2000-09-18 23:08:29 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
|
|
|
* $RCSfile: dview.cxx,v $
|
|
|
|
*
|
2004-09-09 09:55:35 +00:00
|
|
|
* $Revision: 1.18 $
|
2000-09-18 23:08:29 +00:00
|
|
|
*
|
2004-09-09 09:55:35 +00:00
|
|
|
* last change: $Author: obo $ $Date: 2004-09-09 10:55:35 $
|
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 _SVDPAGV_HXX //autogen
|
|
|
|
#include <svx/svdpagv.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _FM_FMMODEL_HXX
|
|
|
|
#include <svx/fmmodel.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _IPOBJ_HXX //autogen
|
|
|
|
#include <so3/ipobj.hxx>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#include "swtypes.hxx"
|
|
|
|
#include "pagefrm.hxx"
|
|
|
|
#include "rootfrm.hxx"
|
|
|
|
#include "cntfrm.hxx"
|
|
|
|
#include "flyfrm.hxx"
|
|
|
|
#include "frmfmt.hxx"
|
|
|
|
#include "dflyobj.hxx"
|
|
|
|
#include "dcontact.hxx"
|
|
|
|
#include "frmatr.hxx"
|
|
|
|
#include "viewsh.hxx"
|
|
|
|
#include "viewimp.hxx"
|
|
|
|
#include "dview.hxx"
|
|
|
|
#include "dpage.hxx"
|
|
|
|
#include "doc.hxx"
|
|
|
|
#include "mdiexp.hxx"
|
|
|
|
|
|
|
|
#ifndef _NDOLE_HXX //autogen
|
|
|
|
#include <ndole.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _FMTANCHR_HXX //autogen
|
|
|
|
#include <fmtanchr.hxx>
|
|
|
|
#endif
|
|
|
|
#include "shellres.hxx"
|
|
|
|
|
2003-04-24 13:54:11 +00:00
|
|
|
// #i7672#
|
|
|
|
#ifndef _OUTLINER_HXX //autogen
|
|
|
|
#include <svx/outliner.hxx>
|
|
|
|
#endif
|
|
|
|
|
2003-07-04 12:20:03 +00:00
|
|
|
// OD 18.06.2003 #108784#
|
|
|
|
#ifndef _SVDVMARK_HXX //autogen
|
|
|
|
#include <svx/svdvmark.hxx>
|
|
|
|
#endif
|
|
|
|
#include <vector>
|
2004-08-02 13:02:28 +00:00
|
|
|
// --> OD 2004-06-24 #i28701#
|
|
|
|
#ifndef _SORTEDOBJS_HXX
|
|
|
|
#include <sortedobjs.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _FLYFRMS_HXX
|
|
|
|
#include <flyfrms.hxx>
|
|
|
|
#endif
|
|
|
|
// <--
|
2003-04-24 13:54:11 +00:00
|
|
|
|
2002-05-28 13:05:17 +00:00
|
|
|
class SwSdrHdl : public SdrHdl
|
|
|
|
{
|
|
|
|
public:
|
2002-09-16 07:47:13 +00:00
|
|
|
SwSdrHdl(const Point& rPnt, bool bTopRight ) :
|
|
|
|
SdrHdl( rPnt, bTopRight ? HDL_ANCHOR_TR : HDL_ANCHOR ) {}
|
2002-05-28 13:05:17 +00:00
|
|
|
virtual BOOL IsFocusHdl() const;
|
|
|
|
};
|
|
|
|
|
|
|
|
BOOL SwSdrHdl::IsFocusHdl() const
|
|
|
|
{
|
2002-09-16 07:47:13 +00:00
|
|
|
if( HDL_ANCHOR == eKind || HDL_ANCHOR_TR == eKind )
|
2002-05-28 13:05:17 +00:00
|
|
|
return TRUE;
|
|
|
|
return SdrHdl::IsFocusHdl();
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
const SwFrm *lcl_FindAnchor( const SdrObject *pObj, FASTBOOL bAll )
|
|
|
|
{
|
2003-11-24 15:02:28 +00:00
|
|
|
const SwVirtFlyDrawObj *pVirt = pObj->ISA(SwVirtFlyDrawObj) ?
|
2000-09-18 23:08:29 +00:00
|
|
|
(SwVirtFlyDrawObj*)pObj : 0;
|
|
|
|
if ( pVirt )
|
|
|
|
{
|
|
|
|
if ( bAll || !pVirt->GetFlyFrm()->IsFlyInCntFrm() )
|
2004-06-28 12:33:32 +00:00
|
|
|
return pVirt->GetFlyFrm()->GetAnchorFrm();
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
const SwDrawContact *pCont = (const SwDrawContact*)GetUserCall(pObj);
|
|
|
|
if ( pCont )
|
2004-06-28 12:33:32 +00:00
|
|
|
return pCont->GetAnchorFrm( pObj );
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* SwDrawView::Ctor
|
|
|
|
|*
|
|
|
|
|* Ersterstellung OK 18.11.94
|
|
|
|
|* Letzte Aenderung MA 22. Jul. 96
|
|
|
|
|*
|
|
|
|
*************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SwDrawView::SwDrawView( SwViewImp &rI, SdrModel *pMd, OutputDevice *pOutDev) :
|
|
|
|
FmFormView( (FmFormModel*)pMd, pOutDev ),
|
|
|
|
rImp( rI )
|
|
|
|
{
|
|
|
|
SetPageVisible( FALSE );
|
|
|
|
SetBordVisible( FALSE );
|
|
|
|
SetGridVisible( FALSE );
|
|
|
|
SetHlplVisible( FALSE );
|
|
|
|
SetGlueVisible( FALSE );
|
|
|
|
SetFrameDragSingles( TRUE );
|
|
|
|
SetVirtualObjectBundling( TRUE );
|
|
|
|
SetSwapAsynchron( TRUE );
|
|
|
|
|
|
|
|
EnableExtendedKeyInputDispatcher( FALSE );
|
|
|
|
EnableExtendedMouseEventDispatcher( FALSE );
|
|
|
|
EnableExtendedCommandEventDispatcher( FALSE );
|
|
|
|
|
|
|
|
SetHitTolerancePixel( GetMarkHdlSizePixel()/2 );
|
|
|
|
|
|
|
|
SetPrintPreview( rI.GetShell()->IsPreView() );
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* SwDrawView::AddCustomHdl()
|
|
|
|
|*
|
|
|
|
|* Gets called every time the handles need to be build
|
|
|
|
|*
|
|
|
|
|* Ersterstellung AW 06. Sep. 99
|
|
|
|
|* Letzte Aenderung AW 06. Sep. 99
|
|
|
|
|*
|
|
|
|
*************************************************************************/
|
|
|
|
|
|
|
|
void SwDrawView::AddCustomHdl()
|
|
|
|
{
|
2004-07-12 14:47:09 +00:00
|
|
|
const SdrMarkList &rMrkList = GetMarkedObjectList();
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
if(rMrkList.GetMarkCount() != 1 || !GetUserCall(rMrkList.GetMark( 0 )->GetObj()))
|
|
|
|
return;
|
|
|
|
|
|
|
|
SdrObject *pObj = rMrkList.GetMark(0)->GetObj();
|
|
|
|
const SwFmtAnchor &rAnchor = ::FindFrmFmt(pObj)->GetAnchor();
|
|
|
|
|
|
|
|
if(FLY_IN_CNTNT == rAnchor.GetAnchorId())
|
|
|
|
return;
|
|
|
|
|
|
|
|
const SwFrm* pAnch;
|
|
|
|
if(0 == (pAnch = CalcAnchor()))
|
|
|
|
return;
|
|
|
|
|
|
|
|
ViewShell &rSh = *Imp().GetShell();
|
|
|
|
Point aPos(aAnchorPoint);
|
|
|
|
|
2004-08-02 13:02:28 +00:00
|
|
|
if ( FLY_AUTO_CNTNT == rAnchor.GetAnchorId() )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2004-08-02 13:02:28 +00:00
|
|
|
// --> OD 2004-06-24 #i28701# - use last character rectangle saved at object
|
|
|
|
// in order to avoid a format of the anchor frame
|
|
|
|
SwAnchoredObject* pAnchoredObj = ::GetUserCall( pObj )->GetAnchoredObj( pObj );
|
|
|
|
SwRect aAutoPos = pAnchoredObj->GetLastCharRect();
|
|
|
|
if ( aAutoPos.Height() )
|
|
|
|
{
|
|
|
|
aPos = aAutoPos.Pos();
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// add anchor handle:
|
2002-09-16 07:47:13 +00:00
|
|
|
aHdl.AddHdl( new SwSdrHdl( aPos, pAnch->IsVertical() ||
|
|
|
|
pAnch->IsRightToLeft() ) );
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* SwDrawView::GetMaxToTopObj(), _GetMaxToTopObj()
|
|
|
|
|*
|
|
|
|
|* Ersterstellung MA 13. Jan. 95
|
|
|
|
|* Letzte Aenderung MA 18. Mar. 97
|
|
|
|
|*
|
|
|
|
*************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
SdrObject* SwDrawView::GetMaxToTopObj( SdrObject* pObj ) const
|
|
|
|
{
|
|
|
|
if ( GetUserCall(pObj) )
|
|
|
|
{
|
|
|
|
const SwFrm *pAnch = ::lcl_FindAnchor( pObj, FALSE );
|
|
|
|
if ( pAnch )
|
|
|
|
{
|
|
|
|
//Das oberste Obj innerhalb des Ankers darf nicht ueberholt
|
|
|
|
//werden.
|
|
|
|
const SwFlyFrm *pFly = pAnch->FindFlyFrm();
|
|
|
|
if ( pFly )
|
|
|
|
{
|
|
|
|
const SwPageFrm *pPage = pFly->FindPageFrm();
|
|
|
|
if ( pPage->GetSortedObjs() )
|
|
|
|
{
|
|
|
|
UINT32 nOrdNum = 0;
|
|
|
|
for ( USHORT i = 0; i < pPage->GetSortedObjs()->Count(); ++i )
|
|
|
|
{
|
2004-08-02 13:02:28 +00:00
|
|
|
const SdrObject *pO =
|
|
|
|
(*pPage->GetSortedObjs())[i]->GetDrawObj();
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
if ( pO->GetOrdNumDirect() > nOrdNum )
|
|
|
|
{
|
|
|
|
const SwFrm *pAnch = ::lcl_FindAnchor( pO, FALSE );
|
|
|
|
if ( pFly->IsAnLower( pAnch ) )
|
|
|
|
{
|
|
|
|
nOrdNum = pO->GetOrdNumDirect();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ( nOrdNum )
|
|
|
|
{
|
|
|
|
SdrPage *pPage = GetModel()->GetPage( 0 );
|
|
|
|
++nOrdNum;
|
|
|
|
if ( nOrdNum < pPage->GetObjCount() )
|
|
|
|
{
|
|
|
|
return pPage->GetObj( nOrdNum );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* SwDrawView::GetMaxToBtmObj()
|
|
|
|
|*
|
|
|
|
|* Ersterstellung MA 13. Jan. 95
|
|
|
|
|* Letzte Aenderung MA 05. Sep. 96
|
|
|
|
|*
|
|
|
|
*************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
SdrObject* SwDrawView::GetMaxToBtmObj(SdrObject* pObj) const
|
|
|
|
{
|
|
|
|
if ( GetUserCall(pObj) )
|
|
|
|
{
|
|
|
|
const SwFrm *pAnch = ::lcl_FindAnchor( pObj, FALSE );
|
|
|
|
if ( pAnch )
|
|
|
|
{
|
|
|
|
//Der Fly des Ankers darf nicht "unterflogen" werden.
|
|
|
|
const SwFlyFrm *pFly = pAnch->FindFlyFrm();
|
|
|
|
if ( pFly )
|
|
|
|
{
|
|
|
|
SdrObject *pRet = (SdrObject*)pFly->GetVirtDrawObj();
|
|
|
|
return pRet != pObj ? pRet : 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* SwDrawView::ObjOrderChanged()
|
|
|
|
|*
|
|
|
|
|* Ersterstellung MA 31. Jul. 95
|
|
|
|
|* Letzte Aenderung MA 18. Mar. 97
|
|
|
|
|*
|
|
|
|
*************************************************************************/
|
|
|
|
|
|
|
|
inline BOOL lcl_IsChild( SdrObject *pParent, SdrObject *pChild )
|
|
|
|
{
|
2003-11-24 15:02:28 +00:00
|
|
|
if ( pParent->ISA(SwVirtFlyDrawObj) )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
const SwFrm *pAnch = lcl_FindAnchor( pChild, FALSE );
|
|
|
|
if ( pAnch && ((SwVirtFlyDrawObj*)pParent)->GetFlyFrm()->IsAnLower( pAnch ))
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline SdrObject *lcl_FindParent( SdrObject *pObj )
|
|
|
|
{
|
|
|
|
const SwFrm *pAnch = lcl_FindAnchor( pObj, FALSE );
|
|
|
|
if ( pAnch && pAnch->IsInFly() )
|
|
|
|
return (SdrObject*)pAnch->FindFlyFrm()->GetVirtDrawObj();
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2004-09-09 09:55:35 +00:00
|
|
|
/** determine maximal order number for a 'child' object of given 'parent' object
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2004-09-09 09:55:35 +00:00
|
|
|
OD 2004-08-20 #110810#
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2004-09-09 09:55:35 +00:00
|
|
|
@author OD
|
|
|
|
*/
|
|
|
|
sal_uInt32 SwDrawView::_GetMaxChildOrdNum( const SwFlyFrm& _rParentObj,
|
|
|
|
const SdrObject* _pExclChildObj ) const
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2004-09-09 09:55:35 +00:00
|
|
|
sal_uInt32 nMaxChildOrdNum = _rParentObj.GetDrawObj()->GetOrdNum();
|
|
|
|
|
|
|
|
const SdrPage* pDrawPage = _rParentObj.GetDrawObj()->GetPage();
|
|
|
|
ASSERT( pDrawPage,
|
|
|
|
"<SwDrawView::_GetMaxChildOrdNum(..) - missing drawing page at parent object - crash!" );
|
|
|
|
|
|
|
|
sal_uInt32 nObjCount = pDrawPage->GetObjCount();
|
|
|
|
for ( sal_uInt32 i = nObjCount-1; i > _rParentObj.GetDrawObj()->GetOrdNum() ; --i )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2004-09-09 09:55:35 +00:00
|
|
|
const SdrObject* pObj = pDrawPage->GetObj( i );
|
|
|
|
|
|
|
|
// Don't consider 'child' object <_pExclChildObj>
|
|
|
|
if ( pObj == _pExclChildObj )
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( pObj->GetOrdNum() > nMaxChildOrdNum &&
|
|
|
|
_rParentObj.IsAnLower( lcl_FindAnchor( pObj, TRUE ) ) )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2004-09-09 09:55:35 +00:00
|
|
|
nMaxChildOrdNum = pObj->GetOrdNum();
|
|
|
|
break;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
}
|
2004-09-09 09:55:35 +00:00
|
|
|
|
|
|
|
return nMaxChildOrdNum;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** method to move 'repeated' objects of the given moved object to the
|
|
|
|
according level
|
|
|
|
|
|
|
|
OD 2004-08-23 #110810#
|
|
|
|
|
|
|
|
@author OD
|
|
|
|
*/
|
|
|
|
void SwDrawView::_MoveRepeatedObjs( const SwAnchoredObject& _rMovedAnchoredObj,
|
|
|
|
const std::vector<SdrObject*>& _rMovedChildObjs ) const
|
|
|
|
{
|
|
|
|
// determine 'repeated' objects of already moved object <_rMovedAnchoredObj>
|
|
|
|
std::vector<SwAnchoredObject*> aAnchoredObjs;
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2004-09-09 09:55:35 +00:00
|
|
|
const SwContact* pContact = ::GetUserCall( _rMovedAnchoredObj.GetDrawObj() );
|
|
|
|
ASSERT( pContact,
|
|
|
|
"SwDrawView::_MoveRepeatedObjs(..) - missing contact object -> crash." );
|
|
|
|
pContact->GetAnchoredObjs( aAnchoredObjs );
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
2004-09-09 09:55:35 +00:00
|
|
|
// check, if 'repeated' objects exists.
|
|
|
|
if ( aAnchoredObjs.size() > 1 )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2004-09-09 09:55:35 +00:00
|
|
|
SdrPage* pDrawPage = GetModel()->GetPage( 0 );
|
|
|
|
|
|
|
|
// move 'repeated' ones to the same order number as the already moved one.
|
|
|
|
sal_uInt32 nNewPos = _rMovedAnchoredObj.GetDrawObj()->GetOrdNum();
|
|
|
|
while ( !aAnchoredObjs.empty() )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2004-09-09 09:55:35 +00:00
|
|
|
SwAnchoredObject* pAnchoredObj = aAnchoredObjs.back();
|
|
|
|
if ( pAnchoredObj != &_rMovedAnchoredObj )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2004-09-09 09:55:35 +00:00
|
|
|
pDrawPage->SetObjectOrdNum( pAnchoredObj->GetDrawObj()->GetOrdNum(),
|
|
|
|
nNewPos );
|
|
|
|
pDrawPage->RecalcObjOrdNums();
|
|
|
|
// adjustments for accessibility API
|
|
|
|
if ( pAnchoredObj->ISA(SwFlyFrm) )
|
|
|
|
{
|
|
|
|
const SwFlyFrm *pTmpFlyFrm = static_cast<SwFlyFrm*>(pAnchoredObj);
|
|
|
|
rImp.DisposeAccessibleFrm( pTmpFlyFrm );
|
|
|
|
rImp.AddAccessibleFrm( pTmpFlyFrm );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
rImp.DisposeAccessibleObj( pAnchoredObj->GetDrawObj() );
|
|
|
|
rImp.AddAccessibleObj( pAnchoredObj->GetDrawObj() );
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
2004-09-09 09:55:35 +00:00
|
|
|
aAnchoredObjs.pop_back();
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
2004-09-09 09:55:35 +00:00
|
|
|
|
|
|
|
// move 'repeated' ones of 'child' objects
|
|
|
|
for ( std::vector<SdrObject*>::const_iterator aObjIter = _rMovedChildObjs.begin();
|
|
|
|
aObjIter != _rMovedChildObjs.end(); ++aObjIter )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2004-09-09 09:55:35 +00:00
|
|
|
SdrObject* pChildObj = (*aObjIter);
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2004-09-09 09:55:35 +00:00
|
|
|
const SwContact* pContact = ::GetUserCall( pChildObj );
|
|
|
|
ASSERT( pContact,
|
|
|
|
"SwDrawView::_MoveRepeatedObjs(..) - missing contact object -> crash." );
|
|
|
|
pContact->GetAnchoredObjs( aAnchoredObjs );
|
|
|
|
}
|
|
|
|
// move 'repeated' ones to the same order number as the already moved one.
|
|
|
|
sal_uInt32 nNewPos = pChildObj->GetOrdNum();
|
|
|
|
while ( !aAnchoredObjs.empty() )
|
|
|
|
{
|
|
|
|
SwAnchoredObject* pAnchoredObj = aAnchoredObjs.back();
|
|
|
|
if ( pAnchoredObj->GetDrawObj() != pChildObj )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2004-09-09 09:55:35 +00:00
|
|
|
pDrawPage->SetObjectOrdNum( pAnchoredObj->GetDrawObj()->GetOrdNum(),
|
|
|
|
nNewPos );
|
|
|
|
pDrawPage->RecalcObjOrdNums();
|
|
|
|
// adjustments for accessibility API
|
|
|
|
if ( pAnchoredObj->ISA(SwFlyFrm) )
|
|
|
|
{
|
|
|
|
const SwFlyFrm *pTmpFlyFrm = static_cast<SwFlyFrm*>(pAnchoredObj);
|
|
|
|
rImp.DisposeAccessibleFrm( pTmpFlyFrm );
|
|
|
|
rImp.AddAccessibleFrm( pTmpFlyFrm );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
rImp.DisposeAccessibleObj( pAnchoredObj->GetDrawObj() );
|
|
|
|
rImp.AddAccessibleObj( pAnchoredObj->GetDrawObj() );
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
2004-09-09 09:55:35 +00:00
|
|
|
aAnchoredObjs.pop_back();
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2004-09-09 09:55:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// --> OD 2004-08-20 #110810# - adjustment and re-factoring of method
|
|
|
|
void SwDrawView::ObjOrderChanged( SdrObject* pObj, ULONG nOldPos,
|
|
|
|
ULONG nNewPos )
|
|
|
|
{
|
|
|
|
// --> OD 2004-08-17 #110810# - nothing to do for group members
|
|
|
|
if ( pObj->GetUpGroup() )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2004-09-09 09:55:35 +00:00
|
|
|
return;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
2004-09-09 09:55:35 +00:00
|
|
|
// <--
|
|
|
|
|
|
|
|
// determine drawing page and assure that the order numbers are correct.
|
|
|
|
SdrPage* pDrawPage = GetModel()->GetPage( 0 );
|
|
|
|
if ( pDrawPage->IsObjOrdNumsDirty() )
|
|
|
|
pDrawPage->RecalcObjOrdNums();
|
|
|
|
const sal_uInt32 nObjCount = pDrawPage->GetObjCount();
|
|
|
|
|
|
|
|
SwAnchoredObject* pMovedAnchoredObj =
|
|
|
|
::GetUserCall( pObj )->GetAnchoredObj( pObj );
|
|
|
|
const SwFlyFrm* pParentAnchoredObj =
|
|
|
|
pMovedAnchoredObj->GetAnchorFrm()->FindFlyFrm();
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2004-09-09 09:55:35 +00:00
|
|
|
const bool bMovedForward = nOldPos < nNewPos;
|
|
|
|
|
|
|
|
// assure for a 'child' object, that it doesn't exceed the limits of its 'parent'
|
|
|
|
if ( pParentAnchoredObj )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2004-09-09 09:55:35 +00:00
|
|
|
if ( bMovedForward )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2004-09-09 09:55:35 +00:00
|
|
|
sal_uInt32 nMaxChildOrdNumWithoutMoved =
|
|
|
|
_GetMaxChildOrdNum( *pParentAnchoredObj, pMovedAnchoredObj->GetDrawObj() );
|
|
|
|
if ( nNewPos > nMaxChildOrdNumWithoutMoved+1 )
|
|
|
|
{
|
|
|
|
// set position to the top of the 'child' object group
|
|
|
|
pDrawPage->SetObjectOrdNum( nNewPos, nMaxChildOrdNumWithoutMoved+1 );
|
|
|
|
nNewPos = nMaxChildOrdNumWithoutMoved+1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
const sal_uInt32 nParentOrdNum = pParentAnchoredObj->GetDrawObj()->GetOrdNum();
|
|
|
|
if ( nNewPos < nParentOrdNum )
|
|
|
|
{
|
|
|
|
// set position to the bottom of the 'child' object group
|
|
|
|
pDrawPage->SetObjectOrdNum( nNewPos, nParentOrdNum );
|
|
|
|
nNewPos = nParentOrdNum;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ( pDrawPage->IsObjOrdNumsDirty() )
|
|
|
|
pDrawPage->RecalcObjOrdNums();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Assure, that object isn't positioned between 'repeated' ones
|
|
|
|
if ( ( bMovedForward && nNewPos < nObjCount - 1 ) ||
|
|
|
|
( !bMovedForward && nNewPos > 0 ) )
|
|
|
|
{
|
|
|
|
const SdrObject* pTmpObj =
|
|
|
|
pDrawPage->GetObj( bMovedForward ? nNewPos - 1 : nNewPos + 1 );
|
|
|
|
if ( pTmpObj )
|
|
|
|
{
|
|
|
|
sal_uInt32 nTmpNewPos( nNewPos );
|
|
|
|
if ( bMovedForward )
|
2004-06-28 12:33:32 +00:00
|
|
|
{
|
2004-09-09 09:55:35 +00:00
|
|
|
// move before the top 'repeated' object
|
|
|
|
const sal_uInt32 nTmpMaxOrdNum =
|
|
|
|
::GetUserCall( pTmpObj )->GetMaxOrdNum();
|
|
|
|
if ( nTmpMaxOrdNum > nNewPos )
|
|
|
|
nTmpNewPos = nTmpMaxOrdNum;
|
2004-06-28 12:33:32 +00:00
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
else
|
2004-06-28 12:33:32 +00:00
|
|
|
{
|
2004-09-09 09:55:35 +00:00
|
|
|
// move behind the bottom 'repeated' object
|
|
|
|
const sal_uInt32 nTmpMinOrdNum =
|
|
|
|
::GetUserCall( pTmpObj )->GetMinOrdNum();
|
|
|
|
if ( nTmpMinOrdNum < nNewPos )
|
|
|
|
nTmpNewPos = nTmpMinOrdNum;
|
|
|
|
}
|
|
|
|
if ( nTmpNewPos != nNewPos )
|
|
|
|
{
|
|
|
|
pDrawPage->SetObjectOrdNum( nNewPos, nTmpNewPos );
|
|
|
|
nNewPos = nTmpNewPos;
|
|
|
|
pDrawPage->RecalcObjOrdNums();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// On move forward, assure that object is moved before its own childs.
|
|
|
|
// Only Writer fly frames can have childs.
|
|
|
|
if ( pMovedAnchoredObj->ISA(SwFlyFrm) &&
|
|
|
|
bMovedForward && nNewPos < nObjCount - 1 )
|
|
|
|
{
|
|
|
|
sal_uInt32 nMaxChildOrdNum =
|
|
|
|
_GetMaxChildOrdNum( *(static_cast<const SwFlyFrm*>(pMovedAnchoredObj)) );
|
|
|
|
if ( nNewPos < nMaxChildOrdNum )
|
|
|
|
{
|
|
|
|
// determine position before the object before its top 'child' object
|
|
|
|
const SdrObject* pTmpObj = pDrawPage->GetObj( nMaxChildOrdNum );
|
|
|
|
sal_uInt32 nTmpNewPos = ::GetUserCall( pTmpObj )->GetMaxOrdNum() + 1;
|
|
|
|
if ( nTmpNewPos >= nObjCount )
|
|
|
|
{
|
|
|
|
--nTmpNewPos;
|
2004-06-28 12:33:32 +00:00
|
|
|
}
|
2004-09-09 09:55:35 +00:00
|
|
|
// assure, that determined position isn't between 'repeated' objects
|
|
|
|
pTmpObj = pDrawPage->GetObj( nTmpNewPos );
|
|
|
|
nTmpNewPos = ::GetUserCall( pTmpObj )->GetMaxOrdNum();
|
|
|
|
// apply new position
|
|
|
|
pDrawPage->SetObjectOrdNum( nNewPos, nTmpNewPos );
|
|
|
|
nNewPos = nTmpNewPos;
|
|
|
|
pDrawPage->RecalcObjOrdNums();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Assure, that object isn't positioned between nested objects
|
|
|
|
if ( ( bMovedForward && nNewPos < nObjCount - 1 ) ||
|
|
|
|
( !bMovedForward && nNewPos > 0 ) )
|
|
|
|
{
|
|
|
|
sal_uInt32 nTmpNewPos( nNewPos );
|
|
|
|
const SwFrmFmt* pParentFrmFmt =
|
|
|
|
pParentAnchoredObj ? &(pParentAnchoredObj->GetFrmFmt()) : 0L;
|
|
|
|
const SdrObject* pTmpObj = pDrawPage->GetObj( nNewPos + 1 );
|
|
|
|
while ( pTmpObj )
|
|
|
|
{
|
|
|
|
const SwFlyFrm* pTmpParentObj =
|
|
|
|
lcl_FindAnchor( pTmpObj, TRUE )->FindFlyFrm();
|
|
|
|
if ( pTmpParentObj &&
|
|
|
|
&(pTmpParentObj->GetFrmFmt()) != pParentFrmFmt )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2004-09-09 09:55:35 +00:00
|
|
|
if ( bMovedForward )
|
|
|
|
{
|
|
|
|
nTmpNewPos = ::GetUserCall( pTmpObj )->GetMaxOrdNum();
|
|
|
|
pTmpObj = pDrawPage->GetObj( nTmpNewPos + 1 );
|
|
|
|
}
|
|
|
|
else
|
2002-04-05 11:27:40 +00:00
|
|
|
{
|
2004-09-09 09:55:35 +00:00
|
|
|
nTmpNewPos = ::GetUserCall( pTmpParentObj->GetDrawObj() )
|
|
|
|
->GetMinOrdNum();
|
|
|
|
pTmpObj = pTmpParentObj->GetDrawObj();
|
2002-04-05 11:27:40 +00:00
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
2004-09-09 09:55:35 +00:00
|
|
|
else
|
|
|
|
break;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
2004-09-09 09:55:35 +00:00
|
|
|
if ( nTmpNewPos != nNewPos )
|
|
|
|
{
|
|
|
|
pDrawPage->SetObjectOrdNum( nNewPos, nTmpNewPos );
|
|
|
|
nNewPos = nTmpNewPos;
|
|
|
|
pDrawPage->RecalcObjOrdNums();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// setup collection of moved 'child' objects to move its 'repeated' objects.
|
|
|
|
std::vector< SdrObject* > aMovedChildObjs;
|
|
|
|
|
|
|
|
// move 'childs' accordingly
|
|
|
|
if ( pMovedAnchoredObj->ISA(SwFlyFrm) )
|
|
|
|
{
|
|
|
|
const SwFlyFrm* pFlyFrm = static_cast<SwFlyFrm*>(pMovedAnchoredObj);
|
|
|
|
|
|
|
|
// adjustments for accessibility API
|
|
|
|
rImp.DisposeAccessibleFrm( pFlyFrm );
|
|
|
|
rImp.AddAccessibleFrm( pFlyFrm );
|
|
|
|
|
|
|
|
const sal_uInt32 nChildNewPos = bMovedForward ? nNewPos : nNewPos+1;
|
|
|
|
sal_uInt32 i = bMovedForward ? nOldPos : nObjCount-1;
|
|
|
|
do
|
|
|
|
{
|
|
|
|
SdrObject* pTmpObj = pDrawPage->GetObj( i );
|
|
|
|
if ( pTmpObj == pObj )
|
|
|
|
break;
|
|
|
|
|
|
|
|
const SwFlyFrm* pTmpParentObj =
|
|
|
|
lcl_FindAnchor( pTmpObj, TRUE )->FindFlyFrm();
|
|
|
|
if ( pTmpParentObj &&
|
|
|
|
( ( pTmpParentObj == pFlyFrm ) ||
|
|
|
|
( pFlyFrm->IsUpperOf( *pTmpParentObj ) ) ) )
|
|
|
|
{
|
|
|
|
// move child object.,
|
|
|
|
pDrawPage->SetObjectOrdNum( i, nChildNewPos );
|
|
|
|
pDrawPage->RecalcObjOrdNums();
|
|
|
|
// collect 'child' object
|
|
|
|
aMovedChildObjs.push_back( pTmpObj );
|
|
|
|
// adjustments for accessibility API
|
|
|
|
if ( pTmpObj->ISA(SwVirtFlyDrawObj) )
|
|
|
|
{
|
|
|
|
const SwFlyFrm *pTmpFlyFrm =
|
|
|
|
static_cast<SwVirtFlyDrawObj*>(pTmpObj)->GetFlyFrm();
|
|
|
|
rImp.DisposeAccessibleFrm( pTmpFlyFrm );
|
|
|
|
rImp.AddAccessibleFrm( pTmpFlyFrm );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
rImp.DisposeAccessibleObj( pTmpObj );
|
|
|
|
rImp.AddAccessibleObj( pTmpObj );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// adjust loop counter
|
|
|
|
if ( bMovedForward )
|
|
|
|
++i;
|
|
|
|
else if ( !bMovedForward && i > 0 )
|
|
|
|
--i;
|
|
|
|
}
|
|
|
|
|
|
|
|
} while ( ( bMovedForward && i < ( nObjCount - aMovedChildObjs.size() ) ) ||
|
|
|
|
( !bMovedForward && i > ( nNewPos + aMovedChildObjs.size() ) ) );
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
2002-05-15 12:32:21 +00:00
|
|
|
else
|
|
|
|
{
|
2004-09-09 09:55:35 +00:00
|
|
|
// adjustments for accessibility API
|
2002-05-15 12:32:21 +00:00
|
|
|
rImp.DisposeAccessibleObj( pObj );
|
|
|
|
rImp.AddAccessibleObj( pObj );
|
|
|
|
}
|
2004-09-09 09:55:35 +00:00
|
|
|
|
|
|
|
_MoveRepeatedObjs( *pMovedAnchoredObj, aMovedChildObjs );
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
2004-09-09 09:55:35 +00:00
|
|
|
// <--
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* SwDrawView::TakeDragLimit()
|
|
|
|
|*
|
|
|
|
|* Ersterstellung AMA 26. Apr. 96
|
|
|
|
|* Letzte Aenderung MA 03. May. 96
|
|
|
|
|*
|
|
|
|
*************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
BOOL SwDrawView::TakeDragLimit( SdrDragMode eMode,
|
|
|
|
Rectangle& rRect ) const
|
|
|
|
{
|
2004-07-12 14:47:09 +00:00
|
|
|
const SdrMarkList &rMrkList = GetMarkedObjectList();
|
2000-09-18 23:08:29 +00:00
|
|
|
BOOL bRet = FALSE;
|
|
|
|
if( 1 == rMrkList.GetMarkCount() )
|
|
|
|
{
|
|
|
|
const SdrObject *pObj = rMrkList.GetMark( 0 )->GetObj();
|
|
|
|
SwRect aRect;
|
|
|
|
if( ::CalcClipRect( pObj, aRect, eMode == SDRDRAG_MOVE ) )
|
|
|
|
{
|
|
|
|
rRect = aRect.SVRect();
|
|
|
|
bRet = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return bRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* SwDrawView::CalcAnchor()
|
|
|
|
|*
|
|
|
|
|* Ersterstellung MA 13. Jan. 95
|
|
|
|
|* Letzte Aenderung MA 08. Nov. 96
|
|
|
|
|*
|
|
|
|
*************************************************************************/
|
|
|
|
|
|
|
|
|
2004-06-28 12:33:32 +00:00
|
|
|
const SwFrm* SwDrawView::CalcAnchor()
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2004-07-12 14:47:09 +00:00
|
|
|
const SdrMarkList &rMrkList = GetMarkedObjectList();
|
2000-09-18 23:08:29 +00:00
|
|
|
if ( rMrkList.GetMarkCount() != 1 )
|
|
|
|
return NULL;
|
|
|
|
|
2003-07-04 12:20:03 +00:00
|
|
|
SdrObject* pObj = rMrkList.GetMark( 0 )->GetObj();
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
//Fuer Absatzgebundene Objekte suchen, andernfalls einfach nur
|
|
|
|
//der aktuelle Anker. Nur suchen wenn wir gerade draggen.
|
2004-06-28 12:33:32 +00:00
|
|
|
const SwFrm* pAnch;
|
2002-11-05 11:33:39 +00:00
|
|
|
Rectangle aMyRect;
|
2003-11-24 15:02:28 +00:00
|
|
|
const BOOL bFly = pObj->ISA(SwVirtFlyDrawObj);
|
2000-09-18 23:08:29 +00:00
|
|
|
if ( bFly )
|
|
|
|
{
|
2004-06-28 12:33:32 +00:00
|
|
|
pAnch = ((SwVirtFlyDrawObj*)pObj)->GetFlyFrm()->GetAnchorFrm();
|
2002-11-05 11:33:39 +00:00
|
|
|
aMyRect = ((SwVirtFlyDrawObj*)pObj)->GetFlyFrm()->Frm().SVRect();
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SwDrawContact *pC = (SwDrawContact*)GetUserCall(pObj);
|
2003-07-04 12:20:03 +00:00
|
|
|
// OD 17.06.2003 #108784# - determine correct anchor position for
|
|
|
|
// 'virtual' drawing objects.
|
2004-06-28 12:33:32 +00:00
|
|
|
// OD 2004-03-25 #i26791#
|
|
|
|
pAnch = pC->GetAnchorFrm( pObj );
|
2000-09-18 23:08:29 +00:00
|
|
|
if( !pAnch )
|
|
|
|
{
|
|
|
|
pC->ConnectToLayout();
|
2003-07-04 12:20:03 +00:00
|
|
|
// OD 17.06.2003 #108784# - determine correct anchor position for
|
|
|
|
// 'virtual' drawing objects.
|
2004-06-28 12:33:32 +00:00
|
|
|
// OD 2004-03-25 #i26791#
|
|
|
|
pAnch = pC->GetAnchorFrm( pObj );
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
2002-11-05 11:33:39 +00:00
|
|
|
aMyRect = pObj->GetSnapRect();
|
|
|
|
}
|
|
|
|
|
|
|
|
const sal_Bool bTopRight = pAnch && ( pAnch->IsVertical() ||
|
|
|
|
pAnch->IsRightToLeft() );
|
|
|
|
|
|
|
|
const Point aMyPt = bTopRight ? aMyRect.TopRight() : aMyRect.TopLeft();
|
|
|
|
|
|
|
|
Point aPt;
|
|
|
|
if ( IsAction() )
|
|
|
|
{
|
|
|
|
if ( !TakeDragObjAnchorPos( aPt, bTopRight ) )
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Rectangle aRect = pObj->GetSnapRect();
|
|
|
|
aPt = bTopRight ? aRect.TopRight() : aRect.TopLeft();
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if ( aPt != aMyPt )
|
|
|
|
{
|
|
|
|
if ( pAnch->IsCntntFrm() )
|
2003-07-04 12:20:03 +00:00
|
|
|
{
|
|
|
|
// OD 26.06.2003 #108784# - allow drawing objects in header/footer,
|
|
|
|
// but exclude control objects.
|
|
|
|
bool bBodyOnly = CheckControlLayer( pObj );
|
|
|
|
pAnch = ::FindAnchor( (SwCntntFrm*)pAnch, aPt, bBodyOnly );
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
else if ( !bFly )
|
2002-11-05 11:33:39 +00:00
|
|
|
{
|
|
|
|
const SwRect aRect( aPt.X(), aPt.Y(), 1, 1 );
|
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
SwDrawContact* pContact = (SwDrawContact*)GetUserCall(pObj);
|
2004-06-28 12:33:32 +00:00
|
|
|
if ( pContact->GetAnchorFrm( pObj ) &&
|
|
|
|
pContact->GetAnchorFrm( pObj )->IsPageFrm() )
|
|
|
|
pAnch = pContact->GetPageFrm();
|
2000-09-18 23:08:29 +00:00
|
|
|
else
|
|
|
|
pAnch = pContact->FindPage( aRect );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if( pAnch && !pAnch->IsProtected() )
|
2003-05-22 08:43:27 +00:00
|
|
|
aAnchorPoint = pAnch->GetFrmAnchorPos( ::HasWrap( pObj ) );
|
2000-09-18 23:08:29 +00:00
|
|
|
else
|
|
|
|
pAnch = 0;
|
|
|
|
return pAnch;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* SwDrawView::ShowDragXor(), HideDragXor()
|
|
|
|
|*
|
|
|
|
|* Ersterstellung MA 17. Jan. 95
|
|
|
|
|* Letzte Aenderung MA 27. Jan. 95
|
|
|
|
|*
|
|
|
|
*************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
void SwDrawView::ShowDragAnchor()
|
|
|
|
{
|
|
|
|
SdrHdl* pHdl = aHdl.GetHdl(HDL_ANCHOR);
|
2002-10-21 11:16:02 +00:00
|
|
|
if ( ! pHdl )
|
|
|
|
pHdl = aHdl.GetHdl(HDL_ANCHOR_TR);
|
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
if(pHdl)
|
|
|
|
{
|
|
|
|
CalcAnchor();
|
|
|
|
pHdl->SetPos(aAnchorPoint);
|
|
|
|
RefreshAllIAOManagers();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* SwDrawView::MarkListHasChanged()
|
|
|
|
|*
|
|
|
|
|* Ersterstellung OM 02. Feb. 95
|
|
|
|
|* Letzte Aenderung OM 07. Jul. 95
|
|
|
|
|*
|
|
|
|
*************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
void SwDrawView::MarkListHasChanged()
|
|
|
|
{
|
|
|
|
Imp().GetShell()->DrawSelChanged(this);
|
|
|
|
FmFormView::MarkListHasChanged();
|
|
|
|
}
|
|
|
|
|
2003-04-24 13:54:11 +00:00
|
|
|
// #i7672#
|
|
|
|
void SwDrawView::ModelHasChanged()
|
|
|
|
{
|
|
|
|
// The ModelHasChanged() call in DrawingLayer also updates
|
|
|
|
// a eventually active text edit view (OutlinerView). This also leads
|
|
|
|
// to newly setting the background color for that edit view. Thus,
|
|
|
|
// this method rescues the current background color if a OutlinerView
|
|
|
|
// exists and re-establishes it then. To be more safe, the OutlinerView
|
|
|
|
// will be fetched again (maybe textedit has ended).
|
|
|
|
OutlinerView* pView = GetTextEditOutlinerView();
|
|
|
|
Color aBackColor;
|
|
|
|
sal_Bool bColorWasSaved(sal_False);
|
|
|
|
|
|
|
|
if(pView)
|
|
|
|
{
|
|
|
|
aBackColor = pView->GetBackgroundColor();
|
|
|
|
bColorWasSaved = sal_True;
|
|
|
|
}
|
|
|
|
|
|
|
|
// call parent
|
|
|
|
FmFormView::ModelHasChanged();
|
|
|
|
|
|
|
|
if(bColorWasSaved)
|
|
|
|
{
|
|
|
|
pView = GetTextEditOutlinerView();
|
|
|
|
|
|
|
|
if(pView)
|
|
|
|
{
|
|
|
|
pView->SetBackgroundColor(aBackColor);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
void SwDrawView::MakeVisible( const Rectangle &rRect, Window &rWin )
|
|
|
|
{
|
|
|
|
ASSERT( rImp.GetShell()->GetWin() && &rWin, "MakeVisible, unknown Window");
|
|
|
|
rImp.GetShell()->MakeVisible( SwRect( rRect ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
#if SUPD<500
|
|
|
|
#define SVOBJ_MISCSTATUS_NOTRESIZEABLE 0
|
|
|
|
#endif
|
|
|
|
|
|
|
|
void SwDrawView::CheckPossibilities()
|
|
|
|
{
|
|
|
|
FmFormView::CheckPossibilities();
|
|
|
|
|
|
|
|
//Zusaetzlich zu den bestehenden Flags der Objekte selbst, die von der
|
|
|
|
//DrawingEngine ausgewertet werden, koennen weitere Umstaende zu einem
|
|
|
|
//Schutz fuehren.
|
|
|
|
//Objekte, die in Rahmen verankert sind, muessen genau dann geschuetzt
|
|
|
|
//sein, wenn der Inhalt des Rahmens geschuetzt ist.
|
|
|
|
//OLE-Objekte konnen selbst einen Resize-Schutz wuenschen (StarMath)
|
|
|
|
|
2004-07-12 14:47:09 +00:00
|
|
|
const SdrMarkList &rMrkList = GetMarkedObjectList();
|
2000-09-18 23:08:29 +00:00
|
|
|
FASTBOOL bProtect = FALSE,
|
|
|
|
bSzProtect = FALSE;
|
|
|
|
for ( USHORT i = 0; !bProtect && i < rMrkList.GetMarkCount(); ++i )
|
|
|
|
{
|
|
|
|
const SdrObject *pObj = rMrkList.GetMark( i )->GetObj();
|
|
|
|
const SwFrm *pFrm = NULL;
|
2003-11-24 15:02:28 +00:00
|
|
|
if ( pObj->ISA(SwVirtFlyDrawObj) )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
const SwFlyFrm *pFly = ((SwVirtFlyDrawObj*)pObj)->GetFlyFrm();
|
|
|
|
if ( pFly )
|
|
|
|
{
|
2004-06-28 12:33:32 +00:00
|
|
|
pFrm = pFly->GetAnchorFrm();
|
2000-09-18 23:08:29 +00:00
|
|
|
if ( pFly->Lower() && pFly->Lower()->IsNoTxtFrm() )
|
|
|
|
{
|
|
|
|
SwOLENode *pNd = ((SwCntntFrm*)pFly->Lower())->GetNode()->GetOLENode();
|
|
|
|
if ( pNd )
|
|
|
|
{
|
|
|
|
SvInPlaceObjectRef aRef = pNd->GetOLEObj().GetOleRef();
|
|
|
|
if ( aRef.Is() )
|
|
|
|
{
|
2004-09-09 09:55:35 +00:00
|
|
|
// --> OD 2004-08-16 #110810# - improvement for
|
|
|
|
// the future, when more than one Writer fly frame
|
|
|
|
// can be selected.
|
|
|
|
bSzProtect |= SVOBJ_MISCSTATUS_NOTRESIZEABLE & aRef->GetMiscStatus()
|
2000-09-18 23:08:29 +00:00
|
|
|
? TRUE : FALSE;
|
2004-09-09 09:55:35 +00:00
|
|
|
// <--
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SwDrawContact *pC = (SwDrawContact*)GetUserCall(pObj);
|
2004-06-28 12:33:32 +00:00
|
|
|
if ( pC )
|
|
|
|
pFrm = pC->GetAnchorFrm( pObj );
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
if ( pFrm )
|
|
|
|
bProtect = pFrm->IsProtected(); //Rahmen, Bereiche usw.
|
|
|
|
if ( FLY_IN_CNTNT == ::FindFrmFmt( (SdrObject*)pObj )->GetAnchor().GetAnchorId() &&
|
|
|
|
rMrkList.GetMarkCount() > 1 )
|
|
|
|
bProtect = TRUE;
|
|
|
|
}
|
|
|
|
bMoveProtect |= bProtect;
|
|
|
|
bResizeProtect |= bProtect | bSzProtect;
|
|
|
|
}
|
|
|
|
|
2003-07-04 12:20:03 +00:00
|
|
|
/** replace marked <SwDrawVirtObj>-objects by its reference object for delete
|
|
|
|
marked objects.
|
|
|
|
|
|
|
|
OD 18.06.2003 #108784#
|
|
|
|
|
|
|
|
@author OD
|
|
|
|
*/
|
|
|
|
void SwDrawView::ReplaceMarkedDrawVirtObjs( SdrMarkView& _rMarkView )
|
|
|
|
{
|
|
|
|
SdrPageView* pDrawPageView = _rMarkView.GetPageViewPgNum(0);
|
2004-07-12 14:47:09 +00:00
|
|
|
const SdrMarkList& rMarkList = _rMarkView.GetMarkedObjectList();
|
2003-07-04 12:20:03 +00:00
|
|
|
|
|
|
|
if( rMarkList.GetMarkCount() )
|
|
|
|
{
|
|
|
|
// collect marked objects in a local data structure
|
|
|
|
std::vector<SdrObject*> aMarkedObjs;
|
|
|
|
for( sal_uInt32 i = 0; i < rMarkList.GetMarkCount(); ++i )
|
|
|
|
{
|
|
|
|
SdrObject* pMarkedObj = rMarkList.GetMark( i )->GetObj();
|
|
|
|
aMarkedObjs.push_back( pMarkedObj );
|
|
|
|
}
|
|
|
|
// unmark all objects
|
|
|
|
_rMarkView.UnmarkAllObj();
|
|
|
|
// re-mark objects, but for marked <SwDrawVirtObj>-objects marked its
|
|
|
|
// reference object.
|
|
|
|
while ( !aMarkedObjs.empty() )
|
|
|
|
{
|
|
|
|
SdrObject* pMarkObj = aMarkedObjs.back();
|
|
|
|
if ( pMarkObj->ISA(SwDrawVirtObj) )
|
|
|
|
{
|
|
|
|
SdrObject* pRefObj = &(static_cast<SwDrawVirtObj*>(pMarkObj)->ReferencedObj());
|
|
|
|
if ( !_rMarkView.IsObjMarked( pRefObj ) )
|
|
|
|
{
|
|
|
|
_rMarkView.MarkObj( pRefObj, pDrawPageView );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
_rMarkView.MarkObj( pMarkObj, pDrawPageView );
|
|
|
|
}
|
|
|
|
|
|
|
|
aMarkedObjs.pop_back();
|
|
|
|
}
|
|
|
|
// sort marked list in order to assure consistent state in drawing layer
|
2004-07-12 14:47:09 +00:00
|
|
|
_rMarkView.SortMarkedObjects();
|
2003-07-04 12:20:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
void SwDrawView::DeleteMarked()
|
|
|
|
{
|
|
|
|
SwDoc* pDoc = Imp().GetShell()->GetDoc();
|
2003-07-04 12:20:03 +00:00
|
|
|
if ( pDoc->GetRootFrm() )
|
2000-09-18 23:08:29 +00:00
|
|
|
pDoc->GetRootFrm()->StartAllAction();
|
|
|
|
pDoc->StartUndo();
|
2003-07-04 12:20:03 +00:00
|
|
|
// OD 18.06.2003 #108784# - replace marked <SwDrawVirtObj>-objects by its
|
|
|
|
// reference objects.
|
|
|
|
{
|
|
|
|
SdrPageView* pDrawPageView = rImp.GetPageView();
|
|
|
|
if ( pDrawPageView )
|
|
|
|
{
|
|
|
|
SdrMarkView* pMarkView = PTR_CAST( SdrMarkView, &(pDrawPageView->GetView()) );
|
|
|
|
if ( pMarkView )
|
|
|
|
{
|
|
|
|
ReplaceMarkedDrawVirtObjs( *pMarkView );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ( pDoc->DeleteSelection( *this ) )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
FmFormView::DeleteMarked();
|
|
|
|
::FrameNotify( Imp().GetShell(), FLY_DRAG_END );
|
|
|
|
}
|
|
|
|
pDoc->EndUndo();
|
|
|
|
if( pDoc->GetRootFrm() )
|
|
|
|
pDoc->GetRootFrm()->EndAllAction();
|
|
|
|
}
|
|
|
|
|
|
|
|
/********
|
|
|
|
JP 02.10.98: sollte als Fix fuer 57153 gelten, hatte aber Nebenwirkungen,
|
|
|
|
wie Bug 57475
|
2004-07-12 14:47:09 +00:00
|
|
|
const SdrMarkList& SwDrawView::GetMarkedObjectList() const
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
FlushComeBackTimer();
|
2004-07-12 14:47:09 +00:00
|
|
|
return FmFormView::GetMarkedObjectList();
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
*************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|