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 )
878 return aBuf.makeStringAndClear();
912 OUString aNewStr = rString;
933 pInsDoc->ResetClip( &rDoc, nTab );
935 if (aNewStr[0] ==
'=')
938 pInsDoc->SetFormulaCell(aPos,
new ScFormulaCell(rDoc, aPos, aNewStr));
946 pInsDoc->SetString( nCol, nRow, nTab, aNewStr );
948 pInsDoc->SetClipArea(
ScRange(aPos) );
964 aPattern, nNewType );
983 if ( bSuccess && bSetModified )
998 RemovePageBreak( bColumn, aCursor, bRecord, bSetModified );
1000 if ( bSuccess && bSetModified )
1014 pUndoDoc->InitUndo( rDoc, nTab, nTab,
true,
true );
1017 std::make_unique<ScUndoRemoveBreaks>( pDocSh, nTab, std::move(pUndoDoc) ) );
1044 const OUString* pRepCol,
const OUString* pRepRow,
1058 for (
const SCTAB& nTab : rMark)
1073 if ( !pPrint->isEmpty() )
1079 const OUString aToken = pPrint->getToken(0, sep,
nPos);
1097 for (
size_t i = 0,
n = pList->size();
i <
n; ++
i)
1109 if ( pRepCol->isEmpty() )
1120 if ( pRepRow->isEmpty() )
1136 pNewRanges->GetPrintRangesInfo(aJsonWriter);
1144 std::make_unique<ScUndoPrintRange>( pDocSh, nCurTab, std::move(pOldRanges), std::move(pNewRanges) ) );
1151 for (
const auto& rTab : rMark)
1155 rBindings.
Invalidate( SID_DELETE_PRINTAREA );
1208 if ( nStartCol == nEndCol && nStartRow == nEndRow )
1214 if ( rDoc.
HasAttrib( nStartCol, nStartRow, nStartTab, nEndCol, nEndRow, nEndTab,
1222 bool bAskDialog =
false;
1223 ScCellMergeOption aMergeOption(nStartCol, nStartRow, nEndCol, nEndRow, bCenter);
1224 for (
const SCTAB&
i : rMark)
1226 aMergeOption.
maTabs.insert(
i);
1240 if (nStartCol != aState.
mnCol1 || nStartRow != aState.
mnRow1)
1250 bool bEmptyMergedCells = officecfg::Office::Calc::Compatibility::MergeCells::EmptyMergedCells::get();
1254 bool bShowDialog = officecfg::Office::Calc::Compatibility::MergeCells::ShowDialog::get();
1255 if (!bApi && bShowDialog)
1258 sal_uInt16 nRetVal = aBox.
run();
1268 bEmptyMergedCells =
false;
1271 bEmptyMergedCells =
true;
1274 assert(!
"Unknown option for merge cells.");
1285 bOk = pDocSh->
GetDocFunc().
MergeCells( aMergeOption, rDoContents,
true, bApi, bEmptyMergedCells );
1299 collectUIInformation({{
"RANGE", aStartAddress +
":" + aEndAddress}},
"MERGE_CELLS");
1308 bool bMerged =
false;
1321 bool bExtended =
false;
1362 bool bExtended =
false;
1366 for (
const SCTAB&
i : rMark)
1390 collectUIInformation({{
"CELL", aCellLocation}},
"UNMERGE_CELL");
1433 ::std::numeric_limits<sal_uLong>::max());
1445 double fStart,
double fStep,
double fMax )
1453 FillSeries( aRange, &rMark, eDir, eCmd, eDateCmd,
1454 fStart, fStep, fMax,
false );
1471 ScRange aRange( nStartCol,nStartRow,nTab, nEndCol,nEndRow,nTab );
1472 ScRange aSourceRange( aRange );
1491 ScRange aChangeRange( aRange );
1509 aChangeRanges.
push_back( aChangeRange );
1527 if (
nCount == ::std::numeric_limits<sal_uLong>::max() )
1532 for (
SCCOL nColItr = nStartCol; nColItr <= nEndCol; ++nColItr )
1534 eCellType = pDoc->
GetCellType(nColItr, nStartRow, nTab);
1538 const std::vector<editeng::MisspellRanges>* pRanges = pWin->
GetAutoSpellData(nColItr, nStartRow);
1541 for (
SCROW nRowItr = nStartRow + 1; nRowItr <= nEndRow; ++nRowItr )
1546 for (
SCCOL nColItr = nStartCol; nColItr <= nEndCol; ++nColItr )
1548 eCellType = pDoc->
GetCellType(nColItr, nEndRow, nTab);
1552 const std::vector<editeng::MisspellRanges>* pRanges = pWin->
GetAutoSpellData(nColItr, nEndRow);
1555 for (
SCROW nRowItr = nEndRow - 1; nRowItr >= nStartRow; --nRowItr )
1560 for (
SCROW nRowItr = nStartRow; nRowItr <= nEndRow; ++nRowItr )
1562 eCellType = pDoc->
GetCellType(nStartCol, nRowItr, nTab);
1566 const std::vector<editeng::MisspellRanges>* pRanges = pWin->
GetAutoSpellData(nStartCol, nRowItr);
1569 for (
SCCOL nColItr = nStartCol + 1; nColItr <= nEndCol; ++nColItr )
1574 for (
SCROW nRowItr = nStartRow; nRowItr <= nEndRow; ++nRowItr )
1576 eCellType = pDoc->
GetCellType(nEndCol, nRowItr, nTab);
1580 const std::vector<editeng::MisspellRanges>* pRanges = pWin->
GetAutoSpellData(nEndCol, nRowItr);
1583 for (
SCCOL nColItr = nEndCol - 1; nColItr >= nStartCol; --nColItr )
1591 typedef const std::vector<editeng::MisspellRanges>* MisspellRangesType;
1592 SCROW nRowRepeatSize = nEndRow - nStartRow + 1;
1593 SCCOL nColRepeatSize = nEndCol - nStartCol + 1;
1596 std::vector<std::vector<MisspellRangesType>> aSourceSpellRanges(nRowRepeatSize, std::vector<MisspellRangesType>(nColRepeatSize,
nullptr));
1598 for (
SCROW nRowIdx = 0; nRowIdx < nRowRepeatSize; ++nRowIdx )
1600 for (
SCCOL nColIdx = 0; nColIdx < nColRepeatSize; ++nColIdx )
1602 eCellType = pDoc->
GetCellType(nStartCol + nColIdx, nStartRow + nRowIdx, nTab);
1606 aSourceSpellRanges[nRowIdx][nColIdx] = pWin->
GetAutoSpellData( nStartCol + nColIdx, nStartRow + nRowIdx );
1613 nTillRow = nEndRow +
nCount;
1614 for (
SCCOL nColItr = nStartCol; nColItr <= nEndCol; ++nColItr )
1616 for (
SCROW nRowItr = nEndRow + 1; nRowItr <= nTillRow; ++nRowItr )
1618 size_t nSourceRowIdx = ( nRowItr - nEndRow - 1 ) % nRowRepeatSize;
1619 MisspellRangesType pRanges = aSourceSpellRanges[nSourceRowIdx][nColItr - nStartCol];
1628 nTillRow = nStartRow -
nCount;
1629 for (
SCCOL nColItr = nStartCol; nColItr <= nEndCol; ++nColItr )
1631 for (
SCROW nRowItr = nStartRow - 1; nRowItr >= nTillRow; --nRowItr )
1633 size_t nSourceRowIdx = nRowRepeatSize - 1 - ( ( nStartRow - 1 - nRowItr ) % nRowRepeatSize );
1634 MisspellRangesType pRanges = aSourceSpellRanges[nSourceRowIdx][nColItr - nStartCol];
1643 nTillCol = nEndCol +
nCount;
1644 for (
SCCOL nColItr = nEndCol + 1; nColItr <= nTillCol; ++nColItr )
1646 size_t nSourceColIdx = ( nColItr - nEndCol - 1 ) % nColRepeatSize;
1647 for (
SCROW nRowItr = nStartRow; nRowItr <= nEndRow; ++nRowItr )
1649 MisspellRangesType pRanges = aSourceSpellRanges[nRowItr - nStartRow][nSourceColIdx];
1658 nTillCol = nStartCol -
nCount;
1659 for (
SCCOL nColItr = nStartCol - 1; nColItr >= nTillCol; --nColItr )
1661 size_t nSourceColIdx = nColRepeatSize - 1 - ( ( nStartCol - 1 - nColItr ) % nColRepeatSize );
1662 for (
SCROW nRowItr = nStartRow; nRowItr <= nEndRow; ++nRowItr )
1664 MisspellRangesType pRanges = aSourceSpellRanges[nRowItr - nStartRow][nSourceColIdx];
1709 pUndoDoc->InitUndo( rDoc, nTab, nTab );
1711 for (
const SCTAB&
i : rMark)
1714 pUndoDoc->AddUndoTab(
i,
i );
1722 rDoc.
FillTabMarked( nTab, rMark, nFlags, nFunction, bSkipEmpty, bAsLink );
1727 rDoc.
FillTab( aMarkRange, rMark, nFlags, nFunction, bSkipEmpty, bAsLink );
1733 std::make_unique<ScUndoFillTable>( pDocSh, rMark,
1736 std::move(pUndoDoc), bMulti, nTab, nFlags, nFunction, bSkipEmpty, bAsLink ) );
1772 if (nEndY >= rDoc.
MaxRow())
1777 if ( rDoc.
IsBlockEmpty( nStartX, nStartY, nEndX, nEndY, nTab ) )
1783 for (
SCCOL nCol = nStartX; nCol <= nEndX; ++nCol)
1785 if (rDoc.
HasData( nCol, nEndY + 1, nTab))
1788 SCROW nY = nEndY + 1;
1793 if (rDoc.
HasData( nCol, nY + 1, nTab))
1796 if (nOverWriteEndRow > nY)
1797 nOverWriteEndRow = nY;
1801 nOverWriteEndRow = nY;
1806 nOverWriteEndRow = 0;
1811 if (nOverWriteEndRow > nEndY)
1819 const bool bDataLeft = (nStartX > 0);
1820 if (!bDataLeft && nEndX >= rDoc.
MaxCol())
1829 SCCOL nMovX = (bDataLeft ? nStartX - 1 : nEndX + 1);
1830 SCROW nMovY = nStartY;
1831 bool bDataFound = (rDoc.
HasData( nMovX, nStartY, nTab) && rDoc.
HasData( nMovX, nStartY + 1, nTab));
1832 if (!bDataFound && bDataLeft && nEndX < rDoc.
MaxCol())
1835 bDataFound = (rDoc.
HasData( nMovX, nStartY, nTab) && rDoc.
HasData( nMovX, nStartY + 1, nTab));
1838 if (!(bDataFound && rDoc.
IsEmptyData( nStartX, nEndY + 1, nEndX, nEndY + 1, nTab )))
1844 for (
SCCOL nX = nStartX; nX <= nEndX; ++nX)
1846 SCROW nY = nEndY + 1;
1856 if (!rDoc.
HasData( nX, nY, nTab))
1914 if ( nEndCol-nStartCol >= 3 && nEndRow-nStartRow >= 3 )
1943 bool bAddUndo,
bool bIsApi )
1969 SCCOL nCol, nOldCol;
1970 SCROW nRow, nOldRow;
1971 SCTAB nTab, nOldTab;
1978 std::set<SCTAB> aOldSelectedTables;
1980 SCTAB nStartTab, nEndTab;
1985 std::set<SCTAB> aTmp(rMark.
begin(), rMark.
end());
1986 aOldSelectedTables.swap(aTmp);
1994 if ( nCommand == SvxSearchCmd::FIND
1995 || nCommand == SvxSearchCmd::FIND_ALL)
2001 std::unique_ptr<ScMarkData> pUndoMark;
2006 if ( nCommand == SvxSearchCmd::REPLACE_ALL )
2009 pUndoDoc->InitUndo( rDoc, nStartTab, nEndTab );
2015 for (
SCTAB j = nStartTab; j <= nEndTab; j++ )
2026 if ( nCol == 0 && nRow == 0 && nTab == nStartTab && !pSearchItem->
GetBackward() )
2029 bool bFound =
false;
2034 bool bMatchedRangesWereClamped =
false;
2035 if (rDoc.
SearchAndReplace(*pSearchItem, nCol, nRow, nTab, rMark, aMatchedRanges, aUndoStr, pUndoDoc.get(), bMatchedRangesWereClamped))
2041 std::make_unique<ScUndoReplace>(
GetViewData().GetDocShell(), *pUndoMark,
2043 aUndoStr, std::move(pUndoDoc), pSearchItem ) );
2046 if (nCommand == SvxSearchCmd::FIND_ALL || nCommand == SvxSearchCmd::REPLACE_ALL)
2053 pViewFrm->
ShowChildWindow(sc::SearchResultsDlgWrapper::GetChildWindowId());
2060 const bool bCellNotes = (pSearchItem->
GetCellType() == SvxSearchCellType::NOTE);
2063 const bool bEmptyCells = (!bCellNotes
2064 && ((nCommand == SvxSearchCmd::FIND_ALL
2066 || (nCommand == SvxSearchCmd::REPLACE_ALL
2068 pDlg->
FillResults(rDoc, aMatchedRanges, bCellNotes, bEmptyCells, bMatchedRangesWereClamped);
2074 for (
size_t i = 0,
n = aMatchedRanges.
size();
i <
n; ++
i)
2076 const ScRange& r = aMatchedRanges[
i];
2084 else if ( bFirst && (nCommand == SvxSearchCmd::FIND ||
2085 nCommand == SvxSearchCmd::REPLACE) )
2091 if ( nStartTab == nEndTab )
2109 if ( nCommand == SvxSearchCmd::FIND_ALL || nCommand == SvxSearchCmd::REPLACE_ALL )
2125 if (!aOldSelectedTables.empty())
2128 for (
SCTAB i = 0;
i <= nEndTab; ++
i)
2131 for (
const auto& rTab : aOldSelectedTables)
2139 if ( aOldSelectedTables.size() == 1 && nTab != nOldTab )
2169 if (pGridWindow && nCommand == SvxSearchCmd::FIND)
2179 std::vector<tools::Rectangle> aLogicRects;
2182 boost::property_tree::ptree aTree;
2183 aTree.put(
"searchString", pSearchItem->
GetSearchString().toUtf8().getStr());
2184 aTree.put(
"highlightAll", nCommand == SvxSearchCmd::FIND_ALL);
2186 boost::property_tree::ptree aSelections;
2189 boost::property_tree::ptree aSelection;
2190 aSelection.put(
"part", OString::number(nTab).getStr());
2191 aSelection.put(
"rectangles", rLogicRect.toString().getStr());
2192 aSelections.push_back(std::make_pair(
"", aSelection));
2194 aTree.add_child(
"searchResultSelection", aSelections);
2197 boost::property_tree::write_json(aStream, aTree);
2198 OString aPayload( aStream.str() );
2207 if ( nCommand == SvxSearchCmd::REPLACE
2208 || nCommand == SvxSearchCmd::REPLACE_ALL )
2210 if ( nCommand == SvxSearchCmd::REPLACE )
2216 if ( nCol == nOldCol && nRow == nOldRow && nTab == nOldTab )
2220 aSearchItem.
SetWhich(SID_SEARCH_ITEM);
2223 bool bMatchedRangesWereClamped;
2225 if ( rDoc.
SearchAndReplace( aSearchItem, nCol, nRow, nTab, rMark, aMatchedRanges, aUndoStr,
nullptr, bMatchedRangesWereClamped ) &&
2226 ( nTab == nOldTab ) &&
2227 ( nCol != nOldCol || nRow != nOldRow ) )
2238 else if ( nCommand == SvxSearchCmd::FIND_ALL )
2255 ScEditableTester aTester( rDoc, nDestTab, nDestCol,nDestRow, nDestCol,nDestRow );
2262 OUString aTargetValStr;
2268 double nSolveResult;
2277 nDestCol, nDestRow, nDestTab,
2293 aMsgStr +=
ScResId( STR_MSSG_SOLVE_0 ) +
2299 aMsgStr =
ScResId( STR_MSSG_SOLVE_2 ) +
2306 VclMessageType::Question, VclButtonsType::YesNo, aMsgStr));
2307 xBox->set_title(
ScResId(STR_MSSG_DOSUBTOTALS_0));
2308 xBox->set_default_response(
RET_NO);
2310 EnterValue( nDestCol, nDestRow, nDestTab, nSolveResult );
2337 SCTAB nNewTab = pDocSh->
MakeScenario( nTab, rName, rComment, rColor, nFlags, rMark );
2395 SCTAB nCount,
bool bRecord )
2426 std::make_unique<ScUndoInsertTables>( pDocSh, nTab, std::move(aNames)));
2453 std::make_unique<ScUndoInsertTab>( pDocSh, nTab,
true, rName));
2475 SCTAB nNewTab = nTab;
2489 SCTAB nNewTab = nTab;
2492 while ( nNewTab > 0 && !rDoc.
IsVisible( nNewTab ) )
2500 for (
SCTAB aTab = 0; aTab < nSheets; ++aTab)
2503 bool bHasCodeName = rDoc.
GetCodeName( nTab + aTab, sCodeName );
2518 pSfxApp->Broadcast(
SfxHint( SfxHintId::ScTablesChanged ) );
2519 pSfxApp->Broadcast(
SfxHint( SfxHintId::ScDbAreasChanged ) );
2520 pSfxApp->Broadcast(
SfxHint( SfxHintId::ScAreaLinksChanged ) );
2528 SCTAB nNewTab = TheTabs.front();
2535 while ( nNewTab > 0 && !rDoc.
IsVisible( nNewTab ) )
2538 bool bWasLinked =
false;
2540 std::unique_ptr<ScRefUndoData> pUndoData;
2547 for(
size_t i=0;
i<TheTabs.size(); ++
i)
2551 pUndoDoc->InitUndo( rDoc, nTab,nTab,
true,
true );
2553 pUndoDoc->AddUndoTab( nTab,nTab,
true,
true );
2556 rDoc.
GetName( nTab, aOldName );
2557 pUndoDoc->RenameTab( nTab, aOldName );
2568 pUndoDoc->SetScenario( nTab,
true );
2573 pUndoDoc->SetScenarioData( nTab, aComment, aColor, nScenFlags );
2575 pUndoDoc->SetActiveScenario( nTab, bActive );
2577 pUndoDoc->SetVisible( nTab, rDoc.
IsVisible( nTab ) );
2580 pUndoDoc->SetSheetEvents( nTab, std::unique_ptr<ScSheetEvents>(pSheetEvents ?
new ScSheetEvents(*pSheetEvents) :
nullptr) );
2581 pUndoDoc->SetLayoutRTL( nTab, rDoc.
IsLayoutRTL( nTab ) );
2590 pUndoDoc->AddUndoTab( 0, nCount-1 );
2597 bool bDelDone =
false;
2599 for(
int i=TheTabs.size()-1; i>=0; --i)
2602 bool bHasCodeName = rDoc.
GetCodeName( TheTabs[i], sCodeName );
2606 if( bVbaEnabled && bHasCodeName )
2616 std::make_unique<ScUndoDeleteTab>(
GetViewData().GetDocShell(), TheTabs,
2617 std::move(pUndoDoc), std::move(pUndoData) ));
2637 pSfxApp->Broadcast(
SfxHint( SfxHintId::ScTablesChanged ) );
2638 pSfxApp->Broadcast(
SfxHint( SfxHintId::ScAreasChanged ) );
2639 pSfxApp->Broadcast(
SfxHint( SfxHintId::ScDbAreasChanged ) );
2640 pSfxApp->Broadcast(
SfxHint( SfxHintId::ScAreaLinksChanged ) );
2679 const OUString& rFilter,
const OUString& rOptions,
2680 const OUString& rSource )
2692 const OUString& rFilter,
const OUString& rOptions,
2693 std::u16string_view rTabName )
2695 OUString aFilterName = rFilter;
2696 OUString aOpt = rOptions;
2704 if (rTabName.empty())
2713 if ( aTemp == rTabName )
2734 bool bError =
false;
2744 SCTAB nInsCount = 0;
2760 SCTAB nSrcTab = pSrcTabs[
i];
2777 bRefs = bName =
true;
2788 OUString aFileName = pMed->
GetName();
2789 OUString aFilterName;
2791 aFilterName = pMed->
GetFilter()->GetFilterName();
2794 bool bWasThere = rDoc.
HasLink( aFileName, aFilterName, aOptions );
2798 for (
i=0;
i<nInsCount;
i++)
2800 rSrcDoc.
GetName( pSrcTabs[
i], aTabStr );
2802 aFileName, aFilterName, aOptions, aTabStr, nRefresh );
2808 pLink->SetInCreate(
true );
2811 pLink->SetInCreate(
false );
2821 std::make_unique<ScUndoImportTab>( pDocSh, nTab,
nCount ) );
2824 for (
i=0;
i<nInsCount;
i++)
2831 pSfxApp->Broadcast(
SfxHint( SfxHintId::ScTablesChanged ) );
2832 pSfxApp->Broadcast(
SfxHint( SfxHintId::ScAreasChanged ) );
2847 sal_uInt16 nDestDocNo,
SCTAB nDestTab,
bool bCopy,
const OUString* pNewTabName )
2854 bool bRename = pNewTabName && !pNewTabName->isEmpty();
2867 SID_OPENDOC, SfxCallMode::API|SfxCallMode::SYNCHRON,
2868 { &aItem, &aTarget });
2871 if (
auto pObjectItem =
dynamic_cast<const SfxObjectItem*
>(pRetItem) )
2872 pDestShell =
dynamic_cast<ScDocShell*
>( pObjectItem->GetShell() );
2873 else if (
auto pViewFrameItem =
dynamic_cast<const SfxViewFrameItem*
>( pRetItem) )
2888 OSL_FAIL(
"Destination document not found !!!");
2902 if (&rDestDoc != &rDoc)
2908 rDestDoc.
RenameTab( 0,
"______42_____" );
2914 vector<SCTAB> TheTabs;
2922 TheTabs.push_back(
i);
2923 for(
SCTAB j=
i+1;j<nTabCount;j++)
2928 TheTabs.push_back(j);
2941 if (!bNewDoc && bUndo)
2947 SCTAB nDestTab1=nDestTab;
2949 for(
size_t j=0; j<TheTabs.size(); ++j, ++nDestTab1 )
2953 aName = *pNewTabName;
2969 nDestTab1 = nDestTab;
2970 for(
SCTAB nTab : TheTabs)
2972 nErrVal = pDestShell->
TransferTab( *pDocShell, nTab, nDestTab1,
false,
false );
2976 if (!bNewDoc && bUndo)
2981 std::make_unique<ScUndoImportTab>( pDestShell, nDestTab,
2982 static_cast<SCTAB>(TheTabs.size())));
3016 if(nTabCount!=nTabSelCount)
3028 SCTAB nNumTabsInserted =
static_cast<SCTAB>(TheTabs.size());
3067 unique_ptr< vector<SCTAB> > pSrcTabs(
new vector<SCTAB>);
3068 unique_ptr< vector<SCTAB> > pDestTabs(
new vector<SCTAB>);
3069 unique_ptr< vector<OUString> > pTabNames(
new vector<OUString>);
3070 unique_ptr< vector<OUString> > pDestNames;
3071 pSrcTabs->reserve(nTabCount);
3072 pDestTabs->reserve(nTabCount);
3073 pTabNames->reserve(nTabCount);
3082 pTabNames->push_back(aTabName);
3084 for(
SCTAB j=
i+1;j<nTabCount;j++)
3089 pTabNames->push_back(aTabName);
3100 rDoc.
GetName( nDestTab, aDestName);
3101 SCTAB nDestTab1=nDestTab;
3103 for (
size_t j = 0,
n = pTabNames->size(); j <
n; ++j)
3106 const OUString& rStr = (*pTabNames)[j];
3111 if(!rDoc.
GetTable(aDestName,nDestTab1))
3113 nDestTab1=nTabCount;
3115 pDocShell->
MoveTable( nMovTab, nDestTab1, bCopy,
false );
3121 SCTAB nSrcTab = (nDestTab1 <= nMovTab) ? nMovTab + 1 : nMovTab;
3142 pSrcTabs->push_back(nMovTab);
3148 nDestTab1=nTabCount;
3152 pDestTabs->push_back(nDestTab1);
3158 pDestNames.reset(
new vector<OUString>);
3159 size_t n = pDestTabs->size();
3160 pDestNames->reserve(
n);
3161 for (
size_t j = 0; j <
n; ++j)
3163 SCTAB nRenameTab = (*pDestTabs)[j];
3164 OUString aTabName = *pNewTabName;
3166 pDestNames->push_back(aTabName);
3181 std::make_unique<ScUndoCopyTab>(
3182 pDocShell, std::move(pSrcTabs), std::move(pDestTabs), std::move(pDestNames)));
3187 std::make_unique<ScUndoMoveTab>(
3188 pDocShell, std::move(pSrcTabs), std::move(pDestTabs), std::move(pTabNames), std::move(pDestNames)));
3192 SCTAB nNewTab = nDestTab;
3195 else if (!bCopy && nTab<nDestTab)
3208 std::vector<SCTAB> undoTabs;
3213 for (
const OUString&
aName : rNames)
3223 undoTabs.push_back(
nPos);
3248 for (
SCTAB i=0;
i < nTabCount && nVisible <= nTabSelCount ;
i++ )
3252 if (nVisible <= nTabSelCount)
3255 std::vector<SCTAB> undoTabs;
3259 for (
const SCTAB& nTab : selectedTabs)
3269 undoTabs.push_back(nTab);
3273 if (nTabToSelect != -1)
3309 nScript = SvtScriptType::LATIN | SvtScriptType::ASIAN | SvtScriptType::COMPLEX;
3322 const SvxBorderLine* pDestLine,
3323 const SvxBorderLine* pSrcLine,
3326 if ( !(pSrcLine && pDestLine) )
3331 rLine.SetColor ( pSrcLine->GetColor() );
3332 rLine.SetBorderLineStyle(pDestLine->GetBorderLineStyle());
3333 rLine.SetWidth ( pDestLine->GetWidth() );
3337 rLine.SetColor ( pDestLine->GetColor() );
3338 rLine.SetBorderLineStyle(pSrcLine->GetBorderLineStyle());
3339 rLine.SetWidth ( pSrcLine->GetWidth() );
3343#define SET_LINE_ATTRIBUTES(LINE,BOXLINE) \
3344 pBoxLine = aBoxItem.Get##LINE(); \
3349 UpdateLineAttrs( aLine, pBoxLine, pLine, bColorOnly ); \
3350 aBoxItem.SetLine( &aLine, BOXLINE ); \
3353 aBoxItem.SetLine( nullptr, BOXLINE ); \
3360 bool bOnlyNotBecauseOfMatrix;
3361 if ( !
SelectionEditable( &bOnlyNotBecauseOfMatrix ) && !bOnlyNotBecauseOfMatrix )
3384 if( !((eItemState != SfxItemState::DEFAULT) || (eTLBRState != SfxItemState::DEFAULT) || (eBLTRState != SfxItemState::DEFAULT)) )
3388 if( (eItemState != SfxItemState::DONTCARE) && (eTLBRState != SfxItemState::DONTCARE) && (eBLTRState != SfxItemState::DONTCARE) )
3393 SvxBorderLine aLine;
3397 const SvxBorderLine* pBoxLine =
nullptr;
3407 aBoxInfoItem.
SetLine( aBoxItem.
GetTop(), SvxBoxInfoItemLine::HORI );
3408 aBoxInfoItem.
SetLine( aBoxItem.
GetLeft(), SvxBoxInfoItemLine::VERT );
3411 aOldSet.
Put( *pBorderAttr );
3412 aNewSet.
Put( aBoxItem );
3413 aNewSet.
Put( aBoxInfoItem );
3416 if( pTLBRItem &&
static_cast<const SvxLineItem*
>(pTLBRItem)->GetLine() )
3421 aOldSet.
Put( *pTLBRItem );
3422 aNewSet.
Put( aTLBRItem );
3425 if( pBLTRItem &&
static_cast<const SvxLineItem*
>(pBLTRItem)->GetLine() )
3430 aOldSet.
Put( *pBLTRItem );
3431 aNewSet.
Put( aBLTRItem );
3449 pDocSh->
PostPaint( nStartCol, nStartRow, nStartTab,
3450 nEndCol, nEndRow, nEndTab,
3457#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
constexpr tools::Long Y() const
constexpr tools::Long X() 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)
virtual void libreOfficeKitViewCallback(int nType, const OString &pPayload) const override
void setTiledSearching(bool bTiledSearching)
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)