[Libreoffice-commits] core.git: include/svx svx/source

Maxim Monastirsky (via logerrit) logerrit at kemper.freedesktop.org
Wed Jul 8 09:04:48 UTC 2020


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

New commits:
commit d3a98b87824f2e2248a45b97d7eef5e8ad596dd3
Author:     Maxim Monastirsky <momonasmon at gmail.com>
AuthorDate: Wed Jul 8 00:46:29 2020 +0300
Commit:     Maxim Monastirsky <momonasmon at gmail.com>
CommitDate: Wed Jul 8 11:04:04 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>

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