diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-04-10 10:10:34 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-04-10 10:38:28 +0100 |
commit | 73295fa4e0df4637f1ddcca30311481efc1009e3 (patch) | |
tree | 9f6930bb09d2636bba4a7b3842a90ef2a9498773 | |
parent | 9781272a4057b795a7dca013f335020ac4985fee (diff) |
convert RID_POPUP_DROPMODE menu to .ui
Change-Id: I004bb61ab6d0cb2dfacc9290236c32a2adf7ff82
-rw-r--r-- | sc/UIConfig_scalc.mk | 1 | ||||
-rw-r--r-- | sc/inc/helpids.h | 5 | ||||
-rw-r--r-- | sc/inc/scres.hrc | 6 | ||||
-rw-r--r-- | sc/source/ui/navipi/content.cxx | 52 | ||||
-rw-r--r-- | sc/source/ui/navipi/navipi.cxx | 32 | ||||
-rw-r--r-- | sc/source/ui/navipi/navipi.src | 29 | ||||
-rw-r--r-- | sc/uiconfig/scalc/ui/dropmenu.ui | 33 |
7 files changed, 93 insertions, 65 deletions
diff --git a/sc/UIConfig_scalc.mk b/sc/UIConfig_scalc.mk index a5e1d6de324e..4237274aaa67 100644 --- a/sc/UIConfig_scalc.mk +++ b/sc/UIConfig_scalc.mk @@ -121,6 +121,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/scalc,\ sc/uiconfig/scalc/ui/deletecells \ sc/uiconfig/scalc/ui/deletecontents \ sc/uiconfig/scalc/ui/descriptivestatisticsdialog \ + sc/uiconfig/scalc/ui/dropmenu \ sc/uiconfig/scalc/ui/doubledialog \ sc/uiconfig/scalc/ui/erroralerttabpage \ sc/uiconfig/scalc/ui/externaldata \ diff --git a/sc/inc/helpids.h b/sc/inc/helpids.h index af47f5b2890a..39df049390db 100644 --- a/sc/inc/helpids.h +++ b/sc/inc/helpids.h @@ -46,11 +46,6 @@ #define HID_SC_ADD_AUTOFMT "SC_HID_SC_ADD_AUTOFMT" #define HID_SC_AUTOFMT_NAME "SC_HID_SC_AUTOFMT_NAME" -#define HID_SC_DROPMODE_URL "SC_HID_SC_DROPMODE_URL" -#define HID_SC_DROPMODE_LINK "SC_HID_SC_DROPMODE_LINK" -#define HID_SC_DROPMODE_COPY "SC_HID_SC_DROPMODE_COPY" - - #define HID_SC_SCENARIO_DELETE "SC_HID_SC_SCENARIO_DELETE" #define HID_SC_SCENARIO_EDIT "SC_HID_SC_SCENARIO_EDIT" diff --git a/sc/inc/scres.hrc b/sc/inc/scres.hrc index 2aaa38f13860..499a19de6fb5 100644 --- a/sc/inc/scres.hrc +++ b/sc/inc/scres.hrc @@ -441,12 +441,6 @@ #define RID_SCDLG_HFEDIT_HEADER (SC_DIALOGS_START + 68) #define RID_SCDLG_HFEDIT_FOOTER (SC_DIALOGS_START + 69) -// popup for drop-mode in navigator -#define RID_POPUP_DROPMODE (SC_DIALOGS_START + 92) -#define RID_DROPMODE_URL (SC_DIALOGS_START + 93) -#define RID_DROPMODE_LINK (SC_DIALOGS_START + 94) -#define RID_DROPMODE_COPY (SC_DIALOGS_START + 95) - #define RID_POPUP_NAVIPI_SCENARIO (SC_DIALOGS_START + 120) #define RID_NAVIPI_SCENARIO_DELETE (SC_DIALOGS_START + 121) #define RID_NAVIPI_SCENARIO_EDIT (SC_DIALOGS_START + 122) diff --git a/sc/source/ui/navipi/content.cxx b/sc/source/ui/navipi/content.cxx index dbf7fb8b7986..598b22fe857a 100644 --- a/sc/source/ui/navipi/content.cxx +++ b/sc/source/ui/navipi/content.cxx @@ -579,14 +579,28 @@ void ScContentTree::Command( const CommandEvent& rCEvt ) // Drag-Drop Modus ScopedVclPtrInstance<PopupMenu> aPop; - VclPtrInstance<ScPopupMenu> aDropMenu( ScResId( RID_POPUP_DROPMODE ) ); - aDropMenu->CheckItem( RID_DROPMODE_URL + pParentWindow->GetDropMode() ); + VclBuilder aBuilder(nullptr, VclBuilderContainer::getUIRootDir(), "modules/scalc/ui/dropmenu.ui", ""); + VclPtr<PopupMenu> aDropMenu(aBuilder.get_menu("menu")); + + switch (pParentWindow->GetDropMode()) + { + case 0: + aDropMenu->CheckItem(aDropMenu->GetItemId("hyperlink")); + break; + case 1: + aDropMenu->CheckItem(aDropMenu->GetItemId("link")); + break; + case 2: + aDropMenu->CheckItem(aDropMenu->GetItemId("copy")); + break; + } + aPop->InsertItem( 1, pParentWindow->GetStrDragMode() ); aPop->SetPopupMenu( 1, aDropMenu.get() ); // displayed document - VclPtrInstance<ScPopupMenu> aDocMenu; + VclPtrInstance<PopupMenu> aDocMenu; aDocMenu->SetMenuFlags( aDocMenu->GetMenuFlags() | MenuFlags::NoAutoMnemonics ); sal_uInt16 i=0; sal_uInt16 nPos=0; @@ -603,14 +617,16 @@ void ScContentTree::Command( const CommandEvent& rCEvt ) aEntry += pParentWindow->aStrActive; else aEntry += pParentWindow->aStrNotActive; - aDocMenu->InsertItem( ++i, aEntry ); + ++i; + aDocMenu->InsertItem(i, aEntry, MenuItemBits::TEXT, OString("document") + OString::number(i)); if ( !bHiddenDoc && aName == aManualDoc ) nPos = i; } pSh = SfxObjectShell::GetNext( *pSh ); } // "active window" - aDocMenu->InsertItem( ++i, pParentWindow->aStrActiveWin ); + ++i; + aDocMenu->InsertItem(i, pParentWindow->aStrActiveWin, MenuItemBits::TEXT, OString("document") + OString::number(i)); if (!bHiddenDoc && aManualDoc.isEmpty()) nPos = i; // hidden document @@ -618,7 +634,8 @@ void ScContentTree::Command( const CommandEvent& rCEvt ) { OUString aEntry = aHiddenTitle; aEntry += pParentWindow->aStrHidden; - aDocMenu->InsertItem( ++i, aEntry ); + ++i; + aDocMenu->InsertItem(i, aEntry, MenuItemBits::TEXT, OString("document") + OString::number(i)); if (bHiddenDoc) nPos = i; } @@ -626,21 +643,20 @@ void ScContentTree::Command( const CommandEvent& rCEvt ) aPop->InsertItem( 2, pParentWindow->GetStrDisplay() ); aPop->SetPopupMenu( 2, aDocMenu.get() ); + sal_uInt16 nSelected = aPop->Execute(this, rCEvt.GetMousePosPixel()); + OString sIdent = aPop->GetItemIdent(nSelected); - aPop->Execute( this, rCEvt.GetMousePosPixel() ); - - if ( aDropMenu->WasHit() ) // Drag-Drop Modus - { - sal_uInt16 nId = aDropMenu->GetSelected(); - if ( nId >= RID_DROPMODE_URL && nId <= RID_DROPMODE_COPY ) - pParentWindow->SetDropMode( nId - RID_DROPMODE_URL ); - } - else if ( aDocMenu->WasHit() ) // displayed document + if (sIdent.startsWith("document")) { - sal_uInt16 nId = aDocMenu->GetSelected(); - OUString aName = aDocMenu->GetItemText(nId); - SelectDoc( aName ); + OUString aName = aDocMenu->GetItemText(aDocMenu->GetItemId(sIdent)); + SelectDoc(aName); } + else if (sIdent == "hyperlink") + pParentWindow->SetDropMode(0); + else if (sIdent == "link") + pParentWindow->SetDropMode(1); + else if (sIdent == "copy") + pParentWindow->SetDropMode(2); } break; default: break; diff --git a/sc/source/ui/navipi/navipi.cxx b/sc/source/ui/navipi/navipi.cxx index b8c28fa84891..9004459997b1 100644 --- a/sc/source/ui/navipi/navipi.cxx +++ b/sc/source/ui/navipi/navipi.cxx @@ -361,15 +361,33 @@ IMPL_LINK(ScNavigatorDlg, ToolBoxDropdownClickHdl, ToolBox *, pToolBox, void) // click (button down) and not in the select (button up) if (pToolBox->GetCurItemId() == nDragModeId) { - ScopedVclPtrInstance<ScPopupMenu> aPop(ScResId(RID_POPUP_DROPMODE)); - aPop->CheckItem(RID_DROPMODE_URL + GetDropMode()); - aPop->Execute(pToolBox, pToolBox->GetItemRect(nDragModeId), PopupMenuFlags::ExecuteDown); - sal_uInt16 nId = aPop->GetSelected(); + VclBuilder aBuilder(nullptr, VclBuilderContainer::getUIRootDir(), "modules/scalc/ui/dropmenu.ui", ""); + VclPtr<PopupMenu> aPop(aBuilder.get_menu("menu")); - pToolBox->EndSelection(); // before SetDropMode (SetDropMode calls SetItemImage) + switch (GetDropMode()) + { + case 0: + aPop->CheckItem(aPop->GetItemId("hyperlink")); + break; + case 1: + aPop->CheckItem(aPop->GetItemId("link")); + break; + case 2: + aPop->CheckItem(aPop->GetItemId("copy")); + break; + } + + sal_uInt16 nId = aPop->Execute(pToolBox, pToolBox->GetItemRect(nDragModeId), PopupMenuFlags::ExecuteDown); + OString sIdent = aPop->GetItemIdent(nId); - if (nId >= RID_DROPMODE_URL && nId <= RID_DROPMODE_COPY) - SetDropMode(nId - RID_DROPMODE_URL); + if (sIdent == "hyperlink") + SetDropMode(0); + else if (sIdent == "link") + SetDropMode(1); + else if (sIdent == "copy") + SetDropMode(2); + + pToolBox->EndSelection(); // before SetDropMode (SetDropMode calls SetItemImage) } } diff --git a/sc/source/ui/navipi/navipi.src b/sc/source/ui/navipi/navipi.src index eb2071f9bb01..a51d48f10fed 100644 --- a/sc/source/ui/navipi/navipi.src +++ b/sc/source/ui/navipi/navipi.src @@ -176,35 +176,6 @@ String SCSTR_QHLP_SCEN_COMMENT Text [ en-US ] = "Comment"; }; - // PopupMenu ------------------------------------------------------------- -Menu RID_POPUP_DROPMODE -{ - ItemList = - { - MenuItem - { - Identifier = RID_DROPMODE_URL ; - HelpId = HID_SC_DROPMODE_URL ; - Text [ en-US ] = "Insert as Hyperlink" ; - RadioCheck = TRUE ; - }; - MenuItem - { - Identifier = RID_DROPMODE_LINK ; - HelpId = HID_SC_DROPMODE_LINK ; - Text [ en-US ] = "Insert as Link" ; - RadioCheck = TRUE ; - }; - MenuItem - { - Identifier = RID_DROPMODE_COPY ; - HelpId = HID_SC_DROPMODE_COPY ; - Text [ en-US ] = "Insert as Copy" ; - RadioCheck = TRUE ; - }; - }; -}; - Menu RID_POPUP_NAVIPI_SCENARIO { ItemList = diff --git a/sc/uiconfig/scalc/ui/dropmenu.ui b/sc/uiconfig/scalc/ui/dropmenu.ui new file mode 100644 index 000000000000..5cd023b0c577 --- /dev/null +++ b/sc/uiconfig/scalc/ui/dropmenu.ui @@ -0,0 +1,33 @@ +<?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="GtkRadioMenuItem" id="hyperlink"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Insert as Hyperlink</property> + <property name="use_underline">True</property> + </object> + </child> + <child> + <object class="GtkRadioMenuItem" id="link"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Insert as Link</property> + <property name="use_underline">True</property> + </object> + </child> + <child> + <object class="GtkRadioMenuItem" id="copy"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Insert as Copy</property> + <property name="use_underline">True</property> + </object> + </child> + </object> +</interface> |