tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / sc / source / filter / xml / xmldpimp.hxx
blob641a2132872c8efc2cd837df648ec073dc223e91
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #pragma once
21 #include <memory>
22 #include <xmloff/xmltoken.hxx>
24 #include <dpsave.hxx>
25 #include <queryparam.hxx>
26 #include "importcontext.hxx"
28 #include <unordered_map>
30 namespace com::sun::star::sheet { struct DataPilotFieldAutoShowInfo; }
31 namespace com::sun::star::sheet { struct DataPilotFieldLayoutInfo; }
32 namespace com::sun::star::sheet { struct DataPilotFieldReference; }
33 namespace com::sun::star::sheet { struct DataPilotFieldSortInfo; }
34 namespace sax_fastparser { class FastAttributeList; }
36 class ScDPSaveNumGroupDimension;
37 class ScDPSaveGroupDimension;
38 class ScDPObject;
40 enum ScMySourceType
42 SQL,
43 TABLE,
44 QUERY,
45 SERVICE,
46 CELLRANGE
49 class ScXMLDataPilotTablesContext : public ScXMLImportContext
51 public:
53 ScXMLDataPilotTablesContext( ScXMLImport& rImport);
55 virtual ~ScXMLDataPilotTablesContext() override;
57 virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
58 sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
61 class ScXMLDataPilotTableContext : public ScXMLImportContext
63 typedef std::unordered_map<OUString, OUString> SelectedPagesType;
65 struct GrandTotalItem
67 OUString maDisplayName;
68 bool mbVisible;
69 GrandTotalItem();
71 ScDocument* pDoc;
72 std::unique_ptr<ScDPSaveData> pDPSave;
73 std::unique_ptr<ScDPDimensionSaveData> pDPDimSaveData;
74 GrandTotalItem maRowGrandTotal;
75 GrandTotalItem maColGrandTotal;
76 OUString sDataPilotTableName;
77 OUString sApplicationData;
78 OUString sDatabaseName;
79 OUString sSourceObject;
80 OUString sServiceName;
81 OUString sServiceSourceName;
82 OUString sServiceSourceObject;
83 OUString sServiceUsername;
84 OUString sServicePassword;
85 OUString sButtons;
86 OUString sSourceRangeName;
87 ScRange aSourceCellRangeAddress;
88 ScRange aTargetRangeAddress;
89 ScQueryParam aSourceQueryParam;
90 ScMySourceType nSourceType;
91 sal_uInt32 mnRowFieldCount;
92 sal_uInt32 mnColFieldCount;
93 sal_uInt32 mnPageFieldCount;
94 sal_uInt32 mnDataFieldCount;
95 css::sheet::DataPilotFieldOrientation
96 mnDataLayoutType;
97 bool bIsNative:1;
98 bool bIgnoreEmptyRows:1;
99 bool bIdentifyCategories:1;
100 bool bTargetRangeAddress:1;
101 bool bSourceCellRange:1;
102 bool bShowFilter:1;
103 bool bDrillDown:1;
104 bool bShowExpandCollapse:1;
105 bool bHeaderGridLayout:1;
106 bool bHasCompactField:1; // True = One or more fields have compact layout.
108 SelectedPagesType maSelectedPages;
110 public:
112 ScXMLDataPilotTableContext( ScXMLImport& rImport,
113 const rtl::Reference<sax_fastparser::FastAttributeList>& rAttrList );
115 virtual ~ScXMLDataPilotTableContext() override;
117 virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
118 sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
120 virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
122 void SetGrandTotal(::xmloff::token::XMLTokenEnum eOrientation, bool bVisible, const OUString& rDisplayName);
123 void SetDatabaseName(const OUString& sValue) { sDatabaseName = sValue; }
124 void SetSourceObject(const OUString& sValue) { sSourceObject = sValue; }
125 void SetNative(bool bValue) { bIsNative = bValue; }
126 void SetServiceName(const OUString& sValue) { sServiceName = sValue; }
127 void SetServiceSourceName(const OUString& sValue) { sServiceSourceName = sValue; }
128 void SetServiceSourceObject(const OUString& sValue) { sServiceSourceObject = sValue; }
129 void SetServiceUsername(const OUString& sValue) { sServiceUsername = sValue; }
130 void SetServicePassword(const OUString& sValue) { sServicePassword = sValue; }
131 void SetSourceRangeName(const OUString& sValue) { sSourceRangeName = sValue; bSourceCellRange = true; }
132 void SetSourceCellRangeAddress(const ScRange& aValue) { aSourceCellRangeAddress = aValue; bSourceCellRange = true; }
133 void SetSourceQueryParam(const ScQueryParam& aValue) { aSourceQueryParam = aValue; }
134 void AddDimension(ScDPSaveDimension* pDim);
135 void AddGroupDim(const ScDPSaveNumGroupDimension& aNumGroupDim);
136 void AddGroupDim(const ScDPSaveGroupDimension& aGroupDim);
137 void SetButtons(ScDPObject* pDPObject);
138 void SetSelectedPage( const OUString& rDimName, const OUString& rSelected );
139 void SetHasCompactField() { bHasCompactField = true; }
142 class ScXMLDPSourceSQLContext : public ScXMLImportContext
144 public:
146 ScXMLDPSourceSQLContext( ScXMLImport& rImport,
147 const rtl::Reference<sax_fastparser::FastAttributeList>& rAttrList,
148 ScXMLDataPilotTableContext* pDataPilotTable);
150 virtual ~ScXMLDPSourceSQLContext() override;
153 class ScXMLDPSourceTableContext : public ScXMLImportContext
155 public:
157 ScXMLDPSourceTableContext( ScXMLImport& rImport,
158 const rtl::Reference<sax_fastparser::FastAttributeList>& rAttrList,
159 ScXMLDataPilotTableContext* pDataPilotTable);
161 virtual ~ScXMLDPSourceTableContext() override;
164 class ScXMLDPSourceQueryContext : public ScXMLImportContext
166 public:
168 ScXMLDPSourceQueryContext( ScXMLImport& rImport,
169 const rtl::Reference<sax_fastparser::FastAttributeList>& rAttrList,
170 ScXMLDataPilotTableContext* pDataPilotTable);
172 virtual ~ScXMLDPSourceQueryContext() override;
175 class ScXMLSourceServiceContext : public ScXMLImportContext
177 public:
179 ScXMLSourceServiceContext( ScXMLImport& rImport,
180 const rtl::Reference<sax_fastparser::FastAttributeList>& rAttrList,
181 ScXMLDataPilotTableContext* pDataPilotTable);
183 virtual ~ScXMLSourceServiceContext() override;
186 class ScXMLDataPilotGrandTotalContext : public ScXMLImportContext
188 enum Orientation { COLUMN, ROW, BOTH, NONE };
190 ScXMLDataPilotTableContext* mpTableContext;
191 OUString maDisplayName;
192 Orientation meOrientation;
193 bool mbVisible;
195 public:
196 ScXMLDataPilotGrandTotalContext(
197 ScXMLImport& rImport,
198 const rtl::Reference<sax_fastparser::FastAttributeList>& rAttrList,
199 ScXMLDataPilotTableContext* pTableContext );
201 virtual ~ScXMLDataPilotGrandTotalContext() override;
203 virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
206 class ScXMLSourceCellRangeContext : public ScXMLImportContext
208 ScXMLDataPilotTableContext* pDataPilotTable;
210 public:
212 ScXMLSourceCellRangeContext( ScXMLImport& rImport,
213 const rtl::Reference<sax_fastparser::FastAttributeList>& rAttrList,
214 ScXMLDataPilotTableContext* pDataPilotTable);
216 virtual ~ScXMLSourceCellRangeContext() override;
218 virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
219 sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
222 struct ScXMLDataPilotGroup
224 ::std::vector<OUString> aMembers;
225 OUString aName;
228 class ScXMLDataPilotFieldContext : public ScXMLImportContext
230 ScXMLDataPilotTableContext* pDataPilotTable;
231 std::unique_ptr<ScDPSaveDimension> xDim;
233 ::std::vector<ScXMLDataPilotGroup> aGroups;
234 OUString sGroupSource;
235 OUString sSelectedPage;
236 OUString sName;
237 double fStart;
238 double fEnd;
239 double fStep;
240 sal_Int32 nUsedHierarchy;
241 sal_Int32 nGroupPart;
242 ScGeneralFunction nFunction;
243 css::sheet::DataPilotFieldOrientation
244 nOrientation;
245 bool bSelectedPage:1;
246 bool bIsGroupField:1;
247 bool bDateValue:1;
248 bool bAutoStart:1;
249 bool bAutoEnd:1;
250 bool mbHasHiddenMember:1; // TODO: import to document core
252 public:
254 ScXMLDataPilotFieldContext( ScXMLImport& rImport,
255 const rtl::Reference<sax_fastparser::FastAttributeList>& rAttrList,
256 ScXMLDataPilotTableContext* pDataPilotTable);
258 virtual ~ScXMLDataPilotFieldContext() override;
260 virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
261 sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
263 virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
265 void SetShowEmpty(const bool bValue) { if (xDim) xDim->SetShowEmpty(bValue); }
266 void SetRepeatItemLabels(const bool bSet) { if (xDim) xDim->SetRepeatItemLabels(bSet); }
267 void SetSubTotals(std::vector<ScGeneralFunction> && rFunctions) { if (xDim) xDim->SetSubTotals(std::move(rFunctions)); }
268 void AddMember(std::unique_ptr<ScDPSaveMember> pMember);
269 void SetSubTotalName(const OUString& rName);
270 void SetFieldReference(const css::sheet::DataPilotFieldReference& aRef) { if (xDim) xDim->SetReferenceValue(&aRef); }
271 void SetAutoShowInfo(const css::sheet::DataPilotFieldAutoShowInfo& aInfo) { if (xDim) xDim->SetAutoShowInfo(&aInfo); }
272 void SetSortInfo(const css::sheet::DataPilotFieldSortInfo& aInfo) { if (xDim) xDim->SetSortInfo(&aInfo); }
273 void SetLayoutInfo(const css::sheet::DataPilotFieldLayoutInfo& aInfo);
274 void SetGrouping(const OUString& rGroupSource, const double& rStart, const double& rEnd, const double& rStep,
275 sal_Int32 nPart, bool bDate, bool bAutoSt, bool bAutoE)
277 bIsGroupField = true;
278 sGroupSource = rGroupSource;
279 fStart = rStart;
280 fEnd = rEnd;
281 fStep = rStep;
282 nGroupPart = nPart;
283 bDateValue = bDate;
284 bAutoStart = bAutoSt;
285 bAutoEnd = bAutoE;
287 void AddGroup(::std::vector<OUString>&& rMembers, const OUString& rName);
290 class ScXMLDataPilotFieldReferenceContext : public ScXMLImportContext
292 public:
294 ScXMLDataPilotFieldReferenceContext( ScXMLImport& rImport,
295 const rtl::Reference<sax_fastparser::FastAttributeList>& rAttrList,
296 ScXMLDataPilotFieldContext* pDataPilotField);
298 virtual ~ScXMLDataPilotFieldReferenceContext() override;
301 class ScXMLDataPilotLevelContext : public ScXMLImportContext
303 ScXMLDataPilotFieldContext* pDataPilotField;
305 public:
307 ScXMLDataPilotLevelContext( ScXMLImport& rImport,
308 const rtl::Reference<sax_fastparser::FastAttributeList>& rAttrList,
309 ScXMLDataPilotFieldContext* pDataPilotField);
311 virtual ~ScXMLDataPilotLevelContext() override;
313 virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
314 sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
317 class ScXMLDataPilotDisplayInfoContext : public ScXMLImportContext
319 public:
321 ScXMLDataPilotDisplayInfoContext( ScXMLImport& rImport,
322 const rtl::Reference<sax_fastparser::FastAttributeList>& rAttrList,
323 ScXMLDataPilotFieldContext* pDataPilotField);
325 virtual ~ScXMLDataPilotDisplayInfoContext() override;
328 class ScXMLDataPilotSortInfoContext : public ScXMLImportContext
330 public:
332 ScXMLDataPilotSortInfoContext( ScXMLImport& rImport,
333 const rtl::Reference<sax_fastparser::FastAttributeList>& rAttrList,
334 ScXMLDataPilotFieldContext* pDataPilotField);
336 virtual ~ScXMLDataPilotSortInfoContext() override;
339 class ScXMLDataPilotLayoutInfoContext : public ScXMLImportContext
341 public:
343 ScXMLDataPilotLayoutInfoContext( ScXMLImport& rImport,
344 const rtl::Reference<sax_fastparser::FastAttributeList>& rAttrList,
345 ScXMLDataPilotFieldContext* pDataPilotField);
347 virtual ~ScXMLDataPilotLayoutInfoContext() override;
350 class ScXMLDataPilotSubTotalsContext : public ScXMLImportContext
352 ScXMLDataPilotFieldContext* pDataPilotField;
354 std::vector<ScGeneralFunction> maFunctions;
355 OUString maDisplayName;
357 public:
358 ScXMLDataPilotSubTotalsContext( ScXMLImport& rImport,
359 ScXMLDataPilotFieldContext* pDataPilotField);
361 virtual ~ScXMLDataPilotSubTotalsContext() override;
363 virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
364 sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
366 virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
367 void AddFunction(ScGeneralFunction nFunction);
368 void SetDisplayName(const OUString& rName);
371 class ScXMLDataPilotSubTotalContext : public ScXMLImportContext
373 public:
375 ScXMLDataPilotSubTotalContext( ScXMLImport& rImport,
376 const rtl::Reference<sax_fastparser::FastAttributeList>& rAttrList,
377 ScXMLDataPilotSubTotalsContext* pDataPilotSubTotals);
379 virtual ~ScXMLDataPilotSubTotalContext() override;
382 class ScXMLDataPilotMembersContext : public ScXMLImportContext
384 ScXMLDataPilotFieldContext* pDataPilotField;
386 public:
388 ScXMLDataPilotMembersContext( ScXMLImport& rImport,
389 ScXMLDataPilotFieldContext* pDataPilotField);
391 virtual ~ScXMLDataPilotMembersContext() override;
393 virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
394 sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
397 class ScXMLDataPilotMemberContext : public ScXMLImportContext
399 ScXMLDataPilotFieldContext* pDataPilotField;
401 OUString sName;
402 OUString maDisplayName;
403 bool bDisplay;
404 bool bDisplayDetails;
405 bool bHasName;
407 public:
409 ScXMLDataPilotMemberContext( ScXMLImport& rImport,
410 const rtl::Reference<sax_fastparser::FastAttributeList>& rAttrList,
411 ScXMLDataPilotFieldContext* pDataPilotField);
413 virtual ~ScXMLDataPilotMemberContext() override;
415 virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
418 class ScXMLDataPilotGroupsContext : public ScXMLImportContext
420 ScXMLDataPilotFieldContext* pDataPilotField;
422 public:
424 ScXMLDataPilotGroupsContext( ScXMLImport& rImport,
425 const rtl::Reference<sax_fastparser::FastAttributeList>& rAttrList,
426 ScXMLDataPilotFieldContext* pDataPilotField);
428 virtual ~ScXMLDataPilotGroupsContext() override;
430 virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
431 sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
434 class ScXMLDataPilotGroupContext : public ScXMLImportContext
436 ScXMLDataPilotFieldContext* pDataPilotField;
438 OUString sName;
439 ::std::vector<OUString> aMembers;
441 public:
443 ScXMLDataPilotGroupContext( ScXMLImport& rImport,
444 const rtl::Reference<sax_fastparser::FastAttributeList>& rAttrList,
445 ScXMLDataPilotFieldContext* pDataPilotField);
447 virtual ~ScXMLDataPilotGroupContext() override;
449 virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
450 sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
452 virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
454 void AddMember(const OUString& sMember) { aMembers.push_back(sMember); }
457 class ScXMLDataPilotGroupMemberContext : public ScXMLImportContext
459 ScXMLDataPilotGroupContext* pDataPilotGroup;
460 OUString sName;
462 public:
464 ScXMLDataPilotGroupMemberContext( ScXMLImport& rImport,
465 const rtl::Reference<sax_fastparser::FastAttributeList>& rAttrList,
466 ScXMLDataPilotGroupContext* pDataPilotGroup);
468 virtual ~ScXMLDataPilotGroupMemberContext() override;
470 virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
473 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */