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_WORKSHEETSETTINGS_HXX 21 #define INCLUDED_SC_SOURCE_FILTER_INC_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 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 struct SheetProtectionModel 45 { 46 OUString maAlgorithmName; /// Algorithm name, "SHA-512", "SHA-1", ... 47 OUString maHashValue; /// Hash value computed by the algorithm, base-64 encoded 48 OUString maSaltValue; /// Salt value to be prepended to the password, base-64 encoded 49 sal_uInt32 mnSpinCount; /// Spin count, iterations to run algorithm 50 sal_uInt16 mnPasswordHash; /// Hash value from sheet protection password. (unrelated to the above) 51 bool mbSheet; /// True = sheet protection enabled, locked cells are protected. 52 bool mbObjects; /// True = objects locked. 53 bool mbScenarios; /// True = scenarios locked. 54 bool mbFormatCells; /// True = format cells locked. 55 bool mbFormatColumns; /// True = format columns locked. 56 bool mbFormatRows; /// True = format rows locked. 57 bool mbInsertColumns; /// True = insert columns locked. 58 bool mbInsertRows; /// True = insert rows locked. 59 bool mbInsertHyperlinks; /// True = insert hyperlinks locked. 60 bool mbDeleteColumns; /// True = delete columns locked. 61 bool mbDeleteRows; /// True = delete rows locked. 62 bool mbSelectLocked; /// True = select locked cells locked. 63 bool mbSort; /// True = sorting locked. 64 bool mbAutoFilter; /// True = autofilters locked. 65 bool mbPivotTables; /// True = pivot tables locked. 66 bool mbSelectUnlocked; /// True = select unlocked cells locked. 67 68 ::std::vector< ScEnhancedProtection > maEnhancedProtections; 69 70 explicit SheetProtectionModel(); 71 }; 72 73 class WorksheetSettings : public WorksheetHelper 74 { 75 public: 76 explicit WorksheetSettings( const WorksheetHelper& rHelper ); 77 78 /** Imports sheet settings from the sheetPr element. */ 79 void importSheetPr( const AttributeList& rAttribs ); 80 /** Imports chart sheet settings from the sheetPr element. */ 81 void importChartSheetPr( const AttributeList& rAttribs ); 82 /** Imports the sheet tab color from the tabColor element. */ 83 void importTabColor( const AttributeList& rAttribs ); 84 /** Imports outline settings from the outlinePr element. */ 85 void importOutlinePr( const AttributeList& rAttribs ); 86 /** Imports protection settings from the sheetProtection element. */ 87 void importSheetProtection( const AttributeList& rAttribs ); 88 /** Imports enhanced protection settings from the protectedRange element. */ 89 void importProtectedRange( const AttributeList& rAttribs ); 90 /** Imports protection settings from the sheetProtection element of a chart sheet. */ 91 void importChartProtection( const AttributeList& rAttribs ); 92 /** Imports phonetic settings from the phoneticPr element. */ 93 void importPhoneticPr( const AttributeList& rAttribs ); 94 95 /** Imports sheet properties from the SHEETPR record. */ 96 void importSheetPr( SequenceInputStream& rStrm ); 97 /** Imports sheet properties from the CHARTSHEETPR record. */ 98 void importChartSheetPr( SequenceInputStream& rStrm ); 99 /** Imports sheet protection settings from the SHEETPROTECTION record. */ 100 void importSheetProtection( SequenceInputStream& rStrm ); 101 /** Imports chart sheet protection settings from the CHARTPROTECTION record. */ 102 void importChartProtection( SequenceInputStream& rStrm ); 103 /** Imports phonetic settings from the PHONETICPR record. */ 104 void importPhoneticPr( SequenceInputStream& rStrm ); 105 106 /** Converts the imported worksheet settings. */ 107 void finalizeImport(); 108 109 private: 110 PhoneticSettings maPhoneticSett; 111 SheetSettingsModel maSheetSettings; 112 SheetProtectionModel maSheetProt; 113 }; 114 115 } // namespace xls 116 } // namespace oox 117 118 #endif 119 120 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 121