summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-04-13 15:08:56 +0100
committerCaolán McNamara <caolanm@redhat.com>2017-04-13 15:08:56 +0100
commitcf4ac0f731a42ea2ae97aba4d78ae53b49844888 (patch)
tree9269a9a10826854f7f880f28242fc19c8094cd93 /sd
parenta756bd31dd2da1ef134d80b2dc276cb0be228aba (diff)
convert font style menu to .ui
Change-Id: I3c66c59dcf55276bf340645206422c0cf7396b04
Diffstat (limited to 'sd')
-rw-r--r--sd/UIConfig_simpress.mk1
-rw-r--r--sd/source/ui/animations/CustomAnimation.hrc6
-rw-r--r--sd/source/ui/animations/CustomAnimation.src22
-rw-r--r--sd/source/ui/animations/CustomAnimationDialog.cxx32
-rw-r--r--sd/uiconfig/simpress/ui/fontstylemenu.ui33
5 files changed, 51 insertions, 43 deletions
diff --git a/sd/UIConfig_simpress.mk b/sd/UIConfig_simpress.mk
index a4f981a8c6be..070572c23309 100644
--- a/sd/UIConfig_simpress.mk
+++ b/sd/UIConfig_simpress.mk
@@ -119,6 +119,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/simpress,\
sd/uiconfig/simpress/ui/dockinganimation \
sd/uiconfig/simpress/ui/effectmenu \
sd/uiconfig/simpress/ui/fontsizemenu \
+ sd/uiconfig/simpress/ui/fontstylemenu \
sd/uiconfig/simpress/ui/headerfooterdialog \
sd/uiconfig/simpress/ui/headerfootertab \
sd/uiconfig/simpress/ui/insertslides \
diff --git a/sd/source/ui/animations/CustomAnimation.hrc b/sd/source/ui/animations/CustomAnimation.hrc
index d940c17c8e0a..2dfbb26f5d51 100644
--- a/sd/source/ui/animations/CustomAnimation.hrc
+++ b/sd/source/ui/animations/CustomAnimation.hrc
@@ -26,8 +26,6 @@
// attention, we have 200 ids free after RID_CUSTOMANIMATION_START
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-#define RID_CUSTOMANIMATION_FONTSTYLE_POPUP RID_CUSTOMANIMATION_START+12
-
#define BMP_CUSTOMANIMATION_ON_CLICK RID_CUSTOMANIMATION_START+0
#define BMP_CUSTOMANIMATION_AFTER_PREVIOUS RID_CUSTOMANIMATION_START+1
#define BMP_CUSTOMANIMATION_ENTRANCE_EFFECT RID_CUSTOMANIMATION_START+2
@@ -71,10 +69,6 @@
#define STR_CUSTOMANIMATION_EXIT RID_CUSTOMANIMATION_START+41
#define STR_CUSTOMANIMATION_MOTION_PATHS RID_CUSTOMANIMATION_START+42
-#define CM_BOLD 1
-#define CM_ITALIC 2
-#define CM_UNDERLINED 3
-
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/animations/CustomAnimation.src b/sd/source/ui/animations/CustomAnimation.src
index ff23e8897f6e..f9d8cfaed76c 100644
--- a/sd/source/ui/animations/CustomAnimation.src
+++ b/sd/source/ui/animations/CustomAnimation.src
@@ -19,28 +19,6 @@
#include "CustomAnimation.hrc"
-Menu RID_CUSTOMANIMATION_FONTSTYLE_POPUP
-{
- ItemList =
- {
- MenuItem
- {
- Identifier = CM_BOLD ;
- Text [ en-US ] = "Bold" ;
- };
- MenuItem
- {
- Identifier = CM_ITALIC ;
- Text [ en-US ] = "Italic" ;
- };
- MenuItem
- {
- Identifier = CM_UNDERLINED ;
- Text [ en-US ] = "Underlined" ;
- };
- };
-};
-
String STR_CUSTOMANIMATION_REPEAT_NONE
{
Text [ en-US ] = "none";
diff --git a/sd/source/ui/animations/CustomAnimationDialog.cxx b/sd/source/ui/animations/CustomAnimationDialog.cxx
index fcd86cdcab0e..791ebf251670 100644
--- a/sd/source/ui/animations/CustomAnimationDialog.cxx
+++ b/sd/source/ui/animations/CustomAnimationDialog.cxx
@@ -883,6 +883,7 @@ public:
void update();
private:
+ VclBuilder maBuilder;
VclPtr<DropdownMenuBox> mpControl;
VclPtr<PopupMenu> mpMenu;
VclPtr<Edit> mpEdit;
@@ -894,13 +895,14 @@ private:
};
FontStylePropertyBox::FontStylePropertyBox( sal_Int32 nControlType, vcl::Window* pParent, const Any& rValue, const Link<LinkParamNone*,void>& rModifyHdl )
-: PropertySubControl( nControlType )
-, maModifyHdl( rModifyHdl )
+ : PropertySubControl(nControlType)
+ , maBuilder(nullptr, VclBuilderContainer::getUIRootDir(), "modules/simpress/ui/fontstylemenu.ui", "")
+ , maModifyHdl( rModifyHdl )
{
mpEdit.set( VclPtr<Edit>::Create( pParent, WB_TABSTOP|WB_IGNORETAB|WB_NOBORDER|WB_READONLY) );
mpEdit->SetText( SD_RESSTR(STR_CUSTOMANIMATION_SAMPLE) );
- mpMenu = VclPtr<PopupMenu>::Create(SdResId( RID_CUSTOMANIMATION_FONTSTYLE_POPUP ) );
+ mpMenu = maBuilder.get_menu("menu");
mpControl = VclPtr<DropdownMenuBox>::Create( pParent, mpEdit, mpMenu );
mpControl->SetMenuSelectHdl( LINK( this, FontStylePropertyBox, implMenuSelectHdl ));
mpControl->SetHelpId( HID_SD_CUSTOMANIMATIONPANE_FONTSTYLEPROPERTYBOX );
@@ -911,15 +913,16 @@ FontStylePropertyBox::FontStylePropertyBox( sal_Int32 nControlType, vcl::Window*
FontStylePropertyBox::~FontStylePropertyBox()
{
+ maBuilder.disposeBuilder();
mpControl.disposeAndClear();
}
void FontStylePropertyBox::update()
{
// update menu
- mpMenu->CheckItem( CM_BOLD, mfFontWeight == awt::FontWeight::BOLD );
- mpMenu->CheckItem( CM_ITALIC, meFontSlant == awt::FontSlant_ITALIC);
- mpMenu->CheckItem( CM_UNDERLINED, mnFontUnderline != awt::FontUnderline::NONE );
+ mpMenu->CheckItem(mpMenu->GetItemId("bold"), mfFontWeight == awt::FontWeight::BOLD);
+ mpMenu->CheckItem(mpMenu->GetItemId("italic"), meFontSlant == awt::FontSlant_ITALIC);
+ mpMenu->CheckItem(mpMenu->GetItemId("underline"), mnFontUnderline != awt::FontUnderline::NONE );
// update sample edit
vcl::Font aFont( mpEdit->GetFont() );
@@ -932,28 +935,27 @@ void FontStylePropertyBox::update()
IMPL_LINK( FontStylePropertyBox, implMenuSelectHdl, MenuButton*, pPb, void )
{
- switch( pPb->GetCurItemId() )
+ OString sIdent = pPb->GetCurItemIdent();
+ if (sIdent == "bold")
{
- case CM_BOLD:
if( mfFontWeight == awt::FontWeight::BOLD )
mfFontWeight = awt::FontWeight::NORMAL;
else
mfFontWeight = awt::FontWeight::BOLD;
- break;
- case CM_ITALIC:
+ }
+ else if (sIdent == "italic")
+ {
if( meFontSlant == awt::FontSlant_ITALIC )
meFontSlant = awt::FontSlant_NONE;
else
meFontSlant = awt::FontSlant_ITALIC;
- break;
- case CM_UNDERLINED:
+ }
+ else if (sIdent == "underline")
+ {
if( mnFontUnderline == awt::FontUnderline::SINGLE )
mnFontUnderline = awt::FontUnderline::NONE;
else
mnFontUnderline = awt::FontUnderline::SINGLE;
- break;
- default:
- return;
}
update();
diff --git a/sd/uiconfig/simpress/ui/fontstylemenu.ui b/sd/uiconfig/simpress/ui/fontstylemenu.ui
new file mode 100644
index 000000000000..191f41d5b2d0
--- /dev/null
+++ b/sd/uiconfig/simpress/ui/fontstylemenu.ui
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.20.0 -->
+<interface>
+ <requires lib="gtk+" version="3.10"/>
+ <object class="GtkMenu" id="menu">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkCheckMenuItem" id="bold">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Bold</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkCheckMenuItem" id="italic">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Italic</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkCheckMenuItem" id="underline">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Underlined</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ </object>
+</interface>