diff options
-rw-r--r-- | sc/source/core/tool/editutil.cxx | 6 | ||||
-rw-r--r-- | sc/source/ui/view/gridwin4.cxx | 16 | ||||
-rw-r--r-- | sc/source/ui/view/viewdata.cxx | 21 |
3 files changed, 30 insertions, 13 deletions
diff --git a/sc/source/core/tool/editutil.cxx b/sc/source/core/tool/editutil.cxx index be3f6a5e9d2e..2167cbbc971a 100644 --- a/sc/source/core/tool/editutil.cxx +++ b/sc/source/core/tool/editutil.cxx @@ -35,6 +35,7 @@ #include <svl/inethist.hxx> #include <unotools/syslocale.hxx> #include <sfx2/objsh.hxx> +#include <comphelper/lok.hxx> #include <osl/diagnose.h> #include <com/sun/star/text/textfield/Type.hpp> @@ -324,9 +325,10 @@ tools::Rectangle ScEditUtil::GetEditArea( const ScPatternAttr* pPattern, bool bF pPattern = pDoc->GetPattern( nCol, nRow, nTab ); Point aStartPos = aCellPos; + bool bIsTiledRendering = comphelper::LibreOfficeKit::isActive(); bool bLayoutRTL = pDoc->IsLayoutRTL( nTab ); - tools::Long nLayoutSign = bLayoutRTL ? -1 : 1; + tools::Long nLayoutSign = (bLayoutRTL && !bIsTiledRendering) ? -1 : 1; const ScMergeAttr* pMerge = &pPattern->GetItem(ATTR_MERGE); tools::Long nCellX = pDoc->GetColWidth(nCol,nTab); @@ -425,7 +427,7 @@ tools::Rectangle ScEditUtil::GetEditArea( const ScPatternAttr* pPattern, bool bF aStartPos.AdjustY(nDifY ); nCellY -= nDifY; - if ( bLayoutRTL ) + if ( bLayoutRTL && !bIsTiledRendering ) aStartPos.AdjustX( -(nCellX - 2) ); // excluding grid on both sides // -1 -> don't overwrite grid diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx index 6a644786906d..ded37621e12f 100644 --- a/sc/source/ui/view/gridwin4.cxx +++ b/sc/source/ui/view/gridwin4.cxx @@ -1129,6 +1129,18 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI Point aStart = mrViewData.GetScrPos( nCol1, nRow1, eWhich ); Point aEnd = mrViewData.GetScrPos( nCol2+1, nRow2+1, eWhich ); + if (bIsTiledRendering && bLayoutRTL) + { + // Transform the cell range X coordinates such that the edit cell area is + // horizontally mirrored w.r.t the (combined-)tile. + tools::Long nStartTileX = -aOriginalMode.GetOrigin().X() / TWIPS_PER_PIXEL; + // Note: nStartTileX is scaled by 2 only to offset for the addition of + // the -ve of the same qty (and nScrX) few lines below. + tools::Long nMirrorX = 2 * nStartTileX + aOutputData.GetScrW(); + aStart.setX(nMirrorX - 1 - aStart.X()); + aEnd.setX(nMirrorX - 1 - aEnd.X()); + } + // don't overwrite grid tools::Long nLayoutSign = bLayoutRTL ? -1 : 1; aEnd.AdjustX( -(2 * nLayoutSign) ); @@ -1136,7 +1148,9 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI // set the correct mapmode tools::Rectangle aBackground(aStart, aEnd); - tools::Rectangle aBGAbs(aStart, aEnd); + if (bIsTiledRendering && bLayoutRTL) + aBackground.Justify(); + tools::Rectangle aBGAbs(aBackground); if (bIsTiledRendering) { diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx index a2bf70ff6199..6e2bf8ee0aa4 100644 --- a/sc/source/ui/view/viewdata.cxx +++ b/sc/source/ui/view/viewdata.cxx @@ -1647,6 +1647,7 @@ void ScViewData::SetEditEngine( ScSplitPos eWhich, // (existing or started) with default alignment extend to the right. bool bGrowCentered = ( eJust == SvxCellHorJustify::Center ); bool bGrowToLeft = ( eJust == SvxCellHorJustify::Right ); // visual left + bool bLOKRTLInvert = (bLOKActive && bLayoutRTL); if ( bAsianVertical ) bGrowCentered = bGrowToLeft = false; // keep old behavior for asian mode @@ -1690,7 +1691,7 @@ void ScViewData::SetEditEngine( ScSplitPos eWhich, nSizeXPTwips = aPTwipsRect.GetWidth() + 2 * std::min(nLeftPTwips, nRightPTwips); } } - else if ( bGrowToLeft ) + else if ( (bGrowToLeft && !bLOKRTLInvert) || (!bGrowToLeft && bLOKRTLInvert) ) { nSizeXPix = aPixRect.Right(); // space that's available in the window when growing to the left if (bLOKPrintTwips) @@ -1925,12 +1926,12 @@ void ScViewData::EditGrowX() nLogicRightPTwips = nColWidth; } - aArea.AdjustLeft( -(bLayoutRTL ? nLogicRight : nLogicLeft) ); - aArea.AdjustRight(bLayoutRTL ? nLogicLeft : nLogicRight ); + aArea.AdjustLeft( -((bLayoutRTL && !bLOKActive) ? nLogicRight : nLogicLeft) ); + aArea.AdjustRight((bLayoutRTL && !bLOKActive) ? nLogicLeft : nLogicRight ); if (bLOKPrintTwips) { - aAreaPTwips.AdjustLeft( -(bLayoutRTL ? nLogicRightPTwips : nLogicLeftPTwips) ); - aAreaPTwips.AdjustRight(bLayoutRTL ? nLogicLeftPTwips : nLogicRightPTwips ); + aAreaPTwips.AdjustLeft( -((bLayoutRTL && !bLOKActive) ? nLogicRightPTwips : nLogicLeftPTwips) ); + aAreaPTwips.AdjustRight((bLayoutRTL && !bLOKActive) ? nLogicLeftPTwips : nLogicRightPTwips ); } if ( aArea.Right() > aArea.Left() + aSize.Width() - 1 ) @@ -1964,7 +1965,7 @@ void ScViewData::EditGrowX() tools::Long nLogicWidth = pWin->PixelToLogic(Size(nPix,0)).Width(); tools::Long& nLogicWidthPTwips = nColWidth; - if ( !bLayoutRTL ) + if ( !bLayoutRTL || bLOKActive ) { aArea.AdjustLeft( -nLogicWidth ); if (bLOKPrintTwips) @@ -1979,7 +1980,7 @@ void ScViewData::EditGrowX() if ( aArea.Right() > aArea.Left() + aSize.Width() - 1 ) { - if ( !bLayoutRTL ) + if ( !bLayoutRTL || bLOKActive ) { aArea.SetLeft( aArea.Right() - aSize.Width() + 1 ); if (bLOKPrintTwips) @@ -2005,7 +2006,7 @@ void ScViewData::EditGrowX() tools::Long nPix = ToPixel( nColWidth, nPPTX ); tools::Long nLogicWidth = pWin->PixelToLogic(Size(nPix,0)).Width(); tools::Long& nLogicWidthPTwips = nColWidth; - if ( bLayoutRTL ) + if ( bLayoutRTL && !bLOKActive ) { aArea.AdjustLeft( -nLogicWidth ); if (bLOKPrintTwips) @@ -2020,7 +2021,7 @@ void ScViewData::EditGrowX() if ( aArea.Right() > aArea.Left() + aSize.Width() - 1 ) { - if ( bLayoutRTL ) + if ( bLayoutRTL && !bLOKActive ) { aArea.SetLeft( aArea.Right() - aSize.Width() + 1 ); if (bLOKPrintTwips) @@ -2513,7 +2514,7 @@ Point ScViewData::GetScrPos( SCCOL nWhereX, SCROW nWhereY, ScSplitPos eWhich, } } - if (mrDoc.IsLayoutRTL(nForTab)) + if (mrDoc.IsLayoutRTL(nForTab) && !bIsTiledRendering) { // mirror horizontal position nScrPosX = aScrSize.Width() - 1 - nScrPosX; |