1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 #ifndef SC_XMLDRANI_HXX 24 #define SC_XMLDRANI_HXX 25 26 #include <xmloff/xmlictxt.hxx> 27 #include <xmloff/xmlimp.hxx> 28 #include <com/sun/star/sheet/DataImportMode.hpp> 29 #include <com/sun/star/sheet/SubTotalColumn.hpp> 30 #include <com/sun/star/beans/XPropertySet.hpp> 31 #include <com/sun/star/beans/PropertyValue.hpp> 32 #include <com/sun/star/sheet/TableFilterField2.hpp> 33 #include <com/sun/star/table/CellAddress.hpp> 34 #include <com/sun/star/table/CellRangeAddress.hpp> 35 #include <com/sun/star/table/TableOrientation.hpp> 36 37 class ScXMLImport; 38 39 class ScXMLDatabaseRangesContext : public SvXMLImportContext 40 { GetScImport() const41 const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); } GetScImport()42 ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); } 43 44 public: 45 46 ScXMLDatabaseRangesContext( ScXMLImport& rImport, sal_uInt16 nPrfx, 47 const ::rtl::OUString& rLName, 48 const ::com::sun::star::uno::Reference< 49 ::com::sun::star::xml::sax::XAttributeList>& xAttrList); 50 51 virtual ~ScXMLDatabaseRangesContext(); 52 53 virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix, 54 const ::rtl::OUString& rLocalName, 55 const ::com::sun::star::uno::Reference< 56 ::com::sun::star::xml::sax::XAttributeList>& xAttrList ); 57 58 virtual void EndElement(); 59 }; 60 61 struct ScSubTotalRule 62 { 63 sal_Int16 nSubTotalRuleGroupFieldNumber; 64 com::sun::star::uno::Sequence <com::sun::star::sheet::SubTotalColumn> aSubTotalColumns; 65 }; 66 67 class ScXMLDatabaseRangeContext : public SvXMLImportContext 68 { 69 rtl::OUString sDatabaseRangeName; 70 rtl::OUString sConnectionRessource; 71 rtl::OUString sRangeAddress; 72 rtl::OUString sDatabaseName; 73 rtl::OUString sSourceObject; 74 com::sun::star::uno::Sequence <com::sun::star::beans::PropertyValue> aSortSequence; 75 com::sun::star::uno::Sequence <com::sun::star::sheet::TableFilterField2> aFilterFields; 76 std::vector < ScSubTotalRule > aSubTotalRules; 77 com::sun::star::table::CellAddress aFilterOutputPosition; 78 com::sun::star::table::CellRangeAddress aFilterConditionSourceRangeAddress; 79 com::sun::star::sheet::DataImportMode nSourceType; 80 com::sun::star::table::TableOrientation eOrientation; 81 sal_Int32 nRefresh; 82 sal_Int16 nSubTotalsUserListIndex; 83 sal_Int16 nSubTotalRuleGroupFieldNumber; 84 sal_Bool bContainsSort; 85 sal_Bool bContainsSubTotal; 86 sal_Bool bNative; 87 sal_Bool bIsSelection; 88 sal_Bool bKeepFormats; 89 sal_Bool bMoveCells; 90 sal_Bool bStripData; 91 sal_Bool bContainsHeader; 92 sal_Bool bAutoFilter; 93 sal_Bool bSubTotalsBindFormatsToContent; 94 sal_Bool bSubTotalsIsCaseSensitive; 95 sal_Bool bSubTotalsInsertPageBreaks; 96 sal_Bool bSubTotalsSortGroups; 97 sal_Bool bSubTotalsEnabledUserList; 98 sal_Bool bSubTotalsAscending; 99 sal_Bool bFilterCopyOutputData; 100 sal_Bool bFilterIsCaseSensitive; 101 sal_Bool bFilterSkipDuplicates; 102 sal_Bool bFilterUseRegularExpressions; 103 sal_Bool bFilterConditionSourceRange; 104 GetScImport() const105 const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); } GetScImport()106 ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); } 107 108 public: 109 110 ScXMLDatabaseRangeContext( ScXMLImport& rImport, sal_uInt16 nPrfx, 111 const ::rtl::OUString& rLName, 112 const ::com::sun::star::uno::Reference< 113 ::com::sun::star::xml::sax::XAttributeList>& xAttrList); 114 115 virtual ~ScXMLDatabaseRangeContext(); 116 117 virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix, 118 const ::rtl::OUString& rLocalName, 119 const ::com::sun::star::uno::Reference< 120 ::com::sun::star::xml::sax::XAttributeList>& xAttrList ); 121 122 virtual void EndElement(); 123 SetDatabaseName(const rtl::OUString sTempDatabaseName)124 void SetDatabaseName(const rtl::OUString sTempDatabaseName) { sDatabaseName = sTempDatabaseName; } SetConnectionRessource(const rtl::OUString sTempConRes)125 void SetConnectionRessource(const rtl::OUString sTempConRes) { sConnectionRessource = sTempConRes; } SetSourceObject(const rtl::OUString sTempSourceObject)126 void SetSourceObject(const rtl::OUString sTempSourceObject) { sSourceObject = sTempSourceObject; } SetSourceType(const com::sun::star::sheet::DataImportMode nTempSourceType)127 void SetSourceType(const com::sun::star::sheet::DataImportMode nTempSourceType) { nSourceType = nTempSourceType; } SetNative(const sal_Bool bTempNative)128 void SetNative(const sal_Bool bTempNative) { bNative = bTempNative; } SetSubTotalsBindFormatsToContent(const sal_Bool bTemp)129 void SetSubTotalsBindFormatsToContent(const sal_Bool bTemp ) { bSubTotalsBindFormatsToContent = bTemp; } SetSubTotalsIsCaseSensitive(const sal_Bool bTemp)130 void SetSubTotalsIsCaseSensitive(const sal_Bool bTemp) { bSubTotalsIsCaseSensitive = bTemp; } SetSubTotalsInsertPageBreaks(const sal_Bool bTemp)131 void SetSubTotalsInsertPageBreaks(const sal_Bool bTemp) { bSubTotalsInsertPageBreaks = bTemp; } SetSubTotalsEnabledUserList(const sal_Bool bTemp)132 void SetSubTotalsEnabledUserList(const sal_Bool bTemp) { bSubTotalsEnabledUserList = bTemp; } SetSubTotalsUserListIndex(const sal_Int16 nTemp)133 void SetSubTotalsUserListIndex(const sal_Int16 nTemp) { nSubTotalsUserListIndex = nTemp; } SetSubTotalsAscending(const sal_Bool bTemp)134 void SetSubTotalsAscending(const sal_Bool bTemp) { bSubTotalsAscending = bTemp; } SetSubTotalsSortGroups(const sal_Bool bTemp)135 void SetSubTotalsSortGroups(const sal_Bool bTemp) { bSubTotalsSortGroups = bTemp; } AddSubTotalRule(const ScSubTotalRule & rRule)136 void AddSubTotalRule(const ScSubTotalRule& rRule) { aSubTotalRules.push_back(rRule); } SetSortSequence(const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> & aTempSortSequence)137 void SetSortSequence(const com::sun::star::uno::Sequence <com::sun::star::beans::PropertyValue>& aTempSortSequence) { aSortSequence = aTempSortSequence; } SetFilterCopyOutputData(const sal_Bool bTemp)138 void SetFilterCopyOutputData(const sal_Bool bTemp) { bFilterCopyOutputData = bTemp; } SetFilterIsCaseSensitive(const sal_Bool bTemp)139 void SetFilterIsCaseSensitive(const sal_Bool bTemp) { bFilterIsCaseSensitive = bTemp; } SetFilterSkipDuplicates(const sal_Bool bTemp)140 void SetFilterSkipDuplicates(const sal_Bool bTemp) { bFilterSkipDuplicates = bTemp; } SetFilterUseRegularExpressions(const sal_Bool bTemp)141 void SetFilterUseRegularExpressions(const sal_Bool bTemp) { bFilterUseRegularExpressions = bTemp; } SetFilterFields(const com::sun::star::uno::Sequence<com::sun::star::sheet::TableFilterField2> & aTemp)142 void SetFilterFields(const com::sun::star::uno::Sequence <com::sun::star::sheet::TableFilterField2>& aTemp) { aFilterFields = aTemp; } SetFilterOutputPosition(const com::sun::star::table::CellAddress & aTemp)143 void SetFilterOutputPosition(const com::sun::star::table::CellAddress& aTemp) { aFilterOutputPosition = aTemp; } SetFilterConditionSourceRangeAddress(const com::sun::star::table::CellRangeAddress & aTemp)144 void SetFilterConditionSourceRangeAddress(const com::sun::star::table::CellRangeAddress& aTemp) { aFilterConditionSourceRangeAddress = aTemp; 145 bFilterConditionSourceRange = sal_True; } 146 }; 147 148 class ScXMLSourceSQLContext : public SvXMLImportContext 149 { 150 ScXMLDatabaseRangeContext* pDatabaseRangeContext; 151 rtl::OUString sDBName; 152 GetScImport() const153 const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); } GetScImport()154 ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); } 155 156 public: 157 158 ScXMLSourceSQLContext( ScXMLImport& rImport, sal_uInt16 nPrfx, 159 const ::rtl::OUString& rLName, 160 const ::com::sun::star::uno::Reference< 161 ::com::sun::star::xml::sax::XAttributeList>& xAttrList, 162 ScXMLDatabaseRangeContext* pTempDatabaseRangeContext); 163 164 virtual ~ScXMLSourceSQLContext(); 165 166 virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix, 167 const ::rtl::OUString& rLocalName, 168 const ::com::sun::star::uno::Reference< 169 ::com::sun::star::xml::sax::XAttributeList>& xAttrList ); 170 171 virtual void EndElement(); 172 }; 173 174 class ScXMLSourceTableContext : public SvXMLImportContext 175 { 176 ScXMLDatabaseRangeContext* pDatabaseRangeContext; 177 rtl::OUString sDBName; 178 GetScImport() const179 const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); } GetScImport()180 ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); } 181 182 public: 183 184 ScXMLSourceTableContext( ScXMLImport& rImport, sal_uInt16 nPrfx, 185 const ::rtl::OUString& rLName, 186 const ::com::sun::star::uno::Reference< 187 ::com::sun::star::xml::sax::XAttributeList>& xAttrList, 188 ScXMLDatabaseRangeContext* pTempDatabaseRangeContext); 189 190 virtual ~ScXMLSourceTableContext(); 191 192 virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix, 193 const ::rtl::OUString& rLocalName, 194 const ::com::sun::star::uno::Reference< 195 ::com::sun::star::xml::sax::XAttributeList>& xAttrList ); 196 197 virtual void EndElement(); 198 }; 199 200 class ScXMLSourceQueryContext : public SvXMLImportContext 201 { 202 ScXMLDatabaseRangeContext* pDatabaseRangeContext; 203 rtl::OUString sDBName; 204 GetScImport() const205 const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); } GetScImport()206 ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); } 207 208 public: 209 210 ScXMLSourceQueryContext( ScXMLImport& rImport, sal_uInt16 nPrfx, 211 const ::rtl::OUString& rLName, 212 const ::com::sun::star::uno::Reference< 213 ::com::sun::star::xml::sax::XAttributeList>& xAttrList, 214 ScXMLDatabaseRangeContext* pTempDatabaseRangeContext); 215 216 virtual ~ScXMLSourceQueryContext(); 217 218 virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix, 219 const ::rtl::OUString& rLocalName, 220 const ::com::sun::star::uno::Reference< 221 ::com::sun::star::xml::sax::XAttributeList>& xAttrList ); 222 223 virtual void EndElement(); 224 }; 225 226 class ScXMLConResContext : public SvXMLImportContext 227 { 228 ScXMLDatabaseRangeContext* pDatabaseRangeContext; 229 GetScImport() const230 const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); } GetScImport()231 ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); } 232 233 public: 234 235 ScXMLConResContext( ScXMLImport& rImport, sal_uInt16 nPrfx, 236 const ::rtl::OUString& rLName, 237 const ::com::sun::star::uno::Reference< 238 ::com::sun::star::xml::sax::XAttributeList>& xAttrList, 239 ScXMLDatabaseRangeContext* pTempDatabaseRangeContext); 240 241 virtual ~ScXMLConResContext(); 242 243 virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix, 244 const ::rtl::OUString& rLocalName, 245 const ::com::sun::star::uno::Reference< 246 ::com::sun::star::xml::sax::XAttributeList>& xAttrList ); 247 248 virtual void EndElement(); 249 }; 250 251 class ScXMLSubTotalRulesContext : public SvXMLImportContext 252 { 253 ScXMLDatabaseRangeContext* pDatabaseRangeContext; 254 GetScImport() const255 const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); } GetScImport()256 ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); } 257 258 public: 259 260 ScXMLSubTotalRulesContext( ScXMLImport& rImport, sal_uInt16 nPrfx, 261 const ::rtl::OUString& rLName, 262 const ::com::sun::star::uno::Reference< 263 ::com::sun::star::xml::sax::XAttributeList>& xAttrList, 264 ScXMLDatabaseRangeContext* pTempDatabaseRangeContext); 265 266 virtual ~ScXMLSubTotalRulesContext(); 267 268 virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix, 269 const ::rtl::OUString& rLocalName, 270 const ::com::sun::star::uno::Reference< 271 ::com::sun::star::xml::sax::XAttributeList>& xAttrList ); 272 273 virtual void EndElement(); 274 }; 275 276 class ScXMLSortGroupsContext : public SvXMLImportContext 277 { 278 ScXMLDatabaseRangeContext* pDatabaseRangeContext; 279 GetScImport() const280 const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); } GetScImport()281 ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); } 282 283 public: 284 285 ScXMLSortGroupsContext( ScXMLImport& rImport, sal_uInt16 nPrfx, 286 const ::rtl::OUString& rLName, 287 const ::com::sun::star::uno::Reference< 288 ::com::sun::star::xml::sax::XAttributeList>& xAttrList, 289 ScXMLDatabaseRangeContext* pTempDatabaseRangeContext); 290 291 virtual ~ScXMLSortGroupsContext(); 292 293 virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix, 294 const ::rtl::OUString& rLocalName, 295 const ::com::sun::star::uno::Reference< 296 ::com::sun::star::xml::sax::XAttributeList>& xAttrList ); 297 298 virtual void EndElement(); 299 }; 300 301 class ScXMLSubTotalRuleContext : public SvXMLImportContext 302 { 303 ScXMLDatabaseRangeContext* pDatabaseRangeContext; 304 ScSubTotalRule aSubTotalRule; 305 GetScImport() const306 const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); } GetScImport()307 ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); } 308 309 public: 310 311 ScXMLSubTotalRuleContext( ScXMLImport& rImport, sal_uInt16 nPrfx, 312 const ::rtl::OUString& rLName, 313 const ::com::sun::star::uno::Reference< 314 ::com::sun::star::xml::sax::XAttributeList>& xAttrList, 315 ScXMLDatabaseRangeContext* pTempDatabaseRangeContext); 316 317 virtual ~ScXMLSubTotalRuleContext(); 318 319 virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix, 320 const ::rtl::OUString& rLocalName, 321 const ::com::sun::star::uno::Reference< 322 ::com::sun::star::xml::sax::XAttributeList>& xAttrList ); 323 324 virtual void EndElement(); 325 AddSubTotalColumn(const com::sun::star::sheet::SubTotalColumn aSubTotalColumn)326 void AddSubTotalColumn(const com::sun::star::sheet::SubTotalColumn aSubTotalColumn) 327 { aSubTotalRule.aSubTotalColumns.realloc(aSubTotalRule.aSubTotalColumns.getLength() + 1); 328 aSubTotalRule.aSubTotalColumns[aSubTotalRule.aSubTotalColumns.getLength() - 1] = aSubTotalColumn; } 329 }; 330 331 class ScXMLSubTotalFieldContext : public SvXMLImportContext 332 { 333 ScXMLSubTotalRuleContext* pSubTotalRuleContext; 334 rtl::OUString sFieldNumber; 335 rtl::OUString sFunction; 336 GetScImport() const337 const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); } GetScImport()338 ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); } 339 340 public: 341 342 ScXMLSubTotalFieldContext( ScXMLImport& rImport, sal_uInt16 nPrfx, 343 const ::rtl::OUString& rLName, 344 const ::com::sun::star::uno::Reference< 345 ::com::sun::star::xml::sax::XAttributeList>& xAttrList, 346 ScXMLSubTotalRuleContext* pSubTotalRuleContext); 347 348 virtual ~ScXMLSubTotalFieldContext(); 349 350 virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix, 351 const ::rtl::OUString& rLocalName, 352 const ::com::sun::star::uno::Reference< 353 ::com::sun::star::xml::sax::XAttributeList>& xAttrList ); 354 355 virtual void EndElement(); 356 }; 357 358 #endif 359