Update ooo320-m1
[ooovba.git] / sc / source / filter / xml / xmldrani.hxx
blob16b22b7c989ed66003c8b7702481db7052699768
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: xmldrani.hxx,v $
10 * $Revision: 1.12 $
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 ************************************************************************/
30 #ifndef SC_XMLDRANI_HXX
31 #define SC_XMLDRANI_HXX
33 #include <xmloff/xmlictxt.hxx>
34 #include <xmloff/xmlimp.hxx>
35 #include <com/sun/star/sheet/DataImportMode.hpp>
36 #include <com/sun/star/sheet/SubTotalColumn.hpp>
37 #include <com/sun/star/beans/XPropertySet.hpp>
38 #include <com/sun/star/beans/PropertyValue.hpp>
39 #include <com/sun/star/sheet/TableFilterField2.hpp>
40 #include <com/sun/star/table/CellAddress.hpp>
41 #include <com/sun/star/table/CellRangeAddress.hpp>
42 #include <com/sun/star/table/TableOrientation.hpp>
44 class ScXMLImport;
46 class ScXMLDatabaseRangesContext : public SvXMLImportContext
48 const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
49 ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
51 public:
53 ScXMLDatabaseRangesContext( ScXMLImport& rImport, USHORT nPrfx,
54 const ::rtl::OUString& rLName,
55 const ::com::sun::star::uno::Reference<
56 ::com::sun::star::xml::sax::XAttributeList>& xAttrList);
58 virtual ~ScXMLDatabaseRangesContext();
60 virtual SvXMLImportContext *CreateChildContext( USHORT nPrefix,
61 const ::rtl::OUString& rLocalName,
62 const ::com::sun::star::uno::Reference<
63 ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
65 virtual void EndElement();
68 struct ScSubTotalRule
70 sal_Int16 nSubTotalRuleGroupFieldNumber;
71 com::sun::star::uno::Sequence <com::sun::star::sheet::SubTotalColumn> aSubTotalColumns;
74 class ScXMLDatabaseRangeContext : public SvXMLImportContext
76 rtl::OUString sDatabaseRangeName;
77 rtl::OUString sConnectionRessource;
78 rtl::OUString sRangeAddress;
79 rtl::OUString sDatabaseName;
80 rtl::OUString sSourceObject;
81 com::sun::star::uno::Sequence <com::sun::star::beans::PropertyValue> aSortSequence;
82 com::sun::star::uno::Sequence <com::sun::star::sheet::TableFilterField2> aFilterFields;
83 std::vector < ScSubTotalRule > aSubTotalRules;
84 com::sun::star::table::CellAddress aFilterOutputPosition;
85 com::sun::star::table::CellRangeAddress aFilterConditionSourceRangeAddress;
86 com::sun::star::sheet::DataImportMode nSourceType;
87 com::sun::star::table::TableOrientation eOrientation;
88 sal_Int32 nRefresh;
89 sal_Int16 nSubTotalsUserListIndex;
90 sal_Int16 nSubTotalRuleGroupFieldNumber;
91 sal_Bool bContainsSort;
92 sal_Bool bContainsSubTotal;
93 sal_Bool bNative;
94 sal_Bool bIsSelection;
95 sal_Bool bKeepFormats;
96 sal_Bool bMoveCells;
97 sal_Bool bStripData;
98 sal_Bool bContainsHeader;
99 sal_Bool bAutoFilter;
100 sal_Bool bSubTotalsBindFormatsToContent;
101 sal_Bool bSubTotalsIsCaseSensitive;
102 sal_Bool bSubTotalsInsertPageBreaks;
103 sal_Bool bSubTotalsSortGroups;
104 sal_Bool bSubTotalsEnabledUserList;
105 sal_Bool bSubTotalsAscending;
106 sal_Bool bFilterCopyOutputData;
107 sal_Bool bFilterIsCaseSensitive;
108 sal_Bool bFilterSkipDuplicates;
109 sal_Bool bFilterUseRegularExpressions;
110 sal_Bool bFilterConditionSourceRange;
112 const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
113 ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
115 public:
117 ScXMLDatabaseRangeContext( ScXMLImport& rImport, USHORT nPrfx,
118 const ::rtl::OUString& rLName,
119 const ::com::sun::star::uno::Reference<
120 ::com::sun::star::xml::sax::XAttributeList>& xAttrList);
122 virtual ~ScXMLDatabaseRangeContext();
124 virtual SvXMLImportContext *CreateChildContext( USHORT nPrefix,
125 const ::rtl::OUString& rLocalName,
126 const ::com::sun::star::uno::Reference<
127 ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
129 virtual void EndElement();
131 void SetDatabaseName(const rtl::OUString sTempDatabaseName) { sDatabaseName = sTempDatabaseName; }
132 void SetConnectionRessource(const rtl::OUString sTempConRes) { sConnectionRessource = sTempConRes; }
133 void SetSourceObject(const rtl::OUString sTempSourceObject) { sSourceObject = sTempSourceObject; }
134 void SetSourceType(const com::sun::star::sheet::DataImportMode nTempSourceType) { nSourceType = nTempSourceType; }
135 void SetNative(const sal_Bool bTempNative) { bNative = bTempNative; }
136 void SetSubTotalsBindFormatsToContent(const sal_Bool bTemp ) { bSubTotalsBindFormatsToContent = bTemp; }
137 void SetSubTotalsIsCaseSensitive(const sal_Bool bTemp) { bSubTotalsIsCaseSensitive = bTemp; }
138 void SetSubTotalsInsertPageBreaks(const sal_Bool bTemp) { bSubTotalsInsertPageBreaks = bTemp; }
139 void SetSubTotalsEnabledUserList(const sal_Bool bTemp) { bSubTotalsEnabledUserList = bTemp; }
140 void SetSubTotalsUserListIndex(const sal_Int16 nTemp) { nSubTotalsUserListIndex = nTemp; }
141 void SetSubTotalsAscending(const sal_Bool bTemp) { bSubTotalsAscending = bTemp; }
142 void SetSubTotalsSortGroups(const sal_Bool bTemp) { bSubTotalsSortGroups = bTemp; }
143 void AddSubTotalRule(const ScSubTotalRule& rRule) { aSubTotalRules.push_back(rRule); }
144 void SetSortSequence(const com::sun::star::uno::Sequence <com::sun::star::beans::PropertyValue>& aTempSortSequence) { aSortSequence = aTempSortSequence; }
145 void SetFilterCopyOutputData(const sal_Bool bTemp) { bFilterCopyOutputData = bTemp; }
146 void SetFilterIsCaseSensitive(const sal_Bool bTemp) { bFilterIsCaseSensitive = bTemp; }
147 void SetFilterSkipDuplicates(const sal_Bool bTemp) { bFilterSkipDuplicates = bTemp; }
148 void SetFilterUseRegularExpressions(const sal_Bool bTemp) { bFilterUseRegularExpressions = bTemp; }
149 void SetFilterFields(const com::sun::star::uno::Sequence <com::sun::star::sheet::TableFilterField2>& aTemp) { aFilterFields = aTemp; }
150 void SetFilterOutputPosition(const com::sun::star::table::CellAddress& aTemp) { aFilterOutputPosition = aTemp; }
151 void SetFilterConditionSourceRangeAddress(const com::sun::star::table::CellRangeAddress& aTemp) { aFilterConditionSourceRangeAddress = aTemp;
152 bFilterConditionSourceRange = sal_True; }
155 class ScXMLSourceSQLContext : public SvXMLImportContext
157 ScXMLDatabaseRangeContext* pDatabaseRangeContext;
158 rtl::OUString sDBName;
160 const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
161 ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
163 public:
165 ScXMLSourceSQLContext( ScXMLImport& rImport, USHORT nPrfx,
166 const ::rtl::OUString& rLName,
167 const ::com::sun::star::uno::Reference<
168 ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
169 ScXMLDatabaseRangeContext* pTempDatabaseRangeContext);
171 virtual ~ScXMLSourceSQLContext();
173 virtual SvXMLImportContext *CreateChildContext( USHORT nPrefix,
174 const ::rtl::OUString& rLocalName,
175 const ::com::sun::star::uno::Reference<
176 ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
178 virtual void EndElement();
181 class ScXMLSourceTableContext : public SvXMLImportContext
183 ScXMLDatabaseRangeContext* pDatabaseRangeContext;
184 rtl::OUString sDBName;
186 const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
187 ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
189 public:
191 ScXMLSourceTableContext( ScXMLImport& rImport, USHORT nPrfx,
192 const ::rtl::OUString& rLName,
193 const ::com::sun::star::uno::Reference<
194 ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
195 ScXMLDatabaseRangeContext* pTempDatabaseRangeContext);
197 virtual ~ScXMLSourceTableContext();
199 virtual SvXMLImportContext *CreateChildContext( USHORT nPrefix,
200 const ::rtl::OUString& rLocalName,
201 const ::com::sun::star::uno::Reference<
202 ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
204 virtual void EndElement();
207 class ScXMLSourceQueryContext : public SvXMLImportContext
209 ScXMLDatabaseRangeContext* pDatabaseRangeContext;
210 rtl::OUString sDBName;
212 const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
213 ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
215 public:
217 ScXMLSourceQueryContext( ScXMLImport& rImport, USHORT nPrfx,
218 const ::rtl::OUString& rLName,
219 const ::com::sun::star::uno::Reference<
220 ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
221 ScXMLDatabaseRangeContext* pTempDatabaseRangeContext);
223 virtual ~ScXMLSourceQueryContext();
225 virtual SvXMLImportContext *CreateChildContext( USHORT nPrefix,
226 const ::rtl::OUString& rLocalName,
227 const ::com::sun::star::uno::Reference<
228 ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
230 virtual void EndElement();
233 class ScXMLConResContext : public SvXMLImportContext
235 ScXMLDatabaseRangeContext* pDatabaseRangeContext;
237 const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
238 ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
240 public:
242 ScXMLConResContext( ScXMLImport& rImport, USHORT nPrfx,
243 const ::rtl::OUString& rLName,
244 const ::com::sun::star::uno::Reference<
245 ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
246 ScXMLDatabaseRangeContext* pTempDatabaseRangeContext);
248 virtual ~ScXMLConResContext();
250 virtual SvXMLImportContext *CreateChildContext( USHORT nPrefix,
251 const ::rtl::OUString& rLocalName,
252 const ::com::sun::star::uno::Reference<
253 ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
255 virtual void EndElement();
258 class ScXMLSubTotalRulesContext : public SvXMLImportContext
260 ScXMLDatabaseRangeContext* pDatabaseRangeContext;
262 const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
263 ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
265 public:
267 ScXMLSubTotalRulesContext( ScXMLImport& rImport, USHORT nPrfx,
268 const ::rtl::OUString& rLName,
269 const ::com::sun::star::uno::Reference<
270 ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
271 ScXMLDatabaseRangeContext* pTempDatabaseRangeContext);
273 virtual ~ScXMLSubTotalRulesContext();
275 virtual SvXMLImportContext *CreateChildContext( USHORT nPrefix,
276 const ::rtl::OUString& rLocalName,
277 const ::com::sun::star::uno::Reference<
278 ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
280 virtual void EndElement();
283 class ScXMLSortGroupsContext : public SvXMLImportContext
285 ScXMLDatabaseRangeContext* pDatabaseRangeContext;
287 const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
288 ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
290 public:
292 ScXMLSortGroupsContext( ScXMLImport& rImport, USHORT nPrfx,
293 const ::rtl::OUString& rLName,
294 const ::com::sun::star::uno::Reference<
295 ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
296 ScXMLDatabaseRangeContext* pTempDatabaseRangeContext);
298 virtual ~ScXMLSortGroupsContext();
300 virtual SvXMLImportContext *CreateChildContext( USHORT nPrefix,
301 const ::rtl::OUString& rLocalName,
302 const ::com::sun::star::uno::Reference<
303 ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
305 virtual void EndElement();
308 class ScXMLSubTotalRuleContext : public SvXMLImportContext
310 ScXMLDatabaseRangeContext* pDatabaseRangeContext;
311 ScSubTotalRule aSubTotalRule;
313 const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
314 ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
316 public:
318 ScXMLSubTotalRuleContext( ScXMLImport& rImport, USHORT nPrfx,
319 const ::rtl::OUString& rLName,
320 const ::com::sun::star::uno::Reference<
321 ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
322 ScXMLDatabaseRangeContext* pTempDatabaseRangeContext);
324 virtual ~ScXMLSubTotalRuleContext();
326 virtual SvXMLImportContext *CreateChildContext( USHORT nPrefix,
327 const ::rtl::OUString& rLocalName,
328 const ::com::sun::star::uno::Reference<
329 ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
331 virtual void EndElement();
333 void AddSubTotalColumn(const com::sun::star::sheet::SubTotalColumn aSubTotalColumn)
334 { aSubTotalRule.aSubTotalColumns.realloc(aSubTotalRule.aSubTotalColumns.getLength() + 1);
335 aSubTotalRule.aSubTotalColumns[aSubTotalRule.aSubTotalColumns.getLength() - 1] = aSubTotalColumn; }
338 class ScXMLSubTotalFieldContext : public SvXMLImportContext
340 ScXMLSubTotalRuleContext* pSubTotalRuleContext;
341 rtl::OUString sFieldNumber;
342 rtl::OUString sFunction;
344 const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
345 ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
347 public:
349 ScXMLSubTotalFieldContext( ScXMLImport& rImport, USHORT nPrfx,
350 const ::rtl::OUString& rLName,
351 const ::com::sun::star::uno::Reference<
352 ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
353 ScXMLSubTotalRuleContext* pSubTotalRuleContext);
355 virtual ~ScXMLSubTotalFieldContext();
357 virtual SvXMLImportContext *CreateChildContext( USHORT nPrefix,
358 const ::rtl::OUString& rLocalName,
359 const ::com::sun::star::uno::Reference<
360 ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
362 virtual void EndElement();
365 #endif