39 #include <unonames.hxx>
43 #include <globstr.hrc>
47 #include <com/sun/star/container/XNameAccess.hpp>
48 #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
49 #include <com/sun/star/lang/IllegalArgumentException.hpp>
50 #include <com/sun/star/lang/NullPointerException.hpp>
51 #include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
52 #include <com/sun/star/sheet/XDimensionsSupplier.hpp>
53 #include <com/sun/star/sheet/XLevelsSupplier.hpp>
54 #include <com/sun/star/sheet/XMembersAccess.hpp>
55 #include <com/sun/star/beans/PropertyAttribute.hpp>
56 #include <com/sun/star/sheet/DataImportMode.hpp>
57 #include <com/sun/star/sheet/DataPilotFieldGroupBy.hpp>
58 #include <com/sun/star/sheet/DataPilotFieldFilter.hpp>
59 #include <com/sun/star/sheet/DataPilotOutputRangeType.hpp>
60 #include <com/sun/star/sheet/DataPilotTablePositionData.hpp>
61 #include <com/sun/star/sheet/GeneralFunction2.hpp>
72 using ::com::sun::star::uno::Any;
73 using ::com::sun::star::uno::Exception;
74 using ::com::sun::star::uno::Reference;
75 using ::com::sun::star::uno::RuntimeException;
76 using ::com::sun::star::uno::Sequence;
77 using ::com::sun::star::uno::UNO_QUERY;
78 using ::com::sun::star::uno::UNO_QUERY_THROW;
80 using ::com::sun::star::container::ElementExistException;
81 using ::com::sun::star::container::NoSuchElementException;
82 using ::com::sun::star::container::XEnumeration;
83 using ::com::sun::star::container::XIndexAccess;
84 using ::com::sun::star::container::XNameAccess;
85 using ::com::sun::star::container::XNamed;
87 using ::com::sun::star::beans::UnknownPropertyException;
88 using ::com::sun::star::beans::XPropertyChangeListener;
89 using ::com::sun::star::beans::XPropertySet;
90 using ::com::sun::star::beans::XPropertySetInfo;
91 using ::com::sun::star::beans::XVetoableChangeListener;
93 using ::com::sun::star::lang::IllegalArgumentException;
94 using ::com::sun::star::lang::IndexOutOfBoundsException;
95 using ::com::sun::star::lang::NullPointerException;
97 using ::com::sun::star::table::CellAddress;
98 using ::com::sun::star::table::CellRangeAddress;
116 {
u"", 0, css::uno::Type(), 0, 0 }
118 return aDataPilotDescriptorBaseMap_Impl;
123 using namespace ::com::sun::star::beans::PropertyAttribute;
145 {
u"", 0, css::uno::Type(), 0, 0 }
147 return aDataPilotFieldMap_Impl;
157 {
u"", 0, css::uno::Type(), 0, 0 }
159 return aDataPilotItemMap_Impl;
162 bool lclCheckValidDouble(
double fValue,
bool bAuto )
164 return bAuto || std::isfinite( fValue );
167 bool lclCheckMinMaxStep(
const DataPilotFieldGroupInfo& rInfo )
170 lclCheckValidDouble( rInfo.Start, rInfo.HasAutoStart ) &&
171 lclCheckValidDouble( rInfo.End, rInfo.HasAutoEnd ) &&
172 (rInfo.HasAutoStart || rInfo.HasAutoEnd || (rInfo.Start <= rInfo.End)) &&
173 lclCheckValidDouble( rInfo.Step,
false ) &&
192 #define SC_DATALAYOUT_NAME "Data"
242 rInfo.Start = rGroupInfo.
mfStart;
244 rInfo.End = rGroupInfo.
mfEnd;
245 rInfo.Step = rGroupInfo.
mfStep;
257 for (
size_t i=0;
i<nCount; ++
i)
287 for ( sal_Int32 nDim = 0; nDim < nCount; ++nDim )
289 bool bIsDataLayout =
false;
290 OUString aDimName( pDPObj->
GetDimName( nDim, bIsDataLayout ) );
317 if ( rHint.
GetId() == SfxHintId::Dying )
334 sal_Int32 nFound = 0;
336 for (
size_t i=0;
i<nCount; ++
i)
341 if ( nFound == nIndex )
373 Reference< XNamed > xOriginal( aAny, UNO_QUERY );
374 return xOriginal.is();
384 Reference< XNamed > xOriginal;
387 if ( xDimProps.is() )
399 if ( !xOriginal.is() )
402 return xOriginal->getName();
406 const CellAddress& aOutputAddress,
407 const Reference<XDataPilotDescriptor>& xDescriptor )
410 if (!xDescriptor.is())
return;
412 if ( !aNewName.isEmpty() &&
hasByName( aNewName ) )
413 throw IllegalArgumentException(
"Name \"" + aNewName +
"\" already exists", static_cast<cppu::OWeakObject*>(
this), 0);
416 throw RuntimeException(
"DocShell is null", static_cast<cppu::OWeakObject*>(
this));
418 auto pImp = comphelper::getUnoTunnelImplementation<ScDataPilotDescriptorBase>( xDescriptor );
420 throw RuntimeException(
"Failed to get ScDataPilotDescriptor", static_cast<cppu::OWeakObject*>(
this));
424 throw RuntimeException(
"Failed to get DPObject", static_cast<cppu::OWeakObject*>(
this));
426 ScRange aOutputRange(static_cast<SCCOL>(aOutputAddress.Column), static_cast<SCROW>(aOutputAddress.Row), static_cast<SCTAB>(aOutputAddress.Sheet),
427 static_cast<SCCOL>(aOutputAddress.Column), static_cast<SCROW>(aOutputAddress.Row), static_cast<SCTAB>(aOutputAddress.Sheet));
429 OUString
aName = aNewName;
433 OUString aTag = xDescriptor->getTag();
440 throw RuntimeException(
"Failed to create pivot table", static_cast<cppu::OWeakObject*>(
this));
476 sal_uInt16 nFound = 0;
478 for (
size_t i=0;
i<nCount; ++
i)
496 throw IndexOutOfBoundsException();
497 return Any( xTable );
519 throw NoSuchElementException();
520 return Any( xTable );
534 sal_uInt16 nFound = 0;
537 for (i=0; i<nCount; ++i)
546 OUString* pAry = aSeq.getArray();
547 for (i=0; i<nCount; ++i)
551 pAry[nPos++] = rDPObj.
GetName();
570 for (
size_t i=0;
i<nCount; ++
i)
583 maPropSet( lcl_GetDataPilotDescriptorBaseMap() ),
601 if ( rHint.
GetId() == SfxHintId::Dying )
615 throw RuntimeException(
"Failed to get DPObject", static_cast<cppu::OWeakObject*>(
this));
617 CellRangeAddress aRet;
629 throw RuntimeException(
"Failed to get DPObject", static_cast<cppu::OWeakObject*>(
this));
637 aSheetDesc.SetSourceRange(aRange);
651 return new ScDataPilotFieldsObj( *
this );
657 return new ScDataPilotFieldsObj( *
this, DataPilotFieldOrientation_COLUMN );
663 return new ScDataPilotFieldsObj( *
this, DataPilotFieldOrientation_ROW );
669 return new ScDataPilotFieldsObj( *
this, DataPilotFieldOrientation_PAGE );
675 return new ScDataPilotFieldsObj( *
this, DataPilotFieldOrientation_DATA );
681 return new ScDataPilotFieldsObj( *
this, DataPilotFieldOrientation_HIDDEN );
688 static Reference<XPropertySetInfo> aRef =
701 OSL_ENSURE(pOldData,
"Here should be a SaveData");
733 if ( aValue >>= aStrVal )
738 uno::Sequence<beans::PropertyValue> aArgSeq;
739 if ( aValue >>= aArgSeq )
745 aImportDesc = *pOldDesc;
750 sheet::DataImportMode nNewType = sheet::DataImportMode_NONE;
754 nNewType = sheet::DataImportMode_SQL;
756 nNewType = sheet::DataImportMode_QUERY;
758 nNewType = sheet::DataImportMode_TABLE;
760 aImportDesc.nType = nNewType;
761 aImportDesc.aDBName = aParam.
aDBName;
763 aImportDesc.bNative = aParam.
bNative;
771 if ( aValue >>= aStrVal )
777 aServiceDesc = *pOldDesc;
786 uno::Sequence<beans::PropertyValue> aArgSeq;
787 if ( aValue >>= aArgSeq )
793 aServiceDesc = *pOldDesc;
796 for (
const beans::PropertyValue& rProp : std::as_const(aArgSeq))
798 OUString aPropName(rProp.Name);
802 if ( rProp.Value >>= aStrVal )
807 if ( rProp.Value >>= aStrVal )
812 if ( rProp.Value >>= aStrVal )
817 if ( rProp.Value >>= aStrVal )
826 throw UnknownPropertyException(aPropertyName);
843 OSL_ENSURE(pOldData,
"Here should be a SaveData");
876 aRet <<= *pGrandTotalName;
885 aParam.
bImport = ( pImportDesc->
nType != sheet::DataImportMode_NONE );
889 aParam.
bSql = ( pImportDesc->
nType == sheet::DataImportMode_SQL );
899 uno::Sequence<beans::PropertyValue> aEmpty(0);
905 OUString aServiceName;
909 aRet <<= aServiceName;
927 uno::Sequence<beans::PropertyValue> aEmpty;
932 throw UnknownPropertyException(aPropertyName);
940 const OUString& ,
const Reference<XPropertyChangeListener >& )
945 const OUString& ,
const Reference<XPropertyChangeListener >& )
950 const OUString& ,
const Reference<XVetoableChangeListener >& )
955 const OUString& ,
const Reference<XVetoableChangeListener >& )
966 if(
ScDPSaveData* pSaveData = pDPObject->GetSaveData() )
968 if( pSaveData->GetDataLayoutDimension() )
971 return new ScDataPilotFieldObj( *
this, aFieldId );
981 const Sequence<sal_Int8 >& rId )
983 if ( isUnoTunnelId<ScDataPilotDescriptorBase>(rId) )
985 return sal::static_int_cast<sal_Int64>(
reinterpret_cast<sal_IntPtr
>(
this));
992 class theScDataPilotDescriptorBaseUnoTunnelId :
public rtl::Static< UnoTunnelIdInit, theScDataPilotDescriptorBaseUnoTunnelId> {};
997 return theScDataPilotDescriptorBaseUnoTunnelId::get().getSeq();
1004 aModifyListeners( 0 )
1020 return ScDataPilotDescriptorBase::queryInterface( rType );
1025 ScDataPilotDescriptorBase::acquire();
1030 ScDataPilotDescriptorBase::release();
1036 ScDataPilotDescriptorBase::getTypes(),
1037 Sequence< uno::Type >
1046 return css::uno::Sequence<sal_Int8>();
1058 if ( pDPObj && pDocSh )
1107 pDPObj->
SetTag( aNewTag );
1119 CellRangeAddress aRet;
1125 aRet.StartColumn = aRange.aStart.Col();
1126 aRet.StartRow = aRange.aStart.Row();
1127 aRet.EndColumn = aRange.aEnd.Col();
1128 aRet.EndRow = aRange.aEnd.Row();
1147 Sequence< Sequence<Any> > aTabData;
1148 ScAddress aAddr2(static_cast<SCCOL>(aAddr.Column), static_cast<SCROW>(aAddr.Row), aAddr.Sheet);
1151 throw RuntimeException(
"Failed to get DPObject", static_cast<cppu::OWeakObject*>(
this));
1160 DataPilotTablePositionData aPosData;
1161 ScAddress aAddr2(static_cast<SCCOL>(aAddr.Column), static_cast<SCROW>(aAddr.Row), aAddr.Sheet);
1164 throw RuntimeException(
"Failed to get DPObject", static_cast<cppu::OWeakObject*>(
this));
1175 throw RuntimeException(
"Failed to get DPObject", static_cast<cppu::OWeakObject*>(
this));
1178 throw RuntimeException(
"Failed to get ViewShell", static_cast<cppu::OWeakObject*>(
this));
1180 Sequence<DataPilotFieldFilter> aFilters;
1182 ScAddress(static_cast<SCCOL>(aAddr.Column), static_cast<SCROW>(aAddr.Row), aAddr.Sheet), aFilters);
1189 if (nType < 0 || nType > DataPilotOutputRangeType::RESULT)
1190 throw IllegalArgumentException(
"nType must be between 0 and " +
1191 OUString::number(DataPilotOutputRangeType::RESULT) +
", got " + OUString::number(nType),
1192 static_cast<cppu::OWeakObject*>(
this), 0);
1194 CellRangeAddress aRet;
1219 for ( sal_uInt16
n=nCount;
n--; )
1222 if ( rObj == aListener )
1238 if (
auto pDataPilotHint = dynamic_cast<const ScDataPilotModifiedHint*>(&rHint) )
1240 if (pDataPilotHint->GetName() ==
aName)
1243 else if (
auto pRefHint = dynamic_cast<const ScUpdateRefHint*>(&rHint) )
1248 pRefHint->GetDx(), pRefHint->GetDy(), pRefHint->GetDz() ) &&
1249 aRanges.
size() == 1 )
1260 lang::EventObject
aEvent;
1261 aEvent.Source.set(static_cast<cppu::OWeakObject*>(
this));
1266 for (
const uno::Reference<util::XModifyListener> & xModifyListener :
aModifyListeners)
1272 mpDPObject(new
ScDPObject(pDocSh ? &pDocSh->GetDocument() : nullptr) )
1299 OSL_FAIL(
"replace DPObject should not happen");
1336 maFieldId( rFieldId )
1351 mxParent->SetDPObject( pDPObject );
1358 if( ppDPObject ) *ppDPObject = pDPObj;
1362 return pSaveData->GetDataLayoutDimension();
1370 sal_Int32 nFoundIdx = 0;
1371 for (
auto const& it : rDims)
1373 if (it->IsDataLayout())
1393 if (xMembersNA.is())
1396 nRet = xMembersIA->getCount();
1403 Reference< XMembersAccess > xMembersNA;
1429 static sal_Int32
lcl_GetFieldCount(
const Reference<XDimensionsSupplier>& rSource,
const Any& rOrient )
1432 throw NullPointerException();
1438 sal_Int32 nIntCount = xIntDims->getCount();
1439 for (sal_Int32
i = 0;
i < nIntCount; ++
i)
1442 const bool bMatch = xDim
1443 && (rOrient.hasValue()
1459 throw NullPointerException();
1463 sal_Int32 nDimIndex = 0;
1467 sal_Int32 nIntCount = xIntDims->getCount();
1469 for (sal_Int32
i = 0;
i < nIntCount; ++
i)
1471 xDim.set(xIntDims->getByIndex(
i), UNO_QUERY);
1472 const bool bMatch = xDim
1473 && (rOrient.hasValue()
1491 xDim.set( xIntDims->getByIndex(nDimIndex), UNO_QUERY );
1492 Reference<XNamed> xDimName( xDim, UNO_QUERY );
1493 if ( xDimName.is() )
1500 sal_Int32 nRepeat = 0;
1506 Reference<XNamed> xPrevName;
1507 for (sal_Int32
i = 0;
i < nDimIndex; ++
i)
1509 xPrevName.set( xIntDims->getByIndex(
i), UNO_QUERY );
1566 return new ScIndexEnumeration(
this,
"com.sun.star.sheet.DataPilotFieldsEnumeration");
1583 throw IndexOutOfBoundsException();
1584 return Any( xField );
1608 throw NoSuchElementException();
1609 return Any( xField );
1618 OUString* pAry = aSeq.getArray();
1621 for (
auto const& it : rDimensions)
1623 if(
maOrient.hasValue() && (it->GetOrientation() ==
maOrient.get< DataPilotFieldOrientation >()))
1625 *pAry = it->GetName();
1644 maPropSet( lcl_GetDataPilotFieldMap() )
1651 maPropSet( lcl_GetDataPilotFieldMap() ),
1668 if( pDim->IsDataLayout() )
1672 const std::optional<OUString> & pLayoutName = pDim->GetLayoutName();
1674 aName = *pLayoutName;
1676 aName = pDim->GetName();
1698 static Reference<XPropertySetInfo> aRef(
1719 uno::Sequence<sheet::GeneralFunction>
aSeq;
1720 if( aValue >>= aSeq)
1722 std::vector< ScGeneralFunction > aSubTotals(aSeq.getLength());
1723 std::transform(aSeq.begin(), aSeq.end(), aSubTotals.begin(),
1725 const int nValAsInt =
static_cast<int>(
rValue);
1733 Sequence< sal_Int16 >
aSeq;
1734 if( aValue >>= aSeq )
1736 std::vector< ScGeneralFunction > aSubTotals(aSeq.getLength());
1737 std::transform(aSeq.begin(), aSeq.end(), aSubTotals.begin(),
1750 OUString sCurrentPage;
1751 if (aValue >>= sCurrentPage)
1765 DataPilotFieldAutoShowInfo aInfo;
1766 if (aValue >>= aInfo)
1776 DataPilotFieldLayoutInfo aInfo;
1777 if (aValue >>= aInfo)
1787 DataPilotFieldReference aRef;
1788 if (aValue >>= aRef)
1798 DataPilotFieldSortInfo aInfo;
1799 if (aValue >>= aInfo)
1809 DataPilotFieldGroupInfo aInfo;
1810 if (aValue >>= aInfo)
1824 if (aValue >>= sName)
1836 sheet::GeneralFunction eVal;
1838 if (nFunction == sheet::GeneralFunction2::MEDIAN)
1840 eVal = sheet::GeneralFunction_NONE;
1844 eVal =
static_cast<sheet::GeneralFunction
>(nFunction);
1853 uno::Sequence<sheet::GeneralFunction> aNewSeq;
1854 aNewSeq.realloc(aSeq.getLength());
1855 std::transform(aSeq.begin(), aSeq.end(), aNewSeq.begin(),
1856 [](sal_Int16 nFunc) -> sheet::GeneralFunction {
1857 if (nFunc == sheet::GeneralFunction2::MEDIAN)
1858 return sheet::GeneralFunction_NONE;
1859 return static_cast<sheet::GeneralFunction
>(nFunc);
1870 aRet <<= OUString();
1901 const DataPilotFieldSortInfo* pInfo =
getSortInfo();
1933 DataPilotFieldOrientation ScDataPilotFieldObj::getOrientation()
const
1937 return pDim ? pDim->
GetOrientation() : DataPilotFieldOrientation_HIDDEN;
1943 if (
maOrient.hasValue() && (eNew ==
maOrient.get< DataPilotFieldOrientation >()))
1958 (eNew == DataPilotFieldOrientation_DATA) )
1965 sal_Int32 nFound = 0;
1967 for (
auto const& it : rDimensions)
1971 if ( it->GetOrientation() == DataPilotFieldOrientation_HIDDEN )
2004 if( pDim->GetOrientation() != DataPilotFieldOrientation_DATA )
2007 tools::Long nSubCount = pDim->GetSubTotalsCount();
2008 if ( nSubCount > 0 )
2009 eRet =
static_cast<sal_Int16
>(pDim->GetSubTotalFunc(0));
2013 eRet =
static_cast<sal_Int16
>(pDim->GetFunction());
2029 std::vector<ScGeneralFunction> nSubTotalFuncs;
2032 nSubTotalFuncs.push_back( eNewFunc );
2044 Sequence< sal_Int16 > aRet;
2047 if( pDim->GetOrientation() != DataPilotFieldOrientation_DATA )
2050 sal_Int32
nCount =
static_cast< sal_Int32
>( pDim->GetSubTotalsCount() );
2053 aRet.realloc( nCount );
2054 for( sal_Int32 nIdx = 0; nIdx < nCount; ++nIdx )
2055 aRet[ nIdx ] = static_cast<sal_Int16>(pDim->GetSubTotalFunc( nIdx ));
2072 sal_Int32
nCount = rSubtotals.size();
2076 std::vector<ScGeneralFunction> nTmpFuncs;
2079 nTmpFuncs.push_back( rSubtotals[ 0 ] );
2083 else if( nCount > 1 )
2086 ::std::vector< ScGeneralFunction > aSubt;
2087 for( sal_Int32 nIdx = 0; nIdx < nCount; ++nIdx )
2093 if( ::std::find( aSubt.begin(), aSubt.end(), eFunc ) == aSubt.end() )
2094 aSubt.push_back( eFunc );
2110 pDim->SetCurrentPage( &rPage );
2127 const OUString aPage;
2148 pDim->SetAutoShowInfo( pInfo );
2166 pDim->SetLayoutInfo( pInfo );
2184 pDim->SetReferenceValue( pInfo );
2202 pDim->SetSortInfo( pInfo );
2220 pDim->SetShowEmpty( bShow );
2238 pDim->SetRepeatItemLabels( bShow );
2249 return pDimData->GetNamedGroupDim( pDim->GetName() ) || pDimData->GetNumGroupDim( pDim->GetName() );
2256 DataPilotFieldGroupInfo aInfo;
2265 aInfo.GroupBy = pGroupDim->GetDatePart();
2271 aInfo.SourceField.set( xFields->getByName( pGroupDim->GetSourceDimName() ), UNO_QUERY );
2278 if( pGroupDim->GetDatePart() == 0 )
2282 for( sal_Int32 nIdx = 0,
nCount = pGroupDim->GetGroupCount(); nIdx <
nCount; ++nIdx )
2287 for( sal_Int32 nMemIdx = 0, nMemCount = rGroup.
GetElementCount(); nMemIdx < nMemCount; ++nMemIdx )
2290 aGroups.push_back( aGroup );
2292 aInfo.Groups =
new ScDataPilotFieldGroupsObj( aGroups );
2297 if (pNumGroupDim->GetDatePart())
2300 aInfo.GroupBy = pNumGroupDim->GetDatePart();
2320 if( pInfo && lclCheckMinMaxStep( *pInfo ) )
2328 aInfo.
mfEnd = pInfo->End;
2329 aInfo.
mfStep = pInfo->Step;
2330 Reference< XNamed > xNamed( pInfo->SourceField, UNO_QUERY );
2334 if( pInfo->GroupBy )
2338 Reference<XIndexAccess> xIndex(pInfo->Groups, UNO_QUERY);
2341 sal_Int32
nCount(xIndex->getCount());
2344 Reference<XNamed> xGroupNamed(xIndex->getByIndex(
i), UNO_QUERY);
2345 if (xGroupNamed.is())
2348 Reference<XIndexAccess> xGroupIndex(xGroupNamed, UNO_QUERY);
2349 if (xGroupIndex.is())
2351 sal_Int32 nItemCount(xGroupIndex->getCount());
2352 for (sal_Int32 j = 0; j < nItemCount; ++j)
2354 Reference<XNamed> xItemNamed(xGroupIndex->getByIndex(j), UNO_QUERY);
2355 if (xItemNamed.is())
2356 aItem.AddElement(xItemNamed->getName());
2359 aGroupDim.AddGroupItem(aItem);
2381 else if (pInfo->GroupBy)
2409 if( !rItems.hasElements() )
2410 throw IllegalArgumentException(
"rItems is empty", static_cast<cppu::OWeakObject*>(
this), 0);
2412 Reference< XMembersAccess > xMembers =
GetMembers();
2415 SAL_WARN(
"sc.ui",
"Cannot access members of the field object.");
2416 throw RuntimeException(
"Cannot access members of the field object", static_cast<cppu::OWeakObject*>(
this));
2424 throw IllegalArgumentException(
"There is no member with name \"" +
aEntryName +
"\"", static_cast<cppu::OWeakObject*>(
this), 0);
2428 Reference< XDataPilotField > xRet;
2433 const OUString& aDimName = pDim->
GetName();
2439 OUString aBaseDimName( aDimName );
2441 if ( pBaseGroupDim )
2453 if ( pGroupDimension )
2457 if ( pBaseGroupDim )
2472 std::unique_ptr<ScDPSaveGroupDimension> pNewGroupDim;
2473 if ( !pGroupDimension )
2479 pGroupDimension = pNewGroupDim.get();
2481 if ( pBaseGroupDim )
2491 for (
tools::Long nGroup = 0; nGroup < nGroupCount; nGroup++ )
2511 if ( pBaseGroupDim )
2529 pNewGroupDim.reset();
2532 pGroupDimension =
nullptr;
2536 if ( pSaveDimension->
GetOrientation() == DataPilotFieldOrientation_HIDDEN )
2549 if( !sNewDim.isEmpty() )
2556 xRet.set(xFields->getByName(sNewDim), UNO_QUERY);
2557 SAL_WARN_IF(!xRet.is(),
"sc.ui",
"there is a name, so there should be also a field");
2559 catch (
const container::NoSuchElementException&)
2562 SAL_WARN(
"sc.ui",
"Cannot find field with that name: " + sNewDim +
".");
2564 throw css::lang::WrappedTargetRuntimeException(
2565 "Cannot find field with name \"" + sNewDim +
"\"",
2566 static_cast<cppu::OWeakObject*>(
this), anyEx );
2576 using namespace ::com::sun::star::sheet::DataPilotFieldGroupBy;
2578 if( !rInfo.HasDateValues )
2579 throw IllegalArgumentException(
"HasDateValues is not set", static_cast<cppu::OWeakObject*>(
this), 0);
2580 if( !lclCheckMinMaxStep( rInfo ) )
2581 throw IllegalArgumentException(
"min/max/step", static_cast<cppu::OWeakObject*>(
this), 0);
2584 if( (rInfo.GroupBy == 0) || (rInfo.GroupBy > YEARS) || ((rInfo.GroupBy & (rInfo.GroupBy - 1)) != 0) )
2585 throw IllegalArgumentException(
"Invalid GroupBy value: " + OUString::number(rInfo.GroupBy), static_cast<cppu::OWeakObject*>(
this), 0);
2588 if( rInfo.Step >= ((rInfo.GroupBy == DAYS) ? 32768.0 : 1.0) )
2589 throw IllegalArgumentException(
"Invalid step value: " + OUString::number(rInfo.Step), static_cast<cppu::OWeakObject*>(
this), 0);
2591 OUString aGroupDimName;
2597 aInfo.
mbDateValues = (rInfo.GroupBy == DAYS) && (rInfo.Step >= 1.0);
2601 aInfo.
mfEnd = rInfo.End;
2602 aInfo.
mfStep = std::trunc( rInfo.Step );
2610 const OUString& rDimName = pDim->GetName();
2612 OUString aSrcDimName = pGroupDim ? pGroupDim->
GetSourceDimName() : rDimName;
2621 if( bHasNamedGrouping || bHasNumGrouping )
2622 throw IllegalArgumentException();
2645 if( nDateParts == 0 )
2651 else if( (nDateParts & rInfo.GroupBy) == 0 )
2660 if( rSaveDim.
GetOrientation() == DataPilotFieldOrientation_HIDDEN )
2675 Reference< XDataPilotField > xRet;
2676 if( !aGroupDimName.isEmpty() )
2680 xRet.set( xFields->getByName( aGroupDimName ), UNO_QUERY );
2693 if( !rElement.hasValue() )
2698 if( rElement >>= aSeq )
2700 if( aSeq.hasElements() )
2701 rMembers.insert( rMembers.end(), aSeq.begin(), aSeq.end() );
2706 Reference< XIndexAccess > xItemsIA( rElement, UNO_QUERY );
2709 for( sal_Int32 nIdx = 0, nCount = xItemsIA->getCount(); nIdx <
nCount; ++nIdx )
2713 Reference< XNamed > xItemName( xItemsIA->getByIndex( nIdx ), UNO_QUERY_THROW );
2714 rMembers.push_back( xItemName->getName() );
2745 throw NoSuchElementException();
2755 aSeq.realloc( static_cast< sal_Int32 >(
maGroups.size() ) );
2756 OUString*
pName = aSeq.getArray();
2757 for(
const auto& rGroup :
maGroups )
2759 *pName = rGroup.maName;
2778 if( rName.isEmpty() )
2779 throw IllegalArgumentException(
"Name is empty", static_cast<cppu::OWeakObject*>(
this), 0);
2783 throw NoSuchElementException(
"Name \"" + rName +
"\" not found", static_cast<cppu::OWeakObject*>(
this));
2787 if( !lclExtractGroupMembers( aMembers, rElement ) )
2788 throw IllegalArgumentException(
"Invalid element object", static_cast<cppu::OWeakObject*>(
this), 0);
2791 aIt->maMembers.swap( aMembers );
2800 if( rName.isEmpty() )
2801 throw IllegalArgumentException(
"Name is empty", static_cast<cppu::OWeakObject*>(
this), 0);
2805 throw ElementExistException(
"Name \"" + rName +
"\" already exists", static_cast<cppu::OWeakObject*>(
this));
2809 if( !lclExtractGroupMembers( aMembers, rElement ) )
2810 throw IllegalArgumentException(
"Invalid element object", static_cast<cppu::OWeakObject*>(
this), 0);
2823 if( rName.isEmpty() )
2824 throw IllegalArgumentException(
"Name is empty", static_cast<cppu::OWeakObject*>(
this), 0);
2828 throw NoSuchElementException(
"Name \"" + rName +
"\" not found", static_cast<cppu::OWeakObject*>(
this));
2838 return static_cast< sal_Int32
>(
maGroups.size() );
2844 if ((nIndex < 0) || (nIndex >= static_cast< sal_Int32 >(
maGroups.size() )))
2845 throw IndexOutOfBoundsException();
2854 return new ScIndexEnumeration(
this,
"com.sun.star.sheet.DataPilotFieldGroupsEnumeration" );
2878 throw RuntimeException(
"Field Group with name \"" + rName +
"\" not found", static_cast<cppu::OWeakObject*>(
this));
2888 throw RuntimeException(
"Field Group with name \"" + rOldName +
"\" not found", static_cast<cppu::OWeakObject*>(
this));
2890 if( (aNewIt !=
maGroups.end()) && (aNewIt != aOldIt) )
2891 throw RuntimeException(
"Field Group with name \"" + rOldName +
"\" already exists", static_cast<cppu::OWeakObject*>(
this));
2892 aOldIt->maName = rNewName;
2898 [&rName](
const ScFieldGroup& rGroup) {
return rGroup.maName == rName; });
2903 OUString lclExtractMember(
const Any& rElement )
2905 if( rElement.has< OUString >() )
2906 return rElement.get< OUString >();
2908 Reference< XNamed > xNamed( rElement, UNO_QUERY );
2910 return xNamed->getName();
2919 maGroupName( rGroupName )
2933 ScFieldGroupMembers::iterator aIt = ::std::find( rMembers.begin(), rMembers.end(), rName );
2934 if( aIt == rMembers.end() )
2935 throw NoSuchElementException(
"Name \"" + rName +
"\" not found", static_cast<cppu::OWeakObject*>(
this));
2936 return Any( Reference< XNamed >(
new ScDataPilotFieldGroupItemObj( *
this, *aIt ) ) );
2942 return ::comphelper::containerToSequence(
mxParent->getFieldGroup(
maGroupName ).maMembers );
2949 return ::std::find( rMembers.begin(), rMembers.end(), rName ) != rMembers.end();
2959 OUString aNewName = lclExtractMember( rElement );
2960 if( rName.isEmpty() || aNewName.isEmpty() )
2961 throw IllegalArgumentException(
"Name is empty", static_cast<cppu::OWeakObject*>(
this), 0);
2962 if( rName == aNewName )
2966 ScFieldGroupMembers::iterator aOldIt = ::std::find( rMembers.begin(), rMembers.end(), rName );
2967 ScFieldGroupMembers::iterator aNewIt = ::std::find( rMembers.begin(), rMembers.end(), aNewName );
2968 if( aOldIt == rMembers.end() )
2969 throw NoSuchElementException(
"Name \"" + rName +
"\" not found", static_cast<cppu::OWeakObject*>(
this));
2970 if( aNewIt != rMembers.end() )
2971 throw IllegalArgumentException(
"Name \"" + rName +
"\" already exists", static_cast<cppu::OWeakObject*>(
this), 0);
2982 if( rName.isEmpty() )
2983 throw IllegalArgumentException(
"Name is empty", static_cast<cppu::OWeakObject*>(
this), 0);
2986 ScFieldGroupMembers::iterator aIt = ::std::find( rMembers.begin(), rMembers.end(), rName );
2987 if( aIt != rMembers.end() )
2988 throw IllegalArgumentException(
"Name \"" + rName +
"\" already exists", static_cast<cppu::OWeakObject*>(
this), 0);
2989 rMembers.push_back( rName );
2996 if( rName.isEmpty() )
2997 throw IllegalArgumentException(
"Name is empty", static_cast<cppu::OWeakObject*>(
this), 0);
2999 ScFieldGroupMembers::iterator aIt = ::std::find( rMembers.begin(), rMembers.end(), rName );
3000 if( aIt == rMembers.end() )
3001 throw NoSuchElementException(
"Name \"" + rName +
"\" not found", static_cast<cppu::OWeakObject*>(
this));
3002 rMembers.erase( aIt );
3010 return static_cast< sal_Int32
>(
mxParent->getFieldGroup(
maGroupName ).maMembers.size() );
3017 if ((nIndex < 0) || (nIndex >= static_cast< sal_Int32 >( rMembers.size() )))
3018 throw IndexOutOfBoundsException();
3019 return Any( Reference< XNamed >(
new ScDataPilotFieldGroupItemObj( *
this, rMembers[ nIndex ] ) ) );
3027 return new ScIndexEnumeration(
this,
"com.sun.star.sheet.DataPilotFieldGroupEnumeration" );
3112 sal_Int32 nCount = xMembersIndex->getCount();
3113 sal_Int32 nItem = 0;
3114 while (nItem < nCount)
3116 Reference<XNamed> xMember(xMembersIndex->getByIndex(nItem), UNO_QUERY);
3117 if (xMember.is() && (aName == xMember->getName()))
3123 throw NoSuchElementException(
"Name \"" + aName +
"\" not found", static_cast<cppu::OWeakObject*>(
this));
3140 bool bFound =
false;
3145 sal_Int32 nCount = xMembersIndex->getCount();
3146 sal_Int32 nItem = 0;
3147 while (nItem < nCount && !bFound )
3149 Reference<XNamed> xMember(xMembersIndex->getByIndex(nItem), UNO_QUERY);
3150 if (xMember.is() && aName == xMember->getName())
3180 throw IndexOutOfBoundsException();
3181 return Any( xItem );
3198 maPropSet( lcl_GetDataPilotItemMap() ),
3216 sal_Int32 nCount = xMembersIndex->getCount();
3219 Reference<XNamed> xMember(xMembersIndex->getByIndex(
mnIndex), UNO_QUERY);
3220 sRet = xMember->getName();
3231 Reference< XPropertySetInfo >
3235 static Reference<XPropertySetInfo> aRef =
3249 if( !xMembers.is() )
3253 sal_Int32 nCount = xMembersIndex->getCount();
3257 Reference<XNamed> xMember(xMembersIndex->getByIndex(
mnIndex), UNO_QUERY);
3258 OUString
sName(xMember->getName());
3263 bool bGetNewIndex =
false;
3270 sal_Int32 nNewPos = 0;
3271 if ( !( aValue >>= nNewPos ) || nNewPos < 0 || nNewPos >= nCount )
3272 throw IllegalArgumentException();
3276 bGetNewIndex =
true;
3284 sal_Int32 nItemCount = aItemNames.getLength();
3285 for (sal_Int32 nItem=0; nItem<nItemCount; ++nItem)
3286 if (aItemNames[nItem] ==
sName)
3301 sal_Int32 nCount = xMembersIndex->getCount();
3304 Reference< XNamed > xMember( xMembersIndex->getByIndex(
mnIndex ), UNO_QUERY );
3305 OUString
sName( xMember->getName() );
3309 if (pMember && pMember->HasShowDetails())
3316 if( xMemberProps.is() )
3324 if (pMember && pMember->HasIsVisible())
3326 aRet <<= !pMember->GetIsVisible();
3331 if( xMemberProps.is() )
3348 const OUString& ,
const Reference< XPropertyChangeListener >& )
3353 const OUString& ,
const Reference< XPropertyChangeListener >& )
3358 const OUString& ,
const Reference< XVetoableChangeListener >& )
3363 const OUString& ,
const Reference< XVetoableChangeListener >& )
static OUString lcl_CreatePivotName(ScDocShell *pDocShell)
virtual css::uno::Any SAL_CALL getByName(const OUString &aName) override
virtual void SAL_CALL insertDrillDownSheet(const css::table::CellAddress &aAddr) override
SC_DLLPUBLIC void SetRepeatIfEmpty(bool bSet)
#define SC_UNONAME_LAYOUTINFO
const ScDPDimensionSaveData * GetExistingDimensionData() const
const OUString & GetGroupDimName() const
virtual sal_Bool SAL_CALL hasElements() override
virtual void SAL_CALL removeByName(const OUString &Name) override
bool UpdateReference(UpdateRefMode, const ScDocument *, const ScRange &rWhere, SCCOL nDx, SCROW nDy, SCTAB nDz)
virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL getDataPilotFields() override
function is determined automatically.
bool IsDimNameInUse(std::u16string_view rName) const
virtual css::table::CellRangeAddress SAL_CALL getOutputRangeByType(sal_Int32 nType) override
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override
virtual void SAL_CALL addPropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
static ScGeneralFunction FirstFunc(PivotFunc nBits)
void ReplaceNumGroupDimension(const ScDPSaveNumGroupDimension &rGroupDim)
static sal_Int32 GetEnumFromAny(const css::uno::Any &aAny)
void ShowDataPilotSourceData(ScDPObject &rDPObj, const css::uno::Sequence< css::sheet::DataPilotFieldFilter > &rFilters)
This class has to do with handling exclusively grouped dimensions? TODO: Find out what this class doe...
static bool lcl_GetFieldDataByIndex(const Reference< XDimensionsSupplier > &rSource, const Any &rOrient, SCSIZE nIndex, ScFieldIdentifier &rFieldId)
ScDPSaveMember * GetMemberByName(const OUString &rName)
Get a member object by its name.
ScDataPilotChildObjBase(ScDataPilotDescriptorBase &rParent)
SC_DLLPUBLIC size_t GetCount() const
static void FillProperties(css::uno::Sequence< css::beans::PropertyValue > &rSeq, const ScImportParam &rParam)
void SetOrientation(css::sheet::DataPilotFieldOrientation nNew)
virtual void SAL_CALL addPropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
#define SC_UNO_DP_SERVICEARG
std::unique_ptr< ScDPObject > mpDPObject
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
SC_DLLPUBLIC const std::optional< OUString > & GetGrandTotalName() const
virtual void SAL_CALL setName(const OUString &aName) override
virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL getPageFields() override
css::sheet::DataPilotFieldOrientation GetOrientation() const
virtual css::uno::Reference< css::sheet::XDataPilotDescriptor > SAL_CALL createDataPilotDescriptor() override
virtual sal_Int32 SAL_CALL getCount() override
void AddNumGroupDimension(const ScDPSaveNumGroupDimension &rGroupDim)
const css::sheet::DataPilotFieldAutoShowInfo * getAutoShowInfo() const
virtual sal_Int32 SAL_CALL getCount() override
sal_Int32 findValue(const css::uno::Sequence< T1 > &_rList, const T2 &_rValue)
virtual OUString SAL_CALL getName() override
virtual void SAL_CALL acquire() override
virtual OUString SAL_CALL getName() override
tools::Long GetDimCount()
virtual sal_Int32 SAL_CALL getCount() override
virtual ~ScDataPilotDescriptor() override
void setReference(const css::sheet::DataPilotFieldReference *pInfo)
css::sheet::DataPilotFieldGroupInfo getGroupInfo()
void GetDrillDownData(const ScAddress &rPos, css::uno::Sequence< css::uno::Sequence< css::uno::Any > > &rTableData)
void AddGroupDimension(const ScDPSaveGroupDimension &rGroupDim)
const css::sheet::DataPilotFieldLayoutInfo * GetLayoutInfo() const
#define SC_UNONAME_REFERENCE
WeakReference< XInterface > mxParent
SC_DLLPUBLIC ScDPDimensionSaveData * GetDimensionData()
#define SC_UNO_DP_COLGRAND
virtual css::uno::Type SAL_CALL getElementType() override
ScDataPilotDescriptorBase(ScDocShell *pDocSh)
Classes to save Data Pilot settings that create new dimensions (fields).
const OUString & GetGroupName() const
rtl::Reference< ScDataPilotFieldGroupObj > mxParent
SC_DLLPUBLIC ScDPCollection * GetDPCollection()
sal_Int32 mnFieldIdx
Source field name.
ScFieldGroup & getFieldGroup(const OUString &rName)
void SetOutRange(const ScRange &rRange)
const OUString & GetSourceDimName() const
void RemoveGroupDimension(const OUString &rGroupDimName)
#define SC_UNO_DP_PASSWORD
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 Index) override
void SetDocumentModified()
virtual sal_Bool SAL_CALL hasByName(const OUString &aName) override
virtual OUString SAL_CALL getName() override
css::sheet::DataPilotFieldOrientation getOrientation() const
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
virtual ScDPObject * GetDPObject() const override
numerical values are counted.
#define SC_UNO_DP_REPEATEMPTY
ScDPObject * GetDPObject() const
Returns the wrapped DataPilot object (calls GetDPObject() at parent).
sum of all numerical values is calculated.
virtual sal_Bool SAL_CALL hasByName(const OUString &aName) override
DataPilotTables collection per sheet.
bool IsDataLayout() const
void SetImportDesc(const ScImportSourceDesc &rDesc)
SC_DLLPUBLIC ScRange GetRange(SCTAB nTab, const tools::Rectangle &rMMRect, bool bHiddenAsZero=true) const
void SetDPObject(ScDPObject *pDPObject)
Sets the passed DataPilot object (calls SetDPObject() at parent).
virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 > &aIdentifier) override
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
virtual void SAL_CALL setName(const OUString &aName) override
virtual css::sheet::DataPilotTablePositionData SAL_CALL getPositionData(const css::table::CellAddress &aAddr) override
const ScDPNumGroupInfo & GetDateInfo() const
#define SC_UNO_DP_IGNORE_EMPTYROWS
ScDataPilotFieldGroupsObj(const ScFieldGroups &rGroups)
#define SC_UNO_DP_GRANDTOTAL_NAME
#define SC_UNONAME_GROUPINFO
void setOrientation(css::sheet::DataPilotFieldOrientation Orientation)
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
product of all numerical values is calculated.
virtual css::uno::Reference< css::sheet::XDataPilotField > SAL_CALL getDataLayoutField() override
virtual ~ScDataPilotDescriptorBase() override
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
void setShowEmpty(bool bShow)
#define SC_UNO_DP_ORIGINAL
static void FillGroupInfo(css::sheet::DataPilotFieldGroupInfo &rInfo, const ScDPNumGroupInfo &rGroupInfo)
OUString CreateGroupDimName(const OUString &rSourceName, const ScDPObject &rObject, bool bAllowSource, const ::std::vector< OUString > *pDeletedNames)
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
OUString CreateNewName() const
Create a new name that's not yet used by any existing data pilot objects.
virtual void SAL_CALL replaceByName(const OUString &aName, const css::uno::Any &aElement) override
ScDataPilotFieldObj * GetObjectByIndex_Impl(sal_Int32 nIndex) const
css::uno::Any const & rValue
const OUString & GetTag() const
sal_Int32 GetMemberCount() const
Returns the number of members for the field described by maFieldId.
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 Index) override
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
const ScDPSaveGroupDimension * GetNamedGroupDim(const OUString &rGroupDimName) const
virtual OUString SAL_CALL getTag() override
virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL getRowFields() override
void RefreshPivotTables(const ScDPObject *pDPObj, bool bApi)
Reload the referenced pivot cache, and refresh all pivot tables that reference the cache...
bool getShowEmpty() const
const ScRange & GetOutRange() const
ScDPSaveGroupDimension * GetGroupDimAccForBase(const OUString &rBaseDimName)
virtual ~ScDataPilotFieldGroupItemObj() override
#define SC_UNONAME_USESELPAGE
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 ...
Any SAL_CALL getCaughtException()
::std::vector< ScFieldGroup > ScFieldGroups
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
void RemoveDimensionByName(const OUString &rName)
void setSubtotals(const std::vector< ScGeneralFunction > &rFunctions)
virtual sal_Bool SAL_CALL hasByName(const OUString &aName) override
virtual void SAL_CALL removePropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &aListener) override
virtual void SAL_CALL addModifyListener(const css::uno::Reference< css::util::XModifyListener > &aListener) override
variance is calculated based on the entire population.
void AddElementsFromGroup(const ScDPSaveGroupItem &rGroup)
void SetMemberPosition(const OUString &rName, sal_Int32 nNewPos)
SC_DLLPUBLIC const ScRange & GetSourceRange() const
Get the range that contains the source data.
ScDataPilotFieldGroupItemObj(ScDataPilotFieldGroupObj &rParent, const OUString &rName)
void ReplaceGroupDimension(const ScDPSaveGroupDimension &rGroupDim)
virtual css::uno::Any SAL_CALL getByName(const OUString &aName) override
bool GetIgnoreEmptyRows() const
void SetSheetDesc(const ScSheetSourceDesc &rDesc)
bool mbDataLayout
Field index (if several fields with same name exist).
css::uno::Sequence< css::beans::PropertyValue > InitPropertySequence(::std::initializer_list< ::std::pair< OUString, css::uno::Any > > vInit)
css::uno::Reference< css::container::XIndexAccess > mxItems
void SetGroupInfo(const ScDPNumGroupInfo &rNew)
size_t GetElementCount() const
css::uno::Sequence< sal_Int16 > getSubtotals() const
void SetFunction(ScGeneralFunction nNew)
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
#define SC_QUERYINTERFACE(x)
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override
virtual void SAL_CALL insertByName(const OUString &aName, const css::uno::Any &aElement) override
bool GetRepeatItemLabels() const
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override
maximum value of all numerical values is calculated.
#define SC_UNO_DP_SOURCENAME
virtual css::uno::Reference< css::sheet::XSheetFilterDescriptor > SAL_CALL getFilterDescriptor() override
virtual css::uno::Any SAL_CALL getByName(const OUString &aName) override
void SetName(const OUString &rNew)
void SetLayoutName(const OUString &rName)
virtual css::uno::Sequence< css::uno::Sequence< css::uno::Any > > SAL_CALL getDrillDownData(const css::table::CellAddress &aAddr) override
void setSortInfo(const css::sheet::DataPilotFieldSortInfo *pInfo)
void setRepeatItemLabels(bool bShow)
static PivotFunc FunctionBit(sal_Int16 eFunc)
tools::Long GetGroupCount() const
bool GetDrillDown() const
#define SC_UNO_DP_IMPORTDESC
ScDataPilotDescriptor(ScDocShell *pDocSh)
standard deviation is calculated based on the entire population.
Collection of all DataPilot fields, or of all fields from a specific dimension.
rtl::Reference< ScDataPilotDescriptorBase > mxParent
virtual css::uno::Reference< css::sheet::XDataPilotField > SAL_CALL createDateGroup(const css::sheet::DataPilotFieldGroupInfo &rInfo) override
virtual css::uno::Any SAL_CALL getByName(const OUString &aName) override
virtual sal_Bool SAL_CALL hasElements() override
ScDataPilotItemObj(ScDataPilotDescriptorBase &rParent, const ScFieldIdentifier &rFieldId, sal_Int32 nIndex)
virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL getDataFields() override
const ScDPSaveGroupItem & GetGroupByIndex(tools::Long nIndex) const
const css::sheet::DataPilotFieldSortInfo * GetSortInfo() const
void setCurrentPage(const OUString &sPage)
bool getRepeatItemLabels() const
virtual void SAL_CALL addVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
void SetCurrentPage(const OUString *pPage)
virtual void SAL_CALL setName(const OUString &aName) override
SC_DLLPUBLIC void SetDimensionData(const ScDPDimensionSaveData *pNew)
virtual css::uno::Type SAL_CALL getElementType() override
ScDocShell * GetDocShell() const
static bool lcl_IsDuplicated(const Reference< XPropertySet > &rDimProps)
const OUString * GetElementByIndex(size_t nIndex) const
static bool lcl_GetFieldDataByName(ScDPObject *pDPObj, const OUString &rFieldName, ScFieldIdentifier &rFieldId)
Represents a group dimension that introduces a new hierarchy for an existing dimension.
virtual void SAL_CALL insertByName(const OUString &aName, const css::uno::Any &aElement) override
static tools::Long GetPropertyCount()
virtual css::uno::Type SAL_CALL getElementType() override
average of all numerical values is calculated.
css::uno::Reference< css::sheet::XDimensionsSupplier > const & GetSource()
virtual css::table::CellRangeAddress SAL_CALL getOutputRange() override
virtual ~ScDataPilotItemObj() override
virtual css::uno::Any SAL_CALL getByName(const OUString &aName) override
virtual ~ScDataPilotFieldObj() override
const ScDPSaveGroupDimension * GetNextNamedGroupDim(const OUString &rGroupDimName) const
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
bool DataPilotUpdate(ScDPObject *pOldObj, const ScDPObject *pNewObj, bool bRecord, bool bApi, bool bAllowMove=false)
ScFieldIdentifier maFieldId
#define SC_UNONAME_AUTOSHOW
void SetSaveData(const ScDPSaveData &rData)
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 Index) override
static SC_DLLPUBLIC OUString getSourceDimensionName(const OUString &rName)
virtual ~ScDataPilotItemsObj() override
static sal_Int32 lcl_GetFieldCount(const Reference< XDimensionsSupplier > &rSource, const Any &rOrient)
ScDataPilotFieldGroupObj(ScDataPilotFieldGroupsObj &rParent, const OUString &rGroupName)
const OUString & GetName() const
#define SC_UNO_DP_DRILLDOWN
virtual sal_Bool SAL_CALL hasElements() override
ScDPSaveNumGroupDimension * GetNumGroupDimAcc(const OUString &rGroupDimName)
#define SC_UNONAME_FUNCTION
bool GetRepeatIfEmpty() const
Implementation of a single DataPilot field.
SfxItemPropertySet maPropSet
static bool GetBoolProperty(const css::uno::Reference< css::beans::XPropertySet > &xProp, const OUString &rName, bool bDefault=false)
void SetTag(const OUString &rNew)
#define SC_UNONAME_SHOWDETAIL
virtual ~ScDataPilotChildObjBase()
OUString ScResId(const char *pId)
const SfxItemPropertyMap & getPropertyMap() const
virtual void SAL_CALL setSourceRange(const css::table::CellRangeAddress &aSourceRange) override
XModifyListenerArr_Impl aModifyListeners
virtual void SAL_CALL setTag(const OUString &aTag) override
ScFieldGroupMembers maMembers
#define SC_UNONAME_SHOWEMPTY
const css::sheet::DataPilotFieldLayoutInfo * getLayoutInfo() const
virtual sal_Bool SAL_CALL hasElements() override
#define SC_UNONAME_HASSORTINFO
#define SC_UNONAME_SELPAGE
ScDPSaveData * GetSaveData() const
#define SC_UNONAME_ISHIDDEN
SC_DLLPUBLIC void SetIgnoreEmptyRows(bool bSet)
const ScImportSourceDesc * GetImportSourceDesc() const
const ScDPNumGroupInfo & GetDateInfo() const
css::uno::Type const & get()
#define SC_SIMPLE_SERVICE_INFO(ClassName, ClassNameAscii, ServiceAscii)
virtual ~ScDataPilotFieldGroupObj() override
virtual ~ScDataPilotFieldGroupsObj() override
const ScDPServiceDesc * GetDPServiceDesc() const
virtual sal_Bool SAL_CALL hasElements() override
const ScDPSaveGroupDimension * GetFirstNamedGroupDim(const OUString &rBaseDimName) const
virtual sal_Bool SAL_CALL hasByName(const OUString &aName) override
virtual void SAL_CALL removeVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
rtl::Reference< ScDataPilotFieldGroupsObj > mxParent
ScDataPilotItemsObj(ScDataPilotDescriptorBase &rParent, const ScFieldIdentifier &rFieldId)
SC_DLLPUBLIC void SetFilterButton(bool bSet)
ScDataPilotTableObj(ScDocShell *pDocSh, SCTAB nT, const OUString &rN)
css::uno::Sequence< T > concatSequences(const css::uno::Sequence< T > &rS1, const Ss &...rSn)
ScDataPilotTablesObj(ScDocShell *pDocSh, SCTAB nT)
ScDPSaveDimension * DuplicateDimension(std::u16string_view rName)
virtual void SAL_CALL removeByName(const OUString &Name) override
virtual void SAL_CALL removeVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
virtual void SetDPObject(ScDPObject *pDPObj) override
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
ScDocShell * GetDocShell() const
Implementation of all grouped items in a DataPilot field.
virtual void SAL_CALL setTag(const OUString &aTag) override
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
const css::sheet::DataPilotFieldSortInfo * getSortInfo() const
static sal_Int16 GetInt16FromAny(const css::uno::Any &aAny)
#define SC_IMPL_DUMMY_PROPERTY_LISTENER(ClassName)
const css::sheet::DataPilotFieldReference * getReference() const
bool GetDataFieldPositionData(const ScAddress &rPos, css::uno::Sequence< css::sheet::DataPilotFieldFilter > &rFilters)
bool GetFilterButton() const
void SetPosition(ScDPSaveDimension *pDim, tools::Long nNew)
css::sheet::DataImportMode nType
SC_DLLPUBLIC void SetShowDetails(bool bSet)
void AddUnoObject(SfxListener &rObject)
#define SC_UNO_DP_ROWGRAND
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 Index) override
#define SC_UNO_DP_ORIENTATION
bool GetColumnGrand() const
median of all numerical values is calculated.
static SC_DLLPUBLIC const css::uno::Sequence< sal_Int8 > & getUnoTunnelId()
SC_DLLPUBLIC void SetGrandTotalName(const OUString &rName)
OUString GetDimName(tools::Long nDim, bool &rIsDataLayout, sal_Int32 *pFlags=nullptr)
void setGroupInfo(const css::sheet::DataPilotFieldGroupInfo *pInfo)
SC_DLLPUBLIC void SetDrillDown(bool bSet)
virtual sal_Bool SAL_CALL hasByName(const OUString &aName) override
#define SC_UNONAME_SORTINFO
virtual css::table::CellRangeAddress SAL_CALL getSourceRange() override
virtual void SAL_CALL release() override
bool RemovePivotTable(ScDPObject &rDPObj, bool bRecord, bool bApi)
ScFieldGroups::iterator implFindByName(const OUString &rName)
#define SC_UNONAME_HASAUTOSHOW
#define SC_UNONAME_SUBTOTALS2
virtual css::uno::Reference< css::sheet::XDataPilotField > SAL_CALL createNameGroup(const css::uno::Sequence< OUString > &aItems) override
#define SC_UNONAME_SUBTOTALS
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
#define SC_UNONAME_ORIENT
ScDataPilotFieldObj * GetObjectByName_Impl(const OUString &rName) const
bool GetShowDetails() const
SfxItemPropertySet maPropSet
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
virtual OUString SAL_CALL getName() override
const DimsType & GetDimensions() const
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
static void FillImportParam(ScImportParam &rParam, const css::uno::Sequence< css::beans::PropertyValue > &rSeq)
void RemoveElementsFromGroups(ScDPSaveGroupDimension &rDimension) const
remove this group's elements from their groups in rDimension (rDimension must be a different dimensio...
#define SC_UNO_DP_USERNAME
::std::vector< OUString > ScFieldGroupMembers
#define SAL_WARN_IF(condition, area, stream)
virtual ~ScDataPilotTablesObj() override
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
ScDataPilotItemObj * GetObjectByIndex_Impl(sal_Int32 nIndex) const
bool GetShowEmpty() const
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
virtual void SAL_CALL removeModifyListener(const css::uno::Reference< css::util::XModifyListener > &aListener) override
void SetServiceData(const ScDPServiceDesc &rDesc)
ScGeneralFunction
the css::sheet::GeneralFunction enum is extended by constants in GeneralFunction2, which causes some type-safety issues.
void RemoveFromGroups(const OUString &rItemName)
virtual void SAL_CALL removeByName(const OUString &aName) override
#define SC_UNO_DP_ISVISIBLE
std::vector< std::unique_ptr< ScDPSaveDimension > > DimsType
virtual void SetDPObject(ScDPObject *pDPObj)=0
variance is calculated based on a sample.
all values, including non-numerical values, are counted.
const ScSheetSourceDesc * GetSheetDesc() const
Represents a new group dimension whose dimension ID is higher than the highest source dimension ID...
static OUString lcl_GetOriginalName(const Reference< XNamed > &rDim)
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override
void RemoveUnoObject(SfxListener &rObject)
virtual ScDPObject * GetDPObject() const =0
void setFunction(ScGeneralFunction Function)
void AddElement(const OUString &rName)
virtual void SAL_CALL setName(const OUString &aName) override
const ScDPSaveGroupItem * GetNamedGroup(const OUString &rGroupName) const
ScDataPilotFieldsObj(ScDataPilotDescriptorBase &rParent)
const css::sheet::DataPilotFieldAutoShowInfo * GetAutoShowInfo() const
void SetDateInfo(const ScDPNumGroupInfo &rInfo, sal_Int32 nPart)
Sequence< sal_Int8 > aSeq
const ScDocument & GetDocument() const
virtual void SAL_CALL replaceByName(const OUString &aName, const css::uno::Any &aElement) override
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 Index) override
virtual ~ScDataPilotFieldsObj() override
virtual css::uno::Type SAL_CALL getElementType() override
void setAutoShowInfo(const css::sheet::DataPilotFieldAutoShowInfo *pInfo)
virtual sal_Int32 SAL_CALL getCount() override
sal_Int32 CollectDateParts(const OUString &rBaseDimName) const
virtual OUString SAL_CALL getTag() override
SC_DLLPUBLIC void SetColumnGrand(bool bSet)
css::uno::Reference< css::sheet::XMembersAccess > GetMembers() const
Returns the collection of members for the field described by maFieldId.
virtual sal_Int32 SAL_CALL getCount() override
virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL getHiddenFields() override
virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL getItems() override
minimum value of all numerical values is calculated.
#define SC_UNONAME_FUNCTION2
#define SC_UNO_DP_SOURCESERVICE
#define SC_UNO_DP_SHOWFILTER
standard deviation is calculated based on a sample.
const ScDPNumGroupInfo & GetInfo() const
ScDataPilotTableObj * GetObjectByIndex_Impl(sal_Int32 nIndex)
SC_DLLPUBLIC void SetRowGrand(bool bSet)
void AddUnoListenerCall(const css::uno::Reference< css::util::XModifyListener > &rListener, const css::lang::EventObject &rEvent)
#define SC_DATALAYOUT_NAME
virtual css::uno::Type SAL_CALL getElementType() override
static void FillApiRange(css::table::CellRangeAddress &rApiRange, const ScRange &rScRange)
virtual void SAL_CALL insertNewByName(const OUString &aName, const css::table::CellAddress &aOutputAddress, const css::uno::Reference< css::sheet::XDataPilotDescriptor > &xDescriptor) override
OUString CreateDateGroupDimName(sal_Int32 nDatePart, const ScDPObject &rObject, bool bAllowSource, const ::std::vector< OUString > *pDeletedNames)
#define SAL_WARN(area, stream)
static sal_Int32 lcl_GetObjectIndex(ScDPObject *pDPObj, const ScFieldIdentifier &rFieldId)
virtual void SAL_CALL refresh() override
virtual OUString SAL_CALL getName() override
#define SC_UNO_DP_SHOWDETAILS
ScTabViewShell * GetBestViewShell(bool bOnlyVisible=true)
#define SC_UNO_DP_ISDATALAYOUT
const ScDPSaveNumGroupDimension * GetNumGroupDim(const OUString &rGroupDimName) const
#define SC_UNONAME_HASREFERENCE
virtual void SAL_CALL setName(const OUString &aName) override
virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL getColumnFields() override
void setUseCurrentPage(bool bUse)
#define SC_UNO_DP_OBJECTNAME
void RefreshPivotTableGroups(ScDPObject *pDPObj)
Refresh the group dimensions of all pivot tables referencing the same cache.
SfxItemPropertySet maPropSet
static ScDPObject * lcl_GetDPObject(ScDocShell *pDocShell, SCTAB nTab, std::u16string_view rName)
static void FillScRange(ScRange &rScRange, const css::table::CellRangeAddress &rApiRange)
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
Base class of all implementation objects based on a DataPilot descriptor or DataPilot table object...
bool hasGroupInfo() const
virtual void SAL_CALL setName(const OUString &aName) override
#define SC_UNONAME_HASLAYOUTINFO
virtual ~ScDataPilotTableObj() override
This class contains authoritative information on the internal reference used as the data source for d...
void setLayoutInfo(const css::sheet::DataPilotFieldLayoutInfo *pInfo)
void SetSubTotals(std::vector< ScGeneralFunction > const &rFuncs)
ScDataPilotFieldObj(ScDataPilotDescriptorBase &rParent, const ScFieldIdentifier &rIdent)
virtual OUString SAL_CALL getName() override
void AddGroupItem(const ScDPSaveGroupItem &rItem)
SC_DLLPUBLIC ScDPSaveDimension * GetDimensionByName(const OUString &rName)
Get a dimension object by its name.
#define SC_UNONAME_ISGROUP
ScDPSaveDimension * GetDPDimension(ScDPObject **ppDPObject=nullptr) const
Returns the DataPilot dimension object related to the field described by maFieldId.
virtual void SAL_CALL addVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
void renameFieldGroup(const OUString &rOldName, const OUString &rNewName)
const css::sheet::DataPilotFieldReference * GetReferenceValue() const
sal_Int16 getFunction() const
void SetDateInfo(const ScDPNumGroupInfo &rInfo, sal_Int32 nPart)
OUString CreateGroupName(std::u16string_view rPrefix)
#define SC_UNONAME_REPEATITEMLABELS
bool any2bool(const css::uno::Any &rAny)
virtual void SAL_CALL removePropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &aListener) override
virtual void SetDPObject(ScDPObject *pDPObj) override
virtual ScDPObject * GetDPObject() const override
void GetPositionData(const ScAddress &rPos, css::sheet::DataPilotTablePositionData &rPosData)
bool CreatePivotTable(const ScDPObject &rDPObj, bool bRecord, bool bApi)
ScDataPilotTableObj * GetObjectByName_Impl(const OUString &aName)