[Libreoffice-commits] core.git: 2 commits - sd/qa sd/source

Jan Holesovsky kendy at collabora.com
Thu Mar 31 13:52:55 UTC 2016


 sd/qa/unit/tiledrendering/tiledrendering.cxx |   37 ++++++++++++++++++++++++---
 sd/source/ui/table/tablefunction.cxx         |   20 ++++++++++----
 2 files changed, 49 insertions(+), 8 deletions(-)

New commits:
commit 8c32ffd59aef2c7b319d64c310e7d0a46dbb9e2c
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Thu Mar 31 15:48:52 2016 +0200

    sd lok bccu#1525: Unit test for the fix.
    
    Change-Id: I55107bd36a9b716ecbef4d01dd670617b141cc48

diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx
index 1d6775f..f62fa5e 100644
--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx
@@ -46,7 +46,6 @@ public:
     virtual void tearDown() override;
 
 #if !defined(_WIN32) && !defined(MACOSX)
-    void testInsertDeletePage();
     void testRegisterCallback();
     void testPostKeyEvent();
     void testPostMouseEvent();
@@ -59,11 +58,12 @@ public:
     void testSearchAllSelections();
     void testSearchAllNotifications();
     void testSearchAllFollowedBySearch();
+    void testInsertDeletePage();
+    void testInsertTable();
 #endif
 
     CPPUNIT_TEST_SUITE(SdTiledRenderingTest);
 #if !defined(_WIN32) && !defined(MACOSX)
-    CPPUNIT_TEST(testInsertDeletePage);
     CPPUNIT_TEST(testRegisterCallback);
     CPPUNIT_TEST(testPostKeyEvent);
     CPPUNIT_TEST(testPostMouseEvent);
@@ -75,7 +75,8 @@ public:
     CPPUNIT_TEST(testSearchAll);
     CPPUNIT_TEST(testSearchAllSelections);
     CPPUNIT_TEST(testSearchAllNotifications);
-    CPPUNIT_TEST(testSearchAllFollowedBySearch);
+    CPPUNIT_TEST(testInsertDeletePage);
+    CPPUNIT_TEST(testInsertTable);
 #endif
     CPPUNIT_TEST_SUITE_END();
 
@@ -628,6 +629,36 @@ void SdTiledRenderingTest::testInsertDeletePage()
     comphelper::LibreOfficeKit::setActive(false);
 }
 
+void SdTiledRenderingTest::testInsertTable()
+{
+    comphelper::LibreOfficeKit::setActive();
+    SdXImpressDocument* pXImpressDocument = createDoc("dummy.odp");
+
+    uno::Sequence<beans::PropertyValue> aArgs(comphelper::InitPropertySequence(
+        {
+            {"Rows", uno::makeAny(3)},
+            {"Columns", uno::makeAny(5)}
+        }
+    ));
+
+    comphelper::dispatchCommand(".uno:InsertTable", aArgs);
+    Scheduler::ProcessEventsToIdle();
+
+    // get the table
+    sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell();
+    SdPage* pActualPage = pViewShell->GetActualPage();
+    SdrObject* pObject = pActualPage->GetObj(1);
+    CPPUNIT_ASSERT(pObject);
+
+    // check that the table is not in the top left corner
+    Point aPos(pObject->GetRelativePos());
+
+    CPPUNIT_ASSERT(aPos.X() != 0);
+    CPPUNIT_ASSERT(aPos.Y() != 0);
+
+    comphelper::LibreOfficeKit::setActive(false);
+}
+
 #endif
 
 CPPUNIT_TEST_SUITE_REGISTRATION(SdTiledRenderingTest);
commit ee246512cb0103f22f8afc0de245ea7f82143776
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Thu Mar 31 12:26:54 2016 +0200

    sd lok bccu#1525: Don't rely on the window size in the LOK case.
    
    Otherwise the table is inserted in the top left corner.
    
    Change-Id: Ia5d7099d4bace6f18cd7e8d3409427119240b756

diff --git a/sd/source/ui/table/tablefunction.cxx b/sd/source/ui/table/tablefunction.cxx
index 4d20312..fd58cd4 100644
--- a/sd/source/ui/table/tablefunction.cxx
+++ b/sd/source/ui/table/tablefunction.cxx
@@ -23,6 +23,7 @@
 #include <com/sun/star/awt/KeyModifier.hpp>
 #include <com/sun/star/lang/XInitialization.hpp>
 
+#include <comphelper/lok.hxx>
 #include <cppuhelper/basemutex.hxx>
 
 #include <vcl/svapp.hxx>
@@ -149,16 +150,25 @@ void DrawViewShell::FuTable(SfxRequest& rReq)
             Size aSize( 14100, 2000 );
 
             Point aPos;
-            Rectangle aWinRect(aPos, GetActiveWindow()->GetOutputSizePixel() );
+            Rectangle aWinRect(aPos, GetActiveWindow()->GetOutputSizePixel());
             aWinRect = GetActiveWindow()->PixelToLogic(aWinRect);
 
             // make sure that the default size of the table fits on the paper and is inside the viewing area.
             // if zoomed in close, don't make the table bigger than the viewing window.
             Size aMaxSize = getCurrentPage()->GetSize();
-            if( aMaxSize.Height() > aWinRect.getHeight() )
-                aMaxSize.setHeight( aWinRect.getHeight() );
-            if( aMaxSize.Width() > aWinRect.getWidth() )
-                aMaxSize.setWidth( aWinRect.getWidth() );
+
+            if (comphelper::LibreOfficeKit::isActive())
+            {
+                // aWinRect is nonsensical in the LOK case
+                aWinRect = Rectangle(aPos, aMaxSize);
+            }
+            else
+            {
+                if( aMaxSize.Height() > aWinRect.getHeight() )
+                    aMaxSize.setHeight( aWinRect.getHeight() );
+                if( aMaxSize.Width() > aWinRect.getWidth() )
+                    aMaxSize.setWidth( aWinRect.getWidth() );
+            }
 
             if( aSize.Width() > aMaxSize.getWidth() )
                 aSize.setWidth( aMaxSize.getWidth() );


More information about the Libreoffice-commits mailing list