22 #include <com/sun/star/sheet/XCalculatable.hpp>
23 #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
24 #include <com/sun/star/util/Date.hpp>
25 #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
26 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
34 #include <oox/token/properties.hxx>
35 #include <oox/token/tokens.hxx>
48 const sal_uInt32 BIFF12_WORKBOOKPR_DATE1904 = 0x00000001;
49 const sal_uInt32 BIFF12_WORKBOOKPR_STRIPEXT = 0x00000080;
51 const sal_uInt16 BIFF12_CALCPR_A1 = 0x0002;
52 const sal_uInt16 BIFF12_CALCPR_ITERATE = 0x0004;
53 const sal_uInt16 BIFF12_CALCPR_FULLPRECISION = 0x0008;
54 const sal_uInt16 BIFF12_CALCPR_CALCCOMPLETED = 0x0010;
55 const sal_uInt16 BIFF12_CALCPR_CALCONSAVE = 0x0020;
56 const sal_uInt16 BIFF12_CALCPR_CONCURRENT = 0x0040;
57 const sal_uInt16 BIFF12_CALCPR_MANUALPROC = 0x0080;
60 const sal_Int16 API_SHOWMODE_SHOW = 0;
61 const sal_Int16 API_SHOWMODE_HIDE = 1;
62 const sal_Int16 API_SHOWMODE_PLACEHOLDER = 2;
69 mbRecommendReadOnly( false )
74 mnShowObjectMode( XML_all ),
75 mnUpdateLinksMode( XML_userSet ),
76 mnDefaultThemeVer( -1 ),
77 mbDateMode1904( false ),
78 mbDateCompatibility ( false ),
79 mbSaveExtLinkValues( true )
85 static const sal_Int32 spnObjModes[] = { XML_all, XML_placeholders, XML_none };
90 mfIterateDelta( 0.001 ),
94 mnIterateCount( 100 ),
97 mbCalcCompleted( true ),
98 mbFullPrecision( true ),
166 sal_Int32 nCalcMode, nProcCount;
175 static const sal_Int32 spnCalcModes[] = { XML_manual, XML_auto, XML_autoNoTable };
191 aPropSet.
setProperty( PROP_RegularExpressions,
false );
201 "com.sun.star.document.Settings" ), UNO_QUERY_THROW );
211 aSettingsProp.
setProperty( PROP_LoadReadonly,
true );
237 Reference< XNumberFormatsSupplier > xNumFmtsSupp(
getDocument(), UNO_QUERY );
238 if( xNumFmtsSupp.is() )
240 PropertySet aNumFmtProp( xNumFmtsSupp->getNumberFormatSettings() );
241 aNumFmtProp.
setProperty( PROP_NullDate, aNullDate );
244 Reference< XCalculatable > xCalculatable(
getDocument(), UNO_QUERY );
245 if( xCalculatable.is() )
256 case XML_all:
return API_SHOWMODE_SHOW;
257 case XML_none:
return API_SHOWMODE_HIDE;
259 case XML_placeholders:
return API_SHOWMODE_PLACEHOLDER;
261 return API_SHOWMODE_SHOW;
266 static const css::util::Date saDate1900 ( 30, 12, 1899 );
267 static const css::util::Date saDate1904 ( 1, 1, 1904 );
268 static const css::util::Date saDateBackCompatibility1900( 31, 12, 1899 );
276 saDateBackCompatibility1900;
Helper class to provide access to global workbook data.
OUString maAlgorithmName
User who added the write protection password.
WorkbookSettings(const WorkbookHelper &rHelper)
CalcSettingsModel()
True = concurrent calculation enabled.
OptValue< bool > getBool(sal_Int32 nAttrToken) const
sal_Int16 getApiShowObjectMode() const
Returns the show objects mode (considered a view setting in Calc).
UnitConverter & getUnitConverter() const
Returns the measurement unit converter.
bool mbRecommendReadOnly
Hash value of the write protection password. (unrelated to the above)
OptValue< OUString > getXString(sal_Int32 nAttrToken) const
void importWorkbookPr(const AttributeList &rAttribs)
Imports the workbookPr element containing global workbook settings.
bool mbCalcCompleted
True = always recalculate formulas before save.
OptValue< sal_Int32 > getInteger(sal_Int32 nAttrToken) const
bool mbConcurrent
True = allow circular references.
void setBiffObjectMode(sal_uInt16 nObjMode)
Sets BIFF object visibility mode.
CalcSettingsModel maCalcSettings
sal_uInt32 mnSpinCount
Salt value to be prepended to the password, base-64 encoded.
void importCalcPr(const AttributeList &rAttribs)
Imports the calcPr element containing workbook calculation settings.
OptValue< double > getDouble(sal_Int32 nAttrToken) const
void setDateMode(bool bDateMode1904, bool bDateCompatibility=true)
Updates date mode and unit converter nulldate.
#define STATIC_ARRAY_SELECT(array, index, def)
OptValue< OUString > getString(sal_Int32 nAttrToken) const
bool mbIterate
True = use full precision on calculation.
OOX_DLLPUBLIC sal_uInt16 getPasswordHash(const AttributeList &rAttribs, sal_Int32 nElement)
utl::MediaDescriptor & getMediaDescriptor() const
::oox::core::FilterBase & getBaseFilter() const
Returns the base filter object (base class of all filters).
OUString maHashValue
Algorithm name, "SHA-512", "SHA-1", ...
FileSharingModel()
True = recommend read-only mode on opening.
void finalizeNullDate(const css::util::Date &rNullDate)
Updates internal nulldate for date/serial conversion.
OptValue< sal_uInt32 > getUnsigned(sal_Int32 nAttrToken) const
bool getFlag(Type nBitField, Type nMask)
sal_uInt16 mnPasswordHash
Spin count, iterations to run algorithm.
bool mbDateCompatibility
True = null date is 1904-01-01.
WorkbookSettingsModel()
True = save cached cell values for external links.
WorkbookSettingsModel maBookSettings
const css::uno::Reference< css::sheet::XSpreadsheetDocument > & getDocument() const
Returns a reference to the source/target spreadsheet document model.
sal_Int32 mnDefaultThemeVer
Specifies how external links are updated.
HRESULT createInstance(REFIID iid, Ifc **ppIfc)
::oox::core::XmlFilterBase & getOoxFilter() const
Returns the base OOXML/BIFF12 filter object.
FileSharingModel maFileSharing
css::util::Date const & getNullDate() const
Returns the nulldate of this workbook.
sal_Int32 mnIterateCount
Automatic or manual recalculation.
sal_Int32 mnRefMode
Calculation engine identifier.
OUString maSaltValue
Hash value computed by the algorithm, base-64 encoded.
sal_Int32 mnShowObjectMode
VBA codename for the workbook.
sal_Int32 mnCalcId
Minimum change in circular references.
ReturnType getFlagValue(Type nBitField, Type nMask, ReturnType nSet, ReturnType nUnset)
sal_Int32 mnUpdateLinksMode
Specifies how objects are shown.
bool mbFullPrecision
True = formulas have been recalculated before save.
void importFileSharing(const AttributeList &rAttribs)
Imports the fileSharing element containing write protection settings.
bool mbSaveExtLinkValues
False = null date is 1899-12-30.
sal_Int32 mnProcCount
Number of iterations in circular references.
sal_Int32 mnCalcMode
Cell reference mode: A1 or R1C1.
void finalizeImport()
Converts the imported workbook settings.
bool mbCalcOnSave
Number of processors for concurrent calculation.
bool setProperty(sal_Int32 nPropId, const Type &rValue)
OptValue< sal_Int32 > getToken(sal_Int32 nAttrToken) const
bool mbDateMode1904
Default theme version.