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 <swdllapi.h>
25
26#include "flyfrm.hxx"
27#include "flowfrm.hxx"
28
29class SwNoTextFrame;
30
32
33// Base class for those Flys that can "move freely" or better that are not
34// bound in Content.
36{
37private:
38 // #i34753# - flag for at-page anchored Writer fly frames
39 // to prevent a positioning - call of method <MakeObjPos()> -, if Writer
40 // fly frame is already clipped during its format by the object formatter.
41 bool mbNoMakePos : 1;
42
43 // #i37068# - flag to prevent move in method <CheckClip(..)>
45
47
48 // RotateFlyFrame3 add TransformableSwFrame
49 std::unique_ptr< TransformableSwFrame > mpTransformableSwFrame;
50
51 void CheckClip( const SwFormatFrameSize &rSz ); //'Emergency' Clipping.
52
63 bool HasEnvironmentAutoSize() const;
64
65 // RotateFlyFrame3 - Support for outer Frame of a SwGrfNode
66 // Only for local data extraction. To uniquely access information
67 // for local transformation, use getFrameArea(Print)Transformation
68 double getLocalFrameRotation() const;
69
70protected:
71 // #i28701# - new friend class <SwFlyNotify> for access to
72 // method <NotifyBackground>
73 friend class SwFlyNotify;
74 virtual void NotifyBackground( SwPageFrame *pPage,
75 const SwRect& rRect, PrepareHint eHint) override;
76 SwFlyFreeFrame( SwFlyFrameFormat*, SwFrame*, SwFrame *pAnchor, bool bFollow = false );
77
78 virtual void DestroyImpl() override;
79 virtual ~SwFlyFreeFrame() override;
80
81public:
82 // #i28701#
83
84 virtual void MakeAll(vcl::RenderContext* pRenderContext) override;
85
86 // #i37068# - accessors for member <mbNoMoveOnCheckClip>
87 void SetNoMoveOnCheckClip( const bool _bNewNoMoveOnCheckClip )
88 {
89 mbNoMoveOnCheckClip = _bNewNoMoveOnCheckClip;
90 }
92 {
93 return mbNoMoveOnCheckClip;
94 }
95 // #i34753# - accessors for member <mbNoMakePos>
96 void SetNoMakePos( const bool _bNoMakePos )
97 {
98 if ( IsFlyLayFrame() )
99 {
100 mbNoMakePos = _bNoMakePos;
101 }
102 }
103 bool IsNoMakePos() const
104 {
105 if ( IsFlyLayFrame() )
106 {
107 return mbNoMakePos;
108 }
109 else
110 {
111 return false;
112 }
113 }
114
115 const SwRect& GetUnclippedFrame( ) const
116 {
117 if ( maUnclippedFrame.HasArea( ) )
118 return maUnclippedFrame;
119 else
120 return getFrameArea();
121 }
122
131 virtual bool IsFormatPossible() const override;
132
133 // RotateFlyFrame3 - Support for Transformations
134 bool isTransformableSwFrame() const { return bool(mpTransformableSwFrame); }
135 TransformableSwFrame* getTransformableSwFrame() { return mpTransformableSwFrame.get(); }
136 const TransformableSwFrame* getTransformableSwFrame() const { return mpTransformableSwFrame.get(); }
137
138 // RotateFlyFrame3 - Support for AutoContour
139 bool supportsAutoContour() const;
140
141 // RotateFlyFrame3 - Support for Transformations
142 virtual basegfx::B2DHomMatrix getFrameAreaTransformation() const override;
144
145 // RotateFlyFrame3 - Support for Transformations
146 virtual void transform_translate(const Point& rOffset) override;
147};
148
150class SwFlyLayFrame final: public SwFlyFreeFrame
151{
152public:
153 // #i28701#
154
156
157 virtual void RegisterAtPage(SwPageFrame &) override;
158 virtual void SwClientNotify(const SwModify&, const SfxHint&) override;
159};
160
162class SW_DLLPUBLIC SwFlyAtContentFrame final: public SwFlyFreeFrame, public SwFlowFrame
163{
164 virtual void MakeAll(vcl::RenderContext* pRenderContext) override;
165
166 // #i28701#
167 virtual bool InvalidationAllowed( const InvalidationType _nInvalid ) const override;
168
174 virtual void RegisterAtCorrectPage() override;
175 virtual void RegisterAtPage(SwPageFrame &) override;
176 virtual void SwClientNotify(const SwModify&, const SfxHint&) override;
177 bool ShouldBwdMoved(SwLayoutFrame* pNewUpper, bool& rReformat) override;
178
179public:
180 // #i28701#
181
182 SwFlyAtContentFrame( SwFlyFrameFormat*, SwFrame*, SwFrame *pAnchor, bool bFollow = false );
185
186 void SetAbsPos( const Point &rNew );
187
188 // #i26791#
189 virtual void MakeObjPos() override;
190
198 virtual bool IsFormatPossible() const override;
199 const SwFlyAtContentFrame* GetFollow() const;
200 SwFlyAtContentFrame* GetFollow();
201 const SwFlyAtContentFrame* GetPrecede() const;
202 SwFlyAtContentFrame* GetPrecede();
204 void DelEmpty();
205 void dumpAsXmlAttributes(xmlTextWriterPtr pWriter) const override;
206};
207
210{
211 Point m_aRef; // relative to this point AbsPos is being calculated
212
213 virtual void DestroyImpl() override;
214 virtual ~SwFlyInContentFrame() override;
215
216 virtual void NotifyBackground(SwPageFrame *pPage, const SwRect& rRect, PrepareHint eHint) override;
217 virtual void MakeAll(vcl::RenderContext* pRenderContext) override;
218 virtual void SwClientNotify(const SwModify&, const SfxHint&) override;
219
220public:
221 // #i28701#
222
224
225 virtual void Format( vcl::RenderContext* pRenderContext, const SwBorderAttrs *pAttrs = nullptr ) override;
226
227 void SetRefPoint( const Point& rPoint, const Point &rRelAttr,
228 const Point &rRelPos );
229 const Point &GetRefPoint() const { return m_aRef; }
230 Point const & GetRelPos() const;
231
232 // (26.11.93, see tabfrm.hxx, but might also be valid for others)
233 // For creation of a Fly after a FlyCnt was created _and_ inserted.
234 // Must be called by creator because can be pasted only after creation.
235 // Sometimes the page for registering the Flys is not visible until then
236 // as well.
237 void RegistFlys();
238
239 //see layact.cxx
240 void AddRefOfst( tools::Long nOfst ) { m_aRef.AdjustY( nOfst ); }
241 void AddRefOfst(Point const& rOfst) { m_aRef += rOfst; }
242
243 // #i26791#
244 virtual void MakeObjPos() override;
245
246 // invalidate anchor frame on invalidation of the position, because the
247 // position is calculated during the format of the anchor frame
248 virtual void ActionOnInvalidation( const InvalidationType _nInvalid ) override;
249};
250
251#endif
252
253/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
tools::Long AdjustY(tools::Long nVertMove)
virtual void NotifyBackground(SwPageFrame *_pPageFrame, const SwRect &_rRect, PrepareHint _eHint)=0
method to trigger notification of 'background'
Flys that are anchored to content (at-para, at-char) but not in content (as-char).
Definition: flyfrms.hxx:163
general base class for all free-flowing frames
Definition: flyfrm.hxx:79
virtual void DestroyImpl() override
Definition: fly.cxx:327
virtual bool IsFormatPossible() const override
method to determine if a format on the Writer fly frame is possible
Definition: fly.cxx:3106
virtual void SwClientNotify(const SwModify &rMod, const SfxHint &rHint) override
Definition: fly.cxx:765
virtual void MakeObjPos() override
method to determine position for the object and set the position at the object
Definition: fly.cxx:1896
bool IsFlyLayFrame() const
Definition: flyfrm.hxx:219
virtual void RegisterAtPage(SwPageFrame &) override
Definition: fly.cxx:3097
virtual void RegisterAtCorrectPage() override
method to assure that anchored object is registered at the correct page frame
Definition: fly.cxx:3092
void SetNoMoveOnCheckClip(const bool _bNewNoMoveOnCheckClip)
Definition: flyfrms.hxx:87
bool isTransformableSwFrame() const
Definition: flyfrms.hxx:134
bool mbNoMoveOnCheckClip
Definition: flyfrms.hxx:44
std::unique_ptr< TransformableSwFrame > mpTransformableSwFrame
Definition: flyfrms.hxx:49
SwRect maUnclippedFrame
Definition: flyfrms.hxx:46
void SetNoMakePos(const bool _bNoMakePos)
Definition: flyfrms.hxx:96
const SwRect & GetUnclippedFrame() const
Definition: flyfrms.hxx:115
const TransformableSwFrame * getTransformableSwFrame() const
Definition: flyfrms.hxx:136
bool IsNoMakePos() const
Definition: flyfrms.hxx:103
bool IsNoMoveOnCheckClip() const
Definition: flyfrms.hxx:91
bool mbNoMakePos
Definition: flyfrms.hxx:41
TransformableSwFrame * getTransformableSwFrame()
Definition: flyfrms.hxx:135
Flys that are anchored as a character in the content.
Definition: flyfrms.hxx:210
virtual void NotifyBackground(SwPageFrame *pPage, const SwRect &rRect, PrepareHint eHint) override
method to trigger notification of 'background'
Definition: flyincnt.cxx:191
virtual ~SwFlyInContentFrame() override
Definition: flyincnt.cxx:57
const Point & GetRefPoint() const
Definition: flyfrms.hxx:229
void AddRefOfst(Point const &rOfst)
Definition: flyfrms.hxx:241
SwFlyInContentFrame(SwFlyFrameFormat *, SwFrame *, SwFrame *pAnchor)
Definition: flyincnt.cxx:32
virtual void SwClientNotify(const SwModify &, const SfxHint &) override
Definition: flyincnt.cxx:95
virtual void ActionOnInvalidation(const InvalidationType _nInvalid) override
method to perform additional actions on an invalidation
Definition: flyincnt.cxx:185
virtual void MakeObjPos() override
Calculate object position.
Definition: flyincnt.cxx:162
void AddRefOfst(tools::Long nOfst)
Definition: flyfrms.hxx:240
Point const & GetRelPos() const
Definition: flyincnt.cxx:200
virtual void MakeAll(vcl::RenderContext *pRenderContext) override
Definition: flyincnt.cxx:214
void SetRefPoint(const Point &rPoint, const Point &rRelAttr, const Point &rRelPos)
Definition: flyincnt.cxx:63
virtual void DestroyImpl() override
Definition: flyincnt.cxx:46
virtual void Format(vcl::RenderContext *pRenderContext, const SwBorderAttrs *pAttrs=nullptr) override
Here the content gets formatted initially.
Definition: flyincnt.cxx:142
Flys that are bound to layout frames (to-frame) and not to/as content.
Definition: flyfrms.hxx:151
virtual void RegisterAtPage(SwPageFrame &) override
Definition: flylay.cxx:723
SwFlyLayFrame(SwFlyFrameFormat *, SwFrame *, SwFrame *pAnchor)
Definition: flylay.cxx:717
virtual void SwClientNotify(const SwModify &, const SfxHint &) override
Definition: flylay.cxx:738
const SwRect & getFrameArea() const
Definition: frame.hxx:179
virtual basegfx::B2DHomMatrix getFrameAreaTransformation() const
Definition: wsfrm.cxx:127
virtual void transform_translate(const Point &rOffset)
Definition: wsfrm.cxx:150
virtual basegfx::B2DHomMatrix getFramePrintAreaTransformation() const
Definition: wsfrm.cxx:137
Base class of the Writer layout elements.
Definition: frame.hxx:315
InvalidationType
enumeration for the different invalidations #i28701#
Definition: frame.hxx:491
virtual bool InvalidationAllowed(const InvalidationType _nInvalid) const
method to determine, if an invalidation is allowed.
Definition: wsfrm.cxx:1957
virtual void dumpAsXmlAttributes(xmlTextWriterPtr writer) const
Definition: xmldump.cxx:188
A layout frame is a frame that contains other frames (m_pLower), e.g. SwPageFrame or SwTabFrame.
Definition: layfrm.hxx:36
virtual void MakeAll(vcl::RenderContext *pRenderContext) override
Definition: calcmove.cxx:944
A page of the document layout.
Definition: pagefrm.hxx:60
Of course Writer needs its own rectangles.
Definition: swrect.hxx:35
bool HasArea() const
Definition: swrect.hxx:300
RotateFlyFrame3: Helper class when you want to make your SwFrame derivate transformable.
Definition: frame.hxx:236
struct _xmlTextWriter * xmlTextWriterPtr
double getLocalFrameRotation_from_SwNoTextFrame(const SwNoTextFrame &rNoTextFrame)
Definition: flylay.cxx:415
long Long
#define SW_DLLPUBLIC
Definition: swdllapi.h:28
PrepareHint
Definition: swtypes.hxx:206