LibreOffice Module sc (master)  1
sheetdata.hxx
Go to the documentation of this file.
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 #pragma once
21 
22 #include <editeng/editdata.hxx>
23 #include <map>
24 #include <unordered_set>
25 #include <vector>
26 
27 #include "address.hxx"
28 
29 class SvXMLNamespaceMap;
30 enum class XmlStyleFamily;
31 
33 {
34  sal_Int32 mnStartOffset;
35  sal_Int32 mnEndOffset;
36 
38  mnStartOffset(-1),
39  mnEndOffset(-1)
40  {
41  }
42 
43  ScStreamEntry( sal_Int32 nStart, sal_Int32 nEnd ) :
44  mnStartOffset(nStart),
45  mnEndOffset(nEnd)
46  {
47  }
48 };
49 
51 {
52  OUString maName;
54 
55  ScCellStyleEntry( const OUString& rName, const ScAddress& rPos ) :
56  maName(rName),
57  maCellPos(rPos)
58  {
59  }
60 };
61 
63 {
64  OUString maStyleName;
65  OUString maTextStyle;
67 
68  ScNoteStyleEntry( const OUString& rStyle, const OUString& rText, const ScAddress& rPos ) :
69  maStyleName(rStyle),
70  maTextStyle(rText),
71  maCellPos(rPos)
72  {
73  }
74 };
75 
77 {
78  OUString maName;
81 
82  ScTextStyleEntry( const OUString& rName, const ScAddress& rPos, const ESelection& rSel ) :
83  maName(rName),
84  maCellPos(rPos),
85  maSelection(rSel)
86  {
87  }
88 };
89 
91 {
92  OUString maPrefix;
93  OUString maName;
94  sal_uInt16 mnKey;
95 
96  ScLoadedNamespaceEntry( const OUString& rPrefix, const OUString& rName, sal_uInt16 nKey ) :
97  maPrefix(rPrefix),
98  maName(rName),
99  mnKey(nKey)
100  {
101  }
102 };
103 
105 {
106  std::unordered_set<OUString> maInitialPrefixes;
107  std::vector<ScLoadedNamespaceEntry> maLoadedNamespaces;
108 
109  std::vector<ScCellStyleEntry> maCellStyles;
110  std::vector<ScCellStyleEntry> maColumnStyles;
111  std::vector<ScCellStyleEntry> maRowStyles;
112  std::vector<ScCellStyleEntry> maTableStyles;
113  std::vector<ScNoteStyleEntry> maNoteStyles;
114  std::vector<ScTextStyleEntry> maNoteParaStyles;
115  std::vector<ScTextStyleEntry> maNoteTextStyles;
116  std::vector<ScTextStyleEntry> maTextStyles;
117  std::vector<bool> maBlocked;
118  std::vector<ScStreamEntry> maStreamEntries;
119  std::vector<ScStreamEntry> maSaveEntries;
121  sal_Int32 mnStartOffset;
122 
124 
126 
127 public:
128  ScSheetSaveData();
130 
131  void AddCellStyle( const OUString& rName, const ScAddress& rCellPos );
132  void AddColumnStyle( const OUString& rName, const ScAddress& rCellPos );
133  void AddRowStyle( const OUString& rName, const ScAddress& rCellPos );
134  void AddTableStyle( const OUString& rName, const ScAddress& rCellPos );
135 
136  void HandleNoteStyles( const OUString& rStyleName, const OUString& rTextName, const ScAddress& rCellPos );
137  void AddNoteContentStyle( XmlStyleFamily nFamily, const OUString& rName, const ScAddress& rCellPos, const ESelection& rSelection );
138 
139  void AddTextStyle( const OUString& rName, const ScAddress& rCellPos, const ESelection& rSelection );
140 
141  void BlockSheet( SCTAB nTab );
142  bool IsSheetBlocked( SCTAB nTab ) const;
143 
144  void AddStreamPos( SCTAB nTab, sal_Int32 nStartOffset, sal_Int32 nEndOffset );
145  void GetStreamPos( SCTAB nTab, sal_Int32& rStartOffset, sal_Int32& rEndOffset ) const;
146  bool HasStreamPos( SCTAB nTab ) const;
147 
148  void StartStreamPos( SCTAB nTab, sal_Int32 nStartOffset );
149  void EndStreamPos( sal_Int32 nEndOffset );
150 
151  bool HasStartPos() const { return mnStartTab >= 0; }
152 
153  void ResetSaveEntries();
154  void AddSavePos( SCTAB nTab, sal_Int32 nStartOffset, sal_Int32 nEndOffset );
155  void UseSaveEntries();
156 
157  void StoreInitialNamespaces( const SvXMLNamespaceMap& rNamespaces );
158  void StoreLoadedNamespaces( const SvXMLNamespaceMap& rNamespaces );
159  bool AddLoadedNamespaces( SvXMLNamespaceMap& rNamespaces ) const;
160 
161  const std::vector<ScCellStyleEntry>& GetCellStyles() const { return maCellStyles; }
162  const std::vector<ScCellStyleEntry>& GetColumnStyles() const { return maColumnStyles; }
163  const std::vector<ScCellStyleEntry>& GetRowStyles() const { return maRowStyles; }
164  const std::vector<ScCellStyleEntry>& GetTableStyles() const { return maTableStyles; }
165  const std::vector<ScNoteStyleEntry>& GetNoteStyles() const { return maNoteStyles; }
166  const std::vector<ScTextStyleEntry>& GetNoteParaStyles() const { return maNoteParaStyles; }
167  const std::vector<ScTextStyleEntry>& GetNoteTextStyles() const { return maNoteTextStyles; }
168  const std::vector<ScTextStyleEntry>& GetTextStyles() const { return maTextStyles; }
169 
170  bool IsInSupportedSave() const { return mbInSupportedSave;}
171  void SetInSupportedSave( bool bSet );
172 };
173 
175 {
176  std::map<sal_uInt64, OUString> maIDToName;
177 };
178 
179 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void HandleNoteStyles(const OUString &rStyleName, const OUString &rTextName, const ScAddress &rCellPos)
Definition: sheetdata.cxx:61
const std::vector< ScNoteStyleEntry > & GetNoteStyles() const
Definition: sheetdata.hxx:165
bool HasStreamPos(SCTAB nTab) const
Definition: sheetdata.cxx:146
std::vector< ScTextStyleEntry > maNoteParaStyles
Definition: sheetdata.hxx:114
bool HasStartPos() const
Definition: sheetdata.hxx:151
void StartStreamPos(SCTAB nTab, sal_Int32 nStartOffset)
Definition: sheetdata.cxx:116
const std::vector< ScTextStyleEntry > & GetNoteTextStyles() const
Definition: sheetdata.hxx:167
const std::vector< ScCellStyleEntry > & GetColumnStyles() const
Definition: sheetdata.hxx:162
void StoreInitialNamespaces(const SvXMLNamespaceMap &rNamespaces)
Definition: sheetdata.cxx:172
ScAddress maCellPos
Definition: sheetdata.hxx:53
void AddColumnStyle(const OUString &rName, const ScAddress &rCellPos)
Definition: sheetdata.cxx:46
bool AddLoadedNamespaces(SvXMLNamespaceMap &rNamespaces) const
Definition: sheetdata.cxx:205
void AddStreamPos(SCTAB nTab, sal_Int32 nStartOffset, sal_Int32 nEndOffset)
Definition: sheetdata.cxx:108
OUString maTextStyle
Definition: sheetdata.hxx:65
OUString maName
Definition: sheetdata.hxx:52
ScAddress maCellPos
Definition: sheetdata.hxx:79
void BlockSheet(SCTAB nTab)
Definition: sheetdata.cxx:92
void UseSaveEntries()
Definition: sheetdata.cxx:167
std::vector< ScLoadedNamespaceEntry > maLoadedNamespaces
Definition: sheetdata.hxx:107
ScLoadedNamespaceEntry(const OUString &rPrefix, const OUString &rName, sal_uInt16 nKey)
Definition: sheetdata.hxx:96
ESelection maSelection
Definition: sheetdata.hxx:80
std::vector< ScTextStyleEntry > maNoteTextStyles
Definition: sheetdata.hxx:115
const std::vector< ScTextStyleEntry > & GetTextStyles() const
Definition: sheetdata.hxx:168
XmlStyleFamily
ScNoteStyleEntry maPreviousNote
Definition: sheetdata.hxx:123
ScTextStyleEntry(const OUString &rName, const ScAddress &rPos, const ESelection &rSel)
Definition: sheetdata.hxx:82
void AddSavePos(SCTAB nTab, sal_Int32 nStartOffset, sal_Int32 nEndOffset)
Definition: sheetdata.cxx:159
void AddTextStyle(const OUString &rName, const ScAddress &rCellPos, const ESelection &rSelection)
Definition: sheetdata.cxx:87
std::vector< ScStreamEntry > maStreamEntries
Definition: sheetdata.hxx:118
void ResetSaveEntries()
Definition: sheetdata.cxx:154
OUString maName
Definition: sheetdata.hxx:78
ScNoteStyleEntry(const OUString &rStyle, const OUString &rText, const ScAddress &rPos)
Definition: sheetdata.hxx:68
void AddTableStyle(const OUString &rName, const ScAddress &rCellPos)
Definition: sheetdata.cxx:56
void AddNoteContentStyle(XmlStyleFamily nFamily, const OUString &rName, const ScAddress &rCellPos, const ESelection &rSelection)
Definition: sheetdata.cxx:79
bool mbInSupportedSave
Definition: sheetdata.hxx:125
ScCellStyleEntry(const OUString &rName, const ScAddress &rPos)
Definition: sheetdata.hxx:55
void EndStreamPos(sal_Int32 nEndOffset)
Definition: sheetdata.cxx:124
const std::vector< ScTextStyleEntry > & GetNoteParaStyles() const
Definition: sheetdata.hxx:166
void SetInSupportedSave(bool bSet)
Definition: sheetdata.cxx:240
std::vector< ScTextStyleEntry > maTextStyles
Definition: sheetdata.hxx:116
std::vector< ScStreamEntry > maSaveEntries
Definition: sheetdata.hxx:119
const std::vector< ScCellStyleEntry > & GetTableStyles() const
Definition: sheetdata.hxx:164
ScStreamEntry(sal_Int32 nStart, sal_Int32 nEnd)
Definition: sheetdata.hxx:43
std::map< sal_uInt64, OUString > maIDToName
Definition: sheetdata.hxx:176
const std::vector< ScCellStyleEntry > & GetRowStyles() const
Definition: sheetdata.hxx:163
std::vector< ScNoteStyleEntry > maNoteStyles
Definition: sheetdata.hxx:113
sal_Int32 mnStartOffset
Definition: sheetdata.hxx:121
sal_Int32 mnEndOffset
Definition: sheetdata.hxx:35
std::vector< bool > maBlocked
Definition: sheetdata.hxx:117
std::unordered_set< OUString > maInitialPrefixes
Definition: sheetdata.hxx:106
std::vector< ScCellStyleEntry > maTableStyles
Definition: sheetdata.hxx:112
void AddCellStyle(const OUString &rName, const ScAddress &rCellPos)
Definition: sheetdata.cxx:41
std::vector< ScCellStyleEntry > maCellStyles
Definition: sheetdata.hxx:109
const std::vector< ScCellStyleEntry > & GetCellStyles() const
Definition: sheetdata.hxx:161
void GetStreamPos(SCTAB nTab, sal_Int32 &rStartOffset, sal_Int32 &rEndOffset) const
Definition: sheetdata.cxx:134
void StoreLoadedNamespaces(const SvXMLNamespaceMap &rNamespaces)
Definition: sheetdata.cxx:184
ScAddress maCellPos
Definition: sheetdata.hxx:66
sal_Int32 mnStartOffset
Definition: sheetdata.hxx:34
bool IsSheetBlocked(SCTAB nTab) const
Definition: sheetdata.cxx:100
void AddRowStyle(const OUString &rName, const ScAddress &rCellPos)
Definition: sheetdata.cxx:51
std::vector< ScCellStyleEntry > maColumnStyles
Definition: sheetdata.hxx:110
bool IsInSupportedSave() const
Definition: sheetdata.hxx:170
std::vector< ScCellStyleEntry > maRowStyles
Definition: sheetdata.hxx:111
OUString maStyleName
Definition: sheetdata.hxx:64
sal_Int16 SCTAB
Definition: types.hxx:22