LibreOffice Module sw (master)  1
flyfrms.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_SOURCE_CORE_INC_FLYFRMS_HXX
20 #define INCLUDED_SW_SOURCE_CORE_INC_FLYFRMS_HXX
21 
22 #include <sal/config.h>
23 
24 #include "flyfrm.hxx"
25 
26 class SwNoTextFrame;
27 
29 
30 // Base class for those Flys that can "move freely" or better that are not
31 // bound in Content.
32 class SwFlyFreeFrame : public SwFlyFrame
33 {
34 private:
35  // #i34753# - flag for at-page anchored Writer fly frames
36  // to prevent a positioning - call of method <MakeObjPos()> -, if Writer
37  // fly frame is already clipped during its format by the object formatter.
38  bool mbNoMakePos : 1;
39 
40  // #i37068# - flag to prevent move in method <CheckClip(..)>
42 
44 
45  // RotateFlyFrame3 add TransformableSwFrame
46  std::unique_ptr< TransformableSwFrame > mpTransformableSwFrame;
47 
48  void CheckClip( const SwFormatFrameSize &rSz ); //'Emergency' Clipping.
49 
60  bool HasEnvironmentAutoSize() const;
61 
62  // RotateFlyFrame3 - Support for outer Frame of a SwGrfNode
63  // Only for local data extraction. To uniquely access information
64  // for local transformation, use getFrameArea(Print)Transformation
65  double getLocalFrameRotation() const;
66 
67 protected:
68  // #i28701# - new friend class <SwFlyNotify> for access to
69  // method <NotifyBackground>
70  friend class SwFlyNotify;
71  virtual void NotifyBackground( SwPageFrame *pPage,
72  const SwRect& rRect, PrepareHint eHint) override;
74 
75  virtual void DestroyImpl() override;
76  virtual ~SwFlyFreeFrame() override;
77 
78 public:
79  // #i28701#
80 
81  virtual void MakeAll(vcl::RenderContext* pRenderContext) override;
82 
83  // #i37068# - accessors for member <mbNoMoveOnCheckClip>
84  void SetNoMoveOnCheckClip( const bool _bNewNoMoveOnCheckClip )
85  {
86  mbNoMoveOnCheckClip = _bNewNoMoveOnCheckClip;
87  }
88  bool IsNoMoveOnCheckClip() const
89  {
90  return mbNoMoveOnCheckClip;
91  }
92  // #i34753# - accessors for member <mbNoMakePos>
93  void SetNoMakePos( const bool _bNoMakePos )
94  {
95  if ( IsFlyLayFrame() )
96  {
97  mbNoMakePos = _bNoMakePos;
98  }
99  }
100  bool IsNoMakePos() const
101  {
102  if ( IsFlyLayFrame() )
103  {
104  return mbNoMakePos;
105  }
106  else
107  {
108  return false;
109  }
110  }
111 
112  const SwRect& GetUnclippedFrame( ) const
113  {
114  if ( maUnclippedFrame.HasArea( ) )
115  return maUnclippedFrame;
116  else
117  return getFrameArea();
118  }
119 
128  virtual bool IsFormatPossible() const override;
129 
130  // RotateFlyFrame3 - Support for Transformations
131  bool isTransformableSwFrame() const { return bool(mpTransformableSwFrame); }
132  TransformableSwFrame* getTransformableSwFrame() { return mpTransformableSwFrame.get(); }
133  const TransformableSwFrame* getTransformableSwFrame() const { return mpTransformableSwFrame.get(); }
134 
135  // RotateFlyFrame3 - Support for AutoContour
136  bool supportsAutoContour() const;
137 
138  // RotateFlyFrame3 - Support for Transformations
139  virtual basegfx::B2DHomMatrix getFrameAreaTransformation() const override;
141 
142  // RotateFlyFrame3 - Support for Transformations
143  virtual void transform_translate(const Point& rOffset) override;
144 };
145 
146 // Flys that are bound to LayoutFrames and not to Content
148 {
149 public:
150  // #i28701#
151 
153 
154 protected:
155  virtual void Modify( const SfxPoolItem*, const SfxPoolItem* ) override;
156 };
157 
158 // Flys that are bound to Content but not in Content
160 {
161 protected:
162  virtual void MakeAll(vcl::RenderContext* pRenderContext) override;
163 
164  // #i28701#
165  virtual bool InvalidationAllowed( const InvalidationType _nInvalid ) const override;
166 
172  virtual void RegisterAtCorrectPage() override;
173  virtual void Modify( const SfxPoolItem*, const SfxPoolItem* ) override;
174 
175 public:
176  // #i28701#
177 
179 
180  void SetAbsPos( const Point &rNew );
181 
182  // #i26791#
183  virtual void MakeObjPos() override;
184 
192  virtual bool IsFormatPossible() const override;
193 };
194 
195 // Flys that are bound to a character in Content
197 {
198  Point aRef; // relative to this point AbsPos is being calculated
199 
200  virtual void DestroyImpl() override;
201  virtual ~SwFlyInContentFrame() override;
202 
203 protected:
204  virtual void NotifyBackground( SwPageFrame *pPage,
205  const SwRect& rRect, PrepareHint eHint) override;
206  virtual void MakeAll(vcl::RenderContext* pRenderContext) override;
207  virtual void Modify( const SfxPoolItem*, const SfxPoolItem* ) override;
208 
209 public:
210  // #i28701#
211 
213 
214  virtual void Format( vcl::RenderContext* pRenderContext, const SwBorderAttrs *pAttrs = nullptr ) override;
215 
216  void SetRefPoint( const Point& rPoint, const Point &rRelAttr,
217  const Point &rRelPos );
218  const Point &GetRefPoint() const { return aRef; }
219  Point const & GetRelPos() const;
220 
221  // (26.11.93, see tabfrm.hxx, but might also be valid for others)
222  // For creation of a Fly after a FlyCnt was created _and_ inserted.
223  // Must be called by creator because can be pasted only after creation.
224  // Sometimes the page for registering the Flys is not visible until then
225  // as well.
226  void RegistFlys();
227 
228  //see layact.cxx
229  void AddRefOfst( long nOfst ) { aRef.AdjustY( nOfst ); }
230 
231  // #i26791#
232  virtual void MakeObjPos() override;
233 
234  // invalidate anchor frame on invalidation of the position, because the
235  // position is calculated during the format of the anchor frame
236  virtual void ActionOnInvalidation( const InvalidationType _nInvalid ) override;
237 };
238 
239 #endif
240 
241 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Base class of the Writer layout elements.
Definition: frame.hxx:295
bool IsFlyLayFrame() const
Definition: flyfrm.hxx:195
double getLocalFrameRotation() const
Definition: flylay.cxx:423
TransformableSwFrame * getTransformableSwFrame()
Definition: flyfrms.hxx:132
SwRect maUnclippedFrame
Definition: flyfrms.hxx:43
virtual basegfx::B2DHomMatrix getFrameAreaTransformation() const override
Definition: flylay.cxx:374
SwFlyInContentFrame(SwFlyFrameFormat *, SwFrame *, SwFrame *pAnchor)
Definition: flyincnt.cxx:31
virtual bool IsFormatPossible() const override
method to determine, if a format on the Writer fly frame is possible
Definition: flylay.cxx:713
virtual void NotifyBackground(SwPageFrame *pPage, const SwRect &rRect, PrepareHint eHint) override
Notifies the background (all ContentFrames that currently are overlapping).
Definition: flylay.cxx:108
bool IsNoMoveOnCheckClip() const
Definition: flyfrms.hxx:88
void SetAbsPos(const Point &rNew)
Definition: flycnt.cxx:1165
RotateFlyFrame3: Helper class when you want to make your SwFrame derivate transformable.
Definition: frame.hxx:231
Of course Writer needs its own rectangles.
Definition: swrect.hxx:34
virtual void Format(vcl::RenderContext *pRenderContext, const SwBorderAttrs *pAttrs=nullptr) override
Here the content gets formatted initially.
Definition: flyincnt.cxx:136
SwFlyLayFrame(SwFlyFrameFormat *, SwFrame *, SwFrame *pAnchor)
Definition: flylay.cxx:720
double getLocalFrameRotation_from_SwNoTextFrame(const SwNoTextFrame &rNoTextFrame)
Definition: flylay.cxx:418
const TransformableSwFrame * getTransformableSwFrame() const
Definition: flyfrms.hxx:133
virtual void MakeObjPos() override
method to determine position for the object and set the position at the object
Definition: flycnt.cxx:1407
virtual void DestroyImpl() override
Definition: flylay.cxx:65
Point const & GetRelPos() const
Definition: flyincnt.cxx:194
const SwRect & getFrameArea() const
Definition: frame.hxx:175
bool isTransformableSwFrame() const
Definition: flyfrms.hxx:131
virtual void RegisterAtCorrectPage() override
method to assure that anchored object is registered at the correct page frame
Definition: flycnt.cxx:1390
void CheckClip(const SwFormatFrameSize &rSz)
Definition: flylay.cxx:474
const Point & GetRefPoint() const
Definition: flyfrms.hxx:218
virtual void ActionOnInvalidation(const InvalidationType _nInvalid) override
method to perform additional actions on an invalidation
Definition: flyincnt.cxx:179
virtual void transform_translate(const Point &rOffset) override
Definition: flylay.cxx:399
virtual void MakeAll(vcl::RenderContext *pRenderContext) override
|* With a paragraph-anchored fly it's absolutely possible that |* the anchor reacts to changes of the...
Definition: flycnt.cxx:321
virtual ~SwFlyFreeFrame() override
Definition: flylay.cxx:93
virtual void Modify(const SfxPoolItem *, const SfxPoolItem *) override
Definition: flyincnt.cxx:94
void SetNoMoveOnCheckClip(const bool _bNewNoMoveOnCheckClip)
Definition: flyfrms.hxx:84
PrepareHint
Definition: swtypes.hxx:204
std::unique_ptr< TransformableSwFrame > mpTransformableSwFrame
Definition: flyfrms.hxx:46
virtual void Modify(const SfxPoolItem *, const SfxPoolItem *) override
Definition: flylay.cxx:728
long AdjustY(long nVertMove)
bool mbNoMoveOnCheckClip
Definition: flyfrms.hxx:41
void AddRefOfst(long nOfst)
Definition: flyfrms.hxx:229
bool HasArea() const
Definition: swrect.hxx:290
bool HasEnvironmentAutoSize() const
determines, if direct environment of fly frame has 'auto' size
Definition: flylay.cxx:448
virtual basegfx::B2DHomMatrix getFramePrintAreaTransformation() const override
Definition: flylay.cxx:386
bool mbNoMakePos
Definition: flyfrms.hxx:38
bool IsNoMakePos() const
Definition: flyfrms.hxx:100
virtual bool IsFormatPossible() const override
method to determine, if a format on the Writer fly frame is possible
Definition: flycnt.cxx:536
A page of the document layout.
Definition: pagefrm.hxx:40
virtual void MakeAll(vcl::RenderContext *pRenderContext) override
Definition: flylay.cxx:114
void SetNoMakePos(const bool _bNoMakePos)
Definition: flyfrms.hxx:93
const SwRect & GetUnclippedFrame() const
Definition: flyfrms.hxx:112
general base class for all free-flowing frames
Definition: flyfrm.hxx:60
virtual void NotifyBackground(SwPageFrame *pPage, const SwRect &rRect, PrepareHint eHint) override
method to trigger notification of 'background'
Definition: flyincnt.cxx:185
bool supportsAutoContour() const
Definition: flylay.cxx:303
virtual void MakeAll(vcl::RenderContext *pRenderContext) override
Definition: flyincnt.cxx:208
void SetRefPoint(const Point &rPoint, const Point &rRelAttr, const Point &rRelPos)
Definition: flyincnt.cxx:62
virtual void MakeObjPos() override
Calculate object position.
Definition: flyincnt.cxx:156
virtual ~SwFlyInContentFrame() override
Definition: flyincnt.cxx:56
virtual void DestroyImpl() override
Definition: flyincnt.cxx:45
SwFlyAtContentFrame(SwFlyFrameFormat *, SwFrame *, SwFrame *pAnchor)
Definition: flycnt.cxx:73
virtual bool InvalidationAllowed(const InvalidationType _nInvalid) const override
method to determine, if an invalidation is allowed.
Definition: flycnt.cxx:1438
virtual void Modify(const SfxPoolItem *, const SfxPoolItem *) override
Definition: flycnt.cxx:82
InvalidationType
enumeration for the different invalidations #i28701#
Definition: frame.hxx:467
SwFlyFreeFrame(SwFlyFrameFormat *, SwFrame *, SwFrame *pAnchor)
Definition: flylay.cxx:53