LCOV - code coverage report
Current view: top level - sw/source/core/frmedt - fews.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 84 599 14.0 %
Date: 2012-08-25 Functions: 12 34 35.3 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 43 773 5.6 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : 
      30                 :            : #include <svx/svdobj.hxx>
      31                 :            : #include <init.hxx>
      32                 :            : #include <fesh.hxx>
      33                 :            : #include <pagefrm.hxx>
      34                 :            : #include <rootfrm.hxx>
      35                 :            : #include <cntfrm.hxx>
      36                 :            : #include <doc.hxx>
      37                 :            : #include <frmtool.hxx>
      38                 :            : #include <swtable.hxx>
      39                 :            : #include <viewimp.hxx>
      40                 :            : #include <dview.hxx>
      41                 :            : #include <flyfrm.hxx>
      42                 :            : #include <node.hxx>
      43                 :            : #include <pam.hxx>
      44                 :            : #include <sectfrm.hxx>
      45                 :            : #include <fmtpdsc.hxx>
      46                 :            : #include <fmtsrnd.hxx>
      47                 :            : #include <fmtcntnt.hxx>
      48                 :            : #include <tabfrm.hxx>
      49                 :            : #include <cellfrm.hxx>
      50                 :            : #include <flyfrms.hxx>
      51                 :            : #include <txtfrm.hxx>       // SwTxtFrm
      52                 :            : #include <mdiexp.hxx>
      53                 :            : #include <edimp.hxx>
      54                 :            : #include <pagedesc.hxx>
      55                 :            : #include <fmtanchr.hxx>
      56                 :            : #include <environmentofanchoredobject.hxx>
      57                 :            : #include <ndtxt.hxx> // #i22341#
      58                 :            : #include <dflyobj.hxx>
      59                 :            : #include <dcontact.hxx> // #i26791#
      60                 :            : 
      61                 :            : 
      62                 :            : using namespace com::sun::star;
      63                 :            : 
      64                 :            : 
      65 [ +  + ][ +  + ]:    1259291 : TYPEINIT1(SwFEShell,SwEditShell)
      66                 :            : 
      67                 :            : /***********************************************************************
      68                 :            : #*  Class      :  SwFEShell
      69                 :            : #*  Method     :  EndAllActionAndCall()
      70                 :            : #***********************************************************************/
      71                 :            : 
      72                 :          0 : void SwFEShell::EndAllActionAndCall()
      73                 :            : {
      74                 :          0 :     ViewShell *pTmp = this;
      75         [ #  # ]:          0 :     do {
      76         [ #  # ]:          0 :         if( pTmp->IsA( TYPE(SwCrsrShell) ) )
      77                 :            :         {
      78                 :          0 :             ((SwFEShell*)pTmp)->EndAction();
      79                 :          0 :             ((SwFEShell*)pTmp)->CallChgLnk();
      80                 :            :         }
      81                 :            :         else
      82                 :          0 :             pTmp->EndAction();
      83                 :          0 :     } while( this != ( pTmp = (ViewShell*)pTmp->GetNext() ));
      84                 :          0 : }
      85                 :            : 
      86                 :            : 
      87                 :            : /***********************************************************************
      88                 :            : #*  Class       :  SwFEShell
      89                 :            : #*  Method      :  GetCntntPos
      90                 :            : #*  Description :  Determine the Cntnt's nearest to the point
      91                 :            : #***********************************************************************/
      92                 :            : 
      93                 :          0 : Point SwFEShell::GetCntntPos( const Point& rPoint, sal_Bool bNext ) const
      94                 :            : {
      95         [ #  # ]:          0 :     SET_CURR_SHELL( (ViewShell*)this );
      96 [ #  # ][ #  # ]:          0 :     return GetLayout()->GetNextPrevCntntPos( rPoint, bNext );
                 [ #  # ]
      97                 :            : }
      98                 :            : 
      99                 :            : 
     100                 :       4161 : const SwRect& SwFEShell::GetAnyCurRect( CurRectType eType, const Point* pPt,
     101                 :            :                                         const uno::Reference < embed::XEmbeddedObject >& xObj ) const
     102                 :            : {
     103                 :       4161 :     const SwFrm *pFrm = Imp()->HasDrawView()
     104                 :       4161 :                 ? ::GetFlyFromMarked( &Imp()->GetDrawView()->GetMarkedObjectList(),
     105                 :       4161 :                                       (ViewShell*)this)
     106         [ +  - ]:       8322 :                 : 0;
     107                 :            : 
     108         [ +  - ]:       4161 :     if( !pFrm )
     109                 :            :     {
     110         [ -  + ]:       4161 :         if( pPt )
     111                 :            :         {
     112 [ #  # ][ #  # ]:          0 :             SwPosition aPos( *GetCrsr()->GetPoint() );
     113                 :          0 :             Point aPt( *pPt );
     114 [ #  # ][ #  # ]:          0 :             GetLayout()->GetCrsrOfst( &aPos, aPt );
     115                 :          0 :             SwCntntNode *pNd = aPos.nNode.GetNode().GetCntntNode();
     116 [ #  # ][ #  # ]:          0 :             pFrm = pNd->getLayoutFrm( GetLayout(), pPt );
                 [ #  # ]
     117                 :            :         }
     118                 :            :         else
     119                 :            :         {
     120                 :       4161 :             const bool bOldCallbackActionEnabled = GetLayout()->IsCallbackActionEnabled();
     121         [ +  - ]:       4161 :             if( bOldCallbackActionEnabled )
     122                 :       4161 :                 GetLayout()->SetCallbackActionEnabled( sal_False );
     123                 :       4161 :             pFrm = GetCurrFrm();
     124         [ +  - ]:       4161 :             if( bOldCallbackActionEnabled )
     125                 :       4161 :                 GetLayout()->SetCallbackActionEnabled( sal_True );
     126                 :            :         }
     127                 :            :     }
     128                 :            : 
     129         [ -  + ]:       4161 :     if( !pFrm )
     130                 :          0 :         return GetLayout()->Frm();
     131                 :            : 
     132                 :       4161 :     sal_Bool  bFrm  = sal_True;
     133   [ +  +  +  -  :       4161 :     switch ( eType )
          -  -  -  -  -  
                   +  - ]
     134                 :            :     {
     135                 :        695 :         case RECT_PAGE_PRT:         bFrm = sal_False; /* no break */
     136                 :       1387 :         case RECT_PAGE :            pFrm = pFrm->FindPageFrm();
     137                 :       1387 :                                     break;
     138                 :            : 
     139                 :       1387 :         case RECT_PAGE_CALC:        pFrm->Calc();
     140                 :       1387 :                                     pFrm = pFrm->FindPageFrm();
     141                 :       1387 :                                     pFrm->Calc();
     142                 :       1387 :                                     break;
     143                 :            : 
     144                 :          0 :         case RECT_FLY_PRT_EMBEDDED: bFrm = sal_False; /* no break */
     145                 :          0 :         case RECT_FLY_EMBEDDED:     pFrm = xObj.is() ? FindFlyFrm( xObj )
     146                 :          0 :                                                 : pFrm->IsFlyFrm()
     147                 :            :                                                     ? pFrm
     148 [ #  # ][ #  # ]:          0 :                                                     : pFrm->FindFlyFrm();
     149                 :          0 :                                     break;
     150                 :            : 
     151                 :            :         case RECT_OUTTABSECTION_PRT:
     152         [ #  # ]:          0 :         case RECT_OUTTABSECTION :   if( pFrm->IsInTab() )
     153                 :          0 :                                         pFrm = pFrm->FindTabFrm();
     154                 :            :                                     else {
     155                 :            :                                         OSL_FAIL( "Missing Table" );
     156                 :            :                                     }
     157                 :            :                                     /* no break */
     158                 :            :         case RECT_SECTION_PRT:
     159         [ #  # ]:          0 :         case RECT_SECTION:          if( pFrm->IsInSct() )
     160                 :          0 :                                         pFrm = pFrm->FindSctFrm();
     161                 :            :                                     else {
     162                 :            :                                         OSL_FAIL( "Missing section" );
     163                 :            :                                     }
     164                 :            : 
     165 [ #  # ][ #  # ]:          0 :                                     if( RECT_OUTTABSECTION_PRT == eType ||
     166                 :            :                                         RECT_SECTION_PRT == eType )
     167                 :          0 :                                         bFrm = sal_False;
     168                 :          0 :                                     break;
     169                 :            : 
     170                 :          0 :         case RECT_HEADERFOOTER_PRT: bFrm = sal_False; /* no break */
     171         [ #  # ]:          0 :         case RECT_HEADERFOOTER:     if( 0 == (pFrm = pFrm->FindFooterOrHeader()) )
     172                 :          0 :                                         return GetLayout()->Frm();
     173                 :          0 :                                     break;
     174                 :            : 
     175                 :       1387 :         case RECT_PAGES_AREA:       return GetLayout()->GetPagesArea();
     176                 :            : 
     177                 :          0 :         default:                    break;
     178                 :            :     }
     179         [ +  + ]:       4161 :     return bFrm ? pFrm->Frm() : pFrm->Prt();
     180                 :            : }
     181                 :            : 
     182                 :            : 
     183                 :          0 : sal_uInt16 SwFEShell::GetPageNumber( const Point &rPoint ) const
     184                 :            : {
     185                 :          0 :     const SwFrm *pPage = GetLayout()->Lower();
     186 [ #  # ][ #  # ]:          0 :     while ( pPage && !pPage->Frm().IsInside( rPoint ) )
                 [ #  # ]
     187                 :          0 :         pPage = pPage->GetNext();
     188         [ #  # ]:          0 :     if ( pPage )
     189                 :          0 :         return ((const SwPageFrm*)pPage)->GetPhyPageNum();
     190                 :            :     else
     191                 :          0 :         return 0;
     192                 :            : }
     193                 :            : 
     194                 :            : 
     195                 :       1365 : sal_Bool SwFEShell::GetPageNumber( long nYPos, sal_Bool bAtCrsrPos, sal_uInt16& rPhyNum, sal_uInt16& rVirtNum, String &rDisplay) const
     196                 :            : {
     197                 :            :     const SwFrm *pPage;
     198                 :            : 
     199         [ +  - ]:       1365 :     if ( bAtCrsrPos )                   // get page of Crsr
     200                 :            :     {
     201                 :       1365 :         pPage = GetCurrFrm( sal_False );
     202         [ +  - ]:       1365 :         if ( pPage )
     203                 :       1365 :             pPage = pPage->FindPageFrm();
     204                 :            :     }
     205         [ #  # ]:          0 :     else if ( nYPos > -1 )              // determine page via the position
     206                 :            :     {
     207                 :          0 :         pPage = GetLayout()->Lower();
     208         [ #  # ]:          0 :         while( pPage &&  (pPage->Frm().Bottom() < nYPos ||
           [ #  #  #  # ]
                 [ #  # ]
     209                 :          0 :                             nYPos < pPage->Frm().Top() ) )
     210                 :          0 :             pPage = pPage->GetNext();
     211                 :            :     }
     212                 :            :     else                                // first visible page
     213                 :            :     {
     214                 :          0 :         pPage = Imp()->GetFirstVisPage();
     215 [ #  # ][ #  # ]:          0 :         if ( pPage && ((SwPageFrm*)pPage)->IsEmptyPage() )
                 [ #  # ]
     216                 :          0 :             pPage = pPage->GetNext();
     217                 :            :     }
     218                 :            : 
     219         [ +  - ]:       1365 :     if( pPage )
     220                 :            :     {
     221                 :       1365 :         rPhyNum  = ((const SwPageFrm*)pPage)->GetPhyPageNum();
     222                 :       1365 :         rVirtNum = ((const SwPageFrm*)pPage)->GetVirtPageNum();
     223                 :       1365 :         const SvxNumberType& rNum = ((const SwPageFrm*)pPage)->GetPageDesc()->GetNumType();
     224         [ +  - ]:       1365 :         rDisplay = rNum.GetNumStr( rVirtNum );
     225                 :            :     }
     226                 :            : 
     227                 :       1365 :     return 0 != pPage;
     228                 :            : }
     229                 :            : 
     230                 :            : /*************************************************************************
     231                 :            : |*
     232                 :            : |*  SwFEShell::IsDirectlyInSection()
     233                 :            : |*
     234                 :            : |*  Hack for OS:
     235                 :            : |*
     236                 :            : *************************************************************************/
     237                 :            : 
     238                 :       1367 : bool SwFEShell::IsDirectlyInSection() const
     239                 :            : {
     240                 :       1367 :     SwFrm* pFrm = GetCurrFrm( sal_False );
     241 [ +  - ][ -  + ]:       1367 :     return pFrm && pFrm->GetUpper() && pFrm->GetUpper()->IsSctFrm();
                 [ +  - ]
     242                 :            : }
     243                 :            : 
     244                 :            : /*************************************************************************
     245                 :            : |*
     246                 :            : |*  SwFEShell::GetFrmType()
     247                 :            : |*
     248                 :            : *************************************************************************/
     249                 :            : 
     250                 :       5806 : sal_uInt16 SwFEShell::GetFrmType( const Point *pPt, sal_Bool bStopAtFly ) const
     251                 :            : {
     252                 :       5806 :     sal_uInt16 nReturn = FRMTYPE_NONE;
     253                 :            :     const SwFrm *pFrm;
     254         [ -  + ]:       5806 :     if ( pPt )
     255                 :            :     {
     256 [ #  # ][ #  # ]:          0 :         SwPosition aPos( *GetCrsr()->GetPoint() );
     257                 :          0 :         Point aPt( *pPt );
     258 [ #  # ][ #  # ]:          0 :         GetLayout()->GetCrsrOfst( &aPos, aPt );
     259                 :          0 :         SwCntntNode *pNd = aPos.nNode.GetNode().GetCntntNode();
     260 [ #  # ][ #  # ]:          0 :         pFrm = pNd->getLayoutFrm( GetLayout(), pPt );
                 [ #  # ]
     261                 :            :     }
     262                 :            :     else
     263                 :       5806 :         pFrm = GetCurrFrm( sal_False );
     264         [ +  + ]:      29087 :     while ( pFrm )
     265                 :            :     {
     266   [ -  +  -  -  :      23281 :         switch ( pFrm->GetType() )
             +  -  -  +  
                      + ]
     267                 :            :         {
     268         [ #  # ]:          0 :             case FRM_COLUMN:    if( pFrm->GetUpper()->IsSctFrm() )
     269                 :            :                                 {
     270                 :            :                                     // Check, if isn't not only a single column
     271                 :            :                                     // from a section with footnotes at the end.
     272 [ #  # ][ #  # ]:          0 :                                     if( pFrm->GetNext() || pFrm->GetPrev() )
                 [ #  # ]
     273                 :            :                                         // Sectioncolumns
     274                 :            :                                         nReturn |= ( nReturn & FRMTYPE_TABLE ) ?
     275         [ #  # ]:          0 :                                             FRMTYPE_COLSECTOUTTAB : FRMTYPE_COLSECT;
     276                 :            :                                 }
     277                 :            :                                 else // only pages and frame columns
     278                 :          0 :                                     nReturn |= FRMTYPE_COLUMN;
     279                 :          0 :                                 break;
     280                 :       5806 :             case FRM_PAGE:      nReturn |= FRMTYPE_PAGE;
     281         [ -  + ]:       5806 :                                 if( ((SwPageFrm*)pFrm)->IsFtnPage() )
     282                 :          0 :                                     nReturn |= FRMTYPE_FTNPAGE;
     283                 :       5806 :                                 break;
     284                 :          0 :             case FRM_HEADER:    nReturn |= FRMTYPE_HEADER;      break;
     285                 :          0 :             case FRM_FOOTER:    nReturn |= FRMTYPE_FOOTER;      break;
     286         [ +  - ]:       5806 :             case FRM_BODY:      if( pFrm->GetUpper()->IsPageFrm() ) // not for ColumnFrms
     287                 :       5806 :                                     nReturn |= FRMTYPE_BODY;
     288                 :       5806 :                                 break;
     289                 :          0 :             case FRM_FTN:       nReturn |= FRMTYPE_FOOTNOTE;    break;
     290         [ #  # ]:          0 :             case FRM_FLY:       if( ((SwFlyFrm*)pFrm)->IsFlyLayFrm() )
     291                 :          0 :                                     nReturn |= FRMTYPE_FLY_FREE;
     292         [ #  # ]:          0 :                                 else if ( ((SwFlyFrm*)pFrm)->IsFlyAtCntFrm() )
     293                 :          0 :                                     nReturn |= FRMTYPE_FLY_ATCNT;
     294                 :            :                                 else
     295                 :            :                                 {
     296                 :            :                                     OSL_ENSURE( ((SwFlyFrm*)pFrm)->IsFlyInCntFrm(),
     297                 :            :                                             "New frametype?" );
     298                 :          0 :                                     nReturn |= FRMTYPE_FLY_INCNT;
     299                 :            :                                 }
     300                 :          0 :                                 nReturn |= FRMTYPE_FLY_ANY;
     301         [ #  # ]:          0 :                                 if( bStopAtFly )
     302                 :          0 :                                     return nReturn;
     303                 :          0 :                                 break;
     304                 :            :             case FRM_TAB:
     305                 :            :             case FRM_ROW:
     306                 :         57 :             case FRM_CELL:      nReturn |= FRMTYPE_TABLE;       break;
     307                 :      11612 :             default:            /* do nothing */                break;
     308                 :            :         }
     309         [ -  + ]:      23281 :         if ( pFrm->IsFlyFrm() )
     310                 :          0 :             pFrm = ((SwFlyFrm*)pFrm)->GetAnchorFrm();
     311                 :            :         else
     312                 :      23281 :             pFrm = pFrm->GetUpper();
     313                 :            :     }
     314                 :       5806 :     return nReturn;
     315                 :            : }
     316                 :            : 
     317                 :            : /*************************************************************************
     318                 :            : |*
     319                 :            : |*  SwFEShell::ShLooseFcs(), ShGetFcs()
     320                 :            : |*
     321                 :            : *************************************************************************/
     322                 :            : 
     323                 :       1302 : void SwFEShell::ShGetFcs( sal_Bool bUpdate )
     324                 :            : {
     325                 :       1302 :     ::SetShell( this );
     326                 :       1302 :     SwCrsrShell::ShGetFcs( bUpdate );
     327                 :            : 
     328         [ +  - ]:       1302 :     if ( HasDrawView() )
     329                 :            :     {
     330                 :       1302 :         Imp()->GetDrawView()->showMarkHandles();
     331         [ -  + ]:       1302 :         if ( Imp()->GetDrawView()->AreObjectsMarked() )
     332                 :          0 :             FrameNotify( this, FLY_DRAG_START );
     333                 :            :     }
     334                 :       1302 : }
     335                 :            : 
     336                 :       1302 : void SwFEShell::ShLooseFcs()
     337                 :            : {
     338                 :       1302 :     SwCrsrShell::ShLooseFcs();
     339                 :            : 
     340 [ -  + ][ -  + ]:       1302 :     if ( HasDrawView() && Imp()->GetDrawView()->AreObjectsMarked() )
                 [ +  - ]
     341                 :            :     {
     342                 :          0 :         Imp()->GetDrawView()->hideMarkHandles();
     343                 :          0 :         FrameNotify( this, FLY_DRAG_END );
     344                 :            :     }
     345                 :       1302 : }
     346                 :            : 
     347                 :            : /*************************************************************************
     348                 :            : |*
     349                 :            : |*  SwFEShell::GetPhyPageNum()
     350                 :            : |*  SwFEShell::GetVirtPageNum()
     351                 :            : |*
     352                 :            : *************************************************************************/
     353                 :            : 
     354                 :          0 : sal_uInt16 SwFEShell::GetPhyPageNum()
     355                 :            : {
     356                 :          0 :     SwFrm *pFrm = GetCurrFrm();
     357         [ #  # ]:          0 :     if ( pFrm )
     358                 :          0 :         return pFrm->GetPhyPageNum();
     359                 :          0 :     return 0;
     360                 :            : }
     361                 :            : 
     362                 :          0 : sal_uInt16 SwFEShell::GetVirtPageNum( const sal_Bool bCalcFrm )
     363                 :            : {
     364                 :          0 :     SwFrm *pFrm = GetCurrFrm( bCalcFrm );
     365         [ #  # ]:          0 :     if ( pFrm )
     366                 :          0 :         return pFrm->GetVirtPageNum();
     367                 :          0 :     return 0;
     368                 :            : }
     369                 :            : 
     370                 :            : /*************************************************************************
     371                 :            : |*
     372                 :            : |*  void lcl_SetAPageOffset()
     373                 :            : |*  void SwFEShell::SetNewPageOffset()
     374                 :            : |*  void SwFEShell::SetPageOffset()
     375                 :            : |*  sal_uInt16 SwFEShell::GetPageOffset() const
     376                 :            : |*
     377                 :            : *************************************************************************/
     378                 :            : 
     379                 :          0 : void lcl_SetAPageOffset( sal_uInt16 nOffset, SwPageFrm* pPage, SwFEShell* pThis )
     380                 :            : {
     381         [ #  # ]:          0 :     pThis->StartAllAction();
     382                 :            :     OSL_ENSURE( pPage->FindFirstBodyCntnt(),
     383                 :            :             "SwFEShell _SetAPageOffset() without CntntFrm" );
     384                 :            : 
     385         [ #  # ]:          0 :     SwFmtPageDesc aDesc( pPage->GetPageDesc() );
     386                 :          0 :     aDesc.SetNumOffset( nOffset );
     387                 :            : 
     388         [ #  # ]:          0 :     SwFrm *pFrm = pThis->GetCurrFrm( sal_False );
     389 [ #  # ][ #  # ]:          0 :     if ( pFrm->IsInTab() )
     390 [ #  # ][ #  # ]:          0 :         pThis->GetDoc()->SetAttr( aDesc, *pFrm->FindTabFrm()->GetFmt() );
                 [ #  # ]
     391                 :            :     else
     392                 :            :     {
     393 [ #  # ][ #  # ]:          0 :         pThis->GetDoc()->InsertPoolItem( *pThis->GetCrsr(), aDesc, 0 );
     394                 :            :     }
     395                 :            : 
     396 [ #  # ][ #  # ]:          0 :     pThis->EndAllAction();
     397                 :          0 : }
     398                 :            : 
     399                 :          0 : void SwFEShell::SetNewPageOffset( sal_uInt16 nOffset )
     400                 :            : {
     401                 :          0 :     GetLayout()->SetVirtPageNum( sal_True );
     402                 :          0 :     const SwPageFrm *pPage = GetCurrFrm( sal_False )->FindPageFrm();
     403                 :          0 :     lcl_SetAPageOffset( nOffset, (SwPageFrm*)pPage, this );
     404                 :          0 : }
     405                 :            : 
     406                 :          0 : void SwFEShell::SetPageOffset( sal_uInt16 nOffset )
     407                 :            : {
     408                 :          0 :     const SwPageFrm *pPage = GetCurrFrm( sal_False )->FindPageFrm();
     409                 :          0 :     const SwRootFrm* pDocLayout = GetLayout();
     410         [ #  # ]:          0 :     while ( pPage )
     411                 :            :     {
     412                 :          0 :         const SwFrm *pFlow = pPage->FindFirstBodyCntnt();
     413         [ #  # ]:          0 :         if ( pFlow )
     414                 :            :         {
     415         [ #  # ]:          0 :             if ( pFlow->IsInTab() )
     416                 :          0 :                 pFlow = pFlow->FindTabFrm();
     417                 :          0 :             const SwFmtPageDesc& rPgDesc = pFlow->GetAttrSet()->GetPageDesc();
     418         [ #  # ]:          0 :             if ( rPgDesc.GetNumOffset() )
     419                 :            :             {
     420                 :          0 :                 pDocLayout->SetVirtPageNum( sal_True );
     421                 :          0 :                 lcl_SetAPageOffset( nOffset, (SwPageFrm*)pPage, this );
     422                 :          0 :                 break;
     423                 :            :             }
     424                 :            :         }
     425                 :          0 :         pPage = (SwPageFrm*)pPage->GetPrev();
     426                 :            :     }
     427                 :          0 : }
     428                 :            : 
     429                 :          0 : sal_uInt16 SwFEShell::GetPageOffset() const
     430                 :            : {
     431                 :          0 :     const SwPageFrm *pPage = GetCurrFrm()->FindPageFrm();
     432         [ #  # ]:          0 :     while ( pPage )
     433                 :            :     {
     434                 :          0 :         const SwFrm *pFlow = pPage->FindFirstBodyCntnt();
     435         [ #  # ]:          0 :         if ( pFlow )
     436                 :            :         {
     437         [ #  # ]:          0 :             if ( pFlow->IsInTab() )
     438                 :          0 :                 pFlow = pFlow->FindTabFrm();
     439                 :          0 :             const sal_uInt16 nOffset = pFlow->GetAttrSet()->GetPageDesc().GetNumOffset();
     440         [ #  # ]:          0 :             if ( nOffset )
     441                 :          0 :                 return nOffset;
     442                 :            :         }
     443                 :          0 :         pPage = (SwPageFrm*)pPage->GetPrev();
     444                 :            :     }
     445                 :          0 :     return 0;
     446                 :            : }
     447                 :            : 
     448                 :            : /*************************************************************************
     449                 :            : |*
     450                 :            : |*  SwFEShell::InsertLabel()
     451                 :            : |*
     452                 :            : *************************************************************************/
     453                 :            : 
     454                 :          0 : void SwFEShell::InsertLabel( const SwLabelType eType, const String &rTxt, const String& rSeparator,
     455                 :            :                              const String& rNumberSeparator,
     456                 :            :                              const sal_Bool bBefore, const sal_uInt16 nId,
     457                 :            :                              const String& rCharacterStyle,
     458                 :            :                              const sal_Bool bCpyBrd )
     459                 :            : {
     460                 :            :     // get node index of cursor position, SwDoc can do everything else itself
     461         [ #  # ]:          0 :     SwCntntFrm *pCnt = LTYPE_DRAW==eType ? 0 : GetCurrFrm( sal_False );
     462 [ #  # ][ #  # ]:          0 :     if( LTYPE_DRAW==eType || pCnt )
     463                 :            :     {
     464         [ #  # ]:          0 :         StartAllAction();
     465                 :            : 
     466                 :          0 :         sal_uLong nIdx = 0;
     467                 :          0 :         SwFlyFrmFmt* pFlyFmt = 0;
     468   [ #  #  #  # ]:          0 :         switch( eType )
     469                 :            :         {
     470                 :            :         case LTYPE_OBJECT:
     471                 :            :         case LTYPE_FLY:
     472 [ #  # ][ #  # ]:          0 :             if( pCnt->IsInFly() )
     473                 :            :             {
     474                 :            :                 // pass down index to the startnode for flys
     475         [ #  # ]:          0 :                 nIdx = pCnt->FindFlyFrm()->
     476 [ #  # ][ #  # ]:          0 :                             GetFmt()->GetCntnt().GetCntntIdx()->GetIndex();
     477                 :            :             }
     478                 :          0 :             break;
     479                 :            :         case LTYPE_TABLE:
     480 [ #  # ][ #  # ]:          0 :             if( pCnt->IsInTab() )
     481                 :            :             {
     482                 :            :                 // pass down index to the TblNode for tables
     483         [ #  # ]:          0 :                 const SwTable& rTbl = *pCnt->FindTabFrm()->GetTable();
     484         [ #  # ]:          0 :                 nIdx = rTbl.GetTabSortBoxes()[ 0 ]
     485         [ #  # ]:          0 :                             ->GetSttNd()->FindTableNode()->GetIndex();
     486                 :            :             }
     487                 :          0 :             break;
     488                 :            :         case LTYPE_DRAW:
     489         [ #  # ]:          0 :             if( Imp()->GetDrawView() )
     490                 :            :             {
     491                 :          0 :                 SwDrawView *pDView = Imp()->GetDrawView();
     492                 :          0 :                 const SdrMarkList& rMrkList = pDView->GetMarkedObjectList();
     493         [ #  # ]:          0 :                 StartUndo();
     494                 :            : 
     495                 :            :                 // copy marked drawing objects to
     496                 :            :                 // local list to perform the corresponding action for each object
     497         [ #  # ]:          0 :                 std::vector<SdrObject*> aDrawObjs;
     498                 :            :                 {
     499         [ #  # ]:          0 :                     for ( sal_uInt16 i = 0; i < rMrkList.GetMarkCount(); ++i )
     500                 :            :                     {
     501 [ #  # ][ #  # ]:          0 :                         SdrObject* pDrawObj = rMrkList.GetMark(i)->GetMarkedSdrObj();
     502         [ #  # ]:          0 :                         if( pDrawObj )
     503         [ #  # ]:          0 :                         aDrawObjs.push_back( pDrawObj );
     504                 :            :                     }
     505                 :            :                 }
     506                 :            :                 // loop on marked drawing objects
     507         [ #  # ]:          0 :                 while ( !aDrawObjs.empty() )
     508                 :            :                 {
     509         [ #  # ]:          0 :                     SdrObject* pDrawObj = aDrawObjs.back();
     510 [ #  # ][ #  # ]:          0 :                     if ( !pDrawObj->ISA(SwVirtFlyDrawObj) &&
         [ #  # ][ #  # ]
                 [ #  # ]
     511 [ #  # ][ #  # ]:          0 :                          !pDrawObj->ISA(SwFlyDrawObj) )
     512                 :            :                     {
     513                 :            :                         SwFlyFrmFmt *pFmt =
     514         [ #  # ]:          0 :                             GetDoc()->InsertDrawLabel( rTxt, rSeparator, rNumberSeparator, nId, rCharacterStyle, *pDrawObj );
     515         [ #  # ]:          0 :                         if( !pFlyFmt )
     516                 :          0 :                             pFlyFmt = pFmt;
     517                 :            :                     }
     518                 :            : 
     519         [ #  # ]:          0 :                     aDrawObjs.pop_back();
     520                 :            :                 }
     521                 :            : 
     522         [ #  # ]:          0 :                 EndUndo();
     523                 :            :             }
     524                 :          0 :             break;
     525                 :            :         default:
     526                 :            :             OSL_ENSURE( !this, "Crsr neither in table nor in fly." );
     527                 :            :         }
     528                 :            : 
     529         [ #  # ]:          0 :         if( nIdx )
     530                 :            :             pFlyFmt = GetDoc()->InsertLabel( eType, rTxt, rSeparator, rNumberSeparator, bBefore, nId,
     531         [ #  # ]:          0 :                                              nIdx, rCharacterStyle, bCpyBrd );
     532                 :            : 
     533                 :            :         SwFlyFrm* pFrm;
     534                 :          0 :         const Point aPt( GetCrsrDocPos() );
     535 [ #  # ][ #  # ]:          0 :         if( pFlyFmt && 0 != ( pFrm = pFlyFmt->GetFrm( &aPt )))
         [ #  # ][ #  # ]
     536         [ #  # ]:          0 :             SelectFlyFrm( *pFrm, sal_True );
     537                 :            : 
     538         [ #  # ]:          0 :         EndAllActionAndCall();
     539                 :            :     }
     540                 :          0 : }
     541                 :            : 
     542                 :            : 
     543                 :            : /***********************************************************************
     544                 :            : #*  Class       :  SwFEShell
     545                 :            : #*  Method      :  Sort
     546                 :            : #***********************************************************************/
     547                 :            : 
     548                 :          0 : sal_Bool SwFEShell::Sort(const SwSortOptions& rOpt)
     549                 :            : {
     550 [ #  # ][ #  # ]:          0 :     if( !HasSelection() )
     551                 :          0 :         return sal_False;
     552                 :            : 
     553         [ #  # ]:          0 :     SET_CURR_SHELL( this );
     554                 :            :     sal_Bool bRet;
     555         [ #  # ]:          0 :     StartAllAction();
     556         [ #  # ]:          0 :     if(IsTableMode())
     557                 :            :     {
     558                 :            :         // Sort table
     559                 :            :         // check if Point/Mark of current Crsr are in one table
     560         [ #  # ]:          0 :         SwFrm *pFrm = GetCurrFrm( sal_False );
     561                 :            :         OSL_ENSURE( pFrm->FindTabFrm(), "Crsr not in table." );
     562                 :            : 
     563                 :            :         // search boxes via the layout
     564         [ #  # ]:          0 :         SwSelBoxes  aBoxes;
     565         [ #  # ]:          0 :         GetTblSel(*this, aBoxes);
     566                 :            : 
     567                 :            :         // The Crsr should be removed from the deletion area.
     568                 :            :         // Always put them behind/on the table; via the
     569                 :            :         // document position they will always be set to the old position
     570         [ #  # ]:          0 :         while( !pFrm->IsCellFrm() )
     571                 :          0 :             pFrm = pFrm->GetUpper();
     572                 :            :         {
     573                 :            :             /* ParkCursor->ParkCursorTab */
     574         [ #  # ]:          0 :             ParkCursorInTab();
     575                 :            :         }
     576                 :            : 
     577                 :            :         // call sorting on document
     578         [ #  # ]:          0 :         bRet = pDoc->SortTbl(aBoxes, rOpt);
     579                 :            :     }
     580                 :            :     else
     581                 :            :     {
     582                 :            :         // Sort text nothing else
     583 [ #  # ][ #  # ]:          0 :         FOREACHPAM_START(this)
     584                 :            : 
     585                 :          0 :             SwPaM* pPam = PCURCRSR;
     586                 :            : 
     587         [ #  # ]:          0 :             SwPosition* pStart = pPam->Start();
     588         [ #  # ]:          0 :             SwPosition* pEnd   = pPam->End();
     589                 :            : 
     590         [ #  # ]:          0 :             SwNodeIndex aPrevIdx( pStart->nNode, -1 );
     591                 :          0 :             sal_uLong nOffset = pEnd->nNode.GetIndex() - pStart->nNode.GetIndex();
     592                 :          0 :             xub_StrLen nCntStt  = pStart->nContent.GetIndex();
     593                 :            : 
     594                 :            :             // Sorting
     595         [ #  # ]:          0 :             bRet = pDoc->SortText(*pPam, rOpt);
     596                 :            : 
     597                 :            :             // put selection again
     598         [ #  # ]:          0 :             pPam->DeleteMark();
     599         [ #  # ]:          0 :             pPam->GetPoint()->nNode.Assign( aPrevIdx.GetNode(), +1 );
     600                 :          0 :             SwCntntNode* pCNd = pPam->GetCntntNode();
     601         [ #  # ]:          0 :             xub_StrLen nLen = pCNd->Len();
     602         [ #  # ]:          0 :             if( nLen > nCntStt )
     603                 :          0 :                 nLen = nCntStt;
     604 [ #  # ][ #  # ]:          0 :             pPam->GetPoint()->nContent.Assign(pCNd, nLen );
     605         [ #  # ]:          0 :             pPam->SetMark();
     606                 :            : 
     607         [ #  # ]:          0 :             pPam->GetPoint()->nNode += nOffset;
     608                 :          0 :             pCNd = pPam->GetCntntNode();
     609 [ #  # ][ #  # ]:          0 :             pPam->GetPoint()->nContent.Assign( pCNd, pCNd->Len() );
         [ #  # ][ #  # ]
     610                 :            : 
     611                 :          0 :         FOREACHPAM_END()
     612                 :            :     }
     613                 :            : 
     614         [ #  # ]:          0 :     EndAllAction();
     615         [ #  # ]:          0 :     return bRet;
     616                 :            : }
     617                 :            : 
     618                 :            : /*************************************************************************
     619                 :            : |*
     620                 :            : |*  SwFEShell::GetCurColNum(), _GetColNum()
     621                 :            : |*
     622                 :            : |*************************************************************************/
     623                 :            : 
     624                 :          0 : sal_uInt16 SwFEShell::_GetCurColNum( const SwFrm *pFrm,
     625                 :            :                                 SwGetCurColNumPara* pPara ) const
     626                 :            : {
     627                 :          0 :     sal_uInt16 nRet = 0;
     628         [ #  # ]:          0 :     while ( pFrm )
     629                 :            :     {
     630                 :          0 :         pFrm = pFrm->GetUpper();
     631 [ #  # ][ #  # ]:          0 :         if( pFrm && pFrm->IsColumnFrm() )
                 [ #  # ]
     632                 :            :         {
     633                 :          0 :             const SwFrm *pCurFrm = pFrm;
     634         [ #  # ]:          0 :             do {
     635                 :          0 :                 ++nRet;
     636                 :          0 :                 pFrm = pFrm->GetPrev();
     637                 :            :             } while ( pFrm );
     638                 :            : 
     639         [ #  # ]:          0 :             if( pPara )
     640                 :            :             {
     641                 :            :                 // now search the format, determining the columness
     642                 :          0 :                 pFrm = pCurFrm->GetUpper();
     643         [ #  # ]:          0 :                 while( pFrm )
     644                 :            :                 {
     645         [ #  # ]:          0 :                     if( ( FRM_PAGE | FRM_FLY | FRM_SECTION ) & pFrm->GetType() )
     646                 :            :                     {
     647                 :          0 :                         pPara->pFrmFmt = ((SwLayoutFrm*)pFrm)->GetFmt();
     648                 :          0 :                         pPara->pPrtRect = &pFrm->Prt();
     649                 :          0 :                         pPara->pFrmRect = &pFrm->Frm();
     650                 :          0 :                         break;
     651                 :            :                     }
     652                 :          0 :                     pFrm = pFrm->GetUpper();
     653                 :            :                 }
     654         [ #  # ]:          0 :                 if( !pFrm )
     655                 :            :                 {
     656                 :          0 :                     pPara->pFrmFmt = 0;
     657                 :          0 :                     pPara->pPrtRect = 0;
     658                 :          0 :                     pPara->pFrmRect = 0;
     659                 :            :                 }
     660                 :            :             }
     661                 :          0 :             break;
     662                 :            :         }
     663                 :            :     }
     664                 :          0 :     return nRet;
     665                 :            : }
     666                 :            : 
     667                 :          0 : sal_uInt16 SwFEShell::GetCurColNum( SwGetCurColNumPara* pPara ) const
     668                 :            : {
     669                 :            :     OSL_ENSURE( GetCurrFrm(), "Crsr parked?" );
     670                 :          0 :     return _GetCurColNum( GetCurrFrm(), pPara );
     671                 :            : }
     672                 :            : 
     673                 :          0 : sal_uInt16 SwFEShell::GetCurOutColNum( SwGetCurColNumPara* pPara ) const
     674                 :            : {
     675                 :          0 :     sal_uInt16 nRet = 0;
     676                 :          0 :     SwFrm* pFrm = GetCurrFrm();
     677                 :            :     OSL_ENSURE( pFrm, "Crsr parked?" );
     678         [ #  # ]:          0 :     if( pFrm )
     679                 :            :     {
     680                 :          0 :         pFrm = pFrm->IsInTab() ? (SwFrm*)pFrm->FindTabFrm()
     681         [ #  # ]:          0 :                                : (SwFrm*)pFrm->FindSctFrm();
     682                 :            :         OSL_ENSURE( pFrm, "No Tab, no Sect" );
     683         [ #  # ]:          0 :         if( pFrm )
     684                 :          0 :             nRet = _GetCurColNum( pFrm, pPara );
     685                 :            :     }
     686                 :          0 :     return nRet;
     687                 :            : }
     688                 :            : 
     689                 :       1318 : SwFEShell::SwFEShell( SwDoc& rDoc, Window *pWindow, const SwViewOption *pOptions )
     690                 :            :     : SwEditShell( rDoc, pWindow, pOptions ),
     691                 :       1318 :     pChainFrom( 0 ), pChainTo( 0 ), bCheckForOLEInCaption( sal_False )
     692                 :            : {
     693                 :       1318 : }
     694                 :            : 
     695                 :          0 : SwFEShell::SwFEShell( SwEditShell& rShell, Window *pWindow )
     696                 :            :     : SwEditShell( rShell, pWindow ),
     697                 :          0 :     pChainFrom( 0 ), pChainTo( 0 ), bCheckForOLEInCaption( sal_False )
     698                 :            : {
     699                 :          0 : }
     700                 :            : 
     701                 :       1231 : SwFEShell::~SwFEShell()
     702                 :            : {
     703 [ -  + ][ #  # ]:       1231 :     delete pChainFrom;
     704 [ -  + ][ #  # ]:       1231 :     delete pChainTo;
     705         [ -  + ]:       1231 : }
     706                 :            : 
     707                 :            : // #i17567# - adjustments for allowing
     708                 :            : //          negative vertical positions for fly frames anchored to paragraph/to character.
     709                 :            : // #i22305# - adjustments for option 'Follow text flow'
     710                 :            : //          for to frame anchored objects.
     711                 :            : // #i22341# - adjustments for vertical alignment at top of line
     712                 :            : //          for to character anchored objects.
     713                 :          0 : void SwFEShell::CalcBoundRect( SwRect& _orRect,
     714                 :            :                                const RndStdIds _nAnchorId,
     715                 :            :                                const sal_Int16 _eHoriRelOrient,
     716                 :            :                                const sal_Int16 _eVertRelOrient,
     717                 :            :                                const SwPosition* _pToCharCntntPos,
     718                 :            :                                const bool _bFollowTextFlow,
     719                 :            :                                bool _bMirror,
     720                 :            :                                Point* _opRef,
     721                 :            :                                Size* _opPercent ) const
     722                 :            : {
     723                 :            :     const SwFrm* pFrm;
     724                 :            :     const SwFlyFrm* pFly;
     725         [ #  # ]:          0 :     if( _opRef )
     726                 :            :     {
     727         [ #  # ]:          0 :         pFrm = GetCurrFrm();
     728 [ #  # ][ #  # ]:          0 :         if( 0 != ( pFly = pFrm->FindFlyFrm() ) )
     729         [ #  # ]:          0 :             pFrm = pFly->GetAnchorFrm();
     730                 :            :     }
     731                 :            :     else
     732                 :            :     {
     733         [ #  # ]:          0 :         pFly = FindFlyFrm();
     734 [ #  # ][ #  # ]:          0 :         pFrm = pFly ? pFly->GetAnchorFrm() : GetCurrFrm();
                 [ #  # ]
     735                 :            :     }
     736                 :            : 
     737                 :          0 :     sal_Bool bWrapThrough = sal_False;
     738         [ #  # ]:          0 :     if ( pFly )
     739                 :            :     {
     740         [ #  # ]:          0 :         SwFlyFrmFmt* pFmt = (SwFlyFrmFmt*)pFly->GetFmt();
     741         [ #  # ]:          0 :         const SwFmtSurround& rSurround = pFmt->GetSurround();
     742                 :          0 :         bWrapThrough = rSurround.GetSurround() == SURROUND_THROUGHT;
     743                 :            :     }
     744                 :            : 
     745         [ #  # ]:          0 :     const SwPageFrm* pPage = pFrm->FindPageFrm();
     746 [ #  # ][ #  # ]:          0 :     _bMirror = _bMirror && !pPage->OnRightPage();
                 [ #  # ]
     747                 :            : 
     748                 :          0 :     Point aPos;
     749                 :          0 :     bool bVertic = false;
     750                 :          0 :     sal_Bool bRTL = sal_False;
     751                 :          0 :     bool bVerticalL2R = false;
     752                 :            : 
     753 [ #  # ][ #  # ]:          0 :     if ((FLY_AT_PAGE == _nAnchorId) || (FLY_AT_FLY == _nAnchorId)) // LAYER_IMPL
     754                 :            :     {
     755                 :          0 :         const SwFrm* pTmp = pFrm;
     756                 :            :         // #i22305#
     757 [ #  # ][ #  # ]:          0 :         if ((FLY_AT_PAGE == _nAnchorId) ||
                 [ #  # ]
     758                 :          0 :             ((FLY_AT_FLY == _nAnchorId) && !_bFollowTextFlow))
     759                 :            :         {
     760                 :          0 :             pFrm = pPage;
     761                 :            :         }
     762                 :            :         else
     763                 :            :         {
     764         [ #  # ]:          0 :             pFrm = pFrm->FindFlyFrm();
     765                 :            :         }
     766         [ #  # ]:          0 :         if ( !pFrm )
     767                 :          0 :             pFrm = pTmp;
     768                 :          0 :         _orRect = pFrm->Frm();
     769 [ #  # ][ #  # ]:          0 :         SWRECTFN( pFrm )
         [ #  # ][ #  # ]
                 [ #  # ]
     770         [ #  # ]:          0 :         bRTL = pFrm->IsRightToLeft();
     771         [ #  # ]:          0 :         if ( bRTL )
     772         [ #  # ]:          0 :             aPos = pFrm->Frm().TopRight();
     773                 :            :         else
     774 [ #  # ][ #  # ]:          0 :             aPos = (pFrm->Frm().*fnRect->fnGetPos)();
     775                 :            : 
     776 [ #  # ][ #  # ]:          0 :         if( bVert || bVertL2R )
     777                 :            :         {
     778                 :          0 :             bVertic = bVert ? true : false;
     779                 :          0 :             bVerticalL2R = bVertL2R ? true : false;
     780                 :          0 :             _bMirror = false; // no mirroring in vertical environment
     781      [ #  #  # ]:          0 :             switch ( _eHoriRelOrient )
     782                 :            :             {
     783                 :            :                 case text::RelOrientation::PAGE_RIGHT:
     784                 :          0 :                 case text::RelOrientation::FRAME_RIGHT: aPos.Y() += pFrm->Prt().Height();
     785                 :            :                 // no break!
     786                 :            :                 case text::RelOrientation::PRINT_AREA:
     787                 :          0 :                 case text::RelOrientation::PAGE_PRINT_AREA: aPos.Y() += pFrm->Prt().Top(); break;
     788                 :          0 :                 default: break;
     789                 :            :             }
     790                 :            :         }
     791         [ #  # ]:          0 :         else if ( _bMirror )
     792                 :            :         {
     793      [ #  #  # ]:          0 :             switch ( _eHoriRelOrient )
     794                 :            :             {
     795                 :            :                 case text::RelOrientation::PRINT_AREA:
     796                 :          0 :                 case text::RelOrientation::PAGE_PRINT_AREA: aPos.X() += pFrm->Prt().Width();
     797                 :            :                 // no break
     798                 :            :                 case text::RelOrientation::PAGE_RIGHT:
     799                 :          0 :                 case text::RelOrientation::FRAME_RIGHT: aPos.X() += pFrm->Prt().Left(); break;
     800                 :          0 :                 default: aPos.X() += pFrm->Frm().Width();
     801                 :            :             }
     802                 :            :         }
     803         [ #  # ]:          0 :         else if ( bRTL )
     804                 :            :         {
     805      [ #  #  # ]:          0 :             switch ( _eHoriRelOrient )
     806                 :            :             {
     807                 :            :                 case text::RelOrientation::PRINT_AREA:
     808                 :          0 :                 case text::RelOrientation::PAGE_PRINT_AREA: aPos.X() += pFrm->Prt().Width();
     809                 :            :                 // no break!
     810                 :            :                 case text::RelOrientation::PAGE_LEFT:
     811                 :          0 :                 case text::RelOrientation::FRAME_LEFT: aPos.X() += pFrm->Prt().Left() -
     812                 :          0 :                                                pFrm->Frm().Width(); break;
     813                 :          0 :                 default: break;
     814                 :            :             }
     815                 :            :         }
     816                 :            :         else
     817                 :            :         {
     818      [ #  #  # ]:          0 :             switch ( _eHoriRelOrient )
     819                 :            :             {
     820                 :            :                 case text::RelOrientation::PAGE_RIGHT:
     821                 :          0 :                 case text::RelOrientation::FRAME_RIGHT:   aPos.X() += pFrm->Prt().Width();
     822                 :            :                 // no break!
     823                 :            :                 case text::RelOrientation::PRINT_AREA:
     824                 :          0 :                 case text::RelOrientation::PAGE_PRINT_AREA: aPos.X() += pFrm->Prt().Left(); break;
     825                 :          0 :                 default:break;
     826                 :            :             }
     827                 :            :         }
     828                 :            : 
     829 [ #  # ][ #  # ]:          0 :         if ( bVert && !bVertL2R )
     830                 :            :         {
     831         [ #  # ]:          0 :             switch ( _eVertRelOrient )
     832                 :            :             {
     833                 :            :                 case text::RelOrientation::PRINT_AREA:
     834                 :            :                 case text::RelOrientation::PAGE_PRINT_AREA:
     835                 :            :                 {
     836         [ #  # ]:          0 :                     aPos.X() -= pFrm->GetRightMargin();
     837                 :            :                 }
     838                 :          0 :                 break;
     839                 :            :             }
     840                 :            :         }
     841         [ #  # ]:          0 :         else if ( bVertL2R )
     842                 :            :         {
     843         [ #  # ]:          0 :             switch ( _eVertRelOrient )
     844                 :            :             {
     845                 :            :                 case text::RelOrientation::PRINT_AREA:
     846                 :            :                 case text::RelOrientation::PAGE_PRINT_AREA:
     847                 :            :                 {
     848         [ #  # ]:          0 :                     aPos.X() += pFrm->GetLeftMargin();
     849                 :            :                 }
     850                 :          0 :                 break;
     851                 :            :             }
     852                 :            :         }
     853                 :            :         else
     854                 :            :         {
     855         [ #  # ]:          0 :             switch ( _eVertRelOrient )
     856                 :            :             {
     857                 :            :                 case text::RelOrientation::PRINT_AREA:
     858                 :            :                 case text::RelOrientation::PAGE_PRINT_AREA:
     859                 :            :                 {
     860         [ #  # ]:          0 :                     if ( pFrm->IsPageFrm() )
     861                 :            :                     {
     862                 :          0 :                         aPos.Y() =
     863         [ #  # ]:          0 :                             static_cast<const SwPageFrm*>(pFrm)->PrtWithoutHeaderAndFooter().Top();
     864                 :            :                     }
     865                 :            :                     else
     866                 :            :                     {
     867                 :          0 :                         aPos.Y() += pFrm->Prt().Top();
     868                 :            :                     }
     869                 :            :                 }
     870                 :          0 :                 break;
     871                 :            :             }
     872                 :            :         }
     873         [ #  # ]:          0 :         if ( _opPercent )
     874                 :          0 :             *_opPercent = pFrm->Prt().SSize();
     875                 :            :     }
     876                 :            :     else
     877                 :            :     {
     878                 :          0 :         const SwFrm* pUpper = ( pFrm->IsPageFrm() || pFrm->IsFlyFrm() ) ?
     879   [ #  #  #  # ]:          0 :                               pFrm : pFrm->GetUpper();
     880 [ #  # ][ #  # ]:          0 :         SWRECTFN( pUpper );
         [ #  # ][ #  # ]
                 [ #  # ]
     881         [ #  # ]:          0 :         if ( _opPercent )
     882                 :          0 :             *_opPercent = pUpper->Prt().SSize();
     883                 :            : 
     884         [ #  # ]:          0 :         bRTL = pFrm->IsRightToLeft();
     885         [ #  # ]:          0 :         if ( bRTL )
     886         [ #  # ]:          0 :             aPos = pFrm->Frm().TopRight();
     887                 :            :         else
     888 [ #  # ][ #  # ]:          0 :             aPos = (pFrm->Frm().*fnRect->fnGetPos)();
     889                 :            :         // #i17567# - allow negative positions
     890                 :            :         // for fly frames anchor to paragraph/to character.
     891 [ #  # ][ #  # ]:          0 :         if ((_nAnchorId == FLY_AT_PARA) || (_nAnchorId == FLY_AT_CHAR))
     892                 :            :         {
     893                 :            :             // The rectangle, the fly frame can be positioned in, is determined
     894                 :            :             // horizontally by the frame area of the horizontal environment
     895                 :            :             // and vertically by the printing area of the vertical environment,
     896                 :            :             // if the object follows the text flow, or by the frame area of the
     897                 :            :             // vertical environment, if the object doesn't follow the text flow.
     898                 :            :             // new class <SwEnvironmentOfAnchoredObject>
     899                 :            :             objectpositioning::SwEnvironmentOfAnchoredObject aEnvOfObj(
     900         [ #  # ]:          0 :                                                             _bFollowTextFlow );
     901                 :            :             const SwLayoutFrm& rHoriEnvironLayFrm =
     902         [ #  # ]:          0 :                                 aEnvOfObj.GetHoriEnvironmentLayoutFrm( *pFrm );
     903                 :            :             const SwLayoutFrm& rVertEnvironLayFrm =
     904         [ #  # ]:          0 :                                 aEnvOfObj.GetVertEnvironmentLayoutFrm( *pFrm );
     905                 :          0 :             SwRect aHoriEnvironRect( rHoriEnvironLayFrm.Frm() );
     906                 :          0 :             SwRect aVertEnvironRect;
     907         [ #  # ]:          0 :             if ( _bFollowTextFlow )
     908                 :            :             {
     909                 :          0 :                 aVertEnvironRect = rVertEnvironLayFrm.Prt();
     910                 :          0 :                 aVertEnvironRect.Pos() += rVertEnvironLayFrm.Frm().Pos();
     911                 :            :                 // #i18732# - adjust vertical 'virtual' anchor position
     912                 :            :                 // (<aPos.Y()> respectively <aPos.X()>), if object is vertical aligned
     913                 :            :                 // to page areas.
     914 [ #  # ][ #  # ]:          0 :                 if ( _eVertRelOrient == text::RelOrientation::PAGE_FRAME || _eVertRelOrient == text::RelOrientation::PAGE_PRINT_AREA )
     915                 :            :                 {
     916 [ #  # ][ #  # ]:          0 :                     if ( bVert && !bVertL2R )
     917                 :            :                     {
     918                 :          0 :                         aPos.X() = aVertEnvironRect.Right();
     919                 :            :                     }
     920         [ #  # ]:          0 :                     else if ( bVertL2R )
     921                 :            :                     {
     922                 :          0 :                         aPos.X() = aVertEnvironRect.Left();
     923                 :            :                     }
     924                 :            :                     else
     925                 :            :                     {
     926                 :          0 :                         aPos.Y() = aVertEnvironRect.Top();
     927                 :            :                     }
     928                 :            :                 }
     929                 :            :             }
     930                 :            :             else
     931                 :            :             {
     932                 :            :                 OSL_ENSURE( rVertEnvironLayFrm.IsPageFrm(),
     933                 :            :                         "<SwFEShell::CalcBoundRect(..)> - not following text flow, but vertical environment *not* page!" );
     934                 :          0 :                 aVertEnvironRect = rVertEnvironLayFrm.Frm();
     935                 :            :                 // #i18732# - adjustment vertical 'virtual' anchor position
     936                 :            :                 // (<aPos.Y()> respectively <aPos.X()>), if object is vertical aligned
     937                 :            :                 // to page areas.
     938 [ #  # ][ #  # ]:          0 :                 if ( _eVertRelOrient == text::RelOrientation::PAGE_FRAME || _eVertRelOrient == text::RelOrientation::PAGE_PRINT_AREA )
     939                 :            :                 {
     940 [ #  # ][ #  # ]:          0 :                     if ( bVert && !bVertL2R )
     941                 :            :                     {
     942                 :          0 :                         aPos.X() = aVertEnvironRect.Right();
     943         [ #  # ]:          0 :                         if ( _eVertRelOrient == text::RelOrientation::PAGE_PRINT_AREA )
     944                 :            :                         {
     945         [ #  # ]:          0 :                             aPos.X() -= rVertEnvironLayFrm.GetRightMargin();
     946                 :            :                         }
     947                 :            :                     }
     948         [ #  # ]:          0 :                     else if ( bVertL2R )
     949                 :            :                     {
     950                 :          0 :                         aPos.X() = aVertEnvironRect.Left();
     951         [ #  # ]:          0 :                         if ( _eVertRelOrient == text::RelOrientation::PAGE_PRINT_AREA )
     952                 :            :                         {
     953         [ #  # ]:          0 :                             aPos.X() += rVertEnvironLayFrm.GetLeftMargin();
     954                 :            :                         }
     955                 :            :                     }
     956                 :            :                     else
     957                 :            :                     {
     958                 :          0 :                         aPos.Y() = aVertEnvironRect.Top();
     959         [ #  # ]:          0 :                         if ( _eVertRelOrient == text::RelOrientation::PAGE_PRINT_AREA )
     960                 :            :                         {
     961         [ #  # ]:          0 :                             aPos.Y() += rVertEnvironLayFrm.GetTopMargin();
     962                 :            :                             // add height of page header
     963                 :          0 :                             const SwFrm* pTmpFrm = rVertEnvironLayFrm.Lower();
     964         [ #  # ]:          0 :                             if ( pTmpFrm->IsHeaderFrm() )
     965                 :            :                             {
     966                 :          0 :                                 aPos.Y() += pTmpFrm->Frm().Height();
     967                 :            :                             }
     968                 :            :                         }
     969                 :            :                     }
     970                 :            :                 }
     971                 :            :             }
     972                 :            : 
     973                 :            :             // #i22341# - adjust vertical 'virtual' anchor position
     974                 :            :             // (<aPos.Y()> respectively <aPos.X()>), if object is anchored to
     975                 :            :             // character and vertical aligned at character or top of line
     976                 :            :             // <pFrm>, which is the anchor frame or the proposed anchor frame,
     977                 :            :             // doesn't have to be a text frame (e.g. edit a to-page anchored
     978                 :            :             // fly frame). Thus, assure this.
     979         [ #  # ]:          0 :             const SwTxtFrm* pTxtFrm( dynamic_cast<const SwTxtFrm*>(pFrm) );
     980 [ #  # ][ #  # ]:          0 :             if ( pTxtFrm &&
         [ #  # ][ #  # ]
     981                 :            :                  (_nAnchorId == FLY_AT_CHAR) &&
     982                 :            :                  ( _eVertRelOrient == text::RelOrientation::CHAR ||
     983                 :            :                    _eVertRelOrient == text::RelOrientation::TEXT_LINE ) )
     984                 :            :             {
     985                 :          0 :                 SwTwips nTop = 0L;
     986         [ #  # ]:          0 :                 if ( _eVertRelOrient == text::RelOrientation::CHAR )
     987                 :            :                 {
     988                 :          0 :                     SwRect aChRect;
     989         [ #  # ]:          0 :                     if ( _pToCharCntntPos )
     990                 :            :                     {
     991         [ #  # ]:          0 :                         pTxtFrm->GetAutoPos( aChRect, *_pToCharCntntPos );
     992                 :            :                     }
     993                 :            :                     else
     994                 :            :                     {
     995                 :            :                         // No content position provided. Thus, use a default one.
     996         [ #  # ]:          0 :                         SwPosition aDefaultCntntPos( *(pTxtFrm->GetTxtNode()) );
     997 [ #  # ][ #  # ]:          0 :                         pTxtFrm->GetAutoPos( aChRect, aDefaultCntntPos );
     998                 :            :                     }
     999 [ #  # ][ #  # ]:          0 :                     nTop = (aChRect.*fnRect->fnGetBottom)();
    1000                 :            :                 }
    1001                 :            :                 else
    1002                 :            :                 {
    1003         [ #  # ]:          0 :                     if ( _pToCharCntntPos )
    1004                 :            :                     {
    1005         [ #  # ]:          0 :                         pTxtFrm->GetTopOfLine( nTop, *_pToCharCntntPos );
    1006                 :            :                     }
    1007                 :            :                     else
    1008                 :            :                     {
    1009                 :            :                         // No content position provided. Thus, use a default one.
    1010         [ #  # ]:          0 :                         SwPosition aDefaultCntntPos( *(pTxtFrm->GetTxtNode()) );
    1011 [ #  # ][ #  # ]:          0 :                         pTxtFrm->GetTopOfLine( nTop, aDefaultCntntPos );
    1012                 :            :                     }
    1013                 :            :                 }
    1014 [ #  # ][ #  # ]:          0 :                 if ( bVert || bVertL2R )
    1015                 :            :                 {
    1016                 :          0 :                     aPos.X() = nTop;
    1017                 :            :                 }
    1018                 :            :                 else
    1019                 :            :                 {
    1020                 :          0 :                     aPos.Y() = nTop;
    1021                 :            :                 }
    1022                 :            :             }
    1023                 :            : 
    1024                 :            :             // #i26945# - adjust horizontal 'virtual' anchor
    1025                 :            :             // position (<aPos.X()> respectively <aPos.Y()>), if object is
    1026                 :            :             // anchored to character and horizontal aligned at character.
    1027 [ #  # ][ #  # ]:          0 :             if ( pTxtFrm &&
                 [ #  # ]
    1028                 :            :                  (_nAnchorId == FLY_AT_CHAR) &&
    1029                 :            :                  _eHoriRelOrient == text::RelOrientation::CHAR )
    1030                 :            :             {
    1031                 :          0 :                 SwTwips nLeft = 0L;
    1032                 :          0 :                 SwRect aChRect;
    1033         [ #  # ]:          0 :                 if ( _pToCharCntntPos )
    1034                 :            :                 {
    1035         [ #  # ]:          0 :                     pTxtFrm->GetAutoPos( aChRect, *_pToCharCntntPos );
    1036                 :            :                 }
    1037                 :            :                 else
    1038                 :            :                 {
    1039                 :            :                     // No content position provided. Thus, use a default one.
    1040         [ #  # ]:          0 :                     SwPosition aDefaultCntntPos( *(pTxtFrm->GetTxtNode()) );
    1041 [ #  # ][ #  # ]:          0 :                     pTxtFrm->GetAutoPos( aChRect, aDefaultCntntPos );
    1042                 :            :                 }
    1043 [ #  # ][ #  # ]:          0 :                 nLeft = (aChRect.*fnRect->fnGetLeft)();
    1044 [ #  # ][ #  # ]:          0 :                 if ( bVert || bVertL2R )
    1045                 :            :                 {
    1046                 :          0 :                     aPos.Y() = nLeft;
    1047                 :            :                 }
    1048                 :            :                 else
    1049                 :            :                 {
    1050                 :          0 :                     aPos.X() = nLeft;
    1051                 :            :                 }
    1052                 :            :             }
    1053 [ #  # ][ #  # ]:          0 :             if ( bVert || bVertL2R )
    1054                 :            :             {
    1055                 :            :                 _orRect = SwRect( aVertEnvironRect.Left(),
    1056                 :            :                                   aHoriEnvironRect.Top(),
    1057                 :            :                                   aVertEnvironRect.Width(),
    1058                 :          0 :                                   aHoriEnvironRect.Height() );
    1059                 :            :             }
    1060                 :            :             else
    1061                 :            :             {
    1062                 :            :                 _orRect = SwRect( aHoriEnvironRect.Left(),
    1063                 :            :                                   aVertEnvironRect.Top(),
    1064                 :            :                                   aHoriEnvironRect.Width(),
    1065                 :          0 :                                   aVertEnvironRect.Height() );
    1066         [ #  # ]:          0 :             }
    1067                 :            :         }
    1068                 :            :         else
    1069                 :            :         {
    1070 [ #  # ][ #  # ]:          0 :             if( _opRef && pFly && pFly->IsFlyInCntFrm() )
         [ #  # ][ #  # ]
    1071                 :          0 :                 *_opRef = ( (SwFlyInCntFrm*)pFly )->GetRefPoint();
    1072                 :            : 
    1073                 :          0 :             _orRect = pUpper->Frm();
    1074         [ #  # ]:          0 :             if( !pUpper->IsBodyFrm() )
    1075                 :            :             {
    1076                 :          0 :                 _orRect += pUpper->Prt().Pos();
    1077                 :          0 :                 _orRect.SSize( pUpper->Prt().SSize() );
    1078         [ #  # ]:          0 :                 if ( pUpper->IsCellFrm() )//MA_FLY_HEIGHT
    1079                 :            :                 {
    1080         [ #  # ]:          0 :                     const SwFrm* pTab = pUpper->FindTabFrm();
    1081 [ #  # ][ #  # ]:          0 :                     long nBottom = (pTab->GetUpper()->*fnRect->fnGetPrtBottom)();
    1082 [ #  # ][ #  # ]:          0 :                     (_orRect.*fnRect->fnSetBottom)( nBottom );
    1083                 :            :                 }
    1084                 :            :             }
    1085                 :            :             // only use 90% of height for character bound
    1086                 :            :             {
    1087 [ #  # ][ #  # ]:          0 :                 if( bVert || bVertL2R )
    1088                 :          0 :                     _orRect.Width( (_orRect.Width()*9)/10 );
    1089                 :            :                 else
    1090                 :          0 :                     _orRect.Height( (_orRect.Height()*9)/10 );
    1091                 :            :             }
    1092                 :            :         }
    1093                 :            : 
    1094                 :          0 :         const SwTwips nBaseOfstForFly = ( pFrm->IsTxtFrm() && pFly ) ?
    1095                 :          0 :                                         ((SwTxtFrm*)pFrm)->GetBaseOfstForFly( !bWrapThrough ) :
    1096 [ #  # ][ #  # ]:          0 :                                          0;
    1097 [ #  # ][ #  # ]:          0 :         if( bVert || bVertL2R )
    1098                 :            :         {
    1099                 :          0 :             bVertic = bVert ? true : false;
    1100                 :          0 :             bVerticalL2R = bVertL2R ? true : false;
    1101                 :          0 :             _bMirror = false;
    1102                 :            : 
    1103   [ #  #  #  #  :          0 :             switch ( _eHoriRelOrient )
                #  #  # ]
    1104                 :            :             {
    1105                 :            :                 case text::RelOrientation::FRAME_RIGHT:
    1106                 :            :                 {
    1107                 :          0 :                     aPos.Y() += pFrm->Prt().Height();
    1108 [ #  # ][ #  # ]:          0 :                     aPos += (pFrm->Prt().*fnRect->fnGetPos)();
    1109                 :          0 :                     break;
    1110                 :            :                 }
    1111                 :            :                 case text::RelOrientation::PRINT_AREA:
    1112                 :            :                 {
    1113 [ #  # ][ #  # ]:          0 :                     aPos += (pFrm->Prt().*fnRect->fnGetPos)();
    1114                 :          0 :                     aPos.Y() += nBaseOfstForFly;
    1115                 :          0 :                     break;
    1116                 :            :                 }
    1117                 :            :                 case text::RelOrientation::PAGE_RIGHT:
    1118                 :            :                 {
    1119                 :          0 :                     aPos.Y() = pPage->Frm().Top() + pPage->Prt().Bottom();
    1120                 :          0 :                     break;
    1121                 :            :                 }
    1122                 :            :                 case text::RelOrientation::PAGE_PRINT_AREA:
    1123                 :            :                 {
    1124                 :          0 :                     aPos.Y() = pPage->Frm().Top() + pPage->Prt().Top();
    1125                 :          0 :                     break;
    1126                 :            :                 }
    1127                 :            :                 case text::RelOrientation::PAGE_LEFT:
    1128                 :            :                 case text::RelOrientation::PAGE_FRAME:
    1129                 :            :                 {
    1130                 :          0 :                     aPos.Y() = pPage->Frm().Top();
    1131                 :          0 :                     break;
    1132                 :            :                 }
    1133                 :            :                 case text::RelOrientation::FRAME:
    1134                 :            :                 {
    1135                 :          0 :                     aPos.Y() += nBaseOfstForFly;
    1136                 :          0 :                     break;
    1137                 :            :                 }
    1138                 :          0 :                 default: break;
    1139                 :            :             }
    1140                 :            :         }
    1141         [ #  # ]:          0 :         else if( _bMirror )
    1142                 :            :         {
    1143   [ #  #  #  #  :          0 :             switch ( _eHoriRelOrient )
                   #  # ]
    1144                 :            :             {
    1145                 :          0 :                 case text::RelOrientation::FRAME_RIGHT:   aPos.X() += pFrm->Prt().Left(); break;
    1146                 :            :                 case text::RelOrientation::FRAME:
    1147                 :          0 :                 case text::RelOrientation::FRAME_LEFT: aPos.X() += pFrm->Frm().Width(); break;
    1148                 :          0 :                 case text::RelOrientation::PRINT_AREA: aPos.X() += pFrm->Prt().Right(); break;
    1149                 :            :                 case text::RelOrientation::PAGE_LEFT:
    1150                 :          0 :                 case text::RelOrientation::PAGE_FRAME: aPos.X() = pPage->Frm().Right(); break;
    1151                 :          0 :                 case text::RelOrientation::PAGE_PRINT_AREA: aPos.X() = pPage->Frm().Left()
    1152                 :          0 :                                               + pPage->Prt().Left(); break;
    1153                 :          0 :                 default: break;
    1154                 :            :             }
    1155                 :            :         }
    1156         [ #  # ]:          0 :         else if ( bRTL )
    1157                 :            :         {
    1158   [ #  #  #  #  :          0 :             switch ( _eHoriRelOrient )
                #  #  # ]
    1159                 :            :             {
    1160                 :            :                 case text::RelOrientation::FRAME_LEFT:
    1161                 :          0 :                     aPos.X() = pFrm->Frm().Left() +
    1162                 :          0 :                                pFrm->Prt().Left();
    1163                 :          0 :                     break;
    1164                 :            : 
    1165                 :            :                 case text::RelOrientation::PRINT_AREA:
    1166                 :          0 :                     aPos.X() = pFrm->Frm().Left() + pFrm->Prt().Left() +
    1167                 :          0 :                                pFrm->Prt().Width();
    1168                 :          0 :                     aPos.X() += nBaseOfstForFly;
    1169                 :          0 :                     break;
    1170                 :            : 
    1171                 :            :                 case text::RelOrientation::PAGE_LEFT:
    1172                 :          0 :                     aPos.X() = pPage->Frm().Left() + pPage->Prt().Left();
    1173                 :          0 :                     break;
    1174                 :            : 
    1175                 :            :                 case text::RelOrientation::PAGE_PRINT_AREA:
    1176                 :          0 :                     aPos.X() = pPage->Frm().Left() + pPage->Prt().Left() +
    1177                 :          0 :                                pPage->Prt().Width() ;
    1178                 :          0 :                     break;
    1179                 :            : 
    1180                 :            :                 case text::RelOrientation::PAGE_RIGHT:
    1181                 :            :                 case text::RelOrientation::PAGE_FRAME:
    1182                 :          0 :                     aPos.X() = pPage->Frm().Right();
    1183                 :          0 :                     break;
    1184                 :            : 
    1185                 :            :                 case text::RelOrientation::FRAME:
    1186                 :          0 :                     aPos.X() += nBaseOfstForFly;
    1187                 :          0 :                     break;
    1188                 :          0 :                 default: break;
    1189                 :            :             }
    1190                 :            :         }
    1191                 :            :         else
    1192                 :            :         {
    1193   [ #  #  #  #  :          0 :             switch ( _eHoriRelOrient )
                #  #  # ]
    1194                 :            :             {
    1195                 :            :                 case text::RelOrientation::FRAME_RIGHT:
    1196                 :          0 :                     aPos.X() += pFrm->Prt().Width();
    1197                 :          0 :                     aPos += pFrm->Prt().Pos();
    1198                 :          0 :                     break;
    1199                 :            :                 case text::RelOrientation::PRINT_AREA:
    1200                 :          0 :                     aPos += pFrm->Prt().Pos();
    1201                 :          0 :                     aPos.X() += nBaseOfstForFly;
    1202                 :          0 :                     break;
    1203                 :            :                 case text::RelOrientation::PAGE_RIGHT:
    1204                 :          0 :                     aPos.X() = pPage->Frm().Left() + pPage->Prt().Right();
    1205                 :          0 :                     break;
    1206                 :            :                 case text::RelOrientation::PAGE_PRINT_AREA:
    1207                 :          0 :                     aPos.X() = pPage->Frm().Left() + pPage->Prt().Left();
    1208                 :          0 :                     break;
    1209                 :            :                 case text::RelOrientation::PAGE_LEFT:
    1210                 :            :                 case text::RelOrientation::PAGE_FRAME:
    1211                 :          0 :                     aPos.X() = pPage->Frm().Left();
    1212                 :          0 :                     break;
    1213                 :            :                 case text::RelOrientation::FRAME:
    1214                 :          0 :                     aPos.X() += nBaseOfstForFly;
    1215                 :          0 :                     break;
    1216                 :          0 :                 default: break;
    1217                 :            :             }
    1218                 :            :         }
    1219                 :            : 
    1220                 :            :     }
    1221         [ #  # ]:          0 :     if( !_opRef )
    1222                 :            :     {
    1223 [ #  # ][ #  # ]:          0 :         if( bVertic && !bVerticalL2R )
    1224                 :          0 :             _orRect.Pos( aPos.X() - _orRect.Width() - _orRect.Left(), _orRect.Top() - aPos.Y() );
    1225         [ #  # ]:          0 :         else if( bVerticalL2R )
    1226                 :          0 :             _orRect.Pos( _orRect.Left() - aPos.X(), _orRect.Top() - aPos.Y() );
    1227         [ #  # ]:          0 :         else if ( bRTL )
    1228                 :          0 :             _orRect.Pos( - ( _orRect.Right() - aPos.X() ), _orRect.Top() - aPos.Y() );
    1229                 :            :         else
    1230                 :          0 :             _orRect.Pos( _orRect.Left() - aPos.X(), _orRect.Top() - aPos.Y() );
    1231         [ #  # ]:          0 :         if( _bMirror )
    1232                 :          0 :             _orRect.Pos( -_orRect.Right(), _orRect.Top() );
    1233                 :            :     }
    1234                 :          0 : }
    1235                 :            : 
    1236                 :          0 : Size SwFEShell::GetGraphicDefaultSize() const
    1237                 :            : {
    1238                 :          0 :     Size aRet;
    1239                 :          0 :     SwFlyFrm *pFly = FindFlyFrm();
    1240         [ #  # ]:          0 :     if ( pFly )
    1241                 :            :     {
    1242                 :            :         // #i32951# - due to issue #i28701# no format of a
    1243                 :            :         // newly inserted Writer fly frame or its anchor frame is performed
    1244                 :            :         // any more. Thus, it could be possible (e.g. on insert of a horizontal
    1245                 :            :         // line) that the anchor frame isn't formatted and its printing area
    1246                 :            :         // size is (0,0). If this is the case the printing area of the upper
    1247                 :            :         // of the anchor frame is taken.
    1248         [ #  # ]:          0 :         const SwFrm* pAnchorFrm = pFly->GetAnchorFrm();
    1249                 :          0 :         aRet = pAnchorFrm->Prt().SSize();
    1250   [ #  #  #  # ]:          0 :         if ( aRet.Width() == 0 && aRet.Height() == 0 &&
         [ #  # ][ #  # ]
    1251                 :          0 :              pAnchorFrm->GetUpper() )
    1252                 :            :         {
    1253                 :          0 :             aRet = pAnchorFrm->GetUpper()->Prt().SSize();
    1254                 :            :         }
    1255                 :            : 
    1256                 :          0 :         SwRect aBound;
    1257 [ #  # ][ #  # ]:          0 :         CalcBoundRect( aBound, pFly->GetFmt()->GetAnchor().GetAnchorId());
                 [ #  # ]
    1258 [ #  # ][ #  # ]:          0 :         if ( pFly->GetAnchorFrm()->IsVertical() )
                 [ #  # ]
    1259                 :          0 :             aRet.Width() = aBound.Width();
    1260                 :            :         else
    1261                 :          0 :             aRet.Height() = aBound.Height();
    1262                 :            :     }
    1263                 :          0 :     return aRet;
    1264                 :            : }
    1265                 :            : 
    1266                 :       2744 : sal_Bool SwFEShell::IsFrmVertical(const sal_Bool bEnvironment, sal_Bool& bRTL, sal_Bool& bVertL2R) const
    1267                 :            : {
    1268                 :       2744 :     sal_Bool bVert = sal_False;
    1269                 :       2744 :     bRTL = sal_False;
    1270                 :       2744 :     bVertL2R = sal_False;
    1271                 :            : 
    1272         [ +  - ]:       2744 :     if ( Imp()->HasDrawView() )
    1273                 :            :     {
    1274                 :       2744 :         const SdrMarkList &rMrkList = Imp()->GetDrawView()->GetMarkedObjectList();
    1275         [ +  - ]:       2744 :         if( rMrkList.GetMarkCount() != 1 )
    1276                 :       2744 :             return bVert;
    1277                 :            : 
    1278                 :          0 :         SdrObject* pObj = rMrkList.GetMark( 0 )->GetMarkedSdrObj();
    1279         [ #  # ]:          0 :         if ( !pObj )
    1280                 :            :         {
    1281                 :            :             OSL_FAIL( "<SwFEShell::IsFrmVertical(..)> - missing SdrObject instance in marked object list -> This is a serious situation, please inform OD" );
    1282                 :          0 :             return bVert;
    1283                 :            :         }
    1284                 :            :         // #i26791#
    1285                 :          0 :         SwContact* pContact = static_cast<SwContact*>(GetUserCall( pObj ));
    1286         [ #  # ]:          0 :         if ( !pContact )
    1287                 :            :         {
    1288                 :            :             OSL_FAIL( "<SwFEShell::IsFrmVertical(..)> - missing SwContact instance at marked object -> This is a serious situation, please inform OD" );
    1289                 :          0 :             return bVert;
    1290                 :            :         }
    1291                 :          0 :         const SwFrm* pRef = pContact->GetAnchoredObj( pObj )->GetAnchorFrm();
    1292         [ #  # ]:          0 :         if ( !pRef )
    1293                 :            :         {
    1294                 :            :             OSL_FAIL( "<SwFEShell::IsFrmVertical(..)> - missing anchor frame at marked object -> This is a serious situation, please inform OD" );
    1295                 :          0 :             return bVert;
    1296                 :            :         }
    1297                 :            : 
    1298 [ #  # ][ #  # ]:          0 :         if ( pObj->ISA(SwVirtFlyDrawObj) && !bEnvironment )
                 [ #  # ]
    1299                 :          0 :             pRef = static_cast<const SwVirtFlyDrawObj*>(pObj)->GetFlyFrm();
    1300                 :            : 
    1301                 :          0 :         bVert = pRef->IsVertical();
    1302                 :          0 :         bRTL = pRef->IsRightToLeft();
    1303                 :          0 :         bVertL2R = pRef->IsVertLR();
    1304                 :            :     }
    1305                 :            : 
    1306                 :       2744 :     return bVert;
    1307                 :            : }
    1308                 :            : 
    1309                 :          0 : void SwFEShell::MoveObjectIfActive( svt::EmbeddedObjectRef&, const Point& )
    1310                 :            : {
    1311                 :            :     // does not do anything, only avoids crash if the method is used for wrong shell
    1312                 :          0 : }
    1313                 :            : 
    1314                 :          0 : void SwFEShell::ToggleHeaderFooterEdit()
    1315                 :            : {
    1316                 :            :     // Clear objects selection
    1317         [ #  # ]:          0 :     if ( Imp()->GetDrawView()->AreObjectsMarked() )
    1318                 :            :     {
    1319                 :          0 :         Imp()->GetDrawView()->UnmarkAll();
    1320                 :          0 :         ClearMark();
    1321                 :            :     }
    1322                 :            : 
    1323                 :          0 :     SwCrsrShell::ToggleHeaderFooterEdit();
    1324                 :          0 : }
    1325                 :            : 
    1326                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10