30#include <document.hxx>
37#include <unonames.hxx>
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>
86using ::std::shared_ptr;
87using ::com::sun::star::uno::Sequence;
88using ::com::sun::star::uno::Reference;
89using ::com::sun::star::uno::UNO_QUERY;
90using ::com::sun::star::uno::Any;
91using ::com::sun::star::uno::Exception;
92using ::com::sun::star::lang::XComponent;
93using ::com::sun::star::sheet::DataPilotTableHeaderData;
94using ::com::sun::star::sheet::DataPilotTablePositionData;
95using ::com::sun::star::sheet::XDimensionsSupplier;
96using ::com::sun::star::beans::XPropertySet;
117 uno::Reference<sdbc::XRowSet> mxRowSet;
118 uno::Reference<sdbc::XRow> mxRow;
119 uno::Reference<sdbc::XResultSetMetaData> mxMetaData;
123 DBConnector(
ScDPCache& rCache, uno::Reference<sdbc::XRowSet> xRowSet,
const Date& rNullDate);
125 bool isValid()
const;
130 virtual bool first()
override;
131 virtual bool next()
override;
132 virtual void finish()
override;
135DBConnector::DBConnector(
ScDPCache& rCache, uno::Reference<sdbc::XRowSet> xRowSet,
const Date& rNullDate) :
136 mrCache(rCache), mxRowSet(std::move(xRowSet)), maNullDate(rNullDate)
138 Reference<sdbc::XResultSetMetaDataSupplier> xMetaSupp(mxRowSet, UNO_QUERY);
140 mxMetaData = xMetaSupp->getMetaData();
142 mxRow.set(mxRowSet, UNO_QUERY);
145bool DBConnector::isValid()
const
147 return mxRowSet.is() && mxRow.is() && mxMetaData.is();
150bool DBConnector::first()
152 return mxRowSet->first();
155bool DBConnector::next()
157 return mxRowSet->next();
160void DBConnector::finish()
162 mxRowSet->beforeFirst();
167 return mxMetaData->getColumnCount();
170OUString DBConnector::getColumnLabel(
tools::Long nCol)
const
172 return mxMetaData->getColumnLabel(nCol+1);
177 rNumType = SvNumFormatType::NUMBER;
178 sal_Int32
nType = mxMetaData->getColumnType(nCol+1);
185 case sdbc::DataType::BIT:
186 case sdbc::DataType::BOOLEAN:
188 rNumType = SvNumFormatType::LOGICAL;
189 fValue = mxRow->getBoolean(nCol+1) ? 1 : 0;
193 case sdbc::DataType::TINYINT:
194 case sdbc::DataType::SMALLINT:
195 case sdbc::DataType::INTEGER:
196 case sdbc::DataType::BIGINT:
197 case sdbc::DataType::FLOAT:
198 case sdbc::DataType::REAL:
199 case sdbc::DataType::DOUBLE:
200 case sdbc::DataType::NUMERIC:
201 case sdbc::DataType::DECIMAL:
204 fValue = mxRow->getDouble(nCol+1);
210 rNumType = SvNumFormatType::DATE;
212 util::Date aDate = mxRow->getDate(nCol+1);
213 fValue =
Date(aDate.Day, aDate.Month, aDate.Year) - maNullDate;
217 case sdbc::DataType::TIME:
219 rNumType = SvNumFormatType::TIME;
221 util::Time aTime = mxRow->getTime(nCol+1);
229 case sdbc::DataType::TIMESTAMP:
231 rNumType = SvNumFormatType::DATETIME;
233 util::DateTime aStamp = mxRow->getTimestamp(nCol+1);
234 fValue = (
Date( aStamp.Day, aStamp.Month, aStamp.Year ) - maNullDate ) +
242 case sdbc::DataType::CHAR:
243 case sdbc::DataType::VARCHAR:
244 case sdbc::DataType::LONGVARCHAR:
245 case sdbc::DataType::SQLNULL:
246 case sdbc::DataType::BINARY:
247 case sdbc::DataType::VARBINARY:
248 case sdbc::DataType::LONGVARBINARY:
252 mrCache.InternString(nCol, mxRow->getString(nCol+1)));
255 catch (uno::Exception&)
265 sheet::DataPilotFieldOrientation nRet = sheet::DataPilotFieldOrientation_HIDDEN;
268 uno::Reference<container::XNameAccess> xDimNameAccess = xSource->getDimensions();
269 const uno::Sequence<OUString> aDimNames = xDimNameAccess->getElementNames();
270 for (
const OUString& rDimName : aDimNames)
272 uno::Reference<beans::XPropertySet> xDimProp(xDimNameAccess->getByName(rDimName),
283 sheet::DataPilotFieldOrientation_HIDDEN );
293 OUString aServ, OUString aSrc, OUString aNam,
294 OUString aUser, OUString aPass ) :
295 aServiceName(
std::move( aServ )),
296 aParSource(
std::move( aSrc )),
297 aParName(
std::move( aNam )),
298 aParUser(
std::move( aUser )),
299 aParPass(
std::move( aPass )) {}
313 mbHeaderLayout(false),
315 bSettingsChanged(false),
316 mbEnableGetPivotData(true)
322 aTableName( r.aTableName ),
323 aTableTag( r.aTableTag ),
324 aOutRange( r.aOutRange ),
325 maInteropGrabBag(r.maInteropGrabBag),
326 nHeaderRows( r.nHeaderRows ),
327 mbHeaderLayout( r.mbHeaderLayout ),
329 bSettingsChanged(false),
330 mbEnableGetPivotData(r.mbEnableGetPivotData)
506 if (nDataDimCount != 1)
513 return (rPos == aTabRange.
aStart);
550 pOutput->SetPosition( aStart );
559class DisableGetPivotData
564 DisableGetPivotData(
ScDPObject& rObj,
bool bOld) : mrDPObj(rObj), mbOldState(bOld)
569 ~DisableGetPivotData()
575class FindIntersectingTable
579 explicit FindIntersectingTable(
const ScRange& rRange) :
maRange(rRange) {}
581 bool operator() (
const std::unique_ptr<ScDPObject>& rObj)
const
583 return maRange.Intersects(rObj->GetOutRange());
587class FindIntersectingTableByColumns
595 mnCol1(nCol1), mnCol2(nCol2),
mnRow(nRow), mnTab(nTab) {}
597 bool operator() (
const std::unique_ptr<ScDPObject>& rObj)
const
599 const ScRange& rRange = rObj->GetOutRange();
621class FindIntersectingTableByRows
629 mnCol(nCol), mnRow1(nRow1), mnRow2(nRow2), mnTab(nTab) {}
631 bool operator() (
const std::unique_ptr<ScDPObject>& rObj)
const
633 const ScRange& rRange = rObj->GetOutRange();
655class AccumulateOutputRanges
660 explicit AccumulateOutputRanges(
SCTAB nTab) : mnTab(nTab) {}
661 AccumulateOutputRanges(
const AccumulateOutputRanges& r) : maRanges(r.maRanges), mnTab(r.mnTab) {}
663 void operator() (
const std::unique_ptr<ScDPObject>& rObj)
665 const ScRange& rRange = rObj->GetOutRange();
670 maRanges.
Join(rRange);
673 const ScRangeList& getRanges()
const {
return maRanges; }
682 shared_ptr<ScDPTableData>
pData;
692 pData = std::make_shared<ScDatabaseDPData>(
pDoc, *pCache);
700 OSL_FAIL(
"no source descriptor");
719 if (
pData && pDimData)
721 auto pGroupData = std::make_shared<ScDPGroupTableData>(
pData,
pDoc);
745 OSL_ENSURE( !
pServDesc,
"DPSource could not be created" );
754 pData->ReloadCacheTable();
766 uno::Reference<util::XRefreshable> xRef(
xSource, uno::UNO_QUERY );
773 catch(uno::Exception&)
806 mpTableData->GetCacheTable().getCache().RemoveReference(
this);
841 const shared_ptr<ScDPTableData>& pSource =
pData->GetSourceTableData();
842 auto pGroupData = std::make_shared<ScDPGroupTableData>(pSource,
pDoc);
849 auto pGroupData = std::make_shared<ScDPGroupTableData>(
mpTableData,
pDoc);
859 Reference< XComponent > xObjectComp(
xSource, UNO_QUERY );
860 if (xObjectComp.is())
864 xObjectComp->dispose();
878 rOverflow =
pOutput->HasError();
884 return pOutput->GetOutputRange();
947 while ( nInitial + 1 < nOutRows &&
lcl_HasButton(
pDoc, nFirstCol, nFirstRow + nInitial, nTab ) )
950 if ( nInitial + 1 < nOutRows &&
951 pDoc->
IsBlockEmpty( nFirstCol, nFirstRow + nInitial, nFirstCol, nFirstRow + nInitial, nTab ) &&
971 pSaveData->BuildAllDimensionMembers(pTableData);
992 pData->ReloadCacheTable();
999 vector<ScDPLabelData::Member> aMembers;
1003 size_t n = aMembers.size();
1005 auto pNames = rNames.getArray();
1006 for (
size_t i = 0;
i <
n; ++
i)
1014 Reference< sheet::XMembersAccess > xMembersNA;
1019 sal_Int32
nCount = xMembersIA->getCount();
1020 vector<ScDPLabelData::Member> aMembers;
1021 aMembers.reserve(
nCount);
1025 Reference<container::XNamed> xMember;
1028 xMember = Reference<container::XNamed>(xMembersIA->getByIndex(
i), UNO_QUERY);
1030 catch (
const container::NoSuchElementException&)
1038 aMem.
maName = xMember->getName();
1040 Reference<beans::XPropertySet> xMemProp(xMember, UNO_QUERY);
1050 aMembers.push_back(aMem);
1052 rMembers.swap(aMembers);
1072 nCol1, nRow1, nTab1, nCol2, nRow2, nTab2 );
1081 const OUString& rRangeName =
pSheetDesc->GetRangeName();
1082 if (!rRangeName.isEmpty())
1097 nCol1, nRow1, nTab1, nCol2, nRow2, nTab2 );
1105 aParam.
nCol1 = sal::static_int_cast<SCCOL>( aParam.
nCol1 + nDiffX );
1106 aParam.
nCol2 = sal::static_int_cast<SCCOL>( aParam.
nCol2 + nDiffX );
1107 aParam.
nRow1 += nDiffY;
1108 aParam.
nRow2 += nDiffY;
1130 OSL_FAIL(
"RefsEqual: SheetDesc set at only one object");
1147 pOutput->GetPositionData(rPos, rPosData);
1151 const ScAddress& rPos, Sequence<sheet::DataPilotFieldFilter>& rFilters)
1155 vector<sheet::DataPilotFieldFilter> aFilters;
1156 if (!
pOutput->GetDataResultPositionData(aFilters, rPos))
1159 sal_Int32
n =
static_cast<sal_Int32
>(aFilters.size());
1160 rFilters.realloc(
n);
1161 auto pFilters = rFilters.getArray();
1162 for (sal_Int32
i = 0;
i <
n; ++
i)
1163 pFilters[
i] = aFilters[
i];
1172 Reference<sheet::XDrillDownDataSupplier> xDrillDownData(
xSource, UNO_QUERY);
1173 if (!xDrillDownData.is())
1176 Sequence<sheet::DataPilotFieldFilter> filters;
1180 rTableData = xDrillDownData->getDrillDownData(filters);
1188 Reference<container::XNameAccess> xDims =
xSource->getDimensions();
1189 const Sequence<OUString> aDimNames = xDims->getElementNames();
1190 for (
const OUString& rDimName : aDimNames)
1192 if (rDimName.equalsIgnoreAsciiCase(rName))
1195 Reference<beans::XPropertySet> xPropSet(xDims->getByName(rDimName), UNO_QUERY);
1201 if (aLayoutName.equalsIgnoreAsciiCase(rName))
1209 rIsDataLayout =
false;
1214 uno::Reference<container::XNameAccess> xDimsName =
xSource->getDimensions();
1219 uno::Reference<uno::XInterface> xIntDim(xDims->getByIndex(nDim), uno::UNO_QUERY);
1220 uno::Reference<container::XNamed> xDimName( xIntDim, uno::UNO_QUERY );
1221 uno::Reference<beans::XPropertySet> xDimProp( xIntDim, uno::UNO_QUERY );
1222 if ( xDimName.is() && xDimProp.is() )
1231 aName = xDimName->getName();
1233 catch(uno::Exception&)
1237 rIsDataLayout =
true;
1249 aRet =
pData->getDimensionName(nDim);
1250 rIsDataLayout =
pData->getIsDataLayoutDimension(nDim);
1258 bool bDuplicated =
false;
1261 uno::Reference<container::XNameAccess> xDimsName =
xSource->getDimensions();
1266 uno::Reference<beans::XPropertySet> xDimProp(xDims->getByIndex(nDim), uno::UNO_QUERY);
1267 if ( xDimProp.is() )
1272 uno::Reference<uno::XInterface> xIntOrig;
1273 if ( (aOrigAny >>= xIntOrig) && xIntOrig.is() )
1276 catch(uno::Exception&)
1292 uno::Reference<container::XNameAccess> xDimsName =
xSource->getDimensions();
1293 if ( xDimsName.is() )
1294 nRet = xDimsName->getElementNames().getLength();
1296 catch(uno::Exception&)
1308 rData.Dimension = rData.Hierarchy = rData.Level = -1;
1311 DataPilotTablePositionData aPosData;
1312 pOutput->GetPositionData(rPos, aPosData);
1313 const sal_Int32 nPosType = aPosData.PositionType;
1315 aPosData.PositionData >>= rData;
1324 explicit FindByName(OUString aName) :
maName(
std::move(
aName)) {}
1328 const std::optional<OUString> & pLayoutName = pDim->
GetLayoutName();
1350 bool operator() (
const sheet::DataPilotFieldFilter& r1,
const sheet::DataPilotFieldFilter& r2)
const
1352 size_t nRank1 = mrDimOrder.size();
1353 size_t nRank2 = mrDimOrder.size();
1354 ScDPSaveData::DimOrderType::const_iterator it1 = mrDimOrder.find(
1356 if (it1 != mrDimOrder.end())
1357 nRank1 = it1->second;
1359 ScDPSaveData::DimOrderType::const_iterator it2 = mrDimOrder.find(
1361 if (it2 != mrDimOrder.end())
1362 nRank2 = it2->second;
1364 return nRank1 < nRank2;
1373 return std::numeric_limits<double>::quiet_NaN();
1377 std::vector<const ScDPSaveDimension*> aDataDims;
1378 pSaveData->GetAllDimensionsByOrientation(sheet::DataPilotFieldOrientation_DATA, aDataDims);
1379 if (aDataDims.empty())
1380 return std::numeric_limits<double>::quiet_NaN();
1382 std::vector<const ScDPSaveDimension*>::iterator it = std::find_if(
1383 aDataDims.begin(), aDataDims.end(),
1386 if (it == aDataDims.end())
1387 return std::numeric_limits<double>::quiet_NaN();
1389 size_t nDataIndex = std::distance(aDataDims.begin(), it);
1391 uno::Reference<sheet::XDataPilotResults> xDPResults(
xSource, uno::UNO_QUERY);
1392 if (!xDPResults.is())
1393 return std::numeric_limits<double>::quiet_NaN();
1397 std::sort(rFilters.begin(), rFilters.end(), LessByDimOrder(
pSaveData->GetDimensionSortOrder()));
1399 size_t n = rFilters.size();
1400 uno::Sequence<sheet::DataPilotFieldFilter> aFilters(
n);
1401 auto aFiltersRange = asNonConstRange(aFilters);
1402 for (
size_t i = 0;
i <
n; ++
i)
1403 aFiltersRange[
i] = rFilters[
i];
1405 uno::Sequence<double> aRes = xDPResults->getFilteredResults(aFilters);
1407 return std::numeric_limits<double>::quiet_NaN();
1409 return aRes[nDataIndex];
1416 return pOutput->IsFilterButton( rPos );
1423 return pOutput->GetHeaderDim( rPos, rOrient );
1431 return pOutput->GetHeaderDrag( rPos, bMouseLeft, bMouseTop, nDragDim, rPosRect, rOrient, rDimPos );
1438 pOutput->GetMemberResultNames(rNames, nDimension);
1461bool dequote( std::u16string_view rSource, sal_Int32 nStartPos, sal_Int32& rEndPos, OUString& rResult )
1467 if (rSource[nStartPos] == cQuote)
1470 sal_Int32
nPos = nStartPos + 1;
1471 const sal_Int32 nLen = rSource.size();
1473 while ( nPos < nLen )
1476 if ( cNext == cQuote )
1478 if (nPos+1 < nLen && rSource[nPos+1] == cQuote)
1487 rResult =
aBuffer.makeStringAndClear();
1503struct ScGetPivotDataFunctionEntry
1509bool parseFunction( std::u16string_view rList, sal_Int32 nStartPos, sal_Int32& rEndPos, sal_Int16& rFunc )
1511 static const ScGetPivotDataFunctionEntry aFunctions[] =
1514 {
"Sum", sheet::GeneralFunction2::SUM },
1516 {
"Average", sheet::GeneralFunction2::AVERAGE },
1517 {
"Max", sheet::GeneralFunction2::MAX },
1518 {
"Min", sheet::GeneralFunction2::MIN },
1519 {
"Product", sheet::GeneralFunction2::PRODUCT },
1520 {
"CountNums", sheet::GeneralFunction2::COUNTNUMS },
1521 {
"StDev", sheet::GeneralFunction2::STDEV },
1522 {
"StDevp", sheet::GeneralFunction2::STDEVP },
1523 {
"Var", sheet::GeneralFunction2::VAR },
1524 {
"VarP", sheet::GeneralFunction2::VARP },
1526 {
"Count Nums", sheet::GeneralFunction2::COUNTNUMS },
1527 {
"StdDev", sheet::GeneralFunction2::STDEV },
1528 {
"StdDevp", sheet::GeneralFunction2::STDEVP }
1531 const sal_Int32 nListLen = rList.size();
1532 while (nStartPos < nListLen && rList[nStartPos] ==
' ')
1535 bool bParsed =
false;
1536 bool bFound =
false;
1538 sal_Int32 nFuncEnd = 0;
1539 if (nStartPos < nListLen && rList[nStartPos] ==
'\'')
1540 bParsed = dequote( rList, nStartPos, nFuncEnd, aFuncStr );
1543 nFuncEnd = rList.find(
']', nStartPos);
1546 aFuncStr = rList.substr(nStartPos, nFuncEnd - nStartPos);
1556 for ( sal_Int32 nFunc=0; nFunc<nFuncCount && !bFound; nFunc++ )
1558 if (aFuncStr.equalsIgnoreAsciiCaseAscii(aFunctions[nFunc].pName))
1560 rFunc = aFunctions[nFunc].eFunc;
1563 while (nFuncEnd < nListLen && rList[nFuncEnd] ==
' ')
1573bool extractAtStart( std::u16string_view rList, sal_Int32& rMatched,
bool bAllowBracket, sal_Int16* pFunc,
1574 OUString& rDequoted )
1576 size_t nMatchList = 0;
1578 bool bParsed =
false;
1579 if ( cFirst ==
'\'' || cFirst ==
'[' )
1584 sal_Int32 nQuoteEnd = 0;
1586 if ( cFirst ==
'\'' )
1587 bParsed = dequote( rList, 0, nQuoteEnd, aDequoted );
1588 else if ( cFirst ==
'[' )
1592 sal_Int32 nStartPos = 1;
1593 const sal_Int32 nListLen = rList.size();
1594 while (nStartPos < nListLen && rList[nStartPos] ==
' ')
1597 if (nStartPos < nListLen && rList[nStartPos] ==
'\'')
1599 if ( dequote( rList, nStartPos, nQuoteEnd, aDequoted ) )
1603 while (nQuoteEnd < nListLen && rList[nQuoteEnd] ==
' ')
1607 if (nQuoteEnd < nListLen && rList[nQuoteEnd] ==
';' && pFunc)
1609 sal_Int32 nFuncEnd = 0;
1610 if ( parseFunction( rList, nQuoteEnd + 1, nFuncEnd, *pFunc ) )
1611 nQuoteEnd = nFuncEnd;
1613 if (nQuoteEnd < nListLen && rList[nQuoteEnd] ==
']')
1624 sal_Int32 nClosePos = rList.find(
']', nStartPos);
1627 sal_Int32 nNameEnd = nClosePos;
1628 sal_Int32 nSemiPos = rList.find(
';', nStartPos);
1629 if (nSemiPos >= 0 && nSemiPos < nClosePos && pFunc)
1631 sal_Int32 nFuncEnd = 0;
1632 if (parseFunction(rList, nSemiPos+1, nFuncEnd, *pFunc))
1633 nNameEnd = nSemiPos;
1636 aDequoted = rList.substr(nStartPos, nNameEnd - nStartPos);
1639 nQuoteEnd = nClosePos + 1;
1647 nMatchList = nQuoteEnd;
1648 rDequoted = aDequoted;
1656 bool bValid =
false;
1657 if ( nMatchList >= rList.size() )
1662 if ( cNext ==
' ' || ( bAllowBracket && cNext ==
'[' ) )
1668 rMatched = nMatchList;
1677 const OUString& rList,
const OUString& rSearch, sal_Int32& rMatched,
1678 bool bAllowBracket, sal_Int16* pFunc )
1680 sal_Int32 nMatchList = 0;
1681 sal_Int32 nMatchSearch = 0;
1683 if ( cFirst ==
'\'' || cFirst ==
'[' )
1686 bool bParsed = extractAtStart( rList, rMatched, bAllowBracket, pFunc, aDequoted);
1689 nMatchList = rMatched;
1690 nMatchSearch = rSearch.getLength();
1697 rList, 0, rList.getLength(), nMatchList, rSearch, 0, rSearch.getLength(), nMatchSearch);
1700 if (nMatchSearch == rSearch.getLength())
1704 bool bValid =
false;
1705 if ( sal::static_int_cast<sal_Int32>(nMatchList) >= rList.getLength() )
1710 if ( cNext ==
' ' || ( bAllowBracket && cNext ==
'[' ) )
1716 rMatched = nMatchList;
1727 OUString& rDataFieldName,
1728 std::vector<sheet::DataPilotFieldFilter>& rFilters,
1729 std::vector<sal_Int16>& rFilterFuncs, std::u16string_view rFilterList )
1735 std::vector<OUString> aDataNames;
1736 std::vector<OUString> aGivenNames;
1738 std::vector< uno::Sequence<OUString> > aFieldValueNames;
1739 std::vector< uno::Sequence<OUString> > aFieldValues;
1743 uno::Reference<container::XNameAccess> xDimsName =
xSource->getDimensions();
1745 sal_Int32
nDimCount = xIntDims->getCount();
1746 for ( sal_Int32 nDim = 0; nDim<
nDimCount; nDim++ )
1748 uno::Reference<uno::XInterface> xIntDim(xIntDims->getByIndex(nDim), uno::UNO_QUERY);
1749 uno::Reference<container::XNamed> xDim( xIntDim, uno::UNO_QUERY );
1750 uno::Reference<beans::XPropertySet> xDimProp( xDim, uno::UNO_QUERY );
1751 uno::Reference<sheet::XHierarchiesSupplier> xDimSupp( xDim, uno::UNO_QUERY );
1756 sheet::DataPilotFieldOrientation_HIDDEN );
1759 if ( nOrient == sheet::DataPilotFieldOrientation_DATA )
1761 OUString aSourceName;
1762 OUString aGivenName;
1764 aDataNames.push_back( aSourceName );
1765 aGivenNames.push_back( aGivenName );
1767 else if ( nOrient != sheet::DataPilotFieldOrientation_HIDDEN )
1771 uno::Reference<container::XIndexAccess> xHiers =
new ScNameToIndexAccess( xDimSupp->getHierarchies() );
1774 if ( nHierarchy >= xHiers->getCount() )
1777 uno::Reference<sheet::XLevelsSupplier> xHierSupp(xHiers->getByIndex(nHierarchy),
1779 if ( xHierSupp.is() )
1781 uno::Reference<container::XIndexAccess> xLevels =
new ScNameToIndexAccess( xHierSupp->getLevels() );
1782 sal_Int32 nLevCount = xLevels->getCount();
1783 for (sal_Int32 nLev=0; nLev<nLevCount; nLev++)
1785 uno::Reference<uno::XInterface> xLevel(xLevels->getByIndex(nLev),
1787 uno::Reference<container::XNamed> xLevNam( xLevel, uno::UNO_QUERY );
1788 uno::Reference<sheet::XMembersSupplier> xLevSupp( xLevel, uno::UNO_QUERY );
1789 if ( xLevNam.is() && xLevSupp.is() )
1791 uno::Reference<sheet::XMembersAccess> xMembers = xLevSupp->getMembers();
1793 OUString aFieldName( xLevNam->getName() );
1796 uno::Sequence<OUString> aMemberValueNames( xMembers->getElementNames() );
1797 uno::Sequence<OUString> aMemberValues( xMembers->getLocaleIndependentElementNames() );
1800 aFieldValueNames.push_back( aMemberValueNames );
1801 aFieldValues.push_back( aMemberValues );
1811 SCSIZE nDataFields = aDataNames.size();
1813 OSL_ENSURE( aGivenNames.size() == nDataFields && aFieldValueNames.size() == nFieldCount &&
1814 aFieldValues.size() == nFieldCount,
"wrong count" );
1816 bool bError =
false;
1817 bool bHasData =
false;
1819 while (!aRemaining.isEmpty() && !bError)
1825 for (
SCSIZE nDataPos=0; nDataPos<nDataFields && !bUsed; nDataPos++ )
1828 sal_Int32 nMatched = 0;
1829 if (isAtStart(aRemaining, aDataNames[nDataPos], nMatched,
false,
nullptr))
1830 aFound = aDataNames[nDataPos];
1831 else if (isAtStart(aRemaining, aGivenNames[nDataPos], nMatched,
false,
nullptr))
1832 aFound = aGivenNames[nDataPos];
1834 if (!aFound.isEmpty())
1836 rDataFieldName = aFound;
1837 aRemaining = aRemaining.copy(nMatched);
1845 OUString aSpecField;
1846 bool bHasFieldName =
false;
1849 sal_Int32 nMatched = 0;
1850 for (
SCSIZE nField=0; nField<nFieldCount && !bHasFieldName; nField++ )
1852 if (isAtStart(aRemaining,
aFieldNames[nField], nMatched,
true,
nullptr))
1855 aRemaining = aRemaining.copy(nMatched);
1859 if (aRemaining.startsWith(
"["))
1861 bHasFieldName =
true;
1877 bool bItemFound =
false;
1878 sal_Int32 nMatched = 0;
1879 OUString aFoundName;
1880 OUString aFoundValueName;
1881 OUString aFoundValue;
1885 OUString aQueryValueName;
1886 const bool bHasQuery = extractAtStart( aRemaining, nMatched,
false, &eFunc, aQueryValueName);
1888 OUString aQueryValue = aQueryValueName;
1896 sal_uInt32 nNumFormat = 0;
1898 if (pFormatter->
IsNumberFormat( aQueryValueName, nNumFormat, fValue))
1903 for (
SCSIZE nField=0; nField<nFieldCount; nField++ )
1907 if ( !bHasFieldName ||
aFieldNames[nField] == aSpecField )
1909 const uno::Sequence<OUString>& rItemNames = aFieldValueNames[nField];
1910 const uno::Sequence<OUString>& rItemValues = aFieldValues[nField];
1911 sal_Int32 nItemCount = rItemNames.getLength();
1912 assert(nItemCount == rItemValues.getLength());
1913 const OUString* pItemNamesArr = rItemNames.getConstArray();
1914 const OUString* pItemValuesArr = rItemValues.getConstArray();
1915 for ( sal_Int32 nItem=0; nItem<nItemCount; nItem++ )
1917 bool bThisItemFound;
1922 aQueryValueName, pItemNamesArr[nItem]);
1923 if (!bThisItemFound && pItemValuesArr[nItem] != pItemNamesArr[nItem])
1925 aQueryValueName, pItemValuesArr[nItem]);
1926 if (!bThisItemFound && aQueryValueName != aQueryValue)
1933 aQueryValue, pItemNamesArr[nItem]);
1934 if (!bThisItemFound && pItemValuesArr[nItem] != pItemNamesArr[nItem])
1936 aQueryValue, pItemValuesArr[nItem]);
1941 bThisItemFound = isAtStart( aRemaining, pItemNamesArr[nItem], nMatched,
false, &eFunc );
1942 if (!bThisItemFound && pItemValuesArr[nItem] != pItemNamesArr[nItem])
1943 bThisItemFound = isAtStart( aRemaining, pItemValuesArr[nItem], nMatched,
false, &eFunc );
1959 aFoundValueName = pItemNamesArr[nItem];
1960 aFoundValue = pItemValuesArr[nItem];
1970 if ( bItemFound && !bError )
1972 sheet::DataPilotFieldFilter aField;
1973 aField.FieldName = aFoundName;
1974 aField.MatchValueName = aFoundValueName;
1975 aField.MatchValue = aFoundValue;
1976 rFilters.push_back(aField);
1977 rFilterFuncs.push_back(eFoundFunc);
1978 aRemaining = aRemaining.copy(nMatched);
1989 if ( !bError && !bHasData && aDataNames.size() == 1 )
1992 rDataFieldName = aDataNames[0];
1996 return bHasData && !bError;
2005 uno::Reference<container::XNamed> xDim;
2006 uno::Reference<container::XNameAccess> xDimsName =
xSource->getDimensions();
2009 if ( rElemDesc.Dimension < nIntCount )
2011 xDim.set(xIntDims->getByIndex(rElemDesc.Dimension), uno::UNO_QUERY);
2013 OSL_ENSURE( xDim.is(),
"dimension not found" );
2014 if ( !xDim.is() )
return;
2015 OUString aDimName = xDim->getName();
2017 uno::Reference<beans::XPropertySet> xDimProp( xDim, uno::UNO_QUERY );
2030 uno::Reference<container::XIndexAccess> xHiers;
2031 uno::Reference<sheet::XHierarchiesSupplier> xHierSupp( xDim, uno::UNO_QUERY );
2032 if ( xHierSupp.is() )
2034 uno::Reference<container::XNameAccess> xHiersName = xHierSupp->getHierarchies();
2036 nHierCount = xHiers->getCount();
2038 uno::Reference<uno::XInterface> xHier;
2039 if ( rElemDesc.Hierarchy < nHierCount )
2040 xHier.set(xHiers->getByIndex(rElemDesc.Hierarchy), uno::UNO_QUERY);
2041 OSL_ENSURE( xHier.is(),
"hierarchy not found" );
2042 if ( !xHier.is() )
return;
2045 uno::Reference<container::XIndexAccess> xLevels;
2046 uno::Reference<sheet::XLevelsSupplier> xLevSupp( xHier, uno::UNO_QUERY );
2047 if ( xLevSupp.is() )
2049 uno::Reference<container::XNameAccess> xLevsName = xLevSupp->getLevels();
2051 nLevCount = xLevels->getCount();
2053 uno::Reference<uno::XInterface> xLevel;
2054 if ( rElemDesc.Level < nLevCount )
2055 xLevel.set(xLevels->getByIndex(rElemDesc.Level), uno::UNO_QUERY);
2056 OSL_ENSURE( xLevel.is(),
"level not found" );
2057 if ( !xLevel.is() )
return;
2059 uno::Reference<sheet::XMembersAccess> xMembers;
2060 uno::Reference<sheet::XMembersSupplier> xMbrSupp( xLevel, uno::UNO_QUERY );
2061 if ( xMbrSupp.is() )
2062 xMembers = xMbrSupp->getMembers();
2064 bool bFound =
false;
2065 bool bShowDetails =
true;
2067 if ( xMembers.is() )
2069 if ( xMembers->hasByName(rElemDesc.MemberName) )
2071 uno::Reference<beans::XPropertySet> xMbrProp(xMembers->getByName(rElemDesc.MemberName),
2073 if ( xMbrProp.is() )
2083 OSL_ENSURE( bFound,
"member not found" );
2089 OSL_ENSURE( pModifyData,
"no data?" );
2092 const OUString
aName = rElemDesc.MemberName;
2094 GetMemberByName(
aName)->SetShowDetails( !bShowDetails );
2105 uno::Reference<sheet::XHierarchiesSupplier> xDimSupp( xDimProp, uno::UNO_QUERY );
2106 if ( xDimProp.is() && xDimSupp.is() )
2108 uno::Reference<container::XIndexAccess> xHiers =
new ScNameToIndexAccess( xDimSupp->getHierarchies() );
2111 if ( nHierarchy >= xHiers->getCount() )
2114 uno::Reference<sheet::XLevelsSupplier> xHierSupp(xHiers->getByIndex(nHierarchy),
2116 if ( xHierSupp.is() )
2118 uno::Reference<container::XIndexAccess> xLevels =
new ScNameToIndexAccess( xHierSupp->getLevels() );
2119 uno::Reference<uno::XInterface> xLevel(xLevels->getByIndex(0), uno::UNO_QUERY);
2120 uno::Reference<beans::XPropertySet> xLevProp( xLevel, uno::UNO_QUERY );
2121 if ( xLevProp.is() )
2128 catch(uno::Exception&)
2131 uno::Sequence<sal_Int16>
aSeq;
2132 if ( aSubAny >>=
aSeq )
2135 for (
const sal_Int16 nElem : std::as_const(
aSeq))
2143 OSL_FAIL(
"FirstSubTotal: NULL");
2164 const uno::Reference<sheet::XDimensionsSupplier>& xSource,
2165 sheet::DataPilotFieldOrientation nOrient,
bool bAddData )
2169 bool bDataFound =
false;
2174 vector<tools::Long> aPos;
2176 uno::Reference<container::XNameAccess> xDimsName = xSource->getDimensions();
2182 uno::Reference<beans::XPropertySet> xDimProp(xDims->getByIndex(nDim), uno::UNO_QUERY);
2187 sheet::DataPilotFieldOrientation_HIDDEN );
2189 if ( xDimProp.is() && nDimOrient == nOrient )
2195 if ( nOrient == sheet::DataPilotFieldOrientation_DATA )
2200 if ( eFunc == sheet::GeneralFunction2::AUTO )
2203 eFunc = sheet::GeneralFunction2::SUM;
2220 if (aOrigAny >>= nTmp)
2223 catch(uno::Exception&)
2228 if (nDupSource >= 0)
2236 nCompCol =
static_cast<SCCOL>(nDupSource);
2238 ScPivotFieldVector::iterator it = std::find_if(aFields.begin(), aFields.end(), FindByColumn(nCompCol, nMask));
2239 if (it != aFields.end())
2240 nDupCount = it->mnDupCount + 1;
2243 aFields.emplace_back();
2260 aPos.push_back(
nPos);
2264 if (nOrient == sheet::DataPilotFieldOrientation_DATA)
2268 catch (uno::Exception&)
2276 size_t nOutCount = aFields.size();
2279 for (
size_t i = 0;
i < nOutCount - 1; ++
i)
2281 for (
size_t j = 0; j +
i < nOutCount - 1; ++j)
2283 if ( aPos[j+1] < aPos[j] )
2285 std::swap( aPos[j], aPos[j+1] );
2286 std::swap( aFields[j], aFields[j+1] );
2292 if (bAddData && !bDataFound)
2295 rFields.swap(aFields);
2320 uno::Reference<beans::XPropertySet> xProp(
xSource, uno::UNO_QUERY );
2337 catch(uno::Exception&)
2345 uno::Reference<sheet::XHierarchiesSupplier> xDimSupp( xDimProp, uno::UNO_QUERY );
2346 if (!xDimProp.is() || !xDimSupp.is())
2349 uno::Reference<container::XIndexAccess> xHiers =
new ScNameToIndexAccess( xDimSupp->getHierarchies() );
2352 if ( nHierarchy >= xHiers->getCount() )
2356 uno::Reference<sheet::XLevelsSupplier> xHierSupp(xHiers->getByIndex(nHierarchy),
2358 if (!xHierSupp.is())
2361 uno::Reference<container::XIndexAccess> xLevels =
2364 uno::Reference<beans::XPropertySet> xLevProp(xLevels->getByIndex(0), uno::UNO_QUERY);
2383 catch(uno::Exception&)
2389 const uno::Reference<container::XIndexAccess>& xDims, sal_Int32 nDim,
ScDPLabelData& rLabelData)
2391 uno::Reference<uno::XInterface> xIntDim(xDims->getByIndex(nDim), uno::UNO_QUERY);
2392 uno::Reference<container::XNamed> xDimName( xIntDim, uno::UNO_QUERY );
2393 uno::Reference<beans::XPropertySet> xDimProp( xIntDim, uno::UNO_QUERY );
2395 if (!xDimName.is() || !xDimProp.is())
2402 sal_Int32 nOrigPos = -1;
2403 OUString aFieldName;
2406 aFieldName = xDimName->getName();
2408 aOrigAny >>= nOrigPos;
2410 catch(uno::Exception&)
2426 rLabelData.
maName = aFieldName;
2454 uno::Reference<container::XNameAccess> xDimsName =
xSource->getDimensions();
2456 sal_Int32
nDimCount = xDims->getCount();
2457 if (nDimCount <= 0 || nDim >=
nDimCount)
2471 uno::Reference<container::XNameAccess> xDimsName =
xSource->getDimensions();
2473 sal_Int32
nDimCount = xDims->getCount();
2477 for (sal_Int32 nDim = 0; nDim <
nDimCount; ++nDim)
2481 rParam.
maLabelArray.push_back(std::unique_ptr<ScDPLabelData>(pNewLabel));
2486 std::vector<OUString>& rNames)
2492 uno::Reference<container::XNameAccess> xDimsName =
xSource->getDimensions();
2497 uno::Reference<uno::XInterface> xIntDim(xDims->getByIndex(nDim), uno::UNO_QUERY);
2498 uno::Reference<container::XNamed> xDimName(xIntDim, uno::UNO_QUERY);
2499 uno::Reference<beans::XPropertySet> xDimProp(xIntDim, uno::UNO_QUERY);
2503 sheet::DataPilotFieldOrientation_HIDDEN );
2505 if ( xDimProp.is() && nDimOrient == nOrient)
2507 rIndices.push_back(nDim);
2508 rNames.push_back(xDimName->getName());
2516 uno::Reference<container::XNameAccess> xDimsName(
GetSource()->getDimensions() );
2520 uno::Reference<sheet::XHierarchiesSupplier> xHierSup(xIntDims->getByIndex( nDim ), uno::UNO_QUERY);
2523 xHiers.set( xHierSup->getHierarchies() );
2532 uno::Reference< container::XNameAccess > xHiersNA;
2535 rHiers = xHiersNA->getElementNames();
2541 sal_Int32 nHier = 0;
2542 uno::Reference<container::XNameAccess> xDimsName(
GetSource()->getDimensions() );
2544 uno::Reference<beans::XPropertySet> xDim(xIntDims->getByIndex( nDim ), uno::UNO_QUERY);
2558 uno::Reference<container::XNameAccess> xDimsName(
GetSource()->getDimensions() );
2560 uno::Reference<beans::XPropertySet> xDim(xIntDims->getByIndex( nDim ), uno::UNO_QUERY);
2563 uno::Reference<sheet::XHierarchiesSupplier> xHierSup(xDim, uno::UNO_QUERY);
2566 uno::Reference<container::XIndexAccess> xHiers(
new ScNameToIndexAccess(xHierSup->getHierarchies()));
2567 uno::Reference<sheet::XLevelsSupplier> xLevSupp( xHiers->getByIndex(nHier), uno::UNO_QUERY );
2568 if ( xLevSupp.is() )
2570 uno::Reference<container::XIndexAccess> xLevels(
new ScNameToIndexAccess( xLevSupp->getLevels()));
2573 sal_Int32 nLevCount = xLevels->getCount();
2576 uno::Reference<sheet::XMembersSupplier> xMembSupp( xLevels->getByIndex(0), uno::UNO_QUERY );
2577 if ( xMembSupp.is() )
2579 xMembers.set(xMembSupp->getMembers());
2594OUString lcl_GetDimName(
const uno::Reference<sheet::XDimensionsSupplier>& xSource,
tools::Long nDim )
2599 uno::Reference<container::XNameAccess> xDimsName = xSource->getDimensions();
2602 if ( nDim < nDimCount )
2604 uno::Reference<container::XNamed> xDimName(xDims->getByIndex(nDim), uno::UNO_QUERY);
2609 aName = xDimName->getName();
2611 catch(uno::Exception&)
2620bool hasFieldColumn(
const vector<ScPivotField>* pRefFields,
SCCOL nCol)
2625 return std::any_of(pRefFields->begin(), pRefFields->end(),
2628 return rField.nCol == nCol; });
2631class FindByOriginalDim
2635 explicit FindByOriginalDim(
tools::Long nDim) : mnDim(nDim) {}
2646 const Reference<XDimensionsSupplier>& xSource,
2652 ScPivotFieldVector::const_iterator itr, itrBeg = rFields.begin(), itrEnd = rFields.end();
2653 for (itr = itrBeg; itr != itrEnd; ++itr)
2659 const sheet::DataPilotFieldReference& rFieldRef = rField.
maFieldRef;
2666 OUString aDocStr = lcl_GetDimName(
xSource, nCol );
2667 if (!aDocStr.isEmpty())
2676 if ( nOrient == sheet::DataPilotFieldOrientation_DATA )
2683 if (hasFieldColumn(pRefColFields, nCol))
2686 if (bFirst && hasFieldColumn(pRefRowFields, nCol))
2689 if (bFirst && hasFieldColumn(pRefPageFields, nCol))
2696 bFirst = std::none_of(itrBeg, itr, FindByOriginalDim(nCol));
2714 std::vector<ScGeneralFunction> nSubTotalFuncs;
2715 nSubTotalFuncs.reserve(16);
2716 sal_uInt16 nMask = 1;
2719 if ( nFuncs &
static_cast<PivotFunc>(nMask) )
2731 size_t nDimIndex = rField.
nCol;
2734 if (nDimIndex < rLabels.size())
2747 bool bAllowed =
true;
2750 case sheet::DataPilotFieldOrientation_PAGE:
2751 bAllowed = ( nDimFlags & sheet::DimensionFlags::NO_PAGE_ORIENTATION ) == 0;
2753 case sheet::DataPilotFieldOrientation_COLUMN:
2754 bAllowed = ( nDimFlags & sheet::DimensionFlags::NO_COLUMN_ORIENTATION ) == 0;
2756 case sheet::DataPilotFieldOrientation_ROW:
2757 bAllowed = ( nDimFlags & sheet::DimensionFlags::NO_ROW_ORIENTATION ) == 0;
2759 case sheet::DataPilotFieldOrientation_DATA:
2760 bAllowed = ( nDimFlags & sheet::DimensionFlags::NO_DATA_ORIENTATION ) == 0;
2772 bool bFound =
false;
2775 uno::Reference<container::XContentEnumerationAccess> xEnAc( xManager, uno::UNO_QUERY );
2778 uno::Reference<container::XEnumeration> xEnum = xEnAc->createContentEnumeration(
2780 if ( xEnum.is() && xEnum->hasMoreElements() )
2789 std::vector<OUString> aVec;
2794 uno::Reference<container::XContentEnumerationAccess> xEnAc( xManager, uno::UNO_QUERY );
2797 uno::Reference<container::XEnumeration> xEnum = xEnAc->createContentEnumeration(
2801 while ( xEnum->hasMoreElements() )
2803 uno::Any aAddInAny = xEnum->nextElement();
2806 uno::Reference<uno::XInterface> xIntFac;
2807 aAddInAny >>= xIntFac;
2810 uno::Reference<lang::XServiceInfo> xInfo( xIntFac, uno::UNO_QUERY );
2813 OUString
sName = xInfo->getImplementationName();
2814 aVec.push_back(
sName );
2828 uno::Reference<sheet::XDimensionsSupplier> xRet;
2831 uno::Reference<container::XContentEnumerationAccess> xEnAc(xManager, uno::UNO_QUERY);
2835 uno::Reference<container::XEnumeration> xEnum =
2840 while (xEnum->hasMoreElements() && !xRet.is())
2842 uno::Any aAddInAny = xEnum->nextElement();
2843 uno::Reference<uno::XInterface> xIntFac;
2844 aAddInAny >>= xIntFac;
2848 uno::Reference<lang::XServiceInfo> xInfo(xIntFac, uno::UNO_QUERY);
2849 if (!xInfo.is() || xInfo->getImplementationName() != aImplName)
2857 uno::Reference<uno::XInterface> xInterface;
2858 uno::Reference<uno::XComponentContext> xCtx(
2860 uno::Reference<lang::XSingleComponentFactory> xCFac( xIntFac, uno::UNO_QUERY );
2862 xInterface = xCFac->createInstanceWithContext(xCtx);
2864 if (!xInterface.is())
2866 uno::Reference<lang::XSingleServiceFactory> xFac( xIntFac, uno::UNO_QUERY );
2868 xInterface = xFac->createInstance();
2871 uno::Reference<lang::XInitialization> xInit( xInterface, uno::UNO_QUERY );
2875 uno::Sequence<uno::Any>
aSeq(4);
2881 xInit->initialize(
aSeq );
2883 xRet.set( xInterface, uno::UNO_QUERY );
2885 catch(uno::Exception&)
2919struct FindInvalidRange
2921 bool operator() (
const ScRange& r)
const
2948 RangeIndexType::const_iterator it = std::find(maRanges.
begin(), maRanges.
end(), rRange);
2949 if (it == maRanges.
end())
2953 size_t nIndex = std::distance(maRanges.
begin(), it);
2954 CachesType::const_iterator
const itCache = m_Caches.find(
nIndex);
2955 return itCache != m_Caches.end();
2960 RangeIndexType::iterator it = std::find(maRanges.
begin(), maRanges.
end(), rRange);
2961 if (it != maRanges.
end())
2964 size_t nIndex = std::distance(maRanges.
begin(), it);
2965 CachesType::iterator
const itCache = m_Caches.find(
nIndex);
2966 if (itCache == m_Caches.end())
2968 OSL_FAIL(
"Cache pool and index pool out-of-sync !!!");
2974 (itCache->second)->ClearGroupFields();
2978 return itCache->second.get();
2983 pCache->InitFromDoc(
mrDoc, rRange);
2988 it = std::find_if(maRanges.
begin(), maRanges.
end(), FindInvalidRange());
2991 if (it == maRanges.
end())
3004 m_Caches.insert(std::make_pair(
nIndex, std::move(pCache)));
3010 RangeIndexType::iterator it = std::find(maRanges.
begin(), maRanges.
end(), rRange);
3011 if (it == maRanges.
end())
3016 size_t nIndex = std::distance(maRanges.
begin(), it);
3017 CachesType::iterator
const itCache = m_Caches.find(
nIndex);
3018 if (itCache == m_Caches.end())
3020 OSL_FAIL(
"Cache pool and index pool out-of-sync !!!");
3024 return itCache->second.get();
3029 RangeIndexType::const_iterator it = std::find(maRanges.
begin(), maRanges.
end(), rRange);
3030 if (it == maRanges.
end())
3035 size_t nIndex = std::distance(maRanges.
begin(), it);
3036 CachesType::const_iterator
const itCache = m_Caches.find(
nIndex);
3037 if (itCache == m_Caches.end())
3039 OSL_FAIL(
"Cache pool and index pool out-of-sync !!!");
3043 return itCache->second.get();
3048 return m_Caches.size();
3054 if (maRanges.
empty())
3058 for (
ScRange& rKeyRange : maRanges)
3060 SCCOL nCol1 = rKeyRange.aStart.Col();
3061 SCROW nRow1 = rKeyRange.aStart.Row();
3062 SCTAB nTab1 = rKeyRange.aStart.Tab();
3063 SCCOL nCol2 = rKeyRange.aEnd.Col();
3064 SCROW nRow2 = rKeyRange.aEnd.Row();
3065 SCTAB nTab2 = rKeyRange.aEnd.Tab();
3071 nCol1, nRow1, nTab1, nCol2, nRow2, nTab2);
3076 ScRange aNew(nCol1, nRow1, nTab1, nCol2, nRow2, nTab2);
3084 RangeIndexType::iterator it = std::find(maRanges.
begin(), maRanges.
end(), rRange);
3085 if (it == maRanges.
end())
3092 size_t nIndex = std::distance(maRanges.
begin(), it);
3093 CachesType::iterator
const itCache = m_Caches.find(
nIndex);
3094 if (itCache == m_Caches.end())
3096 OSL_FAIL(
"Cache pool and index pool out-of-sync !!!");
3110 setGroupItemsToCache(rCache, rRefs);
3115 CachesType::iterator it = std::find_if(m_Caches.begin(), m_Caches.end(),
3116 [&
p](
const CachesType::value_type& rEntry) { return rEntry.second.get() == p; });
3117 if (it != m_Caches.end())
3119 size_t idx = it->first;
3121 maRanges[
idx].SetInvalid();
3136 return m_Caches.count(rName) != 0;
3142 CachesType::const_iterator
const itr = m_Caches.find(rName);
3143 if (itr != m_Caches.end())
3145 return itr->second.get();
3148 pCache->InitFromDoc(
mrDoc, rRange);
3153 m_Caches.insert(std::make_pair(rName, std::move(pCache)));
3159 CachesType::iterator
const itr = m_Caches.find(rName);
3160 return itr != m_Caches.end() ? itr->second.get() :
nullptr;
3165 return m_Caches.size();
3171 CachesType::iterator
const itr = m_Caches.find(rName);
3172 if (itr == m_Caches.end())
3186 setGroupItemsToCache(rCache, rRefs);
3191 CachesType::iterator it = std::find_if(m_Caches.begin(), m_Caches.end(),
3192 [&
p](
const CachesType::value_type& rEntry) { return rEntry.second.get() == p; });
3193 if (it != m_Caches.end())
3202 mnSdbType(nSdbType), maDBName(
std::move(aDBName)), maCommand(
std::move(
aCommand)) {}
3213 DBType aType(nSdbType, rDBName, rCommand);
3214 CachesType::const_iterator
const itr = m_Caches.find(aType);
3215 return itr != m_Caches.end();
3219 sal_Int32 nSdbType,
const OUString& rDBName,
const OUString& rCommand,
3222 DBType aType(nSdbType, rDBName, rCommand);
3223 CachesType::const_iterator
const itr = m_Caches.find(aType);
3224 if (itr != m_Caches.end())
3226 return itr->second.get();
3228 uno::Reference<sdbc::XRowSet> xRowSet = createRowSet(nSdbType, rDBName, rCommand);
3234 DBConnector aDB(*pCache, xRowSet, aFormat.
GetNullDate());
3238 if (!pCache->InitFromDataBase(aDB))
3248 ::comphelper::disposeComponent(xRowSet);
3250 m_Caches.insert(std::make_pair(aType, std::move(pCache)));
3255 sal_Int32 nSdbType,
const OUString& rDBName,
const OUString& rCommand)
3257 DBType aType(nSdbType, rDBName, rCommand);
3258 CachesType::iterator
const itr = m_Caches.find(aType);
3259 return itr != m_Caches.end() ? itr->second.get() :
nullptr;
3263 sal_Int32 nSdbType,
const OUString& rDBName,
const OUString& rCommand)
3265 uno::Reference<sdbc::XRowSet> xRowSet;
3272 uno::Reference<beans::XPropertySet> xRowProp(xRowSet, UNO_QUERY);
3273 OSL_ENSURE( xRowProp.is(),
"can't get RowSet" );
3276 xRowSet.set(
nullptr);
3286 uno::Reference<sdb::XCompletedExecution> xExecute( xRowSet, uno::UNO_QUERY );
3287 if ( xExecute.is() )
3289 uno::Reference<task::XInteractionHandler> xHandler(
3291 uno::UNO_QUERY_THROW);
3292 xExecute->executeWithCompletion( xHandler );
3299 catch (
const sdbc::SQLException& rError )
3303 VclMessageType::Info, VclButtonsType::Ok,
3307 catch ( uno::Exception& )
3312 xRowSet.set(
nullptr);
3317 sal_Int32 nSdbType,
const OUString& rDBName,
const OUString& rCommand,
3320 DBType aType(nSdbType, rDBName, rCommand);
3321 CachesType::iterator
const it = m_Caches.find(aType);
3322 if (it == m_Caches.end())
3331 uno::Reference<sdbc::XRowSet> xRowSet = createRowSet(nSdbType, rDBName, rCommand);
3339 DBConnector aDB(rCache, xRowSet, aFormat.
GetNullDate());
3356 setGroupItemsToCache(rCache, rRefs);
3361 CachesType::iterator it = std::find_if(m_Caches.begin(), m_Caches.end(),
3362 [&
p](
const CachesType::value_type& rEntry) { return rEntry.second.get() == p; });
3363 if (it != m_Caches.end())
3381 maSheetCaches(r.mrDoc),
3382 maNameCaches(r.mrDoc),
3401 explicit MatchByTable(
SCTAB nTab) : mnTab(nTab) {}
3403 bool operator() (
const std::unique_ptr<ScDPObject>& rObj)
const
3405 return rObj->GetOutRange().aStart.Tab() == mnTab;
3414 return STR_ERR_DATAPILOTSOURCE;
3421 return STR_ERR_DATAPILOTSOURCE;
3459 return STR_ERR_DATAPILOTSOURCE;
3565 for (
const std::unique_ptr<ScDPObject>& aTable :
maTables)
3569 if (&rRefObj == &rDPObj)
3578 if (pDesc ==
nullptr || pRefDesc ==
nullptr)
3611 if (pDesc ==
nullptr || pRefDesc ==
nullptr)
3637 rxTable->UpdateReference(eUpdateRefMode, r, nDx, nDy, nDz);
3646 for (
const auto& rxTable :
maTables)
3660 aAdded.push_back(std::unique_ptr<ScDPObject>(pNew));
3663 std::move(aAdded.begin(), aAdded.end(), std::back_inserter(
maTables));
3669 [](
const TablesType::value_type&
a,
const TablesType::value_type& b) { return a->RefsEqual(*b); });
3677 TablesType::iterator itr2 = r.
maTables.begin();
3678 for (
const auto& rxTable :
maTables)
3680 rxTable->WriteRefsTo(**itr2);
3690 size_t nDestSize = r.
maTables.size();
3691 OSL_ENSURE( nSrcSize >= nDestSize,
"WriteRefsTo: missing entries in document" );
3692 for (
size_t nSrcPos = 0; nSrcPos < nSrcSize; ++nSrcPos)
3696 bool bFound =
false;
3697 for (
size_t nDestPos = 0; nDestPos < nDestSize && !bFound; ++nDestPos)
3713 OSL_ENSURE(
maTables.size() == r.
maTables.size(),
"WriteRefsTo: couldn't restore all entries" );
3736 if (
pObject->GetName() == rName)
3746 for (
size_t nAdd = 0; nAdd <=
n; ++nAdd)
3748 OUString aNewName =
"DataPilot" + OUString::number(1 + nAdd);
3750 [&aNewName](
const TablesType::value_type& rxObj) { return rxObj->GetName() == aNewName; }))
3763 auto funcRemoveCondition = [pDPObject] (std::unique_ptr<ScDPObject>
const & pCurrent)
3765 return pCurrent.get() == pDPObject;
3773 const ScRange& rOutRange = pDPObj->GetOutRange();
3778 maTables.push_back(std::move(pDPObj));
3784 for (
const std::unique_ptr<ScDPObject>& aTable :
maTables)
3786 if (aTable.get() == pDPObj)
3826 return std::for_each(
maTables.begin(),
maTables.end(), AccumulateOutputRanges(nTab)).getRanges();
3831 return std::any_of(
maTables.begin(),
maTables.end(), FindIntersectingTableByColumns(nCol1, nCol2, nRow, nTab));
3836 return std::any_of(
maTables.begin(),
maTables.end(), FindIntersectingTableByRows(nCol, nRow1, nRow2, nTab));
3841 return std::any_of(
maTables.begin(),
maTables.end(), FindIntersectingTable(rRange));
3844#if DEBUG_PIVOT_TABLE
3850 void operator() (
const std::unique_ptr<ScDPObject>& rObj)
const
3852 cout <<
"-- '" << rObj->GetName() <<
"'" <<
endl;
3865void ScDPCollection::DumpTables()
const
3890 for (
const auto& rxTable :
maTables)
3918 for (
const auto& rxTable :
maTables)
3944 sal_Int32 nSdbType, std::u16string_view rDBName, std::u16string_view rCommand,
3948 for (
const auto& rxTable :
maTables)
3972 return left.mnSdbType <
right.mnSdbType;
3977 return left.maCommand <
right.maCommand;
HRESULT createInstance(REFIID iid, Ifc **ppIfc)
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 ...
@ DpTable
dp field button with presence of hidden member
const char *const aFieldNames[]
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, const ILibreOfficeKitNotifier *pNotifier=nullptr)
OUString uppercase(const OUString &rStr, sal_Int32 nPos, sal_Int32 nCount) const
Interface for connecting to database source.
virtual OUString getColumnLabel(tools::Long nCol) const =0
virtual tools::Long getColumnCount() const =0
virtual void getValue(tools::Long nCol, ScDPItemData &rData, SvNumFormatType &rNumType) const =0
This class represents the cached data part of the datapilot cache table implementation.
void AddReference(ScDPObject *pObj) const
static OUString GetLocaleIndependentFormattedString(double fValue, SvNumberFormatter &rFormatter, sal_uInt32 nNumFormat)
void InitFromDoc(ScDocument &rDoc, const ScRange &rRange)
const ScDPObjectSet & GetAllReferences() const
bool InitFromDataBase(DBConnector &rDB)
Data caches for external database sources.
static css::uno::Reference< css::sdbc::XRowSet > createRowSet(sal_Int32 nSdbType, const OUString &rDBName, const OUString &rCommand)
const ScDPCache * getCache(sal_Int32 nSdbType, const OUString &rDBName, const OUString &rCommand, const ScDPDimensionSaveData *pDimData)
bool remove(const ScDPCache *p)
void updateCache(sal_Int32 nSdbType, const OUString &rDBName, const OUString &rCommand, o3tl::sorted_vector< ScDPObject * > &rRefs)
ScDPCache * getExistingCache(sal_Int32 nSdbType, const OUString &rDBName, const OUString &rCommand)
bool hasCache(sal_Int32 nSdbType, const OUString &rDBName, const OUString &rCommand) const
DBCaches(ScDocument &rDoc)
Data caches for range name based source data.
bool hasCache(const OUString &rName) const
ScDPCache * getExistingCache(const OUString &rName)
const ScDPCache * getCache(const OUString &rName, const ScRange &rRange, const ScDPDimensionSaveData *pDimData)
void updateCache(const OUString &rName, const ScRange &rRange, o3tl::sorted_vector< ScDPObject * > &rRefs)
bool remove(const ScDPCache *p)
NameCaches(ScDocument &rDoc)
Stores and manages all caches from internal sheets.
SC_DLLPUBLIC const std::vector< ScRange > & getAllRanges() const
SC_DLLPUBLIC size_t size() const
bool hasCache(const ScRange &rRange) const
bool remove(const ScDPCache *p)
const ScDPCache * getCache(const ScRange &rRange, const ScDPDimensionSaveData *pDimData)
SC_DLLPUBLIC ScDPCache * getExistingCache(const ScRange &rRange)
SheetCaches(ScDocument &rDoc)
void updateReference(UpdateRefMode eMode, const ScRange &r, SCCOL nDx, SCROW nDy, SCTAB nDz)
void updateCache(const ScRange &rRange, o3tl::sorted_vector< ScDPObject * > &rRefs)
bool RefsEqual(const ScDPCollection &r) const
void WriteRefsTo(ScDPCollection &r) const
SC_DLLPUBLIC ScDPObject * InsertNewTable(std::unique_ptr< ScDPObject > pDPObj)
bool IntersectsTableByColumns(SCCOL nCol1, SCCOL nCol2, SCROW nRow, SCTAB nTab) const
SheetCaches maSheetCaches
SC_DLLPUBLIC SheetCaches & GetSheetCaches()
void FreeTable(const ScDPObject *pDPObj)
void GetAllTables(const ScRange &rSrcRange, o3tl::sorted_vector< ScDPObject * > &rRefs) const
SC_DLLPUBLIC size_t GetCount() const
void RemoveCache(const ScDPCache *pCache)
Only to be called from ScDPCache::RemoveReference().
void CopyToTab(SCTAB nOld, SCTAB nNew)
ScDPObject * GetByName(std::u16string_view rName) const
SC_DLLPUBLIC ScDPObject & operator[](size_t nIndex)
TranslateId ReloadCache(const ScDPObject *pDPObj, o3tl::sorted_vector< ScDPObject * > &rRefs)
bool IntersectsTableByRows(SCCOL nCol, SCROW nRow1, SCROW nRow2, SCTAB nTab) const
ScDPCollection(ScDocument &rDocument)
ScRangeList GetAllTableRanges(SCTAB nTab) const
void DeleteOnTab(SCTAB nTab)
void UpdateReference(UpdateRefMode eUpdateRefMode, const ScRange &r, SCCOL nDx, SCROW nDy, SCTAB nDz)
OUString CreateNewName() const
Create a new name that's not yet used by any existing data pilot objects.
SC_DLLPUBLIC bool GetReferenceGroups(const ScDPObject &rDPObj, const ScDPDimensionSaveData **pGroups) const
std::vector< std::unique_ptr< ScDPObject > > TablesType
NameCaches & GetNameCaches()
bool ReloadGroupsInCache(const ScDPObject *pDPObj, o3tl::sorted_vector< ScDPObject * > &rRefs)
SC_DLLPUBLIC bool HasTable(const ScDPObject *pDPObj) const
This class has to do with handling exclusively grouped dimensions? TODO: Find out what this class doe...
void WriteToCache(ScDPCache &rCache) const
bool HasGroupDimensions() const
void WriteToData(ScDPGroupTableData &rData) const
When assigning a string value, you can also assign an interned string whose life-cycle is managed by ...
void SetStringInterned(rtl_uString *pS)
void SetValue(double fVal)
ScDPObject & operator=(const ScDPObject &r)
const ScRange & GetOutRange() const
SAL_DLLPRIVATE void CreateOutput()
bool GetHierarchiesNA(sal_Int32 nDim, css::uno::Reference< css::container::XNameAccess > &xHiers)
bool SyncAllDimensionMembers()
Remove in the save data entries for members that don't exist anymore.
void SetName(const OUString &rNew)
ScRange GetNewOutputRange(bool &rOverflow)
void GetHeaderPositionData(const ScAddress &rPos, css::sheet::DataPilotTableHeaderData &rData)
SAL_DLLPRIVATE void CreateObjects()
static css::uno::Reference< css::sheet::XDimensionsSupplier > CreateSource(const ScDPServiceDesc &rDesc)
void SetSaveData(const ScDPSaveData &rData)
void GetDrillDownData(const ScAddress &rPos, css::uno::Sequence< css::uno::Sequence< css::uno::Any > > &rTableData)
ScDPObject(ScDocument *pD)
void GetHierarchies(sal_Int32 nDim, css::uno::Sequence< OUString > &rHiers)
std::unique_ptr< ScDPServiceDesc > pServDesc
bool ParseFilters(OUString &rDataFieldName, std::vector< css::sheet::DataPilotFieldFilter > &rFilters, std::vector< sal_Int16 > &rFilterFuncs, std::u16string_view rFilterList)
void SetAllowMove(bool bSet)
std::unique_ptr< ScImportSourceDesc > pImpDesc
static bool IsOrientationAllowed(css::sheet::DataPilotFieldOrientation nOrient, sal_Int32 nDimFlags)
std::unique_ptr< ScDPOutput > pOutput
void SetImportDesc(const ScImportSourceDesc &rDesc)
SAL_DLLPRIVATE void ClearSource()
css::uno::Reference< css::sheet::XDimensionsSupplier > const & GetSource()
bool mbEnableGetPivotData
bool GetHeaderDrag(const ScAddress &rPos, bool bMouseLeft, bool bMouseTop, tools::Long nDragDim, tools::Rectangle &rPosRect, css::sheet::DataPilotFieldOrientation &rOrient, tools::Long &rDimPos)
bool IsDataDescriptionCell(const ScAddress &rPos)
Data description cell displays the description of a data dimension if and only if there is only one d...
tools::Long GetHeaderDim(const ScAddress &rPos, css::sheet::DataPilotFieldOrientation &rOrient)
void WriteRefsTo(ScDPObject &r) const
void BuildAllDimensionMembers()
void Output(const ScAddress &rPos)
std::shared_ptr< ScDPTableData > mpTableData
void SetTag(const OUString &rNew)
bool IsFilterButton(const ScAddress &rPos)
void SetSheetDesc(const ScSheetSourceDesc &rDesc)
void SetServiceData(const ScDPServiceDesc &rDesc)
bool IsDimNameInUse(std::u16string_view rName) const
css::uno::Reference< css::sheet::XDimensionsSupplier > xSource
bool GetMembers(sal_Int32 nDim, sal_Int32 nHier, ::std::vector< ScDPLabelData::Member > &rMembers)
const ScSheetSourceDesc * GetSheetDesc() const
std::unique_ptr< ScSheetSourceDesc > pSheetDesc
bool GetDataFieldPositionData(const ScAddress &rPos, css::uno::Sequence< css::sheet::DataPilotFieldFilter > &rFilters)
void ToggleDetails(const css::sheet::DataPilotTableHeaderData &rElemDesc, ScDPObject *pDestObj)
double GetPivotData(const OUString &rDataFieldName, std::vector< css::sheet::DataPilotFieldFilter > &rFilters)
SAL_DLLPRIVATE void FillLabelDataForDimension(const css::uno::Reference< css::container::XIndexAccess > &xDims, sal_Int32 nDim, ScDPLabelData &rLabelData)
static bool HasRegisteredSources()
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)
void UpdateReference(UpdateRefMode eUpdateRefMode, const ScRange &r, SCCOL nDx, SCROW nDy, SCTAB nDz)
bool GetMembersNA(sal_Int32 nDim, css::uno::Reference< css::sheet::XMembersAccess > &xMembers)
ScRange GetOutputRangeByType(sal_Int32 nType)
void FillOldParam(ScPivotParam &rParam) const
bool IsDuplicated(tools::Long nDim)
void WriteTempDataTo(ScDPObject &rDest) const
void ReloadGroupTableData()
void GetMemberResultNames(ScDPUniqueStringSet &rNames, tools::Long nDimension)
std::unique_ptr< ScDPSaveData > pSaveData
bool GetMemberNames(sal_Int32 nDim, css::uno::Sequence< OUString > &rNames)
ScDPSaveData * GetSaveData() const
bool IsImportData() const
void SetOutRange(const ScRange &rRange)
const OUString & GetName() const
void WriteSourceDataTo(ScDPObject &rDest) const
void GetPositionData(const ScAddress &rPos, css::sheet::DataPilotTablePositionData &rPosData)
SAL_DLLPRIVATE ScDPTableData * GetTableData()
OUString GetFormattedString(std::u16string_view rDimName, const double fValue)
OUString GetDimName(tools::Long nDim, bool &rIsDataLayout, sal_Int32 *pFlags=nullptr)
tools::Long GetDimCount()
void EnableGetPivotData(bool b)
static std::vector< OUString > GetRegisteredSources()
void SetHeaderLayout(bool bUseGrid)
std::map< OUString, css::uno::Any > maInteropGrabBag
sal_Int32 GetUsedHierarchy(sal_Int32 nDim)
void GetFieldIdsNames(css::sheet::DataPilotFieldOrientation nOrient, std::vector< tools::Long > &rIndices, std::vector< OUString > &rNames)
const ScImportSourceDesc * GetImportSourceDesc() const
void FillLabelData(sal_Int32 nDim, ScDPLabelData &Labels)
bool RefsEqual(const ScDPObject &r) const
static void GetDataDimensionNames(OUString &rSourceName, OUString &rGivenName, const css::uno::Reference< css::uno::XInterface > &xDim)
std::unordered_map< OUString, size_t > DimOrderType
ScDPSaveDimension * DuplicateDimension(std::u16string_view rName)
SC_DLLPUBLIC ScDPSaveDimension * GetDataLayoutDimension()
const ScDPDimensionSaveData * GetExistingDimensionData() const
SC_DLLPUBLIC ScDPSaveDimension * GetDimensionByName(const OUString &rName)
Get a dimension object by its name.
void RemoveSubtotalName()
void SetLayoutName(const OUString &rName)
void SetReferenceValue(const css::sheet::DataPilotFieldReference *pNew)
void SetOrientation(css::sheet::DataPilotFieldOrientation nNew)
void SetSubtotalName(const OUString &rName)
const std::optional< OUString > & GetLayoutName() const
ScGeneralFunction GetFunction() const
const OUString & GetName() const
void SetSubTotals(std::vector< ScGeneralFunction > &&rFuncs)
void SetShowEmpty(bool bSet)
void SetFunction(ScGeneralFunction nNew)
Base class that abstracts different data source types of a datapilot table.
virtual OUString getDimensionName(sal_Int32 nColumn)=0
OUString GetFormattedString(sal_Int32 nDim, const ScDPItemData &rItem, bool bLocaleIndependent) const
virtual sal_Int32 GetColumnCount()=0
use (new) typed collection instead of ScStrCollection or separate Str and ValueCollection
static sal_uInt8 getDuplicateIndex(const OUString &rName)
Get a duplicate index in case the dimension is a duplicate.
static SC_DLLPUBLIC OUString getSourceDimensionName(std::u16string_view rName)
static SC_DLLPUBLIC ScSubTotalFunc toSubTotalFunc(ScGeneralFunction eGenFunc)
static SC_DLLPUBLIC OUString getDisplayedMeasureName(const OUString &rName, ScSubTotalFunc eFunc)
static PivotFunc FunctionBit(sal_Int16 eFunc)
static ScGeneralFunction FirstFunc(PivotFunc nBits)
static weld::Window * GetActiveDialogParent()
SC_DLLPUBLIC bool RemoveFlagsTab(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, SCTAB nTab, ScMF nFlags)
SC_DLLPUBLIC bool ApplyFlagsTab(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, SCTAB nTab, ScMF nFlags)
SC_DLLPUBLIC void DeleteAreaTab(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, SCTAB nTab, InsertDeleteFlags nDelFlag)
bool IsBlockEmpty(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, SCTAB nTab) const
SC_DLLPUBLIC const SfxPoolItem * GetAttr(SCCOL nCol, SCROW nRow, SCTAB nTab, sal_uInt16 nWhich) const
static SC_DLLPUBLIC ::utl::TransliterationWrapper & GetTransliteration()
static SC_DLLPUBLIC LanguageType eLnge
static SC_DLLPUBLIC const CharClass & getCharClass()
::std::vector< ScRange >::const_iterator begin() const
::std::vector< ScRange >::const_iterator end() const
void Join(const ScRange &, bool bIsInList=false)
void push_back(const ScRange &rRange)
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)
This class contains authoritative information on the internal reference used as the data source for d...
const OUString & GetRangeName() const
TranslateId CheckSourceRange() const
Check the sanity of the data source range.
SC_DLLPUBLIC const ScRange & GetSourceRange() const
Get the range that contains the source data.
bool HasRangeName() const
static bool GetBoolProperty(const css::uno::Reference< css::beans::XPropertySet > &xProp, const OUString &rName, bool bDefault=false)
static EnumT GetEnumProperty(const css::uno::Reference< css::beans::XPropertySet > &xProp, const OUString &rName, EnumT nDefault)
static sal_Int16 GetShortProperty(const css::uno::Reference< css::beans::XPropertySet > &xProp, const OUString &rName, sal_Int16 nDefault)
static OUString GetStringProperty(const css::uno::Reference< css::beans::XPropertySet > &xProp, const OUString &rName, const OUString &rDefault)
static sal_Int32 GetLongProperty(const css::uno::Reference< css::beans::XPropertySet > &xProp, const OUString &rName)
void swap(sorted_vector &other)
std::pair< const_iterator, bool > insert(Value &&x)
bool isEqual(const OUString &rStr1, const OUString &rStr2) const
bool equals(const OUString &rStr1, sal_Int32 nPos1, sal_Int32 nCount1, sal_Int32 &nMatch1, const OUString &rStr2, sal_Int32 nPos2, sal_Int32 nCount2, sal_Int32 &nMatch2) const
#define TOOLS_WARN_EXCEPTION(area, stream)
#define DBG_UNHANDLED_EXCEPTION(...)
static bool lcl_HasButton(const ScDocument *pDoc, SCCOL nCol, SCROW nRow, SCTAB nTab)
static sheet::DataPilotFieldOrientation lcl_GetDataGetOrientation(const uno::Reference< sheet::XDimensionsSupplier > &xSource)
static void lcl_FillLabelData(ScDPLabelData &rData, const uno::Reference< beans::XPropertySet > &xDimProp)
constexpr OUStringLiteral SCDPSOURCE_SERVICE
constexpr OUStringLiteral SC_DBPROP_DATASOURCENAME
constexpr OUStringLiteral SC_DBPROP_COMMAND
static void lcl_FillOldFields(ScPivotFieldVector &rFields, const uno::Reference< sheet::XDimensionsSupplier > &xSource, sheet::DataPilotFieldOrientation nOrient, bool bAddData)
constexpr OUStringLiteral SC_SERVICE_ROWSET
static PivotFunc lcl_FirstSubTotal(const uno::Reference< beans::XPropertySet > &xDimProp)
bool operator<(const ScDPCollection::DBType &left, const ScDPCollection::DBType &right)
constexpr OUStringLiteral SC_DBPROP_COMMANDTYPE
std::unordered_set< OUString > ScDPUniqueStringSet
EmbeddedObjectRef * pObject
ScGeneralFunction
the css::sheet::GeneralFunction enum is extended by constants in GeneralFunction2,...
Sequence< sal_Int8 > aSeq
#define SAL_N_ELEMENTS(arr)
std::unique_ptr< sal_Int32[]> pData
OString strip(const OString &rIn, char c)
OString stripEnd(const OString &rIn, char c)
OString stripStart(const OString &rIn, char c)
void disposeComponent(css::uno::Reference< TYPE > &_rxComp)
Reference< XMultiServiceFactory > getProcessServiceFactory()
Reference< XComponentContext > getProcessComponentContext()
Reference< XComponentContext > getComponentContext(Reference< XMultiServiceFactory > const &factory)
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
std::vector< std::unique_ptr< ScDPLabelData > > ScDPLabelDataVector
std::vector< ScPivotField > ScPivotFieldVector
@ UR_NOTHING
Reference not affected, no change at all.
constexpr TypedWhichId< ScMergeFlagAttr > ATTR_MERGE_FLAG(145)
TOOLS_DLLPUBLIC SvStream & endl(SvStream &rStr)
bool operator()(const DBType &left, const DBType &right) const
Defines connection type to external data source.
DBType(sal_Int32 nSdbType, OUString aDBName, OUString aCommand)
sal_Int32 mnUsedHier
Used hierarchy.
css::sheet::DataPilotFieldAutoShowInfo maShowInfo
AutoShow info.
tools::Long mnOriginalDim
original dimension index (>= 0 for duplicated dimension)
bool mbIsValue
true = Sum or count in data field.
css::sheet::DataPilotFieldLayoutInfo maLayoutInfo
Layout info.
SCCOL mnCol
0-based field index (not the source column index)
OUString maName
Original name of the dimension.
bool mbShowAll
true = Show all (also empty) results.
css::uno::Sequence< OUString > maHiers
Hierarchies.
OUString maLayoutName
Layout name (display name)
css::sheet::DataPilotFieldSortInfo maSortInfo
Sorting info.
std::vector< Member > maMembers
sal_Int32 mnFlags
Flags from the DataPilotSource dimension.
bool operator==(const ScDPServiceDesc &rOther) const
ScDPServiceDesc(OUString aServ, OUString aSrc, OUString aNam, OUString aUser, OUString aPass)
sal_Int32 GetCommandType() const
SCCOL nCol
0-based dimension index (not source column index)
tools::Long getOriginalDim() const
css::sheet::DataPilotFieldReference maFieldRef
tools::Long mnOriginalDim
>= 0 for duplicated field.
ScDPLabelDataVector maLabelArray
ScPivotFieldVector maDataFields
ScPivotFieldVector maRowFields
SCCOL nCol
Cursor Position /.
SCROW nRow
or start of destination area
ScPivotFieldVector maColFields
ScPivotFieldVector maPageFields
SC_DLLPUBLIC const ScQueryEntry & GetEntry(SCSIZE n) const
SC_DLLPUBLIC SCSIZE GetEntryCount() const
constexpr OUStringLiteral SC_UNO_DP_SORTING
constexpr OUStringLiteral SC_UNO_DP_COLGRAND
constexpr OUStringLiteral SC_UNO_DP_POSITION
constexpr OUStringLiteral SC_UNO_DP_REPEATEMPTY
constexpr OUStringLiteral SC_UNO_DP_ISDATALAYOUT
constexpr OUStringLiteral SC_UNO_DP_IGNOREEMPTY
constexpr OUStringLiteral SC_UNO_DP_SUBTOTAL2
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_ROWGRAND
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_AUTOSHOW
constexpr OUStringLiteral SC_UNO_DP_FLAGS
std::unique_ptr< char[]> aBuffer