Files
libreoffice/svx/source/table/tabledesign.cxx

780 lines
26 KiB
C++
Raw Normal View History

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
re-base on ALv2 code. Includes: Patch contributed by Christian Lippka impress212: #i113063# patch: dubios self assign in svx/source/dialog/framelink.cxx http://svn.apache.org/viewvc?view=revision&revision=1167619 Patches contributed by Mathias Bauer gnumake4 work variously http://svn.apache.org/viewvc?view=revision&revision=1394707 http://svn.apache.org/viewvc?view=revision&revision=1394326 cws mba34issues01: #i117712#: fix several resource errors introduced by IAccessible2 implementation http://svn.apache.org/viewvc?view=revision&revision=1172343 cws mba34issues01: #i117719#: use correct resource ID http://svn.apache.org/viewvc?view=revision&revision=1172351 Patch contributed by Andre Fischer Do not add targets for junit tests when junit is disabled. http://svn.apache.org/viewvc?view=revision&revision=1241508 Patches contributed by Armin Le-Grand #118804# corrected GraphicExporter behaviour on shortcut when pixel graphic is requested http://svn.apache.org/viewvc?view=revision&revision=1240195 fix for #118525#: Using primitives for chart sub-geometry visualisation http://svn.apache.org/viewvc?view=revision&revision=1226879 #118485# - Styles for OLEs are not saved. http://svn.apache.org/viewvc?view=revision&revision=1182166 #118524: apply patch, followup fixes to 118485 http://svn.apache.org/viewvc?view=revision&revision=1186077 13f79535-47bb-0310-9956-ffa450edef68 Patch contributed by Regina Henschel linecap: Reintegrating finished LineCap feature http://svn.apache.org/viewvc?view=revision&revision=1232507 Patch contributed by Wang Lei (leiw) #i118760# split the first table cell vertically, then undo&redo, the Presentation app will crash http://svn.apache.org/viewvc?view=revision&revision=1301361 cleanup globlmn hacks, undo dependent fixmes.
2012-11-21 22:06:52 +00:00
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include <com/sun/star/style/XStyle.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
#include <com/sun/star/container/XIndexAccess.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/util/XModifyBroadcaster.hpp>
#include <com/sun/star/util/XModifyListener.hpp>
#include <osl/mutex.hxx>
#include <vcl/svapp.hxx>
#include <cppuhelper/basemutex.hxx>
#include <cppuhelper/compbase6.hxx>
#include <cppuhelper/implbase7.hxx>
#include <cppuhelper/interfacecontainer.h>
#include <cppuhelper/supportsservice.hxx>
#include "svx/unoprov.hxx"
#include "svx/sdr/table/tabledesign.hxx"
CWS-TOOLING: integrate CWS fwk98 2008-12-12 22:28:04 +0100 pb r265444 : fix: #i44211# precompiled directive was missed 2008-12-11 10:43:34 +0100 pb r265262 : fix: #i87952# #i84982# SID_INSERT_APPLET and SID_CHAR_DLG_FOR_PARAGRAPH not configurable any longer 2008-12-11 10:40:05 +0100 pb r265261 : fix: #i64346# SID_MAIL_SENDDOCASFORMAT not configurable any longer 2008-12-11 10:36:53 +0100 pb r265260 : fix: #i41265# #i64346# ui name for MacroOrganizer and SendMailDocAs... 2008-12-11 10:29:07 +0100 pb r265258 : fix: #i60617# #i92080# ui name for ContinueNumbering and SaveGraphic 2008-12-11 10:25:52 +0100 pb r265256 : fix: #i80850# ui name for ToggleFormula and AssignMacro 2008-12-08 14:16:20 +0100 pb r264996 : fix: #i44211# querytemplate.obj added 2008-12-08 12:54:02 +0100 pb r264992 : fix: #i44211# use the new query template box 2008-12-08 12:50:45 +0100 pb r264991 : fix: #i44211# STR_QRYTEMPL_... added 2008-12-08 12:48:21 +0100 pb r264990 : fix: #i44211# new query box 2008-12-02 11:06:54 +0100 pb r264681 : fix: #i88478# ScStyleFamilyObj: XPropertySet support added 2008-12-02 11:05:29 +0100 pb r264680 : fix: #i88478# STR_STYLE_FAMILY_... added 2008-12-02 11:03:22 +0100 pb r264679 : fix: #i88478# ScStyleFamilyObj: XPropertySet support added 2008-12-02 10:54:27 +0100 pb r264678 : fix: #i88478# STR_STYLE_FAMILY_... added 2008-12-02 10:50:16 +0100 pb r264677 : fix: #i88478# SwXStyleFamily: XpropertySet support added 2008-12-02 10:48:12 +0100 pb r264676 : fix: #i88478# STR_STYLE_FAMILY_... added 2008-12-02 10:45:46 +0100 pb r264674 : fix: #i88478# SwXStyleFamily: XpropertySet support added 2008-12-02 10:43:44 +0100 pb r264673 : fix: #i88478# STR_STYLE_FAMILY_... added 2008-12-02 10:40:45 +0100 pb r264671 : fix: #i88478# table.srs added 2008-12-02 10:37:45 +0100 pb r264669 : fix: #i88478# dummy text of DisplayName replaced 2008-12-02 10:35:26 +0100 pb r264668 : fix: #i88478# RID_SVXSTR_STYLEFAMILY_TABLEDESIGN added 2008-12-02 10:30:24 +0100 pb r264666 : fix: #i88478# RID_SVXSTR_STYLEFAMILY_TABLEDESIGN added 2008-11-24 10:42:03 +0100 pb r264214 : fix: #i92765# set search algorithm with sense 2008-11-24 07:02:31 +0100 pb r264194 : fix: #i61775# dont display more than 100 fonts 2008-11-24 06:15:20 +0100 pb r264193 : fix: #i96418# map module swxform to swriter for help 2008-11-20 11:34:21 +0100 pb r264035 : fix: #i93453# map 'swform' and 'swreport' to 'sdatabase' 2008-11-20 09:55:30 +0100 pb r264030 : fix: #i94023# after copy a ResId dont forget to set RT correctly
2009-01-06 17:37:13 +00:00
#include "svx/dialmgr.hxx"
#include "svx/dialogs.hrc"
#include "celltypes.hxx"
#include <vector>
#include <map>
#include <boost/bind.hpp>
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::style;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::util;
using namespace ::com::sun::star::container;
using ::osl::MutexGuard;
using ::osl::ClearableMutexGuard;
using ::cppu::OInterfaceContainerHelper;
namespace sdr { namespace table {
typedef std::map< OUString, sal_Int32 > CellStyleNameMap;
typedef ::cppu::WeakComponentImplHelper6< XStyle, XNameReplace, XServiceInfo, XIndexAccess, XModifyBroadcaster, XModifyListener > TableDesignStyleBase;
class TableDesignStyle : private ::cppu::BaseMutex, public TableDesignStyleBase
{
public:
TableDesignStyle();
// XServiceInfo
virtual OUString SAL_CALL getImplementationName() throw(RuntimeException, std::exception) SAL_OVERRIDE;
virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(RuntimeException, std::exception) SAL_OVERRIDE;
virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(RuntimeException, std::exception) SAL_OVERRIDE;
// XStyle
virtual sal_Bool SAL_CALL isUserDefined() throw (RuntimeException, std::exception) SAL_OVERRIDE;
virtual sal_Bool SAL_CALL isInUse() throw (RuntimeException, std::exception) SAL_OVERRIDE;
virtual OUString SAL_CALL getParentStyle() throw (RuntimeException, std::exception) SAL_OVERRIDE;
virtual void SAL_CALL setParentStyle( const OUString& aParentStyle ) throw (NoSuchElementException, RuntimeException, std::exception) SAL_OVERRIDE;
// XNamed
virtual OUString SAL_CALL getName() throw (RuntimeException, std::exception) SAL_OVERRIDE;
virtual void SAL_CALL setName( const OUString& aName ) throw (RuntimeException, std::exception) SAL_OVERRIDE;
// XNameAccess
virtual Any SAL_CALL getByName( const OUString& aName ) throw(NoSuchElementException, WrappedTargetException, RuntimeException, std::exception) SAL_OVERRIDE;
virtual Sequence< OUString > SAL_CALL getElementNames() throw(RuntimeException, std::exception) SAL_OVERRIDE;
virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) throw(RuntimeException, std::exception) SAL_OVERRIDE;
// XElementAccess
virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw(RuntimeException, std::exception) SAL_OVERRIDE;
virtual sal_Bool SAL_CALL hasElements() throw(RuntimeException, std::exception) SAL_OVERRIDE;
// XIndexAccess
virtual sal_Int32 SAL_CALL getCount() throw(RuntimeException, std::exception) SAL_OVERRIDE ;
virtual Any SAL_CALL getByIndex( sal_Int32 Index ) throw(IndexOutOfBoundsException, WrappedTargetException, RuntimeException, std::exception) SAL_OVERRIDE;
// XNameReplace
virtual void SAL_CALL replaceByName( const OUString& aName, const Any& aElement ) throw(IllegalArgumentException, NoSuchElementException, WrappedTargetException, RuntimeException, std::exception) SAL_OVERRIDE;
// XModifyBroadcaster
virtual void SAL_CALL addModifyListener( const Reference< XModifyListener >& aListener ) throw (RuntimeException, std::exception) SAL_OVERRIDE;
virtual void SAL_CALL removeModifyListener( const Reference< XModifyListener >& aListener ) throw (RuntimeException, std::exception) SAL_OVERRIDE;
// XModifyListener
virtual void SAL_CALL modified( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
void notifyModifyListener();
// this function is called upon disposing the component
virtual void SAL_CALL disposing() SAL_OVERRIDE;
static const CellStyleNameMap& getCellStyleNameMap();
OUString msName;
Reference< XStyle > maCellStyles[style_count];
};
typedef std::vector< Reference< XStyle > > TableDesignStyleVector;
class TableDesignFamily : public ::cppu::WeakImplHelper7< XNameContainer, XNamed, XIndexAccess, XSingleServiceFactory, XServiceInfo, XComponent, XPropertySet >
{
public:
// XServiceInfo
virtual OUString SAL_CALL getImplementationName() throw(RuntimeException, std::exception) SAL_OVERRIDE;
virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(RuntimeException, std::exception) SAL_OVERRIDE;
virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(RuntimeException, std::exception) SAL_OVERRIDE;
// XNamed
virtual OUString SAL_CALL getName( ) throw (RuntimeException, std::exception) SAL_OVERRIDE;
virtual void SAL_CALL setName( const OUString& aName ) throw (RuntimeException, std::exception) SAL_OVERRIDE;
// XNameAccess
virtual Any SAL_CALL getByName( const OUString& aName ) throw(NoSuchElementException, WrappedTargetException, RuntimeException, std::exception) SAL_OVERRIDE;
virtual Sequence< OUString > SAL_CALL getElementNames() throw(RuntimeException, std::exception) SAL_OVERRIDE;
virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) throw(RuntimeException, std::exception) SAL_OVERRIDE;
// XElementAccess
virtual Type SAL_CALL getElementType() throw(RuntimeException, std::exception) SAL_OVERRIDE;
virtual sal_Bool SAL_CALL hasElements() throw(RuntimeException, std::exception) SAL_OVERRIDE;
// XIndexAccess
virtual sal_Int32 SAL_CALL getCount() throw(RuntimeException, std::exception) SAL_OVERRIDE ;
virtual Any SAL_CALL getByIndex( sal_Int32 Index ) throw(IndexOutOfBoundsException, WrappedTargetException, RuntimeException, std::exception) SAL_OVERRIDE;
// XNameContainer
virtual void SAL_CALL insertByName( const OUString& aName, const Any& aElement ) throw(IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException, std::exception) SAL_OVERRIDE;
virtual void SAL_CALL removeByName( const OUString& Name ) throw(NoSuchElementException, WrappedTargetException, RuntimeException, std::exception) SAL_OVERRIDE;
// XNameReplace
virtual void SAL_CALL replaceByName( const OUString& aName, const Any& aElement ) throw(IllegalArgumentException, NoSuchElementException, WrappedTargetException, RuntimeException, std::exception) SAL_OVERRIDE;
// XSingleServiceFactory
virtual Reference< XInterface > SAL_CALL createInstance( ) throw(Exception, RuntimeException, std::exception) SAL_OVERRIDE;
virtual Reference< XInterface > SAL_CALL createInstanceWithArguments( const Sequence< Any >& aArguments ) throw(Exception, RuntimeException, std::exception) SAL_OVERRIDE;
// XComponent
virtual void SAL_CALL dispose( ) throw (RuntimeException, std::exception) SAL_OVERRIDE;
virtual void SAL_CALL addEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException, std::exception) SAL_OVERRIDE;
virtual void SAL_CALL removeEventListener( const Reference< XEventListener >& aListener ) throw (RuntimeException, std::exception) SAL_OVERRIDE;
// XPropertySet
virtual Reference<XPropertySetInfo> SAL_CALL getPropertySetInfo() throw (RuntimeException, std::exception) SAL_OVERRIDE;
virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const Any& aValue ) throw (UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException, std::exception) SAL_OVERRIDE;
virtual Any SAL_CALL getPropertyValue( const OUString& PropertyName ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException, std::exception) SAL_OVERRIDE;
virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const Reference<XPropertyChangeListener>& xListener ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException, std::exception) SAL_OVERRIDE;
virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const Reference<XPropertyChangeListener>& aListener ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException, std::exception) SAL_OVERRIDE;
virtual void SAL_CALL addVetoableChangeListener(const OUString& PropertyName, const Reference<XVetoableChangeListener>& aListener ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException, std::exception) SAL_OVERRIDE;
virtual void SAL_CALL removeVetoableChangeListener(const OUString& PropertyName,const Reference<XVetoableChangeListener>&aListener ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException, std::exception) SAL_OVERRIDE;
TableDesignStyleVector maDesigns;
};
TableDesignStyle::TableDesignStyle()
: TableDesignStyleBase(m_aMutex)
{
}
const CellStyleNameMap& TableDesignStyle::getCellStyleNameMap()
{
static CellStyleNameMap aMap;
if( aMap.empty() )
{
CellStyleNameMap aNewMap;
aNewMap[ OUString( "first-row" ) ] = first_row_style;
aNewMap[ OUString( "last-row" ) ] = last_row_style;
aNewMap[ OUString( "first-column" ) ] = first_column_style;
aNewMap[ OUString( "last-column" ) ] = last_column_style;
aNewMap[ OUString( "body" ) ] = body_style;
aNewMap[ OUString( "even-rows" ) ] = even_rows_style;
aNewMap[ OUString( "odd-rows" ) ] = odd_rows_style;
aNewMap[ OUString( "even-columns" ) ] = even_columns_style;
aNewMap[ OUString( "odd-columns" ) ] = odd_columns_style;
aNewMap[ OUString( "background" ) ] = background_style;
aMap.swap( aNewMap );
}
return aMap;
}
// XServiceInfo
OUString SAL_CALL TableDesignStyle::getImplementationName() throw(RuntimeException, std::exception)
{
return OUString("TableDesignStyle");
}
sal_Bool SAL_CALL TableDesignStyle::supportsService( const OUString& ServiceName ) throw(RuntimeException, std::exception)
{
return cppu::supportsService( this, ServiceName );
}
Sequence< OUString > SAL_CALL TableDesignStyle::getSupportedServiceNames() throw(RuntimeException, std::exception)
{
OUString aServiceName("com.sun.star.style.Style");
Sequence< OUString > aSeq( &aServiceName, 1 );
return aSeq;
}
// XStyle
sal_Bool SAL_CALL TableDesignStyle::isUserDefined() throw (RuntimeException, std::exception)
{
return sal_False;
}
sal_Bool SAL_CALL TableDesignStyle::isInUse() throw (RuntimeException, std::exception)
{
ClearableMutexGuard aGuard( rBHelper.rMutex );
OInterfaceContainerHelper * pContainer = rBHelper.getContainer( cppu::UnoType<XModifyListener>::get() );
if( pContainer )
{
Sequence< Reference< XInterface > > aListener( pContainer->getElements() );
aGuard.clear();
sal_Int32 nIndex = aListener.getLength();
while( --nIndex >= 0 )
{
TableDesignUser* pUser = dynamic_cast< TableDesignUser* >( aListener[nIndex].get() );
if( pUser && pUser->isInUse() )
return sal_True;
}
}
return sal_False;
}
OUString SAL_CALL TableDesignStyle::getParentStyle() throw (RuntimeException, std::exception)
{
return OUString();
}
void SAL_CALL TableDesignStyle::setParentStyle( const OUString& ) throw (NoSuchElementException, RuntimeException, std::exception)
{
}
// XNamed
OUString SAL_CALL TableDesignStyle::getName() throw (RuntimeException, std::exception)
{
return msName;
}
void SAL_CALL TableDesignStyle::setName( const OUString& rName ) throw (RuntimeException, std::exception)
{
msName = rName;
}
// XNameAccess
Any SAL_CALL TableDesignStyle::getByName( const OUString& rName ) throw(NoSuchElementException, WrappedTargetException, RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
const CellStyleNameMap& rMap = getCellStyleNameMap();
CellStyleNameMap::const_iterator iter = rMap.find( rName );
if( iter == rMap.end() )
throw NoSuchElementException();
return Any( maCellStyles[(*iter).second] );
}
Sequence< OUString > SAL_CALL TableDesignStyle::getElementNames() throw(RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
const CellStyleNameMap& rMap = getCellStyleNameMap();
Sequence< OUString > aRet( rMap.size() );
OUString* pName = aRet.getArray();
CellStyleNameMap::const_iterator iter = rMap.begin();
while( iter != rMap.end() )
*pName++ = (*iter++).first;
return aRet;
}
sal_Bool SAL_CALL TableDesignStyle::hasByName( const OUString& rName ) throw(RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
const CellStyleNameMap& rMap = getCellStyleNameMap();
CellStyleNameMap::const_iterator iter = rMap.find( rName );
return ( iter != rMap.end() ) ? sal_True : sal_False;
}
// XElementAccess
Type SAL_CALL TableDesignStyle::getElementType() throw(RuntimeException, std::exception)
{
return cppu::UnoType<XStyle>::get();
}
sal_Bool SAL_CALL TableDesignStyle::hasElements() throw(RuntimeException, std::exception)
{
return sal_True;
}
// XIndexAccess
sal_Int32 SAL_CALL TableDesignStyle::getCount() throw(RuntimeException, std::exception)
{
return style_count;
}
Any SAL_CALL TableDesignStyle::getByIndex( sal_Int32 Index ) throw(IndexOutOfBoundsException, WrappedTargetException, RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
if( (Index < 0) || (Index >= style_count) )
throw IndexOutOfBoundsException();
return Any( maCellStyles[Index] );
}
// XNameReplace
void SAL_CALL TableDesignStyle::replaceByName( const OUString& rName, const Any& aElement ) throw(IllegalArgumentException, NoSuchElementException, WrappedTargetException, RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
const CellStyleNameMap& rMap = getCellStyleNameMap();
CellStyleNameMap::const_iterator iter = rMap.find( rName );
if( iter == rMap.end() )
throw NoSuchElementException();
Reference< XStyle > xNewStyle;
if( !(aElement >>= xNewStyle) )
throw IllegalArgumentException();
const sal_Int32 nIndex = (*iter).second;
Reference< XStyle > xOldStyle( maCellStyles[nIndex] );
if( xNewStyle != xOldStyle )
{
Reference< XModifyListener > xListener( this );
// end listening to old style, if possible
Reference< XModifyBroadcaster > xOldBroadcaster( xOldStyle, UNO_QUERY );
if( xOldBroadcaster.is() )
xOldBroadcaster->removeModifyListener( xListener );
// start listening to new style, if possible
Reference< XModifyBroadcaster > xNewBroadcaster( xNewStyle, UNO_QUERY );
if( xNewBroadcaster.is() )
xNewBroadcaster->addModifyListener( xListener );
maCellStyles[nIndex] = xNewStyle;
}
}
// XComponent
void SAL_CALL TableDesignStyle::disposing()
{
for( sal_Int32 nIndex = 0; nIndex < style_count; nIndex++ )
maCellStyles[nIndex].clear();
}
// XModifyBroadcaster
void SAL_CALL TableDesignStyle::addModifyListener( const Reference< XModifyListener >& xListener ) throw (RuntimeException, std::exception)
{
ClearableMutexGuard aGuard( rBHelper.rMutex );
if (rBHelper.bDisposed || rBHelper.bInDispose)
{
aGuard.clear();
EventObject aEvt( static_cast< OWeakObject * >( this ) );
xListener->disposing( aEvt );
}
else
{
rBHelper.addListener( cppu::UnoType<XModifyListener>::get(), xListener );
}
}
void SAL_CALL TableDesignStyle::removeModifyListener( const Reference< XModifyListener >& xListener ) throw (RuntimeException, std::exception)
{
rBHelper.removeListener( cppu::UnoType<XModifyListener>::get(), xListener );
}
void TableDesignStyle::notifyModifyListener()
{
MutexGuard aGuard( rBHelper.rMutex );
OInterfaceContainerHelper * pContainer = rBHelper.getContainer( cppu::UnoType<XModifyListener>::get() );
if( pContainer )
{
EventObject aEvt( static_cast< OWeakObject * >( this ) );
pContainer->forEach<XModifyListener>( boost::bind( &XModifyListener::modified, _1, boost::cref( aEvt ) ) );
}
}
// XModifyListener
// if we get a modify hint from a style, notify all registered XModifyListener
void SAL_CALL TableDesignStyle::modified( const ::com::sun::star::lang::EventObject& ) throw (::com::sun::star::uno::RuntimeException, std::exception)
{
notifyModifyListener();
}
void SAL_CALL TableDesignStyle::disposing( const ::com::sun::star::lang::EventObject& ) throw (::com::sun::star::uno::RuntimeException, std::exception)
{
}
// TableStyle
// XServiceInfo
OUString SAL_CALL TableDesignFamily::getImplementationName() throw(RuntimeException, std::exception)
{
return OUString("TableDesignFamily");
}
sal_Bool SAL_CALL TableDesignFamily::supportsService( const OUString& ServiceName ) throw(RuntimeException, std::exception)
{
return cppu::supportsService( this, ServiceName );
}
Sequence< OUString > SAL_CALL TableDesignFamily::getSupportedServiceNames() throw(RuntimeException, std::exception)
{
OUString aServiceName("com.sun.star.style.StyleFamily");
Sequence< OUString > aSeq( &aServiceName, 1 );
return aSeq;
}
// XNamed
OUString SAL_CALL TableDesignFamily::getName() throw (RuntimeException, std::exception)
{
return OUString( "table" );
}
void SAL_CALL TableDesignFamily::setName( const OUString& ) throw (RuntimeException, std::exception)
{
}
// XNameAccess
Any SAL_CALL TableDesignFamily::getByName( const OUString& rName ) throw(NoSuchElementException, WrappedTargetException, RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
const TableDesignStyleVector::const_iterator aEnd( maDesigns.end() );
for( TableDesignStyleVector::const_iterator iter( maDesigns.begin() );
iter != aEnd; ++iter)
{
if( (*iter)->getName() == rName )
return Any( (*iter) );
}
throw NoSuchElementException();
}
Sequence< OUString > SAL_CALL TableDesignFamily::getElementNames() throw(RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
Sequence< OUString > aRet( maDesigns.size() );
OUString* pNames = aRet.getArray();
const TableDesignStyleVector::const_iterator aEnd( maDesigns.end() );
for( TableDesignStyleVector::const_iterator iter( maDesigns.begin() );
iter != aEnd; ++iter)
*pNames++ = (*iter)->getName();
return aRet;
}
sal_Bool SAL_CALL TableDesignFamily::hasByName( const OUString& aName ) throw(RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
const TableDesignStyleVector::const_iterator aEnd( maDesigns.end() );
for( TableDesignStyleVector::const_iterator iter( maDesigns.begin() );
iter != aEnd; ++iter)
if( (*iter)->getName() == aName )
return sal_True;
return sal_False;
}
// XElementAccess
Type SAL_CALL TableDesignFamily::getElementType() throw(RuntimeException, std::exception)
{
return cppu::UnoType<XStyle>::get();
}
sal_Bool SAL_CALL TableDesignFamily::hasElements() throw(RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
return maDesigns.empty() ? sal_False : sal_True;
}
// XIndexAccess
sal_Int32 SAL_CALL TableDesignFamily::getCount() throw(RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
return sal::static_int_cast< sal_Int32 >( maDesigns.size() );
}
Any SAL_CALL TableDesignFamily::getByIndex( sal_Int32 Index ) throw(IndexOutOfBoundsException, WrappedTargetException, RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
if( (Index >= 0) && (Index < sal::static_int_cast< sal_Int32 >( maDesigns.size() ) ) )
return Any( maDesigns[Index] );
throw IndexOutOfBoundsException();
}
// XNameContainer
void SAL_CALL TableDesignFamily::insertByName( const OUString& rName, const Any& rElement ) throw(IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
Reference< XStyle > xStyle( rElement, UNO_QUERY );
if( !xStyle.is() )
throw IllegalArgumentException();
xStyle->setName( rName );
const TableDesignStyleVector::const_iterator aEnd( maDesigns.end() );
for( TableDesignStyleVector::const_iterator iter( maDesigns.begin() );
iter != aEnd; ++iter)
if( (*iter)->getName() == rName )
throw ElementExistException();
maDesigns.push_back( xStyle );
}
void SAL_CALL TableDesignFamily::removeByName( const OUString& rName ) throw(NoSuchElementException, WrappedTargetException, RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
const TableDesignStyleVector::const_iterator aEnd( maDesigns.end() );
for( TableDesignStyleVector::iterator iter( maDesigns.begin() );
iter != aEnd; ++iter)
{
if( (*iter)->getName() == rName )
{
maDesigns.erase( iter );
return;
}
}
throw NoSuchElementException();
}
// XNameReplace
void SAL_CALL TableDesignFamily::replaceByName( const OUString& rName, const Any& aElement ) throw(IllegalArgumentException, NoSuchElementException, WrappedTargetException, RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
Reference< XStyle > xStyle( aElement, UNO_QUERY );
if( !xStyle.is() )
throw IllegalArgumentException();
const TableDesignStyleVector::const_iterator aEnd( maDesigns.end() );
for( TableDesignStyleVector::iterator iter( maDesigns.begin() );
iter != aEnd; ++iter)
{
if( (*iter)->getName() == rName )
{
(*iter) = xStyle;
xStyle->setName( rName );
return;
}
}
throw NoSuchElementException();
}
// XSingleServiceFactory
Reference< XInterface > SAL_CALL TableDesignFamily::createInstance() throw(Exception, RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
return Reference< XInterface >( static_cast< XStyle* >( new TableDesignStyle ) );
}
Reference< XInterface > SAL_CALL TableDesignFamily::createInstanceWithArguments( const Sequence< Any >& ) throw(Exception, RuntimeException, std::exception)
{
return createInstance();
}
// XComponent
void SAL_CALL TableDesignFamily::dispose( ) throw (RuntimeException, std::exception)
{
TableDesignStyleVector aDesigns;
aDesigns.swap( maDesigns );
2010-12-29 09:49:33 +01:00
for( TableDesignStyleVector::iterator iter( aDesigns.begin() ); iter != aDesigns.end(); ++iter )
{
Reference< XComponent > xComp( (*iter), UNO_QUERY );
if( xComp.is() )
xComp->dispose();
}
}
void SAL_CALL TableDesignFamily::addEventListener( const Reference< XEventListener >& ) throw (RuntimeException, std::exception)
{
}
void SAL_CALL TableDesignFamily::removeEventListener( const Reference< XEventListener >& ) throw (RuntimeException, std::exception)
{
}
// XPropertySet
Reference<XPropertySetInfo> TableDesignFamily::getPropertySetInfo() throw (RuntimeException, std::exception)
{
OSL_FAIL( "###unexpected!" );
return Reference<XPropertySetInfo>();
}
void TableDesignFamily::setPropertyValue( const OUString& , const Any& ) throw (UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException, std::exception)
{
OSL_FAIL( "###unexpected!" );
}
Any TableDesignFamily::getPropertyValue( const OUString& PropertyName ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException, std::exception)
{
if ( PropertyName == "DisplayName" )
{
CWS-TOOLING: integrate CWS fwk98 2008-12-12 22:28:04 +0100 pb r265444 : fix: #i44211# precompiled directive was missed 2008-12-11 10:43:34 +0100 pb r265262 : fix: #i87952# #i84982# SID_INSERT_APPLET and SID_CHAR_DLG_FOR_PARAGRAPH not configurable any longer 2008-12-11 10:40:05 +0100 pb r265261 : fix: #i64346# SID_MAIL_SENDDOCASFORMAT not configurable any longer 2008-12-11 10:36:53 +0100 pb r265260 : fix: #i41265# #i64346# ui name for MacroOrganizer and SendMailDocAs... 2008-12-11 10:29:07 +0100 pb r265258 : fix: #i60617# #i92080# ui name for ContinueNumbering and SaveGraphic 2008-12-11 10:25:52 +0100 pb r265256 : fix: #i80850# ui name for ToggleFormula and AssignMacro 2008-12-08 14:16:20 +0100 pb r264996 : fix: #i44211# querytemplate.obj added 2008-12-08 12:54:02 +0100 pb r264992 : fix: #i44211# use the new query template box 2008-12-08 12:50:45 +0100 pb r264991 : fix: #i44211# STR_QRYTEMPL_... added 2008-12-08 12:48:21 +0100 pb r264990 : fix: #i44211# new query box 2008-12-02 11:06:54 +0100 pb r264681 : fix: #i88478# ScStyleFamilyObj: XPropertySet support added 2008-12-02 11:05:29 +0100 pb r264680 : fix: #i88478# STR_STYLE_FAMILY_... added 2008-12-02 11:03:22 +0100 pb r264679 : fix: #i88478# ScStyleFamilyObj: XPropertySet support added 2008-12-02 10:54:27 +0100 pb r264678 : fix: #i88478# STR_STYLE_FAMILY_... added 2008-12-02 10:50:16 +0100 pb r264677 : fix: #i88478# SwXStyleFamily: XpropertySet support added 2008-12-02 10:48:12 +0100 pb r264676 : fix: #i88478# STR_STYLE_FAMILY_... added 2008-12-02 10:45:46 +0100 pb r264674 : fix: #i88478# SwXStyleFamily: XpropertySet support added 2008-12-02 10:43:44 +0100 pb r264673 : fix: #i88478# STR_STYLE_FAMILY_... added 2008-12-02 10:40:45 +0100 pb r264671 : fix: #i88478# table.srs added 2008-12-02 10:37:45 +0100 pb r264669 : fix: #i88478# dummy text of DisplayName replaced 2008-12-02 10:35:26 +0100 pb r264668 : fix: #i88478# RID_SVXSTR_STYLEFAMILY_TABLEDESIGN added 2008-12-02 10:30:24 +0100 pb r264666 : fix: #i88478# RID_SVXSTR_STYLEFAMILY_TABLEDESIGN added 2008-11-24 10:42:03 +0100 pb r264214 : fix: #i92765# set search algorithm with sense 2008-11-24 07:02:31 +0100 pb r264194 : fix: #i61775# dont display more than 100 fonts 2008-11-24 06:15:20 +0100 pb r264193 : fix: #i96418# map module swxform to swriter for help 2008-11-20 11:34:21 +0100 pb r264035 : fix: #i93453# map 'swform' and 'swreport' to 'sdatabase' 2008-11-20 09:55:30 +0100 pb r264030 : fix: #i94023# after copy a ResId dont forget to set RT correctly
2009-01-06 17:37:13 +00:00
OUString sDisplayName( SVX_RESSTR( RID_SVXSTR_STYLEFAMILY_TABLEDESIGN ) );
return Any( sDisplayName );
}
else
{
throw UnknownPropertyException( "unknown property: " + PropertyName, static_cast<OWeakObject *>(this) );
}
}
void TableDesignFamily::addPropertyChangeListener( const OUString& , const Reference<XPropertyChangeListener>& ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException, std::exception)
{
OSL_FAIL( "###unexpected!" );
}
void TableDesignFamily::removePropertyChangeListener( const OUString& , const Reference<XPropertyChangeListener>& ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException, std::exception)
{
OSL_FAIL( "###unexpected!" );
}
void TableDesignFamily::addVetoableChangeListener( const OUString& , const Reference<XVetoableChangeListener>& ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException, std::exception)
{
OSL_FAIL( "###unexpected!" );
}
void TableDesignFamily::removeVetoableChangeListener( const OUString& , const Reference<XVetoableChangeListener>& ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException, std::exception)
{
OSL_FAIL( "###unexpected!" );
}
Reference< XNameAccess > CreateTableDesignFamily()
{
return new TableDesignFamily();
}
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */