[Libreoffice-commits] core.git: 4 commits - sc/inc sc/Library_sc.mk sc/source sc/uiconfig sc/UIConfig_scalc.mk
Caolán McNamara
caolanm at redhat.com
Mon Apr 10 09:38:56 UTC 2017
sc/Library_sc.mk | 1
sc/UIConfig_scalc.mk | 2 +
sc/inc/helpids.h | 8 -----
sc/inc/scres.hrc | 10 ------
sc/source/ui/cctrl/popmenu.cxx | 28 ------------------
sc/source/ui/inc/popmenu.hxx | 44 -----------------------------
sc/source/ui/inc/tphfedit.hxx | 1
sc/source/ui/miscdlgs/acredlin.cxx | 1
sc/source/ui/navipi/content.cxx | 53 ++++++++++++++++++++++-------------
sc/source/ui/navipi/navipi.cxx | 33 ++++++++++++++++-----
sc/source/ui/navipi/navipi.src | 48 -------------------------------
sc/source/ui/navipi/scenwnd.cxx | 23 +++++----------
sc/uiconfig/scalc/ui/dropmenu.ui | 33 +++++++++++++++++++++
sc/uiconfig/scalc/ui/scenariomenu.ui | 25 ++++++++++++++++
14 files changed, 127 insertions(+), 183 deletions(-)
New commits:
commit 78acb910d2c1d69b03f701dc2dc1fdcbc020125f
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon Apr 10 10:29:53 2017 +0100
the active document window should be radio entries
Change-Id: I90980345f4ea68dc15bacbf2c7abdf2d5d36a05d
diff --git a/sc/source/ui/navipi/content.cxx b/sc/source/ui/navipi/content.cxx
index 657ddf6b351a..a1f9ba8d1dde 100644
--- a/sc/source/ui/navipi/content.cxx
+++ b/sc/source/ui/navipi/content.cxx
@@ -617,7 +617,7 @@ void ScContentTree::Command( const CommandEvent& rCEvt )
else
aEntry += pParentWindow->aStrNotActive;
++i;
- aDocMenu->InsertItem(i, aEntry, MenuItemBits::TEXT, OString("document") + OString::number(i));
+ aDocMenu->InsertItem(i, aEntry, MenuItemBits::AUTOCHECK | MenuItemBits::RADIOCHECK, OString("document") + OString::number(i));
if ( !bHiddenDoc && aName == aManualDoc )
nPos = i;
}
@@ -625,7 +625,7 @@ void ScContentTree::Command( const CommandEvent& rCEvt )
}
// "active window"
++i;
- aDocMenu->InsertItem(i, pParentWindow->aStrActiveWin, MenuItemBits::TEXT, OString("document") + OString::number(i));
+ aDocMenu->InsertItem(i, pParentWindow->aStrActiveWin, MenuItemBits::AUTOCHECK | MenuItemBits::RADIOCHECK, OString("document") + OString::number(i));
if (!bHiddenDoc && aManualDoc.isEmpty())
nPos = i;
// hidden document
@@ -634,7 +634,7 @@ void ScContentTree::Command( const CommandEvent& rCEvt )
OUString aEntry = aHiddenTitle;
aEntry += pParentWindow->aStrHidden;
++i;
- aDocMenu->InsertItem(i, aEntry, MenuItemBits::TEXT, OString("document") + OString::number(i));
+ aDocMenu->InsertItem(i, aEntry, MenuItemBits::AUTOCHECK | MenuItemBits::RADIOCHECK, OString("document") + OString::number(i));
if (bHiddenDoc)
nPos = i;
}
commit f7b5db1f39f97bc14fea448a1995637c3937c931
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon Apr 10 10:21:44 2017 +0100
ScPopupMenu is now unused
Change-Id: I84e2f22992f917f14b4b4b8063238704939f56b7
diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk
index 0a888ee0e403..c8fe0316e679 100644
--- a/sc/Library_sc.mk
+++ b/sc/Library_sc.mk
@@ -384,7 +384,6 @@ $(eval $(call gb_Library_add_exception_objects,sc,\
sc/source/ui/cctrl/cbuttonw \
sc/source/ui/cctrl/checklistmenu \
sc/source/ui/cctrl/dpcontrol \
- sc/source/ui/cctrl/popmenu \
sc/source/ui/cctrl/tbzoomsliderctrl \
sc/source/ui/condformat/condformatdlg \
sc/source/ui/condformat/condformatdlgentry \
diff --git a/sc/source/ui/cctrl/popmenu.cxx b/sc/source/ui/cctrl/popmenu.cxx
deleted file mode 100644
index 47b2b88f8334..000000000000
--- a/sc/source/ui/cctrl/popmenu.cxx
+++ /dev/null
@@ -1,28 +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 "popmenu.hxx"
-
-void ScPopupMenu::Select()
-{
- nSel = GetCurItemId();
- bHit = true;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/popmenu.hxx b/sc/source/ui/inc/popmenu.hxx
deleted file mode 100644
index fcd8746b7b41..000000000000
--- a/sc/source/ui/inc/popmenu.hxx
+++ /dev/null
@@ -1,44 +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 .
- */
-
-#ifndef INCLUDED_SC_SOURCE_UI_INC_POPMENU_HXX
-#define INCLUDED_SC_SOURCE_UI_INC_POPMENU_HXX
-
-#include <vcl/menu.hxx>
-#include "scdllapi.h"
-
-class SC_DLLPUBLIC ScPopupMenu : public PopupMenu
-{
-private:
- sal_uInt16 nSel;
- bool bHit;
-protected:
- virtual void Select() override;
-public:
- ScPopupMenu() : nSel(0),bHit(false) {}
-
- ScPopupMenu(const ResId& rRes) : PopupMenu(rRes),nSel(0),bHit(false) {}
-
- sal_uInt16 GetSelected() const { return nSel; }
- bool WasHit() const { return bHit; }
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/tphfedit.hxx b/sc/source/ui/inc/tphfedit.hxx
index da7a5f9199ab..9047fad24e4f 100644
--- a/sc/source/ui/inc/tphfedit.hxx
+++ b/sc/source/ui/inc/tphfedit.hxx
@@ -28,7 +28,6 @@
#include <vcl/virdev.hxx>
#include "scdllapi.h"
#include "scitems.hxx"
-#include "popmenu.hxx"
#include <com/sun/star/accessibility/XAccessible.hpp>
#include <cppuhelper/weakref.hxx>
diff --git a/sc/source/ui/miscdlgs/acredlin.cxx b/sc/source/ui/miscdlgs/acredlin.cxx
index f33efa354854..5130dc0411cc 100644
--- a/sc/source/ui/miscdlgs/acredlin.cxx
+++ b/sc/source/ui/miscdlgs/acredlin.cxx
@@ -36,7 +36,6 @@
#include "scres.hrc"
#include "simpref.hxx"
#include "scmod.hxx"
-#include "popmenu.hxx"
#include "tabvwsh.hxx"
// defines -------------------------------------------------------------------
diff --git a/sc/source/ui/navipi/content.cxx b/sc/source/ui/navipi/content.cxx
index 598b22fe857a..657ddf6b351a 100644
--- a/sc/source/ui/navipi/content.cxx
+++ b/sc/source/ui/navipi/content.cxx
@@ -42,7 +42,6 @@
#include "rangenam.hxx"
#include "dbdata.hxx"
#include "tablink.hxx"
-#include "popmenu.hxx"
#include "drwlayer.hxx"
#include "transobj.hxx"
#include "drwtrans.hxx"
diff --git a/sc/source/ui/navipi/navipi.cxx b/sc/source/ui/navipi/navipi.cxx
index 9004459997b1..87b3cf6c401a 100644
--- a/sc/source/ui/navipi/navipi.cxx
+++ b/sc/source/ui/navipi/navipi.cxx
@@ -37,7 +37,6 @@
#include "dbdata.hxx"
#include "rangenam.hxx"
#include "rangeutl.hxx"
-#include "popmenu.hxx"
#include "scres.hrc"
#include "scresid.hxx"
#include "scmod.hxx"
diff --git a/sc/source/ui/navipi/scenwnd.cxx b/sc/source/ui/navipi/scenwnd.cxx
index b9ae59960e7f..3246d3abb08d 100644
--- a/sc/source/ui/navipi/scenwnd.cxx
+++ b/sc/source/ui/navipi/scenwnd.cxx
@@ -26,7 +26,6 @@
#include <vcl/svapp.hxx>
#include <vcl/settings.hxx>
#include "navipi.hxx"
-#include "popmenu.hxx"
#include "scresid.hxx"
#include "scres.hrc"
#include "globstr.hrc"
commit 37530ebbfe92893b1fd7e0b55d25b13695f06776
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon Apr 10 10:20:34 2017 +0100
convert scenario menu to .ui
Change-Id: Iac0f52898ce9e8484731d62b2555ed3c83563d1d
diff --git a/sc/UIConfig_scalc.mk b/sc/UIConfig_scalc.mk
index 4237274aaa67..d6dccd0ef937 100644
--- a/sc/UIConfig_scalc.mk
+++ b/sc/UIConfig_scalc.mk
@@ -188,6 +188,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/scalc,\
sc/uiconfig/scalc/ui/samplingdialog \
sc/uiconfig/scalc/ui/standardfilterdialog \
sc/uiconfig/scalc/ui/scenariodialog \
+ sc/uiconfig/scalc/ui/scenariomenu \
sc/uiconfig/scalc/ui/scgeneralpage \
sc/uiconfig/scalc/ui/searchresults \
sc/uiconfig/scalc/ui/selectdatasource \
diff --git a/sc/inc/helpids.h b/sc/inc/helpids.h
index 39df049390db..87fe34b4cc97 100644
--- a/sc/inc/helpids.h
+++ b/sc/inc/helpids.h
@@ -46,9 +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_SCENARIO_DELETE "SC_HID_SC_SCENARIO_DELETE"
-#define HID_SC_SCENARIO_EDIT "SC_HID_SC_SCENARIO_EDIT"
-
#define HID_FUNCTION_BOX "SC_HID_FUNCTION_BOX"
// wrong group - HID_SC_DLG_START is full
diff --git a/sc/inc/scres.hrc b/sc/inc/scres.hrc
index 499a19de6fb5..9bf03fa7a163 100644
--- a/sc/inc/scres.hrc
+++ b/sc/inc/scres.hrc
@@ -441,10 +441,6 @@
#define RID_SCDLG_HFEDIT_HEADER (SC_DIALOGS_START + 68)
#define RID_SCDLG_HFEDIT_FOOTER (SC_DIALOGS_START + 69)
-#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)
-
#define RID_CELLSTYLEFAMILY (SC_DIALOGS_START + 138)
#define RID_PAGESTYLEFAMILY (SC_DIALOGS_START + 139)
#define BMP_STYLES_FAMILY_CELL (SC_DIALOGS_START + 140)
diff --git a/sc/source/ui/navipi/navipi.src b/sc/source/ui/navipi/navipi.src
index a51d48f10fed..4da7b17d911b 100644
--- a/sc/source/ui/navipi/navipi.src
+++ b/sc/source/ui/navipi/navipi.src
@@ -176,23 +176,4 @@ String SCSTR_QHLP_SCEN_COMMENT
Text [ en-US ] = "Comment";
};
-Menu RID_POPUP_NAVIPI_SCENARIO
-{
- ItemList =
- {
- MenuItem
- {
- Identifier = RID_NAVIPI_SCENARIO_DELETE ;
- HelpId = HID_SC_SCENARIO_DELETE ;
- Text [ en-US ] = "Delete" ;
- };
- MenuItem
- {
- Identifier = RID_NAVIPI_SCENARIO_EDIT ;
- HelpId = HID_SC_SCENARIO_EDIT ;
- Text [ en-US ] = "Properties..." ;
- };
- };
-};
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/navipi/scenwnd.cxx b/sc/source/ui/navipi/scenwnd.cxx
index 71c40d913146..b9ae59960e7f 100644
--- a/sc/source/ui/navipi/scenwnd.cxx
+++ b/sc/source/ui/navipi/scenwnd.cxx
@@ -135,20 +135,14 @@ bool ScScenarioListBox::EventNotify( NotifyEvent& rNEvt )
{
if( !pEntry->mbProtected )
{
- ScopedVclPtrInstance<ScPopupMenu> aPopup( ScResId( RID_POPUP_NAVIPI_SCENARIO ) );
- aPopup->Execute( this, pCEvt->GetMousePosPixel() );
- if (aPopup->WasHit())
- {
- switch( aPopup->GetSelected() )
- {
- case RID_NAVIPI_SCENARIO_DELETE:
- DeleteScenario();
- break;
- case RID_NAVIPI_SCENARIO_EDIT:
- EditScenario();
- break;
- }
- }
+ VclBuilder aBuilder(nullptr, VclBuilderContainer::getUIRootDir(), "modules/scalc/ui/scenariomenu.ui", "");
+ VclPtr<PopupMenu> aPopup(aBuilder.get_menu("menu"));
+ sal_uInt16 nId = aPopup->Execute(this, pCEvt->GetMousePosPixel());
+ OString sIdent(aPopup->GetItemIdent(nId));
+ if (sIdent == "delete")
+ DeleteScenario();
+ else if (sIdent == "edit")
+ EditScenario();
}
}
bHandled = true;
diff --git a/sc/uiconfig/scalc/ui/scenariomenu.ui b/sc/uiconfig/scalc/ui/scenariomenu.ui
new file mode 100644
index 000000000000..834a2b2c61cd
--- /dev/null
+++ b/sc/uiconfig/scalc/ui/scenariomenu.ui
@@ -0,0 +1,25 @@
+<?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="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>
+ <child>
+ <object class="GtkMenuItem" id="edit">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Properties...</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ </object>
+</interface>
commit 73295fa4e0df4637f1ddcca30311481efc1009e3
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon Apr 10 10:10:34 2017 +0100
convert RID_POPUP_DROPMODE menu to .ui
Change-Id: I004bb61ab6d0cb2dfacc9290236c32a2adf7ff82
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>
More information about the Libreoffice-commits
mailing list