LCOV - code coverage report
Current view: top level - sw/source/core/inc - flyfrms.hxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 26 28 92.9 %
Date: 2014-04-11 Functions: 13 14 92.9 %
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_CORE_INC_FLYFRMS_HXX
      20             : #define INCLUDED_SW_SOURCE_CORE_INC_FLYFRMS_HXX
      21             : 
      22             : #include "flyfrm.hxx"
      23             : 
      24             : // #i28701#
      25             : class SwFlyAtCntFrm;
      26             : 
      27             : // Base class for those Flys that can "move freely" or better that are not
      28             : // bound in Cntnt.
      29             : class SwFlyFreeFrm : public SwFlyFrm
      30             : {
      31             :     SwPageFrm *pPage;   // page where the Fly is registered
      32             : 
      33             :     // #i34753# - flag for at-page anchored Writer fly frames
      34             :     // to prevent a positioning - call of method <MakeObjPos()> -, if Writer
      35             :     // fly frame is already clipped during its format by the object formatter.
      36             :     bool mbNoMakePos;
      37             : 
      38             :     // #i37068# - flag to prevent move in method <CheckClip(..)>
      39             :     bool mbNoMoveOnCheckClip;
      40             : 
      41             :     SwRect maUnclippedFrm;
      42             : 
      43             :     void CheckClip( const SwFmtFrmSize &rSz );  //'Emergency' Clipping.
      44             : 
      45             :     /** determines, if direct environment of fly frame has 'auto' size
      46             : 
      47             :         #i17297#
      48             :         start with anchor frame and search for a header, footer, row or fly frame
      49             :         stopping at page frame.
      50             :         return <true>, if such a frame is found and it has 'auto' size.
      51             :         otherwise <false> is returned.
      52             : 
      53             :         @return boolean indicating, that direct environment has 'auto' size
      54             :     */
      55             :     bool HasEnvironmentAutoSize() const;
      56             : 
      57             : protected:
      58             :     // #i28701# - new friend class <SwFlyNotify> for access to
      59             :     // method <NotifyBackground>
      60             :     friend class SwFlyNotify;
      61             :     virtual void NotifyBackground( SwPageFrm *pPage,
      62             :                                    const SwRect& rRect, PrepareHint eHint) SAL_OVERRIDE;
      63             :     SwFlyFreeFrm( SwFlyFrmFmt*, SwFrm*, SwFrm *pAnchor );
      64             : 
      65             : public:
      66             :     // #i28701#
      67             :     TYPEINFO_OVERRIDE();
      68             : 
      69             :     virtual ~SwFlyFreeFrm();
      70             : 
      71             :     virtual void MakeAll() SAL_OVERRIDE;
      72             : 
      73             :     // #i37068# - accessors for member <mbNoMoveOnCheckClip>
      74        1480 :     inline void SetNoMoveOnCheckClip( const bool _bNewNoMoveOnCheckClip )
      75             :     {
      76        1480 :         mbNoMoveOnCheckClip = _bNewNoMoveOnCheckClip;
      77        1480 :     }
      78        1465 :     inline bool IsNoMoveOnCheckClip() const
      79             :     {
      80        1465 :         return mbNoMoveOnCheckClip;
      81             :     }
      82             :     // #i34753# - accessors for member <mbNoMakePos>
      83          97 :     inline void SetNoMakePos( const bool _bNoMakePos )
      84             :     {
      85          97 :         if ( IsFlyLayFrm() )
      86             :         {
      87          97 :             mbNoMakePos = _bNoMakePos;
      88             :         }
      89          97 :     }
      90        1424 :     inline bool IsNoMakePos() const
      91             :     {
      92        1424 :         if ( IsFlyLayFrm() )
      93             :         {
      94          80 :             return mbNoMakePos;
      95             :         }
      96             :         else
      97             :         {
      98        1344 :             return false;
      99             :         }
     100             :     }
     101             : 
     102           2 :     inline const SwRect& GetUnclippedFrm( ) const
     103             :     {
     104           2 :         if ( maUnclippedFrm.HasArea( ) )
     105           0 :             return maUnclippedFrm;
     106             :         else
     107           2 :             return Frm();
     108             :     }
     109             : 
     110             :     /** method to determine, if a format on the Writer fly frame is possible
     111             : 
     112             :         #i28701#
     113             :         refine 'IsFormatPossible'-conditions of method
     114             :         <SwFlyFrm::IsFormatPossible()> by:
     115             :         format isn't possible, if Writer fly frame isn't registered at a page frame
     116             :         and its anchor frame isn't inside another Writer fly frame.
     117             :     */
     118             :     virtual bool IsFormatPossible() const SAL_OVERRIDE;
     119             : };
     120             : 
     121             : // Flys that are bound to LayoutFrms and not to Cntnt
     122         208 : class SwFlyLayFrm : public SwFlyFreeFrm
     123             : {
     124             : public:
     125             :     // #i28701#
     126             :     TYPEINFO_OVERRIDE();
     127             : 
     128             :     SwFlyLayFrm( SwFlyFrmFmt*, SwFrm*, SwFrm *pAnchor );
     129             :     SwFlyLayFrm( SwFlyLayFrm& );
     130             : protected:
     131             :     virtual void Modify( const SfxPoolItem*, const SfxPoolItem* ) SAL_OVERRIDE;
     132             : };
     133             : 
     134             : // Flys that are bound to Cntnt but not in Cntnt
     135        1298 : class SwFlyAtCntFrm : public SwFlyFreeFrm
     136             : {
     137             : protected:
     138             :     virtual void MakeAll() SAL_OVERRIDE;
     139             : 
     140             :     // #i28701#
     141             :     virtual bool _InvalidationAllowed( const InvalidationType _nInvalid ) const SAL_OVERRIDE;
     142             : 
     143             :     /** method to assure that anchored object is registered at the correct
     144             :         page frame
     145             : 
     146             :         #i28701#
     147             :     */
     148             :     virtual void RegisterAtCorrectPage() SAL_OVERRIDE;
     149             :     virtual void Modify( const SfxPoolItem*, const SfxPoolItem* ) SAL_OVERRIDE;
     150             : 
     151             : public:
     152             :     // #i28701#
     153             :     TYPEINFO_OVERRIDE();
     154             : 
     155             :     SwFlyAtCntFrm( SwFlyFrmFmt*, SwFrm*, SwFrm *pAnchor );
     156             : 
     157             :     void SetAbsPos( const Point &rNew );
     158             : 
     159             :     // #i26791#
     160             :     virtual void MakeObjPos() SAL_OVERRIDE;
     161             : 
     162             :     /** method to determine, if a format on the Writer fly frame is possible
     163             : 
     164             :         #i28701#
     165             :         refine 'IsFormatPossible'-conditions of method
     166             :         <SwFlyFreeFrm::IsFormatPossible()> by:
     167             :         format isn't possible, if method <MakeAll()> is already in progress.
     168             :     */
     169             :     virtual bool IsFormatPossible() const SAL_OVERRIDE;
     170             : };
     171             : 
     172             : // Flys that are bound to a character in Cntnt
     173             : class SwFlyInCntFrm : public SwFlyFrm
     174             : {
     175             :     Point aRef;  // relative to this point AbsPos is being calculated
     176             : 
     177             :     sal_Bool bInvalidLayout :1;
     178             :     sal_Bool bInvalidCntnt  :1;
     179             : 
     180             : protected:
     181             :     virtual void NotifyBackground( SwPageFrm *pPage,
     182             :                                    const SwRect& rRect, PrepareHint eHint) SAL_OVERRIDE;
     183             :     virtual void MakeAll() SAL_OVERRIDE;
     184             :     virtual void  Modify( const SfxPoolItem*, const SfxPoolItem* ) SAL_OVERRIDE;
     185             : 
     186             : public:
     187             :     // #i28701#
     188             :     TYPEINFO_OVERRIDE();
     189             : 
     190             :     SwFlyInCntFrm( SwFlyFrmFmt*, SwFrm*, SwFrm *pAnchor );
     191             : 
     192             :     virtual ~SwFlyInCntFrm();
     193             :     virtual void  Format(  const SwBorderAttrs *pAttrs = 0 ) SAL_OVERRIDE;
     194             : 
     195             :     void SetRefPoint( const Point& rPoint, const Point &rRelAttr,
     196             :         const Point &rRelPos );
     197        3369 :     const Point &GetRefPoint() const { return aRef; }
     198             :     const Point GetRelPos() const;
     199             : 
     200             :     inline void InvalidateLayout() const;
     201             :     inline void InvalidateCntnt() const;
     202             :     inline void ValidateLayout() const;
     203             :     inline void ValidateCntnt() const;
     204           0 :     sal_Bool IsInvalid() const { return (bInvalidLayout || bInvalidCntnt); }
     205             :     sal_Bool IsInvalidLayout() const { return bInvalidLayout; }
     206             :     sal_Bool IsInvalidCntnt() const { return bInvalidCntnt; }
     207             : 
     208             :     // (26.11.93, see tabfrm.hxx, but might also be valid for others)
     209             :     // For creation of a Fly after a FlyCnt was created _and_ inserted.
     210             :     // Must be called by creator because can be pasted only after creation.
     211             :     // Sometimes the page for registering the Flys is not visible until then
     212             :     // as well.
     213             :     void RegistFlys();
     214             : 
     215             :     //see layact.cxx
     216          19 :     void AddRefOfst( long nOfst ) { aRef.Y() += nOfst; }
     217             : 
     218             :     // #i26791#
     219             :     virtual void MakeObjPos() SAL_OVERRIDE;
     220             : 
     221             :     // invalidate anchor frame on invalidation of the position, because the
     222             :     // position is calculated during the format of the anchor frame
     223             :     virtual void _ActionOnInvalidation( const InvalidationType _nInvalid ) SAL_OVERRIDE;
     224             : };
     225             : 
     226        1735 : inline void SwFlyInCntFrm::InvalidateLayout() const
     227             : {
     228        1735 :     ((SwFlyInCntFrm*)this)->bInvalidLayout = sal_True;
     229        1735 : }
     230        1192 : inline void SwFlyInCntFrm::InvalidateCntnt() const
     231             : {
     232        1192 :     ((SwFlyInCntFrm*)this)->bInvalidCntnt = sal_True;
     233        1192 : }
     234             : 
     235             : inline void SwFlyInCntFrm::ValidateLayout() const
     236             : {
     237             :     ((SwFlyInCntFrm*)this)->bInvalidLayout = sal_False;
     238             : }
     239             : inline void SwFlyInCntFrm::ValidateCntnt() const
     240             : {
     241             :     ((SwFlyInCntFrm*)this)->bInvalidCntnt = sal_False;
     242             : }
     243             : 
     244             : #endif
     245             : 
     246             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10