LibreOffice Module sc (master) 1
dapiuno.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 <algorithm>
21#include <cmath>
22
23#include <o3tl/safeint.hxx>
24#include <svl/hint.hxx>
25#include <utility>
26#include <vcl/svapp.hxx>
27#include <sal/log.hxx>
28
29#include <dapiuno.hxx>
30#include <datauno.hxx>
31#include <miscuno.hxx>
32#include <convuno.hxx>
33#include <docsh.hxx>
34#include <tabvwsh.hxx>
35#include <rangeutl.hxx>
36#include <dpobject.hxx>
37#include <dpshttab.hxx>
38#include <dpsdbtab.hxx>
39#include <dpsave.hxx>
40#include <dbdocfun.hxx>
41#include <unonames.hxx>
42#include <dpdimsave.hxx>
43#include <hints.hxx>
44#include <dputil.hxx>
45#include <globstr.hrc>
46#include <scresid.hxx>
47#include <generalfunction.hxx>
48
49#include <com/sun/star/container/XNameAccess.hpp>
50#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
51#include <com/sun/star/lang/IllegalArgumentException.hpp>
52#include <com/sun/star/lang/NullPointerException.hpp>
53#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
54#include <com/sun/star/sheet/XDimensionsSupplier.hpp>
55#include <com/sun/star/sheet/XLevelsSupplier.hpp>
56#include <com/sun/star/sheet/XMembersAccess.hpp>
57#include <com/sun/star/beans/PropertyAttribute.hpp>
58#include <com/sun/star/sheet/DataImportMode.hpp>
59#include <com/sun/star/sheet/DataPilotFieldGroupBy.hpp>
60#include <com/sun/star/sheet/DataPilotFieldFilter.hpp>
61#include <com/sun/star/sheet/DataPilotOutputRangeType.hpp>
62#include <com/sun/star/sheet/DataPilotTablePositionData.hpp>
63#include <com/sun/star/sheet/GeneralFunction2.hpp>
64
70
71using namespace com::sun::star;
72using namespace com::sun::star::sheet;
73
74using ::com::sun::star::uno::Any;
75using ::com::sun::star::uno::Exception;
76using ::com::sun::star::uno::Reference;
77using ::com::sun::star::uno::RuntimeException;
78using ::com::sun::star::uno::Sequence;
79using ::com::sun::star::uno::UNO_QUERY;
80using ::com::sun::star::uno::UNO_QUERY_THROW;
81
82using ::com::sun::star::container::ElementExistException;
83using ::com::sun::star::container::NoSuchElementException;
84using ::com::sun::star::container::XEnumeration;
85using ::com::sun::star::container::XIndexAccess;
86using ::com::sun::star::container::XNameAccess;
87using ::com::sun::star::container::XNamed;
88
89using ::com::sun::star::beans::UnknownPropertyException;
90using ::com::sun::star::beans::XPropertyChangeListener;
91using ::com::sun::star::beans::XPropertySet;
92using ::com::sun::star::beans::XPropertySetInfo;
93using ::com::sun::star::beans::XVetoableChangeListener;
94
95using ::com::sun::star::lang::IllegalArgumentException;
96using ::com::sun::star::lang::IndexOutOfBoundsException;
97using ::com::sun::star::lang::NullPointerException;
98
99using ::com::sun::star::table::CellAddress;
100using ::com::sun::star::table::CellRangeAddress;
101
102namespace {
103
104o3tl::span<const SfxItemPropertyMapEntry> lcl_GetDataPilotDescriptorBaseMap()
105{
106 static const SfxItemPropertyMapEntry aDataPilotDescriptorBaseMap_Impl[] =
107 {
110 { SC_UNO_DP_GRANDTOTAL_NAME,0,cppu::UnoType<OUString>::get(), beans::PropertyAttribute::MAYBEVOID, 0 },
118 };
119 return aDataPilotDescriptorBaseMap_Impl;
120}
121
122o3tl::span<const SfxItemPropertyMapEntry> lcl_GetDataPilotFieldMap()
123{
124 using namespace ::com::sun::star::beans::PropertyAttribute;
125 static const SfxItemPropertyMapEntry aDataPilotFieldMap_Impl[] =
126 {
146 };
147 return aDataPilotFieldMap_Impl;
148}
149
150o3tl::span<const SfxItemPropertyMapEntry> lcl_GetDataPilotItemMap()
151{
152 static const SfxItemPropertyMapEntry aDataPilotItemMap_Impl[] =
153 {
157 };
158 return aDataPilotItemMap_Impl;
159}
160
161bool lclCheckValidDouble( double fValue, bool bAuto )
162{
163 return bAuto || std::isfinite( fValue );
164}
165
166bool lclCheckMinMaxStep( const DataPilotFieldGroupInfo& rInfo )
167{
168 return
169 lclCheckValidDouble( rInfo.Start, rInfo.HasAutoStart ) &&
170 lclCheckValidDouble( rInfo.End, rInfo.HasAutoEnd ) &&
171 (rInfo.HasAutoStart || rInfo.HasAutoEnd || (rInfo.Start <= rInfo.End)) &&
172 lclCheckValidDouble( rInfo.Step, false ) &&
173 (0.0 <= rInfo.Step);
174}
175
176} // namespace
177
178SC_SIMPLE_SERVICE_INFO( ScDataPilotDescriptor, "ScDataPilotDescriptor", "stardiv::one::sheet::DataPilotDescriptor" )
179SC_SIMPLE_SERVICE_INFO( ScDataPilotFieldObj, "ScDataPilotFieldObj", "com.sun.star.sheet.DataPilotField" )
180SC_SIMPLE_SERVICE_INFO( ScDataPilotFieldsObj, "ScDataPilotFieldsObj", "com.sun.star.sheet.DataPilotFields" )
181SC_SIMPLE_SERVICE_INFO( ScDataPilotTableObj, "ScDataPilotTableObj", "com.sun.star.sheet.DataPilotTable" )
182SC_SIMPLE_SERVICE_INFO( ScDataPilotTablesObj, "ScDataPilotTablesObj", "com.sun.star.sheet.DataPilotTables" )
183SC_SIMPLE_SERVICE_INFO( ScDataPilotItemsObj, "ScDataPilotItemsObj", "com.sun.star.sheet.DataPilotItems" )
184SC_SIMPLE_SERVICE_INFO( ScDataPilotItemObj, "ScDataPilotItemObj", "com.sun.star.sheet.DataPilotItem" )
185
186SC_SIMPLE_SERVICE_INFO( ScDataPilotFieldGroupsObj, "ScDataPilotFieldGroupsObj", "com.sun.star.sheet.DataPilotFieldGroups" )
187SC_SIMPLE_SERVICE_INFO( ScDataPilotFieldGroupObj, "ScDataPilotFieldGroupObj", "com.sun.star.sheet.DataPilotFieldGroup" )
188SC_SIMPLE_SERVICE_INFO( ScDataPilotFieldGroupItemObj, "ScDataPilotFieldGroupItemObj", "com.sun.star.sheet.DataPilotFieldGroupItem" )
189
190// name that is used in the API for the data layout field
191constexpr OUStringLiteral SC_DATALAYOUT_NAME = u"Data";
192
194{
195 if ( nBits & PivotFunc::Sum ) return ScGeneralFunction::SUM;
196 if ( nBits & PivotFunc::Count ) return ScGeneralFunction::COUNT;
198 if ( nBits & PivotFunc::Median ) return ScGeneralFunction::MEDIAN;
199 if ( nBits & PivotFunc::Max ) return ScGeneralFunction::MAX;
200 if ( nBits & PivotFunc::Min ) return ScGeneralFunction::MIN;
203 if ( nBits & PivotFunc::StdDev ) return ScGeneralFunction::STDEV;
204 if ( nBits & PivotFunc::StdDevP ) return ScGeneralFunction::STDEVP;
205 if ( nBits & PivotFunc::StdVar ) return ScGeneralFunction::VAR;
206 if ( nBits & PivotFunc::StdVarP ) return ScGeneralFunction::VARP;
207 if ( nBits & PivotFunc::Auto ) return ScGeneralFunction::AUTO;
209}
210
212{
213 PivotFunc nRet = PivotFunc::NONE; // 0
214 switch (eFunc)
215 {
216 case GeneralFunction2::SUM: nRet = PivotFunc::Sum; break;
217 case GeneralFunction2::COUNT: nRet = PivotFunc::Count; break;
218 case GeneralFunction2::AVERAGE: nRet = PivotFunc::Average; break;
219 case GeneralFunction2::MEDIAN: nRet = PivotFunc::Median; break;
220 case GeneralFunction2::MAX: nRet = PivotFunc::Max; break;
221 case GeneralFunction2::MIN: nRet = PivotFunc::Min; break;
222 case GeneralFunction2::PRODUCT: nRet = PivotFunc::Product; break;
223 case GeneralFunction2::COUNTNUMS: nRet = PivotFunc::CountNum; break;
224 case GeneralFunction2::STDEV: nRet = PivotFunc::StdDev; break;
225 case GeneralFunction2::STDEVP: nRet = PivotFunc::StdDevP; break;
226 case GeneralFunction2::VAR: nRet = PivotFunc::StdVar; break;
227 case GeneralFunction2::VARP: nRet = PivotFunc::StdVarP; break;
228 case GeneralFunction2::AUTO: nRet = PivotFunc::Auto; break;
229 default:
230 {
231 assert(false);
232 }
233 }
234 return nRet;
235}
236
237void ScDataPilotConversion::FillGroupInfo( DataPilotFieldGroupInfo& rInfo, const ScDPNumGroupInfo& rGroupInfo )
238{
239 rInfo.HasDateValues = rGroupInfo.mbDateValues;
240 rInfo.HasAutoStart = rGroupInfo.mbAutoStart;
241 rInfo.Start = rGroupInfo.mfStart;
242 rInfo.HasAutoEnd = rGroupInfo.mbAutoEnd;
243 rInfo.End = rGroupInfo.mfEnd;
244 rInfo.Step = rGroupInfo.mfStep;
245}
246
247static ScDPObject* lcl_GetDPObject( ScDocShell* pDocShell, SCTAB nTab, std::u16string_view rName )
248{
249 if (pDocShell)
250 {
251 ScDocument& rDoc = pDocShell->GetDocument();
252 ScDPCollection* pColl = rDoc.GetDPCollection();
253 if ( pColl )
254 {
255 size_t nCount = pColl->GetCount();
256 for (size_t i=0; i<nCount; ++i)
257 {
258 ScDPObject& rDPObj = (*pColl)[i];
259 if ( rDPObj.GetOutRange().aStart.Tab() == nTab &&
260 rDPObj.GetName() == rName )
261 return &rDPObj;
262 }
263 }
264 }
265 return nullptr; // not found
266}
267
268static OUString lcl_CreatePivotName( ScDocShell* pDocShell )
269{
270 if (pDocShell)
271 {
272 ScDocument& rDoc = pDocShell->GetDocument();
273 ScDPCollection* pColl = rDoc.GetDPCollection();
274 if ( pColl )
275 return pColl->CreateNewName();
276 }
277 return OUString(); // shouldn't happen
278}
279
280static sal_Int32 lcl_GetObjectIndex( ScDPObject* pDPObj, const ScFieldIdentifier& rFieldId )
281{
282 // used for items - nRepeat in identifier can be ignored
283 if ( pDPObj )
284 {
285 sal_Int32 nCount = pDPObj->GetDimCount();
286 for ( sal_Int32 nDim = 0; nDim < nCount; ++nDim )
287 {
288 bool bIsDataLayout = false;
289 OUString aDimName( pDPObj->GetDimName( nDim, bIsDataLayout ) );
290 if ( rFieldId.mbDataLayout ? bIsDataLayout : (aDimName == rFieldId.maFieldName) )
291 return nDim;
292 }
293 }
294 return -1; // none
295}
296
298 pDocShell( &rDocSh ),
299 nTab( nT )
300{
302}
303
305{
307
308 if (pDocShell)
310}
311
313{
315
316 if ( rHint.GetId() == SfxHintId::Dying )
317 {
318 pDocShell = nullptr; // became invalid
319 }
320}
321
322// XDataPilotTables
323
325{
326 if (pDocShell)
327 {
329 ScDPCollection* pColl = rDoc.GetDPCollection();
330 if ( pColl )
331 {
332 // count tables on this sheet
333 sal_Int32 nFound = 0;
334 size_t nCount = pColl->GetCount();
335 for (size_t i=0; i<nCount; ++i)
336 {
337 ScDPObject& rDPObj = (*pColl)[i];
338 if ( rDPObj.GetOutRange().aStart.Tab() == nTab )
339 {
340 if ( nFound == nIndex )
341 {
342 return new ScDataPilotTableObj(*pDocShell, nTab, rDPObj.GetName());
343 }
344 ++nFound;
345 }
346 }
347 }
348 }
349 return nullptr;
350}
351
353{
354 if (hasByName(rName))
355 return new ScDataPilotTableObj(*pDocShell, nTab, rName);
356 return nullptr;
357}
358
359Reference<XDataPilotDescriptor> SAL_CALL ScDataPilotTablesObj::createDataPilotDescriptor()
360{
361 SolarMutexGuard aGuard;
362 if (pDocShell)
363 return new ScDataPilotDescriptor(*pDocShell);
364 return nullptr;
365}
366
367static bool lcl_IsDuplicated(const Reference<XPropertySet>& rDimProps)
368{
369 try
370 {
371 Any aAny = rDimProps->getPropertyValue( SC_UNO_DP_ORIGINAL );
372 Reference< XNamed > xOriginal( aAny, UNO_QUERY );
373 return xOriginal.is();
374 }
375 catch( Exception& )
376 {
377 }
378 return false;
379}
380
381static OUString lcl_GetOriginalName(const Reference< XNamed >& rDim)
382{
383 Reference< XNamed > xOriginal;
384
385 Reference< XPropertySet > xDimProps(rDim, UNO_QUERY);
386 if ( xDimProps.is() )
387 {
388 try
389 {
390 Any aAny = xDimProps->getPropertyValue(SC_UNO_DP_ORIGINAL);
391 aAny >>= xOriginal;
392 }
393 catch( Exception& )
394 {
395 }
396 }
397
398 if ( !xOriginal.is() )
399 xOriginal = rDim;
400
401 return xOriginal->getName();
402}
403
404void SAL_CALL ScDataPilotTablesObj::insertNewByName( const OUString& aNewName,
405 const CellAddress& aOutputAddress,
406 const Reference<XDataPilotDescriptor>& xDescriptor )
407{
408 SolarMutexGuard aGuard;
409 if (!xDescriptor.is()) return;
410
411 if ( !aNewName.isEmpty() && hasByName( aNewName ) )
412 throw IllegalArgumentException("Name \"" + aNewName + "\" already exists", getXWeak(), 0);
413
414 if (!pDocShell)
415 throw RuntimeException("DocShell is null", getXWeak());
416
417 auto pImp = dynamic_cast<ScDataPilotDescriptorBase*>( xDescriptor.get() );
418 if (!pImp)
419 throw RuntimeException("Failed to get ScDataPilotDescriptor", getXWeak());
420
421 ScDPObject* pNewObj = pImp->GetDPObject();
422 if (!pNewObj)
423 throw RuntimeException("Failed to get DPObject", getXWeak());
424
425 ScRange aOutputRange(static_cast<SCCOL>(aOutputAddress.Column), static_cast<SCROW>(aOutputAddress.Row), static_cast<SCTAB>(aOutputAddress.Sheet),
426 static_cast<SCCOL>(aOutputAddress.Column), static_cast<SCROW>(aOutputAddress.Row), static_cast<SCTAB>(aOutputAddress.Sheet));
427 pNewObj->SetOutRange(aOutputRange);
428 OUString aName = aNewName;
429 if (aName.isEmpty())
431 pNewObj->SetName(aName);
432 OUString aTag = xDescriptor->getTag();
433 pNewObj->SetTag(aTag);
434
435 // todo: handle double fields (for more information see ScDPObject)
436
437 ScDBDocFunc aFunc(*pDocShell);
438 if (!aFunc.CreatePivotTable(*pNewObj, true, true))
439 throw RuntimeException("Failed to create pivot table", getXWeak());
440}
441
442void SAL_CALL ScDataPilotTablesObj::removeByName( const OUString& aName )
443{
444 SolarMutexGuard aGuard;
446 if (!pDPObj || !pDocShell)
447 throw RuntimeException(); // no other exceptions specified
448
449 ScDBDocFunc aFunc(*pDocShell);
450 aFunc.RemovePivotTable(*pDPObj, true, true); // remove - incl. undo etc.
451
452}
453
454// XEnumerationAccess
455
456Reference< XEnumeration > SAL_CALL ScDataPilotTablesObj::createEnumeration()
457{
458 SolarMutexGuard aGuard;
459 return new ScIndexEnumeration(this, "com.sun.star.sheet.DataPilotTablesEnumeration");
460}
461
462// XIndexAccess
463
465{
466 SolarMutexGuard aGuard;
467 if ( pDocShell )
468 {
470 ScDPCollection* pColl = rDoc.GetDPCollection();
471 if ( pColl )
472 {
473 // count tables on this sheet
474
475 sal_uInt16 nFound = 0;
476 size_t nCount = pColl->GetCount();
477 for (size_t i=0; i<nCount; ++i)
478 {
479 ScDPObject& rDPObj = (*pColl)[i];
480 if ( rDPObj.GetOutRange().aStart.Tab() == nTab )
481 ++nFound;
482 }
483 return nFound;
484 }
485 }
486
487 return 0;
488}
489
490Any SAL_CALL ScDataPilotTablesObj::getByIndex( sal_Int32 nIndex )
491{
492 SolarMutexGuard aGuard;
493 Reference<XDataPilotTable2> xTable(GetObjectByIndex_Impl(nIndex));
494 if (!xTable.is())
495 throw IndexOutOfBoundsException();
496 return Any( xTable );
497}
498
500{
502}
503
505{
506 SolarMutexGuard aGuard;
507 return ( getCount() != 0 );
508}
509
510// XNameAccess
511
512Any SAL_CALL ScDataPilotTablesObj::getByName( const OUString& aName )
513{
514 SolarMutexGuard aGuard;
515 Reference<XDataPilotTable2> xTable(GetObjectByName_Impl(aName));
516 if (!xTable.is())
517 throw NoSuchElementException();
518 return Any( xTable );
519}
520
521Sequence<OUString> SAL_CALL ScDataPilotTablesObj::getElementNames()
522{
523 SolarMutexGuard aGuard;
524 if (pDocShell)
525 {
527 ScDPCollection* pColl = rDoc.GetDPCollection();
528 if ( pColl )
529 {
530 // count tables on this sheet
531
532 sal_uInt16 nFound = 0;
533 size_t nCount = pColl->GetCount();
534 size_t i;
535 for (i=0; i<nCount; ++i)
536 {
537 ScDPObject& rDPObj = (*pColl)[i];
538 if ( rDPObj.GetOutRange().aStart.Tab() == nTab )
539 ++nFound;
540 }
541
542 sal_uInt16 nPos = 0;
543 Sequence<OUString> aSeq(nFound);
544 OUString* pAry = aSeq.getArray();
545 for (i=0; i<nCount; ++i)
546 {
547 ScDPObject& rDPObj = (*pColl)[i];
548 if ( rDPObj.GetOutRange().aStart.Tab() == nTab )
549 pAry[nPos++] = rDPObj.GetName();
550 }
551
552 return aSeq;
553 }
554 }
555 return {};
556}
557
558sal_Bool SAL_CALL ScDataPilotTablesObj::hasByName( const OUString& aName )
559{
560 SolarMutexGuard aGuard;
561 if (pDocShell)
562 {
564 ScDPCollection* pColl = rDoc.GetDPCollection();
565 if ( pColl )
566 {
567 size_t nCount = pColl->GetCount();
568 for (size_t i=0; i<nCount; ++i)
569 {
570 ScDPObject& rDPObj = (*pColl)[i];
571 if ( rDPObj.GetOutRange().aStart.Tab() == nTab &&
572 rDPObj.GetName() == aName )
573 return true;
574 }
575 }
576 }
577 return false;
578}
579
581 maPropSet( lcl_GetDataPilotDescriptorBaseMap() ),
582 pDocShell( &rDocSh )
583{
585}
586
588{
590
591 if (pDocShell)
593}
594
596{
598
599 if ( rHint.GetId() == SfxHintId::Dying )
600 {
601 pDocShell = nullptr; // became invalid
602 }
603}
604
605// XDataPilotDescriptor
606
608{
609 SolarMutexGuard aGuard;
610
611 ScDPObject* pDPObject(GetDPObject());
612 if (!pDPObject)
613 throw RuntimeException("Failed to get DPObject", getXWeak());
614
615 CellRangeAddress aRet;
616 if (pDPObject->IsSheetData())
618 return aRet;
619}
620
621void SAL_CALL ScDataPilotDescriptorBase::setSourceRange( const CellRangeAddress& aSourceRange )
622{
623 SolarMutexGuard aGuard;
624
625 ScDPObject* pDPObject = GetDPObject();
626 if (!pDPObject)
627 throw RuntimeException("Failed to get DPObject", getXWeak());
628
630 if (pDPObject->IsSheetData())
631 aSheetDesc = *pDPObject->GetSheetDesc();
632
633 ScRange aRange;
634 ScUnoConversion::FillScRange(aRange, aSourceRange);
635 aSheetDesc.SetSourceRange(aRange);
636 pDPObject->SetSheetDesc( aSheetDesc );
637 SetDPObject( pDPObject );
638}
639
640Reference<XSheetFilterDescriptor> SAL_CALL ScDataPilotDescriptorBase::getFilterDescriptor()
641{
642 SolarMutexGuard aGuard;
643 return new ScDataPilotFilterDescriptor( pDocShell, this );
644}
645
646Reference<XIndexAccess> SAL_CALL ScDataPilotDescriptorBase::getDataPilotFields()
647{
648 SolarMutexGuard aGuard;
649 return new ScDataPilotFieldsObj( *this );
650}
651
652Reference<XIndexAccess> SAL_CALL ScDataPilotDescriptorBase::getColumnFields()
653{
654 SolarMutexGuard aGuard;
655 return new ScDataPilotFieldsObj( *this, DataPilotFieldOrientation_COLUMN );
656}
657
658Reference<XIndexAccess> SAL_CALL ScDataPilotDescriptorBase::getRowFields()
659{
660 SolarMutexGuard aGuard;
661 return new ScDataPilotFieldsObj( *this, DataPilotFieldOrientation_ROW );
662}
663
664Reference<XIndexAccess> SAL_CALL ScDataPilotDescriptorBase::getPageFields()
665{
666 SolarMutexGuard aGuard;
667 return new ScDataPilotFieldsObj( *this, DataPilotFieldOrientation_PAGE );
668}
669
670Reference<XIndexAccess> SAL_CALL ScDataPilotDescriptorBase::getDataFields()
671{
672 SolarMutexGuard aGuard;
673 return new ScDataPilotFieldsObj( *this, DataPilotFieldOrientation_DATA );
674}
675
676Reference<XIndexAccess> SAL_CALL ScDataPilotDescriptorBase::getHiddenFields()
677{
678 SolarMutexGuard aGuard;
679 return new ScDataPilotFieldsObj( *this, DataPilotFieldOrientation_HIDDEN );
680}
681
682// XPropertySet
683Reference< XPropertySetInfo > SAL_CALL ScDataPilotDescriptorBase::getPropertySetInfo( )
684{
685 SolarMutexGuard aGuard;
686 static Reference<XPropertySetInfo> aRef =
688 return aRef;
689}
690
691void SAL_CALL ScDataPilotDescriptorBase::setPropertyValue( const OUString& aPropertyName, const Any& aValue )
692{
693 SolarMutexGuard aGuard;
694 ScDPObject* pDPObject = GetDPObject();
695 if (!pDPObject)
696 return;
697
698 ScDPSaveData* pOldData = pDPObject->GetSaveData();
699 OSL_ENSURE(pOldData, "Here should be a SaveData");
700 if ( pOldData )
701 {
702 ScDPSaveData aNewData( *pOldData );
703
704 if ( aPropertyName == SC_UNO_DP_COLGRAND )
705 {
706 aNewData.SetColumnGrand(::cppu::any2bool( aValue ));
707 }
708 else if ( aPropertyName == SC_UNO_DP_IGNORE_EMPTYROWS )
709 {
710 aNewData.SetIgnoreEmptyRows(::cppu::any2bool( aValue ));
711 }
712 else if ( aPropertyName == SC_UNO_DP_REPEATEMPTY )
713 {
714 aNewData.SetRepeatIfEmpty(::cppu::any2bool( aValue ));
715 }
716 else if ( aPropertyName == SC_UNO_DP_ROWGRAND )
717 {
718 aNewData.SetRowGrand(::cppu::any2bool( aValue ));
719 }
720 else if ( aPropertyName == SC_UNO_DP_SHOWFILTER )
721 {
722 aNewData.SetFilterButton(::cppu::any2bool( aValue ));
723 }
724 else if ( aPropertyName == SC_UNO_DP_DRILLDOWN )
725 {
726 aNewData.SetDrillDown(::cppu::any2bool( aValue ));
727 }
728 else if ( aPropertyName == SC_UNO_DP_GRANDTOTAL_NAME )
729 {
730 OUString aStrVal;
731 if ( aValue >>= aStrVal )
732 aNewData.SetGrandTotalName(aStrVal);
733 }
734 else if ( aPropertyName == SC_UNO_DP_IMPORTDESC )
735 {
736 uno::Sequence<beans::PropertyValue> aArgSeq;
737 if ( aValue >>= aArgSeq )
738 {
740
741 const ScImportSourceDesc* pOldDesc = pDPObject->GetImportSourceDesc();
742 if (pOldDesc)
743 aImportDesc = *pOldDesc;
744
745 ScImportParam aParam;
746 ScImportDescriptor::FillImportParam( aParam, aArgSeq );
747
748 sheet::DataImportMode nNewType = sheet::DataImportMode_NONE;
749 if ( aParam.bImport )
750 {
751 if ( aParam.bSql )
752 nNewType = sheet::DataImportMode_SQL;
753 else if ( aParam.nType == ScDbQuery )
754 nNewType = sheet::DataImportMode_QUERY;
755 else
756 nNewType = sheet::DataImportMode_TABLE;
757 }
758 aImportDesc.nType = nNewType;
759 aImportDesc.aDBName = aParam.aDBName;
760 aImportDesc.aObject = aParam.aStatement;
761 aImportDesc.bNative = aParam.bNative;
762
763 pDPObject->SetImportDesc( aImportDesc );
764 }
765 }
766 else if ( aPropertyName == SC_UNO_DP_SOURCESERVICE )
767 {
768 OUString aStrVal;
769 if ( aValue >>= aStrVal )
770 {
771 ScDPServiceDesc aServiceDesc("", "", "", "", "");
772
773 const ScDPServiceDesc* pOldDesc = pDPObject->GetDPServiceDesc();
774 if (pOldDesc)
775 aServiceDesc = *pOldDesc;
776
777 aServiceDesc.aServiceName = aStrVal;
778
779 pDPObject->SetServiceData( aServiceDesc );
780 }
781 }
782 else if ( aPropertyName == SC_UNO_DP_SERVICEARG )
783 {
784 uno::Sequence<beans::PropertyValue> aArgSeq;
785 if ( aValue >>= aArgSeq )
786 {
787 ScDPServiceDesc aServiceDesc("", "", "", "", "");
788
789 const ScDPServiceDesc* pOldDesc = pDPObject->GetDPServiceDesc();
790 if (pOldDesc)
791 aServiceDesc = *pOldDesc;
792
793 OUString aStrVal;
794 for (const beans::PropertyValue& rProp : std::as_const(aArgSeq))
795 {
796 OUString aPropName(rProp.Name);
797
799 {
800 if ( rProp.Value >>= aStrVal )
801 aServiceDesc.aParSource = aStrVal;
802 }
804 {
805 if ( rProp.Value >>= aStrVal )
806 aServiceDesc.aParName = aStrVal;
807 }
808 else if (aPropName == SC_UNO_DP_USERNAME)
809 {
810 if ( rProp.Value >>= aStrVal )
811 aServiceDesc.aParUser = aStrVal;
812 }
813 else if (aPropName == SC_UNO_DP_PASSWORD)
814 {
815 if ( rProp.Value >>= aStrVal )
816 aServiceDesc.aParPass = aStrVal;
817 }
818 }
819
820 pDPObject->SetServiceData( aServiceDesc );
821 }
822 }
823 else
824 throw UnknownPropertyException(aPropertyName);
825
826 pDPObject->SetSaveData( aNewData );
827 }
828
829 SetDPObject(pDPObject);
830}
831
832Any SAL_CALL ScDataPilotDescriptorBase::getPropertyValue( const OUString& aPropertyName )
833{
834 SolarMutexGuard aGuard;
835 Any aRet;
836
837 ScDPObject* pDPObject(GetDPObject());
838 if (pDPObject)
839 {
840 ScDPSaveData* pOldData = pDPObject->GetSaveData();
841 OSL_ENSURE(pOldData, "Here should be a SaveData");
842 if ( pOldData )
843 {
844 ScDPSaveData aNewData( *pOldData );
845
846 if ( aPropertyName == SC_UNO_DP_COLGRAND )
847 {
848 aRet <<= aNewData.GetColumnGrand();
849 }
850 else if ( aPropertyName == SC_UNO_DP_IGNORE_EMPTYROWS )
851 {
852 aRet <<= aNewData.GetIgnoreEmptyRows();
853 }
854 else if ( aPropertyName == SC_UNO_DP_REPEATEMPTY )
855 {
856 aRet <<= aNewData.GetRepeatIfEmpty();
857 }
858 else if ( aPropertyName == SC_UNO_DP_ROWGRAND )
859 {
860 aRet <<= aNewData.GetRowGrand();
861 }
862 else if ( aPropertyName == SC_UNO_DP_SHOWFILTER )
863 {
864 aRet <<= aNewData.GetFilterButton();
865 }
866 else if ( aPropertyName == SC_UNO_DP_DRILLDOWN )
867 {
868 aRet <<= aNewData.GetDrillDown();
869 }
870 else if ( aPropertyName == SC_UNO_DP_GRANDTOTAL_NAME )
871 {
872 const std::optional<OUString> & pGrandTotalName = aNewData.GetGrandTotalName();
873 if (pGrandTotalName)
874 aRet <<= *pGrandTotalName; // same behavior as in ScDPSource
875 }
876 else if ( aPropertyName == SC_UNO_DP_IMPORTDESC )
877 {
878 const ScImportSourceDesc* pImportDesc = pDPObject->GetImportSourceDesc();
879 if ( pImportDesc )
880 {
881 // fill ScImportParam so ScImportDescriptor::FillProperties can be used
882 ScImportParam aParam;
883 aParam.bImport = ( pImportDesc->nType != sheet::DataImportMode_NONE );
884 aParam.aDBName = pImportDesc->aDBName;
885 aParam.aStatement = pImportDesc->aObject;
886 aParam.bNative = pImportDesc->bNative;
887 aParam.bSql = ( pImportDesc->nType == sheet::DataImportMode_SQL );
888 aParam.nType = static_cast<sal_uInt8>(( pImportDesc->nType == sheet::DataImportMode_QUERY ) ? ScDbQuery : ScDbTable);
889
890 uno::Sequence<beans::PropertyValue> aSeq( ScImportDescriptor::GetPropertyCount() );
892 aRet <<= aSeq;
893 }
894 else
895 {
896 // empty sequence
897 uno::Sequence<beans::PropertyValue> aEmpty(0);
898 aRet <<= aEmpty;
899 }
900 }
901 else if ( aPropertyName == SC_UNO_DP_SOURCESERVICE )
902 {
903 OUString aServiceName;
904 const ScDPServiceDesc* pServiceDesc = pDPObject->GetDPServiceDesc();
905 if (pServiceDesc)
906 aServiceName = pServiceDesc->aServiceName;
907 aRet <<= aServiceName; // empty string if no ServiceDesc set
908 }
909 else if ( aPropertyName == SC_UNO_DP_SERVICEARG )
910 {
911 const ScDPServiceDesc* pServiceDesc = pDPObject->GetDPServiceDesc();
912 if (pServiceDesc)
913 {
914 uno::Sequence<beans::PropertyValue> aSeq( comphelper::InitPropertySequence({
915 { SC_UNO_DP_SOURCENAME, Any(pServiceDesc->aParSource) },
916 { SC_UNO_DP_OBJECTNAME, Any(pServiceDesc->aParName) },
917 { SC_UNO_DP_USERNAME, Any(pServiceDesc->aParUser) },
918 { SC_UNO_DP_PASSWORD, Any(pServiceDesc->aParPass) }
919 }));
920 aRet <<= aSeq;
921 }
922 else
923 {
924 // empty sequence
925 uno::Sequence<beans::PropertyValue> aEmpty;
926 aRet <<= aEmpty;
927 }
928 }
929 else
930 throw UnknownPropertyException(aPropertyName);
931 }
932 }
933
934 return aRet;
935}
936
938 const OUString& /* aPropertyName */, const Reference<XPropertyChangeListener >& /* xListener */ )
939{
940}
941
943 const OUString& /* aPropertyName */, const Reference<XPropertyChangeListener >& /* aListener */ )
944{
945}
946
948 const OUString& /* PropertyName */, const Reference<XVetoableChangeListener >& /* aListener */ )
949{
950}
951
953 const OUString& /* PropertyName */, const Reference<XVetoableChangeListener >& /* aListener */ )
954{
955}
956
957// XDataPilotDataLayoutFieldSupplier
958
959Reference< XDataPilotField > SAL_CALL ScDataPilotDescriptorBase::getDataLayoutField()
960{
961 SolarMutexGuard aGuard;
962 if( ScDPObject* pDPObject = GetDPObject() )
963 {
964 if( ScDPSaveData* pSaveData = pDPObject->GetSaveData() )
965 {
966 if( pSaveData->GetDataLayoutDimension() )
967 {
968 ScFieldIdentifier aFieldId( SC_DATALAYOUT_NAME, true );
969 return new ScDataPilotFieldObj( *this, aFieldId );
970 }
971 }
972 }
973 return nullptr;
974}
975
978 nTab( nT ),
979 aName(std::move( aN )),
980 aModifyListeners( 0 )
981{
982}
983
985{
986}
987
989{
990 // since we manually do resolve the query for XDataPilotTable2
991 // we also need to do the same for XDataPilotTable
992 SC_QUERYINTERFACE( XDataPilotTable )
993 SC_QUERYINTERFACE( XDataPilotTable2 )
994 SC_QUERYINTERFACE( XModifyBroadcaster )
995
996 return ScDataPilotDescriptorBase::queryInterface( rType );
997}
998
999void SAL_CALL ScDataPilotTableObj::acquire() noexcept
1000{
1001 ScDataPilotDescriptorBase::acquire();
1002}
1003
1004void SAL_CALL ScDataPilotTableObj::release() noexcept
1005{
1006 ScDataPilotDescriptorBase::release();
1007}
1008
1009Sequence< uno::Type > SAL_CALL ScDataPilotTableObj::getTypes()
1010{
1012 ScDataPilotDescriptorBase::getTypes(),
1013 Sequence< uno::Type >
1014 {
1017 } );
1018}
1019
1020Sequence<sal_Int8> SAL_CALL ScDataPilotTableObj::getImplementationId()
1021{
1022 return css::uno::Sequence<sal_Int8>();
1023}
1024
1026{
1028}
1029
1031{
1032 ScDocShell* pDocSh = GetDocShell();
1033 ScDPObject* pDPObj = lcl_GetDPObject(pDocSh, nTab, aName);
1034 if ( pDPObj && pDocSh )
1035 {
1036 ScDBDocFunc aFunc(*pDocSh);
1037 aFunc.DataPilotUpdate( pDPObj, pDPObject, true, true );
1038 }
1039}
1040
1041// "rest of XDataPilotDescriptor"
1042
1044{
1045 SolarMutexGuard aGuard;
1047 if (pDPObj)
1048 return pDPObj->GetName();
1049 return OUString();
1050}
1051
1052void SAL_CALL ScDataPilotTableObj::setName( const OUString& aNewName )
1053{
1054 SolarMutexGuard aGuard;
1056 if (pDPObj)
1057 {
1059
1060 pDPObj->SetName( aNewName );
1061 aName = aNewName;
1062
1063 // DataPilotUpdate would do too much (output table is not changed)
1065 }
1066}
1067
1069{
1070 SolarMutexGuard aGuard;
1072 if (pDPObj)
1073 return pDPObj->GetTag();
1074 return OUString();
1075}
1076
1077void SAL_CALL ScDataPilotTableObj::setTag( const OUString& aNewTag )
1078{
1079 SolarMutexGuard aGuard;
1081 if (pDPObj)
1082 {
1083 pDPObj->SetTag( aNewTag );
1084
1085 // DataPilotUpdate would do too much (output table is not changed)
1087 }
1088}
1089
1090// XDataPilotTable
1091
1092CellRangeAddress SAL_CALL ScDataPilotTableObj::getOutputRange()
1093{
1094 SolarMutexGuard aGuard;
1095 CellRangeAddress aRet;
1097 if (pDPObj)
1098 {
1099 ScRange aRange(pDPObj->GetOutRange());
1100 aRet.Sheet = aRange.aStart.Tab();
1101 aRet.StartColumn = aRange.aStart.Col();
1102 aRet.StartRow = aRange.aStart.Row();
1103 aRet.EndColumn = aRange.aEnd.Col();
1104 aRet.EndRow = aRange.aEnd.Row();
1105 }
1106 return aRet;
1107}
1108
1110{
1111 SolarMutexGuard aGuard;
1113 if (pDPObj)
1114 {
1115 ScDBDocFunc aFunc(*GetDocShell());
1116 aFunc.RefreshPivotTables(pDPObj, true);
1117 }
1118}
1119
1120Sequence< Sequence<Any> > SAL_CALL ScDataPilotTableObj::getDrillDownData(const CellAddress& aAddr)
1121{
1122 SolarMutexGuard aGuard;
1123 Sequence< Sequence<Any> > aTabData;
1124 ScAddress aAddr2(static_cast<SCCOL>(aAddr.Column), static_cast<SCROW>(aAddr.Row), aAddr.Sheet);
1125 ScDPObject* pObj = GetDPObject();
1126 if (!pObj)
1127 throw RuntimeException("Failed to get DPObject", getXWeak());
1128
1129 pObj->GetDrillDownData(aAddr2, aTabData);
1130 return aTabData;
1131}
1132
1133DataPilotTablePositionData SAL_CALL ScDataPilotTableObj::getPositionData(const CellAddress& aAddr)
1134{
1135 SolarMutexGuard aGuard;
1136 DataPilotTablePositionData aPosData;
1137 ScAddress aAddr2(static_cast<SCCOL>(aAddr.Column), static_cast<SCROW>(aAddr.Row), aAddr.Sheet);
1138 ScDPObject* pObj = GetDPObject();
1139 if (!pObj)
1140 throw RuntimeException("Failed to get DPObject", getXWeak());
1141
1142 pObj->GetPositionData(aAddr2, aPosData);
1143 return aPosData;
1144}
1145
1146void SAL_CALL ScDataPilotTableObj::insertDrillDownSheet(const CellAddress& aAddr)
1147{
1148 SolarMutexGuard aGuard;
1149 ScDPObject* pDPObj = GetDPObject();
1150 if (!pDPObj)
1151 throw RuntimeException("Failed to get DPObject", getXWeak());
1153 if (!pViewSh)
1154 throw RuntimeException("Failed to get ViewShell", getXWeak());
1155
1156 Sequence<DataPilotFieldFilter> aFilters;
1158 ScAddress(static_cast<SCCOL>(aAddr.Column), static_cast<SCROW>(aAddr.Row), aAddr.Sheet), aFilters);
1159 pViewSh->ShowDataPilotSourceData(*pDPObj, aFilters);
1160}
1161
1162CellRangeAddress SAL_CALL ScDataPilotTableObj::getOutputRangeByType( sal_Int32 nType )
1163{
1164 SolarMutexGuard aGuard;
1165 if (nType < 0 || nType > DataPilotOutputRangeType::RESULT)
1166 throw IllegalArgumentException("nType must be between 0 and " +
1167 OUString::number(DataPilotOutputRangeType::RESULT) + ", got " + OUString::number(nType),
1168 getXWeak(), 0);
1169
1170 CellRangeAddress aRet;
1171 if (ScDPObject* pDPObj = lcl_GetDPObject(GetDocShell(), nTab, aName))
1172 ScUnoConversion::FillApiRange( aRet, pDPObj->GetOutputRangeByType( nType ) );
1173 return aRet;
1174}
1175
1176void SAL_CALL ScDataPilotTableObj::addModifyListener( const uno::Reference<util::XModifyListener>& aListener )
1177{
1178 SolarMutexGuard aGuard;
1179
1180 aModifyListeners.emplace_back( aListener );
1181
1182 if ( aModifyListeners.size() == 1 )
1183 {
1184 acquire(); // don't lose this object (one ref for all listeners)
1185 }
1186}
1187
1188void SAL_CALL ScDataPilotTableObj::removeModifyListener( const uno::Reference<util::XModifyListener>& aListener )
1189{
1190 SolarMutexGuard aGuard;
1191
1192 rtl::Reference<ScDataPilotTableObj> xSelfHold(this); // in case the listeners have the last ref
1193
1194 sal_uInt16 nCount = aModifyListeners.size();
1195 for ( sal_uInt16 n=nCount; n--; )
1196 {
1197 uno::Reference<util::XModifyListener>& rObj = aModifyListeners[n];
1198 if ( rObj == aListener )
1199 {
1200 aModifyListeners.erase( aModifyListeners.begin() + n );
1201
1202 if ( aModifyListeners.empty() )
1203 {
1204 release(); // release the ref for the listeners
1205 }
1206
1207 break;
1208 }
1209 }
1210}
1211
1213{
1214 if ( auto pDataPilotHint = dynamic_cast<const ScDataPilotModifiedHint*>(&rHint) )
1215 {
1216 if (pDataPilotHint->GetName() == aName)
1218 }
1219 else if ( auto pRefHint = dynamic_cast<const ScUpdateRefHint*>(&rHint) )
1220 {
1221 ScRange aRange( 0, 0, nTab );
1222 ScRangeList aRanges( aRange );
1223 if ( aRanges.UpdateReference( pRefHint->GetMode(), &GetDocShell()->GetDocument(), pRefHint->GetRange(),
1224 pRefHint->GetDx(), pRefHint->GetDy(), pRefHint->GetDz() ) &&
1225 aRanges.size() == 1 )
1226 {
1227 nTab = aRanges.front().aStart.Tab();
1228 }
1229 }
1230
1232}
1233
1235{
1236 lang::EventObject aEvent;
1237 aEvent.Source = getXWeak();
1238
1239 // the EventObject holds a Ref to this object until after the listener calls
1240
1241 ScDocument& rDoc = GetDocShell()->GetDocument();
1242 for (const uno::Reference<util::XModifyListener> & xModifyListener : aModifyListeners)
1243 rDoc.AddUnoListenerCall( xModifyListener, aEvent );
1244}
1245
1247 ScDataPilotDescriptorBase( rDocSh ),
1248 mpDPObject(new ScDPObject(&rDocSh.GetDocument()))
1249{
1250 ScDPSaveData aSaveData;
1251 // set defaults like in ScPivotParam constructor
1252 aSaveData.SetColumnGrand( true );
1253 aSaveData.SetRowGrand( true );
1254 aSaveData.SetIgnoreEmptyRows( false );
1255 aSaveData.SetRepeatIfEmpty( false );
1256 mpDPObject->SetSaveData(aSaveData);
1257 ScSheetSourceDesc aSheetDesc(&rDocSh.GetDocument());
1258 mpDPObject->SetSheetDesc(aSheetDesc);
1259}
1260
1262{
1263}
1264
1266{
1267 return mpDPObject.get();
1268}
1269
1271{
1272 if (mpDPObject.get() != pDPObject)
1273 {
1274 mpDPObject.reset( pDPObject );
1275 OSL_FAIL("replace DPObject should not happen");
1276 }
1277}
1278
1279// "rest of XDataPilotDescriptor"
1280
1282{
1283 SolarMutexGuard aGuard;
1284 return mpDPObject->GetName();
1285}
1286
1287void SAL_CALL ScDataPilotDescriptor::setName( const OUString& aNewName )
1288{
1289 SolarMutexGuard aGuard;
1290 mpDPObject->SetName( aNewName );
1291}
1292
1294{
1295 SolarMutexGuard aGuard;
1296 return mpDPObject->GetTag();
1297}
1298
1299void SAL_CALL ScDataPilotDescriptor::setTag( const OUString& aNewTag )
1300{
1301 SolarMutexGuard aGuard;
1302 mpDPObject->SetTag( aNewTag );
1303}
1304
1306 mxParent( &rParent )
1307{
1308}
1309
1311 mxParent( &rParent ),
1312 maFieldId(std::move( aFieldId ))
1313{
1314}
1315
1317{
1318}
1319
1321{
1322 return mxParent->GetDPObject();
1323}
1324
1326{
1327 mxParent->SetDPObject( pDPObject );
1328}
1329
1331{
1332 if( ScDPObject* pDPObj = GetDPObject() )
1333 {
1334 if( ppDPObject ) *ppDPObject = pDPObj;
1335 if( ScDPSaveData* pSaveData = pDPObj->GetSaveData() )
1336 {
1338 return pSaveData->GetDataLayoutDimension();
1339
1340 if( maFieldId.mnFieldIdx == 0 )
1341 return pSaveData->GetDimensionByName( maFieldId.maFieldName );
1342
1343 // find dimension with specified index (search in duplicated dimensions)
1344 const ScDPSaveData::DimsType& rDims = pSaveData->GetDimensions();
1345
1346 sal_Int32 nFoundIdx = 0;
1347 for (auto const& it : rDims)
1348 {
1349 if (it->IsDataLayout())
1350 continue;
1351
1352 OUString aSrcName = ScDPUtil::getSourceDimensionName(it->GetName());
1353 if (aSrcName == maFieldId.maFieldName)
1354 {
1355 if( nFoundIdx == maFieldId.mnFieldIdx )
1356 return it.get();
1357 ++nFoundIdx;
1358 }
1359 }
1360 }
1361 }
1362 return nullptr;
1363}
1364
1366{
1367 sal_Int32 nRet = 0;
1368 Reference<XNameAccess> xMembersNA = GetMembers();
1369 if (xMembersNA.is())
1370 {
1371 Reference< XIndexAccess > xMembersIA( new ScNameToIndexAccess( xMembersNA ) );
1372 nRet = xMembersIA->getCount();
1373 }
1374 return nRet;
1375}
1376
1377Reference< XMembersAccess > ScDataPilotChildObjBase::GetMembers() const
1378{
1379 Reference< XMembersAccess > xMembersNA;
1380 if( ScDPObject* pDPObj = GetDPObject() )
1381 pDPObj->GetMembersNA( lcl_GetObjectIndex( pDPObj, maFieldId ), xMembersNA );
1382 return xMembersNA;
1383}
1384
1386{
1387 return mxParent->GetDocShell();
1388}
1389
1391 ScDataPilotChildObjBase( rParent )
1392{
1393}
1394
1395ScDataPilotFieldsObj::ScDataPilotFieldsObj( ScDataPilotDescriptorBase& rParent, DataPilotFieldOrientation eOrient ) :
1396 ScDataPilotChildObjBase( rParent ),
1397 maOrient( eOrient )
1398{
1399}
1400
1402{
1403}
1404
1405static sal_Int32 lcl_GetFieldCount( const Reference<XDimensionsSupplier>& rSource, const Any& rOrient )
1406{
1407 if (!rSource.is())
1408 throw NullPointerException();
1409
1410 sal_Int32 nRet = 0;
1411
1412 Reference<XNameAccess> xDimsName(rSource->getDimensions());
1413 Reference<XIndexAccess> xIntDims(new ScNameToIndexAccess( xDimsName ));
1414 sal_Int32 nIntCount = xIntDims->getCount();
1415 for (sal_Int32 i = 0; i < nIntCount; ++i)
1416 {
1417 Reference<XPropertySet> xDim(xIntDims->getByIndex(i), UNO_QUERY);
1418 const bool bMatch = xDim
1419 && (rOrient.hasValue()
1420 // all fields of the specified orientation, including duplicated
1421 ? (xDim->getPropertyValue(SC_UNO_DP_ORIENTATION) == rOrient)
1422 // count all non-duplicated fields
1423 : !lcl_IsDuplicated(xDim));
1424 if (bMatch)
1425 ++nRet;
1426 }
1427
1428 return nRet;
1429}
1430
1431static bool lcl_GetFieldDataByIndex( const Reference<XDimensionsSupplier>& rSource,
1432 const Any& rOrient, SCSIZE nIndex, ScFieldIdentifier& rFieldId )
1433{
1434 if (!rSource.is())
1435 throw NullPointerException();
1436
1437 bool bOk = false;
1438 SCSIZE nPos = 0;
1439 sal_Int32 nDimIndex = 0;
1440
1441 Reference<XNameAccess> xDimsName(rSource->getDimensions());
1442 Reference<XIndexAccess> xIntDims(new ScNameToIndexAccess( xDimsName ));
1443 sal_Int32 nIntCount = xIntDims->getCount();
1444 Reference<XPropertySet> xDim;
1445 for (sal_Int32 i = 0; i < nIntCount; ++i)
1446 {
1447 xDim.set(xIntDims->getByIndex(i), UNO_QUERY);
1448 const bool bMatch = xDim
1449 && (rOrient.hasValue()
1450 ? (xDim->getPropertyValue(SC_UNO_DP_ORIENTATION) == rOrient)
1451 : !lcl_IsDuplicated(xDim));
1452 if (bMatch)
1453 {
1454 if (nPos == nIndex)
1455 {
1456 bOk = true;
1457 nDimIndex = i;
1458 break;
1459 }
1460 else
1461 ++nPos;
1462 }
1463 }
1464
1465 if ( bOk )
1466 {
1467 xDim.set( xIntDims->getByIndex(nDimIndex), UNO_QUERY );
1468 Reference<XNamed> xDimName( xDim, UNO_QUERY );
1469 if ( xDimName.is() )
1470 {
1471 OUString sOriginalName( lcl_GetOriginalName( xDimName ) );
1472 rFieldId.maFieldName = sOriginalName;
1475
1476 sal_Int32 nRepeat = 0;
1477 if ( rOrient.hasValue() && lcl_IsDuplicated( xDim ) )
1478 {
1479 // find the repeat count
1480 // (this relies on the original dimension always being before the duplicates)
1481
1482 Reference<XNamed> xPrevName;
1483 for (sal_Int32 i = 0; i < nDimIndex; ++i)
1484 {
1485 xPrevName.set( xIntDims->getByIndex(i), UNO_QUERY );
1486 if ( xPrevName.is() && lcl_GetOriginalName( xPrevName ) == sOriginalName )
1487 ++nRepeat;
1488 }
1489 }
1490 rFieldId.mnFieldIdx = nRepeat;
1491 }
1492 else
1493 bOk = false;
1494 }
1495
1496 return bOk;
1497}
1498
1499static bool lcl_GetFieldDataByName( ScDPObject* pDPObj, const OUString& rFieldName, ScFieldIdentifier& rFieldId )
1500{
1501 // "By name" is always the first match.
1502 // The name "Data" always refers to the data layout field.
1503 rFieldId.maFieldName = rFieldName;
1504 rFieldId.mnFieldIdx = 0;
1505 rFieldId.mbDataLayout = rFieldName == SC_DATALAYOUT_NAME;
1506
1507 pDPObj->GetSource(); // IsDimNameInUse doesn't update source data
1508
1509 // check if the named field exists (not for data layout)
1510 return rFieldId.mbDataLayout || pDPObj->IsDimNameInUse( rFieldName );
1511}
1512
1513// XDataPilotFields
1514
1516{
1517 if (ScDPObject* pObj = GetDPObject())
1518 {
1519 ScFieldIdentifier aFieldId;
1520 if (lcl_GetFieldDataByIndex( pObj->GetSource(), maOrient, nIndex, aFieldId ))
1521 return new ScDataPilotFieldObj( *mxParent, aFieldId, maOrient );
1522 }
1523 return nullptr;
1524}
1525
1527{
1528 if (ScDPObject* pDPObj = GetDPObject())
1529 {
1530 ScFieldIdentifier aFieldId;
1531 if (lcl_GetFieldDataByName( pDPObj, aName, aFieldId ))
1532 return new ScDataPilotFieldObj( *mxParent, aFieldId, maOrient );
1533 }
1534 return nullptr;
1535}
1536
1537// XEnumerationAccess
1538
1539Reference<XEnumeration> SAL_CALL ScDataPilotFieldsObj::createEnumeration()
1540{
1541 SolarMutexGuard aGuard;
1542 return new ScIndexEnumeration(this, "com.sun.star.sheet.DataPilotFieldsEnumeration");
1543}
1544
1545// XIndexAccess
1546
1548{
1549 SolarMutexGuard aGuard;
1550 ScDPObject* pDPObj = GetDPObject();
1551 return pDPObj ? lcl_GetFieldCount( pDPObj->GetSource(), maOrient ) : 0;
1552}
1553
1554Any SAL_CALL ScDataPilotFieldsObj::getByIndex( sal_Int32 nIndex )
1555{
1556 SolarMutexGuard aGuard;
1557 Reference< XPropertySet > xField( GetObjectByIndex_Impl( nIndex ) );
1558 if (!xField.is())
1559 throw IndexOutOfBoundsException();
1560 return Any( xField );
1561}
1562
1563// XElementAccess
1564
1566{
1568}
1569
1571{
1572 SolarMutexGuard aGuard;
1573 return ( getCount() != 0 );
1574}
1575
1576// XNameAccess
1577
1578Any SAL_CALL ScDataPilotFieldsObj::getByName( const OUString& aName )
1579{
1580 SolarMutexGuard aGuard;
1581 Reference<XPropertySet> xField(GetObjectByName_Impl(aName));
1582 if (!xField.is())
1583 throw NoSuchElementException();
1584 return Any( xField );
1585}
1586
1587Sequence<OUString> SAL_CALL ScDataPilotFieldsObj::getElementNames()
1588{
1589 SolarMutexGuard aGuard;
1590 if (ScDPObject* pDPObj = GetDPObject())
1591 {
1592 Sequence< OUString > aSeq( lcl_GetFieldCount( pDPObj->GetSource(), maOrient ) );
1593 OUString* pAry = aSeq.getArray();
1594
1595 const ScDPSaveData::DimsType& rDimensions = pDPObj->GetSaveData()->GetDimensions();
1596 for (auto const& it : rDimensions)
1597 {
1598 if(maOrient.hasValue() && (it->GetOrientation() == maOrient.get< DataPilotFieldOrientation >()))
1599 {
1600 *pAry = it->GetName();
1601 ++pAry;
1602 }
1603 }
1604 return aSeq;
1605 }
1606 return Sequence<OUString>();
1607}
1608
1609sal_Bool SAL_CALL ScDataPilotFieldsObj::hasByName( const OUString& aName )
1610{
1611 SolarMutexGuard aGuard;
1612
1613 return GetObjectByName_Impl(aName) != nullptr;
1614}
1615
1617 ScDataPilotDescriptorBase& rParent, const ScFieldIdentifier& rFieldId ) :
1618 ScDataPilotChildObjBase( rParent, rFieldId ),
1619 maPropSet( lcl_GetDataPilotFieldMap() )
1620{
1621}
1622
1624 const ScFieldIdentifier& rFieldId, Any aOrient ) :
1625 ScDataPilotChildObjBase( rParent, rFieldId ),
1626 maPropSet( lcl_GetDataPilotFieldMap() ),
1627 maOrient(std::move( aOrient ))
1628{
1629}
1630
1632{
1633}
1634
1635// XNamed
1636
1638{
1639 SolarMutexGuard aGuard;
1640 OUString aName;
1641 if( ScDPSaveDimension* pDim = GetDPDimension() )
1642 {
1643 if( pDim->IsDataLayout() )
1645 else
1646 {
1647 const std::optional<OUString> & pLayoutName = pDim->GetLayoutName();
1648 if (pLayoutName)
1649 aName = *pLayoutName;
1650 else
1651 aName = pDim->GetName();
1652 }
1653 }
1654 return aName;
1655}
1656
1657void SAL_CALL ScDataPilotFieldObj::setName(const OUString& rName)
1658{
1659 SolarMutexGuard aGuard;
1660 ScDPObject* pDPObj = nullptr;
1661 ScDPSaveDimension* pDim = GetDPDimension( &pDPObj );
1662 if( pDim && !pDim->IsDataLayout() )
1663 {
1664 pDim->SetLayoutName(rName);
1665 SetDPObject( pDPObj );
1666 }
1667}
1668
1669// XPropertySet
1670
1671Reference<XPropertySetInfo> SAL_CALL ScDataPilotFieldObj::getPropertySetInfo()
1672{
1673 SolarMutexGuard aGuard;
1674 static Reference<XPropertySetInfo> aRef(
1676 return aRef;
1677}
1678
1679void SAL_CALL ScDataPilotFieldObj::setPropertyValue( const OUString& aPropertyName, const Any& aValue )
1680{
1681 SolarMutexGuard aGuard;
1682 if ( aPropertyName == SC_UNONAME_FUNCTION )
1683 {
1684 // #i109350# use GetEnumFromAny because it also allows sal_Int32
1686 setFunction( eFunction );
1687 }
1688 else if ( aPropertyName == SC_UNONAME_FUNCTION2 )
1689 {
1691 setFunction( eFunction );
1692 }
1693 else if ( aPropertyName == SC_UNONAME_SUBTOTALS )
1694 {
1695 uno::Sequence<sheet::GeneralFunction> aSeq;
1696 if( aValue >>= aSeq)
1697 {
1698 std::vector< ScGeneralFunction > aSubTotals(aSeq.getLength());
1699 std::transform(std::cbegin(aSeq), std::cend(aSeq), aSubTotals.begin(),
1700 [](const sheet::GeneralFunction& rValue) -> ScGeneralFunction {
1701 const int nValAsInt = static_cast<int>(rValue);
1702 return static_cast<ScGeneralFunction>(nValAsInt);
1703 });
1704 setSubtotals( aSubTotals );
1705 }
1706 }
1707 else if ( aPropertyName == SC_UNONAME_SUBTOTALS2 )
1708 {
1709 Sequence< sal_Int16 > aSeq;
1710 if( aValue >>= aSeq )
1711 {
1712 std::vector< ScGeneralFunction > aSubTotals(aSeq.getLength());
1713 std::transform(std::cbegin(aSeq), std::cend(aSeq), aSubTotals.begin(),
1714 [](sal_Int16 nValue) -> ScGeneralFunction { return static_cast<ScGeneralFunction>(nValue); });
1715 setSubtotals( aSubTotals );
1716 }
1717 }
1718 else if ( aPropertyName == SC_UNONAME_ORIENT )
1719 {
1721 DataPilotFieldOrientation eOrient = static_cast<DataPilotFieldOrientation>(ScUnoHelpFunctions::GetEnumFromAny( aValue ));
1722 setOrientation( eOrient );
1723 }
1724 else if ( aPropertyName == SC_UNONAME_SELPAGE )
1725 {
1726 OUString sCurrentPage;
1727 if (aValue >>= sCurrentPage)
1728 setCurrentPage(sCurrentPage);
1729 }
1730 else if ( aPropertyName == SC_UNONAME_USESELPAGE )
1731 {
1733 }
1734 else if ( aPropertyName == SC_UNONAME_HASAUTOSHOW )
1735 {
1736 if (!cppu::any2bool(aValue))
1737 setAutoShowInfo(nullptr);
1738 }
1739 else if ( aPropertyName == SC_UNONAME_AUTOSHOW )
1740 {
1741 DataPilotFieldAutoShowInfo aInfo;
1742 if (aValue >>= aInfo)
1743 setAutoShowInfo(&aInfo);
1744 }
1745 else if ( aPropertyName == SC_UNONAME_HASLAYOUTINFO )
1746 {
1747 if (!cppu::any2bool(aValue))
1748 setLayoutInfo(nullptr);
1749 }
1750 else if ( aPropertyName == SC_UNONAME_LAYOUTINFO )
1751 {
1752 DataPilotFieldLayoutInfo aInfo;
1753 if (aValue >>= aInfo)
1754 setLayoutInfo(&aInfo);
1755 }
1756 else if ( aPropertyName == SC_UNONAME_HASREFERENCE )
1757 {
1758 if (!cppu::any2bool(aValue))
1759 setReference(nullptr);
1760 }
1761 else if ( aPropertyName == SC_UNONAME_REFERENCE )
1762 {
1763 DataPilotFieldReference aRef;
1764 if (aValue >>= aRef)
1765 setReference(&aRef);
1766 }
1767 else if ( aPropertyName == SC_UNONAME_HASSORTINFO )
1768 {
1769 if (!cppu::any2bool(aValue))
1770 setSortInfo(nullptr);
1771 }
1772 else if ( aPropertyName == SC_UNONAME_SORTINFO )
1773 {
1774 DataPilotFieldSortInfo aInfo;
1775 if (aValue >>= aInfo)
1776 setSortInfo(&aInfo);
1777 }
1778 else if ( aPropertyName == SC_UNONAME_ISGROUP )
1779 {
1780 if (!cppu::any2bool(aValue))
1781 setGroupInfo(nullptr);
1782 }
1783 else if ( aPropertyName == SC_UNONAME_GROUPINFO )
1784 {
1785 DataPilotFieldGroupInfo aInfo;
1786 if (aValue >>= aInfo)
1787 setGroupInfo(&aInfo);
1788 }
1789 else if ( aPropertyName == SC_UNONAME_SHOWEMPTY )
1790 {
1792 }
1793 else if ( aPropertyName == SC_UNONAME_REPEATITEMLABELS )
1794 {
1796 }
1797 else if (aPropertyName == SC_UNONAME_NAME)
1798 {
1799 OUString sName;
1800 if (aValue >>= sName)
1801 setName(sName);
1802 }
1803}
1804
1805Any SAL_CALL ScDataPilotFieldObj::getPropertyValue( const OUString& aPropertyName )
1806{
1807 SolarMutexGuard aGuard;
1808 Any aRet;
1809
1810 if ( aPropertyName == SC_UNONAME_FUNCTION )
1811 {
1812 sheet::GeneralFunction eVal;
1813 sal_Int16 nFunction = getFunction();
1814 if (nFunction == sheet::GeneralFunction2::MEDIAN)
1815 {
1816 eVal = sheet::GeneralFunction_NONE;
1817 }
1818 else
1819 {
1820 eVal = static_cast<sheet::GeneralFunction>(nFunction);
1821 }
1822 aRet <<= eVal;
1823 }
1824 else if ( aPropertyName == SC_UNONAME_FUNCTION2 )
1825 aRet <<= getFunction();
1826 else if ( aPropertyName == SC_UNONAME_SUBTOTALS )
1827 {
1828 const uno::Sequence<sal_Int16> aSeq = getSubtotals();
1829 uno::Sequence<sheet::GeneralFunction> aNewSeq(aSeq.getLength());
1830 std::transform(aSeq.begin(), aSeq.end(), aNewSeq.getArray(),
1831 [](sal_Int16 nFunc) -> sheet::GeneralFunction {
1832 if (nFunc == sheet::GeneralFunction2::MEDIAN)
1833 return sheet::GeneralFunction_NONE;
1834 return static_cast<sheet::GeneralFunction>(nFunc);
1835 });
1836 aRet <<= aNewSeq;
1837 }
1838 else if ( aPropertyName == SC_UNONAME_SUBTOTALS2 )
1839 {
1840 aRet <<= getSubtotals();
1841 }
1842 else if ( aPropertyName == SC_UNONAME_ORIENT )
1843 aRet <<= getOrientation();
1844 else if ( aPropertyName == SC_UNONAME_SELPAGE )
1845 aRet <<= OUString();
1846 else if ( aPropertyName == SC_UNONAME_USESELPAGE )
1847 aRet <<= false;
1848 else if ( aPropertyName == SC_UNONAME_HASAUTOSHOW )
1849 aRet <<= (getAutoShowInfo() != nullptr);
1850 else if ( aPropertyName == SC_UNONAME_AUTOSHOW )
1851 {
1852 const DataPilotFieldAutoShowInfo* pInfo = getAutoShowInfo();
1853 if (pInfo)
1854 aRet <<= *pInfo;
1855 }
1856 else if ( aPropertyName == SC_UNONAME_HASLAYOUTINFO )
1857 aRet <<= (getLayoutInfo() != nullptr);
1858 else if ( aPropertyName == SC_UNONAME_LAYOUTINFO )
1859 {
1860 const DataPilotFieldLayoutInfo* pInfo = getLayoutInfo();
1861 if (pInfo)
1862 aRet <<= *pInfo;
1863 }
1864 else if ( aPropertyName == SC_UNONAME_HASREFERENCE )
1865 aRet <<= (getReference() != nullptr);
1866 else if ( aPropertyName == SC_UNONAME_REFERENCE )
1867 {
1868 const DataPilotFieldReference* pRef = getReference();
1869 if (pRef)
1870 aRet <<= *pRef;
1871 }
1872 else if ( aPropertyName == SC_UNONAME_HASSORTINFO )
1873 aRet <<= (getSortInfo() != nullptr);
1874 else if ( aPropertyName == SC_UNONAME_SORTINFO )
1875 {
1876 const DataPilotFieldSortInfo* pInfo = getSortInfo();
1877 if (pInfo)
1878 aRet <<= *pInfo;
1879 }
1880 else if ( aPropertyName == SC_UNONAME_ISGROUP )
1881 aRet <<= hasGroupInfo();
1882 else if ( aPropertyName == SC_UNONAME_GROUPINFO )
1883 {
1884 aRet <<= getGroupInfo();
1885 }
1886 else if ( aPropertyName == SC_UNONAME_SHOWEMPTY )
1887 aRet <<= getShowEmpty();
1888 else if ( aPropertyName == SC_UNONAME_REPEATITEMLABELS )
1889 aRet <<= getRepeatItemLabels();
1890 else if (aPropertyName == SC_UNONAME_NAME)
1891 aRet <<= getName();
1892
1893 return aRet;
1894}
1895
1896// XDatePilotField
1897
1898Reference<XIndexAccess> SAL_CALL ScDataPilotFieldObj::getItems()
1899{
1900 SolarMutexGuard aGuard;
1901 if (!mxItems.is())
1903 return mxItems;
1904}
1905
1907
1908DataPilotFieldOrientation ScDataPilotFieldObj::getOrientation() const
1909{
1910 SolarMutexGuard aGuard;
1911 ScDPSaveDimension* pDim = GetDPDimension();
1912 return pDim ? pDim->GetOrientation() : DataPilotFieldOrientation_HIDDEN;
1913}
1914
1915void ScDataPilotFieldObj::setOrientation(DataPilotFieldOrientation eNew)
1916{
1917 SolarMutexGuard aGuard;
1918 if (maOrient.hasValue() && (eNew == maOrient.get< DataPilotFieldOrientation >()))
1919 return;
1920
1921 ScDPObject* pDPObj = nullptr;
1922 ScDPSaveDimension* pDim = GetDPDimension( &pDPObj );
1923 if(!pDim)
1924 return;
1925
1926 ScDPSaveData* pSaveData = pDPObj->GetSaveData();
1927
1928 /* If the field was taken from getDataPilotFields(), don't reset the
1929 orientation for an existing use, but create a duplicated field
1930 instead (for "Data" orientation only). */
1931 if ( !maOrient.hasValue() && !maFieldId.mbDataLayout &&
1932 (pDim->GetOrientation() != DataPilotFieldOrientation_HIDDEN) &&
1933 (eNew == DataPilotFieldOrientation_DATA) )
1934 {
1935
1936 ScDPSaveDimension* pNewDim = nullptr;
1937
1938 // look for existing duplicate with orientation "hidden"
1939
1940 sal_Int32 nFound = 0;
1941 const ScDPSaveData::DimsType& rDimensions = pSaveData->GetDimensions();
1942 for (auto const& it : rDimensions)
1943 {
1944 if ( !it->IsDataLayout() && (it->GetName() == maFieldId.maFieldName) )
1945 {
1946 if ( it->GetOrientation() == DataPilotFieldOrientation_HIDDEN )
1947 {
1948 pNewDim = it.get(); // use this one
1949 break;
1950 }
1951 else
1952 ++nFound; // count existing non-hidden occurrences
1953 }
1954 }
1955
1956 if ( !pNewDim ) // if none found, create a new duplicated dimension
1957 pNewDim = &pSaveData->DuplicateDimension( *pDim );
1958
1959 maFieldId.mnFieldIdx = nFound; // keep accessing the new one
1960 pDim = pNewDim;
1961 }
1962
1963 pDim->SetOrientation(eNew);
1964
1965 // move changed field behind all other fields (make it the last field in dimension)
1966 pSaveData->SetPosition( pDim, pSaveData->GetDimensions().size() );
1967
1968 SetDPObject( pDPObj );
1969
1970 maOrient <<= eNew; // modifying the same object's orientation again doesn't create another duplicate
1971}
1972
1974{
1975 SolarMutexGuard aGuard;
1976 sal_Int16 eRet = GeneralFunction2::NONE;
1977 if( ScDPSaveDimension* pDim = GetDPDimension() )
1978 {
1979 if( pDim->GetOrientation() != DataPilotFieldOrientation_DATA )
1980 {
1981 // for non-data fields, property Function is the subtotals
1982 tools::Long nSubCount = pDim->GetSubTotalsCount();
1983 if ( nSubCount > 0 )
1984 eRet = static_cast<sal_Int16>(pDim->GetSubTotalFunc(0)); // always use the first one
1985 // else keep NONE
1986 }
1987 else
1988 eRet = static_cast<sal_Int16>(pDim->GetFunction());
1989 }
1990 return eRet;
1991}
1992
1994{
1995 SolarMutexGuard aGuard;
1996 ScDPObject* pDPObj = nullptr;
1997 ScDPSaveDimension* pDim = GetDPDimension( &pDPObj );
1998 if(!pDim)
1999 return;
2000
2001 if( pDim->GetOrientation() != DataPilotFieldOrientation_DATA )
2002 {
2003 // for non-data fields, property Function is the subtotals
2004 std::vector<ScGeneralFunction> nSubTotalFuncs;
2005 if ( eNewFunc != ScGeneralFunction::NONE )
2006 {
2007 nSubTotalFuncs.push_back( eNewFunc );
2008 }
2009 pDim->SetSubTotals( std::move(nSubTotalFuncs) );
2010 }
2011 else
2012 pDim->SetFunction( eNewFunc );
2013 SetDPObject( pDPObj );
2014}
2015
2016Sequence< sal_Int16 > ScDataPilotFieldObj::getSubtotals() const
2017{
2018 SolarMutexGuard aGuard;
2019 Sequence< sal_Int16 > aRet;
2020 if( ScDPSaveDimension* pDim = GetDPDimension() )
2021 {
2022 if( pDim->GetOrientation() != DataPilotFieldOrientation_DATA )
2023 {
2024 // for non-data fields, property Functions is the sequence of subtotals
2025 sal_Int32 nCount = static_cast< sal_Int32 >( pDim->GetSubTotalsCount() );
2026 if ( nCount > 0 )
2027 {
2028 aRet.realloc( nCount );
2029 auto pRet = aRet.getArray();
2030 for( sal_Int32 nIdx = 0; nIdx < nCount; ++nIdx )
2031 pRet[ nIdx ] = static_cast<sal_Int16>(pDim->GetSubTotalFunc( nIdx ));
2032 }
2033 }
2034 }
2035 return aRet;
2036}
2037
2038void ScDataPilotFieldObj::setSubtotals( const std::vector< ScGeneralFunction >& rSubtotals )
2039{
2040 SolarMutexGuard aGuard;
2041 ScDPObject* pDPObj = nullptr;
2042 ScDPSaveDimension* pDim = GetDPDimension( &pDPObj );
2043 if(!pDim)
2044 return;
2045
2046 if( pDim->GetOrientation() != DataPilotFieldOrientation_DATA )
2047 {
2048 sal_Int32 nCount = rSubtotals.size();
2049 if( nCount == 1 )
2050 {
2051 // count 1: all values are allowed (including NONE and AUTO)
2052 std::vector<ScGeneralFunction> nTmpFuncs;
2053 if( rSubtotals[ 0 ] != ScGeneralFunction::NONE )
2054 {
2055 nTmpFuncs.push_back( rSubtotals[ 0 ] );
2056 }
2057 pDim->SetSubTotals( std::move(nTmpFuncs) );
2058 }
2059 else if( nCount > 1 )
2060 {
2061 // set multiple functions, ignore NONE and AUTO in this case
2062 ::std::vector< ScGeneralFunction > aSubt;
2063 for( sal_Int32 nIdx = 0; nIdx < nCount; ++nIdx )
2064 {
2065 ScGeneralFunction eFunc = rSubtotals[ nIdx ];
2066 if( (eFunc != ScGeneralFunction::NONE) && (eFunc != ScGeneralFunction::AUTO) )
2067 {
2068 // do not insert functions twice
2069 if( ::std::find( aSubt.begin(), aSubt.end(), eFunc ) == aSubt.end() )
2070 aSubt.push_back( eFunc );
2071 }
2072 }
2073 // set values from vector to ScDPSaveDimension
2074 pDim->SetSubTotals( std::move(aSubt) );
2075 }
2076 }
2077 SetDPObject( pDPObj );
2078}
2079
2080void ScDataPilotFieldObj::setCurrentPage( const OUString& rPage )
2081{
2082 SolarMutexGuard aGuard;
2083 ScDPObject* pDPObj = nullptr;
2084 if( ScDPSaveDimension* pDim = GetDPDimension( &pDPObj ) )
2085 {
2086 pDim->SetCurrentPage( &rPage );
2087 SetDPObject( pDPObj );
2088 }
2089}
2090
2092{
2093 SolarMutexGuard aGuard;
2094 ScDPObject* pDPObj = nullptr;
2095 ScDPSaveDimension* pDim = GetDPDimension( &pDPObj );
2096 if(!pDim)
2097 return;
2098
2099 if( bUse )
2100 {
2101 /* It is somehow useless to set the property "HasSelectedPage" to
2102 true, because it is still needed to set an explicit page name. */
2103 const OUString aPage;
2104 pDim->SetCurrentPage( &aPage );
2105 }
2106 else
2107 pDim->SetCurrentPage( nullptr );
2108 SetDPObject( pDPObj );
2109}
2110
2111const DataPilotFieldAutoShowInfo* ScDataPilotFieldObj::getAutoShowInfo() const
2112{
2113 SolarMutexGuard aGuard;
2115 return pDim ? pDim->GetAutoShowInfo() : nullptr;
2116}
2117
2118void ScDataPilotFieldObj::setAutoShowInfo( const DataPilotFieldAutoShowInfo* pInfo )
2119{
2120 SolarMutexGuard aGuard;
2121 ScDPObject* pDPObj = nullptr;
2122 if( ScDPSaveDimension* pDim = GetDPDimension( &pDPObj ) )
2123 {
2124 pDim->SetAutoShowInfo( pInfo );
2125 SetDPObject( pDPObj );
2126 }
2127}
2128
2129const DataPilotFieldLayoutInfo* ScDataPilotFieldObj::getLayoutInfo() const
2130{
2131 SolarMutexGuard aGuard;
2133 return pDim ? pDim->GetLayoutInfo() : nullptr;
2134}
2135
2136void ScDataPilotFieldObj::setLayoutInfo( const DataPilotFieldLayoutInfo* pInfo )
2137{
2138 SolarMutexGuard aGuard;
2139 ScDPObject* pDPObj = nullptr;
2140 if( ScDPSaveDimension* pDim = GetDPDimension( &pDPObj ) )
2141 {
2142 pDim->SetLayoutInfo( pInfo );
2143 SetDPObject( pDPObj );
2144 }
2145}
2146
2147const DataPilotFieldReference* ScDataPilotFieldObj::getReference() const
2148{
2149 SolarMutexGuard aGuard;
2151 return pDim ? pDim->GetReferenceValue() : nullptr;
2152}
2153
2154void ScDataPilotFieldObj::setReference( const DataPilotFieldReference* pInfo )
2155{
2156 SolarMutexGuard aGuard;
2157 ScDPObject* pDPObj = nullptr;
2158 if( ScDPSaveDimension* pDim = GetDPDimension( &pDPObj ) )
2159 {
2160 pDim->SetReferenceValue( pInfo );
2161 SetDPObject( pDPObj );
2162 }
2163}
2164
2165const DataPilotFieldSortInfo* ScDataPilotFieldObj::getSortInfo() const
2166{
2167 SolarMutexGuard aGuard;
2169 return pDim ? pDim->GetSortInfo() : nullptr;
2170}
2171
2172void ScDataPilotFieldObj::setSortInfo( const DataPilotFieldSortInfo* pInfo )
2173{
2174 SolarMutexGuard aGuard;
2175 ScDPObject* pDPObj = nullptr;
2176 if( ScDPSaveDimension* pDim = GetDPDimension( &pDPObj ) )
2177 {
2178 pDim->SetSortInfo( pInfo );
2179 SetDPObject( pDPObj );
2180 }
2181}
2182
2184{
2185 SolarMutexGuard aGuard;
2187 return pDim && pDim->GetShowEmpty();
2188}
2189
2191{
2192 SolarMutexGuard aGuard;
2193 ScDPObject* pDPObj = nullptr;
2194 if( ScDPSaveDimension* pDim = GetDPDimension( &pDPObj ) )
2195 {
2196 pDim->SetShowEmpty( bShow );
2197 SetDPObject( pDPObj );
2198 }
2199}
2200
2202{
2203 SolarMutexGuard aGuard;
2205 return pDim && pDim->GetRepeatItemLabels();
2206}
2207
2209{
2210 SolarMutexGuard aGuard;
2211 ScDPObject* pDPObj = nullptr;
2212 if( ScDPSaveDimension* pDim = GetDPDimension( &pDPObj ) )
2213 {
2214 pDim->SetRepeatItemLabels( bShow );
2215 SetDPObject( pDPObj );
2216 }
2217}
2218
2220{
2221 SolarMutexGuard aGuard;
2222 ScDPObject* pDPObj = nullptr;
2223 if( ScDPSaveDimension* pDim = GetDPDimension( &pDPObj ) )
2224 if( const ScDPDimensionSaveData* pDimData = pDPObj->GetSaveData()->GetExistingDimensionData() )
2225 return pDimData->GetNamedGroupDim( pDim->GetName() ) || pDimData->GetNumGroupDim( pDim->GetName() );
2226 return false;
2227}
2228
2229DataPilotFieldGroupInfo ScDataPilotFieldObj::getGroupInfo()
2230{
2231 SolarMutexGuard aGuard;
2232 DataPilotFieldGroupInfo aInfo;
2233 ScDPObject* pDPObj = nullptr;
2234 if( ScDPSaveDimension* pDim = GetDPDimension( &pDPObj ) )
2235 {
2236 if( const ScDPDimensionSaveData* pDimData = pDPObj->GetSaveData()->GetExistingDimensionData() )
2237 {
2238 if( const ScDPSaveGroupDimension* pGroupDim = pDimData->GetNamedGroupDim( pDim->GetName() ) )
2239 {
2240 // grouped by ...
2241 aInfo.GroupBy = pGroupDim->GetDatePart();
2242
2243 // find source field
2244 try
2245 {
2246 Reference< XNameAccess > xFields( mxParent->getDataPilotFields(), UNO_QUERY_THROW );
2247 aInfo.SourceField.set( xFields->getByName( pGroupDim->GetSourceDimName() ), UNO_QUERY );
2248 }
2249 catch( Exception& )
2250 {
2251 }
2252
2253 ScDataPilotConversion::FillGroupInfo( aInfo, pGroupDim->GetDateInfo() );
2254 if( pGroupDim->GetDatePart() == 0 )
2255 {
2256 // fill vector of group and group member information
2257 ScFieldGroups aGroups;
2258 for( sal_Int32 nIdx = 0, nCount = pGroupDim->GetGroupCount(); nIdx < nCount; ++nIdx )
2259 {
2260 const ScDPSaveGroupItem& rGroup = pGroupDim->GetGroupByIndex( nIdx );
2261 ScFieldGroup aGroup;
2262 aGroup.maName = rGroup.GetGroupName();
2263 for( sal_Int32 nMemIdx = 0, nMemCount = rGroup.GetElementCount(); nMemIdx < nMemCount; ++nMemIdx )
2264 if (const OUString* pMem = rGroup.GetElementByIndex(nMemIdx))
2265 aGroup.maMembers.push_back( *pMem );
2266 aGroups.push_back( aGroup );
2267 }
2268 aInfo.Groups = new ScDataPilotFieldGroupsObj( std::move(aGroups) );
2269 }
2270 }
2271 else if( const ScDPSaveNumGroupDimension* pNumGroupDim = pDimData->GetNumGroupDim( pDim->GetName() ) )
2272 {
2273 if (pNumGroupDim->GetDatePart())
2274 {
2275 ScDataPilotConversion::FillGroupInfo( aInfo, pNumGroupDim->GetDateInfo() );
2276 aInfo.GroupBy = pNumGroupDim->GetDatePart();
2277 }
2278 else
2279 {
2280 ScDataPilotConversion::FillGroupInfo( aInfo, pNumGroupDim->GetInfo() );
2281 }
2282 }
2283 }
2284 }
2285 return aInfo;
2286}
2287
2288void ScDataPilotFieldObj::setGroupInfo( const DataPilotFieldGroupInfo* pInfo )
2289{
2290 SolarMutexGuard aGuard;
2291 ScDPObject* pDPObj = nullptr;
2292 if( /*ScDPSaveDimension* pDim =*/ !GetDPDimension( &pDPObj ) )
2293 return;
2294
2295 ScDPSaveData* pSaveData = pDPObj->GetSaveData();
2296 if( pInfo && lclCheckMinMaxStep( *pInfo ) )
2297 {
2298 ScDPNumGroupInfo aInfo;
2299 aInfo.mbEnable = true;
2300 aInfo.mbDateValues = pInfo->HasDateValues;
2301 aInfo.mbAutoStart = pInfo->HasAutoStart;
2302 aInfo.mbAutoEnd = pInfo->HasAutoEnd;
2303 aInfo.mfStart = pInfo->Start;
2304 aInfo.mfEnd = pInfo->End;
2305 aInfo.mfStep = pInfo->Step;
2306 Reference< XNamed > xNamed( pInfo->SourceField, UNO_QUERY );
2307 if( xNamed.is() )
2308 {
2309 ScDPSaveGroupDimension aGroupDim( xNamed->getName(), getName() );
2310 if( pInfo->GroupBy )
2311 aGroupDim.SetDateInfo(aInfo, pInfo->GroupBy);
2312 else
2313 {
2314 Reference<XIndexAccess> xIndex(pInfo->Groups, UNO_QUERY);
2315 if (xIndex.is())
2316 {
2317 sal_Int32 nCount(xIndex->getCount());
2318 for(sal_Int32 i = 0; i < nCount; i++)
2319 {
2320 Reference<XNamed> xGroupNamed(xIndex->getByIndex(i), UNO_QUERY);
2321 if (xGroupNamed.is())
2322 {
2323 ScDPSaveGroupItem aItem(xGroupNamed->getName());
2324 Reference<XIndexAccess> xGroupIndex(xGroupNamed, UNO_QUERY);
2325 if (xGroupIndex.is())
2326 {
2327 sal_Int32 nItemCount(xGroupIndex->getCount());
2328 for (sal_Int32 j = 0; j < nItemCount; ++j)
2329 {
2330 Reference<XNamed> xItemNamed(xGroupIndex->getByIndex(j), UNO_QUERY);
2331 if (xItemNamed.is())
2332 aItem.AddElement(xItemNamed->getName());
2333 }
2334 }
2335 aGroupDim.AddGroupItem(aItem);
2336 }
2337 }
2338 }
2339 }
2340
2341 // get dimension savedata or create new if none
2342 ScDPDimensionSaveData& rDimSaveData = *pSaveData->GetDimensionData();
2343 rDimSaveData.ReplaceGroupDimension( aGroupDim );
2344 }
2345 else // no source field in group info -> numeric group
2346 {
2347 ScDPDimensionSaveData* pDimData = pSaveData->GetDimensionData(); // created if not there
2348
2349 ScDPSaveNumGroupDimension* pExisting = pDimData->GetNumGroupDimAcc( getName() );
2350 if ( pExisting )
2351 {
2352 if (pInfo->GroupBy)
2353 pExisting->SetDateInfo(aInfo, pInfo->GroupBy);
2354 // modify existing group dimension
2355 pExisting->SetGroupInfo( aInfo );
2356 }
2357 else if (pInfo->GroupBy)
2358 {
2359 // create new group dimension
2360 ScDPSaveNumGroupDimension aNumGroupDim( getName(), aInfo, pInfo->GroupBy );
2361 pDimData->AddNumGroupDimension( aNumGroupDim );
2362 }
2363 else
2364 {
2365 // create new group dimension
2366 ScDPSaveNumGroupDimension aNumGroupDim( getName(), aInfo );
2367 pDimData->AddNumGroupDimension( aNumGroupDim );
2368 }
2369 }
2370 }
2371 else // null passed as argument
2372 {
2373 pSaveData->SetDimensionData( nullptr );
2374 }
2375
2376 pDPObj->SetSaveData( *pSaveData );
2377 SetDPObject( pDPObj );
2378}
2379
2380// XDataPilotFieldGrouping
2381Reference< XDataPilotField > SAL_CALL ScDataPilotFieldObj::createNameGroup( const Sequence< OUString >& rItems )
2382{
2383 SolarMutexGuard aGuard;
2384
2385 if( !rItems.hasElements() )
2386 throw IllegalArgumentException("rItems is empty", getXWeak(), 0);
2387
2388 Reference< XMembersAccess > xMembers = GetMembers();
2389 if (!xMembers.is())
2390 {
2391 SAL_WARN("sc.ui", "Cannot access members of the field object.");
2392 throw RuntimeException("Cannot access members of the field object", getXWeak());
2393 }
2394
2395 for (const OUString& aEntryName : rItems)
2396 {
2397 if (!xMembers->hasByName(aEntryName))
2398 {
2399 SAL_WARN("sc.ui", "There is no member with that name: " + aEntryName + ".");
2400 throw IllegalArgumentException("There is no member with name \"" + aEntryName + "\"", getXWeak(), 0);
2401 }
2402 }
2403
2404 Reference< XDataPilotField > xRet;
2405 OUString sNewDim;
2406 ScDPObject* pDPObj = nullptr;
2407 if( ScDPSaveDimension* pDim = GetDPDimension( &pDPObj ) )
2408 {
2409 const OUString& aDimName = pDim->GetName();
2410
2411 ScDPSaveData aSaveData = *pDPObj->GetSaveData();
2412 ScDPDimensionSaveData* pDimData = aSaveData.GetDimensionData(); // created if not there
2413
2414 // find original base
2415 OUString aBaseDimName( aDimName );
2416 const ScDPSaveGroupDimension* pBaseGroupDim = pDimData->GetNamedGroupDim( aDimName );
2417 if ( pBaseGroupDim )
2418 {
2419 // any entry's SourceDimName is the original base
2420 aBaseDimName = pBaseGroupDim->GetSourceDimName();
2421 }
2422
2423 // find existing group dimension
2424 // (using the selected dim, can be intermediate group dim)
2425 ScDPSaveGroupDimension* pGroupDimension = pDimData->GetGroupDimAccForBase( aDimName );
2426
2427 // remove the selected items from their groups
2428 // (empty groups are removed, too)
2429 if ( pGroupDimension )
2430 {
2431 for (const OUString& aEntryName : rItems)
2432 {
2433 if ( pBaseGroupDim )
2434 {
2435 // for each selected (intermediate) group, remove all its items
2436 // (same logic as for adding, below)
2437 const ScDPSaveGroupItem* pBaseGroup = pBaseGroupDim->GetNamedGroup( aEntryName );
2438 if ( pBaseGroup )
2439 pBaseGroup->RemoveElementsFromGroups( *pGroupDimension ); // remove all elements
2440 else
2441 pGroupDimension->RemoveFromGroups( aEntryName );
2442 }
2443 else
2444 pGroupDimension->RemoveFromGroups( aEntryName );
2445 }
2446 }
2447
2448 std::unique_ptr<ScDPSaveGroupDimension> pNewGroupDim;
2449 if ( !pGroupDimension )
2450 {
2451 // create a new group dimension
2452 sNewDim = pDimData->CreateGroupDimName( aBaseDimName, *pDPObj, false, nullptr );
2453 pNewGroupDim.reset(new ScDPSaveGroupDimension( aBaseDimName, sNewDim ));
2454
2455 pGroupDimension = pNewGroupDim.get(); // make changes to the new dim if none existed
2456
2457 if ( pBaseGroupDim )
2458 {
2459 // If it's a higher-order group dimension, pre-allocate groups for all
2460 // non-selected original groups, so the individual base members aren't
2461 // used for automatic groups (this would make the original groups hard
2462 // to find).
2465
2466 tools::Long nGroupCount = pBaseGroupDim->GetGroupCount();
2467 for ( tools::Long nGroup = 0; nGroup < nGroupCount; nGroup++ )
2468 {
2469 const ScDPSaveGroupItem& rBaseGroup = pBaseGroupDim->GetGroupByIndex( nGroup );
2470
2471 if (comphelper::findValue(rItems, rBaseGroup.GetGroupName()) == -1)
2472 {
2473 // add an additional group for each item that is not in the selection
2474 ScDPSaveGroupItem aGroup( rBaseGroup.GetGroupName() );
2475 aGroup.AddElementsFromGroup( rBaseGroup );
2476 pGroupDimension->AddGroupItem( aGroup );
2477 }
2478 }
2479 }
2480 }
2481 OUString aGroupDimName = pGroupDimension->GetGroupDimName();
2482
2483 OUString aGroupName = pGroupDimension->CreateGroupName( ScResId(STR_PIVOT_GROUP) );
2484 ScDPSaveGroupItem aGroup( aGroupName );
2485 for (const OUString& aEntryName : rItems)
2486 {
2487 if ( pBaseGroupDim )
2488 {
2489 // for each selected (intermediate) group, add all its items
2490 const ScDPSaveGroupItem* pBaseGroup = pBaseGroupDim->GetNamedGroup( aEntryName );
2491 if ( pBaseGroup )
2492 aGroup.AddElementsFromGroup( *pBaseGroup );
2493 else
2494 aGroup.AddElement( aEntryName ); // no group found -> automatic group, add the item itself
2495 }
2496 else
2497 aGroup.AddElement( aEntryName ); // no group dimension, add all items directly
2498 }
2499
2500 pGroupDimension->AddGroupItem( aGroup );
2501
2502 if ( pNewGroupDim )
2503 {
2504 pDimData->AddGroupDimension( *pNewGroupDim );
2505 pNewGroupDim.reset(); // AddGroupDimension copies the object
2506 // don't access pGroupDimension after here
2507 }
2508 pGroupDimension = nullptr;
2509
2510 // set orientation
2511 ScDPSaveDimension* pSaveDimension = aSaveData.GetDimensionByName( aGroupDimName );
2512 if ( pSaveDimension->GetOrientation() == DataPilotFieldOrientation_HIDDEN )
2513 {
2514 ScDPSaveDimension* pOldDimension = aSaveData.GetDimensionByName( aDimName );
2515 pSaveDimension->SetOrientation( pOldDimension->GetOrientation() );
2516 aSaveData.SetPosition( pSaveDimension, 0 );
2517 }
2518
2519 // apply changes
2520 pDPObj->SetSaveData( aSaveData );
2522 }
2523
2524 // if new grouping field has been created (on first group), return it
2525 if( !sNewDim.isEmpty() )
2526 {
2527 Reference< XNameAccess > xFields(mxParent->getDataPilotFields(), UNO_QUERY);
2528 if (xFields.is())
2529 {
2530 try
2531 {
2532 xRet.set(xFields->getByName(sNewDim), UNO_QUERY);
2533 SAL_WARN_IF(!xRet.is(), "sc.ui", "there is a name, so there should be also a field");
2534 }
2535 catch (const container::NoSuchElementException&)
2536 {
2537 css::uno::Any anyEx = cppu::getCaughtException();
2538 SAL_WARN("sc.ui", "Cannot find field with that name: " + sNewDim + ".");
2539 // Avoid throwing exception that's not specified in the method signature.
2540 throw css::lang::WrappedTargetRuntimeException(
2541 "Cannot find field with name \"" + sNewDim + "\"",
2542 getXWeak(), anyEx );
2543 }
2544 }
2545 }
2546 return xRet;
2547}
2548
2549Reference < XDataPilotField > SAL_CALL ScDataPilotFieldObj::createDateGroup( const DataPilotFieldGroupInfo& rInfo )
2550{
2551 SolarMutexGuard aGuard;
2552 using namespace ::com::sun::star::sheet::DataPilotFieldGroupBy;
2553
2554 if( !rInfo.HasDateValues )
2555 throw IllegalArgumentException("HasDateValues is not set", getXWeak(), 0);
2556 if( !lclCheckMinMaxStep( rInfo ) )
2557 throw IllegalArgumentException("min/max/step", getXWeak(), 0);
2558
2559 // only a single date flag is allowed
2560 if( (rInfo.GroupBy == 0) || (rInfo.GroupBy > YEARS) || ((rInfo.GroupBy & (rInfo.GroupBy - 1)) != 0) )
2561 throw IllegalArgumentException("Invalid GroupBy value: " + OUString::number(rInfo.GroupBy), getXWeak(), 0);
2562
2563 // step must be zero, if something else than DAYS is specified
2564 if( rInfo.Step >= ((rInfo.GroupBy == DAYS) ? 32768.0 : 1.0) )
2565 throw IllegalArgumentException("Invalid step value: " + OUString::number(rInfo.Step), getXWeak(), 0);
2566
2567 OUString aGroupDimName;
2568 ScDPObject* pDPObj = nullptr;
2569 if( ScDPSaveDimension* pDim = GetDPDimension( &pDPObj ) )
2570 {
2571 ScDPNumGroupInfo aInfo;
2572 aInfo.mbEnable = true;
2573 aInfo.mbDateValues = (rInfo.GroupBy == DAYS) && (rInfo.Step >= 1.0);
2574 aInfo.mbAutoStart = rInfo.HasAutoStart;
2575 aInfo.mbAutoEnd = rInfo.HasAutoEnd;
2576 aInfo.mfStart = rInfo.Start;
2577 aInfo.mfEnd = rInfo.End;
2578 aInfo.mfStep = std::trunc( rInfo.Step );
2579
2580 // create a local copy of the entire save data (will be written back below)
2581 ScDPSaveData aSaveData = *pDPObj->GetSaveData();
2582 // get or create dimension save data
2583 ScDPDimensionSaveData& rDimData = *aSaveData.GetDimensionData();
2584
2585 // find source dimension name
2586 const OUString& rDimName = pDim->GetName();
2587 const ScDPSaveGroupDimension* pGroupDim = rDimData.GetNamedGroupDim( rDimName );
2588 OUString aSrcDimName = pGroupDim ? pGroupDim->GetSourceDimName() : rDimName;
2589
2590 // find a group dimension for the base field, or get numeric grouping
2591 pGroupDim = rDimData.GetFirstNamedGroupDim( aSrcDimName );
2592 const ScDPSaveNumGroupDimension* pNumGroupDim = rDimData.GetNumGroupDim( aSrcDimName );
2593
2594 // do not group by dates, if named groups or numeric grouping is present
2595 bool bHasNamedGrouping = pGroupDim && !pGroupDim->GetDateInfo().mbEnable;
2596 bool bHasNumGrouping = pNumGroupDim && pNumGroupDim->GetInfo().mbEnable && !pNumGroupDim->GetInfo().mbDateValues && !pNumGroupDim->GetDateInfo().mbEnable;
2597 if( bHasNamedGrouping || bHasNumGrouping )
2598 throw IllegalArgumentException();
2599
2600 if( aInfo.mbDateValues ) // create day ranges grouping
2601 {
2602 // first remove all named group dimensions
2603 while( pGroupDim )
2604 {
2605 OUString aGroupDimName2 = pGroupDim->GetGroupDimName();
2606 // find next group dimension before deleting this group
2607 pGroupDim = rDimData.GetNextNamedGroupDim( aGroupDimName2 );
2608 // remove from dimension save data
2609 rDimData.RemoveGroupDimension( aGroupDimName2 );
2610 // also remove save data settings for the dimension that no longer exists
2611 aSaveData.RemoveDimensionByName( aGroupDimName2 );
2612 }
2613 // create or replace the number grouping dimension
2614 ScDPSaveNumGroupDimension aNumGroupDim( aSrcDimName, aInfo );
2615 rDimData.ReplaceNumGroupDimension( aNumGroupDim );
2616 }
2617 else // create date grouping
2618 {
2619 // collect all existing date flags
2620 sal_Int32 nDateParts = rDimData.CollectDateParts( aSrcDimName );
2621 if( nDateParts == 0 )
2622 {
2623 // insert numeric group dimension, if no date groups exist yet (or replace day range grouping)
2624 ScDPSaveNumGroupDimension aNumGroupDim( aSrcDimName, aInfo, rInfo.GroupBy );
2625 rDimData.ReplaceNumGroupDimension( aNumGroupDim );
2626 }
2627 else if( (nDateParts & rInfo.GroupBy) == 0 ) // do nothing if date field exists already
2628 {
2629 // create new named group dimension for additional date groups
2630 aGroupDimName = rDimData.CreateDateGroupDimName( rInfo.GroupBy, *pDPObj, true, nullptr );
2631 ScDPSaveGroupDimension aGroupDim( aSrcDimName, aGroupDimName, aInfo, rInfo.GroupBy );
2632 rDimData.AddGroupDimension( aGroupDim );
2633
2634 // set orientation of new named group dimension
2635 ScDPSaveDimension& rSaveDim = *aSaveData.GetDimensionByName( aGroupDimName );
2636 if( rSaveDim.GetOrientation() == DataPilotFieldOrientation_HIDDEN )
2637 {
2638 ScDPSaveDimension& rOldDim = *aSaveData.GetDimensionByName( aSrcDimName );
2639 rSaveDim.SetOrientation( rOldDim.GetOrientation() );
2640 aSaveData.SetPosition( &rSaveDim, 0 );
2641 }
2642 }
2643 }
2644
2645 // apply changes
2646 pDPObj->SetSaveData( aSaveData );
2648 }
2649
2650 // return the UNO object of the new dimension, after writing back saved data
2651 Reference< XDataPilotField > xRet;
2652 if( !aGroupDimName.isEmpty() )
2653 try
2654 {
2655 Reference< XNameAccess > xFields( mxParent->getDataPilotFields(), UNO_QUERY_THROW );
2656 xRet.set( xFields->getByName( aGroupDimName ), UNO_QUERY );
2657 }
2658 catch( Exception& )
2659 {
2660 }
2661 return xRet;
2662}
2663
2664namespace {
2665
2666bool lclExtractGroupMembers( ScFieldGroupMembers& rMembers, const Any& rElement )
2667{
2668 // allow empty value to create a new group
2669 if( !rElement.hasValue() )
2670 return true;
2671
2672 // try to extract a simple sequence of strings
2673 Sequence< OUString > aSeq;
2674 if( rElement >>= aSeq )
2675 {
2676 if( aSeq.hasElements() )
2677 rMembers.insert( rMembers.end(), std::cbegin(aSeq), std::cend(aSeq) );
2678 return true;
2679 }
2680
2681 // try to use XIndexAccess providing objects that support XNamed
2682 Reference< XIndexAccess > xItemsIA( rElement, UNO_QUERY );
2683 if( xItemsIA.is() )
2684 {
2685 for( sal_Int32 nIdx = 0, nCount = xItemsIA->getCount(); nIdx < nCount; ++nIdx )
2686 {
2687 try // getByIndex() should not throw, but we cannot be sure
2688 {
2689 Reference< XNamed > xItemName( xItemsIA->getByIndex( nIdx ), UNO_QUERY_THROW );
2690 rMembers.push_back( xItemName->getName() );
2691 }
2692 catch( Exception& )
2693 {
2694 // ignore exceptions, go ahead with next element in the array
2695 }
2696 }
2697 return true;
2698 }
2699
2700 // nothing valid inside the Any -> return false
2701 return false;
2702}
2703
2704} // namespace
2705
2707 maGroups( std::move(rGroups) )
2708{
2709}
2710
2712{
2713}
2714
2715// XNameAccess
2716
2717Any SAL_CALL ScDataPilotFieldGroupsObj::getByName( const OUString& rName )
2718{
2719 SolarMutexGuard aGuard;
2720 if( implFindByName( rName ) == maGroups.end() )
2721 throw NoSuchElementException();
2722 return Any( Reference< XNameAccess >( new ScDataPilotFieldGroupObj( *this, rName ) ) );
2723}
2724
2725Sequence< OUString > SAL_CALL ScDataPilotFieldGroupsObj::getElementNames()
2726{
2727 SolarMutexGuard aGuard;
2728 Sequence< OUString > aSeq;
2729 if( !maGroups.empty() )
2730 {
2731 aSeq.realloc( static_cast< sal_Int32 >( maGroups.size() ) );
2732 OUString* pName = aSeq.getArray();
2733 for( const auto& rGroup : maGroups )
2734 {
2735 *pName = rGroup.maName;
2736 ++pName;
2737 }
2738 }
2739 return aSeq;
2740}
2741
2742sal_Bool SAL_CALL ScDataPilotFieldGroupsObj::hasByName( const OUString& rName )
2743{
2744 SolarMutexGuard aGuard;
2745 return implFindByName( rName ) != maGroups.end();
2746}
2747
2748// XNameReplace
2749
2750void SAL_CALL ScDataPilotFieldGroupsObj::replaceByName( const OUString& rName, const Any& rElement )
2751{
2752 SolarMutexGuard aGuard;
2753
2754 if( rName.isEmpty() )
2755 throw IllegalArgumentException("Name is empty", getXWeak(), 0);
2756
2757 ScFieldGroups::iterator aIt = implFindByName( rName );
2758 if( aIt == maGroups.end() )
2759 throw NoSuchElementException("Name \"" + rName + "\" not found", getXWeak());
2760
2761 // read all item names provided by the passed object
2762 ScFieldGroupMembers aMembers;
2763 if( !lclExtractGroupMembers( aMembers, rElement ) )
2764 throw IllegalArgumentException("Invalid element object", getXWeak(), 0);
2765
2766 // copy and forget, faster than vector assignment
2767 aIt->maMembers.swap( aMembers );
2768}
2769
2770// XNameContainer
2771
2772void SAL_CALL ScDataPilotFieldGroupsObj::insertByName( const OUString& rName, const Any& rElement )
2773{
2774 SolarMutexGuard aGuard;
2775
2776 if( rName.isEmpty() )
2777 throw IllegalArgumentException("Name is empty", getXWeak(), 0);
2778
2779 ScFieldGroups::iterator aIt = implFindByName( rName );
2780 if( aIt != maGroups.end() )
2781 throw ElementExistException("Name \"" + rName + "\" already exists", getXWeak());
2782
2783 // read all item names provided by the passed object
2784 ScFieldGroupMembers aMembers;
2785 if( !lclExtractGroupMembers( aMembers, rElement ) )
2786 throw IllegalArgumentException("Invalid element object", getXWeak(), 0);
2787
2788 // create the new entry if no error has been occurred
2789 maGroups.emplace_back();
2790 ScFieldGroup& rGroup = maGroups.back();
2791 rGroup.maName = rName;
2792 rGroup.maMembers.swap( aMembers );
2793}
2794
2795void SAL_CALL ScDataPilotFieldGroupsObj::removeByName( const OUString& rName )
2796{
2797 SolarMutexGuard aGuard;
2798
2799 if( rName.isEmpty() )
2800 throw IllegalArgumentException("Name is empty", getXWeak(), 0);
2801
2802 ScFieldGroups::iterator aIt = implFindByName( rName );
2803 if( aIt == maGroups.end() )
2804 throw NoSuchElementException("Name \"" + rName + "\" not found", getXWeak());
2805
2806 maGroups.erase( aIt );
2807}
2808
2809// XIndexAccess
2810
2812{
2813 SolarMutexGuard aGuard;
2814 return static_cast< sal_Int32 >( maGroups.size() );
2815}
2816
2817Any SAL_CALL ScDataPilotFieldGroupsObj::getByIndex( sal_Int32 nIndex )
2818{
2819 SolarMutexGuard aGuard;
2820 if ((nIndex < 0) || (o3tl::make_unsigned(nIndex) >= maGroups.size()))
2821 throw IndexOutOfBoundsException();
2822 return Any( Reference< XNameAccess >( new ScDataPilotFieldGroupObj( *this, maGroups[ nIndex ].maName ) ) );
2823}
2824
2825// XEnumerationAccess
2826
2827Reference<XEnumeration> SAL_CALL ScDataPilotFieldGroupsObj::createEnumeration()
2828{
2829 SolarMutexGuard aGuard;
2830 return new ScIndexEnumeration( this, "com.sun.star.sheet.DataPilotFieldGroupsEnumeration" );
2831}
2832
2833// XElementAccess
2834
2836{
2838}
2839
2841{
2842 SolarMutexGuard aGuard;
2843 return !maGroups.empty();
2844}
2845
2846// implementation
2847
2849{
2850 SolarMutexGuard aGuard;
2851 ScFieldGroups::iterator aIt = implFindByName( rName );
2852 if( aIt == maGroups.end() )
2853 throw RuntimeException("Field Group with name \"" + rName + "\" not found", getXWeak());
2854 return *aIt;
2855}
2856
2857void ScDataPilotFieldGroupsObj::renameFieldGroup( const OUString& rOldName, const OUString& rNewName )
2858{
2859 SolarMutexGuard aGuard;
2860 ScFieldGroups::iterator aOldIt = implFindByName( rOldName );
2861 ScFieldGroups::iterator aNewIt = implFindByName( rNewName );
2862 if( aOldIt == maGroups.end() )
2863 throw RuntimeException("Field Group with name \"" + rOldName + "\" not found", getXWeak());
2864 // new name must not exist yet
2865 if( (aNewIt != maGroups.end()) && (aNewIt != aOldIt) )
2866 throw RuntimeException("Field Group with name \"" + rOldName + "\" already exists", getXWeak());
2867 aOldIt->maName = rNewName;
2868}
2869
2870ScFieldGroups::iterator ScDataPilotFieldGroupsObj::implFindByName( const OUString& rName )
2871{
2872 return std::find_if(maGroups.begin(), maGroups.end(),
2873 [&rName](const ScFieldGroup& rGroup) { return rGroup.maName == rName; });
2874}
2875
2876namespace {
2877
2878OUString lclExtractMember( const Any& rElement )
2879{
2880 if( rElement.has< OUString >() )
2881 return rElement.get< OUString >();
2882
2883 Reference< XNamed > xNamed( rElement, UNO_QUERY );
2884 if( xNamed.is() )
2885 return xNamed->getName();
2886
2887 return OUString();
2888}
2889
2890} // namespace
2891
2893 mxParent( &rParent ),
2894 maGroupName(std::move( aGroupName ))
2895{
2896}
2897
2899{
2900}
2901
2902// XNameAccess
2903
2904Any SAL_CALL ScDataPilotFieldGroupObj::getByName( const OUString& rName )
2905{
2906 SolarMutexGuard aGuard;
2907 ScFieldGroupMembers& rMembers = mxParent->getFieldGroup( maGroupName ).maMembers;
2908 ScFieldGroupMembers::iterator aIt = ::std::find( rMembers.begin(), rMembers.end(), rName );
2909 if( aIt == rMembers.end() )
2910 throw NoSuchElementException("Name \"" + rName + "\" not found", getXWeak());
2911 return Any( Reference< XNamed >( new ScDataPilotFieldGroupItemObj( *this, *aIt ) ) );
2912}
2913
2914Sequence< OUString > SAL_CALL ScDataPilotFieldGroupObj::getElementNames()
2915{
2916 SolarMutexGuard aGuard;
2917 return ::comphelper::containerToSequence( mxParent->getFieldGroup( maGroupName ).maMembers );
2918}
2919
2920sal_Bool SAL_CALL ScDataPilotFieldGroupObj::hasByName( const OUString& rName )
2921{
2922 SolarMutexGuard aGuard;
2923 ScFieldGroupMembers& rMembers = mxParent->getFieldGroup( maGroupName ).maMembers;
2924 return ::std::find( rMembers.begin(), rMembers.end(), rName ) != rMembers.end();
2925}
2926
2927// XNameReplace
2928
2929void SAL_CALL ScDataPilotFieldGroupObj::replaceByName( const OUString& rName, const Any& rElement )
2930{
2931 SolarMutexGuard aGuard;
2932
2933 // it should be possible to quickly rename an item -> accept string or XNamed
2934 OUString aNewName = lclExtractMember( rElement );
2935 if( rName.isEmpty() || aNewName.isEmpty() )
2936 throw IllegalArgumentException("Name is empty", getXWeak(), 0);
2937 if( rName == aNewName )
2938 return;
2939
2940 ScFieldGroupMembers& rMembers = mxParent->getFieldGroup( maGroupName ).maMembers;
2941 ScFieldGroupMembers::iterator aOldIt = ::std::find( rMembers.begin(), rMembers.end(), rName );
2942 ScFieldGroupMembers::iterator aNewIt = ::std::find( rMembers.begin(), rMembers.end(), aNewName );
2943 if( aOldIt == rMembers.end() )
2944 throw NoSuchElementException("Name \"" + rName + "\" not found", getXWeak());
2945 if( aNewIt != rMembers.end() )
2946 throw IllegalArgumentException("Name \"" + rName + "\" already exists", getXWeak(), 0);
2947 *aOldIt = aNewName;
2948}
2949
2950// XNameContainer
2951
2952void SAL_CALL ScDataPilotFieldGroupObj::insertByName( const OUString& rName, const Any& /*rElement*/ )
2953{
2954 SolarMutexGuard aGuard;
2955
2956 // we will ignore the passed element and just try to insert the name
2957 if( rName.isEmpty() )
2958 throw IllegalArgumentException("Name is empty", getXWeak(), 0);
2959
2960 ScFieldGroupMembers& rMembers = mxParent->getFieldGroup( maGroupName ).maMembers;
2961 ScFieldGroupMembers::iterator aIt = ::std::find( rMembers.begin(), rMembers.end(), rName );
2962 if( aIt != rMembers.end() )
2963 throw IllegalArgumentException("Name \"" + rName + "\" already exists", getXWeak(), 0);
2964 rMembers.push_back( rName );
2965}
2966
2967void SAL_CALL ScDataPilotFieldGroupObj::removeByName( const OUString& rName )
2968{
2969 SolarMutexGuard aGuard;
2970
2971 if( rName.isEmpty() )
2972 throw IllegalArgumentException("Name is empty", getXWeak(), 0);
2973 ScFieldGroupMembers& rMembers = mxParent->getFieldGroup( maGroupName ).maMembers;
2974 ScFieldGroupMembers::iterator aIt = ::std::find( rMembers.begin(), rMembers.end(), rName );
2975 if( aIt == rMembers.end() )
2976 throw NoSuchElementException("Name \"" + rName + "\" not found", getXWeak());
2977 rMembers.erase( aIt );
2978}
2979
2980// XIndexAccess
2981
2983{
2984 SolarMutexGuard aGuard;
2985 return static_cast< sal_Int32 >( mxParent->getFieldGroup( maGroupName ).maMembers.size() );
2986}
2987
2988Any SAL_CALL ScDataPilotFieldGroupObj::getByIndex( sal_Int32 nIndex )
2989{
2990 SolarMutexGuard aGuard;
2991 ScFieldGroupMembers& rMembers = mxParent->getFieldGroup( maGroupName ).maMembers;
2992 if ((nIndex < 0) || (o3tl::make_unsigned(nIndex) >= rMembers.size()))
2993 throw IndexOutOfBoundsException();
2994 return Any( Reference< XNamed >( new ScDataPilotFieldGroupItemObj( *this, rMembers[ nIndex ] ) ) );
2995}
2996
2997// XEnumerationAccess
2998
2999Reference< XEnumeration > SAL_CALL ScDataPilotFieldGroupObj::createEnumeration()
3000{
3001 SolarMutexGuard aGuard;
3002 return new ScIndexEnumeration( this, "com.sun.star.sheet.DataPilotFieldGroupEnumeration" );
3003}
3004
3005// XElementAccess
3006
3008{
3010}
3011
3013{
3014 SolarMutexGuard aGuard;
3015 return !mxParent->getFieldGroup( maGroupName ).maMembers.empty();
3016}
3017
3018// XNamed
3019
3021{
3022 SolarMutexGuard aGuard;
3023 return maGroupName;
3024}
3025
3026void SAL_CALL ScDataPilotFieldGroupObj::setName( const OUString& rName )
3027{
3028 SolarMutexGuard aGuard;
3029 mxParent->renameFieldGroup( maGroupName, rName );
3030 // if call to renameFieldGroup() did not throw, remember the new name
3031 maGroupName = rName;
3032}
3033
3035 mxParent( &rParent ),
3036 maName(std::move( aName ))
3037{
3038}
3039
3041{
3042}
3043
3044// XNamed
3045
3047{
3048 SolarMutexGuard aGuard;
3049 return maName;
3050}
3051
3052void SAL_CALL ScDataPilotFieldGroupItemObj::setName( const OUString& rName )
3053{
3054 SolarMutexGuard aGuard;
3055 mxParent->replaceByName( maName, Any( rName ) );
3056 // if call to replaceByName() did not throw, remember the new name
3057 maName = rName;
3058}
3059
3061 ScDataPilotChildObjBase( rParent, rFieldId )
3062{
3063}
3064
3066{
3067}
3068
3069// XDataPilotItems
3070
3072{
3073 return ((0 <= nIndex) && (nIndex < GetMemberCount())) ?
3074 new ScDataPilotItemObj( *mxParent, maFieldId, nIndex ) : nullptr;
3075}
3076
3077// XNameAccess
3078
3079Any SAL_CALL ScDataPilotItemsObj::getByName( const OUString& aName )
3080{
3081 SolarMutexGuard aGuard;
3082 Reference<XNameAccess> xMembers = GetMembers();
3083 if (xMembers.is())
3084 {
3085 Reference<XIndexAccess> xMembersIndex(new ScNameToIndexAccess( xMembers ));
3086 sal_Int32 nCount = xMembersIndex->getCount();
3087 sal_Int32 nItem = 0;
3088 while (nItem < nCount)
3089 {
3090 Reference<XNamed> xMember(xMembersIndex->getByIndex(nItem), UNO_QUERY);
3091 if (xMember.is() && (aName == xMember->getName()))
3092 {
3093 return Any( Reference< XPropertySet >( GetObjectByIndex_Impl( nItem ) ) );
3094 }
3095 ++nItem;
3096 }
3097 throw NoSuchElementException("Name \"" + aName + "\" not found", getXWeak());
3098 }
3099 return Any();
3100}
3101
3102Sequence<OUString> SAL_CALL ScDataPilotItemsObj::getElementNames()
3103{
3104 SolarMutexGuard aGuard;
3105 Sequence< OUString > aSeq;
3106 if( ScDPObject* pDPObj = GetDPObject() )
3107 pDPObj->GetMemberNames( lcl_GetObjectIndex( pDPObj, maFieldId ), aSeq );
3108 return aSeq;
3109}
3110
3111sal_Bool SAL_CALL ScDataPilotItemsObj::hasByName( const OUString& aName )
3112{
3113 SolarMutexGuard aGuard;
3114 bool bFound = false;
3115 Reference<XNameAccess> xMembers = GetMembers();
3116 if (xMembers.is())
3117 {
3118 Reference<XIndexAccess> xMembersIndex(new ScNameToIndexAccess( xMembers ));
3119 sal_Int32 nCount = xMembersIndex->getCount();
3120 sal_Int32 nItem = 0;
3121 while (nItem < nCount && !bFound )
3122 {
3123 Reference<XNamed> xMember(xMembersIndex->getByIndex(nItem), UNO_QUERY);
3124 if (xMember.is() && aName == xMember->getName())
3125 bFound = true;
3126 else
3127 nItem++;
3128 }
3129 }
3130 return bFound;
3131}
3132
3133// XEnumerationAccess
3134
3135Reference<XEnumeration> SAL_CALL ScDataPilotItemsObj::createEnumeration()
3136{
3137 SolarMutexGuard aGuard;
3138 return new ScIndexEnumeration(this, "com.sun.star.sheet.DataPilotItemsEnumeration");
3139}
3140
3141// XIndexAccess
3142
3144{
3145 SolarMutexGuard aGuard;
3146 return GetMemberCount();
3147}
3148
3149Any SAL_CALL ScDataPilotItemsObj::getByIndex( sal_Int32 nIndex )
3150{
3151 SolarMutexGuard aGuard;
3152 Reference< XPropertySet > xItem( GetObjectByIndex_Impl( nIndex ) );
3153 if (!xItem.is())
3154 throw IndexOutOfBoundsException();
3155 return Any( xItem );
3156}
3157
3159{
3161}
3162
3164{
3165 SolarMutexGuard aGuard;
3166 return ( getCount() != 0 );
3167}
3168
3170 ScDataPilotChildObjBase( rParent, rFieldId ),
3171 maPropSet( lcl_GetDataPilotItemMap() ),
3172 mnIndex( nIndex )
3173{
3174}
3175
3177{
3178}
3179
3180 // XNamed
3182{
3183 SolarMutexGuard aGuard;
3184 OUString sRet;
3185 Reference<XNameAccess> xMembers = GetMembers();
3186 if (xMembers.is())
3187 {
3188 Reference<XIndexAccess> xMembersIndex(new ScNameToIndexAccess( xMembers ));
3189 sal_Int32 nCount = xMembersIndex->getCount();
3190 if (mnIndex < nCount)
3191 {
3192 Reference<XNamed> xMember(xMembersIndex->getByIndex(mnIndex), UNO_QUERY);
3193 sRet = xMember->getName();
3194 }
3195 }
3196 return sRet;
3197}
3198
3199void SAL_CALL ScDataPilotItemObj::setName( const OUString& /* aName */ )
3200{
3201}
3202
3203 // XPropertySet
3204Reference< XPropertySetInfo >
3206{
3207 SolarMutexGuard aGuard;
3208 static Reference<XPropertySetInfo> aRef =
3210 return aRef;
3211}
3212
3213void SAL_CALL ScDataPilotItemObj::setPropertyValue( const OUString& aPropertyName, const Any& aValue )
3214{
3215 SolarMutexGuard aGuard;
3216 ScDPObject* pDPObj = nullptr;
3217 ScDPSaveDimension* pDim = GetDPDimension( &pDPObj );
3218 if(!pDim)
3219 return;
3220
3221 Reference<XNameAccess> xMembers = GetMembers();
3222 if( !xMembers.is() )
3223 return;
3224
3225 Reference<XIndexAccess> xMembersIndex( new ScNameToIndexAccess( xMembers ) );
3226 sal_Int32 nCount = xMembersIndex->getCount();
3227 if( mnIndex >= nCount )
3228 return;
3229
3230 Reference<XNamed> xMember(xMembersIndex->getByIndex(mnIndex), UNO_QUERY);
3231 OUString sName(xMember->getName());
3232 ScDPSaveMember* pMember = pDim->GetMemberByName(sName);
3233 if (!pMember)
3234 return;
3235
3236 bool bGetNewIndex = false;
3237 if ( aPropertyName == SC_UNONAME_SHOWDETAIL )
3238 pMember->SetShowDetails(cppu::any2bool(aValue));
3239 else if ( aPropertyName == SC_UNONAME_ISHIDDEN )
3240 pMember->SetIsVisible(!cppu::any2bool(aValue));
3241 else if ( aPropertyName == SC_UNONAME_POS )
3242 {
3243 sal_Int32 nNewPos = 0;
3244 if ( !( aValue >>= nNewPos ) || nNewPos < 0 || nNewPos >= nCount )
3245 throw IllegalArgumentException();
3246
3247 pDim->SetMemberPosition( sName, nNewPos );
3248 // get new effective index (depends on sorting mode, which isn't modified)
3249 bGetNewIndex = true;
3250
3251 }
3252 SetDPObject( pDPObj );
3253
3254 if ( bGetNewIndex ) // after SetDPObject, get the new index
3255 {
3256 Sequence< OUString > aItemNames = xMembers->getElementNames();
3257 sal_Int32 nItemCount = aItemNames.getLength();
3258 for (sal_Int32 nItem=0; nItem<nItemCount; ++nItem)
3259 if (aItemNames[nItem] == sName)
3260 mnIndex = nItem;
3261 }
3262}
3263
3264Any SAL_CALL ScDataPilotItemObj::getPropertyValue( const OUString& aPropertyName )
3265{
3266 SolarMutexGuard aGuard;
3267 Any aRet;
3268 if( ScDPSaveDimension* pDim = GetDPDimension() )
3269 {
3270 Reference< XNameAccess > xMembers = GetMembers();
3271 if( xMembers.is() )
3272 {
3273 Reference< XIndexAccess > xMembersIndex( new ScNameToIndexAccess( xMembers ) );
3274 sal_Int32 nCount = xMembersIndex->getCount();
3275 if( mnIndex < nCount )
3276 {
3277 Reference< XNamed > xMember( xMembersIndex->getByIndex( mnIndex ), UNO_QUERY );
3278 OUString sName( xMember->getName() );
3279 ScDPSaveMember* pMember = pDim->GetExistingMemberByName( sName );
3280 if ( aPropertyName == SC_UNONAME_SHOWDETAIL )
3281 {
3282 if (pMember && pMember->HasShowDetails())
3283 {
3284 aRet <<= pMember->GetShowDetails();
3285 }
3286 else
3287 {
3288 Reference< XPropertySet > xMemberProps( xMember, UNO_QUERY );
3289 if( xMemberProps.is() )
3290 aRet = xMemberProps->getPropertyValue( SC_UNO_DP_SHOWDETAILS );
3291 else
3292 aRet <<= true;
3293 }
3294 }
3295 else if ( aPropertyName == SC_UNONAME_ISHIDDEN )
3296 {
3297 if (pMember && pMember->HasIsVisible())
3298 {
3299 aRet <<= !pMember->GetIsVisible();
3300 }
3301 else
3302 {
3303 Reference< XPropertySet > xMemberProps( xMember, UNO_QUERY );
3304 if( xMemberProps.is() )
3305 aRet <<= !cppu::any2bool( xMemberProps->getPropertyValue( SC_UNO_DP_ISVISIBLE ) );
3306 else
3307 aRet <<= false;
3308 }
3309 }
3310 else if ( aPropertyName == SC_UNONAME_POS )
3311 {
3312 aRet <<= mnIndex;
3313 }
3314 }
3315 }
3316 }
3317 return aRet;
3318}
3319
3321 const OUString& /* aPropertyName */, const Reference< XPropertyChangeListener >& /* xListener */ )
3322{
3323}
3324
3326 const OUString& /* aPropertyName */, const Reference< XPropertyChangeListener >& /* aListener */ )
3327{
3328}
3329
3331 const OUString& /* PropertyName */, const Reference< XVetoableChangeListener >& /* aListener */ )
3332{
3333}
3334
3336 const OUString& /* PropertyName */, const Reference< XVetoableChangeListener >& /* aListener */ )
3337{
3338}
3339
3340/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const char * pName
size_t SCSIZE
size_t typedef to be able to find places where code was changed from USHORT to size_t and is used to ...
Definition: address.hxx:44
unotools::WeakReference< AnimationNode > mxParent
AnyEventRef aEvent
OUString maName
SCTAB Tab() const
Definition: address.hxx:283
SCROW Row() const
Definition: address.hxx:274
SCCOL Col() const
Definition: address.hxx:279
bool RemovePivotTable(const ScDPObject &rDPObj, bool bRecord, bool bApi)
Definition: dbdocfun.cxx:1399
void RefreshPivotTables(const ScDPObject *pDPObj, bool bApi)
Reload the referenced pivot cache, and refresh all pivot tables that reference the cache.
Definition: dbdocfun.cxx:1666
bool DataPilotUpdate(ScDPObject *pOldObj, const ScDPObject *pNewObj, bool bRecord, bool bApi, bool bAllowMove=false)
Definition: dbdocfun.cxx:1297
void RefreshPivotTableGroups(ScDPObject *pDPObj)
Refresh the group dimensions of all pivot tables referencing the same cache.
Definition: dbdocfun.cxx:1684
bool CreatePivotTable(const ScDPObject &rDPObj, bool bRecord, bool bApi)
Definition: dbdocfun.cxx:1481
void ShowDataPilotSourceData(ScDPObject &rDPObj, const css::uno::Sequence< css::sheet::DataPilotFieldFilter > &rFilters)
Definition: dbfunc3.cxx:2030
SC_DLLPUBLIC size_t GetCount() const
Definition: dpobject.cxx:3717
OUString CreateNewName() const
Create a new name that's not yet used by any existing data pilot objects.
Definition: dpobject.cxx:3743
This class has to do with handling exclusively grouped dimensions? TODO: Find out what this class doe...
Definition: dpdimsave.hxx:164
const ScDPSaveGroupDimension * GetNamedGroupDim(const OUString &rGroupDimName) const
Definition: dpdimsave.cxx:636
OUString CreateGroupDimName(const OUString &rSourceName, const ScDPObject &rObject, bool bAllowSource, const ::std::vector< OUString > *pDeletedNames)
Definition: dpdimsave.cxx:711
void ReplaceNumGroupDimension(const ScDPSaveNumGroupDimension &rGroupDim)
Definition: dpdimsave.cxx:597
sal_Int32 CollectDateParts(const OUString &rBaseDimName) const
Definition: dpdimsave.cxx:698
void ReplaceGroupDimension(const ScDPSaveGroupDimension &rGroupDim)
Definition: dpdimsave.cxx:571
const ScDPSaveGroupDimension * GetFirstNamedGroupDim(const OUString &rBaseDimName) const
Definition: dpdimsave.cxx:641
void AddNumGroupDimension(const ScDPSaveNumGroupDimension &rGroupDim)
Definition: dpdimsave.cxx:589
const ScDPSaveNumGroupDimension * GetNumGroupDim(const OUString &rGroupDimName) const
Definition: dpdimsave.cxx:651
OUString CreateDateGroupDimName(sal_Int32 nDatePart, const ScDPObject &rObject, bool bAllowSource, const ::std::vector< OUString > *pDeletedNames)
Definition: dpdimsave.cxx:772
void AddGroupDimension(const ScDPSaveGroupDimension &rGroupDim)
Definition: dpdimsave.cxx:563
ScDPSaveNumGroupDimension * GetNumGroupDimAcc(const OUString &rGroupDimName)
Definition: dpdimsave.cxx:687
ScDPSaveGroupDimension * GetGroupDimAccForBase(const OUString &rBaseDimName)
Definition: dpdimsave.cxx:656
const ScDPSaveGroupDimension * GetNextNamedGroupDim(const OUString &rGroupDimName) const
Definition: dpdimsave.cxx:646
void RemoveGroupDimension(const OUString &rGroupDimName)
Definition: dpdimsave.cxx:581
const ScRange & GetOutRange() const
Definition: dpobject.cxx:410
void SetName(const OUString &rNew)
Definition: dpobject.cxx:490
const ScDPServiceDesc * GetDPServiceDesc() const
Definition: dpobject.hxx:158
void SetSaveData(const ScDPSaveData &rData)
Definition: dpobject.cxx:387
void GetDrillDownData(const ScAddress &rPos, css::uno::Sequence< css::uno::Sequence< css::uno::Any > > &rTableData)
Definition: dpobject.cxx:1168
void SetImportDesc(const ScImportSourceDesc &rDesc)
Definition: dpobject.cxx:439
css::uno::Reference< css::sheet::XDimensionsSupplier > const & GetSource()
Definition: dpobject.cxx:516
void SetTag(const OUString &rNew)
Definition: dpobject.cxx:495
void SetSheetDesc(const ScSheetSourceDesc &rDesc)
Definition: dpobject.cxx:415
void SetServiceData(const ScDPServiceDesc &rDesc)
Definition: dpobject.cxx:452
bool IsDimNameInUse(std::u16string_view rName) const
Definition: dpobject.cxx:1183
const ScSheetSourceDesc * GetSheetDesc() const
Definition: dpobject.hxx:156
bool GetDataFieldPositionData(const ScAddress &rPos, css::uno::Sequence< css::sheet::DataPilotFieldFilter > &rFilters)
Definition: dpobject.cxx:1150
ScDPSaveData * GetSaveData() const
Definition: dpobject.hxx:141
void SetOutRange(const ScRange &rRange)
Definition: dpobject.cxx:402
const OUString & GetName() const
Definition: dpobject.hxx:167
void GetPositionData(const ScAddress &rPos, css::sheet::DataPilotTablePositionData &rPosData)
Definition: dpobject.cxx:1144
const OUString & GetTag() const
Definition: dpobject.hxx:169
OUString GetDimName(tools::Long nDim, bool &rIsDataLayout, sal_Int32 *pFlags=nullptr)
Definition: dpobject.cxx:1207
tools::Long GetDimCount()
Definition: dpobject.cxx:1285
bool IsSheetData() const
Definition: dpobject.cxx:485
const ScImportSourceDesc * GetImportSourceDesc() const
Definition: dpobject.hxx:157
SC_DLLPUBLIC void SetIgnoreEmptyRows(bool bSet)
Definition: dpsave.cxx:997
bool GetDrillDown() const
Definition: dpsave.hxx:343
bool GetFilterButton() const
Definition: dpsave.hxx:339
bool GetIgnoreEmptyRows() const
Definition: dpsave.hxx:331
void SetPosition(ScDPSaveDimension *pDim, tools::Long nNew)
Definition: dpsave.cxx:959
ScDPSaveDimension * DuplicateDimension(std::u16string_view rName)
Definition: dpsave.cxx:889
bool GetRepeatIfEmpty() const
Definition: dpsave.hxx:335
SC_DLLPUBLIC const std::optional< OUString > & GetGrandTotalName() const
Definition: dpsave.cxx:774
bool GetRowGrand() const
Definition: dpsave.hxx:327
SC_DLLPUBLIC void SetRepeatIfEmpty(bool bSet)
Definition: dpsave.cxx:1002
SC_DLLPUBLIC void SetFilterButton(bool bSet)
Definition: dpsave.cxx:1007
void RemoveDimensionByName(const OUString &rName)
Definition: dpsave.cxx:902
bool GetColumnGrand() const
Definition: dpsave.hxx:323
SC_DLLPUBLIC void SetGrandTotalName(const OUString &rName)
Definition: dpsave.cxx:769
std::vector< std::unique_ptr< ScDPSaveDimension > > DimsType
Definition: dpsave.hxx:238
SC_DLLPUBLIC void SetRowGrand(bool bSet)
Definition: dpsave.cxx:992
SC_DLLPUBLIC void SetColumnGrand(bool bSet)
Definition: dpsave.cxx:987
const DimsType & GetDimensions() const
Definition: dpsave.hxx:271
const ScDPDimensionSaveData * GetExistingDimensionData() const
Definition: dpsave.hxx:353
SC_DLLPUBLIC ScDPDimensionSaveData * GetDimensionData()
Definition: dpsave.cxx:1204
SC_DLLPUBLIC void SetDimensionData(const ScDPDimensionSaveData *pNew)
Definition: dpsave.cxx:1211
SC_DLLPUBLIC ScDPSaveDimension * GetDimensionByName(const OUString &rName)
Get a dimension object by its name.
Definition: dpsave.cxx:838
SC_DLLPUBLIC void SetDrillDown(bool bSet)
Definition: dpsave.cxx:1012
const css::sheet::DataPilotFieldSortInfo * GetSortInfo() const
Definition: dpsave.hxx:186
void SetLayoutName(const OUString &rName)
Definition: dpsave.cxx:381
void SetOrientation(css::sheet::DataPilotFieldOrientation nNew)
Definition: dpsave.cxx:319
css::sheet::DataPilotFieldOrientation GetOrientation() const
Definition: dpsave.hxx:202
const css::sheet::DataPilotFieldLayoutInfo * GetLayoutInfo() const
Definition: dpsave.hxx:194
const css::sheet::DataPilotFieldAutoShowInfo * GetAutoShowInfo() const
Definition: dpsave.hxx:190
ScDPSaveMember * GetMemberByName(const OUString &rName)
Get a member object by its name.
Definition: dpsave.cxx:458
void SetCurrentPage(const OUString *pPage)
Definition: dpsave.cxx:428
const css::sheet::DataPilotFieldReference * GetReferenceValue() const
Definition: dpsave.hxx:181
bool GetRepeatItemLabels() const
Definition: dpsave.hxx:161
bool IsDataLayout() const
Definition: dpsave.hxx:142
bool GetShowEmpty() const
Definition: dpsave.hxx:157
void SetSubTotals(std::vector< ScGeneralFunction > &&rFuncs)
Definition: dpsave.cxx:324
void SetMemberPosition(const OUString &rName, sal_Int32 nNewPos)
Definition: dpsave.cxx:470
void SetFunction(ScGeneralFunction nNew)
Definition: dpsave.cxx:345
Represents a new group dimension whose dimension ID is higher than the highest source dimension ID.
Definition: dpdimsave.hxx:91
void AddGroupItem(const ScDPSaveGroupItem &rItem)
Definition: dpdimsave.cxx:148
void RemoveFromGroups(const OUString &rItemName)
Definition: dpdimsave.cxx:210
const OUString & GetSourceDimName() const
Definition: dpdimsave.hxx:108
const OUString & GetGroupDimName() const
Definition: dpdimsave.hxx:107
const ScDPNumGroupInfo & GetDateInfo() const
Definition: dpdimsave.hxx:111
void SetDateInfo(const ScDPNumGroupInfo &rInfo, sal_Int32 nPart)
Definition: dpdimsave.cxx:142
const ScDPSaveGroupItem * GetNamedGroup(const OUString &rGroupName) const
Definition: dpdimsave.cxx:182
OUString CreateGroupName(std::u16string_view rPrefix)
Definition: dpdimsave.cxx:153
tools::Long GetGroupCount() const
Definition: dpdimsave.cxx:199
const ScDPSaveGroupItem & GetGroupByIndex(tools::Long nIndex) const
Definition: dpdimsave.cxx:204
Classes to save Data Pilot settings that create new dimensions (fields).
Definition: dpdimsave.hxx:47
void AddElementsFromGroup(const ScDPSaveGroupItem &rGroup)
Definition: dpdimsave.cxx:50
size_t GetElementCount() const
Definition: dpdimsave.cxx:72
void RemoveElementsFromGroups(ScDPSaveGroupDimension &rDimension) const
remove this group's elements from their groups in rDimension (rDimension must be a different dimensio...
Definition: dpdimsave.cxx:87
const OUString & GetGroupName() const
Definition: dpdimsave.hxx:65
void AddElement(const OUString &rName)
Definition: dpdimsave.cxx:45
const OUString * GetElementByIndex(size_t nIndex) const
Definition: dpdimsave.cxx:77
SC_DLLPUBLIC void SetIsVisible(bool bSet)
Definition: dpsave.cxx:97
SC_DLLPUBLIC bool HasShowDetails() const
Definition: dpsave.cxx:102
bool GetShowDetails() const
Definition: dpsave.hxx:76
SC_DLLPUBLIC bool HasIsVisible() const
Definition: dpsave.cxx:92
bool GetIsVisible() const
Definition: dpsave.hxx:71
SC_DLLPUBLIC void SetShowDetails(bool bSet)
Definition: dpsave.cxx:107
Represents a group dimension that introduces a new hierarchy for an existing dimension.
Definition: dpdimsave.hxx:136
void SetDateInfo(const ScDPNumGroupInfo &rInfo, sal_Int32 nPart)
Definition: dpdimsave.cxx:530
const ScDPNumGroupInfo & GetDateInfo() const
Definition: dpdimsave.hxx:153
void SetGroupInfo(const ScDPNumGroupInfo &rNew)
Definition: dpdimsave.cxx:525
const ScDPNumGroupInfo & GetInfo() const
Definition: dpdimsave.hxx:150
static SC_DLLPUBLIC OUString getSourceDimensionName(std::u16string_view rName)
Definition: dputil.cxx:66
Base class of all implementation objects based on a DataPilot descriptor or DataPilot table object.
Definition: dapiuno.hxx:295
ScDPSaveDimension * GetDPDimension(ScDPObject **ppDPObject=nullptr) const
Returns the DataPilot dimension object related to the field described by maFieldId.
Definition: dapiuno.cxx:1330
sal_Int32 GetMemberCount() const
Returns the number of members for the field described by maFieldId.
Definition: dapiuno.cxx:1365
ScDPObject * GetDPObject() const
Returns the wrapped DataPilot object (calls GetDPObject() at parent).
Definition: dapiuno.cxx:1320
css::uno::Reference< css::sheet::XMembersAccess > GetMembers() const
Returns the collection of members for the field described by maFieldId.
Definition: dapiuno.cxx:1377
rtl::Reference< ScDataPilotDescriptorBase > mxParent
Definition: dapiuno.hxx:316
ScDocShell * GetDocShell() const
Definition: dapiuno.cxx:1385
void SetDPObject(ScDPObject *pDPObject)
Sets the passed DataPilot object (calls SetDPObject() at parent).
Definition: dapiuno.cxx:1325
ScFieldIdentifier maFieldId
Definition: dapiuno.hxx:317
ScDataPilotChildObjBase(ScDataPilotDescriptorBase &rParent)
Definition: dapiuno.cxx:1305
virtual ~ScDataPilotChildObjBase()
Definition: dapiuno.cxx:1316
static PivotFunc FunctionBit(sal_Int16 eFunc)
Definition: dapiuno.cxx:211
static void FillGroupInfo(css::sheet::DataPilotFieldGroupInfo &rInfo, const ScDPNumGroupInfo &rGroupInfo)
Definition: dapiuno.cxx:237
virtual void SAL_CALL setSourceRange(const css::table::CellRangeAddress &aSourceRange) override
Definition: dapiuno.cxx:621
virtual css::uno::Reference< css::sheet::XDataPilotField > SAL_CALL getDataLayoutField() override
Definition: dapiuno.cxx:959
virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL getDataFields() override
Definition: dapiuno.cxx:670
virtual void SAL_CALL addVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: dapiuno.cxx:947
virtual void SetDPObject(ScDPObject *pDPObj)=0
virtual ~ScDataPilotDescriptorBase() override
Definition: dapiuno.cxx:587
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: dapiuno.cxx:595
ScDocShell * GetDocShell() const
Definition: dapiuno.hxx:147
virtual void SAL_CALL addPropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
Definition: dapiuno.cxx:937
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: dapiuno.cxx:683
virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL getColumnFields() override
Definition: dapiuno.cxx:652
ScDocShell * pDocShell
Definition: dapiuno.hxx:139
virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL getDataPilotFields() override
Definition: dapiuno.cxx:646
virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL getHiddenFields() override
Definition: dapiuno.cxx:676
virtual css::uno::Reference< css::sheet::XSheetFilterDescriptor > SAL_CALL getFilterDescriptor() override
Definition: dapiuno.cxx:640
virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL getPageFields() override
Definition: dapiuno.cxx:664
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
Definition: dapiuno.cxx:832
virtual void SAL_CALL removePropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &aListener) override
Definition: dapiuno.cxx:942
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
Definition: dapiuno.cxx:691
virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL getRowFields() override
Definition: dapiuno.cxx:658
SfxItemPropertySet maPropSet
Definition: dapiuno.hxx:138
virtual css::table::CellRangeAddress SAL_CALL getSourceRange() override
Definition: dapiuno.cxx:607
virtual ScDPObject * GetDPObject() const =0
virtual void SAL_CALL removeVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: dapiuno.cxx:952
ScDataPilotDescriptorBase(ScDocShell &rDocSh)
Definition: dapiuno.cxx:580
virtual ScDPObject * GetDPObject() const override
Definition: dapiuno.cxx:1265
virtual OUString SAL_CALL getName() override
Definition: dapiuno.cxx:1281
virtual void SAL_CALL setName(const OUString &aName) override
Definition: dapiuno.cxx:1287
virtual OUString SAL_CALL getTag() override
Definition: dapiuno.cxx:1293
virtual void SAL_CALL setTag(const OUString &aTag) override
Definition: dapiuno.cxx:1299
virtual void SetDPObject(ScDPObject *pDPObj) override
Definition: dapiuno.cxx:1270
virtual ~ScDataPilotDescriptor() override
Definition: dapiuno.cxx:1261
ScDataPilotDescriptor(ScDocShell &rDocSh)
Definition: dapiuno.cxx:1246
std::unique_ptr< ScDPObject > mpDPObject
Definition: dapiuno.hxx:199
virtual ~ScDataPilotFieldGroupItemObj() override
Definition: dapiuno.cxx:3040
ScDataPilotFieldGroupItemObj(ScDataPilotFieldGroupObj &rParent, OUString aName)
Definition: dapiuno.cxx:3034
virtual OUString SAL_CALL getName() override
Definition: dapiuno.cxx:3046
virtual void SAL_CALL setName(const OUString &aName) override
Definition: dapiuno.cxx:3052
rtl::Reference< ScDataPilotFieldGroupObj > mxParent
Definition: dapiuno.hxx:621
virtual css::uno::Type SAL_CALL getElementType() override
Definition: dapiuno.cxx:3007
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 Index) override
Definition: dapiuno.cxx:2988
virtual ~ScDataPilotFieldGroupObj() override
Definition: dapiuno.cxx:2898
virtual void SAL_CALL removeByName(const OUString &Name) override
Definition: dapiuno.cxx:2967
rtl::Reference< ScDataPilotFieldGroupsObj > mxParent
Definition: dapiuno.hxx:594
virtual css::uno::Any SAL_CALL getByName(const OUString &aName) override
Definition: dapiuno.cxx:2904
virtual sal_Bool SAL_CALL hasElements() override
Definition: dapiuno.cxx:3012
virtual sal_Int32 SAL_CALL getCount() override
Definition: dapiuno.cxx:2982
virtual void SAL_CALL replaceByName(const OUString &aName, const css::uno::Any &aElement) override
Definition: dapiuno.cxx:2929
virtual sal_Bool SAL_CALL hasByName(const OUString &aName) override
Definition: dapiuno.cxx:2920
virtual void SAL_CALL setName(const OUString &aName) override
Definition: dapiuno.cxx:3026
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
Definition: dapiuno.cxx:2914
ScDataPilotFieldGroupObj(ScDataPilotFieldGroupsObj &rParent, OUString aGroupName)
Definition: dapiuno.cxx:2892
virtual OUString SAL_CALL getName() override
Definition: dapiuno.cxx:3020
virtual void SAL_CALL insertByName(const OUString &aName, const css::uno::Any &aElement) override
Definition: dapiuno.cxx:2952
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override
Definition: dapiuno.cxx:2999
Implementation of all grouped items in a DataPilot field.
Definition: dapiuno.hxx:493
virtual sal_Int32 SAL_CALL getCount() override
Definition: dapiuno.cxx:2811
virtual void SAL_CALL replaceByName(const OUString &aName, const css::uno::Any &aElement) override
Definition: dapiuno.cxx:2750
virtual void SAL_CALL insertByName(const OUString &aName, const css::uno::Any &aElement) override
Definition: dapiuno.cxx:2772
virtual ~ScDataPilotFieldGroupsObj() override
Definition: dapiuno.cxx:2711
void renameFieldGroup(const OUString &rOldName, const OUString &rNewName)
Definition: dapiuno.cxx:2857
ScFieldGroups::iterator implFindByName(const OUString &rName)
Definition: dapiuno.cxx:2870
virtual void SAL_CALL removeByName(const OUString &Name) override
Definition: dapiuno.cxx:2795
ScDataPilotFieldGroupsObj(ScFieldGroups &&rGroups)
Definition: dapiuno.cxx:2706
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 Index) override
Definition: dapiuno.cxx:2817
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override
Definition: dapiuno.cxx:2827
ScFieldGroup & getFieldGroup(const OUString &rName)
Definition: dapiuno.cxx:2848
virtual css::uno::Any SAL_CALL getByName(const OUString &aName) override
Definition: dapiuno.cxx:2717
ScFieldGroups maGroups
Definition: dapiuno.hxx:539
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
Definition: dapiuno.cxx:2725
virtual sal_Bool SAL_CALL hasByName(const OUString &aName) override
Definition: dapiuno.cxx:2742
virtual css::uno::Type SAL_CALL getElementType() override
Definition: dapiuno.cxx:2835
virtual sal_Bool SAL_CALL hasElements() override
Definition: dapiuno.cxx:2840
Implementation of a single DataPilot field.
Definition: dapiuno.hxx:387
void setSortInfo(const css::sheet::DataPilotFieldSortInfo *pInfo)
Definition: dapiuno.cxx:2172
void setLayoutInfo(const css::sheet::DataPilotFieldLayoutInfo *pInfo)
Definition: dapiuno.cxx:2136
css::uno::Any maOrient
Definition: dapiuno.hxx:464
css::sheet::DataPilotFieldGroupInfo getGroupInfo()
Definition: dapiuno.cxx:2229
void setAutoShowInfo(const css::sheet::DataPilotFieldAutoShowInfo *pInfo)
Definition: dapiuno.cxx:2118
virtual css::uno::Reference< css::sheet::XDataPilotField > SAL_CALL createDateGroup(const css::sheet::DataPilotFieldGroupInfo &rInfo) override
Definition: dapiuno.cxx:2549
css::sheet::DataPilotFieldOrientation getOrientation() const
Definition: dapiuno.cxx:1908
virtual void SAL_CALL setName(const OUString &aName) override
Definition: dapiuno.cxx:1657
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
Definition: dapiuno.cxx:1679
bool hasGroupInfo() const
Definition: dapiuno.cxx:2219
void setCurrentPage(const OUString &sPage)
Definition: dapiuno.cxx:2080
void setRepeatItemLabels(bool bShow)
Definition: dapiuno.cxx:2208
void setReference(const css::sheet::DataPilotFieldReference *pInfo)
Definition: dapiuno.cxx:2154
void setSubtotals(const std::vector< ScGeneralFunction > &rFunctions)
Definition: dapiuno.cxx:2038
sal_Int16 getFunction() const
Definition: dapiuno.cxx:1973
virtual css::uno::Reference< css::sheet::XDataPilotField > SAL_CALL createNameGroup(const css::uno::Sequence< OUString > &aItems) override
Definition: dapiuno.cxx:2381
void setOrientation(css::sheet::DataPilotFieldOrientation Orientation)
Definition: dapiuno.cxx:1915
SfxItemPropertySet maPropSet
Definition: dapiuno.hxx:463
const css::sheet::DataPilotFieldLayoutInfo * getLayoutInfo() const
Definition: dapiuno.cxx:2129
css::uno::Reference< css::container::XIndexAccess > mxItems
Definition: dapiuno.hxx:462
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
Definition: dapiuno.cxx:1805
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: dapiuno.cxx:1671
const css::sheet::DataPilotFieldReference * getReference() const
Definition: dapiuno.cxx:2147
void setGroupInfo(const css::sheet::DataPilotFieldGroupInfo *pInfo)
Definition: dapiuno.cxx:2288
bool getRepeatItemLabels() const
Definition: dapiuno.cxx:2201
void setShowEmpty(bool bShow)
Definition: dapiuno.cxx:2190
void setFunction(ScGeneralFunction Function)
Definition: dapiuno.cxx:1993
virtual OUString SAL_CALL getName() override
Definition: dapiuno.cxx:1637
const css::sheet::DataPilotFieldAutoShowInfo * getAutoShowInfo() const
Definition: dapiuno.cxx:2111
bool getShowEmpty() const
Definition: dapiuno.cxx:2183
ScDataPilotFieldObj(ScDataPilotDescriptorBase &rParent, const ScFieldIdentifier &rIdent)
Definition: dapiuno.cxx:1616
const css::sheet::DataPilotFieldSortInfo * getSortInfo() const
Definition: dapiuno.cxx:2165
virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL getItems() override
Definition: dapiuno.cxx:1898
void setUseCurrentPage(bool bUse)
Definition: dapiuno.cxx:2091
virtual ~ScDataPilotFieldObj() override
Definition: dapiuno.cxx:1631
css::uno::Sequence< sal_Int16 > getSubtotals() const
Definition: dapiuno.cxx:2016
Collection of all DataPilot fields, or of all fields from a specific dimension.
Definition: dapiuno.hxx:334
virtual sal_Bool SAL_CALL hasElements() override
Definition: dapiuno.cxx:1570
virtual ~ScDataPilotFieldsObj() override
Definition: dapiuno.cxx:1401
rtl::Reference< ScDataPilotFieldObj > GetObjectByName_Impl(const OUString &rName) const
Definition: dapiuno.cxx:1526
ScDataPilotFieldsObj(ScDataPilotDescriptorBase &rParent)
Definition: dapiuno.cxx:1390
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 Index) override
Definition: dapiuno.cxx:1554
virtual sal_Int32 SAL_CALL getCount() override
Definition: dapiuno.cxx:1547
virtual sal_Bool SAL_CALL hasByName(const OUString &aName) override
Definition: dapiuno.cxx:1609
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override
Definition: dapiuno.cxx:1539
virtual css::uno::Any SAL_CALL getByName(const OUString &aName) override
Definition: dapiuno.cxx:1578
css::uno::Any maOrient
Definition: dapiuno.hxx:372
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
Definition: dapiuno.cxx:1587
rtl::Reference< ScDataPilotFieldObj > GetObjectByIndex_Impl(sal_Int32 nIndex) const
Definition: dapiuno.cxx:1515
virtual css::uno::Type SAL_CALL getElementType() override
Definition: dapiuno.cxx:1565
virtual void SAL_CALL removeVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: dapiuno.cxx:3335
virtual void SAL_CALL removePropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &aListener) override
Definition: dapiuno.cxx:3325
virtual ~ScDataPilotItemObj() override
Definition: dapiuno.cxx:3176
virtual OUString SAL_CALL getName() override
Definition: dapiuno.cxx:3181
SfxItemPropertySet maPropSet
Definition: dapiuno.hxx:710
virtual void SAL_CALL addPropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
Definition: dapiuno.cxx:3320
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: dapiuno.cxx:3205
virtual void SAL_CALL addVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: dapiuno.cxx:3330
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
Definition: dapiuno.cxx:3264
virtual void SAL_CALL setName(const OUString &aName) override
Definition: dapiuno.cxx:3199
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
Definition: dapiuno.cxx:3213
sal_Int32 mnIndex
Definition: dapiuno.hxx:711
ScDataPilotItemObj(ScDataPilotDescriptorBase &rParent, const ScFieldIdentifier &rFieldId, sal_Int32 nIndex)
Definition: dapiuno.cxx:3169
virtual css::uno::Any SAL_CALL getByName(const OUString &aName) override
Definition: dapiuno.cxx:3079
virtual ~ScDataPilotItemsObj() override
Definition: dapiuno.cxx:3065
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override
Definition: dapiuno.cxx:3135
ScDataPilotItemsObj(ScDataPilotDescriptorBase &rParent, const ScFieldIdentifier &rFieldId)
Definition: dapiuno.cxx:3060
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 Index) override
Definition: dapiuno.cxx:3149
virtual sal_Bool SAL_CALL hasByName(const OUString &aName) override
Definition: dapiuno.cxx:3111
ScDataPilotItemObj * GetObjectByIndex_Impl(sal_Int32 nIndex) const
Definition: dapiuno.cxx:3071
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
Definition: dapiuno.cxx:3102
virtual sal_Int32 SAL_CALL getCount() override
Definition: dapiuno.cxx:3143
virtual sal_Bool SAL_CALL hasElements() override
Definition: dapiuno.cxx:3163
virtual css::uno::Type SAL_CALL getElementType() override
Definition: dapiuno.cxx:3158
virtual void SAL_CALL addModifyListener(const css::uno::Reference< css::util::XModifyListener > &aListener) override
Definition: dapiuno.cxx:1176
virtual ScDPObject * GetDPObject() const override
Definition: dapiuno.cxx:1025
XModifyListenerArr_Impl aModifyListeners
Definition: dapiuno.hxx:227
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
Definition: dapiuno.cxx:1009
virtual void SAL_CALL insertDrillDownSheet(const css::table::CellAddress &aAddr) override
Definition: dapiuno.cxx:1146
virtual css::sheet::DataPilotTablePositionData SAL_CALL getPositionData(const css::table::CellAddress &aAddr) override
Definition: dapiuno.cxx:1133
virtual css::table::CellRangeAddress SAL_CALL getOutputRangeByType(sal_Int32 nType) override
Definition: dapiuno.cxx:1162
virtual void SetDPObject(ScDPObject *pDPObj) override
Definition: dapiuno.cxx:1030
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
Definition: dapiuno.cxx:988
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
Definition: dapiuno.cxx:1020
virtual void SAL_CALL release() noexcept override
Definition: dapiuno.cxx:1004
virtual ~ScDataPilotTableObj() override
Definition: dapiuno.cxx:984
virtual void SAL_CALL setTag(const OUString &aTag) override
Definition: dapiuno.cxx:1077
virtual OUString SAL_CALL getTag() override
Definition: dapiuno.cxx:1068
virtual OUString SAL_CALL getName() override
Definition: dapiuno.cxx:1043
virtual void SAL_CALL setName(const OUString &aName) override
Definition: dapiuno.cxx:1052
virtual void SAL_CALL acquire() noexcept override
Definition: dapiuno.cxx:999
virtual void SAL_CALL refresh() override
Definition: dapiuno.cxx:1109
virtual void SAL_CALL removeModifyListener(const css::uno::Reference< css::util::XModifyListener > &aListener) override
Definition: dapiuno.cxx:1188
virtual css::uno::Sequence< css::uno::Sequence< css::uno::Any > > SAL_CALL getDrillDownData(const css::table::CellAddress &aAddr) override
Definition: dapiuno.cxx:1120
virtual css::table::CellRangeAddress SAL_CALL getOutputRange() override
Definition: dapiuno.cxx:1092
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: dapiuno.cxx:1212
ScDataPilotTableObj(ScDocShell &rDocSh, SCTAB nT, OUString aN)
Definition: dapiuno.cxx:976
DataPilotTables collection per sheet.
Definition: dapiuno.hxx:84
virtual void SAL_CALL insertNewByName(const OUString &aName, const css::table::CellAddress &aOutputAddress, const css::uno::Reference< css::sheet::XDataPilotDescriptor > &xDescriptor) override
Definition: dapiuno.cxx:404
virtual css::uno::Any SAL_CALL getByName(const OUString &aName) override
Definition: dapiuno.cxx:512
rtl::Reference< ScDataPilotTableObj > GetObjectByName_Impl(const OUString &aName)
Definition: dapiuno.cxx:352
virtual ~ScDataPilotTablesObj() override
Definition: dapiuno.cxx:304
virtual void SAL_CALL removeByName(const OUString &aName) override
Definition: dapiuno.cxx:442
virtual css::uno::Type SAL_CALL getElementType() override
Definition: dapiuno.cxx:499
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: dapiuno.cxx:312
ScDataPilotTablesObj(ScDocShell &rDocSh, SCTAB nT)
Definition: dapiuno.cxx:297
virtual sal_Bool SAL_CALL hasByName(const OUString &aName) override
Definition: dapiuno.cxx:558
virtual sal_Bool SAL_CALL hasElements() override
Definition: dapiuno.cxx:504
virtual css::uno::Reference< css::sheet::XDataPilotDescriptor > SAL_CALL createDataPilotDescriptor() override
Definition: dapiuno.cxx:359
rtl::Reference< ScDataPilotTableObj > GetObjectByIndex_Impl(sal_Int32 nIndex)
Definition: dapiuno.cxx:324
virtual sal_Int32 SAL_CALL getCount() override
Definition: dapiuno.cxx:464
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
Definition: dapiuno.cxx:521
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override
Definition: dapiuno.cxx:456
ScDocShell * pDocShell
Definition: dapiuno.hxx:86
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 Index) override
Definition: dapiuno.cxx:490
void SetDocumentModified()
Definition: docsh.cxx:2982
const ScDocument & GetDocument() const
Definition: docsh.hxx:219
ScTabViewShell * GetBestViewShell(bool bOnlyVisible=true)
Definition: docsh4.cxx:2623
void AddUnoObject(SfxListener &rObject)
Definition: documen3.cxx:901
void AddUnoListenerCall(const css::uno::Reference< css::util::XModifyListener > &rListener, const css::lang::EventObject &rEvent)
Definition: documen3.cxx:980
void RemoveUnoObject(SfxListener &rObject)
Definition: documen3.cxx:909
SC_DLLPUBLIC ScDPCollection * GetDPCollection()
Definition: documen3.cxx:365
static void FillImportParam(ScImportParam &rParam, const css::uno::Sequence< css::beans::PropertyValue > &rSeq)
Definition: datauno.cxx:205
static void FillProperties(css::uno::Sequence< css::beans::PropertyValue > &rSeq, const ScImportParam &rParam)
Definition: datauno.cxx:165
static tools::Long GetPropertyCount()
Definition: datauno.hxx:81
ScRange & front()
Definition: rangelst.hxx:92
size_t size() const
Definition: rangelst.hxx:89
bool UpdateReference(UpdateRefMode, const ScDocument *, const ScRange &rWhere, SCCOL nDx, SCROW nDy, SCTAB nDz)
Definition: rangelst.cxx:357
ScAddress aEnd
Definition: address.hxx:498
ScAddress aStart
Definition: address.hxx:497
This class contains authoritative information on the internal reference used as the data source for d...
Definition: dpshttab.hxx:40
SC_DLLPUBLIC void SetSourceRange(const ScRange &rRange)
Definition: dpshttab.cxx:224
SC_DLLPUBLIC const ScRange & GetSourceRange() const
Get the range that contains the source data.
Definition: dpshttab.cxx:230
static void FillScRange(ScRange &rScRange, const css::table::CellRangeAddress &rApiRange)
Definition: convuno.hxx:79
static void FillApiRange(css::table::CellRangeAddress &rApiRange, const ScRange &rScRange)
Definition: convuno.hxx:87
static bool GetBoolProperty(const css::uno::Reference< css::beans::XPropertySet > &xProp, const OUString &rName, bool bDefault=false)
Definition: miscuno.cxx:36
static sal_Int16 GetInt16FromAny(const css::uno::Any &aAny)
Definition: miscuno.cxx:145
static sal_Int32 GetEnumFromAny(const css::uno::Any &aAny)
Definition: miscuno.cxx:161
SfxHintId GetId() const
const SfxItemPropertyMap & getPropertyMap() const
css::uno::Type const & get()
int nCount
static sal_Int32 lcl_GetObjectIndex(ScDPObject *pDPObj, const ScFieldIdentifier &rFieldId)
Definition: dapiuno.cxx:280
static bool lcl_GetFieldDataByName(ScDPObject *pDPObj, const OUString &rFieldName, ScFieldIdentifier &rFieldId)
Definition: dapiuno.cxx:1499
static bool lcl_IsDuplicated(const Reference< XPropertySet > &rDimProps)
Definition: dapiuno.cxx:367
constexpr OUStringLiteral SC_DATALAYOUT_NAME
Definition: dapiuno.cxx:191
static OUString lcl_CreatePivotName(ScDocShell *pDocShell)
Definition: dapiuno.cxx:268
static bool lcl_GetFieldDataByIndex(const Reference< XDimensionsSupplier > &rSource, const Any &rOrient, SCSIZE nIndex, ScFieldIdentifier &rFieldId)
Definition: dapiuno.cxx:1431
static OUString lcl_GetOriginalName(const Reference< XNamed > &rDim)
Definition: dapiuno.cxx:381
static ScDPObject * lcl_GetDPObject(ScDocShell *pDocShell, SCTAB nTab, std::u16string_view rName)
Definition: dapiuno.cxx:247
static sal_Int32 lcl_GetFieldCount(const Reference< XDimensionsSupplier > &rSource, const Any &rOrient)
Definition: dapiuno.cxx:1405
::std::vector< ScFieldGroup > ScFieldGroups
Definition: dapiuno.hxx:475
::std::vector< OUString > ScFieldGroupMembers
Definition: dapiuno.hxx:467
PivotFunc
Definition: dpglobal.hxx:24
sal_Int16 nValue
OUString sName
ScGeneralFunction
the css::sheet::GeneralFunction enum is extended by constants in GeneralFunction2,...
@ AVERAGE
average of all numerical values is calculated.
@ PRODUCT
product of all numerical values is calculated.
@ MAX
maximum value of all numerical values is calculated.
@ COUNT
all values, including non-numerical values, are counted.
@ VARP
variance is calculated based on the entire population.
@ SUM
sum of all numerical values is calculated.
@ STDEVP
standard deviation is calculated based on the entire population.
@ MEDIAN
median of all numerical values is calculated.
@ COUNTNUMS
numerical values are counted.
@ NONE
nothing is calculated.
@ MIN
minimum value of all numerical values is calculated.
@ VAR
variance is calculated based on a sample.
@ AUTO
function is determined automatically.
@ STDEV
standard deviation is calculated based on a sample.
@ ScDbQuery
Definition: global.hxx:421
@ ScDbTable
Definition: global.hxx:420
sal_Int32 nIndex
OUString aName
sal_Int64 n
sal_uInt16 nPos
Sequence< sal_Int8 > aSeq
#define SAL_WARN_IF(condition, area, stream)
#define SAL_WARN(area, stream)
#define SC_QUERYINTERFACE(x)
Definition: miscuno.hxx:86
#define SC_SIMPLE_SERVICE_INFO(ClassName, ClassNameAscii, ServiceAscii)
Definition: miscuno.hxx:63
#define SC_IMPL_DUMMY_PROPERTY_LISTENER(ClassName)
Definition: miscuno.hxx:72
@ Exception
sal_Int32 findValue(const css::uno::Sequence< T1 > &_rList, const T2 &_rValue)
css::uno::Sequence< T > concatSequences(const css::uno::Sequence< T > &rS1, const Ss &... rSn)
css::uno::Sequence< css::beans::PropertyValue > InitPropertySequence(::std::initializer_list< ::std::pair< OUString, css::uno::Any > > vInit)
bool any2bool(const css::uno::Any &rAny)
Any SAL_CALL getCaughtException()
int i
OUString aPropName
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
long Long
QPRO_FUNC_TYPE nType
Definition: qproform.cxx:398
OUString ScResId(TranslateId aId)
Definition: scdll.cxx:90
const int COUNT
Definition: sheetevents.cxx:56
char aEntryName[20]
OUString aParName
Definition: dpobject.hxx:73
OUString aParPass
Definition: dpobject.hxx:75
OUString aParSource
Definition: dpobject.hxx:72
OUString aParUser
Definition: dpobject.hxx:74
OUString aServiceName
Definition: dpobject.hxx:71
ScFieldGroupMembers maMembers
Definition: dapiuno.hxx:472
OUString maName
Definition: dapiuno.hxx:471
bool mbDataLayout
Field index (if several fields with same name exist).
Definition: dapiuno.hxx:283
OUString maFieldName
Definition: dapiuno.hxx:281
sal_Int32 mnFieldIdx
Source field name.
Definition: dapiuno.hxx:282
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
css::sheet::DataImportMode nType
Definition: dpsdbtab.hxx:37
OUString aObject
Definition: dpsdbtab.hxx:36
OUString aDBName
Definition: dpsdbtab.hxx:35
sal_uInt32 mnIndex
unsigned char sal_uInt8
unsigned char sal_Bool
sal_Int16 SCTAB
Definition: types.hxx:22
sal_Int16 SCCOL
Definition: types.hxx:21
sal_Int32 SCROW
Definition: types.hxx:17
constexpr OUStringLiteral SC_UNONAME_FUNCTION
Definition: unonames.hxx:263
constexpr OUStringLiteral SC_UNONAME_SHOWEMPTY
Definition: unonames.hxx:279
constexpr OUStringLiteral SC_UNONAME_ORIENT
Definition: unonames.hxx:312
constexpr OUStringLiteral SC_UNO_DP_IMPORTDESC
Definition: unonames.hxx:642
constexpr OUStringLiteral SC_UNO_DP_SHOWFILTER
Definition: unonames.hxx:641
constexpr OUStringLiteral SC_UNO_DP_COLGRAND
Definition: unonames.hxx:603
constexpr OUStringLiteral SC_UNO_DP_SOURCESERVICE
Definition: unonames.hxx:643
constexpr OUStringLiteral SC_UNONAME_REPEATITEMLABELS
Definition: unonames.hxx:280
constexpr OUStringLiteral SC_UNO_DP_REPEATEMPTY
Definition: unonames.hxx:621
constexpr OUStringLiteral SC_UNO_DP_ISDATALAYOUT
Definition: unonames.hxx:607
constexpr OUStringLiteral SC_UNO_DP_SERVICEARG
Definition: unonames.hxx:644
constexpr OUStringLiteral SC_UNONAME_HASSORTINFO
Definition: unonames.hxx:273
constexpr OUStringLiteral SC_UNONAME_AUTOSHOW
Definition: unonames.hxx:272
constexpr OUStringLiteral SC_UNONAME_SHOWDETAIL
Definition: unonames.hxx:283
constexpr OUStringLiteral SC_UNONAME_POS
Definition: unonames.hxx:167
constexpr OUStringLiteral SC_UNO_DP_DRILLDOWN
Definition: unonames.hxx:640
constexpr OUStringLiteral SC_UNONAME_HASLAYOUTINFO
Definition: unonames.hxx:275
constexpr OUStringLiteral SC_UNO_DP_SOURCENAME
Definition: unonames.hxx:647
constexpr OUStringLiteral SC_UNO_DP_GRANDTOTAL_NAME
Definition: unonames.hxx:629
constexpr OUStringLiteral SC_UNO_DP_ORIGINAL
Definition: unonames.hxx:605
constexpr OUStringLiteral SC_UNO_DP_IGNORE_EMPTYROWS
Definition: unonames.hxx:639
constexpr OUStringLiteral SC_UNONAME_SUBTOTALS
Definition: unonames.hxx:265
constexpr OUStringLiteral SC_UNONAME_NAME
Definition: unonames.hxx:240
constexpr OUStringLiteral SC_UNONAME_ISHIDDEN
Definition: unonames.hxx:284
constexpr OUStringLiteral SC_UNONAME_REFERENCE
Definition: unonames.hxx:270
constexpr OUStringLiteral SC_UNONAME_HASAUTOSHOW
Definition: unonames.hxx:271
constexpr OUStringLiteral SC_UNONAME_SELPAGE
Definition: unonames.hxx:267
constexpr OUStringLiteral SC_UNONAME_GROUPINFO
Definition: unonames.hxx:278
constexpr OUStringLiteral SC_UNO_DP_OBJECTNAME
Definition: unonames.hxx:648
constexpr OUStringLiteral SC_UNONAME_SUBTOTALS2
Definition: unonames.hxx:266
constexpr OUStringLiteral SC_UNO_DP_ROWGRAND
Definition: unonames.hxx:604
constexpr OUStringLiteral SC_UNONAME_LAYOUTINFO
Definition: unonames.hxx:276
constexpr OUStringLiteral SC_UNONAME_SORTINFO
Definition: unonames.hxx:274
constexpr OUStringLiteral SC_UNO_DP_ORIENTATION
Definition: unonames.hxx:608
constexpr OUStringLiteral SC_UNONAME_FUNCTION2
Definition: unonames.hxx:264
constexpr OUStringLiteral SC_UNO_DP_USERNAME
Definition: unonames.hxx:649
constexpr OUStringLiteral SC_UNONAME_HASREFERENCE
Definition: unonames.hxx:269
constexpr OUStringLiteral SC_UNO_DP_ISVISIBLE
Definition: unonames.hxx:618
constexpr OUStringLiteral SC_UNONAME_USESELPAGE
Definition: unonames.hxx:268
constexpr OUStringLiteral SC_UNONAME_ISGROUP
Definition: unonames.hxx:277
constexpr OUStringLiteral SC_UNO_DP_SHOWDETAILS
Definition: unonames.hxx:619
constexpr OUStringLiteral SC_UNO_DP_PASSWORD
Definition: unonames.hxx:650