svx/AllLangResTarget_svx.mk | 1 svx/UIConfig_svx.mk | 1 svx/source/dialog/imapdlg.hrc | 15 ----- svx/source/dialog/imapdlg.src | 96 ------------------------------------- svx/source/dialog/imapwnd.cxx | 104 ++++++++++++++-------------------------- svx/uiconfig/ui/imapmenu.ui | 107 ++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 145 insertions(+), 179 deletions(-)
New commits: commit 11c59d1895064cdaaaaa25abfbaf04493807fed8 Author: Caolán McNamara <caol...@redhat.com> Date: Fri Apr 14 12:59:11 2017 +0100 convert image map menu to .ui Change-Id: Ie6c2f49dbc1e4a436bf61906c1361cc593ad37f5 diff --git a/svx/AllLangResTarget_svx.mk b/svx/AllLangResTarget_svx.mk index 3696d0acef21..10a2d6557685 100644 --- a/svx/AllLangResTarget_svx.mk +++ b/svx/AllLangResTarget_svx.mk @@ -42,7 +42,6 @@ $(eval $(call gb_SrsTarget_add_files,svx/res,\ svx/source/dialog/dlgctrl.src \ svx/source/dialog/docrecovery.src \ svx/source/dialog/frmsel.src \ - svx/source/dialog/imapdlg.src \ svx/source/dialog/language.src \ svx/source/dialog/page.src \ svx/source/dialog/numberingtype.src \ diff --git a/svx/UIConfig_svx.mk b/svx/UIConfig_svx.mk index 633b8d6e986a..b210e4b4a358 100644 --- a/svx/UIConfig_svx.mk +++ b/svx/UIConfig_svx.mk @@ -45,6 +45,7 @@ $(eval $(call gb_UIConfig_add_uifiles,svx,\ svx/uiconfig/ui/formlinkwarndialog \ svx/uiconfig/ui/headfootformatpage \ svx/uiconfig/ui/imapdialog \ + svx/uiconfig/ui/imapmenu \ svx/uiconfig/ui/linkwarndialog \ svx/uiconfig/ui/mediaplayback \ svx/uiconfig/ui/namespacedialog \ diff --git a/svx/source/dialog/imapdlg.hrc b/svx/source/dialog/imapdlg.hrc index 715cc05e84c6..598ba711c545 100644 --- a/svx/source/dialog/imapdlg.hrc +++ b/svx/source/dialog/imapdlg.hrc @@ -45,19 +45,4 @@ #define TBI_UNDO 40 #define TBI_REDO 41 -/******************************************************************************/ - -#define RID_SVXMN_IMAP (RID_SVX_IMAPDLG_START + 1) - -#define MN_URL 1 -#define MN_POSITION 2 -#define MN_FRAME_TO_TOP 3 -#define MN_MOREFRONT 4 -#define MN_MOREBACK 5 -#define MN_FRAME_TO_BOTTOM 6 -#define MN_MARK_ALL 7 -#define MN_DELETE1 8 -#define MN_ACTIVATE 9 -#define MN_MACRO 10 - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/dialog/imapdlg.src b/svx/source/dialog/imapdlg.src deleted file mode 100644 index 7687a8f98f36..000000000000 --- a/svx/source/dialog/imapdlg.src +++ /dev/null @@ -1,96 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include "helpid.hrc" -#include "imapdlg.hrc" - -Menu RID_SVXMN_IMAP -{ - ItemList = - { - MenuItem - { - Identifier = MN_URL ; - Text [ en-US ] = "Description..." ; - }; - MenuItem - { - Identifier = MN_MACRO ; - Text [ en-US ] = "~Macro..." ; - }; - MenuItem - { - Identifier = MN_ACTIVATE ; - Text [ en-US ] = "Active" ; - }; - MenuItem - { - Separator = TRUE ; - }; - MenuItem - { - Identifier = MN_POSITION ; - Text [ en-US ] = "Arrange" ; - SubMenu = Menu - { - ItemList = - { - MenuItem - { - Identifier = MN_FRAME_TO_TOP ; - Text [ en-US ] = "Bring to Front" ; - }; - MenuItem - { - Identifier = MN_MOREFRONT ; - Text [ en-US ] = "Bring ~Forward" ; - }; - MenuItem - { - Identifier = MN_MOREBACK ; - Text [ en-US ] = "Send Back~ward" ; - }; - MenuItem - { - Identifier = MN_FRAME_TO_BOTTOM ; - Text [ en-US ] = "~Send to Back" ; - }; - }; - }; - }; - MenuItem - { - Separator = TRUE ; - }; - MenuItem - { - Identifier = MN_MARK_ALL ; - Text [ en-US ] = "Select ~All" ; - }; - MenuItem - { - Identifier = MN_DELETE1 ; - Text [ en-US ] = "~Delete" ; - }; - }; -}; - -/******************************************************************************/ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/dialog/imapwnd.cxx b/svx/source/dialog/imapwnd.cxx index 9b4cc00dcd6f..503e2bc5f902 100644 --- a/svx/source/dialog/imapwnd.cxx +++ b/svx/source/dialog/imapwnd.cxx @@ -471,23 +471,20 @@ void IMapWindow::Command(const CommandEvent& rCEvt) if ( rCEvt.GetCommand() == CommandEventId::ContextMenu ) { - ScopedVclPtrInstance<PopupMenu> aMenu( SVX_RES( RID_SVXMN_IMAP ) ); + VclBuilder aBuilder(nullptr, VclBuilderContainer::getUIRootDir(), "svx/ui/imapmenu.ui", ""); + VclPtr<PopupMenu> aMenu(aBuilder.get_menu("menu")); const SdrMarkList& rMarkList = pView->GetMarkedObjectList(); const size_t nMarked = rMarkList.GetMarkCount(); - aMenu->EnableItem( MN_URL, false ); - aMenu->EnableItem( MN_ACTIVATE, false ); - aMenu->EnableItem( MN_MACRO, false ); - aMenu->EnableItem( MN_MARK_ALL, pModel->GetPage( 0 )->GetObjCount() != pView->GetMarkedObjectCount() ); + aMenu->EnableItem(aMenu->GetItemId("url"), false); + aMenu->EnableItem(aMenu->GetItemId("active"), false); + aMenu->EnableItem(aMenu->GetItemId("macro"), false); + aMenu->EnableItem(aMenu->GetItemId("selectall"), pModel->GetPage(0)->GetObjCount() != pView->GetMarkedObjectCount()); if ( !nMarked ) { - aMenu->EnableItem( MN_POSITION, false ); - aMenu->EnableItem( MN_FRAME_TO_TOP, false ); - aMenu->EnableItem( MN_MOREFRONT, false ); - aMenu->EnableItem( MN_MOREBACK, false ); - aMenu->EnableItem( MN_FRAME_TO_BOTTOM, false ); - aMenu->EnableItem( MN_DELETE1, false ); + aMenu->EnableItem(aMenu->GetItemId("arrange"), false); + aMenu->EnableItem(aMenu->GetItemId("delete"), false); } else { @@ -495,18 +492,14 @@ void IMapWindow::Command(const CommandEvent& rCEvt) { SdrObject* pSdrObj = GetSelectedSdrObject(); - aMenu->EnableItem( MN_URL ); - aMenu->EnableItem( MN_ACTIVATE ); - aMenu->EnableItem( MN_MACRO ); - aMenu->CheckItem( MN_ACTIVATE, GetIMapObj( pSdrObj )->IsActive() ); + aMenu->EnableItem(aMenu->GetItemId("url")); + aMenu->EnableItem(aMenu->GetItemId("active")); + aMenu->EnableItem(aMenu->GetItemId("macro")); + aMenu->CheckItem(aMenu->GetItemId("active"), GetIMapObj(pSdrObj)->IsActive()); } - aMenu->EnableItem( MN_POSITION ); - aMenu->EnableItem( MN_FRAME_TO_TOP ); - aMenu->EnableItem( MN_MOREFRONT ); - aMenu->EnableItem( MN_MOREBACK ); - aMenu->EnableItem( MN_FRAME_TO_BOTTOM ); - aMenu->EnableItem( MN_DELETE1 ); + aMenu->EnableItem(aMenu->GetItemId("arrange")); + aMenu->EnableItem(aMenu->GetItemId("delete")); } aMenu->SetSelectHdl( LINK( this, IMapWindow, MenuSelectHdl ) ); @@ -709,55 +702,32 @@ IMPL_LINK( IMapWindow, MenuSelectHdl, Menu*, pMenu, bool ) if (!pMenu) return false; - sal_uInt16 nId = pMenu->GetCurItemId(); + OString sId = pMenu->GetCurItemIdent(); - switch(nId) + if (sId == "url") + DoPropertyDialog(); + else if (sId == "macro") + DoMacroAssign(); + else if (sId == "active") { - case MN_URL: - DoPropertyDialog(); - break; - - case MN_MACRO: - DoMacroAssign(); - break; - - case MN_ACTIVATE: - { - const bool bNewState = !pMenu->IsItemChecked( MN_ACTIVATE ); - - pMenu->CheckItem( MN_ACTIVATE, bNewState ); - SetCurrentObjState( bNewState ); - UpdateInfo( false ); - } - break; - - case MN_FRAME_TO_TOP: - pView->PutMarkedToTop(); - break; - - case MN_MOREFRONT: - pView->MovMarkedToTop(); - break; - - case MN_MOREBACK: - pView->MovMarkedToBtm(); - break; - - case MN_FRAME_TO_BOTTOM: - pView->PutMarkedToBtm(); - break; - - case MN_MARK_ALL: - pView->MarkAll(); - break; - - case MN_DELETE1: - pView->DeleteMarked(); - break; - - default : - break; + const sal_uInt16 nActiveId = pMenu->GetItemId(sId); + const bool bNewState = !pMenu->IsItemChecked(nActiveId); + pMenu->CheckItem(nActiveId, bNewState); + SetCurrentObjState(bNewState); + UpdateInfo( false ); } + else if (sId == "front") + pView->PutMarkedToTop(); + else if (sId == "forward") + pView->MovMarkedToTop(); + else if (sId == "backward") + pView->MovMarkedToBtm(); + else if (sId == "back") + pView->PutMarkedToBtm(); + else if (sId == "selectall") + pView->MarkAll(); + else if (sId == "delete") + pView->DeleteMarked(); return false; } diff --git a/svx/uiconfig/ui/imapmenu.ui b/svx/uiconfig/ui/imapmenu.ui new file mode 100644 index 000000000000..3f588d734ded --- /dev/null +++ b/svx/uiconfig/ui/imapmenu.ui @@ -0,0 +1,107 @@ +<?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="url"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Description...</property> + <property name="use_underline">True</property> + </object> + </child> + <child> + <object class="GtkMenuItem" id="macro"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">_Macro...</property> + <property name="use_underline">True</property> + </object> + </child> + <child> + <object class="GtkCheckMenuItem" id="active"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Active</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="arrange"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">_Arrange</property> + <property name="use_underline">True</property> + <child type="submenu"> + <object class="GtkMenu"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <child> + <object class="GtkMenuItem" id="front"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Bring to Front</property> + <property name="use_underline">True</property> + </object> + </child> + <child> + <object class="GtkMenuItem" id="forward"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Bring _Forward</property> + <property name="use_underline">True</property> + </object> + </child> + <child> + <object class="GtkMenuItem" id="backward"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Send Back_ward</property> + <property name="use_underline">True</property> + </object> + </child> + <child> + <object class="GtkMenuItem" id="back"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">_Send to Back</property> + <property name="use_underline">True</property> + </object> + </child> + </object> + </child> + </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="selectall"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Select _All</property> + <property name="use_underline">True</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> + <property name="use_underline">True</property> + </object> + </child> + </object> +</interface>
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits