[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - include/svx svx/source

Maxim Monastirsky (via logerrit) logerrit at kemper.freedesktop.org
Tue Jul 14 19:54:02 UTC 2020


 include/svx/verttexttbxctrl.hxx         |    1 +
 svx/source/tbxctrls/verttexttbxctrl.cxx |   16 ++++++++++++++--
 2 files changed, 15 insertions(+), 2 deletions(-)

New commits:
commit ad6d723bb6e37e70702ea467072a1dc077293839
Author:     Maxim Monastirsky <momonasmon at gmail.com>
AuthorDate: Wed Jul 8 00:46:29 2020 +0300
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Tue Jul 14 21:53:22 2020 +0200

    tdf#134188 tdf#114223 Don't override vertical text button visibility
    
    i.e. restore the fix for tdf#33356, which was removed in commit
    eeb2d19e77d6dc47c68e8ba0920a02cf64a1247b ("Resolves: tdf#130159
    hide writedirection unless CTL is enabled"). But do it in a way
    that doesn't introduce tdf#114223 (a regression of tdf#33356).
    
    We can assume that the visibility state of the button at the
    point of control initialization is the one set with toolbar
    customization, as any customization triggers clearing of the
    whole toolbar, and reconstructing from scratch.
    
    Change-Id: I2cdf18e144dd6eb99b8c1e1da968beacddbb3728
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98317
    Tested-by: Jenkins
    Reviewed-by: Maxim Monastirsky <momonasmon at gmail.com>
    (cherry picked from commit d3a98b87824f2e2248a45b97d7eef5e8ad596dd3)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98760
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>

diff --git a/include/svx/verttexttbxctrl.hxx b/include/svx/verttexttbxctrl.hxx
index d283919f6bf8..6dc437ec383a 100644
--- a/include/svx/verttexttbxctrl.hxx
+++ b/include/svx/verttexttbxctrl.hxx
@@ -38,6 +38,7 @@ class SAL_DLLPUBLIC_TEMPLATE SvxVertCTLTextTbxCtrl_Base:
  */
 class SvxVertCTLTextTbxCtrl : public SvxVertCTLTextTbxCtrl_Base
 {
+    bool m_bVisible;
 public:
     explicit SvxVertCTLTextTbxCtrl(const css::uno::Reference<css::uno::XComponentContext>& rContext);
 
diff --git a/svx/source/tbxctrls/verttexttbxctrl.cxx b/svx/source/tbxctrls/verttexttbxctrl.cxx
index 02e245d3fa85..18d6b2b8b4e6 100644
--- a/svx/source/tbxctrls/verttexttbxctrl.cxx
+++ b/svx/source/tbxctrls/verttexttbxctrl.cxx
@@ -64,6 +64,7 @@ com_sun_star_comp_svx_VertTextToolBoxControl_get_implementation(
 
 SvxVertCTLTextTbxCtrl::SvxVertCTLTextTbxCtrl(const css::uno::Reference<css::uno::XComponentContext>& rContext)
     : SvxVertCTLTextTbxCtrl_Base(rContext, nullptr, OUString())
+    , m_bVisible(false)
 {
 }
 
@@ -76,6 +77,17 @@ void SAL_CALL SvxVertCTLTextTbxCtrl::initialize(const css::uno::Sequence<css::un
     SvxVertCTLTextTbxCtrl_Base::initialize(rArguments);
     // fdo#83320 Hide vertical text commands early
     setFastPropertyValue_NoBroadcast(1, css::uno::makeAny(true));
+
+    if (m_pToolbar)
+    {
+        m_bVisible = m_pToolbar->get_item_visible(m_aCommandURL.toUtf8());
+        return;
+    }
+
+    ToolBox* pToolBox = nullptr;
+    sal_uInt16 nItemId = 0;
+    getToolboxId(nItemId, &pToolBox);
+    m_bVisible = pToolBox && pToolBox->IsItemVisible(nItemId);
 }
 
 void SAL_CALL SvxVertCTLTextTbxCtrl::statusChanged(const css::frame::FeatureStateEvent& rEvent)
@@ -88,12 +100,12 @@ void SAL_CALL SvxVertCTLTextTbxCtrl::statusChanged(const css::frame::FeatureStat
     if (rEvent.FeatureURL.Complete == ".uno:VerticalTextState")
     {
         SvtLanguageOptions aLangOptions;
-        bEnabled = aLangOptions.IsVerticalTextEnabled();
+        bEnabled = m_bVisible && aLangOptions.IsVerticalTextEnabled();
     }
     else if (rEvent.FeatureURL.Complete == ".uno:CTLFontState")
     {
         SvtLanguageOptions aLangOptions;
-        bEnabled = aLangOptions.IsCTLFontEnabled();
+        bEnabled = m_bVisible && aLangOptions.IsCTLFontEnabled();
     }
     else
     {


More information about the Libreoffice-commits mailing list