LibreOffice Module sc (master)  1
xmldrani.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 "xmldrani.hxx"
21 #include "xmlimprt.hxx"
22 #include "xmlfilti.hxx"
23 #include "xmlsorti.hxx"
24 #include <document.hxx>
25 #include <globalnames.hxx>
26 #include <dbdata.hxx>
27 #include <datauno.hxx>
28 #include <attrib.hxx>
29 #include <unonames.hxx>
30 #include "XMLConverter.hxx"
31 #include <rangeutl.hxx>
32 #include <dputil.hxx>
33 #include <sortparam.hxx>
34 
35 #include <xmloff/xmltoken.hxx>
36 #include <xmloff/xmlnamespace.hxx>
37 
38 #include <sax/tools/converter.hxx>
39 
40 #include <com/sun/star/sheet/DataImportMode.hpp>
41 #include <com/sun/star/table/TableOrientation.hpp>
42 #include <osl/diagnose.h>
43 
44 #include <memory>
45 
46 using namespace com::sun::star;
47 using namespace xmloff::token;
48 
50  ScXMLImportContext( rImport )
51 {
52  // has no attributes
53  rImport.LockSolarMutex();
54 }
55 
57 {
59 }
60 
61 uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLDatabaseRangesContext::createFastChildContext(
62  sal_Int32 nElement,
63  const uno::Reference< xml::sax::XFastAttributeList >& xAttrList )
64 {
65  SvXMLImportContext *pContext = nullptr;
68 
69  switch( nElement )
70  {
72  {
73  pContext = new ScXMLDatabaseRangeContext( GetScImport(), pAttribList );
74  }
75  break;
76  }
77 
78  return pContext;
79 }
80 
83  ScXMLImportContext( rImport ),
84  mpQueryParam(new ScQueryParam),
85  sDatabaseRangeName(STR_DB_LOCAL_NONAME),
86  aSortSequence(),
87  nSourceType(sheet::DataImportMode_NONE),
88  nRefresh(0),
89  nSubTotalsUserListIndex(0),
90  mbValidRange(true),
91  bContainsSort(false),
92  bContainsSubTotal(false),
93  bNative(true),
94  bIsSelection(false),
95  bKeepFormats(false),
96  bMoveCells(false),
97  bStripData(false),
98  bAutoFilter(false),
99  bSubTotalsBindFormatsToContent(false),
100  bSubTotalsIsCaseSensitive(false),
101  bSubTotalsInsertPageBreaks(false),
102  bSubTotalsSortGroups(false),
103  bSubTotalsEnabledUserList(false),
104  bSubTotalsAscending(true),
105  bFilterConditionSourceRange(false),
106  bHasHeader(true),
107  bByRow(false),
108  meRangeType(ScDBCollection::GlobalNamed)
109 {
110  if( rAttrList.is() )
111  {
112  for( auto &aIter : *rAttrList )
113  {
114  switch( aIter.getToken() )
115  {
116  case XML_ELEMENT( TABLE, XML_NAME ):
117  {
118  sDatabaseRangeName = aIter.toString();
119  }
120  break;
122  {
123  bIsSelection = IsXMLToken( aIter, XML_TRUE );
124  }
125  break;
127  {
128  bKeepFormats = IsXMLToken( aIter, XML_TRUE );
129  }
130  break;
132  {
133  bMoveCells = !IsXMLToken( aIter, XML_TRUE );
134  }
135  break;
137  {
138  bStripData = !IsXMLToken( aIter, XML_TRUE );
139  }
140  break;
142  {
143  bByRow = !IsXMLToken( aIter, XML_COLUMN );
144  mpQueryParam->bByRow = bByRow;
145  }
146  break;
148  {
149  bHasHeader = IsXMLToken( aIter, XML_TRUE );
150  mpQueryParam->bHasHeader = bHasHeader;
151  }
152  break;
154  {
155  bAutoFilter = IsXMLToken( aIter, XML_TRUE );
156  }
157  break;
159  {
160  ScDocument* pDoc = GetScImport().GetDocument();
161  assert(pDoc);
162  sal_Int32 nOffset = 0;
164  maRange, aIter.toString(), *pDoc, ::formula::FormulaGrammar::CONV_OOO, nOffset))
165  mbValidRange = false;
166  }
167  break;
169  {
170  double fTime;
171  if (::sax::Converter::convertDuration( fTime, aIter.toString() ))
172  nRefresh = std::max( static_cast<sal_Int32>(fTime * 86400.0), sal_Int32(0) );
173  }
174  break;
175  }
176  }
177  }
178 
179  mpQueryParam->nTab = maRange.aStart.Tab();
180  mpQueryParam->nCol1 = maRange.aStart.Col();
181  mpQueryParam->nRow1 = maRange.aStart.Row();
182  mpQueryParam->nCol2 = maRange.aEnd.Col();
183  mpQueryParam->nRow2 = maRange.aEnd.Row();
184 
185  if (sDatabaseRangeName.startsWith(STR_DB_LOCAL_NONAME))
187  else if (sDatabaseRangeName.startsWith(STR_DB_GLOBAL_NONAME))
189 }
190 
192 {
193 }
194 
195 uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLDatabaseRangeContext::createFastChildContext(
196  sal_Int32 nElement, const uno::Reference< xml::sax::XFastAttributeList >& xAttrList )
197 {
198  SvXMLImportContext *pContext = nullptr;
199  sax_fastparser::FastAttributeList *pAttribList =
201 
202  switch (nElement)
203  {
205  {
206  pContext = new ScXMLSourceSQLContext( GetScImport(), pAttribList, this);
207  }
208  break;
210  {
211  pContext = new ScXMLSourceTableContext( GetScImport(), pAttribList, this);
212  }
213  break;
215  {
216  pContext = new ScXMLSourceQueryContext( GetScImport(), pAttribList, this);
217  }
218  break;
219  case XML_ELEMENT( TABLE, XML_FILTER ):
220  {
221  pContext = new ScXMLFilterContext(
222  GetScImport(), pAttribList, *mpQueryParam, this);
223  }
224  break;
225  case XML_ELEMENT( TABLE, XML_SORT ):
226  {
227  bContainsSort = true;
228  pContext = new ScXMLSortContext( GetScImport(), pAttribList, this);
229  }
230  break;
232  {
233  bContainsSubTotal = true;
234  pContext = new ScXMLSubTotalRulesContext( GetScImport(), pAttribList, this);
235  }
236  break;
237  }
238 
239  return pContext;
240 }
241 
242 std::unique_ptr<ScDBData> ScXMLDatabaseRangeContext::ConvertToDBData(const OUString& rName)
243 {
244  if (!mbValidRange)
245  return nullptr;
246 
247  ScDocument* pDoc = GetScImport().GetDocument();
248 
249  ::std::unique_ptr<ScDBData> pData(
251 
252  pData->SetAutoFilter(bAutoFilter);
253  pData->SetKeepFmt(bKeepFormats);
254  pData->SetDoSize(bMoveCells);
255  pData->SetStripData(bStripData);
256 
257  pDoc->PrepareQuery(mpQueryParam->nTab, *mpQueryParam);
258 
259  pData->SetQueryParam(*mpQueryParam);
260 
262  {
263  pData->SetAdvancedQuerySource( &aFilterConditionSourceRangeAddress );
264  }
265 
266  {
267  ScImportParam aParam;
268  aParam.bNative = bNative;
270  aParam.aStatement = sSourceObject;
271  switch (nSourceType)
272  {
273  case sheet::DataImportMode_NONE:
274  aParam.bImport = false;
275  break;
276  case sheet::DataImportMode_SQL:
277  aParam.bImport = true;
278  aParam.bSql = true;
279  break;
280  case sheet::DataImportMode_TABLE:
281  aParam.bImport = true;
282  aParam.bSql = false;
283  aParam.nType = ScDbTable;
284  break;
285  case sheet::DataImportMode_QUERY:
286  aParam.bImport = true;
287  aParam.bSql = false;
288  aParam.nType = ScDbQuery;
289  break;
290  default:
291  OSL_FAIL("Unknown data import mode");
292  aParam.bImport = false;
293  }
294  pData->SetImportParam(aParam);
295  }
296 
297  if (bContainsSort)
298  {
299  size_t nOldSize = aSortSequence.getLength();
300  aSortSequence.realloc(nOldSize + 1);
301  beans::PropertyValue aProperty;
302  aProperty.Name = SC_UNONAME_ORIENT;
303  table::TableOrientation eOrient = mpQueryParam->bByRow ?
304  table::TableOrientation_ROWS : table::TableOrientation_COLUMNS;
305  aProperty.Value <<= eOrient;
306  aSortSequence[nOldSize] = aProperty;
307  ScSortParam aParam;
309 
310  SCCOLROW nStartPos = aParam.bByRow ? maRange.aStart.Col() : maRange.aStart.Row();
311  for (size_t i = 0; i < aParam.GetSortKeyCount(); ++i)
312  {
313  if (!aParam.maKeyState[i].bDoSort)
314  break;
315  aParam.maKeyState[i].nField += nStartPos;
316  }
317 
318  pData->SetSortParam(aParam);
319  }
320 
321  if (bContainsSubTotal)
322  {
323  ScSubTotalParam aParam;
329  aParam.bDoSort = bSubTotalsSortGroups;
331  size_t nPos = 0;
332  for (const auto& rSubTotalRule : aSubTotalRules)
333  {
334  if (nPos >= MAXSUBTOTAL)
335  break;
336 
337  const uno::Sequence<sheet::SubTotalColumn>& rColumns = rSubTotalRule.aSubTotalColumns;
338  sal_Int32 nColCount = rColumns.getLength();
339  sal_Int16 nGroupColumn = rSubTotalRule.nSubTotalRuleGroupFieldNumber;
340  aParam.bGroupActive[nPos] = true;
341  aParam.nField[nPos] = static_cast<SCCOL>(nGroupColumn);
342 
343  SCCOL nCount = static_cast<SCCOL>(nColCount);
344  aParam.nSubTotals[nPos] = nCount;
345  if (nCount != 0)
346  {
347  aParam.pSubTotals[nPos].reset(new SCCOL[nCount]);
348  aParam.pFunctions[nPos].reset(new ScSubTotalFunc[nCount]);
349 
350  const sheet::SubTotalColumn* pAry = rColumns.getConstArray();
351  for (SCCOL i = 0; i < nCount; ++i)
352  {
353  aParam.pSubTotals[nPos][i] = static_cast<SCCOL>(pAry[i].Column);
354  aParam.pFunctions[nPos][i] = ScDPUtil::toSubTotalFunc(static_cast<ScGeneralFunction>(pAry[i].Function));
355  }
356  }
357  else
358  {
359  aParam.pSubTotals[nPos].reset();
360  aParam.pFunctions[nPos].reset();
361  }
362  ++nPos;
363  }
364 
365  pData->SetSubTotalParam(aParam);
366  }
367 
368  if (pData->HasImportParam() && !pData->HasImportSelection())
369  {
370  pData->SetRefreshDelay(nRefresh);
371  pData->SetRefreshHandler(pDoc->GetDBCollection()->GetRefreshHandler());
372  pData->SetRefreshControl(&pDoc->GetRefreshTimerControlAddress());
373  }
374 
375  return pData;
376 }
377 
378 namespace {
379 
380 bool setAutoFilterFlags(ScDocument& rDoc, const ScDBData& rData)
381 {
382  if (!rData.HasAutoFilter())
383  return false;
384 
385  // Set autofilter flags so that the buttons get displayed.
386  ScRange aRange;
387  rData.GetArea(aRange);
388  rDoc.ApplyFlagsTab(
389  aRange.aStart.Col(), aRange.aStart.Row(), aRange.aEnd.Col(), aRange.aStart.Row(),
390  aRange.aStart.Tab(), ScMF::Auto);
391  return false;
392 }
393 
394 }
395 
396 void SAL_CALL ScXMLDatabaseRangeContext::endFastElement( sal_Int32 /*nElement*/ )
397 {
398  ScDocument* pDoc = GetScImport().GetDocument();
399  if (!pDoc)
400  return;
401 
403  {
404  ::std::unique_ptr<ScDBData> pData(ConvertToDBData(STR_DB_LOCAL_NONAME));
405 
406  if (pData)
407  {
408  ScRange aRange;
409  pData->GetArea(aRange);
410 
411  setAutoFilterFlags(*pDoc, *pData);
412  pDoc->SetAnonymousDBData(aRange.aStart.Tab(), std::move(pData));
413  }
414  return;
415  }
417  {
418  ::std::unique_ptr<ScDBData> pData(ConvertToDBData(STR_DB_GLOBAL_NONAME));
419 
420  if (pData)
421  {
422  ScRange aRange;
423  pData->GetArea(aRange);
424 
425  if (setAutoFilterFlags(*pDoc, *pData))
426  pDoc->SetAnonymousDBData(aRange.aStart.Tab(), std::move(pData));
427  else
428  pDoc->GetDBCollection()->getAnonDBs().insert(pData.release());
429  }
430  return;
431  }
433  {
434  ::std::unique_ptr<ScDBData> pData(ConvertToDBData(sDatabaseRangeName));
435 
436  if (pData)
437  {
438  setAutoFilterFlags(*pDoc, *pData);
439  (void)pDoc->GetDBCollection()->getNamedDBs().insert(std::move(pData));
440  }
441  }
442 }
443 
446  ScXMLDatabaseRangeContext* pTempDatabaseRangeContext) :
447  ScXMLImportContext( rImport ),
448  pDatabaseRangeContext(pTempDatabaseRangeContext)
449 {
450  if ( rAttrList.is() )
451  {
452  for (auto &aIter : *rAttrList)
453  {
454  switch (aIter.getToken())
455  {
457  sDBName = aIter.toString();
458  break;
460  pDatabaseRangeContext->SetSourceObject(aIter.toString());
461  break;
464  break;
465  }
466  }
467  }
468  pDatabaseRangeContext->SetSourceType(sheet::DataImportMode_SQL);
469 }
470 
472 {
473 }
474 
475 uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLSourceSQLContext::createFastChildContext(
476  sal_Int32 nElement, const uno::Reference< xml::sax::XFastAttributeList >& xAttrList )
477 {
478  SvXMLImportContext *pContext = nullptr;
479  sax_fastparser::FastAttributeList *pAttribList =
481 
482  if ( nElement == XML_ELEMENT( FORM, XML_CONNECTION_RESOURCE ) && sDBName.isEmpty() )
483  {
484  pContext = new ScXMLConResContext( GetScImport(), pAttribList, pDatabaseRangeContext);
485  }
486 
487  return pContext;
488 }
489 
490 void SAL_CALL ScXMLSourceSQLContext::endFastElement( sal_Int32 /*nElement*/ )
491 {
492  if (!sDBName.isEmpty())
494 }
495 
498  ScXMLDatabaseRangeContext* pTempDatabaseRangeContext) :
499  ScXMLImportContext( rImport ),
500  pDatabaseRangeContext(pTempDatabaseRangeContext)
501 {
502  if ( rAttrList.is() )
503  {
504  for (auto &aIter : *rAttrList)
505  {
506  switch (aIter.getToken())
507  {
509  sDBName = aIter.toString();
510  break;
513  pDatabaseRangeContext->SetSourceObject(aIter.toString());
514  break;
515  }
516  }
517  }
518  pDatabaseRangeContext->SetSourceType(sheet::DataImportMode_TABLE);
519 }
520 
522 {
523 }
524 
525 uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLSourceTableContext::createFastChildContext(
526  sal_Int32 nElement, const uno::Reference< xml::sax::XFastAttributeList >& xAttrList )
527 {
528  SvXMLImportContext *pContext = nullptr;
529  sax_fastparser::FastAttributeList *pAttribList =
531 
532  if ( nElement == XML_ELEMENT( FORM, XML_CONNECTION_RESOURCE ) && sDBName.isEmpty() )
533  {
534  pContext = new ScXMLConResContext( GetScImport(), pAttribList, pDatabaseRangeContext);
535  }
536 
537  return pContext;
538 }
539 
540 void SAL_CALL ScXMLSourceTableContext::endFastElement( sal_Int32 /*nElement*/ )
541 {
542  if (!sDBName.isEmpty())
544 }
545 
548  ScXMLDatabaseRangeContext* pTempDatabaseRangeContext) :
549  ScXMLImportContext( rImport ),
550  pDatabaseRangeContext(pTempDatabaseRangeContext)
551 {
552  if ( rAttrList.is() )
553  {
554  for (auto &aIter : *rAttrList)
555  {
556  switch (aIter.getToken())
557  {
559  sDBName = aIter.toString();
560  break;
562  pDatabaseRangeContext->SetSourceObject(aIter.toString());
563  break;
564  }
565  }
566  }
567  pDatabaseRangeContext->SetSourceType(sheet::DataImportMode_QUERY);
568 }
569 
571 {
572 }
573 
574 uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLSourceQueryContext::createFastChildContext(
575  sal_Int32 nElement, const uno::Reference< xml::sax::XFastAttributeList >& xAttrList )
576 {
577  SvXMLImportContext *pContext = nullptr;
578  sax_fastparser::FastAttributeList *pAttribList =
580 
581  if ( nElement == XML_ELEMENT( FORM, XML_CONNECTION_RESOURCE ) && sDBName.isEmpty() )
582  {
583  pContext = new ScXMLConResContext( GetScImport(), pAttribList, pDatabaseRangeContext);
584  }
585 
586  return pContext;
587 }
588 
589 void SAL_CALL ScXMLSourceQueryContext::endFastElement( sal_Int32 /*nElement*/ )
590 {
591  if (!sDBName.isEmpty())
593 }
594 
597  ScXMLDatabaseRangeContext* pDatabaseRangeContext) :
598  ScXMLImportContext( rImport )
599 {
600  OUString sConRes;
601  if ( rAttrList.is() )
602  {
603  auto aIter( rAttrList->find( XML_ELEMENT( XLINK, XML_HREF ) ) );
604  if (aIter != rAttrList->end())
605  sConRes = aIter.toString();
606  }
607  if (!sConRes.isEmpty())
608  pDatabaseRangeContext->SetConnectionResource(sConRes);
609 }
610 
612 {
613 }
614 
617  ScXMLDatabaseRangeContext* pTempDatabaseRangeContext) :
618  ScXMLImportContext( rImport ),
619  pDatabaseRangeContext(pTempDatabaseRangeContext)
620 {
621  if ( !rAttrList.is() )
622  return;
623 
624  for (auto &aIter : *rAttrList)
625  {
626  switch (aIter.getToken())
627  {
630  break;
633  break;
636  break;
637  }
638  }
639 }
640 
642 {
643 }
644 
645 uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLSubTotalRulesContext::createFastChildContext(
646  sal_Int32 nElement, const uno::Reference< xml::sax::XFastAttributeList >& xAttrList )
647 {
648  SvXMLImportContext *pContext = nullptr;
649  sax_fastparser::FastAttributeList *pAttribList =
651 
652  switch (nElement)
653  {
655  {
656  pContext = new ScXMLSortGroupsContext( GetScImport(), pAttribList, pDatabaseRangeContext);
657  }
658  break;
660  {
661  pContext = new ScXMLSubTotalRuleContext( GetScImport(), pAttribList, pDatabaseRangeContext);
662  }
663  break;
664  }
665 
666  return pContext;
667 }
668 
671  ScXMLDatabaseRangeContext* pDatabaseRangeContext) :
672  ScXMLImportContext( rImport )
673 {
674  pDatabaseRangeContext->SetSubTotalsSortGroups(true);
675  if ( !rAttrList.is() )
676  return;
677 
678  for (auto &aIter : *rAttrList)
679  {
680  switch (aIter.getToken())
681  {
683  {
684  const OUString &sValue = aIter.toString();
685  if (sValue.getLength() > 8)
686  {
687  OUString sTemp = sValue.copy(0, 8);
688  if (sTemp == "UserList")
689  {
690  pDatabaseRangeContext->SetSubTotalsEnabledUserList(true);
691  sTemp = sValue.copy(8);
692  pDatabaseRangeContext->SetSubTotalsUserListIndex(static_cast<sal_Int16>(sTemp.toInt32()));
693  }
694  else
695  {
696  //if (IsXMLToken(aIter, XML_AUTOMATIC))
697  //aSortField.FieldType = util::SortFieldType_AUTOMATIC;
698  // is not supported by StarOffice
699  }
700  }
701  else
702  {
703  //if (IsXMLToken(aIter, XML_TEXT))
704  //aSortField.FieldType = util::SortFieldType_ALPHANUMERIC;
705  // is not supported by StarOffice
706  //else if (IsXMLToken(aIter, XML_NUMBER))
707  //aSortField.FieldType = util::SortFieldType_NUMERIC;
708  // is not supported by StarOffice
709  }
710  }
711  break;
712  case XML_ELEMENT( TABLE, XML_ORDER ):
713  {
714  if (IsXMLToken(aIter, XML_ASCENDING))
715  pDatabaseRangeContext->SetSubTotalsAscending(true);
716  else
717  pDatabaseRangeContext->SetSubTotalsAscending(false);
718  }
719  break;
720  }
721  }
722 }
723 
725 {
726 }
727 
730  ScXMLDatabaseRangeContext* pTempDatabaseRangeContext) :
731  ScXMLImportContext( rImport ),
732  pDatabaseRangeContext(pTempDatabaseRangeContext)
733 {
734  if ( rAttrList.is() )
735  {
736  for (auto &aIter : *rAttrList)
737  {
738  switch (aIter.getToken())
739  {
741  aSubTotalRule.nSubTotalRuleGroupFieldNumber = static_cast<sal_Int16>(aIter.toInt32());
742  break;
743  }
744  }
745  }
746 }
747 
749 {
750 }
751 
752 uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLSubTotalRuleContext::createFastChildContext(
753  sal_Int32 nElement, const uno::Reference< xml::sax::XFastAttributeList >& xAttrList )
754 {
755  SvXMLImportContext *pContext = nullptr;
756  sax_fastparser::FastAttributeList *pAttribList =
758 
759  switch (nElement)
760  {
762  {
763  pContext = new ScXMLSubTotalFieldContext( GetScImport(), pAttribList, this);
764  }
765  break;
766  }
767 
768  return pContext;
769 }
770 
771 void SAL_CALL ScXMLSubTotalRuleContext::endFastElement( sal_Int32 /*nElement*/ )
772 {
775 }
776 
779  ScXMLSubTotalRuleContext* pTempSubTotalRuleContext) :
780  ScXMLImportContext( rImport ),
781  pSubTotalRuleContext(pTempSubTotalRuleContext)
782 {
783  if ( !rAttrList.is() )
784  return;
785 
786  for (auto &aIter : *rAttrList)
787  {
788  switch (aIter.getToken())
789  {
791  sFieldNumber = aIter.toString();
792  break;
793  case XML_ELEMENT( TABLE, XML_FUNCTION ):
794  sFunction = aIter.toString();
795  break;
796  }
797  }
798 }
799 
801 {
802 }
803 
804 void SAL_CALL ScXMLSubTotalFieldContext::endFastElement( sal_Int32 /*nElement*/ )
805 {
806  sheet::SubTotalColumn aSubTotalColumn;
807  aSubTotalColumn.Column = sFieldNumber.toInt32();
808  aSubTotalColumn.Function = ScXMLConverter::GetFunctionFromString( sFunction );
809  pSubTotalRuleContext->AddSubTotalColumn(aSubTotalColumn);
810 }
811 
812 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void SetSubTotalsAscending(const bool bTemp)
Definition: xmldrani.hxx:111
::std::vector< ScSortKeyState > maKeyState
Definition: sortparam.hxx:60
bool bGroupActive[MAXSUBTOTAL]
active groups
ScXMLSubTotalRuleContext(ScXMLImport &rImport, const rtl::Reference< sax_fastparser::FastAttributeList > &rAttrList, ScXMLDatabaseRangeContext *pTempDatabaseRangeContext)
Definition: xmldrani.cxx:728
const Link< Timer *, void > & GetRefreshHandler() const
Definition: dbdata.hxx:338
bool insert(std::unique_ptr< ScDBData > p)
Takes ownership of p and attempts to insert it into the collection.
Definition: dbdata.cxx:1180
bool HasAutoFilter() const
Definition: dbdata.hxx:204
XML_SUBTOTAL_RULE
ScXMLDatabaseRangeContext * pDatabaseRangeContext
Definition: xmldrani.hxx:121
XML_TABLE_NAME
SC_DLLPUBLIC ScDBCollection * GetDBCollection() const
Definition: document.hxx:813
SCCOL nField[MAXSUBTOTAL]
associated field
bool bUserDef
sort user defined
ScAddress aStart
Definition: address.hxx:499
virtual ~ScXMLDatabaseRangeContext() override
Definition: xmldrani.cxx:191
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: xmldrani.cxx:525
std::unique_ptr< ScDBData > ConvertToDBData(const OUString &rName)
Definition: xmldrani.cxx:242
SCROW Row() const
Definition: address.hxx:261
std::unique_ptr< ScRefreshTimerControl > const & GetRefreshTimerControlAddress() const
Definition: document.hxx:2429
OUString aDBName
Definition: global.hxx:455
ScXMLDatabaseRangeContext * pDatabaseRangeContext
Definition: xmldrani.hxx:216
XML_SQL_STATEMENT
ScXMLSourceQueryContext(ScXMLImport &rImport, const rtl::Reference< sax_fastparser::FastAttributeList > &rAttrList, ScXMLDatabaseRangeContext *pTempDatabaseRangeContext)
Definition: xmldrani.cxx:546
XML_ASCENDING
std::unique_ptr< ContentProperties > pData
void AddSubTotalColumn(const css::sheet::SubTotalColumn &rSubTotalColumn)
Definition: xmldrani.hxx:232
XML_COLUMN
XML_FIELD_NUMBER
XML_NAME
XML_ORDER
SC_DLLPUBLIC void SetAnonymousDBData(SCTAB nTab, std::unique_ptr< ScDBData > pDBData)
Definition: document.cxx:318
virtual ~ScXMLSourceSQLContext() override
Definition: xmldrani.cxx:471
ScDocument * GetDocument()
Definition: xmlimprt.hxx:205
#define STR_DB_LOCAL_NONAME
Definition: globalnames.hxx:12
XML_ORIENTATION
SC_DLLPUBLIC bool ApplyFlagsTab(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, SCTAB nTab, ScMF nFlags)
Definition: document.cxx:5038
std::unique_ptr< ScQueryParam > mpQueryParam
Definition: xmldrani.hxx:55
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
Definition: xmldrani.cxx:804
XML_DATABASE_SOURCE_QUERY
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
Definition: xmldrani.cxx:771
XML_SORT_GROUPS
void SetSubTotalsBindFormatsToContent(const bool bTemp)
Definition: xmldrani.hxx:106
ScAddress aEnd
Definition: address.hxx:500
bool IsXMLToken(std::u16string_view rString, enum XMLTokenEnum eToken)
FastAttributeList & castToFastAttributeList(const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
XML_DISPLAY_FILTER_BUTTONS
bool bDoSort
presort
XML_DATABASE_TABLE_NAME
XML_BIND_STYLES_TO_CONTENT
bool bPagebreak
page break at change of group
void SetSubTotalsSortGroups(const bool bTemp)
Definition: xmldrani.hxx:112
ScXMLSubTotalFieldContext(ScXMLImport &rImport, const rtl::Reference< sax_fastparser::FastAttributeList > &rAttrList, ScXMLSubTotalRuleContext *pSubTotalRuleContext)
Definition: xmldrani.cxx:777
XML_ON_UPDATE_KEEP_STYLES
virtual ~ScXMLSubTotalFieldContext() override
Definition: xmldrani.cxx:800
void SetSubTotalsInsertPageBreaks(const bool bTemp)
Definition: xmldrani.hxx:108
exports com.sun.star. sheet
XML_HAS_PERSISTENT_DATA
XML_DATABASE_SOURCE_SQL
sal_uInt16 nUserIndex
index into list
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: xmldrani.cxx:574
sal_Int32 SCCOLROW
a type capable of holding either SCCOL or SCROW
Definition: types.hxx:23
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
XML_IS_SELECTION
AnonDBs & getAnonDBs()
Definition: dbdata.hxx:318
void LockSolarMutex()
Definition: xmlimprt.cxx:1516
int nCount
ScSubTotalRule aSubTotalRule
Definition: xmldrani.hxx:217
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
Definition: xmldrani.cxx:540
ScXMLDatabaseRangeContext * pDatabaseRangeContext
Definition: xmldrani.hxx:140
SCTAB Tab() const
Definition: address.hxx:270
css::sheet::DataImportMode nSourceType
Definition: xmldrani.hxx:64
ScXMLSortGroupsContext(ScXMLImport &rImport, const rtl::Reference< sax_fastparser::FastAttributeList > &rAttrList, ScXMLDatabaseRangeContext *pTempDatabaseRangeContext)
Definition: xmldrani.cxx:669
XML_SUBTOTAL_FIELD
ScRange aFilterConditionSourceRangeAddress
Definition: xmldrani.hxx:63
XML_QUERY_NAME
void SetSubTotalsIsCaseSensitive(const bool bTemp)
Definition: xmldrani.hxx:107
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_ON_UPDATE_KEEP_SIZE
ScXMLSubTotalRulesContext(ScXMLImport &rImport, const rtl::Reference< sax_fastparser::FastAttributeList > &rAttrList, ScXMLDatabaseRangeContext *pTempDatabaseRangeContext)
Definition: xmldrani.cxx:615
ScXMLDatabaseRangeContext(ScXMLImport &rImport, const rtl::Reference< sax_fastparser::FastAttributeList > &rAttrList)
Definition: xmldrani.cxx:81
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
Definition: xmldrani.cxx:589
XML_CASE_SENSITIVE
This class exists only to provide GetScImport() to its derived classes.
OUString aStatement
Definition: global.hxx:456
XML_PARSE_SQL_STATEMENT
virtual ~ScXMLSourceQueryContext() override
Definition: xmldrani.cxx:570
SCCOL nSubTotals[MAXSUBTOTAL]
number of SubTotals
int i
ScXMLConResContext(ScXMLImport &rImport, const rtl::Reference< sax_fastparser::FastAttributeList > &rAttrList, ScXMLDatabaseRangeContext *pTempDatabaseRangeContext)
Definition: xmldrani.cxx:595
void insert(ScDBData *p)
Definition: dbdata.cxx:1279
sal_Int16 SCCOL
Definition: types.hxx:21
css::uno::Sequence< css::beans::PropertyValue > aSortSequence
Definition: xmldrani.hxx:61
XML_SUBTOTAL_RULES
XML_REFRESH_DELAY
void SetSourceObject(const OUString &sTempSourceObject)
Definition: xmldrani.hxx:103
bool bNative
Definition: global.hxx:457
XML_HREF
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
Definition: xmldrani.cxx:490
XML_DATABASE_NAME
std::unique_ptr< ScSubTotalFunc[]> pFunctions[MAXSUBTOTAL]
array of associated functions
virtual ~ScXMLDatabaseRangesContext() override
Definition: xmldrani.cxx:56
static void convertDuration(OUStringBuffer &rBuffer, const double fTime)
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
Definition: xmldrani.cxx:396
XML_SORT
ScXMLImport & GetScImport()
ScXMLDatabaseRangeContext * pDatabaseRangeContext
Definition: xmldrani.hxx:189
ScXMLDatabaseRangeContext * pDatabaseRangeContext
Definition: xmldrani.hxx:159
void GetArea(SCTAB &rTab, SCCOL &rCol1, SCROW &rRow1, SCCOL &rCol2, SCROW &rRow2) const
Definition: dbdata.cxx:300
static void FillSortParam(ScSortParam &rParam, const css::uno::Sequence< css::beans::PropertyValue > &rSeq)
Definition: datauno.cxx:324
SCCOL Col() const
Definition: address.hxx:266
XML_CONNECTION_RESOURCE
ScXMLSubTotalRuleContext * pSubTotalRuleContext
Definition: xmldrani.hxx:241
XML_DATA_TYPE
static css::sheet::GeneralFunction GetFunctionFromString(std::u16string_view rString)
ScXMLSourceTableContext(ScXMLImport &rImport, const rtl::Reference< sax_fastparser::FastAttributeList > &rAttrList, ScXMLDatabaseRangeContext *pTempDatabaseRangeContext)
Definition: xmldrani.cxx:496
TABLE
virtual ~ScXMLSortGroupsContext() override
Definition: xmldrani.cxx:724
void SetDatabaseName(const OUString &sTempDatabaseName)
Definition: xmldrani.hxx:101
#define SC_UNONAME_ORIENT
Definition: unonames.hxx:302
sal_uInt8 nType
Definition: global.hxx:459
XML_GROUP_BY_FIELD_NUMBER
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: xmldrani.cxx:195
virtual ~ScXMLSubTotalRulesContext() override
Definition: xmldrani.cxx:641
virtual ~ScXMLSubTotalRuleContext() override
Definition: xmldrani.cxx:748
XML_FILTER
sal_Int16 nSubTotalRuleGroupFieldNumber
Definition: xmldrani.hxx:49
#define STR_DB_GLOBAL_NONAME
Definition: globalnames.hxx:13
sal_uInt16 GetSortKeyCount() const
Definition: sortparam.hxx:78
void SetConnectionResource(const OUString &sTempConRes)
Definition: xmldrani.hxx:102
void UnlockSolarMutex()
Definition: xmlimprt.cxx:1534
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: xmldrani.cxx:61
bool bIncludePattern
sort formats
FORM
#define XML_ELEMENT(prefix, name)
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: xmldrani.cxx:475
virtual ~ScXMLConResContext() override
Definition: xmldrani.cxx:611
std::vector< ScSubTotalRule > aSubTotalRules
Definition: xmldrani.hxx:62
void AddSubTotalRule(const ScSubTotalRule &rRule)
Definition: xmldrani.hxx:113
XML_TARGET_RANGE_ADDRESS
bool bImport
Definition: global.hxx:454
ScDBCollection::RangeType meRangeType
Definition: xmldrani.hxx:85
NamedDBs & getNamedDBs()
Definition: dbdata.hxx:315
void SetSubTotalsEnabledUserList(const bool bTemp)
Definition: xmldrani.hxx:109
XML_DATABASE_RANGE
XML_TRUE
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: xmldrani.cxx:752
ScXMLDatabaseRangesContext(ScXMLImport &rImport)
Definition: xmldrani.cxx:49
void PrepareQuery(SCTAB nTab, ScQueryParam &rQueryParam)
Definition: documen3.cxx:1451
virtual ~ScXMLSourceTableContext() override
Definition: xmldrani.cxx:521
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: xmldrani.cxx:645
ScSubTotalFunc
Definition: global.hxx:844
sal_Int16 nSubTotalsUserListIndex
Definition: xmldrani.hxx:66
std::unique_ptr< SCCOL[]> pSubTotals[MAXSUBTOTAL]
array of columns to be calculated
XML_FUNCTION
void SetNative(const bool bTempNative)
Definition: xmldrani.hxx:105
ScXMLSourceSQLContext(ScXMLImport &rImport, const rtl::Reference< sax_fastparser::FastAttributeList > &rAttrList, ScXMLDatabaseRangeContext *pTempDatabaseRangeContext)
Definition: xmldrani.cxx:444
XML_DATABASE_SOURCE_TABLE
bool bAscending
sort ascending
XML_CONTAINS_HEADER
void SetSubTotalsUserListIndex(const sal_Int16 nTemp)
Definition: xmldrani.hxx:110
XML_PAGE_BREAKS_ON_GROUP_CHANGE
sal_uInt16 nPos
static SC_DLLPUBLIC ScSubTotalFunc toSubTotalFunc(ScGeneralFunction eGenFunc)
Definition: dputil.cxx:401
void SetSourceType(const css::sheet::DataImportMode nTempSourceType)
Definition: xmldrani.hxx:104
const SCSIZE MAXSUBTOTAL
Definition: global.hxx:79
typedef void(CALLTYPE *GetFuncDataPtr)(sal_uInt16 &nNo