diff options
author | Oliver Bolte <obo@openoffice.org> | 2004-07-06 15:58:28 +0000 |
---|---|---|
committer | Oliver Bolte <obo@openoffice.org> | 2004-07-06 15:58:28 +0000 |
commit | 0a46a30e9104077c39605b1451f7731523ee2292 (patch) | |
tree | 84c8e5feff8dd955fd62321db659ecf1b0d3d07e | |
parent | 3f8f638db7c66f68b8d36be61029a91d3173c524 (diff) |
INTEGRATION: CWS docking1 (1.1.2); FILE ADDED
2004/06/20 19:57:14 cd 1.1.2.1: #i30169# Added files for image manager
-rw-r--r-- | framework/source/uiconfiguration/graphicnameaccess.cxx | 151 |
1 files changed, 151 insertions, 0 deletions
diff --git a/framework/source/uiconfiguration/graphicnameaccess.cxx b/framework/source/uiconfiguration/graphicnameaccess.cxx new file mode 100644 index 000000000000..eaa50989f174 --- /dev/null +++ b/framework/source/uiconfiguration/graphicnameaccess.cxx @@ -0,0 +1,151 @@ +/************************************************************************* + * + * $RCSfile: graphicnameaccess.cxx,v $ + * + * $Revision: 1.2 $ + * + * last change: $Author: obo $ $Date: 2004-07-06 16:58:28 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (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.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef __FRAMEWORK_UICONFIGURATION_GRAPHICNAMEACCESS_HXX_ +#include <uiconfiguration/graphicnameaccess.hxx> +#endif + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ + +#include <comphelper/sequence.hxx> + +using namespace ::com::sun::star; + +namespace framework +{ + +GraphicNameAccess::GraphicNameAccess() +{ +} + +GraphicNameAccess::~GraphicNameAccess() +{ +} + +void GraphicNameAccess::addElement( const rtl::OUString& rName, const uno::Reference< graphic::XGraphic >& rElement ) +{ + m_aNameToElementMap.insert( NameGraphicHashMap::value_type( rName, rElement )); +} + +sal_uInt32 GraphicNameAccess::size() const +{ + return m_aNameToElementMap.size(); +} + +// XNameAccess +uno::Any SAL_CALL GraphicNameAccess::getByName( const ::rtl::OUString& aName ) +throw( container::NoSuchElementException, + lang::WrappedTargetException, + uno::RuntimeException) +{ + NameGraphicHashMap::const_iterator pIter = m_aNameToElementMap.find( aName ); + if ( pIter != m_aNameToElementMap.end() ) + return uno::makeAny( pIter->second ); + else + throw container::NoSuchElementException(); +} + +uno::Sequence< ::rtl::OUString > SAL_CALL GraphicNameAccess::getElementNames() +throw(::com::sun::star::uno::RuntimeException) +{ + if ( m_aSeq.getLength() == 0 ) + { + uno::Sequence< rtl::OUString > aSeq( m_aNameToElementMap.size() ); + NameGraphicHashMap::const_iterator pIter = m_aNameToElementMap.begin(); + sal_Int32 i( 0); + while ( pIter != m_aNameToElementMap.end()) + { + aSeq[i++] = pIter->first; + ++pIter; + } + m_aSeq = aSeq; + } + + return m_aSeq; +} + +sal_Bool SAL_CALL GraphicNameAccess::hasByName( const ::rtl::OUString& aName ) +throw(::com::sun::star::uno::RuntimeException) +{ + NameGraphicHashMap::const_iterator pIter = m_aNameToElementMap.find( aName ); + return ( pIter != m_aNameToElementMap.end() ); +} + +// XElementAccess +sal_Bool SAL_CALL GraphicNameAccess::hasElements() +throw( uno::RuntimeException ) +{ + return ( m_aNameToElementMap.size() > 0 ); +} + +uno::Type SAL_CALL GraphicNameAccess::getElementType() +throw( uno::RuntimeException ) +{ + return ::getCppuType( (const uno::Reference< graphic::XGraphic > *)NULL ); +} + +} // namespace framework |