sw/source/ui/config/optcomp.cxx |   26 ++++++++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)

New commits:
commit 1ac1fdbe5bb3139c81a331beb16c79e84d7c4f27
Author:     Tamás Zolnai <tamas.zol...@collabora.com>
AuthorDate: Sat Apr 6 13:25:27 2019 +0200
Commit:     Tamás Zolnai <tamas.zol...@collabora.com>
CommitDate: Sat Apr 6 18:41:30 2019 +0200

    respect read-only config item: MSCompatibleFormsMenu
    
    Change-Id: I4eacbe8ad2025a54c13f4c0fa06e30e5ab59b721
    Reviewed-on: https://gerrit.libreoffice.org/70344
    Tested-by: Jenkins
    Reviewed-by: Tamás Zolnai <tamas.zol...@collabora.com>

diff --git a/sw/source/ui/config/optcomp.cxx b/sw/source/ui/config/optcomp.cxx
index 0eebed82220d..1f49688d6249 100644
--- a/sw/source/ui/config/optcomp.cxx
+++ b/sw/source/ui/config/optcomp.cxx
@@ -37,6 +37,8 @@
 #include <vector>
 #include <svtools/restartdialog.hxx>
 #include <comphelper/processfactory.hxx>
+#include <officecfg/Office/Compatibility.hxx>
+#include <vcl/svlbitm.hxx>
 
 using namespace ::com::sun::star::beans;
 using namespace ::com::sun::star::document;
@@ -82,11 +84,31 @@ SwCompatibilityOptPage::SwCompatibilityOptPage(vcl::Window* 
pParent, const SfxIt
     m_pOptionsLB->SetStyle( m_pOptionsLB->GetStyle() | WB_HSCROLL | 
WB_HIDESELECTION );
     m_pOptionsLB->SetHighlightRange();
 
-    SvTreeListEntry* pEntry = m_pGlobalOptionsCLB->SvTreeListBox::InsertEntry( 
m_pGlobalOptionsLB->GetEntry( 0 ) );
+
+    // Set MSOCompatibleFormsMenu entry attributes
+    const bool bReadOnly = 
officecfg::Office::Compatibility::View::MSCompatibleFormsMenu::isReadOnly();
+    const bool bChecked = m_aViewConfigItem.HasMSOCompatibleFormsMenu();
+
+    SvTreeListEntry* pEntry;
+    if(bReadOnly)
+    {
+        pEntry = m_pGlobalOptionsCLB->SvTreeListBox::InsertEntry( 
m_pGlobalOptionsLB->GetEntry( 0 ), nullptr, false,
+                                                                  
TREELIST_APPEND, nullptr, SvLBoxButtonKind::DisabledCheckbox);
+    }
+    else
+    {
+        pEntry = m_pGlobalOptionsCLB->SvTreeListBox::InsertEntry( 
m_pGlobalOptionsLB->GetEntry( 0 ) );
+    }
+
     if ( pEntry )
     {
-        m_pGlobalOptionsCLB->SetCheckButtonState( pEntry, 
SvButtonState::Unchecked );
+        SvLBoxButton* pButton = 
static_cast<SvLBoxButton*>(pEntry->GetFirstItem(SvLBoxItemType::Button));
+        if(bChecked)
+            pButton->SetStateChecked();
+        else
+            pButton->SetStateUnchecked();
     }
+
     m_pGlobalOptionsLB->Clear();
 
     m_pGlobalOptionsCLB->SetStyle( m_pGlobalOptionsCLB->GetStyle() | 
WB_HSCROLL | WB_HIDESELECTION );
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to