28#include <com/sun/star/beans/XPropertySet.hpp>
29#include <com/sun/star/container/XNameAccess.hpp>
30#include <com/sun/star/sheet/DataPilotFieldFilter.hpp>
31#include <com/sun/star/sheet/DataPilotFieldGroupBy.hpp>
32#include <com/sun/star/sheet/DataPilotFieldOrientation.hpp>
33#include <com/sun/star/sheet/DataPilotFieldSortMode.hpp>
34#include <com/sun/star/sheet/DataPilotTableHeaderData.hpp>
35#include <com/sun/star/sheet/MemberResultFlags.hpp>
36#include <com/sun/star/sheet/XDimensionsSupplier.hpp>
37#include <com/sun/star/sheet/XDrillDownDataSupplier.hpp>
57#include <unonames.hxx>
66#include <osl/diagnose.h>
70#include <unordered_set>
71#include <unordered_map>
76using ::com::sun::star::uno::Any;
77using ::com::sun::star::uno::Sequence;
78using ::com::sun::star::uno::Reference;
79using ::com::sun::star::uno::UNO_QUERY;
80using ::com::sun::star::beans::XPropertySet;
81using ::com::sun::star::container::XNameAccess;
82using ::com::sun::star::sheet::XDimensionsSupplier;
96 aFunc.
MakeOutline( aRange, bColumns, bRecord,
false );
100 bColumns, !bColumns,
false ,
121 bColumns, !bColumns,
false ,
133 bool bColFound =
false;
134 bool bRowFound =
false;
136 SCCOL nStartCol, nEndCol;
137 SCROW nStartRow, nEndRow;
138 SCTAB nStartTab, nEndTab;
141 SCTAB nTab = nStartTab;
149 bool bColMarked = ( nStartRow == 0 && nEndRow == rDoc.
MaxRow() );
150 bool bRowMarked = ( nStartCol == 0 && nEndCol == rDoc.
MaxCol() );
154 if ( !bRowMarked || bColMarked )
165 if ( nStartCol<=
static_cast<SCCOL>(nEnd) && nEndCol>=
static_cast<SCCOL>(nStart) )
172 if ( !bColMarked || bRowMarked )
183 if ( nStartRow<=nEnd && nEndRow>=nStart )
205 true ,
true ,
false ,
239 bool bOk = aFunc.
SelectLevel( nTab, bColumns, nLevel, bRecord,
true );
244 bColumns, !bColumns,
false ,
255 const sal_uInt16 nHeadEntry =
static_cast< sal_uInt16
>( -1 );
256 if ( nEntry == nHeadEntry)
257 SelectLevel( bColumns, sal::static_int_cast<sal_uInt16>(nLevel) );
261 ShowOutline( bColumns, sal::static_int_cast<sal_uInt16>(nLevel), sal::static_int_cast<sal_uInt16>(nEntry) );
263 HideOutline( bColumns, sal::static_int_cast<sal_uInt16>(nLevel), sal::static_int_cast<sal_uInt16>(nEntry) );
273 aFunc.
ShowOutline( nTab, bColumns, nLevel, nEntry, bRecord, bPaint );
278 bColumns, !bColumns,
false ,
293 bool bOk = aFunc.
HideOutline( nTab, bColumns, nLevel, nEntry, bRecord, bPaint );
298 bColumns, !bColumns,
false ,
309 bool bEnable =
false;
341 if ( nStartCol<=
static_cast<SCCOL>(nEnd) && nEndCol>=
static_cast<SCCOL>(nStart) )
347 if ( nStart>=nStartCol && nEnd<=nEndCol )
366 if ( nStartRow<=nEnd && nEndRow>=nStart )
372 if ( nStart>=nStartRow && nEnd<=nEndRow )
397 false ,
true ,
true ,
420 false ,
true ,
true ,
447 OSL_FAIL(
"SubTotals: no DBData" );
472 VclMessageType::Question, VclButtonsType::YesNo,
473 ScResId(STR_MSSG_DOSUBTOTALS_1)));
474 xBox->set_title(
ScResId(STR_MSSG_DOSUBTOTALS_0));
475 xBox->set_default_response(
RET_YES);
487 std::unique_ptr<ScOutlineTable> pUndoTab;
488 std::unique_ptr<ScRangeName> pUndoRange;
489 std::unique_ptr<ScDBCollection> pUndoDB;
493 bool bOldFilter = bDo && rParam.
bDoSort;
508 pUndoDoc->InitUndo( rDoc, nTab, nTab,
true,
true );
513 pUndoDoc->InitUndo( rDoc, nTab, nTab,
false, bOldFilter );
525 if (!pDocRange->
empty())
528 if (!pDocDB->
empty())
537 sal_uInt16 nDepth = rRowArray.
GetDepth();
538 for (sal_uInt16
i = 0;
i < nDepth; ++
i)
547 bool bSuccess =
true;
551 if ( rParam.
bDoSort || pForceNewSort )
560 ScSortParam aSortParam( aNewParam, pForceNewSort ? *pForceNewSort : aOldSort );
561 Sort( aSortParam,
false,
false );
573 std::make_unique<ScUndoSubTotals>( pDocSh, nTab,
574 rParam, aNewParam.
nRow2,
575 std::move(pUndoDoc), std::move(pUndoTab),
576 std::move(pUndoRange), std::move(pUndoDB) ) );
617 OUString
aName = rPrefix + OUString::number( nNumber );
649 SCTAB nNewTab = nSrcTab+1;
665 aDestRange =
ScRange( 0, 0, nNewTab );
690 bool bAllowMove = (pDPObj !=
nullptr);
693 bool bSuccess = aFunc.
DataPilotUpdate(pDPObj, &aObj,
true,
false, bAllowMove);
757 size_t nRangeCount = xRanges->size();
758 bool bContinue =
true;
760 for (
size_t nRangePos=0; nRangePos < nRangeCount && bContinue; nRangePos++)
762 ScRange const & rRange = (*xRanges)[nRangePos];
769 for (
SCROW nRow=nStartRow; nRow<=nEndRow && bContinue; nRow++)
770 for (
SCCOL nCol=nStartCol; nCol<=nEndCol && bContinue; nCol++)
772 sheet::DataPilotTableHeaderData
aData;
774 if (
aData.Dimension < 0 )
778 if ( nStartDimension < 0 )
780 nStartDimension =
aData.Dimension;
781 nStartHierarchy =
aData.Hierarchy;
782 nStartLevel =
aData.Level;
784 if (
aData.Dimension != nStartDimension ||
785 aData.Hierarchy != nStartHierarchy ||
786 aData.Level != nStartLevel )
795 if (
aData.Flags & sheet::MemberResultFlags::HASMEMBER )
796 rEntries.insert(
aData.MemberName);
801 rDimension = nStartDimension;
827 OUString aDimName = pDPObj->
GetDimName( nSelectDimension, bIsDataLayout );
828 OUString aBaseDimName( aDimName );
830 bool bInGroupDim =
false;
831 bool bFoundParts =
false;
856 rOldInfo = pNumGroupDim->
GetInfo();
857 rParts = css::sheet::DataPilotFieldGroupBy::DAYS;
863 else if ( pGroupDim )
879 if ( bFound && !bFoundParts )
884 if ( !bFound && !bInGroupDim )
901 if (
nType == SvNumFormatType::DATE ||
nType == SvNumFormatType::TIME ||
nType == SvNumFormatType::DATETIME )
940 OUString aDimName = pDPObj->
GetDimName( nSelectDimension, bIsDataLayout );
942 bool bInGroupDim =
false;
954 rOldInfo = pNumGroupDim->
GetInfo();
960 if ( !bFound && !bInGroupDim )
1001 std::vector<OUString> aDeletedNames;
1003 OUString aDimName = pDPObj->
GetDimName( nSelectDimension, bIsDataLayout );
1009 OUString aBaseDimName = aDimName;
1011 aBaseDimName = pBaseGroupDim->GetSourceDimName();
1017 aData.RemoveAllGroupDimensions(aBaseDimName, &aDeletedNames);
1024 sal_Int32 nMask = 1;
1027 if ( nParts & nMask )
1034 if ( (nParts == sheet::DataPilotFieldGroupBy::DAYS) && (rInfo.
mfStep >= 1.0) )
1056 OUString aGroupDimName =
1064 if ( pSaveDimension->
GetOrientation() == sheet::DataPilotFieldOrientation_HIDDEN )
1068 aData.SetPosition( pSaveDimension, 0 );
1100 OUString aDimName = pDPObj->
GetDimName( nSelectDimension, bIsDataLayout );
1142 OUString aDimName = pDPObj->
GetDimName( nSelectDimension, bIsDataLayout );
1148 OUString aBaseDimName = aDimName;
1150 if ( pBaseGroupDim )
1162 if ( pGroupDimension )
1166 if ( pBaseGroupDim )
1181 std::unique_ptr<ScDPSaveGroupDimension> pNewGroupDim;
1182 if ( !pGroupDimension )
1185 OUString aGroupDimName =
1189 pGroupDimension = pNewGroupDim.get();
1191 if ( pBaseGroupDim )
1201 for (
tools::Long nGroup = 0; nGroup < nGroupCount; nGroup++ )
1221 if ( pBaseGroupDim )
1239 pNewGroupDim.reset();
1242 pGroupDimension =
nullptr;
1246 if ( pSaveDimension->
GetOrientation() == sheet::DataPilotFieldOrientation_HIDDEN )
1250 aData.SetPosition( pSaveDimension, 0 );
1277 OUString aDimName = pDPObj->
GetDimName( nSelectDimension, bIsDataLayout );
1280 if (!
aData.GetExistingDimensionData())
1288 if ( ( pGroupDim && pGroupDim->
GetDatePart() != 0 ) ||
1289 ( pNumGroupDim && pNumGroupDim->
GetDatePart() != 0 ) )
1300 for (
const auto& rEntry :
aEntries)
1304 bool bEmptyDim = pGroupDim->
IsEmpty();
1318 aData.RemoveDimensionByName( aDimName );
1321 else if ( pNumGroupDim )
1339 sal_Int32
n = rSubtotal.getLength();
1341 OUStringBuffer
aBuf, aWordBuf;
1342 for (sal_Int32
i = 0;
i <
n; ++
i)
1347 OUString aWord = aWordBuf.makeStringAndClear();
1348 if (aWord == rMemberName)
1357 aWordBuf.append(OUStringChar(c) + OUStringChar(c));
1362 aWordBuf.append(
"\\" + OUStringChar(c));
1368 if (!aWordBuf.isEmpty())
1370 OUString aWord = aWordBuf.makeStringAndClear();
1371 if (aWord == rMemberName)
1377 return aBuf.makeStringAndClear();
1391 if ( aOldText == rString )
1401 bool bChange =
false;
1402 bool bNeedReloadGroups =
false;
1404 DataPilotFieldOrientation nOrient = DataPilotFieldOrientation_HIDDEN;
1409 if (
aData.GetExistingDimensionData() )
1420 pGroupDim->
Rename( rString );
1429 pErrorId = STR_INVALIDNAME;
1432 else if (nOrient == DataPilotFieldOrientation_COLUMN || nOrient == DataPilotFieldOrientation_ROW)
1434 bool bDataLayout =
false;
1435 OUString aDimName = pDPObj->
GetDimName(nField, bDataLayout);
1439 if (!rString.isEmpty())
1441 if (rString.equalsIgnoreAsciiCase(aDimName))
1452 pErrorId = STR_INVALIDNAME;
1455 pErrorId = STR_INVALIDNAME;
1465 if (!rString.isEmpty())
1467 if (pDim->
GetName().equalsIgnoreAsciiCase(rString))
1478 pErrorId = STR_INVALIDNAME;
1481 pErrorId = STR_INVALIDNAME;
1487 sheet::DataPilotTableHeaderData aPosData;
1490 if ((aPosData.Flags & MemberResultFlags::HASMEMBER) && !aOldText.isEmpty())
1492 if (
aData.GetExistingDimensionData() && !(aPosData.Flags & MemberResultFlags::SUBTOTAL))
1495 OUString aDimName = pDPObj->
GetDimName( aPosData.Dimension, bIsDataLayout );
1503 if (!rString.isEmpty() && !pGroupDim->
GetNamedGroup(rString))
1507 pGroup->
Rename( rString );
1520 pSaveMember->
SetName( rString );
1523 bNeedReloadGroups =
true;
1526 pErrorId = STR_INVALIDNAME;
1529 else if (aPosData.Flags & MemberResultFlags::GRANDTOTAL)
1531 aData.SetGrandTotalName(rString);
1534 else if (aPosData.Dimension >= 0 && !aPosData.MemberName.isEmpty())
1536 bool bDataLayout =
false;
1543 if (aPosData.Flags & MemberResultFlags::SUBTOTAL)
1550 if (rString.isEmpty())
1552 pErrorId = STR_INVALIDNAME;
1556 if (aPosData.MemberName.equalsIgnoreAsciiCase(rString))
1567 pErrorId = STR_INVALIDNAME;
1584 if (aPosData.Flags & MemberResultFlags::SUBTOTAL)
1587 if (
aData.GetDataDimensionCount() > 1)
1597 const std::optional<OUString> & pLayoutName = pMem->
GetLayoutName();
1598 OUString aMemberName;
1600 aMemberName = *pLayoutName;
1602 aMemberName = aPosData.MemberName;
1612 if (!rString.isEmpty())
1614 if (rString.equalsIgnoreAsciiCase(pMem->
GetName()))
1625 pErrorId = STR_INVALIDNAME;
1628 pErrorId = STR_INVALIDNAME;
1642 if (bNeedReloadGroups)
1657 pErrorId = STR_ERR_DATAPILOT_INPUT;
1664 std::unique_ptr<ScDPSaveMember> pNewMember;
1670 rDim.
AddMember( std::move(pNewMember) );
1677struct ScOUStringCollate
1681 explicit ScOUStringCollate(
CollatorWrapper* pColl) : mpCollator(pColl) {}
1683 bool operator()(
const OUString& rStr1,
const OUString& rStr2)
const
1710 OUString aDimName = pDPObj->
GetDimName(nDimIndex, bDataLayout);
1719 const MemList& rDimMembers = pSaveDim->
GetMembers();
1720 vector<OUString> aMembers;
1721 std::unordered_set<OUString> aMemberSet;
1722 size_t nMemberCount = 0;
1725 aMembers.push_back(pMem->GetName());
1726 aMemberSet.insert(pMem->GetName());
1732 std::stable_sort(aMembers.begin(), aMembers.end(), aCollate);
1736 typedef std::unordered_map<OUString, sal_uInt16> UserSortMap;
1737 UserSortMap aSubStrs;
1738 sal_uInt16 nSubCount = 0;
1744 size_t n = pUserList->
size();
1745 if (!
n || *pUserListId >=
static_cast<sal_uInt16
>(
n))
1751 for (sal_uInt16
i = 0;
i <
n; ++
i)
1754 if (!aMemberSet.count(aSub))
1758 aSubStrs.emplace(aSub, nSubCount++);
1763 vector<OUString> aRankedNames(nMemberCount);
1764 sal_uInt16 nCurStrId = 0;
1765 for (
auto const& aMemberName : aMembers)
1767 sal_uInt16 nRank = 0;
1768 UserSortMap::const_iterator itrSub = aSubStrs.find(aMemberName);
1769 if (itrSub == aSubStrs.end())
1770 nRank = nSubCount + nCurStrId++;
1772 nRank = itrSub->second;
1775 nRank =
static_cast< sal_uInt16
>( nMemberCount - nRank - 1 );
1777 aRankedNames[nRank] = aMemberName;
1781 for (
auto const& aRankedName : aRankedNames)
1794 sheet::DataPilotFieldSortInfo aSortInfo;
1795 aSortInfo.Mode = sheet::DataPilotFieldSortMode::MANUAL;
1802 sheet::DataPilotFieldSortInfo aSortInfo;
1803 aSortInfo.Mode = sheet::DataPilotFieldSortMode::NAME;
1804 aSortInfo.IsAscending = bAscending;
1810 std::unique_ptr<ScDPObject> pNewObj(
new ScDPObject(*pDPObj));
1811 pNewObj->SetSaveData(aNewSaveData);
1824 sheet::DataPilotTableHeaderData aDestData;
1826 bool bValid = ( aDestData.Dimension >= 0 );
1829 std::unordered_set< OUString > aMembersSet;
1830 std::vector< OUString > aMembersVector;
1836 sheet::DataPilotTableHeaderData aSourceData;
1838 if ( aSourceData.Dimension == aDestData.Dimension && !aSourceData.MemberName.isEmpty() )
1840 if ( aMembersSet.insert( aSourceData.MemberName ).second )
1842 aMembersVector.push_back( aSourceData.MemberName );
1853 OUString aDimName = pDPObj->
GetDimName( aDestData.Dimension, bIsDataLayout );
1854 if ( !bIsDataLayout )
1860 uno::Sequence<OUString> aMemberNames;
1863 bool bInserted =
false;
1865 for (
const OUString& aMemberStr : std::as_const(aMemberNames))
1867 if ( !bInserted && aMemberStr == aDestData.MemberName )
1870 for (
const auto& rMember : aMembersVector )
1875 if ( aMembersSet.find( aMemberStr ) == aMembersSet.end() )
1880 for (
const auto& rMember : aMembersVector )
1886 sheet::DataPilotFieldSortInfo aSortInfo;
1887 aSortInfo.Mode = sheet::DataPilotFieldSortMode::MANUAL;
1892 std::unique_ptr<ScDPObject> pNewObj(
new ScDPObject( *pDPObj ));
1893 pNewObj->SetSaveData(
aData );
1922 OUString aDimName = pDPObj->
GetDimName( nSelectDimension, bIsDataLayout );
1923 if ( !bIsDataLayout )
1929 css::sheet::DataPilotFieldOrientation nDimOrient = pDim->
GetOrientation();
1931 if ( pDim == pInner )
1933 rOrientation = nDimOrient;
1959 OUString aDimName = pDPObj->
GetDimName( nSelectDimension, bIsDataLayout );
1960 if ( bIsDataLayout )
1966 if ( bShow && pNewDimensionName )
1972 if ( pNewDim->
GetOrientation() == sheet::DataPilotFieldOrientation_DATA )
1976 pDuplicated =
aData.DuplicateDimension( *pNewDimensionName );
1979 css::sheet::DataPilotFieldOrientation nOrientation = pDim->
GetOrientation();
1983 aData.SetPosition( pNewDim, nPosition );
1987 aData.GetDataDimensionCount() <= 1 )
1991 aData.SetPosition( pDataLayout, nPosition );
1997 aData.SetPosition( pDuplicated, nPosition );
2006 for (
const OUString& aVisName : aVisibleEntries)
2013 for (
const auto& rEntry :
aEntries)
2021 std::unique_ptr<ScDPObject> pNewObj(
new ScDPObject( *pDPObj ));
2022 pNewObj->SetSaveData(
aData );
2039 Reference<sheet::XDimensionsSupplier> xDimSupplier = rDPObj.
GetSource();
2040 Reference<container::XNameAccess> xDims = xDimSupplier->getDimensions();
2041 Reference<sheet::XDrillDownDataSupplier> xDDSupplier(xDimSupplier, UNO_QUERY);
2042 if (!xDDSupplier.is())
2045 Sequence< Sequence<Any> > aTabData = xDDSupplier->getDrillDownData(rFilters);
2046 sal_Int32 nRowSize = aTabData.getLength();
2051 SCCOL nColSize = aTabData[0].getLength();
2056 pInsDoc->ResetClip( &rDoc, nNewTab );
2057 for (
SCROW nRow = 0; nRow < nRowSize; ++nRow)
2059 for (
SCCOL nCol = 0; nCol < nColSize; ++nCol)
2061 const Any& rAny = aTabData[nRow][nCol];
2068 else if (rAny >>= fVal)
2069 pInsDoc->SetValue(nCol, nRow, nNewTab, fVal);
2074 for (
SCCOL nCol = 0; nCol < nColSize; ++nCol)
2077 if (!(aTabData[0][nCol] >>=
aStr))
2080 Reference<XPropertySet> xPropSet(xDims->getByName(
aStr), UNO_QUERY);
2085 sal_Int32 nNumFmt = 0;
2086 if (!(
any >>= nNumFmt))
2091 pInsDoc->ApplyPatternAreaTab(nCol, 1, nCol, nRowSize-1, nNewTab, aPattern);
2096 pInsDoc->GetCellArea( nNewTab, nEndCol, nEndRow );
2097 pInsDoc->SetClipArea(
ScRange( 0, 0, nNewTab, nEndCol, nEndRow, nNewTab ) );
2100 OUString aUndo =
ScResId( STR_UNDO_DOOUTLINE );
2103 OUString aNewTabName;
2129 bool bSort = aSortParam.
maKeyState[0].bDoSort;
2135 if ( bQuery || bSort || bSubTotal )
2137 bool bQuerySize =
false;
2140 if (bQuery && !aQueryParam.
bInplace)
2156 pDBData->
GetArea( nDummy, nStartCol, nStartRow, nEndCol, nEndRow );
2161 std::unique_ptr<ScOutlineTable> pUndoTab;
2162 std::unique_ptr<ScRangeName> pUndoRange;
2163 std::unique_ptr<ScDBCollection> pUndoDB;
2181 pUndoDoc->InitUndo( rDoc, nTab, nTab,
true,
true );
2186 pUndoDoc->InitUndo( rDoc, nTab, nTab,
false,
true );
2196 if (!pDocRange->
empty())
2199 if (!pDocDB->
empty())
2203 if (bSort && bSubTotal)
2214 Sort( aSortParam,
false,
false);
2223 Query( aQueryParam, &aAdvSource,
false );
2226 Query( aQueryParam,
nullptr,
false );
2243 SCROW nDummyRow, nNewEndRow;
2244 pDBData->
GetArea( nDummyTab, nDummyCol,nDummyRow, nDummyCol,nNewEndRow );
2246 const ScRange* pOld =
nullptr;
2247 const ScRange* pNew =
nullptr;
2261 std::make_unique<ScUndoRepeatDB>(
GetViewData().GetDocShell(), nTab,
2262 nStartCol, nStartRow, nEndCol, nEndRow,
2265 std::move(pUndoDoc), std::move(pUndoTab),
2266 std::move(pUndoRange), std::move(pUndoDB),
2289 if (pTabViewShell && pTabViewShell->
GetDocId() == pThisViewShell->
GetDocId())
2294 pPosHelper->invalidateByIndex(nStart);
2299 pPosHelper->invalidateByIndex(nStart);
2302 if (pTabViewShell->
getPart() == nCurrentTabIndex)
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 ...
SfxApplication * SfxGetpApp()
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, const ILibreOfficeKitNotifier *pNotifier=nullptr)
sal_Int32 compareString(const OUString &s1, const OUString &s2) const
void GetArea(SCTAB &rTab, SCCOL &rCol1, SCROW &rRow1, SCCOL &rCol2, SCROW &rRow2) const
SC_DLLPUBLIC bool GetAdvancedQuerySource(ScRange &rSource) const
void SetSubTotalParam(const ScSubTotalParam &rSubTotalParam)
SC_DLLPUBLIC void GetSortParam(ScSortParam &rSortParam) const
SC_DLLPUBLIC void GetQueryParam(ScQueryParam &rQueryParam) const
void GetSubTotalParam(ScSubTotalParam &rSubTotalParam) const
void SetArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2)
bool RemovePivotTable(const ScDPObject &rDPObj, bool bRecord, bool bApi)
void RefreshPivotTables(const ScDPObject *pDPObj, bool bApi)
Reload the referenced pivot cache, and refresh all pivot tables that reference the cache.
bool UpdatePivotTable(ScDPObject &rDPObj, bool bRecord, bool bApi)
bool DataPilotUpdate(ScDPObject *pOldObj, const ScDPObject *pNewObj, bool bRecord, bool bApi, bool bAllowMove=false)
void RefreshPivotTableGroups(ScDPObject *pDPObj)
Refresh the group dimensions of all pivot tables referencing the same cache.
void SetOutlineState(bool bColumn, sal_uInt16 nLevel, sal_uInt16 nEntry, bool bHidden)
bool OutlinePossible(bool bHide)
bool MakePivotTable(const ScDPSaveData &rData, const ScRange &rDest, bool bNewTable, const ScDPObject &rSource)
ScDBData * GetDBData(bool bMarkArea=true, ScGetDBMode eMode=SC_DB_MAKE, ScGetDBSelection eSel=ScGetDBSelection::Keep)
void RemoveOutline(bool bColumns, bool bRecord=true)
bool DataPilotMove(const ScRange &rSource, const ScAddress &rDest)
void HideOutline(bool bColumns, sal_uInt16 nLevel, sal_uInt16 nEntry, bool bRecord=true, bool bPaint=true)
void Sort(const ScSortParam &rSortParam, bool bRecord=true, bool bPaint=true)
void DataPilotInput(const ScAddress &rPos, const OUString &rString)
SC_DLLPUBLIC void Query(const ScQueryParam &rQueryParam, const ScRange *pAdvSource, bool bRecord)
void DoSubTotals(const ScSubTotalParam &rParam, bool bRecord=true, const ScSortParam *pForceNewSort=nullptr)
void DataPilotSort(ScDPObject *pDPObject, tools::Long nDimIndex, bool bAscending, const sal_uInt16 *pUserListId=nullptr)
void GetSelectedMemberList(ScDPUniqueStringSet &rEntries, tools::Long &rDimension)
bool HasSelectionForDrillDown(css::sheet::DataPilotFieldOrientation &rOrientation)
void OnLOKShowHideColRow(bool bColumns, SCCOLROW nStartRow)
bool HasSelectionForDateGroup(ScDPNumGroupInfo &rOldInfo, sal_Int32 &rParts)
void NumGroupDataPilot(const ScDPNumGroupInfo &rInfo)
void RepeatDB(bool bRecord=true)
void MakeOutline(bool bColumns, bool bRecord=true)
void TestRemoveOutline(bool &rCol, bool &rRow)
void DateGroupDataPilot(const ScDPNumGroupInfo &rInfo, sal_Int32 nParts)
bool HasSelectionForNumGroup(ScDPNumGroupInfo &rOldInfo)
void Consolidate(const ScConsolidateParam &rParam)
void ShowMarkedOutlines(bool bRecord=true)
void SetDataPilotDetails(bool bShow, const OUString *pNewDimensionName=nullptr)
void RemoveAllOutlines(bool bRecord=true)
void ShowOutline(bool bColumns, sal_uInt16 nLevel, sal_uInt16 nEntry, bool bRecord=true, bool bPaint=true)
void ShowDataPilotSourceData(ScDPObject &rDPObj, const css::uno::Sequence< css::sheet::DataPilotFieldFilter > &rFilters)
void SelectLevel(bool bColumns, sal_uInt16 nLevel, bool bRecord=true)
void HideMarkedOutlines(bool bRecord=true)
bool ReloadGroupsInCache(const ScDPObject *pDPObj, o3tl::sorted_vector< ScDPObject * > &rRefs)
This class has to do with handling exclusively grouped dimensions? TODO: Find out what this class doe...
const ScDPSaveGroupDimension * GetNamedGroupDim(const OUString &rGroupDimName) const
OUString CreateGroupDimName(const OUString &rSourceName, const ScDPObject &rObject, bool bAllowSource, const ::std::vector< OUString > *pDeletedNames)
sal_Int32 CollectDateParts(const OUString &rBaseDimName) const
void AddNumGroupDimension(const ScDPSaveNumGroupDimension &rGroupDim)
void RemoveNumGroupDimension(const OUString &rGroupDimName)
const ScDPSaveNumGroupDimension * GetNumGroupDim(const OUString &rGroupDimName) const
OUString CreateDateGroupDimName(sal_Int32 nDatePart, const ScDPObject &rObject, bool bAllowSource, const ::std::vector< OUString > *pDeletedNames)
void AddGroupDimension(const ScDPSaveGroupDimension &rGroupDim)
ScDPSaveNumGroupDimension * GetNumGroupDimAcc(const OUString &rGroupDimName)
ScDPSaveGroupDimension * GetGroupDimAccForBase(const OUString &rBaseDimName)
ScDPSaveGroupDimension * GetNamedGroupDimAcc(const OUString &rGroupDimName)
void RemoveGroupDimension(const OUString &rGroupDimName)
void GetHeaderPositionData(const ScAddress &rPos, css::sheet::DataPilotTableHeaderData &rData)
void SetSaveData(const ScDPSaveData &rData)
css::uno::Reference< css::sheet::XDimensionsSupplier > const & GetSource()
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 BuildAllDimensionMembers()
bool IsDimNameInUse(std::u16string_view rName) const
void GetMemberResultNames(ScDPUniqueStringSet &rNames, tools::Long nDimension)
bool GetMemberNames(sal_Int32 nDim, css::uno::Sequence< OUString > &rNames)
ScDPSaveData * GetSaveData() const
void SetOutRange(const ScRange &rRange)
OUString GetDimName(tools::Long nDim, bool &rIsDataLayout, sal_Int32 *pFlags=nullptr)
ScDPSaveDimension * GetInnermostDimension(css::sheet::DataPilotFieldOrientation nOrientation)
SC_DLLPUBLIC ScDPSaveDimension * GetExistingDimensionByName(std::u16string_view rName) const
const ScDPDimensionSaveData * GetExistingDimensionData() const
SC_DLLPUBLIC void SetDimensionData(const ScDPDimensionSaveData *pNew)
SC_DLLPUBLIC ScDPSaveDimension * GetDimensionByName(const OUString &rName)
Get a dimension object by its name.
void SetLayoutName(const OUString &rName)
ScGeneralFunction GetSubTotalFunc(tools::Long nIndex) const
void SetOrientation(css::sheet::DataPilotFieldOrientation nNew)
void AddMember(std::unique_ptr< ScDPSaveMember > pMember)
ScDPSaveMember * GetExistingMemberByName(const OUString &rName)
css::sheet::DataPilotFieldOrientation GetOrientation() const
void SetSubtotalName(const OUString &rName)
void SetSortInfo(const css::sheet::DataPilotFieldSortInfo *pNew)
bool IsMemberNameInUse(const OUString &rName) const
ScDPSaveMember * GetMemberByName(const OUString &rName)
Get a member object by its name.
tools::Long GetSubTotalsCount() const
const MemberList & GetMembers() const
std::vector< ScDPSaveMember * > MemberList
const OUString & GetName() const
void SetName(const OUString &rNew)
Represents a new group dimension whose dimension ID is higher than the highest source dimension ID.
ScDPSaveGroupItem * GetNamedGroupAcc(const OUString &rGroupName)
void Rename(const OUString &rNewName)
void AddGroupItem(const ScDPSaveGroupItem &rItem)
void RemoveFromGroups(const OUString &rItemName)
const OUString & GetSourceDimName() const
const OUString & GetGroupDimName() const
const ScDPNumGroupInfo & GetDateInfo() const
void RemoveGroup(const OUString &rGroupName)
void SetDateInfo(const ScDPNumGroupInfo &rInfo, sal_Int32 nPart)
const ScDPSaveGroupItem * GetNamedGroup(const OUString &rGroupName) const
OUString CreateGroupName(std::u16string_view rPrefix)
sal_Int32 GetDatePart() const
bool HasOnlyHidden(const ScDPUniqueStringSet &rVisible)
tools::Long GetGroupCount() const
const ScDPSaveGroupItem & GetGroupByIndex(tools::Long nIndex) const
Classes to save Data Pilot settings that create new dimensions (fields).
void Rename(const OUString &rNewName)
void AddElementsFromGroup(const ScDPSaveGroupItem &rGroup)
void RemoveElementsFromGroups(ScDPSaveGroupDimension &rDimension) const
remove this group's elements from their groups in rDimension (rDimension must be a different dimensio...
const OUString & GetGroupName() const
void AddElement(const OUString &rName)
void SetName(const OUString &rNew)
const OUString & GetName() const
SC_DLLPUBLIC void SetLayoutName(const OUString &rName)
SC_DLLPUBLIC const std::optional< OUString > & GetLayoutName() const
SC_DLLPUBLIC void SetShowDetails(bool bSet)
Represents a group dimension that introduces a new hierarchy for an existing dimension.
sal_Int32 GetDatePart() const
const ScDPNumGroupInfo & GetDateInfo() const
void SetGroupInfo(const ScDPNumGroupInfo &rNew)
const ScDPNumGroupInfo & GetInfo() const
Create before modifications of the document and destroy thereafter.
void SetDocumentModified()
const ScDocument & GetDocument() const
void PostPaint(SCCOL nStartCol, SCROW nStartRow, SCTAB nStartTab, SCCOL nEndCol, SCROW nEndRow, SCTAB nEndTab, PaintPartFlags nPart, sal_uInt16 nExtFlags=0)
void DoConsolidate(const ScConsolidateParam &rParam, bool bRecord=true)
virtual SfxUndoManager * GetUndoManager() override
SC_DLLPUBLIC bool InsertTab(SCTAB nPos, const OUString &rName, bool bExternalDocument=false, bool bUndoDeleteTab=false)
void RemoveSubTotals(SCTAB nTab, ScSubTotalParam &rParam)
SC_DLLPUBLIC SCCOL MaxCol() const
const ScDBData * GetDBAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab, ScDBDataPortion ePortion) const
SC_DLLPUBLIC SCROW MaxRow() const
SC_DLLPUBLIC double GetValue(const ScAddress &rPos) const
bool DoSubTotals(SCTAB nTab, ScSubTotalParam &rParam)
SC_DLLPUBLIC const ScDBData * GetDBAtArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2) const
SC_DLLPUBLIC bool CreateQueryParam(const ScRange &rRange, ScQueryParam &rQueryParam)
SC_DLLPUBLIC void CreateValidTabName(OUString &rName) const
SC_DLLPUBLIC bool HasAttrib(SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2, SCROW nRow2, SCTAB nTab2, HasAttrFlags nMask) const
void CopyToDocument(SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2, SCROW nRow2, SCTAB nTab2, InsertDeleteFlags nFlags, bool bMarked, ScDocument &rDestDoc, const ScMarkData *pMarks=nullptr, bool bColRowFlags=true)
SC_DLLPUBLIC ScDBCollection * GetDBCollection() const
SC_DLLPUBLIC ScDPObject * GetDPAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab) const
SfxObjectShell * GetDocumentShell() const
SC_DLLPUBLIC ScOutlineTable * GetOutlineTable(SCTAB nTab, bool bCreate=false)
SC_DLLPUBLIC bool HasValueData(SCCOL nCol, SCROW nRow, SCTAB nTab) const
bool TestRemoveSubTotals(SCTAB nTab, const ScSubTotalParam &rParam)
SC_DLLPUBLIC SvNumberFormatter * GetFormatTable() const
SC_DLLPUBLIC ScRangeName * GetRangeName(SCTAB nTab) const
SC_DLLPUBLIC OUString GetString(SCCOL nCol, SCROW nRow, SCTAB nTab, const ScInterpreterContext *pContext=nullptr) const
bool IsUndoEnabled() const
void SetDirty(const ScRange &, bool bIncludeEmptyCells)
SC_DLLPUBLIC bool GetName(SCTAB nTab, OUString &rName) const
SC_DLLPUBLIC const SfxPoolItem * GetAttr(SCCOL nCol, SCROW nRow, SCTAB nTab, sal_uInt16 nWhich) const
SC_DLLPUBLIC ScDPCollection * GetDPCollection()
SC_DLLPUBLIC SCTAB GetTableCount() const
TranslateId GetMessageId() const
static SC_DLLPUBLIC CollatorWrapper & GetCollator()
case-insensitive collator
static SC_DLLPUBLIC ScUserList * GetUserList()
todo: It should be possible to have MarkArrays for each table, in order to enable "search all" across...
const ScRange & GetMultiMarkArea() const
bool IsMultiMarked() const
void SetMarkArea(const ScRange &rRange)
void GetRange(SCCOLROW &rStart, SCCOLROW &rEnd) const
bool Remove(SCCOLROW nBlockStart, SCCOLROW nBlockEnd, bool &rSizeChanged)
void RemoveOutline(const ScRange &rRange, bool bColumns, bool bRecord, bool bApi)
bool HideOutline(SCTAB nTab, bool bColumns, sal_uInt16 nLevel, sal_uInt16 nEntry, bool bRecord, bool bPaint)
bool HideMarkedOutlines(const ScRange &rRange, bool bRecord)
void MakeOutline(const ScRange &rRange, bool bColumns, bool bRecord, bool bApi)
bool RemoveAllOutlines(SCTAB nTab, bool bRecord)
bool ShowMarkedOutlines(const ScRange &rRange, bool bRecord)
void AutoOutline(const ScRange &rRange, bool bRecord)
bool SelectLevel(SCTAB nTab, bool bColumns, sal_uInt16 nLevel, bool bRecord, bool bPaint)
void ShowOutline(SCTAB nTab, bool bColumns, sal_uInt16 nLevel, sal_uInt16 nEntry, bool bRecord, bool bPaint)
SC_DLLPUBLIC SCCOLROW GetStart() const
SC_DLLPUBLIC bool IsHidden() const
SC_DLLPUBLIC SCCOLROW GetEnd() const
const ScOutlineArray & GetColArray() const
const ScOutlineArray & GetRowArray() const
SfxItemSet & GetItemSet()
ScOutlineEntry * GetNext()
virtual void ShowCursor(bool bOn) override
static void notifyAllViewsSheetGeomInvalidation(const SfxViewShell *pForViewShell, bool bColumns, bool bRows, bool bSizes, bool bHidden, bool bFiltered, bool bGroups, SCTAB nCurrentTabIndex)
Emits a LOK_CALLBACK_INVALIDATE_SHEET_GEOMETRY for all views whose current tab is equal to nCurrentTa...
static void notifyAllViewsHeaderInvalidation(const SfxViewShell *pForViewShell, HeaderType eHeaderType, SCTAB nCurrentTabIndex)
Emits a LOK_CALLBACK_INVALIDATE_HEADER for all views whose current tab is equal to nCurrentTabIndex.
int getPart() const override
See SfxViewShell::getPart().
void DoneBlockMode(bool bContinue=false)
void ErrorMessage(TranslateId pGlobStrId)
void SelectionChanged(bool bFromPaste=false)
ScViewData & GetViewData()
void InitOwnBlockMode(const ScRange &rMarkRange)
void UpdateScrollBars(HeaderType eHeaderType=BOTH_HEADERS)
SC_DLLPUBLIC void SetTabNo(SCTAB nTab, bool bNew=false, bool bExtendSelection=false, bool bSameTabButMoved=false)
Stores individual user-defined sort list.
OUString GetSubStr(sal_uInt16 nIndex) const
size_t GetSubCount() const
Collection of user-defined sort lists.
void GetMultiArea(ScRangeListRef &rRange) const
ScMarkData & GetMarkData()
void InsertTab(SCTAB nTab)
ScDocument & GetDocument() const
ScPositionHelper & GetLOKHeightHelper()
ScDocShell * GetDocShell() const
ScTabViewShell * GetViewShell() const
ScPositionHelper & GetLOKWidthHelper()
SC_DLLPUBLIC bool PasteFromClip(InsertDeleteFlags nFlags, ScDocument *pClipDoc, ScPasteFunc nFunction=ScPasteFunc::NONE, bool bSkipEmptyCells=false, bool bTranspose=false, bool bAsLink=false, InsCellCmd eMoveMode=INS_NONE, InsertDeleteFlags nUndoExtraFlags=InsertDeleteFlags::NONE, bool bAllowDialogs=false)
bool InsertTable(const OUString &rName, SCTAB nTabNr, bool bRecord=true)
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
virtual void EnterListAction(const OUString &rComment, const OUString &rRepeatComment, sal_uInt16 nId, ViewShellId nViewShellId)
virtual void AddUndoAction(std::unique_ptr< SfxUndoAction > pAction, bool bTryMerg=false)
ViewShellDocId GetDocId() const override
static SAL_WARN_UNUSED_RESULT SfxViewShell * GetNext(const SfxViewShell &rPrev, bool bOnlyVisible=true, const std::function< bool(const SfxViewShell *)> &isViewShell=nullptr)
static SAL_WARN_UNUSED_RESULT SfxViewShell * GetFirst(bool bOnlyVisible=true, const std::function< bool(const SfxViewShell *)> &isViewShell=nullptr)
@ TOP_LEFT
top left cell of area
static OUString lcl_replaceMemberNameInSubtotal(const OUString &rSubtotal, std::u16string_view rMemberName)
static OUString lcl_MakePivotTabName(std::u16string_view rPrefix, SCTAB nNumber)
static void lcl_MoveToEnd(ScDPSaveDimension &rDim, const OUString &rItemName)
std::unique_ptr< ScDocument, o3tl::default_delete< ScDocument > > ScDocumentUniquePtr
std::unordered_set< OUString > ScDPUniqueStringSet
ScXMLEditAttributeMap::Entry const aEntries[]
@ AUTO
function is determined automatically.
constexpr OUStringLiteral aData
OUString ScResId(TranslateId aId)
constexpr TypedWhichId< SfxUInt32Item > ATTR_VALUE_FORMAT(146)
SC_DLLPUBLIC const ScQueryEntry & GetEntry(SCSIZE n) const
::std::vector< ScSortKeyState > maKeyState
bool bGroupActive[MAXSUBTOTAL]
active groups
bool bReplace
replace existing results
sal_Int32 SCCOLROW
a type capable of holding either SCCOL or SCROW
#define SC_UNO_DP_NUMBERFO