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