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

Oliver-Rainer Wittmann orw at apache.org
Thu Jun 5 05:08:11 PDT 2014


 sw/source/core/crsr/viscrs.cxx    |   16 
 sw/source/core/inc/rootfrm.hxx    |    4 
 sw/source/core/layout/trvlfrm.cxx |  892 ++++++++++++++++++--------------------
 sw/source/ui/wrtsh/wrtsh2.cxx     |    5 
 4 files changed, 453 insertions(+), 464 deletions(-)

New commits:
commit ec7fc735e031f643e324b0924a1f2ca753cb314d
Author: Oliver-Rainer Wittmann <orw at apache.org>
Date:   Thu Jun 5 10:49:57 2014 +0000

    125050: correct text range for comment/annotation at a table cell selection

diff --git a/sw/source/ui/wrtsh/wrtsh2.cxx b/sw/source/ui/wrtsh/wrtsh2.cxx
index 77d16e5..207e553 100644
--- a/sw/source/ui/wrtsh/wrtsh2.cxx
+++ b/sw/source/ui/wrtsh/wrtsh2.cxx
@@ -100,7 +100,10 @@ void SwWrtShell::Insert( SwField& rFld )
                 GetTblCrs()->Normalize( sal_False );
                 const SwPosition rStartPos( *(GetTblCrs()->GetMark()->nNode.GetNode().GetCntntNode()), 0 );
                 KillPams();
-                EndPara();
+                if ( !IsEndOfPara() )
+                {
+                    EndPara();
+                }
                 const SwPosition rEndPos( *GetCurrentShellCursor().GetPoint() );
                 pAnnotationTextRange = new SwPaM( rStartPos, rEndPos );
             }
commit d74e7cd245a570b9bf223424146afc58ce6811ca
Author: Oliver-Rainer Wittmann <orw at apache.org>
Date:   Thu Jun 5 10:37:14 2014 +0000

    125024: minor follow-up to the fix - remove (German) comment

diff --git a/sw/source/core/layout/trvlfrm.cxx b/sw/source/core/layout/trvlfrm.cxx
index 998136d..117bc21 100644
--- a/sw/source/core/layout/trvlfrm.cxx
+++ b/sw/source/core/layout/trvlfrm.cxx
@@ -1982,9 +1982,6 @@ bool SwRootFrm::MakeTblCrsrs( SwTableCursor& rTblCrsr )
  *         Ende nach links erweitern, bis Frame-Start Rect berechnen
  *         und bei mehr als 2 Frames von allen dazwischen liegenden
  *         Frames die PrtArea dazu.
- *  4. Wenn es sich um eine Tabellenselektion handelt wird fuer jeden
- *     PaM im Ring der CellFrm besorgt, dessen PrtArea wird zu den
- *     Rechtecken addiert.
  *
  * Grosser Umbau wg. der FlyFrm; denn diese muessen ausgespart werden.
  * Ausnahmen: - Der Fly in dem die Selektion stattfindet (wenn sie in einem Fly
commit 65f39887f41e701b699fd2e51da803d116766eb8
Author: Oliver-Rainer Wittmann <orw at apache.org>
Date:   Thu Jun 5 10:06:45 2014 +0000

    125024: SwRootFrm::CalcFrmRects(..) - remove code regarding table selection as it is not used any more.

diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx
index 62f2072..ac396dd 100644
--- a/sw/source/core/crsr/viscrs.cxx
+++ b/sw/source/core/crsr/viscrs.cxx
@@ -815,13 +815,15 @@ void SwShellCrsr::SetMark()
 void SwShellCrsr::FillRects()
 {
     // die neuen Rechtecke berechnen
-    if( HasMark() &&
-        GetPoint()->nNode.GetNode().IsCntntNode() &&
-        GetPoint()->nNode.GetNode().GetCntntNode()->getLayoutFrm( GetShell()->GetLayout() ) &&
-        (GetMark()->nNode == GetPoint()->nNode ||
-        (GetMark()->nNode.GetNode().IsCntntNode() &&
-        GetMark()->nNode.GetNode().GetCntntNode()->getLayoutFrm( GetShell()->GetLayout() ) )    ))
-        GetShell()->GetLayout()->CalcFrmRects( *this, GetShell()->IsTableMode() );  //swmod 071107//swmod 071225
+    if ( HasMark()
+         && GetPoint()->nNode.GetNode().IsCntntNode()
+         && GetPoint()->nNode.GetNode().GetCntntNode()->getLayoutFrm( GetShell()->GetLayout() )
+         && ( GetMark()->nNode == GetPoint()->nNode
+              || ( GetMark()->nNode.GetNode().IsCntntNode()
+                   && GetMark()->nNode.GetNode().GetCntntNode()->getLayoutFrm( GetShell()->GetLayout() ) ) ) )
+    {
+        GetShell()->GetLayout()->CalcFrmRects( *this );
+    }
 }
 
 
diff --git a/sw/source/core/inc/rootfrm.hxx b/sw/source/core/inc/rootfrm.hxx
index 073bc99..07bddbd 100644
--- a/sw/source/core/inc/rootfrm.hxx
+++ b/sw/source/core/inc/rootfrm.hxx
@@ -268,9 +268,7 @@ public:
     // next page border
     const SwPageFrm* GetPageAtPos( const Point& rPt, const Size* pSize = 0, bool bExtend = false ) const;
 
-    void CalcFrmRects(
-        SwShellCrsr&,
-        const sal_Bool bIsTblSel );
+    void CalcFrmRects( SwShellCrsr& );
 
     // Calculates the cells included from the current selection
     // false: There was no result because of an invalid layout
diff --git a/sw/source/core/layout/trvlfrm.cxx b/sw/source/core/layout/trvlfrm.cxx
index 945dec2..998136d 100644
--- a/sw/source/core/layout/trvlfrm.cxx
+++ b/sw/source/core/layout/trvlfrm.cxx
@@ -2006,8 +2006,7 @@ inline void Sub( SwRegionRects& rRegion, const SwRect& rRect )
 }
 
 void SwRootFrm::CalcFrmRects(
-    SwShellCrsr &rCrsr,
-    const sal_Bool bIsTblMode )
+    SwShellCrsr &rCrsr )
 {
     SwPosition *pStartPos = rCrsr.Start(),
                *pEndPos   = rCrsr.GetPoint() == pStartPos ? rCrsr.GetMark() : rCrsr.GetPoint();
@@ -2051,523 +2050,513 @@ void SwRootFrm::CalcFrmRects(
         }
     }
 
-    //Fall 4: Tabellenselection
-    if( bIsTblMode )
-    {
-        const SwFrm *pCell = pStartFrm->GetUpper();
-        while ( !pCell->IsCellFrm() )
-            pCell = pCell->GetUpper();
-        SwRect aTmp( pCell->Prt() );
-        aTmp.Pos() += pCell->Frm().Pos();
-        aRegion.ChangeOrigin( aTmp );
-        aRegion.Remove( 0, aRegion.Count() );
-        aRegion.Insert( aTmp, 0 );
-    }
-    else
-    {
-        // falls eine nicht erlaubte Selection besteht, dann korrigiere das
-        // nicht erlaubt ist Header/Footer/TableHeadline ueber 2 Seiten
-        do {    // middle check loop
-            const SwLayoutFrm* pSttLFrm = pStartFrm->GetUpper();
-            const sal_uInt16 cHdFtTblHd = FRM_HEADER | FRM_FOOTER | FRM_TAB;
-            while( pSttLFrm &&
-                ! (cHdFtTblHd & pSttLFrm->GetType() ))
-                pSttLFrm = pSttLFrm->GetUpper();
-            if( !pSttLFrm )
-                break;
-            const SwLayoutFrm* pEndLFrm = pEndFrm->GetUpper();
-            while( pEndLFrm &&
-                ! (cHdFtTblHd & pEndLFrm->GetType() ))
-                pEndLFrm = pEndLFrm->GetUpper();
-            if( !pEndLFrm )
-                break;
+    // falls eine nicht erlaubte Selection besteht, dann korrigiere das
+    // nicht erlaubt ist Header/Footer/TableHeadline ueber 2 Seiten
+    do
+    {   // middle check loop
+        const SwLayoutFrm* pSttLFrm = pStartFrm->GetUpper();
+        const sal_uInt16 cHdFtTblHd = FRM_HEADER | FRM_FOOTER | FRM_TAB;
+        while ( pSttLFrm
+                && !( cHdFtTblHd & pSttLFrm->GetType() ) )
+        {
+            pSttLFrm = pSttLFrm->GetUpper();
+        }
+        if ( !pSttLFrm )
+            break;
+        const SwLayoutFrm* pEndLFrm = pEndFrm->GetUpper();
+        while ( pEndLFrm
+                && !( cHdFtTblHd & pEndLFrm->GetType() ) )
+        {
+            pEndLFrm = pEndLFrm->GetUpper();
+        }
+        if ( !pEndLFrm )
+            break;
 
-            ASSERT( pEndLFrm->GetType() == pSttLFrm->GetType(),
-                "Selection ueber unterschiedliche Inhalte" );
-            switch( pSttLFrm->GetType() )
-            {
-            case FRM_HEADER:
+        ASSERT( pEndLFrm->GetType() == pSttLFrm->GetType(),
+            "Selection ueber unterschiedliche Inhalte" );
+        switch (pSttLFrm->GetType())
+        {
+        case FRM_HEADER:
             case FRM_FOOTER:
-                // auf unterschiedlichen Seiten ??
-                // dann immer auf die Start-Seite
-                if( pEndLFrm->FindPageFrm() != pSttLFrm->FindPageFrm() )
-                {
-                    // End- auf den Start-CntntFrame setzen
-                    if( pStartPos == rCrsr.GetPoint() )
-                        pEndFrm = pStartFrm;
-                    else
-                        pStartFrm = pEndFrm;
-                }
-                break;
-            case FRM_TAB:
-                // auf unterschiedlichen Seiten ??
-                // existiert
-                // dann teste auf Tabelle-Headline
-                {
-                    const SwTabFrm* pTabFrm = (SwTabFrm*)pSttLFrm;
-                    if( ( pTabFrm->GetFollow() ||
-                        ((SwTabFrm*)pEndLFrm)->GetFollow() ) &&
-                        pTabFrm->GetTable()->GetRowsToRepeat() > 0 &&
-                        pTabFrm->GetLower() != ((SwTabFrm*)pEndLFrm)->GetLower() &&
-                        ( lcl_IsInRepeatedHeadline( pStartFrm ) ||
-                        lcl_IsInRepeatedHeadline( pEndFrm ) ) )
-                    {
-                        // End- auf den Start-CntntFrame setzen
-                        if( pStartPos == rCrsr.GetPoint() )
-                            pEndFrm = pStartFrm;
-                        else
-                            pStartFrm = pEndFrm;
-                    }
-                }
-                break;
+            // auf unterschiedlichen Seiten ??
+            // dann immer auf die Start-Seite
+            if ( pEndLFrm->FindPageFrm() != pSttLFrm->FindPageFrm() )
+            {
+                // End- auf den Start-CntntFrame setzen
+                if ( pStartPos == rCrsr.GetPoint() )
+                    pEndFrm = pStartFrm;
+                else
+                    pStartFrm = pEndFrm;
             }
-        } while( sal_False );
-
-        SwCrsrMoveState aTmpState( MV_NONE );
-        aTmpState.b2Lines = sal_True;
-        aTmpState.bNoScroll = sal_True;
-        aTmpState.nCursorBidiLevel = pStartFrm->IsRightToLeft() ? 1 : 0;
-
-        //CntntRects zu Start- und EndFrms.
-        SwRect aStRect, aEndRect;
-        pStartFrm->GetCharRect( aStRect, *pStartPos, &aTmpState );
-        Sw2LinesPos *pSt2Pos = aTmpState.p2Lines;
-        aTmpState.p2Lines = NULL;
-        aTmpState.nCursorBidiLevel = pEndFrm->IsRightToLeft() ? 1 : 0;
-
-        pEndFrm->GetCharRect  ( aEndRect, *pEndPos, &aTmpState );
-        Sw2LinesPos *pEnd2Pos = aTmpState.p2Lines;
-
-        SwRect aStFrm ( pStartFrm->UnionFrm( sal_True ) );
-        aStFrm.Intersection( pStartFrm->PaintArea() );
-        SwRect aEndFrm( pStartFrm == pEndFrm ? aStFrm : pEndFrm->UnionFrm( sal_True ) );
-        if( pStartFrm != pEndFrm )
+            break;
+        case FRM_TAB:
+            // auf unterschiedlichen Seiten ??
+            // existiert
+            // dann teste auf Tabelle-Headline
         {
-            aEndFrm.Intersection( pEndFrm->PaintArea() );
+            const SwTabFrm* pTabFrm = (SwTabFrm*) pSttLFrm;
+            if ( ( pTabFrm->GetFollow()
+                   || ( (SwTabFrm*) pEndLFrm )->GetFollow() )
+                 && pTabFrm->GetTable()->GetRowsToRepeat() > 0
+                 && pTabFrm->GetLower() != ( (SwTabFrm*) pEndLFrm )->GetLower()
+                 && ( lcl_IsInRepeatedHeadline( pStartFrm )
+                      || lcl_IsInRepeatedHeadline( pEndFrm ) ) )
+            {
+                // End- auf den Start-CntntFrame setzen
+                if ( pStartPos == rCrsr.GetPoint() )
+                    pEndFrm = pStartFrm;
+                else
+                    pStartFrm = pEndFrm;
+            }
         }
-        SWRECTFN( pStartFrm )
-        const sal_Bool bR2L = pStartFrm->IsRightToLeft();
-        const sal_Bool bEndR2L = pEndFrm->IsRightToLeft();
-
-        // If there's no doubleline portion involved or start and end are both
-        // in the same doubleline portion, all works fine, but otherwise
-        // we need the following...
-        if( pSt2Pos != pEnd2Pos && ( !pSt2Pos || !pEnd2Pos ||
-            pSt2Pos->aPortion != pEnd2Pos->aPortion ) )
+            break;
+        }
+    } while ( sal_False);
+
+    SwCrsrMoveState aTmpState( MV_NONE );
+    aTmpState.b2Lines = sal_True;
+    aTmpState.bNoScroll = sal_True;
+    aTmpState.nCursorBidiLevel = pStartFrm->IsRightToLeft() ? 1 : 0;
+
+    //CntntRects zu Start- und EndFrms.
+    SwRect aStRect, aEndRect;
+    pStartFrm->GetCharRect( aStRect, *pStartPos, &aTmpState );
+    Sw2LinesPos *pSt2Pos = aTmpState.p2Lines;
+    aTmpState.p2Lines = NULL;
+    aTmpState.nCursorBidiLevel = pEndFrm->IsRightToLeft() ? 1 : 0;
+
+    pEndFrm->GetCharRect( aEndRect, *pEndPos, &aTmpState );
+    Sw2LinesPos *pEnd2Pos = aTmpState.p2Lines;
+
+    SwRect aStFrm( pStartFrm->UnionFrm( sal_True ) );
+    aStFrm.Intersection( pStartFrm->PaintArea() );
+    SwRect aEndFrm( pStartFrm == pEndFrm ? aStFrm : pEndFrm->UnionFrm( sal_True ) );
+    if ( pStartFrm != pEndFrm )
+    {
+        aEndFrm.Intersection( pEndFrm->PaintArea() );
+    }
+    SWRECTFN( pStartFrm )
+    const sal_Bool bR2L = pStartFrm->IsRightToLeft();
+    const sal_Bool bEndR2L = pEndFrm->IsRightToLeft();
+
+    // If there's no doubleline portion involved or start and end are both
+    // in the same doubleline portion, all works fine, but otherwise
+    // we need the following...
+    if ( pSt2Pos != pEnd2Pos
+         && ( !pSt2Pos || !pEnd2Pos || pSt2Pos->aPortion != pEnd2Pos->aPortion ) )
+    {
+        // If we have a start(end) position inside a doubleline portion
+        // the surrounded part of the doubleline portion is subtracted
+        // from the region and the aStRect(aEndRect) is set to the
+        // end(start) of the doubleline portion.
+        if ( pSt2Pos )
         {
-            // If we have a start(end) position inside a doubleline portion
-            // the surrounded part of the doubleline portion is subtracted
-            // from the region and the aStRect(aEndRect) is set to the
-            // end(start) of the doubleline portion.
-            if( pSt2Pos )
-            {
-                SwRect aTmp( aStRect );
+            SwRect aTmp( aStRect );
 
-                // BiDi-Portions are swimming against the current.
-                const sal_Bool bPorR2L = ( MT_BIDI == pSt2Pos->nMultiType ) ?
-                    ! bR2L :
-                bR2L;
+            // BiDi-Portions are swimming against the current.
+            const sal_Bool bPorR2L = ( MT_BIDI == pSt2Pos->nMultiType ) ?
+                                                                          !bR2L :
+                                                                          bR2L;
 
-                if( MT_BIDI == pSt2Pos->nMultiType &&
-                    (pSt2Pos->aPortion2.*fnRect->fnGetWidth)() )
-                {
-                    // nested bidi portion
-                    long nRightAbs = (pSt2Pos->aPortion.*fnRect->fnGetRight)();
-                    nRightAbs -= (pSt2Pos->aPortion2.*fnRect->fnGetLeft)();
-                    long nLeftAbs = nRightAbs - (pSt2Pos->aPortion2.*fnRect->fnGetWidth)();
+            if ( MT_BIDI == pSt2Pos->nMultiType
+                 && ( pSt2Pos->aPortion2.*fnRect->fnGetWidth )() )
+            {
+                // nested bidi portion
+                long nRightAbs = ( pSt2Pos->aPortion.*fnRect->fnGetRight )();
+                nRightAbs -= ( pSt2Pos->aPortion2.*fnRect->fnGetLeft )();
+                long nLeftAbs = nRightAbs - ( pSt2Pos->aPortion2.*fnRect->fnGetWidth )();
 
-                    (aTmp.*fnRect->fnSetRight)( nRightAbs );
+                ( aTmp.*fnRect->fnSetRight )( nRightAbs );
 
-                    if ( ! pEnd2Pos || pEnd2Pos->aPortion != pSt2Pos->aPortion )
-                    {
-                        SwRect aTmp2( pSt2Pos->aPortion );
-                        (aTmp2.*fnRect->fnSetRight)( nLeftAbs );
-                        aTmp2.Intersection( aEndFrm );
-                        Sub( aRegion, aTmp2 );
-                    }
-                }
-                else
+                if ( !pEnd2Pos || pEnd2Pos->aPortion != pSt2Pos->aPortion )
                 {
-                    if( bPorR2L )
-                        (aTmp.*fnRect->fnSetLeft)(
-                            (pSt2Pos->aPortion.*fnRect->fnGetLeft)() );
-                    else
-                        (aTmp.*fnRect->fnSetRight)(
-                            (pSt2Pos->aPortion.*fnRect->fnGetRight)() );
+                    SwRect aTmp2( pSt2Pos->aPortion );
+                    ( aTmp2.*fnRect->fnSetRight )( nLeftAbs );
+                    aTmp2.Intersection( aEndFrm );
+                    Sub( aRegion, aTmp2 );
                 }
+            }
+            else
+            {
+                if ( bPorR2L )
+                    ( aTmp.*fnRect->fnSetLeft )(
+                        ( pSt2Pos->aPortion.*fnRect->fnGetLeft )() );
+                else
+                    ( aTmp.*fnRect->fnSetRight )(
+                        ( pSt2Pos->aPortion.*fnRect->fnGetRight )() );
+            }
+
+            if ( MT_ROT_90 == pSt2Pos->nMultiType
+                 || ( pSt2Pos->aPortion.*fnRect->fnGetTop )() == ( aTmp.*fnRect->fnGetTop )() )
+            {
+                ( aTmp.*fnRect->fnSetTop )(
+                    ( pSt2Pos->aLine.*fnRect->fnGetTop )() );
+            }
+
+            aTmp.Intersection( aStFrm );
+            Sub( aRegion, aTmp );
 
-                if( MT_ROT_90 == pSt2Pos->nMultiType ||
-                    (pSt2Pos->aPortion.*fnRect->fnGetTop)() ==
-                    (aTmp.*fnRect->fnGetTop)() )
+            SwTwips nTmp = ( pSt2Pos->aLine.*fnRect->fnGetBottom )();
+            if ( MT_ROT_90 != pSt2Pos->nMultiType
+                 && ( aStRect.*fnRect->fnBottomDist )( nTmp ) > 0 )
+            {
+                ( aTmp.*fnRect->fnSetTop )( ( aTmp.*fnRect->fnGetBottom )() );
+                ( aTmp.*fnRect->fnSetBottom )( nTmp );
+                if ( ( aStRect.*fnRect->fnBottomDist )( ( pSt2Pos->aPortion.*fnRect->fnGetBottom )() ) > 0 )
                 {
-                    (aTmp.*fnRect->fnSetTop)(
-                        (pSt2Pos->aLine.*fnRect->fnGetTop)() );
+                    if ( bPorR2L )
+                        ( aTmp.*fnRect->fnSetRight )(
+                            ( pSt2Pos->aPortion.*fnRect->fnGetRight )() );
+                    else
+                        ( aTmp.*fnRect->fnSetLeft )(
+                            ( pSt2Pos->aPortion.*fnRect->fnGetLeft )() );
                 }
-
                 aTmp.Intersection( aStFrm );
                 Sub( aRegion, aTmp );
+            }
 
-                SwTwips nTmp = (pSt2Pos->aLine.*fnRect->fnGetBottom)();
-                if( MT_ROT_90 != pSt2Pos->nMultiType &&
-                    (aStRect.*fnRect->fnBottomDist)( nTmp ) > 0 )
-                {
-                    (aTmp.*fnRect->fnSetTop)( (aTmp.*fnRect->fnGetBottom)() );
-                    (aTmp.*fnRect->fnSetBottom)( nTmp );
-                    if( (aStRect.*fnRect->fnBottomDist)(
-                        (pSt2Pos->aPortion.*fnRect->fnGetBottom)() ) > 0 )
-                    {
-                        if( bPorR2L )
-                            (aTmp.*fnRect->fnSetRight)(
-                                (pSt2Pos->aPortion.*fnRect->fnGetRight)() );
-                        else
-                            (aTmp.*fnRect->fnSetLeft)(
-                                (pSt2Pos->aPortion.*fnRect->fnGetLeft)() );
-                    }
-                    aTmp.Intersection( aStFrm );
-                    Sub( aRegion, aTmp );
-                }
+            aStRect = pSt2Pos->aLine;
+            ( aStRect.*fnRect->fnSetLeft )( bR2L ?
+                                                   ( pSt2Pos->aPortion.*fnRect->fnGetLeft )() :
+                                                   ( pSt2Pos->aPortion.*fnRect->fnGetRight )() );
+            ( aStRect.*fnRect->fnSetWidth )( 1 );
+        }
 
-                aStRect = pSt2Pos->aLine;
-                (aStRect.*fnRect->fnSetLeft)( bR2L ?
-                        (pSt2Pos->aPortion.*fnRect->fnGetLeft)() :
-                        (pSt2Pos->aPortion.*fnRect->fnGetRight)() );
-                (aStRect.*fnRect->fnSetWidth)( 1 );
-            }
+        if ( pEnd2Pos )
+        {
+            SWRECTFNX( pEndFrm )
+            SwRect aTmp( aEndRect );
 
-            if( pEnd2Pos )
+            // BiDi-Portions are swimming against the current.
+            const sal_Bool bPorR2L = ( MT_BIDI == pEnd2Pos->nMultiType ) ?
+                                                                           !bEndR2L :
+                                                                           bEndR2L;
+
+            if ( MT_BIDI == pEnd2Pos->nMultiType
+                 && ( pEnd2Pos->aPortion2.*fnRectX->fnGetWidth )() )
             {
-                SWRECTFNX( pEndFrm )
-                SwRect aTmp( aEndRect );
+                // nested bidi portion
+                long nRightAbs = ( pEnd2Pos->aPortion.*fnRectX->fnGetRight )();
+                nRightAbs = nRightAbs - ( pEnd2Pos->aPortion2.*fnRectX->fnGetLeft )();
+                long nLeftAbs = nRightAbs - ( pEnd2Pos->aPortion2.*fnRectX->fnGetWidth )();
 
-                // BiDi-Portions are swimming against the current.
-                const sal_Bool bPorR2L = ( MT_BIDI == pEnd2Pos->nMultiType ) ?
-                                           ! bEndR2L :
-                                             bEndR2L;
+                ( aTmp.*fnRectX->fnSetLeft )( nLeftAbs );
 
-                if( MT_BIDI == pEnd2Pos->nMultiType &&
-                    (pEnd2Pos->aPortion2.*fnRectX->fnGetWidth)() )
+                if ( !pSt2Pos || pSt2Pos->aPortion != pEnd2Pos->aPortion )
                 {
-                    // nested bidi portion
-                    long nRightAbs = (pEnd2Pos->aPortion.*fnRectX->fnGetRight)();
-                    nRightAbs = nRightAbs - (pEnd2Pos->aPortion2.*fnRectX->fnGetLeft)();
-                    long nLeftAbs = nRightAbs - (pEnd2Pos->aPortion2.*fnRectX->fnGetWidth)();
-
-                    (aTmp.*fnRectX->fnSetLeft)( nLeftAbs );
-
-                    if ( ! pSt2Pos || pSt2Pos->aPortion != pEnd2Pos->aPortion )
-                    {
-                        SwRect aTmp2( pEnd2Pos->aPortion );
-                        (aTmp2.*fnRectX->fnSetLeft)( nRightAbs );
-                        aTmp2.Intersection( aEndFrm );
-                        Sub( aRegion, aTmp2 );
-                    }
+                    SwRect aTmp2( pEnd2Pos->aPortion );
+                    ( aTmp2.*fnRectX->fnSetLeft )( nRightAbs );
+                    aTmp2.Intersection( aEndFrm );
+                    Sub( aRegion, aTmp2 );
                 }
+            }
+            else
+            {
+                if ( bPorR2L )
+                    ( aTmp.*fnRectX->fnSetRight )(
+                        ( pEnd2Pos->aPortion.*fnRectX->fnGetRight )() );
                 else
-                {
-                    if ( bPorR2L )
-                        (aTmp.*fnRectX->fnSetRight)(
-                            (pEnd2Pos->aPortion.*fnRectX->fnGetRight)() );
-                    else
-                        (aTmp.*fnRectX->fnSetLeft)(
-                            (pEnd2Pos->aPortion.*fnRectX->fnGetLeft)() );
-                }
+                    ( aTmp.*fnRectX->fnSetLeft )(
+                        ( pEnd2Pos->aPortion.*fnRectX->fnGetLeft )() );
+            }
 
-                if( MT_ROT_90 == pEnd2Pos->nMultiType ||
-                    (pEnd2Pos->aPortion.*fnRectX->fnGetBottom)() ==
-                    (aEndRect.*fnRectX->fnGetBottom)() )
-                {
-                    (aTmp.*fnRectX->fnSetBottom)(
-                        (pEnd2Pos->aLine.*fnRectX->fnGetBottom)() );
-                }
+            if ( MT_ROT_90 == pEnd2Pos->nMultiType
+                 || ( pEnd2Pos->aPortion.*fnRectX->fnGetBottom )() == ( aEndRect.*fnRectX->fnGetBottom )() )
+            {
+                ( aTmp.*fnRectX->fnSetBottom )(
+                    ( pEnd2Pos->aLine.*fnRectX->fnGetBottom )() );
+            }
 
-                aTmp.Intersection( aEndFrm );
-                Sub( aRegion, aTmp );
+            aTmp.Intersection( aEndFrm );
+            Sub( aRegion, aTmp );
 
-                // The next statement means neither ruby nor rotate(90):
-                if( !( MT_RUBY & pEnd2Pos->nMultiType ) )
+            // The next statement means neither ruby nor rotate(90):
+            if ( !( MT_RUBY & pEnd2Pos->nMultiType ) )
+            {
+                SwTwips nTmp = ( pEnd2Pos->aLine.*fnRectX->fnGetTop )();
+                if ( ( aEndRect.*fnRectX->fnGetTop )() != nTmp )
                 {
-                    SwTwips nTmp = (pEnd2Pos->aLine.*fnRectX->fnGetTop)();
-                    if( (aEndRect.*fnRectX->fnGetTop)() != nTmp )
+                    ( aTmp.*fnRectX->fnSetBottom )(
+                        ( aTmp.*fnRectX->fnGetTop )() );
+                    ( aTmp.*fnRectX->fnSetTop )( nTmp );
+                    if ( ( aEndRect.*fnRectX->fnGetTop )() !=
+                         ( pEnd2Pos->aPortion.*fnRectX->fnGetTop )() )
                     {
-                        (aTmp.*fnRectX->fnSetBottom)(
-                            (aTmp.*fnRectX->fnGetTop)() );
-                        (aTmp.*fnRectX->fnSetTop)( nTmp );
-                        if( (aEndRect.*fnRectX->fnGetTop)() !=
-                            (pEnd2Pos->aPortion.*fnRectX->fnGetTop)() )
-                        {
-                            if( bPorR2L )
-                                (aTmp.*fnRectX->fnSetLeft)(
-                                    (pEnd2Pos->aPortion.*fnRectX->fnGetLeft)() );
-                            else
-                                (aTmp.*fnRectX->fnSetRight)(
-                                    (pEnd2Pos->aPortion.*fnRectX->fnGetRight)() );
-                        }
-                        aTmp.Intersection( aEndFrm );
-                        Sub( aRegion, aTmp );
+                        if ( bPorR2L )
+                            ( aTmp.*fnRectX->fnSetLeft )(
+                                ( pEnd2Pos->aPortion.*fnRectX->fnGetLeft )() );
+                        else
+                            ( aTmp.*fnRectX->fnSetRight )(
+                                ( pEnd2Pos->aPortion.*fnRectX->fnGetRight )() );
                     }
+                    aTmp.Intersection( aEndFrm );
+                    Sub( aRegion, aTmp );
                 }
-
-                aEndRect = pEnd2Pos->aLine;
-                (aEndRect.*fnRectX->fnSetLeft)( bEndR2L ?
-                        (pEnd2Pos->aPortion.*fnRectX->fnGetRight)() :
-                        (pEnd2Pos->aPortion.*fnRectX->fnGetLeft)() );
-                (aEndRect.*fnRectX->fnSetWidth)( 1 );
-            }
-        }
-        else if( pSt2Pos && pEnd2Pos &&
-                 MT_BIDI == pSt2Pos->nMultiType &&
-                 MT_BIDI == pEnd2Pos->nMultiType &&
-                 pSt2Pos->aPortion == pEnd2Pos->aPortion &&
-                 pSt2Pos->aPortion2 != pEnd2Pos->aPortion2 )
-        {
-            // This is the ugly special case, where the selection starts and
-            // ends in the same bidi portion but one start or end is inside a
-            // nested bidi portion.
-
-            if ( (pSt2Pos->aPortion2.*fnRect->fnGetWidth)() )
-            {
-                SwRect aTmp( aStRect );
-                long nRightAbs = (pSt2Pos->aPortion.*fnRect->fnGetRight)();
-                nRightAbs -= (pSt2Pos->aPortion2.*fnRect->fnGetLeft)();
-                long nLeftAbs = nRightAbs - (pSt2Pos->aPortion2.*fnRect->fnGetWidth)();
-
-                (aTmp.*fnRect->fnSetRight)( nRightAbs );
-                aTmp.Intersection( aStFrm );
-                Sub( aRegion, aTmp );
-
-                aStRect = pSt2Pos->aLine;
-                (aStRect.*fnRect->fnSetLeft)( bR2L ? nRightAbs : nLeftAbs );
-                (aStRect.*fnRect->fnSetWidth)( 1 );
             }
 
-            SWRECTFNX( pEndFrm )
-            if ( (pEnd2Pos->aPortion2.*fnRectX->fnGetWidth)() )
-            {
-                SwRect aTmp( aEndRect );
-                long nRightAbs = (pEnd2Pos->aPortion.*fnRectX->fnGetRight)();
-                nRightAbs -= (pEnd2Pos->aPortion2.*fnRectX->fnGetLeft)();
-                long nLeftAbs = nRightAbs - (pEnd2Pos->aPortion2.*fnRectX->fnGetWidth)();
+            aEndRect = pEnd2Pos->aLine;
+            ( aEndRect.*fnRectX->fnSetLeft )( bEndR2L ?
+                                                        ( pEnd2Pos->aPortion.*fnRectX->fnGetRight )() :
+                                                        ( pEnd2Pos->aPortion.*fnRectX->fnGetLeft )() );
+            ( aEndRect.*fnRectX->fnSetWidth )( 1 );
+        }
+    }
+    else if ( pSt2Pos && pEnd2Pos
+              && MT_BIDI == pSt2Pos->nMultiType
+              && MT_BIDI == pEnd2Pos->nMultiType
+              && pSt2Pos->aPortion == pEnd2Pos->aPortion
+              && pSt2Pos->aPortion2 != pEnd2Pos->aPortion2 )
+    {
+        // This is the ugly special case, where the selection starts and
+        // ends in the same bidi portion but one start or end is inside a
+        // nested bidi portion.
 
-                (aTmp.*fnRectX->fnSetLeft)( nLeftAbs );
-                aTmp.Intersection( aEndFrm );
-                Sub( aRegion, aTmp );
+        if ( ( pSt2Pos->aPortion2.*fnRect->fnGetWidth )() )
+        {
+            SwRect aTmp( aStRect );
+            long nRightAbs = ( pSt2Pos->aPortion.*fnRect->fnGetRight )();
+            nRightAbs -= ( pSt2Pos->aPortion2.*fnRect->fnGetLeft )();
+            long nLeftAbs = nRightAbs - ( pSt2Pos->aPortion2.*fnRect->fnGetWidth )();
+
+            ( aTmp.*fnRect->fnSetRight )( nRightAbs );
+            aTmp.Intersection( aStFrm );
+            Sub( aRegion, aTmp );
+
+            aStRect = pSt2Pos->aLine;
+            ( aStRect.*fnRect->fnSetLeft )( bR2L ? nRightAbs : nLeftAbs );
+            ( aStRect.*fnRect->fnSetWidth )( 1 );
+        }
 
-                aEndRect = pEnd2Pos->aLine;
-                (aEndRect.*fnRectX->fnSetLeft)( bEndR2L ? nLeftAbs : nRightAbs );
-                (aEndRect.*fnRectX->fnSetWidth)( 1 );
-            }
+        SWRECTFNX( pEndFrm )
+        if ( ( pEnd2Pos->aPortion2.*fnRectX->fnGetWidth )() )
+        {
+            SwRect aTmp( aEndRect );
+            long nRightAbs = ( pEnd2Pos->aPortion.*fnRectX->fnGetRight )();
+            nRightAbs -= ( pEnd2Pos->aPortion2.*fnRectX->fnGetLeft )();
+            long nLeftAbs = nRightAbs - ( pEnd2Pos->aPortion2.*fnRectX->fnGetWidth )();
+
+            ( aTmp.*fnRectX->fnSetLeft )( nLeftAbs );
+            aTmp.Intersection( aEndFrm );
+            Sub( aRegion, aTmp );
+
+            aEndRect = pEnd2Pos->aLine;
+            ( aEndRect.*fnRectX->fnSetLeft )( bEndR2L ? nLeftAbs : nRightAbs );
+            ( aEndRect.*fnRectX->fnSetWidth )( 1 );
         }
+    }
 
-        // The charrect may be outside the paintarea (for cursortravelling)
-        // but the selection has to be restricted to the paintarea
-        if( aStRect.Left() < aStFrm.Left() )
-            aStRect.Left( aStFrm.Left() );
-        else if( aStRect.Left() > aStFrm.Right() )
-            aStRect.Left( aStFrm.Right() );
-        SwTwips nTmp = aStRect.Right();
-        if( nTmp < aStFrm.Left() )
-            aStRect.Right( aStFrm.Left() );
-        else if( nTmp > aStFrm.Right() )
-            aStRect.Right( aStFrm.Right() );
-        if( aEndRect.Left() < aEndFrm.Left() )
-            aEndRect.Left( aEndFrm.Left() );
-        else if( aEndRect.Left() > aEndFrm.Right() )
-            aEndRect.Left( aEndFrm.Right() );
-        nTmp = aEndRect.Right();
-        if( nTmp < aEndFrm.Left() )
-            aEndRect.Right( aEndFrm.Left() );
-        else if( nTmp > aEndFrm.Right() )
-            aEndRect.Right( aEndFrm.Right() );
-
-        if( pStartFrm == pEndFrm )
+    // The charrect may be outside the paintarea (for cursortravelling)
+    // but the selection has to be restricted to the paintarea
+    if ( aStRect.Left() < aStFrm.Left() )
+        aStRect.Left( aStFrm.Left() );
+    else if ( aStRect.Left() > aStFrm.Right() )
+        aStRect.Left( aStFrm.Right() );
+    SwTwips nTmp = aStRect.Right();
+    if ( nTmp < aStFrm.Left() )
+        aStRect.Right( aStFrm.Left() );
+    else if ( nTmp > aStFrm.Right() )
+        aStRect.Right( aStFrm.Right() );
+    if ( aEndRect.Left() < aEndFrm.Left() )
+        aEndRect.Left( aEndFrm.Left() );
+    else if ( aEndRect.Left() > aEndFrm.Right() )
+        aEndRect.Left( aEndFrm.Right() );
+    nTmp = aEndRect.Right();
+    if ( nTmp < aEndFrm.Left() )
+        aEndRect.Right( aEndFrm.Left() );
+    else if ( nTmp > aEndFrm.Right() )
+        aEndRect.Right( aEndFrm.Right() );
+
+    if ( pStartFrm == pEndFrm )
+    {
+        sal_Bool bSameRotatedOrBidi = pSt2Pos && pEnd2Pos
+                                      && ( MT_BIDI & pSt2Pos->nMultiType )
+                                      && pSt2Pos->aPortion == pEnd2Pos->aPortion;
+        //case 1: (Same frame and same row)
+        if ( bSameRotatedOrBidi
+             || ( aStRect.*fnRect->fnGetTop )() == ( aEndRect.*fnRect->fnGetTop )() )
         {
-            sal_Bool bSameRotatedOrBidi = pSt2Pos && pEnd2Pos &&
-                ( MT_BIDI & pSt2Pos->nMultiType ) &&
-                pSt2Pos->aPortion == pEnd2Pos->aPortion;
-            //case 1: (Same frame and same row)
-            if( bSameRotatedOrBidi ||
-                (aStRect.*fnRect->fnGetTop)() == (aEndRect.*fnRect->fnGetTop)() )
+            Point aTmpSt( aStRect.Pos() );
+            Point aTmpEnd( aEndRect.Right(), aEndRect.Bottom() );
+            if ( bSameRotatedOrBidi || bR2L )
             {
-                Point aTmpSt( aStRect.Pos() );
-                Point aTmpEnd( aEndRect.Right(), aEndRect.Bottom() );
-                if( bSameRotatedOrBidi || bR2L )
+                if ( aTmpSt.Y() > aTmpEnd.Y() )
                 {
-                    if( aTmpSt.Y() > aTmpEnd.Y() )
-                    {
-                        long nTmpY = aTmpEnd.Y();
-                        aTmpEnd.Y() = aTmpSt.Y();
-                        aTmpSt.Y() = nTmpY;
-                    }
-                    if( aTmpSt.X() > aTmpEnd.X() )
-                    {
-                        long nTmpX = aTmpEnd.X();
-                        aTmpEnd.X() = aTmpSt.X();
-                        aTmpSt.X() = nTmpX;
-                    }
+                    long nTmpY = aTmpEnd.Y();
+                    aTmpEnd.Y() = aTmpSt.Y();
+                    aTmpSt.Y() = nTmpY;
                 }
-
-                SwRect aTmp = SwRect( aTmpSt, aTmpEnd );
-                // Bug 34888: falls Inhalt selektiert ist, der keinen Platz
-                //            einnimmt (z.B. PostIts,RefMarks, TOXMarks),
-                //            dann mindestens die Breite des Crsr setzen.
-                if( 1 == (aTmp.*fnRect->fnGetWidth)() &&
-                    pStartPos->nContent.GetIndex() !=
-                    pEndPos->nContent.GetIndex() )
+                if ( aTmpSt.X() > aTmpEnd.X() )
                 {
-                    OutputDevice* pOut = pSh->GetOut();
-                    long nCrsrWidth = pOut->GetSettings().GetStyleSettings().
-                        GetCursorSize();
-                    (aTmp.*fnRect->fnSetWidth)( pOut->PixelToLogic(
-                        Size( nCrsrWidth, 0 ) ).Width() );
+                    long nTmpX = aTmpEnd.X();
+                    aTmpEnd.X() = aTmpSt.X();
+                    aTmpSt.X() = nTmpX;
                 }
-                aTmp.Intersection( aStFrm );
-                Sub( aRegion, aTmp );
             }
-            //case 2: (Same frame, but not the same line)
-            else
-            {
-                SwTwips lLeft, lRight;
-                if( pSt2Pos && pEnd2Pos && pSt2Pos->aPortion == pEnd2Pos->aPortion )
-                {
-                    lLeft = (pSt2Pos->aPortion.*fnRect->fnGetLeft)();
-                    lRight = (pSt2Pos->aPortion.*fnRect->fnGetRight)();
-                }
-                else
-                {
-                    lLeft = (pStartFrm->Frm().*fnRect->fnGetLeft)() +
-                        (pStartFrm->Prt().*fnRect->fnGetLeft)();
-                    lRight = (pStartFrm->Frm().*fnRect->fnGetLeft)() +
-                        (pStartFrm->Prt().*fnRect->fnGetRight)();
-                }
-                if( lLeft < (aStFrm.*fnRect->fnGetLeft)() )
-                    lLeft = (aStFrm.*fnRect->fnGetLeft)();
-                if( lRight > (aStFrm.*fnRect->fnGetRight)() )
-                    lRight = (aStFrm.*fnRect->fnGetRight)();
-                SwRect aSubRect( aStRect );
-                //First line
-                if( bR2L )
-                    (aSubRect.*fnRect->fnSetLeft)( lLeft );
-                else
-                    (aSubRect.*fnRect->fnSetRight)( lRight );
-                Sub( aRegion, aSubRect );
 
-                //If there's at least a twips between start- and endline,
-                //so the whole area between will be added.
-                SwTwips aTmpBottom = (aStRect.*fnRect->fnGetBottom)();
-                SwTwips aTmpTop = (aEndRect.*fnRect->fnGetTop)();
-                if( aTmpBottom != aTmpTop )
-                {
-                    (aSubRect.*fnRect->fnSetLeft)( lLeft );
-                    (aSubRect.*fnRect->fnSetRight)( lRight );
-                    (aSubRect.*fnRect->fnSetTop)( aTmpBottom );
-                    (aSubRect.*fnRect->fnSetBottom)( aTmpTop );
-                    Sub( aRegion, aSubRect );
-                }
-                //and the last line
-                aSubRect = aEndRect;
-                if( bR2L )
-                    (aSubRect.*fnRect->fnSetRight)( lRight );
-                else
-                    (aSubRect.*fnRect->fnSetLeft)( lLeft );
-                Sub( aRegion, aSubRect );
+            SwRect aTmp = SwRect( aTmpSt, aTmpEnd );
+            // Bug 34888: falls Inhalt selektiert ist, der keinen Platz
+            //            einnimmt (z.B. PostIts,RefMarks, TOXMarks),
+            //            dann mindestens die Breite des Crsr setzen.
+            if ( 1 == ( aTmp.*fnRect->fnGetWidth )() &&
+                 pStartPos->nContent.GetIndex() !=
+                 pEndPos->nContent.GetIndex() )
+            {
+                OutputDevice* pOut = pSh->GetOut();
+                long nCrsrWidth = pOut->GetSettings().GetStyleSettings().
+                        GetCursorSize();
+                ( aTmp.*fnRect->fnSetWidth )( pOut->PixelToLogic(
+                    Size( nCrsrWidth, 0 ) ).Width() );
             }
+            aTmp.Intersection( aStFrm );
+            Sub( aRegion, aTmp );
         }
-        //case 3: (Different frames, maybe with ohther frames between
+        //case 2: (Same frame, but not the same line)
         else
         {
-            //The startframe first...
+            SwTwips lLeft, lRight;
+            if ( pSt2Pos && pEnd2Pos && pSt2Pos->aPortion == pEnd2Pos->aPortion )
+            {
+                lLeft = ( pSt2Pos->aPortion.*fnRect->fnGetLeft )();
+                lRight = ( pSt2Pos->aPortion.*fnRect->fnGetRight )();
+            }
+            else
+            {
+                lLeft = ( pStartFrm->Frm().*fnRect->fnGetLeft )() +
+                        ( pStartFrm->Prt().*fnRect->fnGetLeft )();
+                lRight = ( pStartFrm->Frm().*fnRect->fnGetLeft )() +
+                         ( pStartFrm->Prt().*fnRect->fnGetRight )();
+            }
+            if ( lLeft < ( aStFrm.*fnRect->fnGetLeft )() )
+                lLeft = ( aStFrm.*fnRect->fnGetLeft )();
+            if ( lRight > ( aStFrm.*fnRect->fnGetRight )() )
+                lRight = ( aStFrm.*fnRect->fnGetRight )();
             SwRect aSubRect( aStRect );
-            if( bR2L )
-                (aSubRect.*fnRect->fnSetLeft)( (aStFrm.*fnRect->fnGetLeft)());
+            //First line
+            if ( bR2L )
+                ( aSubRect.*fnRect->fnSetLeft )( lLeft );
             else
-                (aSubRect.*fnRect->fnSetRight)( (aStFrm.*fnRect->fnGetRight)());
+                ( aSubRect.*fnRect->fnSetRight )( lRight );
             Sub( aRegion, aSubRect );
-            SwTwips nTmpTwips = (aStRect.*fnRect->fnGetBottom)();
-            if( (aStFrm.*fnRect->fnGetBottom)() != nTmpTwips )
+
+            //If there's at least a twips between start- and endline,
+            //so the whole area between will be added.
+            SwTwips aTmpBottom = ( aStRect.*fnRect->fnGetBottom )();
+            SwTwips aTmpTop = ( aEndRect.*fnRect->fnGetTop )();
+            if ( aTmpBottom != aTmpTop )
             {
-                aSubRect = aStFrm;
-                (aSubRect.*fnRect->fnSetTop)( nTmpTwips );
+                ( aSubRect.*fnRect->fnSetLeft )( lLeft );
+                ( aSubRect.*fnRect->fnSetRight )( lRight );
+                ( aSubRect.*fnRect->fnSetTop )( aTmpBottom );
+                ( aSubRect.*fnRect->fnSetBottom )( aTmpTop );
                 Sub( aRegion, aSubRect );
             }
+            //and the last line
+            aSubRect = aEndRect;
+            if ( bR2L )
+                ( aSubRect.*fnRect->fnSetRight )( lRight );
+            else
+                ( aSubRect.*fnRect->fnSetLeft )( lLeft );
+            Sub( aRegion, aSubRect );
+        }
+    }
+    //case 3: (Different frames, maybe with ohther frames between
+    else
+    {
+        //The startframe first...
+        SwRect aSubRect( aStRect );
+        if ( bR2L )
+            ( aSubRect.*fnRect->fnSetLeft )( ( aStFrm.*fnRect->fnGetLeft )() );
+        else
+            ( aSubRect.*fnRect->fnSetRight )( ( aStFrm.*fnRect->fnGetRight )() );
+        Sub( aRegion, aSubRect );
+        SwTwips nTmpTwips = ( aStRect.*fnRect->fnGetBottom )();
+        if ( ( aStFrm.*fnRect->fnGetBottom )() != nTmpTwips )
+        {
+            aSubRect = aStFrm;
+            ( aSubRect.*fnRect->fnSetTop )( nTmpTwips );
+            Sub( aRegion, aSubRect );
+        }
 
-            //Now the frames between, if there are any
-            sal_Bool bBody = pStartFrm->IsInDocBody();
-            const SwTableBox* pCellBox = pStartFrm->GetUpper()->IsCellFrm() ?
-                ((SwCellFrm*)pStartFrm->GetUpper())->GetTabBox() : 0;
-            const SwCntntFrm *pCntnt = pStartFrm->GetNextCntntFrm();
-            SwRect aPrvRect;
-
-            ASSERT( pCntnt,
-                "<SwRootFrm::CalcFrmRects(..)> - no content frame. This is a serious defect -> please inform OD" );
-            while ( pCntnt && pCntnt != pEndFrm )
+        //Now the frames between, if there are any
+        sal_Bool bBody = pStartFrm->IsInDocBody();
+        const SwTableBox* pCellBox = pStartFrm->GetUpper()->IsCellFrm() ?
+                                                                          ( (SwCellFrm*) pStartFrm->GetUpper() )->GetTabBox() :
+                                                                          0;
+        const SwCntntFrm *pCntnt = pStartFrm->GetNextCntntFrm();
+        SwRect aPrvRect;
+
+        ASSERT( pCntnt,
+            "<SwRootFrm::CalcFrmRects(..)> - no content frame. This is a serious defect -> please inform OD" );
+        while (pCntnt && pCntnt != pEndFrm)
+        {
+            if ( pCntnt->IsInFly() )
             {
-                if ( pCntnt->IsInFly() )
-                {
-                    const SwAnchoredObject* pObj = pCntnt->FindFlyFrm();
-                    aSortObjs.Insert( *(const_cast<SwAnchoredObject*>(pObj)) );
-                }
+                const SwAnchoredObject* pObj = pCntnt->FindFlyFrm();
+                aSortObjs.Insert( *( const_cast< SwAnchoredObject* >( pObj ) ) );
+            }
 
-                // Consider only frames which have the same IsInDocBody value like pStartFrm
-                // If pStartFrm is inside a SwCellFrm, consider only frames which are inside the
-                // same cell frame (or its follow cell)
-                const SwTableBox* pTmpCellBox = pCntnt->GetUpper()->IsCellFrm() ?
-                    ((SwCellFrm*)pCntnt->GetUpper())->GetTabBox() : 0;
-                if ( bBody == pCntnt->IsInDocBody() &&
-                    ( !pCellBox || pCellBox == pTmpCellBox ) )
+            // Consider only frames which have the same IsInDocBody value like pStartFrm
+            // If pStartFrm is inside a SwCellFrm, consider only frames which are inside the
+            // same cell frame (or its follow cell)
+            const SwTableBox* pTmpCellBox = pCntnt->GetUpper()->IsCellFrm() ?
+                                                                              ( (SwCellFrm*) pCntnt->GetUpper() )->GetTabBox() :
+                                                                              0;
+            if ( bBody == pCntnt->IsInDocBody() &&
+                 ( !pCellBox || pCellBox == pTmpCellBox ) )
+            {
+                SwRect aCRect( pCntnt->UnionFrm( sal_True ) );
+                aCRect.Intersection( pCntnt->PaintArea() );
+                if ( aCRect.IsOver( aRegion.GetOrigin() ) )
                 {
-                    SwRect aCRect( pCntnt->UnionFrm( sal_True ) );
-                    aCRect.Intersection( pCntnt->PaintArea() );
-                    if( aCRect.IsOver( aRegion.GetOrigin() ))
+                    SwRect aTmp( aPrvRect );
+                    aTmp.Union( aCRect );
+                    if ( ( aPrvRect.Height() * aPrvRect.Width() +
+                           aCRect.Height() * aCRect.Width() )
+                         ==
+                         ( aTmp.Height() * aTmp.Width() ) )
                     {
-                        SwRect aTmp( aPrvRect );
-                        aTmp.Union( aCRect );
-                        if ( (aPrvRect.Height() * aPrvRect.Width() +
-                            aCRect.Height()   * aCRect.Width()) ==
-                            (aTmp.Height() * aTmp.Width()) )
-                        {
-                            aPrvRect.Union( aCRect );
-                        }
-                        else
-                        {
-                            if ( aPrvRect.HasArea() )
-                                Sub( aRegion, aPrvRect );
-                            aPrvRect = aCRect;
-                        }
+                        aPrvRect.Union( aCRect );
+                    }
+                    else
+                    {
+                        if ( aPrvRect.HasArea() )
+                            Sub( aRegion, aPrvRect );
+                        aPrvRect = aCRect;
                     }
                 }
-                pCntnt = pCntnt->GetNextCntntFrm();
-                ASSERT( pCntnt,
-                    "<SwRootFrm::CalcFrmRects(..)> - no content frame. This is a serious defect -> please inform OD" );
             }
-            if ( aPrvRect.HasArea() )
-                Sub( aRegion, aPrvRect );
-
-            //At least the endframe...
-            bVert = pEndFrm->IsVertical();
-            bRev = pEndFrm->IsReverse();
-            //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin
-            fnRect = bVert ? ( bRev ? fnRectVL2R : ( pEndFrm->IsVertLR() ? fnRectVertL2R : fnRectVert ) ) :
-                ( bRev ? fnRectB2T : fnRectHori );
-            nTmpTwips = (aEndRect.*fnRect->fnGetTop)();
-            if( (aEndFrm.*fnRect->fnGetTop)() != nTmpTwips )
-            {
-                aSubRect = aEndFrm;
-                (aSubRect.*fnRect->fnSetBottom)( nTmpTwips );
-                Sub( aRegion, aSubRect );
-            }
-            aSubRect = aEndRect;
-            if( bEndR2L )
-                (aSubRect.*fnRect->fnSetRight)((aEndFrm.*fnRect->fnGetRight)());
-            else
-                (aSubRect.*fnRect->fnSetLeft)( (aEndFrm.*fnRect->fnGetLeft)() );
+            pCntnt = pCntnt->GetNextCntntFrm();
+            ASSERT( pCntnt,
+                "<SwRootFrm::CalcFrmRects(..)> - no content frame. This is a serious defect -> please inform OD" );
+        }
+        if ( aPrvRect.HasArea() )
+            Sub( aRegion, aPrvRect );
+
+        //At least the endframe...
+        bVert = pEndFrm->IsVertical();
+        bRev = pEndFrm->IsReverse();
+        //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin
+        fnRect = bVert ? ( bRev ? fnRectVL2R : ( pEndFrm->IsVertLR() ? fnRectVertL2R : fnRectVert ) ) :
+                         ( bRev ? fnRectB2T : fnRectHori );
+        nTmpTwips = ( aEndRect.*fnRect->fnGetTop )();
+        if ( ( aEndFrm.*fnRect->fnGetTop )() != nTmpTwips )
+        {
+            aSubRect = aEndFrm;
+            ( aSubRect.*fnRect->fnSetBottom )( nTmpTwips );
             Sub( aRegion, aSubRect );
         }
-
-        aRegion.Invert();
-        delete pSt2Pos;
-        delete pEnd2Pos;
+        aSubRect = aEndRect;
+        if ( bEndR2L )
+            ( aSubRect.*fnRect->fnSetRight )( ( aEndFrm.*fnRect->fnGetRight )() );
+        else
+            ( aSubRect.*fnRect->fnSetLeft )( ( aEndFrm.*fnRect->fnGetLeft )() );
+        Sub( aRegion, aSubRect );
     }
 
+    aRegion.Invert();
+    delete pSt2Pos;
+    delete pEnd2Pos;
+
     //Flys mit Durchlauf ausstanzen. Nicht ausgestanzt werden Flys:
     //- die Lower des StartFrm/EndFrm sind (FlyInCnt und alle Flys die wiederum
     //  darin sitzen)


More information about the Libreoffice-commits mailing list