30 #include <document.hxx>
37 #include <unonames.hxx>
39 #include <globstr.hrc>
43 #include <com/sun/star/beans/XPropertySet.hpp>
44 #include <com/sun/star/sdb/XCompletedExecution.hpp>
45 #include <com/sun/star/sdbc/DataType.hpp>
46 #include <com/sun/star/sdbc/SQLException.hpp>
47 #include <com/sun/star/sdbc/XResultSetMetaData.hpp>
48 #include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
49 #include <com/sun/star/sdbc/XRow.hpp>
50 #include <com/sun/star/sdbc/XRowSet.hpp>
51 #include <com/sun/star/sheet/GeneralFunction2.hpp>
52 #include <com/sun/star/sheet/DataPilotFieldFilter.hpp>
53 #include <com/sun/star/sheet/DataPilotFieldOrientation.hpp>
54 #include <com/sun/star/sheet/DataPilotFieldReferenceType.hpp>
55 #include <com/sun/star/sheet/DataPilotTableHeaderData.hpp>
56 #include <com/sun/star/sheet/DataPilotTablePositionData.hpp>
57 #include <com/sun/star/sheet/DataPilotTablePositionType.hpp>
58 #include <com/sun/star/sheet/DimensionFlags.hpp>
59 #include <com/sun/star/task/InteractionHandler.hpp>
60 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
61 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
62 #include <com/sun/star/lang/XSingleComponentFactory.hpp>
63 #include <com/sun/star/lang/XInitialization.hpp>
64 #include <com/sun/star/container/XContentEnumerationAccess.hpp>
65 #include <com/sun/star/sheet/XDrillDownDataSupplier.hpp>
85 using ::std::shared_ptr;
86 using ::com::sun::star::uno::Sequence;
87 using ::com::sun::star::uno::Reference;
88 using ::com::sun::star::uno::UNO_QUERY;
89 using ::com::sun::star::uno::Any;
90 using ::com::sun::star::uno::Exception;
91 using ::com::sun::star::lang::XComponent;
92 using ::com::sun::star::sheet::DataPilotTableHeaderData;
93 using ::com::sun::star::sheet::DataPilotTablePositionData;
94 using ::com::sun::star::sheet::XDimensionsSupplier;
95 using ::com::sun::star::beans::XPropertySet;
116 uno::Reference<sdbc::XRowSet> mxRowSet;
117 uno::Reference<sdbc::XRow> mxRow;
118 uno::Reference<sdbc::XResultSetMetaData> mxMetaData;
122 DBConnector(
ScDPCache& rCache,
const uno::Reference<sdbc::XRowSet>& xRowSet,
const Date& rNullDate);
124 bool isValid()
const;
127 virtual OUString getColumnLabel(
tools::Long nCol)
const override;
128 virtual tools::Long getColumnCount()
const override;
129 virtual bool first()
override;
130 virtual bool next()
override;
131 virtual void finish()
override;
134 DBConnector::DBConnector(
ScDPCache& rCache,
const uno::Reference<sdbc::XRowSet>& xRowSet,
const Date& rNullDate) :
135 mrCache(rCache), mxRowSet(xRowSet), maNullDate(rNullDate)
137 Reference<sdbc::XResultSetMetaDataSupplier> xMetaSupp(mxRowSet, UNO_QUERY);
139 mxMetaData = xMetaSupp->getMetaData();
141 mxRow.set(mxRowSet, UNO_QUERY);
144 bool DBConnector::isValid()
const
146 return mxRowSet.is() && mxRow.is() && mxMetaData.is();
149 bool DBConnector::first()
151 return mxRowSet->first();
154 bool DBConnector::next()
156 return mxRowSet->next();
159 void DBConnector::finish()
161 mxRowSet->beforeFirst();
166 return mxMetaData->getColumnCount();
169 OUString DBConnector::getColumnLabel(
tools::Long nCol)
const
171 return mxMetaData->getColumnLabel(nCol+1);
176 rNumType = SvNumFormatType::NUMBER;
177 sal_Int32
nType = mxMetaData->getColumnType(nCol+1);
184 case sdbc::DataType::BIT:
185 case sdbc::DataType::BOOLEAN:
187 rNumType = SvNumFormatType::LOGICAL;
188 fValue = mxRow->getBoolean(nCol+1) ? 1 : 0;
192 case sdbc::DataType::TINYINT:
193 case sdbc::DataType::SMALLINT:
194 case sdbc::DataType::INTEGER:
195 case sdbc::DataType::BIGINT:
196 case sdbc::DataType::FLOAT:
197 case sdbc::DataType::REAL:
198 case sdbc::DataType::DOUBLE:
199 case sdbc::DataType::NUMERIC:
200 case sdbc::DataType::DECIMAL:
203 fValue = mxRow->getDouble(nCol+1);
209 rNumType = SvNumFormatType::DATE;
211 util::Date aDate = mxRow->getDate(nCol+1);
212 fValue =
Date(aDate.Day, aDate.Month, aDate.Year) - maNullDate;
216 case sdbc::DataType::TIME:
218 rNumType = SvNumFormatType::TIME;
220 util::Time aTime = mxRow->getTime(nCol+1);
228 case sdbc::DataType::TIMESTAMP:
230 rNumType = SvNumFormatType::DATETIME;
232 util::DateTime aStamp = mxRow->getTimestamp(nCol+1);
233 fValue = (
Date( aStamp.Day, aStamp.Month, aStamp.Year ) - maNullDate ) +
241 case sdbc::DataType::CHAR:
242 case sdbc::DataType::VARCHAR:
243 case sdbc::DataType::LONGVARCHAR:
244 case sdbc::DataType::SQLNULL:
245 case sdbc::DataType::BINARY:
246 case sdbc::DataType::VARBINARY:
247 case sdbc::DataType::LONGVARBINARY:
251 mrCache.InternString(nCol, mxRow->getString(nCol+1)));
254 catch (uno::Exception&)
264 sheet::DataPilotFieldOrientation nRet = sheet::DataPilotFieldOrientation_HIDDEN;
267 uno::Reference<container::XNameAccess> xDimNameAccess = xSource->getDimensions();
268 const uno::Sequence<OUString> aDimNames = xDimNameAccess->getElementNames();
269 for (
const OUString& rDimName : aDimNames)
271 uno::Reference<beans::XPropertySet> xDimProp(xDimNameAccess->getByName(rDimName),
282 sheet::DataPilotFieldOrientation_HIDDEN );
292 const OUString& rServ,
const OUString& rSrc,
const OUString& rNam,
293 const OUString& rUser,
const OUString& rPass ) :
294 aServiceName( rServ ),
312 mbHeaderLayout(
false),
314 bSettingsChanged(
false),
315 mbEnableGetPivotData(true)
321 aTableName( r.aTableName ),
322 aTableTag( r.aTableTag ),
323 aOutRange( r.aOutRange ),
324 maInteropGrabBag(r.maInteropGrabBag),
325 nHeaderRows( r.nHeaderRows ),
326 mbHeaderLayout( r.mbHeaderLayout ),
328 bSettingsChanged(
false),
329 mbEnableGetPivotData(r.mbEnableGetPivotData)
505 if (nDataDimCount != 1)
512 return (rPos == aTabRange.
aStart);
540 if ( nHeaderRows == 0 )
549 pOutput->SetPosition( aStart );
558 class DisableGetPivotData
563 DisableGetPivotData(
ScDPObject& rObj,
bool bOld) : mrDPObj(rObj), mbOldState(bOld)
568 ~DisableGetPivotData()
574 class FindIntersectingTable
578 explicit FindIntersectingTable(
const ScRange& rRange) : maRange(rRange) {}
580 bool operator() (
const std::unique_ptr<ScDPObject>& rObj)
const
582 return maRange.
Intersects(rObj->GetOutRange());
586 class FindIntersectingTableByColumns
594 mnCol1(nCol1), mnCol2(nCol2), mnRow(nRow), mnTab(nTab) {}
596 bool operator() (
const std::unique_ptr<ScDPObject>& rObj)
const
598 const ScRange& rRange = rObj->GetOutRange();
620 class FindIntersectingTableByRows
628 mnCol(nCol), mnRow1(nRow1), mnRow2(nRow2), mnTab(nTab) {}
630 bool operator() (
const std::unique_ptr<ScDPObject>& rObj)
const
632 const ScRange& rRange = rObj->GetOutRange();
654 class AccumulateOutputRanges
659 explicit AccumulateOutputRanges(
SCTAB nTab) : mnTab(nTab) {}
660 AccumulateOutputRanges(
const AccumulateOutputRanges& r) : maRanges(r.maRanges), mnTab(r.mnTab) {}
662 void operator() (
const std::unique_ptr<ScDPObject>& rObj)
664 const ScRange& rRange = rObj->GetOutRange();
669 maRanges.
Join(rRange);
672 const ScRangeList& getRanges()
const {
return maRanges; }
681 shared_ptr<ScDPTableData>
pData;
691 pData = std::make_shared<ScDatabaseDPData>(
pDoc, *pCache);
699 OSL_FAIL(
"no source descriptor");
712 pData = std::make_shared<ScSheetDPData>(
pDoc, *
pSheetDesc, *pCache);
718 if (pData && pDimData)
720 auto pGroupData = std::make_shared<ScDPGroupTableData>(pData,
pDoc);
744 OSL_ENSURE( !
pServDesc,
"DPSource could not be created" );
765 uno::Reference<util::XRefreshable> xRef(
xSource, uno::UNO_QUERY );
772 catch(uno::Exception&)
805 mpTableData->GetCacheTable().getCache().RemoveReference(
this);
841 auto pGroupData = std::make_shared<ScDPGroupTableData>(pSource,
pDoc);
848 auto pGroupData = std::make_shared<ScDPGroupTableData>(
mpTableData,
pDoc);
850 mpTableData = pGroupData;
858 Reference< XComponent > xObjectComp(
xSource, UNO_QUERY );
859 if (xObjectComp.is())
863 xObjectComp->dispose();
877 rOverflow =
pOutput->HasError();
883 return pOutput->GetOutputRange();
917 return pOutput->GetOutputRange(nType);
925 return pOutput->GetOutputRange(nType);
946 while ( nInitial + 1 < nOutRows &&
lcl_HasButton(
pDoc, nFirstCol, nFirstRow + nInitial, nTab ) )
949 if ( nInitial + 1 < nOutRows &&
950 pDoc->
IsBlockEmpty( nFirstCol, nFirstRow + nInitial, nFirstCol, nFirstRow + nInitial, nTab ) &&
970 pSaveData->BuildAllDimensionMembers(pTableData);
992 pSaveData->SyncAllDimensionMembers(pData);
998 vector<ScDPLabelData::Member> aMembers;
1002 size_t n = aMembers.size();
1004 auto pNames = rNames.getArray();
1005 for (
size_t i = 0;
i < n; ++
i)
1013 Reference< sheet::XMembersAccess > xMembersNA;
1018 sal_Int32
nCount = xMembersIA->getCount();
1019 vector<ScDPLabelData::Member> aMembers;
1020 aMembers.reserve(nCount);
1022 for (sal_Int32
i = 0;
i < nCount; ++
i)
1024 Reference<container::XNamed> xMember(xMembersIA->getByIndex(
i), UNO_QUERY);
1028 aMem.
maName = xMember->getName();
1040 aMembers.push_back(aMem);
1042 rMembers.swap(aMembers);
1062 nCol1, nRow1, nTab1, nCol2, nRow2, nTab2 );
1071 const OUString& rRangeName =
pSheetDesc->GetRangeName();
1072 if (!rRangeName.isEmpty())
1087 nCol1, nRow1, nTab1, nCol2, nRow2, nTab2 );
1097 aParam.
nRow1 += nDiffY;
1098 aParam.
nRow2 += nDiffY;
1120 OSL_FAIL(
"RefsEqual: SheetDesc set at only one object");
1137 pOutput->GetPositionData(rPos, rPosData);
1141 const ScAddress& rPos, Sequence<sheet::DataPilotFieldFilter>& rFilters)
1145 vector<sheet::DataPilotFieldFilter> aFilters;
1146 if (!
pOutput->GetDataResultPositionData(aFilters, rPos))
1149 sal_Int32
n =
static_cast<sal_Int32
>(aFilters.size());
1150 rFilters.realloc(n);
1151 auto pFilters = rFilters.getArray();
1152 for (sal_Int32
i = 0;
i < n; ++
i)
1153 pFilters[
i] = aFilters[
i];
1162 Reference<sheet::XDrillDownDataSupplier> xDrillDownData(
xSource, UNO_QUERY);
1163 if (!xDrillDownData.is())
1166 Sequence<sheet::DataPilotFieldFilter> filters;
1170 rTableData = xDrillDownData->getDrillDownData(filters);
1180 for (
const OUString& rDimName : aDimNames)
1182 if (rDimName.equalsIgnoreAsciiCase(rName))
1191 if (aLayoutName.equalsIgnoreAsciiCase(rName))
1199 rIsDataLayout =
false;
1204 uno::Reference<container::XNameAccess> xDimsName =
xSource->getDimensions();
1207 if ( nDim < nDimCount )
1209 uno::Reference<uno::XInterface> xIntDim(xDims->getByIndex(nDim), uno::UNO_QUERY);
1210 uno::Reference<container::XNamed> xDimName( xIntDim, uno::UNO_QUERY );
1211 uno::Reference<beans::XPropertySet> xDimProp( xIntDim, uno::UNO_QUERY );
1212 if ( xDimName.is() && xDimProp.is() )
1221 aName = xDimName->getName();
1223 catch(uno::Exception&)
1227 rIsDataLayout =
true;
1239 aRet =
pData->getDimensionName(nDim);
1240 rIsDataLayout =
pData->getIsDataLayoutDimension(nDim);
1248 bool bDuplicated =
false;
1251 uno::Reference<container::XNameAccess> xDimsName =
xSource->getDimensions();
1254 if ( nDim < nDimCount )
1256 uno::Reference<beans::XPropertySet> xDimProp(xDims->getByIndex(nDim), uno::UNO_QUERY);
1257 if ( xDimProp.is() )
1262 uno::Reference<uno::XInterface> xIntOrig;
1263 if ( (aOrigAny >>= xIntOrig) && xIntOrig.is() )
1266 catch(uno::Exception&)
1282 uno::Reference<container::XNameAccess> xDimsName =
xSource->getDimensions();
1283 if ( xDimsName.is() )
1284 nRet = xDimsName->getElementNames().getLength();
1286 catch(uno::Exception&)
1298 rData.Dimension = rData.Hierarchy = rData.Level = -1;
1301 DataPilotTablePositionData aPosData;
1302 pOutput->GetPositionData(rPos, aPosData);
1303 const sal_Int32 nPosType = aPosData.PositionType;
1305 aPosData.PositionData >>= rData;
1314 explicit FindByName(
const OUString& rName) : maName(rName) {}
1318 const std::optional<OUString> & pLayoutName = pDim->
GetLayoutName();
1333 class LessByDimOrder
1340 bool operator() (
const sheet::DataPilotFieldFilter& r1,
const sheet::DataPilotFieldFilter& r2)
const
1342 size_t nRank1 = mrDimOrder.size();
1343 size_t nRank2 = mrDimOrder.size();
1344 ScDPSaveData::DimOrderType::const_iterator it1 = mrDimOrder.find(
1346 if (it1 != mrDimOrder.end())
1347 nRank1 = it1->second;
1349 ScDPSaveData::DimOrderType::const_iterator it2 = mrDimOrder.find(
1351 if (it2 != mrDimOrder.end())
1352 nRank2 = it2->second;
1354 return nRank1 < nRank2;
1363 return std::numeric_limits<double>::quiet_NaN();
1367 std::vector<const ScDPSaveDimension*> aDataDims;
1368 pSaveData->GetAllDimensionsByOrientation(sheet::DataPilotFieldOrientation_DATA, aDataDims);
1369 if (aDataDims.empty())
1370 return std::numeric_limits<double>::quiet_NaN();
1372 std::vector<const ScDPSaveDimension*>::iterator it = std::find_if(
1373 aDataDims.begin(), aDataDims.end(),
1376 if (it == aDataDims.end())
1377 return std::numeric_limits<double>::quiet_NaN();
1379 size_t nDataIndex = std::distance(aDataDims.begin(), it);
1381 uno::Reference<sheet::XDataPilotResults> xDPResults(
xSource, uno::UNO_QUERY);
1382 if (!xDPResults.is())
1383 return std::numeric_limits<double>::quiet_NaN();
1387 std::sort(rFilters.begin(), rFilters.end(), LessByDimOrder(
pSaveData->GetDimensionSortOrder()));
1389 size_t n = rFilters.size();
1390 uno::Sequence<sheet::DataPilotFieldFilter> aFilters(n);
1391 auto aFiltersRange = asNonConstRange(aFilters);
1392 for (
size_t i = 0;
i < n; ++
i)
1393 aFiltersRange[
i] = rFilters[
i];
1395 uno::Sequence<double> aRes = xDPResults->getFilteredResults(aFilters);
1396 if (static_cast<sal_Int32>(nDataIndex) >= aRes.getLength())
1397 return std::numeric_limits<double>::quiet_NaN();
1399 return aRes[nDataIndex];
1406 return pOutput->IsFilterButton( rPos );
1413 return pOutput->GetHeaderDim( rPos, rOrient );
1421 return pOutput->GetHeaderDrag( rPos, bMouseLeft, bMouseTop, nDragDim, rPosRect, rOrient, rDimPos );
1428 pOutput->GetMemberResultNames(rNames, nDimension);
1451 bool dequote(
const OUString& rSource, sal_Int32 nStartPos, sal_Int32& rEndPos, OUString& rResult )
1457 if (rSource[nStartPos] == cQuote)
1460 sal_Int32
nPos = nStartPos + 1;
1461 const sal_Int32 nLen = rSource.getLength();
1463 while ( nPos < nLen )
1466 if ( cNext == cQuote )
1468 if (nPos+1 < nLen && rSource[nPos+1] == cQuote)
1471 aBuffer.append( cNext );
1477 rResult = aBuffer.makeStringAndClear();
1483 aBuffer.append( cNext );
1493 struct ScGetPivotDataFunctionEntry
1499 bool parseFunction(
const OUString& rList, sal_Int32 nStartPos, sal_Int32& rEndPos, sal_Int16& rFunc )
1501 static const ScGetPivotDataFunctionEntry aFunctions[] =
1504 {
"Sum", sheet::GeneralFunction2::SUM },
1506 {
"Average", sheet::GeneralFunction2::AVERAGE },
1507 {
"Max", sheet::GeneralFunction2::MAX },
1508 {
"Min", sheet::GeneralFunction2::MIN },
1509 {
"Product", sheet::GeneralFunction2::PRODUCT },
1510 {
"CountNums", sheet::GeneralFunction2::COUNTNUMS },
1511 {
"StDev", sheet::GeneralFunction2::STDEV },
1512 {
"StDevp", sheet::GeneralFunction2::STDEVP },
1513 {
"Var", sheet::GeneralFunction2::VAR },
1514 {
"VarP", sheet::GeneralFunction2::VARP },
1516 {
"Count Nums", sheet::GeneralFunction2::COUNTNUMS },
1517 {
"StdDev", sheet::GeneralFunction2::STDEV },
1518 {
"StdDevp", sheet::GeneralFunction2::STDEVP }
1521 const sal_Int32 nListLen = rList.getLength();
1522 while (nStartPos < nListLen && rList[nStartPos] ==
' ')
1525 bool bParsed =
false;
1526 bool bFound =
false;
1528 sal_Int32 nFuncEnd = 0;
1529 if (nStartPos < nListLen && rList[nStartPos] ==
'\'')
1530 bParsed = dequote( rList, nStartPos, nFuncEnd, aFuncStr );
1533 nFuncEnd = rList.indexOf(
']', nStartPos);
1536 aFuncStr = rList.copy(nStartPos, nFuncEnd - nStartPos);
1546 for ( sal_Int32 nFunc=0; nFunc<nFuncCount && !bFound; nFunc++ )
1548 if (aFuncStr.equalsIgnoreAsciiCaseAscii(aFunctions[nFunc].pName))
1550 rFunc = aFunctions[nFunc].eFunc;
1553 while (nFuncEnd < nListLen && rList[nFuncEnd] ==
' ')
1563 bool extractAtStart(
const OUString& rList, sal_Int32& rMatched,
bool bAllowBracket, sal_Int16* pFunc,
1564 OUString& rDequoted )
1566 sal_Int32 nMatchList = 0;
1568 bool bParsed =
false;
1569 if ( cFirst ==
'\'' || cFirst ==
'[' )
1574 sal_Int32 nQuoteEnd = 0;
1576 if ( cFirst ==
'\'' )
1577 bParsed = dequote( rList, 0, nQuoteEnd, aDequoted );
1578 else if ( cFirst ==
'[' )
1582 sal_Int32 nStartPos = 1;
1583 const sal_Int32 nListLen = rList.getLength();
1584 while (nStartPos < nListLen && rList[nStartPos] ==
' ')
1587 if (nStartPos < nListLen && rList[nStartPos] ==
'\'')
1589 if ( dequote( rList, nStartPos, nQuoteEnd, aDequoted ) )
1593 while (nQuoteEnd < nListLen && rList[nQuoteEnd] ==
' ')
1597 if (nQuoteEnd < nListLen && rList[nQuoteEnd] ==
';' && pFunc)
1599 sal_Int32 nFuncEnd = 0;
1600 if ( parseFunction( rList, nQuoteEnd + 1, nFuncEnd, *pFunc ) )
1601 nQuoteEnd = nFuncEnd;
1603 if (nQuoteEnd < nListLen && rList[nQuoteEnd] ==
']')
1614 sal_Int32 nClosePos = rList.indexOf(
']', nStartPos);
1617 sal_Int32 nNameEnd = nClosePos;
1618 sal_Int32 nSemiPos = rList.indexOf(
';', nStartPos);
1619 if (nSemiPos >= 0 && nSemiPos < nClosePos && pFunc)
1621 sal_Int32 nFuncEnd = 0;
1622 if (parseFunction(rList, nSemiPos+1, nFuncEnd, *pFunc))
1623 nNameEnd = nSemiPos;
1626 aDequoted = rList.copy(nStartPos, nNameEnd - nStartPos);
1629 nQuoteEnd = nClosePos + 1;
1637 nMatchList = nQuoteEnd;
1638 rDequoted = aDequoted;
1646 bool bValid =
false;
1647 if ( sal::static_int_cast<sal_Int32>(nMatchList) >= rList.getLength() )
1652 if ( cNext ==
' ' || ( bAllowBracket && cNext ==
'[' ) )
1658 rMatched = nMatchList;
1667 const OUString& rList,
const OUString& rSearch, sal_Int32& rMatched,
1668 bool bAllowBracket, sal_Int16* pFunc )
1670 sal_Int32 nMatchList = 0;
1671 sal_Int32 nMatchSearch = 0;
1673 if ( cFirst ==
'\'' || cFirst ==
'[' )
1676 bool bParsed = extractAtStart( rList, rMatched, bAllowBracket, pFunc, aDequoted);
1679 nMatchList = rMatched;
1680 nMatchSearch = rSearch.getLength();
1687 rList, 0, rList.getLength(), nMatchList, rSearch, 0, rSearch.getLength(), nMatchSearch);
1690 if (nMatchSearch == rSearch.getLength())
1694 bool bValid =
false;
1695 if ( sal::static_int_cast<sal_Int32>(nMatchList) >= rList.getLength() )
1700 if ( cNext ==
' ' || ( bAllowBracket && cNext ==
'[' ) )
1706 rMatched = nMatchList;
1717 OUString& rDataFieldName,
1718 std::vector<sheet::DataPilotFieldFilter>& rFilters,
1719 std::vector<sal_Int16>& rFilterFuncs, std::u16string_view rFilterList )
1725 std::vector<OUString> aDataNames;
1726 std::vector<OUString> aGivenNames;
1728 std::vector< uno::Sequence<OUString> > aFieldValueNames;
1729 std::vector< uno::Sequence<OUString> > aFieldValues;
1733 uno::Reference<container::XNameAccess> xDimsName =
xSource->getDimensions();
1735 sal_Int32
nDimCount = xIntDims->getCount();
1736 for ( sal_Int32 nDim = 0; nDim<nDimCount; nDim++ )
1738 uno::Reference<uno::XInterface> xIntDim(xIntDims->getByIndex(nDim), uno::UNO_QUERY);
1739 uno::Reference<container::XNamed> xDim( xIntDim, uno::UNO_QUERY );
1740 uno::Reference<beans::XPropertySet> xDimProp( xDim, uno::UNO_QUERY );
1741 uno::Reference<sheet::XHierarchiesSupplier> xDimSupp( xDim, uno::UNO_QUERY );
1746 sheet::DataPilotFieldOrientation_HIDDEN );
1749 if ( nOrient == sheet::DataPilotFieldOrientation_DATA )
1751 OUString aSourceName;
1752 OUString aGivenName;
1754 aDataNames.push_back( aSourceName );
1755 aGivenNames.push_back( aGivenName );
1757 else if ( nOrient != sheet::DataPilotFieldOrientation_HIDDEN )
1761 uno::Reference<container::XIndexAccess> xHiers =
new ScNameToIndexAccess( xDimSupp->getHierarchies() );
1764 if ( nHierarchy >= xHiers->getCount() )
1767 uno::Reference<sheet::XLevelsSupplier> xHierSupp(xHiers->getByIndex(nHierarchy),
1769 if ( xHierSupp.is() )
1771 uno::Reference<container::XIndexAccess> xLevels =
new ScNameToIndexAccess( xHierSupp->getLevels() );
1772 sal_Int32 nLevCount = xLevels->
getCount();
1773 for (sal_Int32 nLev=0; nLev<nLevCount; nLev++)
1775 uno::Reference<uno::XInterface> xLevel(xLevels->getByIndex(nLev),
1777 uno::Reference<container::XNamed> xLevNam( xLevel, uno::UNO_QUERY );
1778 uno::Reference<sheet::XMembersSupplier> xLevSupp( xLevel, uno::UNO_QUERY );
1779 if ( xLevNam.is() && xLevSupp.is() )
1781 uno::Reference<sheet::XMembersAccess> xMembers = xLevSupp->getMembers();
1783 OUString aFieldName( xLevNam->getName() );
1786 uno::Sequence<OUString> aMemberValueNames( xMembers->getElementNames() );
1787 uno::Sequence<OUString> aMemberValues( xMembers->getLocaleIndependentElementNames() );
1789 aFieldNames.push_back( aFieldName );
1790 aFieldValueNames.push_back( aMemberValueNames );
1791 aFieldValues.push_back( aMemberValues );
1801 SCSIZE nDataFields = aDataNames.size();
1802 SCSIZE nFieldCount = aFieldNames.size();
1803 OSL_ENSURE( aGivenNames.size() == nDataFields && aFieldValueNames.size() == nFieldCount &&
1804 aFieldValues.size() == nFieldCount,
"wrong count" );
1806 bool bError =
false;
1807 bool bHasData =
false;
1809 while (!aRemaining.isEmpty() && !bError)
1815 for (
SCSIZE nDataPos=0; nDataPos<nDataFields && !bUsed; nDataPos++ )
1818 sal_Int32 nMatched = 0;
1819 if (isAtStart(aRemaining, aDataNames[nDataPos], nMatched,
false,
nullptr))
1820 aFound = aDataNames[nDataPos];
1821 else if (isAtStart(aRemaining, aGivenNames[nDataPos], nMatched,
false,
nullptr))
1822 aFound = aGivenNames[nDataPos];
1824 if (!aFound.isEmpty())
1826 rDataFieldName = aFound;
1827 aRemaining = aRemaining.copy(nMatched);
1835 OUString aSpecField;
1836 bool bHasFieldName =
false;
1839 sal_Int32 nMatched = 0;
1840 for (
SCSIZE nField=0; nField<nFieldCount && !bHasFieldName; nField++ )
1842 if (isAtStart(aRemaining, aFieldNames[nField], nMatched,
true,
nullptr))
1844 aSpecField = aFieldNames[nField];
1845 aRemaining = aRemaining.copy(nMatched);
1849 if (aRemaining.startsWith(
"["))
1851 bHasFieldName =
true;
1867 bool bItemFound =
false;
1868 sal_Int32 nMatched = 0;
1869 OUString aFoundName;
1870 OUString aFoundValueName;
1871 OUString aFoundValue;
1875 OUString aQueryValueName;
1876 const bool bHasQuery = extractAtStart( aRemaining, nMatched,
false, &eFunc, aQueryValueName);
1878 OUString aQueryValue = aQueryValueName;
1886 sal_uInt32 nNumFormat = 0;
1888 if (pFormatter->
IsNumberFormat( aQueryValueName, nNumFormat, fValue))
1893 for (
SCSIZE nField=0; nField<nFieldCount; nField++ )
1897 if ( !bHasFieldName || aFieldNames[nField] == aSpecField )
1899 const uno::Sequence<OUString>& rItemNames = aFieldValueNames[nField];
1900 const uno::Sequence<OUString>& rItemValues = aFieldValues[nField];
1901 sal_Int32 nItemCount = rItemNames.getLength();
1902 assert(nItemCount == rItemValues.getLength());
1903 const OUString* pItemNamesArr = rItemNames.getConstArray();
1904 const OUString* pItemValuesArr = rItemValues.getConstArray();
1905 for ( sal_Int32 nItem=0; nItem<nItemCount; nItem++ )
1907 bool bThisItemFound;
1912 aQueryValueName, pItemNamesArr[nItem]);
1913 if (!bThisItemFound && pItemValuesArr[nItem] != pItemNamesArr[nItem])
1915 aQueryValueName, pItemValuesArr[nItem]);
1916 if (!bThisItemFound && aQueryValueName != aQueryValue)
1923 aQueryValue, pItemNamesArr[nItem]);
1924 if (!bThisItemFound && pItemValuesArr[nItem] != pItemNamesArr[nItem])
1926 aQueryValue, pItemValuesArr[nItem]);
1931 bThisItemFound = isAtStart( aRemaining, pItemNamesArr[nItem], nMatched,
false, &eFunc );
1932 if (!bThisItemFound && pItemValuesArr[nItem] != pItemNamesArr[nItem])
1933 bThisItemFound = isAtStart( aRemaining, pItemValuesArr[nItem], nMatched,
false, &eFunc );
1948 aFoundName = aFieldNames[nField];
1949 aFoundValueName = pItemNamesArr[nItem];
1950 aFoundValue = pItemValuesArr[nItem];
1960 if ( bItemFound && !bError )
1962 sheet::DataPilotFieldFilter aField;
1963 aField.FieldName = aFoundName;
1964 aField.MatchValueName = aFoundValueName;
1965 aField.MatchValue = aFoundValue;
1966 rFilters.push_back(aField);
1967 rFilterFuncs.push_back(eFoundFunc);
1968 aRemaining = aRemaining.copy(nMatched);
1979 if ( !bError && !bHasData && aDataNames.size() == 1 )
1982 rDataFieldName = aDataNames[0];
1986 return bHasData && !bError;
1995 uno::Reference<container::XNamed> xDim;
1996 uno::Reference<container::XNameAccess> xDimsName =
xSource->getDimensions();
1999 if ( rElemDesc.Dimension < nIntCount )
2001 xDim.set(xIntDims->getByIndex(rElemDesc.Dimension), uno::UNO_QUERY);
2003 OSL_ENSURE( xDim.is(),
"dimension not found" );
2004 if ( !xDim.is() )
return;
2005 OUString aDimName = xDim->getName();
2007 uno::Reference<beans::XPropertySet> xDimProp( xDim, uno::UNO_QUERY );
2020 uno::Reference<container::XIndexAccess> xHiers;
2021 uno::Reference<sheet::XHierarchiesSupplier> xHierSupp( xDim, uno::UNO_QUERY );
2022 if ( xHierSupp.is() )
2024 uno::Reference<container::XNameAccess> xHiersName = xHierSupp->getHierarchies();
2026 nHierCount = xHiers->getCount();
2028 uno::Reference<uno::XInterface> xHier;
2029 if ( rElemDesc.Hierarchy < nHierCount )
2030 xHier.set(xHiers->getByIndex(rElemDesc.Hierarchy), uno::UNO_QUERY);
2031 OSL_ENSURE( xHier.is(),
"hierarchy not found" );
2032 if ( !xHier.is() )
return;
2035 uno::Reference<container::XIndexAccess> xLevels;
2036 uno::Reference<sheet::XLevelsSupplier> xLevSupp( xHier, uno::UNO_QUERY );
2037 if ( xLevSupp.is() )
2039 uno::Reference<container::XNameAccess> xLevsName = xLevSupp->getLevels();
2041 nLevCount = xLevels->getCount();
2043 uno::Reference<uno::XInterface> xLevel;
2044 if ( rElemDesc.Level < nLevCount )
2045 xLevel.set(xLevels->getByIndex(rElemDesc.Level), uno::UNO_QUERY);
2046 OSL_ENSURE( xLevel.is(),
"level not found" );
2047 if ( !xLevel.is() )
return;
2049 uno::Reference<sheet::XMembersAccess> xMembers;
2050 uno::Reference<sheet::XMembersSupplier> xMbrSupp( xLevel, uno::UNO_QUERY );
2051 if ( xMbrSupp.is() )
2052 xMembers = xMbrSupp->getMembers();
2054 bool bFound =
false;
2055 bool bShowDetails =
true;
2057 if ( xMembers.is() )
2059 if ( xMembers->hasByName(rElemDesc.MemberName) )
2061 uno::Reference<beans::XPropertySet> xMbrProp(xMembers->getByName(rElemDesc.MemberName),
2063 if ( xMbrProp.is() )
2073 OSL_ENSURE( bFound,
"member not found" );
2079 OSL_ENSURE( pModifyData,
"no data?" );
2082 const OUString
aName = rElemDesc.MemberName;
2084 GetMemberByName(aName)->SetShowDetails( !bShowDetails );
2095 uno::Reference<sheet::XHierarchiesSupplier> xDimSupp( xDimProp, uno::UNO_QUERY );
2096 if ( xDimProp.is() && xDimSupp.is() )
2098 uno::Reference<container::XIndexAccess> xHiers =
new ScNameToIndexAccess( xDimSupp->getHierarchies() );
2101 if ( nHierarchy >= xHiers->getCount() )
2104 uno::Reference<sheet::XLevelsSupplier> xHierSupp(xHiers->getByIndex(nHierarchy),
2106 if ( xHierSupp.is() )
2108 uno::Reference<container::XIndexAccess> xLevels =
new ScNameToIndexAccess( xHierSupp->getLevels() );
2109 uno::Reference<uno::XInterface> xLevel(xLevels->getByIndex(0), uno::UNO_QUERY);
2110 uno::Reference<beans::XPropertySet> xLevProp( xLevel, uno::UNO_QUERY );
2111 if ( xLevProp.is() )
2118 catch(uno::Exception&)
2121 uno::Sequence<sal_Int16>
aSeq;
2122 if ( aSubAny >>= aSeq )
2125 for (
const sal_Int16 nElem : std::as_const(aSeq))
2133 OSL_FAIL(
"FirstSubTotal: NULL");
2144 FindByColumn(
SCCOL nCol,
PivotFunc nMask) : mnCol(nCol), mnMask(nMask) {}
2154 const uno::Reference<sheet::XDimensionsSupplier>& xSource,
2155 sheet::DataPilotFieldOrientation nOrient,
bool bAddData )
2159 bool bDataFound =
false;
2164 vector<tools::Long> aPos;
2166 uno::Reference<container::XNameAccess> xDimsName = xSource->getDimensions();
2169 for (
tools::Long nDim = 0; nDim < nDimCount; ++nDim)
2172 uno::Reference<beans::XPropertySet> xDimProp(xDims->getByIndex(nDim), uno::UNO_QUERY);
2177 sheet::DataPilotFieldOrientation_HIDDEN );
2179 if ( xDimProp.is() && nDimOrient == nOrient )
2185 if ( nOrient == sheet::DataPilotFieldOrientation_DATA )
2190 if ( eFunc == sheet::GeneralFunction2::AUTO )
2193 eFunc = sheet::GeneralFunction2::SUM;
2210 if (aOrigAny >>= nTmp)
2213 catch(uno::Exception&)
2218 if (nDupSource >= 0)
2226 nCompCol =
static_cast<SCCOL>(nDupSource);
2228 ScPivotFieldVector::iterator it = std::find_if(aFields.begin(), aFields.end(), FindByColumn(nCompCol, nMask));
2229 if (it != aFields.end())
2230 nDupCount = it->mnDupCount + 1;
2233 aFields.emplace_back();
2250 aPos.push_back(nPos);
2254 if (nOrient == sheet::DataPilotFieldOrientation_DATA)
2258 catch (uno::Exception&)
2266 size_t nOutCount = aFields.size();
2269 for (
size_t i = 0;
i < nOutCount - 1; ++
i)
2271 for (
size_t j = 0; j +
i < nOutCount - 1; ++j)
2273 if ( aPos[j+1] < aPos[j] )
2275 std::swap( aPos[j], aPos[j+1] );
2276 std::swap( aFields[j], aFields[j+1] );
2282 if (bAddData && !bDataFound)
2285 rFields.swap(aFields);
2310 uno::Reference<beans::XPropertySet> xProp(
xSource, uno::UNO_QUERY );
2327 catch(uno::Exception&)
2335 uno::Reference<sheet::XHierarchiesSupplier> xDimSupp( xDimProp, uno::UNO_QUERY );
2336 if (!xDimProp.is() || !xDimSupp.is())
2339 uno::Reference<container::XIndexAccess> xHiers =
new ScNameToIndexAccess( xDimSupp->getHierarchies() );
2342 if ( nHierarchy >= xHiers->getCount() )
2346 uno::Reference<sheet::XLevelsSupplier> xHierSupp(xHiers->getByIndex(nHierarchy),
2348 if (!xHierSupp.is())
2351 uno::Reference<container::XIndexAccess> xLevels =
2354 uno::Reference<beans::XPropertySet> xLevProp(xLevels->getByIndex(0), uno::UNO_QUERY);
2373 catch(uno::Exception&)
2379 const uno::Reference<container::XIndexAccess>& xDims, sal_Int32 nDim,
ScDPLabelData& rLabelData)
2381 uno::Reference<uno::XInterface> xIntDim(xDims->getByIndex(nDim), uno::UNO_QUERY);
2382 uno::Reference<container::XNamed> xDimName( xIntDim, uno::UNO_QUERY );
2383 uno::Reference<beans::XPropertySet> xDimProp( xIntDim, uno::UNO_QUERY );
2385 if (!xDimName.is() || !xDimProp.is())
2392 sal_Int32 nOrigPos = -1;
2393 OUString aFieldName;
2396 aFieldName = xDimName->getName();
2398 aOrigAny >>= nOrigPos;
2400 catch(uno::Exception&)
2416 rLabelData.
maName = aFieldName;
2444 uno::Reference<container::XNameAccess> xDimsName =
xSource->getDimensions();
2446 sal_Int32
nDimCount = xDims->getCount();
2447 if (nDimCount <= 0 || nDim >= nDimCount)
2461 uno::Reference<container::XNameAccess> xDimsName =
xSource->getDimensions();
2463 sal_Int32
nDimCount = xDims->getCount();
2467 for (sal_Int32 nDim = 0; nDim < nDimCount; ++nDim)
2471 rParam.
maLabelArray.push_back(std::unique_ptr<ScDPLabelData>(pNewLabel));
2478 uno::Reference<container::XNameAccess> xDimsName(
GetSource()->getDimensions() );
2482 uno::Reference<sheet::XHierarchiesSupplier> xHierSup(xIntDims->getByIndex( nDim ), uno::UNO_QUERY);
2485 xHiers.set( xHierSup->getHierarchies() );
2494 uno::Reference< container::XNameAccess > xHiersNA;
2497 rHiers = xHiersNA->getElementNames();
2503 sal_Int32 nHier = 0;
2504 uno::Reference<container::XNameAccess> xDimsName(
GetSource()->getDimensions() );
2506 uno::Reference<beans::XPropertySet> xDim(xIntDims->getByIndex( nDim ), uno::UNO_QUERY);
2517 bool ScDPObject::GetMembersNA( sal_Int32 nDim, sal_Int32 nHier, uno::Reference< sheet::XMembersAccess >& xMembers )
2520 uno::Reference<container::XNameAccess> xDimsName(
GetSource()->getDimensions() );
2522 uno::Reference<beans::XPropertySet> xDim(xIntDims->getByIndex( nDim ), uno::UNO_QUERY);
2525 uno::Reference<sheet::XHierarchiesSupplier> xHierSup(xDim, uno::UNO_QUERY);
2528 uno::Reference<container::XIndexAccess> xHiers(
new ScNameToIndexAccess(xHierSup->getHierarchies()));
2529 uno::Reference<sheet::XLevelsSupplier> xLevSupp( xHiers->getByIndex(nHier), uno::UNO_QUERY );
2530 if ( xLevSupp.is() )
2532 uno::Reference<container::XIndexAccess> xLevels(
new ScNameToIndexAccess( xLevSupp->getLevels()));
2535 sal_Int32 nLevCount = xLevels->getCount();
2538 uno::Reference<sheet::XMembersSupplier> xMembSupp( xLevels->getByIndex(0), uno::UNO_QUERY );
2539 if ( xMembSupp.is() )
2541 xMembers.set(xMembSupp->getMembers());
2556 OUString lcl_GetDimName(
const uno::Reference<sheet::XDimensionsSupplier>& xSource,
tools::Long nDim )
2561 uno::Reference<container::XNameAccess> xDimsName = xSource->getDimensions();
2564 if ( nDim < nDimCount )
2566 uno::Reference<container::XNamed> xDimName(xDims->getByIndex(nDim), uno::UNO_QUERY);
2571 aName = xDimName->getName();
2573 catch(uno::Exception&)
2582 bool hasFieldColumn(
const vector<ScPivotField>* pRefFields,
SCCOL nCol)
2587 return std::any_of(pRefFields->begin(), pRefFields->end(),
2590 return rField.nCol == nCol; });
2593 class FindByOriginalDim
2597 explicit FindByOriginalDim(
tools::Long nDim) : mnDim(nDim) {}
2608 const Reference<XDimensionsSupplier>& xSource,
2614 ScPivotFieldVector::const_iterator itr, itrBeg = rFields.begin(), itrEnd = rFields.end();
2615 for (itr = itrBeg; itr != itrEnd; ++itr)
2621 const sheet::DataPilotFieldReference& rFieldRef = rField.
maFieldRef;
2628 OUString aDocStr = lcl_GetDimName( xSource, nCol );
2629 if (!aDocStr.isEmpty())
2638 if ( nOrient == sheet::DataPilotFieldOrientation_DATA )
2645 if (hasFieldColumn(pRefColFields, nCol))
2648 if (bFirst && hasFieldColumn(pRefRowFields, nCol))
2651 if (bFirst && hasFieldColumn(pRefPageFields, nCol))
2658 bFirst = std::none_of(itrBeg, itr, FindByOriginalDim(nCol));
2676 std::vector<ScGeneralFunction> nSubTotalFuncs;
2677 nSubTotalFuncs.reserve(16);
2678 sal_uInt16 nMask = 1;
2681 if ( nFuncs & static_cast<PivotFunc>(nMask) )
2693 size_t nDimIndex = rField.
nCol;
2696 if (nDimIndex < rLabels.size())
2709 bool bAllowed =
true;
2712 case sheet::DataPilotFieldOrientation_PAGE:
2713 bAllowed = ( nDimFlags & sheet::DimensionFlags::NO_PAGE_ORIENTATION ) == 0;
2715 case sheet::DataPilotFieldOrientation_COLUMN:
2716 bAllowed = ( nDimFlags & sheet::DimensionFlags::NO_COLUMN_ORIENTATION ) == 0;
2718 case sheet::DataPilotFieldOrientation_ROW:
2719 bAllowed = ( nDimFlags & sheet::DimensionFlags::NO_ROW_ORIENTATION ) == 0;
2721 case sheet::DataPilotFieldOrientation_DATA:
2722 bAllowed = ( nDimFlags & sheet::DimensionFlags::NO_DATA_ORIENTATION ) == 0;
2734 bool bFound =
false;
2737 uno::Reference<container::XContentEnumerationAccess> xEnAc( xManager, uno::UNO_QUERY );
2740 uno::Reference<container::XEnumeration> xEnum = xEnAc->createContentEnumeration(
2742 if ( xEnum.is() && xEnum->hasMoreElements() )
2751 std::vector<OUString> aVec;
2756 uno::Reference<container::XContentEnumerationAccess> xEnAc( xManager, uno::UNO_QUERY );
2759 uno::Reference<container::XEnumeration> xEnum = xEnAc->createContentEnumeration(
2763 while ( xEnum->hasMoreElements() )
2765 uno::Any aAddInAny = xEnum->nextElement();
2768 uno::Reference<uno::XInterface> xIntFac;
2769 aAddInAny >>= xIntFac;
2772 uno::Reference<lang::XServiceInfo> xInfo( xIntFac, uno::UNO_QUERY );
2775 OUString
sName = xInfo->getImplementationName();
2776 aVec.push_back( sName );
2790 uno::Reference<sheet::XDimensionsSupplier> xRet;
2793 uno::Reference<container::XContentEnumerationAccess> xEnAc(xManager, uno::UNO_QUERY);
2797 uno::Reference<container::XEnumeration> xEnum =
2802 while (xEnum->hasMoreElements() && !xRet.is())
2804 uno::Any aAddInAny = xEnum->nextElement();
2805 uno::Reference<uno::XInterface> xIntFac;
2806 aAddInAny >>= xIntFac;
2810 uno::Reference<lang::XServiceInfo> xInfo(xIntFac, uno::UNO_QUERY);
2811 if (!xInfo.is() || xInfo->getImplementationName() != aImplName)
2819 uno::Reference<uno::XInterface> xInterface;
2820 uno::Reference<uno::XComponentContext> xCtx(
2822 uno::Reference<lang::XSingleComponentFactory> xCFac( xIntFac, uno::UNO_QUERY );
2824 xInterface = xCFac->createInstanceWithContext(xCtx);
2826 if (!xInterface.is())
2828 uno::Reference<lang::XSingleServiceFactory> xFac( xIntFac, uno::UNO_QUERY );
2830 xInterface = xFac->createInstance();
2833 uno::Reference<lang::XInitialization> xInit( xInterface, uno::UNO_QUERY );
2837 uno::Sequence<uno::Any>
aSeq(4);
2838 uno::Any* pArray = aSeq.getArray();
2843 xInit->initialize( aSeq );
2845 xRet.set( xInterface, uno::UNO_QUERY );
2847 catch(uno::Exception&)
2855 #if DUMP_PIVOT_TABLE
2881 struct FindInvalidRange
2883 bool operator() (
const ScRange& r)
const
2910 RangeIndexType::const_iterator it = std::find(maRanges.
begin(), maRanges.
end(), rRange);
2911 if (it == maRanges.
end())
2915 size_t nIndex = std::distance(maRanges.
begin(), it);
2916 CachesType::const_iterator
const itCache = m_Caches.find(nIndex);
2917 return itCache != m_Caches.end();
2922 RangeIndexType::iterator it = std::find(maRanges.
begin(), maRanges.
end(), rRange);
2923 if (it != maRanges.
end())
2926 size_t nIndex = std::distance(maRanges.
begin(), it);
2927 CachesType::iterator
const itCache = m_Caches.find(nIndex);
2928 if (itCache == m_Caches.end())
2930 OSL_FAIL(
"Cache pool and index pool out-of-sync !!!");
2936 (itCache->second)->ClearGroupFields();
2940 return itCache->second.get();
2945 pCache->InitFromDoc(
mrDoc, rRange);
2950 it = std::find_if(maRanges.
begin(), maRanges.
end(), FindInvalidRange());
2953 if (it == maRanges.
end())
2962 nIndex = std::distance(maRanges.
begin(), it);
2966 m_Caches.insert(std::make_pair(nIndex, std::move(pCache)));
2972 RangeIndexType::iterator it = std::find(maRanges.
begin(), maRanges.
end(), rRange);
2973 if (it == maRanges.
end())
2978 size_t nIndex = std::distance(maRanges.
begin(), it);
2979 CachesType::iterator
const itCache = m_Caches.find(nIndex);
2980 if (itCache == m_Caches.end())
2982 OSL_FAIL(
"Cache pool and index pool out-of-sync !!!");
2986 return itCache->second.get();
2991 RangeIndexType::const_iterator it = std::find(maRanges.
begin(), maRanges.
end(), rRange);
2992 if (it == maRanges.
end())
2997 size_t nIndex = std::distance(maRanges.
begin(), it);
2998 CachesType::const_iterator
const itCache = m_Caches.find(nIndex);
2999 if (itCache == m_Caches.end())
3001 OSL_FAIL(
"Cache pool and index pool out-of-sync !!!");
3005 return itCache->second.get();
3010 return m_Caches.size();
3016 if (maRanges.
empty())
3020 for (
ScRange& rKeyRange : maRanges)
3022 SCCOL nCol1 = rKeyRange.aStart.Col();
3023 SCROW nRow1 = rKeyRange.aStart.Row();
3024 SCTAB nTab1 = rKeyRange.aStart.Tab();
3025 SCCOL nCol2 = rKeyRange.aEnd.Col();
3026 SCROW nRow2 = rKeyRange.aEnd.Row();
3027 SCTAB nTab2 = rKeyRange.aEnd.Tab();
3033 nCol1, nRow1, nTab1, nCol2, nRow2, nTab2);
3038 ScRange aNew(nCol1, nRow1, nTab1, nCol2, nRow2, nTab2);
3046 RangeIndexType::iterator it = std::find(maRanges.
begin(), maRanges.
end(), rRange);
3047 if (it == maRanges.
end())
3054 size_t nIndex = std::distance(maRanges.
begin(), it);
3055 CachesType::iterator
const itCache = m_Caches.find(nIndex);
3056 if (itCache == m_Caches.end())
3058 OSL_FAIL(
"Cache pool and index pool out-of-sync !!!");
3072 setGroupItemsToCache(rCache, rRefs);
3077 CachesType::iterator it = std::find_if(m_Caches.begin(), m_Caches.end(),
3078 [&p](
const CachesType::value_type& rEntry) {
return rEntry.second.get() == p; });
3079 if (it != m_Caches.end())
3081 size_t idx = it->first;
3083 maRanges[idx].SetInvalid();
3098 return m_Caches.count(rName) != 0;
3104 CachesType::const_iterator
const itr = m_Caches.find(rName);
3105 if (itr != m_Caches.end())
3107 return itr->second.get();
3110 pCache->InitFromDoc(
mrDoc, rRange);
3115 m_Caches.insert(std::make_pair(rName, std::move(pCache)));
3121 CachesType::iterator
const itr = m_Caches.find(rName);
3122 return itr != m_Caches.end() ? itr->second.get() :
nullptr;
3127 return m_Caches.size();
3133 CachesType::iterator
const itr = m_Caches.find(rName);
3134 if (itr == m_Caches.end())
3148 setGroupItemsToCache(rCache, rRefs);
3153 CachesType::iterator it = std::find_if(m_Caches.begin(), m_Caches.end(),
3154 [&p](
const CachesType::value_type& rEntry) {
return rEntry.second.get() == p; });
3155 if (it != m_Caches.end())
3164 mnSdbType(nSdbType), maDBName(rDBName), maCommand(rCommand) {}
3168 return left < right;
3175 DBType aType(nSdbType, rDBName, rCommand);
3176 CachesType::const_iterator
const itr = m_Caches.find(aType);
3177 return itr != m_Caches.end();
3181 sal_Int32 nSdbType,
const OUString& rDBName,
const OUString& rCommand,
3184 DBType aType(nSdbType, rDBName, rCommand);
3185 CachesType::const_iterator
const itr = m_Caches.find(aType);
3186 if (itr != m_Caches.end())
3188 return itr->second.get();
3190 uno::Reference<sdbc::XRowSet> xRowSet = createRowSet(nSdbType, rDBName, rCommand);
3196 DBConnector aDB(*pCache, xRowSet, aFormat.
GetNullDate());
3200 if (!pCache->InitFromDataBase(aDB))
3210 ::comphelper::disposeComponent(xRowSet);
3212 m_Caches.insert(std::make_pair(aType, std::move(pCache)));
3217 sal_Int32 nSdbType,
const OUString& rDBName,
const OUString& rCommand)
3219 DBType aType(nSdbType, rDBName, rCommand);
3220 CachesType::iterator
const itr = m_Caches.find(aType);
3221 return itr != m_Caches.end() ? itr->second.get() :
nullptr;
3225 sal_Int32 nSdbType,
const OUString& rDBName,
const OUString& rCommand)
3227 uno::Reference<sdbc::XRowSet> xRowSet;
3234 uno::Reference<beans::XPropertySet> xRowProp(xRowSet, UNO_QUERY);
3235 OSL_ENSURE( xRowProp.is(),
"can't get RowSet" );
3238 xRowSet.set(
nullptr);
3248 uno::Reference<sdb::XCompletedExecution> xExecute( xRowSet, uno::UNO_QUERY );
3249 if ( xExecute.is() )
3251 uno::Reference<task::XInteractionHandler> xHandler(
3253 uno::UNO_QUERY_THROW);
3254 xExecute->executeWithCompletion( xHandler );
3261 catch (
const sdbc::SQLException& rError )
3265 VclMessageType::Info, VclButtonsType::Ok,
3269 catch ( uno::Exception& )
3274 xRowSet.set(
nullptr);
3279 sal_Int32 nSdbType,
const OUString& rDBName,
const OUString& rCommand,
3282 DBType aType(nSdbType, rDBName, rCommand);
3283 CachesType::iterator
const it = m_Caches.find(aType);
3284 if (it == m_Caches.end())
3293 uno::Reference<sdbc::XRowSet> xRowSet = createRowSet(nSdbType, rDBName, rCommand);
3301 DBConnector aDB(rCache, xRowSet, aFormat.
GetNullDate());
3318 setGroupItemsToCache(rCache, rRefs);
3323 CachesType::iterator it = std::find_if(m_Caches.begin(), m_Caches.end(),
3324 [&p](
const CachesType::value_type& rEntry) {
return rEntry.second.get() == p; });
3325 if (it != m_Caches.end())
3343 maSheetCaches(r.mrDoc),
3344 maNameCaches(r.mrDoc),
3363 explicit MatchByTable(
SCTAB nTab) : mnTab(nTab) {}
3365 bool operator() (
const std::unique_ptr<ScDPObject>& rObj)
const
3367 return rObj->GetOutRange().aStart.Tab() == mnTab;
3376 return STR_ERR_DATAPILOTSOURCE;
3383 return STR_ERR_DATAPILOTSOURCE;
3421 return STR_ERR_DATAPILOTSOURCE;
3527 for (
const std::unique_ptr<ScDPObject>& aTable :
maTables)
3531 if (&rRefObj == &rDPObj)
3540 if (pDesc ==
nullptr || pRefDesc ==
nullptr)
3573 if (pDesc ==
nullptr || pRefDesc ==
nullptr)
3599 rxTable->UpdateReference(eUpdateRefMode, r, nDx, nDy, nDz);
3608 for (
const auto& rxTable :
maTables)
3622 aAdded.push_back(std::unique_ptr<ScDPObject>(pNew));
3625 std::move(aAdded.begin(), aAdded.end(), std::back_inserter(maTables));
3631 [](
const TablesType::value_type&
a,
const TablesType::value_type& b) {
return a->RefsEqual(*b); });
3639 TablesType::iterator itr2 = r.
maTables.begin();
3640 for (
const auto& rxTable :
maTables)
3642 rxTable->WriteRefsTo(**itr2);
3652 size_t nDestSize = r.
maTables.size();
3653 OSL_ENSURE( nSrcSize >= nDestSize,
"WriteRefsTo: missing entries in document" );
3654 for (
size_t nSrcPos = 0; nSrcPos < nSrcSize; ++nSrcPos)
3657 const OUString& aName = rSrcObj.
GetName();
3658 bool bFound =
false;
3659 for (
size_t nDestPos = 0; nDestPos < nDestSize && !bFound; ++nDestPos)
3662 if (rDestObj.
GetName() == aName)
3675 OSL_ENSURE(
maTables.size() == r.
maTables.size(),
"WriteRefsTo: couldn't restore all entries" );
3698 if (
pObject->GetName() == rName)
3708 for (
size_t nAdd = 0; nAdd <= n; ++nAdd)
3710 OUString aNewName =
"DataPilot" + OUString::number(1 + nAdd);
3712 [&aNewName](
const TablesType::value_type& rxObj) {
return rxObj->GetName() == aNewName; }))
3725 auto funcRemoveCondition = [pDPObject] (std::unique_ptr<ScDPObject>
const & pCurrent)
3727 return pCurrent.get() == pDPObject;
3735 const ScRange& rOutRange = pDPObj->GetOutRange();
3740 maTables.push_back(std::move(pDPObj));
3746 for (
const std::unique_ptr<ScDPObject>& aTable :
maTables)
3748 if (aTable.get() == pDPObj)
3788 return std::for_each(
maTables.begin(),
maTables.end(), AccumulateOutputRanges(nTab)).getRanges();
3793 return std::any_of(
maTables.begin(),
maTables.end(), FindIntersectingTableByColumns(nCol1, nCol2, nRow, nTab));
3798 return std::any_of(
maTables.begin(),
maTables.end(), FindIntersectingTableByRows(nCol, nRow1, nRow2, nTab));
3803 return std::any_of(
maTables.begin(),
maTables.end(), FindIntersectingTable(rRange));
3806 #if DEBUG_PIVOT_TABLE
3812 void operator() (
const std::unique_ptr<ScDPObject>& rObj)
const
3814 cout <<
"-- '" << rObj->GetName() <<
"'" <<
endl;
3827 void ScDPCollection::DumpTables()
const
3852 for (
const auto& rxTable :
maTables)
3871 aRefs.
insert(const_cast<ScDPObject*>(&rObj));
3880 for (
const auto& rxTable :
maTables)
3899 aRefs.
insert(const_cast<ScDPObject*>(&rObj));
3906 sal_Int32 nSdbType, std::u16string_view rDBName, std::u16string_view rCommand,
3910 for (
const auto& rxTable :
maTables)
3925 aRefs.
insert(const_cast<ScDPObject*>(&rObj));
SheetCaches(ScDocument &rDoc)
void SetValue(double fVal)
OString stripEnd(const OString &rIn, char c)
bool operator()(const DBType &left, const DBType &right) const
const ScDPDimensionSaveData * GetExistingDimensionData() const
SAL_DLLPRIVATE ScDPTableData * GetTableData()
#define SC_UNO_DP_FIELD_SUBTOTALNAME
bool IsDimNameInUse(std::u16string_view rName) const
virtual sal_Int32 SAL_CALL getCount() override
const std::optional< OUString > & GetLayoutName() const
void GetHeaderPositionData(const ScAddress &rPos, css::sheet::DataPilotTableHeaderData &rData)
static ScRefUpdateRes Update(const ScDocument *pDoc, UpdateRefMode eUpdateRefMode, SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2, SCROW nRow2, SCTAB nTab2, SCCOL nDx, SCROW nDy, SCTAB nDz, SCCOL &theCol1, SCROW &theRow1, SCTAB &theTab1, SCCOL &theCol2, SCROW &theRow2, SCTAB &theTab2)
void ReloadGroupTableData()
#define SC_UNO_DP_IGNOREEMPTY
static ScGeneralFunction FirstFunc(PivotFunc nBits)
ScPivotFieldVector maDataFields
This class has to do with handling exclusively grouped dimensions? TODO: Find out what this class doe...
void CopyToTab(SCTAB nOld, SCTAB nNew)
constexpr OUStringLiteral SC_DBPROP_COMMAND
SC_DLLPUBLIC size_t GetCount() const
void SetOrientation(css::sheet::DataPilotFieldOrientation nNew)
std::vector< Member > maMembers
void FillOldParam(ScPivotParam &rParam) const
static OUString GetLocaleIndependentFormattedString(double fValue, SvNumberFormatter &rFormatter, sal_uInt32 nNumFormat)
#define SC_UNO_DP_REFVALUE
static sal_Int32 GetLongProperty(const css::uno::Reference< css::beans::XPropertySet > &xProp, const OUString &rName)
SC_DLLPUBLIC SheetCaches & GetSheetCaches()
bool HasGroupDimensions() const
void WriteSourceDataTo(ScDPObject &rDest) const
static void ConvertOrientation(ScDPSaveData &rSaveData, const ScPivotFieldVector &rFields, css::sheet::DataPilotFieldOrientation nOrient, const css::uno::Reference< css::sheet::XDimensionsSupplier > &xSource, const ScDPLabelDataVector &rLabels, const ScPivotFieldVector *pRefColFields=nullptr, const ScPivotFieldVector *pRefRowFields=nullptr, const ScPivotFieldVector *pRefPageFields=nullptr)
bool mbEnableGetPivotData
static weld::Window * GetActiveDialogParent()
DBType(sal_Int32 nSdbType, const OUString &rDBName, const OUString &rCommand)
bool RefsEqual(const ScDPCollection &r) const
std::unique_ptr< sal_Int32[]> pData
static void GetDataDimensionNames(OUString &rSourceName, OUString &rGivenName, const css::uno::Reference< css::uno::XInterface > &xDim)
tools::Long GetDimCount()
bool Intersects(const ScRange &rRange) const
SC_DLLPUBLIC bool GetReferenceGroups(const ScDPObject &rDPObj, const ScDPDimensionSaveData **pGroups) const
void GetDrillDownData(const ScAddress &rPos, css::uno::Sequence< css::uno::Sequence< css::uno::Any > > &rTableData)
#define SC_UNO_DP_COLGRAND
constexpr OUStringLiteral SC_DBPROP_DATASOURCENAME
dp field button with presence of hidden member
SC_DLLPUBLIC bool ApplyFlagsTab(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, SCTAB nTab, ScMF nFlags)
bool remove(const ScDPCache *p)
#define SC_UNO_DP_SORTING
TranslateId CheckSourceRange() const
Check the sanity of the data source range.
void SetOutRange(const ScRange &rRange)
void FillLabelData(sal_Int32 nDim, ScDPLabelData &Labels)
void SetSubTotals(std::vector< ScGeneralFunction > &&rFuncs)
const ContentProperties & rData
sal_Int32 mnUsedHier
Used hierarchy.
void SetAllowMove(bool bSet)
bool mbShowAll
true = Show all (also empty) results.
void updateReference(UpdateRefMode eMode, const ScRange &r, SCCOL nDx, SCROW nDy, SCTAB nDz)
static EnumT GetEnumProperty(const css::uno::Reference< css::beans::XPropertySet > &xProp, const OUString &rName, EnumT nDefault)
std::vector< std::unique_ptr< ScDPObject > > TablesType
#define SC_UNO_DP_REPEATEMPTY
void EnableGetPivotData(bool b)
#define SC_UNO_DP_POSITION
void swap(sorted_vector &other)
void SetImportDesc(const ScImportSourceDesc &rDesc)
Data caches for range name based source data.
static OUString GetStringProperty(const css::uno::Reference< css::beans::XPropertySet > &xProp, const OUString &rName, const OUString &rDefault)
This class represents the cached data part of the datapilot cache table implementation.
EmbeddedObjectRef * pObject
void InitFromDoc(ScDocument &rDoc, const ScRange &rRange)
ScDPObject * GetByName(std::u16string_view rName) const
constexpr OUStringLiteral SC_SERVICE_ROWSET
SAL_DLLPRIVATE void ClearSource()
bool IsImportData() const
bool mbIsValue
true = Sum or count in data field.
css::sheet::DataPilotFieldLayoutInfo maLayoutInfo
Layout info.
ScDPServiceDesc(const OUString &rServ, const OUString &rSrc, const OUString &rNam, const OUString &rUser, const OUString &rPass)
#define SC_UNO_DP_ORIGINAL
ScDPCollection(ScDocument &rDocument)
OUString CreateNewName() const
Create a new name that's not yet used by any existing data pilot objects.
#define SC_UNO_DP_LAYOUTNAME
std::shared_ptr< ScDPTableData > mpTableData
css::uno::Reference< css::sheet::XDimensionsSupplier > xSource
static bool HasRegisteredSources()
void GetHierarchies(sal_Int32 nDim, css::uno::Sequence< OUString > &rHiers)
constexpr OUStringLiteral SC_DBPROP_COMMANDTYPE
const ScRange & GetOutRange() const
Data caches for external database sources.
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 ...
SC_DLLPUBLIC SCSIZE GetEntryCount() const
sal_Int32 mnFlags
Flags from the DataPilotSource dimension.
std::unique_ptr< ScDPServiceDesc > pServDesc
void push_back(const ScRange &rRange)
SC_DLLPUBLIC const ScQueryEntry & GetEntry(SCSIZE n) const
Defines connection type to external data source.
void AddReference(ScDPObject *pObj) const
bool SyncAllDimensionMembers()
Remove in the save data entries for members that don't exist anymore.
bool ReloadGroupsInCache(const ScDPObject *pDPObj, o3tl::sorted_vector< ScDPObject * > &rRefs)
SC_DLLPUBLIC const ScRange & GetSourceRange() const
Get the range that contains the source data.
ScGeneralFunction GetFunction() const
bool GetMembersNA(sal_Int32 nDim, css::uno::Reference< css::sheet::XMembersAccess > &xMembers)
virtual void ReloadCacheTable()=0
void SetStringInterned(rtl_uString *pS)
void SetSheetDesc(const ScSheetSourceDesc &rDesc)
virtual void SetEmptyFlags(bool bIgnoreEmptyRows, bool bRepeatIfEmpty)=0
void Output(const ScAddress &rPos)
std::unordered_map< OUString, size_t > DimOrderType
bool IsDataDescriptionCell(const ScAddress &rPos)
Data description cell displays the description of a data dimension if and only if there is only one d...
void SetFunction(ScGeneralFunction nNew)
static SC_DLLPUBLIC OUString getSourceDimensionName(std::u16string_view rName)
void GetAllTables(const ScRange &rSrcRange, o3tl::sorted_vector< ScDPObject * > &rRefs) const
SC_DLLPUBLIC const SfxPoolItem * GetAttr(SCCOL nCol, SCROW nRow, SCTAB nTab, sal_uInt16 nWhich) const
OUString maName
Original name of the dimension.
#define SC_UNO_DP_REPEATITEMLABELS
static css::uno::Reference< css::sheet::XDimensionsSupplier > CreateSource(const ScDPServiceDesc &rDesc)
void WriteRefsTo(ScDPObject &r) const
#define SAL_N_ELEMENTS(arr)
void SetName(const OUString &rNew)
void SetLayoutName(const OUString &rName)
ScDPLabelDataVector maLabelArray
bool IsFilterButton(const ScAddress &rPos)
bool IsBlockEmpty(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, SCTAB nTab) const
static PivotFunc FunctionBit(sal_Int16 eFunc)
Interface for connecting to database source.
void SetHeaderLayout(bool bUseGrid)
#define DBG_UNHANDLED_EXCEPTION(...)
bool IntersectsTableByColumns(SCCOL nCol1, SCCOL nCol2, SCROW nRow, SCTAB nTab) const
bool RefsEqual(const ScDPObject &r) const
const ScDPCache * getCache(const OUString &rName, const ScRange &rRange, const ScDPDimensionSaveData *pDimData)
bool IntersectsTableByRows(SCCOL nCol, SCROW nRow1, SCROW nRow2, SCTAB nTab) const
#define TOOLS_WARN_EXCEPTION(area, stream)
ScPivotFieldVector maColFields
When assigning a string value, you can also assign an interned string whose life-cycle is managed by ...
#define SC_UNO_DP_FUNCTION2
ScDPCache * getExistingCache(sal_Int32 nSdbType, const OUString &rDBName, const OUString &rCommand)
SC_DLLPUBLIC ScDPObject & operator[](size_t nIndex)
SC_DLLPUBLIC const std::vector< ScRange > & getAllRanges() const
std::vector< std::unique_ptr< ScDPLabelData > > ScDPLabelDataVector
tools::Long mnOriginalDim
>= 0 for duplicated field.
Stores and manages all caches from internal sheets.
std::vector< ScPivotField > ScPivotFieldVector
virtual OUString getDimensionName(sal_Int32 nColumn)=0
const ScDPCache * getCache(const ScRange &rRange, const ScDPDimensionSaveData *pDimData)
css::uno::Reference< css::sheet::XDimensionsSupplier > const & GetSource()
void SetSaveData(const ScDPSaveData &rData)
static SC_DLLPUBLIC const CharClass & getCharClass()
const OUString & GetName() const
::std::vector< ScRange >::const_iterator end() const
HRESULT createInstance(REFIID iid, Ifc **ppIfc)
void SetTag(const OUString &rNew)
static bool GetBoolProperty(const css::uno::Reference< css::beans::XPropertySet > &xProp, const OUString &rName, bool bDefault=false)
std::unique_ptr< ScDPSaveData > pSaveData
OUString uppercase(const OUString &rStr, sal_Int32 nPos, sal_Int32 nCount) const
bool GetHeaderDrag(const ScAddress &rPos, bool bMouseLeft, bool bMouseTop, tools::Long nDragDim, tools::Rectangle &rPosRect, css::sheet::DataPilotFieldOrientation &rOrient, tools::Long &rDimPos)
NameCaches(ScDocument &rDoc)
static sheet::DataPilotFieldOrientation lcl_GetDataGetOrientation(const uno::Reference< sheet::XDimensionsSupplier > &xSource)
bool hasCache(const ScRange &rRange) const
TranslateId ReloadCache(const ScDPObject *pDPObj, o3tl::sorted_vector< ScDPObject * > &rRefs)
ScDPSaveData * GetSaveData() const
bool GetHierarchiesNA(sal_Int32 nDim, css::uno::Reference< css::container::XNameAccess > &xHiers)
SC_DLLPUBLIC ScDPObject * InsertNewTable(std::unique_ptr< ScDPObject > pDPObj)
const ScImportSourceDesc * GetImportSourceDesc() const
css::sheet::DataPilotFieldReference maFieldRef
static bool lcl_HasButton(const ScDocument *pDoc, SCCOL nCol, SCROW nRow, SCTAB nTab)
bool ParseFilters(OUString &rDataFieldName, std::vector< css::sheet::DataPilotFieldFilter > &rFilters, std::vector< sal_Int16 > &rFilterFuncs, std::u16string_view rFilterList)
#define SC_UNO_DP_AUTOSHOW
ScDPObject & operator=(const ScDPObject &r)
css::beans::Optional< css::uno::Any > getValue(std::u16string_view id)
static SC_DLLPUBLIC LanguageType eLnge
Reference< XComponentContext > getComponentContext(Reference< XMultiServiceFactory > const &factory)
SCCOL nCol
Cursor Position /.
ScDPSaveDimension * DuplicateDimension(std::u16string_view rName)
void SetReferenceValue(const css::sheet::DataPilotFieldReference *pNew)
Reference not affected, no change at all.
static PivotFunc lcl_FirstSubTotal(const uno::Reference< beans::XPropertySet > &xDimProp)
bool GetMembers(sal_Int32 nDim, sal_Int32 nHier,::std::vector< ScDPLabelData::Member > &rMembers)
bool hasCache(sal_Int32 nSdbType, const OUString &rDBName, const OUString &rCommand) const
bool GetDataFieldPositionData(const ScAddress &rPos, css::uno::Sequence< css::sheet::DataPilotFieldFilter > &rFilters)
bool hasCache(const OUString &rName) const
DBCaches(ScDocument &rDoc)
static sal_uInt8 getDuplicateIndex(const OUString &rName)
Get a duplicate index in case the dimension is a duplicate.
const std::shared_ptr< ScDPTableData > & GetSourceTableData() const
bool remove(const ScDPCache *p)
#define SC_UNO_DP_ROWGRAND
void RemoveCache(const ScDPCache *pCache)
Only to be called from ScDPCache::RemoveReference().
bool HasRangeName() const
#define SC_UNO_DP_ORIENTATION
#define SC_UNO_DP_ORIGINAL_POS
SC_DLLPUBLIC size_t size() const
OUString GetDimName(tools::Long nDim, bool &rIsDataLayout, sal_Int32 *pFlags=nullptr)
SAL_DLLPRIVATE void FillLabelDataForDimension(const css::uno::Reference< css::container::XIndexAccess > &xDims, sal_Int32 nDim, ScDPLabelData &rLabelData)
OUString maLayoutName
Layout name (display name)
#define SC_UNO_DP_SHOWEMPTY
bool GetMemberNames(sal_Int32 nDim, css::uno::Sequence< OUString > &rNames)
static bool IsOrientationAllowed(css::sheet::DataPilotFieldOrientation nOrient, sal_Int32 nDimFlags)
constexpr TypedWhichId< ScMergeFlagAttr > ATTR_MERGE_FLAG(145)
Base class that abstracts different data source types of a datapilot table.
bool InitFromDataBase(DBConnector &rDB)
ScDPObject(ScDocument *pD)
bool operator<(const ScDPCollection::DBType &left, const ScDPCollection::DBType &right)
Reference< XMultiServiceFactory > getProcessServiceFactory()
std::unique_ptr< char[]> aBuffer
void UpdateReference(UpdateRefMode eUpdateRefMode, const ScRange &r, SCCOL nDx, SCROW nDy, SCTAB nDz)
SC_DLLPUBLIC bool HasTable(const ScDPObject *pDPObj) const
void updateCache(const OUString &rName, const ScRange &rRange, o3tl::sorted_vector< ScDPObject * > &rRefs)
ScRangeList GetAllTableRanges(SCTAB nTab) const
#define SC_UNO_DP_USEDHIERARCHY
css::uno::Sequence< OUString > maHiers
Hierarchies.
void Join(const ScRange &, bool bIsInList=false)
SheetCaches maSheetCaches
void SetSubtotalName(const OUString &rName)
std::unordered_set< OUString > ScDPUniqueStringSet
SvStream & endl(SvStream &rStr)
void SetServiceData(const ScDPServiceDesc &rDesc)
ScGeneralFunction
the css::sheet::GeneralFunction enum is extended by constants in GeneralFunction2, which causes some type-safety issues.
std::unique_ptr< ScImportSourceDesc > pImpDesc
const OUString & GetName() const
SCROW nRow
or start of destination area
#define SC_UNO_DP_ISVISIBLE
css::sheet::DataPilotFieldSortInfo maSortInfo
Sorting info.
OString strip(const OString &rIn, char c)
SC_DLLPUBLIC bool RemoveFlagsTab(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, SCTAB nTab, ScMF nFlags)
static void lcl_FillLabelData(ScDPLabelData &rData, const uno::Reference< beans::XPropertySet > &xDimProp)
const ScDPObjectSet & GetAllReferences() const
bool remove(const ScDPCache *p)
const ScSheetSourceDesc * GetSheetDesc() const
const OUString & GetRangeName() const
OUString GetFormattedString(std::u16string_view rDimName, const double fValue)
void RemoveSubtotalName()
bool operator==(const ScDPServiceDesc &rOther) const
ScPivotFieldVector maRowFields
sal_Int32 GetUsedHierarchy(sal_Int32 nDim)
Reference< XComponentContext > getProcessComponentContext()
Sequence< sal_Int8 > aSeq
static sal_Int16 GetShortProperty(const css::uno::Reference< css::beans::XPropertySet > &xProp, const OUString &rName, sal_Int16 nDefault)
OString stripStart(const OString &rIn, char c)
void UpdateReference(UpdateRefMode eUpdateRefMode, const ScRange &r, SCCOL nDx, SCROW nDy, SCTAB nDz)
void GetMemberResultNames(ScDPUniqueStringSet &rNames, tools::Long nDimension)
void SetShowEmpty(bool bSet)
OUString GetFormattedString(sal_Int32 nDim, const ScDPItemData &rItem, bool bLocaleIndependent) const
bool IsDuplicated(tools::Long nDim)
std::map< OUString, css::uno::Any > maInteropGrabBag
void WriteRefsTo(ScDPCollection &r) const
void WriteToData(ScDPGroupTableData &rData) const
void disposeComponent(css::uno::Reference< TYPE > &_rxComp)
double GetPivotData(const OUString &rDataFieldName, std::vector< css::sheet::DataPilotFieldFilter > &rFilters)
static SC_DLLPUBLIC OUString getDisplayedMeasureName(const OUString &rName, ScSubTotalFunc eFunc)
std::unique_ptr< ScSheetSourceDesc > pSheetDesc
::std::vector< ScRange >::const_iterator begin() const
constexpr OUStringLiteral SCDPSOURCE_SERVICE
void WriteToCache(ScDPCache &rCache) const
#define SC_UNO_DP_SHOWDETAILS
ScPivotFieldVector maPageFields
void WriteTempDataTo(ScDPObject &rDest) const
SAL_DLLPRIVATE void CreateOutput()
void DeleteOnTab(SCTAB nTab)
#define SC_UNO_DP_ISDATALAYOUT
static css::uno::Reference< css::sdbc::XRowSet > createRowSet(sal_Int32 nSdbType, const OUString &rDBName, const OUString &rCommand)
const char *const aFieldNames[]
static SC_DLLPUBLIC::utl::TransliterationWrapper & GetTransliteration()
std::unique_ptr< ScDPOutput > pOutput
std::pair< const_iterator, bool > insert(Value &&x)
void BuildAllDimensionMembers()
SC_DLLPUBLIC void DeleteAreaTab(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, SCTAB nTab, InsertDeleteFlags nDelFlag)
NameCaches & GetNameCaches()
SAL_DLLPRIVATE void CreateObjects()
constexpr OUStringLiteral first
static void lcl_FillOldFields(ScPivotFieldVector &rFields, const uno::Reference< sheet::XDimensionsSupplier > &xSource, sheet::DataPilotFieldOrientation nOrient, bool bAddData)
ScRange GetNewOutputRange(bool &rOverflow)
static std::vector< OUString > GetRegisteredSources()
sal_Int32 GetCommandType() const
SC_DLLPUBLIC ScDPCache * getExistingCache(const ScRange &rRange)
#define SC_UNO_DP_SUBTOTAL2
This class contains authoritative information on the internal reference used as the data source for d...
void updateCache(sal_Int32 nSdbType, const OUString &rDBName, const OUString &rCommand, o3tl::sorted_vector< ScDPObject * > &rRefs)
ScRange GetOutputRangeByType(sal_Int32 nType)
tools::Long getOriginalDim() const
tools::Long mnOriginalDim
original dimension index (>= 0 for duplicated dimension)
const ScDPCache * getCache(sal_Int32 nSdbType, const OUString &rDBName, const OUString &rCommand, const ScDPDimensionSaveData *pDimData)
SC_DLLPUBLIC ScDPSaveDimension * GetDimensionByName(const OUString &rName)
Get a dimension object by its name.
SCCOL nCol
0-based dimension index (not source column index)
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, bool bMobile=false)
ScDPCache * getExistingCache(const OUString &rName)
tools::Long GetHeaderDim(const ScAddress &rPos, css::sheet::DataPilotFieldOrientation &rOrient)
SC_DLLPUBLIC ScDPSaveDimension * GetDataLayoutDimension()
void ToggleDetails(const css::sheet::DataPilotTableHeaderData &rElemDesc, ScDPObject *pDestObj)
static SC_DLLPUBLIC ScSubTotalFunc toSubTotalFunc(ScGeneralFunction eGenFunc)
SCCOL mnCol
0-based field index (not the source column index)
css::sheet::DataPilotFieldAutoShowInfo maShowInfo
AutoShow info.
void GetPositionData(const ScAddress &rPos, css::sheet::DataPilotTablePositionData &rPosData)
void updateCache(const ScRange &rRange, o3tl::sorted_vector< ScDPObject * > &rRefs)
void FreeTable(const ScDPObject *pDPObj)
bool m_bDetectedRangeSegmentation false
virtual sal_Int32 GetColumnCount()=0
use (new) typed collection instead of ScStrCollection or separate Str and ValueCollection ...