Kaydet (Commit) 831dca83 authored tarafından Henry Castro's avatar Henry Castro

sd lok: ensure default view

In Tiled rendering case, the only default view is supported

Change-Id: Ia6df85dba28f8ebb41bdc20ae48916b0437ea185
Reviewed-on: https://gerrit.libreoffice.org/44737Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarHenry Castro <hcastro@collabora.com>
üst b56479e8
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
*/ */
#include "../sdmodeltestbase.hxx" #include "../sdmodeltestbase.hxx"
#include <app.hrc>
#include <test/bootstrapfixture.hxx> #include <test/bootstrapfixture.hxx>
#include <unotest/macros_test.hxx> #include <unotest/macros_test.hxx>
#include <test/xmltesttools.hxx> #include <test/xmltesttools.hxx>
...@@ -104,6 +105,7 @@ public: ...@@ -104,6 +105,7 @@ public:
void testMultiViewInsertDeletePage(); void testMultiViewInsertDeletePage();
void testDisableUndoRepair(); void testDisableUndoRepair();
void testLanguageStatus(); void testLanguageStatus();
void testDefaultView();
CPPUNIT_TEST_SUITE(SdTiledRenderingTest); CPPUNIT_TEST_SUITE(SdTiledRenderingTest);
CPPUNIT_TEST(testRegisterCallback); CPPUNIT_TEST(testRegisterCallback);
...@@ -142,6 +144,7 @@ public: ...@@ -142,6 +144,7 @@ public:
CPPUNIT_TEST(testMultiViewInsertDeletePage); CPPUNIT_TEST(testMultiViewInsertDeletePage);
CPPUNIT_TEST(testDisableUndoRepair); CPPUNIT_TEST(testDisableUndoRepair);
CPPUNIT_TEST(testLanguageStatus); CPPUNIT_TEST(testLanguageStatus);
CPPUNIT_TEST(testDefaultView);
CPPUNIT_TEST_SUITE_END(); CPPUNIT_TEST_SUITE_END();
...@@ -1836,6 +1839,8 @@ void SdTiledRenderingTest::testDisableUndoRepair() ...@@ -1836,6 +1839,8 @@ void SdTiledRenderingTest::testDisableUndoRepair()
CPPUNIT_ASSERT(pUInt32Item); CPPUNIT_ASSERT(pUInt32Item);
CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt32>(SID_REPAIRPACKAGE), pUInt32Item->GetValue()); CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt32>(SID_REPAIRPACKAGE), pUInt32Item->GetValue());
} }
comphelper::LibreOfficeKit::setActive(false);
} }
void SdTiledRenderingTest::testLanguageStatus() void SdTiledRenderingTest::testLanguageStatus()
...@@ -1854,6 +1859,30 @@ void SdTiledRenderingTest::testLanguageStatus() ...@@ -1854,6 +1859,30 @@ void SdTiledRenderingTest::testLanguageStatus()
CPPUNIT_ASSERT(dynamic_cast< const SfxStringListItem* >(pItem1.get())); CPPUNIT_ASSERT(dynamic_cast< const SfxStringListItem* >(pItem1.get()));
CPPUNIT_ASSERT(dynamic_cast< const SfxStringListItem* >(pItem2.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); CPPUNIT_TEST_SUITE_REGISTRATION(SdTiledRenderingTest);
......
...@@ -2413,10 +2413,6 @@ void SdXImpressDocument::initializeForTiledRendering(const css::uno::Sequence<cs ...@@ -2413,10 +2413,6 @@ void SdXImpressDocument::initializeForTiledRendering(const css::uno::Sequence<cs
{ {
SolarMutexGuard aGuard; 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()) if (DrawViewShell* pViewShell = GetViewShell())
{ {
DrawView* pDrawView = pViewShell->GetDrawView(); DrawView* pDrawView = pViewShell->GetDrawView();
......
...@@ -25,10 +25,12 @@ ...@@ -25,10 +25,12 @@
#include <app.hrc> #include <app.hrc>
#include <framework/FrameworkHelper.hxx> #include <framework/FrameworkHelper.hxx>
#include <framework/ImpressModule.hxx> #include <framework/ImpressModule.hxx>
#include <framework/FrameworkHelper.hxx>
#include <MasterPageObserver.hxx> #include <MasterPageObserver.hxx>
#include <sfx2/request.hxx> #include <sfx2/request.hxx>
#include <sfx2/viewfrm.hxx> #include <sfx2/viewfrm.hxx>
#include <sfx2/viewsh.hxx> #include <sfx2/viewsh.hxx>
#include <comphelper/lok.hxx>
namespace sd { namespace sd {
...@@ -41,7 +43,7 @@ SfxViewShell* ImpressViewShellBase::CreateInstance ( ...@@ -41,7 +43,7 @@ SfxViewShell* ImpressViewShellBase::CreateInstance (
SfxViewFrame *pFrame, SfxViewShell *pOldView) SfxViewFrame *pFrame, SfxViewShell *pOldView)
{ {
ImpressViewShellBase* pBase = new ImpressViewShellBase(pFrame, pOldView); ImpressViewShellBase* pBase = new ImpressViewShellBase(pFrame, pOldView);
pBase->LateInit(""); pBase->LateInit(comphelper::LibreOfficeKit::isActive() ? framework::FrameworkHelper::msImpressViewURL : "");
return pBase; return pBase;
} }
void ImpressViewShellBase::RegisterFactory( SfxInterfaceId nPrio ) void ImpressViewShellBase::RegisterFactory( SfxInterfaceId nPrio )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment