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

Generated by: LCOV version 1.10