Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


Hi all,

A newly-reported fdo#40341
https://bugs.freedesktop.org/show_bug.cgi?id=40341
looks like a simple SEGV with a null pointer, which can be fixed by
the attached patch.
It also contains code hiding a checkbox for "Math baseline alignment"
in "Formatting Aids" if its current value is unavailable, like in
this case of 'Page Preview' mode.
Is it permissible? Any better way?

Cheers,
-- Takeshi Abe
From fcf6d59e11404d270246ff0efecef0340e9ef67b Mon Sep 17 00:00:00 2001
From: Takeshi Abe <tabe@fixedpoint.jp>
Date: Wed, 24 Aug 2011 18:41:01 +0900
Subject: [PATCH] fdo#40341: hide 'math baseline alignment' unless available

---
 sw/source/ui/config/optpage.cxx |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx
index f44c8db..331863f 100644
--- a/sw/source/ui/config/optpage.cxx
+++ b/sw/source/ui/config/optpage.cxx
@@ -1456,9 +1456,11 @@ sal_Bool SwShdwCrsrOptionsTabPage::FillItemSet( SfxItemSet& rSet )
         bRet = sal_True;
     }
 
-    m_pWrtShell->GetDoc()->set( IDocumentSettingAccess::MATH_BASELINE_ALIGNMENT,
-            m_aMathBaselineAlignmentCB.IsChecked() );
-    bRet |= m_aMathBaselineAlignmentCB.IsChecked() != m_aMathBaselineAlignmentCB.GetSavedValue();
+    if (m_pWrtShell) {
+        m_pWrtShell->GetDoc()->set( IDocumentSettingAccess::MATH_BASELINE_ALIGNMENT,
+                                    m_aMathBaselineAlignmentCB.IsChecked() );
+        bRet |= m_aMathBaselineAlignmentCB.IsChecked() != 
m_aMathBaselineAlignmentCB.GetSavedValue();
+    }
 
     if( aCrsrInProtCB.IsChecked() != aCrsrInProtCB.GetSavedValue())
     {
@@ -1505,8 +1507,12 @@ void SwShdwCrsrOptionsTabPage::Reset( const SfxItemSet& rSet )
     aFillTabRB.Check( FILL_TAB == eMode );
     aFillSpaceRB.Check( FILL_SPACE == eMode );
 
-    m_aMathBaselineAlignmentCB.Check( m_pWrtShell->GetDoc()->get( 
IDocumentSettingAccess::MATH_BASELINE_ALIGNMENT ) );
-    m_aMathBaselineAlignmentCB.SaveValue();
+    if (m_pWrtShell) {
+        m_aMathBaselineAlignmentCB.Check( m_pWrtShell->GetDoc()->get( 
IDocumentSettingAccess::MATH_BASELINE_ALIGNMENT ) );
+        m_aMathBaselineAlignmentCB.SaveValue();
+    } else {
+        m_aMathBaselineAlignmentCB.Hide();
+    }
 
     if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_CRSR_IN_PROTECTED, sal_False, &pItem ))
         aCrsrInProtCB.Check(((const SfxBoolItem*)pItem)->GetValue());
-- 
1.7.6


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.