summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-09-30 13:30:36 +0100
committerCaolán McNamara <caolanm@redhat.com>2015-09-30 13:35:44 +0100
commited25a000ab67324075e68d9a7f3ca657b4e6a573 (patch)
tree3debdd93da4f701a01e679cb2480af77bcaea53e
parent739094745eb051e9a733ef16f59aba4cb74ea93e (diff)
implement save slide background for impress
to go along with the existing "set background", same sort of thing as the competitor's effort Change-Id: I2a1106771ead2cd926f3d631850447499340697c
-rw-r--r--officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu7
-rw-r--r--sd/inc/app.hrc1
-rw-r--r--sd/inc/sdcommands.h1
-rw-r--r--sd/sdi/_drvwsh.sdi5
-rw-r--r--sd/sdi/sdraw.sdi24
-rw-r--r--sd/source/ui/app/menuids_tmpl.src11
-rw-r--r--sd/source/ui/func/fupage.cxx85
-rw-r--r--sd/source/ui/inc/DrawViewShell.hxx4
-rw-r--r--sd/source/ui/view/drviews2.cxx1
-rw-r--r--sd/source/ui/view/drviews7.cxx25
10 files changed, 127 insertions, 37 deletions
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu
index 9e611827be3f..d80b94db16fc 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu
@@ -1409,7 +1409,12 @@
</node>
<node oor:name=".uno:SelectBackground" oor:op="replace">
<prop oor:name="Label" oor:type="xs:string">
- <value xml:lang="en-US">Background Image...</value>
+ <value xml:lang="en-US">Set Background Image...</value>
+ </prop>
+ </node>
+ <node oor:name=".uno:SaveBackground" oor:op="replace">
+ <prop oor:name="Label" oor:type="xs:string">
+ <value xml:lang="en-US">Save Background Image...</value>
</prop>
</node>
<node oor:name=".uno:DisplayMasterBackground" oor:op="replace">
diff --git a/sd/inc/app.hrc b/sd/inc/app.hrc
index 4e1306c773aa..0b21cd0deb43 100644
--- a/sd/inc/app.hrc
+++ b/sd/inc/app.hrc
@@ -449,6 +449,7 @@
#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)
diff --git a/sd/inc/sdcommands.h b/sd/inc/sdcommands.h
index 2f4bf56121ef..1d3502f1cd6b 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 2f7769be816b..c25285d9de80 100644
--- a/sd/sdi/_drvwsh.sdi
+++ b/sd/sdi/_drvwsh.sdi
@@ -2695,6 +2695,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 5fd19ad8bde8..cda8bf8e3be5 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 5221ff1f35f2..c32cd2d04782 100644
--- a/sd/source/ui/app/menuids_tmpl.src
+++ b/sd/source/ui/app/menuids_tmpl.src
@@ -130,6 +130,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\
{\
@@ -161,6 +168,7 @@
MN_SELECT_BACKGROUND\
MN_PAGE_DESIGN\
MN_RENAME_PAGE\
+ MN_SAVE_BACKGROUND\
};\
};\
Text [ en-US ] = "Pag~e" ; \
@@ -192,7 +200,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 f652f82a54e3..2fcf8815f7cb 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);
}
std::unique_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 6205ef373113..e6d24e7805d4 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;
@@ -515,6 +516,9 @@ private:
Color mnAppBackgroundColor;
};
+ /// 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 358d3cea0075..2a8c7bfb6844 100644
--- a/sd/source/ui/view/drviews2.cxx
+++ b/sd/source/ui/view/drviews2.cxx
@@ -1184,6 +1184,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 2f3484e3ca86..480b433445de 100644
--- a/sd/source/ui/view/drviews7.cxx
+++ b/sd/source/ui/view/drviews7.cxx
@@ -84,6 +84,7 @@
#include "fubullet.hxx"
#include "fuconcs.hxx"
#include "fuformatpaintbrush.hxx"
+#include "stlsheet.hxx"
#include <config_features.h>
@@ -678,6 +679,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)
@@ -694,6 +696,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);
@@ -714,6 +717,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
{
@@ -1593,8 +1597,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();
@@ -1615,6 +1618,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);
}