28 #include <osl/diagnose.h>
29 #include <rtl/math.hxx>
39 #include <unonames.hxx>
46 #include <com/sun/star/beans/PropertyAttribute.hpp>
47 #include <com/sun/star/sheet/DataPilotFieldFilter.hpp>
48 #include <com/sun/star/sheet/DataPilotFieldReferenceType.hpp>
49 #include <com/sun/star/sheet/DataPilotFieldSortMode.hpp>
50 #include <com/sun/star/sheet/DataPilotFieldGroupBy.hpp>
51 #include <com/sun/star/sheet/DataPilotFieldAutoShowInfo.hpp>
52 #include <com/sun/star/sheet/GeneralFunction2.hpp>
53 #include <com/sun/star/sheet/TableFilterField.hpp>
56 #include <com/sun/star/i18n/CalendarDisplayIndex.hpp>
60 using ::com::sun::star::uno::Sequence;
61 using ::com::sun::star::uno::Any;
62 using ::com::sun::star::sheet::DataPilotFieldAutoShowInfo;
64 #define SC_MINCOUNT_LIMIT 1000000
75 "
com.sun.star.sheet.DataPilotSourceHierarchies", "
com.sun.star.sheet.DataPilotSourceHierarcies" )
98 bIgnoreEmptyRows( false ),
99 bRepeatIfEmpty( false ),
101 bResultOverflow( false ),
102 bPageFiltered( false )
127 return sheet::DataPilotFieldOrientation_COLUMN;
130 return sheet::DataPilotFieldOrientation_ROW;
133 return sheet::DataPilotFieldOrientation_DATA;
136 return sheet::DataPilotFieldOrientation_PAGE;
138 return sheet::DataPilotFieldOrientation_HIDDEN;
166 std::vector<sal_Int32>::const_iterator it, itBeg =
maColDims.begin(), itEnd =
maColDims.end();
167 it = std::find(itBeg, itEnd, nColumn);
169 return std::distance(itBeg, it);
173 it = std::find(itBeg, itEnd, nColumn);
175 return std::distance(itBeg, it);
179 it = std::find(itBeg, itEnd, nColumn);
181 return std::distance(itBeg, it);
185 it = std::find(itBeg, itEnd, nColumn);
187 return std::distance(itBeg, it);
194 bool testSubTotal(
bool& rAllowed, sal_Int32 nColumn,
const std::vector<sal_Int32>& rDims,
ScDPSource* pSource )
197 std::vector<sal_Int32>::const_iterator it = rDims.begin(), itEnd = rDims.end();
198 for (; it != itEnd; ++it)
223 void removeDim( sal_Int32 nRemove, std::vector<sal_Int32>& rDims )
225 std::vector<sal_Int32>::iterator it = std::find(rDims.begin(), rDims.end(), nRemove);
226 if (it != rDims.end())
235 bool bAllowed =
true;
236 if ( testSubTotal(bAllowed, nColumn,
maColDims,
this) )
238 if ( testSubTotal(bAllowed, nColumn,
maRowDims,
this) )
256 case sheet::DataPilotFieldOrientation_COLUMN:
259 case sheet::DataPilotFieldOrientation_ROW:
262 case sheet::DataPilotFieldOrientation_DATA:
265 case sheet::DataPilotFieldOrientation_PAGE:
269 case sheet::DataPilotFieldOrientation_HIDDEN:
272 OSL_FAIL(
"ScDPSource::SetOrientation: unexpected orientation" );
313 OSL_ENSURE(
pDimensions.is(),
"AddDuplicated without dimensions?" );
321 if (pDim && pDim->
getName() == rNewName)
337 if ( nDim <= pData->GetColumnCount() )
340 if ( nDim < pDimensions->getCount() )
351 OSL_FAIL(
"GetSourceDim: wrong dim");
362 throw uno::RuntimeException();
371 uno::Sequence< uno::Sequence<sheet::DataResult> >
aSeq( nRowCount );
372 uno::Sequence<sheet::DataResult>* pRowAry = aSeq.getArray();
373 for (sal_Int32 nRow = 0; nRow < nRowCount; nRow++)
375 uno::Sequence<sheet::DataResult> aColSeq( nColCount );
377 pRowAry[nRow] = aColSeq;
390 const uno::Sequence<sheet::DataPilotFieldFilter>& aFilters )
397 if (pVals && !pVals->empty())
399 size_t n = pVals->size();
400 uno::Sequence<double> aRet(n);
401 for (
size_t i = 0;
i < n; ++
i)
402 aRet[
i] = (*pVals)[
i];
407 if (aFilters.getLength() == 1)
411 if (!std::isnan(fVal))
413 uno::Sequence<double> aRet(1);
419 return uno::Sequence<double>();
429 OSL_FAIL(
"not implemented");
434 OSL_FAIL(
"not implemented");
441 vector<ScDPFilteredCache::Criterion> aFilterCriteria;
442 for (
const sheet::DataPilotFieldFilter& rFilter : aFilters)
444 const OUString& aFieldName = rFilter.FieldName;
445 for (sal_Int32 nCol = 0; nCol < nColumnCount; ++nCol)
451 GetLevelsObject()->getByIndex(0)->GetMembersObject();
456 aFilterCriteria.emplace_back( );
457 aFilterCriteria.back().mnFieldIndex = nCol;
458 aFilterCriteria.back().mpFilter =
459 std::make_shared<ScDPFilteredCache::SingleFilter>(aItem);
471 Sequence< Sequence<Any> > aTabData;
472 std::unordered_set<sal_Int32> aCatDims;
483 if (
pResData->GetMeasureCount() == 1 )
485 bool bTotalResult =
false;
543 bool bWasShowAll =
true;
549 if ( nPos+1 < nLevels && ppDim[nPos] == ppDim[nPos+1] )
551 OSL_FAIL(
"lcl_CountMinMembers: multiple levels from one dimension not implemented");
556 if ( ppDim[nPos]->getIsDataLayoutDimension() )
559 nDataCount = ppLevel[nPos]->GetMembersObject()->getCount();
560 if ( nDataCount == 0 )
563 else if ( bWasShowAll )
566 if ( !ppLevel[nPos]->getShowEmpty() )
574 tools::Long nThisCount = ppLevel[nPos]->GetMembersObject()->getMinMembers();
575 if ( nThisCount == 0 )
582 if ( nTotal >=
LONG_MAX / nThisCount )
584 nTotal *= nThisCount;
590 if ( nTotal >=
LONG_MAX / nDataCount )
592 nTotal *= nDataCount;
600 for (
const auto& rDimIndex : rDims)
614 for (sal_Int32 j = 0; j < nCount; ++j)
645 class CategoryDimInserter
648 std::unordered_set<sal_Int32>& mrCatDims;
650 CategoryDimInserter(
ScDPSource& rSource, std::unordered_set<sal_Int32>& rCatDims) :
652 mrCatDims(rCatDims) {}
657 mrCatDims.insert(nDim);
665 std::unordered_set<sal_Int32> aCatDims;
667 CategoryDimInserter aInserter(*
this, aCatDims);
672 rCatDims.swap(aCatDims);
685 SAL_WARN(
"sc.core",
"tried to apply page field filters several times");
693 vector<ScDPFilteredCache::Criterion> aCriteria;
700 GetLevelsObject()->getByIndex(0)->GetMembersObject();
705 aFilter.
mpFilter = std::make_shared<ScDPFilteredCache::GroupFilter>();
714 pGrpFilter->addMatchItem(
aData);
719 aCriteria.push_back(aFilter);
725 aCriteria.emplace_back();
728 r.
mpFilter = std::make_shared<ScDPFilteredCache::SingleFilter>(rData);
730 if (!aCriteria.empty())
732 std::unordered_set<sal_Int32> aCatDims;
745 if (
maDataDims.size() > 1 && ( nDataOrient != sheet::DataPilotFieldOrientation_COLUMN &&
746 nDataOrient != sheet::DataPilotFieldOrientation_ROW ) )
750 nDataOrient = sheet::DataPilotFieldOrientation_ROW;
756 vector<OUString> aDataNames;
757 vector<sheet::DataPilotFieldReference> aDataRefValues;
758 vector<ScSubTotalFunc> aDataFunctions;
759 vector<sheet::DataPilotFieldOrientation> aDataRefOrient;
765 bool bLateInit =
true;
786 sheet::DataPilotFieldOrientation nDataRefOrient = sheet::DataPilotFieldOrientation_HIDDEN;
787 sal_Int32 eRefType = aDataRefValues.back().ReferenceType;
788 if ( eRefType == sheet::DataPilotFieldReferenceType::ITEM_DIFFERENCE ||
789 eRefType == sheet::DataPilotFieldReferenceType::ITEM_PERCENTAGE ||
790 eRefType == sheet::DataPilotFieldReferenceType::ITEM_PERCENTAGE_DIFFERENCE ||
791 eRefType == sheet::DataPilotFieldReferenceType::RUNNING_TOTAL )
805 aDataRefOrient.push_back(nDataRefOrient);
807 aDataNames.push_back(pDim->
getName());
826 pResData->SetMeasureData(aDataFunctions, aDataRefValues, aDataRefOrient, aDataNames);
827 pResData->SetDataLayoutOrientation(nDataOrient);
830 bool bHasAutoShow =
false;
848 tools::Long nColDimCount2 =
maColDims.size() - (nDataLayoutOrient == sheet::DataPilotFieldOrientation_COLUMN ? 1 : 0);
849 tools::Long nRowDimCount2 =
maRowDims.size() - (nDataLayoutOrient == sheet::DataPilotFieldOrientation_ROW ? 1 : 0);
851 bool bShowRowGrand =
bRowGrand && nRowDimCount2 > 0;
864 if ( nRowLevelCount > 0 )
867 aInfo.
aRowLevels[nRowLevelCount-1]->SetEnableLayout(
false );
874 for (
const auto& rDimIndex : maPageDims)
958 std::vector<sal_Int32>* pDimIndex =
nullptr;
959 switch (nOrientation)
961 case sheet::DataPilotFieldOrientation_COLUMN:
964 case sheet::DataPilotFieldOrientation_ROW:
967 case sheet::DataPilotFieldOrientation_DATA:
970 case sheet::DataPilotFieldOrientation_PAGE:
974 OSL_FAIL(
"ScDPSource::FillLevelList: unexpected orientation" );
979 OSL_FAIL(
"invalid orientation");
984 for (
const auto& rIndex : *pDimIndex)
987 OSL_ENSURE( pDim->
getOrientation() == nOrientation,
"orientations are wrong" );
995 sal_Int32 nLevCount = pLevels->
getCount();
996 for (sal_Int32 nLev=0; nLev<nLevCount; nLev++)
999 rList.push_back(pLevel);
1023 pColResults.reset(
new uno::Sequence<sheet::MemberResult>[nColLevelCount]);
1029 true,
nullptr, nullptr );
1037 pRowResults.reset(
new uno::Sequence<sheet::MemberResult>[nRowLevelCount] );
1043 true,
nullptr, nullptr );
1053 for (i=0; i<nColCount; i++)
1056 if ( pColLevel == pLevel )
1060 for (i=0; i<nRowCount; i++)
1063 if ( pRowLevel == pLevel )
1074 using beans::PropertyAttribute::READONLY;
1087 {
u"", 0, css::uno::Type(), 0, 0 }
1089 static uno::Reference<beans::XPropertySetInfo> aRef =
1107 if (aValue >>= aName)
1112 OSL_FAIL(
"unknown property");
1131 aRet <<= static_cast<sal_Int32>(
maRowDims.size());
1133 aRet <<= static_cast<sal_Int32>(
maColDims.size());
1135 aRet <<= static_cast<sal_Int32>(
maDataDims.size());
1143 OSL_FAIL(
"unknown property");
1149 #if DUMP_PIVOT_TABLE
1152 std::cout <<
"+++++ column root" << std::endl;
1154 std::cout <<
"+++++ row root" << std::endl;
1182 sal_Int32 nCopy = std::min( nNewCount,
nDimCount );
1185 for (i=0; i<nCopy; i++)
1187 for (i=nCopy; i<nNewCount; i++)
1200 for (sal_Int32
i=0;
i<nCount;
i++)
1203 uno::Reference<container::XNamed> xNamed =
getByIndex(
i);
1209 throw container::NoSuchElementException();
1216 uno::Sequence<OUString>
aSeq(nCount);
1217 OUString* pArr = aSeq.getArray();
1253 if ( nIndex >= 0 && nIndex <
nDimCount )
1261 if ( !
ppDims[nIndex].is() )
1266 return ppDims[nIndex].get();
1277 bHasSelectedPage( false ),
1278 mbHasHiddenMember(false)
1314 if (!
aName.isEmpty())
1343 OSL_ENSURE(
nSourceDim < 0,
"recursive duplicate - not implemented" );
1346 OUString aNewName =
aName;
1350 pNew->
aName = aNewName;
1374 if ( nLevel < nLevCount )
1420 {
u"", 0, css::uno::Type(), 0, 0 }
1422 static uno::Reference<beans::XPropertySetInfo> aRef =
1435 sheet::DataPilotFieldOrientation eEnum;
1436 if (aValue >>= eEnum)
1441 sheet::GeneralFunction eEnum;
1442 if (aValue >>= eEnum)
1443 setFunction( static_cast<ScGeneralFunction>(eEnum) );
1448 if (aValue >>= eEnum)
1449 setFunction( static_cast<ScGeneralFunction>(eEnum) );
1456 uno::Sequence<sheet::TableFilterField>
aSeq;
1457 if (aValue >>= aSeq)
1459 sal_Int32
nLength = aSeq.getLength();
1466 else if ( nLength == 1 )
1468 const sheet::TableFilterField& rField = aSeq[0];
1469 if ( rField.Field == 0 && rField.Operator == sheet::FilterOperator_EQUAL && !rField.IsNumeric )
1479 OSL_FAIL(
"Filter property is not a single string");
1480 throw lang::IllegalArgumentException();
1487 if (aValue >>= aTmpName)
1493 if (aValue >>= aTmpName)
1504 OSL_FAIL(
"unknown property");
1526 const int nValAsInt =
static_cast<int>(nVal);
1527 assert(nValAsInt >=
int(css::sheet::GeneralFunction_NONE) &&
1528 nValAsInt <=
int(css::sheet::GeneralFunction_VARP));
1529 aRet <<= static_cast<sheet::GeneralFunction>(nValAsInt);
1534 aRet <<= static_cast<sal_Int16>(eVal);
1542 sal_Int32 nFormat = 0;
1550 case sheet::DataPilotFieldReferenceType::ITEM_PERCENTAGE:
1551 case sheet::DataPilotFieldReferenceType::ITEM_PERCENTAGE_DIFFERENCE:
1552 case sheet::DataPilotFieldReferenceType::ROW_PERCENTAGE:
1553 case sheet::DataPilotFieldReferenceType::COLUMN_PERCENTAGE:
1554 case sheet::DataPilotFieldReferenceType::TOTAL_PERCENTAGE:
1557 case sheet::DataPilotFieldReferenceType::INDEX:
1568 uno::Reference<container::XNamed> xOriginal;
1582 sheet::TableFilterField aField( sheet::FilterConnection_AND, 0,
1584 aRet <<= uno::Sequence<sheet::TableFilterField>( &aField, 1 );
1587 aRet <<= uno::Sequence<sheet::TableFilterField>(0);
1597 aRet <<= sal_Int32(0);
1601 OSL_FAIL(
"unknown property");
1629 uno::Reference<container::XNamed> xNamed =
getByIndex(
i);
1635 throw container::NoSuchElementException();
1641 uno::Sequence<OUString>
aSeq(nCount);
1642 OUString* pArr = aSeq.getArray();
1740 OSL_FAIL(
"ScDPHierarchy::getName: unexpected hierarchy" );
1748 OSL_FAIL(
"not implemented");
1769 OSL_FAIL(
"wrong hierarchy");
1790 uno::Reference<container::XNamed> xNamed =
getByIndex(
i);
1796 throw container::NoSuchElementException();
1802 uno::Sequence<OUString>
aSeq(nCount);
1803 OUString* pArr = aSeq.getArray();
1837 if ( nIndex >= 0 && nIndex <
nLevCount )
1845 if ( !
ppLevs[nIndex].is() )
1850 return ppLevs[nIndex].get();
1858 class ScDPGlobalMembersOrder
1864 ScDPGlobalMembersOrder(
ScDPLevel& rLev,
bool bAsc ) :
1869 bool operator()( sal_Int32 nIndex1, sal_Int32 nIndex2 )
const;
1874 bool ScDPGlobalMembersOrder::operator()( sal_Int32 nIndex1, sal_Int32 nIndex2 )
const
1876 sal_Int32 nCompare = 0;
1878 if( nIndex1 != nIndex2 )
1880 ScDPMembers* pMembers = rLevel.GetMembersObject();
1883 nCompare = pMember1->
Compare( *pMember2 );
1885 return bAscending ? (nCompare < 0) : (nCompare > 0);
1896 bShowEmpty( false ),
1897 bEnableLayout( false ),
1898 bRepeatItemLabels( false )
1913 case sheet::DataPilotFieldSortMode::DATA:
1918 for (
tools::Long nMeasure=0; nMeasure<nMeasureCount; nMeasure++)
1930 case sheet::DataPilotFieldSortMode::MANUAL:
1931 case sheet::DataPilotFieldSortMode::NAME:
1941 bool bAscending = (
aSortInfo.Mode == sheet::DataPilotFieldSortMode::MANUAL ||
aSortInfo.IsAscending );
1942 ScDPGlobalMembersOrder aComp( *
this, bAscending );
1954 for (
tools::Long nMeasure=0; nMeasure<nMeasureCount; nMeasure++)
1987 const uno::Sequence<sheet::MemberResult>* pRes = pSource->
GetMemberResults(
this );
1991 return uno::Sequence<sheet::MemberResult>(0);
2018 OSL_FAIL(
"ScDPLevel::getName: unexpected level" );
2036 OSL_FAIL(
"ScDPLevel::getName: unexpected level" );
2040 if (!aRet.isEmpty())
2053 OSL_FAIL(
"not implemented");
2062 return uno::Sequence<sal_Int16>(0);
2083 {
u"", 0, css::uno::Type(), 0, 0 }
2085 static uno::Reference<beans::XPropertySetInfo> aRef =
2098 uno::Sequence<sheet::GeneralFunction>
aSeq;
2101 std::transform(aSeq.begin(), aSeq.end(),
aSubTotals.begin(),
2102 [](
const sheet::GeneralFunction& rFunc) -> sal_Int16 {
2103 return static_cast<sal_Int16
>(rFunc); });
2115 OSL_FAIL(
"unknown property");
2129 uno::Sequence<sheet::GeneralFunction> aNewSeq;
2130 aNewSeq.realloc(aSeq.getLength());
2131 std::transform(aSeq.begin(), aSeq.end(), aNewSeq.begin(),
2132 [](
const sal_Int16 nFunc) -> sheet::GeneralFunction {
2133 if (nFunc == sheet::GeneralFunction2::MEDIAN)
2134 return sheet::GeneralFunction_NONE;
2135 return static_cast<sheet::GeneralFunction
>(nFunc);
2159 const std::optional<OUString> & pLayoutName = pDim->
GetLayoutName();
2163 aRet <<= *pLayoutName;
2167 OSL_FAIL(
"unknown property");
2201 pLastNumData = pData;
2206 const ScDPItemData* pFirstData = GetSrcItemDataByIndex( 0 );
2207 double fFirstVal = pFirstData->
GetValue();
2208 double fLastVal = pLastNumData->
GetValue();
2211 static_cast<tools::Long>(::rtl::math::approxFloor( fFirstVal )),
2214 static_cast<tools::Long>(::rtl::math::approxFloor( fLastVal )),
2217 nMbrCount = nLastYear + 1 - nFirstYear;
2227 OSL_FAIL(
"ScDPMembers::ScDPMembers: unexpected level" );
2239 OSL_FAIL(
"ScDPMembers::ScDPMembers: unexpected level" );
2261 for (sal_Int32
i=0;
i<nCount;
i++)
2265 ScDPMembersHashMap::const_iterator aIter =
aHashMap.find( rName );
2267 return aIter->second;
2277 uno::Reference<container::XNamed> xNamed =
getByIndex(nIndex);
2283 throw container::NoSuchElementException();
2324 GetHierarchiesObject()->getByIndex(
nHier)->GetLevelsObject()->getByIndex(
nLev);
2326 const std::vector<sal_Int32>& rGlobalOrder = pLevel->
GetGlobalOrder();
2327 bool bSort = !rGlobalOrder.empty();
2330 uno::Sequence<OUString>
aSeq(nCount);
2331 OUString* pArr = aSeq.getArray();
2341 sal_Int32 nVisCount = 0;
2346 return !pMbr || (pMbr->isVisible() && pMbr->getShowDetails()); });
2359 if ( nIndex >= 0 && nIndex <
nMbrCount )
2375 sal_Int32 nGroupBy = 0;
2385 static_cast<tools::Long>(::rtl::math::approxFloor( fFirstVal )),
2388 nVal = nFirstYear + nIndex;
2394 css::i18n::CalendarDisplayIndex::DAY,
2395 sal::static_int_cast<sal_Int16>(nVal), 0 );
2401 css::i18n::CalendarDisplayIndex::MONTH,
2402 sal::static_int_cast<sal_Int16>(nVal), 0 );
2410 nGroupBy = sheet::DataPilotFieldGroupBy::YEARS;
2414 nGroupBy = sheet::DataPilotFieldGroupBy::QUARTERS;
2418 nGroupBy = sheet::DataPilotFieldGroupBy::MONTHS;
2421 nGroupBy = sheet::DataPilotFieldGroupBy::DAYS;
2426 if (aName.isEmpty())
2427 aName = OUString::number(nVal);
2448 ScDPSource* pSrc, sal_Int32 nD, sal_Int32 nH, sal_Int32 nL,
SCROW nIndex) :
2475 static_cast<tools::Long>(::rtl::math::approxFloor( pData->
GetValue() )),
2479 return pData2 && nComp == pData2->
GetValue();
2539 OSL_FAIL(
"not implemented");
2554 {
u"", 0, css::uno::Type(), 0, 0 }
2556 static uno::Reference<beans::XPropertySetInfo> aRef =
2572 if (aValue >>= aName)
2577 OSL_FAIL(
"unknown property");
2594 OSL_FAIL(
"unknown property");
2603 OSL_ENSURE(
GetData() ,
"empty ScDPTableData pointer");
2604 return (
GetData()!=
nullptr ) ? &
GetData()->GetCacheTable().getCache() : nullptr ;
2610 SAL_WARN_IF( !pData,
"sc.core",
"ScDPMember::GetItemData: what data? nDim " <<
nDim <<
", mnDataId " <<
mnDataId);
2622 if ( nIndex >= static_cast<tools::Long>(memberIds.size()) || nIndex < 0 )
OUString getDataDescription()
com sun star sheet DataPilotSourceHierarchy
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
#define SC_UNO_DP_FIELD_SUBTOTALNAME
function is determined automatically.
double getLeafResult(const css::sheet::DataPilotFieldFilter &rFilter) const
ScDPTableData * GetData()
virtual ~ScDPMember() override
#define SC_UNO_DP_IGNOREEMPTY
void SetEnableLayout(bool bSet)
virtual bool IsDateDimension(sal_Int32 nDim)=0
rtl::Reference< ScDPHierarchies > mxHierarchies
void FillLevelList(css::sheet::DataPilotFieldOrientation nOrientation, std::vector< ScDPLevel * > &rList)
const std::optional< OUString > & GetGrandTotalName() const
sal_Int32 getMinMembers() const
ScDPDimension * GetDataDimension(sal_Int32 nIndex)
ScDPHierarchy * getByIndex(tools::Long nIndex) const
virtual ~ScDPLevel() override
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
const css::sheet::DataPilotFieldAutoShowInfo & GetAutoShow() const
#define SC_UNO_DP_REFVALUE
ScDPLevels * GetLevelsObject()
virtual sal_Bool SAL_CALL hasByName(const OUString &aName) override
virtual sal_Bool SAL_CALL hasElements() override
void swap(ScDPResultTree &rOther)
std::unique_ptr< ContentProperties > pData
ScGeneralFunction nFunction
ScDPResultTree maFilterSet
void setFunction(ScGeneralFunction nNew)
std::optional< OUString > mpLayoutName
std::optional< OUString > mpGrandTotalName
sal_Int32 GetDimension() const
sal_Int32 findValue(const css::uno::Sequence< T1 > &_rList, const T2 &_rValue)
The term 'measure' here roughly equals "data dimension" ?
com sun star sheet com sun star sheet static DataPilotSourceHierarcy bool lcl_GetBoolFromAny(const uno::Any &aAny)
std::unique_ptr< ScDPResultMember > pRowResRoot
SCROW GetIdByItemData(tools::Long nDim, const ScDPItemData &rItem) const
OUString GetDataDimName(sal_Int32 nIndex)
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
virtual void SAL_CALL refresh() override
#define SC_UNO_DP_COLGRAND
#define SC_UNO_DP_SORTING
sal_Int32 getCount() const
virtual void CalcResults(CalcInfo &rInfo, bool bAutoShow)=0
const css::sheet::DataPilotFieldReference & GetReferenceValue() const
const ScDPCache * GetCache()
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
Member names that are being processed for InitFrom/LateInitFrom (needed for initialization of grouped...
::std::vector< sal_Int32 > aRowLevelDims
const ContentProperties & rData
virtual void GetDrillDownData(const std::vector< ScDPFilteredCache::Criterion > &rCriteria, const std::unordered_set< sal_Int32 > &rCatDims, css::uno::Sequence< css::uno::Sequence< css::uno::Any > > &rData)=0
void GetCategoryDimensionIndices(std::unordered_set< sal_Int32 > &rCatDims)
Compile a list of dimension indices that are either, column, row or page dimensions (i...
ScDPMembers * GetMembersObject()
ScDPDimension * AddDuplicated(std::u16string_view rNewName)
move to ScDPResultData
std::unique_ptr< css::uno::Sequence< css::sheet::MemberResult >[]> pColResults
#define SC_MINCOUNT_LIMIT
numerical values are counted.
#define SC_UNO_DP_REPEATEMPTY
#define SC_UNO_DP_FUNCTION
const ScDPItemData * GetMemberByIndex(sal_Int32 nDim, sal_Int32 nIndex)
#define SC_UNO_DP_POSITION
sum of all numerical values is calculated.
virtual const std::vector< SCROW > & GetColumnEntries(sal_Int32 nColumn)
std::vector< sal_Int32 > maPageDims
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
This class represents the cached data part of the datapilot cache table implementation.
css::sheet::DataPilotFieldLayoutInfo aLayoutInfo
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
virtual sal_Bool SAL_CALL hasElements() override
virtual void SAL_CALL setName(const OUString &aName) override
const css::uno::Sequence< css::sheet::MemberResult > * GetMemberResults(const ScDPLevel *pLevel)
#define SC_UNO_DP_GRANDTOTAL_NAME
const ValuesType * getResults(const css::uno::Sequence< css::sheet::DataPilotFieldFilter > &rFilters) const
const ScDPItemData & GetSelectedData()
::std::vector< ScDPDimension * > aColDims
exports com.sun.star. sheet
#define SC_UNO_DP_ORIGINAL
const ScDPItemData * GetSrcItemDataByIndex(SCROW nIndex)
virtual const ScDPItemData * GetMemberById(sal_Int32 nDim, sal_Int32 nId)
#define SC_UNO_DP_LAYOUTNAME
virtual sal_Bool SAL_CALL hasByName(const OUString &aName) override
rtl::Reference< ScDPDimensions > pDimensions
::std::vector< sal_Int32 > aGlobalOrder
#define SC_UNO_DP_SUBTOTAL
const std::optional< OUString > & GetSubtotalName() const
virtual OUString SAL_CALL getName() override
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
bool HasSelectedPage() const
virtual ~ScDPHierarchy() override
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
std::optional< OUString > mpSubtotalName
ScDPDimensions * GetDimensionsObject()
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
ScDPSource(ScDPTableData *pD)
multi-item (group) filter.
ScGeneralFunction getFunction() const
void SetOrientation(sal_Int32 nColumn, css::sheet::DataPilotFieldOrientation nNew)
const ScDPItemData * GetItemDataById(tools::Long nDim, SCROW nId) const
virtual void CreateCacheTable()=0
std::vector< sal_Int32 > maColDims
ScDPDimension * CreateCloneObject()
virtual OUString SAL_CALL getName() override
ScDPLevels(ScDPSource *pSrc, sal_Int32 nDim, sal_Int32 nHier)
virtual ~ScDPDimension() override
virtual css::uno::Type SAL_CALL getElementType() override
virtual ~ScDPDimensions() override
std::shared_ptr< FilterBase > mpFilter
ScDPHierarchy(ScDPSource *pSrc, sal_Int32 nDim, sal_Int32 nHier)
virtual void SetEmptyFlags(bool bIgnoreEmptyRows, bool bRepeatIfEmpty)=0
#define SC_UNO_DP_ROWFIELDCOUNT
virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getDimensions() override
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
const ::std::vector< sal_Int32 > & GetGlobalOrder() const
css::sheet::DataPilotFieldAutoShowInfo aAutoShowInfo
#define SC_UNO_DP_REPEATITEMLABELS
void FillCalcInfo(bool bIsRow, ScDPTableData::CalcInfo &rInfo, bool &bHasAutoShow)
::std::vector< ScDPLevel * > aColLevels
sal_Int32 GetSourceDim(sal_Int32 nDim)
indexes when calculating running totals
::std::vector< sal_Int32 > aColLevelDims
virtual void SAL_CALL setName(const OUString &aName) override
constexpr OUStringLiteral aData
#define SC_DAPI_QUARTER_LEVELS
virtual sal_Bool SAL_CALL hasByName(const OUString &aName) override
::std::vector< ScDPDimension * > aRowDims
virtual void SAL_CALL setName(const OUString &aName) override
::std::vector< sal_Int32 > aPageDims
css::sheet::DataPilotFieldOrientation GetDataLayoutOrientation()
std::optional< OUString > mpLayoutName
virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getLevels() override
virtual css::uno::Any SAL_CALL getByName(const OUString &aName) override
When assigning a string value, you can also assign an interned string whose life-cycle is managed by ...
#define SC_UNO_DP_FUNCTION2
virtual ~ScDPLevels() override
SC_SIMPLE_SERVICE_INFO_COMPAT(ScDPHierarchies,"ScDPHierarchies","com.sun.star.sheet.DataPilotSourceHierarchies","com.sun.star.sheet.DataPilotSourceHierarcies") SC_SIMPLE_SERVICE_INFO_COMPAT(ScDPHierarchy
virtual void DisposeData()=0
std::unique_ptr< rtl::Reference< ScDPLevel >[]> ppLevs
virtual sal_Int32 GetMembersCount(sal_Int32 nDim)
ScDPDimension * getByIndex(tools::Long nIndex) const
This structure stores dimension information used when calculating results.
::std::vector< sal_Int32 > aDataSrcCols
virtual ~ScDPHierarchies() override
sal_Int32 GetDupCount() const
#define SC_DAPI_HIERARCHY_WEEK
virtual OUString getDimensionName(sal_Int32 nColumn)=0
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
virtual css::uno::Type SAL_CALL getElementType() override
void AddMember(tools::Long nSourceIndex, SCROW nMember)
#define SC_DAPI_LEVEL_YEAR
std::unique_ptr< ScDPResultMember > pColResRoot
virtual css::uno::Any SAL_CALL getByName(const OUString &aName) override
std::unique_ptr< rtl::Reference< ScDPHierarchy >[]> ppHiers
tools::Long getCount() const
static SC_DLLPUBLIC OUString getSourceDimensionName(const OUString &rName)
sal_uInt32 GetNumberFormatByIdx(NfIndexTableOffset)
void SetDupCount(tools::Long nNew)
const ScDPItemData * GetItemDataById(sal_Int32 nDim, sal_Int32 nId)
#define SC_DAPI_LEVEL_QUARTER
virtual OUString SAL_CALL getName() override
std::unique_ptr< css::uno::Sequence< css::sheet::MemberResult >[]> pRowResults
#define SC_DAPI_LEVEL_DAY
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
#define SC_DAPI_WEEK_LEVELS
virtual css::uno::Any SAL_CALL getByName(const OUString &aName) override
SCROW GetItemDataId() const
#define SC_DAPI_LEVEL_MONTH
sal_Int32 GetPosition(sal_Int32 nColumn)
void FilterCacheByPageDimensions()
Set visibilities of individual rows in the cache table based on the page field data.
ScDPResultMember * pColRoot
void setIgnoreEmptyRows(bool bSet)
???
css::uno::Type const & get()
#define SC_DAPI_HIERARCHY_FLAT
#define SC_SIMPLE_SERVICE_INFO(ClassName, ClassNameAscii, ServiceAscii)
virtual void SAL_CALL removeRefreshListener(const css::uno::Reference< css::util::XRefreshListener > &l) override
bool SubTotalAllowed(sal_Int32 nColumn)
#define SC_UNO_DP_AUTOSHOW
#define SC_UNO_DP_COLUMNFIELDCOUNT
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
ScDPItemData FillItemData() const
css::uno::Sequence< sal_Int16 > getSubTotals() const
static const tools::Long nHierCount
css::sheet::DataPilotFieldReference aReferenceValue
virtual OUString SAL_CALL getName() override
#define SC_UNO_DP_HAS_HIDDEN_MEMBER
virtual css::uno::Any SAL_CALL getByName(const OUString &aName) override
void fillFieldFilters(::std::vector< ScDPFilteredCache::Criterion > &rFilters) const
virtual sal_Bool SAL_CALL hasByName(const OUString &aName) override
#define SC_IMPL_DUMMY_PROPERTY_LISTENER(ClassName)
static tools::Long getUsedHierarchy()
#define SC_DAPI_LEVEL_WEEKDAY
css::sheet::DataPilotFieldSortInfo aSortInfo
OUString getDisplayName(sal_Int16 nCalendarDisplayIndex, sal_Int16 nIdx, sal_Int16 nNameType) const
#define SC_UNO_DP_ROWGRAND
std::vector< sal_Int32 > maDataDims
std::vector< double > ValuesType
#define SC_UNO_DP_DATAFIELDCOUNT
#define SC_UNO_DP_ORIENTATION
ScDPDimension(ScDPSource *pSrc, tools::Long nD)
median of all numerical values is calculated.
#define SC_UNO_DP_ORIGINAL_POS
virtual bool getIsDataLayoutDimension(sal_Int32 nColumn)=0
#define SC_UNO_DP_SHOWEMPTY
std::unique_ptr< rtl::Reference< ScDPDimension >[]> ppDims
std::vector< ScDPLevel * > aColLevelList
ScDPMember(ScDPSource *pSrc, sal_Int32 nDim, sal_Int32 nHier, sal_Int32 nLev, SCROW nIndex)
virtual css::uno::Sequence< css::uno::Sequence< css::sheet::DataResult > > SAL_CALL getResults() override
Base class that abstracts different data source types of a datapilot table.
void setRepeatIfEmpty(bool bSet)
virtual css::uno::Sequence< double > SAL_CALL getFilteredResults(const css::uno::Sequence< css::sheet::DataPilotFieldFilter > &aFilters) override
rtl::Reference< ScDPMembers > mxMembers
single filtering criterion.
bool IsNamedItem(SCROW nIndex) const
static CalendarWrapper * GetCalendar()
sal_Int32 Compare(const ScDPMember &rOther) const
std::vector< ScDPLevel * > aRowLevelList
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
std::vector< sal_Int32 > maRowDims
ScDPInitState * pInitState
#define SC_UNO_DP_USEDHIERARCHY
css::sheet::DataPilotFieldOrientation GetOrientation(sal_Int32 nColumn)
#define SAL_WARN_IF(condition, area, stream)
ScDPLevel(ScDPSource *pSrc, sal_Int32 nDim, sal_Int32 nHier, sal_Int32 nLevel)
sal_Int32 GetIndexFromName(const OUString &rName) const
virtual void SAL_CALL setName(const OUString &aName) override
#define SC_UNO_DP_DATADESC
virtual sal_Bool SAL_CALL hasElements() override
virtual css::uno::Sequence< OUString > SAL_CALL getLocaleIndependentElementNames() override
ScGeneralFunction
the css::sheet::GeneralFunction enum is extended by constants in GeneralFunction2, which causes some type-safety issues.
static sal_Int32 getCount()
static tools::Long lcl_CountMinMembers(const vector< ScDPDimension * > &ppDim, const vector< ScDPLevel * > &ppLevel, tools::Long nLevels)
This class collects visible members of each dimension and uses that information to create filtering c...
#define SC_UNO_DP_ISVISIBLE
sal_Int32 GetSourceDim() const
virtual css::uno::Type SAL_CALL getElementType() override
all values, including non-numerical values, are counted.
bool HasStringData() const
virtual ~ScDPMembers() override
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
virtual void FilterCacheTable(const std::vector< ScDPFilteredCache::Criterion > &rCriteria, const std::unordered_set< sal_Int32 > &rDataDims)=0
ScDPResultTree maResFilterSet
Sequence< sal_Int8 > aSeq
virtual sal_Bool SAL_CALL hasElements() override
virtual css::uno::Reference< css::sheet::XMembersAccess > SAL_CALL getMembers() override
OUString GetNameStr(bool bLocaleIndependent) const
virtual void SAL_CALL addRefreshListener(const css::uno::Reference< css::util::XRefreshListener > &l) override
OUString GetFormattedString(sal_Int32 nDim, const ScDPItemData &rItem, bool bLocaleIndependent) const
sal_Int32 getCount() const
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
::std::vector< ScDPLevel * > aRowLevels
sal_Int32 GetDataDimensionCount() const
virtual sal_uInt32 GetNumberFormat(sal_Int32 nDim)
virtual ~ScDPSource() override
css::uno::Sequence< sal_Int16 > aSubTotals
bool getIsDataLayoutDimension() const
virtual sal_Int32 Compare(sal_Int32 nDim, sal_Int32 nDataId1, sal_Int32 nDataId2)
#define SC_DAPI_LEVEL_WEEK
#define SAL_WARN(area, stream)
ScDPResultMember * pRowRoot
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
#define SC_UNO_DP_SHOWDETAILS
detail::Optional< bool >::type tryAccess< bool >(css::uno::Any const &any)
bool IsDateDimension(sal_Int32 nDim)
#define SC_DAPI_FLAT_LEVELS
#define SC_UNO_DP_ISDATALAYOUT
virtual css::uno::Type SAL_CALL getElementType() override
ScDPLevel * getByIndex(sal_Int32 nIndex) const
ScDPHierarchies * GetHierarchiesObject()
std::unique_ptr< ScDPItemData > pSelectedData
rtl::Reference< ScDPLevels > mxLevels
const std::optional< OUString > & GetLayoutName() const
virtual css::uno::Sequence< css::uno::Sequence< css::uno::Any > > SAL_CALL getDrillDownData(const css::uno::Sequence< css::sheet::DataPilotFieldFilter > &aFilters) override
virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone() override
#define SC_DAPI_HIERARCHY_QUARTER
ScDPMembersHashMap aHashMap
#define SC_UNO_DP_SUBTOTAL2
virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getHierarchies() override
#define SC_UNO_DP_NUMBERFO
css::sheet::DataPilotFieldOrientation getOrientation() const
const ScDPItemData * GetItemData() const
static SC_DLLPUBLIC ScSubTotalFunc toSubTotalFunc(ScGeneralFunction eGenFunc)
bool IsDataLayoutDimension(sal_Int32 nDim)
tools::Long GetDatePart(tools::Long nDateVal, tools::Long nHierarchy, tools::Long nLevel)
ScDPMember * getByIndex(sal_Int32 nIndex) const
std::unique_ptr< ScDPResultData > pResData
virtual sal_Int32 GetColumnCount()=0
use (new) typed collection instead of ScStrCollection or separate Str and ValueCollection ...
const std::optional< OUString > & GetLayoutName() const
virtual css::uno::Sequence< css::sheet::MemberResult > SAL_CALL getResults() override