summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/qa/extras/tiledrendering/tiledrendering.cxx30
-rw-r--r--sw/source/core/draw/dview.cxx5
-rw-r--r--sw/source/core/inc/dview.hxx3
-rw-r--r--sw/source/uibase/uiview/viewprt.cxx2
4 files changed, 39 insertions, 1 deletions
diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index 4861f128dd8e..c8dbaa493336 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -72,6 +72,7 @@ public:
void testTrackChangesCallback();
void testRedlineUpdateCallback();
void testSetViewGraphicSelection();
+ void testCreateViewGraphicSelection();
CPPUNIT_TEST_SUITE(SwTiledRenderingTest);
CPPUNIT_TEST(testRegisterCallback);
@@ -108,6 +109,7 @@ public:
CPPUNIT_TEST(testTrackChangesCallback);
CPPUNIT_TEST(testRedlineUpdateCallback);
CPPUNIT_TEST(testSetViewGraphicSelection);
+ CPPUNIT_TEST(testCreateViewGraphicSelection);
CPPUNIT_TEST_SUITE_END();
private:
@@ -1272,6 +1274,34 @@ void SwTiledRenderingTest::testSetViewGraphicSelection()
comphelper::LibreOfficeKit::setActive(false);
}
+void SwTiledRenderingTest::testCreateViewGraphicSelection()
+{
+ // Load a document.
+ comphelper::LibreOfficeKit::setActive();
+ SwXTextDocument* pXTextDocument = createDoc("frame.odt");
+ ViewCallback aView1;
+ SfxViewShell::Current()->registerLibreOfficeKitViewCallback(&ViewCallback::callback, &aView1);
+
+ // Mark the textframe in the first view.
+ SwWrtShell* pWrtShell = pXTextDocument->GetDocShell()->GetWrtShell();
+ SdrPage* pPage = pWrtShell->GetDoc()->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0);
+ SdrObject* pObject = pPage->GetObj(0);
+ SdrView* pView = pWrtShell->GetDrawView();
+ aView1.m_bGraphicSelection = true;
+ pView->MarkObj(pObject, pView->GetSdrPageView());
+ CPPUNIT_ASSERT(aView1.m_bGraphicSelection);
+
+ // Create a second view.
+ SfxLokHelper::createView();
+ // This was false, creating a second view cleared the selection of the
+ // first one.
+ CPPUNIT_ASSERT(aView1.m_bGraphicSelection);
+
+ mxComponent->dispose();
+ mxComponent.clear();
+ comphelper::LibreOfficeKit::setActive(false);
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SwTiledRenderingTest);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/core/draw/dview.cxx b/sw/source/core/draw/dview.cxx
index ad6f7df0764e..ab5df7cad783 100644
--- a/sw/source/core/draw/dview.cxx
+++ b/sw/source/core/draw/dview.cxx
@@ -919,6 +919,11 @@ void SwDrawView::ReplaceMarkedDrawVirtObjs( SdrMarkView& _rMarkView )
}
}
+SfxViewShell* SwDrawView::GetSfxViewShell() const
+{
+ return rImp.GetShell()->GetSfxViewShell();
+}
+
void SwDrawView::DeleteMarked()
{
SwDoc* pDoc = Imp().GetShell()->GetDoc();
diff --git a/sw/source/core/inc/dview.hxx b/sw/source/core/inc/dview.hxx
index 9bf76c1ede5e..4145c51f59a2 100644
--- a/sw/source/core/inc/dview.hxx
+++ b/sw/source/core/inc/dview.hxx
@@ -112,6 +112,9 @@ public:
// method to replace marked/selected <SwDrawVirtObj>
// by its reference object for delete of selection and group selection
static void ReplaceMarkedDrawVirtObjs( SdrMarkView& _rMarkView );
+
+ /// See SdrMarkView::GetSfxViewShell().
+ SfxViewShell* GetSfxViewShell() const override;
};
#endif
diff --git a/sw/source/uibase/uiview/viewprt.cxx b/sw/source/uibase/uiview/viewprt.cxx
index 072478439803..3317aca5ecd1 100644
--- a/sw/source/uibase/uiview/viewprt.cxx
+++ b/sw/source/uibase/uiview/viewprt.cxx
@@ -250,7 +250,7 @@ void SwView::ExecutePrint(SfxRequest& rReq)
int SwView::getPart() const
{
- if (!m_pWrtShell)
+ if (m_bInDtor || !m_pWrtShell)
return 0;
sal_uInt16 nPage, nLogPage;