[Libreoffice-commits] core.git: Branch 'aoo/trunk' - sw/source

Oliver-Rainer Wittmann orw at apache.org
Fri Oct 11 03:07:54 PDT 2013


 sw/source/ui/config/optpage.cxx |   30 ++++++++++++++++++++++--------
 1 file changed, 22 insertions(+), 8 deletions(-)

New commits:
commit 7b0d095c47c6fc1b8675ad11c008dcca47bb567d
Author: Oliver-Rainer Wittmann <orw at apache.org>
Date:   Fri Oct 11 09:30:43 2013 +0000

    123462 - Writer's Formatting Aids option page - guard access to <SwWrtShell> instance as this is not available in Page Preview
    
    Found by: Matthieu Riolo <matthieu.riolo at adfinis-sygroup.ch>
    Review by: Matthieu Riolo <matthieu.riolo at adfinis-sygroup.ch>

diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx
index 53cb9ba..4fe17cf 100644
--- a/sw/source/ui/config/optpage.cxx
+++ b/sw/source/ui/config/optpage.cxx
@@ -1608,9 +1608,13 @@ sal_Bool SwShdwCrsrOptionsTabPage::FillItemSet( SfxItemSet& rSet )
         bRet = sal_True;
     }
 
-    m_pWrtShell->GetDoc()->set( IDocumentSettingAccess::MATH_BASELINE_ALIGNMENT,
+    if ( m_pWrtShell )
+    {
+        m_pWrtShell->GetDoc()->set(
+            IDocumentSettingAccess::MATH_BASELINE_ALIGNMENT,
             m_aMathBaselineAlignmentCB.IsChecked() );
-    bRet |= m_aMathBaselineAlignmentCB.IsChecked() != m_aMathBaselineAlignmentCB.GetSavedValue();
+        bRet |= m_aMathBaselineAlignmentCB.IsChecked() != m_aMathBaselineAlignmentCB.GetSavedValue();
+    }
 
     if( aCrsrInProtCB.IsChecked() != aCrsrInProtCB.GetSavedValue())
     {
@@ -1618,8 +1622,8 @@ sal_Bool SwShdwCrsrOptionsTabPage::FillItemSet( SfxItemSet& rSet )
         bRet |= sal_True;
     }
 
-    const SwDocDisplayItem* pOldAttr = (const SwDocDisplayItem*)
-                        GetOldItem(GetItemSet(), FN_PARAM_DOCDISP);
+    const SwDocDisplayItem* pOldAttr =
+        (const SwDocDisplayItem*)GetOldItem(GetItemSet(), FN_PARAM_DOCDISP);
 
     SwDocDisplayItem aDisp;
     if(pOldAttr)
@@ -1648,7 +1652,9 @@ void SwShdwCrsrOptionsTabPage::Reset( const SfxItemSet& rSet )
 
     SwShadowCursorItem aOpt;
     if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_SHADOWCURSOR, sal_False, &pItem ))
+    {
         aOpt = *(SwShadowCursorItem*)pItem;
+    }
     aOnOffCB.Check( aOpt.IsOn() );
 
     sal_uInt8 eMode = aOpt.GetMode();
@@ -1657,17 +1663,25 @@ 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.Disable();
+    }
 
     if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_CRSR_IN_PROTECTED, sal_False, &pItem ))
+    {
         aCrsrInProtCB.Check(((const SfxBoolItem*)pItem)->GetValue());
+    }
     aCrsrInProtCB.SaveValue();
 
     const SwDocDisplayItem* pDocDisplayAttr = 0;
 
-    rSet.GetItemState( FN_PARAM_DOCDISP, sal_False,
-                                    (const SfxPoolItem**)&pDocDisplayAttr );
+    rSet.GetItemState( FN_PARAM_DOCDISP, sal_False, (const SfxPoolItem**)&pDocDisplayAttr );
     if(pDocDisplayAttr)
     {
         aParaCB     .Check  (pDocDisplayAttr->bParagraphEnd         );


More information about the Libreoffice-commits mailing list