summaryrefslogtreecommitdiff
path: root/svx/source/unogallery/unogaltheme.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'svx/source/unogallery/unogaltheme.cxx')
-rw-r--r--svx/source/unogallery/unogaltheme.cxx126
1 files changed, 63 insertions, 63 deletions
diff --git a/svx/source/unogallery/unogaltheme.cxx b/svx/source/unogallery/unogaltheme.cxx
index ef7646c944..9bbe80effd 100644
--- a/svx/source/unogallery/unogaltheme.cxx
+++ b/svx/source/unogallery/unogaltheme.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -32,19 +32,19 @@
#include "precompiled_svx.hxx"
#include <algorithm>
-
-#include "unogaltheme.hxx"
-#include "unogalitem.hxx"
-#include "galtheme.hxx"
-#include "gallery1.hxx"
-#include "galmisc.hxx"
-#include <svx/fmmodel.hxx>
+
+#include "unogaltheme.hxx"
+#include "unogalitem.hxx"
+#include "galtheme.hxx"
+#include "svx/gallery1.hxx"
+#include "svx/galmisc.hxx"
+#include <svx/fmmodel.hxx>
#include <rtl/uuid.h>
#include <vos/mutex.hxx>
-#ifndef _SV_SVAPP_HXX_
+#ifndef _SV_SVAPP_HXX_
#include <vcl/svapp.hxx>
#endif
-#include <svtools/pathoptions.hxx>
+#include <unotools/pathoptions.hxx>
using namespace ::com::sun::star;
@@ -58,7 +58,7 @@ GalleryTheme::GalleryTheme( const ::rtl::OUString& rThemeName )
{
mpGallery = ::Gallery::GetGalleryInstance();
mpTheme = ( mpGallery ? mpGallery->AcquireTheme( rThemeName, *this ) : NULL );
-
+
if( mpGallery )
StartListening( *mpGallery );
}
@@ -68,7 +68,7 @@ GalleryTheme::GalleryTheme( const ::rtl::OUString& rThemeName )
GalleryTheme::~GalleryTheme()
{
const ::vos::OGuard aGuard( Application::GetSolarMutex() );
-
+
DBG_ASSERT( !mpTheme || mpGallery, "Theme is living without Gallery" );
implReleaseItems( NULL );
@@ -76,14 +76,14 @@ GalleryTheme::~GalleryTheme()
if( mpGallery )
{
EndListening( *mpGallery );
-
+
if( mpTheme )
mpGallery->ReleaseTheme( mpTheme, *this );
}
}
// ------------------------------------------------------------------------------
-
+
::rtl::OUString GalleryTheme::getImplementationName_Static()
throw()
{
@@ -96,15 +96,15 @@ uno::Sequence< ::rtl::OUString > GalleryTheme::getSupportedServiceNames_Static()
throw()
{
uno::Sequence< ::rtl::OUString > aSeq( 1 );
-
+
aSeq.getArray()[ 0 ] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.gallery.GalleryTheme" ) );
-
+
return aSeq;
}
// ------------------------------------------------------------------------------
-
-::rtl::OUString SAL_CALL GalleryTheme::getImplementationName()
+
+::rtl::OUString SAL_CALL GalleryTheme::getImplementationName()
throw( uno::RuntimeException )
{
return getImplementationName_Static();
@@ -112,7 +112,7 @@ uno::Sequence< ::rtl::OUString > GalleryTheme::getSupportedServiceNames_Static()
// ------------------------------------------------------------------------------
-sal_Bool SAL_CALL GalleryTheme::supportsService( const ::rtl::OUString& ServiceName )
+sal_Bool SAL_CALL GalleryTheme::supportsService( const ::rtl::OUString& ServiceName )
throw( uno::RuntimeException )
{
uno::Sequence< ::rtl::OUString > aSNL( getSupportedServiceNames() );
@@ -127,7 +127,7 @@ sal_Bool SAL_CALL GalleryTheme::supportsService( const ::rtl::OUString& ServiceN
// ------------------------------------------------------------------------------
-uno::Sequence< ::rtl::OUString > SAL_CALL GalleryTheme::getSupportedServiceNames()
+uno::Sequence< ::rtl::OUString > SAL_CALL GalleryTheme::getSupportedServiceNames()
throw( uno::RuntimeException )
{
return getSupportedServiceNames_Static();
@@ -135,7 +135,7 @@ uno::Sequence< ::rtl::OUString > SAL_CALL GalleryTheme::getSupportedServiceNames
// ------------------------------------------------------------------------------
-uno::Sequence< uno::Type > SAL_CALL GalleryTheme::getTypes()
+uno::Sequence< uno::Type > SAL_CALL GalleryTheme::getTypes()
throw(uno::RuntimeException)
{
uno::Sequence< uno::Type > aTypes( 5 );
@@ -152,18 +152,18 @@ uno::Sequence< uno::Type > SAL_CALL GalleryTheme::getTypes()
// ------------------------------------------------------------------------------
-uno::Sequence< sal_Int8 > SAL_CALL GalleryTheme::getImplementationId()
+uno::Sequence< sal_Int8 > SAL_CALL GalleryTheme::getImplementationId()
throw(uno::RuntimeException)
{
const vos::OGuard aGuard( Application::GetSolarMutex() );
static uno::Sequence< sal_Int8 > aId;
-
+
if( aId.getLength() == 0 )
{
aId.realloc( 16 );
rtl_createUuid( reinterpret_cast< sal_uInt8* >( aId.getArray() ), 0, sal_True );
}
-
+
return aId;
}
@@ -177,21 +177,21 @@ uno::Type SAL_CALL GalleryTheme::getElementType()
// ------------------------------------------------------------------------------
-sal_Bool SAL_CALL GalleryTheme::hasElements()
+sal_Bool SAL_CALL GalleryTheme::hasElements()
throw (uno::RuntimeException)
{
const ::vos::OGuard aGuard( Application::GetSolarMutex() );
-
+
return( ( mpTheme != NULL ) && ( mpTheme->GetObjectCount() > 0 ) );
}
// ------------------------------------------------------------------------------
-sal_Int32 SAL_CALL GalleryTheme::getCount()
+sal_Int32 SAL_CALL GalleryTheme::getCount()
throw (uno::RuntimeException)
{
const ::vos::OGuard aGuard( Application::GetSolarMutex() );
-
+
return( mpTheme ? mpTheme->GetObjectCount() : 0 );
}
@@ -202,7 +202,7 @@ uno::Any SAL_CALL GalleryTheme::getByIndex( ::sal_Int32 nIndex )
{
const ::vos::OGuard aGuard( Application::GetSolarMutex() );
uno::Any aRet;
-
+
if( mpTheme )
{
if( ( nIndex < 0 ) || ( nIndex >= getCount() ) )
@@ -212,12 +212,12 @@ uno::Any SAL_CALL GalleryTheme::getByIndex( ::sal_Int32 nIndex )
else
{
const GalleryObject* pObj = mpTheme->ImplGetGalleryObject( nIndex );
-
+
if( pObj )
- aRet = uno::makeAny( uno::Reference< gallery::XGalleryItem >( new GalleryItem( *this, *pObj ) ) );
+ aRet = uno::makeAny( uno::Reference< gallery::XGalleryItem >( new GalleryItem( *this, *pObj ) ) );
}
}
-
+
return aRet;
}
@@ -228,20 +228,20 @@ uno::Any SAL_CALL GalleryTheme::getByIndex( ::sal_Int32 nIndex )
{
const ::vos::OGuard aGuard( Application::GetSolarMutex() );
::rtl::OUString aRet;
-
+
if( mpTheme )
aRet = mpTheme->GetName();
-
+
return aRet;
}
// ------------------------------------------------------------------------------
-
+
void SAL_CALL GalleryTheme::update( )
throw (uno::RuntimeException)
{
const ::vos::OGuard aGuard( Application::GetSolarMutex() );
-
+
if( mpTheme )
{
const Link aDummyLink;
@@ -250,26 +250,26 @@ void SAL_CALL GalleryTheme::update( )
}
// ------------------------------------------------------------------------------
-
+
::sal_Int32 SAL_CALL GalleryTheme::insertURLByIndex(
const ::rtl::OUString& rURL, ::sal_Int32 nIndex )
throw (lang::WrappedTargetException, uno::RuntimeException)
{
const ::vos::OGuard aGuard( Application::GetSolarMutex() );
sal_Int32 nRet = -1;
-
+
if( mpTheme )
{
try
{
const INetURLObject aURL( rURL );
-
+
nIndex = ::std::max( ::std::min( nIndex, getCount() ), sal_Int32( 0 ) );
-
+
if( ( aURL.GetProtocol() != INET_PROT_NOT_VALID ) && mpTheme->InsertURL( aURL, nIndex ) )
{
const GalleryObject* pObj = mpTheme->ImplGetGalleryObject( aURL );
-
+
if( pObj )
nRet = mpTheme->ImplGetGalleryObjectPos( pObj );
}
@@ -278,14 +278,14 @@ void SAL_CALL GalleryTheme::update( )
{
}
}
-
+
return nRet;
}
// ------------------------------------------------------------------------------
-
-::sal_Int32 SAL_CALL GalleryTheme::insertGraphicByIndex(
- const uno::Reference< graphic::XGraphic >& rxGraphic, sal_Int32 nIndex )
+
+::sal_Int32 SAL_CALL GalleryTheme::insertGraphicByIndex(
+ const uno::Reference< graphic::XGraphic >& rxGraphic, sal_Int32 nIndex )
throw (lang::WrappedTargetException, uno::RuntimeException)
{
const ::vos::OGuard aGuard( Application::GetSolarMutex() );
@@ -296,9 +296,9 @@ void SAL_CALL GalleryTheme::update( )
try
{
const Graphic aGraphic( rxGraphic );
-
+
nIndex = ::std::max( ::std::min( nIndex, getCount() ), sal_Int32( 0 ) );
-
+
if( mpTheme->InsertGraphic( aGraphic, nIndex ) )
nRet = nIndex;
}
@@ -306,12 +306,12 @@ void SAL_CALL GalleryTheme::update( )
{
}
}
-
+
return nRet;
}
// ------------------------------------------------------------------------------
-
+
::sal_Int32 SAL_CALL GalleryTheme::insertDrawingByIndex(
const uno::Reference< lang::XComponent >& Drawing, sal_Int32 nIndex )
throw (lang::WrappedTargetException, uno::RuntimeException)
@@ -322,26 +322,26 @@ void SAL_CALL GalleryTheme::update( )
if( mpTheme )
{
GalleryDrawingModel* pModel = GalleryDrawingModel::getImplementation( Drawing );
-
+
if( pModel && pModel->GetDoc() && pModel->GetDoc()->ISA( FmFormModel ) )
{
nIndex = ::std::max( ::std::min( nIndex, getCount() ), sal_Int32( 0 ) );
-
+
if( mpTheme->InsertModel( *static_cast< FmFormModel* >( pModel->GetDoc() ), nIndex ) )
nRet = nIndex;
}
}
-
+
return nRet;
}
// ------------------------------------------------------------------------------
-
+
void SAL_CALL GalleryTheme::removeByIndex( sal_Int32 nIndex )
throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
{
const ::vos::OGuard aGuard( Application::GetSolarMutex() );
-
+
if( mpTheme )
{
if( ( nIndex < 0 ) || ( nIndex >= getCount() ) )
@@ -363,9 +363,9 @@ void GalleryTheme::Notify( SfxBroadcaster&, const SfxHint& rHint )
case( GALLERY_HINT_CLOSE_THEME ):
{
DBG_ASSERT( !mpTheme || mpGallery, "Theme is living without Gallery" );
-
+
implReleaseItems( NULL );
-
+
if( mpGallery && mpTheme )
{
mpGallery->ReleaseTheme( mpTheme, *this );
@@ -373,16 +373,16 @@ void GalleryTheme::Notify( SfxBroadcaster&, const SfxHint& rHint )
}
}
break;
-
+
case( GALLERY_HINT_CLOSE_OBJECT ):
{
GalleryObject* pObj = reinterpret_cast< GalleryObject* >( rGalleryHint.GetData1() );
-
+
if( pObj )
implReleaseItems( pObj );
}
break;
-
+
default:
break;
}
@@ -393,7 +393,7 @@ void GalleryTheme::Notify( SfxBroadcaster&, const SfxHint& rHint )
void GalleryTheme::implReleaseItems( GalleryObject* pObj )
{
const ::vos::OGuard aGuard( Application::GetSolarMutex() );
-
+
for( GalleryItemList::iterator aIter = maItemList.begin(); aIter != maItemList.end(); )
{
if( !pObj || ( (*aIter)->implGetObject() == pObj ) )
@@ -418,17 +418,17 @@ void GalleryTheme::implReleaseItems( GalleryObject* pObj )
void GalleryTheme::implRegisterGalleryItem( ::unogallery::GalleryItem& rItem )
{
const ::vos::OGuard aGuard( Application::GetSolarMutex() );
-
+
// DBG_ASSERT( maItemList.find( &rItem ) == maItemList.end(), "Item already registered" );
maItemList.push_back( &rItem );
}
// ------------------------------------------------------------------------------
-
+
void GalleryTheme::implDeregisterGalleryItem( ::unogallery::GalleryItem& rItem )
{
const ::vos::OGuard aGuard( Application::GetSolarMutex() );
-
+
// DBG_ASSERT( maItemList.find( &rItem ) != maItemList.end(), "Item is not registered" );
maItemList.remove( &rItem );
}