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));
852 xTabData->InitData(
mrDoc);
892 collectUIInformation({{}},
"InsertTab");
906 for (
SCTAB i = nTab;
i < nTab + nNewSheets; ++
i)
950 OSL_FAIL(
"too many sheets");
955 OSL_FAIL(
"pTabData out of bounds, FIX IT");
972 std::unique_ptr<ScViewDataTable> pTab;
994 for (
const auto& rTab : rvTabs )
1000 bool bAll = tabs.empty();
1010 i->eZoomType = eNew;
1016 for (
const SCTAB&
i : tabs )
1026 std::vector< SCTAB > vTabs;
1030 vTabs.insert(vTabs.begin(), itr, itrEnd);
1037 bool bAll = tabs.empty();
1043 "fraction rNewX not sensible: " <<
static_cast<double>(rNewX));
1045 "fraction rNewY not sensible: " <<
static_cast<double>(rNewY));
1055 i->aPageZoomX = rNewX;
1056 i->aPageZoomY = rNewY;
1078 for (
const SCTAB&
i : tabs )
1100 std::vector< SCTAB > vTabs;
1104 vTabs.insert(vTabs.begin(), itr, itrEnd);
1106 SetZoom( rNewX, rNewY, vTabs );
1162 if ( nRow < 1 || nCol < 1 )
1192 aRange.
GetVars( rStartCol, rStartRow, rStartTab, rEndCol, rEndRow, rEndTab);
1337 const sal_Int32 kMax = 23 * 1024 * 1024;
1413 return maTabData[nForTab]->nPosX[eWhich];
1427 return maTabData[nForTab]->nPosY[eWhich];
1467 auto GetColWidthPx = [
this, nTab](
SCCOL nCol) {
1475 SAL_INFO(
"sc.lok.docsize",
"ScViewData::SetMaxTiledCol: nNewMaxCol: "
1476 << nNewMaxCol <<
", nTotalPixels: " << nTotalPixels);
1492 auto GetRowHeightPx = [
this, nTab](
SCROW nRow) {
1500 SAL_INFO(
"sc.lok.docsize",
"ScViewData::SetMaxTiledRow: nNewMaxRow: "
1501 << nNewMaxRow <<
", nTotalPixels: " << nTotalPixels);
1511 bool bForceToTop,
bool bInPrintTwips )
1513 Point aCellTopLeft = bInPrintTwips ?
1529 comphelper::LibreOfficeKit::Compat::scPrintTwipsMsgs);
1531 bool bWasThere =
false;
1542 pEditView[eWhich]->SetEditEngine(pNewEngine);
1545 if (
pEditView[eWhich]->GetWindow() != pWin)
1549 OSL_FAIL(
"EditView Window has changed");
1559 pEditView[eWhich]->SetBroadcastLOKViewCursor(bLOKPrintTwips);
1565 if (!bWasThere && bLOKActive)
1570 [pThisViewShell, nThisTabNo, eWhich] (
ScTabViewShell* pOtherViewShell)
1572 ScViewData& rOtherViewData = pOtherViewShell->GetViewData();
1574 if (nThisTabNo == nOtherTabNo)
1575 pOtherViewShell->AddWindowToForeignEditView(pThisViewShell, eWhich);
1587 pEditView[eWhich]->SetControlWord(nVC & ~EVControlBits::AUTOSCROLL);
1594 bool bBreak = ( eJust == SvxCellHorJustify::Block ) ||
1613 if (
GetEditAdjust() == SvxAdjust::Right || bAsianVertical )
1622 if (!
pEditView[eWhich]->HasLOKSpecialPositioning())
1623 pEditView[eWhich]->InitLOKSpecialPositioning(MapUnit::MapTwip, aPTwipsRect,
Point());
1625 pEditView[eWhich]->SetLOKSpecialOutputArea(aPTwipsRect);
1629 pEditView[eWhich]->SetOutputArea( aOutputArea );
1651 bool bGrowCentered = ( eJust == SvxCellHorJustify::Center );
1652 bool bGrowToLeft = ( eJust == SvxCellHorJustify::Right );
1653 bool bLOKRTLInvert = (bLOKActive && bLayoutRTL);
1654 if ( bAsianVertical )
1655 bGrowCentered = bGrowToLeft =
false;
1661 tools::Long nGridWidthTwips = 0, nGridHeightTwips = 0;
1664 Size aGridSize(nGridWidthPx, nGridHeightPx);
1668 rWinMapMode,
MapMode(MapUnit::MapTwip));
1669 nGridWidthTwips = aGridSize.
Width();
1670 nGridHeightTwips = aGridSize.
Height();
1673 if (bBreak && !bAsianVertical)
1677 nSizeXPTwips = aPTwipsRect.
GetWidth();
1681 OSL_ENSURE(
pView,
"no View for EditView");
1683 if ( bGrowCentered )
1689 nSizeXPix = aPixRect.
GetWidth() + 2 * std::min( nLeft, nRight );
1694 nSizeXPTwips = aPTwipsRect.
GetWidth() + 2 * std::min(nLeftPTwips, nRightPTwips);
1697 else if ( (bGrowToLeft && !bLOKRTLInvert) || (!bGrowToLeft && bLOKRTLInvert) )
1699 nSizeXPix = aPixRect.
Right();
1701 nSizeXPTwips = aPTwipsRect.
Right();
1705 nSizeXPix = nGridWidthPx - aPixRect.
Left();
1707 nSizeXPTwips = nGridWidthTwips - aPTwipsRect.
Left();
1710 if ( nSizeXPix <= 0 )
1714 nSizeXPTwips = aPTwipsRect.
GetWidth();
1717 OSL_ENSURE(
pView,
"no View for EditView");
1719 tools::Long nSizeYPTwips = bLOKPrintTwips ? (nGridHeightTwips - aPTwipsRect.
Top()) : 0;
1721 if ( nSizeYPix <= 0 )
1729 Size aPaperSizePTwips(nSizeXPTwips, nSizeYPTwips);
1730 if ( bBreak && !bAsianVertical &&
SC_MOD()->GetInputOptions().GetTextWysiwyg() )
1755 aVisPTwips =
pEditView[eWhich]->GetLOKSpecialVisArea();
1770 aVisPTwips.
SetRight( ( aPaperSizePTwips.
Width() - 1 + nDiffPTwips ) / 2 );
1791 pEditView[eWhich]->SetLOKSpecialVisArea(aVisPTwips);
1802 if (aDocPos.Y() < aOutputArea.
Top())
1803 pEditView[eWhich]->Scroll( 0, aOutputArea.
Top() - aDocPos.Y() );
1819 pEditView[eWhich]->SetBackgroundColor( aBackCol );
1828 if (nStatus & (EditStatusFlags::HSCROLL | EditStatusFlags::TextHeightChanged | EditStatusFlags::TEXTWIDTHCHANGED | EditStatusFlags::CURSOROUT))
1833 if (nStatus & EditStatusFlags::CURSOROUT)
1836 if (pEditView[eWhich])
1837 pEditView[eWhich]->ShowCursor(
false);
1856 comphelper::LibreOfficeKit::Compat::scPrintTwipsMsgs);
1892 bool bChanged =
false;
1898 bool bGrowCentered = ( eJust == SvxCellHorJustify::Center );
1899 bool bGrowToLeft = ( eJust == SvxCellHorJustify::Right );
1900 bool bGrowBackwards = bGrowToLeft;
1902 bGrowBackwards = !bGrowBackwards;
1903 if ( bAsianVertical )
1904 bGrowCentered = bGrowToLeft = bGrowBackwards =
false;
1906 bool bUnevenGrow =
false;
1907 if ( bGrowCentered )
1920 nLogicLeftPTwips = nColWidth;
1931 nLogicRightPTwips = nColWidth;
1934 aArea.
AdjustLeft( -((bLayoutRTL && !bLOKActive) ? nLogicRight : nLogicLeft) );
1935 aArea.
AdjustRight((bLayoutRTL && !bLOKActive) ? nLogicLeft : nLogicRight );
1946 aArea.
SetLeft( nCenter - nHalf + 1 );
1953 aAreaPTwips.
SetLeft( nCenterPTwips - nHalfPTwips + 1 );
1954 aAreaPTwips.
SetRight( nCenterPTwips + aSizePTwips.
Width() - nHalfPTwips - 1 );
1959 if ( nLogicLeft != nLogicRight )
1963 else if ( bGrowBackwards )
1973 if ( !bLayoutRTL || bLOKActive )
1977 aAreaPTwips.
AdjustLeft( -nLogicWidthPTwips );
1988 if ( !bLayoutRTL || bLOKActive )
2014 if ( bLayoutRTL && !bLOKActive )
2027 if ( bLayoutRTL && !bLOKActive )
2046 if (
bMoveArea || bGrowCentered || bGrowBackwards || bLayoutRTL )
2053 if ( bGrowCentered )
2061 aVis.
SetLeft( nCenter - nVisSize / 2 );
2068 aVisPTwips.
SetLeft( nCenterPTwips - nVisSizePTwips / 2 );
2069 aVisPTwips.
SetRight( aVisPTwips.
Left() + nVisSizePTwips - 1 );
2072 else if ( bGrowToLeft )
2126 else if ( !bAsianVertical && !bGrowToLeft && !bGrowCentered )
2143 comphelper::LibreOfficeKit::Compat::scPrintTwipsMsgs);
2153 if ( nControl & EVControlBits::AUTOSCROLL )
2193 OUString aText = pEngine->
GetText( 0 );
2194 if ( ( aText.isEmpty() && bInitial ) || aText.startsWith(
"=") )
2198 bool bChanged =
false;
2199 bool bMaxReached =
false;
2200 while (aArea.
GetHeight() + nAllowedExtra < nTextHeight &&
nEditEndRow < nBottom && !bMaxReached)
2232 if (!(nControl & EVControlBits::AUTOSCROLL))
2233 pCurView->
SetControlWord( nControl | EVControlBits::AUTOSCROLL );
2236 aArea.
SetTop( nOldBottom );
2246 for (sal_uInt16
i=0;
i<4;
i++)
2266 for (sal_uInt16
i=0;
i<4;
i++)
2318 OSL_FAIL(
"wrong sheet number");
2337 return &(
maTabData[nTabIndex]->aWidthHelper);
2347 return &(
maTabData[nTabIndex]->aHeightHelper);
2376 bool bAllowNeg,
SCTAB nForTab )
const
2402 bool bForCurTab = (nForTab ==
nTabNo);
2405 SAL_WARN(
"sc.viewdata",
"ScViewData::GetScrPos : invalid nForTab = " << nForTab);
2424 if (bAllowNeg || nWhereX >= nPosX)
2426 SCROW nStartPosX = nPosX;
2427 if (bIsTiledRendering)
2429 OSL_ENSURE(nPosX == 0,
"Unsupported case.");
2431 nStartPosX = rNearest.first + 1;
2432 nScrPosX = rNearest.second;
2435 if (nWhereX >= nStartPosX)
2437 for (
SCCOL nX = nStartPosX; nX < nWhereX && (bAllowNeg || bIsTiledRendering || nScrPosX <=
aScrSize.
Width()); nX++)
2440 nScrPosX = 0x7FFFFFFF;
2447 nScrPosX += nSizeXPix;
2451 SCCOL lastHidden = -1;
2452 if(
mrDoc.
ColHidden(nX, nForTab,
nullptr, &lastHidden) && lastHidden > nX)
2453 nX = lastHidden - 1;
2460 for (
SCCOL nX = nStartPosX; nX > nWhereX;)
2467 nScrPosX -= nSizeXPix;
2471 SCCOL firstHidden = -1;
2472 if(
mrDoc.
ColHidden(nX, nForTab, &firstHidden,
nullptr) && firstHidden >= 0)
2484 if (bAllowNeg || nWhereY >= nPosY)
2486 SCROW nStartPosY = nPosY;
2487 if (bIsTiledRendering)
2489 OSL_ENSURE(nPosY == 0,
"Unsupported case.");
2491 nStartPosY = rNearest.first + 1;
2492 nScrPosY = rNearest.second;
2495 if (nWhereY >= nStartPosY)
2497 for (
SCROW nY = nStartPosY; nY < nWhereY && (bAllowNeg || bIsTiledRendering || nScrPosY <=
aScrSize.
Height()); nY++)
2500 nScrPosY = 0x7FFFFFFF;
2507 nScrPosY += nSizeYPix;
2523 for (
SCROW nY = nStartPosY; nY > nWhereY;)
2530 nScrPosY -= nSizeYPix;
2534 SCROW firstHidden = -1;
2535 if(
mrDoc.
RowHidden(nY, nForTab, &firstHidden,
nullptr) && firstHidden >= 0)
2548 return Point( nScrPosX, nScrPosY );
2560 return Point(nPosX, nPosY);
2573 const Point aTileTwipsCellPos(aPixCellPos.X() /
nPPTX, aPixCellPos.Y() /
nPPTY);
2575 return aPrintTwipsCellPos + (rTileTwipsPos - aTileTwipsCellPos);
2580 const bool bPosSizeInPixels = bPixelAligned;
2586 if (bPosSizeInPixels)
2592 if (bPosSizeInPixels)
2604 tools::Long nPosXTw = rtl::math::round(aCellPos.getX() / fPPTX);
2605 tools::Long nPosYTw = rtl::math::round(aCellPos.getY() / fPPTY);
2607 tools::Long nSizeXTw = rtl::math::round(nSizeX / fPPTX) - 1;
2608 tools::Long nSizeYTw = rtl::math::round(nSizeY / fPPTY) - 1;
2610 ss << nPosXTw <<
", " << nPosYTw <<
", " << nSizeXTw <<
", " << nSizeYTw <<
", "
2611 << nX <<
", " << nY;
2620 ss << aCellPos.getX() <<
", " << aCellPos.getY()
2621 <<
", " << nSizeX <<
", " << nSizeY <<
", "
2622 << nX <<
", " << nY;
2625 return ss.str().c_str();
2631 OSL_ENSURE( nDir==1 || nDir==-1,
"wrong CellsAt call" );
2637 sal_uInt16 nScrPosX = 0;
2646 for ( ; nScrPosX<=nScrSizeX && !bOut; nX = sal::static_int_cast<SCCOL>(nX + nDir) )
2657 nScrPosX = sal::static_int_cast<sal_uInt16>( nScrPosX +
static_cast<sal_uInt16
>(nSizeXPix) );
2663 nX = sal::static_int_cast<SCCOL>( nX - nPosX );
2673 OSL_ENSURE( nDir==1 || nDir==-1,
"wrong CellsAt call" );
2699 nY -= (nY == 0 ? 2 : 1);
2739 for (
SCROW nRow = nY; nRow <= nY+nCountY-1; ++nRow)
2741 SCROW nLastRow = nRow;
2752 rSizeXPix = nOutWidth;
2753 rSizeYPix = nOutHeight;
2777 return (nCountX > 1 || nCountY > 1);
2782 bool bTestMerge,
bool bRepair,
SCTAB nForTab )
2788 bool bForCurTab = (nForTab ==
nTabNo);
2791 SAL_WARN(
"sc.viewdata",
"ScViewData::GetPosFromPixel : invalid nForTab = " << nForTab);
2819 while (rPosX <=
mrDoc.
MaxCol() && nClickX >= nScrX)
2828 while ( rPosX>0 && nClickX < nScrX )
2840 while ( rPosY>0 && nClickY < nScrY )
2848 if ( rPosX == nStartPosX && nClickX > 0 )
2855 if ( rPosY == nStartPosY && nClickY > 0 )
2866 if (!(bTestMerge && bForCurTab))
2870 SCCOL nOrigX = rPosX;
2871 SCROW nOrigY = rPosY;
2873 bool bHOver = (nOrigX != rPosX);
2874 bool bVOver = (nOrigY != rPosY);
2876 if ( !(bRepair && ( bHOver || bVOver )) )
2883 OSL_FAIL(
"merge error found");
2896 SCCOL nPosX,
SCROW nPosY,
bool& rLeft,
bool& rTop )
2905 rLeft = ( rClickPos.X() - aCellStart.X() ) * nLayoutSign <= nSizeX / 2;
2906 rTop = rClickPos.Y() - aCellStart.Y() <= nSizeY / 2;
2913 if (nNewPosX != 0 && !bIsTiledRendering)
2919 if ( nNewPosX > nOldPosX )
2920 for (
i=nOldPosX;
i<nNewPosX;
i++ )
2924 nPixPosX -=
ToPixel(sal::static_int_cast<sal_uInt16>(nThis),
nPPTX);
2927 for (
i=nNewPosX;
i<nOldPosX;
i++ )
2931 nPixPosX +=
ToPixel(sal::static_int_cast<sal_uInt16>(nThis),
nPPTX);
2952 if (nNewPosY != 0 && !bIsTiledRendering)
2958 if ( nNewPosY > nOldPosY )
2959 for (
i=nOldPosY;
i<nNewPosY;
i++ )
2962 SCROW nRows = std::min( nNewPosY, nHeightEndRow + 1) -
i;
2964 nTPosY -= nThis * nRows;
2965 nPixPosY -=
ToPixel(sal::static_int_cast<sal_uInt16>(nThis),
nPPTY) * nRows;
2968 for (
i=nNewPosY;
i<nOldPosY;
i++ )
2971 SCROW nRows = std::min( nOldPosY, nHeightEndRow + 1) -
i;
2973 nTPosY += nThis * nRows;
2974 nPixPosY +=
ToPixel(sal::static_int_cast<sal_uInt16>(nThis),
nPPTY) * nRows;
2993 for (sal_uInt16 eWhich=0; eWhich<2; eWhich++)
3004 SCROW nLastSameHeightRow = -1;
3005 for (
SCROW j=0; j<nPosY; j++)
3007 if(nLastSameHeightRow < j)
3009 nPixPosY -= nRowHeight;
3041 for (nCol=nCol1; nCol<=nCol2; nCol++)
3047 nScrPosX +=
static_cast<sal_uInt16
>(nSizePix);
3051 for (nRow=nRow1; nRow<=nRow2; nRow++)
3057 nScrPosY +=
static_cast<sal_uInt16
>(nSizePix);
3080 if (nSize + nAdd <= nTwips + 1 && nX1 <
mrDoc.
MaxCol())
3096 if (nSize + nAdd <= nTwips + 1 && nY1 <
mrDoc.
MaxRow())
3131 assert(
pView &&
"GetBindings() without ViewShell");
3137 assert(
pView &&
"GetDispatcher() without ViewShell");
3153 assert(
pView &&
"GetDialogParent() without ViewShell");
3159 assert(
pView &&
"GetActiveWin() without View");
3165 assert(
pView &&
"GetActiveWin() without View");
3171 assert(
pView &&
"GetScDrawView() without View");
3177 assert(
pView &&
"IsMinimized() without View");
3186 SetZoom( rNewX, rNewY,
false );
3202 double nOldPPTX =
nPPTX;
3203 double nOldPPTY =
nPPTY;
3224 double fOriginal = nTwips *
nPPTX;
3225 if ( fOriginal <
static_cast<double>(nEndCol) )
3230 double fRounded = ::rtl::math::approxFloor( fOriginal + 0.5 );
3231 if ( fRounded > 0.0 )
3233 double fScale = fRounded / fOriginal + 1
E-6;
3234 if ( fScale >= 0.9 && fScale <= 1.1 )
3245 bool bResetWidths = (
nPPTX != nOldPPTX);
3246 bool bResetHeights = (
nPPTY != nOldPPTY);
3247 for (
SCTAB nTabIdx = 0; nTabIdx < nTabCount; ++nTabIdx)
3254 pWHelper->invalidateByPosition(0L);
3258 pHHelper->invalidateByPosition(0L);
3262#define SC_OLD_TABSEP '/'
3263#define SC_NEW_TABSEP '+'
3276 rData = OUString::number( nZoom ) +
"/";
3278 rData += OUString::number( nZoom ) +
"/";
3302 rData += OUString::number(
maTabData[
i]->nCurX ) + cTabSep +
3303 OUString::number(
maTabData[
i]->nCurY ) + cTabSep +
3304 OUString::number(
maTabData[
i]->eHSplitMode ) + cTabSep +
3305 OUString::number(
maTabData[
i]->eVSplitMode ) + cTabSep;
3307 rData += OUString::number(
maTabData[
i]->nFixPosX );
3309 rData += OUString::number(
maTabData[
i]->nHSplitPos );
3312 rData += OUString::number(
maTabData[
i]->nFixPosY );
3314 rData += OUString::number(
maTabData[
i]->nVSplitPos );
3316 OUString::number(
maTabData[
i]->eWhichActive ) + cTabSep +
3317 OUString::number(
maTabData[
i]->nPosX[0] ) + cTabSep +
3318 OUString::number(
maTabData[
i]->nPosX[1] ) + cTabSep +
3319 OUString::number(
maTabData[
i]->nPosY[0] ) + cTabSep +
3334 OSL_FAIL(
"ReadUserData: This is not my data");
3338 sal_Int32 nMainIdx {0};
3341 std::u16string_view aZoomStr =
o3tl::getToken(rData, 0,
';', nMainIdx);
3352 const sal_Int32 nMainIdxRef {nMainIdx};
3353 std::u16string_view aTabOpt =
o3tl::getToken(rData, 0,
';', nMainIdx);
3355 std::u16string_view aRest;
3363 nMainIdx = nMainIdxRef;
3368 while ( nMainIdx>0 )
3440 for(
SCTAB nTab = 0; nTab < static_cast<SCTAB>(
maTabData.size()); ++nTab )
3449 SCCOL nExFixPosX = pViewTab->nFixPosX;
3450 SCROW nExFixPosY = pViewTab->nFixPosY;
3457 nExFixPosX, nExFixPosY,
3458 nExHSplitPos, nExVSplitPos, nTab);
3465 OSL_ENSURE( !bRealSplit || !bFrozen,
"ScViewData::WriteExtOptions - split and freeze in same sheet" );
3474 rSplitPos =
Point( bHSplit ? nExHSplitPos : 0, bVSplit ? nExVSplitPos : 0 );
3490 switch( pViewTab->eWhichActive )
3511 rTabSett.
maCursor.
Set( pViewTab->nCurX, pViewTab->nCurY, nTab );
3555 for(
SCTAB nTab = 0; nTab < static_cast<SCTAB>(
maTabData.size()); ++nTab )
3614 aPixel.setX(
static_cast<tools::Long>( aPixel.X() * nFactor + 0.5 ) );
3617 bHSplit = bHSplit && aPixel.X() > 0;
3618 bVSplit = bVSplit && aPixel.Y() > 0;
3705 beans::PropertyValue* pSettings = rSettings.getArray();
3711 uno::Reference<container::XNameContainer> xNameContainer =
3713 for (
SCTAB nTab=0; nTab<static_cast<SCTAB>(
maTabData.size()); nTab++)
3717 uno::Sequence <beans::PropertyValue> aTableViewSettings;
3718 maTabData[nTab]->WriteUserDataSequence(aTableViewSettings, *
this, nTab);
3723 xNameContainer->insertByName(sTabName,
uno::Any(aTableViewSettings));
3726 catch ( container::ElementExistException& )
3728 OSL_FAIL(
"seems there are two tables with the same name");
3730 catch ( uno::RuntimeException& )
3732 OSL_FAIL(
"something went wrong");
3765 OUString aColorName;
3803 std::vector<bool> aHasZoomVect(
GetDocument().GetTableCount(),
false );
3805 sal_Int32 nTemp32(0);
3806 sal_Int16 nTemp16(0);
3807 sal_Int16 nFormulaBarLineCount(0);
3808 bool bPageMode(
false);
3812 for (
const auto& rSetting : rSettings)
3815 OUString
sName(rSetting.Name);
3818 uno::Reference<container::XNameContainer> xNameContainer;
3819 if ((rSetting.Value >>= xNameContainer) && xNameContainer->hasElements())
3821 const uno::Sequence< OUString > aNames(xNameContainer->getElementNames());
3822 for (
const OUString& sTabName : aNames)
3827 uno::Any aAny = xNameContainer->getByName(sTabName);
3828 uno::Sequence<beans::PropertyValue> aTabSettings;
3829 if (aAny >>= aTabSettings)
3835 bool bHasZoom =
false;
3836 maTabData[nTab]->ReadUserDataSequence(aTabSettings, *
this, nTab, bHasZoom);
3837 aHasZoomVect[nTab] = bHasZoom;
3846 if(rSetting.Value >>= sTabName)
3855 if (rSetting.Value >>= nTemp32)
3860 double fWidth = 0.0;
3861 if (rSetting.Value >>= fWidth)
3866 if (rSetting.Value >>= nTemp16)
3871 if (rSetting.Value >>= nTemp32)
3879 if (rSetting.Value >>= nTemp32)
3887 if (rSetting.Value >>= nFormulaBarLineCount)
3913 if (rSetting.Value >>= aColor)
3932 if ( rSetting.Value >>= nTemp16 )
3938 if ( rSetting.Value >>= nTemp16 )
3944 if ( rSetting.Value >>= nTemp16 )
3974 for (
SCTAB nZoomTab=0; nZoomTab< static_cast<SCTAB>(
maTabData.size()); ++nZoomTab)
3975 if (
maTabData[nZoomTab] && ( nZoomTab >=
static_cast<SCTAB>(aHasZoomVect.size()) || !aHasZoomVect[nZoomTab] ))
3984 if (rSettings.hasElements())
4005 OSL_ENSURE(
pView,
"No View" );
4015 OSL_ENSURE(
pView,
"GetMousePosPixel() without View" );
4046 sal_uInt16 nTSize = rLocalDoc.
GetColWidth( nX, nTab );
4054 if (nNewPos !=
maTabData[nTab]->nHSplitPos)
4081 sal_uInt16 nTSize = rLocalDoc.
GetRowHeight( nY, nTab );
4089 if (nNewPos !=
maTabData[nTab]->nVSplitPos)
4106 nCntrl |= EEControlBits::MARKNONURLFIELDS;
4108 nCntrl |= EEControlBits::AUTOCORRECT;
4110 nCntrl |= EEControlBits::ONLINESPELLING;
4150 while (rScrY <= nEndPixels && nRow <= nEndRow)
4152 SCROW nHeightEndRow;
4154 if (nHeightEndRow > nEndRow)
4155 nHeightEndRow = nEndRow;
4159 nRow = nHeightEndRow + 1;
4165 SCROW nRows = nHeightEndRow - nRow + 1;
4167 sal_Int64 nAdd =
nPixel * nRows;
4168 if (nAdd + rScrY > nEndPixels)
4170 sal_Int64 nDiff = rScrY + nAdd - nEndPixels;
4174 if (nAdd + rScrY <= nEndPixels)
4194 while (rScrY <= nEndPixels && nRow >= nStartRow)
4196 SCROW nHeightStartRow;
4198 if (nHeightStartRow < nStartRow)
4199 nHeightStartRow = nStartRow;
4201 nRow = nHeightStartRow - 1;
4204 SCROW nRows = nRow - nHeightStartRow + 1;
4206 sal_Int64 nAdd =
nPixel * nRows;
4207 if (nAdd + rScrY > nEndPixels)
4209 sal_Int64 nDiff = nAdd + rScrY - nEndPixels;
4213 if (nAdd + rScrY <= nEndPixels)
4231 return nFreezeIndex >= 0 ? nFreezeIndex : 0;
4242 SAL_WARN(
"sc.viewdata",
"ScViewData::SetLOKSheetFreezeIndex : invalid nForTab = " << nForTab);
4254 return colUnfreezed || rowUnfreezed;
4260 for (
SCTAB nTab = 0; nTab <= nMaxTab; ++nTab)
4268 SAL_WARN(
"sc.viewdata",
"ScViewData::DeriveLOKFreezeIfNeeded : invalid nForTab = " << nForTab);
4276 bool bConvertToFreezeX =
false;
4277 bool bConvertToFreezeY =
false;
4281 if (nFreezeCol == -1)
4287 bConvertToFreezeX =
true;
4292 if (nFreezeRow == -1)
4298 bConvertToFreezeY =
true;
4303 if (bConvertToFreezeX || bConvertToFreezeY)
4308 bConvertToFreezeY ? pViewTable->
nVSplitPos : 0,
4312 if (bConvertToFreezeX)
4314 if (bConvertToFreezeY)
4329 bool bConvertToScrPosX =
false;
4330 bool bConvertToScrPosY =
false;
4332 if (nFreezeCol >= 0)
4339 nExFixPosX = nFreezeCol;
4343 bConvertToScrPosX =
true;
4346 if (nFreezeRow >= 0)
4353 nExFixPosY = nFreezeRow;
4357 bConvertToScrPosY =
true;
4360 if (bConvertToScrPosX || bConvertToScrPosY)
4363 if (bConvertToScrPosX)
4364 nExHSplitPos = aExSplitPos.X();
4365 if (bConvertToScrPosY)
4366 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)