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

Generated by: LCOV version 1.10