1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: fefly1.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sw.hxx"
33 #include <hintids.hxx>
34 #include <svtools/itemiter.hxx>
35 #include <svtools/imapobj.hxx>
36 #include <svtools/soerr.hxx>
37 #include <svx/protitem.hxx>
38 #include <svx/svdogrp.hxx>
39 #include <svx/svdouno.hxx>
40 #include <svx/fmglob.hxx>
41 #include <com/sun/star/form/FormButtonType.hpp>
42 #include <com/sun/star/beans/XPropertySet.hpp>
43 #include <fmtanchr.hxx>
44 #include <txtflcnt.hxx>
45 #include <fmtcntnt.hxx>
46 #include <fmtornt.hxx>
47 #include <fmtflcnt.hxx>
49 #include <fmtclds.hxx>
50 #include <fmtfsize.hxx>
53 #include <rootfrm.hxx>
54 #include <pagefrm.hxx>
57 #include <viewimp.hxx>
61 #include <dflyobj.hxx>
62 #include <dcontact.hxx>
67 #include <swtable.hxx>
68 #include <mvsave.hxx> // Strukturen zum Sichern beim Move/Delete
70 #include <flyfrms.hxx>
75 // --> OD 2006-03-06 #125892#
76 #include <HandleAnchorNodeChg.hxx>
82 using ::rtl::OUString
;
83 using namespace ::com::sun::star
;
85 //Zum anmelden von Flys in Flys in ...
86 //definiert in layout/frmtool.cxx
87 void RegistFlys( SwPageFrm
*, const SwLayoutFrm
* );
89 /***********************************************************************
91 #* Methode : UseSpzLayoutFmt
92 #* Beschreibung: Anhand des Request werden zu dem Format entsprechende
93 #* Aenderungen an den Spezifischen Layouts vorgenommen.
94 #* Datum : MA 23. Sep. 92
95 #* Update : JP 09.03.98
96 #***********************************************************************/
98 sal_Bool
lcl_SetNewFlyPos( const SwNode
& rNode
, SwFmtAnchor
& rAnchor
,
101 sal_Bool bRet
= sal_False
;
102 const SwStartNode
* pStNode
= rNode
.FindFlyStartNode();
105 SwPosition
aPos( *pStNode
);
106 rAnchor
.SetAnchor( &aPos
);
111 const SwCntntNode
*pCntNd
= rNode
.GetCntntNode();
112 const SwCntntFrm
* pCFrm
= pCntNd
? pCntNd
->GetFrm( &rPt
, 0, sal_False
) : 0;
113 const SwPageFrm
*pPg
= pCFrm
? pCFrm
->FindPageFrm() : 0;
115 rAnchor
.SetPageNum( pPg
? pPg
->GetPhyPageNum() : 1 );
116 rAnchor
.SetType( FLY_PAGE
);
121 BOOL
lcl_FindAnchorPos( SwDoc
& rDoc
, const Point
& rPt
, const SwFrm
& rFrm
,
125 SwFmtAnchor
aNewAnch( (SwFmtAnchor
&)rSet
.Get( RES_ANCHOR
) );
126 RndStdIds nNew
= aNewAnch
.GetAnchorId();
127 const SwFrm
*pNewAnch
;
129 //Neuen Anker ermitteln
130 Point
aTmpPnt( rPt
);
133 case FLY_IN_CNTNT
: // sollte der nicht auch mit hinein?
135 case FLY_AUTO_CNTNT
: // LAYER_IMPL
137 //Ausgehend von der linken oberen Ecke des Fly den
138 //dichtesten CntntFrm suchen.
139 const SwFrm
* pFrm
= rFrm
.IsFlyFrm() ? ((SwFlyFrm
&)rFrm
).GetAnchorFrm()
141 pNewAnch
= ::FindAnchor( pFrm
, aTmpPnt
);
142 if( pNewAnch
->IsProtected() )
148 SwPosition
aPos( *((SwCntntFrm
*)pNewAnch
)->GetNode() );
149 if( FLY_AUTO_CNTNT
== nNew
|| FLY_IN_CNTNT
== nNew
)
151 // es muss ein TextNode gefunden werden, denn nur in diesen
152 // ist ein Inhaltsgebundene Frames zu verankern
153 SwCrsrMoveState
aState( MV_SETONLYTEXT
);
154 aTmpPnt
.X() -= 1; //nicht im Fly landen!!
155 if( !pNewAnch
->GetCrsrOfst( &aPos
, aTmpPnt
, &aState
) )
157 SwCntntNode
* pCNd
= ((SwCntntFrm
*)pNewAnch
)->GetNode();
158 if( pNewAnch
->Frm().Bottom() < aTmpPnt
.Y() )
159 pCNd
->MakeStartIndex( &aPos
.nContent
);
161 pCNd
->MakeEndIndex( &aPos
.nContent
);
164 aNewAnch
.SetAnchor( &aPos
);
168 case FLY_AT_FLY
: // LAYER_IMPL
170 //Ausgehend von der linken oberen Ecke des Fly den
171 //dichtesten SwFlyFrm suchen.
172 SwCrsrMoveState
aState( MV_SETONLYTEXT
);
173 SwPosition
aPos( rDoc
.GetNodes() );
174 aTmpPnt
.X() -= 1; //nicht im Fly landen!!
175 rDoc
.GetRootFrm()->GetCrsrOfst( &aPos
, aTmpPnt
, &aState
);
176 pNewAnch
= ::FindAnchor(
177 aPos
.nNode
.GetNode().GetCntntNode()->GetFrm( 0, 0, sal_False
),
178 aTmpPnt
)->FindFlyFrm();
180 if( pNewAnch
&& &rFrm
!= pNewAnch
&& !pNewAnch
->IsProtected() )
182 aPos
.nNode
= *((SwFlyFrm
*)pNewAnch
)->GetFmt()->GetCntnt().
184 aNewAnch
.SetAnchor( &aPos
);
189 aNewAnch
.SetType( nNew
= FLY_PAGE
);
193 pNewAnch
= rFrm
.FindPageFrm();
194 aNewAnch
.SetPageNum( pNewAnch
->GetPhyPageNum() );
198 ASSERT( !&rDoc
, "Falsche ID fuer neuen Anker." );
201 rSet
.Put( aNewAnch
);
206 //! also used in unoframe.cxx
208 sal_Bool
lcl_ChkAndSetNewAnchor( const SwFlyFrm
& rFly
, SfxItemSet
& rSet
)
210 const SwFrmFmt
& rFmt
= *rFly
.GetFmt();
211 const SwFmtAnchor
&rOldAnch
= rFmt
.GetAnchor();
212 const RndStdIds nOld
= rOldAnch
.GetAnchorId();
214 RndStdIds nNew
= ((SwFmtAnchor
&)rSet
.Get( RES_ANCHOR
)).GetAnchorId();
219 SwDoc
* pDoc
= (SwDoc
*)rFmt
.GetDoc();
222 ASSERT( !(nNew
== FLY_PAGE
&&
223 (FLY_AT_CNTNT
==nOld
|| FLY_AUTO_CNTNT
==nOld
|| FLY_IN_CNTNT
==nOld
) &&
224 pDoc
->IsInHeaderFooter( rOldAnch
.GetCntntAnchor()->nNode
)),
225 "Unerlaubter Ankerwechsel in Head/Foot." );
228 return ::lcl_FindAnchorPos( *pDoc
, rFly
.Frm().Pos(), rFly
, rSet
);
231 void SwFEShell::SelectFlyFrm( SwFlyFrm
& rFrm
, sal_Bool bNew
)
233 SET_CURR_SHELL( this );
235 // Wenn es ein neuer Rahmen ist, so soll er selektiert sein.
236 // !!Rahmen immer selektieren, wenn sie nicht selektiert sind.
237 // - Es kann ein neuer 'alter' sein weil der Anker gewechselt wurde.
238 // - 'alte' Rahmen sind vorher immer selektiert denn sonst wird nix
239 // an ihnen veraendert.
240 // Der Rahmen darf nicht per Dokumentposition selektiert werden, weil er
241 // auf jedenfall selektiert sein muss!
242 SwViewImp
*pImpl
= Imp();
243 if( GetWin() && (bNew
|| !pImpl
->GetDrawView()->AreObjectsMarked()) )
245 ASSERT( rFrm
.IsFlyFrm(), "SelectFlyFrm will einen Fly" );
247 //Wenn der Fly bereits selektiert ist gibt es hier ja wohl nichts
249 if ( FindFlyFrm() == &rFrm
)
252 //Damit der Anker ueberhaupt noch gepaintet wird.
253 if( rFrm
.IsFlyInCntFrm() && rFrm
.GetAnchorFrm() )
254 rFrm
.GetAnchorFrm()->SetCompletePaint();
256 // --> OD 2004-06-11 #i28701# - no format at all.
257 // //Hier wurde immer kalkuliert. Leider ist der Sonderfall Fly in Fly mit
258 // //Spalten u.U. sehr kritisch wenn der innenliegende zuerst formatiert
259 // //wird. Um kein Risiko einzugehen entschaerfen wir nur diesen Sonderfall.
260 // if( !rFrm.GetAnchorFrm()->IsInFly() )
263 if( pImpl
->GetDrawView()->AreObjectsMarked() )
264 pImpl
->GetDrawView()->UnmarkAll();
266 pImpl
->GetDrawView()->MarkObj( rFrm
.GetVirtDrawObj(),
267 pImpl
->GetPageView(), sal_False
, sal_False
);
274 /*************************************************************************
276 |* SwFEShell::FindFlyFrm()
278 |* Beschreibung Liefert den Fly wenn einer Selektiert ist.
279 |* Ersterstellung MA 03. Nov. 92
280 |* Letzte Aenderung MA 05. Mar. 96
282 *************************************************************************/
284 SwFlyFrm
*SwFEShell::FindFlyFrm() const
286 if ( Imp()->HasDrawView() )
288 // Ein Fly ist genau dann erreichbar, wenn er selektiert ist.
289 const SdrMarkList
&rMrkList
= Imp()->GetDrawView()->GetMarkedObjectList();
290 if( rMrkList
.GetMarkCount() != 1 )
293 SdrObject
*pO
= rMrkList
.GetMark( 0 )->GetMarkedSdrObj();
294 return pO
->ISA(SwVirtFlyDrawObj
) ? ((SwVirtFlyDrawObj
*)pO
)->GetFlyFrm() : 0;
299 /*************************************************************************
301 |* SwFEShell::IsFlyInFly()
303 |* Beschreibung Liefert sal_True, wenn der aktuelle Fly an einem anderen
304 |* verankert werden koennte (also innerhalb ist)
305 |* Ersterstellung AMA 11. Sep. 97
306 |* Letzte Aenderung AMA 14. Jan. 98
308 *************************************************************************/
310 const SwFrmFmt
* SwFEShell::IsFlyInFly()
312 SET_CURR_SHELL( this );
314 if ( !Imp()->HasDrawView() )
317 const SdrMarkList
&rMrkList
= Imp()->GetDrawView()->GetMarkedObjectList();
318 if ( !rMrkList
.GetMarkCount() )
320 SwCntntFrm
*pCntnt
= GetCurrFrm( sal_False
);
323 SwFlyFrm
*pFly
= pCntnt
->FindFlyFrm();
326 return pFly
->GetFmt();
328 else if ( rMrkList
.GetMarkCount() != 1 ||
329 !GetUserCall(rMrkList
.GetMark( 0 )->GetMarkedSdrObj()) )
332 SdrObject
*pObj
= rMrkList
.GetMark( 0 )->GetMarkedSdrObj();
334 SwFrmFmt
*pFmt
= FindFrmFmt( pObj
);
335 if( pFmt
&& FLY_AT_FLY
== pFmt
->GetAnchor().GetAnchorId() )
337 const SwFrm
* pFly
= pObj
->ISA(SwVirtFlyDrawObj
) ?
338 ((SwVirtFlyDrawObj
*)pObj
)->GetFlyFrm()->GetAnchorFrm() :
339 ((SwDrawContact
*)GetUserCall(pObj
))->GetAnchorFrm( pObj
);
340 ASSERT( pFly
, "IsFlyInFly: Where's my anchor?" );
341 ASSERT( pFly
->IsFlyFrm(), "IsFlyInFly: Funny anchor!" );
342 return ((SwFlyFrm
*)pFly
)->GetFmt();
345 Point aTmpPos
= pObj
->GetCurrentBoundRect().TopLeft();
349 SwCrsrMoveState
aState( MV_SETONLYTEXT
);
350 SwNodeIndex
aSwNodeIndex( GetDoc()->GetNodes() );
351 SwPosition
aPos( aSwNodeIndex
);
352 Point
aPoint( aTmpPos
);
353 aPoint
.X() -= 1; //nicht im Fly landen!!
354 GetLayout()->GetCrsrOfst( &aPos
, aPoint
, &aState
);
355 // OD 01.07.2003 #108784# - determine text frame by left-top-corner
357 //pTxtFrm = aPos.nNode.GetNode().GetCntntNode()->GetFrm( 0, 0, sal_False );
358 pTxtFrm
= aPos
.nNode
.GetNode().GetCntntNode()->GetFrm( &aTmpPos
, 0, sal_False
);
360 const SwFrm
*pTmp
= ::FindAnchor( pTxtFrm
, aTmpPos
);
361 const SwFlyFrm
*pFly
= pTmp
->FindFlyFrm();
363 return pFly
->GetFmt();
367 /*************************************************************************
369 |* SwFEShell::SetFlyPos
371 |* Ersterstellung MA 14. Jan. 93
372 |* Letzte Aenderung MA 14. Feb. 95
374 *************************************************************************/
376 void SwFEShell::SetFlyPos( const Point
& rAbsPos
)
378 SET_CURR_SHELL( this );
380 //Bezugspunkt in Dokumentkoordinaten bestimmen
381 SwCntntFrm
*pCntnt
= GetCurrFrm( sal_False
);
384 SwFlyFrm
*pFly
= pCntnt
->FindFlyFrm();
388 //SwSaveHdl aSaveX( Imp() );
390 //Bei Absatzgebundenen Flys muss ausgehend von der absoluten
391 //Position ein neuer Anker gesetzt werden. Anker und neue RelPos werden
392 //vom Fly selbst berechnet und gesetzt.
393 if ( pFly
->IsFlyAtCntFrm() )
394 ((SwFlyAtCntFrm
*)pFly
)->SetAbsPos( rAbsPos
);
397 const SwFrm
*pAnch
= pFly
->GetAnchorFrm();
398 // --> OD 2004-06-11 #i28701# - no format here
400 Point
aOrient( pAnch
->Frm().Pos() );
402 if ( pFly
->IsFlyInCntFrm() )
403 aOrient
.X() = rAbsPos
.X();
406 aOrient
.X() = rAbsPos
.X() - aOrient
.X();
407 aOrient
.Y() = rAbsPos
.Y() - aOrient
.Y();
408 pFly
->ChgRelPos( aOrient
);
410 // --> OD 2004-06-11 #i28701# - no format here
412 CallChgLnk(); // rufe das AttrChangeNotify auf der UI-Seite.
415 /*************************************************************************
417 |* SwFEShell::FindAnchorPos
419 |* Ersterstellung AMA 24. Sep. 97
420 |* Letzte Aenderung AMA 24. Sep. 97
422 *************************************************************************/
424 Point
SwFEShell::FindAnchorPos( const Point
& rAbsPos
, sal_Bool bMoveIt
)
428 SET_CURR_SHELL( this );
430 if ( !Imp()->HasDrawView() )
433 const SdrMarkList
&rMrkList
= Imp()->GetDrawView()->GetMarkedObjectList();
434 if ( rMrkList
.GetMarkCount() != 1 ||
435 !GetUserCall(rMrkList
.GetMark( 0 )->GetMarkedSdrObj()) )
438 SdrObject
* pObj
= rMrkList
.GetMark( 0 )->GetMarkedSdrObj();
439 // --> OD 2004-07-16 #i28701#
440 SwAnchoredObject
* pAnchoredObj
= ::GetUserCall( pObj
)->GetAnchoredObj( pObj
);
441 SwFrmFmt
& rFmt
= pAnchoredObj
->GetFrmFmt();
442 RndStdIds nAnchorId
= rFmt
.GetAnchor().GetAnchorId();
444 if ( FLY_IN_CNTNT
== nAnchorId
)
447 sal_Bool bFlyFrame
= pObj
->ISA(SwVirtFlyDrawObj
);
450 const SwFrm
* pOldAnch
;
451 const SwFrm
* pFooterOrHeader
= NULL
;
455 //Bezugspunkt in Dokumentkoordinaten bestimmen
456 SwCntntFrm
*pCntnt
= GetCurrFrm( sal_False
);
459 pFly
= pCntnt
->FindFlyFrm();
462 pOldAnch
= pFly
->GetAnchorFrm();
465 if( FLY_PAGE
!= nAnchorId
)
466 pFooterOrHeader
= pCntnt
->FindFooterOrHeader();
468 // OD 26.06.2003 #108784# - set <pFooterOrHeader> also for drawing
469 // objects, but not for control objects.
470 // Necessary for moving 'anchor symbol' at the user interface inside header/footer.
471 else if ( !::CheckControlLayer( pObj
) )
473 SwCntntFrm
*pCntnt
= GetCurrFrm( sal_False
);
476 pFooterOrHeader
= pCntnt
->FindFooterOrHeader();
479 //Ausgehend von der linken oberen Ecke des Fly den
480 //dichtesten SwFlyFrm suchen.
483 SwCrsrMoveState
aState( MV_SETONLYTEXT
);
484 SwPosition
aPos( GetDoc()->GetNodes().GetEndOfExtras() );
485 Point
aTmpPnt( rAbsPos
);
486 GetLayout()->GetCrsrOfst( &aPos
, aTmpPnt
, &aState
);
487 pTxtFrm
= aPos
.nNode
.GetNode().GetCntntNode()->GetFrm(0,&aPos
,FALSE
);
489 const SwFrm
*pNewAnch
;
492 if( FLY_PAGE
== nAnchorId
)
493 pNewAnch
= pTxtFrm
->FindPageFrm();
496 pNewAnch
= ::FindAnchor( pTxtFrm
, rAbsPos
);
498 if( FLY_AT_FLY
== nAnchorId
) // LAYER_IMPL
499 pNewAnch
= pNewAnch
->FindFlyFrm();
505 if( pNewAnch
&& !pNewAnch
->IsProtected() )
507 const SwFlyFrm
* pCheck
= bFlyFrame
? pNewAnch
->FindFlyFrm() : 0;
508 // Falls wir innerhalb eines Rahmens landen, muss sichergestellt werden,
509 // dass der Rahmen nicht in seinem eigenen Inhalt landet!
514 const SwFrm
*pTmp
= pCheck
->GetAnchorFrm();
515 pCheck
= pTmp
? pTmp
->FindFlyFrm() : NULL
;
517 // Es darf nicht aus einer Kopf-/Fusszeile in einen anderen Bereich
518 // gewechselt werden, es darf nicht in eine Kopf-/Fusszeile hinein-
519 // gewechselt werden.
521 pFooterOrHeader
== pNewAnch
->FindFooterOrHeader() )
523 aRet
= pNewAnch
->GetFrmAnchorPos( ::HasWrap( pObj
) );
525 if( bMoveIt
|| nAnchorId
== FLY_AUTO_CNTNT
)
527 SwFmtAnchor
aAnch( rFmt
.GetAnchor() );
532 SwPosition
*pPos
= (SwPosition
*)aAnch
.GetCntntAnchor();
533 pPos
->nNode
= *pTxtFrm
->GetNode();
534 pPos
->nContent
.Assign(0,0);
539 aAnch
.SetPageNum( ((const SwPageFrm
*)pNewAnch
)->
545 SwPosition
aPos( *((SwFlyFrm
*)pNewAnch
)->GetFmt()->
546 GetCntnt().GetCntntIdx() );
547 aAnch
.SetAnchor( &aPos
);
552 SwPosition
*pPos
= (SwPosition
*)aAnch
.GetCntntAnchor();
553 Point
aTmpPnt( rAbsPos
);
554 if( pTxtFrm
->GetCrsrOfst( pPos
, aTmpPnt
, NULL
) )
557 pTxtFrm
->GetCharRect( aTmpRect
, *pPos
);
558 aRet
= aTmpRect
.Pos();
562 pPos
->nNode
= *pTxtFrm
->GetNode();
563 pPos
->nContent
.Assign(0,0);
573 // --> OD 2006-02-28 #125892#
574 // handle change of anchor node:
575 // if count of the anchor frame also change, the fly frames have to be
576 // re-created. Thus, delete all fly frames except the <this> before the
577 // anchor attribute is change and re-create them afterwards.
579 SwHandleAnchorNodeChg
* pHandleAnchorNodeChg( 0L );
580 SwFlyFrmFmt
* pFlyFrmFmt( dynamic_cast<SwFlyFrmFmt
*>(&rFmt
) );
583 pHandleAnchorNodeChg
=
584 new SwHandleAnchorNodeChg( *pFlyFrmFmt
, aAnch
);
586 rFmt
.GetDoc()->SetAttr( aAnch
, rFmt
);
587 delete pHandleAnchorNodeChg
;
590 // --> OD 2004-06-24 #i28701# - no call of method
591 // <CheckCharRectAndTopOfLine()> for to-character anchored
592 // Writer fly frame needed. This method call can cause a
593 // format of the anchor frame, which is no longer intended.
594 // Instead clear the anchor character rectangle and
595 // the top of line values for all to-character anchored objects.
596 pAnchoredObj
->ClearCharRectAndTopOfLine();
602 SwRect
aTmpRect( aRet
, rAbsPos
);
603 if( aTmpRect
.HasArea() )
604 MakeVisible( aTmpRect
);
606 //TODO: That doesn't seem to be intended
607 if( Color(COL_TRANSPARENT
) != GetOut()->GetLineColor() )
609 ASSERT( FALSE
, "Hey, Joe: Where's my Null Pen?" );
610 GetOut()->SetLineColor( Color(COL_TRANSPARENT
) );
619 /***********************************************************************
621 #* Methode : NewFlyFrm
623 #* Datum : MA 03. Nov. 92
624 #* Update : JP 11. Aug. 93
625 #***********************************************************************/
627 const SwFrmFmt
*SwFEShell::NewFlyFrm( const SfxItemSet
& rSet
, sal_Bool bAnchValid
,
630 SET_CURR_SHELL( this );
633 SwPaM
* pCrsr
= GetCrsr();
634 const Point
aPt( GetCrsrDocPos() );
637 sal_Bool bMoveCntnt
= sal_True
;
640 GetTblSel( *this, aBoxes
);
643 // die Crsr muessen noch aus dem Loeschbereich entfernt
644 // werden. Setze sie immer hinter/auf die Tabelle; ueber die
645 // Dokument-Position werden sie dann immer an die alte
647 ParkCrsr( SwNodeIndex( *aBoxes
[0]->GetSttNd() ));
649 // --> FME 2005-12-01 #i127787# pCurCrsr will be deleted in ParkCrsr,
650 // we better get the current pCurCrsr instead of working with the
658 bMoveCntnt
= sal_False
;
660 else if( !pCrsr
->HasMark() && pCrsr
->GetNext() == pCrsr
)
661 bMoveCntnt
= sal_False
;
663 const SwPosition
& rPos
= *pCrsr
->Start();
665 SwFmtAnchor
& rAnch
= (SwFmtAnchor
&)rSet
.Get( RES_ANCHOR
);
666 RndStdIds eRndId
= rAnch
.GetAnchorId();
670 if( !rAnch
.GetPageNum() ) //HotFix: Bug in UpdateByExample
671 rAnch
.SetPageNum( 1 );
680 if( FLY_AT_FLY
!= eRndId
)
681 rAnch
.SetAnchor( &rPos
);
682 else if( lcl_SetNewFlyPos( rPos
.nNode
.GetNode(), rAnch
, aPt
) )
688 ASSERT( !this, "Was sollte das fuer ein Fly werden?" )
695 GetDoc()->StartUndo( UNDO_INSLAYFMT
, NULL
);
696 SwFmtAnchor
* pOldAnchor
= 0;
697 sal_Bool bHOriChgd
= sal_False
, bVOriChgd
= sal_False
;
698 SwFmtVertOrient aOldV
;
699 SwFmtHoriOrient aOldH
;
701 if( FLY_PAGE
!= eRndId
)
703 // erstmal als mit Seitenbindung, Absatz/Zeichenbindung erst wenn
704 // alles verschoben ist. Dann ist die Position gueltig!
705 // JP 13.05.98: ggfs. auch noch die Hori/Vert-Orientierung
706 // umsetzen, damit diese beim Umanker NICHT
708 pOldAnchor
= new SwFmtAnchor( rAnch
);
709 ((SfxItemSet
&)rSet
).Put( SwFmtAnchor( FLY_PAGE
, 1 ) );
711 const SfxPoolItem
* pItem
;
712 if( SFX_ITEM_SET
== rSet
.GetItemState( RES_HORI_ORIENT
, sal_False
, &pItem
)
713 && text::HoriOrientation::NONE
== ((SwFmtHoriOrient
*)pItem
)->GetHoriOrient() )
715 bHOriChgd
= sal_True
;
716 aOldH
= *((SwFmtHoriOrient
*)pItem
);
717 ((SfxItemSet
&)rSet
).Put( SwFmtHoriOrient( 0, text::HoriOrientation::LEFT
) );
719 if( SFX_ITEM_SET
== rSet
.GetItemState( RES_VERT_ORIENT
, sal_False
, &pItem
)
720 && text::VertOrientation::NONE
== ((SwFmtVertOrient
*)pItem
)->GetVertOrient() )
722 bVOriChgd
= sal_True
;
723 aOldV
= *((SwFmtVertOrient
*)pItem
);
724 ((SfxItemSet
&)rSet
).Put( SwFmtVertOrient( 0, text::VertOrientation::TOP
) );
728 pRet
= GetDoc()->MakeFlyAndMove( *pCrsr
, rSet
, &aBoxes
, pParent
);
736 // neue Position bestimmen
737 //JP 24.03.97: immer ueber die Seitenbindung gehen - der
738 // chaos::Anchor darf nie im verschobenen Bereich
742 const SwFrm
* pAnch
= ::FindAnchor( GetLayout(), aPt
, sal_False
);
743 SwPosition
aPos( *((SwCntntFrm
*)pAnch
)->GetNode() );
744 if( FLY_IN_CNTNT
== eRndId
)
745 aPos
.nContent
.Assign( ((SwCntntFrm
*)pAnch
)->GetNode(), 0 );
746 pOldAnchor
->SetAnchor( &aPos
);
748 // das verschieben von TabelleSelektion ist noch nicht
749 // Undofaehig - also darf das UmAnkern auch nicht
750 // aufgezeichnet werden.
751 sal_Bool bDoesUndo
= GetDoc()->DoesUndo();
752 if( bDoesUndo
&& UNDO_INSLAYFMT
== GetDoc()->GetUndoIds(NULL
, NULL
) )
753 GetDoc()->DoUndo( sal_False
);
755 ((SfxItemSet
&)rSet
).Put( *pOldAnchor
);
758 ((SfxItemSet
&)rSet
).Put( aOldH
);
760 ((SfxItemSet
&)rSet
).Put( aOldV
);
762 GetDoc()->SetFlyFrmAttr( *pRet
, (SfxItemSet
&)rSet
);
763 GetDoc()->DoUndo( bDoesUndo
);
767 GetDoc()->EndUndo( UNDO_INSLAYFMT
, NULL
);
770 /* #109161# If called from a shell try to propagate an
771 existing adjust item from rPos to the content node of the
773 pRet
= GetDoc()->MakeFlySection( eRndId
, &rPos
, &rSet
, pParent
, TRUE
);
777 SwFlyFrm
* pFrm
= pRet
->GetFrm( &aPt
);
779 SelectFlyFrm( *pFrm
, sal_True
);
782 GetLayout()->SetAssertFlyPages();
786 EndAllActionAndCall();
791 /***********************************************************************
795 #* Update : MA 12. Sep. 94
796 #***********************************************************************/
798 void SwFEShell::Insert( const String
& rGrfName
, const String
& rFltName
,
799 const Graphic
* pGraphic
,
800 const SfxItemSet
* pFlyAttrSet
,
801 const SfxItemSet
* pGrfAttrSet
,
804 SwFlyFrmFmt
* pFmt
= 0;
805 SET_CURR_SHELL( this );
807 SwShellCrsr
*pStartCursor
= dynamic_cast<SwShellCrsr
*>(this->GetSwCrsr());
808 SwShellCrsr
*pCursor
= pStartCursor
;
811 // Anker noch nicht oder unvollstaendig gesetzt ?
814 const SfxPoolItem
* pItem
;
815 if( SFX_ITEM_SET
== pFlyAttrSet
->GetItemState( RES_ANCHOR
, sal_False
,
818 SwFmtAnchor
* pAnchor
= (SwFmtAnchor
*)pItem
;
819 switch( pAnchor
->GetAnchorId())
822 case FLY_AUTO_CNTNT
: // LAYER_IMPL
824 if( !pAnchor
->GetCntntAnchor() )
826 pAnchor
->SetAnchor( pCursor
->GetPoint() );
830 if( !pAnchor
->GetCntntAnchor() )
832 lcl_SetNewFlyPos( *pCursor
->GetNode(),
833 *pAnchor
, GetCrsrDocPos() );
837 if( !pAnchor
->GetPageNum() )
839 pAnchor
->SetPageNum( pCursor
->GetPageNum(
840 sal_True
, &pCursor
->GetPtPos() ) );
848 pFmt
= GetDoc()->Insert(*pCursor
, rGrfName
,
851 pGrfAttrSet
, pFrmFmt
);
852 ASSERT( pFmt
, "Doc->Insert(notxt) failed." );
854 } while( (pCursor
= dynamic_cast<SwShellCrsr
*>(pCursor
->GetNext()))
861 const Point
aPt( GetCrsrDocPos() );
862 SwFlyFrm
* pFrm
= pFmt
->GetFrm( &aPt
);
865 SelectFlyFrm( *pFrm
, sal_True
);
867 GetLayout()->SetAssertFlyPages();
871 SwFlyFrmFmt
* SwFEShell::InsertObject( const svt::EmbeddedObjectRef
& xObj
,
872 const SfxItemSet
* pFlyAttrSet
,
873 const SfxItemSet
* pGrfAttrSet
,
876 SwFlyFrmFmt
* pFmt
= 0;
877 SET_CURR_SHELL( this );
879 FOREACHPAM_START( this )
880 pFmt
= GetDoc()->Insert(*PCURCRSR
, xObj
,
881 pFlyAttrSet
, pGrfAttrSet
, pFrmFmt
);
882 ASSERT( pFmt
, "Doc->Insert(notxt) failed." );
889 const Point
aPt( GetCrsrDocPos() );
890 SwFlyFrm
* pFrm
= pFmt
->GetFrm( &aPt
);
893 SelectFlyFrm( *pFrm
, sal_True
);
895 GetLayout()->SetAssertFlyPages();
902 void SwFEShell::Insert( SdrObject
& rDrawObj
,
903 const SfxItemSet
* pFlyAttrSet
,
904 SwFrmFmt
* pFrmFmt
, const Point
* pPt
)
906 SwDrawFrmFmt
* pFmt
= 0;
907 SET_CURR_SHELL( this );
911 SfxItemSet
* pSet
= 0;
912 const SfxPoolItem
* pItem
;
914 !pFlyAttrSet
->GetItemState( RES_ANCHOR
, sal_False
, &pItem
) ||
915 FLY_PAGE
!= ((SwFmtAnchor
*)pItem
)->GetAnchorId() )
917 pSet
= new SfxItemSet( GetDoc()->GetAttrPool(), aFrmFmtSetRange
);
918 pSet
->Put( SwFmtAnchor( FLY_AT_CNTNT
));
922 SwCrsrMoveState
aState( MV_SETONLYTEXT
);
923 SwPaM
aPam( pDoc
->GetNodes() );
924 Point
aTmpPt( *pPt
);
925 getIDocumentLayoutAccess()->GetRootFrm()->GetCrsrOfst( aPam
.GetPoint(), aTmpPt
, &aState
);
926 SwFrm
* pFrm
= aPam
.GetCntntNode()->GetFrm( 0, 0, sal_False
);
927 const Point
aRelPos( pPt
->X() - pFrm
->Frm().Left(),
928 pPt
->Y() - pFrm
->Frm().Top() );
929 // OD 2004-04-05 #i26791# - direct object positioning for <SwDoc::Insert(..)>
930 rDrawObj
.SetRelativePos( aRelPos
);
931 ::lcl_FindAnchorPos( *GetDoc(), *pPt
, *pFrm
, *(SfxItemSet
*)pFlyAttrSet
);
932 pFmt
= GetDoc()->Insert( aPam
, rDrawObj
, pFlyAttrSet
, pFrmFmt
);
939 FOREACHPAM_START( this )
940 pFmt
= GetDoc()->Insert(*PCURCRSR
, rDrawObj
,
941 pFlyAttrSet
, pFrmFmt
);
942 ASSERT( pFmt
, "Doc->Insert(sdrobj) failed." );
948 // --> OD 2005-01-07 #i40085# - follow-up of #i35635#
949 // move object to visible layer
950 SwContact
* pContact
= static_cast<SwContact
*>(rDrawObj
.GetUserCall());
953 pContact
->MoveObjToVisibleLayer( &rDrawObj
);
958 // das DrawObject selektieren
959 Imp()->GetDrawView()->MarkObj( &rDrawObj
, Imp()->GetPageView(),
960 sal_False
, sal_False
);
962 GetLayout()->SetAssertFlyPages();
965 /***********************************************************************
967 #* Methode : GetPageObjs
969 #* Update : MA 11. Jan. 95
970 #***********************************************************************/
972 void SwFEShell::GetPageObjs( SvPtrarr
& rFillArr
)
974 if( rFillArr
.Count() )
975 rFillArr
.Remove( 0, rFillArr
.Count() );
977 const SwFrmFmt
* pFmt
;
978 for( sal_uInt16 n
= 0; n
< pDoc
->GetSpzFrmFmts()->Count(); ++n
)
980 pFmt
= (const SwFrmFmt
*)(*pDoc
->GetSpzFrmFmts())[n
];
981 if( FLY_PAGE
== pFmt
->GetAnchor().GetAnchorId() )
982 rFillArr
.Insert( (VoidPtr
)pFmt
, rFillArr
.Count() );
986 /***********************************************************************
988 #* Methode : SetPageFlysNewPage
990 #* Update : MA 14. Feb. 95
991 #***********************************************************************/
993 void SwFEShell::SetPageObjsNewPage( SvPtrarr
& rFillArr
, int nOffset
)
995 if( !rFillArr
.Count() || !nOffset
)
1003 SwRootFrm
* pTmpRootFrm
= getIDocumentLayoutAccess()->GetRootFrm();
1004 sal_uInt16 nMaxPage
= pTmpRootFrm
->GetPageNum();
1005 sal_Bool bTmpAssert
= sal_False
;
1006 for( sal_uInt16 n
= 0; n
< rFillArr
.Count(); ++n
)
1008 pFmt
= (SwFrmFmt
*)rFillArr
[n
];
1009 if( USHRT_MAX
!= pDoc
->GetSpzFrmFmts()->GetPos( pFmt
))
1011 // FlyFmt ist noch gueltig, also behandeln
1012 SwFmtAnchor
aNewAnchor( pFmt
->GetAnchor() );
1013 if( FLY_PAGE
!= aNewAnchor
.GetAnchorId() ||
1014 0 >= ( nNewPage
= aNewAnchor
.GetPageNum() + nOffset
) )
1015 // chaos::Anchor wurde veraendert oder ungueltige SeitenNummer,
1016 // also nicht veraendern !!
1019 if( sal_uInt16(nNewPage
) > nMaxPage
)
1021 if ( RES_DRAWFRMFMT
== pFmt
->Which() )
1023 SwContact
*pCon
= pFmt
->FindContactObj();
1025 ((SwDrawContact
*)pCon
)->DisconnectFromLayout();
1029 bTmpAssert
= sal_True
;
1031 aNewAnchor
.SetPageNum( sal_uInt16(nNewPage
) );
1032 pDoc
->SetAttr( aNewAnchor
, *pFmt
);
1037 pTmpRootFrm
->SetAssertFlyPages();
1043 /***********************************************************************
1044 #* Class : SwFEShell
1045 #* Methode : GetFlyFrmAttr
1046 #* Beschreibung: Alle Attribute in dem 'Koerbchen' werden mit den
1047 #* Attributen des aktuellen FlyFrms gefuellt.
1048 #* Sind Attribute nicht zu fuellen weil fehl am Platz oder
1049 #* uneindeutig (Mehrfachtselektionen) so werden sie entfernt.
1050 #* Datum : MA 03. Nov. 92
1051 #* Update : MA 03. Feb. 94
1052 #***********************************************************************/
1054 sal_Bool
SwFEShell::GetFlyFrmAttr( SfxItemSet
&rSet
) const
1056 SwFlyFrm
*pFly
= FindFlyFrm();
1059 // --> OD 2006-11-08 #139670# - make code robust
1060 SwFrm
* pCurrFrm( GetCurrFrm() );
1064 "<SwFEShell::GetFlyFrmAttr(..)> - missing current frame. This is a serious defect, please inform OD." );
1068 pFly
= GetCurrFrm()->FindFlyFrm();
1071 ASSERT( !this, "GetFlyFrmAttr, no Fly selected." );
1076 SET_CURR_SHELL( (ViewShell
*)this );
1078 if( !rSet
.Set( pFly
->GetFmt()->GetAttrSet(), sal_True
) )
1081 //Und die Attribute durchschaufeln. Unerlaubte Attribute entfernen, dann
1082 //alle restlichen Attribute besorgen und eintragen.
1083 const SfxPoolItem
* pItem
;
1084 if( SFX_ITEM_SET
== rSet
.GetItemState( RES_ANCHOR
, sal_False
, &pItem
) )
1086 SwFmtAnchor
* pAnchor
= (SwFmtAnchor
*)pItem
;
1087 RndStdIds eType
= pAnchor
->GetAnchorId();
1089 if( FLY_PAGE
!= eType
)
1091 // OD 12.11.2003 #i22341# - content anchor of anchor item is needed.
1092 // Thus, don't overwrite anchor item by default contructed anchor item.
1093 //rSet.Put( SwFmtAnchor( eType ) );
1094 if( FLY_IN_CNTNT
== eType
)
1096 rSet
.ClearItem( RES_OPAQUE
);
1097 rSet
.ClearItem( RES_SURROUND
);
1101 rSet
.SetParent( pFly
->GetFmt()->GetAttrSet().GetParent() );
1102 //JP 11.02.97: Bug #35894#: die Attribute MUESSEN entfern werden!
1103 rSet
.ClearItem( RES_FILL_ORDER
);
1104 rSet
.ClearItem( RES_CNTNT
);
1105 //MA: Ersteinmal entfernen (Template by example usw.)
1106 rSet
.ClearItem( RES_CHAIN
);
1109 /***********************************************************************
1110 #* Class : SwFEShell
1111 #* Methode : SetFlyFrmAttr
1112 #* Beschreibung: Die Attribute des aktuellen Flys aendern sich.
1113 #* Datum : MA 03. Nov. 92
1114 #* Update : MA 01. Aug. 95
1115 #***********************************************************************/
1117 sal_Bool
SwFEShell::SetFlyFrmAttr( SfxItemSet
& rSet
)
1119 SET_CURR_SHELL( this );
1120 sal_Bool bRet
= sal_False
;
1124 SwFlyFrm
*pFly
= FindFlyFrm();
1127 ASSERT( GetCurrFrm(), "Crsr in parking zone" );
1128 pFly
= GetCurrFrm()->FindFlyFrm();
1129 ASSERT( pFly
, "SetFlyFrmAttr, no Fly selected." );
1134 const Point
aPt( pFly
->Frm().Pos() );
1136 if( SFX_ITEM_SET
== rSet
.GetItemState( RES_ANCHOR
, sal_False
))
1137 ::lcl_ChkAndSetNewAnchor( *pFly
, rSet
);
1138 SwFlyFrmFmt
* pFlyFmt
= (SwFlyFrmFmt
*)pFly
->GetFmt();
1140 if( GetDoc()->SetFlyFrmAttr( *pFlyFmt
, rSet
))
1143 SwFlyFrm
* pFrm
= pFlyFmt
->GetFrm( &aPt
);
1145 SelectFlyFrm( *pFrm
, sal_True
);
1147 GetLayout()->SetAssertFlyPages();
1150 EndAllActionAndCall();
1155 /*-- 30.03.2004 15:05:07---------------------------------------------------
1157 -----------------------------------------------------------------------*/
1158 sal_Bool
SwFEShell::SetDrawingAttr( SfxItemSet
& rSet
)
1160 sal_Bool bRet
= sal_False
;
1161 SET_CURR_SHELL( this );
1162 if ( !rSet
.Count() ||
1163 !Imp()->HasDrawView() )
1166 const SdrMarkList
&rMrkList
= Imp()->GetDrawView()->GetMarkedObjectList();
1167 if ( rMrkList
.GetMarkCount() != 1 )
1171 SdrObject
*pObj
= rMrkList
.GetMark( 0 )->GetMarkedSdrObj();
1172 SwFrmFmt
*pFmt
= FindFrmFmt( pObj
);
1174 if( SFX_ITEM_SET
== rSet
.GetItemState( RES_ANCHOR
, sal_False
))
1176 RndStdIds nNew
= ((SwFmtAnchor
&)rSet
.Get( RES_ANCHOR
)).GetAnchorId();
1177 if ( nNew
!= pFmt
->GetAnchor().GetAnchorId() )
1180 // --> OD 2004-06-17 #i26791# - clear anchor attribute in item set,
1181 // because method <ChgAnchor(..)> takes care of it.
1182 rSet
.ClearItem( RES_ANCHOR
);
1186 if( GetDoc()->SetFlyFrmAttr( *pFmt
, rSet
))
1190 SelectObj( aTmp
, 0, pObj
);
1192 EndAllActionAndCall();
1198 /***********************************************************************
1199 #* Class : SwFEShell
1200 #* Methode : ResetFlyFrmAttr
1201 #* Beschreibung: Das gewuenschte Attribut oder die im Set befindlichen
1202 #* werden zurueckgesetzt.
1203 #* Datum : MA 14. Mar. 97
1204 #* Update : MA 14. Mar. 97
1205 #***********************************************************************/
1207 sal_Bool
SwFEShell::ResetFlyFrmAttr( sal_uInt16 nWhich
, const SfxItemSet
* pSet
)
1209 sal_Bool bRet
= sal_False
;
1211 if( RES_ANCHOR
!= nWhich
&& RES_CHAIN
!= nWhich
&& RES_CNTNT
!= nWhich
)
1213 SET_CURR_SHELL( this );
1215 SwFlyFrm
*pFly
= FindFlyFrm();
1218 ASSERT( GetCurrFrm(), "Crsr in parking zone" );
1219 pFly
= GetCurrFrm()->FindFlyFrm();
1220 ASSERT( pFly
, "SetFlyFrmAttr, no Fly selected." );
1229 SfxItemIter
aIter( *pSet
);
1230 const SfxPoolItem
* pItem
= aIter
.FirstItem();
1233 if( !IsInvalidItem( pItem
) &&
1234 RES_ANCHOR
!= ( nWhich
= pItem
->Which() ) &&
1235 RES_CHAIN
!= nWhich
&& RES_CNTNT
!= nWhich
)
1236 pFly
->GetFmt()->ResetFmtAttr( nWhich
);
1237 pItem
= aIter
.NextItem();
1241 pFly
->GetFmt()->ResetFmtAttr( nWhich
);
1244 EndAllActionAndCall();
1245 GetDoc()->SetModified();
1251 /***********************************************************************
1252 #* Class : SwFEShell
1253 #* Methode : GetCurFrmFmt
1254 #* Beschreibung: liefert wenn Rahmen, dann Rahmenvorlage, sonst 0
1255 #* Datum : ST 04. Jun. 93
1257 #***********************************************************************/
1259 SwFrmFmt
* SwFEShell::GetCurFrmFmt() const
1262 SwLayoutFrm
*pFly
= FindFlyFrm();
1263 if( pFly
&& ( pRet
= (SwFrmFmt
*)pFly
->GetFmt()->DerivedFrom() ) ==
1264 GetDoc()->GetDfltFrmFmt() )
1269 /******************************************************************************
1270 * Methode : void SwFEShell::SetFrmFmt(SwFrmFmt *pNewFmt)
1272 * Erstellt : OK 14.04.94 15:40
1273 * Aenderung : MA 23. Apr. 97
1274 ******************************************************************************/
1276 void SwFEShell::SetFrmFmt( SwFrmFmt
*pNewFmt
, sal_Bool bKeepOrient
, Point
* pDocPos
)
1281 const SwFrmFmt
* pFmt
= GetFmtFromObj( *pDocPos
);
1283 if(PTR_CAST(SwFlyFrmFmt
, pFmt
))
1284 pFly
= ((SwFlyFrmFmt
*)pFmt
)->GetFrm();
1287 pFly
= FindFlyFrm();
1288 ASSERT( pFly
, "SetFrmFmt: kein Frame" );
1292 SET_CURR_SHELL( this );
1294 SwFlyFrmFmt
* pFlyFmt
= (SwFlyFrmFmt
*)pFly
->GetFmt();
1295 const Point
aPt( pFly
->Frm().Pos() );
1297 SfxItemSet
* pSet
= 0;
1298 const SfxPoolItem
* pItem
;
1299 if( SFX_ITEM_SET
== pNewFmt
->GetItemState( RES_ANCHOR
, sal_False
, &pItem
))
1301 pSet
= new SfxItemSet( GetDoc()->GetAttrPool(), aFrmFmtSetRange
);
1302 pSet
->Put( *pItem
);
1303 if( !::lcl_ChkAndSetNewAnchor( *pFly
, *pSet
))
1304 delete pSet
, pSet
= 0;
1307 if( GetDoc()->SetFrmFmtToFly( *pFlyFmt
, *pNewFmt
, pSet
, bKeepOrient
))
1309 SwFlyFrm
* pFrm
= pFlyFmt
->GetFrm( &aPt
);
1311 SelectFlyFrm( *pFrm
, sal_True
);
1313 GetLayout()->SetAssertFlyPages();
1318 EndAllActionAndCall();
1322 /*************************************************************************
1324 |* SwFEShell::GetFlyFrmFmt()
1326 |* Ersterstellung OK 23.06.93 13:15
1327 |* Letzte Aenderung OK 23.06.93 13:15
1329 *************************************************************************/
1331 const SwFrmFmt
* SwFEShell::GetFlyFrmFmt() const
1333 const SwFlyFrm
* pFly
= FindFlyFrm();
1336 SwFrm
* pCurrFrm
= GetCurrFrm();
1337 pFly
= pCurrFrm
? pCurrFrm
->FindFlyFrm() : 0;
1340 return pFly
->GetFmt();
1344 SwFrmFmt
* SwFEShell::GetFlyFrmFmt()
1346 SwFlyFrm
* pFly
= FindFlyFrm();
1349 SwFrm
* pCurrFrm
= GetCurrFrm();
1350 pFly
= pCurrFrm
? pCurrFrm
->FindFlyFrm() : 0;
1353 return pFly
->GetFmt();
1357 /*************************************************************************
1359 |* SwFEShell::GetFlyRect()
1361 |* Ersterstellung AMA 6. Mae. 97
1362 |* Letzte Aenderung AMA 6. Mae. 97
1364 *************************************************************************/
1366 SwRect
SwFEShell::GetFlyRect() const
1368 SwCntntFrm
*pCntnt
= GetCurrFrm( sal_False
);
1369 SwFlyFrm
*pFly
= pCntnt
? pCntnt
->FindFlyFrm() : 0;
1379 /*************************************************************************
1381 |* SwFEShell::GetObjRect()
1383 |* Ersterstellung MA 22. Aug. 93
1384 |* Letzte Aenderung MA 11. Jan. 95
1386 *************************************************************************/
1388 SwRect
SwFEShell::GetObjRect() const
1390 if( Imp()->HasDrawView() )
1391 return Imp()->GetDrawView()->GetAllMarkedRect();
1399 void SwFEShell::SetObjRect( const SwRect
& rRect
)
1401 if ( Imp()->HasDrawView() )
1403 Imp()->GetDrawView()->SetAllMarkedRect( rRect
.SVRect() );
1404 CallChgLnk(); // rufe das AttrChangeNotify auf der UI-Seite.
1408 /***********************************************************************
1409 #* Class : SwFEShell
1410 #* Methode : RequestObjectResize()
1411 #* Datum : MA 10. Feb. 95
1412 #* Update : MA 13. Jul. 95
1413 #***********************************************************************/
1415 Size
SwFEShell::RequestObjectResize( const SwRect
&rRect
, const uno::Reference
< embed::XEmbeddedObject
>& xObj
)
1419 SwFlyFrm
*pFly
= FindFlyFrm( xObj
);
1422 aResult
= rRect
.SSize();
1426 aResult
= pFly
->Prt().SSize();
1428 sal_Bool bPosProt
= pFly
->GetFmt()->GetProtect().IsPosProtected();
1429 sal_Bool bSizeProt
= pFly
->GetFmt()->GetProtect().IsSizeProtected();
1433 //MA wir lassen den Fly nicht Clippen, damit die Ole-Server mit
1434 //beliebigen Wuenschen kommen koennen. Die Formatierung uebernimmt das
1435 //Clippen. Die richtige Darstellung wird per Scalierung erledigt.
1436 //Die Scalierung wird von SwNoTxtFrm::Format durch einen Aufruf von
1437 //SwWrtShell::CalcAndSetScale() erledigt.
1438 if ( rRect
.SSize() != pFly
->Prt().SSize() && !bSizeProt
)
1440 Size
aSz( rRect
.SSize() );
1442 //JP 28.02.2001: Task 74707 - ask for fly in fly with automatic size
1444 const SwFrm
* pAnchor
;
1445 const SwTxtNode
* pTNd
;
1446 const SwpHints
* pHts
;
1447 const SwFmtFrmSize
& rFrmSz
= pFly
->GetFmt()->GetFrmSize();
1448 if( bCheckForOLEInCaption
&&
1449 0 != rFrmSz
.GetWidthPercent() &&
1450 0 != (pAnchor
= pFly
->GetAnchorFrm()) &&
1451 pAnchor
->IsTxtFrm() &&
1452 !pAnchor
->GetNext() && !pAnchor
->GetPrev() &&
1453 pAnchor
->GetUpper()->IsFlyFrm() &&
1454 0 != ( pTNd
= ((SwTxtFrm
*)pAnchor
)->GetNode()->GetTxtNode()) &&
1455 0 != ( pHts
= pTNd
->GetpSwpHints() ))
1457 // search for a sequence field:
1458 const SfxPoolItem
* pItem
;
1459 for( USHORT n
= 0, nEnd
= pHts
->Count(); n
< nEnd
; ++n
)
1460 if( RES_TXTATR_FIELD
== ( pItem
=
1461 &(*pHts
)[ n
]->GetAttr())->Which() &&
1462 TYP_SEQFLD
== ((SwFmtFld
*)pItem
)->GetFld()->GetTypeId() )
1464 // sequence field found
1465 SwFlyFrm
* pChgFly
= (SwFlyFrm
*)pAnchor
->GetUpper();
1466 // calculate the changed size:
1467 // width must change, height can change
1468 Size
aNewSz( aSz
.Width() + pChgFly
->Frm().Width() -
1469 pFly
->Prt().Width(), aSz
.Height() );
1471 SwFrmFmt
*pFmt
= pChgFly
->GetFmt();
1472 SwFmtFrmSize
aFrmSz( pFmt
->GetFrmSize() );
1473 aFrmSz
.SetWidth( aNewSz
.Width() );
1474 if( ATT_MIN_SIZE
!= aFrmSz
.GetHeightSizeType() )
1476 aNewSz
.Height() += pChgFly
->Frm().Height() -
1477 pFly
->Prt().Height();
1478 if( Abs( aNewSz
.Height() - pChgFly
->Frm().Height()) > 1 )
1479 aFrmSz
.SetHeight( aNewSz
.Height() );
1481 // uebers Doc fuers Undo!
1482 pFmt
->GetDoc()->SetAttr( aFrmSz
, *pFmt
);
1487 // set the new Size at the fly themself
1488 if ( pFly
->Prt().Height() > 0 && pFly
->Prt().Width() > 0 )
1490 aSz
.Width() += pFly
->Frm().Width() - pFly
->Prt().Width();
1491 aSz
.Height()+= pFly
->Frm().Height()- pFly
->Prt().Height();
1493 aResult
= pFly
->ChgSize( aSz
);
1495 //Wenn sich das Objekt aendert ist die Kontur hoechstwahrscheinlich daneben.
1496 ASSERT( pFly
->Lower()->IsNoTxtFrm(), "Request ohne NoTxt" );
1497 SwNoTxtNode
*pNd
= ((SwCntntFrm
*)pFly
->Lower())->GetNode()->GetNoTxtNode();
1498 ASSERT( pNd
, "Request ohne Node" );
1499 pNd
->SetContour( 0 );
1503 //Wenn nur die Size angepasst werden soll, so wird eine Pos mit
1504 //ausgezeichneten Werten transportiert.
1505 Point
aPt( pFly
->Prt().Pos() );
1506 aPt
+= pFly
->Frm().Pos();
1507 if ( rRect
.Top() != LONG_MIN
&& rRect
.Pos() != aPt
&& !bPosProt
)
1510 aPt
.X() -= pFly
->Prt().Left();
1511 aPt
.Y() -= pFly
->Prt().Top();
1512 //Bei Absatzgebundenen Flys muss ausgehend von der neuen Position ein
1513 //neuer Anker gesetzt werden. Anker und neue RelPos werden vom Fly
1514 //selbst berechnet und gesetzt.
1515 if( pFly
->IsFlyAtCntFrm() )
1516 ((SwFlyAtCntFrm
*)pFly
)->SetAbsPos( aPt
);
1519 const SwFrmFmt
*pFmt
= pFly
->GetFmt();
1520 const SwFmtVertOrient
&rVert
= pFmt
->GetVertOrient();
1521 const SwFmtHoriOrient
&rHori
= pFmt
->GetHoriOrient();
1522 const long lXDiff
= aPt
.X() - pFly
->Frm().Left();
1523 const long lYDiff
= aPt
.Y() - pFly
->Frm().Top();
1524 const Point
aTmp( rHori
.GetPos() + lXDiff
,
1525 rVert
.GetPos() + lYDiff
);
1526 pFly
->ChgRelPos( aTmp
);
1535 /***********************************************************************
1536 #* Class : SwFEShell
1537 #* Methode : WizzardFindCurFrmFmt
1538 #* Datum : JP 31.07.95
1539 #* Update : JP 31.07.95
1540 #***********************************************************************/
1542 SwFrmFmt
* SwFEShell::WizzardGetFly()
1544 // mal nicht uebers Layout den Fly suchen. Dann kann auch ohne gueltiges
1545 // Layout ein Rahmen geloescht werden. ( z.B.: fuer die Wizard's )
1546 SwSpzFrmFmts
& rSpzArr
= *pDoc
->GetSpzFrmFmts();
1547 sal_uInt16 nCnt
= rSpzArr
.Count();
1550 SwNodeIndex
& rCrsrNd
= GetCrsr()->GetPoint()->nNode
;
1551 if( rCrsrNd
.GetIndex() > pDoc
->GetNodes().GetEndOfExtras().GetIndex() )
1552 // Cusor steht im Body-Bereich!
1555 for( sal_uInt16 n
= 0; n
< nCnt
; ++n
)
1557 SwFrmFmt
* pFmt
= rSpzArr
[ n
];
1558 const SwNodeIndex
* pIdx
= pFmt
->GetCntnt( sal_False
).GetCntntIdx();
1559 SwStartNode
* pSttNd
;
1561 0 != ( pSttNd
= pIdx
->GetNode().GetStartNode() ) &&
1562 pSttNd
->GetIndex() < rCrsrNd
.GetIndex() &&
1563 rCrsrNd
.GetIndex() < pSttNd
->EndOfSectionIndex() )
1565 // gefunden: also raus damit
1573 void SwFEShell::SetFlyName( const String
& rName
)
1575 SwLayoutFrm
*pFly
= FindFlyFrm();
1577 GetDoc()->SetFlyName( *(SwFlyFrmFmt
*)pFly
->GetFmt(), rName
);
1579 ASSERT( !this, "kein FlyFrame selektiert" )
1583 const String
& SwFEShell::GetFlyName() const
1585 SwLayoutFrm
*pFly
= FindFlyFrm();
1587 return pFly
->GetFmt()->GetName();
1589 ASSERT( !this, "kein FlyFrame selektiert" )
1594 String
SwFEShell::GetUniqueGrfName() const
1596 return GetDoc()->GetUniqueGrfName();
1599 const SwFrmFmt
* SwFEShell::IsURLGrfAtPos( const Point
& rPt
, String
* pURL
,
1600 String
*pTargetFrameName
,
1601 String
*pDescription
) const
1603 if( !Imp()->HasDrawView() )
1608 const SwFrmFmt
* pRet
= 0;
1609 SwDrawView
*pDView
= (SwDrawView
*)Imp()->GetDrawView();
1611 sal_uInt16 nOld
= pDView
->GetHitTolerancePixel();
1612 pDView
->SetHitTolerancePixel( 2 );
1614 if( pDView
->PickObj( rPt
, pDView
->getHitTolLog(), pObj
, pPV
,SDRSEARCH_PICKMACRO
) &&
1615 pObj
->ISA(SwVirtFlyDrawObj
) )
1617 SwFlyFrm
*pFly
= ((SwVirtFlyDrawObj
*)pObj
)->GetFlyFrm();
1618 const SwFmtURL
&rURL
= pFly
->GetFmt()->GetURL();
1619 if( rURL
.GetURL().Len() || rURL
.GetMap() )
1621 BOOL bSetTargetFrameName
= pTargetFrameName
!= 0;
1622 BOOL bSetDescription
= pDescription
!= 0;
1623 if ( rURL
.GetMap() )
1625 IMapObject
*pObject
= pFly
->GetFmt()->GetIMapObject( rPt
, pFly
);
1626 if ( pObject
&& pObject
->GetURL().Len() )
1629 *pURL
= pObject
->GetURL();
1630 if ( bSetTargetFrameName
&& pObject
->GetTarget().Len() )
1632 bSetTargetFrameName
= sal_False
;
1633 *pTargetFrameName
= pObject
->GetTarget();
1635 if ( bSetDescription
)
1637 bSetDescription
= sal_False
;
1638 *pDescription
= pObject
->GetAltText();
1640 pRet
= pFly
->GetFmt();
1647 *pURL
= rURL
.GetURL();
1648 if( rURL
.IsServerMap() )
1650 // dann die rel. Pixel Position anhaengen !!
1652 aPt
-= pFly
->Frm().Pos();
1653 // ohne MapMode-Offset, ohne Offset, o ... !!!!!
1654 aPt
= GetOut()->LogicToPixel(
1655 aPt
, MapMode( MAP_TWIP
) );
1656 ((( *pURL
+= '?' ) += String::CreateFromInt32( aPt
.X() ))
1657 += ',' ) += String::CreateFromInt32(aPt
.Y() );
1660 pRet
= pFly
->GetFmt();
1662 if ( bSetTargetFrameName
)
1663 *pTargetFrameName
= rURL
.GetTargetFrameName();
1664 if ( bSetDescription
)
1665 *pDescription
= pFly
->GetFmt()->GetName();
1668 pDView
->SetHitTolerancePixel( nOld
);
1672 const Graphic
*SwFEShell::GetGrfAtPos( const Point
&rPt
,
1673 String
&rName
, sal_Bool
&rbLink
) const
1675 if( !Imp()->HasDrawView() )
1680 SwDrawView
*pDView
= (SwDrawView
*)Imp()->GetDrawView();
1682 if( pDView
->PickObj( rPt
, pDView
->getHitTolLog(), pObj
, pPV
) && pObj
->ISA(SwVirtFlyDrawObj
) )
1684 SwFlyFrm
*pFly
= ((SwVirtFlyDrawObj
*)pObj
)->GetFlyFrm();
1685 if ( pFly
->Lower() && pFly
->Lower()->IsNoTxtFrm() )
1687 SwGrfNode
*pNd
= ((SwCntntFrm
*)pFly
->Lower())->GetNode()->GetGrfNode();
1690 if ( pNd
->IsGrfLink() )
1692 //Halbfertige Grafik?
1693 ::sfx2::SvLinkSource
* pLnkObj
= pNd
->GetLink()->GetObj();
1694 if( pLnkObj
&& pLnkObj
->IsPending() )
1699 pNd
->GetFileFilterNms( &rName
, 0 );
1701 rName
= pFly
->GetFmt()->GetName();
1702 pNd
->SwapIn( sal_True
);
1703 return &pNd
->GetGrf();
1711 const SwFrmFmt
* SwFEShell::GetFmtFromObj( const Point
& rPt
, SwRect
** pRectToFill
) const
1715 if( Imp()->HasDrawView() )
1718 SdrPageView
* pPView
;
1720 SwDrawView
*pDView
= (SwDrawView
*)Imp()->GetDrawView();
1722 sal_uInt16 nOld
= pDView
->GetHitTolerancePixel();
1723 // Tattergrenze fuer Drawing-SS
1724 pDView
->SetHitTolerancePixel( pDView
->GetMarkHdlSizePixel()/2 );
1726 if( pDView
->PickObj( rPt
, pDView
->getHitTolLog(), pObj
, pPView
, SDRSEARCH_PICKMARKABLE
) )
1728 // dann teste mal was es ist:
1729 if ( pObj
->ISA(SwVirtFlyDrawObj
) )
1730 pRet
= ((SwVirtFlyDrawObj
*)pObj
)->GetFmt();
1731 else if ( pObj
->GetUserCall() ) //nicht fuer Gruppenobjekte
1732 pRet
= ((SwDrawContact
*)pObj
->GetUserCall())->GetFmt();
1733 if(pRet
&& pRectToFill
)
1734 **pRectToFill
= pObj
->GetCurrentBoundRect();
1736 pDView
->SetHitTolerancePixel( nOld
);
1741 // returns a format too, if the point is over the text of any fly
1742 const SwFrmFmt
* SwFEShell::GetFmtFromAnyObj( const Point
& rPt
) const
1744 const SwFrmFmt
* pRet
= GetFmtFromObj( rPt
);
1745 if( !pRet
|| RES_FLYFRMFMT
== pRet
->Which() )
1747 SwPosition
aPos( *GetCrsr()->GetPoint() );
1749 GetLayout()->GetCrsrOfst( &aPos
, aPt
);
1750 SwCntntNode
*pNd
= aPos
.nNode
.GetNode().GetCntntNode();
1751 SwFrm
* pFrm
= pNd
->GetFrm( &rPt
)->FindFlyFrm();
1752 pRet
= pFrm
? ((SwLayoutFrm
*)pFrm
)->GetFmt() : 0;
1757 ObjCntType
SwFEShell::GetObjCntType( const SdrObject
& rObj
) const
1759 ObjCntType eType
= OBJCNT_NONE
;
1761 // OD 23.06.2003 #108784# - investigate 'master' drawing object, if method
1762 // is called for a 'virtual' drawing object.
1763 const SdrObject
* pInvestigatedObj
;
1764 if ( rObj
.ISA(SwDrawVirtObj
) )
1766 const SwDrawVirtObj
* pDrawVirtObj
= static_cast<const SwDrawVirtObj
*>(&rObj
);
1767 pInvestigatedObj
= &(pDrawVirtObj
->GetReferencedObj());
1771 pInvestigatedObj
= &rObj
;
1774 if( FmFormInventor
== pInvestigatedObj
->GetObjInventor() )
1776 eType
= OBJCNT_CONTROL
;
1777 uno::Reference
< awt::XControlModel
> xModel
=
1778 ((SdrUnoObj
&)(*pInvestigatedObj
)).GetUnoControlModel();
1782 OUString sName
= OUString::createFromAscii("ButtonType");
1783 uno::Reference
< beans::XPropertySet
> xSet(xModel
, uno::UNO_QUERY
);
1785 uno::Reference
< beans::XPropertySetInfo
> xInfo
= xSet
->getPropertySetInfo();
1786 if(xInfo
->hasPropertyByName( sName
))
1788 beans::Property xProperty
= xInfo
->getPropertyByName( sName
);
1789 aVal
= xSet
->getPropertyValue( sName
);
1790 if( aVal
.getValue() && form::FormButtonType_URL
== *((form::FormButtonType
*)aVal
.getValue()) )
1791 eType
= OBJCNT_URLBUTTON
;
1795 else if( pInvestigatedObj
->ISA(SwVirtFlyDrawObj
) )
1797 SwFlyFrm
*pFly
= ((SwVirtFlyDrawObj
&)(*pInvestigatedObj
)).GetFlyFrm();
1798 if ( pFly
->Lower() && pFly
->Lower()->IsNoTxtFrm() )
1800 if ( ((SwCntntFrm
*)pFly
->Lower())->GetNode()->GetGrfNode() )
1808 // --> OD 2006-11-06 #130889# - make code robust
1809 // else if( pInvestigatedObj->ISA( SdrObjGroup ) &&
1811 // ((SwDrawContact*)GetUserCall(pInvestigatedObj))->GetFmt()->GetAnchor().GetAnchorId() )
1812 // eType = OBJCNT_GROUPOBJ;
1813 else if ( pInvestigatedObj
->ISA( SdrObjGroup
) )
1815 SwDrawContact
* pDrawContact( dynamic_cast<SwDrawContact
*>(GetUserCall( pInvestigatedObj
) ) );
1816 if ( !pDrawContact
)
1819 "<SwFEShell::GetObjCntType(..)> - missing draw contact object" );
1820 eType
= OBJCNT_NONE
;
1824 SwFrmFmt
* pFrmFmt( pDrawContact
->GetFmt() );
1828 "<SwFEShell::GetObjCntType(..)> - missing frame format" );
1829 eType
= OBJCNT_NONE
;
1831 else if ( FLY_IN_CNTNT
!= pFrmFmt
->GetAnchor().GetAnchorId() )
1833 eType
= OBJCNT_GROUPOBJ
;
1839 eType
= OBJCNT_SIMPLE
;
1843 ObjCntType
SwFEShell::GetObjCntType( const Point
&rPt
, SdrObject
*&rpObj
) const
1845 ObjCntType eType
= OBJCNT_NONE
;
1847 if( Imp()->HasDrawView() )
1850 SdrPageView
* pPView
;
1852 SwDrawView
*pDView
= (SwDrawView
*)Imp()->GetDrawView();
1854 sal_uInt16 nOld
= pDView
->GetHitTolerancePixel();
1855 // Tattergrenze fuer Drawing-SS
1856 pDView
->SetHitTolerancePixel( pDView
->GetMarkHdlSizePixel()/2 );
1858 if( pDView
->PickObj( rPt
, pDView
->getHitTolLog(), pObj
, pPView
, SDRSEARCH_PICKMARKABLE
) )
1859 eType
= GetObjCntType( *(rpObj
= pObj
) );
1861 pDView
->SetHitTolerancePixel( nOld
);
1866 ObjCntType
SwFEShell::GetObjCntTypeOfSelection( SdrObject
** ppObj
) const
1868 ObjCntType eType
= OBJCNT_NONE
;
1870 if( Imp()->HasDrawView() )
1872 const SdrMarkList
&rMrkList
= Imp()->GetDrawView()->GetMarkedObjectList();
1873 for( sal_uInt32 i
= 0, nE
= rMrkList
.GetMarkCount(); i
< nE
; ++i
)
1875 SdrObject
* pObj
= rMrkList
.GetMark( i
)->GetMarkedSdrObj();
1876 ObjCntType eTmp
= GetObjCntType( *pObj
);
1880 if( ppObj
) *ppObj
= pObj
;
1882 else if( eTmp
!= eType
)
1884 eType
= OBJCNT_DONTCARE
;
1885 // einmal DontCare, immer DontCare!
1894 sal_Bool
SwFEShell::ReplaceSdrObj( const String
& rGrfName
, const String
& rFltName
,
1895 const Graphic
* pGrf
)
1897 SET_CURR_SHELL( this );
1899 sal_Bool bRet
= sal_False
;
1900 const SdrMarkList
*pMrkList
;
1901 if( Imp()->HasDrawView() && 1 ==
1902 ( pMrkList
= &Imp()->GetDrawView()->GetMarkedObjectList())->GetMarkCount() )
1904 SdrObject
* pObj
= pMrkList
->GetMark( 0 )->GetMarkedSdrObj();
1905 SwFrmFmt
*pFmt
= FindFrmFmt( pObj
);
1907 // Attribute sichern und dann an der Grafik setzen
1908 SfxItemSet
aFrmSet( pDoc
->GetAttrPool(),
1909 pFmt
->GetAttrSet().GetRanges() );
1910 aFrmSet
.Set( pFmt
->GetAttrSet() );
1912 // Groesse und Position setzen ??
1913 if( !pObj
->ISA(SwVirtFlyDrawObj
) )
1916 const Rectangle
&rBound
= pObj
->GetSnapRect();
1917 Point
aRelPos( pObj
->GetRelativePos() );
1919 const long nWidth
= rBound
.Right() - rBound
.Left();
1920 const long nHeight
= rBound
.Bottom() - rBound
.Top();
1921 aFrmSet
.Put( SwFmtFrmSize( ATT_MIN_SIZE
,
1922 Max( nWidth
, long(MINFLY
) ),
1923 Max( nHeight
, long(MINFLY
) )));
1925 if( SFX_ITEM_SET
!= aFrmSet
.GetItemState( RES_HORI_ORIENT
))
1926 aFrmSet
.Put( SwFmtHoriOrient( aRelPos
.X(), text::HoriOrientation::NONE
, text::RelOrientation::FRAME
));
1928 if( SFX_ITEM_SET
!= aFrmSet
.GetItemState( RES_VERT_ORIENT
))
1929 aFrmSet
.Put( SwFmtVertOrient( aRelPos
.Y(), text::VertOrientation::NONE
, text::RelOrientation::FRAME
));
1938 // das "Sdr-Object" loeschen und dafuer die Grafik einfuegen
1941 pFmt
= GetDoc()->Insert( *GetCrsr(), rGrfName
, rFltName
, pGrf
, &aFrmSet
, NULL
, NULL
);
1943 // die Ordnungsnummer (Z-Order) noch uebertragen
1944 // JP 04.07.98: klappt aber nicht richtig!
1945 //SdrObject* pNewObj = ::FindSdrObject( pFmt );
1946 //pNewObj->SetOrdNum( nOrdNum );
1955 static USHORT
SwFmtGetPageNum(const SwFlyFrmFmt
* pFmt
)
1957 ASSERT(pFmt
!= NULL
, "invalid argument");
1959 SwFlyFrm
* pFrm
= pFmt
->GetFrm();
1964 aResult
= pFrm
->GetPhyPageNum();
1966 aResult
= pFmt
->GetAnchor().GetPageNum();
1971 #include <fmtcnct.hxx>
1973 void SwFEShell::GetConnectableFrmFmts(SwFrmFmt
& rFmt
,
1974 const String
& rReference
,
1976 ::std::vector
< String
> & aPrevPageVec
,
1977 ::std::vector
< String
> & aThisPageVec
,
1978 ::std::vector
< String
> & aNextPageVec
,
1979 ::std::vector
< String
> & aRestVec
)
1983 SwFmtChain rChain
= rFmt
.GetChain();
1984 SwFrmFmt
* pOldChainNext
= (SwFrmFmt
*) rChain
.GetNext();
1985 SwFrmFmt
* pOldChainPrev
= (SwFrmFmt
*) rChain
.GetPrev();
1988 pDoc
->Unchain(rFmt
);
1991 pDoc
->Unchain(*pOldChainPrev
);
1993 sal_uInt16 nCnt
= pDoc
->GetFlyCount(FLYCNTTYPE_FRM
);
1995 /* potential successors resp. predecessors */
1996 ::std::vector
< const SwFrmFmt
* > aTmpSpzArray
;
1998 (SwFrmFmt
*) pDoc
->FindFlyByName(rReference
);
2000 for (sal_uInt16 n
= 0; n
< nCnt
; n
++)
2002 const SwFrmFmt
& rFmt1
= *(pDoc
->GetFlyNum(n
, FLYCNTTYPE_FRM
));
2005 pFmt is a potential successor of rFmt if it is chainable after
2008 pFmt is a potential predecessor of rFmt if rFmt is chainable
2015 nChainState
= pDoc
->Chainable(rFmt
, rFmt1
);
2017 nChainState
= pDoc
->Chainable(rFmt1
, rFmt
);
2019 if (nChainState
== SW_CHAIN_OK
)
2021 aTmpSpzArray
.push_back(&rFmt1
);
2027 if (aTmpSpzArray
.size() > 0)
2029 aPrevPageVec
.clear();
2030 aThisPageVec
.clear();
2031 aNextPageVec
.clear();
2034 /* number of page rFmt resides on */
2035 USHORT nPageNum
= SwFmtGetPageNum((SwFlyFrmFmt
*) &rFmt
);
2037 ::std::vector
< const SwFrmFmt
* >::const_iterator aIt
;
2039 for (aIt
= aTmpSpzArray
.begin(); aIt
!= aTmpSpzArray
.end(); aIt
++)
2041 String aString
= (*aIt
)->GetName();
2043 /* rFmt is not a vaild successor or predecessor of
2045 if (aString
!= rReference
&& aString
!= rFmt
.GetName())
2048 SwFmtGetPageNum((SwFlyFrmFmt
*) *aIt
);
2050 if (nNum1
== nPageNum
-1)
2051 aPrevPageVec
.push_back(aString
);
2052 else if (nNum1
== nPageNum
)
2053 aThisPageVec
.push_back(aString
);
2054 else if (nNum1
== nPageNum
+ 1)
2055 aNextPageVec
.push_back(aString
);
2057 aRestVec
.push_back(aString
);
2064 pDoc
->Chain(rFmt
, *pOldChainNext
);
2067 pDoc
->Chain(*pOldChainPrev
, rFmt
);
2072 // --> OD 2009-07-13 #i73249#
2073 const String
SwFEShell::GetObjTitle() const
2077 if ( Imp()->HasDrawView() )
2079 const SdrMarkList
*pMrkList
= &Imp()->GetDrawView()->GetMarkedObjectList();
2080 if ( pMrkList
->GetMarkCount() == 1 )
2082 const SdrObject
* pObj
= pMrkList
->GetMark( 0 )->GetMarkedSdrObj();
2083 const SwFrmFmt
* pFmt
= FindFrmFmt( pObj
);
2084 if ( pFmt
->Which() == RES_FLYFRMFMT
)
2086 aTitle
= dynamic_cast<const SwFlyFrmFmt
*>(pFmt
)->GetObjTitle();
2090 aTitle
= pObj
->GetTitle();
2098 void SwFEShell::SetObjTitle( const String
& rTitle
)
2100 if ( Imp()->HasDrawView() )
2102 const SdrMarkList
*pMrkList
= &Imp()->GetDrawView()->GetMarkedObjectList();
2103 if ( pMrkList
->GetMarkCount() == 1 )
2105 SdrObject
* pObj
= pMrkList
->GetMark( 0 )->GetMarkedSdrObj();
2106 SwFrmFmt
* pFmt
= FindFrmFmt( pObj
);
2107 if ( pFmt
->Which() == RES_FLYFRMFMT
)
2109 GetDoc()->SetFlyFrmTitle( *(dynamic_cast<SwFlyFrmFmt
*>(pFmt
)),
2114 pObj
->SetTitle( rTitle
);
2120 const String
SwFEShell::GetObjDescription() const
2122 String aDescription
;
2124 if ( Imp()->HasDrawView() )
2126 const SdrMarkList
*pMrkList
= &Imp()->GetDrawView()->GetMarkedObjectList();
2127 if ( pMrkList
->GetMarkCount() == 1 )
2129 const SdrObject
* pObj
= pMrkList
->GetMark( 0 )->GetMarkedSdrObj();
2130 const SwFrmFmt
* pFmt
= FindFrmFmt( pObj
);
2131 if ( pFmt
->Which() == RES_FLYFRMFMT
)
2133 aDescription
= dynamic_cast<const SwFlyFrmFmt
*>(pFmt
)->GetObjDescription();
2137 aDescription
= pObj
->GetDescription();
2142 return aDescription
;
2145 void SwFEShell::SetObjDescription( const String
& rDescription
)
2147 if ( Imp()->HasDrawView() )
2149 const SdrMarkList
*pMrkList
= &Imp()->GetDrawView()->GetMarkedObjectList();
2150 if ( pMrkList
->GetMarkCount() == 1 )
2152 SdrObject
* pObj
= pMrkList
->GetMark( 0 )->GetMarkedSdrObj();
2153 SwFrmFmt
* pFmt
= FindFrmFmt( pObj
);
2154 if ( pFmt
->Which() == RES_FLYFRMFMT
)
2156 GetDoc()->SetFlyFrmDescription( *(dynamic_cast<SwFlyFrmFmt
*>(pFmt
)),
2161 pObj
->SetDescription( rDescription
);