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