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 ) &&
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 ) );
299 pDocShell( &rDocSh ),
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::getFromUnoTunnel<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 );
518 throw NoSuchElementException();
519 return Any( xTable );
533 sal_uInt16 nFound = 0;
536 for (i=0; i<nCount; ++i)
545 OUString* pAry = aSeq.getArray();
546 for (i=0; i<nCount; ++i)
550 pAry[nPos++] = rDPObj.
GetName();
569 for (
size_t i=0;
i<nCount; ++
i)
582 maPropSet( lcl_GetDataPilotDescriptorBaseMap() ),
600 if ( rHint.
GetId() == SfxHintId::Dying )
614 throw RuntimeException(
"Failed to get DPObject", static_cast<cppu::OWeakObject*>(
this));
616 CellRangeAddress aRet;
628 throw RuntimeException(
"Failed to get DPObject", static_cast<cppu::OWeakObject*>(
this));
636 aSheetDesc.SetSourceRange(aRange);
687 static Reference<XPropertySetInfo> aRef =
700 OSL_ENSURE(pOldData,
"Here should be a SaveData");
732 if ( aValue >>= aStrVal )
737 uno::Sequence<beans::PropertyValue> aArgSeq;
738 if ( aValue >>= aArgSeq )
744 aImportDesc = *pOldDesc;
749 sheet::DataImportMode nNewType = sheet::DataImportMode_NONE;
753 nNewType = sheet::DataImportMode_SQL;
755 nNewType = sheet::DataImportMode_QUERY;
757 nNewType = sheet::DataImportMode_TABLE;
759 aImportDesc.nType = nNewType;
760 aImportDesc.aDBName = aParam.
aDBName;
762 aImportDesc.bNative = aParam.
bNative;
770 if ( aValue >>= aStrVal )
776 aServiceDesc = *pOldDesc;
785 uno::Sequence<beans::PropertyValue> aArgSeq;
786 if ( aValue >>= aArgSeq )
792 aServiceDesc = *pOldDesc;
795 for (
const beans::PropertyValue& rProp : std::as_const(aArgSeq))
801 if ( rProp.Value >>= aStrVal )
806 if ( rProp.Value >>= aStrVal )
811 if ( rProp.Value >>= aStrVal )
816 if ( rProp.Value >>= aStrVal )
825 throw UnknownPropertyException(aPropertyName);
842 OSL_ENSURE(pOldData,
"Here should be a SaveData");
875 aRet <<= *pGrandTotalName;
884 aParam.
bImport = ( pImportDesc->
nType != sheet::DataImportMode_NONE );
888 aParam.
bSql = ( pImportDesc->
nType == sheet::DataImportMode_SQL );
898 uno::Sequence<beans::PropertyValue> aEmpty(0);
904 OUString aServiceName;
908 aRet <<= aServiceName;
926 uno::Sequence<beans::PropertyValue> aEmpty;
931 throw UnknownPropertyException(aPropertyName);
939 const OUString& ,
const Reference<XPropertyChangeListener >& )
944 const OUString& ,
const Reference<XPropertyChangeListener >& )
949 const OUString& ,
const Reference<XVetoableChangeListener >& )
954 const OUString& ,
const Reference<XVetoableChangeListener >& )
965 if(
ScDPSaveData* pSaveData = pDPObject->GetSaveData() )
967 if( pSaveData->GetDataLayoutDimension() )
980 const Sequence<sal_Int8 >& rId )
988 return theScDataPilotDescriptorBaseUnoTunnelId.
getSeq();
995 aModifyListeners( 0 )
1011 return ScDataPilotDescriptorBase::queryInterface( rType );
1016 ScDataPilotDescriptorBase::acquire();
1021 ScDataPilotDescriptorBase::release();
1027 ScDataPilotDescriptorBase::getTypes(),
1028 Sequence< uno::Type >
1037 return css::uno::Sequence<sal_Int8>();
1049 if ( pDPObj && pDocSh )
1098 pDPObj->
SetTag( aNewTag );
1110 CellRangeAddress aRet;
1116 aRet.StartColumn = aRange.aStart.Col();
1117 aRet.StartRow = aRange.aStart.Row();
1118 aRet.EndColumn = aRange.aEnd.Col();
1119 aRet.EndRow = aRange.aEnd.Row();
1138 Sequence< Sequence<Any> > aTabData;
1139 ScAddress aAddr2(static_cast<SCCOL>(aAddr.Column), static_cast<SCROW>(aAddr.Row), aAddr.Sheet);
1142 throw RuntimeException(
"Failed to get DPObject", static_cast<cppu::OWeakObject*>(
this));
1151 DataPilotTablePositionData aPosData;
1152 ScAddress aAddr2(static_cast<SCCOL>(aAddr.Column), static_cast<SCROW>(aAddr.Row), aAddr.Sheet);
1155 throw RuntimeException(
"Failed to get DPObject", static_cast<cppu::OWeakObject*>(
this));
1166 throw RuntimeException(
"Failed to get DPObject", static_cast<cppu::OWeakObject*>(
this));
1169 throw RuntimeException(
"Failed to get ViewShell", static_cast<cppu::OWeakObject*>(
this));
1171 Sequence<DataPilotFieldFilter> aFilters;
1173 ScAddress(static_cast<SCCOL>(aAddr.Column), static_cast<SCROW>(aAddr.Row), aAddr.Sheet), aFilters);
1180 if (nType < 0 || nType > DataPilotOutputRangeType::RESULT)
1181 throw IllegalArgumentException(
"nType must be between 0 and " +
1182 OUString::number(DataPilotOutputRangeType::RESULT) +
", got " + OUString::number(nType),
1183 static_cast<cppu::OWeakObject*>(
this), 0);
1185 CellRangeAddress aRet;
1210 for ( sal_uInt16
n=nCount;
n--; )
1213 if ( rObj == aListener )
1229 if (
auto pDataPilotHint = dynamic_cast<const ScDataPilotModifiedHint*>(&rHint) )
1231 if (pDataPilotHint->GetName() ==
aName)
1234 else if (
auto pRefHint = dynamic_cast<const ScUpdateRefHint*>(&rHint) )
1239 pRefHint->GetDx(), pRefHint->GetDy(), pRefHint->GetDz() ) &&
1240 aRanges.
size() == 1 )
1251 lang::EventObject
aEvent;
1252 aEvent.Source.set(static_cast<cppu::OWeakObject*>(
this));
1257 for (
const uno::Reference<util::XModifyListener> & xModifyListener :
aModifyListeners)
1263 mpDPObject(new
ScDPObject(&rDocSh.GetDocument()))
1290 OSL_FAIL(
"replace DPObject should not happen");
1327 maFieldId( rFieldId )
1342 mxParent->SetDPObject( pDPObject );
1349 if( ppDPObject ) *ppDPObject = pDPObj;
1353 return pSaveData->GetDataLayoutDimension();
1361 sal_Int32 nFoundIdx = 0;
1362 for (
auto const& it : rDims)
1364 if (it->IsDataLayout())
1384 if (xMembersNA.is())
1387 nRet = xMembersIA->getCount();
1394 Reference< XMembersAccess > xMembersNA;
1420 static sal_Int32
lcl_GetFieldCount(
const Reference<XDimensionsSupplier>& rSource,
const Any& rOrient )
1423 throw NullPointerException();
1429 sal_Int32 nIntCount = xIntDims->getCount();
1430 for (sal_Int32
i = 0;
i < nIntCount; ++
i)
1433 const bool bMatch = xDim
1434 && (rOrient.hasValue()
1450 throw NullPointerException();
1454 sal_Int32 nDimIndex = 0;
1458 sal_Int32 nIntCount = xIntDims->getCount();
1460 for (sal_Int32
i = 0;
i < nIntCount; ++
i)
1462 xDim.set(xIntDims->getByIndex(
i), UNO_QUERY);
1463 const bool bMatch = xDim
1464 && (rOrient.hasValue()
1482 xDim.set( xIntDims->getByIndex(nDimIndex), UNO_QUERY );
1483 Reference<XNamed> xDimName( xDim, UNO_QUERY );
1484 if ( xDimName.is() )
1491 sal_Int32 nRepeat = 0;
1497 Reference<XNamed> xPrevName;
1498 for (sal_Int32
i = 0;
i < nDimIndex; ++
i)
1500 xPrevName.set( xIntDims->getByIndex(
i), UNO_QUERY );
1557 return new ScIndexEnumeration(
this,
"com.sun.star.sheet.DataPilotFieldsEnumeration");
1574 throw IndexOutOfBoundsException();
1575 return Any( xField );
1598 throw NoSuchElementException();
1599 return Any( xField );
1608 OUString* pAry = aSeq.getArray();
1611 for (
auto const& it : rDimensions)
1613 if(
maOrient.hasValue() && (it->GetOrientation() ==
maOrient.get< DataPilotFieldOrientation >()))
1615 *pAry = it->GetName();
1634 maPropSet( lcl_GetDataPilotFieldMap() )
1641 maPropSet( lcl_GetDataPilotFieldMap() ),
1658 if( pDim->IsDataLayout() )
1662 const std::optional<OUString> & pLayoutName = pDim->GetLayoutName();
1664 aName = *pLayoutName;
1666 aName = pDim->GetName();
1689 static Reference<XPropertySetInfo> aRef(
1710 uno::Sequence<sheet::GeneralFunction>
aSeq;
1711 if( aValue >>= aSeq)
1713 std::vector< ScGeneralFunction > aSubTotals(aSeq.getLength());
1714 std::transform(std::cbegin(aSeq), std::cend(aSeq), aSubTotals.begin(),
1716 const int nValAsInt =
static_cast<int>(rValue);
1724 Sequence< sal_Int16 >
aSeq;
1725 if( aValue >>= aSeq )
1727 std::vector< ScGeneralFunction > aSubTotals(aSeq.getLength());
1728 std::transform(std::cbegin(aSeq), std::cend(aSeq), aSubTotals.begin(),
1741 OUString sCurrentPage;
1742 if (aValue >>= sCurrentPage)
1756 DataPilotFieldAutoShowInfo aInfo;
1757 if (aValue >>= aInfo)
1767 DataPilotFieldLayoutInfo aInfo;
1768 if (aValue >>= aInfo)
1778 DataPilotFieldReference aRef;
1779 if (aValue >>= aRef)
1789 DataPilotFieldSortInfo aInfo;
1790 if (aValue >>= aInfo)
1800 DataPilotFieldGroupInfo aInfo;
1801 if (aValue >>= aInfo)
1815 if (aValue >>= sName)
1827 sheet::GeneralFunction eVal;
1829 if (nFunction == sheet::GeneralFunction2::MEDIAN)
1831 eVal = sheet::GeneralFunction_NONE;
1835 eVal =
static_cast<sheet::GeneralFunction
>(nFunction);
1844 uno::Sequence<sheet::GeneralFunction> aNewSeq(aSeq.getLength());
1845 std::transform(aSeq.begin(), aSeq.end(), aNewSeq.getArray(),
1846 [](sal_Int16 nFunc) -> sheet::GeneralFunction {
1847 if (nFunc == sheet::GeneralFunction2::MEDIAN)
1848 return sheet::GeneralFunction_NONE;
1849 return static_cast<sheet::GeneralFunction
>(nFunc);
1860 aRet <<= OUString();
1891 const DataPilotFieldSortInfo* pInfo =
getSortInfo();
1927 return pDim ? pDim->
GetOrientation() : DataPilotFieldOrientation_HIDDEN;
1933 if (
maOrient.hasValue() && (eNew ==
maOrient.get< DataPilotFieldOrientation >()))
1948 (eNew == DataPilotFieldOrientation_DATA) )
1955 sal_Int32 nFound = 0;
1957 for (
auto const& it : rDimensions)
1961 if ( it->GetOrientation() == DataPilotFieldOrientation_HIDDEN )
1994 if( pDim->GetOrientation() != DataPilotFieldOrientation_DATA )
1997 tools::Long nSubCount = pDim->GetSubTotalsCount();
1998 if ( nSubCount > 0 )
1999 eRet =
static_cast<sal_Int16
>(pDim->GetSubTotalFunc(0));
2003 eRet =
static_cast<sal_Int16
>(pDim->GetFunction());
2019 std::vector<ScGeneralFunction> nSubTotalFuncs;
2022 nSubTotalFuncs.push_back( eNewFunc );
2034 Sequence< sal_Int16 > aRet;
2037 if( pDim->GetOrientation() != DataPilotFieldOrientation_DATA )
2040 sal_Int32
nCount =
static_cast< sal_Int32
>( pDim->GetSubTotalsCount() );
2043 aRet.realloc( nCount );
2044 auto pRet = aRet.getArray();
2045 for( sal_Int32 nIdx = 0; nIdx < nCount; ++nIdx )
2046 pRet[ nIdx ] = static_cast<sal_Int16>(pDim->GetSubTotalFunc( nIdx ));
2063 sal_Int32
nCount = rSubtotals.size();
2067 std::vector<ScGeneralFunction> nTmpFuncs;
2070 nTmpFuncs.push_back( rSubtotals[ 0 ] );
2074 else if( nCount > 1 )
2077 ::std::vector< ScGeneralFunction > aSubt;
2078 for( sal_Int32 nIdx = 0; nIdx < nCount; ++nIdx )
2084 if( ::std::find( aSubt.begin(), aSubt.end(), eFunc ) == aSubt.end() )
2085 aSubt.push_back( eFunc );
2101 pDim->SetCurrentPage( &rPage );
2118 const OUString aPage;
2139 pDim->SetAutoShowInfo( pInfo );
2157 pDim->SetLayoutInfo( pInfo );
2175 pDim->SetReferenceValue( pInfo );
2193 pDim->SetSortInfo( pInfo );
2211 pDim->SetShowEmpty( bShow );
2229 pDim->SetRepeatItemLabels( bShow );
2240 return pDimData->GetNamedGroupDim( pDim->GetName() ) || pDimData->GetNumGroupDim( pDim->GetName() );
2247 DataPilotFieldGroupInfo aInfo;
2256 aInfo.GroupBy = pGroupDim->GetDatePart();
2262 aInfo.SourceField.set( xFields->getByName( pGroupDim->GetSourceDimName() ), UNO_QUERY );
2269 if( pGroupDim->GetDatePart() == 0 )
2273 for( sal_Int32 nIdx = 0,
nCount = pGroupDim->GetGroupCount(); nIdx <
nCount; ++nIdx )
2278 for( sal_Int32 nMemIdx = 0, nMemCount = rGroup.
GetElementCount(); nMemIdx < nMemCount; ++nMemIdx )
2281 aGroups.push_back( aGroup );
2288 if (pNumGroupDim->GetDatePart())
2291 aInfo.GroupBy = pNumGroupDim->GetDatePart();
2311 if( pInfo && lclCheckMinMaxStep( *pInfo ) )
2319 aInfo.
mfEnd = pInfo->End;
2320 aInfo.
mfStep = pInfo->Step;
2321 Reference< XNamed > xNamed( pInfo->SourceField, UNO_QUERY );
2325 if( pInfo->GroupBy )
2329 Reference<XIndexAccess> xIndex(pInfo->Groups, UNO_QUERY);
2332 sal_Int32
nCount(xIndex->getCount());
2335 Reference<XNamed> xGroupNamed(xIndex->getByIndex(
i), UNO_QUERY);
2336 if (xGroupNamed.is())
2339 Reference<XIndexAccess> xGroupIndex(xGroupNamed, UNO_QUERY);
2340 if (xGroupIndex.is())
2342 sal_Int32 nItemCount(xGroupIndex->getCount());
2343 for (sal_Int32 j = 0; j < nItemCount; ++j)
2345 Reference<XNamed> xItemNamed(xGroupIndex->getByIndex(j), UNO_QUERY);
2346 if (xItemNamed.is())
2347 aItem.AddElement(xItemNamed->getName());
2350 aGroupDim.AddGroupItem(aItem);
2372 else if (pInfo->GroupBy)
2400 if( !rItems.hasElements() )
2401 throw IllegalArgumentException(
"rItems is empty", static_cast<cppu::OWeakObject*>(
this), 0);
2403 Reference< XMembersAccess > xMembers =
GetMembers();
2406 SAL_WARN(
"sc.ui",
"Cannot access members of the field object.");
2407 throw RuntimeException(
"Cannot access members of the field object", static_cast<cppu::OWeakObject*>(
this));
2415 throw IllegalArgumentException(
"There is no member with name \"" +
aEntryName +
"\"", static_cast<cppu::OWeakObject*>(
this), 0);
2419 Reference< XDataPilotField > xRet;
2424 const OUString& aDimName = pDim->
GetName();
2430 OUString aBaseDimName( aDimName );
2432 if ( pBaseGroupDim )
2444 if ( pGroupDimension )
2448 if ( pBaseGroupDim )
2463 std::unique_ptr<ScDPSaveGroupDimension> pNewGroupDim;
2464 if ( !pGroupDimension )
2470 pGroupDimension = pNewGroupDim.get();
2472 if ( pBaseGroupDim )
2482 for (
tools::Long nGroup = 0; nGroup < nGroupCount; nGroup++ )
2502 if ( pBaseGroupDim )
2520 pNewGroupDim.reset();
2523 pGroupDimension =
nullptr;
2527 if ( pSaveDimension->
GetOrientation() == DataPilotFieldOrientation_HIDDEN )
2540 if( !sNewDim.isEmpty() )
2547 xRet.set(xFields->getByName(sNewDim), UNO_QUERY);
2548 SAL_WARN_IF(!xRet.is(),
"sc.ui",
"there is a name, so there should be also a field");
2550 catch (
const container::NoSuchElementException&)
2553 SAL_WARN(
"sc.ui",
"Cannot find field with that name: " + sNewDim +
".");
2555 throw css::lang::WrappedTargetRuntimeException(
2556 "Cannot find field with name \"" + sNewDim +
"\"",
2557 static_cast<cppu::OWeakObject*>(
this), anyEx );
2567 using namespace ::com::sun::star::sheet::DataPilotFieldGroupBy;
2569 if( !rInfo.HasDateValues )
2570 throw IllegalArgumentException(
"HasDateValues is not set", static_cast<cppu::OWeakObject*>(
this), 0);
2571 if( !lclCheckMinMaxStep( rInfo ) )
2572 throw IllegalArgumentException(
"min/max/step", static_cast<cppu::OWeakObject*>(
this), 0);
2575 if( (rInfo.GroupBy == 0) || (rInfo.GroupBy > YEARS) || ((rInfo.GroupBy & (rInfo.GroupBy - 1)) != 0) )
2576 throw IllegalArgumentException(
"Invalid GroupBy value: " + OUString::number(rInfo.GroupBy), static_cast<cppu::OWeakObject*>(
this), 0);
2579 if( rInfo.Step >= ((rInfo.GroupBy == DAYS) ? 32768.0 : 1.0) )
2580 throw IllegalArgumentException(
"Invalid step value: " + OUString::number(rInfo.Step), static_cast<cppu::OWeakObject*>(
this), 0);
2582 OUString aGroupDimName;
2588 aInfo.
mbDateValues = (rInfo.GroupBy == DAYS) && (rInfo.Step >= 1.0);
2592 aInfo.
mfEnd = rInfo.End;
2593 aInfo.
mfStep = std::trunc( rInfo.Step );
2601 const OUString& rDimName = pDim->GetName();
2603 OUString aSrcDimName = pGroupDim ? pGroupDim->
GetSourceDimName() : rDimName;
2612 if( bHasNamedGrouping || bHasNumGrouping )
2613 throw IllegalArgumentException();
2636 if( nDateParts == 0 )
2642 else if( (nDateParts & rInfo.GroupBy) == 0 )
2651 if( rSaveDim.
GetOrientation() == DataPilotFieldOrientation_HIDDEN )
2666 Reference< XDataPilotField > xRet;
2667 if( !aGroupDimName.isEmpty() )
2671 xRet.set( xFields->getByName( aGroupDimName ), UNO_QUERY );
2684 if( !rElement.hasValue() )
2689 if( rElement >>= aSeq )
2691 if( aSeq.hasElements() )
2692 rMembers.insert( rMembers.end(), std::cbegin(aSeq), std::cend(aSeq) );
2697 Reference< XIndexAccess > xItemsIA( rElement, UNO_QUERY );
2700 for( sal_Int32 nIdx = 0, nCount = xItemsIA->getCount(); nIdx <
nCount; ++nIdx )
2704 Reference< XNamed > xItemName( xItemsIA->getByIndex( nIdx ), UNO_QUERY_THROW );
2705 rMembers.push_back( xItemName->getName() );
2722 maGroups(
std::move(rGroups) )
2736 throw NoSuchElementException();
2746 aSeq.realloc( static_cast< sal_Int32 >(
maGroups.size() ) );
2747 OUString*
pName = aSeq.getArray();
2748 for(
const auto& rGroup :
maGroups )
2750 *pName = rGroup.maName;
2769 if( rName.isEmpty() )
2770 throw IllegalArgumentException(
"Name is empty", static_cast<cppu::OWeakObject*>(
this), 0);
2774 throw NoSuchElementException(
"Name \"" + rName +
"\" not found", static_cast<cppu::OWeakObject*>(
this));
2778 if( !lclExtractGroupMembers( aMembers, rElement ) )
2779 throw IllegalArgumentException(
"Invalid element object", static_cast<cppu::OWeakObject*>(
this), 0);
2782 aIt->maMembers.swap( aMembers );
2791 if( rName.isEmpty() )
2792 throw IllegalArgumentException(
"Name is empty", static_cast<cppu::OWeakObject*>(
this), 0);
2796 throw ElementExistException(
"Name \"" + rName +
"\" already exists", static_cast<cppu::OWeakObject*>(
this));
2800 if( !lclExtractGroupMembers( aMembers, rElement ) )
2801 throw IllegalArgumentException(
"Invalid element object", static_cast<cppu::OWeakObject*>(
this), 0);
2814 if( rName.isEmpty() )
2815 throw IllegalArgumentException(
"Name is empty", static_cast<cppu::OWeakObject*>(
this), 0);
2819 throw NoSuchElementException(
"Name \"" + rName +
"\" not found", static_cast<cppu::OWeakObject*>(
this));
2829 return static_cast< sal_Int32
>(
maGroups.size() );
2835 if ((nIndex < 0) || (nIndex >= static_cast< sal_Int32 >(
maGroups.size() )))
2836 throw IndexOutOfBoundsException();
2845 return new ScIndexEnumeration(
this,
"com.sun.star.sheet.DataPilotFieldGroupsEnumeration" );
2868 throw RuntimeException(
"Field Group with name \"" + rName +
"\" not found", static_cast<cppu::OWeakObject*>(
this));
2878 throw RuntimeException(
"Field Group with name \"" + rOldName +
"\" not found", static_cast<cppu::OWeakObject*>(
this));
2880 if( (aNewIt !=
maGroups.end()) && (aNewIt != aOldIt) )
2881 throw RuntimeException(
"Field Group with name \"" + rOldName +
"\" already exists", static_cast<cppu::OWeakObject*>(
this));
2882 aOldIt->maName = rNewName;
2888 [&rName](
const ScFieldGroup& rGroup) {
return rGroup.maName == rName; });
2893 OUString lclExtractMember(
const Any& rElement )
2895 if( rElement.has< OUString >() )
2896 return rElement.get< OUString >();
2898 Reference< XNamed > xNamed( rElement, UNO_QUERY );
2900 return xNamed->getName();
2909 maGroupName( rGroupName )
2923 ScFieldGroupMembers::iterator aIt = ::std::find( rMembers.begin(), rMembers.end(), rName );
2924 if( aIt == rMembers.end() )
2925 throw NoSuchElementException(
"Name \"" + rName +
"\" not found", static_cast<cppu::OWeakObject*>(
this));
2932 return ::comphelper::containerToSequence(
mxParent->getFieldGroup(
maGroupName ).maMembers );
2939 return ::std::find( rMembers.begin(), rMembers.end(), rName ) != rMembers.end();
2949 OUString aNewName = lclExtractMember( rElement );
2950 if( rName.isEmpty() || aNewName.isEmpty() )
2951 throw IllegalArgumentException(
"Name is empty", static_cast<cppu::OWeakObject*>(
this), 0);
2952 if( rName == aNewName )
2956 ScFieldGroupMembers::iterator aOldIt = ::std::find( rMembers.begin(), rMembers.end(), rName );
2957 ScFieldGroupMembers::iterator aNewIt = ::std::find( rMembers.begin(), rMembers.end(), aNewName );
2958 if( aOldIt == rMembers.end() )
2959 throw NoSuchElementException(
"Name \"" + rName +
"\" not found", static_cast<cppu::OWeakObject*>(
this));
2960 if( aNewIt != rMembers.end() )
2961 throw IllegalArgumentException(
"Name \"" + rName +
"\" already exists", static_cast<cppu::OWeakObject*>(
this), 0);
2972 if( rName.isEmpty() )
2973 throw IllegalArgumentException(
"Name is empty", static_cast<cppu::OWeakObject*>(
this), 0);
2976 ScFieldGroupMembers::iterator aIt = ::std::find( rMembers.begin(), rMembers.end(), rName );
2977 if( aIt != rMembers.end() )
2978 throw IllegalArgumentException(
"Name \"" + rName +
"\" already exists", static_cast<cppu::OWeakObject*>(
this), 0);
2979 rMembers.push_back( rName );
2986 if( rName.isEmpty() )
2987 throw IllegalArgumentException(
"Name is empty", static_cast<cppu::OWeakObject*>(
this), 0);
2989 ScFieldGroupMembers::iterator aIt = ::std::find( rMembers.begin(), rMembers.end(), rName );
2990 if( aIt == rMembers.end() )
2991 throw NoSuchElementException(
"Name \"" + rName +
"\" not found", static_cast<cppu::OWeakObject*>(
this));
2992 rMembers.erase( aIt );
3000 return static_cast< sal_Int32
>(
mxParent->getFieldGroup(
maGroupName ).maMembers.size() );
3007 if ((nIndex < 0) || (nIndex >= static_cast< sal_Int32 >( rMembers.size() )))
3008 throw IndexOutOfBoundsException();
3017 return new ScIndexEnumeration(
this,
"com.sun.star.sheet.DataPilotFieldGroupEnumeration" );
3101 sal_Int32 nCount = xMembersIndex->getCount();
3102 sal_Int32 nItem = 0;
3103 while (nItem < nCount)
3105 Reference<XNamed> xMember(xMembersIndex->getByIndex(nItem), UNO_QUERY);
3106 if (xMember.is() && (aName == xMember->getName()))
3112 throw NoSuchElementException(
"Name \"" + aName +
"\" not found", static_cast<cppu::OWeakObject*>(
this));
3129 bool bFound =
false;
3134 sal_Int32 nCount = xMembersIndex->getCount();
3135 sal_Int32 nItem = 0;
3136 while (nItem < nCount && !bFound )
3138 Reference<XNamed> xMember(xMembersIndex->getByIndex(nItem), UNO_QUERY);
3139 if (xMember.is() && aName == xMember->getName())
3169 throw IndexOutOfBoundsException();
3170 return Any( xItem );
3186 maPropSet( lcl_GetDataPilotItemMap() ),
3204 sal_Int32 nCount = xMembersIndex->getCount();
3207 Reference<XNamed> xMember(xMembersIndex->getByIndex(
mnIndex), UNO_QUERY);
3208 sRet = xMember->getName();
3219 Reference< XPropertySetInfo >
3223 static Reference<XPropertySetInfo> aRef =
3237 if( !xMembers.is() )
3241 sal_Int32 nCount = xMembersIndex->getCount();
3245 Reference<XNamed> xMember(xMembersIndex->getByIndex(
mnIndex), UNO_QUERY);
3246 OUString
sName(xMember->getName());
3251 bool bGetNewIndex =
false;
3258 sal_Int32 nNewPos = 0;
3259 if ( !( aValue >>= nNewPos ) || nNewPos < 0 || nNewPos >= nCount )
3260 throw IllegalArgumentException();
3264 bGetNewIndex =
true;
3272 sal_Int32 nItemCount = aItemNames.getLength();
3273 for (sal_Int32 nItem=0; nItem<nItemCount; ++nItem)
3274 if (aItemNames[nItem] ==
sName)
3289 sal_Int32 nCount = xMembersIndex->getCount();
3292 Reference< XNamed > xMember( xMembersIndex->getByIndex(
mnIndex ), UNO_QUERY );
3293 OUString
sName( xMember->getName() );
3297 if (pMember && pMember->HasShowDetails())
3304 if( xMemberProps.is() )
3312 if (pMember && pMember->HasIsVisible())
3314 aRet <<= !pMember->GetIsVisible();
3319 if( xMemberProps.is() )
3336 const OUString& ,
const Reference< XPropertyChangeListener >& )
3341 const OUString& ,
const Reference< XPropertyChangeListener >& )
3346 const OUString& ,
const Reference< XVetoableChangeListener >& )
3351 const OUString& ,
const Reference< XVetoableChangeListener >& )
static OUString lcl_CreatePivotName(ScDocShell *pDocShell)
constexpr OUStringLiteral SC_DATALAYOUT_NAME
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
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.
OUString ScResId(TranslateId aId)
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
rtl::Reference< ScDataPilotFieldObj > GetObjectByName_Impl(const OUString &rName) 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 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
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
void SetSubTotals(std::vector< ScGeneralFunction > &&rFuncs)
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
ScDataPilotTablesObj(ScDocShell &rDocSh, SCTAB nT)
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
#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
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
void RemoveDimensionByName(const OUString &rName)
bool RemovePivotTable(const ScDPObject &rDPObj, bool bRecord, bool bApi)
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.
ScDataPilotDescriptor(ScDocShell &rDocSh)
ScDataPilotFieldGroupItemObj(ScDataPilotFieldGroupObj &rParent, const OUString &rName)
void ReplaceGroupDimension(const ScDPSaveGroupDimension &rGroupDim)
virtual css::uno::Any SAL_CALL getByName(const OUString &aName) override
virtual void SAL_CALL acquire() noexcept 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)
static SC_DLLPUBLIC OUString getSourceDimensionName(std::u16string_view rName)
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
const css::uno::Sequence< sal_Int8 > & getSeq() const
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
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
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()
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
rtl::Reference< ScDataPilotTableObj > GetObjectByName_Impl(const OUString &aName)
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)
css::uno::Sequence< T > concatSequences(const css::uno::Sequence< T > &rS1, const Ss &...rSn)
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
rtl::Reference< ScDataPilotTableObj > GetObjectByIndex_Impl(sal_Int32 nIndex)
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
rtl::Reference< ScDataPilotFieldObj > GetObjectByIndex_Impl(sal_Int32 nIndex) 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()
virtual void SAL_CALL release() noexcept override
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
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
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
sal_Int64 getSomethingImpl(const css::uno::Sequence< sal_Int8 > &rId, T *pThis, FallbackToGetSomethingOf< Base >={})
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.
ScDataPilotFieldGroupsObj(ScFieldGroups &&rGroups)
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
SC_DLLPUBLIC void SetRowGrand(bool bSet)
void AddUnoListenerCall(const css::uno::Reference< css::util::XModifyListener > &rListener, const css::lang::EventObject &rEvent)
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)
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.
ScDataPilotTableObj(ScDocShell &rDocSh, SCTAB nT, const OUString &rN)
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)
ScDataPilotDescriptorBase(ScDocShell &rDocSh)