LibreOffice Module sw (master)  1
anchoreddrawobject.hxx
Go to the documentation of this file.
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 #include <boost/optional.hpp>
24 
25 namespace tools { class Rectangle; }
26 
29 {
30  private:
31  // boolean, indicating that the object position has been invalidated
32  // and that a positioning has to be performed.
33  bool mbValidPos;
34 
35  // rectangle, keeping the last object rectangle after the positioning
37 
38  // boolean, indicating that anchored drawing object hasn't been attached
39  // to an anchor frame yet. Once, it is attached to an anchor frame the
40  // boolean changes its state.
42 
43  // boolean, indicating that anchored
44  // drawing object hasn't been positioned yet. Once, it's positioned the
45  // boolean changes its state.
47 
48  // boolean, indicating that after change of layout direction the
49  // anchored drawing object has to be captured on the page, if it exceeds
50  // the left or right page margin.
51  // Needed for compatibility option <DoNotCaptureDrawObjsOnPage>
53 
58  void MakeObjPosAnchoredAtPara();
59 
64  void MakeObjPosAnchoredAtLayout();
65 
73  void SetPositioningAttr();
74 
86  void SetDrawObjAnchor();
87 
89  void InvalidatePage_( SwPageFrame* _pPageFrame );
90 
91  protected:
92  virtual void ObjectAttachedToAnchorFrame() override;
93 
97  virtual void RegisterAtCorrectPage() override;
98 
99  virtual bool SetObjTop_( const SwTwips _nTop) override;
100  virtual bool SetObjLeft_( const SwTwips _nLeft) override;
101 
102  virtual const SwRect GetObjBoundRect() const override;
103 
104  public:
105 
107  virtual ~SwAnchoredDrawObject() override;
108 
109  // declaration of pure virtual methods of base class <SwAnchoredObject>
110  virtual void MakeObjPos() override;
111  virtual void InvalidateObjPos() override;
112  bool IsValidPos() const
113  {
114  return mbValidPos;
115  }
116 
117  // accessors to the format
118  virtual SwFrameFormat& GetFrameFormat() override;
119  virtual const SwFrameFormat& GetFrameFormat() const override;
120 
121  // accessors to the object area and its position
122  virtual const SwRect GetObjRect() const override;
123 
125  void SetLastObjRect( const tools::Rectangle& _rNewObjRect );
126 
142  void AdjustPositioningAttr( const SwFrame* _pNewAnchorFrame,
143  const SwRect* _pNewObjRect = nullptr );
144 
146  virtual void NotifyBackground( SwPageFrame* _pPageFrame,
147  const SwRect& _rRect,
148  PrepareHint _eHint ) override;
149 
150  bool NotYetPositioned() const
151  {
152  return mbNotYetPositioned;
153  }
154 
155  // change of layout direction needs to be tracked
156  // for setting <mbCaptureAfterLayoutDirChange>.
157  virtual void UpdateLayoutDir() override;
158  bool IsOutsidePage() const;
159 
160  // new Loop control
161  void ValidateThis() { mbValidPos = true; }
162 
164  virtual const char* getElementName( ) const override { return "SwAnchoredDrawObject"; }
165 };
166 
167 #endif
168 
169 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void MakeObjPos()=0
method to determine position for the object and set the position at the object
Base class of the Writer layout elements.
Definition: frame.hxx:295
class for the positioning of drawing objects
virtual bool SetObjTop_(const SwTwips _nTop)=0
virtual void UpdateLayoutDir()
method update layout direction the layout direction, the anchored object is assigned to ...
virtual const char * getElementName() const override
The element name to show in the XML dump.
boost::optional< tools::Rectangle > maLastObjRect
long SwTwips
Definition: swtypes.hxx:49
Of course Writer needs its own rectangles.
Definition: swrect.hxx:34
boost::optional< tools::Rectangle > const & GetLastObjRect() const
wrapper class for the positioning of Writer fly frames and drawing objects
virtual void ObjectAttachedToAnchorFrame()
method to indicate, that anchored object is attached to an anchor frame
virtual bool SetObjLeft_(const SwTwips _nLeft)=0
virtual const SwRect GetObjRect() const =0
Style of a layout element.
Definition: frmfmt.hxx:57
PrepareHint
Definition: swtypes.hxx:204
virtual void InvalidateObjPos()=0
method to invalidate position of the anchored object
#define SW_DLLPUBLIC
Definition: swdllapi.h:28
A page of the document layout.
Definition: pagefrm.hxx:40
virtual SwFrameFormat & GetFrameFormat()=0
virtual void RegisterAtCorrectPage()=0
method to assure that anchored object is registered at the correct page frame
virtual void NotifyBackground(SwPageFrame *_pPageFrame, const SwRect &_rRect, PrepareHint _eHint)=0
method to trigger notification of 'background'
virtual const SwRect GetObjBoundRect() const =0