Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef SC_SHEETDATA_HXX
30 : : #define SC_SHEETDATA_HXX
31 : :
32 : : #include <xmloff/maptype.hxx>
33 : : #include <editeng/editdata.hxx>
34 : : #include <vector>
35 : : #include <boost/unordered_set.hpp>
36 : :
37 : : #include "address.hxx"
38 : :
39 : : class ScAddress;
40 : : class SvXMLNamespaceMap;
41 : :
42 : :
43 : : struct ScStreamEntry
44 : : {
45 : : sal_Int32 mnStartOffset;
46 : : sal_Int32 mnEndOffset;
47 : :
48 : 204 : ScStreamEntry() :
49 : : mnStartOffset(-1),
50 : 204 : mnEndOffset(-1)
51 : : {
52 : 204 : }
53 : :
54 : 204 : ScStreamEntry( sal_Int32 nStart, sal_Int32 nEnd ) :
55 : : mnStartOffset(nStart),
56 : 204 : mnEndOffset(nEnd)
57 : : {
58 : 204 : }
59 : : };
60 : :
61 : 5385 : struct ScCellStyleEntry
62 : : {
63 : : rtl::OUString maName;
64 : : ScAddress maCellPos;
65 : :
66 : 1121 : ScCellStyleEntry( const rtl::OUString& rName, const ScAddress& rPos ) :
67 : : maName(rName),
68 : 1121 : maCellPos(rPos)
69 : : {
70 : 1121 : }
71 : : };
72 : :
73 : 117 : struct ScNoteStyleEntry
74 : : {
75 : : rtl::OUString maStyleName;
76 : : rtl::OUString maTextStyle;
77 : : ScAddress maCellPos;
78 : :
79 : 103 : ScNoteStyleEntry( const rtl::OUString& rStyle, const rtl::OUString& rText, const ScAddress& rPos ) :
80 : : maStyleName(rStyle),
81 : : maTextStyle(rText),
82 : 103 : maCellPos(rPos)
83 : : {
84 : 103 : }
85 : : };
86 : :
87 : 18 : struct ScTextStyleEntry
88 : : {
89 : : rtl::OUString maName;
90 : : ScAddress maCellPos;
91 : : ESelection maSelection;
92 : :
93 : 6 : ScTextStyleEntry( const rtl::OUString& rName, const ScAddress& rPos, const ESelection& rSel ) :
94 : : maName(rName),
95 : : maCellPos(rPos),
96 : 6 : maSelection(rSel)
97 : : {
98 : 6 : }
99 : : };
100 : :
101 : 14409 : struct ScLoadedNamespaceEntry
102 : : {
103 : : rtl::OUString maPrefix;
104 : : rtl::OUString maName;
105 : : sal_uInt16 mnKey;
106 : :
107 : 2835 : ScLoadedNamespaceEntry( const rtl::OUString& rPrefix, const rtl::OUString& rName, sal_uInt16 nKey ) :
108 : : maPrefix(rPrefix),
109 : : maName(rName),
110 : 2835 : mnKey(nKey)
111 : : {
112 : 2835 : }
113 : : };
114 : :
115 : : class ScSheetSaveData
116 : : {
117 : : boost::unordered_set<rtl::OUString, rtl::OUStringHash> maInitialPrefixes;
118 : : std::vector<ScLoadedNamespaceEntry> maLoadedNamespaces;
119 : :
120 : : std::vector<ScCellStyleEntry> maCellStyles;
121 : : std::vector<ScCellStyleEntry> maColumnStyles;
122 : : std::vector<ScCellStyleEntry> maRowStyles;
123 : : std::vector<ScCellStyleEntry> maTableStyles;
124 : : std::vector<ScNoteStyleEntry> maNoteStyles;
125 : : std::vector<ScTextStyleEntry> maNoteParaStyles;
126 : : std::vector<ScTextStyleEntry> maNoteTextStyles;
127 : : std::vector<ScTextStyleEntry> maTextStyles;
128 : : std::vector<bool> maBlocked;
129 : : std::vector<ScStreamEntry> maStreamEntries;
130 : : std::vector<ScStreamEntry> maSaveEntries;
131 : : SCTAB mnStartTab;
132 : : sal_Int32 mnStartOffset;
133 : :
134 : : ScNoteStyleEntry maPreviousNote;
135 : :
136 : : bool mbInSupportedSave;
137 : :
138 : : public:
139 : : ScSheetSaveData();
140 : : ~ScSheetSaveData();
141 : :
142 : : void AddCellStyle( const rtl::OUString& rName, const ScAddress& rCellPos );
143 : : void AddColumnStyle( const rtl::OUString& rName, const ScAddress& rCellPos );
144 : : void AddRowStyle( const rtl::OUString& rName, const ScAddress& rCellPos );
145 : : void AddTableStyle( const rtl::OUString& rName, const ScAddress& rCellPos );
146 : :
147 : : void HandleNoteStyles( const rtl::OUString& rStyleName, const rtl::OUString& rTextName, const ScAddress& rCellPos );
148 : : void AddNoteContentStyle( sal_uInt16 nFamily, const rtl::OUString& rName, const ScAddress& rCellPos, const ESelection& rSelection );
149 : :
150 : : void AddTextStyle( const rtl::OUString& rName, const ScAddress& rCellPos, const ESelection& rSelection );
151 : :
152 : : void BlockSheet( SCTAB nTab );
153 : : bool IsSheetBlocked( SCTAB nTab ) const;
154 : :
155 : : void AddStreamPos( SCTAB nTab, sal_Int32 nStartOffset, sal_Int32 nEndOffset );
156 : : void GetStreamPos( SCTAB nTab, sal_Int32& rStartOffset, sal_Int32& rEndOffset ) const;
157 : : bool HasStreamPos( SCTAB nTab ) const;
158 : :
159 : : void StartStreamPos( SCTAB nTab, sal_Int32 nStartOffset );
160 : : void EndStreamPos( sal_Int32 nEndOffset );
161 : :
162 : 411 : bool HasStartPos() const { return mnStartTab >= 0; }
163 : :
164 : : void ResetSaveEntries();
165 : : void AddSavePos( SCTAB nTab, sal_Int32 nStartOffset, sal_Int32 nEndOffset );
166 : : void UseSaveEntries();
167 : :
168 : : void StoreInitialNamespaces( const SvXMLNamespaceMap& rNamespaces );
169 : : void StoreLoadedNamespaces( const SvXMLNamespaceMap& rNamespaces );
170 : : bool AddLoadedNamespaces( SvXMLNamespaceMap& rNamespaces ) const;
171 : :
172 : 4 : const std::vector<ScCellStyleEntry>& GetCellStyles() const { return maCellStyles; }
173 : 4 : const std::vector<ScCellStyleEntry>& GetColumnStyles() const { return maColumnStyles; }
174 : 4 : const std::vector<ScCellStyleEntry>& GetRowStyles() const { return maRowStyles; }
175 : 4 : const std::vector<ScCellStyleEntry>& GetTableStyles() const { return maTableStyles; }
176 : 4 : const std::vector<ScNoteStyleEntry>& GetNoteStyles() const { return maNoteStyles; }
177 : 4 : const std::vector<ScTextStyleEntry>& GetNoteParaStyles() const { return maNoteParaStyles; }
178 : 4 : const std::vector<ScTextStyleEntry>& GetNoteTextStyles() const { return maNoteTextStyles; }
179 : 4 : const std::vector<ScTextStyleEntry>& GetTextStyles() const { return maTextStyles; }
180 : :
181 : : bool IsInSupportedSave() const;
182 : : void SetInSupportedSave( bool bSet );
183 : : };
184 : :
185 : : #endif
186 : :
187 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|