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.
360 lines
12 KiB
360 lines
12 KiB
9 years ago
|
From 402f64fc8464366015259d44e238a77cb7d9d776 Mon Sep 17 00:00:00 2001
|
||
|
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
|
||
|
Date: Wed, 30 Sep 2015 13:30:36 +0100
|
||
|
Subject: [PATCH] implement save slide background for impress
|
||
|
|
||
|
to go along with the existing "set background",
|
||
|
same sort of thing as the competitor's effort
|
||
|
|
||
|
(cherry picked from commit ed25a000ab67324075e68d9a7f3ca657b4e6a573)
|
||
|
|
||
|
Change-Id: I2a1106771ead2cd926f3d631850447499340697c
|
||
|
---
|
||
|
sd/inc/app.hrc | 3 +-
|
||
|
sd/inc/sdcommands.h | 1 +
|
||
|
sd/sdi/_drvwsh.sdi | 5 +++
|
||
|
sd/sdi/sdraw.sdi | 24 +++++++++++
|
||
|
sd/source/ui/app/menuids_tmpl.src | 11 ++++-
|
||
|
sd/source/ui/func/fupage.cxx | 85 +++++++++++++++++++++++---------------
|
||
|
sd/source/ui/inc/DrawViewShell.hxx | 4 ++
|
||
|
sd/source/ui/view/drviews2.cxx | 1 +
|
||
|
sd/source/ui/view/drviews7.cxx | 25 ++++++++++-
|
||
|
9 files changed, 122 insertions(+), 37 deletions(-)
|
||
|
|
||
|
diff --git a/sd/inc/app.hrc b/sd/inc/app.hrc
|
||
|
index 4f3d82e..956c7d4 100644
|
||
|
--- a/sd/inc/app.hrc
|
||
|
+++ b/sd/inc/app.hrc
|
||
|
@@ -421,7 +421,8 @@
|
||
|
#define SID_SLIDE_SORTER_MULTI_PANE_GUI (SID_SD_START+421)
|
||
|
|
||
|
#define SID_SELECT_BACKGROUND (SID_SD_START+422)
|
||
|
-
|
||
|
+#define SID_SAVE_BACKGROUND (SID_SD_START+423)
|
||
|
+ // FREE
|
||
|
// Slots for the tool pane popup
|
||
|
#define SID_TP_APPLY_TO_ALL_SLIDES (SID_SD_START+425)
|
||
|
#define SID_TP_APPLY_TO_SELECTED_SLIDES (SID_SD_START+426)
|
||
|
diff --git a/sd/inc/sdcommands.h b/sd/inc/sdcommands.h
|
||
|
index 2f4bf56..1d3502f 100644
|
||
|
--- a/sd/inc/sdcommands.h
|
||
|
+++ b/sd/inc/sdcommands.h
|
||
|
@@ -90,6 +90,7 @@
|
||
|
#define CMD_SID_DELETE_MASTER_PAGE ".uno:DeleteMasterPage"
|
||
|
#define CMD_SID_RENAME_MASTER_PAGE ".uno:RenameMasterPage"
|
||
|
#define CMD_SID_SELECT_BACKGROUND ".uno:SelectBackground"
|
||
|
+#define CMD_SID_SAVE_BACKGROUND ".uno:SaveBackground"
|
||
|
#define CMD_SID_DISPLAY_MASTER_BACKGROUND ".uno:DisplayMasterBackground"
|
||
|
#define CMD_SID_DISPLAY_MASTER_OBJECTS ".uno:DisplayMasterObjects"
|
||
|
#define CMD_SID_TABLE_DISTRIBUTE_COLUMNS ".uno:DistributeColumns"
|
||
|
diff --git a/sd/sdi/_drvwsh.sdi b/sd/sdi/_drvwsh.sdi
|
||
|
index 263a8ed..28ee22c 100644
|
||
|
--- a/sd/sdi/_drvwsh.sdi
|
||
|
+++ b/sd/sdi/_drvwsh.sdi
|
||
|
@@ -2662,6 +2662,11 @@ interface DrawView
|
||
|
ExecMethod = FuTemporary ;
|
||
|
StateMethod = GetMenuState ;
|
||
|
]
|
||
|
+ SID_SAVE_BACKGROUND
|
||
|
+ [
|
||
|
+ ExecMethod = FuTemporary ;
|
||
|
+ StateMethod = GetMenuState ;
|
||
|
+ ]
|
||
|
SID_DISPLAY_MASTER_BACKGROUND
|
||
|
[
|
||
|
ExecMethod = FuTemporary ;
|
||
|
diff --git a/sd/sdi/sdraw.sdi b/sd/sdi/sdraw.sdi
|
||
|
index 7297c1f..d2d5d28 100644
|
||
|
--- a/sd/sdi/sdraw.sdi
|
||
|
+++ b/sd/sdi/sdraw.sdi
|
||
|
@@ -6439,6 +6439,30 @@ SfxVoidItem SelectBackground SID_SELECT_BACKGROUND
|
||
|
GroupId = GID_OPTIONS;
|
||
|
]
|
||
|
|
||
|
+SfxVoidItem SaveBackground SID_SAVE_BACKGROUND
|
||
|
+()
|
||
|
+[
|
||
|
+ /* flags: */
|
||
|
+ AutoUpdate = FALSE,
|
||
|
+ Cachable = Cachable,
|
||
|
+ FastCall = FALSE,
|
||
|
+ HasCoreId = FALSE,
|
||
|
+ HasDialog = TRUE,
|
||
|
+ ReadOnlyDoc = TRUE,
|
||
|
+ Toggle = FALSE,
|
||
|
+ Container = FALSE,
|
||
|
+ RecordAbsolute = FALSE,
|
||
|
+ RecordPerSet;
|
||
|
+ Synchron;
|
||
|
+
|
||
|
+ /* config: */
|
||
|
+ AccelConfig = FALSE,
|
||
|
+ MenuConfig = FALSE,
|
||
|
+ StatusBarConfig = FALSE,
|
||
|
+ ToolBoxConfig = FALSE,
|
||
|
+ GroupId = GID_OPTIONS;
|
||
|
+]
|
||
|
+
|
||
|
SfxBoolItem DisplayMasterBackground SID_DISPLAY_MASTER_BACKGROUND
|
||
|
[
|
||
|
/* flags: */
|
||
|
diff --git a/sd/source/ui/app/menuids_tmpl.src b/sd/source/ui/app/menuids_tmpl.src
|
||
|
index bf30830..6917de2 100644
|
||
|
--- a/sd/source/ui/app/menuids_tmpl.src
|
||
|
+++ b/sd/source/ui/app/menuids_tmpl.src
|
||
|
@@ -138,6 +138,13 @@
|
||
|
HelpId = CMD_SID_SELECT_BACKGROUND ; \
|
||
|
Text [ en-US ] = "Set Background Image..." ; \
|
||
|
};
|
||
|
+#define MN_SAVE_BACKGROUND \
|
||
|
+ MenuItem\
|
||
|
+ {\
|
||
|
+ Identifier = SID_SAVE_BACKGROUND ; \
|
||
|
+ HelpId = CMD_SID_SAVE_BACKGROUND ; \
|
||
|
+ Text [ en-US ] = "Save Background Image..." ; \
|
||
|
+ };
|
||
|
#define MN_DISPLAY_MASTER_BACKGROUND \
|
||
|
MenuItem\
|
||
|
{\
|
||
|
@@ -169,6 +176,7 @@
|
||
|
MN_SELECT_BACKGROUND\
|
||
|
MN_PAGE_DESIGN\
|
||
|
MN_RENAME_PAGE\
|
||
|
+ MN_SAVE_BACKGROUND\
|
||
|
};\
|
||
|
};\
|
||
|
Text [ en-US ] = "Pag~e" ; \
|
||
|
@@ -200,7 +208,8 @@
|
||
|
MN_DISPLAY_MASTER_OBJECTS\
|
||
|
};\
|
||
|
};\
|
||
|
- };
|
||
|
+ }; \
|
||
|
+ MN_SAVE_BACKGROUND
|
||
|
|
||
|
// Layer
|
||
|
#define MN_RENAME_LAYER \
|
||
|
diff --git a/sd/source/ui/func/fupage.cxx b/sd/source/ui/func/fupage.cxx
|
||
|
index 83146e4..d3a053f 100644
|
||
|
--- a/sd/source/ui/func/fupage.cxx
|
||
|
+++ b/sd/source/ui/func/fupage.cxx
|
||
|
@@ -36,6 +36,7 @@
|
||
|
#include <svx/svdundo.hxx>
|
||
|
#include <editeng/eeitem.hxx>
|
||
|
#include <editeng/frmdiritem.hxx>
|
||
|
+#include <svx/graphichelper.hxx>
|
||
|
#include <svx/xbtmpit.hxx>
|
||
|
#include <svx/xsetit.hxx>
|
||
|
#include <editeng/ulspitem.hxx>
|
||
|
@@ -164,6 +165,41 @@ void FuPage::Deactivate()
|
||
|
{
|
||
|
}
|
||
|
|
||
|
+void MergePageBackgroundFilling(SdPage *pPage, SdStyleSheet *pStyleSheet, bool bMasterPage, SfxItemSet& rMergedAttr)
|
||
|
+{
|
||
|
+ if (bMasterPage)
|
||
|
+ {
|
||
|
+ if (pStyleSheet)
|
||
|
+ mergeItemSetsImpl(rMergedAttr, pStyleSheet->GetItemSet());
|
||
|
+ }
|
||
|
+ else
|
||
|
+ {
|
||
|
+ // Only this page, get attributes for background fill
|
||
|
+ const SfxItemSet& rBackgroundAttributes = pPage->getSdrPageProperties().GetItemSet();
|
||
|
+
|
||
|
+ if(drawing::FillStyle_NONE != static_cast<const XFillStyleItem&>(rBackgroundAttributes.Get(XATTR_FILLSTYLE)).GetValue())
|
||
|
+ {
|
||
|
+ // page attributes are used, take them
|
||
|
+ rMergedAttr.Put(rBackgroundAttributes);
|
||
|
+ }
|
||
|
+ else
|
||
|
+ {
|
||
|
+ if(pStyleSheet
|
||
|
+ && drawing::FillStyle_NONE != static_cast<const XFillStyleItem&>(pStyleSheet->GetItemSet().Get(XATTR_FILLSTYLE)).GetValue())
|
||
|
+ {
|
||
|
+ // if the page has no fill style, use the settings from the
|
||
|
+ // background stylesheet (if used)
|
||
|
+ mergeItemSetsImpl(rMergedAttr, pStyleSheet->GetItemSet());
|
||
|
+ }
|
||
|
+ else
|
||
|
+ {
|
||
|
+ // no fill style from page, start with no fill style
|
||
|
+ rMergedAttr.Put(XFillStyleItem(drawing::FillStyle_NONE));
|
||
|
+ }
|
||
|
+ }
|
||
|
+ }
|
||
|
+}
|
||
|
+
|
||
|
const SfxItemSet* FuPage::ExecuteDialog( vcl::Window* pParent )
|
||
|
{
|
||
|
if (!mpDrawViewShell)
|
||
|
@@ -247,44 +283,27 @@ const SfxItemSet* FuPage::ExecuteDialog( vcl::Window* pParent )
|
||
|
// merge page background filling to the dialogs input set
|
||
|
if( mbDisplayBackgroundTabPage )
|
||
|
{
|
||
|
- if( mbMasterPage )
|
||
|
- {
|
||
|
- if(pStyleSheet)
|
||
|
- mergeItemSetsImpl( aMergedAttr, pStyleSheet->GetItemSet() );
|
||
|
- }
|
||
|
- else
|
||
|
- {
|
||
|
- // Only this page, get attributes for background fill
|
||
|
- const SfxItemSet& rBackgroundAttributes = mpPage->getSdrPageProperties().GetItemSet();
|
||
|
-
|
||
|
- if(drawing::FillStyle_NONE != static_cast<const XFillStyleItem&>(rBackgroundAttributes.Get(XATTR_FILLSTYLE)).GetValue())
|
||
|
- {
|
||
|
- // page attributes are used, take them
|
||
|
- aMergedAttr.Put(rBackgroundAttributes);
|
||
|
- }
|
||
|
- else
|
||
|
- {
|
||
|
- if(pStyleSheet
|
||
|
- && drawing::FillStyle_NONE != static_cast<const XFillStyleItem&>(pStyleSheet->GetItemSet().Get(XATTR_FILLSTYLE)).GetValue())
|
||
|
- {
|
||
|
- // if the page has no fill style, use the settings from the
|
||
|
- // background stylesheet (if used)
|
||
|
- mergeItemSetsImpl(aMergedAttr, pStyleSheet->GetItemSet());
|
||
|
- }
|
||
|
- else
|
||
|
- {
|
||
|
- // no fill style from page, start with no fill style
|
||
|
- aMergedAttr.Put(XFillStyleItem(drawing::FillStyle_NONE));
|
||
|
- }
|
||
|
- }
|
||
|
- }
|
||
|
+ MergePageBackgroundFilling(mpPage, pStyleSheet, mbMasterPage, aMergedAttr);
|
||
|
}
|
||
|
|
||
|
boost::scoped_ptr< SfxItemSet > pTempSet;
|
||
|
|
||
|
- if( GetSlotID() == SID_SELECT_BACKGROUND )
|
||
|
+ const sal_uInt16 nId = GetSlotID();
|
||
|
+ if (nId == SID_SAVE_BACKGROUND)
|
||
|
+ {
|
||
|
+ const XFillStyleItem& rStyleItem =
|
||
|
+ static_cast<const XFillStyleItem&>(aMergedAttr.Get(XATTR_FILLSTYLE));
|
||
|
+ if (drawing::FillStyle_BITMAP == (drawing::FillStyle)rStyleItem.GetValue())
|
||
|
+ {
|
||
|
+ const XFillBitmapItem& rBitmap =
|
||
|
+ static_cast<const XFillBitmapItem&>(aMergedAttr.Get(XATTR_FILLBITMAP));
|
||
|
+ const GraphicObject& rGraphicObj = rBitmap.GetGraphicObject();
|
||
|
+ GraphicHelper::ExportGraphic(rGraphicObj.GetGraphic(), "");
|
||
|
+ }
|
||
|
+ }
|
||
|
+ else if (nId == SID_SELECT_BACKGROUND)
|
||
|
{
|
||
|
- SvxOpenGraphicDialog aDlg(SdResId(STR_SET_BACKGROUND_PICTURE));
|
||
|
+ SvxOpenGraphicDialog aDlg(SdResId(STR_SET_BACKGROUND_PICTURE));
|
||
|
|
||
|
if( aDlg.Execute() == GRFILTER_OK )
|
||
|
{
|
||
|
diff --git a/sd/source/ui/inc/DrawViewShell.hxx b/sd/source/ui/inc/DrawViewShell.hxx
|
||
|
index 405e7af..5ec628c 100644
|
||
|
--- a/sd/source/ui/inc/DrawViewShell.hxx
|
||
|
+++ b/sd/source/ui/inc/DrawViewShell.hxx
|
||
|
@@ -33,6 +33,7 @@
|
||
|
|
||
|
class Outliner;
|
||
|
class SdPage;
|
||
|
+class SdStyleSheet;
|
||
|
class SdrExternalToolEdit;
|
||
|
class DrawDocShell;
|
||
|
class TabBar;
|
||
|
@@ -509,6 +510,9 @@ private:
|
||
|
std::vector<std::unique_ptr<SdrExternalToolEdit>> m_ExternalEdits;
|
||
|
};
|
||
|
|
||
|
+ /// Merge the background properties together and deposit the result in rMergeAttr
|
||
|
+ void MergePageBackgroundFilling(SdPage *pPage, SdStyleSheet *pStyleSheet, bool bMasterPage, SfxItemSet& rMergedAttr);
|
||
|
+
|
||
|
} // end of namespace sd
|
||
|
|
||
|
#endif
|
||
|
diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx
|
||
|
index e9c5f00..5c26c55 100644
|
||
|
--- a/sd/source/ui/view/drviews2.cxx
|
||
|
+++ b/sd/source/ui/view/drviews2.cxx
|
||
|
@@ -1190,6 +1190,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
|
||
|
break;
|
||
|
|
||
|
case SID_SELECT_BACKGROUND:
|
||
|
+ case SID_SAVE_BACKGROUND:
|
||
|
case SID_PAGESETUP: // BASIC ??
|
||
|
{
|
||
|
SetCurrentFunction( FuPage::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
|
||
|
diff --git a/sd/source/ui/view/drviews7.cxx b/sd/source/ui/view/drviews7.cxx
|
||
|
index 8b6d968..fba8bc1 100644
|
||
|
--- a/sd/source/ui/view/drviews7.cxx
|
||
|
+++ b/sd/source/ui/view/drviews7.cxx
|
||
|
@@ -83,6 +83,7 @@
|
||
|
#include "fuediglu.hxx"
|
||
|
#include "fubullet.hxx"
|
||
|
#include "fuformatpaintbrush.hxx"
|
||
|
+#include "stlsheet.hxx"
|
||
|
|
||
|
#include <config_features.h>
|
||
|
|
||
|
@@ -714,6 +715,7 @@ void DrawViewShell::GetMenuState( SfxItemSet &rSet )
|
||
|
{
|
||
|
rSet.DisableItem(SID_PRESENTATION_LAYOUT);
|
||
|
rSet.DisableItem(SID_SELECT_BACKGROUND);
|
||
|
+ rSet.DisableItem(SID_SAVE_BACKGROUND);
|
||
|
}
|
||
|
|
||
|
if (mePageKind == PK_NOTES)
|
||
|
@@ -730,6 +732,7 @@ void DrawViewShell::GetMenuState( SfxItemSet &rSet )
|
||
|
rSet.DisableItem(SID_MODIFYPAGE);
|
||
|
|
||
|
rSet.DisableItem(SID_SELECT_BACKGROUND);
|
||
|
+ rSet.DisableItem(SID_SAVE_BACKGROUND);
|
||
|
rSet.DisableItem(SID_INSERTLAYER);
|
||
|
rSet.DisableItem(SID_LAYERMODE);
|
||
|
rSet.DisableItem(SID_INSERTFILE);
|
||
|
@@ -750,6 +753,7 @@ void DrawViewShell::GetMenuState( SfxItemSet &rSet )
|
||
|
rSet.DisableItem(SID_INSERTFILE);
|
||
|
rSet.DisableItem(SID_PAGEMODE);
|
||
|
rSet.DisableItem(SID_SELECT_BACKGROUND);
|
||
|
+ rSet.DisableItem(SID_SAVE_BACKGROUND);
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
@@ -1646,8 +1650,7 @@ void DrawViewShell::GetMenuState( SfxItemSet &rSet )
|
||
|
|| rSet.GetItemState(SID_DISPLAY_MASTER_OBJECTS) == SfxItemState::DEFAULT)
|
||
|
{
|
||
|
SdPage* pPage = GetActualPage();
|
||
|
- if (pPage != NULL
|
||
|
- && GetDoc() != NULL)
|
||
|
+ if (pPage != NULL && GetDoc() != NULL)
|
||
|
{
|
||
|
SetOfByte aVisibleLayers = pPage->TRG_GetMasterPageVisibleLayers();
|
||
|
SdrLayerAdmin& rLayerAdmin = GetDoc()->GetLayerAdmin();
|
||
|
@@ -1668,6 +1671,24 @@ void DrawViewShell::GetMenuState( SfxItemSet &rSet )
|
||
|
}
|
||
|
#endif
|
||
|
|
||
|
+ if (rSet.GetItemState(SID_SAVE_BACKGROUND) == SfxItemState::DEFAULT)
|
||
|
+ {
|
||
|
+ bool bDisableSaveBackground = true;
|
||
|
+ SdPage* pPage = GetActualPage();
|
||
|
+ if (pPage != NULL && GetDoc() != NULL)
|
||
|
+ {
|
||
|
+ SfxItemSet aMergedAttr(GetDoc()->GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST, 0);
|
||
|
+ SdStyleSheet* pStyleSheet = pPage->getPresentationStyle(HID_PSEUDOSHEET_BACKGROUND);
|
||
|
+ MergePageBackgroundFilling(pPage, pStyleSheet, meEditMode == EM_MASTERPAGE, aMergedAttr);
|
||
|
+ if (drawing::FillStyle_BITMAP == static_cast<const XFillStyleItem&>(aMergedAttr.Get(XATTR_FILLSTYLE)).GetValue())
|
||
|
+ {
|
||
|
+ bDisableSaveBackground = false;
|
||
|
+ }
|
||
|
+ }
|
||
|
+ if (bDisableSaveBackground)
|
||
|
+ rSet.DisableItem(SID_SAVE_BACKGROUND);
|
||
|
+ }
|
||
|
+
|
||
|
GetModeSwitchingMenuState (rSet);
|
||
|
}
|
||
|
|
||
|
--
|
||
|
2.4.3
|
||
|
|