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_WORKSHEETSETTINGS_HXX
21 : #define OOX_XLS_WORKSHEETSETTINGS_HXX
22 :
23 : #include "richstring.hxx"
24 : #include "worksheethelper.hxx"
25 : #include "tabprotection.hxx"
26 :
27 : namespace oox {
28 : namespace xls {
29 :
30 : /** Sheet and outline settings. */
31 0 : struct SheetSettingsModel
32 : {
33 : OUString maCodeName; /// VBA module codename.
34 : Color maTabColor; /// Sheet tab color.
35 : bool mbFilterMode; /// True = sheet contains active filter.
36 : bool mbApplyStyles; /// True = automatic styles when creating outlines.
37 : bool mbSummaryBelow; /// True = row outline symbols below group.
38 : bool mbSummaryRight; /// True = column outline symbols right of group.
39 :
40 : explicit SheetSettingsModel();
41 : };
42 :
43 : /** Sheet protection settings. */
44 0 : struct SheetProtectionModel
45 : {
46 : sal_uInt16 mnPasswordHash; /// Hash value from sheet protection password.
47 : bool mbSheet; /// True = sheet protection enabled, locked cells are protcted.
48 : bool mbObjects; /// True = objects locked.
49 : bool mbScenarios; /// True = scenarios locked.
50 : bool mbFormatCells; /// True = format cells locked.
51 : bool mbFormatColumns; /// True = format columns locked.
52 : bool mbFormatRows; /// True = format rows locked.
53 : bool mbInsertColumns; /// True = insert columns locked.
54 : bool mbInsertRows; /// True = insert rows locked.
55 : bool mbInsertHyperlinks; /// True = insert hyperlinks locked.
56 : bool mbDeleteColumns; /// True = delete columns locked.
57 : bool mbDeleteRows; /// True = delete rows locked.
58 : bool mbSelectLocked; /// True = select locked cells locked.
59 : bool mbSort; /// True = sorting locked.
60 : bool mbAutoFilter; /// True = autofilters locked.
61 : bool mbPivotTables; /// True = pivot tables locked.
62 : bool mbSelectUnlocked; /// True = select unlocked cells locked.
63 :
64 : ::std::vector< ScEnhancedProtection > maEnhancedProtections;
65 :
66 : explicit SheetProtectionModel();
67 : };
68 :
69 0 : class WorksheetSettings : public WorksheetHelper
70 : {
71 : public:
72 : explicit WorksheetSettings( const WorksheetHelper& rHelper );
73 :
74 : /** Imports sheet settings from the sheetPr element. */
75 : void importSheetPr( const AttributeList& rAttribs );
76 : /** Imports chart sheet settings from the sheetPr element. */
77 : void importChartSheetPr( const AttributeList& rAttribs );
78 : /** Imports the sheet tab color from the tabColor element. */
79 : void importTabColor( const AttributeList& rAttribs );
80 : /** Imports outline settings from the outlinePr element. */
81 : void importOutlinePr( const AttributeList& rAttribs );
82 : /** Imports protection settings from the sheetProtection element. */
83 : void importSheetProtection( const AttributeList& rAttribs );
84 : /** Imports enhanced protection settings from the protectedRanges element. */
85 : void importProtectedRanges( const AttributeList& rAttribs );
86 : /** Imports enhanced protection settings from the protectedRange element. */
87 : void importProtectedRange( const AttributeList& rAttribs );
88 : /** Imports protection settings from the sheetProtection element of a chart sheet. */
89 : void importChartProtection( const AttributeList& rAttribs );
90 : /** Imports phonetic settings from the phoneticPr element. */
91 : void importPhoneticPr( const AttributeList& rAttribs );
92 :
93 : /** Imports sheet properties from the SHEETPR record. */
94 : void importSheetPr( SequenceInputStream& rStrm );
95 : /** Imports sheet properties from the CHARTSHEETPR record. */
96 : void importChartSheetPr( SequenceInputStream& rStrm );
97 : /** Imports sheet protection settings from the SHEETPROTECTION record. */
98 : void importSheetProtection( SequenceInputStream& rStrm );
99 : /** Imports chart sheet protection settings from the CHARTPROTECTION record. */
100 : void importChartProtection( SequenceInputStream& rStrm );
101 : /** Imports phonetic settings from the PHONETICPR record. */
102 : void importPhoneticPr( SequenceInputStream& rStrm );
103 :
104 : /** Converts the imported worksheet settings. */
105 : void finalizeImport();
106 :
107 : private:
108 : PhoneticSettings maPhoneticSett;
109 : SheetSettingsModel maSheetSettings;
110 : SheetProtectionModel maSheetProt;
111 : };
112 :
113 : } // namespace xls
114 : } // namespace oox
115 :
116 : #endif
117 :
118 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|