[Libreoffice-commits] .: 2 commits - extensions/inc unusedcode.easy vbahelper/inc vbahelper/Library_vbahelper.mk vbahelper/Package_inc.mk vbahelper/source

Matus Kukan mkukan at kemper.freedesktop.org
Mon Sep 5 11:02:01 PDT 2011


 extensions/inc/ucbhelper/ext_content.hxx      |  332 --------------------------
 unusedcode.easy                               |    4 
 vbahelper/Library_vbahelper.mk                |    1 
 vbahelper/Package_inc.mk                      |    1 
 vbahelper/inc/vbahelper/collectionbase.hxx    |  214 ----------------
 vbahelper/source/vbahelper/collectionbase.cxx |  332 --------------------------
 6 files changed, 884 deletions(-)

New commits:
commit fbcaafce49fa08275813433f3330c447edc4e53c
Author: Matúš Kukan <matus.kukan at gmail.com>
Date:   Thu Aug 25 14:51:34 2011 +0200

    remove unused header file

diff --git a/extensions/inc/ucbhelper/ext_content.hxx b/extensions/inc/ucbhelper/ext_content.hxx
deleted file mode 100644
index 99736f7..0000000
--- a/extensions/inc/ucbhelper/ext_content.hxx
+++ /dev/null
@@ -1,332 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org.  If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-
-#ifndef _UCBHELPER_CONTENT_HXX_
-#define _UCBHELPER_CONTENT_HXX_
-
-#include <rtl/string.hxx>
-#include <rtl/ustring>
-#include <osl/mutex.hxx>
-#include <osl/thread.h>
-
-#include <cppuhelper/weak.hxx>
-#include <com/sun/star/ucb/XCommandTaskProcessor.hpp>
-#include <com/sun/star/ucb/XCommandInfo.hpp>
-#include <com/sun/star/ucb/XContent.hpp>
-#include <com/sun/star/ucb/XPropertyTaskProcessor.hpp>
-#include <com/sun/star/ucb/XContentIdentifier.hpp>
-#include <com/sun/star/beans/XPropertiesChangeListener.hpp>
-#include <com/sun/star/lang/XComponent.hpp>
-
-#include <list>
-
-using namespace cppu;
-using namespace com::sun::star::ucb;
-using namespace com::sun::star::uno;
-using namespace com::sun::star::beans;
-using namespace com::sun::star::lang;
-using namespace std;
-using namespace osl;
-
-using ::rtl::OUString;
-
-
-
-template <class Type> class safe_list : public osl::Mutex, public std::list< Type > {};
-
-class OSimpleContentIdentifier :    public OWeakObject,
-                                    public XContentIdentifier
-{
-private:
-    OUString    Identifier;
-    OUString    ProviderScheme;
-
-public:
-    OSimpleContentIdentifier( const OUString& rIdentifier, const OUString& rProviderScheme );
-
-    // XInterface
-    virtual Any         SAL_CALL queryInterface( const Type &type ) throw( RuntimeException );
-    virtual void        SAL_CALL acquire() throw(RuntimeException);
-    virtual void        SAL_CALL release() throw(RuntimeException);
-
-    // XContentIdentifier
-    virtual OUString    SAL_CALL getContentIdentifier() throw(RuntimeException);
-    virtual OUString    SAL_CALL getContentProviderScheme() throw(RuntimeException);
-};
-
-
-//---------------------------------------------------------------------------
-//
-//  FileSystemContent
-//
-//---------------------------------------------------------------------------
-
-class OContent :
-public OWeakObject,
-public XContent,
-public XCommandTaskProcessor,
-public XPropertyTaskProcessor,
-public XCommandInfo,
-public XPropertySetInfo,
-public XComponent
-{
-public:
-    struct PropertyChangeEventInfo
-    {
-        OUString    Name;
-        long        Handle;
-
-        PropertyChangeEventInfo() : Handle( -1 ) {}
-
-        inline int operator ==( const PropertyChangeEventInfo& crInfo ) const
-        { return Handle == crInfo.Handle && Handle > 0 || Name == crInfo.Name; }
-    #ifdef __SUNPRO_CC
-        inline int operator <( const PropertyChangeEventInfo& crInfo ) const
-        { return Handle != crInfo.Handle ? Handle < crInfo.Handle : Name < crInfo.Name; }
-    #endif
-    };
-
-    struct PropertyChangeListenerInfo
-    {
-        Reference< XPropertiesChangeListener >  xListener;
-        list< PropertyChangeEventInfo >         aEventInfos;
-
-        inline int operator ==( const PropertyChangeListenerInfo& crInfo ) const
-        { return xListener == crInfo.xListener; }
-    #ifdef __SUNPRO_CC
-        inline int operator <( const PropertyChangeListenerInfo& crInfo ) const
-        { return xListener < crInfo.xListener; }
-    #endif
-    };
-
-protected:
-    Sequence< PropertyChangeEvent > matchListenerEvents( const Sequence< PropertyChangeEvent >& crEvents, const PropertyChangeListenerInfo & crInfo );
-
-    safe_list< Reference< XContentEventListener > > m_aContentListeners;
-    safe_list< Reference< XEventListener > >        m_aComponentListeners;
-    safe_list< PropertyChangeListenerInfo >         m_aPropertyChangeListeners;
-public:
-    virtual ~OContent() {}
-
-    virtual void broadcastContentEvent( const ContentEvent & crEvent );
-    virtual void broadcastPropertiesChangeEvents( const Sequence< PropertyChangeEvent >& crEvents );
-
-    // To be implemented by inheritents
-    virtual Any doCommand( const Command & crCommand ) = 0;
-
-    // XInterface
-    virtual Any         SAL_CALL queryInterface( const Type &type ) throw( RuntimeException );
-
-    virtual void SAL_CALL acquire() throw(RuntimeException);
-    virtual void SAL_CALL release() throw(RuntimeException);
-
-    // XContent
-    virtual void SAL_CALL addContentEventListener( const Reference< XContentEventListener >& rListener ) throw();
-    virtual void SAL_CALL removeContentEventListener( const Reference< XContentEventListener >& rListener ) throw();
-
-    // XComponent
-    virtual void SAL_CALL dispose() throw();
-    virtual void SAL_CALL addEventListener( const Reference< XEventListener >& xListener ) throw();
-    virtual void SAL_CALL removeEventListener( const Reference< XEventListener >& xListener ) throw();
-
-    // XCommmandTaskProcessor
-    virtual Reference< XCommandInfo > SAL_CALL getCommandsInfo() throw();
-
-    // XCommandInfo
-    virtual CommandInfo SAL_CALL getCommandInfoByName( const OUString& rName ) throw( UnsupportedCommandException );
-    virtual CommandInfo SAL_CALL getCommandInfoByHandle( long nHandle ) throw( UnsupportedCommandException );
-    virtual sal_Bool SAL_CALL hasCommandByName( const OUString& rName ) throw();
-    virtual sal_Bool SAL_CALL hasCommandByHandle( long nHandle ) throw();
-
-    // XPropertyTaskProcessor
-    virtual Reference< XPropertySetInfo > SAL_CALL getPropertySetInfo() throw();
-
-    // XPropertySetInfo
-    virtual Property SAL_CALL getPropertyByName( const OUString& Name ) throw( UnknownPropertyException );
-    virtual sal_Bool SAL_CALL hasPropertyByName( const OUString& Name ) throw();
-    virtual void SAL_CALL addPropertiesChangeListener( const Sequence< OUString >& Names, const Reference< XPropertiesChangeListener >& xListener ) throw();
-    virtual void SAL_CALL removePropertiesChangeListener( const Sequence< OUString >& Names, const Reference< XPropertiesChangeListener >& xListener ) throw();
-};
-
-//---------------------------------------------------------------------------
-//
-//  FolderContent
-//
-//---------------------------------------------------------------------------
-
-// supported Commands
-static const sal_Int32 OPEN     = 0;
-static const sal_Int32 CLOSE    = 1;
-
-class OFolderContent : public OContent
-{
-protected:
-    // Already provided children
-    safe_list< XContent >   m_aChildList;
-
-    // OContent
-    virtual Any doCommand( const Command & crCommand );
-
-    // new methods, can be overloaded
-    virtual Any doOpenCommand();
-    virtual Any doCloseCommand();
-
-    // To be implemented by inheritants
-    virtual Sequence< XContent > getAllChildren() = 0;
-
-public:
-
-    // XCommmandTaskProcessor
-    virtual Reference< XCommandTask > SAL_CALL createCommandTask(const Command& rCommand, const Reference< XContentTaskEnvironment >& rEnvironment ) throw();
-
-    // XCommandInfo
-    virtual Sequence< CommandInfo > SAL_CALL getCommands() throw();
-};
-
-//---------------------------------------------------------------------------
-//
-//  OContentTask
-//
-//---------------------------------------------------------------------------
-
-class OContentTask :
-public OWeakObject,
-public XContentTask
-{
-    Guard< OContent >                       m_aContentGuard;
-protected:
-    OContent                                *m_pContent;
-    Reference< XContentTaskEnvironment >    m_xEnvironment;
-    ContentTaskStatus                       m_eStatus;
-    oslThread                               m_aThread;
-
-    static void executeWorker( void * );
-    virtual ContentTaskStatus setStatus( ContentTaskStatus eStatus );
-
-    // To be implemented by inheritants
-    virtual void doExecute() = 0;
-public:
-    OContentTask(  const Reference< XContentTaskEnvironment >& xEnv, OContent *pContent );
-    virtual ~OContentTask();
-
-    // XInterface
-    virtual Any         SAL_CALL queryInterface( const Type &type ) throw( RuntimeException );
-
-    virtual void SAL_CALL acquire() throw(RuntimeException);
-    virtual void SAL_CALL release() throw(RuntimeException);
-
-    // XContentTask
-    virtual void SAL_CALL start() throw();
-    virtual void SAL_CALL execute() throw( Exception );
-    virtual void SAL_CALL abort() throw();
-    virtual ContentTaskStatus SAL_CALL getStatus() throw();
-    virtual Reference< XContentTaskEnvironment > SAL_CALL getEnvironment() throw();
-};
-
-//---------------------------------------------------------------------------
-//
-//  OCommandTask
-//
-//---------------------------------------------------------------------------
-
-class OCommandTask :
-public OContentTask,
-public XCommandTask
-{
-protected:
-    Command             m_aCommand;
-    Any                 m_aResult;
-
-public:
-    OCommandTask( const Reference< XContentTaskEnvironment >& xEnv, OContent *pContent, const Command& rCommand );
-    virtual ~OCommandTask();
-
-    virtual void doExecute();
-
-    // XInterface
-    virtual Any         SAL_CALL queryInterface( const Type &type ) throw( RuntimeException );
-    virtual void        SAL_CALL acquire() throw(RuntimeException);
-    virtual void        SAL_CALL release() throw(RuntimeException);
-
-    // XContentTask
-    virtual void SAL_CALL start() throw();
-    virtual void SAL_CALL execute() throw( Exception );
-    virtual void SAL_CALL abort() throw();
-    virtual ContentTaskStatus SAL_CALL getStatus() throw();
-    virtual Reference< XContentTaskEnvironment > SAL_CALL getEnvironment() throw();
-
-    // XCommandTask
-    virtual Command SAL_CALL getCommand() throw();
-    virtual Any SAL_CALL getResult() throw();
-};
-
-//---------------------------------------------------------------------------
-//
-//  OPropertyTask
-//
-//---------------------------------------------------------------------------
-
-class OPropertyTask :
-public OContentTask,
-public XPropertyTask
-{
-protected:
-    Sequence< PropertyValueInfo >   m_aProperties;
-    PropertyTaskType                m_eType;
-public:
-    OPropertyTask(const Reference< XContentTaskEnvironment >& Environment, OContent *pContent, const Sequence< PropertyValue >& Properties, PropertyTaskType Type );
-    virtual ~OPropertyTask();
-
-    virtual void doExecute();
-
-    // To be implemented by inheritants
-    virtual Any setPropertyValue( PropertyValueInfo & rProperty ) = 0;
-    virtual void getPropertyValue( PropertyValueInfo & rProperty ) = 0;
-
-    // XInterface
-    virtual Any         SAL_CALL queryInterface( const Type &type ) throw( RuntimeException );
-    virtual void        SAL_CALL acquire() throw(RuntimeException);
-    virtual void        SAL_CALL release() throw(RuntimeException);
-
-    // XContentTask
-    virtual void SAL_CALL start() throw();
-    virtual void SAL_CALL execute() throw( Exception );
-    virtual void SAL_CALL abort() throw();
-    virtual ContentTaskStatus SAL_CALL getStatus() throw();
-    virtual Reference< XContentTaskEnvironment > SAL_CALL getEnvironment() throw();
-
-    // XPropertyTask
-    PropertyTaskType SAL_CALL getType() throw();
-    Sequence< PropertyValueInfo > SAL_CALL getProperties() throw();
-};
-
-#endif // _UCBHELPER_CONTENT_HXX_
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit ad814e27cf7eea30266c4527334c273326d87891
Author: Matúš Kukan <matus.kukan at gmail.com>
Date:   Mon Sep 5 19:55:58 2011 +0200

    unusedcode: vbahelper::CollectionBase class

diff --git a/unusedcode.easy b/unusedcode.easy
index aaba53c..16c3bbe 100644
--- a/unusedcode.easy
+++ b/unusedcode.easy
@@ -3079,10 +3079,6 @@ utl::OConfigurationValueContainer::OConfigurationValueContainer(com::sun::star::
 utl::OConfigurationValueContainer::getServiceFactory() const
 utl::OConfigurationValueContainer::registerNullValueExchangeLocation(char const*, com::sun::star::uno::Any*)
 utl::TransliterationWrapper::compareSubstring(String const&, int, int, String const&, int, int) const
-vbahelper::CollectionBase::CollectionBase(com::sun::star::uno::Type const&)
-vbahelper::CollectionBase::getAnyItemOrThis(com::sun::star::uno::Any const&)
-vbahelper::CollectionBase::initElements(std::vector<com::sun::star::beans::NamedValue, std::allocator<com::sun::star::beans::NamedValue> > const&, vbahelper::CollectionBase::ContainerType)
-vbahelper::CollectionBase::initElements(std::vector<com::sun::star::uno::Reference<com::sun::star::container::XNamed>, std::allocator<com::sun::star::uno::Reference<com::sun::star::container::XNamed> > > const&, vbahelper::CollectionBase::ContainerType)
 vcl::Clipboard_getSupportedServiceNames()
 vcl::I18NStatus::addChoice(String const&, void*)
 vcl::I18NStatus::clearChoices()
diff --git a/vbahelper/Library_vbahelper.mk b/vbahelper/Library_vbahelper.mk
index 6ce7185..a0788ed 100644
--- a/vbahelper/Library_vbahelper.mk
+++ b/vbahelper/Library_vbahelper.mk
@@ -75,7 +75,6 @@ $(eval $(call gb_Library_add_linked_libs,vbahelper,\
 # add all source files that shall be compiled with exceptions enabled
 # the name is relative to $(SRCROOT) and must not contain an extension
 $(eval $(call gb_Library_add_exception_objects,vbahelper,\
-    vbahelper/source/vbahelper/collectionbase \
     vbahelper/source/vbahelper/vbaapplicationbase \
     vbahelper/source/vbahelper/vbacolorformat \
     vbahelper/source/vbahelper/vbacommandbar \
diff --git a/vbahelper/Package_inc.mk b/vbahelper/Package_inc.mk
index ffdc2f4..87c1696 100644
--- a/vbahelper/Package_inc.mk
+++ b/vbahelper/Package_inc.mk
@@ -27,7 +27,6 @@
 #*************************************************************************
 
 $(eval $(call gb_Package_Package,vbahelper_inc,$(SRCDIR)/vbahelper/inc))
-$(eval $(call gb_Package_add_file,vbahelper_inc,inc/vbahelper/collectionbase.hxx,vbahelper/collectionbase.hxx))
 $(eval $(call gb_Package_add_file,vbahelper_inc,inc/vbahelper/helperdecl.hxx,vbahelper/helperdecl.hxx))
 $(eval $(call gb_Package_add_file,vbahelper_inc,inc/vbahelper/vbaaccesshelper.hxx,vbahelper/vbaaccesshelper.hxx))
 $(eval $(call gb_Package_add_file,vbahelper_inc,inc/vbahelper/vbaapplicationbase.hxx,vbahelper/vbaapplicationbase.hxx))
diff --git a/vbahelper/inc/vbahelper/collectionbase.hxx b/vbahelper/inc/vbahelper/collectionbase.hxx
deleted file mode 100755
index ebb5bf8..0000000
--- a/vbahelper/inc/vbahelper/collectionbase.hxx
+++ /dev/null
@@ -1,214 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2011 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org.  If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef VBAHELPER_COLLECTIONBASE_HXX
-#define VBAHELPER_COLLECTIONBASE_HXX
-
-#include <vector>
-#include <com/sun/star/beans/NamedValue.hpp>
-#include <com/sun/star/container/XElementAccess.hpp>
-#include <com/sun/star/container/XNamed.hpp>
-#include <ooo/vba/XCollectionBase.hpp>
-#include <cppuhelper/implbase1.hxx>
-#include <vbahelper/vbahelper.hxx>
-
-namespace vbahelper {
-
-// ============================================================================
-
-typedef ::cppu::WeakImplHelper1< ov::XCollectionBase > CollectionBase_BASE;
-
-/** Base class of VBA objects implementing the VBA collection concept.
-
-    This base class intentionally does not include the interface
-    XHelperInterface supported by all application VBA object. There may be
-    other VBA objects that do not support the special methods provided by
-    XHelperInterface.
- */
-class VBAHELPER_DLLPUBLIC CollectionBase : public CollectionBase_BASE
-{
-public:
-    /** Enumerates different container types a VBA collection can be based on. */
-    enum ContainerType
-    {
-        /** Container elements are VBA items.
-
-            The initial container contains the final VBA items provided by the
-            VBA collection. No conversion takes place on item access.
-         */
-        CONTAINER_NATIVE_VBA,
-
-        /** Container elements will be converted to VBA items on demand.
-
-            The initial container contains intermediate objects (e.g. UNO
-            objects) which will be converted to VBA items everytime the item is
-            accessed (e.g. item access method, enumeration). Changes in the
-            initial container are reflected by the collection.
-         */
-        CONTAINER_CONVERT_ON_DEMAND,
-    };
-
-    // ------------------------------------------------------------------------
-
-    CollectionBase( const css::uno::Type& rElementType );
-
-    // ------------------------------------------------------------------------
-
-    // attributes
-    virtual sal_Int32 SAL_CALL getCount() throw (css::uno::RuntimeException);
-    // XEnumerationAccess
-    virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
-    // XElementAccess
-    virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
-    virtual sal_Bool SAL_CALL hasElements() throw (css::uno::RuntimeException);
-    // XDefaultMethod
-    virtual ::rtl::OUString SAL_CALL getDefaultMethodName() throw (css::uno::RuntimeException);
-
-    // ------------------------------------------------------------------------
-
-    /** Associates this collection with the passed UNO container.
-
-        @param rxElementAccess
-            The UNO container with the elements of this collection. Shall
-            support either XIndexAccess or XNameAccess, may support both.
-
-            If the container does not support XIndexAccess, index access is
-            simulated based on the order returned by the function
-            XNameAccess::getElementNames().
-
-            If the container does not support XNameAccess, name access is
-            simulated by iterating the elements via index access and asking the
-            elements for their name via the interface XNamed. If the elements
-            do not support XNamed, the elements cannot be accessed by name.
-
-        @param eContainerType
-            Specifies the type of the passed container.
-     */
-    void initContainer(
-        const css::uno::Reference< css::container::XElementAccess >& rxElementAccess,
-        ContainerType eContainerType ) throw (css::uno::RuntimeException);
-
-    /** Initializes this collection with copies of all elements in the passed
-        temporary STL vector.
-
-        @param rElements
-            The STL vector with the named elements of this collection.
-        @param eContainerType
-            Specifies the type of the passed vector.
-     */
-    void initElements(
-        const ::std::vector< css::uno::Reference< css::container::XNamed > >& rElements,
-        ContainerType eContainerType ) throw (css::uno::RuntimeException);
-
-    /** Initializes this collection with copies of all elements in the passed
-        temporary STL vector.
-
-        @param rElements
-            The STL vector with the named elements of this collection.
-        @param eContainerType
-            Specifies the type of the passed vector.
-     */
-    void initElements(
-        const ::std::vector< css::beans::NamedValue >& rElements,
-        ContainerType eContainerType ) throw (css::uno::RuntimeException);
-
-    /** Returns a VBA implementation object from the passed element.
-
-        If the container type is CONTAINER_NATIVE_VBA, returns the passed
-        object unmodified. If the container type is CONTAINER_CONVERT_ON_DEMAND,
-        calls the virtual function implCreateCollectionItem() that implements
-        creation of the VBA implmentation object.
-
-        @param rElement
-            The container element the VBA implementation object is based on.
-
-        @param rIndex
-            The index or name that has been used to access the item.
-     */
-    css::uno::Any createCollectionItem(
-        const css::uno::Any& rElement,
-        const css::uno::Any& rIndex ) throw (css::uno::RuntimeException);
-
-    /** Returns a collection item specified by its one-based item index.
-
-        @param nIndex
-            The one-based index of the collection item.
-    */
-    css::uno::Any getItemByIndex( sal_Int32 nIndex ) throw (css::uno::RuntimeException);
-
-    /** Returns a collection item specified by its name.
-
-        @param rName
-            The name of the collection item.
-    */
-    css::uno::Any getItemByName( const ::rtl::OUString& rName ) throw (css::uno::RuntimeException);
-
-    /** Returns a collection item specified by its index or name.
-
-        @param rIndex
-            The index or name of the collection item. May be empty, in that
-            case the entire collection is returned.
-    */
-    css::uno::Any getAnyItemOrThis( const css::uno::Any& rIndex ) throw (css::uno::RuntimeException);
-
-    /** Returns a collection item of a specific type specified by its index or
-        name.
-
-        @param rIndex
-            The index or name of the collection item.
-    */
-    template< typename XType >
-    inline css::uno::Reference< XType > getAnyItem( const css::uno::Any& rIndex ) throw (css::uno::RuntimeException)
-        { css::uno::Any aRet; if( rIndex.hasValue() ) aRet = getAnyItemOrThis( rIndex ); return css::uno::Reference< XType >( aRet, css::uno::UNO_QUERY_THROW ); }
-
-protected:
-    /** Derived classes implement creation of a VBA implementation object from
-        the passed intermediate container element.
-
-        May be kept unimplemented if container type is CONTAINER_NATIVE_VBA.
-
-        @param rElement
-            The container element the VBA implementation object is based on.
-
-        @param rIndex
-            The index or name used to access the item. Can be used by
-            implementations as a hint how to find or convert the VBA object.
-     */
-    virtual css::uno::Any implCreateCollectionItem( const css::uno::Any& rElement, const css::uno::Any& rIndex ) throw (css::uno::RuntimeException);
-
-private:
-    css::uno::Reference< css::container::XIndexAccess > mxIndexAccess;
-    css::uno::Reference< css::container::XNameAccess > mxNameAccess;
-    css::uno::Type maElementType;
-    bool mbConvertOnDemand;
-};
-
-// ============================================================================
-
-} // namespace vbahelper
-
-#endif
diff --git a/vbahelper/source/vbahelper/collectionbase.cxx b/vbahelper/source/vbahelper/collectionbase.cxx
deleted file mode 100755
index 16fc673..0000000
--- a/vbahelper/source/vbahelper/collectionbase.cxx
+++ /dev/null
@@ -1,332 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2011 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org.  If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include <vbahelper/collectionbase.hxx>
-
-#include <map>
-#include <com/sun/star/container/XIndexAccess.hpp>
-#include <com/sun/star/container/XNameAccess.hpp>
-#include <cppuhelper/implbase2.hxx>
-
-namespace vbahelper {
-
-using namespace ::com::sun::star;
-using namespace ::ooo::vba;
-
-// ============================================================================
-
-namespace {
-
-// ----------------------------------------------------------------------------
-
-class CollectionEnumeration : public ::cppu::WeakImplHelper1< container::XEnumeration >
-{
-public:
-    explicit CollectionEnumeration( const ::rtl::Reference< CollectionBase >& rxCollection );
-    virtual sal_Bool SAL_CALL hasMoreElements() throw (uno::RuntimeException);
-    virtual uno::Any SAL_CALL nextElement() throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException);
-
-private:
-    ::rtl::Reference< CollectionBase > mxCollection;
-    sal_Int32 mnCurrIndex;
-};
-
-CollectionEnumeration::CollectionEnumeration( const ::rtl::Reference< CollectionBase >& rxCollection ) :
-    mxCollection( rxCollection ),
-    mnCurrIndex( 1 )    // collection expects one-based indexes
-{
-}
-
-sal_Bool SAL_CALL CollectionEnumeration::hasMoreElements() throw (uno::RuntimeException)
-{
-    return mnCurrIndex <= mxCollection->getCount();
-}
-
-uno::Any SAL_CALL CollectionEnumeration::nextElement() throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
-{
-    if( hasMoreElements() )
-        return mxCollection->getItemByIndex( mnCurrIndex++ );
-    throw container::NoSuchElementException();
-}
-
-// ----------------------------------------------------------------------------
-
-struct IsLessIgnoreCase
-{
-    inline bool operator()( const ::rtl::OUString& rName1, const ::rtl::OUString& rName2 ) const
-        { return ::rtl_ustr_compareIgnoreAsciiCase_WithLength( rName1.getStr(), rName1.getLength(), rName2.getStr(), rName2.getLength() ) < 0; }
-};
-
-// ----------------------------------------------------------------------------
-
-class SequenceToContainer : public ::cppu::WeakImplHelper2< container::XIndexAccess, container::XNameAccess >
-{
-public:
-    explicit SequenceToContainer( const ::std::vector< uno::Reference< container::XNamed > >& rElements, const uno::Type& rElementType );
-    explicit SequenceToContainer( const ::std::vector< beans::NamedValue >& rElements, const uno::Type& rElementType );
-    // XIndexAccess
-    virtual sal_Int32 SAL_CALL getCount() throw (uno::RuntimeException);
-    virtual uno::Any SAL_CALL getByIndex( sal_Int32 nIndex ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException);
-    // XNameAccess
-    virtual uno::Any SAL_CALL getByName( const ::rtl::OUString& rName ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException);
-    virtual uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() throw (uno::RuntimeException);
-    virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& rName ) throw (uno::RuntimeException);
-    // XElementAccess
-    virtual uno::Type SAL_CALL getElementType() throw (uno::RuntimeException);
-    virtual sal_Bool SAL_CALL hasElements() throw (uno::RuntimeException);
-
-private:
-    typedef uno::Sequence< ::rtl::OUString > ElementNameSequence;
-    typedef ::std::vector< uno::Any > ElementVector;
-    typedef ::std::map< ::rtl::OUString, uno::Any, IsLessIgnoreCase > ElementMap;
-
-    ElementNameSequence maElementNames;
-    ElementVector maElements;
-    ElementMap maElementMap;
-    uno::Type maElementType;
-};
-
-SequenceToContainer::SequenceToContainer( const ::std::vector< uno::Reference< container::XNamed > >& rElements, const uno::Type& rElementType ) :
-    maElementType( rElementType )
-{
-    maElementNames.realloc( static_cast< sal_Int32 >( rElements.size() ) );
-    maElements.reserve( rElements.size() );
-    ::rtl::OUString* pElementName = maElementNames.getArray();
-    for( ::std::vector< uno::Reference< container::XNamed > >::const_iterator aIt = rElements.begin(), aEnd = rElements.end(); aIt != aEnd; ++aIt, ++pElementName )
-    {
-        uno::Reference< container::XNamed > xNamed = *aIt;
-        *pElementName = xNamed->getName();
-        maElements.push_back( uno::Any( xNamed ) );
-        // same name may occur multiple times, VBA returns first occurance
-        if( maElementMap.count( *pElementName ) == 0 )
-            maElementMap[ *pElementName ] <<= xNamed;
-    }
-}
-
-SequenceToContainer::SequenceToContainer( const ::std::vector< beans::NamedValue >& rElements, const uno::Type& rElementType ) :
-    maElementType( rElementType )
-{
-    maElementNames.realloc( static_cast< sal_Int32 >( rElements.size() ) );
-    maElements.reserve( rElements.size() );
-    ::rtl::OUString* pElementName = maElementNames.getArray();
-    for( ::std::vector< beans::NamedValue >::const_iterator aIt = rElements.begin(), aEnd = rElements.end(); aIt != aEnd; ++aIt, ++pElementName )
-    {
-        *pElementName = aIt->Name;
-        maElements.push_back( aIt->Value );
-        // same name may occur multiple times, VBA returns first occurance
-        if( maElementMap.count( *pElementName ) == 0 )
-            maElementMap[ *pElementName ] = aIt->Value;
-    }
-}
-
-sal_Int32 SAL_CALL SequenceToContainer::getCount() throw (uno::RuntimeException)
-{
-    return static_cast< sal_Int32 >( maElements.size() );
-}
-
-uno::Any SAL_CALL SequenceToContainer::getByIndex( sal_Int32 nIndex ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
-{
-    if( (0 <= nIndex) && (nIndex < getCount()) )
-        return maElements[ static_cast< size_t >( nIndex ) ];
-    throw lang::IndexOutOfBoundsException();
-}
-
-uno::Any SAL_CALL SequenceToContainer::getByName( const ::rtl::OUString& rName ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
-{
-    ElementMap::iterator aIt = maElementMap.find( rName );
-    if( aIt != maElementMap.end() )
-        return aIt->second;
-    throw container::NoSuchElementException();
-}
-
-uno::Sequence< ::rtl::OUString > SAL_CALL SequenceToContainer::getElementNames() throw (uno::RuntimeException)
-{
-    return maElementNames;
-}
-
-sal_Bool SAL_CALL SequenceToContainer::hasByName( const ::rtl::OUString& rName ) throw (uno::RuntimeException)
-{
-    return maElementMap.count( rName ) > 0;
-}
-
-uno::Type SAL_CALL SequenceToContainer::getElementType() throw (uno::RuntimeException)
-{
-    return maElementType;
-}
-
-sal_Bool SAL_CALL SequenceToContainer::hasElements() throw (uno::RuntimeException)
-{
-    return !maElements.empty();
-}
-
-} // namespace
-
-// ============================================================================
-
-CollectionBase::CollectionBase( const uno::Type& rElementType ) :
-    maElementType( rElementType ),
-    mbConvertOnDemand( false )
-{
-}
-
-sal_Int32 SAL_CALL CollectionBase::getCount() throw (uno::RuntimeException)
-{
-    if( mxIndexAccess.is() )
-        return mxIndexAccess->getCount();
-    if( mxNameAccess.is() )
-        return mxNameAccess->getElementNames().getLength();
-    throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "No element container set." ) ), 0 );
-}
-
-uno::Reference< container::XEnumeration > SAL_CALL CollectionBase::createEnumeration() throw (uno::RuntimeException)
-{
-    return new CollectionEnumeration( this );
-}
-
-uno::Type SAL_CALL CollectionBase::getElementType() throw (uno::RuntimeException)
-{
-    return maElementType;
-}
-
-sal_Bool SAL_CALL CollectionBase::hasElements() throw (uno::RuntimeException)
-{
-    if( mxIndexAccess.is() )
-        return mxIndexAccess->hasElements();
-    if( mxNameAccess.is() )
-        return mxNameAccess->hasElements();
-    throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "No element container set." ) ), 0 );
-}
-
-::rtl::OUString SAL_CALL CollectionBase::getDefaultMethodName() throw (uno::RuntimeException)
-{
-    static ::rtl::OUString saDefMethodName( RTL_CONSTASCII_USTRINGPARAM( "Item" ) );
-    return saDefMethodName;
-}
-
-// ----------------------------------------------------------------------------
-
-void CollectionBase::initContainer(
-        const uno::Reference< container::XElementAccess >& rxElementAccess,
-        ContainerType eContainerType ) throw (uno::RuntimeException)
-{
-    mxIndexAccess.set( rxElementAccess, uno::UNO_QUERY );
-    mxNameAccess.set( rxElementAccess, uno::UNO_QUERY );
-    switch( eContainerType )
-    {
-        case CONTAINER_NATIVE_VBA:
-            mbConvertOnDemand = false;
-        break;
-        case CONTAINER_CONVERT_ON_DEMAND:
-            mbConvertOnDemand = true;
-        break;
-    }
-}
-
-void CollectionBase::initElements( const ::std::vector< uno::Reference< container::XNamed > >& rElements, ContainerType eContainerType ) throw (uno::RuntimeException)
-{
-    // SequenceToContainer derives twice from XElementAccess, need to resolve ambiguity
-    initContainer( static_cast< container::XIndexAccess* >( new SequenceToContainer( rElements, maElementType ) ), eContainerType );
-}
-
-void CollectionBase::initElements( const ::std::vector< beans::NamedValue >& rElements, ContainerType eContainerType ) throw (uno::RuntimeException)
-{
-    // SequenceToContainer derives twice from XElementAccess, need to resolve ambiguity
-    initContainer( static_cast< container::XIndexAccess* >( new SequenceToContainer( rElements, maElementType ) ), eContainerType );
-}
-
-uno::Any CollectionBase::createCollectionItem( const uno::Any& rElement, const uno::Any& rIndex ) throw (css::uno::RuntimeException)
-{
-    uno::Any aItem = mbConvertOnDemand ? implCreateCollectionItem( rElement, rIndex ) : rElement;
-    if( aItem.hasValue() )
-        return aItem;
-    throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Invalid item." ) ), 0 );
-}
-
-uno::Any CollectionBase::getItemByIndex( sal_Int32 nIndex ) throw (uno::RuntimeException)
-{
-    if( mxIndexAccess.is() )
-    {
-        if( (1 <= nIndex) && (nIndex <= mxIndexAccess->getCount()) )
-            // createCollectionItem() will convert from container element to VBA item
-            return createCollectionItem( mxIndexAccess->getByIndex( nIndex - 1 ), uno::Any( nIndex ) );
-        throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Index out of bounds." ) ), 0 );
-    }
-    if( mxNameAccess.is() )
-    {
-        uno::Sequence< ::rtl::OUString > aElementNames = mxNameAccess->getElementNames();
-        if( (1 <= nIndex) && (nIndex <= aElementNames.getLength()) )
-            // createCollectionItem() will convert from container element to VBA item
-            return createCollectionItem( mxNameAccess->getByName( aElementNames[ nIndex - 1 ] ), uno::Any( aElementNames[ nIndex - 1 ] ) );
-        throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Index out of bounds." ) ), 0 );
-    }
-    throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "No element container set." ) ), 0 );
-}
-
-uno::Any CollectionBase::getItemByName( const ::rtl::OUString& rName ) throw (uno::RuntimeException)
-{
-    if( mxNameAccess.is() )
-    {
-        if( rName.getLength() > 0 )
-            // createCollectionItem() will convert from container element to VBA item
-            return createCollectionItem( mxNameAccess->getByName( rName ), uno::Any( rName ) );
-        throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Invalid item name." ) ), 0 );
-    }
-    if( mxIndexAccess.is() )
-    {
-        for( sal_Int32 nIndex = 0, nSize = mxIndexAccess->getCount(); nIndex < nSize; ++nIndex )
-        {
-            uno::Any aElement = mxIndexAccess->getByIndex( nIndex );
-            uno::Reference< container::XNamed > xNamed( aElement, uno::UNO_QUERY );
-            if( xNamed.is() && xNamed->getName().equalsIgnoreAsciiCase( rName ) )
-                // createCollectionItem() will convert from container element to VBA item
-                return createCollectionItem( aElement, uno::Any( nIndex ) );
-        }
-        throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Invalid item name." ) ), 0 );
-    }
-    throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "No element container set." ) ), 0 );
-}
-
-uno::Any CollectionBase::getAnyItemOrThis( const uno::Any& rIndex ) throw (uno::RuntimeException)
-{
-    if( !rIndex.hasValue() )
-        return uno::Any( uno::Reference< XCollectionBase >( this ) );
-    if( rIndex.has< ::rtl::OUString >() )
-        return getItemByName( rIndex.get< ::rtl::OUString >() );
-    // extractIntFromAny() throws if no index can be extracted
-    return getItemByIndex( extractIntFromAny( rIndex ) );
-}
-
-// protected ------------------------------------------------------------------
-
-uno::Any CollectionBase::implCreateCollectionItem( const uno::Any& /*rElement*/, const uno::Any& /*rIndex*/ ) throw (uno::RuntimeException)
-{
-    throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Creation of VBA implementation object not implemented." ) ), 0 );
-}
-
-// ============================================================================
-
-} // namespace vbahelper


More information about the Libreoffice-commits mailing list