cui/source/options/optgdlg.cxx                             |    5 +
 cui/source/tabpages/page.cxx                               |    3 
 include/svl/ctloptions.hxx                                 |    6 +
 officecfg/registry/data/org/openoffice/Office/Common.xcu   |    3 
 officecfg/registry/schema/org/openoffice/Office/Common.xcs |    8 ++
 svl/source/config/ctloptions.cxx                           |   41 ++++++++++++-
 6 files changed, 63 insertions(+), 3 deletions(-)

New commits:
commit 1412f0235405e71aaa327596e3db71ffa999e122
Author:     Jonathan Clark <[email protected]>
AuthorDate: Wed Jan 22 07:41:16 2025 -0700
Commit:     Jonathan Clark <[email protected]>
CommitDate: Wed Jan 22 22:18:01 2025 +0100

    tdf#163228 Enable vertical text options for Mongolian script
    
    Previously, vertical text direction options were enabled if and only if
    CJK language support is enabled. This change extends the logic to also
    enable vertical text direction options if the CTL language is set to
    Mongolian Mongolian.
    
    Change-Id: I4e3738b4dea755c26c786cc233aff8786146e90b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180604
    Tested-by: Jenkins
    Reviewed-by: Jonathan Clark <[email protected]>

diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx
index 94f87bcc3dcd..47e125e2d1a0 100644
--- a/cui/source/options/optgdlg.cxx
+++ b/cui/source/options/optgdlg.cxx
@@ -1544,6 +1544,11 @@ bool OfaLanguagesTabPage::FillItemSet( SfxItemSet* rSet )
             
rSet->Put(SvxLanguageItem(MsLangId::resolveSystemLanguageByScriptType(eSelectLang,
 css::i18n::ScriptType::COMPLEX),
                 SID_ATTR_CHAR_CTL_LANGUAGE));
         }
+
+        // tdf#163228: Mongolian script supports vertical text
+        pLangConfig->aCTLLanguageOptions.SetCTLVerticalText(
+            MsLangId::getPrimaryLanguage(eSelectLang)
+            == 
MsLangId::getPrimaryLanguage(LANGUAGE_MONGOLIAN_MONGOLIAN_MONGOLIA));
     }
 
     if(m_xAsianSupportCB->get_state_changed_from_saved() )
diff --git a/cui/source/tabpages/page.cxx b/cui/source/tabpages/page.cxx
index 3f13a6bf6324..39fb9a7bcd6d 100644
--- a/cui/source/tabpages/page.cxx
+++ b/cui/source/tabpages/page.cxx
@@ -193,6 +193,7 @@ SvxPageDescPage::SvxPageDescPage(weld::Container* pPage, 
weld::DialogController*
 
     bool bCJK = SvtCJKOptions::IsAsianTypographyEnabled();
     bool bCTL = SvtCTLOptions::IsCTLFontEnabled();
+    bool bVertCTL = bCTL && SvtCTLOptions::IsCTLVerticalText();
     bool bWeb = false;
 
     const SfxUInt16Item* pHtmlModeItem = rAttr.GetItemIfSet(SID_HTML_MODE, 
false);
@@ -213,7 +214,7 @@ SvxPageDescPage::SvxPageDescPage(weld::Container* pPage, 
weld::DialogController*
 
 
     // #109989# do not show vertical directions in Writer/Web
-    if( !bWeb && bCJK )
+    if (!bWeb && (bCJK || bVertCTL))
     {
         m_xTextFlowBox->append(SvxFrameDirection::Vertical_RL_TB, 
SvxResId(RID_SVXSTR_PAGEDIR_RTL_VERT));
         m_xTextFlowBox->append(SvxFrameDirection::Vertical_LR_TB, 
SvxResId(RID_SVXSTR_PAGEDIR_LTR_VERT));
diff --git a/include/svl/ctloptions.hxx b/include/svl/ctloptions.hxx
index fe3432658929..06ada1b14854 100644
--- a/include/svl/ctloptions.hxx
+++ b/include/svl/ctloptions.hxx
@@ -41,6 +41,9 @@ public:
     void        SetCTLFontEnabled( bool _bEnabled );
     static bool IsCTLFontEnabled();
 
+    void SetCTLVerticalText(bool bVertical);
+    static bool IsCTLVerticalText();
+
     void        SetCTLSequenceChecking( bool _bEnabled );
     static bool IsCTLSequenceChecking();
 
@@ -75,7 +78,8 @@ public:
         E_CTLCURSORMOVEMENT,
         E_CTLTEXTNUMERALS,
         E_CTLSEQUENCECHECKINGRESTRICTED,
-        E_CTLSEQUENCECHECKINGTYPEANDREPLACE
+        E_CTLSEQUENCECHECKINGTYPEANDREPLACE,
+        E_CTLVERTICALTEXT
     };
     bool IsReadOnly(EOption eOption) const;
 };
diff --git a/officecfg/registry/data/org/openoffice/Office/Common.xcu 
b/officecfg/registry/data/org/openoffice/Office/Common.xcu
index 48faa40b5549..54cd6c148d83 100644
--- a/officecfg/registry/data/org/openoffice/Office/Common.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/Common.xcu
@@ -55,6 +55,9 @@
       <prop oor:name="CTLFont" install:module="ctl">
         <value>true</value>
       </prop>
+      <prop oor:name="CTLVerticalText" install:module="ctl">
+        <value>true</value>
+      </prop>
       <prop oor:name="CTLSequenceChecking" install:module="ctlseqcheck">
         <value>true</value>
       </prop>
diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs 
b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
index 2b309219bf10..61dba68ab1af 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
@@ -6651,6 +6651,14 @@
           </info>
           <value>false</value>
         </prop>
+        <prop oor:name="CTLVerticalText" oor:type="xs:boolean" 
oor:nillable="false">
+          <!-- UIHints: setup -->
+          <info>
+            <desc>Specifies whether vertical text settings are available (true)
+            or not (false).</desc>
+          </info>
+          <value>false</value>
+        </prop>
         <prop oor:name="CTLSequenceChecking" oor:type="xs:boolean" 
oor:nillable="false">
           <!-- UIHints: setup -->
           <info>
diff --git a/svl/source/config/ctloptions.cxx b/svl/source/config/ctloptions.cxx
index 9f151bcb01cb..21418e80072c 100644
--- a/svl/source/config/ctloptions.cxx
+++ b/svl/source/config/ctloptions.cxx
@@ -38,6 +38,7 @@ class SvtCTLOptions_Impl : public utl::ConfigItem
 private:
     bool                        m_bIsLoaded;
     bool                        m_bCTLFontEnabled;
+    bool m_bCTLVerticalText;
     bool                        m_bCTLSequenceChecking;
     bool                        m_bCTLRestricted;
     bool                        m_bCTLTypeAndReplace;
@@ -45,6 +46,7 @@ private:
     SvtCTLOptions::TextNumerals     m_eCTLTextNumerals;
 
     bool                        m_bROCTLFontEnabled;
+    bool m_bROCTLVerticalText;
     bool                        m_bROCTLSequenceChecking;
     bool                        m_bROCTLRestricted;
     bool                        m_bROCTLTypeAndReplace;
@@ -63,6 +65,8 @@ public:
     bool            IsLoaded() const { return m_bIsLoaded; }
     void            SetCTLFontEnabled( bool _bEnabled );
 
+    void SetCTLVerticalText(bool bVertical);
+
     void            SetCTLSequenceChecking( bool _bEnabled );
 
     void            SetCTLSequenceCheckingRestricted( bool _bEnable );
@@ -94,6 +98,7 @@ bool SvtCTLOptions_Impl::IsReadOnly(SvtCTLOptions::EOption 
eOption) const
         case SvtCTLOptions::E_CTLTEXTNUMERALS     : bReadOnly = 
m_bROCTLTextNumerals      ; break;
         case SvtCTLOptions::E_CTLSEQUENCECHECKINGRESTRICTED: bReadOnly = 
m_bROCTLRestricted  ; break;
         case SvtCTLOptions::E_CTLSEQUENCECHECKINGTYPEANDREPLACE: bReadOnly = 
m_bROCTLTypeAndReplace; break;
+        case SvtCTLOptions::E_CTLVERTICALTEXT : bReadOnly = 
m_bROCTLVerticalText ; break;
         default: assert(false);
     }
     return bReadOnly;
@@ -104,6 +109,7 @@ SvtCTLOptions_Impl::SvtCTLOptions_Impl() :
 
     m_bIsLoaded             ( false ),
     m_bCTLFontEnabled       ( true ),
+    m_bCTLVerticalText      ( true ),
     m_bCTLSequenceChecking  ( false ),
     m_bCTLRestricted        ( false ),
     m_bCTLTypeAndReplace    ( false ),
@@ -111,6 +117,7 @@ SvtCTLOptions_Impl::SvtCTLOptions_Impl() :
     m_eCTLTextNumerals      ( SvtCTLOptions::NUMERALS_ARABIC ),
 
     m_bROCTLFontEnabled     ( CFG_READONLY_DEFAULT ),
+    m_bROCTLVerticalText    ( CFG_READONLY_DEFAULT ),
     m_bROCTLSequenceChecking( CFG_READONLY_DEFAULT ),
     m_bROCTLRestricted      ( CFG_READONLY_DEFAULT ),
     m_bROCTLTypeAndReplace  ( CFG_READONLY_DEFAULT ),
@@ -210,6 +217,16 @@ void SvtCTLOptions_Impl::ImplCommit()
                 }
             }
             break;
+            case 6:
+            {
+                if (!m_bROCTLVerticalText)
+                {
+                    pNames[nRealCount] = pOrgNames[nProp];
+                    pValues[nRealCount] <<= m_bCTLVerticalText;
+                    ++nRealCount;
+                }
+            }
+            break;
         }
     }
     aNames.realloc(nRealCount);
@@ -230,7 +247,8 @@ void SvtCTLOptions_Impl::Load()
             u"CTLCursorMovement"_ustr,
             u"CTLTextNumerals"_ustr,
             u"CTLSequenceCheckingRestricted"_ustr,
-            u"CTLSequenceCheckingTypeAndReplace"_ustr };
+            u"CTLSequenceCheckingTypeAndReplace"_ustr,
+            u"CTLVerticalText"_ustr};
         EnableNotification( rPropertyNames );
     }
     Sequence< Any > aValues = GetProperties( rPropertyNames );
@@ -256,6 +274,7 @@ void SvtCTLOptions_Impl::Load()
                         case 1: { m_bCTLSequenceChecking = bValue; 
m_bROCTLSequenceChecking = pROStates[nProp]; } break;
                         case 4: { m_bCTLRestricted = bValue; 
m_bROCTLRestricted = pROStates[nProp]; } break;
                         case 5: { m_bCTLTypeAndReplace = bValue; 
m_bROCTLTypeAndReplace = pROStates[nProp]; } break;
+                        case 6: { m_bCTLVerticalText = bValue; 
m_bROCTLVerticalText = pROStates[nProp]; } break;
                     }
                 }
                 else if ( pValues[nProp] >>= nValue )
@@ -281,6 +300,15 @@ void SvtCTLOptions_Impl::SetCTLFontEnabled( bool _bEnabled 
)
         NotifyListeners(ConfigurationHints::NONE);
     }
 }
+void SvtCTLOptions_Impl::SetCTLVerticalText(bool bVertical)
+{
+    if (!m_bROCTLVerticalText && m_bCTLVerticalText != bVertical)
+    {
+        m_bCTLVerticalText = bVertical;
+        SetModified();
+        NotifyListeners(ConfigurationHints::NONE);
+    }
+}
 void SvtCTLOptions_Impl::SetCTLSequenceChecking( bool _bEnabled )
 {
     if(!m_bROCTLSequenceChecking && m_bCTLSequenceChecking != _bEnabled)
@@ -379,6 +407,17 @@ bool SvtCTLOptions::IsCTLFontEnabled()
     return officecfg::Office::Common::I18N::CTL::CTLFont::get();
 }
 
+void SvtCTLOptions::SetCTLVerticalText(bool bVertical)
+{
+    assert(m_pImpl->IsLoaded());
+    m_pImpl->SetCTLVerticalText(bVertical);
+}
+
+bool SvtCTLOptions::IsCTLVerticalText()
+{
+    return officecfg::Office::Common::I18N::CTL::CTLVerticalText::get();
+}
+
 void SvtCTLOptions::SetCTLSequenceChecking( bool _bEnabled )
 {
     assert(m_pImpl->IsLoaded());

Reply via email to