[Libreoffice-commits] core.git: sw/source

Jochen Nitschke j.nitschke+logerrit at ok.de
Thu Oct 5 07:02:18 UTC 2017


 sw/source/ui/config/optpage.cxx |   28 ++++++++++++++++------------
 1 file changed, 16 insertions(+), 12 deletions(-)

New commits:
commit b93ae66b210f98c193263c4c1cd26d896bbf8e83
Author: Jochen Nitschke <j.nitschke+logerrit at ok.de>
Date:   Thu Sep 28 16:29:49 2017 +0200

    remove miss leading pool item assignments
    
    SfxPoolItems are not assignable, you have to Clone them.
    
    The assignments copied only the item values.
    In case of SwElemItem and SwDocDisplayItem those item fields were
    overriden in next steps.
    Member values of SwShadowCursorItem are used, so pass them to local
    variables.
    
    Assignment operators are still used in copy constructors, but will
    be removed soon.
    
    Change-Id: I9f493b580f09f6e921c228183212c4fde66adf2b
    Reviewed-on: https://gerrit.libreoffice.org/42939
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx
index 6692394ca951..0eafad8b80a3 100644
--- a/sw/source/ui/config/optpage.cxx
+++ b/sw/source/ui/config/optpage.cxx
@@ -248,8 +248,6 @@ bool SwContentOptPage::FillItemSet(SfxItemSet* rSet)
                         GetOldItem(GetItemSet(), FN_PARAM_ELEM));
 
     SwElemItem aElem;
-    if(pOldAttr)
-        aElem = *pOldAttr;
     aElem.bTable                = m_pTableCB->IsChecked();
     aElem.bGraphic              = m_pGrfCB->IsChecked();
     aElem.bDrawing              = m_pDrwCB->IsChecked();
@@ -1341,13 +1339,17 @@ SwShdwCursorOptionsTabPage::SwShdwCursorOptionsTabPage( vcl::Window* pParent,
     get(m_pMathBaselineAlignmentCB, "mathbaseline");
 
     const SfxPoolItem* pItem = nullptr;
+    sal_uInt8 eMode = SwFillMode::FILL_TAB;
+    bool bIsOn = false;
 
-    SwShadowCursorItem aOpt;
     if( SfxItemState::SET == rSet.GetItemState( FN_PARAM_SHADOWCURSOR, false, &pItem ))
-        aOpt = *static_cast<const SwShadowCursorItem*>(pItem);
-    m_pOnOffCB->Check( aOpt.IsOn() );
+    {
+        auto& aOpt = *static_cast<const SwShadowCursorItem*>(pItem);
+        eMode = aOpt.GetMode();
+        bIsOn = aOpt.IsOn();
+    }
+    m_pOnOffCB->Check( bIsOn );
 
-    sal_uInt8 eMode = aOpt.GetMode();
     m_pFillIndentRB->Check( FILL_INDENT == eMode );
     m_pFillMarginRB->Check( FILL_MARGIN == eMode );
     m_pFillTabRB->Check( FILL_TAB == eMode );
@@ -1459,8 +1461,6 @@ bool SwShdwCursorOptionsTabPage::FillItemSet( SfxItemSet* rSet )
                         GetOldItem(GetItemSet(), FN_PARAM_DOCDISP));
 
     SwDocDisplayItem aDisp;
-    if(pOldAttr)
-        aDisp = *pOldAttr;
 
     aDisp.bParagraphEnd         = m_pParaCB->IsChecked();
     aDisp.bTab                  = m_pTabCB->IsChecked();
@@ -1482,13 +1482,17 @@ bool SwShdwCursorOptionsTabPage::FillItemSet( SfxItemSet* rSet )
 void SwShdwCursorOptionsTabPage::Reset( const SfxItemSet* rSet )
 {
     const SfxPoolItem* pItem = nullptr;
+    sal_uInt8 eMode = SwFillMode::FILL_TAB;
+    bool bIsOn = false;
 
-    SwShadowCursorItem aOpt;
     if( SfxItemState::SET == rSet->GetItemState( FN_PARAM_SHADOWCURSOR, false, &pItem ))
-        aOpt = *static_cast<const SwShadowCursorItem*>(pItem);
-    m_pOnOffCB->Check( aOpt.IsOn() );
+    {
+        auto& aOpt = *static_cast<const SwShadowCursorItem*>(pItem);
+        eMode = aOpt.GetMode();
+        bIsOn = aOpt.IsOn();
+    }
+    m_pOnOffCB->Check( bIsOn );
 
-    sal_uInt8 eMode = aOpt.GetMode();
     m_pFillIndentRB->Check( FILL_INDENT == eMode );
     m_pFillMarginRB->Check( FILL_MARGIN == eMode );
     m_pFillTabRB->Check( FILL_TAB == eMode );


More information about the Libreoffice-commits mailing list