LCOV - code coverage report
Current view: top level - sw/source/core/uibase/frmdlg - frmmgr.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 0 284 0.0 %
Date: 2014-04-11 Functions: 0 24 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include "cmdid.h"
      21             : #include "hintids.hxx"
      22             : 
      23             : #include <svl/stritem.hxx>
      24             : #include <editeng/protitem.hxx>
      25             : #include <editeng/boxitem.hxx>
      26             : #include <editeng/opaqitem.hxx>
      27             : #include <editeng/lrspitem.hxx>
      28             : #include <editeng/ulspitem.hxx>
      29             : #include <editeng/shaditem.hxx>
      30             : #include <svx/swframevalidation.hxx>
      31             : #include <svx/xdef.hxx>
      32             : #include <fmtclds.hxx>
      33             : #include "wrtsh.hxx"
      34             : #include "view.hxx"
      35             : #include "viewopt.hxx"
      36             : #include "uitool.hxx"
      37             : #include "frmmgr.hxx"
      38             : #include "format.hxx"
      39             : #include "mdiexp.hxx"
      40             : #include "poolfmt.hxx"
      41             : #include <com/sun/star/text/TextContentAnchorType.hpp>
      42             : #include <com/sun/star/text/HoriOrientation.hpp>
      43             : #include <com/sun/star/text/VertOrientation.hpp>
      44             : #include <com/sun/star/text/RelOrientation.hpp>
      45             : 
      46             : using namespace ::com::sun::star;
      47             : 
      48             : static sal_uInt16 aFrmMgrRange[] = {
      49             :                             RES_FRMATR_BEGIN, RES_FRMATR_END-1,
      50             : 
      51             :                             //UUUU FillAttribute support
      52             :                             XATTR_FILL_FIRST, XATTR_FILL_LAST,
      53             : 
      54             :                             SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER,
      55             :                             FN_SET_FRM_NAME, FN_SET_FRM_NAME,
      56             :                             0};
      57             : 
      58             : /*--------------------------------------------------------------------
      59             :      Description: determine frame attributes via Shell
      60             :  --------------------------------------------------------------------*/
      61           0 : SwFlyFrmAttrMgr::SwFlyFrmAttrMgr( sal_Bool bNew, SwWrtShell* pSh, sal_uInt8 nType ) :
      62           0 :     m_aSet( (SwAttrPool&)pSh->GetAttrPool(), aFrmMgrRange ),
      63             :     m_pOwnSh( pSh ),
      64             :     m_bAbsPos( sal_False ),
      65             :     m_bNewFrm( bNew ),
      66             :     m_bIsInVertical( sal_False ),
      67           0 :     m_bIsInVerticalL2R( sal_False )
      68             : {
      69           0 :     if ( m_bNewFrm )
      70             :     {
      71             :         // set defaults:
      72           0 :         sal_uInt16 nId = 0;
      73           0 :         switch ( nType )
      74             :         {
      75           0 :             case FRMMGR_TYPE_TEXT:  nId = RES_POOLFRM_FRAME;    break;
      76           0 :             case FRMMGR_TYPE_OLE:   nId = RES_POOLFRM_OLE;      break;
      77           0 :             case FRMMGR_TYPE_GRF:   nId = RES_POOLFRM_GRAPHIC;  break;
      78             :         }
      79           0 :         m_aSet.SetParent( &m_pOwnSh->GetFmtFromPool( nId )->GetAttrSet());
      80           0 :         m_aSet.Put( SwFmtFrmSize( ATT_MIN_SIZE, DFLT_WIDTH, DFLT_HEIGHT ));
      81           0 :         if ( 0 != ::GetHtmlMode(pSh->GetView().GetDocShell()) )
      82           0 :             m_aSet.Put( SwFmtHoriOrient( 0, text::HoriOrientation::LEFT, text::RelOrientation::PRINT_AREA ) );
      83             :     }
      84           0 :     else if ( nType == FRMMGR_TYPE_NONE )
      85             :     {
      86           0 :         m_pOwnSh->GetFlyFrmAttr( m_aSet );
      87             :         sal_Bool bRightToLeft;
      88           0 :         m_bIsInVertical = m_pOwnSh->IsFrmVertical(sal_True, bRightToLeft, m_bIsInVerticalL2R);
      89             :     }
      90           0 :     ::PrepareBoxInfo( m_aSet, *m_pOwnSh );
      91           0 : }
      92             : 
      93           0 : SwFlyFrmAttrMgr::SwFlyFrmAttrMgr( sal_Bool bNew, SwWrtShell* pSh, const SfxItemSet &rSet ) :
      94             :     m_aSet( rSet ),
      95             :     m_pOwnSh( pSh ),
      96             :     m_bAbsPos( sal_False ),
      97             :     m_bNewFrm( bNew ),
      98             :     m_bIsInVertical(sal_False),
      99           0 :     m_bIsInVerticalL2R(sal_False)
     100             : {
     101           0 :     if(!bNew)
     102             :     {
     103             :         sal_Bool bRightToLeft;
     104           0 :         m_bIsInVertical = pSh->IsFrmVertical(sal_True, bRightToLeft, m_bIsInVerticalL2R);
     105             :     }
     106           0 : }
     107             : 
     108             : /*--------------------------------------------------------------------
     109             :      Description:   Initialise
     110             :  --------------------------------------------------------------------*/
     111           0 : void SwFlyFrmAttrMgr::UpdateAttrMgr()
     112             : {
     113           0 :     if ( !m_bNewFrm && m_pOwnSh->IsFrmSelected() )
     114           0 :         m_pOwnSh->GetFlyFrmAttr( m_aSet );
     115           0 :     ::PrepareBoxInfo( m_aSet, *m_pOwnSh );
     116           0 : }
     117             : 
     118           0 : void SwFlyFrmAttrMgr::_UpdateFlyFrm()
     119             : {
     120           0 :     const SfxPoolItem* pItem = 0;
     121             : 
     122           0 :     if (m_aSet.GetItemState(FN_SET_FRM_NAME, false, &pItem) == SFX_ITEM_SET)
     123           0 :         m_pOwnSh->SetFlyName(((SfxStringItem *)pItem)->GetValue());
     124             : 
     125           0 :     m_pOwnSh->SetModified();
     126             : 
     127           0 :     if ( m_bAbsPos )
     128             :     {
     129           0 :         m_pOwnSh->SetFlyPos( m_aAbsPos );
     130           0 :         m_bAbsPos = sal_False;
     131             :     }
     132           0 : }
     133             : 
     134             : /*--------------------------------------------------------------------
     135             :     Description: change existing Fly-Frame
     136             :  --------------------------------------------------------------------*/
     137           0 : void SwFlyFrmAttrMgr::UpdateFlyFrm()
     138             : {
     139             :     OSL_ENSURE( m_pOwnSh->IsFrmSelected(),
     140             :         "no frame selected or no shell, update not possible");
     141             : 
     142           0 :     if( m_pOwnSh->IsFrmSelected() )
     143             :     {
     144             :         //JP 6.8.2001: set never an invalid anchor into the core.
     145             :         const SfxPoolItem *pGItem, *pItem;
     146           0 :         if( SFX_ITEM_SET == m_aSet.GetItemState( RES_ANCHOR, false, &pItem ))
     147             :         {
     148           0 :             SfxItemSet aGetSet( *m_aSet.GetPool(), RES_ANCHOR, RES_ANCHOR );
     149           0 :             if( m_pOwnSh->GetFlyFrmAttr( aGetSet ) && 1 == aGetSet.Count() &&
     150           0 :                 SFX_ITEM_SET == aGetSet.GetItemState( RES_ANCHOR, false, &pGItem )
     151           0 :                 && ((SwFmtAnchor*)pGItem)->GetAnchorId() ==
     152           0 :                    ((SwFmtAnchor*)pItem)->GetAnchorId() )
     153           0 :                 m_aSet.ClearItem( RES_ANCHOR );
     154             :         }
     155             : 
     156             :         // return wg. BASIC
     157           0 :         if( m_aSet.Count() )
     158             :         {
     159           0 :             m_pOwnSh->StartAllAction();
     160           0 :             m_pOwnSh->SetFlyFrmAttr( m_aSet );
     161           0 :             _UpdateFlyFrm();
     162           0 :             m_pOwnSh->EndAllAction();
     163             :         }
     164             :     }
     165           0 : }
     166             : 
     167             : /*--------------------------------------------------------------------
     168             :      Description:   insert frame
     169             :  --------------------------------------------------------------------*/
     170           0 : sal_Bool SwFlyFrmAttrMgr::InsertFlyFrm()
     171             : {
     172           0 :     m_pOwnSh->StartAllAction();
     173             : 
     174           0 :     sal_Bool bRet = 0 != m_pOwnSh->NewFlyFrm( m_aSet );
     175             : 
     176             :     // turn on the right mode at the shell, frame got selected automatically.
     177           0 :     if ( bRet )
     178             :     {
     179           0 :         _UpdateFlyFrm();
     180           0 :         m_pOwnSh->EnterSelFrmMode();
     181           0 :         FrameNotify(m_pOwnSh, FLY_DRAG_START);
     182             :     }
     183           0 :     m_pOwnSh->EndAllAction();
     184           0 :     return bRet;
     185             : }
     186             : 
     187             : /*------------------------------------------------------------------------
     188             :  Description:   Insert frames of type eAnchorType. Position and size are
     189             :                 being set explicitly.
     190             :                 Not-allowed values of the enumeration type get corrected.
     191             : ------------------------------------------------------------------------*/
     192           0 : void SwFlyFrmAttrMgr::InsertFlyFrm(RndStdIds    eAnchorType,
     193             :                                    const Point  &rPos,
     194             :                                    const Size   &rSize,
     195             :                                    sal_Bool bAbs )
     196             : {
     197             :     OSL_ENSURE( eAnchorType == FLY_AT_PAGE ||
     198             :             eAnchorType == FLY_AT_PARA ||
     199             :             eAnchorType == FLY_AT_CHAR ||
     200             :             eAnchorType == FLY_AT_FLY  ||
     201             :             eAnchorType == FLY_AS_CHAR,     "invalid frame type" );
     202             : 
     203           0 :     if ( bAbs )
     204           0 :         SetAbsPos( rPos );
     205             :     else
     206           0 :         SetPos( rPos );
     207             : 
     208           0 :     SetSize( rSize );
     209           0 :     SetAnchor( eAnchorType );
     210           0 :     InsertFlyFrm();
     211           0 : }
     212             : 
     213             : /*--------------------------------------------------------------------
     214             :      Description:   set anchor
     215             :  --------------------------------------------------------------------*/
     216           0 : void SwFlyFrmAttrMgr::SetAnchor( RndStdIds eId )
     217             : {
     218             :     sal_uInt16 nPhyPageNum, nVirtPageNum;
     219           0 :     m_pOwnSh->GetPageNum( nPhyPageNum, nVirtPageNum );
     220             : 
     221           0 :     m_aSet.Put( SwFmtAnchor( eId, nPhyPageNum ) );
     222           0 :     if ((FLY_AT_PAGE == eId) || (FLY_AT_PARA == eId) || (FLY_AT_CHAR == eId)
     223           0 :         || (FLY_AT_FLY == eId))
     224             :     {
     225           0 :         SwFmtVertOrient aVertOrient( GetVertOrient() );
     226           0 :         SwFmtHoriOrient aHoriOrient( GetHoriOrient() );
     227           0 :         aHoriOrient.SetRelationOrient( text::RelOrientation::FRAME );
     228           0 :         aVertOrient.SetRelationOrient( text::RelOrientation::FRAME );
     229           0 :         m_aSet.Put( aVertOrient );
     230           0 :         m_aSet.Put( aHoriOrient );
     231             :     }
     232           0 : }
     233             : 
     234             : /*------------------------------------------------------------------------
     235             :  Description:   set the attribute for columns
     236             : ------------------------------------------------------------------------*/
     237           0 : void SwFlyFrmAttrMgr::SetCol( const SwFmtCol &rCol )
     238             : {
     239           0 :     m_aSet.Put( rCol );
     240           0 : }
     241             : 
     242             : /*--------------------------------------------------------------------
     243             :      Description:   set absolute position
     244             :  --------------------------------------------------------------------*/
     245           0 : void SwFlyFrmAttrMgr::SetAbsPos( const Point& rPoint )
     246             : {
     247           0 :     m_bAbsPos = sal_True;
     248           0 :     m_aAbsPos = rPoint;
     249             : 
     250           0 :     SwFmtVertOrient aVertOrient( GetVertOrient() );
     251           0 :     SwFmtHoriOrient aHoriOrient( GetHoriOrient() );
     252           0 :     aHoriOrient.SetHoriOrient( text::HoriOrientation::NONE );
     253           0 :     aVertOrient.SetVertOrient( text::VertOrientation::NONE );
     254           0 :     m_aSet.Put( aVertOrient );
     255           0 :     m_aSet.Put( aHoriOrient );
     256           0 : }
     257             : 
     258             : /*--------------------------------------------------------------------
     259             :     Description: check metrics for correctness
     260             :  --------------------------------------------------------------------*/
     261           0 : void SwFlyFrmAttrMgr::ValidateMetrics( SvxSwFrameValidation& rVal,
     262             :         const SwPosition* pToCharCntntPos,
     263             :         bool bOnlyPercentRefValue )
     264             : {
     265           0 :     if (!bOnlyPercentRefValue)
     266             :     {
     267           0 :         rVal.nMinHeight = MINFLY + CalcTopSpace() + CalcBottomSpace();
     268           0 :         rVal.nMinWidth =  MINFLY + CalcLeftSpace()+ CalcRightSpace();
     269             :     }
     270             : 
     271           0 :     SwRect aBoundRect;
     272             : 
     273             :     // OD 18.09.2003 #i18732# - adjustment for allowing vertical position
     274             :     //      aligned to page for fly frame anchored to paragraph or to character.
     275           0 :     const RndStdIds eAnchorType = static_cast<RndStdIds >(rVal.nAnchorType);
     276           0 :     const SwFmtFrmSize& rSize = (const SwFmtFrmSize&)m_aSet.Get(RES_FRM_SIZE);
     277             :     m_pOwnSh->CalcBoundRect( aBoundRect, eAnchorType,
     278             :                            rVal.nHRelOrient,
     279             :                            rVal.nVRelOrient,
     280             :                            pToCharCntntPos,
     281             :                            rVal.bFollowTextFlow,
     282             :                            rVal.bMirror, NULL, &rVal.aPercentSize,
     283           0 :                            &rSize);
     284             : 
     285           0 :     if (bOnlyPercentRefValue)
     286           0 :         return;
     287             : 
     288             :     // --> OD 2009-09-01 #mongolianlayout#
     289           0 :     if ( m_bIsInVertical || m_bIsInVerticalL2R )
     290             :     {
     291           0 :         Point aPos(aBoundRect.Pos());
     292           0 :         long nTmp = aPos.X();
     293           0 :         aPos.X() = aPos.Y();
     294           0 :         aPos.Y() = nTmp;
     295           0 :         Size aSize(aBoundRect.SSize());
     296           0 :         nTmp = aSize.Width();
     297           0 :         aSize.Width() = aSize.Height();
     298           0 :         aSize.Height() = nTmp;
     299           0 :         aBoundRect.Chg( aPos, aSize );
     300             :         //exchange width/height to enable correct values
     301           0 :         nTmp = rVal.nWidth;
     302           0 :         rVal.nWidth = rVal.nHeight;
     303           0 :         rVal.nHeight = nTmp;
     304             :     }
     305           0 :     if ((eAnchorType == FLY_AT_PAGE) || (eAnchorType == FLY_AT_FLY))
     306             :     {
     307             :         // MinimalPosition
     308           0 :         rVal.nMinHPos = aBoundRect.Left();
     309           0 :         rVal.nMinVPos = aBoundRect.Top();
     310           0 :         SwTwips nH = rVal.nHPos;
     311           0 :         SwTwips nV = rVal.nVPos;
     312             : 
     313           0 :         if (rVal.nHPos + rVal.nWidth > aBoundRect.Right())
     314             :         {
     315           0 :             if (rVal.nHoriOrient == text::HoriOrientation::NONE)
     316             :             {
     317           0 :                 rVal.nHPos -= ((rVal.nHPos + rVal.nWidth) - aBoundRect.Right());
     318           0 :                 nH = rVal.nHPos;
     319             :             }
     320             :             else
     321           0 :                 rVal.nWidth = aBoundRect.Right() - rVal.nHPos;
     322             :         }
     323             : 
     324           0 :         if (rVal.nHPos + rVal.nWidth > aBoundRect.Right())
     325           0 :             rVal.nWidth = aBoundRect.Right() - rVal.nHPos;
     326             : 
     327           0 :         if (rVal.nVPos + rVal.nHeight > aBoundRect.Bottom())
     328             :         {
     329           0 :             if (rVal.nVertOrient == text::VertOrientation::NONE)
     330             :             {
     331           0 :                 rVal.nVPos -= ((rVal.nVPos + rVal.nHeight) - aBoundRect.Bottom());
     332           0 :                 nV = rVal.nVPos;
     333             :             }
     334             :             else
     335           0 :                 rVal.nHeight = aBoundRect.Bottom() - rVal.nVPos;
     336             :         }
     337             : 
     338           0 :         if (rVal.nVPos + rVal.nHeight > aBoundRect.Bottom())
     339           0 :             rVal.nHeight = aBoundRect.Bottom() - rVal.nVPos;
     340             : 
     341           0 :         if ( rVal.nVertOrient != text::VertOrientation::NONE )
     342           0 :             nV = aBoundRect.Top();
     343             : 
     344           0 :         if ( rVal.nHoriOrient != text::HoriOrientation::NONE )
     345           0 :             nH = aBoundRect.Left();
     346             : 
     347           0 :         rVal.nMaxHPos   = aBoundRect.Right()  - rVal.nWidth;
     348           0 :         rVal.nMaxHeight = aBoundRect.Bottom() - nV;
     349             : 
     350           0 :         rVal.nMaxVPos   = aBoundRect.Bottom() - rVal.nHeight;
     351           0 :         rVal.nMaxWidth  = aBoundRect.Right()  - nH;
     352             :     }
     353             :     // OD 12.11.2003 #i22341# - handle to character anchored objects vertical
     354             :     // aligned at character or top of line in a special case
     355           0 :     else if ((eAnchorType == FLY_AT_PARA) ||
     356           0 :                 ((eAnchorType == FLY_AT_CHAR) &&
     357           0 :                 !(rVal.nVRelOrient == text::RelOrientation::CHAR) &&
     358           0 :                 !(rVal.nVRelOrient == text::RelOrientation::TEXT_LINE) ) )
     359             :     {
     360           0 :         if (rVal.nHPos + rVal.nWidth > aBoundRect.Right())
     361             :         {
     362           0 :             if (rVal.nHoriOrient == text::HoriOrientation::NONE)
     363             :             {
     364           0 :                 rVal.nHPos -= ((rVal.nHPos + rVal.nWidth) - aBoundRect.Right());
     365             :             }
     366             :             else
     367           0 :                 rVal.nWidth = aBoundRect.Right() - rVal.nHPos;
     368             :         }
     369             : 
     370             :         // OD 29.09.2003 #i17567#, #i18732# - consider following the text flow
     371             :         // and alignment at page areas.
     372           0 :         const bool bMaxVPosAtBottom = !rVal.bFollowTextFlow ||
     373           0 :                                       rVal.nVRelOrient == text::RelOrientation::PAGE_FRAME ||
     374           0 :                                       rVal.nVRelOrient == text::RelOrientation::PAGE_PRINT_AREA;
     375             :         {
     376             :             SwTwips nTmpMaxVPos = ( bMaxVPosAtBottom
     377             :                                     ? aBoundRect.Bottom()
     378           0 :                                     : aBoundRect.Height() ) -
     379           0 :                                   rVal.nHeight;
     380           0 :             if ( rVal.nVPos > nTmpMaxVPos )
     381             :             {
     382           0 :                 if (rVal.nVertOrient == text::VertOrientation::NONE)
     383             :                 {
     384           0 :                     rVal.nVPos = nTmpMaxVPos;
     385             :                 }
     386             :                 else
     387             :                 {
     388             :                     rVal.nHeight = ( bMaxVPosAtBottom
     389             :                                      ? aBoundRect.Bottom()
     390           0 :                                      : aBoundRect.Height() ) - rVal.nVPos;
     391             :                 }
     392             :             }
     393             :         }
     394             : 
     395           0 :         rVal.nMinHPos  = aBoundRect.Left();
     396           0 :         rVal.nMaxHPos  = aBoundRect.Right() - rVal.nWidth;
     397             : 
     398           0 :         rVal.nMinVPos  = aBoundRect.Top();
     399             :         // OD 26.09.2003 #i17567#, #i18732# - determine maximum vertical position
     400           0 :         if ( bMaxVPosAtBottom )
     401             :         {
     402           0 :             rVal.nMaxVPos  = aBoundRect.Bottom() - rVal.nHeight;
     403             :         }
     404             :         else
     405             :         {
     406           0 :             rVal.nMaxVPos  = aBoundRect.Height() - rVal.nHeight;
     407             :         }
     408             : 
     409             :         // maximum width height
     410           0 :         const SwTwips nH = ( rVal.nHoriOrient != text::HoriOrientation::NONE )
     411             :                            ? aBoundRect.Left()
     412           0 :                            : rVal.nHPos;
     413           0 :         const SwTwips nV = ( rVal.nVertOrient != text::VertOrientation::NONE )
     414             :                            ? aBoundRect.Top()
     415           0 :                            : rVal.nVPos;
     416           0 :         rVal.nMaxHeight  = rVal.nMaxVPos + rVal.nHeight - nV;
     417           0 :         rVal.nMaxWidth   = rVal.nMaxHPos + rVal.nWidth - nH;
     418             :     }
     419             :     // OD 12.11.2003 #i22341# - special case for to character anchored objects
     420             :     // vertical aligned at character or top of line.
     421             :     // Note: (1) positive vertical values are positions above the top of line
     422             :     //       (2) negative vertical values are positions below the top of line
     423           0 :     else if ( (eAnchorType == FLY_AT_CHAR) &&
     424           0 :               ( rVal.nVRelOrient == text::RelOrientation::CHAR ||
     425           0 :                 rVal.nVRelOrient == text::RelOrientation::TEXT_LINE ) )
     426             :     {
     427             :         // determine horizontal values
     428           0 :         rVal.nMinHPos  = aBoundRect.Left();
     429             : 
     430           0 :         rVal.nMaxHPos  = aBoundRect.Right() - rVal.nWidth;
     431           0 :         if (rVal.nHPos + rVal.nWidth > aBoundRect.Right())
     432             :         {
     433           0 :             if (rVal.nHoriOrient == text::HoriOrientation::NONE)
     434             :             {
     435           0 :                 rVal.nHPos -= ((rVal.nHPos + rVal.nWidth) - aBoundRect.Right());
     436             :             }
     437             :             else
     438           0 :                 rVal.nWidth = aBoundRect.Right() - rVal.nHPos;
     439             :         }
     440             : 
     441           0 :         const SwTwips nH = ( rVal.nHoriOrient != text::HoriOrientation::NONE )
     442             :                            ? aBoundRect.Left()
     443           0 :                            : rVal.nHPos;
     444           0 :         rVal.nMaxWidth   = rVal.nMaxHPos + rVal.nWidth - nH;
     445             : 
     446             :         // determine vertical values
     447           0 :         rVal.nMinVPos = -( aBoundRect.Bottom() - rVal.nHeight );
     448           0 :         if ( rVal.nVPos < rVal.nMinVPos &&
     449           0 :              rVal.nVertOrient == text::VertOrientation::NONE )
     450             :         {
     451           0 :             rVal.nVPos = rVal.nMinVPos;
     452             :         }
     453             : 
     454           0 :         rVal.nMaxVPos  = -aBoundRect.Top();
     455           0 :         if ( rVal.nVPos > rVal.nMaxVPos &&
     456           0 :              rVal.nVertOrient == text::VertOrientation::NONE )
     457             :         {
     458           0 :             rVal.nVPos = rVal.nMaxVPos;
     459             :         }
     460             : 
     461           0 :         if ( rVal.nVertOrient == text::VertOrientation::NONE )
     462             :         {
     463           0 :             rVal.nMaxHeight = aBoundRect.Bottom() + rVal.nVPos;
     464             :         }
     465             :         else
     466             :         {
     467           0 :             rVal.nMaxHeight = aBoundRect.Height();
     468           0 :         }
     469             :     }
     470           0 :     else if ( eAnchorType == FLY_AS_CHAR )
     471             :     {
     472           0 :         rVal.nMinHPos = 0;
     473           0 :         rVal.nMaxHPos = 0;
     474             : 
     475           0 :         rVal.nMaxHeight = aBoundRect.Height();
     476           0 :         rVal.nMaxWidth  = aBoundRect.Width();
     477             : 
     478           0 :         rVal.nMaxVPos   = aBoundRect.Height();
     479           0 :         rVal.nMinVPos   = -aBoundRect.Height() + rVal.nHeight;
     480           0 :         if (rVal.nMaxVPos < rVal.nMinVPos)
     481             :         {
     482           0 :             rVal.nMinVPos = rVal.nMaxVPos;
     483           0 :             rVal.nMaxVPos = -aBoundRect.Height();
     484             :         }
     485             :     }
     486             :     // --> OD 2009-09-01 #mongolianlayout#
     487           0 :     if ( m_bIsInVertical || m_bIsInVerticalL2R )
     488             :     {
     489             :         //restore width/height exchange
     490           0 :         long nTmp = rVal.nWidth;
     491           0 :         rVal.nWidth = rVal.nHeight;
     492           0 :         rVal.nHeight = nTmp;
     493             :     }
     494             : 
     495           0 :     if (rVal.nMaxWidth < rVal.nWidth)
     496           0 :         rVal.nWidth = rVal.nMaxWidth;
     497           0 :     if (rVal.nMaxHeight < rVal.nHeight)
     498           0 :         rVal.nHeight = rVal.nMaxHeight;
     499             : }
     500             : 
     501             : /*--------------------------------------------------------------------
     502             :     Description: correction for border
     503             :  --------------------------------------------------------------------*/
     504           0 : SwTwips SwFlyFrmAttrMgr::CalcTopSpace()
     505             : {
     506           0 :     const SvxShadowItem& rShadow = GetShadow();
     507           0 :     const SvxBoxItem&    rBox    = GetBox();
     508           0 :     return rShadow.CalcShadowSpace(SHADOW_TOP ) + rBox.CalcLineSpace(BOX_LINE_TOP);
     509             : }
     510             : 
     511           0 : SwTwips SwFlyFrmAttrMgr::CalcBottomSpace()
     512             : {
     513           0 :     const SvxShadowItem& rShadow = GetShadow();
     514           0 :     const SvxBoxItem& rBox       = GetBox();
     515           0 :     return rShadow.CalcShadowSpace(SHADOW_BOTTOM) + rBox.CalcLineSpace(BOX_LINE_BOTTOM);
     516             : }
     517             : 
     518           0 : SwTwips SwFlyFrmAttrMgr::CalcLeftSpace()
     519             : {
     520           0 :     const SvxShadowItem& rShadow = GetShadow();
     521           0 :     const SvxBoxItem&    rBox    = GetBox();
     522           0 :     return rShadow.CalcShadowSpace(SHADOW_LEFT) + rBox.CalcLineSpace(BOX_LINE_LEFT);
     523             : }
     524             : 
     525           0 : SwTwips SwFlyFrmAttrMgr::CalcRightSpace()
     526             : {
     527           0 :     const SvxShadowItem& rShadow = GetShadow();
     528           0 :     const SvxBoxItem&    rBox    = GetBox();
     529           0 :     return rShadow.CalcShadowSpace(SHADOW_RIGHT) + rBox.CalcLineSpace(BOX_LINE_RIGHT);
     530             : }
     531             : 
     532             : /*--------------------------------------------------------------------
     533             :     Description: erase attribute from the set
     534             :  --------------------------------------------------------------------*/
     535           0 : void SwFlyFrmAttrMgr::DelAttr( sal_uInt16 nId )
     536             : {
     537           0 :     m_aSet.ClearItem( nId );
     538           0 : }
     539             : 
     540           0 : void SwFlyFrmAttrMgr::SetLRSpace( long nLeft, long nRight )
     541             : {
     542             :     OSL_ENSURE( LONG_MAX != nLeft && LONG_MAX != nRight, "Welchen Raend setzen?" );
     543             : 
     544           0 :     SvxLRSpaceItem aTmp( (SvxLRSpaceItem&)m_aSet.Get( RES_LR_SPACE ) );
     545           0 :     if( LONG_MAX != nLeft )
     546           0 :         aTmp.SetLeft( sal_uInt16(nLeft) );
     547           0 :     if( LONG_MAX != nRight )
     548           0 :         aTmp.SetRight( sal_uInt16(nRight) );
     549           0 :     m_aSet.Put( aTmp );
     550           0 : }
     551             : 
     552           0 : void SwFlyFrmAttrMgr::SetULSpace( long nTop, long nBottom )
     553             : {
     554             :     OSL_ENSURE(LONG_MAX != nTop && LONG_MAX != nBottom, "Welchen Raend setzen?" );
     555             : 
     556           0 :     SvxULSpaceItem aTmp( (SvxULSpaceItem&)m_aSet.Get( RES_UL_SPACE ) );
     557           0 :     if( LONG_MAX != nTop )
     558           0 :         aTmp.SetUpper( sal_uInt16(nTop) );
     559           0 :     if( LONG_MAX != nBottom )
     560           0 :         aTmp.SetLower( sal_uInt16(nBottom) );
     561           0 :     m_aSet.Put( aTmp );
     562           0 : }
     563             : 
     564           0 : void SwFlyFrmAttrMgr::SetPos( const Point& rPoint )
     565             : {
     566           0 :     SwFmtVertOrient aVertOrient( GetVertOrient() );
     567           0 :     SwFmtHoriOrient aHoriOrient( GetHoriOrient() );
     568             : 
     569           0 :     aHoriOrient.SetPos       ( rPoint.X() );
     570           0 :     aHoriOrient.SetHoriOrient( text::HoriOrientation::NONE  );
     571             : 
     572           0 :     aVertOrient.SetPos       ( rPoint.Y() );
     573           0 :     aVertOrient.SetVertOrient( text::VertOrientation::NONE  );
     574             : 
     575           0 :     m_aSet.Put( aVertOrient );
     576           0 :     m_aSet.Put( aHoriOrient );
     577           0 : }
     578             : 
     579           0 : void SwFlyFrmAttrMgr::SetHorzOrientation( sal_Int16 eOrient )
     580             : {
     581           0 :     SwFmtHoriOrient aHoriOrient( GetHoriOrient() );
     582           0 :     aHoriOrient.SetHoriOrient( eOrient );
     583           0 :     m_aSet.Put( aHoriOrient );
     584           0 : }
     585             : 
     586           0 : void SwFlyFrmAttrMgr::SetVertOrientation( sal_Int16 eOrient )
     587             : {
     588           0 :     SwFmtVertOrient aVertOrient( GetVertOrient() );
     589           0 :     aVertOrient.SetVertOrient( eOrient );
     590           0 :     m_aSet.Put( aVertOrient );
     591           0 : }
     592             : 
     593           0 : void SwFlyFrmAttrMgr::SetHeightSizeType( SwFrmSize eType )
     594             : {
     595           0 :     SwFmtFrmSize aSize( GetFrmSize() );
     596           0 :     aSize.SetHeightSizeType( eType );
     597           0 :     m_aSet.Put( aSize );
     598           0 : }
     599             : 
     600           0 : void SwFlyFrmAttrMgr::SetSize( const Size& rSize )
     601             : {
     602           0 :     SwFmtFrmSize aSize( GetFrmSize() );
     603           0 :     aSize.SetSize(Size(std::max(rSize.Width(), long(MINFLY)), std::max(rSize.Height(), long(MINFLY))));
     604           0 :     m_aSet.Put( aSize );
     605           0 : }
     606             : 
     607           0 : void SwFlyFrmAttrMgr::SetAttrSet(const SfxItemSet& rSet)
     608             : {
     609           0 :     m_aSet.ClearItem();
     610           0 :     m_aSet.Put( rSet );
     611           0 : }
     612             : 
     613             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10