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 OOX_XLS_WORKBOOKSETTINGS_HXX
21 : #define OOX_XLS_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 : // ============================================================================
31 :
32 : /** Settings for workbook write protection. */
33 11 : struct FileSharingModel
34 : {
35 : ::rtl::OUString maUserName; /// User who added the write protection password.
36 : sal_uInt16 mnPasswordHash; /// Hash value of the write protection password.
37 : bool mbRecommendReadOnly; /// True = recommend read-only mode on opening.
38 :
39 : explicit FileSharingModel();
40 : };
41 :
42 : // ============================================================================
43 :
44 : /** Global workbook settings. */
45 11 : struct WorkbookSettingsModel
46 : {
47 : ::rtl::OUString maCodeName; /// VBA codename for the workbook.
48 : sal_Int32 mnShowObjectMode; /// Specifies how objects are shown.
49 : sal_Int32 mnUpdateLinksMode; /// Specifies how external links are updated.
50 : sal_Int32 mnDefaultThemeVer; /// Default theme version.
51 : bool mbDateMode1904; /// True = null date is 1904-01-01.
52 : bool mbDateCompatibility; /// False = null date is 1899-12-30.
53 : bool mbSaveExtLinkValues; /// True = save cached cell values for external links.
54 :
55 : explicit WorkbookSettingsModel();
56 :
57 : /** Sets BIFF object visibility mode. */
58 : void setBiffObjectMode( sal_uInt16 nObjMode );
59 : };
60 :
61 : // ============================================================================
62 :
63 : /** Workbook calculation settings. */
64 : struct CalcSettingsModel
65 : {
66 : double mfIterateDelta; /// Minimum change in circular references.
67 : sal_Int32 mnCalcId; /// Calculation engine identifier.
68 : sal_Int32 mnRefMode; /// Cell reference mode: A1 or R1C1.
69 : sal_Int32 mnCalcMode; /// Automatic or manual recalculation.
70 : sal_Int32 mnIterateCount; /// Number of iterations in circular references.
71 : sal_Int32 mnProcCount; /// Number of processors for concurrent calculation.
72 : bool mbCalcOnSave; /// True = always recalculate formulas before save.
73 : bool mbCalcCompleted; /// True = formulas have been recalculated before save.
74 : bool mbFullPrecision; /// True = use full precision on calculation.
75 : bool mbIterate; /// True = allow circular references.
76 : bool mbConcurrent; /// True = concurrent calculation enabled.
77 : bool mbUseNlr; /// True = use natural language references in formulas.
78 :
79 : explicit CalcSettingsModel();
80 : };
81 :
82 : // ============================================================================
83 :
84 22 : class WorkbookSettings : public WorkbookHelper
85 : {
86 : public:
87 : explicit WorkbookSettings( const WorkbookHelper& rHelper );
88 :
89 : /** Imports the fileSharing element containing write protection settings. */
90 : void importFileSharing( const AttributeList& rAttribs );
91 : /** Imports the workbookPr element containing global workbook settings. */
92 : void importWorkbookPr( const AttributeList& rAttribs );
93 : /** Imports the calcPr element containing workbook calculation settings. */
94 : void importCalcPr( const AttributeList& rAttribs );
95 :
96 : /** Imports the FILESHARING record containing write protection settings. */
97 : void importFileSharing( SequenceInputStream& rStrm );
98 : /** Imports the WORKBOOKPR record containing global workbook settings. */
99 : void importWorkbookPr( SequenceInputStream& rStrm );
100 : /** Imports the CALCPR record containing workbook calculation settings. */
101 : void importCalcPr( SequenceInputStream& rStrm );
102 :
103 : /** Converts the imported workbook settings. */
104 : void finalizeImport();
105 :
106 : /** Returns the show objects mode (considered a view setting in Calc). */
107 : sal_Int16 getApiShowObjectMode() const;
108 : /** Returns the nulldate of this workbook. */
109 : ::com::sun::star::util::Date getNullDate() const;
110 :
111 : private:
112 : /** Updates date mode and unit converter nulldate. */
113 : void setDateMode( bool bDateMode1904, bool bDateCompatibility=true );
114 :
115 : private:
116 : FileSharingModel maFileSharing;
117 : WorkbookSettingsModel maBookSettings;
118 : CalcSettingsModel maCalcSettings;
119 : };
120 :
121 : // ============================================================================
122 :
123 : } // namespace xls
124 : } // namespace oox
125 :
126 : #endif
127 :
128 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|