[Libreoffice-commits] core.git: sd/source sd/uiconfig sd/UIConfig_simpress.mk

Caolán McNamara caolanm at redhat.com
Thu Apr 13 13:44:41 UTC 2017


 sd/UIConfig_simpress.mk                           |    1 
 sd/source/ui/animations/CustomAnimation.hrc       |    9 --
 sd/source/ui/animations/CustomAnimation.src       |   49 ---------------
 sd/source/ui/animations/CustomAnimationDialog.cxx |   43 +++++++------
 sd/uiconfig/simpress/ui/scalemenu.ui              |   71 ++++++++++++++++++++++
 5 files changed, 95 insertions(+), 78 deletions(-)

New commits:
commit a713544b18383c6e5e8d887695e587c2e1b7335a
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Apr 13 14:26:48 2017 +0100

    convert the scale menu to .ui
    
    (see tdf#48918 for what's needed to enable the grow/shrink entry so
    this can be seen)
    
    Change-Id: Ib36907695eb068a22052d08467739e433b240a40

diff --git a/sd/UIConfig_simpress.mk b/sd/UIConfig_simpress.mk
index 60d250604268..feae99758a85 100644
--- a/sd/UIConfig_simpress.mk
+++ b/sd/UIConfig_simpress.mk
@@ -137,6 +137,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/simpress,\
 	sd/uiconfig/simpress/ui/prntopts \
 	sd/uiconfig/simpress/ui/publishingdialog \
 	sd/uiconfig/simpress/ui/remotedialog \
+	sd/uiconfig/simpress/ui/scalemenu \
 	sd/uiconfig/simpress/ui/sdviewpage \
 	sd/uiconfig/simpress/ui/sidebarslidebackground \
 	sd/uiconfig/simpress/ui/slidedesigndialog \
diff --git a/sd/source/ui/animations/CustomAnimation.hrc b/sd/source/ui/animations/CustomAnimation.hrc
index 0f0a69bdf8d7..062def473af8 100644
--- a/sd/source/ui/animations/CustomAnimation.hrc
+++ b/sd/source/ui/animations/CustomAnimation.hrc
@@ -27,7 +27,6 @@
 // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
 #define RID_CUSTOMANIMATION_ROTATION_POPUP              RID_CUSTOMANIMATION_START+9
-#define RID_CUSTOMANIMATION_SCALE_POPUP                 RID_CUSTOMANIMATION_START+11
 #define RID_CUSTOMANIMATION_FONTSTYLE_POPUP             RID_CUSTOMANIMATION_START+12
 
 #define BMP_CUSTOMANIMATION_ON_CLICK                    RID_CUSTOMANIMATION_START+0
@@ -80,14 +79,6 @@
 #define CM_CLOCKWISE                5
 #define CM_COUNTERCLOCKWISE         6
 
-#define CM_SIZE_25                  25
-#define CM_SIZE_50                  50
-#define CM_SIZE_150                 150
-#define CM_SIZE_400                 400
-#define CM_HORIZONTAL               1
-#define CM_VERTICAL                 2
-#define CM_BOTH                     3
-
 #define CM_BOLD                     1
 #define CM_ITALIC                   2
 #define CM_UNDERLINED               3
diff --git a/sd/source/ui/animations/CustomAnimation.src b/sd/source/ui/animations/CustomAnimation.src
index ae5fe4267a6c..b3eda0013c87 100644
--- a/sd/source/ui/animations/CustomAnimation.src
+++ b/sd/source/ui/animations/CustomAnimation.src
@@ -19,55 +19,6 @@
 
 #include "CustomAnimation.hrc"
 
-Menu RID_CUSTOMANIMATION_SCALE_POPUP
-{
-    ItemList =
-    {
-        MenuItem
-        {
-            Identifier = CM_SIZE_25 ;
-            Text [ en-US ] = "Tiny" ;
-        };
-        MenuItem
-        {
-            Identifier = CM_SIZE_50 ;
-            Text [ en-US ] = "Smaller" ;
-        };
-        MenuItem
-        {
-            Identifier = CM_SIZE_150 ;
-            Text [ en-US ] = "Larger" ;
-        };
-        MenuItem
-        {
-            Identifier = CM_SIZE_400 ;
-            Text [ en-US ] = "Extra large" ;
-        };
-        MenuItem
-        {
-            Separator = TRUE ;
-        };
-        MenuItem
-        {
-            Identifier = CM_HORIZONTAL  ;
-            Text [ en-US ] = "Horizontal" ;
-
-        };
-        MenuItem
-        {
-            Identifier = CM_VERTICAL ;
-            Text [ en-US ] = "Vertical" ;
-
-        };
-        MenuItem
-        {
-            Identifier = CM_BOTH ;
-            Text [ en-US ] = "Both" ;
-
-        };
-    };
-};
-
 Menu RID_CUSTOMANIMATION_ROTATION_POPUP
 {
     ItemList =
diff --git a/sd/source/ui/animations/CustomAnimationDialog.cxx b/sd/source/ui/animations/CustomAnimationDialog.cxx
index 6facfeef0f9b..e59968b9c660 100644
--- a/sd/source/ui/animations/CustomAnimationDialog.cxx
+++ b/sd/source/ui/animations/CustomAnimationDialog.cxx
@@ -723,6 +723,7 @@ public:
     void updateMenu();
 
 private:
+    VclBuilder maBuilder;
     VclPtr<DropdownMenuBox>   mpControl;
     VclPtr<PopupMenu>         mpMenu;
     VclPtr<MetricField>       mpMetric;
@@ -730,16 +731,17 @@ private:
     int                       mnDirection;
 };
 
-ScalePropertyBox::ScalePropertyBox( sal_Int32 nControlType, vcl::Window* pParent, const Any& rValue, const Link<LinkParamNone*,void>& rModifyHdl )
-: PropertySubControl( nControlType )
-, maModifyHdl( rModifyHdl )
+ScalePropertyBox::ScalePropertyBox(sal_Int32 nControlType, vcl::Window* pParent, const Any& rValue, const Link<LinkParamNone*,void>& rModifyHdl)
+    : PropertySubControl( nControlType )
+    , maBuilder(nullptr, VclBuilderContainer::getUIRootDir(), "modules/simpress/ui/scalemenu.ui", "")
+    , maModifyHdl( rModifyHdl )
 {
     mpMetric.set( VclPtr<MetricField>::Create( pParent ,WB_TABSTOP|WB_IGNORETAB| WB_NOBORDER) );
     mpMetric->SetUnit( FUNIT_PERCENT );
     mpMetric->SetMin( 0 );
     mpMetric->SetMax( 10000 );
 
-    mpMenu = VclPtr<PopupMenu>::Create(SdResId( RID_CUSTOMANIMATION_SCALE_POPUP ) );
+    mpMenu = maBuilder.get_menu("menu");
     mpControl = VclPtr<DropdownMenuBox>::Create( pParent, mpMetric, mpMenu );
     mpControl->SetMenuSelectHdl( LINK( this, ScalePropertyBox, implMenuSelectHdl ));
     mpControl->SetHelpId( HID_SD_CUSTOMANIMATIONPANE_SCALEPROPERTYBOX );
@@ -753,6 +755,7 @@ ScalePropertyBox::ScalePropertyBox( sal_Int32 nControlType, vcl::Window* pParent
 
 ScalePropertyBox::~ScalePropertyBox()
 {
+    maBuilder.disposeBuilder();
     mpControl.disposeAndClear();
 }
 
@@ -760,14 +763,14 @@ void ScalePropertyBox::updateMenu()
 {
     sal_Int64 nValue = mpMetric->GetValue();
 
-    mpMenu->CheckItem( 25, nValue == 25 );
-    mpMenu->CheckItem( 50, nValue == 50 );
-    mpMenu->CheckItem( 150, nValue == 150 );
-    mpMenu->CheckItem( 400, nValue == 400 );
+    mpMenu->CheckItem(mpMenu->GetItemId("25"), nValue == 25);
+    mpMenu->CheckItem(mpMenu->GetItemId("50"), nValue == 50);
+    mpMenu->CheckItem(mpMenu->GetItemId("150"), nValue == 150);
+    mpMenu->CheckItem(mpMenu->GetItemId("400"), nValue == 400);
 
-    mpMenu->CheckItem( CM_HORIZONTAL, mnDirection == 1 );
-    mpMenu->CheckItem( CM_VERTICAL, mnDirection == 2 );
-    mpMenu->CheckItem( CM_BOTH, mnDirection == 3 );
+    mpMenu->CheckItem(mpMenu->GetItemId("hori"), mnDirection == 1);
+    mpMenu->CheckItem(mpMenu->GetItemId("vert"), mnDirection == 2);
+    mpMenu->CheckItem(mpMenu->GetItemId("both"), mnDirection == 3);
 }
 
 IMPL_LINK_NOARG(ScalePropertyBox, implModifyHdl, Edit&, void)
@@ -782,15 +785,15 @@ IMPL_LINK( ScalePropertyBox, implMenuSelectHdl, MenuButton*, pPb, void )
 
     int nDirection = mnDirection;
 
-    switch( pPb->GetCurItemId() )
-    {
-    case CM_HORIZONTAL: nDirection = 1; break;
-    case CM_VERTICAL: nDirection = 2; break;
-    case CM_BOTH: nDirection = 3; break;
-
-    default:
-        nValue = pPb->GetCurItemId();
-    }
+    OString sIdent(pPb->GetCurItemIdent());
+    if (sIdent == "hori")
+        nDirection = 1;
+    else if (sIdent == "veri")
+        nDirection = 2;
+    else if (sIdent == "both")
+        nDirection = 3;
+    else
+        nValue = sIdent.toInt32();
 
     bool bModified = false;
 
diff --git a/sd/uiconfig/simpress/ui/scalemenu.ui b/sd/uiconfig/simpress/ui/scalemenu.ui
new file mode 100644
index 000000000000..b0978fc35fa1
--- /dev/null
+++ b/sd/uiconfig/simpress/ui/scalemenu.ui
@@ -0,0 +1,71 @@
+<?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="GtkMenuItem" id="25">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">Tiny</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="50">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">Smaller</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="150">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">Larger</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="400">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">Extra Large</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkSeparatorMenuItem" id="menuitem1">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="hori">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">Horizontal</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="vert">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">Vertical</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="both">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">Both</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+  </object>
+</interface>


More information about the Libreoffice-commits mailing list