summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2016-10-03 15:22:50 +0100
committerjan iversen <jani@documentfoundation.org>2016-10-04 11:25:50 +0000
commit8127ac5412b0af8ed7985e07ab11b3241a4e659e (patch)
tree1e55a10b4c9decfa45038028872d33df76b66c36
parent0620f7ca99eca6c8fe00a99b999ad74b8847ffe4 (diff)
Resolves: tdf#101711 revert attempt to drop unused bg images
for 5-2/5-1 simply revert the effort Revert "Related: rhbz#1353069 don't clear XATTR_FILL* from stylesheet if..." This reverts commit 19c191a0a92b6ae9ca86aa4ee7afb887fd42a209. Revert "Resolves: rhbz#1353069 don't clear XATTR_FILL* from stylesheet if..." This reverts commit fad4d7877ac8d04ab82e8acd21205f315d6eab1f. Revert "rhbz#1326602 avoid exp. bg bitmaps from deleted slides" This reverts commit fd45334b49c09538598f82f5ffa2f61f6bdd9d24. Change-Id: I591083b6b1d7b08316ee24c0788386799d01724b Reviewed-on: https://gerrit.libreoffice.org/29491 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: jan iversen <jani@documentfoundation.org>
-rw-r--r--include/svx/svdundo.hxx14
-rw-r--r--reportdesign/source/core/inc/ReportUndoFactory.hxx2
-rw-r--r--reportdesign/source/core/sdr/ReportUndoFactory.cxx4
-rw-r--r--sc/source/core/data/drwlayer.cxx2
-rw-r--r--sd/source/core/drawdoc3.cxx20
-rw-r--r--sd/source/ui/func/undoback.cxx43
-rw-r--r--sd/source/ui/inc/undoback.hxx6
-rw-r--r--svx/source/svdraw/svdundo.cxx84
8 files changed, 15 insertions, 160 deletions
diff --git a/include/svx/svdundo.hxx b/include/svx/svdundo.hxx
index b1be6ddb58bb..7d4973f11663 100644
--- a/include/svx/svdundo.hxx
+++ b/include/svx/svdundo.hxx
@@ -22,7 +22,6 @@
#include <sal/config.h>
-#include <memory>
#include <vector>
#include <svl/solar.hrc>
@@ -34,7 +33,6 @@
#include <svx/svxdllapi.h>
class SfxItemSet;
-class SfxPoolItem;
class SfxStyleSheet;
class SdrView;
class SdrPageView;
@@ -586,12 +584,9 @@ class SVX_DLLPUBLIC SdrUndoDelPage : public SdrUndoPageList
// When deleting a MasterPage, we remember all relations of the
// Character Page with the MasterPage in this UndoGroup.
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;
@@ -602,11 +597,6 @@ public:
virtual void SdrRepeat(SdrView& rView) override;
virtual bool CanSdrRepeat(SdrView& rView) const override;
-
-private:
- void queryFillBitmap(const SfxItemSet &rItemSet);
- void clearFillBitmap();
- void restoreFillBitmap();
};
/**
@@ -764,7 +754,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 1839f1f70472..88d0024044ee 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 566400cc009a..cbb5a8a305bf 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 2a3896404da1..2886926d3386 100644
--- a/sc/source/core/data/drwlayer.cxx
+++ b/sc/source/core/data/drwlayer.cxx
@@ -411,7 +411,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 0673299e2d94..d993b2bc470a 100644
--- a/sd/source/core/drawdoc3.cxx
+++ b/sd/source/core/drawdoc3.cxx
@@ -796,17 +796,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);
@@ -1245,7 +1236,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 )
@@ -1260,10 +1250,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;
}
}
}
@@ -1297,7 +1283,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/sd/source/ui/func/undoback.cxx b/sd/source/ui/func/undoback.cxx
index 704b551c7469..126101fba2be 100644
--- a/sd/source/ui/func/undoback.cxx
+++ b/sd/source/ui/func/undoback.cxx
@@ -21,14 +21,8 @@
#include "sdpage.hxx"
#include "sdresid.hxx"
#include "strings.hrc"
-
-#include <com/sun/star/drawing/FillStyle.hpp>
-
-#include <o3tl/make_unique.hxx>
-
#include <svl/itemset.hxx>
-#include <svx/xfillit0.hxx>
SdBackgroundObjUndoAction::SdBackgroundObjUndoAction(
SdDrawDocument& rDoc,
@@ -36,12 +30,10 @@ SdBackgroundObjUndoAction::SdBackgroundObjUndoAction(
const SfxItemSet& rItenSet)
: SdUndoAction(&rDoc),
mrPage(rPage),
- mpItemSet(new SfxItemSet(rItenSet)),
- mbHasFillBitmap(false)
+ mpItemSet(new SfxItemSet(rItenSet))
{
OUString aString( SdResId( STR_UNDO_CHANGE_PAGEFORMAT ) );
SetComment( aString );
- saveFillBitmap(*mpItemSet);
}
SdBackgroundObjUndoAction::~SdBackgroundObjUndoAction()
@@ -53,14 +45,9 @@ void SdBackgroundObjUndoAction::ImplRestoreBackgroundObj()
{
SfxItemSet* pNew = new SfxItemSet(mrPage.getSdrPageProperties().GetItemSet());
mrPage.getSdrPageProperties().ClearItem();
- if (bool(mpFillBitmapItem))
- restoreFillBitmap(*mpItemSet);
- mpFillBitmapItem.reset();
- mbHasFillBitmap = false;
mrPage.getSdrPageProperties().PutItemSet(*mpItemSet);
delete mpItemSet;
mpItemSet = pNew;
- saveFillBitmap(*mpItemSet);
// tell the page that it's visualization has changed
mrPage.ActionChanged();
@@ -78,33 +65,7 @@ void SdBackgroundObjUndoAction::Redo()
SdUndoAction* SdBackgroundObjUndoAction::Clone() const
{
- std::unique_ptr<SdBackgroundObjUndoAction> pCopy = o3tl::make_unique<SdBackgroundObjUndoAction>(*mpDoc, mrPage, *mpItemSet);
- if (mpFillBitmapItem)
- pCopy->mpFillBitmapItem.reset(mpFillBitmapItem->Clone());
- pCopy->mbHasFillBitmap = mbHasFillBitmap;
- return pCopy.release();
-}
-
-void SdBackgroundObjUndoAction::saveFillBitmap(SfxItemSet &rItemSet)
-{
- const SfxPoolItem *pItem = nullptr;
- if (rItemSet.GetItemState(XATTR_FILLBITMAP, false, &pItem) == SfxItemState::SET)
- mpFillBitmapItem.reset(pItem->Clone());
- if (bool(mpFillBitmapItem))
- {
- if (rItemSet.GetItemState(XATTR_FILLSTYLE, false, &pItem) == SfxItemState::SET)
- mbHasFillBitmap = static_cast<const XFillStyleItem*>(pItem)->GetValue() == css::drawing::FillStyle_BITMAP;
- rItemSet.ClearItem(XATTR_FILLBITMAP);
- if (mbHasFillBitmap)
- rItemSet.ClearItem(XATTR_FILLSTYLE);
- }
-}
-
-void SdBackgroundObjUndoAction::restoreFillBitmap(SfxItemSet &rItemSet)
-{
- rItemSet.Put(*mpFillBitmapItem);
- if (mbHasFillBitmap)
- rItemSet.Put(XFillStyleItem(css::drawing::FillStyle_BITMAP));
+ return new SdBackgroundObjUndoAction(*mpDoc, mrPage, *mpItemSet);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/undoback.hxx b/sd/source/ui/inc/undoback.hxx
index 35370ca01627..3b1553b4d239 100644
--- a/sd/source/ui/inc/undoback.hxx
+++ b/sd/source/ui/inc/undoback.hxx
@@ -20,13 +20,11 @@
#ifndef INCLUDED_SD_SOURCE_UI_INC_UNDOBACK_HXX
#define INCLUDED_SD_SOURCE_UI_INC_UNDOBACK_HXX
-#include <memory>
#include "sdundo.hxx"
class SdDrawDocument;
class SdPage;
class SfxItemSet;
-class SfxPoolItem;
// SdBackgroundObjUndoAction
class SdBackgroundObjUndoAction : public SdUndoAction
@@ -35,12 +33,8 @@ private:
SdPage& mrPage;
SfxItemSet* mpItemSet;
- std::unique_ptr<SfxPoolItem> mpFillBitmapItem;
- bool mbHasFillBitmap;
void ImplRestoreBackgroundObj();
- void saveFillBitmap(SfxItemSet &rItemSet);
- void restoreFillBitmap(SfxItemSet &rItemSet);
public:
diff --git a/svx/source/svdraw/svdundo.cxx b/svx/source/svdraw/svdundo.cxx
index ff60a82f9cc4..9567d9e1a12e 100644
--- a/svx/source/svdraw/svdundo.cxx
+++ b/svx/source/svdraw/svdundo.cxx
@@ -17,7 +17,6 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include <com/sun/star/drawing/FillStyle.hpp>
#include <svl/lstner.hxx>
@@ -28,7 +27,6 @@
#include <svx/svdlayer.hxx>
#include <svx/svdmodel.hxx>
#include <svx/svdview.hxx>
-#include <svx/xfillit0.hxx>
#include "svx/svdstr.hrc"
#include "svdglob.hxx"
#include <svx/scene3d.hxx>
@@ -1459,28 +1457,13 @@ SdrUndoPageList::~SdrUndoPageList()
}
-SdrUndoDelPage::SdrUndoDelPage(SdrPage& rNewPg, bool bSoleOwnerOfFillBitmapProps)
+
+SdrUndoDelPage::SdrUndoDelPage(SdrPage& rNewPg)
: SdrUndoPageList(rNewPg)
, pUndoGroup(nullptr)
- , mbHasFillBitmap(false)
- , mbSoleOwnerOfFillBitmapProps(bSoleOwnerOfFillBitmapProps)
{
bItsMine = true;
- // keep fill bitmap separately to remove it from pool if not used elsewhere
- if (mrPage.IsMasterPage())
- {
- SfxStyleSheet* const pStyleSheet = mrPage.getSdrPageProperties().GetStyleSheet();
- if (pStyleSheet)
- queryFillBitmap(pStyleSheet->GetItemSet());
- }
- else
- {
- queryFillBitmap(mrPage.getSdrPageProperties().GetItemSet());
- }
- if (bool(mpFillBitmapItem))
- clearFillBitmap();
-
// now remember the master page relationships
if(mrPage.IsMasterPage())
{
@@ -1515,8 +1498,6 @@ SdrUndoDelPage::~SdrUndoDelPage()
void SdrUndoDelPage::Undo()
{
- if (bool(mpFillBitmapItem))
- restoreFillBitmap();
ImpInsertPage(nPageNum);
if (pUndoGroup!=nullptr)
{
@@ -1530,8 +1511,6 @@ void SdrUndoDelPage::Undo()
void SdrUndoDelPage::Redo()
{
ImpRemovePage(nPageNum);
- if (bool(mpFillBitmapItem))
- clearFillBitmap();
// master page relations are dissolved automatically
DBG_ASSERT(!bItsMine,"RedoDeletePage: mrPage already belongs to UndoAction.");
bItsMine=true;
@@ -1560,61 +1539,6 @@ bool SdrUndoDelPage::CanSdrRepeat(SdrView& /*rView*/) const
return false;
}
-void SdrUndoDelPage::queryFillBitmap(const SfxItemSet& rItemSet)
-{
- const SfxPoolItem *pItem = nullptr;
- if (rItemSet.GetItemState(XATTR_FILLBITMAP, false, &pItem) == SfxItemState::SET)
- mpFillBitmapItem.reset(pItem->Clone());
- if (rItemSet.GetItemState(XATTR_FILLSTYLE, false, &pItem) == SfxItemState::SET)
- mbHasFillBitmap = static_cast<const XFillStyleItem*>(pItem)->GetValue() == css::drawing::FillStyle_BITMAP;
-}
-
-void SdrUndoDelPage::clearFillBitmap()
-{
- if (mrPage.IsMasterPage())
- {
- if (mbSoleOwnerOfFillBitmapProps)
- {
- SfxStyleSheet* const pStyleSheet = mrPage.getSdrPageProperties().GetStyleSheet();
- assert(bool(pStyleSheet)); // who took away my stylesheet?
- SfxItemSet& rItemSet = pStyleSheet->GetItemSet();
- rItemSet.ClearItem(XATTR_FILLBITMAP);
- if (mbHasFillBitmap)
- rItemSet.ClearItem(XATTR_FILLSTYLE);
- }
- }
- else
- {
- SdrPageProperties &rPageProps = mrPage.getSdrPageProperties();
- rPageProps.ClearItem(XATTR_FILLBITMAP);
- if (mbHasFillBitmap)
- rPageProps.ClearItem(XATTR_FILLSTYLE);
- }
-}
-
-void SdrUndoDelPage::restoreFillBitmap()
-{
- if (mrPage.IsMasterPage())
- {
- if (mbSoleOwnerOfFillBitmapProps)
- {
- SfxStyleSheet* const pStyleSheet = mrPage.getSdrPageProperties().GetStyleSheet();
- assert(bool(pStyleSheet)); // who took away my stylesheet?
- SfxItemSet& rItemSet = pStyleSheet->GetItemSet();
- rItemSet.Put(*mpFillBitmapItem);
- if (mbHasFillBitmap)
- rItemSet.Put(XFillStyleItem(css::drawing::FillStyle_BITMAP));
- }
- }
- else
- {
- SdrPageProperties &rPageProps = mrPage.getSdrPageProperties();
- rPageProps.PutItem(*mpFillBitmapItem);
- if (mbHasFillBitmap)
- rPageProps.PutItem(XFillStyleItem(css::drawing::FillStyle_BITMAP));
- }
-}
-
void SdrUndoNewPage::Undo()
@@ -1864,9 +1788,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)