2004-04-09 09:05:39 -04:00
|
|
|
/* ====================================================================
|
2006-12-22 14:18:16 -05:00
|
|
|
Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
contributor license agreements. See the NOTICE file distributed with
|
|
|
|
this work for additional information regarding copyright ownership.
|
|
|
|
The ASF licenses this file to You under the Apache License, Version 2.0
|
|
|
|
(the "License"); you may not use this file except in compliance with
|
|
|
|
the License. You may obtain a copy of the License at
|
2004-04-09 09:05:39 -04:00
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
==================================================================== */
|
2004-04-09 07:45:38 -04:00
|
|
|
package org.apache.poi.ddf;
|
|
|
|
|
2012-03-05 04:44:20 -05:00
|
|
|
import org.apache.poi.util.Internal;
|
|
|
|
|
2004-04-09 07:45:38 -04:00
|
|
|
/**
|
2011-07-29 03:01:39 -04:00
|
|
|
* The opt record is used to store property values for a shape. It is the key to
|
|
|
|
* determining the attributes of a shape. Properties can be of two types: simple
|
|
|
|
* or complex. Simple types are fixed length. Complex properties are variable
|
|
|
|
* length.
|
2004-04-09 07:45:38 -04:00
|
|
|
*/
|
2011-07-29 03:01:39 -04:00
|
|
|
public class EscherOptRecord extends AbstractEscherOptRecord
|
2004-04-09 07:45:38 -04:00
|
|
|
{
|
|
|
|
public static final String RECORD_DESCRIPTION = "msofbtOPT";
|
2011-09-06 07:13:41 -04:00
|
|
|
public static final short RECORD_ID = (short) 0xF00B;
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public short getInstance()
|
|
|
|
{
|
2016-12-04 18:49:49 -05:00
|
|
|
setInstance( (short) getEscherProperties().size() );
|
2011-09-06 07:13:41 -04:00
|
|
|
return super.getInstance();
|
|
|
|
}
|
2004-04-09 07:45:38 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Automatically recalculate the correct option
|
|
|
|
*/
|
2016-06-06 19:33:00 -04:00
|
|
|
@Override
|
2012-03-05 04:44:20 -05:00
|
|
|
@Internal
|
2004-04-09 07:45:38 -04:00
|
|
|
public short getOptions()
|
|
|
|
{
|
2011-09-06 07:13:41 -04:00
|
|
|
// update values
|
|
|
|
getInstance();
|
|
|
|
getVersion();
|
2004-04-09 07:45:38 -04:00
|
|
|
return super.getOptions();
|
|
|
|
}
|
|
|
|
|
2016-06-06 19:33:00 -04:00
|
|
|
@Override
|
2011-07-29 03:01:39 -04:00
|
|
|
public String getRecordName()
|
2004-04-09 07:45:38 -04:00
|
|
|
{
|
2011-07-29 03:01:39 -04:00
|
|
|
return "Opt";
|
2011-07-19 08:19:48 -04:00
|
|
|
}
|
2011-09-06 07:13:41 -04:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public short getVersion()
|
|
|
|
{
|
|
|
|
setVersion( (short) 0x3 );
|
|
|
|
return super.getVersion();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void setVersion( short value )
|
|
|
|
{
|
|
|
|
if ( value != 0x3 )
|
|
|
|
throw new IllegalArgumentException( RECORD_DESCRIPTION
|
|
|
|
+ " can have only '0x3' version" );
|
|
|
|
|
|
|
|
super.setVersion( value );
|
|
|
|
}
|
2004-04-09 07:45:38 -04:00
|
|
|
}
|