sd/UIConfig_simpress.mk                         |    1 
 sd/source/ui/animations/CustomAnimation.hrc     |    9 ---
 sd/source/ui/animations/CustomAnimation.src     |   41 ----------------
 sd/source/ui/animations/CustomAnimationList.cxx |   31 +++++++-----
 sd/source/ui/animations/CustomAnimationList.hxx |    5 +
 sd/source/ui/animations/CustomAnimationPane.cxx |   29 +++--------
 sd/source/ui/animations/CustomAnimationPane.hxx |    2 
 sd/uiconfig/simpress/ui/effectmenu.ui           |   61 ++++++++++++++++++++++++
 sw/source/filter/ww8/ww8graf.cxx                |   10 +++
 9 files changed, 105 insertions(+), 84 deletions(-)

New commits:
commit e72f3ce68e18ac604469ce5e856341a469af27ff
Author: Caolán McNamara <caol...@redhat.com>
Date:   Thu Apr 13 13:01:35 2017 +0100

    ofz: header has to be at least 1 pair long
    
    Change-Id: I5725048519a2b68265e90d12b1e4bcb506c56fc2

diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx
index 7d843a225a0a..e3fbbaf62732 100644
--- a/sw/source/filter/ww8/ww8graf.cxx
+++ b/sw/source/filter/ww8/ww8graf.cxx
@@ -1248,12 +1248,20 @@ SdrObject* SwWW8ImplReader::ReadCaptionBox(WW8_DPHEAD* 
pHd, SfxAllItemSet &rSet)
         return nullptr;
 
     sal_uInt16 nCount = SVBT16ToShort( aCallB.dpPolyLine.aBits1 ) >> 1 & 
0x7fff;
+    if (nCount < 1)
+    {
+        SAL_WARN("sw.ww8", "Short CaptionBox header");
+        return nullptr;
+    }
+
     std::unique_ptr<SVBT16[]> xP(new SVBT16[nCount * 2]);
 
     bool bCouldRead = checkRead(*m_pStrm, xP.get(), nCount * 4);      // 
Punkte einlesen
-    OSL_ENSURE(bCouldRead, "Short CaptionBox header");
     if (!bCouldRead)
+    {
+        SAL_WARN("sw.ww8", "Short CaptionBox header");
         return nullptr;
+    }
 
     sal_uInt8 nTyp = (sal_uInt8)nCount - 1;
     if( nTyp == 1 && SVBT16ToShort( xP[0] ) == SVBT16ToShort( xP[2] ) )
commit fb8f2313ba539f585de418a9a37e2a245a8def92
Author: Caolán McNamara <caol...@redhat.com>
Date:   Thu Apr 13 12:43:19 2017 +0100

    effect start entries should be radio buttons
    
    Change-Id: I7ed3bbb83930d3989a4bc4e6684b5cc4811cd836

diff --git a/sd/uiconfig/simpress/ui/effectmenu.ui 
b/sd/uiconfig/simpress/ui/effectmenu.ui
index 33f40433ccec..7971047a8f4d 100644
--- a/sd/uiconfig/simpress/ui/effectmenu.ui
+++ b/sd/uiconfig/simpress/ui/effectmenu.ui
@@ -6,7 +6,7 @@
     <property name="visible">True</property>
     <property name="can_focus">False</property>
     <child>
-      <object class="GtkMenuItem" id="onclick">
+      <object class="GtkRadioMenuItem" id="onclick">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
         <property name="label" translatable="yes">Start On _Click</property>
@@ -14,7 +14,7 @@
       </object>
     </child>
     <child>
-      <object class="GtkMenuItem" id="withprev">
+      <object class="GtkRadioMenuItem" id="withprev">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
         <property name="label" translatable="yes">Start _With 
Previous</property>
@@ -22,7 +22,7 @@
       </object>
     </child>
     <child>
-      <object class="GtkMenuItem" id="afterprev">
+      <object class="GtkRadioMenuItem" id="afterprev">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
         <property name="label" translatable="yes">Start _After 
Previous</property>
commit af50fddf5e49514fd6f730521f9bd914af30fd1d
Author: Caolán McNamara <caol...@redhat.com>
Date:   Thu Apr 13 12:29:30 2017 +0100

    convert effects menu to .ui
    
    Change-Id: I7c6d060e8d8ccd033e5093fc03cb19d9efe7877d

diff --git a/sd/UIConfig_simpress.mk b/sd/UIConfig_simpress.mk
index 3429e7df4dc7..9561e5c5518f 100644
--- a/sd/UIConfig_simpress.mk
+++ b/sd/UIConfig_simpress.mk
@@ -117,6 +117,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/simpress,\
        sd/uiconfig/simpress/ui/definecustomslideshow \
        sd/uiconfig/simpress/ui/dlgfield \
        sd/uiconfig/simpress/ui/dockinganimation \
+       sd/uiconfig/simpress/ui/effectmenu \
        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 f6a6b0555c14..9124b4386eb1 100644
--- a/sd/source/ui/animations/CustomAnimation.hrc
+++ b/sd/source/ui/animations/CustomAnimation.hrc
@@ -26,7 +26,6 @@
 // attention, we have 200 ids free after RID_CUSTOMANIMATION_START
 // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
-#define RID_EFFECT_CONTEXTMENU                          
RID_CUSTOMANIMATION_START+0
 #define RID_CUSTOMANIMATION_ROTATION_POPUP              
RID_CUSTOMANIMATION_START+9
 #define RID_CUSTOMANIMATION_FONTSIZE_POPUP              
RID_CUSTOMANIMATION_START+10
 #define RID_CUSTOMANIMATION_SCALE_POPUP                 
RID_CUSTOMANIMATION_START+11
@@ -75,14 +74,6 @@
 #define STR_CUSTOMANIMATION_EXIT                        
RID_CUSTOMANIMATION_START+41
 #define STR_CUSTOMANIMATION_MOTION_PATHS                
RID_CUSTOMANIMATION_START+42
 
-#define CM_WITH_CLICK               1
-#define CM_WITH_PREVIOUS            2
-#define CM_AFTER_PREVIOUS           3
-#define CM_OPTIONS                  4
-#define CM_DURATION                 5
-#define CM_REMOVE                   6
-#define CM_CREATE                   7
-
 #define CM_QUARTER_SPIN             1
 #define CM_HALF_SPIN                2
 #define CM_FULL_SPIN                3
diff --git a/sd/source/ui/animations/CustomAnimation.src 
b/sd/source/ui/animations/CustomAnimation.src
index c955cad124a2..34eedb138aad 100644
--- a/sd/source/ui/animations/CustomAnimation.src
+++ b/sd/source/ui/animations/CustomAnimation.src
@@ -19,47 +19,6 @@
 
 #include "CustomAnimation.hrc"
 
-Menu RID_EFFECT_CONTEXTMENU
-{
-    ItemList =
-    {
-        MenuItem
-        {
-            Identifier = CM_WITH_CLICK ;
-            Text [ en-US ] = "Start On ~Click" ;
-        };
-        MenuItem
-        {
-            Identifier = CM_WITH_PREVIOUS ;
-            Text [ en-US ] = "Start ~With Previous" ;
-        };
-        MenuItem
-        {
-            Identifier = CM_AFTER_PREVIOUS;
-            Text [ en-US ] = "Start ~After Previous" ;
-        };
-        MenuItem
-        {
-            Separator = TRUE ;
-        };
-        MenuItem
-        {
-            Identifier = CM_OPTIONS;
-            Text [ en-US ] = "~Effect Options..." ;
-        };
-        MenuItem
-        {
-            Identifier = CM_DURATION;
-            Text [ en-US ] = "~Timing..." ;
-        };
-        MenuItem
-        {
-            Identifier = CM_REMOVE;
-            Text [ en-US ] = "~Remove" ;
-        };
-    };
-};
-
 Menu RID_CUSTOMANIMATION_FONTSIZE_POPUP
 {
     ItemList =
diff --git a/sd/source/ui/animations/CustomAnimationList.cxx 
b/sd/source/ui/animations/CustomAnimationList.cxx
index ae782622bdc9..0477f54114d3 100644
--- a/sd/source/ui/animations/CustomAnimationList.cxx
+++ b/sd/source/ui/animations/CustomAnimationList.cxx
@@ -445,7 +445,6 @@ CustomAnimationList::CustomAnimationList( vcl::Window* 
pParent )
     , mnLastGroupId(0)
     , mpLastParentEntry(nullptr)
 {
-
     EnableContextMenuHandling();
     SetSelectionMode( SelectionMode::Multiple );
     SetOptimalImageIndent();
@@ -478,6 +477,10 @@ void CustomAnimationList::dispose()
         mpMainSequence->removeListener( this );
 
     clear();
+
+    mxMenu.disposeAndClear();
+    mxBuilder.reset();
+
     SvTreeListBox::dispose();
 }
 
@@ -486,8 +489,12 @@ void CustomAnimationList::KeyInput( const KeyEvent& rKEvt )
     const int nKeyCode = rKEvt.GetKeyCode().GetCode();
     switch( nKeyCode )
     {
-        case KEY_DELETE:    mpController->onContextMenu( CM_REMOVE ); return;
-        case KEY_INSERT:    mpController->onContextMenu( CM_CREATE ); return;
+        case KEY_DELETE:
+            mpController->onContextMenu("remove");
+            return;
+        case KEY_INSERT:
+            mpController->onContextMenu("create");
+            return;
         case KEY_SPACE:
             {
                 const Point aPos;
@@ -892,7 +899,9 @@ bool CustomAnimationList::DoubleClickHdl()
 
 VclPtr<PopupMenu> CustomAnimationList::CreateContextMenu()
 {
-    VclPtrInstance<PopupMenu> pMenu(SdResId( RID_EFFECT_CONTEXTMENU ));
+    mxMenu.disposeAndClear();
+    mxBuilder.reset(new VclBuilder(nullptr, 
VclBuilderContainer::getUIRootDir(), "modules/simpress/ui/effectmenu.ui", ""));
+    mxMenu.set(mxBuilder->get_menu("menu"));
 
     sal_Int16 nNodeType = -1;
     sal_Int16 nEntries = 0;
@@ -921,18 +930,18 @@ VclPtr<PopupMenu> CustomAnimationList::CreateContextMenu()
         pEntry = static_cast< CustomAnimationListEntry* >(NextSelected( pEntry 
));
     }
 
-    pMenu->CheckItem( CM_WITH_CLICK, nNodeType == EffectNodeType::ON_CLICK );
-    pMenu->CheckItem( CM_WITH_PREVIOUS, nNodeType == 
EffectNodeType::WITH_PREVIOUS );
-    pMenu->CheckItem( CM_AFTER_PREVIOUS, nNodeType == 
EffectNodeType::AFTER_PREVIOUS );
-    pMenu->EnableItem( CM_OPTIONS, nEntries == 1 );
-    pMenu->EnableItem( CM_DURATION, nEntries == 1 );
+    mxMenu->CheckItem(mxMenu->GetItemId("onclick"), nNodeType == 
EffectNodeType::ON_CLICK);
+    mxMenu->CheckItem(mxMenu->GetItemId("withprev"), nNodeType == 
EffectNodeType::WITH_PREVIOUS);
+    mxMenu->CheckItem(mxMenu->GetItemId("afterprev"), nNodeType == 
EffectNodeType::AFTER_PREVIOUS);
+    mxMenu->EnableItem(mxMenu->GetItemId("options"), nEntries == 1);
+    mxMenu->EnableItem(mxMenu->GetItemId("timing"), nEntries == 1);
 
-    return pMenu;
+    return mxMenu;
 }
 
 void CustomAnimationList::ExecuteContextMenuAction( sal_uInt16 
nSelectedPopupEntry )
 {
-    mpController->onContextMenu( nSelectedPopupEntry );
+    mpController->onContextMenu(mxMenu->GetItemIdent(nSelectedPopupEntry));
 }
 
 void CustomAnimationList::notify_change()
diff --git a/sd/source/ui/animations/CustomAnimationList.hxx 
b/sd/source/ui/animations/CustomAnimationList.hxx
index 07303eedbb03..6f8cf8d78fea 100644
--- a/sd/source/ui/animations/CustomAnimationList.hxx
+++ b/sd/source/ui/animations/CustomAnimationList.hxx
@@ -40,7 +40,7 @@ class ICustomAnimationListController
 public:
     virtual void onSelect() = 0;
     virtual void onDoubleClick() = 0;
-    virtual void onContextMenu( sal_uInt16 nSelectedPopupEntry ) = 0;
+    virtual void onContextMenu(const OString &rIdent) = 0;
     virtual ~ICustomAnimationListController() {}
 };
 
@@ -96,6 +96,9 @@ public:
     };
 
 private:
+    std::unique_ptr<VclBuilder> mxBuilder;
+    VclPtr<PopupMenu> mxMenu;
+
     bool    mbIgnorePaint;
 
     /** appends the given effect to the list*/
diff --git a/sd/source/ui/animations/CustomAnimationPane.cxx 
b/sd/source/ui/animations/CustomAnimationPane.cxx
index e446748f2b5c..86c77ac79387 100644
--- a/sd/source/ui/animations/CustomAnimationPane.cxx
+++ b/sd/source/ui/animations/CustomAnimationPane.cxx
@@ -878,33 +878,22 @@ void CustomAnimationPane::onDoubleClick()
     showOptions();
 }
 
-void CustomAnimationPane::onContextMenu( sal_uInt16 nSelectedPopupEntry )
+void CustomAnimationPane::onContextMenu(const OString &rIdent)
 {
-    switch( nSelectedPopupEntry )
-    {
-    case CM_WITH_CLICK:
+    if (rIdent == "onclick")
         onChangeStart( EffectNodeType::ON_CLICK );
-        break;
-    case CM_WITH_PREVIOUS:
+    else if (rIdent == "withprev")
         onChangeStart( EffectNodeType::WITH_PREVIOUS  );
-        break;
-    case CM_AFTER_PREVIOUS:
+    else if (rIdent == "afterprev")
         onChangeStart( EffectNodeType::AFTER_PREVIOUS );
-        break;
-    case CM_OPTIONS:
+    else if (rIdent == "options")
         showOptions();
-        break;
-    case CM_DURATION:
+    else if (rIdent == "timing")
         showOptions("timing");
-        break;
-    case CM_REMOVE:
+    else if (rIdent == "remove")
         onRemove();
-        break;
-    case CM_CREATE:
-        if( maViewSelection.hasValue() ) onAdd();
-        break;
-    }
-
+    else if (rIdent == "create" && maViewSelection.hasValue())
+        onAdd();
     updateControls();
 }
 
diff --git a/sd/source/ui/animations/CustomAnimationPane.hxx 
b/sd/source/ui/animations/CustomAnimationPane.hxx
index 97164dd8bd4e..12e2cd9f9a35 100644
--- a/sd/source/ui/animations/CustomAnimationPane.hxx
+++ b/sd/source/ui/animations/CustomAnimationPane.hxx
@@ -89,7 +89,7 @@ public:
     // ICustomAnimationListController
     virtual void onSelect() override;
     virtual void onDoubleClick() override;
-    virtual void onContextMenu( sal_uInt16 nSelectedPopupEntry ) override;
+    virtual void onContextMenu(const OString& rIdent) override;
 
     // Window
     virtual void DataChanged (const DataChangedEvent& rEvent) override;
diff --git a/sd/uiconfig/simpress/ui/effectmenu.ui 
b/sd/uiconfig/simpress/ui/effectmenu.ui
new file mode 100644
index 000000000000..33f40433ccec
--- /dev/null
+++ b/sd/uiconfig/simpress/ui/effectmenu.ui
@@ -0,0 +1,61 @@
+<?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="onclick">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">Start On _Click</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="withprev">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">Start _With 
Previous</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="afterprev">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">Start _After 
Previous</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="options">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">_Effect Options...</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="timing">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">_Timing...</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="remove">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">_Remove</property>
+      </object>
+    </child>
+  </object>
+</interface>
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to