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>
60using ::com::sun::star::uno::Sequence;
61using ::com::sun::star::uno::Any;
62using ::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);
194bool 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)
223void 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())
402 if (aFilters.getLength() == 1)
406 if (!std::isnan(fVal))
412 return uno::Sequence<double>();
422 OSL_FAIL(
"not implemented");
427 OSL_FAIL(
"not implemented");
434 vector<ScDPFilteredCache::Criterion> aFilterCriteria;
435 for (
const sheet::DataPilotFieldFilter& rFilter : aFilters)
437 const OUString& aFieldName = rFilter.FieldName;
438 for (sal_Int32 nCol = 0; nCol < nColumnCount; ++nCol)
444 GetLevelsObject()->getByIndex(0)->GetMembersObject();
449 aFilterCriteria.emplace_back( );
450 aFilterCriteria.back().mnFieldIndex = nCol;
451 aFilterCriteria.back().mpFilter =
452 std::make_shared<ScDPFilteredCache::SingleFilter>(aItem);
464 Sequence< Sequence<Any> > aTabData;
465 std::unordered_set<sal_Int32> aCatDims;
476 if (
pResData->GetMeasureCount() == 1 )
478 bool bTotalResult =
false;
536 bool bWasShowAll =
true;
544 OSL_FAIL(
"lcl_CountMinMembers: multiple levels from one dimension not implemented");
549 if ( ppDim[
nPos]->getIsDataLayoutDimension() )
552 nDataCount = ppLevel[
nPos]->GetMembersObject()->getCount();
553 if ( nDataCount == 0 )
556 else if ( bWasShowAll )
559 if ( !ppLevel[
nPos]->getShowEmpty() )
567 tools::Long nThisCount = ppLevel[
nPos]->GetMembersObject()->getMinMembers();
568 if ( nThisCount == 0 )
575 if ( nTotal >=
LONG_MAX / nThisCount )
577 nTotal *= nThisCount;
583 if ( nTotal >=
LONG_MAX / nDataCount )
585 nTotal *= nDataCount;
593 for (
const auto& rDimIndex : rDims)
607 for (sal_Int32 j = 0; j <
nCount; ++j)
638class CategoryDimInserter
641 std::unordered_set<sal_Int32>& mrCatDims;
643 CategoryDimInserter(
ScDPSource& rSource, std::unordered_set<sal_Int32>& rCatDims) :
645 mrCatDims(rCatDims) {}
650 mrCatDims.insert(nDim);
658 std::unordered_set<sal_Int32> aCatDims;
660 CategoryDimInserter aInserter(*
this, aCatDims);
665 rCatDims.swap(aCatDims);
678 SAL_WARN(
"sc.core",
"tried to apply page field filters several times");
686 vector<ScDPFilteredCache::Criterion> aCriteria;
693 GetLevelsObject()->getByIndex(0)->GetMembersObject();
698 aFilter.
mpFilter = std::make_shared<ScDPFilteredCache::GroupFilter>();
712 aCriteria.push_back(aFilter);
718 aCriteria.emplace_back();
721 r.
mpFilter = std::make_shared<ScDPFilteredCache::SingleFilter>(rData);
723 if (!aCriteria.empty())
725 std::unordered_set<sal_Int32> aCatDims;
738 if (
maDataDims.size() > 1 && ( nDataOrient != sheet::DataPilotFieldOrientation_COLUMN &&
739 nDataOrient != sheet::DataPilotFieldOrientation_ROW ) )
743 nDataOrient = sheet::DataPilotFieldOrientation_ROW;
749 vector<OUString> aDataNames;
750 vector<sheet::DataPilotFieldReference> aDataRefValues;
751 vector<ScSubTotalFunc> aDataFunctions;
752 vector<sheet::DataPilotFieldOrientation> aDataRefOrient;
758 bool bLateInit =
true;
779 sheet::DataPilotFieldOrientation nDataRefOrient = sheet::DataPilotFieldOrientation_HIDDEN;
780 sal_Int32 eRefType = aDataRefValues.back().ReferenceType;
781 if ( eRefType == sheet::DataPilotFieldReferenceType::ITEM_DIFFERENCE ||
782 eRefType == sheet::DataPilotFieldReferenceType::ITEM_PERCENTAGE ||
783 eRefType == sheet::DataPilotFieldReferenceType::ITEM_PERCENTAGE_DIFFERENCE ||
784 eRefType == sheet::DataPilotFieldReferenceType::RUNNING_TOTAL )
798 aDataRefOrient.push_back(nDataRefOrient);
800 aDataNames.push_back(pDim->
getName());
819 pResData->SetMeasureData(aDataFunctions, aDataRefValues, aDataRefOrient, aDataNames);
820 pResData->SetDataLayoutOrientation(nDataOrient);
823 bool bHasAutoShow =
false;
841 tools::Long nColDimCount2 =
maColDims.size() - (nDataLayoutOrient == sheet::DataPilotFieldOrientation_COLUMN ? 1 : 0);
842 tools::Long nRowDimCount2 =
maRowDims.size() - (nDataLayoutOrient == sheet::DataPilotFieldOrientation_ROW ? 1 : 0);
844 bool bShowRowGrand =
bRowGrand && nRowDimCount2 > 0;
857 if ( nRowLevelCount > 0 )
860 aInfo.
aRowLevels[nRowLevelCount-1]->SetEnableLayout(
false );
951 std::vector<sal_Int32>* pDimIndex =
nullptr;
952 switch (nOrientation)
954 case sheet::DataPilotFieldOrientation_COLUMN:
957 case sheet::DataPilotFieldOrientation_ROW:
960 case sheet::DataPilotFieldOrientation_DATA:
963 case sheet::DataPilotFieldOrientation_PAGE:
967 OSL_FAIL(
"ScDPSource::FillLevelList: unexpected orientation" );
972 OSL_FAIL(
"invalid orientation");
977 for (
const auto& rIndex : *pDimIndex)
980 OSL_ENSURE( pDim->
getOrientation() == nOrientation,
"orientations are wrong" );
988 sal_Int32 nLevCount = pLevels->
getCount();
989 for (sal_Int32 nLev=0; nLev<nLevCount; nLev++)
992 rList.push_back(pLevel);
1016 pColResults.reset(
new uno::Sequence<sheet::MemberResult>[nColLevelCount]);
1022 true,
nullptr,
nullptr );
1030 pRowResults.reset(
new uno::Sequence<sheet::MemberResult>[nRowLevelCount] );
1036 true,
nullptr,
nullptr );
1046 for (
i=0;
i<nColCount;
i++)
1049 if ( pColLevel == pLevel )
1053 for (
i=0;
i<nRowCount;
i++)
1056 if ( pRowLevel == pLevel )
1066 using beans::PropertyAttribute::READONLY;
1080 static uno::Reference<beans::XPropertySetInfo> aRef =
1098 if (aValue >>=
aName)
1103 OSL_FAIL(
"unknown property");
1122 aRet <<= static_cast<sal_Int32>(
maRowDims.size());
1124 aRet <<= static_cast<sal_Int32>(
maColDims.size());
1126 aRet <<= static_cast<sal_Int32>(
maDataDims.size());
1134 OSL_FAIL(
"unknown property");
1143 std::cout <<
"+++++ column root" << std::endl;
1145 std::cout <<
"+++++ row root" << std::endl;
1173 sal_Int32 nCopy = std::min( nNewCount,
nDimCount );
1176 for (
i=0;
i<nCopy;
i++)
1178 for (
i=nCopy;
i<nNewCount;
i++)
1194 uno::Reference<container::XNamed> xNamed =
getByIndex(
i);
1200 throw container::NoSuchElementException();
1208 OUString* pArr =
aSeq.getArray();
1268 bHasSelectedPage( false ),
1269 mbHasHiddenMember(false)
1305 if (!
aName.isEmpty())
1334 OSL_ENSURE(
nSourceDim < 0,
"recursive duplicate - not implemented" );
1337 OUString aNewName =
aName;
1341 pNew->
aName = aNewName;
1365 if ( nLevel < nLevCount )
1410 static uno::Reference<beans::XPropertySetInfo> aRef =
1423 sheet::DataPilotFieldOrientation eEnum;
1424 if (aValue >>= eEnum)
1429 sheet::GeneralFunction eEnum;
1430 if (aValue >>= eEnum)
1436 if (aValue >>= eEnum)
1444 uno::Sequence<sheet::TableFilterField>
aSeq;
1445 if (aValue >>=
aSeq)
1456 const sheet::TableFilterField& rField =
aSeq[0];
1457 if ( rField.Field == 0 && rField.Operator == sheet::FilterOperator_EQUAL && !rField.IsNumeric )
1467 OSL_FAIL(
"Filter property is not a single string");
1468 throw lang::IllegalArgumentException();
1475 if (aValue >>= aTmpName)
1481 if (aValue >>= aTmpName)
1492 OSL_FAIL(
"unknown property");
1514 const int nValAsInt =
static_cast<int>(nVal);
1515 assert(nValAsInt >=
int(css::sheet::GeneralFunction_NONE) &&
1516 nValAsInt <=
int(css::sheet::GeneralFunction_VARP));
1517 aRet <<= static_cast<sheet::GeneralFunction>(nValAsInt);
1522 aRet <<= static_cast<sal_Int16>(eVal);
1530 sal_Int32 nFormat = 0;
1538 case sheet::DataPilotFieldReferenceType::ITEM_PERCENTAGE:
1539 case sheet::DataPilotFieldReferenceType::ITEM_PERCENTAGE_DIFFERENCE:
1540 case sheet::DataPilotFieldReferenceType::ROW_PERCENTAGE:
1541 case sheet::DataPilotFieldReferenceType::COLUMN_PERCENTAGE:
1542 case sheet::DataPilotFieldReferenceType::TOTAL_PERCENTAGE:
1545 case sheet::DataPilotFieldReferenceType::INDEX:
1556 uno::Reference<container::XNamed> xOriginal;
1570 sheet::TableFilterField aField( sheet::FilterConnection_AND, 0,
1572 aRet <<= uno::Sequence<sheet::TableFilterField>( &aField, 1 );
1575 aRet <<= uno::Sequence<sheet::TableFilterField>(0);
1585 aRet <<= sal_Int32(0);
1589 OSL_FAIL(
"unknown property");
1617 uno::Reference<container::XNamed> xNamed =
getByIndex(
i);
1623 throw container::NoSuchElementException();
1630 OUString* pArr =
aSeq.getArray();
1728 OSL_FAIL(
"ScDPHierarchy::getName: unexpected hierarchy" );
1736 OSL_FAIL(
"not implemented");
1757 OSL_FAIL(
"wrong hierarchy");
1778 uno::Reference<container::XNamed> xNamed =
getByIndex(
i);
1784 throw container::NoSuchElementException();
1791 OUString* pArr =
aSeq.getArray();
1846class ScDPGlobalMembersOrder
1852 ScDPGlobalMembersOrder(
ScDPLevel& rLev,
bool bAsc ) :
1857 bool operator()( sal_Int32 nIndex1, sal_Int32 nIndex2 )
const;
1862bool ScDPGlobalMembersOrder::operator()( sal_Int32 nIndex1, sal_Int32 nIndex2 )
const
1864 sal_Int32 nCompare = 0;
1866 if( nIndex1 != nIndex2 )
1868 ScDPMembers* pMembers = rLevel.GetMembersObject();
1871 nCompare = pMember1->
Compare( *pMember2 );
1873 return bAscending ? (nCompare < 0) : (nCompare > 0);
1881 aSortInfo( OUString(), true, sheet::DataPilotFieldSortMode::
NAME ),
1884 bShowEmpty( false ),
1885 bEnableLayout( false ),
1886 bRepeatItemLabels( false )
1901 case sheet::DataPilotFieldSortMode::DATA:
1906 for (
tools::Long nMeasure=0; nMeasure<nMeasureCount; nMeasure++)
1918 case sheet::DataPilotFieldSortMode::MANUAL:
1919 case sheet::DataPilotFieldSortMode::NAME:
1929 bool bAscending = (
aSortInfo.Mode == sheet::DataPilotFieldSortMode::MANUAL ||
aSortInfo.IsAscending );
1930 ScDPGlobalMembersOrder aComp( *
this, bAscending );
1942 for (
tools::Long nMeasure=0; nMeasure<nMeasureCount; nMeasure++)
2006 OSL_FAIL(
"ScDPLevel::getName: unexpected level" );
2024 OSL_FAIL(
"ScDPLevel::getName: unexpected level" );
2028 if (!aRet.isEmpty())
2041 OSL_FAIL(
"not implemented");
2070 static uno::Reference<beans::XPropertySetInfo> aRef =
2083 uno::Sequence<sheet::GeneralFunction>
aSeq;
2087 [](
const sheet::GeneralFunction& rFunc) -> sal_Int16 {
2088 return static_cast<sal_Int16>(rFunc); });
2100 OSL_FAIL(
"unknown property");
2114 uno::Sequence<sheet::GeneralFunction> aNewSeq(
aSeq.getLength());
2115 std::transform(
aSeq.begin(),
aSeq.end(), aNewSeq.getArray(),
2116 [](
const sal_Int16 nFunc) -> sheet::GeneralFunction {
2117 if (nFunc == sheet::GeneralFunction2::MEDIAN)
2118 return sheet::GeneralFunction_NONE;
2119 return static_cast<sheet::GeneralFunction>(nFunc);
2143 const std::optional<OUString> & pLayoutName = pDim->
GetLayoutName();
2147 aRet <<= *pLayoutName;
2151 OSL_FAIL(
"unknown property");
2185 pLastNumData =
pData;
2190 const ScDPItemData* pFirstData = GetSrcItemDataByIndex( 0 );
2191 double fFirstVal = pFirstData->
GetValue();
2192 double fLastVal = pLastNumData->
GetValue();
2195 static_cast<tools::Long>(::rtl::math::approxFloor( fFirstVal )),
2198 static_cast<tools::Long>(::rtl::math::approxFloor( fLastVal )),
2201 nMbrCount = nLastYear + 1 - nFirstYear;
2211 OSL_FAIL(
"ScDPMembers::ScDPMembers: unexpected level" );
2223 OSL_FAIL(
"ScDPMembers::ScDPMembers: unexpected level" );
2249 ScDPMembersHashMap::const_iterator aIter =
aHashMap.find( rName );
2251 return aIter->second;
2267 throw container::NoSuchElementException();
2308 GetHierarchiesObject()->getByIndex(
nHier)->GetLevelsObject()->getByIndex(
nLev);
2310 const std::vector<sal_Int32>& rGlobalOrder = pLevel->
GetGlobalOrder();
2311 bool bSort = !rGlobalOrder.empty();
2315 OUString* pArr =
aSeq.getArray();
2325 sal_Int32 nVisCount = 0;
2330 return !pMbr || (pMbr->isVisible() && pMbr->getShowDetails()); });
2359 sal_Int32 nGroupBy = 0;
2369 static_cast<tools::Long>(::rtl::math::approxFloor( fFirstVal )),
2372 nVal = nFirstYear +
nIndex;
2378 css::i18n::CalendarDisplayIndex::DAY,
2379 sal::static_int_cast<sal_Int16>(nVal), 0 );
2385 css::i18n::CalendarDisplayIndex::MONTH,
2386 sal::static_int_cast<sal_Int16>(nVal), 0 );
2394 nGroupBy = sheet::DataPilotFieldGroupBy::YEARS;
2398 nGroupBy = sheet::DataPilotFieldGroupBy::QUARTERS;
2402 nGroupBy = sheet::DataPilotFieldGroupBy::MONTHS;
2405 nGroupBy = sheet::DataPilotFieldGroupBy::DAYS;
2410 if (
aName.isEmpty())
2411 aName = OUString::number(nVal);
2432 ScDPSource* pSrc, sal_Int32 nD, sal_Int32 nH, sal_Int32 nL,
SCROW nIndex) :
2456 if (
pData->IsValue())
2463 return pData2 && nComp == pData2->
GetValue();
2523 OSL_FAIL(
"not implemented");
2537 static uno::Reference<beans::XPropertySetInfo> aRef =
2553 if (aValue >>=
aName)
2558 OSL_FAIL(
"unknown property");
2575 OSL_FAIL(
"unknown property");
2584 OSL_ENSURE(
GetData() ,
"empty ScDPTableData pointer");
2585 return (
GetData()!=
nullptr ) ? &
GetData()->GetCacheTable().getCache() : nullptr ;
OUString getDisplayName(sal_Int16 nCalendarDisplayIndex, sal_Int16 nIdx, sal_Int16 nNameType) const
This class represents the cached data part of the datapilot cache table implementation.
const ScDPItemData * GetItemDataById(tools::Long nDim, SCROW nId) const
SCROW GetIdByItemData(tools::Long nDim, const ScDPItemData &rItem) const
virtual ~ScDPDimension() override
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
ScDPHierarchies * GetHierarchiesObject()
virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone() override
ScGeneralFunction getFunction() const
ScDPDimension(ScDPSource *pSrc, tools::Long nD)
std::optional< OUString > mpSubtotalName
const std::optional< OUString > & GetLayoutName() const
void setFunction(ScGeneralFunction nNew)
css::sheet::DataPilotFieldReference aReferenceValue
ScDPDimension * CreateCloneObject()
bool HasSelectedPage() const
static tools::Long getUsedHierarchy()
virtual void SAL_CALL setName(const OUString &aName) override
sal_Int32 GetSourceDim() const
std::unique_ptr< ScDPItemData > pSelectedData
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
virtual OUString SAL_CALL getName() override
std::optional< OUString > mpLayoutName
bool getIsDataLayoutDimension() const
css::sheet::DataPilotFieldOrientation getOrientation() const
const css::sheet::DataPilotFieldReference & GetReferenceValue() const
const ScDPItemData & GetSelectedData()
rtl::Reference< ScDPHierarchies > mxHierarchies
ScGeneralFunction nFunction
virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getHierarchies() override
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
sal_Int32 GetDimension() const
const std::optional< OUString > & GetSubtotalName() const
std::unique_ptr< rtl::Reference< ScDPDimension >[]> ppDims
virtual css::uno::Any SAL_CALL getByName(const OUString &aName) override
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
tools::Long getCount() const
virtual ~ScDPDimensions() override
virtual css::uno::Type SAL_CALL getElementType() override
ScDPDimension * getByIndex(tools::Long nIndex) const
virtual sal_Bool SAL_CALL hasByName(const OUString &aName) override
virtual sal_Bool SAL_CALL hasElements() override
multi-item (group) filter.
void addMatchItem(const ScDPItemData &rItem)
size_t getMatchItemCount() const
static const tools::Long nHierCount
static sal_Int32 getCount()
virtual css::uno::Any SAL_CALL getByName(const OUString &aName) override
ScDPHierarchy * getByIndex(tools::Long nIndex) const
virtual sal_Bool SAL_CALL hasByName(const OUString &aName) override
virtual ~ScDPHierarchies() override
std::unique_ptr< rtl::Reference< ScDPHierarchy >[]> ppHiers
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
virtual sal_Bool SAL_CALL hasElements() override
virtual css::uno::Type SAL_CALL getElementType() override
ScDPLevels * GetLevelsObject()
virtual ~ScDPHierarchy() override
rtl::Reference< ScDPLevels > mxLevels
virtual void SAL_CALL setName(const OUString &aName) override
ScDPHierarchy(ScDPSource *pSrc, sal_Int32 nDim, sal_Int32 nHier)
virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getLevels() override
virtual OUString SAL_CALL getName() override
Member names that are being processed for InitFrom/LateInitFrom (needed for initialization of grouped...
void AddMember(tools::Long nSourceIndex, SCROW nMember)
When assigning a string value, you can also assign an interned string whose life-cycle is managed by ...
ScDPMembers * GetMembersObject()
const css::sheet::DataPilotFieldAutoShowInfo & GetAutoShow() const
virtual void SAL_CALL setName(const OUString &aName) override
css::sheet::DataPilotFieldAutoShowInfo aAutoShowInfo
css::sheet::DataPilotFieldSortInfo aSortInfo
virtual ~ScDPLevel() override
void SetEnableLayout(bool bSet)
const ::std::vector< sal_Int32 > & GetGlobalOrder() const
virtual css::uno::Sequence< css::sheet::MemberResult > SAL_CALL getResults() override
virtual OUString SAL_CALL getName() override
css::uno::Sequence< sal_Int16 > getSubTotals() const
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
css::sheet::DataPilotFieldLayoutInfo aLayoutInfo
ScDPLevel(ScDPSource *pSrc, sal_Int32 nDim, sal_Int32 nHier, sal_Int32 nLevel)
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
css::uno::Sequence< sal_Int16 > aSubTotals
virtual css::uno::Reference< css::sheet::XMembersAccess > SAL_CALL getMembers() override
::std::vector< sal_Int32 > aGlobalOrder
rtl::Reference< ScDPMembers > mxMembers
ScDPLevel * getByIndex(sal_Int32 nIndex) const
virtual sal_Bool SAL_CALL hasElements() override
virtual ~ScDPLevels() override
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
virtual sal_Bool SAL_CALL hasByName(const OUString &aName) override
ScDPLevels(ScDPSource *pSrc, sal_Int32 nDim, sal_Int32 nHier)
sal_Int32 getCount() const
std::unique_ptr< rtl::Reference< ScDPLevel >[]> ppLevs
virtual css::uno::Any SAL_CALL getByName(const OUString &aName) override
virtual css::uno::Type SAL_CALL getElementType() override
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
virtual OUString SAL_CALL getName() override
sal_Int32 Compare(const ScDPMember &rOther) const
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
ScDPMember(ScDPSource *pSrc, sal_Int32 nDim, sal_Int32 nHier, sal_Int32 nLev, SCROW nIndex)
virtual void SAL_CALL setName(const OUString &aName) override
SCROW GetItemDataId() const
std::optional< OUString > mpLayoutName
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
bool IsNamedItem(SCROW nIndex) const
ScDPItemData FillItemData() const
const ScDPItemData * GetItemData() const
OUString GetNameStr(bool bLocaleIndependent) const
virtual ~ScDPMember() override
const std::optional< OUString > & GetLayoutName() const
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
sal_Int32 getCount() const
virtual ~ScDPMembers() override
sal_Int32 getMinMembers() const
sal_Int32 GetIndexFromName(const OUString &rName) const
const ScDPItemData * GetSrcItemDataByIndex(SCROW nIndex)
ScDPMembersHashMap aHashMap
virtual sal_Bool SAL_CALL hasElements() override
ScDPMember * getByIndex(sal_Int32 nIndex) const
virtual css::uno::Any SAL_CALL getByName(const OUString &aName) override
virtual css::uno::Sequence< OUString > SAL_CALL getLocaleIndependentElementNames() override
virtual css::uno::Type SAL_CALL getElementType() override
virtual sal_Bool SAL_CALL hasByName(const OUString &aName) override
The term 'measure' here roughly equals "data dimension" ?
double getLeafResult(const css::sheet::DataPilotFieldFilter &rFilter) const
std::vector< double > ValuesType
const ValuesType * getResults(const css::uno::Sequence< css::sheet::DataPilotFieldFilter > &rFilters) const
void swap(ScDPResultTree &rOther)
This class collects visible members of each dimension and uses that information to create filtering c...
void fillFieldFilters(::std::vector< ScDPFilteredCache::Criterion > &rFilters) const
indexes when calculating running totals
sal_Int32 GetSourceDim(sal_Int32 nDim)
std::vector< sal_Int32 > maDataDims
virtual void SAL_CALL addRefreshListener(const css::uno::Reference< css::util::XRefreshListener > &l) override
void setRepeatIfEmpty(bool bSet)
std::vector< ScDPLevel * > aRowLevelList
ScDPDimensions * GetDimensionsObject()
virtual css::uno::Sequence< css::uno::Sequence< css::uno::Any > > SAL_CALL getDrillDownData(const css::uno::Sequence< css::sheet::DataPilotFieldFilter > &aFilters) override
void SetDupCount(tools::Long nNew)
bool SubTotalAllowed(sal_Int32 nColumn)
sal_Int32 GetDupCount() const
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
void setIgnoreEmptyRows(bool bSet)
???
virtual css::uno::Sequence< css::uno::Sequence< css::sheet::DataResult > > SAL_CALL getResults() override
ScDPTableData * GetData()
std::unique_ptr< ScDPResultMember > pColResRoot
const css::uno::Sequence< css::sheet::MemberResult > * GetMemberResults(const ScDPLevel *pLevel)
virtual ~ScDPSource() override
virtual void SAL_CALL removeRefreshListener(const css::uno::Reference< css::util::XRefreshListener > &l) override
OUString GetDataDimName(sal_Int32 nIndex)
const std::optional< OUString > & GetGrandTotalName() const
std::vector< ScDPLevel * > aColLevelList
ScDPSource(ScDPTableData *pD)
const ScDPItemData * GetItemDataById(sal_Int32 nDim, sal_Int32 nId)
sal_Int32 GetDataDimensionCount() const
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
std::optional< OUString > mpGrandTotalName
const ScDPCache * GetCache()
virtual void SAL_CALL refresh() override
css::sheet::DataPilotFieldOrientation GetOrientation(sal_Int32 nColumn)
std::unique_ptr< css::uno::Sequence< css::sheet::MemberResult >[]> pRowResults
void GetCategoryDimensionIndices(std::unordered_set< sal_Int32 > &rCatDims)
Compile a list of dimension indices that are either, column, row or page dimensions (i....
std::vector< sal_Int32 > maPageDims
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
bool IsDateDimension(sal_Int32 nDim)
OUString getDataDescription()
void FillCalcInfo(bool bIsRow, ScDPTableData::CalcInfo &rInfo, bool &bHasAutoShow)
std::vector< sal_Int32 > maRowDims
rtl::Reference< ScDPDimensions > pDimensions
void FilterCacheByPageDimensions()
Set visibilities of individual rows in the cache table based on the page field data.
ScDPDimension * AddDuplicated(std::u16string_view rNewName)
move to ScDPResultData
void FillLevelList(css::sheet::DataPilotFieldOrientation nOrientation, std::vector< ScDPLevel * > &rList)
sal_Int32 GetPosition(sal_Int32 nColumn)
void SetOrientation(sal_Int32 nColumn, css::sheet::DataPilotFieldOrientation nNew)
std::unique_ptr< css::uno::Sequence< css::sheet::MemberResult >[]> pColResults
virtual css::uno::Sequence< double > SAL_CALL getFilteredResults(const css::uno::Sequence< css::sheet::DataPilotFieldFilter > &aFilters) override
ScDPResultTree maResFilterSet
virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getDimensions() override
std::unique_ptr< ScDPResultData > pResData
ScDPDimension * GetDataDimension(sal_Int32 nIndex)
std::vector< sal_Int32 > maColDims
std::unique_ptr< ScDPResultMember > pRowResRoot
css::sheet::DataPilotFieldOrientation GetDataLayoutOrientation()
bool IsDataLayoutDimension(sal_Int32 nDim)
Base class that abstracts different data source types of a datapilot table.
virtual void DisposeData()=0
virtual sal_Int32 GetMembersCount(sal_Int32 nDim)
sal_uInt32 GetNumberFormatByIdx(NfIndexTableOffset)
virtual void GetDrillDownData(std::vector< ScDPFilteredCache::Criterion > &&rCriteria, std::unordered_set< sal_Int32 > &&rCatDims, css::uno::Sequence< css::uno::Sequence< css::uno::Any > > &rData)=0
virtual OUString getDimensionName(sal_Int32 nColumn)=0
virtual bool IsDateDimension(sal_Int32 nDim)=0
virtual void FilterCacheTable(std::vector< ScDPFilteredCache::Criterion > &&rCriteria, std::unordered_set< sal_Int32 > &&rDataDims)=0
OUString GetFormattedString(sal_Int32 nDim, const ScDPItemData &rItem, bool bLocaleIndependent) const
virtual const ScDPItemData * GetMemberById(sal_Int32 nDim, sal_Int32 nId)
virtual sal_Int32 Compare(sal_Int32 nDim, sal_Int32 nDataId1, sal_Int32 nDataId2)
virtual sal_Int32 GetColumnCount()=0
use (new) typed collection instead of ScStrCollection or separate Str and ValueCollection
virtual bool getIsDataLayoutDimension(sal_Int32 nColumn)=0
tools::Long GetDatePart(tools::Long nDateVal, tools::Long nHierarchy, tools::Long nLevel)
virtual void SetEmptyFlags(bool bIgnoreEmptyRows, bool bRepeatIfEmpty)=0
const ScDPItemData * GetMemberByIndex(sal_Int32 nDim, sal_Int32 nIndex)
virtual void CreateCacheTable()=0
virtual void CalcResults(CalcInfo &rInfo, bool bAutoShow)=0
virtual const std::vector< SCROW > & GetColumnEntries(sal_Int32 nColumn)
virtual sal_uInt32 GetNumberFormat(sal_Int32 nDim)
static SC_DLLPUBLIC OUString getSourceDimensionName(std::u16string_view rName)
static SC_DLLPUBLIC ScSubTotalFunc toSubTotalFunc(ScGeneralFunction eGenFunc)
static CalendarWrapper & GetCalendar()
css::uno::Type const & get()
#define SC_DAPI_FLAT_LEVELS
#define SC_DAPI_HIERARCHY_QUARTER
#define SC_DAPI_HIERARCHY_WEEK
#define SC_DAPI_LEVEL_WEEKDAY
#define SC_DAPI_LEVEL_QUARTER
#define SC_DAPI_LEVEL_MONTH
#define SC_DAPI_HIERARCHY_FLAT
#define SC_DAPI_WEEK_LEVELS
#define SC_DAPI_QUARTER_LEVELS
#define SC_DAPI_LEVEL_YEAR
#define SC_DAPI_LEVEL_DAY
#define SC_DAPI_LEVEL_WEEK
SC_SIMPLE_SERVICE_INFO_COMPAT(ScDPHierarchies, "ScDPHierarchies", "com.sun.star.sheet.DataPilotSourceHierarchies", "com.sun.star.sheet.DataPilotSourceHierarcies") SC_SIMPLE_SERVICE_INFO_COMPAT(ScDPHierarchy
#define SC_MINCOUNT_LIMIT
com sun star sheet DataPilotSourceHierarchy
com sun star sheet com sun star sheet static DataPilotSourceHierarcy bool lcl_GetBoolFromAny(const uno::Any &aAny)
static tools::Long lcl_CountMinMembers(const vector< ScDPDimension * > &ppDim, const vector< ScDPLevel * > &ppLevel, tools::Long nLevels)
ScGeneralFunction
the css::sheet::GeneralFunction enum is extended by constants in GeneralFunction2,...
@ COUNT
all values, including non-numerical values, are counted.
@ SUM
sum of all numerical values is calculated.
@ MEDIAN
median of all numerical values is calculated.
@ COUNTNUMS
numerical values are counted.
@ NONE
nothing is calculated.
@ AUTO
function is determined automatically.
Sequence< sal_Int8 > aSeq
#define SAL_WARN_IF(condition, area, stream)
#define SAL_WARN(area, stream)
std::unique_ptr< sal_Int32[]> pData
#define SC_SIMPLE_SERVICE_INFO(ClassName, ClassNameAscii, ServiceAscii)
#define SC_IMPL_DUMMY_PROPERTY_LISTENER(ClassName)
constexpr OUStringLiteral aData
sal_Int32 findValue(const css::uno::Sequence< T1 > &_rList, const T2 &_rValue)
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
detail::Optional< bool >::type tryAccess< bool >(css::uno::Any const &any)
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
single filtering criterion.
std::shared_ptr< FilterBase > mpFilter
ScDPResultTree maFilterSet
This structure stores dimension information used when calculating results.
::std::vector< sal_Int32 > aPageDims
::std::vector< ScDPLevel * > aColLevels
::std::vector< sal_Int32 > aRowLevelDims
::std::vector< sal_Int32 > aDataSrcCols
::std::vector< ScDPDimension * > aColDims
ScDPResultMember * pRowRoot
::std::vector< sal_Int32 > aColLevelDims
ScDPResultMember * pColRoot
::std::vector< ScDPDimension * > aRowDims
::std::vector< ScDPLevel * > aRowLevels
ScDPInitState * pInitState
constexpr OUStringLiteral SC_UNO_DP_FUNCTION
constexpr OUStringLiteral SC_UNO_DP_SORTING
constexpr OUStringLiteral SC_UNO_DP_HAS_HIDDEN_MEMBER
constexpr OUStringLiteral SC_UNO_DP_SUBTOTAL
constexpr OUStringLiteral SC_UNO_DP_COLGRAND
constexpr OUStringLiteral SC_UNO_DP_POSITION
constexpr OUStringLiteral SC_UNO_DP_DATAFIELDCOUNT
constexpr OUStringLiteral SC_UNO_DP_REPEATEMPTY
constexpr OUStringLiteral SC_UNO_DP_ISDATALAYOUT
constexpr OUStringLiteral SC_UNO_DP_COLUMNFIELDCOUNT
constexpr OUStringLiteral SC_UNO_DP_IGNOREEMPTY
constexpr OUStringLiteral SC_UNO_DP_SUBTOTAL2
constexpr OUStringLiteral SC_UNO_DP_GRANDTOTAL_NAME
constexpr OUStringLiteral SC_UNO_DP_LAYOUTNAME
constexpr OUStringLiteral SC_UNO_DP_REPEATITEMLABELS
constexpr OUStringLiteral SC_UNO_DP_FUNCTION2
constexpr OUStringLiteral SC_UNO_DP_ORIGINAL
constexpr OUStringLiteral SC_UNO_DP_DATADESC
constexpr OUStringLiteral SC_UNO_DP_FILTER
constexpr OUStringLiteral SC_UNO_DP_ROWGRAND
#define SC_UNO_DP_NUMBERFO
constexpr OUStringLiteral SC_UNO_DP_USEDHIERARCHY
constexpr OUStringLiteral SC_UNO_DP_ORIENTATION
constexpr OUStringLiteral SC_UNO_DP_FIELD_SUBTOTALNAME
constexpr OUStringLiteral SC_UNO_DP_ISVISIBLE
constexpr OUStringLiteral SC_UNO_DP_SHOWDETAILS
constexpr OUStringLiteral SC_UNO_DP_SHOWEMPTY
constexpr OUStringLiteral SC_UNO_DP_ORIGINAL_POS
constexpr OUStringLiteral SC_UNO_DP_LAYOUT
constexpr OUStringLiteral SC_UNO_DP_REFVALUE
constexpr OUStringLiteral SC_UNO_DP_ROWFIELDCOUNT
constexpr OUStringLiteral SC_UNO_DP_AUTOSHOW
constexpr OUStringLiteral SC_UNO_DP_FLAGS