Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef INCLUDED_SC_SOURCE_FILTER_INC_WORKBOOKSETTINGS_HXX
21 : #define INCLUDED_SC_SOURCE_FILTER_INC_WORKBOOKSETTINGS_HXX
22 :
23 : #include "workbookhelper.hxx"
24 :
25 : namespace com { namespace sun { namespace star { namespace util { struct Date; } } } }
26 :
27 : namespace oox {
28 : namespace xls {
29 :
30 : /** Settings for workbook write protection. */
31 145 : struct FileSharingModel
32 : {
33 : OUString maUserName; /// User who added the write protection password.
34 : sal_uInt16 mnPasswordHash; /// Hash value of the write protection password.
35 : bool mbRecommendReadOnly; /// True = recommend read-only mode on opening.
36 :
37 : explicit FileSharingModel();
38 : };
39 :
40 : /** Global workbook settings. */
41 145 : struct WorkbookSettingsModel
42 : {
43 : OUString maCodeName; /// VBA codename for the workbook.
44 : sal_Int32 mnShowObjectMode; /// Specifies how objects are shown.
45 : sal_Int32 mnUpdateLinksMode; /// Specifies how external links are updated.
46 : sal_Int32 mnDefaultThemeVer; /// Default theme version.
47 : bool mbDateMode1904; /// True = null date is 1904-01-01.
48 : bool mbDateCompatibility; /// False = null date is 1899-12-30.
49 : bool mbSaveExtLinkValues; /// True = save cached cell values for external links.
50 :
51 : explicit WorkbookSettingsModel();
52 :
53 : /** Sets BIFF object visibility mode. */
54 : void setBiffObjectMode( sal_uInt16 nObjMode );
55 : };
56 :
57 : /** Workbook calculation settings. */
58 : struct CalcSettingsModel
59 : {
60 : double mfIterateDelta; /// Minimum change in circular references.
61 : sal_Int32 mnCalcId; /// Calculation engine identifier.
62 : sal_Int32 mnRefMode; /// Cell reference mode: A1 or R1C1.
63 : sal_Int32 mnCalcMode; /// Automatic or manual recalculation.
64 : sal_Int32 mnIterateCount; /// Number of iterations in circular references.
65 : sal_Int32 mnProcCount; /// Number of processors for concurrent calculation.
66 : bool mbCalcOnSave; /// True = always recalculate formulas before save.
67 : bool mbCalcCompleted; /// True = formulas have been recalculated before save.
68 : bool mbFullPrecision; /// True = use full precision on calculation.
69 : bool mbIterate; /// True = allow circular references.
70 : bool mbConcurrent; /// True = concurrent calculation enabled.
71 : bool mbUseNlr; /// True = use natural language references in formulas.
72 :
73 : explicit CalcSettingsModel();
74 : };
75 :
76 290 : class WorkbookSettings : public WorkbookHelper
77 : {
78 : public:
79 : explicit WorkbookSettings( const WorkbookHelper& rHelper );
80 :
81 : /** Imports the fileSharing element containing write protection settings. */
82 : void importFileSharing( const AttributeList& rAttribs );
83 : /** Imports the workbookPr element containing global workbook settings. */
84 : void importWorkbookPr( const AttributeList& rAttribs );
85 : /** Imports the calcPr element containing workbook calculation settings. */
86 : void importCalcPr( const AttributeList& rAttribs );
87 :
88 : /** Imports the FILESHARING record containing write protection settings. */
89 : void importFileSharing( SequenceInputStream& rStrm );
90 : /** Imports the WORKBOOKPR record containing global workbook settings. */
91 : void importWorkbookPr( SequenceInputStream& rStrm );
92 : /** Imports the CALCPR record containing workbook calculation settings. */
93 : void importCalcPr( SequenceInputStream& rStrm );
94 :
95 : /** Converts the imported workbook settings. */
96 : void finalizeImport();
97 :
98 : /** Returns the show objects mode (considered a view setting in Calc). */
99 : sal_Int16 getApiShowObjectMode() const;
100 : /** Returns the nulldate of this workbook. */
101 : ::com::sun::star::util::Date getNullDate() const;
102 :
103 : private:
104 : /** Updates date mode and unit converter nulldate. */
105 : void setDateMode( bool bDateMode1904, bool bDateCompatibility=true );
106 :
107 : private:
108 : FileSharingModel maFileSharing;
109 : WorkbookSettingsModel maBookSettings;
110 : CalcSettingsModel maCalcSettings;
111 : };
112 :
113 : } // namespace xls
114 : } // namespace oox
115 :
116 : #endif
117 :
118 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|