xref: /aoo42x/main/sw/source/core/doc/docdraw.cxx (revision 870262e3)
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
10efeef26fSAndrew Rist  *
11efeef26fSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12efeef26fSAndrew Rist  *
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.
19efeef26fSAndrew Rist  *
20efeef26fSAndrew Rist  *************************************************************/
21efeef26fSAndrew Rist 
22efeef26fSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sw.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <hintids.hxx>
28cdf0e10cSrcweir #include <rtl/logfile.hxx>
29cdf0e10cSrcweir #include <vcl/outdev.hxx>
30cdf0e10cSrcweir #include <sfx2/printer.hxx>
31cdf0e10cSrcweir #include <editeng/eeitem.hxx>
32cdf0e10cSrcweir #include <editeng/flditem.hxx>
33cdf0e10cSrcweir #include <editeng/editeng.hxx>
34cdf0e10cSrcweir #include <svx/svdoutl.hxx>
35cdf0e10cSrcweir #include <editeng/colritem.hxx>
36cdf0e10cSrcweir #include <svx/svdpage.hxx>
37cdf0e10cSrcweir #include <svx/svdogrp.hxx>
38cdf0e10cSrcweir #include <editeng/langitem.hxx>
39cdf0e10cSrcweir #include <editeng/unolingu.hxx>
40cdf0e10cSrcweir #include <editeng/measfld.hxx>
41cdf0e10cSrcweir #include <svx/svdpool.hxx>
42cdf0e10cSrcweir #include <fmtanchr.hxx>
43cdf0e10cSrcweir #include <charatr.hxx>
44cdf0e10cSrcweir #include <frmfmt.hxx>
45cdf0e10cSrcweir #include <charfmt.hxx>
46cdf0e10cSrcweir #include <viewimp.hxx>
47cdf0e10cSrcweir #include <swhints.hxx>
48cdf0e10cSrcweir #include <doc.hxx>
49cdf0e10cSrcweir #include <IDocumentUndoRedo.hxx>
50cdf0e10cSrcweir #include <docsh.hxx>
51cdf0e10cSrcweir #include <rootfrm.hxx>	//Damit der RootDtor gerufen wird.
52cdf0e10cSrcweir #include <poolfmt.hxx>
53cdf0e10cSrcweir #include <viewsh.hxx>           // fuer MakeDrawView
54cdf0e10cSrcweir #include <drawdoc.hxx>
55cdf0e10cSrcweir #include <UndoDraw.hxx>
56cdf0e10cSrcweir #include <swundo.hxx>			// fuer die UndoIds
57cdf0e10cSrcweir #include <dcontact.hxx>
58cdf0e10cSrcweir #include <dview.hxx>
59cdf0e10cSrcweir #include <mvsave.hxx>
60cdf0e10cSrcweir #include <flyfrm.hxx>
61cdf0e10cSrcweir #include <dflyobj.hxx>
62cdf0e10cSrcweir #include <svx/svdetc.hxx>
63cdf0e10cSrcweir #include <editeng/fhgtitem.hxx>
64cdf0e10cSrcweir #include <svx/svdpagv.hxx>
65cdf0e10cSrcweir #include <dcontact.hxx>
66cdf0e10cSrcweir #include <txtfrm.hxx>
67cdf0e10cSrcweir #include <frmfmt.hxx>
68cdf0e10cSrcweir #include <editeng/frmdiritem.hxx>
69cdf0e10cSrcweir #include <fmtornt.hxx>
70cdf0e10cSrcweir #include <svx/svditer.hxx>
71cdf0e10cSrcweir #include <vector>
72cdf0e10cSrcweir #include <switerator.hxx>
73cdf0e10cSrcweir 
74cdf0e10cSrcweir using namespace ::com::sun::star;
75cdf0e10cSrcweir using namespace ::com::sun::star::linguistic2;
76cdf0e10cSrcweir 
77cdf0e10cSrcweir 
SV_IMPL_VARARR_SORT(_ZSortFlys,_ZSortFly)78cdf0e10cSrcweir SV_IMPL_VARARR_SORT( _ZSortFlys, _ZSortFly )
79cdf0e10cSrcweir 
80cdf0e10cSrcweir /*************************************************************************
81cdf0e10cSrcweir |*
82cdf0e10cSrcweir |*	SwDoc::GroupSelection / SwDoc::UnGroupSelection
83cdf0e10cSrcweir |*
84cdf0e10cSrcweir |*	Ersterstellung		JP 21.08.95
85cdf0e10cSrcweir |*	Letzte Aenderung	JP 21.08.95
86cdf0e10cSrcweir |*
87cdf0e10cSrcweir |*************************************************************************/
88cdf0e10cSrcweir // OD 2004-04-01 #i26791# - local method to determine positioning and
89cdf0e10cSrcweir // alignment attributes for a drawing object, which is newly connected to
90cdf0e10cSrcweir // the layout. Used for a newly formed group object <SwDoc::GroupSelection(..)>
91cdf0e10cSrcweir // and the members of a destroyed group <SwDoc::UnGroupSelection(..)>
92cdf0e10cSrcweir void lcl_AdjustPositioningAttr( SwDrawFrmFmt* _pFrmFmt,
93cdf0e10cSrcweir                                 const SdrObject& _rSdrObj )
94cdf0e10cSrcweir {
95cdf0e10cSrcweir     const SwContact* pContact = GetUserCall( &_rSdrObj );
96cdf0e10cSrcweir     ASSERT( pContact, "<lcl_AdjustPositioningAttr(..)> - missing contact object." );
97cdf0e10cSrcweir 
98cdf0e10cSrcweir     // determine position of new group object relative to its anchor frame position
99cdf0e10cSrcweir     SwTwips nHoriRelPos = 0;
100cdf0e10cSrcweir     SwTwips nVertRelPos = 0;
101cdf0e10cSrcweir     {
102cdf0e10cSrcweir         const SwFrm* pAnchorFrm = pContact->GetAnchoredObj( &_rSdrObj )->GetAnchorFrm();
103cdf0e10cSrcweir         ASSERT( !pAnchorFrm ||
104cdf0e10cSrcweir                 !pAnchorFrm->IsTxtFrm() ||
105cdf0e10cSrcweir                 !static_cast<const SwTxtFrm*>(pAnchorFrm)->IsFollow(),
106cdf0e10cSrcweir                 "<lcl_AdjustPositioningAttr(..)> - anchor frame is a follow. Please inform OD." );
107cdf0e10cSrcweir         bool bVert = false;
108cdf0e10cSrcweir         bool bR2L = false;
109cdf0e10cSrcweir         // --> OD 2005-05-10 #i45952# - use anchor position of
110cdf0e10cSrcweir         // anchor frame, if it exist.
111cdf0e10cSrcweir         Point aAnchorPos;
112cdf0e10cSrcweir         if ( pAnchorFrm )
113cdf0e10cSrcweir         {
114cdf0e10cSrcweir             // --> OD 2005-05-10 #i45952#
115cdf0e10cSrcweir             aAnchorPos = pAnchorFrm->GetFrmAnchorPos( ::HasWrap( &_rSdrObj ) );
116cdf0e10cSrcweir             // <--
117cdf0e10cSrcweir             bVert = pAnchorFrm->IsVertical();
118cdf0e10cSrcweir             bR2L = pAnchorFrm->IsRightToLeft();
119cdf0e10cSrcweir         }
120cdf0e10cSrcweir         else
121cdf0e10cSrcweir         {
122cdf0e10cSrcweir             // --> OD 2005-05-10 #i45952#
123cdf0e10cSrcweir             aAnchorPos = _rSdrObj.GetAnchorPos();
124cdf0e10cSrcweir             // <--
125cdf0e10cSrcweir             // If no anchor frame exist - e.g. because no layout exists - the
126cdf0e10cSrcweir             // default layout direction is taken.
127cdf0e10cSrcweir             const SvxFrameDirectionItem* pDirItem =
128cdf0e10cSrcweir                 static_cast<const SvxFrameDirectionItem*>(&(_pFrmFmt->GetAttrSet().GetPool()->GetDefaultItem( RES_FRAMEDIR )));
129cdf0e10cSrcweir             switch ( pDirItem->GetValue() )
130cdf0e10cSrcweir             {
131cdf0e10cSrcweir                 case FRMDIR_VERT_TOP_LEFT:
132cdf0e10cSrcweir                 {
133cdf0e10cSrcweir                     // vertical from left-to-right - Badaa: supported now!
134cdf0e10cSrcweir                     bVert = true;
135cdf0e10cSrcweir                     bR2L = true;
136cdf0e10cSrcweir                     //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin
137cdf0e10cSrcweir                     //ASSERT( false, "<lcl_AdjustPositioningAttr(..)> - vertical from left-to-right not supported." );
138cdf0e10cSrcweir                     //End
139cdf0e10cSrcweir                 }
140cdf0e10cSrcweir                 break;
141cdf0e10cSrcweir                 case FRMDIR_VERT_TOP_RIGHT:
142cdf0e10cSrcweir                 {
143cdf0e10cSrcweir                     // vertical from right-to-left
144cdf0e10cSrcweir                     bVert = true;
145cdf0e10cSrcweir                     bR2L = false;
146cdf0e10cSrcweir                 }
147cdf0e10cSrcweir                 break;
148cdf0e10cSrcweir                 case FRMDIR_HORI_RIGHT_TOP:
149cdf0e10cSrcweir                 {
150cdf0e10cSrcweir                     // horizontal from right-to-left
151cdf0e10cSrcweir                     bVert = false;
152cdf0e10cSrcweir                     bR2L = true;
153cdf0e10cSrcweir                 }
154cdf0e10cSrcweir                 break;
155cdf0e10cSrcweir                 case FRMDIR_HORI_LEFT_TOP:
156cdf0e10cSrcweir                 {
157cdf0e10cSrcweir                     // horizontal from left-to-right
158cdf0e10cSrcweir                     bVert = false;
159cdf0e10cSrcweir                     bR2L = false;
160cdf0e10cSrcweir                 }
161cdf0e10cSrcweir                 break;
162cdf0e10cSrcweir             }
163cdf0e10cSrcweir 
164cdf0e10cSrcweir         }
165cdf0e10cSrcweir         // use geometry of drawing object
166cdf0e10cSrcweir         const SwRect aObjRect = _rSdrObj.GetSnapRect();
167cdf0e10cSrcweir 
168cdf0e10cSrcweir         if ( bVert )
169cdf0e10cSrcweir         {
170cdf0e10cSrcweir             if ( bR2L ) {
171cdf0e10cSrcweir 			  	//FRMDIR_VERT_TOP_LEFT
172cdf0e10cSrcweir 			  	nHoriRelPos = aObjRect.Left() - aAnchorPos.X();
173cdf0e10cSrcweir 			  	nVertRelPos = aObjRect.Top() - aAnchorPos.Y();
174cdf0e10cSrcweir 			} else {
175cdf0e10cSrcweir 				//FRMDIR_VERT_TOP_RIGHT
176cdf0e10cSrcweir 				nHoriRelPos = aObjRect.Top() - aAnchorPos.Y();
177cdf0e10cSrcweir             	nVertRelPos = aAnchorPos.X() - aObjRect.Right();
178cdf0e10cSrcweir 			}
179cdf0e10cSrcweir         }
180cdf0e10cSrcweir         else if ( bR2L )
181cdf0e10cSrcweir         {
182cdf0e10cSrcweir             nHoriRelPos = aAnchorPos.X() - aObjRect.Right();
183cdf0e10cSrcweir             nVertRelPos = aObjRect.Top() - aAnchorPos.Y();
184cdf0e10cSrcweir         }
185cdf0e10cSrcweir         else
186cdf0e10cSrcweir         {
187cdf0e10cSrcweir             nHoriRelPos = aObjRect.Left() - aAnchorPos.X();
188cdf0e10cSrcweir             nVertRelPos = aObjRect.Top() - aAnchorPos.Y();
189cdf0e10cSrcweir         }
190cdf0e10cSrcweir         //End of SCMS
191cdf0e10cSrcweir     }
192cdf0e10cSrcweir 
193cdf0e10cSrcweir     _pFrmFmt->SetFmtAttr( SwFmtHoriOrient( nHoriRelPos, text::HoriOrientation::NONE, text::RelOrientation::FRAME ) );
194cdf0e10cSrcweir     _pFrmFmt->SetFmtAttr( SwFmtVertOrient( nVertRelPos, text::VertOrientation::NONE, text::RelOrientation::FRAME ) );
195cdf0e10cSrcweir     // --> OD 2005-03-11 #i44334#, #i44681# - positioning attributes already set
196cdf0e10cSrcweir     _pFrmFmt->PosAttrSet();
197cdf0e10cSrcweir     // <--
198cdf0e10cSrcweir     // --> OD 2004-10-01 #i34750# - keep current object rectangle for  drawing
199cdf0e10cSrcweir     // objects. The object rectangle is used on events from the drawing layer
200cdf0e10cSrcweir     // to adjust the positioning attributes - see <SwDrawContact::_Changed(..)>.
201cdf0e10cSrcweir     {
202cdf0e10cSrcweir         const SwAnchoredObject* pAnchoredObj = pContact->GetAnchoredObj( &_rSdrObj );
203cdf0e10cSrcweir         if ( pAnchoredObj->ISA(SwAnchoredDrawObject) )
204cdf0e10cSrcweir         {
205cdf0e10cSrcweir             const SwAnchoredDrawObject* pAnchoredDrawObj =
206cdf0e10cSrcweir                             static_cast<const SwAnchoredDrawObject*>(pAnchoredObj);
207cdf0e10cSrcweir             const SwRect aObjRect = _rSdrObj.GetSnapRect();
208cdf0e10cSrcweir             const_cast<SwAnchoredDrawObject*>(pAnchoredDrawObj)
209cdf0e10cSrcweir                                         ->SetLastObjRect( aObjRect.SVRect() );
210cdf0e10cSrcweir         }
211cdf0e10cSrcweir     }
212cdf0e10cSrcweir     // <--
213cdf0e10cSrcweir }
214cdf0e10cSrcweir 
GroupSelection(SdrView & rDrawView)215cdf0e10cSrcweir SwDrawContact* SwDoc::GroupSelection( SdrView& rDrawView )
216cdf0e10cSrcweir {
217cdf0e10cSrcweir     // OD 30.06.2003 #108784# - replace marked 'virtual' drawing objects by
218cdf0e10cSrcweir     // the corresponding 'master' drawing objects.
219cdf0e10cSrcweir     SwDrawView::ReplaceMarkedDrawVirtObjs( rDrawView );
220cdf0e10cSrcweir 
221cdf0e10cSrcweir     const SdrMarkList &rMrkList = rDrawView.GetMarkedObjectList();
222cdf0e10cSrcweir 	SwDrawFrmFmt *pFmt = 0L;
223cdf0e10cSrcweir 	SdrObject *pObj = rMrkList.GetMark( 0 )->GetMarkedSdrObj();
224cdf0e10cSrcweir 	sal_Bool bNoGroup = ( 0 == pObj->GetUpGroup() );
225cdf0e10cSrcweir     SwDrawContact* pNewContact = 0;
226cdf0e10cSrcweir 	if( bNoGroup )
227cdf0e10cSrcweir 	{
228cdf0e10cSrcweir 		//Ankerattribut aufheben.
229cdf0e10cSrcweir 		SwDrawContact *pMyContact = (SwDrawContact*)GetUserCall(pObj);
230cdf0e10cSrcweir 		const SwFmtAnchor aAnch( pMyContact->GetFmt()->GetAnchor() );
231cdf0e10cSrcweir 
232cdf0e10cSrcweir         SwUndoDrawGroup *const pUndo = (!GetIDocumentUndoRedo().DoesUndo())
233cdf0e10cSrcweir                                  ? 0
234cdf0e10cSrcweir                                  : new SwUndoDrawGroup( (sal_uInt16)rMrkList.GetMarkCount() );
235cdf0e10cSrcweir 
236cdf0e10cSrcweir         // --> OD 2005-08-16 #i53320#
237cdf0e10cSrcweir         bool bGroupMembersNotPositioned( false );
238cdf0e10cSrcweir         {
239cdf0e10cSrcweir             SwAnchoredDrawObject* pAnchoredDrawObj =
240cdf0e10cSrcweir                 static_cast<SwAnchoredDrawObject*>(pMyContact->GetAnchoredObj( pObj ));
241cdf0e10cSrcweir             bGroupMembersNotPositioned = pAnchoredDrawObj->NotYetPositioned();
242cdf0e10cSrcweir         }
243cdf0e10cSrcweir         // <--
244cdf0e10cSrcweir 		//ContactObjekte und Formate vernichten.
245cdf0e10cSrcweir 		for( sal_uInt16 i = 0; i < rMrkList.GetMarkCount(); ++i )
246cdf0e10cSrcweir 		{
247cdf0e10cSrcweir 			pObj = rMrkList.GetMark( i )->GetMarkedSdrObj();
248cdf0e10cSrcweir 			SwDrawContact *pContact = (SwDrawContact*)GetUserCall(pObj);
249cdf0e10cSrcweir 
250cdf0e10cSrcweir             // --> OD 2005-08-16 #i53320#
251cdf0e10cSrcweir #ifdef DBG_UTIL
252cdf0e10cSrcweir             SwAnchoredDrawObject* pAnchoredDrawObj =
253cdf0e10cSrcweir                 static_cast<SwAnchoredDrawObject*>(pContact->GetAnchoredObj( pObj ));
254cdf0e10cSrcweir             ASSERT( bGroupMembersNotPositioned == pAnchoredDrawObj->NotYetPositioned(),
255cdf0e10cSrcweir                     "<SwDoc::GroupSelection(..)> - group members have different positioning status!" );
256cdf0e10cSrcweir #endif
257cdf0e10cSrcweir             // <--
258cdf0e10cSrcweir 
259cdf0e10cSrcweir             pFmt = (SwDrawFrmFmt*)pContact->GetFmt();
260cdf0e10cSrcweir 			//loescht sich selbst!
261cdf0e10cSrcweir 			pContact->Changed(*pObj, SDRUSERCALL_DELETE, pObj->GetLastBoundRect() );
262cdf0e10cSrcweir 			pObj->SetUserCall( 0 );
263cdf0e10cSrcweir 
264cdf0e10cSrcweir 			if( pUndo )
265cdf0e10cSrcweir 				pUndo->AddObj( i, pFmt, pObj );
266cdf0e10cSrcweir 			else
267cdf0e10cSrcweir 				DelFrmFmt( pFmt );
268cdf0e10cSrcweir 
269cdf0e10cSrcweir             // --> OD 2005-05-10 #i45952# - re-introduce position
270cdf0e10cSrcweir             // normalization of group member objects, because its anchor position
271cdf0e10cSrcweir             // is cleared, when they are grouped.
272cdf0e10cSrcweir             Point aAnchorPos( pObj->GetAnchorPos() );
273cdf0e10cSrcweir             pObj->NbcSetAnchorPos( Point( 0, 0 ) );
274cdf0e10cSrcweir             pObj->NbcMove( Size( aAnchorPos.X(), aAnchorPos.Y() ) );
275cdf0e10cSrcweir             // <--
276cdf0e10cSrcweir         }
277cdf0e10cSrcweir 
278cdf0e10cSrcweir 		pFmt = MakeDrawFrmFmt( String::CreateFromAscii(
279cdf0e10cSrcweir 								RTL_CONSTASCII_STRINGPARAM( "DrawObject" )),
280cdf0e10cSrcweir 								GetDfltFrmFmt() );
281cdf0e10cSrcweir         pFmt->SetFmtAttr( aAnch );
282cdf0e10cSrcweir         // --> OD 2004-10-25 #i36010# - set layout direction of the position
283cdf0e10cSrcweir         pFmt->SetPositionLayoutDir(
284cdf0e10cSrcweir             text::PositionLayoutDir::PositionInLayoutDirOfAnchor );
285cdf0e10cSrcweir         // <--
286cdf0e10cSrcweir 
287cdf0e10cSrcweir         rDrawView.GroupMarked();
288cdf0e10cSrcweir         ASSERT( rMrkList.GetMarkCount() == 1, "GroupMarked more or none groups." );
289cdf0e10cSrcweir 
290cdf0e10cSrcweir         SdrObject* pNewGroupObj = rMrkList.GetMark( 0 )->GetMarkedSdrObj();
291cdf0e10cSrcweir         pNewContact = new SwDrawContact( pFmt, pNewGroupObj );
292cdf0e10cSrcweir         // --> OD 2004-11-22 #i35635#
293cdf0e10cSrcweir         pNewContact->MoveObjToVisibleLayer( pNewGroupObj );
294cdf0e10cSrcweir         // <--
295cdf0e10cSrcweir         pNewContact->ConnectToLayout();
296cdf0e10cSrcweir         // --> OD 2005-08-16 #i53320# - No adjustment of the positioning and
297cdf0e10cSrcweir         // alignment attributes, if group members aren't positioned yet.
298cdf0e10cSrcweir         if ( !bGroupMembersNotPositioned )
299cdf0e10cSrcweir         {
300cdf0e10cSrcweir             // OD 2004-04-01 #i26791# - Adjust positioning and alignment attributes.
301cdf0e10cSrcweir             lcl_AdjustPositioningAttr( pFmt, *pNewGroupObj );
302cdf0e10cSrcweir         }
303cdf0e10cSrcweir         // <--
304cdf0e10cSrcweir 
305cdf0e10cSrcweir         if( pUndo )
306cdf0e10cSrcweir 		{
307cdf0e10cSrcweir 			pUndo->SetGroupFmt( pFmt );
308cdf0e10cSrcweir             GetIDocumentUndoRedo().AppendUndo( pUndo );
309cdf0e10cSrcweir         }
310cdf0e10cSrcweir     }
311cdf0e10cSrcweir     else
312cdf0e10cSrcweir     {
313cdf0e10cSrcweir         if (GetIDocumentUndoRedo().DoesUndo())
314cdf0e10cSrcweir         {
315cdf0e10cSrcweir             GetIDocumentUndoRedo().ClearRedo();
316cdf0e10cSrcweir         }
317cdf0e10cSrcweir 
318cdf0e10cSrcweir         rDrawView.GroupMarked();
319cdf0e10cSrcweir         ASSERT( rMrkList.GetMarkCount() == 1, "GroupMarked more or none groups." );
320cdf0e10cSrcweir     }
321cdf0e10cSrcweir 
322cdf0e10cSrcweir 	return pNewContact;
323cdf0e10cSrcweir }
324cdf0e10cSrcweir 
325cdf0e10cSrcweir 
UnGroupSelection(SdrView & rDrawView)326cdf0e10cSrcweir void SwDoc::UnGroupSelection( SdrView& rDrawView )
327cdf0e10cSrcweir {
328cdf0e10cSrcweir     bool const bUndo = GetIDocumentUndoRedo().DoesUndo();
329cdf0e10cSrcweir 	if( bUndo )
330cdf0e10cSrcweir     {
331cdf0e10cSrcweir         GetIDocumentUndoRedo().ClearRedo();
332cdf0e10cSrcweir     }
333cdf0e10cSrcweir 
334cdf0e10cSrcweir     // OD 30.06.2003 #108784# - replace marked 'virtual' drawing objects by
335cdf0e10cSrcweir     // the corresponding 'master' drawing objects.
336cdf0e10cSrcweir     SwDrawView::ReplaceMarkedDrawVirtObjs( rDrawView );
337cdf0e10cSrcweir 
338cdf0e10cSrcweir     const SdrMarkList &rMrkList = rDrawView.GetMarkedObjectList();
339cdf0e10cSrcweir     // --> OD 2006-11-01 #130889#
340cdf0e10cSrcweir     std::vector< std::pair< SwDrawFrmFmt*, SdrObject* > >* pFmtsAndObjs( 0L );
341cdf0e10cSrcweir     const sal_uInt32 nMarkCount( rMrkList.GetMarkCount() );
342cdf0e10cSrcweir     // <--
343cdf0e10cSrcweir     if ( nMarkCount )
344cdf0e10cSrcweir 	{
345cdf0e10cSrcweir         // --> OD 2006-11-01 #130889#
346cdf0e10cSrcweir         pFmtsAndObjs = new std::vector< std::pair< SwDrawFrmFmt*, SdrObject* > >[nMarkCount];
347cdf0e10cSrcweir         // <--
348cdf0e10cSrcweir 		SdrObject *pMyObj = rMrkList.GetMark( 0 )->GetMarkedSdrObj();
349cdf0e10cSrcweir 		if( !pMyObj->GetUpGroup() )
350cdf0e10cSrcweir 		{
351cdf0e10cSrcweir 			String sDrwFmtNm( String::CreateFromAscii(
352cdf0e10cSrcweir 								RTL_CONSTASCII_STRINGPARAM("DrawObject" )));
353cdf0e10cSrcweir             for ( sal_uInt16 i = 0; i < nMarkCount; ++i )
354cdf0e10cSrcweir 			{
355cdf0e10cSrcweir 				SdrObject *pObj = rMrkList.GetMark( i )->GetMarkedSdrObj();
356cdf0e10cSrcweir 				if ( pObj->IsA( TYPE(SdrObjGroup) ) )
357cdf0e10cSrcweir 				{
358cdf0e10cSrcweir 					SwDrawContact *pContact = (SwDrawContact*)GetUserCall(pObj);
359cdf0e10cSrcweir 					SwFmtAnchor aAnch( pContact->GetFmt()->GetAnchor() );
360cdf0e10cSrcweir 					SdrObjList *pLst = ((SdrObjGroup*)pObj)->GetSubList();
361cdf0e10cSrcweir 
362cdf0e10cSrcweir 					SwUndoDrawUnGroup* pUndo = 0;
363cdf0e10cSrcweir 					if( bUndo )
364cdf0e10cSrcweir 					{
365cdf0e10cSrcweir 						pUndo = new SwUndoDrawUnGroup( (SdrObjGroup*)pObj );
366cdf0e10cSrcweir                         GetIDocumentUndoRedo().AppendUndo(pUndo);
367cdf0e10cSrcweir                     }
368cdf0e10cSrcweir 
369cdf0e10cSrcweir 					for ( sal_uInt16 i2 = 0; i2 < pLst->GetObjCount(); ++i2 )
370cdf0e10cSrcweir 					{
371cdf0e10cSrcweir                         SdrObject* pSubObj = pLst->GetObj( i2 );
372cdf0e10cSrcweir 						SwDrawFrmFmt *pFmt = MakeDrawFrmFmt( sDrwFmtNm,
373cdf0e10cSrcweir 															GetDfltFrmFmt() );
374cdf0e10cSrcweir                         pFmt->SetFmtAttr( aAnch );
375cdf0e10cSrcweir                         // --> OD 2004-10-25 #i36010# - set layout direction of the position
376cdf0e10cSrcweir                         pFmt->SetPositionLayoutDir(
377cdf0e10cSrcweir                             text::PositionLayoutDir::PositionInLayoutDirOfAnchor );
378cdf0e10cSrcweir                         // <--
379cdf0e10cSrcweir                         // --> OD 2006-11-01 #130889#
380cdf0e10cSrcweir                         // creation of <SwDrawContact> instances for the group
381cdf0e10cSrcweir                         // members and its connection to the Writer layout is
382cdf0e10cSrcweir                         // done after intrinsic ungrouping.
383cdf0e10cSrcweir //                        SwDrawContact* pContact = new SwDrawContact( pFmt, pSubObj );
384cdf0e10cSrcweir //                        // --> OD 2004-11-22 #i35635#
385cdf0e10cSrcweir //                        pContact->MoveObjToVisibleLayer( pSubObj );
386cdf0e10cSrcweir //                        // <--
387cdf0e10cSrcweir //                        pContact->ConnectToLayout();
388cdf0e10cSrcweir //                        // OD 2004-04-07 #i26791# - Adjust positioning and
389cdf0e10cSrcweir //                        // alignment attributes.
390cdf0e10cSrcweir //                        lcl_AdjustPositioningAttr( pFmt, *pSubObj );
391cdf0e10cSrcweir                         pFmtsAndObjs[i].push_back( std::pair< SwDrawFrmFmt*, SdrObject* >( pFmt, pSubObj ) );
392cdf0e10cSrcweir                         // <--
393cdf0e10cSrcweir 
394cdf0e10cSrcweir 						if( bUndo )
395cdf0e10cSrcweir 							pUndo->AddObj( i2, pFmt );
396cdf0e10cSrcweir 					}
397cdf0e10cSrcweir 				}
398cdf0e10cSrcweir 			}
399cdf0e10cSrcweir 		}
400cdf0e10cSrcweir 	}
401cdf0e10cSrcweir 	rDrawView.UnGroupMarked();
402cdf0e10cSrcweir     // --> OD 2006-11-01 #130889#
403cdf0e10cSrcweir     // creation of <SwDrawContact> instances for the former group members and
404cdf0e10cSrcweir     // its connection to the Writer layout.
405cdf0e10cSrcweir     for ( sal_uInt32 i = 0; i < nMarkCount; ++i )
406cdf0e10cSrcweir     {
407cdf0e10cSrcweir         SwUndoDrawUnGroupConnectToLayout* pUndo = 0;
408cdf0e10cSrcweir         if( bUndo )
409cdf0e10cSrcweir         {
410cdf0e10cSrcweir             pUndo = new SwUndoDrawUnGroupConnectToLayout();
411cdf0e10cSrcweir             GetIDocumentUndoRedo().AppendUndo(pUndo);
412cdf0e10cSrcweir         }
413cdf0e10cSrcweir 
414cdf0e10cSrcweir         while ( pFmtsAndObjs[i].size() > 0 )
415cdf0e10cSrcweir         {
416cdf0e10cSrcweir             SwDrawFrmFmt* pFmt( pFmtsAndObjs[i].back().first );
417cdf0e10cSrcweir             SdrObject* pObj( pFmtsAndObjs[i].back().second );
418cdf0e10cSrcweir             pFmtsAndObjs[i].pop_back();
419cdf0e10cSrcweir 
420cdf0e10cSrcweir             SwDrawContact* pContact = new SwDrawContact( pFmt, pObj );
421cdf0e10cSrcweir             pContact->MoveObjToVisibleLayer( pObj );
422cdf0e10cSrcweir             pContact->ConnectToLayout();
423cdf0e10cSrcweir             lcl_AdjustPositioningAttr( pFmt, *pObj );
424cdf0e10cSrcweir 
425cdf0e10cSrcweir             if ( bUndo )
426cdf0e10cSrcweir             {
427cdf0e10cSrcweir                 pUndo->AddFmtAndObj( pFmt, pObj );
428cdf0e10cSrcweir             }
429cdf0e10cSrcweir         }
430cdf0e10cSrcweir     }
431cdf0e10cSrcweir     delete [] pFmtsAndObjs;
432cdf0e10cSrcweir     // <--
433cdf0e10cSrcweir }
434cdf0e10cSrcweir 
435cdf0e10cSrcweir /*************************************************************************
436cdf0e10cSrcweir |*
437cdf0e10cSrcweir |*	SwDoc::DeleteSelection()
438cdf0e10cSrcweir |*
439cdf0e10cSrcweir |*	Ersterstellung		MA 14. Nov. 95
440cdf0e10cSrcweir |*	Letzte Aenderung	MA 14. Nov. 95
441cdf0e10cSrcweir |*
442cdf0e10cSrcweir |*************************************************************************/
443cdf0e10cSrcweir 
DeleteSelection(SwDrawView & rDrawView)444cdf0e10cSrcweir sal_Bool SwDoc::DeleteSelection( SwDrawView& rDrawView )
445cdf0e10cSrcweir {
446cdf0e10cSrcweir 	sal_Bool bCallBase = sal_False;
447cdf0e10cSrcweir 	const SdrMarkList &rMrkList = rDrawView.GetMarkedObjectList();
448cdf0e10cSrcweir 	if( rMrkList.GetMarkCount() )
449cdf0e10cSrcweir 	{
450cdf0e10cSrcweir         GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL);
451cdf0e10cSrcweir 		sal_uInt16 i;
452cdf0e10cSrcweir 		sal_Bool bDelMarked = sal_True;
453cdf0e10cSrcweir 
454cdf0e10cSrcweir 		if( 1 == rMrkList.GetMarkCount() )
455cdf0e10cSrcweir 		{
456cdf0e10cSrcweir 			SdrObject *pObj = rMrkList.GetMark( 0 )->GetMarkedSdrObj();
457cdf0e10cSrcweir 			if( pObj->ISA(SwVirtFlyDrawObj) )
458cdf0e10cSrcweir 			{
459cdf0e10cSrcweir 				SwFlyFrmFmt* pFrmFmt = (SwFlyFrmFmt*)
460cdf0e10cSrcweir 					((SwVirtFlyDrawObj*)pObj)->GetFlyFrm()->GetFmt();
461cdf0e10cSrcweir 				if( pFrmFmt )
462cdf0e10cSrcweir 				{
463cdf0e10cSrcweir 					DelLayoutFmt( pFrmFmt );
464cdf0e10cSrcweir 					bDelMarked = sal_False;
465cdf0e10cSrcweir 				}
466cdf0e10cSrcweir 			}
467cdf0e10cSrcweir 		}
468cdf0e10cSrcweir 
469cdf0e10cSrcweir 		for( i = 0; i < rMrkList.GetMarkCount(); ++i )
470cdf0e10cSrcweir 		{
471cdf0e10cSrcweir 			SdrObject *pObj = rMrkList.GetMark( i )->GetMarkedSdrObj();
472cdf0e10cSrcweir 			if( !pObj->ISA(SwVirtFlyDrawObj) )
473cdf0e10cSrcweir 			{
474cdf0e10cSrcweir 				SwDrawContact *pC = (SwDrawContact*)GetUserCall(pObj);
475cdf0e10cSrcweir 				SwDrawFrmFmt *pFrmFmt = (SwDrawFrmFmt*)pC->GetFmt();
476cdf0e10cSrcweir 				if( pFrmFmt &&
477cdf0e10cSrcweir                     FLY_AS_CHAR == pFrmFmt->GetAnchor().GetAnchorId() )
478cdf0e10cSrcweir 				{
479cdf0e10cSrcweir 					rDrawView.MarkObj( pObj, rDrawView.Imp().GetPageView(), sal_True );
480cdf0e10cSrcweir 					--i;
481cdf0e10cSrcweir 					DelLayoutFmt( pFrmFmt );
482cdf0e10cSrcweir 				}
483cdf0e10cSrcweir 			}
484cdf0e10cSrcweir 		}
485cdf0e10cSrcweir 
486cdf0e10cSrcweir 		if( rMrkList.GetMarkCount() && bDelMarked )
487cdf0e10cSrcweir 		{
488cdf0e10cSrcweir 			SdrObject *pObj = rMrkList.GetMark( 0 )->GetMarkedSdrObj();
489cdf0e10cSrcweir 			if( !pObj->GetUpGroup() )
490cdf0e10cSrcweir 			{
491cdf0e10cSrcweir                 SwUndoDrawDelete *const pUndo =
492cdf0e10cSrcweir                     (!GetIDocumentUndoRedo().DoesUndo())
493cdf0e10cSrcweir                         ? 0
494cdf0e10cSrcweir 							: new SwUndoDrawDelete(	(sal_uInt16)rMrkList.GetMarkCount() );
495cdf0e10cSrcweir 
496cdf0e10cSrcweir                 //ContactObjekte vernichten, Formate sicherstellen.
497cdf0e10cSrcweir 				for( i = 0; i < rMrkList.GetMarkCount(); ++i )
498cdf0e10cSrcweir 				{
499cdf0e10cSrcweir                     const SdrMark& rMark = *rMrkList.GetMark( i );
500cdf0e10cSrcweir 					pObj = rMark.GetMarkedSdrObj();
501cdf0e10cSrcweir 					SwDrawContact *pContact = (SwDrawContact*)pObj->GetUserCall();
502cdf0e10cSrcweir 					if( pContact ) // natuerlich nicht bei gruppierten Objekten
503cdf0e10cSrcweir 					{
504cdf0e10cSrcweir 						SwDrawFrmFmt *pFmt = (SwDrawFrmFmt*)pContact->GetFmt();
505cdf0e10cSrcweir                         // OD 18.06.2003 #108784# - before delete of selection
506cdf0e10cSrcweir                         // is performed, marked <SwDrawVirtObj>-objects have to
507cdf0e10cSrcweir                         // be replaced by its reference objects.
508cdf0e10cSrcweir                         // Thus, assert, if a <SwDrawVirt>-object is found in the mark list.
509cdf0e10cSrcweir                         if ( pObj->ISA(SwDrawVirtObj) )
510cdf0e10cSrcweir                         {
511cdf0e10cSrcweir                             ASSERT( false,
512cdf0e10cSrcweir                                     "<SwDrawVirtObj> is still marked for delete. application will crash!" );
513cdf0e10cSrcweir                         }
514cdf0e10cSrcweir                         //loescht sich selbst!
515cdf0e10cSrcweir                         pContact->Changed(*pObj, SDRUSERCALL_DELETE, pObj->GetLastBoundRect() );
516cdf0e10cSrcweir                         pObj->SetUserCall( 0 );
517cdf0e10cSrcweir 
518cdf0e10cSrcweir 						if( pUndo )
519cdf0e10cSrcweir 							pUndo->AddObj( i, pFmt, rMark );
520cdf0e10cSrcweir 						else
521cdf0e10cSrcweir 							DelFrmFmt( pFmt );
522cdf0e10cSrcweir 					}
523cdf0e10cSrcweir 				}
524cdf0e10cSrcweir 
525cdf0e10cSrcweir 				if( pUndo )
526cdf0e10cSrcweir                 {
527cdf0e10cSrcweir                     GetIDocumentUndoRedo().AppendUndo( pUndo );
528cdf0e10cSrcweir                 }
529cdf0e10cSrcweir             }
530cdf0e10cSrcweir 			bCallBase = sal_True;
531cdf0e10cSrcweir 		}
532cdf0e10cSrcweir 		SetModified();
533cdf0e10cSrcweir 
534cdf0e10cSrcweir         GetIDocumentUndoRedo().EndUndo(UNDO_EMPTY, NULL);
535cdf0e10cSrcweir     }
536cdf0e10cSrcweir 
537cdf0e10cSrcweir 	return bCallBase;
538cdf0e10cSrcweir }
539cdf0e10cSrcweir 
540cdf0e10cSrcweir /*************************************************************************
541cdf0e10cSrcweir |*
542cdf0e10cSrcweir |*	SwDoc::DeleteSelection()
543cdf0e10cSrcweir |*
544cdf0e10cSrcweir |*	Ersterstellung		JP 11.01.96
545cdf0e10cSrcweir |*	Letzte Aenderung	JP 11.01.96
546cdf0e10cSrcweir |*
547cdf0e10cSrcweir |*************************************************************************/
548cdf0e10cSrcweir 
_ZSortFly(const SwFrmFmt * pFrmFmt,const SwFmtAnchor * pFlyAn,sal_uInt32 nArrOrdNum)549cdf0e10cSrcweir _ZSortFly::_ZSortFly( const SwFrmFmt* pFrmFmt, const SwFmtAnchor* pFlyAn,
550cdf0e10cSrcweir 					  sal_uInt32 nArrOrdNum )
551cdf0e10cSrcweir 	: pFmt( pFrmFmt ), pAnchor( pFlyAn ), nOrdNum( nArrOrdNum )
552cdf0e10cSrcweir {
553cdf0e10cSrcweir 	// #i11176#
554cdf0e10cSrcweir 	// This also needs to work when no layout exists. Thus, for
555cdf0e10cSrcweir 	// FlyFrames an alternative method is used now in that case.
556cdf0e10cSrcweir 	if( RES_FLYFRMFMT == pFmt->Which() )
557cdf0e10cSrcweir 	{
558cdf0e10cSrcweir         if( pFmt->getIDocumentLayoutAccess()->GetCurrentViewShell() )	//swmod 071107//swmod 071225
559cdf0e10cSrcweir 		{
560cdf0e10cSrcweir 			// Schauen, ob es ein SdrObject dafuer gibt
561cdf0e10cSrcweir             SwFlyFrm* pFly = SwIterator<SwFlyFrm,SwFmt>::FirstElement( *pFrmFmt );
562cdf0e10cSrcweir 			if( pFly )
563cdf0e10cSrcweir 				nOrdNum = pFly->GetVirtDrawObj()->GetOrdNum();
564cdf0e10cSrcweir 		}
565cdf0e10cSrcweir 		else
566cdf0e10cSrcweir 		{
567cdf0e10cSrcweir 			// Schauen, ob es ein SdrObject dafuer gibt
568cdf0e10cSrcweir             SwFlyDrawContact* pContact = SwIterator<SwFlyDrawContact,SwFmt>::FirstElement( *pFrmFmt );
569cdf0e10cSrcweir 			if( pContact )
570cdf0e10cSrcweir 				nOrdNum = pContact->GetMaster()->GetOrdNum();
571cdf0e10cSrcweir 		}
572cdf0e10cSrcweir 	}
573cdf0e10cSrcweir 	else if( RES_DRAWFRMFMT == pFmt->Which() )
574cdf0e10cSrcweir 	{
575cdf0e10cSrcweir 		// Schauen, ob es ein SdrObject dafuer gibt
576cdf0e10cSrcweir             SwDrawContact* pContact = SwIterator<SwDrawContact,SwFmt>::FirstElement( *pFrmFmt );
577cdf0e10cSrcweir 			if( pContact )
578cdf0e10cSrcweir 				nOrdNum = pContact->GetMaster()->GetOrdNum();
579cdf0e10cSrcweir 	}
580cdf0e10cSrcweir 	else {
581*870262e3SDon Lewis 		ASSERT( sal_False, "what is that format?" );
582cdf0e10cSrcweir     }
583cdf0e10cSrcweir }
584cdf0e10cSrcweir 
585cdf0e10cSrcweir /*************************************************************************/
586cdf0e10cSrcweir // Wird auch vom Sw3-Reader gerufen, wenn ein Fehler beim Einlesen
587cdf0e10cSrcweir // des Drawing Layers auftrat. In diesem Fall wird der Layer komplett
588cdf0e10cSrcweir // neu aufgebaut.
589cdf0e10cSrcweir 
590cdf0e10cSrcweir // #75371#
591cdf0e10cSrcweir #include <svx/sxenditm.hxx>
592cdf0e10cSrcweir 
InitDrawModel()593cdf0e10cSrcweir void SwDoc::InitDrawModel()
594cdf0e10cSrcweir {
595cdf0e10cSrcweir 	RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722",  "SwDoc::InitDrawModel" );
596cdf0e10cSrcweir 
597cdf0e10cSrcweir 	//!!Achtung im sw3-Reader (sw3imp.cxx) gibt es aehnlichen Code, der
598cdf0e10cSrcweir 	//mitgepfelgt werden muss.
599cdf0e10cSrcweir 	if ( pDrawModel )
600cdf0e10cSrcweir 		ReleaseDrawModel();
601cdf0e10cSrcweir 
602cdf0e10cSrcweir     // SJ: #95129# set FontHeight pool defaults without changing static SdrEngineDefaults
603cdf0e10cSrcweir  	GetAttrPool().SetPoolDefaultItem(SvxFontHeightItem( 240, 100, EE_CHAR_FONTHEIGHT ));
604cdf0e10cSrcweir 
605cdf0e10cSrcweir 	RTL_LOGFILE_CONTEXT_TRACE( aLog, "before create DrawDocument" );
606cdf0e10cSrcweir 	//Das SdrModel gehoert dem Dokument, wir haben immer zwei Layer und eine
607cdf0e10cSrcweir 	//Seite.
60826ea3662SArmin Le Grand 	pDrawModel = new SwDrawModel( this );
609cdf0e10cSrcweir 
610cdf0e10cSrcweir     pDrawModel->EnableUndo( GetIDocumentUndoRedo().DoesUndo() );
611cdf0e10cSrcweir 
612cdf0e10cSrcweir 	String sLayerNm;
613cdf0e10cSrcweir 	sLayerNm.AssignAscii(RTL_CONSTASCII_STRINGPARAM("Hell" ));
614cdf0e10cSrcweir 	nHell	= pDrawModel->GetLayerAdmin().NewLayer( sLayerNm )->GetID();
615cdf0e10cSrcweir 
616cdf0e10cSrcweir 	sLayerNm.AssignAscii(RTL_CONSTASCII_STRINGPARAM("Heaven" ));
617cdf0e10cSrcweir 	nHeaven	= pDrawModel->GetLayerAdmin().NewLayer( sLayerNm )->GetID();
618cdf0e10cSrcweir 
619cdf0e10cSrcweir 	sLayerNm.AssignAscii(RTL_CONSTASCII_STRINGPARAM("Controls" ));
620cdf0e10cSrcweir 	nControls = pDrawModel->GetLayerAdmin().NewLayer( sLayerNm )->GetID();
621cdf0e10cSrcweir 
622cdf0e10cSrcweir     // OD 25.06.2003 #108784# - add invisible layers corresponding to the
623cdf0e10cSrcweir     // visible ones.
624cdf0e10cSrcweir     {
625cdf0e10cSrcweir         sLayerNm.AssignAscii(RTL_CONSTASCII_STRINGPARAM("InvisibleHell" ));
626cdf0e10cSrcweir         nInvisibleHell   = pDrawModel->GetLayerAdmin().NewLayer( sLayerNm )->GetID();
627cdf0e10cSrcweir 
628cdf0e10cSrcweir         sLayerNm.AssignAscii(RTL_CONSTASCII_STRINGPARAM("InvisibleHeaven" ));
629cdf0e10cSrcweir         nInvisibleHeaven = pDrawModel->GetLayerAdmin().NewLayer( sLayerNm )->GetID();
630cdf0e10cSrcweir 
631cdf0e10cSrcweir         sLayerNm.AssignAscii(RTL_CONSTASCII_STRINGPARAM("InvisibleControls" ));
632cdf0e10cSrcweir         nInvisibleControls = pDrawModel->GetLayerAdmin().NewLayer( sLayerNm )->GetID();
633cdf0e10cSrcweir     }
634cdf0e10cSrcweir 
635cdf0e10cSrcweir     SdrPage* pMasterPage = pDrawModel->AllocPage( sal_False );
636cdf0e10cSrcweir 	pDrawModel->InsertPage( pMasterPage );
637cdf0e10cSrcweir 	RTL_LOGFILE_CONTEXT_TRACE( aLog, "after create DrawDocument" );
638cdf0e10cSrcweir 
639cdf0e10cSrcweir 	RTL_LOGFILE_CONTEXT_TRACE( aLog, "before create Spellchecker/Hyphenator" );
640cdf0e10cSrcweir 	SdrOutliner& rOutliner = pDrawModel->GetDrawOutliner();
641cdf0e10cSrcweir 	uno::Reference< XSpellChecker1 > xSpell = ::GetSpellChecker();
642cdf0e10cSrcweir 	rOutliner.SetSpeller( xSpell );
643cdf0e10cSrcweir     uno::Reference<XHyphenator> xHyphenator( ::GetHyphenator() );
644cdf0e10cSrcweir 	rOutliner.SetHyphenator( xHyphenator );
645cdf0e10cSrcweir 	RTL_LOGFILE_CONTEXT_TRACE( aLog, "after create Spellchecker/Hyphenator" );
646cdf0e10cSrcweir 
647cdf0e10cSrcweir 	SetCalcFieldValueHdl(&rOutliner);
648cdf0e10cSrcweir 	SetCalcFieldValueHdl(&pDrawModel->GetHitTestOutliner());
649cdf0e10cSrcweir 
650cdf0e10cSrcweir 	//JP 16.07.98: Bug 50193 - Linkmanager am Model setzen, damit
651cdf0e10cSrcweir 	//			dort ggfs. verlinkte Grafiken eingefuegt werden koennen
652cdf0e10cSrcweir 	//JP 28.01.99: der WinWord Import benoetigt ihn auch
653cdf0e10cSrcweir 	pDrawModel->SetLinkManager( &GetLinkManager() );
654cdf0e10cSrcweir     pDrawModel->SetAddExtLeading( get(IDocumentSettingAccess::ADD_EXT_LEADING) );
655cdf0e10cSrcweir 
656cdf0e10cSrcweir     OutputDevice* pRefDev = getReferenceDevice( false );
657cdf0e10cSrcweir     if ( pRefDev )
658cdf0e10cSrcweir         pDrawModel->SetRefDevice( pRefDev );
659cdf0e10cSrcweir 
660cdf0e10cSrcweir     pDrawModel->SetNotifyUndoActionHdl( LINK( this, SwDoc, AddDrawUndo ));
661cdf0e10cSrcweir 	if ( pCurrentView )
662cdf0e10cSrcweir 	{
663cdf0e10cSrcweir         ViewShell* pViewSh = pCurrentView;
664cdf0e10cSrcweir         do
665cdf0e10cSrcweir         {
666cdf0e10cSrcweir             SwRootFrm* pRoot =  pViewSh->GetLayout();
667cdf0e10cSrcweir             if( pRoot && !pRoot->GetDrawPage() )
668cdf0e10cSrcweir             {
669cdf0e10cSrcweir                 // Disable "multiple layout" for the moment:
670cdf0e10cSrcweir                 // use pMasterPage instead of a new created SdrPage
671cdf0e10cSrcweir                 // pDrawModel->AllocPage( FALSE );
672cdf0e10cSrcweir                 // pDrawModel->InsertPage( pDrawPage );
673cdf0e10cSrcweir                 SdrPage* pDrawPage = pMasterPage;
674cdf0e10cSrcweir                 pRoot->SetDrawPage( pDrawPage );
675cdf0e10cSrcweir                 pDrawPage->SetSize( pRoot->Frm().SSize() );
676cdf0e10cSrcweir             }
677cdf0e10cSrcweir             pViewSh = (ViewShell*)pViewSh->GetNext();
678cdf0e10cSrcweir         }while( pViewSh != pCurrentView );
679cdf0e10cSrcweir 	}
680cdf0e10cSrcweir }
681cdf0e10cSrcweir 
682cdf0e10cSrcweir /** method to notify drawing page view about the invisible layers
683cdf0e10cSrcweir 
684cdf0e10cSrcweir     OD 26.06.2003 #108784#
685cdf0e10cSrcweir 
686cdf0e10cSrcweir     @author OD
687cdf0e10cSrcweir */
NotifyInvisibleLayers(SdrPageView & _rSdrPageView)688cdf0e10cSrcweir void SwDoc::NotifyInvisibleLayers( SdrPageView& _rSdrPageView )
689cdf0e10cSrcweir {
690cdf0e10cSrcweir     String sLayerNm;
691cdf0e10cSrcweir     sLayerNm.AssignAscii(RTL_CONSTASCII_STRINGPARAM("InvisibleHell" ));
692cdf0e10cSrcweir     _rSdrPageView.SetLayerVisible( sLayerNm, sal_False );
693cdf0e10cSrcweir 
694cdf0e10cSrcweir     sLayerNm.AssignAscii(RTL_CONSTASCII_STRINGPARAM("InvisibleHeaven" ));
695cdf0e10cSrcweir     _rSdrPageView.SetLayerVisible( sLayerNm, sal_False );
696cdf0e10cSrcweir 
697cdf0e10cSrcweir     sLayerNm.AssignAscii(RTL_CONSTASCII_STRINGPARAM("InvisibleControls" ));
698cdf0e10cSrcweir     _rSdrPageView.SetLayerVisible( sLayerNm, sal_False );
699cdf0e10cSrcweir }
700cdf0e10cSrcweir 
701cdf0e10cSrcweir /** method to determine, if a layer ID belongs to the visible ones.
702cdf0e10cSrcweir 
703cdf0e10cSrcweir     OD 25.06.2003 #108784#
704cdf0e10cSrcweir     Note: If given layer ID is unknown, method asserts and returns <false>.
705cdf0e10cSrcweir 
706cdf0e10cSrcweir     @author OD
707cdf0e10cSrcweir */
IsVisibleLayerId(const SdrLayerID & _nLayerId) const708cdf0e10cSrcweir bool SwDoc::IsVisibleLayerId( const SdrLayerID& _nLayerId ) const
709cdf0e10cSrcweir {
710cdf0e10cSrcweir     bool bRetVal;
711cdf0e10cSrcweir 
712cdf0e10cSrcweir     if ( _nLayerId == GetHeavenId() ||
713cdf0e10cSrcweir          _nLayerId == GetHellId() ||
714cdf0e10cSrcweir          _nLayerId == GetControlsId() )
715cdf0e10cSrcweir     {
716cdf0e10cSrcweir         bRetVal = true;
717cdf0e10cSrcweir     }
718cdf0e10cSrcweir     else if ( _nLayerId == GetInvisibleHeavenId() ||
719cdf0e10cSrcweir               _nLayerId == GetInvisibleHellId() ||
720cdf0e10cSrcweir               _nLayerId == GetInvisibleControlsId() )
721cdf0e10cSrcweir     {
722cdf0e10cSrcweir         bRetVal = false;
723cdf0e10cSrcweir     }
724cdf0e10cSrcweir     else
725cdf0e10cSrcweir     {
726cdf0e10cSrcweir         ASSERT( false, "<SwDoc::IsVisibleLayerId(..)> - unknown layer ID." );
727cdf0e10cSrcweir         bRetVal = false;
728cdf0e10cSrcweir     }
729cdf0e10cSrcweir 
730cdf0e10cSrcweir     return bRetVal;
731cdf0e10cSrcweir }
732cdf0e10cSrcweir 
733cdf0e10cSrcweir /** method to determine, if the corresponding visible layer ID for a invisible one.
734cdf0e10cSrcweir 
735cdf0e10cSrcweir     OD 25.06.2003 #108784#
736cdf0e10cSrcweir     Note: If given layer ID is a visible one, method returns given layer ID.
737cdf0e10cSrcweir     Note: If given layer ID is unknown, method returns given layer ID.
738cdf0e10cSrcweir 
739cdf0e10cSrcweir     @author OD
740cdf0e10cSrcweir */
GetVisibleLayerIdByInvisibleOne(const SdrLayerID & _nInvisibleLayerId)741cdf0e10cSrcweir SdrLayerID SwDoc::GetVisibleLayerIdByInvisibleOne( const SdrLayerID& _nInvisibleLayerId )
742cdf0e10cSrcweir {
743cdf0e10cSrcweir     SdrLayerID nVisibleLayerId;
744cdf0e10cSrcweir 
745cdf0e10cSrcweir     if ( _nInvisibleLayerId == GetInvisibleHeavenId() )
746cdf0e10cSrcweir     {
747cdf0e10cSrcweir         nVisibleLayerId = GetHeavenId();
748cdf0e10cSrcweir     }
749cdf0e10cSrcweir     else if ( _nInvisibleLayerId == GetInvisibleHellId() )
750cdf0e10cSrcweir     {
751cdf0e10cSrcweir         nVisibleLayerId = GetHellId();
752cdf0e10cSrcweir     }
753cdf0e10cSrcweir     else if ( _nInvisibleLayerId == GetInvisibleControlsId() )
754cdf0e10cSrcweir     {
755cdf0e10cSrcweir         nVisibleLayerId = GetControlsId();
756cdf0e10cSrcweir     }
757cdf0e10cSrcweir     else if ( _nInvisibleLayerId == GetHeavenId() ||
758cdf0e10cSrcweir               _nInvisibleLayerId == GetHellId() ||
759cdf0e10cSrcweir               _nInvisibleLayerId == GetControlsId() )
760cdf0e10cSrcweir     {
761cdf0e10cSrcweir         ASSERT( false, "<SwDoc::GetVisibleLayerIdByInvisibleOne(..)> - given layer ID already an invisible one." );
762cdf0e10cSrcweir         nVisibleLayerId = _nInvisibleLayerId;
763cdf0e10cSrcweir     }
764cdf0e10cSrcweir     else
765cdf0e10cSrcweir     {
766cdf0e10cSrcweir         ASSERT( false, "<SwDoc::GetVisibleLayerIdByInvisibleOne(..)> - given layer ID is unknown." );
767cdf0e10cSrcweir         nVisibleLayerId = _nInvisibleLayerId;
768cdf0e10cSrcweir     }
769cdf0e10cSrcweir 
770cdf0e10cSrcweir     return nVisibleLayerId;
771cdf0e10cSrcweir }
772cdf0e10cSrcweir 
773cdf0e10cSrcweir /** method to determine, if the corresponding invisible layer ID for a visible one.
774cdf0e10cSrcweir 
775cdf0e10cSrcweir     OD 25.06.2003 #108784#
776cdf0e10cSrcweir     Note: If given layer ID is a invisible one, method returns given layer ID.
777cdf0e10cSrcweir     Note: If given layer ID is unknown, method returns given layer ID.
778cdf0e10cSrcweir 
779cdf0e10cSrcweir     @author OD
780cdf0e10cSrcweir */
GetInvisibleLayerIdByVisibleOne(const SdrLayerID & _nVisibleLayerId)781cdf0e10cSrcweir SdrLayerID SwDoc::GetInvisibleLayerIdByVisibleOne( const SdrLayerID& _nVisibleLayerId )
782cdf0e10cSrcweir {
783cdf0e10cSrcweir     SdrLayerID nInvisibleLayerId;
784cdf0e10cSrcweir 
785cdf0e10cSrcweir     if ( _nVisibleLayerId == GetHeavenId() )
786cdf0e10cSrcweir     {
787cdf0e10cSrcweir         nInvisibleLayerId = GetInvisibleHeavenId();
788cdf0e10cSrcweir     }
789cdf0e10cSrcweir     else if ( _nVisibleLayerId == GetHellId() )
790cdf0e10cSrcweir     {
791cdf0e10cSrcweir         nInvisibleLayerId = GetInvisibleHellId();
792cdf0e10cSrcweir     }
793cdf0e10cSrcweir     else if ( _nVisibleLayerId == GetControlsId() )
794cdf0e10cSrcweir     {
795cdf0e10cSrcweir         nInvisibleLayerId = GetInvisibleControlsId();
796cdf0e10cSrcweir     }
797cdf0e10cSrcweir     else if ( _nVisibleLayerId == GetInvisibleHeavenId() ||
798cdf0e10cSrcweir               _nVisibleLayerId == GetInvisibleHellId() ||
799cdf0e10cSrcweir               _nVisibleLayerId == GetInvisibleControlsId() )
800cdf0e10cSrcweir     {
801cdf0e10cSrcweir         ASSERT( false, "<SwDoc::GetInvisibleLayerIdByVisibleOne(..)> - given layer ID already an invisible one." );
802cdf0e10cSrcweir         nInvisibleLayerId = _nVisibleLayerId;
803cdf0e10cSrcweir     }
804cdf0e10cSrcweir     else
805cdf0e10cSrcweir     {
806cdf0e10cSrcweir         ASSERT( false, "<SwDoc::GetInvisibleLayerIdByVisibleOne(..)> - given layer ID is unknown." );
807cdf0e10cSrcweir         nInvisibleLayerId = _nVisibleLayerId;
808cdf0e10cSrcweir     }
809cdf0e10cSrcweir 
810cdf0e10cSrcweir     return nInvisibleLayerId;
811cdf0e10cSrcweir }
812cdf0e10cSrcweir 
813cdf0e10cSrcweir /*************************************************************************/
814cdf0e10cSrcweir 
815cdf0e10cSrcweir 
ReleaseDrawModel()816cdf0e10cSrcweir void SwDoc::ReleaseDrawModel()
817cdf0e10cSrcweir {
818cdf0e10cSrcweir 	if ( pDrawModel )
819cdf0e10cSrcweir 	{
820cdf0e10cSrcweir 		//!!Den code im sw3io fuer Einfuegen Dokument mitpflegen!!
821cdf0e10cSrcweir 		delete pDrawModel; pDrawModel = 0;
822cdf0e10cSrcweir 	}
823cdf0e10cSrcweir }
824cdf0e10cSrcweir 
825cdf0e10cSrcweir /*************************************************************************/
826cdf0e10cSrcweir 
827cdf0e10cSrcweir 
_MakeDrawModel()82826ea3662SArmin Le Grand SwDrawModel* SwDoc::_MakeDrawModel()
829cdf0e10cSrcweir {
830cdf0e10cSrcweir 	ASSERT( !pDrawModel, "_MakeDrawModel: Why?" );
831cdf0e10cSrcweir 	InitDrawModel();
832cdf0e10cSrcweir 	if ( pCurrentView )
833cdf0e10cSrcweir 	{
834cdf0e10cSrcweir 		ViewShell* pTmp = pCurrentView;
835cdf0e10cSrcweir 		do
836cdf0e10cSrcweir 		{
837cdf0e10cSrcweir 			pTmp->MakeDrawView();
838cdf0e10cSrcweir 			pTmp = (ViewShell*) pTmp->GetNext();
839cdf0e10cSrcweir 		} while ( pTmp != pCurrentView );
840cdf0e10cSrcweir 
841cdf0e10cSrcweir 		//Broadcast, damit die FormShell mit der DrawView verbunden werden kann
842cdf0e10cSrcweir 		if( GetDocShell() )
843cdf0e10cSrcweir 		{
844cdf0e10cSrcweir 			SfxSimpleHint aHnt( SW_BROADCAST_DRAWVIEWS_CREATED );
845cdf0e10cSrcweir 			GetDocShell()->Broadcast( aHnt );
846cdf0e10cSrcweir 		}
847cdf0e10cSrcweir 	}	//swmod 071029//swmod 071225
848cdf0e10cSrcweir 	return pDrawModel;
849cdf0e10cSrcweir }
850cdf0e10cSrcweir 
851cdf0e10cSrcweir /*************************************************************************/
852cdf0e10cSrcweir 
DrawNotifyUndoHdl()853cdf0e10cSrcweir void SwDoc::DrawNotifyUndoHdl()
854cdf0e10cSrcweir {
855cdf0e10cSrcweir 	pDrawModel->SetNotifyUndoActionHdl( Link() );
856cdf0e10cSrcweir }
857cdf0e10cSrcweir 
858cdf0e10cSrcweir /*************************************************************************
859cdf0e10cSrcweir *
860cdf0e10cSrcweir * Am Outliner Link auf Methode fuer Felddarstellung in Editobjekten setzen
861cdf0e10cSrcweir *
862cdf0e10cSrcweir *************************************************************************/
863cdf0e10cSrcweir 
SetCalcFieldValueHdl(Outliner * pOutliner)864cdf0e10cSrcweir void SwDoc::SetCalcFieldValueHdl(Outliner* pOutliner)
865cdf0e10cSrcweir {
866cdf0e10cSrcweir 	pOutliner->SetCalcFieldValueHdl(LINK(this, SwDoc, CalcFieldValueHdl));
867cdf0e10cSrcweir }
868cdf0e10cSrcweir 
869cdf0e10cSrcweir /*************************************************************************
870cdf0e10cSrcweir |*
871cdf0e10cSrcweir |* Felder bzw URLs im Outliner erkennen und Darstellung festlegen
872cdf0e10cSrcweir |*
873cdf0e10cSrcweir \************************************************************************/
874cdf0e10cSrcweir 
IMPL_LINK(SwDoc,CalcFieldValueHdl,EditFieldInfo *,pInfo)875cdf0e10cSrcweir IMPL_LINK(SwDoc, CalcFieldValueHdl, EditFieldInfo*, pInfo)
876cdf0e10cSrcweir {
877cdf0e10cSrcweir 	if (pInfo)
878cdf0e10cSrcweir 	{
879cdf0e10cSrcweir 		const SvxFieldItem& rField = pInfo->GetField();
880cdf0e10cSrcweir 		const SvxFieldData* pField = rField.GetField();
881cdf0e10cSrcweir 
882cdf0e10cSrcweir 		if (pField && pField->ISA(SvxDateField))
883cdf0e10cSrcweir 		{
884cdf0e10cSrcweir 			/******************************************************************
885cdf0e10cSrcweir 			* Date-Field
886cdf0e10cSrcweir 			******************************************************************/
887cdf0e10cSrcweir 			pInfo->SetRepresentation(
888cdf0e10cSrcweir 				((const SvxDateField*) pField)->GetFormatted(
889cdf0e10cSrcweir 						*GetNumberFormatter( sal_True ), LANGUAGE_SYSTEM) );
890cdf0e10cSrcweir 		}
891cdf0e10cSrcweir 		else if (pField && pField->ISA(SvxURLField))
892cdf0e10cSrcweir 		{
893cdf0e10cSrcweir 			/******************************************************************
894cdf0e10cSrcweir 			* URL-Field
895cdf0e10cSrcweir 			******************************************************************/
896cdf0e10cSrcweir 
897cdf0e10cSrcweir 			switch ( ((const SvxURLField*) pField)->GetFormat() )
898cdf0e10cSrcweir 			{
899cdf0e10cSrcweir 				case SVXURLFORMAT_APPDEFAULT: //!!! einstellbar an App???
900cdf0e10cSrcweir 				case SVXURLFORMAT_REPR:
901cdf0e10cSrcweir 				{
902cdf0e10cSrcweir 					pInfo->SetRepresentation(
903cdf0e10cSrcweir 						((const SvxURLField*)pField)->GetRepresentation());
904cdf0e10cSrcweir 				}
905cdf0e10cSrcweir 				break;
906cdf0e10cSrcweir 
907cdf0e10cSrcweir 				case SVXURLFORMAT_URL:
908cdf0e10cSrcweir 				{
909cdf0e10cSrcweir 					pInfo->SetRepresentation(
910cdf0e10cSrcweir 						((const SvxURLField*)pField)->GetURL());
911cdf0e10cSrcweir 				}
912cdf0e10cSrcweir 				break;
913cdf0e10cSrcweir 			}
914cdf0e10cSrcweir 
915cdf0e10cSrcweir 			sal_uInt16 nChrFmt;
916cdf0e10cSrcweir 
917cdf0e10cSrcweir 			if (IsVisitedURL(((const SvxURLField*)pField)->GetURL()))
918cdf0e10cSrcweir 				nChrFmt = RES_POOLCHR_INET_VISIT;
919cdf0e10cSrcweir 			else
920cdf0e10cSrcweir 				nChrFmt = RES_POOLCHR_INET_NORMAL;
921cdf0e10cSrcweir 
922cdf0e10cSrcweir 			SwFmt *pFmt = GetCharFmtFromPool(nChrFmt);
923cdf0e10cSrcweir 
924cdf0e10cSrcweir 			Color aColor(COL_LIGHTBLUE);
925cdf0e10cSrcweir 			if (pFmt)
926cdf0e10cSrcweir 				aColor = pFmt->GetColor().GetValue();
927cdf0e10cSrcweir 
928cdf0e10cSrcweir 			pInfo->SetTxtColor(aColor);
929cdf0e10cSrcweir 		}
930cdf0e10cSrcweir 		else if (pField && pField->ISA(SdrMeasureField))
931cdf0e10cSrcweir 		{
932cdf0e10cSrcweir 			/******************************************************************
933cdf0e10cSrcweir 			* Measure-Field
934cdf0e10cSrcweir 			******************************************************************/
935cdf0e10cSrcweir 			pInfo->ClearFldColor();
936cdf0e10cSrcweir 		}
937cdf0e10cSrcweir         else if ( pField && pField->ISA(SvxExtTimeField))
938cdf0e10cSrcweir         {
939cdf0e10cSrcweir             /******************************************************************
940cdf0e10cSrcweir             * Time-Field
941cdf0e10cSrcweir             ******************************************************************/
942cdf0e10cSrcweir             pInfo->SetRepresentation(
943cdf0e10cSrcweir                 ((const SvxExtTimeField*) pField)->GetFormatted(
944cdf0e10cSrcweir                         *GetNumberFormatter( sal_True ), LANGUAGE_SYSTEM) );
945cdf0e10cSrcweir         }
946cdf0e10cSrcweir 		else
947cdf0e10cSrcweir 		{
948cdf0e10cSrcweir 			DBG_ERROR("unbekannter Feldbefehl");
949cdf0e10cSrcweir 			pInfo->SetRepresentation( String( '?' ) );
950cdf0e10cSrcweir 		}
951cdf0e10cSrcweir 	}
952cdf0e10cSrcweir 
953cdf0e10cSrcweir 	return(0);
954cdf0e10cSrcweir }
955cdf0e10cSrcweir 
956cdf0e10cSrcweir /* TFFDI: The functions formerly declared 'inline'
957cdf0e10cSrcweir  */
GetDrawModel() const95826ea3662SArmin Le Grand const SwDrawModel* SwDoc::GetDrawModel() const { return pDrawModel; }
GetDrawModel()95926ea3662SArmin Le Grand SwDrawModel* SwDoc::GetDrawModel() { return pDrawModel; }
GetHeavenId() const960cdf0e10cSrcweir SdrLayerID SwDoc::GetHeavenId() const { return nHeaven; }
GetHellId() const961cdf0e10cSrcweir SdrLayerID SwDoc::GetHellId() const { return nHell; }
GetControlsId() const962cdf0e10cSrcweir SdrLayerID SwDoc::GetControlsId() const { return nControls;   }
GetInvisibleHeavenId() const963cdf0e10cSrcweir SdrLayerID SwDoc::GetInvisibleHeavenId() const { return nInvisibleHeaven; }
GetInvisibleHellId() const964cdf0e10cSrcweir SdrLayerID SwDoc::GetInvisibleHellId() const { return nInvisibleHell; }
GetInvisibleControlsId() const965cdf0e10cSrcweir SdrLayerID SwDoc::GetInvisibleControlsId() const { return nInvisibleControls; }
GetOrCreateDrawModel()96626ea3662SArmin Le Grand SwDrawModel* SwDoc::GetOrCreateDrawModel() { return GetDrawModel() ? GetDrawModel() : _MakeDrawModel(); }
967cdf0e10cSrcweir 
968cdf0e10cSrcweir // --> OD 2006-03-14 #i62875#
969cdf0e10cSrcweir namespace docfunc
970cdf0e10cSrcweir {
ExistsDrawObjs(SwDoc & p_rDoc)971cdf0e10cSrcweir     bool ExistsDrawObjs( SwDoc& p_rDoc )
972cdf0e10cSrcweir     {
973cdf0e10cSrcweir         bool bExistsDrawObjs( false );
974cdf0e10cSrcweir 
975cdf0e10cSrcweir         if ( p_rDoc.GetDrawModel() &&
976cdf0e10cSrcweir              p_rDoc.GetDrawModel()->GetPage( 0 ) )
977cdf0e10cSrcweir         {
978cdf0e10cSrcweir             const SdrPage& rSdrPage( *(p_rDoc.GetDrawModel()->GetPage( 0 )) );
979cdf0e10cSrcweir 
980cdf0e10cSrcweir             SdrObjListIter aIter( rSdrPage, IM_FLAT );
981cdf0e10cSrcweir             while( aIter.IsMore() )
982cdf0e10cSrcweir             {
983cdf0e10cSrcweir                 SdrObject* pObj( aIter.Next() );
984cdf0e10cSrcweir                 if ( !dynamic_cast<SwVirtFlyDrawObj*>(pObj) &&
985cdf0e10cSrcweir                      !dynamic_cast<SwFlyDrawObj*>(pObj) )
986cdf0e10cSrcweir                 {
987cdf0e10cSrcweir                     bExistsDrawObjs = true;
988cdf0e10cSrcweir                     break;
989cdf0e10cSrcweir                 }
990cdf0e10cSrcweir             }
991cdf0e10cSrcweir         }
992cdf0e10cSrcweir 
993cdf0e10cSrcweir         return bExistsDrawObjs;
994cdf0e10cSrcweir     }
995cdf0e10cSrcweir 
AllDrawObjsOnPage(SwDoc & p_rDoc)996cdf0e10cSrcweir     bool AllDrawObjsOnPage( SwDoc& p_rDoc )
997cdf0e10cSrcweir     {
998cdf0e10cSrcweir         bool bAllDrawObjsOnPage( true );
999cdf0e10cSrcweir 
1000cdf0e10cSrcweir         if ( p_rDoc.GetDrawModel() &&
1001cdf0e10cSrcweir              p_rDoc.GetDrawModel()->GetPage( 0 ) )
1002cdf0e10cSrcweir         {
1003cdf0e10cSrcweir             const SdrPage& rSdrPage( *(p_rDoc.GetDrawModel()->GetPage( 0 )) );
1004cdf0e10cSrcweir 
1005cdf0e10cSrcweir             SdrObjListIter aIter( rSdrPage, IM_FLAT );
1006cdf0e10cSrcweir             while( aIter.IsMore() )
1007cdf0e10cSrcweir             {
1008cdf0e10cSrcweir                 SdrObject* pObj( aIter.Next() );
1009cdf0e10cSrcweir                 if ( !dynamic_cast<SwVirtFlyDrawObj*>(pObj) &&
1010cdf0e10cSrcweir                      !dynamic_cast<SwFlyDrawObj*>(pObj) )
1011cdf0e10cSrcweir                 {
1012cdf0e10cSrcweir                     SwDrawContact* pDrawContact =
1013cdf0e10cSrcweir                             dynamic_cast<SwDrawContact*>(::GetUserCall( pObj ));
1014cdf0e10cSrcweir                     if ( pDrawContact )
1015cdf0e10cSrcweir                     {
1016cdf0e10cSrcweir                         SwAnchoredDrawObject* pAnchoredDrawObj =
1017cdf0e10cSrcweir                             dynamic_cast<SwAnchoredDrawObject*>(pDrawContact->GetAnchoredObj( pObj ));
1018cdf0e10cSrcweir 
1019cdf0e10cSrcweir                         // error handling
1020cdf0e10cSrcweir                         {
1021cdf0e10cSrcweir                             if ( !pAnchoredDrawObj )
1022cdf0e10cSrcweir                             {
1023cdf0e10cSrcweir                                 ASSERT( false,
1024cdf0e10cSrcweir                                         "<docfunc::AllDrawObjsOnPage() - missing anchored draw object" );
1025cdf0e10cSrcweir                                 bAllDrawObjsOnPage = false;
1026cdf0e10cSrcweir                                 break;
1027cdf0e10cSrcweir                             }
1028cdf0e10cSrcweir                         }
1029cdf0e10cSrcweir 
1030cdf0e10cSrcweir                         if ( pAnchoredDrawObj->NotYetPositioned() )
1031cdf0e10cSrcweir                         {
1032cdf0e10cSrcweir                             // The drawing object isn't yet layouted.
1033cdf0e10cSrcweir                             // Thus, it isn't known, if all drawing objects are on page.
1034cdf0e10cSrcweir                             bAllDrawObjsOnPage = false;
1035cdf0e10cSrcweir                             break;
1036cdf0e10cSrcweir                         }
1037cdf0e10cSrcweir                         else if ( pAnchoredDrawObj->IsOutsidePage() )
1038cdf0e10cSrcweir                         {
1039cdf0e10cSrcweir                             bAllDrawObjsOnPage = false;
1040cdf0e10cSrcweir                             break;
1041cdf0e10cSrcweir                         }
1042cdf0e10cSrcweir                     }
1043cdf0e10cSrcweir                     else
1044cdf0e10cSrcweir                     {
1045cdf0e10cSrcweir                         // contact object of drawing object doesn't exists.
1046cdf0e10cSrcweir                         // Thus, the drawing object isn't yet positioned.
1047cdf0e10cSrcweir                         // Thus, it isn't known, if all drawing objects are on page.
1048cdf0e10cSrcweir                         bAllDrawObjsOnPage = false;
1049cdf0e10cSrcweir                         break;
1050cdf0e10cSrcweir                     }
1051cdf0e10cSrcweir                 }
1052cdf0e10cSrcweir             }
1053cdf0e10cSrcweir         }
1054cdf0e10cSrcweir 
1055cdf0e10cSrcweir         return bAllDrawObjsOnPage;
1056cdf0e10cSrcweir     }
1057cdf0e10cSrcweir }
1058cdf0e10cSrcweir // <--
1059cdf0e10cSrcweir 
10601396af09SArmin Le Grand // eof
1061