[Libreoffice-commits] core.git: 4 commits - comphelper/source i18npool/source include/comphelper include/svx svx/inc svx/source svx/uiconfig svx/UIConfig_svx.mk sw/inc sw/source

Caolán McNamara caolanm at redhat.com
Thu Apr 6 10:43:24 UTC 2017


 comphelper/source/streaming/seqstream.cxx           |   14 ++-
 i18npool/source/breakiterator/breakiteratorImpl.cxx |    2 
 include/comphelper/seqstream.hxx                    |    4 
 include/svx/dialogs.hrc                             |    3 
 svx/UIConfig_svx.mk                                 |    1 
 svx/inc/helpid.hrc                                  |    8 -
 svx/source/stbctrls/stbctrls.h                      |   10 --
 svx/source/stbctrls/stbctrls.src                    |   57 ------------
 svx/source/stbctrls/zoomctrl.cxx                    |   92 ++++++++++----------
 svx/uiconfig/ui/zoommenu.ui                         |   73 +++++++++++++++
 sw/inc/globals.hrc                                  |    2 
 sw/source/uibase/utlui/navipi.src                   |    8 +
 12 files changed, 147 insertions(+), 127 deletions(-)

New commits:
commit 15c8a54cc9a875a17bed23a383fcd3d7742a1fca
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Apr 5 16:20:35 2017 +0100

    convert zoom menu to .ui
    
    Change-Id: I4163042773f0f38e3372527d0a77a1b370bcafe9

diff --git a/include/svx/dialogs.hrc b/include/svx/dialogs.hrc
index af5ee763eeab..5f98695ecace 100644
--- a/include/svx/dialogs.hrc
+++ b/include/svx/dialogs.hrc
@@ -140,9 +140,6 @@
 #define RID_SVXFLOAT3D_FIX_G                (RID_SVX_START + 78)
 #define RID_SVXFLOAT3D_FIX_B                (RID_SVX_START + 84)
 
-// ResId for zoom popup menu
-#define RID_SVXMNU_ZOOM                     (RID_SVX_START +  82)
-
 // ResId for funktion popup menue
 #define RID_SVXMNU_PSZ_FUNC                 (RID_SVX_START +  83)
 
diff --git a/svx/UIConfig_svx.mk b/svx/UIConfig_svx.mk
index ae2f419b73b1..e073234f3540 100644
--- a/svx/UIConfig_svx.mk
+++ b/svx/UIConfig_svx.mk
@@ -81,6 +81,7 @@ $(eval $(call gb_UIConfig_add_uifiles,svx,\
 	svx/uiconfig/ui/textunderlinecontrol \
 	svx/uiconfig/ui/xmlsecstatmenu \
 	svx/uiconfig/ui/xformspage \
+	svx/uiconfig/ui/zoommenu \
 ))
 
 # vim: set noet sw=4 ts=4:
diff --git a/svx/inc/helpid.hrc b/svx/inc/helpid.hrc
index 6ebd60d993ce..1844d102e9bb 100644
--- a/svx/inc/helpid.hrc
+++ b/svx/inc/helpid.hrc
@@ -53,14 +53,6 @@
 #define HID_MNU_FUNC_NONE                                     "SVX_HID_MNU_FUNC_NONE"
 #define HID_MNU_FUNC_SUM                                      "SVX_HID_MNU_FUNC_SUM"
 #define HID_MNU_FUNC_SELECTION_COUNT                          "SVX_HID_MNU_FUNC_SELECTION_COUNT"
-#define HID_MNU_ZOOM_100                                      "SVX_HID_MNU_ZOOM_100"
-#define HID_MNU_ZOOM_150                                      "SVX_HID_MNU_ZOOM_150"
-#define HID_MNU_ZOOM_200                                      "SVX_HID_MNU_ZOOM_200"
-#define HID_MNU_ZOOM_50                                       "SVX_HID_MNU_ZOOM_50"
-#define HID_MNU_ZOOM_75                                       "SVX_HID_MNU_ZOOM_75"
-#define HID_MNU_ZOOM_OPTIMAL                                  "SVX_HID_MNU_ZOOM_OPTIMAL"
-#define HID_MNU_ZOOM_PAGE_WIDTH                               "SVX_HID_MNU_ZOOM_PAGE_WIDTH"
-#define HID_MNU_ZOOM_WHOLE_PAGE                               "SVX_HID_MNU_ZOOM_WHOLE_PAGE"
 #define HID_POPUP_COLOR                                       "SVX_HID_POPUP_COLOR"
 #define HID_POPUP_COLOR_CTRL                                  "SVX_HID_POPUP_COLOR_CTRL"
 #define HID_POPUP_FRAME                                       "SVX_HID_POPUP_FRAME"
diff --git a/svx/source/stbctrls/stbctrls.h b/svx/source/stbctrls/stbctrls.h
index 316cab0eb458..77d4f7f0f2fd 100644
--- a/svx/source/stbctrls/stbctrls.h
+++ b/svx/source/stbctrls/stbctrls.h
@@ -19,16 +19,6 @@
 #ifndef INCLUDED_SVX_SOURCE_STBCTRLS_STBCTRLS_H
 #define INCLUDED_SVX_SOURCE_STBCTRLS_STBCTRLS_H
 
-#define ZOOM_200            1
-#define ZOOM_150            2
-#define ZOOM_100            3
-#define ZOOM_75             4
-#define ZOOM_50             5
-
-#define ZOOM_OPTIMAL        6
-#define ZOOM_PAGE_WIDTH     7
-#define ZOOM_WHOLE_PAGE     8
-
 // IDs as in SUBTOTAL_FUNC of Calc
 
 #define PSZ_FUNC_AVG                1
diff --git a/svx/source/stbctrls/stbctrls.src b/svx/source/stbctrls/stbctrls.src
index e8f9c072e1b4..e846cffc5e14 100644
--- a/svx/source/stbctrls/stbctrls.src
+++ b/svx/source/stbctrls/stbctrls.src
@@ -188,62 +188,7 @@ String RID_SIDEBAR_EMPTY_PANEL_TEXT
     Text [ en-US ] = "Properties for the task that you are performing are not available for the current selection" ;
 };
 
- // PopupMenu -------------------------------------------------------------
-Menu RID_SVXMNU_ZOOM
-{
-    ItemList =
-    {
-        MenuItem
-        {
-            Identifier = ZOOM_WHOLE_PAGE ;
-            HelpId = HID_MNU_ZOOM_WHOLE_PAGE ;
-            Text [ en-US ] = "Entire Page" ;
-        };
-        MenuItem
-        {
-            Identifier = ZOOM_PAGE_WIDTH ;
-            HelpId = HID_MNU_ZOOM_PAGE_WIDTH ;
-            Text [ en-US ] = "Page Width" ;
-        };
-        MenuItem
-        {
-            Identifier = ZOOM_OPTIMAL ;
-            HelpId = HID_MNU_ZOOM_OPTIMAL ;
-            Text [ en-US ] = "Optimal View" ;
-        };
-        MenuItem
-        {
-            Identifier = ZOOM_50 ;
-            HelpId = HID_MNU_ZOOM_50 ;
-            Text [ en-US ] = "50%" ;
-        };
-        MenuItem
-        {
-            Identifier = ZOOM_75 ;
-            HelpId = HID_MNU_ZOOM_75 ;
-            Text [ en-US ] = "75%" ;
-        };
-        MenuItem
-        {
-            Identifier = ZOOM_100 ;
-            HelpId = HID_MNU_ZOOM_100 ;
-            Text [ en-US ] = "100%" ;
-        };
-        MenuItem
-        {
-            Identifier = ZOOM_150 ;
-            HelpId = HID_MNU_ZOOM_150 ;
-            Text [ en-US ] = "150%" ;
-        };
-        MenuItem
-        {
-            Identifier = ZOOM_200 ;
-            HelpId = HID_MNU_ZOOM_200 ;
-            Text [ en-US ] = "200%" ;
-        };
-    };
-};
- // Choice of functions on the SvxPosSizeStatusBarControl for Calc
+// Choice of functions on the SvxPosSizeStatusBarControl for Calc
 Menu RID_SVXMNU_PSZ_FUNC
 {
     ItemList =
diff --git a/svx/source/stbctrls/zoomctrl.cxx b/svx/source/stbctrls/zoomctrl.cxx
index 384a0f9ed13e..e93740e9deb9 100644
--- a/svx/source/stbctrls/zoomctrl.cxx
+++ b/svx/source/stbctrls/zoomctrl.cxx
@@ -18,6 +18,7 @@
  */
 
 #include <i18nutil/unicode.hxx>
+#include <vcl/builder.hxx>
 #include <vcl/svapp.hxx>
 #include <vcl/status.hxx>
 #include <vcl/menu.hxx>
@@ -36,61 +37,63 @@
 
 SFX_IMPL_STATUSBAR_CONTROL(SvxZoomStatusBarControl,SvxZoomItem);
 
-class ZoomPopup_Impl : public PopupMenu
+class ZoomPopup_Impl
 {
 public:
     ZoomPopup_Impl( sal_uInt16 nZ, SvxZoomEnableFlags nValueSet );
 
-    sal_uInt16          GetZoom() const { return nZoom; }
-    sal_uInt16          GetCurId() const { return nCurId; }
+    sal_uInt16 GetZoom();
+    OString    GetCurItemIdent() const { return m_xMenu->GetCurItemIdent(); }
+
+    sal_uInt16 Execute(vcl::Window* pWindow, const Point& rPopupPos)
+    {
+        return m_xMenu->Execute(pWindow, rPopupPos);
+    }
 
 private:
+    VclBuilder          m_aBuilder;
+    VclPtr<PopupMenu>   m_xMenu;
     sal_uInt16          nZoom;
-    sal_uInt16          nCurId;
-
-    virtual void    Select() override;
 };
 
-
 ZoomPopup_Impl::ZoomPopup_Impl( sal_uInt16 nZ, SvxZoomEnableFlags nValueSet )
-    : PopupMenu(ResId(RID_SVXMNU_ZOOM, DIALOG_MGR()))
+    : m_aBuilder(nullptr, VclBuilderContainer::getUIRootDir(), "svx/ui/zoommenu.ui", "")
+    , m_xMenu(m_aBuilder.get_menu("menu"))
     , nZoom(nZ)
-    , nCurId(0)
 {
     if ( !(SvxZoomEnableFlags::N50 & nValueSet) )
-            EnableItem( ZOOM_50, false );
+        m_xMenu->EnableItem("50", false);
     if ( !(SvxZoomEnableFlags::N100 & nValueSet) )
-            EnableItem( ZOOM_100, false );
+        m_xMenu->EnableItem("100", false);
     if ( !(SvxZoomEnableFlags::N150 & nValueSet) )
-            EnableItem( ZOOM_150, false );
+        m_xMenu->EnableItem("150", false);
     if ( !(SvxZoomEnableFlags::N200 & nValueSet) )
-            EnableItem( ZOOM_200, false );
+        m_xMenu->EnableItem("200", false);
     if ( !(SvxZoomEnableFlags::OPTIMAL & nValueSet) )
-            EnableItem( ZOOM_OPTIMAL, false );
+        m_xMenu->EnableItem("optimal", false);
     if ( !(SvxZoomEnableFlags::WHOLEPAGE & nValueSet) )
-            EnableItem( ZOOM_WHOLE_PAGE, false );
+        m_xMenu->EnableItem("page", false);
     if ( !(SvxZoomEnableFlags::PAGEWIDTH & nValueSet) )
-            EnableItem( ZOOM_PAGE_WIDTH, false );
+        m_xMenu->EnableItem("width", false);
 }
 
-
-void ZoomPopup_Impl::Select()
+sal_uInt16 ZoomPopup_Impl::GetZoom()
 {
-    nCurId = GetCurItemId();
-
-    switch ( nCurId )
-    {
-        case ZOOM_200:          nZoom = 200; break;
-        case ZOOM_150:          nZoom = 150; break;
-        case ZOOM_100:          nZoom = 100; break;
-        case ZOOM_75:           nZoom =  75; break;
-        case ZOOM_50:           nZoom =  50; break;
-
-        case ZOOM_OPTIMAL:
-        case ZOOM_PAGE_WIDTH:
-        case ZOOM_WHOLE_PAGE:   nZoom = 0; break;
-
-    }
+    OString sIdent = GetCurItemIdent();
+    if (sIdent == "200")
+        nZoom = 200;
+    else if (sIdent == "150")
+        nZoom = 150;
+    else if (sIdent == "100")
+        nZoom = 100;
+    else if (sIdent == "75")
+        nZoom =  75;
+    else if (sIdent == "50")
+        nZoom =  50;
+    else if (sIdent == "optimal" || sIdent == "width" || sIdent == "page")
+        nZoom = 0;
+
+    return nZoom;
 }
 
 SvxZoomStatusBarControl::SvxZoomStatusBarControl( sal_uInt16 _nSlotId,
@@ -142,20 +145,21 @@ void SvxZoomStatusBarControl::Command( const CommandEvent& rCEvt )
 {
     if ( CommandEventId::ContextMenu == rCEvt.GetCommand() && bool(nValueSet) )
     {
-        ScopedVclPtrInstance<ZoomPopup_Impl> aPop( nZoom, nValueSet );
+        ZoomPopup_Impl aPop(nZoom, nValueSet);
         StatusBar& rStatusbar = GetStatusBar();
 
-        if ( aPop->Execute( &rStatusbar, rCEvt.GetMousePosPixel() ) && ( nZoom != aPop->GetZoom() || !nZoom ) )
+        if (aPop.Execute(&rStatusbar, rCEvt.GetMousePosPixel()) && (nZoom != aPop.GetZoom() || !nZoom))
         {
-            nZoom = aPop->GetZoom();
-            SvxZoomItem aZoom( SvxZoomType::PERCENT, nZoom, GetId() );
-
-            switch( aPop->GetCurId() )
-            {
-            case ZOOM_OPTIMAL:      aZoom.SetType( SvxZoomType::OPTIMAL ); break;
-            case ZOOM_PAGE_WIDTH:   aZoom.SetType( SvxZoomType::PAGEWIDTH ); break;
-            case ZOOM_WHOLE_PAGE:   aZoom.SetType( SvxZoomType::WHOLEPAGE ); break;
-            }
+            nZoom = aPop.GetZoom();
+            SvxZoomItem aZoom(SvxZoomType::PERCENT, nZoom, GetId());
+
+            OString sIdent = aPop.GetCurItemIdent();
+            if (sIdent == "optimal")
+                aZoom.SetType(SvxZoomType::OPTIMAL);
+            else if (sIdent == "width")
+                aZoom.SetType(SvxZoomType::PAGEWIDTH);
+            else if (sIdent == "page")
+                aZoom.SetType(SvxZoomType::WHOLEPAGE);
 
             css::uno::Any a;
             INetURLObject aObj( m_aCommandURL );
diff --git a/svx/uiconfig/ui/zoommenu.ui b/svx/uiconfig/ui/zoommenu.ui
new file mode 100644
index 000000000000..3cc2c6c95beb
--- /dev/null
+++ b/svx/uiconfig/ui/zoommenu.ui
@@ -0,0 +1,73 @@
+<?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="page">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">Entire Page</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="width">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">Page Width</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="optimal">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">Optimal View</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="50">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">50%</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="75">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">75%</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="100">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">100%</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="150">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">150%</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="200">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">200%</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+  </object>
+</interface>
commit e576278e16644a1478c9a90116ef4e383e54696c
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Apr 6 11:36:19 2017 +0100

    reinstate removed but inuse resources
    
    since...
    
    commit 6742500ccb2ff6d39f527760152d2b08fd9cfe17
    Date:   Wed Mar 15 13:16:37 2017 +0200
    
        remove unused defines from HRC files in sw/
    
    Change-Id: Ie9cb54ba854ef04deaf9857468b3dbb171eb9b5a

diff --git a/sw/inc/globals.hrc b/sw/inc/globals.hrc
index 2eb78e46843e..748cd8b811c1 100644
--- a/sw/inc/globals.hrc
+++ b/sw/inc/globals.hrc
@@ -123,6 +123,8 @@
 #define STR_OUTLINE_LEVEL            (STR_CONTEXT_FIRST + 0)
 #define STR_DRAGMODE                 (STR_CONTEXT_FIRST + 1)
 #define STR_HYPERLINK                (STR_CONTEXT_FIRST + 2)
+#define STR_LINK_REGION              (STR_CONTEXT_FIRST + 3)
+#define STR_COPY_REGION              (STR_CONTEXT_FIRST + 4)
 #define STR_DISPLAY                  (STR_CONTEXT_FIRST + 5)
 #define STR_ACTIVE_VIEW              (STR_CONTEXT_FIRST + 6)
 #define STR_STATUS_FIRST             (RC_GLOBALS_BEGIN + 59)
diff --git a/sw/source/uibase/utlui/navipi.src b/sw/source/uibase/utlui/navipi.src
index 0da7b7b8d157..f4473ef36442 100644
--- a/sw/source/uibase/utlui/navipi.src
+++ b/sw/source/uibase/utlui/navipi.src
@@ -118,6 +118,14 @@ String STR_HYPERLINK
 {
     Text [ en-US ] = "Insert as Hyperlink" ;
 };
+String STR_LINK_REGION
+{
+    Text [ en-US ] = "Insert as Link" ;
+};
+String STR_COPY_REGION
+{
+    Text [ en-US ] = "Insert as Copy" ;
+};
 String STR_DISPLAY
 {
     Text [ en-US ] = "Display" ;
commit 485242225388b5d6c559b56c654e816e91af34e7
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Apr 5 10:04:13 2017 +0100

    split closeOutput up
    
    Change-Id: Id6408fa804e1049ceab012ec0220d8e6f8d8e555

diff --git a/comphelper/source/streaming/seqstream.cxx b/comphelper/source/streaming/seqstream.cxx
index b375f7c6d6be..f1e397d13770 100644
--- a/comphelper/source/streaming/seqstream.cxx
+++ b/comphelper/source/streaming/seqstream.cxx
@@ -199,12 +199,9 @@ void SAL_CALL OSequenceOutputStream::flush(  )
     m_rSequence.realloc(m_nSize);
 }
 
-
-void SAL_CALL OSequenceOutputStream::closeOutput(  )
+void OSequenceOutputStream::finalizeOutput()
 {
     MutexGuard aGuard(m_aMutex);
-    if (!m_bConnected)
-        throw NotConnectedException();
 
     // cut the sequence to the real size
     m_rSequence.realloc(m_nSize);
@@ -212,6 +209,15 @@ void SAL_CALL OSequenceOutputStream::closeOutput(  )
     m_bConnected = false;
 }
 
+void SAL_CALL OSequenceOutputStream::closeOutput()
+{
+    MutexGuard aGuard(m_aMutex);
+    if (!m_bConnected)
+        throw NotConnectedException();
+
+    finalizeOutput();
+}
+
 } // namespace comphelper
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/seqstream.hxx b/include/comphelper/seqstream.hxx
index 794a56837c78..ae7502f776e4 100644
--- a/include/comphelper/seqstream.hxx
+++ b/include/comphelper/seqstream.hxx
@@ -71,6 +71,8 @@ class SAL_DLLPUBLIC_TEMPLATE OSequenceOutputStream_Base
 
 class COMPHELPER_DLLPUBLIC OSequenceOutputStream : public OSequenceOutputStream_Base
 {
+private:
+    void finalizeOutput();
 protected:
     css::uno::Sequence< sal_Int8 >&                 m_rSequence;
     double                                          m_nResizeFactor;
@@ -85,7 +87,7 @@ protected:
     ::osl::Mutex                                    m_aMutex;
 
 protected:
-    virtual ~OSequenceOutputStream() override { if (m_bConnected) closeOutput(); }
+    virtual ~OSequenceOutputStream() override { if (m_bConnected) finalizeOutput(); }
 
 public:
     /** constructs the object. Everything written into the stream through the XOutputStream methods will be forwarded
commit 65753b9713ae798804da078dd4e9ed3e478e5264
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Apr 6 09:29:39 2017 +0100

    scriptclass for codepoint 0 is WEAK
    
    getScriptClass returns the cached nRet if new char equals old char
    old char is initialized to 0, so nRet should be initialized to
    the script class 0 would map to, which is WEAK (1), not 0
    
    Change-Id: I30a8388d7c91e786c88deee781a7e2f80f219207

diff --git a/i18npool/source/breakiterator/breakiteratorImpl.cxx b/i18npool/source/breakiterator/breakiteratorImpl.cxx
index 25e3f367ac98..2c4971562a7b 100644
--- a/i18npool/source/breakiterator/breakiteratorImpl.cxx
+++ b/i18npool/source/breakiterator/breakiteratorImpl.cxx
@@ -509,7 +509,7 @@ bool getCompatibilityScriptClassByBlock(sal_uInt32 currentChar, sal_Int16 &rScri
 sal_Int16  BreakIteratorImpl::getScriptClass(sal_uInt32 currentChar)
 {
     static sal_uInt32 lastChar = 0;
-    static sal_Int16 nRet = 0;
+    static sal_Int16 nRet = ScriptType::WEAK;
 
     if (currentChar != lastChar)
     {


More information about the Libreoffice-commits mailing list