editeng/source/editeng/editeng.cxx |   10 ++++++++++
 editeng/source/editeng/impedit.hxx |    4 ++++
 include/editeng/editeng.hxx        |    3 +++
 sc/source/ui/view/viewdata.cxx     |   10 +++++-----
 4 files changed, 22 insertions(+), 5 deletions(-)

New commits:
commit e02bd1b5aa22c463fbb985df546edc94e63a7c98
Author:     Dennis Francis <dennis.fran...@collabora.com>
AuthorDate: Wed Jun 3 21:33:24 2020 +0530
Commit:     Dennis Francis <dennis.fran...@collabora.com>
CommitDate: Mon Jul 6 17:44:55 2020 +0200

    scPrintTwipsMsgs: Use print-twips paper-size
    
    Paper size for the EditEngine is calculated based on per-cell pixel
    alignment. So lets use the exact print-twips version whenever we need it
    to compute/adjust output-area and visible-area of EditView.
    
    Change-Id: I7da6db9363d09965315ff5ca9d01f0fea141a533
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98066
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Dennis Francis <dennis.fran...@collabora.com>

diff --git a/editeng/source/editeng/editeng.cxx 
b/editeng/source/editeng/editeng.cxx
index 5a91e29f0074..e68a4cb57663 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -2816,6 +2816,16 @@ void EditEngine::DisableAttributeExpanding() {
     pImpEditEngine->GetEditDoc().DisableAttributeExpanding();
 }
 
+void EditEngine::SetLOKSpecialPaperSize(const Size& rSize)
+{
+    pImpEditEngine->SetLOKSpecialPaperSize(rSize);
+}
+
+const Size& EditEngine::GetLOKSpecialPaperSize() const
+{
+    return pImpEditEngine->GetLOKSpecialPaperSize();
+}
+
 EFieldInfo::EFieldInfo()
 {
 }
diff --git a/editeng/source/editeng/impedit.hxx 
b/editeng/source/editeng/impedit.hxx
index 3e76d820db60..4297206d4be9 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -573,6 +573,8 @@ private:
     // If it is detected at one point that the StatusHdl has to be called, but
     // this should not happen immediately (critical section):
     Timer               aStatusTimer;
+    Size                aLOKSpecialPaperSize;
+
     Link<EditStatus&,void>         aStatusHdlLink;
     Link<EENotify&,void>           aNotifyHdl;
     Link<HtmlImportInfo&,void>     aHtmlImportHdl;
@@ -1117,6 +1119,8 @@ public:
     bool            IsNbspRunNext() const { return mbNbspRunNext; }
 
     void Dispose();
+    void SetLOKSpecialPaperSize(const Size& rSize) { aLOKSpecialPaperSize = 
rSize; }
+    const Size& GetLOKSpecialPaperSize() const { return aLOKSpecialPaperSize; }
 };
 
 inline EPaM ImpEditEngine::CreateEPaM( const EditPaM& rPaM )
diff --git a/include/editeng/editeng.hxx b/include/editeng/editeng.hxx
index 4c603a1b8b07..c5baa182e2e1 100644
--- a/include/editeng/editeng.hxx
+++ b/include/editeng/editeng.hxx
@@ -623,6 +623,9 @@ public:
     // the same type expands the original instead of inserting another. But the
     // spell check dialog doesn't want that behaviour
     void DisableAttributeExpanding();
+
+    void SetLOKSpecialPaperSize(const Size& rSize);
+    const Size& GetLOKSpecialPaperSize() const;
 };
 
 #endif // INCLUDED_EDITENG_EDITENG_HXX
diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx
index 1eadc05975f1..887f4e632ce6 100644
--- a/sc/source/ui/view/viewdata.cxx
+++ b/sc/source/ui/view/viewdata.cxx
@@ -1650,7 +1650,10 @@ void ScViewData::SetEditEngine( ScSplitPos eWhich,
                 aPaperSizePTwips.setWidth(OutputDevice::LogicToLogic(
                         aUtilRect.GetWidth(), MapUnit::Map100thMM, 
MapUnit::MapTwip));
         }
+
         pNewEngine->SetPaperSize( aPaperSize );
+        if (bLOKPrintTwips)
+            pNewEngine->SetLOKSpecialPaperSize(aPaperSizePTwips);
 
         // sichtbarer Ausschnitt
         Size aPaper = pNewEngine->GetPaperSize();
@@ -1779,12 +1782,10 @@ void ScViewData::EditGrowX()
     SCCOL nLeft = GetPosX(eHWhich);
     SCCOL nRight = nLeft + VisibleCellsX(eHWhich);
 
-    MapUnit eWinUnit = GetLogicMode(eWhich).GetMapUnit();
     Size        aSize = pEngine->GetPaperSize();
     Size aSizePTwips;
-
     if (bLOKPrintTwips)
-        aSizePTwips = OutputDevice::LogicToLogic(aSize, MapMode(eWinUnit), 
MapMode(MapUnit::MapTwip));
+        aSizePTwips = pEngine->GetLOKSpecialPaperSize();
 
     tools::Rectangle   aArea = pCurView->GetOutputArea();
     tools::Rectangle aAreaPTwips;
@@ -2072,7 +2073,6 @@ void ScViewData::EditGrowY( bool bInitial )
 
     EditEngine* pEngine = pCurView->GetEditEngine();
     vcl::Window* pWin = pCurView->GetWindow();
-    MapUnit eWinUnit = GetLogicMode(eWhich).GetMapUnit();
 
     SCROW nBottom = GetPosY(eVWhich) + VisibleCellsY(eVWhich);
 
@@ -2083,7 +2083,7 @@ void ScViewData::EditGrowY( bool bInitial )
 
     if (bLOKPrintTwips)
     {
-        aSizePTwips = OutputDevice::LogicToLogic(aSize, MapMode(eWinUnit), 
MapMode(MapUnit::MapTwip));
+        aSizePTwips = pEngine->GetLOKSpecialPaperSize();
         aAreaPTwips = pCurView->GetLOKSpecialOutputArea();
     }
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to