LCOV - code coverage report
Current view: top level - sw/source/ui/inc - frmmgr.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 20 0.0 %
Date: 2012-08-25 Functions: 0 12 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           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                 :            : #ifndef _FRMMGR_HXX
      29                 :            : #define _FRMMGR_HXX
      30                 :            : 
      31                 :            : #include "swtypes.hxx"
      32                 :            : #include "frmatr.hxx"
      33                 :            : #include <editeng/svxenum.hxx>
      34                 :            : #include <tools/gen.hxx>
      35                 :            : #include <fmtfsize.hxx>
      36                 :            : #include <fmtsrnd.hxx>
      37                 :            : #include <fmtornt.hxx>
      38                 :            : #include <fmtanchr.hxx>
      39                 :            : #include "swdllapi.h"
      40                 :            : 
      41                 :            : class   SwWrtShell;
      42                 :            : struct  SvxSwFrameValidation;
      43                 :            : struct  SwPosition;
      44                 :            : 
      45                 :            : class   SwFmtCol;
      46                 :            : 
      47                 :            : const SwTwips   DFLT_WIDTH      = MM50 * 4;
      48                 :            : const SwTwips   DFLT_HEIGHT     = MM50;
      49                 :            : 
      50                 :            : #define FULL_ATTRSET    0xffff
      51                 :            : 
      52                 :            : #define FRMMGR_TYPE_NONE    0x00
      53                 :            : #define FRMMGR_TYPE_TEXT    0x01
      54                 :            : #define FRMMGR_TYPE_GRF     0x02
      55                 :            : #define FRMMGR_TYPE_OLE     0x04
      56                 :            : #define FRMMGR_TYPE_LABEL   0x08
      57                 :            : #define FRMMGR_TYPE_ENVELP  0x10
      58                 :            : 
      59                 :          0 : class SW_DLLPUBLIC SwFlyFrmAttrMgr
      60                 :            : {
      61                 :            :     SfxItemSet  aSet;
      62                 :            :     Point       aAbsPos;
      63                 :            :     SwWrtShell  *pOwnSh;
      64                 :            : 
      65                 :            :     sal_Bool        bAbsPos,
      66                 :            :                 bNewFrm;
      67                 :            :     sal_Bool        bIsInVertical;
      68                 :            :     // --> OD 2009-09-01 #mongolianlayout#
      69                 :            :     sal_Bool        bIsInVerticalL2R;
      70                 :            : 
      71                 :            :     // internal calculation for borders
      72                 :            :     SW_DLLPRIVATE SwTwips           CalcTopSpace();
      73                 :            :     SW_DLLPRIVATE SwTwips           CalcBottomSpace();
      74                 :            :     SW_DLLPRIVATE SwTwips           CalcLeftSpace();
      75                 :            :     SW_DLLPRIVATE SwTwips           CalcRightSpace();
      76                 :            : 
      77                 :            :     SW_DLLPRIVATE void _UpdateFlyFrm(); // post-treatment after insert or update
      78                 :            : 
      79                 :            : public:
      80                 :            :     SwFlyFrmAttrMgr( sal_Bool bNew, SwWrtShell* pSh, sal_uInt8 nType );
      81                 :            : 
      82                 :            :     //CopyCtor for dialogs to check the metrics
      83                 :            :     SwFlyFrmAttrMgr( sal_Bool bNew, SwWrtShell *pSh, const SfxItemSet &rSet );
      84                 :            : 
      85                 :            :     inline SwWrtShell*  GetShell() { return pOwnSh; }
      86                 :            : 
      87                 :            :     void                SetAnchor(RndStdIds eId);
      88                 :            :     inline RndStdIds    GetAnchor()  const;
      89                 :            : 
      90                 :            :     void                SetHorzOrientation(sal_Int16 eOrient);
      91                 :            :     void                SetVertOrientation(sal_Int16 eOrient);
      92                 :            : 
      93                 :            :     // absolute position
      94                 :            :     void                SetAbsPos(const Point& rLPoint);
      95                 :            : 
      96                 :            :     // anchor's relative position
      97                 :            :     void                SetPos(const Point& rLPoint);
      98                 :            :     inline Point        GetPos() const;
      99                 :            : 
     100                 :            :     // size
     101                 :            :     void                SetSize(const Size& rLSize);
     102                 :            :     inline const Size&  GetSize() const;
     103                 :            : 
     104                 :            :     inline sal_uInt16       GetHeightPercent() const;
     105                 :            : 
     106                 :            :     void                SetHeightSizeType(SwFrmSize eType);
     107                 :            : 
     108                 :            :     // space to content
     109                 :            :     void                SetLRSpace( long nLeft  = LONG_MAX,
     110                 :            :                                     long nRight = LONG_MAX );
     111                 :            :     void                SetULSpace( long nTop   = LONG_MAX,
     112                 :            :                                     long nBottom= LONG_MAX );
     113                 :            : 
     114                 :            :     void                SetCol( const SwFmtCol &rCol);
     115                 :            : 
     116                 :            :     // change and query attributes
     117                 :            :     void                UpdateAttrMgr();
     118                 :            :     void                UpdateFlyFrm();
     119                 :            : 
     120                 :            :     // create new frame
     121                 :            :     sal_Bool                InsertFlyFrm();
     122                 :            :     void                InsertFlyFrm(RndStdIds      eAnchorType,
     123                 :            :                                    const Point    &rPos,
     124                 :            :                                    const Size     &rSize,
     125                 :            :                                    sal_Bool           bAbsPos = sal_False);
     126                 :            : 
     127                 :            :     // check and change metrics
     128                 :            :     void                ValidateMetrics(SvxSwFrameValidation& rVal,
     129                 :            :                             const SwPosition* pToCharCntntPos,
     130                 :            :                             sal_Bool bOnlyPercentRefValue = sal_False);
     131                 :            : 
     132                 :            :     void                DelAttr(sal_uInt16 nId);
     133                 :            : 
     134                 :            :     // reach out the set
     135                 :            :     inline const SfxItemSet &GetAttrSet() const { return aSet; }
     136                 :          0 :     inline       SfxItemSet &GetAttrSet()       { return aSet; }
     137                 :            :     void                     SetAttrSet(const SfxItemSet& rSet);
     138                 :            : 
     139                 :            :     inline const SwFmtVertOrient &GetVertOrient() const;
     140                 :            :     inline const SwFmtHoriOrient &GetHoriOrient() const;
     141                 :            :     inline const SvxShadowItem   &GetShadow() const;
     142                 :            :     inline const SvxBoxItem      &GetBox() const;
     143                 :            :     inline const SwFmtSurround   &GetSurround() const;
     144                 :            :     inline const SwFmtFrmSize    &GetFrmSize() const;
     145                 :            : 
     146                 :          0 :     long CalcWidthBorder()  { return CalcLeftSpace()+CalcRightSpace(); }
     147                 :          0 :     long CalcHeightBorder() { return CalcTopSpace()+CalcBottomSpace(); }
     148                 :            : };
     149                 :            : 
     150                 :          0 : inline const Size& SwFlyFrmAttrMgr::GetSize() const
     151                 :            : {
     152                 :          0 :     return ((SwFmtFrmSize&)aSet.Get(RES_FRM_SIZE)).GetSize();
     153                 :            : }
     154                 :            : 
     155                 :          0 : inline const SwFmtVertOrient &SwFlyFrmAttrMgr::GetVertOrient() const
     156                 :            : {
     157                 :          0 :     return ((SwFmtVertOrient&)aSet.Get(RES_VERT_ORIENT));
     158                 :            : }
     159                 :          0 : inline const SwFmtHoriOrient &SwFlyFrmAttrMgr::GetHoriOrient() const
     160                 :            : {
     161                 :          0 :     return ((SwFmtHoriOrient &)aSet.Get(RES_HORI_ORIENT));
     162                 :            : }
     163                 :          0 : inline const SwFmtFrmSize& SwFlyFrmAttrMgr::GetFrmSize() const
     164                 :            : {
     165                 :          0 :     return ((SwFmtFrmSize&)aSet.Get(RES_FRM_SIZE));
     166                 :            : }
     167                 :          0 : inline const SvxShadowItem &SwFlyFrmAttrMgr::GetShadow() const
     168                 :            : {
     169                 :          0 :     return ((SvxShadowItem&)aSet.Get(RES_SHADOW));
     170                 :            : }
     171                 :          0 : inline const SvxBoxItem &SwFlyFrmAttrMgr::GetBox() const
     172                 :            : {
     173                 :          0 :     return ((SvxBoxItem&)aSet.Get(RES_BOX));
     174                 :            : }
     175                 :            : inline const SwFmtSurround &SwFlyFrmAttrMgr::GetSurround() const
     176                 :            : {
     177                 :            :     return ((SwFmtSurround&)aSet.Get(RES_SURROUND));
     178                 :            : }
     179                 :            : 
     180                 :          0 : inline Point SwFlyFrmAttrMgr::GetPos() const
     181                 :            : {
     182                 :          0 :     return Point( GetHoriOrient().GetPos(), GetVertOrient().GetPos() );
     183                 :            : }
     184                 :            : 
     185                 :          0 : inline RndStdIds SwFlyFrmAttrMgr::GetAnchor()  const
     186                 :            : {
     187                 :          0 :     return ((SwFmtAnchor&)aSet.Get(RES_ANCHOR)).GetAnchorId();
     188                 :            : }
     189                 :            : 
     190                 :            : inline sal_uInt16 SwFlyFrmAttrMgr::GetHeightPercent() const
     191                 :            : {
     192                 :            :     return GetFrmSize().GetHeightPercent();
     193                 :            : }
     194                 :            : 
     195                 :            : #endif
     196                 :            : 
     197                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10