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