summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenry Castro <hcastro@collabora.com>2017-11-14 16:15:52 -0400
committerJan Holesovsky <kendy@collabora.com>2017-11-28 22:10:36 +0100
commit394506840a6bfc8684e89292cefff7088557a915 (patch)
tree0280d524923ef8234b9e2f89a1fab63b059a47d1
parentaf44e1547121f0292cd43fb8db6545e44594020d (diff)
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@libreoffice.org> Reviewed-by: Henry Castro <hcastro@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/44744 Reviewed-by: Jan Holesovsky <kendy@collabora.com> Tested-by: Jan Holesovsky <kendy@collabora.com>
-rw-r--r--sd/qa/unit/tiledrendering/data/notes-view.odpbin0 -> 11184 bytes
-rw-r--r--sd/qa/unit/tiledrendering/tiledrendering.cxx29
-rw-r--r--sd/source/ui/unoidl/unomodel.cxx4
-rw-r--r--sd/source/ui/view/ImpressViewShellBase.cxx18
4 files changed, 39 insertions, 12 deletions
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
--- /dev/null
+++ b/sd/qa/unit/tiledrendering/data/notes-view.odp
Binary files differ
diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx
index 55d5712fe632..6b27320bc0d0 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>
@@ -98,6 +99,7 @@ public:
void testMultiViewInsertDeletePage();
void testDisableUndoRepair();
void testLanguageStatus();
+ void testDefaultView();
CPPUNIT_TEST_SUITE(SdTiledRenderingTest);
CPPUNIT_TEST(testRegisterCallback);
@@ -136,6 +138,7 @@ public:
CPPUNIT_TEST(testMultiViewInsertDeletePage);
CPPUNIT_TEST(testDisableUndoRepair);
CPPUNIT_TEST(testLanguageStatus);
+ CPPUNIT_TEST(testDefaultView);
CPPUNIT_TEST_SUITE_END();
@@ -1818,6 +1821,8 @@ void SdTiledRenderingTest::testDisableUndoRepair()
CPPUNIT_ASSERT(dynamic_cast< const SfxUInt32Item* >(pItem1.get()));
CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt32>(SID_REPAIRPACKAGE), dynamic_cast< const SfxUInt32Item * >(pItem1.get())->GetValue());
}
+
+ comphelper::LibreOfficeKit::setActive(false);
}
void SdTiledRenderingTest::testLanguageStatus()
@@ -1836,6 +1841,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 6b852e2cb5bb..c844c559a642 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -2445,10 +2445,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 e74440f08010..12dcfd949e32 100644
--- a/sd/source/ui/view/ImpressViewShellBase.cxx
+++ b/sd/source/ui/view/ImpressViewShellBase.cxx
@@ -19,16 +19,18 @@
#include "ImpressViewShellBase.hxx"
-#include "DrawDocShell.hxx"
-#include "sdresid.hxx"
-#include "strings.hrc"
-#include "app.hrc"
-#include "framework/FrameworkHelper.hxx"
-#include "framework/ImpressModule.hxx"
-#include "MasterPageObserver.hxx"
+#include <DrawDocShell.hxx>
+#include <sdresid.hxx>
+#include <strings.hrc>
+#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( sal_uInt16 nPrio )