[Libreoffice-commits] core.git: 2 commits - include/vcl sc/qa sc/source svx/source sw/source

Michael Meeks (via logerrit) logerrit at kemper.freedesktop.org
Tue Dec 3 08:47:29 UTC 2019


 include/vcl/ITiledRenderable.hxx                    |    4 -
 sc/qa/unit/tiledrendering/tiledrendering.cxx        |   50 ++++++++++++++++++++
 sc/source/ui/unoobj/docuno.cxx                      |   33 ++-----------
 sc/source/ui/view/gridwin4.cxx                      |    7 ++
 svx/source/sidebar/possize/PosSizePropertyPanel.cxx |    2 
 sw/source/uibase/uno/unotxdoc.cxx                   |    3 -
 6 files changed, 65 insertions(+), 34 deletions(-)

New commits:
commit c4ef1caaeada44750cb420cc755532e5df1c5fb9
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Mon Dec 2 22:10:15 2019 +0000
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Tue Dec 3 09:46:20 2019 +0100

    lok: shape selection: perform the needed unit conversion in a clever way
    
    follow-on fixup of: 35d6c6ffc9b3f66e3802d1770c4e87cf843c3a48 which ended
    up not removing the duplicated conversion logic it should have.
    
    Change-Id: I28ef0180749f6356ec456b4f0b1eef1b474fd6c9
    Reviewed-on: https://gerrit.libreoffice.org/84284
    Tested-by: Jenkins
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
index 25127882e620..f9f3d576be2f 100644
--- a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
+++ b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
@@ -52,7 +52,7 @@
 using namespace css;
 using namespace css::uno;
 
-const char USERITEM_NAME[]      = "FitItem";
+const char USERITEM_NAME[] = "FitItem";
 
 namespace svx { namespace sidebar {
 
commit 3b7661cda1c910524a2c4e3394417971fa025f31
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Mon Dec 2 21:03:05 2019 +0000
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Tue Dec 3 09:46:06 2019 +0100

    lok: calc - store zoom in the view itself.
    
    Don't duplicate this on the ITiledRenderable interface, which is not a
    per-view construct, this just confuses everything.
    
    Store & restore the zoom level before/after rendering a tile -
    unfortunately this is not done by the most optimal view yet.
    
    Change-Id: I1f7dfaa353333f45c5601d49a9bca784d34fb81a
    Reviewed-on: https://gerrit.libreoffice.org/84281
    Tested-by: Jenkins
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx
index e5407e805e5c..e26c1387b6e1 100644
--- a/include/vcl/ITiledRenderable.hxx
+++ b/include/vcl/ITiledRenderable.hxx
@@ -43,11 +43,7 @@ namespace vcl
 
 class VCL_DLLPUBLIC ITiledRenderable
 {
-protected:
-    int mnTilePixelWidth, mnTilePixelHeight;
-    int mnTileTwipWidth, mnTileTwipHeight;
 public:
-
     virtual ~ITiledRenderable();
 
     /**
diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx
index 9af67980b512..c0386f16cd38 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -67,6 +67,7 @@ public:
     virtual void setUp() override;
     virtual void tearDown() override;
 
+    void testRowColumnHeaders();
     void testRowColumnSelections();
     void testSortAscendingDescending();
     void testPartHash();
@@ -107,6 +108,7 @@ public:
     void testJumpToLastRowInvalidation();
 
     CPPUNIT_TEST_SUITE(ScTiledRenderingTest);
+    CPPUNIT_TEST(testRowColumnHeaders);
     CPPUNIT_TEST(testRowColumnSelections);
     CPPUNIT_TEST(testSortAscendingDescending);
     CPPUNIT_TEST(testPartHash);
@@ -1843,6 +1845,54 @@ void ScTiledRenderingTest::testJumpToLastRowInvalidation()
     CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 13005, 26775, 127500255), aView1.m_aInvalidations[0]);
 }
 
+// We need to ensure that views are not perterbed by rendering (!?) hmm ...
+void ScTiledRenderingTest::testRowColumnHeaders()
+{
+    comphelper::LibreOfficeKit::setActive();
+
+    ScModelObj* pModelObj = createDoc("empty.ods");
+    ScViewData* pViewData = ScDocShell::GetViewData();
+    CPPUNIT_ASSERT(pViewData);
+
+    // view #1
+    ViewCallback aView1;
+    int nView1 = SfxLokHelper::getView();
+    SfxViewShell::Current()->registerLibreOfficeKitViewCallback(&ViewCallback::callback, &aView1);
+    CPPUNIT_ASSERT(!lcl_hasEditView(*pViewData));
+
+    // view #2
+    SfxLokHelper::createView();
+    int nView2 = SfxLokHelper::getView();
+    ViewCallback aView2;
+    pModelObj->initializeForTiledRendering(uno::Sequence<beans::PropertyValue>());
+    SfxViewShell::Current()->registerLibreOfficeKitViewCallback(&ViewCallback::callback, &aView2);
+
+    // ViewRowColumnHeaders test
+    SfxLokHelper::setView(nView1);
+    OUString aHeaders1 = pModelObj->getRowColumnHeaders(tools::Rectangle(65,723,10410,4695));
+
+    SfxLokHelper::setView(nView2);
+    // 50% zoom
+    pModelObj->setClientVisibleArea(tools::Rectangle(0, 0, 22474, 47333));
+    pModelObj->setClientZoom(256, 256, 6636, 6636);
+    OUString aHeaders2 = pModelObj->getRowColumnHeaders(tools::Rectangle(65,723,10410,4695));
+
+    // Check vs. view #1
+    SfxLokHelper::setView(nView1);
+    OUString aHeaders1_2 = pModelObj->getRowColumnHeaders(tools::Rectangle(65,723,10410,4695));
+    CPPUNIT_ASSERT_EQUAL(aHeaders1, aHeaders1_2);
+
+    // Check vs. view #2
+    SfxLokHelper::setView(nView2);
+    OUString aHeaders2_2 = pModelObj->getRowColumnHeaders(tools::Rectangle(65,723,10410,4695));
+    CPPUNIT_ASSERT_EQUAL(aHeaders2, aHeaders2_2);
+
+    SfxLokHelper::setView(nView1);
+    SfxViewShell::Current()->registerLibreOfficeKitViewCallback(nullptr, nullptr);
+    SfxLokHelper::setView(nView2);
+    SfxViewShell::Current()->registerLibreOfficeKitViewCallback(nullptr, nullptr);
+}
+
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(ScTiledRenderingTest);
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index aec2102f2d63..12de81d3556b 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -653,10 +653,6 @@ void ScModelObj::postMouseEvent(int nType, int nX, int nY, int nCount, int nButt
     if (!pGridWindow)
         return;
 
-    // update the aLogicMode in ScViewData to something predictable
-    pViewData->SetZoom(Fraction(mnTilePixelWidth * TWIPS_PER_PIXEL, mnTileTwipWidth),
-                       Fraction(mnTilePixelHeight * TWIPS_PER_PIXEL, mnTileTwipHeight), true);
-
     // check if user hit a chart which is being edited by him
     ScTabViewShell * pTabViewShell = pViewData->GetViewShell();
     LokChartHelper aChartHelper(pTabViewShell);
@@ -693,10 +689,6 @@ void ScModelObj::setTextSelection(int nType, int nX, int nY)
     ScInputHandler* pInputHandler = SC_MOD()->GetInputHdl(pViewShell);
     ScDrawView* pDrawView = pViewData->GetScDrawView();
 
-    // update the aLogicMode in ScViewData to something predictable
-    pViewData->SetZoom(Fraction(mnTilePixelWidth * TWIPS_PER_PIXEL, mnTileTwipWidth),
-                       Fraction(mnTilePixelHeight * TWIPS_PER_PIXEL, mnTileTwipHeight), true);
-
     bool bHandled = false;
 
     if (pInputHandler && pInputHandler->IsInputMode())
@@ -804,9 +796,6 @@ void ScModelObj::setGraphicSelection(int nType, int nX, int nY)
     ScViewData* pViewData = ScDocShell::GetViewData();
     ScGridWindow* pGridWindow = pViewData->GetActiveWin();
 
-    // update the aLogicMode in ScViewData to something predictable
-    pViewData->SetZoom(Fraction(mnTilePixelWidth * TWIPS_PER_PIXEL, mnTileTwipWidth),
-                       Fraction(mnTilePixelHeight * TWIPS_PER_PIXEL, mnTileTwipHeight), true);
     double fPPTX = pViewData->GetPPTX();
     double fPPTY = pViewData->GetPPTY();
 
@@ -890,10 +879,13 @@ bool ScModelObj::isMimeTypeSupported()
 
 void ScModelObj::setClientZoom(int nTilePixelWidth_, int nTilePixelHeight_, int nTileTwipWidth_, int nTileTwipHeight_)
 {
-    mnTilePixelWidth = nTilePixelWidth_;
-    mnTilePixelHeight = nTilePixelHeight_;
-    mnTileTwipWidth = nTileTwipWidth_;
-    mnTileTwipHeight = nTileTwipHeight_;
+    ScViewData* pViewData = ScDocShell::GetViewData();
+
+    if (!pViewData)
+        return;
+
+    pViewData->SetZoom(Fraction(nTilePixelWidth_ * TWIPS_PER_PIXEL, nTileTwipWidth_),
+                       Fraction(nTilePixelHeight_ * TWIPS_PER_PIXEL, nTileTwipHeight_), true);
 }
 
 OUString ScModelObj::getRowColumnHeaders(const tools::Rectangle& rRectangle)
@@ -903,10 +895,6 @@ OUString ScModelObj::getRowColumnHeaders(const tools::Rectangle& rRectangle)
     if (!pViewData)
         return OUString();
 
-    // update the aLogicMode in ScViewData to something predictable
-    pViewData->SetZoom(Fraction(mnTilePixelWidth * TWIPS_PER_PIXEL, mnTileTwipWidth),
-                       Fraction(mnTilePixelHeight * TWIPS_PER_PIXEL, mnTileTwipHeight), true);
-
     ScTabView* pTabView = pViewData->GetView();
     if (!pTabView)
         return OUString();
@@ -1112,13 +1100,6 @@ void ScModelObj::initializeForTiledRendering(const css::uno::Sequence<css::beans
     // causing 'Save' being disabled; so let's always save to the original
     // format
     SvtSaveOptions().SetWarnAlienFormat(false);
-
-    // default tile size in pixels
-    mnTilePixelWidth = 256;
-    mnTilePixelHeight = 256;
-    // the default zoom level will be 1
-    mnTileTwipWidth = mnTilePixelWidth * TWIPS_PER_PIXEL;
-    mnTileTwipHeight = mnTilePixelHeight * TWIPS_PER_PIXEL;
 }
 
 uno::Any SAL_CALL ScModelObj::queryInterface( const uno::Type& rType )
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index d0e530be77e8..823fa87d7d4e 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -1114,6 +1114,9 @@ void ScGridWindow::PaintTile( VirtualDevice& rDevice,
                               int nTilePosX, int nTilePosY,
                               long nTileWidth, long nTileHeight )
 {
+    Fraction origZoomX = pViewData->GetZoomX();
+    Fraction origZoomY = pViewData->GetZoomY();
+
     // Output size is in pixels while tile position and size are in logical units (twips).
 
     // Assumption: always paint the whole sheet i.e. "visible" range is always
@@ -1132,6 +1135,8 @@ void ScGridWindow::PaintTile( VirtualDevice& rDevice,
     Fraction aFracX(long(nOutputWidth * TWIPS_PER_PIXEL), nTileWidth);
     Fraction aFracY(long(nOutputHeight * TWIPS_PER_PIXEL), nTileHeight);
 
+    // FIXME: compare vs. origZoomX/Y and avoid ?
+
     // page break zoom, and aLogicMode in ScViewData
     pViewData->SetZoom(aFracX, aFracY, true);
 
@@ -1239,6 +1244,8 @@ void ScGridWindow::PaintTile( VirtualDevice& rDevice,
     // Flag drawn formula cells "unchanged".
     pDoc->ResetChanged(ScRange(nTopLeftTileCol, nTopLeftTileRow, nTab, nBottomRightTileCol, nBottomRightTileRow, nTab));
     pDoc->PrepareFormulaCalc();
+
+    pViewData->SetZoom(origZoomX, origZoomY, true);
 }
 
 void ScGridWindow::LogicInvalidate(const tools::Rectangle* pRectangle)
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index e266692f9c9b..91bc50b079a8 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -3232,9 +3232,6 @@ void SwXTextDocument::setClientZoom(int nTilePixelWidth_, int /*nTilePixelHeight
     // This value is used in postMouseEvent and setGraphicSelection methods
     // for in place chart editing. We assume that x and y scale is roughly
     // the same.
-    // Indeed we could set mnTilePixelWidth, mnTilePixelHeight, mnTileTwipWidth,
-    // mnTileTwipHeight data members of this class but they are not very useful
-    // since we need to be able to retrieve the zoom value for each view shell.
     SfxInPlaceClient* pIPClient = pDocShell->GetView()->GetIPClient();
     if (pIPClient)
     {


More information about the Libreoffice-commits mailing list