1*f6e50924SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*f6e50924SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*f6e50924SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*f6e50924SAndrew Rist * distributed with this work for additional information 6*f6e50924SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*f6e50924SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*f6e50924SAndrew Rist * "License"); you may not use this file except in compliance 9*f6e50924SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*f6e50924SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*f6e50924SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*f6e50924SAndrew Rist * software distributed under the License is distributed on an 15*f6e50924SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*f6e50924SAndrew Rist * KIND, either express or implied. See the License for the 17*f6e50924SAndrew Rist * specific language governing permissions and limitations 18*f6e50924SAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*f6e50924SAndrew Rist *************************************************************/ 21*f6e50924SAndrew Rist 22*f6e50924SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_svx.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <com/sun/star/style/XStyle.hpp> 28cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp> 29cdf0e10cSrcweir #include <com/sun/star/lang/XComponent.hpp> 30cdf0e10cSrcweir #include <com/sun/star/lang/XSingleServiceFactory.hpp> 31cdf0e10cSrcweir #include <com/sun/star/container/XIndexAccess.hpp> 32cdf0e10cSrcweir #include <com/sun/star/container/XNameContainer.hpp> 33cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp> 34cdf0e10cSrcweir #include <com/sun/star/util/XModifyBroadcaster.hpp> 35cdf0e10cSrcweir #include <com/sun/star/util/XModifyListener.hpp> 36cdf0e10cSrcweir #include <comphelper/serviceinfohelper.hxx> 37cdf0e10cSrcweir 38cdf0e10cSrcweir #include <osl/mutex.hxx> 39cdf0e10cSrcweir #include <vos/mutex.hxx> 40cdf0e10cSrcweir #include <vcl/svapp.hxx> 41cdf0e10cSrcweir 42cdf0e10cSrcweir #include <cppuhelper/basemutex.hxx> 43cdf0e10cSrcweir #include <cppuhelper/compbase6.hxx> 44cdf0e10cSrcweir #include <cppuhelper/implbase7.hxx> 45cdf0e10cSrcweir #include <cppuhelper/interfacecontainer.h> 46cdf0e10cSrcweir 47cdf0e10cSrcweir #include "svx/unoprov.hxx" 48cdf0e10cSrcweir #include "svx/sdr/table/tabledesign.hxx" 49cdf0e10cSrcweir #include "svx/dialmgr.hxx" 50cdf0e10cSrcweir #include "svx/dialogs.hrc" 51cdf0e10cSrcweir 52cdf0e10cSrcweir #include "celltypes.hxx" 53cdf0e10cSrcweir 54cdf0e10cSrcweir #include <vector> 55cdf0e10cSrcweir #include <map> 56cdf0e10cSrcweir 57cdf0e10cSrcweir #include <boost/bind.hpp> 58cdf0e10cSrcweir 59cdf0e10cSrcweir // ----------------------------------------------------------------------------- 60cdf0e10cSrcweir 61cdf0e10cSrcweir using namespace ::com::sun::star::uno; 62cdf0e10cSrcweir using namespace ::com::sun::star::style; 63cdf0e10cSrcweir using namespace ::com::sun::star::lang; 64cdf0e10cSrcweir using namespace ::com::sun::star::beans; 65cdf0e10cSrcweir using namespace ::com::sun::star::util; 66cdf0e10cSrcweir using namespace ::com::sun::star::container; 67cdf0e10cSrcweir 68cdf0e10cSrcweir using ::rtl::OUString; 69cdf0e10cSrcweir using ::vos::OGuard; 70cdf0e10cSrcweir using ::osl::MutexGuard; 71cdf0e10cSrcweir using ::osl::ClearableMutexGuard; 72cdf0e10cSrcweir using ::cppu::OInterfaceContainerHelper; 73cdf0e10cSrcweir 74cdf0e10cSrcweir namespace sdr { namespace table { 75cdf0e10cSrcweir 76cdf0e10cSrcweir typedef std::map< OUString, sal_Int32 > CellStyleNameMap; 77cdf0e10cSrcweir 78cdf0e10cSrcweir typedef ::cppu::WeakComponentImplHelper6< XStyle, XNameReplace, XServiceInfo, XIndexAccess, XModifyBroadcaster, XModifyListener > TableDesignStyleBase; 79cdf0e10cSrcweir 80cdf0e10cSrcweir class TableDesignStyle : private ::cppu::BaseMutex, public TableDesignStyleBase 81cdf0e10cSrcweir { 82cdf0e10cSrcweir public: 83cdf0e10cSrcweir TableDesignStyle(); 84cdf0e10cSrcweir 85cdf0e10cSrcweir // XServiceInfo 86cdf0e10cSrcweir virtual OUString SAL_CALL getImplementationName() throw(RuntimeException); 87cdf0e10cSrcweir virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(RuntimeException); 88cdf0e10cSrcweir virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(RuntimeException); 89cdf0e10cSrcweir 90cdf0e10cSrcweir // XStyle 91cdf0e10cSrcweir virtual ::sal_Bool SAL_CALL isUserDefined() throw (RuntimeException); 92cdf0e10cSrcweir virtual ::sal_Bool SAL_CALL isInUse() throw (RuntimeException); 93cdf0e10cSrcweir virtual OUString SAL_CALL getParentStyle() throw (RuntimeException); 94cdf0e10cSrcweir virtual void SAL_CALL setParentStyle( const OUString& aParentStyle ) throw (NoSuchElementException, RuntimeException); 95cdf0e10cSrcweir 96cdf0e10cSrcweir // XNamed 97cdf0e10cSrcweir virtual OUString SAL_CALL getName() throw (RuntimeException); 98cdf0e10cSrcweir virtual void SAL_CALL setName( const OUString& aName ) throw (RuntimeException); 99cdf0e10cSrcweir 100cdf0e10cSrcweir // XNameAccess 101cdf0e10cSrcweir virtual Any SAL_CALL getByName( const OUString& aName ) throw(NoSuchElementException, WrappedTargetException, RuntimeException); 102cdf0e10cSrcweir virtual Sequence< OUString > SAL_CALL getElementNames() throw(RuntimeException); 103cdf0e10cSrcweir virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) throw(RuntimeException); 104cdf0e10cSrcweir 105cdf0e10cSrcweir // XElementAccess 106cdf0e10cSrcweir virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw(RuntimeException); 107cdf0e10cSrcweir virtual sal_Bool SAL_CALL hasElements() throw(RuntimeException); 108cdf0e10cSrcweir 109cdf0e10cSrcweir // XIndexAccess 110cdf0e10cSrcweir virtual sal_Int32 SAL_CALL getCount() throw(RuntimeException) ; 111cdf0e10cSrcweir virtual Any SAL_CALL getByIndex( sal_Int32 Index ) throw(IndexOutOfBoundsException, WrappedTargetException, RuntimeException); 112cdf0e10cSrcweir 113cdf0e10cSrcweir // XNameReplace 114cdf0e10cSrcweir virtual void SAL_CALL replaceByName( const OUString& aName, const Any& aElement ) throw(IllegalArgumentException, NoSuchElementException, WrappedTargetException, RuntimeException); 115cdf0e10cSrcweir 116cdf0e10cSrcweir // XModifyBroadcaster 117cdf0e10cSrcweir virtual void SAL_CALL addModifyListener( const Reference< XModifyListener >& aListener ) throw (RuntimeException); 118cdf0e10cSrcweir virtual void SAL_CALL removeModifyListener( const Reference< XModifyListener >& aListener ) throw (RuntimeException); 119cdf0e10cSrcweir 120cdf0e10cSrcweir // XModifyListener 121cdf0e10cSrcweir virtual void SAL_CALL modified( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException); 122cdf0e10cSrcweir virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException); 123cdf0e10cSrcweir 124cdf0e10cSrcweir void notifyModifyListener(); 125cdf0e10cSrcweir 126cdf0e10cSrcweir // this function is called upon disposing the component 127cdf0e10cSrcweir virtual void SAL_CALL disposing(); 128cdf0e10cSrcweir 129cdf0e10cSrcweir static const CellStyleNameMap& getCellStyleNameMap(); 130cdf0e10cSrcweir 131cdf0e10cSrcweir OUString msName; 132cdf0e10cSrcweir Reference< XStyle > maCellStyles[style_count]; 133cdf0e10cSrcweir }; 134cdf0e10cSrcweir 135cdf0e10cSrcweir typedef std::vector< Reference< XStyle > > TableDesignStyleVector; 136cdf0e10cSrcweir 137cdf0e10cSrcweir class TableDesignFamily : public ::cppu::WeakImplHelper7< XNameContainer, XNamed, XIndexAccess, XSingleServiceFactory, XServiceInfo, XComponent, XPropertySet > 138cdf0e10cSrcweir { 139cdf0e10cSrcweir public: 140cdf0e10cSrcweir // XServiceInfo 141cdf0e10cSrcweir virtual OUString SAL_CALL getImplementationName() throw(RuntimeException); 142cdf0e10cSrcweir virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(RuntimeException); 143cdf0e10cSrcweir virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(RuntimeException); 144cdf0e10cSrcweir 145cdf0e10cSrcweir // XNamed 146cdf0e10cSrcweir virtual OUString SAL_CALL getName( ) throw (RuntimeException); 147cdf0e10cSrcweir virtual void SAL_CALL setName( const OUString& aName ) throw (RuntimeException); 148cdf0e10cSrcweir 149cdf0e10cSrcweir // XNameAccess 150cdf0e10cSrcweir virtual Any SAL_CALL getByName( const OUString& aName ) throw(NoSuchElementException, WrappedTargetException, RuntimeException); 151cdf0e10cSrcweir virtual Sequence< OUString > SAL_CALL getElementNames() throw(RuntimeException); 152cdf0e10cSrcweir virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) throw(RuntimeException); 153cdf0e10cSrcweir 154cdf0e10cSrcweir // XElementAccess 155cdf0e10cSrcweir virtual Type SAL_CALL getElementType() throw(RuntimeException); 156cdf0e10cSrcweir virtual sal_Bool SAL_CALL hasElements() throw(RuntimeException); 157cdf0e10cSrcweir 158cdf0e10cSrcweir // XIndexAccess 159cdf0e10cSrcweir virtual sal_Int32 SAL_CALL getCount() throw(RuntimeException) ; 160cdf0e10cSrcweir virtual Any SAL_CALL getByIndex( sal_Int32 Index ) throw(IndexOutOfBoundsException, WrappedTargetException, RuntimeException); 161cdf0e10cSrcweir 162cdf0e10cSrcweir // XNameContainer 163cdf0e10cSrcweir virtual void SAL_CALL insertByName( const OUString& aName, const Any& aElement ) throw(IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException); 164cdf0e10cSrcweir virtual void SAL_CALL removeByName( const OUString& Name ) throw(NoSuchElementException, WrappedTargetException, RuntimeException); 165cdf0e10cSrcweir 166cdf0e10cSrcweir // XNameReplace 167cdf0e10cSrcweir virtual void SAL_CALL replaceByName( const OUString& aName, const Any& aElement ) throw(IllegalArgumentException, NoSuchElementException, WrappedTargetException, RuntimeException); 168cdf0e10cSrcweir 169cdf0e10cSrcweir // XSingleServiceFactory 170cdf0e10cSrcweir virtual Reference< XInterface > SAL_CALL createInstance( ) throw(Exception, RuntimeException); 171cdf0e10cSrcweir virtual Reference< XInterface > SAL_CALL createInstanceWithArguments( const Sequence< Any >& aArguments ) throw(Exception, RuntimeException); 172cdf0e10cSrcweir 173cdf0e10cSrcweir // XComponent 174cdf0e10cSrcweir virtual void SAL_CALL dispose( ) throw (RuntimeException); 175cdf0e10cSrcweir virtual void SAL_CALL addEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException); 176cdf0e10cSrcweir virtual void SAL_CALL removeEventListener( const Reference< XEventListener >& aListener ) throw (RuntimeException); 177cdf0e10cSrcweir 178cdf0e10cSrcweir // XPropertySet 179cdf0e10cSrcweir virtual Reference<XPropertySetInfo> SAL_CALL getPropertySetInfo() throw (RuntimeException); 180cdf0e10cSrcweir virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const Any& aValue ) throw (UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException); 181cdf0e10cSrcweir virtual Any SAL_CALL getPropertyValue( const OUString& PropertyName ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException); 182cdf0e10cSrcweir virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const Reference<XPropertyChangeListener>& xListener ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException); 183cdf0e10cSrcweir virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const Reference<XPropertyChangeListener>& aListener ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException); 184cdf0e10cSrcweir virtual void SAL_CALL addVetoableChangeListener(const OUString& PropertyName, const Reference<XVetoableChangeListener>& aListener ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException); 185cdf0e10cSrcweir virtual void SAL_CALL removeVetoableChangeListener(const OUString& PropertyName,const Reference<XVetoableChangeListener>&aListener ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException); 186cdf0e10cSrcweir 187cdf0e10cSrcweir TableDesignStyleVector maDesigns; 188cdf0e10cSrcweir }; 189cdf0e10cSrcweir 190cdf0e10cSrcweir //------------------------------------------------------------------------ 191cdf0e10cSrcweir // TableDesignStyle 192cdf0e10cSrcweir //------------------------------------------------------------------------ 193cdf0e10cSrcweir 194cdf0e10cSrcweir TableDesignStyle::TableDesignStyle() 195cdf0e10cSrcweir : TableDesignStyleBase(m_aMutex) 196cdf0e10cSrcweir { 197cdf0e10cSrcweir } 198cdf0e10cSrcweir 199cdf0e10cSrcweir const CellStyleNameMap& TableDesignStyle::getCellStyleNameMap() 200cdf0e10cSrcweir { 201cdf0e10cSrcweir static CellStyleNameMap aMap; 202cdf0e10cSrcweir if( aMap.empty() ) 203cdf0e10cSrcweir { 204cdf0e10cSrcweir CellStyleNameMap aNewMap; 205cdf0e10cSrcweir aNewMap[ OUString( RTL_CONSTASCII_USTRINGPARAM( "first-row" ) ) ] = first_row_style; 206cdf0e10cSrcweir aNewMap[ OUString( RTL_CONSTASCII_USTRINGPARAM( "last-row" ) ) ] = last_row_style; 207cdf0e10cSrcweir aNewMap[ OUString( RTL_CONSTASCII_USTRINGPARAM( "first-column" ) ) ] = first_column_style; 208cdf0e10cSrcweir aNewMap[ OUString( RTL_CONSTASCII_USTRINGPARAM( "last-column" ) ) ] = last_column_style; 209cdf0e10cSrcweir aNewMap[ OUString( RTL_CONSTASCII_USTRINGPARAM( "body" ) ) ] = body_style; 210cdf0e10cSrcweir aNewMap[ OUString( RTL_CONSTASCII_USTRINGPARAM( "even-rows" ) ) ] = even_rows_style; 211cdf0e10cSrcweir aNewMap[ OUString( RTL_CONSTASCII_USTRINGPARAM( "odd-rows" ) ) ] = odd_rows_style; 212cdf0e10cSrcweir aNewMap[ OUString( RTL_CONSTASCII_USTRINGPARAM( "even-columns" ) ) ] = even_columns_style; 213cdf0e10cSrcweir aNewMap[ OUString( RTL_CONSTASCII_USTRINGPARAM( "odd-columns" ) ) ] = odd_columns_style; 214cdf0e10cSrcweir aNewMap[ OUString( RTL_CONSTASCII_USTRINGPARAM( "background" ) ) ] = background_style; 215cdf0e10cSrcweir aMap.swap( aNewMap ); 216cdf0e10cSrcweir } 217cdf0e10cSrcweir 218cdf0e10cSrcweir return aMap; 219cdf0e10cSrcweir } 220cdf0e10cSrcweir 221cdf0e10cSrcweir // ---------------------------------------------------------- 222cdf0e10cSrcweir // XServiceInfo 223cdf0e10cSrcweir // ---------------------------------------------------------- 224cdf0e10cSrcweir 225cdf0e10cSrcweir OUString SAL_CALL TableDesignStyle::getImplementationName() throw(RuntimeException) 226cdf0e10cSrcweir { 227cdf0e10cSrcweir return OUString( RTL_CONSTASCII_USTRINGPARAM("TableDesignStyle") ); 228cdf0e10cSrcweir } 229cdf0e10cSrcweir 230cdf0e10cSrcweir // ---------------------------------------------------------- 231cdf0e10cSrcweir 232cdf0e10cSrcweir sal_Bool SAL_CALL TableDesignStyle::supportsService( const OUString& ServiceName ) throw(RuntimeException) 233cdf0e10cSrcweir { 234cdf0e10cSrcweir return comphelper::ServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() ); 235cdf0e10cSrcweir } 236cdf0e10cSrcweir 237cdf0e10cSrcweir // ---------------------------------------------------------- 238cdf0e10cSrcweir 239cdf0e10cSrcweir Sequence< OUString > SAL_CALL TableDesignStyle::getSupportedServiceNames() throw(RuntimeException) 240cdf0e10cSrcweir { 241cdf0e10cSrcweir OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.style.Style") ); 242cdf0e10cSrcweir Sequence< OUString > aSeq( &aServiceName, 1 ); 243cdf0e10cSrcweir return aSeq; 244cdf0e10cSrcweir } 245cdf0e10cSrcweir 246cdf0e10cSrcweir // ---------------------------------------------------------- 247cdf0e10cSrcweir // XStyle 248cdf0e10cSrcweir // ---------------------------------------------------------- 249cdf0e10cSrcweir 250cdf0e10cSrcweir sal_Bool SAL_CALL TableDesignStyle::isUserDefined() throw (RuntimeException) 251cdf0e10cSrcweir { 252cdf0e10cSrcweir return sal_False; 253cdf0e10cSrcweir } 254cdf0e10cSrcweir 255cdf0e10cSrcweir // ---------------------------------------------------------- 256cdf0e10cSrcweir 257cdf0e10cSrcweir sal_Bool SAL_CALL TableDesignStyle::isInUse() throw (RuntimeException) 258cdf0e10cSrcweir { 259cdf0e10cSrcweir ClearableMutexGuard aGuard( rBHelper.rMutex ); 260cdf0e10cSrcweir OInterfaceContainerHelper * pContainer = rBHelper.getContainer( XModifyListener::static_type() ); 261cdf0e10cSrcweir if( pContainer ) 262cdf0e10cSrcweir { 263cdf0e10cSrcweir Sequence< Reference< XInterface > > aListener( pContainer->getElements() ); 264cdf0e10cSrcweir aGuard.clear(); 265cdf0e10cSrcweir 266cdf0e10cSrcweir sal_Int32 nIndex = aListener.getLength(); 267cdf0e10cSrcweir while( --nIndex >= 0 ) 268cdf0e10cSrcweir { 269cdf0e10cSrcweir TableDesignUser* pUser = dynamic_cast< TableDesignUser* >( aListener[nIndex].get() ); 270cdf0e10cSrcweir if( pUser && pUser->isInUse() ) 271cdf0e10cSrcweir return sal_True; 272cdf0e10cSrcweir } 273cdf0e10cSrcweir } 274cdf0e10cSrcweir return sal_False; 275cdf0e10cSrcweir } 276cdf0e10cSrcweir 277cdf0e10cSrcweir // ---------------------------------------------------------- 278cdf0e10cSrcweir 279cdf0e10cSrcweir OUString SAL_CALL TableDesignStyle::getParentStyle() throw (RuntimeException) 280cdf0e10cSrcweir { 281cdf0e10cSrcweir return OUString(); 282cdf0e10cSrcweir } 283cdf0e10cSrcweir 284cdf0e10cSrcweir // ---------------------------------------------------------- 285cdf0e10cSrcweir 286cdf0e10cSrcweir void SAL_CALL TableDesignStyle::setParentStyle( const OUString& ) throw (NoSuchElementException, RuntimeException) 287cdf0e10cSrcweir { 288cdf0e10cSrcweir } 289cdf0e10cSrcweir 290cdf0e10cSrcweir // ---------------------------------------------------------- 291cdf0e10cSrcweir // XNamed 292cdf0e10cSrcweir // ---------------------------------------------------------- 293cdf0e10cSrcweir 294cdf0e10cSrcweir OUString SAL_CALL TableDesignStyle::getName() throw (RuntimeException) 295cdf0e10cSrcweir { 296cdf0e10cSrcweir return msName; 297cdf0e10cSrcweir } 298cdf0e10cSrcweir 299cdf0e10cSrcweir // ---------------------------------------------------------- 300cdf0e10cSrcweir 301cdf0e10cSrcweir void SAL_CALL TableDesignStyle::setName( const OUString& rName ) throw (RuntimeException) 302cdf0e10cSrcweir { 303cdf0e10cSrcweir msName = rName; 304cdf0e10cSrcweir } 305cdf0e10cSrcweir 306cdf0e10cSrcweir // ---------------------------------------------------------- 307cdf0e10cSrcweir // XNameAccess 308cdf0e10cSrcweir // ---------------------------------------------------------- 309cdf0e10cSrcweir 310cdf0e10cSrcweir Any SAL_CALL TableDesignStyle::getByName( const OUString& rName ) throw(NoSuchElementException, WrappedTargetException, RuntimeException) 311cdf0e10cSrcweir { 312cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 313cdf0e10cSrcweir 314cdf0e10cSrcweir const CellStyleNameMap& rMap = getCellStyleNameMap(); 315cdf0e10cSrcweir 316cdf0e10cSrcweir CellStyleNameMap::const_iterator iter = rMap.find( rName ); 317cdf0e10cSrcweir if( iter == rMap.end() ) 318cdf0e10cSrcweir throw NoSuchElementException(); 319cdf0e10cSrcweir 320cdf0e10cSrcweir return Any( maCellStyles[(*iter).second] ); 321cdf0e10cSrcweir } 322cdf0e10cSrcweir 323cdf0e10cSrcweir // ---------------------------------------------------------- 324cdf0e10cSrcweir 325cdf0e10cSrcweir Sequence< OUString > SAL_CALL TableDesignStyle::getElementNames() throw(RuntimeException) 326cdf0e10cSrcweir { 327cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 328cdf0e10cSrcweir 329cdf0e10cSrcweir const CellStyleNameMap& rMap = getCellStyleNameMap(); 330cdf0e10cSrcweir Sequence< OUString > aRet( rMap.size() ); 331cdf0e10cSrcweir OUString* pName = aRet.getArray(); 332cdf0e10cSrcweir 333cdf0e10cSrcweir CellStyleNameMap::const_iterator iter = rMap.begin(); 334cdf0e10cSrcweir while( iter != rMap.end() ) 335cdf0e10cSrcweir *pName++ = (*iter++).first; 336cdf0e10cSrcweir 337cdf0e10cSrcweir return aRet; 338cdf0e10cSrcweir } 339cdf0e10cSrcweir 340cdf0e10cSrcweir // ---------------------------------------------------------- 341cdf0e10cSrcweir 342cdf0e10cSrcweir sal_Bool SAL_CALL TableDesignStyle::hasByName( const OUString& rName ) throw(RuntimeException) 343cdf0e10cSrcweir { 344cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 345cdf0e10cSrcweir 346cdf0e10cSrcweir const CellStyleNameMap& rMap = getCellStyleNameMap(); 347cdf0e10cSrcweir 348cdf0e10cSrcweir CellStyleNameMap::const_iterator iter = rMap.find( rName ); 349cdf0e10cSrcweir return ( iter != rMap.end() ) ? sal_True : sal_False; 350cdf0e10cSrcweir } 351cdf0e10cSrcweir 352cdf0e10cSrcweir // ---------------------------------------------------------- 353cdf0e10cSrcweir // XElementAccess 354cdf0e10cSrcweir // ---------------------------------------------------------- 355cdf0e10cSrcweir 356cdf0e10cSrcweir Type SAL_CALL TableDesignStyle::getElementType() throw(RuntimeException) 357cdf0e10cSrcweir { 358cdf0e10cSrcweir return XStyle::static_type(); 359cdf0e10cSrcweir } 360cdf0e10cSrcweir 361cdf0e10cSrcweir // ---------------------------------------------------------- 362cdf0e10cSrcweir 363cdf0e10cSrcweir sal_Bool SAL_CALL TableDesignStyle::hasElements() throw(RuntimeException) 364cdf0e10cSrcweir { 365cdf0e10cSrcweir return sal_True; 366cdf0e10cSrcweir } 367cdf0e10cSrcweir 368cdf0e10cSrcweir // ---------------------------------------------------------- 369cdf0e10cSrcweir // XIndexAccess 370cdf0e10cSrcweir // ---------------------------------------------------------- 371cdf0e10cSrcweir 372cdf0e10cSrcweir sal_Int32 SAL_CALL TableDesignStyle::getCount() throw(RuntimeException) 373cdf0e10cSrcweir { 374cdf0e10cSrcweir return style_count; 375cdf0e10cSrcweir } 376cdf0e10cSrcweir 377cdf0e10cSrcweir // ---------------------------------------------------------- 378cdf0e10cSrcweir 379cdf0e10cSrcweir Any SAL_CALL TableDesignStyle::getByIndex( sal_Int32 Index ) throw(IndexOutOfBoundsException, WrappedTargetException, RuntimeException) 380cdf0e10cSrcweir { 381cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 382cdf0e10cSrcweir 383cdf0e10cSrcweir if( (Index < 0) || (Index >= style_count) ) 384cdf0e10cSrcweir throw IndexOutOfBoundsException(); 385cdf0e10cSrcweir 386cdf0e10cSrcweir return Any( maCellStyles[Index] ); 387cdf0e10cSrcweir } 388cdf0e10cSrcweir 389cdf0e10cSrcweir // ---------------------------------------------------------- 390cdf0e10cSrcweir // XNameReplace 391cdf0e10cSrcweir // ---------------------------------------------------------- 392cdf0e10cSrcweir 393cdf0e10cSrcweir void SAL_CALL TableDesignStyle::replaceByName( const OUString& rName, const Any& aElement ) throw(IllegalArgumentException, NoSuchElementException, WrappedTargetException, RuntimeException) 394cdf0e10cSrcweir { 395cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 396cdf0e10cSrcweir 397cdf0e10cSrcweir const CellStyleNameMap& rMap = getCellStyleNameMap(); 398cdf0e10cSrcweir CellStyleNameMap::const_iterator iter = rMap.find( rName ); 399cdf0e10cSrcweir if( iter == rMap.end() ) 400cdf0e10cSrcweir throw NoSuchElementException(); 401cdf0e10cSrcweir 402cdf0e10cSrcweir 403cdf0e10cSrcweir Reference< XStyle > xNewStyle; 404cdf0e10cSrcweir if( !(aElement >>= xNewStyle) ) 405cdf0e10cSrcweir throw IllegalArgumentException(); 406cdf0e10cSrcweir 407cdf0e10cSrcweir const sal_Int32 nIndex = (*iter).second; 408cdf0e10cSrcweir 409cdf0e10cSrcweir Reference< XStyle > xOldStyle( maCellStyles[nIndex] ); 410cdf0e10cSrcweir 411cdf0e10cSrcweir if( xNewStyle != xOldStyle ) 412cdf0e10cSrcweir { 413cdf0e10cSrcweir Reference< XModifyListener > xListener( this ); 414cdf0e10cSrcweir 415cdf0e10cSrcweir // end listening to old style, if possible 416cdf0e10cSrcweir Reference< XModifyBroadcaster > xOldBroadcaster( xOldStyle, UNO_QUERY ); 417cdf0e10cSrcweir if( xOldBroadcaster.is() ) 418cdf0e10cSrcweir xOldBroadcaster->removeModifyListener( xListener ); 419cdf0e10cSrcweir 420cdf0e10cSrcweir // start listening to new style, if possible 421cdf0e10cSrcweir Reference< XModifyBroadcaster > xNewBroadcaster( xNewStyle, UNO_QUERY ); 422cdf0e10cSrcweir if( xNewBroadcaster.is() ) 423cdf0e10cSrcweir xNewBroadcaster->addModifyListener( xListener ); 424cdf0e10cSrcweir 425cdf0e10cSrcweir maCellStyles[nIndex] = xNewStyle; 426cdf0e10cSrcweir } 427cdf0e10cSrcweir } 428cdf0e10cSrcweir 429cdf0e10cSrcweir // ---------------------------------------------------------- 430cdf0e10cSrcweir // XComponent 431cdf0e10cSrcweir // ---------------------------------------------------------- 432cdf0e10cSrcweir 433cdf0e10cSrcweir void SAL_CALL TableDesignStyle::disposing() 434cdf0e10cSrcweir { 435cdf0e10cSrcweir for( sal_Int32 nIndex = 0; nIndex < style_count; nIndex++ ) 436cdf0e10cSrcweir maCellStyles[nIndex].clear(); 437cdf0e10cSrcweir } 438cdf0e10cSrcweir 439cdf0e10cSrcweir //------------------------------------------------------------------------ 440cdf0e10cSrcweir // XModifyBroadcaster 441cdf0e10cSrcweir //------------------------------------------------------------------------ 442cdf0e10cSrcweir 443cdf0e10cSrcweir void SAL_CALL TableDesignStyle::addModifyListener( const Reference< XModifyListener >& xListener ) throw (RuntimeException) 444cdf0e10cSrcweir { 445cdf0e10cSrcweir ClearableMutexGuard aGuard( rBHelper.rMutex ); 446cdf0e10cSrcweir if (rBHelper.bDisposed || rBHelper.bInDispose) 447cdf0e10cSrcweir { 448cdf0e10cSrcweir aGuard.clear(); 449cdf0e10cSrcweir EventObject aEvt( static_cast< OWeakObject * >( this ) ); 450cdf0e10cSrcweir xListener->disposing( aEvt ); 451cdf0e10cSrcweir } 452cdf0e10cSrcweir else 453cdf0e10cSrcweir { 454cdf0e10cSrcweir rBHelper.addListener( XModifyListener::static_type(), xListener ); 455cdf0e10cSrcweir } 456cdf0e10cSrcweir } 457cdf0e10cSrcweir 458cdf0e10cSrcweir //------------------------------------------------------------------------ 459cdf0e10cSrcweir 460cdf0e10cSrcweir void SAL_CALL TableDesignStyle::removeModifyListener( const Reference< XModifyListener >& xListener ) throw (RuntimeException) 461cdf0e10cSrcweir { 462cdf0e10cSrcweir rBHelper.removeListener( XModifyListener::static_type(), xListener ); 463cdf0e10cSrcweir } 464cdf0e10cSrcweir 465cdf0e10cSrcweir //------------------------------------------------------------------------ 466cdf0e10cSrcweir 467cdf0e10cSrcweir void TableDesignStyle::notifyModifyListener() 468cdf0e10cSrcweir { 469cdf0e10cSrcweir MutexGuard aGuard( rBHelper.rMutex ); 470cdf0e10cSrcweir 471cdf0e10cSrcweir OInterfaceContainerHelper * pContainer = rBHelper.getContainer( XModifyListener::static_type() ); 472cdf0e10cSrcweir if( pContainer ) 473cdf0e10cSrcweir { 474cdf0e10cSrcweir EventObject aEvt( static_cast< OWeakObject * >( this ) ); 475cdf0e10cSrcweir pContainer->forEach<XModifyListener>( boost::bind( &XModifyListener::modified, _1, boost::cref( aEvt ) ) ); 476cdf0e10cSrcweir } 477cdf0e10cSrcweir } 478cdf0e10cSrcweir 479cdf0e10cSrcweir //------------------------------------------------------------------------ 480cdf0e10cSrcweir // XModifyListener 481cdf0e10cSrcweir //------------------------------------------------------------------------ 482cdf0e10cSrcweir 483cdf0e10cSrcweir // if we get a modify hint from a style, notify all registered XModifyListener 484cdf0e10cSrcweir void SAL_CALL TableDesignStyle::modified( const ::com::sun::star::lang::EventObject& ) throw (::com::sun::star::uno::RuntimeException) 485cdf0e10cSrcweir { 486cdf0e10cSrcweir notifyModifyListener(); 487cdf0e10cSrcweir } 488cdf0e10cSrcweir 489cdf0e10cSrcweir //------------------------------------------------------------------------ 490cdf0e10cSrcweir 491cdf0e10cSrcweir void SAL_CALL TableDesignStyle::disposing( const ::com::sun::star::lang::EventObject& ) throw (::com::sun::star::uno::RuntimeException) 492cdf0e10cSrcweir { 493cdf0e10cSrcweir } 494cdf0e10cSrcweir 495cdf0e10cSrcweir //------------------------------------------------------------------------ 496cdf0e10cSrcweir // TableStyle 497cdf0e10cSrcweir //------------------------------------------------------------------------ 498cdf0e10cSrcweir 499cdf0e10cSrcweir // ---------------------------------------------------------- 500cdf0e10cSrcweir // XServiceInfo 501cdf0e10cSrcweir // ---------------------------------------------------------- 502cdf0e10cSrcweir 503cdf0e10cSrcweir OUString SAL_CALL TableDesignFamily::getImplementationName() throw(RuntimeException) 504cdf0e10cSrcweir { 505cdf0e10cSrcweir return OUString( RTL_CONSTASCII_USTRINGPARAM("TableDesignFamily") ); 506cdf0e10cSrcweir } 507cdf0e10cSrcweir 508cdf0e10cSrcweir // ---------------------------------------------------------- 509cdf0e10cSrcweir 510cdf0e10cSrcweir sal_Bool SAL_CALL TableDesignFamily::supportsService( const OUString& ServiceName ) throw(RuntimeException) 511cdf0e10cSrcweir { 512cdf0e10cSrcweir return comphelper::ServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() ); 513cdf0e10cSrcweir } 514cdf0e10cSrcweir 515cdf0e10cSrcweir // ---------------------------------------------------------- 516cdf0e10cSrcweir 517cdf0e10cSrcweir Sequence< OUString > SAL_CALL TableDesignFamily::getSupportedServiceNames() throw(RuntimeException) 518cdf0e10cSrcweir { 519cdf0e10cSrcweir OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.style.StyleFamily") ); 520cdf0e10cSrcweir Sequence< OUString > aSeq( &aServiceName, 1 ); 521cdf0e10cSrcweir return aSeq; 522cdf0e10cSrcweir } 523cdf0e10cSrcweir 524cdf0e10cSrcweir // ---------------------------------------------------------- 525cdf0e10cSrcweir // XNamed 526cdf0e10cSrcweir // ---------------------------------------------------------- 527cdf0e10cSrcweir 528cdf0e10cSrcweir OUString SAL_CALL TableDesignFamily::getName() throw (RuntimeException) 529cdf0e10cSrcweir { 530cdf0e10cSrcweir return OUString( RTL_CONSTASCII_USTRINGPARAM( "table" ) ); 531cdf0e10cSrcweir } 532cdf0e10cSrcweir 533cdf0e10cSrcweir // ---------------------------------------------------------- 534cdf0e10cSrcweir 535cdf0e10cSrcweir void SAL_CALL TableDesignFamily::setName( const OUString& ) throw (RuntimeException) 536cdf0e10cSrcweir { 537cdf0e10cSrcweir } 538cdf0e10cSrcweir 539cdf0e10cSrcweir // ---------------------------------------------------------- 540cdf0e10cSrcweir // XNameAccess 541cdf0e10cSrcweir // ---------------------------------------------------------- 542cdf0e10cSrcweir 543cdf0e10cSrcweir Any SAL_CALL TableDesignFamily::getByName( const OUString& rName ) throw(NoSuchElementException, WrappedTargetException, RuntimeException) 544cdf0e10cSrcweir { 545cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 546cdf0e10cSrcweir 547cdf0e10cSrcweir for( TableDesignStyleVector::iterator iter( maDesigns.begin() ); iter != maDesigns.end(); iter++ ) 548cdf0e10cSrcweir { 549cdf0e10cSrcweir if( (*iter)->getName() == rName ) 550cdf0e10cSrcweir return Any( (*iter) ); 551cdf0e10cSrcweir } 552cdf0e10cSrcweir 553cdf0e10cSrcweir throw NoSuchElementException(); 554cdf0e10cSrcweir } 555cdf0e10cSrcweir 556cdf0e10cSrcweir // ---------------------------------------------------------- 557cdf0e10cSrcweir 558cdf0e10cSrcweir Sequence< OUString > SAL_CALL TableDesignFamily::getElementNames() throw(RuntimeException) 559cdf0e10cSrcweir { 560cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 561cdf0e10cSrcweir 562cdf0e10cSrcweir Sequence< OUString > aRet( maDesigns.size() ); 563cdf0e10cSrcweir OUString* pNames = aRet.getArray(); 564cdf0e10cSrcweir 565cdf0e10cSrcweir for( TableDesignStyleVector::iterator iter( maDesigns.begin() ); iter != maDesigns.end(); iter++ ) 566cdf0e10cSrcweir *pNames++ = (*iter)->getName(); 567cdf0e10cSrcweir 568cdf0e10cSrcweir return aRet; 569cdf0e10cSrcweir } 570cdf0e10cSrcweir 571cdf0e10cSrcweir // ---------------------------------------------------------- 572cdf0e10cSrcweir 573cdf0e10cSrcweir sal_Bool SAL_CALL TableDesignFamily::hasByName( const OUString& aName ) throw(RuntimeException) 574cdf0e10cSrcweir { 575cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 576cdf0e10cSrcweir 577cdf0e10cSrcweir for( TableDesignStyleVector::iterator iter( maDesigns.begin() ); iter != maDesigns.end(); iter++ ) 578cdf0e10cSrcweir if( (*iter)->getName() == aName ) 579cdf0e10cSrcweir return sal_True; 580cdf0e10cSrcweir 581cdf0e10cSrcweir return sal_False; 582cdf0e10cSrcweir } 583cdf0e10cSrcweir 584cdf0e10cSrcweir // ---------------------------------------------------------- 585cdf0e10cSrcweir // XElementAccess 586cdf0e10cSrcweir // ---------------------------------------------------------- 587cdf0e10cSrcweir 588cdf0e10cSrcweir Type SAL_CALL TableDesignFamily::getElementType() throw(RuntimeException) 589cdf0e10cSrcweir { 590cdf0e10cSrcweir return XStyle::static_type(); 591cdf0e10cSrcweir } 592cdf0e10cSrcweir 593cdf0e10cSrcweir // ---------------------------------------------------------- 594cdf0e10cSrcweir 595cdf0e10cSrcweir sal_Bool SAL_CALL TableDesignFamily::hasElements() throw(RuntimeException) 596cdf0e10cSrcweir { 597cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 598cdf0e10cSrcweir 599cdf0e10cSrcweir return maDesigns.empty() ? sal_False : sal_True; 600cdf0e10cSrcweir } 601cdf0e10cSrcweir 602cdf0e10cSrcweir // ---------------------------------------------------------- 603cdf0e10cSrcweir // XIndexAccess 604cdf0e10cSrcweir // ---------------------------------------------------------- 605cdf0e10cSrcweir 606cdf0e10cSrcweir sal_Int32 SAL_CALL TableDesignFamily::getCount() throw(RuntimeException) 607cdf0e10cSrcweir { 608cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 609cdf0e10cSrcweir 610cdf0e10cSrcweir return sal::static_int_cast< sal_Int32 >( maDesigns.size() ); 611cdf0e10cSrcweir } 612cdf0e10cSrcweir 613cdf0e10cSrcweir // ---------------------------------------------------------- 614cdf0e10cSrcweir 615cdf0e10cSrcweir Any SAL_CALL TableDesignFamily::getByIndex( sal_Int32 Index ) throw(IndexOutOfBoundsException, WrappedTargetException, RuntimeException) 616cdf0e10cSrcweir { 617cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 618cdf0e10cSrcweir 619cdf0e10cSrcweir if( (Index >= 0) && (Index < sal::static_int_cast< sal_Int32 >( maDesigns.size() ) ) ) 620cdf0e10cSrcweir return Any( maDesigns[Index] ); 621cdf0e10cSrcweir 622cdf0e10cSrcweir throw IndexOutOfBoundsException(); 623cdf0e10cSrcweir } 624cdf0e10cSrcweir 625cdf0e10cSrcweir // ---------------------------------------------------------- 626cdf0e10cSrcweir // XNameContainer 627cdf0e10cSrcweir // ---------------------------------------------------------- 628cdf0e10cSrcweir 629cdf0e10cSrcweir void SAL_CALL TableDesignFamily::insertByName( const OUString& rName, const Any& rElement ) throw(IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException) 630cdf0e10cSrcweir { 631cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 632cdf0e10cSrcweir 633cdf0e10cSrcweir Reference< XStyle > xStyle( rElement, UNO_QUERY ); 634cdf0e10cSrcweir if( !xStyle.is() ) 635cdf0e10cSrcweir throw IllegalArgumentException(); 636cdf0e10cSrcweir 637cdf0e10cSrcweir xStyle->setName( rName ); 638cdf0e10cSrcweir for( TableDesignStyleVector::iterator iter( maDesigns.begin() ); iter != maDesigns.end(); iter++ ) 639cdf0e10cSrcweir if( (*iter)->getName() == rName ) 640cdf0e10cSrcweir throw ElementExistException(); 641cdf0e10cSrcweir 642cdf0e10cSrcweir maDesigns.push_back( xStyle ); 643cdf0e10cSrcweir } 644cdf0e10cSrcweir 645cdf0e10cSrcweir // ---------------------------------------------------------- 646cdf0e10cSrcweir 647cdf0e10cSrcweir void SAL_CALL TableDesignFamily::removeByName( const OUString& rName ) throw(NoSuchElementException, WrappedTargetException, RuntimeException) 648cdf0e10cSrcweir { 649cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 650cdf0e10cSrcweir 651cdf0e10cSrcweir for( TableDesignStyleVector::iterator iter( maDesigns.begin() ); iter != maDesigns.end(); iter++ ) 652cdf0e10cSrcweir { 653cdf0e10cSrcweir if( (*iter)->getName() == rName ) 654cdf0e10cSrcweir { 655cdf0e10cSrcweir maDesigns.erase( iter ); 656cdf0e10cSrcweir return; 657cdf0e10cSrcweir } 658cdf0e10cSrcweir } 659cdf0e10cSrcweir 660cdf0e10cSrcweir 661cdf0e10cSrcweir throw NoSuchElementException(); 662cdf0e10cSrcweir } 663cdf0e10cSrcweir 664cdf0e10cSrcweir // ---------------------------------------------------------- 665cdf0e10cSrcweir // XNameReplace 666cdf0e10cSrcweir // ---------------------------------------------------------- 667cdf0e10cSrcweir 668cdf0e10cSrcweir void SAL_CALL TableDesignFamily::replaceByName( const OUString& rName, const Any& aElement ) throw(IllegalArgumentException, NoSuchElementException, WrappedTargetException, RuntimeException) 669cdf0e10cSrcweir { 670cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 671cdf0e10cSrcweir 672cdf0e10cSrcweir Reference< XStyle > xStyle( aElement, UNO_QUERY ); 673cdf0e10cSrcweir if( !xStyle.is() ) 674cdf0e10cSrcweir throw IllegalArgumentException(); 675cdf0e10cSrcweir 676cdf0e10cSrcweir for( TableDesignStyleVector::iterator iter( maDesigns.begin() ); iter != maDesigns.end(); iter++ ) 677cdf0e10cSrcweir { 678cdf0e10cSrcweir if( (*iter)->getName() == rName ) 679cdf0e10cSrcweir { 680cdf0e10cSrcweir (*iter) = xStyle; 681cdf0e10cSrcweir xStyle->setName( rName ); 682cdf0e10cSrcweir return; 683cdf0e10cSrcweir } 684cdf0e10cSrcweir } 685cdf0e10cSrcweir 686cdf0e10cSrcweir throw NoSuchElementException(); 687cdf0e10cSrcweir } 688cdf0e10cSrcweir 689cdf0e10cSrcweir // ---------------------------------------------------------- 690cdf0e10cSrcweir // XSingleServiceFactory 691cdf0e10cSrcweir // ---------------------------------------------------------- 692cdf0e10cSrcweir 693cdf0e10cSrcweir Reference< XInterface > SAL_CALL TableDesignFamily::createInstance() throw(Exception, RuntimeException) 694cdf0e10cSrcweir { 695cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 696cdf0e10cSrcweir 697cdf0e10cSrcweir return Reference< XInterface >( static_cast< XStyle* >( new TableDesignStyle ) ); 698cdf0e10cSrcweir } 699cdf0e10cSrcweir 700cdf0e10cSrcweir // ---------------------------------------------------------- 701cdf0e10cSrcweir 702cdf0e10cSrcweir Reference< XInterface > SAL_CALL TableDesignFamily::createInstanceWithArguments( const Sequence< Any >& ) throw(Exception, RuntimeException) 703cdf0e10cSrcweir { 704cdf0e10cSrcweir return createInstance(); 705cdf0e10cSrcweir } 706cdf0e10cSrcweir 707cdf0e10cSrcweir // ---------------------------------------------------------- 708cdf0e10cSrcweir // XComponent 709cdf0e10cSrcweir // ---------------------------------------------------------- 710cdf0e10cSrcweir 711cdf0e10cSrcweir void SAL_CALL TableDesignFamily::dispose( ) throw (RuntimeException) 712cdf0e10cSrcweir { 713cdf0e10cSrcweir TableDesignStyleVector aDesigns; 714cdf0e10cSrcweir aDesigns.swap( maDesigns ); 715cdf0e10cSrcweir 716cdf0e10cSrcweir for( TableDesignStyleVector::iterator iter( aDesigns.begin() ); iter != aDesigns.end(); iter++ ) 717cdf0e10cSrcweir { 718cdf0e10cSrcweir Reference< XComponent > xComp( (*iter), UNO_QUERY ); 719cdf0e10cSrcweir if( xComp.is() ) 720cdf0e10cSrcweir xComp->dispose(); 721cdf0e10cSrcweir } 722cdf0e10cSrcweir } 723cdf0e10cSrcweir 724cdf0e10cSrcweir // ---------------------------------------------------------- 725cdf0e10cSrcweir 726cdf0e10cSrcweir void SAL_CALL TableDesignFamily::addEventListener( const Reference< XEventListener >& ) throw (RuntimeException) 727cdf0e10cSrcweir { 728cdf0e10cSrcweir } 729cdf0e10cSrcweir 730cdf0e10cSrcweir // ---------------------------------------------------------- 731cdf0e10cSrcweir 732cdf0e10cSrcweir void SAL_CALL TableDesignFamily::removeEventListener( const Reference< XEventListener >& ) throw (RuntimeException) 733cdf0e10cSrcweir { 734cdf0e10cSrcweir } 735cdf0e10cSrcweir 736cdf0e10cSrcweir // ---------------------------------------------------------- 737cdf0e10cSrcweir // XPropertySet 738cdf0e10cSrcweir // ---------------------------------------------------------- 739cdf0e10cSrcweir 740cdf0e10cSrcweir Reference<XPropertySetInfo> TableDesignFamily::getPropertySetInfo() throw (RuntimeException) 741cdf0e10cSrcweir { 742cdf0e10cSrcweir OSL_ENSURE( 0, "###unexpected!" ); 743cdf0e10cSrcweir return Reference<XPropertySetInfo>(); 744cdf0e10cSrcweir } 745cdf0e10cSrcweir 746cdf0e10cSrcweir // ---------------------------------------------------------- 747cdf0e10cSrcweir 748cdf0e10cSrcweir void TableDesignFamily::setPropertyValue( const OUString& , const Any& ) throw (UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException) 749cdf0e10cSrcweir { 750cdf0e10cSrcweir OSL_ENSURE( 0, "###unexpected!" ); 751cdf0e10cSrcweir } 752cdf0e10cSrcweir 753cdf0e10cSrcweir // ---------------------------------------------------------- 754cdf0e10cSrcweir 755cdf0e10cSrcweir Any TableDesignFamily::getPropertyValue( const OUString& PropertyName ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException) 756cdf0e10cSrcweir { 757cdf0e10cSrcweir if (PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("DisplayName") )) 758cdf0e10cSrcweir { 759cdf0e10cSrcweir OUString sDisplayName( SVX_RESSTR( RID_SVXSTR_STYLEFAMILY_TABLEDESIGN ) ); 760cdf0e10cSrcweir return Any( sDisplayName ); 761cdf0e10cSrcweir } 762cdf0e10cSrcweir else 763cdf0e10cSrcweir { 764cdf0e10cSrcweir throw UnknownPropertyException( OUString( RTL_CONSTASCII_USTRINGPARAM("unknown property: ") ) + PropertyName, static_cast<OWeakObject *>(this) ); 765cdf0e10cSrcweir } 766cdf0e10cSrcweir } 767cdf0e10cSrcweir 768cdf0e10cSrcweir // ---------------------------------------------------------- 769cdf0e10cSrcweir 770cdf0e10cSrcweir void TableDesignFamily::addPropertyChangeListener( const OUString& , const Reference<XPropertyChangeListener>& ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException) 771cdf0e10cSrcweir { 772cdf0e10cSrcweir OSL_ENSURE( 0, "###unexpected!" ); 773cdf0e10cSrcweir } 774cdf0e10cSrcweir 775cdf0e10cSrcweir // ---------------------------------------------------------- 776cdf0e10cSrcweir 777cdf0e10cSrcweir void TableDesignFamily::removePropertyChangeListener( const OUString& , const Reference<XPropertyChangeListener>& ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException) 778cdf0e10cSrcweir { 779cdf0e10cSrcweir OSL_ENSURE( 0, "###unexpected!" ); 780cdf0e10cSrcweir } 781cdf0e10cSrcweir 782cdf0e10cSrcweir // ---------------------------------------------------------- 783cdf0e10cSrcweir 784cdf0e10cSrcweir void TableDesignFamily::addVetoableChangeListener( const OUString& , const Reference<XVetoableChangeListener>& ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException) 785cdf0e10cSrcweir { 786cdf0e10cSrcweir OSL_ENSURE( 0, "###unexpected!" ); 787cdf0e10cSrcweir } 788cdf0e10cSrcweir 789cdf0e10cSrcweir // ---------------------------------------------------------- 790cdf0e10cSrcweir 791cdf0e10cSrcweir void TableDesignFamily::removeVetoableChangeListener( const OUString& , const Reference<XVetoableChangeListener>& ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException) 792cdf0e10cSrcweir { 793cdf0e10cSrcweir OSL_ENSURE( 0, "###unexpected!" ); 794cdf0e10cSrcweir } 795cdf0e10cSrcweir 796cdf0e10cSrcweir // -------------------------------------------------------------------- 797cdf0e10cSrcweir 798cdf0e10cSrcweir 799cdf0e10cSrcweir SVX_DLLPUBLIC Reference< XNameAccess > CreateTableDesignFamily() 800cdf0e10cSrcweir { 801cdf0e10cSrcweir return new TableDesignFamily(); 802cdf0e10cSrcweir } 803cdf0e10cSrcweir 804cdf0e10cSrcweir } } 805