LCOV - code coverage report
Current view: top level - sw/source/core/inc - flyfrms.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 22 24 91.7 %
Date: 2012-08-25 Functions: 11 13 84.6 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 5 12 41.7 %

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

Generated by: LCOV version 1.10