summaryrefslogtreecommitdiff
path: root/basctl/source/basicide/basides1.cxx
diff options
context:
space:
mode:
authorMaxim Monastirsky <momonasmon@gmail.com>2020-07-26 12:35:11 +0300
committerMaxim Monastirsky <momonasmon@gmail.com>2020-07-28 00:44:46 +0200
commit2446fdba3ec4a81d6e3b619a1d9e91b3c6dcbd54 (patch)
treecd669f0646152ad90756bc06e31fc6eb5d9e9a4b /basctl/source/basicide/basides1.cxx
parenta10e3987e61b7fcc1a3f7ce3f34fe75a51bff87e (diff)
tdf#134887 Rework last item handling in NewToolbarController
Just store the last used menu id, and consistently get all the information (command name, image id, target frame etc.) from the menu instance. Also implement the XSubToolbarController interface, so we get a chance to update the image on icon size or theme change. The initial action and icon of the button are based on the url passed by the .uno:AddDirect status update, given that there is a corresponding menu item. The only defined fallback now is to .uno:AddDirect itself for both executing and getting the icon, but this shouldn't happen normally, as I fixed all the affected cases I found so far, namely Base (including windows like table design etc.) and the Basic IDE. Actually these cases were partially broken anyway, and as a result now completely fixed: - In Base main app window, the button used to default to a new Writer document, although its tooltip advertises Ctrl+N as the kb shortcut, and pressing that shortcut actually opens the database creation wizard (as expected). - In the Basic IDE, the button was working, but not the Ctrl+N shortcut. Change-Id: I6537b3f38e7d7001ec1b39d78285445464fd8cbe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99514 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky <momonasmon@gmail.com>
Diffstat (limited to 'basctl/source/basicide/basides1.cxx')
-rw-r--r--basctl/source/basicide/basides1.cxx16
1 files changed, 16 insertions, 0 deletions
diff --git a/basctl/source/basicide/basides1.cxx b/basctl/source/basicide/basides1.cxx
index 12399e823019..e42ad914390a 100644
--- a/basctl/source/basicide/basides1.cxx
+++ b/basctl/source/basicide/basides1.cxx
@@ -40,6 +40,7 @@
#include <svl/srchdefs.hxx>
#include <sal/log.hxx>
#include <osl/diagnose.h>
+#include <sfx2/app.hxx>
#include <sfx2/bindings.hxx>
#include <sfx2/childwin.hxx>
#include <sfx2/dinfdlg.hxx>
@@ -270,6 +271,14 @@ void Shell::ExecuteGlobal( SfxRequest& rReq )
sal_uInt16 nSlot = rReq.GetSlot();
switch ( nSlot )
{
+ case SID_NEWDOCDIRECT:
+ {
+ // we do not have a new document factory,
+ // so just forward to a fallback method.
+ SfxGetpApp()->ExecuteSlot(rReq);
+ }
+ break;
+
case SID_BASICSTOP:
{
// maybe do not simply stop if on breakpoint!
@@ -770,6 +779,13 @@ void Shell::GetState(SfxItemSet &rSet)
{
switch ( nWh )
{
+ case SID_NEWDOCDIRECT:
+ {
+ // we do not have a new document factory,
+ // so just forward to a fallback method.
+ SfxGetpApp()->GetSlotState(nWh, nullptr, &rSet);
+ }
+ break;
case SID_DOCINFO:
{
rSet.DisableItem( nWh );