You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
libreoffice/0001-Resolves-tdf-101711-pr...

200 lines
9.2 KiB

From d6a33b409cfff921a8656d549f5f91b0b4f1bec3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
Date: Fri, 30 Sep 2016 12:45:03 +0100
Subject: [PATCH] Resolves: tdf#101711 problems with attempt to remove unused
bg images
only do the save, unset (and possibly restore) of a bg image on the
stylesheet if it has one owner, this continue to make the original
scenario function without (so far anyway) the various reported problems
Change-Id: I73382961973b1c53bf2ceff205615727dd378c77
---
include/svx/svdundo.hxx | 5 ++---
reportdesign/source/core/inc/ReportUndoFactory.hxx | 2 +-
reportdesign/source/core/sdr/ReportUndoFactory.cxx | 4 ++--
sc/source/core/data/drwlayer.cxx | 2 +-
sd/source/core/drawdoc3.cxx | 20 +++-----------------
svx/source/svdraw/svdundo.cxx | 19 +++++++++----------
6 files changed, 18 insertions(+), 34 deletions(-)
diff --git a/include/svx/svdundo.hxx b/include/svx/svdundo.hxx
index 9d63557..9e94342 100644
--- a/include/svx/svdundo.hxx
+++ b/include/svx/svdundo.hxx
@@ -588,10 +588,9 @@ class SVX_DLLPUBLIC SdrUndoDelPage : public SdrUndoPageList
SdrUndoGroup* pUndoGroup;
std::unique_ptr<SfxPoolItem> mpFillBitmapItem;
bool mbHasFillBitmap;
- bool mbSoleOwnerOfFillBitmapProps;
public:
- SdrUndoDelPage(SdrPage& rNewPg, bool bSoleOwnerOfFillBitmapProps);
+ SdrUndoDelPage(SdrPage& rNewPg);
virtual ~SdrUndoDelPage();
virtual void Undo() override;
@@ -763,7 +762,7 @@ public:
virtual SdrUndoAction* CreateUndoMoveLayer(sal_uInt16 nLayerNum, SdrLayerAdmin& rNewLayerAdmin, SdrModel& rNewModel, sal_uInt16 nNeuPos1);
// Page
- virtual SdrUndoAction* CreateUndoDeletePage(SdrPage& rPage, bool bSoleOwnerOfFillBitmapProps = true);
+ virtual SdrUndoAction* CreateUndoDeletePage(SdrPage& rPage);
virtual SdrUndoAction* CreateUndoNewPage(SdrPage& rPage);
virtual SdrUndoAction* CreateUndoCopyPage(SdrPage& rPage);
virtual SdrUndoAction* CreateUndoSetPageNum(SdrPage& rNewPg, sal_uInt16 nOldPageNum1, sal_uInt16 nNewPageNum1);
diff --git a/reportdesign/source/core/inc/ReportUndoFactory.hxx b/reportdesign/source/core/inc/ReportUndoFactory.hxx
index 1839f1f..03baf07 100644
--- a/reportdesign/source/core/inc/ReportUndoFactory.hxx
+++ b/reportdesign/source/core/inc/ReportUndoFactory.hxx
@@ -59,7 +59,7 @@ namespace rptui
virtual SdrUndoAction* CreateUndoMoveLayer(sal_uInt16 nLayerNum, SdrLayerAdmin& rNewLayerAdmin, SdrModel& rNewModel, sal_uInt16 nNeuPos1) override;
// page
- virtual SdrUndoAction* CreateUndoDeletePage(SdrPage& rPage, bool bSoleOwnerOfFillBitmapProps = true) override;
+ virtual SdrUndoAction* CreateUndoDeletePage(SdrPage& rPage) override;
virtual SdrUndoAction* CreateUndoNewPage(SdrPage& rPage) override;
virtual SdrUndoAction* CreateUndoCopyPage(SdrPage& rPage) override;
virtual SdrUndoAction* CreateUndoSetPageNum(SdrPage& rNewPg, sal_uInt16 nOldPageNum1, sal_uInt16 nNewPageNum1) override;
diff --git a/reportdesign/source/core/sdr/ReportUndoFactory.cxx b/reportdesign/source/core/sdr/ReportUndoFactory.cxx
index 566400c..d1f2bb5 100644
--- a/reportdesign/source/core/sdr/ReportUndoFactory.cxx
+++ b/reportdesign/source/core/sdr/ReportUndoFactory.cxx
@@ -133,9 +133,9 @@ SdrUndoAction* OReportUndoFactory::CreateUndoMoveLayer(sal_uInt16 nLayerNum, Sdr
}
// page
-SdrUndoAction* OReportUndoFactory::CreateUndoDeletePage(SdrPage& rPage, bool bSoleOwnerOfFillBitmapProps)
+SdrUndoAction* OReportUndoFactory::CreateUndoDeletePage(SdrPage& rPage)
{
- return m_pUndoFactory->CreateUndoDeletePage(rPage, bSoleOwnerOfFillBitmapProps);
+ return m_pUndoFactory->CreateUndoDeletePage(rPage);
}
SdrUndoAction* OReportUndoFactory::CreateUndoNewPage(SdrPage& rPage)
diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx
index b2c7ab9..7ea6758 100644
--- a/sc/source/core/data/drwlayer.cxx
+++ b/sc/source/core/data/drwlayer.cxx
@@ -412,7 +412,7 @@ void ScDrawLayer::ScRemovePage( SCTAB nTab )
if (bRecording)
{
SdrPage* pPage = GetPage(static_cast<sal_uInt16>(nTab));
- AddCalcUndo(new SdrUndoDelPage(*pPage, true)); // Undo-Action becomes the page owner
+ AddCalcUndo(new SdrUndoDelPage(*pPage)); // Undo-Action becomes the page owner
RemovePage( static_cast<sal_uInt16>(nTab) ); // just deliver, not deleting
}
else
diff --git a/sd/source/core/drawdoc3.cxx b/sd/source/core/drawdoc3.cxx
index 9bef42e..111db41 100644
--- a/sd/source/core/drawdoc3.cxx
+++ b/sd/source/core/drawdoc3.cxx
@@ -792,17 +792,8 @@ bool SdDrawDocument::InsertBookmarkAsPage(
aTest == aMPLayout &&
eKind == pTest->GetPageKind() )
{
- if (bUndo)
- {
- bool bSoleOwnerOfStyleSheet = true;
- if (pRefPage->IsMasterPage())
- {
- const SfxStyleSheet* pRefSheet = pRefPage->getSdrPageProperties().GetStyleSheet();
- const SfxStyleSheet* pTestSheet = pTest->getSdrPageProperties().GetStyleSheet();
- bSoleOwnerOfStyleSheet = pRefSheet != pTestSheet;
- }
- AddUndo(GetSdrUndoFactory().CreateUndoDeletePage(*pRefPage, bSoleOwnerOfStyleSheet));
- }
+ if( bUndo )
+ AddUndo(GetSdrUndoFactory().CreateUndoDeletePage(*pRefPage));
RemoveMasterPage(nPage);
@@ -1241,7 +1232,6 @@ void SdDrawDocument::RemoveUnnecessaryMasterPages(SdPage* pMasterPage, bool bOnl
{
// Do not delete master pages that have their precious flag set
bool bDeleteMaster = !pMaster->IsPrecious();
- bool bSoleOwnerOfStyleSheet = true;
OUString aLayoutName = pMaster->GetLayoutName();
if(bOnlyDuplicatePages )
@@ -1256,10 +1246,6 @@ void SdDrawDocument::RemoveUnnecessaryMasterPages(SdPage* pMasterPage, bool bOnl
{
// duplicate page found -> remove it
bDeleteMaster = true;
-
- const SfxStyleSheet* pRefSheet = pMaster->getSdrPageProperties().GetStyleSheet();
- const SfxStyleSheet* pTestSheet = pMPg->getSdrPageProperties().GetStyleSheet();
- bSoleOwnerOfStyleSheet = pRefSheet != pTestSheet;
}
}
}
@@ -1293,7 +1279,7 @@ void SdDrawDocument::RemoveUnnecessaryMasterPages(SdPage* pMasterPage, bool bOnl
delete pNotesMaster;
if( bUndo )
- AddUndo(GetSdrUndoFactory().CreateUndoDeletePage(*pMaster, bSoleOwnerOfStyleSheet));
+ AddUndo(GetSdrUndoFactory().CreateUndoDeletePage(*pMaster));
RemoveMasterPage( pMaster->GetPageNum() );
diff --git a/svx/source/svdraw/svdundo.cxx b/svx/source/svdraw/svdundo.cxx
index ec5f2fe..18d7100 100644
--- a/svx/source/svdraw/svdundo.cxx
+++ b/svx/source/svdraw/svdundo.cxx
@@ -1444,11 +1444,10 @@ SdrUndoPageList::~SdrUndoPageList()
}
-SdrUndoDelPage::SdrUndoDelPage(SdrPage& rNewPg, bool bSoleOwnerOfFillBitmapProps)
+SdrUndoDelPage::SdrUndoDelPage(SdrPage& rNewPg)
: SdrUndoPageList(rNewPg)
, pUndoGroup(nullptr)
, mbHasFillBitmap(false)
- , mbSoleOwnerOfFillBitmapProps(bSoleOwnerOfFillBitmapProps)
{
bItsMine = true;
@@ -1558,10 +1557,10 @@ void SdrUndoDelPage::clearFillBitmap()
{
if (mrPage.IsMasterPage())
{
- if (mbSoleOwnerOfFillBitmapProps)
+ SfxStyleSheet* const pStyleSheet = mrPage.getSdrPageProperties().GetStyleSheet();
+ assert(bool(pStyleSheet)); // who took away my stylesheet?
+ if (pStyleSheet->GetListenerCount() == 1)
{
- SfxStyleSheet* const pStyleSheet = mrPage.getSdrPageProperties().GetStyleSheet();
- assert(bool(pStyleSheet)); // who took away my stylesheet?
SfxItemSet& rItemSet = pStyleSheet->GetItemSet();
rItemSet.ClearItem(XATTR_FILLBITMAP);
if (mbHasFillBitmap)
@@ -1581,10 +1580,10 @@ void SdrUndoDelPage::restoreFillBitmap()
{
if (mrPage.IsMasterPage())
{
- if (mbSoleOwnerOfFillBitmapProps)
+ SfxStyleSheet* const pStyleSheet = mrPage.getSdrPageProperties().GetStyleSheet();
+ assert(bool(pStyleSheet)); // who took away my stylesheet?
+ if (pStyleSheet->GetListenerCount() == 1)
{
- SfxStyleSheet* const pStyleSheet = mrPage.getSdrPageProperties().GetStyleSheet();
- assert(bool(pStyleSheet)); // who took away my stylesheet?
SfxItemSet& rItemSet = pStyleSheet->GetItemSet();
rItemSet.Put(*mpFillBitmapItem);
if (mbHasFillBitmap)
@@ -1846,9 +1845,9 @@ SdrUndoAction* SdrUndoFactory::CreateUndoMoveLayer(sal_uInt16 nLayerNum, SdrLaye
}
// page
-SdrUndoAction* SdrUndoFactory::CreateUndoDeletePage(SdrPage& rPage, bool bSoleOwnerOfFillBitmapProps)
+SdrUndoAction* SdrUndoFactory::CreateUndoDeletePage(SdrPage& rPage)
{
- return new SdrUndoDelPage(rPage, bSoleOwnerOfFillBitmapProps);
+ return new SdrUndoDelPage(rPage);
}
SdrUndoAction* SdrUndoFactory::CreateUndoNewPage(SdrPage& rPage)
--
2.7.4