diff options
Diffstat (limited to 'framework/inc/classes')
21 files changed, 4038 insertions, 0 deletions
diff --git a/framework/inc/classes/actiontriggercontainer.hxx b/framework/inc/classes/actiontriggercontainer.hxx new file mode 100644 index 000000000000..936f6cf0cdbb --- /dev/null +++ b/framework/inc/classes/actiontriggercontainer.hxx @@ -0,0 +1,79 @@ +/************************************************************************* + * + * 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 __FRAMEWORK_CLASSES_ACTIONTRIGGERCONTAINER_HXX_ +#define __FRAMEWORK_CLASSES_ACTIONTRIGGERCONTAINER_HXX_ + +#include <helper/propertysetcontainer.hxx> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <framework/fwedllapi.h> + +#define SERVICENAME_ACTIONTRIGGERCONTAINER "com.sun.star.ui.ActionTriggerContainer" +#define IMPLEMENTATIONNAME_ACTIONTRIGGERCONTAINER "com.sun.star.comp.ui.ActionTriggerContainer" + + +namespace framework +{ + +class FWE_DLLPUBLIC ActionTriggerContainer : public PropertySetContainer, + public com::sun::star::lang::XMultiServiceFactory, + public com::sun::star::lang::XServiceInfo, + public com::sun::star::lang::XTypeProvider +{ + public: + ActionTriggerContainer( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager ); + virtual ~ActionTriggerContainer(); + + // XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire() throw (); + virtual void SAL_CALL release() throw (); + + // XMultiServiceFactory + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstance( const ::rtl::OUString& aServiceSpecifier ) + throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceWithArguments( const ::rtl::OUString& ServiceSpecifier, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Arguments ) + throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getAvailableServiceNames() + throw (::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException); + + // XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw (::com::sun::star::uno::RuntimeException); +}; + +} + +#endif // __FRAMEWORK_CLASSES_ACTIONTRIGGERCONTAINER_HXX_ diff --git a/framework/inc/classes/actiontriggerpropertyset.hxx b/framework/inc/classes/actiontriggerpropertyset.hxx new file mode 100644 index 000000000000..3f373f272afd --- /dev/null +++ b/framework/inc/classes/actiontriggerpropertyset.hxx @@ -0,0 +1,134 @@ +/************************************************************************* + * + * 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 __FRAMEWORK_CLASSES_ACTIONTRIGGERPROPERTYSET_HXX_ +#define __FRAMEWORK_CLASSES_ACTIONTRIGGERPROPERTYSET_HXX_ + +#include <threadhelp/threadhelpbase.hxx> +#include <cppuhelper/propshlp.hxx> +#include <cppuhelper/weak.hxx> +#include <osl/mutex.hxx> +#include <rtl/ustring.hxx> + +#ifndef __COM_SUN_STAR_AWT_XBITMAP_HPP_ +#include <com/sun/star/awt/XBitmap.hpp> +#endif +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/lang/IllegalArgumentException.hpp> +#include <framework/fwedllapi.h> + +#define SERVICENAME_ACTIONTRIGGER "com.sun.star.ui.ActionTrigger" +#define IMPLEMENTATIONNAME_ACTIONTRIGGER "com.sun.star.comp.ui.ActionTrigger" + +namespace framework +{ + +class ActionTriggerPropertySet : public ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses. + public ::com::sun::star::lang::XServiceInfo , + public ::com::sun::star::lang::XTypeProvider, + public ::cppu::OBroadcastHelper , + public ::cppu::OPropertySetHelper , // -> XPropertySet, XFastPropertySet, XMultiPropertySet + public ::cppu::OWeakObject +{ + public: + FWE_DLLPUBLIC ActionTriggerPropertySet( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); + FWE_DLLPUBLIC virtual ~ActionTriggerPropertySet(); + + // XInterface + virtual FWE_DLLPUBLIC ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) + throw (::com::sun::star::uno::RuntimeException); + virtual FWE_DLLPUBLIC void SAL_CALL acquire() throw (); + virtual FWE_DLLPUBLIC void SAL_CALL release() throw (); + + // XServiceInfo + virtual FWE_DLLPUBLIC ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException); + virtual FWE_DLLPUBLIC sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException); + virtual FWE_DLLPUBLIC ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException); + + // XTypeProvider + virtual FWE_DLLPUBLIC ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw (::com::sun::star::uno::RuntimeException); + virtual FWE_DLLPUBLIC ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw (::com::sun::star::uno::RuntimeException); + + private: + //--------------------------------------------------------------------------------------------------------- + // OPropertySetHelper + //--------------------------------------------------------------------------------------------------------- + virtual sal_Bool SAL_CALL convertFastPropertyValue( com::sun::star::uno::Any& aConvertedValue, + com::sun::star::uno::Any& aOldValue, + sal_Int32 nHandle, + const com::sun::star::uno::Any& aValue ) + throw( com::sun::star::lang::IllegalArgumentException ); + + + virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const com::sun::star::uno::Any& aValue ) + throw( com::sun::star::uno::Exception ); + + using cppu::OPropertySetHelper::getFastPropertyValue; + virtual void SAL_CALL getFastPropertyValue( com::sun::star::uno::Any& aValue, sal_Int32 nHandle ) const; + + virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); + + virtual com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() + throw (::com::sun::star::uno::RuntimeException); + + static const com::sun::star::uno::Sequence< com::sun::star::beans::Property > impl_getStaticPropertyDescriptor(); + + //--------------------------------------------------------------------------------------------------------- + // helper + //--------------------------------------------------------------------------------------------------------- + + sal_Bool impl_tryToChangeProperty( const rtl::OUString& aCurrentValue , + const com::sun::star::uno::Any& aNewValue , + com::sun::star::uno::Any& aOldValue , + com::sun::star::uno::Any& aConvertedValue ) throw( com::sun::star::lang::IllegalArgumentException ); + + sal_Bool impl_tryToChangeProperty( const com::sun::star::uno::Reference< com::sun::star::awt::XBitmap > xBitmap, + const com::sun::star::uno::Any& aNewValue , + com::sun::star::uno::Any& aOldValue , + com::sun::star::uno::Any& aConvertedValue ) throw( com::sun::star::lang::IllegalArgumentException ); + + sal_Bool impl_tryToChangeProperty( const com::sun::star::uno::Reference< com::sun::star::uno::XInterface > xInterface, + const com::sun::star::uno::Any& aNewValue , + com::sun::star::uno::Any& aOldValue , + com::sun::star::uno::Any& aConvertedValue ) throw( com::sun::star::lang::IllegalArgumentException ); + + //--------------------------------------------------------------------------------------------------------- + // members + //--------------------------------------------------------------------------------------------------------- + + rtl::OUString m_aCommandURL; + rtl::OUString m_aHelpURL; + rtl::OUString m_aText; + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap > m_xBitmap; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xActionTriggerContainer; +}; + +} + +#endif // __FRAMEWORK_CLASSES_ACTIONTRIGGERPROPERTYSET_HXX_ diff --git a/framework/inc/classes/actiontriggerseparatorpropertyset.hxx b/framework/inc/classes/actiontriggerseparatorpropertyset.hxx new file mode 100644 index 000000000000..f3579e98fcc1 --- /dev/null +++ b/framework/inc/classes/actiontriggerseparatorpropertyset.hxx @@ -0,0 +1,117 @@ +/************************************************************************* + * + * 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 __FRAMEWORK_CLASSES_ACTIONTRIGGERSEPARATORPROPERTYSET_HXX_ +#define __FRAMEWORK_CLASSES_ACTIONTRIGGERSEPARATORPROPERTYSET_HXX_ + +#include <threadhelp/threadhelpbase.hxx> +#include <cppuhelper/propshlp.hxx> +#include <cppuhelper/weak.hxx> +#include <osl/mutex.hxx> +#include <rtl/ustring.hxx> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/lang/IllegalArgumentException.hpp> +#include <framework/fwedllapi.h> + +#define SERVICENAME_ACTIONTRIGGERSEPARATOR "com.sun.star.ui.ActionTriggerSeparator" +#define IMPLEMENTATIONNAME_ACTIONTRIGGERSEPARATOR "com.sun.star.comp.ui.ActionTriggerSeparator" + + +namespace framework +{ + +class ActionTriggerSeparatorPropertySet : public ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses. + public ::com::sun::star::lang::XServiceInfo , + public ::com::sun::star::lang::XTypeProvider, + public ::cppu::OBroadcastHelper , + public ::cppu::OPropertySetHelper , // -> XPropertySet, XFastPropertySet, XMultiPropertySet + public ::cppu::OWeakObject +{ + public: + ActionTriggerSeparatorPropertySet( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); + virtual ~ActionTriggerSeparatorPropertySet(); + + // XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire() throw (); + virtual void SAL_CALL release() throw (); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException); + + // XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw (::com::sun::star::uno::RuntimeException); + + private: + //--------------------------------------------------------------------------------------------------------- + // OPropertySetHelper + //--------------------------------------------------------------------------------------------------------- + virtual sal_Bool SAL_CALL convertFastPropertyValue( com::sun::star::uno::Any& aConvertedValue, + com::sun::star::uno::Any& aOldValue, + sal_Int32 nHandle, + const com::sun::star::uno::Any& aValue ) + throw( com::sun::star::lang::IllegalArgumentException ); + + + virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const com::sun::star::uno::Any& aValue ) + throw( com::sun::star::uno::Exception ); + + using cppu::OPropertySetHelper::getFastPropertyValue; + virtual void SAL_CALL getFastPropertyValue( com::sun::star::uno::Any& aValue, sal_Int32 nHandle ) const; + + virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); + + virtual com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() + throw (::com::sun::star::uno::RuntimeException); + + static const com::sun::star::uno::Sequence< com::sun::star::beans::Property > impl_getStaticPropertyDescriptor(); + + //--------------------------------------------------------------------------------------------------------- + // helper + //--------------------------------------------------------------------------------------------------------- + + sal_Bool impl_tryToChangeProperty( sal_Int16 aCurrentValue , + const com::sun::star::uno::Any& aNewValue , + com::sun::star::uno::Any& aOldValue , + com::sun::star::uno::Any& aConvertedValue ) throw( com::sun::star::lang::IllegalArgumentException ); + + //--------------------------------------------------------------------------------------------------------- + // members + //--------------------------------------------------------------------------------------------------------- + + sal_Int16 m_nSeparatorType; +}; + +} + +#endif // __FRAMEWORK_CLASSES_ACTIONTRIGGERSEPARATORPROPERTYSET_HXX_ diff --git a/framework/inc/classes/checkediterator.hxx b/framework/inc/classes/checkediterator.hxx new file mode 100644 index 000000000000..7c337b023ba3 --- /dev/null +++ b/framework/inc/classes/checkediterator.hxx @@ -0,0 +1,345 @@ +/************************************************************************* + * + * 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 __FRAMEWORK_CLASSES_CHECKEDITERATOR_HXX_ +#define __FRAMEWORK_CLASSES_CHECKEDITERATOR_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <macros/debug.hxx> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <sal/types.h> + +#ifndef __SGI_STL_ITERATOR +#include <iterator> +#endif + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ +// exported const +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// exported definitions +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short implement a iterator which support 2 end states! + @descr For our search methods we need a "walking" iterator object with special functionality! + We must check for 3 different states of an iterator - normal position, exact end, after end. + It's neccessary to detect if we have not found a entry and must return our default or + default already returned and we must break loop! + see using in class FilterCache too for further informations! + + @Attention If your wish to debug this inline code ... + under windows and msdev you can use "set ENVCFLAGS=/Ob0" to do that! + + @implements - + @base - + + @devstatus ready to use + @threadsafe no +*//*-*************************************************************************************************************/ + +template< class TContainer > +class CheckedIterator +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + + public: + + //--------------------------------------------------------------------------------------------------------- + // constructor / destructor + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short standard constructor + @descr Set default values on members. + We set it internal to E_UNKNOWN to detect uninitialized instances of this class. + If we found one - we know: "We must call initialize first!" + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + inline CheckedIterator() + : m_eEndState ( E_UNKNOWN ) + , m_pContainer( NULL ) + { + } + + //--------------------------------------------------------------------------------------------------------- + // interface methods + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short initialize instance with valid container + @descr Set new container at an instance of this class. The other member will set automaticly! + m_pPosition = first element in container + m_eEndState = BEFOREEND + + @seealso - + + @param "rContainer", must be a valid reference to an existing container. + @return - + + @onerror An assertion is thrown. + *//*-*****************************************************************************************************/ + + inline void initialize( const TContainer& rContainer ) + { + // Check incoming parameter. We don't accept all! + LOG_ASSERT2( &rContainer==NULL , "CheckedIterator::initialize()", "Invalid parameter detected!" ) + LOG_ASSERT2( m_eEndState!=E_UNKNOWN , "CheckedIterator::initialize()", "Instance already initialized! Don't do it again." ) + + if( m_eEndState == E_UNKNOWN ) + { + // Set new container and update other member. + m_pContainer = &rContainer ; + m_eEndState = E_BEFOREEND ; + m_pPosition = m_pContainer->begin(); + } + } + + /*-****************************************************************************************************//** + @short set internal states to E_END + @descr Sometimes we need a "walking" check-iterator which is initialized with the END-state! + We need it to return one default value if no other ones exist ... + + @seealso using in class FilterCache! + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + inline void setEnd() + { + m_pContainer = NULL ; + m_eEndState = E_END ; + } + + /*-****************************************************************************************************//** + @short set internal states to E_AFTEREND + @descr Sometimes we need a "walking" check-iterator which is initialized with AFTEREND-state! + We need it if we don't have a container but must prevent us against further searching! + + @seealso using in class FilterCache! + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + inline void setAfterEnd() + { + m_pContainer = NULL ; + m_eEndState = E_AFTEREND ; + } + + /*-****************************************************************************************************//** + @short reset this iterator + @descr It must be called on an already initialized iterator. + Means the member m_pContainer must be valid. Otherwhise the reaction + isn't defined. + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + inline void reset() + { + m_eEndState = E_UNKNOWN; + m_pContainer = NULL; + } + + /*-****************************************************************************************************//** + @short step to next element in container. + @descr If end of container is reached we change our internal "m_eEndState". + If end reached for first time; we set it to E_END; + If you step to next element again; we set it to E_AFTEREND. + So you have a chance to differ between "exact end" and "after end"! + + @seealso method isEnd() + @seealso method isAfterEnd() + + @param - + @return A reference to our changed object himself. + + @onerror - + *//*-*****************************************************************************************************/ + + inline CheckedIterator& operator++() + { + // Warn programmer if he forget to initailize object! + LOG_ASSERT2( m_pContainer==NULL, "CheckedIterator::operator++()", "Object not initialized!" ) + // Step to next element if any exist or set our end states. + switch( m_eEndState ) + { + case E_BEFOREEND: { + ++m_pPosition; + // If iterator reaching end ... set right state! + if( m_pPosition == m_pContainer->end() ) + { + m_eEndState = E_END; + } + } + break; + case E_END : { + // Set state only ... iterator already points to end of container! + m_eEndState = E_AFTEREND; + } + break; + } + return *this; + } + + /*-****************************************************************************************************//** + @short return true if internal iterator was not initialized before + @descr These will be true, if use start a new search by using these iterator mechanism! + + @seealso class FilterCache + + @param - + @return True if internalk state E_UNKNOWN - false otherwise. + + @onerror - + *//*-*****************************************************************************************************/ + + inline sal_Bool isUninitialized() + { + return( m_eEndState == E_UNKNOWN ); + } + + /*-****************************************************************************************************//** + @short return true if internal iterator reached end of container + @descr These will be true if you step to the end of internal container. + + @seealso method isAfterEnd() + + @param - + @return True if end reached; false otherwise. + + @onerror - + *//*-*****************************************************************************************************/ + + inline sal_Bool isEnd() + { + // Is true if one end state is set! + return ( + ( m_eEndState == E_END ) || + ( m_eEndState == E_AFTEREND ) + ); + } + + /*-****************************************************************************************************//** + @short return true if you call operator++ again and end already reached + @descr These indicate, that end already reached but you call operator++ again and again! + + @seealso method isEnd() + + @param - + @return True if end multiple reached; false otherwise. + + @onerror - + *//*-*****************************************************************************************************/ + + inline sal_Bool isAfterEnd() + { + // Is true only, if special end state is set! + return( m_eEndState == E_AFTEREND ); + } + + /*-****************************************************************************************************//** + @short support readonly access to container entry + @descr Use it to get the value of current container item. + + @seealso - + + @param - + @return A reference to value of container entry. + + @onerror - + *//*-*****************************************************************************************************/ + + inline typename TContainer::const_iterator getEntry() + { + // Warn programmer if he forget to initialize these object ... + LOG_ASSERT2( m_pContainer==NULL, "CheckedIterator::getEntry()", "Object not initialized!" ) + // or try to read a non existing element! + LOG_ASSERT2( m_eEndState!=E_BEFOREEND, "CheckedIterator::getEntry()", "Wrong using of class detected!" ) + + return m_pPosition; + } + + //------------------------------------------------------------------------------------------------------------- + // private member + //------------------------------------------------------------------------------------------------------------- + + private: + + // These enum defines our four states for an iterator position in curent container. + enum EEndState + { + E_UNKNOWN , + E_BEFOREEND , + E_END , + E_AFTEREND + }; + + const TContainer* m_pContainer ; // pointer to current container + EEndState m_eEndState ; // "position state" of iterator! + typename TContainer::const_iterator m_pPosition ; // point to actual element in container +}; + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_CLASSES_CHECKEDITERATOR_HXX_ diff --git a/framework/inc/classes/converter.hxx b/framework/inc/classes/converter.hxx new file mode 100644 index 000000000000..43972eeefa1b --- /dev/null +++ b/framework/inc/classes/converter.hxx @@ -0,0 +1,92 @@ +/************************************************************************* + * + * 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 __FRAMEWORK_CLASSES_CONVERTER_HXX_ +#define __FRAMEWORK_CLASSES_CONVERTER_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <general.h> +#include <stdtypes.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/beans/NamedValue.hpp> +#include <tools/datetime.hxx> +#include <fwidllapi.h> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ +// exported const +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// exported definitions +//_________________________________________________________________________________________________________________ + +class FWI_DLLPUBLIC Converter +{ + public: + // Seq<Any> <=> Seq<beans.PropertyValue> + static css::uno::Sequence< css::uno::Any > convert_seqProp2seqAny ( const css::uno::Sequence< css::beans::PropertyValue >& lSource ); + static css::uno::Sequence< css::beans::PropertyValue > convert_seqAny2seqProp ( const css::uno::Sequence< css::uno::Any >& lSource ); + + // Seq<beans.NamedValue> <=> Seq<beans.PropertyValue> + static css::uno::Sequence< css::beans::PropertyValue > convert_seqNamedVal2seqPropVal ( const css::uno::Sequence< css::beans::NamedValue >& lSource ); + static css::uno::Sequence< css::beans::NamedValue > convert_seqPropVal2seqNamedVal ( const css::uno::Sequence< css::beans::PropertyValue >& lSource ); + + // Seq<String> => Vector<String> + static OUStringList convert_seqOUString2OUStringList( const css::uno::Sequence< ::rtl::OUString >& lSource ); + static css::uno::Sequence< ::rtl::OUString > convert_OUStringList2seqOUString( const OUStringList& lSource ); + + static css::uno::Sequence< css::beans::PropertyValue > convert_OUStringHash2seqProp ( const OUStringHash& lSource ); + static OUStringHash convert_seqProp2OUStringHash ( const css::uno::Sequence< css::beans::PropertyValue >& lSource ); + + // String <=> tools.DateTime + static DateTime convert_String2DateTime ( const ::rtl::OUString& sSource ); + static ::rtl::OUString convert_DateTime2String ( const DateTime& aSource ); + static ::rtl::OUString convert_DateTime2ISO8601 ( const DateTime& aSource ); +}; + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_CLASSES_CONVERTER_HXX_ diff --git a/framework/inc/classes/droptargetlistener.hxx b/framework/inc/classes/droptargetlistener.hxx new file mode 100644 index 000000000000..34442c2e2a67 --- /dev/null +++ b/framework/inc/classes/droptargetlistener.hxx @@ -0,0 +1,108 @@ +/************************************************************************* + * + * 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 __FRAMEWORK_CLASSES_DROPTARGETLISTENER_HXX_ +#define __FRAMEWORK_CLASSES_DROPTARGETLISTENER_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <threadhelp/threadhelpbase.hxx> +#include <general.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ + +#ifndef _COM_SUN_STAR_DATATRANSFER_DND_XDROPTARGETELISTENER_HPP_ +#include <com/sun/star/datatransfer/dnd/XDropTargetListener.hpp> +#endif +#include <com/sun/star/frame/XFrame.hpp> + +//_________________________________________________________________________________________________________________ +// includes of other projects +//_________________________________________________________________________________________________________________ +#include <cppuhelper/implbase1.hxx> + +#ifndef _SOT_EXCHANGE_HXX_ +#include <sot/exchange.hxx> +#endif + +namespace framework +{ + +class DropTargetListener : private ThreadHelpBase + , public ::cppu::WeakImplHelper1< ::com::sun::star::datatransfer::dnd::XDropTargetListener > +{ + //___________________________________________ + // member + private: + + /// uno service manager to create neccessary services + css::uno::Reference< css::lang::XMultiServiceFactory > m_xFactory; + /// weakreference to target frame (Don't use a hard reference. Owner can't delete us then!) + css::uno::WeakReference< css::frame::XFrame > m_xTargetFrame; + /// drag/drop info + DataFlavorExVector* m_pFormats; + + //___________________________________________ + // c++ interface + public: + + DropTargetListener( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory , + const css::uno::Reference< css::frame::XFrame >& xFrame ); + ~DropTargetListener( ); + + //___________________________________________ + // uno interface + public: + + // XEventListener + virtual void SAL_CALL disposing ( const css::lang::EventObject& Source ) throw(css::uno::RuntimeException); + + // XDropTargetListener + virtual void SAL_CALL drop ( const css::datatransfer::dnd::DropTargetDropEvent& dtde ) throw(css::uno::RuntimeException); + virtual void SAL_CALL dragEnter ( const css::datatransfer::dnd::DropTargetDragEnterEvent& dtdee ) throw(css::uno::RuntimeException); + virtual void SAL_CALL dragExit ( const css::datatransfer::dnd::DropTargetEvent& dte ) throw(css::uno::RuntimeException); + virtual void SAL_CALL dragOver ( const css::datatransfer::dnd::DropTargetDragEvent& dtde ) throw(css::uno::RuntimeException); + virtual void SAL_CALL dropActionChanged( const css::datatransfer::dnd::DropTargetDragEvent& dtde ) throw(css::uno::RuntimeException); + + //___________________________________________ + // internal helper + private: + + void implts_BeginDrag ( const css::uno::Sequence< css::datatransfer::DataFlavor >& rSupportedDataFlavors ); + void implts_EndDrag ( ); + sal_Bool implts_IsDropFormatSupported( SotFormatStringId nFormat ); + void implts_OpenFile ( const String& rFilePath ); + +}; // class DropTargetListener + +} // namespace framework + +#endif // __FRAMEWORK_CLASSES_DROPTARGETLISTENER_HXX_ diff --git a/framework/inc/classes/filtercache.hxx b/framework/inc/classes/filtercache.hxx new file mode 100644 index 000000000000..516c50a1141a --- /dev/null +++ b/framework/inc/classes/filtercache.hxx @@ -0,0 +1,447 @@ +/************************************************************************* + * + * 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. + * + ************************************************************************/ + +/*TODO + - late init + - order by number! + - insert default detector and loader as last ones in hashes ... don't hold it as an extra member! + => CheckedIterator will be obsolete! + */ + +#ifndef __FRAMEWORK_CLASSES_FILTERCACHE_HXX_ +#define __FRAMEWORK_CLASSES_FILTERCACHE_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <classes/filtercachedata.hxx> +#include <threadhelp/threadhelpbase.hxx> + +#ifndef __FRAMEWORK_THREADHELP_TRANSACTIONBASE_HXX_ +#include <threadhelp/transactionbase.hxx> +#endif +#include <general.h> +#include <queries.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/registry/XRegistryKey.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/container/ElementExistException.hpp> +#include <com/sun/star/container/NoSuchElementException.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <rtl/ustring.hxx> + +#ifdef ENABLE_GENERATEFILTERCACHE + #ifndef _RTL_USTRBUF_HXX_ + #include <rtl/ustrbuf.hxx> + #endif +#endif + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ +// exported const +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// exported definitions +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short cache for all filter and type information + @descr Frameloader- and filterfactory need some informations about our current registered filters and types. + For better performance its neccessary to cache all needed values. + + @implements - + @base ThreadHelpBase + TransactionBase + + @devstatus ready to use + @threadsafe yes +*//*-*************************************************************************************************************/ + +class FilterCache : private ThreadHelpBase + , private TransactionBase +{ + public: + + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + + public: + + //--------------------------------------------------------------------------------------------------------- + // constructor / destructor + //--------------------------------------------------------------------------------------------------------- + + FilterCache( sal_Int32 nVersion = DEFAULT_FILTERCACHE_VERSION, + sal_Int16 nMode = DEFAULT_FILTERCACHE_MODE ); + + /*-****************************************************************************************************//** + @short standard destructor to delete instance + @descr This will clear the cache if last owner release it. + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual ~FilterCache(); + + void flush( DataContainer::ECFGType eType ); + + /*-****************************************************************************************************//** + @short get the current state of the cache + @descr Call this methods to get information about the state of the current cache. + + @seealso - + + @param - + @return - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + sal_Bool isValidOrRepairable() const; + sal_Bool hasTypes () const; + sal_Bool hasFilters () const; + sal_Bool hasDetectors () const; + sal_Bool hasLoaders () const; + sal_Bool hasContentHandlers () const; + + /*-****************************************************************************************************//** + @short search routines to find items which match given parameter + @descr Mostly we search for a type first and get all informations about filter, detector and loader + services from the other configuration tables which are registered for this type. + These operations support a FindFirst/Next mechanism. + If you call search...( ... nStartEntry=0 ... ) we search for + the first entry. If these return a value different from <empty> you can work with these value. + If found value isn't the right one - you can call search method again. + DONT'T CHANGE THE VALUE OF "rStartEntry" between two search calls! + You can use returned value as parameter for getBy...Name() functions of this implementation too! + + @attention returned type name is an internal name + returned filter name is an internal name + returned loader name is an implementation name of a service + returned detector name is an implementation name of a service + + @seealso - + + @param "sResult", name of found type, filter, ... + @return true, if search was successful, + false, otherwise. + + @onerror We return false. + *//*-*****************************************************************************************************/ + + sal_Bool searchType ( const ::rtl::OUString& sURL , + const ::rtl::OUString& sMediaType , + const ::rtl::OUString& sClipboardFormat , + CheckedTypeIterator& aStartEntry , + ::rtl::OUString& sResult ) const; + + sal_Bool searchFilterForType ( const ::rtl::OUString& sInternalTypeName , + CheckedStringListIterator& aStartEntry , + ::rtl::OUString& sResult ) const; + + sal_Bool searchDetectorForType ( const ::rtl::OUString& sInternalTypeName , + CheckedStringListIterator& aStartEntry , + ::rtl::OUString& sResult ) const; + + sal_Bool searchLoaderForType ( const ::rtl::OUString& sInternalTypeName , + CheckedStringListIterator& aStartEntry , + ::rtl::OUString& sResult ) const; + + sal_Bool searchContentHandlerForType ( const ::rtl::OUString& sInternalTypeName , + CheckedStringListIterator& aStartEntry , + ::rtl::OUString& sResult ) const; + + /*-****************************************************************************************************//** + @short get all properties of a cache entry by given name + @descr If you need additional informations about our internal cache values + you can use these methods to get a list of all cached config values + and subkeys of specified entry. + + @seealso - + + @param "sName", name of suspected entry in cache + @return A structure with valid information if item exists! An empty Any otherwise. + + @onerror We return an empty Any. + *//*-*****************************************************************************************************/ + + css::uno::Sequence< ::rtl::OUString > getAllTypeNames () const; + css::uno::Sequence< ::rtl::OUString > getAllFilterNames () const; + css::uno::Sequence< ::rtl::OUString > getAllDetectorNames () const; // without default detector! + css::uno::Sequence< ::rtl::OUString > getAllLoaderNames () const; // without default loader! + css::uno::Sequence< ::rtl::OUString > getAllContentHandlerNames () const; + css::uno::Sequence< ::rtl::OUString > getAllDetectorNamesWithDefault () const; // default detector is last one! + css::uno::Sequence< ::rtl::OUString > getAllLoaderNamesWithDefault () const; // default loader is last one! + ::rtl::OUString getDefaultLoader () const; + + css::uno::Sequence< css::beans::PropertyValue > getTypeProperties ( const ::rtl::OUString& sName ) const; + css::uno::Sequence< css::beans::PropertyValue > getFilterProperties ( const ::rtl::OUString& sName ) const; + css::uno::Sequence< css::beans::PropertyValue > getDetectorProperties ( const ::rtl::OUString& sName ) const; + css::uno::Sequence< css::beans::PropertyValue > getLoaderProperties ( const ::rtl::OUString& sName ) const; + css::uno::Sequence< css::beans::PropertyValue > getContentHandlerProperties ( const ::rtl::OUString& sName ) const; + + FileType getType ( const ::rtl::OUString& sName ) const; + Filter getFilter ( const ::rtl::OUString& sName ) const; + Detector getDetector ( const ::rtl::OUString& sName ) const; + Loader getLoader ( const ::rtl::OUString& sName ) const; + ContentHandler getContentHandler ( const ::rtl::OUString& sName ) const; + + sal_Bool existsType ( const ::rtl::OUString& sName ) const; + sal_Bool existsFilter ( const ::rtl::OUString& sName ) const; + sal_Bool existsDetector ( const ::rtl::OUString& sName ) const; + sal_Bool existsLoader ( const ::rtl::OUString& sName ) const; + sal_Bool existsContentHandler ( const ::rtl::OUString& sName ) const; + + /*-****************************************************************************************************//** + @short support special query modes + @descr Our owner services need sometimes a special mode to query for subsets of our configuration! + They give us a special query string - we return right values. + + @seealso file queries.h + @seealso class FilterFactory + @seealso class FrameLoaderFactory + @seealso class TypeDetection + + @param "sName", name of query + @return A structure with valid information! + + @onerror We return an empty result set. + *//*-*****************************************************************************************************/ + + css::uno::Any queryFilters( const ::rtl::OUString& sQuery ) const; + + /*-****************************************************************************************************//** + @short support registration of elements in current configuration + @descr Use this methods to add or remove items in our configuration files. + We use the globale configuration to do that ... in fat office "share/config/registry/..."! + + *** structure of type properties ********************************************************** + + PropertyValue.Name PropertyValue.Value Description + --------------------------------------------------------------------------------------- + ... + + *** structure of filter properties ******************************************************** + + PropertyValue.Name PropertyValue.Value Description + --------------------------------------------------------------------------------------- + "Name" [string] internal name + "Type" [string] registered for these type + "UIName" [string] localized name for UI (valid for current locale at runtime!) + "UINames" [stringlist] assignment of all supported localized names to right locales + "DocumentService" [string] uno servicename of document services + "FilterService" [string] uno servicename of filter implementation + "Flags" [long] describe filter + "UserData" [stringlist] additional user data (format not fixed!) + "FileFormatVersion" [long] version numbher of supported files + "TemplateName" [string] name of template + + *** structure of detector properties ****************************************************** + + PropertyValue.Name PropertyValue.Value Description + --------------------------------------------------------------------------------------- + ... + + *** structure of loader properties ******************************************************** + + PropertyValue.Name PropertyValue.Value Description + --------------------------------------------------------------------------------------- + ... + + @seealso - + + @param "sName" , name of type, filter ... + @param "lProperties" , values of new type, filter + @return state of operation as bool + + @onerror We return false then. + *//*-*****************************************************************************************************/ + + sal_Bool addFilter ( const ::rtl::OUString& sName , + const css::uno::Sequence< css::beans::PropertyValue >& lProperties , + sal_Bool bException ) throw(css::container::ElementExistException , + css::registry::InvalidRegistryException); + sal_Bool replaceFilter( const ::rtl::OUString& sName , + const css::uno::Sequence< css::beans::PropertyValue >& lProperties , + sal_Bool bException ) throw(css::container::NoSuchElementException , + css::registry::InvalidRegistryException); + sal_Bool removeFilter ( const ::rtl::OUString& sName , + sal_Bool bException ) throw(css::container::NoSuchElementException , + css::registry::InvalidRegistryException); + + sal_Bool addType ( const ::rtl::OUString& sName , + const css::uno::Sequence< css::beans::PropertyValue >& lProperties , + sal_Bool bException ) throw(css::container::ElementExistException , + css::registry::InvalidRegistryException); + sal_Bool replaceType ( const ::rtl::OUString& sName , + const css::uno::Sequence< css::beans::PropertyValue >& lProperties , + sal_Bool bException ) throw(css::container::NoSuchElementException , + css::registry::InvalidRegistryException); + sal_Bool removeType ( const ::rtl::OUString& sName , + sal_Bool bException ) throw(css::container::NoSuchElementException , + css::registry::InvalidRegistryException); + + sal_Bool addDetector ( const ::rtl::OUString& sName , + const css::uno::Sequence< css::beans::PropertyValue >& lProperties , + sal_Bool bException ) throw(css::container::ElementExistException , + css::registry::InvalidRegistryException); + sal_Bool replaceDetector( const ::rtl::OUString& sName , + const css::uno::Sequence< css::beans::PropertyValue >& lProperties , + sal_Bool bException ) throw(css::container::NoSuchElementException , + css::registry::InvalidRegistryException); + sal_Bool removeDetector ( const ::rtl::OUString& sName , + sal_Bool bException ) throw(css::container::NoSuchElementException , + css::registry::InvalidRegistryException); + + sal_Bool validateAndRepair(); + sal_Bool validateAndRepairTypes(); + sal_Bool validateAndRepairFilter(); + sal_Bool validateAndRepairDetectors(); + sal_Bool validateAndRepairLoader(); + sal_Bool validateAndRepairHandler(); + + //------------------------------------------------------------------------------------------------------------- + // protected methods + //------------------------------------------------------------------------------------------------------------- + + protected: + + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + + private: + + //------------------------------------------------------------------------------------------------------------- + // debug methods + //------------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short debug-method to check incoming parameter of some other mehods of this class + @descr The following methods are used to check parameters for other methods + of this class. The return value is used directly for an ASSERT(...). + + @seealso ASSERT in implementation! + + @param references to checking variables + @return sal_False ,on invalid parameter + @return sal_True ,otherwise + + @onerror - + *//*-*****************************************************************************************************/ + + #ifdef ENABLE_ASSERTIONS + + private: + + static sal_Bool implcp_searchType ( const ::rtl::OUString& sURL , + const ::rtl::OUString* pMediaType , + const ::rtl::OUString* pClipboardFormat , + const CheckedTypeIterator& aStartEntry , + const ::rtl::OUString& sResult ); + static sal_Bool implcp_searchFilterForType ( const ::rtl::OUString& sInternalTypeName , + const CheckedStringListIterator& aStartEntry , + const ::rtl::OUString& sResult ); + static sal_Bool implcp_searchDetectorForType ( const ::rtl::OUString& sInternalTypeName , + const CheckedStringListIterator& aStartEntry , + const ::rtl::OUString& sResult ); + static sal_Bool implcp_searchLoaderForType ( const ::rtl::OUString& sInternalTypeName , + const CheckedStringListIterator& aStartEntry , + const ::rtl::OUString& sResult ); + static sal_Bool implcp_searchContentHandlerForType ( const ::rtl::OUString& sInternalTypeName , + const CheckedStringListIterator& aStartEntry , + const ::rtl::OUString& sResult ); + static sal_Bool implcp_getTypeProperties ( const ::rtl::OUString& sName ); + static sal_Bool implcp_getFilterProperties ( const ::rtl::OUString& sName ); + static sal_Bool implcp_getDetectorProperties ( const ::rtl::OUString& sName ); + static sal_Bool implcp_getLoaderProperties ( const ::rtl::OUString& sName ); + static sal_Bool implcp_getContentHandlerProperties ( const ::rtl::OUString& sName ); + static sal_Bool implcp_getType ( const ::rtl::OUString& sName ); + static sal_Bool implcp_getFilter ( const ::rtl::OUString& sName ); + static sal_Bool implcp_getDetector ( const ::rtl::OUString& sName ); + static sal_Bool implcp_getLoader ( const ::rtl::OUString& sName ); + static sal_Bool implcp_getContentHandler ( const ::rtl::OUString& sName ); + static sal_Bool implcp_existsType ( const ::rtl::OUString& sName ); + static sal_Bool implcp_existsFilter ( const ::rtl::OUString& sName ); + static sal_Bool implcp_existsDetector ( const ::rtl::OUString& sName ); + static sal_Bool implcp_existsLoader ( const ::rtl::OUString& sName ); + static sal_Bool implcp_existsContentHandler ( const ::rtl::OUString& sName ); + static sal_Bool implcp_addFilter ( const ::rtl::OUString& sName , + const css::uno::Sequence< css::beans::PropertyValue >& lProperties ); + static sal_Bool implcp_replaceFilter ( const ::rtl::OUString& sName , + const css::uno::Sequence< css::beans::PropertyValue >& lProperties ); + static sal_Bool implcp_removeFilter ( const ::rtl::OUString& sName ); + static sal_Bool implcp_queryFilters ( const ::rtl::OUString& sQuery ); + + #endif // #ifdef ENABLE_ASSERTIONS + + #ifdef ENABLE_COMPONENT_SELF_CHECK + + private: + + void impldbg_dumpCache(); + + #endif // ENABLE_COMPONENT_SELF_CHECK + + //------------------------------------------------------------------------------------------------------------- + // private variables + //------------------------------------------------------------------------------------------------------------- + private: + + static sal_Int32 m_nRefCount ; + static DataContainer* m_pData ; + static sal_Int32 m_nVersion ; + static sal_Int16 m_nMode ; + +}; // class FilterCache + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_CLASSES_FILTERCACHE_HXX_ diff --git a/framework/inc/classes/filtercachedata.hxx b/framework/inc/classes/filtercachedata.hxx new file mode 100644 index 000000000000..e6ac179fee50 --- /dev/null +++ b/framework/inc/classes/filtercachedata.hxx @@ -0,0 +1,859 @@ +/************************************************************************* + * + * 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 __FRAMEWORK_CLASSES_FILTERCACHEDATA_HXX_ +#define __FRAMEWORK_CLASSES_FILTERCACHEDATA_HXX_ + +/** Attention: stl headers must(!) be included at first. Otherwhise it can make trouble + with solaris headers ... +*/ +#include <hash_map> +#include <vector> +#include <iterator> + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ +#include <classes/checkediterator.hxx> +#include <classes/wildcard.hxx> +#include <classes/converter.hxx> +#include <threadhelp/threadhelpbase.hxx> +#include <macros/xinterface.hxx> +#include <macros/debug.hxx> +#include <general.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/util/XChangesListener.hpp> +#include <com/sun/star/util/XChangesNotifier.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <unotools/configitem.hxx> +#include <cppuhelper/weak.hxx> +#include <rtl/ustring.hxx> +#include <rtl/logfile.hxx> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ +// exported const +//_________________________________________________________________________________________________________________ + +#define PACKAGENAME_TYPEDETECTION_STANDARD DECLARE_ASCII("Office.TypeDetection" ) /// Names of our configuration files. +#define PACKAGENAME_TYPEDETECTION_ADDITIONAL DECLARE_ASCII("Office.TypeDetectionAdditional" ) +#define CFG_PATH_SEPERATOR DECLARE_ASCII("/" ) /// seperator for configuration pathes +#define PROPERTY_SEPERATOR sal_Unicode(',') /// seperator for own formated property strings of types and filters +#define LIST_SEPERATOR sal_Unicode(';') /// seperator for own formated lists as part of our own formated type- or filter-string +#define LOCALE_FALLBACK DECLARE_ASCII("en-US" ) /// fallback, if configuration can't give us current set locale ... +#define DEFAULT_FILTERCACHE_VERSION 6 /// these implmentation of FilterCache support different version of TypeDetection.xml! This define the current set default one. + +#define DEFAULT_FILTERCACHE_MODE CONFIG_MODE_DELAYED_UPDATE | CONFIG_MODE_ALL_LOCALES /// ConfigItems could run in different modes: supported values are ... { CONFIG_MODE_IMMEDIATE_UPDATE, CONFIG_MODE_DELAYED_UPDATE, CONFIG_MODE_ALL_LOCALES } +//#define DEFAULT_FILTERCACHE_MODE CONFIG_MODE_DELAYED_UPDATE /// ConfigItems could run in different modes: supported values are ... { CONFIG_MODE_IMMEDIATE_UPDATE, CONFIG_MODE_DELAYED_UPDATE, CONFIG_MODE_ALL_LOCALES } + +#define CFG_ENCODING_OPEN DECLARE_ASCII("[\'" ) /// used to start encoding of set names +#define CFG_ENCODING_CLOSE DECLARE_ASCII("\']" ) /// used to finish encoding of set names +#define PRODUCTNAME_VARIABLE DECLARE_ASCII("%productname%") +#define PRODUCTNAME_VARLENGTH 13 +#define PRODUCTNAME_FALLBACK DECLARE_ASCII("StarOffice" ) /// fallback, if configuration can't give us current set product name ... +#define FORMATVERSION_VARIABLE DECLARE_ASCII("%formatversion%" ) +#define FORMATVERSION_VARLENGTH 15 +#define FORMATVERSION_FALLBACK DECLARE_ASCII("6.0/7" ) + +//***************************************************************************************************************** +// We know some default values ... +//***************************************************************************************************************** +#define NAME_DEFAULTDETECTOR DECLARE_ASCII("com.sun.star.comp.office.FilterDetect" ) +#define NAME_GENERICLOADER DECLARE_ASCII("com.sun.star.comp.office.FrameLoader" ) +#define UINAME_GENERICLOADER DECLARE_ASCII("com.sun.star.comp.office.FrameLoader" ) +#define TYPELIST_DEFAULTDETECTOR DECLARE_ASCII("*" ) +#define TYPELIST_GENERICLOADER DECLARE_ASCII("*" ) + +//***************************************************************************************************************** +// This are all supported set-names of our filter configuration. +//***************************************************************************************************************** +#define SUBLIST_TYPES DECLARE_ASCII("Types" ) +#define SUBLIST_FILTERS DECLARE_ASCII("Filters" ) +#define SUBLIST_DETECTSERVICES DECLARE_ASCII("DetectServices" ) +#define SUBLIST_FRAMELOADERS DECLARE_ASCII("FrameLoaders" ) +#define SUBLIST_CONTENTHANDLERS DECLARE_ASCII("ContentHandlers" ) +#define SUBLIST_DEFAULTS DECLARE_ASCII("Defaults" ) + +#define TEMPLATENAME_TYPE DECLARE_ASCII("Type" ) +#define TEMPLATENAME_FILTER DECLARE_ASCII("Filter" ) +#define TEMPLATENAME_DETECTSERVICE DECLARE_ASCII("DetectService" ) +#define TEMPLATENAME_FRAMELOADER DECLARE_ASCII("FrameLoader" ) +#define TEMPLATENAME_CONTENTHANDLER DECLARE_ASCII("ContentHandler" ) + +//***************************************************************************************************************** +// These defines declare all supported names of configuration key names. +// They are not sorted and could be shared by different base configuration items. +//***************************************************************************************************************** +#define SUBKEY_PREFERRED DECLARE_ASCII("Preferred" ) +#define SUBKEY_INSTALLED DECLARE_ASCII("Installed" ) +#define SUBKEY_NAME DECLARE_ASCII("Name" ) +#define SUBKEY_UINAME DECLARE_ASCII("UIName" ) +#define SUBKEY_MEDIATYPE DECLARE_ASCII("MediaType" ) +#define SUBKEY_CLIPBOARDFORMAT DECLARE_ASCII("ClipboardFormat" ) +#define SUBKEY_URLPATTERN DECLARE_ASCII("URLPattern" ) +#define SUBKEY_EXTENSIONS DECLARE_ASCII("Extensions" ) +#define SUBKEY_DOCUMENTICONID DECLARE_ASCII("DocumentIconID" ) +#define SUBKEY_TYPE DECLARE_ASCII("Type" ) +#define SUBKEY_DOCUMENTSERVICE DECLARE_ASCII("DocumentService" ) +#define SUBKEY_FILTERSERVICE DECLARE_ASCII("FilterService" ) +#define SUBKEY_FLAGS DECLARE_ASCII("Flags" ) +#define SUBKEY_USERDATA DECLARE_ASCII("UserData" ) +#define SUBKEY_FILEFORMATVERSION DECLARE_ASCII("FileFormatVersion" ) +#define SUBKEY_TEMPLATENAME DECLARE_ASCII("TemplateName" ) +#define SUBKEY_TYPES DECLARE_ASCII("Types" ) +#define SUBKEY_ORDER DECLARE_ASCII("Order" ) +#define SUBKEY_DEFAULTDETECTOR DECLARE_ASCII("DetectService" ) +#define SUBKEY_GENERICLOADER DECLARE_ASCII("FrameLoader" ) +#define SUBKEY_DATA DECLARE_ASCII("Data" ) +#define SUBKEY_UICOMPONENT DECLARE_ASCII("UIComponent" ) + +//***************************************************************************************************************** +// These defines declare all supported property names for our name container interface. +// They are not sorted by using ... and could be shared by different methods and access operations. +//***************************************************************************************************************** +#define PROPERTY_NAME DECLARE_ASCII("Name" ) +#define PROPERTY_PREFERRED DECLARE_ASCII("Preferred" ) +#define PROPERTY_INSTALLED DECLARE_ASCII("Installed" ) +#define PROPERTY_UINAME DECLARE_ASCII("UIName" ) +#define PROPERTY_UINAMES DECLARE_ASCII("UINames" ) +#define PROPERTY_MEDIATYPE DECLARE_ASCII("MediaType" ) +#define PROPERTY_CLIPBOARDFORMAT DECLARE_ASCII("ClipboardFormat" ) +#define PROPERTY_URLPATTERN DECLARE_ASCII("URLPattern" ) +#define PROPERTY_EXTENSIONS DECLARE_ASCII("Extensions" ) +#define PROPERTY_DOCUMENTICONID DECLARE_ASCII("DocumentIconID" ) +#define PROPERTY_TYPE DECLARE_ASCII("Type" ) +#define PROPERTY_DOCUMENTSERVICE DECLARE_ASCII("DocumentService" ) +#define PROPERTY_FILTERSERVICE DECLARE_ASCII("FilterService" ) +#define PROPERTY_FLAGS DECLARE_ASCII("Flags" ) +#define PROPERTY_USERDATA DECLARE_ASCII("UserData" ) +#define PROPERTY_FILEFORMATVERSION DECLARE_ASCII("FileFormatVersion" ) +#define PROPERTY_TEMPLATENAME DECLARE_ASCII("TemplateName" ) +#define PROPERTY_TYPES DECLARE_ASCII("Types" ) +#define PROPERTY_ORDER DECLARE_ASCII("Order" ) +#define PROPERTY_UICOMPONENT DECLARE_ASCII("UIComponent" ) + +//_________________________________________________________________________________________________________________ +// exported definitions +//_________________________________________________________________________________________________________________ + +enum EModifyState +{ + E_UNTOUCHED , + E_ADDED , + E_CHANGED , + E_REMOVED +}; + +enum EFilterPackage +{ + E_STANDARD , + E_ADDITIONAL +}; + +//***************************************************************************************************************** +// These struct define a type, which present the type of a file. +// He is used for easy filter detection without file stream detection! +// The internal name is the keyname of an item with these structure in our hash map or our configuration set! +//***************************************************************************************************************** +struct FileType +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + public: + + inline FileType ( ) { impl_clear(); } + inline FileType ( const FileType& rCopy ) { impl_copy( rCopy ); } + inline ~FileType ( ) { impl_clear(); } + inline FileType& operator= ( const FileType& rCopy ) { return impl_copy( rCopy ); } + inline void free ( ) { impl_clear(); } + + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + private: + + inline void impl_clear() + { + bPreferred = sal_False ; + sName = ::rtl::OUString() ; + sMediaType = ::rtl::OUString() ; + sClipboardFormat = ::rtl::OUString() ; + nDocumentIconID = 0 ; + lUINames.free (); + lURLPattern.free(); + lExtensions.free(); + } + + inline FileType& impl_copy( const FileType& rCopy ) + { + bPreferred = rCopy.bPreferred ; + sName = rCopy.sName ; + lUINames = rCopy.lUINames ; + sMediaType = rCopy.sMediaType ; + sClipboardFormat = rCopy.sClipboardFormat; + nDocumentIconID = rCopy.nDocumentIconID ; + lURLPattern = rCopy.lURLPattern ; + lExtensions = rCopy.lExtensions ; + return (*this); + } + + //------------------------------------------------------------------------------------------------------------- + // public member + //------------------------------------------------------------------------------------------------------------- + public: + + sal_Bool bPreferred ; + ::rtl::OUString sName ; + OUStringHash lUINames ; + ::rtl::OUString sMediaType ; + ::rtl::OUString sClipboardFormat ; + sal_Int32 nDocumentIconID ; + OUStringList lURLPattern ; + OUStringList lExtensions ; +}; + +//***************************************************************************************************************** +// These struct describe a filter which is registered for one type. +// He hold information about services which present the document himself (like a item) and a filter service which +// filter a file in these document. +// The internal name is the keyname of an item with these structure in our hash map or our configuration set! +//***************************************************************************************************************** +struct Filter +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + public: + + inline Filter ( ) { impl_clear(); } + inline Filter ( const Filter& rCopy ) { impl_copy( rCopy ); } + inline ~Filter ( ) { impl_clear(); } + inline Filter& operator= ( const Filter& rCopy ) { return impl_copy( rCopy ); } + inline void free ( ) { impl_clear(); } + + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + private: + + inline void impl_clear() + { + nOrder = 0 ; + sName = ::rtl::OUString(); + sType = ::rtl::OUString(); + sDocumentService = ::rtl::OUString(); + sFilterService = ::rtl::OUString(); + sUIComponent = ::rtl::OUString(); + nFlags = 0 ; + nFileFormatVersion = 0 ; + sTemplateName = ::rtl::OUString(); + lUINames.free (); + lUserData.free (); + } + + inline Filter& impl_copy( const Filter& rCopy ) + { + nOrder = rCopy.nOrder ; + sName = rCopy.sName ; + sType = rCopy.sType ; + lUINames = rCopy.lUINames ; + sDocumentService = rCopy.sDocumentService ; + sFilterService = rCopy.sFilterService ; + sUIComponent = rCopy.sUIComponent ; + nFlags = rCopy.nFlags ; + nFileFormatVersion = rCopy.nFileFormatVersion ; + sTemplateName = rCopy.sTemplateName ; + lUserData = rCopy.lUserData ; + return (*this); + } + + //------------------------------------------------------------------------------------------------------------- + // public member + //------------------------------------------------------------------------------------------------------------- + public: + + sal_Int32 nOrder ; + ::rtl::OUString sName ; + ::rtl::OUString sType ; + OUStringHash lUINames ; + ::rtl::OUString sDocumentService ; + ::rtl::OUString sFilterService ; + ::rtl::OUString sUIComponent ; + sal_Int32 nFlags ; + OUStringList lUserData ; + sal_Int32 nFileFormatVersion ; + ::rtl::OUString sTemplateName ; +}; + +//***************************************************************************************************************** +// Programmer can register his own services for an content detection of different types. +// The implementation or service name of these is the keyname of an item with these structure +// in our hash map or our configuration set! +//***************************************************************************************************************** +struct Detector +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + public: + + inline Detector ( ) { impl_clear(); } + inline Detector ( const Detector& rCopy ) { impl_copy( rCopy ); } + inline ~Detector ( ) { impl_clear(); } + inline Detector& operator= ( const Detector& rCopy ) { return impl_copy( rCopy ); } + inline void free ( ) { impl_clear(); } + + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + private: + + inline void impl_clear() + { + sName = ::rtl::OUString(); + lTypes.free(); + } + + inline Detector& impl_copy( const Detector& rCopy ) + { + sName = rCopy.sName ; + lTypes = rCopy.lTypes ; + return (*this); + } + + //------------------------------------------------------------------------------------------------------------- + // public member + //------------------------------------------------------------------------------------------------------------- + public: + + ::rtl::OUString sName ; + OUStringList lTypes ; +}; + +//***************************************************************************************************************** +// Programmer can register his own services for loading documents in a frame. +// The implementation or service name of these is the keyname of an item with these structure +// in our hash map or our configuration set! +//***************************************************************************************************************** +struct Loader +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + public: + + inline Loader ( ) { impl_clear(); } + inline Loader ( const Loader& rCopy ) { impl_copy( rCopy ); } + inline ~Loader ( ) { impl_clear(); } + inline Loader& operator= ( const Loader& rCopy ) { return impl_copy( rCopy ); } + inline void free ( ) { impl_clear(); } + + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + private: + + inline void impl_clear() + { + sName = ::rtl::OUString(); + lUINames.free (); + lTypes.free (); + } + + inline Loader& impl_copy( const Loader& rCopy ) + { + sName = rCopy.sName ; + lUINames = rCopy.lUINames ; + lTypes = rCopy.lTypes ; + return (*this); + } + + //------------------------------------------------------------------------------------------------------------- + // public member + //------------------------------------------------------------------------------------------------------------- + public: + + ::rtl::OUString sName ; + OUStringHash lUINames ; + OUStringList lTypes ; +}; + +//***************************************************************************************************************** +// Programmer can register his own services to handle a FileType and intercept dispatches. +// Don't forget: It's not a FrameLoader - it's a ContentHandler! (normaly without any UI) +//***************************************************************************************************************** +struct ContentHandler +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + public: + + inline ContentHandler( ) { impl_clear(); } + inline ContentHandler( const ContentHandler& rCopy ) { impl_copy( rCopy ); } + inline ~ContentHandler( ) { impl_clear(); } + inline ContentHandler& operator= ( const ContentHandler& rCopy ) { return impl_copy( rCopy ); } + inline void free ( ) { impl_clear(); } + + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + private: + + inline void impl_clear() + { + sName = ::rtl::OUString(); + lTypes.free(); + } + + inline ContentHandler& impl_copy( const ContentHandler& rCopy ) + { + sName = rCopy.sName ; + lTypes = rCopy.lTypes; + return (*this); + } + + //------------------------------------------------------------------------------------------------------------- + // public member + //------------------------------------------------------------------------------------------------------------- + public: + + ::rtl::OUString sName ; + OUStringList lTypes ; +}; + +//***************************************************************************************************************** +// We need different hash maps for different tables of our configuration management. +// Follow maps convert <names> to <properties> of type, filter, detector, loader ... +// and could be used in a generic way +//***************************************************************************************************************** +template< class HashType > +class SetNodeHash : public ::std::hash_map< ::rtl::OUString , + HashType , + OUStringHashCode , + ::std::equal_to< ::rtl::OUString > > +{ + //------------------------------------------------------------------------------------------------------------- + // interface + //------------------------------------------------------------------------------------------------------------- + public: + //--------------------------------------------------------------------------------------------------------- + // The only way to free ALL memory realy! + //--------------------------------------------------------------------------------------------------------- + inline void free() + { + SetNodeHash().swap( *this ); + lAddedItems.free (); + lChangedItems.free(); + lRemovedItems.free(); + } + + //--------------------------------------------------------------------------------------------------------- + // Append changed, added or removed items to special lists + // Neccessary for saving changes + //--------------------------------------------------------------------------------------------------------- + void appendChange( const ::rtl::OUString& sName , + EModifyState eState ); + + //------------------------------------------------------------------------------------------------------------- + // member + //------------------------------------------------------------------------------------------------------------- + public: + OUStringList lAddedItems ; + OUStringList lChangedItems ; + OUStringList lRemovedItems ; +}; + +//***************************************************************************************************************** +// Use these hashes to implement different tables which assign types to frame loader or detect services. +// It's an optimism to find registered services faster! +// The preferred hash maps file extensions to preferred types to find these ones faster. +//***************************************************************************************************************** +class PerformanceHash : public ::std::hash_map< ::rtl::OUString , + OUStringList , + OUStringHashCode , + ::std::equal_to< ::rtl::OUString > > +{ + public: + //--------------------------------------------------------------------------------------------------------- + // try to free all used memory REALY! + //--------------------------------------------------------------------------------------------------------- + inline void free() + { + PerformanceHash().swap( *this ); + } + + //--------------------------------------------------------------------------------------------------------- + // normaly a complete string must match our hash key values ... + // But sometimes we need a search by using these key values as pattern! + // The in/out parameter "pStepper" is used to return a pointer to found element in hash ... + // and could be used for further searches again, which should be started at next element! + // We stop search at the end of hash. You can start it again by setting it to the begin by himself. + //--------------------------------------------------------------------------------------------------------- + inline sal_Bool findPatternKey( const ::rtl::OUString& sSearchValue , + const_iterator& pStepper ) + { + sal_Bool bFound = sal_False; + + // If this is the forst call - start search on first element. + // Otherwise start search on further elements! + if( pStepper != begin() ) + { + ++pStepper; + } + + while( + ( pStepper != end() ) && + ( bFound == sal_False ) + ) + { + bFound = Wildcard::match( sSearchValue, pStepper->first ); + // If element was found - break loop by setting right return value + // and don't change "pStepper". He must point to found element! + // Otherwise step to next one. + if( bFound == sal_False ) + ++pStepper; + } + return bFound; + } +}; + +//***************************************************************************************************************** +// Define easy usable types +//***************************************************************************************************************** +typedef SetNodeHash< FileType > FileTypeHash ; +typedef SetNodeHash< Filter > FilterHash ; +typedef SetNodeHash< Detector > DetectorHash ; +typedef SetNodeHash< Loader > LoaderHash ; +typedef SetNodeHash< ContentHandler > ContentHandlerHash ; +typedef OUStringHash PreferredHash ; +typedef OUStringList OrderList ; + +typedef CheckedIterator< OUStringList > CheckedStringListIterator ; +typedef CheckedIterator< FileTypeHash > CheckedTypeIterator ; +typedef CheckedIterator< PerformanceHash > CheckedPerformanceIterator ; + +typedef ::std::vector< FilterHash::const_iterator > FilterQuery ; + +//***************************************************************************************************************** +// Use private static data container to hold all values of configuration! +//***************************************************************************************************************** +class DataContainer : private ThreadHelpBase +{ + public: + + /** @short identifies different sets of the TypeDetection configuration package. + + @descr Most functions on top of this configuration package are the same ... + but must be executed on different places inside ths configuration structures. + These enum values can be used ate some interface methods to specify, which + configuration set should be used. + Further it must be possible to start the same action for more then one cfg type. + That's why these values must be interpreted as flags. Means: it's values must be + in range [2^n]! + */ + enum ECFGType + { + E_TYPE = 1, + E_FILTER = 2, + E_DETECTSERVICE = 4, + E_FRAMELOADER = 8, + E_CONTENTHANDLER = 16, + + E_ALL = E_TYPE | E_FILTER | E_DETECTSERVICE | E_FRAMELOADER | E_CONTENTHANDLER + }; + + public: + + DataContainer(); + + void startListener(); + void stopListener (); + + sal_Bool isModified(); + + LockHelper& getSyncronizer(); + void free(); + + sal_Bool isValidOrRepairable () const; + sal_Bool validateAndRepair (); + sal_Bool validateAndRepairTypes (); + sal_Bool validateAndRepairFilter (); + sal_Bool validateAndRepairDetectors(); + sal_Bool validateAndRepairLoader (); + sal_Bool validateAndRepairHandler (); + + sal_Bool existsType ( const ::rtl::OUString& sName ); + sal_Bool existsFilter ( const ::rtl::OUString& sName ); + sal_Bool existsDetector ( const ::rtl::OUString& sName ); + sal_Bool existsLoader ( const ::rtl::OUString& sName ); + sal_Bool existsContentHandler ( const ::rtl::OUString& sName ); + + void addType ( const FileType& aType , sal_Bool bSetModified ); + void addFilter ( const Filter& aFilter , sal_Bool bSetModified ); + void addDetector ( const Detector& aDetector, sal_Bool bSetModified ); + void addLoader ( const Loader& aLoader , sal_Bool bSetModified ); + void addContentHandler ( const ContentHandler& aHandler , sal_Bool bSetModified ); + + void replaceType ( const FileType& aType , sal_Bool bSetModified ); + void replaceFilter ( const Filter& aFilter , sal_Bool bSetModified ); + void replaceDetector ( const Detector& aDetector, sal_Bool bSetModified ); + void replaceLoader ( const Loader& aLoader , sal_Bool bSetModified ); + void replaceContentHandler( const ContentHandler& aHandler , sal_Bool bSetModified ); + + void removeType ( const ::rtl::OUString& sName , sal_Bool bSetModified ); + void removeFilter ( const ::rtl::OUString& sName , sal_Bool bSetModified ); + void removeDetector ( const ::rtl::OUString& sName , sal_Bool bSetModified ); + void removeLoader ( const ::rtl::OUString& sName , sal_Bool bSetModified ); + void removeContentHandler ( const ::rtl::OUString& sName , sal_Bool bSetModified ); + + static void convertFileTypeToPropertySequence ( const FileType& aSource , + css::uno::Sequence< css::beans::PropertyValue >& lDestination , + const ::rtl::OUString& sCurrentLocale ); + static void convertFilterToPropertySequence ( const Filter& aSource , + css::uno::Sequence< css::beans::PropertyValue >& lDestination , + const ::rtl::OUString& sCurrentLocale ); + static void convertDetectorToPropertySequence ( const Detector& aSource , + css::uno::Sequence< css::beans::PropertyValue >& lDestination ); + static void convertLoaderToPropertySequence ( const Loader& aSource , + css::uno::Sequence< css::beans::PropertyValue >& lDestination , + const ::rtl::OUString& sCurrentLocale ); + static void convertContentHandlerToPropertySequence ( const ContentHandler& aSource , + css::uno::Sequence< css::beans::PropertyValue >& lDestination ); + static void convertPropertySequenceToFilter ( const css::uno::Sequence< css::beans::PropertyValue >& lSource , + Filter& aDestination , + const ::rtl::OUString& sCurrentLocale ); + static void convertPropertySequenceToFileType ( const css::uno::Sequence< css::beans::PropertyValue >& lSource , + FileType& aDestination , + const ::rtl::OUString& sCurrentLocale ); + static void convertPropertySequenceToDetector ( const css::uno::Sequence< css::beans::PropertyValue >& lSource , + Detector& aDestination ); + static void convertPropertySequenceToLoader ( const css::uno::Sequence< css::beans::PropertyValue >& lSource , + Loader& aDestination , + const ::rtl::OUString& sCurrentLocale ); + static void convertPropertySequenceToContentHandler ( const css::uno::Sequence< css::beans::PropertyValue >& lSource , + ContentHandler& aDestination , + const ::rtl::OUString& sCurrentLocale ); + static void extractLocalizedStrings ( const ::rtl::OUString& sCurrentLocale , + const css::uno::Any& aCFGValue , + OUStringHash& lLocales ); + static void packLocalizedStrings ( sal_Int16 nMode , + const ::rtl::OUString& sCurrentLocale , + css::uno::Any& aCFGValue , + const OUStringHash& lLocales ); + static ::rtl::OUString getLocalelizedString ( const OUStringHash& lLocales , + const ::rtl::OUString& sLocale ); + static void setLocalelizedString ( OUStringHash& lLocales , + const ::rtl::OUString& sLocale , + const ::rtl::OUString& sValue ); + static void correctExtensions ( OUStringList& lExtensions ); + + public: + + FileTypeHash m_aTypeCache ; /// hold all informations about registered file types + FilterHash m_aFilterCache ; /// hold all informations about registered filters + DetectorHash m_aDetectorCache ; /// hold all informations about registered detect services + LoaderHash m_aLoaderCache ; /// hold all informations about registered loader services + ContentHandlerHash m_aContentHandlerCache ; /// hold all informations about registered content handler services + PerformanceHash m_aFastFilterCache ; /// hold all registered filter for a special file type + PerformanceHash m_aFastDetectorCache ; /// hold all registered detect services for a special file type + PerformanceHash m_aFastLoaderCache ; /// hold all registered loader services for a special file type + PerformanceHash m_aFastContentHandlerCache ; /// hold all registered content handler services for a special file type + PreferredHash m_aPreferredTypesCache ; /// assignment of extensions to preferred types for it + Loader m_aGenericLoader ; /// informations about our default frame loader + ::rtl::OUString m_sLocale ; /// current set locale of configuration to handle right UIName from set of all UINames! + sal_Bool m_bTypesModified ; + sal_Bool m_bFiltersModified ; + sal_Bool m_bDetectorsModified ; + sal_Bool m_bLoadersModified ; + sal_Bool m_bHandlersModified ; +}; + +/*-************************************************************************************************************//** + @short capsulate configuration access for fiter configuration + @descr We use the ConfigItem mechanism to read/write values from/to configuration. + This implementation could be used to handle standard AND additional filter configurations in the same way. + We set a data container pointer for filling or reading ... this class use it temp. + After successfuly calling of read(), we can use filled container directly or merge it with an existing one. + After successfuly calling of write() all values of given data container are flushed to our configuration. + + @implements - + @base ConfigItem + + @devstatus ready to use + @threadsafe no +*//*-*************************************************************************************************************/ +class FilterCFGAccess : public ::utl::ConfigItem +{ + //------------------------------------------------------------------------------------------------------------- + // interface + //------------------------------------------------------------------------------------------------------------- + public: + FilterCFGAccess ( const ::rtl::OUString& sPath , + sal_Int32 nVersion = DEFAULT_FILTERCACHE_VERSION , + sal_Int16 nMode = DEFAULT_FILTERCACHE_MODE ); // open configuration + virtual ~FilterCFGAccess( ); + + void read ( DataContainer& rData , + DataContainer::ECFGType eType ); // read values from configuration into given struct + void write ( DataContainer& rData , + DataContainer::ECFGType eType ); // write values from given struct to configuration + + static ::rtl::OUString encodeTypeData ( const FileType& aType ); // build own formated string of type properties + static void decodeTypeData ( const ::rtl::OUString& sData , + FileType& aType ); + static ::rtl::OUString encodeFilterData( const Filter& aFilter ); // build own formated string of filter properties + static void decodeFilterData( const ::rtl::OUString& sData , + Filter& aFilter ); + static ::rtl::OUString encodeStringList( const OUStringList& lList ); // build own formated string of OUStringList + static OUStringList decodeStringList( const ::rtl::OUString& sValue ); + + void setProductName ( OUStringHash& lUINames ); + void resetProductName ( OUStringHash& lUINames ); + + //------------------------------------------------------------------------------------------------------------- + // internal helper + //------------------------------------------------------------------------------------------------------------- + private: + void impl_initKeyCounts ( ); // set right key counts, which are used at reading/writing of set node properties + void impl_removeNodes ( OUStringList& rChangesList , // helper to remove list of set nodes + const ::rtl::OUString& sTemplateType , + const ::rtl::OUString& sSetName ); + + void impl_loadTypes ( DataContainer& rData ); // helper to load configuration parts + void impl_loadFilters ( DataContainer& rData ); + void impl_loadDetectors ( DataContainer& rData ); + void impl_loadLoaders ( DataContainer& rData ); + void impl_loadContentHandlers ( DataContainer& rData ); + void impl_loadDefaults ( DataContainer& rData ); + + void impl_saveTypes ( DataContainer& rData ); // helper to save configuration parts + void impl_saveFilters ( DataContainer& rData ); + void impl_saveDetectors ( DataContainer& rData ); + void impl_saveLoaders ( DataContainer& rData ); + void impl_saveContentHandlers ( DataContainer& rData ); + + //------------------------------------------------------------------------------------------------------------- + // debug checks + //------------------------------------------------------------------------------------------------------------- + private: + static sal_Bool implcp_ctor ( const ::rtl::OUString& sPath , // methods to check incoming parameter on our interface methods! + sal_Int32 nVersion , + sal_Int16 nMode ); + static sal_Bool implcp_read ( const DataContainer& rData ); + static sal_Bool implcp_write( const DataContainer& rData ); + + //------------------------------------------------------------------------------------------------------------- + // member + //------------------------------------------------------------------------------------------------------------- + private: + EFilterPackage m_ePackage ; // ... not realy used yet! should split configuration in STANDARD and ADDITIONAL filter + sal_Int32 m_nVersion ; // file format version of configuration! (neccessary for "xml2xcd" transformation!) + sal_Int32 m_nKeyCountTypes ; // follow key counts present count of configuration properties for types/filters ... and depends from m_nVersion - must be set right! + sal_Int32 m_nKeyCountFilters ; + sal_Int32 m_nKeyCountDetectors ; + sal_Int32 m_nKeyCountLoaders ; + sal_Int32 m_nKeyCountContentHandlers ; + ::rtl::OUString m_sProductName ; + ::rtl::OUString m_sFormatVersion ; +}; +/*DRAFT +class FilterCFGListener : public css::util::XChangesListener + , private ThreadHelpBase + , public ::cppu::OWeakObject +{ + public: + + enum ECFGType + { + E_TYPE , + E_FILTER , + E_LOADER , + E_DETECTOR , + E_CONTENTHANDLER + }; + + private: + + // read only access to the configuration, where we are regsieterd as changes listener. + css::uno::Reference< css::uno::XInterface > m_xCFG; + + // indicates, for which type of configuration item we listen. + ECFGType m_eType; + + DataContainer* m_pData; + + // we must know, if we are already registered as listener or not. + // That can be usefull to supress double registration calls ... + // which may will force double call backs in our disposing method! + // Such superflous calls can be dangerous. + sal_Bool m_bListening; + + public: + + DECLARE_XINTERFACE + + FilterCFGListener( const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR , + ECFGType eType , + DataContainer* pData ); + + void startListening(); + void stopListening (); + + virtual void SAL_CALL changesOccurred( const css::util::ChangesEvent& aEvent ) throw(css::uno::RuntimeException); + virtual void SAL_CALL disposing ( const css::lang::EventObject& aEvent ) throw(css::uno::RuntimeException); + + private: + + FileType impl_readType ( const css::uno::Reference< css::uno::XInterface >& xNode ); + Filter impl_readFilter ( const css::uno::Reference< css::uno::XInterface >& xNode ); + Detector impl_readDetector( const css::uno::Reference< css::uno::XInterface >& xNode ); + Loader impl_readLoader ( const css::uno::Reference< css::uno::XInterface >& xNode ); + ContentHandler impl_readHandler ( const css::uno::Reference< css::uno::XInterface >& xNode ); +}; +*/ + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_CLASSES_FILTERCACHEDATA_HXX_ diff --git a/framework/inc/classes/framecontainer.hxx b/framework/inc/classes/framecontainer.hxx new file mode 100644 index 000000000000..bd3aee81694b --- /dev/null +++ b/framework/inc/classes/framecontainer.hxx @@ -0,0 +1,151 @@ +/************************************************************************* + * + * 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 __FRAMEWORK_CLASSES_FRAMECONTAINER_HXX_ +#define __FRAMEWORK_CLASSES_FRAMECONTAINER_HXX_ + +/** Attention: stl headers must(!) be included at first. Otherwhise it can make trouble + with solaris headers ... +*/ +#include <vector> +#include <stdexcept> +#include <algorithm> + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ +#include <threadhelp/threadhelpbase.hxx> + +#ifndef __FRAMEWORK_THREADHELP_TRANSACTIONBASE_HXX_ +#include <threadhelp/transactionbase.hxx> +#endif +#include <macros/debug.hxx> +#include <general.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/uno/Reference.hxx> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <cppuhelper/weakref.hxx> +#include <vos/ref.hxx> +#include <rtl/ustring.hxx> +#include <vcl/evntpost.hxx> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ +// exported const +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// exported definitions +//_________________________________________________________________________________________________________________ + +typedef ::std::vector< css::uno::Reference< css::frame::XFrame > > TFrameContainer ; +typedef TFrameContainer::iterator TFrameIterator ; +typedef TFrameContainer::const_iterator TConstFrameIterator ; + +/*-************************************************************************************************************//** + @short implement a container to hold childs of frame, task or desktop + @descr Every object of frame, task or desktop hold reference to his childs. These container is used as helper + to do this. Some helper-classe like OFrames or OTasksAccess use it to. They hold a pointer to an instance + of this class, which is a member of a frame, task or desktop! You can append and remove frames. + It's possible to set one of these frames as active or deactive. You could have full index-access to + container-items. + + @base ThreadHelpBase + guarantee right initialized lock member during boostrap! + + @devstatus ready to use + @threadsafe yes + @modified 01.07.2002 14:39, as96863 +*//*-*************************************************************************************************************/ +class FrameContainer : private ThreadHelpBase +{ + //_______________________________________ + // member + + private: + + /// list to hold all frames + TFrameContainer m_aContainer; + /// one container item can be the current active frame. Its neccessary for Desktop or Frame implementation. + css::uno::Reference< css::frame::XFrame > m_xActiveFrame; +/*DEPRECATEME + /// indicates using of the automatic async quit feature in case last task will be closed + sal_Bool m_bAsyncQuit; + /// used to execute the terminate request asyncronous + ::vcl::EventPoster m_aAsyncCall; + /// used for async quit feature (must be weak to prevent us against strange situations!) + css::uno::WeakReference< css::frame::XDesktop > m_xDesktop; +*/ + + //_______________________________________ + // interface + + public: + + /// constructor / destructor + FrameContainer(); + virtual ~FrameContainer(); + + /// add/remove/mark container items + void append ( const css::uno::Reference< css::frame::XFrame >& xFrame ); + void remove ( const css::uno::Reference< css::frame::XFrame >& xFrame ); + void setActive ( const css::uno::Reference< css::frame::XFrame >& xFrame ); + css::uno::Reference< css::frame::XFrame > getActive ( ) const; + + /// checks and free memory + sal_Bool exist ( const css::uno::Reference< css::frame::XFrame >& xFrame ) const; + void clear ( ); + + /// deprecated IndexAccess! + sal_uInt32 getCount ( ) const; + css::uno::Reference< css::frame::XFrame > operator[]( sal_uInt32 nIndex ) const; + + /// replacement for deprectaed index access + css::uno::Sequence< css::uno::Reference< css::frame::XFrame > > getAllElements() const; + + /// special helper for Frame::findFrame() + css::uno::Reference< css::frame::XFrame > searchOnAllChildrens ( const ::rtl::OUString& sName ) const; + css::uno::Reference< css::frame::XFrame > searchOnDirectChildrens( const ::rtl::OUString& sName ) const; + +}; // class FrameContainer + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_CLASSES_FRAMECONTAINER_HXX_ diff --git a/framework/inc/classes/fwkresid.hxx b/framework/inc/classes/fwkresid.hxx new file mode 100644 index 000000000000..e8a9da8d6d6c --- /dev/null +++ b/framework/inc/classes/fwkresid.hxx @@ -0,0 +1,47 @@ +/************************************************************************* + * + * 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 __FRAMEWORK_CLASSES_FWKRESID_HXX_ +#define __FRAMEWORK_CLASSES_FWKRESID_HXX_ + +#include <tools/resid.hxx> +#include <framework/fwedllapi.h> + +namespace framework +{ + +class FWE_DLLPUBLIC FwkResId : public ResId +{ + public: + FwkResId( sal_uInt16 nId ); + + static ResMgr* GetResManager(); +}; + +} + +#endif // __FRAMEWORK_CLASSES_FWKRESID diff --git a/framework/inc/classes/fwktabwindow.hxx b/framework/inc/classes/fwktabwindow.hxx new file mode 100644 index 000000000000..7d01b3c6f9d8 --- /dev/null +++ b/framework/inc/classes/fwktabwindow.hxx @@ -0,0 +1,135 @@ +/************************************************************************* + * + * 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 FRAMEWORK_TABWINDOW_HXX +#define FRAMEWORK_TABWINDOW_HXX + +#include <general.h> + +#include <vector> + +#include <com/sun/star/uno/Reference.h> +#include <vcl/tabctrl.hxx> +#include <vcl/tabdlg.hxx> +#include <vcl/tabpage.hxx> +#include <vcl/button.hxx> + +namespace com { namespace sun { namespace star { + namespace awt { + class XWindow; + class XContainerWindowProvider; + class XContainerWindowEventHandler; } + namespace beans { + struct NamedValue; } +} } } + +namespace framework +{ + +class FwkTabControl : public TabControl +{ +public: + FwkTabControl( Window* pParent, const ResId& rResId ); + + void BroadcastEvent( sal_uLong nEvent ); +}; + +class FwkTabPage : public TabPage +{ +private: + rtl::OUString m_sPageURL; + rtl::OUString m_sEventHdl; + css::uno::Reference< css::awt::XWindow > m_xPage; + css::uno::Reference< css::awt::XContainerWindowEventHandler > m_xEventHdl; + css::uno::Reference< css::awt::XContainerWindowProvider > m_xWinProvider; + + void CreateDialog(); + sal_Bool CallMethod( const rtl::OUString& rMethod ); + +public: + FwkTabPage( + Window* pParent, + const rtl::OUString& rPageURL, + const css::uno::Reference< css::awt::XContainerWindowEventHandler >& rEventHdl, + const css::uno::Reference< css::awt::XContainerWindowProvider >& rProvider ); + + virtual ~FwkTabPage(); + + virtual void ActivatePage(); + virtual void DeactivatePage(); + virtual void Resize(); +}; + +struct TabEntry +{ + sal_Int32 m_nIndex; + FwkTabPage* m_pPage; + ::rtl::OUString m_sPageURL; + css::uno::Reference< css::awt::XContainerWindowEventHandler > m_xEventHdl; + + TabEntry() : + m_nIndex( -1 ), m_pPage( NULL ) {} + + TabEntry( sal_Int32 nIndex, ::rtl::OUString sURL, const css::uno::Reference< css::awt::XContainerWindowEventHandler > & rEventHdl ) : + m_nIndex( nIndex ), m_pPage( NULL ), m_sPageURL( sURL ), m_xEventHdl( rEventHdl ) {} + + ~TabEntry() { delete m_pPage; } +}; + +typedef std::vector< TabEntry* > TabEntryList; + +class FwkTabWindow : public Window +{ +private: + FwkTabControl m_aTabCtrl; + TabEntryList m_TabList; + + css::uno::Reference< css::awt::XContainerWindowProvider > m_xWinProvider; + + void ClearEntryList(); + TabEntry* FindEntry( sal_Int32 nIndex ) const; + bool RemoveEntry( sal_Int32 nIndex ); + + DECL_DLLPRIVATE_LINK( ActivatePageHdl, TabControl * ); + DECL_DLLPRIVATE_LINK( DeactivatePageHdl, TabControl * ); + DECL_DLLPRIVATE_LINK( CloseHdl, PushButton * ); + +public: + FwkTabWindow( Window* pParent ); + ~FwkTabWindow(); + + void AddEventListener( const Link& rEventListener ); + void RemoveEventListener( const Link& rEventListener ); + FwkTabPage* AddTabPage( sal_Int32 nIndex, const css::uno::Sequence< css::beans::NamedValue >& rProperties ); + void ActivatePage( sal_Int32 nIndex ); + void RemovePage( sal_Int32 nIndex ); + virtual void Resize(); +}; + +} // namespace framework + +#endif + diff --git a/framework/inc/classes/fwlresid.hxx b/framework/inc/classes/fwlresid.hxx new file mode 100755 index 000000000000..673a110a5097 --- /dev/null +++ b/framework/inc/classes/fwlresid.hxx @@ -0,0 +1,46 @@ +/************************************************************************* + * + * 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 __FRAMEWORK_CLASSES_FwlResId_HXX_ +#define __FRAMEWORK_CLASSES_FwlResId_HXX_ + +#include <tools/resid.hxx> + +namespace framework +{ + +class FwlResId : public ResId +{ + public: + FwlResId( sal_uInt16 nId ); + + static ResMgr* GetResManager(); +}; + +} + +#endif // __FRAMEWORK_CLASSES_FwlResId diff --git a/framework/inc/classes/imagewrapper.hxx b/framework/inc/classes/imagewrapper.hxx new file mode 100644 index 000000000000..2001314e9edb --- /dev/null +++ b/framework/inc/classes/imagewrapper.hxx @@ -0,0 +1,71 @@ +/************************************************************************* + * + * 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 __FRAMEWORK_CLASSES_IMAGEWRAPPER_HXX_ +#define __FRAMEWORK_CLASSES_IMAGEWRAPPER_HXX_ + +#include <threadhelp/threadhelpbase.hxx> +#include <com/sun/star/awt/XBitmap.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <cppuhelper/implbase2.hxx> +#include <vcl/image.hxx> +#include <framework/fwedllapi.h> + +namespace framework +{ + +class FWE_DLLPUBLIC ImageWrapper : public ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses. + public ::cppu::WeakImplHelper2< ::com::sun::star::awt::XBitmap, + ::com::sun::star::lang::XUnoTunnel > +{ + public: + ImageWrapper( const Image& aImage ); + virtual ~ImageWrapper(); + + const Image& GetImage() const + { + return m_aImage; + } + + static ::com::sun::star::uno::Sequence< sal_Int8 > GetUnoTunnelId(); + + // XBitmap + virtual ::com::sun::star::awt::Size SAL_CALL getSize() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getDIB() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getMaskDIB() throw (::com::sun::star::uno::RuntimeException); + + // XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw (::com::sun::star::uno::RuntimeException); + + private: + Image m_aImage; +}; + +} + +#endif // __FRAMEWORK_CLASSES_IMAGEWRAPPER_HXX_ diff --git a/framework/inc/classes/menumanager.hxx b/framework/inc/classes/menumanager.hxx new file mode 100644 index 000000000000..11e56a7b522e --- /dev/null +++ b/framework/inc/classes/menumanager.hxx @@ -0,0 +1,168 @@ +/************************************************************************* + * + * 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 __FRAMEWORK_CLASSES_MENUMANAGER_HXX_ +#define __FRAMEWORK_CLASSES_MENUMANAGER_HXX_ + +/** Attention: stl headers must(!) be included at first. Otherwhise it can make trouble + with solaris headers ... +*/ +#include <vector> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/frame/FeatureStateEvent.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/util/XURLTransformer.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <rtl/ustring.hxx> +#include <vcl/menu.hxx> +#include <vcl/accel.hxx> +#include <cppuhelper/implbase1.hxx> +#include <threadhelp/threadhelpbase.hxx> +#include <macros/debug.hxx> + +// #110897# +#include <com/sun/star/lang/XMultiServiceFactory.hpp> + +#define REFERENCE ::com::sun::star::uno::Reference +#define XFRAME ::com::sun::star::frame::XFrame +#define XDISPATCH ::com::sun::star::frame::XDispatch +#define XDISPATCHPROVIDER ::com::sun::star::frame::XDispatchProvider +#define XSTATUSLISTENER ::com::sun::star::frame::XStatusListener +#define XEVENTLISTENER ::com::sun::star::lang::XEventListener +#define FEATURSTATEEVENT ::com::sun::star::frame::FeatureStateEvent +#define RUNTIMEEXCEPTION ::com::sun::star::uno::RuntimeException +#define EVENTOBJECT ::com::sun::star::lang::EventObject + +namespace framework +{ + +class BmkMenu; +class AddonMenu; +class AddonPopupMenu; +class MenuManager : public ThreadHelpBase , + public ::cppu::WeakImplHelper1< ::com::sun::star::frame::XStatusListener > +{ + public: + // #110897# + MenuManager( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, + REFERENCE< XFRAME >& rFrame, + Menu* pMenu, + sal_Bool bDelete, + sal_Bool bDeleteChildren ); +#if 0 + MenuManager( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, + REFERENCE< XFRAME >& rFrame, + AddonMenu* pAddonMenu, + sal_Bool bDelete, + sal_Bool bDeleteChildren ); +#endif + + virtual ~MenuManager(); + + // XStatusListener + virtual void SAL_CALL statusChanged( const FEATURSTATEEVENT& Event ) throw ( RUNTIMEEXCEPTION ); + + // XEventListener + virtual void SAL_CALL disposing( const EVENTOBJECT& Source ) throw ( RUNTIMEEXCEPTION ); + + DECL_LINK( Select, Menu * ); + + Menu* GetMenu() const { return m_pVCLMenu; } + + void RemoveListener(); + + // #110897# + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& getServiceFactory(); + + static void UpdateSpecialWindowMenu( Menu* pMenu ,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,IMutex& _rMutex); + static void FillMenuImages(::com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& xFrame,Menu* _pMenu,sal_Bool bIsHiContrast,sal_Bool bShowMenuImages); + + protected: + DECL_LINK( Highlight, Menu * ); + DECL_LINK( Activate, Menu * ); + DECL_LINK( Deactivate, Menu * ); + + private: + void UpdateSpecialFileMenu( Menu* pMenu ); + void UpdateSpecialWindowMenu( Menu* pMenu ); + void ClearMenuDispatch(const EVENTOBJECT& Source = EVENTOBJECT(),bool _bRemoveOnly = true); + void SetHdl(); + void AddMenu(PopupMenu* _pPopupMenu,const ::rtl::OUString& _sItemCommand,sal_uInt16 _nItemId,sal_Bool _bDelete,sal_Bool _bDeleteChildren); + sal_uInt16 FillItemCommand(::rtl::OUString& _rItemCommand,Menu* _pMenu,sal_uInt16 _nIndex) const; + + + struct MenuItemHandler + { + MenuItemHandler( sal_uInt16 aItemId, MenuManager* pManager, REFERENCE< XDISPATCH >& rDispatch ) : + nItemId( aItemId ), pSubMenuManager( pManager ), xMenuItemDispatch( rDispatch ) {} + + sal_uInt16 nItemId; + ::rtl::OUString aTargetFrame; + ::rtl::OUString aMenuItemURL; + ::rtl::OUString aFilter; + ::rtl::OUString aPassword; + ::rtl::OUString aTitle; + MenuManager* pSubMenuManager; + REFERENCE< XDISPATCH > xMenuItemDispatch; + }; + + void CreatePicklistArguments( + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArgsList, + const MenuItemHandler* ); + + MenuItemHandler* GetMenuItemHandler( sal_uInt16 nItemId ); + + sal_Bool m_bInitialized; + sal_Bool m_bDeleteMenu; + sal_Bool m_bDeleteChildren; + sal_Bool m_bActive; + sal_Bool m_bIsBookmarkMenu; + sal_Bool m_bWasHiContrast; + sal_Bool m_bShowMenuImages; + ::rtl::OUString m_aMenuItemCommand; + Menu* m_pVCLMenu; + REFERENCE< XFRAME > m_xFrame; + ::std::vector< MenuItemHandler* > m_aMenuItemHandlerVector; + + // #110897# + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& mxServiceFactory; + ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer > m_xURLTransformer; +}; + +} // namespace + +#endif diff --git a/framework/inc/classes/propertysethelper.hxx b/framework/inc/classes/propertysethelper.hxx new file mode 100644 index 000000000000..d62debc5b2a2 --- /dev/null +++ b/framework/inc/classes/propertysethelper.hxx @@ -0,0 +1,258 @@ +/************************************************************************* + * + * 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 __FRAMEWORK_CLASSES_PROPERTYSETHELPER_HXX_ +#define __FRAMEWORK_CLASSES_PROPERTYSETHELPER_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes + +#include <threadhelp/threadhelpbase.hxx> +#include <threadhelp/transactionbase.hxx> +#include <macros/debug.hxx> +#include <general.h> +#include <stdtypes.h> + +//_________________________________________________________________________________________________________________ +// interface includes +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/beans/XPropertySetInfo.hpp> +#include <com/sun/star/beans/PropertyExistException.hpp> +#include <com/sun/star/beans/UnknownPropertyException.hpp> + +//_________________________________________________________________________________________________________________ +// other includes + +#include <cppuhelper/weakref.hxx> +#include <fwidllapi.h> + +//_________________________________________________________________________________________________________________ +// namespace + +namespace framework{ + +//_________________________________________________________________________________________________________________ + +/** supports the API XPropertySet and XPropertySetInfo. + * + * It must be used as baseclass. The internal list of supported + * properties can be changed everytimes so dynamic property set's + * can be implemented. + * + * Further the derived and this base class share the same lock. + * So it's possible to be threadsafe if it's needed. +*/ +class FWI_DLLPUBLIC PropertySetHelper : public css::beans::XPropertySet + , public css::beans::XPropertySetInfo +{ + //------------------------------------------------------------------------- + /* types */ + protected: + + typedef BaseHash< css::beans::Property > TPropInfoHash; + + //------------------------------------------------------------------------- + /* member */ + protected: + + css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR; + + PropertySetHelper::TPropInfoHash m_lProps; + + ListenerHash m_lSimpleChangeListener; + ListenerHash m_lVetoChangeListener; + + sal_Bool m_bReleaseLockOnCall; + + // hold it weak ... otherwhise this helper has to be "killed" explicitly .-) + css::uno::WeakReference< css::uno::XInterface > m_xBroadcaster; + + LockHelper& m_rLock; + TransactionManager& m_rTransactionManager; + + //------------------------------------------------------------------------- + /* native interface */ + public: + + //--------------------------------------------------------------------- + /** initialize new instance of this helper. + * + * @param xSMGR + * points to an uno service manager, which is used internaly to create own + * needed uno services. + * + * @param pExternalLock + * this helper must be used as a baseclass ... + * but then it should synchronize its own calls + * with the same lock then it's superclass uses. + * + * @param pExternalTransactionManager + * this helper must be used as a baseclass ... + * but then it should synchronize its own calls + * with the same transaction manager then it's superclass. + * + * @param bReleaseLockOnCall + * see member m_bReleaseLockOnCall + */ + PropertySetHelper(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR , + LockHelper* pExternalLock , + TransactionManager* pExternalTransactionManager , + sal_Bool bReleaseLockOnCall ); + + //--------------------------------------------------------------------- + /** free all needed memory. + */ + virtual ~PropertySetHelper(); + + //--------------------------------------------------------------------- + /** set a new owner for this helper. + * + * This owner is used as source for all broadcasted events. + * Further we hold it weak, because we dont wish to be disposed() .-) + */ + void impl_setPropertyChangeBroadcaster(const css::uno::Reference< css::uno::XInterface >& xBroadcaster); + + //--------------------------------------------------------------------- + /** add a new property info to the set of supported ones. + * + * @param aProperty + * describes the new property. + * + * @throw [com::sun::star::beans::PropertyExistException] + * if a property with the same name already exists. + * + * Note: The consistence of the whole set of properties is not checked here. + * Means e.g. ... a handle which exists more then once is not detected. + * The owner of this class has to be sure, that every new property does + * not clash with any existing one. + */ + virtual void SAL_CALL impl_addPropertyInfo(const css::beans::Property& aProperty) + throw(css::beans::PropertyExistException, + css::uno::Exception ); + + //--------------------------------------------------------------------- + /** remove an existing property info from the set of supported ones. + * + * @param sProperty + * the name of the property. + * + * @throw [com::sun::star::beans::UnknownPropertyException] + * if no property with the specified name exists. + */ + virtual void SAL_CALL impl_removePropertyInfo(const ::rtl::OUString& sProperty) + throw(css::beans::UnknownPropertyException, + css::uno::Exception ); + + //--------------------------------------------------------------------- + /** mark the object as "useable for working" or "dead". + * + * This correspond to the lifetime handling implemented by the base class TransactionBase. + * There is no chance to reactive a "dead" object by calling impl_enablePropertySet() + * again! + */ + virtual void SAL_CALL impl_enablePropertySet(); + virtual void SAL_CALL impl_disablePropertySet(); + + //--------------------------------------------------------------------- + /** + */ + virtual void SAL_CALL impl_setPropertyValue(const ::rtl::OUString& sProperty, + sal_Int32 nHandle , + const css::uno::Any& aValue ) = 0; + + virtual css::uno::Any SAL_CALL impl_getPropertyValue(const ::rtl::OUString& sProperty, + sal_Int32 nHandle ) = 0; + + //------------------------------------------------------------------------- + /* uno interface */ + public: + + // XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() + throw(css::uno::RuntimeException); + + virtual void SAL_CALL setPropertyValue(const ::rtl::OUString& sProperty, + const css::uno::Any& aValue ) + throw(css::beans::UnknownPropertyException, + css::beans::PropertyVetoException , + css::lang::IllegalArgumentException , + css::lang::WrappedTargetException , + css::uno::RuntimeException ); + + virtual css::uno::Any SAL_CALL getPropertyValue(const ::rtl::OUString& sProperty) + throw(css::beans::UnknownPropertyException, + css::lang::WrappedTargetException , + css::uno::RuntimeException ); + + virtual void SAL_CALL addPropertyChangeListener(const ::rtl::OUString& sProperty, + const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener) + throw(css::beans::UnknownPropertyException, + css::lang::WrappedTargetException , + css::uno::RuntimeException ); + + virtual void SAL_CALL removePropertyChangeListener(const ::rtl::OUString& sProperty, + const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener) + throw(css::beans::UnknownPropertyException, + css::lang::WrappedTargetException , + css::uno::RuntimeException ); + + virtual void SAL_CALL addVetoableChangeListener(const ::rtl::OUString& sProperty, + const css::uno::Reference< css::beans::XVetoableChangeListener >& xListener) + throw(css::beans::UnknownPropertyException, + css::lang::WrappedTargetException , + css::uno::RuntimeException ); + + virtual void SAL_CALL removeVetoableChangeListener(const ::rtl::OUString& sProperty, + const css::uno::Reference< css::beans::XVetoableChangeListener >& xListener) + throw(css::beans::UnknownPropertyException, + css::lang::WrappedTargetException , + css::uno::RuntimeException ); + + // XPropertySetInfo + virtual css::uno::Sequence< css::beans::Property > SAL_CALL getProperties() + throw(css::uno::RuntimeException); + + virtual css::beans::Property SAL_CALL getPropertyByName(const ::rtl::OUString& sName) + throw(css::beans::UnknownPropertyException, + css::uno::RuntimeException ); + + virtual sal_Bool SAL_CALL hasPropertyByName(const ::rtl::OUString& sName) + throw(css::uno::RuntimeException); + + //------------------------------------------------------------------------- + /* internal helper */ + private: + + sal_Bool impl_existsVeto(const css::beans::PropertyChangeEvent& aEvent); + + void impl_notifyChangeListener(const css::beans::PropertyChangeEvent& aEvent); +}; + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_CLASSES_PROPERTYSETHELPER_HXX_ diff --git a/framework/inc/classes/protocolhandlercache.hxx b/framework/inc/classes/protocolhandlercache.hxx new file mode 100644 index 000000000000..ffdcaa1f253b --- /dev/null +++ b/framework/inc/classes/protocolhandlercache.hxx @@ -0,0 +1,200 @@ +/************************************************************************* + * + * 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 __FRAMEWORK_CLASSES_PROTOCOLHANDLERCACHE_HXX_ +#define __FRAMEWORK_CLASSES_PROTOCOLHANDLERCACHE_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <general.h> +#include <stdtypes.h> +#include <macros/debug.hxx> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/util/URL.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ + +#include <unotools/configitem.hxx> +#include <rtl/ustring.hxx> +#include <fwidllapi.h> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ +// exported const +//_________________________________________________________________________________________________________________ + +#define PACKAGENAME_PROTOCOLHANDLER DECLARE_ASCII("Office.ProtocolHandler" ) /// name of our configuration package + +#define CFG_PATH_SEPERATOR DECLARE_ASCII("/" ) /// seperator for configuration pathes +#define CFG_ENCODING_OPEN DECLARE_ASCII("[\'" ) /// used to start encoding of set names +#define CFG_ENCODING_CLOSE DECLARE_ASCII("\']" ) /// used to finish encoding of set names + +#define SETNAME_HANDLER DECLARE_ASCII("HandlerSet" ) /// name of configuration set inside package +#define PROPERTY_PROTOCOLS DECLARE_ASCII("Protocols" ) /// properties of a protocol handler + +//_________________________________________________________________________________________________________________ + +/** + Programmer can register his own services to handle different protocols. + Don't forget: It doesn't mean "handling of documents" ... these services could handle protocols ... + e.g. "mailto:", "file://", ".java:" + This struct holds the information about one such registered protocol handler. + A list of handler objects is defined as ProtocolHandlerHash. see below +*/ +struct FWI_DLLPUBLIC ProtocolHandler +{ + /* member */ + public: + + /// the uno implementation name of this handler + ::rtl::OUString m_sUNOName; + /// list of URL pattern which defines the protocols which this handler is registered for + OUStringList m_lProtocols; +}; + +//_________________________________________________________________________________________________________________ + +/** + This hash use registered pattern of all protocol handlers as keys and provide her + uno implementation names as value. Overloading of the index operator makes it possible + to search for a key by using a full qualified URL on list of all possible pattern keys. +*/ +class FWI_DLLPUBLIC PatternHash : public BaseHash< ::rtl::OUString > +{ + /* interface */ + public: + + PatternHash::iterator findPatternKey( const ::rtl::OUString& sURL ); +}; + +//_________________________________________________________________________________________________________________ + +/** + This hash holds protocol handler structs by her names. +*/ +typedef BaseHash< ProtocolHandler > HandlerHash; + +//_________________________________________________________________________________________________________________ + +/** + @short this hash makes it easy to find a protocol handler by using his uno implementation name. + @descr It holds two lists of informations: + - first holds all handler by her uno implementation names and + can be used to get her other properties + - another one maps her registered pattern to her uno names to + perform search on such data + But this lists a static for all instances of this class. So it's possible to + create new objects without opening configuration twice and free memory automaticly + if last object will gone. + + @attention We implement a singleton concept - so we doesn't need any mutex member here. + Because to safe access on static member we must use a static global lock + here too. + + @devstatus ready to use + @threadsafe yes + + @modified 30.04.2002 11:19, as96863 +*/ + +class HandlerCFGAccess; +class FWI_DLLPUBLIC HandlerCache +{ + /* member */ + private: + + /// list of all registered handler registered by her uno implementation names + static HandlerHash* m_pHandler; + /// maps URL pattern to handler names + static PatternHash* m_pPattern; + /// informs about config updates + static HandlerCFGAccess* m_pConfig; + /// ref count to construct/destruct internal member lists on demand by using singleton mechanism + static sal_Int32 m_nRefCount; + + /* interface */ + public: + + HandlerCache(); + virtual ~HandlerCache(); + + sal_Bool search( const ::rtl::OUString& sURL, ProtocolHandler* pReturn ) const; + sal_Bool search( const css::util::URL& aURL, ProtocolHandler* pReturn ) const; + sal_Bool exists( const ::rtl::OUString& sURL ) const; + + void takeOver(HandlerHash* pHandler, PatternHash* pPattern); +}; + +//_________________________________________________________________________________________________________________ + +/** + @short implements configuration access for handler configuration + @descr We use the ConfigItem mechanism to read/write values from/to configuration. + We set a data container pointer for filling or reading ... this class use it temp. + After successfuly calling of read(), we can use filled container directly or merge it with an existing one. + After successfuly calling of write() all values of given data container are flushed to our configuration - + but current implementation doesn't support writeing realy. + + @base ::utl::ConfigItem + base mechanism for configuration access + + @devstatus ready to use + @threadsafe no + + @modified 30.04.2002 09:58, as96863 +*/ +class FWI_DLLPUBLIC HandlerCFGAccess : public ::utl::ConfigItem +{ + private: + HandlerCache* m_pCache; + + /* interface */ + public: + HandlerCFGAccess( const ::rtl::OUString& sPackage ); + void read ( HandlerHash** ppHandler , + PatternHash** ppPattern ); + + void setCache(HandlerCache* pCache) {m_pCache = pCache;}; + virtual void Notify(const css::uno::Sequence< rtl::OUString >& lPropertyNames); + virtual void Commit(); +}; + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_CLASSES_PROTOCOLHANDLERCACHE_HXX_ diff --git a/framework/inc/classes/resource.hrc b/framework/inc/classes/resource.hrc new file mode 100644 index 000000000000..8c9bd2e854b0 --- /dev/null +++ b/framework/inc/classes/resource.hrc @@ -0,0 +1,87 @@ +/************************************************************************* + * + * 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 __FRAMEWORK_CLASSES_RESOURCE_HRC_ +#define __FRAMEWORK_CLASSES_RESOURCE_HRC_ + +#define RID_STR_START 2000 +#define RID_MENU_START 10000 +#define RID_IMAGE_START 15000 +#define RID_FWK_DIALOG_START 0 + +#define STR_MENU_ADDONS (RID_STR_START+0) +#define STR_MENU_ADDONHELP (RID_STR_START+1) +#define STR_MENU_HEADFOOTALL (RID_STR_START+2) +#define STR_UPDATEDOC (RID_STR_START+3) +#define STR_CLOSEDOC_ANDRETURN (RID_STR_START+4) +#define STR_SAVECOPYDOC (RID_STR_START+5) +#define STR_NODOCUMENT (RID_STR_START+6) +#define STR_TOOLBAR_TITLE_ADDON (RID_STR_START+7) +#define STR_STATUSBAR_LOGOTEXT (RID_STR_START+8) +#define STR_FULL_DISC_RETRY_BUTTON (RID_STR_START+9) // used by AuotSave to show error state: full disc +#define STR_FULL_DISC_MSG (RID_STR_START+10) // used by AuotSave to show error state: full disc +#define STR_RESTORE_TOOLBARS (RID_STR_START+11) +#define STR_CORRUPT_UICFG_SHARE (RID_STR_START+12) +#define STR_CORRUPT_UICFG_USER (RID_STR_START+13) +#define STR_CORRUPT_UICFG_GENERAL (RID_STR_START+14) +#define STR_LANGSTATUS_MULTIPLE_LANGUAGES (RID_STR_START+15) +#define STR_LANGSTATUS_NONE (RID_STR_START+16) +#define STR_LANGSTATUS_MORE (RID_STR_START+17) +#define STR_SET_LANGUAGE_FOR_SELECTION (RID_STR_START+18) +#define STR_SET_LANGUAGE_FOR_PARAGRAPH (RID_STR_START+19) +#define STR_SET_LANGUAGE_FOR_ALL_TEXT (RID_STR_START+20) +#define STR_UNTITLED_DOCUMENT (RID_STR_START+21) +#define STR_RESET_TO_DEFAULT_LANGUAGE (RID_STR_START+22) + +#define POPUPMENU_TOOLBAR_QUICKCUSTOMIZATION (RID_MENU_START+0) + +#define MENUITEM_TOOLBAR_VISIBLEBUTTON 1 +#define MENUITEM_TOOLBAR_CUSTOMIZETOOLBAR 2 +#define MENUITEM_TOOLBAR_DOCKTOOLBAR 3 +#define MENUITEM_TOOLBAR_DOCKALLTOOLBAR 4 +#define MENUITEM_TOOLBAR_LOCKTOOLBARPOSITION 5 +#define MENUITEM_TOOLBAR_CLOSE 6 + +#define RID_IMAGE_STATUSBAR_LOGO (RID_IMAGE_START+0) + +// License Dialog +#define DLG_LICENSE (RID_FWK_DIALOG_START+256) +#define ML_LICENSE (RID_FWK_DIALOG_START+11) +#define FT_INFO1 (RID_FWK_DIALOG_START+12) +#define FT_INFO2 (RID_FWK_DIALOG_START+13) +#define FT_INFO3 (RID_FWK_DIALOG_START+14) +#define FT_INFO2_1 (RID_FWK_DIALOG_START+15) +#define FT_INFO3_1 (RID_FWK_DIALOG_START+16) +#define FL_DIVIDE (RID_FWK_DIALOG_START+17) +#define PB_PAGEDOWN (RID_FWK_DIALOG_START+18) +#define IMG_ARROW (RID_FWK_DIALOG_START+19) +#define LICENSE_ACCEPT (RID_FWK_DIALOG_START+20) +#define LICENSE_NOTACCEPT (RID_FWK_DIALOG_START+21) +#define PB_DECLINE (RID_FWK_DIALOG_START+22) +#define PB_ACCEPT (RID_FWK_DIALOG_START+23) + +#endif diff --git a/framework/inc/classes/rootactiontriggercontainer.hxx b/framework/inc/classes/rootactiontriggercontainer.hxx new file mode 100644 index 000000000000..e3c26d190ce9 --- /dev/null +++ b/framework/inc/classes/rootactiontriggercontainer.hxx @@ -0,0 +1,128 @@ +/************************************************************************* + * + * 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 __FRAMEWORK_CLASSES_ROOTACTIONTRIGGERCONTAINER_HXX_ +#define __FRAMEWORK_CLASSES_ROOTACTIONTRIGGERCONTAINER_HXX_ + +#include <helper/propertysetcontainer.hxx> +#include <vcl/menu.hxx> +#include <com/sun/star/container/XNamed.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <framework/fwedllapi.h> + +#define IMPLEMENTATIONNAME_ROOTACTIONTRIGGERCONTAINER "com.sun.star.comp.ui.RootActionTriggerContainer" + + +namespace framework +{ + +class FWE_DLLPUBLIC RootActionTriggerContainer : public PropertySetContainer, + public com::sun::star::lang::XMultiServiceFactory, + public com::sun::star::lang::XServiceInfo, + public com::sun::star::lang::XUnoTunnel, + public com::sun::star::lang::XTypeProvider, + public com::sun::star::container::XNamed +{ + public: + RootActionTriggerContainer( const Menu* pMenu, const ::rtl::OUString* pMenuIdentifier, const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager ); + virtual ~RootActionTriggerContainer(); + + const Menu* GetMenu(); + + ::com::sun::star::uno::Sequence< sal_Int8 > GetUnoTunnelId() const; + + // XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire() throw (); + virtual void SAL_CALL release() throw (); + + // XMultiServiceFactory + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstance( const ::rtl::OUString& aServiceSpecifier ) + throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceWithArguments( const ::rtl::OUString& ServiceSpecifier, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Arguments ) + throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getAvailableServiceNames() + throw (::com::sun::star::uno::RuntimeException); + + // XIndexContainer + virtual void SAL_CALL insertByIndex( sal_Int32 Index, const ::com::sun::star::uno::Any& Element ) + throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + + virtual void SAL_CALL removeByIndex( sal_Int32 Index ) + throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + + // XIndexReplace + virtual void SAL_CALL replaceByIndex( sal_Int32 Index, const ::com::sun::star::uno::Any& Element ) + throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + + // XIndexAccess + virtual sal_Int32 SAL_CALL getCount() + throw (::com::sun::star::uno::RuntimeException); + + virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) + throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + + // XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType() + throw (::com::sun::star::uno::RuntimeException); + + virtual sal_Bool SAL_CALL hasElements() + throw (::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException); + + // XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw (::com::sun::star::uno::RuntimeException); + + // XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw (::com::sun::star::uno::RuntimeException); + + // XNamed + virtual ::rtl::OUString SAL_CALL getName( ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setName( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException); + + private: + void FillContainer(); + + sal_Bool m_bContainerCreated; + sal_Bool m_bContainerChanged; + sal_Bool m_bInContainerCreation; + const Menu* m_pMenu; + const ::rtl::OUString* m_pMenuIdentifier; +}; + +} + +#endif // __FRAMEWORK_CLASSES_ROOTACTIONTRIGGERCONTAINER_HXX_ diff --git a/framework/inc/classes/servicemanager.hxx b/framework/inc/classes/servicemanager.hxx new file mode 100644 index 000000000000..233987768b82 --- /dev/null +++ b/framework/inc/classes/servicemanager.hxx @@ -0,0 +1,280 @@ +/************************************************************************* + * + * 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 __FRAMEWORK_CLASSES_SERVICEMANAGER_HXX_ +#define __FRAMEWORK_CLASSES_SERVICEMANAGER_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <macros/debug.hxx> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/lang/XMultiServiceFactory.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/uno/Reference.hxx> +#include <rtl/ustring.hxx> +#include <osl/mutex.hxx> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +#define REFERENCE ::com::sun::star::uno::Reference +#define XMULTISERVICEFACTORY ::com::sun::star::lang::XMultiServiceFactory +#define OUSTRING ::rtl::OUString +#define MUTEX ::osl::Mutex + +//_________________________________________________________________________________________________________________ +// exported const +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// exported definitions +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short create a new global servicemanager + @descr A global servicemanager is neccessary to instanciate UNO-services. To do this, you need + a factory to create new objects with special type. That's the reason for a servicemanager. + + @implements - + @base - + + @devstatus ready to use +*//*-*************************************************************************************************************/ + +class ServiceManager +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + + public: + + //--------------------------------------------------------------------------------------------------------- + // constructor / destructor + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short standard constructor + @descr This method don't initialize the new global servicemanager! + But we increase an internal ref count. These is needed in dtor to release + all created static references to created service mamanger! + + @seealso dtor + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + ServiceManager(); + + /*-****************************************************************************************************//** + @short standard destructor to delete instance + @descr Here is a good place to destroy the global manager instances! + + @seealso ctor + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual ~ServiceManager(); + + /*-****************************************************************************************************//** + @short initialize global uno service manager and return it + @descr This method create a new manager only at first call. We confiscate this with a static + pointer, which will be initialized only, if it NULL! + Then you can call this method everytime to get a reference to the manager. + If you will initialize an uno application you must set returned reference in ::comphelper::setProcessServiceFactory()! + The created manager use "applicat.rdb" and "userXX.rdb" automaticly. + + @seealso - + + @param - + @return A reference to the global servicemanager. It can be NULL! + + @onerror We return a null-reference. + *//*-*****************************************************************************************************/ + + REFERENCE< XMULTISERVICEFACTORY > getGlobalUNOServiceManager(); + + /*-****************************************************************************************************//** + @short initialize global uno service manager and return it + @descr Do the same like getGlobalUNOServiceManager() before, but use "applicat.rdb" only! + + @seealso - + + @param - + @return A reference to the global servicemanager. It can be NULL! + + @onerror We return a null-reference. + *//*-*****************************************************************************************************/ + + REFERENCE< XMULTISERVICEFACTORY > getSimpleGlobalUNOServiceManager(); + + /*-****************************************************************************************************//** + @short return a reference to a uno servicemanager instance which use your specified user registry file + @descr This do the same like method before - but instead of "userXX.rdb" we use your file. + These is neccessary, if you will run more then one uno application at the same time in same environment! + All created servicemanager use the same "applicat.rdb" but different user registries. + + @ATTENTION Given file name must be a full qualified system file name. If file not already exist we create a new one! + "applicat.rdb", "userXX.rdb" are not valid values! + + @seealso method generateGlobalUNOServiceManager() + @seealso method generatePrivateUNOServiceManager() + + @param "sUserRegistryFile", full qualified system file name of user registry + @return A reference to the created servicemanager. It can be NULL! + + @onerror We return a null-reference. + *//*-*****************************************************************************************************/ + + REFERENCE< XMULTISERVICEFACTORY > getSharedUNOServiceManager( const OUSTRING& sUserRegistryFile ); + + /*-****************************************************************************************************//** + @short return a reference to a uno servicemanager instance which use your specified user registry file only + @descr This do the same like methods before - but use your file as the only one registry. + "applicat.rdb" is used here! + + @ATTENTION Given file name must be a full qualified system file name. If file not already exist we create a new one! + "applicat.rdb", "userXX.rdb" are not valid values! + If file was new created - you must register services at runtime himself. + Otherwise no service could be created by these manager ... + + @seealso method generateGlobalUNOServiceManager() + @seealso method generateSharedUNOServiceManager() + + @param "sUserRegistryFile", full qualified system file name of user registry + @return A reference to the created servicemanager. It can be NULL! + + @onerror We return a null-reference. + *//*-*****************************************************************************************************/ + + REFERENCE< XMULTISERVICEFACTORY > getPrivateUNOServiceManager( const OUSTRING& sUserRegistryFile ); + + //------------------------------------------------------------------------------------------------------------- + // protected methods + //------------------------------------------------------------------------------------------------------------- + + protected: + + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + + private: + + /*-****************************************************************************************************//** + @short create our own global mutex to prevent us against multithreaded problems + @descr We use some static member. For correct access to it we must use the global osl mutex ... + but its not fine to do so! These block ALL other operations, which need these mutex too. + That's the reason to create our own static mutex. Only first creation is protected + by the global mutex, using isn't it! + + @seealso using + + @param - + @return reference to created static own global mutex + + @onerror No error should occure. + *//*-*****************************************************************************************************/ + + MUTEX& impl_getOwnGlobalMutex(); + + /*-****************************************************************************************************//** + @short create a new global servicemanager instance + @descr Is a helper-method for getManager(). + + @seealso method getManager() + + @param "sRegistryFile", file name of user registry. + @return A reference to a new initialized servicemanager with a valid registry. + It can be NULL, if an error occured. + + @onerror Return a NULL-reference. + *//*-*****************************************************************************************************/ + + REFERENCE< XMULTISERVICEFACTORY > impl_createManager( const OUSTRING& sRegistryFile ); + + //------------------------------------------------------------------------------------------------------------- + // debug methods + // (should be private everyway!) + //------------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short debug-method to check incoming parameter of some other mehods of this class + @descr The following methods are used to check parameters for other methods + of this class. The return value is used directly for an ASSERT(...). + + @seealso ASSERTs in implementation! + + @param references to checking variables + @return sal_False on invalid parameter<BR> + sal_True otherway + + @onerror - + *//*-*****************************************************************************************************/ + + #ifdef ENABLE_ASSERTIONS + + private: + + #endif // #ifdef ENABLE_ASSERTIONS + + //------------------------------------------------------------------------------------------------------------- + // private variables + // (should be private everyway!) + //------------------------------------------------------------------------------------------------------------- + + private: + + static REFERENCE< XMULTISERVICEFACTORY >* m_pGlobalServiceManager ; + static REFERENCE< XMULTISERVICEFACTORY >* m_pSimpleGlobalServiceManager ; + static REFERENCE< XMULTISERVICEFACTORY >* m_pSharedServiceManager ; + static REFERENCE< XMULTISERVICEFACTORY >* m_pPrivateServiceManager ; + static sal_Int32 m_nRefCount ; + +}; // class ServiceManager + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_CLASSES_SERVICEMANAGER_HXX_ diff --git a/framework/inc/classes/taskcreator.hxx b/framework/inc/classes/taskcreator.hxx new file mode 100644 index 000000000000..19c68d6a332c --- /dev/null +++ b/framework/inc/classes/taskcreator.hxx @@ -0,0 +1,102 @@ +/************************************************************************* + * + * 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 __FRAMEWORK_CLASSES_TASKCREATOR_HXX_ +#define __FRAMEWORK_CLASSES_TASKCREATOR_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <threadhelp/threadhelpbase.hxx> +#include <macros/generic.hxx> +#include <macros/debug.hxx> +#include <general.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/frame/XFramesSupplier.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/uno/Reference.hxx> +#include <rtl/ustring.hxx> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ +// exported const +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// exported definitions +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short a helper to create new tasks or sub frames for "_blank" or FrameSearchFlag::CREATE + @descr There are different places to create new (task)frames. Its not easy to service this code! + Thats the reason for this helper. He capsulate asynchronous/synchronous creation by calling + a simple interface. + + @devstatus ready to use + @threadsafe yes + @modified 20.08.2003 08:37, as96863 +*//*-*************************************************************************************************************/ +class TaskCreator : private ThreadHelpBase +{ + //_______________________ + // member + private: + + css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR; + + //_______________________ + // interface + public: + + TaskCreator( const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR ); + virtual ~TaskCreator( ); + + css::uno::Reference< css::frame::XFrame > createTask( const ::rtl::OUString& sName , + sal_Bool bVisible ); + + //_______________________ + // helper + private: + +}; // class TaskCreator + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_CLASSES_TASKCREATOR_HXX_ diff --git a/framework/inc/classes/wildcard.hxx b/framework/inc/classes/wildcard.hxx new file mode 100644 index 000000000000..bc4d770a0c1c --- /dev/null +++ b/framework/inc/classes/wildcard.hxx @@ -0,0 +1,184 @@ +/************************************************************************* + * + * 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 __FRAMEWORK_CLASSES_WILDCARD_HXX_ +#define __FRAMEWORK_CLASSES_WILDCARD_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <macros/debug.hxx> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <rtl/ustring.hxx> + +//_________________________________________________________________________________________________________________ +// const +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ +// declarations +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short implement wildcard-mechanism for unicode + @descr This class can be used to get information about the matching of a pattern to a given text. + It's suitable for 8-Bit- AND 16-Bit-strings! + + @implements - + @base - + + @ATTENTION This class is'nt threadsafe! + + @devstatus deprecated +*//*-*************************************************************************************************************/ + +class Wildcard +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + + public: + + //--------------------------------------------------------------------------------------------------------- + // constructor / destructor + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short standard ctor + @descr We do nothing here. + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + Wildcard(); + + /*-****************************************************************************************************//** + @short standard dtor + @descr We do nothing here. + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual ~Wildcard(); + + //--------------------------------------------------------------------------------------------------------- + // interface + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short try to find an agreement between given text and searchpattern + @descr You can use wildcards in pattern only! + + @seealso - + + @param "sText" is the text, in which we search given pattern. + @param "sPattern" is the searched pattern with includes wildcards. + @return sal_True , if pattern was found. + @return sal_False, if pattern don't match the text. + + @onerror - + *//*-*****************************************************************************************************/ + + static sal_Bool match( const ::rtl::OUString& sText , + const ::rtl::OUString& sPattern ); + + //--------------------------------------------------------------------------------------------------------- + // debug and test methods + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short debug-methods to check incoming parameter of some other mehods of this class + @descr The follow methods are used to check parameters for other methods + of this class. The return value is used directly for an ASSERT(...). + This mechanism is active in debug version only! + + @seealso FRAMEWORK_ASSERT in implementation! + + @param references to checking variables + @return sal_False on invalid parameter + @return sal_True otherwise + + @onerror - + *//*-*****************************************************************************************************/ + + #ifdef ENABLE_ASSERTIONS + + static sal_Bool impldbg_checkParameter_match( const ::rtl::OUString& sText , + const ::rtl::OUString& sPattern ); + + #endif // #ifdef ENABLE_ASSERTIONS + + /*-****************************************************************************************************//** + @short test implementation of match() with different examples + @descr If TESTMODE activated, you cann call these method to start and log some special examples. + Do this if you have changed the implementation of method match() to test it. + + @seealso - + + @param - + @return - + + @onerror Error-conditions are written to file or show in a messagebox. + Thhat depends from current setting of ASSERT_OUTPUTTYPE. (see debug.hxx for further informations.) + *//*-*****************************************************************************************************/ + + #ifdef ENABLE_CLASSDEBUG + + void impldbg_testWildcard(); + + #endif // #ifdef ENABLE_CLASSDEBUG + +}; // class Wildcard + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_CLASSES_WILDCARD_HXX_ |