1efeef26fSAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3efeef26fSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4efeef26fSAndrew Rist * or more contributor license agreements. See the NOTICE file
5efeef26fSAndrew Rist * distributed with this work for additional information
6efeef26fSAndrew Rist * regarding copyright ownership. The ASF licenses this file
7efeef26fSAndrew Rist * to you under the Apache License, Version 2.0 (the
8efeef26fSAndrew Rist * "License"); you may not use this file except in compliance
9efeef26fSAndrew Rist * with the License. You may obtain a copy of the License at
10cdf0e10cSrcweir *
11efeef26fSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir *
13efeef26fSAndrew Rist * Unless required by applicable law or agreed to in writing,
14efeef26fSAndrew Rist * software distributed under the License is distributed on an
15efeef26fSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16efeef26fSAndrew Rist * KIND, either express or implied. See the License for the
17efeef26fSAndrew Rist * specific language governing permissions and limitations
18efeef26fSAndrew Rist * under the License.
19cdf0e10cSrcweir *
20efeef26fSAndrew Rist *************************************************************/
21efeef26fSAndrew Rist
22cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
23cdf0e10cSrcweir #include "precompiled_sw.hxx"
2426ea3662SArmin Le Grand
25cdf0e10cSrcweir #include "hintids.hxx"
26cdf0e10cSrcweir #include <svl/itemiter.hxx>
27cdf0e10cSrcweir #include <svtools/imap.hxx>
28cdf0e10cSrcweir #include <vcl/graph.hxx>
29cdf0e10cSrcweir #include <tools/poly.hxx>
30cdf0e10cSrcweir #include <svx/contdlg.hxx>
31cdf0e10cSrcweir #include <editeng/protitem.hxx>
32cdf0e10cSrcweir #include <editeng/opaqitem.hxx>
33cdf0e10cSrcweir #include <editeng/ulspitem.hxx>
34cdf0e10cSrcweir #include <editeng/lrspitem.hxx>
35cdf0e10cSrcweir #include <editeng/frmdiritem.hxx>
36cdf0e10cSrcweir #include <editeng/keepitem.hxx>
37cdf0e10cSrcweir #include <fmtanchr.hxx>
38cdf0e10cSrcweir #include <fmtfsize.hxx>
39cdf0e10cSrcweir #include <fmtclds.hxx>
40cdf0e10cSrcweir #include <fmtcntnt.hxx>
41cdf0e10cSrcweir #include <fmturl.hxx>
42cdf0e10cSrcweir #include <fmtsrnd.hxx>
43cdf0e10cSrcweir #include <fmtornt.hxx>
44cdf0e10cSrcweir #include <fmtpdsc.hxx>
45cdf0e10cSrcweir #include <fmtcnct.hxx>
46cdf0e10cSrcweir #include <layhelp.hxx>
47cdf0e10cSrcweir #include <ndtxt.hxx>
48cdf0e10cSrcweir #include <svx/svdogrp.hxx>
49cdf0e10cSrcweir #include <ndgrf.hxx>
50cdf0e10cSrcweir #include <tolayoutanchoredobjectposition.hxx>
51cdf0e10cSrcweir #include <fmtfollowtextflow.hxx>
52cdf0e10cSrcweir #include <sortedobjs.hxx>
53cdf0e10cSrcweir #include <objectformatter.hxx>
54cdf0e10cSrcweir #include <anchoredobject.hxx>
55cdf0e10cSrcweir #include <ndole.hxx>
56cdf0e10cSrcweir #include <swtable.hxx>
57cdf0e10cSrcweir #include <svx/svdpage.hxx>
58cdf0e10cSrcweir #include "doc.hxx"
59cdf0e10cSrcweir #include "viewsh.hxx"
60cdf0e10cSrcweir #include "layouter.hxx"
61cdf0e10cSrcweir #include "pagefrm.hxx"
62cdf0e10cSrcweir #include "rootfrm.hxx"
63cdf0e10cSrcweir #include "cntfrm.hxx"
64cdf0e10cSrcweir #include "pam.hxx"
65cdf0e10cSrcweir #include "frmatr.hxx"
66cdf0e10cSrcweir #include "viewimp.hxx"
67cdf0e10cSrcweir #include "viewopt.hxx"
68cdf0e10cSrcweir #include "errhdl.hxx"
69cdf0e10cSrcweir #include "dcontact.hxx"
70cdf0e10cSrcweir #include "dflyobj.hxx"
71cdf0e10cSrcweir #include "dview.hxx"
72cdf0e10cSrcweir #include "flyfrm.hxx"
73cdf0e10cSrcweir #include "frmtool.hxx"
74cdf0e10cSrcweir #include "frmfmt.hxx"
75cdf0e10cSrcweir #include "hints.hxx"
76cdf0e10cSrcweir #include "swregion.hxx"
77cdf0e10cSrcweir #include "tabfrm.hxx"
78cdf0e10cSrcweir #include "txtfrm.hxx"
79cdf0e10cSrcweir #include "ndnotxt.hxx"
80cdf0e10cSrcweir #include "notxtfrm.hxx" // GetGrfArea
81cdf0e10cSrcweir #include "flyfrms.hxx"
82cdf0e10cSrcweir #include "ndindex.hxx" // GetGrfArea
83cdf0e10cSrcweir #include "sectfrm.hxx"
84cdf0e10cSrcweir #include <vcl/svapp.hxx>
85cdf0e10cSrcweir #include <vcl/salbtype.hxx> // FRound
86cdf0e10cSrcweir #include "switerator.hxx"
8726ea3662SArmin Le Grand #include <drawdoc.hxx>
88cdf0e10cSrcweir
89cdf0e10cSrcweir using namespace ::com::sun::star;
90cdf0e10cSrcweir
91cdf0e10cSrcweir // OD 2004-03-23 #i26791
92cdf0e10cSrcweir TYPEINIT2(SwFlyFrm,SwLayoutFrm,SwAnchoredObject);
93cdf0e10cSrcweir
94cdf0e10cSrcweir /*************************************************************************
95cdf0e10cSrcweir |*
96cdf0e10cSrcweir |* SwFlyFrm::SwFlyFrm()
97cdf0e10cSrcweir |*
98cdf0e10cSrcweir |* Ersterstellung MA 28. Sep. 92
99cdf0e10cSrcweir |* Letzte Aenderung MA 09. Apr. 99
100cdf0e10cSrcweir |*
101cdf0e10cSrcweir |*************************************************************************/
102cdf0e10cSrcweir
SwFlyFrm(SwFlyFrmFmt * pFmt,SwFrm * pSib,SwFrm * pAnch)103cdf0e10cSrcweir SwFlyFrm::SwFlyFrm( SwFlyFrmFmt *pFmt, SwFrm* pSib, SwFrm *pAnch ) :
104cdf0e10cSrcweir SwLayoutFrm( pFmt, pSib ),
105cdf0e10cSrcweir SwAnchoredObject(),
106cdf0e10cSrcweir pPrevLink( 0 ),
107cdf0e10cSrcweir pNextLink( 0 ),
108cdf0e10cSrcweir bInCnt( sal_False ),
109cdf0e10cSrcweir bAtCnt( sal_False ),
110cdf0e10cSrcweir bLayout( sal_False ),
111cdf0e10cSrcweir bAutoPosition( sal_False ),
112cdf0e10cSrcweir bNoShrink( sal_False ),
113cdf0e10cSrcweir bLockDeleteContent( sal_False )
114cdf0e10cSrcweir {
115cdf0e10cSrcweir nType = FRMC_FLY;
116cdf0e10cSrcweir
117cdf0e10cSrcweir bInvalid = bNotifyBack = sal_True;
11887bbf24bSOliver-Rainer Wittmann bLocked = bMinHeight = bHeightClipped = bWidthClipped = bFormatHeightOnly = sal_False;
119cdf0e10cSrcweir
120cdf0e10cSrcweir //Grosseneinstellung, Fixe groesse ist immer die Breite
121cdf0e10cSrcweir const SwFmtFrmSize &rFrmSize = pFmt->GetFrmSize();
12287bbf24bSOliver-Rainer Wittmann sal_uInt16 nDir = ((SvxFrameDirectionItem&)pFmt->GetFmtAttr( RES_FRAMEDIR )).GetValue();
123cdf0e10cSrcweir if( FRMDIR_ENVIRONMENT == nDir )
124cdf0e10cSrcweir {
125cdf0e10cSrcweir bDerivedVert = 1;
126cdf0e10cSrcweir bDerivedR2L = 1;
127cdf0e10cSrcweir }
128cdf0e10cSrcweir else
129cdf0e10cSrcweir {
130cdf0e10cSrcweir bInvalidVert = 0;
131cdf0e10cSrcweir bDerivedVert = 0;
132cdf0e10cSrcweir bDerivedR2L = 0;
133cdf0e10cSrcweir if( FRMDIR_HORI_LEFT_TOP == nDir || FRMDIR_HORI_RIGHT_TOP == nDir )
134cdf0e10cSrcweir {
135cdf0e10cSrcweir //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin
136cdf0e10cSrcweir bVertLR = 0;
137cdf0e10cSrcweir bVertical = 0;
138cdf0e10cSrcweir }
139cdf0e10cSrcweir else
140cdf0e10cSrcweir {
141cdf0e10cSrcweir const ViewShell *pSh = getRootFrm() ? getRootFrm()->GetCurrShell() : 0;
142cdf0e10cSrcweir if( pSh && pSh->GetViewOptions()->getBrowseMode() )
143cdf0e10cSrcweir {
144cdf0e10cSrcweir //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin
145cdf0e10cSrcweir bVertLR = 0;
146cdf0e10cSrcweir bVertical = 0;
147cdf0e10cSrcweir }
148cdf0e10cSrcweir else
149cdf0e10cSrcweir {
150cdf0e10cSrcweir bVertical = 1;
151cdf0e10cSrcweir //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin
152cdf0e10cSrcweir if ( FRMDIR_VERT_TOP_LEFT == nDir )
153cdf0e10cSrcweir bVertLR = 1;
154cdf0e10cSrcweir else
155cdf0e10cSrcweir bVertLR = 0;
156cdf0e10cSrcweir }
157cdf0e10cSrcweir }
158cdf0e10cSrcweir
159cdf0e10cSrcweir bInvalidR2L = 0;
160cdf0e10cSrcweir if( FRMDIR_HORI_RIGHT_TOP == nDir )
161cdf0e10cSrcweir bRightToLeft = 1;
162cdf0e10cSrcweir else
163cdf0e10cSrcweir bRightToLeft = 0;
164cdf0e10cSrcweir }
165cdf0e10cSrcweir
166cdf0e10cSrcweir Frm().Width( rFrmSize.GetWidth() );
167cdf0e10cSrcweir Frm().Height( rFrmSize.GetHeightSizeType() == ATT_VAR_SIZE ? MINFLY : rFrmSize.GetHeight() );
168cdf0e10cSrcweir
169cdf0e10cSrcweir //Hoehe Fix oder Variabel oder was?
170cdf0e10cSrcweir if ( rFrmSize.GetHeightSizeType() == ATT_MIN_SIZE )
171cdf0e10cSrcweir bMinHeight = sal_True;
172cdf0e10cSrcweir else if ( rFrmSize.GetHeightSizeType() == ATT_FIX_SIZE )
173cdf0e10cSrcweir bFixSize = sal_True;
174cdf0e10cSrcweir
17587bbf24bSOliver-Rainer Wittmann // insert columns, if necessary
176cdf0e10cSrcweir InsertColumns();
177cdf0e10cSrcweir
17887bbf24bSOliver-Rainer Wittmann // initialize before inserting content as the content might contain other objects which need to be registered
179cdf0e10cSrcweir InitDrawObj( sal_False );
180cdf0e10cSrcweir
181cdf0e10cSrcweir Chain( pAnch );
182cdf0e10cSrcweir
183cdf0e10cSrcweir InsertCnt();
184cdf0e10cSrcweir
18587bbf24bSOliver-Rainer Wittmann // apply dummy position which is far-away in order to avoid needless formattings
186cdf0e10cSrcweir Frm().Pos().X() = Frm().Pos().Y() = WEIT_WECH;
187cdf0e10cSrcweir }
188cdf0e10cSrcweir
Chain(SwFrm * _pAnch)189cdf0e10cSrcweir void SwFlyFrm::Chain( SwFrm* _pAnch )
190cdf0e10cSrcweir {
191*2814ae3cSJohn Bampton // Connect to chain neighbors.
192*2814ae3cSJohn Bampton // No problem, if a neighbor doesn't exist - the construction of the
193*2814ae3cSJohn Bampton // neighbor will make the connection
194cdf0e10cSrcweir const SwFmtChain& rChain = GetFmt()->GetChain();
195cdf0e10cSrcweir if ( rChain.GetPrev() || rChain.GetNext() )
196cdf0e10cSrcweir {
197cdf0e10cSrcweir if ( rChain.GetNext() )
198cdf0e10cSrcweir {
199cdf0e10cSrcweir SwFlyFrm* pFollow = FindChainNeighbour( *rChain.GetNext(), _pAnch );
200cdf0e10cSrcweir if ( pFollow )
201cdf0e10cSrcweir {
202cdf0e10cSrcweir ASSERT( !pFollow->GetPrevLink(), "wrong chain detected" );
203cdf0e10cSrcweir if ( !pFollow->GetPrevLink() )
204cdf0e10cSrcweir SwFlyFrm::ChainFrames( this, pFollow );
205cdf0e10cSrcweir }
206cdf0e10cSrcweir }
207cdf0e10cSrcweir if ( rChain.GetPrev() )
208cdf0e10cSrcweir {
209cdf0e10cSrcweir SwFlyFrm *pMaster = FindChainNeighbour( *rChain.GetPrev(), _pAnch );
210cdf0e10cSrcweir if ( pMaster )
211cdf0e10cSrcweir {
212cdf0e10cSrcweir ASSERT( !pMaster->GetNextLink(), "wrong chain detected" );
213cdf0e10cSrcweir if ( !pMaster->GetNextLink() )
214cdf0e10cSrcweir SwFlyFrm::ChainFrames( pMaster, this );
215cdf0e10cSrcweir }
216cdf0e10cSrcweir }
217cdf0e10cSrcweir }
218cdf0e10cSrcweir }
219cdf0e10cSrcweir
InsertCnt()220cdf0e10cSrcweir void SwFlyFrm::InsertCnt()
221cdf0e10cSrcweir {
222cdf0e10cSrcweir if ( !GetPrevLink() )
223cdf0e10cSrcweir {
224cdf0e10cSrcweir const SwFmtCntnt& rCntnt = GetFmt()->GetCntnt();
225cdf0e10cSrcweir ASSERT( rCntnt.GetCntntIdx(), ":-( no content prepared." );
226cdf0e10cSrcweir sal_uLong nIndex = rCntnt.GetCntntIdx()->GetIndex();
227cdf0e10cSrcweir // Lower() bedeutet SwColumnFrm, eingefuegt werden muss der Inhalt dann in den (Column)BodyFrm
228cdf0e10cSrcweir ::_InsertCnt( Lower() ? (SwLayoutFrm*)((SwLayoutFrm*)Lower())->Lower() : (SwLayoutFrm*)this,
229cdf0e10cSrcweir GetFmt()->GetDoc(), nIndex );
230cdf0e10cSrcweir
231cdf0e10cSrcweir //NoTxt haben immer eine FixHeight.
232cdf0e10cSrcweir if ( Lower() && Lower()->IsNoTxtFrm() )
233cdf0e10cSrcweir {
234cdf0e10cSrcweir bFixSize = sal_True;
235cdf0e10cSrcweir bMinHeight = sal_False;
236cdf0e10cSrcweir }
237cdf0e10cSrcweir }
238cdf0e10cSrcweir }
239cdf0e10cSrcweir
InsertColumns()240cdf0e10cSrcweir void SwFlyFrm::InsertColumns()
241cdf0e10cSrcweir {
242cdf0e10cSrcweir // Check, if column are allowed.
243cdf0e10cSrcweir // Columns are not allowed for fly frames, which represent graphics or embedded objects.
244cdf0e10cSrcweir const SwFmtCntnt& rCntnt = GetFmt()->GetCntnt();
245cdf0e10cSrcweir ASSERT( rCntnt.GetCntntIdx(), "<SwFlyFrm::InsertColumns()> - no content prepared." );
246cdf0e10cSrcweir SwNodeIndex aFirstCntnt( *( rCntnt.GetCntntIdx() ), 1 );
247cdf0e10cSrcweir if ( aFirstCntnt.GetNode().IsNoTxtNode() )
248cdf0e10cSrcweir {
249cdf0e10cSrcweir return;
250cdf0e10cSrcweir }
251cdf0e10cSrcweir
252cdf0e10cSrcweir const SwFmtCol &rCol = GetFmt()->GetCol();
253cdf0e10cSrcweir if ( rCol.GetNumCols() > 1 )
254cdf0e10cSrcweir {
255cdf0e10cSrcweir //PrtArea ersteinmal so gross wie der Frm, damit die Spalten
256cdf0e10cSrcweir //vernuenftig eingesetzt werden koennen; das schaukelt sich dann
257cdf0e10cSrcweir //schon zurecht.
258cdf0e10cSrcweir Prt().Width( Frm().Width() );
259cdf0e10cSrcweir Prt().Height( Frm().Height() );
260cdf0e10cSrcweir const SwFmtCol aOld; //ChgColumns() verlaesst sich darauf, dass auch ein
261cdf0e10cSrcweir //Old-Wert hereingereicht wird.
262cdf0e10cSrcweir ChgColumns( aOld, rCol );
263cdf0e10cSrcweir }
264cdf0e10cSrcweir }
265cdf0e10cSrcweir
266cdf0e10cSrcweir /*************************************************************************
267cdf0e10cSrcweir |*
268cdf0e10cSrcweir |* SwFlyFrm::~SwFlyFrm()
269cdf0e10cSrcweir |*
270cdf0e10cSrcweir |* Ersterstellung MA 28. Sep. 92
271cdf0e10cSrcweir |* Letzte Aenderung MA 07. Jul. 95
272cdf0e10cSrcweir |*
273cdf0e10cSrcweir |*************************************************************************/
274cdf0e10cSrcweir
~SwFlyFrm()275cdf0e10cSrcweir SwFlyFrm::~SwFlyFrm()
276cdf0e10cSrcweir {
277cdf0e10cSrcweir // Accessible objects for fly frames will be destroyed in this destructor.
278cdf0e10cSrcweir // For frames bound as char or frames that don't have an anchor we have
279cdf0e10cSrcweir // to do that ourselves. For any other frame the call RemoveFly at the
280cdf0e10cSrcweir // anchor will do that.
281cdf0e10cSrcweir if( IsAccessibleFrm() && GetFmt() && (IsFlyInCntFrm() || !GetAnchorFrm()) )
282cdf0e10cSrcweir {
283cdf0e10cSrcweir SwRootFrm *pRootFrm = getRootFrm();
284cdf0e10cSrcweir if( pRootFrm && pRootFrm->IsAnyShellAccessible() )
285cdf0e10cSrcweir {
286cdf0e10cSrcweir ViewShell *pVSh = pRootFrm->GetCurrShell();
287cdf0e10cSrcweir if( pVSh && pVSh->Imp() )
288cdf0e10cSrcweir {
289cdf0e10cSrcweir // Lowers aren't disposed already, so we have to do a recursive
290cdf0e10cSrcweir // dispose
291cdf0e10cSrcweir pVSh->Imp()->DisposeAccessibleFrm( this, sal_True );
292cdf0e10cSrcweir }
293cdf0e10cSrcweir }
294cdf0e10cSrcweir }
295cdf0e10cSrcweir
296cdf0e10cSrcweir if( GetFmt() && !GetFmt()->GetDoc()->IsInDtor() )
297cdf0e10cSrcweir {
298cdf0e10cSrcweir // OD 2004-01-19 #110582#
299cdf0e10cSrcweir Unchain();
300cdf0e10cSrcweir
301cdf0e10cSrcweir // OD 2004-01-19 #110582#
302cdf0e10cSrcweir DeleteCnt();
303cdf0e10cSrcweir
304cdf0e10cSrcweir //Tschuess sagen.
305cdf0e10cSrcweir if ( GetAnchorFrm() )
306cdf0e10cSrcweir AnchorFrm()->RemoveFly( this );
307cdf0e10cSrcweir }
308cdf0e10cSrcweir
309cdf0e10cSrcweir FinitDrawObj();
310cdf0e10cSrcweir }
311cdf0e10cSrcweir
312cdf0e10cSrcweir // OD 2004-01-19 #110582#
Unchain()313cdf0e10cSrcweir void SwFlyFrm::Unchain()
314cdf0e10cSrcweir {
315cdf0e10cSrcweir if ( GetPrevLink() )
316cdf0e10cSrcweir UnchainFrames( GetPrevLink(), this );
317cdf0e10cSrcweir if ( GetNextLink() )
318cdf0e10cSrcweir UnchainFrames( this, GetNextLink() );
319cdf0e10cSrcweir }
320cdf0e10cSrcweir
321cdf0e10cSrcweir // OD 2004-01-19 #110582#
DeleteCnt()322cdf0e10cSrcweir void SwFlyFrm::DeleteCnt()
323cdf0e10cSrcweir {
324cdf0e10cSrcweir // #110582#-2
325cdf0e10cSrcweir if ( IsLockDeleteContent() )
326cdf0e10cSrcweir return;
327cdf0e10cSrcweir
328cdf0e10cSrcweir SwFrm* pFrm = pLower;
329cdf0e10cSrcweir while ( pFrm )
330cdf0e10cSrcweir {
331cdf0e10cSrcweir while ( pFrm->GetDrawObjs() && pFrm->GetDrawObjs()->Count() )
332cdf0e10cSrcweir {
333cdf0e10cSrcweir SwAnchoredObject *pAnchoredObj = (*pFrm->GetDrawObjs())[0];
334cdf0e10cSrcweir if ( pAnchoredObj->ISA(SwFlyFrm) )
335cdf0e10cSrcweir delete pAnchoredObj;
336cdf0e10cSrcweir else if ( pAnchoredObj->ISA(SwAnchoredDrawObject) )
337cdf0e10cSrcweir {
338cdf0e10cSrcweir // OD 23.06.2003 #108784# - consider 'virtual' drawing objects
339cdf0e10cSrcweir SdrObject* pObj = pAnchoredObj->DrawObj();
340cdf0e10cSrcweir if ( pObj->ISA(SwDrawVirtObj) )
341cdf0e10cSrcweir {
342cdf0e10cSrcweir SwDrawVirtObj* pDrawVirtObj = static_cast<SwDrawVirtObj*>(pObj);
343cdf0e10cSrcweir pDrawVirtObj->RemoveFromWriterLayout();
344cdf0e10cSrcweir pDrawVirtObj->RemoveFromDrawingPage();
345cdf0e10cSrcweir }
346cdf0e10cSrcweir else
347cdf0e10cSrcweir {
348cdf0e10cSrcweir SwDrawContact* pContact =
349cdf0e10cSrcweir static_cast<SwDrawContact*>(::GetUserCall( pObj ));
350cdf0e10cSrcweir if ( pContact )
351cdf0e10cSrcweir {
352cdf0e10cSrcweir pContact->DisconnectFromLayout();
353cdf0e10cSrcweir }
354cdf0e10cSrcweir }
355cdf0e10cSrcweir }
356cdf0e10cSrcweir }
357cdf0e10cSrcweir
358cdf0e10cSrcweir pFrm->Remove();
359cdf0e10cSrcweir delete pFrm;
360cdf0e10cSrcweir pFrm = pLower;
361cdf0e10cSrcweir }
362cdf0e10cSrcweir
363cdf0e10cSrcweir InvalidatePage();
364cdf0e10cSrcweir }
365cdf0e10cSrcweir
366cdf0e10cSrcweir /*************************************************************************
367cdf0e10cSrcweir |*
368cdf0e10cSrcweir |* SwFlyFrm::InitDrawObj()
369cdf0e10cSrcweir |*
370cdf0e10cSrcweir |* Ersterstellung MA 02. Dec. 94
371cdf0e10cSrcweir |* Letzte Aenderung MA 30. Nov. 95
372cdf0e10cSrcweir |*
373cdf0e10cSrcweir |*************************************************************************/
374cdf0e10cSrcweir
_GetOrdNumForNewRef(const SwFlyDrawContact * pContact)375cdf0e10cSrcweir sal_uInt32 SwFlyFrm::_GetOrdNumForNewRef( const SwFlyDrawContact* pContact )
376cdf0e10cSrcweir {
377cdf0e10cSrcweir sal_uInt32 nOrdNum( 0L );
378cdf0e10cSrcweir
379cdf0e10cSrcweir // search for another Writer fly frame registered at same frame format
380cdf0e10cSrcweir SwIterator<SwFlyFrm,SwFmt> aIter( *pContact->GetFmt() );
381cdf0e10cSrcweir const SwFlyFrm* pFlyFrm( 0L );
382cdf0e10cSrcweir for ( pFlyFrm = aIter.First(); pFlyFrm; pFlyFrm = aIter.Next() )
383cdf0e10cSrcweir {
384cdf0e10cSrcweir if ( pFlyFrm != this )
385cdf0e10cSrcweir {
386cdf0e10cSrcweir break;
387cdf0e10cSrcweir }
388cdf0e10cSrcweir }
389cdf0e10cSrcweir
390cdf0e10cSrcweir if ( pFlyFrm )
391cdf0e10cSrcweir {
392cdf0e10cSrcweir // another Writer fly frame found. Take its order number
393cdf0e10cSrcweir nOrdNum = pFlyFrm->GetVirtDrawObj()->GetOrdNum();
394cdf0e10cSrcweir }
395cdf0e10cSrcweir else
396cdf0e10cSrcweir {
397cdf0e10cSrcweir // no other Writer fly frame found. Take order number of 'master' object
398cdf0e10cSrcweir // --> OD 2004-11-11 #i35748# - use method <GetOrdNumDirect()> instead
399cdf0e10cSrcweir // of method <GetOrdNum()> to avoid a recalculation of the order number,
400cdf0e10cSrcweir // which isn't intended.
401cdf0e10cSrcweir nOrdNum = pContact->GetMaster()->GetOrdNumDirect();
402cdf0e10cSrcweir // <--
403cdf0e10cSrcweir }
404cdf0e10cSrcweir
405cdf0e10cSrcweir return nOrdNum;
406cdf0e10cSrcweir }
407cdf0e10cSrcweir
CreateNewRef(SwFlyDrawContact * pContact)408cdf0e10cSrcweir SwVirtFlyDrawObj* SwFlyFrm::CreateNewRef( SwFlyDrawContact *pContact )
409cdf0e10cSrcweir {
410cdf0e10cSrcweir SwVirtFlyDrawObj *pDrawObj = new SwVirtFlyDrawObj( *pContact->GetMaster(), this );
411cdf0e10cSrcweir pDrawObj->SetModel( pContact->GetMaster()->GetModel() );
412cdf0e10cSrcweir pDrawObj->SetUserCall( pContact );
413cdf0e10cSrcweir
414cdf0e10cSrcweir //Der Reader erzeugt die Master und setzt diese, um die Z-Order zu
415cdf0e10cSrcweir //transportieren, in die Page ein. Beim erzeugen der ersten Referenz werden
416cdf0e10cSrcweir //die Master aus der Liste entfernt und fuehren von da an ein
417cdf0e10cSrcweir //Schattendasein.
418cdf0e10cSrcweir SdrPage* pPg( 0L );
419cdf0e10cSrcweir if ( 0 != ( pPg = pContact->GetMaster()->GetPage() ) )
420cdf0e10cSrcweir {
421cdf0e10cSrcweir const sal_uInt32 nOrdNum = pContact->GetMaster()->GetOrdNum();
422cdf0e10cSrcweir pPg->ReplaceObject( pDrawObj, nOrdNum );
423cdf0e10cSrcweir }
424cdf0e10cSrcweir // --> OD 2004-08-16 #i27030# - insert new <SwVirtFlyDrawObj> instance
425cdf0e10cSrcweir // into drawing page with correct order number
426cdf0e10cSrcweir else
427cdf0e10cSrcweir {
428cdf0e10cSrcweir pContact->GetFmt()->getIDocumentDrawModelAccess()->GetDrawModel()->GetPage( 0 )->
429cdf0e10cSrcweir InsertObject( pDrawObj, _GetOrdNumForNewRef( pContact ) );
430cdf0e10cSrcweir }
431cdf0e10cSrcweir // <--
432cdf0e10cSrcweir // --> OD 2004-12-13 #i38889# - assure, that new <SwVirtFlyDrawObj> instance
433cdf0e10cSrcweir // is in a visible layer.
434cdf0e10cSrcweir pContact->MoveObjToVisibleLayer( pDrawObj );
435cdf0e10cSrcweir // <--
436cdf0e10cSrcweir return pDrawObj;
437cdf0e10cSrcweir }
438cdf0e10cSrcweir
439cdf0e10cSrcweir
440cdf0e10cSrcweir
InitDrawObj(sal_Bool bNotify)441cdf0e10cSrcweir void SwFlyFrm::InitDrawObj( sal_Bool bNotify )
442cdf0e10cSrcweir {
443cdf0e10cSrcweir //ContactObject aus dem Format suchen. Wenn bereits eines existiert, so
444cdf0e10cSrcweir //braucht nur eine neue Ref erzeugt werden, anderfalls ist es jetzt an
445cdf0e10cSrcweir //der Zeit das Contact zu erzeugen.
446cdf0e10cSrcweir
447cdf0e10cSrcweir IDocumentDrawModelAccess* pIDDMA = GetFmt()->getIDocumentDrawModelAccess();
448cdf0e10cSrcweir SwFlyDrawContact *pContact = SwIterator<SwFlyDrawContact,SwFmt>::FirstElement( *GetFmt() );
449cdf0e10cSrcweir if ( !pContact )
450cdf0e10cSrcweir {
451cdf0e10cSrcweir // --> OD 2005-08-08 #i52858# - method name changed
45226ea3662SArmin Le Grand pContact = new SwFlyDrawContact( (SwFlyFrmFmt*)GetFmt(), pIDDMA->GetOrCreateDrawModel() );
453cdf0e10cSrcweir // <--
454cdf0e10cSrcweir }
455cdf0e10cSrcweir ASSERT( pContact, "InitDrawObj failed" );
456cdf0e10cSrcweir // OD 2004-03-22 #i26791#
457cdf0e10cSrcweir SetDrawObj( *(CreateNewRef( pContact )) );
458cdf0e10cSrcweir
459cdf0e10cSrcweir //Den richtigen Layer setzen.
460cdf0e10cSrcweir // OD 2004-01-19 #110582#
461cdf0e10cSrcweir SdrLayerID nHeavenId = pIDDMA->GetHeavenId();
462cdf0e10cSrcweir SdrLayerID nHellId = pIDDMA->GetHellId();
463cdf0e10cSrcweir // OD 2004-03-22 #i26791#
464cdf0e10cSrcweir GetVirtDrawObj()->SetLayer( GetFmt()->GetOpaque().GetValue()
465cdf0e10cSrcweir ? nHeavenId
466cdf0e10cSrcweir : nHellId );
467cdf0e10cSrcweir if ( bNotify )
468cdf0e10cSrcweir NotifyDrawObj();
469cdf0e10cSrcweir }
470cdf0e10cSrcweir
471cdf0e10cSrcweir /*************************************************************************
472cdf0e10cSrcweir |*
473cdf0e10cSrcweir |* SwFlyFrm::FinitDrawObj()
474cdf0e10cSrcweir |*
475cdf0e10cSrcweir |* Ersterstellung MA 12. Dec. 94
476cdf0e10cSrcweir |* Letzte Aenderung MA 15. May. 95
477cdf0e10cSrcweir |*
478cdf0e10cSrcweir |*************************************************************************/
479cdf0e10cSrcweir
FinitDrawObj()480cdf0e10cSrcweir void SwFlyFrm::FinitDrawObj()
481cdf0e10cSrcweir {
482cdf0e10cSrcweir if ( !GetVirtDrawObj() )
483cdf0e10cSrcweir return;
484cdf0e10cSrcweir
485cdf0e10cSrcweir //Bei den SdrPageViews abmelden falls das Objekt dort noch selektiert ist.
486cdf0e10cSrcweir if ( !GetFmt()->GetDoc()->IsInDtor() )
487cdf0e10cSrcweir {
488cdf0e10cSrcweir ViewShell *p1St = getRootFrm()->GetCurrShell();
489cdf0e10cSrcweir if ( p1St )
490cdf0e10cSrcweir {
491cdf0e10cSrcweir ViewShell *pSh = p1St;
492cdf0e10cSrcweir do
493cdf0e10cSrcweir { //z.Zt. kann das Drawing nur ein Unmark auf alles, weil das
494cdf0e10cSrcweir //Objekt bereits Removed wurde.
495cdf0e10cSrcweir if( pSh->HasDrawView() )
496cdf0e10cSrcweir pSh->Imp()->GetDrawView()->UnmarkAll();
497cdf0e10cSrcweir pSh = (ViewShell*)pSh->GetNext();
498cdf0e10cSrcweir
499cdf0e10cSrcweir } while ( pSh != p1St );
500cdf0e10cSrcweir }
501cdf0e10cSrcweir }
502cdf0e10cSrcweir
503cdf0e10cSrcweir //VirtObject mit in das Grab nehmen. Wenn das letzte VirObject
504cdf0e10cSrcweir //zerstoert wird, mussen das DrawObject und DrawContact ebenfalls
505cdf0e10cSrcweir //zerstoert werden.
506cdf0e10cSrcweir SwFlyDrawContact *pMyContact = 0;
507cdf0e10cSrcweir if ( GetFmt() )
508cdf0e10cSrcweir {
509cdf0e10cSrcweir bool bContinue = true;
510cdf0e10cSrcweir SwIterator<SwFrm,SwFmt> aFrmIter( *GetFmt() );
511cdf0e10cSrcweir for ( SwFrm* pFrm = aFrmIter.First(); pFrm; pFrm = aFrmIter.Next() )
512cdf0e10cSrcweir if ( pFrm != this )
513cdf0e10cSrcweir {
514cdf0e10cSrcweir // don't delete Contact if there is still a Frm
515cdf0e10cSrcweir bContinue = false;
516cdf0e10cSrcweir break;
517cdf0e10cSrcweir }
518cdf0e10cSrcweir
519cdf0e10cSrcweir if ( bContinue )
520cdf0e10cSrcweir // no Frm left, find Contact object to destroy
521cdf0e10cSrcweir pMyContact = SwIterator<SwFlyDrawContact,SwFmt>::FirstElement( *GetFmt() );
522cdf0e10cSrcweir }
523cdf0e10cSrcweir
524cdf0e10cSrcweir // OD, OS 2004-03-31 #116203# - clear user call of Writer fly frame 'master'
525cdf0e10cSrcweir // <SdrObject> to assure, that a <SwXFrame::dispose()> doesn't delete the
526cdf0e10cSrcweir // Writer fly frame again.
527cdf0e10cSrcweir if ( pMyContact )
528cdf0e10cSrcweir {
529cdf0e10cSrcweir pMyContact->GetMaster()->SetUserCall( 0 );
530cdf0e10cSrcweir }
531cdf0e10cSrcweir GetVirtDrawObj()->SetUserCall( 0 ); //Ruft sonst Delete des ContactObj
532cdf0e10cSrcweir delete GetVirtDrawObj(); //Meldet sich selbst beim Master ab.
533cdf0e10cSrcweir if ( pMyContact )
534cdf0e10cSrcweir delete pMyContact; //zerstoert den Master selbst.
535cdf0e10cSrcweir }
536cdf0e10cSrcweir
537cdf0e10cSrcweir /*************************************************************************
538cdf0e10cSrcweir |*
539cdf0e10cSrcweir |* SwFlyFrm::ChainFrames()
540cdf0e10cSrcweir |*
541cdf0e10cSrcweir |* Ersterstellung MA 29. Oct. 97
542cdf0e10cSrcweir |* Letzte Aenderung MA 20. Jan. 98
543cdf0e10cSrcweir |*
544cdf0e10cSrcweir |*************************************************************************/
545cdf0e10cSrcweir
ChainFrames(SwFlyFrm * pMaster,SwFlyFrm * pFollow)546cdf0e10cSrcweir void SwFlyFrm::ChainFrames( SwFlyFrm *pMaster, SwFlyFrm *pFollow )
547cdf0e10cSrcweir {
548cdf0e10cSrcweir ASSERT( pMaster && pFollow, "uncomplete chain" );
549cdf0e10cSrcweir ASSERT( !pMaster->GetNextLink(), "link can not be changed" );
550cdf0e10cSrcweir ASSERT( !pFollow->GetPrevLink(), "link can not be changed" );
551cdf0e10cSrcweir
552cdf0e10cSrcweir pMaster->pNextLink = pFollow;
553cdf0e10cSrcweir pFollow->pPrevLink = pMaster;
554cdf0e10cSrcweir
555cdf0e10cSrcweir if ( pMaster->ContainsCntnt() )
556cdf0e10cSrcweir {
557cdf0e10cSrcweir //Damit ggf. ein Textfluss zustande kommt muss invalidiert werden.
558cdf0e10cSrcweir SwFrm *pInva = pMaster->FindLastLower();
559cdf0e10cSrcweir SWRECTFN( pMaster )
560cdf0e10cSrcweir const long nBottom = (pMaster->*fnRect->fnGetPrtBottom)();
561cdf0e10cSrcweir while ( pInva )
562cdf0e10cSrcweir {
563cdf0e10cSrcweir if( (pInva->Frm().*fnRect->fnBottomDist)( nBottom ) <= 0 )
564cdf0e10cSrcweir {
565cdf0e10cSrcweir pInva->InvalidateSize();
566cdf0e10cSrcweir pInva->Prepare( PREP_CLEAR );
567cdf0e10cSrcweir pInva = pInva->FindPrev();
568cdf0e10cSrcweir }
569cdf0e10cSrcweir else
570cdf0e10cSrcweir pInva = 0;
571cdf0e10cSrcweir }
572cdf0e10cSrcweir }
573cdf0e10cSrcweir
574cdf0e10cSrcweir if ( pFollow->ContainsCntnt() )
575cdf0e10cSrcweir {
576cdf0e10cSrcweir //Es gibt nur noch den Inhalt des Masters, der Inhalt vom Follow
577cdf0e10cSrcweir //hat keine Frames mehr (sollte immer nur genau ein leerer TxtNode sein).
578cdf0e10cSrcweir SwFrm *pFrm = pFollow->ContainsCntnt();
579cdf0e10cSrcweir ASSERT( !pFrm->IsTabFrm() && !pFrm->FindNext(), "follow in chain contains content" );
580cdf0e10cSrcweir pFrm->Cut();
581cdf0e10cSrcweir delete pFrm;
582cdf0e10cSrcweir }
583cdf0e10cSrcweir
584cdf0e10cSrcweir // invalidate accessible relation set (accessibility wrapper)
585cdf0e10cSrcweir ViewShell* pSh = pMaster->getRootFrm()->GetCurrShell();
586cdf0e10cSrcweir if( pSh )
587cdf0e10cSrcweir {
588cdf0e10cSrcweir SwRootFrm* pLayout = pMaster->getRootFrm();
589cdf0e10cSrcweir if( pLayout && pLayout->IsAnyShellAccessible() )
590cdf0e10cSrcweir pSh->Imp()->InvalidateAccessibleRelationSet( pMaster, pFollow );
591cdf0e10cSrcweir }
592cdf0e10cSrcweir }
593cdf0e10cSrcweir
UnchainFrames(SwFlyFrm * pMaster,SwFlyFrm * pFollow)594cdf0e10cSrcweir void SwFlyFrm::UnchainFrames( SwFlyFrm *pMaster, SwFlyFrm *pFollow )
595cdf0e10cSrcweir {
596cdf0e10cSrcweir pMaster->pNextLink = 0;
597cdf0e10cSrcweir pFollow->pPrevLink = 0;
598cdf0e10cSrcweir
599cdf0e10cSrcweir if ( pFollow->ContainsCntnt() )
600cdf0e10cSrcweir {
601cdf0e10cSrcweir //Der Master saugt den Inhalt vom Follow auf
602cdf0e10cSrcweir SwLayoutFrm *pUpper = pMaster;
603cdf0e10cSrcweir if ( pUpper->Lower()->IsColumnFrm() )
604cdf0e10cSrcweir {
605cdf0e10cSrcweir pUpper = static_cast<SwLayoutFrm*>(pUpper->GetLastLower());
606cdf0e10cSrcweir pUpper = static_cast<SwLayoutFrm*>(pUpper->Lower()); // der (Column)BodyFrm
607cdf0e10cSrcweir ASSERT( pUpper && pUpper->IsColBodyFrm(), "Missing ColumnBody" );
608cdf0e10cSrcweir }
609cdf0e10cSrcweir SwFlyFrm *pFoll = pFollow;
610cdf0e10cSrcweir while ( pFoll )
611cdf0e10cSrcweir {
612cdf0e10cSrcweir SwFrm *pTmp = ::SaveCntnt( pFoll );
613cdf0e10cSrcweir if ( pTmp )
614cdf0e10cSrcweir ::RestoreCntnt( pTmp, pUpper, pMaster->FindLastLower(), true );
615cdf0e10cSrcweir pFoll->SetCompletePaint();
616cdf0e10cSrcweir pFoll->InvalidateSize();
617cdf0e10cSrcweir pFoll = pFoll->GetNextLink();
618cdf0e10cSrcweir }
619cdf0e10cSrcweir }
620cdf0e10cSrcweir
621cdf0e10cSrcweir //Der Follow muss mit seinem eigenen Inhalt versorgt werden.
622cdf0e10cSrcweir const SwFmtCntnt &rCntnt = pFollow->GetFmt()->GetCntnt();
623cdf0e10cSrcweir ASSERT( rCntnt.GetCntntIdx(), ":-( Kein Inhalt vorbereitet." );
624cdf0e10cSrcweir sal_uLong nIndex = rCntnt.GetCntntIdx()->GetIndex();
625cdf0e10cSrcweir // Lower() bedeutet SwColumnFrm, dieser beinhaltet wieder einen SwBodyFrm
626cdf0e10cSrcweir ::_InsertCnt( pFollow->Lower() ? (SwLayoutFrm*)((SwLayoutFrm*)pFollow->Lower())->Lower()
627cdf0e10cSrcweir : (SwLayoutFrm*)pFollow,
628cdf0e10cSrcweir pFollow->GetFmt()->GetDoc(), ++nIndex );
629cdf0e10cSrcweir
630cdf0e10cSrcweir // invalidate accessible relation set (accessibility wrapper)
631cdf0e10cSrcweir ViewShell* pSh = pMaster->getRootFrm()->GetCurrShell();
632cdf0e10cSrcweir if( pSh )
633cdf0e10cSrcweir {
634cdf0e10cSrcweir SwRootFrm* pLayout = pMaster->getRootFrm();
635cdf0e10cSrcweir if( pLayout && pLayout->IsAnyShellAccessible() )
636cdf0e10cSrcweir pSh->Imp()->InvalidateAccessibleRelationSet( pMaster, pFollow );
637cdf0e10cSrcweir }
638cdf0e10cSrcweir }
639cdf0e10cSrcweir
640cdf0e10cSrcweir /*************************************************************************
641cdf0e10cSrcweir |*
642cdf0e10cSrcweir |* SwFlyFrm::FindChainNeighbour()
643cdf0e10cSrcweir |*
644cdf0e10cSrcweir |* Ersterstellung MA 11. Nov. 97
645cdf0e10cSrcweir |* Letzte Aenderung MA 09. Apr. 99
646cdf0e10cSrcweir |*
647cdf0e10cSrcweir |*************************************************************************/
648cdf0e10cSrcweir
FindChainNeighbour(SwFrmFmt & rChain,SwFrm * pAnch)649cdf0e10cSrcweir SwFlyFrm *SwFlyFrm::FindChainNeighbour( SwFrmFmt &rChain, SwFrm *pAnch )
650cdf0e10cSrcweir {
651cdf0e10cSrcweir //Wir suchen denjenigen Fly, der in dem selben Bereich steht.
652cdf0e10cSrcweir //Bereiche koennen zunaechst nur Kopf-/Fusszeilen oder Flys sein.
653cdf0e10cSrcweir
654cdf0e10cSrcweir if ( !pAnch ) //Wenn ein Anchor uebergeben Wurde zaehlt dieser: Ctor!
655cdf0e10cSrcweir pAnch = AnchorFrm();
656cdf0e10cSrcweir
657cdf0e10cSrcweir SwLayoutFrm *pLay;
658cdf0e10cSrcweir if ( pAnch->IsInFly() )
659cdf0e10cSrcweir pLay = pAnch->FindFlyFrm();
660cdf0e10cSrcweir else
661cdf0e10cSrcweir {
662cdf0e10cSrcweir //FindFooterOrHeader taugt hier nicht, weil evtl. noch keine Verbindung
663cdf0e10cSrcweir //zum Anker besteht.
664cdf0e10cSrcweir pLay = pAnch->GetUpper();
665cdf0e10cSrcweir while ( pLay && !(pLay->GetType() & (FRM_HEADER|FRM_FOOTER)) )
666cdf0e10cSrcweir pLay = pLay->GetUpper();
667cdf0e10cSrcweir }
668cdf0e10cSrcweir
669cdf0e10cSrcweir SwIterator<SwFlyFrm,SwFmt> aIter( rChain );
670cdf0e10cSrcweir SwFlyFrm *pFly = aIter.First();
671cdf0e10cSrcweir if ( pLay )
672cdf0e10cSrcweir {
673cdf0e10cSrcweir while ( pFly )
674cdf0e10cSrcweir {
675cdf0e10cSrcweir if ( pFly->GetAnchorFrm() )
676cdf0e10cSrcweir {
677cdf0e10cSrcweir if ( pFly->GetAnchorFrm()->IsInFly() )
678cdf0e10cSrcweir {
679cdf0e10cSrcweir if ( pFly->AnchorFrm()->FindFlyFrm() == pLay )
680cdf0e10cSrcweir break;
681cdf0e10cSrcweir }
682cdf0e10cSrcweir else if ( pLay == pFly->FindFooterOrHeader() )
683cdf0e10cSrcweir break;
684cdf0e10cSrcweir }
685cdf0e10cSrcweir pFly = aIter.Next();
686cdf0e10cSrcweir }
687cdf0e10cSrcweir }
688cdf0e10cSrcweir else if ( pFly )
689cdf0e10cSrcweir {
690cdf0e10cSrcweir ASSERT( !aIter.Next(), "chain with more than one inkarnation" );
691cdf0e10cSrcweir }
692cdf0e10cSrcweir return pFly;
693cdf0e10cSrcweir }
694cdf0e10cSrcweir
695cdf0e10cSrcweir
696cdf0e10cSrcweir /*************************************************************************
697cdf0e10cSrcweir |*
698cdf0e10cSrcweir |* SwFlyFrm::FindLastLower()
699cdf0e10cSrcweir |*
700cdf0e10cSrcweir |* Ersterstellung MA 29. Oct. 97
701cdf0e10cSrcweir |* Letzte Aenderung MA 29. Oct. 97
702cdf0e10cSrcweir |*
703cdf0e10cSrcweir |*************************************************************************/
704cdf0e10cSrcweir
FindLastLower()705cdf0e10cSrcweir SwFrm *SwFlyFrm::FindLastLower()
706cdf0e10cSrcweir {
707cdf0e10cSrcweir SwFrm *pRet = ContainsAny();
708cdf0e10cSrcweir if ( pRet && pRet->IsInTab() )
709cdf0e10cSrcweir pRet = pRet->FindTabFrm();
710cdf0e10cSrcweir SwFrm *pNxt = pRet;
711cdf0e10cSrcweir while ( pNxt && IsAnLower( pNxt ) )
712cdf0e10cSrcweir { pRet = pNxt;
713cdf0e10cSrcweir pNxt = pNxt->FindNext();
714cdf0e10cSrcweir }
715cdf0e10cSrcweir return pRet;
716cdf0e10cSrcweir }
717cdf0e10cSrcweir
718cdf0e10cSrcweir
719cdf0e10cSrcweir /*************************************************************************
720cdf0e10cSrcweir |*
721cdf0e10cSrcweir |* SwFlyFrm::FrmSizeChg()
722cdf0e10cSrcweir |*
723cdf0e10cSrcweir |* Ersterstellung MA 17. Dec. 92
724cdf0e10cSrcweir |* Letzte Aenderung MA 24. Jul. 96
725cdf0e10cSrcweir |*
726cdf0e10cSrcweir |*************************************************************************/
727cdf0e10cSrcweir
FrmSizeChg(const SwFmtFrmSize & rFrmSize)728cdf0e10cSrcweir sal_Bool SwFlyFrm::FrmSizeChg( const SwFmtFrmSize &rFrmSize )
729cdf0e10cSrcweir {
730cdf0e10cSrcweir sal_Bool bRet = sal_False;
731cdf0e10cSrcweir SwTwips nDiffHeight = Frm().Height();
732cdf0e10cSrcweir if ( rFrmSize.GetHeightSizeType() == ATT_VAR_SIZE )
733cdf0e10cSrcweir bFixSize = bMinHeight = sal_False;
734cdf0e10cSrcweir else
735cdf0e10cSrcweir {
736cdf0e10cSrcweir if ( rFrmSize.GetHeightSizeType() == ATT_FIX_SIZE )
737cdf0e10cSrcweir {
738cdf0e10cSrcweir bFixSize = sal_True;
739cdf0e10cSrcweir bMinHeight = sal_False;
740cdf0e10cSrcweir }
741cdf0e10cSrcweir else if ( rFrmSize.GetHeightSizeType() == ATT_MIN_SIZE )
742cdf0e10cSrcweir {
743cdf0e10cSrcweir bFixSize = sal_False;
744cdf0e10cSrcweir bMinHeight = sal_True;
745cdf0e10cSrcweir }
746cdf0e10cSrcweir nDiffHeight -= rFrmSize.GetHeight();
747cdf0e10cSrcweir }
748cdf0e10cSrcweir //Wenn der Fly Spalten enthaehlt muessen der Fly und
749cdf0e10cSrcweir //die Spalten schon einmal auf die Wunschwerte gebracht
750cdf0e10cSrcweir //werden, sonst haben wir ein kleines Problem.
751cdf0e10cSrcweir if ( Lower() )
752cdf0e10cSrcweir {
753cdf0e10cSrcweir if ( Lower()->IsColumnFrm() )
754cdf0e10cSrcweir {
755cdf0e10cSrcweir const SwRect aOld( GetObjRectWithSpaces() );
756cdf0e10cSrcweir const Size aOldSz( Prt().SSize() );
757cdf0e10cSrcweir const SwTwips nDiffWidth = Frm().Width() - rFrmSize.GetWidth();
758cdf0e10cSrcweir aFrm.Height( aFrm.Height() - nDiffHeight );
759cdf0e10cSrcweir aFrm.Width ( aFrm.Width() - nDiffWidth );
760cdf0e10cSrcweir // --> OD 2006-08-16 #i68520#
761cdf0e10cSrcweir InvalidateObjRectWithSpaces();
762cdf0e10cSrcweir // <--
763cdf0e10cSrcweir aPrt.Height( aPrt.Height() - nDiffHeight );
764cdf0e10cSrcweir aPrt.Width ( aPrt.Width() - nDiffWidth );
765cdf0e10cSrcweir ChgLowersProp( aOldSz );
766cdf0e10cSrcweir ::Notify( this, FindPageFrm(), aOld );
767cdf0e10cSrcweir bValidPos = sal_False;
768cdf0e10cSrcweir bRet = sal_True;
769cdf0e10cSrcweir }
770cdf0e10cSrcweir else if ( Lower()->IsNoTxtFrm() )
771cdf0e10cSrcweir {
772cdf0e10cSrcweir bFixSize = sal_True;
773cdf0e10cSrcweir bMinHeight = sal_False;
774cdf0e10cSrcweir }
775cdf0e10cSrcweir }
776cdf0e10cSrcweir return bRet;
777cdf0e10cSrcweir }
778cdf0e10cSrcweir
779cdf0e10cSrcweir /*************************************************************************
780cdf0e10cSrcweir |*
781cdf0e10cSrcweir |* SwFlyFrm::Modify()
782cdf0e10cSrcweir |*
783cdf0e10cSrcweir |* Ersterstellung MA 17. Dec. 92
784cdf0e10cSrcweir |* Letzte Aenderung MA 17. Jan. 97
785cdf0e10cSrcweir |*
786cdf0e10cSrcweir |*************************************************************************/
787cdf0e10cSrcweir
Modify(const SfxPoolItem * pOld,const SfxPoolItem * pNew)788cdf0e10cSrcweir void SwFlyFrm::Modify( const SfxPoolItem* pOld, const SfxPoolItem * pNew )
789cdf0e10cSrcweir {
790cdf0e10cSrcweir sal_uInt8 nInvFlags = 0;
791cdf0e10cSrcweir
792cdf0e10cSrcweir if( pNew && RES_ATTRSET_CHG == pNew->Which() )
793cdf0e10cSrcweir {
794cdf0e10cSrcweir SfxItemIter aNIter( *((SwAttrSetChg*)pNew)->GetChgSet() );
795cdf0e10cSrcweir SfxItemIter aOIter( *((SwAttrSetChg*)pOld)->GetChgSet() );
796cdf0e10cSrcweir SwAttrSetChg aOldSet( *(SwAttrSetChg*)pOld );
797cdf0e10cSrcweir SwAttrSetChg aNewSet( *(SwAttrSetChg*)pNew );
798cdf0e10cSrcweir while( sal_True )
799cdf0e10cSrcweir {
800cdf0e10cSrcweir _UpdateAttr( (SfxPoolItem*)aOIter.GetCurItem(),
801cdf0e10cSrcweir (SfxPoolItem*)aNIter.GetCurItem(), nInvFlags,
802cdf0e10cSrcweir &aOldSet, &aNewSet );
803cdf0e10cSrcweir if( aNIter.IsAtEnd() )
804cdf0e10cSrcweir break;
805cdf0e10cSrcweir aNIter.NextItem();
806cdf0e10cSrcweir aOIter.NextItem();
807cdf0e10cSrcweir }
808cdf0e10cSrcweir if ( aOldSet.Count() || aNewSet.Count() )
809cdf0e10cSrcweir SwLayoutFrm::Modify( &aOldSet, &aNewSet );
810cdf0e10cSrcweir }
811cdf0e10cSrcweir else
812cdf0e10cSrcweir _UpdateAttr( pOld, pNew, nInvFlags );
813cdf0e10cSrcweir
814cdf0e10cSrcweir if ( nInvFlags != 0 )
815cdf0e10cSrcweir {
816cdf0e10cSrcweir _Invalidate();
817cdf0e10cSrcweir if ( nInvFlags & 0x01 )
818cdf0e10cSrcweir {
819cdf0e10cSrcweir _InvalidatePos();
820cdf0e10cSrcweir // --> OD 2006-08-16 #i68520#
821cdf0e10cSrcweir InvalidateObjRectWithSpaces();
822cdf0e10cSrcweir // <--
823cdf0e10cSrcweir }
824cdf0e10cSrcweir if ( nInvFlags & 0x02 )
825cdf0e10cSrcweir {
826cdf0e10cSrcweir _InvalidateSize();
827cdf0e10cSrcweir // --> OD 2006-08-16 #i68520#
828cdf0e10cSrcweir InvalidateObjRectWithSpaces();
829cdf0e10cSrcweir // <--
830cdf0e10cSrcweir }
831cdf0e10cSrcweir if ( nInvFlags & 0x04 )
832cdf0e10cSrcweir _InvalidatePrt();
833cdf0e10cSrcweir if ( nInvFlags & 0x08 )
834cdf0e10cSrcweir SetNotifyBack();
835cdf0e10cSrcweir if ( nInvFlags & 0x10 )
836cdf0e10cSrcweir SetCompletePaint();
837cdf0e10cSrcweir if ( ( nInvFlags & 0x40 ) && Lower() && Lower()->IsNoTxtFrm() )
838cdf0e10cSrcweir ClrContourCache( GetVirtDrawObj() );
839cdf0e10cSrcweir SwRootFrm *pRoot;
840cdf0e10cSrcweir if ( nInvFlags & 0x20 && 0 != (pRoot = getRootFrm()) )
841cdf0e10cSrcweir pRoot->InvalidateBrowseWidth();
842cdf0e10cSrcweir // --> OD 2004-06-28 #i28701#
843cdf0e10cSrcweir if ( nInvFlags & 0x80 )
844cdf0e10cSrcweir {
845cdf0e10cSrcweir // update sorted object lists, the Writer fly frame is registered at.
846cdf0e10cSrcweir UpdateObjInSortedList();
847cdf0e10cSrcweir }
848cdf0e10cSrcweir // <--
849cdf0e10cSrcweir // --> OD #i87645# - reset flags for the layout process (only if something has been invalidated)
850cdf0e10cSrcweir ResetLayoutProcessBools();
851cdf0e10cSrcweir // <--
852cdf0e10cSrcweir }
853cdf0e10cSrcweir }
854cdf0e10cSrcweir
_UpdateAttr(const SfxPoolItem * pOld,const SfxPoolItem * pNew,sal_uInt8 & rInvFlags,SwAttrSetChg * pOldSet,SwAttrSetChg * pNewSet)855cdf0e10cSrcweir void SwFlyFrm::_UpdateAttr( const SfxPoolItem *pOld, const SfxPoolItem *pNew,
856cdf0e10cSrcweir sal_uInt8 &rInvFlags,
857cdf0e10cSrcweir SwAttrSetChg *pOldSet, SwAttrSetChg *pNewSet )
858cdf0e10cSrcweir {
859cdf0e10cSrcweir sal_Bool bClear = sal_True;
860cdf0e10cSrcweir const sal_uInt16 nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0;
861cdf0e10cSrcweir ViewShell *pSh = getRootFrm()->GetCurrShell();
862cdf0e10cSrcweir switch( nWhich )
863cdf0e10cSrcweir {
864cdf0e10cSrcweir case RES_VERT_ORIENT:
865cdf0e10cSrcweir case RES_HORI_ORIENT:
866cdf0e10cSrcweir // OD 22.09.2003 #i18732# - consider new option 'follow text flow'
867cdf0e10cSrcweir case RES_FOLLOW_TEXT_FLOW:
868cdf0e10cSrcweir {
869cdf0e10cSrcweir //Achtung! _immer_ Aktion in ChgRePos() mitpflegen.
870cdf0e10cSrcweir rInvFlags |= 0x09;
871cdf0e10cSrcweir }
872cdf0e10cSrcweir break;
873cdf0e10cSrcweir // OD 2004-07-01 #i28701# - consider new option 'wrap influence on position'
874cdf0e10cSrcweir case RES_WRAP_INFLUENCE_ON_OBJPOS:
875cdf0e10cSrcweir {
876cdf0e10cSrcweir rInvFlags |= 0x89;
877cdf0e10cSrcweir }
878cdf0e10cSrcweir break;
879cdf0e10cSrcweir case RES_SURROUND:
880cdf0e10cSrcweir {
881cdf0e10cSrcweir // OD 2004-05-13 #i28701# - invalidate position on change of
882cdf0e10cSrcweir // wrapping style.
883cdf0e10cSrcweir //rInvFlags |= 0x40;
884cdf0e10cSrcweir rInvFlags |= 0x41;
885cdf0e10cSrcweir //Der Hintergrund muss benachrichtigt und Invalidiert werden.
886cdf0e10cSrcweir const SwRect aTmp( GetObjRectWithSpaces() );
887cdf0e10cSrcweir NotifyBackground( FindPageFrm(), aTmp, PREP_FLY_ATTR_CHG );
888cdf0e10cSrcweir
889cdf0e10cSrcweir // Durch eine Umlaufaenderung von rahmengebundenen Rahmen kann eine
890cdf0e10cSrcweir // vertikale Ausrichtung aktiviert/deaktiviert werden => MakeFlyPos
891cdf0e10cSrcweir if( FLY_AT_FLY == GetFmt()->GetAnchor().GetAnchorId() )
892cdf0e10cSrcweir rInvFlags |= 0x09;
893cdf0e10cSrcweir
894cdf0e10cSrcweir //Ggf. die Kontur am Node loeschen.
895cdf0e10cSrcweir if ( Lower() && Lower()->IsNoTxtFrm() &&
896cdf0e10cSrcweir !GetFmt()->GetSurround().IsContour() )
897cdf0e10cSrcweir {
898cdf0e10cSrcweir SwNoTxtNode *pNd = (SwNoTxtNode*)((SwCntntFrm*)Lower())->GetNode();
899cdf0e10cSrcweir if ( pNd->HasContour() )
900cdf0e10cSrcweir pNd->SetContour( 0 );
901cdf0e10cSrcweir }
902cdf0e10cSrcweir // --> OD 2004-06-28 #i28701# - perform reorder of object lists
903cdf0e10cSrcweir // at anchor frame and at page frame.
904cdf0e10cSrcweir rInvFlags |= 0x80;
905cdf0e10cSrcweir }
906cdf0e10cSrcweir break;
907cdf0e10cSrcweir
908cdf0e10cSrcweir case RES_PROTECT:
909cdf0e10cSrcweir {
910cdf0e10cSrcweir const SvxProtectItem *pP = (SvxProtectItem*)pNew;
911cdf0e10cSrcweir GetVirtDrawObj()->SetMoveProtect( pP->IsPosProtected() );
912cdf0e10cSrcweir GetVirtDrawObj()->SetResizeProtect( pP->IsSizeProtected() );
913cdf0e10cSrcweir if( pSh )
914cdf0e10cSrcweir {
915cdf0e10cSrcweir SwRootFrm* pLayout = getRootFrm();
916cdf0e10cSrcweir if( pLayout && pLayout->IsAnyShellAccessible() )
917cdf0e10cSrcweir pSh->Imp()->InvalidateAccessibleEditableState( sal_True, this );
918cdf0e10cSrcweir }
919cdf0e10cSrcweir break;
920cdf0e10cSrcweir }
921cdf0e10cSrcweir
922cdf0e10cSrcweir case RES_COL:
923cdf0e10cSrcweir {
924cdf0e10cSrcweir ChgColumns( *(const SwFmtCol*)pOld, *(const SwFmtCol*)pNew );
925cdf0e10cSrcweir const SwFmtFrmSize &rNew = GetFmt()->GetFrmSize();
926cdf0e10cSrcweir if ( FrmSizeChg( rNew ) )
927cdf0e10cSrcweir NotifyDrawObj();
928cdf0e10cSrcweir rInvFlags |= 0x1A;
929cdf0e10cSrcweir break;
930cdf0e10cSrcweir }
931cdf0e10cSrcweir
932cdf0e10cSrcweir case RES_FRM_SIZE:
933cdf0e10cSrcweir case RES_FMT_CHG:
934cdf0e10cSrcweir {
935cdf0e10cSrcweir const SwFmtFrmSize &rNew = GetFmt()->GetFrmSize();
936cdf0e10cSrcweir if ( FrmSizeChg( rNew ) )
937cdf0e10cSrcweir NotifyDrawObj();
938cdf0e10cSrcweir rInvFlags |= 0x7F;
939cdf0e10cSrcweir if ( RES_FMT_CHG == nWhich )
940cdf0e10cSrcweir {
941cdf0e10cSrcweir SwRect aNew( GetObjRectWithSpaces() );
942cdf0e10cSrcweir SwRect aOld( aFrm );
943cdf0e10cSrcweir const SvxULSpaceItem &rUL = ((SwFmtChg*)pOld)->pChangedFmt->GetULSpace();
944cdf0e10cSrcweir aOld.Top( Max( aOld.Top() - long(rUL.GetUpper()), 0L ) );
945cdf0e10cSrcweir aOld.SSize().Height()+= rUL.GetLower();
946cdf0e10cSrcweir const SvxLRSpaceItem &rLR = ((SwFmtChg*)pOld)->pChangedFmt->GetLRSpace();
947cdf0e10cSrcweir aOld.Left ( Max( aOld.Left() - long(rLR.GetLeft()), 0L ) );
948cdf0e10cSrcweir aOld.SSize().Width() += rLR.GetRight();
949cdf0e10cSrcweir aNew.Union( aOld );
950cdf0e10cSrcweir NotifyBackground( FindPageFrm(), aNew, PREP_CLEAR );
951cdf0e10cSrcweir
952cdf0e10cSrcweir //Dummer Fall. Bei der Zusweisung einer Vorlage k?nnen wir uns
953cdf0e10cSrcweir //nicht auf das alte Spaltenattribut verlassen. Da diese
954cdf0e10cSrcweir //wenigstens anzahlgemass fuer ChgColumns vorliegen muessen,
955cdf0e10cSrcweir //bleibt uns nur einen temporaeres Attribut zu basteln.
956cdf0e10cSrcweir SwFmtCol aCol;
957cdf0e10cSrcweir if ( Lower() && Lower()->IsColumnFrm() )
958cdf0e10cSrcweir {
959cdf0e10cSrcweir sal_uInt16 nCol = 0;
960cdf0e10cSrcweir SwFrm *pTmp = Lower();
961cdf0e10cSrcweir do
962cdf0e10cSrcweir { ++nCol;
963cdf0e10cSrcweir pTmp = pTmp->GetNext();
964cdf0e10cSrcweir } while ( pTmp );
965cdf0e10cSrcweir aCol.Init( nCol, 0, 1000 );
966cdf0e10cSrcweir }
967cdf0e10cSrcweir ChgColumns( aCol, GetFmt()->GetCol() );
968cdf0e10cSrcweir }
969cdf0e10cSrcweir
970cdf0e10cSrcweir SwFmtURL aURL( GetFmt()->GetURL() );
971cdf0e10cSrcweir if ( aURL.GetMap() )
972cdf0e10cSrcweir {
973cdf0e10cSrcweir const SwFmtFrmSize &rOld = nWhich == RES_FRM_SIZE ?
974cdf0e10cSrcweir *(SwFmtFrmSize*)pNew :
975cdf0e10cSrcweir ((SwFmtChg*)pOld)->pChangedFmt->GetFrmSize();
976cdf0e10cSrcweir //#35091# Kann beim Laden von Vorlagen mal 0 sein
977cdf0e10cSrcweir if ( rOld.GetWidth() && rOld.GetHeight() )
978cdf0e10cSrcweir {
979cdf0e10cSrcweir
980cdf0e10cSrcweir Fraction aScaleX( rOld.GetWidth(), rNew.GetWidth() );
981cdf0e10cSrcweir Fraction aScaleY( rOld.GetHeight(), rOld.GetHeight() );
982cdf0e10cSrcweir aURL.GetMap()->Scale( aScaleX, aScaleY );
983cdf0e10cSrcweir SwFrmFmt *pFmt = GetFmt();
984cdf0e10cSrcweir pFmt->LockModify();
985cdf0e10cSrcweir pFmt->SetFmtAttr( aURL );
986cdf0e10cSrcweir pFmt->UnlockModify();
987cdf0e10cSrcweir }
988cdf0e10cSrcweir }
989cdf0e10cSrcweir const SvxProtectItem &rP = GetFmt()->GetProtect();
990cdf0e10cSrcweir GetVirtDrawObj()->SetMoveProtect( rP.IsPosProtected() );
991cdf0e10cSrcweir GetVirtDrawObj()->SetResizeProtect( rP.IsSizeProtected() );
992cdf0e10cSrcweir
993cdf0e10cSrcweir if ( pSh )
994cdf0e10cSrcweir pSh->InvalidateWindows( Frm() );
995cdf0e10cSrcweir const IDocumentDrawModelAccess* pIDDMA = GetFmt()->getIDocumentDrawModelAccess();
996cdf0e10cSrcweir const sal_uInt8 nId = GetFmt()->GetOpaque().GetValue() ?
997cdf0e10cSrcweir pIDDMA->GetHeavenId() :
998cdf0e10cSrcweir pIDDMA->GetHellId();
999cdf0e10cSrcweir GetVirtDrawObj()->SetLayer( nId );
1000cdf0e10cSrcweir
1001cdf0e10cSrcweir if ( Lower() )
1002cdf0e10cSrcweir {
1003cdf0e10cSrcweir //Ggf. die Kontur am Node loeschen.
1004cdf0e10cSrcweir if( Lower()->IsNoTxtFrm() &&
1005cdf0e10cSrcweir !GetFmt()->GetSurround().IsContour() )
1006cdf0e10cSrcweir {
1007cdf0e10cSrcweir SwNoTxtNode *pNd = (SwNoTxtNode*)((SwCntntFrm*)Lower())->GetNode();
1008cdf0e10cSrcweir if ( pNd->HasContour() )
1009cdf0e10cSrcweir pNd->SetContour( 0 );
1010cdf0e10cSrcweir }
1011cdf0e10cSrcweir else if( !Lower()->IsColumnFrm() )
1012cdf0e10cSrcweir {
1013cdf0e10cSrcweir SwFrm* pFrm = GetLastLower();
1014cdf0e10cSrcweir if( pFrm->IsTxtFrm() && ((SwTxtFrm*)pFrm)->IsUndersized() )
1015cdf0e10cSrcweir pFrm->Prepare( PREP_ADJUST_FRM );
1016cdf0e10cSrcweir }
1017cdf0e10cSrcweir }
1018cdf0e10cSrcweir
1019cdf0e10cSrcweir // --> OD 2004-06-28 #i28701# - perform reorder of object lists
1020cdf0e10cSrcweir // at anchor frame and at page frame.
1021cdf0e10cSrcweir rInvFlags |= 0x80;
1022cdf0e10cSrcweir
1023cdf0e10cSrcweir break;
1024cdf0e10cSrcweir }
1025cdf0e10cSrcweir case RES_UL_SPACE:
1026cdf0e10cSrcweir case RES_LR_SPACE:
1027cdf0e10cSrcweir {
1028cdf0e10cSrcweir rInvFlags |= 0x41;
1029cdf0e10cSrcweir if( pSh && pSh->GetViewOptions()->getBrowseMode() )
1030cdf0e10cSrcweir getRootFrm()->InvalidateBrowseWidth();
1031cdf0e10cSrcweir SwRect aNew( GetObjRectWithSpaces() );
1032cdf0e10cSrcweir SwRect aOld( aFrm );
1033cdf0e10cSrcweir if ( RES_UL_SPACE == nWhich )
1034cdf0e10cSrcweir {
1035cdf0e10cSrcweir const SvxULSpaceItem &rUL = *(SvxULSpaceItem*)pNew;
1036cdf0e10cSrcweir aOld.Top( Max( aOld.Top() - long(rUL.GetUpper()), 0L ) );
1037cdf0e10cSrcweir aOld.SSize().Height()+= rUL.GetLower();
1038cdf0e10cSrcweir }
1039cdf0e10cSrcweir else
1040cdf0e10cSrcweir {
1041cdf0e10cSrcweir const SvxLRSpaceItem &rLR = *(SvxLRSpaceItem*)pNew;
1042cdf0e10cSrcweir aOld.Left ( Max( aOld.Left() - long(rLR.GetLeft()), 0L ) );
1043cdf0e10cSrcweir aOld.SSize().Width() += rLR.GetRight();
1044cdf0e10cSrcweir }
1045cdf0e10cSrcweir aNew.Union( aOld );
1046cdf0e10cSrcweir NotifyBackground( FindPageFrm(), aNew, PREP_CLEAR );
1047cdf0e10cSrcweir }
1048cdf0e10cSrcweir break;
1049cdf0e10cSrcweir
1050cdf0e10cSrcweir case RES_BOX:
1051cdf0e10cSrcweir case RES_SHADOW:
1052cdf0e10cSrcweir rInvFlags |= 0x17;
1053cdf0e10cSrcweir break;
1054cdf0e10cSrcweir
1055cdf0e10cSrcweir case RES_FRAMEDIR :
1056cdf0e10cSrcweir SetDerivedVert( sal_False );
1057cdf0e10cSrcweir SetDerivedR2L( sal_False );
1058cdf0e10cSrcweir CheckDirChange();
1059cdf0e10cSrcweir break;
1060cdf0e10cSrcweir
1061cdf0e10cSrcweir case RES_OPAQUE:
1062cdf0e10cSrcweir {
1063cdf0e10cSrcweir if ( pSh )
1064cdf0e10cSrcweir pSh->InvalidateWindows( Frm() );
1065cdf0e10cSrcweir
1066cdf0e10cSrcweir const IDocumentDrawModelAccess* pIDDMA = GetFmt()->getIDocumentDrawModelAccess();
1067cdf0e10cSrcweir const sal_uInt8 nId = ((SvxOpaqueItem*)pNew)->GetValue() ?
1068cdf0e10cSrcweir pIDDMA->GetHeavenId() :
1069cdf0e10cSrcweir pIDDMA->GetHellId();
1070cdf0e10cSrcweir GetVirtDrawObj()->SetLayer( nId );
1071cdf0e10cSrcweir if( pSh )
1072cdf0e10cSrcweir {
1073cdf0e10cSrcweir SwRootFrm* pLayout = getRootFrm();
1074cdf0e10cSrcweir if( pLayout && pLayout->IsAnyShellAccessible() )
1075cdf0e10cSrcweir {
1076cdf0e10cSrcweir pSh->Imp()->DisposeAccessibleFrm( this );
1077cdf0e10cSrcweir pSh->Imp()->AddAccessibleFrm( this );
1078cdf0e10cSrcweir }
1079cdf0e10cSrcweir }
1080cdf0e10cSrcweir // --> OD 2004-06-28 #i28701# - perform reorder of object lists
1081cdf0e10cSrcweir // at anchor frame and at page frame.
1082cdf0e10cSrcweir rInvFlags |= 0x80;
1083cdf0e10cSrcweir }
1084cdf0e10cSrcweir break;
1085cdf0e10cSrcweir
1086cdf0e10cSrcweir case RES_URL:
1087cdf0e10cSrcweir //Das Interface arbeitet bei Textrahmen auf der Rahmengroesse,
1088cdf0e10cSrcweir //die Map muss sich aber auf die FrmSize beziehen
1089cdf0e10cSrcweir if ( (!Lower() || !Lower()->IsNoTxtFrm()) &&
1090cdf0e10cSrcweir ((SwFmtURL*)pNew)->GetMap() && ((SwFmtURL*)pOld)->GetMap() )
1091cdf0e10cSrcweir {
1092cdf0e10cSrcweir const SwFmtFrmSize &rSz = GetFmt()->GetFrmSize();
1093cdf0e10cSrcweir if ( rSz.GetHeight() != Frm().Height() ||
1094cdf0e10cSrcweir rSz.GetWidth() != Frm().Width() )
1095cdf0e10cSrcweir {
1096cdf0e10cSrcweir SwFmtURL aURL( GetFmt()->GetURL() );
1097cdf0e10cSrcweir Fraction aScaleX( Frm().Width(), rSz.GetWidth() );
1098cdf0e10cSrcweir Fraction aScaleY( Frm().Height(), rSz.GetHeight() );
1099cdf0e10cSrcweir aURL.GetMap()->Scale( aScaleX, aScaleY );
1100cdf0e10cSrcweir SwFrmFmt *pFmt = GetFmt();
1101cdf0e10cSrcweir pFmt->LockModify();
1102cdf0e10cSrcweir pFmt->SetFmtAttr( aURL );
1103cdf0e10cSrcweir pFmt->UnlockModify();
1104cdf0e10cSrcweir }
1105cdf0e10cSrcweir }
1106cdf0e10cSrcweir /* Keine Invalidierung notwendig */
1107cdf0e10cSrcweir break;
1108cdf0e10cSrcweir
1109cdf0e10cSrcweir case RES_CHAIN:
1110cdf0e10cSrcweir {
1111cdf0e10cSrcweir SwFmtChain *pChain = (SwFmtChain*)pNew;
1112cdf0e10cSrcweir if ( pChain->GetNext() )
1113cdf0e10cSrcweir {
1114cdf0e10cSrcweir SwFlyFrm *pFollow = FindChainNeighbour( *pChain->GetNext() );
1115cdf0e10cSrcweir if ( GetNextLink() && pFollow != GetNextLink() )
1116cdf0e10cSrcweir SwFlyFrm::UnchainFrames( this, GetNextLink());
1117cdf0e10cSrcweir if ( pFollow )
1118cdf0e10cSrcweir {
1119cdf0e10cSrcweir if ( pFollow->GetPrevLink() &&
1120cdf0e10cSrcweir pFollow->GetPrevLink() != this )
1121cdf0e10cSrcweir SwFlyFrm::UnchainFrames( pFollow->GetPrevLink(),
1122cdf0e10cSrcweir pFollow );
1123cdf0e10cSrcweir if ( !GetNextLink() )
1124cdf0e10cSrcweir SwFlyFrm::ChainFrames( this, pFollow );
1125cdf0e10cSrcweir }
1126cdf0e10cSrcweir }
1127cdf0e10cSrcweir else if ( GetNextLink() )
1128cdf0e10cSrcweir SwFlyFrm::UnchainFrames( this, GetNextLink() );
1129cdf0e10cSrcweir if ( pChain->GetPrev() )
1130cdf0e10cSrcweir {
1131cdf0e10cSrcweir SwFlyFrm *pMaster = FindChainNeighbour( *pChain->GetPrev() );
1132cdf0e10cSrcweir if ( GetPrevLink() && pMaster != GetPrevLink() )
1133cdf0e10cSrcweir SwFlyFrm::UnchainFrames( GetPrevLink(), this );
1134cdf0e10cSrcweir if ( pMaster )
1135cdf0e10cSrcweir {
1136cdf0e10cSrcweir if ( pMaster->GetNextLink() &&
1137cdf0e10cSrcweir pMaster->GetNextLink() != this )
1138cdf0e10cSrcweir SwFlyFrm::UnchainFrames( pMaster,
1139cdf0e10cSrcweir pMaster->GetNextLink() );
1140cdf0e10cSrcweir if ( !GetPrevLink() )
1141cdf0e10cSrcweir SwFlyFrm::ChainFrames( pMaster, this );
1142cdf0e10cSrcweir }
1143cdf0e10cSrcweir }
1144cdf0e10cSrcweir else if ( GetPrevLink() )
1145cdf0e10cSrcweir SwFlyFrm::UnchainFrames( GetPrevLink(), this );
1146cdf0e10cSrcweir }
1147cdf0e10cSrcweir
1148cdf0e10cSrcweir default:
1149cdf0e10cSrcweir bClear = sal_False;
1150cdf0e10cSrcweir }
1151cdf0e10cSrcweir if ( bClear )
1152cdf0e10cSrcweir {
1153cdf0e10cSrcweir if ( pOldSet || pNewSet )
1154cdf0e10cSrcweir {
1155cdf0e10cSrcweir if ( pOldSet )
1156cdf0e10cSrcweir pOldSet->ClearItem( nWhich );
1157cdf0e10cSrcweir if ( pNewSet )
1158cdf0e10cSrcweir pNewSet->ClearItem( nWhich );
1159cdf0e10cSrcweir }
1160cdf0e10cSrcweir else
1161cdf0e10cSrcweir SwLayoutFrm::Modify( pOld, pNew );
1162cdf0e10cSrcweir }
1163cdf0e10cSrcweir }
1164cdf0e10cSrcweir
1165cdf0e10cSrcweir /*************************************************************************
1166cdf0e10cSrcweir |*
1167cdf0e10cSrcweir |* SwFlyFrm::GetInfo()
1168cdf0e10cSrcweir |*
1169cdf0e10cSrcweir |* Beschreibung erfragt Informationen
1170cdf0e10cSrcweir |* Ersterstellung JP 31.03.94
1171cdf0e10cSrcweir |* Letzte Aenderung JP 31.03.94
1172cdf0e10cSrcweir |*
1173cdf0e10cSrcweir *************************************************************************/
1174cdf0e10cSrcweir
1175cdf0e10cSrcweir // erfrage vom Modify Informationen
GetInfo(SfxPoolItem & rInfo) const1176cdf0e10cSrcweir sal_Bool SwFlyFrm::GetInfo( SfxPoolItem & rInfo ) const
1177cdf0e10cSrcweir {
1178cdf0e10cSrcweir if( RES_AUTOFMT_DOCNODE == rInfo.Which() )
1179cdf0e10cSrcweir return sal_False; // es gibt einen FlyFrm also wird er benutzt
1180cdf0e10cSrcweir return sal_True; // weiter suchen
1181cdf0e10cSrcweir }
1182cdf0e10cSrcweir
1183cdf0e10cSrcweir /*************************************************************************
1184cdf0e10cSrcweir |*
1185cdf0e10cSrcweir |* SwFlyFrm::_Invalidate()
1186cdf0e10cSrcweir |*
1187cdf0e10cSrcweir |* Ersterstellung MA 15. Oct. 92
1188cdf0e10cSrcweir |* Letzte Aenderung MA 26. Jun. 96
1189cdf0e10cSrcweir |*
1190cdf0e10cSrcweir |*************************************************************************/
1191cdf0e10cSrcweir
_Invalidate(SwPageFrm * pPage)1192cdf0e10cSrcweir void SwFlyFrm::_Invalidate( SwPageFrm *pPage )
1193cdf0e10cSrcweir {
1194cdf0e10cSrcweir InvalidatePage( pPage );
1195cdf0e10cSrcweir bNotifyBack = bInvalid = sal_True;
1196cdf0e10cSrcweir
1197cdf0e10cSrcweir SwFlyFrm *pFrm;
1198cdf0e10cSrcweir if ( GetAnchorFrm() && 0 != (pFrm = AnchorFrm()->FindFlyFrm()) )
1199cdf0e10cSrcweir {
1200cdf0e10cSrcweir //Gaanz dumm: Wenn der Fly innerhalb eines Fly gebunden ist, der
1201cdf0e10cSrcweir //Spalten enthaehlt, sollte das Format von diesem ausgehen.
1202cdf0e10cSrcweir if ( !pFrm->IsLocked() && !pFrm->IsColLocked() &&
1203cdf0e10cSrcweir pFrm->Lower() && pFrm->Lower()->IsColumnFrm() )
1204cdf0e10cSrcweir pFrm->InvalidateSize();
1205cdf0e10cSrcweir }
1206cdf0e10cSrcweir
1207cdf0e10cSrcweir // --> OD 2008-01-21 #i85216#
1208cdf0e10cSrcweir // if vertical position is oriented at a layout frame inside a ghost section,
1209cdf0e10cSrcweir // assure that the position is invalidated and that the information about
1210cdf0e10cSrcweir // the vertical position oriented frame is cleared
1211cdf0e10cSrcweir if ( GetVertPosOrientFrm() && GetVertPosOrientFrm()->IsLayoutFrm() )
1212cdf0e10cSrcweir {
1213cdf0e10cSrcweir const SwSectionFrm* pSectFrm( GetVertPosOrientFrm()->FindSctFrm() );
1214cdf0e10cSrcweir if ( pSectFrm && pSectFrm->GetSection() == 0 )
1215cdf0e10cSrcweir {
1216cdf0e10cSrcweir InvalidatePos();
1217cdf0e10cSrcweir ClearVertPosOrientFrm();
1218cdf0e10cSrcweir }
1219cdf0e10cSrcweir }
1220cdf0e10cSrcweir // <--
1221cdf0e10cSrcweir }
1222cdf0e10cSrcweir
1223cdf0e10cSrcweir /*************************************************************************
1224cdf0e10cSrcweir |*
1225cdf0e10cSrcweir |* SwFlyFrm::ChgRelPos()
1226cdf0e10cSrcweir |*
1227cdf0e10cSrcweir |* Beschreibung Aenderung der relativen Position, die Position wird
1228cdf0e10cSrcweir |* damit automatisch Fix, das Attribut wird entprechend angepasst.
1229cdf0e10cSrcweir |* Ersterstellung MA 25. Aug. 92
1230cdf0e10cSrcweir |* Letzte Aenderung MA 09. Aug. 95
1231cdf0e10cSrcweir |*
1232cdf0e10cSrcweir |*************************************************************************/
1233cdf0e10cSrcweir
ChgRelPos(const Point & rNewPos)1234cdf0e10cSrcweir void SwFlyFrm::ChgRelPos( const Point &rNewPos )
1235cdf0e10cSrcweir {
1236cdf0e10cSrcweir if ( GetCurrRelPos() != rNewPos )
1237cdf0e10cSrcweir {
1238cdf0e10cSrcweir SwFrmFmt *pFmt = GetFmt();
1239cdf0e10cSrcweir const bool bVert = GetAnchorFrm()->IsVertical();
1240cdf0e10cSrcweir const SwTwips nNewY = bVert ? rNewPos.X() : rNewPos.Y();
1241cdf0e10cSrcweir SwTwips nTmpY = nNewY == LONG_MAX ? 0 : nNewY;
1242cdf0e10cSrcweir if( bVert )
1243cdf0e10cSrcweir nTmpY = -nTmpY;
1244cdf0e10cSrcweir SfxItemSet aSet( pFmt->GetDoc()->GetAttrPool(),
1245cdf0e10cSrcweir RES_VERT_ORIENT, RES_HORI_ORIENT);
1246cdf0e10cSrcweir
1247cdf0e10cSrcweir SwFmtVertOrient aVert( pFmt->GetVertOrient() );
1248cdf0e10cSrcweir SwTxtFrm *pAutoFrm = NULL;
1249cdf0e10cSrcweir // --> OD 2004-11-12 #i34948# - handle also at-page and at-fly anchored
1250cdf0e10cSrcweir // Writer fly frames
1251cdf0e10cSrcweir const RndStdIds eAnchorType = GetFrmFmt().GetAnchor().GetAnchorId();
1252cdf0e10cSrcweir if ( eAnchorType == FLY_AT_PAGE )
1253cdf0e10cSrcweir {
1254cdf0e10cSrcweir aVert.SetVertOrient( text::VertOrientation::NONE );
1255cdf0e10cSrcweir aVert.SetRelationOrient( text::RelOrientation::PAGE_FRAME );
1256cdf0e10cSrcweir }
1257cdf0e10cSrcweir else if ( eAnchorType == FLY_AT_FLY )
1258cdf0e10cSrcweir {
1259cdf0e10cSrcweir aVert.SetVertOrient( text::VertOrientation::NONE );
1260cdf0e10cSrcweir aVert.SetRelationOrient( text::RelOrientation::FRAME );
1261cdf0e10cSrcweir }
1262cdf0e10cSrcweir // <--
1263cdf0e10cSrcweir else if ( IsFlyAtCntFrm() || text::VertOrientation::NONE != aVert.GetVertOrient() )
1264cdf0e10cSrcweir {
1265cdf0e10cSrcweir if( text::RelOrientation::CHAR == aVert.GetRelationOrient() && IsAutoPos() )
1266cdf0e10cSrcweir {
1267cdf0e10cSrcweir if( LONG_MAX != nNewY )
1268cdf0e10cSrcweir {
1269cdf0e10cSrcweir aVert.SetVertOrient( text::VertOrientation::NONE );
1270cdf0e10cSrcweir xub_StrLen nOfs =
1271cdf0e10cSrcweir pFmt->GetAnchor().GetCntntAnchor()->nContent.GetIndex();
1272cdf0e10cSrcweir ASSERT( GetAnchorFrm()->IsTxtFrm(), "TxtFrm expected" );
1273cdf0e10cSrcweir pAutoFrm = (SwTxtFrm*)GetAnchorFrm();
1274cdf0e10cSrcweir while( pAutoFrm->GetFollow() &&
1275cdf0e10cSrcweir pAutoFrm->GetFollow()->GetOfst() <= nOfs )
1276cdf0e10cSrcweir {
1277cdf0e10cSrcweir if( pAutoFrm == GetAnchorFrm() )
1278cdf0e10cSrcweir nTmpY += pAutoFrm->GetRelPos().Y();
1279cdf0e10cSrcweir nTmpY -= pAutoFrm->GetUpper()->Prt().Height();
1280cdf0e10cSrcweir pAutoFrm = pAutoFrm->GetFollow();
1281cdf0e10cSrcweir }
1282cdf0e10cSrcweir nTmpY = ((SwFlyAtCntFrm*)this)->GetRelCharY(pAutoFrm)-nTmpY;
1283cdf0e10cSrcweir }
1284cdf0e10cSrcweir else
1285cdf0e10cSrcweir aVert.SetVertOrient( text::VertOrientation::CHAR_BOTTOM );
1286cdf0e10cSrcweir }
1287cdf0e10cSrcweir else
1288cdf0e10cSrcweir {
1289cdf0e10cSrcweir aVert.SetVertOrient( text::VertOrientation::NONE );
1290cdf0e10cSrcweir aVert.SetRelationOrient( text::RelOrientation::FRAME );
1291cdf0e10cSrcweir }
1292cdf0e10cSrcweir }
1293cdf0e10cSrcweir aVert.SetPos( nTmpY );
1294cdf0e10cSrcweir aSet.Put( aVert );
1295cdf0e10cSrcweir
1296cdf0e10cSrcweir //Fuer Flys im Cnt ist die horizontale Ausrichtung uninteressant,
1297cdf0e10cSrcweir //den sie ist stets 0.
1298cdf0e10cSrcweir if ( !IsFlyInCntFrm() )
1299cdf0e10cSrcweir {
1300cdf0e10cSrcweir const SwTwips nNewX = bVert ? rNewPos.Y() : rNewPos.X();
1301cdf0e10cSrcweir SwTwips nTmpX = nNewX == LONG_MAX ? 0 : nNewX;
1302cdf0e10cSrcweir SwFmtHoriOrient aHori( pFmt->GetHoriOrient() );
1303cdf0e10cSrcweir // --> OD 2004-11-12 #i34948# - handle also at-page and at-fly anchored
1304cdf0e10cSrcweir // Writer fly frames
1305cdf0e10cSrcweir if ( eAnchorType == FLY_AT_PAGE )
1306cdf0e10cSrcweir {
1307cdf0e10cSrcweir aHori.SetHoriOrient( text::HoriOrientation::NONE );
1308cdf0e10cSrcweir aHori.SetRelationOrient( text::RelOrientation::PAGE_FRAME );
1309cdf0e10cSrcweir aHori.SetPosToggle( sal_False );
1310cdf0e10cSrcweir }
1311cdf0e10cSrcweir else if ( eAnchorType == FLY_AT_FLY )
1312cdf0e10cSrcweir {
1313cdf0e10cSrcweir aHori.SetHoriOrient( text::HoriOrientation::NONE );
1314cdf0e10cSrcweir aHori.SetRelationOrient( text::RelOrientation::FRAME );
1315cdf0e10cSrcweir aHori.SetPosToggle( sal_False );
1316cdf0e10cSrcweir }
1317cdf0e10cSrcweir // <--
1318cdf0e10cSrcweir else if ( IsFlyAtCntFrm() || text::HoriOrientation::NONE != aHori.GetHoriOrient() )
1319cdf0e10cSrcweir {
1320cdf0e10cSrcweir aHori.SetHoriOrient( text::HoriOrientation::NONE );
1321cdf0e10cSrcweir if( text::RelOrientation::CHAR == aHori.GetRelationOrient() && IsAutoPos() )
1322cdf0e10cSrcweir {
1323cdf0e10cSrcweir if( LONG_MAX != nNewX )
1324cdf0e10cSrcweir {
1325cdf0e10cSrcweir if( !pAutoFrm )
1326cdf0e10cSrcweir {
1327cdf0e10cSrcweir xub_StrLen nOfs = pFmt->GetAnchor().GetCntntAnchor()
1328cdf0e10cSrcweir ->nContent.GetIndex();
1329cdf0e10cSrcweir ASSERT( GetAnchorFrm()->IsTxtFrm(), "TxtFrm expected");
1330cdf0e10cSrcweir pAutoFrm = (SwTxtFrm*)GetAnchorFrm();
1331cdf0e10cSrcweir while( pAutoFrm->GetFollow() &&
1332cdf0e10cSrcweir pAutoFrm->GetFollow()->GetOfst() <= nOfs )
1333cdf0e10cSrcweir pAutoFrm = pAutoFrm->GetFollow();
1334cdf0e10cSrcweir }
1335cdf0e10cSrcweir nTmpX -= ((SwFlyAtCntFrm*)this)->GetRelCharX(pAutoFrm);
1336cdf0e10cSrcweir }
1337cdf0e10cSrcweir }
1338cdf0e10cSrcweir else
1339cdf0e10cSrcweir aHori.SetRelationOrient( text::RelOrientation::FRAME );
1340cdf0e10cSrcweir aHori.SetPosToggle( sal_False );
1341cdf0e10cSrcweir }
1342cdf0e10cSrcweir aHori.SetPos( nTmpX );
1343cdf0e10cSrcweir aSet.Put( aHori );
1344cdf0e10cSrcweir }
1345cdf0e10cSrcweir SetCurrRelPos( rNewPos );
1346cdf0e10cSrcweir pFmt->GetDoc()->SetAttr( aSet, *pFmt );
1347cdf0e10cSrcweir }
1348cdf0e10cSrcweir }
1349cdf0e10cSrcweir /*************************************************************************
1350cdf0e10cSrcweir |*
1351cdf0e10cSrcweir |* SwFlyFrm::Format()
1352cdf0e10cSrcweir |*
1353cdf0e10cSrcweir |* Beschreibung: "Formatiert" den Frame; Frm und PrtArea.
1354cdf0e10cSrcweir |* Die Fixsize wird hier nicht eingestellt.
1355cdf0e10cSrcweir |* Ersterstellung MA 14. Jun. 93
1356cdf0e10cSrcweir |* Letzte Aenderung MA 13. Jun. 96
1357cdf0e10cSrcweir |*
1358cdf0e10cSrcweir |*************************************************************************/
1359cdf0e10cSrcweir
Format(const SwBorderAttrs * pAttrs)1360cdf0e10cSrcweir void SwFlyFrm::Format( const SwBorderAttrs *pAttrs )
1361cdf0e10cSrcweir {
1362cdf0e10cSrcweir ASSERT( pAttrs, "FlyFrm::Format, pAttrs ist 0." );
1363cdf0e10cSrcweir
1364cdf0e10cSrcweir ColLock();
1365cdf0e10cSrcweir
1366cdf0e10cSrcweir if ( !bValidSize )
1367cdf0e10cSrcweir {
1368cdf0e10cSrcweir if ( Frm().Top() == WEIT_WECH && Frm().Left() == WEIT_WECH )
1369cdf0e10cSrcweir {
1370cdf0e10cSrcweir //Sicherheitsschaltung wegnehmen (siehe SwFrm::CTor)
1371cdf0e10cSrcweir Frm().Pos().X() = Frm().Pos().Y() = 0;
1372cdf0e10cSrcweir // --> OD 2006-08-16 #i68520#
1373cdf0e10cSrcweir InvalidateObjRectWithSpaces();
1374cdf0e10cSrcweir // <--
1375cdf0e10cSrcweir }
1376cdf0e10cSrcweir
1377cdf0e10cSrcweir //Breite der Spalten pruefen und ggf. einstellen.
1378cdf0e10cSrcweir if ( Lower() && Lower()->IsColumnFrm() )
1379cdf0e10cSrcweir AdjustColumns( 0, sal_False );
1380cdf0e10cSrcweir
1381cdf0e10cSrcweir bValidSize = sal_True;
1382cdf0e10cSrcweir
1383cdf0e10cSrcweir const SwTwips nUL = pAttrs->CalcTopLine() + pAttrs->CalcBottomLine();
1384cdf0e10cSrcweir const SwTwips nLR = pAttrs->CalcLeftLine() + pAttrs->CalcRightLine();
1385cdf0e10cSrcweir const SwFmtFrmSize &rFrmSz = GetFmt()->GetFrmSize();
1386cdf0e10cSrcweir Size aRelSize( CalcRel( rFrmSz ) );
1387cdf0e10cSrcweir
1388cdf0e10cSrcweir ASSERT( pAttrs->GetSize().Height() != 0 || rFrmSz.GetHeightPercent(), "Hoehe des RahmenAttr ist 0." );
1389cdf0e10cSrcweir ASSERT( pAttrs->GetSize().Width() != 0 || rFrmSz.GetWidthPercent(), "Breite des RahmenAttr ist 0." );
1390cdf0e10cSrcweir
1391cdf0e10cSrcweir SWRECTFN( this )
1392cdf0e10cSrcweir if( !HasFixSize() )
1393cdf0e10cSrcweir {
1394cdf0e10cSrcweir SwTwips nRemaining = 0;
1395cdf0e10cSrcweir
1396cdf0e10cSrcweir long nMinHeight = 0;
1397cdf0e10cSrcweir if( IsMinHeight() )
1398cdf0e10cSrcweir nMinHeight = bVert ? aRelSize.Width() : aRelSize.Height();
1399cdf0e10cSrcweir
1400cdf0e10cSrcweir if ( Lower() )
1401cdf0e10cSrcweir {
1402cdf0e10cSrcweir if ( Lower()->IsColumnFrm() )
1403cdf0e10cSrcweir {
1404cdf0e10cSrcweir FormatWidthCols( *pAttrs, nUL, nMinHeight );
1405cdf0e10cSrcweir nRemaining = (Lower()->Frm().*fnRect->fnGetHeight)();
1406cdf0e10cSrcweir }
1407cdf0e10cSrcweir else
1408cdf0e10cSrcweir {
1409cdf0e10cSrcweir SwFrm *pFrm = Lower();
1410cdf0e10cSrcweir while ( pFrm )
1411cdf0e10cSrcweir {
1412cdf0e10cSrcweir nRemaining += (pFrm->Frm().*fnRect->fnGetHeight)();
1413cdf0e10cSrcweir if( pFrm->IsTxtFrm() && ((SwTxtFrm*)pFrm)->IsUndersized() )
1414cdf0e10cSrcweir // Dieser TxtFrm waere gern ein bisschen groesser
1415cdf0e10cSrcweir nRemaining += ((SwTxtFrm*)pFrm)->GetParHeight()
1416cdf0e10cSrcweir - (pFrm->Prt().*fnRect->fnGetHeight)();
1417cdf0e10cSrcweir else if( pFrm->IsSctFrm() && ((SwSectionFrm*)pFrm)->IsUndersized() )
1418cdf0e10cSrcweir nRemaining += ((SwSectionFrm*)pFrm)->Undersize();
1419cdf0e10cSrcweir pFrm = pFrm->GetNext();
1420cdf0e10cSrcweir }
1421cdf0e10cSrcweir // --> OD 2006-02-09 #130878#
1422cdf0e10cSrcweir // Do not keep old height, if content has no height.
1423cdf0e10cSrcweir // The old height could be wrong due to wrong layout cache
1424cdf0e10cSrcweir // and isn't corrected in the further formatting, because
1425cdf0e10cSrcweir // the fly frame doesn't become invalid anymore.
1426cdf0e10cSrcweir // if( !nRemaining )
1427cdf0e10cSrcweir // nRemaining = nOldHeight - nUL;
1428cdf0e10cSrcweir // <--
1429cdf0e10cSrcweir }
1430cdf0e10cSrcweir if ( GetDrawObjs() )
1431cdf0e10cSrcweir {
1432cdf0e10cSrcweir sal_uInt32 nCnt = GetDrawObjs()->Count();
1433cdf0e10cSrcweir SwTwips nTop = (Frm().*fnRect->fnGetTop)();
1434cdf0e10cSrcweir SwTwips nBorder = (Frm().*fnRect->fnGetHeight)() -
1435cdf0e10cSrcweir (Prt().*fnRect->fnGetHeight)();
1436cdf0e10cSrcweir for ( sal_uInt16 i = 0; i < nCnt; ++i )
1437cdf0e10cSrcweir {
1438cdf0e10cSrcweir SwAnchoredObject* pAnchoredObj = (*GetDrawObjs())[i];
1439cdf0e10cSrcweir if ( pAnchoredObj->ISA(SwFlyFrm) )
1440cdf0e10cSrcweir {
1441cdf0e10cSrcweir SwFlyFrm* pFly = static_cast<SwFlyFrm*>(pAnchoredObj);
1442cdf0e10cSrcweir // OD 06.11.2003 #i22305# - consider
1443cdf0e10cSrcweir // only Writer fly frames, which follow the text flow.
1444cdf0e10cSrcweir if ( pFly->IsFlyLayFrm() &&
1445cdf0e10cSrcweir pFly->Frm().Top() != WEIT_WECH &&
1446cdf0e10cSrcweir pFly->GetFmt()->GetFollowTextFlow().GetValue() )
1447cdf0e10cSrcweir {
1448cdf0e10cSrcweir SwTwips nDist = -(pFly->Frm().*fnRect->
1449cdf0e10cSrcweir fnBottomDist)( nTop );
1450cdf0e10cSrcweir if( nDist > nBorder + nRemaining )
1451cdf0e10cSrcweir nRemaining = nDist - nBorder;
1452cdf0e10cSrcweir }
1453cdf0e10cSrcweir }
1454cdf0e10cSrcweir }
1455cdf0e10cSrcweir }
1456cdf0e10cSrcweir }
1457cdf0e10cSrcweir
1458cdf0e10cSrcweir if( IsMinHeight() && (nRemaining + nUL) < nMinHeight )
1459cdf0e10cSrcweir nRemaining = nMinHeight - nUL;
1460cdf0e10cSrcweir //Weil das Grow/Shrink der Flys die Groessen nicht direkt
1461cdf0e10cSrcweir //einstellt, sondern indirekt per Invalidate ein Format
1462cdf0e10cSrcweir //ausloesst, muessen die Groessen hier direkt eingestellt
1463cdf0e10cSrcweir //werden. Benachrichtung laeuft bereits mit.
1464cdf0e10cSrcweir //Weil bereits haeufiger 0en per Attribut hereinkamen wehre
1465cdf0e10cSrcweir //ich mich ab sofort dagegen.
1466cdf0e10cSrcweir if ( nRemaining < MINFLY )
1467cdf0e10cSrcweir nRemaining = MINFLY;
1468cdf0e10cSrcweir (Prt().*fnRect->fnSetHeight)( nRemaining );
1469cdf0e10cSrcweir nRemaining -= (Frm().*fnRect->fnGetHeight)();
1470cdf0e10cSrcweir (Frm().*fnRect->fnAddBottom)( nRemaining + nUL );
1471cdf0e10cSrcweir // --> OD 2006-08-16 #i68520#
1472cdf0e10cSrcweir if ( nRemaining + nUL != 0 )
1473cdf0e10cSrcweir {
1474cdf0e10cSrcweir InvalidateObjRectWithSpaces();
1475cdf0e10cSrcweir }
1476cdf0e10cSrcweir // <--
1477cdf0e10cSrcweir bValidSize = sal_True;
1478cdf0e10cSrcweir }
1479cdf0e10cSrcweir else
1480cdf0e10cSrcweir {
1481cdf0e10cSrcweir bValidSize = sal_True; //Fixe Frms formatieren sich nicht.
1482cdf0e10cSrcweir //Flys stellen ihre Groesse anhand des Attr ein.
1483cdf0e10cSrcweir SwTwips nNewSize = bVert ? aRelSize.Width() : aRelSize.Height();
1484cdf0e10cSrcweir nNewSize -= nUL;
1485cdf0e10cSrcweir if( nNewSize < MINFLY )
1486cdf0e10cSrcweir nNewSize = MINFLY;
1487cdf0e10cSrcweir (Prt().*fnRect->fnSetHeight)( nNewSize );
1488cdf0e10cSrcweir nNewSize += nUL - (Frm().*fnRect->fnGetHeight)();
1489cdf0e10cSrcweir (Frm().*fnRect->fnAddBottom)( nNewSize );
1490cdf0e10cSrcweir // --> OD 2006-08-16 #i68520#
1491cdf0e10cSrcweir if ( nNewSize != 0 )
1492cdf0e10cSrcweir {
1493cdf0e10cSrcweir InvalidateObjRectWithSpaces();
1494cdf0e10cSrcweir }
1495cdf0e10cSrcweir // <--
1496cdf0e10cSrcweir }
1497cdf0e10cSrcweir
1498cdf0e10cSrcweir if ( !bFormatHeightOnly )
1499cdf0e10cSrcweir {
1500cdf0e10cSrcweir ASSERT( aRelSize == CalcRel( rFrmSz ), "SwFlyFrm::Format CalcRel problem" )
1501cdf0e10cSrcweir SwTwips nNewSize = bVert ? aRelSize.Height() : aRelSize.Width();
1502cdf0e10cSrcweir
1503cdf0e10cSrcweir if ( rFrmSz.GetWidthSizeType() != ATT_FIX_SIZE )
1504cdf0e10cSrcweir {
1505cdf0e10cSrcweir // #i9046# Autowidth for fly frames
1506cdf0e10cSrcweir const SwTwips nAutoWidth = CalcAutoWidth();
1507cdf0e10cSrcweir if ( nAutoWidth )
1508cdf0e10cSrcweir {
1509cdf0e10cSrcweir if( ATT_MIN_SIZE == rFrmSz.GetWidthSizeType() )
1510cdf0e10cSrcweir nNewSize = Max( nNewSize - nLR, nAutoWidth );
1511cdf0e10cSrcweir else
1512cdf0e10cSrcweir nNewSize = nAutoWidth;
1513cdf0e10cSrcweir }
1514cdf0e10cSrcweir }
151591100364SJian Hong Cheng /*else
151691100364SJian Hong Cheng nNewSize -= nLR;*/
151791100364SJian Hong Cheng else
151891100364SJian Hong Cheng {//Bug 120881:For enlarging fixed size Pagenumber frame,kangjian
151991100364SJian Hong Cheng if(nNewSize <= 500 && IsPageNumberingFrm())
152091100364SJian Hong Cheng nNewSize = nNewSize - nLR + 150;
152191100364SJian Hong Cheng
1522cdf0e10cSrcweir else
1523cdf0e10cSrcweir nNewSize -= nLR;
152491100364SJian Hong Cheng //Bug 120881(End)
152591100364SJian Hong Cheng }
1526cdf0e10cSrcweir
1527cdf0e10cSrcweir if( nNewSize < MINFLY )
1528cdf0e10cSrcweir nNewSize = MINFLY;
1529cdf0e10cSrcweir (Prt().*fnRect->fnSetWidth)( nNewSize );
1530cdf0e10cSrcweir nNewSize += nLR - (Frm().*fnRect->fnGetWidth)();
1531cdf0e10cSrcweir (Frm().*fnRect->fnAddRight)( nNewSize );
1532cdf0e10cSrcweir // --> OD 2006-08-16 #i68520#
1533cdf0e10cSrcweir if ( nNewSize != 0 )
1534cdf0e10cSrcweir {
1535cdf0e10cSrcweir InvalidateObjRectWithSpaces();
1536cdf0e10cSrcweir }
1537cdf0e10cSrcweir // <--
1538cdf0e10cSrcweir }
1539cdf0e10cSrcweir }
1540cdf0e10cSrcweir ColUnlock();
1541cdf0e10cSrcweir }
1542cdf0e10cSrcweir
1543cdf0e10cSrcweir // OD 14.03.2003 #i11760# - change parameter <bNoColl>: type <bool>;
1544cdf0e10cSrcweir // default value = false.
1545cdf0e10cSrcweir // OD 14.03.2003 #i11760# - add new parameter <bNoCalcFollow> with
1546cdf0e10cSrcweir // default value = false.
1547cdf0e10cSrcweir // OD 11.04.2003 #108824# - new parameter <bNoCalcFollow> was used by method
1548cdf0e10cSrcweir // <FormatWidthCols(..)> to avoid follow formatting
1549cdf0e10cSrcweir // for text frames. But, unformatted follows causes
1550cdf0e10cSrcweir // problems in method <SwCntntFrm::_WouldFit(..)>,
1551cdf0e10cSrcweir // which assumes that the follows are formatted.
1552cdf0e10cSrcweir // Thus, <bNoCalcFollow> no longer used by <FormatWidthCols(..)>.
1553cdf0e10cSrcweir //void CalcCntnt( SwLayoutFrm *pLay, sal_Bool bNoColl )
CalcCntnt(SwLayoutFrm * pLay,bool bNoColl,bool bNoCalcFollow)1554cdf0e10cSrcweir void CalcCntnt( SwLayoutFrm *pLay,
1555cdf0e10cSrcweir bool bNoColl,
1556cdf0e10cSrcweir bool bNoCalcFollow )
1557cdf0e10cSrcweir {
1558cdf0e10cSrcweir SwSectionFrm* pSect;
1559cdf0e10cSrcweir sal_Bool bCollect = sal_False;
1560cdf0e10cSrcweir if( pLay->IsSctFrm() )
1561cdf0e10cSrcweir {
1562cdf0e10cSrcweir pSect = (SwSectionFrm*)pLay;
1563cdf0e10cSrcweir if( pSect->IsEndnAtEnd() && !bNoColl )
1564cdf0e10cSrcweir {
1565cdf0e10cSrcweir bCollect = sal_True;
1566cdf0e10cSrcweir SwLayouter::CollectEndnotes( pLay->GetFmt()->GetDoc(), pSect );
1567cdf0e10cSrcweir }
1568cdf0e10cSrcweir pSect->CalcFtnCntnt();
1569cdf0e10cSrcweir }
1570cdf0e10cSrcweir else
1571cdf0e10cSrcweir pSect = NULL;
1572cdf0e10cSrcweir SwFrm *pFrm = pLay->ContainsAny();
1573cdf0e10cSrcweir if ( !pFrm )
1574cdf0e10cSrcweir {
1575cdf0e10cSrcweir if( pSect )
1576cdf0e10cSrcweir {
1577cdf0e10cSrcweir if( pSect->HasFollow() )
1578cdf0e10cSrcweir pFrm = pSect->GetFollow()->ContainsAny();
1579cdf0e10cSrcweir if( !pFrm )
1580cdf0e10cSrcweir {
1581cdf0e10cSrcweir if( pSect->IsEndnAtEnd() )
1582cdf0e10cSrcweir {
1583cdf0e10cSrcweir if( bCollect )
1584cdf0e10cSrcweir pLay->GetFmt()->GetDoc()->GetLayouter()->
1585cdf0e10cSrcweir InsertEndnotes( pSect );
1586cdf0e10cSrcweir sal_Bool bLock = pSect->IsFtnLock();
1587cdf0e10cSrcweir pSect->SetFtnLock( sal_True );
1588cdf0e10cSrcweir pSect->CalcFtnCntnt();
1589cdf0e10cSrcweir pSect->CalcFtnCntnt();
1590cdf0e10cSrcweir pSect->SetFtnLock( bLock );
1591cdf0e10cSrcweir }
1592cdf0e10cSrcweir return;
1593cdf0e10cSrcweir }
1594cdf0e10cSrcweir pFrm->_InvalidatePos();
1595cdf0e10cSrcweir }
1596cdf0e10cSrcweir else
1597cdf0e10cSrcweir return;
1598cdf0e10cSrcweir }
1599cdf0e10cSrcweir pFrm->InvalidatePage();
1600cdf0e10cSrcweir
1601cdf0e10cSrcweir do
1602cdf0e10cSrcweir {
1603cdf0e10cSrcweir // local variables to avoid loops caused by anchored object positioning
1604cdf0e10cSrcweir SwAnchoredObject* pAgainObj1 = 0;
1605cdf0e10cSrcweir SwAnchoredObject* pAgainObj2 = 0;
1606cdf0e10cSrcweir
1607cdf0e10cSrcweir // FME 2007-08-30 #i81146# new loop control
1608cdf0e10cSrcweir sal_uInt16 nLoopControlRuns = 0;
1609cdf0e10cSrcweir const sal_uInt16 nLoopControlMax = 20;
1610cdf0e10cSrcweir const SwFrm* pLoopControlCond = 0;
1611cdf0e10cSrcweir
1612cdf0e10cSrcweir SwFrm* pLast;
1613cdf0e10cSrcweir do
1614cdf0e10cSrcweir {
1615cdf0e10cSrcweir pLast = pFrm;
1616cdf0e10cSrcweir if( pFrm->IsVertical() ?
1617cdf0e10cSrcweir ( pFrm->GetUpper()->Prt().Height() != pFrm->Frm().Height() )
1618cdf0e10cSrcweir : ( pFrm->GetUpper()->Prt().Width() != pFrm->Frm().Width() ) )
1619cdf0e10cSrcweir {
1620cdf0e10cSrcweir pFrm->Prepare( PREP_FIXSIZE_CHG );
1621cdf0e10cSrcweir pFrm->_InvalidateSize();
1622cdf0e10cSrcweir }
1623cdf0e10cSrcweir
1624cdf0e10cSrcweir if ( pFrm->IsTabFrm() )
1625cdf0e10cSrcweir {
1626cdf0e10cSrcweir ((SwTabFrm*)pFrm)->bCalcLowers = sal_True;
1627cdf0e10cSrcweir // OD 26.08.2003 #i18103# - lock move backward of follow table,
1628cdf0e10cSrcweir // if no section content is formatted or follow table belongs
1629cdf0e10cSrcweir // to the section, which content is formatted.
1630cdf0e10cSrcweir if ( ((SwTabFrm*)pFrm)->IsFollow() &&
1631cdf0e10cSrcweir ( !pSect || pSect == pFrm->FindSctFrm() ) )
1632cdf0e10cSrcweir {
1633cdf0e10cSrcweir ((SwTabFrm*)pFrm)->bLockBackMove = sal_True;
1634cdf0e10cSrcweir }
1635cdf0e10cSrcweir }
1636cdf0e10cSrcweir
1637cdf0e10cSrcweir // OD 14.03.2003 #i11760# - forbid format of follow, if requested.
1638cdf0e10cSrcweir if ( bNoCalcFollow && pFrm->IsTxtFrm() )
1639cdf0e10cSrcweir static_cast<SwTxtFrm*>(pFrm)->ForbidFollowFormat();
1640cdf0e10cSrcweir
1641cdf0e10cSrcweir pFrm->Calc();
1642cdf0e10cSrcweir
1643cdf0e10cSrcweir // OD 14.03.2003 #i11760# - reset control flag for follow format.
1644cdf0e10cSrcweir if ( pFrm->IsTxtFrm() )
1645cdf0e10cSrcweir {
1646cdf0e10cSrcweir static_cast<SwTxtFrm*>(pFrm)->AllowFollowFormat();
1647cdf0e10cSrcweir }
1648cdf0e10cSrcweir
1649cdf0e10cSrcweir // #111937# The keep-attribute can cause the position
1650cdf0e10cSrcweir // of the prev to be invalid:
1651cdf0e10cSrcweir // OD 2004-03-15 #116560# - Do not consider invalid previous frame
1652cdf0e10cSrcweir // due to its keep-attribute, if current frame is a follow or is locked.
1653cdf0e10cSrcweir // --> OD 2005-03-08 #i44049# - do not consider invalid previous
1654cdf0e10cSrcweir // frame due to its keep-attribute, if it can't move forward.
1655cdf0e10cSrcweir // --> OD 2006-01-27 #i57765# - do not consider invalid previous
1656cdf0e10cSrcweir // frame, if current frame has a column/page break before attribute.
1657cdf0e10cSrcweir SwFrm* pTmpPrev = pFrm->FindPrev();
1658cdf0e10cSrcweir SwFlowFrm* pTmpPrevFlowFrm = pTmpPrev && pTmpPrev->IsFlowFrm() ? SwFlowFrm::CastFlowFrm(pTmpPrev) : 0;
1659cdf0e10cSrcweir SwFlowFrm* pTmpFlowFrm = pFrm->IsFlowFrm() ? SwFlowFrm::CastFlowFrm(pFrm) : 0;
1660cdf0e10cSrcweir
1661cdf0e10cSrcweir bool bPrevInvalid = pTmpPrevFlowFrm && pTmpFlowFrm &&
1662cdf0e10cSrcweir !pTmpFlowFrm->IsFollow() &&
1663cdf0e10cSrcweir !StackHack::IsLocked() && // #i76382#
1664cdf0e10cSrcweir !pTmpFlowFrm->IsJoinLocked() &&
1665cdf0e10cSrcweir !pTmpPrev->GetValidPosFlag() &&
1666cdf0e10cSrcweir pLay->IsAnLower( pTmpPrev ) &&
1667cdf0e10cSrcweir pTmpPrevFlowFrm->IsKeep( *pTmpPrev->GetAttrSet() ) &&
1668cdf0e10cSrcweir pTmpPrevFlowFrm->IsKeepFwdMoveAllowed();
1669cdf0e10cSrcweir // <--
1670cdf0e10cSrcweir
1671cdf0e10cSrcweir // format floating screen objects anchored to the frame.
1672cdf0e10cSrcweir bool bRestartLayoutProcess = false;
1673cdf0e10cSrcweir if ( !bPrevInvalid && pFrm->GetDrawObjs() && pLay->IsAnLower( pFrm ) )
1674cdf0e10cSrcweir {
1675cdf0e10cSrcweir bool bAgain = false;
1676cdf0e10cSrcweir SwPageFrm* pPageFrm = pFrm->FindPageFrm();
1677cdf0e10cSrcweir sal_uInt32 nCnt = pFrm->GetDrawObjs()->Count();
1678cdf0e10cSrcweir for ( sal_uInt16 i = 0; i < nCnt; ++i )
1679cdf0e10cSrcweir {
1680cdf0e10cSrcweir // --> OD 2004-07-01 #i28701#
1681cdf0e10cSrcweir SwAnchoredObject* pAnchoredObj = (*pFrm->GetDrawObjs())[i];
1682cdf0e10cSrcweir // determine, if anchored object has to be formatted.
1683cdf0e10cSrcweir if ( pAnchoredObj->PositionLocked() )
1684cdf0e10cSrcweir {
1685cdf0e10cSrcweir continue;
1686cdf0e10cSrcweir }
1687cdf0e10cSrcweir
1688cdf0e10cSrcweir // format anchored object
1689cdf0e10cSrcweir if ( pAnchoredObj->IsFormatPossible() )
1690cdf0e10cSrcweir {
1691cdf0e10cSrcweir // --> OD 2005-05-17 #i43737# - no invalidation of
1692cdf0e10cSrcweir // anchored object needed - causes loops for as-character
1693cdf0e10cSrcweir // anchored objects.
1694cdf0e10cSrcweir //pAnchoredObj->InvalidateObjPos();
1695cdf0e10cSrcweir // <--
1696cdf0e10cSrcweir SwRect aRect( pAnchoredObj->GetObjRect() );
1697cdf0e10cSrcweir if ( !SwObjectFormatter::FormatObj( *pAnchoredObj, pFrm, pPageFrm ) )
1698cdf0e10cSrcweir {
1699cdf0e10cSrcweir bRestartLayoutProcess = true;
1700cdf0e10cSrcweir break;
1701cdf0e10cSrcweir }
1702cdf0e10cSrcweir // --> OD 2004-08-25 #i3317# - restart layout process,
1703cdf0e10cSrcweir // if the position of the anchored object is locked now.
1704cdf0e10cSrcweir if ( pAnchoredObj->PositionLocked() )
1705cdf0e10cSrcweir {
1706cdf0e10cSrcweir bRestartLayoutProcess = true;
1707cdf0e10cSrcweir break;
1708cdf0e10cSrcweir }
1709cdf0e10cSrcweir // <--
1710cdf0e10cSrcweir
1711cdf0e10cSrcweir if ( aRect != pAnchoredObj->GetObjRect() )
1712cdf0e10cSrcweir {
1713cdf0e10cSrcweir bAgain = true;
1714cdf0e10cSrcweir if ( pAgainObj2 == pAnchoredObj )
1715cdf0e10cSrcweir {
1716cdf0e10cSrcweir ASSERT( false,
1717cdf0e10cSrcweir "::CalcCntnt(..) - loop detected, perform attribute changes to avoid the loop" );
1718cdf0e10cSrcweir //Oszillation unterbinden.
1719cdf0e10cSrcweir SwFrmFmt& rFmt = pAnchoredObj->GetFrmFmt();
1720cdf0e10cSrcweir SwFmtSurround aAttr( rFmt.GetSurround() );
1721cdf0e10cSrcweir if( SURROUND_THROUGHT != aAttr.GetSurround() )
1722cdf0e10cSrcweir {
1723cdf0e10cSrcweir // Bei autopositionierten hilft manchmal nur
1724cdf0e10cSrcweir // noch, auf Durchlauf zu schalten
1725cdf0e10cSrcweir if ((rFmt.GetAnchor().GetAnchorId() ==
1726cdf0e10cSrcweir FLY_AT_CHAR) &&
1727cdf0e10cSrcweir (SURROUND_PARALLEL ==
1728cdf0e10cSrcweir aAttr.GetSurround()))
1729cdf0e10cSrcweir {
1730cdf0e10cSrcweir aAttr.SetSurround( SURROUND_THROUGHT );
1731cdf0e10cSrcweir }
1732cdf0e10cSrcweir else
1733cdf0e10cSrcweir {
1734cdf0e10cSrcweir aAttr.SetSurround( SURROUND_PARALLEL );
1735cdf0e10cSrcweir }
1736cdf0e10cSrcweir rFmt.LockModify();
1737cdf0e10cSrcweir rFmt.SetFmtAttr( aAttr );
1738cdf0e10cSrcweir rFmt.UnlockModify();
1739cdf0e10cSrcweir }
1740cdf0e10cSrcweir }
1741cdf0e10cSrcweir else
1742cdf0e10cSrcweir {
1743cdf0e10cSrcweir if ( pAgainObj1 == pAnchoredObj )
1744cdf0e10cSrcweir pAgainObj2 = pAnchoredObj;
1745cdf0e10cSrcweir pAgainObj1 = pAnchoredObj;
1746cdf0e10cSrcweir }
1747cdf0e10cSrcweir }
1748cdf0e10cSrcweir
1749cdf0e10cSrcweir if ( !pFrm->GetDrawObjs() )
1750cdf0e10cSrcweir break;
1751cdf0e10cSrcweir if ( pFrm->GetDrawObjs()->Count() < nCnt )
1752cdf0e10cSrcweir {
1753cdf0e10cSrcweir --i;
1754cdf0e10cSrcweir --nCnt;
1755cdf0e10cSrcweir }
1756cdf0e10cSrcweir }
1757cdf0e10cSrcweir }
1758cdf0e10cSrcweir
1759cdf0e10cSrcweir // --> OD 2004-06-11 #i28701# - restart layout process, if
1760cdf0e10cSrcweir // requested by floating screen object formatting
1761cdf0e10cSrcweir if ( bRestartLayoutProcess )
1762cdf0e10cSrcweir {
1763cdf0e10cSrcweir pFrm = pLay->ContainsAny();
1764cdf0e10cSrcweir pAgainObj1 = 0L;
1765cdf0e10cSrcweir pAgainObj2 = 0L;
1766cdf0e10cSrcweir continue;
1767cdf0e10cSrcweir }
1768cdf0e10cSrcweir
1769cdf0e10cSrcweir // OD 2004-05-17 #i28701# - format anchor frame after its objects
1770cdf0e10cSrcweir // are formatted, if the wrapping style influence has to be considered.
1771cdf0e10cSrcweir if ( pLay->GetFmt()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::CONSIDER_WRAP_ON_OBJECT_POSITION) )
1772cdf0e10cSrcweir {
1773cdf0e10cSrcweir pFrm->Calc();
1774cdf0e10cSrcweir }
1775cdf0e10cSrcweir // <--
1776cdf0e10cSrcweir
1777cdf0e10cSrcweir if ( bAgain )
1778cdf0e10cSrcweir {
1779cdf0e10cSrcweir pFrm = pLay->ContainsCntnt();
1780cdf0e10cSrcweir if ( pFrm && pFrm->IsInTab() )
1781cdf0e10cSrcweir pFrm = pFrm->FindTabFrm();
1782cdf0e10cSrcweir if( pFrm && pFrm->IsInSct() )
1783cdf0e10cSrcweir {
1784cdf0e10cSrcweir SwSectionFrm* pTmp = pFrm->FindSctFrm();
1785cdf0e10cSrcweir if( pTmp != pLay && pLay->IsAnLower( pTmp ) )
1786cdf0e10cSrcweir pFrm = pTmp;
1787cdf0e10cSrcweir }
1788cdf0e10cSrcweir
1789cdf0e10cSrcweir if ( pFrm == pLoopControlCond )
1790cdf0e10cSrcweir ++nLoopControlRuns;
1791cdf0e10cSrcweir else
1792cdf0e10cSrcweir {
1793cdf0e10cSrcweir nLoopControlRuns = 0;
1794cdf0e10cSrcweir pLoopControlCond = pFrm;
1795cdf0e10cSrcweir }
1796cdf0e10cSrcweir
1797cdf0e10cSrcweir if ( nLoopControlRuns < nLoopControlMax )
1798cdf0e10cSrcweir continue;
1799cdf0e10cSrcweir
1800cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1
1801cdf0e10cSrcweir ASSERT( false, "LoopControl in CalcCntnt" )
1802cdf0e10cSrcweir #endif
1803cdf0e10cSrcweir }
1804cdf0e10cSrcweir }
1805cdf0e10cSrcweir if ( pFrm->IsTabFrm() )
1806cdf0e10cSrcweir {
1807cdf0e10cSrcweir if ( ((SwTabFrm*)pFrm)->IsFollow() )
1808cdf0e10cSrcweir ((SwTabFrm*)pFrm)->bLockBackMove = sal_False;
1809cdf0e10cSrcweir }
1810cdf0e10cSrcweir
1811cdf0e10cSrcweir pFrm = bPrevInvalid ? pTmpPrev : pFrm->FindNext();
1812cdf0e10cSrcweir if( !bPrevInvalid && pFrm && pFrm->IsSctFrm() && pSect )
1813cdf0e10cSrcweir {
1814cdf0e10cSrcweir // Es koennen hier leere SectionFrms herumspuken
1815cdf0e10cSrcweir while( pFrm && pFrm->IsSctFrm() && !((SwSectionFrm*)pFrm)->GetSection() )
1816cdf0e10cSrcweir pFrm = pFrm->FindNext();
1817cdf0e10cSrcweir // Wenn FindNext den Follow des urspruenglichen Bereichs liefert,
1818cdf0e10cSrcweir // wollen wir mit dessen Inhalt weitermachen, solange dieser
1819cdf0e10cSrcweir // zurueckfliesst.
1820cdf0e10cSrcweir if( pFrm && pFrm->IsSctFrm() && ( pFrm == pSect->GetFollow() ||
1821cdf0e10cSrcweir ((SwSectionFrm*)pFrm)->IsAnFollow( pSect ) ) )
1822cdf0e10cSrcweir {
1823cdf0e10cSrcweir pFrm = ((SwSectionFrm*)pFrm)->ContainsAny();
1824cdf0e10cSrcweir if( pFrm )
1825cdf0e10cSrcweir pFrm->_InvalidatePos();
1826cdf0e10cSrcweir }
1827cdf0e10cSrcweir }
1828cdf0e10cSrcweir // Im pLay bleiben, Ausnahme, bei SectionFrms mit Follow wird der erste
1829cdf0e10cSrcweir // CntntFrm des Follows anformatiert, damit er die Chance erhaelt, in
1830cdf0e10cSrcweir // pLay zu landen. Solange diese Frames in pLay landen, geht's weiter.
1831cdf0e10cSrcweir } while ( pFrm &&
1832cdf0e10cSrcweir ( pLay->IsAnLower( pFrm ) ||
1833cdf0e10cSrcweir ( pSect &&
1834cdf0e10cSrcweir ( ( pSect->HasFollow() &&
1835cdf0e10cSrcweir ( pLay->IsAnLower( pLast ) ||
1836cdf0e10cSrcweir ( pLast->IsInSct() &&
1837cdf0e10cSrcweir pLast->FindSctFrm()->IsAnFollow(pSect) ) ) &&
1838cdf0e10cSrcweir pSect->GetFollow()->IsAnLower( pFrm ) ) ||
1839cdf0e10cSrcweir ( pFrm->IsInSct() &&
1840cdf0e10cSrcweir pFrm->FindSctFrm()->IsAnFollow( pSect ) ) ) ) ) );
1841cdf0e10cSrcweir if( pSect )
1842cdf0e10cSrcweir {
1843cdf0e10cSrcweir if( bCollect )
1844cdf0e10cSrcweir {
1845cdf0e10cSrcweir pLay->GetFmt()->GetDoc()->GetLayouter()->InsertEndnotes(pSect);
1846cdf0e10cSrcweir pSect->CalcFtnCntnt();
1847cdf0e10cSrcweir }
1848cdf0e10cSrcweir if( pSect->HasFollow() )
1849cdf0e10cSrcweir {
1850cdf0e10cSrcweir SwSectionFrm* pNxt = pSect->GetFollow();
1851cdf0e10cSrcweir while( pNxt && !pNxt->ContainsCntnt() )
1852cdf0e10cSrcweir pNxt = pNxt->GetFollow();
1853cdf0e10cSrcweir if( pNxt )
1854cdf0e10cSrcweir pNxt->CalcFtnCntnt();
1855cdf0e10cSrcweir }
1856cdf0e10cSrcweir if( bCollect )
1857cdf0e10cSrcweir {
1858cdf0e10cSrcweir pFrm = pLay->ContainsAny();
1859cdf0e10cSrcweir bCollect = sal_False;
1860cdf0e10cSrcweir if( pFrm )
1861cdf0e10cSrcweir continue;
1862cdf0e10cSrcweir }
1863cdf0e10cSrcweir }
1864cdf0e10cSrcweir break;
1865cdf0e10cSrcweir }
1866cdf0e10cSrcweir while( sal_True );
1867cdf0e10cSrcweir }
1868cdf0e10cSrcweir
1869cdf0e10cSrcweir /*************************************************************************
1870cdf0e10cSrcweir |*
1871cdf0e10cSrcweir |* SwFlyFrm::MakeFlyPos()
1872cdf0e10cSrcweir |*
1873cdf0e10cSrcweir |* Ersterstellung MA ??
1874cdf0e10cSrcweir |* Letzte Aenderung MA 14. Nov. 96
1875cdf0e10cSrcweir |*
1876cdf0e10cSrcweir |*************************************************************************/
1877cdf0e10cSrcweir // OD 2004-03-23 #i26791#
1878cdf0e10cSrcweir //void SwFlyFrm::MakeFlyPos()
MakeObjPos()1879cdf0e10cSrcweir void SwFlyFrm::MakeObjPos()
1880cdf0e10cSrcweir {
1881cdf0e10cSrcweir if ( !bValidPos )
1882cdf0e10cSrcweir {
1883cdf0e10cSrcweir bValidPos = sal_True;
1884cdf0e10cSrcweir
1885cdf0e10cSrcweir // OD 29.10.2003 #113049# - use new class to position object
1886cdf0e10cSrcweir GetAnchorFrm()->Calc();
1887cdf0e10cSrcweir objectpositioning::SwToLayoutAnchoredObjectPosition
1888cdf0e10cSrcweir aObjPositioning( *GetVirtDrawObj() );
1889cdf0e10cSrcweir aObjPositioning.CalcPosition();
1890cdf0e10cSrcweir
1891cdf0e10cSrcweir // --> OD 2006-10-05 #i58280#
1892cdf0e10cSrcweir // update relative position
1893cdf0e10cSrcweir SetCurrRelPos( aObjPositioning.GetRelPos() );
1894cdf0e10cSrcweir // <--
1895cdf0e10cSrcweir
1896cdf0e10cSrcweir SWRECTFN( GetAnchorFrm() );
1897cdf0e10cSrcweir aFrm.Pos( aObjPositioning.GetRelPos() );
1898cdf0e10cSrcweir aFrm.Pos() += (GetAnchorFrm()->Frm().*fnRect->fnGetPos)();
1899cdf0e10cSrcweir // --> OD 2006-09-11 #i69335#
1900cdf0e10cSrcweir InvalidateObjRectWithSpaces();
1901cdf0e10cSrcweir // <--
1902cdf0e10cSrcweir }
1903cdf0e10cSrcweir }
1904cdf0e10cSrcweir
1905cdf0e10cSrcweir /*************************************************************************
1906cdf0e10cSrcweir |*
1907cdf0e10cSrcweir |* SwFlyFrm::MakePrtArea()
1908cdf0e10cSrcweir |*
1909cdf0e10cSrcweir |* Ersterstellung MA 23. Jun. 93
1910cdf0e10cSrcweir |* Letzte Aenderung MA 23. Jun. 93
1911cdf0e10cSrcweir |*
1912cdf0e10cSrcweir |*************************************************************************/
MakePrtArea(const SwBorderAttrs & rAttrs)1913cdf0e10cSrcweir void SwFlyFrm::MakePrtArea( const SwBorderAttrs &rAttrs )
1914cdf0e10cSrcweir {
1915cdf0e10cSrcweir
1916cdf0e10cSrcweir if ( !bValidPrtArea )
1917cdf0e10cSrcweir {
1918cdf0e10cSrcweir bValidPrtArea = sal_True;
1919cdf0e10cSrcweir
1920cdf0e10cSrcweir // OD 31.07.2003 #110978# - consider vertical layout
1921cdf0e10cSrcweir SWRECTFN( this )
1922cdf0e10cSrcweir (this->*fnRect->fnSetXMargins)( rAttrs.CalcLeftLine(),
1923cdf0e10cSrcweir rAttrs.CalcRightLine() );
1924cdf0e10cSrcweir (this->*fnRect->fnSetYMargins)( rAttrs.CalcTopLine(),
1925cdf0e10cSrcweir rAttrs.CalcBottomLine() );
1926cdf0e10cSrcweir }
1927cdf0e10cSrcweir }
1928cdf0e10cSrcweir
1929cdf0e10cSrcweir /*************************************************************************
1930cdf0e10cSrcweir |*
1931cdf0e10cSrcweir |* SwFlyFrm::_Grow(), _Shrink()
1932cdf0e10cSrcweir |*
1933cdf0e10cSrcweir |* Ersterstellung MA 05. Oct. 92
1934cdf0e10cSrcweir |* Letzte Aenderung MA 05. Sep. 96
1935cdf0e10cSrcweir |*
1936cdf0e10cSrcweir |*************************************************************************/
1937cdf0e10cSrcweir
_Grow(SwTwips nDist,sal_Bool bTst)1938cdf0e10cSrcweir SwTwips SwFlyFrm::_Grow( SwTwips nDist, sal_Bool bTst )
1939cdf0e10cSrcweir {
1940cdf0e10cSrcweir SWRECTFN( this )
1941cdf0e10cSrcweir if ( Lower() && !IsColLocked() && !HasFixSize() )
1942cdf0e10cSrcweir {
1943cdf0e10cSrcweir SwTwips nSize = (Frm().*fnRect->fnGetHeight)();
1944cdf0e10cSrcweir if( nSize > 0 && nDist > ( LONG_MAX - nSize ) )
1945cdf0e10cSrcweir nDist = LONG_MAX - nSize;
1946cdf0e10cSrcweir
1947cdf0e10cSrcweir if ( nDist <= 0L )
1948cdf0e10cSrcweir return 0L;
1949cdf0e10cSrcweir
1950cdf0e10cSrcweir if ( Lower()->IsColumnFrm() )
1951cdf0e10cSrcweir { //Bei Spaltigkeit ubernimmt das Format die Kontrolle ueber
1952cdf0e10cSrcweir //das Wachstum (wg. des Ausgleichs).
1953cdf0e10cSrcweir if ( !bTst )
1954cdf0e10cSrcweir {
1955cdf0e10cSrcweir // --> OD 2004-06-09 #i28701# - unlock position of Writer fly frame
1956cdf0e10cSrcweir UnlockPosition();
1957cdf0e10cSrcweir _InvalidatePos();
1958cdf0e10cSrcweir InvalidateSize();
1959cdf0e10cSrcweir }
1960cdf0e10cSrcweir return 0L;
1961cdf0e10cSrcweir }
1962cdf0e10cSrcweir
1963cdf0e10cSrcweir if ( !bTst )
1964cdf0e10cSrcweir {
1965cdf0e10cSrcweir const SwRect aOld( GetObjRectWithSpaces() );
1966cdf0e10cSrcweir _InvalidateSize();
1967cdf0e10cSrcweir const sal_Bool bOldLock = bLocked;
1968cdf0e10cSrcweir Unlock();
1969cdf0e10cSrcweir if ( IsFlyFreeFrm() )
1970cdf0e10cSrcweir {
1971cdf0e10cSrcweir // --> OD 2004-11-12 #i37068# - no format of position here
1972cdf0e10cSrcweir // and prevent move in method <CheckClip(..)>.
1973cdf0e10cSrcweir // This is needed to prevent layout loop caused by nested
1974cdf0e10cSrcweir // Writer fly frames - inner Writer fly frames format its
1975cdf0e10cSrcweir // anchor, which grows/shrinks the outer Writer fly frame.
1976cdf0e10cSrcweir // Note: position will be invalidated below.
1977cdf0e10cSrcweir bValidPos = sal_True;
1978cdf0e10cSrcweir // --> OD 2005-10-10 #i55416#
1979cdf0e10cSrcweir // Suppress format of width for autowidth frame, because the
1980cdf0e10cSrcweir // format of the width would call <SwTxtFrm::CalcFitToContent()>
1981cdf0e10cSrcweir // for the lower frame, which initiated this grow.
1982cdf0e10cSrcweir const sal_Bool bOldFormatHeightOnly = bFormatHeightOnly;
1983cdf0e10cSrcweir const SwFmtFrmSize& rFrmSz = GetFmt()->GetFrmSize();
1984cdf0e10cSrcweir if ( rFrmSz.GetWidthSizeType() != ATT_FIX_SIZE )
1985cdf0e10cSrcweir {
1986cdf0e10cSrcweir bFormatHeightOnly = sal_True;
1987cdf0e10cSrcweir }
1988cdf0e10cSrcweir // <--
1989cdf0e10cSrcweir static_cast<SwFlyFreeFrm*>(this)->SetNoMoveOnCheckClip( true );
1990cdf0e10cSrcweir ((SwFlyFreeFrm*)this)->SwFlyFreeFrm::MakeAll();
1991cdf0e10cSrcweir static_cast<SwFlyFreeFrm*>(this)->SetNoMoveOnCheckClip( false );
1992cdf0e10cSrcweir // --> OD 2005-10-10 #i55416#
1993cdf0e10cSrcweir if ( rFrmSz.GetWidthSizeType() != ATT_FIX_SIZE )
1994cdf0e10cSrcweir {
1995cdf0e10cSrcweir bFormatHeightOnly = bOldFormatHeightOnly;
1996cdf0e10cSrcweir }
1997cdf0e10cSrcweir // <--
1998cdf0e10cSrcweir // <--
1999cdf0e10cSrcweir }
2000cdf0e10cSrcweir else
2001cdf0e10cSrcweir MakeAll();
2002cdf0e10cSrcweir _InvalidateSize();
2003cdf0e10cSrcweir InvalidatePos();
2004cdf0e10cSrcweir if ( bOldLock )
2005cdf0e10cSrcweir Lock();
2006cdf0e10cSrcweir const SwRect aNew( GetObjRectWithSpaces() );
2007cdf0e10cSrcweir if ( aOld != aNew )
2008cdf0e10cSrcweir ::Notify( this, FindPageFrm(), aOld );
2009cdf0e10cSrcweir return (aNew.*fnRect->fnGetHeight)()-(aOld.*fnRect->fnGetHeight)();
2010cdf0e10cSrcweir }
2011cdf0e10cSrcweir return nDist;
2012cdf0e10cSrcweir }
2013cdf0e10cSrcweir return 0L;
2014cdf0e10cSrcweir }
2015cdf0e10cSrcweir
_Shrink(SwTwips nDist,sal_Bool bTst)2016cdf0e10cSrcweir SwTwips SwFlyFrm::_Shrink( SwTwips nDist, sal_Bool bTst )
2017cdf0e10cSrcweir {
2018cdf0e10cSrcweir if( Lower() && !IsColLocked() && !HasFixSize() && !IsNoShrink() )
2019cdf0e10cSrcweir {
2020cdf0e10cSrcweir SWRECTFN( this )
2021cdf0e10cSrcweir SwTwips nHeight = (Frm().*fnRect->fnGetHeight)();
2022cdf0e10cSrcweir if ( nDist > nHeight )
2023cdf0e10cSrcweir nDist = nHeight;
2024cdf0e10cSrcweir
2025cdf0e10cSrcweir SwTwips nVal = nDist;
2026cdf0e10cSrcweir if ( IsMinHeight() )
2027cdf0e10cSrcweir {
2028cdf0e10cSrcweir const SwFmtFrmSize& rFmtSize = GetFmt()->GetFrmSize();
2029cdf0e10cSrcweir SwTwips nFmtHeight = bVert ? rFmtSize.GetWidth() : rFmtSize.GetHeight();
2030cdf0e10cSrcweir
2031cdf0e10cSrcweir nVal = Min( nDist, nHeight - nFmtHeight );
2032cdf0e10cSrcweir }
2033cdf0e10cSrcweir
2034cdf0e10cSrcweir if ( nVal <= 0L )
2035cdf0e10cSrcweir return 0L;
2036cdf0e10cSrcweir
2037cdf0e10cSrcweir if ( Lower()->IsColumnFrm() )
2038cdf0e10cSrcweir { //Bei Spaltigkeit ubernimmt das Format die Kontrolle ueber
2039cdf0e10cSrcweir //das Wachstum (wg. des Ausgleichs).
2040cdf0e10cSrcweir if ( !bTst )
2041cdf0e10cSrcweir {
2042cdf0e10cSrcweir SwRect aOld( GetObjRectWithSpaces() );
2043cdf0e10cSrcweir (Frm().*fnRect->fnSetHeight)( nHeight - nVal );
2044cdf0e10cSrcweir // --> OD 2006-08-16 #i68520#
2045cdf0e10cSrcweir if ( nHeight - nVal != 0 )
2046cdf0e10cSrcweir {
2047cdf0e10cSrcweir InvalidateObjRectWithSpaces();
2048cdf0e10cSrcweir }
2049cdf0e10cSrcweir // <--
2050cdf0e10cSrcweir nHeight = (Prt().*fnRect->fnGetHeight)();
2051cdf0e10cSrcweir (Prt().*fnRect->fnSetHeight)( nHeight - nVal );
2052cdf0e10cSrcweir _InvalidatePos();
2053cdf0e10cSrcweir InvalidateSize();
2054cdf0e10cSrcweir ::Notify( this, FindPageFrm(), aOld );
2055cdf0e10cSrcweir NotifyDrawObj();
2056cdf0e10cSrcweir if ( GetAnchorFrm()->IsInFly() )
2057cdf0e10cSrcweir AnchorFrm()->FindFlyFrm()->Shrink( nDist, bTst );
2058cdf0e10cSrcweir }
2059cdf0e10cSrcweir return 0L;
2060cdf0e10cSrcweir }
2061cdf0e10cSrcweir
2062cdf0e10cSrcweir if ( !bTst )
2063cdf0e10cSrcweir {
2064cdf0e10cSrcweir const SwRect aOld( GetObjRectWithSpaces() );
2065cdf0e10cSrcweir _InvalidateSize();
2066cdf0e10cSrcweir const sal_Bool bOldLocked = bLocked;
2067cdf0e10cSrcweir Unlock();
2068cdf0e10cSrcweir if ( IsFlyFreeFrm() )
2069cdf0e10cSrcweir {
2070cdf0e10cSrcweir // --> OD 2004-11-12 #i37068# - no format of position here
2071cdf0e10cSrcweir // and prevent move in method <CheckClip(..)>.
2072cdf0e10cSrcweir // This is needed to prevent layout loop caused by nested
2073cdf0e10cSrcweir // Writer fly frames - inner Writer fly frames format its
2074cdf0e10cSrcweir // anchor, which grows/shrinks the outer Writer fly frame.
2075cdf0e10cSrcweir // Note: position will be invalidated below.
2076cdf0e10cSrcweir bValidPos = sal_True;
2077cdf0e10cSrcweir // --> OD 2005-10-10 #i55416#
2078cdf0e10cSrcweir // Suppress format of width for autowidth frame, because the
2079cdf0e10cSrcweir // format of the width would call <SwTxtFrm::CalcFitToContent()>
2080cdf0e10cSrcweir // for the lower frame, which initiated this shrink.
2081cdf0e10cSrcweir const sal_Bool bOldFormatHeightOnly = bFormatHeightOnly;
2082cdf0e10cSrcweir const SwFmtFrmSize& rFrmSz = GetFmt()->GetFrmSize();
2083cdf0e10cSrcweir if ( rFrmSz.GetWidthSizeType() != ATT_FIX_SIZE )
2084cdf0e10cSrcweir {
2085cdf0e10cSrcweir bFormatHeightOnly = sal_True;
2086cdf0e10cSrcweir }
2087cdf0e10cSrcweir // <--
2088cdf0e10cSrcweir static_cast<SwFlyFreeFrm*>(this)->SetNoMoveOnCheckClip( true );
2089cdf0e10cSrcweir ((SwFlyFreeFrm*)this)->SwFlyFreeFrm::MakeAll();
2090cdf0e10cSrcweir static_cast<SwFlyFreeFrm*>(this)->SetNoMoveOnCheckClip( false );
2091cdf0e10cSrcweir // --> OD 2005-10-10 #i55416#
2092cdf0e10cSrcweir if ( rFrmSz.GetWidthSizeType() != ATT_FIX_SIZE )
2093cdf0e10cSrcweir {
2094cdf0e10cSrcweir bFormatHeightOnly = bOldFormatHeightOnly;
2095cdf0e10cSrcweir }
2096cdf0e10cSrcweir // <--
2097cdf0e10cSrcweir // <--
2098cdf0e10cSrcweir }
2099cdf0e10cSrcweir else
2100cdf0e10cSrcweir MakeAll();
2101cdf0e10cSrcweir _InvalidateSize();
2102cdf0e10cSrcweir InvalidatePos();
2103cdf0e10cSrcweir if ( bOldLocked )
2104cdf0e10cSrcweir Lock();
2105cdf0e10cSrcweir const SwRect aNew( GetObjRectWithSpaces() );
2106cdf0e10cSrcweir if ( aOld != aNew )
2107cdf0e10cSrcweir {
2108cdf0e10cSrcweir ::Notify( this, FindPageFrm(), aOld );
2109cdf0e10cSrcweir if ( GetAnchorFrm()->IsInFly() )
2110cdf0e10cSrcweir AnchorFrm()->FindFlyFrm()->Shrink( nDist, bTst );
2111cdf0e10cSrcweir }
2112cdf0e10cSrcweir return (aOld.*fnRect->fnGetHeight)() -
2113cdf0e10cSrcweir (aNew.*fnRect->fnGetHeight)();
2114cdf0e10cSrcweir }
2115cdf0e10cSrcweir return nVal;
2116cdf0e10cSrcweir }
2117cdf0e10cSrcweir return 0L;
2118cdf0e10cSrcweir }
2119cdf0e10cSrcweir
2120cdf0e10cSrcweir /*************************************************************************
2121cdf0e10cSrcweir |*
2122cdf0e10cSrcweir |* SwFlyFrm::ChgSize()
2123cdf0e10cSrcweir |*
2124cdf0e10cSrcweir |* Ersterstellung MA 05. Oct. 92
2125cdf0e10cSrcweir |* Letzte Aenderung MA 04. Sep. 96
2126cdf0e10cSrcweir |*
2127cdf0e10cSrcweir |*************************************************************************/
2128cdf0e10cSrcweir
ChgSize(const Size & aNewSize)2129cdf0e10cSrcweir Size SwFlyFrm::ChgSize( const Size& aNewSize )
2130cdf0e10cSrcweir {
2131cdf0e10cSrcweir // --> OD 2006-01-19 #i53298#
2132cdf0e10cSrcweir // If the fly frame anchored at-paragraph or at-character contains an OLE
2133cdf0e10cSrcweir // object, assure that the new size fits into the current clipping area
2134cdf0e10cSrcweir // of the fly frame
2135cdf0e10cSrcweir Size aAdjustedNewSize( aNewSize );
2136cdf0e10cSrcweir {
2137cdf0e10cSrcweir if ( dynamic_cast<SwFlyAtCntFrm*>(this) &&
2138cdf0e10cSrcweir Lower() && dynamic_cast<SwNoTxtFrm*>(Lower()) &&
2139cdf0e10cSrcweir static_cast<SwNoTxtFrm*>(Lower())->GetNode()->GetOLENode() )
2140cdf0e10cSrcweir {
2141cdf0e10cSrcweir SwRect aClipRect;
2142cdf0e10cSrcweir ::CalcClipRect( GetVirtDrawObj(), aClipRect, sal_False );
2143cdf0e10cSrcweir if ( aAdjustedNewSize.Width() > aClipRect.Width() )
2144cdf0e10cSrcweir {
2145cdf0e10cSrcweir aAdjustedNewSize.setWidth( aClipRect.Width() );
2146cdf0e10cSrcweir }
2147cdf0e10cSrcweir if ( aAdjustedNewSize.Height() > aClipRect.Height() )
2148cdf0e10cSrcweir {
2149cdf0e10cSrcweir aAdjustedNewSize.setWidth( aClipRect.Height() );
2150cdf0e10cSrcweir }
2151cdf0e10cSrcweir }
2152cdf0e10cSrcweir }
2153cdf0e10cSrcweir // <--
2154cdf0e10cSrcweir if ( aAdjustedNewSize != Frm().SSize() )
2155cdf0e10cSrcweir {
2156cdf0e10cSrcweir SwFrmFmt *pFmt = GetFmt();
2157cdf0e10cSrcweir SwFmtFrmSize aSz( pFmt->GetFrmSize() );
2158cdf0e10cSrcweir aSz.SetWidth( aAdjustedNewSize.Width() );
2159cdf0e10cSrcweir // --> OD 2006-01-19 #i53298# - no tolerance any more.
2160cdf0e10cSrcweir // If it reveals that the tolerance is still needed, then suppress a
2161cdf0e10cSrcweir // <SetAttr> call, if <aSz> equals the current <SwFmtFrmSize> attribute.
2162cdf0e10cSrcweir // if ( Abs(aAdjustedNewSize.Height() - aSz.GetHeight()) > 1 )
2163cdf0e10cSrcweir aSz.SetHeight( aAdjustedNewSize.Height() );
2164cdf0e10cSrcweir // <--
2165cdf0e10cSrcweir // uebers Doc fuers Undo!
2166cdf0e10cSrcweir pFmt->GetDoc()->SetAttr( aSz, *pFmt );
2167cdf0e10cSrcweir return aSz.GetSize();
2168cdf0e10cSrcweir }
2169cdf0e10cSrcweir else
2170cdf0e10cSrcweir return Frm().SSize();
2171cdf0e10cSrcweir }
2172cdf0e10cSrcweir
2173cdf0e10cSrcweir /*************************************************************************
2174cdf0e10cSrcweir |*
2175cdf0e10cSrcweir |* SwFlyFrm::IsLowerOf()
2176cdf0e10cSrcweir |*
2177cdf0e10cSrcweir |* Ersterstellung MA 27. Dec. 93
2178cdf0e10cSrcweir |* Letzte Aenderung MA 27. Dec. 93
2179cdf0e10cSrcweir |*
2180cdf0e10cSrcweir |*************************************************************************/
2181cdf0e10cSrcweir
IsLowerOf(const SwLayoutFrm * pUpperFrm) const2182cdf0e10cSrcweir sal_Bool SwFlyFrm::IsLowerOf( const SwLayoutFrm* pUpperFrm ) const
2183cdf0e10cSrcweir {
2184cdf0e10cSrcweir ASSERT( GetAnchorFrm(), "8-( Fly is lost in Space." );
2185cdf0e10cSrcweir const SwFrm* pFrm = GetAnchorFrm();
2186cdf0e10cSrcweir do
2187cdf0e10cSrcweir {
2188cdf0e10cSrcweir if ( pFrm == pUpperFrm )
2189cdf0e10cSrcweir return sal_True;
2190cdf0e10cSrcweir pFrm = pFrm->IsFlyFrm()
2191cdf0e10cSrcweir ? ((const SwFlyFrm*)pFrm)->GetAnchorFrm()
2192cdf0e10cSrcweir : pFrm->GetUpper();
2193cdf0e10cSrcweir } while ( pFrm );
2194cdf0e10cSrcweir return sal_False;
2195cdf0e10cSrcweir }
2196cdf0e10cSrcweir
2197cdf0e10cSrcweir /*************************************************************************
2198cdf0e10cSrcweir |*
2199cdf0e10cSrcweir |* SwFlyFrm::Cut()
2200cdf0e10cSrcweir |*
2201cdf0e10cSrcweir |* Ersterstellung MA 23. Feb. 94
2202cdf0e10cSrcweir |* Letzte Aenderung MA 23. Feb. 94
2203cdf0e10cSrcweir |*
2204cdf0e10cSrcweir |*************************************************************************/
2205cdf0e10cSrcweir
Cut()2206cdf0e10cSrcweir void SwFlyFrm::Cut()
2207cdf0e10cSrcweir {
2208cdf0e10cSrcweir }
2209cdf0e10cSrcweir
2210cdf0e10cSrcweir /*************************************************************************
2211cdf0e10cSrcweir |*
2212cdf0e10cSrcweir |* SwFrm::AppendFly(), RemoveFly()
2213cdf0e10cSrcweir |*
2214cdf0e10cSrcweir |* Ersterstellung MA 25. Aug. 92
2215cdf0e10cSrcweir |* Letzte Aenderung MA 09. Jun. 95
2216cdf0e10cSrcweir |*
2217cdf0e10cSrcweir |*************************************************************************/
2218cdf0e10cSrcweir
AppendFly(SwFlyFrm * pNew)2219cdf0e10cSrcweir void SwFrm::AppendFly( SwFlyFrm *pNew )
2220cdf0e10cSrcweir {
2221cdf0e10cSrcweir if ( !pDrawObjs )
2222cdf0e10cSrcweir pDrawObjs = new SwSortedObjs();
2223cdf0e10cSrcweir pDrawObjs->Insert( *pNew );
2224cdf0e10cSrcweir pNew->ChgAnchorFrm( this );
2225cdf0e10cSrcweir
2226cdf0e10cSrcweir SwPageFrm* pPage = FindPageFrm();
222775613651SOliver-Rainer Wittmann if ( pPage != NULL )
2228cdf0e10cSrcweir {
2229cdf0e10cSrcweir pPage->AppendFlyToPage( pNew );
2230cdf0e10cSrcweir }
2231cdf0e10cSrcweir }
2232cdf0e10cSrcweir
RemoveFly(SwFlyFrm * pToRemove)2233cdf0e10cSrcweir void SwFrm::RemoveFly( SwFlyFrm *pToRemove )
2234cdf0e10cSrcweir {
2235cdf0e10cSrcweir //Bei der Seite Abmelden - kann schon passiert sein weil die Seite
2236cdf0e10cSrcweir //bereits destruiert wurde.
2237cdf0e10cSrcweir SwPageFrm *pPage = pToRemove->FindPageFrm();
2238cdf0e10cSrcweir if ( pPage && pPage->GetSortedObjs() )
2239cdf0e10cSrcweir {
2240cdf0e10cSrcweir pPage->RemoveFlyFromPage( pToRemove );
2241cdf0e10cSrcweir }
2242cdf0e10cSrcweir // --> OD 2008-05-19 #i73201#
2243cdf0e10cSrcweir else
2244cdf0e10cSrcweir {
2245cdf0e10cSrcweir if ( pToRemove->IsAccessibleFrm() &&
2246cdf0e10cSrcweir pToRemove->GetFmt() &&
2247cdf0e10cSrcweir !pToRemove->IsFlyInCntFrm() )
2248cdf0e10cSrcweir {
2249cdf0e10cSrcweir SwRootFrm *pRootFrm = getRootFrm();
2250cdf0e10cSrcweir if( pRootFrm && pRootFrm->IsAnyShellAccessible() )
2251cdf0e10cSrcweir {
2252cdf0e10cSrcweir ViewShell *pVSh = pRootFrm->GetCurrShell();
2253cdf0e10cSrcweir if( pVSh && pVSh->Imp() )
2254cdf0e10cSrcweir {
2255cdf0e10cSrcweir pVSh->Imp()->DisposeAccessibleFrm( pToRemove );
2256cdf0e10cSrcweir }
2257cdf0e10cSrcweir }
2258cdf0e10cSrcweir }
2259cdf0e10cSrcweir }
2260cdf0e10cSrcweir // <--
2261cdf0e10cSrcweir
2262cdf0e10cSrcweir pDrawObjs->Remove( *pToRemove );
2263cdf0e10cSrcweir if ( !pDrawObjs->Count() )
2264cdf0e10cSrcweir DELETEZ( pDrawObjs );
2265cdf0e10cSrcweir
2266cdf0e10cSrcweir pToRemove->ChgAnchorFrm( 0 );
2267cdf0e10cSrcweir
2268cdf0e10cSrcweir if ( !pToRemove->IsFlyInCntFrm() && GetUpper() && IsInTab() )//MA_FLY_HEIGHT
2269cdf0e10cSrcweir GetUpper()->InvalidateSize();
2270cdf0e10cSrcweir }
2271cdf0e10cSrcweir
2272cdf0e10cSrcweir /*************************************************************************
2273cdf0e10cSrcweir |*
2274cdf0e10cSrcweir |* SwFrm::AppendDrawObj(), RemoveDrawObj()
2275cdf0e10cSrcweir |*
2276cdf0e10cSrcweir |* --> OD 2004-07-06 #i28701# - new methods
2277cdf0e10cSrcweir |*
2278cdf0e10cSrcweir |*************************************************************************/
AppendDrawObj(SwAnchoredObject & _rNewObj)2279cdf0e10cSrcweir void SwFrm::AppendDrawObj( SwAnchoredObject& _rNewObj )
2280cdf0e10cSrcweir {
2281cdf0e10cSrcweir if ( !_rNewObj.ISA(SwAnchoredDrawObject) )
2282cdf0e10cSrcweir {
2283cdf0e10cSrcweir ASSERT( false,
2284cdf0e10cSrcweir "SwFrm::AppendDrawObj(..) - anchored object of unexcepted type -> object not appended" );
2285cdf0e10cSrcweir return;
2286cdf0e10cSrcweir }
2287cdf0e10cSrcweir
2288cdf0e10cSrcweir if ( !_rNewObj.GetDrawObj()->ISA(SwDrawVirtObj) &&
2289cdf0e10cSrcweir _rNewObj.GetAnchorFrm() && _rNewObj.GetAnchorFrm() != this )
2290cdf0e10cSrcweir {
2291cdf0e10cSrcweir // perform disconnect from layout, if 'master' drawing object is appended
2292cdf0e10cSrcweir // to a new frame.
2293cdf0e10cSrcweir static_cast<SwDrawContact*>(::GetUserCall( _rNewObj.GetDrawObj() ))->
2294cdf0e10cSrcweir DisconnectFromLayout( false );
2295cdf0e10cSrcweir }
2296cdf0e10cSrcweir
2297cdf0e10cSrcweir if ( _rNewObj.GetAnchorFrm() != this )
2298cdf0e10cSrcweir {
2299cdf0e10cSrcweir if ( !pDrawObjs )
2300cdf0e10cSrcweir pDrawObjs = new SwSortedObjs();
2301cdf0e10cSrcweir pDrawObjs->Insert( _rNewObj );
2302cdf0e10cSrcweir _rNewObj.ChgAnchorFrm( this );
2303cdf0e10cSrcweir }
2304cdf0e10cSrcweir
2305cdf0e10cSrcweir // --> OD 2010-09-14 #i113730#
2306cdf0e10cSrcweir // Assure the control objects and group objects containing controls are on the control layer
2307cdf0e10cSrcweir if ( ::CheckControlLayer( _rNewObj.DrawObj() ) )
2308cdf0e10cSrcweir {
2309cdf0e10cSrcweir const IDocumentDrawModelAccess* pIDDMA = (IsFlyFrm())
2310cdf0e10cSrcweir ? static_cast<SwFlyFrm*>(this)->GetFmt()->
2311cdf0e10cSrcweir getIDocumentDrawModelAccess()
2312cdf0e10cSrcweir : GetUpper()->GetFmt()->getIDocumentDrawModelAccess();
2313cdf0e10cSrcweir const SdrLayerID aCurrentLayer(_rNewObj.DrawObj()->GetLayer());
2314cdf0e10cSrcweir const SdrLayerID aControlLayerID(pIDDMA->GetControlsId());
2315cdf0e10cSrcweir const SdrLayerID aInvisibleControlLayerID(pIDDMA->GetInvisibleControlsId());
2316cdf0e10cSrcweir
2317cdf0e10cSrcweir if(aCurrentLayer != aControlLayerID && aCurrentLayer != aInvisibleControlLayerID)
2318cdf0e10cSrcweir {
2319cdf0e10cSrcweir if ( aCurrentLayer == pIDDMA->GetInvisibleHellId() ||
2320cdf0e10cSrcweir aCurrentLayer == pIDDMA->GetInvisibleHeavenId() )
2321cdf0e10cSrcweir {
2322cdf0e10cSrcweir _rNewObj.DrawObj()->SetLayer(aInvisibleControlLayerID);
2323cdf0e10cSrcweir }
2324cdf0e10cSrcweir else
2325cdf0e10cSrcweir {
2326cdf0e10cSrcweir _rNewObj.DrawObj()->SetLayer(aControlLayerID);
2327cdf0e10cSrcweir }
2328cdf0e10cSrcweir }
2329cdf0e10cSrcweir }
2330cdf0e10cSrcweir // <--
2331cdf0e10cSrcweir
2332cdf0e10cSrcweir // no direct positioning needed, but invalidate the drawing object position
2333cdf0e10cSrcweir _rNewObj.InvalidateObjPos();
2334cdf0e10cSrcweir
2335cdf0e10cSrcweir // register at page frame
2336cdf0e10cSrcweir SwPageFrm* pPage = FindPageFrm();
2337cdf0e10cSrcweir if ( pPage )
2338cdf0e10cSrcweir {
2339cdf0e10cSrcweir pPage->AppendDrawObjToPage( _rNewObj );
2340cdf0e10cSrcweir }
2341cdf0e10cSrcweir
2342cdf0e10cSrcweir // Notify accessible layout.
2343cdf0e10cSrcweir ViewShell* pSh = getRootFrm()->GetCurrShell();
2344cdf0e10cSrcweir if( pSh )
2345cdf0e10cSrcweir {
2346cdf0e10cSrcweir SwRootFrm* pLayout = getRootFrm();
2347cdf0e10cSrcweir if( pLayout && pLayout->IsAnyShellAccessible() )
2348cdf0e10cSrcweir pSh->Imp()->AddAccessibleObj( _rNewObj.GetDrawObj() );
2349cdf0e10cSrcweir }
2350cdf0e10cSrcweir }
2351cdf0e10cSrcweir
RemoveDrawObj(SwAnchoredObject & _rToRemoveObj)2352cdf0e10cSrcweir void SwFrm::RemoveDrawObj( SwAnchoredObject& _rToRemoveObj )
2353cdf0e10cSrcweir {
2354cdf0e10cSrcweir // Notify accessible layout.
2355cdf0e10cSrcweir ViewShell* pSh = getRootFrm()->GetCurrShell();
2356cdf0e10cSrcweir if( pSh )
2357cdf0e10cSrcweir {
2358cdf0e10cSrcweir SwRootFrm* pLayout = getRootFrm();
2359cdf0e10cSrcweir if( pLayout && pLayout->IsAnyShellAccessible() )
2360cdf0e10cSrcweir pSh->Imp()->DisposeAccessibleObj( _rToRemoveObj.GetDrawObj() );
2361cdf0e10cSrcweir }
2362cdf0e10cSrcweir
2363cdf0e10cSrcweir // deregister from page frame
2364cdf0e10cSrcweir SwPageFrm* pPage = _rToRemoveObj.GetPageFrm();
2365cdf0e10cSrcweir if ( pPage && pPage->GetSortedObjs() )
2366cdf0e10cSrcweir pPage->RemoveDrawObjFromPage( _rToRemoveObj );
2367cdf0e10cSrcweir
2368cdf0e10cSrcweir pDrawObjs->Remove( _rToRemoveObj );
2369cdf0e10cSrcweir if ( !pDrawObjs->Count() )
2370cdf0e10cSrcweir DELETEZ( pDrawObjs );
2371cdf0e10cSrcweir
2372cdf0e10cSrcweir _rToRemoveObj.ChgAnchorFrm( 0 );
2373cdf0e10cSrcweir }
2374cdf0e10cSrcweir
2375cdf0e10cSrcweir /*************************************************************************
2376cdf0e10cSrcweir |*
2377cdf0e10cSrcweir |* SwFrm::InvalidateObjs()
2378cdf0e10cSrcweir |*
2379cdf0e10cSrcweir |* Ersterstellung MA 29. Nov. 96
2380cdf0e10cSrcweir |* Letzte Aenderung MA 29. Nov. 96
2381cdf0e10cSrcweir |*
2382cdf0e10cSrcweir |*************************************************************************/
2383cdf0e10cSrcweir // --> OD 2004-07-01 #i28701# - change purpose of method and adjust its name
InvalidateObjs(const bool _bInvaPosOnly,const bool _bNoInvaOfAsCharAnchoredObjs)2384cdf0e10cSrcweir void SwFrm::InvalidateObjs( const bool _bInvaPosOnly,
2385cdf0e10cSrcweir const bool _bNoInvaOfAsCharAnchoredObjs )
2386cdf0e10cSrcweir {
2387cdf0e10cSrcweir if ( GetDrawObjs() )
2388cdf0e10cSrcweir {
2389cdf0e10cSrcweir // --> OD 2004-10-08 #i26945# - determine page the frame is on,
2390cdf0e10cSrcweir // in order to check, if anchored object is registered at the same
2391cdf0e10cSrcweir // page.
2392cdf0e10cSrcweir const SwPageFrm* pPageFrm = FindPageFrm();
2393cdf0e10cSrcweir // <--
2394cdf0e10cSrcweir // --> OD 2004-07-01 #i28701# - re-factoring
2395cdf0e10cSrcweir sal_uInt32 i = 0;
2396cdf0e10cSrcweir for ( ; i < GetDrawObjs()->Count(); ++i )
2397cdf0e10cSrcweir {
2398cdf0e10cSrcweir SwAnchoredObject* pAnchoredObj = (*GetDrawObjs())[i];
2399cdf0e10cSrcweir if ( _bNoInvaOfAsCharAnchoredObjs &&
2400cdf0e10cSrcweir (pAnchoredObj->GetFrmFmt().GetAnchor().GetAnchorId()
2401cdf0e10cSrcweir == FLY_AS_CHAR) )
2402cdf0e10cSrcweir {
2403cdf0e10cSrcweir continue;
2404cdf0e10cSrcweir }
2405cdf0e10cSrcweir // --> OD 2004-10-08 #i26945# - no invalidation, if anchored object
2406cdf0e10cSrcweir // isn't registered at the same page and instead is registered at
2407cdf0e10cSrcweir // the page, where its anchor character text frame is on.
2408cdf0e10cSrcweir if ( pAnchoredObj->GetPageFrm() &&
2409cdf0e10cSrcweir pAnchoredObj->GetPageFrm() != pPageFrm )
2410cdf0e10cSrcweir {
2411cdf0e10cSrcweir SwTxtFrm* pAnchorCharFrm = pAnchoredObj->FindAnchorCharFrm();
2412cdf0e10cSrcweir if ( pAnchorCharFrm &&
2413cdf0e10cSrcweir pAnchoredObj->GetPageFrm() == pAnchorCharFrm->FindPageFrm() )
2414cdf0e10cSrcweir {
2415cdf0e10cSrcweir continue;
2416cdf0e10cSrcweir }
2417cdf0e10cSrcweir // --> OD 2004-11-24 #115759# - unlock its position, if anchored
2418cdf0e10cSrcweir // object isn't registered at the page, where its anchor
2419cdf0e10cSrcweir // character text frame is on, respectively if it has no
2420cdf0e10cSrcweir // anchor character text frame.
2421cdf0e10cSrcweir else
2422cdf0e10cSrcweir {
2423cdf0e10cSrcweir pAnchoredObj->UnlockPosition();
2424cdf0e10cSrcweir }
2425cdf0e10cSrcweir // <--
2426cdf0e10cSrcweir }
2427cdf0e10cSrcweir // <--
2428cdf0e10cSrcweir // --> OD 2005-07-18 #i51474# - reset flag, that anchored object
2429cdf0e10cSrcweir // has cleared environment, and unlock its position, if the anchored
2430cdf0e10cSrcweir // object is registered at the same page as the anchor frame is on.
2431cdf0e10cSrcweir if ( pAnchoredObj->ClearedEnvironment() &&
2432cdf0e10cSrcweir pAnchoredObj->GetPageFrm() &&
2433cdf0e10cSrcweir pAnchoredObj->GetPageFrm() == pPageFrm )
2434cdf0e10cSrcweir {
2435cdf0e10cSrcweir pAnchoredObj->UnlockPosition();
2436cdf0e10cSrcweir pAnchoredObj->SetClearedEnvironment( false );
2437cdf0e10cSrcweir }
2438cdf0e10cSrcweir // <--
2439cdf0e10cSrcweir // distinguish between writer fly frames and drawing objects
2440cdf0e10cSrcweir if ( pAnchoredObj->ISA(SwFlyFrm) )
2441cdf0e10cSrcweir {
2442cdf0e10cSrcweir SwFlyFrm* pFly = static_cast<SwFlyFrm*>(pAnchoredObj);
2443cdf0e10cSrcweir pFly->_Invalidate();
2444cdf0e10cSrcweir pFly->_InvalidatePos();
2445cdf0e10cSrcweir if ( !_bInvaPosOnly )
2446cdf0e10cSrcweir pFly->_InvalidateSize();
2447cdf0e10cSrcweir }
2448cdf0e10cSrcweir else
2449cdf0e10cSrcweir {
2450cdf0e10cSrcweir pAnchoredObj->InvalidateObjPos();
2451cdf0e10cSrcweir } // end of distinction between writer fly frames and drawing objects
2452cdf0e10cSrcweir
2453cdf0e10cSrcweir } // end of loop on objects, which are connected to the frame
2454cdf0e10cSrcweir }
2455cdf0e10cSrcweir }
2456cdf0e10cSrcweir
2457cdf0e10cSrcweir /*************************************************************************
2458cdf0e10cSrcweir |*
2459cdf0e10cSrcweir |* SwLayoutFrm::NotifyLowerObjs()
2460cdf0e10cSrcweir |*
2461cdf0e10cSrcweir |*************************************************************************/
2462cdf0e10cSrcweir // --> OD 2004-07-01 #i28701# - change purpose of method and its name
2463cdf0e10cSrcweir // --> OD 2004-10-08 #i26945# - correct check, if anchored object is a lower
2464cdf0e10cSrcweir // of the layout frame. E.g., anchor character text frame can be a follow text
2465cdf0e10cSrcweir // frame.
2466cdf0e10cSrcweir // --> OD 2005-03-11 #i44016# - add parameter <_bUnlockPosOfObjs> to
2467cdf0e10cSrcweir // force an unlockposition call for the lower objects.
NotifyLowerObjs(const bool _bUnlockPosOfObjs)2468cdf0e10cSrcweir void SwLayoutFrm::NotifyLowerObjs( const bool _bUnlockPosOfObjs )
2469cdf0e10cSrcweir {
2470cdf0e10cSrcweir // invalidate lower floating screen objects
2471cdf0e10cSrcweir SwPageFrm* pPageFrm = FindPageFrm();
2472cdf0e10cSrcweir if ( pPageFrm && pPageFrm->GetSortedObjs() )
2473cdf0e10cSrcweir {
2474cdf0e10cSrcweir SwSortedObjs& rObjs = *(pPageFrm->GetSortedObjs());
2475cdf0e10cSrcweir for ( sal_uInt32 i = 0; i < rObjs.Count(); ++i )
2476cdf0e10cSrcweir {
2477cdf0e10cSrcweir SwAnchoredObject* pObj = rObjs[i];
2478cdf0e10cSrcweir // --> OD 2004-10-08 #i26945# - check, if anchored object is a lower
2479cdf0e10cSrcweir // of the layout frame is changed to check, if its anchor frame
2480cdf0e10cSrcweir // is a lower of the layout frame.
2481cdf0e10cSrcweir // determine the anchor frame - usually it's the anchor frame,
2482cdf0e10cSrcweir // for at-character/as-character anchored objects the anchor character
2483cdf0e10cSrcweir // text frame is taken.
2484cdf0e10cSrcweir const SwFrm* pAnchorFrm = pObj->GetAnchorFrmContainingAnchPos();
2485cdf0e10cSrcweir // <--
2486cdf0e10cSrcweir if ( pObj->ISA(SwFlyFrm) )
2487cdf0e10cSrcweir {
2488cdf0e10cSrcweir SwFlyFrm* pFly = static_cast<SwFlyFrm*>(pObj);
2489cdf0e10cSrcweir
2490cdf0e10cSrcweir if ( pFly->Frm().Left() == WEIT_WECH )
2491cdf0e10cSrcweir continue;
2492cdf0e10cSrcweir
2493cdf0e10cSrcweir if ( pFly->IsAnLower( this ) )
2494cdf0e10cSrcweir continue;
2495cdf0e10cSrcweir
2496cdf0e10cSrcweir // --> OD 2004-10-08 #i26945# - use <pAnchorFrm> to check, if
2497cdf0e10cSrcweir // fly frame is lower of layout frame resp. if fly frame is
2498cdf0e10cSrcweir // at a different page registered as its anchor frame is on.
2499cdf0e10cSrcweir const bool bLow = IsAnLower( pAnchorFrm );
2500cdf0e10cSrcweir if ( bLow || pAnchorFrm->FindPageFrm() != pPageFrm )
2501cdf0e10cSrcweir // <--
2502cdf0e10cSrcweir {
2503cdf0e10cSrcweir pFly->_Invalidate( pPageFrm );
2504cdf0e10cSrcweir if ( !bLow || pFly->IsFlyAtCntFrm() )
2505cdf0e10cSrcweir {
2506cdf0e10cSrcweir // --> OD 2005-03-11 #i44016#
2507cdf0e10cSrcweir if ( _bUnlockPosOfObjs )
2508cdf0e10cSrcweir {
2509cdf0e10cSrcweir pFly->UnlockPosition();
2510cdf0e10cSrcweir }
2511cdf0e10cSrcweir // <--
2512cdf0e10cSrcweir pFly->_InvalidatePos();
2513cdf0e10cSrcweir }
2514cdf0e10cSrcweir else
2515cdf0e10cSrcweir pFly->_InvalidatePrt();
2516cdf0e10cSrcweir }
2517cdf0e10cSrcweir }
2518cdf0e10cSrcweir else
2519cdf0e10cSrcweir {
2520cdf0e10cSrcweir ASSERT( pObj->ISA(SwAnchoredDrawObject),
2521cdf0e10cSrcweir "<SwLayoutFrm::NotifyFlys() - anchored object of unexcepted type" );
2522cdf0e10cSrcweir // --> OD 2004-10-08 #i26945# - use <pAnchorFrm> to check, if
2523cdf0e10cSrcweir // fly frame is lower of layout frame resp. if fly frame is
2524cdf0e10cSrcweir // at a different page registered as its anchor frame is on.
2525cdf0e10cSrcweir if ( IsAnLower( pAnchorFrm ) ||
2526cdf0e10cSrcweir pAnchorFrm->FindPageFrm() != pPageFrm )
2527cdf0e10cSrcweir // <--
2528cdf0e10cSrcweir {
2529cdf0e10cSrcweir // --> OD 2005-03-11 #i44016#
2530cdf0e10cSrcweir if ( _bUnlockPosOfObjs )
2531cdf0e10cSrcweir {
2532cdf0e10cSrcweir pObj->UnlockPosition();
2533cdf0e10cSrcweir }
2534cdf0e10cSrcweir // <--
2535cdf0e10cSrcweir pObj->InvalidateObjPos();
2536cdf0e10cSrcweir }
2537cdf0e10cSrcweir }
2538cdf0e10cSrcweir }
2539cdf0e10cSrcweir }
2540cdf0e10cSrcweir }
2541cdf0e10cSrcweir
2542cdf0e10cSrcweir /*************************************************************************
2543cdf0e10cSrcweir |*
2544cdf0e10cSrcweir |* SwFlyFrm::NotifyDrawObj()
2545cdf0e10cSrcweir |*
2546cdf0e10cSrcweir |* Ersterstellung OK 22. Nov. 94
2547cdf0e10cSrcweir |* Letzte Aenderung MA 10. Jan. 97
2548cdf0e10cSrcweir |*
2549cdf0e10cSrcweir |*************************************************************************/
2550cdf0e10cSrcweir
NotifyDrawObj()2551cdf0e10cSrcweir void SwFlyFrm::NotifyDrawObj()
2552cdf0e10cSrcweir {
2553cdf0e10cSrcweir SwVirtFlyDrawObj* pObj = GetVirtDrawObj();
2554cdf0e10cSrcweir pObj->SetRect();
2555cdf0e10cSrcweir pObj->SetRectsDirty();
2556cdf0e10cSrcweir pObj->SetChanged();
2557cdf0e10cSrcweir pObj->BroadcastObjectChange();
2558cdf0e10cSrcweir if ( GetFmt()->GetSurround().IsContour() )
2559cdf0e10cSrcweir ClrContourCache( pObj );
2560cdf0e10cSrcweir }
2561cdf0e10cSrcweir
2562cdf0e10cSrcweir /*************************************************************************
2563cdf0e10cSrcweir |*
2564cdf0e10cSrcweir |* SwFlyFrm::CalcRel()
2565cdf0e10cSrcweir |*
2566cdf0e10cSrcweir |* Ersterstellung MA 13. Jun. 96
2567cdf0e10cSrcweir |* Letzte Aenderung MA 10. Oct. 96
2568cdf0e10cSrcweir |*
2569cdf0e10cSrcweir |*************************************************************************/
2570cdf0e10cSrcweir
CalcRel(const SwFmtFrmSize & rSz) const2571cdf0e10cSrcweir Size SwFlyFrm::CalcRel( const SwFmtFrmSize &rSz ) const
2572cdf0e10cSrcweir {
2573cdf0e10cSrcweir Size aRet( rSz.GetSize() );
2574cdf0e10cSrcweir
2575cdf0e10cSrcweir const SwFrm *pRel = IsFlyLayFrm() ? GetAnchorFrm() : GetAnchorFrm()->GetUpper();
2576cdf0e10cSrcweir if( pRel ) // LAYER_IMPL
2577cdf0e10cSrcweir {
2578cdf0e10cSrcweir long nRelWidth = LONG_MAX, nRelHeight = LONG_MAX;
2579cdf0e10cSrcweir const ViewShell *pSh = getRootFrm()->GetCurrShell();
2580cdf0e10cSrcweir if ( ( pRel->IsBodyFrm() || pRel->IsPageFrm() ) &&
2581cdf0e10cSrcweir pSh && pSh->GetViewOptions()->getBrowseMode() &&
2582cdf0e10cSrcweir pSh->VisArea().HasArea() )
2583cdf0e10cSrcweir {
2584cdf0e10cSrcweir nRelWidth = pSh->GetBrowseWidth();
2585cdf0e10cSrcweir nRelHeight = pSh->VisArea().Height();
2586cdf0e10cSrcweir Size aBorder = pSh->GetOut()->PixelToLogic( pSh->GetBrowseBorder() );
2587cdf0e10cSrcweir long nDiff = nRelWidth - pRel->Prt().Width();
2588cdf0e10cSrcweir if ( nDiff > 0 )
2589cdf0e10cSrcweir nRelWidth -= nDiff;
2590cdf0e10cSrcweir nRelHeight -= 2*aBorder.Height();
2591cdf0e10cSrcweir nDiff = nRelHeight - pRel->Prt().Height();
2592cdf0e10cSrcweir if ( nDiff > 0 )
2593cdf0e10cSrcweir nRelHeight -= nDiff;
2594cdf0e10cSrcweir }
2595cdf0e10cSrcweir nRelWidth = Min( nRelWidth, pRel->Prt().Width() );
2596cdf0e10cSrcweir nRelHeight = Min( nRelHeight, pRel->Prt().Height() );
2597cdf0e10cSrcweir if( !pRel->IsPageFrm() )
2598cdf0e10cSrcweir {
2599cdf0e10cSrcweir const SwPageFrm* pPage = FindPageFrm();
2600cdf0e10cSrcweir if( pPage )
2601cdf0e10cSrcweir {
2602cdf0e10cSrcweir nRelWidth = Min( nRelWidth, pPage->Prt().Width() );
2603cdf0e10cSrcweir nRelHeight = Min( nRelHeight, pPage->Prt().Height() );
2604cdf0e10cSrcweir }
2605cdf0e10cSrcweir }
2606cdf0e10cSrcweir
2607cdf0e10cSrcweir if ( rSz.GetWidthPercent() && rSz.GetWidthPercent() != 0xFF )
2608cdf0e10cSrcweir aRet.Width() = nRelWidth * rSz.GetWidthPercent() / 100;
2609cdf0e10cSrcweir if ( rSz.GetHeightPercent() && rSz.GetHeightPercent() != 0xFF )
2610cdf0e10cSrcweir aRet.Height() = nRelHeight * rSz.GetHeightPercent() / 100;
2611cdf0e10cSrcweir
2612cdf0e10cSrcweir if ( rSz.GetWidthPercent() == 0xFF )
2613cdf0e10cSrcweir {
2614cdf0e10cSrcweir aRet.Width() *= aRet.Height();
2615cdf0e10cSrcweir aRet.Width() /= rSz.GetHeight();
2616cdf0e10cSrcweir }
2617cdf0e10cSrcweir else if ( rSz.GetHeightPercent() == 0xFF )
2618cdf0e10cSrcweir {
2619cdf0e10cSrcweir aRet.Height() *= aRet.Width();
2620cdf0e10cSrcweir aRet.Height() /= rSz.GetWidth();
2621cdf0e10cSrcweir }
2622cdf0e10cSrcweir }
2623cdf0e10cSrcweir return aRet;
2624cdf0e10cSrcweir }
2625cdf0e10cSrcweir
2626cdf0e10cSrcweir /*************************************************************************
2627cdf0e10cSrcweir |*
2628cdf0e10cSrcweir |* SwFlyFrm::CalcAutoWidth()
2629cdf0e10cSrcweir |*
2630cdf0e10cSrcweir |*************************************************************************/
2631cdf0e10cSrcweir
lcl_CalcAutoWidth(const SwLayoutFrm & rFrm)2632cdf0e10cSrcweir SwTwips lcl_CalcAutoWidth( const SwLayoutFrm& rFrm )
2633cdf0e10cSrcweir {
2634cdf0e10cSrcweir SwTwips nRet = 0;
2635cdf0e10cSrcweir SwTwips nMin = 0;
2636cdf0e10cSrcweir const SwFrm* pFrm = rFrm.Lower();
2637cdf0e10cSrcweir
2638cdf0e10cSrcweir // No autowidth defined for columned frames
2639cdf0e10cSrcweir if ( !pFrm || pFrm->IsColumnFrm() )
2640cdf0e10cSrcweir return nRet;
2641cdf0e10cSrcweir
2642cdf0e10cSrcweir while ( pFrm )
2643cdf0e10cSrcweir {
2644cdf0e10cSrcweir if ( pFrm->IsSctFrm() )
2645cdf0e10cSrcweir {
2646cdf0e10cSrcweir nMin = lcl_CalcAutoWidth( *(SwSectionFrm*)pFrm );
2647cdf0e10cSrcweir }
2648cdf0e10cSrcweir if ( pFrm->IsTxtFrm() )
2649cdf0e10cSrcweir {
2650cdf0e10cSrcweir nMin = ((SwTxtFrm*)pFrm)->CalcFitToContent();
2651cdf0e10cSrcweir const SvxLRSpaceItem &rSpace =
2652cdf0e10cSrcweir ((SwTxtFrm*)pFrm)->GetTxtNode()->GetSwAttrSet().GetLRSpace();
265372aeb479SOliver-Rainer Wittmann if (!((SwTxtFrm*)pFrm)->IsLocked())
2654cdf0e10cSrcweir nMin += rSpace.GetRight() + rSpace.GetTxtLeft() + rSpace.GetTxtFirstLineOfst();
2655cdf0e10cSrcweir }
2656cdf0e10cSrcweir else if ( pFrm->IsTabFrm() )
2657cdf0e10cSrcweir {
2658cdf0e10cSrcweir const SwFmtFrmSize& rTblFmtSz = ((SwTabFrm*)pFrm)->GetTable()->GetFrmFmt()->GetFrmSize();
2659cdf0e10cSrcweir if ( USHRT_MAX == rTblFmtSz.GetSize().Width() ||
2660cdf0e10cSrcweir text::HoriOrientation::NONE == ((SwTabFrm*)pFrm)->GetFmt()->GetHoriOrient().GetHoriOrient() )
2661cdf0e10cSrcweir {
2662cdf0e10cSrcweir const SwPageFrm* pPage = rFrm.FindPageFrm();
2663cdf0e10cSrcweir // auto width table
2664cdf0e10cSrcweir nMin = pFrm->GetUpper()->IsVertical() ?
2665cdf0e10cSrcweir pPage->Prt().Height() :
2666cdf0e10cSrcweir pPage->Prt().Width();
2667cdf0e10cSrcweir }
2668cdf0e10cSrcweir else
2669cdf0e10cSrcweir {
2670cdf0e10cSrcweir nMin = rTblFmtSz.GetSize().Width();
2671cdf0e10cSrcweir }
2672cdf0e10cSrcweir }
2673cdf0e10cSrcweir
2674cdf0e10cSrcweir if ( nMin > nRet )
2675cdf0e10cSrcweir nRet = nMin;
2676cdf0e10cSrcweir
2677cdf0e10cSrcweir pFrm = pFrm->GetNext();
2678cdf0e10cSrcweir }
2679cdf0e10cSrcweir
2680cdf0e10cSrcweir return nRet;
2681cdf0e10cSrcweir }
2682cdf0e10cSrcweir
CalcAutoWidth() const2683cdf0e10cSrcweir SwTwips SwFlyFrm::CalcAutoWidth() const
2684cdf0e10cSrcweir {
2685cdf0e10cSrcweir return lcl_CalcAutoWidth( *this );
2686cdf0e10cSrcweir }
2687cdf0e10cSrcweir
2688cdf0e10cSrcweir /*************************************************************************
2689cdf0e10cSrcweir |*
2690cdf0e10cSrcweir |* SwFlyFrm::AddSpacesToFrm
2691cdf0e10cSrcweir |*
2692cdf0e10cSrcweir |* Ersterstellung MA 11. Nov. 96
2693cdf0e10cSrcweir |* Letzte Aenderung MA 10. Mar. 97
2694cdf0e10cSrcweir |*
2695cdf0e10cSrcweir |*************************************************************************/
2696cdf0e10cSrcweir
2697cdf0e10cSrcweir //SwRect SwFlyFrm::AddSpacesToFrm() const
2698cdf0e10cSrcweir //{
2699cdf0e10cSrcweir // SwRect aRect( Frm() );
2700cdf0e10cSrcweir // const SvxULSpaceItem &rUL = GetFmt()->GetULSpace();
2701cdf0e10cSrcweir // const SvxLRSpaceItem &rLR = GetFmt()->GetLRSpace();
2702cdf0e10cSrcweir // aRect.Left( Max( aRect.Left() - long(rLR.GetLeft()), 0L ) );
2703cdf0e10cSrcweir // aRect.SSize().Width() += rLR.GetRight();
2704cdf0e10cSrcweir // aRect.Top( Max( aRect.Top() - long(rUL.GetUpper()), 0L ) );
2705cdf0e10cSrcweir // aRect.SSize().Height()+= rUL.GetLower();
2706cdf0e10cSrcweir // return aRect;
2707cdf0e10cSrcweir //}
2708cdf0e10cSrcweir
2709cdf0e10cSrcweir /*************************************************************************
2710cdf0e10cSrcweir |*
2711cdf0e10cSrcweir |* SwFlyFrm::GetContour()
2712cdf0e10cSrcweir |*
2713cdf0e10cSrcweir |* Ersterstellung MA 09. Jan. 97
2714cdf0e10cSrcweir |* Letzte Aenderung MA 10. Jan. 97
2715cdf0e10cSrcweir |*
2716cdf0e10cSrcweir |*************************************************************************/
2717cdf0e10cSrcweir /// OD 16.04.2003 #i13147# - If called for paint and the <SwNoTxtFrm> contains
2718cdf0e10cSrcweir /// a graphic, load of intrinsic graphic has to be avoided.
GetContour(PolyPolygon & rContour,const sal_Bool _bForPaint) const2719cdf0e10cSrcweir sal_Bool SwFlyFrm::GetContour( PolyPolygon& rContour,
2720cdf0e10cSrcweir const sal_Bool _bForPaint ) const
2721cdf0e10cSrcweir {
2722cdf0e10cSrcweir sal_Bool bRet = sal_False;
2723cdf0e10cSrcweir if( GetFmt()->GetSurround().IsContour() && Lower() &&
2724cdf0e10cSrcweir Lower()->IsNoTxtFrm() )
2725cdf0e10cSrcweir {
2726cdf0e10cSrcweir SwNoTxtNode *pNd = (SwNoTxtNode*)((SwCntntFrm*)Lower())->GetNode();
2727cdf0e10cSrcweir // OD 16.04.2003 #i13147# - determine <GraphicObject> instead of <Graphic>
2728cdf0e10cSrcweir // in order to avoid load of graphic, if <SwNoTxtNode> contains a graphic
2729cdf0e10cSrcweir // node and method is called for paint.
2730cdf0e10cSrcweir const GraphicObject* pGrfObj = NULL;
2731cdf0e10cSrcweir sal_Bool bGrfObjCreated = sal_False;
2732cdf0e10cSrcweir const SwGrfNode* pGrfNd = pNd->GetGrfNode();
2733cdf0e10cSrcweir if ( pGrfNd && _bForPaint )
2734cdf0e10cSrcweir {
2735cdf0e10cSrcweir pGrfObj = &(pGrfNd->GetGrfObj());
2736cdf0e10cSrcweir }
2737cdf0e10cSrcweir else
2738cdf0e10cSrcweir {
2739cdf0e10cSrcweir pGrfObj = new GraphicObject( pNd->GetGraphic() );
2740cdf0e10cSrcweir bGrfObjCreated = sal_True;
2741cdf0e10cSrcweir }
2742cdf0e10cSrcweir ASSERT( pGrfObj, "SwFlyFrm::GetContour() - No Graphic/GraphicObject found at <SwNoTxtNode>." );
2743cdf0e10cSrcweir if ( pGrfObj && pGrfObj->GetType() != GRAPHIC_NONE )
2744cdf0e10cSrcweir {
2745cdf0e10cSrcweir if( !pNd->HasContour() )
2746cdf0e10cSrcweir {
2747cdf0e10cSrcweir // OD 16.04.2003 #i13147# - no <CreateContour> for a graphic
2748cdf0e10cSrcweir // during paint. Thus, return (value of <bRet> should be <sal_False>).
2749cdf0e10cSrcweir if ( pGrfNd && _bForPaint )
2750cdf0e10cSrcweir {
2751cdf0e10cSrcweir ASSERT( false, "SwFlyFrm::GetContour() - No Contour found at <SwNoTxtNode> during paint." );
2752cdf0e10cSrcweir return bRet;
2753cdf0e10cSrcweir }
2754cdf0e10cSrcweir pNd->CreateContour();
2755cdf0e10cSrcweir }
2756cdf0e10cSrcweir pNd->GetContour( rContour );
2757cdf0e10cSrcweir //Der Node haelt das Polygon passend zur Originalgroesse der Grafik
2758cdf0e10cSrcweir //hier muss die Skalierung einkalkuliert werden.
2759cdf0e10cSrcweir SwRect aClip;
2760cdf0e10cSrcweir SwRect aOrig;
2761cdf0e10cSrcweir Lower()->Calc();
2762cdf0e10cSrcweir ((SwNoTxtFrm*)Lower())->GetGrfArea( aClip, &aOrig, sal_False );
2763cdf0e10cSrcweir // OD 16.04.2003 #i13147# - copy method code <SvxContourDlg::ScaleContour(..)>
2764cdf0e10cSrcweir // in order to avoid that graphic has to be loaded for contour scale.
2765cdf0e10cSrcweir //SvxContourDlg::ScaleContour( rContour, aGrf, MAP_TWIP, aOrig.SSize() );
2766cdf0e10cSrcweir {
2767cdf0e10cSrcweir OutputDevice* pOutDev = Application::GetDefaultDevice();
2768cdf0e10cSrcweir const MapMode aDispMap( MAP_TWIP );
2769cdf0e10cSrcweir const MapMode aGrfMap( pGrfObj->GetPrefMapMode() );
2770cdf0e10cSrcweir const Size aGrfSize( pGrfObj->GetPrefSize() );
2771cdf0e10cSrcweir double fScaleX;
2772cdf0e10cSrcweir double fScaleY;
2773cdf0e10cSrcweir Size aOrgSize;
2774cdf0e10cSrcweir Point aNewPoint;
2775cdf0e10cSrcweir sal_Bool bPixelMap = aGrfMap.GetMapUnit() == MAP_PIXEL;
2776cdf0e10cSrcweir
2777cdf0e10cSrcweir if ( bPixelMap )
2778cdf0e10cSrcweir aOrgSize = pOutDev->PixelToLogic( aGrfSize, aDispMap );
2779cdf0e10cSrcweir else
2780cdf0e10cSrcweir aOrgSize = pOutDev->LogicToLogic( aGrfSize, aGrfMap, aDispMap );
2781cdf0e10cSrcweir
2782cdf0e10cSrcweir if ( aOrgSize.Width() && aOrgSize.Height() )
2783cdf0e10cSrcweir {
2784cdf0e10cSrcweir fScaleX = (double) aOrig.Width() / aOrgSize.Width();
2785cdf0e10cSrcweir fScaleY = (double) aOrig.Height() / aOrgSize.Height();
2786cdf0e10cSrcweir
2787cdf0e10cSrcweir for ( sal_uInt16 j = 0, nPolyCount = rContour.Count(); j < nPolyCount; j++ )
2788cdf0e10cSrcweir {
2789cdf0e10cSrcweir Polygon& rPoly = rContour[ j ];
2790cdf0e10cSrcweir
2791cdf0e10cSrcweir for ( sal_uInt16 i = 0, nCount = rPoly.GetSize(); i < nCount; i++ )
2792cdf0e10cSrcweir {
2793cdf0e10cSrcweir if ( bPixelMap )
2794cdf0e10cSrcweir aNewPoint = pOutDev->PixelToLogic( rPoly[ i ], aDispMap );
2795cdf0e10cSrcweir else
2796cdf0e10cSrcweir aNewPoint = pOutDev->LogicToLogic( rPoly[ i ], aGrfMap, aDispMap );
2797cdf0e10cSrcweir
2798cdf0e10cSrcweir rPoly[ i ] = Point( FRound( aNewPoint.X() * fScaleX ), FRound( aNewPoint.Y() * fScaleY ) );
2799cdf0e10cSrcweir }
2800cdf0e10cSrcweir }
2801cdf0e10cSrcweir }
2802cdf0e10cSrcweir }
2803cdf0e10cSrcweir // OD 17.04.2003 #i13147# - destroy created <GraphicObject>.
2804cdf0e10cSrcweir if ( bGrfObjCreated )
2805cdf0e10cSrcweir {
2806cdf0e10cSrcweir delete pGrfObj;
2807cdf0e10cSrcweir }
2808cdf0e10cSrcweir rContour.Move( aOrig.Left(), aOrig.Top() );
2809cdf0e10cSrcweir if( !aClip.Width() )
2810cdf0e10cSrcweir aClip.Width( 1 );
2811cdf0e10cSrcweir if( !aClip.Height() )
2812cdf0e10cSrcweir aClip.Height( 1 );
2813cdf0e10cSrcweir rContour.Clip( aClip.SVRect() );
2814cdf0e10cSrcweir rContour.Optimize(POLY_OPTIMIZE_CLOSE);
2815cdf0e10cSrcweir bRet = sal_True;
2816cdf0e10cSrcweir }
2817cdf0e10cSrcweir }
2818cdf0e10cSrcweir return bRet;
2819cdf0e10cSrcweir }
2820cdf0e10cSrcweir
2821cdf0e10cSrcweir // OD 2004-03-25 #i26791#
GetVirtDrawObj() const2822cdf0e10cSrcweir const SwVirtFlyDrawObj* SwFlyFrm::GetVirtDrawObj() const
2823cdf0e10cSrcweir {
2824cdf0e10cSrcweir return static_cast<const SwVirtFlyDrawObj*>(GetDrawObj());
2825cdf0e10cSrcweir }
GetVirtDrawObj()2826cdf0e10cSrcweir SwVirtFlyDrawObj* SwFlyFrm::GetVirtDrawObj()
2827cdf0e10cSrcweir {
2828cdf0e10cSrcweir return static_cast<SwVirtFlyDrawObj*>(DrawObj());
2829cdf0e10cSrcweir }
2830cdf0e10cSrcweir
2831cdf0e10cSrcweir // =============================================================================
2832cdf0e10cSrcweir // OD 2004-03-24 #i26791# - implementation of pure virtual method declared in
2833cdf0e10cSrcweir // base class <SwAnchoredObject>
2834cdf0e10cSrcweir // =============================================================================
InvalidateObjPos()2835cdf0e10cSrcweir void SwFlyFrm::InvalidateObjPos()
2836cdf0e10cSrcweir {
2837cdf0e10cSrcweir InvalidatePos();
2838cdf0e10cSrcweir // --> OD 2006-08-10 #i68520#
2839cdf0e10cSrcweir InvalidateObjRectWithSpaces();
2840cdf0e10cSrcweir // <--
2841cdf0e10cSrcweir }
2842cdf0e10cSrcweir
GetFrmFmt()2843cdf0e10cSrcweir SwFrmFmt& SwFlyFrm::GetFrmFmt()
2844cdf0e10cSrcweir {
2845cdf0e10cSrcweir ASSERT( GetFmt(),
2846cdf0e10cSrcweir "<SwFlyFrm::GetFrmFmt()> - missing frame format -> crash." );
2847cdf0e10cSrcweir return *GetFmt();
2848cdf0e10cSrcweir }
GetFrmFmt() const2849cdf0e10cSrcweir const SwFrmFmt& SwFlyFrm::GetFrmFmt() const
2850cdf0e10cSrcweir {
2851cdf0e10cSrcweir ASSERT( GetFmt(),
2852cdf0e10cSrcweir "<SwFlyFrm::GetFrmFmt()> - missing frame format -> crash." );
2853cdf0e10cSrcweir return *GetFmt();
2854cdf0e10cSrcweir }
2855cdf0e10cSrcweir
GetObjRect() const2856cdf0e10cSrcweir const SwRect SwFlyFrm::GetObjRect() const
2857cdf0e10cSrcweir {
2858cdf0e10cSrcweir return Frm();
2859cdf0e10cSrcweir }
2860cdf0e10cSrcweir
2861cdf0e10cSrcweir // --> OD 2006-10-05 #i70122#
2862cdf0e10cSrcweir // for Writer fly frames the bounding rectangle equals the object rectangles
GetObjBoundRect() const2863cdf0e10cSrcweir const SwRect SwFlyFrm::GetObjBoundRect() const
2864cdf0e10cSrcweir {
2865cdf0e10cSrcweir return GetObjRect();
2866cdf0e10cSrcweir }
2867cdf0e10cSrcweir // <--
2868cdf0e10cSrcweir
2869cdf0e10cSrcweir // --> OD 2006-08-10 #i68520#
_SetObjTop(const SwTwips _nTop)2870cdf0e10cSrcweir bool SwFlyFrm::_SetObjTop( const SwTwips _nTop )
2871cdf0e10cSrcweir {
2872cdf0e10cSrcweir const bool bChanged( Frm().Pos().Y() != _nTop );
2873cdf0e10cSrcweir
2874cdf0e10cSrcweir Frm().Pos().Y() = _nTop;
2875cdf0e10cSrcweir
2876cdf0e10cSrcweir return bChanged;
2877cdf0e10cSrcweir }
_SetObjLeft(const SwTwips _nLeft)2878cdf0e10cSrcweir bool SwFlyFrm::_SetObjLeft( const SwTwips _nLeft )
2879cdf0e10cSrcweir {
2880cdf0e10cSrcweir const bool bChanged( Frm().Pos().X() != _nLeft );
2881cdf0e10cSrcweir
2882cdf0e10cSrcweir Frm().Pos().X() = _nLeft;
2883cdf0e10cSrcweir
2884cdf0e10cSrcweir return bChanged;
2885cdf0e10cSrcweir }
2886cdf0e10cSrcweir // <--
2887cdf0e10cSrcweir
2888cdf0e10cSrcweir /** method to assure that anchored object is registered at the correct
2889cdf0e10cSrcweir page frame
2890cdf0e10cSrcweir
2891cdf0e10cSrcweir OD 2004-07-02 #i28701#
2892cdf0e10cSrcweir
2893cdf0e10cSrcweir @author OD
2894cdf0e10cSrcweir */
RegisterAtCorrectPage()2895cdf0e10cSrcweir void SwFlyFrm::RegisterAtCorrectPage()
2896cdf0e10cSrcweir {
2897cdf0e10cSrcweir // default behaviour is to do nothing.
2898cdf0e10cSrcweir }
2899cdf0e10cSrcweir
2900cdf0e10cSrcweir /** method to determine, if a <MakeAll()> on the Writer fly frame is possible
2901cdf0e10cSrcweir
2902cdf0e10cSrcweir OD 2004-05-11 #i28701#
2903cdf0e10cSrcweir
2904cdf0e10cSrcweir @author OD
2905cdf0e10cSrcweir */
IsFormatPossible() const2906cdf0e10cSrcweir bool SwFlyFrm::IsFormatPossible() const
2907cdf0e10cSrcweir {
2908cdf0e10cSrcweir return SwAnchoredObject::IsFormatPossible() &&
2909cdf0e10cSrcweir !IsLocked() && !IsColLocked();
2910cdf0e10cSrcweir }
2911cdf0e10cSrcweir
GetAnchoredObjects(std::list<SwAnchoredObject * > & aList,const SwFmt & rFmt)2912cdf0e10cSrcweir void SwFlyFrm::GetAnchoredObjects( std::list<SwAnchoredObject*>& aList, const SwFmt& rFmt )
2913cdf0e10cSrcweir {
2914cdf0e10cSrcweir SwIterator<SwFlyFrm,SwFmt> aIter( rFmt );
2915cdf0e10cSrcweir for( SwFlyFrm* pFlyFrm = aIter.First(); pFlyFrm; pFlyFrm = aIter.Next() )
2916cdf0e10cSrcweir aList.push_back( pFlyFrm );
2917cdf0e10cSrcweir }
2918cdf0e10cSrcweir
GetFmt() const2919cdf0e10cSrcweir const SwFlyFrmFmt * SwFlyFrm::GetFmt() const
2920cdf0e10cSrcweir {
2921cdf0e10cSrcweir return static_cast< const SwFlyFrmFmt * >( GetDep() );
2922cdf0e10cSrcweir }
2923cdf0e10cSrcweir
GetFmt()2924cdf0e10cSrcweir SwFlyFrmFmt * SwFlyFrm::GetFmt()
2925cdf0e10cSrcweir {
2926cdf0e10cSrcweir return static_cast< SwFlyFrmFmt * >( GetDep() );
2927cdf0e10cSrcweir }
2928cdf0e10cSrcweir
292991100364SJian Hong Cheng //Bug 120881:Modify here for Directly Page Numbering
IsPageNumberingFrm()293091100364SJian Hong Cheng sal_Bool SwFlyFrm::IsPageNumberingFrm()
293191100364SJian Hong Cheng {
293291100364SJian Hong Cheng if (!GetAnchorFrm())//Invalidate frame...
293391100364SJian Hong Cheng return false;
293491100364SJian Hong Cheng if (bInCnt || bLayout)//Incorrect anchor type...
293591100364SJian Hong Cheng return false;
293691100364SJian Hong Cheng if (!(GetAnchorFrm()->IsTxtFrm() && GetAnchorFrm()->GetUpper()
293791100364SJian Hong Cheng && (GetAnchorFrm()->GetUpper()->FindFooterOrHeader())))//Not in header or footer frame
293891100364SJian Hong Cheng return false;
293991100364SJian Hong Cheng
294091100364SJian Hong Cheng if (pNextLink || pPrevLink)//Linked...
294191100364SJian Hong Cheng return false;
294291100364SJian Hong Cheng
294391100364SJian Hong Cheng SwFrmFmt* pFmt = NULL;
2944973b5647SPavel Janík if ((pFmt = GetFmt()))
294591100364SJian Hong Cheng {
294691100364SJian Hong Cheng if (pLower && pLower->GetNext() && pFmt->GetCol().GetNumCols()>1)//Has more than 1 column...
294791100364SJian Hong Cheng return false;
294891100364SJian Hong Cheng }
294991100364SJian Hong Cheng
295091100364SJian Hong Cheng if (!pLower)//Do not has even 1 child frame?
295191100364SJian Hong Cheng return false;
295291100364SJian Hong Cheng
295391100364SJian Hong Cheng for (SwFrm* pIter = pLower;pIter!=NULL;pIter=pIter->GetNext())
295491100364SJian Hong Cheng {
295591100364SJian Hong Cheng if (pIter->IsTxtFrm() && ((SwTxtFrm*)pIter)->HasPageNumberField())
295691100364SJian Hong Cheng {
295791100364SJian Hong Cheng return true;
295891100364SJian Hong Cheng }
295991100364SJian Hong Cheng }
296091100364SJian Hong Cheng return false;
296191100364SJian Hong Cheng }
296291100364SJian Hong Cheng
296391100364SJian Hong Cheng //Bug 120881(End)
2964