LCOV - code coverage report
Current view: top level - sw/source/core/inc - objectformatter.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 8 8 100.0 %
Date: 2012-08-25 Functions: 4 4 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           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 _OBJECTFORMATTER_HXX
      29                 :            : #define _OBJECTFORMATTER_HXX
      30                 :            : 
      31                 :            : #include <sal/types.h>
      32                 :            : 
      33                 :            : class SwFrm;
      34                 :            : // #i26945#
      35                 :            : class SwTxtFrm;
      36                 :            : class SwLayoutFrm;
      37                 :            : class SwPageFrm;
      38                 :            : class SwAnchoredObject;
      39                 :            : class SwLayAction;
      40                 :            : // OD 2004-10-04 #i26945#
      41                 :            : class SwPageNumAndTypeOfAnchors;
      42                 :            : 
      43                 :            : // -----------------------------------------------------------------------------
      44                 :            : // #i28701#
      45                 :            : // Format floating screen objects, which are anchored at the given anchor frame
      46                 :            : // and registered at the given page frame.
      47                 :            : // -----------------------------------------------------------------------------
      48                 :            : class SwObjectFormatter
      49                 :            : {
      50                 :            :     private:
      51                 :            :         // page frame, at which the floating screen objects are registered.
      52                 :            :         const SwPageFrm& mrPageFrm;
      53                 :            : 
      54                 :            :         // boolean, indicating that only as-character anchored objects have to
      55                 :            :         // be formatted.
      56                 :            :         bool mbFormatOnlyAsCharAnchored;
      57                 :            : 
      58                 :            :         // value of document compatibility option 'Consider wrapping style on
      59                 :            :         // object positioning'
      60                 :            :         const bool mbConsiderWrapOnObjPos;
      61                 :            : 
      62                 :            :         // layout action calling the format of the floating screen objects
      63                 :            :         SwLayAction* mpLayAction;
      64                 :            : 
      65                 :            :         // data structure to collect page number of object's 'anchor'
      66                 :            :         // #i26945#
      67                 :            :         SwPageNumAndTypeOfAnchors* mpPgNumAndTypeOfAnchors;
      68                 :            : 
      69                 :            :         /** helper method for method <_FormatObj(..)> - performs the intrinsic
      70                 :            :             format of the layout of the given layout frame and all its lower
      71                 :            :             layout frames.
      72                 :            : 
      73                 :            :             #i28701#
      74                 :            :             IMPORTANT NOTE:
      75                 :            :             Method corresponds to methods <SwLayAction::FormatLayoutFly(..)> and
      76                 :            :             <SwLayAction::FormatLayout(..)>. Thus, its code for the formatting have
      77                 :            :             to be synchronised.
      78                 :            :         */
      79                 :            :         void _FormatLayout( SwLayoutFrm& _rLayoutFrm );
      80                 :            : 
      81                 :            :         /** helper method for method <_FormatObj(..)> - performs the intrinsic
      82                 :            :             format of the content of the given floating screen object.
      83                 :            : 
      84                 :            :             #i28701#
      85                 :            :         */
      86                 :            :         void _FormatObjCntnt( SwAnchoredObject& _rAnchoredObj );
      87                 :            : 
      88                 :            :     protected:
      89                 :            :         SwObjectFormatter( const SwPageFrm& _rPageFrm,
      90                 :            :                            SwLayAction* _pLayAction = 0L,
      91                 :            :                            const bool _bCollectPgNumOfAnchors = false );
      92                 :            : 
      93                 :            :         static SwObjectFormatter* CreateObjFormatter( SwFrm& _rAnchorFrm,
      94                 :            :                                                       const SwPageFrm& _rPageFrm,
      95                 :            :                                                       SwLayAction* _pLayAction );
      96                 :            : 
      97                 :            :         virtual SwFrm& GetAnchorFrm() = 0;
      98                 :            : 
      99                 :          9 :         inline const SwPageFrm& GetPageFrm() const
     100                 :            :         {
     101                 :          9 :             return mrPageFrm;
     102                 :            :         }
     103                 :            : 
     104                 :       1333 :         inline bool ConsiderWrapOnObjPos() const
     105                 :            :         {
     106                 :       1333 :             return mbConsiderWrapOnObjPos;
     107                 :            :         }
     108                 :            : 
     109                 :       9064 :         inline SwLayAction* GetLayAction()
     110                 :            :         {
     111                 :       9064 :             return mpLayAction;
     112                 :            :         }
     113                 :            : 
     114                 :            :         /** method to restrict the format of floating screen objects to
     115                 :            :             as-character anchored ones
     116                 :            :         */
     117                 :            :         inline void SetFormatOnlyAsCharAnchored()
     118                 :            :         {
     119                 :            :             mbFormatOnlyAsCharAnchored = true;
     120                 :            :         }
     121                 :            : 
     122                 :       4723 :         inline bool FormatOnlyAsCharAnchored() const
     123                 :            :         {
     124                 :       4723 :             return mbFormatOnlyAsCharAnchored;
     125                 :            :         }
     126                 :            : 
     127                 :            :         /** performs the intrinsic format of a given floating screen object and its content.
     128                 :            : 
     129                 :            :             #i28701#
     130                 :            :         */
     131                 :            :         void _FormatObj( SwAnchoredObject& _rAnchoredObj );
     132                 :            : 
     133                 :            :         /** invokes the intrinsic format method for all floating screen objects,
     134                 :            :             anchored at anchor frame on the given page frame
     135                 :            : 
     136                 :            :             #i28701#
     137                 :            :             #i26945# - for format of floating screen objects for
     138                 :            :             follow text frames, the 'master' text frame is passed to the method.
     139                 :            :             Thus, the objects, whose anchor character is inside the follow text
     140                 :            :             frame can be formatted.
     141                 :            : 
     142                 :            :             @param _pMasterTxtFrm
     143                 :            :             input parameter - pointer to 'master' text frame. default value: NULL
     144                 :            :         */
     145                 :            :         bool _FormatObjsAtFrm( SwTxtFrm* _pMasterTxtFrm = 0L );
     146                 :            : 
     147                 :            :         /** accessor to collected anchored object
     148                 :            : 
     149                 :            :             #i28701#
     150                 :            :         */
     151                 :            :         SwAnchoredObject* GetCollectedObj( const sal_uInt32 _nIndex );
     152                 :            : 
     153                 :            :         /** accessor to 'anchor' page number of collected anchored object
     154                 :            : 
     155                 :            :             #i28701#
     156                 :            :         */
     157                 :            :         sal_uInt32 GetPgNumOfCollected( const sal_uInt32 _nIndex );
     158                 :            : 
     159                 :            :         /** accessor to 'anchor' type of collected anchored object
     160                 :            : 
     161                 :            :             #i26945#
     162                 :            :         */
     163                 :            :         bool IsCollectedAnchoredAtMaster( const sal_uInt32 _nIndex );
     164                 :            : 
     165                 :            :         /** accessor to total number of collected anchored objects
     166                 :            : 
     167                 :            :             #i28701#
     168                 :            :         */
     169                 :            :         sal_uInt32 CountOfCollected();
     170                 :            : 
     171                 :            :     public:
     172                 :            :         virtual ~SwObjectFormatter();
     173                 :            : 
     174                 :            :         /** intrinsic method to format a certain floating screen object
     175                 :            : 
     176                 :            :             #i40147# - add parameter <_bCheckForMovedFwd>
     177                 :            : 
     178                 :            :             @param _rAnchoredObj
     179                 :            :             input parameter - anchored object, which have to be formatted.
     180                 :            : 
     181                 :            :             @param _bCheckForMovedFwd
     182                 :            :             input parameter - boolean indicating, that after a successful
     183                 :            :             format of the anchored object the anchor frame has to be checked,
     184                 :            :             if it would moved forward due to the positioning of the anchored object.
     185                 :            :             default value: false
     186                 :            :             value only considered, if wrapping style influence has to be
     187                 :            :             considered for the positioning of the anchored object.
     188                 :            :         */
     189                 :            :         virtual bool DoFormatObj( SwAnchoredObject& _rAnchoredObj,
     190                 :            :                                   const bool _bCheckForMovedFwd = false ) = 0;
     191                 :            : 
     192                 :            :         /** intrinsic method to format all floating screen objects
     193                 :            :         */
     194                 :            :         virtual bool DoFormatObjs() = 0;
     195                 :            : 
     196                 :            :         /** method to format all floating screen objects at the given anchor frame
     197                 :            :         */
     198                 :            :         static bool FormatObjsAtFrm( SwFrm& _rAnchorFrm,
     199                 :            :                                      const SwPageFrm& _rPageFrm,
     200                 :            :                                      SwLayAction* _pLayAction = 0L );
     201                 :            : 
     202                 :            :         /** method to format a given floating screen object
     203                 :            :         */
     204                 :            :         static bool FormatObj( SwAnchoredObject& _rAnchoredObj,
     205                 :            :                                SwFrm* _pAnchorFrm = 0L,
     206                 :            :                                const SwPageFrm* _pPageFrm = 0L,
     207                 :            :                                SwLayAction* _pLayAction = 0L );
     208                 :            : };
     209                 :            : 
     210                 :            : #endif
     211                 :            : 
     212                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10