svx/UIConfig_svx.mk              |    1 
 svx/inc/galbrws2.hxx             |    7 
 svx/inc/gallery.hrc              |    6 
 svx/inc/helpid.hrc               |    4 
 svx/source/gallery2/galbrws2.cxx |  314 +++++++++++++++------------------------
 svx/source/gallery2/gallery.src  |   65 --------
 svx/uiconfig/ui/gallerymenu2.ui  |   65 ++++++++
 7 files changed, 192 insertions(+), 270 deletions(-)

New commits:
commit c4462e7858297a81da24a4362621b0142c2cc7ed
Author: Caolán McNamara <caol...@redhat.com>
Date:   Fri Apr 14 14:38:35 2017 +0100

    GalleryBrowser2::Dispatch is always used with just MN_ADD
    
    Change-Id: I295738e3114fe033df50dcd6787f56d846fe5ce4

diff --git a/svx/inc/galbrws2.hxx b/svx/inc/galbrws2.hxx
index a68e1d329cdf..ab92f8adafc1 100644
--- a/svx/inc/galbrws2.hxx
+++ b/svx/inc/galbrws2.hxx
@@ -163,9 +163,8 @@ public:
     const css::uno::Reference< css::util::XURLTransformer >& 
GetURLTransformer() const { return m_xTransformer; }
 
     void Execute(const OString &rIdent);
-    void Dispatch( sal_uInt16 nId,
-                   const css::uno::Reference< css::frame::XDispatch > 
&rxDispatch,
-                   const css::util::URL &rURL );
+    void DispatchAdd(const css::uno::Reference<css::frame::XDispatch> 
&rxDispatch,
+                     const css::util::URL &rURL);
 
     DECL_STATIC_LINK( GalleryBrowser2, AsyncDispatch_Impl, void*, void );
 };
diff --git a/svx/inc/gallery.hrc b/svx/inc/gallery.hrc
index 1c1f0fd3b1a8..742e81391b24 100644
--- a/svx/inc/gallery.hrc
+++ b/svx/inc/gallery.hrc
@@ -52,7 +52,6 @@
 #define RID_SVXBMP_GALLERY_MEDIA                (RID_SVX_GALLERY_START + 71)
 
 // local Defines
-#define MN_ADD 6
 #define MN_PREVIEW 10
 #define MN_DELETE 12
 
diff --git a/svx/inc/helpid.hrc b/svx/inc/helpid.hrc
index 3ba81a7a2706..75e7079434ea 100644
--- a/svx/inc/helpid.hrc
+++ b/svx/inc/helpid.hrc
@@ -34,7 +34,6 @@
 #define HID_EDITENG_SPELLER_WORDLANGUAGE                      
"SVX_HID_EDITENG_SPELLER_WORDLANGUAGE"
 #define HID_GALLERY_ICONVIEW                                  
"SVX_HID_GALLERY_ICONVIEW"
 #define HID_GALLERY_LISTVIEW                                  
"SVX_HID_GALLERY_LISTVIEW"
-#define HID_GALLERY_MN_ADD                                    
"SVX_HID_GALLERY_MN_ADD"
 #define HID_GALLERY_MN_DELETE                                 
"SVX_HID_GALLERY_MN_DELETE"
 #define HID_GALLERY_MN_PREVIEW                                
"SVX_HID_GALLERY_MN_PREVIEW"
 #define HID_GALLERY_NEWTHEME                                  
"SVX_HID_GALLERY_NEWTHEME"
diff --git a/svx/source/gallery2/galbrws2.cxx b/svx/source/gallery2/galbrws2.cxx
index 1701ffcf0dd6..2cce206440f8 100644
--- a/svx/source/gallery2/galbrws2.cxx
+++ b/svx/source/gallery2/galbrws2.cxx
@@ -311,7 +311,7 @@ IMPL_LINK( GalleryThemePopup, MenuSelectHdl, Menu*, pMenu, 
bool )
     {
         const CommandInfoMap::const_iterator it = m_aCommandInfo.find( 
SID_GALLERY_FORMATS );
         if (it != m_aCommandInfo.end())
-            mpBrowser->Dispatch(MN_ADD, it->second.Dispatch, it->second.URL);
+            mpBrowser->DispatchAdd(it->second.Dispatch, it->second.URL);
     }
     else
         mpBrowser->Execute(sIdent);
@@ -655,7 +655,7 @@ bool GalleryBrowser2::KeyInput( const KeyEvent& rKEvt, 
vcl::Window* pWindow )
                 // Inserting a gallery item in the document must be dispatched
                 if( bValidURL )
                 {
-                    Dispatch( MN_ADD, 
css::uno::Reference<css::frame::XDispatch>(), css::util::URL() );
+                    DispatchAdd(css::uno::Reference<css::frame::XDispatch>(), 
css::util::URL());
                     return true;
                 }
             }
@@ -989,10 +989,9 @@ GalleryBrowser2::GetFrame()
     return xFrame;
 }
 
-void GalleryBrowser2::Dispatch(
-     sal_uInt16 nId,
+void GalleryBrowser2::DispatchAdd(
     const css::uno::Reference< css::frame::XDispatch > &rxDispatch,
-    const css::util::URL &rURL )
+    const css::util::URL &rURL)
 {
     Point aSelPos;
     const sal_uIntPtr nItemId = ImplGetSelectedItemId( nullptr, aSelPos );
@@ -1002,94 +1001,84 @@ void GalleryBrowser2::Dispatch(
 
     mnCurActionPos = nItemId - 1;
 
-    switch( nId )
-    {
-        case MN_ADD:
-        {
-            css::uno::Reference< css::frame::XDispatch > xDispatch( rxDispatch 
);
-            css::util::URL aURL = rURL;
+    css::uno::Reference< css::frame::XDispatch > xDispatch( rxDispatch );
+    css::util::URL aURL = rURL;
 
-            if ( !xDispatch.is() )
-            {
-                css::uno::Reference< css::frame::XDispatchProvider > 
xDispatchProvider(
-                    GetFrame(), css::uno::UNO_QUERY );
-                if ( !xDispatchProvider.is() || !m_xTransformer.is() )
-                    return;
-
-                aURL.Complete = CMD_SID_GALLERY_FORMATS;
-                m_xTransformer->parseStrict( aURL );
-                xDispatch = xDispatchProvider->queryDispatch(
-                    aURL,
-                    "_self",
-                    css::frame::FrameSearchFlag::SELF );
-            }
+    if ( !xDispatch.is() )
+    {
+        css::uno::Reference< css::frame::XDispatchProvider > xDispatchProvider(
+            GetFrame(), css::uno::UNO_QUERY );
+        if ( !xDispatchProvider.is() || !m_xTransformer.is() )
+            return;
+
+        aURL.Complete = CMD_SID_GALLERY_FORMATS;
+        m_xTransformer->parseStrict( aURL );
+        xDispatch = xDispatchProvider->queryDispatch(
+            aURL,
+            "_self",
+            css::frame::FrameSearchFlag::SELF );
+    }
 
-            if ( !xDispatch.is() )
-                return;
+    if ( !xDispatch.is() )
+        return;
 
-            sal_Int8 nType = 0;
-            OUString aFileURL, aFilterName;
-            css::uno::Reference< css::lang::XComponent > xDrawing;
-            css::uno::Reference< css::graphic::XGraphic > xGraphic;
+    sal_Int8 nType = 0;
+    OUString aFileURL, aFilterName;
+    css::uno::Reference< css::lang::XComponent > xDrawing;
+    css::uno::Reference< css::graphic::XGraphic > xGraphic;
 
-            aFilterName = GetFilterName();
+    aFilterName = GetFilterName();
 
-            switch( mpCurTheme->GetObjectKind( mnCurActionPos ) )
-            {
-                case SgaObjKind::Bitmap:
-                case SgaObjKind::Animation:
-                case SgaObjKind::Inet:
-                // TODO drawing objects are inserted as drawings only via 
drag&drop
-                case SgaObjKind::SvDraw:
-                    nType = css::gallery::GalleryItemType::GRAPHIC;
-                break;
-
-                case SgaObjKind::Sound :
-                    nType = css::gallery::GalleryItemType::MEDIA;
-                break;
-
-                default:
-                    nType = css::gallery::GalleryItemType::EMPTY;
-                break;
-            }
+    switch( mpCurTheme->GetObjectKind( mnCurActionPos ) )
+    {
+        case SgaObjKind::Bitmap:
+        case SgaObjKind::Animation:
+        case SgaObjKind::Inet:
+        // TODO drawing objects are inserted as drawings only via drag&drop
+        case SgaObjKind::SvDraw:
+            nType = css::gallery::GalleryItemType::GRAPHIC;
+        break;
 
-            Graphic aGraphic;
-            bool bGraphic = mpCurTheme->GetGraphic( mnCurActionPos, aGraphic );
-            if ( bGraphic && !!aGraphic )
-                xGraphic.set( aGraphic.GetXGraphic() );
-            OSL_ENSURE( xGraphic.is(), "gallery item is graphic, but the 
reference is invalid!" );
-
-            css::uno::Sequence< css::beans::PropertyValue > aSeq( 
SVXGALLERYITEM_PARAMS );
-
-            aSeq[0].Name = SVXGALLERYITEM_TYPE;
-            aSeq[0].Value <<= nType;
-            aSeq[1].Name = SVXGALLERYITEM_URL;
-            aSeq[1].Value <<= aFileURL;
-            aSeq[2].Name = SVXGALLERYITEM_FILTER;
-            aSeq[2].Value <<= aFilterName;
-            aSeq[3].Name = SVXGALLERYITEM_DRAWING;
-            aSeq[3].Value <<= xDrawing;
-            aSeq[4].Name = SVXGALLERYITEM_GRAPHIC;
-            aSeq[4].Value <<= xGraphic;
-
-            css::uno::Sequence< css::beans::PropertyValue > aArgs( 1 );
-            aArgs[0].Name = SVXGALLERYITEM_ARGNAME;
-            aArgs[0].Value <<= aSeq;
-
-            DispatchInfo *pInfo = new DispatchInfo;
-            pInfo->TargetURL = aURL;
-            pInfo->Arguments = aArgs;
-            pInfo->Dispatch = xDispatch;
-
-            if ( !Application::PostUserEvent(
-                    LINK( nullptr, GalleryBrowser2, AsyncDispatch_Impl), pInfo 
) )
-                delete pInfo;
-        }
+        case SgaObjKind::Sound :
+            nType = css::gallery::GalleryItemType::MEDIA;
         break;
 
         default:
+            nType = css::gallery::GalleryItemType::EMPTY;
         break;
     }
+
+    Graphic aGraphic;
+    bool bGraphic = mpCurTheme->GetGraphic( mnCurActionPos, aGraphic );
+    if ( bGraphic && !!aGraphic )
+        xGraphic.set( aGraphic.GetXGraphic() );
+    OSL_ENSURE( xGraphic.is(), "gallery item is graphic, but the reference is 
invalid!" );
+
+    css::uno::Sequence< css::beans::PropertyValue > aSeq( 
SVXGALLERYITEM_PARAMS );
+
+    aSeq[0].Name = SVXGALLERYITEM_TYPE;
+    aSeq[0].Value <<= nType;
+    aSeq[1].Name = SVXGALLERYITEM_URL;
+    aSeq[1].Value <<= aFileURL;
+    aSeq[2].Name = SVXGALLERYITEM_FILTER;
+    aSeq[2].Value <<= aFilterName;
+    aSeq[3].Name = SVXGALLERYITEM_DRAWING;
+    aSeq[3].Value <<= xDrawing;
+    aSeq[4].Name = SVXGALLERYITEM_GRAPHIC;
+    aSeq[4].Value <<= xGraphic;
+
+    css::uno::Sequence< css::beans::PropertyValue > aArgs( 1 );
+    aArgs[0].Name = SVXGALLERYITEM_ARGNAME;
+    aArgs[0].Value <<= aSeq;
+
+    DispatchInfo *pInfo = new DispatchInfo;
+    pInfo->TargetURL = aURL;
+    pInfo->Arguments = aArgs;
+    pInfo->Dispatch = xDispatch;
+
+    if ( !Application::PostUserEvent(
+            LINK( nullptr, GalleryBrowser2, AsyncDispatch_Impl), pInfo ) )
+        delete pInfo;
 }
 
 void GalleryBrowser2::Execute(const OString &rIdent)
commit c908096d9e0ffd9c869bb6431f15b5ac15280b35
Author: Caolán McNamara <caol...@redhat.com>
Date:   Fri Apr 14 14:33:10 2017 +0100

    convert gallery menu to .ui
    
    Change-Id: I69b7b9d06d01c205dc1906578d590c17c4eab460

diff --git a/svx/UIConfig_svx.mk b/svx/UIConfig_svx.mk
index b210e4b4a358..ce4e14e9b62d 100644
--- a/svx/UIConfig_svx.mk
+++ b/svx/UIConfig_svx.mk
@@ -43,6 +43,7 @@ $(eval $(call gb_UIConfig_add_uifiles,svx,\
        svx/uiconfig/ui/fontworkgallerydialog \
        svx/uiconfig/ui/fontworkspacingdialog \
        svx/uiconfig/ui/formlinkwarndialog \
+       svx/uiconfig/ui/gallerymenu2 \
        svx/uiconfig/ui/headfootformatpage \
        svx/uiconfig/ui/imapdialog \
        svx/uiconfig/ui/imapmenu \
diff --git a/svx/inc/galbrws2.hxx b/svx/inc/galbrws2.hxx
index 3db2b5a37203..a68e1d329cdf 100644
--- a/svx/inc/galbrws2.hxx
+++ b/svx/inc/galbrws2.hxx
@@ -162,7 +162,7 @@ public:
     static css::uno::Reference< css::frame::XFrame > GetFrame();
     const css::uno::Reference< css::util::XURLTransformer >& 
GetURLTransformer() const { return m_xTransformer; }
 
-    void Execute( sal_uInt16 nId );
+    void Execute(const OString &rIdent);
     void Dispatch( sal_uInt16 nId,
                    const css::uno::Reference< css::frame::XDispatch > 
&rxDispatch,
                    const css::util::URL &rURL );
diff --git a/svx/inc/gallery.hrc b/svx/inc/gallery.hrc
index 61b6df4bcb5f..1c1f0fd3b1a8 100644
--- a/svx/inc/gallery.hrc
+++ b/svx/inc/gallery.hrc
@@ -33,7 +33,6 @@
 
 // Controls for Gallery
 #define RID_SVXMN_GALLERY1                      (RID_SVX_GALLERY_START + 36)
-#define RID_SVXMN_GALLERY2                      (RID_SVX_GALLERY_START + 37)
 
 // Images
 #define RID_SVXBMP_THEME_NORMAL                 (RID_SVX_GALLERY_START + 48)
@@ -56,10 +55,6 @@
 #define MN_ADD 6
 #define MN_PREVIEW 10
 #define MN_DELETE 12
-#define MN_BACKGROUND 14
-#define MN_TITLE 15
-#define MN_COPYCLIPBOARD 16
-#define MN_PASTECLIPBOARD 17
 
 #define MN_ACTUALIZE 21
 #define MN_RENAME 22
diff --git a/svx/inc/helpid.hrc b/svx/inc/helpid.hrc
index 1844d102e9bb..3ba81a7a2706 100644
--- a/svx/inc/helpid.hrc
+++ b/svx/inc/helpid.hrc
@@ -35,10 +35,7 @@
 #define HID_GALLERY_ICONVIEW                                  
"SVX_HID_GALLERY_ICONVIEW"
 #define HID_GALLERY_LISTVIEW                                  
"SVX_HID_GALLERY_LISTVIEW"
 #define HID_GALLERY_MN_ADD                                    
"SVX_HID_GALLERY_MN_ADD"
-#define HID_GALLERY_MN_BACKGROUND                             
"SVX_HID_GALLERY_MN_BACKGROUND"
-#define HID_GALLERY_MN_COPYCLIPBOARD                          
"SVX_HID_GALLERY_MN_COPYCLIPBOARD"
 #define HID_GALLERY_MN_DELETE                                 
"SVX_HID_GALLERY_MN_DELETE"
-#define HID_GALLERY_MN_PASTECLIPBOARD                         
"SVX_HID_GALLERY_MN_PASTECLIPBOARD"
 #define HID_GALLERY_MN_PREVIEW                                
"SVX_HID_GALLERY_MN_PREVIEW"
 #define HID_GALLERY_NEWTHEME                                  
"SVX_HID_GALLERY_NEWTHEME"
 #define HID_GALLERY_PROPERTIES                                
"SVX_HID_GALLERY_PROPERTIES"
diff --git a/svx/source/gallery2/galbrws2.cxx b/svx/source/gallery2/galbrws2.cxx
index 2f3927b5f6cd..1701ffcf0dd6 100644
--- a/svx/source/gallery2/galbrws2.cxx
+++ b/svx/source/gallery2/galbrws2.cxx
@@ -112,7 +112,8 @@ private:
     const GalleryTheme* mpTheme;
     sal_uIntPtr         mnObjectPos;
     bool                mbPreview;
-    ScopedVclPtr<PopupMenu> mpPopupMenu;
+    VclBuilder          maBuilder;
+    VclPtr<PopupMenu> mpPopupMenu;
     VclPtr<PopupMenu> mpBackgroundPopup;
     VclPtr<GalleryBrowser2> mpBrowser;
 
@@ -145,11 +146,12 @@ GalleryThemePopup::GalleryThemePopup(
     : mpTheme( pTheme )
     , mnObjectPos( nObjectPos )
     , mbPreview( bPreview )
-    , mpPopupMenu( VclPtr<PopupMenu>::Create(GAL_RES( RID_SVXMN_GALLERY2 )) )
+    , maBuilder(nullptr, VclBuilderContainer::getUIRootDir(), 
"svx/ui/gallerymenu2.ui", "")
+    , mpPopupMenu(maBuilder.get_menu("menu"))
     , mpBackgroundPopup( VclPtr<PopupMenu>::Create() )
     , mpBrowser( pBrowser )
 {
-    mpPopupMenu->SetPopupMenu( MN_BACKGROUND, mpBackgroundPopup );
+    mpPopupMenu->SetPopupMenu(mpPopupMenu->GetItemId("background"), 
mpBackgroundPopup);
 
     // SID_GALLERY_ENABLE_ADDCOPY
     m_aCommandInfo.insert(
@@ -177,7 +179,7 @@ void SAL_CALL GalleryThemePopup::statusChanged(
     {
         if ( !rEvent.IsEnabled )
         {
-            mpPopupMenu->EnableItem( MN_ADD, false );
+            mpPopupMenu->EnableItem(mpPopupMenu->GetItemId("add"), false);
         }
     }
     else if ( rURL == CMD_SID_GALLERY_BG_BRUSH )
@@ -236,34 +238,22 @@ void GalleryThemePopup::ExecutePopup( vcl::Window 
*pWindow, const ::Point &aPos
     const_cast< GalleryTheme* >( mpTheme )->GetURL( mnObjectPos, aURL );
     const bool bValidURL = ( aURL.GetProtocol() != INetProtocol::NotValid );
 
-    mpPopupMenu->EnableItem( MN_ADD, bValidURL && SgaObjKind::Sound != 
eObjKind );
+    mpPopupMenu->EnableItem(mpPopupMenu->GetItemId("add"), bValidURL && 
SgaObjKind::Sound != eObjKind);
 
-    mpPopupMenu->EnableItem( MN_PREVIEW, bValidURL );
-
-    mpPopupMenu->CheckItem( MN_PREVIEW, mbPreview );
+    mpPopupMenu->EnableItem(mpPopupMenu->GetItemId("preview"), bValidURL);
+    mpPopupMenu->CheckItem(mpPopupMenu->GetItemId("preview"), mbPreview);
 
     if( mpTheme->IsReadOnly() || !mpTheme->GetObjectCount() )
     {
-        mpPopupMenu->EnableItem( MN_DELETE, false );
-        mpPopupMenu->EnableItem( MN_TITLE, false );
-
-        if( mpTheme->IsReadOnly() )
-            mpPopupMenu->EnableItem( MN_PASTECLIPBOARD, false );
-
-        if( !mpTheme->GetObjectCount() )
-            mpPopupMenu->EnableItem( MN_COPYCLIPBOARD, false );
+        mpPopupMenu->EnableItem(mpPopupMenu->GetItemId("delete"), false);
+        mpPopupMenu->EnableItem(mpPopupMenu->GetItemId("title"), false);
     }
     else
     {
-        mpPopupMenu->EnableItem( MN_DELETE, !mbPreview );
-        mpPopupMenu->EnableItem( MN_TITLE );
-        mpPopupMenu->EnableItem( MN_COPYCLIPBOARD );
-        mpPopupMenu->EnableItem( MN_PASTECLIPBOARD );
+        mpPopupMenu->EnableItem(mpPopupMenu->GetItemId("delete"), !mbPreview);
+        mpPopupMenu->EnableItem(mpPopupMenu->GetItemId("title"));
     }
 
-    mpPopupMenu->EnableItem( MN_COPYCLIPBOARD, false );
-    mpPopupMenu->EnableItem( MN_PASTECLIPBOARD, false );
-
     // update status
     css::uno::Reference< css::frame::XDispatchProvider> xDispatchProvider(
         GalleryBrowser2::GetFrame(), css::uno::UNO_QUERY );
@@ -298,10 +288,10 @@ void GalleryThemePopup::ExecutePopup( vcl::Window 
*pWindow, const ::Point &aPos
     }
 
     if( !mpBackgroundPopup->GetItemCount() || ( eObjKind == SgaObjKind::SvDraw 
) || ( eObjKind == SgaObjKind::Sound ) )
-        mpPopupMenu->EnableItem( MN_BACKGROUND, false );
+        mpPopupMenu->EnableItem(mpPopupMenu->GetItemId("background"), false);
     else
     {
-        mpPopupMenu->EnableItem( MN_BACKGROUND );
+        mpPopupMenu->EnableItem(mpPopupMenu->GetItemId("background"));
         mpBackgroundPopup->SetSelectHdl( LINK( this, GalleryThemePopup, 
BackgroundMenuSelectHdl ) );
     }
 
@@ -316,22 +306,15 @@ IMPL_LINK( GalleryThemePopup, MenuSelectHdl, Menu*, 
pMenu, bool )
     if( !pMenu )
         return false;
 
-    sal_uInt16 nId( pMenu->GetCurItemId() );
-    switch ( nId )
+    OString sIdent(pMenu->GetCurItemIdent());
+    if (sIdent == "add")
     {
-        case MN_ADD:
-        {
-            const CommandInfoMap::const_iterator it = m_aCommandInfo.find( 
SID_GALLERY_FORMATS );
-            if ( it != m_aCommandInfo.end() )
-                mpBrowser->Dispatch( nId,
-                                     it->second.Dispatch,
-                                     it->second.URL );
-        }
-        break;
-
-        default:
-            mpBrowser->Execute( nId );
+        const CommandInfoMap::const_iterator it = m_aCommandInfo.find( 
SID_GALLERY_FORMATS );
+        if (it != m_aCommandInfo.end())
+            mpBrowser->Dispatch(MN_ADD, it->second.Dispatch, it->second.URL);
     }
+    else
+        mpBrowser->Execute(sIdent);
 
     return false;
 }
@@ -636,7 +619,7 @@ bool GalleryBrowser2::KeyInput( const KeyEvent& rKEvt, 
vcl::Window* pWindow )
 
     if( !bRet && !maViewBox->HasFocus() && nItemId && mpCurTheme )
     {
-        sal_uInt16          nExecuteId = 0;
+        OString sExecuteIdent;
         INetURLObject       aURL;
 
         mpCurTheme->GetURL( nItemId - 1, aURL );
@@ -682,14 +665,14 @@ bool GalleryBrowser2::KeyInput( const KeyEvent& rKEvt, 
vcl::Window* pWindow )
             case KEY_D:
             {
                 if( bDelete )
-                    nExecuteId = MN_DELETE;
+                    sExecuteIdent = "delete";
             }
             break;
 
             case KEY_T:
             {
                 if( bTitle )
-                    nExecuteId = MN_TITLE;
+                    sExecuteIdent = "title";
             }
             break;
 
@@ -697,9 +680,9 @@ bool GalleryBrowser2::KeyInput( const KeyEvent& rKEvt, 
vcl::Window* pWindow )
             break;
         }
 
-        if( nExecuteId )
+        if (!sExecuteIdent.isEmpty())
         {
-            Execute( nExecuteId );
+            Execute(sExecuteIdent);
             bRet = true;
         }
     }
@@ -1109,7 +1092,7 @@ void GalleryBrowser2::Dispatch(
     }
 }
 
-void GalleryBrowser2::Execute( sal_uInt16 nId )
+void GalleryBrowser2::Execute(const OString &rIdent)
 {
     Point       aSelPos;
     const sal_uIntPtr nItemId = ImplGetSelectedItemId( nullptr, aSelPos );
@@ -1118,86 +1101,46 @@ void GalleryBrowser2::Execute( sal_uInt16 nId )
     {
         mnCurActionPos = nItemId - 1;
 
-        switch( nId )
+        if (rIdent == "preview")
+            SetMode( ( GALLERYBROWSERMODE_PREVIEW != GetMode() ) ? 
GALLERYBROWSERMODE_PREVIEW : meLastMode );
+        else if (rIdent == "delete")
         {
-            case MN_PREVIEW:
-                SetMode( ( GALLERYBROWSERMODE_PREVIEW != GetMode() ) ? 
GALLERYBROWSERMODE_PREVIEW : meLastMode );
-            break;
-
-            case MN_DELETE:
+            if( !mpCurTheme->IsReadOnly() &&
+                ScopedVclPtrInstance<MessageDialog>(nullptr, 
"QueryDeleteObjectDialog","svx/ui/querydeleteobjectdialog.ui")->Execute() == 
RET_YES )
             {
-                if( !mpCurTheme->IsReadOnly() &&
-                    ScopedVclPtrInstance<MessageDialog>(nullptr, 
"QueryDeleteObjectDialog","svx/ui/querydeleteobjectdialog.ui")->Execute() == 
RET_YES )
-                {
-                    mpCurTheme->RemoveObject( mnCurActionPos );
-                }
+                mpCurTheme->RemoveObject( mnCurActionPos );
             }
-            break;
+        }
+        else if (rIdent == "title")
+        {
+            SgaObject* pObj = mpCurTheme->AcquireObject( mnCurActionPos );
 
-            case MN_TITLE:
+            if( pObj )
             {
-                SgaObject* pObj = mpCurTheme->AcquireObject( mnCurActionPos );
+                const OUString  aOldTitle( GetItemText( *mpCurTheme, *pObj, 
GalleryItemFlags::Title ) );
 
-                if( pObj )
+                SvxAbstractDialogFactory* pFact = 
SvxAbstractDialogFactory::Create();
+                if(pFact)
                 {
-                    const OUString  aOldTitle( GetItemText( *mpCurTheme, 
*pObj, GalleryItemFlags::Title ) );
-
-                    SvxAbstractDialogFactory* pFact = 
SvxAbstractDialogFactory::Create();
-                    if(pFact)
+                    ScopedVclPtr<AbstractTitleDialog> 
aDlg(pFact->CreateTitleDialog( this, aOldTitle ));
+                    DBG_ASSERT(aDlg, "Dialog creation failed!");
+                    if( aDlg->Execute() == RET_OK )
                     {
-                        ScopedVclPtr<AbstractTitleDialog> 
aDlg(pFact->CreateTitleDialog( this, aOldTitle ));
-                        DBG_ASSERT(aDlg, "Dialog creation failed!");
-                        if( aDlg->Execute() == RET_OK )
-                        {
-                            OUString aNewTitle( aDlg->GetTitle() );
+                        OUString aNewTitle( aDlg->GetTitle() );
 
-                            if( ( aNewTitle.isEmpty() && 
!pObj->GetTitle().isEmpty() ) || ( aNewTitle != aOldTitle ) )
-                            {
-                                if( aNewTitle.isEmpty() )
-                                    aNewTitle = "__<empty>__";
+                        if( ( aNewTitle.isEmpty() && 
!pObj->GetTitle().isEmpty() ) || ( aNewTitle != aOldTitle ) )
+                        {
+                            if( aNewTitle.isEmpty() )
+                                aNewTitle = "__<empty>__";
 
-                                pObj->SetTitle( aNewTitle );
-                                mpCurTheme->InsertObject( *pObj );
-                            }
+                            pObj->SetTitle( aNewTitle );
+                            mpCurTheme->InsertObject( *pObj );
                         }
-
-                        GalleryTheme::ReleaseObject( pObj );
                     }
-                }
-            }
-            break;
-
-            case MN_COPYCLIPBOARD:
-            {
-                vcl::Window* pWindow;
-
-                switch( GetMode() )
-                {
-                    case GALLERYBROWSERMODE_ICON: pWindow = 
static_cast<vcl::Window*>(mpIconView); break;
-                    case GALLERYBROWSERMODE_LIST: pWindow = 
static_cast<vcl::Window*>(mpListView); break;
-                    case GALLERYBROWSERMODE_PREVIEW: pWindow = 
static_cast<vcl::Window*>(mpPreview); break;
-
-                    default:
-                        pWindow = nullptr;
-                    break;
-                }
 
-                mpCurTheme->CopyToClipboard( pWindow, mnCurActionPos );
-            }
-            break;
-
-            case MN_PASTECLIPBOARD:
-            {
-                if( !mpCurTheme->IsReadOnly() )
-                {
-                    TransferableDataHelper aDataHelper( 
TransferableDataHelper::CreateFromSystemClipboard( this ) );
-                    mpCurTheme->InsertTransferable( 
aDataHelper.GetTransferable(), mnCurActionPos );
+                    GalleryTheme::ReleaseObject( pObj );
                 }
             }
-            break;
-
-            default:
-            break;
         }
     }
 }
diff --git a/svx/source/gallery2/gallery.src b/svx/source/gallery2/gallery.src
index cf9bb15bf136..cde9bc433a6e 100644
--- a/svx/source/gallery2/gallery.src
+++ b/svx/source/gallery2/gallery.src
@@ -159,69 +159,4 @@ Menu RID_SVXMN_GALLERY1
     };
 };
 
-Menu RID_SVXMN_GALLERY2
-{
-    ItemList =
-    {
-        MenuItem
-        {
-            Identifier = MN_ADD ;
-            HelpId = HID_GALLERY_MN_ADD ;
-            Text [ en-US ] = "~Insert" ;
-        };
-        MenuItem
-        {
-            Identifier = MN_BACKGROUND ;
-            HelpId = HID_GALLERY_MN_BACKGROUND ;
-            Text [ en-US ] = "Insert as Bac~kground" ;
-        };
-        MenuItem
-        {
-            Separator = TRUE ;
-        };
-        MenuItem
-        {
-            Identifier = MN_PREVIEW ;
-            HelpId = HID_GALLERY_MN_PREVIEW ;
-            Text [ en-US ] = "~Preview" ;
-        };
-        MenuItem
-        {
-            Separator = TRUE ;
-        };
-        MenuItem
-        {
-            Identifier = MN_TITLE ;
-            HelpId = HID_GALLERY_TITLE;
-            Text [ en-US ] = "~Title" ;
-        };
-        MenuItem
-        {
-            Separator = TRUE ;
-        };
-        MenuItem
-        {
-            Identifier = MN_DELETE ;
-            HelpId = HID_GALLERY_MN_DELETE ;
-            Text [ en-US ] = "~Delete" ;
-        };
-        MenuItem
-        {
-            Separator = TRUE ;
-        };
-        MenuItem
-        {
-            Identifier = MN_COPYCLIPBOARD;
-            HelpId = HID_GALLERY_MN_COPYCLIPBOARD;
-            Text [ en-US ] = "~Copy" ;
-        };
-        MenuItem
-        {
-            Identifier = MN_PASTECLIPBOARD;
-            HelpId = HID_GALLERY_MN_PASTECLIPBOARD;
-            Text [ en-US ] = "~Insert" ;
-        };
-    };
-};
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/uiconfig/ui/gallerymenu2.ui b/svx/uiconfig/ui/gallerymenu2.ui
new file mode 100644
index 000000000000..3fda767be80b
--- /dev/null
+++ b/svx/uiconfig/ui/gallerymenu2.ui
@@ -0,0 +1,65 @@
+<?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="add">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">_Insert</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="background">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">Insert as 
Bac_kground</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="GtkCheckMenuItem" id="preview">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">_Preview</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkSeparatorMenuItem" id="menuitem2">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="title">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">_Title</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkSeparatorMenuItem" id="menuitem3">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="delete">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">_Delete</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