LibreOffice Module sc (master) 1
xmldpimp.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#include "xmldpimp.hxx"
21#include "xmlimprt.hxx"
22#include "xmlfilti.hxx"
23#include <document.hxx>
24#include <dpshttab.hxx>
25#include <dpsdbtab.hxx>
26#include <attrib.hxx>
27#include "XMLConverter.hxx"
28#include <dpdimsave.hxx>
29#include <rangeutl.hxx>
30#include <dpoutputgeometry.hxx>
31#include <generalfunction.hxx>
32
33#include "pivotsource.hxx"
34
35#include <xmloff/xmltoken.hxx>
37#include <xmloff/xmluconv.hxx>
38
39#include <com/sun/star/sheet/DataPilotFieldReferenceType.hpp>
40#include <com/sun/star/sheet/DataPilotFieldReferenceItemType.hpp>
41#include <com/sun/star/sheet/DataPilotFieldShowItemsMode.hpp>
42#include <com/sun/star/sheet/DataPilotFieldSortMode.hpp>
43#include <com/sun/star/sheet/DataPilotFieldLayoutMode.hpp>
44#include <com/sun/star/sheet/DataPilotFieldGroupBy.hpp>
45#include <com/sun/star/sheet/DataPilotFieldOrientation.hpp>
46
47using namespace com::sun::star;
48using namespace xmloff::token;
49using ::com::sun::star::uno::Reference;
50
52 ScXMLImportContext( rImport )
53{
54 // has no Attributes
55 rImport.LockSolarMutex();
56}
57
59{
61}
62
63uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLDataPilotTablesContext::createFastChildContext(
64 sal_Int32 nElement, const uno::Reference< xml::sax::XFastAttributeList >& xAttrList )
65{
66 SvXMLImportContext *pContext = nullptr;
69
70 switch (nElement)
71 {
73 {
74 pContext = new ScXMLDataPilotTableContext( GetScImport(), pAttribList );
75 }
76 break;
77 }
78
79 return pContext;
80}
81
83 mbVisible(true) {}
84
87 ScXMLImportContext( rImport ),
88 pDoc(GetScImport().GetDocument()),
89 pDPSave(new ScDPSaveData()),
95 mnDataLayoutType(sheet::DataPilotFieldOrientation_HIDDEN),
96 bIsNative(true),
97 bIgnoreEmptyRows(false),
100 bSourceCellRange(false),
101 bShowFilter(true),
102 bDrillDown(true),
103 bShowExpandCollapse(false),
104 bHeaderGridLayout(false),
105 bHasCompactField(false)
106{
107 if ( !rAttrList.is() )
108 return;
109
110 for (auto &aIter : *rAttrList)
111 {
112 switch (aIter.getToken())
113 {
114 case XML_ELEMENT( TABLE, XML_NAME ):
115 {
116 sDataPilotTableName = aIter.toString();
117 }
118 break;
120 {
121 sApplicationData = aIter.toString();
122 }
123 break;
125 {
126 if (IsXMLToken(aIter, XML_BOTH))
127 {
130 }
131 else if (IsXMLToken(aIter, XML_ROW))
132 {
135 }
136 else if (IsXMLToken(aIter, XML_COLUMN))
137 {
140 }
141 else
142 {
145 }
146 }
147 break;
149 {
151 }
152 break;
154 {
156 }
157 break;
159 {
160 sal_Int32 nOffset(0);
161 assert(pDoc);
163 }
164 break;
166 {
167 sButtons = aIter.toString();
168 }
169 break;
171 {
173 }
174 break;
176 {
178 }
179 break;
181 {
183 }
184 break;
186 {
188 }
189 break;
190 }
191 }
192}
193
195{
196}
197
198uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLDataPilotTableContext::createFastChildContext(
199 sal_Int32 nElement, const uno::Reference< xml::sax::XFastAttributeList >& xAttrList )
200{
201 SvXMLImportContext *pContext = nullptr;
204
205 switch (nElement)
206 {
208 {
209 pContext = new ScXMLDPSourceSQLContext(GetScImport(), pAttribList, this);
211 }
212 break;
214 {
215 pContext = new ScXMLDPSourceTableContext(GetScImport(), pAttribList, this);
217 }
218 break;
220 {
221 pContext = new ScXMLDPSourceQueryContext(GetScImport(), pAttribList, this);
223 }
224 break;
226 {
227 pContext = new ScXMLSourceServiceContext(GetScImport(), pAttribList, this);
229 }
230 break;
232 case XML_ELEMENT( TABLE_EXT, XML_DATA_PILOT_GRAND_TOTAL ):
233 {
234 pContext = new ScXMLDataPilotGrandTotalContext(GetScImport(), pAttribList, this);
235 }
236 break;
238 {
239 pContext = new ScXMLSourceCellRangeContext(GetScImport(), pAttribList, this);
241 }
242 break;
244 pContext = new ScXMLDataPilotFieldContext(GetScImport(), pAttribList, this);
245 break;
246 }
247
248 return pContext;
249}
250
251namespace {
252
253const ScDPSaveDimension* getDimension(
254 const std::vector<const ScDPSaveDimension*>& rRowDims,
255 const std::vector<const ScDPSaveDimension*>& rColDims,
256 const std::vector<const ScDPSaveDimension*>& rPageDims,
257 ScDPOutputGeometry::FieldType eType, size_t nPos)
258{
259 switch (eType)
260 {
262 {
263 if (rColDims.size() <= nPos)
264 return nullptr;
265
266 return rColDims[nPos];
267 }
269 {
270 if (rRowDims.size() <= nPos)
271 return nullptr;
272
273 return rRowDims[nPos];
274 }
276 {
277 if (rPageDims.size() <= nPos)
278 return nullptr;
279
280 return rPageDims[nPos];
281 }
283 break;
285 break;
286 default:
287 break;
288 }
289 return nullptr;
290}
291
292ScDPOutputGeometry::FieldType toFieldType(sheet::DataPilotFieldOrientation nOrient)
293{
294 switch (nOrient)
295 {
296 case sheet::DataPilotFieldOrientation_COLUMN:
298 case sheet::DataPilotFieldOrientation_DATA:
300 case sheet::DataPilotFieldOrientation_PAGE:
302 case sheet::DataPilotFieldOrientation_ROW:
304 case sheet::DataPilotFieldOrientation_HIDDEN:
305 break;
306 default:
307 break;
308 }
310}
311
312}
313
315{
321 aGeometry.setDataLayoutType(toFieldType(mnDataLayoutType));
323
324 std::vector<const ScDPSaveDimension*> aRowDims, aColDims, aPageDims;
325 pDPSave->GetAllDimensionsByOrientation(sheet::DataPilotFieldOrientation_ROW, aRowDims);
326 pDPSave->GetAllDimensionsByOrientation(sheet::DataPilotFieldOrientation_COLUMN, aColDims);
327 pDPSave->GetAllDimensionsByOrientation(sheet::DataPilotFieldOrientation_PAGE, aPageDims);
328
329 OUString sAddress;
330 sal_Int32 nOffset = 0;
331 while( nOffset >= 0 )
332 {
334 if( nOffset >= 0 )
335 {
336 ScAddress aScAddress;
337 sal_Int32 nAddrOffset(0);
339 {
340 std::pair<ScDPOutputGeometry::FieldType, size_t> aBtnType = aGeometry.getFieldButtonType(aScAddress);
341 const ScDPSaveDimension* pDim = getDimension(
342 aRowDims, aColDims, aPageDims, aBtnType.first, aBtnType.second);
343
344 bool bDimension = pDim != nullptr;
345 bool bDataLayout = pDim && pDim->IsDataLayout();
346 bool bHasHidden = pDim && pDim->HasInvisibleMember();
347 bool bPageDim = pDim && pDim->GetOrientation() == sheet::DataPilotFieldOrientation_PAGE;
348
349 if (bPageDim)
350 {
351 // Page dimension needs 2 buttons.
352
353 pDoc->ApplyFlagsTab(aScAddress.Col(), aScAddress.Row(), aScAddress.Col(), aScAddress.Row(), aScAddress.Tab(), ScMF::Button);
354
355 ScMF nMFlag = ScMF::ButtonPopup;
356 if (bHasHidden)
357 nMFlag |= ScMF::HiddenMember;
358 pDoc->ApplyFlagsTab(aScAddress.Col()+1, aScAddress.Row(), aScAddress.Col()+1, aScAddress.Row(), aScAddress.Tab(), nMFlag);
359 }
360 else
361 {
362 ScMF nMFlag = ScMF::Button;
363 if (bDataLayout)
364 {
365 // Data layout dimension only has a plain button with no popup.
366 }
367 else if (bDimension)
368 {
369 // Normal dimension has a popup arrow button.
370 if (bHasHidden)
371 nMFlag |= ScMF::HiddenMember;
372
374 }
375
376 pDoc->ApplyFlagsTab(aScAddress.Col(), aScAddress.Row(), aScAddress.Col(), aScAddress.Row(), aScAddress.Tab(), nMFlag);
377 }
378 }
379 }
380 }
381
382 pDPObject->RefreshAfterLoad();
383}
384
385void ScXMLDataPilotTableContext::SetSelectedPage( const OUString& rDimName, const OUString& rSelected )
386{
387 maSelectedPages.emplace(rDimName, rSelected);
388}
389
391{
392 if (!pDPSave)
393 return;
394
395 if (pDim->IsDataLayout())
397
398 // if a dimension with that name has already been inserted,
399 // mark the new one as duplicate
400 if ( !pDim->IsDataLayout() &&
401 pDPSave->GetExistingDimensionByName(pDim->GetName()) )
402 pDim->SetDupFlag(true);
403
404 switch (pDim->GetOrientation())
405 {
406 case sheet::DataPilotFieldOrientation_ROW:
408 break;
409 case sheet::DataPilotFieldOrientation_COLUMN:
411 break;
412 case sheet::DataPilotFieldOrientation_PAGE:
414 break;
415 case sheet::DataPilotFieldOrientation_DATA:
417 break;
418 case sheet::DataPilotFieldOrientation_HIDDEN:
419 break;
420 default:
421 break;
422 }
423
424 pDPSave->AddDimension(pDim);
425}
426
428{
429 if (!pDPDimSaveData)
431 pDPDimSaveData->AddNumGroupDimension(aNumGroupDim);
432}
433
435{
436 if (!pDPDimSaveData)
438 pDPDimSaveData->AddGroupDimension(aGroupDim);
439}
440
441void SAL_CALL ScXMLDataPilotTableContext::endFastElement( sal_Int32 /*nElement*/ )
442{
444 return;
445
446 std::unique_ptr<ScDPObject> pDPObject(new ScDPObject(pDoc));
447 pDPObject->SetName(sDataPilotTableName);
448 pDPObject->SetTag(sApplicationData);
449 pDPObject->SetOutRange(aTargetRangeAddress);
450 pDPObject->SetHeaderLayout(bHeaderGridLayout);
451
453
454 switch (nSourceType)
455 {
456 case SQL :
457 {
458 ScImportSourceDesc aImportDesc(pDoc);
459 aImportDesc.aDBName = sDatabaseName;
460 aImportDesc.aObject = sSourceObject;
461 aImportDesc.nType = sheet::DataImportMode_SQL;
462 aImportDesc.bNative = bIsNative;
463 rPivotSources.appendDBSource(pDPObject.get(), aImportDesc);
464 }
465 break;
466 case TABLE :
467 {
468 ScImportSourceDesc aImportDesc(pDoc);
469 aImportDesc.aDBName = sDatabaseName;
470 aImportDesc.aObject = sSourceObject;
471 aImportDesc.nType = sheet::DataImportMode_TABLE;
472 rPivotSources.appendDBSource(pDPObject.get(), aImportDesc);
473 }
474 break;
475 case QUERY :
476 {
477 ScImportSourceDesc aImportDesc(pDoc);
478 aImportDesc.aDBName = sDatabaseName;
479 aImportDesc.aObject = sSourceObject;
480 aImportDesc.nType = sheet::DataImportMode_QUERY;
481 rPivotSources.appendDBSource(pDPObject.get(), aImportDesc);
482 }
483 break;
484 case SERVICE :
485 {
488 rPivotSources.appendServiceSource(pDPObject.get(), aServiceDesc);
489 }
490 break;
491 case CELLRANGE :
492 {
494 {
495 ScSheetSourceDesc aSheetDesc(pDoc);
496 if (!sSourceRangeName.isEmpty())
497 // Range name takes precedence.
498 aSheetDesc.SetRangeName(sSourceRangeName);
499 else
502 rPivotSources.appendSheetSource(pDPObject.get(), aSheetDesc);
503 }
504 }
505 break;
506 }
507
508 rPivotSources.appendSelectedPages(pDPObject.get(), std::unordered_map(maSelectedPages));
509
510 pDPSave->SetRowGrand(maRowGrandTotal.mbVisible);
511 pDPSave->SetColumnGrand(maColGrandTotal.mbVisible);
512 if (!maRowGrandTotal.maDisplayName.isEmpty())
513 // TODO: Right now, we only support one grand total name for both
514 // column and row totals. Take the value from the row total for
515 // now.
516 pDPSave->SetGrandTotalName(maRowGrandTotal.maDisplayName);
517
518 pDPSave->SetIgnoreEmptyRows(bIgnoreEmptyRows);
519 pDPSave->SetRepeatIfEmpty(bIdentifyCategories);
520 pDPSave->SetFilterButton(bShowFilter);
521 pDPSave->SetDrillDown(bDrillDown);
522 pDPSave->SetExpandCollapse(bShowExpandCollapse);
523 if (pDPDimSaveData)
524 pDPSave->SetDimensionData(pDPDimSaveData.get());
525 pDPObject->SetSaveData(*pDPSave);
526
527 ScDPCollection* pDPCollection = pDoc->GetDPCollection();
528
529 // #i94570# Names have to be unique, or the tables can't be accessed by API.
530 if ( pDPCollection->GetByName(pDPObject->GetName()) )
531 pDPObject->SetName( OUString() ); // ignore the invalid name, create a new name in AfterXMLLoading
532
533 SetButtons(pDPObject.get());
534
535 pDPCollection->InsertNewTable(std::move(pDPObject));
536}
537
539 XMLTokenEnum eOrientation, bool bVisible, const OUString& rDisplayName)
540{
541 switch (eOrientation)
542 {
543 case XML_BOTH:
545 maRowGrandTotal.maDisplayName = rDisplayName;
547 maColGrandTotal.maDisplayName = rDisplayName;
548 break;
549 case XML_ROW:
551 maRowGrandTotal.maDisplayName = rDisplayName;
552 break;
553 case XML_COLUMN:
555 maColGrandTotal.maDisplayName = rDisplayName;
556 break;
557 default:
558 break;
559 }
560}
561
564 ScXMLDataPilotTableContext* pDataPilotTable) :
565 ScXMLImportContext( rImport )
566{
567 if ( !rAttrList.is() )
568 return;
569
570 for (auto &aIter : *rAttrList)
571 {
572 switch (aIter.getToken())
573 {
575 pDataPilotTable->SetDatabaseName(aIter.toString());
576 break;
578 pDataPilotTable->SetSourceObject(aIter.toString());
579 break;
581 pDataPilotTable->SetNative(!IsXMLToken(aIter, XML_TRUE));
582 break;
583 }
584 }
585}
586
588{
589}
590
593 ScXMLDataPilotTableContext* pDataPilotTable) :
594 ScXMLImportContext( rImport )
595{
596 if ( !rAttrList.is() )
597 return;
598
599 for (auto &aIter : *rAttrList)
600 {
601 switch (aIter.getToken())
602 {
604 pDataPilotTable->SetDatabaseName(aIter.toString());
605 break;
608 pDataPilotTable->SetSourceObject(aIter.toString());
609 break;
610 }
611 }
612}
613
615{
616}
617
620 ScXMLDataPilotTableContext* pDataPilotTable) :
621 ScXMLImportContext( rImport )
622{
623 if ( !rAttrList.is() )
624 return;
625
626 for (auto &aIter : *rAttrList)
627 {
628 switch (aIter.getToken())
629 {
631 pDataPilotTable->SetDatabaseName(aIter.toString());
632 break;
634 pDataPilotTable->SetSourceObject(aIter.toString());
635 break;
636 }
637 }
638}
639
641{
642}
643
646 ScXMLDataPilotTableContext* pDataPilotTable) :
647 ScXMLImportContext( rImport )
648{
649 if ( !rAttrList.is() )
650 return;
651
652 for (auto &aIter : *rAttrList)
653 {
654 switch (aIter.getToken())
655 {
656 case XML_ELEMENT( TABLE, XML_NAME ):
657 pDataPilotTable->SetServiceName(aIter.toString());
658 break;
660 pDataPilotTable->SetServiceSourceName(aIter.toString());
661 break;
663 pDataPilotTable->SetServiceSourceObject(aIter.toString());
664 break;
666 pDataPilotTable->SetServiceUsername(aIter.toString());
667 break;
669 pDataPilotTable->SetServicePassword(aIter.toString());
670 break;
671 }
672 }
673}
674
676{
677}
678
681 ScXMLDataPilotTableContext* pTableContext ) :
682 ScXMLImportContext( rImport ),
683 mpTableContext(pTableContext),
684 meOrientation(NONE),
685 mbVisible(false)
686{
687 if ( !rAttrList.is() )
688 return;
689
690 for (auto &aIter : *rAttrList)
691 {
692 switch (aIter.getToken())
693 {
695 mbVisible = IsXMLToken(aIter, XML_TRUE);
696 break;
698 if (IsXMLToken(aIter, XML_BOTH))
700 else if (IsXMLToken(aIter, XML_ROW))
702 else if (IsXMLToken(aIter, XML_COLUMN))
704 break;
706 case XML_ELEMENT( TABLE_EXT, XML_DISPLAY_NAME ):
707 maDisplayName = aIter.toString();
708 break;
709 default:
710 break;
711 }
712 }
713}
714
716{
717}
718
719 void SAL_CALL ScXMLDataPilotGrandTotalContext::endFastElement( sal_Int32 /*nElement*/ )
720{
721 XMLTokenEnum eOrient = XML_NONE;
722 switch (meOrientation)
723 {
724 case BOTH:
725 eOrient = XML_BOTH;
726 break;
727 case ROW:
728 eOrient = XML_ROW;
729 break;
730 case COLUMN:
731 eOrient = XML_COLUMN;
732 break;
733 default:
734 break;
735 }
737}
738
741 ScXMLDataPilotTableContext* pTempDataPilotTable) :
742 ScXMLImportContext( rImport ),
743 pDataPilotTable(pTempDataPilotTable)
744{
745 if ( !rAttrList.is() )
746 return;
747
748 for (auto &aIter : *rAttrList)
749 {
750 switch (aIter.getToken())
751 {
753 {
754 ScRange aSourceRangeAddress;
755 sal_Int32 nOffset(0);
757 assert(pDoc);
758 if (ScRangeStringConverter::GetRangeFromString( aSourceRangeAddress, aIter.toString(), *pDoc, ::formula::FormulaGrammar::CONV_OOO, nOffset ))
759 pDataPilotTable->SetSourceCellRangeAddress(aSourceRangeAddress);
760 }
761 break;
762 case XML_ELEMENT( TABLE, XML_NAME ):
763 pDataPilotTable->SetSourceRangeName(aIter.toString());
764 break;
765 }
766 }
767}
768
770{
771}
772
773uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLSourceCellRangeContext::createFastChildContext(
774 sal_Int32 nElement, const uno::Reference< xml::sax::XFastAttributeList >& xAttrList )
775{
776 SvXMLImportContext *pContext = nullptr;
779
780 switch (nElement)
781 {
783 pContext = new ScXMLDPFilterContext(GetScImport(), pAttribList, pDataPilotTable);
784 break;
785 }
786
787 return pContext;
788}
789
792 ScXMLDataPilotTableContext* pTempDataPilotTable) :
793 ScXMLImportContext( rImport ),
794 pDataPilotTable(pTempDataPilotTable),
795 fStart(0.0),
796 fEnd(0.0),
797 fStep(0.0),
798 nUsedHierarchy(1),
799 nGroupPart(0),
800 nFunction(ScGeneralFunction::NONE),
801 nOrientation(sheet::DataPilotFieldOrientation_HIDDEN),
802 bSelectedPage(false),
803 bIsGroupField(false),
804 bDateValue(false),
805 bAutoStart(false),
806 bAutoEnd(false),
807 mbHasHiddenMember(false)
808{
809 bool bHasName = false;
810 bool bDataLayout = false;
811 bool bIgnoreSelectedPage = false;
812 OUString aDisplayName;
813 if ( rAttrList.is() )
814 {
815 for (auto &aIter : *rAttrList)
816 {
817 switch (aIter.getToken())
818 {
820 sName = aIter.toString();
821 bHasName = true;
822 break;
824 case XML_ELEMENT( TABLE_EXT, XML_DISPLAY_NAME ):
825 aDisplayName = aIter.toString();
826 break;
828 bDataLayout = IsXMLToken(aIter, XML_TRUE);
829 break;
832 break;
835 break;
837 sSelectedPage = aIter.toString();
838 bSelectedPage = true;
839 break;
841 bIgnoreSelectedPage = true;
842 break;
844 nUsedHierarchy = aIter.toInt32();
845 break;
846 }
847 }
848 }
849
850 // use the new extension elements
851 if (bIgnoreSelectedPage)
852 bSelectedPage = false;
853
854 if (bHasName)
855 {
856 xDim.reset(new ScDPSaveDimension(sName, bDataLayout));
857 if (!aDisplayName.isEmpty())
858 xDim->SetLayoutName(aDisplayName);
859 }
860}
861
863{
864}
865
866uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLDataPilotFieldContext::createFastChildContext(
867 sal_Int32 nElement, const uno::Reference< xml::sax::XFastAttributeList >& xAttrList )
868{
869 SvXMLImportContext *pContext = nullptr;
872
873 switch (nElement)
874 {
876 pContext = new ScXMLDataPilotLevelContext(GetScImport(), pAttribList, this);
877 break;
879 pContext = new ScXMLDataPilotFieldReferenceContext(GetScImport(), pAttribList, this);
880 break;
882 pContext = new ScXMLDataPilotGroupsContext(GetScImport(), pAttribList, this);
883 break;
884 }
885
886 return pContext;
887}
888
889void ScXMLDataPilotFieldContext::AddMember(std::unique_ptr<ScDPSaveMember> pMember)
890{
891 if (xDim)
892 {
893 bool isVisible = pMember->GetIsVisible();
894 xDim->AddMember(std::move(pMember));
895 if (!isVisible)
896 // This member is hidden.
897 mbHasHiddenMember = true;
898 }
899}
900
902{
903 if (xDim)
904 xDim->SetSubtotalName(rName);
905}
906
907void ScXMLDataPilotFieldContext::SetLayoutInfo(const css::sheet::DataPilotFieldLayoutInfo& aInfo)
908{
909 if (xDim)
910 xDim->SetLayoutInfo(&aInfo);
911
912 if (pDataPilotTable && aInfo.LayoutMode == sheet::DataPilotFieldLayoutMode::COMPACT_LAYOUT)
914}
915
916void ScXMLDataPilotFieldContext::AddGroup(::std::vector<OUString>&& rMembers, const OUString& rName)
917{
918 ScXMLDataPilotGroup aGroup;
919 aGroup.aMembers = std::move(rMembers);
920 aGroup.aName = rName;
921 aGroups.push_back(std::move(aGroup));
922}
923
924void SAL_CALL ScXMLDataPilotFieldContext::endFastElement( sal_Int32 /*nElement*/ )
925{
926 if (!xDim)
927 return;
928
929 xDim->SetUsedHierarchy(nUsedHierarchy);
930 xDim->SetFunction(nFunction);
931 xDim->SetOrientation(nOrientation);
932 if (bSelectedPage)
933 {
935 }
937 if (!bIsGroupField)
938 return;
939
940 ScDPNumGroupInfo aInfo;
941 aInfo.mbEnable = true;
942 aInfo.mbDateValues = bDateValue;
943 aInfo.mbAutoStart = bAutoStart;
944 aInfo.mbAutoEnd = bAutoEnd;
945 aInfo.mfStart = fStart;
946 aInfo.mfEnd = fEnd;
947 aInfo.mfStep = fStep;
948 if (!sGroupSource.isEmpty())
949 {
951 if (nGroupPart)
952 aGroupDim.SetDateInfo(aInfo, nGroupPart);
953 else
954 {
955 for (const auto& rGroup : aGroups)
956 {
957 ScDPSaveGroupItem aItem(rGroup.aName);
958 for (const auto& rMember : rGroup.aMembers)
959 {
960 aItem.AddElement(rMember);
961 }
962 aGroupDim.AddGroupItem(aItem);
963 }
964 }
965 pDataPilotTable->AddGroupDim(aGroupDim);
966 }
967 else //NumGroup
968 {
969 ScDPSaveNumGroupDimension aNumGroupDim(sName, aInfo);
970 if (nGroupPart)
971 aNumGroupDim.SetDateInfo(aInfo, nGroupPart);
972 pDataPilotTable->AddGroupDim(aNumGroupDim);
973 }
974}
975
978 ScXMLDataPilotFieldContext* pDataPilotField) :
979 ScXMLImportContext( rImport )
980{
981 sheet::DataPilotFieldReference aReference;
982
983 if ( rAttrList.is() )
984 {
985 for (auto &aIter : *rAttrList)
986 {
987 switch (aIter.getToken())
988 {
989 case XML_ELEMENT( TABLE, XML_TYPE ):
990 {
991 if (IsXMLToken(aIter, XML_NONE))
992 aReference.ReferenceType = sheet::DataPilotFieldReferenceType::NONE;
993 else if (IsXMLToken(aIter, XML_MEMBER_DIFFERENCE))
994 aReference.ReferenceType = sheet::DataPilotFieldReferenceType::ITEM_DIFFERENCE;
995 else if (IsXMLToken(aIter, XML_MEMBER_PERCENTAGE))
996 aReference.ReferenceType = sheet::DataPilotFieldReferenceType::ITEM_PERCENTAGE;
998 aReference.ReferenceType = sheet::DataPilotFieldReferenceType::ITEM_PERCENTAGE_DIFFERENCE;
999 else if (IsXMLToken(aIter, XML_RUNNING_TOTAL))
1000 aReference.ReferenceType = sheet::DataPilotFieldReferenceType::RUNNING_TOTAL;
1001 else if (IsXMLToken(aIter, XML_ROW_PERCENTAGE))
1002 aReference.ReferenceType = sheet::DataPilotFieldReferenceType::ROW_PERCENTAGE;
1003 else if (IsXMLToken(aIter, XML_COLUMN_PERCENTAGE))
1004 aReference.ReferenceType = sheet::DataPilotFieldReferenceType::COLUMN_PERCENTAGE;
1005 else if (IsXMLToken(aIter, XML_TOTAL_PERCENTAGE))
1006 aReference.ReferenceType = sheet::DataPilotFieldReferenceType::TOTAL_PERCENTAGE;
1007 else if (IsXMLToken(aIter, XML_INDEX))
1008 aReference.ReferenceType = sheet::DataPilotFieldReferenceType::INDEX;
1009 }
1010 break;
1012 {
1013 aReference.ReferenceField = aIter.toString();
1014 }
1015 break;
1017 {
1018 if (IsXMLToken(aIter, XML_NAMED))
1019 aReference.ReferenceItemType = sheet::DataPilotFieldReferenceItemType::NAMED;
1020 else if (IsXMLToken(aIter, XML_PREVIOUS))
1021 aReference.ReferenceItemType = sheet::DataPilotFieldReferenceItemType::PREVIOUS;
1022 else if (IsXMLToken(aIter, XML_NEXT))
1023 aReference.ReferenceItemType = sheet::DataPilotFieldReferenceItemType::NEXT;
1024 }
1025 break;
1027 {
1028 aReference.ReferenceItemName = aIter.toString();
1029 }
1030 break;
1031 }
1032 }
1033 }
1034 pDataPilotField->SetFieldReference(aReference);
1035}
1036
1038{
1039}
1040
1043 ScXMLDataPilotFieldContext* pTempDataPilotField) :
1044 ScXMLImportContext( rImport ),
1045 pDataPilotField(pTempDataPilotField)
1046{
1047 if ( !rAttrList.is() )
1048 return;
1049
1050 for (auto &aIter : *rAttrList)
1051 {
1052 switch (aIter.getToken())
1053 {
1056 break;
1057 case XML_ELEMENT( CALC_EXT, XML_REPEAT_ITEM_LABELS ):
1059 break;
1060 }
1061 }
1062}
1063
1065{
1066}
1067
1068uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLDataPilotLevelContext::createFastChildContext(
1069 sal_Int32 nElement, const uno::Reference< xml::sax::XFastAttributeList >& xAttrList )
1070{
1071 SvXMLImportContext *pContext = nullptr;
1074
1075 switch (nElement)
1076 {
1079 break;
1082 break;
1084 pContext = new ScXMLDataPilotDisplayInfoContext(GetScImport(), pAttribList, pDataPilotField);
1085 break;
1087 pContext = new ScXMLDataPilotSortInfoContext(GetScImport(), pAttribList, pDataPilotField);
1088 break;
1090 pContext = new ScXMLDataPilotLayoutInfoContext(GetScImport(), pAttribList, pDataPilotField);
1091 break;
1092 }
1093
1094 return pContext;
1095}
1096
1099 ScXMLDataPilotFieldContext* pDataPilotField) :
1100 ScXMLImportContext( rImport )
1101{
1102 sheet::DataPilotFieldAutoShowInfo aInfo;
1103
1104 if ( rAttrList.is() )
1105 {
1106 for (auto &aIter : *rAttrList)
1107 {
1108 switch (aIter.getToken())
1109 {
1110 case XML_ELEMENT( TABLE, XML_ENABLED ):
1111 if (IsXMLToken(aIter, XML_TRUE))
1112 aInfo.IsEnabled = true;
1113 else
1114 aInfo.IsEnabled = false;
1115 break;
1117 if (IsXMLToken(aIter, XML_FROM_TOP))
1118 aInfo.ShowItemsMode = sheet::DataPilotFieldShowItemsMode::FROM_TOP;
1119 else if (IsXMLToken(aIter, XML_FROM_BOTTOM))
1120 aInfo.ShowItemsMode = sheet::DataPilotFieldShowItemsMode::FROM_BOTTOM;
1121 break;
1123 aInfo.ItemCount = aIter.toInt32();
1124 break;
1126 aInfo.DataField = aIter.toString();
1127 break;
1128 }
1129 }
1130 }
1131 pDataPilotField->SetAutoShowInfo(aInfo);
1132}
1133
1135{
1136}
1137
1140 ScXMLDataPilotFieldContext* pDataPilotField) :
1141 ScXMLImportContext( rImport )
1142{
1143 sheet::DataPilotFieldSortInfo aInfo;
1144
1145 if ( rAttrList.is() )
1146 {
1147 for (auto &aIter : *rAttrList)
1148 {
1149 switch (aIter.getToken())
1150 {
1151 case XML_ELEMENT( TABLE, XML_ORDER ):
1152 if (IsXMLToken(aIter, XML_ASCENDING))
1153 aInfo.IsAscending = true;
1154 else if (IsXMLToken(aIter, XML_DESCENDING))
1155 aInfo.IsAscending = false;
1156 break;
1158 if (IsXMLToken(aIter, XML_NONE))
1160 else if (IsXMLToken(aIter, XML_MANUAL))
1161 aInfo.Mode = sheet::DataPilotFieldSortMode::MANUAL;
1162 else if (IsXMLToken(aIter, XML_NAME))
1163 aInfo.Mode = sheet::DataPilotFieldSortMode::NAME;
1164 else if (IsXMLToken(aIter, XML_DATA))
1165 aInfo.Mode = sheet::DataPilotFieldSortMode::DATA;
1166 break;
1168 aInfo.Field = aIter.toString();
1169 break;
1170 }
1171 }
1172 }
1173 pDataPilotField->SetSortInfo(aInfo);
1174}
1175
1177{
1178}
1179
1182 ScXMLDataPilotFieldContext* pDataPilotField) :
1183 ScXMLImportContext( rImport )
1184{
1185 sheet::DataPilotFieldLayoutInfo aInfo;
1186 aInfo.LayoutMode = sheet::DataPilotFieldLayoutMode::TABULAR_LAYOUT;
1187
1188 if ( rAttrList.is() )
1189 {
1190 for (auto &aIter : *rAttrList)
1191 {
1192 switch (aIter.getToken())
1193 {
1195 if (IsXMLToken(aIter, XML_TRUE))
1196 aInfo.AddEmptyLines = true;
1197 else
1198 aInfo.AddEmptyLines = false;
1199 break;
1201 case XML_ELEMENT( LO_EXT, XML_LAYOUT_MODE ):
1202 // Ensure that loext:layout-mode="compact" is not overwritten by any
1203 // value of table:layout-mode.
1204 if (aInfo.LayoutMode != sheet::DataPilotFieldLayoutMode::COMPACT_LAYOUT)
1205 {
1206 if (IsXMLToken(aIter, XML_TABULAR_LAYOUT))
1207 aInfo.LayoutMode = sheet::DataPilotFieldLayoutMode::TABULAR_LAYOUT;
1208 else if (IsXMLToken(aIter, XML_OUTLINE_SUBTOTALS_TOP))
1209 aInfo.LayoutMode = sheet::DataPilotFieldLayoutMode::OUTLINE_SUBTOTALS_TOP;
1211 aInfo.LayoutMode = sheet::DataPilotFieldLayoutMode::OUTLINE_SUBTOTALS_BOTTOM;
1212 else if (IsXMLToken(aIter, XML_COMPACT_LAYOUT))
1213 aInfo.LayoutMode = sheet::DataPilotFieldLayoutMode::COMPACT_LAYOUT;
1214 }
1215 break;
1216 }
1217 }
1218 }
1219 pDataPilotField->SetLayoutInfo(aInfo);}
1220
1222{
1223}
1224
1226 ScXMLDataPilotFieldContext* pTempDataPilotField) :
1227 ScXMLImportContext( rImport ),
1228 pDataPilotField(pTempDataPilotField)
1229{
1230
1231 // has no attributes
1232}
1233
1235{
1236}
1237
1238uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLDataPilotSubTotalsContext::createFastChildContext(
1239 sal_Int32 nElement, const uno::Reference< xml::sax::XFastAttributeList >& xAttrList )
1240{
1241 SvXMLImportContext *pContext = nullptr;
1244
1245 switch (nElement)
1246 {
1248 pContext = new ScXMLDataPilotSubTotalContext(GetScImport(), pAttribList, this);
1249 break;
1250 }
1251
1252 return pContext;
1253}
1254
1255void SAL_CALL ScXMLDataPilotSubTotalsContext::endFastElement( sal_Int32 /*nElement*/ )
1256{
1258 if (!maDisplayName.isEmpty())
1260}
1261
1263{
1264 maFunctions.push_back(nFunction);
1265}
1266
1268{
1269 maDisplayName = rName;
1270}
1271
1274 ScXMLDataPilotSubTotalsContext* pDataPilotSubTotals) :
1275 ScXMLImportContext( rImport )
1276{
1277 if ( !rAttrList.is() )
1278 return;
1279
1280 for (auto &aIter : *rAttrList)
1281 {
1282 switch (aIter.getToken())
1283 {
1285 pDataPilotSubTotals->AddFunction( ScXMLConverter::GetFunctionFromString2( aIter.toString() ) );
1286 break;
1288 case XML_ELEMENT( TABLE_EXT, XML_DISPLAY_NAME ):
1289 pDataPilotSubTotals->SetDisplayName(aIter.toString());
1290 break;
1291 }
1292 }
1293}
1294
1296{
1297}
1298
1300 ScXMLDataPilotFieldContext* pTempDataPilotField) :
1301 ScXMLImportContext( rImport ),
1302 pDataPilotField(pTempDataPilotField)
1303{
1304 // has no attributes
1305}
1306
1308{
1309}
1310
1311uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLDataPilotMembersContext::createFastChildContext(
1312 sal_Int32 nElement, const uno::Reference< xml::sax::XFastAttributeList >& xAttrList )
1313{
1314 SvXMLImportContext *pContext = nullptr;
1317
1318 switch (nElement)
1319 {
1321 pContext = new ScXMLDataPilotMemberContext(GetScImport(), pAttribList, pDataPilotField);
1322 break;
1323 }
1324
1325 return pContext;
1326}
1327
1330 ScXMLDataPilotFieldContext* pTempDataPilotField) :
1331 ScXMLImportContext( rImport ),
1332 pDataPilotField(pTempDataPilotField),
1333 bDisplay( true ),
1334 bDisplayDetails( true ),
1335 bHasName( false )
1336{
1337 if ( !rAttrList.is() )
1338 return;
1339
1340 for (auto &aIter : *rAttrList)
1341 {
1342 switch (aIter.getToken())
1343 {
1344 case XML_ELEMENT( TABLE, XML_NAME ):
1345 sName = aIter.toString();
1346 bHasName = true;
1347 break;
1349 case XML_ELEMENT( TABLE_EXT, XML_DISPLAY_NAME ):
1350 maDisplayName = aIter.toString();
1351 break;
1352 case XML_ELEMENT( TABLE, XML_DISPLAY ):
1353 bDisplay = IsXMLToken(aIter, XML_TRUE);
1354 break;
1357 break;
1358 }
1359 }
1360}
1361
1363{
1364}
1365
1366void SAL_CALL ScXMLDataPilotMemberContext::endFastElement( sal_Int32 /*nElement*/ )
1367{
1368 if (bHasName) // #i53407# don't check sName, empty name is allowed
1369 {
1370 std::unique_ptr<ScDPSaveMember> pMember(new ScDPSaveMember(sName));
1371 if (!maDisplayName.isEmpty())
1372 pMember->SetLayoutName(maDisplayName);
1373 pMember->SetIsVisible(bDisplay);
1374 pMember->SetShowDetails(bDisplayDetails);
1375 pDataPilotField->AddMember(std::move(pMember));
1376 }
1377}
1378
1381 ScXMLDataPilotFieldContext* pTempDataPilotField) :
1382 ScXMLImportContext( rImport ),
1383 pDataPilotField(pTempDataPilotField)
1384{
1385 OUString sGroupSource;
1386 double fStart(0.0);
1387 double fEnd(0.0);
1388 double fStep(0.0);
1389 sal_Int32 nGroupPart(0);
1390 bool bDateValue(false);
1391 bool bAutoStart(true);
1392 bool bAutoEnd(true);
1393
1394 if ( rAttrList.is() )
1395 {
1396 for (auto &aIter : *rAttrList)
1397 {
1398 switch (aIter.getToken() & TOKEN_MASK)
1399 {
1401 {
1402 sGroupSource = aIter.toString();
1403 }
1404 break;
1405 case XML_DATE_START :
1406 {
1407 bDateValue = true;
1408 if (IsXMLToken(aIter, XML_AUTO))
1409 bAutoStart = true;
1410 else
1411 {
1412 GetScImport().GetMM100UnitConverter().convertDateTime(fStart, aIter.toView());
1413 bAutoStart = false;
1414 }
1415 }
1416 break;
1417 case XML_DATE_END :
1418 {
1419 bDateValue = true;
1420 if (IsXMLToken(aIter, XML_AUTO))
1421 bAutoEnd = true;
1422 else
1423 {
1424 GetScImport().GetMM100UnitConverter().convertDateTime(fEnd, aIter.toView());
1425 bAutoEnd = false;
1426 }
1427 }
1428 break;
1429 case XML_START :
1430 {
1431 if (IsXMLToken(aIter, XML_AUTO))
1432 bAutoStart = true;
1433 else
1434 {
1435 fStart = aIter.toDouble();
1436 bAutoStart = false;
1437 }
1438 }
1439 break;
1440 case XML_END :
1441 {
1442 if (IsXMLToken(aIter, XML_AUTO))
1443 bAutoEnd = true;
1444 else
1445 {
1446 fEnd = aIter.toDouble();
1447 bAutoEnd = false;
1448 }
1449 }
1450 break;
1451 case XML_STEP :
1452 {
1453 fStep = aIter.toDouble();
1454 }
1455 break;
1456 case XML_GROUPED_BY :
1457 {
1458 if (IsXMLToken(aIter, XML_SECONDS))
1459 nGroupPart = css::sheet::DataPilotFieldGroupBy::SECONDS;
1460 else if (IsXMLToken(aIter, XML_MINUTES))
1461 nGroupPart = css::sheet::DataPilotFieldGroupBy::MINUTES;
1462 else if (IsXMLToken(aIter, XML_HOURS))
1463 nGroupPart = css::sheet::DataPilotFieldGroupBy::HOURS;
1464 else if (IsXMLToken(aIter, XML_DAYS))
1465 nGroupPart = css::sheet::DataPilotFieldGroupBy::DAYS;
1466 else if (IsXMLToken(aIter, XML_MONTHS))
1467 nGroupPart = css::sheet::DataPilotFieldGroupBy::MONTHS;
1468 else if (IsXMLToken(aIter, XML_QUARTERS))
1469 nGroupPart = css::sheet::DataPilotFieldGroupBy::QUARTERS;
1470 else if (IsXMLToken(aIter, XML_YEARS))
1471 nGroupPart = css::sheet::DataPilotFieldGroupBy::YEARS;
1472 }
1473 break;
1474 }
1475 }
1476 }
1477 pDataPilotField->SetGrouping(sGroupSource, fStart, fEnd, fStep, nGroupPart, bDateValue, bAutoStart, bAutoEnd);
1478}
1479
1481{
1482}
1483
1484uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLDataPilotGroupsContext::createFastChildContext(
1485 sal_Int32 nElement, const uno::Reference< xml::sax::XFastAttributeList >& xAttrList )
1486{
1487 SvXMLImportContext *pContext = nullptr;
1490
1491 if (nElement == XML_ELEMENT( TABLE, XML_DATA_PILOT_GROUP ))
1492 {
1493 pContext = new ScXMLDataPilotGroupContext(GetScImport(), pAttribList, pDataPilotField);
1494 }
1495
1496 return pContext;
1497}
1498
1501 ScXMLDataPilotFieldContext* pTempDataPilotField) :
1502 ScXMLImportContext( rImport ),
1503 pDataPilotField(pTempDataPilotField)
1504{
1505 if ( rAttrList.is() )
1506 {
1507 auto aIter( rAttrList->find( XML_ELEMENT( TABLE, XML_NAME ) ) );
1508 if (aIter != rAttrList->end())
1509 sName = aIter.toString();
1510 }
1511}
1512
1514{
1515}
1516
1517uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLDataPilotGroupContext::createFastChildContext(
1518 sal_Int32 nElement, const uno::Reference< xml::sax::XFastAttributeList >& xAttrList )
1519{
1520 SvXMLImportContext *pContext = nullptr;
1523
1524 if (nElement == XML_ELEMENT( TABLE, XML_DATA_PILOT_MEMBER ) ||
1526 {
1527 pContext = new ScXMLDataPilotGroupMemberContext(GetScImport(), pAttribList, this);
1528 }
1529
1530 return pContext;
1531}
1532
1533void SAL_CALL ScXMLDataPilotGroupContext::endFastElement( sal_Int32 /*nElement*/ )
1534{
1535 pDataPilotField->AddGroup(std::vector(aMembers), sName);
1536}
1537
1540 ScXMLDataPilotGroupContext* pTempDataPilotGroup) :
1541 ScXMLImportContext( rImport ),
1542 pDataPilotGroup(pTempDataPilotGroup)
1543{
1544 if ( rAttrList.is() )
1545 {
1546 auto aIter( rAttrList->find( XML_ELEMENT( TABLE, XML_NAME ) ) );
1547 if (aIter != rAttrList->end())
1548 sName = aIter.toString();
1549 }
1550}
1551
1553{
1554}
1555
1556void SAL_CALL ScXMLDataPilotGroupMemberContext::endFastElement( sal_Int32 /*nElement*/ )
1557{
1558 if (!sName.isEmpty())
1560}
1561
1562/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
ScMF
Definition: attrib.hxx:34
@ HiddenMember
dp button with popup arrow
@ Button
autofilter arrow
@ ButtonPopup
@ ButtonPopup2
dp compact layout expand button
SCTAB Tab() const
Definition: address.hxx:283
SCROW Row() const
Definition: address.hxx:274
SCCOL Col() const
Definition: address.hxx:279
SC_DLLPUBLIC ScDPObject * InsertNewTable(std::unique_ptr< ScDPObject > pDPObj)
Definition: dpobject.cxx:3771
ScDPObject * GetByName(std::u16string_view rName) const
Definition: dpobject.cxx:3732
This class has to do with handling exclusively grouped dimensions? TODO: Find out what this class doe...
Definition: dpdimsave.hxx:164
void RefreshAfterLoad()
Definition: dpobject.cxx:934
std::pair< FieldType, size_t > getFieldButtonType(const ScAddress &rPos) const
void setColumnFieldCount(sal_uInt32 nCount)
void setRowFieldCount(sal_uInt32 nCount)
void setHeaderLayout(bool bHeaderLayout)
void setPageFieldCount(sal_uInt32 nCount)
void setDataFieldCount(sal_uInt32 nCount)
void setDataLayoutType(FieldType eType)
bool HasInvisibleMember() const
Definition: dpsave.cxx:624
void SetDupFlag(bool bSet)
Definition: dpsave.hxx:133
css::sheet::DataPilotFieldOrientation GetOrientation() const
Definition: dpsave.hxx:202
bool IsDataLayout() const
Definition: dpsave.hxx:142
const OUString & GetName() const
Definition: dpsave.hxx:139
Represents a new group dimension whose dimension ID is higher than the highest source dimension ID.
Definition: dpdimsave.hxx:91
void AddGroupItem(const ScDPSaveGroupItem &rItem)
Definition: dpdimsave.cxx:148
void SetDateInfo(const ScDPNumGroupInfo &rInfo, sal_Int32 nPart)
Definition: dpdimsave.cxx:142
Classes to save Data Pilot settings that create new dimensions (fields).
Definition: dpdimsave.hxx:47
void AddElement(const OUString &rName)
Definition: dpdimsave.cxx:45
Represents a group dimension that introduces a new hierarchy for an existing dimension.
Definition: dpdimsave.hxx:136
void SetDateInfo(const ScDPNumGroupInfo &rInfo, sal_Int32 nPart)
Definition: dpdimsave.cxx:530
SC_DLLPUBLIC bool ApplyFlagsTab(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, SCTAB nTab, ScMF nFlags)
Definition: document.cxx:4970
SC_DLLPUBLIC ScDPCollection * GetDPCollection()
Definition: documen3.cxx:365
static bool GetAddressFromString(ScAddress &rAddress, std::u16string_view rAddressStr, const ScDocument &rDocument, formula::FormulaGrammar::AddressConvention eConv, sal_Int32 &nOffset, sal_Unicode cSeparator=' ', sal_Unicode cQuote='\'')
String to Range core.
Definition: rangeutl.cxx:461
static bool GetRangeFromString(ScRange &rRange, std::u16string_view rRangeStr, const ScDocument &rDocument, formula::FormulaGrammar::AddressConvention eConv, sal_Int32 &nOffset, sal_Unicode cSeparator=' ', sal_Unicode cQuote='\'')
static void GetTokenByOffset(OUString &rToken, std::u16string_view rString, sal_Int32 &nOffset, sal_Unicode cSeparator=' ', sal_Unicode cQuote='\'')
Definition: rangeutl.cxx:414
This class contains authoritative information on the internal reference used as the data source for d...
Definition: dpshttab.hxx:40
SC_DLLPUBLIC void SetSourceRange(const ScRange &rRange)
Definition: dpshttab.cxx:224
SC_DLLPUBLIC void SetRangeName(const OUString &rName)
Definition: dpshttab.cxx:260
void SetQueryParam(const ScQueryParam &rParam)
Definition: dpshttab.cxx:270
static css::sheet::DataPilotFieldOrientation GetOrientationFromString(std::u16string_view rString)
static ScGeneralFunction GetFunctionFromString2(std::u16string_view rString)
virtual ~ScXMLDPSourceQueryContext() override
Definition: xmldpimp.cxx:640
ScXMLDPSourceQueryContext(ScXMLImport &rImport, const rtl::Reference< sax_fastparser::FastAttributeList > &rAttrList, ScXMLDataPilotTableContext *pDataPilotTable)
Definition: xmldpimp.cxx:618
ScXMLDPSourceSQLContext(ScXMLImport &rImport, const rtl::Reference< sax_fastparser::FastAttributeList > &rAttrList, ScXMLDataPilotTableContext *pDataPilotTable)
Definition: xmldpimp.cxx:562
virtual ~ScXMLDPSourceSQLContext() override
Definition: xmldpimp.cxx:587
virtual ~ScXMLDPSourceTableContext() override
Definition: xmldpimp.cxx:614
ScXMLDPSourceTableContext(ScXMLImport &rImport, const rtl::Reference< sax_fastparser::FastAttributeList > &rAttrList, ScXMLDataPilotTableContext *pDataPilotTable)
Definition: xmldpimp.cxx:591
ScXMLDataPilotDisplayInfoContext(ScXMLImport &rImport, const rtl::Reference< sax_fastparser::FastAttributeList > &rAttrList, ScXMLDataPilotFieldContext *pDataPilotField)
Definition: xmldpimp.cxx:1097
virtual ~ScXMLDataPilotDisplayInfoContext() override
Definition: xmldpimp.cxx:1134
void SetLayoutInfo(const css::sheet::DataPilotFieldLayoutInfo &aInfo)
Definition: xmldpimp.cxx:907
void SetShowEmpty(const bool bValue)
Definition: xmldpimp.hxx:265
void SetSubTotals(std::vector< ScGeneralFunction > &&rFunctions)
Definition: xmldpimp.hxx:267
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
Definition: xmldpimp.cxx:866
void SetGrouping(const OUString &rGroupSource, const double &rStart, const double &rEnd, const double &rStep, sal_Int32 nPart, bool bDate, bool bAutoSt, bool bAutoE)
Definition: xmldpimp.hxx:274
void SetAutoShowInfo(const css::sheet::DataPilotFieldAutoShowInfo &aInfo)
Definition: xmldpimp.hxx:271
css::sheet::DataPilotFieldOrientation nOrientation
Definition: xmldpimp.hxx:244
virtual ~ScXMLDataPilotFieldContext() override
Definition: xmldpimp.cxx:862
void AddGroup(::std::vector< OUString > &&rMembers, const OUString &rName)
Definition: xmldpimp.cxx:916
::std::vector< ScXMLDataPilotGroup > aGroups
Definition: xmldpimp.hxx:233
void SetFieldReference(const css::sheet::DataPilotFieldReference &aRef)
Definition: xmldpimp.hxx:270
ScXMLDataPilotTableContext * pDataPilotTable
Definition: xmldpimp.hxx:230
ScGeneralFunction nFunction
Definition: xmldpimp.hxx:242
void AddMember(std::unique_ptr< ScDPSaveMember > pMember)
Definition: xmldpimp.cxx:889
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
Definition: xmldpimp.cxx:924
void SetSubTotalName(const OUString &rName)
Definition: xmldpimp.cxx:901
void SetSortInfo(const css::sheet::DataPilotFieldSortInfo &aInfo)
Definition: xmldpimp.hxx:272
std::unique_ptr< ScDPSaveDimension > xDim
Definition: xmldpimp.hxx:231
ScXMLDataPilotFieldContext(ScXMLImport &rImport, const rtl::Reference< sax_fastparser::FastAttributeList > &rAttrList, ScXMLDataPilotTableContext *pDataPilotTable)
Definition: xmldpimp.cxx:790
void SetRepeatItemLabels(const bool bSet)
Definition: xmldpimp.hxx:266
virtual ~ScXMLDataPilotFieldReferenceContext() override
Definition: xmldpimp.cxx:1037
ScXMLDataPilotFieldReferenceContext(ScXMLImport &rImport, const rtl::Reference< sax_fastparser::FastAttributeList > &rAttrList, ScXMLDataPilotFieldContext *pDataPilotField)
Definition: xmldpimp.cxx:976
virtual ~ScXMLDataPilotGrandTotalContext() override
Definition: xmldpimp.cxx:715
ScXMLDataPilotTableContext * mpTableContext
Definition: xmldpimp.hxx:190
ScXMLDataPilotGrandTotalContext(ScXMLImport &rImport, const rtl::Reference< sax_fastparser::FastAttributeList > &rAttrList, ScXMLDataPilotTableContext *pTableContext)
Definition: xmldpimp.cxx:679
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
Definition: xmldpimp.cxx:719
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
Definition: xmldpimp.cxx:1517
void AddMember(const OUString &sMember)
Definition: xmldpimp.hxx:454
ScXMLDataPilotGroupContext(ScXMLImport &rImport, const rtl::Reference< sax_fastparser::FastAttributeList > &rAttrList, ScXMLDataPilotFieldContext *pDataPilotField)
Definition: xmldpimp.cxx:1499
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
Definition: xmldpimp.cxx:1533
::std::vector< OUString > aMembers
Definition: xmldpimp.hxx:439
ScXMLDataPilotFieldContext * pDataPilotField
Definition: xmldpimp.hxx:436
virtual ~ScXMLDataPilotGroupContext() override
Definition: xmldpimp.cxx:1513
ScXMLDataPilotGroupMemberContext(ScXMLImport &rImport, const rtl::Reference< sax_fastparser::FastAttributeList > &rAttrList, ScXMLDataPilotGroupContext *pDataPilotGroup)
Definition: xmldpimp.cxx:1538
virtual ~ScXMLDataPilotGroupMemberContext() override
Definition: xmldpimp.cxx:1552
ScXMLDataPilotGroupContext * pDataPilotGroup
Definition: xmldpimp.hxx:459
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
Definition: xmldpimp.cxx:1556
virtual ~ScXMLDataPilotGroupsContext() override
Definition: xmldpimp.cxx:1480
ScXMLDataPilotFieldContext * pDataPilotField
Definition: xmldpimp.hxx:420
ScXMLDataPilotGroupsContext(ScXMLImport &rImport, const rtl::Reference< sax_fastparser::FastAttributeList > &rAttrList, ScXMLDataPilotFieldContext *pDataPilotField)
Definition: xmldpimp.cxx:1379
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
Definition: xmldpimp.cxx:1484
ScXMLDataPilotLayoutInfoContext(ScXMLImport &rImport, const rtl::Reference< sax_fastparser::FastAttributeList > &rAttrList, ScXMLDataPilotFieldContext *pDataPilotField)
Definition: xmldpimp.cxx:1180
virtual ~ScXMLDataPilotLayoutInfoContext() override
Definition: xmldpimp.cxx:1221
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
Definition: xmldpimp.cxx:1068
ScXMLDataPilotFieldContext * pDataPilotField
Definition: xmldpimp.hxx:303
ScXMLDataPilotLevelContext(ScXMLImport &rImport, const rtl::Reference< sax_fastparser::FastAttributeList > &rAttrList, ScXMLDataPilotFieldContext *pDataPilotField)
Definition: xmldpimp.cxx:1041
virtual ~ScXMLDataPilotLevelContext() override
Definition: xmldpimp.cxx:1064
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
Definition: xmldpimp.cxx:1366
virtual ~ScXMLDataPilotMemberContext() override
Definition: xmldpimp.cxx:1362
ScXMLDataPilotFieldContext * pDataPilotField
Definition: xmldpimp.hxx:399
ScXMLDataPilotMemberContext(ScXMLImport &rImport, const rtl::Reference< sax_fastparser::FastAttributeList > &rAttrList, ScXMLDataPilotFieldContext *pDataPilotField)
Definition: xmldpimp.cxx:1328
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
Definition: xmldpimp.cxx:1311
ScXMLDataPilotFieldContext * pDataPilotField
Definition: xmldpimp.hxx:384
virtual ~ScXMLDataPilotMembersContext() override
Definition: xmldpimp.cxx:1307
ScXMLDataPilotMembersContext(ScXMLImport &rImport, ScXMLDataPilotFieldContext *pDataPilotField)
Definition: xmldpimp.cxx:1299
ScXMLDataPilotSortInfoContext(ScXMLImport &rImport, const rtl::Reference< sax_fastparser::FastAttributeList > &rAttrList, ScXMLDataPilotFieldContext *pDataPilotField)
Definition: xmldpimp.cxx:1138
virtual ~ScXMLDataPilotSortInfoContext() override
Definition: xmldpimp.cxx:1176
ScXMLDataPilotSubTotalContext(ScXMLImport &rImport, const rtl::Reference< sax_fastparser::FastAttributeList > &rAttrList, ScXMLDataPilotSubTotalsContext *pDataPilotSubTotals)
Definition: xmldpimp.cxx:1272
virtual ~ScXMLDataPilotSubTotalContext() override
Definition: xmldpimp.cxx:1295
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
Definition: xmldpimp.cxx:1238
virtual ~ScXMLDataPilotSubTotalsContext() override
Definition: xmldpimp.cxx:1234
void AddFunction(ScGeneralFunction nFunction)
Definition: xmldpimp.cxx:1262
void SetDisplayName(const OUString &rName)
Definition: xmldpimp.cxx:1267
std::vector< ScGeneralFunction > maFunctions
Definition: xmldpimp.hxx:354
ScXMLDataPilotSubTotalsContext(ScXMLImport &rImport, ScXMLDataPilotFieldContext *pDataPilotField)
Definition: xmldpimp.cxx:1225
ScXMLDataPilotFieldContext * pDataPilotField
Definition: xmldpimp.hxx:352
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
Definition: xmldpimp.cxx:1255
css::sheet::DataPilotFieldOrientation mnDataLayoutType
Definition: xmldpimp.hxx:96
void SetSourceRangeName(const OUString &sValue)
Definition: xmldpimp.hxx:131
void SetServiceSourceObject(const OUString &sValue)
Definition: xmldpimp.hxx:128
void SetSourceObject(const OUString &sValue)
Definition: xmldpimp.hxx:124
GrandTotalItem maRowGrandTotal
Definition: xmldpimp.hxx:74
void SetNative(bool bValue)
Definition: xmldpimp.hxx:125
void AddDimension(ScDPSaveDimension *pDim)
Definition: xmldpimp.cxx:390
void SetSourceCellRangeAddress(const ScRange &aValue)
Definition: xmldpimp.hxx:132
std::unique_ptr< ScDPDimensionSaveData > pDPDimSaveData
Definition: xmldpimp.hxx:73
void SetDatabaseName(const OUString &sValue)
Definition: xmldpimp.hxx:123
ScXMLDataPilotTableContext(ScXMLImport &rImport, const rtl::Reference< sax_fastparser::FastAttributeList > &rAttrList)
Definition: xmldpimp.cxx:85
void SetServiceName(const OUString &sValue)
Definition: xmldpimp.hxx:126
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
Definition: xmldpimp.cxx:441
SelectedPagesType maSelectedPages
Definition: xmldpimp.hxx:108
std::unique_ptr< ScDPSaveData > pDPSave
Definition: xmldpimp.hxx:72
void SetButtons(ScDPObject *pDPObject)
Definition: xmldpimp.cxx:314
ScQueryParam aSourceQueryParam
Definition: xmldpimp.hxx:89
void AddGroupDim(const ScDPSaveNumGroupDimension &aNumGroupDim)
Definition: xmldpimp.cxx:427
void SetServicePassword(const OUString &sValue)
Definition: xmldpimp.hxx:130
virtual ~ScXMLDataPilotTableContext() override
Definition: xmldpimp.cxx:194
ScMySourceType nSourceType
Definition: xmldpimp.hxx:90
void SetSelectedPage(const OUString &rDimName, const OUString &rSelected)
Definition: xmldpimp.cxx:385
void SetServiceSourceName(const OUString &sValue)
Definition: xmldpimp.hxx:127
void SetServiceUsername(const OUString &sValue)
Definition: xmldpimp.hxx:129
GrandTotalItem maColGrandTotal
Definition: xmldpimp.hxx:75
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
Definition: xmldpimp.cxx:198
void SetGrandTotal(::xmloff::token::XMLTokenEnum eOrientation, bool bVisible, const OUString &rDisplayName)
Definition: xmldpimp.cxx:538
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
Definition: xmldpimp.cxx:63
ScXMLDataPilotTablesContext(ScXMLImport &rImport)
Definition: xmldpimp.cxx:51
virtual ~ScXMLDataPilotTablesContext() override
Definition: xmldpimp.cxx:58
This class exists only to provide GetScImport() to its derived classes.
ScXMLImport & GetScImport()
void LockSolarMutex()
Definition: xmlimprt.cxx:1519
ScDocument * GetDocument()
Definition: xmlimprt.hxx:205
void UnlockSolarMutex()
Definition: xmlimprt.cxx:1537
sc::PivotTableSources & GetPivotTableSources()
Definition: xmlimprt.cxx:312
virtual ~ScXMLSourceCellRangeContext() override
Definition: xmldpimp.cxx:769
ScXMLSourceCellRangeContext(ScXMLImport &rImport, const rtl::Reference< sax_fastparser::FastAttributeList > &rAttrList, ScXMLDataPilotTableContext *pDataPilotTable)
Definition: xmldpimp.cxx:739
ScXMLDataPilotTableContext * pDataPilotTable
Definition: xmldpimp.hxx:208
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
Definition: xmldpimp.cxx:773
ScXMLSourceServiceContext(ScXMLImport &rImport, const rtl::Reference< sax_fastparser::FastAttributeList > &rAttrList, ScXMLDataPilotTableContext *pDataPilotTable)
Definition: xmldpimp.cxx:644
virtual ~ScXMLSourceServiceContext() override
Definition: xmldpimp.cxx:675
ScGeneralFunction
the css::sheet::GeneralFunction enum is extended by constants in GeneralFunction2,...
sal_uInt16 nPos
TABLE
QUERY
FastAttributeList & castToFastAttributeList(const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
XMLTokenEnum
XML_DATA_PILOT_FIELD_REFERENCE
XML_IDENTIFY_CATEGORIES
XML_TABLE_NAME
XML_COLUMN_PERCENTAGE
XML_DATA_PILOT_DISPLAY_INFO
XML_PASSWORD
XML_QUARTERS
XML_ORDER
XML_DATA_PILOT_LAYOUT_INFO
XML_MEMBER_NAME
XML_ASCENDING
XML_PARSE_SQL_STATEMENT
XML_START
XML_MEMBER_COUNT
XML_DATA_PILOT_GROUP
XML_FILTER
XML_AUTO
XML_OBJECT_NAME
XML_CELL_RANGE_ADDRESS
XML_COLUMN
XML_PREVIOUS
XML_DATABASE_NAME
XML_DATE_END
XML_QUERY_NAME
XML_OUTLINE_SUBTOTALS_TOP
XML_FIELD_NAME
XML_MEMBER_PERCENTAGE_DIFFERENCE
XML_ENABLED
XML_DATA_FIELD
XML_ROW
XML_DATA_PILOT_GROUPS
XML_HEADER_GRID_LAYOUT
XML_DATA_PILOT_SUBTOTAL
XML_DATA_PILOT_GROUP_MEMBER
XML_YEARS
XML_END
XML_MANUAL
XML_DISPLAY
XML_TRUE
XML_LAYOUT_MODE
XML_DATABASE_TABLE_NAME
XML_SOURCE_NAME
XML_NONE
XML_MEMBER_DIFFERENCE
XML_USED_HIERARCHY
XML_DATA
XML_SOURCE_SERVICE
XML_FUNCTION
XML_DATABASE_SOURCE_QUERY
XML_HOURS
XML_USER_NAME
XML_OUTLINE_SUBTOTALS_BOTTOM
XML_SORT_MODE
XML_MINUTES
XML_DATA_PILOT_SUBTOTALS
XML_DATA_PILOT_MEMBER
XML_DATA_PILOT_FIELD
XML_MONTHS
XML_REPEAT_ITEM_LABELS
XML_SELECTED_PAGE
XML_SOURCE_FIELD_NAME
XML_DAYS
XML_BUTTONS
XML_APPLICATION_DATA
XML_SHOW_FILTER_BUTTON
XML_SECONDS
XML_TOTAL_PERCENTAGE
XML_GROUPED_BY
XML_SHOW_EMPTY
XML_DISPLAY_MEMBER_MODE
XML_DATA_PILOT_SORT_INFO
XML_DISPLAY_NAME
XML_IS_DATA_LAYOUT_FIELD
XML_DATE_START
XML_RUNNING_TOTAL
XML_SQL_STATEMENT
XML_SHOW_DETAILS
XML_INDEX
XML_NAME
XML_TARGET_RANGE_ADDRESS
XML_MEMBER_PERCENTAGE
XML_STEP
XML_IGNORE_EMPTY_ROWS
XML_SHOW_DRILL_DOWN_BUTTONS
XML_FROM_BOTTOM
XML_DATA_PILOT_LEVEL
XML_GRAND_TOTAL
XML_DATA_PILOT_MEMBERS
XML_ADD_EMPTY_LINES
XML_COMPACT_LAYOUT
XML_NAMED
XML_IGNORE_SELECTED_PAGE
XML_SOURCE_CELL_RANGE
XML_DATABASE_SOURCE_TABLE
XML_DESCENDING
XML_DRILL_DOWN_ON_DOUBLE_CLICK
XML_ORIENTATION
XML_DATABASE_SOURCE_SQL
XML_MEMBER_TYPE
XML_ROW_PERCENTAGE
XML_TABULAR_LAYOUT
XML_FROM_TOP
XML_NEXT
XML_DATA_PILOT_GRAND_TOTAL
XML_DATA_PILOT_TABLE
XML_BOTH
XML_TYPE
bool IsXMLToken(std::u16string_view rString, enum XMLTokenEnum eToken)
css::sheet::DataImportMode nType
Definition: dpsdbtab.hxx:37
OUString aObject
Definition: dpsdbtab.hxx:36
OUString aDBName
Definition: dpsdbtab.hxx:35
::std::vector< OUString > aMembers
Definition: xmldpimp.hxx:224
Store pivot table data that need to be post-processed at the end of the import.
Definition: pivotsource.hxx:26
void appendSelectedPages(ScDPObject *pObj, SelectedPagesType &&rSelected)
Definition: pivotsource.cxx:47
void appendSheetSource(ScDPObject *pObj, const ScSheetSourceDesc &rDesc)
Definition: pivotsource.cxx:32
void appendDBSource(ScDPObject *pObj, const ScImportSourceDesc &rDesc)
Definition: pivotsource.cxx:37
void appendServiceSource(ScDPObject *pObj, const ScDPServiceDesc &rDesc)
Definition: pivotsource.cxx:42
bool mbVisible
bool bVisible
@ CELLRANGE
Definition: xmldpimp.hxx:46
@ SERVICE
Definition: xmldpimp.hxx:45
@ SQL
Definition: xmldpimp.hxx:42
#define XML_ELEMENT(prefix, name)
constexpr sal_Int32 TOKEN_MASK