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

Henry Castro hcastro at collabora.com
Tue Nov 14 23:56:21 UTC 2017


 sd/qa/unit/tiledrendering/data/notes-view.odp |binary
 sd/qa/unit/tiledrendering/tiledrendering.cxx  |   29 ++++++++++++++++++++++++++
 sd/source/ui/unoidl/unomodel.cxx              |    4 ---
 sd/source/ui/view/ImpressViewShellBase.cxx    |    4 ++-
 4 files changed, 32 insertions(+), 5 deletions(-)

New commits:
commit 831dca83f073bca9ad6242f1b96183eb4a49af69
Author: Henry Castro <hcastro at collabora.com>
Date:   Tue Nov 14 16:15:52 2017 -0400

    sd lok: ensure default view
    
    In Tiled rendering case, the only default view is supported
    
    Change-Id: Ia6df85dba28f8ebb41bdc20ae48916b0437ea185
    Reviewed-on: https://gerrit.libreoffice.org/44737
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Henry Castro <hcastro at collabora.com>

diff --git a/sd/qa/unit/tiledrendering/data/notes-view.odp b/sd/qa/unit/tiledrendering/data/notes-view.odp
new file mode 100644
index 000000000000..d41bdf9599a4
Binary files /dev/null and b/sd/qa/unit/tiledrendering/data/notes-view.odp differ
diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx
index 6d5c0bc84af2..37ded6498370 100644
--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx
@@ -8,6 +8,7 @@
  */
 
 #include "../sdmodeltestbase.hxx"
+#include <app.hrc>
 #include <test/bootstrapfixture.hxx>
 #include <unotest/macros_test.hxx>
 #include <test/xmltesttools.hxx>
@@ -104,6 +105,7 @@ public:
     void testMultiViewInsertDeletePage();
     void testDisableUndoRepair();
     void testLanguageStatus();
+    void testDefaultView();
 
     CPPUNIT_TEST_SUITE(SdTiledRenderingTest);
     CPPUNIT_TEST(testRegisterCallback);
@@ -142,6 +144,7 @@ public:
     CPPUNIT_TEST(testMultiViewInsertDeletePage);
     CPPUNIT_TEST(testDisableUndoRepair);
     CPPUNIT_TEST(testLanguageStatus);
+    CPPUNIT_TEST(testDefaultView);
 
     CPPUNIT_TEST_SUITE_END();
 
@@ -1836,6 +1839,8 @@ void SdTiledRenderingTest::testDisableUndoRepair()
         CPPUNIT_ASSERT(pUInt32Item);
         CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt32>(SID_REPAIRPACKAGE), pUInt32Item->GetValue());
     }
+
+    comphelper::LibreOfficeKit::setActive(false);
 }
 
 void SdTiledRenderingTest::testLanguageStatus()
@@ -1854,6 +1859,30 @@ void SdTiledRenderingTest::testLanguageStatus()
         CPPUNIT_ASSERT(dynamic_cast< const SfxStringListItem* >(pItem1.get()));
         CPPUNIT_ASSERT(dynamic_cast< const SfxStringListItem* >(pItem2.get()));
     }
+
+    comphelper::LibreOfficeKit::setActive(false);
+}
+
+void SdTiledRenderingTest::testDefaultView()
+{
+    // Load the document with notes view.
+    comphelper::LibreOfficeKit::setActive();
+
+    SdXImpressDocument* pXImpressDocument = createDoc("notes-view.odp");
+    sd::ViewShell* pView = pXImpressDocument->GetDocShell()->GetViewShell();
+    {
+        std::unique_ptr<SfxPoolItem> pItem1;
+        std::unique_ptr<SfxPoolItem> pItem2;
+        pView->GetViewFrame()->GetBindings().QueryState(SID_NORMAL_MULTI_PANE_GUI, pItem1);
+        pView->GetViewFrame()->GetBindings().QueryState(SID_NOTES_MODE, pItem2);
+        const SfxBoolItem* pImpressView = dynamic_cast< const SfxBoolItem* >(pItem1.get());
+        const SfxBoolItem* pNotesView = dynamic_cast< const SfxBoolItem* >(pItem2.get());
+        CPPUNIT_ASSERT(pImpressView);
+        CPPUNIT_ASSERT(pNotesView);
+        CPPUNIT_ASSERT_EQUAL(true, pImpressView->GetValue());
+        CPPUNIT_ASSERT_EQUAL(false, pNotesView->GetValue());
+    }
+    comphelper::LibreOfficeKit::setActive(false);
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(SdTiledRenderingTest);
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index 4cd01e61acff..ab16b1b1419f 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -2413,10 +2413,6 @@ void SdXImpressDocument::initializeForTiledRendering(const css::uno::Sequence<cs
 {
     SolarMutexGuard aGuard;
 
-    if (mbImpressDoc)
-        // tiled rendering works only when we are in the 'Normal' view, switch to that
-        mpDocShell->GetViewShell()->GetViewFrame()->GetDispatcher()->Execute(SID_VIEWSHELL0, SfxCallMode::SYNCHRON | SfxCallMode::RECORD);
-
     if (DrawViewShell* pViewShell = GetViewShell())
     {
         DrawView* pDrawView = pViewShell->GetDrawView();
diff --git a/sd/source/ui/view/ImpressViewShellBase.cxx b/sd/source/ui/view/ImpressViewShellBase.cxx
index 6cc5cd504f19..6c6c95acbb8a 100644
--- a/sd/source/ui/view/ImpressViewShellBase.cxx
+++ b/sd/source/ui/view/ImpressViewShellBase.cxx
@@ -25,10 +25,12 @@
 #include <app.hrc>
 #include <framework/FrameworkHelper.hxx>
 #include <framework/ImpressModule.hxx>
+#include <framework/FrameworkHelper.hxx>
 #include <MasterPageObserver.hxx>
 #include <sfx2/request.hxx>
 #include <sfx2/viewfrm.hxx>
 #include <sfx2/viewsh.hxx>
+#include <comphelper/lok.hxx>
 
 namespace sd {
 
@@ -41,7 +43,7 @@ SfxViewShell* ImpressViewShellBase::CreateInstance (
     SfxViewFrame *pFrame, SfxViewShell *pOldView)
 {
     ImpressViewShellBase* pBase = new ImpressViewShellBase(pFrame, pOldView);
-    pBase->LateInit("");
+    pBase->LateInit(comphelper::LibreOfficeKit::isActive() ? framework::FrameworkHelper::msImpressViewURL : "");
     return pBase;
 }
 void ImpressViewShellBase::RegisterFactory( SfxInterfaceId nPrio )


More information about the Libreoffice-commits mailing list