2000-09-18 23:08:29 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2005-09-09 03:11:38 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2000-09-18 23:08:29 +00:00
|
|
|
*
|
2005-09-09 03:11:38 +00:00
|
|
|
* $RCSfile: flycnt.cxx,v $
|
2000-09-18 23:08:29 +00:00
|
|
|
*
|
2007-09-06 13:01:55 +00:00
|
|
|
* $Revision: 1.62 $
|
2000-09-18 23:08:29 +00:00
|
|
|
*
|
2007-09-06 13:01:55 +00:00
|
|
|
* last change: $Author: kz $ $Date: 2007-09-06 14:01:55 $
|
2000-09-18 23:08:29 +00:00
|
|
|
*
|
2005-09-09 03:11:38 +00:00
|
|
|
* The Contents of this file are made available subject to
|
|
|
|
* the terms of GNU Lesser General Public License Version 2.1.
|
2000-09-18 23:08:29 +00:00
|
|
|
*
|
|
|
|
*
|
2005-09-09 03:11:38 +00:00
|
|
|
* GNU Lesser General Public License Version 2.1
|
|
|
|
* =============================================
|
|
|
|
* Copyright 2005 by Sun Microsystems, Inc.
|
|
|
|
* 901 San Antonio Road, Palo Alto, CA 94303, USA
|
2000-09-18 23:08:29 +00:00
|
|
|
*
|
2005-09-09 03:11:38 +00:00
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License version 2.1, as published by the Free Software Foundation.
|
2000-09-18 23:08:29 +00:00
|
|
|
*
|
2005-09-09 03:11:38 +00:00
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
2000-09-18 23:08:29 +00:00
|
|
|
*
|
2005-09-09 03:11:38 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
|
|
|
* MA 02111-1307 USA
|
2000-09-18 23:08:29 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
2006-09-16 20:18:17 +00:00
|
|
|
|
|
|
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
|
|
|
#include "precompiled_sw.hxx"
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
#ifndef _BIGINT_HXX //autogen
|
|
|
|
#include <tools/bigint.hxx>
|
|
|
|
#endif
|
|
|
|
#include "pagefrm.hxx"
|
|
|
|
#include "rootfrm.hxx"
|
|
|
|
#include "cntfrm.hxx"
|
|
|
|
#include "flyfrm.hxx"
|
|
|
|
#include "txtfrm.hxx"
|
|
|
|
#include "doc.hxx"
|
|
|
|
#include "viewsh.hxx"
|
|
|
|
#include "viewimp.hxx"
|
|
|
|
#include "pam.hxx"
|
|
|
|
#include "frmfmt.hxx"
|
|
|
|
#include "frmtool.hxx"
|
|
|
|
#include "dflyobj.hxx"
|
|
|
|
#include "hints.hxx"
|
2002-04-26 06:53:08 +00:00
|
|
|
#include "ndtxt.hxx"
|
2000-09-18 23:08:29 +00:00
|
|
|
#include "swundo.hxx"
|
|
|
|
#include "errhdl.hxx"
|
|
|
|
|
|
|
|
#ifndef _SVX_ULSPITEM_HXX //autogen
|
|
|
|
#include <svx/ulspitem.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _SVX_LRSPITEM_HXX //autogen
|
|
|
|
#include <svx/lrspitem.hxx>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _FMTANCHR_HXX //autogen
|
|
|
|
#include <fmtanchr.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _FMTORNT_HXX //autogen
|
|
|
|
#include <fmtornt.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _FMTFSIZE_HXX //autogen
|
|
|
|
#include <fmtfsize.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _FMTSRND_HXX //autogen
|
|
|
|
#include <fmtsrnd.hxx>
|
|
|
|
#endif
|
2006-08-14 15:25:46 +00:00
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
#include "tabfrm.hxx"
|
|
|
|
#include "flyfrms.hxx"
|
|
|
|
#include "crstate.hxx"
|
|
|
|
#include "sectfrm.hxx"
|
|
|
|
|
2004-03-08 13:00:27 +00:00
|
|
|
// OD 29.10.2003 #113049#
|
|
|
|
#ifndef _TOCNTNTANCHOREDOBJECTPOSITION_HXX
|
|
|
|
#include <tocntntanchoredobjectposition.hxx>
|
2004-02-02 17:21:12 +00:00
|
|
|
#endif
|
2004-08-02 13:09:05 +00:00
|
|
|
// OD 2004-05-24 #i28701#
|
|
|
|
#ifndef _DCONTACT_HXX
|
|
|
|
#include <dcontact.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _SORTEDOBJS_HXX
|
|
|
|
#include <sortedobjs.hxx>
|
|
|
|
#endif
|
2005-10-27 15:51:25 +00:00
|
|
|
// --> OD 2005-09-29 #125370#,#125957#
|
2005-10-19 11:35:13 +00:00
|
|
|
#ifndef _LAYOUTER_HXX
|
|
|
|
#include <layouter.hxx>
|
|
|
|
#endif
|
|
|
|
// <--
|
2005-11-17 15:33:49 +00:00
|
|
|
// --> OD 2005-11-17 #i56300#
|
|
|
|
#ifndef _OBJECTFORMATTERTXTFRM_HXX
|
|
|
|
#include <objectformattertxtfrm.hxx>
|
|
|
|
#endif
|
|
|
|
// <--
|
2006-03-21 14:36:27 +00:00
|
|
|
// --> OD 2006-03-06 #125892#
|
|
|
|
#ifndef _HANDLEANCHORNODECHG_HXX
|
|
|
|
#include <HandleAnchorNodeChg.hxx>
|
|
|
|
#endif
|
|
|
|
// <--
|
2004-02-02 17:21:12 +00:00
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* SwFlyAtCntFrm::SwFlyAtCntFrm()
|
|
|
|
|*
|
|
|
|
|* Ersterstellung MA 11. Nov. 92
|
|
|
|
|* Letzte Aenderung MA 09. Apr. 99
|
|
|
|
|*
|
|
|
|
|*************************************************************************/
|
|
|
|
|
|
|
|
SwFlyAtCntFrm::SwFlyAtCntFrm( SwFlyFrmFmt *pFmt, SwFrm *pAnch ) :
|
2004-06-28 12:39:13 +00:00
|
|
|
SwFlyFreeFrm( pFmt, pAnch )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
bAtCnt = TRUE;
|
|
|
|
bAutoPosition = FLY_AUTO_CNTNT == pFmt->GetAnchor().GetAnchorId();
|
|
|
|
}
|
|
|
|
|
2004-08-02 13:09:05 +00:00
|
|
|
// --> OD 2004-06-29 #i28701#
|
|
|
|
TYPEINIT1(SwFlyAtCntFrm,SwFlyFreeFrm);
|
|
|
|
// <--
|
2000-09-18 23:08:29 +00:00
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* SwFlyAtCntFrm::Modify()
|
|
|
|
|*
|
|
|
|
|* Ersterstellung MA 08. Feb. 93
|
|
|
|
|* Letzte Aenderung MA 23. Nov. 94
|
|
|
|
|*
|
|
|
|
|*************************************************************************/
|
|
|
|
|
|
|
|
void SwFlyAtCntFrm::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew )
|
|
|
|
{
|
|
|
|
USHORT nWhich = pNew ? pNew->Which() : 0;
|
|
|
|
const SwFmtAnchor *pAnch = 0;
|
2004-08-02 13:09:05 +00:00
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
if( RES_ATTRSET_CHG == nWhich && SFX_ITEM_SET ==
|
|
|
|
((SwAttrSetChg*)pNew)->GetChgSet()->GetItemState( RES_ANCHOR, FALSE,
|
|
|
|
(const SfxPoolItem**)&pAnch ))
|
|
|
|
; // Beim GetItemState wird der AnkerPointer gesetzt !
|
|
|
|
|
|
|
|
else if( RES_ANCHOR == nWhich )
|
|
|
|
{
|
|
|
|
//Ankerwechsel, ich haenge mich selbst um.
|
|
|
|
//Es darf sich nicht um einen Wechsel des Ankertyps handeln,
|
|
|
|
//dies ist nur ueber die SwFEShell moeglich.
|
|
|
|
pAnch = (const SwFmtAnchor*)pNew;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( pAnch )
|
|
|
|
{
|
|
|
|
ASSERT( pAnch->GetAnchorId() == GetFmt()->GetAnchor().GetAnchorId(),
|
|
|
|
"Unzulaessiger Wechsel des Ankertyps." );
|
|
|
|
|
|
|
|
//Abmelden, neuen Anker besorgen und 'dranhaengen.
|
2004-08-02 13:09:05 +00:00
|
|
|
SwRect aOld( GetObjRectWithSpaces() );
|
2000-09-18 23:08:29 +00:00
|
|
|
SwPageFrm *pOldPage = FindPageFrm();
|
2004-06-28 12:39:13 +00:00
|
|
|
const SwFrm *pOldAnchor = GetAnchorFrm();
|
|
|
|
SwCntntFrm *pCntnt = (SwCntntFrm*)GetAnchorFrm();
|
|
|
|
AnchorFrm()->RemoveFly( this );
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
const BOOL bBodyFtn = (pCntnt->IsInDocBody() || pCntnt->IsInFtn());
|
|
|
|
|
|
|
|
//Den neuen Anker anhand des NodeIdx suchen, am alten und
|
|
|
|
//neuen NodeIdx kann auch erkannt werden, in welche Richtung
|
|
|
|
//gesucht werden muss.
|
|
|
|
const SwNodeIndex aNewIdx( pAnch->GetCntntAnchor()->nNode );
|
|
|
|
SwNodeIndex aOldIdx( *pCntnt->GetNode() );
|
|
|
|
|
|
|
|
//fix: Umstellung, ehemals wurde in der do-while-Schleife nach vorn bzw.
|
|
|
|
//nach hinten gesucht; je nachdem wie welcher Index kleiner war.
|
|
|
|
//Das kann aber u.U. zu einer Endlosschleife fuehren. Damit
|
|
|
|
//wenigstens die Schleife unterbunden wird suchen wir nur in eine
|
|
|
|
//Richtung. Wenn der neue Anker nicht gefunden wird koennen wir uns
|
|
|
|
//immer noch vom Node einen Frame besorgen. Die Change, dass dies dann
|
|
|
|
//der richtige ist, ist gut.
|
2006-03-21 14:36:27 +00:00
|
|
|
const bool bNext = aOldIdx < aNewIdx;
|
|
|
|
// --> OD 2006-02-28 #125892#
|
|
|
|
// consider the case that at found anchor frame candidate already a
|
|
|
|
// fly frame of the given fly format is registered.
|
|
|
|
// --> OD 2006-03-15 #133407# - consider, that <pCntnt> is the already
|
|
|
|
// the new anchor frame.
|
|
|
|
bool bFound( aOldIdx == aNewIdx );
|
|
|
|
// <--
|
|
|
|
while ( pCntnt && !bFound )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
do
|
2006-03-21 14:36:27 +00:00
|
|
|
{
|
|
|
|
if ( bNext )
|
2000-09-18 23:08:29 +00:00
|
|
|
pCntnt = pCntnt->GetNextCntntFrm();
|
|
|
|
else
|
|
|
|
pCntnt = pCntnt->GetPrevCntntFrm();
|
|
|
|
} while ( pCntnt &&
|
2006-03-21 14:36:27 +00:00
|
|
|
!( bBodyFtn == ( pCntnt->IsInDocBody() ||
|
|
|
|
pCntnt->IsInFtn() ) ) );
|
|
|
|
if ( pCntnt )
|
2000-09-18 23:08:29 +00:00
|
|
|
aOldIdx = *pCntnt->GetNode();
|
2006-03-21 14:36:27 +00:00
|
|
|
|
|
|
|
// --> OD 2006-02-28 #125892#
|
|
|
|
// check, if at found anchor frame candidate already a fly frame
|
|
|
|
// of the given fly frame format is registered.
|
|
|
|
bFound = aOldIdx == aNewIdx;
|
|
|
|
if ( bFound && pCntnt->GetDrawObjs() )
|
|
|
|
{
|
|
|
|
SwFrmFmt* pMyFlyFrmFmt( &GetFrmFmt() );
|
|
|
|
SwSortedObjs &rObjs = *pCntnt->GetDrawObjs();
|
|
|
|
for( sal_uInt16 i = 0; i < rObjs.Count(); ++i)
|
|
|
|
{
|
|
|
|
SwFlyFrm* pFlyFrm = dynamic_cast<SwFlyFrm*>(rObjs[i]);
|
|
|
|
if ( pFlyFrm &&
|
|
|
|
&(pFlyFrm->GetFrmFmt()) == pMyFlyFrmFmt )
|
|
|
|
{
|
|
|
|
bFound = false;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// <--
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
2006-03-21 14:36:27 +00:00
|
|
|
// <--
|
2000-09-18 23:08:29 +00:00
|
|
|
if ( !pCntnt )
|
|
|
|
{
|
|
|
|
SwCntntNode *pNode = aNewIdx.GetNode().GetCntntNode();
|
|
|
|
pCntnt = pNode->GetFrm( &pOldAnchor->Frm().Pos(), 0, FALSE );
|
|
|
|
ASSERT( pCntnt, "Neuen Anker nicht gefunden" );
|
|
|
|
}
|
|
|
|
//Flys haengen niemals an einem Follow sondern immer am
|
|
|
|
//Master, den suchen wir uns jetzt.
|
2004-01-13 10:16:27 +00:00
|
|
|
SwCntntFrm* pFlow = pCntnt;
|
2000-09-18 23:08:29 +00:00
|
|
|
while ( pFlow->IsFollow() )
|
|
|
|
pFlow = pFlow->FindMaster();
|
2004-01-13 10:16:27 +00:00
|
|
|
pCntnt = pFlow;
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
//und schwupp angehaengt das teil...
|
|
|
|
pCntnt->AppendFly( this );
|
|
|
|
if ( pOldPage && pOldPage != FindPageFrm() )
|
|
|
|
NotifyBackground( pOldPage, aOld, PREP_FLY_LEAVE );
|
|
|
|
|
|
|
|
//Fix(3495)
|
|
|
|
_InvalidatePos();
|
|
|
|
InvalidatePage();
|
|
|
|
SetNotifyBack();
|
2004-08-02 13:09:05 +00:00
|
|
|
// --> OD 2004-06-24 #i28701# - reset member <maLastCharRect> and
|
|
|
|
// <mnLastTopOfLine> for to-character anchored objects.
|
|
|
|
ClearCharRectAndTopOfLine();
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
SwFlyFrm::Modify( pOld, pNew );
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* SwFlyAtCntFrm::MakeAll()
|
|
|
|
|*
|
|
|
|
|* Beschreibung Bei einem Absatzgebunden Fly kann es durchaus sein,
|
|
|
|
|* das der Anker auf die Veraenderung des Flys reagiert. Auf diese
|
|
|
|
|* Reaktion hat der Fly natuerlich auch wieder zu reagieren.
|
|
|
|
|* Leider kann dies zu Oszillationen fuehren z.b. Der Fly will nach
|
|
|
|
|* unten, dadurch kann der Inhalt nach oben, der TxtFrm wird kleiner,
|
|
|
|
|* der Fly muss wieder hoeher woduch der Text wieder nach unten
|
|
|
|
|* verdraengt wird...
|
|
|
|
|* Um derartige Oszillationen zu vermeiden, wird ein kleiner Positions-
|
|
|
|
|* stack aufgebaut. Wenn der Fly ein Position erreicht, die er bereits
|
|
|
|
|* einmal einnahm, so brechen wir den Vorgang ab. Um keine Risiken
|
|
|
|
|* einzugehen, wird der Positionsstack so aufgebaut, dass er fuenf
|
|
|
|
|* Positionen zurueckblickt.
|
|
|
|
|* Wenn der Stack ueberlaeuft, wird ebenfalls abgebrochen.
|
|
|
|
|* Der Abbruch fuer dazu, dass der Fly am Ende eine unguenste Position
|
|
|
|
|* einnimmt. Damit es nicht durch einen wiederholten Aufruf von
|
|
|
|
|* Aussen zu einer 'grossen Oszillation' kommen kann wird im Abbruch-
|
|
|
|
|* fall das Attribut des Rahmens auf automatische Ausrichtung oben
|
|
|
|
|* eingestellt.
|
|
|
|
|*
|
|
|
|
|* Ersterstellung MA 12. Nov. 92
|
|
|
|
|* Letzte Aenderung MA 20. Sep. 96
|
|
|
|
|*
|
|
|
|
|*************************************************************************/
|
|
|
|
//Wir brauchen ein Paar Hilfsklassen zur Kontrolle der Ozillation und ein paar
|
|
|
|
//Funktionen um die Uebersicht zu gewaehrleisten.
|
2004-09-09 09:57:01 +00:00
|
|
|
// OD 2004-08-25 #i3317# - re-factoring of the position stack
|
2000-09-18 23:08:29 +00:00
|
|
|
class SwOszControl
|
|
|
|
{
|
|
|
|
static const SwFlyFrm *pStk1;
|
|
|
|
static const SwFlyFrm *pStk2;
|
|
|
|
static const SwFlyFrm *pStk3;
|
|
|
|
static const SwFlyFrm *pStk4;
|
|
|
|
static const SwFlyFrm *pStk5;
|
|
|
|
|
|
|
|
const SwFlyFrm *pFly;
|
2004-09-09 09:57:01 +00:00
|
|
|
// --> OD 2004-08-25 #i3317#
|
|
|
|
sal_uInt8 mnPosStackSize;
|
|
|
|
std::vector<Point*> maObjPositions;
|
|
|
|
// <--
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
SwOszControl( const SwFlyFrm *pFrm );
|
|
|
|
~SwOszControl();
|
2004-09-09 09:57:01 +00:00
|
|
|
bool ChkOsz();
|
2000-09-18 23:08:29 +00:00
|
|
|
static FASTBOOL IsInProgress( const SwFlyFrm *pFly );
|
|
|
|
};
|
|
|
|
const SwFlyFrm *SwOszControl::pStk1 = 0;
|
|
|
|
const SwFlyFrm *SwOszControl::pStk2 = 0;
|
|
|
|
const SwFlyFrm *SwOszControl::pStk3 = 0;
|
|
|
|
const SwFlyFrm *SwOszControl::pStk4 = 0;
|
|
|
|
const SwFlyFrm *SwOszControl::pStk5 = 0;
|
|
|
|
|
2004-09-09 09:57:01 +00:00
|
|
|
SwOszControl::SwOszControl( const SwFlyFrm *pFrm )
|
|
|
|
: pFly( pFrm ),
|
|
|
|
// --> OD 2004-08-25 #i3317#
|
|
|
|
mnPosStackSize( 20 )
|
|
|
|
// <--
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
if ( !SwOszControl::pStk1 )
|
|
|
|
SwOszControl::pStk1 = pFly;
|
|
|
|
else if ( !SwOszControl::pStk2 )
|
|
|
|
SwOszControl::pStk2 = pFly;
|
|
|
|
else if ( !SwOszControl::pStk3 )
|
|
|
|
SwOszControl::pStk3 = pFly;
|
|
|
|
else if ( !SwOszControl::pStk4 )
|
|
|
|
SwOszControl::pStk4 = pFly;
|
|
|
|
else if ( !SwOszControl::pStk5 )
|
|
|
|
SwOszControl::pStk5 = pFly;
|
|
|
|
}
|
|
|
|
|
|
|
|
SwOszControl::~SwOszControl()
|
|
|
|
{
|
|
|
|
if ( SwOszControl::pStk1 == pFly )
|
|
|
|
SwOszControl::pStk1 = 0;
|
|
|
|
else if ( SwOszControl::pStk2 == pFly )
|
|
|
|
SwOszControl::pStk2 = 0;
|
|
|
|
else if ( SwOszControl::pStk3 == pFly )
|
|
|
|
SwOszControl::pStk3 = 0;
|
|
|
|
else if ( SwOszControl::pStk4 == pFly )
|
|
|
|
SwOszControl::pStk4 = 0;
|
|
|
|
else if ( SwOszControl::pStk5 == pFly )
|
|
|
|
SwOszControl::pStk5 = 0;
|
2004-09-09 09:57:01 +00:00
|
|
|
// --> OD 2004-08-25 #i3317#
|
|
|
|
while ( !maObjPositions.empty() )
|
|
|
|
{
|
|
|
|
Point* pPos = maObjPositions.back();
|
|
|
|
delete pPos;
|
|
|
|
|
|
|
|
maObjPositions.pop_back();
|
|
|
|
}
|
|
|
|
// <--
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
FASTBOOL SwOszControl::IsInProgress( const SwFlyFrm *pFly )
|
|
|
|
{
|
|
|
|
if ( SwOszControl::pStk1 && !pFly->IsLowerOf( SwOszControl::pStk1 ) )
|
|
|
|
return TRUE;
|
|
|
|
if ( SwOszControl::pStk2 && !pFly->IsLowerOf( SwOszControl::pStk2 ) )
|
|
|
|
return TRUE;
|
|
|
|
if ( SwOszControl::pStk3 && !pFly->IsLowerOf( SwOszControl::pStk3 ) )
|
|
|
|
return TRUE;
|
|
|
|
if ( SwOszControl::pStk4 && !pFly->IsLowerOf( SwOszControl::pStk4 ) )
|
|
|
|
return TRUE;
|
|
|
|
if ( SwOszControl::pStk5 && !pFly->IsLowerOf( SwOszControl::pStk5 ) )
|
|
|
|
return TRUE;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2004-09-09 09:57:01 +00:00
|
|
|
bool SwOszControl::ChkOsz()
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2004-09-09 09:57:01 +00:00
|
|
|
bool bOscillationDetected = false;
|
|
|
|
|
|
|
|
if ( maObjPositions.size() == mnPosStackSize )
|
|
|
|
{
|
|
|
|
// position stack is full -> oscillation
|
|
|
|
bOscillationDetected = true;
|
|
|
|
}
|
|
|
|
else
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2004-09-09 09:57:01 +00:00
|
|
|
Point* pNewObjPos = new Point( pFly->GetObjRect().Pos() );
|
|
|
|
for ( std::vector<Point*>::iterator aObjPosIter = maObjPositions.begin();
|
|
|
|
aObjPosIter != maObjPositions.end();
|
|
|
|
++aObjPosIter )
|
|
|
|
{
|
|
|
|
if ( *(pNewObjPos) == *(*aObjPosIter) )
|
|
|
|
{
|
|
|
|
// position already occured -> oscillation
|
|
|
|
bOscillationDetected = true;
|
|
|
|
delete pNewObjPos;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ( !bOscillationDetected )
|
|
|
|
{
|
|
|
|
maObjPositions.push_back( pNewObjPos );
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
2004-09-09 09:57:01 +00:00
|
|
|
|
|
|
|
return bOscillationDetected;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void SwFlyAtCntFrm::MakeAll()
|
|
|
|
{
|
2004-02-26 14:29:59 +00:00
|
|
|
// OD 2004-01-19 #110582#
|
|
|
|
if ( !GetFmt()->GetDoc()->IsVisibleLayerId( GetVirtDrawObj()->GetLayer() ) )
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2001-11-13 13:20:30 +00:00
|
|
|
if ( !SwOszControl::IsInProgress( this ) && !IsLocked() && !IsColLocked() )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2004-08-02 13:09:05 +00:00
|
|
|
// --> OD 2004-06-30 #i28701# - use new method <GetPageFrm()>
|
|
|
|
if( !GetPageFrm() && GetAnchorFrm() && GetAnchorFrm()->IsInFly() )
|
2001-11-13 13:20:30 +00:00
|
|
|
{
|
2004-06-28 12:39:13 +00:00
|
|
|
SwFlyFrm* pFly = AnchorFrm()->FindFlyFrm();
|
2001-11-13 13:20:30 +00:00
|
|
|
SwPageFrm *pPage = pFly ? pFly->FindPageFrm() : NULL;
|
|
|
|
if( pPage )
|
2004-08-02 13:09:05 +00:00
|
|
|
pPage->AppendFlyToPage( this );
|
2001-11-13 13:20:30 +00:00
|
|
|
}
|
2004-08-02 13:09:05 +00:00
|
|
|
// --> OD 2004-06-30 #i28701# - use new method <GetPageFrm()>
|
|
|
|
if( GetPageFrm() )
|
2001-11-13 13:20:30 +00:00
|
|
|
{
|
|
|
|
bSetCompletePaintOnInvalidate = TRUE;
|
2001-11-07 13:12:46 +00:00
|
|
|
{
|
2001-11-13 13:20:30 +00:00
|
|
|
SwFlyFrmFmt *pFmt = (SwFlyFrmFmt*)GetFmt();
|
|
|
|
const SwFmtFrmSize &rFrmSz = GetFmt()->GetFrmSize();
|
|
|
|
if( rFrmSz.GetHeightPercent() != 0xFF &&
|
|
|
|
rFrmSz.GetHeightPercent() >= 100 )
|
2001-11-07 13:12:46 +00:00
|
|
|
{
|
2001-11-13 13:20:30 +00:00
|
|
|
pFmt->LockModify();
|
|
|
|
SwFmtSurround aMain( pFmt->GetSurround() );
|
|
|
|
if ( aMain.GetSurround() == SURROUND_NONE )
|
|
|
|
{
|
|
|
|
aMain.SetSurround( SURROUND_THROUGHT );
|
|
|
|
pFmt->SetAttr( aMain );
|
|
|
|
}
|
|
|
|
pFmt->UnlockModify();
|
2001-11-07 13:12:46 +00:00
|
|
|
}
|
|
|
|
}
|
2004-08-02 13:09:05 +00:00
|
|
|
|
2001-11-13 13:20:30 +00:00
|
|
|
SwOszControl aOszCntrl( this );
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2005-03-23 10:53:12 +00:00
|
|
|
// --> OD 2005-02-22 #i43255#
|
2005-07-08 10:03:10 +00:00
|
|
|
// --> OD 2005-06-07 #i50356# - format the anchor frame, which
|
|
|
|
// contains the anchor position. E.g., for at-character anchored
|
|
|
|
// object this can be the follow frame of the anchor frame.
|
2005-03-23 10:53:12 +00:00
|
|
|
const bool bFormatAnchor =
|
2005-07-08 10:03:10 +00:00
|
|
|
!static_cast<const SwTxtFrm*>( GetAnchorFrmContainingAnchPos() )->IsAnyJoinLocked() &&
|
2005-03-23 10:53:12 +00:00
|
|
|
!ConsiderObjWrapInfluenceOnObjPos() &&
|
|
|
|
!ConsiderObjWrapInfluenceOfOtherObjs();
|
|
|
|
// <--
|
2004-08-02 13:09:05 +00:00
|
|
|
|
2004-06-28 12:39:13 +00:00
|
|
|
const SwFrm* pFooter = GetAnchorFrm()->FindFooterOrHeader();
|
2001-11-13 13:20:30 +00:00
|
|
|
if( pFooter && !pFooter->IsFooterFrm() )
|
|
|
|
pFooter = NULL;
|
2004-09-09 09:57:01 +00:00
|
|
|
bool bOsz = false;
|
2001-11-13 13:20:30 +00:00
|
|
|
FASTBOOL bExtra = Lower() && Lower()->IsColumnFrm();
|
2004-09-09 09:57:01 +00:00
|
|
|
// --> OD 2004-08-25 #i3317# - boolean, to apply temporarly the
|
|
|
|
// 'straightforward positioning process' for the frame due to its
|
|
|
|
// overlapping with a previous column.
|
|
|
|
bool bConsiderWrapInfluenceDueToOverlapPrevCol( false );
|
|
|
|
// <--
|
2004-11-16 14:45:34 +00:00
|
|
|
// --> OD 2004-10-22 #i35911# - boolean, to apply temporarly the
|
|
|
|
// 'straightforward positioning process' for the frame due to fact
|
|
|
|
// that it causes the complete content of its layout environment
|
|
|
|
// to move forward.
|
2005-01-27 10:11:12 +00:00
|
|
|
// --> OD 2005-01-14 #i40444# - extend usage of this boolean:
|
|
|
|
// apply temporarly the 'straightforward positioning process' for
|
|
|
|
// the frame due to the fact that the frame clears the area for
|
|
|
|
// the anchor frame, thus it has to move forward.
|
|
|
|
bool bConsiderWrapInfluenceDueToMovedFwdAnchor( false );
|
2004-11-16 14:45:34 +00:00
|
|
|
// <--
|
2001-11-13 13:20:30 +00:00
|
|
|
do {
|
2002-01-17 07:54:14 +00:00
|
|
|
SWRECTFN( this )
|
|
|
|
Point aOldPos( (Frm().*fnRect->fnGetPos)() );
|
|
|
|
SwFlyFreeFrm::MakeAll();
|
2004-08-02 13:09:05 +00:00
|
|
|
const bool bPosChgDueToOwnFormat =
|
|
|
|
aOldPos != (Frm().*fnRect->fnGetPos)();
|
2004-09-09 09:57:01 +00:00
|
|
|
// --> OD 2004-08-25 #i3317#
|
|
|
|
if ( !ConsiderObjWrapInfluenceOnObjPos() &&
|
|
|
|
OverlapsPrevColumn() )
|
|
|
|
{
|
|
|
|
bConsiderWrapInfluenceDueToOverlapPrevCol = true;
|
|
|
|
}
|
|
|
|
// <--
|
2004-08-02 13:09:05 +00:00
|
|
|
// OD 2004-05-12 #i28701# - no format of anchor frame, if
|
|
|
|
// wrapping style influence is considered on object positioning
|
2005-03-23 10:53:12 +00:00
|
|
|
if ( bFormatAnchor )
|
2001-11-13 13:20:30 +00:00
|
|
|
{
|
2005-11-17 15:33:49 +00:00
|
|
|
SwTxtFrm* pAnchPosAnchorFrm =
|
|
|
|
dynamic_cast<SwTxtFrm*>(GetAnchorFrmContainingAnchPos());
|
|
|
|
ASSERT( pAnchPosAnchorFrm,
|
|
|
|
"<SwFlyAtCntFrm::MakeAll()> - anchor frame of wrong type -> crash" );
|
2006-02-03 16:17:50 +00:00
|
|
|
// --> OD 2006-01-27 #i58182# - For the usage of new method
|
|
|
|
// <SwObjectFormatterTxtFrm::CheckMovedFwdCondition(..)>
|
|
|
|
// to check move forward of anchor frame due to the object
|
|
|
|
// positioning it's needed to know, if the object is anchored
|
|
|
|
// at the master frame before the anchor frame is formatted.
|
|
|
|
const bool bAnchoredAtMaster( !pAnchPosAnchorFrm->IsFollow() );
|
|
|
|
// <--
|
|
|
|
|
2005-11-17 15:33:49 +00:00
|
|
|
// --> OD 2005-11-17 #i56300#
|
|
|
|
// perform complete format of anchor text frame and its
|
|
|
|
// previous frames, which have become invalid due to the
|
|
|
|
// fly frame format.
|
|
|
|
SwObjectFormatterTxtFrm::FormatAnchorFrmAndItsPrevs( *pAnchPosAnchorFrm );
|
2004-11-16 14:45:34 +00:00
|
|
|
// <--
|
|
|
|
// --> OD 2004-10-22 #i35911#
|
2005-01-27 10:11:12 +00:00
|
|
|
// --> OD 2005-01-14 #i40444#
|
2006-02-03 16:17:50 +00:00
|
|
|
// --> OD 2006-01-27 #i58182# - usage of new method
|
|
|
|
// <SwObjectFormatterTxtFrm::CheckMovedFwdCondition(..)>
|
|
|
|
sal_uInt32 nToPageNum( 0L );
|
|
|
|
bool bDummy( false );
|
|
|
|
if ( SwObjectFormatterTxtFrm::CheckMovedFwdCondition(
|
|
|
|
*this, GetPageFrm()->GetPhyPageNum(),
|
|
|
|
bAnchoredAtMaster, nToPageNum, bDummy ) )
|
2004-11-16 14:45:34 +00:00
|
|
|
{
|
2005-01-27 10:11:12 +00:00
|
|
|
bConsiderWrapInfluenceDueToMovedFwdAnchor = true;
|
2005-10-27 15:51:25 +00:00
|
|
|
// --> OD 2005-09-29 #125370#,#125957# - mark anchor text frame
|
2005-10-19 11:35:13 +00:00
|
|
|
// directly, that it is moved forward by object positioning.
|
|
|
|
SwTxtFrm* pAnchorTxtFrm( static_cast<SwTxtFrm*>(AnchorFrm()) );
|
|
|
|
const SwPageFrm* pAnchorPageFrm =
|
2005-11-17 15:33:49 +00:00
|
|
|
pAnchPosAnchorFrm->FindPageFrm();
|
2005-10-19 11:35:13 +00:00
|
|
|
bool bInsert( true );
|
2006-02-03 16:17:50 +00:00
|
|
|
sal_uInt32 nAnchorFrmToPageNum( 0L );
|
2005-10-19 11:35:13 +00:00
|
|
|
const SwDoc& rDoc = *(GetFrmFmt().GetDoc());
|
|
|
|
if ( SwLayouter::FrmMovedFwdByObjPos(
|
2006-02-03 16:17:50 +00:00
|
|
|
rDoc, *pAnchorTxtFrm, nAnchorFrmToPageNum ) )
|
2005-10-19 11:35:13 +00:00
|
|
|
{
|
2006-02-03 16:17:50 +00:00
|
|
|
if ( nAnchorFrmToPageNum < nToPageNum )
|
2005-10-19 11:35:13 +00:00
|
|
|
SwLayouter::RemoveMovedFwdFrm( rDoc, *pAnchorTxtFrm );
|
|
|
|
else
|
|
|
|
bInsert = false;
|
|
|
|
}
|
|
|
|
if ( bInsert )
|
|
|
|
{
|
|
|
|
SwLayouter::InsertMovedFwdFrm( rDoc, *pAnchorTxtFrm,
|
2006-02-03 16:17:50 +00:00
|
|
|
nToPageNum );
|
2005-10-19 11:35:13 +00:00
|
|
|
}
|
|
|
|
// <--
|
2004-11-16 14:45:34 +00:00
|
|
|
}
|
|
|
|
// <--
|
2001-11-13 13:20:30 +00:00
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2004-08-02 13:09:05 +00:00
|
|
|
if ( aOldPos != (Frm().*fnRect->fnGetPos)() ||
|
|
|
|
( !GetValidPosFlag() &&
|
|
|
|
( pFooter || bPosChgDueToOwnFormat ) ) )
|
|
|
|
{
|
2001-11-13 13:20:30 +00:00
|
|
|
bOsz = aOszCntrl.ChkOsz();
|
2006-04-26 13:12:39 +00:00
|
|
|
|
|
|
|
// --> OD 2006-04-13 #b6403541#
|
|
|
|
// special loop prevention for dedicated document:
|
|
|
|
if ( bOsz &&
|
|
|
|
HasFixSize() && IsClipped() &&
|
|
|
|
GetAnchorFrm()->GetUpper()->IsCellFrm() )
|
|
|
|
{
|
|
|
|
SwFrmFmt* pFmt = GetFmt();
|
|
|
|
const SwFmtFrmSize& rFrmSz = pFmt->GetFrmSize();
|
|
|
|
if ( rFrmSz.GetWidthPercent() &&
|
|
|
|
rFrmSz.GetHeightPercent() == 0xFF )
|
|
|
|
{
|
|
|
|
SwFmtSurround aSurround( pFmt->GetSurround() );
|
|
|
|
if ( aSurround.GetSurround() == SURROUND_NONE )
|
|
|
|
{
|
|
|
|
pFmt->LockModify();
|
|
|
|
aSurround.SetSurround( SURROUND_THROUGHT );
|
|
|
|
pFmt->SetAttr( aSurround );
|
|
|
|
pFmt->UnlockModify();
|
|
|
|
bOsz = false;
|
|
|
|
#if OSL_DEBUG_LEVEL > 1
|
|
|
|
ASSERT( false,
|
|
|
|
"<SwFlyAtCntFrm::MakeAll()> - special loop prevention for dedicated document of b6403541 applied" );
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// <--
|
2004-08-02 13:09:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if ( bExtra && Lower() && !Lower()->GetValidPosFlag() )
|
|
|
|
{
|
|
|
|
// Wenn ein mehrspaltiger Rahmen wg. Positionswechsel ungueltige
|
2001-11-13 13:20:30 +00:00
|
|
|
// Spalten hinterlaesst, so drehen wir lieber hier eine weitere
|
|
|
|
// Runde und formatieren unseren Inhalt via FormatWidthCols nochmal.
|
|
|
|
_InvalidateSize();
|
|
|
|
bExtra = FALSE; // Sicherhaltshalber gibt es nur eine Ehrenrunde.
|
|
|
|
}
|
2004-02-26 14:29:59 +00:00
|
|
|
} while ( !IsValid() && !bOsz &&
|
2004-09-09 09:57:01 +00:00
|
|
|
// --> OD 2004-08-25 #i3317#
|
|
|
|
!bConsiderWrapInfluenceDueToOverlapPrevCol &&
|
|
|
|
// <--
|
2005-01-27 10:11:12 +00:00
|
|
|
// --> OD 2005-01-14 #i40444#
|
|
|
|
!bConsiderWrapInfluenceDueToMovedFwdAnchor &&
|
2004-11-16 14:45:34 +00:00
|
|
|
// <--
|
2004-02-26 14:29:59 +00:00
|
|
|
GetFmt()->GetDoc()->IsVisibleLayerId( GetVirtDrawObj()->GetLayer() ) );
|
2001-11-13 13:20:30 +00:00
|
|
|
|
2004-09-09 09:57:01 +00:00
|
|
|
// --> OD 2004-08-25 #i3317# - instead of attribute change apply
|
|
|
|
// temporarly the 'straightforward positioning process'.
|
2004-11-16 14:45:34 +00:00
|
|
|
if ( bOsz || bConsiderWrapInfluenceDueToOverlapPrevCol ||
|
2005-01-27 10:11:12 +00:00
|
|
|
// --> OD 2005-01-14 #i40444#
|
|
|
|
bConsiderWrapInfluenceDueToMovedFwdAnchor )
|
2004-11-16 14:45:34 +00:00
|
|
|
// <--
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2004-09-09 09:57:01 +00:00
|
|
|
SetTmpConsiderWrapInfluence( true );
|
|
|
|
SetRestartLayoutProcess( true );
|
2006-07-26 07:17:09 +00:00
|
|
|
// --> OD 2006-07-24 #b6449874#
|
|
|
|
SetTmpConsiderWrapInfluenceOfOtherObjs( true );
|
|
|
|
// <--
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
2004-09-09 09:57:01 +00:00
|
|
|
// <--
|
2001-11-13 13:20:30 +00:00
|
|
|
bSetCompletePaintOnInvalidate = FALSE;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-08-02 13:09:05 +00:00
|
|
|
/** method to determine, if a <MakeAll()> on the Writer fly frame is possible
|
|
|
|
|
|
|
|
OD 2004-05-11 #i28701#
|
|
|
|
|
|
|
|
@author OD
|
|
|
|
*/
|
|
|
|
bool SwFlyAtCntFrm::IsFormatPossible() const
|
|
|
|
{
|
|
|
|
return SwFlyFreeFrm::IsFormatPossible() &&
|
|
|
|
!SwOszControl::IsInProgress( this );
|
|
|
|
}
|
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* FindAnchor() und Hilfsfunktionen.
|
|
|
|
|*
|
|
|
|
|* Beschreibung: Sucht ausgehend von pOldAnch einen Anker fuer
|
|
|
|
|* Absatzgebundene Objekte.
|
|
|
|
|* Wird beim Draggen von Absatzgebundenen Objekten zur Ankeranzeige sowie
|
|
|
|
|* fuer Ankerwechsel benoetigt.
|
|
|
|
|* Ersterstellung MA 22. Jun. 93
|
|
|
|
|* Letzte Aenderung MA 30. Jan. 95
|
|
|
|
|*
|
|
|
|
|*************************************************************************/
|
|
|
|
|
|
|
|
class SwDistance
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
SwTwips nMain, nSub;
|
|
|
|
SwDistance() { nMain = nSub = 0; }
|
|
|
|
SwDistance& operator=( const SwDistance &rTwo )
|
|
|
|
{ nMain = rTwo.nMain; nSub = rTwo.nSub; return *this; }
|
|
|
|
BOOL operator<( const SwDistance& rTwo )
|
|
|
|
{ return nMain < rTwo.nMain || ( nMain == rTwo.nMain && nSub &&
|
|
|
|
rTwo.nSub && nSub < rTwo.nSub ); }
|
|
|
|
BOOL operator<=( const SwDistance& rTwo )
|
|
|
|
{ return nMain < rTwo.nMain || ( nMain == rTwo.nMain && ( !nSub ||
|
|
|
|
!rTwo.nSub || nSub <= rTwo.nSub ) ); }
|
|
|
|
};
|
|
|
|
|
|
|
|
const SwFrm * MA_FASTCALL lcl_CalcDownDist( SwDistance &rRet,
|
|
|
|
const Point &rPt,
|
|
|
|
const SwCntntFrm *pCnt )
|
|
|
|
{
|
|
|
|
rRet.nSub = 0;
|
|
|
|
//Wenn der Point direkt innerhalb des Cnt steht ist die Sache klar und
|
|
|
|
//der Cntnt hat automatisch eine Entfernung von 0
|
|
|
|
if ( pCnt->Frm().IsInside( rPt ) )
|
|
|
|
{
|
|
|
|
rRet.nMain = 0;
|
|
|
|
return pCnt;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
const SwLayoutFrm *pUp = pCnt->IsInTab() ? pCnt->FindTabFrm()->GetUpper() : pCnt->GetUpper();
|
|
|
|
// einspaltige Bereiche muessen zu ihrem Upper durchschalten
|
|
|
|
while( pUp->IsSctFrm() )
|
|
|
|
pUp = pUp->GetUpper();
|
2002-08-14 08:51:35 +00:00
|
|
|
SWRECTFN( pUp )
|
2000-09-18 23:08:29 +00:00
|
|
|
//Dem Textflus folgen.
|
2002-01-17 07:54:14 +00:00
|
|
|
if ( pUp->Frm().IsInside( rPt ) )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2004-02-02 17:21:12 +00:00
|
|
|
// OD 26.09.2003 - <rPt> point is inside environment of given content frame
|
2002-08-14 08:51:35 +00:00
|
|
|
if( bVert )
|
|
|
|
rRet.nMain = pCnt->Frm().Left() + pCnt->Frm().Width() -rPt.X();
|
|
|
|
else
|
|
|
|
rRet.nMain = rPt.Y() - pCnt->Frm().Top();
|
2000-09-18 23:08:29 +00:00
|
|
|
return pCnt;
|
|
|
|
}
|
2002-10-30 13:58:48 +00:00
|
|
|
else if ( rPt.Y() <= pUp->Frm().Top() )
|
|
|
|
{
|
2004-02-02 17:21:12 +00:00
|
|
|
// OD 26.09.2003 - <rPt> point is above environment of given content frame
|
|
|
|
// OD: correct for vertical layout?
|
2002-10-30 13:58:48 +00:00
|
|
|
rRet.nMain = LONG_MAX;
|
|
|
|
}
|
2002-08-14 08:51:35 +00:00
|
|
|
else if( rPt.X() < pUp->Frm().Left() &&
|
|
|
|
rPt.Y() <= ( bVert ? pUp->Frm().Top() : pUp->Frm().Bottom() ) )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2004-02-02 17:21:12 +00:00
|
|
|
// OD 26.09.2003 - <rPt> point is left of environment of given content frame
|
|
|
|
// OD: seems not to be correct for vertical layout!?
|
2000-09-18 23:08:29 +00:00
|
|
|
const SwFrm *pLay = pUp->GetLeaf( MAKEPAGE_NONE, FALSE, pCnt );
|
2002-08-14 08:51:35 +00:00
|
|
|
if( !pLay ||
|
|
|
|
(bVert && (pLay->Frm().Top() + pLay->Prt().Bottom()) <rPt.Y())||
|
|
|
|
(!bVert && (pLay->Frm().Left() + pLay->Prt().Right())<rPt.X()) )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2004-02-02 17:21:12 +00:00
|
|
|
// OD 26.09.2003 - <rPt> point is in left border of environment
|
2002-08-14 08:51:35 +00:00
|
|
|
if( bVert )
|
|
|
|
rRet.nMain = pCnt->Frm().Left() + pCnt->Frm().Width()
|
|
|
|
- rPt.X();
|
|
|
|
else
|
|
|
|
rRet.nMain = rPt.Y() - pCnt->Frm().Top();
|
2000-09-18 23:08:29 +00:00
|
|
|
return pCnt;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
rRet.nMain = LONG_MAX;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-08-14 08:51:35 +00:00
|
|
|
rRet.nMain = bVert ? pCnt->Frm().Left() + pCnt->Frm().Width() -
|
|
|
|
(pUp->Frm().Left() + pUp->Prt().Left())
|
|
|
|
: (pUp->Frm().Top() + pUp->Prt().Bottom()) - pCnt->Frm().Top();
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
const SwFrm *pPre = pCnt;
|
|
|
|
const SwFrm *pLay = pUp->GetLeaf( MAKEPAGE_NONE, TRUE, pCnt );
|
|
|
|
SwTwips nFrmTop, nPrtHeight;
|
|
|
|
BOOL bSct;
|
|
|
|
const SwSectionFrm *pSect = pUp->FindSctFrm();
|
|
|
|
if( pSect )
|
|
|
|
{
|
|
|
|
rRet.nSub = rRet.nMain;
|
|
|
|
rRet.nMain = 0;
|
|
|
|
}
|
|
|
|
if( pSect && !pSect->IsAnLower( pLay ) )
|
|
|
|
{
|
|
|
|
bSct = FALSE;
|
|
|
|
const SwSectionFrm* pNxtSect = pLay ? pLay->FindSctFrm() : 0;
|
|
|
|
if( pSect->IsAnFollow( pNxtSect ) )
|
|
|
|
{
|
2002-08-14 08:51:35 +00:00
|
|
|
if( pLay->IsVertical() )
|
|
|
|
{
|
|
|
|
nFrmTop = pLay->Frm().Left() + pLay->Frm().Width();
|
|
|
|
nPrtHeight = pLay->Prt().Width();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
nFrmTop = pLay->Frm().Top();
|
|
|
|
nPrtHeight = pLay->Prt().Height();
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
pSect = pNxtSect;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pLay = pSect->GetUpper();
|
2002-08-14 08:51:35 +00:00
|
|
|
if( pLay->IsVertical() )
|
|
|
|
{
|
|
|
|
nFrmTop = pSect->Frm().Left();
|
|
|
|
nPrtHeight = pSect->Frm().Left() - pLay->Frm().Left()
|
|
|
|
- pLay->Prt().Left();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
nFrmTop = pSect->Frm().Bottom();
|
|
|
|
nPrtHeight = pLay->Frm().Top() + pLay->Prt().Top()
|
|
|
|
+ pLay->Prt().Height() - pSect->Frm().Top()
|
|
|
|
- pSect->Frm().Height();
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
pSect = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if( pLay )
|
|
|
|
{
|
2002-08-14 08:51:35 +00:00
|
|
|
if( pLay->IsVertical() )
|
|
|
|
{
|
|
|
|
nFrmTop = pLay->Frm().Left() + pLay->Frm().Width();
|
|
|
|
nPrtHeight = pLay->Prt().Width();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
nFrmTop = pLay->Frm().Top();
|
|
|
|
nPrtHeight = pLay->Prt().Height();
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
bSct = 0 != pSect;
|
|
|
|
}
|
|
|
|
while ( pLay && !pLay->Frm().IsInside( rPt ) &&
|
|
|
|
( pLay->Frm().Top() <= rPt.Y() || pLay->IsInFly() ||
|
|
|
|
( pLay->IsInSct() &&
|
|
|
|
pLay->FindSctFrm()->GetUpper()->Frm().Top() <= rPt.Y())) )
|
|
|
|
{
|
|
|
|
if ( pLay->IsFtnContFrm() )
|
|
|
|
{
|
|
|
|
if ( !((SwLayoutFrm*)pLay)->Lower() )
|
|
|
|
{
|
|
|
|
SwFrm *pDel = (SwFrm*)pLay;
|
|
|
|
pDel->Cut();
|
|
|
|
delete pDel;
|
|
|
|
return pPre;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if( bSct || pSect )
|
|
|
|
rRet.nSub += nPrtHeight;
|
|
|
|
else
|
|
|
|
rRet.nMain += nPrtHeight;
|
|
|
|
pPre = pLay;
|
|
|
|
pLay = pLay->GetLeaf( MAKEPAGE_NONE, TRUE, pCnt );
|
|
|
|
if( pSect && !pSect->IsAnLower( pLay ) )
|
|
|
|
{ // If we're leaving a SwSectionFrm, the next Leaf-Frm
|
|
|
|
// is the part of the upper below the SectionFrm.
|
|
|
|
const SwSectionFrm* pNxtSect = pLay ?
|
|
|
|
pLay->FindSctFrm() : NULL;
|
|
|
|
bSct = FALSE;
|
|
|
|
if( pSect->IsAnFollow( pNxtSect ) )
|
|
|
|
{
|
|
|
|
pSect = pNxtSect;
|
2002-08-14 08:51:35 +00:00
|
|
|
if( pLay->IsVertical() )
|
|
|
|
{
|
|
|
|
nFrmTop = pLay->Frm().Left() + pLay->Frm().Width();
|
|
|
|
nPrtHeight = pLay->Prt().Width();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
nFrmTop = pLay->Frm().Top();
|
|
|
|
nPrtHeight = pLay->Prt().Height();
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pLay = pSect->GetUpper();
|
2002-08-14 08:51:35 +00:00
|
|
|
if( pLay->IsVertical() )
|
|
|
|
{
|
|
|
|
nFrmTop = pSect->Frm().Left();
|
|
|
|
nPrtHeight = pSect->Frm().Left() -
|
|
|
|
pLay->Frm().Left() - pLay->Prt().Left();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
nFrmTop = pSect->Frm().Bottom();
|
|
|
|
nPrtHeight = pLay->Frm().Top()+pLay->Prt().Top()
|
|
|
|
+ pLay->Prt().Height() - pSect->Frm().Top()
|
|
|
|
- pSect->Frm().Height();
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
pSect = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if( pLay )
|
|
|
|
{
|
2002-08-14 08:51:35 +00:00
|
|
|
if( pLay->IsVertical() )
|
|
|
|
{
|
|
|
|
nFrmTop = pLay->Frm().Left() + pLay->Frm().Width();
|
|
|
|
nPrtHeight = pLay->Prt().Width();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
nFrmTop = pLay->Frm().Top();
|
|
|
|
nPrtHeight = pLay->Prt().Height();
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
bSct = 0 != pSect;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ( pLay )
|
|
|
|
{
|
|
|
|
if ( pLay->Frm().IsInside( rPt ) )
|
|
|
|
{
|
2002-08-14 08:51:35 +00:00
|
|
|
SwTwips nDiff = pLay->IsVertical() ? ( nFrmTop - rPt.X() )
|
|
|
|
: ( rPt.Y() - nFrmTop );
|
2000-09-18 23:08:29 +00:00
|
|
|
if( bSct || pSect )
|
2002-08-14 08:51:35 +00:00
|
|
|
rRet.nSub += nDiff;
|
2000-09-18 23:08:29 +00:00
|
|
|
else
|
2002-08-14 08:51:35 +00:00
|
|
|
rRet.nMain += nDiff;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
if ( pLay->IsFtnContFrm() && !((SwLayoutFrm*)pLay)->Lower() )
|
|
|
|
{
|
|
|
|
SwFrm *pDel = (SwFrm*)pLay;
|
|
|
|
pDel->Cut();
|
|
|
|
delete pDel;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return pLay;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
rRet.nMain = LONG_MAX;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
//Bug 3985, optimierungsproblem, vergleiche auch trvlfrm.cxx lcl_FindCntnt()
|
2007-09-06 13:01:55 +00:00
|
|
|
#ifdef _MSC_VER
|
2000-09-18 23:08:29 +00:00
|
|
|
#pragma optimize("e",off)
|
2007-09-06 13:01:55 +00:00
|
|
|
#endif
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
ULONG MA_FASTCALL lcl_FindCntDiff( const Point &rPt, const SwLayoutFrm *pLay,
|
|
|
|
const SwCntntFrm *& rpCnt,
|
|
|
|
const BOOL bBody, const BOOL bFtn )
|
|
|
|
{
|
|
|
|
//Sucht unterhalb von pLay den dichtesten Cnt zum Point. Der Bezugspunkt
|
|
|
|
//der Cntnts ist immer die linke obere Ecke.
|
|
|
|
//Der Cnt soll moeglichst ueber dem Point liegen.
|
|
|
|
|
2003-04-15 15:50:38 +00:00
|
|
|
#if OSL_DEBUG_LEVEL > 1
|
2000-09-18 23:08:29 +00:00
|
|
|
Point arPoint( rPt );
|
|
|
|
#endif
|
|
|
|
|
|
|
|
rpCnt = 0;
|
|
|
|
ULONG nDistance = ULONG_MAX;
|
|
|
|
ULONG nNearest = ULONG_MAX;
|
|
|
|
const SwCntntFrm *pCnt = pLay->ContainsCntnt();
|
|
|
|
|
|
|
|
while ( pCnt && (bBody != pCnt->IsInDocBody() || bFtn != pCnt->IsInFtn()))
|
|
|
|
{
|
|
|
|
pCnt = pCnt->GetNextCntntFrm();
|
|
|
|
if ( !pLay->IsAnLower( pCnt ) )
|
|
|
|
pCnt = 0;
|
|
|
|
}
|
|
|
|
const SwCntntFrm *pNearest = pCnt;
|
|
|
|
if ( pCnt )
|
|
|
|
{
|
|
|
|
do
|
|
|
|
{
|
|
|
|
//Jetzt die Entfernung zwischen den beiden Punkten berechnen.
|
|
|
|
//'Delta' X^2 + 'Delta'Y^2 = 'Entfernung'^2
|
2006-03-16 11:27:39 +00:00
|
|
|
sal_uInt32 dX = Max( pCnt->Frm().Left(), rPt.X() ) -
|
2000-09-18 23:08:29 +00:00
|
|
|
Min( pCnt->Frm().Left(), rPt.X() ),
|
|
|
|
dY = Max( pCnt->Frm().Top(), rPt.Y() ) -
|
|
|
|
Min( pCnt->Frm().Top(), rPt.Y() );
|
|
|
|
BigInt dX1( dX ), dY1( dY );
|
|
|
|
dX1 *= dX1; dY1 *= dY1;
|
|
|
|
const ULONG nDiff = ::SqRt( dX1 + dY1 );
|
|
|
|
if ( pCnt->Frm().Top() <= rPt.Y() )
|
|
|
|
{
|
|
|
|
if ( nDiff < nDistance )
|
|
|
|
{ //Der ist dichter dran
|
|
|
|
nDistance = nNearest = nDiff;
|
|
|
|
rpCnt = pNearest = pCnt;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if ( nDiff < nNearest )
|
|
|
|
{
|
|
|
|
nNearest = nDiff;
|
|
|
|
pNearest = pCnt;
|
|
|
|
}
|
|
|
|
pCnt = pCnt->GetNextCntntFrm();
|
|
|
|
while ( pCnt &&
|
|
|
|
(bBody != pCnt->IsInDocBody() || bFtn != pCnt->IsInFtn()))
|
|
|
|
pCnt = pCnt->GetNextCntntFrm();
|
|
|
|
|
|
|
|
} while ( pCnt && pLay->IsAnLower( pCnt ) );
|
|
|
|
}
|
|
|
|
if ( nDistance == ULONG_MAX )
|
|
|
|
{ rpCnt = pNearest;
|
|
|
|
return nNearest;
|
|
|
|
}
|
|
|
|
return nDistance;
|
|
|
|
}
|
|
|
|
|
2007-09-06 13:01:55 +00:00
|
|
|
#ifdef _MSC_VER
|
2000-09-18 23:08:29 +00:00
|
|
|
#pragma optimize("e",on)
|
2007-09-06 13:01:55 +00:00
|
|
|
#endif
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
const SwCntntFrm * MA_FASTCALL lcl_FindCnt( const Point &rPt, const SwCntntFrm *pCnt,
|
|
|
|
const BOOL bBody, const BOOL bFtn )
|
|
|
|
{
|
|
|
|
//Sucht ausgehen von pCnt denjenigen CntntFrm, dessen linke obere
|
|
|
|
//Ecke am dichtesten am Point liegt.
|
|
|
|
//Liefert _immer_ einen CntntFrm zurueck.
|
|
|
|
|
|
|
|
//Zunaechst wird versucht den dichtesten Cntnt innerhalt derjenigen
|
|
|
|
//Seite zu suchen innerhalb derer der Cntnt steht.
|
|
|
|
//Ausgehend von der Seite muessen die Seiten in beide
|
|
|
|
//Richtungen beruecksichtigt werden.
|
|
|
|
//Falls moeglich wird ein Cntnt geliefert, dessen Y-Position ueber der
|
|
|
|
//des Point sitzt.
|
|
|
|
const SwCntntFrm *pRet, *pNew;
|
|
|
|
const SwLayoutFrm *pLay = pCnt->FindPageFrm();
|
|
|
|
ULONG nDist;
|
|
|
|
|
|
|
|
nDist = ::lcl_FindCntDiff( rPt, pLay, pNew, bBody, bFtn );
|
|
|
|
if ( pNew )
|
|
|
|
pRet = pNew;
|
|
|
|
else
|
|
|
|
{ pRet = pCnt;
|
|
|
|
nDist = ULONG_MAX;
|
|
|
|
}
|
|
|
|
const SwCntntFrm *pNearest = pRet;
|
|
|
|
ULONG nNearest = nDist;
|
|
|
|
|
|
|
|
if ( pLay )
|
|
|
|
{
|
|
|
|
const SwLayoutFrm *pPge = pLay;
|
|
|
|
ULONG nOldNew = ULONG_MAX;
|
|
|
|
for ( USHORT i = 0; pPge->GetPrev() && (i < 3); ++i )
|
|
|
|
{
|
|
|
|
pPge = (SwLayoutFrm*)pPge->GetPrev();
|
|
|
|
const ULONG nNew = ::lcl_FindCntDiff( rPt, pPge, pNew, bBody, bFtn );
|
|
|
|
if ( nNew < nDist )
|
|
|
|
{
|
|
|
|
if ( pNew->Frm().Top() <= rPt.Y() )
|
|
|
|
{
|
|
|
|
pRet = pNearest = pNew;
|
|
|
|
nDist = nNearest = nNew;
|
|
|
|
}
|
|
|
|
else if ( nNew < nNearest )
|
|
|
|
{
|
|
|
|
pNearest = pNew;
|
|
|
|
nNearest = nNew;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if ( nOldNew != ULONG_MAX && nNew > nOldNew )
|
|
|
|
break;
|
|
|
|
else
|
|
|
|
nOldNew = nNew;
|
|
|
|
|
|
|
|
}
|
|
|
|
pPge = pLay;
|
|
|
|
nOldNew = ULONG_MAX;
|
|
|
|
for ( USHORT j = 0; pPge->GetNext() && (j < 3); ++j )
|
|
|
|
{
|
|
|
|
pPge = (SwLayoutFrm*)pPge->GetNext();
|
|
|
|
const ULONG nNew = ::lcl_FindCntDiff( rPt, pPge, pNew, bBody, bFtn );
|
|
|
|
if ( nNew < nDist )
|
|
|
|
{
|
|
|
|
if ( pNew->Frm().Top() <= rPt.Y() )
|
|
|
|
{
|
|
|
|
pRet = pNearest = pNew;
|
|
|
|
nDist = nNearest = nNew;
|
|
|
|
}
|
|
|
|
else if ( nNew < nNearest )
|
|
|
|
{
|
|
|
|
pNearest = pNew;
|
|
|
|
nNearest = nNew;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if ( nOldNew != ULONG_MAX && nNew > nOldNew )
|
|
|
|
break;
|
|
|
|
else
|
|
|
|
nOldNew = nNew;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ( (pRet->Frm().Top() > rPt.Y()) )
|
|
|
|
return pNearest;
|
|
|
|
else
|
|
|
|
return pRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
void lcl_PointToPrt( Point &rPoint, const SwFrm *pFrm )
|
|
|
|
{
|
|
|
|
SwRect aTmp( pFrm->Prt() );
|
|
|
|
aTmp += pFrm->Frm().Pos();
|
|
|
|
if ( rPoint.X() < aTmp.Left() )
|
|
|
|
rPoint.X() = aTmp.Left();
|
|
|
|
else if ( rPoint.X() > aTmp.Right() )
|
|
|
|
rPoint.X() = aTmp.Right();
|
|
|
|
if ( rPoint.Y() < aTmp.Top() )
|
|
|
|
rPoint.Y() = aTmp.Top();
|
|
|
|
else if ( rPoint.Y() > aTmp.Bottom() )
|
|
|
|
rPoint.Y() = aTmp.Bottom();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
const SwCntntFrm *FindAnchor( const SwFrm *pOldAnch, const Point &rNew,
|
|
|
|
const BOOL bBodyOnly )
|
|
|
|
{
|
|
|
|
//Zu der angegebenen DokumentPosition wird der dichteste Cnt im
|
|
|
|
//Textfluss gesucht. AusgangsFrm ist der uebergebene Anker.
|
2004-02-02 17:21:12 +00:00
|
|
|
const SwCntntFrm* pCnt;
|
2000-09-18 23:08:29 +00:00
|
|
|
if ( pOldAnch->IsCntntFrm() )
|
2004-02-02 17:21:12 +00:00
|
|
|
{
|
2000-09-18 23:08:29 +00:00
|
|
|
pCnt = (const SwCntntFrm*)pOldAnch;
|
2004-02-02 17:21:12 +00:00
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
else
|
2004-02-02 17:21:12 +00:00
|
|
|
{
|
|
|
|
Point aTmp( rNew );
|
2000-09-18 23:08:29 +00:00
|
|
|
SwLayoutFrm *pTmpLay = (SwLayoutFrm*)pOldAnch;
|
|
|
|
if( pTmpLay->IsRootFrm() )
|
|
|
|
{
|
|
|
|
SwRect aTmpRect( aTmp, Size(0,0) );
|
|
|
|
pTmpLay = (SwLayoutFrm*)::FindPage( aTmpRect, pTmpLay->Lower() );
|
|
|
|
}
|
|
|
|
pCnt = pTmpLay->GetCntntPos( aTmp, FALSE, bBodyOnly );
|
|
|
|
}
|
|
|
|
|
|
|
|
//Beim Suchen darauf achten, dass die Bereiche sinnvoll erhalten
|
|
|
|
//bleiben. D.h. in diesem Fall nicht in Header/Footer hinein und
|
|
|
|
//nicht aus Header/Footer hinaus.
|
|
|
|
const BOOL bBody = pCnt->IsInDocBody() || bBodyOnly;
|
|
|
|
const BOOL bFtn = !bBodyOnly && pCnt->IsInFtn();
|
|
|
|
|
|
|
|
Point aNew( rNew );
|
|
|
|
if ( bBody )
|
|
|
|
{
|
|
|
|
//#38848 Vom Seitenrand in den Body ziehen.
|
|
|
|
const SwFrm *pPage = pCnt->FindPageFrm();
|
|
|
|
::lcl_PointToPrt( aNew, pPage->GetUpper() );
|
|
|
|
SwRect aTmp( aNew, Size( 0, 0 ) );
|
|
|
|
pPage = ::FindPage( aTmp, pPage );
|
|
|
|
::lcl_PointToPrt( aNew, pPage );
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( pCnt->IsInDocBody() == bBody && pCnt->Frm().IsInside( aNew ) )
|
|
|
|
return pCnt;
|
|
|
|
else if ( pOldAnch->IsInDocBody() || pOldAnch->IsPageFrm() )
|
|
|
|
{
|
|
|
|
//Vielleicht befindet sich der gewuenschte Anker ja auf derselben
|
|
|
|
//Seite wie der aktuelle Anker.
|
|
|
|
//So gibt es kein Problem mit Spalten.
|
|
|
|
Point aTmp( aNew );
|
|
|
|
const SwCntntFrm *pTmp = pCnt->FindPageFrm()->
|
|
|
|
GetCntntPos( aTmp, FALSE, TRUE, FALSE );
|
|
|
|
if ( pTmp && pTmp->Frm().IsInside( aNew ) )
|
|
|
|
return pTmp;
|
|
|
|
}
|
|
|
|
|
|
|
|
//Ausgehend vom Anker suche ich jetzt in beide Richtungen bis ich
|
|
|
|
//den jeweils dichtesten gefunden habe.
|
|
|
|
//Nicht die direkte Entfernung ist relevant sondern die Strecke die
|
|
|
|
//im Textfluss zurueckgelegt werden muss.
|
|
|
|
const SwCntntFrm *pUpLst;
|
|
|
|
const SwCntntFrm *pUpFrm = pCnt;
|
|
|
|
SwDistance nUp, nUpLst;
|
|
|
|
::lcl_CalcDownDist( nUp, aNew, pUpFrm );
|
|
|
|
SwDistance nDown = nUp;
|
|
|
|
BOOL bNegAllowed = TRUE;//Einmal aus dem negativen Bereich heraus lassen.
|
|
|
|
do
|
|
|
|
{
|
|
|
|
pUpLst = pUpFrm; nUpLst = nUp;
|
|
|
|
pUpFrm = pUpLst->GetPrevCntntFrm();
|
|
|
|
while ( pUpFrm &&
|
|
|
|
(bBody != pUpFrm->IsInDocBody() || bFtn != pUpFrm->IsInFtn()))
|
|
|
|
pUpFrm = pUpFrm->GetPrevCntntFrm();
|
|
|
|
if ( pUpFrm )
|
|
|
|
{
|
|
|
|
::lcl_CalcDownDist( nUp, aNew, pUpFrm );
|
|
|
|
//Wenn die Distanz innnerhalb einer Tabelle waechst, so lohnt es
|
|
|
|
//sich weiter zu suchen.
|
|
|
|
if ( pUpLst->IsInTab() && pUpFrm->IsInTab() )
|
|
|
|
{
|
|
|
|
while ( pUpFrm && ((nUpLst < nUp && pUpFrm->IsInTab()) ||
|
|
|
|
bBody != pUpFrm->IsInDocBody()) )
|
|
|
|
{
|
|
|
|
pUpFrm = pUpFrm->GetPrevCntntFrm();
|
|
|
|
if ( pUpFrm )
|
|
|
|
::lcl_CalcDownDist( nUp, aNew, pUpFrm );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ( !pUpFrm )
|
|
|
|
nUp.nMain = LONG_MAX;
|
2002-10-30 13:58:48 +00:00
|
|
|
if ( nUp.nMain >= 0 && LONG_MAX != nUp.nMain )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
bNegAllowed = FALSE;
|
|
|
|
if ( nUpLst.nMain < 0 ) //nicht den falschen erwischen, wenn der Wert
|
|
|
|
//gerade von negativ auf positiv gekippt ist.
|
|
|
|
{ pUpLst = pUpFrm;
|
|
|
|
nUpLst = nUp;
|
|
|
|
}
|
|
|
|
}
|
2002-10-30 13:58:48 +00:00
|
|
|
} while ( pUpFrm && ( ( bNegAllowed && nUp.nMain < 0 ) || ( nUp <= nUpLst ) ) );
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
const SwCntntFrm *pDownLst;
|
|
|
|
const SwCntntFrm *pDownFrm = pCnt;
|
|
|
|
SwDistance nDownLst;
|
|
|
|
if ( nDown.nMain < 0 )
|
|
|
|
nDown.nMain = LONG_MAX;
|
|
|
|
do
|
|
|
|
{
|
|
|
|
pDownLst = pDownFrm; nDownLst = nDown;
|
|
|
|
pDownFrm = pDownLst->GetNextCntntFrm();
|
|
|
|
while ( pDownFrm &&
|
|
|
|
(bBody != pDownFrm->IsInDocBody() || bFtn != pDownFrm->IsInFtn()))
|
|
|
|
pDownFrm = pDownFrm->GetNextCntntFrm();
|
|
|
|
if ( pDownFrm )
|
|
|
|
{
|
|
|
|
::lcl_CalcDownDist( nDown, aNew, pDownFrm );
|
|
|
|
if ( nDown.nMain < 0 )
|
|
|
|
nDown.nMain = LONG_MAX;
|
|
|
|
//Wenn die Distanz innnerhalb einer Tabelle waechst, so lohnt es
|
|
|
|
//sich weiter zu suchen.
|
|
|
|
if ( pDownLst->IsInTab() && pDownFrm->IsInTab() )
|
|
|
|
{
|
|
|
|
while ( pDownFrm && ( ( nDown.nMain != LONG_MAX && nDownLst < nDownLst
|
|
|
|
&& pDownFrm->IsInTab()) || bBody != pDownFrm->IsInDocBody() ) )
|
|
|
|
{
|
|
|
|
pDownFrm = pDownFrm->GetNextCntntFrm();
|
|
|
|
if ( pDownFrm )
|
|
|
|
::lcl_CalcDownDist( nDown, aNew, pDownFrm );
|
|
|
|
if ( nDown.nMain < 0 )
|
|
|
|
nDown.nMain = LONG_MAX;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ( !pDownFrm )
|
|
|
|
nDown.nMain = LONG_MAX;
|
|
|
|
|
|
|
|
} while ( pDownFrm && nDown <= nDownLst &&
|
|
|
|
nDown.nMain != LONG_MAX && nDownLst.nMain != LONG_MAX );
|
|
|
|
|
|
|
|
//Wenn ich in beide Richtungen keinen gefunden habe, so suche ich mir
|
|
|
|
//denjenigen Cntnt dessen linke obere Ecke dem Point am naechsten liegt.
|
|
|
|
//Eine derartige Situation tritt z.b. auf, wenn der Point nicht im Text-
|
|
|
|
//fluss sondern in irgendwelchen Raendern steht.
|
|
|
|
if ( nDownLst.nMain == LONG_MAX && nUpLst.nMain == LONG_MAX )
|
2002-10-30 14:04:08 +00:00
|
|
|
{
|
|
|
|
// #102861# If an OLE objects, which is contained in a fly frame
|
|
|
|
// is resized in inplace mode and the new Position is outside the
|
|
|
|
// fly frame, we do not want to leave our fly frame.
|
|
|
|
if ( pCnt->IsInFly() )
|
|
|
|
return pCnt;
|
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
return ::lcl_FindCnt( aNew, pCnt, bBody, bFtn );
|
2002-10-30 14:04:08 +00:00
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
else
|
|
|
|
return nDownLst < nUpLst ? pDownLst : pUpLst;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* SwFlyAtCntFrm::SetAbsPos()
|
|
|
|
|*
|
|
|
|
|* Ersterstellung MA 22. Jun. 93
|
|
|
|
|* Letzte Aenderung MA 11. Sep. 98
|
|
|
|
|*
|
|
|
|
|*************************************************************************/
|
|
|
|
|
2002-01-21 08:51:16 +00:00
|
|
|
void SwFlyAtCntFrm::SetAbsPos( const Point &rNew )
|
|
|
|
{
|
|
|
|
SwPageFrm *pOldPage = FindPageFrm();
|
2004-08-02 13:09:05 +00:00
|
|
|
const SwRect aOld( GetObjRectWithSpaces() );
|
2002-04-24 11:50:09 +00:00
|
|
|
Point aNew( rNew );
|
2002-10-10 07:48:06 +00:00
|
|
|
|
2004-06-28 12:39:13 +00:00
|
|
|
if( GetAnchorFrm()->IsVertical() || GetAnchorFrm()->IsRightToLeft() )
|
2002-10-10 07:48:06 +00:00
|
|
|
|
2002-04-24 11:50:09 +00:00
|
|
|
aNew.X() += Frm().Width();
|
2004-06-28 12:39:13 +00:00
|
|
|
SwCntntFrm *pCnt = (SwCntntFrm*)::FindAnchor( GetAnchorFrm(), aNew );
|
2002-01-21 08:51:16 +00:00
|
|
|
if( pCnt->IsProtected() )
|
2004-06-28 12:39:13 +00:00
|
|
|
pCnt = (SwCntntFrm*)GetAnchorFrm();
|
2002-01-21 08:51:16 +00:00
|
|
|
|
|
|
|
SwPageFrm *pPage = 0;
|
2002-04-24 11:50:09 +00:00
|
|
|
SWRECTFN( pCnt )
|
2002-10-10 07:48:06 +00:00
|
|
|
const sal_Bool bRTL = pCnt->IsRightToLeft();
|
|
|
|
|
2004-06-28 12:39:13 +00:00
|
|
|
if( ( bVert != GetAnchorFrm()->IsVertical() ) ||
|
|
|
|
( bRTL != GetAnchorFrm()->IsRightToLeft() ) )
|
2002-10-10 07:48:06 +00:00
|
|
|
{
|
|
|
|
if( bVert || bRTL )
|
|
|
|
aNew.X() += Frm().Width();
|
|
|
|
else
|
|
|
|
aNew.X() -= Frm().Width();
|
|
|
|
}
|
|
|
|
|
2002-01-21 08:51:16 +00:00
|
|
|
if ( pCnt->IsInDocBody() )
|
|
|
|
{
|
|
|
|
//#38848 Vom Seitenrand in den Body ziehen.
|
|
|
|
pPage = pCnt->FindPageFrm();
|
|
|
|
::lcl_PointToPrt( aNew, pPage->GetUpper() );
|
|
|
|
SwRect aTmp( aNew, Size( 0, 0 ) );
|
|
|
|
pPage = (SwPageFrm*)::FindPage( aTmp, pPage );
|
|
|
|
::lcl_PointToPrt( aNew, pPage );
|
|
|
|
}
|
|
|
|
|
|
|
|
//RelPos einstellen, nur auf Wunsch invalidieren.
|
|
|
|
//rNew ist eine Absolute Position. Um die RelPos korrekt einzustellen
|
|
|
|
//muessen wir uns die Entfernung von rNew zum Anker im Textfluss besorgen.
|
|
|
|
//!!!!!Hier kann Optimiert werden: FindAnchor koennte die RelPos mitliefern!
|
|
|
|
const SwFrm *pFrm = 0;
|
|
|
|
SwTwips nY;
|
|
|
|
if ( pCnt->Frm().IsInside( aNew ) )
|
|
|
|
{
|
|
|
|
if( bVert )
|
2002-04-24 11:50:09 +00:00
|
|
|
nY = pCnt->Frm().Left()+pCnt->Frm().Width()-rNew.X()-Frm().Width();
|
2002-01-21 08:51:16 +00:00
|
|
|
else
|
|
|
|
nY = rNew.Y() - pCnt->Frm().Top();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SwDistance aDist;
|
|
|
|
pFrm = ::lcl_CalcDownDist( aDist, aNew, pCnt );
|
|
|
|
nY = aDist.nMain + aDist.nSub;
|
|
|
|
}
|
|
|
|
|
|
|
|
SwTwips nX = 0;
|
|
|
|
|
|
|
|
if ( pCnt->IsFollow() )
|
|
|
|
{
|
|
|
|
//Flys haengen niemals an einem Follow sondern immer am
|
|
|
|
//Master, den suchen wir uns jetzt.
|
|
|
|
const SwCntntFrm *pOriginal = pCnt;
|
|
|
|
const SwCntntFrm *pFollow = pCnt;
|
|
|
|
while ( pCnt->IsFollow() )
|
|
|
|
{
|
|
|
|
do
|
|
|
|
{ pCnt = pCnt->GetPrevCntntFrm();
|
|
|
|
} while ( pCnt->GetFollow() != pFollow );
|
|
|
|
pFollow = pCnt;
|
|
|
|
}
|
|
|
|
SwTwips nDiff = 0;
|
|
|
|
do
|
|
|
|
{ const SwFrm *pUp = pFollow->GetUpper();
|
2002-08-14 08:51:35 +00:00
|
|
|
if( pUp->IsVertical() )
|
|
|
|
nDiff += pFollow->Frm().Left() + pFollow->Frm().Width()
|
|
|
|
- pUp->Frm().Left() - pUp->Prt().Left();
|
|
|
|
else
|
|
|
|
nDiff += pUp->Prt().Height() - pFollow->GetRelPos().Y();
|
2002-01-21 08:51:16 +00:00
|
|
|
pFollow = pFollow->GetFollow();
|
|
|
|
} while ( pFollow != pOriginal );
|
|
|
|
nY += nDiff;
|
2002-08-14 08:51:35 +00:00
|
|
|
if( bVert )
|
|
|
|
nX = pCnt->Frm().Top() - pOriginal->Frm().Top();
|
|
|
|
else
|
|
|
|
nX = pCnt->Frm().Left() - pOriginal->Frm().Left();
|
2002-01-21 08:51:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if ( nY == LONG_MAX )
|
|
|
|
{
|
|
|
|
if( bVert )
|
|
|
|
nY = pCnt->Frm().Left() + pCnt->Frm().Width() - rNew.X();
|
|
|
|
else
|
|
|
|
nY = rNew.Y() - pCnt->Frm().Top();
|
|
|
|
}
|
2003-05-22 08:47:03 +00:00
|
|
|
|
|
|
|
SwFlyFrmFmt *pFmt = (SwFlyFrmFmt*)GetFmt();
|
|
|
|
const SwFmtSurround& rSurround = pFmt->GetSurround();
|
|
|
|
const FASTBOOL bWrapThrough =
|
|
|
|
rSurround.GetSurround() == SURROUND_THROUGHT;
|
|
|
|
SwTwips nBaseOfstForFly = 0;
|
|
|
|
const SwFrm* pTmpFrm = pFrm ? pFrm : pCnt;
|
|
|
|
if ( pTmpFrm->IsTxtFrm() )
|
|
|
|
nBaseOfstForFly =
|
|
|
|
((SwTxtFrm*)pTmpFrm)->GetBaseOfstForFly( !bWrapThrough );
|
|
|
|
|
2002-01-21 08:51:16 +00:00
|
|
|
if( bVert )
|
|
|
|
{
|
|
|
|
if( !pFrm )
|
2003-05-22 08:47:03 +00:00
|
|
|
nX += rNew.Y() - pCnt->Frm().Top() - nBaseOfstForFly;
|
2002-01-21 08:51:16 +00:00
|
|
|
else
|
2003-05-22 08:47:03 +00:00
|
|
|
nX = rNew.Y() - pFrm->Frm().Top() - nBaseOfstForFly;
|
2002-01-21 08:51:16 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if( !pFrm )
|
2002-10-10 07:48:06 +00:00
|
|
|
{
|
|
|
|
if ( pCnt->IsRightToLeft() )
|
2003-05-22 08:47:03 +00:00
|
|
|
nX += pCnt->Frm().Right() - rNew.X() - Frm().Width() +
|
|
|
|
nBaseOfstForFly;
|
2002-10-10 07:48:06 +00:00
|
|
|
else
|
2003-05-22 08:47:03 +00:00
|
|
|
nX += rNew.X() - pCnt->Frm().Left() - nBaseOfstForFly;
|
2002-10-10 07:48:06 +00:00
|
|
|
}
|
2002-01-21 08:51:16 +00:00
|
|
|
else
|
2002-10-10 07:48:06 +00:00
|
|
|
{
|
|
|
|
if ( pFrm->IsRightToLeft() )
|
2003-05-22 08:47:03 +00:00
|
|
|
nX += pFrm->Frm().Right() - rNew.X() - Frm().Width() +
|
|
|
|
nBaseOfstForFly;
|
2002-10-10 07:48:06 +00:00
|
|
|
else
|
2003-05-22 08:47:03 +00:00
|
|
|
nX = rNew.X() - pFrm->Frm().Left() - nBaseOfstForFly;
|
2002-10-10 07:48:06 +00:00
|
|
|
}
|
2002-01-21 08:51:16 +00:00
|
|
|
}
|
2006-08-14 15:25:46 +00:00
|
|
|
GetFmt()->GetDoc()->StartUndo( UNDO_START, NULL );
|
2002-01-21 08:51:16 +00:00
|
|
|
|
2004-06-28 12:39:13 +00:00
|
|
|
if( pCnt != GetAnchorFrm() || ( IsAutoPos() && pCnt->IsTxtFrm() &&
|
2006-08-14 15:25:46 +00:00
|
|
|
GetFmt()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::HTML_MODE)) )
|
2002-01-21 08:51:16 +00:00
|
|
|
{
|
|
|
|
//Das Ankerattribut auf den neuen Cnt setzen.
|
|
|
|
SwFmtAnchor aAnch( pFmt->GetAnchor() );
|
|
|
|
SwPosition *pPos = (SwPosition*)aAnch.GetCntntAnchor();
|
|
|
|
if( IsAutoPos() && pCnt->IsTxtFrm() )
|
|
|
|
{
|
|
|
|
SwCrsrMoveState eTmpState( MV_SETONLYTEXT );
|
|
|
|
Point aPt( rNew );
|
|
|
|
if( pCnt->GetCrsrOfst( pPos, aPt, &eTmpState )
|
|
|
|
&& pPos->nNode == *pCnt->GetNode() )
|
|
|
|
{
|
2004-06-28 12:39:13 +00:00
|
|
|
ResetLastCharRectHeight();
|
2002-01-21 08:51:16 +00:00
|
|
|
if( REL_CHAR == pFmt->GetVertOrient().GetRelationOrient() )
|
|
|
|
nY = LONG_MAX;
|
|
|
|
if( REL_CHAR == pFmt->GetHoriOrient().GetRelationOrient() )
|
|
|
|
nX = LONG_MAX;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pPos->nNode = *pCnt->GetNode();
|
|
|
|
pPos->nContent.Assign( pCnt->GetNode(), 0 );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pPos->nNode = *pCnt->GetNode();
|
|
|
|
pPos->nContent.Assign( pCnt->GetNode(), 0 );
|
|
|
|
}
|
2006-03-21 14:36:27 +00:00
|
|
|
|
|
|
|
// --> OD 2006-02-27 #125892#
|
|
|
|
// handle change of anchor node:
|
|
|
|
// if count of the anchor frame also change, the fly frames have to be
|
|
|
|
// re-created. Thus, delete all fly frames except the <this> before the
|
|
|
|
// anchor attribute is change and re-create them afterwards.
|
|
|
|
{
|
|
|
|
SwHandleAnchorNodeChg aHandleAnchorNodeChg( *pFmt, aAnch, this );
|
|
|
|
pFmt->GetDoc()->SetAttr( aAnch, *pFmt );
|
|
|
|
}
|
|
|
|
// <--
|
2002-01-21 08:51:16 +00:00
|
|
|
}
|
2004-08-02 13:09:05 +00:00
|
|
|
// --> OD 2004-06-30 #i28701# - use new method <GetPageFrm()>
|
|
|
|
else if ( pPage && pPage != GetPageFrm() )
|
|
|
|
GetPageFrm()->MoveFly( this, pPage );
|
2002-01-21 08:51:16 +00:00
|
|
|
|
|
|
|
const Point aRelPos = bVert ? Point( -nY, nX ) : Point( nX, nY );
|
|
|
|
ChgRelPos( aRelPos );
|
|
|
|
|
2006-08-14 15:25:46 +00:00
|
|
|
GetFmt()->GetDoc()->EndUndo( UNDO_END, NULL );
|
2002-01-21 08:51:16 +00:00
|
|
|
|
|
|
|
if ( pOldPage != FindPageFrm() )
|
|
|
|
::Notify_Background( GetVirtDrawObj(), pOldPage, aOld, PREP_FLY_LEAVE,
|
|
|
|
FALSE );
|
|
|
|
}
|
|
|
|
|
2004-09-09 09:57:01 +00:00
|
|
|
// OD 2004-08-12 #i32795# - Note: method no longer used in <flyincnt.cxx>
|
|
|
|
//void DeepCalc( const SwFrm *pFrm )
|
|
|
|
//{
|
|
|
|
// if( pFrm->IsSctFrm() ||
|
|
|
|
// ( pFrm->IsFlyFrm() && ((SwFlyFrm*)pFrm)->IsFlyInCntFrm() ) )
|
|
|
|
// return;
|
|
|
|
// const SwFlowFrm *pFlow = SwFlowFrm::CastFlowFrm( pFrm );
|
|
|
|
// if( pFlow && pFlow->IsAnyJoinLocked() )
|
|
|
|
// return;
|
|
|
|
|
|
|
|
// USHORT nCnt = 0;
|
|
|
|
|
|
|
|
// FASTBOOL bContinue = FALSE;
|
|
|
|
// do
|
|
|
|
// {
|
|
|
|
// if ( ++nCnt == 10 )
|
|
|
|
// {
|
|
|
|
// ASSERT( !nCnt, "DeepCalc: Loop detected1?" );
|
|
|
|
// break;
|
|
|
|
// }
|
|
|
|
|
|
|
|
// const FASTBOOL bSetComplete = !pFrm->IsValid();
|
|
|
|
// const SwRect aOldFrm( pFrm->Frm() );
|
|
|
|
// const SwRect aOldPrt( pFrm->Prt() );
|
|
|
|
|
|
|
|
// const SwFrm *pUp = pFrm->GetUpper();
|
|
|
|
// if ( pUp )
|
|
|
|
// {
|
|
|
|
// //Nicht weiter wenn der Up ein Fly mit Spalten ist.
|
|
|
|
// if( ( !pUp->IsFlyFrm() || !((SwLayoutFrm*)pUp)->Lower() ||
|
|
|
|
// !((SwLayoutFrm*)pUp)->Lower()->IsColumnFrm() ) &&
|
|
|
|
// !pUp->IsSctFrm() )
|
|
|
|
// {
|
|
|
|
// SWRECTFN( pUp )
|
|
|
|
// const Point aPt( (pUp->Frm().*fnRect->fnGetPos)() );
|
|
|
|
// ::DeepCalc( pUp );
|
|
|
|
// bContinue = aPt != (pUp->Frm().*fnRect->fnGetPos)();
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// else
|
|
|
|
// pUp = pFrm;
|
|
|
|
|
|
|
|
// pFrm->Calc();
|
|
|
|
// if ( bSetComplete && (aOldFrm != pFrm->Frm() || aOldPrt != pFrm->Prt()))
|
|
|
|
// pFrm->SetCompletePaint();
|
|
|
|
|
|
|
|
// if ( pUp->IsFlyFrm() )
|
|
|
|
// {
|
|
|
|
// if ( ((SwFlyFrm*)pUp)->IsLocked() ||
|
|
|
|
// (((SwFlyFrm*)pUp)->IsFlyAtCntFrm() &&
|
|
|
|
// SwOszControl::IsInProgress( (const SwFlyFrm*)pUp )) )
|
|
|
|
// {
|
|
|
|
// bContinue = FALSE;
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// } while ( bContinue );
|
|
|
|
//}
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2004-08-02 13:09:05 +00:00
|
|
|
/** method to assure that anchored object is registered at the correct
|
|
|
|
page frame
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2004-08-02 13:09:05 +00:00
|
|
|
OD 2004-07-02 #i28701#
|
|
|
|
takes over functionality of deleted method <SwFlyAtCntFrm::AssertPage()>
|
|
|
|
|
|
|
|
@author OD
|
|
|
|
*/
|
|
|
|
void SwFlyAtCntFrm::RegisterAtCorrectPage()
|
|
|
|
{
|
|
|
|
SwPageFrm* pPageFrm( 0L );
|
|
|
|
if ( GetVertPosOrientFrm() )
|
|
|
|
{
|
|
|
|
pPageFrm = const_cast<SwPageFrm*>(GetVertPosOrientFrm()->FindPageFrm());
|
|
|
|
}
|
|
|
|
if ( pPageFrm && GetPageFrm() != pPageFrm )
|
|
|
|
{
|
|
|
|
if ( GetPageFrm() )
|
|
|
|
GetPageFrm()->MoveFly( this, pPageFrm );
|
|
|
|
else
|
|
|
|
pPageFrm->AppendFlyToPage( this );
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
2004-06-28 12:39:13 +00:00
|
|
|
// OD 2004-03-23 #i26791#
|
|
|
|
//void SwFlyAtCntFrm::MakeFlyPos()
|
|
|
|
void SwFlyAtCntFrm::MakeObjPos()
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2004-02-02 17:21:12 +00:00
|
|
|
// OD 02.10.2002 #102646#
|
2004-11-16 14:45:34 +00:00
|
|
|
// if fly frame position is valid, nothing is to do. Thus, return
|
2002-10-10 08:32:50 +00:00
|
|
|
if ( bValidPos )
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2004-06-28 12:39:13 +00:00
|
|
|
// OD 2004-03-24 #i26791# - validate position flag here.
|
|
|
|
bValidPos = TRUE;
|
|
|
|
|
2004-11-16 14:45:34 +00:00
|
|
|
// --> OD 2004-10-22 #i35911# - no calculation of new position, if
|
|
|
|
// anchored object is marked that it clears its environment and its
|
|
|
|
// environment is already cleared.
|
2006-01-27 13:36:06 +00:00
|
|
|
// --> OD 2006-01-02 #125977# - before checking for cleared environment
|
|
|
|
// check, if member <mpVertPosOrientFrm> is set.
|
|
|
|
if ( GetVertPosOrientFrm() &&
|
|
|
|
ClearedEnvironment() && HasClearedEnvironment() )
|
2004-11-16 14:45:34 +00:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
// <--
|
|
|
|
|
2004-03-08 13:00:27 +00:00
|
|
|
// OD 29.10.2003 #113049# - use new class to position object
|
|
|
|
objectpositioning::SwToCntntAnchoredObjectPosition
|
|
|
|
aObjPositioning( *GetVirtDrawObj() );
|
2004-02-02 17:21:12 +00:00
|
|
|
aObjPositioning.CalcPosition();
|
2002-01-17 07:54:14 +00:00
|
|
|
|
2004-06-28 12:39:13 +00:00
|
|
|
SetVertPosOrientFrm ( aObjPositioning.GetVertPosOrientFrm() );
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
2004-08-02 13:09:05 +00:00
|
|
|
|
|
|
|
// OD 2004-05-12 #i28701#
|
|
|
|
bool SwFlyAtCntFrm::_InvalidationAllowed( const InvalidationType _nInvalid ) const
|
|
|
|
{
|
|
|
|
bool bAllowed( SwFlyFreeFrm::_InvalidationAllowed( _nInvalid ) );
|
|
|
|
|
|
|
|
// forbiddance of base instance can't be over ruled.
|
|
|
|
if ( bAllowed )
|
|
|
|
{
|
|
|
|
if ( _nInvalid == INVALID_POS ||
|
|
|
|
_nInvalid == INVALID_ALL )
|
|
|
|
{
|
|
|
|
bAllowed = InvalidationOfPosAllowed();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return bAllowed;
|
|
|
|
}
|