2000-09-18 11:07:07 -05:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-10 16:53:06 -05:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2000-09-18 11:07:07 -05:00
|
|
|
*
|
2010-02-12 08:01:35 -06:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2000-09-18 11:07:07 -05:00
|
|
|
*
|
2008-04-10 16:53:06 -05:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2000-09-18 11:07:07 -05:00
|
|
|
*
|
2008-04-10 16:53:06 -05:00
|
|
|
* This file is part of OpenOffice.org.
|
2000-09-18 11:07:07 -05:00
|
|
|
*
|
2008-04-10 16:53:06 -05:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2000-09-18 11:07:07 -05:00
|
|
|
*
|
2008-04-10 16:53:06 -05:00
|
|
|
* OpenOffice.org 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 version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2000-09-18 11:07:07 -05:00
|
|
|
*
|
2008-04-10 16:53:06 -05:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2000-09-18 11:07:07 -05:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
2006-09-16 13:27:51 -05:00
|
|
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
|
|
|
#include "precompiled_sd.hxx"
|
2001-02-26 08:27:47 -06:00
|
|
|
#include <com/sun/star/drawing/BitmapMode.hpp>
|
2000-09-18 11:07:07 -05:00
|
|
|
#include <vos/mutex.hxx>
|
|
|
|
#include <vcl/svapp.hxx>
|
2009-10-15 17:05:16 -05:00
|
|
|
#include <svl/itemset.hxx>
|
2009-12-10 11:09:38 -06:00
|
|
|
#include <svx/svdpool.hxx>
|
2001-03-19 02:53:25 -06:00
|
|
|
#include <comphelper/extract.hxx>
|
2000-09-18 11:07:07 -05:00
|
|
|
#include <rtl/uuid.h>
|
|
|
|
#include <rtl/memory.h>
|
2000-12-20 08:58:39 -06:00
|
|
|
#include <svx/xflbstit.hxx>
|
|
|
|
#include <svx/xflbmtit.hxx>
|
2000-09-18 11:07:07 -05:00
|
|
|
#include <svx/svdobj.hxx>
|
|
|
|
#include <svx/unoprov.hxx>
|
2000-12-05 15:38:10 -06:00
|
|
|
#include <svx/unoshape.hxx>
|
2010-01-08 11:32:51 -06:00
|
|
|
#include <comphelper/serviceinfohelper.hxx>
|
2000-09-18 11:07:07 -05:00
|
|
|
|
|
|
|
#include "unopback.hxx"
|
|
|
|
#include "unohelp.hxx"
|
|
|
|
#include "drawdoc.hxx"
|
|
|
|
#include "unokywds.hxx"
|
|
|
|
|
|
|
|
using namespace ::rtl;
|
|
|
|
using namespace ::vos;
|
|
|
|
using namespace ::com::sun::star;
|
|
|
|
|
2009-06-03 06:26:39 -05:00
|
|
|
const SvxItemPropertySet* ImplGetPageBackgroundPropertySet()
|
2000-09-18 11:07:07 -05:00
|
|
|
{
|
2009-06-03 06:26:39 -05:00
|
|
|
static const SfxItemPropertyMapEntry aPageBackgroundPropertyMap_Impl[] =
|
2000-09-18 11:07:07 -05:00
|
|
|
{
|
|
|
|
FILL_PROPERTIES
|
2006-12-12 12:02:01 -06:00
|
|
|
{0,0,0,0,0,0}
|
2000-09-18 11:07:07 -05:00
|
|
|
};
|
|
|
|
|
2009-12-10 11:09:38 -06:00
|
|
|
static SvxItemPropertySet aPageBackgroundPropertySet_Impl( aPageBackgroundPropertyMap_Impl, SdrObject::GetGlobalDrawObjectItemPool() );
|
2009-06-03 06:26:39 -05:00
|
|
|
return &aPageBackgroundPropertySet_Impl;
|
2000-09-18 11:07:07 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
UNO3_GETIMPLEMENTATION_IMPL( SdUnoPageBackground );
|
|
|
|
|
|
|
|
SdUnoPageBackground::SdUnoPageBackground( SdDrawDocument* pDoc /* = NULL */, SdrObject* pObj /* = NULL */ ) throw()
|
2009-06-03 06:26:39 -05:00
|
|
|
: mpPropSet( ImplGetPageBackgroundPropertySet() ), mpSet( NULL ), mpDoc( pDoc )
|
2000-09-18 11:07:07 -05:00
|
|
|
{
|
2000-11-08 04:21:55 -06:00
|
|
|
if( pDoc )
|
2000-09-18 11:07:07 -05:00
|
|
|
{
|
2000-09-29 06:52:40 -05:00
|
|
|
StartListening( *pDoc );
|
2004-11-03 01:58:13 -06:00
|
|
|
mpSet = new SfxItemSet( pDoc->GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST );
|
2000-10-30 04:50:43 -06:00
|
|
|
|
2000-11-08 04:21:55 -06:00
|
|
|
if( pObj )
|
2003-11-24 10:17:36 -06:00
|
|
|
mpSet->Put(pObj->GetMergedItemSet());
|
2000-09-18 11:07:07 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-12-05 15:38:10 -06:00
|
|
|
SdUnoPageBackground::SdUnoPageBackground( SdDrawDocument* pDoc, const SfxItemSet* pSet ) throw()
|
2009-06-03 06:26:39 -05:00
|
|
|
: mpPropSet( ImplGetPageBackgroundPropertySet() ), mpSet( NULL ), mpDoc( pDoc )
|
2000-12-05 15:38:10 -06:00
|
|
|
{
|
|
|
|
if( pDoc )
|
|
|
|
{
|
|
|
|
StartListening( *pDoc );
|
2004-11-03 01:58:13 -06:00
|
|
|
mpSet = new SfxItemSet( pDoc->GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST );
|
2000-12-05 15:38:10 -06:00
|
|
|
|
|
|
|
if( pSet )
|
|
|
|
mpSet->Put(*pSet);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-09-18 11:07:07 -05:00
|
|
|
SdUnoPageBackground::~SdUnoPageBackground() throw()
|
|
|
|
{
|
2000-09-29 06:52:40 -05:00
|
|
|
if( mpDoc )
|
|
|
|
EndListening( *mpDoc );
|
|
|
|
|
2000-09-18 11:07:07 -05:00
|
|
|
if( mpSet )
|
|
|
|
delete mpSet;
|
|
|
|
}
|
|
|
|
|
2006-12-12 12:02:01 -06:00
|
|
|
void SdUnoPageBackground::Notify( SfxBroadcaster&, const SfxHint& rHint )
|
2000-09-29 06:52:40 -05:00
|
|
|
{
|
|
|
|
const SdrHint* pSdrHint = PTR_CAST( SdrHint, &rHint );
|
|
|
|
|
|
|
|
if( pSdrHint )
|
|
|
|
{
|
|
|
|
// delete item set if document is dying because then the pool
|
|
|
|
// will also die
|
|
|
|
if( pSdrHint->GetKind() == HINT_MODELCLEARED )
|
|
|
|
{
|
|
|
|
delete mpSet;
|
|
|
|
mpSet = NULL;
|
|
|
|
mpDoc = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void SdUnoPageBackground::fillItemSet( SdDrawDocument* pDoc, SfxItemSet& rSet ) throw()
|
2000-09-18 11:07:07 -05:00
|
|
|
{
|
|
|
|
rSet.ClearItem();
|
|
|
|
|
|
|
|
if( mpSet == NULL )
|
|
|
|
{
|
2000-09-29 06:52:40 -05:00
|
|
|
StartListening( *pDoc );
|
|
|
|
mpDoc = pDoc;
|
|
|
|
|
2000-09-18 11:07:07 -05:00
|
|
|
mpSet = new SfxItemSet( *rSet.GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST );
|
|
|
|
|
2009-06-03 06:26:39 -05:00
|
|
|
if( mpPropSet->AreThereOwnUsrAnys() )
|
2000-09-18 11:07:07 -05:00
|
|
|
{
|
|
|
|
uno::Any* pAny;
|
2009-06-03 06:26:39 -05:00
|
|
|
PropertyEntryVector_t aProperties = mpPropSet->getPropertyMap()->getPropertyEntries();
|
|
|
|
PropertyEntryVector_t::const_iterator aIt = aProperties.begin();
|
2009-06-22 08:21:25 -05:00
|
|
|
|
2009-06-03 06:26:39 -05:00
|
|
|
while( aIt != aProperties.end() )
|
2000-09-18 11:07:07 -05:00
|
|
|
{
|
2009-06-03 06:26:39 -05:00
|
|
|
pAny = mpPropSet->GetUsrAnyForID( aIt->nWID );
|
2000-09-18 11:07:07 -05:00
|
|
|
if( pAny )
|
|
|
|
{
|
2009-06-22 08:21:25 -05:00
|
|
|
OUString aPropertyName( aIt->sName );
|
|
|
|
switch( aIt->nWID )
|
2008-01-10 05:22:59 -06:00
|
|
|
{
|
2009-06-17 05:58:14 -05:00
|
|
|
case XATTR_FILLFLOATTRANSPARENCE :
|
|
|
|
case XATTR_FILLGRADIENT :
|
2008-01-10 05:22:59 -06:00
|
|
|
{
|
2009-06-17 05:58:14 -05:00
|
|
|
if ( ( pAny->getValueType() == ::getCppuType((const ::com::sun::star::awt::Gradient*)0) )
|
2009-06-22 08:21:25 -05:00
|
|
|
&& ( aIt->nMemberId == MID_FILLGRADIENT ) )
|
2009-06-17 05:58:14 -05:00
|
|
|
{
|
|
|
|
setPropertyValue( aPropertyName, *pAny );
|
|
|
|
}
|
|
|
|
else if ( ( pAny->getValueType() == ::getCppuType((const ::rtl::OUString*)0) ) &&
|
2009-06-22 08:21:25 -05:00
|
|
|
( aIt->nMemberId == MID_NAME ) )
|
2009-06-17 05:58:14 -05:00
|
|
|
{
|
|
|
|
setPropertyValue( aPropertyName, *pAny );
|
|
|
|
}
|
2008-01-10 05:22:59 -06:00
|
|
|
}
|
2009-06-17 05:58:14 -05:00
|
|
|
break;
|
|
|
|
case XATTR_FILLHATCH :
|
2008-01-10 05:22:59 -06:00
|
|
|
{
|
2009-06-17 05:58:14 -05:00
|
|
|
if ( ( pAny->getValueType() == ::getCppuType((const ::com::sun::star::drawing::Hatch*)0) )
|
2009-06-22 08:21:25 -05:00
|
|
|
&& ( aIt->nMemberId == MID_FILLHATCH ) )
|
2009-06-17 05:58:14 -05:00
|
|
|
{
|
|
|
|
setPropertyValue( aPropertyName, *pAny );
|
|
|
|
}
|
|
|
|
else if ( ( pAny->getValueType() == ::getCppuType((const ::rtl::OUString*)0) ) &&
|
2009-06-22 08:21:25 -05:00
|
|
|
( aIt->nMemberId == MID_NAME ) )
|
2009-06-17 05:58:14 -05:00
|
|
|
{
|
|
|
|
setPropertyValue( aPropertyName, *pAny );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case XATTR_FILLBITMAP :
|
|
|
|
{
|
|
|
|
if ( ( ( pAny->getValueType() == ::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap >*)0) ) ||
|
|
|
|
( pAny->getValueType() == ::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >*)0) ) ) &&
|
2009-06-22 08:21:25 -05:00
|
|
|
( aIt->nMemberId == MID_BITMAP ) )
|
2009-06-17 05:58:14 -05:00
|
|
|
{
|
|
|
|
setPropertyValue( aPropertyName, *pAny );
|
|
|
|
}
|
|
|
|
else if ( ( pAny->getValueType() == ::getCppuType((const ::rtl::OUString*)0) ) &&
|
2009-06-22 08:21:25 -05:00
|
|
|
( ( aIt->nMemberId == MID_NAME ) || ( aIt->nMemberId == MID_GRAFURL ) ) )
|
2009-06-17 05:58:14 -05:00
|
|
|
{
|
|
|
|
setPropertyValue( aPropertyName, *pAny );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
setPropertyValue( aPropertyName, *pAny );
|
2008-01-10 05:22:59 -06:00
|
|
|
}
|
2009-06-22 08:50:27 -05:00
|
|
|
}
|
|
|
|
++aIt;
|
2009-09-09 04:19:53 -05:00
|
|
|
}
|
2000-09-18 11:07:07 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
rSet.Put( *mpSet );
|
|
|
|
}
|
|
|
|
|
|
|
|
// XServiceInfo
|
|
|
|
OUString SAL_CALL SdUnoPageBackground::getImplementationName()
|
|
|
|
throw(uno::RuntimeException)
|
|
|
|
{
|
|
|
|
return OUString::createFromAscii( sUNO_SdUnoPageBackground );
|
|
|
|
}
|
|
|
|
|
|
|
|
sal_Bool SAL_CALL SdUnoPageBackground::supportsService( const OUString& ServiceName )
|
|
|
|
throw(uno::RuntimeException)
|
|
|
|
{
|
2010-01-08 11:32:51 -06:00
|
|
|
return comphelper::ServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() );
|
2000-09-18 11:07:07 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
uno::Sequence< OUString > SAL_CALL SdUnoPageBackground::getSupportedServiceNames()
|
|
|
|
throw(uno::RuntimeException)
|
|
|
|
{
|
|
|
|
uno::Sequence< OUString > aNameSequence( 2 );
|
|
|
|
OUString* pStrings = aNameSequence.getArray();
|
|
|
|
|
2001-03-06 10:44:18 -06:00
|
|
|
*pStrings++ = OUString( RTL_CONSTASCII_USTRINGPARAM( sUNO_Service_PageBackground ) );
|
|
|
|
*pStrings = OUString( RTL_CONSTASCII_USTRINGPARAM( sUNO_Service_FillProperties ) );
|
2000-09-18 11:07:07 -05:00
|
|
|
|
|
|
|
return aNameSequence;
|
|
|
|
}
|
|
|
|
|
|
|
|
// XPropertySet
|
|
|
|
uno::Reference< beans::XPropertySetInfo > SAL_CALL SdUnoPageBackground::getPropertySetInfo()
|
|
|
|
throw(uno::RuntimeException)
|
|
|
|
{
|
2009-06-03 06:26:39 -05:00
|
|
|
return mpPropSet->getPropertySetInfo();
|
2000-09-18 11:07:07 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void SAL_CALL SdUnoPageBackground::setPropertyValue( const OUString& aPropertyName, const uno::Any& aValue )
|
|
|
|
throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
|
|
|
|
{
|
|
|
|
OGuard aGuard( Application::GetSolarMutex() );
|
|
|
|
|
2009-06-03 06:26:39 -05:00
|
|
|
const SfxItemPropertySimpleEntry* pEntry = getPropertyMapEntry( aPropertyName );
|
2000-09-18 11:07:07 -05:00
|
|
|
|
2009-06-03 06:26:39 -05:00
|
|
|
if( pEntry == NULL )
|
2000-09-18 11:07:07 -05:00
|
|
|
{
|
|
|
|
throw beans::UnknownPropertyException();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if( mpSet )
|
|
|
|
{
|
2009-06-03 06:26:39 -05:00
|
|
|
if( pEntry->nWID == OWN_ATTR_FILLBMP_MODE )
|
2000-12-20 08:58:39 -06:00
|
|
|
{
|
2001-02-26 08:27:47 -06:00
|
|
|
drawing::BitmapMode eMode;
|
|
|
|
if( aValue >>= eMode )
|
2000-12-20 08:58:39 -06:00
|
|
|
{
|
2001-02-26 08:27:47 -06:00
|
|
|
mpSet->Put( XFillBmpStretchItem( eMode == drawing::BitmapMode_STRETCH ) );
|
|
|
|
mpSet->Put( XFillBmpTileItem( eMode == drawing::BitmapMode_REPEAT ) );
|
2000-12-20 08:58:39 -06:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
throw lang::IllegalArgumentException();
|
|
|
|
}
|
|
|
|
|
2000-09-18 11:07:07 -05:00
|
|
|
SfxItemPool& rPool = *mpSet->GetPool();
|
2009-06-03 06:26:39 -05:00
|
|
|
SfxItemSet aSet( rPool, pEntry->nWID, pEntry->nWID);
|
2000-09-18 11:07:07 -05:00
|
|
|
aSet.Put( *mpSet );
|
|
|
|
|
|
|
|
if( !aSet.Count() )
|
2009-06-03 06:26:39 -05:00
|
|
|
aSet.Put( rPool.GetDefaultItem( pEntry->nWID ) );
|
2000-09-18 11:07:07 -05:00
|
|
|
|
2009-06-03 06:26:39 -05:00
|
|
|
if( pEntry->nMemberId == MID_NAME && ( pEntry->nWID == XATTR_FILLBITMAP || pEntry->nWID == XATTR_FILLGRADIENT || pEntry->nWID == XATTR_FILLHATCH || pEntry->nWID == XATTR_FILLFLOATTRANSPARENCE ) )
|
2000-12-05 15:38:10 -06:00
|
|
|
{
|
|
|
|
OUString aName;
|
|
|
|
if(!(aValue >>= aName ))
|
|
|
|
throw lang::IllegalArgumentException();
|
|
|
|
|
2009-06-03 06:26:39 -05:00
|
|
|
SvxShape::SetFillAttribute( pEntry->nWID, aName, aSet );
|
2000-12-05 15:38:10 -06:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-01-22 11:23:36 -06:00
|
|
|
SvxItemPropertySet_setPropertyValue( *mpPropSet, pEntry, aValue, aSet );
|
2000-12-05 15:38:10 -06:00
|
|
|
}
|
|
|
|
|
2000-09-18 11:07:07 -05:00
|
|
|
mpSet->Put( aSet );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-06-03 06:26:39 -05:00
|
|
|
if(pEntry && pEntry->nWID)
|
|
|
|
mpPropSet->setPropertyValue( pEntry, aValue );
|
2000-09-18 11:07:07 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
uno::Any SAL_CALL SdUnoPageBackground::getPropertyValue( const OUString& PropertyName )
|
|
|
|
throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
|
|
|
|
{
|
|
|
|
OGuard aGuard( Application::GetSolarMutex() );
|
|
|
|
|
|
|
|
uno::Any aAny;
|
2009-06-03 06:26:39 -05:00
|
|
|
const SfxItemPropertySimpleEntry* pEntry = getPropertyMapEntry(PropertyName);
|
2000-09-18 11:07:07 -05:00
|
|
|
|
2009-06-03 06:26:39 -05:00
|
|
|
if( pEntry == NULL )
|
2000-09-18 11:07:07 -05:00
|
|
|
{
|
|
|
|
throw beans::UnknownPropertyException();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if( mpSet )
|
|
|
|
{
|
2009-06-03 06:26:39 -05:00
|
|
|
if( pEntry->nWID == OWN_ATTR_FILLBMP_MODE )
|
2000-12-20 08:58:39 -06:00
|
|
|
{
|
|
|
|
XFillBmpStretchItem* pStretchItem = (XFillBmpStretchItem*)mpSet->GetItem(XATTR_FILLBMP_STRETCH);
|
|
|
|
XFillBmpTileItem* pTileItem = (XFillBmpTileItem*)mpSet->GetItem(XATTR_FILLBMP_TILE);
|
2000-09-18 11:07:07 -05:00
|
|
|
|
2000-12-20 08:58:39 -06:00
|
|
|
if( pStretchItem && pTileItem )
|
|
|
|
{
|
|
|
|
if( pTileItem->GetValue() )
|
2001-02-26 08:27:47 -06:00
|
|
|
aAny <<= drawing::BitmapMode_REPEAT;
|
2000-12-20 08:58:39 -06:00
|
|
|
else if( pStretchItem->GetValue() )
|
2001-02-26 08:27:47 -06:00
|
|
|
aAny <<= drawing::BitmapMode_STRETCH;
|
2000-12-20 08:58:39 -06:00
|
|
|
else
|
2001-02-26 08:27:47 -06:00
|
|
|
aAny <<= drawing::BitmapMode_NO_REPEAT;
|
2000-12-20 08:58:39 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SfxItemPool& rPool = *mpSet->GetPool();
|
2009-06-03 06:26:39 -05:00
|
|
|
SfxItemSet aSet( rPool, pEntry->nWID, pEntry->nWID);
|
2000-12-20 08:58:39 -06:00
|
|
|
aSet.Put( *mpSet );
|
2000-09-18 11:07:07 -05:00
|
|
|
|
2000-12-20 08:58:39 -06:00
|
|
|
if( !aSet.Count() )
|
2009-06-03 06:26:39 -05:00
|
|
|
aSet.Put( rPool.GetDefaultItem( pEntry->nWID ) );
|
2000-12-20 08:58:39 -06:00
|
|
|
|
|
|
|
// Hole Wert aus ItemSet
|
2010-01-08 11:32:51 -06:00
|
|
|
aAny = SvxItemPropertySet_getPropertyValue( *mpPropSet, pEntry, aSet );
|
2000-12-20 08:58:39 -06:00
|
|
|
}
|
2000-09-18 11:07:07 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-06-03 06:26:39 -05:00
|
|
|
if(pEntry && pEntry->nWID)
|
|
|
|
aAny = mpPropSet->getPropertyValue( pEntry );
|
2000-09-18 11:07:07 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return aAny;
|
|
|
|
}
|
|
|
|
|
2006-12-12 12:02:01 -06:00
|
|
|
void SAL_CALL SdUnoPageBackground::addPropertyChangeListener( const OUString& , const uno::Reference< beans::XPropertyChangeListener >& ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
|
|
|
|
void SAL_CALL SdUnoPageBackground::removePropertyChangeListener( const OUString& , const uno::Reference< beans::XPropertyChangeListener >& ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
|
|
|
|
void SAL_CALL SdUnoPageBackground::addVetoableChangeListener( const OUString& , const uno::Reference< beans::XVetoableChangeListener >& ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
|
|
|
|
void SAL_CALL SdUnoPageBackground::removeVetoableChangeListener( const OUString& , const uno::Reference< beans::XVetoableChangeListener >& ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
|
2000-09-18 11:07:07 -05:00
|
|
|
|
|
|
|
// XPropertyState
|
|
|
|
beans::PropertyState SAL_CALL SdUnoPageBackground::getPropertyState( const OUString& PropertyName )
|
|
|
|
throw(beans::UnknownPropertyException, uno::RuntimeException)
|
|
|
|
{
|
|
|
|
OGuard aGuard( Application::GetSolarMutex() );
|
|
|
|
|
2009-06-03 06:26:39 -05:00
|
|
|
const SfxItemPropertySimpleEntry* pEntry = getPropertyMapEntry(PropertyName);
|
2000-09-18 11:07:07 -05:00
|
|
|
|
2009-06-03 06:26:39 -05:00
|
|
|
if( pEntry == NULL )
|
2000-09-18 11:07:07 -05:00
|
|
|
throw beans::UnknownPropertyException();
|
|
|
|
|
|
|
|
if( mpSet )
|
|
|
|
{
|
2009-06-03 06:26:39 -05:00
|
|
|
if( pEntry->nWID == OWN_ATTR_FILLBMP_MODE )
|
2000-12-20 08:58:39 -06:00
|
|
|
{
|
|
|
|
if( mpSet->GetItemState( XATTR_FILLBMP_STRETCH, false ) == SFX_ITEM_SET ||
|
|
|
|
mpSet->GetItemState( XATTR_FILLBMP_TILE, false ) == SFX_ITEM_SET )
|
|
|
|
{
|
|
|
|
return beans::PropertyState_DIRECT_VALUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return beans::PropertyState_AMBIGUOUS_VALUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-06-03 06:26:39 -05:00
|
|
|
switch( mpSet->GetItemState( pEntry->nWID, sal_False ) )
|
2000-09-18 11:07:07 -05:00
|
|
|
{
|
|
|
|
case SFX_ITEM_READONLY:
|
|
|
|
case SFX_ITEM_SET:
|
|
|
|
return beans::PropertyState_DIRECT_VALUE;
|
|
|
|
case SFX_ITEM_DEFAULT:
|
|
|
|
return beans::PropertyState_DEFAULT_VALUE;
|
|
|
|
default:
|
|
|
|
// case SFX_ITEM_DONTCARE:
|
|
|
|
// case SFX_ITEM_DISABLED:
|
|
|
|
return beans::PropertyState_AMBIGUOUS_VALUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-06-03 06:26:39 -05:00
|
|
|
if( NULL == mpPropSet->GetUsrAnyForID(pEntry->nWID) )
|
2000-09-18 11:07:07 -05:00
|
|
|
return beans::PropertyState_DEFAULT_VALUE;
|
|
|
|
else
|
|
|
|
return beans::PropertyState_DIRECT_VALUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
uno::Sequence< beans::PropertyState > SAL_CALL SdUnoPageBackground::getPropertyStates( const uno::Sequence< OUString >& aPropertyName )
|
|
|
|
throw(beans::UnknownPropertyException, uno::RuntimeException)
|
|
|
|
{
|
|
|
|
OGuard aGuard( Application::GetSolarMutex() );
|
|
|
|
|
|
|
|
sal_Int32 nCount = aPropertyName.getLength();
|
|
|
|
const OUString* pNames = aPropertyName.getConstArray();
|
|
|
|
|
|
|
|
uno::Sequence< beans::PropertyState > aPropertyStateSequence( nCount );
|
|
|
|
beans::PropertyState* pState = aPropertyStateSequence.getArray();
|
|
|
|
|
|
|
|
while( nCount-- )
|
|
|
|
*pState++ = getPropertyState( *pNames++ );
|
|
|
|
|
|
|
|
return aPropertyStateSequence;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SAL_CALL SdUnoPageBackground::setPropertyToDefault( const OUString& PropertyName )
|
|
|
|
throw(beans::UnknownPropertyException, uno::RuntimeException)
|
|
|
|
{
|
|
|
|
OGuard aGuard( Application::GetSolarMutex() );
|
|
|
|
|
2009-06-03 06:26:39 -05:00
|
|
|
const SfxItemPropertySimpleEntry* pEntry = getPropertyMapEntry(PropertyName);
|
2000-09-18 11:07:07 -05:00
|
|
|
|
2009-06-03 06:26:39 -05:00
|
|
|
if( pEntry == NULL )
|
2000-09-18 11:07:07 -05:00
|
|
|
throw beans::UnknownPropertyException();
|
|
|
|
|
|
|
|
if( mpSet )
|
2000-12-20 08:58:39 -06:00
|
|
|
{
|
2009-06-03 06:26:39 -05:00
|
|
|
if( pEntry->nWID == OWN_ATTR_FILLBMP_MODE )
|
2000-12-20 08:58:39 -06:00
|
|
|
{
|
|
|
|
mpSet->ClearItem( XATTR_FILLBMP_STRETCH );
|
|
|
|
mpSet->ClearItem( XATTR_FILLBMP_TILE );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-06-03 06:26:39 -05:00
|
|
|
mpSet->ClearItem( pEntry->nWID );
|
2000-12-20 08:58:39 -06:00
|
|
|
}
|
|
|
|
}
|
2000-09-18 11:07:07 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
uno::Any SAL_CALL SdUnoPageBackground::getPropertyDefault( const OUString& aPropertyName )
|
|
|
|
throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
|
|
|
|
{
|
|
|
|
OGuard aGuard( Application::GetSolarMutex() );
|
|
|
|
|
2009-06-03 06:26:39 -05:00
|
|
|
const SfxItemPropertySimpleEntry* pEntry = getPropertyMapEntry(aPropertyName);
|
|
|
|
if( pEntry == NULL || mpSet == NULL )
|
2000-09-18 11:07:07 -05:00
|
|
|
throw beans::UnknownPropertyException();
|
|
|
|
|
|
|
|
uno::Any aAny;
|
|
|
|
if( mpSet )
|
|
|
|
{
|
2009-06-03 06:26:39 -05:00
|
|
|
if( pEntry->nWID == OWN_ATTR_FILLBMP_MODE )
|
2000-12-20 08:58:39 -06:00
|
|
|
{
|
2001-02-26 08:33:16 -06:00
|
|
|
aAny <<= drawing::BitmapMode_REPEAT;
|
2000-12-20 08:58:39 -06:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SfxItemPool& rPool = *mpSet->GetPool();
|
2009-06-03 06:26:39 -05:00
|
|
|
SfxItemSet aSet( rPool, pEntry->nWID, pEntry->nWID);
|
|
|
|
aSet.Put( rPool.GetDefaultItem( pEntry->nWID ) );
|
2000-09-18 11:07:07 -05:00
|
|
|
|
2010-01-08 11:32:51 -06:00
|
|
|
aAny = SvxItemPropertySet_getPropertyValue( *mpPropSet, pEntry, aSet );
|
2000-12-20 08:58:39 -06:00
|
|
|
}
|
2000-09-18 11:07:07 -05:00
|
|
|
}
|
|
|
|
return aAny;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** this is used because our property map is not sorted yet */
|
2009-06-03 06:26:39 -05:00
|
|
|
const SfxItemPropertySimpleEntry* SdUnoPageBackground::getPropertyMapEntry( const OUString& rPropertyName ) const throw()
|
2000-09-18 11:07:07 -05:00
|
|
|
{
|
2009-06-03 06:26:39 -05:00
|
|
|
return mpPropSet->getPropertyMap()->getByName(rPropertyName);
|
2000-09-18 11:07:07 -05:00
|
|
|
}
|
|
|
|
|