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