LCOV - code coverage report
Current view: top level - sw/inc - anchoreddrawobject.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 4 7 57.1 %
Date: 2014-11-03 Functions: 3 5 60.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_INC_ANCHOREDDRAWOBJECT_HXX
      20             : #define INCLUDED_SW_INC_ANCHOREDDRAWOBJECT_HXX
      21             : 
      22             : #include <anchoredobject.hxx>
      23             : 
      24             : class Rectangle;
      25             : 
      26             : /** class for the positioning of drawing objects
      27             : 
      28             :     @author OD
      29             : */
      30             : class SW_DLLPUBLIC SwAnchoredDrawObject : public SwAnchoredObject
      31             : {
      32             :     private:
      33             :         // boolean, indicating that the object position has been invalidated
      34             :         // and that a positioning has to be performed.
      35             :         bool mbValidPos;
      36             : 
      37             :         // rectangle, keeping the last object rectangle after the positioning
      38             :         Rectangle* mpLastObjRect;
      39             : 
      40             :         // boolean, indicating that anchored drawing object hasn't been attached
      41             :         // to a anchor frame yet. Once, it is attached to a anchor frame the
      42             :         // boolean changes its state.
      43             :         bool mbNotYetAttachedToAnchorFrame;
      44             : 
      45             :         // boolean, indicating that anchored
      46             :         // drawing object hasn't been positioned yet. Once, it's positioned the
      47             :         // boolean changes its state.
      48             :         bool mbNotYetPositioned;
      49             : 
      50             :         // boolean, indicating that after change of layout direction the
      51             :         // anchored drawing object has to be captured on the page, if it exceeds
      52             :         // the left or right page margin.
      53             :         // Needed for compatibility option <DoNotCaptureDrawObjsOnPage>
      54             :         bool mbCaptureAfterLayoutDirChange;
      55             : 
      56             :         /** method for the intrinsic positioning of a at-paragraph|at-character
      57             :             anchored drawing object
      58             : 
      59             :             helper method for method <MakeObjPos>
      60             : 
      61             :             @author OD
      62             :         */
      63             :         void _MakeObjPosAnchoredAtPara();
      64             : 
      65             :         /** method for the intrinsic positioning of a at-page|at-frame anchored
      66             :             drawing object
      67             : 
      68             :             helper method for method <MakeObjPos>
      69             : 
      70             :             @author OD
      71             :         */
      72             :         void _MakeObjPosAnchoredAtLayout();
      73             : 
      74             :             /** method to set positioning attributes (not for as-character anchored)
      75             : 
      76             :             During load the positioning attributes aren't set.
      77             :             Thus, the positioning attributes are set by the current object geometry.
      78             :             This method is also used for the conversion for drawing objects
      79             :             (not anchored as-character) imported from OpenOffice.org file format
      80             :             once and directly before the first positioning.
      81             : 
      82             :             @author OD
      83             :         */
      84             :         void _SetPositioningAttr();
      85             : 
      86             :         /** method to set internal anchor position of <SdrObject> instance
      87             :             of the drawing object
      88             : 
      89             :             For drawing objects the internal anchor position of the <SdrObject>
      90             :             instance has to be set.
      91             :             Note: This adjustment is not be done for as-character anchored
      92             :             drawing object - the positioning code takes care of this.
      93             :             #i31698# - API for drawing objects in Writer has
      94             :             been adjusted. Thus, this method will only set the internal anchor
      95             :             position of the <SdrObject> instance to the anchor position given
      96             :             by its anchor frame.
      97             : 
      98             :             @author OD
      99             :         */
     100             :         void _SetDrawObjAnchor();
     101             : 
     102             :         /** method to invalidate the given page frame
     103             : 
     104             :             @author OD
     105             :         */
     106             :         void _InvalidatePage( SwPageFrm* _pPageFrm );
     107             : 
     108             :     protected:
     109             :         virtual void ObjectAttachedToAnchorFrame() SAL_OVERRIDE;
     110             : 
     111             :         /** method to assure that anchored object is registered at the correct
     112             :             page frame
     113             : 
     114             :             @author OD
     115             :         */
     116             :         virtual void RegisterAtCorrectPage() SAL_OVERRIDE;
     117             : 
     118             :         virtual bool _SetObjTop( const SwTwips _nTop) SAL_OVERRIDE;
     119             :         virtual bool _SetObjLeft( const SwTwips _nLeft) SAL_OVERRIDE;
     120             : 
     121             :         virtual const SwRect GetObjBoundRect() const SAL_OVERRIDE;
     122             : 
     123             :     public:
     124             :         TYPEINFO_OVERRIDE();
     125             : 
     126             :         SwAnchoredDrawObject();
     127             :         virtual ~SwAnchoredDrawObject();
     128             : 
     129             :         // declaration of pure virtual methods of base class <SwAnchoredObject>
     130             :         virtual void MakeObjPos() SAL_OVERRIDE;
     131             :         virtual void InvalidateObjPos() SAL_OVERRIDE;
     132           0 :         inline bool IsValidPos() const
     133             :         {
     134           0 :             return mbValidPos;
     135             :         }
     136             : 
     137             :         // accessors to the format
     138             :         virtual SwFrmFmt& GetFrmFmt() SAL_OVERRIDE;
     139             :         virtual const SwFrmFmt& GetFrmFmt() const SAL_OVERRIDE;
     140             : 
     141             :         // accessors to the object area and its position
     142             :         virtual const SwRect GetObjRect() const SAL_OVERRIDE;
     143             :         // Return value can be NULL.
     144          40 :         const Rectangle* GetLastObjRect() const { return mpLastObjRect;}
     145             : 
     146             :         void SetLastObjRect( const Rectangle& _rNewObjRect );
     147             : 
     148             :         /** adjust positioning and alignment attributes for new anchor frame
     149             : 
     150             :             Set horizontal and vertical position/alignment to manual position
     151             :             relative to anchor frame area using the anchor position of the
     152             :             new anchor frame and the current absolute drawing object position.
     153             :             Note: For correct Undo/Redo method should only be called inside a
     154             :             Undo-/Redo-action.
     155             : 
     156             :             @author OD
     157             : 
     158             :             @param <_pNewAnchorFrm>
     159             :             input parameter - new anchor frame for the anchored object.
     160             : 
     161             :             @param <_pNewObjRect>
     162             :             optional input parameter - proposed new object rectangle. If not
     163             :             provided the current object rectangle is taken.
     164             :         */
     165             :         void AdjustPositioningAttr( const SwFrm* _pNewAnchorFrm,
     166             :                                     const SwRect* _pNewObjRect = 0L );
     167             : 
     168             :         /** method to notify background of drawing object
     169             : 
     170             :             @author OD
     171             :         */
     172             :         virtual void NotifyBackground( SwPageFrm* _pPageFrm,
     173             :                                        const SwRect& _rRect,
     174             :                                        PrepareHint _eHint ) SAL_OVERRIDE;
     175             : 
     176       32526 :         inline bool NotYetPositioned() const
     177             :         {
     178       32526 :             return mbNotYetPositioned;
     179             :         }
     180             : 
     181             :         // change of layout direction needs to be tracked
     182             :         // for setting <mbCaptureAfterLayoutDirChange>.
     183             :         virtual void UpdateLayoutDir() SAL_OVERRIDE;
     184             :         bool IsOutsidePage() const;
     185             : 
     186             :         // new Loop control
     187           0 :         void ValidateThis() { mbValidPos = true; }
     188             : 
     189             :         /** The element name to show in the XML dump.
     190             :           */
     191          26 :         virtual const char* getElementName( ) const SAL_OVERRIDE { return "SwAnchoredDrawObject"; }
     192             : };
     193             : 
     194             : #endif
     195             : 
     196             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10