2000-09-18 16:07:07 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2005-09-09 00:07:41 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2005-09-09 00:07:41 +00:00
|
|
|
* $RCSfile: unoshap2.cxx,v $
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2006-03-29 11:30:42 +00:00
|
|
|
* $Revision: 1.52 $
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2006-03-29 11:30:42 +00:00
|
|
|
* last change: $Author: obo $ $Date: 2006-03-29 12:30:42 $
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2005-09-09 00:07:41 +00:00
|
|
|
* The Contents of this file are made available subject to
|
|
|
|
* the terms of GNU Lesser General Public License Version 2.1.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
|
|
|
*
|
2005-09-09 00:07:41 +00:00
|
|
|
* GNU Lesser General Public License Version 2.1
|
|
|
|
* =============================================
|
|
|
|
* Copyright 2005 by Sun Microsystems, Inc.
|
|
|
|
* 901 San Antonio Road, Palo Alto, CA 94303, USA
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2005-09-09 00:07:41 +00:00
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License version 2.1, as published by the Free Software Foundation.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2005-09-09 00:07:41 +00:00
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2005-09-09 00:07:41 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
|
|
|
* MA 02111-1307 USA
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
#define _SVX_USE_UNOGLOBALS_
|
|
|
|
|
2001-04-19 11:08:10 +00:00
|
|
|
#ifndef _COM_SUN_STAR_AWT_FONTSLANT_HPP_
|
|
|
|
#include <com/sun/star/awt/FontSlant.hpp>
|
|
|
|
#endif
|
2005-01-21 16:00:40 +00:00
|
|
|
#ifndef _COM_SUN_STAR_STYLE_VERTICALALIGNMENT_HPP_
|
|
|
|
#include <com/sun/star/style/VerticalAlignment.hpp>
|
|
|
|
#endif
|
|
|
|
#ifndef _COM_SUN_STAR_DRAWING_TEXTVERTICALADJUST_HPP_
|
|
|
|
#include <com/sun/star/drawing/TextVerticalAdjust.hpp>
|
|
|
|
#endif
|
2002-11-06 09:38:37 +00:00
|
|
|
#ifndef _COM_SUN_STAR_AWT_TEXTALIGN_HPP_
|
|
|
|
#include <com/sun/star/awt/TextAlign.hpp> //added by BerryJia for fixing Bug102407 2002-11-4
|
|
|
|
#endif
|
|
|
|
#ifndef _COM_SUN_STAR_STYLE_PARAGRAPHADJUST_HPP_
|
|
|
|
#include <com/sun/star/style/ParagraphAdjust.hpp> //added by BerryJia for fixing Bug102407 2002-11-4
|
|
|
|
#endif
|
2000-09-18 16:07:07 +00:00
|
|
|
#ifndef _COM_SUN_STAR_DRAWING_POINTSEQUENCESEQUENCE_HPP_
|
|
|
|
#include <com/sun/star/drawing/PointSequenceSequence.hpp>
|
|
|
|
#endif
|
|
|
|
#ifndef _COM_SUN_STAR_DRAWING_POINTSEQUENCE_HPP_
|
|
|
|
#include <com/sun/star/drawing/PointSequence.hpp>
|
|
|
|
#endif
|
2004-11-26 17:15:31 +00:00
|
|
|
#ifndef _COM_SUN_STAR_GRAPHIC_XGRAPHIC_HPP_
|
|
|
|
#include <com/sun/star/graphic/XGraphic.hpp>
|
|
|
|
#endif
|
2001-02-05 13:31:31 +00:00
|
|
|
#ifndef _B2D_MATRIX3D_HXX
|
|
|
|
#include <goodies/matrix3d.hxx>
|
|
|
|
#endif
|
2001-01-25 13:15:20 +00:00
|
|
|
#ifndef _URLOBJ_HXX
|
|
|
|
#include <tools/urlobj.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _UNOTOOLS_LOCALFILEHELPER_HXX
|
|
|
|
#include <unotools/localfilehelper.hxx>
|
|
|
|
#endif
|
2000-09-18 16:07:07 +00:00
|
|
|
#ifndef _SV_SVAPP_HXX
|
|
|
|
#include <vcl/svapp.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _VOS_MUTEX_HXX_ //autogen
|
|
|
|
#include <vos/mutex.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _FLTCALL_HXX
|
|
|
|
#include <svtools/fltcall.hxx>
|
|
|
|
#endif
|
2001-01-25 13:15:20 +00:00
|
|
|
#ifndef _SVX_IMPGRF_HXX
|
2001-02-13 10:35:26 +00:00
|
|
|
#include "impgrf.hxx"
|
2001-01-25 13:15:20 +00:00
|
|
|
#endif
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
#include <rtl/uuid.h>
|
|
|
|
#include <rtl/memory.h>
|
2001-01-08 14:08:36 +00:00
|
|
|
#include <tools/urlobj.hxx>
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
#include "unoprnms.hxx"
|
|
|
|
#include "unoshape.hxx"
|
|
|
|
#include "unopage.hxx"
|
|
|
|
#include "svdobj.hxx"
|
|
|
|
#include "svdpage.hxx"
|
|
|
|
#include "svdmodel.hxx"
|
|
|
|
#include "svdouno.hxx"
|
2001-05-07 13:25:20 +00:00
|
|
|
#include "shapeimpl.hxx"
|
2004-04-02 13:17:42 +00:00
|
|
|
#include "svdoashp.hxx"
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2004-07-12 13:52:28 +00:00
|
|
|
// #i29181#
|
|
|
|
#ifndef _SVDVITER_HXX
|
|
|
|
#include "svdviter.hxx"
|
|
|
|
#endif
|
|
|
|
#ifndef _SVDVIEW_HXX //autogen
|
|
|
|
#include "svdview.hxx"
|
|
|
|
#endif
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
using namespace ::osl;
|
|
|
|
using namespace ::vos;
|
|
|
|
using namespace ::rtl;
|
|
|
|
using namespace ::cppu;
|
|
|
|
using namespace ::com::sun::star;
|
|
|
|
using namespace ::com::sun::star::uno;
|
|
|
|
using namespace ::com::sun::star::lang;
|
|
|
|
using namespace ::com::sun::star::container;
|
|
|
|
|
|
|
|
#define INTERFACE_TYPE( xint ) \
|
|
|
|
::getCppuType((const Reference< xint >*)0)
|
|
|
|
|
|
|
|
#define QUERYINT( xint ) \
|
|
|
|
if( rType == ::getCppuType((const Reference< xint >*)0) ) \
|
|
|
|
aAny <<= Reference< xint >(this)
|
|
|
|
|
|
|
|
class GDIMetaFile;
|
|
|
|
class SvStream;
|
|
|
|
sal_Bool ConvertGDIMetaFileToWMF( const GDIMetaFile & rMTF, SvStream & rTargetStream,
|
|
|
|
PFilterCallback pCallback=NULL, void * pCallerData=NULL,
|
|
|
|
sal_Bool bPlaceable=sal_True);
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* class SvxShapeGroup *
|
|
|
|
***********************************************************************/
|
|
|
|
|
|
|
|
SvxShapeGroup::SvxShapeGroup( SdrObject* pObj, SvxDrawPage* pDrawPage ) throw() :
|
|
|
|
SvxShape( pObj, aSvxMapProvider.GetMap(SVXMAP_GROUP) ),
|
|
|
|
pPage( pDrawPage )
|
|
|
|
{
|
|
|
|
if( pPage )
|
|
|
|
pPage->acquire();
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
SvxShapeGroup::~SvxShapeGroup() throw()
|
|
|
|
{
|
|
|
|
if( pPage )
|
|
|
|
pPage->release();
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void SvxShapeGroup::Create( SdrObject* pNewObj, SvxDrawPage* pNewPage ) throw()
|
|
|
|
{
|
|
|
|
if( pPage )
|
|
|
|
{
|
|
|
|
pPage->release();
|
|
|
|
pPage = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
SvxShape::Create( pNewObj, pNewPage );
|
|
|
|
|
|
|
|
pPage = pNewPage;
|
|
|
|
if( pPage )
|
|
|
|
pPage->acquire();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2001-07-10 06:53:54 +00:00
|
|
|
uno::Any SAL_CALL SvxShapeGroup::queryInterface( const uno::Type & rType )
|
|
|
|
throw(uno::RuntimeException)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2001-07-10 06:53:54 +00:00
|
|
|
return SvxShape::queryInterface( rType );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
uno::Any SAL_CALL SvxShapeGroup::queryAggregation( const uno::Type & rType )
|
|
|
|
throw(uno::RuntimeException)
|
|
|
|
{
|
|
|
|
uno::Any aAny;
|
|
|
|
|
|
|
|
QUERYINT( drawing::XShapeGroup );
|
|
|
|
else QUERYINT( drawing::XShapes );
|
|
|
|
else QUERYINT( container::XIndexAccess );
|
|
|
|
else QUERYINT( container::XElementAccess );
|
|
|
|
else
|
2001-12-04 15:01:42 +00:00
|
|
|
SvxShape::queryAggregation( rType, aAny );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
return aAny;
|
|
|
|
}
|
|
|
|
|
2001-10-17 09:12:08 +00:00
|
|
|
void SAL_CALL SvxShapeGroup::acquire() throw ( )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2001-07-10 06:53:54 +00:00
|
|
|
SvxShape::acquire();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2001-10-17 09:12:08 +00:00
|
|
|
void SAL_CALL SvxShapeGroup::release() throw ( )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2001-07-10 06:53:54 +00:00
|
|
|
SvxShape::release();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
uno::Sequence< uno::Type > SAL_CALL SvxShapeGroup::getTypes()
|
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
2001-12-04 15:01:42 +00:00
|
|
|
return SvxShape::getTypes();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
uno::Sequence< sal_Int8 > SAL_CALL SvxShapeGroup::getImplementationId()
|
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
|
|
|
static uno::Sequence< sal_Int8 > aId;
|
|
|
|
if( aId.getLength() == 0 )
|
|
|
|
{
|
|
|
|
aId.realloc( 16 );
|
|
|
|
rtl_createUuid( (sal_uInt8 *)aId.getArray(), 0, sal_True );
|
|
|
|
}
|
|
|
|
return aId;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ::com::sun::star::drawing::XShape
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
OUString SAL_CALL SvxShapeGroup::getShapeType()
|
|
|
|
throw( uno::RuntimeException )
|
|
|
|
{
|
|
|
|
return SvxShape::getShapeType();
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------1----
|
|
|
|
awt::Point SAL_CALL SvxShapeGroup::getPosition() throw(uno::RuntimeException)
|
|
|
|
{
|
|
|
|
return SvxShape::getPosition();
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void SAL_CALL SvxShapeGroup::setPosition( const awt::Point& Position ) throw(uno::RuntimeException)
|
|
|
|
{
|
|
|
|
SvxShape::setPosition(Position);
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
|
|
awt::Size SAL_CALL SvxShapeGroup::getSize() throw(uno::RuntimeException)
|
|
|
|
{
|
|
|
|
return SvxShape::getSize();
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void SAL_CALL SvxShapeGroup::setSize( const awt::Size& rSize )
|
|
|
|
throw(beans::PropertyVetoException, uno::RuntimeException)
|
|
|
|
{
|
|
|
|
SvxShape::setSize( rSize );
|
|
|
|
}
|
|
|
|
|
|
|
|
// drawing::XShapeGroup
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void SAL_CALL SvxShapeGroup::enterGroup( ) throw(uno::RuntimeException)
|
|
|
|
{
|
|
|
|
// Todo
|
|
|
|
// pDrView->EnterMarkedGroup();
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void SAL_CALL SvxShapeGroup::leaveGroup( ) throw(uno::RuntimeException)
|
|
|
|
{
|
|
|
|
// Todo
|
|
|
|
// pDrView->LeaveOneGroup();
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
|
|
// XShapes
|
|
|
|
void SAL_CALL SvxShapeGroup::add( const uno::Reference< drawing::XShape >& xShape )
|
|
|
|
throw( uno::RuntimeException )
|
|
|
|
{
|
|
|
|
OGuard aGuard( Application::GetSolarMutex() );
|
|
|
|
|
|
|
|
SvxShape* pShape = SvxShape::getImplementation( xShape );
|
2006-03-29 11:30:42 +00:00
|
|
|
SdrObject* pObject = mpObj.get();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2006-03-29 11:30:42 +00:00
|
|
|
if( pObject != NULL && pPage != NULL && pShape != NULL )
|
2001-02-19 15:07:06 +00:00
|
|
|
{
|
|
|
|
SdrObject* pSdrShape = pShape->GetSdrObject();
|
|
|
|
if( pSdrShape == NULL )
|
|
|
|
pSdrShape = pPage->_CreateSdrObject( xShape );
|
2001-01-15 16:03:14 +00:00
|
|
|
|
2001-02-19 15:07:06 +00:00
|
|
|
if( pSdrShape->IsInserted() )
|
|
|
|
pSdrShape->GetObjList()->RemoveObject( pSdrShape->GetOrdNum() );
|
2001-01-15 16:03:14 +00:00
|
|
|
|
2006-03-29 11:30:42 +00:00
|
|
|
pObject->GetSubList()->InsertObject( pSdrShape );
|
|
|
|
pSdrShape->SetModel(pObject->GetModel());
|
2001-05-28 09:58:47 +00:00
|
|
|
|
|
|
|
// #85922# It makes no sense to set the layer asked
|
|
|
|
// from the group object since these is an iteration
|
|
|
|
// over the contained objects. In consequence, this
|
|
|
|
// statement erases all layer information from the draw
|
|
|
|
// objects. Layers need to be set at draw objects directly
|
|
|
|
// and have nothing to do with grouping at all.
|
2006-03-29 11:30:42 +00:00
|
|
|
// pSdrShape->SetLayer(pObject->GetLayer());
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2004-04-07 09:28:01 +00:00
|
|
|
// Establish connection between new SdrObject and its wrapper before
|
|
|
|
// inserting the new shape into the group. There a new wrapper
|
|
|
|
// would be created when this connection would not already exist.
|
2001-02-19 15:07:06 +00:00
|
|
|
if(pShape)
|
|
|
|
pShape->Create( pSdrShape, pPage );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-02-19 15:07:06 +00:00
|
|
|
if( pModel )
|
|
|
|
pModel->SetChanged();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
DBG_ERROR("could not add XShape to group shape!");
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void SAL_CALL SvxShapeGroup::remove( const uno::Reference< drawing::XShape >& xShape )
|
|
|
|
throw( uno::RuntimeException )
|
|
|
|
{
|
|
|
|
OGuard aGuard( Application::GetSolarMutex() );
|
|
|
|
|
|
|
|
SdrObject* pSdrShape = NULL;
|
|
|
|
SvxShape* pShape = SvxShape::getImplementation( xShape );
|
2006-03-29 11:30:42 +00:00
|
|
|
SdrObject* pObject = mpObj.get();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if( pShape )
|
|
|
|
pSdrShape = pShape->GetSdrObject();
|
|
|
|
|
2006-03-29 11:30:42 +00:00
|
|
|
if(pObject == NULL || pSdrShape == NULL || pSdrShape->GetObjList()->GetOwnerObj() != pObject )
|
2000-09-18 16:07:07 +00:00
|
|
|
throw uno::RuntimeException();
|
|
|
|
|
|
|
|
SdrObjList& rList = *pSdrShape->GetObjList();
|
|
|
|
|
2000-11-22 15:33:50 +00:00
|
|
|
const sal_uInt32 nObjCount = rList.GetObjCount();
|
2000-09-18 16:07:07 +00:00
|
|
|
sal_uInt32 nObjNum = 0;
|
|
|
|
while( nObjNum < nObjCount )
|
|
|
|
{
|
|
|
|
if(rList.GetObj( nObjNum ) == pSdrShape )
|
|
|
|
break;
|
|
|
|
nObjNum++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( nObjNum < nObjCount )
|
|
|
|
{
|
2004-07-12 13:52:28 +00:00
|
|
|
// #i29181#
|
|
|
|
// If the SdrObject which is about to be deleted is in any selection,
|
|
|
|
// deselect it first.
|
|
|
|
SdrViewIter aIter( pSdrShape );
|
|
|
|
|
|
|
|
for ( SdrView* pView = aIter.FirstView(); pView; pView = aIter.NextView() )
|
|
|
|
{
|
|
|
|
if(CONTAINER_ENTRY_NOTFOUND != pView->TryToFindMarkedObject(pSdrShape))
|
|
|
|
{
|
|
|
|
pView->MarkObj(pSdrShape, pView->GetPageViewPvNum(0), sal_True, sal_False);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
delete rList.NbcRemoveObject( nObjNum );
|
|
|
|
pShape->InvalidateSdrObject();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
DBG_ASSERT( 0, "Fatality! SdrObject is not belonging to its SdrObjList! [CL]" );
|
|
|
|
}
|
|
|
|
|
|
|
|
if( pModel )
|
|
|
|
pModel->SetChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
// XIndexAccess
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
sal_Int32 SAL_CALL SvxShapeGroup::getCount() throw( uno::RuntimeException )
|
|
|
|
{
|
|
|
|
OGuard aGuard( Application::GetSolarMutex() );
|
|
|
|
|
|
|
|
sal_Int32 nRetval = 0;
|
|
|
|
|
2006-03-29 11:30:42 +00:00
|
|
|
SdrObject* pObject = mpObj.get();
|
|
|
|
if(pObject && pObject->GetSubList())
|
|
|
|
nRetval = pObject->GetSubList()->GetObjCount();
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
|
|
|
throw uno::RuntimeException();
|
|
|
|
|
|
|
|
return nRetval;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
uno::Any SAL_CALL SvxShapeGroup::getByIndex( sal_Int32 Index )
|
|
|
|
throw( lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException )
|
|
|
|
{
|
|
|
|
OGuard aGuard( Application::GetSolarMutex() );
|
2006-03-29 11:30:42 +00:00
|
|
|
SdrObject* pObject = mpObj.get();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2006-03-29 11:30:42 +00:00
|
|
|
if( pObject == NULL || pObject->GetSubList() == NULL )
|
2000-09-18 16:07:07 +00:00
|
|
|
throw uno::RuntimeException();
|
|
|
|
|
|
|
|
|
2006-03-29 11:30:42 +00:00
|
|
|
if( pObject->GetSubList()->GetObjCount() <= (sal_uInt32)Index )
|
2000-09-18 16:07:07 +00:00
|
|
|
throw lang::IndexOutOfBoundsException();
|
|
|
|
|
2006-03-29 11:30:42 +00:00
|
|
|
SdrObject* pDestObj = pObject->GetSubList()->GetObj( Index );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2000-11-26 13:00:58 +00:00
|
|
|
if(pDestObj == NULL)
|
2000-09-18 16:07:07 +00:00
|
|
|
throw lang::IndexOutOfBoundsException();
|
|
|
|
|
2000-11-26 13:00:58 +00:00
|
|
|
Reference< drawing::XShape > xShape( pDestObj->getUnoShape(), uno::UNO_QUERY );
|
|
|
|
uno::Any aAny;
|
|
|
|
aAny <<= xShape;
|
|
|
|
return aAny;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ::com::sun::star::container::XElementAccess
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
uno::Type SAL_CALL SvxShapeGroup::getElementType() throw( uno::RuntimeException )
|
|
|
|
{
|
|
|
|
return ::getCppuType(( const Reference< drawing::XShape >*)0);
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
sal_Bool SAL_CALL SvxShapeGroup::hasElements() throw( uno::RuntimeException )
|
|
|
|
{
|
|
|
|
OGuard aGuard( Application::GetSolarMutex() );
|
2006-03-29 11:30:42 +00:00
|
|
|
SdrObject* pObject = mpObj.get();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2006-03-29 11:30:42 +00:00
|
|
|
return pObject && pObject->GetSubList() && (pObject->GetSubList()->GetObjCount() > 0);
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// ::com::sun::star::lang::XServiceInfo
|
|
|
|
|
|
|
|
uno::Sequence< OUString > SAL_CALL SvxShapeGroup::getSupportedServiceNames()
|
|
|
|
throw(uno::RuntimeException)
|
|
|
|
{
|
2001-01-16 19:18:55 +00:00
|
|
|
return SvxShape::getSupportedServiceNames();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* *
|
|
|
|
***********************************************************************/
|
|
|
|
|
|
|
|
SvxShapeConnector::SvxShapeConnector( SdrObject* pObj ) throw() :
|
2001-07-10 06:53:54 +00:00
|
|
|
SvxShapeText( pObj, aSvxMapProvider.GetMap(SVXMAP_CONNECTOR) )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
SvxShapeConnector::~SvxShapeConnector() throw()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2001-07-10 06:53:54 +00:00
|
|
|
|
|
|
|
uno::Any SAL_CALL SvxShapeConnector::queryInterface( const uno::Type & rType )
|
|
|
|
throw(uno::RuntimeException)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2001-07-10 06:53:54 +00:00
|
|
|
return SvxShapeText::queryInterface( rType );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
uno::Any SAL_CALL SvxShapeConnector::queryAggregation( const uno::Type & rType )
|
|
|
|
throw(uno::RuntimeException)
|
|
|
|
{
|
|
|
|
uno::Any aAny;
|
|
|
|
|
|
|
|
QUERYINT( drawing::XConnectorShape );
|
|
|
|
else
|
2001-07-10 06:53:54 +00:00
|
|
|
return SvxShapeText::queryAggregation( rType );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
return aAny;
|
|
|
|
}
|
|
|
|
|
2001-10-17 09:12:08 +00:00
|
|
|
void SAL_CALL SvxShapeConnector::acquire() throw ( )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2001-07-10 06:53:54 +00:00
|
|
|
SvxShapeText::acquire();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2001-10-17 09:12:08 +00:00
|
|
|
void SAL_CALL SvxShapeConnector::release() throw ( )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2001-07-10 06:53:54 +00:00
|
|
|
SvxShapeText::release();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
// XTypeProvider
|
|
|
|
|
|
|
|
uno::Sequence< uno::Type > SAL_CALL SvxShapeConnector::getTypes()
|
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
2001-12-04 15:01:42 +00:00
|
|
|
return SvxShape::getTypes();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
uno::Sequence< sal_Int8 > SAL_CALL SvxShapeConnector::getImplementationId()
|
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
|
|
|
static uno::Sequence< sal_Int8 > aId;
|
|
|
|
if( aId.getLength() == 0 )
|
|
|
|
{
|
|
|
|
aId.realloc( 16 );
|
|
|
|
rtl_createUuid( (sal_uInt8 *)aId.getArray(), 0, sal_True );
|
|
|
|
}
|
|
|
|
return aId;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ::com::sun::star::drawing::XShape
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
OUString SAL_CALL SvxShapeConnector::getShapeType()
|
|
|
|
throw( uno::RuntimeException )
|
|
|
|
{
|
2001-07-10 06:53:54 +00:00
|
|
|
return SvxShapeText::getShapeType();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------1----
|
|
|
|
awt::Point SAL_CALL SvxShapeConnector::getPosition() throw(uno::RuntimeException)
|
|
|
|
{
|
2001-07-10 06:53:54 +00:00
|
|
|
return SvxShapeText::getPosition();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void SAL_CALL SvxShapeConnector::setPosition( const awt::Point& Position ) throw(uno::RuntimeException)
|
|
|
|
{
|
2002-09-11 11:07:44 +00:00
|
|
|
SvxShapeText::setPosition(Position);
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
|
|
awt::Size SAL_CALL SvxShapeConnector::getSize() throw(uno::RuntimeException)
|
|
|
|
{
|
2001-07-10 06:53:54 +00:00
|
|
|
return SvxShapeText::getSize();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void SAL_CALL SvxShapeConnector::setSize( const awt::Size& rSize )
|
|
|
|
throw(beans::PropertyVetoException, uno::RuntimeException)
|
|
|
|
{
|
2001-07-10 06:53:54 +00:00
|
|
|
SvxShapeText::setSize( rSize );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
|
|
// XConnectorShape
|
|
|
|
|
|
|
|
void SAL_CALL SvxShapeConnector::connectStart( const uno::Reference< drawing::XConnectableShape >& xShape, drawing::ConnectionType nPos ) throw( uno::RuntimeException )
|
|
|
|
{
|
|
|
|
OGuard aGuard( Application::GetSolarMutex() );
|
|
|
|
|
|
|
|
Reference< drawing::XShape > xRef( xShape, UNO_QUERY );
|
|
|
|
SvxShape* pShape = SvxShape::getImplementation( xRef );
|
2006-03-29 11:30:42 +00:00
|
|
|
SdrObject* pObject = mpObj.get();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if( pShape )
|
2006-03-29 11:30:42 +00:00
|
|
|
pObject->ConnectToNode( sal_True, pShape->GetSdrObject() );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if( pModel )
|
|
|
|
pModel->SetChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void SAL_CALL SvxShapeConnector::connectEnd( const uno::Reference< drawing::XConnectableShape >& xShape, drawing::ConnectionType nPos )
|
|
|
|
throw( uno::RuntimeException )
|
|
|
|
{
|
|
|
|
OGuard aGuard( Application::GetSolarMutex() );
|
|
|
|
|
|
|
|
Reference< drawing::XShape > xRef( xShape, UNO_QUERY );
|
|
|
|
SvxShape* pShape = SvxShape::getImplementation( xRef );
|
2006-03-29 11:30:42 +00:00
|
|
|
SdrObject* pObject = mpObj.get();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2006-03-29 11:30:42 +00:00
|
|
|
if( pObject && pShape )
|
|
|
|
pObject->ConnectToNode( sal_False, pShape->GetSdrObject() );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if( pModel )
|
|
|
|
pModel->SetChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void SAL_CALL SvxShapeConnector::disconnectBegin( const uno::Reference< drawing::XConnectableShape >& xShape )
|
|
|
|
throw( uno::RuntimeException )
|
|
|
|
{
|
|
|
|
OGuard aGuard( Application::GetSolarMutex() );
|
|
|
|
|
2006-03-29 11:30:42 +00:00
|
|
|
SdrObject* pObject = mpObj.get();
|
|
|
|
|
|
|
|
if(pObject)
|
|
|
|
pObject->DisconnectFromNode( sal_True );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if( pModel )
|
|
|
|
pModel->SetChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void SAL_CALL SvxShapeConnector::disconnectEnd( const uno::Reference< drawing::XConnectableShape >& xShape )
|
|
|
|
throw( uno::RuntimeException )
|
|
|
|
{
|
|
|
|
OGuard aGuard( Application::GetSolarMutex() );
|
|
|
|
|
2006-03-29 11:30:42 +00:00
|
|
|
SdrObject* pObject = mpObj.get();
|
|
|
|
|
|
|
|
if(pObject)
|
|
|
|
pObject->DisconnectFromNode( sal_False );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if( pModel )
|
|
|
|
pModel->SetChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// ::com::sun::star::lang::XServiceInfo
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
uno::Sequence< OUString > SAL_CALL SvxShapeConnector::getSupportedServiceNames() throw( uno::RuntimeException )
|
|
|
|
{
|
2001-07-10 06:53:54 +00:00
|
|
|
return SvxShapeText::getSupportedServiceNames();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* class SvxShapeControl *
|
|
|
|
***********************************************************************/
|
2001-02-09 09:54:33 +00:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
SvxShapeControl::SvxShapeControl( SdrObject* pObj ) throw() :
|
2001-07-10 06:53:54 +00:00
|
|
|
SvxShapeText( pObj, aSvxMapProvider.GetMap(SVXMAP_CONTROL) )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2001-12-11 11:37:57 +00:00
|
|
|
setShapeKind( OBJ_UNO );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
SvxShapeControl::~SvxShapeControl() throw()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2001-07-10 06:53:54 +00:00
|
|
|
uno::Any SAL_CALL SvxShapeControl::queryInterface( const uno::Type & rType )
|
|
|
|
throw(uno::RuntimeException)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2001-07-10 06:53:54 +00:00
|
|
|
return SvxShapeText::queryInterface( rType );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
uno::Any SAL_CALL SvxShapeControl::queryAggregation( const uno::Type & rType )
|
|
|
|
throw(uno::RuntimeException)
|
|
|
|
{
|
|
|
|
uno::Any aAny;
|
|
|
|
|
|
|
|
QUERYINT( drawing::XControlShape );
|
|
|
|
else
|
2001-07-10 06:53:54 +00:00
|
|
|
return SvxShapeText::queryAggregation( rType );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
return aAny;
|
|
|
|
}
|
|
|
|
|
2001-10-17 09:12:08 +00:00
|
|
|
void SAL_CALL SvxShapeControl::acquire() throw ( )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2001-07-10 06:53:54 +00:00
|
|
|
SvxShapeText::acquire();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2001-10-17 09:12:08 +00:00
|
|
|
void SAL_CALL SvxShapeControl::release() throw ( )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2001-07-10 06:53:54 +00:00
|
|
|
SvxShapeText::release();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
// XTypeProvider
|
|
|
|
|
|
|
|
uno::Sequence< uno::Type > SAL_CALL SvxShapeControl::getTypes()
|
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
2001-12-04 15:01:42 +00:00
|
|
|
return SvxShape::getTypes();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
uno::Sequence< sal_Int8 > SAL_CALL SvxShapeControl::getImplementationId()
|
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
|
|
|
static uno::Sequence< sal_Int8 > aId;
|
|
|
|
if( aId.getLength() == 0 )
|
|
|
|
{
|
|
|
|
aId.realloc( 16 );
|
|
|
|
rtl_createUuid( (sal_uInt8 *)aId.getArray(), 0, sal_True );
|
|
|
|
}
|
|
|
|
return aId;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ::com::sun::star::drawing::XShape
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
OUString SAL_CALL SvxShapeControl::getShapeType()
|
|
|
|
throw( uno::RuntimeException )
|
|
|
|
{
|
2001-07-10 06:53:54 +00:00
|
|
|
return SvxShapeText::getShapeType();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------1----
|
|
|
|
awt::Point SAL_CALL SvxShapeControl::getPosition() throw(uno::RuntimeException)
|
|
|
|
{
|
2001-07-10 06:53:54 +00:00
|
|
|
return SvxShapeText::getPosition();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void SAL_CALL SvxShapeControl::setPosition( const awt::Point& Position ) throw(uno::RuntimeException)
|
|
|
|
{
|
2001-07-10 06:53:54 +00:00
|
|
|
SvxShapeText::setPosition(Position);
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
|
|
awt::Size SAL_CALL SvxShapeControl::getSize() throw(uno::RuntimeException)
|
|
|
|
{
|
2001-07-10 06:53:54 +00:00
|
|
|
return SvxShapeText::getSize();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void SAL_CALL SvxShapeControl::setSize( const awt::Size& rSize )
|
|
|
|
throw(beans::PropertyVetoException, uno::RuntimeException)
|
|
|
|
{
|
2001-07-10 06:53:54 +00:00
|
|
|
SvxShapeText::setSize( rSize );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// XControlShape
|
|
|
|
|
|
|
|
Reference< awt::XControlModel > SAL_CALL SvxShapeControl::getControl()
|
|
|
|
throw( uno::RuntimeException )
|
|
|
|
{
|
|
|
|
OGuard aGuard( Application::GetSolarMutex() );
|
|
|
|
|
|
|
|
Reference< awt::XControlModel > xModel;
|
|
|
|
|
2006-03-29 11:30:42 +00:00
|
|
|
SdrUnoObj* pUnoObj = PTR_CAST(SdrUnoObj, mpObj.get());
|
2000-09-18 16:07:07 +00:00
|
|
|
if( pUnoObj )
|
|
|
|
xModel = pUnoObj->GetUnoControlModel();
|
|
|
|
|
|
|
|
return xModel;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void SAL_CALL SvxShapeControl::setControl( const Reference< awt::XControlModel >& xControl )
|
|
|
|
throw( uno::RuntimeException )
|
|
|
|
{
|
|
|
|
OGuard aGuard( Application::GetSolarMutex() );
|
|
|
|
|
2006-03-29 11:30:42 +00:00
|
|
|
SdrUnoObj* pUnoObj = PTR_CAST(SdrUnoObj, mpObj.get());
|
2000-09-18 16:07:07 +00:00
|
|
|
if( pUnoObj )
|
|
|
|
pUnoObj->SetUnoControlModel( xControl );
|
|
|
|
|
|
|
|
if( pModel )
|
|
|
|
pModel->SetChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
// XServiceInfo
|
|
|
|
uno::Sequence< OUString > SAL_CALL SvxShapeControl::getSupportedServiceNames() throw( uno::RuntimeException )
|
|
|
|
{
|
2001-07-10 06:53:54 +00:00
|
|
|
return SvxShapeText::getSupportedServiceNames();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2001-04-19 11:08:10 +00:00
|
|
|
static struct
|
|
|
|
{
|
|
|
|
const sal_Char* mpAPIName;
|
|
|
|
sal_uInt16 mnAPINameLen;
|
|
|
|
|
|
|
|
const sal_Char* mpFormName;
|
|
|
|
sal_uInt16 mnFormNameLen;
|
|
|
|
}
|
|
|
|
SvxShapeControlPropertyMapping[] =
|
|
|
|
{
|
|
|
|
// Warning: The first entry must be FontSlant because the any needs to be converted
|
|
|
|
{ MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_POSTURE), MAP_CHAR_LEN("FontSlant") }, // const sal_Int16 => ::com::sun::star::awt::FontSlant
|
|
|
|
{ MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTNAME), MAP_CHAR_LEN("FontName") },
|
|
|
|
{ MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTSTYLENAME), MAP_CHAR_LEN("FontStyleName") },
|
|
|
|
{ MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTFAMILY), MAP_CHAR_LEN("FontFamily") },
|
|
|
|
{ MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTCHARSET), MAP_CHAR_LEN("FontCharset") },
|
|
|
|
{ MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_HEIGHT), MAP_CHAR_LEN("FontHeight") },
|
|
|
|
{ MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTPITCH), MAP_CHAR_LEN("FontPitch" ) },
|
|
|
|
{ MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_WEIGHT), MAP_CHAR_LEN("FontWeight" ) },
|
|
|
|
{ MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_UNDERLINE), MAP_CHAR_LEN("FontUnderline") },
|
|
|
|
{ MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_STRIKEOUT), MAP_CHAR_LEN("FontStrikeout") },
|
|
|
|
{ MAP_CHAR_LEN("CharKerning"), MAP_CHAR_LEN("FontKerning") },
|
|
|
|
{ MAP_CHAR_LEN("CharWordMode"), MAP_CHAR_LEN("FontWordLineMode" ) },
|
|
|
|
{ MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_COLOR), MAP_CHAR_LEN("TextColor") },
|
2001-06-07 11:21:39 +00:00
|
|
|
{ MAP_CHAR_LEN("CharRelief"), MAP_CHAR_LEN("FontRelief") },
|
|
|
|
{ MAP_CHAR_LEN("CharUnderlineColor"), MAP_CHAR_LEN("TextLineColor") },
|
2001-04-19 11:08:10 +00:00
|
|
|
{ MAP_CHAR_LEN(UNO_NAME_EDIT_PARA_ADJUST), MAP_CHAR_LEN("Align") },
|
2005-01-21 16:00:40 +00:00
|
|
|
{ MAP_CHAR_LEN("TextVerticalAdjust"), MAP_CHAR_LEN("VerticalAlign") },
|
2001-05-15 13:09:23 +00:00
|
|
|
{ MAP_CHAR_LEN("ControlBackground"), MAP_CHAR_LEN("BackgroundColor") },
|
2004-07-06 12:34:55 +00:00
|
|
|
{ MAP_CHAR_LEN("ControlSymbolColor"), MAP_CHAR_LEN("SymbolColor") },
|
2001-04-19 11:08:10 +00:00
|
|
|
{ MAP_CHAR_LEN("ControlBorder"), MAP_CHAR_LEN("Border") },
|
2004-07-05 14:53:30 +00:00
|
|
|
{ MAP_CHAR_LEN("ControlBorderColor"), MAP_CHAR_LEN("BorderColor") },
|
2001-06-07 11:21:39 +00:00
|
|
|
{ MAP_CHAR_LEN("ControlTextEmphasis"), MAP_CHAR_LEN("FontEmphasisMark") },
|
2001-04-19 11:08:10 +00:00
|
|
|
{ NULL,0, NULL, 0 }
|
|
|
|
};
|
|
|
|
|
2005-01-21 16:00:40 +00:00
|
|
|
void SvxShapeControl::convertPropertyName( const OUString& rApiName, OUString& rInternalName )
|
2001-04-19 11:08:10 +00:00
|
|
|
{
|
|
|
|
sal_uInt16 i = 0;
|
|
|
|
while( SvxShapeControlPropertyMapping[i].mpAPIName )
|
|
|
|
{
|
|
|
|
if( rApiName.reverseCompareToAsciiL( SvxShapeControlPropertyMapping[i].mpAPIName, SvxShapeControlPropertyMapping[i].mnAPINameLen ) == 0 )
|
|
|
|
{
|
|
|
|
rInternalName = OUString( SvxShapeControlPropertyMapping[i].mpFormName, SvxShapeControlPropertyMapping[i].mnFormNameLen, RTL_TEXTENCODING_ASCII_US );
|
|
|
|
}
|
2005-01-21 16:00:40 +00:00
|
|
|
++i;
|
2001-04-19 11:08:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-11-06 09:38:37 +00:00
|
|
|
//added by BerryJia for fixing Bug102407 2002-11-04
|
|
|
|
static struct
|
|
|
|
{
|
|
|
|
sal_Int16 nAPIValue;
|
|
|
|
sal_Int16 nFormValue;
|
|
|
|
}
|
|
|
|
SvxShapeControlPropertyValueMapping[] =
|
|
|
|
{
|
2003-03-27 14:06:05 +00:00
|
|
|
// note that order matters:
|
|
|
|
// valueAlignToParaAdjust and valueParaAdjustToAlign search this map from the _beginning_
|
|
|
|
// and use the first matching entry
|
2002-11-06 09:38:37 +00:00
|
|
|
{style::ParagraphAdjust_LEFT, (sal_Int16)awt::TextAlign::LEFT},
|
|
|
|
{style::ParagraphAdjust_CENTER, (sal_Int16)awt::TextAlign::CENTER},
|
|
|
|
{style::ParagraphAdjust_RIGHT, (sal_Int16)awt::TextAlign::RIGHT},
|
2003-03-27 14:06:05 +00:00
|
|
|
{style::ParagraphAdjust_BLOCK, (sal_Int16)awt::TextAlign::RIGHT},
|
2002-11-06 09:38:37 +00:00
|
|
|
{style::ParagraphAdjust_STRETCH, (sal_Int16)awt::TextAlign::LEFT},
|
|
|
|
{style::ParagraphAdjust_MAKE_FIXED_SIZE,(sal_Int16)awt::TextAlign::LEFT},
|
|
|
|
{-1,-1}
|
|
|
|
};
|
|
|
|
|
|
|
|
void SvxShapeControl::valueAlignToParaAdjust(Any& rValue)
|
|
|
|
{
|
|
|
|
sal_Int16 nValue;
|
|
|
|
rValue >>= nValue;
|
|
|
|
sal_uInt16 i = 0;
|
|
|
|
while (-1 != SvxShapeControlPropertyValueMapping[i].nFormValue)
|
|
|
|
{
|
|
|
|
if (nValue == SvxShapeControlPropertyValueMapping[i].nFormValue)
|
|
|
|
{
|
|
|
|
rValue <<= (SvxShapeControlPropertyValueMapping[i].nAPIValue);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void SvxShapeControl::valueParaAdjustToAlign(Any& rValue)
|
|
|
|
{
|
|
|
|
sal_Int32 nValue;
|
|
|
|
rValue >>= nValue;
|
|
|
|
sal_uInt16 i = 0;
|
|
|
|
while (-1 != SvxShapeControlPropertyValueMapping[i].nAPIValue)
|
|
|
|
{
|
|
|
|
if ( nValue == SvxShapeControlPropertyValueMapping[i].nAPIValue)
|
|
|
|
{
|
|
|
|
rValue <<= (SvxShapeControlPropertyValueMapping[i].nFormValue);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-01-21 16:00:40 +00:00
|
|
|
namespace
|
|
|
|
{
|
|
|
|
void convertVerticalAdjustToVerticalAlign( Any& _rValue ) SAL_THROW( ( lang::IllegalArgumentException ) )
|
|
|
|
{
|
|
|
|
if ( !_rValue.hasValue() )
|
|
|
|
return;
|
|
|
|
|
|
|
|
drawing::TextVerticalAdjust eAdjust = drawing::TextVerticalAdjust_TOP;
|
|
|
|
style::VerticalAlignment eAlign = style::VerticalAlignment_TOP;
|
|
|
|
if ( !( _rValue >>= eAdjust ) )
|
|
|
|
throw lang::IllegalArgumentException();
|
|
|
|
switch ( eAdjust )
|
|
|
|
{
|
|
|
|
case drawing::TextVerticalAdjust_TOP: eAlign = style::VerticalAlignment_TOP; break;
|
|
|
|
case drawing::TextVerticalAdjust_BOTTOM: eAlign = style::VerticalAlignment_BOTTOM; break;
|
|
|
|
default: eAlign = style::VerticalAlignment_MIDDLE; break;
|
|
|
|
}
|
|
|
|
_rValue <<= eAlign;
|
|
|
|
}
|
|
|
|
|
|
|
|
void convertVerticalAlignToVerticalAdjust( Any& _rValue )
|
|
|
|
{
|
|
|
|
if ( !_rValue.hasValue() )
|
|
|
|
return;
|
|
|
|
style::VerticalAlignment eAlign = style::VerticalAlignment_TOP;
|
|
|
|
drawing::TextVerticalAdjust eAdjust = drawing::TextVerticalAdjust_TOP;
|
|
|
|
OSL_VERIFY( _rValue >>= eAlign );
|
|
|
|
switch ( eAlign )
|
|
|
|
{
|
|
|
|
case style::VerticalAlignment_TOP: eAdjust = drawing::TextVerticalAdjust_TOP; break;
|
|
|
|
case style::VerticalAlignment_BOTTOM: eAdjust = drawing::TextVerticalAdjust_BOTTOM; break;
|
|
|
|
default: eAdjust = drawing::TextVerticalAdjust_CENTER; break;
|
|
|
|
}
|
|
|
|
_rValue <<= eAdjust;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-04-19 11:08:10 +00:00
|
|
|
void SAL_CALL SvxShapeControl::setPropertyValue( const OUString& aPropertyName, const uno::Any& aValue )
|
|
|
|
throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, com::sun::star::beans::PropertyVetoException, com::sun::star::lang::IllegalArgumentException)
|
|
|
|
{
|
|
|
|
OUString aFormsName;
|
2005-01-21 16:00:40 +00:00
|
|
|
convertPropertyName( aPropertyName, aFormsName );
|
2001-04-19 11:08:10 +00:00
|
|
|
if( aFormsName.getLength() )
|
|
|
|
{
|
|
|
|
uno::Reference< beans::XPropertySet > xControl( getControl(), uno::UNO_QUERY );
|
|
|
|
if( xControl.is() )
|
|
|
|
{
|
|
|
|
uno::Reference< beans::XPropertySetInfo > xInfo( xControl->getPropertySetInfo() );
|
|
|
|
if( xInfo.is() && xInfo->hasPropertyByName( aFormsName ) )
|
|
|
|
{
|
2005-01-21 16:00:40 +00:00
|
|
|
uno::Any aConvertedValue( aValue );
|
|
|
|
if ( aFormsName.equalsAscii( "FontSlant" ) )
|
2001-04-19 11:08:10 +00:00
|
|
|
{
|
|
|
|
awt::FontSlant nSlant;
|
|
|
|
if( !(aValue >>= nSlant ) )
|
|
|
|
throw lang::IllegalArgumentException();
|
2005-01-21 16:00:40 +00:00
|
|
|
aConvertedValue <<= (sal_Int16)nSlant;
|
2001-04-19 11:08:10 +00:00
|
|
|
}
|
2005-01-21 16:00:40 +00:00
|
|
|
else if ( aFormsName.equalsAscii( "Align" ) )
|
2001-04-19 11:08:10 +00:00
|
|
|
{
|
2005-01-21 16:00:40 +00:00
|
|
|
valueParaAdjustToAlign( aConvertedValue );
|
2001-04-19 11:08:10 +00:00
|
|
|
}
|
2005-01-21 16:00:40 +00:00
|
|
|
else if ( aFormsName.equalsAscii( "VerticalAlign" ) )
|
|
|
|
{
|
|
|
|
convertVerticalAdjustToVerticalAlign( aConvertedValue );
|
|
|
|
}
|
|
|
|
|
|
|
|
xControl->setPropertyValue( aFormsName, aConvertedValue );
|
2001-04-19 11:08:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SvxShape::setPropertyValue( aPropertyName, aValue );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
uno::Any SAL_CALL SvxShapeControl::getPropertyValue( const OUString& aPropertyName )
|
|
|
|
throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
|
|
|
|
{
|
|
|
|
OUString aFormsName;
|
2005-01-21 16:00:40 +00:00
|
|
|
convertPropertyName( aPropertyName, aFormsName );
|
2001-04-19 11:08:10 +00:00
|
|
|
if( aFormsName.getLength() )
|
|
|
|
{
|
|
|
|
uno::Reference< beans::XPropertySet > xControl( getControl(), uno::UNO_QUERY );
|
|
|
|
|
2005-01-21 16:00:40 +00:00
|
|
|
uno::Any aValue;
|
2001-04-19 11:08:10 +00:00
|
|
|
if( xControl.is() )
|
|
|
|
{
|
|
|
|
uno::Reference< beans::XPropertySetInfo > xInfo( xControl->getPropertySetInfo() );
|
|
|
|
if( xInfo.is() && xInfo->hasPropertyByName( aFormsName ) )
|
|
|
|
{
|
2005-01-21 16:00:40 +00:00
|
|
|
aValue = xControl->getPropertyValue( aFormsName );
|
|
|
|
if ( aFormsName.equalsAscii( "FontSlant" ) )
|
2001-04-19 11:08:10 +00:00
|
|
|
{
|
2005-01-21 16:00:40 +00:00
|
|
|
awt::FontSlant eSlant = awt::FontSlant_NONE;
|
2001-04-19 11:08:10 +00:00
|
|
|
sal_Int16 nSlant;
|
2005-01-21 16:00:40 +00:00
|
|
|
if ( aValue >>= nSlant )
|
|
|
|
{
|
|
|
|
eSlant = (awt::FontSlant)nSlant;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
OSL_VERIFY( aValue >>= eSlant );
|
|
|
|
}
|
|
|
|
aValue <<= eSlant;
|
2001-04-19 11:08:10 +00:00
|
|
|
}
|
2005-01-21 16:00:40 +00:00
|
|
|
else if ( aFormsName.equalsAscii( "Align" ) )
|
2001-04-19 11:08:10 +00:00
|
|
|
{
|
2005-01-21 16:00:40 +00:00
|
|
|
valueAlignToParaAdjust( aValue );
|
|
|
|
}
|
|
|
|
else if ( aFormsName.equalsAscii( "VerticalAlign" ) )
|
|
|
|
{
|
|
|
|
convertVerticalAlignToVerticalAdjust( aValue );
|
2001-04-19 11:08:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-01-21 16:00:40 +00:00
|
|
|
return aValue;
|
2001-04-19 11:08:10 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return SvxShape::getPropertyValue( aPropertyName );
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// XPropertyState
|
|
|
|
beans::PropertyState SAL_CALL SvxShapeControl::getPropertyState( const ::rtl::OUString& PropertyName ) throw( beans::UnknownPropertyException, uno::RuntimeException )
|
|
|
|
{
|
|
|
|
OUString aFormsName;
|
2005-01-21 16:00:40 +00:00
|
|
|
convertPropertyName( PropertyName, aFormsName );
|
2001-04-19 11:08:10 +00:00
|
|
|
if( aFormsName.getLength() )
|
|
|
|
{
|
|
|
|
uno::Reference< beans::XPropertyState > xControl( getControl(), uno::UNO_QUERY );
|
|
|
|
uno::Reference< beans::XPropertySet > xPropSet( getControl(), uno::UNO_QUERY );
|
|
|
|
|
|
|
|
if( xControl.is() && xPropSet.is() )
|
|
|
|
{
|
|
|
|
uno::Reference< beans::XPropertySetInfo > xInfo( xPropSet->getPropertySetInfo() );
|
|
|
|
if( xInfo.is() && xInfo->hasPropertyByName( aFormsName ) )
|
|
|
|
{
|
|
|
|
return xControl->getPropertyState( aFormsName );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return beans::PropertyState_DEFAULT_VALUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return SvxShape::getPropertyState( PropertyName );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void SAL_CALL SvxShapeControl::setPropertyToDefault( const ::rtl::OUString& PropertyName ) throw( beans::UnknownPropertyException, uno::RuntimeException )
|
|
|
|
{
|
|
|
|
OUString aFormsName;
|
2005-01-21 16:00:40 +00:00
|
|
|
convertPropertyName( PropertyName, aFormsName );
|
2001-04-19 11:08:10 +00:00
|
|
|
if( aFormsName.getLength() )
|
|
|
|
{
|
|
|
|
uno::Reference< beans::XPropertyState > xControl( getControl(), uno::UNO_QUERY );
|
|
|
|
uno::Reference< beans::XPropertySet > xPropSet( getControl(), uno::UNO_QUERY );
|
|
|
|
|
|
|
|
if( xControl.is() && xPropSet.is() )
|
|
|
|
{
|
|
|
|
uno::Reference< beans::XPropertySetInfo > xInfo( xPropSet->getPropertySetInfo() );
|
|
|
|
if( xInfo.is() && xInfo->hasPropertyByName( aFormsName ) )
|
|
|
|
{
|
|
|
|
xControl->setPropertyToDefault( aFormsName );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SvxShape::setPropertyToDefault( PropertyName );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
uno::Any SAL_CALL SvxShapeControl::getPropertyDefault( const ::rtl::OUString& aPropertyName )
|
|
|
|
throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
|
|
|
|
{
|
|
|
|
OUString aFormsName;
|
2005-01-21 16:00:40 +00:00
|
|
|
convertPropertyName( aPropertyName, aFormsName );
|
2001-04-19 11:08:10 +00:00
|
|
|
if( aFormsName.getLength() )
|
|
|
|
{
|
|
|
|
uno::Reference< beans::XPropertyState > xControl( getControl(), uno::UNO_QUERY );
|
|
|
|
|
|
|
|
if( xControl.is() )
|
|
|
|
{
|
2005-01-21 16:00:40 +00:00
|
|
|
Any aDefault( xControl->getPropertyDefault( aFormsName ) );
|
|
|
|
if ( aFormsName.equalsAscii( "FontSlant" ) )
|
2001-04-19 11:08:10 +00:00
|
|
|
{
|
2005-01-21 16:00:40 +00:00
|
|
|
sal_Int16 nSlant( 0 );
|
|
|
|
aDefault >>= nSlant;
|
|
|
|
aDefault <<= (awt::FontSlant)nSlant;
|
|
|
|
}
|
|
|
|
else if ( aFormsName.equalsAscii( "Align" ) )
|
|
|
|
{
|
|
|
|
valueAlignToParaAdjust( aDefault );
|
2001-04-19 11:08:10 +00:00
|
|
|
}
|
2005-01-21 16:00:40 +00:00
|
|
|
else if ( aFormsName.equalsAscii( "VerticalAlign" ) )
|
2001-04-19 11:08:10 +00:00
|
|
|
{
|
2005-01-21 16:00:40 +00:00
|
|
|
convertVerticalAlignToVerticalAdjust( aDefault );
|
2001-04-19 11:08:10 +00:00
|
|
|
}
|
2005-01-21 16:00:40 +00:00
|
|
|
return aDefault;
|
2001-04-19 11:08:10 +00:00
|
|
|
}
|
2001-06-06 08:02:44 +00:00
|
|
|
|
|
|
|
throw beans::UnknownPropertyException();
|
2001-04-19 11:08:10 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return SvxShape::getPropertyDefault( aPropertyName );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
/***********************************************************************
|
|
|
|
* class SvxShapeDimensioning *
|
|
|
|
***********************************************************************/
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
SvxShapeDimensioning::SvxShapeDimensioning( SdrObject* pObj ) throw()
|
2001-07-10 06:53:54 +00:00
|
|
|
: SvxShapeText( pObj, aSvxMapProvider.GetMap(SVXMAP_DIMENSIONING) )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
SvxShapeDimensioning::~SvxShapeDimensioning() throw()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
// ::com::sun::star::lang::XServiceInfo
|
|
|
|
uno::Sequence< OUString > SAL_CALL SvxShapeDimensioning::getSupportedServiceNames() throw( uno::RuntimeException )
|
|
|
|
{
|
2001-07-10 06:53:54 +00:00
|
|
|
return SvxShapeText::getSupportedServiceNames();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* *
|
|
|
|
***********************************************************************/
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
SvxShapeCircle::SvxShapeCircle( SdrObject* pObj ) throw()
|
2001-07-10 06:53:54 +00:00
|
|
|
: SvxShapeText( pObj, aSvxMapProvider.GetMap(SVXMAP_CIRCLE) )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
SvxShapeCircle::~SvxShapeCircle() throw()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
// ::com::sun::star::lang::XServiceInfo
|
|
|
|
// XServiceInfo
|
|
|
|
uno::Sequence< OUString > SAL_CALL SvxShapeCircle::getSupportedServiceNames() throw( uno::RuntimeException )
|
|
|
|
{
|
2001-07-10 06:53:54 +00:00
|
|
|
return SvxShapeText::getSupportedServiceNames();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* *
|
|
|
|
***********************************************************************/
|
|
|
|
|
|
|
|
#include "svdopath.hxx"
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
SvxShapePolyPolygon::SvxShapePolyPolygon( SdrObject* pObj , drawing::PolygonKind eNew )
|
2001-07-10 06:53:54 +00:00
|
|
|
throw( com::sun::star::beans::PropertyVetoException, com::sun::star::lang::IllegalArgumentException)
|
|
|
|
: SvxShapeText( pObj, aSvxMapProvider.GetMap(SVXMAP_POLYPOLYGON) ),
|
2000-09-18 16:07:07 +00:00
|
|
|
ePolygonKind( eNew )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
SvxShapePolyPolygon::~SvxShapePolyPolygon() throw()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2001-02-05 13:31:31 +00:00
|
|
|
void SAL_CALL ImplSvxPolyPolygonToPointSequenceSequence( const drawing::PointSequenceSequence* pOuterSequence, XPolyPolygon& rNewPolyPolygon ) throw()
|
|
|
|
{
|
|
|
|
// Koordinaten in das PolyPolygon packen
|
|
|
|
sal_Int32 nOuterSequenceCount = pOuterSequence->getLength();
|
|
|
|
|
|
|
|
// Zeiger auf innere sequences holen
|
|
|
|
const drawing::PointSequence* pInnerSequence = pOuterSequence->getConstArray();
|
2003-03-27 14:06:05 +00:00
|
|
|
const drawing::PointSequence* pInnerSeqEnd = pInnerSequence + pOuterSequence->getLength();
|
2001-02-05 13:31:31 +00:00
|
|
|
|
2001-04-24 10:33:35 +00:00
|
|
|
// #85920# Clear the given polygon, since the new one shall be SET, not ADDED
|
|
|
|
rNewPolyPolygon.Clear();
|
|
|
|
|
2003-03-27 14:06:05 +00:00
|
|
|
for(;pInnerSequence != pInnerSeqEnd;++pInnerSequence)
|
2001-02-05 13:31:31 +00:00
|
|
|
{
|
|
|
|
sal_Int32 nInnerSequenceCount = pInnerSequence->getLength();
|
|
|
|
|
|
|
|
// Neues XPolygon vorbereiten
|
|
|
|
XPolygon aNewPolygon((USHORT)nInnerSequenceCount);
|
|
|
|
|
|
|
|
// Zeiger auf Arrays holen
|
2003-03-27 14:06:05 +00:00
|
|
|
const awt::Point* pArray = pInnerSequence->getConstArray();
|
|
|
|
const awt::Point* pArrayEnd = pArray + nInnerSequenceCount;
|
2001-02-05 13:31:31 +00:00
|
|
|
|
2003-03-27 14:06:05 +00:00
|
|
|
for(USHORT b=0;pArray != pArrayEnd;++b,++pArray)
|
2001-02-05 13:31:31 +00:00
|
|
|
{
|
2003-03-27 14:06:05 +00:00
|
|
|
Point& rPoint = aNewPolygon[b];
|
|
|
|
rPoint.X() = pArray->X;
|
|
|
|
rPoint.Y() = pArray->Y;
|
2001-02-05 13:31:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Neues Teilpolygon einfuegen
|
|
|
|
rNewPolyPolygon.Insert(aNewPolygon);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void SAL_CALL SvxShapePolyPolygon::setPropertyValue( const OUString& aPropertyName, const uno::Any& aValue )
|
|
|
|
throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, com::sun::star::beans::PropertyVetoException, com::sun::star::lang::IllegalArgumentException)
|
|
|
|
{
|
|
|
|
OGuard aGuard( Application::GetSolarMutex() );
|
|
|
|
|
2000-11-22 17:14:28 +00:00
|
|
|
if( aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(UNO_NAME_POLYPOLYGON)))
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2001-02-05 13:31:31 +00:00
|
|
|
if( !aValue.getValue() || aValue.getValueType() != ::getCppuType((const drawing::PointSequenceSequence*)0) )
|
2000-09-18 16:07:07 +00:00
|
|
|
throw lang::IllegalArgumentException();
|
|
|
|
|
|
|
|
XPolyPolygon aNewPolyPolygon;
|
|
|
|
|
2001-02-05 13:31:31 +00:00
|
|
|
ImplSvxPolyPolygonToPointSequenceSequence( (drawing::PointSequenceSequence*)aValue.getValue(), aNewPolyPolygon );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-02-05 13:31:31 +00:00
|
|
|
SetPolygon(aNewPolyPolygon);
|
|
|
|
}
|
|
|
|
else if(aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Geometry")))
|
|
|
|
{
|
|
|
|
if( !aValue.getValue() || aValue.getValueType() != ::getCppuType((const drawing::PointSequenceSequence*)0) )
|
|
|
|
throw lang::IllegalArgumentException();
|
|
|
|
|
2006-03-29 11:30:42 +00:00
|
|
|
SdrObject* pObject = mpObj.get();
|
|
|
|
if( pObject )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2001-02-05 13:31:31 +00:00
|
|
|
XPolyPolygon aNewPolyPolygon;
|
|
|
|
Matrix3D aMatrix3D;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2006-03-29 11:30:42 +00:00
|
|
|
pObject->TRGetBaseGeometry(aMatrix3D, aNewPolyPolygon);
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-02-05 13:31:31 +00:00
|
|
|
ImplSvxPolyPolygonToPointSequenceSequence( (drawing::PointSequenceSequence*)aValue.getValue(), aNewPolyPolygon );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2006-03-29 11:30:42 +00:00
|
|
|
pObject->TRSetBaseGeometry(aMatrix3D, aNewPolyPolygon);
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
2000-11-22 17:14:28 +00:00
|
|
|
else if(aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(UNO_NAME_POLYGON)))
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
drawing::PointSequence* pSequence = (drawing::PointSequence*)aValue.getValue();
|
|
|
|
|
|
|
|
if( !pSequence || aValue.getValueType() != ::getCppuType((const drawing::PointSequence*)0 ) )
|
|
|
|
throw lang::IllegalArgumentException();
|
|
|
|
|
|
|
|
// Koordinaten in das PolyPolygon packen
|
|
|
|
const sal_Int32 nSequenceCount = pSequence->getLength();
|
|
|
|
|
|
|
|
// Neues PolyPolygon vorbereiten
|
|
|
|
XPolyPolygon aNewPolyPolygon;
|
|
|
|
|
|
|
|
// Neues XPolygon vorbereiten
|
2000-11-22 15:33:50 +00:00
|
|
|
XPolygon aNewPolygon((USHORT)nSequenceCount);
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
// Zeiger auf Arrays holen
|
|
|
|
awt::Point* pArray = pSequence->getArray();
|
|
|
|
|
|
|
|
for(sal_Int32 b=0;b<nSequenceCount;b++)
|
|
|
|
{
|
2000-11-22 15:33:50 +00:00
|
|
|
aNewPolygon[(USHORT)b] = Point( pArray->X, pArray->Y );
|
2000-09-18 16:07:07 +00:00
|
|
|
pArray++;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Neues Teilpolygon einfuegen
|
|
|
|
aNewPolyPolygon.Insert(aNewPolygon);
|
|
|
|
|
|
|
|
// Polygon setzen
|
|
|
|
SetPolygon(aNewPolyPolygon);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SvxShape::setPropertyValue(aPropertyName, aValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
if( pModel )
|
|
|
|
pModel->SetChanged();
|
|
|
|
}
|
|
|
|
|
2004-04-02 13:17:42 +00:00
|
|
|
void SAL_CALL SvxPointSequenceSequenceToXPolyPolygon( const XPolyPolygon& rPolyPoly, drawing::PointSequenceSequence& rRetval )
|
2001-02-05 13:31:31 +00:00
|
|
|
{
|
|
|
|
if( rRetval.getLength() != rPolyPoly.Count() )
|
|
|
|
rRetval.realloc( rPolyPoly.Count() );
|
|
|
|
|
|
|
|
// Zeiger auf aeussere Arrays holen
|
|
|
|
drawing::PointSequence* pOuterSequence = rRetval.getArray();
|
|
|
|
|
|
|
|
for(sal_uInt16 a=0;a<rPolyPoly.Count();a++)
|
|
|
|
{
|
|
|
|
// Einzelpolygon holen
|
|
|
|
const XPolygon& rPoly = rPolyPoly[a];
|
|
|
|
|
|
|
|
// Platz in Arrays schaffen
|
|
|
|
pOuterSequence->realloc((sal_Int32)rPoly.GetPointCount());
|
|
|
|
|
|
|
|
// Pointer auf arrays holen
|
|
|
|
awt::Point* pInnerSequence = pOuterSequence->getArray();
|
|
|
|
|
|
|
|
for(sal_uInt16 b=0;b<rPoly.GetPointCount();b++)
|
|
|
|
{
|
|
|
|
*pInnerSequence = awt::Point( rPoly[b].X(), rPoly[b].Y() );
|
|
|
|
pInnerSequence++;
|
|
|
|
}
|
|
|
|
|
|
|
|
pOuterSequence++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
|
|
uno::Any SAL_CALL SvxShapePolyPolygon::getPropertyValue( const OUString& aPropertyName )
|
|
|
|
throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
|
|
|
|
{
|
|
|
|
OGuard aGuard( Application::GetSolarMutex() );
|
|
|
|
|
2000-11-22 17:14:28 +00:00
|
|
|
if(aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(UNO_NAME_POLYPOLYGON)))
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
// PolyPolygon in eine struct PolyPolygon packen
|
|
|
|
const XPolyPolygon& rPolyPoly = GetPolygon();
|
|
|
|
drawing::PointSequenceSequence aRetval( rPolyPoly.Count() );
|
|
|
|
|
2004-04-02 13:17:42 +00:00
|
|
|
SvxPointSequenceSequenceToXPolyPolygon( rPolyPoly, aRetval );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-02-05 13:31:31 +00:00
|
|
|
return uno::Any( &aRetval, ::getCppuType((const drawing::PointSequenceSequence*)0) );
|
|
|
|
}
|
|
|
|
else if(aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Geometry")))
|
|
|
|
{
|
|
|
|
// PolyPolygon in eine struct PolyPolygon packen
|
|
|
|
XPolyPolygon aPolyPoly;
|
|
|
|
Matrix3D aMatrix3D;
|
2006-03-29 11:30:42 +00:00
|
|
|
SdrObject* pObject = mpObj.get();
|
|
|
|
if( pObject )
|
|
|
|
pObject->TRGetBaseGeometry( aMatrix3D, aPolyPoly );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-02-05 13:31:31 +00:00
|
|
|
drawing::PointSequenceSequence aRetval( aPolyPoly.Count() );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2004-04-02 13:17:42 +00:00
|
|
|
SvxPointSequenceSequenceToXPolyPolygon( aPolyPoly, aRetval );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
return uno::Any( &aRetval, ::getCppuType((const drawing::PointSequenceSequence*)0) );
|
|
|
|
}
|
2000-11-22 17:14:28 +00:00
|
|
|
else if(aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(UNO_NAME_POLYGON)))
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
// PolyPolygon in eine struct PolyPolygon packen
|
|
|
|
const XPolyPolygon& rPolyPoly = GetPolygon();
|
|
|
|
|
2000-11-22 17:14:28 +00:00
|
|
|
sal_Int32 nCount = 0;
|
|
|
|
if( rPolyPoly.Count() > 0 )
|
|
|
|
nCount = rPolyPoly[0].GetPointCount();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2000-11-22 17:14:28 +00:00
|
|
|
drawing::PointSequence aRetval( nCount );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2000-11-22 17:14:28 +00:00
|
|
|
if( nCount > 0 )
|
|
|
|
{
|
|
|
|
// Einzelpolygon holen
|
|
|
|
const XPolygon& rPoly = rPolyPoly[0];
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2000-11-22 17:14:28 +00:00
|
|
|
// Pointer auf arrays holen
|
|
|
|
awt::Point* pSequence = aRetval.getArray();
|
|
|
|
|
|
|
|
for(sal_Int32 b=0;b<nCount;b++)
|
2000-11-22 17:30:03 +00:00
|
|
|
*pSequence++ = awt::Point( rPoly[(USHORT)b].X(), rPoly[(USHORT)b].Y() );
|
2000-11-22 17:14:28 +00:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
return uno::Any( &aRetval, ::getCppuType((const drawing::PointSequence*)0) );
|
|
|
|
}
|
2000-11-22 17:14:28 +00:00
|
|
|
else if(aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(UNO_NAME_POLYGONKIND)))
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
drawing::PolygonKind ePT = GetPolygonKind();
|
|
|
|
return Any( &ePT, ::getCppuType((const drawing::PolygonKind*)0) );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return SvxShape::getPropertyValue(aPropertyName);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
drawing::PolygonKind SvxShapePolyPolygon::GetPolygonKind() const throw()
|
|
|
|
{
|
|
|
|
return ePolygonKind;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void SvxShapePolyPolygon::SetPolygon(const XPolyPolygon& rNew) throw()
|
|
|
|
{
|
|
|
|
OGuard aGuard( Application::GetSolarMutex() );
|
|
|
|
|
2006-03-29 11:30:42 +00:00
|
|
|
SdrObject* pObject = mpObj.get();
|
|
|
|
if(pObject)
|
|
|
|
((SdrPathObj*)pObject)->SetPathPoly(rNew);
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
const XPolyPolygon& SvxShapePolyPolygon::GetPolygon() const throw()
|
|
|
|
{
|
|
|
|
OGuard aGuard( Application::GetSolarMutex() );
|
|
|
|
|
2006-03-29 11:30:42 +00:00
|
|
|
SdrObject* pObject = mpObj.get();
|
|
|
|
if(pObject)
|
|
|
|
return ((SdrPathObj*)pObject)->GetPathPoly();
|
2000-09-18 16:07:07 +00:00
|
|
|
return aEmptyPoly;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ::com::sun::star::lang::XServiceInfo
|
|
|
|
uno::Sequence< OUString > SAL_CALL SvxShapePolyPolygon::getSupportedServiceNames() throw( uno::RuntimeException )
|
|
|
|
{
|
2001-07-10 06:53:54 +00:00
|
|
|
return SvxShapeText::getSupportedServiceNames();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* class SvxShapePolyPolygonBezier *
|
|
|
|
***********************************************************************/
|
|
|
|
|
|
|
|
#ifndef _COM_SUN_STAR_DRAWING_POLYPOLYGONBEZIERCOORDS_HPP_
|
|
|
|
#include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
|
|
|
|
#endif
|
|
|
|
#ifndef _COM_SUN_STAR_DRAWING_FLAGSEQUENCE_HPP_
|
|
|
|
#include <com/sun/star/drawing/FlagSequence.hpp>
|
|
|
|
#endif
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
SvxShapePolyPolygonBezier::SvxShapePolyPolygonBezier( SdrObject* pObj , drawing::PolygonKind eNew ) throw()
|
2001-07-10 06:53:54 +00:00
|
|
|
: SvxShapeText( pObj, aSvxMapProvider.GetMap(SVXMAP_POLYPOLYGONBEZIER) ),
|
2000-09-18 16:07:07 +00:00
|
|
|
ePolygonKind( eNew )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
SvxShapePolyPolygonBezier::~SvxShapePolyPolygonBezier() throw()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2004-04-02 13:17:42 +00:00
|
|
|
void SvxConvertPolyPolygonBezierToXPolyPolygon( const drawing::PolyPolygonBezierCoords* pSourcePolyPolygon, XPolyPolygon& rNewPolyPolygon )
|
2001-02-05 13:31:31 +00:00
|
|
|
throw( IllegalArgumentException )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2001-02-05 13:31:31 +00:00
|
|
|
sal_Int32 nOuterSequenceCount = pSourcePolyPolygon->Coordinates.getLength();
|
|
|
|
if(pSourcePolyPolygon->Flags.getLength() != nOuterSequenceCount)
|
|
|
|
throw IllegalArgumentException();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-02-05 13:31:31 +00:00
|
|
|
// Zeiger auf innere sequences holen
|
|
|
|
const drawing::PointSequence* pInnerSequence = pSourcePolyPolygon->Coordinates.getConstArray();
|
|
|
|
const drawing::FlagSequence* pInnerSequenceFlags = pSourcePolyPolygon->Flags.getConstArray();
|
2001-04-05 10:31:27 +00:00
|
|
|
sal_Bool bIsCurve(FALSE);
|
|
|
|
sal_Bool bCurveValid(TRUE);
|
|
|
|
sal_Bool bCurveTestActive(FALSE);
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-04-05 10:31:27 +00:00
|
|
|
for(sal_Int32 a(0); bCurveValid && a < nOuterSequenceCount; a++)
|
2001-02-05 13:31:31 +00:00
|
|
|
{
|
|
|
|
sal_Int32 nInnerSequenceCount = pInnerSequence->getLength();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-02-05 13:31:31 +00:00
|
|
|
if(pInnerSequenceFlags->getLength() != nInnerSequenceCount)
|
2000-09-18 16:07:07 +00:00
|
|
|
throw IllegalArgumentException();
|
|
|
|
|
2001-02-05 13:31:31 +00:00
|
|
|
// Neues XPolygon vorbereiten
|
|
|
|
XPolygon aNewPolygon((USHORT)nInnerSequenceCount);
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-02-05 13:31:31 +00:00
|
|
|
// Zeiger auf Arrays holen
|
|
|
|
const awt::Point* pArray = pInnerSequence->getConstArray();
|
|
|
|
const drawing::PolygonFlags* pArrayFlags = pInnerSequenceFlags->getConstArray();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-04-05 10:31:27 +00:00
|
|
|
for(sal_Int32 b(0); bCurveValid && b < nInnerSequenceCount; b++)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2001-04-05 10:31:27 +00:00
|
|
|
// coordinate data
|
2001-02-05 13:31:31 +00:00
|
|
|
aNewPolygon[(USHORT)b] = Point( pArray->X, pArray->Y );
|
|
|
|
pArray++;
|
2001-04-05 10:31:27 +00:00
|
|
|
|
|
|
|
// flag data
|
|
|
|
XPolyFlags ePolyFlag = (XPolyFlags)((sal_uInt16)*pArrayFlags++);
|
|
|
|
|
|
|
|
// set curve flag
|
|
|
|
if(!bIsCurve && ePolyFlag == XPOLY_CONTROL)
|
|
|
|
bIsCurve = TRUE;
|
|
|
|
|
|
|
|
// curve testing
|
|
|
|
if(bIsCurve && bCurveValid && (bCurveTestActive || ePolyFlag == XPOLY_CONTROL))
|
|
|
|
{
|
|
|
|
if(!bCurveTestActive)
|
|
|
|
{
|
|
|
|
// first control point found, test it
|
|
|
|
if(b == 0)
|
|
|
|
{
|
|
|
|
// no curve startpoint possible
|
|
|
|
bCurveValid = FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// test type of prev point
|
|
|
|
XPolyFlags ePrevPolyFlag = (XPolyFlags)((sal_uInt16)*(pArrayFlags - 2));
|
|
|
|
if(ePrevPolyFlag == XPOLY_CONTROL)
|
|
|
|
{
|
|
|
|
// curve startpoint is a control point,
|
|
|
|
// this is not allowed (three control points in a row)
|
|
|
|
bCurveValid = FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// next curve test state
|
|
|
|
bCurveTestActive = TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// prev was a valid curve start, this should be the second
|
|
|
|
// curve control point, test it
|
|
|
|
if(ePolyFlag != XPOLY_CONTROL)
|
|
|
|
{
|
|
|
|
// no second curve control point
|
|
|
|
bCurveValid = FALSE;
|
|
|
|
}
|
|
|
|
else if(b == nInnerSequenceCount-1)
|
|
|
|
{
|
|
|
|
// no curve endpoint possible
|
|
|
|
bCurveValid = FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// test type of next point
|
|
|
|
XPolyFlags eNextPolyFlag = (XPolyFlags)((sal_uInt16)*pArrayFlags);
|
|
|
|
if(eNextPolyFlag == XPOLY_CONTROL)
|
|
|
|
{
|
|
|
|
// curve endpoint is the next control point,
|
|
|
|
// this is not allowed (three control points in a row)
|
|
|
|
bCurveValid = FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// end curve test for this segment
|
|
|
|
bCurveTestActive = FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
aNewPolygon.SetFlags((USHORT)b, ePolyFlag);
|
2001-02-05 13:31:31 +00:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-02-05 13:31:31 +00:00
|
|
|
pInnerSequence++;
|
|
|
|
pInnerSequenceFlags++;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-02-05 13:31:31 +00:00
|
|
|
// Neues Teilpolygon einfuegen
|
|
|
|
rNewPolyPolygon.Insert(aNewPolygon);
|
|
|
|
}
|
2001-04-05 10:31:27 +00:00
|
|
|
|
|
|
|
// throw exception if polygon data is an invalid curve definition
|
|
|
|
if(bIsCurve && !bCurveValid)
|
|
|
|
throw IllegalArgumentException();
|
2001-02-05 13:31:31 +00:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-02-05 13:31:31 +00:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void SAL_CALL SvxShapePolyPolygonBezier::setPropertyValue( const OUString& aPropertyName, const uno::Any& aValue )
|
|
|
|
throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, com::sun::star::beans::PropertyVetoException, com::sun::star::lang::IllegalArgumentException )
|
|
|
|
{
|
|
|
|
OGuard aGuard( Application::GetSolarMutex() );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-02-05 13:31:31 +00:00
|
|
|
if(aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(UNO_NAME_POLYPOLYGONBEZIER)))
|
|
|
|
{
|
|
|
|
if( !aValue.getValue() || aValue.getValueType() != ::getCppuType((const drawing::PolyPolygonBezierCoords*)0) )
|
|
|
|
throw IllegalArgumentException();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-02-05 13:31:31 +00:00
|
|
|
XPolyPolygon aNewPolyPolygon;
|
2004-04-02 13:17:42 +00:00
|
|
|
SvxConvertPolyPolygonBezierToXPolyPolygon( (drawing::PolyPolygonBezierCoords*)aValue.getValue(), aNewPolyPolygon );
|
2001-02-05 13:31:31 +00:00
|
|
|
SetPolygon(aNewPolyPolygon);
|
|
|
|
}
|
|
|
|
else if(aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Geometry")))
|
|
|
|
{
|
|
|
|
if( !aValue.getValue() || aValue.getValueType() != ::getCppuType((const drawing::PolyPolygonBezierCoords*)0) )
|
|
|
|
throw IllegalArgumentException();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2006-03-29 11:30:42 +00:00
|
|
|
SdrObject* pObject = mpObj.get();
|
|
|
|
if( pObject )
|
2001-02-05 13:31:31 +00:00
|
|
|
{
|
|
|
|
Matrix3D aMatrix3D;
|
|
|
|
XPolyPolygon aNewPolyPolygon;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2006-03-29 11:30:42 +00:00
|
|
|
pObject->TRGetBaseGeometry(aMatrix3D, aNewPolyPolygon);
|
2004-04-02 13:17:42 +00:00
|
|
|
SvxConvertPolyPolygonBezierToXPolyPolygon( (drawing::PolyPolygonBezierCoords*)aValue.getValue(), aNewPolyPolygon );
|
2006-03-29 11:30:42 +00:00
|
|
|
pObject->TRSetBaseGeometry(aMatrix3D, aNewPolyPolygon);
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SvxShape::setPropertyValue(aPropertyName, aValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
if( pModel )
|
|
|
|
pModel->SetChanged();
|
|
|
|
}
|
|
|
|
|
2004-04-02 13:17:42 +00:00
|
|
|
void SvxPolyPolygonToPolyPolygonBezierCoords( const XPolyPolygon& rPolyPoly, drawing::PolyPolygonBezierCoords& rRetval )
|
2001-02-05 13:31:31 +00:00
|
|
|
{
|
|
|
|
// Polygone innerhalb vrobereiten
|
|
|
|
rRetval.Coordinates.realloc((sal_Int32)rPolyPoly.Count());
|
|
|
|
rRetval.Flags.realloc((sal_Int32)rPolyPoly.Count());
|
|
|
|
|
|
|
|
// Zeiger auf aeussere Arrays holen
|
|
|
|
drawing::PointSequence* pOuterSequence = rRetval.Coordinates.getArray();
|
|
|
|
drawing::FlagSequence* pOuterFlags = rRetval.Flags.getArray();
|
|
|
|
|
|
|
|
for(sal_uInt16 a=0;a<rPolyPoly.Count();a++)
|
|
|
|
{
|
|
|
|
// Einzelpolygon holen
|
|
|
|
const XPolygon& rPoly = rPolyPoly[a];
|
|
|
|
|
|
|
|
// Platz in Arrays schaffen
|
|
|
|
pOuterSequence->realloc((sal_Int32)rPoly.GetPointCount());
|
|
|
|
pOuterFlags->realloc((sal_Int32)rPoly.GetPointCount());
|
|
|
|
|
|
|
|
// Pointer auf arrays holen
|
|
|
|
awt::Point* pInnerSequence = pOuterSequence->getArray();
|
|
|
|
drawing::PolygonFlags* pInnerFlags = pOuterFlags->getArray();
|
|
|
|
|
|
|
|
for(sal_uInt16 b=0;b<rPoly.GetPointCount();b++)
|
|
|
|
{
|
|
|
|
*pInnerSequence++ = awt::Point( rPoly[b].X(), rPoly[b].Y() );
|
|
|
|
*pInnerFlags++ = (drawing::PolygonFlags)((sal_uInt16)rPoly.GetFlags(b));
|
|
|
|
}
|
|
|
|
|
|
|
|
pOuterSequence++;
|
|
|
|
pOuterFlags++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
uno::Any SAL_CALL SvxShapePolyPolygonBezier::getPropertyValue( const OUString& aPropertyName )
|
|
|
|
throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
|
|
|
|
{
|
|
|
|
OGuard aGuard( Application::GetSolarMutex() );
|
2001-03-04 21:50:23 +00:00
|
|
|
uno::Any aAny;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2000-11-22 17:14:28 +00:00
|
|
|
if(aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(UNO_NAME_POLYPOLYGONBEZIER)))
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
// PolyPolygon in eine struct PolyPolygon packen
|
|
|
|
const XPolyPolygon& rPolyPoly = GetPolygon();
|
|
|
|
drawing::PolyPolygonBezierCoords aRetval;
|
2004-04-02 13:17:42 +00:00
|
|
|
SvxPolyPolygonToPolyPolygonBezierCoords(rPolyPoly, aRetval );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-03-04 21:50:23 +00:00
|
|
|
aAny <<= aRetval;
|
2001-02-05 13:31:31 +00:00
|
|
|
}
|
2001-02-09 09:54:33 +00:00
|
|
|
else if(aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Geometry")))
|
2001-02-05 13:31:31 +00:00
|
|
|
{
|
2006-03-29 11:30:42 +00:00
|
|
|
SdrObject* pObject = mpObj.get();
|
|
|
|
if( pObject )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2001-02-05 13:31:31 +00:00
|
|
|
// PolyPolygon in eine struct PolyPolygon packen
|
|
|
|
XPolyPolygon aPolyPoly;
|
|
|
|
Matrix3D aMatrix3D;
|
2006-03-29 11:30:42 +00:00
|
|
|
pObject->TRGetBaseGeometry( aMatrix3D, aPolyPoly );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-02-05 13:31:31 +00:00
|
|
|
drawing::PolyPolygonBezierCoords aRetval;
|
2004-04-02 13:17:42 +00:00
|
|
|
SvxPolyPolygonToPolyPolygonBezierCoords(aPolyPoly, aRetval );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-03-04 21:50:23 +00:00
|
|
|
aAny <<= aRetval;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
2000-11-22 17:14:28 +00:00
|
|
|
else if(aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(UNO_NAME_POLYGONKIND)))
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2001-03-04 21:50:23 +00:00
|
|
|
aAny <<= (drawing::PolygonKind)GetPolygonKind();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return SvxShape::getPropertyValue(aPropertyName);
|
|
|
|
}
|
2001-03-04 21:50:23 +00:00
|
|
|
|
|
|
|
return aAny;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
drawing::PolygonKind SvxShapePolyPolygonBezier::GetPolygonKind() const throw()
|
|
|
|
{
|
|
|
|
return ePolygonKind;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void SvxShapePolyPolygonBezier::SetPolygon(const XPolyPolygon& rNew) throw()
|
|
|
|
{
|
|
|
|
OGuard aGuard( Application::GetSolarMutex() );
|
|
|
|
|
2006-03-29 11:30:42 +00:00
|
|
|
SdrObject* pObject = mpObj.get();
|
|
|
|
if(pObject)
|
|
|
|
((SdrPathObj*)pObject)->SetPathPoly(rNew);
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
const XPolyPolygon& SvxShapePolyPolygonBezier::GetPolygon() const throw()
|
|
|
|
{
|
|
|
|
OGuard aGuard( Application::GetSolarMutex() );
|
|
|
|
|
2006-03-29 11:30:42 +00:00
|
|
|
SdrObject* pObject = mpObj.get();
|
|
|
|
if(pObject)
|
|
|
|
return ((SdrPathObj*)pObject)->GetPathPoly();
|
2000-09-18 16:07:07 +00:00
|
|
|
return aEmptyPoly;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ::com::sun::star::lang::XServiceInfo
|
|
|
|
uno::Sequence< OUString > SAL_CALL SvxShapePolyPolygonBezier::getSupportedServiceNames() throw( uno::RuntimeException )
|
|
|
|
{
|
2001-07-10 06:53:54 +00:00
|
|
|
return SvxShapeText::getSupportedServiceNames();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* class SvxGraphicObject *
|
|
|
|
***********************************************************************/
|
|
|
|
|
|
|
|
#ifndef _COM_SUN_STAR_AWT_XBITMAP_HPP_
|
|
|
|
#include <com/sun/star/awt/XBitmap.hpp>
|
|
|
|
#endif
|
|
|
|
#ifndef _SV_CVTGRF_HXX
|
|
|
|
#include <vcl/cvtgrf.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _SVDOGRAF_HXX
|
|
|
|
#include <svdograf.hxx>
|
|
|
|
#endif
|
2001-03-19 08:16:39 +00:00
|
|
|
#ifndef SVX_LIGHT
|
2000-09-18 16:07:07 +00:00
|
|
|
#ifndef _SFXDOCFILE_HXX
|
|
|
|
#include <sfx2/docfile.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _SFXAPP_HXX
|
|
|
|
#include <sfx2/app.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _SFX_FCONTNR_HXX
|
|
|
|
#include <sfx2/fcontnr.hxx>
|
|
|
|
#endif
|
2001-03-19 08:16:39 +00:00
|
|
|
#endif
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
#include "toolkit/unohlp.hxx"
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
SvxGraphicObject::SvxGraphicObject( SdrObject* pObj ) throw()
|
2001-07-10 06:53:54 +00:00
|
|
|
: SvxShapeText( pObj, aSvxMapProvider.GetMap(SVXMAP_GRAPHICOBJECT) )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
SvxGraphicObject::~SvxGraphicObject() throw()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void SAL_CALL SvxGraphicObject::setPropertyValue( const OUString& aPropertyName, const uno::Any& aValue )
|
|
|
|
throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, com::sun::star::beans::PropertyVetoException, com::sun::star::lang::IllegalArgumentException)
|
|
|
|
{
|
|
|
|
OGuard aGuard( Application::GetSolarMutex() );
|
2006-03-29 11:30:42 +00:00
|
|
|
SdrObject* pObject = mpObj.get();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2006-03-29 11:30:42 +00:00
|
|
|
if(pObject && aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(UNO_NAME_GRAPHOBJ_FILLBITMAP)))
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
if( aValue.getValueType() == ::getCppuType(( const uno::Sequence< sal_Int8 >*)0) )
|
|
|
|
{
|
|
|
|
uno::Sequence<sal_Int8>* pSeq = (uno::Sequence<sal_Int8>*)aValue.getValue();
|
|
|
|
SvMemoryStream aMemStm;
|
|
|
|
Graphic aGraphic;
|
|
|
|
|
|
|
|
aMemStm.SetBuffer( (char*)pSeq->getConstArray(), pSeq->getLength(), sal_False, pSeq->getLength() );
|
|
|
|
|
|
|
|
if( GraphicConverter::Import( aMemStm, aGraphic ) == ERRCODE_NONE )
|
|
|
|
{
|
2006-03-29 11:30:42 +00:00
|
|
|
((SdrGrafObj*)pObject)->SetGraphic(aGraphic);
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if( aValue.getValueType() == INTERFACE_TYPE( awt::XBitmap))
|
|
|
|
{
|
|
|
|
// Bitmap in das Objekt packen
|
|
|
|
Reference< awt::XBitmap > xBmp;
|
|
|
|
if( aValue >>= xBmp )
|
|
|
|
{
|
|
|
|
// Bitmap einsetzen
|
|
|
|
Graphic aGraphic(VCLUnoHelper::GetBitmap( xBmp ));
|
2006-03-29 11:30:42 +00:00
|
|
|
((SdrGrafObj*)pObject)->SetGraphic(aGraphic);
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2006-03-29 11:30:42 +00:00
|
|
|
else if( pObject && aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(UNO_NAME_GRAPHOBJ_GRAFURL)))
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
OUString aURL;
|
|
|
|
if(!(aValue >>= aURL))
|
|
|
|
throw lang::IllegalArgumentException();
|
|
|
|
|
2001-05-14 13:32:51 +00:00
|
|
|
if( aURL.compareToAscii( UNO_NAME_GRAPHOBJ_URLPREFIX, RTL_CONSTASCII_LENGTH( UNO_NAME_GRAPHOBJ_URLPREFIX ) ) == 0 )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
// graphic manager url
|
|
|
|
aURL = aURL.copy( sizeof( UNO_NAME_GRAPHOBJ_URLPREFIX ) - 1 );
|
|
|
|
String aTmpStr(aURL);
|
|
|
|
ByteString aUniqueID( aTmpStr, RTL_TEXTENCODING_UTF8 );
|
|
|
|
GraphicObject aGrafObj( aUniqueID );
|
2002-08-06 08:23:41 +00:00
|
|
|
|
|
|
|
// #101808# since loading a graphic can cause a reschedule of the office
|
|
|
|
// it is possible that our shape is removed while where in this
|
|
|
|
// method.
|
2006-03-29 11:30:42 +00:00
|
|
|
if( pObject )
|
2002-08-06 08:23:41 +00:00
|
|
|
{
|
2006-03-29 11:30:42 +00:00
|
|
|
((SdrGrafObj*)pObject)->ReleaseGraphicLink();
|
|
|
|
((SdrGrafObj*)pObject)->SetGraphicObject( aGrafObj );
|
2002-08-06 08:23:41 +00:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2001-05-14 13:32:51 +00:00
|
|
|
else if( aURL.compareToAscii( UNO_NAME_GRAPHOBJ_URLPKGPREFIX, RTL_CONSTASCII_LENGTH( UNO_NAME_GRAPHOBJ_URLPKGPREFIX ) ) != 0 )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2001-01-25 13:15:20 +00:00
|
|
|
// normal link
|
2001-03-19 08:16:39 +00:00
|
|
|
String aFilterName;
|
2001-01-25 13:15:20 +00:00
|
|
|
const SfxFilter* pSfxFilter = NULL;
|
|
|
|
SfxMedium aSfxMedium( aURL, STREAM_READ | STREAM_SHARE_DENYNONE, FALSE );
|
|
|
|
|
|
|
|
SFX_APP()->GetFilterMatcher().GuessFilter( aSfxMedium, &pSfxFilter, SFX_FILTER_IMPORT, SFX_FILTER_NOTINSTALLED | SFX_FILTER_EXECUTABLE );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-01-25 13:15:20 +00:00
|
|
|
if( !pSfxFilter )
|
|
|
|
{
|
|
|
|
INetURLObject aURLObj( aURL );
|
|
|
|
|
|
|
|
if( aURLObj.GetProtocol() == INET_PROT_NOT_VALID )
|
|
|
|
{
|
|
|
|
String aValidURL;
|
|
|
|
|
|
|
|
if( ::utl::LocalFileHelper::ConvertPhysicalNameToURL( aURL, aValidURL ) )
|
|
|
|
aURLObj = INetURLObject( aValidURL );
|
|
|
|
}
|
|
|
|
|
|
|
|
if( aURLObj.GetProtocol() != INET_PROT_NOT_VALID )
|
|
|
|
{
|
|
|
|
GraphicFilter* pGrfFilter = GetGrfFilter();
|
|
|
|
aFilterName = pGrfFilter->GetImportFormatName( pGrfFilter->GetImportFormatNumberForShortName( aURLObj.getExtension() ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
aFilterName = pSfxFilter->GetFilterName();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2002-08-06 08:23:41 +00:00
|
|
|
// #101808# since loading a graphic can cause a reschedule of the office
|
|
|
|
// it is possible that our shape is removed while where in this
|
|
|
|
// method.
|
2006-03-29 11:30:42 +00:00
|
|
|
if( pObject )
|
|
|
|
((SdrGrafObj*)pObject)->SetGraphicLink( aURL, aFilterName );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2001-05-14 13:32:51 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
}
|
2006-03-29 11:30:42 +00:00
|
|
|
else if( pObject && aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(UNO_NAME_GRAPHOBJ_GRAFSTREAMURL)))
|
2001-01-08 14:08:36 +00:00
|
|
|
{
|
|
|
|
OUString aStreamURL;
|
|
|
|
|
|
|
|
if( !( aValue >>= aStreamURL ) )
|
|
|
|
throw lang::IllegalArgumentException();
|
|
|
|
|
2001-05-14 13:32:51 +00:00
|
|
|
|
|
|
|
if( aStreamURL.compareToAscii( UNO_NAME_GRAPHOBJ_URLPKGPREFIX, RTL_CONSTASCII_LENGTH( UNO_NAME_GRAPHOBJ_URLPKGPREFIX ) ) != 0 )
|
2001-01-08 14:08:36 +00:00
|
|
|
{
|
|
|
|
aStreamURL = OUString();
|
|
|
|
}
|
|
|
|
|
2006-03-29 11:30:42 +00:00
|
|
|
((SdrGrafObj*)pObject)->SetGrafStreamURL( aStreamURL );
|
|
|
|
((SdrGrafObj*)pObject)->ForceSwapOut();
|
2001-01-08 14:08:36 +00:00
|
|
|
}
|
2006-03-29 11:30:42 +00:00
|
|
|
else if( pObject && aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(UNO_NAME_GRAPHOBJ_GRAPHIC)))
|
2004-11-26 17:15:31 +00:00
|
|
|
{
|
|
|
|
Reference< graphic::XGraphic > xGraphic;
|
|
|
|
|
|
|
|
if( !( aValue >>= xGraphic ) )
|
|
|
|
throw lang::IllegalArgumentException();
|
|
|
|
|
2006-03-29 11:30:42 +00:00
|
|
|
static_cast< SdrGrafObj*>( pObject)->SetGraphic( xGraphic );
|
2004-11-26 17:15:31 +00:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
SvxShape::setPropertyValue(aPropertyName, aValue);
|
|
|
|
}
|
|
|
|
if( pModel )
|
|
|
|
pModel->SetChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
uno::Any SAL_CALL SvxGraphicObject::getPropertyValue( const OUString& aPropertyName )
|
|
|
|
throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
|
|
|
|
{
|
|
|
|
OGuard aGuard( Application::GetSolarMutex() );
|
2006-03-29 11:30:42 +00:00
|
|
|
SdrObject* pObject = mpObj.get();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2006-03-29 11:30:42 +00:00
|
|
|
if(pObject && aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(UNO_NAME_GRAPHOBJ_FILLBITMAP)))
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2006-03-29 11:30:42 +00:00
|
|
|
const Graphic& rGraphic = ((SdrGrafObj*)pObject)->GetGraphic();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if(rGraphic.GetType() != GRAPHIC_GDIMETAFILE)
|
|
|
|
{
|
|
|
|
// Objekt in eine Bitmap packen
|
2006-03-29 11:30:42 +00:00
|
|
|
Reference< ::com::sun::star::awt::XBitmap > xBitmap( VCLUnoHelper::CreateBitmap(((SdrGrafObj*)pObject)->GetGraphic().GetBitmapEx()) );
|
2000-09-18 16:07:07 +00:00
|
|
|
return uno::Any( &xBitmap, ::getCppuType((const Reference<awt::XBitmap>*)0) );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SvMemoryStream aDestStrm( 65535, 65535 );
|
|
|
|
|
|
|
|
ConvertGDIMetaFileToWMF( rGraphic.GetGDIMetaFile(), aDestStrm, NULL, NULL, sal_False );
|
|
|
|
uno::Sequence<sal_Int8> aSeq((sal_Int8*)aDestStrm.GetData(), aDestStrm.GetSize());
|
|
|
|
return uno::Any( &aSeq, ::getCppuType(( uno::Sequence< sal_Int8 >*)0) );
|
|
|
|
}
|
|
|
|
}
|
2006-03-29 11:30:42 +00:00
|
|
|
else if( pObject && aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(UNO_NAME_GRAPHOBJ_GRAFURL)) )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
uno::Any aAny;
|
2006-03-29 11:30:42 +00:00
|
|
|
if( ((SdrGrafObj*)pObject)->IsLinkedGraphic() )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2006-03-29 11:30:42 +00:00
|
|
|
aAny <<= OUString( ((SdrGrafObj*)pObject)->GetFileName() );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-03-29 11:30:42 +00:00
|
|
|
const GraphicObject& rGrafObj = ((SdrGrafObj*)pObject)->GetGraphicObject();
|
2000-09-18 16:07:07 +00:00
|
|
|
OUString aURL( RTL_CONSTASCII_USTRINGPARAM(UNO_NAME_GRAPHOBJ_URLPREFIX));
|
|
|
|
aURL += OUString::createFromAscii( rGrafObj.GetUniqueID().GetBuffer() );
|
|
|
|
aAny <<= aURL;
|
|
|
|
}
|
|
|
|
return aAny;
|
|
|
|
}
|
2006-03-29 11:30:42 +00:00
|
|
|
else if( pObject && aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(UNO_NAME_GRAPHOBJ_GRAFSTREAMURL)) )
|
2001-01-24 12:44:05 +00:00
|
|
|
{
|
2006-03-29 11:30:42 +00:00
|
|
|
const OUString aStreamURL( ( (SdrGrafObj*) pObject )->GetGrafStreamURL() );
|
2001-01-24 12:44:05 +00:00
|
|
|
uno::Any aAny;
|
|
|
|
|
|
|
|
if( aStreamURL.getLength() )
|
|
|
|
aAny <<= aStreamURL;
|
|
|
|
|
|
|
|
return aAny;
|
|
|
|
}
|
2006-03-29 11:30:42 +00:00
|
|
|
else if( pObject && aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(UNO_NAME_GRAPHOBJ_GRAPHIC)) )
|
2004-11-26 17:15:31 +00:00
|
|
|
{
|
2006-03-29 11:30:42 +00:00
|
|
|
Reference< graphic::XGraphic > xGraphic( static_cast< SdrGrafObj* >( pObject )->GetGraphic().GetXGraphic() );
|
2004-11-26 17:15:31 +00:00
|
|
|
return uno::Any( &xGraphic, ::getCppuType((const Reference<graphic::XGraphic>*)0) );
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
return SvxShape::getPropertyValue(aPropertyName);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// ::com::sun::star::lang::XServiceInfo
|
|
|
|
uno::Sequence< OUString > SAL_CALL SvxGraphicObject::getSupportedServiceNames()
|
|
|
|
throw( uno::RuntimeException )
|
|
|
|
{
|
2001-07-10 06:53:54 +00:00
|
|
|
return SvxShapeText::getSupportedServiceNames();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-03-08 10:38:56 +00:00
|
|
|
void SvxConvertPolyPolygonBezierToXPolygon( const drawing::PolyPolygonBezierCoords* pSourcePolyPolygon, XPolygon& rNewPolygon )
|
2001-02-23 20:37:19 +00:00
|
|
|
throw( lang::IllegalArgumentException )
|
|
|
|
{
|
|
|
|
sal_Int32 nOuterSequenceCount = pSourcePolyPolygon->Coordinates.getLength();
|
|
|
|
if( nOuterSequenceCount != 1 || pSourcePolyPolygon->Flags.getLength() != nOuterSequenceCount)
|
|
|
|
throw lang::IllegalArgumentException();
|
|
|
|
|
|
|
|
// Zeiger auf innere sequences holen
|
|
|
|
const drawing::PointSequence* pInnerSequence = pSourcePolyPolygon->Coordinates.getConstArray();
|
|
|
|
const drawing::FlagSequence* pInnerSequenceFlags = pSourcePolyPolygon->Flags.getConstArray();
|
|
|
|
|
|
|
|
sal_Int32 nInnerSequenceCount = pInnerSequence->getLength();
|
|
|
|
|
|
|
|
if(pInnerSequenceFlags->getLength() != nInnerSequenceCount)
|
|
|
|
throw lang::IllegalArgumentException();
|
|
|
|
|
|
|
|
// Zeiger auf Arrays holen
|
|
|
|
const awt::Point* pArray = pInnerSequence->getConstArray();
|
|
|
|
const drawing::PolygonFlags* pArrayFlags = pInnerSequenceFlags->getConstArray();
|
|
|
|
|
|
|
|
for(sal_Int32 b=0;b<nInnerSequenceCount;b++)
|
|
|
|
{
|
|
|
|
rNewPolygon[(USHORT)b] = Point( pArray->X, pArray->Y );
|
|
|
|
pArray++;
|
|
|
|
rNewPolygon.SetFlags((USHORT)b, (XPolyFlags)((sal_uInt16)*pArrayFlags++));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-03-08 10:38:56 +00:00
|
|
|
void SvxConvertXPolygonToPolyPolygonBezier( const XPolygon& rPolygon, drawing::PolyPolygonBezierCoords& rRetval ) throw()
|
2001-02-23 20:37:19 +00:00
|
|
|
{
|
|
|
|
// Polygone innerhalb vrobereiten
|
|
|
|
rRetval.Coordinates.realloc(1);
|
|
|
|
rRetval.Flags.realloc(1);
|
|
|
|
|
|
|
|
// Zeiger auf aeussere Arrays holen
|
|
|
|
drawing::PointSequence* pOuterSequence = rRetval.Coordinates.getArray();
|
|
|
|
drawing::FlagSequence* pOuterFlags = rRetval.Flags.getArray();
|
|
|
|
|
|
|
|
// Platz in Arrays schaffen
|
|
|
|
pOuterSequence->realloc((sal_Int32)rPolygon.GetPointCount());
|
|
|
|
pOuterFlags->realloc((sal_Int32)rPolygon.GetPointCount());
|
|
|
|
|
|
|
|
// Pointer auf arrays holen
|
|
|
|
awt::Point* pInnerSequence = pOuterSequence->getArray();
|
|
|
|
drawing::PolygonFlags* pInnerFlags = pOuterFlags->getArray();
|
|
|
|
|
|
|
|
for(sal_uInt16 b=0;b<rPolygon.GetPointCount();b++)
|
|
|
|
{
|
|
|
|
*pInnerSequence++ = awt::Point( rPolygon[b].X(), rPolygon[b].Y() );
|
|
|
|
*pInnerFlags++ = (drawing::PolygonFlags)((sal_uInt16)rPolygon.GetFlags(b));
|
|
|
|
}
|
|
|
|
}
|
2001-05-07 13:25:20 +00:00
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
SvxShapeCaption::SvxShapeCaption( SdrObject* pObj ) throw()
|
2001-07-10 06:53:54 +00:00
|
|
|
: SvxShapeText( pObj, aSvxMapProvider.GetMap(SVXMAP_CAPTION) )
|
2001-05-07 13:25:20 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
SvxShapeCaption::~SvxShapeCaption() throw()
|
|
|
|
{
|
|
|
|
}
|
2004-04-02 13:17:42 +00:00
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* class SvxCustomShape *
|
|
|
|
***********************************************************************/
|
|
|
|
|
|
|
|
SvxCustomShape::SvxCustomShape( SdrObject* pObj ) throw() :
|
|
|
|
SvxShapeText( pObj, aSvxMapProvider.GetMap( SVXMAP_CUSTOMSHAPE ) )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
SvxCustomShape::~SvxCustomShape() throw()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void SvxCustomShape::Create( SdrObject* pNewObj, SvxDrawPage* pNewPage ) throw()
|
|
|
|
{
|
|
|
|
SvxShapeText::Create( pNewObj, pNewPage );
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
|
|
uno::Sequence< uno::Type > SAL_CALL SvxCustomShape::getTypes()
|
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
|
|
|
return SvxShapeText::getTypes();
|
|
|
|
}
|
|
|
|
|
|
|
|
uno::Sequence< sal_Int8 > SAL_CALL SvxCustomShape::getImplementationId()
|
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
|
|
|
static uno::Sequence< sal_Int8 > aId;
|
|
|
|
if( aId.getLength() == 0 )
|
|
|
|
{
|
|
|
|
aId.realloc( 16 );
|
|
|
|
rtl_createUuid( (sal_uInt8 *)aId.getArray(), 0, sal_True );
|
|
|
|
}
|
|
|
|
return aId;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ::com::sun::star::drawing::XShape
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
OUString SAL_CALL SvxCustomShape::getShapeType()
|
|
|
|
throw( uno::RuntimeException )
|
|
|
|
{
|
|
|
|
return SvxShape::getShapeType();
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------1----
|
|
|
|
awt::Point SAL_CALL SvxCustomShape::getPosition() throw(uno::RuntimeException)
|
|
|
|
{
|
2006-03-29 11:30:42 +00:00
|
|
|
OGuard aGuard( Application::GetSolarMutex() );
|
|
|
|
SdrObject* pObject = mpObj.get();
|
|
|
|
if ( pModel && pObject )
|
2004-04-02 13:17:42 +00:00
|
|
|
{
|
|
|
|
SdrAShapeObjGeoData aCustomShapeGeoData;
|
2006-03-29 11:30:42 +00:00
|
|
|
((SdrObjCustomShape*)pObject)->SaveGeoData( aCustomShapeGeoData );
|
2004-04-02 13:17:42 +00:00
|
|
|
|
|
|
|
sal_Bool bMirroredX = sal_False;
|
|
|
|
sal_Bool bMirroredY = sal_False;
|
|
|
|
|
2006-03-29 11:30:42 +00:00
|
|
|
if ( pObject )
|
2004-04-02 13:17:42 +00:00
|
|
|
{
|
2006-03-29 11:30:42 +00:00
|
|
|
bMirroredX = ( ((SdrObjCustomShape*)pObject)->IsMirroredX() );
|
|
|
|
bMirroredY = ( ((SdrObjCustomShape*)pObject)->IsMirroredY() );
|
2004-04-02 13:17:42 +00:00
|
|
|
}
|
|
|
|
// get aRect, this is the unrotated snaprect
|
2006-03-29 11:30:42 +00:00
|
|
|
Rectangle aRect(((SdrObjCustomShape*)pObject)->GetLogicRect());
|
2004-04-02 13:17:42 +00:00
|
|
|
Rectangle aRectangle( aRect );
|
|
|
|
|
|
|
|
if ( bMirroredX || bMirroredY )
|
|
|
|
{ // we have to retrieve the unmirrored rect
|
|
|
|
|
|
|
|
GeoStat aNewGeo( aCustomShapeGeoData.aGeo );
|
|
|
|
if ( bMirroredX )
|
|
|
|
{
|
|
|
|
Polygon aPol( Rect2Poly( aRect, aNewGeo ) );
|
|
|
|
Rectangle aBoundRect( aPol.GetBoundRect() );
|
|
|
|
|
|
|
|
Point aRef1( ( aBoundRect.Left() + aBoundRect.Right() ) >> 1, aBoundRect.Top() );
|
|
|
|
Point aRef2( aRef1.X(), aRef1.Y() + 1000 );
|
|
|
|
USHORT i;
|
|
|
|
USHORT nPntAnz=aPol.GetSize();
|
|
|
|
for (i=0; i<nPntAnz; i++)
|
|
|
|
{
|
|
|
|
MirrorPoint(aPol[i],aRef1,aRef2);
|
|
|
|
}
|
|
|
|
// Polygon wenden und etwas schieben
|
|
|
|
Polygon aPol0(aPol);
|
|
|
|
aPol[0]=aPol0[1];
|
|
|
|
aPol[1]=aPol0[0];
|
|
|
|
aPol[2]=aPol0[3];
|
|
|
|
aPol[3]=aPol0[2];
|
|
|
|
aPol[4]=aPol0[1];
|
|
|
|
Poly2Rect(aPol,aRectangle,aNewGeo);
|
|
|
|
}
|
|
|
|
if ( bMirroredY )
|
|
|
|
{
|
|
|
|
Polygon aPol( Rect2Poly( aRectangle, aNewGeo ) );
|
|
|
|
Rectangle aBoundRect( aPol.GetBoundRect() );
|
|
|
|
|
|
|
|
Point aRef1( aBoundRect.Left(), ( aBoundRect.Top() + aBoundRect.Bottom() ) >> 1 );
|
|
|
|
Point aRef2( aRef1.X() + 1000, aRef1.Y() );
|
|
|
|
USHORT i;
|
|
|
|
USHORT nPntAnz=aPol.GetSize();
|
|
|
|
for (i=0; i<nPntAnz; i++)
|
|
|
|
{
|
|
|
|
MirrorPoint(aPol[i],aRef1,aRef2);
|
|
|
|
}
|
|
|
|
// Polygon wenden und etwas schieben
|
|
|
|
Polygon aPol0(aPol);
|
|
|
|
aPol[0]=aPol0[1];
|
|
|
|
aPol[1]=aPol0[0];
|
|
|
|
aPol[2]=aPol0[3];
|
|
|
|
aPol[3]=aPol0[2];
|
|
|
|
aPol[4]=aPol0[1];
|
|
|
|
Poly2Rect( aPol, aRectangle, aNewGeo );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Point aPt( aRectangle.TopLeft() );
|
|
|
|
|
|
|
|
if( pModel->IsWriter() )
|
2006-03-29 11:30:42 +00:00
|
|
|
aPt -= pObject->GetAnchorPos();
|
2004-04-02 13:17:42 +00:00
|
|
|
|
|
|
|
ForceMetricTo100th_mm(aPt);
|
|
|
|
return ::com::sun::star::awt::Point( aPt.X(), aPt.Y() );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return SvxShape::getPosition();
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void SAL_CALL SvxCustomShape::setPosition( const awt::Point& Position ) throw(uno::RuntimeException)
|
|
|
|
{
|
|
|
|
SvxShapeText::setPosition(Position);
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
|
|
awt::Size SAL_CALL SvxCustomShape::getSize() throw(uno::RuntimeException)
|
|
|
|
{
|
|
|
|
return SvxShapeText::getSize();
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void SAL_CALL SvxCustomShape::setSize( const awt::Size& rSize )
|
|
|
|
throw(beans::PropertyVetoException, uno::RuntimeException)
|
|
|
|
{
|
|
|
|
SvxShapeText::setSize( rSize );
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// ::com::sun::star::lang::XServiceInfo
|
|
|
|
|
|
|
|
uno::Sequence< OUString > SAL_CALL SvxCustomShape::getSupportedServiceNames()
|
|
|
|
throw(uno::RuntimeException)
|
|
|
|
{
|
|
|
|
return SvxShapeText::getSupportedServiceNames();
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void SAL_CALL SvxCustomShape::setPropertyValue( const OUString& aPropertyName, const uno::Any& aValue )
|
|
|
|
throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, com::sun::star::beans::PropertyVetoException, com::sun::star::lang::IllegalArgumentException)
|
|
|
|
{
|
2006-03-29 11:30:42 +00:00
|
|
|
OGuard aGuard( Application::GetSolarMutex() );
|
|
|
|
SdrObject* pObject = mpObj.get();
|
|
|
|
|
|
|
|
sal_Bool bCustomShapeGeometry = pObject && aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "CustomShapeGeometry" ) );
|
2004-04-02 13:17:42 +00:00
|
|
|
|
|
|
|
sal_Bool bMirroredX = sal_False;
|
|
|
|
sal_Bool bMirroredY = sal_False;
|
|
|
|
|
|
|
|
if ( bCustomShapeGeometry )
|
|
|
|
{
|
2006-03-29 11:30:42 +00:00
|
|
|
bMirroredX = ( ((SdrObjCustomShape*)pObject)->IsMirroredX() );
|
|
|
|
bMirroredY = ( ((SdrObjCustomShape*)pObject)->IsMirroredY() );
|
2004-04-02 13:17:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SvxShape::setPropertyValue( aPropertyName, aValue );
|
|
|
|
|
|
|
|
if ( bCustomShapeGeometry )
|
|
|
|
{
|
2006-03-29 11:30:42 +00:00
|
|
|
Rectangle aRect( pObject->GetSnapRect() );
|
2005-02-17 08:09:16 +00:00
|
|
|
|
|
|
|
// #i38892#
|
2006-03-29 11:30:42 +00:00
|
|
|
const SdrGluePointList* pList = pObject->GetGluePointList();
|
2005-02-17 08:09:16 +00:00
|
|
|
SdrGluePointList* pListCopy = (pList && pList->GetCount()) ? new SdrGluePointList(*pList) : 0L;
|
|
|
|
bool bGluePointListChanged(false);
|
|
|
|
|
2006-03-29 11:30:42 +00:00
|
|
|
if ( ((SdrObjCustomShape*)pObject)->IsMirroredX() != bMirroredX )
|
2004-04-02 13:17:42 +00:00
|
|
|
{
|
|
|
|
Point aTop( ( aRect.Left() + aRect.Right() ) >> 1, aRect.Top() );
|
|
|
|
Point aBottom( aTop.X(), aTop.Y() + 1000 );
|
2006-03-29 11:30:42 +00:00
|
|
|
((SdrObjCustomShape*)pObject)->NbcMirror( aTop, aBottom );
|
2004-04-02 13:17:42 +00:00
|
|
|
// NbcMirroring is flipping the current mirror state,
|
|
|
|
// so we have to set the correct state again
|
2006-03-29 11:30:42 +00:00
|
|
|
((SdrObjCustomShape*)pObject)->SetMirroredX( bMirroredX ? sal_False : sal_True );
|
2005-02-17 08:09:16 +00:00
|
|
|
|
|
|
|
// #i38892#
|
|
|
|
bGluePointListChanged = true;
|
2004-04-02 13:17:42 +00:00
|
|
|
}
|
2006-03-29 11:30:42 +00:00
|
|
|
if ( ((SdrObjCustomShape*)pObject)->IsMirroredY() != bMirroredY )
|
2004-04-02 13:17:42 +00:00
|
|
|
{
|
|
|
|
Point aLeft( aRect.Left(), ( aRect.Top() + aRect.Bottom() ) >> 1 );
|
|
|
|
Point aRight( aLeft.X() + 1000, aLeft.Y() );
|
2006-03-29 11:30:42 +00:00
|
|
|
((SdrObjCustomShape*)pObject)->NbcMirror( aLeft, aRight );
|
2004-04-02 13:17:42 +00:00
|
|
|
// NbcMirroring is flipping the current mirror state,
|
|
|
|
// so we have to set the correct state again
|
2006-03-29 11:30:42 +00:00
|
|
|
((SdrObjCustomShape*)pObject)->SetMirroredY( bMirroredY ? sal_False : sal_True );
|
2005-02-17 08:09:16 +00:00
|
|
|
|
|
|
|
// #i38892#
|
|
|
|
bGluePointListChanged = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// #i38892#
|
|
|
|
if(pListCopy)
|
|
|
|
{
|
|
|
|
if(bGluePointListChanged)
|
|
|
|
{
|
2006-03-29 11:30:42 +00:00
|
|
|
SdrGluePointList* pNewList = pObject->GetGluePointList();
|
2005-02-17 08:09:16 +00:00
|
|
|
|
|
|
|
if(pNewList)
|
|
|
|
{
|
|
|
|
*pNewList = *pListCopy;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
delete pListCopy;
|
2004-04-02 13:17:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
uno::Any SAL_CALL SvxCustomShape::getPropertyValue( const OUString& aPropertyName )
|
|
|
|
throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
|
|
|
|
{
|
2006-03-29 11:30:42 +00:00
|
|
|
OGuard aGuard( Application::GetSolarMutex() );
|
|
|
|
SdrObject* pObject = mpObj.get();
|
|
|
|
|
|
|
|
if( pObject && aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "RotateAngle" ) ) )
|
2004-04-02 13:17:42 +00:00
|
|
|
{
|
2006-03-29 11:30:42 +00:00
|
|
|
double fAngle = ((SdrObjCustomShape*)pObject)->GetObjectRotation();
|
2004-04-02 13:17:42 +00:00
|
|
|
fAngle *= 100;
|
|
|
|
sal_Int32 nAngle = (sal_Int32)fAngle;
|
|
|
|
|
|
|
|
Any aAny;
|
|
|
|
aAny <<= nAngle;
|
|
|
|
return aAny;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return SvxShape::getPropertyValue( aPropertyName );
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|