Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef OOX_XLS_WORKBOOKSETTINGS_HXX
30 : : #define OOX_XLS_WORKBOOKSETTINGS_HXX
31 : :
32 : : #include "workbookhelper.hxx"
33 : :
34 : : namespace com { namespace sun { namespace star { namespace util { struct Date; } } } }
35 : :
36 : : namespace oox {
37 : : namespace xls {
38 : :
39 : : // ============================================================================
40 : :
41 : : /** Settings for workbook write protection. */
42 : 24 : struct FileSharingModel
43 : : {
44 : : ::rtl::OUString maUserName; /// User who added the write protection password.
45 : : sal_uInt16 mnPasswordHash; /// Hash value of the write protection password.
46 : : bool mbRecommendReadOnly; /// True = recommend read-only mode on opening.
47 : :
48 : : explicit FileSharingModel();
49 : : };
50 : :
51 : : // ============================================================================
52 : :
53 : : /** Global workbook settings. */
54 : 24 : struct WorkbookSettingsModel
55 : : {
56 : : ::rtl::OUString maCodeName; /// VBA codename for the workbook.
57 : : sal_Int32 mnShowObjectMode; /// Specifies how objects are shown.
58 : : sal_Int32 mnUpdateLinksMode; /// Specifies how external links are updated.
59 : : sal_Int32 mnDefaultThemeVer; /// Default theme version.
60 : : bool mbDateMode1904; /// True = null date is 1904-01-01.
61 : : bool mbDateCompatibility; /// False = null date is 1899-12-30.
62 : : bool mbSaveExtLinkValues; /// True = save cached cell values for external links.
63 : :
64 : : explicit WorkbookSettingsModel();
65 : :
66 : : /** Sets BIFF object visibility mode. */
67 : : void setBiffObjectMode( sal_uInt16 nObjMode );
68 : : };
69 : :
70 : : // ============================================================================
71 : :
72 : : /** Workbook calculation settings. */
73 : : struct CalcSettingsModel
74 : : {
75 : : double mfIterateDelta; /// Minimum change in circular references.
76 : : sal_Int32 mnCalcId; /// Calculation engine identifier.
77 : : sal_Int32 mnRefMode; /// Cell reference mode: A1 or R1C1.
78 : : sal_Int32 mnCalcMode; /// Automatic or manual recalculation.
79 : : sal_Int32 mnIterateCount; /// Number of iterations in circular references.
80 : : sal_Int32 mnProcCount; /// Number of processors for concurrent calculation.
81 : : bool mbCalcOnSave; /// True = always recalculate formulas before save.
82 : : bool mbCalcCompleted; /// True = formulas have been recalculated before save.
83 : : bool mbFullPrecision; /// True = use full precision on calculation.
84 : : bool mbIterate; /// True = allow circular references.
85 : : bool mbConcurrent; /// True = concurrent calculation enabled.
86 : : bool mbUseNlr; /// True = use natural language references in formulas.
87 : :
88 : : explicit CalcSettingsModel();
89 : : };
90 : :
91 : : // ============================================================================
92 : :
93 [ - + ]: 48 : class WorkbookSettings : public WorkbookHelper
94 : : {
95 : : public:
96 : : explicit WorkbookSettings( const WorkbookHelper& rHelper );
97 : :
98 : : /** Imports the fileSharing element containing write protection settings. */
99 : : void importFileSharing( const AttributeList& rAttribs );
100 : : /** Imports the workbookPr element containing global workbook settings. */
101 : : void importWorkbookPr( const AttributeList& rAttribs );
102 : : /** Imports the calcPr element containing workbook calculation settings. */
103 : : void importCalcPr( const AttributeList& rAttribs );
104 : :
105 : : /** Imports the FILESHARING record containing write protection settings. */
106 : : void importFileSharing( SequenceInputStream& rStrm );
107 : : /** Imports the WORKBOOKPR record containing global workbook settings. */
108 : : void importWorkbookPr( SequenceInputStream& rStrm );
109 : : /** Imports the CALCPR record containing workbook calculation settings. */
110 : : void importCalcPr( SequenceInputStream& rStrm );
111 : :
112 : : /** Converts the imported workbook settings. */
113 : : void finalizeImport();
114 : :
115 : : /** Returns the show objects mode (considered a view setting in Calc). */
116 : : sal_Int16 getApiShowObjectMode() const;
117 : : /** Returns the nulldate of this workbook. */
118 : : ::com::sun::star::util::Date getNullDate() const;
119 : :
120 : : private:
121 : : /** Updates date mode and unit converter nulldate. */
122 : : void setDateMode( bool bDateMode1904, bool bDateCompatibility=true );
123 : :
124 : : private:
125 : : FileSharingModel maFileSharing;
126 : : WorkbookSettingsModel maBookSettings;
127 : : CalcSettingsModel maCalcSettings;
128 : : };
129 : :
130 : : // ============================================================================
131 : :
132 : : } // namespace xls
133 : : } // namespace oox
134 : :
135 : : #endif
136 : :
137 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|