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>
37
39
40#include <com/sun/star/sheet/DataImportMode.hpp>
41#include <com/sun/star/table/TableOrientation.hpp>
42#include <osl/diagnose.h>
43#include <o3tl/string_view.hxx>
44
45#include <memory>
46
47using namespace com::sun::star;
48using namespace xmloff::token;
49
51 ScXMLImportContext( rImport )
52{
53 // has no attributes
54 rImport.LockSolarMutex();
55}
56
58{
60}
61
62uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLDatabaseRangesContext::createFastChildContext(
63 sal_Int32 nElement,
64 const uno::Reference< xml::sax::XFastAttributeList >& xAttrList )
65{
66 SvXMLImportContext *pContext = nullptr;
69
70 switch( nElement )
71 {
73 {
74 pContext = new ScXMLDatabaseRangeContext( GetScImport(), pAttribList );
75 }
76 break;
77 }
78
79 return pContext;
80}
81
84 ScXMLImportContext( rImport ),
85 mpQueryParam(new ScQueryParam),
86 sDatabaseRangeName(STR_DB_LOCAL_NONAME),
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(true),
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 {
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.toView() ))
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
187 else if (sDatabaseRangeName.startsWith(STR_DB_GLOBAL_NONAME))
189}
190
192{
193}
194
195uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLDatabaseRangeContext::createFastChildContext(
196 sal_Int32 nElement, const uno::Reference< xml::sax::XFastAttributeList >& xAttrList )
197{
198 SvXMLImportContext *pContext = nullptr;
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;
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
242std::unique_ptr<ScDBData> ScXMLDatabaseRangeContext::ConvertToDBData(const OUString& rName)
243{
244 if (!mbValidRange)
245 return nullptr;
246
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
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.getArray()[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
322 {
323 ScSubTotalParam aParam;
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
378namespace {
379
380bool 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
396void SAL_CALL ScXMLDatabaseRangeContext::endFastElement( sal_Int32 /*nElement*/ )
397{
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
475uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLSourceSQLContext::createFastChildContext(
476 sal_Int32 nElement, const uno::Reference< xml::sax::XFastAttributeList >& xAttrList )
477{
478 SvXMLImportContext *pContext = nullptr;
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
490void 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
525uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLSourceTableContext::createFastChildContext(
526 sal_Int32 nElement, const uno::Reference< xml::sax::XFastAttributeList >& xAttrList )
527{
528 SvXMLImportContext *pContext = nullptr;
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
540void 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
574uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLSourceQueryContext::createFastChildContext(
575 sal_Int32 nElement, const uno::Reference< xml::sax::XFastAttributeList >& xAttrList )
576{
577 SvXMLImportContext *pContext = nullptr;
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
589void 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
645uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLSubTotalRulesContext::createFastChildContext(
646 sal_Int32 nElement, const uno::Reference< xml::sax::XFastAttributeList >& xAttrList )
647{
648 SvXMLImportContext *pContext = nullptr;
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 std::u16string_view sTemp = sValue.subView(0, 8);
688 if (sTemp == u"UserList")
689 {
690 pDatabaseRangeContext->SetSubTotalsEnabledUserList(true);
691 sTemp = sValue.subView(8);
692 pDatabaseRangeContext->SetSubTotalsUserListIndex(static_cast<sal_Int16>(o3tl::toInt32(sTemp)));
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
752uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLSubTotalRuleContext::createFastChildContext(
753 sal_Int32 nElement, const uno::Reference< xml::sax::XFastAttributeList >& xAttrList )
754{
755 SvXMLImportContext *pContext = nullptr;
758
759 switch (nElement)
760 {
762 {
763 pContext = new ScXMLSubTotalFieldContext( GetScImport(), pAttribList, this);
764 }
765 break;
766 }
767
768 return pContext;
769}
770
771void 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;
794 sFunction = aIter.toString();
795 break;
796 }
797 }
798}
799
801{
802}
803
804void 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: */
SCTAB Tab() const
Definition: address.hxx:283
SCROW Row() const
Definition: address.hxx:274
SCCOL Col() const
Definition: address.hxx:279
void insert(ScDBData *p)
Definition: dbdata.cxx:1339
bool insert(std::unique_ptr< ScDBData > p)
Takes ownership of p and attempts to insert it into the collection.
Definition: dbdata.cxx:1240
NamedDBs & getNamedDBs()
Definition: dbdata.hxx:324
const Link< Timer *, void > & GetRefreshHandler() const
Definition: dbdata.hxx:349
AnonDBs & getAnonDBs()
Definition: dbdata.hxx:327
bool HasAutoFilter() const
Definition: dbdata.hxx:212
void GetArea(SCTAB &rTab, SCCOL &rCol1, SCROW &rRow1, SCCOL &rCol2, SCROW &rRow2) const
Definition: dbdata.cxx:298
static SC_DLLPUBLIC ScSubTotalFunc toSubTotalFunc(ScGeneralFunction eGenFunc)
Definition: dputil.cxx:395
void PrepareQuery(SCTAB nTab, ScQueryParam &rQueryParam)
Definition: documen3.cxx:1458
std::unique_ptr< ScRefreshTimerControl > const & GetRefreshTimerControlAddress() const
Definition: document.hxx:2522
SC_DLLPUBLIC bool ApplyFlagsTab(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, SCTAB nTab, ScMF nFlags)
Definition: document.cxx:4970
SC_DLLPUBLIC ScDBCollection * GetDBCollection() const
Definition: document.hxx:827
SC_DLLPUBLIC void SetAnonymousDBData(SCTAB nTab, std::unique_ptr< ScDBData > pDBData)
Definition: document.cxx:302
static bool GetRangeFromString(ScRange &rRange, std::u16string_view rRangeStr, const ScDocument &rDocument, formula::FormulaGrammar::AddressConvention eConv, sal_Int32 &nOffset, sal_Unicode cSeparator=' ', sal_Unicode cQuote='\'')
ScAddress aEnd
Definition: address.hxx:498
ScAddress aStart
Definition: address.hxx:497
static void FillSortParam(ScSortParam &rParam, const css::uno::Sequence< css::beans::PropertyValue > &rSeq)
Definition: datauno.cxx:322
virtual ~ScXMLConResContext() override
Definition: xmldrani.cxx:611
ScXMLConResContext(ScXMLImport &rImport, const rtl::Reference< sax_fastparser::FastAttributeList > &rAttrList, ScXMLDatabaseRangeContext *pTempDatabaseRangeContext)
Definition: xmldrani.cxx:595
static css::sheet::GeneralFunction GetFunctionFromString(std::u16string_view rString)
sal_Int16 nSubTotalsUserListIndex
Definition: xmldrani.hxx:66
css::sheet::DataImportMode nSourceType
Definition: xmldrani.hxx:64
void SetSubTotalsInsertPageBreaks(const bool bTemp)
Definition: xmldrani.hxx:108
std::vector< ScSubTotalRule > aSubTotalRules
Definition: xmldrani.hxx:62
ScXMLDatabaseRangeContext(ScXMLImport &rImport, const rtl::Reference< sax_fastparser::FastAttributeList > &rAttrList)
Definition: xmldrani.cxx:82
void SetSubTotalsIsCaseSensitive(const bool bTemp)
Definition: xmldrani.hxx:107
void SetSubTotalsEnabledUserList(const bool bTemp)
Definition: xmldrani.hxx:109
void SetConnectionResource(const OUString &sTempConRes)
Definition: xmldrani.hxx:102
void SetDatabaseName(const OUString &sTempDatabaseName)
Definition: xmldrani.hxx:101
std::unique_ptr< ScQueryParam > mpQueryParam
Definition: xmldrani.hxx:55
ScRange aFilterConditionSourceRangeAddress
Definition: xmldrani.hxx:63
void SetSubTotalsAscending(const bool bTemp)
Definition: xmldrani.hxx:111
ScDBCollection::RangeType meRangeType
Definition: xmldrani.hxx:85
void SetSubTotalsUserListIndex(const sal_Int16 nTemp)
Definition: xmldrani.hxx:110
void SetSubTotalsSortGroups(const bool bTemp)
Definition: xmldrani.hxx:112
std::unique_ptr< ScDBData > ConvertToDBData(const OUString &rName)
Definition: xmldrani.cxx:242
css::uno::Sequence< css::beans::PropertyValue > aSortSequence
Definition: xmldrani.hxx:61
virtual ~ScXMLDatabaseRangeContext() override
Definition: xmldrani.cxx:191
void SetSourceObject(const OUString &sTempSourceObject)
Definition: xmldrani.hxx:103
void SetSubTotalsBindFormatsToContent(const bool bTemp)
Definition: xmldrani.hxx:106
void SetNative(const bool bTempNative)
Definition: xmldrani.hxx:105
void SetSourceType(const css::sheet::DataImportMode nTempSourceType)
Definition: xmldrani.hxx:104
void AddSubTotalRule(const ScSubTotalRule &rRule)
Definition: xmldrani.hxx:113
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 void SAL_CALL endFastElement(sal_Int32 nElement) override
Definition: xmldrani.cxx:396
ScXMLDatabaseRangesContext(ScXMLImport &rImport)
Definition: xmldrani.cxx:50
virtual ~ScXMLDatabaseRangesContext() override
Definition: xmldrani.cxx:57
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:62
This class exists only to provide GetScImport() to its derived classes.
ScXMLImport & GetScImport()
void LockSolarMutex()
Definition: xmlimprt.cxx:1519
ScDocument * GetDocument()
Definition: xmlimprt.hxx:205
void UnlockSolarMutex()
Definition: xmlimprt.cxx:1537
virtual ~ScXMLSortGroupsContext() override
Definition: xmldrani.cxx:724
ScXMLSortGroupsContext(ScXMLImport &rImport, const rtl::Reference< sax_fastparser::FastAttributeList > &rAttrList, ScXMLDatabaseRangeContext *pTempDatabaseRangeContext)
Definition: xmldrani.cxx:669
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
Definition: xmldrani.cxx:589
ScXMLDatabaseRangeContext * pDatabaseRangeContext
Definition: xmldrani.hxx:159
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
virtual ~ScXMLSourceQueryContext() override
Definition: xmldrani.cxx:570
ScXMLSourceQueryContext(ScXMLImport &rImport, const rtl::Reference< sax_fastparser::FastAttributeList > &rAttrList, ScXMLDatabaseRangeContext *pTempDatabaseRangeContext)
Definition: xmldrani.cxx:546
ScXMLDatabaseRangeContext * pDatabaseRangeContext
Definition: xmldrani.hxx:121
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
Definition: xmldrani.cxx:490
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 ~ScXMLSourceSQLContext() override
Definition: xmldrani.cxx:471
ScXMLSourceSQLContext(ScXMLImport &rImport, const rtl::Reference< sax_fastparser::FastAttributeList > &rAttrList, ScXMLDatabaseRangeContext *pTempDatabaseRangeContext)
Definition: xmldrani.cxx:444
ScXMLDatabaseRangeContext * pDatabaseRangeContext
Definition: xmldrani.hxx:140
ScXMLSourceTableContext(ScXMLImport &rImport, const rtl::Reference< sax_fastparser::FastAttributeList > &rAttrList, ScXMLDatabaseRangeContext *pTempDatabaseRangeContext)
Definition: xmldrani.cxx:496
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:525
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
Definition: xmldrani.cxx:540
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
Definition: xmldrani.cxx:804
virtual ~ScXMLSubTotalFieldContext() override
Definition: xmldrani.cxx:800
ScXMLSubTotalFieldContext(ScXMLImport &rImport, const rtl::Reference< sax_fastparser::FastAttributeList > &rAttrList, ScXMLSubTotalRuleContext *pSubTotalRuleContext)
Definition: xmldrani.cxx:777
ScXMLSubTotalRuleContext * pSubTotalRuleContext
Definition: xmldrani.hxx:241
void AddSubTotalColumn(const css::sheet::SubTotalColumn &rSubTotalColumn)
Definition: xmldrani.hxx:232
ScXMLSubTotalRuleContext(ScXMLImport &rImport, const rtl::Reference< sax_fastparser::FastAttributeList > &rAttrList, ScXMLDatabaseRangeContext *pTempDatabaseRangeContext)
Definition: xmldrani.cxx:728
ScSubTotalRule aSubTotalRule
Definition: xmldrani.hxx:217
ScXMLDatabaseRangeContext * pDatabaseRangeContext
Definition: xmldrani.hxx:216
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
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
Definition: xmldrani.cxx:771
virtual ~ScXMLSubTotalRuleContext() override
Definition: xmldrani.cxx:748
ScXMLDatabaseRangeContext * pDatabaseRangeContext
Definition: xmldrani.hxx:189
ScXMLSubTotalRulesContext(ScXMLImport &rImport, const rtl::Reference< sax_fastparser::FastAttributeList > &rAttrList, ScXMLDatabaseRangeContext *pTempDatabaseRangeContext)
Definition: xmldrani.cxx:615
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
virtual ~ScXMLSubTotalRulesContext() override
Definition: xmldrani.cxx:641
static void convertDuration(OUStringBuffer &rBuffer, const double fTime)
int nCount
float u
ScGeneralFunction
the css::sheet::GeneralFunction enum is extended by constants in GeneralFunction2,...
const SCSIZE MAXSUBTOTAL
Definition: global.hxx:82
ScSubTotalFunc
Definition: global.hxx:860
@ ScDbQuery
Definition: global.hxx:421
@ ScDbTable
Definition: global.hxx:420
constexpr OUStringLiteral STR_DB_GLOBAL_NONAME
Definition: globalnames.hxx:15
constexpr OUStringLiteral STR_DB_LOCAL_NONAME
Definition: globalnames.hxx:14
sal_uInt16 nPos
std::unique_ptr< sal_Int32[]> pData
FORM
TABLE
int i
sal_Int32 toInt32(std::u16string_view str, sal_Int16 radix=10)
FastAttributeList & castToFastAttributeList(const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
XML_SUBTOTAL_FIELD
XML_TABLE_NAME
XML_ORDER
XML_FIELD_NUMBER
XML_ASCENDING
XML_PARSE_SQL_STATEMENT
XML_BIND_STYLES_TO_CONTENT
XML_FILTER
XML_COLUMN
XML_DATABASE_NAME
XML_IS_SELECTION
XML_QUERY_NAME
XML_HREF
XML_CASE_SENSITIVE
XML_TRUE
XML_DATABASE_TABLE_NAME
XML_SORT
XML_DATABASE_RANGE
XML_ON_UPDATE_KEEP_STYLES
XML_FUNCTION
XML_DATABASE_SOURCE_QUERY
XML_REFRESH_DELAY
XML_SUBTOTAL_RULES
XML_GROUP_BY_FIELD_NUMBER
XML_SUBTOTAL_RULE
XML_DISPLAY_FILTER_BUTTONS
XML_SQL_STATEMENT
XML_NAME
XML_TARGET_RANGE_ADDRESS
XML_CONNECTION_RESOURCE
XML_SORT_GROUPS
XML_DATA_TYPE
XML_DATABASE_SOURCE_TABLE
XML_ORIENTATION
XML_CONTAINS_HEADER
XML_HAS_PERSISTENT_DATA
XML_DATABASE_SOURCE_SQL
XML_PAGE_BREAKS_ON_GROUP_CHANGE
XML_ON_UPDATE_KEEP_SIZE
bool IsXMLToken(std::u16string_view rString, enum XMLTokenEnum eToken)
OUString aStatement
Definition: global.hxx:447
sal_uInt8 nType
Definition: global.hxx:450
OUString aDBName
Definition: global.hxx:446
bool bNative
Definition: global.hxx:448
bool bImport
Definition: global.hxx:445
::std::vector< ScSortKeyState > maKeyState
Definition: sortparam.hxx:130
sal_uInt16 GetSortKeyCount() const
Definition: sortparam.hxx:148
bool bUserDef
sort user defined
bool bPagebreak
page break at change of group
bool bAscending
sort ascending
bool bGroupActive[MAXSUBTOTAL]
active groups
sal_uInt16 nUserIndex
index into list
SCCOL nField[MAXSUBTOTAL]
associated field
SCCOL nSubTotals[MAXSUBTOTAL]
number of SubTotals
bool bDoSort
presort
std::unique_ptr< ScSubTotalFunc[]> pFunctions[MAXSUBTOTAL]
array of associated functions
std::unique_ptr< SCCOL[]> pSubTotals[MAXSUBTOTAL]
array of columns to be calculated
bool bIncludePattern
sort formats
sal_Int16 nSubTotalRuleGroupFieldNumber
Definition: xmldrani.hxx:49
@ Function
sal_Int32 SCCOLROW
a type capable of holding either SCCOL or SCROW
Definition: types.hxx:23
sal_Int16 SCCOL
Definition: types.hxx:21
constexpr OUStringLiteral SC_UNONAME_ORIENT
Definition: unonames.hxx:312
#define XML_ELEMENT(prefix, name)