Kaydet (Commit) ed25a000 authored tarafından Caolán McNamara's avatar Caolán McNamara

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
üst 73909474
......@@ -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">
......
......@@ -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)
......
......@@ -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"
......
......@@ -2695,6 +2695,11 @@ interface DrawView
ExecMethod = FuTemporary ;
StateMethod = GetMenuState ;
]
SID_SAVE_BACKGROUND
[
ExecMethod = FuTemporary ;
StateMethod = GetMenuState ;
]
SID_DISPLAY_MASTER_BACKGROUND
[
ExecMethod = FuTemporary ;
......
......@@ -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: */
......
......@@ -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 \
......
......@@ -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 )
{
......
......@@ -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
......
......@@ -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 ) );
......
......@@ -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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment