2000-09-18 23:08:29 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
|
|
|
* $RCSfile: dcontact.cxx,v $
|
|
|
|
*
|
2005-01-21 09:30:46 +00:00
|
|
|
* $Revision: 1.40 $
|
2000-09-18 23:08:29 +00:00
|
|
|
*
|
2005-01-21 09:30:46 +00:00
|
|
|
* last change: $Author: kz $ $Date: 2005-01-21 10:30:46 $
|
2000-09-18 23:08:29 +00:00
|
|
|
*
|
|
|
|
* The Contents of this file are made available subject to the terms of
|
|
|
|
* either of the following licenses
|
|
|
|
*
|
|
|
|
* - GNU Lesser General Public License Version 2.1
|
|
|
|
* - Sun Industry Standards Source License Version 1.1
|
|
|
|
*
|
|
|
|
* Sun Microsystems Inc., October, 2000
|
|
|
|
*
|
|
|
|
* GNU Lesser General Public License Version 2.1
|
|
|
|
* =============================================
|
|
|
|
* Copyright 2000 by Sun Microsystems, Inc.
|
|
|
|
* 901 San Antonio Road, Palo Alto, CA 94303, USA
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Sun Industry Standards Source License Version 1.1
|
|
|
|
* =================================================
|
|
|
|
* The contents of this file are subject to the Sun Industry Standards
|
|
|
|
* Source License Version 1.1 (the "License"); You may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of the
|
|
|
|
* License at http://www.openoffice.org/license.html.
|
|
|
|
*
|
|
|
|
* Software provided under this License is provided on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
|
|
|
|
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
|
|
|
|
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
|
|
|
|
* See the License for the specific provisions governing your rights and
|
|
|
|
* obligations concerning the Software.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
|
|
|
|
*
|
|
|
|
* Copyright: 2000 by Sun Microsystems, Inc.
|
|
|
|
*
|
|
|
|
* All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s): _______________________________________
|
|
|
|
*
|
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
#pragma hdrstop
|
|
|
|
|
|
|
|
#include "hintids.hxx"
|
|
|
|
|
|
|
|
#ifndef _SVX_PROTITEM_HXX //autogen
|
|
|
|
#include <svx/protitem.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _SVX_OPAQITEM_HXX //autogen
|
|
|
|
#include <svx/opaqitem.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _SVX_ULSPITEM_HXX //autogen
|
|
|
|
#include <svx/ulspitem.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _SVX_LRSPITEM_HXX //autogen
|
|
|
|
#include <svx/lrspitem.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _SVDPAGE_HXX //autogen
|
|
|
|
#include <svx/svdpage.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _SVX_FMGLOB_HXX
|
|
|
|
#include <svx/fmglob.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _SVDOGRP_HXX //autogen
|
|
|
|
#include <svx/svdogrp.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _SVDOTEXT_HXX //autogen
|
|
|
|
#include <svx/svdotext.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _SVDMODEL_HXX //autogen
|
|
|
|
#include <svx/svdmodel.hxx>
|
|
|
|
#endif
|
2001-12-10 16:39:35 +00:00
|
|
|
#ifndef _SVDPAGV_HXX //autogen
|
|
|
|
#include <svx/svdpagv.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _SVDVITER_HXX
|
|
|
|
#include <svx/svdviter.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _SVDVIEW_HXX
|
|
|
|
#include <svx/svdview.hxx>
|
|
|
|
#endif
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
#ifndef _FMTORNT_HXX //autogen
|
|
|
|
#include <fmtornt.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _VIEWIMP_HXX //autogen
|
|
|
|
#include <viewimp.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _FMTSRND_HXX //autogen
|
|
|
|
#include <fmtsrnd.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _FMTANCHR_HXX //autogen
|
|
|
|
#include <fmtanchr.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _NODE_HXX //autogen
|
|
|
|
#include <node.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _FMTCNTNT_HXX //autogen
|
|
|
|
#include <fmtcntnt.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _PAGEFRM_HXX
|
|
|
|
#include <pagefrm.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _ROOTFRM_HXX
|
|
|
|
#include <rootfrm.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _FRMTOOL_HXX
|
|
|
|
#include <frmtool.hxx> // Notify_Background
|
|
|
|
#endif
|
|
|
|
#ifndef _FLYFRM_HXX
|
|
|
|
#include <flyfrm.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _FRMFMT_HXX
|
|
|
|
#include <frmfmt.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _FRMATR_HXX
|
|
|
|
#include <frmatr.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _DFLYOBJ_HXX
|
|
|
|
#include <dflyobj.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _DCONTACT_HXX
|
|
|
|
#include <dcontact.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _PAM_HXX
|
|
|
|
#include <pam.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _DOC_HXX
|
|
|
|
#include <doc.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _HINTS_HXX
|
|
|
|
#include <hints.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _CNTFRM_HXX
|
|
|
|
#include <cntfrm.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _TXTFRM_HXX
|
|
|
|
#include <txtfrm.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _EDITSH_HXX
|
|
|
|
#include <editsh.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _DOCARY_HXX
|
|
|
|
#include <docary.hxx>
|
|
|
|
#endif
|
|
|
|
|
2003-07-04 12:19:51 +00:00
|
|
|
// #108784#
|
|
|
|
#ifndef _XOUTX_HXX
|
|
|
|
#include <svx/xoutx.hxx>
|
|
|
|
#endif
|
|
|
|
|
2004-02-26 14:27:15 +00:00
|
|
|
// OD 2004-02-11 #110582#-2
|
|
|
|
#ifndef _FLYFRMS_HXX
|
|
|
|
#include <flyfrms.hxx>
|
|
|
|
#endif
|
|
|
|
|
2004-06-28 12:32:58 +00:00
|
|
|
// AW, OD 2004-04-30 #i28501#
|
|
|
|
#ifndef _SDR_CONTACT_OBJECTCONTACTOFOBJLISTPAINTER_HXX
|
|
|
|
#include <svx/sdr/contact/objectcontactofobjlistpainter.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _SDR_CONTACT_DISPLAYINFO_HXX
|
|
|
|
#include <svx/sdr/contact/displayinfo.hxx>
|
|
|
|
#endif
|
|
|
|
|
2003-07-04 12:19:51 +00:00
|
|
|
// OD 18.06.2003 #108784#
|
|
|
|
#include <algorithm>
|
2004-08-02 13:02:08 +00:00
|
|
|
// OD 2004-05-24 #i28701#
|
|
|
|
#ifndef _SORTEDOBJS_HXX
|
|
|
|
#include <sortedobjs.hxx>
|
|
|
|
#endif
|
2003-07-04 12:19:51 +00:00
|
|
|
|
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
TYPEINIT1( SwContact, SwClient )
|
|
|
|
TYPEINIT1( SwFlyDrawContact, SwContact )
|
|
|
|
TYPEINIT1( SwDrawContact, SwContact )
|
|
|
|
|
|
|
|
|
|
|
|
//Der Umgekehrte Weg: Sucht das Format zum angegebenen Objekt.
|
|
|
|
//Wenn das Object ein SwVirtFlyDrawObj ist so wird das Format von
|
|
|
|
//selbigem besorgt.
|
|
|
|
//Anderfalls ist es eben ein einfaches Zeichenobjekt. Diese hat einen
|
|
|
|
//UserCall und der ist Client vom gesuchten Format.
|
|
|
|
|
|
|
|
SwFrmFmt *FindFrmFmt( SdrObject *pObj )
|
|
|
|
{
|
2003-07-04 12:19:51 +00:00
|
|
|
SwFrmFmt* pRetval = 0L;
|
|
|
|
|
2003-11-24 15:01:52 +00:00
|
|
|
if ( pObj->ISA(SwVirtFlyDrawObj) )
|
2003-07-04 12:19:51 +00:00
|
|
|
{
|
2004-06-28 12:32:58 +00:00
|
|
|
pRetval = ((SwVirtFlyDrawObj*)pObj)->GetFmt();
|
2003-07-04 12:19:51 +00:00
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
else
|
|
|
|
{
|
2003-07-04 12:19:51 +00:00
|
|
|
SwDrawContact* pContact = static_cast<SwDrawContact*>(GetUserCall( pObj ));
|
|
|
|
if ( pContact )
|
|
|
|
{
|
|
|
|
pRetval = pContact->GetFmt();
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
2004-10-12 12:23:04 +00:00
|
|
|
/* SJ: after prior consultation with OD we decided to remove this Assertion
|
|
|
|
#if OSL_DEBUG_LEVEL > 1
|
|
|
|
ASSERT( pRetval,
|
|
|
|
"<::FindFrmFmt(..)> - no frame format found for given object. Please inform OD." );
|
|
|
|
#endif
|
|
|
|
*/
|
2003-07-04 12:19:51 +00:00
|
|
|
return pRetval;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
2003-05-22 08:43:04 +00:00
|
|
|
sal_Bool HasWrap( const SdrObject* pObj )
|
|
|
|
{
|
|
|
|
if ( pObj )
|
|
|
|
{
|
|
|
|
const SwFrmFmt* pFmt = ::FindFrmFmt( pObj );
|
|
|
|
if ( pFmt )
|
|
|
|
{
|
|
|
|
return SURROUND_THROUGHT != pFmt->GetSurround().GetSurround();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return sal_False;
|
|
|
|
}
|
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
/*****************************************************************************
|
|
|
|
*
|
|
|
|
* GetBoundRect liefert das BoundRect _inklusive_ Abstand des Objekts.
|
|
|
|
*
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
SwRect GetBoundRect( const SdrObject* pObj )
|
|
|
|
{
|
2003-11-24 15:01:52 +00:00
|
|
|
SwRect aRet( pObj->GetCurrentBoundRect() );
|
2000-09-18 23:08:29 +00:00
|
|
|
const SwFmt *pFmt = ((SwContact*)GetUserCall(pObj))->GetFmt();
|
|
|
|
const SvxULSpaceItem &rUL = pFmt->GetULSpace();
|
|
|
|
const SvxLRSpaceItem &rLR = pFmt->GetLRSpace();
|
2001-12-05 12:56:01 +00:00
|
|
|
{
|
|
|
|
aRet.Top ( Max( aRet.Top() - long(rUL.GetUpper()), 0L ));
|
|
|
|
aRet.Left( Max( aRet.Left()- long(rLR.GetLeft()), 0L ));
|
|
|
|
aRet.SSize().Height() += rUL.GetLower();
|
|
|
|
aRet.SSize().Width() += rLR.GetRight();
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
return aRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
//Liefert den UserCall ggf. vom Gruppenobjekt
|
2004-06-28 12:32:58 +00:00
|
|
|
// OD 2004-03-31 #i26791# - change return type
|
|
|
|
SwContact* GetUserCall( const SdrObject* pObj )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
SdrObject *pTmp;
|
|
|
|
while ( !pObj->GetUserCall() && 0 != (pTmp = pObj->GetUpGroup()) )
|
|
|
|
pObj = pTmp;
|
2004-06-28 12:32:58 +00:00
|
|
|
ASSERT( !pObj->GetUserCall() || pObj->GetUserCall()->ISA(SwContact),
|
|
|
|
"<::GetUserCall(..)> - wrong type of found object user call." );
|
|
|
|
return static_cast<SwContact*>(pObj->GetUserCall());
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// liefert TRUE falls das SrdObject ein Marquee-Object (Lauftext) ist
|
|
|
|
FASTBOOL IsMarqueeTextObj( const SdrObject& rObj )
|
|
|
|
{
|
|
|
|
SdrTextAniKind eTKind;
|
|
|
|
return SdrInventor == rObj.GetObjInventor() &&
|
|
|
|
OBJ_TEXT == rObj.GetObjIdentifier() &&
|
|
|
|
( SDRTEXTANI_SCROLL == ( eTKind = ((SdrTextObj&)rObj).GetTextAniKind())
|
|
|
|
|| SDRTEXTANI_ALTERNATE == eTKind || SDRTEXTANI_SLIDE == eTKind );
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* SwContact, Ctor und Dtor
|
|
|
|
|*
|
|
|
|
|* Ersterstellung AMA 27.Sep.96 18:13
|
|
|
|
|* Letzte Aenderung AMA 27.Sep.96
|
|
|
|
|*
|
|
|
|
|*************************************************************************/
|
|
|
|
|
2004-06-28 12:32:58 +00:00
|
|
|
SwContact::SwContact( SwFrmFmt *pToRegisterIn ) :
|
2000-09-18 23:08:29 +00:00
|
|
|
SwClient( pToRegisterIn ),
|
2003-09-29 14:04:59 +00:00
|
|
|
// OD 05.09.2003 #112039# - init member <mbInDTOR>
|
|
|
|
mbInDTOR( false )
|
2004-06-28 12:32:58 +00:00
|
|
|
{}
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
SwContact::~SwContact()
|
|
|
|
{
|
2003-09-29 14:04:59 +00:00
|
|
|
// OD 05.09.2003 #112039# - set <mbInDTOR>
|
|
|
|
SetInDTOR();
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
2003-09-29 14:04:59 +00:00
|
|
|
// OD 05.09.2003 #112039# - accessor for member <mbInDTOR>
|
|
|
|
const bool SwContact::IsInDTOR() const
|
|
|
|
{
|
|
|
|
return mbInDTOR;
|
|
|
|
}
|
|
|
|
|
|
|
|
// OD 05.09.2003 #112039# - accessor to set member <mbInDTOR>
|
|
|
|
void SwContact::SetInDTOR()
|
|
|
|
{
|
|
|
|
mbInDTOR = true;
|
|
|
|
}
|
|
|
|
|
2004-02-26 14:27:15 +00:00
|
|
|
/** method to move drawing object to corresponding visible layer
|
|
|
|
|
|
|
|
OD 21.08.2003 #i18447#
|
|
|
|
|
|
|
|
@author OD
|
|
|
|
*/
|
|
|
|
void SwContact::MoveObjToVisibleLayer( SdrObject* _pDrawObj )
|
|
|
|
{
|
|
|
|
_MoveObjToLayer( true, _pDrawObj );
|
|
|
|
}
|
|
|
|
|
|
|
|
/** method to move drawing object to corresponding invisible layer
|
|
|
|
|
|
|
|
OD 21.08.2003 #i18447#
|
|
|
|
|
|
|
|
@author OD
|
|
|
|
*/
|
|
|
|
void SwContact::MoveObjToInvisibleLayer( SdrObject* _pDrawObj )
|
|
|
|
{
|
|
|
|
_MoveObjToLayer( false, _pDrawObj );
|
|
|
|
}
|
|
|
|
|
|
|
|
/** method to move object to visible/invisible layer
|
|
|
|
|
|
|
|
OD 21.08.2003 #i18447#
|
|
|
|
implementation for the public method <MoveObjToVisibleLayer(..)>
|
|
|
|
and <MoveObjToInvisibleLayer(..)>
|
|
|
|
|
|
|
|
@author OD
|
|
|
|
*/
|
|
|
|
void SwContact::_MoveObjToLayer( const bool _bToVisible,
|
|
|
|
SdrObject* _pDrawObj )
|
|
|
|
{
|
|
|
|
if ( !_pDrawObj )
|
|
|
|
{
|
|
|
|
ASSERT( false, "SwDrawContact::_MoveObjToLayer(..) - no drawing object!" );
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( !pRegisteredIn )
|
|
|
|
{
|
|
|
|
ASSERT( false, "SwDrawContact::_MoveObjToLayer(..) - no drawing frame format!" );
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
SwDoc* pWriterDoc = static_cast<SwFrmFmt*>(pRegisteredIn)->GetDoc();
|
|
|
|
if ( !pWriterDoc )
|
|
|
|
{
|
|
|
|
ASSERT( false, "SwDrawContact::_MoveObjToLayer(..) - no writer document!" );
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
SdrLayerID nToHellLayerId =
|
|
|
|
_bToVisible ? pWriterDoc->GetHellId() : pWriterDoc->GetInvisibleHellId();
|
|
|
|
SdrLayerID nToHeavenLayerId =
|
|
|
|
_bToVisible ? pWriterDoc->GetHeavenId() : pWriterDoc->GetInvisibleHeavenId();
|
|
|
|
SdrLayerID nToControlLayerId =
|
|
|
|
_bToVisible ? pWriterDoc->GetControlsId() : pWriterDoc->GetInvisibleControlsId();
|
|
|
|
SdrLayerID nFromHellLayerId =
|
|
|
|
_bToVisible ? pWriterDoc->GetInvisibleHellId() : pWriterDoc->GetHellId();
|
|
|
|
SdrLayerID nFromHeavenLayerId =
|
|
|
|
_bToVisible ? pWriterDoc->GetInvisibleHeavenId() : pWriterDoc->GetHeavenId();
|
|
|
|
SdrLayerID nFromControlLayerId =
|
|
|
|
_bToVisible ? pWriterDoc->GetInvisibleControlsId() : pWriterDoc->GetControlsId();
|
|
|
|
|
|
|
|
if ( _pDrawObj->ISA( SdrObjGroup ) )
|
|
|
|
{
|
|
|
|
// determine layer for group object
|
|
|
|
{
|
|
|
|
// proposed layer of a group object is the hell layer
|
|
|
|
SdrLayerID nNewLayerId = nToHellLayerId;
|
|
|
|
if ( ::CheckControlLayer( _pDrawObj ) )
|
|
|
|
{
|
|
|
|
// it has to be the control layer, if one of the member
|
|
|
|
// is a control
|
|
|
|
nNewLayerId = nToControlLayerId;
|
|
|
|
}
|
|
|
|
else if ( _pDrawObj->GetLayer() == pWriterDoc->GetHeavenId() ||
|
|
|
|
_pDrawObj->GetLayer() == pWriterDoc->GetInvisibleHeavenId() )
|
|
|
|
{
|
|
|
|
// it has to be the heaven layer, if method <GetLayer()> reveals
|
|
|
|
// a heaven layer
|
|
|
|
nNewLayerId = nToHeavenLayerId;
|
|
|
|
}
|
|
|
|
// set layer at group object, but do *not* broadcast and
|
|
|
|
// no propagation to the members.
|
|
|
|
// Thus, call <NbcSetLayer(..)> at super class
|
|
|
|
_pDrawObj->SdrObject::NbcSetLayer( nNewLayerId );
|
|
|
|
}
|
|
|
|
|
|
|
|
// call method recursively for group object members
|
|
|
|
const SdrObjList* pLst =
|
|
|
|
static_cast<SdrObjGroup*>(_pDrawObj)->GetSubList();
|
|
|
|
if ( pLst )
|
|
|
|
{
|
|
|
|
for ( USHORT i = 0; i < pLst->GetObjCount(); ++i )
|
|
|
|
{
|
|
|
|
_MoveObjToLayer( _bToVisible, pLst->GetObj( i ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
const SdrLayerID nLayerIdOfObj = _pDrawObj->GetLayer();
|
|
|
|
if ( nLayerIdOfObj == nFromHellLayerId )
|
|
|
|
{
|
|
|
|
_pDrawObj->SetLayer( nToHellLayerId );
|
|
|
|
}
|
|
|
|
else if ( nLayerIdOfObj == nFromHeavenLayerId )
|
|
|
|
{
|
|
|
|
_pDrawObj->SetLayer( nToHeavenLayerId );
|
|
|
|
}
|
|
|
|
else if ( nLayerIdOfObj == nFromControlLayerId )
|
|
|
|
{
|
|
|
|
_pDrawObj->SetLayer( nToControlLayerId );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
// OD 2004-01-16 #110582# - some virtual helper methods for information
|
|
|
|
// about the object (Writer fly frame resp. drawing object)
|
|
|
|
|
|
|
|
const SwIndex& SwContact::GetCntntAnchorIndex() const
|
|
|
|
{
|
|
|
|
return GetCntntAnchor().nContent;
|
|
|
|
}
|
|
|
|
|
2004-09-09 09:55:21 +00:00
|
|
|
/** get minimum order number of anchored objects handled by with contact
|
|
|
|
|
|
|
|
OD 2004-08-24 #110810#
|
|
|
|
|
|
|
|
@author
|
|
|
|
*/
|
|
|
|
sal_uInt32 SwContact::GetMinOrdNum() const
|
|
|
|
{
|
|
|
|
sal_uInt32 nMinOrdNum( ULONG_MAX );
|
|
|
|
|
|
|
|
std::vector< SwAnchoredObject* > aObjs;
|
|
|
|
GetAnchoredObjs( aObjs );
|
|
|
|
|
|
|
|
while ( !aObjs.empty() )
|
|
|
|
{
|
|
|
|
sal_uInt32 nTmpOrdNum = aObjs.back()->GetDrawObj()->GetOrdNum();
|
|
|
|
|
|
|
|
if ( nTmpOrdNum < nMinOrdNum )
|
|
|
|
{
|
|
|
|
nMinOrdNum = nTmpOrdNum;
|
|
|
|
}
|
|
|
|
|
|
|
|
aObjs.pop_back();
|
|
|
|
}
|
|
|
|
|
|
|
|
ASSERT( nMinOrdNum != ULONG_MAX,
|
|
|
|
"<SwContact::GetMinOrdNum()> - no order number found." );
|
|
|
|
return nMinOrdNum;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** get maximum order number of anchored objects handled by with contact
|
|
|
|
|
|
|
|
OD 2004-08-24 #110810#
|
|
|
|
|
|
|
|
@author
|
|
|
|
*/
|
|
|
|
sal_uInt32 SwContact::GetMaxOrdNum() const
|
|
|
|
{
|
|
|
|
sal_uInt32 nMaxOrdNum( 0L );
|
|
|
|
|
|
|
|
std::vector< SwAnchoredObject* > aObjs;
|
|
|
|
GetAnchoredObjs( aObjs );
|
|
|
|
|
|
|
|
while ( !aObjs.empty() )
|
|
|
|
{
|
|
|
|
sal_uInt32 nTmpOrdNum = aObjs.back()->GetDrawObj()->GetOrdNum();
|
|
|
|
|
|
|
|
if ( nTmpOrdNum > nMaxOrdNum )
|
|
|
|
{
|
|
|
|
nMaxOrdNum = nTmpOrdNum;
|
|
|
|
}
|
|
|
|
|
|
|
|
aObjs.pop_back();
|
|
|
|
}
|
|
|
|
|
|
|
|
return nMaxOrdNum;
|
|
|
|
}
|
2004-02-26 14:27:15 +00:00
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* SwFlyDrawContact, Ctor und Dtor
|
|
|
|
|*
|
|
|
|
|* Ersterstellung OK 23.11.94 18:13
|
|
|
|
|* Letzte Aenderung MA 06. Apr. 95
|
|
|
|
|*
|
|
|
|
|*************************************************************************/
|
|
|
|
|
|
|
|
SwFlyDrawContact::SwFlyDrawContact( SwFlyFrmFmt *pToRegisterIn, SdrModel *pMod ) :
|
|
|
|
SwContact( pToRegisterIn )
|
|
|
|
{
|
2004-06-28 12:32:58 +00:00
|
|
|
// OD 2004-04-01 #i26791# - class <SwFlyDrawContact> contains the 'master'
|
|
|
|
// drawing object of type <SwFlyDrawObj> on its own.
|
|
|
|
mpMasterObj = new SwFlyDrawObj;
|
|
|
|
mpMasterObj->SetOrdNum( 0xFFFFFFFE );
|
|
|
|
mpMasterObj->SetUserCall( this );
|
|
|
|
}
|
|
|
|
|
|
|
|
SwFlyDrawContact::SwFlyDrawContact( SwFrmFmt* pToRegisterIn, SdrObject* pObj ):
|
|
|
|
SwContact( pToRegisterIn )
|
|
|
|
{
|
|
|
|
#if OSL_DEBUG_LEVEL > 1
|
|
|
|
ASSERT( pObj, "<SwFlyDrawContact::SwFlyDrawContact(..)> - no <SdrObject> provided. Please inform OD." );
|
|
|
|
#endif
|
|
|
|
ASSERT( !pObj || pObj->ISA(SwFlyDrawObj),
|
|
|
|
"<SwFlyDrawContact::SwFlyDrawContact(..)> - wrong type of <SdrObject>." );
|
|
|
|
mpMasterObj = static_cast<SwFlyDrawObj*>(pObj);
|
|
|
|
mpMasterObj->SetUserCall( this );
|
|
|
|
}
|
|
|
|
|
|
|
|
SwFlyDrawContact::~SwFlyDrawContact()
|
|
|
|
{
|
|
|
|
if ( mpMasterObj )
|
|
|
|
{
|
|
|
|
mpMasterObj->SetUserCall( 0 );
|
|
|
|
if ( mpMasterObj->GetPage() )
|
|
|
|
mpMasterObj->GetPage()->RemoveObject( mpMasterObj->GetOrdNum() );
|
|
|
|
delete mpMasterObj;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// OD 2004-03-29 #i26791#
|
|
|
|
const SwAnchoredObject* SwFlyDrawContact::GetAnchoredObj( const SdrObject* _pSdrObj ) const
|
|
|
|
{
|
|
|
|
ASSERT( _pSdrObj,
|
|
|
|
"<SwFlyDrawContact::GetAnchoredObj(..)> - no object provided" );
|
|
|
|
ASSERT( _pSdrObj->ISA(SwVirtFlyDrawObj),
|
|
|
|
"<SwFlyDrawContact::GetAnchoredObj(..)> - wrong object type object provided" );
|
|
|
|
ASSERT( GetUserCall( _pSdrObj ) == const_cast<SwFlyDrawContact*>(this),
|
|
|
|
"<SwFlyDrawContact::GetAnchoredObj(..)> - provided object doesn't belongs to this contact" );
|
|
|
|
|
|
|
|
const SwAnchoredObject* pRetAnchoredObj = 0L;
|
|
|
|
|
|
|
|
if ( _pSdrObj && _pSdrObj->ISA(SwVirtFlyDrawObj) )
|
|
|
|
{
|
|
|
|
pRetAnchoredObj = static_cast<const SwVirtFlyDrawObj*>(_pSdrObj)->GetFlyFrm();
|
|
|
|
}
|
|
|
|
|
|
|
|
return pRetAnchoredObj;
|
|
|
|
}
|
|
|
|
|
|
|
|
SwAnchoredObject* SwFlyDrawContact::GetAnchoredObj( SdrObject* _pSdrObj )
|
|
|
|
{
|
|
|
|
ASSERT( _pSdrObj,
|
|
|
|
"<SwFlyDrawContact::GetAnchoredObj(..)> - no object provided" );
|
|
|
|
ASSERT( _pSdrObj->ISA(SwVirtFlyDrawObj),
|
|
|
|
"<SwFlyDrawContact::GetAnchoredObj(..)> - wrong object type provided" );
|
|
|
|
ASSERT( GetUserCall( _pSdrObj ) == this,
|
|
|
|
"<SwFlyDrawContact::GetAnchoredObj(..)> - provided object doesn't belongs to this contact" );
|
|
|
|
|
|
|
|
SwAnchoredObject* pRetAnchoredObj = 0L;
|
|
|
|
|
|
|
|
if ( _pSdrObj && _pSdrObj->ISA(SwVirtFlyDrawObj) )
|
|
|
|
{
|
|
|
|
pRetAnchoredObj = static_cast<SwVirtFlyDrawObj*>(_pSdrObj)->GetFlyFrm();
|
|
|
|
}
|
|
|
|
|
|
|
|
return pRetAnchoredObj;
|
|
|
|
}
|
|
|
|
|
|
|
|
const SdrObject* SwFlyDrawContact::GetMaster() const
|
|
|
|
{
|
|
|
|
return mpMasterObj;
|
|
|
|
}
|
|
|
|
|
|
|
|
SdrObject* SwFlyDrawContact::GetMaster()
|
|
|
|
{
|
|
|
|
return mpMasterObj;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwFlyDrawContact::SetMaster( SdrObject* _pNewMaster )
|
|
|
|
{
|
|
|
|
ASSERT( _pNewMaster->ISA(SwFlyDrawObj),
|
|
|
|
"<SwFlyDrawContact::SetMaster(..)> - wrong type of new master object" );
|
|
|
|
mpMasterObj = static_cast<SwFlyDrawObj *>(_pNewMaster);
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* SwFlyDrawContact::CreateNewRef()
|
|
|
|
|*
|
|
|
|
|* Ersterstellung MA 14. Dec. 94
|
|
|
|
|* Letzte Aenderung MA 24. Apr. 95
|
|
|
|
|*
|
|
|
|
|*************************************************************************/
|
|
|
|
|
|
|
|
SwVirtFlyDrawObj *SwFlyDrawContact::CreateNewRef( SwFlyFrm *pFly )
|
|
|
|
{
|
|
|
|
SwVirtFlyDrawObj *pDrawObj = new SwVirtFlyDrawObj( *GetMaster(), pFly );
|
|
|
|
pDrawObj->SetModel( GetMaster()->GetModel() );
|
|
|
|
pDrawObj->SetUserCall( this );
|
|
|
|
|
|
|
|
//Der Reader erzeugt die Master und setzt diese, um die Z-Order zu
|
|
|
|
//transportieren, in die Page ein. Beim erzeugen der ersten Referenz werden
|
|
|
|
//die Master aus der Liste entfernt und fuehren von da an ein
|
|
|
|
//Schattendasein.
|
2004-09-09 09:55:21 +00:00
|
|
|
SdrPage* pPg( 0L );
|
2000-09-18 23:08:29 +00:00
|
|
|
if ( 0 != ( pPg = GetMaster()->GetPage() ) )
|
|
|
|
{
|
|
|
|
const UINT32 nOrdNum = GetMaster()->GetOrdNum();
|
|
|
|
pPg->ReplaceObject( pDrawObj, nOrdNum );
|
|
|
|
}
|
2004-09-09 09:55:21 +00:00
|
|
|
// --> OD 2004-08-16 #i27030# - insert new <SwVirtFlyDrawObj> instance
|
|
|
|
// into drawing page with correct order number
|
|
|
|
else
|
|
|
|
{
|
|
|
|
GetFmt()->GetDoc()->GetDrawModel()->GetPage( 0 )->
|
|
|
|
InsertObject( pDrawObj, _GetOrdNumForNewRef( pFly ) );
|
|
|
|
}
|
|
|
|
// <--
|
2005-01-05 13:29:21 +00:00
|
|
|
// --> OD 2004-12-13 #i38889# - assure, that new <SwVirtFlyDrawObj> instance
|
|
|
|
// is in a visible layer.
|
|
|
|
MoveObjToVisibleLayer( pDrawObj );
|
|
|
|
// <--
|
2000-09-18 23:08:29 +00:00
|
|
|
return pDrawObj;
|
|
|
|
}
|
|
|
|
|
2004-09-09 09:55:21 +00:00
|
|
|
/** method to determine new order number for new instance of <SwVirtFlyDrawObj>
|
|
|
|
|
|
|
|
OD 2004-08-16 #i27030#
|
|
|
|
Used in method <CreateNewRef(..)>
|
|
|
|
|
|
|
|
@author OD
|
|
|
|
*/
|
|
|
|
sal_uInt32 SwFlyDrawContact::_GetOrdNumForNewRef( const SwFlyFrm* _pFlyFrm )
|
|
|
|
{
|
|
|
|
sal_uInt32 nOrdNum( 0L );
|
|
|
|
|
|
|
|
// search for another Writer fly frame registered at same frame format
|
|
|
|
SwClientIter aIter( *GetFmt() );
|
|
|
|
const SwFlyFrm* pFlyFrm( 0L );
|
|
|
|
for ( pFlyFrm = (SwFlyFrm*)aIter.First( TYPE(SwFlyFrm) );
|
|
|
|
pFlyFrm;
|
|
|
|
pFlyFrm = (SwFlyFrm*)aIter.Next() )
|
|
|
|
{
|
|
|
|
if ( pFlyFrm != _pFlyFrm )
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( pFlyFrm )
|
|
|
|
{
|
|
|
|
// another Writer fly frame found. Take its order number
|
|
|
|
nOrdNum = pFlyFrm->GetVirtDrawObj()->GetOrdNum();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// no other Writer fly frame found. Take order number of 'master' object
|
2004-12-23 09:04:43 +00:00
|
|
|
// --> OD 2004-11-11 #i35748# - use method <GetOrdNumDirect()> instead
|
|
|
|
// of method <GetOrdNum()> to avoid a recalculation of the order number,
|
|
|
|
// which isn't intended.
|
|
|
|
nOrdNum = GetMaster()->GetOrdNumDirect();
|
|
|
|
// <--
|
2004-09-09 09:55:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return nOrdNum;
|
|
|
|
}
|
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* SwFlyDrawContact::Modify()
|
|
|
|
|*
|
|
|
|
|* Ersterstellung OK 08.11.94 10:21
|
|
|
|
|* Letzte Aenderung MA 06. Dec. 94
|
|
|
|
|*
|
|
|
|
|*************************************************************************/
|
|
|
|
|
|
|
|
void SwFlyDrawContact::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2004-02-26 14:27:15 +00:00
|
|
|
// OD 2004-01-16 #110582# - override method to control Writer fly frames,
|
|
|
|
// which are linked, and to assure that all objects anchored at/inside the
|
|
|
|
// Writer fly frame are also made visible.
|
|
|
|
void SwFlyDrawContact::MoveObjToVisibleLayer( SdrObject* _pDrawObj )
|
|
|
|
{
|
|
|
|
ASSERT( _pDrawObj->ISA(SwVirtFlyDrawObj),
|
|
|
|
"<SwFlyDrawContact::MoveObjToVisibleLayer(..)> - wrong SdrObject type -> crash" );
|
|
|
|
|
|
|
|
if ( GetFmt()->GetDoc()->IsVisibleLayerId( _pDrawObj->GetLayer() ) )
|
|
|
|
{
|
|
|
|
// nothing to do
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
SwFlyFrm* pFlyFrm = static_cast<SwVirtFlyDrawObj*>(_pDrawObj)->GetFlyFrm();
|
|
|
|
|
|
|
|
// OD 2004-02-12 #110582#-2 - insert columns, if necessary
|
|
|
|
pFlyFrm->InsertColumns();
|
2004-06-28 12:32:58 +00:00
|
|
|
pFlyFrm->Chain( pFlyFrm->AnchorFrm() );
|
2004-02-26 14:27:15 +00:00
|
|
|
pFlyFrm->InsertCnt();
|
|
|
|
if ( pFlyFrm->GetDrawObjs() )
|
|
|
|
{
|
|
|
|
for ( sal_uInt8 i = 0; i < pFlyFrm->GetDrawObjs()->Count(); ++i)
|
|
|
|
{
|
2004-08-02 13:02:08 +00:00
|
|
|
// --> OD 2004-07-01 #i28701# - consider type of objects in sorted object list.
|
|
|
|
SdrObject* pObj = (*pFlyFrm->GetDrawObjs())[i]->DrawObj();
|
2004-02-26 14:27:15 +00:00
|
|
|
SwContact* pContact = static_cast<SwContact*>(pObj->GetUserCall());
|
|
|
|
pContact->MoveObjToVisibleLayer( pObj );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// make fly frame visible
|
|
|
|
SwContact::MoveObjToVisibleLayer( _pDrawObj );
|
|
|
|
|
|
|
|
// OD 2004-02-11 #110582#-2
|
|
|
|
if ( pFlyFrm->IsFlyInCntFrm() )
|
|
|
|
{
|
|
|
|
static_cast<SwFlyInCntFrm*>(pFlyFrm)->SetRefPoint( Point(), Point(), Point() );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pFlyFrm->Frm().Pos( Point() );
|
|
|
|
}
|
|
|
|
pFlyFrm->InvalidatePos();
|
|
|
|
}
|
|
|
|
|
|
|
|
// OD 2004-01-16 #110582# - override method to control Writer fly frames,
|
|
|
|
// which are linked, and to assure that all objects anchored at/inside the
|
|
|
|
// Writer fly frame are also made invisible.
|
|
|
|
void SwFlyDrawContact::MoveObjToInvisibleLayer( SdrObject* _pDrawObj )
|
|
|
|
{
|
|
|
|
ASSERT( _pDrawObj->ISA(SwVirtFlyDrawObj),
|
|
|
|
"<SwFlyDrawContact::MoveObjToInvisibleLayer(..)> - wrong SdrObject type -> crash" );
|
|
|
|
|
|
|
|
if ( !GetFmt()->GetDoc()->IsVisibleLayerId( _pDrawObj->GetLayer() ) )
|
|
|
|
{
|
|
|
|
// nothing to do
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
SwFlyFrm* pFlyFrm = static_cast<SwVirtFlyDrawObj*>(_pDrawObj)->GetFlyFrm();
|
|
|
|
|
|
|
|
pFlyFrm->Unchain();
|
|
|
|
pFlyFrm->DeleteCnt();
|
|
|
|
if ( pFlyFrm->GetDrawObjs() )
|
|
|
|
{
|
|
|
|
for ( sal_uInt8 i = 0; i < pFlyFrm->GetDrawObjs()->Count(); ++i)
|
|
|
|
{
|
2004-08-02 13:02:08 +00:00
|
|
|
// --> OD 2004-07-01 #i28701# - consider type of objects in sorted object list.
|
|
|
|
SdrObject* pObj = (*pFlyFrm->GetDrawObjs())[i]->DrawObj();
|
2004-02-26 14:27:15 +00:00
|
|
|
SwContact* pContact = static_cast<SwContact*>(pObj->GetUserCall());
|
|
|
|
pContact->MoveObjToInvisibleLayer( pObj );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// make fly frame invisible
|
|
|
|
SwContact::MoveObjToInvisibleLayer( _pDrawObj );
|
|
|
|
}
|
|
|
|
|
2004-09-09 09:55:21 +00:00
|
|
|
/** get data collection of anchored objects, handled by with contact
|
|
|
|
|
|
|
|
OD 2004-08-23 #110810#
|
|
|
|
|
|
|
|
@author
|
|
|
|
*/
|
|
|
|
void SwFlyDrawContact::GetAnchoredObjs( std::vector<SwAnchoredObject*>& _roAnchoredObjs ) const
|
|
|
|
{
|
|
|
|
const SwFrmFmt* pFmt = GetFmt();
|
|
|
|
|
|
|
|
SwClientIter aIter( *(const_cast<SwFrmFmt*>(pFmt)) );
|
|
|
|
for( SwFlyFrm* pFlyFrm = (SwFlyFrm*)aIter.First( TYPE(SwFlyFrm) );
|
|
|
|
pFlyFrm;
|
|
|
|
pFlyFrm = (SwFlyFrm*)aIter.Next() )
|
|
|
|
{
|
|
|
|
_roAnchoredObjs.push_back( pFlyFrm );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* SwDrawContact, Ctor+Dtor
|
|
|
|
|*
|
|
|
|
|* Ersterstellung MA 09. Jan. 95
|
|
|
|
|* Letzte Aenderung MA 22. Jul. 98
|
|
|
|
|*
|
|
|
|
|*************************************************************************/
|
2003-07-04 12:19:51 +00:00
|
|
|
bool CheckControlLayer( const SdrObject *pObj )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
if ( FmFormInventor == pObj->GetObjInventor() )
|
2003-07-04 12:19:51 +00:00
|
|
|
return true;
|
2000-09-18 23:08:29 +00:00
|
|
|
if ( pObj->ISA( SdrObjGroup ) )
|
|
|
|
{
|
|
|
|
const SdrObjList *pLst = ((SdrObjGroup*)pObj)->GetSubList();
|
|
|
|
for ( USHORT i = 0; i < pLst->GetObjCount(); ++i )
|
2003-08-27 15:30:43 +00:00
|
|
|
{
|
2003-07-04 12:19:51 +00:00
|
|
|
if ( ::CheckControlLayer( pLst->GetObj( i ) ) )
|
2003-08-27 15:30:43 +00:00
|
|
|
{
|
|
|
|
// OD 21.08.2003 #i18447# - return correct value ;-)
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
2003-07-04 12:19:51 +00:00
|
|
|
return false;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
2004-06-28 12:32:58 +00:00
|
|
|
SwDrawContact::SwDrawContact( SwFrmFmt* pToRegisterIn, SdrObject* pObj ) :
|
|
|
|
SwContact( pToRegisterIn ),
|
|
|
|
maAnchoredDrawObj(),
|
|
|
|
mbMasterObjCleared( false ),
|
2003-12-01 08:39:02 +00:00
|
|
|
// OD 10.10.2003 #112299#
|
|
|
|
mbDisconnectInProgress( false )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2003-07-04 12:19:51 +00:00
|
|
|
// clear vector containing 'virtual' drawing objects.
|
2004-06-28 12:32:58 +00:00
|
|
|
maDrawVirtObjs.clear();
|
2003-07-04 12:19:51 +00:00
|
|
|
|
2004-11-03 15:00:42 +00:00
|
|
|
// --> OD 2004-09-22 #i33909# - assure, that drawing object is inserted
|
|
|
|
// in the drawing page.
|
|
|
|
if ( !pObj->IsInserted() )
|
|
|
|
{
|
|
|
|
pToRegisterIn->GetDoc()->GetDrawModel()->GetPage(0)->
|
|
|
|
InsertObject( pObj, pObj->GetOrdNumDirect() );
|
|
|
|
}
|
|
|
|
// <--
|
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
//Controls muessen immer im Control-Layer liegen. Das gilt auch fuer
|
|
|
|
//Gruppenobjekte, wenn diese Controls enthalten.
|
2003-07-04 12:19:51 +00:00
|
|
|
if ( ::CheckControlLayer( pObj ) )
|
|
|
|
{
|
|
|
|
// OD 25.06.2003 #108784# - set layer of object to corresponding invisible layer.
|
|
|
|
pObj->SetLayer( pToRegisterIn->GetDoc()->GetInvisibleControlsId() );
|
|
|
|
}
|
2004-06-28 12:32:58 +00:00
|
|
|
|
|
|
|
// OD 2004-03-29 #i26791#
|
|
|
|
pObj->SetUserCall( this );
|
|
|
|
maAnchoredDrawObj.SetDrawObj( *pObj );
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SwDrawContact::~SwDrawContact()
|
|
|
|
{
|
2003-09-29 14:04:59 +00:00
|
|
|
// OD 05.09.2003 #112039# - set <mbInDTOR>
|
|
|
|
SetInDTOR();
|
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
DisconnectFromLayout();
|
2003-07-04 12:19:51 +00:00
|
|
|
|
|
|
|
// OD 25.06.2003 #108784# - remove 'master' from drawing page
|
|
|
|
RemoveMasterFromDrawPage();
|
|
|
|
|
|
|
|
// remove and destroy 'virtual' drawing objects.
|
|
|
|
RemoveAllVirtObjs();
|
2004-06-28 12:32:58 +00:00
|
|
|
|
|
|
|
if ( !mbMasterObjCleared )
|
|
|
|
{
|
|
|
|
delete maAnchoredDrawObj.GetDrawObj();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// OD 2004-03-29 #i26791#
|
|
|
|
const SwAnchoredObject* SwDrawContact::GetAnchoredObj( const SdrObject* _pSdrObj ) const
|
|
|
|
{
|
|
|
|
// handle default parameter value
|
|
|
|
if ( !_pSdrObj )
|
|
|
|
{
|
|
|
|
_pSdrObj = GetMaster();
|
|
|
|
}
|
|
|
|
|
|
|
|
ASSERT( _pSdrObj,
|
|
|
|
"<SwDrawContact::GetAnchoredObj(..)> - no object provided" );
|
|
|
|
ASSERT( _pSdrObj->ISA(SwDrawVirtObj) ||
|
|
|
|
( !_pSdrObj->ISA(SdrVirtObj) && !_pSdrObj->ISA(SwDrawVirtObj) ),
|
|
|
|
"<SwDrawContact::GetAnchoredObj(..)> - wrong object type object provided" );
|
|
|
|
ASSERT( GetUserCall( _pSdrObj ) == const_cast<SwDrawContact*>(this) ||
|
|
|
|
_pSdrObj == GetMaster(),
|
|
|
|
"<SwDrawContact::GetAnchoredObj(..)> - provided object doesn't belongs to this contact" );
|
|
|
|
|
|
|
|
const SwAnchoredObject* pRetAnchoredObj = 0L;
|
|
|
|
|
|
|
|
if ( _pSdrObj )
|
|
|
|
{
|
|
|
|
if ( _pSdrObj->ISA(SwDrawVirtObj) )
|
|
|
|
{
|
|
|
|
pRetAnchoredObj = static_cast<const SwDrawVirtObj*>(_pSdrObj)->GetAnchoredObj();
|
|
|
|
}
|
|
|
|
else if ( !_pSdrObj->ISA(SdrVirtObj) && !_pSdrObj->ISA(SwDrawVirtObj) )
|
|
|
|
{
|
|
|
|
pRetAnchoredObj = &maAnchoredDrawObj;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return pRetAnchoredObj;
|
|
|
|
}
|
|
|
|
|
|
|
|
SwAnchoredObject* SwDrawContact::GetAnchoredObj( SdrObject* _pSdrObj )
|
|
|
|
{
|
|
|
|
// handle default parameter value
|
|
|
|
if ( !_pSdrObj )
|
|
|
|
{
|
|
|
|
_pSdrObj = GetMaster();
|
|
|
|
}
|
|
|
|
|
|
|
|
ASSERT( _pSdrObj,
|
|
|
|
"<SwDrawContact::GetAnchoredObj(..)> - no object provided" );
|
|
|
|
ASSERT( _pSdrObj->ISA(SwDrawVirtObj) ||
|
|
|
|
( !_pSdrObj->ISA(SdrVirtObj) && !_pSdrObj->ISA(SwDrawVirtObj) ),
|
|
|
|
"<SwDrawContact::GetAnchoredObj(..)> - wrong object type object provided" );
|
|
|
|
ASSERT( GetUserCall( _pSdrObj ) == this || _pSdrObj == GetMaster(),
|
|
|
|
"<SwDrawContact::GetAnchoredObj(..)> - provided object doesn't belongs to this contact" );
|
|
|
|
|
|
|
|
SwAnchoredObject* pRetAnchoredObj = 0L;
|
|
|
|
|
|
|
|
if ( _pSdrObj )
|
|
|
|
{
|
|
|
|
if ( _pSdrObj->ISA(SwDrawVirtObj) )
|
|
|
|
{
|
|
|
|
pRetAnchoredObj = static_cast<SwDrawVirtObj*>(_pSdrObj)->AnchoredObj();
|
|
|
|
}
|
|
|
|
else if ( !_pSdrObj->ISA(SdrVirtObj) && !_pSdrObj->ISA(SwDrawVirtObj) )
|
|
|
|
{
|
|
|
|
pRetAnchoredObj = &maAnchoredDrawObj;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return pRetAnchoredObj;
|
|
|
|
}
|
|
|
|
|
|
|
|
const SdrObject* SwDrawContact::GetMaster() const
|
|
|
|
{
|
|
|
|
return !mbMasterObjCleared
|
|
|
|
? maAnchoredDrawObj.GetDrawObj()
|
|
|
|
: 0L;
|
|
|
|
}
|
|
|
|
|
|
|
|
SdrObject* SwDrawContact::GetMaster()
|
|
|
|
{
|
|
|
|
return !mbMasterObjCleared
|
|
|
|
? maAnchoredDrawObj.DrawObj()
|
|
|
|
: 0L;
|
|
|
|
}
|
|
|
|
|
|
|
|
// OD 16.05.2003 #108784# - overload <SwContact::SetMaster(..)> in order to
|
|
|
|
// assert, if the 'master' drawing object is replaced.
|
|
|
|
// OD 10.07.2003 #110742# - replace of master object correctly handled, if
|
|
|
|
// handled by method <SwDrawContact::ChangeMasterObject(..)>. Thus, assert
|
|
|
|
// only, if a debug level is given.
|
|
|
|
void SwDrawContact::SetMaster( SdrObject* _pNewMaster )
|
|
|
|
{
|
|
|
|
if ( _pNewMaster )
|
|
|
|
{
|
|
|
|
#if OSL_DEBUG_LEVEL > 1
|
|
|
|
ASSERT( false, "debug notification - master replaced!" );
|
|
|
|
#endif
|
|
|
|
maAnchoredDrawObj.SetDrawObj( *_pNewMaster );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
mbMasterObjCleared = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const SwFrm* SwDrawContact::GetAnchorFrm( const SdrObject* _pDrawObj ) const
|
|
|
|
{
|
|
|
|
const SwFrm* pAnchorFrm = 0L;
|
|
|
|
if ( !_pDrawObj ||
|
|
|
|
_pDrawObj == GetMaster() ||
|
|
|
|
( !_pDrawObj->GetUserCall() &&
|
|
|
|
GetUserCall( _pDrawObj ) == static_cast<const SwContact* const>(this) ) )
|
|
|
|
{
|
|
|
|
pAnchorFrm = maAnchoredDrawObj.GetAnchorFrm();
|
|
|
|
}
|
|
|
|
else if ( _pDrawObj->ISA(SwDrawVirtObj) )
|
|
|
|
{
|
|
|
|
pAnchorFrm = static_cast<const SwDrawVirtObj*>(_pDrawObj)->GetAnchorFrm();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ASSERT( false,
|
|
|
|
"<SwDrawContact::GetAnchorFrm(..)> - unknown drawing object." )
|
|
|
|
}
|
|
|
|
|
|
|
|
return pAnchorFrm;
|
|
|
|
}
|
|
|
|
SwFrm* SwDrawContact::GetAnchorFrm( SdrObject* _pDrawObj )
|
|
|
|
{
|
|
|
|
SwFrm* pAnchorFrm = 0L;
|
|
|
|
if ( !_pDrawObj ||
|
|
|
|
_pDrawObj == GetMaster() ||
|
|
|
|
( !_pDrawObj->GetUserCall() &&
|
|
|
|
GetUserCall( _pDrawObj ) == this ) )
|
|
|
|
{
|
|
|
|
pAnchorFrm = maAnchoredDrawObj.AnchorFrm();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ASSERT( _pDrawObj->ISA(SwDrawVirtObj),
|
|
|
|
"<SwDrawContact::GetAnchorFrm(..)> - unknown drawing object." )
|
|
|
|
pAnchorFrm = static_cast<SwDrawVirtObj*>(_pDrawObj)->AnchorFrm();
|
|
|
|
}
|
|
|
|
|
|
|
|
return pAnchorFrm;
|
2003-07-04 12:19:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// OD 23.06.2003 #108784# - method to create a new 'virtual' drawing object.
|
|
|
|
SwDrawVirtObj* SwDrawContact::CreateVirtObj()
|
|
|
|
{
|
|
|
|
// determine 'master'
|
|
|
|
SdrObject* pOrgMasterSdrObj = GetMaster();
|
|
|
|
|
|
|
|
// create 'virtual' drawing object
|
|
|
|
SwDrawVirtObj* pNewDrawVirtObj = new SwDrawVirtObj ( *(pOrgMasterSdrObj), *(this) );
|
|
|
|
|
|
|
|
// add new 'virtual' drawing object managing data structure
|
|
|
|
maDrawVirtObjs.push_back( pNewDrawVirtObj );
|
|
|
|
|
|
|
|
return pNewDrawVirtObj;
|
|
|
|
}
|
|
|
|
|
|
|
|
// OD 23.06.2003 #108784# - destroys a given 'virtual' drawing object.
|
|
|
|
// side effect: 'virtual' drawing object is removed from data structure
|
|
|
|
// <maDrawVirtObjs>.
|
|
|
|
void SwDrawContact::DestroyVirtObj( SwDrawVirtObj* _pVirtObj )
|
|
|
|
{
|
|
|
|
if ( _pVirtObj )
|
|
|
|
{
|
|
|
|
delete _pVirtObj;
|
|
|
|
_pVirtObj = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// OD 16.05.2003 #108784# - add a 'virtual' drawing object to drawing page.
|
|
|
|
// Use an already created one, which isn't used, or create a new one.
|
|
|
|
SwDrawVirtObj* SwDrawContact::AddVirtObj()
|
|
|
|
{
|
|
|
|
SwDrawVirtObj* pAddedDrawVirtObj = 0L;
|
|
|
|
|
|
|
|
// check, if a disconnected 'virtual' drawing object exist and use it
|
|
|
|
std::list<SwDrawVirtObj*>::const_iterator aFoundVirtObjIter =
|
|
|
|
std::find_if( maDrawVirtObjs.begin(), maDrawVirtObjs.end(),
|
|
|
|
UsedOrUnusedVirtObjPred( false ) );
|
|
|
|
|
|
|
|
if ( aFoundVirtObjIter != maDrawVirtObjs.end() )
|
|
|
|
{
|
|
|
|
// use already created, disconnected 'virtual' drawing object
|
|
|
|
pAddedDrawVirtObj = (*aFoundVirtObjIter);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// create new 'virtual' drawing object.
|
|
|
|
pAddedDrawVirtObj = CreateVirtObj();
|
|
|
|
}
|
|
|
|
pAddedDrawVirtObj->AddToDrawingPage();
|
|
|
|
|
|
|
|
return pAddedDrawVirtObj;
|
|
|
|
}
|
|
|
|
|
|
|
|
// OD 16.05.2003 #108784# - remove 'virtual' drawing objects and destroy them.
|
|
|
|
void SwDrawContact::RemoveAllVirtObjs()
|
|
|
|
{
|
|
|
|
for ( std::list<SwDrawVirtObj*>::iterator aDrawVirtObjsIter = maDrawVirtObjs.begin();
|
|
|
|
aDrawVirtObjsIter != maDrawVirtObjs.end();
|
|
|
|
++aDrawVirtObjsIter )
|
|
|
|
{
|
|
|
|
// remove and destroy 'virtual object'
|
|
|
|
SwDrawVirtObj* pDrawVirtObj = (*aDrawVirtObjsIter);
|
|
|
|
pDrawVirtObj->RemoveFromWriterLayout();
|
|
|
|
pDrawVirtObj->RemoveFromDrawingPage();
|
|
|
|
DestroyVirtObj( pDrawVirtObj );
|
|
|
|
}
|
|
|
|
maDrawVirtObjs.clear();
|
|
|
|
}
|
|
|
|
|
2004-06-28 12:32:58 +00:00
|
|
|
SwDrawContact::VirtObjAnchoredAtFrmPred::VirtObjAnchoredAtFrmPred(
|
|
|
|
const SwFrm& _rAnchorFrm )
|
|
|
|
: mpAnchorFrm( &_rAnchorFrm )
|
2003-07-04 12:19:51 +00:00
|
|
|
{
|
2004-06-28 12:32:58 +00:00
|
|
|
if ( mpAnchorFrm->IsCntntFrm() )
|
|
|
|
{
|
|
|
|
const SwCntntFrm* pTmpFrm =
|
|
|
|
static_cast<const SwCntntFrm*>( mpAnchorFrm );
|
|
|
|
while ( pTmpFrm->IsFollow() )
|
|
|
|
{
|
|
|
|
pTmpFrm = pTmpFrm->FindMaster();
|
|
|
|
}
|
|
|
|
mpAnchorFrm = pTmpFrm;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// OD 2004-04-14 #i26791# - compare with master frame
|
|
|
|
bool SwDrawContact::VirtObjAnchoredAtFrmPred::operator() ( const SwDrawVirtObj* _pDrawVirtObj )
|
|
|
|
{
|
|
|
|
const SwFrm* pObjAnchorFrm = _pDrawVirtObj->GetAnchorFrm();
|
|
|
|
if ( pObjAnchorFrm && pObjAnchorFrm->IsCntntFrm() )
|
|
|
|
{
|
|
|
|
const SwCntntFrm* pTmpFrm =
|
|
|
|
static_cast<const SwCntntFrm*>( pObjAnchorFrm );
|
|
|
|
while ( pTmpFrm->IsFollow() )
|
|
|
|
{
|
|
|
|
pTmpFrm = pTmpFrm->FindMaster();
|
|
|
|
}
|
|
|
|
pObjAnchorFrm = pTmpFrm;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ( pObjAnchorFrm == mpAnchorFrm );
|
2003-07-04 12:19:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// OD 19.06.2003 #108784# - get drawing object ('master' or 'virtual') by frame.
|
|
|
|
SdrObject* SwDrawContact::GetDrawObjectByAnchorFrm( const SwFrm& _rAnchorFrm )
|
|
|
|
{
|
|
|
|
SdrObject* pRetDrawObj = 0L;
|
|
|
|
|
2004-06-28 12:32:58 +00:00
|
|
|
// OD 2004-04-14 #i26791# - compare master frames instead of direct frames
|
|
|
|
const SwFrm* pProposedAnchorFrm = &_rAnchorFrm;
|
|
|
|
if ( pProposedAnchorFrm->IsCntntFrm() )
|
|
|
|
{
|
|
|
|
const SwCntntFrm* pTmpFrm =
|
|
|
|
static_cast<const SwCntntFrm*>( pProposedAnchorFrm );
|
|
|
|
while ( pTmpFrm->IsFollow() )
|
|
|
|
{
|
|
|
|
pTmpFrm = pTmpFrm->FindMaster();
|
|
|
|
}
|
|
|
|
pProposedAnchorFrm = pTmpFrm;
|
|
|
|
}
|
|
|
|
|
|
|
|
const SwFrm* pMasterObjAnchorFrm = GetAnchorFrm();
|
|
|
|
if ( pMasterObjAnchorFrm && pMasterObjAnchorFrm->IsCntntFrm() )
|
|
|
|
{
|
|
|
|
const SwCntntFrm* pTmpFrm =
|
|
|
|
static_cast<const SwCntntFrm*>( pMasterObjAnchorFrm );
|
|
|
|
while ( pTmpFrm->IsFollow() )
|
|
|
|
{
|
|
|
|
pTmpFrm = pTmpFrm->FindMaster();
|
|
|
|
}
|
|
|
|
pMasterObjAnchorFrm = pTmpFrm;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( pMasterObjAnchorFrm && pMasterObjAnchorFrm == pProposedAnchorFrm )
|
2003-07-04 12:19:51 +00:00
|
|
|
{
|
|
|
|
pRetDrawObj = GetMaster();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
std::list<SwDrawVirtObj*>::const_iterator aFoundVirtObjIter =
|
|
|
|
std::find_if( maDrawVirtObjs.begin(), maDrawVirtObjs.end(),
|
2004-06-28 12:32:58 +00:00
|
|
|
VirtObjAnchoredAtFrmPred( *pProposedAnchorFrm ) );
|
2003-07-04 12:19:51 +00:00
|
|
|
|
|
|
|
if ( aFoundVirtObjIter != maDrawVirtObjs.end() )
|
|
|
|
{
|
|
|
|
pRetDrawObj = (*aFoundVirtObjIter);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return pRetDrawObj;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* SwDrawContact::Changed
|
|
|
|
|*
|
|
|
|
|* Ersterstellung MA 09. Jan. 95
|
|
|
|
|* Letzte Aenderung MA 29. May. 96
|
|
|
|
|*
|
|
|
|
|*************************************************************************/
|
|
|
|
|
2003-07-04 12:19:51 +00:00
|
|
|
// OD 03.07.2003 #108784#
|
|
|
|
void SwDrawContact::NotifyBackgrdOfAllVirtObjs( const Rectangle* pOldBoundRect )
|
|
|
|
{
|
|
|
|
for ( std::list<SwDrawVirtObj*>::iterator aDrawVirtObjIter = maDrawVirtObjs.begin();
|
|
|
|
aDrawVirtObjIter != maDrawVirtObjs.end();
|
|
|
|
++aDrawVirtObjIter )
|
|
|
|
{
|
|
|
|
SwDrawVirtObj* pDrawVirtObj = (*aDrawVirtObjIter);
|
|
|
|
if ( pDrawVirtObj->GetAnchorFrm() )
|
|
|
|
{
|
2004-11-16 14:40:11 +00:00
|
|
|
// --> OD 2004-10-21 #i34640# - determine correct page frame
|
|
|
|
SwPageFrm* pPage = pDrawVirtObj->AnchoredObj()->FindPageFrmOfAnchor();
|
|
|
|
// <--
|
2003-07-04 12:19:51 +00:00
|
|
|
if( pOldBoundRect && pPage )
|
|
|
|
{
|
|
|
|
SwRect aOldRect( *pOldBoundRect );
|
|
|
|
aOldRect.Pos() += pDrawVirtObj->GetOffset();
|
|
|
|
if( aOldRect.HasArea() )
|
2004-11-16 14:40:11 +00:00
|
|
|
::Notify_Background( pDrawVirtObj, pPage,
|
|
|
|
aOldRect, PREP_FLY_LEAVE,TRUE);
|
2003-07-04 12:19:51 +00:00
|
|
|
}
|
2004-11-16 14:40:11 +00:00
|
|
|
// --> OD 2004-10-21 #i34640# - include spacing for wrapping
|
|
|
|
SwRect aRect( pDrawVirtObj->GetAnchoredObj()->GetObjRectWithSpaces() );
|
|
|
|
// <--
|
2003-07-04 12:19:51 +00:00
|
|
|
if( aRect.HasArea() )
|
|
|
|
{
|
2004-11-16 14:40:11 +00:00
|
|
|
// --> OD 2004-10-21 #i34640# - simplify
|
|
|
|
SwPageFrm* pPg = (SwPageFrm*)::FindPage( aRect, pPage );
|
|
|
|
// <--
|
2003-07-04 12:19:51 +00:00
|
|
|
if ( pPg )
|
2004-06-28 12:32:58 +00:00
|
|
|
::Notify_Background( pDrawVirtObj, pPg, aRect,
|
2004-11-16 14:40:11 +00:00
|
|
|
PREP_FLY_ARRIVE, TRUE );
|
2003-07-04 12:19:51 +00:00
|
|
|
}
|
2004-06-28 12:32:58 +00:00
|
|
|
::ClrContourCache( pDrawVirtObj );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// OD 2004-04-08 #i26791# - local method to notify the background for a drawing object
|
|
|
|
void lcl_NotifyBackgroundOfObj( SwDrawContact& _rDrawContact,
|
|
|
|
const SdrObject& _rObj,
|
|
|
|
const Rectangle* _pOldObjRect )
|
|
|
|
{
|
2004-11-16 14:40:11 +00:00
|
|
|
// --> OD 2004-10-21 #i34640#
|
|
|
|
SwAnchoredObject* pAnchoredObj =
|
|
|
|
const_cast<SwAnchoredObject*>(_rDrawContact.GetAnchoredObj( &_rObj ));
|
|
|
|
if ( pAnchoredObj && pAnchoredObj->GetAnchorFrm() )
|
|
|
|
// <--
|
2004-06-28 12:32:58 +00:00
|
|
|
{
|
2004-11-16 14:40:11 +00:00
|
|
|
// --> OD 2004-10-21 #i34640# - determine correct page frame
|
|
|
|
SwPageFrm* pPageFrm = pAnchoredObj->FindPageFrmOfAnchor();
|
|
|
|
// <--
|
2004-06-28 12:32:58 +00:00
|
|
|
if( _pOldObjRect && pPageFrm )
|
|
|
|
{
|
|
|
|
SwRect aOldRect( *_pOldObjRect );
|
|
|
|
if( aOldRect.HasArea() )
|
|
|
|
{
|
2004-11-16 14:40:11 +00:00
|
|
|
// --> OD 2004-10-21 #i34640# - determine correct page frame
|
|
|
|
SwPageFrm* pOldPageFrm = (SwPageFrm*)::FindPage( aOldRect, pPageFrm );
|
|
|
|
// <--
|
|
|
|
::Notify_Background( &_rObj, pOldPageFrm, aOldRect,
|
2004-06-28 12:32:58 +00:00
|
|
|
PREP_FLY_LEAVE, TRUE);
|
|
|
|
}
|
|
|
|
}
|
2004-11-16 14:40:11 +00:00
|
|
|
// --> OD 2004-10-21 #i34640# - include spacing for wrapping
|
|
|
|
SwRect aNewRect( pAnchoredObj->GetObjRectWithSpaces() );
|
|
|
|
// <--
|
2004-06-28 12:32:58 +00:00
|
|
|
if( aNewRect.HasArea() && pPageFrm )
|
|
|
|
{
|
|
|
|
pPageFrm = (SwPageFrm*)::FindPage( aNewRect, pPageFrm );
|
|
|
|
::Notify_Background( &_rObj, pPageFrm, aNewRect,
|
|
|
|
PREP_FLY_ARRIVE, TRUE );
|
2003-07-04 12:19:51 +00:00
|
|
|
}
|
2004-06-28 12:32:58 +00:00
|
|
|
ClrContourCache( &_rObj );
|
2003-07-04 12:19:51 +00:00
|
|
|
}
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2003-07-04 12:19:51 +00:00
|
|
|
void SwDrawContact::Changed( const SdrObject& rObj,
|
|
|
|
SdrUserCallType eType,
|
|
|
|
const Rectangle& rOldBoundRect )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2004-06-28 12:32:58 +00:00
|
|
|
// OD 2004-06-01 #i26791# - no event handling, if existing <ViewShell>
|
|
|
|
// is in contruction
|
|
|
|
SwDoc* pDoc = GetFmt()->GetDoc();
|
|
|
|
if ( pDoc->GetRootFrm() &&
|
2004-08-02 12:05:46 +00:00
|
|
|
pDoc->GetRootFrm()->GetCurrShell() &&
|
2004-06-28 12:32:58 +00:00
|
|
|
pDoc->GetRootFrm()->GetCurrShell()->IsInConstructor() )
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
//Action aufsetzen, aber nicht wenn gerade irgendwo eine Action laeuft.
|
|
|
|
ViewShell *pSh = 0, *pOrg;
|
|
|
|
if ( pDoc->GetRootFrm() && pDoc->GetRootFrm()->IsCallbackActionEnabled() )
|
|
|
|
{
|
|
|
|
pDoc->GetEditShell( &pOrg );
|
|
|
|
pSh = pOrg;
|
|
|
|
if ( pSh )
|
|
|
|
do
|
|
|
|
{ if ( pSh->Imp()->IsAction() || pSh->Imp()->IsIdleAction() )
|
|
|
|
pSh = 0;
|
|
|
|
else
|
|
|
|
pSh = (ViewShell*)pSh->GetNext();
|
|
|
|
|
|
|
|
} while ( pSh && pSh != pOrg );
|
|
|
|
|
|
|
|
if ( pSh )
|
|
|
|
pDoc->GetRootFrm()->StartAllAction();
|
|
|
|
}
|
|
|
|
|
|
|
|
SdrObjUserCall::Changed( rObj, eType, rOldBoundRect );
|
|
|
|
_Changed( rObj, eType, &rOldBoundRect ); //Achtung, ggf. Suizid!
|
|
|
|
|
|
|
|
if ( pSh )
|
|
|
|
pDoc->GetRootFrm()->EndAllAction();
|
|
|
|
}
|
|
|
|
|
2003-07-04 12:19:51 +00:00
|
|
|
void SwDrawContact::_Changed( const SdrObject& rObj,
|
|
|
|
SdrUserCallType eType,
|
|
|
|
const Rectangle* pOldBoundRect )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2004-11-16 14:40:11 +00:00
|
|
|
// OD 05.08.2002 #100843# - do *not* notify, if document is destructing
|
|
|
|
// --> OD 2004-10-21 #i35912# - do *not* notify for as-character anchored
|
|
|
|
// drawing objects.
|
2004-12-23 09:04:43 +00:00
|
|
|
// --> OD 2004-11-11 #i35007#
|
|
|
|
// improvement: determine as-character anchored object flag only once.
|
|
|
|
const bool bAnchoredAsChar = ObjAnchoredAsChar();
|
|
|
|
// <--
|
2004-06-28 12:32:58 +00:00
|
|
|
const bool bNotify = !(GetFmt()->GetDoc()->IsInDtor()) &&
|
2004-11-16 14:40:11 +00:00
|
|
|
( SURROUND_THROUGHT != GetFmt()->GetSurround().GetSurround() ) &&
|
2004-12-23 09:04:43 +00:00
|
|
|
!bAnchoredAsChar;
|
2004-11-16 14:40:11 +00:00
|
|
|
// <--
|
2000-09-18 23:08:29 +00:00
|
|
|
switch( eType )
|
|
|
|
{
|
|
|
|
case SDRUSERCALL_DELETE:
|
|
|
|
{
|
2004-06-28 12:32:58 +00:00
|
|
|
if ( bNotify )
|
|
|
|
{
|
|
|
|
lcl_NotifyBackgroundOfObj( *this, rObj, pOldBoundRect );
|
2004-11-16 14:40:11 +00:00
|
|
|
// --> OD 2004-10-27 #i36181# - background of 'virtual'
|
|
|
|
// drawing objects have also been notified.
|
|
|
|
NotifyBackgrdOfAllVirtObjs( pOldBoundRect );
|
|
|
|
// <--
|
2004-06-28 12:32:58 +00:00
|
|
|
}
|
2003-07-11 11:22:56 +00:00
|
|
|
DisconnectFromLayout( false );
|
2000-09-18 23:08:29 +00:00
|
|
|
SetMaster( NULL );
|
|
|
|
delete this;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case SDRUSERCALL_INSERTED:
|
|
|
|
{
|
2003-12-01 08:39:02 +00:00
|
|
|
// OD 10.10.2003 #112299#
|
|
|
|
if ( mbDisconnectInProgress )
|
|
|
|
{
|
|
|
|
ASSERT( false,
|
|
|
|
"<SwDrawContact::_Changed(..)> - Insert event during disconnection from layout is invalid." );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ConnectToLayout();
|
2004-06-28 12:32:58 +00:00
|
|
|
if ( bNotify )
|
|
|
|
{
|
|
|
|
lcl_NotifyBackgroundOfObj( *this, rObj, pOldBoundRect );
|
|
|
|
}
|
2003-12-01 08:39:02 +00:00
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case SDRUSERCALL_REMOVED:
|
|
|
|
{
|
2004-06-28 12:32:58 +00:00
|
|
|
if ( bNotify )
|
|
|
|
{
|
|
|
|
lcl_NotifyBackgroundOfObj( *this, rObj, pOldBoundRect );
|
|
|
|
}
|
2003-07-11 11:22:56 +00:00
|
|
|
DisconnectFromLayout( false );
|
2000-09-18 23:08:29 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case SDRUSERCALL_MOVEONLY:
|
|
|
|
case SDRUSERCALL_RESIZE:
|
|
|
|
case SDRUSERCALL_CHILD_MOVEONLY :
|
|
|
|
case SDRUSERCALL_CHILD_RESIZE :
|
|
|
|
case SDRUSERCALL_CHILD_CHGATTR :
|
|
|
|
case SDRUSERCALL_CHILD_DELETE :
|
|
|
|
case SDRUSERCALL_CHILD_COPY :
|
|
|
|
case SDRUSERCALL_CHILD_INSERTED :
|
|
|
|
case SDRUSERCALL_CHILD_REMOVED :
|
2004-06-28 12:32:58 +00:00
|
|
|
{
|
2004-08-23 07:01:44 +00:00
|
|
|
// --> OD 2004-08-04 #i31698# - improvement:
|
|
|
|
// get instance <SwAnchoredDrawObject> only once
|
|
|
|
const SwAnchoredDrawObject* pAnchoredDrawObj =
|
|
|
|
static_cast<const SwAnchoredDrawObject*>( GetAnchoredObj( &rObj ) );
|
|
|
|
// <--
|
2004-06-28 12:32:58 +00:00
|
|
|
// OD 2004-04-06 #i26791# - adjust positioning and alignment attributes,
|
|
|
|
// if positioning of drawing object isn't in progress.
|
2004-10-27 11:30:54 +00:00
|
|
|
// --> OD 2004-10-19 #i35798# - no adjust of positioning attributes,
|
|
|
|
// if drawing object isn't attached to an anchor frame
|
|
|
|
if ( !pAnchoredDrawObj->IsPositioningInProgress() &&
|
|
|
|
!pAnchoredDrawObj->NotYetAttachedToAnchorFrm() )
|
|
|
|
// <--
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2004-12-23 09:04:43 +00:00
|
|
|
// --> OD 2004-09-29 #i34748# - If no last object rectangle is
|
|
|
|
// provided by the anchored object, use parameter <pOldBoundRect>.
|
|
|
|
const Rectangle& aOldObjRect = pAnchoredDrawObj->GetLastObjRect()
|
|
|
|
? *(pAnchoredDrawObj->GetLastObjRect())
|
|
|
|
: *(pOldBoundRect);
|
|
|
|
// <--
|
2004-08-23 07:01:44 +00:00
|
|
|
// --> OD 2004-08-04 #i31698# - determine layout direction
|
|
|
|
// via draw frame format.
|
|
|
|
SwFrmFmt::tLayoutDir eLayoutDir =
|
|
|
|
pAnchoredDrawObj->GetFrmFmt().GetLayoutDir();
|
|
|
|
// <--
|
|
|
|
// use geometry of drawing object
|
|
|
|
SwRect aObjRect( rObj.GetSnapRect() );
|
|
|
|
// If drawing object is a member of a group, the adjustment
|
|
|
|
// of the positioning and the alignment attributes has to
|
|
|
|
// be done for the top group object.
|
|
|
|
if ( rObj.GetUpGroup() )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2004-08-23 07:01:44 +00:00
|
|
|
const SdrObject* pGroupObj = rObj.GetUpGroup();
|
|
|
|
while ( pGroupObj->GetUpGroup() )
|
2004-06-28 12:32:58 +00:00
|
|
|
{
|
2004-08-23 07:01:44 +00:00
|
|
|
pGroupObj = pGroupObj->GetUpGroup();
|
2004-06-28 12:32:58 +00:00
|
|
|
}
|
2004-08-23 07:01:44 +00:00
|
|
|
// use geometry of drawing object
|
|
|
|
aObjRect = pGroupObj->GetSnapRect();
|
|
|
|
}
|
|
|
|
SwTwips nXPosDiff(0L);
|
|
|
|
SwTwips nYPosDiff(0L);
|
|
|
|
switch ( eLayoutDir )
|
|
|
|
{
|
|
|
|
case SwFrmFmt::HORI_L2R:
|
2002-01-31 08:41:44 +00:00
|
|
|
{
|
2004-08-23 07:01:44 +00:00
|
|
|
nXPosDiff = aObjRect.Left() - aOldObjRect.Left();
|
|
|
|
nYPosDiff = aObjRect.Top() - aOldObjRect.Top();
|
2004-06-28 12:32:58 +00:00
|
|
|
}
|
2004-08-23 07:01:44 +00:00
|
|
|
break;
|
|
|
|
case SwFrmFmt::HORI_R2L:
|
2004-06-28 12:32:58 +00:00
|
|
|
{
|
|
|
|
nXPosDiff = aOldObjRect.Right() - aObjRect.Right();
|
|
|
|
nYPosDiff = aObjRect.Top() - aOldObjRect.Top();
|
2002-01-31 08:41:44 +00:00
|
|
|
}
|
2004-08-23 07:01:44 +00:00
|
|
|
break;
|
|
|
|
case SwFrmFmt::VERT_R2L:
|
2003-07-04 12:19:51 +00:00
|
|
|
{
|
2004-08-23 07:01:44 +00:00
|
|
|
nXPosDiff = aObjRect.Top() - aOldObjRect.Top();
|
|
|
|
nYPosDiff = aOldObjRect.Right() - aObjRect.Right();
|
2004-06-28 12:32:58 +00:00
|
|
|
}
|
2004-08-23 07:01:44 +00:00
|
|
|
break;
|
|
|
|
default:
|
2004-06-28 12:32:58 +00:00
|
|
|
{
|
2004-08-23 07:01:44 +00:00
|
|
|
ASSERT( false,
|
|
|
|
"<SwDrawContact::_Changed(..)> - unsupported layout direction" );
|
2004-06-28 12:32:58 +00:00
|
|
|
}
|
2004-08-23 07:01:44 +00:00
|
|
|
}
|
|
|
|
SfxItemSet aSet( GetFmt()->GetDoc()->GetAttrPool(),
|
|
|
|
RES_VERT_ORIENT, RES_HORI_ORIENT, 0 );
|
|
|
|
const SwFmtVertOrient& rVert = GetFmt()->GetVertOrient();
|
|
|
|
if ( nYPosDiff != 0 )
|
|
|
|
{
|
2004-06-28 12:32:58 +00:00
|
|
|
|
2004-08-23 07:01:44 +00:00
|
|
|
if ( rVert.GetRelationOrient() == REL_CHAR ||
|
|
|
|
rVert.GetRelationOrient() == REL_VERT_LINE )
|
2004-06-28 12:32:58 +00:00
|
|
|
{
|
2004-08-23 07:01:44 +00:00
|
|
|
nYPosDiff = -nYPosDiff;
|
2004-06-28 12:32:58 +00:00
|
|
|
}
|
2004-08-23 07:01:44 +00:00
|
|
|
aSet.Put( SwFmtVertOrient( rVert.GetPos()+nYPosDiff,
|
2004-10-27 11:30:54 +00:00
|
|
|
VERT_NONE,
|
2004-08-23 07:01:44 +00:00
|
|
|
rVert.GetRelationOrient() ) );
|
|
|
|
}
|
2004-06-28 12:32:58 +00:00
|
|
|
|
2004-08-23 07:01:44 +00:00
|
|
|
const SwFmtHoriOrient& rHori = GetFmt()->GetHoriOrient();
|
2004-12-23 09:04:43 +00:00
|
|
|
if ( !bAnchoredAsChar && nXPosDiff != 0 )
|
2004-08-23 07:01:44 +00:00
|
|
|
{
|
|
|
|
aSet.Put( SwFmtHoriOrient( rHori.GetPos()+nXPosDiff,
|
2004-10-27 11:30:54 +00:00
|
|
|
HORI_NONE,
|
2004-08-23 07:01:44 +00:00
|
|
|
rHori.GetRelationOrient() ) );
|
2004-06-28 12:32:58 +00:00
|
|
|
}
|
2004-08-23 07:01:44 +00:00
|
|
|
|
|
|
|
if ( nYPosDiff ||
|
2004-12-23 09:04:43 +00:00
|
|
|
( !bAnchoredAsChar && nXPosDiff != 0 ) )
|
2004-08-23 07:01:44 +00:00
|
|
|
{
|
|
|
|
GetFmt()->GetDoc()->SetFlyFrmAttr( *(GetFmt()), aSet );
|
|
|
|
// keep new object rectangle, to avoid multiple
|
|
|
|
// changes of the attributes by multiple event from
|
|
|
|
// the drawing layer - e.g. group objects and its members
|
2004-10-27 11:30:54 +00:00
|
|
|
// --> OD 2004-09-29 #i34748# - use new method
|
|
|
|
// <SwAnchoredDrawObject::SetLastObjRect(..)>.
|
2004-08-23 07:01:44 +00:00
|
|
|
const_cast<SwAnchoredDrawObject*>(pAnchoredDrawObj)
|
2004-10-27 11:30:54 +00:00
|
|
|
->SetLastObjRect( aObjRect.SVRect() );
|
2004-08-23 07:01:44 +00:00
|
|
|
}
|
|
|
|
else if ( aObjRect.SSize() != aOldObjRect.GetSize() )
|
2004-06-28 12:32:58 +00:00
|
|
|
{
|
2004-08-23 07:01:44 +00:00
|
|
|
_InvalidateObjs();
|
2004-12-23 09:04:43 +00:00
|
|
|
// --> OD 2004-11-11 #i35007# - notify anchor frame
|
|
|
|
// of as-character anchored object
|
|
|
|
if ( bAnchoredAsChar )
|
|
|
|
{
|
|
|
|
const_cast<SwAnchoredDrawObject*>(pAnchoredDrawObj)
|
|
|
|
->AnchorFrm()->Prepare( PREP_FLY_ATTR_CHG, GetFmt() );
|
|
|
|
}
|
|
|
|
// <--
|
|
|
|
}
|
|
|
|
if ( bNotify )
|
|
|
|
{
|
|
|
|
// --> OD 2004-07-20 #i31573# - correction: Only invalidate
|
|
|
|
// background of given drawing object.
|
|
|
|
lcl_NotifyBackgroundOfObj( *this, rObj, &aOldObjRect );
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
2004-06-28 12:32:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2000-09-18 23:08:29 +00:00
|
|
|
case SDRUSERCALL_CHGATTR:
|
2004-06-28 12:32:58 +00:00
|
|
|
if ( bNotify )
|
|
|
|
{
|
|
|
|
lcl_NotifyBackgroundOfObj( *this, rObj, pOldBoundRect );
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* SwDrawContact::Modify()
|
|
|
|
|*
|
|
|
|
|* Ersterstellung MA 09. Jan. 95
|
|
|
|
|* Letzte Aenderung MA 03. Dec. 95
|
|
|
|
|*
|
|
|
|
|*************************************************************************/
|
|
|
|
|
|
|
|
void SwDrawContact::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew )
|
|
|
|
{
|
2003-12-01 08:39:02 +00:00
|
|
|
// OD 10.10.2003 #112299#
|
|
|
|
ASSERT( !mbDisconnectInProgress,
|
|
|
|
"<SwDrawContact::Modify(..)> called during disconnection.");
|
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
USHORT nWhich = pNew ? pNew->Which() : 0;
|
2004-06-28 12:32:58 +00:00
|
|
|
SwFmtAnchor* pAnchorFmt = 0L;
|
|
|
|
if ( RES_ATTRSET_CHG == nWhich )
|
|
|
|
{
|
|
|
|
if ( SFX_ITEM_SET == static_cast<SwAttrSetChg*>(pNew)->GetChgSet()->
|
|
|
|
GetItemState( RES_ANCHOR, FALSE, (const SfxPoolItem**)&pAnchorFmt ) )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2004-06-28 12:32:58 +00:00
|
|
|
// <pAnchorFmt> is set and will be handled below
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
}
|
2004-06-28 12:32:58 +00:00
|
|
|
else if ( RES_ANCHOR == nWhich )
|
|
|
|
{
|
|
|
|
pAnchorFmt = static_cast<SwFmtAnchor*>(pNew);
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2004-06-28 12:32:58 +00:00
|
|
|
if ( pAnchorFmt )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
// JP 10.04.95: nicht auf ein Reset Anchor reagieren !!!!!
|
2004-06-28 12:32:58 +00:00
|
|
|
if ( SFX_ITEM_SET ==
|
|
|
|
GetFmt()->GetAttrSet().GetItemState( RES_ANCHOR, FALSE ) )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2003-12-01 08:39:02 +00:00
|
|
|
// OD 10.10.2003 #112299# - no connect to layout during disconnection
|
|
|
|
if ( !mbDisconnectInProgress )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2004-06-28 12:32:58 +00:00
|
|
|
// determine old object retangle of 'master' drawing object
|
|
|
|
// for notification
|
|
|
|
const Rectangle* pOldRect = 0L;
|
2004-11-16 14:40:11 +00:00
|
|
|
Rectangle aOldRect;
|
2004-06-28 12:32:58 +00:00
|
|
|
if ( GetAnchorFrm() )
|
2003-12-01 08:39:02 +00:00
|
|
|
{
|
2004-11-16 14:40:11 +00:00
|
|
|
// --> OD 2004-10-27 #i36181# - include spacing in object
|
|
|
|
// rectangle for notification.
|
|
|
|
aOldRect = maAnchoredDrawObj.GetObjRectWithSpaces().SVRect();
|
|
|
|
pOldRect = &aOldRect;
|
|
|
|
// <--
|
2003-12-01 08:39:02 +00:00
|
|
|
}
|
2004-06-28 12:32:58 +00:00
|
|
|
// re-connect to layout due to anchor format change
|
|
|
|
ConnectToLayout( pAnchorFmt );
|
|
|
|
// notify background of drawing objects
|
|
|
|
lcl_NotifyBackgroundOfObj( *this, *GetMaster(), pOldRect );
|
|
|
|
NotifyBackgrdOfAllVirtObjs( pOldRect );
|
2001-10-24 09:32:03 +00:00
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
DisconnectFromLayout();
|
|
|
|
}
|
2004-08-02 13:02:08 +00:00
|
|
|
// --> OD 2004-07-01 #i28701# - on change of wrapping style, hell|heaven layer,
|
|
|
|
// or wrapping style influence an update of the <SwSortedObjs> list,
|
|
|
|
// the drawing object is registered in, has to be performed. This is triggered
|
|
|
|
// by the 1st parameter of method call <_InvalidateObjs(..)>.
|
2004-06-28 12:32:58 +00:00
|
|
|
else if ( RES_SURROUND == nWhich ||
|
2004-08-02 13:02:08 +00:00
|
|
|
RES_OPAQUE == nWhich ||
|
|
|
|
RES_WRAP_INFLUENCE_ON_OBJPOS == nWhich ||
|
2004-06-28 12:32:58 +00:00
|
|
|
( RES_ATTRSET_CHG == nWhich &&
|
|
|
|
( SFX_ITEM_SET == ((SwAttrSetChg*)pNew)->GetChgSet()->GetItemState(
|
2000-09-18 23:08:29 +00:00
|
|
|
RES_SURROUND, FALSE ) ||
|
2004-06-28 12:32:58 +00:00
|
|
|
SFX_ITEM_SET == ((SwAttrSetChg*)pNew)->GetChgSet()->GetItemState(
|
2004-08-02 13:02:08 +00:00
|
|
|
RES_OPAQUE, FALSE ) ||
|
2004-06-28 12:32:58 +00:00
|
|
|
SFX_ITEM_SET == ((SwAttrSetChg*)pNew)->GetChgSet()->GetItemState(
|
2004-08-02 13:02:08 +00:00
|
|
|
RES_WRAP_INFLUENCE_ON_OBJPOS, FALSE ) ) ) )
|
2004-06-28 12:32:58 +00:00
|
|
|
{
|
|
|
|
lcl_NotifyBackgroundOfObj( *this, *GetMaster(), 0L );
|
|
|
|
NotifyBackgrdOfAllVirtObjs( 0L );
|
2004-08-02 13:02:08 +00:00
|
|
|
_InvalidateObjs( true );
|
2004-06-28 12:32:58 +00:00
|
|
|
}
|
2004-08-02 13:02:08 +00:00
|
|
|
else if ( RES_UL_SPACE == nWhich || RES_LR_SPACE == nWhich ||
|
|
|
|
RES_HORI_ORIENT == nWhich || RES_VERT_ORIENT == nWhich ||
|
|
|
|
// --> OD 2004-07-01 #i28701# - add attribute 'Follow text flow'
|
|
|
|
RES_FOLLOW_TEXT_FLOW == nWhich ||
|
2004-06-28 12:32:58 +00:00
|
|
|
( RES_ATTRSET_CHG == nWhich &&
|
|
|
|
( SFX_ITEM_SET == ((SwAttrSetChg*)pNew)->GetChgSet()->GetItemState(
|
2004-08-02 13:02:08 +00:00
|
|
|
RES_LR_SPACE, FALSE ) ||
|
|
|
|
SFX_ITEM_SET == ((SwAttrSetChg*)pNew)->GetChgSet()->GetItemState(
|
|
|
|
RES_UL_SPACE, FALSE ) ||
|
|
|
|
SFX_ITEM_SET == ((SwAttrSetChg*)pNew)->GetChgSet()->GetItemState(
|
2004-06-28 12:32:58 +00:00
|
|
|
RES_HORI_ORIENT, FALSE ) ||
|
|
|
|
SFX_ITEM_SET == ((SwAttrSetChg*)pNew)->GetChgSet()->GetItemState(
|
2004-08-02 13:02:08 +00:00
|
|
|
RES_VERT_ORIENT, FALSE ) ||
|
|
|
|
SFX_ITEM_SET == ((SwAttrSetChg*)pNew)->GetChgSet()->GetItemState(
|
|
|
|
RES_FOLLOW_TEXT_FLOW, FALSE ) ) ) )
|
2004-06-28 12:32:58 +00:00
|
|
|
{
|
|
|
|
lcl_NotifyBackgroundOfObj( *this, *GetMaster(), 0L );
|
|
|
|
NotifyBackgrdOfAllVirtObjs( 0L );
|
|
|
|
_InvalidateObjs();
|
|
|
|
}
|
2004-11-16 14:40:11 +00:00
|
|
|
// --> OD 2004-10-26 #i35443#
|
|
|
|
else if ( RES_ATTRSET_CHG == nWhich )
|
|
|
|
{
|
|
|
|
lcl_NotifyBackgroundOfObj( *this, *GetMaster(), 0L );
|
|
|
|
NotifyBackgrdOfAllVirtObjs( 0L );
|
|
|
|
_InvalidateObjs();
|
|
|
|
}
|
|
|
|
// <--
|
2004-09-09 09:55:21 +00:00
|
|
|
else if ( RES_REMOVE_UNO_OBJECT == nWhich )
|
|
|
|
{
|
|
|
|
// nothing to do
|
|
|
|
}
|
|
|
|
#if OSL_DEBUG_LEVEL > 1
|
2004-08-02 13:02:08 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
ASSERT( false,
|
|
|
|
"<SwDrawContact::Modify(..)> - unhandled attribute? - please inform od@openoffice.org" );
|
|
|
|
}
|
2004-09-09 09:55:21 +00:00
|
|
|
#endif
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
2004-06-28 12:32:58 +00:00
|
|
|
// OD 2004-03-31 #i26791#
|
2004-08-02 13:02:08 +00:00
|
|
|
// --> OD 2004-07-01 #i28701# - added parameter <_bUpdateSortedObjsList>
|
|
|
|
void SwDrawContact::_InvalidateObjs( const bool _bUpdateSortedObjsList )
|
2004-06-28 12:32:58 +00:00
|
|
|
{
|
|
|
|
// invalidate position of existing 'virtual' drawing objects
|
|
|
|
for ( std::list<SwDrawVirtObj*>::iterator aDisconnectIter = maDrawVirtObjs.begin();
|
|
|
|
aDisconnectIter != maDrawVirtObjs.end();
|
|
|
|
++aDisconnectIter )
|
|
|
|
{
|
|
|
|
SwDrawVirtObj* pDrawVirtObj = (*aDisconnectIter);
|
2004-09-09 09:55:21 +00:00
|
|
|
// --> OD 2004-08-23 #i33313# - invalidation only for connected
|
|
|
|
// 'virtual' drawing objects
|
|
|
|
if ( pDrawVirtObj->IsConnected() )
|
2004-08-02 13:02:08 +00:00
|
|
|
{
|
2004-09-09 09:55:21 +00:00
|
|
|
pDrawVirtObj->AnchoredObj()->InvalidateObjPos();
|
|
|
|
// --> OD 2004-07-01 #i28701#
|
|
|
|
if ( _bUpdateSortedObjsList )
|
|
|
|
{
|
|
|
|
pDrawVirtObj->AnchoredObj()->UpdateObjInSortedList();
|
|
|
|
}
|
|
|
|
// <--
|
2004-08-02 13:02:08 +00:00
|
|
|
}
|
|
|
|
// <--
|
2004-06-28 12:32:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// invalidate position of 'master' drawing object
|
2005-01-21 09:30:46 +00:00
|
|
|
SwAnchoredObject* pAnchoredObj = GetAnchoredObj( 0L );
|
2004-08-02 13:02:08 +00:00
|
|
|
pAnchoredObj->InvalidateObjPos();
|
|
|
|
// --> OD 2004-07-01 #i28701#
|
|
|
|
if ( _bUpdateSortedObjsList )
|
|
|
|
{
|
|
|
|
pAnchoredObj->UpdateObjInSortedList();
|
|
|
|
}
|
|
|
|
// <--
|
2004-06-28 12:32:58 +00:00
|
|
|
}
|
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* SwDrawContact::DisconnectFromLayout()
|
|
|
|
|*
|
|
|
|
|* Ersterstellung MA 09. Jan. 95
|
|
|
|
|* Letzte Aenderung MA 25. Mar. 99
|
|
|
|
|*
|
|
|
|
|*************************************************************************/
|
|
|
|
|
2003-07-04 12:19:51 +00:00
|
|
|
void SwDrawContact::DisconnectFromLayout( bool _bMoveMasterToInvisibleLayer )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2003-12-01 08:39:02 +00:00
|
|
|
// OD 10.10.2003 #112299#
|
|
|
|
mbDisconnectInProgress = true;
|
|
|
|
|
2004-11-16 14:40:11 +00:00
|
|
|
// --> OD 2004-10-27 #i36181# - notify background of drawing object
|
|
|
|
if ( _bMoveMasterToInvisibleLayer &&
|
|
|
|
!(GetFmt()->GetDoc()->IsInDtor()) &&
|
|
|
|
GetAnchorFrm() )
|
|
|
|
{
|
|
|
|
const Rectangle aOldRect( maAnchoredDrawObj.GetObjRectWithSpaces().SVRect() );
|
|
|
|
lcl_NotifyBackgroundOfObj( *this, *GetMaster(), &aOldRect );
|
|
|
|
NotifyBackgrdOfAllVirtObjs( &aOldRect );
|
|
|
|
}
|
|
|
|
// <--
|
|
|
|
|
2003-07-04 12:19:51 +00:00
|
|
|
// OD 16.05.2003 #108784# - remove 'virtual' drawing objects from writer
|
|
|
|
// layout and from drawing page
|
|
|
|
for ( std::list<SwDrawVirtObj*>::iterator aDisconnectIter = maDrawVirtObjs.begin();
|
|
|
|
aDisconnectIter != maDrawVirtObjs.end();
|
|
|
|
++aDisconnectIter )
|
|
|
|
{
|
|
|
|
SwDrawVirtObj* pDrawVirtObj = (*aDisconnectIter);
|
|
|
|
pDrawVirtObj->RemoveFromWriterLayout();
|
|
|
|
pDrawVirtObj->RemoveFromDrawingPage();
|
|
|
|
}
|
|
|
|
|
2004-08-02 13:02:08 +00:00
|
|
|
if ( maAnchoredDrawObj.GetAnchorFrm() )
|
2003-07-04 12:19:51 +00:00
|
|
|
{
|
2004-08-02 13:02:08 +00:00
|
|
|
maAnchoredDrawObj.AnchorFrm()->RemoveDrawObj( maAnchoredDrawObj );
|
2003-07-04 12:19:51 +00:00
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2003-07-04 12:19:51 +00:00
|
|
|
if ( _bMoveMasterToInvisibleLayer && GetMaster() && GetMaster()->IsInserted() )
|
2001-12-10 16:39:35 +00:00
|
|
|
{
|
|
|
|
SdrViewIter aIter( GetMaster() );
|
|
|
|
for( SdrView* pView = aIter.FirstView(); pView;
|
|
|
|
pView = aIter.NextView() )
|
2003-07-04 12:19:51 +00:00
|
|
|
{
|
2001-12-10 16:39:35 +00:00
|
|
|
pView->MarkObj( GetMaster(), pView->GetPageViewPvNum(0), TRUE );
|
2003-07-04 12:19:51 +00:00
|
|
|
}
|
2001-12-10 16:39:35 +00:00
|
|
|
|
2003-07-04 12:19:51 +00:00
|
|
|
// OD 25.06.2003 #108784# - Instead of removing 'master' object from
|
|
|
|
// drawing page, move the 'master' drawing object into the corresponding
|
|
|
|
// invisible layer.
|
|
|
|
{
|
|
|
|
//((SwFrmFmt*)pRegisteredIn)->GetDoc()->GetDrawModel()->GetPage(0)->
|
|
|
|
// RemoveObject( GetMaster()->GetOrdNum() );
|
2003-08-27 15:30:43 +00:00
|
|
|
// OD 21.08.2003 #i18447# - in order to consider group object correct
|
|
|
|
// use new method <SwDrawContact::MoveObjToInvisibleLayer(..)>
|
|
|
|
MoveObjToInvisibleLayer( GetMaster() );
|
2003-07-04 12:19:51 +00:00
|
|
|
}
|
|
|
|
}
|
2003-12-01 08:39:02 +00:00
|
|
|
|
|
|
|
// OD 10.10.2003 #112299#
|
|
|
|
mbDisconnectInProgress = false;
|
2003-07-04 12:19:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// OD 26.06.2003 #108784# - method to remove 'master' drawing object
|
|
|
|
// from drawing page.
|
|
|
|
void SwDrawContact::RemoveMasterFromDrawPage()
|
|
|
|
{
|
|
|
|
if ( GetMaster() )
|
|
|
|
{
|
|
|
|
GetMaster()->SetUserCall( 0 );
|
|
|
|
if ( GetMaster()->IsInserted() )
|
|
|
|
{
|
|
|
|
((SwFrmFmt*)pRegisteredIn)->GetDoc()->GetDrawModel()->GetPage(0)->
|
|
|
|
RemoveObject( GetMaster()->GetOrdNum() );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// OD 19.06.2003 #108784# - disconnect for a dedicated drawing object -
|
|
|
|
// could be 'master' or 'virtual'.
|
|
|
|
// a 'master' drawing object will disconnect a 'virtual' drawing object
|
|
|
|
// in order to take its place.
|
2003-12-01 08:39:02 +00:00
|
|
|
// OD 13.10.2003 #i19919# - no special case, if drawing object isn't in
|
|
|
|
// page header/footer, in order to get drawing objects in repeating table headers
|
|
|
|
// also working.
|
2003-07-04 12:19:51 +00:00
|
|
|
void SwDrawContact::DisconnectObjFromLayout( SdrObject* _pDrawObj )
|
|
|
|
{
|
2003-12-01 08:39:02 +00:00
|
|
|
if ( _pDrawObj->ISA(SwDrawVirtObj) )
|
2003-07-04 12:19:51 +00:00
|
|
|
{
|
2003-12-01 08:39:02 +00:00
|
|
|
SwDrawVirtObj* pDrawVirtObj = static_cast<SwDrawVirtObj*>(_pDrawObj);
|
|
|
|
pDrawVirtObj->RemoveFromWriterLayout();
|
|
|
|
pDrawVirtObj->RemoveFromDrawingPage();
|
2003-07-04 12:19:51 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2003-12-01 08:39:02 +00:00
|
|
|
std::list<SwDrawVirtObj*>::const_iterator aFoundVirtObjIter =
|
|
|
|
std::find_if( maDrawVirtObjs.begin(), maDrawVirtObjs.end(),
|
|
|
|
UsedOrUnusedVirtObjPred( true ) );
|
|
|
|
if ( aFoundVirtObjIter != maDrawVirtObjs.end() )
|
2003-07-04 12:19:51 +00:00
|
|
|
{
|
2003-12-01 08:39:02 +00:00
|
|
|
// replace found 'virtual' drawing object by 'master' drawing
|
|
|
|
// object and disconnect the 'virtual' one
|
|
|
|
SwDrawVirtObj* pDrawVirtObj = (*aFoundVirtObjIter);
|
2004-06-28 12:32:58 +00:00
|
|
|
SwFrm* pNewAnchorFrmOfMaster = pDrawVirtObj->AnchorFrm();
|
2003-12-01 08:39:02 +00:00
|
|
|
// disconnect 'virtual' drawing object
|
2003-07-04 12:19:51 +00:00
|
|
|
pDrawVirtObj->RemoveFromWriterLayout();
|
|
|
|
pDrawVirtObj->RemoveFromDrawingPage();
|
2003-12-01 08:39:02 +00:00
|
|
|
// disconnect 'master' drawing object from current frame
|
2004-08-02 13:02:08 +00:00
|
|
|
GetAnchorFrm()->RemoveDrawObj( maAnchoredDrawObj );
|
2003-12-01 08:39:02 +00:00
|
|
|
// re-connect 'master' drawing object to frame of found 'virtual'
|
|
|
|
// drawing object.
|
2004-08-02 13:02:08 +00:00
|
|
|
pNewAnchorFrmOfMaster->AppendDrawObj( maAnchoredDrawObj );
|
2003-07-04 12:19:51 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2003-12-01 08:39:02 +00:00
|
|
|
// no connected 'virtual' drawing object found. Thus, disconnect
|
|
|
|
// completely from layout.
|
|
|
|
DisconnectFromLayout();
|
2003-07-04 12:19:51 +00:00
|
|
|
}
|
2001-12-10 16:39:35 +00:00
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* SwDrawContact::ConnectToLayout()
|
|
|
|
|*
|
|
|
|
|* Ersterstellung MA 09. Jan. 95
|
|
|
|
|* Letzte Aenderung MA 25. Mar. 99
|
|
|
|
|*
|
|
|
|
|*************************************************************************/
|
2004-02-26 14:27:15 +00:00
|
|
|
SwTxtFrm* lcl_GetFlyInCntntAnchor( SwTxtFrm* _pProposedAnchorFrm,
|
|
|
|
const xub_StrLen _nTxtOfs )
|
|
|
|
{
|
|
|
|
SwTxtFrm* pAct = _pProposedAnchorFrm;
|
|
|
|
SwTxtFrm* pTmp;
|
|
|
|
do
|
|
|
|
{
|
|
|
|
pTmp = pAct;
|
|
|
|
pAct = pTmp->GetFollow();
|
|
|
|
}
|
|
|
|
while( pAct && _nTxtOfs >= pAct->GetOfst() );
|
|
|
|
return pTmp;
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2003-07-04 12:19:51 +00:00
|
|
|
void SwDrawContact::ConnectToLayout( const SwFmtAnchor* pAnch )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2003-12-01 08:39:02 +00:00
|
|
|
// OD 10.10.2003 #112299# - *no* connect to layout during disconnection from
|
|
|
|
// layout.
|
|
|
|
if ( mbDisconnectInProgress )
|
|
|
|
{
|
|
|
|
ASSERT( false,
|
|
|
|
"<SwDrawContact::ConnectToLayout(..)> called during disconnection.");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2004-11-03 15:00:42 +00:00
|
|
|
// --> OD 2004-09-22 #i33909# - *no* connect to layout, if 'master' drawing
|
|
|
|
// object isn't inserted in the drawing page
|
|
|
|
if ( !GetMaster()->IsInserted() )
|
|
|
|
{
|
|
|
|
ASSERT( false, "<SwDrawContact::ConnectToLayout(..)> - master drawing object not inserted -> no connect to layout. Please inform od@openoffice.org" );
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
// <--
|
|
|
|
|
2003-07-04 12:19:51 +00:00
|
|
|
SwFrmFmt* pDrawFrmFmt = (SwFrmFmt*)pRegisteredIn;
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2003-07-04 12:19:51 +00:00
|
|
|
SwRootFrm* pRoot = pDrawFrmFmt->GetDoc()->GetRootFrm();
|
2000-09-18 23:08:29 +00:00
|
|
|
if ( !pRoot )
|
2003-07-04 12:19:51 +00:00
|
|
|
{
|
2000-09-18 23:08:29 +00:00
|
|
|
return;
|
2003-07-04 12:19:51 +00:00
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2003-07-04 12:19:51 +00:00
|
|
|
// OD 16.05.2003 #108784# - remove 'virtual' drawing objects from writer
|
|
|
|
// layout and from drawing page, and remove 'master' drawing object from
|
|
|
|
// writer layout - 'master' object will remain in drawing page.
|
|
|
|
DisconnectFromLayout( false );
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
if ( !pAnch )
|
2003-07-04 12:19:51 +00:00
|
|
|
{
|
|
|
|
pAnch = &(pDrawFrmFmt->GetAnchor());
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
switch ( pAnch->GetAnchorId() )
|
|
|
|
{
|
|
|
|
case FLY_PAGE:
|
2004-08-02 13:02:08 +00:00
|
|
|
{
|
2000-09-18 23:08:29 +00:00
|
|
|
USHORT nPgNum = pAnch->GetPageNum();
|
2003-07-04 12:19:51 +00:00
|
|
|
SwPageFrm *pPage = static_cast<SwPageFrm*>(pRoot->Lower());
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2003-07-04 12:19:51 +00:00
|
|
|
for ( USHORT i = 1; i < nPgNum && pPage; ++i )
|
|
|
|
{
|
|
|
|
pPage = static_cast<SwPageFrm*>(pPage->GetNext());
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
if ( pPage )
|
|
|
|
{
|
2004-08-02 13:02:08 +00:00
|
|
|
pPage->AppendDrawObj( maAnchoredDrawObj );
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
//Sieht doof aus, ist aber erlaubt (vlg. SwFEShell::SetPageObjsNewPage)
|
|
|
|
pRoot->SetAssertFlyPages();
|
2004-08-02 13:02:08 +00:00
|
|
|
}
|
|
|
|
break;
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
case FLY_AUTO_CNTNT:
|
|
|
|
case FLY_AT_CNTNT:
|
2003-07-04 12:19:51 +00:00
|
|
|
case FLY_AT_FLY:
|
|
|
|
case FLY_IN_CNTNT:
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2003-07-04 12:19:51 +00:00
|
|
|
if ( pAnch->GetAnchorId() == FLY_IN_CNTNT )
|
|
|
|
{
|
|
|
|
ClrContourCache( GetMaster() );
|
|
|
|
}
|
|
|
|
// OD 16.05.2003 #108784# - support drawing objects in header/footer,
|
|
|
|
// but not control objects:
|
|
|
|
// anchor at first found frame the 'master' object and
|
|
|
|
// at the following frames 'virtual' drawing objects.
|
|
|
|
// Note: method is similar to <SwFlyFrmFmt::MakeFrms(..)>
|
|
|
|
SwModify *pModify = 0;
|
|
|
|
if( pAnch->GetCntntAnchor() )
|
|
|
|
{
|
|
|
|
if ( pAnch->GetAnchorId() == FLY_AT_FLY )
|
|
|
|
{
|
|
|
|
SwNodeIndex aIdx( pAnch->GetCntntAnchor()->nNode );
|
|
|
|
SwCntntNode* pCNd = pDrawFrmFmt->GetDoc()->GetNodes().GoNext( &aIdx );
|
|
|
|
SwClientIter aIter( *pCNd );
|
|
|
|
if ( aIter.First( TYPE(SwFrm) ) )
|
|
|
|
pModify = pCNd;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
const SwNodeIndex& rIdx = pAnch->GetCntntAnchor()->nNode;
|
|
|
|
SwSpzFrmFmts& rFmts = *(pDrawFrmFmt->GetDoc()->GetSpzFrmFmts());
|
|
|
|
for( sal_uInt16 i = 0; i < rFmts.Count(); ++i )
|
|
|
|
{
|
|
|
|
SwFrmFmt* pFlyFmt = rFmts[i];
|
|
|
|
if( pFlyFmt->GetCntnt().GetCntntIdx() &&
|
|
|
|
rIdx == *(pFlyFmt->GetCntnt().GetCntntIdx()) )
|
|
|
|
{
|
|
|
|
pModify = pFlyFmt;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2004-07-05 13:39:32 +00:00
|
|
|
// --> OD 2004-06-15 #i29199# - It is possible, that
|
|
|
|
// the anchor doesn't exist - E.g., reordering the
|
|
|
|
// sub-documents in a master document.
|
|
|
|
// Note: The anchor will be inserted later.
|
|
|
|
if ( !pModify )
|
|
|
|
{
|
|
|
|
// break to end of the current switch case.
|
|
|
|
break;
|
|
|
|
}
|
2003-07-04 12:19:51 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pModify = pAnch->GetCntntAnchor()->nNode.GetNode().GetCntntNode();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
SwClientIter aIter( *pModify );
|
|
|
|
SwFrm* pAnchorFrmOfMaster = 0;
|
|
|
|
for( SwFrm *pFrm = (SwFrm*)aIter.First( TYPE(SwFrm) );
|
|
|
|
pFrm;
|
|
|
|
pFrm = (SwFrm*)aIter.Next() )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2003-07-04 12:19:51 +00:00
|
|
|
// append drawing object, if
|
|
|
|
// (1) proposed anchor frame isn't a follow and
|
|
|
|
// (2) drawing object isn't a control object to be anchored
|
|
|
|
// in header/footer.
|
|
|
|
const bool bAdd = ( !pFrm->IsCntntFrm() ||
|
|
|
|
!((SwCntntFrm*)pFrm)->IsFollow() ) &&
|
2003-08-27 15:30:43 +00:00
|
|
|
( !::CheckControlLayer( GetMaster() ) ||
|
2003-07-04 12:19:51 +00:00
|
|
|
!pFrm->FindFooterOrHeader() );
|
|
|
|
|
|
|
|
if( bAdd )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2003-07-04 12:19:51 +00:00
|
|
|
if ( FLY_AT_FLY == pAnch->GetAnchorId() && !pFrm->IsFlyFrm() )
|
|
|
|
{
|
|
|
|
pFrm = pFrm->FindFlyFrm();
|
2004-08-02 12:05:46 +00:00
|
|
|
ASSERT( pFrm,
|
|
|
|
"<SwDrawContact::ConnectToLayout(..)> - missing fly frame -> crash." );
|
2003-07-04 12:19:51 +00:00
|
|
|
}
|
|
|
|
|
2004-02-26 14:27:15 +00:00
|
|
|
// OD 2004-01-20 #110582# - find correct follow for
|
|
|
|
// as character anchored objects.
|
|
|
|
if ( pAnch->GetAnchorId() == FLY_IN_CNTNT &&
|
|
|
|
pFrm->IsTxtFrm() )
|
|
|
|
{
|
|
|
|
pFrm = lcl_GetFlyInCntntAnchor(
|
|
|
|
static_cast<SwTxtFrm*>(pFrm),
|
|
|
|
pAnch->GetCntntAnchor()->nContent.GetIndex() );
|
|
|
|
}
|
|
|
|
|
2003-07-04 12:19:51 +00:00
|
|
|
if ( !pAnchorFrmOfMaster )
|
|
|
|
{
|
|
|
|
// append 'master' drawing object
|
|
|
|
pAnchorFrmOfMaster = pFrm;
|
2004-08-02 13:02:08 +00:00
|
|
|
pFrm->AppendDrawObj( maAnchoredDrawObj );
|
2003-07-04 12:19:51 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// append 'virtual' drawing object
|
|
|
|
SwDrawVirtObj* pDrawVirtObj = AddVirtObj();
|
|
|
|
if ( pAnch->GetAnchorId() == FLY_IN_CNTNT )
|
|
|
|
{
|
|
|
|
ClrContourCache( pDrawVirtObj );
|
|
|
|
}
|
2004-08-02 13:02:08 +00:00
|
|
|
pFrm->AppendDrawObj( *(pDrawVirtObj->AnchoredObj()) );
|
2003-11-24 15:01:52 +00:00
|
|
|
|
|
|
|
// for repaint, use new ActionChanged()
|
|
|
|
// pDrawVirtObj->SendRepaintBroadcast();
|
|
|
|
pDrawVirtObj->ActionChanged();
|
2003-07-04 12:19:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if ( pAnch->GetAnchorId() == FLY_IN_CNTNT )
|
|
|
|
{
|
|
|
|
pFrm->InvalidatePrt();
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
#ifndef PRODUCT
|
|
|
|
default: ASSERT( FALSE, "Unknown Anchor." );
|
|
|
|
#endif
|
|
|
|
}
|
2004-06-28 12:32:58 +00:00
|
|
|
if ( GetAnchorFrm() )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2004-06-28 12:32:58 +00:00
|
|
|
// OD 2004-04-01 #i26791# - invalidate objects instead of direct positioning
|
|
|
|
_InvalidateObjs();
|
2003-07-04 12:19:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// OD 27.06.2003 #108784# - insert 'master' drawing object into drawing page
|
|
|
|
void SwDrawContact::InsertMasterIntoDrawPage()
|
|
|
|
{
|
|
|
|
if ( !GetMaster()->IsInserted() )
|
|
|
|
{
|
|
|
|
GetFmt()->GetDoc()->GetDrawModel()->GetPage(0)
|
|
|
|
->InsertObject( GetMaster(), GetMaster()->GetOrdNumDirect() );
|
|
|
|
}
|
|
|
|
GetMaster()->SetUserCall( this );
|
|
|
|
}
|
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* SwDrawContact::FindPage(), ChkPage()
|
|
|
|
|*
|
|
|
|
|* Ersterstellung MA 21. Mar. 95
|
|
|
|
|* Letzte Aenderung MA 19. Jul. 96
|
|
|
|
|*
|
|
|
|
|*************************************************************************/
|
|
|
|
|
2003-07-04 12:19:51 +00:00
|
|
|
SwPageFrm* SwDrawContact::FindPage( const SwRect &rRect )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2004-08-02 13:02:08 +00:00
|
|
|
// --> OD 2004-07-01 #i28701# - use method <GetPageFrm()>
|
2004-06-28 12:32:58 +00:00
|
|
|
SwPageFrm* pPg = GetPageFrm();
|
|
|
|
if ( !pPg && GetAnchorFrm() )
|
|
|
|
pPg = GetAnchorFrm()->FindPageFrm();
|
2000-09-18 23:08:29 +00:00
|
|
|
if ( pPg )
|
|
|
|
pPg = (SwPageFrm*)::FindPage( rRect, pPg );
|
|
|
|
return pPg;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwDrawContact::ChkPage()
|
|
|
|
{
|
2003-12-01 08:39:02 +00:00
|
|
|
// OD 10.10.2003 #112299#
|
|
|
|
if ( mbDisconnectInProgress )
|
|
|
|
{
|
|
|
|
ASSERT( false,
|
|
|
|
"<SwDrawContact::ChkPage()> called during disconnection." );
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2004-08-02 13:02:08 +00:00
|
|
|
// --> OD 2004-07-01 #i28701#
|
|
|
|
SwPageFrm* pPg = ( maAnchoredDrawObj.GetAnchorFrm() &&
|
|
|
|
maAnchoredDrawObj.GetAnchorFrm()->IsPageFrm() )
|
|
|
|
? GetPageFrm()
|
|
|
|
: FindPage( GetMaster()->GetCurrentBoundRect() );
|
2004-06-28 12:32:58 +00:00
|
|
|
if ( GetPageFrm() != pPg )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2003-07-04 12:19:51 +00:00
|
|
|
// OD 27.06.2003 #108784# - if drawing object is anchor in header/footer
|
|
|
|
// a change of the page is a dramatic change. Thus, completely re-connect
|
|
|
|
// to the layout
|
2004-08-02 13:02:08 +00:00
|
|
|
if ( maAnchoredDrawObj.GetAnchorFrm() &&
|
|
|
|
maAnchoredDrawObj.GetAnchorFrm()->FindFooterOrHeader() )
|
2003-07-04 12:19:51 +00:00
|
|
|
{
|
|
|
|
ConnectToLayout();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-08-02 13:02:08 +00:00
|
|
|
// --> OD 2004-07-01 #i28701# - use methods <GetPageFrm()> and <SetPageFrm>
|
2004-06-28 12:32:58 +00:00
|
|
|
if ( GetPageFrm() )
|
2004-08-02 13:02:08 +00:00
|
|
|
GetPageFrm()->RemoveDrawObjFromPage( maAnchoredDrawObj );
|
|
|
|
pPg->AppendDrawObjToPage( maAnchoredDrawObj );
|
|
|
|
SetPageFrm( pPg );
|
2003-07-04 12:19:51 +00:00
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* SwDrawContact::ChangeMasterObject()
|
|
|
|
|*
|
|
|
|
|* Ersterstellung MA 07. Aug. 95
|
|
|
|
|* Letzte Aenderung MA 20. Apr. 99
|
|
|
|
|*
|
|
|
|
|*************************************************************************/
|
2003-07-11 11:22:56 +00:00
|
|
|
// OD 10.07.2003 #110742# - Important note:
|
|
|
|
// method is called by method <SwDPage::ReplaceObject(..)>, which called its
|
|
|
|
// corresponding superclass method <FmFormPage::ReplaceObject(..)>.
|
2004-08-02 13:02:08 +00:00
|
|
|
// Note: 'master' drawing object *has* to be connected to layout triggered
|
|
|
|
// by the caller of this, if method is called.
|
2000-09-18 23:08:29 +00:00
|
|
|
void SwDrawContact::ChangeMasterObject( SdrObject *pNewMaster )
|
|
|
|
{
|
2003-07-11 11:22:56 +00:00
|
|
|
DisconnectFromLayout( false );
|
|
|
|
// OD 10.07.2003 #110742# - consider 'virtual' drawing objects
|
|
|
|
RemoveAllVirtObjs();
|
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
GetMaster()->SetUserCall( 0 );
|
|
|
|
SetMaster( pNewMaster );
|
|
|
|
GetMaster()->SetUserCall( this );
|
2002-09-16 07:47:13 +00:00
|
|
|
|
2004-06-28 12:32:58 +00:00
|
|
|
_InvalidateObjs();
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
2004-09-09 09:55:21 +00:00
|
|
|
/** get data collection of anchored objects, handled by with contact
|
|
|
|
|
|
|
|
OD 2004-08-23 #110810#
|
|
|
|
|
|
|
|
@author
|
|
|
|
*/
|
|
|
|
void SwDrawContact::GetAnchoredObjs( std::vector<SwAnchoredObject*>& _roAnchoredObjs ) const
|
|
|
|
{
|
|
|
|
_roAnchoredObjs.push_back( const_cast<SwAnchoredDrawObject*>(&maAnchoredDrawObj) );
|
|
|
|
|
|
|
|
for ( std::list<SwDrawVirtObj*>::const_iterator aDrawVirtObjsIter = maDrawVirtObjs.begin();
|
|
|
|
aDrawVirtObjsIter != maDrawVirtObjs.end();
|
|
|
|
++aDrawVirtObjsIter )
|
|
|
|
{
|
|
|
|
_roAnchoredObjs.push_back( (*aDrawVirtObjsIter)->AnchoredObj() );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-07-04 12:19:51 +00:00
|
|
|
// =============================================================================
|
|
|
|
/** implementation of class <SwDrawVirtObj>
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2003-07-04 12:19:51 +00:00
|
|
|
OD 14.05.2003 #108784#
|
|
|
|
|
|
|
|
@author OD
|
|
|
|
*/
|
|
|
|
|
|
|
|
TYPEINIT1(SwDrawVirtObj,SdrVirtObj);
|
|
|
|
|
|
|
|
// #108784#
|
|
|
|
// implemetation of SwDrawVirtObj
|
|
|
|
SwDrawVirtObj::SwDrawVirtObj( SdrObject& _rNewObj,
|
|
|
|
SwDrawContact& _rDrawContact )
|
|
|
|
: SdrVirtObj( _rNewObj ),
|
2004-06-28 12:32:58 +00:00
|
|
|
// OD 2004-03-29 #i26791# - init new member <maAnchoredDrawObj>
|
|
|
|
maAnchoredDrawObj(),
|
2003-07-04 12:19:51 +00:00
|
|
|
mrDrawContact( _rDrawContact )
|
2004-06-28 12:32:58 +00:00
|
|
|
{
|
|
|
|
// OD 2004-03-29 #i26791#
|
|
|
|
maAnchoredDrawObj.SetDrawObj( *this );
|
2004-12-23 09:04:43 +00:00
|
|
|
// --> OD 2004-11-17 #i35635# - set initial position out of sight
|
|
|
|
NbcMove( Size( -RECT_EMPTY, -RECT_EMPTY ) );
|
|
|
|
// <--
|
2004-06-28 12:32:58 +00:00
|
|
|
}
|
2003-07-04 12:19:51 +00:00
|
|
|
|
|
|
|
SwDrawVirtObj::~SwDrawVirtObj()
|
|
|
|
{}
|
|
|
|
|
|
|
|
const Point SwDrawVirtObj::GetOffset() const
|
|
|
|
{
|
2004-06-28 12:32:58 +00:00
|
|
|
return GetLastBoundRect().TopLeft() -
|
|
|
|
GetReferencedObj().GetLastBoundRect().TopLeft();
|
2003-07-04 12:19:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void SwDrawVirtObj::operator=( const SdrObject& rObj )
|
|
|
|
{
|
|
|
|
SdrVirtObj::operator=(rObj);
|
2004-08-02 13:02:08 +00:00
|
|
|
// Note: Members <maAnchoredDrawObj> and <mrDrawContact>
|
2004-06-28 12:32:58 +00:00
|
|
|
// haven't to be considered.
|
2003-07-04 12:19:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SdrObject* SwDrawVirtObj::Clone() const
|
|
|
|
{
|
|
|
|
SwDrawVirtObj* pObj = new SwDrawVirtObj( rRefObj, mrDrawContact );
|
|
|
|
|
|
|
|
if ( pObj )
|
|
|
|
{
|
|
|
|
pObj->operator=(static_cast<const SdrObject&>(*this));
|
2004-08-02 13:02:08 +00:00
|
|
|
// Note: Member <maAnchoredDrawObj> hasn't to be considered.
|
2003-07-04 12:19:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return pObj;
|
|
|
|
}
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------
|
2004-06-28 12:32:58 +00:00
|
|
|
// connection to writer layout: <GetAnchoredObj()>, <SetAnchorFrm(..)>,
|
|
|
|
// <GetAnchorFrm()>, <SetPageFrm(..)>, <GetPageFrm()> and <RemoveFromWriterLayout()>
|
2003-07-04 12:19:51 +00:00
|
|
|
// --------------------------------------------------------------------
|
2004-06-28 12:32:58 +00:00
|
|
|
const SwAnchoredObject* SwDrawVirtObj::GetAnchoredObj() const
|
|
|
|
{
|
|
|
|
return &maAnchoredDrawObj;
|
|
|
|
}
|
|
|
|
|
|
|
|
SwAnchoredObject* SwDrawVirtObj::AnchoredObj()
|
|
|
|
{
|
|
|
|
return &maAnchoredDrawObj;
|
|
|
|
}
|
|
|
|
|
2003-07-04 12:19:51 +00:00
|
|
|
void SwDrawVirtObj::SetAnchorFrm( SwFrm* _pNewAnchorFrm )
|
|
|
|
{
|
2004-06-28 12:32:58 +00:00
|
|
|
// OD 2004-03-29 #i26791# - use new member <maAnchoredDrawObj>
|
|
|
|
maAnchoredDrawObj.ChgAnchorFrm( _pNewAnchorFrm );
|
|
|
|
}
|
|
|
|
|
|
|
|
const SwFrm* SwDrawVirtObj::GetAnchorFrm() const
|
|
|
|
{
|
|
|
|
// OD 2004-03-29 #i26791# - use new member <maAnchoredDrawObj>
|
|
|
|
return maAnchoredDrawObj.GetAnchorFrm();
|
2003-07-04 12:19:51 +00:00
|
|
|
}
|
|
|
|
|
2004-06-28 12:32:58 +00:00
|
|
|
SwFrm* SwDrawVirtObj::AnchorFrm()
|
2003-07-04 12:19:51 +00:00
|
|
|
{
|
2004-06-28 12:32:58 +00:00
|
|
|
// OD 2004-03-29 #i26791# - use new member <maAnchoredDrawObj>
|
|
|
|
return maAnchoredDrawObj.AnchorFrm();
|
2003-07-04 12:19:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void SwDrawVirtObj::SetPageFrm( SwPageFrm* _pNewPageFrm )
|
|
|
|
{
|
2004-08-02 13:02:08 +00:00
|
|
|
// --> OD 2004-06-30 #i28701# - page frame is now stored at member <maAnchoredDrawObj>
|
|
|
|
maAnchoredDrawObj.SetPageFrm( _pNewPageFrm );
|
2003-07-04 12:19:51 +00:00
|
|
|
}
|
|
|
|
|
2004-06-28 12:32:58 +00:00
|
|
|
SwPageFrm* SwDrawVirtObj::GetPageFrm()
|
2003-07-04 12:19:51 +00:00
|
|
|
{
|
2004-08-02 13:02:08 +00:00
|
|
|
// --> OD 2004-06-30 #i28701# - page frame is now stored at member <maAnchoredDrawObj>
|
|
|
|
return maAnchoredDrawObj.GetPageFrm();
|
2003-07-04 12:19:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void SwDrawVirtObj::RemoveFromWriterLayout()
|
|
|
|
{
|
|
|
|
// remove contact object from frame for 'virtual' drawing object
|
2004-06-28 12:32:58 +00:00
|
|
|
// OD 2004-03-29 #i26791# - use new member <maAnchoredDrawObj>
|
|
|
|
if ( maAnchoredDrawObj.GetAnchorFrm() )
|
2003-07-04 12:19:51 +00:00
|
|
|
{
|
2004-08-02 13:02:08 +00:00
|
|
|
maAnchoredDrawObj.AnchorFrm()->RemoveDrawObj( maAnchoredDrawObj );
|
2003-07-04 12:19:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------
|
|
|
|
// connection to writer layout: <AddToDrawingPage()>, <RemoveFromDrawingPage()>
|
|
|
|
// --------------------------------------------------------------------
|
|
|
|
void SwDrawVirtObj::AddToDrawingPage()
|
|
|
|
{
|
|
|
|
// determine 'master'
|
|
|
|
SdrObject* pOrgMasterSdrObj = mrDrawContact.GetMaster();
|
|
|
|
|
|
|
|
// insert 'virtual' drawing object into page, set layer and user call.
|
2004-09-09 09:55:21 +00:00
|
|
|
SdrPage* pDrawPg;
|
|
|
|
// --> OD 2004-08-16 #i27030# - apply order number of referenced object
|
|
|
|
if ( 0 != ( pDrawPg = pOrgMasterSdrObj->GetPage() ) )
|
2003-07-04 12:19:51 +00:00
|
|
|
{
|
2004-09-09 09:55:21 +00:00
|
|
|
// --> OD 2004-08-16 #i27030# - apply order number of referenced object
|
|
|
|
pDrawPg->InsertObject( this, GetReferencedObj().GetOrdNum() );
|
2003-07-04 12:19:51 +00:00
|
|
|
}
|
2004-09-09 09:55:21 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
pDrawPg = GetPage();
|
|
|
|
if ( pDrawPg )
|
|
|
|
{
|
|
|
|
pDrawPg->SetObjectOrdNum( GetOrdNumDirect(),
|
|
|
|
GetReferencedObj().GetOrdNum() );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SetOrdNum( GetReferencedObj().GetOrdNum() );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// <--
|
2003-07-04 12:19:51 +00:00
|
|
|
SetUserCall( &mrDrawContact );
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwDrawVirtObj::RemoveFromDrawingPage()
|
|
|
|
{
|
|
|
|
SetUserCall( 0 );
|
|
|
|
if ( GetPage() )
|
|
|
|
{
|
|
|
|
GetPage()->RemoveObject( GetOrdNum() );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-09-09 09:55:21 +00:00
|
|
|
// is 'virtual' drawing object connected to writer layout and to drawing layer.
|
2003-07-04 12:19:51 +00:00
|
|
|
bool SwDrawVirtObj::IsConnected() const
|
|
|
|
{
|
|
|
|
bool bRetVal = GetAnchorFrm() &&
|
|
|
|
( GetPage() && GetUserCall() );
|
|
|
|
|
|
|
|
return bRetVal;
|
|
|
|
}
|
|
|
|
|
2004-08-02 13:02:08 +00:00
|
|
|
void SwDrawVirtObj::NbcSetAnchorPos(const Point& rPnt)
|
|
|
|
{
|
|
|
|
SdrObject::NbcSetAnchorPos( rPnt );
|
|
|
|
}
|
|
|
|
|
2004-06-28 12:32:58 +00:00
|
|
|
const Rectangle& SwDrawVirtObj::GetCurrentBoundRect() const
|
2003-07-04 12:19:51 +00:00
|
|
|
{
|
2004-06-28 12:32:58 +00:00
|
|
|
if (bBoundRectDirty)
|
2003-07-04 12:19:51 +00:00
|
|
|
{
|
2004-06-28 12:32:58 +00:00
|
|
|
const_cast<SwDrawVirtObj*>(this)->RecalcBoundRect();
|
|
|
|
const_cast<SwDrawVirtObj*>(this)->bBoundRectDirty = FALSE;
|
2003-07-04 12:19:51 +00:00
|
|
|
}
|
2003-11-24 15:01:52 +00:00
|
|
|
return aOutRect;
|
|
|
|
}
|
|
|
|
|
|
|
|
const Rectangle& SwDrawVirtObj::GetLastBoundRect() const
|
2003-07-04 12:19:51 +00:00
|
|
|
{
|
|
|
|
return aOutRect;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwDrawVirtObj::RecalcBoundRect()
|
|
|
|
{
|
2004-06-28 12:32:58 +00:00
|
|
|
// OD 2004-04-05 #i26791# - switch order of calling <GetOffset()> and
|
|
|
|
// <ReferencedObj().GetCurrentBoundRect()>, because <GetOffset()> calculates
|
|
|
|
// its value by the 'BoundRect' of the referenced object.
|
|
|
|
//aOutRect = rRefObj.GetCurrentBoundRect();
|
|
|
|
//aOutRect += GetOffset();
|
|
|
|
Point aOffset = GetOffset();
|
|
|
|
aOutRect = ReferencedObj().GetCurrentBoundRect() + aOffset;
|
2003-07-04 12:19:51 +00:00
|
|
|
}
|
|
|
|
|
2004-11-03 08:51:32 +00:00
|
|
|
sal_Bool SwDrawVirtObj::DoPaintObject( XOutputDevice& rOut,
|
2004-06-28 12:32:58 +00:00
|
|
|
const SdrPaintInfoRec& rInfoRec ) const
|
|
|
|
|
2003-07-04 12:19:51 +00:00
|
|
|
{
|
2004-06-28 12:32:58 +00:00
|
|
|
sal_Bool bRetval;
|
|
|
|
const SdrObject& rReferencedObject = GetReferencedObj();
|
2003-07-04 12:19:51 +00:00
|
|
|
|
2004-06-28 12:32:58 +00:00
|
|
|
// rescue offset and set new one
|
|
|
|
const Point aOfs(rOut.GetOffset());
|
|
|
|
const Point aLocalOffset(GetOffset());
|
|
|
|
rOut.SetOffset(aOfs + aLocalOffset);
|
|
|
|
if ( rReferencedObject.ISA(SdrObjGroup) )
|
2003-07-04 12:19:51 +00:00
|
|
|
{
|
2004-06-28 12:32:58 +00:00
|
|
|
|
|
|
|
// If it's a group object, paint the whole group content
|
|
|
|
// using a temporary ObjectContactOfObjListPainter
|
|
|
|
sdr::contact::SdrObjectVector aObjectVector;
|
|
|
|
aObjectVector.push_back(&((SdrObject&)rReferencedObject));
|
|
|
|
|
|
|
|
sdr::contact::ObjectContactOfObjListPainter aPainter(aObjectVector);
|
|
|
|
sdr::contact::DisplayInfo aDisplayInfo;
|
|
|
|
SdrPaintInfoRec aCopyInfoRec(rInfoRec);
|
|
|
|
aCopyInfoRec.aCheckRect.Move( -aLocalOffset.X(), -aLocalOffset.Y() );
|
|
|
|
aCopyInfoRec.aDirtyRect.Move( -aLocalOffset.X(), -aLocalOffset.Y() );
|
|
|
|
aDisplayInfo.SetExtendedOutputDevice(&rOut);
|
|
|
|
aDisplayInfo.SetPaintInfoRec(&aCopyInfoRec);
|
|
|
|
aDisplayInfo.SetOutputDevice(rOut.GetOutDev());
|
|
|
|
|
|
|
|
// keep draw hierarchy up-to-date
|
|
|
|
aPainter.PreProcessDisplay(aDisplayInfo);
|
|
|
|
|
|
|
|
// do processing
|
|
|
|
aPainter.ProcessDisplay(aDisplayInfo);
|
|
|
|
|
|
|
|
// prepare delete
|
|
|
|
aPainter.PrepareDelete();
|
2003-07-04 12:19:51 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-06-28 12:32:58 +00:00
|
|
|
// If it's a single object, paint it
|
|
|
|
bRetval = rRefObj.DoPaintObject(rOut, rInfoRec);
|
2003-07-04 12:19:51 +00:00
|
|
|
}
|
2004-06-28 12:32:58 +00:00
|
|
|
|
|
|
|
// restore offset
|
2003-07-04 12:19:51 +00:00
|
|
|
rOut.SetOffset(aOfs);
|
|
|
|
|
2004-06-28 12:32:58 +00:00
|
|
|
return bRetval;
|
2003-07-04 12:19:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SdrObject* SwDrawVirtObj::CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const
|
|
|
|
{
|
2004-06-28 12:32:58 +00:00
|
|
|
Point aPnt(rPnt - GetOffset());
|
2003-07-04 12:19:51 +00:00
|
|
|
FASTBOOL bRet = rRefObj.CheckHit(aPnt, nTol, pVisiLayer) != NULL;
|
|
|
|
|
|
|
|
return bRet ? (SdrObject*)this : NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwDrawVirtObj::TakeXorPoly(XPolyPolygon& rPoly, FASTBOOL bDetail) const
|
|
|
|
{
|
|
|
|
rRefObj.TakeXorPoly(rPoly, bDetail);
|
2004-06-28 12:32:58 +00:00
|
|
|
rPoly.Move(GetOffset().X(), GetOffset().Y());
|
2003-07-04 12:19:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void SwDrawVirtObj::TakeContour(XPolyPolygon& rPoly) const
|
|
|
|
{
|
|
|
|
rRefObj.TakeContour(rPoly);
|
2004-06-28 12:32:58 +00:00
|
|
|
rPoly.Move(GetOffset().X(), GetOffset().Y());
|
2003-07-04 12:19:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SdrHdl* SwDrawVirtObj::GetHdl(USHORT nHdlNum) const
|
|
|
|
{
|
|
|
|
SdrHdl* pHdl = rRefObj.GetHdl(nHdlNum);
|
2004-06-28 12:32:58 +00:00
|
|
|
Point aP(pHdl->GetPos() + GetOffset());
|
2003-07-04 12:19:51 +00:00
|
|
|
pHdl->SetPos(aP);
|
|
|
|
|
|
|
|
return pHdl;
|
|
|
|
}
|
|
|
|
|
|
|
|
SdrHdl* SwDrawVirtObj::GetPlusHdl(const SdrHdl& rHdl, USHORT nPlNum) const
|
|
|
|
{
|
|
|
|
SdrHdl* pHdl = rRefObj.GetPlusHdl(rHdl, nPlNum);
|
2004-06-28 12:32:58 +00:00
|
|
|
pHdl->SetPos(pHdl->GetPos() + GetOffset());
|
2003-07-04 12:19:51 +00:00
|
|
|
|
|
|
|
return pHdl;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwDrawVirtObj::NbcMove(const Size& rSiz)
|
|
|
|
{
|
2004-06-28 12:32:58 +00:00
|
|
|
SdrObject::NbcMove( rSiz );
|
2003-07-04 12:19:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void SwDrawVirtObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact)
|
|
|
|
{
|
2004-06-28 12:32:58 +00:00
|
|
|
rRefObj.NbcResize(rRef - GetOffset(), xFact, yFact);
|
2003-07-04 12:19:51 +00:00
|
|
|
SetRectsDirty();
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwDrawVirtObj::NbcRotate(const Point& rRef, long nWink, double sn, double cs)
|
|
|
|
{
|
2004-06-28 12:32:58 +00:00
|
|
|
rRefObj.NbcRotate(rRef - GetOffset(), nWink, sn, cs);
|
2003-07-04 12:19:51 +00:00
|
|
|
SetRectsDirty();
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwDrawVirtObj::NbcMirror(const Point& rRef1, const Point& rRef2)
|
|
|
|
{
|
2004-06-28 12:32:58 +00:00
|
|
|
rRefObj.NbcMirror(rRef1 - GetOffset(), rRef2 - GetOffset());
|
2003-07-04 12:19:51 +00:00
|
|
|
SetRectsDirty();
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwDrawVirtObj::NbcShear(const Point& rRef, long nWink, double tn, FASTBOOL bVShear)
|
|
|
|
{
|
2004-06-28 12:32:58 +00:00
|
|
|
rRefObj.NbcShear(rRef - GetOffset(), nWink, tn, bVShear);
|
2003-07-04 12:19:51 +00:00
|
|
|
SetRectsDirty();
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwDrawVirtObj::Move(const Size& rSiz)
|
|
|
|
{
|
2004-06-28 12:32:58 +00:00
|
|
|
SdrObject::Move( rSiz );
|
|
|
|
// Rectangle aBoundRect0; if(pUserCall) aBoundRect0 = GetLastBoundRect();
|
|
|
|
// rRefObj.Move( rSiz );
|
|
|
|
// SetRectsDirty();
|
|
|
|
// SendUserCall(SDRUSERCALL_RESIZE, aBoundRect0);
|
2003-07-04 12:19:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void SwDrawVirtObj::Resize(const Point& rRef, const Fraction& xFact, const Fraction& yFact)
|
|
|
|
{
|
|
|
|
if(xFact.GetNumerator() != xFact.GetDenominator() || yFact.GetNumerator() != yFact.GetDenominator())
|
|
|
|
{
|
2003-11-24 15:01:52 +00:00
|
|
|
Rectangle aBoundRect0; if(pUserCall) aBoundRect0 = GetLastBoundRect();
|
2004-06-28 12:32:58 +00:00
|
|
|
rRefObj.Resize(rRef - GetOffset(), xFact, yFact);
|
2003-07-04 12:19:51 +00:00
|
|
|
SetRectsDirty();
|
|
|
|
SendUserCall(SDRUSERCALL_RESIZE, aBoundRect0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwDrawVirtObj::Rotate(const Point& rRef, long nWink, double sn, double cs)
|
|
|
|
{
|
|
|
|
if(nWink)
|
|
|
|
{
|
2003-11-24 15:01:52 +00:00
|
|
|
Rectangle aBoundRect0; if(pUserCall) aBoundRect0 = GetLastBoundRect();
|
2004-06-28 12:32:58 +00:00
|
|
|
rRefObj.Rotate(rRef - GetOffset(), nWink, sn, cs);
|
2003-07-04 12:19:51 +00:00
|
|
|
SetRectsDirty();
|
|
|
|
SendUserCall(SDRUSERCALL_RESIZE, aBoundRect0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwDrawVirtObj::Mirror(const Point& rRef1, const Point& rRef2)
|
|
|
|
{
|
2003-11-24 15:01:52 +00:00
|
|
|
Rectangle aBoundRect0; if(pUserCall) aBoundRect0 = GetLastBoundRect();
|
2004-06-28 12:32:58 +00:00
|
|
|
rRefObj.Mirror(rRef1 - GetOffset(), rRef2 - GetOffset());
|
2003-07-04 12:19:51 +00:00
|
|
|
SetRectsDirty();
|
|
|
|
SendUserCall(SDRUSERCALL_RESIZE, aBoundRect0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwDrawVirtObj::Shear(const Point& rRef, long nWink, double tn, FASTBOOL bVShear)
|
|
|
|
{
|
|
|
|
if(nWink)
|
|
|
|
{
|
2003-11-24 15:01:52 +00:00
|
|
|
Rectangle aBoundRect0; if(pUserCall) aBoundRect0 = GetLastBoundRect();
|
2004-06-28 12:32:58 +00:00
|
|
|
rRefObj.Shear(rRef - GetOffset(), nWink, tn, bVShear);
|
2003-07-04 12:19:51 +00:00
|
|
|
SetRectsDirty();
|
|
|
|
SendUserCall(SDRUSERCALL_RESIZE, aBoundRect0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwDrawVirtObj::RecalcSnapRect()
|
|
|
|
{
|
|
|
|
aSnapRect = rRefObj.GetSnapRect();
|
2004-06-28 12:32:58 +00:00
|
|
|
aSnapRect += GetOffset();
|
2003-07-04 12:19:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const Rectangle& SwDrawVirtObj::GetSnapRect() const
|
|
|
|
{
|
|
|
|
((SwDrawVirtObj*)this)->aSnapRect = rRefObj.GetSnapRect();
|
2004-06-28 12:32:58 +00:00
|
|
|
((SwDrawVirtObj*)this)->aSnapRect += GetOffset();
|
2003-07-04 12:19:51 +00:00
|
|
|
|
|
|
|
return aSnapRect;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwDrawVirtObj::SetSnapRect(const Rectangle& rRect)
|
|
|
|
{
|
2003-11-24 15:01:52 +00:00
|
|
|
Rectangle aBoundRect0; if(pUserCall) aBoundRect0 = GetLastBoundRect();
|
2003-07-04 12:19:51 +00:00
|
|
|
Rectangle aR(rRect);
|
2004-06-28 12:32:58 +00:00
|
|
|
aR -= GetOffset();
|
2003-07-04 12:19:51 +00:00
|
|
|
rRefObj.SetSnapRect(aR);
|
|
|
|
SetRectsDirty();
|
|
|
|
SendUserCall(SDRUSERCALL_RESIZE, aBoundRect0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwDrawVirtObj::NbcSetSnapRect(const Rectangle& rRect)
|
|
|
|
{
|
|
|
|
Rectangle aR(rRect);
|
2004-06-28 12:32:58 +00:00
|
|
|
aR -= GetOffset();
|
2003-07-04 12:19:51 +00:00
|
|
|
SetRectsDirty();
|
|
|
|
rRefObj.NbcSetSnapRect(aR);
|
|
|
|
}
|
|
|
|
|
|
|
|
const Rectangle& SwDrawVirtObj::GetLogicRect() const
|
|
|
|
{
|
|
|
|
((SwDrawVirtObj*)this)->aSnapRect = rRefObj.GetLogicRect();
|
2004-06-28 12:32:58 +00:00
|
|
|
((SwDrawVirtObj*)this)->aSnapRect += GetOffset();
|
2003-07-04 12:19:51 +00:00
|
|
|
|
|
|
|
return aSnapRect;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwDrawVirtObj::SetLogicRect(const Rectangle& rRect)
|
|
|
|
{
|
2003-11-24 15:01:52 +00:00
|
|
|
Rectangle aBoundRect0; if(pUserCall) aBoundRect0 = GetLastBoundRect();
|
2003-07-04 12:19:51 +00:00
|
|
|
Rectangle aR(rRect);
|
2004-06-28 12:32:58 +00:00
|
|
|
aR -= GetOffset();
|
2003-07-04 12:19:51 +00:00
|
|
|
rRefObj.SetLogicRect(aR);
|
|
|
|
SetRectsDirty();
|
|
|
|
SendUserCall(SDRUSERCALL_RESIZE, aBoundRect0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwDrawVirtObj::NbcSetLogicRect(const Rectangle& rRect)
|
|
|
|
{
|
|
|
|
Rectangle aR(rRect);
|
2004-06-28 12:32:58 +00:00
|
|
|
aR -= GetOffset();
|
2003-07-04 12:19:51 +00:00
|
|
|
rRefObj.NbcSetLogicRect(aR);
|
|
|
|
SetRectsDirty();
|
|
|
|
}
|
|
|
|
|
|
|
|
Point SwDrawVirtObj::GetSnapPoint(USHORT i) const
|
|
|
|
{
|
|
|
|
Point aP(rRefObj.GetSnapPoint(i));
|
2004-06-28 12:32:58 +00:00
|
|
|
aP += GetOffset();
|
2003-07-04 12:19:51 +00:00
|
|
|
|
|
|
|
return aP;
|
|
|
|
}
|
|
|
|
|
|
|
|
const Point& SwDrawVirtObj::GetPoint(USHORT i) const
|
|
|
|
{
|
|
|
|
((SwDrawVirtObj*)this)->aHack = rRefObj.GetPoint(i);
|
2004-06-28 12:32:58 +00:00
|
|
|
((SwDrawVirtObj*)this)->aHack += GetOffset();
|
2003-07-04 12:19:51 +00:00
|
|
|
|
|
|
|
return aHack;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwDrawVirtObj::NbcSetPoint(const Point& rPnt, USHORT i)
|
|
|
|
{
|
|
|
|
Point aP(rPnt);
|
2004-06-28 12:32:58 +00:00
|
|
|
aP -= GetOffset();
|
2003-07-04 12:19:51 +00:00
|
|
|
rRefObj.SetPoint(aP, i);
|
|
|
|
SetRectsDirty();
|
|
|
|
}
|
|
|
|
|
|
|
|
// #108784#
|
|
|
|
FASTBOOL SwDrawVirtObj::HasTextEdit() const
|
|
|
|
{
|
|
|
|
return rRefObj.HasTextEdit();
|
|
|
|
}
|
|
|
|
|
|
|
|
// OD 18.06.2003 #108784# - overloaded 'layer' methods for 'virtual' drawing
|
|
|
|
// object to assure, that layer of 'virtual' object is the layer of the referenced
|
|
|
|
// object.
|
|
|
|
SdrLayerID SwDrawVirtObj::GetLayer() const
|
|
|
|
{
|
|
|
|
return GetReferencedObj().GetLayer();
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwDrawVirtObj::NbcSetLayer(SdrLayerID nLayer)
|
|
|
|
{
|
|
|
|
ReferencedObj().NbcSetLayer( nLayer );
|
|
|
|
SdrVirtObj::NbcSetLayer( ReferencedObj().GetLayer() );
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwDrawVirtObj::SetLayer(SdrLayerID nLayer)
|
|
|
|
{
|
|
|
|
ReferencedObj().SetLayer( nLayer );
|
|
|
|
SdrVirtObj::NbcSetLayer( ReferencedObj().GetLayer() );
|
|
|
|
}
|
|
|
|
// eof
|