diff options
author | Regina Henschel <rb.henschel@t-online.de> | 2020-04-19 18:22:11 +0200 |
---|---|---|
committer | Regina Henschel <rb.henschel@t-online.de> | 2020-04-25 14:49:30 +0200 |
commit | eb2d669af61b8808d5819b16157c59d3c6c3e03b (patch) | |
tree | 504c6c46494d41d85c6ac73387b47ce305895f7b /sd | |
parent | 10dba26804cc0c14f74069c26112e75dacf3865b (diff) |
tdf#129898 Use layer DrawnInSlideshow in edit mode
If 'Mouse pointer as pen' is set in slideshow settings, painting in
slideshow becomes persistent. A layer DrawnInSlideshow is created
for that purpose during slideshow. But that layer was not known to
the view from where the slideshow was started.
Generating a layer had been done regardless whether such layer
already exists or not. That had produced several layers with
identical name. That may not happen, because layers are identified
by name.
Change-Id: I2ba9bad5babe5a1bba3d1fc69d028d9037d2bd47
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92502
Tested-by: Jenkins
Reviewed-by: Regina Henschel <rb.henschel@t-online.de>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/qa/unit/data/tdf129898_faulty_DrawnInSlideshow.odp | bin | 0 -> 12607 bytes | |||
-rw-r--r-- | sd/qa/unit/misc-tests.cxx | 25 | ||||
-rw-r--r-- | sd/source/ui/slideshow/slideshow.cxx | 26 | ||||
-rw-r--r-- | sd/source/ui/view/drviews5.cxx | 17 |
4 files changed, 68 insertions, 0 deletions
diff --git a/sd/qa/unit/data/tdf129898_faulty_DrawnInSlideshow.odp b/sd/qa/unit/data/tdf129898_faulty_DrawnInSlideshow.odp Binary files differnew file mode 100644 index 000000000000..796b57b2cb84 --- /dev/null +++ b/sd/qa/unit/data/tdf129898_faulty_DrawnInSlideshow.odp diff --git a/sd/qa/unit/misc-tests.cxx b/sd/qa/unit/misc-tests.cxx index 3e23752aa477..53707a5676a2 100644 --- a/sd/qa/unit/misc-tests.cxx +++ b/sd/qa/unit/misc-tests.cxx @@ -82,6 +82,7 @@ public: void testTdf98839_ShearVFlipH(); void testTdf130988(); void testTdf131033(); + void testTdf129898LayerDrawnInSlideshow(); CPPUNIT_TEST_SUITE(SdMiscTest); CPPUNIT_TEST(testTdf96206); @@ -102,6 +103,7 @@ public: CPPUNIT_TEST(testTdf98839_ShearVFlipH); CPPUNIT_TEST(testTdf130988); CPPUNIT_TEST(testTdf131033); + CPPUNIT_TEST(testTdf129898LayerDrawnInSlideshow); CPPUNIT_TEST_SUITE_END(); virtual void registerNamespaces(xmlXPathContextPtr& pXmlXPathCtx) override @@ -854,6 +856,29 @@ void SdMiscTest::testTdf131033() xDocShRef->DoClose(); } +void SdMiscTest::testTdf129898LayerDrawnInSlideshow() +{ + // Versions LO 6.2 to 6.4 have produced files, where the layer DrawnInSlideshow has + // got visible=false and printable=false attributes. Those files should be repaired now. + const OUString sURL = "sd/qa/unit/data/tdf129898_faulty_DrawnInSlideshow.odp"; + sd::DrawDocShellRef xDocShRef = Load(m_directories.getURLFromSrc(sURL), ODP); + CPPUNIT_ASSERT_MESSAGE("Failed to load file.", xDocShRef.is()); + + // Verify model + const OUString sName = "DrawnInSlideshow"; + SdrLayerAdmin& rLayerAdmin = xDocShRef->GetDoc()->GetLayerAdmin(); + SdrLayer* pLayer = rLayerAdmin.GetLayer(sName); + CPPUNIT_ASSERT_MESSAGE("No layer DrawnInSlideshow", pLayer); + CPPUNIT_ASSERT(pLayer->IsVisibleODF() && pLayer->IsPrintableODF()); + + // Verify view + sd::DrawViewShell* pViewShell = static_cast<sd::DrawViewShell*>(xDocShRef->GetViewShell()); + SdrPageView* pPageView = pViewShell->GetView()->GetSdrPageView(); + CPPUNIT_ASSERT(pPageView->IsLayerVisible(sName) && pPageView->IsLayerPrintable(sName)); + + xDocShRef->DoClose(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdMiscTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sd/source/ui/slideshow/slideshow.cxx b/sd/source/ui/slideshow/slideshow.cxx index e43d08b960a9..1b63f0d06f14 100644 --- a/sd/source/ui/slideshow/slideshow.cxx +++ b/sd/source/ui/slideshow/slideshow.cxx @@ -28,6 +28,7 @@ #include <vcl/svapp.hxx> #include <vcl/wrkwin.hxx> #include <svx/svdpool.hxx> +#include <svx/svdlayer.hxx> #include <svl/itemprop.hxx> #include <sfx2/bindings.hxx> @@ -35,6 +36,7 @@ #include <sfx2/sfxsids.hrc> #include <framework/FrameworkHelper.hxx> +#include <comphelper/extract.hxx> #include <FrameView.hxx> #include <createpresentation.hxx> @@ -766,6 +768,30 @@ void SAL_CALL SlideShow::end() } } + // In case mbMouseAsPen was set, a new layer DrawnInSlideshow might have been generated + // during slideshow, which is not known to FrameView yet. + if (any2bool(getPropertyValue("UsePen")) + && pViewShell->GetDoc()->GetLayerAdmin().GetLayer("DrawnInSlideshow")) + { + SdrLayerIDSet aDocLayerIDSet; + pViewShell->GetDoc()->GetLayerAdmin().getVisibleLayersODF(aDocLayerIDSet); + if (pViewShell->GetFrameView()->GetVisibleLayers() != aDocLayerIDSet) + { + pViewShell->GetFrameView()->SetVisibleLayers(aDocLayerIDSet); + } + pViewShell->GetDoc()->GetLayerAdmin().getPrintableLayersODF(aDocLayerIDSet); + if (pViewShell->GetFrameView()->GetPrintableLayers() != aDocLayerIDSet) + { + pViewShell->GetFrameView()->SetPrintableLayers(aDocLayerIDSet); + } + pViewShell->GetDoc()->GetLayerAdmin().getLockedLayersODF(aDocLayerIDSet); + if (pViewShell->GetFrameView()->GetLockedLayers() != aDocLayerIDSet) + { + pViewShell->GetFrameView()->SetLockedLayers(aDocLayerIDSet); + } + pViewShell->InvalidateWindows(); + } + // Fire the acc focus event when focus is switched back. The above method // mpCurrentViewShellBase->GetWindow()->GrabFocus() will set focus to WorkWindow // instead of the sd::window, so here call Shell's method to fire the focus event diff --git a/sd/source/ui/view/drviews5.cxx b/sd/source/ui/view/drviews5.cxx index dab56e56aa6b..110e7756225f 100644 --- a/sd/source/ui/view/drviews5.cxx +++ b/sd/source/ui/view/drviews5.cxx @@ -493,6 +493,23 @@ void DrawViewShell::ReadUserDataSequence ( const css::uno::Sequence < css::beans rLayerAdmin.getLockedLayersODF( aSdrLayerIDSet ); mpFrameView -> SetLockedLayers( aSdrLayerIDSet ); } + else + { + // tdf#129898 repair layer "DrawnInSlideshow", which was wrongly written + // in LO 6.2 to 6.4. The ODF defaults were corrected when reading draw:layer-set, but + // not in reading config settings, because there the name is not known. + const SdrLayerAdmin& rLayerAdmin = GetDocSh()->GetDoc()->GetLayerAdmin(); + if (rLayerAdmin.GetLayer("DrawnInSlideshow")) + { + SdrLayerIDSet aSdrLayerIDSet; + rLayerAdmin.getVisibleLayersODF( aSdrLayerIDSet ); + mpFrameView -> SetVisibleLayers( aSdrLayerIDSet ); + rLayerAdmin.getPrintableLayersODF( aSdrLayerIDSet ); + mpFrameView -> SetPrintableLayers( aSdrLayerIDSet ); + rLayerAdmin.getLockedLayersODF( aSdrLayerIDSet ); + mpFrameView -> SetLockedLayers( aSdrLayerIDSet ); + } + } if( mpFrameView->GetPageKind() != mePageKind ) |