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 6907817b83e37d40be491cc10b2e5b99cc0f48fc
Author:     Dennis Francis <dennis.fran...@collabora.com>
AuthorDate: Wed Jun 3 21:33:24 2020 +0530
Commit:     Dennis Francis <dennis.fran...@collabora.com>
CommitDate: Wed Jul 8 18:08:25 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/+/98130
    Tested-by: Jenkins
    Reviewed-by: Dennis Francis <dennis.fran...@collabora.com>

diff --git a/editeng/source/editeng/editeng.cxx 
b/editeng/source/editeng/editeng.cxx
index 73d85a07b7ce..99b6f1e04a99 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -2818,6 +2818,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 5f67ecd9b22a..0e2b6df1d790 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -562,6 +562,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;
@@ -1109,6 +1111,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 292b620a9b95..e183cf81be5a 100644
--- a/include/editeng/editeng.hxx
+++ b/include/editeng/editeng.hxx
@@ -628,6 +628,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 3469399f40b4..58ee76e99a1f 100644
--- a/sc/source/ui/view/viewdata.cxx
+++ b/sc/source/ui/view/viewdata.cxx
@@ -1652,7 +1652,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();
@@ -1781,12 +1784,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;
@@ -2074,7 +2075,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);
 
@@ -2085,7 +2085,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