summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorDavid Tardon <dtardon@redhat.com>2016-04-26 09:17:11 +0200
committerDavid Tardon <dtardon@redhat.com>2016-05-02 06:54:30 +0200
commitb876bbe2cacce8af379b10d82da6c7e7d229b361 (patch)
tree455fab6400a107149e6136f0bef995f115da17e0 /svx
parent859c00663f79d81b28f08a7c24a7aebddd8b7ffe (diff)
rbhz#1326602 avoid exp. bg bitmaps from deleted slides
ODF export uses SvxUnoBitmapTable (impl. of com.sun.star.drawing.BitmapTable) to create fill bitmap styles. That returns all XATTR_FILLBITMAP items that are in the document's pool. So we ensure that bitmaps that are only used on deleted (either explicitly or by undoing their insertion) slides are not in the pool. Change-Id: I54c594a94989158f22b156fe660c1e716b988b3e
Diffstat (limited to 'svx')
-rw-r--r--svx/source/svdraw/svdundo.cxx70
1 files changed, 70 insertions, 0 deletions
diff --git a/svx/source/svdraw/svdundo.cxx b/svx/source/svdraw/svdundo.cxx
index e3cc47895528..675edb830ae7 100644
--- a/svx/source/svdraw/svdundo.cxx
+++ b/svx/source/svdraw/svdundo.cxx
@@ -17,6 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <com/sun/star/drawing/FillStyle.hpp>
#include <svl/lstner.hxx>
@@ -27,6 +28,7 @@
#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>
@@ -1445,9 +1447,24 @@ SdrUndoPageList::~SdrUndoPageList()
SdrUndoDelPage::SdrUndoDelPage(SdrPage& rNewPg)
: SdrUndoPageList(rNewPg)
, pUndoGroup(nullptr)
+ , mbHasFillBitmap(false)
{
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())
{
@@ -1482,6 +1499,8 @@ SdrUndoDelPage::~SdrUndoDelPage()
void SdrUndoDelPage::Undo()
{
+ if (bool(mpFillBitmapItem))
+ restoreFillBitmap();
ImpInsertPage(nPageNum);
if (pUndoGroup!=nullptr)
{
@@ -1495,6 +1514,8 @@ 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;
@@ -1523,6 +1544,55 @@ 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())
+ {
+ 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())
+ {
+ 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()
{