[Libreoffice-commits] core.git: 2 commits - framework/source icon-themes/breeze icon-themes/galaxy icon-themes/hicontrast icon-themes/sifr icon-themes/tango include/sfx2 officecfg/registry sfx2/sdi vcl/source

Maxim Monastirsky momonasmon at gmail.com
Mon Mar 21 10:40:24 UTC 2016


 framework/source/uielement/popuptoolbarcontroller.cxx                |   25 ++++++----
 icon-themes/breeze/links.txt                                         |    3 +
 icon-themes/galaxy/links.txt                                         |    2 
 icon-themes/hicontrast/links.txt                                     |    2 
 icon-themes/sifr/links.txt                                           |    4 +
 icon-themes/tango/links.txt                                          |    2 
 include/sfx2/sfxsids.hrc                                             |    1 
 officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu |   11 ++++
 sfx2/sdi/docslots.sdi                                                |    1 
 sfx2/sdi/sfx.sdi                                                     |   15 ++++++
 vcl/source/helper/commandinfoprovider.cxx                            |    5 +-
 11 files changed, 61 insertions(+), 10 deletions(-)

New commits:
commit ae00a95ea458a0328d7b12d25c231e9f4ac8eed8
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date:   Mon Mar 21 12:35:46 2016 +0200

    tdf#98745 Optional save button without the dropdown
    
    Change-Id: I66499a9108dce76e661df9b5b45b249caf9eece8

diff --git a/framework/source/uielement/popuptoolbarcontroller.cxx b/framework/source/uielement/popuptoolbarcontroller.cxx
index 28f7aff..50f7ec3 100644
--- a/framework/source/uielement/popuptoolbarcontroller.cxx
+++ b/framework/source/uielement/popuptoolbarcontroller.cxx
@@ -354,12 +354,14 @@ public:
     virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw ( css::uno::RuntimeException ) override;
 
 private:
+    bool m_bSplitButton;
     bool m_bModified;
     css::uno::Reference< css::util::XModifiable > m_xModifiable;
 };
 
 SaveToolbarController::SaveToolbarController( const css::uno::Reference< css::uno::XComponentContext >& rxContext )
     : ImplInheritanceHelper( rxContext, ".uno:SaveAsMenu" )
+    , m_bSplitButton( true )
     , m_bModified( false )
 {
 }
@@ -369,16 +371,21 @@ void SaveToolbarController::initialize( const css::uno::Sequence< css::uno::Any
 {
     PopupMenuToolbarController::initialize( aArguments );
 
-    if ( m_sModuleName.endsWith( "RelationDesign" ) )
+    bool bRelationDesignModule = m_sModuleName.endsWith( "RelationDesign" );
+
+    ToolBox* pToolBox = nullptr;
+    sal_uInt16 nId = 0;
+    if ( getToolboxId( nId, &pToolBox )
+        && ( bRelationDesignModule || pToolBox->GetItemCommand( nId ) != m_aCommandURL ) )
     {
-        // Should not have the dropdown.
-        ToolBox* pToolBox = nullptr;
-        sal_uInt16 nId = 0;
-        if ( getToolboxId( nId, &pToolBox ) )
-            pToolBox->SetItemBits( nId, pToolBox->GetItemBits( nId ) & ~ ToolBoxItemBits::DROPDOWN );
-        return;
+        m_bSplitButton = false;
+        pToolBox->SetItemBits( nId, pToolBox->GetItemBits( nId ) & ~ ToolBoxItemBits::DROPDOWN );
     }
 
+    if ( bRelationDesignModule )
+        // No modified icon there, just disable the button if there's nothing to save.
+        return;
+
     css::uno::Reference< css::frame::XController > xController( m_xFrame->getController(), css::uno::UNO_QUERY );
     if ( xController.is() )
         m_xModifiable.set( xController->getModel(), css::uno::UNO_QUERY );
@@ -421,7 +428,7 @@ void SaveToolbarController::updateImage()
     css::uno::Reference< css::frame::XStorable > xStorable( m_xModifiable, css::uno::UNO_QUERY );
     Image aImage;
 
-    if ( xStorable.is() && xStorable->isReadonly() )
+    if ( m_bSplitButton && xStorable.is() && xStorable->isReadonly() )
     {
         aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand( ".uno:SaveAs", bLargeIcons, m_xFrame );
     }
@@ -446,7 +453,7 @@ void SaveToolbarController::statusChanged( const css::frame::FeatureStateEvent&
     // If the model is able to tell us whether we're in read only mode, change the button to save as only mode
     // based on that. Otherwise just dumbly disable the button (because there could be other reasons why the
     // save slot is disabled, where save as isn't possible as well).
-    if ( xStorable.is() )
+    if ( m_bSplitButton && xStorable.is() )
     {
         ToolBox* pToolBox = nullptr;
         sal_uInt16 nId = 0;
diff --git a/icon-themes/breeze/links.txt b/icon-themes/breeze/links.txt
index fc0ad0b..14f7be2 100644
--- a/icon-themes/breeze/links.txt
+++ b/icon-themes/breeze/links.txt
@@ -826,6 +826,9 @@ cmd/sc_showgraphics.png cmd/sc_graphic.png
 cmd/lc_dsbrowserexplorer.png cmd/lc_showfmexplorer.png
 cmd/sc_dsbrowserexplorer.png cmd/sc_showfmexplorer.png
 
+cmd/lc_savesimple.png cmd/lc_save.png
+cmd/sc_savesimple.png cmd/sc_save.png
+
 # database
 # ==============================================
 database/linked_text_table.png cmd/sc_dataimport.png
diff --git a/icon-themes/galaxy/links.txt b/icon-themes/galaxy/links.txt
index 1a94f0b..18e589d 100644
--- a/icon-themes/galaxy/links.txt
+++ b/icon-themes/galaxy/links.txt
@@ -1,3 +1,5 @@
+cmd/lc_savesimple.png cmd/lc_save.png
+cmd/sc_savesimple.png cmd/sc_save.png
 cmd/lc_datastreamsplay.png avmedia/res/avl02049.png
 cmd/sc_datastreamsplay.png avmedia/res/av02049.png
 cmd/lc_datastreamsstop.png avmedia/res/avl02051.png
diff --git a/icon-themes/hicontrast/links.txt b/icon-themes/hicontrast/links.txt
index 6a36734..278aabd 100644
--- a/icon-themes/hicontrast/links.txt
+++ b/icon-themes/hicontrast/links.txt
@@ -1,3 +1,5 @@
+cmd/lc_savesimple.png cmd/lc_save.png
+cmd/sc_savesimple.png cmd/sc_save.png
 cmd/lc_anchormenu.png cmd/lc_toggleanchortype.png
 cmd/sc_anchormenu.png cmd/sc_toggleanchortype.png
 
diff --git a/icon-themes/sifr/links.txt b/icon-themes/sifr/links.txt
index c5304c5..4035889 100644
--- a/icon-themes/sifr/links.txt
+++ b/icon-themes/sifr/links.txt
@@ -154,6 +154,10 @@ cmd/sc_insertrowsafter.png cmd/sc_insertrows.png
 cmd/lc_insertcolumnsafter.png cmd/lc_insertcolumns.png
 cmd/sc_insertcolumnsafter.png cmd/sc_insertcolumns.png
 
+# simple save button
+cmd/lc_savesimple.png cmd/lc_save.png
+cmd/sc_savesimple.png cmd/sc_save.png
+
 # anchor menu
 cmd/lc_anchormenu.png cmd/lc_toggleanchortype.png
 cmd/sc_anchormenu.png cmd/sc_toggleanchortype.png
diff --git a/icon-themes/tango/links.txt b/icon-themes/tango/links.txt
index c5750f9..2189051 100644
--- a/icon-themes/tango/links.txt
+++ b/icon-themes/tango/links.txt
@@ -1,3 +1,5 @@
+cmd/lc_savesimple.png cmd/lc_save.png
+cmd/sc_savesimple.png cmd/sc_save.png
 cmd/sc_showsinglepage.png cmd/sc_adddirect.png
 res/sx03129.png dbaccess/res/db.png
 cmd/sc_refresh.png cmd/sc_reload.png
diff --git a/include/sfx2/sfxsids.hrc b/include/sfx2/sfxsids.hrc
index 25664a9..16def42 100644
--- a/include/sfx2/sfxsids.hrc
+++ b/include/sfx2/sfxsids.hrc
@@ -103,6 +103,7 @@
 #define SID_OPENTEMPLATE                    (SID_SFX_START + 594)
 #define SID_SAVEASDOC                       (SID_SFX_START + 502)
 #define SID_SAVEASREMOTE                    (SID_SFX_START + 516)
+#define SID_SAVESIMPLE                      (SID_SFX_START + 518)
 #define SID_SAVEACOPY                       (SID_SFX_START + 999)
 #define SID_SAVEACOPYITEM                   (SID_SFX_START + 998)
 #define SID_CLOSING                         (SID_SFX_START +1539)
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
index b0c65de..e88a79e 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
@@ -2141,6 +2141,17 @@
           <value>1</value>
         </prop>
       </node>
+      <node oor:name=".uno:SaveSimple" oor:op="replace">
+        <prop oor:name="Label" oor:type="xs:string">
+          <value xml:lang="en-US">Save Document</value>
+        </prop>
+        <prop oor:name="Properties" oor:type="xs:int">
+          <value>1</value>
+        </prop>
+        <prop oor:name="TargetURL" oor:type="xs:string">
+          <value>.uno:Save</value>
+        </prop>
+      </node>
       <node oor:name=".uno:BezierInsert" oor:op="replace">
         <prop oor:name="Label" oor:type="xs:string">
           <value xml:lang="en-US">Insert Points</value>
diff --git a/sfx2/sdi/docslots.sdi b/sfx2/sdi/docslots.sdi
index 73e1e4d..8a54a6c 100644
--- a/sfx2/sdi/docslots.sdi
+++ b/sfx2/sdi/docslots.sdi
@@ -124,6 +124,7 @@ interface OfficeDocument : Document
         ExecMethod = ExecProps_Impl ;
         StateMethod = GetState_Impl ;
     ]
+    SID_SAVESIMPLE []
     SID_SAVEDOC // ole(req) api(final/play/rec)
     [
         ExecMethod = ExecFile_Impl ;
diff --git a/sfx2/sdi/sfx.sdi b/sfx2/sdi/sfx.sdi
index e1b37a5..b69f94d 100644
--- a/sfx2/sdi/sfx.sdi
+++ b/sfx2/sdi/sfx.sdi
@@ -3563,6 +3563,21 @@ SfxVoidItem RunBasic SID_BASICRUN
     GroupId = GID_MACRO;
 ]
 
+SfxVoidItem SaveSimple SID_SAVESIMPLE
+[
+    AutoUpdate = FALSE,
+    FastCall = FALSE,
+    ReadOnlyDoc = FALSE,
+    Toggle = FALSE,
+    Container = TRUE,
+    RecordAbsolute = FALSE,
+    NoRecord;
+
+    AccelConfig = TRUE,
+    MenuConfig = TRUE,
+    ToolBoxConfig = TRUE,
+    GroupId = GID_DOCUMENT;
+]
 
 SfxBoolItem Save SID_SAVEDOC
 (SfxStringItem VersionComment SID_DOCINFO_COMMENTS,SfxStringItem Author SID_DOCINFO_AUTHOR)
commit e4765bdfecf94287aeaf3f27cca185b533761784
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date:   Mon Mar 21 12:05:30 2016 +0200

    Need to get the shortcut of the real command
    
    ... as command alias can't have one by itself.
    That's the same we do for menus.
    
    Change-Id: I555a41282001300fa9aa0e585c073656789c4ebd

diff --git a/vcl/source/helper/commandinfoprovider.cxx b/vcl/source/helper/commandinfoprovider.cxx
index c878a94..77d5ba6 100644
--- a/vcl/source/helper/commandinfoprovider.cxx
+++ b/vcl/source/helper/commandinfoprovider.cxx
@@ -166,7 +166,10 @@ OUString CommandInfoProvider::GetTooltipForCommand (
     if (sLabel.isEmpty())
         sLabel = GetCommandProperty("Name", rsCommandName);
 
-    const OUString sShortCut(GetCommandShortcut(rsCommandName, rxFrame));
+    // Command can be just an alias to another command,
+    // so need to get the shortcut of the "real" command.
+    const OUString sRealCommand(GetRealCommandForCommand(rsCommandName, rxFrame));
+    const OUString sShortCut(GetCommandShortcut(!sRealCommand.isEmpty() ? sRealCommand : rsCommandName, rxFrame));
     if (!sShortCut.isEmpty())
         return sLabel + " (" + sShortCut + ")";
     return sLabel;


More information about the Libreoffice-commits mailing list