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/xmlnmspe.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);
162  }
163  break;
164  case XML_ELEMENT( TABLE, XML_BUTTONS ):
165  {
166  sButtons = aIter.toString();
167  }
168  break;
170  {
171  bShowFilter = IsXMLToken(aIter, XML_TRUE);
172  }
173  break;
175  {
176  bDrillDown = IsXMLToken(aIter, XML_TRUE);
177  }
178  break;
180  {
182  }
183  break;
184  }
185  }
186 }
187 
189 {
190 }
191 
192 uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLDataPilotTableContext::createFastChildContext(
193  sal_Int32 nElement, const uno::Reference< xml::sax::XFastAttributeList >& xAttrList )
194 {
195  SvXMLImportContext *pContext = nullptr;
196  sax_fastparser::FastAttributeList *pAttribList =
198 
199  switch (nElement)
200  {
202  {
203  pContext = new ScXMLDPSourceSQLContext(GetScImport(), pAttribList, this);
204  nSourceType = SQL;
205  }
206  break;
208  {
209  pContext = new ScXMLDPSourceTableContext(GetScImport(), pAttribList, this);
210  nSourceType = TABLE;
211  }
212  break;
214  {
215  pContext = new ScXMLDPSourceQueryContext(GetScImport(), pAttribList, this);
216  nSourceType = QUERY;
217  }
218  break;
220  {
221  pContext = new ScXMLSourceServiceContext(GetScImport(), pAttribList, this);
223  }
224  break;
226  case XML_ELEMENT( TABLE_EXT, XML_DATA_PILOT_GRAND_TOTAL ):
227  {
228  pContext = new ScXMLDataPilotGrandTotalContext(GetScImport(), pAttribList, this);
229  }
230  break;
232  {
233  pContext = new ScXMLSourceCellRangeContext(GetScImport(), pAttribList, this);
235  }
236  break;
238  pContext = new ScXMLDataPilotFieldContext(GetScImport(), pAttribList, this);
239  break;
240  }
241 
242  return pContext;
243 }
244 
245 namespace {
246 
247 const ScDPSaveDimension* getDimension(
248  const std::vector<const ScDPSaveDimension*>& rRowDims,
249  const std::vector<const ScDPSaveDimension*>& rColDims,
250  const std::vector<const ScDPSaveDimension*>& rPageDims,
251  ScDPOutputGeometry::FieldType eType, size_t nPos)
252 {
253  switch (eType)
254  {
256  {
257  if (rColDims.size() <= nPos)
258  return nullptr;
259 
260  return rColDims[nPos];
261  }
263  {
264  if (rRowDims.size() <= nPos)
265  return nullptr;
266 
267  return rRowDims[nPos];
268  }
270  {
271  if (rPageDims.size() <= nPos)
272  return nullptr;
273 
274  return rPageDims[nPos];
275  }
277  break;
279  break;
280  default:
281  break;
282  }
283  return nullptr;
284 }
285 
286 ScDPOutputGeometry::FieldType toFieldType(sheet::DataPilotFieldOrientation nOrient)
287 {
288  switch (nOrient)
289  {
290  case sheet::DataPilotFieldOrientation_COLUMN:
292  case sheet::DataPilotFieldOrientation_DATA:
294  case sheet::DataPilotFieldOrientation_PAGE:
296  case sheet::DataPilotFieldOrientation_ROW:
298  case sheet::DataPilotFieldOrientation_HIDDEN:
299  break;
300  default:
301  break;
302  }
304 }
305 
306 }
307 
309 {
315  aGeometry.setDataLayoutType(toFieldType(mnDataLayoutType));
317 
318  std::vector<const ScDPSaveDimension*> aRowDims, aColDims, aPageDims;
319  pDPSave->GetAllDimensionsByOrientation(sheet::DataPilotFieldOrientation_ROW, aRowDims);
320  pDPSave->GetAllDimensionsByOrientation(sheet::DataPilotFieldOrientation_COLUMN, aColDims);
321  pDPSave->GetAllDimensionsByOrientation(sheet::DataPilotFieldOrientation_PAGE, aPageDims);
322 
323  OUString sAddress;
324  sal_Int32 nOffset = 0;
325  while( nOffset >= 0 )
326  {
328  if( nOffset >= 0 )
329  {
330  ScAddress aScAddress;
331  sal_Int32 nAddrOffset(0);
332  if (pDoc && ScRangeStringConverter::GetAddressFromString( aScAddress, sAddress, pDoc, ::formula::FormulaGrammar::CONV_OOO, nAddrOffset ))
333  {
334  std::pair<ScDPOutputGeometry::FieldType, size_t> aBtnType = aGeometry.getFieldButtonType(aScAddress);
335  const ScDPSaveDimension* pDim = getDimension(
336  aRowDims, aColDims, aPageDims, aBtnType.first, aBtnType.second);
337 
338  bool bDimension = pDim != nullptr;
339  bool bDataLayout = pDim && pDim->IsDataLayout();
340  bool bHasHidden = pDim && pDim->HasInvisibleMember();
341  bool bPageDim = pDim && pDim->GetOrientation() == sheet::DataPilotFieldOrientation_PAGE;
342 
343  if (bPageDim)
344  {
345  // Page dimension needs 2 buttons.
346 
347  pDoc->ApplyFlagsTab(aScAddress.Col(), aScAddress.Row(), aScAddress.Col(), aScAddress.Row(), aScAddress.Tab(), ScMF::Button);
348 
349  ScMF nMFlag = ScMF::ButtonPopup;
350  if (bHasHidden)
351  nMFlag |= ScMF::HiddenMember;
352  pDoc->ApplyFlagsTab(aScAddress.Col()+1, aScAddress.Row(), aScAddress.Col()+1, aScAddress.Row(), aScAddress.Tab(), nMFlag);
353  }
354  else
355  {
356  ScMF nMFlag = ScMF::Button;
357  if (bDataLayout)
358  {
359  // Data layout dimension only has a plain button with no popup.
360  }
361  else if (bDimension)
362  {
363  // Normal dimension has a popup arrow button.
364  if (bHasHidden)
365  nMFlag |= ScMF::HiddenMember;
366 
367  nMFlag |= ScMF::ButtonPopup;
368  }
369 
370  pDoc->ApplyFlagsTab(aScAddress.Col(), aScAddress.Row(), aScAddress.Col(), aScAddress.Row(), aScAddress.Tab(), nMFlag);
371  }
372  }
373  }
374  }
375 
376  pDPObject->RefreshAfterLoad();
377 }
378 
379 void ScXMLDataPilotTableContext::SetSelectedPage( const OUString& rDimName, const OUString& rSelected )
380 {
381  maSelectedPages.emplace(rDimName, rSelected);
382 }
383 
385 {
386  if (!pDPSave)
387  return;
388 
389  if (pDim->IsDataLayout())
391 
392  // if a dimension with that name has already been inserted,
393  // mark the new one as duplicate
394  if ( !pDim->IsDataLayout() &&
395  pDPSave->GetExistingDimensionByName(pDim->GetName()) )
396  pDim->SetDupFlag(true);
397 
398  switch (pDim->GetOrientation())
399  {
400  case sheet::DataPilotFieldOrientation_ROW:
401  ++mnRowFieldCount;
402  break;
403  case sheet::DataPilotFieldOrientation_COLUMN:
404  ++mnColFieldCount;
405  break;
406  case sheet::DataPilotFieldOrientation_PAGE:
408  break;
409  case sheet::DataPilotFieldOrientation_DATA:
411  break;
412  case sheet::DataPilotFieldOrientation_HIDDEN:
413  break;
414  default:
415  break;
416  }
417 
418  pDPSave->AddDimension(pDim);
419 }
420 
422 {
423  if (!pDPDimSaveData)
425  pDPDimSaveData->AddNumGroupDimension(aNumGroupDim);
426 }
427 
429 {
430  if (!pDPDimSaveData)
432  pDPDimSaveData->AddGroupDimension(aGroupDim);
433 }
434 
435 void SAL_CALL ScXMLDataPilotTableContext::endFastElement( sal_Int32 /*nElement*/ )
436 {
437  if (!bTargetRangeAddress)
438  return;
439 
440  std::unique_ptr<ScDPObject> pDPObject(new ScDPObject(pDoc));
441  pDPObject->SetName(sDataPilotTableName);
442  pDPObject->SetTag(sApplicationData);
443  pDPObject->SetOutRange(aTargetRangeAddress);
444  pDPObject->SetHeaderLayout(bHeaderGridLayout);
445 
447 
448  switch (nSourceType)
449  {
450  case SQL :
451  {
452  ScImportSourceDesc aImportDesc(pDoc);
453  aImportDesc.aDBName = sDatabaseName;
454  aImportDesc.aObject = sSourceObject;
455  aImportDesc.nType = sheet::DataImportMode_SQL;
456  aImportDesc.bNative = bIsNative;
457  rPivotSources.appendDBSource(pDPObject.get(), aImportDesc);
458  }
459  break;
460  case TABLE :
461  {
462  ScImportSourceDesc aImportDesc(pDoc);
463  aImportDesc.aDBName = sDatabaseName;
464  aImportDesc.aObject = sSourceObject;
465  aImportDesc.nType = sheet::DataImportMode_TABLE;
466  rPivotSources.appendDBSource(pDPObject.get(), aImportDesc);
467  }
468  break;
469  case QUERY :
470  {
471  ScImportSourceDesc aImportDesc(pDoc);
472  aImportDesc.aDBName = sDatabaseName;
473  aImportDesc.aObject = sSourceObject;
474  aImportDesc.nType = sheet::DataImportMode_QUERY;
475  rPivotSources.appendDBSource(pDPObject.get(), aImportDesc);
476  }
477  break;
478  case SERVICE :
479  {
482  rPivotSources.appendServiceSource(pDPObject.get(), aServiceDesc);
483  }
484  break;
485  case CELLRANGE :
486  {
487  if (bSourceCellRange)
488  {
489  ScSheetSourceDesc aSheetDesc(pDoc);
490  if (!sSourceRangeName.isEmpty())
491  // Range name takes precedence.
492  aSheetDesc.SetRangeName(sSourceRangeName);
493  else
495  aSheetDesc.SetQueryParam(aSourceQueryParam);
496  rPivotSources.appendSheetSource(pDPObject.get(), aSheetDesc);
497  }
498  }
499  break;
500  }
501 
502  rPivotSources.appendSelectedPages(pDPObject.get(), maSelectedPages);
503 
504  pDPSave->SetRowGrand(maRowGrandTotal.mbVisible);
505  pDPSave->SetColumnGrand(maColGrandTotal.mbVisible);
506  if (!maRowGrandTotal.maDisplayName.isEmpty())
507  // TODO: Right now, we only support one grand total name for both
508  // column and row totals. Take the value from the row total for
509  // now.
510  pDPSave->SetGrandTotalName(maRowGrandTotal.maDisplayName);
511 
512  pDPSave->SetIgnoreEmptyRows(bIgnoreEmptyRows);
513  pDPSave->SetRepeatIfEmpty(bIdentifyCategories);
514  pDPSave->SetFilterButton(bShowFilter);
515  pDPSave->SetDrillDown(bDrillDown);
516  if (pDPDimSaveData)
517  pDPSave->SetDimensionData(pDPDimSaveData.get());
518  pDPObject->SetSaveData(*pDPSave);
519 
520  ScDPCollection* pDPCollection = pDoc->GetDPCollection();
521 
522  // #i94570# Names have to be unique, or the tables can't be accessed by API.
523  if ( pDPCollection->GetByName(pDPObject->GetName()) )
524  pDPObject->SetName( OUString() ); // ignore the invalid name, create a new name in AfterXMLLoading
525 
526  SetButtons(pDPObject.get());
527 
528  pDPCollection->InsertNewTable(std::move(pDPObject));
529 }
530 
532  XMLTokenEnum eOrientation, bool bVisible, const OUString& rDisplayName)
533 {
534  switch (eOrientation)
535  {
536  case XML_BOTH:
537  maRowGrandTotal.mbVisible = bVisible;
538  maRowGrandTotal.maDisplayName = rDisplayName;
539  maColGrandTotal.mbVisible = bVisible;
540  maColGrandTotal.maDisplayName = rDisplayName;
541  break;
542  case XML_ROW:
543  maRowGrandTotal.mbVisible = bVisible;
544  maRowGrandTotal.maDisplayName = rDisplayName;
545  break;
546  case XML_COLUMN:
547  maColGrandTotal.mbVisible = bVisible;
548  maColGrandTotal.maDisplayName = rDisplayName;
549  break;
550  default:
551  break;
552  }
553 }
554 
557  ScXMLDataPilotTableContext* pDataPilotTable) :
558  ScXMLImportContext( rImport )
559 {
560  if ( !rAttrList.is() )
561  return;
562 
563  for (auto &aIter : *rAttrList)
564  {
565  switch (aIter.getToken())
566  {
568  pDataPilotTable->SetDatabaseName(aIter.toString());
569  break;
571  pDataPilotTable->SetSourceObject(aIter.toString());
572  break;
574  pDataPilotTable->SetNative(!IsXMLToken(aIter, XML_TRUE));
575  break;
576  }
577  }
578 }
579 
581 {
582 }
583 
586  ScXMLDataPilotTableContext* pDataPilotTable) :
587  ScXMLImportContext( rImport )
588 {
589  if ( !rAttrList.is() )
590  return;
591 
592  for (auto &aIter : *rAttrList)
593  {
594  switch (aIter.getToken())
595  {
597  pDataPilotTable->SetDatabaseName(aIter.toString());
598  break;
601  pDataPilotTable->SetSourceObject(aIter.toString());
602  break;
603  }
604  }
605 }
606 
608 {
609 }
610 
613  ScXMLDataPilotTableContext* pDataPilotTable) :
614  ScXMLImportContext( rImport )
615 {
616  if ( !rAttrList.is() )
617  return;
618 
619  for (auto &aIter : *rAttrList)
620  {
621  switch (aIter.getToken())
622  {
624  pDataPilotTable->SetDatabaseName(aIter.toString());
625  break;
627  pDataPilotTable->SetSourceObject(aIter.toString());
628  break;
629  }
630  }
631 }
632 
634 {
635 }
636 
639  ScXMLDataPilotTableContext* pDataPilotTable) :
640  ScXMLImportContext( rImport )
641 {
642  if ( !rAttrList.is() )
643  return;
644 
645  for (auto &aIter : *rAttrList)
646  {
647  switch (aIter.getToken())
648  {
649  case XML_ELEMENT( TABLE, XML_NAME ):
650  pDataPilotTable->SetServiceName(aIter.toString());
651  break;
653  pDataPilotTable->SetServiceSourceName(aIter.toString());
654  break;
656  pDataPilotTable->SetServiceSourceObject(aIter.toString());
657  break;
659  pDataPilotTable->SetServiceUsername(aIter.toString());
660  break;
661  case XML_ELEMENT( TABLE, XML_PASSWORD ):
662  pDataPilotTable->SetServicePassword(aIter.toString());
663  break;
664  }
665  }
666 }
667 
669 {
670 }
671 
674  ScXMLDataPilotTableContext* pTableContext ) :
675  ScXMLImportContext( rImport ),
676  mpTableContext(pTableContext),
677  meOrientation(NONE),
678  mbVisible(false)
679 {
680  if ( !rAttrList.is() )
681  return;
682 
683  for (auto &aIter : *rAttrList)
684  {
685  switch (aIter.getToken())
686  {
687  case XML_ELEMENT( TABLE, XML_DISPLAY ):
688  mbVisible = IsXMLToken(aIter, XML_TRUE);
689  break;
691  if (IsXMLToken(aIter, XML_BOTH))
693  else if (IsXMLToken(aIter, XML_ROW))
694  meOrientation = ROW;
695  else if (IsXMLToken(aIter, XML_COLUMN))
697  break;
699  case XML_ELEMENT( TABLE_EXT, XML_DISPLAY_NAME ):
700  maDisplayName = aIter.toString();
701  break;
702  default:
703  break;
704  }
705  }
706 }
707 
709 {
710 }
711 
712  void SAL_CALL ScXMLDataPilotGrandTotalContext::endFastElement( sal_Int32 /*nElement*/ )
713 {
714  XMLTokenEnum eOrient = XML_NONE;
715  switch (meOrientation)
716  {
717  case BOTH:
718  eOrient = XML_BOTH;
719  break;
720  case ROW:
721  eOrient = XML_ROW;
722  break;
723  case COLUMN:
724  eOrient = XML_COLUMN;
725  break;
726  default:
727  break;
728  }
730 }
731 
734  ScXMLDataPilotTableContext* pTempDataPilotTable) :
735  ScXMLImportContext( rImport ),
736  pDataPilotTable(pTempDataPilotTable)
737 {
738  if ( !rAttrList.is() )
739  return;
740 
741  for (auto &aIter : *rAttrList)
742  {
743  switch (aIter.getToken())
744  {
746  {
747  ScRange aSourceRangeAddress;
748  sal_Int32 nOffset(0);
749  if (ScRangeStringConverter::GetRangeFromString( aSourceRangeAddress, aIter.toString(), GetScImport().GetDocument(), ::formula::FormulaGrammar::CONV_OOO, nOffset ))
750  pDataPilotTable->SetSourceCellRangeAddress(aSourceRangeAddress);
751  }
752  break;
753  case XML_ELEMENT( TABLE, XML_NAME ):
754  pDataPilotTable->SetSourceRangeName(aIter.toString());
755  break;
756  }
757  }
758 }
759 
761 {
762 }
763 
764 uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLSourceCellRangeContext::createFastChildContext(
765  sal_Int32 nElement, const uno::Reference< xml::sax::XFastAttributeList >& xAttrList )
766 {
767  SvXMLImportContext *pContext = nullptr;
768  sax_fastparser::FastAttributeList *pAttribList =
770 
771  switch (nElement)
772  {
773  case XML_ELEMENT( TABLE, XML_FILTER ):
774  pContext = new ScXMLDPFilterContext(GetScImport(), pAttribList, pDataPilotTable);
775  break;
776  }
777 
778  return pContext;
779 }
780 
783  ScXMLDataPilotTableContext* pTempDataPilotTable) :
784  ScXMLImportContext( rImport ),
785  pDataPilotTable(pTempDataPilotTable),
786  xDim(),
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: */
::std::vector< ScXMLDataPilotGroup > aGroups
Definition: xmldpimp.hxx:231
static bool GetRangeFromString(ScRange &rRange, const OUString &rRangeStr, const ScDocument *pDocument, formula::FormulaGrammar::AddressConvention eConv, sal_Int32 &nOffset, sal_Unicode cSeparator= ' ', sal_Unicode cQuote= '\'')
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
Definition: xmldpimp.cxx:435
void SetDatabaseName(const OUString &sValue)
Definition: xmldpimp.hxx:122
bool IsXMLToken(const OUString &rString, enum XMLTokenEnum eToken)
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: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
static bool GetAddressFromString(ScAddress &rAddress, const OUString &rAddressStr, const ScDocument *pDocument, formula::FormulaGrammar::AddressConvention eConv, sal_Int32 &nOffset, sal_Unicode cSeparator= ' ', sal_Unicode cQuote= '\'')
String to Range core.
Definition: rangeutl.cxx:437
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:607
XML_HOURS
SCROW Row() const
Definition: address.hxx:262
virtual ~ScXMLDataPilotMemberContext() override
Definition: xmldpimp.cxx:1336
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:781
void SetGrandTotal(::xmloff::token::XMLTokenEnum eOrientation, bool bVisible, const OUString &rDisplayName)
Definition: xmldpimp.cxx:531
ScXMLDataPilotGrandTotalContext(ScXMLImport &rImport, const rtl::Reference< sax_fastparser::FastAttributeList > &rAttrList, ScXMLDataPilotTableContext *pTableContext)
Definition: xmldpimp.cxx:672
ScXMLDataPilotLevelContext(ScXMLImport &rImport, const rtl::Reference< sax_fastparser::FastAttributeList > &rAttrList, ScXMLDataPilotFieldContext *pDataPilotField)
Definition: xmldpimp.cxx:1024
ScGeneralFunction nFunction
Definition: xmldpimp.hxx:240
XML_ORIENTATION
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
Definition: xmldpimp.cxx:1340
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:5014
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:346
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:192
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:611
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:1080
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:1530
XML_INDEX
bool HasInvisibleMember() const
Definition: dpsave.cxx:623
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:668
virtual ~ScXMLDataPilotLevelContext() override
Definition: xmldpimp.cxx:1047
XML_MEMBER_PERCENTAGE
XML_DESCENDING
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_CELL_RANGE_ADDRESS
void AddMember(std::unique_ptr< ScDPSaveMember > pMember)
Definition: xmldpimp.cxx:881
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
Definition: xmldpimp.cxx:1507
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:1458
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:732
XML_ROW
XML_DATA_PILOT_SORT_INFO
ScXMLDataPilotGroupMemberContext(ScXMLImport &rImport, const rtl::Reference< sax_fastparser::FastAttributeList > &rAttrList, ScXMLDataPilotGroupContext *pDataPilotGroup)
Definition: xmldpimp.cxx:1512
void LockSolarMutex()
Definition: xmlimprt.cxx:1699
virtual ~ScXMLSourceCellRangeContext() override
Definition: xmldpimp.cxx:760
XML_OUTLINE_SUBTOTALS_TOP
ScXMLDPSourceTableContext(ScXMLImport &rImport, const rtl::Reference< sax_fastparser::FastAttributeList > &rAttrList, ScXMLDataPilotTableContext *pDataPilotTable)
Definition: xmldpimp.cxx:584
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_TYPE
XML_DATA_PILOT_SUBTOTAL
virtual ~ScXMLDataPilotFieldContext() override
Definition: xmldpimp.cxx:854
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:1163
css::sheet::DataPilotFieldOrientation nOrientation
Definition: xmldpimp.hxx:242
void SetDisplayName(const OUString &rName)
Definition: xmldpimp.cxx:1241
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
XML_DATA
virtual ~ScXMLDataPilotLayoutInfoContext() override
Definition: xmldpimp.cxx:1195
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:1454
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:1199
Represents a group dimension that introduces a new hierarchy for an existing dimension.
Definition: dpdimsave.hxx:132
virtual ~ScXMLDPSourceQueryContext() override
Definition: xmldpimp.cxx:633
void SetServiceSourceObject(const OUString &sValue)
Definition: xmldpimp.hxx:127
ScXMLDataPilotSortInfoContext(ScXMLImport &rImport, const rtl::Reference< sax_fastparser::FastAttributeList > &rAttrList, ScXMLDataPilotFieldContext *pDataPilotField)
Definition: xmldpimp.cxx:1121
ScXMLDataPilotGroupContext(ScXMLImport &rImport, const rtl::Reference< sax_fastparser::FastAttributeList > &rAttrList, ScXMLDataPilotFieldContext *pDataPilotField)
Definition: xmldpimp.cxx:1473
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:555
ScXMLDataPilotTableContext * mpTableContext
Definition: xmldpimp.hxx:188
void AddGroupDim(const ScDPSaveNumGroupDimension &aNumGroupDim)
Definition: xmldpimp.cxx:421
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:1281
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:1285
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:1051
OUString aDBName
Definition: dpsdbtab.hxx:36
SCCOL Col() const
Definition: address.hxx:267
virtual ~ScXMLDataPilotSubTotalsContext() override
Definition: xmldpimp.cxx:1208
virtual ~ScXMLDataPilotDisplayInfoContext() override
Definition: xmldpimp.cxx:1117
XML_IS_DATA_LAYOUT_FIELD
XML_SHOW_DETAILS
css::sheet::DataImportMode nType
Definition: dpsdbtab.hxx:38
virtual ~ScXMLDataPilotSubTotalContext() override
Definition: xmldpimp.cxx:1269
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:1526
XML_MEMBER_COUNT
XML_NEXT
ScXMLDataPilotFieldContext * pDataPilotField
Definition: xmldpimp.hxx:397
void AddGroup(const ::std::vector< OUString > &rMembers, const OUString &rName)
Definition: xmldpimp.cxx:899
TABLE
XML_SHOW_FILTER_BUTTON
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
Definition: xmldpimp.cxx:1229
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:1246
XML_BUTTONS
ScXMLDataPilotMemberContext(ScXMLImport &rImport, const rtl::Reference< sax_fastparser::FastAttributeList > &rAttrList, ScXMLDataPilotFieldContext *pDataPilotField)
Definition: xmldpimp.cxx:1302
XML_COLUMN_PERCENTAGE
std::vector< ScGeneralFunction > maFunctions
Definition: xmldpimp.hxx:352
void SetSubTotalName(const OUString &rName)
Definition: xmldpimp.cxx:893
XML_FILTER
virtual ~ScXMLDataPilotTableContext() override
Definition: xmldpimp.cxx:188
void setDataFieldCount(sal_uInt32 nCount)
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
static ScGeneralFunction GetFunctionFromString2(const OUString &rString)
void UnlockSolarMutex()
Definition: xmlimprt.cxx:1717
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:712
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:580
void SetButtons(ScDPObject *pDPObject)
Definition: xmldpimp.cxx:308
void SetSelectedPage(const OUString &rDimName, const OUString &rSelected)
Definition: xmldpimp.cxx:379
XML_FROM_BOTTOM
void AddDimension(ScDPSaveDimension *pDim)
Definition: xmldpimp.cxx:384
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:764
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:1212
XML_DATE_START
XML_RUNNING_TOTAL
ScXMLDataPilotGroupsContext(ScXMLImport &rImport, const rtl::Reference< sax_fastparser::FastAttributeList > &rAttrList, ScXMLDataPilotFieldContext *pDataPilotField)
Definition: xmldpimp.cxx:1353
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:708
XML_IGNORE_EMPTY_ROWS
XML_ADD_EMPTY_LINES
virtual ~ScXMLDataPilotSortInfoContext() override
Definition: xmldpimp.cxx:1159
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:390
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:959
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:1020
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:637
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:1491