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