37#include <rtl/math.hxx>
44#include <document.hxx>
54#include <unonames.hxx>
57#include <inputwin.hxx>
72#include <com/sun/star/container/XNameContainer.hpp>
73#include <com/sun/star/document/NamedPropertyValues.hpp>
77#define SC_GROWY_SMALL_EXTRA 100
78#define SC_GROWY_BIG_EXTRA 200
90 { pOtherViewShell->RemoveWindowFromForeignEditView(pTabViewShell, eWhich); };
100void collectUIInformation(std::map<OUString, OUString>&& aParameters,
const OUString& rAction)
103 aDescription.
aID =
"grid_window";
104 aDescription.
aAction = rAction;
106 aDescription.
aParent =
"MainWindow";
107 aDescription.
aKeyWord =
"ScGridWinUIObject";
117 if (rValue1.first ==
null || rValue2.first ==
null)
119 return rValue1.second < rValue2.second;
123 return rValue1.first < rValue2.first;
130 mData.insert(std::make_pair(-1, 0));
141 SAL_INFO(
"sc.lok.poshelper",
"ScPositionHelper::insert: nIndex: "
145 mData.insert(aValue);
147 "ScPositionHelper::insert: after insert: size: " <<
mData.size());
154 SAL_INFO(
"sc.lok.poshelper",
"ScPositionHelper::remove: nIndex: " <<
nIndex
155 <<
", size: " <<
mData.size());
157 if (it ==
mData.end())
return;
160 "ScPositionHelper::remove: after erase: size: " <<
mData.size());
165 SAL_INFO(
"sc.lok.poshelper",
"ScPositionHelper::invalidate: nIndex: " <<
nIndex);
169 mData.insert(std::make_pair(-1, 0));
173 auto it =
mData.lower_bound(std::make_pair(
nIndex, 0));
180 SAL_INFO(
"sc.lok.poshelper",
"ScPositionHelper::invalidate: nPos: " <<
nPos);
184 mData.insert(std::make_pair(-1, 0));
197 "ScPositionHelper::getNearest: nIndex: " <<
nIndex <<
", size: " <<
mData.size());
198 auto posUB =
mData.upper_bound(std::make_pair(
nIndex, 0));
199 if (posUB ==
mData.begin())
204 auto posLB = std::prev(posUB);
206 if (posUB ==
mData.end())
213 if (nDiffUB < -nDiffLB)
227 "ScPositionHelper::getNearest: nPos: " <<
nPos <<
", size: " <<
mData.size());
230 if (posUB ==
mData.begin())
235 auto posLB = std::prev(posUB);
237 if (posUB ==
mData.end())
245 if (nDiffUB < -nDiffLB)
258 if (it ==
mData.end())
return -1;
276 nTotalPixels += getSizePx(nIdx);
283 nTotalPixels -= getSizePx(nIdx);
290 : rDoc(rView.GetDocument())
292 , bColumnHeader(bColHeader)
294 , mfPPTX(rView.GetPPTX())
295 , mfPPTY(rView.GetPPTY())
298 , nFirstPositionPx(-1)
299 , nSecondPositionPx(-1)
342 nFoundIndex, nPosition, bTowards);
345 nFoundIndex, nPosition, bTowards);
352 SAL_INFO(
"sc.lok.header",
"BoundsProvider: nFirstBound: " << nFirstBound
353 <<
", nSecondBound: " << nSecondBound);
355 tools::Long nFirstDiff = aFirstNearest.second - nFirstBound;
356 tools::Long nSecondDiff = aSecondNearest.second - nSecondBound;
357 SAL_INFO(
"sc.lok.header",
"BoundsProvider: rTopNearest: index: " << aFirstNearest.first
358 <<
", pos: " << aFirstNearest.second <<
", diff: " << nFirstDiff);
359 SAL_INFO(
"sc.lok.header",
"BoundsProvider: rBottomNearest: index: " << aSecondNearest.first
360 <<
", pos: " << aSecondNearest.second <<
", diff: " << nSecondDiff);
362 bool bReverse = (std::abs(nFirstDiff) >= std::abs(nSecondDiff));
366 std::swap(aFirstNearest, aSecondNearest);
367 std::swap(nFirstBound, nSecondBound);
368 std::swap(nFirstDiff, nSecondDiff);
371 index_type nNearestIndex = aFirstNearest.first;
372 tools::Long nNearestPosition = aFirstNearest.second;
373 SAL_INFO(
"sc.lok.header",
"BoundsProvider: nearest to first bound: nNearestIndex: "
374 << nNearestIndex <<
", nNearestPosition: " << nNearestPosition);
383 nNearestIndex = aSecondNearest.first;
384 nNearestPosition = aSecondNearest.second;
390 nSecondDiff = !bReverse ? -1 : 1;
392 SAL_INFO(
"sc.lok.header",
"BoundsProvider: nearest to second bound: nNearestIndex: "
393 << nNearestIndex <<
", nNearestPosition: " << nNearestPosition
394 <<
", diff: " << nSecondDiff);
443 if (nBound >= nNearestPosition)
446 nPosition = nNearestPosition;
451 nNearestPosition -= nSizePx;
453 if (!bTowards && nFoundIndex != -1)
456 nPosition +=
GetSize(nFoundIndex);
468 nNearestPosition += nSizePx;
470 if (nNearestPosition > nBound)
473 nPosition = nNearestPosition;
477 if (nFoundIndex == -2)
480 nPosition = nNearestPosition;
484 nPosition -=
GetSize(nFoundIndex);
506 aWidthHelper(pDoc, true),
507 aHeightHelper(pDoc, false),
511 mbOldCursorValid( false )
532 beans::PropertyValue* pSettings = rSettings.getArray();
544 nExFixPosX, nExFixPosY,
545 nExHSplitPos, nExVSplitPos, nTab);
554 if(nExFixPosX != 0 || nExFixPosY != 0 || nExHSplitPos != 0 || nExVSplitPos != 0)
610 sal_Int32 nTemp32(0);
611 sal_Int16 nTemp16(0);
612 sal_Int32 nTempPosV(0);
613 sal_Int32 nTempPosH(0);
614 sal_Int32 nTempPosVTw(0);
615 sal_Int32 nTempPosHTw(0);
616 bool bHasVSplitInTwips =
false;
617 bool bHasHSplitInTwips =
false;
618 for (
const auto& rSetting : aSettings)
620 OUString
sName(rSetting.Name);
623 rSetting.Value >>= nTemp32;
628 rSetting.Value >>= nTemp32;
643 rSetting.Value >>= nTempPosH;
644 bHasHSplitInTwips =
false;
648 rSetting.Value >>= nTempPosV;
649 bHasVSplitInTwips =
false;
653 rSetting.Value >>= nTempPosHTw;
654 bHasHSplitInTwips =
true;
658 rSetting.Value >>= nTempPosVTw;
659 bHasVSplitInTwips =
true;
668 rSetting.Value >>= nTemp32;
673 rSetting.Value >>= nTemp32;
678 rSetting.Value >>= nTemp32;
683 rSetting.Value >>= nTemp32;
688 rSetting.Value >>= nTemp16;
694 rSetting.Value >>= nTemp32;
701 rSetting.Value >>= nTemp32;
712 bool bSelected =
false;
713 rSetting.Value >>= bSelected;
720 rSetting.Value >>= aColor;
783 maMarkData (pDocSh ? pDocSh->GetDocument().GetSheetLimits() : pDoc->GetSheetLimits()),
784 pDocShell ( pDocSh ),
785 mrDoc (pDocSh ? pDocSh->GetDocument() : *pDoc),
787 maOptions (pDocSh ? pDocSh->GetDocument().GetViewOptions() :
DefaultOptions()),
788 pSpellingView ( nullptr ),
793 aDefPageZoomX( 3,5 ),
794 aDefPageZoomY( 3,5 ),
813 bIsRefMode ( false ),
814 bDelMarkValid( false ),
815 bPagebreak ( false ),
816 bSelCtrlMouseClick( false ),
820 m_nLOKPageUpDownOffset( 0 )
822 assert(
bool(pDoc) !=
bool(pDocSh));
853 xTabData->InitData(
mrDoc);
893 collectUIInformation({{}},
"InsertTab");
907 for (
SCTAB i = nTab;
i < nTab + nNewSheets; ++
i)
951 OSL_FAIL(
"too many sheets");
956 OSL_FAIL(
"pTabData out of bounds, FIX IT");
973 std::unique_ptr<ScViewDataTable> pTab;
995 for (
const auto& rTab : rvTabs )
1001 bool bAll = tabs.empty();
1011 i->eZoomType = eNew;
1017 for (
const SCTAB&
i : tabs )
1027 std::vector< SCTAB > vTabs;
1031 vTabs.insert(vTabs.begin(), itr, itrEnd);
1038 bool bAll = tabs.empty();
1044 "fraction rNewX not sensible: " <<
static_cast<double>(rNewX));
1046 "fraction rNewY not sensible: " <<
static_cast<double>(rNewY));
1056 i->aPageZoomX = rNewX;
1057 i->aPageZoomY = rNewY;
1079 for (
const SCTAB&
i : tabs )
1101 std::vector< SCTAB > vTabs;
1105 vTabs.insert(vTabs.begin(), itr, itrEnd);
1107 SetZoom( rNewX, rNewY, vTabs );
1163 if ( nRow < 1 || nCol < 1 )
1193 aRange.
GetVars( rStartCol, rStartRow, rStartTab, rEndCol, rEndRow, rEndTab);
1338 const sal_Int32 kMax = 23 * 1024 * 1024;
1414 return maTabData[nForTab]->nPosX[eWhich];
1428 return maTabData[nForTab]->nPosY[eWhich];
1468 auto GetColWidthPx = [
this, nTab](
SCCOL nCol) {
1476 SAL_INFO(
"sc.lok.docsize",
"ScViewData::SetMaxTiledCol: nNewMaxCol: "
1477 << nNewMaxCol <<
", nTotalPixels: " << nTotalPixels);
1493 auto GetRowHeightPx = [
this, nTab](
SCROW nRow) {
1501 SAL_INFO(
"sc.lok.docsize",
"ScViewData::SetMaxTiledRow: nNewMaxRow: "
1502 << nNewMaxRow <<
", nTotalPixels: " << nTotalPixels);
1512 bool bForceToTop,
bool bInPrintTwips )
1514 Point aCellTopLeft = bInPrintTwips ?
1530 comphelper::LibreOfficeKit::Compat::scPrintTwipsMsgs);
1531 bool bLOKLayoutRTL = bLOKActive && bLayoutRTL;
1533 bool bWasThere =
false;
1544 pEditView[eWhich]->SetEditEngine(pNewEngine);
1547 if (
pEditView[eWhich]->GetWindow() != pWin)
1551 OSL_FAIL(
"EditView Window has changed");
1561 pEditView[eWhich]->SetBroadcastLOKViewCursor(bLOKPrintTwips);
1567 if (!bWasThere && bLOKActive)
1572 [pThisViewShell, nThisTabNo, eWhich] (
ScTabViewShell* pOtherViewShell)
1574 ScViewData& rOtherViewData = pOtherViewShell->GetViewData();
1576 if (nThisTabNo == nOtherTabNo)
1577 pOtherViewShell->AddWindowToForeignEditView(pThisViewShell, eWhich);
1589 pEditView[eWhich]->SetControlWord(nVC & ~EVControlBits::AUTOSCROLL);
1596 bool bBreak = ( eJust == SvxCellHorJustify::Block ) ||
1615 if (
GetEditAdjust() == SvxAdjust::Right || bAsianVertical )
1624 if (!
pEditView[eWhich]->HasLOKSpecialPositioning())
1625 pEditView[eWhich]->InitLOKSpecialPositioning(MapUnit::MapTwip, aPTwipsRect,
Point());
1627 pEditView[eWhich]->SetLOKSpecialOutputArea(aPTwipsRect);
1630 if (bLOKActive &&
pEditView[eWhich]->HasLOKSpecialPositioning())
1631 pEditView[eWhich]->SetLOKSpecialFlags(bLOKLayoutRTL ? LOKSpecialFlags::LayoutRTL : LOKSpecialFlags::NONE);
1634 pEditView[eWhich]->SetOutputArea( aOutputArea );
1656 bool bGrowCentered = ( eJust == SvxCellHorJustify::Center );
1657 bool bGrowToLeft = ( eJust == SvxCellHorJustify::Right );
1658 bool bLOKRTLInvert = (bLOKActive && bLayoutRTL);
1659 if ( bAsianVertical )
1660 bGrowCentered = bGrowToLeft =
false;
1666 tools::Long nGridWidthTwips = 0, nGridHeightTwips = 0;
1669 Size aGridSize(nGridWidthPx, nGridHeightPx);
1673 rWinMapMode,
MapMode(MapUnit::MapTwip));
1674 nGridWidthTwips = aGridSize.
Width();
1675 nGridHeightTwips = aGridSize.
Height();
1678 if (bBreak && !bAsianVertical)
1682 nSizeXPTwips = aPTwipsRect.
GetWidth();
1686 OSL_ENSURE(
pView,
"no View for EditView");
1688 if ( bGrowCentered )
1694 nSizeXPix = aPixRect.
GetWidth() + 2 * std::min( nLeft, nRight );
1699 nSizeXPTwips = aPTwipsRect.
GetWidth() + 2 * std::min(nLeftPTwips, nRightPTwips);
1702 else if ( (bGrowToLeft && !bLOKRTLInvert) || (!bGrowToLeft && bLOKRTLInvert) )
1704 nSizeXPix = aPixRect.
Right();
1706 nSizeXPTwips = aPTwipsRect.
Right();
1710 nSizeXPix = nGridWidthPx - aPixRect.
Left();
1712 nSizeXPTwips = nGridWidthTwips - aPTwipsRect.
Left();
1715 if ( nSizeXPix <= 0 )
1719 nSizeXPTwips = aPTwipsRect.
GetWidth();
1722 OSL_ENSURE(
pView,
"no View for EditView");
1724 tools::Long nSizeYPTwips = bLOKPrintTwips ? (nGridHeightTwips - aPTwipsRect.
Top()) : 0;
1726 if ( nSizeYPix <= 0 )
1734 Size aPaperSizePTwips(nSizeXPTwips, nSizeYPTwips);
1735 if ( bBreak && !bAsianVertical &&
SC_MOD()->GetInputOptions().GetTextWysiwyg() )
1760 aVisPTwips =
pEditView[eWhich]->GetLOKSpecialVisArea();
1775 aVisPTwips.
SetRight( ( aPaperSizePTwips.
Width() - 1 + nDiffPTwips ) / 2 );
1796 pEditView[eWhich]->SetLOKSpecialVisArea(aVisPTwips);
1807 if (aDocPos.
Y() < aOutputArea.
Top())
1808 pEditView[eWhich]->Scroll( 0, aOutputArea.
Top() - aDocPos.
Y() );
1824 pEditView[eWhich]->SetBackgroundColor( aBackCol );
1833 if (nStatus & (EditStatusFlags::HSCROLL | EditStatusFlags::TextHeightChanged | EditStatusFlags::TEXTWIDTHCHANGED | EditStatusFlags::CURSOROUT))
1838 if (nStatus & EditStatusFlags::CURSOROUT)
1841 if (pEditView[eWhich])
1842 pEditView[eWhich]->ShowCursor(
false);
1861 comphelper::LibreOfficeKit::Compat::scPrintTwipsMsgs);
1897 bool bChanged =
false;
1903 bool bGrowCentered = ( eJust == SvxCellHorJustify::Center );
1904 bool bGrowToLeft = ( eJust == SvxCellHorJustify::Right );
1905 bool bGrowBackwards = bGrowToLeft;
1907 bGrowBackwards = !bGrowBackwards;
1908 if ( bAsianVertical )
1909 bGrowCentered = bGrowToLeft = bGrowBackwards =
false;
1911 bool bUnevenGrow =
false;
1912 if ( bGrowCentered )
1925 nLogicLeftPTwips = nColWidth;
1936 nLogicRightPTwips = nColWidth;
1939 aArea.
AdjustLeft( -((bLayoutRTL && !bLOKActive) ? nLogicRight : nLogicLeft) );
1940 aArea.
AdjustRight((bLayoutRTL && !bLOKActive) ? nLogicLeft : nLogicRight );
1951 aArea.
SetLeft( nCenter - nHalf + 1 );
1958 aAreaPTwips.
SetLeft( nCenterPTwips - nHalfPTwips + 1 );
1959 aAreaPTwips.
SetRight( nCenterPTwips + aSizePTwips.
Width() - nHalfPTwips - 1 );
1964 if ( nLogicLeft != nLogicRight )
1968 else if ( bGrowBackwards )
1978 if ( !bLayoutRTL || bLOKActive )
1982 aAreaPTwips.
AdjustLeft( -nLogicWidthPTwips );
1993 if ( !bLayoutRTL || bLOKActive )
2019 if ( bLayoutRTL && !bLOKActive )
2032 if ( bLayoutRTL && !bLOKActive )
2051 if (
bMoveArea || bGrowCentered || bGrowBackwards || bLayoutRTL )
2058 if ( bGrowCentered )
2066 aVis.
SetLeft( nCenter - nVisSize / 2 );
2073 aVisPTwips.
SetLeft( nCenterPTwips - nVisSizePTwips / 2 );
2074 aVisPTwips.
SetRight( aVisPTwips.
Left() + nVisSizePTwips - 1 );
2077 else if ( bGrowToLeft )
2131 else if ( !bAsianVertical && !bGrowToLeft && !bGrowCentered )
2148 comphelper::LibreOfficeKit::Compat::scPrintTwipsMsgs);
2158 if ( nControl & EVControlBits::AUTOSCROLL )
2198 OUString aText = pEngine->
GetText( 0 );
2199 if ( ( aText.isEmpty() && bInitial ) || aText.startsWith(
"=") )
2203 bool bChanged =
false;
2204 bool bMaxReached =
false;
2205 while (aArea.
GetHeight() + nAllowedExtra < nTextHeight &&
nEditEndRow < nBottom && !bMaxReached)
2237 if (!(nControl & EVControlBits::AUTOSCROLL))
2238 pCurView->
SetControlWord( nControl | EVControlBits::AUTOSCROLL );
2241 aArea.
SetTop( nOldBottom );
2251 for (sal_uInt16
i=0;
i<4;
i++)
2271 for (sal_uInt16
i=0;
i<4;
i++)
2323 OSL_FAIL(
"wrong sheet number");
2342 return &(
maTabData[nTabIndex]->aWidthHelper);
2352 return &(
maTabData[nTabIndex]->aHeightHelper);
2381 bool bAllowNeg,
SCTAB nForTab )
const
2407 bool bForCurTab = (nForTab ==
nTabNo);
2410 SAL_WARN(
"sc.viewdata",
"ScViewData::GetScrPos : invalid nForTab = " << nForTab);
2429 if (bAllowNeg || nWhereX >= nPosX)
2431 SCROW nStartPosX = nPosX;
2432 if (bIsTiledRendering)
2434 OSL_ENSURE(nPosX == 0,
"Unsupported case.");
2436 nStartPosX = rNearest.first + 1;
2437 nScrPosX = rNearest.second;
2440 if (nWhereX >= nStartPosX)
2442 for (
SCCOL nX = nStartPosX; nX < nWhereX && (bAllowNeg || bIsTiledRendering || nScrPosX <=
aScrSize.
Width()); nX++)
2445 nScrPosX = 0x7FFFFFFF;
2452 nScrPosX += nSizeXPix;
2456 SCCOL lastHidden = -1;
2457 if(
mrDoc.
ColHidden(nX, nForTab,
nullptr, &lastHidden) && lastHidden > nX)
2458 nX = lastHidden - 1;
2465 for (
SCCOL nX = nStartPosX; nX > nWhereX;)
2472 nScrPosX -= nSizeXPix;
2476 SCCOL firstHidden = -1;
2477 if(
mrDoc.
ColHidden(nX, nForTab, &firstHidden,
nullptr) && firstHidden >= 0)
2489 if (bAllowNeg || nWhereY >= nPosY)
2491 SCROW nStartPosY = nPosY;
2492 if (bIsTiledRendering)
2494 OSL_ENSURE(nPosY == 0,
"Unsupported case.");
2496 nStartPosY = rNearest.first + 1;
2497 nScrPosY = rNearest.second;
2500 if (nWhereY >= nStartPosY)
2502 for (
SCROW nY = nStartPosY; nY < nWhereY && (bAllowNeg || bIsTiledRendering || nScrPosY <=
aScrSize.
Height()); nY++)
2505 nScrPosY = 0x7FFFFFFF;
2512 nScrPosY += nSizeYPix;
2528 for (
SCROW nY = nStartPosY; nY > nWhereY;)
2535 nScrPosY -= nSizeYPix;
2539 SCROW firstHidden = -1;
2540 if(
mrDoc.
RowHidden(nY, nForTab, &firstHidden,
nullptr) && firstHidden >= 0)
2553 return Point( nScrPosX, nScrPosY );
2565 return Point(nPosX, nPosY);
2578 const Point aTileTwipsCellPos(aPixCellPos.
X() /
nPPTX, aPixCellPos.
Y() /
nPPTY);
2580 return aPrintTwipsCellPos + (rTileTwipsPos - aTileTwipsCellPos);
2585 const bool bPosSizeInPixels = bPixelAligned;
2591 if (bPosSizeInPixels)
2597 if (bPosSizeInPixels)
2612 tools::Long nSizeXTw = rtl::math::round(nSizeX / fPPTX) - 1;
2613 tools::Long nSizeYTw = rtl::math::round(nSizeY / fPPTY) - 1;
2615 ss << nPosXTw <<
", " << nPosYTw <<
", " << nSizeXTw <<
", " << nSizeYTw <<
", "
2616 << nX <<
", " << nY;
2625 ss << aCellPos.
getX() <<
", " << aCellPos.
getY()
2626 <<
", " << nSizeX <<
", " << nSizeY <<
", "
2627 << nX <<
", " << nY;
2630 return OString(ss.str());
2636 OSL_ENSURE( nDir==1 || nDir==-1,
"wrong CellsAt call" );
2642 sal_uInt16 nScrPosX = 0;
2651 for ( ; nScrPosX<=nScrSizeX && !bOut; nX = sal::static_int_cast<SCCOL>(nX + nDir) )
2662 nScrPosX = sal::static_int_cast<sal_uInt16>( nScrPosX +
static_cast<sal_uInt16
>(nSizeXPix) );
2668 nX = sal::static_int_cast<SCCOL>( nX - nPosX );
2678 OSL_ENSURE( nDir==1 || nDir==-1,
"wrong CellsAt call" );
2704 nY -= (nY == 0 ? 2 : 1);
2744 for (
SCROW nRow = nY; nRow <= nY+nCountY-1; ++nRow)
2746 SCROW nLastRow = nRow;
2757 rSizeXPix = nOutWidth;
2758 rSizeYPix = nOutHeight;
2782 return (nCountX > 1 || nCountY > 1);
2787 bool bTestMerge,
bool bRepair,
SCTAB nForTab )
2793 bool bForCurTab = (nForTab ==
nTabNo);
2796 SAL_WARN(
"sc.viewdata",
"ScViewData::GetPosFromPixel : invalid nForTab = " << nForTab);
2824 while (rPosX <=
mrDoc.
MaxCol() && nClickX >= nScrX)
2833 while ( rPosX>0 && nClickX < nScrX )
2845 while ( rPosY>0 && nClickY < nScrY )
2853 if ( rPosX == nStartPosX && nClickX > 0 )
2860 if ( rPosY == nStartPosY && nClickY > 0 )
2871 if (!(bTestMerge && bForCurTab))
2875 SCCOL nOrigX = rPosX;
2876 SCROW nOrigY = rPosY;
2878 bool bHOver = (nOrigX != rPosX);
2879 bool bVOver = (nOrigY != rPosY);
2881 if ( !(bRepair && ( bHOver || bVOver )) )
2888 OSL_FAIL(
"merge error found");
2901 SCCOL nPosX,
SCROW nPosY,
bool& rLeft,
bool& rTop )
2910 rLeft = ( rClickPos.
X() - aCellStart.
X() ) * nLayoutSign <= nSizeX / 2;
2911 rTop = rClickPos.
Y() - aCellStart.
Y() <= nSizeY / 2;
2918 if (nNewPosX != 0 && !bIsTiledRendering)
2924 if ( nNewPosX > nOldPosX )
2925 for (
i=nOldPosX;
i<nNewPosX;
i++ )
2929 nPixPosX -=
ToPixel(sal::static_int_cast<sal_uInt16>(nThis),
nPPTX);
2932 for (
i=nNewPosX;
i<nOldPosX;
i++ )
2936 nPixPosX +=
ToPixel(sal::static_int_cast<sal_uInt16>(nThis),
nPPTX);
2957 if (nNewPosY != 0 && !bIsTiledRendering)
2963 if ( nNewPosY > nOldPosY )
2964 for (
i=nOldPosY;
i<nNewPosY;
i++ )
2967 SCROW nRows = std::min( nNewPosY, nHeightEndRow + 1) -
i;
2969 nTPosY -= nThis * nRows;
2970 nPixPosY -=
ToPixel(sal::static_int_cast<sal_uInt16>(nThis),
nPPTY) * nRows;
2973 for (
i=nNewPosY;
i<nOldPosY;
i++ )
2976 SCROW nRows = std::min( nOldPosY, nHeightEndRow + 1) -
i;
2978 nTPosY += nThis * nRows;
2979 nPixPosY +=
ToPixel(sal::static_int_cast<sal_uInt16>(nThis),
nPPTY) * nRows;
2998 for (sal_uInt16 eWhich=0; eWhich<2; eWhich++)
3009 SCROW nLastSameHeightRow = -1;
3010 for (
SCROW j=0; j<nPosY; j++)
3012 if(nLastSameHeightRow < j)
3014 nPixPosY -= nRowHeight;
3046 for (nCol=nCol1; nCol<=nCol2; nCol++)
3052 nScrPosX +=
static_cast<sal_uInt16
>(nSizePix);
3056 for (nRow=nRow1; nRow<=nRow2; nRow++)
3062 nScrPosY +=
static_cast<sal_uInt16
>(nSizePix);
3085 if (nSize + nAdd <= nTwips + 1 && nX1 <
mrDoc.
MaxCol())
3101 if (nSize + nAdd <= nTwips + 1 && nY1 <
mrDoc.
MaxRow())
3136 assert(
pView &&
"GetBindings() without ViewShell");
3142 assert(
pView &&
"GetDispatcher() without ViewShell");
3158 assert(
pView &&
"GetDialogParent() without ViewShell");
3164 assert(
pView &&
"GetActiveWin() without View");
3170 assert(
pView &&
"GetActiveWin() without View");
3176 assert(
pView &&
"GetScDrawView() without View");
3182 assert(
pView &&
"IsMinimized() without View");
3191 SetZoom( rNewX, rNewY,
false );
3207 double nOldPPTX =
nPPTX;
3208 double nOldPPTY =
nPPTY;
3229 double fOriginal = nTwips *
nPPTX;
3230 if ( fOriginal <
static_cast<double>(nEndCol) )
3235 double fRounded = ::rtl::math::approxFloor( fOriginal + 0.5 );
3236 if ( fRounded > 0.0 )
3238 double fScale = fRounded / fOriginal + 1
E-6;
3239 if ( fScale >= 0.9 && fScale <= 1.1 )
3250 bool bResetWidths = (
nPPTX != nOldPPTX);
3251 bool bResetHeights = (
nPPTY != nOldPPTY);
3252 for (
SCTAB nTabIdx = 0; nTabIdx < nTabCount; ++nTabIdx)
3259 pWHelper->invalidateByPosition(0L);
3263 pHHelper->invalidateByPosition(0L);
3267#define SC_OLD_TABSEP '/'
3268#define SC_NEW_TABSEP '+'
3281 rData = OUString::number( nZoom ) +
"/";
3283 rData += OUString::number( nZoom ) +
"/";
3307 rData += OUString::number(
maTabData[
i]->nCurX ) + cTabSep +
3308 OUString::number(
maTabData[
i]->nCurY ) + cTabSep +
3309 OUString::number(
maTabData[
i]->eHSplitMode ) + cTabSep +
3310 OUString::number(
maTabData[
i]->eVSplitMode ) + cTabSep;
3312 rData += OUString::number(
maTabData[
i]->nFixPosX );
3314 rData += OUString::number(
maTabData[
i]->nHSplitPos );
3317 rData += OUString::number(
maTabData[
i]->nFixPosY );
3319 rData += OUString::number(
maTabData[
i]->nVSplitPos );
3321 OUString::number(
maTabData[
i]->eWhichActive ) + cTabSep +
3322 OUString::number(
maTabData[
i]->nPosX[0] ) + cTabSep +
3323 OUString::number(
maTabData[
i]->nPosX[1] ) + cTabSep +
3324 OUString::number(
maTabData[
i]->nPosY[0] ) + cTabSep +
3339 OSL_FAIL(
"ReadUserData: This is not my data");
3343 sal_Int32 nMainIdx {0};
3346 std::u16string_view aZoomStr =
o3tl::getToken(rData, 0,
';', nMainIdx);
3357 const sal_Int32 nMainIdxRef {nMainIdx};
3358 std::u16string_view aTabOpt =
o3tl::getToken(rData, 0,
';', nMainIdx);
3360 std::u16string_view aRest;
3368 nMainIdx = nMainIdxRef;
3373 while ( nMainIdx>0 )
3445 for(
SCTAB nTab = 0; nTab < static_cast<SCTAB>(
maTabData.size()); ++nTab )
3454 SCCOL nExFixPosX = pViewTab->nFixPosX;
3455 SCROW nExFixPosY = pViewTab->nFixPosY;
3462 nExFixPosX, nExFixPosY,
3463 nExHSplitPos, nExVSplitPos, nTab);
3470 OSL_ENSURE( !bRealSplit || !bFrozen,
"ScViewData::WriteExtOptions - split and freeze in same sheet" );
3479 rSplitPos =
Point( bHSplit ? nExHSplitPos : 0, bVSplit ? nExVSplitPos : 0 );
3495 switch( pViewTab->eWhichActive )
3516 rTabSett.
maCursor.
Set( pViewTab->nCurX, pViewTab->nCurY, nTab );
3554 for(
SCTAB nTab = 0; nTab < static_cast<SCTAB>(
maTabData.size()); ++nTab )
3616 bHSplit = bHSplit && aPixel.
X() > 0;
3617 bVSplit = bVSplit && aPixel.
Y() > 0;
3698 beans::PropertyValue* pSettings = rSettings.getArray();
3704 uno::Reference<container::XNameContainer> xNameContainer =
3706 for (
SCTAB nTab=0; nTab<static_cast<SCTAB>(
maTabData.size()); nTab++)
3710 uno::Sequence <beans::PropertyValue> aTableViewSettings;
3711 maTabData[nTab]->WriteUserDataSequence(aTableViewSettings, *
this, nTab);
3716 xNameContainer->insertByName(sTabName,
uno::Any(aTableViewSettings));
3719 catch ( container::ElementExistException& )
3721 OSL_FAIL(
"seems there are two tables with the same name");
3723 catch ( uno::RuntimeException& )
3725 OSL_FAIL(
"something went wrong");
3758 OUString aColorName;
3796 std::vector<bool> aHasZoomVect(
GetDocument().GetTableCount(),
false );
3798 sal_Int32 nTemp32(0);
3799 sal_Int16 nTemp16(0);
3800 sal_Int16 nFormulaBarLineCount(0);
3801 bool bPageMode(
false);
3805 for (
const auto& rSetting : rSettings)
3808 OUString
sName(rSetting.Name);
3811 uno::Reference<container::XNameContainer> xNameContainer;
3812 if ((rSetting.Value >>= xNameContainer) && xNameContainer->hasElements())
3814 const uno::Sequence< OUString > aNames(xNameContainer->getElementNames());
3815 for (
const OUString& sTabName : aNames)
3820 uno::Any aAny = xNameContainer->getByName(sTabName);
3821 uno::Sequence<beans::PropertyValue> aTabSettings;
3822 if (aAny >>= aTabSettings)
3828 bool bHasZoom =
false;
3829 maTabData[nTab]->ReadUserDataSequence(aTabSettings, *
this, nTab, bHasZoom);
3830 aHasZoomVect[nTab] = bHasZoom;
3839 if(rSetting.Value >>= sTabName)
3848 if (rSetting.Value >>= nTemp32)
3853 double fWidth = 0.0;
3854 if (rSetting.Value >>= fWidth)
3859 if (rSetting.Value >>= nTemp16)
3864 if (rSetting.Value >>= nTemp32)
3872 if (rSetting.Value >>= nTemp32)
3880 if (rSetting.Value >>= nFormulaBarLineCount)
3906 if (rSetting.Value >>= aColor)
3920 if ( rSetting.Value >>= nTemp16 )
3926 if ( rSetting.Value >>= nTemp16 )
3932 if ( rSetting.Value >>= nTemp16 )
3962 for (
SCTAB nZoomTab=0; nZoomTab< static_cast<SCTAB>(
maTabData.size()); ++nZoomTab)
3963 if (
maTabData[nZoomTab] && ( nZoomTab >=
static_cast<SCTAB>(aHasZoomVect.size()) || !aHasZoomVect[nZoomTab] ))
3972 if (rSettings.hasElements())
3993 OSL_ENSURE(
pView,
"No View" );
4003 OSL_ENSURE(
pView,
"GetMousePosPixel() without View" );
4034 sal_uInt16 nTSize = rLocalDoc.
GetColWidth( nX, nTab );
4042 if (nNewPos !=
maTabData[nTab]->nHSplitPos)
4069 sal_uInt16 nTSize = rLocalDoc.
GetRowHeight( nY, nTab );
4077 if (nNewPos !=
maTabData[nTab]->nVSplitPos)
4094 nCntrl |= EEControlBits::MARKNONURLFIELDS;
4096 nCntrl |= EEControlBits::AUTOCORRECT;
4098 nCntrl |= EEControlBits::ONLINESPELLING;
4138 while (rScrY <= nEndPixels && nRow <= nEndRow)
4140 SCROW nHeightEndRow;
4142 if (nHeightEndRow > nEndRow)
4143 nHeightEndRow = nEndRow;
4147 nRow = nHeightEndRow + 1;
4153 SCROW nRows = nHeightEndRow - nRow + 1;
4155 sal_Int64 nAdd =
nPixel * nRows;
4156 if (nAdd + rScrY > nEndPixels)
4158 sal_Int64 nDiff = rScrY + nAdd - nEndPixels;
4162 if (nAdd + rScrY <= nEndPixels)
4182 while (rScrY <= nEndPixels && nRow >= nStartRow)
4184 SCROW nHeightStartRow;
4186 if (nHeightStartRow < nStartRow)
4187 nHeightStartRow = nStartRow;
4189 nRow = nHeightStartRow - 1;
4192 SCROW nRows = nRow - nHeightStartRow + 1;
4194 sal_Int64 nAdd =
nPixel * nRows;
4195 if (nAdd + rScrY > nEndPixels)
4197 sal_Int64 nDiff = nAdd + rScrY - nEndPixels;
4201 if (nAdd + rScrY <= nEndPixels)
4219 return nFreezeIndex >= 0 ? nFreezeIndex : 0;
4230 SAL_WARN(
"sc.viewdata",
"ScViewData::SetLOKSheetFreezeIndex : invalid nForTab = " << nForTab);
4242 return colUnfreezed || rowUnfreezed;
4248 for (
SCTAB nTab = 0; nTab <= nMaxTab; ++nTab)
4256 SAL_WARN(
"sc.viewdata",
"ScViewData::DeriveLOKFreezeIfNeeded : invalid nForTab = " << nForTab);
4264 bool bConvertToFreezeX =
false;
4265 bool bConvertToFreezeY =
false;
4269 if (nFreezeCol == -1)
4275 bConvertToFreezeX =
true;
4280 if (nFreezeRow == -1)
4286 bConvertToFreezeY =
true;
4291 if (bConvertToFreezeX || bConvertToFreezeY)
4296 bConvertToFreezeY ? pViewTable->
nVSplitPos : 0,
4300 if (bConvertToFreezeX)
4302 if (bConvertToFreezeY)
4317 bool bConvertToScrPosX =
false;
4318 bool bConvertToScrPosY =
false;
4320 if (nFreezeCol >= 0)
4327 nExFixPosX = nFreezeCol;
4331 bConvertToScrPosX =
true;
4334 if (nFreezeRow >= 0)
4341 nExFixPosY = nFreezeRow;
4345 bConvertToScrPosY =
true;
4348 if (bConvertToScrPosX || bConvertToScrPosY)
4351 if (bConvertToScrPosX)
4352 nExHSplitPos = aExSplitPos.
X();
4353 if (bConvertToScrPosY)
4354 nExVSplitPos = aExSplitPos.
Y();
css::chart::ChartAxisLabelPosition ePos
#define SC_HORIZONTAL_SPLIT_POSITION
#define SC_VERTICALSPLITPOSITION_TWIPS
#define SC_TABLE_VIEWSETTINGS
#define SC_TABLE_ZOOM_VALUE
#define SC_VERTICAL_SPLIT_MODE
#define SC_VIEWSETTINGS_COUNT
#define SC_HORIZONTAL_SPLIT_MODE
#define SC_POSITION_RIGHT
constexpr OUStringLiteral SC_ACTIVESPLITRANGE
constexpr OUStringLiteral SC_SHOWPAGEBREAKPREVIEW
constexpr OUStringLiteral SC_HORIZONTALSCROLLBARWIDTH
constexpr OUStringLiteral SC_TABLES
#define SC_VERTICAL_SPLIT_POSITION
constexpr OUStringLiteral SC_POSITIONRIGHT
#define SC_FORMULA_BAR_HEIGHT_VALUE
#define SC_RELHORIZONTALTABBARWIDTH
constexpr OUStringLiteral SC_ZOOMVALUE
constexpr OUStringLiteral SC_CURSORPOSITIONY
constexpr OUStringLiteral SC_VERTICALSPLITMODE
#define SC_TABLE_SHOWGRID
#define SC_VALUE_HIGHLIGHTING
constexpr OUStringLiteral SC_POSITIONBOTTOM
constexpr OUStringLiteral SC_VERTICALSPLITPOSITION
constexpr OUStringLiteral SC_POSITIONLEFT
constexpr OUStringLiteral SC_VIEWID
constexpr OUStringLiteral SC_ZOOMTYPE
constexpr OUStringLiteral SC_HORIZONTALSPLITPOSITION
#define SC_ACTIVE_SPLIT_RANGE
#define SC_PAGE_VIEW_ZOOM_VALUE
constexpr OUStringLiteral SC_CURSORPOSITIONX
#define SC_HORIZONTAL_SCROLL_BAR_WIDTH
#define SC_SHOWFORMULASMARKS
constexpr OUStringLiteral SC_PAGEVIEWZOOMVALUE
constexpr OUStringLiteral SC_FORMULABARHEIGHT
constexpr OUStringLiteral SC_ACTIVETABLE
#define SC_TABLE_PAGE_VIEW_ZOOM_VALUE
#define SC_HORIZONTALSPLITPOSITION_TWIPS
#define SC_TABLE_ZOOM_TYPE
#define SC_TABLE_VIEWSETTINGS_COUNT
#define SC_PAGE_BREAK_PREVIEW
constexpr OUStringLiteral SC_POSITIONTOP
constexpr OUStringLiteral SC_HORIZONTALSPLITMODE
#define SC_POSITION_BOTTOM
bool ValidTab(SCTAB nTab)
const SCCOL SC_TABSTART_NONE
const SCTAB SC_TAB_APPEND
static OutputDevice * GetDefaultDevice()
bool IsTransparent() const
OUString GetText(LineEnd eEnd=LINEEND_LF) const
bool SetUpdateLayout(bool bUpdate, bool bRestoring=false)
EEControlBits GetControlWord() const
sal_Int32 GetParagraphCount() const
const Size & GetPaperSize() const
EditView * RemoveView(EditView *pEditView)
sal_uInt32 GetTextHeight() const
bool IsEffectivelyVertical() const
sal_uInt32 CalcTextWidth()
void SetControlWord(EEControlBits nWord)
void SetStatusEventHdl(const Link< EditStatus &, void > &rLink)
void SetPaperSize(const Size &rSize)
void SetLOKSpecialPaperSize(const Size &rSize)
void InsertView(EditView *pEditView, size_t nIndex=EE_APPEND)
const Size & GetLOKSpecialPaperSize() const
void SetLOKSpecialVisArea(const tools::Rectangle &rVisArea)
void SetControlWord(EVControlBits nWord)
void InvalidateOtherViewWindows(const tools::Rectangle &rInvRect)
void SetOutputArea(const tools::Rectangle &rRect)
tools::Rectangle GetVisArea() const
tools::Rectangle GetLOKSpecialVisArea() const