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

Ashod Nakashian ashodnakashian at yahoo.com
Sat Nov 7 13:22:22 PST 2015


 sw/inc/anchoredobject.hxx               |   12 ++++----
 sw/inc/crstate.hxx                      |   10 +++----
 sw/inc/dbfld.hxx                        |    2 -
 sw/inc/dbmgr.hxx                        |    4 +-
 sw/inc/doc.hxx                          |    4 +-
 sw/inc/editsh.hxx                       |   14 +++++-----
 sw/inc/fesh.hxx                         |   10 +++----
 sw/inc/frmfmt.hxx                       |   10 +++----
 sw/source/core/inc/frame.hxx            |    8 +++--
 sw/source/core/inc/pagefrm.hxx          |    6 ++--
 sw/source/core/inc/swcache.hxx          |    2 -
 sw/source/core/layout/calcmove.cxx      |    2 -
 sw/source/core/layout/findfrm.cxx       |   12 ++++----
 sw/source/core/layout/layact.cxx        |    3 +-
 sw/source/core/layout/pagechg.cxx       |   44 ++++++++++++++------------------
 sw/source/core/layout/paintfrm.cxx      |    2 -
 sw/source/core/layout/wsfrm.cxx         |   17 ++++++------
 sw/source/uibase/docvw/PageBreakWin.cxx |   24 ++++++++---------
 sw/source/uibase/docvw/PostItMgr.cxx    |   24 ++++++++---------
 sw/source/uibase/docvw/SidebarWin.cxx   |   32 +++++++++++------------
 sw/source/uibase/shells/tabsh.cxx       |   24 ++++++++---------
 21 files changed, 133 insertions(+), 133 deletions(-)

New commits:
commit 04783fd91832fa01a5b096f395edd7ad4f9c0f6b
Author: Ashod Nakashian <ashodnakashian at yahoo.com>
Date:   Sat Oct 31 21:04:59 2015 -0400

    Misc tweaks and cleanups.
    
    Streamlined a couple of hotspots and some
    minor cleanups.
    
    Change-Id: I85a9423e03f7e20ce78736a44d668da859a443cd
    Reviewed-on: https://gerrit.libreoffice.org/19720
    Reviewed-by: Björn Michaelsen <bjoern.michaelsen at canonical.com>
    Tested-by: Björn Michaelsen <bjoern.michaelsen at canonical.com>

diff --git a/sw/inc/anchoredobject.hxx b/sw/inc/anchoredobject.hxx
index 31b596a..c02f0a2 100644
--- a/sw/inc/anchoredobject.hxx
+++ b/sw/inc/anchoredobject.hxx
@@ -214,12 +214,12 @@ class SW_DLLPUBLIC SwAnchoredObject
 
         // accessors to member <mpDrawObj>
         void SetDrawObj( SdrObject& _rDrawObj );
-        const SdrObject* GetDrawObj() const { return mpDrawObj;}
-        SdrObject* DrawObj() { return mpDrawObj;}
+        const SdrObject* GetDrawObj() const { return mpDrawObj; }
+        SdrObject* DrawObj() { return mpDrawObj; }
 
         // accessors to member <mpAnchorFrm>
-        const SwFrm* GetAnchorFrm() const { return mpAnchorFrm;}
-        SwFrm* AnchorFrm() { return mpAnchorFrm;}
+        const SwFrm* GetAnchorFrm() const { return mpAnchorFrm; }
+        SwFrm* AnchorFrm() { return mpAnchorFrm; }
         void ChgAnchorFrm( SwFrm* _pNewAnchorFrm );
         /** determine anchor frame containing the anchor position
 
@@ -232,8 +232,8 @@ class SW_DLLPUBLIC SwAnchoredObject
         */
         SwFrm* GetAnchorFrmContainingAnchPos();
 
-        SwPageFrm* GetPageFrm() { return mpPageFrm;}
-        const SwPageFrm* GetPageFrm() const { return mpPageFrm;}
+        SwPageFrm* GetPageFrm() { return mpPageFrm; }
+        const SwPageFrm* GetPageFrm() const { return mpPageFrm; }
         void SetPageFrm( SwPageFrm* _pNewPageFrm );
 
         /** method to determine the page frame, on which the 'anchor' of
diff --git a/sw/inc/crstate.hxx b/sw/inc/crstate.hxx
index a1150e2..cdb7df2 100644
--- a/sw/inc/crstate.hxx
+++ b/sw/inc/crstate.hxx
@@ -161,9 +161,9 @@ struct SwCrsrMoveState
     int m_nInNumPostionOffset;        ///< distance from number portion's start
 
     SwCrsrMoveState( CrsrMoveState eSt = MV_NONE ) :
-        m_pFill( NULL ),
-        m_p2Lines( NULL ),
-        m_pSpecialPos( NULL ),
+        m_pFill( nullptr ),
+        m_p2Lines( nullptr ),
+        m_pSpecialPos( nullptr ),
         m_eState( eSt ),
         m_nCursorBidiLevel( 0 ),
         m_bStop( false ),
@@ -185,8 +185,8 @@ struct SwCrsrMoveState
     {}
     SwCrsrMoveState( SwFillCrsrPos *pInitFill ) :
         m_pFill( pInitFill ),
-        m_p2Lines( NULL ),
-        m_pSpecialPos( NULL ),
+        m_p2Lines( nullptr ),
+        m_pSpecialPos( nullptr ),
         m_eState( MV_SETONLYTEXT ),
         m_nCursorBidiLevel( 0 ),
         m_bStop( false ),
diff --git a/sw/inc/dbfld.hxx b/sw/inc/dbfld.hxx
index 080b7d5..682c950 100644
--- a/sw/inc/dbfld.hxx
+++ b/sw/inc/dbfld.hxx
@@ -109,7 +109,7 @@ public:
     virtual bool        PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override;
 
     static bool FormatValue( SvNumberFormatter* pDocFormatter, OUString &aString, sal_uInt32 nFormat,
-                             double &aNumber, sal_Int32 nColumnType, SwDBField *pField = NULL );
+                             double &aNumber, sal_Int32 nColumnType, SwDBField *pField = nullptr );
 };
 
 inline  void SwDBField::SetExpansion(const OUString& rStr)
diff --git a/sw/inc/dbmgr.hxx b/sw/inc/dbmgr.hxx
index b74140d..ca7fc51 100644
--- a/sw/inc/dbmgr.hxx
+++ b/sw/inc/dbmgr.hxx
@@ -250,7 +250,7 @@ public:
     inline void     SetMergeSilent( bool bVal )     { bMergeSilent = bVal; }
 
     /// Merging of data records into fields.
-    bool            MergeNew( const SwMergeDescriptor& rMergeDesc, vcl::Window* pParent = NULL );
+    bool            MergeNew( const SwMergeDescriptor& rMergeDesc, vcl::Window* pParent = nullptr );
     static bool     Merge(SwWrtShell* pSh);
     void            MergeCancel();
 
@@ -335,7 +335,7 @@ public:
     static OUString GetDBField(
                     css::uno::Reference< css::beans::XPropertySet > xColumnProp,
                     const SwDBFormatData& rDBFormatData,
-                    double *pNumber = NULL);
+                    double *pNumber = nullptr);
 
     static css::uno::Reference< css::sdbc::XConnection>
             GetConnection(const OUString& rDataSource,
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index d72b463..46ee9e2 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -920,9 +920,9 @@ public:
     size_t GetPageDescCnt() const { return m_PageDescs.size(); }
     const SwPageDesc& GetPageDesc(const size_t i) const { return *m_PageDescs[i]; }
     SwPageDesc& GetPageDesc(size_t const i) { return *m_PageDescs[i]; }
-    SwPageDesc* FindPageDesc(const OUString& rName, size_t* pPos = NULL) const;
+    SwPageDesc* FindPageDesc(const OUString& rName, size_t* pPos = nullptr) const;
     // Just searches the pointer in the m_PageDescs vector!
-    bool        ContainsPageDesc(const SwPageDesc *pDesc, size_t* pPos = NULL);
+    bool        ContainsPageDesc(const SwPageDesc *pDesc, size_t* pPos = nullptr);
 
     /** Copy the complete PageDesc - beyond document and "deep"!
      Optionally copying of PoolFormatId, -HlpId can be prevented. */
diff --git a/sw/inc/editsh.hxx b/sw/inc/editsh.hxx
index de1e902..1469997 100644
--- a/sw/inc/editsh.hxx
+++ b/sw/inc/editsh.hxx
@@ -234,7 +234,7 @@ public:
     bool GetCurAttr( SfxItemSet& ,
                      const bool bMergeIndentValuesOfNumRule = false ) const;
     void SetAttrItem( const SfxPoolItem&, SetAttrMode nFlags = SetAttrMode::DEFAULT );
-    void SetAttrSet( const SfxItemSet&, SetAttrMode nFlags = SetAttrMode::DEFAULT, SwPaM* pCrsr = NULL );
+    void SetAttrSet( const SfxItemSet&, SetAttrMode nFlags = SetAttrMode::DEFAULT, SwPaM* pCrsr = nullptr );
 
     /** Get RES_CHRATR_* items of one type in the current selection.
      * @param nWhich WhichId of the collected items.
@@ -276,7 +276,7 @@ public:
     /// Query default attribute of document.
     const SfxPoolItem& GetDefault( sal_uInt16 nFormatHint ) const;
 
-    void ResetAttr( const std::set<sal_uInt16> &attrs = std::set<sal_uInt16>(), SwPaM* pCrsr = NULL );
+    void ResetAttr( const std::set<sal_uInt16> &attrs = std::set<sal_uInt16>(), SwPaM* pCrsr = nullptr );
     void GCAttr();
 
     /// @return the scripttpye of the selection.
@@ -525,11 +525,11 @@ public:
     void ChgNumRuleFormats( const SwNumRule& rRule );
 
     /// Set (and query if) a numbering with StartFlag starts at current PointPos.
-    void SetNumRuleStart( bool bFlag = true, SwPaM* pCrsr = NULL );
-    bool IsNumRuleStart( SwPaM* pPaM = NULL ) const;
-    void SetNodeNumStart( sal_uInt16 nStt, SwPaM* = NULL );
+    void SetNumRuleStart( bool bFlag = true, SwPaM* pCrsr = nullptr );
+    bool IsNumRuleStart( SwPaM* pPaM = nullptr ) const;
+    void SetNodeNumStart( sal_uInt16 nStt, SwPaM* = nullptr );
 
-    sal_uInt16 GetNodeNumStart( SwPaM* pPaM = NULL ) const;
+    sal_uInt16 GetNodeNumStart( SwPaM* pPaM = nullptr ) const;
 
     bool ReplaceNumRule( const OUString& rOldRule, const OUString& rNewRule );
 
@@ -793,7 +793,7 @@ public:
     void GetINetAttrs( SwGetINetAttrs& rArr );
 
     OUString GetDropText( const sal_Int32 nChars ) const;
-    void   ReplaceDropText( const OUString &rStr, SwPaM* pPaM = NULL );
+    void   ReplaceDropText( const OUString &rStr, SwPaM* pPaM = nullptr );
 
     /** May an outline be moved or copied?
      Check whether it's in text body, not in table, and not read-only (move). */
diff --git a/sw/inc/fesh.hxx b/sw/inc/fesh.hxx
index 661c030..b589480 100644
--- a/sw/inc/fesh.hxx
+++ b/sw/inc/fesh.hxx
@@ -330,11 +330,11 @@ public:
                         const RndStdIds _nAnchorId,
                         const sal_Int16 _eHoriRelOrient = css::text::RelOrientation::FRAME,
                         const sal_Int16 _eVertRelOrient = css::text::RelOrientation::FRAME,
-                        const SwPosition* _pToCharContentPos = NULL,
+                        const SwPosition* _pToCharContentPos = nullptr,
                         const bool _bFollowTextFlow = false,
                         bool _bMirror = false,
-                        Point* _opRef = NULL,
-                        Size* _opPercent = NULL,
+                        Point* _opRef = nullptr,
+                        Size* _opPercent = nullptr,
                         const SwFormatFrmSize* pFormatFrmSize = 0 ) const;
 
     /// Set size of draw objects.
@@ -492,7 +492,7 @@ public:
     bool GetObjAttr( SfxItemSet &rSet ) const;
     bool SetObjAttr( const SfxItemSet &rSet );
 
-    const SdrObject* GetBestObject( bool bNext, GotoObjFlags eType = GotoObjFlags::DrawAny, bool bFlat = true, const svx::ISdrObjectFilter* pFilter = NULL );
+    const SdrObject* GetBestObject( bool bNext, GotoObjFlags eType = GotoObjFlags::DrawAny, bool bFlat = true, const svx::ISdrObjectFilter* pFilter = nullptr );
     bool GotoObj( bool bNext, GotoObjFlags eType = GotoObjFlags::DrawAny);
 
     /// Set DragMode (e.g. Rotate), but do nothing when frame is selected.
@@ -664,7 +664,7 @@ public:
 
     void SetTabBorders( const SfxItemSet& rSet );
     void GetTabBorders(       SfxItemSet& rSet) const;
-    void SetTabLineStyle(const Color* pColor, bool bSetLine = false, const editeng::SvxBorderLine* pBorderLine = NULL);
+    void SetTabLineStyle(const Color* pColor, bool bSetLine = false, const editeng::SvxBorderLine* pBorderLine = nullptr);
 
     void SetTabBackground( const SvxBrushItem &rNew );
     void GetTabBackground( SvxBrushItem &rToFill ) const;
diff --git a/sw/inc/frmfmt.hxx b/sw/inc/frmfmt.hxx
index 352c6d4..69fa304 100644
--- a/sw/inc/frmfmt.hxx
+++ b/sw/inc/frmfmt.hxx
@@ -74,7 +74,7 @@ public:
     /// Creates the views.
     virtual void MakeFrms();
 
-    virtual Graphic MakeGraphic( ImageMap* pMap = NULL );
+    virtual Graphic MakeGraphic( ImageMap* pMap = nullptr );
 
     /**  @return the IMapObject defined at format (Fly)
         in the ImageMap at position Point.
@@ -181,7 +181,7 @@ public:
     SwAnchoredObject* GetAnchoredObj( const Point* pDocPos = 0,
                                       const bool bCalcFrm = false ) const;
 
-    virtual Graphic MakeGraphic( ImageMap* pMap = NULL ) override;
+    virtual Graphic MakeGraphic( ImageMap* pMap = nullptr ) override;
 
     virtual bool GetInfo( SfxPoolItem& rInfo ) const override;
 
@@ -244,7 +244,7 @@ protected:
     SwDrawFrameFormat( SwAttrPool& rPool, const sal_Char* pFormatNm,
                     SwFrameFormat *pDrvdFrm )
         : SwFrameFormat( rPool, pFormatNm, pDrvdFrm, RES_DRAWFRMFMT ),
-          m_pSdrObjectCached(NULL),
+          m_pSdrObjectCached(nullptr),
 
           meLayoutDir( SwFrameFormat::HORI_L2R ),
 
@@ -256,7 +256,7 @@ protected:
     SwDrawFrameFormat( SwAttrPool& rPool, const OUString &rFormatNm,
                     SwFrameFormat *pDrvdFrm )
         : SwFrameFormat( rPool, rFormatNm, pDrvdFrm, RES_DRAWFRMFMT ),
-          m_pSdrObjectCached(NULL),
+          m_pSdrObjectCached(nullptr),
           meLayoutDir( SwFrameFormat::HORI_L2R ),
 
           mnPositionLayoutDir( css::text::PositionLayoutDir::PositionInLayoutDirOfAnchor ),
@@ -276,7 +276,7 @@ public:
      Reset delete marks. */
     virtual void MakeFrms() override;
 
-    virtual Graphic MakeGraphic( ImageMap* pMap = NULL ) override;
+    virtual Graphic MakeGraphic( ImageMap* pMap = nullptr ) override;
 
     virtual SwFrameFormat::tLayoutDir GetLayoutDir() const override;
     virtual void SetLayoutDir( const SwFrameFormat::tLayoutDir _eLayoutDir ) override;
diff --git a/sw/source/core/inc/frame.hxx b/sw/source/core/inc/frame.hxx
index 251bc15..943503d 100644
--- a/sw/source/core/inc/frame.hxx
+++ b/sw/source/core/inc/frame.hxx
@@ -314,6 +314,8 @@ class SW_DLLPUBLIC SwFrm: public SwClient, public SfxBroadcaster
 
     const SwLayoutFrm* ImplGetNextLayoutLeaf( bool bFwd ) const;
 
+    SwPageFrm* ImplFindPageFrm();
+
 protected:
     SwSortedObjs* mpDrawObjs;    // draw objects, can be 0
 
@@ -582,12 +584,12 @@ public:
     SwFrm               *GetPrev()  { return mpPrev; }
     SwLayoutFrm         *GetUpper() { return mpUpper; }
     SwRootFrm           *getRootFrm(){ return mpRoot; }
-    SwPageFrm           *FindPageFrm();
+    SwPageFrm           *FindPageFrm() { return IsPageFrm() ? reinterpret_cast<SwPageFrm*>(this) : ImplFindPageFrm(); }
     SwFrm               *FindColFrm();
     SwRowFrm            *FindRowFrm();
-    SwFootnoteBossFrm        *FindFootnoteBossFrm( bool bFootnotes = false );
+    SwFootnoteBossFrm   *FindFootnoteBossFrm( bool bFootnotes = false );
     SwTabFrm            *ImplFindTabFrm();
-    SwFootnoteFrm            *ImplFindFootnoteFrm();
+    SwFootnoteFrm       *ImplFindFootnoteFrm();
     SwFlyFrm            *ImplFindFlyFrm();
     SwSectionFrm        *ImplFindSctFrm();
     SwFrm               *FindFooterOrHeader();
diff --git a/sw/source/core/inc/pagefrm.hxx b/sw/source/core/inc/pagefrm.hxx
index 2979491..2c51f2b 100644
--- a/sw/source/core/inc/pagefrm.hxx
+++ b/sw/source/core/inc/pagefrm.hxx
@@ -54,12 +54,12 @@ class SwPageFrm: public SwFootnoteBossFrm
 
     sal_uInt16  m_nPhyPageNum; // Physical page number
 
-    bool m_bInvalidContent        :1;
+    bool m_bInvalidContent      :1;
     bool m_bInvalidLayout       :1;
-    bool m_bInvalidFlyContent     :1;
+    bool m_bInvalidFlyContent   :1;
     bool m_bInvalidFlyLayout    :1;
     bool m_bInvalidFlyInCnt     :1;
-    bool m_bFootnotePage             :1; // This Page is for document end footnotes
+    bool m_bFootnotePage        :1; // This Page is for document end footnotes
     bool m_bEmptyPage           :1; // This Page is an explicitly empty page
     bool m_bEndNotePage         :1; // 'Footnote page' for end notes
     bool m_bInvalidSpelling     :1; // We need online spelling
diff --git a/sw/source/core/inc/swcache.hxx b/sw/source/core/inc/swcache.hxx
index cab9192..4f38eca 100644
--- a/sw/source/core/inc/swcache.hxx
+++ b/sw/source/core/inc/swcache.hxx
@@ -24,7 +24,7 @@
  * These objects are created (using new) in cache access classes; they are
  * destroyed by the cache.
  *
- * One can access these objects by array index or by searching in the array
+ * One can access these objects by array index or by searching in the array.
  * If you access it by index, managing the index is the responsibility of
  * the cache user.
  *
diff --git a/sw/source/core/layout/calcmove.cxx b/sw/source/core/layout/calcmove.cxx
index 9de4a2f..5b32b56 100644
--- a/sw/source/core/layout/calcmove.cxx
+++ b/sw/source/core/layout/calcmove.cxx
@@ -254,7 +254,7 @@ void SwFrm::PrepareMake(vcl::RenderContext* pRenderContext)
         const bool bTab = IsTabFrm();
         bool bNoSect = IsInSct();
         bool bOldTabLock = false, bFoll = false;
-        SwFlowFrm* pThis = bCnt ? static_cast<SwContentFrm*>(this) : NULL;
+        SwFlowFrm* pThis = bCnt ? static_cast<SwContentFrm*>(this) : nullptr;
 
         if ( bTab )
         {
diff --git a/sw/source/core/layout/findfrm.cxx b/sw/source/core/layout/findfrm.cxx
index ced90ec..8936e25 100644
--- a/sw/source/core/layout/findfrm.cxx
+++ b/sw/source/core/layout/findfrm.cxx
@@ -393,7 +393,7 @@ const SwContentFrm* SwContentFrm::ImplGetNextContentFrm( bool bFwd ) const
     return pContentFrm;
 }
 
-SwPageFrm* SwFrm::FindPageFrm()
+SwPageFrm* SwFrm::ImplFindPageFrm()
 {
     SwFrm *pRet = this;
     while ( pRet && !pRet->IsPageFrm() )
@@ -403,13 +403,13 @@ SwPageFrm* SwFrm::FindPageFrm()
         else if ( pRet->IsFlyFrm() )
         {
             // #i28701# - use new method <GetPageFrm()>
-            if ( static_cast<SwFlyFrm*>(pRet)->GetPageFrm() )
-                pRet = static_cast<SwFlyFrm*>(pRet)->GetPageFrm();
-            else
-                pRet = static_cast<SwFlyFrm*>(pRet)->AnchorFrm();
+            const auto pFly(static_cast<SwFlyFrm*>(pRet));
+            pRet = pFly->GetPageFrm();
+            if (pRet == nullptr)
+                pRet = pFly->AnchorFrm();
         }
         else
-            return 0;
+            return nullptr;
     }
     return static_cast<SwPageFrm*>(pRet);
 }
diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx
index 989ec2f..e9bedba 100644
--- a/sw/source/core/layout/layact.cxx
+++ b/sw/source/core/layout/layact.cxx
@@ -483,7 +483,8 @@ void SwLayAction::InternalAction(OutputDevice* pRenderContext)
             ::SetProgressState( nPercentPageNum, pImp->GetShell()->GetDoc()->GetDocShell());
         }
         pOptTab = 0;
-             // No Shortcut for Idle or CalcLayout
+
+        // No Shortcut for Idle or CalcLayout
         if ( !IsIdle() && !IsComplete() && IsShortCut( pPage ) )
         {
             pRoot->DeleteEmptySct();
diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx
index 3c43775..6d698bd 100644
--- a/sw/source/core/layout/pagechg.cxx
+++ b/sw/source/core/layout/pagechg.cxx
@@ -1754,44 +1754,41 @@ static void lcl_MoveAllLowers( SwFrm* pFrm, const Point& rOffset );
 
 static void lcl_MoveAllLowerObjs( SwFrm* pFrm, const Point& rOffset )
 {
-    SwSortedObjs* pSortedObj = 0;
     const bool bPage = pFrm->IsPageFrm();
+    const SwSortedObjs* pSortedObj = bPage
+                        ? static_cast<SwPageFrm*>(pFrm)->GetSortedObjs()
+                        : pFrm->GetDrawObjs();
+    if (pSortedObj == nullptr)
+        return;
 
-    if ( bPage )
-        pSortedObj = static_cast<SwPageFrm*>(pFrm)->GetSortedObjs();
-    else
-        pSortedObj = pFrm->GetDrawObjs();
-
-    for ( size_t i = 0; pSortedObj && i < pSortedObj->size(); ++i)
+    for (SwAnchoredObject* pAnchoredObj : *pSortedObj)
     {
-        SwAnchoredObject* pAnchoredObj = (*pSortedObj)[i];
-
         const SwFrameFormat& rObjFormat = pAnchoredObj->GetFrameFormat();
         const SwFormatAnchor& rAnchor = rObjFormat.GetAnchor();
 
         // all except from the as character anchored objects are moved
         // when processing the page frame:
-        const bool bAsChar = (rAnchor.GetAnchorId() == FLY_AS_CHAR);
-        if ( !bPage && !bAsChar )
+        if ( !bPage && (rAnchor.GetAnchorId() != FLY_AS_CHAR) )
             continue;
 
         SwObjPositioningInProgress aPosInProgress( *pAnchoredObj );
 
-        if ( dynamic_cast< const SwFlyFrm *>( pAnchoredObj ) !=  nullptr )
+        if ( dynamic_cast< const SwFlyFrm *>( pAnchoredObj ) != nullptr )
         {
             SwFlyFrm* pFlyFrm( static_cast<SwFlyFrm*>(pAnchoredObj) );
             lcl_MoveAllLowers( pFlyFrm, rOffset );
             pFlyFrm->NotifyDrawObj();
             // --> let the active embedded object be moved
-            if ( pFlyFrm->Lower() )
+            SwFrm* pLower = pFlyFrm->Lower();
+            if ( pLower )
             {
-                if ( pFlyFrm->Lower()->IsNoTextFrm() )
+                if ( pLower->IsNoTextFrm() )
                 {
-                    SwContentFrm* pContentFrm = static_cast<SwContentFrm*>(pFlyFrm->Lower());
-                    SwRootFrm* pRoot = pFlyFrm->Lower()->getRootFrm();
-                    SwViewShell *pSh = pRoot ? pRoot->GetCurrShell() : 0;
+                    SwRootFrm* pRoot = pLower->getRootFrm();
+                    SwViewShell *pSh = pRoot ? pRoot->GetCurrShell() : nullptr;
                     if ( pSh )
                     {
+                        SwContentFrm* pContentFrm = static_cast<SwContentFrm*>(pLower);
                         SwOLENode* pNode = pContentFrm->GetNode()->GetOLENode();
                         if ( pNode )
                         {
@@ -1815,11 +1812,10 @@ static void lcl_MoveAllLowerObjs( SwFrm* pFrm, const Point& rOffset )
             SwAnchoredDrawObject* pAnchoredDrawObj( static_cast<SwAnchoredDrawObject*>(pAnchoredObj) );
 
             // don't touch objects that are not yet positioned:
-            const bool bNotYetPositioned = pAnchoredDrawObj->NotYetPositioned();
-            if ( bNotYetPositioned )
+            if ( pAnchoredDrawObj->NotYetPositioned() )
                 continue;
 
-            const Point aCurrAnchorPos = pAnchoredDrawObj->GetDrawObj()->GetAnchorPos();
+            const Point& aCurrAnchorPos = pAnchoredDrawObj->GetDrawObj()->GetAnchorPos();
             const Point aNewAnchorPos( ( aCurrAnchorPos + rOffset ) );
             pAnchoredDrawObj->DrawObj()->SetAnchorPos( aNewAnchorPos );
             pAnchoredDrawObj->SetLastObjRect( pAnchoredDrawObj->GetObjRect().SVRect() );
@@ -1874,12 +1870,13 @@ static void lcl_MoveAllLowers( SwFrm* pFrm, const Point& rOffset )
 // Calculate how the pages have to be positioned
 void SwRootFrm::CheckViewLayout( const SwViewOption* pViewOpt, const SwRect* pVisArea )
 {
-    vcl::RenderContext* pRenderContext = GetCurrShell() ? GetCurrShell()->GetOut() : 0;
+    SwViewShell* pSh = GetCurrShell();
+    vcl::RenderContext* pRenderContext = pSh ? pSh->GetOut() : nullptr;
     // #i91432#
     // No calculation of page positions, if only an empty page is present.
     // This situation occurs when <SwRootFrm> instance is in construction
     // and the document contains only left pages.
-    if ( Lower()->GetNext() == 0 &&
+    if ( Lower()->GetNext() == nullptr &&
          static_cast<SwPageFrm*>(Lower())->IsEmptyPage() )
     {
         return;
@@ -1922,7 +1919,6 @@ void SwRootFrm::CheckViewLayout( const SwViewOption* pViewOpt, const SwRect* pVi
 
     const long nBorder = Frm().Pos().getX();
     const long nVisWidth = mnViewWidth - 2 * nBorder;
-    SwViewShell* pSh = GetCurrShell();
     const long nGapBetweenPages = pViewOpt ? pViewOpt->GetGapBetweenPages()
                                            : (pSh ? pSh->GetViewOptions()->GetGapBetweenPages()
                                                   : SwViewOption::GetDefGapBetweenPages());
@@ -1950,7 +1946,7 @@ void SwRootFrm::CheckViewLayout( const SwViewOption* pViewOpt, const SwRect* pVi
 
     bool bPageChanged = false;
     const bool bRTL = !IsLeftToRightViewLayout();
-    const SwTwips nSidebarWidth = SwPageFrm::GetSidebarBorderWidth( GetCurrShell() );
+    const SwTwips nSidebarWidth = SwPageFrm::GetSidebarBorderWidth( pSh );
 
     while ( pPageFrm )
     {
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index 3f6acc2..b92c6e8 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -6411,7 +6411,7 @@ SwRect SwPageFrm::GetBoundRect(OutputDevice* pOutputDevice) const
 
 /*static*/ SwTwips SwPageFrm::GetSidebarBorderWidth( const SwViewShell* _pViewShell )
 {
-    const SwPostItMgr* pPostItMgr = _pViewShell ? _pViewShell->GetPostItMgr() : 0;
+    const SwPostItMgr* pPostItMgr = _pViewShell ? _pViewShell->GetPostItMgr() : nullptr;
     const SwTwips nRet = pPostItMgr && pPostItMgr->HasNotes() && pPostItMgr->ShowNotes() ? pPostItMgr->GetSidebarWidth() + pPostItMgr->GetSidebarBorderWidth() : 0;
     return nRet;
 }
diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx
index b767f8b..fbf706e 100644
--- a/sw/source/core/layout/wsfrm.cxx
+++ b/sw/source/core/layout/wsfrm.cxx
@@ -58,11 +58,11 @@ SwFrm::SwFrm( SwModify *pMod, SwFrm* pSib ) :
     mbIfAccTableShouldDisposing( false ), //A member to identify if the acc table should dispose
     mbInDtor(false),
     mnFrmId( SwFrm::mnLastFrmId++ ),
-    mpRoot( pSib ? pSib->getRootFrm() : 0 ),
-    mpUpper( 0 ),
-    mpNext( 0 ),
-    mpPrev( 0 ),
-    mpDrawObjs( 0 ),
+    mpRoot( pSib ? pSib->getRootFrm() : nullptr ),
+    mpUpper(nullptr),
+    mpNext(nullptr),
+    mpPrev(nullptr),
+    mpDrawObjs(nullptr),
     mnFrmType(0),
     mbInfBody( false ),
     mbInfTab ( false ),
@@ -2157,11 +2157,12 @@ TYPEINIT1(SwLayoutFrm,SwFrm);
 
 SwTwips SwLayoutFrm::InnerHeight() const
 {
-    if( !Lower() )
-        return 0;
-    SwTwips nRet = 0;
     const SwFrm* pCnt = Lower();
+    if (!pCnt)
+        return 0;
+
     SWRECTFN( this )
+    SwTwips nRet = 0;
     if( pCnt->IsColumnFrm() || pCnt->IsCellFrm() )
     {
         do
diff --git a/sw/source/uibase/docvw/PageBreakWin.cxx b/sw/source/uibase/docvw/PageBreakWin.cxx
index 93e7c42..7533bce 100644
--- a/sw/source/uibase/docvw/PageBreakWin.cxx
+++ b/sw/source/uibase/docvw/PageBreakWin.cxx
@@ -93,13 +93,13 @@ namespace
 
 SwPageBreakWin::SwPageBreakWin( SwEditWin* pEditWin, const SwFrm *pFrm ) :
     SwFrameMenuButtonBase( pEditWin, pFrm ),
-    m_pPopupMenu( NULL ),
-    m_pLine( NULL ),
+    m_pPopupMenu( nullptr ),
+    m_pLine( nullptr ),
     m_bIsAppearing( false ),
     m_nFadeRate( 100 ),
     m_nDelayAppearing( 0 ),
     m_bDestroyed( false ),
-    m_pMousePt( NULL )
+    m_pMousePt( nullptr )
 {
     // Use pixels for the rest of the drawing
     SetMapMode( MapMode ( MAP_PIXEL ) );
@@ -128,9 +128,9 @@ void SwPageBreakWin::dispose()
 
     m_pLine.disposeAndClear();
     delete m_pPopupMenu;
-    m_pPopupMenu = NULL;
+    m_pPopupMenu = nullptr;
     delete m_pMousePt;
-    m_pMousePt = NULL;
+    m_pMousePt = nullptr;
 
     SwFrameMenuButtonBase::dispose();
 }
@@ -246,7 +246,7 @@ void SwPageBreakWin::Select( )
 
                         SfxStringItem aItem(pEditWin->GetView().GetPool().GetWhich(FN_FORMAT_TABLE_DLG), "textflow");
                         pEditWin->GetView().GetViewFrame()->GetDispatcher()->Execute(
-                                FN_FORMAT_TABLE_DLG, SfxCallMode::SYNCHRON|SfxCallMode::RECORD, &aItem, NULL );
+                                FN_FORMAT_TABLE_DLG, SfxCallMode::SYNCHRON|SfxCallMode::RECORD, &aItem, nullptr );
 
                         rSh.Pop( false );
                     }
@@ -259,7 +259,7 @@ void SwPageBreakWin::Select( )
                         SwPaMItem aPaMItem( pEditWin->GetView().GetPool( ).GetWhich( FN_PARAM_PAM ), &aPaM );
                         SfxStringItem aItem( pEditWin->GetView().GetPool( ).GetWhich( SID_PARA_DLG ), "textflow" );
                         pEditWin->GetView().GetViewFrame()->GetDispatcher()->Execute(
-                                SID_PARA_DLG, SfxCallMode::SYNCHRON|SfxCallMode::RECORD, &aItem, &aPaMItem, NULL );
+                                SID_PARA_DLG, SfxCallMode::SYNCHRON|SfxCallMode::RECORD, &aItem, &aPaMItem, nullptr );
                     }
                     rSh.LockView( bOldLock );
                     pEditWin->GrabFocus( );
@@ -277,19 +277,19 @@ void SwPageBreakWin::Select( )
                     SwContentFrm *pCnt = const_cast< SwContentFrm* >( pBodyFrm->ContainsContent() );
                     SwContentNode* pNd = pCnt->GetNode();
 
-                    pNd->GetDoc()->GetIDocumentUndoRedo( ).StartUndo( UNDO_UI_DELETE_PAGE_BREAK, NULL );
+                    pNd->GetDoc()->GetIDocumentUndoRedo( ).StartUndo( UNDO_UI_DELETE_PAGE_BREAK, nullptr );
 
                     SfxItemSet aSet( GetEditWin()->GetView().GetWrtShell().GetAttrPool(),
                             RES_PAGEDESC, RES_PAGEDESC,
                             RES_BREAK, RES_BREAK,
-                            NULL );
+                            nullptr );
                     aSet.Put( SvxFormatBreakItem( SVX_BREAK_NONE, RES_BREAK ) );
-                    aSet.Put( SwFormatPageDesc( NULL ) );
+                    aSet.Put( SwFormatPageDesc( nullptr ) );
 
                     SwPaM aPaM( *pNd );
                     pNd->GetDoc()->getIDocumentContentOperations().InsertItemSet( aPaM, aSet );
 
-                    pNd->GetDoc()->GetIDocumentUndoRedo( ).EndUndo( UNDO_UI_DELETE_PAGE_BREAK, NULL );
+                    pNd->GetDoc()->GetIDocumentUndoRedo( ).EndUndo( UNDO_UI_DELETE_PAGE_BREAK, nullptr );
                 }
             }
             break;
@@ -322,7 +322,7 @@ void SwPageBreakWin::Activate( )
 
 void SwPageBreakWin::UpdatePosition( const Point* pEvtPt )
 {
-    if ( pEvtPt != NULL )
+    if ( pEvtPt != nullptr )
     {
         if ( pEvtPt == m_pMousePt )
             return;
diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx
index 5d0408a..a80ab36 100644
--- a/sw/source/uibase/docvw/PostItMgr.cxx
+++ b/sw/source/uibase/docvw/PostItMgr.cxx
@@ -468,8 +468,8 @@ bool SwPostItMgr::CalcRects()
                 const SwTextAnnotationField* pTextAnnotationField =
                     dynamic_cast< const SwTextAnnotationField* >( pItem->GetFormatField().GetTextField() );
                 const ::sw::mark::IMark* pAnnotationMark =
-                    pTextAnnotationField != NULL ? pTextAnnotationField->GetAnnotationMark() : NULL;
-                if ( pAnnotationMark != NULL )
+                    pTextAnnotationField != nullptr ? pTextAnnotationField->GetAnnotationMark() : nullptr;
+                if ( pAnnotationMark != nullptr )
                 {
                     pItem->mLayoutStatus =
                         SwPostItHelper::getLayoutInfos(
@@ -1265,7 +1265,7 @@ class FieldDocWatchingStack : public SfxListener
             if (pHint->Which() == SwFormatFieldHintWhich::REMOVED)
             {
                 const SwFormatField* pField = pHint->GetField();
-                bAllInvalidated = pField == NULL;
+                bAllInvalidated = pField == nullptr;
                 if (!bAllInvalidated && m_rFilter(pField))
                 {
                     EndListening(const_cast<SwFormatField&>(*pField));
@@ -1275,7 +1275,7 @@ class FieldDocWatchingStack : public SfxListener
             else if (pHint->Which() == SwFormatFieldHintWhich::INSERTED)
             {
                 const SwFormatField* pField = pHint->GetField();
-                bAllInvalidated = pField == NULL;
+                bAllInvalidated = pField == nullptr;
                 if (!bAllInvalidated && m_rFilter(pField))
                 {
                     StartListening(const_cast<SwFormatField&>(*pField));
@@ -1330,7 +1330,7 @@ public:
     const SwFormatField* pop()
     {
         if (v.empty())
-            return NULL;
+            return nullptr;
         const SwFormatField* p = v.back();
         EndListening(const_cast<SwFormatField&>(*p));
         v.pop_back();
@@ -1510,7 +1510,7 @@ SwSidebarWin* SwPostItMgr::GetSidebarWin( const SfxBroadcaster* pBroadcaster) co
         if ( (*i)->GetBroadCaster() == pBroadcaster)
             return (*i)->pPostIt;
     }
-    return NULL;
+    return nullptr;
 }
 
 sw::annotation::SwAnnotationWin* SwPostItMgr::GetAnnotationWin(const SwPostItField* pField) const
@@ -1520,7 +1520,7 @@ sw::annotation::SwAnnotationWin* SwPostItMgr::GetAnnotationWin(const SwPostItFie
         if ( (*i)->GetFormatField().GetField() == pField )
             return dynamic_cast<sw::annotation::SwAnnotationWin*>((*i)->pPostIt.get());
     }
-    return NULL;
+    return nullptr;
 }
 
 SwSidebarWin* SwPostItMgr::GetNextPostIt( sal_uInt16 aDirection,
@@ -1537,7 +1537,7 @@ SwSidebarWin* SwPostItMgr::GetNextPostIt( sal_uInt16 aDirection,
                 {
                     if ( iNextPostIt == mvPostItFields.begin() )
                     {
-                        return NULL;
+                        return nullptr;
                     }
                     --iNextPostIt;
                 }
@@ -1546,19 +1546,19 @@ SwSidebarWin* SwPostItMgr::GetNextPostIt( sal_uInt16 aDirection,
                     ++iNextPostIt;
                     if ( iNextPostIt == mvPostItFields.end() )
                     {
-                        return NULL;
+                        return nullptr;
                     }
                 }
                 // lets quit, we are back at the beginning
                 if ( (*iNextPostIt)->pPostIt == aPostIt)
-                    return NULL;
+                    return nullptr;
                 return (*iNextPostIt)->pPostIt;
             }
         }
-        return NULL;
+        return nullptr;
     }
     else
-        return NULL;
+        return nullptr;
 }
 
 long SwPostItMgr::GetNextBorder()
diff --git a/sw/source/uibase/docvw/SidebarWin.cxx b/sw/source/uibase/docvw/SidebarWin.cxx
index f5c620a..21f5a6e 100644
--- a/sw/source/uibase/docvw/SidebarWin.cxx
+++ b/sw/source/uibase/docvw/SidebarWin.cxx
@@ -107,9 +107,9 @@ SwSidebarWin::SwSidebarWin(SwEditWin& rEditWin,
     , mpMetadataAuthor(0)
     , mpMetadataDate(0)
     , mpMenuButton(0)
-    , mpAnchor(NULL)
-    , mpShadow(NULL)
-    , mpTextRangeOverlay(NULL)
+    , mpAnchor(nullptr)
+    , mpShadow(nullptr)
+    , mpTextRangeOverlay(nullptr)
     , mColorAnchor()
     , mColorDark()
     , mColorLight()
@@ -193,13 +193,13 @@ void SwSidebarWin::dispose()
     RemoveEventListener( LINK( this, SwSidebarWin, WindowEventListener ) );
 
     AnchorOverlayObject::DestroyAnchorOverlayObject( mpAnchor );
-    mpAnchor = NULL;
+    mpAnchor = nullptr;
 
     ShadowOverlayObject::DestroyShadowOverlayObject( mpShadow );
-    mpShadow = NULL;
+    mpShadow = nullptr;
 
     delete mpTextRangeOverlay;
-    mpTextRangeOverlay = NULL;
+    mpTextRangeOverlay = nullptr;
 
     mpMenuButton.disposeAndClear();
 
@@ -694,14 +694,14 @@ void SwSidebarWin::SetPosAndSize()
         {
             const SwTextAnnotationField* pTextAnnotationField =
                 dynamic_cast< const SwTextAnnotationField* >( mrSidebarItem.GetFormatField().GetTextField() );
-            if ( pTextAnnotationField != NULL
-                 && pTextAnnotationField->GetpTextNode() != NULL )
+            if ( pTextAnnotationField != nullptr
+                 && pTextAnnotationField->GetpTextNode() != nullptr )
             {
                 SwTextNode* pTextNode = pTextAnnotationField->GetpTextNode();
                 SwNodes& rNds = pTextNode->GetDoc()->GetNodes();
                 SwContentNode* const pContentNd = rNds[mrSidebarItem.maLayoutInfo.mnStartNodeIdx]->GetContentNode();
                 SwPosition aStartPos( *pContentNd, mrSidebarItem.maLayoutInfo.mnStartContent );
-                SwShellCrsr* pTmpCrsr = NULL;
+                SwShellCrsr* pTmpCrsr = nullptr;
                 const bool bTableCrsrNeeded = pTextNode->FindTableBoxStartNode() != pContentNd->FindTableBoxStartNode();
                 if ( bTableCrsrNeeded )
                 {
@@ -736,10 +736,10 @@ void SwSidebarWin::SetPosAndSize()
             }
         }
 
-        if ( mpTextRangeOverlay != NULL )
+        if ( mpTextRangeOverlay != nullptr )
         {
             mpTextRangeOverlay->setRanges( aAnnotationTextRanges );
-            if ( mpAnchor != NULL && mpAnchor->getLineSolid() )
+            if ( mpAnchor != nullptr && mpAnchor->getLineSolid() )
             {
                 mpTextRangeOverlay->ShowSolidBorder();
             }
@@ -762,7 +762,7 @@ void SwSidebarWin::SetPosAndSize()
     else
     {
         delete mpTextRangeOverlay;
-        mpTextRangeOverlay = NULL;
+        mpTextRangeOverlay = nullptr;
     }
 }
 
@@ -1301,7 +1301,7 @@ void SwSidebarWin::SetViewState(ViewState bViewState)
                     pWin->Anchor()->SetAnchorState(AS_END);
                 }
                 mpAnchor->setLineSolid(true);
-                if ( mpTextRangeOverlay != NULL )
+                if ( mpTextRangeOverlay != nullptr )
                 {
                     mpTextRangeOverlay->ShowSolidBorder();
                 }
@@ -1315,7 +1315,7 @@ void SwSidebarWin::SetViewState(ViewState bViewState)
             if (mpAnchor)
             {
                 mpAnchor->setLineSolid(true);
-                if ( mpTextRangeOverlay != NULL )
+                if ( mpTextRangeOverlay != nullptr )
                 {
                     mpTextRangeOverlay->ShowSolidBorder();
                 }
@@ -1344,7 +1344,7 @@ void SwSidebarWin::SetViewState(ViewState bViewState)
                         if ( pTopWinSelf != mrMgr.GetActiveSidebarWin() )
                         {
                             pTopWinSelf->Anchor()->setLineSolid(false);
-                            if ( pTopWinSelf->TextRange() != NULL )
+                            if ( pTopWinSelf->TextRange() != nullptr )
                             {
                                 pTopWinSelf->TextRange()->HideSolidBorder();
                             }
@@ -1353,7 +1353,7 @@ void SwSidebarWin::SetViewState(ViewState bViewState)
                     }
                 }
                 mpAnchor->setLineSolid(false);
-                if ( mpTextRangeOverlay != NULL )
+                if ( mpTextRangeOverlay != nullptr )
                 {
                     mpTextRangeOverlay->HideSolidBorder();
                 }
diff --git a/sw/source/uibase/shells/tabsh.cxx b/sw/source/uibase/shells/tabsh.cxx
index 3708487..ce012a6 100644
--- a/sw/source/uibase/shells/tabsh.cxx
+++ b/sw/source/uibase/shells/tabsh.cxx
@@ -504,17 +504,17 @@ void SwTableShell::Execute(SfxRequest &rReq)
 // The attributes of all lines will be read and the strongest wins.
             const SvxBorderLine* pBorderLine;
             SvxBorderLine aBorderLine;
-            if ((pBorderLine = rCoreBox.GetTop()) != NULL)
+            if ((pBorderLine = rCoreBox.GetTop()) != nullptr)
                 lcl_TabGetMaxLineWidth(pBorderLine, aBorderLine);
-            if ((pBorderLine = rCoreBox.GetBottom()) != NULL)
+            if ((pBorderLine = rCoreBox.GetBottom()) != nullptr)
                 lcl_TabGetMaxLineWidth(pBorderLine, aBorderLine);
-            if ((pBorderLine = rCoreBox.GetLeft()) != NULL)
+            if ((pBorderLine = rCoreBox.GetLeft()) != nullptr)
                 lcl_TabGetMaxLineWidth(pBorderLine, aBorderLine);
-            if ((pBorderLine = rCoreBox.GetRight()) != NULL)
+            if ((pBorderLine = rCoreBox.GetRight()) != nullptr)
                 lcl_TabGetMaxLineWidth(pBorderLine, aBorderLine);
-            if ((pBorderLine = aCoreInfo.GetHori()) != NULL)
+            if ((pBorderLine = aCoreInfo.GetHori()) != nullptr)
                 lcl_TabGetMaxLineWidth(pBorderLine, aBorderLine);
-            if ((pBorderLine = aCoreInfo.GetVert()) != NULL)
+            if ((pBorderLine = aCoreInfo.GetVert()) != nullptr)
                 lcl_TabGetMaxLineWidth(pBorderLine, aBorderLine);
 
             if(aBorderLine.GetOutWidth() == 0)
@@ -524,17 +524,17 @@ void SwTableShell::Execute(SfxRequest &rReq)
             }
 
             bool bLine = false;
-            if( aBox.GetTop() != NULL )
+            if( aBox.GetTop() != nullptr )
                 aBox.SetLine(&aBorderLine, SvxBoxItemLine::TOP), bLine |= true;
-            if( aBox.GetBottom() != NULL )
+            if( aBox.GetBottom() != nullptr )
                 aBox.SetLine(&aBorderLine, SvxBoxItemLine::BOTTOM), bLine |= true;
-            if( aBox.GetLeft() != NULL )
+            if( aBox.GetLeft() != nullptr )
                 aBox.SetLine(&aBorderLine, SvxBoxItemLine::LEFT), bLine |= true;
-            if( aBox.GetRight() != NULL )
+            if( aBox.GetRight() != nullptr )
                 aBox.SetLine(&aBorderLine, SvxBoxItemLine::RIGHT), bLine |= true;
-            if( aInfo.GetHori() != NULL )
+            if( aInfo.GetHori() != nullptr )
                 aInfo.SetLine(&aBorderLine, SvxBoxInfoItemLine::HORI), bLine |= true;
-            if( aInfo.GetVert() != NULL )
+            if( aInfo.GetVert() != nullptr )
                 aInfo.SetLine(&aBorderLine, SvxBoxInfoItemLine::VERT), bLine |= true;
 
             aCoreSet.Put( aBox  );


More information about the Libreoffice-commits mailing list