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", static_cast<cppu::OWeakObject*>(this), 0);
413
414 if (!pDocShell)
415 throw RuntimeException("DocShell is null", static_cast<cppu::OWeakObject*>(this));
416
417 auto pImp = comphelper::getFromUnoTunnel<ScDataPilotDescriptorBase>( xDescriptor );
418 if (!pImp)
419 throw RuntimeException("Failed to get ScDataPilotDescriptor", static_cast<cppu::OWeakObject*>(this));
420
421 ScDPObject* pNewObj = pImp->GetDPObject();
422 if (!pNewObj)
423 throw RuntimeException("Failed to get DPObject", static_cast<cppu::OWeakObject*>(this));
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", static_cast<cppu::OWeakObject*>(this));
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", static_cast<cppu::OWeakObject*>(this));
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", static_cast<cppu::OWeakObject*>(this));
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
976// XUnoTunnel
977
979 const Sequence<sal_Int8 >& rId )
980{
981 return comphelper::getSomethingImpl(rId, this);
982}
983
985{
986 static const comphelper::UnoIdInit theScDataPilotDescriptorBaseUnoTunnelId;
987 return theScDataPilotDescriptorBaseUnoTunnelId.getSeq();
988}
989
992 nTab( nT ),
993 aName(std::move( aN )),
994 aModifyListeners( 0 )
995{
996}
997
999{
1000}
1001
1003{
1004 // since we manually do resolve the query for XDataPilotTable2
1005 // we also need to do the same for XDataPilotTable
1006 SC_QUERYINTERFACE( XDataPilotTable )
1007 SC_QUERYINTERFACE( XDataPilotTable2 )
1008 SC_QUERYINTERFACE( XModifyBroadcaster )
1009
1010 return ScDataPilotDescriptorBase::queryInterface( rType );
1011}
1012
1013void SAL_CALL ScDataPilotTableObj::acquire() noexcept
1014{
1015 ScDataPilotDescriptorBase::acquire();
1016}
1017
1018void SAL_CALL ScDataPilotTableObj::release() noexcept
1019{
1020 ScDataPilotDescriptorBase::release();
1021}
1022
1023Sequence< uno::Type > SAL_CALL ScDataPilotTableObj::getTypes()
1024{
1026 ScDataPilotDescriptorBase::getTypes(),
1027 Sequence< uno::Type >
1028 {
1031 } );
1032}
1033
1034Sequence<sal_Int8> SAL_CALL ScDataPilotTableObj::getImplementationId()
1035{
1036 return css::uno::Sequence<sal_Int8>();
1037}
1038
1040{
1042}
1043
1045{
1046 ScDocShell* pDocSh = GetDocShell();
1047 ScDPObject* pDPObj = lcl_GetDPObject(pDocSh, nTab, aName);
1048 if ( pDPObj && pDocSh )
1049 {
1050 ScDBDocFunc aFunc(*pDocSh);
1051 aFunc.DataPilotUpdate( pDPObj, pDPObject, true, true );
1052 }
1053}
1054
1055// "rest of XDataPilotDescriptor"
1056
1058{
1059 SolarMutexGuard aGuard;
1061 if (pDPObj)
1062 return pDPObj->GetName();
1063 return OUString();
1064}
1065
1066void SAL_CALL ScDataPilotTableObj::setName( const OUString& aNewName )
1067{
1068 SolarMutexGuard aGuard;
1070 if (pDPObj)
1071 {
1073
1074 pDPObj->SetName( aNewName );
1075 aName = aNewName;
1076
1077 // DataPilotUpdate would do too much (output table is not changed)
1079 }
1080}
1081
1083{
1084 SolarMutexGuard aGuard;
1086 if (pDPObj)
1087 return pDPObj->GetTag();
1088 return OUString();
1089}
1090
1091void SAL_CALL ScDataPilotTableObj::setTag( const OUString& aNewTag )
1092{
1093 SolarMutexGuard aGuard;
1095 if (pDPObj)
1096 {
1097 pDPObj->SetTag( aNewTag );
1098
1099 // DataPilotUpdate would do too much (output table is not changed)
1101 }
1102}
1103
1104// XDataPilotTable
1105
1106CellRangeAddress SAL_CALL ScDataPilotTableObj::getOutputRange()
1107{
1108 SolarMutexGuard aGuard;
1109 CellRangeAddress aRet;
1111 if (pDPObj)
1112 {
1113 ScRange aRange(pDPObj->GetOutRange());
1114 aRet.Sheet = aRange.aStart.Tab();
1115 aRet.StartColumn = aRange.aStart.Col();
1116 aRet.StartRow = aRange.aStart.Row();
1117 aRet.EndColumn = aRange.aEnd.Col();
1118 aRet.EndRow = aRange.aEnd.Row();
1119 }
1120 return aRet;
1121}
1122
1124{
1125 SolarMutexGuard aGuard;
1127 if (pDPObj)
1128 {
1129 ScDBDocFunc aFunc(*GetDocShell());
1130 aFunc.RefreshPivotTables(pDPObj, true);
1131 }
1132}
1133
1134Sequence< Sequence<Any> > SAL_CALL ScDataPilotTableObj::getDrillDownData(const CellAddress& aAddr)
1135{
1136 SolarMutexGuard aGuard;
1137 Sequence< Sequence<Any> > aTabData;
1138 ScAddress aAddr2(static_cast<SCCOL>(aAddr.Column), static_cast<SCROW>(aAddr.Row), aAddr.Sheet);
1139 ScDPObject* pObj = GetDPObject();
1140 if (!pObj)
1141 throw RuntimeException("Failed to get DPObject", static_cast<cppu::OWeakObject*>(this));
1142
1143 pObj->GetDrillDownData(aAddr2, aTabData);
1144 return aTabData;
1145}
1146
1147DataPilotTablePositionData SAL_CALL ScDataPilotTableObj::getPositionData(const CellAddress& aAddr)
1148{
1149 SolarMutexGuard aGuard;
1150 DataPilotTablePositionData aPosData;
1151 ScAddress aAddr2(static_cast<SCCOL>(aAddr.Column), static_cast<SCROW>(aAddr.Row), aAddr.Sheet);
1152 ScDPObject* pObj = GetDPObject();
1153 if (!pObj)
1154 throw RuntimeException("Failed to get DPObject", static_cast<cppu::OWeakObject*>(this));
1155
1156 pObj->GetPositionData(aAddr2, aPosData);
1157 return aPosData;
1158}
1159
1160void SAL_CALL ScDataPilotTableObj::insertDrillDownSheet(const CellAddress& aAddr)
1161{
1162 SolarMutexGuard aGuard;
1163 ScDPObject* pDPObj = GetDPObject();
1164 if (!pDPObj)
1165 throw RuntimeException("Failed to get DPObject", static_cast<cppu::OWeakObject*>(this));
1167 if (!pViewSh)
1168 throw RuntimeException("Failed to get ViewShell", static_cast<cppu::OWeakObject*>(this));
1169
1170 Sequence<DataPilotFieldFilter> aFilters;
1172 ScAddress(static_cast<SCCOL>(aAddr.Column), static_cast<SCROW>(aAddr.Row), aAddr.Sheet), aFilters);
1173 pViewSh->ShowDataPilotSourceData(*pDPObj, aFilters);
1174}
1175
1176CellRangeAddress SAL_CALL ScDataPilotTableObj::getOutputRangeByType( sal_Int32 nType )
1177{
1178 SolarMutexGuard aGuard;
1179 if (nType < 0 || nType > DataPilotOutputRangeType::RESULT)
1180 throw IllegalArgumentException("nType must be between 0 and " +
1181 OUString::number(DataPilotOutputRangeType::RESULT) + ", got " + OUString::number(nType),
1182 static_cast<cppu::OWeakObject*>(this), 0);
1183
1184 CellRangeAddress aRet;
1185 if (ScDPObject* pDPObj = lcl_GetDPObject(GetDocShell(), nTab, aName))
1186 ScUnoConversion::FillApiRange( aRet, pDPObj->GetOutputRangeByType( nType ) );
1187 return aRet;
1188}
1189
1190void SAL_CALL ScDataPilotTableObj::addModifyListener( const uno::Reference<util::XModifyListener>& aListener )
1191{
1192 SolarMutexGuard aGuard;
1193
1194 aModifyListeners.emplace_back( aListener );
1195
1196 if ( aModifyListeners.size() == 1 )
1197 {
1198 acquire(); // don't lose this object (one ref for all listeners)
1199 }
1200}
1201
1202void SAL_CALL ScDataPilotTableObj::removeModifyListener( const uno::Reference<util::XModifyListener>& aListener )
1203{
1204 SolarMutexGuard aGuard;
1205
1206 rtl::Reference<ScDataPilotTableObj> xSelfHold(this); // in case the listeners have the last ref
1207
1208 sal_uInt16 nCount = aModifyListeners.size();
1209 for ( sal_uInt16 n=nCount; n--; )
1210 {
1211 uno::Reference<util::XModifyListener>& rObj = aModifyListeners[n];
1212 if ( rObj == aListener )
1213 {
1214 aModifyListeners.erase( aModifyListeners.begin() + n );
1215
1216 if ( aModifyListeners.empty() )
1217 {
1218 release(); // release the ref for the listeners
1219 }
1220
1221 break;
1222 }
1223 }
1224}
1225
1227{
1228 if ( auto pDataPilotHint = dynamic_cast<const ScDataPilotModifiedHint*>(&rHint) )
1229 {
1230 if (pDataPilotHint->GetName() == aName)
1232 }
1233 else if ( auto pRefHint = dynamic_cast<const ScUpdateRefHint*>(&rHint) )
1234 {
1235 ScRange aRange( 0, 0, nTab );
1236 ScRangeList aRanges( aRange );
1237 if ( aRanges.UpdateReference( pRefHint->GetMode(), &GetDocShell()->GetDocument(), pRefHint->GetRange(),
1238 pRefHint->GetDx(), pRefHint->GetDy(), pRefHint->GetDz() ) &&
1239 aRanges.size() == 1 )
1240 {
1241 nTab = aRanges.front().aStart.Tab();
1242 }
1243 }
1244
1246}
1247
1249{
1250 lang::EventObject aEvent;
1251 aEvent.Source.set(static_cast<cppu::OWeakObject*>(this));
1252
1253 // the EventObject holds a Ref to this object until after the listener calls
1254
1255 ScDocument& rDoc = GetDocShell()->GetDocument();
1256 for (const uno::Reference<util::XModifyListener> & xModifyListener : aModifyListeners)
1257 rDoc.AddUnoListenerCall( xModifyListener, aEvent );
1258}
1259
1261 ScDataPilotDescriptorBase( rDocSh ),
1262 mpDPObject(new ScDPObject(&rDocSh.GetDocument()))
1263{
1264 ScDPSaveData aSaveData;
1265 // set defaults like in ScPivotParam constructor
1266 aSaveData.SetColumnGrand( true );
1267 aSaveData.SetRowGrand( true );
1268 aSaveData.SetIgnoreEmptyRows( false );
1269 aSaveData.SetRepeatIfEmpty( false );
1270 mpDPObject->SetSaveData(aSaveData);
1271 ScSheetSourceDesc aSheetDesc(&rDocSh.GetDocument());
1272 mpDPObject->SetSheetDesc(aSheetDesc);
1273}
1274
1276{
1277}
1278
1280{
1281 return mpDPObject.get();
1282}
1283
1285{
1286 if (mpDPObject.get() != pDPObject)
1287 {
1288 mpDPObject.reset( pDPObject );
1289 OSL_FAIL("replace DPObject should not happen");
1290 }
1291}
1292
1293// "rest of XDataPilotDescriptor"
1294
1296{
1297 SolarMutexGuard aGuard;
1298 return mpDPObject->GetName();
1299}
1300
1301void SAL_CALL ScDataPilotDescriptor::setName( const OUString& aNewName )
1302{
1303 SolarMutexGuard aGuard;
1304 mpDPObject->SetName( aNewName );
1305}
1306
1308{
1309 SolarMutexGuard aGuard;
1310 return mpDPObject->GetTag();
1311}
1312
1313void SAL_CALL ScDataPilotDescriptor::setTag( const OUString& aNewTag )
1314{
1315 SolarMutexGuard aGuard;
1316 mpDPObject->SetTag( aNewTag );
1317}
1318
1320 mxParent( &rParent )
1321{
1322}
1323
1325 mxParent( &rParent ),
1326 maFieldId(std::move( aFieldId ))
1327{
1328}
1329
1331{
1332}
1333
1335{
1336 return mxParent->GetDPObject();
1337}
1338
1340{
1341 mxParent->SetDPObject( pDPObject );
1342}
1343
1345{
1346 if( ScDPObject* pDPObj = GetDPObject() )
1347 {
1348 if( ppDPObject ) *ppDPObject = pDPObj;
1349 if( ScDPSaveData* pSaveData = pDPObj->GetSaveData() )
1350 {
1352 return pSaveData->GetDataLayoutDimension();
1353
1354 if( maFieldId.mnFieldIdx == 0 )
1355 return pSaveData->GetDimensionByName( maFieldId.maFieldName );
1356
1357 // find dimension with specified index (search in duplicated dimensions)
1358 const ScDPSaveData::DimsType& rDims = pSaveData->GetDimensions();
1359
1360 sal_Int32 nFoundIdx = 0;
1361 for (auto const& it : rDims)
1362 {
1363 if (it->IsDataLayout())
1364 continue;
1365
1366 OUString aSrcName = ScDPUtil::getSourceDimensionName(it->GetName());
1367 if (aSrcName == maFieldId.maFieldName)
1368 {
1369 if( nFoundIdx == maFieldId.mnFieldIdx )
1370 return it.get();
1371 ++nFoundIdx;
1372 }
1373 }
1374 }
1375 }
1376 return nullptr;
1377}
1378
1380{
1381 sal_Int32 nRet = 0;
1382 Reference<XNameAccess> xMembersNA = GetMembers();
1383 if (xMembersNA.is())
1384 {
1385 Reference< XIndexAccess > xMembersIA( new ScNameToIndexAccess( xMembersNA ) );
1386 nRet = xMembersIA->getCount();
1387 }
1388 return nRet;
1389}
1390
1391Reference< XMembersAccess > ScDataPilotChildObjBase::GetMembers() const
1392{
1393 Reference< XMembersAccess > xMembersNA;
1394 if( ScDPObject* pDPObj = GetDPObject() )
1395 pDPObj->GetMembersNA( lcl_GetObjectIndex( pDPObj, maFieldId ), xMembersNA );
1396 return xMembersNA;
1397}
1398
1400{
1401 return mxParent->GetDocShell();
1402}
1403
1405 ScDataPilotChildObjBase( rParent )
1406{
1407}
1408
1409ScDataPilotFieldsObj::ScDataPilotFieldsObj( ScDataPilotDescriptorBase& rParent, DataPilotFieldOrientation eOrient ) :
1410 ScDataPilotChildObjBase( rParent ),
1411 maOrient( eOrient )
1412{
1413}
1414
1416{
1417}
1418
1419static sal_Int32 lcl_GetFieldCount( const Reference<XDimensionsSupplier>& rSource, const Any& rOrient )
1420{
1421 if (!rSource.is())
1422 throw NullPointerException();
1423
1424 sal_Int32 nRet = 0;
1425
1426 Reference<XNameAccess> xDimsName(rSource->getDimensions());
1427 Reference<XIndexAccess> xIntDims(new ScNameToIndexAccess( xDimsName ));
1428 sal_Int32 nIntCount = xIntDims->getCount();
1429 for (sal_Int32 i = 0; i < nIntCount; ++i)
1430 {
1431 Reference<XPropertySet> xDim(xIntDims->getByIndex(i), UNO_QUERY);
1432 const bool bMatch = xDim
1433 && (rOrient.hasValue()
1434 // all fields of the specified orientation, including duplicated
1435 ? (xDim->getPropertyValue(SC_UNO_DP_ORIENTATION) == rOrient)
1436 // count all non-duplicated fields
1437 : !lcl_IsDuplicated(xDim));
1438 if (bMatch)
1439 ++nRet;
1440 }
1441
1442 return nRet;
1443}
1444
1445static bool lcl_GetFieldDataByIndex( const Reference<XDimensionsSupplier>& rSource,
1446 const Any& rOrient, SCSIZE nIndex, ScFieldIdentifier& rFieldId )
1447{
1448 if (!rSource.is())
1449 throw NullPointerException();
1450
1451 bool bOk = false;
1452 SCSIZE nPos = 0;
1453 sal_Int32 nDimIndex = 0;
1454
1455 Reference<XNameAccess> xDimsName(rSource->getDimensions());
1456 Reference<XIndexAccess> xIntDims(new ScNameToIndexAccess( xDimsName ));
1457 sal_Int32 nIntCount = xIntDims->getCount();
1458 Reference<XPropertySet> xDim;
1459 for (sal_Int32 i = 0; i < nIntCount; ++i)
1460 {
1461 xDim.set(xIntDims->getByIndex(i), UNO_QUERY);
1462 const bool bMatch = xDim
1463 && (rOrient.hasValue()
1464 ? (xDim->getPropertyValue(SC_UNO_DP_ORIENTATION) == rOrient)
1465 : !lcl_IsDuplicated(xDim));
1466 if (bMatch)
1467 {
1468 if (nPos == nIndex)
1469 {
1470 bOk = true;
1471 nDimIndex = i;
1472 break;
1473 }
1474 else
1475 ++nPos;
1476 }
1477 }
1478
1479 if ( bOk )
1480 {
1481 xDim.set( xIntDims->getByIndex(nDimIndex), UNO_QUERY );
1482 Reference<XNamed> xDimName( xDim, UNO_QUERY );
1483 if ( xDimName.is() )
1484 {
1485 OUString sOriginalName( lcl_GetOriginalName( xDimName ) );
1486 rFieldId.maFieldName = sOriginalName;
1489
1490 sal_Int32 nRepeat = 0;
1491 if ( rOrient.hasValue() && lcl_IsDuplicated( xDim ) )
1492 {
1493 // find the repeat count
1494 // (this relies on the original dimension always being before the duplicates)
1495
1496 Reference<XNamed> xPrevName;
1497 for (sal_Int32 i = 0; i < nDimIndex; ++i)
1498 {
1499 xPrevName.set( xIntDims->getByIndex(i), UNO_QUERY );
1500 if ( xPrevName.is() && lcl_GetOriginalName( xPrevName ) == sOriginalName )
1501 ++nRepeat;
1502 }
1503 }
1504 rFieldId.mnFieldIdx = nRepeat;
1505 }
1506 else
1507 bOk = false;
1508 }
1509
1510 return bOk;
1511}
1512
1513static bool lcl_GetFieldDataByName( ScDPObject* pDPObj, const OUString& rFieldName, ScFieldIdentifier& rFieldId )
1514{
1515 // "By name" is always the first match.
1516 // The name "Data" always refers to the data layout field.
1517 rFieldId.maFieldName = rFieldName;
1518 rFieldId.mnFieldIdx = 0;
1519 rFieldId.mbDataLayout = rFieldName == SC_DATALAYOUT_NAME;
1520
1521 pDPObj->GetSource(); // IsDimNameInUse doesn't update source data
1522
1523 // check if the named field exists (not for data layout)
1524 return rFieldId.mbDataLayout || pDPObj->IsDimNameInUse( rFieldName );
1525}
1526
1527// XDataPilotFields
1528
1530{
1531 if (ScDPObject* pObj = GetDPObject())
1532 {
1533 ScFieldIdentifier aFieldId;
1534 if (lcl_GetFieldDataByIndex( pObj->GetSource(), maOrient, nIndex, aFieldId ))
1535 return new ScDataPilotFieldObj( *mxParent, aFieldId, maOrient );
1536 }
1537 return nullptr;
1538}
1539
1541{
1542 if (ScDPObject* pDPObj = GetDPObject())
1543 {
1544 ScFieldIdentifier aFieldId;
1545 if (lcl_GetFieldDataByName( pDPObj, aName, aFieldId ))
1546 return new ScDataPilotFieldObj( *mxParent, aFieldId, maOrient );
1547 }
1548 return nullptr;
1549}
1550
1551// XEnumerationAccess
1552
1553Reference<XEnumeration> SAL_CALL ScDataPilotFieldsObj::createEnumeration()
1554{
1555 SolarMutexGuard aGuard;
1556 return new ScIndexEnumeration(this, "com.sun.star.sheet.DataPilotFieldsEnumeration");
1557}
1558
1559// XIndexAccess
1560
1562{
1563 SolarMutexGuard aGuard;
1564 ScDPObject* pDPObj = GetDPObject();
1565 return pDPObj ? lcl_GetFieldCount( pDPObj->GetSource(), maOrient ) : 0;
1566}
1567
1568Any SAL_CALL ScDataPilotFieldsObj::getByIndex( sal_Int32 nIndex )
1569{
1570 SolarMutexGuard aGuard;
1571 Reference< XPropertySet > xField( GetObjectByIndex_Impl( nIndex ) );
1572 if (!xField.is())
1573 throw IndexOutOfBoundsException();
1574 return Any( xField );
1575}
1576
1577// XElementAccess
1578
1580{
1582}
1583
1585{
1586 SolarMutexGuard aGuard;
1587 return ( getCount() != 0 );
1588}
1589
1590// XNameAccess
1591
1592Any SAL_CALL ScDataPilotFieldsObj::getByName( const OUString& aName )
1593{
1594 SolarMutexGuard aGuard;
1595 Reference<XPropertySet> xField(GetObjectByName_Impl(aName));
1596 if (!xField.is())
1597 throw NoSuchElementException();
1598 return Any( xField );
1599}
1600
1601Sequence<OUString> SAL_CALL ScDataPilotFieldsObj::getElementNames()
1602{
1603 SolarMutexGuard aGuard;
1604 if (ScDPObject* pDPObj = GetDPObject())
1605 {
1606 Sequence< OUString > aSeq( lcl_GetFieldCount( pDPObj->GetSource(), maOrient ) );
1607 OUString* pAry = aSeq.getArray();
1608
1609 const ScDPSaveData::DimsType& rDimensions = pDPObj->GetSaveData()->GetDimensions();
1610 for (auto const& it : rDimensions)
1611 {
1612 if(maOrient.hasValue() && (it->GetOrientation() == maOrient.get< DataPilotFieldOrientation >()))
1613 {
1614 *pAry = it->GetName();
1615 ++pAry;
1616 }
1617 }
1618 return aSeq;
1619 }
1620 return Sequence<OUString>();
1621}
1622
1623sal_Bool SAL_CALL ScDataPilotFieldsObj::hasByName( const OUString& aName )
1624{
1625 SolarMutexGuard aGuard;
1626
1627 return GetObjectByName_Impl(aName) != nullptr;
1628}
1629
1631 ScDataPilotDescriptorBase& rParent, const ScFieldIdentifier& rFieldId ) :
1632 ScDataPilotChildObjBase( rParent, rFieldId ),
1633 maPropSet( lcl_GetDataPilotFieldMap() )
1634{
1635}
1636
1638 const ScFieldIdentifier& rFieldId, Any aOrient ) :
1639 ScDataPilotChildObjBase( rParent, rFieldId ),
1640 maPropSet( lcl_GetDataPilotFieldMap() ),
1641 maOrient(std::move( aOrient ))
1642{
1643}
1644
1646{
1647}
1648
1649// XNamed
1650
1652{
1653 SolarMutexGuard aGuard;
1654 OUString aName;
1655 if( ScDPSaveDimension* pDim = GetDPDimension() )
1656 {
1657 if( pDim->IsDataLayout() )
1659 else
1660 {
1661 const std::optional<OUString> & pLayoutName = pDim->GetLayoutName();
1662 if (pLayoutName)
1663 aName = *pLayoutName;
1664 else
1665 aName = pDim->GetName();
1666 }
1667 }
1668 return aName;
1669}
1670
1671void SAL_CALL ScDataPilotFieldObj::setName(const OUString& rName)
1672{
1673 SolarMutexGuard aGuard;
1674 ScDPObject* pDPObj = nullptr;
1675 ScDPSaveDimension* pDim = GetDPDimension( &pDPObj );
1676 if( pDim && !pDim->IsDataLayout() )
1677 {
1678 pDim->SetLayoutName(rName);
1679 SetDPObject( pDPObj );
1680 }
1681}
1682
1683// XPropertySet
1684
1685Reference<XPropertySetInfo> SAL_CALL ScDataPilotFieldObj::getPropertySetInfo()
1686{
1687 SolarMutexGuard aGuard;
1688 static Reference<XPropertySetInfo> aRef(
1690 return aRef;
1691}
1692
1693void SAL_CALL ScDataPilotFieldObj::setPropertyValue( const OUString& aPropertyName, const Any& aValue )
1694{
1695 SolarMutexGuard aGuard;
1696 if ( aPropertyName == SC_UNONAME_FUNCTION )
1697 {
1698 // #i109350# use GetEnumFromAny because it also allows sal_Int32
1700 setFunction( eFunction );
1701 }
1702 else if ( aPropertyName == SC_UNONAME_FUNCTION2 )
1703 {
1705 setFunction( eFunction );
1706 }
1707 else if ( aPropertyName == SC_UNONAME_SUBTOTALS )
1708 {
1709 uno::Sequence<sheet::GeneralFunction> 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 [](const sheet::GeneralFunction& rValue) -> ScGeneralFunction {
1715 const int nValAsInt = static_cast<int>(rValue);
1716 return static_cast<ScGeneralFunction>(nValAsInt);
1717 });
1718 setSubtotals( aSubTotals );
1719 }
1720 }
1721 else if ( aPropertyName == SC_UNONAME_SUBTOTALS2 )
1722 {
1723 Sequence< sal_Int16 > aSeq;
1724 if( aValue >>= aSeq )
1725 {
1726 std::vector< ScGeneralFunction > aSubTotals(aSeq.getLength());
1727 std::transform(std::cbegin(aSeq), std::cend(aSeq), aSubTotals.begin(),
1728 [](sal_Int16 nValue) -> ScGeneralFunction { return static_cast<ScGeneralFunction>(nValue); });
1729 setSubtotals( aSubTotals );
1730 }
1731 }
1732 else if ( aPropertyName == SC_UNONAME_ORIENT )
1733 {
1735 DataPilotFieldOrientation eOrient = static_cast<DataPilotFieldOrientation>(ScUnoHelpFunctions::GetEnumFromAny( aValue ));
1736 setOrientation( eOrient );
1737 }
1738 else if ( aPropertyName == SC_UNONAME_SELPAGE )
1739 {
1740 OUString sCurrentPage;
1741 if (aValue >>= sCurrentPage)
1742 setCurrentPage(sCurrentPage);
1743 }
1744 else if ( aPropertyName == SC_UNONAME_USESELPAGE )
1745 {
1747 }
1748 else if ( aPropertyName == SC_UNONAME_HASAUTOSHOW )
1749 {
1750 if (!cppu::any2bool(aValue))
1751 setAutoShowInfo(nullptr);
1752 }
1753 else if ( aPropertyName == SC_UNONAME_AUTOSHOW )
1754 {
1755 DataPilotFieldAutoShowInfo aInfo;
1756 if (aValue >>= aInfo)
1757 setAutoShowInfo(&aInfo);
1758 }
1759 else if ( aPropertyName == SC_UNONAME_HASLAYOUTINFO )
1760 {
1761 if (!cppu::any2bool(aValue))
1762 setLayoutInfo(nullptr);
1763 }
1764 else if ( aPropertyName == SC_UNONAME_LAYOUTINFO )
1765 {
1766 DataPilotFieldLayoutInfo aInfo;
1767 if (aValue >>= aInfo)
1768 setLayoutInfo(&aInfo);
1769 }
1770 else if ( aPropertyName == SC_UNONAME_HASREFERENCE )
1771 {
1772 if (!cppu::any2bool(aValue))
1773 setReference(nullptr);
1774 }
1775 else if ( aPropertyName == SC_UNONAME_REFERENCE )
1776 {
1777 DataPilotFieldReference aRef;
1778 if (aValue >>= aRef)
1779 setReference(&aRef);
1780 }
1781 else if ( aPropertyName == SC_UNONAME_HASSORTINFO )
1782 {
1783 if (!cppu::any2bool(aValue))
1784 setSortInfo(nullptr);
1785 }
1786 else if ( aPropertyName == SC_UNONAME_SORTINFO )
1787 {
1788 DataPilotFieldSortInfo aInfo;
1789 if (aValue >>= aInfo)
1790 setSortInfo(&aInfo);
1791 }
1792 else if ( aPropertyName == SC_UNONAME_ISGROUP )
1793 {
1794 if (!cppu::any2bool(aValue))
1795 setGroupInfo(nullptr);
1796 }
1797 else if ( aPropertyName == SC_UNONAME_GROUPINFO )
1798 {
1799 DataPilotFieldGroupInfo aInfo;
1800 if (aValue >>= aInfo)
1801 setGroupInfo(&aInfo);
1802 }
1803 else if ( aPropertyName == SC_UNONAME_SHOWEMPTY )
1804 {
1806 }
1807 else if ( aPropertyName == SC_UNONAME_REPEATITEMLABELS )
1808 {
1810 }
1811 else if (aPropertyName == SC_UNONAME_NAME)
1812 {
1813 OUString sName;
1814 if (aValue >>= sName)
1815 setName(sName);
1816 }
1817}
1818
1819Any SAL_CALL ScDataPilotFieldObj::getPropertyValue( const OUString& aPropertyName )
1820{
1821 SolarMutexGuard aGuard;
1822 Any aRet;
1823
1824 if ( aPropertyName == SC_UNONAME_FUNCTION )
1825 {
1826 sheet::GeneralFunction eVal;
1827 sal_Int16 nFunction = getFunction();
1828 if (nFunction == sheet::GeneralFunction2::MEDIAN)
1829 {
1830 eVal = sheet::GeneralFunction_NONE;
1831 }
1832 else
1833 {
1834 eVal = static_cast<sheet::GeneralFunction>(nFunction);
1835 }
1836 aRet <<= eVal;
1837 }
1838 else if ( aPropertyName == SC_UNONAME_FUNCTION2 )
1839 aRet <<= getFunction();
1840 else if ( aPropertyName == SC_UNONAME_SUBTOTALS )
1841 {
1842 const uno::Sequence<sal_Int16> aSeq = getSubtotals();
1843 uno::Sequence<sheet::GeneralFunction> aNewSeq(aSeq.getLength());
1844 std::transform(aSeq.begin(), aSeq.end(), aNewSeq.getArray(),
1845 [](sal_Int16 nFunc) -> sheet::GeneralFunction {
1846 if (nFunc == sheet::GeneralFunction2::MEDIAN)
1847 return sheet::GeneralFunction_NONE;
1848 return static_cast<sheet::GeneralFunction>(nFunc);
1849 });
1850 aRet <<= aNewSeq;
1851 }
1852 else if ( aPropertyName == SC_UNONAME_SUBTOTALS2 )
1853 {
1854 aRet <<= getSubtotals();
1855 }
1856 else if ( aPropertyName == SC_UNONAME_ORIENT )
1857 aRet <<= getOrientation();
1858 else if ( aPropertyName == SC_UNONAME_SELPAGE )
1859 aRet <<= OUString();
1860 else if ( aPropertyName == SC_UNONAME_USESELPAGE )
1861 aRet <<= false;
1862 else if ( aPropertyName == SC_UNONAME_HASAUTOSHOW )
1863 aRet <<= (getAutoShowInfo() != nullptr);
1864 else if ( aPropertyName == SC_UNONAME_AUTOSHOW )
1865 {
1866 const DataPilotFieldAutoShowInfo* pInfo = getAutoShowInfo();
1867 if (pInfo)
1868 aRet <<= *pInfo;
1869 }
1870 else if ( aPropertyName == SC_UNONAME_HASLAYOUTINFO )
1871 aRet <<= (getLayoutInfo() != nullptr);
1872 else if ( aPropertyName == SC_UNONAME_LAYOUTINFO )
1873 {
1874 const DataPilotFieldLayoutInfo* pInfo = getLayoutInfo();
1875 if (pInfo)
1876 aRet <<= *pInfo;
1877 }
1878 else if ( aPropertyName == SC_UNONAME_HASREFERENCE )
1879 aRet <<= (getReference() != nullptr);
1880 else if ( aPropertyName == SC_UNONAME_REFERENCE )
1881 {
1882 const DataPilotFieldReference* pRef = getReference();
1883 if (pRef)
1884 aRet <<= *pRef;
1885 }
1886 else if ( aPropertyName == SC_UNONAME_HASSORTINFO )
1887 aRet <<= (getSortInfo() != nullptr);
1888 else if ( aPropertyName == SC_UNONAME_SORTINFO )
1889 {
1890 const DataPilotFieldSortInfo* pInfo = getSortInfo();
1891 if (pInfo)
1892 aRet <<= *pInfo;
1893 }
1894 else if ( aPropertyName == SC_UNONAME_ISGROUP )
1895 aRet <<= hasGroupInfo();
1896 else if ( aPropertyName == SC_UNONAME_GROUPINFO )
1897 {
1898 aRet <<= getGroupInfo();
1899 }
1900 else if ( aPropertyName == SC_UNONAME_SHOWEMPTY )
1901 aRet <<= getShowEmpty();
1902 else if ( aPropertyName == SC_UNONAME_REPEATITEMLABELS )
1903 aRet <<= getRepeatItemLabels();
1904 else if (aPropertyName == SC_UNONAME_NAME)
1905 aRet <<= getName();
1906
1907 return aRet;
1908}
1909
1910// XDatePilotField
1911
1912Reference<XIndexAccess> SAL_CALL ScDataPilotFieldObj::getItems()
1913{
1914 SolarMutexGuard aGuard;
1915 if (!mxItems.is())
1917 return mxItems;
1918}
1919
1921
1922DataPilotFieldOrientation ScDataPilotFieldObj::getOrientation() const
1923{
1924 SolarMutexGuard aGuard;
1925 ScDPSaveDimension* pDim = GetDPDimension();
1926 return pDim ? pDim->GetOrientation() : DataPilotFieldOrientation_HIDDEN;
1927}
1928
1929void ScDataPilotFieldObj::setOrientation(DataPilotFieldOrientation eNew)
1930{
1931 SolarMutexGuard aGuard;
1932 if (maOrient.hasValue() && (eNew == maOrient.get< DataPilotFieldOrientation >()))
1933 return;
1934
1935 ScDPObject* pDPObj = nullptr;
1936 ScDPSaveDimension* pDim = GetDPDimension( &pDPObj );
1937 if(!pDim)
1938 return;
1939
1940 ScDPSaveData* pSaveData = pDPObj->GetSaveData();
1941
1942 /* If the field was taken from getDataPilotFields(), don't reset the
1943 orientation for an existing use, but create a duplicated field
1944 instead (for "Data" orientation only). */
1945 if ( !maOrient.hasValue() && !maFieldId.mbDataLayout &&
1946 (pDim->GetOrientation() != DataPilotFieldOrientation_HIDDEN) &&
1947 (eNew == DataPilotFieldOrientation_DATA) )
1948 {
1949
1950 ScDPSaveDimension* pNewDim = nullptr;
1951
1952 // look for existing duplicate with orientation "hidden"
1953
1954 sal_Int32 nFound = 0;
1955 const ScDPSaveData::DimsType& rDimensions = pSaveData->GetDimensions();
1956 for (auto const& it : rDimensions)
1957 {
1958 if ( !it->IsDataLayout() && (it->GetName() == maFieldId.maFieldName) )
1959 {
1960 if ( it->GetOrientation() == DataPilotFieldOrientation_HIDDEN )
1961 {
1962 pNewDim = it.get(); // use this one
1963 break;
1964 }
1965 else
1966 ++nFound; // count existing non-hidden occurrences
1967 }
1968 }
1969
1970 if ( !pNewDim ) // if none found, create a new duplicated dimension
1971 pNewDim = &pSaveData->DuplicateDimension( *pDim );
1972
1973 maFieldId.mnFieldIdx = nFound; // keep accessing the new one
1974 pDim = pNewDim;
1975 }
1976
1977 pDim->SetOrientation(eNew);
1978
1979 // move changed field behind all other fields (make it the last field in dimension)
1980 pSaveData->SetPosition( pDim, pSaveData->GetDimensions().size() );
1981
1982 SetDPObject( pDPObj );
1983
1984 maOrient <<= eNew; // modifying the same object's orientation again doesn't create another duplicate
1985}
1986
1988{
1989 SolarMutexGuard aGuard;
1990 sal_Int16 eRet = GeneralFunction2::NONE;
1991 if( ScDPSaveDimension* pDim = GetDPDimension() )
1992 {
1993 if( pDim->GetOrientation() != DataPilotFieldOrientation_DATA )
1994 {
1995 // for non-data fields, property Function is the subtotals
1996 tools::Long nSubCount = pDim->GetSubTotalsCount();
1997 if ( nSubCount > 0 )
1998 eRet = static_cast<sal_Int16>(pDim->GetSubTotalFunc(0)); // always use the first one
1999 // else keep NONE
2000 }
2001 else
2002 eRet = static_cast<sal_Int16>(pDim->GetFunction());
2003 }
2004 return eRet;
2005}
2006
2008{
2009 SolarMutexGuard aGuard;
2010 ScDPObject* pDPObj = nullptr;
2011 ScDPSaveDimension* pDim = GetDPDimension( &pDPObj );
2012 if(!pDim)
2013 return;
2014
2015 if( pDim->GetOrientation() != DataPilotFieldOrientation_DATA )
2016 {
2017 // for non-data fields, property Function is the subtotals
2018 std::vector<ScGeneralFunction> nSubTotalFuncs;
2019 if ( eNewFunc != ScGeneralFunction::NONE )
2020 {
2021 nSubTotalFuncs.push_back( eNewFunc );
2022 }
2023 pDim->SetSubTotals( std::move(nSubTotalFuncs) );
2024 }
2025 else
2026 pDim->SetFunction( eNewFunc );
2027 SetDPObject( pDPObj );
2028}
2029
2030Sequence< sal_Int16 > ScDataPilotFieldObj::getSubtotals() const
2031{
2032 SolarMutexGuard aGuard;
2033 Sequence< sal_Int16 > aRet;
2034 if( ScDPSaveDimension* pDim = GetDPDimension() )
2035 {
2036 if( pDim->GetOrientation() != DataPilotFieldOrientation_DATA )
2037 {
2038 // for non-data fields, property Functions is the sequence of subtotals
2039 sal_Int32 nCount = static_cast< sal_Int32 >( pDim->GetSubTotalsCount() );
2040 if ( nCount > 0 )
2041 {
2042 aRet.realloc( nCount );
2043 auto pRet = aRet.getArray();
2044 for( sal_Int32 nIdx = 0; nIdx < nCount; ++nIdx )
2045 pRet[ nIdx ] = static_cast<sal_Int16>(pDim->GetSubTotalFunc( nIdx ));
2046 }
2047 }
2048 }
2049 return aRet;
2050}
2051
2052void ScDataPilotFieldObj::setSubtotals( const std::vector< ScGeneralFunction >& rSubtotals )
2053{
2054 SolarMutexGuard aGuard;
2055 ScDPObject* pDPObj = nullptr;
2056 ScDPSaveDimension* pDim = GetDPDimension( &pDPObj );
2057 if(!pDim)
2058 return;
2059
2060 if( pDim->GetOrientation() != DataPilotFieldOrientation_DATA )
2061 {
2062 sal_Int32 nCount = rSubtotals.size();
2063 if( nCount == 1 )
2064 {
2065 // count 1: all values are allowed (including NONE and AUTO)
2066 std::vector<ScGeneralFunction> nTmpFuncs;
2067 if( rSubtotals[ 0 ] != ScGeneralFunction::NONE )
2068 {
2069 nTmpFuncs.push_back( rSubtotals[ 0 ] );
2070 }
2071 pDim->SetSubTotals( std::move(nTmpFuncs) );
2072 }
2073 else if( nCount > 1 )
2074 {
2075 // set multiple functions, ignore NONE and AUTO in this case
2076 ::std::vector< ScGeneralFunction > aSubt;
2077 for( sal_Int32 nIdx = 0; nIdx < nCount; ++nIdx )
2078 {
2079 ScGeneralFunction eFunc = rSubtotals[ nIdx ];
2080 if( (eFunc != ScGeneralFunction::NONE) && (eFunc != ScGeneralFunction::AUTO) )
2081 {
2082 // do not insert functions twice
2083 if( ::std::find( aSubt.begin(), aSubt.end(), eFunc ) == aSubt.end() )
2084 aSubt.push_back( eFunc );
2085 }
2086 }
2087 // set values from vector to ScDPSaveDimension
2088 pDim->SetSubTotals( std::move(aSubt) );
2089 }
2090 }
2091 SetDPObject( pDPObj );
2092}
2093
2094void ScDataPilotFieldObj::setCurrentPage( const OUString& rPage )
2095{
2096 SolarMutexGuard aGuard;
2097 ScDPObject* pDPObj = nullptr;
2098 if( ScDPSaveDimension* pDim = GetDPDimension( &pDPObj ) )
2099 {
2100 pDim->SetCurrentPage( &rPage );
2101 SetDPObject( pDPObj );
2102 }
2103}
2104
2106{
2107 SolarMutexGuard aGuard;
2108 ScDPObject* pDPObj = nullptr;
2109 ScDPSaveDimension* pDim = GetDPDimension( &pDPObj );
2110 if(!pDim)
2111 return;
2112
2113 if( bUse )
2114 {
2115 /* It is somehow useless to set the property "HasSelectedPage" to
2116 true, because it is still needed to set an explicit page name. */
2117 const OUString aPage;
2118 pDim->SetCurrentPage( &aPage );
2119 }
2120 else
2121 pDim->SetCurrentPage( nullptr );
2122 SetDPObject( pDPObj );
2123}
2124
2125const DataPilotFieldAutoShowInfo* ScDataPilotFieldObj::getAutoShowInfo() const
2126{
2127 SolarMutexGuard aGuard;
2129 return pDim ? pDim->GetAutoShowInfo() : nullptr;
2130}
2131
2132void ScDataPilotFieldObj::setAutoShowInfo( const DataPilotFieldAutoShowInfo* pInfo )
2133{
2134 SolarMutexGuard aGuard;
2135 ScDPObject* pDPObj = nullptr;
2136 if( ScDPSaveDimension* pDim = GetDPDimension( &pDPObj ) )
2137 {
2138 pDim->SetAutoShowInfo( pInfo );
2139 SetDPObject( pDPObj );
2140 }
2141}
2142
2143const DataPilotFieldLayoutInfo* ScDataPilotFieldObj::getLayoutInfo() const
2144{
2145 SolarMutexGuard aGuard;
2147 return pDim ? pDim->GetLayoutInfo() : nullptr;
2148}
2149
2150void ScDataPilotFieldObj::setLayoutInfo( const DataPilotFieldLayoutInfo* pInfo )
2151{
2152 SolarMutexGuard aGuard;
2153 ScDPObject* pDPObj = nullptr;
2154 if( ScDPSaveDimension* pDim = GetDPDimension( &pDPObj ) )
2155 {
2156 pDim->SetLayoutInfo( pInfo );
2157 SetDPObject( pDPObj );
2158 }
2159}
2160
2161const DataPilotFieldReference* ScDataPilotFieldObj::getReference() const
2162{
2163 SolarMutexGuard aGuard;
2165 return pDim ? pDim->GetReferenceValue() : nullptr;
2166}
2167
2168void ScDataPilotFieldObj::setReference( const DataPilotFieldReference* pInfo )
2169{
2170 SolarMutexGuard aGuard;
2171 ScDPObject* pDPObj = nullptr;
2172 if( ScDPSaveDimension* pDim = GetDPDimension( &pDPObj ) )
2173 {
2174 pDim->SetReferenceValue( pInfo );
2175 SetDPObject( pDPObj );
2176 }
2177}
2178
2179const DataPilotFieldSortInfo* ScDataPilotFieldObj::getSortInfo() const
2180{
2181 SolarMutexGuard aGuard;
2183 return pDim ? pDim->GetSortInfo() : nullptr;
2184}
2185
2186void ScDataPilotFieldObj::setSortInfo( const DataPilotFieldSortInfo* pInfo )
2187{
2188 SolarMutexGuard aGuard;
2189 ScDPObject* pDPObj = nullptr;
2190 if( ScDPSaveDimension* pDim = GetDPDimension( &pDPObj ) )
2191 {
2192 pDim->SetSortInfo( pInfo );
2193 SetDPObject( pDPObj );
2194 }
2195}
2196
2198{
2199 SolarMutexGuard aGuard;
2201 return pDim && pDim->GetShowEmpty();
2202}
2203
2205{
2206 SolarMutexGuard aGuard;
2207 ScDPObject* pDPObj = nullptr;
2208 if( ScDPSaveDimension* pDim = GetDPDimension( &pDPObj ) )
2209 {
2210 pDim->SetShowEmpty( bShow );
2211 SetDPObject( pDPObj );
2212 }
2213}
2214
2216{
2217 SolarMutexGuard aGuard;
2219 return pDim && pDim->GetRepeatItemLabels();
2220}
2221
2223{
2224 SolarMutexGuard aGuard;
2225 ScDPObject* pDPObj = nullptr;
2226 if( ScDPSaveDimension* pDim = GetDPDimension( &pDPObj ) )
2227 {
2228 pDim->SetRepeatItemLabels( bShow );
2229 SetDPObject( pDPObj );
2230 }
2231}
2232
2234{
2235 SolarMutexGuard aGuard;
2236 ScDPObject* pDPObj = nullptr;
2237 if( ScDPSaveDimension* pDim = GetDPDimension( &pDPObj ) )
2238 if( const ScDPDimensionSaveData* pDimData = pDPObj->GetSaveData()->GetExistingDimensionData() )
2239 return pDimData->GetNamedGroupDim( pDim->GetName() ) || pDimData->GetNumGroupDim( pDim->GetName() );
2240 return false;
2241}
2242
2243DataPilotFieldGroupInfo ScDataPilotFieldObj::getGroupInfo()
2244{
2245 SolarMutexGuard aGuard;
2246 DataPilotFieldGroupInfo aInfo;
2247 ScDPObject* pDPObj = nullptr;
2248 if( ScDPSaveDimension* pDim = GetDPDimension( &pDPObj ) )
2249 {
2250 if( const ScDPDimensionSaveData* pDimData = pDPObj->GetSaveData()->GetExistingDimensionData() )
2251 {
2252 if( const ScDPSaveGroupDimension* pGroupDim = pDimData->GetNamedGroupDim( pDim->GetName() ) )
2253 {
2254 // grouped by ...
2255 aInfo.GroupBy = pGroupDim->GetDatePart();
2256
2257 // find source field
2258 try
2259 {
2260 Reference< XNameAccess > xFields( mxParent->getDataPilotFields(), UNO_QUERY_THROW );
2261 aInfo.SourceField.set( xFields->getByName( pGroupDim->GetSourceDimName() ), UNO_QUERY );
2262 }
2263 catch( Exception& )
2264 {
2265 }
2266
2267 ScDataPilotConversion::FillGroupInfo( aInfo, pGroupDim->GetDateInfo() );
2268 if( pGroupDim->GetDatePart() == 0 )
2269 {
2270 // fill vector of group and group member information
2271 ScFieldGroups aGroups;
2272 for( sal_Int32 nIdx = 0, nCount = pGroupDim->GetGroupCount(); nIdx < nCount; ++nIdx )
2273 {
2274 const ScDPSaveGroupItem& rGroup = pGroupDim->GetGroupByIndex( nIdx );
2275 ScFieldGroup aGroup;
2276 aGroup.maName = rGroup.GetGroupName();
2277 for( sal_Int32 nMemIdx = 0, nMemCount = rGroup.GetElementCount(); nMemIdx < nMemCount; ++nMemIdx )
2278 if (const OUString* pMem = rGroup.GetElementByIndex(nMemIdx))
2279 aGroup.maMembers.push_back( *pMem );
2280 aGroups.push_back( aGroup );
2281 }
2282 aInfo.Groups = new ScDataPilotFieldGroupsObj( std::move(aGroups) );
2283 }
2284 }
2285 else if( const ScDPSaveNumGroupDimension* pNumGroupDim = pDimData->GetNumGroupDim( pDim->GetName() ) )
2286 {
2287 if (pNumGroupDim->GetDatePart())
2288 {
2289 ScDataPilotConversion::FillGroupInfo( aInfo, pNumGroupDim->GetDateInfo() );
2290 aInfo.GroupBy = pNumGroupDim->GetDatePart();
2291 }
2292 else
2293 {
2294 ScDataPilotConversion::FillGroupInfo( aInfo, pNumGroupDim->GetInfo() );
2295 }
2296 }
2297 }
2298 }
2299 return aInfo;
2300}
2301
2302void ScDataPilotFieldObj::setGroupInfo( const DataPilotFieldGroupInfo* pInfo )
2303{
2304 SolarMutexGuard aGuard;
2305 ScDPObject* pDPObj = nullptr;
2306 if( /*ScDPSaveDimension* pDim =*/ !GetDPDimension( &pDPObj ) )
2307 return;
2308
2309 ScDPSaveData* pSaveData = pDPObj->GetSaveData();
2310 if( pInfo && lclCheckMinMaxStep( *pInfo ) )
2311 {
2312 ScDPNumGroupInfo aInfo;
2313 aInfo.mbEnable = true;
2314 aInfo.mbDateValues = pInfo->HasDateValues;
2315 aInfo.mbAutoStart = pInfo->HasAutoStart;
2316 aInfo.mbAutoEnd = pInfo->HasAutoEnd;
2317 aInfo.mfStart = pInfo->Start;
2318 aInfo.mfEnd = pInfo->End;
2319 aInfo.mfStep = pInfo->Step;
2320 Reference< XNamed > xNamed( pInfo->SourceField, UNO_QUERY );
2321 if( xNamed.is() )
2322 {
2323 ScDPSaveGroupDimension aGroupDim( xNamed->getName(), getName() );
2324 if( pInfo->GroupBy )
2325 aGroupDim.SetDateInfo(aInfo, pInfo->GroupBy);
2326 else
2327 {
2328 Reference<XIndexAccess> xIndex(pInfo->Groups, UNO_QUERY);
2329 if (xIndex.is())
2330 {
2331 sal_Int32 nCount(xIndex->getCount());
2332 for(sal_Int32 i = 0; i < nCount; i++)
2333 {
2334 Reference<XNamed> xGroupNamed(xIndex->getByIndex(i), UNO_QUERY);
2335 if (xGroupNamed.is())
2336 {
2337 ScDPSaveGroupItem aItem(xGroupNamed->getName());
2338 Reference<XIndexAccess> xGroupIndex(xGroupNamed, UNO_QUERY);
2339 if (xGroupIndex.is())
2340 {
2341 sal_Int32 nItemCount(xGroupIndex->getCount());
2342 for (sal_Int32 j = 0; j < nItemCount; ++j)
2343 {
2344 Reference<XNamed> xItemNamed(xGroupIndex->getByIndex(j), UNO_QUERY);
2345 if (xItemNamed.is())
2346 aItem.AddElement(xItemNamed->getName());
2347 }
2348 }
2349 aGroupDim.AddGroupItem(aItem);
2350 }
2351 }
2352 }
2353 }
2354
2355 // get dimension savedata or create new if none
2356 ScDPDimensionSaveData& rDimSaveData = *pSaveData->GetDimensionData();
2357 rDimSaveData.ReplaceGroupDimension( aGroupDim );
2358 }
2359 else // no source field in group info -> numeric group
2360 {
2361 ScDPDimensionSaveData* pDimData = pSaveData->GetDimensionData(); // created if not there
2362
2363 ScDPSaveNumGroupDimension* pExisting = pDimData->GetNumGroupDimAcc( getName() );
2364 if ( pExisting )
2365 {
2366 if (pInfo->GroupBy)
2367 pExisting->SetDateInfo(aInfo, pInfo->GroupBy);
2368 // modify existing group dimension
2369 pExisting->SetGroupInfo( aInfo );
2370 }
2371 else if (pInfo->GroupBy)
2372 {
2373 // create new group dimension
2374 ScDPSaveNumGroupDimension aNumGroupDim( getName(), aInfo, pInfo->GroupBy );
2375 pDimData->AddNumGroupDimension( aNumGroupDim );
2376 }
2377 else
2378 {
2379 // create new group dimension
2380 ScDPSaveNumGroupDimension aNumGroupDim( getName(), aInfo );
2381 pDimData->AddNumGroupDimension( aNumGroupDim );
2382 }
2383 }
2384 }
2385 else // null passed as argument
2386 {
2387 pSaveData->SetDimensionData( nullptr );
2388 }
2389
2390 pDPObj->SetSaveData( *pSaveData );
2391 SetDPObject( pDPObj );
2392}
2393
2394// XDataPilotFieldGrouping
2395Reference< XDataPilotField > SAL_CALL ScDataPilotFieldObj::createNameGroup( const Sequence< OUString >& rItems )
2396{
2397 SolarMutexGuard aGuard;
2398
2399 if( !rItems.hasElements() )
2400 throw IllegalArgumentException("rItems is empty", static_cast<cppu::OWeakObject*>(this), 0);
2401
2402 Reference< XMembersAccess > xMembers = GetMembers();
2403 if (!xMembers.is())
2404 {
2405 SAL_WARN("sc.ui", "Cannot access members of the field object.");
2406 throw RuntimeException("Cannot access members of the field object", static_cast<cppu::OWeakObject*>(this));
2407 }
2408
2409 for (const OUString& aEntryName : rItems)
2410 {
2411 if (!xMembers->hasByName(aEntryName))
2412 {
2413 SAL_WARN("sc.ui", "There is no member with that name: " + aEntryName + ".");
2414 throw IllegalArgumentException("There is no member with name \"" + aEntryName + "\"", static_cast<cppu::OWeakObject*>(this), 0);
2415 }
2416 }
2417
2418 Reference< XDataPilotField > xRet;
2419 OUString sNewDim;
2420 ScDPObject* pDPObj = nullptr;
2421 if( ScDPSaveDimension* pDim = GetDPDimension( &pDPObj ) )
2422 {
2423 const OUString& aDimName = pDim->GetName();
2424
2425 ScDPSaveData aSaveData = *pDPObj->GetSaveData();
2426 ScDPDimensionSaveData* pDimData = aSaveData.GetDimensionData(); // created if not there
2427
2428 // find original base
2429 OUString aBaseDimName( aDimName );
2430 const ScDPSaveGroupDimension* pBaseGroupDim = pDimData->GetNamedGroupDim( aDimName );
2431 if ( pBaseGroupDim )
2432 {
2433 // any entry's SourceDimName is the original base
2434 aBaseDimName = pBaseGroupDim->GetSourceDimName();
2435 }
2436
2437 // find existing group dimension
2438 // (using the selected dim, can be intermediate group dim)
2439 ScDPSaveGroupDimension* pGroupDimension = pDimData->GetGroupDimAccForBase( aDimName );
2440
2441 // remove the selected items from their groups
2442 // (empty groups are removed, too)
2443 if ( pGroupDimension )
2444 {
2445 for (const OUString& aEntryName : rItems)
2446 {
2447 if ( pBaseGroupDim )
2448 {
2449 // for each selected (intermediate) group, remove all its items
2450 // (same logic as for adding, below)
2451 const ScDPSaveGroupItem* pBaseGroup = pBaseGroupDim->GetNamedGroup( aEntryName );
2452 if ( pBaseGroup )
2453 pBaseGroup->RemoveElementsFromGroups( *pGroupDimension ); // remove all elements
2454 else
2455 pGroupDimension->RemoveFromGroups( aEntryName );
2456 }
2457 else
2458 pGroupDimension->RemoveFromGroups( aEntryName );
2459 }
2460 }
2461
2462 std::unique_ptr<ScDPSaveGroupDimension> pNewGroupDim;
2463 if ( !pGroupDimension )
2464 {
2465 // create a new group dimension
2466 sNewDim = pDimData->CreateGroupDimName( aBaseDimName, *pDPObj, false, nullptr );
2467 pNewGroupDim.reset(new ScDPSaveGroupDimension( aBaseDimName, sNewDim ));
2468
2469 pGroupDimension = pNewGroupDim.get(); // make changes to the new dim if none existed
2470
2471 if ( pBaseGroupDim )
2472 {
2473 // If it's a higher-order group dimension, pre-allocate groups for all
2474 // non-selected original groups, so the individual base members aren't
2475 // used for automatic groups (this would make the original groups hard
2476 // to find).
2479
2480 tools::Long nGroupCount = pBaseGroupDim->GetGroupCount();
2481 for ( tools::Long nGroup = 0; nGroup < nGroupCount; nGroup++ )
2482 {
2483 const ScDPSaveGroupItem& rBaseGroup = pBaseGroupDim->GetGroupByIndex( nGroup );
2484
2485 if (comphelper::findValue(rItems, rBaseGroup.GetGroupName()) == -1)
2486 {
2487 // add an additional group for each item that is not in the selection
2488 ScDPSaveGroupItem aGroup( rBaseGroup.GetGroupName() );
2489 aGroup.AddElementsFromGroup( rBaseGroup );
2490 pGroupDimension->AddGroupItem( aGroup );
2491 }
2492 }
2493 }
2494 }
2495 OUString aGroupDimName = pGroupDimension->GetGroupDimName();
2496
2497 OUString aGroupName = pGroupDimension->CreateGroupName( ScResId(STR_PIVOT_GROUP) );
2498 ScDPSaveGroupItem aGroup( aGroupName );
2499 for (const OUString& aEntryName : rItems)
2500 {
2501 if ( pBaseGroupDim )
2502 {
2503 // for each selected (intermediate) group, add all its items
2504 const ScDPSaveGroupItem* pBaseGroup = pBaseGroupDim->GetNamedGroup( aEntryName );
2505 if ( pBaseGroup )
2506 aGroup.AddElementsFromGroup( *pBaseGroup );
2507 else
2508 aGroup.AddElement( aEntryName ); // no group found -> automatic group, add the item itself
2509 }
2510 else
2511 aGroup.AddElement( aEntryName ); // no group dimension, add all items directly
2512 }
2513
2514 pGroupDimension->AddGroupItem( aGroup );
2515
2516 if ( pNewGroupDim )
2517 {
2518 pDimData->AddGroupDimension( *pNewGroupDim );
2519 pNewGroupDim.reset(); // AddGroupDimension copies the object
2520 // don't access pGroupDimension after here
2521 }
2522 pGroupDimension = nullptr;
2523
2524 // set orientation
2525 ScDPSaveDimension* pSaveDimension = aSaveData.GetDimensionByName( aGroupDimName );
2526 if ( pSaveDimension->GetOrientation() == DataPilotFieldOrientation_HIDDEN )
2527 {
2528 ScDPSaveDimension* pOldDimension = aSaveData.GetDimensionByName( aDimName );
2529 pSaveDimension->SetOrientation( pOldDimension->GetOrientation() );
2530 aSaveData.SetPosition( pSaveDimension, 0 );
2531 }
2532
2533 // apply changes
2534 pDPObj->SetSaveData( aSaveData );
2536 }
2537
2538 // if new grouping field has been created (on first group), return it
2539 if( !sNewDim.isEmpty() )
2540 {
2541 Reference< XNameAccess > xFields(mxParent->getDataPilotFields(), UNO_QUERY);
2542 if (xFields.is())
2543 {
2544 try
2545 {
2546 xRet.set(xFields->getByName(sNewDim), UNO_QUERY);
2547 SAL_WARN_IF(!xRet.is(), "sc.ui", "there is a name, so there should be also a field");
2548 }
2549 catch (const container::NoSuchElementException&)
2550 {
2551 css::uno::Any anyEx = cppu::getCaughtException();
2552 SAL_WARN("sc.ui", "Cannot find field with that name: " + sNewDim + ".");
2553 // Avoid throwing exception that's not specified in the method signature.
2554 throw css::lang::WrappedTargetRuntimeException(
2555 "Cannot find field with name \"" + sNewDim + "\"",
2556 static_cast<cppu::OWeakObject*>(this), anyEx );
2557 }
2558 }
2559 }
2560 return xRet;
2561}
2562
2563Reference < XDataPilotField > SAL_CALL ScDataPilotFieldObj::createDateGroup( const DataPilotFieldGroupInfo& rInfo )
2564{
2565 SolarMutexGuard aGuard;
2566 using namespace ::com::sun::star::sheet::DataPilotFieldGroupBy;
2567
2568 if( !rInfo.HasDateValues )
2569 throw IllegalArgumentException("HasDateValues is not set", static_cast<cppu::OWeakObject*>(this), 0);
2570 if( !lclCheckMinMaxStep( rInfo ) )
2571 throw IllegalArgumentException("min/max/step", static_cast<cppu::OWeakObject*>(this), 0);
2572
2573 // only a single date flag is allowed
2574 if( (rInfo.GroupBy == 0) || (rInfo.GroupBy > YEARS) || ((rInfo.GroupBy & (rInfo.GroupBy - 1)) != 0) )
2575 throw IllegalArgumentException("Invalid GroupBy value: " + OUString::number(rInfo.GroupBy), static_cast<cppu::OWeakObject*>(this), 0);
2576
2577 // step must be zero, if something else than DAYS is specified
2578 if( rInfo.Step >= ((rInfo.GroupBy == DAYS) ? 32768.0 : 1.0) )
2579 throw IllegalArgumentException("Invalid step value: " + OUString::number(rInfo.Step), static_cast<cppu::OWeakObject*>(this), 0);
2580
2581 OUString aGroupDimName;
2582 ScDPObject* pDPObj = nullptr;
2583 if( ScDPSaveDimension* pDim = GetDPDimension( &pDPObj ) )
2584 {
2585 ScDPNumGroupInfo aInfo;
2586 aInfo.mbEnable = true;
2587 aInfo.mbDateValues = (rInfo.GroupBy == DAYS) && (rInfo.Step >= 1.0);
2588 aInfo.mbAutoStart = rInfo.HasAutoStart;
2589 aInfo.mbAutoEnd = rInfo.HasAutoEnd;
2590 aInfo.mfStart = rInfo.Start;
2591 aInfo.mfEnd = rInfo.End;
2592 aInfo.mfStep = std::trunc( rInfo.Step );
2593
2594 // create a local copy of the entire save data (will be written back below)
2595 ScDPSaveData aSaveData = *pDPObj->GetSaveData();
2596 // get or create dimension save data
2597 ScDPDimensionSaveData& rDimData = *aSaveData.GetDimensionData();
2598
2599 // find source dimension name
2600 const OUString& rDimName = pDim->GetName();
2601 const ScDPSaveGroupDimension* pGroupDim = rDimData.GetNamedGroupDim( rDimName );
2602 OUString aSrcDimName = pGroupDim ? pGroupDim->GetSourceDimName() : rDimName;
2603
2604 // find a group dimension for the base field, or get numeric grouping
2605 pGroupDim = rDimData.GetFirstNamedGroupDim( aSrcDimName );
2606 const ScDPSaveNumGroupDimension* pNumGroupDim = rDimData.GetNumGroupDim( aSrcDimName );
2607
2608 // do not group by dates, if named groups or numeric grouping is present
2609 bool bHasNamedGrouping = pGroupDim && !pGroupDim->GetDateInfo().mbEnable;
2610 bool bHasNumGrouping = pNumGroupDim && pNumGroupDim->GetInfo().mbEnable && !pNumGroupDim->GetInfo().mbDateValues && !pNumGroupDim->GetDateInfo().mbEnable;
2611 if( bHasNamedGrouping || bHasNumGrouping )
2612 throw IllegalArgumentException();
2613
2614 if( aInfo.mbDateValues ) // create day ranges grouping
2615 {
2616 // first remove all named group dimensions
2617 while( pGroupDim )
2618 {
2619 OUString aGroupDimName2 = pGroupDim->GetGroupDimName();
2620 // find next group dimension before deleting this group
2621 pGroupDim = rDimData.GetNextNamedGroupDim( aGroupDimName2 );
2622 // remove from dimension save data
2623 rDimData.RemoveGroupDimension( aGroupDimName2 );
2624 // also remove save data settings for the dimension that no longer exists
2625 aSaveData.RemoveDimensionByName( aGroupDimName2 );
2626 }
2627 // create or replace the number grouping dimension
2628 ScDPSaveNumGroupDimension aNumGroupDim( aSrcDimName, aInfo );
2629 rDimData.ReplaceNumGroupDimension( aNumGroupDim );
2630 }
2631 else // create date grouping
2632 {
2633 // collect all existing date flags
2634 sal_Int32 nDateParts = rDimData.CollectDateParts( aSrcDimName );
2635 if( nDateParts == 0 )
2636 {
2637 // insert numeric group dimension, if no date groups exist yet (or replace day range grouping)
2638 ScDPSaveNumGroupDimension aNumGroupDim( aSrcDimName, aInfo, rInfo.GroupBy );
2639 rDimData.ReplaceNumGroupDimension( aNumGroupDim );
2640 }
2641 else if( (nDateParts & rInfo.GroupBy) == 0 ) // do nothing if date field exists already
2642 {
2643 // create new named group dimension for additional date groups
2644 aGroupDimName = rDimData.CreateDateGroupDimName( rInfo.GroupBy, *pDPObj, true, nullptr );
2645 ScDPSaveGroupDimension aGroupDim( aSrcDimName, aGroupDimName, aInfo, rInfo.GroupBy );
2646 rDimData.AddGroupDimension( aGroupDim );
2647
2648 // set orientation of new named group dimension
2649 ScDPSaveDimension& rSaveDim = *aSaveData.GetDimensionByName( aGroupDimName );
2650 if( rSaveDim.GetOrientation() == DataPilotFieldOrientation_HIDDEN )
2651 {
2652 ScDPSaveDimension& rOldDim = *aSaveData.GetDimensionByName( aSrcDimName );
2653 rSaveDim.SetOrientation( rOldDim.GetOrientation() );
2654 aSaveData.SetPosition( &rSaveDim, 0 );
2655 }
2656 }
2657 }
2658
2659 // apply changes
2660 pDPObj->SetSaveData( aSaveData );
2662 }
2663
2664 // return the UNO object of the new dimension, after writing back saved data
2665 Reference< XDataPilotField > xRet;
2666 if( !aGroupDimName.isEmpty() )
2667 try
2668 {
2669 Reference< XNameAccess > xFields( mxParent->getDataPilotFields(), UNO_QUERY_THROW );
2670 xRet.set( xFields->getByName( aGroupDimName ), UNO_QUERY );
2671 }
2672 catch( Exception& )
2673 {
2674 }
2675 return xRet;
2676}
2677
2678namespace {
2679
2680bool lclExtractGroupMembers( ScFieldGroupMembers& rMembers, const Any& rElement )
2681{
2682 // allow empty value to create a new group
2683 if( !rElement.hasValue() )
2684 return true;
2685
2686 // try to extract a simple sequence of strings
2687 Sequence< OUString > aSeq;
2688 if( rElement >>= aSeq )
2689 {
2690 if( aSeq.hasElements() )
2691 rMembers.insert( rMembers.end(), std::cbegin(aSeq), std::cend(aSeq) );
2692 return true;
2693 }
2694
2695 // try to use XIndexAccess providing objects that support XNamed
2696 Reference< XIndexAccess > xItemsIA( rElement, UNO_QUERY );
2697 if( xItemsIA.is() )
2698 {
2699 for( sal_Int32 nIdx = 0, nCount = xItemsIA->getCount(); nIdx < nCount; ++nIdx )
2700 {
2701 try // getByIndex() should not throw, but we cannot be sure
2702 {
2703 Reference< XNamed > xItemName( xItemsIA->getByIndex( nIdx ), UNO_QUERY_THROW );
2704 rMembers.push_back( xItemName->getName() );
2705 }
2706 catch( Exception& )
2707 {
2708 // ignore exceptions, go ahead with next element in the array
2709 }
2710 }
2711 return true;
2712 }
2713
2714 // nothing valid inside the Any -> return false
2715 return false;
2716}
2717
2718} // namespace
2719
2721 maGroups( std::move(rGroups) )
2722{
2723}
2724
2726{
2727}
2728
2729// XNameAccess
2730
2731Any SAL_CALL ScDataPilotFieldGroupsObj::getByName( const OUString& rName )
2732{
2733 SolarMutexGuard aGuard;
2734 if( implFindByName( rName ) == maGroups.end() )
2735 throw NoSuchElementException();
2736 return Any( Reference< XNameAccess >( new ScDataPilotFieldGroupObj( *this, rName ) ) );
2737}
2738
2739Sequence< OUString > SAL_CALL ScDataPilotFieldGroupsObj::getElementNames()
2740{
2741 SolarMutexGuard aGuard;
2742 Sequence< OUString > aSeq;
2743 if( !maGroups.empty() )
2744 {
2745 aSeq.realloc( static_cast< sal_Int32 >( maGroups.size() ) );
2746 OUString* pName = aSeq.getArray();
2747 for( const auto& rGroup : maGroups )
2748 {
2749 *pName = rGroup.maName;
2750 ++pName;
2751 }
2752 }
2753 return aSeq;
2754}
2755
2756sal_Bool SAL_CALL ScDataPilotFieldGroupsObj::hasByName( const OUString& rName )
2757{
2758 SolarMutexGuard aGuard;
2759 return implFindByName( rName ) != maGroups.end();
2760}
2761
2762// XNameReplace
2763
2764void SAL_CALL ScDataPilotFieldGroupsObj::replaceByName( const OUString& rName, const Any& rElement )
2765{
2766 SolarMutexGuard aGuard;
2767
2768 if( rName.isEmpty() )
2769 throw IllegalArgumentException("Name is empty", static_cast<cppu::OWeakObject*>(this), 0);
2770
2771 ScFieldGroups::iterator aIt = implFindByName( rName );
2772 if( aIt == maGroups.end() )
2773 throw NoSuchElementException("Name \"" + rName + "\" not found", static_cast<cppu::OWeakObject*>(this));
2774
2775 // read all item names provided by the passed object
2776 ScFieldGroupMembers aMembers;
2777 if( !lclExtractGroupMembers( aMembers, rElement ) )
2778 throw IllegalArgumentException("Invalid element object", static_cast<cppu::OWeakObject*>(this), 0);
2779
2780 // copy and forget, faster than vector assignment
2781 aIt->maMembers.swap( aMembers );
2782}
2783
2784// XNameContainer
2785
2786void SAL_CALL ScDataPilotFieldGroupsObj::insertByName( const OUString& rName, const Any& rElement )
2787{
2788 SolarMutexGuard aGuard;
2789
2790 if( rName.isEmpty() )
2791 throw IllegalArgumentException("Name is empty", static_cast<cppu::OWeakObject*>(this), 0);
2792
2793 ScFieldGroups::iterator aIt = implFindByName( rName );
2794 if( aIt != maGroups.end() )
2795 throw ElementExistException("Name \"" + rName + "\" already exists", static_cast<cppu::OWeakObject*>(this));
2796
2797 // read all item names provided by the passed object
2798 ScFieldGroupMembers aMembers;
2799 if( !lclExtractGroupMembers( aMembers, rElement ) )
2800 throw IllegalArgumentException("Invalid element object", static_cast<cppu::OWeakObject*>(this), 0);
2801
2802 // create the new entry if no error has been occurred
2803 maGroups.emplace_back();
2804 ScFieldGroup& rGroup = maGroups.back();
2805 rGroup.maName = rName;
2806 rGroup.maMembers.swap( aMembers );
2807}
2808
2809void SAL_CALL ScDataPilotFieldGroupsObj::removeByName( const OUString& rName )
2810{
2811 SolarMutexGuard aGuard;
2812
2813 if( rName.isEmpty() )
2814 throw IllegalArgumentException("Name is empty", static_cast<cppu::OWeakObject*>(this), 0);
2815
2816 ScFieldGroups::iterator aIt = implFindByName( rName );
2817 if( aIt == maGroups.end() )
2818 throw NoSuchElementException("Name \"" + rName + "\" not found", static_cast<cppu::OWeakObject*>(this));
2819
2820 maGroups.erase( aIt );
2821}
2822
2823// XIndexAccess
2824
2826{
2827 SolarMutexGuard aGuard;
2828 return static_cast< sal_Int32 >( maGroups.size() );
2829}
2830
2831Any SAL_CALL ScDataPilotFieldGroupsObj::getByIndex( sal_Int32 nIndex )
2832{
2833 SolarMutexGuard aGuard;
2834 if ((nIndex < 0) || (o3tl::make_unsigned(nIndex) >= maGroups.size()))
2835 throw IndexOutOfBoundsException();
2836 return Any( Reference< XNameAccess >( new ScDataPilotFieldGroupObj( *this, maGroups[ nIndex ].maName ) ) );
2837}
2838
2839// XEnumerationAccess
2840
2841Reference<XEnumeration> SAL_CALL ScDataPilotFieldGroupsObj::createEnumeration()
2842{
2843 SolarMutexGuard aGuard;
2844 return new ScIndexEnumeration( this, "com.sun.star.sheet.DataPilotFieldGroupsEnumeration" );
2845}
2846
2847// XElementAccess
2848
2850{
2852}
2853
2855{
2856 SolarMutexGuard aGuard;
2857 return !maGroups.empty();
2858}
2859
2860// implementation
2861
2863{
2864 SolarMutexGuard aGuard;
2865 ScFieldGroups::iterator aIt = implFindByName( rName );
2866 if( aIt == maGroups.end() )
2867 throw RuntimeException("Field Group with name \"" + rName + "\" not found", static_cast<cppu::OWeakObject*>(this));
2868 return *aIt;
2869}
2870
2871void ScDataPilotFieldGroupsObj::renameFieldGroup( const OUString& rOldName, const OUString& rNewName )
2872{
2873 SolarMutexGuard aGuard;
2874 ScFieldGroups::iterator aOldIt = implFindByName( rOldName );
2875 ScFieldGroups::iterator aNewIt = implFindByName( rNewName );
2876 if( aOldIt == maGroups.end() )
2877 throw RuntimeException("Field Group with name \"" + rOldName + "\" not found", static_cast<cppu::OWeakObject*>(this));
2878 // new name must not exist yet
2879 if( (aNewIt != maGroups.end()) && (aNewIt != aOldIt) )
2880 throw RuntimeException("Field Group with name \"" + rOldName + "\" already exists", static_cast<cppu::OWeakObject*>(this));
2881 aOldIt->maName = rNewName;
2882}
2883
2884ScFieldGroups::iterator ScDataPilotFieldGroupsObj::implFindByName( const OUString& rName )
2885{
2886 return std::find_if(maGroups.begin(), maGroups.end(),
2887 [&rName](const ScFieldGroup& rGroup) { return rGroup.maName == rName; });
2888}
2889
2890namespace {
2891
2892OUString lclExtractMember( const Any& rElement )
2893{
2894 if( rElement.has< OUString >() )
2895 return rElement.get< OUString >();
2896
2897 Reference< XNamed > xNamed( rElement, UNO_QUERY );
2898 if( xNamed.is() )
2899 return xNamed->getName();
2900
2901 return OUString();
2902}
2903
2904} // namespace
2905
2907 mxParent( &rParent ),
2908 maGroupName(std::move( aGroupName ))
2909{
2910}
2911
2913{
2914}
2915
2916// XNameAccess
2917
2918Any SAL_CALL ScDataPilotFieldGroupObj::getByName( const OUString& rName )
2919{
2920 SolarMutexGuard aGuard;
2921 ScFieldGroupMembers& rMembers = mxParent->getFieldGroup( maGroupName ).maMembers;
2922 ScFieldGroupMembers::iterator aIt = ::std::find( rMembers.begin(), rMembers.end(), rName );
2923 if( aIt == rMembers.end() )
2924 throw NoSuchElementException("Name \"" + rName + "\" not found", static_cast<cppu::OWeakObject*>(this));
2925 return Any( Reference< XNamed >( new ScDataPilotFieldGroupItemObj( *this, *aIt ) ) );
2926}
2927
2928Sequence< OUString > SAL_CALL ScDataPilotFieldGroupObj::getElementNames()
2929{
2930 SolarMutexGuard aGuard;
2931 return ::comphelper::containerToSequence( mxParent->getFieldGroup( maGroupName ).maMembers );
2932}
2933
2934sal_Bool SAL_CALL ScDataPilotFieldGroupObj::hasByName( const OUString& rName )
2935{
2936 SolarMutexGuard aGuard;
2937 ScFieldGroupMembers& rMembers = mxParent->getFieldGroup( maGroupName ).maMembers;
2938 return ::std::find( rMembers.begin(), rMembers.end(), rName ) != rMembers.end();
2939}
2940
2941// XNameReplace
2942
2943void SAL_CALL ScDataPilotFieldGroupObj::replaceByName( const OUString& rName, const Any& rElement )
2944{
2945 SolarMutexGuard aGuard;
2946
2947 // it should be possible to quickly rename an item -> accept string or XNamed
2948 OUString aNewName = lclExtractMember( rElement );
2949 if( rName.isEmpty() || aNewName.isEmpty() )
2950 throw IllegalArgumentException("Name is empty", static_cast<cppu::OWeakObject*>(this), 0);
2951 if( rName == aNewName )
2952 return;
2953
2954 ScFieldGroupMembers& rMembers = mxParent->getFieldGroup( maGroupName ).maMembers;
2955 ScFieldGroupMembers::iterator aOldIt = ::std::find( rMembers.begin(), rMembers.end(), rName );
2956 ScFieldGroupMembers::iterator aNewIt = ::std::find( rMembers.begin(), rMembers.end(), aNewName );
2957 if( aOldIt == rMembers.end() )
2958 throw NoSuchElementException("Name \"" + rName + "\" not found", static_cast<cppu::OWeakObject*>(this));
2959 if( aNewIt != rMembers.end() )
2960 throw IllegalArgumentException("Name \"" + rName + "\" already exists", static_cast<cppu::OWeakObject*>(this), 0);
2961 *aOldIt = aNewName;
2962}
2963
2964// XNameContainer
2965
2966void SAL_CALL ScDataPilotFieldGroupObj::insertByName( const OUString& rName, const Any& /*rElement*/ )
2967{
2968 SolarMutexGuard aGuard;
2969
2970 // we will ignore the passed element and just try to insert the name
2971 if( rName.isEmpty() )
2972 throw IllegalArgumentException("Name is empty", static_cast<cppu::OWeakObject*>(this), 0);
2973
2974 ScFieldGroupMembers& rMembers = mxParent->getFieldGroup( maGroupName ).maMembers;
2975 ScFieldGroupMembers::iterator aIt = ::std::find( rMembers.begin(), rMembers.end(), rName );
2976 if( aIt != rMembers.end() )
2977 throw IllegalArgumentException("Name \"" + rName + "\" already exists", static_cast<cppu::OWeakObject*>(this), 0);
2978 rMembers.push_back( rName );
2979}
2980
2981void SAL_CALL ScDataPilotFieldGroupObj::removeByName( const OUString& rName )
2982{
2983 SolarMutexGuard aGuard;
2984
2985 if( rName.isEmpty() )
2986 throw IllegalArgumentException("Name is empty", static_cast<cppu::OWeakObject*>(this), 0);
2987 ScFieldGroupMembers& rMembers = mxParent->getFieldGroup( maGroupName ).maMembers;
2988 ScFieldGroupMembers::iterator aIt = ::std::find( rMembers.begin(), rMembers.end(), rName );
2989 if( aIt == rMembers.end() )
2990 throw NoSuchElementException("Name \"" + rName + "\" not found", static_cast<cppu::OWeakObject*>(this));
2991 rMembers.erase( aIt );
2992}
2993
2994// XIndexAccess
2995
2997{
2998 SolarMutexGuard aGuard;
2999 return static_cast< sal_Int32 >( mxParent->getFieldGroup( maGroupName ).maMembers.size() );
3000}
3001
3002Any SAL_CALL ScDataPilotFieldGroupObj::getByIndex( sal_Int32 nIndex )
3003{
3004 SolarMutexGuard aGuard;
3005 ScFieldGroupMembers& rMembers = mxParent->getFieldGroup( maGroupName ).maMembers;
3006 if ((nIndex < 0) || (o3tl::make_unsigned(nIndex) >= rMembers.size()))
3007 throw IndexOutOfBoundsException();
3008 return Any( Reference< XNamed >( new ScDataPilotFieldGroupItemObj( *this, rMembers[ nIndex ] ) ) );
3009}
3010
3011// XEnumerationAccess
3012
3013Reference< XEnumeration > SAL_CALL ScDataPilotFieldGroupObj::createEnumeration()
3014{
3015 SolarMutexGuard aGuard;
3016 return new ScIndexEnumeration( this, "com.sun.star.sheet.DataPilotFieldGroupEnumeration" );
3017}
3018
3019// XElementAccess
3020
3022{
3024}
3025
3027{
3028 SolarMutexGuard aGuard;
3029 return !mxParent->getFieldGroup( maGroupName ).maMembers.empty();
3030}
3031
3032// XNamed
3033
3035{
3036 SolarMutexGuard aGuard;
3037 return maGroupName;
3038}
3039
3040void SAL_CALL ScDataPilotFieldGroupObj::setName( const OUString& rName )
3041{
3042 SolarMutexGuard aGuard;
3043 mxParent->renameFieldGroup( maGroupName, rName );
3044 // if call to renameFieldGroup() did not throw, remember the new name
3045 maGroupName = rName;
3046}
3047
3049 mxParent( &rParent ),
3050 maName(std::move( aName ))
3051{
3052}
3053
3055{
3056}
3057
3058// XNamed
3059
3061{
3062 SolarMutexGuard aGuard;
3063 return maName;
3064}
3065
3066void SAL_CALL ScDataPilotFieldGroupItemObj::setName( const OUString& rName )
3067{
3068 SolarMutexGuard aGuard;
3069 mxParent->replaceByName( maName, Any( rName ) );
3070 // if call to replaceByName() did not throw, remember the new name
3071 maName = rName;
3072}
3073
3075 ScDataPilotChildObjBase( rParent, rFieldId )
3076{
3077}
3078
3080{
3081}
3082
3083// XDataPilotItems
3084
3086{
3087 return ((0 <= nIndex) && (nIndex < GetMemberCount())) ?
3088 new ScDataPilotItemObj( *mxParent, maFieldId, nIndex ) : nullptr;
3089}
3090
3091// XNameAccess
3092
3093Any SAL_CALL ScDataPilotItemsObj::getByName( const OUString& aName )
3094{
3095 SolarMutexGuard aGuard;
3096 Reference<XNameAccess> xMembers = GetMembers();
3097 if (xMembers.is())
3098 {
3099 Reference<XIndexAccess> xMembersIndex(new ScNameToIndexAccess( xMembers ));
3100 sal_Int32 nCount = xMembersIndex->getCount();
3101 sal_Int32 nItem = 0;
3102 while (nItem < nCount)
3103 {
3104 Reference<XNamed> xMember(xMembersIndex->getByIndex(nItem), UNO_QUERY);
3105 if (xMember.is() && (aName == xMember->getName()))
3106 {
3107 return Any( Reference< XPropertySet >( GetObjectByIndex_Impl( nItem ) ) );
3108 }
3109 ++nItem;
3110 }
3111 throw NoSuchElementException("Name \"" + aName + "\" not found", static_cast<cppu::OWeakObject*>(this));
3112 }
3113 return Any();
3114}
3115
3116Sequence<OUString> SAL_CALL ScDataPilotItemsObj::getElementNames()
3117{
3118 SolarMutexGuard aGuard;
3119 Sequence< OUString > aSeq;
3120 if( ScDPObject* pDPObj = GetDPObject() )
3121 pDPObj->GetMemberNames( lcl_GetObjectIndex( pDPObj, maFieldId ), aSeq );
3122 return aSeq;
3123}
3124
3125sal_Bool SAL_CALL ScDataPilotItemsObj::hasByName( const OUString& aName )
3126{
3127 SolarMutexGuard aGuard;
3128 bool bFound = false;
3129 Reference<XNameAccess> xMembers = GetMembers();
3130 if (xMembers.is())
3131 {
3132 Reference<XIndexAccess> xMembersIndex(new ScNameToIndexAccess( xMembers ));
3133 sal_Int32 nCount = xMembersIndex->getCount();
3134 sal_Int32 nItem = 0;
3135 while (nItem < nCount && !bFound )
3136 {
3137 Reference<XNamed> xMember(xMembersIndex->getByIndex(nItem), UNO_QUERY);
3138 if (xMember.is() && aName == xMember->getName())
3139 bFound = true;
3140 else
3141 nItem++;
3142 }
3143 }
3144 return bFound;
3145}
3146
3147// XEnumerationAccess
3148
3149Reference<XEnumeration> SAL_CALL ScDataPilotItemsObj::createEnumeration()
3150{
3151 SolarMutexGuard aGuard;
3152 return new ScIndexEnumeration(this, "com.sun.star.sheet.DataPilotItemsEnumeration");
3153}
3154
3155// XIndexAccess
3156
3158{
3159 SolarMutexGuard aGuard;
3160 return GetMemberCount();
3161}
3162
3163Any SAL_CALL ScDataPilotItemsObj::getByIndex( sal_Int32 nIndex )
3164{
3165 SolarMutexGuard aGuard;
3166 Reference< XPropertySet > xItem( GetObjectByIndex_Impl( nIndex ) );
3167 if (!xItem.is())
3168 throw IndexOutOfBoundsException();
3169 return Any( xItem );
3170}
3171
3173{
3175}
3176
3178{
3179 SolarMutexGuard aGuard;
3180 return ( getCount() != 0 );
3181}
3182
3184 ScDataPilotChildObjBase( rParent, rFieldId ),
3185 maPropSet( lcl_GetDataPilotItemMap() ),
3186 mnIndex( nIndex )
3187{
3188}
3189
3191{
3192}
3193
3194 // XNamed
3196{
3197 SolarMutexGuard aGuard;
3198 OUString sRet;
3199 Reference<XNameAccess> xMembers = GetMembers();
3200 if (xMembers.is())
3201 {
3202 Reference<XIndexAccess> xMembersIndex(new ScNameToIndexAccess( xMembers ));
3203 sal_Int32 nCount = xMembersIndex->getCount();
3204 if (mnIndex < nCount)
3205 {
3206 Reference<XNamed> xMember(xMembersIndex->getByIndex(mnIndex), UNO_QUERY);
3207 sRet = xMember->getName();
3208 }
3209 }
3210 return sRet;
3211}
3212
3213void SAL_CALL ScDataPilotItemObj::setName( const OUString& /* aName */ )
3214{
3215}
3216
3217 // XPropertySet
3218Reference< XPropertySetInfo >
3220{
3221 SolarMutexGuard aGuard;
3222 static Reference<XPropertySetInfo> aRef =
3224 return aRef;
3225}
3226
3227void SAL_CALL ScDataPilotItemObj::setPropertyValue( const OUString& aPropertyName, const Any& aValue )
3228{
3229 SolarMutexGuard aGuard;
3230 ScDPObject* pDPObj = nullptr;
3231 ScDPSaveDimension* pDim = GetDPDimension( &pDPObj );
3232 if(!pDim)
3233 return;
3234
3235 Reference<XNameAccess> xMembers = GetMembers();
3236 if( !xMembers.is() )
3237 return;
3238
3239 Reference<XIndexAccess> xMembersIndex( new ScNameToIndexAccess( xMembers ) );
3240 sal_Int32 nCount = xMembersIndex->getCount();
3241 if( mnIndex >= nCount )
3242 return;
3243
3244 Reference<XNamed> xMember(xMembersIndex->getByIndex(mnIndex), UNO_QUERY);
3245 OUString sName(xMember->getName());
3246 ScDPSaveMember* pMember = pDim->GetMemberByName(sName);
3247 if (!pMember)
3248 return;
3249
3250 bool bGetNewIndex = false;
3251 if ( aPropertyName == SC_UNONAME_SHOWDETAIL )
3252 pMember->SetShowDetails(cppu::any2bool(aValue));
3253 else if ( aPropertyName == SC_UNONAME_ISHIDDEN )
3254 pMember->SetIsVisible(!cppu::any2bool(aValue));
3255 else if ( aPropertyName == SC_UNONAME_POS )
3256 {
3257 sal_Int32 nNewPos = 0;
3258 if ( !( aValue >>= nNewPos ) || nNewPos < 0 || nNewPos >= nCount )
3259 throw IllegalArgumentException();
3260
3261 pDim->SetMemberPosition( sName, nNewPos );
3262 // get new effective index (depends on sorting mode, which isn't modified)
3263 bGetNewIndex = true;
3264
3265 }
3266 SetDPObject( pDPObj );
3267
3268 if ( bGetNewIndex ) // after SetDPObject, get the new index
3269 {
3270 Sequence< OUString > aItemNames = xMembers->getElementNames();
3271 sal_Int32 nItemCount = aItemNames.getLength();
3272 for (sal_Int32 nItem=0; nItem<nItemCount; ++nItem)
3273 if (aItemNames[nItem] == sName)
3274 mnIndex = nItem;
3275 }
3276}
3277
3278Any SAL_CALL ScDataPilotItemObj::getPropertyValue( const OUString& aPropertyName )
3279{
3280 SolarMutexGuard aGuard;
3281 Any aRet;
3282 if( ScDPSaveDimension* pDim = GetDPDimension() )
3283 {
3284 Reference< XNameAccess > xMembers = GetMembers();
3285 if( xMembers.is() )
3286 {
3287 Reference< XIndexAccess > xMembersIndex( new ScNameToIndexAccess( xMembers ) );
3288 sal_Int32 nCount = xMembersIndex->getCount();
3289 if( mnIndex < nCount )
3290 {
3291 Reference< XNamed > xMember( xMembersIndex->getByIndex( mnIndex ), UNO_QUERY );
3292 OUString sName( xMember->getName() );
3293 ScDPSaveMember* pMember = pDim->GetExistingMemberByName( sName );
3294 if ( aPropertyName == SC_UNONAME_SHOWDETAIL )
3295 {
3296 if (pMember && pMember->HasShowDetails())
3297 {
3298 aRet <<= pMember->GetShowDetails();
3299 }
3300 else
3301 {
3302 Reference< XPropertySet > xMemberProps( xMember, UNO_QUERY );
3303 if( xMemberProps.is() )
3304 aRet = xMemberProps->getPropertyValue( SC_UNO_DP_SHOWDETAILS );
3305 else
3306 aRet <<= true;
3307 }
3308 }
3309 else if ( aPropertyName == SC_UNONAME_ISHIDDEN )
3310 {
3311 if (pMember && pMember->HasIsVisible())
3312 {
3313 aRet <<= !pMember->GetIsVisible();
3314 }
3315 else
3316 {
3317 Reference< XPropertySet > xMemberProps( xMember, UNO_QUERY );
3318 if( xMemberProps.is() )
3319 aRet <<= !cppu::any2bool( xMemberProps->getPropertyValue( SC_UNO_DP_ISVISIBLE ) );
3320 else
3321 aRet <<= false;
3322 }
3323 }
3324 else if ( aPropertyName == SC_UNONAME_POS )
3325 {
3326 aRet <<= mnIndex;
3327 }
3328 }
3329 }
3330 }
3331 return aRet;
3332}
3333
3335 const OUString& /* aPropertyName */, const Reference< XPropertyChangeListener >& /* xListener */ )
3336{
3337}
3338
3340 const OUString& /* aPropertyName */, const Reference< XPropertyChangeListener >& /* aListener */ )
3341{
3342}
3343
3345 const OUString& /* PropertyName */, const Reference< XVetoableChangeListener >& /* aListener */ )
3346{
3347}
3348
3350 const OUString& /* PropertyName */, const Reference< XVetoableChangeListener >& /* aListener */ )
3351{
3352}
3353
3354/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
int mnIndex
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
WeakReference< XInterface > 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:2032
SC_DLLPUBLIC size_t GetCount() const
Definition: dpobject.cxx:3689
OUString CreateNewName() const
Create a new name that's not yet used by any existing data pilot objects.
Definition: dpobject.cxx:3715
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:995
bool GetDrillDown() const
Definition: dpsave.hxx:342
bool GetFilterButton() const
Definition: dpsave.hxx:338
bool GetIgnoreEmptyRows() const
Definition: dpsave.hxx:330
void SetPosition(ScDPSaveDimension *pDim, tools::Long nNew)
Definition: dpsave.cxx:957
ScDPSaveDimension * DuplicateDimension(std::u16string_view rName)
Definition: dpsave.cxx:887
bool GetRepeatIfEmpty() const
Definition: dpsave.hxx:334
SC_DLLPUBLIC const std::optional< OUString > & GetGrandTotalName() const
Definition: dpsave.cxx:772
bool GetRowGrand() const
Definition: dpsave.hxx:326
SC_DLLPUBLIC void SetRepeatIfEmpty(bool bSet)
Definition: dpsave.cxx:1000
SC_DLLPUBLIC void SetFilterButton(bool bSet)
Definition: dpsave.cxx:1005
void RemoveDimensionByName(const OUString &rName)
Definition: dpsave.cxx:900
bool GetColumnGrand() const
Definition: dpsave.hxx:322
SC_DLLPUBLIC void SetGrandTotalName(const OUString &rName)
Definition: dpsave.cxx:767
std::vector< std::unique_ptr< ScDPSaveDimension > > DimsType
Definition: dpsave.hxx:238
SC_DLLPUBLIC void SetRowGrand(bool bSet)
Definition: dpsave.cxx:990
SC_DLLPUBLIC void SetColumnGrand(bool bSet)
Definition: dpsave.cxx:985
const DimsType & GetDimensions() const
Definition: dpsave.hxx:270
const ScDPDimensionSaveData * GetExistingDimensionData() const
Definition: dpsave.hxx:348
SC_DLLPUBLIC ScDPDimensionSaveData * GetDimensionData()
Definition: dpsave.cxx:1197
SC_DLLPUBLIC void SetDimensionData(const ScDPDimensionSaveData *pNew)
Definition: dpsave.cxx:1204
SC_DLLPUBLIC ScDPSaveDimension * GetDimensionByName(const OUString &rName)
Get a dimension object by its name.
Definition: dpsave.cxx:836
SC_DLLPUBLIC void SetDrillDown(bool bSet)
Definition: dpsave.cxx:1010
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:304
ScDPSaveDimension * GetDPDimension(ScDPObject **ppDPObject=nullptr) const
Returns the DataPilot dimension object related to the field described by maFieldId.
Definition: dapiuno.cxx:1344
sal_Int32 GetMemberCount() const
Returns the number of members for the field described by maFieldId.
Definition: dapiuno.cxx:1379
ScDPObject * GetDPObject() const
Returns the wrapped DataPilot object (calls GetDPObject() at parent).
Definition: dapiuno.cxx:1334
css::uno::Reference< css::sheet::XMembersAccess > GetMembers() const
Returns the collection of members for the field described by maFieldId.
Definition: dapiuno.cxx:1391
rtl::Reference< ScDataPilotDescriptorBase > mxParent
Definition: dapiuno.hxx:325
ScDocShell * GetDocShell() const
Definition: dapiuno.cxx:1399
void SetDPObject(ScDPObject *pDPObject)
Sets the passed DataPilot object (calls SetDPObject() at parent).
Definition: dapiuno.cxx:1339
ScFieldIdentifier maFieldId
Definition: dapiuno.hxx:326
ScDataPilotChildObjBase(ScDataPilotDescriptorBase &rParent)
Definition: dapiuno.cxx:1319
virtual ~ScDataPilotChildObjBase()
Definition: dapiuno.cxx:1330
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:150
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:142
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 sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 > &aIdentifier) override
Definition: dapiuno.cxx:978
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
static SC_DLLPUBLIC const css::uno::Sequence< sal_Int8 > & getUnoTunnelId()
Definition: dapiuno.cxx:984
virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL getRowFields() override
Definition: dapiuno.cxx:658
SfxItemPropertySet maPropSet
Definition: dapiuno.hxx:141
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:1279
virtual OUString SAL_CALL getName() override
Definition: dapiuno.cxx:1295
virtual void SAL_CALL setName(const OUString &aName) override
Definition: dapiuno.cxx:1301
virtual OUString SAL_CALL getTag() override
Definition: dapiuno.cxx:1307
virtual void SAL_CALL setTag(const OUString &aTag) override
Definition: dapiuno.cxx:1313
virtual void SetDPObject(ScDPObject *pDPObj) override
Definition: dapiuno.cxx:1284
virtual ~ScDataPilotDescriptor() override
Definition: dapiuno.cxx:1275
ScDataPilotDescriptor(ScDocShell &rDocSh)
Definition: dapiuno.cxx:1260
std::unique_ptr< ScDPObject > mpDPObject
Definition: dapiuno.hxx:208
virtual ~ScDataPilotFieldGroupItemObj() override
Definition: dapiuno.cxx:3054
ScDataPilotFieldGroupItemObj(ScDataPilotFieldGroupObj &rParent, OUString aName)
Definition: dapiuno.cxx:3048
virtual OUString SAL_CALL getName() override
Definition: dapiuno.cxx:3060
virtual void SAL_CALL setName(const OUString &aName) override
Definition: dapiuno.cxx:3066
rtl::Reference< ScDataPilotFieldGroupObj > mxParent
Definition: dapiuno.hxx:630
virtual css::uno::Type SAL_CALL getElementType() override
Definition: dapiuno.cxx:3021
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 Index) override
Definition: dapiuno.cxx:3002
virtual ~ScDataPilotFieldGroupObj() override
Definition: dapiuno.cxx:2912
virtual void SAL_CALL removeByName(const OUString &Name) override
Definition: dapiuno.cxx:2981
rtl::Reference< ScDataPilotFieldGroupsObj > mxParent
Definition: dapiuno.hxx:603
virtual css::uno::Any SAL_CALL getByName(const OUString &aName) override
Definition: dapiuno.cxx:2918
virtual sal_Bool SAL_CALL hasElements() override
Definition: dapiuno.cxx:3026
virtual sal_Int32 SAL_CALL getCount() override
Definition: dapiuno.cxx:2996
virtual void SAL_CALL replaceByName(const OUString &aName, const css::uno::Any &aElement) override
Definition: dapiuno.cxx:2943
virtual sal_Bool SAL_CALL hasByName(const OUString &aName) override
Definition: dapiuno.cxx:2934
virtual void SAL_CALL setName(const OUString &aName) override
Definition: dapiuno.cxx:3040
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
Definition: dapiuno.cxx:2928
ScDataPilotFieldGroupObj(ScDataPilotFieldGroupsObj &rParent, OUString aGroupName)
Definition: dapiuno.cxx:2906
virtual OUString SAL_CALL getName() override
Definition: dapiuno.cxx:3034
virtual void SAL_CALL insertByName(const OUString &aName, const css::uno::Any &aElement) override
Definition: dapiuno.cxx:2966
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override
Definition: dapiuno.cxx:3013
Implementation of all grouped items in a DataPilot field.
Definition: dapiuno.hxx:502
virtual sal_Int32 SAL_CALL getCount() override
Definition: dapiuno.cxx:2825
virtual void SAL_CALL replaceByName(const OUString &aName, const css::uno::Any &aElement) override
Definition: dapiuno.cxx:2764
virtual void SAL_CALL insertByName(const OUString &aName, const css::uno::Any &aElement) override
Definition: dapiuno.cxx:2786
virtual ~ScDataPilotFieldGroupsObj() override
Definition: dapiuno.cxx:2725
void renameFieldGroup(const OUString &rOldName, const OUString &rNewName)
Definition: dapiuno.cxx:2871
ScFieldGroups::iterator implFindByName(const OUString &rName)
Definition: dapiuno.cxx:2884
virtual void SAL_CALL removeByName(const OUString &Name) override
Definition: dapiuno.cxx:2809
ScDataPilotFieldGroupsObj(ScFieldGroups &&rGroups)
Definition: dapiuno.cxx:2720
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 Index) override
Definition: dapiuno.cxx:2831
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override
Definition: dapiuno.cxx:2841
ScFieldGroup & getFieldGroup(const OUString &rName)
Definition: dapiuno.cxx:2862
virtual css::uno::Any SAL_CALL getByName(const OUString &aName) override
Definition: dapiuno.cxx:2731
ScFieldGroups maGroups
Definition: dapiuno.hxx:548
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
Definition: dapiuno.cxx:2739
virtual sal_Bool SAL_CALL hasByName(const OUString &aName) override
Definition: dapiuno.cxx:2756
virtual css::uno::Type SAL_CALL getElementType() override
Definition: dapiuno.cxx:2849
virtual sal_Bool SAL_CALL hasElements() override
Definition: dapiuno.cxx:2854
Implementation of a single DataPilot field.
Definition: dapiuno.hxx:396
void setSortInfo(const css::sheet::DataPilotFieldSortInfo *pInfo)
Definition: dapiuno.cxx:2186
void setLayoutInfo(const css::sheet::DataPilotFieldLayoutInfo *pInfo)
Definition: dapiuno.cxx:2150
css::uno::Any maOrient
Definition: dapiuno.hxx:473
css::sheet::DataPilotFieldGroupInfo getGroupInfo()
Definition: dapiuno.cxx:2243
void setAutoShowInfo(const css::sheet::DataPilotFieldAutoShowInfo *pInfo)
Definition: dapiuno.cxx:2132
virtual css::uno::Reference< css::sheet::XDataPilotField > SAL_CALL createDateGroup(const css::sheet::DataPilotFieldGroupInfo &rInfo) override
Definition: dapiuno.cxx:2563
css::sheet::DataPilotFieldOrientation getOrientation() const
Definition: dapiuno.cxx:1922
virtual void SAL_CALL setName(const OUString &aName) override
Definition: dapiuno.cxx:1671
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
Definition: dapiuno.cxx:1693
bool hasGroupInfo() const
Definition: dapiuno.cxx:2233
void setCurrentPage(const OUString &sPage)
Definition: dapiuno.cxx:2094
void setRepeatItemLabels(bool bShow)
Definition: dapiuno.cxx:2222
void setReference(const css::sheet::DataPilotFieldReference *pInfo)
Definition: dapiuno.cxx:2168
void setSubtotals(const std::vector< ScGeneralFunction > &rFunctions)
Definition: dapiuno.cxx:2052
sal_Int16 getFunction() const
Definition: dapiuno.cxx:1987
virtual css::uno::Reference< css::sheet::XDataPilotField > SAL_CALL createNameGroup(const css::uno::Sequence< OUString > &aItems) override
Definition: dapiuno.cxx:2395
void setOrientation(css::sheet::DataPilotFieldOrientation Orientation)
Definition: dapiuno.cxx:1929
SfxItemPropertySet maPropSet
Definition: dapiuno.hxx:472
const css::sheet::DataPilotFieldLayoutInfo * getLayoutInfo() const
Definition: dapiuno.cxx:2143
css::uno::Reference< css::container::XIndexAccess > mxItems
Definition: dapiuno.hxx:471
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
Definition: dapiuno.cxx:1819
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: dapiuno.cxx:1685
const css::sheet::DataPilotFieldReference * getReference() const
Definition: dapiuno.cxx:2161
void setGroupInfo(const css::sheet::DataPilotFieldGroupInfo *pInfo)
Definition: dapiuno.cxx:2302
bool getRepeatItemLabels() const
Definition: dapiuno.cxx:2215
void setShowEmpty(bool bShow)
Definition: dapiuno.cxx:2204
void setFunction(ScGeneralFunction Function)
Definition: dapiuno.cxx:2007
virtual OUString SAL_CALL getName() override
Definition: dapiuno.cxx:1651
const css::sheet::DataPilotFieldAutoShowInfo * getAutoShowInfo() const
Definition: dapiuno.cxx:2125
bool getShowEmpty() const
Definition: dapiuno.cxx:2197
ScDataPilotFieldObj(ScDataPilotDescriptorBase &rParent, const ScFieldIdentifier &rIdent)
Definition: dapiuno.cxx:1630
const css::sheet::DataPilotFieldSortInfo * getSortInfo() const
Definition: dapiuno.cxx:2179
virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL getItems() override
Definition: dapiuno.cxx:1912
void setUseCurrentPage(bool bUse)
Definition: dapiuno.cxx:2105
virtual ~ScDataPilotFieldObj() override
Definition: dapiuno.cxx:1645
css::uno::Sequence< sal_Int16 > getSubtotals() const
Definition: dapiuno.cxx:2030
Collection of all DataPilot fields, or of all fields from a specific dimension.
Definition: dapiuno.hxx:343
virtual sal_Bool SAL_CALL hasElements() override
Definition: dapiuno.cxx:1584
virtual ~ScDataPilotFieldsObj() override
Definition: dapiuno.cxx:1415
rtl::Reference< ScDataPilotFieldObj > GetObjectByName_Impl(const OUString &rName) const
Definition: dapiuno.cxx:1540
ScDataPilotFieldsObj(ScDataPilotDescriptorBase &rParent)
Definition: dapiuno.cxx:1404
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 Index) override
Definition: dapiuno.cxx:1568
virtual sal_Int32 SAL_CALL getCount() override
Definition: dapiuno.cxx:1561
virtual sal_Bool SAL_CALL hasByName(const OUString &aName) override
Definition: dapiuno.cxx:1623
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override
Definition: dapiuno.cxx:1553
virtual css::uno::Any SAL_CALL getByName(const OUString &aName) override
Definition: dapiuno.cxx:1592
css::uno::Any maOrient
Definition: dapiuno.hxx:381
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
Definition: dapiuno.cxx:1601
rtl::Reference< ScDataPilotFieldObj > GetObjectByIndex_Impl(sal_Int32 nIndex) const
Definition: dapiuno.cxx:1529
virtual css::uno::Type SAL_CALL getElementType() override
Definition: dapiuno.cxx:1579
virtual void SAL_CALL removeVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: dapiuno.cxx:3349
virtual void SAL_CALL removePropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &aListener) override
Definition: dapiuno.cxx:3339
virtual ~ScDataPilotItemObj() override
Definition: dapiuno.cxx:3190
virtual OUString SAL_CALL getName() override
Definition: dapiuno.cxx:3195
SfxItemPropertySet maPropSet
Definition: dapiuno.hxx:719
virtual void SAL_CALL addPropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
Definition: dapiuno.cxx:3334
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: dapiuno.cxx:3219
virtual void SAL_CALL addVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: dapiuno.cxx:3344
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
Definition: dapiuno.cxx:3278
virtual void SAL_CALL setName(const OUString &aName) override
Definition: dapiuno.cxx:3213
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
Definition: dapiuno.cxx:3227
sal_Int32 mnIndex
Definition: dapiuno.hxx:720
ScDataPilotItemObj(ScDataPilotDescriptorBase &rParent, const ScFieldIdentifier &rFieldId, sal_Int32 nIndex)
Definition: dapiuno.cxx:3183
virtual css::uno::Any SAL_CALL getByName(const OUString &aName) override
Definition: dapiuno.cxx:3093
virtual ~ScDataPilotItemsObj() override
Definition: dapiuno.cxx:3079
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override
Definition: dapiuno.cxx:3149
ScDataPilotItemsObj(ScDataPilotDescriptorBase &rParent, const ScFieldIdentifier &rFieldId)
Definition: dapiuno.cxx:3074
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 Index) override
Definition: dapiuno.cxx:3163
virtual sal_Bool SAL_CALL hasByName(const OUString &aName) override
Definition: dapiuno.cxx:3125
ScDataPilotItemObj * GetObjectByIndex_Impl(sal_Int32 nIndex) const
Definition: dapiuno.cxx:3085
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
Definition: dapiuno.cxx:3116
virtual sal_Int32 SAL_CALL getCount() override
Definition: dapiuno.cxx:3157
virtual sal_Bool SAL_CALL hasElements() override
Definition: dapiuno.cxx:3177
virtual css::uno::Type SAL_CALL getElementType() override
Definition: dapiuno.cxx:3172
virtual void SAL_CALL addModifyListener(const css::uno::Reference< css::util::XModifyListener > &aListener) override
Definition: dapiuno.cxx:1190
virtual ScDPObject * GetDPObject() const override
Definition: dapiuno.cxx:1039
XModifyListenerArr_Impl aModifyListeners
Definition: dapiuno.hxx:236
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
Definition: dapiuno.cxx:1023
virtual void SAL_CALL insertDrillDownSheet(const css::table::CellAddress &aAddr) override
Definition: dapiuno.cxx:1160
virtual css::sheet::DataPilotTablePositionData SAL_CALL getPositionData(const css::table::CellAddress &aAddr) override
Definition: dapiuno.cxx:1147
virtual css::table::CellRangeAddress SAL_CALL getOutputRangeByType(sal_Int32 nType) override
Definition: dapiuno.cxx:1176
virtual void SetDPObject(ScDPObject *pDPObj) override
Definition: dapiuno.cxx:1044
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
Definition: dapiuno.cxx:1002
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
Definition: dapiuno.cxx:1034
virtual void SAL_CALL release() noexcept override
Definition: dapiuno.cxx:1018
virtual ~ScDataPilotTableObj() override
Definition: dapiuno.cxx:998
virtual void SAL_CALL setTag(const OUString &aTag) override
Definition: dapiuno.cxx:1091
virtual OUString SAL_CALL getTag() override
Definition: dapiuno.cxx:1082
virtual OUString SAL_CALL getName() override
Definition: dapiuno.cxx:1057
virtual void SAL_CALL setName(const OUString &aName) override
Definition: dapiuno.cxx:1066
virtual void SAL_CALL acquire() noexcept override
Definition: dapiuno.cxx:1013
virtual void SAL_CALL refresh() override
Definition: dapiuno.cxx:1123
virtual void SAL_CALL removeModifyListener(const css::uno::Reference< css::util::XModifyListener > &aListener) override
Definition: dapiuno.cxx:1202
virtual css::uno::Sequence< css::uno::Sequence< css::uno::Any > > SAL_CALL getDrillDownData(const css::table::CellAddress &aAddr) override
Definition: dapiuno.cxx:1134
virtual css::table::CellRangeAddress SAL_CALL getOutputRange() override
Definition: dapiuno.cxx:1106
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: dapiuno.cxx:1226
ScDataPilotTableObj(ScDocShell &rDocSh, SCTAB nT, OUString aN)
Definition: dapiuno.cxx:990
DataPilotTables collection per sheet.
Definition: dapiuno.hxx:85
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:87
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 Index) override
Definition: dapiuno.cxx:490
void SetDocumentModified()
Definition: docsh.cxx:2961
const ScDocument & GetDocument() const
Definition: docsh.hxx:220
ScTabViewShell * GetBestViewShell(bool bOnlyVisible=true)
Definition: docsh4.cxx:2608
void AddUnoObject(SfxListener &rObject)
Definition: documen3.cxx:907
void AddUnoListenerCall(const css::uno::Reference< css::util::XModifyListener > &rListener, const css::lang::EventObject &rEvent)
Definition: documen3.cxx:986
void RemoveUnoObject(SfxListener &rObject)
Definition: documen3.cxx:915
SC_DLLPUBLIC ScDPCollection * GetDPCollection()
Definition: documen3.cxx:371
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:82
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
const css::uno::Sequence< sal_Int8 > & getSeq() 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:1513
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:1445
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:1419
::std::vector< ScFieldGroup > ScFieldGroups
Definition: dapiuno.hxx:484
::std::vector< OUString > ScFieldGroupMembers
Definition: dapiuno.hxx:476
PivotFunc
Definition: dpglobal.hxx:24
sal_Int16 nValue
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:420
@ ScDbTable
Definition: global.hxx:419
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
const char * sName
@ 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)
sal_Int64 getSomethingImpl(const css::uno::Sequence< sal_Int8 > &rId, T *pThis, FallbackToGetSomethingOf< Base >={})
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:481
OUString maName
Definition: dapiuno.hxx:480
bool mbDataLayout
Field index (if several fields with same name exist).
Definition: dapiuno.hxx:292
OUString maFieldName
Definition: dapiuno.hxx:290
sal_Int32 mnFieldIdx
Source field name.
Definition: dapiuno.hxx:291
OUString aStatement
Definition: global.hxx:446
sal_uInt8 nType
Definition: global.hxx:449
OUString aDBName
Definition: global.hxx:445
bool bNative
Definition: global.hxx:447
bool bImport
Definition: global.hxx:444
css::sheet::DataImportMode nType
Definition: dpsdbtab.hxx:37
OUString aObject
Definition: dpsdbtab.hxx:36
OUString aDBName
Definition: dpsdbtab.hxx:35
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
#define SC_UNONAME_USESELPAGE
Definition: unonames.hxx:260
#define SC_UNO_DP_USERNAME
Definition: unonames.hxx:640
#define SC_UNONAME_LAYOUTINFO
Definition: unonames.hxx:268
#define SC_UNO_DP_IGNORE_EMPTYROWS
Definition: unonames.hxx:630
#define SC_UNO_DP_COLGRAND
Definition: unonames.hxx:594
#define SC_UNONAME_AUTOSHOW
Definition: unonames.hxx:264
#define SC_UNONAME_SORTINFO
Definition: unonames.hxx:266
#define SC_UNO_DP_SERVICEARG
Definition: unonames.hxx:635
#define SC_UNONAME_REPEATITEMLABELS
Definition: unonames.hxx:272
#define SC_UNONAME_HASREFERENCE
Definition: unonames.hxx:261
#define SC_UNONAME_SHOWDETAIL
Definition: unonames.hxx:275
#define SC_UNONAME_POS
Definition: unonames.hxx:160
#define SC_UNONAME_SHOWEMPTY
Definition: unonames.hxx:271
#define SC_UNO_DP_ORIGINAL
Definition: unonames.hxx:596
#define SC_UNONAME_ISGROUP
Definition: unonames.hxx:269
#define SC_UNO_DP_GRANDTOTAL_NAME
Definition: unonames.hxx:620
#define SC_UNO_DP_IMPORTDESC
Definition: unonames.hxx:633
#define SC_UNO_DP_SOURCENAME
Definition: unonames.hxx:638
#define SC_UNONAME_HASAUTOSHOW
Definition: unonames.hxx:263
#define SC_UNONAME_FUNCTION2
Definition: unonames.hxx:256
#define SC_UNONAME_ORIENT
Definition: unonames.hxx:304
#define SC_UNONAME_NAME
Definition: unonames.hxx:232
#define SC_UNO_DP_PASSWORD
Definition: unonames.hxx:641
#define SC_UNONAME_SUBTOTALS
Definition: unonames.hxx:257
#define SC_UNO_DP_DRILLDOWN
Definition: unonames.hxx:631
#define SC_UNO_DP_SHOWDETAILS
Definition: unonames.hxx:610
#define SC_UNO_DP_SHOWFILTER
Definition: unonames.hxx:632
#define SC_UNO_DP_ISVISIBLE
Definition: unonames.hxx:609
#define SC_UNO_DP_ROWGRAND
Definition: unonames.hxx:595
#define SC_UNONAME_SUBTOTALS2
Definition: unonames.hxx:258
#define SC_UNONAME_GROUPINFO
Definition: unonames.hxx:270
#define SC_UNO_DP_REPEATEMPTY
Definition: unonames.hxx:612
#define SC_UNO_DP_ORIENTATION
Definition: unonames.hxx:599
#define SC_UNONAME_HASLAYOUTINFO
Definition: unonames.hxx:267
#define SC_UNONAME_ISHIDDEN
Definition: unonames.hxx:276
#define SC_UNONAME_HASSORTINFO
Definition: unonames.hxx:265
#define SC_UNO_DP_ISDATALAYOUT
Definition: unonames.hxx:598
#define SC_UNONAME_SELPAGE
Definition: unonames.hxx:259
#define SC_UNO_DP_OBJECTNAME
Definition: unonames.hxx:639
#define SC_UNONAME_REFERENCE
Definition: unonames.hxx:262
#define SC_UNONAME_FUNCTION
Definition: unonames.hxx:255
#define SC_UNO_DP_SOURCESERVICE
Definition: unonames.hxx:634