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 _FLYFRMS_HXX
20 : #define _FLYFRMS_HXX
21 :
22 : #include "flyfrm.hxx"
23 :
24 : // #i28701#
25 : class SwFlyAtCntFrm;
26 :
27 : // Base class for those Flys that can "move freely" or better that are not
28 : // bound in Cntnt.
29 : class SwFlyFreeFrm : public SwFlyFrm
30 : {
31 : SwPageFrm *pPage; // page where the Fly is registered
32 :
33 : // #i34753# - flag for at-page anchored Writer fly frames
34 : // to prevent a positioning - call of method <MakeObjPos()> -, if Writer
35 : // fly frame is already clipped during its format by the object formatter.
36 : bool mbNoMakePos;
37 :
38 : // #i37068# - flag to prevent move in method <CheckClip(..)>
39 : bool mbNoMoveOnCheckClip;
40 :
41 : SwRect maUnclippedFrm;
42 :
43 : void CheckClip( const SwFmtFrmSize &rSz ); //'Emergency' Clipping.
44 :
45 : /** determines, if direct environment of fly frame has 'auto' size
46 :
47 : #i17297#
48 : start with anchor frame and search for a header, footer, row or fly frame
49 : stopping at page frame.
50 : return <true>, if such a frame is found and it has 'auto' size.
51 : otherwise <false> is returned.
52 :
53 : @return boolean indicating, that direct environment has 'auto' size
54 : */
55 : bool HasEnvironmentAutoSize() const;
56 :
57 : protected:
58 : // #i28701# - new friend class <SwFlyNotify> for access to
59 : // method <NotifyBackground>
60 : friend class SwFlyNotify;
61 : virtual void NotifyBackground( SwPageFrm *pPage,
62 : const SwRect& rRect, PrepareHint eHint);
63 : SwFlyFreeFrm( SwFlyFrmFmt*, SwFrm*, SwFrm *pAnchor );
64 :
65 : public:
66 : // #i28701#
67 : TYPEINFO();
68 :
69 : virtual ~SwFlyFreeFrm();
70 :
71 : virtual void MakeAll();
72 :
73 : // #i37068# - accessors for member <mbNoMoveOnCheckClip>
74 16 : inline void SetNoMoveOnCheckClip( const bool _bNewNoMoveOnCheckClip )
75 : {
76 16 : mbNoMoveOnCheckClip = _bNewNoMoveOnCheckClip;
77 16 : }
78 2 : inline bool IsNoMoveOnCheckClip() const
79 : {
80 2 : return mbNoMoveOnCheckClip;
81 : }
82 : // #i34753# - accessors for member <mbNoMakePos>
83 0 : inline void SetNoMakePos( const bool _bNoMakePos )
84 : {
85 0 : if ( IsFlyLayFrm() )
86 : {
87 0 : mbNoMakePos = _bNoMakePos;
88 : }
89 0 : }
90 33 : inline bool IsNoMakePos() const
91 : {
92 33 : if ( IsFlyLayFrm() )
93 : {
94 0 : return mbNoMakePos;
95 : }
96 : else
97 : {
98 33 : return false;
99 : }
100 : }
101 :
102 0 : inline const SwRect& GetUnclippedFrm( ) const
103 : {
104 0 : if ( maUnclippedFrm.HasArea( ) )
105 0 : return maUnclippedFrm;
106 : else
107 0 : return Frm();
108 : }
109 :
110 : /** method to determine, if a format on the Writer fly frame is possible
111 :
112 : #i28701#
113 : refine 'IsFormatPossible'-conditions of method
114 : <SwFlyFrm::IsFormatPossible()> by:
115 : format isn't possible, if Writer fly frame isn't registered at a page frame
116 : and its anchor frame isn't inside another Writer fly frame.
117 : */
118 : virtual bool IsFormatPossible() const;
119 : };
120 :
121 : // Flys that are bound to LayoutFrms and not to Cntnt
122 0 : class SwFlyLayFrm : public SwFlyFreeFrm
123 : {
124 : public:
125 : // #i28701#
126 : TYPEINFO();
127 :
128 : SwFlyLayFrm( SwFlyFrmFmt*, SwFrm*, SwFrm *pAnchor );
129 : SwFlyLayFrm( SwFlyLayFrm& );
130 : protected:
131 : virtual void Modify( const SfxPoolItem*, const SfxPoolItem* );
132 : };
133 :
134 : // Flys that are bound to Cntnt but not in Cntnt
135 6 : class SwFlyAtCntFrm : public SwFlyFreeFrm
136 : {
137 : protected:
138 : virtual void MakeAll();
139 :
140 : // #i28701#
141 : virtual bool _InvalidationAllowed( const InvalidationType _nInvalid ) const;
142 :
143 : /** method to assure that anchored object is registered at the correct
144 : page frame
145 :
146 : #i28701#
147 : */
148 : virtual void RegisterAtCorrectPage();
149 : virtual void Modify( const SfxPoolItem*, const SfxPoolItem* );
150 :
151 : public:
152 : // #i28701#
153 : TYPEINFO();
154 :
155 : SwFlyAtCntFrm( SwFlyFrmFmt*, SwFrm*, SwFrm *pAnchor );
156 :
157 : void SetAbsPos( const Point &rNew );
158 :
159 : // #i26791#
160 : virtual void MakeObjPos();
161 :
162 : /** method to determine, if a format on the Writer fly frame is possible
163 :
164 : #i28701#
165 : refine 'IsFormatPossible'-conditions of method
166 : <SwFlyFreeFrm::IsFormatPossible()> by:
167 : format isn't possible, if method <MakeAll()> is already in progress.
168 : */
169 : virtual bool IsFormatPossible() const;
170 : };
171 :
172 : // Flys that are bound to a character in Cntnt
173 : class SwFlyInCntFrm : public SwFlyFrm
174 : {
175 : Point aRef; //Relativ zu diesem Point wird die AbsPos berechnet.
176 : long nLine; //Zeilenhoehe, Ref.Y() - nLine == Zeilenanfang.
177 :
178 : sal_Bool bInvalidLayout :1;
179 : sal_Bool bInvalidCntnt :1;
180 :
181 : protected:
182 : virtual void NotifyBackground( SwPageFrm *pPage,
183 : const SwRect& rRect, PrepareHint eHint);
184 : virtual void MakeAll();
185 : virtual void Modify( const SfxPoolItem*, const SfxPoolItem* );
186 :
187 : public:
188 : // #i28701#
189 : TYPEINFO();
190 :
191 : SwFlyInCntFrm( SwFlyFrmFmt*, SwFrm*, SwFrm *pAnchor );
192 :
193 : virtual ~SwFlyInCntFrm();
194 : virtual void Format( const SwBorderAttrs *pAttrs = 0 );
195 :
196 : void SetRefPoint( const Point& rPoint, const Point &rRelAttr,
197 : const Point &rRelPos );
198 737 : const Point &GetRefPoint() const { return aRef; }
199 : const Point GetRelPos() const;
200 : long GetLineHeight() const { return nLine; }
201 :
202 : inline void InvalidateLayout() const;
203 : inline void InvalidateCntnt() const;
204 : inline void ValidateLayout() const;
205 : inline void ValidateCntnt() const;
206 0 : sal_Bool IsInvalid() const { return (bInvalidLayout || bInvalidCntnt); }
207 : sal_Bool IsInvalidLayout() const { return bInvalidLayout; }
208 : sal_Bool IsInvalidCntnt() const { return bInvalidCntnt; }
209 :
210 : // (26.11.93, see tabfrm.hxx, but might also be valid for others)
211 : // For creation of a Fly after a FlyCnt was created _and_ inserted.
212 : // Must be called by creator because can be pasted only after creation.
213 : // Sometimes the page for registering the Flys is not visible until then
214 : // as well.
215 : void RegistFlys();
216 :
217 : //see layact.cxx
218 0 : void AddRefOfst( long nOfst ) { aRef.Y() += nOfst; }
219 :
220 : // #i26791#
221 : virtual void MakeObjPos();
222 :
223 : // invalidate anchor frame on invalidation of the position, because the
224 : // position is calculated during the format of the anchor frame
225 : virtual void _ActionOnInvalidation( const InvalidationType _nInvalid );
226 : };
227 :
228 398 : inline void SwFlyInCntFrm::InvalidateLayout() const
229 : {
230 398 : ((SwFlyInCntFrm*)this)->bInvalidLayout = sal_True;
231 398 : }
232 314 : inline void SwFlyInCntFrm::InvalidateCntnt() const
233 : {
234 314 : ((SwFlyInCntFrm*)this)->bInvalidCntnt = sal_True;
235 314 : }
236 :
237 : inline void SwFlyInCntFrm::ValidateLayout() const
238 : {
239 : ((SwFlyInCntFrm*)this)->bInvalidLayout = sal_False;
240 : }
241 : inline void SwFlyInCntFrm::ValidateCntnt() const
242 : {
243 : ((SwFlyInCntFrm*)this)->bInvalidCntnt = sal_False;
244 : }
245 :
246 : #endif
247 :
248 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|