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

Bjoern Michaelsen bjoern.michaelsen at canonical.com
Thu Jan 5 14:39:16 UTC 2017


 sw/source/core/layout/flypos.cxx |   40 ++++++---------------------------------
 1 file changed, 7 insertions(+), 33 deletions(-)

New commits:
commit 9fc76fd59cb632faa3b9b8467caccfac87d15838
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Wed Jan 4 23:11:56 2017 +0100

    use GetZOrnderHint instead of duplication
    
    Change-Id: I78f428e9ddc50df60f7e9652015d49f3cf7b3286
    Reviewed-on: https://gerrit.libreoffice.org/32746
    Reviewed-by: Björn Michaelsen <bjoern.michaelsen at canonical.com>
    Tested-by: Björn Michaelsen <bjoern.michaelsen at canonical.com>

diff --git a/sw/source/core/layout/flypos.cxx b/sw/source/core/layout/flypos.cxx
index 38ab540..0503f5a 100644
--- a/sw/source/core/layout/flypos.cxx
+++ b/sw/source/core/layout/flypos.cxx
@@ -36,41 +36,15 @@ bool SwPosFlyFrameCmp::operator()(const SwPosFlyFramePtr& rA, const SwPosFlyFram
     return rA->GetNdIndex() < rB->GetNdIndex();
 }
 
-SwPosFlyFrame::SwPosFlyFrame( const SwNodeIndex& rIdx, const SwFrameFormat* pFormat,
-                            sal_uInt16 nArrPos )
-    : m_pFrameFormat( pFormat ), m_pNodeIndex( const_cast<SwNodeIndex*>(&rIdx) )
+SwPosFlyFrame::SwPosFlyFrame(const SwNodeIndex& rIdx, const SwFrameFormat* pFormat, sal_uInt16 nArrPos)
+    : m_pFrameFormat(pFormat), m_pNodeIndex(const_cast<SwNodeIndex*>(&rIdx)), m_nOrdNum(SAL_MAX_UINT32)
 {
-    bool bFnd = false;
     const SwFormatAnchor& rAnchor = pFormat->GetAnchor();
-    if (FLY_AT_PAGE == rAnchor.GetAnchorId())
-    {
-        m_pNodeIndex = new SwNodeIndex( rIdx );
-    }
-    else if( pFormat->GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell() )
-    {
-        if( RES_FLYFRMFMT == pFormat->Which() )
-        {
-            // Let's see if we have an SdrObject for this
-            SwFlyFrame* pFly = SwIterator<SwFlyFrame,SwFormat>(*pFormat).First();
-            if( pFly )
-            {
-                m_nOrdNum = pFly->GetVirtDrawObj()->GetOrdNum();
-                bFnd = true;
-            }
-        }
-        else if( RES_DRAWFRMFMT == pFormat->Which() )
-        {
-            // Let's see if we have an SdrObject for this
-            SwDrawContact* pContact = SwIterator<SwDrawContact,SwFormat>(*pFormat).First();
-            if( pContact )
-            {
-                m_nOrdNum = pContact->GetMaster()->GetOrdNum();
-                bFnd = true;
-            }
-        }
-    }
-
-    if( !bFnd )
+    if(FLY_AT_PAGE == rAnchor.GetAnchorId())
+        m_pNodeIndex = new SwNodeIndex(rIdx);
+    else if(pFormat->GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell())
+        pFormat->CallSwClientNotify(sw::GetZOrderHint(m_nOrdNum));
+    if(m_nOrdNum == SAL_MAX_UINT32)
     {
         m_nOrdNum = pFormat->GetDoc()->GetSpzFrameFormats()->size();
         m_nOrdNum += nArrPos;


More information about the Libreoffice-commits mailing list