LCOV - code coverage report
Current view: top level - sw/source/core/inc - flyfrm.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 25 0.0 %
Date: 2014-04-14 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             : #ifndef INCLUDED_SW_SOURCE_CORE_INC_FLYFRM_HXX
      21             : #define INCLUDED_SW_SOURCE_CORE_INC_FLYFRM_HXX
      22             : 
      23             : #include "layfrm.hxx"
      24             : #include <list>
      25             : #include "frmfmt.hxx"
      26             : 
      27             : class SwPageFrm;
      28             : class SwFmtFrmSize;
      29             : struct SwCrsrMoveState;
      30             : class SwBorderAttrs;
      31             : class SwVirtFlyDrawObj;
      32             : class SwFrmFmts;
      33             : class SwAttrSetChg;
      34             : class PolyPolygon;
      35             : class SwFlyDrawContact;
      36             : class SwFmt;
      37             : 
      38             : #include <anchoredobject.hxx>
      39             : 
      40             : /** search an anchor for paragraph bound frames starting from pOldAnch
      41             : 
      42             :     needed for dragging of objects bound to a paragraph for showing an anchor
      43             :     indicator as well as for changing the anchor.
      44             : 
      45             :     implemented in layout/flycnt.cxx
      46             :  */
      47             : const SwCntntFrm *FindAnchor( const SwFrm *pOldAnch, const Point &rNew,
      48             :                               const sal_Bool bBody = sal_False );
      49             : 
      50             : /** calculate rectangle in that the object can be moved or rather be resized */
      51             : sal_Bool CalcClipRect( const SdrObject *pSdrObj, SwRect &rRect, sal_Bool bMove = sal_True );
      52             : 
      53             : /** general base class for all free-flowing frames
      54             : 
      55             :     #i26791# - inherit also from <SwAnchoredFlyFrm>
      56             : */
      57             : class SwFlyFrm : public SwLayoutFrm, public SwAnchoredObject
      58             : {
      59             :     // is allowed to lock, implemented in frmtool.cxx
      60             :     friend void AppendObjs   ( const SwFrmFmts *, sal_uLong, SwFrm *, SwPageFrm * );
      61             :     friend void Notify( SwFlyFrm *, SwPageFrm *pOld, const SwRect &rOld,
      62             :                         const SwRect* pOldPrt );
      63             : 
      64             :     void InitDrawObj( sal_Bool bNotify ); // these to methods are called in the
      65             :     void FinitDrawObj();                  // constructors
      66             : 
      67             :     void _UpdateAttr( const SfxPoolItem*, const SfxPoolItem*, sal_uInt8 &,
      68             :                       SwAttrSetChg *pa = 0, SwAttrSetChg *pb = 0 );
      69             : 
      70             :     using SwLayoutFrm::CalcRel;
      71             : 
      72             :     sal_uInt32 _GetOrdNumForNewRef( const SwFlyDrawContact* );
      73             :     SwVirtFlyDrawObj* CreateNewRef( SwFlyDrawContact* );
      74             : 
      75             : protected:
      76             :     // Predecessor/Successor for chaining with text flow
      77             :     SwFlyFrm *pPrevLink, *pNextLink;
      78             : 
      79             : private:
      80             :     // It must be possible to block Cntnt-bound flys so that they will be not
      81             :     // formatted; in this case MakeAll() returns immediately. This is necessary
      82             :     // for page changes during formattting. In addition, it is needed during
      83             :     // the constructor call of the root object since otherwise the anchor will
      84             :     // be formatted before the root is anchored correctly to a shell and
      85             :     // because too much would be formatted as a result.
      86             :     sal_Bool bLocked :1;
      87             :     // sal_True if the background of NotifyDTor needs to be notified at the end
      88             :     // of a MakeAll() call.
      89             :     sal_Bool bNotifyBack :1;
      90             : 
      91             : protected:
      92             :     // Pos, PrtArea or SSize have been invalidated - they will be evaluated
      93             :     // again immediately because they have to be valid _at all time_.
      94             :     // The invalidation is tracked here so that LayAction knows about it and
      95             :     // can handle it properly. Exceptions prove the rule.
      96             :     sal_Bool bInvalid :1;
      97             : 
      98             :     // sal_True if the proposed height of an attribute is a minimal height
      99             :     // (this means that the frame can grow higher if needed)
     100             :     sal_Bool bMinHeight :1;
     101             :     // sal_True if the fly frame could not format position/size based on its
     102             :     // attributes, e.g. because there was not enough space.
     103             :     sal_Bool bHeightClipped :1;
     104             :     sal_Bool bWidthClipped :1;
     105             :     // If sal_True call only the format after adjusting the width (CheckClip);
     106             :     // but the width will not be re-evaluated based on the attributes.
     107             :     sal_Bool bFormatHeightOnly :1;
     108             : 
     109             :     sal_Bool bInCnt :1;        ///< FLY_AS_CHAR, anchored as character
     110             :     sal_Bool bAtCnt :1;        ///< FLY_AT_PARA, anchored at paragraph
     111             :     sal_Bool bLayout :1;       ///< FLY_AT_PAGE, FLY_AT_FLY, at page or at frame
     112             :     sal_Bool bAutoPosition :1; ///< FLY_AT_CHAR, anchored at character
     113             : 
     114             :     sal_Bool bNoShrink :1;     ///< temporary forbid shrinking to avoid loops
     115             :     // If sal_True, the content of the fly frame will not be deleted when it
     116             :     // is moved to an invisible layer.
     117             :     sal_Bool bLockDeleteContent :1;
     118             : 
     119             :     friend class SwNoTxtFrm; // is allowed to call NotifyBackground
     120             : 
     121             :     Point m_aContentPos;        // content area's position relatively to Frm
     122             :     bool m_bValidContentPos;
     123             : 
     124             :     virtual void Format( const SwBorderAttrs *pAttrs = 0 ) SAL_OVERRIDE;
     125             :     void MakePrtArea( const SwBorderAttrs &rAttrs );
     126             :     void MakeContentPos( const SwBorderAttrs &rAttrs );
     127             : 
     128           0 :     void Lock()         { bLocked = sal_True; }
     129           0 :     void Unlock()       { bLocked = sal_False; }
     130             : 
     131             :     void SetMinHeight()  { bMinHeight = sal_True; }
     132             :     void ResetMinHeight(){ bMinHeight = sal_False; }
     133             : 
     134             :     Size CalcRel( const SwFmtFrmSize &rSz ) const;
     135             :     SwTwips CalcAutoWidth() const;
     136             : 
     137             :     SwFlyFrm( SwFlyFrmFmt*, SwFrm*, SwFrm *pAnchor );
     138             : 
     139             :     /** method to assure that anchored object is registered at the correct
     140             :         page frame
     141             : 
     142             :         #i28701#
     143             :     */
     144             :     virtual void RegisterAtCorrectPage() SAL_OVERRIDE;
     145             : 
     146             :     virtual bool _SetObjTop( const SwTwips _nTop ) SAL_OVERRIDE;
     147             :     virtual bool _SetObjLeft( const SwTwips _nLeft ) SAL_OVERRIDE;
     148             : 
     149             :     virtual const SwRect GetObjBoundRect() const SAL_OVERRIDE;
     150             :     virtual void Modify( const SfxPoolItem*, const SfxPoolItem* ) SAL_OVERRIDE;
     151             : 
     152             :     virtual const IDocumentDrawModelAccess* getIDocumentDrawModelAccess( ) SAL_OVERRIDE;
     153             : 
     154             :     SwTwips CalcContentHeight(const SwBorderAttrs *pAttrs, const SwTwips nMinHeight, const SwTwips nUL);
     155             : 
     156             : public:
     157             :     // #i26791#
     158             :     TYPEINFO_OVERRIDE();
     159             : 
     160             :     virtual ~SwFlyFrm();
     161             :     // get client information
     162             :     virtual bool GetInfo( SfxPoolItem& ) const SAL_OVERRIDE;
     163             :     virtual void Paint( SwRect const&,
     164             :                         SwPrintData const*const pPrintData = NULL ) const SAL_OVERRIDE;
     165             :     virtual Size ChgSize( const Size& aNewSize ) SAL_OVERRIDE;
     166             :     virtual bool GetCrsrOfst( SwPosition *, Point&,
     167             :                               SwCrsrMoveState* = 0, bool bTestBackground = false ) const SAL_OVERRIDE;
     168             : 
     169             :     virtual void CheckDirection( bool bVert ) SAL_OVERRIDE;
     170             :     virtual void Cut() SAL_OVERRIDE;
     171             : #ifdef DBG_UTIL
     172             :     virtual void Paste( SwFrm* pParent, SwFrm* pSibling = 0 ) SAL_OVERRIDE;
     173             : #endif
     174             : 
     175             :     SwTwips _Shrink( SwTwips, sal_Bool bTst );
     176             :     SwTwips _Grow  ( SwTwips, sal_Bool bTst );
     177             :     void    _Invalidate( SwPageFrm *pPage = 0 );
     178             : 
     179             :     sal_Bool FrmSizeChg( const SwFmtFrmSize & );
     180             : 
     181           0 :     SwFlyFrm *GetPrevLink() const { return pPrevLink; }
     182           0 :     SwFlyFrm *GetNextLink() const { return pNextLink; }
     183             : 
     184             :     static void ChainFrames( SwFlyFrm *pMaster, SwFlyFrm *pFollow );
     185             :     static void UnchainFrames( SwFlyFrm *pMaster, SwFlyFrm *pFollow );
     186             : 
     187             :     SwFlyFrm *FindChainNeighbour( SwFrmFmt &rFmt, SwFrm *pAnch = 0 );
     188             : 
     189             :     // #i26791#
     190             :     const SwVirtFlyDrawObj* GetVirtDrawObj() const;
     191             :     SwVirtFlyDrawObj *GetVirtDrawObj();
     192             :     void NotifyDrawObj();
     193             : 
     194             :     void ChgRelPos( const Point &rAbsPos );
     195           0 :     sal_Bool IsInvalid() const { return bInvalid; }
     196           0 :     void Invalidate() const { ((SwFlyFrm*)this)->bInvalid = sal_True; }
     197           0 :     void Validate() const { ((SwFlyFrm*)this)->bInvalid = sal_False; }
     198             : 
     199           0 :     sal_Bool IsMinHeight()  const { return bMinHeight; }
     200           0 :     sal_Bool IsLocked()     const { return bLocked; }
     201           0 :     sal_Bool IsAutoPos()    const { return bAutoPosition; }
     202           0 :     sal_Bool IsFlyInCntFrm() const { return bInCnt; }
     203           0 :     sal_Bool IsFlyFreeFrm() const { return bAtCnt || bLayout; }
     204           0 :     sal_Bool IsFlyLayFrm() const { return bLayout; }
     205           0 :     sal_Bool IsFlyAtCntFrm() const { return bAtCnt; }
     206             : 
     207           0 :     sal_Bool IsNotifyBack() const { return bNotifyBack; }
     208           0 :     void SetNotifyBack()      { bNotifyBack = sal_True; }
     209           0 :     void ResetNotifyBack()    { bNotifyBack = sal_False; }
     210           0 :     sal_Bool IsNoShrink()   const { return bNoShrink; }
     211             :     void SetNoShrink( sal_Bool bNew ) { bNoShrink = bNew; }
     212           0 :     sal_Bool IsLockDeleteContent()  const { return bLockDeleteContent; }
     213             :     void SetLockDeleteContent( sal_Bool bNew ) { bLockDeleteContent = bNew; }
     214             : 
     215           0 :     sal_Bool IsClipped()        const   { return bHeightClipped || bWidthClipped; }
     216           0 :     sal_Bool IsHeightClipped()  const   { return bHeightClipped; }
     217             :     sal_Bool IsWidthClipped()   const   { return bWidthClipped;  }
     218             : 
     219             :     sal_Bool IsLowerOf( const SwLayoutFrm* pUpper ) const;
     220           0 :     inline sal_Bool IsUpperOf( const SwFlyFrm& _rLower ) const
     221             :     {
     222           0 :         return _rLower.IsLowerOf( this );
     223             :     }
     224             : 
     225             :     SwFrm *FindLastLower();
     226             : 
     227             :     // #i13147# - add parameter <_bForPaint> to avoid load of
     228             :     // the graphic during paint. Default value: sal_False
     229             :     sal_Bool GetContour( PolyPolygon&   rContour,
     230             :                      const sal_Bool _bForPaint = sal_False ) const;
     231             : 
     232             :     // Paint on this shell (consider Preview, print flag, etc. recursively)?
     233             :     static sal_Bool IsPaint( SdrObject *pObj, const SwViewShell *pSh );
     234             : 
     235             :     /** SwFlyFrm::IsBackgroundTransparent
     236             : 
     237             :         determines if background of fly frame has to be drawn transparently
     238             : 
     239             :         definition found in /core/layout/paintfrm.cxx
     240             : 
     241             :         @return true, if background color is transparent or a existing background
     242             :         graphic is transparent.
     243             :     */
     244             :     bool IsBackgroundTransparent() const;
     245             : 
     246             :     /** SwFlyFrm::IsShadowTransparent
     247             : 
     248             :         determine if shadow color of fly frame has to be drawn transparently
     249             : 
     250             :         definition found in /core/layout/paintfrm.cxx
     251             : 
     252             :         @return true, if shadow color is transparent.
     253             :     */
     254             :     bool IsShadowTransparent() const;
     255             : 
     256             :     void Chain( SwFrm* _pAnchor );
     257             :     void Unchain();
     258             :     void InsertCnt();
     259             :     void DeleteCnt();
     260             :     void InsertColumns();
     261             : 
     262             :     // #i26791# - pure virtual methods of base class <SwAnchoredObject>
     263             :     virtual void MakeObjPos() SAL_OVERRIDE;
     264             :     virtual void InvalidateObjPos() SAL_OVERRIDE;
     265             : 
     266             :     virtual SwFrmFmt& GetFrmFmt() SAL_OVERRIDE;
     267             :     virtual const SwFrmFmt& GetFrmFmt() const SAL_OVERRIDE;
     268             : 
     269             :     virtual const SwRect GetObjRect() const SAL_OVERRIDE;
     270             : 
     271             :     /** method to determine if a format on the Writer fly frame is possible
     272             : 
     273             :         #i28701#
     274             :         refine 'IsFormatPossible'-conditions of method
     275             :         <SwAnchoredObject::IsFormatPossible()> by:
     276             :         format isn't possible, if Writer fly frame is locked resp. col-locked.
     277             :     */
     278             :     virtual bool IsFormatPossible() const SAL_OVERRIDE;
     279             :     static void GetAnchoredObjects( std::list<SwAnchoredObject*>&, const SwFmt& rFmt );
     280             : 
     281             :     // overwriting "SwFrmFmt *SwLayoutFrm::GetFmt" to provide the correct derived return type.
     282             :     // (This is in order to skip on the otherwise necessary casting of the result to
     283             :     // 'SwFlyFrmFmt *' after calls to this function. The casting is now done in this function.)
     284             :     virtual const SwFlyFrmFmt *GetFmt() const SAL_OVERRIDE;
     285             :     virtual       SwFlyFrmFmt *GetFmt() SAL_OVERRIDE;
     286             : 
     287           0 :     virtual void dumpAsXml( xmlTextWriterPtr writer ) SAL_OVERRIDE { SwLayoutFrm::dumpAsXml( writer ); };
     288             : 
     289             :     virtual void Calc() const SAL_OVERRIDE;
     290             : 
     291             :     const Point& ContentPos() const { return m_aContentPos; }
     292           0 :     Point& ContentPos() { return m_aContentPos; }
     293             : 
     294             :     void InvalidateContentPos();
     295             : };
     296             : #endif
     297             : 
     298             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10