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>
36#include <oox/token/properties.hxx>
37#include <oox/token/tokens.hxx>
50const sal_uInt32 BIFF12_WORKBOOKPR_DATE1904 = 0x00000001;
51const sal_uInt32 BIFF12_WORKBOOKPR_STRIPEXT = 0x00000080;
53const sal_uInt16 BIFF12_CALCPR_A1 = 0x0002;
54const sal_uInt16 BIFF12_CALCPR_ITERATE = 0x0004;
55const sal_uInt16 BIFF12_CALCPR_FULLPRECISION = 0x0008;
56const sal_uInt16 BIFF12_CALCPR_CALCCOMPLETED = 0x0010;
57const sal_uInt16 BIFF12_CALCPR_CALCONSAVE = 0x0020;
58const sal_uInt16 BIFF12_CALCPR_CONCURRENT = 0x0040;
59const sal_uInt16 BIFF12_CALCPR_MANUALPROC = 0x0080;
62const sal_Int16 API_SHOWMODE_SHOW = 0;
63const sal_Int16 API_SHOWMODE_HIDE = 1;
64const sal_Int16 API_SHOWMODE_PLACEHOLDER = 2;
71 mbRecommendReadOnly( false )
76 mnShowObjectMode( XML_all ),
77 mnUpdateLinksMode( XML_userSet ),
78 mnDefaultThemeVer( -1 ),
79 mbDateMode1904( false ),
80 mbDateCompatibility ( false ),
81 mbSaveExtLinkValues( true )
87 static const sal_Int32 spnObjModes[] = { XML_all, XML_placeholders,
XML_none };
92 mfIterateDelta( 0.001 ),
96 mnIterateCount( 100 ),
99 mbCalcCompleted( true ),
100 mbFullPrecision( true ),
157 nFlags =
rStrm.readuInt32();
168 sal_Int32 nCalcMode, nProcCount;
171 nCalcMode =
rStrm.readInt32();
174 nProcCount =
rStrm.readInt32();
175 nFlags =
rStrm.readuInt16();
177 static const sal_Int32 spnCalcModes[] = { XML_manual, XML_auto, XML_autoNoTable };
193 aPropSet.
setProperty( PROP_RegularExpressions,
false );
203 "com.sun.star.document.Settings" ), UNO_QUERY_THROW );
213 aSettingsProp.
setProperty( PROP_LoadReadonly,
true );
217 Sequence<PropertyValue> aResult{
223 aSettingsProp.
setProperty(PROP_ModifyPasswordInfo, aResult);
243 Reference< XNumberFormatsSupplier > xNumFmtsSupp(
getDocument(), UNO_QUERY );
244 if( xNumFmtsSupp.is() )
246 PropertySet aNumFmtProp( xNumFmtsSupp->getNumberFormatSettings() );
247 aNumFmtProp.
setProperty( PROP_NullDate, aNullDate );
250 Reference< XCalculatable > xCalculatable(
getDocument(), UNO_QUERY );
251 if( xCalculatable.is() )
262 case XML_all:
return API_SHOWMODE_SHOW;
263 case XML_none:
return API_SHOWMODE_HIDE;
265 case XML_placeholders:
return API_SHOWMODE_PLACEHOLDER;
267 return API_SHOWMODE_SHOW;
272 static const css::util::Date saDate1900 ( 30, 12, 1899 );
273 static const css::util::Date saDate1904 ( 1, 1, 1904 );
274 static const css::util::Date saDateBackCompatibility1900( 31, 12, 1899 );
282 saDateBackCompatibility1900;
HRESULT createInstance(REFIID iid, Ifc **ppIfc)
std::optional< OUString > getXString(sal_Int32 nAttrToken) const
std::optional< sal_uInt32 > getUnsigned(sal_Int32 nAttrToken) const
std::optional< sal_Int32 > getInteger(sal_Int32 nAttrToken) const
std::optional< OUString > getString(sal_Int32 nAttrToken) const
std::optional< bool > getBool(sal_Int32 nAttrToken) const
std::optional< sal_Int32 > getToken(sal_Int32 nAttrToken) const
std::optional< double > getDouble(sal_Int32 nAttrToken) const
bool setProperty(sal_Int32 nPropId, const Type &rValue)
utl::MediaDescriptor & getMediaDescriptor() const
void finalizeNullDate(const css::util::Date &rNullDate)
Updates internal nulldate for date/serial conversion.
Helper class to provide access to global workbook data.
::oox::core::XmlFilterBase & getOoxFilter() const
Returns the base OOXML/BIFF12 filter object.
UnitConverter & getUnitConverter() const
Returns the measurement unit converter.
::oox::core::FilterBase & getBaseFilter() const
Returns the base filter object (base class of all filters).
const css::uno::Reference< css::sheet::XSpreadsheetDocument > & getDocument() const
Returns a reference to the source/target spreadsheet document model.
sal_Int16 getApiShowObjectMode() const
Returns the show objects mode (considered a view setting in Calc).
WorkbookSettingsModel maBookSettings
void finalizeImport()
Converts the imported workbook settings.
CalcSettingsModel maCalcSettings
void importCalcPr(const AttributeList &rAttribs)
Imports the calcPr element containing workbook calculation settings.
FileSharingModel maFileSharing
void setDateMode(bool bDateMode1904, bool bDateCompatibility=true)
Updates date mode and unit converter nulldate.
WorkbookSettings(const WorkbookHelper &rHelper)
void importFileSharing(const AttributeList &rAttribs)
Imports the fileSharing element containing write protection settings.
css::util::Date const & getNullDate() const
Returns the nulldate of this workbook.
void importWorkbookPr(const AttributeList &rAttribs)
Imports the workbookPr element containing global workbook settings.
#define STATIC_ARRAY_SELECT(array, index, def)
css::beans::PropertyValue makePropertyValue(const OUString &rName, T &&rValue)
OOX_DLLPUBLIC sal_uInt16 getPasswordHash(const AttributeList &rAttribs, sal_Int32 nElement)
ReturnType getFlagValue(Type nBitField, Type nMask, ReturnType nSet, ReturnType nUnset)
bool getFlag(Type nBitField, Type nMask)
sal_Int32 mnCalcId
Minimum change in circular references.
bool mbCalcOnSave
Number of processors for concurrent calculation.
sal_Int32 mnRefMode
Calculation engine identifier.
sal_Int32 mnProcCount
Number of iterations in circular references.
sal_Int32 mnIterateCount
Automatic or manual recalculation.
bool mbConcurrent
True = allow circular references.
bool mbCalcCompleted
True = always recalculate formulas before save.
bool mbIterate
True = use full precision on calculation.
CalcSettingsModel()
True = concurrent calculation enabled.
sal_Int32 mnCalcMode
Cell reference mode: A1 or R1C1.
bool mbFullPrecision
True = formulas have been recalculated before save.
OUString maAlgorithmName
User who added the write protection password.
OUString maSaltValue
Hash value computed by the algorithm, base-64 encoded.
sal_uInt32 mnSpinCount
Salt value to be prepended to the password, base-64 encoded.
OUString maHashValue
Algorithm name, "SHA-512", "SHA-1", ...
sal_uInt16 mnPasswordHash
Spin count, iterations to run algorithm.
bool mbRecommendReadOnly
Hash value of the write protection password. (unrelated to the above)
FileSharingModel()
True = recommend read-only mode on opening.
void setBiffObjectMode(sal_uInt16 nObjMode)
Sets BIFF object visibility mode.
sal_Int32 mnDefaultThemeVer
Specifies how external links are updated.
bool mbDateCompatibility
True = null date is 1904-01-01.
WorkbookSettingsModel()
True = save cached cell values for external links.
sal_Int32 mnUpdateLinksMode
Specifies how objects are shown.
sal_Int32 mnShowObjectMode
VBA codename for the workbook.
bool mbDateMode1904
Default theme version.
bool mbSaveExtLinkValues
False = null date is 1899-12-30.