[Libreoffice-commits] core.git: svx/inc svx/source svx/uiconfig svx/UIConfig_svx.mk
Caolán McNamara
caolanm at redhat.com
Fri Apr 14 13:54:48 UTC 2017
svx/UIConfig_svx.mk | 1
svx/inc/gallery.hrc | 12 --
svx/source/gallery2/galbrws1.cxx | 173 ++++++++++++++++++---------------------
svx/source/gallery2/galbrws1.hxx | 4
svx/source/gallery2/gallery.src | 48 ----------
svx/uiconfig/ui/gallerymenu1.ui | 63 ++++++++++++++
6 files changed, 147 insertions(+), 154 deletions(-)
New commits:
commit 9df643781504e38c8a9f8f3ceda268677c1c4f02
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Apr 14 14:52:44 2017 +0100
convert other gallery menu to .ui
Change-Id: Ib67c0e1822e32349ef5bc84fdf513276ad859e98
diff --git a/svx/UIConfig_svx.mk b/svx/UIConfig_svx.mk
index ce4e14e9b62d..f68a66650128 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/gallerymenu1 \
svx/uiconfig/ui/gallerymenu2 \
svx/uiconfig/ui/headfootformatpage \
svx/uiconfig/ui/imapdialog \
diff --git a/svx/inc/gallery.hrc b/svx/inc/gallery.hrc
index 742e81391b24..dcba6fb87260 100644
--- a/svx/inc/gallery.hrc
+++ b/svx/inc/gallery.hrc
@@ -31,9 +31,6 @@
#define RID_SVXSTR_GALLERY_ICONVIEW (RID_SVX_GALLERY_START + 86)
#define RID_SVXSTR_GALLERY_LISTVIEW (RID_SVX_GALLERY_START + 87)
-// Controls for Gallery
-#define RID_SVXMN_GALLERY1 (RID_SVX_GALLERY_START + 36)
-
// Images
#define RID_SVXBMP_THEME_NORMAL (RID_SVX_GALLERY_START + 48)
#define RID_SVXBMP_THEME_READONLY (RID_SVX_GALLERY_START + 52)
@@ -51,15 +48,6 @@
#define RID_SVXBMP_GALLERY_SOUND_7 (RID_SVX_GALLERY_START + 68)
#define RID_SVXBMP_GALLERY_MEDIA (RID_SVX_GALLERY_START + 71)
-// local Defines
-#define MN_PREVIEW 10
-#define MN_DELETE 12
-
-#define MN_ACTUALIZE 21
-#define MN_RENAME 22
-#define MN_PROPERTIES 23
-#define MN_ASSIGN_ID 24
-
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/gallery2/galbrws1.cxx b/svx/source/gallery2/galbrws1.cxx
index 41b13b9402a2..e3a7afca7c4f 100644
--- a/svx/source/gallery2/galbrws1.cxx
+++ b/svx/source/gallery2/galbrws1.cxx
@@ -103,8 +103,8 @@ bool GalleryThemeListBox::PreNotify( NotifyEvent& rNEvt )
GalleryBrowser1::GalleryBrowser1(
vcl::Window* pParent,
Gallery* pGallery,
- const ::std::function<sal_Bool (const KeyEvent&,Window*)>& rKeyInputHandler,
- const ::std::function<void ()>& rThemeSlectionHandler)
+ const std::function<sal_Bool (const KeyEvent&,Window*)>& rKeyInputHandler,
+ const std::function<void ()>& rThemeSlectionHandler)
:
Control ( pParent, WB_TABSTOP ),
maNewTheme ( VclPtr<GalleryButton>::Create(this, WB_3DLOOK) ),
@@ -219,7 +219,7 @@ void GalleryBrowser1::ImplFillExchangeData( const GalleryTheme* pThm, ExchangeDa
}
}
-void GalleryBrowser1::ImplGetExecuteVector(::std::vector< sal_uInt16 >& o_aExec)
+void GalleryBrowser1::ImplGetExecuteVector(std::vector<OString>& o_aExec)
{
GalleryTheme* pTheme = mpGallery->AcquireTheme( GetSelectedTheme(), *this );
@@ -239,18 +239,18 @@ void GalleryBrowser1::ImplGetExecuteVector(::std::vector< sal_uInt16 >& o_aExec)
bUpdateAllowed = bRenameAllowed = bRemoveAllowed = true;
if( bUpdateAllowed && pTheme->GetObjectCount() )
- o_aExec.push_back( MN_ACTUALIZE );
+ o_aExec.push_back("update");
if( bRenameAllowed )
- o_aExec.push_back( MN_RENAME );
+ o_aExec.push_back("rename");
if( bRemoveAllowed )
- o_aExec.push_back( MN_DELETE );
+ o_aExec.push_back("delete");
if( bIdDialog && !pTheme->IsReadOnly() )
- o_aExec.push_back( MN_ASSIGN_ID );
+ o_aExec.push_back("assign");
- o_aExec.push_back( MN_PROPERTIES );
+ o_aExec.push_back("properties");
mpGallery->ReleaseTheme( pTheme, *this );
}
@@ -340,94 +340,82 @@ IMPL_LINK( GalleryBrowser1, DestroyThemePropertiesDlgHdl, void*, /*p*/, void )
mpThemePropsDlgItemSet = nullptr;
}
-void GalleryBrowser1::ImplExecute( sal_uInt16 nId )
+void GalleryBrowser1::ImplExecute(const OString &rIdent)
{
- switch( nId )
+ if (rIdent == "update")
{
- case MN_ACTUALIZE:
- {
- GalleryTheme* pTheme = mpGallery->AcquireTheme( GetSelectedTheme(), *this );
+ GalleryTheme* pTheme = mpGallery->AcquireTheme( GetSelectedTheme(), *this );
- SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
- if(pFact)
- {
- ScopedVclPtr<VclAbstractRefreshableDialog> aActualizeProgress(pFact->CreateActualizeProgressDialog( this, pTheme ));
- DBG_ASSERT(aActualizeProgress, "Dialog creation failed!");
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ if(pFact)
+ {
+ ScopedVclPtr<VclAbstractRefreshableDialog> aActualizeProgress(pFact->CreateActualizeProgressDialog( this, pTheme ));
+ DBG_ASSERT(aActualizeProgress, "Dialog creation failed!");
- aActualizeProgress->Update();
- aActualizeProgress->Execute();
- mpGallery->ReleaseTheme( pTheme, *this );
- }
+ aActualizeProgress->Update();
+ aActualizeProgress->Execute();
+ mpGallery->ReleaseTheme( pTheme, *this );
}
- break;
+ }
+ else if (rIdent == "delete")
+ {
+ if( ScopedVclPtrInstance<MessageDialog>(nullptr, "QueryDeleteThemeDialog","svx/ui/querydeletethemedialog.ui")->Execute() == RET_YES )
+ mpGallery->RemoveTheme( mpThemes->GetSelectEntry() );
+ }
+ else if (rIdent == "rename")
+ {
+ GalleryTheme* pTheme = mpGallery->AcquireTheme( GetSelectedTheme(), *this );
+ const OUString aOldName( pTheme->GetName() );
- case MN_DELETE:
- {
- if( ScopedVclPtrInstance<MessageDialog>(nullptr, "QueryDeleteThemeDialog","svx/ui/querydeletethemedialog.ui")->Execute() == RET_YES )
- mpGallery->RemoveTheme( mpThemes->GetSelectEntry() );
- }
- break;
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialog creation failed!");
+ ScopedVclPtr<AbstractTitleDialog> aDlg(pFact->CreateTitleDialog( this, aOldName ));
+ DBG_ASSERT(aDlg, "Dialog creation failed!");
- case MN_RENAME:
+ if( aDlg->Execute() == RET_OK )
{
- GalleryTheme* pTheme = mpGallery->AcquireTheme( GetSelectedTheme(), *this );
- const OUString aOldName( pTheme->GetName() );
+ const OUString aNewName( aDlg->GetTitle() );
- SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
- DBG_ASSERT(pFact, "Dialog creation failed!");
- ScopedVclPtr<AbstractTitleDialog> aDlg(pFact->CreateTitleDialog( this, aOldName ));
- DBG_ASSERT(aDlg, "Dialog creation failed!");
-
- if( aDlg->Execute() == RET_OK )
+ if( !aNewName.isEmpty() && ( aNewName != aOldName ) )
{
- const OUString aNewName( aDlg->GetTitle() );
+ OUString aName( aNewName );
+ sal_uInt16 nCount = 0;
- if( !aNewName.isEmpty() && ( aNewName != aOldName ) )
+ while( mpGallery->HasTheme( aName ) && ( nCount++ < 16000 ) )
{
- OUString aName( aNewName );
- sal_uInt16 nCount = 0;
-
- while( mpGallery->HasTheme( aName ) && ( nCount++ < 16000 ) )
- {
- aName = aNewName;
- aName += " ";
- aName += OUString::number( nCount );
- }
-
- mpGallery->RenameTheme( aOldName, aName );
+ aName = aNewName;
+ aName += " ";
+ aName += OUString::number( nCount );
}
+
+ mpGallery->RenameTheme( aOldName, aName );
}
- mpGallery->ReleaseTheme( pTheme, *this );
}
- break;
+ mpGallery->ReleaseTheme( pTheme, *this );
+ }
+ else if (rIdent == "assign")
+ {
+ GalleryTheme* pTheme = mpGallery->AcquireTheme( GetSelectedTheme(), *this );
- case MN_ASSIGN_ID:
+ if (pTheme && !pTheme->IsReadOnly())
{
- GalleryTheme* pTheme = mpGallery->AcquireTheme( GetSelectedTheme(), *this );
- if (pTheme && !pTheme->IsReadOnly())
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ if(pFact)
{
+ ScopedVclPtr<AbstractGalleryIdDialog> aDlg(pFact->CreateGalleryIdDialog( this, pTheme ));
+ DBG_ASSERT(aDlg, "Dialog creation failed!");
- SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
- if(pFact)
- {
- ScopedVclPtr<AbstractGalleryIdDialog> aDlg(pFact->CreateGalleryIdDialog( this, pTheme ));
- DBG_ASSERT(aDlg, "Dialog creation failed!");
-
- if( aDlg->Execute() == RET_OK )
- pTheme->SetId( aDlg->GetId(), true );
- }
+ if( aDlg->Execute() == RET_OK )
+ pTheme->SetId( aDlg->GetId(), true );
}
-
- mpGallery->ReleaseTheme( pTheme, *this );
}
- break;
- case MN_PROPERTIES:
- {
- ImplGalleryThemeProperties( GetSelectedTheme(), false );
- }
- break;
+ mpGallery->ReleaseTheme( pTheme, *this );
+ }
+ else if (rIdent == "properties")
+ {
+ ImplGalleryThemeProperties( GetSelectedTheme(), false );
}
}
@@ -513,10 +501,10 @@ bool GalleryBrowser1::KeyInput( const KeyEvent& rKEvt, vcl::Window* pWindow )
if( !bRet )
{
- ::std::vector< sal_uInt16 > aExecVector;
+ std::vector<OString> aExecVector;
ImplGetExecuteVector(aExecVector);
- sal_uInt16 nExecuteId = 0;
- bool bMod1 = rKEvt.GetKeyCode().IsMod1();
+ OString sExecuteIdent;
+ bool bMod1 = rKEvt.GetKeyCode().IsMod1();
switch( rKEvt.GetKeyCode().GetCode() )
{
@@ -534,39 +522,39 @@ bool GalleryBrowser1::KeyInput( const KeyEvent& rKEvt, vcl::Window* pWindow )
case KEY_U:
{
if( bMod1 )
- nExecuteId = MN_ACTUALIZE;
+ sExecuteIdent = "update";
}
break;
case KEY_DELETE:
- nExecuteId = MN_DELETE;
+ sExecuteIdent = "delete";
break;
case KEY_D:
{
if( bMod1 )
- nExecuteId = MN_DELETE;
+ sExecuteIdent = "delete";
}
break;
case KEY_R:
{
if( bMod1 )
- nExecuteId = MN_RENAME;
+ sExecuteIdent = "rename";
}
break;
case KEY_RETURN:
{
if( bMod1 )
- nExecuteId = MN_PROPERTIES;
+ sExecuteIdent = "proeprties";
}
break;
}
- if( nExecuteId && ( ::std::find( aExecVector.begin(), aExecVector.end(), nExecuteId ) != aExecVector.end() ) )
+ if (!sExecuteIdent.isEmpty() && (std::find( aExecVector.begin(), aExecVector.end(), sExecuteIdent) != aExecVector.end()))
{
- ImplExecute( nExecuteId );
+ ImplExecute(sExecuteIdent);
bRet = true;
}
}
@@ -576,18 +564,19 @@ bool GalleryBrowser1::KeyInput( const KeyEvent& rKEvt, vcl::Window* pWindow )
IMPL_LINK_NOARG(GalleryBrowser1, ShowContextMenuHdl, void*, void)
{
- ::std::vector< sal_uInt16 > aExecVector;
+ std::vector<OString> aExecVector;
ImplGetExecuteVector(aExecVector);
if( !aExecVector.empty() )
{
- ScopedVclPtrInstance<PopupMenu> aMenu( GAL_RES( RID_SVXMN_GALLERY1 ) );
-
- aMenu->EnableItem( MN_ACTUALIZE, ::std::find( aExecVector.begin(), aExecVector.end(), MN_ACTUALIZE ) != aExecVector.end() );
- aMenu->EnableItem( MN_RENAME, ::std::find( aExecVector.begin(), aExecVector.end(), MN_RENAME ) != aExecVector.end() );
- aMenu->EnableItem( MN_DELETE, ::std::find( aExecVector.begin(), aExecVector.end(), MN_DELETE ) != aExecVector.end() );
- aMenu->EnableItem( MN_ASSIGN_ID, ::std::find( aExecVector.begin(), aExecVector.end(), MN_ASSIGN_ID ) != aExecVector.end() );
- aMenu->EnableItem( MN_PROPERTIES, ::std::find( aExecVector.begin(), aExecVector.end(), MN_PROPERTIES ) != aExecVector.end() );
+ VclBuilder aBuilder(nullptr, VclBuilderContainer::getUIRootDir(), "svx/ui/gallerymenu1.ui", "");
+ VclPtr<PopupMenu> aMenu(aBuilder.get_menu("menu"));
+
+ aMenu->EnableItem( aMenu->GetItemId("update"), std::find( aExecVector.begin(), aExecVector.end(), "update" ) != aExecVector.end() );
+ aMenu->EnableItem( aMenu->GetItemId("rename"), std::find( aExecVector.begin(), aExecVector.end(), "rename" ) != aExecVector.end() );
+ aMenu->EnableItem( aMenu->GetItemId("delete"), std::find( aExecVector.begin(), aExecVector.end(), "delete" ) != aExecVector.end() );
+ aMenu->EnableItem( aMenu->GetItemId("assign"), std::find( aExecVector.begin(), aExecVector.end(), "assign" ) != aExecVector.end() );
+ aMenu->EnableItem( aMenu->GetItemId("properties"), std::find( aExecVector.begin(), aExecVector.end(), "properties" ) != aExecVector.end() );
aMenu->SetSelectHdl( LINK( this, GalleryBrowser1, PopupMenuHdl ) );
aMenu->RemoveDisabledEntries();
@@ -603,7 +592,7 @@ IMPL_LINK_NOARG(GalleryBrowser1, ShowContextMenuHdl, void*, void)
IMPL_LINK( GalleryBrowser1, PopupMenuHdl, Menu*, pMenu, bool )
{
- ImplExecute( pMenu->GetCurItemId() );
+ ImplExecute(pMenu->GetCurItemIdent());
return false;
}
diff --git a/svx/source/gallery2/galbrws1.hxx b/svx/source/gallery2/galbrws1.hxx
index 38f1abad83d5..3abd35c509e9 100644
--- a/svx/source/gallery2/galbrws1.hxx
+++ b/svx/source/gallery2/galbrws1.hxx
@@ -93,8 +93,8 @@ private:
void ImplAdjustControls();
sal_uIntPtr ImplInsertThemeEntry( const GalleryThemeEntry* pEntry );
static void ImplFillExchangeData( const GalleryTheme* pThm, ExchangeData& rData );
- void ImplGetExecuteVector(::std::vector< sal_uInt16 >& o_aExec);
- void ImplExecute( sal_uInt16 nId );
+ void ImplGetExecuteVector(std::vector<OString>& o_aExec);
+ void ImplExecute(const OString &rIdent);
void ImplGalleryThemeProperties( const OUString & rThemeName, bool bCreateNew );
void ImplEndGalleryThemeProperties(bool bCreateNew);
diff --git a/svx/source/gallery2/gallery.src b/svx/source/gallery2/gallery.src
index cde9bc433a6e..304477076504 100644
--- a/svx/source/gallery2/gallery.src
+++ b/svx/source/gallery2/gallery.src
@@ -111,52 +111,4 @@ Bitmap RID_SVXBMP_GALLERY_VIEW_LIST
File = "gallist.png";
};
-Menu RID_SVXMN_GALLERY1
-{
- ItemList =
- {
- MenuItem
- {
- Identifier = MN_ACTUALIZE;
- HelpId = HID_GALLERY_ACTUALIZE;
- Text [ en-US ] = "Update";
- };
- MenuItem
- {
- Separator = TRUE ;
- };
- MenuItem
- {
- Identifier = MN_DELETE ;
- HelpId = HID_GALLERY_MN_DELETE ;
- Text [ en-US ] = "~Delete" ;
- };
- MenuItem
- {
- Identifier = MN_RENAME;
- HelpId = HID_GALLERY_RENAME;
- Text [ en-US ] = "~Rename" ;
- };
- MenuItem
- {
- Separator = TRUE ;
- };
- MenuItem
- {
- Identifier = MN_ASSIGN_ID;
- Text [ en-US ] = "Assign ~ID" ;
- };
- MenuItem
- {
- Separator = TRUE ;
- };
- MenuItem
- {
- Identifier = MN_PROPERTIES;
- HelpId = HID_GALLERY_PROPERTIES;
- Text [ en-US ] = "Propert~ies..." ;
- };
- };
-};
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/uiconfig/ui/gallerymenu1.ui b/svx/uiconfig/ui/gallerymenu1.ui
new file mode 100644
index 000000000000..7ee1d56ffa51
--- /dev/null
+++ b/svx/uiconfig/ui/gallerymenu1.ui
@@ -0,0 +1,63 @@
+<?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="update">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Update</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="delete">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">_Delete</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkMenuItem" id="rename">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">_Rename</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="assign">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Assign _ID</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="properties">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Propert_ies...</property>
+ </object>
+ </child>
+ </object>
+</interface>
More information about the Libreoffice-commits
mailing list