Update ooo320-m1
[ooovba.git] / sc / inc / sheetdata.hxx
blob1cfe2e0e7e293eb3ec50018c3b4a45f0079c7c75
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: sheetdata.hxx,v $
10 * $Revision: 1.16.32.2 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef SC_SHEETDATA_HXX
32 #define SC_SHEETDATA_HXX
34 #include <xmloff/maptype.hxx>
35 #include <svx/editdata.hxx>
36 #include <vector>
37 #include <hash_set>
39 #include "address.hxx"
41 class ScAddress;
42 class SvXMLNamespaceMap;
45 struct ScStreamEntry
47 sal_Int32 mnStartOffset;
48 sal_Int32 mnEndOffset;
50 ScStreamEntry() :
51 mnStartOffset(-1),
52 mnEndOffset(-1)
56 ScStreamEntry( sal_Int32 nStart, sal_Int32 nEnd ) :
57 mnStartOffset(nStart),
58 mnEndOffset(nEnd)
63 struct ScCellStyleEntry
65 rtl::OUString maName;
66 ScAddress maCellPos;
68 ScCellStyleEntry( const rtl::OUString& rName, const ScAddress& rPos ) :
69 maName(rName),
70 maCellPos(rPos)
75 struct ScNoteStyleEntry
77 rtl::OUString maStyleName;
78 rtl::OUString maTextStyle;
79 ScAddress maCellPos;
81 ScNoteStyleEntry( const rtl::OUString& rStyle, const rtl::OUString& rText, const ScAddress& rPos ) :
82 maStyleName(rStyle),
83 maTextStyle(rText),
84 maCellPos(rPos)
89 struct ScTextStyleEntry
91 rtl::OUString maName;
92 ScAddress maCellPos;
93 ESelection maSelection;
95 ScTextStyleEntry( const rtl::OUString& rName, const ScAddress& rPos, const ESelection& rSel ) :
96 maName(rName),
97 maCellPos(rPos),
98 maSelection(rSel)
103 struct ScLoadedNamespaceEntry
105 rtl::OUString maPrefix;
106 rtl::OUString maName;
107 sal_uInt16 mnKey;
109 ScLoadedNamespaceEntry( const rtl::OUString& rPrefix, const rtl::OUString& rName, sal_uInt16 nKey ) :
110 maPrefix(rPrefix),
111 maName(rName),
112 mnKey(nKey)
117 class ScSheetSaveData
119 std::hash_set<rtl::OUString, rtl::OUStringHash> maInitialPrefixes;
120 std::vector<ScLoadedNamespaceEntry> maLoadedNamespaces;
122 std::vector<ScCellStyleEntry> maCellStyles;
123 std::vector<ScCellStyleEntry> maColumnStyles;
124 std::vector<ScCellStyleEntry> maRowStyles;
125 std::vector<ScCellStyleEntry> maTableStyles;
126 std::vector<ScNoteStyleEntry> maNoteStyles;
127 std::vector<ScTextStyleEntry> maNoteParaStyles;
128 std::vector<ScTextStyleEntry> maNoteTextStyles;
129 std::vector<ScTextStyleEntry> maTextStyles;
130 std::vector<bool> maBlocked;
131 std::vector<ScStreamEntry> maStreamEntries;
132 std::vector<ScStreamEntry> maSaveEntries;
133 sal_Int32 mnStartTab;
134 sal_Int32 mnStartOffset;
136 ScNoteStyleEntry maPreviousNote;
138 public:
139 ScSheetSaveData();
140 ~ScSheetSaveData();
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 );
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 );
150 void AddTextStyle( const rtl::OUString& rName, const ScAddress& rCellPos, const ESelection& rSelection );
152 void BlockSheet( sal_Int32 nTab );
153 bool IsSheetBlocked( sal_Int32 nTab ) const;
155 void AddStreamPos( sal_Int32 nTab, sal_Int32 nStartOffset, sal_Int32 nEndOffset );
156 void GetStreamPos( sal_Int32 nTab, sal_Int32& rStartOffset, sal_Int32& rEndOffset ) const;
157 bool HasStreamPos( sal_Int32 nTab ) const;
159 void StartStreamPos( sal_Int32 nTab, sal_Int32 nStartOffset );
160 void EndStreamPos( sal_Int32 nEndOffset );
162 bool HasStartPos() const { return mnStartTab >= 0; }
164 void ResetSaveEntries();
165 void AddSavePos( sal_Int32 nTab, sal_Int32 nStartOffset, sal_Int32 nEndOffset );
166 void UseSaveEntries();
168 void StoreInitialNamespaces( const SvXMLNamespaceMap& rNamespaces );
169 void StoreLoadedNamespaces( const SvXMLNamespaceMap& rNamespaces );
170 bool AddLoadedNamespaces( SvXMLNamespaceMap& rNamespaces ) const;
172 const std::vector<ScCellStyleEntry>& GetCellStyles() const { return maCellStyles; }
173 const std::vector<ScCellStyleEntry>& GetColumnStyles() const { return maColumnStyles; }
174 const std::vector<ScCellStyleEntry>& GetRowStyles() const { return maRowStyles; }
175 const std::vector<ScCellStyleEntry>& GetTableStyles() const { return maTableStyles; }
176 const std::vector<ScNoteStyleEntry>& GetNoteStyles() const { return maNoteStyles; }
177 const std::vector<ScTextStyleEntry>& GetNoteParaStyles() const { return maNoteParaStyles; }
178 const std::vector<ScTextStyleEntry>& GetNoteTextStyles() const { return maNoteTextStyles; }
179 const std::vector<ScTextStyleEntry>& GetTextStyles() const { return maTextStyles; }
182 #endif