42#include <osl/diagnose.h>
44#include <viewfunc.hxx>
56#include <compiler.hxx>
74#include <charthelper.hxx>
79#include <tokenarray.hxx>
81#include <LibreOfficeKit/LibreOfficeKitEnums.h>
89#include <boost/property_tree/json_parser.hpp>
92#include <officecfg/Office/Calc.hxx>
95using ::editeng::SvxBorderLine;
99void collectUIInformation(std::map<OUString, OUString>&& aParameters,
const OUString& rAction)
102 aDescription.
aID =
"grid_window";
103 aDescription.
aAction = rAction;
105 aDescription.
aParent =
"MainWindow";
106 aDescription.
aKeyWord =
"ScGridWinUIObject";
113using ::std::unique_ptr;
124 if (aMarkedRows.empty())
127 aMarkedRows.emplace_back(nCurRow, nCurRow);
132 SCCOLROW nStart = aMarkedRows[0].mnStart;
150 bool bAnyChanged =
false;
151 for (
const SCTAB& nTab : *pMarkData)
153 bool bChanged =
false;
155 for (
const auto& rRow : aMarkedRows)
157 SCROW nStartNo = rRow.mnStart;
158 SCROW nEndNo = rRow.mnEnd;
165 bAnyChanged = bChanged =
true;
171 if ( bPaint && bChanged )
176 if ( bPaint && bAnyChanged )
185 true ,
false ,
false ,
207 sal_uInt16 nOldPixel = 0;
208 if (nStartRow == nEndRow)
219 bool bChanged = rDoc.
SetOptimalHeight(aCxt, nStartRow, nEndRow, nTab, bApi);
225 if (bChanged && ( nStartRow == nEndRow ))
227 sal_uInt16 nNewPixel =
static_cast<sal_uInt16
>(rDoc.
GetRowHeight(nStartRow,nTab) *
nPPTY);
228 if ( nNewPixel == nOldPixel )
241 true ,
false ,
false ,
279 ScAutoSum val = ScAutoSumNone;
285 case ocSum : val = ScAutoSumSum;
289 case ocMax : val = ScAutoSumMax;
291 case ocMin : val = ScAutoSumMin;
293 case ocCount : val = ScAutoSumCount;
295 case ocCount2 : val = ScAutoSumCountA;
299 case ocStDev : val = ScAutoSumStDev;
301 case ocStDevP : val = ScAutoSumStDevP;
303 case ocVar : val = ScAutoSumVar;
305 case ocVarP : val = ScAutoSumVarP;
315 return ScAutoSumData;
317 return ScAutoSumNone;
320#define SC_AUTOSUM_MAXCOUNT 20
333 return ScAutoSumNone;
340 return ScAutoSumNone;
344 rDoc, nCol, nRow, nTab, eDir, nExtend )) != ScAutoSumNone )
348 return ScAutoSumNone;
351#undef SC_AUTOSUM_MAXCOUNT
356 const SCROW nTmp = nRow;
357 ScAutoSum eSkip = ScAutoSumNone;
361 if (eSkip != ScAutoSumData || nRow <= nMinRow )
365 return eSkip >= ScAutoSumSum && nRow < nTmp;
371 const SCCOL nTmp = nCol;
372 ScAutoSum eSkip = ScAutoSumNone;
376 if (eSkip != ScAutoSumData || nCol <= nMinCol )
380 return eSkip >= ScAutoSumSum && nCol < nTmp;
387 if ( aStart.
Col() != aEnd.
Col() )
389 return ScAutoSumNone;
395 SCROW nStartRow = nEndRow;
399 if ( eSum >= ScAutoSumSum )
401 bool bContinue =
false;
404 rRangeList.
push_back(
ScRange( nCol, nStartRow, nTab, nCol, nEndRow, nTab ) );
405 nEndRow =
static_cast< SCROW >( nExtend );
411 }
while ( bContinue );
415 while ( nStartRow > aStart.
Row() )
418 if (eSum >= ScAutoSumSum )
422 rRangeList.
push_back(
ScRange( nCol, nStartRow, nTab, nCol, nEndRow, nTab ) );
423 if (eSum == ScAutoSumNone)
424 eSum = ScAutoSumData;
434 if ( aStart.
Row() != aEnd.
Row() )
436 return ScAutoSumNone;
442 SCCOL nStartCol = nEndCol;
446 if ( eSum >= ScAutoSumSum )
448 bool bContinue =
false;
451 rRangeList.
push_back(
ScRange( nStartCol, nRow, nTab, nEndCol, nRow, nTab ) );
452 nEndCol =
static_cast< SCCOL >( nExtend );
458 }
while ( bContinue );
462 while ( nStartCol > aStart.
Col() )
465 if (eSum >= ScAutoSumSum )
469 rRangeList.
push_back(
ScRange( nStartCol, nRow, nTab, nEndCol, nRow, nTab ) );
470 if (eSum == ScAutoSumNone)
471 eSum = ScAutoSumData;
482 case ocSum : val = 9;
486 case ocMax : val = 4;
488 case ocMin : val = 5;
500 case ocVar : val = 10;
518 SCCOL nStartCol = nCol;
519 SCROW nStartRow = nRow;
520 SCCOL nEndCol = nCol;
521 SCROW nEndRow = nRow;
522 SCCOL nSeekCol = nCol;
523 SCROW nSeekRow = nRow;
532 DIR_TOP, nExtend )) == ScAutoSumData )
534 DIR_LEFT, nExtend )) == ScAutoSumData )
541 DIR_LEFT, nExtend )) == ScAutoSumData )
555 nStartRow = nSeekRow;
556 if ( eSum >= ScAutoSumSum && eSum < ScAutoSumEnd )
563 nStartCol = nSeekCol;
564 if ( eSum >= ScAutoSumSum )
569 bool bContinue =
false;
572 if ( eSum == ScAutoSumData )
577 nStartRow-1, nTab,
DIR_TOP, nExtend ) == eSum )
583 nRow, nTab,
DIR_LEFT, nExtend ) == eSum )
588 ScRange( nStartCol, nStartRow, nTab, nEndCol, nEndRow, nTab ) );
589 if ( eSum >= ScAutoSumSum )
593 nEndRow =
static_cast< SCROW >( nExtend );
602 nEndCol =
static_cast< SCCOL >( nExtend );
610 }
while ( bContinue );
633 bool bRowData =
false;
634 for (
SCROW nRow = nStartRow; nRow <= nEndRow; ++nRow )
636 for (
SCCOL nCol = nStartCol; nCol <= nEndCol; ++nCol )
656 bool bColData =
false;
657 for (
SCCOL nCol = nStartCol; nCol <= nEndCol; ++nCol )
659 for (
SCROW nRow = nStartRow; nRow <= nEndRow; ++nRow )
678 const bool bEndRowEmpty = rDoc.
IsBlockEmpty( nStartCol, nEndRow, nEndCol, nEndRow, nTab );
679 const bool bEndColEmpty = rDoc.
IsBlockEmpty( nEndCol, nStartRow, nEndCol, nEndRow, nTab );
680 bool bRow = ( nStartRow != nEndRow ) && ( bEndRowEmpty || !bEndColEmpty );
681 bool bCol = ( nStartCol != nEndCol ) && ( bEndColEmpty || nStartRow == nEndRow );
684 SCROW nInsRow = nEndRow;
685 if ( bRow && !bEndRowEmpty )
687 if ( nInsRow < rDoc.
MaxRow() )
690 while ( !rDoc.
IsBlockEmpty( nStartCol, nInsRow, nEndCol, nInsRow, nTab ) )
692 if ( nInsRow < rDoc.
MaxRow() )
710 SCCOL nInsCol = nEndCol;
711 if ( bCol && !bEndColEmpty )
713 if ( nInsCol < rDoc.
MaxCol() )
716 while ( !rDoc.
IsBlockEmpty( nInsCol, nStartRow, nInsCol, nEndRow, nTab ) )
718 if ( nInsCol < rDoc.
MaxCol() )
735 if ( !bRow && !bCol )
740 SCCOL nMarkEndCol = nEndCol;
741 SCROW nMarkEndRow = nEndRow;
742 ScAutoSum eSum = ScAutoSumNone;
745 SCROW nColSumsStartRow = 0;
746 SCCOL nRowSumsStartCol = 0;
752 SCROW nSumEndRow = nEndRow;
766 for (
SCCOL nCol = nStartCol; nCol <= nEndCol; ++nCol )
768 if ( !rDoc.
IsBlockEmpty( nCol, nStartRow, nCol, nSumEndRow, nTab ) )
772 const ScRange aRange( nCol, rRange.
aStart.
Row(), nTab, nCol, nSumEndRow, nTab );
776 nRowSumsStartCol = aRangeList[0].aStart.Col();
778 aRangeList, bSubTotal,
ScAddress(nCol, nInsRow, nTab), eCode);
779 EnterData( nCol, nInsRow, nTab, aFormula );
789 SCCOL nSumEndCol = nEndCol;
803 for (
SCROW nRow = nStartRow; nRow <= nEndRow; ++nRow )
805 if ( !rDoc.
IsBlockEmpty( nStartCol, nRow, nSumEndCol, nRow, nTab ) )
809 const ScRange aRange( rRange.
aStart.
Col(), nRow, nTab, nSumEndCol, nRow, nTab );
813 nColSumsStartRow = aRangeList[0].aStart.Row();
815 EnterData( nInsCol, nRow, nTab, aFormula );
826 (eSum >= ScAutoSumSum ?
827 (nRowSums == 1 ? nRowSumsStartCol : nStartCol) :
829 (eSum >= ScAutoSumSum ?
830 (nColSums == 1 ? nColSumsStartRow : nStartRow) :
832 nTab, nMarkEndCol, nMarkEndRow, nTab );
833 MarkRange( aMarkRange,
false, bContinue );
857 if(!rRangeList.
empty())
860 size_t ListSize = aRangeList.
size();
861 for (
size_t i = 0;
i < ListSize; ++
i )
877 OUString aFormula =
aBuf.makeStringAndClear();
879 aBuf.append(aFormula);
880 return aBuf.makeStringAndClear();
914 OUString aNewStr = rString;
935 pInsDoc->ResetClip( &rDoc, nTab );
937 if (aNewStr[0] ==
'=')
940 pInsDoc->SetFormulaCell(aPos,
new ScFormulaCell(rDoc, aPos, aNewStr));
948 pInsDoc->SetString( nCol, nRow, nTab, aNewStr );
950 pInsDoc->SetClipArea(
ScRange(aPos) );
966 aPattern, nNewType );
985 if ( bSuccess && bSetModified )
1000 RemovePageBreak( bColumn, aCursor, bRecord, bSetModified );
1002 if ( bSuccess && bSetModified )
1016 pUndoDoc->InitUndo( rDoc, nTab, nTab,
true,
true );
1019 std::make_unique<ScUndoRemoveBreaks>( pDocSh, nTab, std::move(pUndoDoc) ) );
1046 const OUString* pRepCol,
const OUString* pRepRow,
1060 for (
const SCTAB& nTab : rMark)
1075 if ( !pPrint->isEmpty() )
1081 const OUString aToken = pPrint->getToken(0, sep,
nPos);
1099 for (
size_t i = 0,
n = pList->size();
i <
n; ++
i)
1111 if ( pRepCol->isEmpty() )
1122 if ( pRepRow->isEmpty() )
1138 pNewRanges->GetPrintRangesInfo(aJsonWriter);
1146 std::make_unique<ScUndoPrintRange>( pDocSh, nCurTab, std::move(pOldRanges), std::move(pNewRanges) ) );
1153 for (
const auto& rTab : rMark)
1157 rBindings.
Invalidate( SID_DELETE_PRINTAREA );
1210 if ( nStartCol == nEndCol && nStartRow == nEndRow )
1216 if ( rDoc.
HasAttrib( nStartCol, nStartRow, nStartTab, nEndCol, nEndRow, nEndTab,
1224 bool bAskDialog =
false;
1225 ScCellMergeOption aMergeOption(nStartCol, nStartRow, nEndCol, nEndRow, bCenter);
1226 for (
const SCTAB&
i : rMark)
1228 aMergeOption.
maTabs.insert(
i);
1242 if (nStartCol != aState.
mnCol1 || nStartRow != aState.
mnRow1)
1252 bool bEmptyMergedCells = officecfg::Office::Calc::Compatibility::MergeCells::EmptyMergedCells::get();
1256 bool bShowDialog = officecfg::Office::Calc::Compatibility::MergeCells::ShowDialog::get();
1257 if (!bApi && bShowDialog)
1260 sal_uInt16 nRetVal = aBox.
run();
1270 bEmptyMergedCells =
false;
1273 bEmptyMergedCells =
true;
1276 assert(!
"Unknown option for merge cells.");
1287 bOk = pDocSh->
GetDocFunc().
MergeCells( aMergeOption, rDoContents,
true, bApi, bEmptyMergedCells );
1301 collectUIInformation({{
"RANGE", aStartAddress +
":" + aEndAddress}},
"MERGE_CELLS");
1310 bool bMerged =
false;
1323 bool bExtended =
false;
1364 bool bExtended =
false;
1368 for (
const SCTAB&
i : rMark)
1392 collectUIInformation({{
"CELL", aCellLocation}},
"UNMERGE_CELL");
1435 ::std::numeric_limits<sal_uLong>::max());
1447 double fStart,
double fStep,
double fMax )
1455 FillSeries( aRange, &rMark, eDir, eCmd, eDateCmd,
1456 fStart, fStep, fMax,
false );
1473 ScRange aRange( nStartCol,nStartRow,nTab, nEndCol,nEndRow,nTab );
1474 ScRange aSourceRange( aRange );
1493 ScRange aChangeRange( aRange );
1511 aChangeRanges.
push_back( aChangeRange );
1529 if (
nCount == ::std::numeric_limits<sal_uLong>::max() )
1534 for (
SCCOL nColItr = nStartCol; nColItr <= nEndCol; ++nColItr )
1536 eCellType = pDoc->
GetCellType(nColItr, nStartRow, nTab);
1540 const std::vector<editeng::MisspellRanges>* pRanges = pWin->
GetAutoSpellData(nColItr, nStartRow);
1543 for (
SCROW nRowItr = nStartRow + 1; nRowItr <= nEndRow; ++nRowItr )
1548 for (
SCCOL nColItr = nStartCol; nColItr <= nEndCol; ++nColItr )
1550 eCellType = pDoc->
GetCellType(nColItr, nEndRow, nTab);
1554 const std::vector<editeng::MisspellRanges>* pRanges = pWin->
GetAutoSpellData(nColItr, nEndRow);
1557 for (
SCROW nRowItr = nEndRow - 1; nRowItr >= nStartRow; --nRowItr )
1562 for (
SCROW nRowItr = nStartRow; nRowItr <= nEndRow; ++nRowItr )
1564 eCellType = pDoc->
GetCellType(nStartCol, nRowItr, nTab);
1568 const std::vector<editeng::MisspellRanges>* pRanges = pWin->
GetAutoSpellData(nStartCol, nRowItr);
1571 for (
SCCOL nColItr = nStartCol + 1; nColItr <= nEndCol; ++nColItr )
1576 for (
SCROW nRowItr = nStartRow; nRowItr <= nEndRow; ++nRowItr )
1578 eCellType = pDoc->
GetCellType(nEndCol, nRowItr, nTab);
1582 const std::vector<editeng::MisspellRanges>* pRanges = pWin->
GetAutoSpellData(nEndCol, nRowItr);
1585 for (
SCCOL nColItr = nEndCol - 1; nColItr >= nStartCol; --nColItr )
1593 typedef const std::vector<editeng::MisspellRanges>* MisspellRangesType;
1594 SCROW nRowRepeatSize = nEndRow - nStartRow + 1;
1595 SCCOL nColRepeatSize = nEndCol - nStartCol + 1;
1598 std::vector<std::vector<MisspellRangesType>> aSourceSpellRanges(nRowRepeatSize, std::vector<MisspellRangesType>(nColRepeatSize,
nullptr));
1600 for (
SCROW nRowIdx = 0; nRowIdx < nRowRepeatSize; ++nRowIdx )
1602 for (
SCCOL nColIdx = 0; nColIdx < nColRepeatSize; ++nColIdx )
1604 eCellType = pDoc->
GetCellType(nStartCol + nColIdx, nStartRow + nRowIdx, nTab);
1608 aSourceSpellRanges[nRowIdx][nColIdx] = pWin->
GetAutoSpellData( nStartCol + nColIdx, nStartRow + nRowIdx );
1615 nTillRow = nEndRow +
nCount;
1616 for (
SCCOL nColItr = nStartCol; nColItr <= nEndCol; ++nColItr )
1618 for (
SCROW nRowItr = nEndRow + 1; nRowItr <= nTillRow; ++nRowItr )
1620 size_t nSourceRowIdx = ( nRowItr - nEndRow - 1 ) % nRowRepeatSize;
1621 MisspellRangesType pRanges = aSourceSpellRanges[nSourceRowIdx][nColItr - nStartCol];
1630 nTillRow = nStartRow -
nCount;
1631 for (
SCCOL nColItr = nStartCol; nColItr <= nEndCol; ++nColItr )
1633 for (
SCROW nRowItr = nStartRow - 1; nRowItr >= nTillRow; --nRowItr )
1635 size_t nSourceRowIdx = nRowRepeatSize - 1 - ( ( nStartRow - 1 - nRowItr ) % nRowRepeatSize );
1636 MisspellRangesType pRanges = aSourceSpellRanges[nSourceRowIdx][nColItr - nStartCol];
1645 nTillCol = nEndCol +
nCount;
1646 for (
SCCOL nColItr = nEndCol + 1; nColItr <= nTillCol; ++nColItr )
1648 size_t nSourceColIdx = ( nColItr - nEndCol - 1 ) % nColRepeatSize;
1649 for (
SCROW nRowItr = nStartRow; nRowItr <= nEndRow; ++nRowItr )
1651 MisspellRangesType pRanges = aSourceSpellRanges[nRowItr - nStartRow][nSourceColIdx];
1660 nTillCol = nStartCol -
nCount;
1661 for (
SCCOL nColItr = nStartCol - 1; nColItr >= nTillCol; --nColItr )
1663 size_t nSourceColIdx = nColRepeatSize - 1 - ( ( nStartCol - 1 - nColItr ) % nColRepeatSize );
1664 for (
SCROW nRowItr = nStartRow; nRowItr <= nEndRow; ++nRowItr )
1666 MisspellRangesType pRanges = aSourceSpellRanges[nRowItr - nStartRow][nSourceColIdx];
1711 pUndoDoc->InitUndo( rDoc, nTab, nTab );
1713 for (
const SCTAB&
i : rMark)
1716 pUndoDoc->AddUndoTab(
i,
i );
1724 rDoc.
FillTabMarked( nTab, rMark, nFlags, nFunction, bSkipEmpty, bAsLink );
1729 rDoc.
FillTab( aMarkRange, rMark, nFlags, nFunction, bSkipEmpty, bAsLink );
1735 std::make_unique<ScUndoFillTable>( pDocSh, rMark,
1738 std::move(pUndoDoc), bMulti, nTab, nFlags, nFunction, bSkipEmpty, bAsLink ) );
1774 if (nEndY >= rDoc.
MaxRow())
1779 if ( rDoc.
IsBlockEmpty( nStartX, nStartY, nEndX, nEndY, nTab ) )
1785 for (
SCCOL nCol = nStartX; nCol <= nEndX; ++nCol)
1787 if (rDoc.
HasData( nCol, nEndY + 1, nTab))
1790 SCROW nY = nEndY + 1;
1795 if (rDoc.
HasData( nCol, nY + 1, nTab))
1798 if (nOverWriteEndRow > nY)
1799 nOverWriteEndRow = nY;
1803 nOverWriteEndRow = nY;
1808 nOverWriteEndRow = 0;
1813 if (nOverWriteEndRow > nEndY)
1821 const bool bDataLeft = (nStartX > 0);
1822 if (!bDataLeft && nEndX >= rDoc.
MaxCol())
1831 SCCOL nMovX = (bDataLeft ? nStartX - 1 : nEndX + 1);
1832 SCROW nMovY = nStartY;
1833 bool bDataFound = (rDoc.
HasData( nMovX, nStartY, nTab) && rDoc.
HasData( nMovX, nStartY + 1, nTab));
1834 if (!bDataFound && bDataLeft && nEndX < rDoc.
MaxCol())
1837 bDataFound = (rDoc.
HasData( nMovX, nStartY, nTab) && rDoc.
HasData( nMovX, nStartY + 1, nTab));
1840 if (!(bDataFound && rDoc.
IsEmptyData( nStartX, nEndY + 1, nEndX, nEndY + 1, nTab )))
1846 for (
SCCOL nX = nStartX; nX <= nEndX; ++nX)
1848 SCROW nY = nEndY + 1;
1858 if (!rDoc.
HasData( nX, nY, nTab))
1916 if ( nEndCol-nStartCol >= 3 && nEndRow-nStartRow >= 3 )
1945 bool bAddUndo,
bool bIsApi )
1971 SCCOL nCol, nOldCol;
1972 SCROW nRow, nOldRow;
1973 SCTAB nTab, nOldTab;
1980 std::set<SCTAB> aOldSelectedTables;
1982 SCTAB nStartTab, nEndTab;
1987 std::set<SCTAB> aTmp(rMark.
begin(), rMark.
end());
1988 aOldSelectedTables.swap(aTmp);
1996 if ( nCommand == SvxSearchCmd::FIND
1997 || nCommand == SvxSearchCmd::FIND_ALL)
2003 std::unique_ptr<ScMarkData> pUndoMark;
2008 if ( nCommand == SvxSearchCmd::REPLACE_ALL )
2011 pUndoDoc->InitUndo( rDoc, nStartTab, nEndTab );
2017 for (
SCTAB j = nStartTab; j <= nEndTab; j++ )
2028 if ( nCol == 0 && nRow == 0 && nTab == nStartTab && !pSearchItem->
GetBackward() )
2031 bool bFound =
false;
2036 bool bMatchedRangesWereClamped =
false;
2037 if (rDoc.
SearchAndReplace(*pSearchItem, nCol, nRow, nTab, rMark, aMatchedRanges, aUndoStr, pUndoDoc.get(), bMatchedRangesWereClamped))
2043 std::make_unique<ScUndoReplace>(
GetViewData().GetDocShell(), *pUndoMark,
2045 aUndoStr, std::move(pUndoDoc), pSearchItem ) );
2048 if (nCommand == SvxSearchCmd::FIND_ALL || nCommand == SvxSearchCmd::REPLACE_ALL)
2055 pViewFrm->
ShowChildWindow(sc::SearchResultsDlgWrapper::GetChildWindowId());
2062 const bool bCellNotes = (pSearchItem->
GetCellType() == SvxSearchCellType::NOTE);
2065 const bool bEmptyCells = (!bCellNotes
2066 && ((nCommand == SvxSearchCmd::FIND_ALL
2068 || (nCommand == SvxSearchCmd::REPLACE_ALL
2070 pDlg->
FillResults(rDoc, aMatchedRanges, bCellNotes, bEmptyCells, bMatchedRangesWereClamped);
2076 for (
size_t i = 0,
n = aMatchedRanges.
size();
i <
n; ++
i)
2078 const ScRange& r = aMatchedRanges[
i];
2086 else if ( bFirst && (nCommand == SvxSearchCmd::FIND ||
2087 nCommand == SvxSearchCmd::REPLACE) )
2093 if ( nStartTab == nEndTab )
2111 if ( nCommand == SvxSearchCmd::FIND_ALL || nCommand == SvxSearchCmd::REPLACE_ALL )
2127 if (!aOldSelectedTables.empty())
2130 for (
SCTAB i = 0;
i <= nEndTab; ++
i)
2133 for (
const auto& rTab : aOldSelectedTables)
2141 if ( aOldSelectedTables.size() == 1 && nTab != nOldTab )
2171 if (pGridWindow && nCommand == SvxSearchCmd::FIND)
2181 std::vector<tools::Rectangle> aLogicRects;
2184 boost::property_tree::ptree aTree;
2185 aTree.put(
"searchString", pSearchItem->
GetSearchString().toUtf8().getStr());
2186 aTree.put(
"highlightAll", nCommand == SvxSearchCmd::FIND_ALL);
2188 boost::property_tree::ptree aSelections;
2191 boost::property_tree::ptree aSelection;
2192 aSelection.put(
"part", OString::number(nTab).getStr());
2193 aSelection.put(
"rectangles", rLogicRect.toString().getStr());
2194 aSelections.push_back(std::make_pair(
"", aSelection));
2196 aTree.add_child(
"searchResultSelection", aSelections);
2199 boost::property_tree::write_json(aStream, aTree);
2200 OString aPayload = aStream.str().c_str();
2209 if ( nCommand == SvxSearchCmd::REPLACE
2210 || nCommand == SvxSearchCmd::REPLACE_ALL )
2212 if ( nCommand == SvxSearchCmd::REPLACE )
2218 if ( nCol == nOldCol && nRow == nOldRow && nTab == nOldTab )
2222 aSearchItem.
SetWhich(SID_SEARCH_ITEM);
2225 bool bMatchedRangesWereClamped;
2227 if ( rDoc.
SearchAndReplace( aSearchItem, nCol, nRow, nTab, rMark, aMatchedRanges, aUndoStr,
nullptr, bMatchedRangesWereClamped ) &&
2228 ( nTab == nOldTab ) &&
2229 ( nCol != nOldCol || nRow != nOldRow ) )
2240 else if ( nCommand == SvxSearchCmd::FIND_ALL )
2257 ScEditableTester aTester( rDoc, nDestTab, nDestCol,nDestRow, nDestCol,nDestRow );
2264 OUString aTargetValStr;
2270 double nSolveResult;
2279 nDestCol, nDestRow, nDestTab,
2295 aMsgStr +=
ScResId( STR_MSSG_SOLVE_0 ) +
2301 aMsgStr =
ScResId( STR_MSSG_SOLVE_2 ) +
2308 VclMessageType::Question, VclButtonsType::YesNo, aMsgStr));
2309 xBox->set_title(
ScResId(STR_MSSG_DOSUBTOTALS_0));
2310 xBox->set_default_response(
RET_NO);
2312 EnterValue( nDestCol, nDestRow, nDestTab, nSolveResult );
2339 SCTAB nNewTab = pDocSh->
MakeScenario( nTab, rName, rComment, rColor, nFlags, rMark );
2397 SCTAB nCount,
bool bRecord )
2428 std::make_unique<ScUndoInsertTables>( pDocSh, nTab, std::move(aNames)));
2455 std::make_unique<ScUndoInsertTab>( pDocSh, nTab,
true, rName));
2477 SCTAB nNewTab = nTab;
2491 SCTAB nNewTab = nTab;
2494 while ( nNewTab > 0 && !rDoc.
IsVisible( nNewTab ) )
2502 for (
SCTAB aTab = 0; aTab < nSheets; ++aTab)
2505 bool bHasCodeName = rDoc.
GetCodeName( nTab + aTab, sCodeName );
2520 pSfxApp->Broadcast(
SfxHint( SfxHintId::ScTablesChanged ) );
2521 pSfxApp->Broadcast(
SfxHint( SfxHintId::ScDbAreasChanged ) );
2522 pSfxApp->Broadcast(
SfxHint( SfxHintId::ScAreaLinksChanged ) );
2530 SCTAB nNewTab = TheTabs.front();
2537 while ( nNewTab > 0 && !rDoc.
IsVisible( nNewTab ) )
2540 bool bWasLinked =
false;
2542 std::unique_ptr<ScRefUndoData> pUndoData;
2549 for(
size_t i=0;
i<TheTabs.size(); ++
i)
2553 pUndoDoc->InitUndo( rDoc, nTab,nTab,
true,
true );
2555 pUndoDoc->AddUndoTab( nTab,nTab,
true,
true );
2558 rDoc.
GetName( nTab, aOldName );
2559 pUndoDoc->RenameTab( nTab, aOldName );
2570 pUndoDoc->SetScenario( nTab,
true );
2575 pUndoDoc->SetScenarioData( nTab, aComment, aColor, nScenFlags );
2577 pUndoDoc->SetActiveScenario( nTab, bActive );
2579 pUndoDoc->SetVisible( nTab, rDoc.
IsVisible( nTab ) );
2582 pUndoDoc->SetSheetEvents( nTab, std::unique_ptr<ScSheetEvents>(pSheetEvents ?
new ScSheetEvents(*pSheetEvents) :
nullptr) );
2583 pUndoDoc->SetLayoutRTL( nTab, rDoc.
IsLayoutRTL( nTab ) );
2592 pUndoDoc->AddUndoTab( 0, nCount-1 );
2599 bool bDelDone =
false;
2601 for(
int i=TheTabs.size()-1; i>=0; --i)
2604 bool bHasCodeName = rDoc.
GetCodeName( TheTabs[i], sCodeName );
2608 if( bVbaEnabled && bHasCodeName )
2618 std::make_unique<ScUndoDeleteTab>(
GetViewData().GetDocShell(), TheTabs,
2619 std::move(pUndoDoc), std::move(pUndoData) ));
2639 pSfxApp->Broadcast(
SfxHint( SfxHintId::ScTablesChanged ) );
2640 pSfxApp->Broadcast(
SfxHint( SfxHintId::ScAreasChanged ) );
2641 pSfxApp->Broadcast(
SfxHint( SfxHintId::ScDbAreasChanged ) );
2642 pSfxApp->Broadcast(
SfxHint( SfxHintId::ScAreaLinksChanged ) );
2681 const OUString& rFilter,
const OUString& rOptions,
2682 const OUString& rSource )
2694 const OUString& rFilter,
const OUString& rOptions,
2695 std::u16string_view rTabName )
2697 OUString aFilterName = rFilter;
2698 OUString aOpt = rOptions;
2706 if (rTabName.empty())
2715 if ( aTemp == rTabName )
2736 bool bError =
false;
2746 SCTAB nInsCount = 0;
2762 SCTAB nSrcTab = pSrcTabs[
i];
2779 bRefs = bName =
true;
2790 OUString aFileName = pMed->
GetName();
2791 OUString aFilterName;
2793 aFilterName = pMed->
GetFilter()->GetFilterName();
2796 bool bWasThere = rDoc.
HasLink( aFileName, aFilterName, aOptions );
2800 for (
i=0;
i<nInsCount;
i++)
2802 rSrcDoc.
GetName( pSrcTabs[
i], aTabStr );
2804 aFileName, aFilterName, aOptions, aTabStr, nRefresh );
2810 pLink->SetInCreate(
true );
2813 pLink->SetInCreate(
false );
2823 std::make_unique<ScUndoImportTab>( pDocSh, nTab,
nCount ) );
2826 for (
i=0;
i<nInsCount;
i++)
2833 pSfxApp->Broadcast(
SfxHint( SfxHintId::ScTablesChanged ) );
2834 pSfxApp->Broadcast(
SfxHint( SfxHintId::ScAreasChanged ) );
2849 sal_uInt16 nDestDocNo,
SCTAB nDestTab,
bool bCopy,
const OUString* pNewTabName )
2856 bool bRename = pNewTabName && !pNewTabName->isEmpty();
2869 SID_OPENDOC, SfxCallMode::API|SfxCallMode::SYNCHRON,
2870 { &aItem, &aTarget });
2873 if (
auto pObjectItem =
dynamic_cast<const SfxObjectItem*
>(pRetItem) )
2874 pDestShell =
dynamic_cast<ScDocShell*
>( pObjectItem->GetShell() );
2875 else if (
auto pViewFrameItem =
dynamic_cast<const SfxViewFrameItem*
>( pRetItem) )
2890 OSL_FAIL(
"Destination document not found !!!");
2904 if (&rDestDoc != &rDoc)
2910 rDestDoc.
RenameTab( 0,
"______42_____" );
2916 vector<SCTAB> TheTabs;
2924 TheTabs.push_back(
i);
2925 for(
SCTAB j=
i+1;j<nTabCount;j++)
2930 TheTabs.push_back(j);
2943 if (!bNewDoc && bUndo)
2949 SCTAB nDestTab1=nDestTab;
2951 for(
size_t j=0; j<TheTabs.size(); ++j, ++nDestTab1 )
2955 aName = *pNewTabName;
2971 nDestTab1 = nDestTab;
2972 for(
SCTAB nTab : TheTabs)
2974 nErrVal = pDestShell->
TransferTab( *pDocShell, nTab, nDestTab1,
false,
false );
2978 if (!bNewDoc && bUndo)
2983 std::make_unique<ScUndoImportTab>( pDestShell, nDestTab,
2984 static_cast<SCTAB>(TheTabs.size())));
3018 if(nTabCount!=nTabSelCount)
3030 SCTAB nNumTabsInserted =
static_cast<SCTAB>(TheTabs.size());
3069 unique_ptr< vector<SCTAB> > pSrcTabs(
new vector<SCTAB>);
3070 unique_ptr< vector<SCTAB> > pDestTabs(
new vector<SCTAB>);
3071 unique_ptr< vector<OUString> > pTabNames(
new vector<OUString>);
3072 unique_ptr< vector<OUString> > pDestNames;
3073 pSrcTabs->reserve(nTabCount);
3074 pDestTabs->reserve(nTabCount);
3075 pTabNames->reserve(nTabCount);
3084 pTabNames->push_back(aTabName);
3086 for(
SCTAB j=
i+1;j<nTabCount;j++)
3091 pTabNames->push_back(aTabName);
3102 rDoc.
GetName( nDestTab, aDestName);
3103 SCTAB nDestTab1=nDestTab;
3105 for (
size_t j = 0,
n = pTabNames->size(); j <
n; ++j)
3108 const OUString& rStr = (*pTabNames)[j];
3113 if(!rDoc.
GetTable(aDestName,nDestTab1))
3115 nDestTab1=nTabCount;
3117 pDocShell->
MoveTable( nMovTab, nDestTab1, bCopy,
false );
3123 SCTAB nSrcTab = (nDestTab1 <= nMovTab) ? nMovTab + 1 : nMovTab;
3144 pSrcTabs->push_back(nMovTab);
3150 nDestTab1=nTabCount;
3154 pDestTabs->push_back(nDestTab1);
3160 pDestNames.reset(
new vector<OUString>);
3161 size_t n = pDestTabs->size();
3162 pDestNames->reserve(
n);
3163 for (
size_t j = 0; j <
n; ++j)
3165 SCTAB nRenameTab = (*pDestTabs)[j];
3166 OUString aTabName = *pNewTabName;
3168 pDestNames->push_back(aTabName);
3183 std::make_unique<ScUndoCopyTab>(
3184 pDocShell, std::move(pSrcTabs), std::move(pDestTabs), std::move(pDestNames)));
3189 std::make_unique<ScUndoMoveTab>(
3190 pDocShell, std::move(pSrcTabs), std::move(pDestTabs), std::move(pTabNames), std::move(pDestNames)));
3194 SCTAB nNewTab = nDestTab;
3197 else if (!bCopy && nTab<nDestTab)
3210 std::vector<SCTAB> undoTabs;
3215 for (
const OUString&
aName : rNames)
3225 undoTabs.push_back(
nPos);
3250 for (
SCTAB i=0;
i < nTabCount && nVisible <= nTabSelCount ;
i++ )
3254 if (nVisible <= nTabSelCount)
3257 std::vector<SCTAB> undoTabs;
3261 for (
const SCTAB& nTab : selectedTabs)
3271 undoTabs.push_back(nTab);
3275 if (nTabToSelect != -1)
3311 nScript = SvtScriptType::LATIN | SvtScriptType::ASIAN | SvtScriptType::COMPLEX;
3324 const SvxBorderLine* pDestLine,
3325 const SvxBorderLine* pSrcLine,
3328 if ( !(pSrcLine && pDestLine) )
3333 rLine.SetColor ( pSrcLine->GetColor() );
3334 rLine.SetBorderLineStyle(pDestLine->GetBorderLineStyle());
3335 rLine.SetWidth ( pDestLine->GetWidth() );
3339 rLine.SetColor ( pDestLine->GetColor() );
3340 rLine.SetBorderLineStyle(pSrcLine->GetBorderLineStyle());
3341 rLine.SetWidth ( pSrcLine->GetWidth() );
3345#define SET_LINE_ATTRIBUTES(LINE,BOXLINE) \
3346 pBoxLine = aBoxItem.Get##LINE(); \
3351 UpdateLineAttrs( aLine, pBoxLine, pLine, bColorOnly ); \
3352 aBoxItem.SetLine( &aLine, BOXLINE ); \
3355 aBoxItem.SetLine( nullptr, BOXLINE ); \
3362 bool bOnlyNotBecauseOfMatrix;
3363 if ( !
SelectionEditable( &bOnlyNotBecauseOfMatrix ) && !bOnlyNotBecauseOfMatrix )
3386 if( !((eItemState != SfxItemState::DEFAULT) || (eTLBRState != SfxItemState::DEFAULT) || (eBLTRState != SfxItemState::DEFAULT)) )
3390 if( (eItemState != SfxItemState::DONTCARE) && (eTLBRState != SfxItemState::DONTCARE) && (eBLTRState != SfxItemState::DONTCARE) )
3395 SvxBorderLine aLine;
3399 const SvxBorderLine* pBoxLine =
nullptr;
3409 aBoxInfoItem.
SetLine( aBoxItem.
GetTop(), SvxBoxInfoItemLine::HORI );
3410 aBoxInfoItem.
SetLine( aBoxItem.
GetLeft(), SvxBoxInfoItemLine::VERT );
3413 aOldSet.
Put( *pBorderAttr );
3414 aNewSet.
Put( aBoxItem );
3415 aNewSet.
Put( aBoxInfoItem );
3418 if( pTLBRItem &&
static_cast<const SvxLineItem*
>(pTLBRItem)->GetLine() )
3423 aOldSet.
Put( *pTLBRItem );
3424 aNewSet.
Put( aTLBRItem );
3427 if( pBLTRItem &&
static_cast<const SvxLineItem*
>(pBLTRItem)->GetLine() )
3432 aOldSet.
Put( *pBLTRItem );
3433 aNewSet.
Put( aBLTRItem );
3451 pDocSh->
PostPaint( nStartCol, nStartRow, nStartTab,
3452 nEndCol, nEndRow, nEndTab,
3459#undef SET_LINE_ATTRIBUTES
const SCTAB SC_TAB_APPEND
SfxApplication * SfxGetpApp()
@ Scenario
field button for datapilot
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, const ILibreOfficeKitNotifier *pNotifier=nullptr)
sal_uInt32 GetValue() const
OUString GetText(LineEnd eEnd=LINEEND_LF) const
void IncCol(SCCOL nDelta=1)
void IncRow(SCROW nDelta=1)
OUString GetColRowString() const
Create a human-readable string representation of the cell address.
static void AdjustRangesOfChartsOnDestinationPage(const ScDocument &rSrcDoc, ScDocument &rDestDoc, const SCTAB nSrcTab, const SCTAB nDestTab)
bool AutoFormat(const ScRange &rRange, const ScMarkData *pTabMark, sal_uInt16 nFormatNo, bool bApi)
bool UnmergeCells(const ScRange &rRange, bool bRecord, ScUndoRemoveMerge *pUndoRemoveMerge)
bool SetTabBgColor(SCTAB nTab, const Color &rColor, bool bRecord, bool bApi)
bool TabOp(const ScRange &rRange, const ScMarkData *pTabMark, const ScTabOpParam &rParam, bool bRecord, bool bApi)
SC_DLLPUBLIC bool MergeCells(const ScCellMergeOption &rOption, bool bContents, bool bRecord, bool bApi, bool bEmptyMergedCells=false)
void InsertAreaLink(const OUString &rFile, const OUString &rFilter, const OUString &rOptions, const OUString &rSource, const ScRange &rDestRange, sal_Int32 nRefreshDelaySeconds, bool bFitBlock, bool bApi)
void ConvertFormulaToValue(const ScRange &rRange, bool bInteraction)
bool DeleteTable(SCTAB nTab, bool bRecord)
bool FillSimple(const ScRange &rRange, const ScMarkData *pTabMark, FillDir eDir, bool bApi)
SCTAB MakeScenario(SCTAB nTab, const OUString &rName, const OUString &rComment, const Color &rColor, ScScenarioFlags nFlags, ScMarkData &rMark, bool bRecord=true)
bool AdjustPrintZoom(const ScRange &rRange)
void SetDocumentModified()
void UseScenario(SCTAB nTab, const OUString &rName, bool bRecord=true)
const ScDocument & GetDocument() const
ScDrawLayer * MakeDrawLayer()
ScTabViewShell * GetBestViewShell(bool bOnlyVisible=true)
void UpdateOle(const ScViewData &rViewData, bool bSnapSize=false)
void PostPaint(SCCOL nStartCol, SCROW nStartRow, SCTAB nStartTab, SCCOL nEndCol, SCROW nEndRow, SCTAB nEndTab, PaintPartFlags nPart, sal_uInt16 nExtFlags=0)
bool MoveTable(SCTAB nSrcTab, SCTAB nDestTab, bool bCopy, bool bRecord)
SfxPrinter * GetPrinter(bool bCreateIfNotExist=true)
static ScDocShell * GetShellByNum(sal_uInt16 nDocNo)
sal_uLong TransferTab(ScDocShell &rSrcDocShell, SCTAB nSrcPos, SCTAB nDestPos, bool bInsertNew, bool bNotifyAndPaint)
void SetPrintZoom(SCTAB nTab, sal_uInt16 nScale, sal_uInt16 nPages)
ScModelObj * GetModel() const
virtual SfxUndoManager * GetUndoManager() override
void UpdateLinks() override
static OUString GetOptions(const SfxMedium &rMedium)
ScDocShell * GetDocShell()
SC_DLLPUBLIC bool InsertTab(SCTAB nPos, const OUString &rName, bool bExternalDocument=false, bool bUndoDeleteTab=false)
SC_DLLPUBLIC bool IsScenario(SCTAB nTab) const
SC_DLLPUBLIC SfxItemPool * GetEnginePool() const
ScSheetLimits & GetSheetLimits() const
SC_DLLPUBLIC sal_uInt16 GetRowHeight(SCROW nRow, SCTAB nTab, bool bHiddenAsZero=true) const
sc::MultiDataCellState HasMultipleDataCells(const ScRange &rRange) const
Check if the specified range contains either: 1) one non-empty cell, 2) more than one non-empty cells...
void GetAutoFormatData(SCTAB nTab, SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, ScAutoFormatData &rData)
SC_DLLPUBLIC void CreateValidTabNames(std::vector< OUString > &aNames, SCTAB nCount) const
SC_DLLPUBLIC OUString GetLinkTab(SCTAB nTab) const
SC_DLLPUBLIC const ScTableProtection * GetTabProtection(SCTAB nTab) const
void UpdatePageBreaks(SCTAB nTab, const ScRange *pUserArea=nullptr)
SC_DLLPUBLIC bool ExtendMerge(SCCOL nStartCol, SCROW nStartRow, SCCOL &rEndCol, SCROW &rEndRow, SCTAB nTab, bool bRefresh=false)
SC_DLLPUBLIC void UpdateChartListenerCollection()
SC_DLLPUBLIC bool InsertTabs(SCTAB nPos, const std::vector< OUString > &rNames, bool bNamesValid=false)
SC_DLLPUBLIC Color GetTabBgColor(SCTAB nTab) const
SC_DLLPUBLIC bool GetTable(const OUString &rName, SCTAB &rTab) const
bool HasStringWeakCharacters(const OUString &rString)
SC_DLLPUBLIC bool IsTabProtected(SCTAB nTab) const
SC_DLLPUBLIC SCCOL MaxCol() const
SC_DLLPUBLIC void SetScenarioData(SCTAB nTab, const OUString &rComment, const Color &rColor, ScScenarioFlags nFlags)
SC_DLLPUBLIC bool RenameTab(SCTAB nTab, const OUString &rName, bool bExternalDocument=false)
const ScSheetEvents * GetSheetEvents(SCTAB nTab) const
OUString GetLinkOpt(SCTAB nTab) const
SC_DLLPUBLIC bool SetOptimalHeight(sc::RowHeightContext &rCxt, SCROW nStartRow, SCROW nEndRow, SCTAB nTab, bool bApi)
SC_DLLPUBLIC void AddPrintRange(SCTAB nTab, const ScRange &rNew)
Adds a new print ranges.
void FillTabMarked(SCTAB nSrcTab, const ScMarkData &rMark, InsertDeleteFlags nFlags, ScPasteFunc nFunction, bool bSkipEmpty, bool bAsLink)
SC_DLLPUBLIC ScDocumentPool * GetPool()
void GetSearchAndReplaceStart(const SvxSearchItem &rSearchItem, SCCOL &rCol, SCROW &rRow)
SC_DLLPUBLIC formula::FormulaGrammar::AddressConvention GetAddressConvention() const
SC_DLLPUBLIC SCROW MaxRow() const
SC_DLLPUBLIC void ClearPrintRanges(SCTAB nTab)
Removes all print ranges.
bool HasLink(std::u16string_view rDoc, std::u16string_view rFilter, std::u16string_view rOptions) const
bool Solver(SCCOL nFCol, SCROW nFRow, SCTAB nFTab, SCCOL nVCol, SCROW nVRow, SCTAB nVTab, const OUString &sValStr, double &nX)
(Goal Seek) Find a value of x that is a root of f(x)
SC_DLLPUBLIC void SetPrintEntireSheet(SCTAB nTab)
Marks the specified sheet to be printed completely.
SC_DLLPUBLIC SvtScriptType GetStringScriptType(const OUString &rString)
SC_DLLPUBLIC void GetScenarioData(SCTAB nTab, OUString &rComment, Color &rColor, ScScenarioFlags &rFlags) const
void FillTab(const ScRange &rSrcArea, const ScMarkData &rMark, InsertDeleteFlags nFlags, ScPasteFunc nFunction, bool bSkipEmpty, bool bAsLink)
SC_DLLPUBLIC SfxItemPool * GetEditPool() const
void ApplySelectionLineStyle(const ScMarkData &rMark, const ::editeng::SvxBorderLine *pLine, bool bColorOnly)
SC_DLLPUBLIC bool HasData(SCCOL nCol, SCROW nRow, SCTAB nTab)
SC_DLLPUBLIC void SetDrawPageSize(SCTAB nTab)
SC_DLLPUBLIC ScDrawLayer * GetDrawLayer()
SC_DLLPUBLIC void CreateValidTabName(OUString &rName) const
SC_DLLPUBLIC void SetRepeatRowRange(SCTAB nTab, std::optional< ScRange > oNew)
SC_DLLPUBLIC ScLinkMode GetLinkMode(SCTAB nTab) const
SC_DLLPUBLIC bool HasAttrib(SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2, SCROW nRow2, SCTAB nTab2, HasAttrFlags nMask) const
SC_DLLPUBLIC formula::FormulaGrammar::Grammar GetGrammar() const
void UpdateScriptTypes(const ScAddress &rPos, SCCOL nColSize, SCROW nRowSize)
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 void ApplyPatternIfNumberformatIncompatible(const ScRange &rRange, const ScMarkData &rMark, const ScPatternAttr &rPattern, SvNumFormatType nNewType)
void FindAreaPos(SCCOL &rCol, SCROW &rRow, SCTAB nTab, ScMoveDirection eDirection) const
const OUString & GetCodeName() const
SC_DLLPUBLIC sal_uLong AddValidationEntry(const ScValidationData &rNew)
SC_DLLPUBLIC void ExtendOverlapped(SCCOL &rStartCol, SCROW &rStartRow, SCCOL nEndCol, SCROW nEndRow, SCTAB nTab) const
sal_uLong GetLinkRefreshDelay(SCTAB nTab) const
void SetLink(SCTAB nTab, ScLinkMode nMode, const OUString &rDoc, const OUString &rFilter, const OUString &rOptions, const OUString &rTabName, sal_uLong nRefreshDelay)
SC_DLLPUBLIC SvNumberFormatter * GetFormatTable() const
SC_DLLPUBLIC void SetActiveScenario(SCTAB nTab, bool bActive)
bool SearchAndReplace(const SvxSearchItem &rSearchItem, SCCOL &rCol, SCROW &rRow, SCTAB &rTab, const ScMarkData &rMark, ScRangeList &rMatchedRanges, OUString &rUndoStr, ScDocument *pUndoDoc, bool &bMatchedRangesWereClamped)
std::unique_ptr< ScPrintRangeSaver > CreatePrintRangeSaver() const
SC_DLLPUBLIC bool IsEmptyData(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, SCTAB nTab) const
static bool IsEmptyCellSearch(const SvxSearchItem &rSearchItem)
SC_DLLPUBLIC bool IsVisible(SCTAB nTab) const
SC_DLLPUBLIC OUString GetLinkDoc(SCTAB nTab) const
bool IsLinked(SCTAB nTab) const
SC_DLLPUBLIC CellType GetCellType(SCCOL nCol, SCROW nRow, SCTAB nTab) const
SC_DLLPUBLIC bool IsLayoutRTL(SCTAB nTab) const
bool IsBlockEmpty(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, SCTAB nTab) const
SC_DLLPUBLIC bool DeleteTab(SCTAB nTab)
SC_DLLPUBLIC void SetRepeatColRange(SCTAB nTab, std::optional< ScRange > oNew)
SC_DLLPUBLIC bool DeleteTabs(SCTAB nTab, SCTAB nSheets)
SC_DLLPUBLIC sfx2::LinkManager * GetLinkManager()
bool IsUndoEnabled() const
SC_DLLPUBLIC bool GetName(SCTAB nTab, OUString &rName) const
OUString GetLinkFlt(SCTAB nTab) const
void SetClipParam(const ScClipParam &rParam)
SC_DLLPUBLIC void SetScenario(SCTAB nTab, bool bFlag)
void RemoveManualBreaks(SCTAB nTab)
bool IsChartListenerCollectionNeedsUpdate() const
SC_DLLPUBLIC const ScPatternAttr * GetPattern(SCCOL nCol, SCROW nRow, SCTAB nTab) const
SC_DLLPUBLIC const ScDocOptions & GetDocOptions() const
SC_DLLPUBLIC void SetVisible(SCTAB nTab, bool bVisible)
SC_DLLPUBLIC bool IsActiveScenario(SCTAB nTab) const
SC_DLLPUBLIC SCTAB GetTableCount() const
void SetTextCurrentDefaults(const EditTextObject &rTextObject)
SetText and apply defaults already set.
TranslateId GetMessageId() const
static SC_DLLPUBLIC const SvxSearchItem & GetSearchItem()
const std::vector< editeng::MisspellRanges > * GetAutoSpellData(SCCOL nPosX, SCROW nPosY)
void SetCellSelectionPixel(int nType, int nPixelX, int nPixelY)
Update the cell selection according to what handles have been dragged.
void ResetAutoSpellForContentChange()
void GetCellSelection(std::vector< tools::Rectangle > &rLogicRects)
Get the cell selection, coordinates are in logic units.
void SetAutoSpellData(SCCOL nPosX, SCROW nPosY, const std::vector< editeng::MisspellRanges > *pRanges)
bool InsideVisibleRange(SCCOL nPosX, SCROW nPosY)
todo: It should be possible to have MarkArrays for each table, in order to enable "search all" across...
const_iterator end() const
const ScRange & GetMultiMarkArea() const
void SelectTable(SCTAB nTab, bool bNew)
const ScRange & GetMarkArea() const
SCTAB GetFirstSelected() const
bool IsMultiMarked() const
void FillRangeListWithMarks(ScRangeList *pList, bool bClear, SCTAB nForTab=-1) const
Create a range list of marks.
SCTAB GetLastSelected() const
bool GetTableSelect(SCTAB nTab) const
std::set< SCTAB > MarkedTabsType
void SetMultiMarkArea(const ScRange &rRange, bool bMark=true, bool bSetupMulti=false)
SCTAB GetSelectCount() const
void SetMarkArea(const ScRange &rRange)
const MarkedTabsType & GetSelectedTabs() const
const_iterator begin() const
std::vector< sc::ColRowSpan > GetMarkedRowSpans() const
ScMergeCellsOption GetMergeCellsOption() const
sal_uInt32 GetNumberFormat(SvNumberFormatter *) const
SfxItemSet & GetItemSet()
void push_back(const ScRange &rRange)
ScRefFlags ParseAny(const OUString &, const ScDocument &, const ScAddress::Details &rDetails=ScAddress::detailsOOOa1)
OutputDevice * GetDevice() const
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.
void UpdateInputHandler(bool bForce=false, bool bStopEditing=true)
bool TabKeyInput(const KeyEvent &rKEvt)
void UpdatePageBreakData(bool bForcePaint=false)
void TabChanged(bool bSameTabButMoved=false)
Called after moving, copying, inserting or deleting a sheet.
void AlignToCursor(SCCOL nCurX, SCROW nCurY, ScFollowMode eMode, const ScSplitPos *pWhich=nullptr)
void DoneBlockMode(bool bContinue=false)
void ErrorMessage(TranslateId pGlobStrId)
void MarkRange(const ScRange &rRange, bool bSetCursor=true, bool bContinue=false)
vcl::Window * GetFrameWin() const
void PaintArea(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, ScUpdateMode eMode=ScUpdateMode::All)
static void UpdateInputLine()
ScViewData & GetViewData()
ScGridWindow * GetActiveWin()
SC_DLLPUBLIC void SetCursor(SCCOL nPosX, SCROW nPosY, bool bNew=false)
SC_DLLPUBLIC void CellContentChanged()
ScDrawView * GetScDrawView()
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)
static void UpdateSearchItemAddressForReplace(const SvxSearchItem &rSearchItem, SCCOL &rCol, SCROW &rRow)
Replace behaves differently to the Search; adjust the rCol and rRow accordingly.
virtual formula::FormulaToken * AddOpCode(OpCode eCode) override
formula::FormulaToken * AddDoubleReference(const ScComplexRefData &rRef)
bool GetAdjacentExtendOfOuterFuncRefs(SCCOLROW &nExtend, const ScAddress &rPos, ScDirection)
Determines the extent of direct adjacent references.
SfxDispatcher & GetDispatcher()
const ScViewOptions & GetOptions() const
ScMarkData & GetMarkData()
const Fraction & GetZoomY() const
void InsertTab(SCTAB nTab)
ScDocument & GetDocument() const
ScDocShell * GetDocShell() const
ScGridWindow * GetActiveWin()
void GetPosFromPixel(tools::Long nClickX, tools::Long nClickY, ScSplitPos eWhich, SCCOL &rPosX, SCROW &rPosY, bool bTestMerge=true, bool bRepair=false, SCTAB nForTab=-1)
ScTabViewShell * GetViewShell() const
ScMarkType GetSimpleArea(SCCOL &rStartCol, SCROW &rStartRow, SCTAB &rStartTab, SCCOL &rEndCol, SCROW &rEndRow, SCTAB &rEndTab) const
Point GetScrPos(SCCOL nWhereX, SCROW nWhereY, ScSplitPos eWhich, bool bAllowNeg=false, SCTAB nForTab=-1) const
const Fraction & GetZoomX() const
ScAddress GetCurPos() const
SfxBindings & GetBindings()
bool AutoSum(const ScRange &rRange, bool bSubTotal, bool bSetCursor, bool bContinue, const OpCode eCode)
void TabOp(const ScTabOpParam &rParam, bool bRecord=true)
bool SelectionEditable(bool *pOnlyNotBecauseOfMatrix=nullptr)
bool AppendTable(const OUString &rName, bool bRecord=true)
bool GetAutoSumArea(ScRangeList &rRangeList)
void RemoveManualBreaks()
void FillTab(InsertDeleteFlags nFlags, ScPasteFunc nFunction, bool bSkipEmpty, bool bAsLink)
SC_DLLPUBLIC void FillSimple(FillDir eDir)
void EnterData(SCCOL nCol, SCROW nRow, SCTAB nTab, const OUString &rString, const EditTextObject *pData=nullptr, bool bMatrixExpand=false)
SC_DLLPUBLIC void DeletePageBreak(bool bColumn, bool bRecord=true, const ScAddress *pPos=nullptr, bool bSetModified=true)
void ApplyUserItemSet(const SfxItemSet &rItemSet)
void SetPrintRanges(bool bEntireSheet, const OUString *pPrint, const OUString *pRepCol, const OUString *pRepRow, bool bAddPrint)
void FillSeries(FillDir eDir, FillCmd eCmd, FillDateCmd eDateCmd, double fStart, double fStep, double fMax)
void TransliterateText(TransliterationFlags nType)
void CopyAutoSpellData(FillDir eDir, SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, sal_uLong nCount)
void EnterAutoSum(const ScRangeList &rRangeList, bool bSubTotal, const ScAddress &rAddr, const OpCode eCode)
void SetSelectionFrameLines(const ::editeng::SvxBorderLine *pLine, bool bColorOnly)
void SetPrintZoom(sal_uInt16 nScale)
SC_DLLPUBLIC void InsertPageBreak(bool bColumn, bool bRecord=true, const ScAddress *pPos=nullptr, bool bSetModified=true)
bool DeleteTables(const std::vector< SCTAB > &TheTabs, bool bRecord=true)
void InsertAreaLink(const OUString &rFile, const OUString &rFilter, const OUString &rOptions, const OUString &rSource)
void EnterValue(SCCOL nCol, SCROW nRow, SCTAB nTab, const double &rValue)
bool SetTabBgColor(const Color &rColor, SCTAB nTabNr)
void ApplySelectionPattern(const ScPatternAttr &rAttr, bool bCursorOnly=false)
void FillCrossDblClick()
Downward fill of selected cell(s) by double-clicking cross-hair cursor.
SC_DLLPUBLIC void FillAuto(FillDir eDir, SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, sal_uLong nCount)
void DeleteTable(SCTAB nTabNr, bool bRecord=true)
SC_DLLPUBLIC const ScPatternAttr * GetSelectionPattern()
void MakeScenario(const OUString &rName, const OUString &rComment, const Color &rColor, ScScenarioFlags nFlags)
ScAutoFormatData * CreateAutoFormatData()
void ImportTables(ScDocShell *pSrcShell, SCTAB nCount, const SCTAB *pSrcTabs, bool bLink, SCTAB nTab)
void HideTable(const ScMarkData &rMark, SCTAB nTabToSelect=-1)
bool MergeCells(bool bApi, bool &rDoContents, bool bCenter)
bool AdjustBlockHeight(bool bPaint=true, ScMarkData *pMarkData=nullptr)
void ShowTable(const std::vector< OUString > &rNames)
void Solve(const ScSolveParam &rParam)
void AutoFormat(sal_uInt16 nFormatNo)
void MoveTable(sal_uInt16 nDestDocNo, SCTAB nDestTab, bool bCopy, const OUString *pNewTabName=nullptr)
void InsertSpecialChar(const OUString &rStr, const vcl::Font &rFont)
static void UpdateLineAttrs(::editeng::SvxBorderLine &rLine, const ::editeng::SvxBorderLine *pDestLine, const ::editeng::SvxBorderLine *pSrcLine, bool bColor)
void EnterBlock(const OUString &rString, const EditTextObject *pData)
void InsertTables(std::vector< OUString > &aNames, SCTAB nTab, SCTAB nCount, bool bRecord=true)
void ApplyAttr(const SfxPoolItem &rAttrItem, bool bAdjustBlockHeight=true)
bool RenameTable(const OUString &rName, SCTAB nTabNr)
void OnLOKSetWidthOrHeight(SCCOLROW nStart, bool bWidth)
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 SearchAndReplace(const SvxSearchItem *pSearchItem, bool bAddUndo, bool bIsApi)
void ApplyAttributes(const SfxItemSet *pDialogSet, const SfxItemSet *pOldSet, bool bAdjustBlockHeight=true)
void InsertTableLink(const OUString &rFile, const OUString &rFilter, const OUString &rOptions, std::u16string_view rTabName)
void ConvertFormulaToValue()
bool InsertTable(const OUString &rName, SCTAB nTabNr, bool bRecord=true)
OUString GetAutoSumFormula(const ScRangeList &rRangeList, bool bSubTotal, const ScAddress &rAddr, const OpCode eCode)
void SetValidation(const ScValidationData &rNew)
void UseScenario(const OUString &rName)
bool AdjustRowHeight(SCROW nStartRow, SCROW nEndRow, bool bApi)
bool GetOption(ScViewOption eOpt) const
static void UnmarkFiltered(ScMarkData &rMark, const ScDocument &rDoc)
virtual void ClearPageView() override
void Invalidate(sal_uInt16 nId)
std::shared_ptr< SfxDialogController > & GetController()
const SfxPoolItem * ExecuteList(sal_uInt16 nSlot, SfxCallMode nCall, std::initializer_list< SfxPoolItem const * > args, std::initializer_list< SfxPoolItem const * > internalargs=std::initializer_list< SfxPoolItem const * >())
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const std::shared_ptr< const SfxFilter > & GetFilter() const
const OUString & GetName() const
SfxMedium * GetMedium() const
void SetWhich(sal_uInt16 nId)
SfxItemPool & GetPool() const
virtual void AddUndoAction(std::unique_ptr< SfxUndoAction > pAction, bool bTryMerg=false)
static SAL_WARN_UNUSED_RESULT SfxViewFrame * Current()
SfxChildWindow * GetChildWindow(sal_uInt16)
SfxFrame & GetFrame() const
virtual SfxObjectShell * GetObjectShell() override
void ShowChildWindow(sal_uInt16, bool bVisible=true)
void setTiledSearching(bool bTiledSearching)
virtual void libreOfficeKitViewCallback(int nType, const char *pPayload) const override
void SetLine(const editeng::SvxBorderLine *pNew, SvxBoxInfoItemLine nLine)
const editeng::SvxBorderLine * GetTop() const
const editeng::SvxBorderLine * GetLeft() const
const editeng::SvxBorderLine * GetLine() const
void SetLine(const editeng::SvxBorderLine *pNew)
void PutItemForScriptType(SvtScriptType nScriptType, const SfxPoolItem &rItem)
static void SetSearchLabel(const SearchLabel &rSL)
bool HasStartPoint() const
const OUString & GetSearchString() const
SvxSearchCmd GetCommand() const
const OUString & GetReplaceString() const
void SetCommand(SvxSearchCmd nNewCommand)
SvxSearchCellType GetCellType() const
sal_Int32 GetStartPointX() const
sal_Int32 GetStartPointY() const
static UITestLogger & getInstance()
void logEvent(const EventDescription &rDescription)
void FillResults(ScDocument &rDoc, const ScRangeList &rMatchedRanges, bool bCellNotes, bool bEmptyCells, bool bMatchedRangesWereClamped)
void InsertFileLink(sfx2::SvBaseLink &, SvBaseLinkObjectType nFileType, std::u16string_view rFileNm, const OUString *pFilterNm=nullptr, const OUString *pRange=nullptr)
FontFamily GetFamilyType()
const OUString & GetStyleName() const
const OUString & GetFamilyName() const
rtl_TextEncoding GetCharSet() const
void VBA_DeleteModule(ScDocShell &rDocSh, const OUString &sModuleName)
std::unique_ptr< ScDocument, o3tl::default_delete< ScDocument > > ScDocumentUniquePtr
constexpr OUStringLiteral STRING_SCAPP
@ ATTRIB
Internal use only (d&d undo): do not delete caption objects of cell notes.
@ EmptyContentHiddenCells
std::unique_ptr< sal_Int32[]> pData
void NotifyIfChangesListeners(const ScDocShell &rDocShell, const ScRange &rRange, const OUString &rType=OUString("cell-change"))
void Notify(ScModelObj &rModelObj, const ScRangeList &rChangeRanges, const OUString &rType=OUString("cell-change"), const css::uno::Sequence< css::beans::PropertyValue > &rProperties=css::uno::Sequence< css::beans::PropertyValue >())
bool getMustPropagateChangesModel(ScModelObj *pModelObj)
OUString ScResId(TranslateId aId)
constexpr TypedWhichId< SvxLineItem > ATTR_BORDER_TLBR(141)
constexpr TypedWhichId< SvxBoxInfoItem > ATTR_BORDER_INNER(151)
constexpr TypedWhichId< SvxBoxItem > ATTR_BORDER(150)
constexpr TypedWhichId< SfxUInt32Item > ATTR_VALUE_FORMAT(146)
constexpr TypedWhichId< SvxLineItem > ATTR_BORDER_BLTR(142)
constexpr TypedWhichId< SvxFontItem > ATTR_FONT(100)
constexpr TypedWhichId< SfxUInt32Item > ATTR_VALIDDATA(153)
std::map< OUString, OUString > aParameters
ScRange getSingleRange(SCTAB nTab) const
::std::set< SCTAB > maTabs
ScRange getFirstSingleRange() const
This struct stores general clipboard parameters associated with a ScDocument instance created in clip...
Complex reference (a range) into the sheet.
void InitRangeRel(const ScDocument &rDoc, const ScRange &rRange, const ScAddress &rPos)
This is very similar to ScCellValue, except that it references the original value instead of copying ...
ScFormulaCell * getFormula() const
SCCOL GetMaxColCount() const
ScAddress aRefVariableCell
std::optional< OUString > pStrTargetVal
ScAddress aRefFormulaCell
Parameter for data table aka multiple operations.
::std::vector< ScUndoTabColorInfo > List
sal_Int32 SCCOLROW
a type capable of holding either SCCOL or SCROW
static ScAutoSum lcl_IsAutoSumData(ScDocument &rDoc, SCCOL nCol, SCROW nRow, SCTAB nTab, ScDirection eDir, SCCOLROW &nExtend)
static sal_Int8 GetSubTotal(const OpCode eCode)
#define SET_LINE_ATTRIBUTES(LINE, BOXLINE)
static bool lcl_extendMergeRange(ScCellMergeOption &rOption, const ScRange &rRange)
static bool lcl_FindNextSumEntryInColumn(ScDocument &rDoc, SCCOL nCol, SCROW &nRow, SCTAB nTab, SCCOLROW &nExtend, SCROW nMinRow)
#define SC_AUTOSUM_MAXCOUNT
static ScAutoSum lcl_SeekAutoSumData(ScDocument &rDoc, SCCOL &nCol, SCROW &nRow, SCTAB nTab, ScDirection eDir, SCCOLROW &nExtend)
static bool lcl_FindNextSumEntryInRow(ScDocument &rDoc, SCCOL &nCol, SCROW nRow, SCTAB nTab, SCCOLROW &nExtend, SCCOL nMinCol)
static ScAutoSum lcl_GetAutoSumForColumnRange(ScDocument &rDoc, ScRangeList &rRangeList, const ScRange &rRange)
static ScAutoSum lcl_GetAutoSumForRowRange(ScDocument &rDoc, ScRangeList &rRangeList, const ScRange &rRange)