2000-09-18 16:07:07 +00:00
|
|
|
|
/*************************************************************************
|
|
|
|
|
|
*
|
2005-09-09 00:06:55 +00:00
|
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2000-09-18 16:07:07 +00:00
|
|
|
|
*
|
2005-09-09 00:06:55 +00:00
|
|
|
|
* $RCSfile: unopage.cxx,v $
|
2000-09-18 16:07:07 +00:00
|
|
|
|
*
|
2006-06-19 15:55:49 +00:00
|
|
|
|
* $Revision: 1.35 $
|
2000-09-18 16:07:07 +00:00
|
|
|
|
*
|
2006-06-19 15:55:49 +00:00
|
|
|
|
* last change: $Author: hr $ $Date: 2006-06-19 16:55:49 $
|
2000-09-18 16:07:07 +00:00
|
|
|
|
*
|
2005-09-09 00:06:55 +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:06:55 +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:06:55 +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:06:55 +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:06:55 +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_
|
|
|
|
|
|
|
2004-03-30 13:33:35 +00:00
|
|
|
|
#ifndef _COM_SUN_STAR_DOCUMENT_EVENTOBJECT_HPP_
|
|
|
|
|
|
#include <com/sun/star/document/EventObject.hpp>
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_
|
|
|
|
|
|
#include <com/sun/star/lang/DisposedException.hpp>
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
|
#ifndef _VOS_MUTEX_HXX_
|
|
|
|
|
|
#include <vos/mutex.hxx>
|
|
|
|
|
|
#endif
|
|
|
|
|
|
#ifndef _OSL_MUTEX_HXX_
|
|
|
|
|
|
#include <osl/mutex.hxx>
|
|
|
|
|
|
#endif
|
2001-03-19 08:16:39 +00:00
|
|
|
|
#ifndef SVX_LIGHT
|
2000-09-18 16:07:07 +00:00
|
|
|
|
#ifndef _SFXDISPATCH_HXX //autogen
|
|
|
|
|
|
#include <sfx2/dispatch.hxx>
|
|
|
|
|
|
#endif
|
2001-04-30 09:06:24 +00:00
|
|
|
|
#ifndef _SOT_CLSIDS_HXX
|
|
|
|
|
|
#include <sot/clsids.hxx>
|
|
|
|
|
|
#endif
|
2001-03-19 08:16:39 +00:00
|
|
|
|
#endif
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
|
|
|
#include <rtl/uuid.h>
|
|
|
|
|
|
#include <rtl/memory.h>
|
2004-10-04 16:56:20 +00:00
|
|
|
|
#include <sfx2/objsh.hxx>
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
|
|
|
#include "svdobj.hxx"
|
2001-09-13 08:32:10 +00:00
|
|
|
|
#include "svdoole2.hxx"
|
2000-09-18 16:07:07 +00:00
|
|
|
|
#include "svdpage.hxx"
|
|
|
|
|
|
#include "svdmodel.hxx"
|
|
|
|
|
|
#include "svdview.hxx"
|
|
|
|
|
|
#include "svdpagv.hxx"
|
|
|
|
|
|
#include "unopage.hxx"
|
2001-04-30 09:06:24 +00:00
|
|
|
|
#include "shapeimpl.hxx"
|
2000-09-18 16:07:07 +00:00
|
|
|
|
#include "globl3d.hxx"
|
|
|
|
|
|
#include "polysc3d.hxx"
|
|
|
|
|
|
#include "unoprov.hxx"
|
|
|
|
|
|
#include "svdopath.hxx"
|
|
|
|
|
|
#include "unoapi.hxx"
|
2000-11-22 14:53:17 +00:00
|
|
|
|
#include "svdomeas.hxx"
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
2000-12-07 14:22:53 +00:00
|
|
|
|
#ifndef _E3D_EXTRUD3D_HXX
|
|
|
|
|
|
#include <extrud3d.hxx>
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef _E3D_LATHE3D_HXX
|
|
|
|
|
|
#include <lathe3d.hxx>
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
2006-06-19 15:55:49 +00:00
|
|
|
|
using ::rtl::OUString;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
using namespace ::vos;
|
|
|
|
|
|
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;
|
|
|
|
|
|
using namespace ::com::sun::star::drawing;
|
|
|
|
|
|
|
|
|
|
|
|
#define INTERFACE_TYPE( xint ) \
|
|
|
|
|
|
::getCppuType((const Reference< xint >*)0)
|
|
|
|
|
|
|
|
|
|
|
|
#define QUERYINT( xint ) \
|
|
|
|
|
|
if( rType == ::getCppuType((const Reference< xint >*)0) ) \
|
|
|
|
|
|
aAny <<= Reference< xint >(this)
|
|
|
|
|
|
|
|
|
|
|
|
DECLARE_LIST( SvxDrawPageList, SvxDrawPage * );
|
|
|
|
|
|
|
|
|
|
|
|
extern SfxItemPropertyMap* ImplGetSvxOle2PropertyMap();
|
2000-12-06 11:00:46 +00:00
|
|
|
|
extern SfxItemPropertyMap* ImplGetSvxPageShapePropertyMap();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
|
|
* class SvxDrawPage *
|
|
|
|
|
|
**********************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
UNO3_GETIMPLEMENTATION_IMPL( SvxDrawPage );
|
|
|
|
|
|
|
2006-06-19 15:55:49 +00:00
|
|
|
|
SvxDrawPage::SvxDrawPage( SdrPage* pInPage ) throw()
|
|
|
|
|
|
: mrBHelper( getMutex() )
|
|
|
|
|
|
, mpPage( pInPage )
|
|
|
|
|
|
, mpModel( 0 )
|
2000-09-18 16:07:07 +00:00
|
|
|
|
{
|
|
|
|
|
|
// Am Broadcaster anmelden
|
2006-06-19 15:55:49 +00:00
|
|
|
|
if( mpPage )
|
|
|
|
|
|
mpModel = mpPage->GetModel();
|
|
|
|
|
|
if( mpModel )
|
|
|
|
|
|
StartListening( *mpModel );
|
|
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
|
|
|
// Erzeugen der (hidden) ::com::sun::star::sdbcx::View
|
2006-06-19 15:55:49 +00:00
|
|
|
|
mpView = new SdrView( mpModel );
|
|
|
|
|
|
if( mpView )
|
|
|
|
|
|
mpView->SetDesignMode(sal_True);
|
2000-09-18 16:07:07 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
// Ctor fuer SvxDrawPage_NewInstance()
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2006-06-19 15:55:49 +00:00
|
|
|
|
SvxDrawPage::SvxDrawPage() throw()
|
|
|
|
|
|
: mrBHelper( getMutex() )
|
|
|
|
|
|
, mpPage( NULL )
|
|
|
|
|
|
, mpModel( NULL )
|
|
|
|
|
|
, mpView( NULL )
|
2000-09-18 16:07:07 +00:00
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
SvxDrawPage::~SvxDrawPage() throw()
|
|
|
|
|
|
{
|
2004-03-30 13:33:35 +00:00
|
|
|
|
DBG_ASSERT( mrBHelper.bDisposed, "SvxDrawPage must be disposed!" );
|
|
|
|
|
|
if( !mrBHelper.bDisposed )
|
|
|
|
|
|
disposing();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
// XInterface
|
|
|
|
|
|
void SvxDrawPage::release() throw()
|
|
|
|
|
|
{
|
|
|
|
|
|
uno::Reference< uno::XInterface > x( xDelegator );
|
|
|
|
|
|
if (! x.is())
|
|
|
|
|
|
{
|
|
|
|
|
|
if (osl_decrementInterlockedCount( &m_refCount ) == 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (! mrBHelper.bDisposed)
|
|
|
|
|
|
{
|
|
|
|
|
|
uno::Reference< uno::XInterface > xHoldAlive( (uno::XWeak*)this );
|
|
|
|
|
|
// First dispose
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
dispose();
|
|
|
|
|
|
}
|
|
|
|
|
|
catch(::com::sun::star::uno::Exception&)
|
|
|
|
|
|
{
|
|
|
|
|
|
// release should not throw exceptions
|
|
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
2004-03-30 13:33:35 +00:00
|
|
|
|
// only the alive ref holds the object
|
|
|
|
|
|
OSL_ASSERT( m_refCount == 1 );
|
|
|
|
|
|
// destroy the object if xHoldAlive decrement the refcount to 0
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
// restore the reference count
|
|
|
|
|
|
osl_incrementInterlockedCount( &m_refCount );
|
|
|
|
|
|
}
|
|
|
|
|
|
OWeakAggObject::release();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2004-03-30 13:33:35 +00:00
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
|
2006-06-19 15:55:49 +00:00
|
|
|
|
SvxDrawPage* SvxDrawPage::GetPageForSdrPage( SdrPage* mpPage ) throw()
|
2000-09-18 16:07:07 +00:00
|
|
|
|
{
|
2006-06-19 15:55:49 +00:00
|
|
|
|
return getImplementation( mpPage->getUnoPage() );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2004-03-30 13:33:35 +00:00
|
|
|
|
// XComponent
|
|
|
|
|
|
void SvxDrawPage::disposing() throw()
|
|
|
|
|
|
{
|
2006-06-19 15:55:49 +00:00
|
|
|
|
if( mpModel )
|
2004-03-30 13:33:35 +00:00
|
|
|
|
{
|
2006-06-19 15:55:49 +00:00
|
|
|
|
EndListening( *mpModel );
|
|
|
|
|
|
mpModel = NULL;
|
2004-03-30 13:33:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2006-06-19 15:55:49 +00:00
|
|
|
|
if( mpView )
|
2004-03-30 13:33:35 +00:00
|
|
|
|
{
|
2006-06-19 15:55:49 +00:00
|
|
|
|
delete mpView;
|
|
|
|
|
|
mpView = NULL;
|
2004-03-30 13:33:35 +00:00
|
|
|
|
}
|
2006-06-19 15:55:49 +00:00
|
|
|
|
mpPage = 0;
|
2004-03-30 13:33:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// XComponent
|
|
|
|
|
|
void SvxDrawPage::dispose()
|
|
|
|
|
|
throw(::com::sun::star::uno::RuntimeException)
|
|
|
|
|
|
{
|
|
|
|
|
|
// An frequently programming error is to release the last
|
|
|
|
|
|
// reference to this object in the disposing message.
|
|
|
|
|
|
// Make it rubust, hold a self Reference.
|
|
|
|
|
|
uno::Reference< lang::XComponent > xSelf( this );
|
|
|
|
|
|
|
|
|
|
|
|
// Guard dispose against multible threading
|
|
|
|
|
|
// Remark: It is an error to call dispose more than once
|
|
|
|
|
|
sal_Bool bDoDispose = sal_False;
|
|
|
|
|
|
{
|
|
|
|
|
|
osl::MutexGuard aGuard( mrBHelper.rMutex );
|
|
|
|
|
|
if( !mrBHelper.bDisposed && !mrBHelper.bInDispose )
|
|
|
|
|
|
{
|
|
|
|
|
|
// only one call go into this section
|
|
|
|
|
|
mrBHelper.bInDispose = sal_True;
|
|
|
|
|
|
bDoDispose = sal_True;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Do not hold the mutex because we are broadcasting
|
|
|
|
|
|
if( bDoDispose )
|
|
|
|
|
|
{
|
|
|
|
|
|
// Create an event with this as sender
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
uno::Reference< uno::XInterface > xSource( uno::Reference< uno::XInterface >::query( (lang::XComponent *)this ) );
|
|
|
|
|
|
::com::sun::star::document::EventObject aEvt;
|
|
|
|
|
|
aEvt.Source = xSource;
|
|
|
|
|
|
// inform all listeners to release this object
|
|
|
|
|
|
// The listener container are automaticly cleared
|
|
|
|
|
|
mrBHelper.aLC.disposeAndClear( aEvt );
|
|
|
|
|
|
// notify subclasses to do their dispose
|
|
|
|
|
|
disposing();
|
|
|
|
|
|
}
|
|
|
|
|
|
catch(::com::sun::star::uno::Exception& e)
|
|
|
|
|
|
{
|
|
|
|
|
|
// catch exception and throw again but signal that
|
|
|
|
|
|
// the object was disposed. Dispose should be called
|
|
|
|
|
|
// only once.
|
|
|
|
|
|
mrBHelper.bDisposed = sal_True;
|
|
|
|
|
|
mrBHelper.bInDispose = sal_False;
|
|
|
|
|
|
throw e;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// the values bDispose and bInDisposing must set in this order.
|
|
|
|
|
|
// No multithread call overcome the "!rBHelper.bDisposed && !rBHelper.bInDispose" guard.
|
|
|
|
|
|
mrBHelper.bDisposed = sal_True;
|
|
|
|
|
|
mrBHelper.bInDispose = sal_False;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// XComponent
|
|
|
|
|
|
void SAL_CALL SvxDrawPage::addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw(::com::sun::star::uno::RuntimeException)
|
|
|
|
|
|
{
|
|
|
|
|
|
OGuard aGuard( Application::GetSolarMutex() );
|
|
|
|
|
|
|
2006-06-19 15:55:49 +00:00
|
|
|
|
if( mpModel == 0 )
|
2004-03-30 13:33:35 +00:00
|
|
|
|
throw lang::DisposedException();
|
|
|
|
|
|
|
|
|
|
|
|
mrBHelper.addListener( ::getCppuType( &aListener ) , aListener );
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// XComponent
|
|
|
|
|
|
void SAL_CALL SvxDrawPage::removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw(::com::sun::star::uno::RuntimeException)
|
|
|
|
|
|
{
|
|
|
|
|
|
OGuard aGuard( Application::GetSolarMutex() );
|
|
|
|
|
|
|
2006-06-19 15:55:49 +00:00
|
|
|
|
if( mpModel == 0 )
|
2004-03-30 13:33:35 +00:00
|
|
|
|
throw lang::DisposedException();
|
|
|
|
|
|
|
|
|
|
|
|
mrBHelper.removeListener( ::getCppuType( &aListener ) , aListener );
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
|
// SfxListener
|
|
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2006-06-19 15:55:49 +00:00
|
|
|
|
void SvxDrawPage::Notify( SfxBroadcaster&, const SfxHint& rHint )
|
2000-09-18 16:07:07 +00:00
|
|
|
|
{
|
2006-06-19 15:55:49 +00:00
|
|
|
|
if( mpModel )
|
2000-09-18 16:07:07 +00:00
|
|
|
|
{
|
2000-11-01 10:43:12 +00:00
|
|
|
|
const SdrHint* pSdrHint = PTR_CAST( SdrHint, &rHint );
|
|
|
|
|
|
|
|
|
|
|
|
sal_Bool bInvalid = sal_False;
|
|
|
|
|
|
|
|
|
|
|
|
if( pSdrHint )
|
|
|
|
|
|
{
|
|
|
|
|
|
switch( pSdrHint->GetKind() )
|
|
|
|
|
|
{
|
|
|
|
|
|
case HINT_MODELCLEARED:
|
|
|
|
|
|
bInvalid = sal_True;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case HINT_PAGEORDERCHG:
|
|
|
|
|
|
{
|
|
|
|
|
|
const SdrPage* pPg=pSdrHint->GetPage();
|
2006-06-19 15:55:49 +00:00
|
|
|
|
if( pPg == mpPage ) // own page?
|
2000-11-01 10:43:12 +00:00
|
|
|
|
{
|
|
|
|
|
|
if(!pPg->IsInserted()) // page removed?
|
|
|
|
|
|
bInvalid = sal_True;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
2006-06-19 15:55:49 +00:00
|
|
|
|
default:
|
|
|
|
|
|
break;
|
2000-11-01 10:43:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if( bInvalid )
|
|
|
|
|
|
{
|
2004-03-30 13:33:35 +00:00
|
|
|
|
dispose();
|
2000-11-01 10:43:12 +00:00
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ::com::sun::star::drawing::XShapes
|
|
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2006-06-19 15:55:49 +00:00
|
|
|
|
void SAL_CALL SvxDrawPage::add( const uno::Reference< drawing::XShape >& xShape )
|
2000-09-18 16:07:07 +00:00
|
|
|
|
throw( uno::RuntimeException )
|
|
|
|
|
|
{
|
|
|
|
|
|
OGuard aGuard( Application::GetSolarMutex() );
|
|
|
|
|
|
|
2006-06-19 15:55:49 +00:00
|
|
|
|
if( (mpModel == 0) || (mpPage == 0) )
|
2004-03-30 13:33:35 +00:00
|
|
|
|
throw lang::DisposedException();
|
|
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
|
SvxShape* pShape = SvxShape::getImplementation( xShape );
|
|
|
|
|
|
|
2001-03-30 11:18:08 +00:00
|
|
|
|
if( NULL == pShape )
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
|
SdrObject *pObj = pShape->GetSdrObject();
|
|
|
|
|
|
|
|
|
|
|
|
if(!pObj)
|
|
|
|
|
|
{
|
|
|
|
|
|
pObj = CreateSdrObject( xShape );
|
|
|
|
|
|
}
|
|
|
|
|
|
else if ( !pObj->IsInserted() )
|
|
|
|
|
|
{
|
2006-06-19 15:55:49 +00:00
|
|
|
|
pObj->SetModel(mpModel);
|
|
|
|
|
|
mpPage->InsertObject( pObj );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(pObj == NULL)
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
if(pShape)
|
|
|
|
|
|
pShape->Create( pObj, this );
|
|
|
|
|
|
|
2006-06-19 15:55:49 +00:00
|
|
|
|
if( mpModel )
|
|
|
|
|
|
mpModel->SetChanged();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
void SAL_CALL SvxDrawPage::remove( const Reference< drawing::XShape >& xShape )
|
|
|
|
|
|
throw( uno::RuntimeException )
|
|
|
|
|
|
{
|
|
|
|
|
|
OGuard aGuard( Application::GetSolarMutex() );
|
|
|
|
|
|
|
2006-06-19 15:55:49 +00:00
|
|
|
|
if( (mpModel == 0) || (mpPage == 0) )
|
2004-03-30 13:33:35 +00:00
|
|
|
|
throw lang::DisposedException();
|
|
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
|
SvxShape* pShape = SvxShape::getImplementation( xShape );
|
|
|
|
|
|
|
|
|
|
|
|
if(pShape)
|
|
|
|
|
|
{
|
|
|
|
|
|
SdrObject* pObj = pShape->GetSdrObject();
|
|
|
|
|
|
if(pObj)
|
|
|
|
|
|
{
|
|
|
|
|
|
// SdrObject aus der Page loeschen
|
2006-06-19 15:55:49 +00:00
|
|
|
|
sal_uInt32 nCount = mpPage->GetObjCount();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
for( sal_uInt32 nNum = 0; nNum < nCount; nNum++ )
|
|
|
|
|
|
{
|
2006-06-19 15:55:49 +00:00
|
|
|
|
if(mpPage->GetObj(nNum) == pObj)
|
2000-09-18 16:07:07 +00:00
|
|
|
|
{
|
2006-06-19 15:55:49 +00:00
|
|
|
|
delete mpPage->RemoveObject(nNum);
|
2000-09-18 16:07:07 +00:00
|
|
|
|
pShape->InvalidateSdrObject();
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2006-06-19 15:55:49 +00:00
|
|
|
|
if( mpModel )
|
|
|
|
|
|
mpModel->SetChanged();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ::com::sun::star::container::XIndexAccess
|
|
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
sal_Int32 SAL_CALL SvxDrawPage::getCount()
|
|
|
|
|
|
throw( uno::RuntimeException )
|
|
|
|
|
|
{
|
2004-03-30 13:33:35 +00:00
|
|
|
|
OGuard aGuard( Application::GetSolarMutex() );
|
|
|
|
|
|
|
2006-06-19 15:55:49 +00:00
|
|
|
|
if( (mpModel == 0) || (mpPage == 0) )
|
2004-03-30 13:33:35 +00:00
|
|
|
|
throw lang::DisposedException();
|
|
|
|
|
|
|
2006-06-19 15:55:49 +00:00
|
|
|
|
return( (sal_Int32) mpPage->GetObjCount() );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
uno::Any SAL_CALL SvxDrawPage::getByIndex( sal_Int32 Index )
|
|
|
|
|
|
throw( lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
|
|
|
|
|
|
{
|
|
|
|
|
|
OGuard aGuard( Application::GetSolarMutex() );
|
|
|
|
|
|
|
2006-06-19 15:55:49 +00:00
|
|
|
|
if( (mpModel == 0) || (mpPage == 0) )
|
2004-03-30 13:33:35 +00:00
|
|
|
|
throw lang::DisposedException();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
2006-06-19 15:55:49 +00:00
|
|
|
|
if ( Index < 0 || Index >= (sal_Int32)mpPage->GetObjCount() )
|
2000-09-18 16:07:07 +00:00
|
|
|
|
throw lang::IndexOutOfBoundsException();
|
|
|
|
|
|
|
2006-06-19 15:55:49 +00:00
|
|
|
|
SdrObject* pObj = mpPage->GetObj( Index );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
if( pObj == NULL )
|
|
|
|
|
|
throw uno::RuntimeException();
|
|
|
|
|
|
|
2003-03-27 14:06:05 +00:00
|
|
|
|
|
|
|
|
|
|
return makeAny(Reference< drawing::XShape >( pObj->getUnoShape(), uno::UNO_QUERY ));
|
2000-09-18 16:07:07 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ::com::sun::star::container::XElementAccess
|
|
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
uno::Type SAL_CALL SvxDrawPage::getElementType()
|
|
|
|
|
|
throw( uno::RuntimeException )
|
|
|
|
|
|
{
|
|
|
|
|
|
return INTERFACE_TYPE( drawing::XShape );
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
sal_Bool SAL_CALL SvxDrawPage::hasElements()
|
|
|
|
|
|
throw( uno::RuntimeException )
|
|
|
|
|
|
{
|
2004-03-30 13:33:35 +00:00
|
|
|
|
OGuard aGuard( Application::GetSolarMutex() );
|
|
|
|
|
|
|
2006-06-19 15:55:49 +00:00
|
|
|
|
if( (mpModel == 0) || (mpPage == 0) )
|
2004-03-30 13:33:35 +00:00
|
|
|
|
throw lang::DisposedException();
|
|
|
|
|
|
|
2006-06-19 15:55:49 +00:00
|
|
|
|
return mpPage?(mpPage->GetObjCount()>0):sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2006-03-29 11:30:30 +00:00
|
|
|
|
namespace
|
|
|
|
|
|
{
|
|
|
|
|
|
void lcl_markSdrObjectOfShape( const Reference< drawing::XShape >& _rxShape, SdrView& _rView, SdrPageView& _rPageView )
|
|
|
|
|
|
{
|
|
|
|
|
|
SvxShape* pShape = SvxShape::getImplementation( _rxShape );
|
|
|
|
|
|
if ( !pShape )
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
SdrObject* pObj = pShape->GetSdrObject();
|
|
|
|
|
|
if ( !pObj )
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
_rView.MarkObj( pObj, &_rPageView );
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
// ACHTUNG: _SelectObjectsInView selektiert die ::com::sun::star::drawing::Shapes nur in der angegebennen
|
|
|
|
|
|
// SdrPageView. Dies mu<6D> nicht die sichtbare SdrPageView sein.
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
void SvxDrawPage::_SelectObjectsInView( const Reference< drawing::XShapes > & aShapes, SdrPageView* pPageView ) throw ()
|
|
|
|
|
|
{
|
|
|
|
|
|
DBG_ASSERT(pPageView,"SdrPageView ist NULL! [CL]");
|
2006-06-19 15:55:49 +00:00
|
|
|
|
DBG_ASSERT(mpView, "SdrView ist NULL! [CL]");
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
2006-06-19 15:55:49 +00:00
|
|
|
|
if(pPageView!=NULL && mpView!=NULL)
|
2000-09-18 16:07:07 +00:00
|
|
|
|
{
|
2006-06-19 15:55:49 +00:00
|
|
|
|
mpView->UnmarkAllObj( pPageView );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
|
|
|
long nCount = aShapes->getCount();
|
|
|
|
|
|
for( long i = 0; i < nCount; i++ )
|
|
|
|
|
|
{
|
|
|
|
|
|
uno::Any aAny( aShapes->getByIndex(i) );
|
|
|
|
|
|
Reference< drawing::XShape > xShape;
|
|
|
|
|
|
if( aAny >>= xShape )
|
2006-06-19 15:55:49 +00:00
|
|
|
|
lcl_markSdrObjectOfShape( xShape, *mpView, *pPageView );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
// ACHTUNG: _SelectObjectInView selektiert das Shape *nur* in der angegebennen
|
|
|
|
|
|
// SdrPageView. Dies mu<6D> nicht die sichtbare SdrPageView sein.
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
void SvxDrawPage::_SelectObjectInView( const Reference< drawing::XShape > & xShape, SdrPageView* pPageView ) throw()
|
|
|
|
|
|
{
|
|
|
|
|
|
DBG_ASSERT(pPageView,"SdrPageView ist NULL! [CL]");
|
2006-06-19 15:55:49 +00:00
|
|
|
|
DBG_ASSERT(mpView, "SdrView ist NULL! [CL]");
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
2006-06-19 15:55:49 +00:00
|
|
|
|
if(pPageView!=NULL && mpView != NULL)
|
2000-09-18 16:07:07 +00:00
|
|
|
|
{
|
2006-06-19 15:55:49 +00:00
|
|
|
|
mpView->UnmarkAllObj( pPageView );
|
|
|
|
|
|
lcl_markSdrObjectOfShape( xShape, *mpView, *pPageView );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
Reference< drawing::XShapeGroup > SAL_CALL SvxDrawPage::group( const Reference< drawing::XShapes >& xShapes )
|
|
|
|
|
|
throw( uno::RuntimeException )
|
|
|
|
|
|
{
|
|
|
|
|
|
OGuard aGuard( Application::GetSolarMutex() );
|
|
|
|
|
|
|
2006-06-19 15:55:49 +00:00
|
|
|
|
if( (mpModel == 0) || (mpPage == 0) )
|
2004-03-30 13:33:35 +00:00
|
|
|
|
throw lang::DisposedException();
|
|
|
|
|
|
|
2006-06-19 15:55:49 +00:00
|
|
|
|
DBG_ASSERT(mpPage,"SdrPage ist NULL! [CL]");
|
|
|
|
|
|
DBG_ASSERT(mpView, "SdrView ist NULL! [CL]");
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
|
|
|
Reference< ::com::sun::star::drawing::XShapeGroup > xShapeGroup;
|
2006-06-19 15:55:49 +00:00
|
|
|
|
if(mpPage==NULL||mpView==NULL||!xShapes.is())
|
2000-09-18 16:07:07 +00:00
|
|
|
|
return xShapeGroup;
|
|
|
|
|
|
|
2006-06-19 15:55:49 +00:00
|
|
|
|
SdrPageView* pPageView = mpView->ShowPage( mpPage, Point() );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
|
|
|
_SelectObjectsInView( xShapes, pPageView );
|
|
|
|
|
|
|
2006-06-19 15:55:49 +00:00
|
|
|
|
mpView->GroupMarked();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
2006-06-19 15:55:49 +00:00
|
|
|
|
mpView->AdjustMarkHdl();
|
|
|
|
|
|
const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
if( rMarkList.GetMarkCount() == 1 )
|
|
|
|
|
|
{
|
|
|
|
|
|
SdrObject* pObj = rMarkList.GetMark(0)->GetObj();
|
|
|
|
|
|
if( pObj )
|
2000-11-26 13:00:58 +00:00
|
|
|
|
xShapeGroup = Reference< drawing::XShapeGroup >::query( pObj->getUnoShape() );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2006-06-19 15:55:49 +00:00
|
|
|
|
mpView->HidePage(pPageView);
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
2006-06-19 15:55:49 +00:00
|
|
|
|
if( mpModel )
|
|
|
|
|
|
mpModel->SetChanged();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
|
|
|
return xShapeGroup;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
void SAL_CALL SvxDrawPage::ungroup( const Reference< drawing::XShapeGroup >& aGroup )
|
|
|
|
|
|
throw( uno::RuntimeException )
|
|
|
|
|
|
{
|
|
|
|
|
|
OGuard aGuard( Application::GetSolarMutex() );
|
|
|
|
|
|
|
2006-06-19 15:55:49 +00:00
|
|
|
|
if( (mpModel == 0) || (mpPage == 0) )
|
2004-03-30 13:33:35 +00:00
|
|
|
|
throw lang::DisposedException();
|
|
|
|
|
|
|
2006-06-19 15:55:49 +00:00
|
|
|
|
DBG_ASSERT(mpPage,"SdrPage ist NULL! [CL]");
|
|
|
|
|
|
DBG_ASSERT(mpView, "SdrView ist NULL! [CL]");
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
2006-06-19 15:55:49 +00:00
|
|
|
|
if(mpPage==NULL||mpView==NULL||!aGroup.is())
|
2000-09-18 16:07:07 +00:00
|
|
|
|
return;
|
|
|
|
|
|
|
2006-06-19 15:55:49 +00:00
|
|
|
|
SdrPageView* pPageView = mpView->ShowPage( mpPage, Point() );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
|
|
|
Reference< drawing::XShape > xShape( aGroup, UNO_QUERY );
|
|
|
|
|
|
_SelectObjectInView( xShape, pPageView );
|
2006-06-19 15:55:49 +00:00
|
|
|
|
mpView->UnGroupMarked();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
2006-06-19 15:55:49 +00:00
|
|
|
|
mpView->HidePage(pPageView);
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
2006-06-19 15:55:49 +00:00
|
|
|
|
if( mpModel )
|
|
|
|
|
|
mpModel->SetChanged();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
SdrObject *SvxDrawPage::_CreateSdrObject( const Reference< drawing::XShape > & xShape ) throw()
|
|
|
|
|
|
{
|
|
|
|
|
|
sal_uInt16 nType;
|
|
|
|
|
|
sal_uInt32 nInventor;
|
|
|
|
|
|
|
2002-07-19 11:35:02 +00:00
|
|
|
|
GetTypeAndInventor( nType, nInventor, xShape->getShapeType() );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
SdrObject* pNewObj = 0;
|
|
|
|
|
|
|
|
|
|
|
|
if( nType != 0 )
|
|
|
|
|
|
{
|
|
|
|
|
|
awt::Size aSize = xShape->getSize();
|
|
|
|
|
|
aSize.Width += 1;
|
|
|
|
|
|
aSize.Height += 1;
|
|
|
|
|
|
awt::Point aPos = xShape->getPosition();
|
|
|
|
|
|
Rectangle aRect( Point( aPos.X, aPos.Y ), Size( aSize.Width, aSize.Height ) );
|
|
|
|
|
|
|
2000-11-22 14:53:17 +00:00
|
|
|
|
// special cases
|
|
|
|
|
|
if( nInventor == SdrInventor )
|
2000-09-18 16:07:07 +00:00
|
|
|
|
{
|
2000-11-22 14:53:17 +00:00
|
|
|
|
switch( nType )
|
|
|
|
|
|
{
|
|
|
|
|
|
case OBJ_MEASURE:
|
|
|
|
|
|
pNewObj = new SdrMeasureObj( aRect.TopLeft(), aRect.BottomRight() );
|
|
|
|
|
|
break;
|
|
|
|
|
|
case OBJ_LINE:
|
|
|
|
|
|
pNewObj = new SdrPathObj( aRect.TopLeft(), aRect.BottomRight() );
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
}
|
2000-11-22 14:53:17 +00:00
|
|
|
|
|
|
|
|
|
|
if( pNewObj == NULL )
|
2006-06-19 15:55:49 +00:00
|
|
|
|
pNewObj = SdrObjFactory::MakeNewObject( nInventor, nType, mpPage );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
|
|
|
if(pNewObj)
|
|
|
|
|
|
{
|
|
|
|
|
|
pNewObj->SetSnapRect(aRect);
|
|
|
|
|
|
|
|
|
|
|
|
if( pNewObj->ISA(E3dPolyScene))
|
|
|
|
|
|
{
|
|
|
|
|
|
// Szene initialisieren
|
|
|
|
|
|
E3dScene* pScene = (E3dScene*)pNewObj;
|
|
|
|
|
|
|
|
|
|
|
|
double fW = (double)aSize.Width;
|
|
|
|
|
|
double fH = (double)aSize.Height;
|
|
|
|
|
|
|
|
|
|
|
|
Camera3D aCam(pScene->GetCamera());
|
|
|
|
|
|
aCam.SetAutoAdjustProjection(sal_False);
|
|
|
|
|
|
aCam.SetViewWindow(- fW / 2, - fH / 2, fW, fH);
|
|
|
|
|
|
Vector3D aLookAt;
|
|
|
|
|
|
Vector3D aCamPos(0.0, 0.0, 10000.0);
|
|
|
|
|
|
aCam.SetPosAndLookAt(aCamPos, aLookAt);
|
|
|
|
|
|
aCam.SetFocalLength(100.0);
|
|
|
|
|
|
aCam.SetDefaults(aCamPos, aLookAt, 10000.0);
|
|
|
|
|
|
pScene->SetCamera(aCam);
|
|
|
|
|
|
|
|
|
|
|
|
pScene->SetRectsDirty();
|
|
|
|
|
|
pScene->InitTransformationSet();
|
|
|
|
|
|
}
|
2000-12-07 14:22:53 +00:00
|
|
|
|
else if(pNewObj->ISA(E3dExtrudeObj))
|
|
|
|
|
|
{
|
|
|
|
|
|
E3dExtrudeObj* pObj = (E3dExtrudeObj*)pNewObj;
|
|
|
|
|
|
Polygon3D aNewP(3);
|
|
|
|
|
|
aNewP[0] = Vector3D(0,0,0);
|
|
|
|
|
|
aNewP[1] = Vector3D(0,1,0);
|
|
|
|
|
|
aNewP[2] = Vector3D(1,0,0);
|
2001-06-12 12:20:39 +00:00
|
|
|
|
|
|
|
|
|
|
// #87922#
|
|
|
|
|
|
// To avoid that CreateGeometry(...) sets the DoubleSided
|
|
|
|
|
|
// item at once, use a closed poylgon.
|
|
|
|
|
|
aNewP.SetClosed(TRUE);
|
|
|
|
|
|
|
2000-12-07 14:22:53 +00:00
|
|
|
|
PolyPolygon3D aNewPP(aNewP);
|
|
|
|
|
|
pObj->SetExtrudePolygon(aNewPP);
|
2003-03-27 14:06:05 +00:00
|
|
|
|
|
|
|
|
|
|
// #107245# pObj->SetExtrudeCharacterMode(TRUE);
|
2003-11-24 16:03:34 +00:00
|
|
|
|
pObj->SetMergedItem(Svx3DCharacterModeItem(sal_True));
|
2000-12-07 14:22:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
else if(pNewObj->ISA(E3dLatheObj))
|
|
|
|
|
|
{
|
|
|
|
|
|
E3dLatheObj* pObj = (E3dLatheObj*)pNewObj;
|
|
|
|
|
|
Polygon3D aNewP(3);
|
|
|
|
|
|
aNewP[0] = Vector3D(0,0,0);
|
|
|
|
|
|
aNewP[1] = Vector3D(0,1,0);
|
|
|
|
|
|
aNewP[2] = Vector3D(1,0,0);
|
2001-06-12 12:20:39 +00:00
|
|
|
|
|
|
|
|
|
|
// #87922#
|
|
|
|
|
|
// To avoid that CreateGeometry(...) sets the DoubleSided
|
|
|
|
|
|
// item at once, use a closed poylgon.
|
|
|
|
|
|
aNewP.SetClosed(TRUE);
|
|
|
|
|
|
|
2000-12-07 14:22:53 +00:00
|
|
|
|
PolyPolygon3D aNewPP(aNewP);
|
|
|
|
|
|
pObj->SetPolyPoly3D(aNewPP);
|
2003-03-27 14:06:05 +00:00
|
|
|
|
|
|
|
|
|
|
// #107245# pObj->SetLatheCharacterMode(TRUE);
|
2003-11-24 16:03:34 +00:00
|
|
|
|
pObj->SetMergedItem(Svx3DCharacterModeItem(sal_True));
|
2000-12-07 14:22:53 +00:00
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return pNewObj;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
void SvxDrawPage::GetTypeAndInventor( sal_uInt16& rType, sal_uInt32& rInventor, const OUString& aName ) const throw()
|
|
|
|
|
|
{
|
2000-11-17 09:14:03 +00:00
|
|
|
|
sal_uInt32 nTempType = aSdrShapeIdentifierMap.getId( aName );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
2000-11-17 09:14:03 +00:00
|
|
|
|
if(nTempType & E3D_INVENTOR_FLAG)
|
2000-09-18 16:07:07 +00:00
|
|
|
|
{
|
|
|
|
|
|
rInventor = E3dInventor;
|
2000-11-17 09:14:03 +00:00
|
|
|
|
rType = (sal_uInt16)(nTempType & ~E3D_INVENTOR_FLAG);
|
2000-09-18 16:07:07 +00:00
|
|
|
|
}
|
|
|
|
|
|
else
|
2000-11-17 09:14:03 +00:00
|
|
|
|
{
|
2000-09-18 16:07:07 +00:00
|
|
|
|
rInventor = SdrInventor;
|
2000-11-17 09:14:03 +00:00
|
|
|
|
rType = (sal_uInt16)nTempType;
|
2001-04-30 09:06:24 +00:00
|
|
|
|
|
|
|
|
|
|
switch( rType )
|
|
|
|
|
|
{
|
|
|
|
|
|
case OBJ_FRAME:
|
|
|
|
|
|
case OBJ_OLE2_PLUGIN:
|
|
|
|
|
|
case OBJ_OLE2_APPLET:
|
|
|
|
|
|
rType = OBJ_OLE2;
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
2000-11-17 09:14:03 +00:00
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2006-06-19 15:55:49 +00:00
|
|
|
|
SvxShape* SvxDrawPage::CreateShapeByTypeAndInventor( sal_uInt16 nType, sal_uInt32 nInventor, SdrObject *pObj, SvxDrawPage *mpPage ) throw()
|
2000-09-18 16:07:07 +00:00
|
|
|
|
{
|
|
|
|
|
|
SvxShape* pRet = NULL;
|
|
|
|
|
|
switch( nInventor )
|
|
|
|
|
|
{
|
|
|
|
|
|
case E3dInventor:
|
|
|
|
|
|
{
|
|
|
|
|
|
switch( nType )
|
|
|
|
|
|
{
|
2000-11-17 09:14:03 +00:00
|
|
|
|
case E3D_SCENE_ID :
|
2000-09-18 16:07:07 +00:00
|
|
|
|
case E3D_POLYSCENE_ID :
|
2006-06-19 15:55:49 +00:00
|
|
|
|
pRet = new Svx3DSceneObject( pObj, mpPage );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
break;
|
|
|
|
|
|
case E3D_CUBEOBJ_ID :
|
|
|
|
|
|
pRet = new Svx3DCubeObject( pObj );
|
|
|
|
|
|
break;
|
|
|
|
|
|
case E3D_SPHEREOBJ_ID :
|
|
|
|
|
|
pRet = new Svx3DSphereObject( pObj );
|
|
|
|
|
|
break;
|
|
|
|
|
|
case E3D_LATHEOBJ_ID :
|
|
|
|
|
|
pRet = new Svx3DLatheObject( pObj );
|
|
|
|
|
|
break;
|
|
|
|
|
|
case E3D_EXTRUDEOBJ_ID :
|
|
|
|
|
|
pRet = new Svx3DExtrudeObject( pObj );
|
|
|
|
|
|
break;
|
|
|
|
|
|
case E3D_POLYGONOBJ_ID :
|
|
|
|
|
|
pRet = new Svx3DPolygonObject( pObj );
|
|
|
|
|
|
break;
|
|
|
|
|
|
default: // unbekanntes 3D-Objekt auf der Page
|
|
|
|
|
|
pRet = new SvxShape( pObj );
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
case SdrInventor:
|
|
|
|
|
|
{
|
|
|
|
|
|
switch( nType )
|
|
|
|
|
|
{
|
|
|
|
|
|
// case OBJ_NONE:
|
|
|
|
|
|
// break;
|
|
|
|
|
|
case OBJ_GRUP:
|
2006-06-19 15:55:49 +00:00
|
|
|
|
pRet = new SvxShapeGroup( pObj, mpPage );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
break;
|
|
|
|
|
|
case OBJ_LINE:
|
|
|
|
|
|
pRet = new SvxShapePolyPolygon( pObj , PolygonKind_LINE );
|
|
|
|
|
|
break;
|
|
|
|
|
|
case OBJ_RECT:
|
|
|
|
|
|
pRet = new SvxShapeRect( pObj );
|
|
|
|
|
|
break;
|
|
|
|
|
|
case OBJ_CIRC:
|
|
|
|
|
|
case OBJ_SECT:
|
|
|
|
|
|
case OBJ_CARC:
|
|
|
|
|
|
case OBJ_CCUT:
|
|
|
|
|
|
pRet = new SvxShapeCircle( pObj );
|
|
|
|
|
|
break;
|
|
|
|
|
|
case OBJ_POLY:
|
|
|
|
|
|
pRet = new SvxShapePolyPolygon( pObj , PolygonKind_POLY );
|
|
|
|
|
|
break;
|
|
|
|
|
|
case OBJ_PLIN:
|
|
|
|
|
|
pRet = new SvxShapePolyPolygon( pObj , PolygonKind_PLIN );
|
|
|
|
|
|
break;
|
|
|
|
|
|
case OBJ_SPLNLINE:
|
|
|
|
|
|
case OBJ_PATHLINE:
|
|
|
|
|
|
pRet = new SvxShapePolyPolygonBezier( pObj , PolygonKind_PATHLINE );
|
|
|
|
|
|
break;
|
|
|
|
|
|
case OBJ_SPLNFILL:
|
|
|
|
|
|
case OBJ_PATHFILL:
|
|
|
|
|
|
pRet = new SvxShapePolyPolygonBezier( pObj , PolygonKind_PATHFILL );
|
|
|
|
|
|
break;
|
|
|
|
|
|
case OBJ_FREELINE:
|
|
|
|
|
|
pRet = new SvxShapePolyPolygonBezier( pObj , PolygonKind_FREELINE );
|
|
|
|
|
|
break;
|
|
|
|
|
|
case OBJ_FREEFILL:
|
|
|
|
|
|
pRet = new SvxShapePolyPolygonBezier( pObj , PolygonKind_FREEFILL );
|
|
|
|
|
|
break;
|
2001-05-07 13:25:20 +00:00
|
|
|
|
case OBJ_CAPTION:
|
|
|
|
|
|
pRet = new SvxShapeCaption( pObj );
|
|
|
|
|
|
break;
|
2001-09-28 13:57:46 +00:00
|
|
|
|
case OBJ_TITLETEXT:
|
|
|
|
|
|
case OBJ_OUTLINETEXT:
|
2000-09-18 16:07:07 +00:00
|
|
|
|
case OBJ_TEXT:
|
2001-07-10 06:53:54 +00:00
|
|
|
|
pRet = new SvxShapeText( pObj );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
break;
|
|
|
|
|
|
case OBJ_GRAF:
|
|
|
|
|
|
pRet = new SvxGraphicObject( pObj );
|
|
|
|
|
|
break;
|
2001-04-30 09:06:24 +00:00
|
|
|
|
case OBJ_FRAME:
|
|
|
|
|
|
#ifndef SVX_LIGHT
|
|
|
|
|
|
pRet = new SvxFrameShape( pObj );
|
|
|
|
|
|
break;
|
|
|
|
|
|
#endif
|
|
|
|
|
|
case OBJ_OLE2_APPLET:
|
|
|
|
|
|
#ifndef SVX_LIGHT
|
|
|
|
|
|
pRet = new SvxAppletShape( pObj );
|
|
|
|
|
|
break;
|
|
|
|
|
|
#endif
|
|
|
|
|
|
case OBJ_OLE2_PLUGIN:
|
|
|
|
|
|
#ifndef SVX_LIGHT
|
|
|
|
|
|
pRet = new SvxPluginShape( pObj );
|
|
|
|
|
|
break;
|
|
|
|
|
|
#endif
|
2000-09-18 16:07:07 +00:00
|
|
|
|
case OBJ_OLE2:
|
2001-04-30 09:06:24 +00:00
|
|
|
|
{
|
|
|
|
|
|
#ifndef SVX_LIGHT
|
2006-06-19 15:55:49 +00:00
|
|
|
|
if( pObj && !pObj->IsEmptyPresObj() && mpPage )
|
2001-04-30 09:06:24 +00:00
|
|
|
|
{
|
2006-06-19 15:55:49 +00:00
|
|
|
|
SfxObjectShell *pPersist = mpPage->GetSdrPage()->GetModel()->GetPersist();
|
2002-01-11 08:28:06 +00:00
|
|
|
|
if( pPersist )
|
2001-04-30 09:06:24 +00:00
|
|
|
|
{
|
2004-10-04 16:56:20 +00:00
|
|
|
|
uno::Reference < embed::XEmbeddedObject > xObject = pPersist->GetEmbeddedObjectContainer().
|
|
|
|
|
|
GetEmbeddedObject( static_cast< SdrOle2Obj* >( pObj )->GetPersistName() );
|
2001-10-05 07:58:08 +00:00
|
|
|
|
|
2004-10-04 16:56:20 +00:00
|
|
|
|
// TODO CL->KA: Why is this not working anymore?
|
|
|
|
|
|
if( xObject.is() )
|
2001-10-05 07:58:08 +00:00
|
|
|
|
{
|
2004-10-04 16:56:20 +00:00
|
|
|
|
SvGlobalName aClassId( xObject->getClassID() );
|
2002-01-11 08:28:06 +00:00
|
|
|
|
|
|
|
|
|
|
const SvGlobalName aAppletClassId( SO3_APPLET_CLASSID );
|
|
|
|
|
|
const SvGlobalName aPluginClassId( SO3_PLUGIN_CLASSID );
|
|
|
|
|
|
const SvGlobalName aIFrameClassId( SO3_IFRAME_CLASSID );
|
|
|
|
|
|
|
|
|
|
|
|
if( aPluginClassId == aClassId )
|
|
|
|
|
|
{
|
|
|
|
|
|
pRet = new SvxPluginShape( pObj );
|
|
|
|
|
|
nType = OBJ_OLE2_PLUGIN;
|
|
|
|
|
|
}
|
|
|
|
|
|
else if( aAppletClassId == aClassId )
|
|
|
|
|
|
{
|
|
|
|
|
|
pRet = new SvxAppletShape( pObj );
|
|
|
|
|
|
nType = OBJ_OLE2_APPLET;
|
|
|
|
|
|
}
|
|
|
|
|
|
else if( aIFrameClassId == aClassId )
|
|
|
|
|
|
{
|
|
|
|
|
|
pRet = new SvxFrameShape( pObj );
|
|
|
|
|
|
nType = OBJ_FRAME;
|
|
|
|
|
|
}
|
2001-10-05 07:58:08 +00:00
|
|
|
|
}
|
2001-04-30 09:06:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
#endif
|
|
|
|
|
|
if( pRet == NULL )
|
|
|
|
|
|
{
|
|
|
|
|
|
pRet = new SvxOle2Shape( pObj, ImplGetSvxOle2PropertyMap() );
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
case OBJ_EDGE:
|
|
|
|
|
|
pRet = new SvxShapeConnector( pObj );
|
|
|
|
|
|
break;
|
|
|
|
|
|
case OBJ_PATHPOLY:
|
|
|
|
|
|
pRet = new SvxShapePolyPolygon( pObj , PolygonKind_PATHPOLY );
|
|
|
|
|
|
break;
|
|
|
|
|
|
case OBJ_PATHPLIN:
|
|
|
|
|
|
pRet = new SvxShapePolyPolygon( pObj , PolygonKind_PATHPLIN );
|
|
|
|
|
|
break;
|
|
|
|
|
|
case OBJ_PAGE:
|
2000-12-06 11:00:46 +00:00
|
|
|
|
pRet = new SvxShape( pObj, ImplGetSvxPageShapePropertyMap() );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
break;
|
|
|
|
|
|
case OBJ_MEASURE:
|
|
|
|
|
|
pRet = new SvxShapeDimensioning( pObj );
|
|
|
|
|
|
break;
|
|
|
|
|
|
// case OBJ_DUMMY:
|
|
|
|
|
|
// break;
|
|
|
|
|
|
case OBJ_UNO:
|
|
|
|
|
|
pRet = new SvxShapeControl( pObj );
|
|
|
|
|
|
break;
|
2004-04-02 13:17:16 +00:00
|
|
|
|
case OBJ_CUSTOMSHAPE:
|
|
|
|
|
|
pRet = new SvxCustomShape( pObj );
|
|
|
|
|
|
break;
|
2004-08-12 08:06:18 +00:00
|
|
|
|
case OBJ_MEDIA:
|
|
|
|
|
|
pRet = new SvxMediaShape( pObj );
|
|
|
|
|
|
break;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
default: // unbekanntes 2D-Objekt auf der Page
|
|
|
|
|
|
DBG_ERROR("Nicht implementierter Starone-Shape erzeugt! [CL]");
|
2001-07-10 06:53:54 +00:00
|
|
|
|
pRet = new SvxShapeText( pObj );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
default: // Unbekannter Inventor
|
|
|
|
|
|
{
|
|
|
|
|
|
DBG_ERROR("AW: Unknown Inventor in SvxDrawPage::_CreateShape()");
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(pRet)
|
|
|
|
|
|
{
|
|
|
|
|
|
sal_uInt32 nObjId = nType;
|
|
|
|
|
|
|
|
|
|
|
|
if( nInventor == E3dInventor )
|
|
|
|
|
|
nObjId |= E3D_INVENTOR_FLAG;
|
|
|
|
|
|
|
|
|
|
|
|
switch(nObjId)
|
|
|
|
|
|
{
|
|
|
|
|
|
case OBJ_CCUT: // Kreisabschnitt
|
|
|
|
|
|
case OBJ_CARC: // Kreisbogen
|
|
|
|
|
|
case OBJ_SECT: // Kreissektor
|
|
|
|
|
|
nObjId = OBJ_CIRC;
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
2000-11-17 09:14:03 +00:00
|
|
|
|
case E3D_SCENE_ID | E3D_INVENTOR_FLAG:
|
|
|
|
|
|
nObjId = E3D_POLYSCENE_ID | E3D_INVENTOR_FLAG;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
break;
|
2001-09-28 13:57:46 +00:00
|
|
|
|
|
|
|
|
|
|
case OBJ_TITLETEXT:
|
|
|
|
|
|
case OBJ_OUTLINETEXT:
|
|
|
|
|
|
nObjId = OBJ_TEXT;
|
|
|
|
|
|
break;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2002-07-19 11:35:02 +00:00
|
|
|
|
pRet->setShapeKind(nObjId);
|
2000-09-18 16:07:07 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return pRet;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
Reference< drawing::XShape > SvxDrawPage::_CreateShape( SdrObject *pObj ) const throw()
|
|
|
|
|
|
{
|
2000-11-26 13:00:58 +00:00
|
|
|
|
Reference< drawing::XShape > xShape( CreateShapeByTypeAndInventor(pObj->GetObjIdentifier(),
|
2000-09-18 16:07:07 +00:00
|
|
|
|
pObj->GetObjInventor(),
|
|
|
|
|
|
pObj,
|
2000-11-26 13:00:58 +00:00
|
|
|
|
(SvxDrawPage*)this));
|
2000-09-18 16:07:07 +00:00
|
|
|
|
return xShape;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
SdrObject *SvxDrawPage::CreateSdrObject( const Reference< drawing::XShape > & xShape ) throw()
|
|
|
|
|
|
{
|
|
|
|
|
|
SdrObject* pObj = _CreateSdrObject( xShape );
|
|
|
|
|
|
if( pObj && !pObj->IsInserted() )
|
2006-06-19 15:55:49 +00:00
|
|
|
|
mpPage->InsertObject( pObj );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
|
|
|
return pObj;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
// ::com::sun::star::lang::XServiceInfo
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
OUString SAL_CALL SvxDrawPage::getImplementationName() throw( uno::RuntimeException )
|
|
|
|
|
|
{
|
|
|
|
|
|
return OUString( RTL_CONSTASCII_USTRINGPARAM("SvxDrawPage"));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
sal_Bool SAL_CALL SvxDrawPage::supportsService( const OUString& ServiceName )
|
|
|
|
|
|
throw(::com::sun::star::uno::RuntimeException)
|
|
|
|
|
|
{
|
|
|
|
|
|
return SvxServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() );
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
uno::Sequence< OUString > SAL_CALL SvxDrawPage::getSupportedServiceNames() throw( uno::RuntimeException )
|
|
|
|
|
|
{
|
|
|
|
|
|
uno::Sequence< OUString > aSeq( 1 );
|
|
|
|
|
|
aSeq.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.ShapeCollection" ));
|
|
|
|
|
|
return aSeq;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SvxShape* CreateSvxShapeByTypeAndInventor( sal_uInt16 nType, sal_uInt32 nInventor ) throw()
|
|
|
|
|
|
{
|
|
|
|
|
|
return SvxDrawPage::CreateShapeByTypeAndInventor( nType, nInventor );
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2005-10-19 11:12:25 +00:00
|
|
|
|
void SvxDrawPage::ChangeModel( SdrModel* pNewModel )
|
|
|
|
|
|
{
|
2006-06-19 15:55:49 +00:00
|
|
|
|
if( pNewModel != mpModel )
|
2005-10-19 11:12:25 +00:00
|
|
|
|
{
|
2006-06-19 15:55:49 +00:00
|
|
|
|
if( mpModel )
|
|
|
|
|
|
EndListening( *mpModel );
|
2005-10-19 11:12:25 +00:00
|
|
|
|
|
|
|
|
|
|
if( pNewModel )
|
|
|
|
|
|
StartListening( *pNewModel );
|
|
|
|
|
|
|
2006-06-19 15:55:49 +00:00
|
|
|
|
mpModel = pNewModel;
|
2005-10-19 11:12:25 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|