[Libreoffice-commits] core.git: Branch 'libreoffice-5-0' - sw/inc sw/source

Samuel Mehrbrodt Samuel.Mehrbrodt at cib.de
Mon Feb 1 12:48:53 UTC 2016


 sw/inc/globals.hrc                |    6 ++----
 sw/source/ui/frmdlg/frmui.src     |   19 -------------------
 sw/source/uibase/shells/frmsh.cxx |   26 +++++++++++++++++---------
 3 files changed, 19 insertions(+), 32 deletions(-)

New commits:
commit acfc9935a41d45619d09d05abe6d933c3cd9fcc7
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
Date:   Fri Dec 11 09:23:09 2015 +0100

    tdf#96075 Frame alignment buttons not using correct tooltips
    
    Tooltips change on state change, and they were taken from another source.
    Unify this to reuse the existing strings from the uno command.
    
    Change-Id: I8ff6fc43bc0469f15c9e930695d950f6d664bfdf
    Reviewed-on: https://gerrit.libreoffice.org/20629
    Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
    Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
    Reviewed-on: https://gerrit.libreoffice.org/20633
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/sw/inc/globals.hrc b/sw/inc/globals.hrc
index ca0a2ef..96bc1c5 100644
--- a/sw/inc/globals.hrc
+++ b/sw/inc/globals.hrc
@@ -59,10 +59,8 @@
 #define STR_TOP_BASE                (RC_GLOBALS_BEGIN + 31)
 #define STR_BOTTOM_BASE             (RC_GLOBALS_BEGIN + 32)
 #define STR_CENTER_BASE             (RC_GLOBALS_BEGIN + 33)
-#define STR_TOP                     (RC_GLOBALS_BEGIN + 34)
-#define STR_BOTTOM                  (RC_GLOBALS_BEGIN + 35)
-#define STR_CENTER_HORI             (RC_GLOBALS_BEGIN + 36)
-#define STR_CENTER_VERT             (RC_GLOBALS_BEGIN + 37)
+
+// free
 
 #define STR_LOAD_HTML_DOC           (RC_GLOBALS_BEGIN + 38)
 
diff --git a/sw/source/ui/frmdlg/frmui.src b/sw/source/ui/frmdlg/frmui.src
index c6d436a..ecbcc4e 100644
--- a/sw/source/ui/frmdlg/frmui.src
+++ b/sw/source/ui/frmdlg/frmui.src
@@ -19,25 +19,6 @@
 #include "frmui.hrc"
 
 /*-----------------------------------------------------------------------
-    Description: V-Align
- -----------------------------------------------------------------------*/
-String STR_TOP
-{
-    Text [ en-US ] = "~Top" ;
-};
-String STR_BOTTOM
-{
-    Text [ en-US ] = "~Bottom" ;
-};
-String STR_CENTER_VERT
-{
-    Text [ en-US ] = "C~enter" ;
-};
-String STR_CENTER_HORI
-{
-    Text [ en-US ] = "~Center" ;
-};
-/*-----------------------------------------------------------------------
     Description: V-Rel
  -----------------------------------------------------------------------*/
 String STR_TOPPRT
diff --git a/sw/source/uibase/shells/frmsh.cxx b/sw/source/uibase/shells/frmsh.cxx
index 4868fdf..87fdc66 100644
--- a/sw/source/uibase/shells/frmsh.cxx
+++ b/sw/source/uibase/shells/frmsh.cxx
@@ -40,6 +40,7 @@
 #include <sfx2/request.hxx>
 #include <sfx2/objface.hxx>
 #include <sfx2/sidebar/EnumContext.hxx>
+#include <sfx2/sidebar/CommandInfoProvider.hxx>
 #include <svx/hlnkitem.hxx>
 #include <svx/svdview.hxx>
 #include <vcl/msgbox.hxx>
@@ -739,21 +740,25 @@ void SwFrameShell::GetState(SfxItemSet& rSet)
                         rSet.DisableItem( nWhich );
                     else
                     {
-                        sal_uInt16 nId = 0;
+                        // These slots need different labels depending on whether they are anchored in a character
+                        // or on a paragraph/page etc.
+                        OUString sNewLabel;
                         if (eFrmType & FrmTypeFlags::FLY_INCNT)
                         {
                             switch (nWhich)
                             {
                                 case SID_OBJECT_ALIGN_UP     :
                                 case FN_FRAME_ALIGN_VERT_TOP:
-                                    nId = STR_TOP_BASE; break;
+                                    sNewLabel = SW_RES(STR_TOP_BASE);
+                                    break;
                                 case SID_OBJECT_ALIGN_MIDDLE :
                                 case FN_FRAME_ALIGN_VERT_CENTER:
-                                    nId = STR_CENTER_BASE;  break;
+                                    sNewLabel = SW_RES(STR_CENTER_BASE);
+                                    break;
                                 case SID_OBJECT_ALIGN_DOWN :
                                 case FN_FRAME_ALIGN_VERT_BOTTOM:
                                     if(!bHtmlMode)
-                                        nId = STR_BOTTOM_BASE;
+                                        sNewLabel = SW_RES(STR_BOTTOM_BASE);
                                     else
                                         rSet.DisableItem( nWhich );
                                 break;
@@ -782,17 +787,20 @@ void SwFrameShell::GetState(SfxItemSet& rSet)
                             {
                                 case SID_OBJECT_ALIGN_UP :
                                 case FN_FRAME_ALIGN_VERT_TOP:
-                                    nId = STR_TOP; break;
+                                    sNewLabel = sfx2::sidebar::CommandInfoProvider::Instance().GetLabelForCommand(".uno:AlignTop", GetFrame()->GetFrame().GetFrameInterface());
+                                    break;
                                 case SID_OBJECT_ALIGN_MIDDLE:
                                 case FN_FRAME_ALIGN_VERT_CENTER:
-                                    nId = STR_CENTER_VERT; break;
+                                    sNewLabel = sfx2::sidebar::CommandInfoProvider::Instance().GetLabelForCommand(".uno:AlignVerticalCenter", GetFrame()->GetFrame().GetFrameInterface());
+                                    break;
                                 case SID_OBJECT_ALIGN_DOWN:
                                 case FN_FRAME_ALIGN_VERT_BOTTOM:
-                                    nId = STR_BOTTOM; break;
+                                    sNewLabel = sfx2::sidebar::CommandInfoProvider::Instance().GetLabelForCommand(".uno:AlignBottom", GetFrame()->GetFrame().GetFrameInterface());
+                                    break;
                             }
                         }
-                        if ( nId )
-                            rSet.Put( SfxStringItem( nWhich, SW_RES(nId) ));
+                        if ( !sNewLabel.isEmpty() )
+                            rSet.Put( SfxStringItem( nWhich, sNewLabel ));
                     }
                 break;
                 case SID_HYPERLINK_GETLINK:


More information about the Libreoffice-commits mailing list