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

Generated by: LCOV version 1.11