[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - include/svx reportdesign/source sc/source sd/source svx/source

Caolán McNamara caolanm at redhat.com
Wed Oct 5 06:49:05 UTC 2016


 include/svx/svdundo.hxx                            |   14 ---
 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 -----
 sd/source/ui/func/undoback.cxx                     |   56 ++------------
 sd/source/ui/inc/undoback.hxx                      |   12 ---
 svx/source/svdraw/svdundo.cxx                      |   83 ---------------------
 8 files changed, 26 insertions(+), 167 deletions(-)

New commits:
commit 0402ba63551b614c9742b198e48232ac87a2b32b
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Sep 30 12:45:03 2016 +0100

    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 914d72ee1edb351e4975a516240a38696f619217.
    
    Revert "Resolves: rhbz#1353069 don't clear XATTR_FILL* from stylesheet if..."
    
    This reverts commit de4908eb4d2f1f2ce38a37eea18a9efc4a0073b1.
    
    Revert "use unique_ptr"
    
    This reverts commit ee4f35090657fdce572c5bc6238aceb4098a6e4e.
    
    Revert "fix typo"
    
    This reverts commit a084962e8c3deaeb3c1b6b9119215b48cf27e76e.
    
    Revert "rbhz#1326602 avoid exp. bg bitmaps from deleted slides"
    
    This reverts commit b876bbe2cacce8af379b10d82da6c7e7d229b361.
    
    Change-Id: I65a2f50d1087d6f8bb94d8bb73d54d3f378c6800
    Reviewed-on: https://gerrit.libreoffice.org/29490
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: David Tardon <dtardon at redhat.com>

diff --git a/include/svx/svdundo.hxx b/include/svx/svdundo.hxx
index 9d63557..8a9bb8a 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();
 };
 
 /**
@@ -763,7 +753,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..88d0024 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..cbb5a8a 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/sd/source/ui/func/undoback.cxx b/sd/source/ui/func/undoback.cxx
index 08ff102..126101f 100644
--- a/sd/source/ui/func/undoback.cxx
+++ b/sd/source/ui/func/undoback.cxx
@@ -18,44 +18,36 @@
  */
 
 #include "undoback.hxx"
-
 #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,
     SdPage& rPage,
-    const SfxItemSet& rItemSet)
+    const SfxItemSet& rItenSet)
 :   SdUndoAction(&rDoc),
     mrPage(rPage),
-    mpItemSet(o3tl::make_unique<SfxItemSet>(rItemSet)),
-    mbHasFillBitmap(false)
+    mpItemSet(new SfxItemSet(rItenSet))
 {
     OUString aString( SdResId( STR_UNDO_CHANGE_PAGEFORMAT ) );
     SetComment( aString );
-    saveFillBitmap(*mpItemSet);
+}
+
+SdBackgroundObjUndoAction::~SdBackgroundObjUndoAction()
+{
+    delete mpItemSet;
 }
 
 void SdBackgroundObjUndoAction::ImplRestoreBackgroundObj()
 {
-    std::unique_ptr<SfxItemSet> pNew = o3tl::make_unique<SfxItemSet>(mrPage.getSdrPageProperties().GetItemSet());
+    SfxItemSet* pNew = new SfxItemSet(mrPage.getSdrPageProperties().GetItemSet());
     mrPage.getSdrPageProperties().ClearItem();
-    if (bool(mpFillBitmapItem))
-        restoreFillBitmap(*mpItemSet);
-    mpFillBitmapItem.reset();
-    mbHasFillBitmap = false;
     mrPage.getSdrPageProperties().PutItemSet(*mpItemSet);
-    mpItemSet = std::move(pNew);
-    saveFillBitmap(*mpItemSet);
+    delete mpItemSet;
+    mpItemSet = pNew;
 
     // tell the page that it's visualization has changed
     mrPage.ActionChanged();
@@ -73,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 4fd35e2..d3dfcea 100644
--- a/sd/source/ui/inc/undoback.hxx
+++ b/sd/source/ui/inc/undoback.hxx
@@ -20,33 +20,27 @@
 #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;
 
 class SdBackgroundObjUndoAction : public SdUndoAction
 {
 private:
 
     SdPage&                 mrPage;
-    std::unique_ptr<SfxItemSet> mpItemSet;
-    std::unique_ptr<SfxPoolItem> mpFillBitmapItem;
-    bool                    mbHasFillBitmap;
+    SfxItemSet*             mpItemSet;
 
     void                    ImplRestoreBackgroundObj();
-    void                    saveFillBitmap(SfxItemSet &rItemSet);
-    void                    restoreFillBitmap(SfxItemSet &rItemSet);
 
 public:
                             SdBackgroundObjUndoAction(
                                 SdDrawDocument& rDoc,
                                 SdPage& rPage,
-                                const SfxItemSet& rItemSet);
+                                const SfxItemSet& rItenSet);
+    virtual                 ~SdBackgroundObjUndoAction();
 
     virtual void            Undo() override;
     virtual void            Redo() override;
diff --git a/svx/source/svdraw/svdundo.cxx b/svx/source/svdraw/svdundo.cxx
index ec5f2fe..efc5991 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>
@@ -1444,28 +1442,12 @@ 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())
     {
@@ -1500,8 +1482,6 @@ SdrUndoDelPage::~SdrUndoDelPage()
 
 void SdrUndoDelPage::Undo()
 {
-    if (bool(mpFillBitmapItem))
-        restoreFillBitmap();
     ImpInsertPage(nPageNum);
     if (pUndoGroup!=nullptr)
     {
@@ -1515,8 +1495,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;
@@ -1545,61 +1523,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()
 {
@@ -1846,9 +1769,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)


More information about the Libreoffice-commits mailing list