diff options
Diffstat (limited to 'framework/inc')
249 files changed, 41620 insertions, 0 deletions
diff --git a/framework/inc/acceleratorconst.h b/framework/inc/acceleratorconst.h new file mode 100644 index 000000000000..f17f8c1e1cbb --- /dev/null +++ b/framework/inc/acceleratorconst.h @@ -0,0 +1,88 @@ +/************************************************************************* + * + * 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_ACCELERATORCONST_H_ +#define _FRAMEWORK_ACCELERATORCONST_H_ + +//_______________________________________________ +// own includes + +#include <general.h> + +//_______________________________________________ +// interface includes + +//_______________________________________________ +// other includes + +namespace framework{ + +#define DOCTYPE_ACCELERATORS DECLARE_ASCII("<!DOCTYPE accel:acceleratorlist PUBLIC \"-//OpenOffice.org//DTD OfficeDocument 1.0//EN\" \"accelerator.dtd\">") + +#define ATTRIBUTE_TYPE_CDATA DECLARE_ASCII("CDATA") + +#define XMLNS_ACCEL DECLARE_ASCII("accel") +#define XMLNS_XLINK DECLARE_ASCII("xlink") + +#define ATTRIBUTE_URL DECLARE_ASCII("href" ) +#define ATTRIBUTE_KEYCODE DECLARE_ASCII("code" ) +#define ATTRIBUTE_MOD_SHIFT DECLARE_ASCII("shift") +#define ATTRIBUTE_MOD_MOD1 DECLARE_ASCII("mod1" ) +#define ATTRIBUTE_MOD_MOD2 DECLARE_ASCII("mod2" ) +#define ATTRIBUTE_MOD_MOD3 DECLARE_ASCII("mod3" ) + +// same items with a name space alias +#define AL_ELEMENT_ACCELERATORLIST DECLARE_ASCII("accel:acceleratorlist") +#define AL_ELEMENT_ITEM DECLARE_ASCII("accel:item" ) + +#define AL_XMLNS_ACCEL DECLARE_ASCII("xmlns:accel") +#define AL_XMLNS_XLINK DECLARE_ASCII("xmlns:xlink") + +#define AL_ATTRIBUTE_URL DECLARE_ASCII("xlink:href" ) +#define AL_ATTRIBUTE_KEYCODE DECLARE_ASCII("accel:code" ) +#define AL_ATTRIBUTE_MOD_SHIFT DECLARE_ASCII("accel:shift") +#define AL_ATTRIBUTE_MOD_MOD1 DECLARE_ASCII("accel:mod1" ) +#define AL_ATTRIBUTE_MOD_MOD2 DECLARE_ASCII("accel:mod2" ) +#define AL_ATTRIBUTE_MOD_MOD3 DECLARE_ASCII("accel:mod3" ) + +// same items with full qualified name space +#define NS_ELEMENT_ACCELERATORLIST DECLARE_ASCII("http://openoffice.org/2001/accel^acceleratorlist") +#define NS_ELEMENT_ITEM DECLARE_ASCII("http://openoffice.org/2001/accel^item" ) + +#define NS_XMLNS_ACCEL DECLARE_ASCII("http://openoffice.org/2001/accel") +#define NS_XMLNS_XLINK DECLARE_ASCII("http://www.w3.org/1999/xlink" ) + +#define NS_ATTRIBUTE_URL DECLARE_ASCII("http://www.w3.org/1999/xlink^href" ) +#define NS_ATTRIBUTE_KEYCODE DECLARE_ASCII("http://openoffice.org/2001/accel^code" ) +#define NS_ATTRIBUTE_MOD_SHIFT DECLARE_ASCII("http://openoffice.org/2001/accel^shift") +#define NS_ATTRIBUTE_MOD_MOD1 DECLARE_ASCII("http://openoffice.org/2001/accel^mod1" ) +#define NS_ATTRIBUTE_MOD_MOD2 DECLARE_ASCII("http://openoffice.org/2001/accel^mod2" ) +#define NS_ATTRIBUTE_MOD_MOD3 DECLARE_ASCII("http://openoffice.org/2001/accel^mod3" ) + +} // namespace framework + +#endif // _FRAMEWORK_ACCELERATORCONST_H_ diff --git a/framework/inc/arguments.h b/framework/inc/arguments.h new file mode 100644 index 000000000000..6b395d1e6e98 --- /dev/null +++ b/framework/inc/arguments.h @@ -0,0 +1,173 @@ +/************************************************************************* + * + * 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_ARGUMENTS_H_ +#define __FRAMEWORK_ARGUMENTS_H_ + +//_________________________________________________________________________________________________________________ +// includes +//_________________________________________________________________________________________________________________ + +#include <macros/generic.hxx> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +/*-************************************************************************************************************//** + @short These arguments are included in given parameter lists - e.g. at dispatch calls at Sequence< PropertyValue >. + You can use class ArgumentAnalyzer to set/get it from a given list! +*//*-*************************************************************************************************************/ + +#define ARGUMENTNAME_ASTEMPLATE DECLARE_ASCII("AsTemplate" ) // bool +#define ARGUMENTNAME_CHARACTERSET DECLARE_ASCII("CharacterSet" ) // string +#define ARGUMENTNAME_DEEPDETECTION DECLARE_ASCII("DeepDetection" ) // bool +#define ARGUMENTNAME_DETECTSERVICE DECLARE_ASCII("DetectService" ) // string +#define ARGUMENTNAME_EXTENSION DECLARE_ASCII("Extension" ) // string +#define ARGUMENTNAME_FILTERNAME DECLARE_ASCII("FilterName" ) // string +#define ARGUMENTNAME_FILTEROPTIONS DECLARE_ASCII("FilterOptions" ) // string +#define ARGUMENTNAME_FORMAT DECLARE_ASCII("Format" ) // string +#define ARGUMENTNAME_FRAMENAME DECLARE_ASCII("FrameName" ) // string +#define ARGUMENTNAME_HIDDEN DECLARE_ASCII("Hidden" ) // bool +#define ARGUMENTNAME_INPUTSTREAM DECLARE_ASCII("InputStream" ) // Reference< XInputStream > +#define ARGUMENTNAME_INTERACTIONHANDLER DECLARE_ASCII("InteractionHandler" ) // Reference< XInteractionHandler > +#define ARGUMENTNAME_JUMPMARK DECLARE_ASCII("JumpMark" ) // string +#define ARGUMENTNAME_MACROEXECUTIONMODE DECLARE_ASCII("MacroExecutionMode" ) // int16 +#define ARGUMENTNAME_MEDIATYPE DECLARE_ASCII("MediaType" ) // string +#define ARGUMENTNAME_MINIMIZED DECLARE_ASCII("Minimized" ) // bool +#define ARGUMENTNAME_OPENNEWVIEW DECLARE_ASCII("OpenNewView" ) // bool +#define ARGUMENTNAME_OUTPUTSTREAM DECLARE_ASCII("OutputStream" ) // Reference< XOutputStream > +#define ARGUMENTNAME_PATTERN DECLARE_ASCII("Pattern" ) // string +#define ARGUMENTNAME_POSSIZE DECLARE_ASCII("PosSize" ) // rectangle +#define ARGUMENTNAME_POSTDATA DECLARE_ASCII("PostData" ) // Reference< XInputStream > +#define ARGUMENTNAME_POSTSTRING DECLARE_ASCII("PostString" ) // string +#define ARGUMENTNAME_PREVIEW DECLARE_ASCII("Preview" ) // bool +#define ARGUMENTNAME_READONLY DECLARE_ASCII("ReadOnly" ) // bool +#define ARGUMENTNAME_REFERRER DECLARE_ASCII("Referer" ) // string +#define ARGUMENTNAME_SILENT DECLARE_ASCII("Silent" ) // bool +#define ARGUMENTNAME_STATUSINDICATOR DECLARE_ASCII("StatusIndicator" ) // Reference< XStatusIndicator > +#define ARGUMENTNAME_TEMPLATENAME DECLARE_ASCII("TemplateName" ) // string +#define ARGUMENTNAME_TEMPLATEREGIONNAME DECLARE_ASCII("TemplateRegionName" ) // string +#define ARGUMENTNAME_TYPENAME DECLARE_ASCII("TypeName" ) // string +#define ARGUMENTNAME_UPDATEDOCMODE DECLARE_ASCII("UpdateDocMode" ) // int16 +#define ARGUMENTNAME_URL DECLARE_ASCII("URL" ) // string +#define ARGUMENTNAME_VERSION DECLARE_ASCII("Version" ) // int16 +#define ARGUMENTNAME_VIEWID DECLARE_ASCII("ViewId" ) // int16 +#define ARGUMENTNAME_REPAIRPACKAGE DECLARE_ASCII("RepairPackage" ) // bool +#define ARGUMENTNAME_DOCUMENTTITLE DECLARE_ASCII("DocumentTitle" ) // string + +/*-************************************************************************************************************//** + @short define our argument mask + @descr These mask could be used to define a subset for analyzing arguments or specify + one argument for set/get operations. + We use first byte [bit 0..7] of an int32 to define 8 layer, and follow 3 bytes [bit 8..31] + to address 24 properties per layer! Please use defines to build these mask!!! + With these values we build an special enum field for better using at our Argumentanalyzer-interface ... + Special define ANALYZE_ALL is our default for analyzing. Then we analyze complete argument list. +*//*-*************************************************************************************************************/ +#define ARGUMENTLAYER_1 0x00000001 +#define ARGUMENTLAYER_2 0x00000002 +#define ARGUMENTLAYER_3 0x00000004 +#define ARGUMENTLAYER_4 0x00000008 +#define ARGUMENTLAYER_5 0x00000010 +#define ARGUMENTLAYER_6 0x00000020 +#define ARGUMENTLAYER_7 0x00000040 +#define ARGUMENTLAYER_8 0x00000080 + +#define ARGUMENTFLAG_1 0x00000100 +#define ARGUMENTFLAG_2 0x00000200 +#define ARGUMENTFLAG_3 0x00000400 +#define ARGUMENTFLAG_4 0x00000800 +#define ARGUMENTFLAG_5 0x00001000 +#define ARGUMENTFLAG_6 0x00002000 +#define ARGUMENTFLAG_7 0x00004000 +#define ARGUMENTFLAG_8 0x00008000 +#define ARGUMENTFLAG_9 0x00010000 +#define ARGUMENTFLAG_10 0x00020000 +#define ARGUMENTFLAG_11 0x00040000 +#define ARGUMENTFLAG_12 0x00080000 +#define ARGUMENTFLAG_13 0x00100000 +#define ARGUMENTFLAG_14 0x00200000 +#define ARGUMENTFLAG_15 0x00400000 +#define ARGUMENTFLAG_16 0x00800000 +#define ARGUMENTFLAG_17 0x01000000 +#define ARGUMENTFLAG_18 0x02000000 +#define ARGUMENTFLAG_19 0x04000000 +#define ARGUMENTFLAG_20 0x08000000 +#define ARGUMENTFLAG_21 0x10000000 +#define ARGUMENTFLAG_22 0x20000000 +#define ARGUMENTFLAG_23 0x40000000 +#define ARGUMENTFLAG_24 0x80000000 + +#define ANALYZE_ALL_ARGUMENTS 0xFFFFFFFF + +enum EArgument +{ + E_ASTEMPLATE = ARGUMENTLAYER_1 | ARGUMENTFLAG_1 , + E_CHARACTERSET = ARGUMENTLAYER_1 | ARGUMENTFLAG_2 , + E_DEEPDETECTION = ARGUMENTLAYER_1 | ARGUMENTFLAG_3 , + E_DETECTSERVICE = ARGUMENTLAYER_1 | ARGUMENTFLAG_4 , + E_EXTENSION = ARGUMENTLAYER_1 | ARGUMENTFLAG_5 , + E_FILTERNAME = ARGUMENTLAYER_1 | ARGUMENTFLAG_6 , + E_FILTEROPTIONS = ARGUMENTLAYER_1 | ARGUMENTFLAG_7 , + E_FORMAT = ARGUMENTLAYER_1 | ARGUMENTFLAG_8 , + E_FRAMENAME = ARGUMENTLAYER_1 | ARGUMENTFLAG_9 , + E_HIDDEN = ARGUMENTLAYER_1 | ARGUMENTFLAG_10, + E_INPUTSTREAM = ARGUMENTLAYER_1 | ARGUMENTFLAG_11, + E_INTERACTIONHANDLER = ARGUMENTLAYER_1 | ARGUMENTFLAG_12, + E_JUMPMARK = ARGUMENTLAYER_1 | ARGUMENTFLAG_13, + E_MACROEXECUTIONMODE = ARGUMENTLAYER_1 | ARGUMENTFLAG_14, + E_MEDIATYPE = ARGUMENTLAYER_1 | ARGUMENTFLAG_15, + E_MINIMIZED = ARGUMENTLAYER_1 | ARGUMENTFLAG_16, + E_OPENNEWVIEW = ARGUMENTLAYER_1 | ARGUMENTFLAG_17, + E_OUTPUTSTREAM = ARGUMENTLAYER_1 | ARGUMENTFLAG_18, + E_PATTERN = ARGUMENTLAYER_1 | ARGUMENTFLAG_19, + E_POSSIZE = ARGUMENTLAYER_1 | ARGUMENTFLAG_20, + E_POSTDATA = ARGUMENTLAYER_1 | ARGUMENTFLAG_21, + E_POSTSTRING = ARGUMENTLAYER_1 | ARGUMENTFLAG_22, + E_PREVIEW = ARGUMENTLAYER_1 | ARGUMENTFLAG_23, + E_READONLY = ARGUMENTLAYER_1 | ARGUMENTFLAG_24, + + E_REFERRER = ARGUMENTLAYER_2 | ARGUMENTFLAG_1 , + E_SILENT = ARGUMENTLAYER_2 | ARGUMENTFLAG_2 , + E_STATUSINDICATOR = ARGUMENTLAYER_2 | ARGUMENTFLAG_3 , + E_TEMPLATENAME = ARGUMENTLAYER_2 | ARGUMENTFLAG_4 , + E_TEMPLATEREGIONNAME = ARGUMENTLAYER_2 | ARGUMENTFLAG_5 , + E_TYPENAME = ARGUMENTLAYER_2 | ARGUMENTFLAG_6 , + E_UPDATEDOCMODE = ARGUMENTLAYER_2 | ARGUMENTFLAG_7 , + E_URL = ARGUMENTLAYER_2 | ARGUMENTFLAG_8 , + E_VERSION = ARGUMENTLAYER_2 | ARGUMENTFLAG_9 , + E_VIEWID = ARGUMENTLAYER_2 | ARGUMENTFLAG_10, + E_REPAIRPACKAGE = ARGUMENTLAYER_2 | ARGUMENTFLAG_11, + E_DOCUMENTTITLE = ARGUMENTLAYER_2 | ARGUMENTFLAG_12 +}; + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_ARGUMENTS_H_ 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_ diff --git a/framework/inc/commands.h b/framework/inc/commands.h new file mode 100644 index 000000000000..fac23bd26648 --- /dev/null +++ b/framework/inc/commands.h @@ -0,0 +1,56 @@ +/************************************************************************* + * + * 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_COMMANDS_H_ +#define __FRAMEWORK_COMMANDS_H_ + +//_________________________________________________________________________________________________________________ +// includes +//_________________________________________________________________________________________________________________ + +#include <macros/generic.hxx> +#include <vos/process.hxx> +#include <rtl/ustring.hxx> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +/*-************************************************************************************************************//** + @short These values describe some command line arguments of our office. + We need it e.g. to detect running mode of it - plugin, headless ... +*//*-*************************************************************************************************************/ + +#define COMMAND_PLUGIN DECLARE_ASCII("-plugin" ) /// office is plugged into a browser +#define COMMAND_HEADLESS DECLARE_ASCII("-headless" ) /// office runs in headless mode for scripting +#define COMMAND_INVISIBLE DECLARE_ASCII("-invisible" ) /// office runs in invisible mode which supress splash screen and first empry document +#define COMMAND_SERVER DECLARE_ASCII("-server" ) /// office runs as server +} // namespace framework + +#endif // #ifndef __FRAMEWORK_TARGETS_H_ diff --git a/framework/inc/dispatch/basedispatcher.hxx b/framework/inc/dispatch/basedispatcher.hxx new file mode 100644 index 000000000000..0b2f7d547b2e --- /dev/null +++ b/framework/inc/dispatch/basedispatcher.hxx @@ -0,0 +1,391 @@ +/************************************************************************* + * + * 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_DISPATCH_BASEDISPATCHER_HXX_ +#define __FRAMEWORK_DISPATCH_BASEDISPATCHER_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <classes/taskcreator.hxx> +#include <threadhelp/resetableguard.hxx> +#include <threadhelp/threadhelpbase.hxx> + +#ifndef __FRAMEWORK_THREADHELP_TRANSACTIONBASE_HXX_ +#include <threadhelp/transactionbase.hxx> +#endif +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/debug.hxx> +#include <macros/generic.hxx> +#include <stdtypes.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/frame/XNotifyingDispatch.hpp> +#include <com/sun/star/util/URL.hpp> +#include <com/sun/star/frame/DispatchDescriptor.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/frame/XDispatchResultListener.hpp> +#include <com/sun/star/frame/XFrameLoader.hpp> +#include <com/sun/star/frame/XLoadEventListener.hpp> +#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/frame/FeatureStateEvent.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <cppuhelper/weak.hxx> +#include <cppuhelper/weakref.hxx> +#include <cppuhelper/interfacecontainer.h> +/*DRAFT +#include <unotools/historyoptions.hxx> +*/ + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ +// exported const +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// exported definitions +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @descr We must support loading of different URLs with different handler or loader into different tasks simultaniously. + They call us back to return state of operation. We need some informations to distinguish + between these different "loading threads". + This is the reason to implement this dynamicly list. + + @attention I maked class LoaderThreads threadsafe! Using will be easier in a multithreaded environment. + struct DispatchBinding doesn't need that! +*//*-*************************************************************************************************************/ +struct LoadBinding +{ + //------------------------------------------------------------------------------------------------------------- + public: + + //--------------------------------------------------------------------------------------------------------- + inline LoadBinding() + { + free(); + } + + //--------------------------------------------------------------------------------------------------------- + // use to initialize struct for asynchronous dispatching by using handler + inline LoadBinding( const css::util::URL& aNewURL , + const css::uno::Sequence< css::beans::PropertyValue > lNewDescriptor , + const css::uno::Reference< css::frame::XDispatch >& xNewHandler , + const css::uno::Any& aNewAsyncInfo ) + { + free(); + xHandler = xNewHandler ; + aURL = aNewURL ; + lDescriptor = lNewDescriptor; + aAsyncInfo = aNewAsyncInfo ; + } + + //--------------------------------------------------------------------------------------------------------- + // use to initialize struct for asynchronous loading by using frame loader + inline LoadBinding( const css::util::URL& aNewURL , + const css::uno::Sequence< css::beans::PropertyValue > lNewDescriptor , + const css::uno::Reference< css::frame::XFrame >& xNewFrame , + const css::uno::Reference< css::frame::XFrameLoader >& xNewLoader , + const css::uno::Any& aNewAsyncInfo ) + { + free(); + xLoader = xNewLoader ; + xFrame = xNewFrame ; + aURL = aNewURL ; + lDescriptor = lNewDescriptor; + aAsyncInfo = aNewAsyncInfo ; + } + + //--------------------------------------------------------------------------------------------------------- + // dont forget toe release used references + inline ~LoadBinding() + { + free(); + } + + //--------------------------------------------------------------------------------------------------------- + inline void free() + { + xHandler = css::uno::Reference< css::frame::XDispatch >() ; + xLoader = css::uno::Reference< css::frame::XFrameLoader >(); + xFrame = css::uno::Reference< css::frame::XFrame >() ; + aURL = css::util::URL() ; + lDescriptor = css::uno::Sequence< css::beans::PropertyValue >(); + aAsyncInfo = css::uno::Any() ; + } + + //------------------------------------------------------------------------------------------------------------- + public: + css::uno::Reference< css::frame::XDispatch > xHandler ; // if handler was used, this reference will be valid + css::uno::Reference< css::frame::XFrameLoader > xLoader ; // if loader was used, this reference will be valid + css::uno::Reference< css::frame::XFrame > xFrame ; // Target of loading + css::util::URL aURL ; // dispatched URL - neccessary to find listener for status event! + css::uno::Sequence< css::beans::PropertyValue > lDescriptor ; // dispatched arguments - neccessary for "reactForLoadingState()"! + css::uno::Any aAsyncInfo ; // superclasses could use them to save her own user specific data for these asynchron call-info + css::uno::Reference< css::frame::XDispatchResultListener > xListener; +}; + +//***************************************************************************************************************** +class LoaderThreads : private ::std::vector< LoadBinding > + , private ThreadHelpBase +{ + //------------------------------------------------------------------------------------------------------------- + public: + + //--------------------------------------------------------------------------------------------------------- + inline LoaderThreads() + : ThreadHelpBase() + { + } + + //--------------------------------------------------------------------------------------------------------- + inline void append( const LoadBinding& aBinding ) + { + ResetableGuard aGuard( m_aLock ); + push_back( aBinding ); + } + + //--------------------------------------------------------------------------------------------------------- + /// search for handler thread in list wich match given parameter and delete it + inline sal_Bool searchAndForget( const css::uno::Reference < css::frame::XDispatchResultListener >& rListener, LoadBinding& aBinding ) + { + ResetableGuard aGuard( m_aLock ); + sal_Bool bFound = sal_False; + for( iterator pItem=begin(); pItem!=end(); ++pItem ) + { + if( pItem->xListener == rListener ) + { + aBinding = *pItem; + erase( pItem ); + bFound = sal_True; + break; + } + } + return bFound; + } + + //--------------------------------------------------------------------------------------------------------- + /// search for loader thread in list wich match given parameter and delete it + inline sal_Bool searchAndForget( const css::uno::Reference< css::frame::XFrameLoader > xLoader, LoadBinding& aBinding ) + { + ResetableGuard aGuard( m_aLock ); + sal_Bool bFound = sal_False; + for( iterator pItem=begin(); pItem!=end(); ++pItem ) + { + if( pItem->xLoader == xLoader ) + { + aBinding = *pItem; + erase( pItem ); + bFound = sal_True; + break; + } + } + return bFound; + } + + //--------------------------------------------------------------------------------------------------------- + // free ALL memory ... I hope it + inline void free() + { + ResetableGuard aGuard( m_aLock ); + LoaderThreads().swap( *this ); + } +}; + +/*-************************************************************************************************************//** + @short base class for dispatcher implementations + @descr Most of our dispatch implementations do everytime the same. They try to handle or load + somethinmg into a target ... normaly a frame/task/pluginframe! + They must do it synchron or sometimes asynchron. They must wait for callbacks and + notify registered listener with right status events. + All these things are implemented by this baseclass. You should override some methods + to change something. + + "dispatch()" => should be you dispatch algorithm + "reactForLoadingState()" => do something depending from loading state ... + + @implements XInterface + XDispatch + XLoadEventListener + XEventListener + + @base ThreadHelpBase + TransactionBase + OWeakObject + + @devstatus ready to use + @threadsafe yes +*//*-*************************************************************************************************************/ +class BaseDispatcher : // interfaces + public css::lang::XTypeProvider , + public css::frame::XNotifyingDispatch , + public css::frame::XLoadEventListener , // => XEventListener too! + // baseclasses + // Order is neccessary for right initialization! + protected ThreadHelpBase , + protected TransactionBase , + public ::cppu::OWeakObject +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + public: + + // constructor / destructor + BaseDispatcher( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory , + const css::uno::Reference< css::frame::XFrame >& xOwnerFrame ); + + void dispatchFinished ( const css::frame::DispatchResultEvent& aEvent, const css::uno::Reference < css::frame::XDispatchResultListener >& rListener ); + + // XInterface + DECLARE_XINTERFACE + DECLARE_XTYPEPROVIDER + + // XNotifyingDispatch + virtual void SAL_CALL dispatchWithNotification ( const css::util::URL& aURL, + const css::uno::Sequence< css::beans::PropertyValue >& aArgs, + const css::uno::Reference< css::frame::XDispatchResultListener >& Listener ) throw ( css::uno::RuntimeException); + + // XDispatch + virtual void SAL_CALL dispatch ( const css::util::URL& aURL , + const css::uno::Sequence< css::beans::PropertyValue >& lArguments ) throw( css::uno::RuntimeException ) = 0; + virtual void SAL_CALL addStatusListener ( const css::uno::Reference< css::frame::XStatusListener >& xListener , + const css::util::URL& aURL ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL removeStatusListener ( const css::uno::Reference< css::frame::XStatusListener >& xListener , + const css::util::URL& aURL ) throw( css::uno::RuntimeException ); + + // XLoadEventListener + virtual void SAL_CALL loadFinished ( const css::uno::Reference< css::frame::XFrameLoader >& xLoader ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL loadCancelled ( const css::uno::Reference< css::frame::XFrameLoader >& xLoader ) throw( css::uno::RuntimeException ); + + // XEventListener + virtual void SAL_CALL disposing ( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException ); + + //------------------------------------------------------------------------------------------------------------- + // protected methods + //------------------------------------------------------------------------------------------------------------- + protected: + virtual ~BaseDispatcher(); + + /*-****************************************************************************************************//** + @short you should react for successfully or failed load/handle operations. + @descr These baseclass implement handling of dispatched URLs and synchronous/asynchronous loading + of it into a target frame. It implement the complete listener mechanism to get events from + used loader or handler and sending of status events to registered listener too! + But we couldn't react for this events in all cases. + May be - you wish to reactivate suspended controllers or wish to delete a new created + task if operation failed ...!? + By overwriting these pure virtual methods it's possible to do such things. + We call you with all available informations ... you should react for it. + BUT - don't send any status events to your listener! We will do it everytime. + (other listener could be informed as well!) + + You will called back in: a) "reactForLoadingState()" , if URL was loaded into a frame + b) "reactForHandlingState()", if URL was handled by a registered content handler + (without using a target frame!) + + @seealso method statusChanged() + @seealso method loadFinished() + @seealso method loadCancelled() + + @param "aURL" , original dispatched URL + @param "lDescriptor" , original dispatched arguments + @param "xTarget" , target of operation (could be NULL if URL was handled not loaded!) + @param "bState" , state of operation + @return - + + @onerror - + @threadsafe - + *//*-*****************************************************************************************************/ + virtual void SAL_CALL reactForLoadingState ( const css::util::URL& aURL , + const css::uno::Sequence< css::beans::PropertyValue >& lDescriptor , + const css::uno::Reference< css::frame::XFrame >& xTarget , + sal_Bool bState , + const css::uno::Any& aAsyncInfo ) = 0; + + virtual void SAL_CALL reactForHandlingState( const css::util::URL& aURL , + const css::uno::Sequence< css::beans::PropertyValue >& lDescriptor , + sal_Bool bState , + const css::uno::Any& aAsyncInfo ) = 0; + + //------------------------------------------------------------------------------------------------------------- + // protected methods + //------------------------------------------------------------------------------------------------------------- + protected: + ::rtl::OUString implts_detectType ( const css::util::URL& aURL , + css::uno::Sequence< css::beans::PropertyValue >& lDescriptor , + sal_Bool bDeep ); + sal_Bool implts_handleIt ( const css::util::URL& aURL , + css::uno::Sequence< css::beans::PropertyValue >& lDescriptor , + const ::rtl::OUString& sTypeName , + const css::uno::Any& aAsyncInfo = css::uno::Any() ); + sal_Bool implts_loadIt ( const css::util::URL& aURL , + css::uno::Sequence< css::beans::PropertyValue >& lDescriptor , + const ::rtl::OUString& sTypeName , + const css::uno::Reference< css::frame::XFrame >& xTarget , + const css::uno::Any& aAsyncInfo = css::uno::Any() ); + void implts_enableFrame ( const css::uno::Reference< css::frame::XFrame >& xFrame , + const css::uno::Sequence< css::beans::PropertyValue >& lDescriptor ); + void implts_disableFrame ( const css::uno::Reference< css::frame::XFrame >& xFrame ); + sal_Bool implts_deactivateController ( const css::uno::Reference< css::frame::XController >& xController ); + sal_Bool implts_reactivateController ( const css::uno::Reference< css::frame::XController >& xController ); + void implts_sendResultEvent ( const css::uno::Reference< css::frame::XFrame >& xEventSource , + const ::rtl::OUString& sURL , + sal_Bool bLoadState ); + + //------------------------------------------------------------------------------------------------------------- + // variables + // - should be private normaly ... + // - but some super classes need access to some of them => protected! + //------------------------------------------------------------------------------------------------------------- + protected: + css::uno::Reference< css::lang::XMultiServiceFactory > m_xFactory ; /// global uno service manager to create new services + css::uno::WeakReference< css::frame::XFrame > m_xOwner ; /// weakreference to owner (Don't use a hard reference. Owner can't delete us then!) + + private: + LoaderThreads m_aLoaderThreads ; /// list of bindings between handler/loader, tasks and loaded URLs + ListenerHash m_aListenerContainer ; /// hash table for listener at specified URLs + +}; // class BaseDispatcher + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_DISPATCH_BASEDISPATCHER_HXX_ diff --git a/framework/inc/dispatch/blankdispatcher.hxx b/framework/inc/dispatch/blankdispatcher.hxx new file mode 100644 index 000000000000..bd0e5b1d34dd --- /dev/null +++ b/framework/inc/dispatch/blankdispatcher.hxx @@ -0,0 +1,129 @@ +/************************************************************************* + * + * 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_DISPATCH_BLANKDISPATCHER_HXX_ +#define __FRAMEWORK_DISPATCH_BLANKDISPATCHER_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <dispatch/basedispatcher.hxx> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ +// exported const +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// exported definitions +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short helper for desktop only(!) to create new tasks on demand for dispatches + @descr Use this class as member only! Never use it as baseclass. + XInterface will be ambigous and we hold a weakreference to ouer OWNER - not to ouer SUPERCLASS! + + @implements XInterface + XDispatch + XStatusListener + XLoadEventListener + XEventListener + + @base BaseDispatcher + OWeakObject + + @devstatus ready to use + @threadsafe yes +*//*-*************************************************************************************************************/ +class BlankDispatcher : // -interfaces ... are supported by our BaseDispatcher! + // -baseclasses ... order is neccessary for right initialization! + public BaseDispatcher +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + public: + // ctor + BlankDispatcher ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory , + const css::uno::Reference< css::frame::XFrame >& xDesktop, + sal_Bool bIsDefaultDispatcher ); + // XDispatch + virtual void SAL_CALL dispatch ( const css::util::URL& aURL , + const css::uno::Sequence< css::beans::PropertyValue >& lArguments ) throw( css::uno::RuntimeException ); + + //------------------------------------------------------------------------------------------------------------- + // protected methods + //------------------------------------------------------------------------------------------------------------- + protected: + virtual void SAL_CALL reactForLoadingState ( const css::util::URL& aURL , + const css::uno::Sequence< css::beans::PropertyValue >& lDescriptor , + const css::uno::Reference< css::frame::XFrame >& xTarget , + sal_Bool bState , + const css::uno::Any& aAsyncInfo ); + + virtual void SAL_CALL reactForHandlingState( const css::util::URL& aURL , + const css::uno::Sequence< css::beans::PropertyValue >& lDescriptor , + sal_Bool bState , + const css::uno::Any& aAsyncInfo ); + + //------------------------------------------------------------------------------------------------------------- + // protected methods + //------------------------------------------------------------------------------------------------------------- + private: + sal_Bool implts_findAndActivateAlreadyLoadedTask( const css::util::URL& aURL , + const css::uno::Sequence< css::beans::PropertyValue >& lArguments , + const css::uno::Reference< css::frame::XFrame > xDesktop ); + + css::uno::Reference< css::frame::XFrame > implts_findAndLockRecycleTask( const css::util::URL& aURL , + const css::uno::Sequence< css::beans::PropertyValue >& lArguments , + const css::uno::Reference< css::frame::XFrame > xDesktop ); + + //------------------------------------------------------------------------------------------------------------- + // variables + // (should be private everyway!) + //------------------------------------------------------------------------------------------------------------- + private: + sal_Bool m_bIsDefaultDispatcher; +}; // class BlankDispatcher + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_DISPATCH_BLANKDISPATCHER_HXX_ diff --git a/framework/inc/dispatch/closedispatcher.hxx b/framework/inc/dispatch/closedispatcher.hxx new file mode 100644 index 000000000000..40233269b3a0 --- /dev/null +++ b/framework/inc/dispatch/closedispatcher.hxx @@ -0,0 +1,322 @@ +/************************************************************************* + * + * 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_DISPATCH_CLOSEDISPATCHER_HXX_ +#define __FRAMEWORK_DISPATCH_CLOSEDISPATCHER_HXX_ + +//_______________________________________________ +// my own includes + +#include <threadhelp/threadhelpbase.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/debug.hxx> +#include <macros/generic.hxx> +#include <stdtypes.h> +#include <general.h> + +//_______________________________________________ +// interface includes +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/frame/XStatusListener.hpp> +#include <com/sun/star/frame/XNotifyingDispatch.hpp> +#include <com/sun/star/frame/XDispatchInformationProvider.hpp> +#include <com/sun/star/util/URL.hpp> +#include <com/sun/star/frame/XDispatchResultListener.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/frame/DispatchResultState.hpp> + +//_______________________________________________ +// other includes +#include <cppuhelper/weak.hxx> +#include <vcl/evntpost.hxx> + +//_______________________________________________ +// namespace + +namespace framework{ + +//----------------------------------------------- +/** + @short helper to dispatch the URLs ".uno:CloseDoc"/".uno:CloseWin"/".uno:CloseFrame" + to close a frame/document or the whole application implicitly in case it was the last frame + + @descr These URLs implements a special functionality to close a document or the whole frame ... + and handle the state, it was the last frame or document. Then we create the + default backing document which can be used to open new ones using the file open dialog + or some other menu entries. Or we terminate the whole application in case this backing mode shouldnt + be used. + */ +class CloseDispatcher : public css::lang::XTypeProvider + , public css::frame::XNotifyingDispatch // => XDispatch + , public css::frame::XDispatchInformationProvider + // baseclasses ... order is neccessary for right initialization! + , private ThreadHelpBase + , public ::cppu::OWeakObject +{ + //------------------------------------------- + // types + + private: + + //--------------------------------------- + /** @short describe, which request must be done here. + @descr The incoming URLs {.uno:CloseDoc/CloseWin and CloseFrame + can be classified so and checked later performant.}*/ + enum EOperation + { + E_CLOSE_DOC, + E_CLOSE_FRAME, + E_CLOSE_WIN + }; + + //------------------------------------------- + // member + + private: + + //--------------------------------------- + /** @short reference to an uno service manager, + which can be used to create own needed + uno resources. */ + css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR; + + //--------------------------------------- + /** @short reference to the target frame, which should be + closed by this dispatch. */ + css::uno::WeakReference< css::frame::XFrame > m_xCloseFrame; + + //--------------------------------------- + /** @short used for asynchronous callbacks within the main thread. + @descr Internaly we work asynchronous. Because our callis + are not aware, that her request can kill its own environment ... */ + ::vcl::EventPoster m_aAsyncCallback; + + //--------------------------------------- + /** @short used inside asyncronous callback to decide, + which operation must be executed. */ + EOperation m_eOperation; + + //--------------------------------------- + /** @short for asynchronous operations we must hold us self alive! */ + css::uno::Reference< css::uno::XInterface > m_xSelfHold; + + //--------------------------------------- + /** @short list of registered status listener */ + ListenerHash m_lStatusListener; + + //--------------------------------------- + /** @short holded alive for internaly asynchronous operations! */ + css::uno::Reference< css::frame::XDispatchResultListener > m_xResultListener; + + //------------------------------------------- + // native interface + + public: + + //--------------------------------------- + /** @short connect a new CloseDispatcher instance to its frame. + @descr One CloseDispatcher instance is bound to onw frame only. + That makes an implementation (e.g. of listener support) + much more easier .-) + + @param xSMGR + an un oservice manager, which is needed to create uno resource + internaly. + + @param xFrame + the frame where the corresponding dispatch was started. + + @param sTarget + help us to find the right target for this close operation. + */ + CloseDispatcher(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR , + const css::uno::Reference< css::frame::XFrame >& xFrame , + const ::rtl::OUString& sTarget); + + //--------------------------------------- + /** @short does nothing real. */ + virtual ~CloseDispatcher(); + + //------------------------------------------- + // uno interface + + public: + + //--------------------------------------- + FWK_DECLARE_XINTERFACE + FWK_DECLARE_XTYPEPROVIDER + + //--------------------------------------- + // XNotifyingDispatch + virtual void SAL_CALL dispatchWithNotification( const css::util::URL& aURL , + const css::uno::Sequence< css::beans::PropertyValue >& lArguments, + const css::uno::Reference< css::frame::XDispatchResultListener >& xListener ) throw(css::uno::RuntimeException); + + //--------------------------------------- + // XDispatch + virtual void SAL_CALL dispatch ( const css::util::URL& aURL , + const css::uno::Sequence< css::beans::PropertyValue >& lArguments) throw(css::uno::RuntimeException); + virtual void SAL_CALL addStatusListener ( const css::uno::Reference< css::frame::XStatusListener >& xListener , + const css::util::URL& aURL ) throw(css::uno::RuntimeException); + virtual void SAL_CALL removeStatusListener( const css::uno::Reference< css::frame::XStatusListener >& xListener , + const css::util::URL& aURL ) throw(css::uno::RuntimeException); + + //--------------------------------------- + // XDispatchInformationProvider + virtual css::uno::Sequence< sal_Int16 > SAL_CALL getSupportedCommandGroups ( ) throw (css::uno::RuntimeException); + virtual css::uno::Sequence< css::frame::DispatchInformation > SAL_CALL getConfigurableDispatchInformation( sal_Int16 nCommandGroup ) throw (css::uno::RuntimeException); + + //------------------------------------------- + // internal helper + + private: + + //--------------------------------------- + /** @short a callback for asynchronous started operations. + + @descr As already mentione, we make internaly all operations + asynchronous. Otherwhise our callis kill its own environment + during they call us ... + */ + DECL_LINK( impl_asyncCallback, void* ); + + //--------------------------------------- + /** @short prepare m_xCloseFrame so it should be closeable without problems. + + @descr Thats needed to be shure, that the document cant disagree + later with e.g. an office termination. + The problem: Closing of documents can show UI. If the user + ignores it and open/close other documents, we cant know + which state the office has after closing of this frame. + + @param bAllowSuspend + force calling of XController->suspend(). + + @param bCloseAllOtherViewsToo + if there are other top level frames, which + contains views to the same document then our m_xCloseFrame, + they are forced to be closed too. + We need it to implement the CLOSE_DOC semantic. + + @return [boolean] + sal_True if closing was successfully. + */ + sal_Bool implts_prepareFrameForClosing(const css::uno::Reference< css::frame::XFrame >& xFrame , + sal_Bool bAllowSuspend , + sal_Bool bCloseAllOtherViewsToo, + sal_Bool& bControllerSuspended ); + + //--------------------------------------- + /** @short close the member m_xCloseFrame. + + @descr This method does not look for any document + inside this frame. Such views must be cleared + before (e.g. by calling implts_closeView()! + + Otherwhise e.g. the XController->suspend() + call isnt made and no UI warn the user about + loosing document changes. Because the + frame is closed .... + + @return [bool] + sal_True if closing was successfully. + */ + sal_Bool implts_closeFrame(); + + //--------------------------------------- + /** @short set the special BackingComponent (now StartModule) + as new component of our m_xCloseFrame. + + @return [bool] + sal_True if operation was successfully. + */ + sal_Bool implts_establishBackingMode(); + + //--------------------------------------- + /** @short calls XDesktop->terminate(). + + @descr No office code has to be called + afterwards! Because the process is dieing ... + The only exception is a might be registered + listener at this instance here. + Because he should know, that such things will happen :-) + + @return [bool] + sal_True if termination of the application was started ... + */ + sal_Bool implts_terminateApplication(); + + //--------------------------------------- + /** @short notify a DispatchResultListener. + + @descr We check the listener reference before we use it. + So this method can be called everytimes! + + @parama xListener + the listener, which should be notified. + Can be null! + + @param nState + directly used as css::frame::DispatchResultState value. + + @param aResult + not used yet realy ... + */ + void implts_notifyResultListener(const css::uno::Reference< css::frame::XDispatchResultListener >& xListener, + sal_Int16 nState , + const css::uno::Any& aResult ); + + //--------------------------------------- + /** @short try to find the right target frame where this close request + must be realy done. + + @descr The problem behind: closing some resources depends sometimes from the + context where its dispatched. Sometimes the start frame of the dispatch + has to be closed itself (target=_self) ... sometimes it's parent frame + has to be closed - BUT(!) it means a parent frame containing a top level + window. _top cant be used then for dispatch - because it adress TopFrames + not frames containg top level windows. So normaly _magic (which btw does not + exists at the moment .-) ) should be used. So we interpret target=<empty> + as _magic ! + + @param xFrame + start point for search of right dispatch frame. + + @param sTarget + give us an idea how this target frame must be searched. + */ + + static css::uno::Reference< css::frame::XFrame > static_impl_searchRightTargetFrame(const css::uno::Reference< css::frame::XFrame >& xFrame , + const ::rtl::OUString& sTarget); + +}; // class CloseDispatcher + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_DISPATCH_CLOSEDISPATCHER_HXX_ diff --git a/framework/inc/dispatch/createdispatcher.hxx b/framework/inc/dispatch/createdispatcher.hxx new file mode 100644 index 000000000000..41b448455b0e --- /dev/null +++ b/framework/inc/dispatch/createdispatcher.hxx @@ -0,0 +1,127 @@ +/************************************************************************* + * + * 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_DISPATCH_CREATEDISPATCHER_HXX_ +#define __FRAMEWORK_DISPATCH_CREATEDISPATCHER_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <dispatch/basedispatcher.hxx> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ +// exported const +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// exported definitions +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short helper to create new frames by using non special target name and CREATE flag + @descr If user whish to find any frame by name or will create it, if it not already exist ... + these dispatch helper should be used. Because - a frame must be created at dispatch call ... + not on queryDispatch()! So we hold weakreferences to the possible parent frame, safe the name + of new frame. If user call dispatch at us - we check a weakreference to our last created frame + (he should have same name!) ... if he exist - we do nothing ... if not - we create it again. + But if possible parent for new created task doesn't exist - we couldn't do anything! + Then we wait for our own dispose and do nothing. + + @attention Use this class as member only! Never use it as baseclass. + XInterface will be ambigous and we hold a weakreference to ouer OWNER - not to ouer SUPERCLASS! + + @implements XInterface + XDispatch + XStatusListener + XLoadEventListener + XEventListener + + @base BaseDispatcher + + @devstatus ready to use + @threadsafe yes +*//*-*************************************************************************************************************/ +class CreateDispatcher : // -interfaces ... are supported by our BaseDispatcher! + // -baseclasses ... order is neccessary for right initialization! + public BaseDispatcher +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + public: + // ctor + CreateDispatcher ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory , + const css::uno::Reference< css::frame::XFrame >& xParent , + const rtl::OUString& sName ); + // XDispatch + virtual void SAL_CALL dispatch ( const css::util::URL& aURL , + const css::uno::Sequence< css::beans::PropertyValue >& lArguments ) throw( css::uno::RuntimeException ); + + //------------------------------------------------------------------------------------------------------------- + // protected methods + //------------------------------------------------------------------------------------------------------------- + protected: + virtual void SAL_CALL reactForLoadingState ( const css::util::URL& aURL , + const css::uno::Sequence< css::beans::PropertyValue >& lDescriptor , + const css::uno::Reference< css::frame::XFrame >& xTarget , + sal_Bool bState , + const css::uno::Any& aAsyncInfo = css::uno::Any() ); + + virtual void SAL_CALL reactForHandlingState( const css::util::URL& aURL , + const css::uno::Sequence< css::beans::PropertyValue >& lDescriptor , + sal_Bool bState , + const css::uno::Any& aAsyncInfo = css::uno::Any() ) + { LOG_WARNING( "CreateDispatcher::reactForHandlingState()", "Who call this function! It's a non used pure virtual function overload ..." ) } + + //------------------------------------------------------------------------------------------------------------- + // variables + // (should be private everyway!) + //------------------------------------------------------------------------------------------------------------- + private: + css::uno::WeakReference< css::frame::XFrame > m_xTarget ; /// new created frame (Don't hold hard reference ... target frame couldn't die then!) + ::rtl::OUString m_sTargetName ; /// name of new created frame + +}; // class CreateDispatcher + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_DISPATCH_CREATEDISPATCHER_HXX_ diff --git a/framework/inc/dispatch/dispatchinformationprovider.hxx b/framework/inc/dispatch/dispatchinformationprovider.hxx new file mode 100644 index 000000000000..124698145340 --- /dev/null +++ b/framework/inc/dispatch/dispatchinformationprovider.hxx @@ -0,0 +1,111 @@ +/************************************************************************* + * + * 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_DISPATCH_DISPATCHINFORMATIONPROVIDER_HXX_ +#define __FRAMEWORK_DISPATCH_DISPATCHINFORMATIONPROVIDER_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <threadhelp/threadhelpbase.hxx> +#include <macros/generic.hxx> +#include <macros/debug.hxx> +#include <macros/xinterface.hxx> +#include <general.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/frame/XDispatchInformationProvider.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <cppuhelper/weakref.hxx> +#include <rtl/ustring.hxx> +#include <cppuhelper/weak.hxx> +#include <vcl/svapp.hxx> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ +// exported const +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// exported definitions +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short a helper to merge dispatch informations of different sources together. +*//*-*************************************************************************************************************/ +class DispatchInformationProvider : public css::frame::XDispatchInformationProvider + , private ThreadHelpBase + , public ::cppu::OWeakObject +{ + //_______________________ + // member + private: + + css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR; + css::uno::WeakReference< css::frame::XFrame > m_xFrame; + + //_______________________ + // interface + public: + + DispatchInformationProvider(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR , + const css::uno::Reference< css::frame::XFrame >& xFrame); + + virtual ~DispatchInformationProvider(); + + FWK_DECLARE_XINTERFACE + + virtual css::uno::Sequence< sal_Int16 > SAL_CALL getSupportedCommandGroups() + throw (css::uno::RuntimeException); + + virtual css::uno::Sequence< css::frame::DispatchInformation > SAL_CALL getConfigurableDispatchInformation(sal_Int16 nCommandGroup) + throw (css::uno::RuntimeException); + + //_______________________ + // helper + private: + + css::uno::Sequence< css::uno::Reference< css::frame::XDispatchInformationProvider > > implts_getAllSubProvider(); + +}; // class DispatchInformationProvider + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_DISPATCH_DISPATCHINFORMATIONPROVIDER_HXX_ diff --git a/framework/inc/dispatch/dispatchprovider.hxx b/framework/inc/dispatch/dispatchprovider.hxx new file mode 100644 index 000000000000..15e2a1df5987 --- /dev/null +++ b/framework/inc/dispatch/dispatchprovider.hxx @@ -0,0 +1,173 @@ +/************************************************************************* + * + * 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_DISPATCH_DISPATCHPROVIDER_HXX_ +#define __FRAMEWORK_DISPATCH_DISPATCHPROVIDER_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <services/frame.hxx> + +#include <classes/protocolhandlercache.hxx> +#include <threadhelp/threadhelpbase.hxx> + +#ifndef __FRAMEWORK_THREADHELP_TRANSACTIONBASE_HXX_ +#include <threadhelp/transactionbase.hxx> +#endif +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/debug.hxx> +#include <macros/generic.hxx> +#include <stdtypes.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/frame/XDispatchProvider.hpp> +#include <com/sun/star/util/URL.hpp> +#include <com/sun/star/frame/DispatchDescriptor.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <cppuhelper/weak.hxx> +#include <cppuhelper/weakref.hxx> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ + +/** + @descr We know some special dispatch objects with diffrent functionality. + The can be created internaly by the following DispatchProvider. + Here we define some identifier to force creation of the right one. +*/ +enum EDispatchHelper +{ + E_DEFAULTDISPATCHER , + E_MENUDISPATCHER , + E_HELPAGENTDISPATCHER , + E_CREATEDISPATCHER , + E_BLANKDISPATCHER , + E_SELFDISPATCHER , + E_CLOSEDISPATCHER , + E_STARTMODULEDISPATCHER +}; + +//_________________________________________________________________________________________________________________ + +/** + @short implement a helper for XDispatchProvider interface + @descr The result of a queryDispatch() call depends from the owner, which use an instance of this class. + (frame, desktop) All of them must provides different functionality. + E.g: - task can be created by the desktop only + - a task can have a beamer as direct child + - a normal frame never can create a new one by himself + + @attention Use this class as member only! Never use it as baseclass. + XInterface will be ambigous and we hold a weakreference to ouer OWNER - not to ouer SUPERCLASS! + + @base ThreadHelpBase + supports threadsafe mechanism + @base OWeakObject + provides ref count and weak mechanism + + @devstatus ready to use + @threadsafe yes + @modified 17.05.2002 07:56, as96863 +*/ +class DispatchProvider : // interfaces + public css::lang::XTypeProvider , + public css::frame::XDispatchProvider , + // baseclasses + // Order is neccessary for right initialization! + private ThreadHelpBase , + private TransactionBase , + public ::cppu::OWeakObject +{ + /* member */ + private: + /// reference to global service manager to create new services + css::uno::Reference< css::lang::XMultiServiceFactory > m_xFactory; + /// weakreference to owner frame (Don't use a hard reference. Owner can't delete us then!) + css::uno::WeakReference< css::frame::XFrame > m_xFrame; + /// different dispatcher to handle special dispatch calls, protocols or URLs (they will be created on demand.) + css::uno::Reference< css::frame::XDispatch > m_xMenuDispatcher ; + css::uno::Reference< css::frame::XDispatch > m_xHelpAgentDispatcher; +/* css::uno::Reference< css::frame::XDispatch > m_xBlankDispatcher ; + css::uno::Reference< css::frame::XDispatch > m_xSelfDispatcher ; + css::uno::Reference< css::frame::XDispatch > m_xDefaultDispatcher ;*/ + /// cache of some other dispatch provider which are registered inside configuration to handle special URL protocols + HandlerCache m_aProtocolHandlerCache; + + /* interface */ + public: + FWK_DECLARE_XINTERFACE + FWK_DECLARE_XTYPEPROVIDER + + DispatchProvider( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory , + const css::uno::Reference< css::frame::XFrame >& xFrame ); + + virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL queryDispatch ( const css::util::URL& aURL , + const ::rtl::OUString& sTargetFrameName , + sal_Int32 nSearchFlags ) throw( css::uno::RuntimeException ); + virtual css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL queryDispatches( const css::uno::Sequence< css::frame::DispatchDescriptor >& lDescriptions ) throw( css::uno::RuntimeException ); + + /* helper */ + protected: + // Let him protected! So nobody can use us as base ... + virtual ~DispatchProvider(); + + private: + css::uno::Reference< css::frame::XDispatch > implts_getOrCreateDispatchHelper ( EDispatchHelper eHelper , + const css::uno::Reference< css::frame::XFrame >& xOwner , + const ::rtl::OUString& sTarget = ::rtl::OUString() , + sal_Int32 nSearchFlags = 0 ); + sal_Bool implts_isLoadableContent ( const css::util::URL& aURL ); + css::uno::Reference< css::frame::XDispatch > implts_queryDesktopDispatch ( const css::uno::Reference< css::frame::XFrame > xDesktop , + const css::util::URL& aURL , + const ::rtl::OUString& sTargetFrameName , + sal_Int32 nSearchFlags ); + css::uno::Reference< css::frame::XDispatch > implts_queryFrameDispatch ( const css::uno::Reference< css::frame::XFrame > xFrame , + const css::util::URL& aURL , + const ::rtl::OUString& sTargetFrameName , + sal_Int32 nSearchFlags ); + css::uno::Reference< css::frame::XDispatch > implts_searchProtocolHandler ( const css::util::URL& aURL ); + +}; // class DispatchProvider + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_DISPATCH_DISPATCHPROVIDER_HXX_ diff --git a/framework/inc/dispatch/helpagentdispatcher.hxx b/framework/inc/dispatch/helpagentdispatcher.hxx new file mode 100644 index 000000000000..84eaf284255b --- /dev/null +++ b/framework/inc/dispatch/helpagentdispatcher.hxx @@ -0,0 +1,205 @@ +/************************************************************************* + * + * 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_DISPATCH_HELPAGENTDISPATCHER_HXX_ +#define __FRAMEWORK_DISPATCH_HELPAGENTDISPATCHER_HXX_ + +#include <threadhelp/threadhelpbase.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/awt/XWindowListener.hpp> +#include <com/sun/star/awt/XWindow.hpp> +#include <svtools/helpagentwindow.hxx> +#include <vcl/timer.hxx> +#include <vcl/evntpost.hxx> +#include <cppuhelper/weak.hxx> + +//........................................................................ +namespace framework +{ + +// define css alias ... and undefine it at the end of this file !!! +#ifdef css + #error "I tried to use css as namespace define inside non exported header ... but it was already defined by somwhere else. .-)" +#else + #define css ::com::sun::star +#endif + +//........................................................................ + +class HelpAgentDispatcher : public css::lang::XTypeProvider + , public css::frame::XDispatch + , public css::awt::XWindowListener // => css::lang::XEventListener + , public ::svt::IHelpAgentCallback + , private ThreadHelpBase + , public ::cppu::OWeakObject +{ + private: + + //--------------------------------------- + /// @short represent the current active help URL, which must be used to show the right help page + ::rtl::OUString m_sCurrentURL; + + //--------------------------------------- + /// @short parent of the agent window. + css::uno::Reference< css::awt::XWindow > m_xContainerWindow; + + //--------------------------------------- + /// @short the agent window itself (implemented in svtools) + css::uno::Reference< css::awt::XWindow > m_xAgentWindow; + + //--------------------------------------- + /// @short the timer for showing the agent window + Timer m_aTimer; + + //--------------------------------------- + /** @short hold this dispatcher alive till the timer was killed or expired! + @descr Because the vcl timer knows us by using a pointer ... and our instance is used + ref counted normaly it can happen that our reference goes down to 0 ... and the timer + runs into some trouble. So we hold us self alive till the timer could be stopped or expired. + */ + css::uno::Reference< css::uno::XInterface > m_xSelfHold; + + public: + + HelpAgentDispatcher(const css::uno::Reference< css::frame::XFrame >& xParentFrame); + + FWK_DECLARE_XINTERFACE + FWK_DECLARE_XTYPEPROVIDER + + // css::frame::XDispatch + virtual void SAL_CALL dispatch(const css::util::URL& sURL , + const css::uno::Sequence< css::beans::PropertyValue >& lArgs) + throw(css::uno::RuntimeException); + virtual void SAL_CALL addStatusListener(const css::uno::Reference< css::frame::XStatusListener >& xListener, + const css::util::URL& aURL ) + throw(css::uno::RuntimeException); + virtual void SAL_CALL removeStatusListener(const css::uno::Reference< css::frame::XStatusListener >& xListener, + const css::util::URL& aURL ) + throw(css::uno::RuntimeException); + + // css::awt::XWindowListener + virtual void SAL_CALL windowResized(const css::awt::WindowEvent& aSource) + throw(css::uno::RuntimeException); + virtual void SAL_CALL windowMoved(const css::awt::WindowEvent& aSource) + throw(css::uno::RuntimeException); + virtual void SAL_CALL windowShown(const css::lang::EventObject& aSource) + throw(css::uno::RuntimeException); + virtual void SAL_CALL windowHidden(const css::lang::EventObject& aSource) + throw(css::uno::RuntimeException); + + // css::lang::XEventListener + virtual void SAL_CALL disposing(const css::lang::EventObject& aSource) + throw(css::uno::RuntimeException); + + protected: + + ~HelpAgentDispatcher(); + + protected: + + /// IHelpAgentCallback overridables + virtual void helpRequested(); + virtual void closeAgent(); + + private: + + //--------------------------------------- + /** @short mark the current set URL as "accepted by user" and show the right help window + */ + void implts_acceptCurrentURL(); + + //--------------------------------------- + /** @short mark the current set URL as "ignored by user" + */ + void implts_ignoreCurrentURL(); + + //--------------------------------------- + /** @short ensures that the agent's window exists + @descr We create the agent window on demand. But afterwards we hold it alive till + this helpagent dispatcher dies. The agent window will be made visible/hidden + in case a new dispatch occures or in case the timer expired. + + @return [sal_Bool] + sal_True in case the member m_xAgentWindow is a valid reference; + sal_False otherwise. + */ + css::uno::Reference< css::awt::XWindow > implts_ensureAgentWindow(); + + //--------------------------------------- + /** @short show the agent window. + @descr If the agent window does not exists, it will be created on demand. + (see implts_ensureAgentWindow). Further it's checked if the parent container + window is currently visible or not. Only if its visible the agent window will + be shown too. + */ + void implts_showAgentWindow(); + + //--------------------------------------- + /** @short hide the agent window. + */ + void implts_hideAgentWindow(); + + //--------------------------------------- + /** @short set the new position and size of the agent window. + @descr If the agent window does not exists, it will be created on demand. + (see implts_ensureAgentWindow). + If the agent window exists, its position and size will be calculated + and set. + */ + void implts_positionAgentWindow(); + + //--------------------------------------- + /** @short starts the timer for showing the agent window. + @descr The timer wont be started twice ... this method checks the current running state .-) + */ + void implts_startTimer(); + + //--------------------------------------- + /** @short stop the timer. + @descr The timer wont be stopped twice ... this method checks the current running state .-) + Further this method marks the current help URL (m_xCurrentURL) as "ignorable". + Cause the user ignored it ! + */ + void implts_stopTimer(); + + //--------------------------------------- + /** @short callback of our internal timer. + */ + DECL_LINK(implts_timerExpired, void*); +}; + +#undef css + +//........................................................................ +} // namespace framework +//........................................................................ + +#endif // _FRAMEWORK_DISPATCH_HELPAGENTDISPATCHER_HXX_ + diff --git a/framework/inc/dispatch/interceptionhelper.hxx b/framework/inc/dispatch/interceptionhelper.hxx new file mode 100644 index 000000000000..e811e9ddec7c --- /dev/null +++ b/framework/inc/dispatch/interceptionhelper.hxx @@ -0,0 +1,326 @@ +/************************************************************************* + * + * 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_HELPER_INTERCEPTIONHELPER_HXX_ +#define __FRAMEWORK_HELPER_INTERCEPTIONHELPER_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <services/frame.hxx> +#include <threadhelp/threadhelpbase.hxx> +#include <macros/xinterface.hxx> +#include <macros/generic.hxx> +#include <macros/debug.hxx> +#include <general.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/frame/XDispatchProviderInterception.hpp> +#include <com/sun/star/frame/XDispatchProviderInterceptor.hpp> +#include <com/sun/star/frame/XDispatchProvider.hpp> +#include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/frame/DispatchDescriptor.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <tools/wldcrd.hxx> +#include <cppuhelper/weak.hxx> +#include <cppuhelper/weakref.hxx> + +#ifndef __SGI_STL_DEQUE +#include <deque> +#endif + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ +// exported const +//_________________________________________________________________________________________________________________ + +//_________________________________________________________ +// definitions +//_________________________________________________________ + +/** @short implements a helper to support interception with additional functionality. + + @descr This helper implements the complete XDispatchProviderInterception interface with + master/slave functionality AND using of optional features like registration of URL pattern! + + @attention Don't use this class as direct member - use it dynamicly. Do not derive from this class. + We hold a weakreference to ouer owner not to ouer superclass. + */ +class InterceptionHelper : public css::frame::XDispatchProvider + , public css::frame::XDispatchProviderInterception + , public css::lang::XEventListener + // order of base classes is important for right initialization of mutex member! + , private ThreadHelpBase + , public ::cppu::OWeakObject +{ + //_____________________________________________________ + // structs, helper + + /** @short bind an interceptor component to it's URL pattern registration. */ + struct InterceptorInfo + { + /** @short reference to the interceptor component. */ + css::uno::Reference< css::frame::XDispatchProvider > xInterceptor; + + /** @short it's registration for URL patterns. + + @descr If the interceptor component does not support the optional interface + XInterceptorInfo, it will be registered for one pattern "*" by default. + That would make it possible to handle it in the same manner then real + registered interceptor objects and we must not implement any special code. */ + css::uno::Sequence< ::rtl::OUString > lURLPattern; + }; + + //_____________________________________________________ + + /** @short implements a list of items of type InterceptorInfo, and provides some special + functions on it. + + @descr Because interceptor objects can be registered for URL patterns, + it supports a wildcard search on all list items. + */ + class InterceptorList : public ::std::deque< InterceptorInfo > + { + public: + + //_____________________________________________ + + /** @short search for an interceptor inside this list using it's reference. + + @param xInterceptor + points to the interceptor object, which should be located inside this list. + + @return An iterator object, which points directly to the located item inside this list. + In case no interceptor could be found, it points to the end of this list! + */ + iterator findByReference(const css::uno::Reference< css::frame::XDispatchProviderInterceptor >& xInterceptor) + { + css::uno::Reference< css::frame::XDispatchProviderInterceptor > xProviderInterface(xInterceptor, css::uno::UNO_QUERY); + iterator pIt; + for (pIt=begin(); pIt!=end(); ++pIt) + { + if (pIt->xInterceptor == xProviderInterface) + return pIt; + } + return end(); + } + + //_____________________________________________ + + /** @short search for an interceptor inside this list using it's reference. + + @param xInterceptor + points to the interceptor object, which should be located inside this list. + + @return An iterator object, which points directly to the located item inside this list. + In case no interceptor could be found, it points to the end of this list! + */ + iterator findByPattern(const ::rtl::OUString& sURL) + { + iterator pIt; + for (pIt=begin(); pIt!=end(); ++pIt) + { + sal_Int32 c = pIt->lURLPattern.getLength(); + const ::rtl::OUString* pPattern = pIt->lURLPattern.getConstArray(); + + for (sal_Int32 i=0; i<c; ++i) + { + WildCard aPattern(pPattern[i]); + if (aPattern.Matches(sURL)) + return pIt; + } + } + return end(); + } + }; + + //_____________________________________________________ + // member + + private: + + /** @short reference to the frame, which uses this instance to implement it's own interception. + + @descr We hold a weak reference only, to make disposing operations easy. */ + css::uno::WeakReference< css::frame::XFrame > m_xOwnerWeak; + + /** @short this interception helper implements the top level master of an interceptor list ... + but this member is the lowest possible slave! */ + css::uno::Reference< css::frame::XDispatchProvider > m_xSlave; + + /** @short contains all registered interceptor objects. */ + InterceptorList m_lInterceptionRegs; + + /** @short it regulates, which interceptor is used first. + The last or the first registered one. */ + static sal_Bool m_bPreferrFirstInterceptor; + + //_____________________________________________________ + // native interface + + public: + + //_________________________________________________ + + /** @short creates a new interception helper instance. + + @param xOwner + points to the frame, which use this instances to support it's own interception interfaces. + + @param xSlave + an outside creates dispatch provider, which has to be used here as lowest slave "interceptor". + */ + InterceptionHelper(const css::uno::Reference< css::frame::XFrame >& xOwner, + const css::uno::Reference< css::frame::XDispatchProvider >& xSlave); + + protected: + + //_________________________________________________ + + /** @short standard destructor. + + @descr This method destruct an instance of this class and clear some member. + This method is protected, because its not allowed to use this class as a direct member! + You MUST use a dynamical instance (pointer). That's the reason for a protected dtor. + */ + virtual ~InterceptionHelper(); + + //_____________________________________________________ + // uno interface + + public: + + FWK_DECLARE_XINTERFACE + + //_________________________________________________ + // XDispatchProvider + + /** @short query for a dispatch, which implements the requested feature. + + @descr We search inside our list of interception registrations, to locate + any interested interceptor. In case no interceptor exists or nobody is + interested on this URL our lowest slave will be used. + + @param aURL + describes the requested dispatch functionality. + + @param sTargetFrameName + the name of the target frame or a special name like "_blank", "_top" ... + Won't be used here ... but may by one of our registered interceptor objects + or our slave. + + @param nSearchFlags + optional search parameter for targeting, if sTargetFrameName isn't a special one. + + @return A valid dispatch object, if any interceptor or at least our slave is interested on the given URL; + or NULL otherwhise. + */ + virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL queryDispatch(const css::util::URL& aURL , + const ::rtl::OUString& sTargetFrameName, + sal_Int32 nSearchFlags ) + throw(css::uno::RuntimeException); + + //_________________________________________________ + // XDispatchProvider + + /** @short implements an optimized queryDispatch() for remote. + + @descr It capsulate more then one queryDispatch() requests and return a lits of dispatch objects + as result. Because both lists (in and out) coreespond together, it's not allowed to + pack it - means supress NULL references! + + @param lDescriptor + a list of queryDispatch() arguments. + + @return A list of dispatch objects. + */ + virtual css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL queryDispatches(const css::uno::Sequence< css::frame::DispatchDescriptor >& lDescriptor) + throw(css::uno::RuntimeException); + + //_________________________________________________ + // XDispatchProviderInterception + + /** @short register an interceptor. + + @descr Somebody can register himself to intercept all or some special dispatches. + It's depend from his supported interfaces. If he implement XInterceptorInfo + he his called for some special URLs only - otherwise we call it for every request! + + @attention We don't check for double registrations here! + + @param xInterceptor + reference to interceptor, which wish to be registered here. + + @throw A RuntimeException if the given reference is NULL! + */ + virtual void SAL_CALL registerDispatchProviderInterceptor(const css::uno::Reference< css::frame::XDispatchProviderInterceptor >& xInterceptor) + throw(css::uno::RuntimeException); + + //_________________________________________________ + // XDispatchProviderInterception + + /** @short release an interceptor. + + @descr Remove the registered interceptor from our internal list + and delete all special informations about it. + + @param xInterceptor + reference to the interceptor, which wish to be deregistered. + + @throw A RuntimeException if the given reference is NULL! + */ + virtual void SAL_CALL releaseDispatchProviderInterceptor( const css::uno::Reference< css::frame::XDispatchProviderInterceptor >& xInterceptor ) throw( css::uno::RuntimeException ); + + //_________________________________________________ + // XEventListener + + /** @short Is called from our owner frame, in case he will be disposed. + + @descr We have to relaease all references to him then. + Normaly we will die by ref count too ... + */ + virtual void SAL_CALL disposing(const css::lang::EventObject& aEvent) + throw(css::uno::RuntimeException); + +}; // class InterceptionHelper + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_HELPER_INTERCEPTIONHELPER_HXX_ diff --git a/framework/inc/dispatch/mailtodispatcher.hxx b/framework/inc/dispatch/mailtodispatcher.hxx new file mode 100644 index 000000000000..f1c6dc34d194 --- /dev/null +++ b/framework/inc/dispatch/mailtodispatcher.hxx @@ -0,0 +1,145 @@ +/************************************************************************* + * + * 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_DISPATCH_MAILTODISPATCHER_HXX_ +#define __FRAMEWORK_DISPATCH_MAILTODISPATCHER_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <macros/generic.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> +#include <macros/debug.hxx> +#include <threadhelp/threadhelpbase.hxx> +#include <general.h> +#include <stdtypes.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/frame/XNotifyingDispatch.hpp> +#include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/frame/XDispatchProvider.hpp> +#include <com/sun/star/util/URL.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/frame/XStatusListener.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <cppuhelper/weak.hxx> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ +// exported const +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// exported definitions +//_________________________________________________________________________________________________________________ + +/** + @short protocol handler for "mailto:" URLs + @descr It's a special dispatch object which is used registered for "mailto:*" URLs and + will be automaticly used from the framework dispatch mechanism if such URL occured. + + @base ThreadHelpBase + exports a lock member to guarantee right initialize value of it + @base OWeakObject + provides XWeak and ref count mechanism + + @devstatus ready to use + + @modified 02.05.2002 08:12, as96863 +*/ +class MailToDispatcher : // interfaces + public css::lang::XTypeProvider , + public css::lang::XServiceInfo , + public css::frame::XDispatchProvider , + public css::frame::XNotifyingDispatch, // => XDispatch + // baseclasses + // Order is neccessary for right initialization! + private ThreadHelpBase , + public cppu::OWeakObject +{ + /* member */ + private: + + /// reference to global uno service manager which had created us + css::uno::Reference< css::lang::XMultiServiceFactory > m_xFactory; + + /* interface */ + public: + + // ctor/dtor + MailToDispatcher( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory ); + virtual ~MailToDispatcher( ); + + // XInterface, XTypeProvider, XServiceInfo + FWK_DECLARE_XINTERFACE + FWK_DECLARE_XTYPEPROVIDER + DECLARE_XSERVICEINFO + + // XDispatchProvider + virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL queryDispatch ( const css::util::URL& aURL , + const ::rtl::OUString& sTarget , + sal_Int32 nFlags ) throw( css::uno::RuntimeException ); + virtual css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL queryDispatches( const css::uno::Sequence< css::frame::DispatchDescriptor >& lDescriptor ) throw( css::uno::RuntimeException ); + + // XNotifyingDispatch + virtual void SAL_CALL dispatchWithNotification( const css::util::URL& aURL , + const css::uno::Sequence< css::beans::PropertyValue >& lArguments, + const css::uno::Reference< css::frame::XDispatchResultListener >& xListener ) throw( css::uno::RuntimeException ); + + // XDispatch + virtual void SAL_CALL dispatch ( const css::util::URL& aURL , + const css::uno::Sequence< css::beans::PropertyValue >& lArguments ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL addStatusListener ( const css::uno::Reference< css::frame::XStatusListener >& xListener , + const css::util::URL& aURL ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL removeStatusListener( const css::uno::Reference< css::frame::XStatusListener >& xListener , + const css::util::URL& aURL ) throw( css::uno::RuntimeException ); + + /* internal */ + private: + + sal_Bool implts_dispatch( const css::util::URL& aURL , + const css::uno::Sequence< css::beans::PropertyValue >& lArguments ) throw( css::uno::RuntimeException ); + +}; // class MailToDispatcher + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_DISPATCH_MAILTODISPATCHER_HXX_ diff --git a/framework/inc/dispatch/menudispatcher.hxx b/framework/inc/dispatch/menudispatcher.hxx new file mode 100644 index 000000000000..30016a96f499 --- /dev/null +++ b/framework/inc/dispatch/menudispatcher.hxx @@ -0,0 +1,336 @@ +/************************************************************************* + * + * 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_DISPATCH_MENUDISPATCHER_HXX_ +#define __FRAMEWORK_DISPATCH_MENUDISPATCHER_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <classes/taskcreator.hxx> +#include <services/frame.hxx> +#include <macros/generic.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/debug.hxx> +#include <threadhelp/threadhelpbase.hxx> +#include <classes/menumanager.hxx> +#include <general.h> +#include <stdtypes.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/util/URL.hpp> +#include <com/sun/star/frame/DispatchDescriptor.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/frame/XStatusListener.hpp> +#include <com/sun/star/frame/XFrameLoader.hpp> +#include <com/sun/star/frame/XLoadEventListener.hpp> +#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/frame/FeatureStateEvent.hpp> +#include <com/sun/star/frame/XFrameActionListener.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <cppuhelper/weak.hxx> +#include <cppuhelper/weakref.hxx> +#include <cppuhelper/interfacecontainer.h> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + + +//_________________________________________________________________________________________________________________ +// exported const +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// exported definitions +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + We must save informations about our listener and URL for listening. + We implement this as a hashtable for strings. +*//*-*************************************************************************************************************/ + +typedef ::cppu::OMultiTypeInterfaceContainerHelperVar< ::rtl::OUString , + OUStringHashCode , + std::equal_to< ::rtl::OUString > > IMPL_ListenerHashContainer; + + +/*-************************************************************************************************************//** + @short helper for desktop only(!) to create new tasks on demand for dispatches + @descr Use this class as member only! Never use it as baseclass. + XInterface will be ambigous and we hold a weakcss::uno::Reference to ouer OWNER - not to ouer SUPERCLASS! + + @implements XInterface + XDispatch + XLoadEventListener + XFrameActionListener + XEventListener + @base ThreadHelpBase + OWeakObject + + @devstatus ready to use +*//*-*************************************************************************************************************/ +class MenuDispatcher : // interfaces + public css::lang::XTypeProvider , + public css::frame::XDispatch , + public css::frame::XFrameActionListener , + // baseclasses + // Order is neccessary for right initialization! + public ThreadHelpBase , + public cppu::OWeakObject +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + + public: + + //--------------------------------------------------------------------------------------------------------- + // constructor / destructor + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short standard ctor + @descr These initialize a new instance of ths class with needed informations for work. + + @seealso using at owner + + @param "xFactory" , css::uno::Reference to servicemanager for creation of new services + @param "xOwner" , css::uno::Reference to our owner, the Desktop!!! + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + MenuDispatcher( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory , + const css::uno::Reference< css::frame::XFrame >& xOwner ); + + //--------------------------------------------------------------------------------------------------------- + // XInterface + //--------------------------------------------------------------------------------------------------------- + + FWK_DECLARE_XINTERFACE + FWK_DECLARE_XTYPEPROVIDER + + //--------------------------------------------------------------------------------------------------------- + // XDispatch + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short dispatch URL with arguments + @descr Every dispatch create a new task. If load of URL failed task will deleted automaticly! + + @seealso - + + @param "aURL" , URL to dispatch. + @param "seqArguments" , list of optional arguments. + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL dispatch( const css::util::URL& aURL , + const css::uno::Sequence< css::beans::PropertyValue >& seqProperties ) throw( css::uno::RuntimeException ); + + /*-****************************************************************************************************//** + @short add listener for state events + @descr You can add a listener to get information about status of dispatch: OK or Failed. + + @seealso method loadFinished() + @seealso method loadCancelled() + + @param "xControl" , css::uno::Reference to a valid listener for state events. + @param "aURL" , URL about listener will be informed, if something occured. + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL addStatusListener( const css::uno::Reference< css::frame::XStatusListener >& xControl, + const css::util::URL& aURL ) throw( css::uno::RuntimeException ); + + /*-****************************************************************************************************//** + @short remove listener for state events + @descr You can remove a listener if information of dispatch isn't important for you any longer. + + @seealso method loadFinished() + @seealso method loadCancelled() + + @param "xControl" , css::uno::Reference to a valid listener. + @param "aURL" , URL on which listener has registered. + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL removeStatusListener( const css::uno::Reference< css::frame::XStatusListener >& xControl, + const css::util::URL& aURL ) throw( css::uno::RuntimeException ); + + + //--------------------------------------------------------------------------------------------------------- + // XFrameActionListener + //--------------------------------------------------------------------------------------------------------- + + virtual void SAL_CALL frameAction( const css::frame::FrameActionEvent& aEvent ) throw ( css::uno::RuntimeException ); + + //--------------------------------------------------------------------------------------------------------- + // XEventListener + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short dispose current instance + @descr If service helper isn't required any longer call this method to release all used ressources. + + @seealso - + + @param "aEvent", information about source of this event. + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + void SAL_CALL disposing( const EVENTOBJECT& aEvent ) throw( css::uno::RuntimeException ); + + //------------------------------------------------------------------------------------------------------------- + // protected methods + //------------------------------------------------------------------------------------------------------------- + + protected: + + /*-****************************************************************************************************//** + @short standard destructor + @descr This method destruct an instance of this class and clear some member. + This method is protected, because its not allowed to use an instance of this class as a member! + You MUST use a pointer. + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual ~MenuDispatcher(); + + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + + private: + + DECL_LINK( Close_Impl, void* ); + + /*-****************************************************************************************************//** + @short - + @descr - + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + sal_Bool impl_setMenuBar( MenuBar* pMenuBar, sal_Bool bMenuFromResource = sal_False ); + + /*-****************************************************************************************************//** + @short - + @descr - + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + void impl_setAccelerators( Menu* pMenu, const Accelerator& aAccel ); + + //------------------------------------------------------------------------------------------------------------- + // 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 css::uno::References to checking variables + @return sal_False on invalid parameter<BR> + sal_True otherway + + @onerror - + *//*-*****************************************************************************************************/ + + #ifdef ENABLE_ASSERTIONS + + private: + + static sal_Bool impldbg_checkParameter_MenuDispatcher ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory , + const css::uno::Reference< css::frame::XFrame >& xOwner ); + static sal_Bool impldbg_checkParameter_addStatusListener ( const css::uno::Reference< css::frame::XStatusListener >& xControl , + const css::util::URL& aURL ); + static sal_Bool impldbg_checkParameter_removeStatusListener ( const css::uno::Reference< css::frame::XStatusListener >& xControl , + const css::util::URL& aURL ); + #endif // #ifdef ENABLE_ASSERTIONS + + //------------------------------------------------------------------------------------------------------------- + // variables + // (should be private everyway!) + //------------------------------------------------------------------------------------------------------------- + + private: + + css::uno::WeakReference< css::frame::XFrame > m_xOwnerWeak ; /// css::uno::WeakReference to owner (Don't use a hard css::uno::Reference. Owner can't delete us then!) + css::uno::Reference< css::lang::XMultiServiceFactory > m_xFactory ; /// factory shared with our owner to create new services! + IMPL_ListenerHashContainer m_aListenerContainer; /// hash table for listener at specified URLs + sal_Bool m_bAlreadyDisposed ; /// Protection against multiple disposing calls. + sal_Bool m_bActivateListener ; /// dispatcher is listener for frame activation + MenuManager* m_pMenuManager ; /// menu manager controlling menu dispatches + +}; // class MenuDispatcher + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_DISPATCH_MENUDISPATCHER_HXX_ diff --git a/framework/inc/dispatch/oxt_handler.hxx b/framework/inc/dispatch/oxt_handler.hxx new file mode 100644 index 000000000000..25bb1db58086 --- /dev/null +++ b/framework/inc/dispatch/oxt_handler.hxx @@ -0,0 +1,215 @@ +/************************************************************************* + * + * 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_HANDLER_OXT_HANDLER_HXX_ +#define __FRAMEWORK_HANDLER_OXT_HANDLER_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#ifndef __FRAMEWORK_THREADHELP_THREADHELPBASE_HXX_ +#include <threadhelp/threadhelpbase.hxx> +#endif + +#ifndef __FRAMEWORK_THREADHELP_RESETABLEGUARD_HXX_ +#include <threadhelp/resetableguard.hxx> +#endif + +#ifndef __FRAMEWORK_MACROS_XINTERFACE_HXX_ +#include <macros/xinterface.hxx> +#endif + +#ifndef __FRAMEWORK_MACROS_XTYPEPROVIDER_HXX_ +#include <macros/xtypeprovider.hxx> +#endif + +#ifndef __FRAMEWORK_MACROS_XSERVICEINFO_HXX_ +#include <macros/xserviceinfo.hxx> +#endif + +#ifndef __FRAMEWORK_MACROS_DEBUG_HXX_ +#include <macros/debug.hxx> +#endif + +#ifndef __FRAMEWORK_MACROS_GENERIC_HXX_ +#include <macros/generic.hxx> +#endif + +#ifndef __FRAMEWORK_GENERAL_H_ +#include <general.h> +#endif + +#ifndef __FRAMEWORK_STDTYPES_H_ +#include <stdtypes.h> +#endif + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ + +#ifndef _COM_SUN_STAR_LANG_XTYPEPROVIDER_HPP_ +#include <com/sun/star/lang/XTypeProvider.hpp> +#endif + +#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_ +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#endif + +#ifndef _COM_SUN_STAR_FRAME_XNOTIFYINGDISPATCH_HPP_ +#include <com/sun/star/frame/XNotifyingDispatch.hpp> +#endif + +#ifndef _COM_SUN_STAR_FRAME_XSTATUSLISTENER_HPP_ +#include <com/sun/star/frame/XStatusListener.hpp> +#endif + +#ifndef _COM_SUN_STAR_FRAME_XFRAME_HPP_ +#include <com/sun/star/frame/XFrame.hpp> +#endif + +#ifndef _COM_SUN_STAR_DOCUMENT_XEXTENDEDFILTERDETECTION_HPP_ +#include <com/sun/star/document/XExtendedFilterDetection.hpp> +#endif + +#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_ +#include <com/sun/star/beans/PropertyValue.hpp> +#endif + +#ifndef _COM_SUN_STAR_UTIL_URL_HPP_ +#include <com/sun/star/util/URL.hpp> +#endif + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ + +#ifndef _CPPUHELPER_WEAK_HXX_ +#include <cppuhelper/weak.hxx> +#endif + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ +// exported const +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// exported definitions +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short handler to detect and play sounds ("wav" and "au" only!) + @descr Register this implementation as a content handler to detect and/or play wav- and au-sounds. + It doesn't depend from the target platform. But one instance of this class + can play one sound at the same time only. Means every new dispatch request will stop the + might still running one. So we support one operation/one URL/one listener at the same time + only. + + @devstatus ready + @threadsafe yes +*//*-*************************************************************************************************************/ +class Oxt_Handler : // interfaces + public css::lang::XTypeProvider + , public css::lang::XServiceInfo + , public css::frame::XNotifyingDispatch // => XDispatch + , public css::document::XExtendedFilterDetection + // baseclasses + // Order is neccessary for right initialization! + , private ThreadHelpBase + , public ::cppu::OWeakObject +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + public: + + //--------------------------------------------------------------------------------------------------------- + // constructor / destructor + //--------------------------------------------------------------------------------------------------------- + Oxt_Handler( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory ); + virtual ~Oxt_Handler( ); + + //--------------------------------------------------------------------------------------------------------- + // XInterface, XTypeProvider, XServiceInfo + //--------------------------------------------------------------------------------------------------------- + FWK_DECLARE_XINTERFACE + FWK_DECLARE_XTYPEPROVIDER + DECLARE_XSERVICEINFO + + //--------------------------------------------------------------------------------------------------------- + // XNotifyingDispatch + //--------------------------------------------------------------------------------------------------------- + virtual void SAL_CALL dispatchWithNotification(const css::util::URL& aURL , + const css::uno::Sequence< css::beans::PropertyValue >& lArguments, + const css::uno::Reference< css::frame::XDispatchResultListener >& xListener ) throw( css::uno::RuntimeException ); + + //--------------------------------------------------------------------------------------------------------- + // XDispatch + //--------------------------------------------------------------------------------------------------------- + virtual void SAL_CALL dispatch ( const css::util::URL& aURL , + const css::uno::Sequence< css::beans::PropertyValue >& lArguments ) throw( css::uno::RuntimeException ); + // not supported ! + virtual void SAL_CALL addStatusListener ( const css::uno::Reference< css::frame::XStatusListener >& /*xListener*/ , + const css::util::URL& /*aURL*/ ) throw( css::uno::RuntimeException ) {}; + virtual void SAL_CALL removeStatusListener ( const css::uno::Reference< css::frame::XStatusListener >& /*xListener*/ , + const css::util::URL& /*aURL*/ ) throw( css::uno::RuntimeException ) {}; + + //--------------------------------------------------------------------------------------------------------- + // XExtendedFilterDetection + //--------------------------------------------------------------------------------------------------------- + virtual ::rtl::OUString SAL_CALL detect ( css::uno::Sequence< css::beans::PropertyValue >& lDescriptor ) throw( css::uno::RuntimeException ); + + //------------------------------------------------------------------------------------------------------------- + // protected methods + //------------------------------------------------------------------------------------------------------------- + protected: + + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + private: + + //------------------------------------------------------------------------------------------------------------- + // variables + // (should be private everyway!) + //------------------------------------------------------------------------------------------------------------- + private: + + css::uno::Reference< css::lang::XMultiServiceFactory > m_xFactory ; /// global uno service factory to create new services + css::uno::Reference< css::uno::XInterface > m_xSelfHold ; /// we must protect us against dieing during async(!) dispatch() call! + css::uno::Reference< css::frame::XDispatchResultListener > m_xListener ; + +}; // class Oxt_Handler + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_HANDLER_OXT_HANDLER_HXX_ diff --git a/framework/inc/dispatch/popupmenudispatcher.hxx b/framework/inc/dispatch/popupmenudispatcher.hxx new file mode 100644 index 000000000000..e8002834dff9 --- /dev/null +++ b/framework/inc/dispatch/popupmenudispatcher.hxx @@ -0,0 +1,199 @@ +/************************************************************************* + * + * 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_DISPATCH_POPUPMENUDISPATCHER_HXX_ +#define __FRAMEWORK_DISPATCH_POPUPMENUDISPATCHER_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <services/frame.hxx> +/* +#include <macros/generic.hxx> +*/ +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> +/* +#include <macros/debug.hxx> +*/ +#include <threadhelp/threadhelpbase.hxx> +#include <general.h> +#include <stdtypes.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/frame/XDispatchProvider.hpp> +#include <com/sun/star/util/URL.hpp> +#include <com/sun/star/frame/DispatchDescriptor.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/frame/XStatusListener.hpp> +#include <com/sun/star/frame/XFrameLoader.hpp> +#include <com/sun/star/frame/XLoadEventListener.hpp> +#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/frame/FeatureStateEvent.hpp> +#include <com/sun/star/frame/XFrameActionListener.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/container/XNameAccess.hpp> +#ifndef _COM_SUN_STAR_URI_XURLREFERENCEFACTORY_HPP_ +#include <com/sun/star/uri/XUriReferenceFactory.hpp> +#endif +#ifndef _COM_SUN_STAR_URI_XURLREFERENCE_HPP_ +#include <com/sun/star/uri/XUriReference.hpp> +#endif + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <cppuhelper/weak.hxx> +#include <cppuhelper/weakref.hxx> +#include <cppuhelper/interfacecontainer.h> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + + +//_________________________________________________________________________________________________________________ +// exported const +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// exported definitions +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + We must save informations about our listener and URL for listening. + We implement this as a hashtable for strings. +*//*-*************************************************************************************************************/ + +typedef ::cppu::OMultiTypeInterfaceContainerHelperVar< ::rtl::OUString , + OUStringHashCode , + std::equal_to< ::rtl::OUString > > IMPL_ListenerHashContainer; + + +/*-************************************************************************************************************//** + @short helper for desktop only(!) to create new tasks on demand for dispatches + @descr Use this class as member only! Never use it as baseclass. + XInterface will be ambigous and we hold a weakcss::uno::Reference to ouer OWNER - not to our SUPERCLASS! + + @implements XInterface + XDispatch + XLoadEventListener + XFrameActionListener + XEventListener + @base ThreadHelpBase + OWeakObject + + @devstatus ready to use +*//*-*************************************************************************************************************/ +class PopupMenuDispatcher : // interfaces + public css::lang::XTypeProvider , + public css::lang::XServiceInfo , + public css::frame::XDispatchProvider , + public css::frame::XDispatch , + public css::frame::XFrameActionListener , + public css::lang::XInitialization , + // baseclasses + // Order is neccessary for right initialization! + public ThreadHelpBase , + public cppu::OWeakObject +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + public: + + // constructor / destructor + PopupMenuDispatcher( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory ); + + // XInterface, XTypeProvider, XServiceInfo + FWK_DECLARE_XINTERFACE + FWK_DECLARE_XTYPEPROVIDER + DECLARE_XSERVICEINFO + + // XInitialization + virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& lArguments ) throw( css::uno::Exception , + css::uno::RuntimeException); + // XDispatchProvider + virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > SAL_CALL queryDispatch( + const ::com::sun::star::util::URL& aURL , + const ::rtl::OUString& sTarget , + sal_Int32 nFlags ) + throw( ::com::sun::star::uno::RuntimeException ); + + virtual css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL queryDispatches( + const css::uno::Sequence< css::frame::DispatchDescriptor >& lDescriptor ) + throw( css::uno::RuntimeException ); + + // XDispatch + virtual void SAL_CALL dispatch( const css::util::URL& aURL, + const css::uno::Sequence< css::beans::PropertyValue >& seqProperties ) throw( css::uno::RuntimeException ); + + virtual void SAL_CALL addStatusListener( const css::uno::Reference< css::frame::XStatusListener >& xControl, + const css::util::URL& aURL ) throw( css::uno::RuntimeException ); + + virtual void SAL_CALL removeStatusListener( const css::uno::Reference< css::frame::XStatusListener >& xControl, + const css::util::URL& aURL ) throw( css::uno::RuntimeException ); + + + // XFrameActionListener + virtual void SAL_CALL frameAction( const css::frame::FrameActionEvent& aEvent ) throw ( css::uno::RuntimeException ); + + // XEventListener + void SAL_CALL disposing( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException ); + + // protected methods + protected: + virtual ~PopupMenuDispatcher(); + + void impl_RetrievePopupControllerQuery(); + void impl_CreateUriRefFactory(); + + // private methods + + // variables + private: + css::uno::WeakReference< css::frame::XFrame > m_xWeakFrame ; /// css::uno::WeakReference to frame (Don't use a hard css::uno::Reference. Owner can't delete us then!) + css::uno::Reference< css::container::XNameAccess > m_xPopupCtrlQuery ; /// reference to query for popup controller + css::uno::Reference< css::uri::XUriReferenceFactory > m_xUriRefFactory ; /// reference to the uri reference factory + css::uno::Reference< css::lang::XMultiServiceFactory > m_xFactory ; /// factory shared with our owner to create new services! + IMPL_ListenerHashContainer m_aListenerContainer; /// hash table for listener at specified URLs + sal_Bool m_bAlreadyDisposed ; /// Protection against multiple disposing calls. + sal_Bool m_bActivateListener ; /// dispatcher is listener for frame activation + +}; // class PopupMenuDispatcher + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_DISPATCH_POPUPMENUDISPATCHER_HXX_ diff --git a/framework/inc/dispatch/selfdispatcher.hxx b/framework/inc/dispatch/selfdispatcher.hxx new file mode 100644 index 000000000000..1bbca4d20ed5 --- /dev/null +++ b/framework/inc/dispatch/selfdispatcher.hxx @@ -0,0 +1,112 @@ +/************************************************************************* + * + * 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_DISPATCH_SELFDISPATCHER_HXX_ +#define __FRAMEWORK_DISPATCH_SELFDISPATCHER_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <dispatch/basedispatcher.hxx> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ +// exported const +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// exported definitions +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short helper to dispatch into an existing owner frame + @descr You should use it as dispatcher for "_self", flag::SELF ... cases, to load a document into an + owner frame without creation of a new one. + Use this class as member only! Never use it as baseclass. + XInterface will be ambigous and we hold a weakreference to ouer OWNER - not to ouer SUPERCLASS! + + @implements XInterface + XDispatch + XStatusListener + XLoadEventListener + XEventListener + + @base BaseDispatcher + OWeakObject + + @devstatus ready to use + @threadsafe yes +*//*-*************************************************************************************************************/ +class SelfDispatcher : // -interfaces ... are supported by our BaseDispatcher! + // -baseclasses ... order is neccessary for right initialization! + public BaseDispatcher +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + public: + // ctor + SelfDispatcher ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory , + const css::uno::Reference< css::frame::XFrame >& xTarget ); + // XDispatch + virtual void SAL_CALL dispatch ( const css::util::URL& aURL , + const css::uno::Sequence< css::beans::PropertyValue >& lArguments ) throw( css::uno::RuntimeException ); + + //------------------------------------------------------------------------------------------------------------- + // protected methods + //------------------------------------------------------------------------------------------------------------- + protected: + virtual void SAL_CALL reactForLoadingState ( const css::util::URL& aURL , + const css::uno::Sequence< css::beans::PropertyValue >& lDescriptor , + const css::uno::Reference< css::frame::XFrame >& xTarget , + sal_Bool bState , + const css::uno::Any& aAsyncInfo ); + + virtual void SAL_CALL reactForHandlingState( const css::util::URL& aURL , + const css::uno::Sequence< css::beans::PropertyValue >& lDescriptor , + sal_Bool bState , + const css::uno::Any& aAsyncInfo ); + +}; // class SelfDispatcher + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_DISPATCH_SELFDISPATCHER_HXX_ diff --git a/framework/inc/dispatch/servicehandler.hxx b/framework/inc/dispatch/servicehandler.hxx new file mode 100644 index 000000000000..8b93b8734265 --- /dev/null +++ b/framework/inc/dispatch/servicehandler.hxx @@ -0,0 +1,149 @@ +/************************************************************************* + * + * 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_DISPATCH_SERVICEHANDLER_HXX_ +#define __FRAMEWORK_DISPATCH_SERVICEHANDLER_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <macros/generic.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> +#include <macros/debug.hxx> +#include <threadhelp/threadhelpbase.hxx> +#include <general.h> +#include <stdtypes.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/frame/XNotifyingDispatch.hpp> +#include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/frame/XDispatchProvider.hpp> +#include <com/sun/star/util/URL.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/frame/XStatusListener.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <cppuhelper/weak.hxx> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ +// exported const +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// exported definitions +//_________________________________________________________________________________________________________________ + +/** + @short protocol handler for "service:*" URLs + @descr It's a special dispatch/provider object which is registered for such URL pattern and will + be automaticly used by the framework dispatch mechanism if such URL occured. + His job is to create any registered uno components which must be coded inside + dispatched URL (may with some optional given parameters). After that such created + service must be hold his self alive. Such mechanism can be usefull for UI components + (e.g. Dialogs, Wizards) only. + + @base ThreadHelpBase + exports a lock member to guarantee right initialize value of it + @base OWeakObject + provides XWeak and ref count mechanism + + @devstatus ready to use + + @modified 02.05.2002 08:13, as96863 +*/ +class ServiceHandler : // interfaces + public css::lang::XTypeProvider , + public css::lang::XServiceInfo , + public css::frame::XDispatchProvider , + public css::frame::XNotifyingDispatch, // => XDispatch + // baseclasses + // Order is neccessary for right initialization! + private ThreadHelpBase , + public cppu::OWeakObject +{ + /* member */ + private: + + /// reference to global uno service manager which had created us + css::uno::Reference< css::lang::XMultiServiceFactory > m_xFactory; + + /* interface */ + public: + + // ctor/dtor + ServiceHandler( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory ); + virtual ~ServiceHandler( ); + + // XInterface, XTypeProvider, XServiceInfo + FWK_DECLARE_XINTERFACE + FWK_DECLARE_XTYPEPROVIDER + DECLARE_XSERVICEINFO + + // XDispatchProvider + virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL queryDispatch ( const css::util::URL& aURL , + const ::rtl::OUString& sTarget , + sal_Int32 nFlags ) throw( css::uno::RuntimeException ); + virtual css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL queryDispatches( const css::uno::Sequence< css::frame::DispatchDescriptor >& lDescriptor ) throw( css::uno::RuntimeException ); + + // XNotifyingDispatch + virtual void SAL_CALL dispatchWithNotification( const css::util::URL& aURL , + const css::uno::Sequence< css::beans::PropertyValue >& lArguments, + const css::uno::Reference< css::frame::XDispatchResultListener >& xListener ) throw( css::uno::RuntimeException ); + + // XDispatch + virtual void SAL_CALL dispatch ( const css::util::URL& aURL , + const css::uno::Sequence< css::beans::PropertyValue >& lArguments ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL addStatusListener ( const css::uno::Reference< css::frame::XStatusListener >& xListener , + const css::util::URL& aURL ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL removeStatusListener( const css::uno::Reference< css::frame::XStatusListener >& xListener , + const css::util::URL& aURL ) throw( css::uno::RuntimeException ); + + /* internal */ + private: + + css::uno::Reference< css::uno::XInterface > implts_dispatch( const css::util::URL& aURL , + const css::uno::Sequence< css::beans::PropertyValue >& lArguments ) throw( css::uno::RuntimeException ); + +}; // class ServiceHandler + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_DISPATCH_SERVICEHANDLER_HXX_ diff --git a/framework/inc/dispatch/startmoduledispatcher.hxx b/framework/inc/dispatch/startmoduledispatcher.hxx new file mode 100644 index 000000000000..e2ff8955a423 --- /dev/null +++ b/framework/inc/dispatch/startmoduledispatcher.hxx @@ -0,0 +1,197 @@ +/************************************************************************* + * + * 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_DISPATCH_STARTMODULEDISPATCHER_HXX_ +#define __FRAMEWORK_DISPATCH_STARTMODULEDISPATCHER_HXX_ + +//_______________________________________________ +// my own includes + +#include <threadhelp/threadhelpbase.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/debug.hxx> +#include <macros/generic.hxx> +#include <stdtypes.h> +#include <general.h> + +//_______________________________________________ +// interface includes +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/frame/XStatusListener.hpp> +#include <com/sun/star/frame/XNotifyingDispatch.hpp> +#include <com/sun/star/frame/XDispatchInformationProvider.hpp> +#include <com/sun/star/util/URL.hpp> +#include <com/sun/star/frame/XDispatchResultListener.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/frame/DispatchResultState.hpp> + +//_______________________________________________ +// other includes +#include <cppuhelper/weak.hxx> +#include <vcl/evntpost.hxx> + +//_______________________________________________ +// namespace + +namespace framework{ + +//----------------------------------------------- +/** + @short helper to handle all URLs related to the StartModule + */ +class StartModuleDispatcher : public css::lang::XTypeProvider + , public css::frame::XNotifyingDispatch // => XDispatch + , public css::frame::XDispatchInformationProvider + // baseclasses ... order is neccessary for right initialization! + , private ThreadHelpBase + , public ::cppu::OWeakObject +{ + //------------------------------------------- + // member + + private: + + //--------------------------------------- + /** @short reference to an uno service manager, + which can be used to create own needed + uno resources. */ + css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR; + + //--------------------------------------- + /** @short our "context" frame. */ + css::uno::WeakReference< css::frame::XFrame > m_xOwner; + + //--------------------------------------- + /** @short the original queryDispatch() target. */ + ::rtl::OUString m_sDispatchTarget; + + //--------------------------------------- + /** @short list of registered status listener */ + ListenerHash m_lStatusListener; + + //------------------------------------------- + // native interface + + public: + + //--------------------------------------- + /** @short connect a new StartModuleDispatcher instance to its "owner frame". + + @descr Such "owner frame" is used as context for all related operations. + + @param xSMGR + an uno service manager, which is needed to create uno resource + internaly. + + @param xFrame + the frame where the corresponding dispatch was started. + + @param sTarget + the original target information used for the related queryDispatch() call. + */ + StartModuleDispatcher(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR , + const css::uno::Reference< css::frame::XFrame >& xFrame , + const ::rtl::OUString& sTarget); + + //--------------------------------------- + /** @short does nothing real. */ + virtual ~StartModuleDispatcher(); + + //------------------------------------------- + // uno interface + + public: + + //--------------------------------------- + FWK_DECLARE_XINTERFACE + FWK_DECLARE_XTYPEPROVIDER + + //--------------------------------------- + // XNotifyingDispatch + virtual void SAL_CALL dispatchWithNotification( const css::util::URL& aURL , + const css::uno::Sequence< css::beans::PropertyValue >& lArguments, + const css::uno::Reference< css::frame::XDispatchResultListener >& xListener ) throw(css::uno::RuntimeException); + + //--------------------------------------- + // XDispatch + virtual void SAL_CALL dispatch ( const css::util::URL& aURL , + const css::uno::Sequence< css::beans::PropertyValue >& lArguments) throw(css::uno::RuntimeException); + virtual void SAL_CALL addStatusListener ( const css::uno::Reference< css::frame::XStatusListener >& xListener , + const css::util::URL& aURL ) throw(css::uno::RuntimeException); + virtual void SAL_CALL removeStatusListener( const css::uno::Reference< css::frame::XStatusListener >& xListener , + const css::util::URL& aURL ) throw(css::uno::RuntimeException); + + //--------------------------------------- + // XDispatchInformationProvider + virtual css::uno::Sequence< sal_Int16 > SAL_CALL getSupportedCommandGroups ( ) throw (css::uno::RuntimeException); + virtual css::uno::Sequence< css::frame::DispatchInformation > SAL_CALL getConfigurableDispatchInformation( sal_Int16 nCommandGroup ) throw (css::uno::RuntimeException); + + //------------------------------------------- + // internal helper + + private: + + //--------------------------------------- + /** @short check if StartModule can be shown. + */ + ::sal_Bool implts_isBackingModePossible(); + + //--------------------------------------- + /** @short open the special BackingComponent (now StartModule) + + @return [bool] + sal_True if operation was successfully. + */ + ::sal_Bool implts_establishBackingMode(); + + //--------------------------------------- + /** @short notify a DispatchResultListener. + + @descr We check the listener reference before we use it. + So this method can be called everytimes! + + @parama xListener + the listener, which should be notified. + Can be null! + + @param nState + directly used as css::frame::DispatchResultState value. + + @param aResult + not used yet realy ... + */ + void implts_notifyResultListener(const css::uno::Reference< css::frame::XDispatchResultListener >& xListener, + sal_Int16 nState , + const css::uno::Any& aResult ); + +}; // class StartModuleDispatcher + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_DISPATCH_STARTMODULEDISPATCHER_HXX_ diff --git a/framework/inc/dispatch/systemexec.hxx b/framework/inc/dispatch/systemexec.hxx new file mode 100644 index 000000000000..b191ab3e31c5 --- /dev/null +++ b/framework/inc/dispatch/systemexec.hxx @@ -0,0 +1,145 @@ +/************************************************************************* + * + * 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_DISPATCH_SYSTEMEXEC_HXX_ +#define __FRAMEWORK_DISPATCH_SYSTEMEXEC_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <macros/generic.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> +#include <macros/debug.hxx> +#include <threadhelp/threadhelpbase.hxx> +#include <general.h> +#include <stdtypes.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/frame/XNotifyingDispatch.hpp> +#include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/frame/XDispatchProvider.hpp> +#include <com/sun/star/util/URL.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/frame/XStatusListener.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <cppuhelper/weak.hxx> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ +// exported const +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// exported definitions +//_________________________________________________________________________________________________________________ + +/** + @short protocol handler for "systemexec:*" URLs + @descr It's a special dispatch/provider object which is registered for such URL pattern and will + be automaticly used by the framework dispatch mechanism if such URL occured. + It forwards all URL's to the underlying operating system. + So it would e.g. be possible to open HTML files outside the office within a web browser. + + @base ThreadHelpBase + exports a lock member to guarantee right initialize value of it + @base OWeakObject + provides XWeak and ref count mechanism + + @devstatus ready to use +*/ +class SystemExec : // interfaces + public css::lang::XTypeProvider , + public css::lang::XServiceInfo , + public css::frame::XDispatchProvider , + public css::frame::XNotifyingDispatch, // => XDispatch + // baseclasses + // Order is neccessary for right initialization! + private ThreadHelpBase , + public cppu::OWeakObject +{ + /* member */ + private: + + /// reference to global uno service manager which had created us + css::uno::Reference< css::lang::XMultiServiceFactory > m_xFactory; + + /* interface */ + public: + + // ctor/dtor + SystemExec( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory ); + virtual ~SystemExec( ); + + // XInterface, XTypeProvider, XServiceInfo + FWK_DECLARE_XINTERFACE + FWK_DECLARE_XTYPEPROVIDER + DECLARE_XSERVICEINFO + + // XDispatchProvider + virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL queryDispatch ( const css::util::URL& aURL , + const ::rtl::OUString& sTarget , + sal_Int32 nFlags ) throw( css::uno::RuntimeException ); + virtual css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL queryDispatches( const css::uno::Sequence< css::frame::DispatchDescriptor >& lDescriptor ) throw( css::uno::RuntimeException ); + + // XNotifyingDispatch + virtual void SAL_CALL dispatchWithNotification( const css::util::URL& aURL , + const css::uno::Sequence< css::beans::PropertyValue >& lArguments, + const css::uno::Reference< css::frame::XDispatchResultListener >& xListener ) throw( css::uno::RuntimeException ); + + // XDispatch + virtual void SAL_CALL dispatch ( const css::util::URL& aURL , + const css::uno::Sequence< css::beans::PropertyValue >& lArguments ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL addStatusListener ( const css::uno::Reference< css::frame::XStatusListener >& xListener , + const css::util::URL& aURL ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL removeStatusListener( const css::uno::Reference< css::frame::XStatusListener >& xListener , + const css::util::URL& aURL ) throw( css::uno::RuntimeException ); + + /* internal */ + private: + + void impl_notifyResultListener(const css::uno::Reference< css::frame::XDispatchResultListener >& xListener, + const sal_Int16 nState ); + +}; // class SystemExec + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_DISPATCH_SYSTEMEXEC_HXX_ diff --git a/framework/inc/dispatchcommands.h b/framework/inc/dispatchcommands.h new file mode 100644 index 000000000000..97284a7b264b --- /dev/null +++ b/framework/inc/dispatchcommands.h @@ -0,0 +1,52 @@ +/************************************************************************* + * + * 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_DISPATCHCOMMANDS_H_ +#define __FRAMEWORK_DISPATCHCOMMANDS_H_ + +//_________________________________________________________________________________________________________________ +// includes +//_________________________________________________________________________________________________________________ + +#include <macros/generic.hxx> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ + +static ::rtl::OUString CMD_UNO_SHOWSTARTMODULE = ::rtl::OUString::createFromAscii(".uno:ShowStartModule"); +static ::rtl::OUString CMD_UNO_CLOSEDOC = ::rtl::OUString::createFromAscii(".uno:CloseDoc" ); +static ::rtl::OUString CMD_UNO_CLOSEWIN = ::rtl::OUString::createFromAscii(".uno:CloseWin" ); +static ::rtl::OUString CMD_UNO_CLOSEFRAME = ::rtl::OUString::createFromAscii(".uno:CloseFrame" ); + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_DISPATCHCOMMANDS_H_ diff --git a/framework/inc/framework.hrc b/framework/inc/framework.hrc new file mode 100644 index 000000000000..1817b60d90e9 --- /dev/null +++ b/framework/inc/framework.hrc @@ -0,0 +1,85 @@ +/************************************************************************* + * + * 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_HRC +#define _FRAMEWORK_HRC + +#include "svl/solar.hrc" + +#define RID_FWK_START 260 + +#define RID_GROUPS_OFFSET 32000 +#define RID_GROUPS_END 32767 + +#define RID_FWK_DIALOG_START_CORRECT (RID_FWK_START + 2048) + +#define DLG_FILTER_SELECT (RID_FWK_DIALOG_START_CORRECT + 0) + +#define STR_FILTER_DOWNLOAD (RID_FWK_START+0) +#define STR_FILTER_CHOOSER (RID_FWK_START+1) +#define STR_FILTER_OTHERS (RID_FWK_START+2) +#define STR_FILTER_ZIPPED (RID_FWK_START+3) + +// ResIds for BackingWindow +#define DLG_BACKING (RID_FWK_DIALOG_START_CORRECT+100) +#define STR_BACKING_WELCOME 1 +#define STR_BACKING_WELCOMEPRODUCT 2 +#define STR_BACKING_CREATE 3 +#define STR_BACKING_TEMPLATE 4 +#define STR_BACKING_FILE 5 +#define STR_BACKING_EXTHELP 6 +#define STR_BACKING_REGHELP 7 +#define STR_BACKING_INFOHELP 8 +#define STR_BACKING_TPLREP 9 + +#define RES_BACKING_IMAGES (DLG_BACKING+1) +#define RES_BACKING_IMAGES_HC (DLG_BACKING+2) + +#define BMP_BACKING_BACKGROUND_LEFT 1 +#define BMP_BACKING_BACKGROUND_MIDDLE 2 +#define BMP_BACKING_BACKGROUND_RIGHT 3 +#define BMP_BACKING_BACKGROUND_RTL_LEFT 4 +#define BMP_BACKING_BACKGROUND_RTL_RIGHT 5 +#define BMP_BACKING_EXT 6 +#define BMP_BACKING_REG 7 +#define BMP_BACKING_INFO 8 +#define BMP_BACKING_TPLREP 9 +#define BMP_BACKING_WRITER 10 +#define BMP_BACKING_CALC 11 +#define BMP_BACKING_IMPRESS 12 +#define BMP_BACKING_DRAW 13 +#define BMP_BACKING_DATABASE 14 +#define BMP_BACKING_FORMULA 15 +#define BMP_BACKING_OPENFILE 16 +#define BMP_BACKING_OPENTEMPLATE 17 + +// Ids of TabWindow +#define WIN_TABWINDOW (RID_FWK_DIALOG_START_CORRECT+101) +#define TC_TABCONTROL 1 + +#endif + diff --git a/framework/inc/framework/acceleratorinfo.hxx b/framework/inc/framework/acceleratorinfo.hxx new file mode 100644 index 000000000000..6b0519ceed98 --- /dev/null +++ b/framework/inc/framework/acceleratorinfo.hxx @@ -0,0 +1,50 @@ +/************************************************************************* + * + * 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_HELPER_ACCELERATORINFO_HXX_ +#define __FRAMEWORK_HELPER_ACCELERATORINFO_HXX_ + +#include <com/sun/star/frame/XFrame.hpp> +#include <vcl/keycod.hxx> +#include <rtl/ustring.hxx> +#include <framework/fwedllapi.h> + +namespace framework +{ + +typedef ::rtl::OUString ( *pfunc_getCommandURLFromKeyCode)( const KeyCode& ); +typedef KeyCode ( *pfunc_getKeyCodeFromCommandURL )( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, const ::rtl::OUString& aURL ); + +pfunc_getCommandURLFromKeyCode SAL_CALL SetCommandURLFromKeyCode( pfunc_getCommandURLFromKeyCode ); +pfunc_getKeyCodeFromCommandURL SAL_CALL SetKeyCodeFromCommandURL( pfunc_getKeyCodeFromCommandURL ); + +::rtl::OUString SAL_CALL GetCommandURLFromKeyCode( const KeyCode& aKeyCode ); +KeyCode GetKeyCodeFromCommandURL( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, const rtl::OUString& aCommandURL ); + +} + +#endif // __FRAMEWORK_HELPER_ACCELERATORINFO_HXX_ diff --git a/framework/inc/framework/actiontriggerhelper.hxx b/framework/inc/framework/actiontriggerhelper.hxx new file mode 100644 index 000000000000..67c4115a3621 --- /dev/null +++ b/framework/inc/framework/actiontriggerhelper.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_HELPER_ACTIONTRIGGERHELPER_HXX_ +#define __FRAMEWORK_HELPER_ACTIONTRIGGERHELPER_HXX_ + +#include <com/sun/star/container/XIndexContainer.hpp> + +// #110897# +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <vcl/menu.hxx> +#include <framework/fwedllapi.h> + + +namespace framework +{ + class FWE_DLLPUBLIC ActionTriggerHelper + { + public: + // Fills the submitted menu with the structure contained in the second + // parameter rActionTriggerContainer + // @param pNewMenu = must be a valid and empty menu + // @param rActionTriggerContainer = must be an instance of service "com.sun.star.ui.ActionTriggerContaienr" + static void + CreateMenuFromActionTriggerContainer( + Menu* pNewMenu, + const com::sun::star::uno::Reference< com::sun::star::container::XIndexContainer >& rActionTriggerContainer ); + + // Creates a "com::sun::star::ui::ActionTriggerContainer" with the structure of the menu + // provided as a parameter. The implementation class stores the menu pointer + // to optimize the time of creation of a menu from a actiontrigger structure. + // IMPORTANT: The caller must ensure that the menu pointer is valid through the + // life time of the XIndexContainer object!!! + // + // @param pNewMenu = Must be a valid menu. Please be aware that this implementation is based on + // the above mentioned restriction!!! + + // #110897# + static com::sun::star::uno::Reference< com::sun::star::container::XIndexContainer > CreateActionTriggerContainerFromMenu( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, + const Menu* pMenu, const ::rtl::OUString* pMenuIdentifier ); + + // Fills the submitted rActionTriggerContainer with the structure of the menu + // provided as the second parameter + // @param rActionTriggerContainer = must be an instance of service "com.sun.star.ui.ActionTriggerContainer" + // @param pNewMenu = must be a valid menu + static void + FillActionTriggerContainerFromMenu( + com::sun::star::uno::Reference< com::sun::star::container::XIndexContainer >& rActionTriggerContainer, + const Menu* pMenu ); + + }; +} + +#endif // __FRAMEWORK_HELPER_ACTIONTRIGGERHELPER_HXX_ diff --git a/framework/inc/framework/addonmenu.hxx b/framework/inc/framework/addonmenu.hxx new file mode 100644 index 000000000000..da3c9bb8740b --- /dev/null +++ b/framework/inc/framework/addonmenu.hxx @@ -0,0 +1,141 @@ +/************************************************************************* + * + * 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_ADDONMENU_HXX_ +#define __FRAMEWORK_CLASSES_ADDONMENU_HXX_ + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ + +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/uno/Sequence.hxx> + +//_________________________________________________________________________________________________________________ +// includes of other projects +//_________________________________________________________________________________________________________________ + +#include <vcl/menu.hxx> +#include <framework/fwedllapi.h> + +#define ADDONMENU_ITEMID_START 2000 +#define ADDONMENU_ITEMID_END 3000 + +namespace framework +{ + +class FWE_DLLPUBLIC AddonMenu : public PopupMenu +{ + public: + AddonMenu( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame ); + ~AddonMenu(); + + protected: + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xFrame; +}; + +class AddonMenuManager; +class FWE_DLLPUBLIC AddonPopupMenu : public AddonMenu +{ + public: + ~AddonPopupMenu(); + + // Check if command URL string has the unique prefix to identify addon popup menus + static sal_Bool IsCommandURLPrefix( const rtl::OUString& aCmdURL ); + + void SetCommandURL( const rtl::OUString& aCmdURL ) { m_aCommandURL = aCmdURL; } + const rtl::OUString& GetCommandURL() const { return m_aCommandURL; } + + protected: + void Initialize( const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& rAddonPopupMenuDefinition ); + + private: + AddonPopupMenu( const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame ); + + rtl::OUString m_aCommandURL; + + friend class AddonMenuManager; +}; + +class FWE_DLLPUBLIC AddonMenuManager +{ + public: + enum MenuType + { + ADDON_MENU, + ADDON_POPUPMENU + }; + + static sal_Bool HasAddonMenuElements(); + static sal_Bool HasAddonHelpMenuElements(); + + static sal_Bool IsAddonMenuId( sal_uInt16 nId ) { return (( nId >= ADDONMENU_ITEMID_START ) && ( nId < ADDONMENU_ITEMID_END )); } + + // Check if the context string matches the provided xModel context + static sal_Bool IsCorrectContext( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rModel, const rtl::OUString& aContext ); + + // Factory method to create different Add-On menu types + static PopupMenu* CreatePopupMenuType( MenuType eMenuType, const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame ); + + // Create the Add-Ons menu + static AddonMenu* CreateAddonMenu( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame ); + + // Merge the Add-Ons help menu items into the given menu bar at a defined pos + static void MergeAddonHelpMenu( const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame, + MenuBar* pMergeMenuBar ); + + // Merge the addon popup menus into the given menu bar at the provided pos. + static void MergeAddonPopupMenus( const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame, + const com::sun::star::uno::Reference< com::sun::star::frame::XModel >& rModel, + sal_uInt16 nMergeAtPos, + MenuBar* pMergeMenuBar ); + + // Returns the next position to insert a menu item/sub menu + static sal_uInt16 GetNextPos( sal_uInt16 nPos ); + + // Build up the menu item and sub menu into the provided pCurrentMenu. The sub menus should be of type nSubMenuType. + static void BuildMenu( PopupMenu* pCurrentMenu, + MenuType nSubMenuType, + sal_uInt16 nInsPos, + sal_uInt16& nUniqueMenuId, + com::sun::star::uno::Sequence< com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > > aAddonMenuDefinition, + const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame, + const com::sun::star::uno::Reference< com::sun::star::frame::XModel >& rModel ); + + // Retrieve the menu entry property values from a sequence + static void GetMenuEntry( const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& rAddonMenuEntry, + ::rtl::OUString& rTitle, + ::rtl::OUString& rURL, + ::rtl::OUString& rTarget, + ::rtl::OUString& rImageId, + ::rtl::OUString& rContext, + com::sun::star::uno::Sequence< com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > >& rAddonSubMenu ); +}; + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_CLASSES_ADDONMENU_HXX_ diff --git a/framework/inc/framework/addonsoptions.hxx b/framework/inc/framework/addonsoptions.hxx new file mode 100644 index 000000000000..6e41fcbafdd1 --- /dev/null +++ b/framework/inc/framework/addonsoptions.hxx @@ -0,0 +1,374 @@ +/************************************************************************* + * + * 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_ADDONSOPTIONS_HXX_ +#define __FRAMEWORK_CLASSES_ADDONSOPTIONS_HXX_ + +//_________________________________________________________________________________________________________________ +// includes +//_________________________________________________________________________________________________________________ + +#include <sal/types.h> +#include <osl/mutex.hxx> +#include <vcl/image.hxx> +#include <vcl/bitmap.hxx> +#include <vcl/svapp.hxx> +#include <com/sun/star/uno/Sequence.h> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <framework/fwedllapi.h> +//_________________________________________________________________________________________________________________ +// types, enums, ... +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @descr The method GetAddonsMenu() returns a list of property values. + Use follow defines to seperate values by names. +*//*-*************************************************************************************************************/ +#define ADDONSMENUITEM_STRING_URL "URL" +#define ADDONSMENUITEM_STRING_TITLE "Title" +#define ADDONSMENUITEM_STRING_TARGET "Target" +#define ADDONSMENUITEM_STRING_IMAGEIDENTIFIER "ImageIdentifier" +#define ADDONSMENUITEM_STRING_CONTEXT "Context" +#define ADDONSMENUITEM_STRING_SUBMENU "Submenu" +#define ADDONSMENUITEM_STRING_CONTROLTYPE "ControlType" +#define ADDONSMENUITEM_STRING_WIDTH "Width" + +#define ADDONSMENUITEM_URL_LEN 3 +#define ADDONSMENUITEM_TITLE_LEN 5 +#define ADDONSMENUITEM_TARGET_LEN 6 +#define ADDONSMENUITEM_SUBMENU_LEN 7 +#define ADDONSMENUITEM_CONTEXT_LEN 7 +#define ADDONSMENUITEM_IMAGEIDENTIFIER_LEN 15 + +#define ADDONSMENUITEM_PROPERTYNAME_URL ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(ADDONSMENUITEM_STRING_URL )) +#define ADDONSMENUITEM_PROPERTYNAME_TITLE ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(ADDONSMENUITEM_STRING_TITLE )) +#define ADDONSMENUITEM_PROPERTYNAME_TARGET ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(ADDONSMENUITEM_STRING_TARGET )) +#define ADDONSMENUITEM_PROPERTYNAME_IMAGEIDENTIFIER ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(ADDONSMENUITEM_STRING_IMAGEIDENTIFIER )) +#define ADDONSMENUITEM_PROPERTYNAME_CONTEXT ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(ADDONSMENUITEM_STRING_CONTEXT )) +#define ADDONSMENUITEM_PROPERTYNAME_SUBMENU ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(ADDONSMENUITEM_STRING_SUBMENU )) +#define ADDONSMENUITEM_PROPERTYNAME_CONTROLTYPE ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(ADDONSMENUITEM_STRING_CONTROLTYPE )) +#define ADDONSMENUITEM_PROPERTYNAME_WIDTH ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(ADDONSMENUITEM_STRING_WIDTH )) + +#define ADDONSPOPUPMENU_URL_PREFIX_STR "private:menu/Addon" + +#define ADDONSPOPUPMENU_URL_PREFIX ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ADDONSPOPUPMENU_URL_PREFIX_STR )) + +namespace framework +{ + +typedef ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > > MergeMenuDefinition; + +struct FWE_DLLPUBLIC MergeMenuInstruction +{ + ::rtl::OUString aMergePoint; + ::rtl::OUString aMergeCommand; + ::rtl::OUString aMergeCommandParameter; + ::rtl::OUString aMergeFallback; + ::rtl::OUString aMergeContext; + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > > aMergeMenu; +}; +typedef ::std::vector< MergeMenuInstruction > MergeMenuInstructionContainer; + +struct FWE_DLLPUBLIC MergeToolbarInstruction +{ + ::rtl::OUString aMergeToolbar; + ::rtl::OUString aMergePoint; + ::rtl::OUString aMergeCommand; + ::rtl::OUString aMergeCommandParameter; + ::rtl::OUString aMergeFallback; + ::rtl::OUString aMergeContext; + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > > aMergeToolbarItems; +}; + +typedef ::std::vector< MergeToolbarInstruction > MergeToolbarInstructionContainer; + +//_________________________________________________________________________________________________________________ +// forward declarations +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short forward declaration to our private date container implementation + @descr We use these class as internal member to support small memory requirements. + You can create the container if it is neccessary. The class which use these mechanism + is faster and smaller then a complete implementation! +*//*-*************************************************************************************************************/ + +class AddonsOptions_Impl; + +//_________________________________________________________________________________________________________________ +// declarations +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short collect informations about menu features + @descr - + + @implements - + @base - + + @devstatus ready to use +*//*-*************************************************************************************************************/ + +class FWE_DLLPUBLIC AddonsOptions +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + + public: + //--------------------------------------------------------------------------------------------------------- + // constructor / destructor + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short standard constructor and destructor + @descr This will initialize an instance with default values. + We implement these class with a refcount mechanism! Every instance of this class increase it + at create and decrease it at delete time - but all instances use the same data container! + He is implemented as a static member ... + + @seealso member m_nRefCount + @seealso member m_pDataContainer + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + AddonsOptions(); + ~AddonsOptions(); + + //--------------------------------------------------------------------------------------------------------- + // interface + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short clears completely the addons menu + @descr Call this methods to clear the addons menu + To fill it again use AppendItem(). + + @seealso - + + @param "eMenu" select right menu to clear. + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + void Clear(); + + /*-****************************************************************************************************//** + @short returns if an addons menu is available + @descr Call to retrieve if a addons menu is available + + + @return sal_True if there is a menu otherwise sal_False + *//*-*****************************************************************************************************/ + + sal_Bool HasAddonsMenu() const; + + /*-****************************************************************************************************//** + @short returns if an addons help menu is available + @descr Call to retrieve if a addons menu is available + + + @return sal_True if there is a menu otherwise sal_False + *//*-*****************************************************************************************************/ + + sal_Bool HasAddonsHelpMenu() const; + + /*-****************************************************************************************************//** + @short returns number of addons toolbars + @descr Call to retrieve the number of addons toolbars + + + @return number of addons toolbars + *//*-*****************************************************************************************************/ + sal_Int32 GetAddonsToolBarCount() const ; + + /*-****************************************************************************************************//** + @short returns the complete addons menu + @descr Call it to get all entries of the addon menu. + We return a list of all nodes with his names and properties. + + @seealso - + + @return A list of menu items is returned. + + @onerror We return an empty list. + *//*-*****************************************************************************************************/ + + const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > >& GetAddonsMenu() const; + + /*-****************************************************************************************************//** + @short Gets the menu bar part of all addon components registered + @descr - + + @seealso - + + @return A complete + + @onerror We return sal_False + *//*-*****************************************************************************************************/ + + const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > >& GetAddonsMenuBarPart() const; + + /*-****************************************************************************************************//** + @short Gets a toolbar part of an single addon + @descr - + + @seealso - + + @return A complete + + @onerror We return sal_False + *//*-*****************************************************************************************************/ + + const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > >& GetAddonsToolBarPart( sal_uInt32 nIndex ) const; + + /*-****************************************************************************************************//** + @short Gets a unique toolbar resource name of an single addon + @descr - + + @seealso - + + @return A complete + + @onerror We return sal_False + *//*-*****************************************************************************************************/ + + const ::rtl::OUString GetAddonsToolbarResourceName( sal_uInt32 nIndex ) const; + + /*-****************************************************************************************************//** + @short Retrieves all available merge instructions for the Office menu bar + @descr - + + @seealso - + + @return The filled MergeMenuDefinitionContaier + + @onerror We return sal_False + *//*-*****************************************************************************************************/ + + const MergeMenuInstructionContainer& GetMergeMenuInstructions() const; + + /*-****************************************************************************************************//** + @short Retrieves all available merge instructions for a single toolbar + @descr - + + @seealso - + + @return The filled + + @onerror We return sal_False + *//*-*****************************************************************************************************/ + bool GetMergeToolbarInstructions( const ::rtl::OUString& rToolbarName, MergeToolbarInstructionContainer& rToolbar ) const; + + /*-****************************************************************************************************//** + @short Gets the Add-On help menu part of all addon components registered + @descr - + + @seealso - + + @return A complete + + @onerror We return sal_False + *//*-*****************************************************************************************************/ + const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > >& GetAddonsHelpMenu() const; + + /*-****************************************************************************************************//** + @short Retrieve an image for a command URL which is defined inside the addon menu configuration + @descr Call it to retrieve an image for a command URL which is defined inside the addon menu configuration + + @seealso - + + @return An image which was defined in the configuration for the menu item. The image can be empty + no bitmap was defined for the request image properties. + + @onerror An empty image + *//*-*****************************************************************************************************/ + + Image GetImageFromURL( const rtl::OUString& aURL, sal_Bool bBig, sal_Bool bHiContrast, sal_Bool bNoScale ) const; + + Image GetImageFromURL( const rtl::OUString& aURL, sal_Bool bBig, sal_Bool bHiContrast ) const; + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short return a reference to a static mutex + @descr These class is partially threadsafe (for de-/initialization only). + All access methods are'nt safe! + We create a static mutex only for one ime and use at different times. + + @seealso - + + @param - + @return A reference to a static mutex member. + + @onerror - + *//*-*****************************************************************************************************/ + + static ::osl::Mutex& GetOwnStaticMutex(); + + /*-****************************************************************************************************//** + @short return a reference to a static mutex + @descr These class is partially threadsafe (for de-/initialization only). + All access methods are'nt safe! + We create a static mutex only for one ime and use at different times. + + @seealso - + + @param - + @return A reference to a static mutex member. + + @onerror - + *//*-*****************************************************************************************************/ + DECL_STATIC_LINK( AddonsOptions, Notify, void* ); + + //------------------------------------------------------------------------------------------------------------- + // private member + //------------------------------------------------------------------------------------------------------------- + + private: + + /*Attention + + Don't initialize these static member in these header! + a) Double dfined symbols will be detected ... + b) and unresolved externals exist at linking time. + Do it in your source only. + */ + + static AddonsOptions_Impl* m_pDataContainer ; /// impl. data container as dynamic pointer for smaller memory requirements! + static sal_Int32 m_nRefCount ; /// internal ref count mechanism + +}; // class SvtMenuOptions + +} + +#endif // #ifndef __FRAMEWORK_CLASSES_ADDONSOPTIONS_HXX_ diff --git a/framework/inc/framework/bmkmenu.hxx b/framework/inc/framework/bmkmenu.hxx new file mode 100644 index 000000000000..0ee25dea1ab2 --- /dev/null +++ b/framework/inc/framework/bmkmenu.hxx @@ -0,0 +1,81 @@ +/************************************************************************* + * + * 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_BMKMENU_HXX +#define __FRAMEWORK_CLASSES_BMKMENU_HXX + +#include "framework/addonmenu.hxx" +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ + +#include <com/sun/star/frame/XFrame.hpp> +#include <framework/fwedllapi.h> +//_________________________________________________________________________________________________________________ +// includes of other projects +//_________________________________________________________________________________________________________________ + +#include <vcl/menu.hxx> +#include <vcl/image.hxx> + +class String; +class ImageList; + +#define BMKMENU_ITEMID_START 20000 + +namespace framework +{ + +class BmkMenu_Impl; +class FWE_DLLPUBLIC BmkMenu : public AddonMenu +{ + public: + enum BmkMenuType + { + BMK_NEWMENU, + BMK_WIZARDMENU + }; + + BmkMenu( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, + BmkMenuType nType ); + ~BmkMenu(); + + void Initialize(); // Synchrones Laden der Eintraege + + protected: + BmkMenu::BmkMenuType m_nType; + sal_uInt16 CreateMenuId(); + + private: + BmkMenu( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, + BmkMenuType, BmkMenu* pRoot ); + + BmkMenu_Impl* _pImp; +}; + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_CLASSES_BMKMENU_HXX diff --git a/framework/inc/framework/configimporter.hxx b/framework/inc/framework/configimporter.hxx new file mode 100644 index 000000000000..6038f7bdd325 --- /dev/null +++ b/framework/inc/framework/configimporter.hxx @@ -0,0 +1,53 @@ +/************************************************************************* + * + * 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_HELPER_CONFIGIMPORTER_HXX_ +#define __FRAMEWORK_HELPER_CONFIGIMPORTER_HXX_ + +#include <com/sun/star/container/XIndexContainer.hpp> +#include <com/sun/star/embed/XStorage.hpp> +#include <com/sun/star/ui/XUIConfigurationManager.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> + +#include <rtl/ustring.hxx> +#include <framework/fwedllapi.h> + +namespace framework +{ + class FWE_DLLPUBLIC UIConfigurationImporterOOo1x + { + public: + static sal_Bool ImportCustomToolbars( + const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIConfigurationManager >& rContainerFactory, + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer > >& rSeqContainer, + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rServiceManager, + const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& rToolbarStorage ); + }; + +} // namespace framework + +#endif // __FRAMEWORK_HELPER_CONFIGIMPORTER_HXX_ diff --git a/framework/inc/framework/documentundoguard.hxx b/framework/inc/framework/documentundoguard.hxx new file mode 100755 index 000000000000..da2976e895e1 --- /dev/null +++ b/framework/inc/framework/documentundoguard.hxx @@ -0,0 +1,70 @@ +/************************************************************************* + * 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_DOCUMENTUNDOGUARD_HXX +#define FRAMEWORK_DOCUMENTUNDOGUARD_HXX + +#include "framework/fwedllapi.h" + +/** === begin UNO includes === **/ +#include <com/sun/star/uno/XInterface.hpp> +/** === end UNO includes === **/ + +#include <boost/scoped_ptr.hpp> + +//...................................................................................................................... +namespace framework +{ +//...................................................................................................................... + + //================================================================================================================== + //= DocumentUndoGuard + //================================================================================================================== + struct DocumentUndoGuard_Data; + /** a helper class guarding the Undo manager of a document + + This class guards, within a given scope, the Undo Manager of a document (or another component supporting + the XUndoManagerSupplier interface). When entering the scope (i.e. when the <code>DocumentUndoGuard</code> + instances is constructed), the current state of the undo contexts of the undo manager is examined. + Upon leaving the scope (i.e. when the <code>DocumentUndoGuard</code> is destructed), the guard will execute + as many calls to <member scope="com::sun::star::document">XUndoManager::leaveUndoContext</member> as are + necessary to restore the manager's initial state. + */ + class FWE_DLLPUBLIC DocumentUndoGuard + { + public: + DocumentUndoGuard( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& i_undoSupplierComponent ); + ~DocumentUndoGuard(); + + private: + ::boost::scoped_ptr< DocumentUndoGuard_Data > m_pData; + }; + +//...................................................................................................................... +} // namespace framework +//...................................................................................................................... + +#endif // FRAMEWORK_DOCUMENTUNDOGUARD_HXX diff --git a/framework/inc/framework/eventsconfiguration.hxx b/framework/inc/framework/eventsconfiguration.hxx new file mode 100644 index 000000000000..4c07be58d1c7 --- /dev/null +++ b/framework/inc/framework/eventsconfiguration.hxx @@ -0,0 +1,66 @@ +/************************************************************************* + * + * 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_XML_EVENTSCONFIGURATION_HXX_ +#define __FRAMEWORK_XML_EVENTSCONFIGURATION_HXX_ + +#include <framework/fwedllapi.h> +#include <svl/svarray.hxx> +#include <tools/string.hxx> +#include <tools/stream.hxx> +#include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/beans/PropertyValue.hpp> + +// #110897# +#include <com/sun/star/lang/XMultiServiceFactory.hpp> + +namespace framework +{ + +struct FWE_DLLPUBLIC EventsConfig +{ + ::com::sun::star::uno::Sequence< ::rtl::OUString > aEventNames; + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > aEventsProperties; +}; + +class FWE_DLLPUBLIC EventsConfiguration +{ + public: + // #110897# + static sal_Bool LoadEventsConfig( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, + SvStream& rInStream, EventsConfig& aItems ); + + // #110897# + static sal_Bool StoreEventsConfig( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, + SvStream& rOutStream, const EventsConfig& aItems ); +}; + +} // namespace framework + +#endif // __FRAMEWORK_XML_EVENTSCONFIGURATION_HXX_ diff --git a/framework/inc/framework/framelistanalyzer.hxx b/framework/inc/framework/framelistanalyzer.hxx new file mode 100644 index 000000000000..61fe08cc7018 --- /dev/null +++ b/framework/inc/framework/framelistanalyzer.hxx @@ -0,0 +1,214 @@ +/************************************************************************* + * + * 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_FRAMELISTANALYZER_HXX_ +#define __FRAMEWORK_CLASSES_FRAMELISTANALYZER_HXX_ + +//_______________________________________________ +// interface includes +#include <com/sun/star/frame/XFrame.hpp> + +//_______________________________________________ +// other includes +#include <framework/fwedllapi.h> + +//_______________________________________________ +// namespace + +namespace framework{ + +//_______________________________________________ +// exported const + +//_______________________________________________ +// exported definitions + +/** analyze and split the current available frame list of a given frames supplier + into different parts. + + These analyzed informations can be used e.g. to decide if it's neccessary + to switch into the backing mode, close the current active frame only or + exit the whole application explicitly or implicitly. + */ +class FWE_DLLPUBLIC FrameListAnalyzer +{ + //_______________________________________ + // types + + public: + + /** These enums can be combined as flags to enable/disable + special search algorithm during analyze phase. + see impl_analyze() for further informations. + But note: To be useable as flags, these enums + must be values of range [2^n]! */ + enum EDetect + { + E_MODEL = 1, + E_HELP = 2, + E_BACKINGCOMPONENT = 4, + E_HIDDEN = 8, + E_ALL = 15, + E_ZOMBIE = 32768 // use it for special test scenarios only!!! + }; + + //_______________________________________ + // member + + public: + + /** provides access to the frame container, which should be analyzed. */ + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFramesSupplier >& m_xSupplier; + + /** hold the reference frame, which is used e.g. to detect other frames with the same model. */ + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& m_xReferenceFrame; + + /** enable/disable some special analyzing steps. + see impl_analyze() for further informations. */ + sal_uInt32 m_eDetectMode; + + /** contains all frames, which uses the same model like the reference frame. + Will be filled only if m_eDetectMode has set the flag E_MODEL. + The reference frame is never part of this list! */ + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > > m_lModelFrames; + + /** contains all frames, which does not contain the same model like the reference frame. + Filling of it can't be supressed by m_eDetectMode. + The reference frame is never part of this list! + All frames inside this list are visible ones. */ + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > > m_lOtherVisibleFrames; + + /** contains all frames, which does not contain the same model like the reference frame. + Filling of it can't be supressed by m_eDetectMode. + The reference frame is never part of this list! + All frames inside this list are hidden ones. */ + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > > m_lOtherHiddenFrames; + + /** points to the help frame. + Will be set only, if any other frame (means different from the reference frame) + contains the help component. If the reference frame itself includes the help module + it's not set ... but another member m_bIsHelp is used to safe this information. + See following example code: + + <listing> + if (m_xReferenceFrame == help) + { + m_xHelp = NULL; + m_bIsHelp = sal_True; + } + else + if (xOtherFrame == help) + { + m_xHelp = xOtherFrame; + m_bIsHelp = sal_False; + } + </listing> + + Analyzing of the help frame ignores the visible state of any frame. + But note: a hidden help frame indicates a wrong state! + */ + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xHelp; + + /** points to the frame, which contains the backing component. + Will be set only, if any other frame (means different from the reference frame) + contains the backing component. If the reference frame itself includes the + backing component it's not set ... but another member m_bIsBackingComponent + will used to safe this information. + See following example code: + + <listing> + if (m_xReferenceFrame == backing) + { + m_xBackingComponent = NULL; + m_bIsBackingComponent = sal_True; + } + else + if (xOtherFrame == backing) + { + m_xBackingComponent = xOtherFrame; + m_bIsBackingComponent = sal_False ; + } + </listing> + + Analyzing of the help frame ignores the visible state of any frame. + But note: a hidden backing mode frame indicates a wrong state! + */ + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xBackingComponent; + + /** is set to true only, if the reference frame is a hidden one. + This value is undefined if m_eDetectMode doesn't have set the flag E_HIDDEN! */ + sal_Bool m_bReferenceIsHidden; + + /** is set to true only, if the reference frame contains the help component. + In this case the member m_xHelp is set to NULL everytimes. + This value is undefined if m_eDetectMode doesn't have set the flag E_HELP! */ + sal_Bool m_bReferenceIsHelp; + + /** is set to true only, if the reference frame contains the backing component. + In this case the member m_xBackingComponent is set to NULL everytimes. + This value is undefined if m_eDetectMode doesn't have set the flag E_BACKINGCOMPONENT! */ + sal_Bool m_bReferenceIsBacking; + + //_______________________________________ + // interface + + public: + + /** starts analyze phase and fille all members with valid informations. + + @param xSupplier + Must be a valid reference to a frames supplier, which provies + access to the frame list for analyzing. + + @param xReferenceFrame + This frame must(!) exist inside the analyzed frame list and + is used for some comparing functions. Further some member states + depends from the current state of this frame. + + @param eDetectMode + It represent a flag field, which can enable/disable special + analyze steps. Note: Some member values will be undefined, if + an analyze step will be disabled. + */ + FrameListAnalyzer( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFramesSupplier >& xSupplier , + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xReferenceFrame , + sal_uInt32 eDetectMode ); + virtual ~FrameListAnalyzer(); + + //_______________________________________ + // helper + + private: + + void impl_analyze(); + + +}; // class FrameListAnalyzer + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_CLASSES_FRAMELISTANALYZER_HXX_ diff --git a/framework/inc/framework/fwedllapi.h b/framework/inc/framework/fwedllapi.h new file mode 100644 index 000000000000..c3aa1bb81d1d --- /dev/null +++ b/framework/inc/framework/fwedllapi.h @@ -0,0 +1,13 @@ +#ifndef INCLUDED_FWEDLLAPI_H +#define INCLUDED_FWEDLLAPI_H + +#include "sal/types.h" + +#if defined(FWE_DLLIMPLEMENTATION) +#define FWE_DLLPUBLIC SAL_DLLPUBLIC_EXPORT +#else +#define FWE_DLLPUBLIC SAL_DLLPUBLIC_IMPORT +#endif +#define FWE_DLLPRIVATE SAL_DLLPRIVATE + +#endif /* INCLUDED_FWEDLLAPI_H */ diff --git a/framework/inc/framework/iguard.hxx b/framework/inc/framework/iguard.hxx new file mode 100755 index 000000000000..7c00858b208d --- /dev/null +++ b/framework/inc/framework/iguard.hxx @@ -0,0 +1,69 @@ +/************************************************************************* + * + * 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_THREADHELP_IGUARD_H_ +#define __FRAMEWORK_THREADHELP_IGUARD_H_ + +//_________________________________________________________________________________________________________________ +// includes +//_________________________________________________________________________________________________________________ + +#include <sal/types.h> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ +// declarations +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @descr interface for guarding a lock +*//*-*************************************************************************************************************/ +class SAL_NO_VTABLE IGuard +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + public: + + /** clears the lock. If the guard does not currently hold the lock, nothing happens. + */ + virtual void clear() = 0; + + /** attempts to re-establishes the lock, blocking until the attempt is successful. + */ + virtual void reset() = 0; + +}; // class IGuard + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_THREADHELP_IGUARD_H_ diff --git a/framework/inc/framework/imageproducer.hxx b/framework/inc/framework/imageproducer.hxx new file mode 100644 index 000000000000..02042e44a2e2 --- /dev/null +++ b/framework/inc/framework/imageproducer.hxx @@ -0,0 +1,51 @@ +/************************************************************************* + * + * 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_HELPER_IMAGEPRODUCER_HXX_ +#define __FRAMEWORK_HELPER_IMAGEPRODUCER_HXX_ + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <sal/types.h> +#include <com/sun/star/frame/XFrame.hpp> +#include <vcl/image.hxx> +#include <rtl/ustring.hxx> +#include <framework/fwedllapi.h> + +namespace framework +{ + +typedef Image ( *pfunc_getImage)( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, const ::rtl::OUString& aURL, sal_Bool bBig, sal_Bool bHiContrast ); + +pfunc_getImage FWE_DLLPUBLIC SAL_CALL SetImageProducer( pfunc_getImage pGetImageFunc ); + +Image FWE_DLLPUBLIC SAL_CALL GetImageFromURL( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, const ::rtl::OUString& aURL, sal_Bool bBig, sal_Bool bHiContrast ); + +} + +#endif // __FRAMEWORK_HELPER_IMAGEPRODUCER_HXX_ diff --git a/framework/inc/framework/imagesconfiguration.hxx b/framework/inc/framework/imagesconfiguration.hxx new file mode 100644 index 000000000000..0771e2d8f7f1 --- /dev/null +++ b/framework/inc/framework/imagesconfiguration.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_XML_IMAGESCONFIGURATION_HXX_ +#define __FRAMEWORK_XML_IMAGESCONFIGURATION_HXX_ + +#include <framework/fwedllapi.h> +#include <svl/svarray.hxx> +#include <tools/string.hxx> +#include <tools/stream.hxx> +#include <tools/color.hxx> + +// #110897# +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/io/XInputStream.hpp> +#include <com/sun/star/io/XOutputStream.hpp> + +#include <vector> + +namespace framework +{ + +enum ImageMaskMode +{ + ImageMaskMode_Color, + ImageMaskMode_Bitmap +}; + +struct FWE_DLLPUBLIC ImageItemDescriptor +{ + ImageItemDescriptor() : nIndex( -1 ) {} + + String aCommandURL; // URL command to dispatch + long nIndex; // index of the bitmap inside the bitmaplist +}; + +struct FWE_DLLPUBLIC ExternalImageItemDescriptor +{ + String aCommandURL; // URL command to dispatch + String aURL; // a URL to an external bitmap +}; + +typedef ImageItemDescriptor* ImageItemDescriptorPtr; +SV_DECL_PTRARR_DEL( ImageItemListDescriptor, ImageItemDescriptorPtr, 10, 2) + +typedef ExternalImageItemDescriptor* ExternalImageItemDescriptorPtr; +SV_DECL_PTRARR_DEL( ExternalImageItemListDescriptor, ExternalImageItemDescriptorPtr, 10, 2) + +struct FWE_DLLPUBLIC ImageListItemDescriptor +{ + ImageListItemDescriptor() : nMaskMode( ImageMaskMode_Color ), + pImageItemList( 0 ) {} + + ~ImageListItemDescriptor() { delete pImageItemList; } + + String aURL; // an URL to a bitmap with several images inside + Color aMaskColor; // a color used as transparent + String aMaskURL; // an URL to an optional bitmap used as a mask + ImageMaskMode nMaskMode; // an enum to describe the current mask mode + ImageItemListDescriptor* pImageItemList; // an array of ImageItemDescriptors that describes every image + String aHighContrastURL; // an URL to an optional high contrast bitmap with serveral images inside + String aHighContrastMaskURL; // an URL to an optional high contrast bitmap as a mask +}; + +typedef ImageListItemDescriptor* ImageListItemDescriptorPtr; +SV_DECL_PTRARR_DEL( ImageListDescriptor, ImageListItemDescriptorPtr, 10, 2) + +struct FWE_DLLPUBLIC ImageListsDescriptor +{ + ImageListsDescriptor() : pImageList( 0 ), + pExternalImageList( 0 ) {} + ~ImageListsDescriptor() { delete pImageList; delete pExternalImageList; } + + ImageListDescriptor* pImageList; + ExternalImageItemListDescriptor* pExternalImageList; +}; + +class FWE_DLLPUBLIC ImagesConfiguration +{ + public: + // #110897# + static sal_Bool LoadImages( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, + SvStream& rInStream, ImageListsDescriptor& aItems ); + + // #110897# + static sal_Bool StoreImages( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, + SvStream& rOutStream, const ImageListsDescriptor& aItems ); + + static sal_Bool LoadImages( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rInputStream, + ImageListsDescriptor& rItems ); + + static sal_Bool StoreImages( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& rOutputStream, + const ImageListsDescriptor& rItems ); +}; + +} // namespace framework + +#endif // __FRAMEWORK_CLASSES_IMAGES diff --git a/framework/inc/framework/imutex.hxx b/framework/inc/framework/imutex.hxx new file mode 100644 index 000000000000..5466edc4cf76 --- /dev/null +++ b/framework/inc/framework/imutex.hxx @@ -0,0 +1,69 @@ +/************************************************************************* + * + * 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_THREADHELP_IMUTEX_H_ +#define __FRAMEWORK_THREADHELP_IMUTEX_H_ + +//_________________________________________________________________________________________________________________ +// includes +//_________________________________________________________________________________________________________________ + +#include <sal/types.h> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ +// declarations +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @descr We need this interface to support using of different mutex implementations in a generic way. +*//*-*************************************************************************************************************/ +class SAL_NO_VTABLE IMutex +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + public: + + /*-****************************************************************************************************//** + @descr These functions must be supported by a derived class! + acquire() -try to register thread + release() -unregister thread + *//*-*****************************************************************************************************/ + virtual void acquire() = 0; + virtual void release() = 0; + +}; // class IMutex + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_THREADHELP_IMUTEX_H_ diff --git a/framework/inc/framework/interaction.hxx b/framework/inc/framework/interaction.hxx new file mode 100644 index 000000000000..03c8fde19736 --- /dev/null +++ b/framework/inc/framework/interaction.hxx @@ -0,0 +1,142 @@ +/************************************************************************* + * + * 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_DISPATCH_INTERACTION_HXX_ +#define __FRAMEWORK_DISPATCH_INTERACTION_HXX_ + +#include <com/sun/star/task/XInteractionRequest.hpp> +#include <com/sun/star/task/XInteractionContinuation.hpp> +#include <com/sun/star/task/XInteractionAbort.hpp> +#include <com/sun/star/task/XInteractionApprove.hpp> +#include <com/sun/star/task/XInteractionDisapprove.hpp> +#include <com/sun/star/task/XInteractionRetry.hpp> +#include <com/sun/star/document/XInteractionFilterSelect.hpp> +#include <com/sun/star/document/NoSuchFilterRequest.hpp> +#include <com/sun/star/document/AmbigousFilterRequest.hpp> +#include <com/sun/star/uno/RuntimeException.hpp> + +//_________________________________________________________________________________________________________________ +// includes of other projects +//_________________________________________________________________________________________________________________ +#include <rtl/ustring.hxx> +#include <cppuhelper/implbase1.hxx> +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/uno/Sequence.hxx> +#include <framework/fwedllapi.h> + +namespace framework{ + +/*-************************************************************************************************************//** + @short special request for interaction to ask user for right filter + @descr These helper can be used to ask user for right filter, if filter detection failed. + It capsulate communication with any interaction handler and supports an easy + access on interaction results for user of these class. + Use it and forget complex mechanism of interaction ... + + @example RequestFilterSelect* pRequest = new RequestFilterSelect; + Reference< XInteractionRequest > xRequest ( pRequest ); + xInteractionHandler->handle( xRequest ); + if( ! pRequest.isAbort() ) + { + OUString sFilter = pRequest->getFilter(); + } + + @implements XInteractionRequest + + @base WeakImplHelper1 + + @devstatus ready to use + @threadsafe no (used on once position only!) +*//*-*************************************************************************************************************/ +class RequestFilterSelect_Impl; +class FWE_DLLPUBLIC RequestFilterSelect +{ + RequestFilterSelect_Impl* pImp; + + public: + RequestFilterSelect( const ::rtl::OUString& sURL ); + ~RequestFilterSelect(); + sal_Bool isAbort () const; + ::rtl::OUString getFilter() const; + com::sun::star::uno::Reference < ::com::sun::star::task::XInteractionRequest > GetRequest(); +}; + +/*-************************************************************************************************************//** + @short special request for interaction + @descr User must decide between a preselected and another detected filter. + It capsulate communication with any interaction handler and supports an easy + access on interaction results for user of these class. + + @implements XInteractionRequest + + @base WeakImplHelper1 + + @devstatus ready to use + @threadsafe no (used on once position only!) +*//*-*************************************************************************************************************/ +class FWE_DLLPUBLIC InteractionRequest +{ +public: + static com::sun::star::uno::Reference < ::com::sun::star::task::XInteractionRequest > + CreateRequest( const ::com::sun::star::uno::Any& aRequest, + const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > > lContinuations ); +}; + +/*-************************************************************************************************************//** + @short special request for interaction + @descr User must decide between a preselected and another detected filter. + It capsulate communication with any interaction handler and supports an easy + access on interaction results for user of these class. + + @implements XInteractionRequest + + @base WeakImplHelper1 + + @devstatus ready to use + @threadsafe no (used on once position only!) +*//*-*************************************************************************************************************/ +/* +class RequestAmbigousFilter_Impl; +class RequestAmbigousFilter // seems to be unused currently +{ + RequestAmbigousFilter_Impl* pImp; + + // c++ interface +public: + RequestAmbigousFilter( const ::rtl::OUString& sURL, + const ::rtl::OUString& sSelectedFilter , + const ::rtl::OUString& sDetectedFilter ); + ~RequestAmbigousFilter(); + sal_Bool isAbort () const; + ::rtl::OUString getFilter() const; + com::sun::star::uno::Reference < ::com::sun::star::task::XInteractionRequest > GetRequest(); +}; + */ + +} // namespace framework + +#endif // #define __FRAMEWORK_DISPATCH_INTERACTION_HXX_ diff --git a/framework/inc/framework/menuconfiguration.hxx b/framework/inc/framework/menuconfiguration.hxx new file mode 100644 index 000000000000..be3437c5e45c --- /dev/null +++ b/framework/inc/framework/menuconfiguration.hxx @@ -0,0 +1,126 @@ +/************************************************************************* + * + * 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_XML_MENUCONFIGURATION_HXX_ +#define __FRAMEWORK_XML_MENUCONFIGURATION_HXX_ + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ + +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/lang/WrappedTargetException.hpp> +#include <com/sun/star/io/XInputStream.hpp> +#include <com/sun/star/io/XOutputStream.hpp> +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/container/XIndexContainer.hpp> +#include <com/sun/star/container/XIndexAccess.hpp> +#include <com/sun/star/frame/XDispatchProvider.hpp> +#include <framework/fwedllapi.h> + +//_________________________________________________________________________________________________________________ +// includes of other projects +//_________________________________________________________________________________________________________________ + +#include <cppuhelper/weak.hxx> +#include <vcl/menu.hxx> +#include <vcl/toolbox.hxx> + +#define BOOKMARK_NEWMENU ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "private:menu_bookmark_new" )) +#define BOOKMARK_WIZARDMENU ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "private:menu_bookmark_wizard" )) +#define ADDONS_POPUPMENU ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "private:menu_addons_popup" )) + +// Prepare for inclusion by framework and sfx +// Please consider that there is a corresponding define also in sfxsids.hrc!! (SID_SFX_START)/(SID_ADDONS) +#define FWK_SID_SFX_START 5000 +#define FWK_SID_ADDONS (FWK_SID_SFX_START+1678) +#define FWK_SID_ADDONHELP (FWK_SID_SFX_START+1684) + +const sal_uInt16 START_ITEMID_PICKLIST = 4500; +const sal_uInt16 END_ITEMID_PICKLIST = 4599; +const sal_uInt16 MAX_ITEMCOUNT_PICKLIST = 99; // difference between START_... & END_... for picklist / must be changed too, if these values are changed! +const sal_uInt16 START_ITEMID_WINDOWLIST = 4600; +const sal_uInt16 END_ITEMID_WINDOWLIST = 4699; +const sal_uInt16 ITEMID_ADDONLIST = FWK_SID_ADDONS; +const sal_uInt16 ITEMID_ADDONHELP = FWK_SID_ADDONHELP; + +namespace framework +{ + +class FWE_DLLPUBLIC MenuConfiguration +{ + public: + struct Attributes + { + Attributes() {} + Attributes( const ::rtl::OUString& aFrame, const ::rtl::OUString& aImageIdStr ) : + aTargetFrame( aFrame ), aImageId( aImageIdStr ) {} + + ::rtl::OUString aTargetFrame; + ::rtl::OUString aImageId; + ::com::sun::star::uno::WeakReference< ::com::sun::star::frame::XDispatchProvider > xDispatchProvider; + sal_Int16 nStyle; + }; + + MenuConfiguration( + // #110897#-1 use const when giving a uno reference by reference + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rServiceManager ); + + virtual ~MenuConfiguration(); + + ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > CreateMenuBarConfigurationFromXML( + ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rInputStream ) + throw ( ::com::sun::star::lang::WrappedTargetException ); + + PopupMenu* CreateBookmarkMenu( + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, + const ::rtl::OUString& aURL ) + throw ( ::com::sun::star::lang::WrappedTargetException ); + + ToolBox* CreateToolBoxFromConfiguration( + ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rInputStream ) + throw ( ::com::sun::star::lang::WrappedTargetException ); + + void StoreMenuBarConfigurationToXML( ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& rMenuBarConfiguration, + ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& rOutputStream ) + throw ( ::com::sun::star::lang::WrappedTargetException ); + + void StoreToolBox( ToolBox* pToolBox, + ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& rOutputStream ) + throw ( ::com::sun::star::lang::WrappedTargetException ); + + static sal_Bool IsPickListItemId( sal_uInt16 nId ); + static sal_Bool IsWindowListItemId( sal_uInt16 nId ); + + private: + // #110897#-1 do not hold the uno reference by reference + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& m_rxServiceManager; +}; + +} + +#endif // __FRAMEWORK_XML_MENUCONFIGURATION_HXX_ diff --git a/framework/inc/framework/menuextensionsupplier.hxx b/framework/inc/framework/menuextensionsupplier.hxx new file mode 100644 index 000000000000..f6ca60d4fecc --- /dev/null +++ b/framework/inc/framework/menuextensionsupplier.hxx @@ -0,0 +1,51 @@ +/************************************************************************* + * + * 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_MENUEXTENSIONSUPPLIER_HXX_ +#define __FRAMEWORK_CLASSES_MENUEXTENSIONSUPPLIER_HXX_ + +#include <rtl/ustring.hxx> +#include <framework/fwedllapi.h> + +struct FWE_DLLPUBLIC MenuExtensionItem +{ + rtl::OUString aLabel; + rtl::OUString aURL; +}; + +typedef MenuExtensionItem ( *pfunc_setMenuExtensionSupplier)(); + +namespace framework +{ + +FWE_DLLPUBLIC pfunc_setMenuExtensionSupplier SAL_CALL SetMenuExtensionSupplier( pfunc_setMenuExtensionSupplier pSetMenuExtensionSupplier ); + +FWE_DLLPUBLIC MenuExtensionItem SAL_CALL GetMenuExtension(); + +} + +#endif // __FRAMEWORK_CLASSES_MENUEXTENSIONSUPPLIER_HXX_ diff --git a/framework/inc/framework/preventduplicateinteraction.hxx b/framework/inc/framework/preventduplicateinteraction.hxx new file mode 100644 index 000000000000..0e24357fe71e --- /dev/null +++ b/framework/inc/framework/preventduplicateinteraction.hxx @@ -0,0 +1,272 @@ +/************************************************************************* + * + * 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_INTERACTION_PREVENTDUPLICATEINTERACTION_HXX_ +#define __FRAMEWORK_INTERACTION_PREVENTDUPLICATEINTERACTION_HXX_ + +#include <framework/fwedllapi.h> +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <vector> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/task/XInteractionHandler2.hpp> +#include <com/sun/star/task/XInteractionRequest.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <cppuhelper/implbase1.hxx> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +#ifdef css + #error "Conflict during define of namespace alias ..." +#else + #define css ::com::sun::star +#endif + +//_________________________________________________________________________________________________________________ +// exported const +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// exported definitions +//_________________________________________________________________________________________________________________ + +/** + @short Prevent us from showing the same interaction more then once during + the same transaction. + + @descr Every interaction provided to this helper will be safed ... handled by the internal + used UUIInteractionHandler (!) and never be handled a second time! + + On the other side there exists some interactions, which allow a retry. + So this helper allow to set a list of interactions combined with a retry value. + */ +struct ThreadHelpBase2 +{ + public: + mutable ::osl::Mutex m_aLock; +}; + +class FWE_DLLPUBLIC PreventDuplicateInteraction : private ThreadHelpBase2 + ,public ::cppu::WeakImplHelper1< css::task::XInteractionHandler2 > +{ + //_____________________________________ + // structs, types etcp. + public: + + struct InteractionInfo + { + public: + /// describe the interaction. + css::uno::Type m_aInteraction; + /// after max count was reached this interaction will be blocked. + sal_Int32 m_nMaxCount; + /// count how often this interaction was called. + sal_Int32 m_nCallCount; + /** hold the last intercepted request (matching the set interaction type) alive + so it can be used for further checks */ + css::uno::Reference< css::task::XInteractionRequest > m_xRequest; + + public: + + InteractionInfo(const css::uno::Type& aInteraction, + sal_Int32 nMaxCount ) + : m_aInteraction(aInteraction) + , m_nMaxCount (nMaxCount ) + , m_nCallCount (0 ) + {} + + InteractionInfo(const InteractionInfo& aCopy) + : m_aInteraction(aCopy.m_aInteraction) + , m_nMaxCount (aCopy.m_nMaxCount ) + , m_nCallCount (aCopy.m_nCallCount ) + , m_xRequest (aCopy.m_xRequest ) + {} + }; + + typedef ::std::vector< InteractionInfo > InteractionList; + + //_____________________________________ + // member + private: + + /// Used to create needed uno services at runtime. + css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR; + + /** The outside interaction handler, which is used to handle every incoming interaction, + if it's not blocked. */ + css::uno::Reference< css::task::XInteractionHandler > m_xHandler; + + /** This list describe which and how incoming interactions must be handled. + Further it contains all collected informations after this interaction + object was used.*/ + InteractionList m_lInteractionRules; + + //_____________________________________ + // uno interface + public: + + //_________________________________ + /** + @interface XInteractionHandler + @short called from outside to handle a problem + @descr We filter the incoming interactions. some of them + will be forwarded to the generic UI interaction handler. + So we must not implement it twice. Some other ones + will be aborted only. + + @threadsafe yes + */ + virtual void SAL_CALL handle(const css::uno::Reference< css::task::XInteractionRequest >& xRequest) + throw(css::uno::RuntimeException); + + //_________________________________ + /** + @interface XInteractionHandler2 + @short called from outside to handle a problem + @descr We filter the incoming interactions. some of them + will be forwarded to the generic UI interaction handler. + So we must not implement it twice. Some other ones + will be aborted only. + + @threadsafe yes + */ + virtual ::sal_Bool SAL_CALL handleInteractionRequest( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionRequest >& xRequest ) + throw (::com::sun::star::uno::RuntimeException); + + //_________________________________ + /** + @interface XInterface + @short called to query another interface of the component + @descr Will allow to query for XInteractionHandler2 if and only if m_xHandler supports this interface, too. + + @threadsafe yes + */ + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) + throw (::com::sun::star::uno::RuntimeException); + //_____________________________________ + // c++ interface + public: + + //_________________________________ + /** + @short ctor to guarantee right initialized instances of this class + @descr It uses the given uno service manager to create the global + generic UI interaction handler for later internal using. + + @param xSMGR + uno service manager for creating services internaly + + @threadsafe not neccessary + */ + PreventDuplicateInteraction(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR); + + //_________________________________ + /** + @short dtor to free used memory. + */ + virtual ~PreventDuplicateInteraction(); + + //_________________________________ + /** + @short set the outside interaction handler, which must be used internaly + if the interaction will not be blocked by the set list of rules. + + @note This overwrites the settings of e.g. useDefaultUUIHandler()! + + @param xHandler + the new interaction handler + */ + virtual void setHandler(const css::uno::Reference< css::task::XInteractionHandler >& xHandler); + + //_________________________________ + /** + @short instead of setting an outside interaction handler, this method + make sure the default UUI interaction handler of the office is used. + + @note This overwrites the settings of e.g. setHandler()! + */ + virtual void useDefaultUUIHandler(); + + //_________________________________ + /** + @short add a new interaction to the list of interactions, which + must be handled by this helper. + + @descr This method must be called immediatly after a new instance of this helper was + created. Without such list of InteractionRules, this instances does nothing! + On the other side there is no possibility to remove rules. + So the same instance cant be used within different transactions. + It's a OneWay-object .-) + + @param aInteractionInfo + describe the type of interaction, hos often it can be called etcpp. + + @threadsafe yes + */ + virtual void addInteractionRule(const PreventDuplicateInteraction::InteractionInfo& aInteractionInfo); + + //_________________________________ + /** + @short return the info struct for the specified interaction. + + @param aInteraction + specify the interaction. + + @param pReturn + provides informations about: + - the count how often this interaction was handled during the + lifetime of this helper. + - the interaction itself, so it can be analyzed further + + @return [boolean] + sal_True if the queried interaction could be found. + sal_False otherwise. + + @threadsafe yes + */ + virtual sal_Bool getInteractionInfo(const css::uno::Type& aInteraction, + PreventDuplicateInteraction::InteractionInfo* pReturn ) const; +}; + +#undef css + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_INTERACTION_PREVENTDUPLICATEINTERACTION_HXX_ diff --git a/framework/inc/framework/sfxhelperfunctions.hxx b/framework/inc/framework/sfxhelperfunctions.hxx new file mode 100644 index 000000000000..fd4292fc340f --- /dev/null +++ b/framework/inc/framework/sfxhelperfunctions.hxx @@ -0,0 +1,74 @@ +/************************************************************************* + * + * 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_SFXHELPERFUNCTIONS_HXX_ +#define __FRAMEWORK_CLASSES_SFXHELPERFUNCTIONS_HXX_ + +#include <framework/fwedllapi.h> +#include <com/sun/star/frame/XFrame.hpp> +#include <rtl/ustring.hxx> +#include <vcl/toolbox.hxx> +#include <vcl/status.hxx> +#include <svtools/toolboxcontroller.hxx> +#include <svtools/statusbarcontroller.hxx> + +typedef svt::ToolboxController* ( *pfunc_setToolBoxControllerCreator)( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, ToolBox* pToolbox, unsigned short nID, const ::rtl::OUString& aCommandURL ); +typedef svt::StatusbarController* ( *pfunc_setStatusBarControllerCreator)( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, StatusBar* pStatusBar, unsigned short nID, const ::rtl::OUString& aCommandURL ); +typedef void ( *pfunc_getRefreshToolbars)( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame ); +typedef void ( *pfunc_createDockingWindow)( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, const ::rtl::OUString& rResourceURL ); +typedef bool ( *pfunc_isDockingWindowVisible)( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, const ::rtl::OUString& rResourceURL ); +typedef void ( *pfunc_activateToolPanel)( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame, const ::rtl::OUString& i_rPanelURL ); + +namespace framework +{ + +FWE_DLLPUBLIC pfunc_setToolBoxControllerCreator SAL_CALL SetToolBoxControllerCreator( pfunc_setToolBoxControllerCreator pSetToolBoxControllerCreator ); + +FWE_DLLPUBLIC svt::ToolboxController* SAL_CALL CreateToolBoxController( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, ToolBox* pToolbox, unsigned short nID, const ::rtl::OUString& aCommandURL ); + +FWE_DLLPUBLIC pfunc_setStatusBarControllerCreator SAL_CALL SetStatusBarControllerCreator( pfunc_setStatusBarControllerCreator pSetStatusBarControllerCreator ); + +FWE_DLLPUBLIC svt::StatusbarController* SAL_CALL CreateStatusBarController( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, StatusBar* pStatusBar, unsigned short nID, const ::rtl::OUString& aCommandURL ); + +FWE_DLLPUBLIC pfunc_getRefreshToolbars SAL_CALL SetRefreshToolbars( pfunc_getRefreshToolbars pRefreshToolbarsFunc ); + +FWE_DLLPUBLIC void SAL_CALL RefreshToolbars( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame ); + +FWE_DLLPUBLIC pfunc_createDockingWindow SAL_CALL SetDockingWindowCreator( pfunc_createDockingWindow pCreateDockingWindow ); + +FWE_DLLPUBLIC void SAL_CALL CreateDockingWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, const ::rtl::OUString& rResourceURL ); + +FWE_DLLPUBLIC pfunc_isDockingWindowVisible SAL_CALL SetIsDockingWindowVisible( pfunc_isDockingWindowVisible pIsDockingWindowVisible ); + +FWE_DLLPUBLIC bool SAL_CALL IsDockingWindowVisible( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, const ::rtl::OUString& rResourceURL ); + +FWE_DLLPUBLIC pfunc_activateToolPanel SAL_CALL SetActivateToolPanel( pfunc_activateToolPanel i_pActivator ); + +FWE_DLLPUBLIC void SAL_CALL ActivateToolPanel( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame, const ::rtl::OUString& i_rPanelURL ); +} + +#endif // __FRAMEWORK_CLASSES_SFXHELPERFUNCTIONS_HXX_ diff --git a/framework/inc/framework/statusbarconfiguration.hxx b/framework/inc/framework/statusbarconfiguration.hxx new file mode 100644 index 000000000000..bd93831cba7a --- /dev/null +++ b/framework/inc/framework/statusbarconfiguration.hxx @@ -0,0 +1,85 @@ +/************************************************************************* + * + * 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_STATUSBARCONFIGURATION_HXX_ +#define __FRAMEWORK_CLASSES_STATUSBARCONFIGURATION_HXX_ + +#include <framework/fwedllapi.h> +#include <svl/svarray.hxx> +#include <tools/string.hxx> +#include <tools/stream.hxx> +#include <vcl/status.hxx> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/io/XInputStream.hpp> +#include <com/sun/star/io/XOutputStream.hpp> +#include <com/sun/star/container/XIndexAccess.hpp> +#include <com/sun/star/container/XIndexContainer.hpp> + +namespace framework +{ + +struct FWE_DLLPUBLIC StatusBarItemDescriptor +{ + String aURL; // URL command to dispatch + long nItemBits; // properties for this statusbar item (WinBits) + long nWidth; // width of a statusbar item + long nOffset; // offset + + public: + + StatusBarItemDescriptor() : nItemBits( SIB_CENTER | SIB_IN ) + ,nWidth( 0 ) + ,nOffset( STATUSBAR_OFFSET ) {} +}; + +typedef StatusBarItemDescriptor* StatusBarItemDescriptorPtr; +SV_DECL_PTRARR_DEL( StatusBarDescriptor, StatusBarItemDescriptorPtr, 10, 2) + +class FWE_DLLPUBLIC StatusBarConfiguration +{ + public: + static sal_Bool LoadStatusBar( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, + SvStream& rInStream, StatusBarDescriptor& aItems ); + + static sal_Bool StoreStatusBar( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, + SvStream& rOutStream, const StatusBarDescriptor& aItems ); + + static sal_Bool LoadStatusBar( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xInputStream, + const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer >& rStatusbarConfiguration ); + + static sal_Bool StoreStatusBar( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& xOutputStream, + const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& rStatusbarConfiguration ); +}; + +} // namespace framework + +#endif // __FRAMEWORK_CLASSES_STATUSBARCONFIGURATION_HXX_ diff --git a/framework/inc/framework/titlehelper.hxx b/framework/inc/framework/titlehelper.hxx new file mode 100644 index 000000000000..1b448cef13ac --- /dev/null +++ b/framework/inc/framework/titlehelper.hxx @@ -0,0 +1,228 @@ +/************************************************************************* + * + * 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_TITLEHELPER_HXX_ +#define _FRAMEWORK_TITLEHELPER_HXX_ + +//_______________________________________________ +// includes + +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/uno/XInterface.hpp> +#include <com/sun/star/lang/IllegalArgumentException.hpp> +#include <com/sun/star/frame/XUntitledNumbers.hpp> +#include <com/sun/star/frame/XTitle.hpp> +#include <com/sun/star/frame/XTitleChangeBroadcaster.hpp> +#include <com/sun/star/frame/XModel.hpp> +#include <com/sun/star/frame/XController.hpp> +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/frame/XFrameActionListener.hpp> +#include <com/sun/star/document/XEventListener.hpp> + +#include <cppuhelper/basemutex.hxx> +#include <cppuhelper/weakref.hxx> +#include <cppuhelper/implbase5.hxx> +#include <cppuhelper/interfacecontainer.hxx> + +#include <rtl/ustrbuf.hxx> + +#include <hash_map> +#include <framework/fwedllapi.h> + +//_______________________________________________ +// namespace + +namespace framework{ + +#ifdef css + #error "Ambigious namespace definition of css." +#else + #define css ::com::sun::star +#endif + +//_______________________________________________ +// definitions + +/** @short can be used as implementation helper of interface css.frame.XTitle + + @threadsafe + */ +class FWE_DLLPUBLIC TitleHelper : private ::cppu::BaseMutex + , public ::cppu::WeakImplHelper5< css::frame::XTitle , + css::frame::XTitleChangeBroadcaster, + css::frame::XTitleChangeListener , + css::frame::XFrameActionListener , + css::document::XEventListener > +{ + //------------------------------------------- + // interface + public: + + //--------------------------------------- + /** @short lightweight constructor. + */ + TitleHelper(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR); + + //--------------------------------------- + /** @short free all internaly used resources. + */ + virtual ~TitleHelper(); + + //--------------------------------------- + /** set an outside component which uses this container and must be set + as source of all broadcasted messages, exceptions. + + It's holded weak only so we do not need any complex dispose sessions. + + Note: Passing NULL as parameter will be alloed. It will reset the internal + member reference only. + + @param xOwner + the new owner of this collection. + */ + void setOwner (const css::uno::Reference< css::uno::XInterface >& xOwner); + + //--------------------------------------- + /** set an outside component which provides the righht string and number for + an untitled component. + + It's holded weak only so we do not need any complex dispose sessions. + + Note: Passing NULL as parameter will be alloed. It will reset the internal + member reference only. + + @param xNumbers + the right numbered collection for this helper. + */ + void connectWithUntitledNumbers (const css::uno::Reference< css::frame::XUntitledNumbers >& xNumbers); + + //--------------------------------------- + /** @see XTitle */ + virtual ::rtl::OUString SAL_CALL getTitle() + throw (css::uno::RuntimeException); + + //--------------------------------------- + /** @see XTitle */ + virtual void SAL_CALL setTitle(const ::rtl::OUString& sTitle) + throw (css::uno::RuntimeException); + + //--------------------------------------- + /** @see XTitleChangeBroadcaster */ + virtual void SAL_CALL addTitleChangeListener(const css::uno::Reference< css::frame::XTitleChangeListener >& xListener) + throw (css::uno::RuntimeException); + + //--------------------------------------- + /** @see XTitleChangeBroadcaster */ + virtual void SAL_CALL removeTitleChangeListener(const css::uno::Reference< css::frame::XTitleChangeListener >& xListener) + throw (css::uno::RuntimeException); + + //--------------------------------------- + /** @see XTitleChangeListener */ + virtual void SAL_CALL titleChanged(const css::frame::TitleChangedEvent& aEvent) + throw (css::uno::RuntimeException); + + //--------------------------------------- + /** @see css.document.XEventListener */ + virtual void SAL_CALL notifyEvent(const css::document::EventObject& aEvent) + throw (css::uno::RuntimeException); + + //--------------------------------------- + /** @see css.lang.XEventListener */ + virtual void SAL_CALL disposing(const css::lang::EventObject& aEvent) + throw (css::uno::RuntimeException); + + //--------------------------------------- + /** @see css.frame.XFrameActionListener */ + virtual void SAL_CALL frameAction(const css::frame::FrameActionEvent& aEvent) + throw(css::uno::RuntimeException); + + //------------------------------------------- + // internal + private: + + void impl_sendTitleChangedEvent (); + + void impl_updateTitle (); + void impl_updateTitleForModel (const css::uno::Reference< css::frame::XModel >& xModel); + void impl_updateTitleForController (const css::uno::Reference< css::frame::XController >& xController); + void impl_updateTitleForFrame (const css::uno::Reference< css::frame::XFrame >& xFrame); + + void impl_startListeningForModel (const css::uno::Reference< css::frame::XModel >& xModel); + void impl_startListeningForController (const css::uno::Reference< css::frame::XController >& xController); + void impl_startListeningForFrame (const css::uno::Reference< css::frame::XFrame >& xFrame); + void impl_updateListeningForFrame (const css::uno::Reference< css::frame::XFrame >& xFrame); + + void impl_appendComponentTitle ( ::rtl::OUStringBuffer& sTitle , + const css::uno::Reference< css::uno::XInterface >& xComponent); + void impl_appendProductName (::rtl::OUStringBuffer& sTitle); + void impl_appendProductExtension (::rtl::OUStringBuffer& sTitle); + void impl_appendModuleName (::rtl::OUStringBuffer& sTitle); + void impl_appendDebugVersion (::rtl::OUStringBuffer& sTitle); + void impl_appendEvalVersion (::rtl::OUStringBuffer& sTitle); + + void impl_setSubTitle (const css::uno::Reference< css::frame::XTitle >& xSubTitle); + ::rtl::OUString impl_getSubTitle (); + + ::rtl::OUString impl_convertURL2Title(const ::rtl::OUString& sURL); + + //------------------------------------------- + // member + private: + + /** points to the global uno service manager. */ + css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR; + + /** reference to the outside UNO class using this helper. */ + css::uno::WeakReference< css::uno::XInterface > m_xOwner; + + /** used to know how an "Untitled X" string can be created right :-) */ + css::uno::WeakReference< css::frame::XUntitledNumbers > m_xUntitledNumbers; + + /** provides parts of our own title and we listen there for changes too. */ + css::uno::WeakReference< css::frame::XTitle > m_xSubTitle; + + /** if it's set to sal_True the member m_sTitle has not to be changed internaly. + It was set from outside and so outside code has to make sure it will be + updated. + */ + ::sal_Bool m_bExternalTitle; + + /** the actual title value */ + ::rtl::OUString m_sTitle; + + /** knows the leased number which must be used for untitled components. */ + ::sal_Int32 m_nLeasedNumber; + + /** contains all title change listener */ + ::cppu::OMultiTypeInterfaceContainerHelper m_aListener; +}; + +#undef css + +} // namespace framework + +#endif // _FRAMEWORK_TITLEHELPER_HXX_ diff --git a/framework/inc/framework/toolboxconfiguration.hxx b/framework/inc/framework/toolboxconfiguration.hxx new file mode 100644 index 000000000000..453d94810fbc --- /dev/null +++ b/framework/inc/framework/toolboxconfiguration.hxx @@ -0,0 +1,65 @@ +/************************************************************************* + * + * 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_XML_TOOLBOXCONFIGURATION_HXX_ +#define __FRAMEWORK_XML_TOOLBOXCONFIGURATION_HXX_ + +#include <framework/fwedllapi.h> +#include <svl/svarray.hxx> +#include <vcl/bitmap.hxx> +#include <tools/string.hxx> +#include <com/sun/star/io/XInputStream.hpp> +#ifndef _COM_SUN_STAR_IO_XOUPUTSTREAM_HPP_ +#include <com/sun/star/io/XOutputStream.hpp> +#endif +#include <com/sun/star/container/XIndexContainer.hpp> +#include <com/sun/star/container/XIndexAccess.hpp> + +// #110897# +#include <com/sun/star/lang/XMultiServiceFactory.hpp> + +namespace framework +{ + +class FWE_DLLPUBLIC ToolBoxConfiguration +{ + public: + // #110897# + static sal_Bool LoadToolBox( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rInputStream, + const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer >& rToolbarConfiguration ); + + // #110897# + static sal_Bool StoreToolBox( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& rOutputStream, + const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& rToolbarConfiguration ); +}; + +} // namespace framework + +#endif // __FRAMEWORK_XML_TOOLBOXCONFIGURATION_HXX_ diff --git a/framework/inc/framework/undomanagerhelper.hxx b/framework/inc/framework/undomanagerhelper.hxx new file mode 100755 index 000000000000..9cd7266b33c8 --- /dev/null +++ b/framework/inc/framework/undomanagerhelper.hxx @@ -0,0 +1,160 @@ +/************************************************************************* + * 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_UNDOMANAGERHELPER_HXX +#define FRAMEWORK_UNDOMANAGERHELPER_HXX + +#include "framework/fwedllapi.h" +#include "framework/iguard.hxx" +#include "framework/imutex.hxx" + +/** === begin UNO includes === **/ +#include <com/sun/star/document/XUndoManager.hpp> +#include <com/sun/star/util/XModifyListener.hpp> +/** === end UNO includes === **/ + +#include <boost/scoped_ptr.hpp> + +namespace svl +{ + class IUndoManager; +} + +//...................................................................................................................... +namespace framework +{ +//...................................................................................................................... + + //================================================================================================================== + //= IMutexGuard + //================================================================================================================== + class SAL_NO_VTABLE IMutexGuard : public IGuard + { + public: + /** returns the mutex guarded by the instance. + + Even if the guard currently has not a lock on the mutex, this method must succeed. + */ + virtual IMutex& getGuardedMutex() = 0; + }; + + //================================================================================================================== + //= IUndoManagerImplementation + //================================================================================================================== + class SAL_NO_VTABLE IUndoManagerImplementation + { + public: + /** returns the IUndoManager interface to the actual Undo stack + + @throws com::sun::star::lang::DisposedException + when the instance is already disposed, and no IUndoManager can be provided + + @throws com::sun::star::lang::NotInitializedException + when the instance is not initialized, yet, and no IUndoManager can be provided + */ + virtual ::svl::IUndoManager& getImplUndoManager() = 0; + + /** provides access to an UNO interface for the XUndoManager implementation. Used when throwing exceptions. + */ + virtual ::com::sun::star::uno::Reference< ::com::sun::star::document::XUndoManager > + getThis() = 0; + }; + + //================================================================================================================== + //= UndoManagerHelper + //================================================================================================================== + class UndoManagerHelper_Impl; + /** helper class for implementing an XUndoManager + + Several of the methods of the class take an IMutexGuard instance. It is assumed that this guard has a lock on + its mutext at the moment the method is entered. The lock will be released before any notifications to the + registered XUndoManagerListeners happen. + + The following locking strategy is used for this mutex: + <ul><li>Any notifications to the registered XUndoManagerListeners are after the guard has been cleared. i.e. + without the mutex being locked.</p> + <li>Any calls into the <code>IUndoManager</code> implementation is made without the mutex being locked. + Note that this implies that the <code>IUndoManager</code> implementation must be thread-safe in itself + (which is true for the default implementation, SfxUndoManager).</li> + <li>An exception to the previous item are the <member>IUndoManager::Undo</member> and + <member>IUndoManager::Redo</member> methods: They're called with the given external mutex being + locked.</li> + </ul> + + The reason for the exception for IUndoManager::Undo and IUndoManager::Redo is that those are expected to + modify the actual document which the UndoManager works for. And as long as our documents are not thread-safe, + and as long as we do not re-fit <strong>all</strong> existing SfxUndoImplementations to <em>not</em> expect + the dreaded SolarMutex being locked when they're called, the above behavior is a compromise between "how it should + be" and "how it can realistically be". + */ + class FWE_DLLPUBLIC UndoManagerHelper + { + public: + UndoManagerHelper( IUndoManagerImplementation& i_undoManagerImpl ); + ~UndoManagerHelper(); + + // life time control + void disposing(); + + // XUndoManager equivalents + void enterUndoContext( const ::rtl::OUString& i_title, IMutexGuard& i_instanceLock ); + void enterHiddenUndoContext( IMutexGuard& i_instanceLock ); + void leaveUndoContext( IMutexGuard& i_instanceLock ); + void addUndoAction( const ::com::sun::star::uno::Reference< ::com::sun::star::document::XUndoAction >& i_action, IMutexGuard& i_instanceLock ); + void undo( IMutexGuard& i_instanceLock ); + void redo( IMutexGuard& i_instanceLock ); + ::sal_Bool isUndoPossible() const; + ::sal_Bool isRedoPossible() const; + ::rtl::OUString getCurrentUndoActionTitle() const; + ::rtl::OUString getCurrentRedoActionTitle() const; + ::com::sun::star::uno::Sequence< ::rtl::OUString > + getAllUndoActionTitles() const; + ::com::sun::star::uno::Sequence< ::rtl::OUString > + getAllRedoActionTitles() const; + void clear( IMutexGuard& i_instanceLock ); + void clearRedo( IMutexGuard& i_instanceLock ); + void reset( IMutexGuard& i_instanceLock ); + void addUndoManagerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::document::XUndoManagerListener >& i_listener ); + void removeUndoManagerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::document::XUndoManagerListener >& i_listener ); + + // XLockable, base of XUndoManager, equivalents + void lock(); + void unlock(); + ::sal_Bool isLocked(); + + // XModifyBroadcaster equivalents + void addModifyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& i_listener ); + void removeModifyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& i_listener ); + + private: + ::boost::scoped_ptr< UndoManagerHelper_Impl > m_pImpl; + }; + +//...................................................................................................................... +} // namespace framework +//...................................................................................................................... + +#endif // FRAMEWORK_UNDOMANAGERHELPER_HXX diff --git a/framework/inc/fwidllapi.h b/framework/inc/fwidllapi.h new file mode 100644 index 000000000000..8f4b50cf77e0 --- /dev/null +++ b/framework/inc/fwidllapi.h @@ -0,0 +1,13 @@ +#ifndef INCLUDED_FWIDLLAPI_H +#define INCLUDED_FWIDLLAPI_H + +#include "sal/types.h" + +#if defined(FWI_DLLIMPLEMENTATION) +#define FWI_DLLPUBLIC SAL_DLLPUBLIC_EXPORT +#else +#define FWI_DLLPUBLIC SAL_DLLPUBLIC_IMPORT +#endif +#define FWI_DLLPRIVATE SAL_DLLPRIVATE + +#endif /* INCLUDED_FWIDLLAPI_H */ diff --git a/framework/inc/fwkdllapi.h b/framework/inc/fwkdllapi.h new file mode 100644 index 000000000000..a22303386b68 --- /dev/null +++ b/framework/inc/fwkdllapi.h @@ -0,0 +1,8 @@ +#ifndef INCLUDED_FWKDLLAPI_H +#define INCLUDED_FWKDLLAPI_H + +#include "sal/types.h" + +#include <fwidllapi.h> + +#endif /* INCLUDED_FWKDLLAPI_H */ diff --git a/framework/inc/general.h b/framework/inc/general.h new file mode 100644 index 000000000000..086bfdd2f1dd --- /dev/null +++ b/framework/inc/general.h @@ -0,0 +1,82 @@ +/************************************************************************* + * + * 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_GENERAL_H_ +#define __FRAMEWORK_GENERAL_H_ + +//============================================================================= +// includes + +#include <macros/generic.hxx> + +/* Normaly XInterface isnt used here ... + But we need it to be able to define namespace alias css to anything related to ::com::sun::star + :-) */ +#include <com/sun/star/uno/XInterface.hpp> + +#include <rtl/ustring.hxx> + +//============================================================================= +// namespace + +//----------------------------------------------------------------------------- +/** will make our code more readable if we can use such short name css instead + of typing ::com::sun::star everytimes. + + On the other side we had so many problems with "using namespace" so we dont use + it here any longer. + */ +namespace css = ::com::sun::star; + +namespace framework { + +//----------------------------------------------------------------------------- +/** status event mapped from load event of frame loader + + @todo think about me + should be moved to another more specific place. + */ +static const ::rtl::OUString FEATUREDESCRIPTOR_LOADSTATE = DECLARE_ASCII("loadFinishedOrCancelled"); + +//----------------------------------------------------------------------------- +/** Those macro is used to make it more clear where a synchronized block will start. + Because normal documentation code wont be recognized by some developers to be real + I need something where they are thinking about. + + At least this macro will do nothing ... it's empty. + But it should make the code more clear .-)) +*/ +#define SYNCHRONIZED_START + +//----------------------------------------------------------------------------- +/** Same then SYNCHRONIZED_START ... but instead it mark the end of such code block. +*/ +#define SYNCHRONIZED_END + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_GENERAL_H_ diff --git a/framework/inc/helper/dockingareadefaultacceptor.hxx b/framework/inc/helper/dockingareadefaultacceptor.hxx new file mode 100644 index 000000000000..1f11edf755d9 --- /dev/null +++ b/framework/inc/helper/dockingareadefaultacceptor.hxx @@ -0,0 +1,111 @@ +/************************************************************************* + * + * 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_HELPER_DOCKINGAREADEFAULTACCEPTOR_HXX_ +#define __FRAMEWORK_HELPER_DOCKINGAREADEFAULTACCEPTOR_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <classes/framecontainer.hxx> +#include <threadhelp/threadhelpbase.hxx> +#include <macros/generic.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/debug.hxx> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/ui/XDockingAreaAcceptor.hpp> +#include <com/sun/star/frame/XFrame.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <cppuhelper/implbase1.hxx> +#include <cppuhelper/weakref.hxx> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ + + +class DockingAreaDefaultAcceptor : private ThreadHelpBase , + public ::cppu::WeakImplHelper1< ::com::sun::star::ui::XDockingAreaAcceptor > +{ + public: + + //--------------------------------------------------------------------------------------------------------- + // constructor / destructor + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short constructor to initialize this instance + @descr A docking area acceptor + But we need a instance to create more then one enumerations to the same tasklist! + + @seealso class Desktop + @seealso class OTasksEnumeration + + @param "xOwner" is a reference to ouer owner and must be the desktop! + @param "pTasks" is a pointer to the taskcontainer of the desktop. We need it to create a new enumeration. + @return - + + @onerror Do nothing and reset this object to default with an empty list. + *//*-*****************************************************************************************************/ + + DockingAreaDefaultAcceptor( const css::uno::Reference< css::frame::XFrame >& xOwner ); + virtual ~DockingAreaDefaultAcceptor(); + + //--------------------------------------------------------------------------------------------------------- + // XDockingAreaAcceptor + //--------------------------------------------------------------------------------------------------------- + + virtual css::uno::Reference< css::awt::XWindow > SAL_CALL getContainerWindow() throw (css::uno::RuntimeException); + virtual sal_Bool SAL_CALL requestDockingAreaSpace( const css::awt::Rectangle& RequestedSpace ) throw (css::uno::RuntimeException); + virtual void SAL_CALL setDockingAreaSpace( const css::awt::Rectangle& BorderSpace ) throw (css::uno::RuntimeException); + + + //------------------------------------------------------------------------------------------------------------- + // variables + // (should be private everyway!) + //------------------------------------------------------------------------------------------------------------- + + private: + + css::uno::WeakReference< css::frame::XFrame > m_xOwner ; /// weak reference to our frame object! +}; + +} // namespace framework + +#endif // __FRAMEWORK_HELPER_DOCKINGAREADEFAULTACCEPTOR_HXX_ diff --git a/framework/inc/helper/fixeddocumentproperties.hxx b/framework/inc/helper/fixeddocumentproperties.hxx new file mode 100644 index 000000000000..8d6ef2031d9c --- /dev/null +++ b/framework/inc/helper/fixeddocumentproperties.hxx @@ -0,0 +1,57 @@ +#ifndef __FRAMEWORK_HELPER_FIXEDDOCUMENTPROPERTIES_HXX_ +#define __FRAMEWORK_HELPER_FIXEDDOCUMENTPROPERTIES_HXX_ + +#include <sal/types.h> +#include <rtl/ustring.hxx> +#include <com/sun/star/uno/Sequence.h> +#include <com/sun/star/util/DateTime.hpp> + +namespace framework +{ + +struct FixedDocumentProperties +{ + // fixed Properties (sort by name and used by OPropertySetHelper) + ::rtl::OUString m_sAuthor ; /// Creator of this document + sal_Bool m_bAutoloadEnabled ; /// Automatic reload enabled/disabled ? + sal_Int32 m_nAutoloadSecs ; /// Time cycle for automatic reload + ::rtl::OUString m_sAutoloadURL ; /// URL for automatic reload + ::rtl::OUString m_sBlindCopiesTo ; /// Adress for BCC + ::rtl::OUString m_sCopiesTo ; /// Adress CC + com::sun::star::util::DateTime m_aCreationDate ; /// Time and date of document creation + ::rtl::OUString m_sDefaultTarget ; /// Name of default target + ::rtl::OUString m_sDescription ; /// Short description and comments + sal_Int16 m_nEditingCycles ; /// Document number + sal_Int32 m_nEditingDuration ; /// Duration since last edit + com::sun::star::uno::Sequence< sal_Int8 > m_seqExtraData ; /// Buffer of bytes for some extra data + ::rtl::OUString m_sInReplyTo ; /// Adress for reply to ... + sal_Bool m_bIsEncrypted ; /// Document is en/decrypted + ::rtl::OUString m_sKeywords ; /// Some keywords + ::rtl::OUString m_sMIMEType ; /// MIME-type of document + ::rtl::OUString m_sModifiedBy ; /// Name of user who has modified as last one + com::sun::star::util::DateTime m_aModifyDate ; /// Date and time of last modification + ::rtl::OUString m_sNewsgroups ; /// Document is a message of newsgroup + ::rtl::OUString m_sOriginal ; /// Message ID + sal_Bool m_bPortableGraphics ; /// Use of portable graphics + com::sun::star::util::DateTime m_aPrintDate ; /// Date and time of last print + ::rtl::OUString m_sPrintedBy ; /// Name of user who has printed as last one + sal_uInt16 m_nPriority ; /// Priority of message, if document a message! + sal_Bool m_bQueryTemplate ; /// Search for template ? + ::rtl::OUString m_sRecipient ; /// Name of recipient + ::rtl::OUString m_sReferences ; /// Some references to other things + ::rtl::OUString m_sReplyTo ; /// Adress to reply + sal_Bool m_bSaveGraphicsCompressed ; /// Compressed/non compressed graphics + sal_Bool m_bSaveOriginalGraphics ; /// Include graphics + sal_Bool m_bSaveVersionOnClose ; /// Save version on close of document ? + ::rtl::OUString m_sTemplate ; /// Name of template + sal_Bool m_bTemplateConfig ; /// Exist template config ? + com::sun::star::util::DateTime m_aTemplateDate ; /// Date and time of template + ::rtl::OUString m_sTemplateFileName ; /// File name of template + ::rtl::OUString m_sTheme ; /// Name of theme + ::rtl::OUString m_sTitle ; /// Title of document + sal_Bool m_bUserData ; /// Exist user data ? +}; + +} + +#endif // __FRAMEWORK_SERVICES_FIXEDDOCUMENTPROPERTIES_HXX_ diff --git a/framework/inc/helper/ilayoutnotifications.hxx b/framework/inc/helper/ilayoutnotifications.hxx new file mode 100755 index 000000000000..db63ea15c7b4 --- /dev/null +++ b/framework/inc/helper/ilayoutnotifications.hxx @@ -0,0 +1,52 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: layoutmanager.hxx,v $ + * $Revision: 1.34 $ + * + * 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_LAYOUTMANAGER_ILAYOUTNOTIFICATIONS_HXX_ +#define __FRAMEWORK_LAYOUTMANAGER_ILAYOUTNOTIFICATIONS_HXX_ + +namespace framework +{ + +class ILayoutNotifications +{ + public: + enum Hint + { + HINT_NOT_SPECIFIED, + HINT_TOOLBARSPACE_HAS_CHANGED, + HINT_COUNT + }; + + virtual void requestLayout( Hint eHint = HINT_NOT_SPECIFIED ) = 0; +}; + +} + +#endif // __FRAMEWORK_LAYOUTMANAGER_ILAYOUTNOTIFICATIONS_HXX_ diff --git a/framework/inc/helper/mischelper.hxx b/framework/inc/helper/mischelper.hxx new file mode 100755 index 000000000000..5698974930ca --- /dev/null +++ b/framework/inc/helper/mischelper.hxx @@ -0,0 +1,125 @@ +/************************************************************************* + * + * 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 __MISC_HELPER_HXX_ +#define __MISC_HELPER_HXX_ + +#include <com/sun/star/linguistic2/XLanguageGuessing.hpp> +#include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/frame/XFrame.hpp> + +#include <i18npool/lang.h> +#include <svl/languageoptions.hxx> +#include <rtl/ustring.hxx> +#include <fwidllapi.h> + +#include <set> + +class SvtLanguageTable; + + +// flags for script types in use within selection +#define LS_SCRIPT_LATIN 0x0001 +#define LS_SCRIPT_ASIAN 0x0002 +#define LS_SCRIPT_COMPLEX 0x0004 + + +namespace framework +{ + +// menu ids for language status bar control +enum LangMenuIDs +{ + MID_LANG_SEL_1 = 1, // need to start with 1 since xPopupMenu->execute will return 0 if the menu is cancelled + MID_LANG_SEL_2, + MID_LANG_SEL_3, + MID_LANG_SEL_4, + MID_LANG_SEL_5, + MID_LANG_SEL_6, + MID_LANG_SEL_7, + MID_LANG_SEL_8, + MID_LANG_SEL_9, + MID_LANG_SEL_NONE, + MID_LANG_SEL_RESET, + MID_LANG_SEL_MORE, + + MID_LANG_PARA_SEPERATOR, + MID_LANG_PARA_STRING, + + MID_LANG_PARA_1, + MID_LANG_PARA_2, + MID_LANG_PARA_3, + MID_LANG_PARA_4, + MID_LANG_PARA_5, + MID_LANG_PARA_6, + MID_LANG_PARA_7, + MID_LANG_PARA_8, + MID_LANG_PARA_9, + MID_LANG_PARA_NONE, + MID_LANG_PARA_RESET, + MID_LANG_PARA_MORE, +}; + + +inline bool IsScriptTypeMatchingToLanguage( sal_Int16 nScriptType, LanguageType nLang ) +{ + return 0 != (nScriptType & SvtLanguageOptions::GetScriptTypeOfLanguage( nLang )); +} + + +class FWI_DLLPUBLIC LanguageGuessingHelper +{ + mutable ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XLanguageGuessing > m_xLanguageGuesser; + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; + +public: + LanguageGuessingHelper(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xServiceManager) : m_xServiceManager(_xServiceManager){} + + ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XLanguageGuessing > GetGuesser() const; +}; + +FWI_DLLPUBLIC ::rtl::OUString RetrieveLabelFromCommand( const ::rtl::OUString& aCmdURL + ,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xServiceFactory + ,::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _xUICommandLabels + ,const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _xFrame + ,::rtl::OUString& _rModuleIdentifier + ,sal_Bool& _rIni + ,const sal_Char* _pName); + +FWI_DLLPUBLIC void FillLangItems( std::set< ::rtl::OUString > &rLangItems, + const SvtLanguageTable &rLanguageTable, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > &rxFrame, + const LanguageGuessingHelper & rLangGuessHelper, + sal_Int16 nScriptType, + const ::rtl::OUString & rCurLang, + const ::rtl::OUString & rKeyboardLang, + const ::rtl::OUString & rGuessedTextLang ); + +} // namespace framework + +#endif // __MISC_HELPER_HXX_ + diff --git a/framework/inc/helper/networkdomain.hxx b/framework/inc/helper/networkdomain.hxx new file mode 100644 index 000000000000..55db4bf708dc --- /dev/null +++ b/framework/inc/helper/networkdomain.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_HELPER_NETWORKDOMAIN_HXX_ +#define __FRAMEWORK_HELPER_NETWORKDOMAIN_HXX_ + +#include <rtl/ustring.hxx> +#include <fwidllapi.h> + +namespace framework +{ + +class FWI_DLLPUBLIC NetworkDomain +{ + public: + static rtl::OUString GetNTDomainName(); + static rtl::OUString GetYPDomainName(); +}; + +} + +#endif // __FRAMEWORK_HELPER_NETWORKDOMAIN_HXX_ diff --git a/framework/inc/helper/ocomponentaccess.hxx b/framework/inc/helper/ocomponentaccess.hxx new file mode 100644 index 000000000000..ec5161ef5335 --- /dev/null +++ b/framework/inc/helper/ocomponentaccess.hxx @@ -0,0 +1,275 @@ +/************************************************************************* + * + * 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_HELPER_OCOMPONENTACCESS_HXX_ +#define __FRAMEWORK_HELPER_OCOMPONENTACCESS_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <threadhelp/threadhelpbase.hxx> +#include <macros/generic.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/debug.hxx> +#include <general.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/frame/XFramesSupplier.hpp> +#include <com/sun/star/container/XEnumerationAccess.hpp> +#include <com/sun/star/container/XElementAccess.hpp> +#include <com/sun/star/container/XEnumeration.hpp> +#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/lang/XComponent.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <cppuhelper/implbase1.hxx> +#include <cppuhelper/weakref.hxx> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ +// exported const +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// exported definitions +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short implement XEnumerationAccess interface as helper to create many oneway enumeration of components + @descr We share mutex and framecontainer with ouer owner and have full access to his child tasks. + (Ouer owner can be the Desktop only!) We create oneway enumerations on demand. These "lists" + can be used for one time only. Step during the list from first to last element. + (The type of created enumerations is OComponentEnumeration.) + + @implements XInterface + XTypeProvider + XEnumerationAccess + XElementAccess + + @base ThreadHelpBase + OWeakObject + + @devstatus ready to use +*//*-*************************************************************************************************************/ + +class OComponentAccess : private ThreadHelpBase , // Must be the first of baseclasses - Is neccessary for right initialization of objects! + public ::cppu::WeakImplHelper1< ::com::sun::star::container::XEnumerationAccess > +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + + public: + + //--------------------------------------------------------------------------------------------------------- + // constructor / destructor + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short constructor to initialize this instance + @descr A desktop will create an enumeration-access-object. An enumeration is a oneway-list and a + snapshot of the components of current tasks under the desktop. + But we need a instance to create more then one enumerations at different times! + + @seealso class Desktop + @seealso class OComponentEnumeration + + @param "xOwner" is a reference to ouer owner and must be the desktop! + @return - + + @onerror Do nothing and reset this object to default with an empty list. + *//*-*****************************************************************************************************/ + + OComponentAccess( const css::uno::Reference< css::frame::XDesktop >& xOwner ); + + //--------------------------------------------------------------------------------------------------------- + // XEnumerationAccess + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short create a new enumeration of components + @descr You can call this method to get a new snapshot from all components of all tasks of the desktop as an enumeration. + + @seealso interface XEnumerationAccess + @seealso interface XEnumeration + @seealso class Desktop + + @param - + @return If the desktop and some components exist => a valid reference to an enumeration<BR> + An NULL-reference, other way. + + @onerror - + *//*-*****************************************************************************************************/ + + virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw( css::uno::RuntimeException ); + + //--------------------------------------------------------------------------------------------------------- + // XElementAccess + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short get the type of elements in enumeration + @descr - + + @seealso interface XElementAccess + @seealso class OComponentEnumeration + + @param - + @return The uno-type XComponent. + + @onerror - + *//*-*****************************************************************************************************/ + + virtual css::uno::Type SAL_CALL getElementType() throw( css::uno::RuntimeException ); + + /*-****************************************************************************************************//** + @short get state of componentlist of enumeration. + @descr - + + @seealso interface XElementAccess + + @param - + @return sal_True ,if more then 0 elements exist. + @return sal_False ,otherwise. + + @onerror - + *//*-*****************************************************************************************************/ + + virtual sal_Bool SAL_CALL hasElements() throw( css::uno::RuntimeException ); + + //------------------------------------------------------------------------------------------------------------- + // protected methods + //------------------------------------------------------------------------------------------------------------- + + protected: + + /*-****************************************************************************************************//** + @short standard destructor + @descr This method destruct an instance of this class and clear some member. + Don't use an instance of this class as normal member. Use it dynamicly with a pointer. + We hold a weakreference to ouer owner and not to ouer superclass! + Thats the reason for a protected dtor. + + @seealso class Desktop + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual ~OComponentAccess(); + + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + + private: + + /*-****************************************************************************************************//** + @short recursive method (!) to collect all components of all frames from the subtree of given node + @descr This is neccessary to create the enumeration. + + @seealso method createEnumeration + + @param "xNode" , root of subtree and start point of search + @param "seqComponents", result list of search. We cant use a return value, we search recursive + and must collect all informations. + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + void impl_collectAllChildComponents( const css::uno::Reference< css::frame::XFramesSupplier >& xNode , + css::uno::Sequence< css::uno::Reference< css::lang::XComponent > >& seqComponents ); + + /*-****************************************************************************************************//** + @short get the component of a frame + @descr The component of a frame can be the window, the controller or the model. + + @seealso method createEnumeration + + @param "xFrame", frame which contains the component + @return A reference to the component of given frame. + + @onerror A null reference is returned. + *//*-*****************************************************************************************************/ + + css::uno::Reference< css::lang::XComponent > impl_getFrameComponent( const css::uno::Reference< css::frame::XFrame >& xFrame ) const; + + //------------------------------------------------------------------------------------------------------------- + // 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. + @return sal_True ,otherwise + + @onerror - + *//*-*****************************************************************************************************/ + + #ifdef ENABLE_ASSERTIONS + + private: + + static sal_Bool impldbg_checkParameter_OComponentAccessCtor( const css::uno::Reference< css::frame::XDesktop >& xOwner ); + + #endif // #ifdef ENABLE_ASSERTIONS + + //------------------------------------------------------------------------------------------------------------- + // variables + // (should be private everyway!) + //------------------------------------------------------------------------------------------------------------- + + private: + + css::uno::WeakReference< css::frame::XDesktop > m_xOwner ; /// weak reference to the desktop object! + +}; // class OComponentAccess + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_HELPER_OCOMPONENTACCESS_HXX_ diff --git a/framework/inc/helper/ocomponentenumeration.hxx b/framework/inc/helper/ocomponentenumeration.hxx new file mode 100644 index 000000000000..e3fce4bcac35 --- /dev/null +++ b/framework/inc/helper/ocomponentenumeration.hxx @@ -0,0 +1,262 @@ +/************************************************************************* + * + * 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_HELPER_OCOMPONENTENUMERATION_HXX_ +#define __FRAMEWORK_HELPER_OCOMPONENTENUMERATION_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#ifndef __FRAMEWORK_OMUTEXMEMBER_HXX_ +#include <threadhelp/threadhelpbase.hxx> +#endif +#include <macros/generic.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/debug.hxx> +#include <general.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/lang/XEventListener.hpp> +#include <com/sun/star/container/XEnumeration.hpp> +#include <com/sun/star/lang/XComponent.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <cppuhelper/implbase2.hxx> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ +// exported const +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// exported definitions +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short implement a helper for a oneway enumeration of components + @descr You can step during this list only for one time! Its a snapshot. + Don't forget to release the reference. You are the owner of an instance of this implementation. + You cant use this as a baseclass. Please use it as a dynamical object for return. + + @implements XInterface + XTypeProvider + XEventListener + XEnumeration + + @base ThreadHelpBase + OWeakObject + + @devstatus ready to use + @threadsafe yes +*//*-*************************************************************************************************************/ + +class OComponentEnumeration : public ThreadHelpBase , + public ::cppu::WeakImplHelper2< ::com::sun::star::container::XEnumeration,::com::sun::star::lang::XEventListener > +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + + public: + + //--------------------------------------------------------------------------------------------------------- + // constructor / destructor + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short constructor to initialize this enumeration + @descr An enumeration is a list with oneway-access! You can get every member only for one time. + This method allow to initialize this oneway list with values. + + @seealso - + + @param "seqComponents" is a sequence of interfaces, which are components. + @return - + + @onerror Do nothing and reset this object to default with an empty list. + *//*-*****************************************************************************************************/ + + OComponentEnumeration( const css::uno::Sequence< css::uno::Reference< css::lang::XComponent > >& seqComponents ); + + //--------------------------------------------------------------------------------------------------------- + // XEventListener + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short last chance to release all references and free memory + @descr This method is called, if the enumeration is used completly and has no more elements. + Then we must destroy ouer list and release all references to other objects. + + @seealso interface XEventListener + + @param "aEvent" describe the source of this event. + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL disposing( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException ); + + //--------------------------------------------------------------------------------------------------------- + // XEnumeration + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short check count of accessible elements of enumeration + @descr You can call this method to get information about accessible elements in future. + Elements you have already getted are not accessible! + + @seealso interface XEnumeration + + @param - + @return sal_True = if more elements accessible<BR> + sal_False = other way + + @onerror sal_False<BR> + (List is emtpy and there no accessible elements ...) + *//*-*****************************************************************************************************/ + + virtual sal_Bool SAL_CALL hasMoreElements() throw( css::uno::RuntimeException ); + + /*-****************************************************************************************************//** + @short give the next element, if some exist + @descr If a call "hasMoreElements()" return true, you can get the next element of list. + + @seealso interface XEnumeration + + @param - + @return A Reference to a component, safed in an Any-structure. + + @onerror If end of enumeration is arrived or there are no elements in list => a NoSuchElementException is thrown. + *//*-*****************************************************************************************************/ + + virtual css::uno::Any SAL_CALL nextElement() throw( css::container::NoSuchElementException , + css::lang::WrappedTargetException , + css::uno::RuntimeException ); + + //------------------------------------------------------------------------------------------------------------- + // protected methods + //------------------------------------------------------------------------------------------------------------- + + protected: + + /*-****************************************************************************************************//** + @short standard destructor + @descr This method destruct an instance of this class and clear some member. + We make it protected, because its not supported to use this class as normal instance! + You must create it dynamical in memory and use a pointer. + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual ~OComponentEnumeration(); + + /*-****************************************************************************************************//** + @short reset instance to default values + + @descr There are two ways to delete an instance of this class.<BR> + 1) delete with destructor<BR> + 2) dispose from parent or factory ore ...<BR> + This method do the same for both ways! It free used memory and release references ... + + @seealso method dispose() + @seealso destructor ~TaskEnumeration() + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void impl_resetObject(); + + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + + private: + + //------------------------------------------------------------------------------------------------------------- + // 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 ASSERT in implementation! + + @param references to checking variables + @return sal_False on invalid parameter<BR> + sal_True otherway + + @onerror - + *//*-*****************************************************************************************************/ + + #ifdef ENABLE_ASSERTIONS + + private: + + static sal_Bool impldbg_checkParameter_OComponentEnumerationCtor ( const css::uno::Sequence< css::uno::Reference< css::lang::XComponent > >& seqComponents ); + static sal_Bool impldbg_checkParameter_disposing ( const css::lang::EventObject& aEvent ); + + #endif // #ifdef ENABLE_ASSERTIONS + + //------------------------------------------------------------------------------------------------------------- + // variables + // (should be private everyway!) + //------------------------------------------------------------------------------------------------------------- + + private: + + sal_uInt32 m_nPosition ; /// current position in enumeration + css::uno::Sequence< css::uno::Reference< css::lang::XComponent > > m_seqComponents ; /// list of current components + +}; // class OComponentEnumeration + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_HELPER_OCOMPONENTENUMERATION_HXX_ diff --git a/framework/inc/helper/oframes.hxx b/framework/inc/helper/oframes.hxx new file mode 100644 index 000000000000..725b6aeb9394 --- /dev/null +++ b/framework/inc/helper/oframes.hxx @@ -0,0 +1,355 @@ +/************************************************************************* + * + * 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_HELPER_OFRAMES_HXX_ +#define __FRAMEWORK_HELPER_OFRAMES_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <classes/framecontainer.hxx> +#include <threadhelp/threadhelpbase.hxx> +#include <macros/generic.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/debug.hxx> +#include <general.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/frame/XFrames.hpp> +#include <com/sun/star/frame/XFrame.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <cppuhelper/implbase1.hxx> +#include <cppuhelper/weakref.hxx> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ +// exported const +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// exported definitions +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short implement XFrames, XIndexAccess and XElementAccess interfaces as helper for services + @descr Use this class as helper for these interfaces. We share mutex and framecontainer with ouer owner. + The framecontainer is a member of it from type "FrameContainer". That means; + we have the same information as ouer owner. In current implementation we use mutex and lock-mechanism + to prevent against compete access. In future we plan support of semaphore! + + @devstatus deprecated + @implements XInterface + XFrames + XIndexAccess + XElementAccess + @base OWeakObject + + @ATTENTION Don't use this class as direct member - use it dynamicly. Do not derive from this class. + We hold a weakreference to ouer owner not to ouer superclass. + + @devstatus deprecated +*//*-*************************************************************************************************************/ + +class OFrames : private ThreadHelpBase , // Must be the first of baseclasses - Is neccessary for right initialization of objects! + public ::cppu::WeakImplHelper1< ::com::sun::star::frame::XFrames > +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + + public: + + //--------------------------------------------------------------------------------------------------------- + // constructor / destructor + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short standard ctor + @descr These initialize a new instance of this class with all needed informations for work. + We share framecontainer with owner implementation! It's a threadsafe container. + + @seealso - + + @param "xFactory" , reference to factory which has created ouer owner(!). We can use these to create new uno-services. + @param "xOwner" , reference to ouer owner. We hold a wekreference to prevent us against cross-references! + @param "pFrameContainer" , pointer to shared framecontainer of owner. It's valid only, if weakreference is valid! + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + OFrames( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory , + const css::uno::Reference< css::frame::XFrame >& xOwner , + FrameContainer* pFrameContainer ); + + //--------------------------------------------------------------------------------------------------------- + // XFrames + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short append frame to container + @descr We share the container with ouer owner. We can do this only, if no lock is set on container. + Valid references are accepted only! + + @seealso class FrameContainer + + @param "xFrame", reference to an existing frame to append. + @return - + + @onerror We do nothing in release or throw an assert in debug version. + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL append( const css::uno::Reference< css::frame::XFrame >& xFrame ) throw( css::uno::RuntimeException ); + + /*-****************************************************************************************************//** + @short remove frame from container + @descr This is the companion to append(). We only accept valid references and don't work, if + a lock is set. + + @seealso class FrameContainer + + @param "xFrame", reference to an existing frame to remove. + @return - + + @onerror We do nothing in release or throw an assert in debug version. + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL remove( const css::uno::Reference< css::frame::XFrame >& xFrame ) throw( css::uno::RuntimeException ); + + /*-****************************************************************************************************//** + @short return list of all applicable frames for given flags + @descr Call these to get a list of all frames, which are match with given search flags. + + @seealso - + + @param "nSearchFlag", flags to search right frames. + @return A list of founded frames. + + @onerror An empty list is returned. + *//*-*****************************************************************************************************/ + + virtual css::uno::Sequence< css::uno::Reference< css::frame::XFrame > > SAL_CALL queryFrames( sal_Int32 nSearchFlags ) throw( css::uno::RuntimeException ); + + //--------------------------------------------------------------------------------------------------------- + // XIndexAccess + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short get count of all current frames in container + @descr This is the beginning of full index-access. With a count you can step over all items in container. + Next call shuoöd be getByIndex(). But these mechanism works only, if no lock in container is set! + + @seealso class FrameContainer + @seealso method getByIndex() + + @param - + @return Count of current items in container. + + @onerror If a lock is set, we return 0 for prevent further access! + *//*-*****************************************************************************************************/ + + virtual sal_Int32 SAL_CALL getCount() throw( css::uno::RuntimeException ); + + /*-****************************************************************************************************//** + @short get specified container item by index + @descr If you called getCount() successful - this method return the specified element as an Any. + You must observe the range from 0 to count-1! Otherwise an IndexOutOfBoundsException is thrown. + + @seealso class FrameContainer + @seealso method getCount() + + @param "nIndex", valid index to get container item. + @return A container item (specified by index) wrapped in an Any. + + @onerror If a lock is set, we return an empty Any! + @onerror If index out of range, an IndexOutOfBoundsException is thrown. + *//*-*****************************************************************************************************/ + + virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 nIndex ) throw( css::lang::IndexOutOfBoundsException , + css::lang::WrappedTargetException , + css::uno::RuntimeException ); + + //--------------------------------------------------------------------------------------------------------- + // XElementAccess + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short get uno-type of all container items + @descr In current implementation type is fixed to XFrame! + (container-lock is ignored) + + @seealso - + + @param - + @return A uno-type descriptor. + + @onerror - + *//*-*****************************************************************************************************/ + + virtual css::uno::Type SAL_CALL getElementType() throw( css::uno::RuntimeException ); + + /*-****************************************************************************************************//** + @short get fill state of current container + @descr Call these to get information about, if items exist in container or not. + (container-lock is ignored) + + @seealso - + + @param - + @return sal_True, if container contains some items. + @return sal_False, otherwise. + + @onerror We return sal_False. + *//*-*****************************************************************************************************/ + + virtual sal_Bool SAL_CALL hasElements() throw( css::uno::RuntimeException ); + + //------------------------------------------------------------------------------------------------------------- + // protected methods + //------------------------------------------------------------------------------------------------------------- + + protected: + + /*-****************************************************************************************************//** + @short standard destructor + @descr This method destruct an instance of this class and clear some member. + This method is protected, because its not allowed to use this class as a member! + You MUST use a dynamical instance (pointer). That's the reason for a protected dtor. + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual ~OFrames(); + + /*-****************************************************************************************************//** + @short reset instance to default values + @descr There are two ways to delete an instance of this class.<BR> + 1) delete with destructor<BR> + 2) dispose from parent or factory ore ...<BR> + This method do the same for both ways! It free used memory and release references ... + + @seealso method dispose() (if it exist!) + @seealso destructor ~TaskEnumeration() + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void impl_resetObject(); + + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + + private: + + /*-****************************************************************************************************//** + @short append one sequence to another + @descr There is no operation to add to sequences! Use this helper-method to do this. + + @seealso class Sequence + + @param "seqDestination", reference to sequence on which operation will append the other sequence. + @param "seqSource" , reference to sequence for append. + @return "seqDestination" is parameter AND return value at the same time. + + @onerror - + *//*-*****************************************************************************************************/ + + void impl_appendSequence( css::uno::Sequence< css::uno::Reference< css::frame::XFrame > >& seqDestination , + const css::uno::Sequence< css::uno::Reference< css::frame::XFrame > >& seqSource ); + + //------------------------------------------------------------------------------------------------------------- + // 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 + @return sal_True ,otherwise + + @onerror - + *//*-*****************************************************************************************************/ + + #ifdef ENABLE_ASSERTIONS + + private: + + static sal_Bool impldbg_checkParameter_OFramesCtor ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory , + const css::uno::Reference< css::frame::XFrame >& xOwner , + FrameContainer* pFrameContainer ); + static sal_Bool impldbg_checkParameter_append ( const css::uno::Reference< css::frame::XFrame >& xFrame ); + static sal_Bool impldbg_checkParameter_remove ( const css::uno::Reference< css::frame::XFrame >& xFrame ); + static sal_Bool impldbg_checkParameter_queryFrames ( sal_Int32 nSearchFlags ); + + #endif // #ifdef ENABLE_ASSERTIONS + + //------------------------------------------------------------------------------------------------------------- + // variables + // (should be private everyway!) + //------------------------------------------------------------------------------------------------------------- + + private: + + css::uno::Reference< css::lang::XMultiServiceFactory > m_xFactory ; /// reference to global servicemanager + css::uno::WeakReference< css::frame::XFrame > m_xOwner ; /// reference to owner of this instance (Hold no hard reference!) + FrameContainer* m_pFrameContainer ; /// with owner shared list to hold all direct childs of an XFramesSupplier + sal_Bool m_bRecursiveSearchProtection ; /// flag to protect against recursive searches of frames at parents + +}; // class OFrames + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_HELPER_OFRAMES_HXX_ diff --git a/framework/inc/helper/otasksaccess.hxx b/framework/inc/helper/otasksaccess.hxx new file mode 100644 index 000000000000..d81e73d684f1 --- /dev/null +++ b/framework/inc/helper/otasksaccess.hxx @@ -0,0 +1,254 @@ +/************************************************************************* + * + * 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_HELPER_OTASKSACCESS_HXX_ +#define __FRAMEWORK_HELPER_OTASKSACCESS_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <classes/framecontainer.hxx> +#include <threadhelp/threadhelpbase.hxx> +#include <macros/generic.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/debug.hxx> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/container/XEnumerationAccess.hpp> +#include <com/sun/star/container/XElementAccess.hpp> +#include <com/sun/star/container/XEnumeration.hpp> +#include <com/sun/star/frame/XDesktop.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <cppuhelper/weak.hxx> +#include <cppuhelper/weakref.hxx> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ +// exported const +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// exported definitions +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short implement XEnumerationAccess interface as helper to create many oneway enumeration of tasks + @descr We share mutex and framecontainer with ouer owner and have full access to his child tasks. + (Ouer owner can be the Desktop only!) We create oneway enumerations on demand. These "lists" + can be used for one time only. Step during the list from first to last element. + (The type of created enumerations is OTasksEnumeration.) + + @implements XInterface + XEnumerationAccess + XElementAccess + + @base OWeakObject + + @devstatus deprecated +*//*-*************************************************************************************************************/ + +class OTasksAccess : public css::lang::XTypeProvider , + public css::container::XEnumerationAccess , // => XElementAccess + private ThreadHelpBase , + public ::cppu::OWeakObject +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + + public: + + //--------------------------------------------------------------------------------------------------------- + // constructor / destructor + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short constructor to initialize this instance + @descr A desktop will create an enumeration-access-object. An enumeration is a oneway-list and a + snapshot of the tasklist of current tasks of desktop. + But we need a instance to create more then one enumerations to the same tasklist! + + @seealso class Desktop + @seealso class OTasksEnumeration + + @param "xOwner" is a reference to ouer owner and must be the desktop! + @param "pTasks" is a pointer to the taskcontainer of the desktop. We need it to create a new enumeration. + @return - + + @onerror Do nothing and reset this object to default with an empty list. + *//*-*****************************************************************************************************/ + + OTasksAccess( const css::uno::Reference< css::frame::XDesktop >& xOwner , + FrameContainer* pTasks ); + + //--------------------------------------------------------------------------------------------------------- + // XInterface + //--------------------------------------------------------------------------------------------------------- + + DECLARE_XINTERFACE + DECLARE_XTYPEPROVIDER + + //--------------------------------------------------------------------------------------------------------- + // XEnumerationAccess + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short create a new enumeration of tasks + @descr You can call this method to get a new snapshot to all tasks of the desktop as an enumeration. + + @seealso interface XEnumerationAccess + @seealso interface XEnumeration + @seealso class Desktop + + @param - + @return If the desktop and some tasks exist => a valid reference to an enumeration<BR> + An NULL-reference, other way. + + @onerror - + *//*-*****************************************************************************************************/ + + virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw( css::uno::RuntimeException ); + + //--------------------------------------------------------------------------------------------------------- + // XElementAccess + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short get the type of elements in enumeration + @descr - + + @seealso interface XElementAccess + @seealso class TasksEnumeration + + @param - + @return The uno-type XTask. + + @onerror - + *//*-*****************************************************************************************************/ + + virtual css::uno::Type SAL_CALL getElementType() throw( css::uno::RuntimeException ); + + /*-****************************************************************************************************//** + @short get state of tasklist of enumeration. + @descr - + + @seealso interface XElementAccess + + @param - + @return sal_True ,if more then 0 elements exist. + @return sal_False ,otherwise. + + @onerror - + *//*-*****************************************************************************************************/ + + virtual sal_Bool SAL_CALL hasElements() throw( css::uno::RuntimeException ); + + //------------------------------------------------------------------------------------------------------------- + // protected methods + //------------------------------------------------------------------------------------------------------------- + + protected: + + /*-****************************************************************************************************//** + @short standard destructor + @descr This method destruct an instance of this class and clear some member. + Don't use an instance of this class as normal member. Use it dynamicly with a pointer. + We hold a weakreference to ouer owner and not to ouer superclass! + Thats the reason for a protected dtor. + + @seealso class Desktop + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual ~OTasksAccess(); + + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + + private: + + //------------------------------------------------------------------------------------------------------------- + // 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. + @return sal_True ,otherwise + + @onerror - + *//*-*****************************************************************************************************/ + + #ifdef ENABLE_ASSERTIONS + + private: + + static sal_Bool impldbg_checkParameter_OTasksAccessCtor( const css::uno::Reference< css::frame::XDesktop >& xOwner , + FrameContainer* pTasks ); + + #endif // #ifdef ENABLE_ASSERTIONS + + //------------------------------------------------------------------------------------------------------------- + // variables + // (should be private everyway!) + //------------------------------------------------------------------------------------------------------------- + + private: + + css::uno::WeakReference< css::frame::XDesktop > m_xOwner ; /// weak reference to the desktop object! + FrameContainer* m_pTasks ; /// pointer to list of current tasks on desktop (is a member of class Desktop!) + /// This pointer is valid only, if weakreference can be locked. + +}; // class OTasksAccess + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_HELPER_OTASKSACCESS_HXX_ diff --git a/framework/inc/helper/otasksenumeration.hxx b/framework/inc/helper/otasksenumeration.hxx new file mode 100644 index 000000000000..acbcb5b3b050 --- /dev/null +++ b/framework/inc/helper/otasksenumeration.hxx @@ -0,0 +1,272 @@ +/************************************************************************* + * + * 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_HELPER_OTASKSENUMERATION_HXX_ +#define __FRAMEWORK_HELPER_OTASKSENUMERATION_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#ifndef __FRAMEWORK_OMUTEXMEMBER_HXX_ +#include <threadhelp/threadhelpbase.hxx> +#endif +#include <macros/generic.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/debug.hxx> +#include <general.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/lang/XEventListener.hpp> +#include <com/sun/star/container/XEnumeration.hpp> +#include <com/sun/star/frame/XTask.hpp> +#include <com/sun/star/frame/XFrame.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <cppuhelper/weak.hxx> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ +// exported const +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// exported definitions +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short implement a helper for a oneway enumeration of tasks + @descr You can step during this list only for one time! Its a snapshot. + Don't forget to release the reference. You are the owner of an instance of this implementation. + You cant use this as a baseclass. Please use it as a dynamical object for return. + + @implements XInterface + XTypeProvider + XEventListener + XEnumeration + + @base ThreadHelpBase + OWeakObject + + @devstatus ready to use +*//*-*************************************************************************************************************/ + +class OTasksEnumeration : public css::lang::XTypeProvider , + public css::lang::XEventListener , + public css::container::XEnumeration , + public ThreadHelpBase , + public ::cppu::OWeakObject +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + + public: + + //--------------------------------------------------------------------------------------------------------- + // constructor / destructor + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short constructor to initialize this enumeration + @descr An enumeration is a list with oneway-access! You can get every member only for one time. + This method allow to initialize this oneway list with values. + + @seealso - + + @param "seqTasks" is a sequence of interfaces, which are tasks. + @return - + + @onerror Do nothing and reset this object to default with an empty list. + *//*-*****************************************************************************************************/ + + OTasksEnumeration( const css::uno::Sequence< css::uno::Reference< css::frame::XFrame > >& seqTasks ); + + //--------------------------------------------------------------------------------------------------------- + // XInterface + //--------------------------------------------------------------------------------------------------------- + + DECLARE_XINTERFACE + DECLARE_XTYPEPROVIDER + + //--------------------------------------------------------------------------------------------------------- + // XEventListener + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short last chance to release all references and free memory + @descr This method is called, if the enumeration is used completly and has no more elements. + Then we must destroy ouer list and release all references to other objects. + + @seealso interface XEventListener + + @param "aEvent" describe the source of this event. + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL disposing( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException ); + + //--------------------------------------------------------------------------------------------------------- + // XEnumeration + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short check count of accessible elements of enumeration + @descr You can call this method to get information about accessible elements in future. + Elements you have already getted are not accessible! + + @seealso interface XEnumeration + + @param - + @return sal_True = if more elements accessible<BR> + sal_False = other way + + @onerror sal_False<BR> + (List is emtpy and there no accessible elements ...) + *//*-*****************************************************************************************************/ + + virtual sal_Bool SAL_CALL hasMoreElements() throw( css::uno::RuntimeException ); + + /*-****************************************************************************************************//** + @short give the next element, if some exist + @descr If a call "hasMoreElements()" return true, you can get the next element of list. + + @seealso interface XEnumeration + + @param - + @return A Reference to a task, safed in an Any-structure. + + @onerror If end of enumeration is arrived or there are no elements in list => a NoSuchElementException is thrown. + *//*-*****************************************************************************************************/ + + virtual css::uno::Any SAL_CALL nextElement() throw( css::container::NoSuchElementException , + css::lang::WrappedTargetException , + css::uno::RuntimeException ); + + //------------------------------------------------------------------------------------------------------------- + // protected methods + //------------------------------------------------------------------------------------------------------------- + + protected: + + /*-****************************************************************************************************//** + @short standard destructor + @descr This method destruct an instance of this class and clear some member. + We make it protected, because its not supported to use this class as normal instance! + You must create it dynamical in memory and use a pointer. + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual ~OTasksEnumeration(); + + /*-****************************************************************************************************//** + @short reset instance to default values + + @descr There are two ways to delete an instance of this class.<BR> + 1) delete with destructor<BR> + 2) dispose from parent or factory ore ...<BR> + This method do the same for both ways! It free used memory and release references ... + + @seealso method dispose() + @seealso destructor ~TaskEnumeration() + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void impl_resetObject(); + + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + + private: + + //------------------------------------------------------------------------------------------------------------- + // 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 ASSERT in implementation! + + @param references to checking variables + @return sal_False on invalid parameter<BR> + sal_True otherway + + @onerror - + *//*-*****************************************************************************************************/ + + #ifdef ENABLE_ASSERTIONS + + private: + + static sal_Bool impldbg_checkParameter_OTasksEnumerationCtor ( const css::uno::Sequence< css::uno::Reference< css::frame::XFrame > >& seqTasks ); + static sal_Bool impldbg_checkParameter_disposing ( const css::lang::EventObject& aEvent ); + + #endif // #ifdef ENABLE_ASSERTIONS + + //------------------------------------------------------------------------------------------------------------- + // variables + // (should be private everyway!) + //------------------------------------------------------------------------------------------------------------- + + private: + + sal_uInt32 m_nPosition ; /// current position in enumeration + css::uno::Sequence< css::uno::Reference< css::frame::XTask > > m_seqTasks ; /// list of current tasks + +}; // class OTasksEnumeration + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_HELPER_OTASKSENUMERATION_HXX_ diff --git a/framework/inc/helper/persistentwindowstate.hxx b/framework/inc/helper/persistentwindowstate.hxx new file mode 100644 index 000000000000..3d700ee607df --- /dev/null +++ b/framework/inc/helper/persistentwindowstate.hxx @@ -0,0 +1,227 @@ +/************************************************************************* + * + * 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_HELPER_PERSISTENTWINDOWSTATE_HXX_ +#define __FRAMEWORK_HELPER_PERSISTENTWINDOWSTATE_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <threadhelp/threadhelpbase.hxx> +#include <macros/debug.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <general.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/frame/XFrameActionListener.hpp> +#include <com/sun/star/lang/XEventListener.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <unotools/moduleoptions.hxx> +#include <cppuhelper/weak.hxx> + +//_________________________________________________________________________________________________________________ +// const +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ +// declarations +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short listener for closing document frames to make her window state persistent + @descr It's a feature of our office. If a document window was created by ourself (and not from + any external process e.g. the office bean) we save and restore the window state of it + corresponding to the document service factory. That means: one instance of this class will be + a listener on one frame which container window was created by ourself. + We listen for frame action events and everytimes a component will deattached from a frame + we store its current position and size to the configuration. Everytimes a new component is + attached to a frame first time(!) we restore this informations again. + + @base ThreadHelpBase + guarantee right initialized lock member during startup of instances of this class. + + @base OWeakObject + implements ref counting for this class. + + @devstatus ready + @threadsafe yes + @modified 06.08.2004 08:41, as96863 +*//*-*************************************************************************************************************/ +class PersistentWindowState : // interfaces + public css::lang::XTypeProvider, + public css::lang::XInitialization, + public css::frame::XFrameActionListener, // => XEventListener + // baseclasses (order neccessary for right initialization!) + private ThreadHelpBase, + public ::cppu::OWeakObject +{ + //________________________________ + // member + + private: + + /// may we need an uno service manager to create own services + css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR; + + /// reference to the frame which was created by the office himself + css::uno::WeakReference< css::frame::XFrame > m_xFrame; + + /// we call SetWindowState one times only for the same frame! + sal_Bool m_bWindowStateAlreadySet; + + //________________________________ + // interface + + public: + + //____________________________ + // ctor/dtor + PersistentWindowState(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR); + virtual ~PersistentWindowState( ); + + //____________________________ + // XInterface, XTypeProvider + FWK_DECLARE_XINTERFACE + FWK_DECLARE_XTYPEPROVIDER + + //____________________________ + // XInitialization + virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any >& lArguments) + throw(css::uno::Exception , + css::uno::RuntimeException); + + //____________________________ + // XFrameActionListener + virtual void SAL_CALL frameAction(const css::frame::FrameActionEvent& aEvent) + throw(css::uno::RuntimeException); + + //____________________________ + // XEventListener + virtual void SAL_CALL disposing(const css::lang::EventObject& aEvent) + throw(css::uno::RuntimeException); + + //________________________________ + // helper + + private: + //____________________________ + /** @short identify the application module, which is used behind the component + of our frame. + + @param xSMGR + needed to create needed uno resources. + + @param xFrame + contains the component, wich must be identified. + + @return [string] + a module identifier for the current frame component. + */ + static ::rtl::OUString implst_identifyModule(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR , + const css::uno::Reference< css::frame::XFrame >& xFrame); + + //____________________________ + /** @short retrieve the window state from the configuration. + + @param xSMGR + needed to create the configuration access. + + @param sModuleName + identifies the application module, where the + information should be getted for. + + @return [string] + contains the information about position and size. + */ + static ::rtl::OUString implst_getWindowStateFromConfig(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR , + const ::rtl::OUString& sModuleName); + + //____________________________ + /** @short retrieve the window state from the container window. + + @param xWindow + must point to the container window of the frame. + We use it VCL part here - because the toolkit doesnt + provide the right functionality! + + @return [string] + contains the information about position and size. + */ + static ::rtl::OUString implst_getWindowStateFromWindow(const css::uno::Reference< css::awt::XWindow >& xWindow); + + //____________________________ + /** @short restore the position and size on the container window. + + @param xSMGR + needed to create the configuration access. + + @param sModuleName + identifies the application module, where the + information should be setted on. + + @param sWindowState + contains the information about position and size. + */ + static void implst_setWindowStateOnConfig(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR , + const ::rtl::OUString& sModuleName , + const ::rtl::OUString& sWindowState ); + + //____________________________ + /** @short restore the position and size on the container window. + + @param xWindow + must point to the container window of the frame. + We use it VCL part here - because the toolkit doesnt + provide the right functionality! + + @param sWindowState + contains the information about position and size. + */ + static void implst_setWindowStateOnWindow(const css::uno::Reference< css::awt::XWindow >& xWindow , + const ::rtl::OUString& sWindowState); + +}; // class PersistentWindowState + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_HELPER_PERSISTENTWINDOWSTATE_HXX_ diff --git a/framework/inc/helper/propertysetcontainer.hxx b/framework/inc/helper/propertysetcontainer.hxx new file mode 100644 index 000000000000..d1c50d3d9a14 --- /dev/null +++ b/framework/inc/helper/propertysetcontainer.hxx @@ -0,0 +1,98 @@ +/************************************************************************* + * + * 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_HELPER_PROPERTYSETCONTAINER_HXX_ +#define __FRAMEWORK_HELPER_PROPERTYSETCONTAINER_HXX_ + +/** Attention: stl headers must(!) be included at first. Otherwhise it can make trouble + with solaris headers ... +*/ +#include <vector> +#include <cppuhelper/weak.hxx> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/container/XIndexContainer.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <threadhelp/threadhelpbase.hxx> +#include <framework/fwedllapi.h> + +namespace framework +{ + +class FWE_DLLPUBLIC PropertySetContainer : public com::sun::star::container::XIndexContainer , + public ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses. + public ::cppu::OWeakObject +{ + public: + PropertySetContainer( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& ); + virtual ~PropertySetContainer(); + + // 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 (); + + // 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) + { + return ::getCppuType((com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet >*)0); + } + + virtual sal_Bool SAL_CALL hasElements() + throw (::com::sun::star::uno::RuntimeException); + + protected: + com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; + + private: + typedef std::vector< com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > > PropertySetVector; + PropertySetVector m_aPropertySetVector; + +}; + +} + +#endif // __FRAMEWORK_CLASSES_PROPERTYSETCONTAINER_HXX_ diff --git a/framework/inc/helper/shareablemutex.hxx b/framework/inc/helper/shareablemutex.hxx new file mode 100644 index 000000000000..1d323551b841 --- /dev/null +++ b/framework/inc/helper/shareablemutex.hxx @@ -0,0 +1,96 @@ +/************************************************************************* + * + * 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_HELPER_SHAREABLEMUTEX_HXX_ +#define __FRAMEWORK_HELPER_SHAREABLEMUTEX_HXX_ + +#include <osl/interlck.h> +#include <osl/mutex.hxx> +#include <fwidllapi.h> + +namespace framework +{ + +class FWI_DLLPUBLIC ShareableMutex +{ + public: + ShareableMutex(); + ShareableMutex( const ShareableMutex& rShareableMutex ); + const ShareableMutex& operator=( const ShareableMutex& rShareableMutex ); + + ~ShareableMutex(); + + void acquire(); + void release(); + ::osl::Mutex& getShareableOslMutex(); + + private: + struct MutexRef + { + MutexRef() : m_refCount(0) {} + void acquire() + { + osl_incrementInterlockedCount( &m_refCount ); + } + + void release() + { + if ( osl_decrementInterlockedCount( &m_refCount ) == 0 ) + delete this; + } + + oslInterlockedCount m_refCount; + osl::Mutex m_oslMutex; + }; + + MutexRef* pMutexRef; +}; + +class ShareGuard +{ + public: + ShareGuard( ShareableMutex& rShareMutex ) : + m_rShareMutex( rShareMutex ) + { + m_rShareMutex.acquire(); + } + + ~ShareGuard() + { + m_rShareMutex.release(); + } + + private: + ShareGuard(); + ShareGuard& operator=( const ShareGuard& ); + + ShareableMutex& m_rShareMutex; +}; + +} + +#endif // #ifndef __FRAMEWORK_HELPER_SHAREABLEMUTEX_HXX_ diff --git a/framework/inc/helper/statusindicator.hxx b/framework/inc/helper/statusindicator.hxx new file mode 100644 index 000000000000..f43dc6d4f778 --- /dev/null +++ b/framework/inc/helper/statusindicator.hxx @@ -0,0 +1,142 @@ +/************************************************************************* + * + * 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_HELPER_STATUSINDICATOR_HXX_ +#define __FRAMEWORK_HELPER_STATUSINDICATOR_HXX_ + +//_______________________________________________ +// include files of own module + +#include <helper/statusindicatorfactory.hxx> +#include <threadhelp/threadhelpbase.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/debug.hxx> +#include <macros/generic.hxx> + +//_______________________________________________ +// include UNO interfaces +#include <com/sun/star/task/XStatusIndicator.hpp> + +//_______________________________________________ +// include all others +#include <cppuhelper/weak.hxx> +#include <cppuhelper/weakref.hxx> + +//_______________________________________________ +// namespace + +namespace framework{ + +//_______________________________________________ +// definitions + +//_______________________________________________ +/** + @short implement a status indicator object + + @descr With this indicator you can show a message and a progress ... + but you share the output device with other indicator objects, + if this instances was created by the same factory. + Then the last created object has full access to device. + All others change her internal data structure only. + + All objects of this StatusIndicator class calls a c++ interface + on the StatusIndicatorFactory (where they was created). + The factory holds all data structures and paints the progress. + + @devstatus ready to use + @threadsafe yes +*/ +class StatusIndicator : public css::lang::XTypeProvider + , public css::task::XStatusIndicator + , private ThreadHelpBase // Order of baseclasses is neccessary for right initializaton! + , public ::cppu::OWeakObject // => XInterface +{ + //------------------------------------------- + // member + private: + + /** @short weak reference to our factory + @descr All our interface calls will be forwarded + to a suitable c++ interface on this factory. + But we dont hold our factory alive. They + correspond with e.g. with a Frame service and + will be owned by him. If the frame will be closed + he close our factory too ... + */ + css::uno::WeakReference< css::task::XStatusIndicatorFactory > m_xFactory; + + //------------------------------------------- + // c++ interface + public: + + //---------------------------------------- + /** @short initialize new instance of this class. + + @param pFactory + pointer to our factory + */ + StatusIndicator(StatusIndicatorFactory* pFactory); + + //---------------------------------------- + /** @short does nothing real .... + */ + virtual ~StatusIndicator(); + + //------------------------------------------- + // uno interface + public: + + //--------------------------------------- + // XInterface, XTypeProvider + FWK_DECLARE_XINTERFACE + FWK_DECLARE_XTYPEPROVIDER + + //--------------------------------------- + // XStatusIndicator + virtual void SAL_CALL start(const ::rtl::OUString& sText , + sal_Int32 nRange) + throw(css::uno::RuntimeException); + + virtual void SAL_CALL end() + throw(css::uno::RuntimeException); + + virtual void SAL_CALL reset() + throw(css::uno::RuntimeException); + + virtual void SAL_CALL setText(const ::rtl::OUString& sText) + throw(css::uno::RuntimeException); + + virtual void SAL_CALL setValue(sal_Int32 nValue) + throw(css::uno::RuntimeException); + +}; // class StatusIndicator + +} // namespace framework + +#endif // __FRAMEWORK_HELPER_STATUSINDICATOR_HXX_ diff --git a/framework/inc/helper/statusindicatorfactory.hxx b/framework/inc/helper/statusindicatorfactory.hxx new file mode 100644 index 000000000000..e36d79e0d1db --- /dev/null +++ b/framework/inc/helper/statusindicatorfactory.hxx @@ -0,0 +1,341 @@ +/************************************************************************* + * + * 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_HELPER_STATUSINDICATORFACTORY_HXX_ +#define __FRAMEWORK_HELPER_STATUSINDICATORFACTORY_HXX_ + +// Attention: stl headers must(!) be included at first. Otherwhise it can make trouble +// with solaris headers ... +#include <vector> + +//_______________________________________________ +// include files of own module +#include <helper/wakeupthread.hxx> +#include <threadhelp/threadhelpbase.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> +#include <macros/debug.hxx> +#include <macros/generic.hxx> +#include <general.h> + +//_______________________________________________ +// include uno interfaces +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/lang/XEventListener.hpp> +#include <com/sun/star/task/XStatusIndicatorFactory.hpp> +#include <com/sun/star/task/XStatusIndicator.hpp> +#include <com/sun/star/awt/XWindow.hpp> +#include <com/sun/star/awt/XWindowListener.hpp> +#include <com/sun/star/lang/EventObject.hpp> +#include <com/sun/star/awt/WindowEvent.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/frame/XFrame.hpp> + +#ifndef _COM_SUN_STAR_URTIL_XUPDATABLE_HPP_ +#include <com/sun/star/util/XUpdatable.hpp> +#endif + +//_______________________________________________ +// include others +#include <vcl/status.hxx> +#include <cppuhelper/weak.hxx> +#include <osl/thread.hxx> + +//_______________________________________________ +// namespace + +namespace framework{ + +//_______________________________________________ +// definitions + +//=============================================== +/** + @descr This struct hold some informations about all currently running progress proccesses. + Because the can be used on a stack, we must cache her states but must paint only + the top most one. + */ +struct IndicatorInfo +{ + //------------------------------------------- + // member + public: + + /** @short points to the indicator child, where we hold its states + alive here. */ + css::uno::Reference< css::task::XStatusIndicator > m_xIndicator; + + /** @short the last set text for this indicator */ + ::rtl::OUString m_sText; + + /** @short the max range for this indicator. */ + sal_Int32 m_nRange; + + /** @short the last set value for this indicator */ + sal_Int32 m_nValue; + + //------------------------------------------- + // interface + public: + + //--------------------------------------- + /** @short initialize new instance of this class + + @param xIndicator + the new child indiactor of our factory. + + @param sText + its initial text. + + @param nRange + the max range for this indicator. + */ + IndicatorInfo(const css::uno::Reference< css::task::XStatusIndicator >& xIndicator, + const ::rtl::OUString& sText , + sal_Int32 nRange ) + { + m_xIndicator = xIndicator; + m_sText = sText ; + m_nRange = nRange ; + m_nValue = 0 ; + } + + //--------------------------------------- + /** @short Don't forget to free used references! + */ + ~IndicatorInfo() + { + m_xIndicator.clear(); + } + + //--------------------------------------------------------------------------------------------------------- + /** @short Used to locate an info struct inside a stl structure ... + + @descr The indicator object itself is used as key. Its values + are not interesting then. Because mor then one child + indicator can use the same values ... + */ + sal_Bool operator==(const css::uno::Reference< css::task::XStatusIndicator >& xIndicator) + { + return (m_xIndicator == xIndicator); + } +}; +/* + //--------------------------------------------------------------------------------------------------------- + // norm nValue to fit range of 0..100% + sal_Int32 calcPercentage() + { + return ::std::min( (( m_nValue * 100 )/ ::std::max( m_nRange, (sal_Int32)1 ) ), (sal_Int32)100 ); + } +*/ + +//=============================================== +/** @descr Define a lits of child indicator objects and her data. */ +typedef ::std::vector< IndicatorInfo > IndicatorStack; + +//=============================================== +/** @short implement a factory service to create new status indicator objects + + @descr Internaly it uses: + - a vcl based + - or an uno based and by the frame layouted + progress implementation. + + This factory create different indicators and control his access + to a shared output device! Only the last activated component + can write his state to this device. All other requests will be + cached only. + + @devstatus ready to use + @threadsafe yes + */ +class StatusIndicatorFactory : public css::lang::XTypeProvider + , public css::lang::XServiceInfo + , public css::lang::XInitialization + , public css::task::XStatusIndicatorFactory + , public css::util::XUpdatable + , private ThreadHelpBase + , public ::cppu::OWeakObject // => XInterface +{ + //------------------------------------------- + // member + private: + + /** stack with all current indicator childs. */ + IndicatorStack m_aStack; + + /** uno service manager to create own needed uno resources. */ + css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR; + + /** most active indicator child, which could work with our shared indicator window only. */ + css::uno::Reference< css::task::XStatusIndicator > m_xActiveChild; + + /** used to show the progress on the frame (layouted!) or + as a plugged vcl window. */ + css::uno::Reference< css::task::XStatusIndicator > m_xProgress; + + /** points to the frame, where we show the progress (in case + m_xProgress points to a frame progress. */ + css::uno::WeakReference< css::frame::XFrame > m_xFrame; + + /** points to an outside window, where we show the progress (in case + we are plugged into such window). */ + css::uno::WeakReference< css::awt::XWindow > m_xPluggWindow; + + /** Notify us if a fix time is over. We use it to implement an + intelligent "Reschedule" ... */ + WakeUpThread* m_pWakeUp; + + /** Our WakeUpThread calls us in our interface method "XUpdatable::update(). + There we set this member m_bAllowReschedule to sal_True. Next time if our impl_reschedule() + method is called, we know, that an Application::Reschedule() should be made. + Because the last made Reschedule can be was taken long time ago ... may be.*/ + sal_Bool m_bAllowReschedule; + + /** enable/disable automatic showing of our parent window. */ + sal_Bool m_bAllowParentShow; + + /** enable/disable rescheduling. Default=enabled*/ + sal_Bool m_bDisableReschedule; + + /** prevent recursive calling of Application::Reschedule(). */ + static sal_Int32 m_nInReschedule; + + /** time where there last start call was made. */ + sal_Int32 m_nStartTime; + + //------------------------------------------- + // interface + + public: + + //--------------------------------------- + // ctor + StatusIndicatorFactory(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR); + + //--------------------------------------- + // XInterface, XTypeProvider, XServiceInfo + FWK_DECLARE_XINTERFACE + FWK_DECLARE_XTYPEPROVIDER + DECLARE_XSERVICEINFO + + //--------------------------------------- + // XInitialization + virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any >& lArguments) + throw(css::uno::Exception , + css::uno::RuntimeException); + + //--------------------------------------- + // XStatusIndicatorFactory + virtual css::uno::Reference< css::task::XStatusIndicator > SAL_CALL createStatusIndicator() + throw(css::uno::RuntimeException); + + //--------------------------------------- + // XUpdatable + virtual void SAL_CALL update() + throw(css::uno::RuntimeException); + + //--------------------------------------- + // similar (XStatusIndicator) + virtual void start(const css::uno::Reference< css::task::XStatusIndicator >& xChild, + const ::rtl::OUString& sText , + sal_Int32 nRange); + + virtual void SAL_CALL reset(const css::uno::Reference< css::task::XStatusIndicator >& xChild); + + virtual void SAL_CALL end(const css::uno::Reference< css::task::XStatusIndicator >& xChild); + + virtual void SAL_CALL setText(const css::uno::Reference< css::task::XStatusIndicator >& xChild, + const ::rtl::OUString& sText ); + + virtual void SAL_CALL setValue(const css::uno::Reference< css::task::XStatusIndicator >& xChild, + sal_Int32 nValue); + + //------------------------------------------- + // specials + + protected: + + virtual ~StatusIndicatorFactory(); + + //------------------------------------------- + // helper + private: + + /** @short show the parent window of this progress ... + if it's allowed to do so. + + + @descr By default we show the parent window automaticly + if this progress is used. + If that isn't a valid operation, the user of this + progress can suppress this feature by initializaing + us with a special parameter. + + @seealso initialize() + */ + void implts_makeParentVisibleIfAllowed(); + + /** @short creates a new internal used progress. + @descr This factory does not paint the progress itself. + It uses helper for that. They can be vcl based or + layouted by the frame and provided as an uno interface. + */ + void impl_createProgress(); + + /** @short shows the internal used progress. + @descr This factory does not paint the progress itself. + It uses helper for that. They can be vcl based or + layouted by the frame and provided as an uno interface. + */ + void impl_showProgress(); + + /** @short hides the internal used progress. + @descr This factory does not paint the progress itself. + It uses helper for that. They can be vcl based or + layouted by the frame and provided as an uno interface. + */ + void impl_hideProgress(); + + /** @short try to "share the current thread in an intelligent manner" :-) + + @param Overwrites our algorithm for Reschedule and force it to be shure + that our progress was painted right. + */ + void impl_reschedule(sal_Bool bForceUpdate); + + void impl_startWakeUpThread(); + void impl_stopWakeUpThread(); + +}; // class StatusIndicatorFactory + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_HELPER_STATUSINDICATORFACTORY_HXX_ diff --git a/framework/inc/helper/tagwindowasmodified.hxx b/framework/inc/helper/tagwindowasmodified.hxx new file mode 100644 index 000000000000..2aec417eb375 --- /dev/null +++ b/framework/inc/helper/tagwindowasmodified.hxx @@ -0,0 +1,157 @@ +/************************************************************************* + * + * 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_HELPER_TAGWINDOWASMODIFIED_HXX_ +#define __FRAMEWORK_HELPER_TAGWINDOWASMODIFIED_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <threadhelp/threadhelpbase.hxx> +#include <macros/debug.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <general.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/util/XModifyListener.hpp> +#include <com/sun/star/lang/XEventListener.hpp> +#include <com/sun/star/frame/XFrameActionListener.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <cppuhelper/weak.hxx> + +//_________________________________________________________________________________________________________________ +// const +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ +// declarations +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short listen for modify events on model and tag frame container window so it can react accordingly + @descr Used e.g. by our MAC port where such state is shown seperately on some controls of the + title bar. + + @base ThreadHelpBase + guarantee right initialized lock member during startup of instances of this class. + + @base OWeakObject + implements ref counting for this class. + + @devstatus draft + @threadsafe yes + @modified as96863 +*//*-*************************************************************************************************************/ +class TagWindowAsModified : // interfaces + public css::lang::XTypeProvider, + public css::lang::XInitialization, + public css::frame::XFrameActionListener, // => XEventListener + public css::util::XModifyListener, // => XEventListener + // baseclasses (order neccessary for right initialization!) + private ThreadHelpBase, + public ::cppu::OWeakObject +{ + //________________________________ + // member + + private: + + /// may we need an uno service manager to create own services + css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR; + + /// reference to the frame, where we listen for new loaded documents for updating our own xModel reference + css::uno::WeakReference< css::frame::XFrame > m_xFrame; + + /// reference to the frame container window, where we must set the tag + css::uno::WeakReference< css::awt::XWindow > m_xWindow; + + /// we list on the model for modify events + css::uno::WeakReference< css::frame::XModel > m_xModel; + + //________________________________ + // interface + + public: + + //____________________________ + // ctor/dtor + TagWindowAsModified(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR); + virtual ~TagWindowAsModified( ); + + //____________________________ + // XInterface, XTypeProvider + FWK_DECLARE_XINTERFACE + FWK_DECLARE_XTYPEPROVIDER + + //____________________________ + // XInitialization + virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any >& lArguments) + throw(css::uno::Exception , + css::uno::RuntimeException); + + //____________________________ + // XModifyListener + virtual void SAL_CALL modified(const css::lang::EventObject& aEvent) + throw(css::uno::RuntimeException); + + //____________________________ + // XFrameActionListener + virtual void SAL_CALL frameAction(const css::frame::FrameActionEvent& aEvent) + throw(css::uno::RuntimeException); + + //____________________________ + // XEventListener + virtual void SAL_CALL disposing(const css::lang::EventObject& aEvent) + throw(css::uno::RuntimeException); + + private: + + //____________________________ + // @todo document me + void impl_update(const css::uno::Reference< css::frame::XFrame >& xFrame); + +}; // class TagWindowAsModified + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_HELPER_TAGWINDOWASMODIFIED_HXX_ diff --git a/framework/inc/helper/timerhelper.hxx b/framework/inc/helper/timerhelper.hxx new file mode 100644 index 000000000000..a37bd5b2ce05 --- /dev/null +++ b/framework/inc/helper/timerhelper.hxx @@ -0,0 +1,53 @@ +/************************************************************************* + * + * 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_HELPER_TIMERHELPER_HXX_ +#define __FRAMEWORK_HELPER_TIMERHELPER_HXX_ + +#include <threadhelp/threadhelpbase.hxx> +#include <vos/timer.hxx> +#include <osl/mutex.hxx> + +//........................................................................ +namespace framework +{ +//........................................................................ + + //==================================================================== + //= ITimerListener + //==================================================================== + class ITimerListener + { + public: + virtual void timerExpired() = 0; + }; +//........................................................................ +} // namespace framework +//........................................................................ + +#endif // _FRAMEWORK_HELPER_TIMERHELPER_HXX_ + diff --git a/framework/inc/helper/titlebarupdate.hxx b/framework/inc/helper/titlebarupdate.hxx new file mode 100644 index 000000000000..f74926f07131 --- /dev/null +++ b/framework/inc/helper/titlebarupdate.hxx @@ -0,0 +1,249 @@ +/************************************************************************* + * + * 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_HELPER_TITLEBARUPDATE_HXX_ +#define __FRAMEWORK_HELPER_TITLEBARUPDATE_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#ifndef __FRAMEWORK_THREADHELP_THREADHELPBASE_HXX_ +#include <threadhelp/threadhelpbase.hxx> +#endif + +#ifndef __FRAMEWORK_MACROS_DEBUG_HXX_ +#include <macros/debug.hxx> +#endif + +#ifndef __FRAMEWORK_MACROS_XINTERFACE_HXX_ +#include <macros/xinterface.hxx> +#endif + +#ifndef __FRAMEWORK_MACROS_XTYPEPROVIDER_HXX_ +#include <macros/xtypeprovider.hxx> +#endif + +#ifndef __FRAMEWORK_GENERAL_H_ +#include <general.h> +#endif + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ + +#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_ +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#endif + +#ifndef _COM_SUN_STAR_LANG_XINITIALIZATION_HPP_ +#include <com/sun/star/lang/XInitialization.hpp> +#endif + +#ifndef _COM_SUN_STAR_FRAME_XFRAME_HPP_ +#include <com/sun/star/frame/XFrame.hpp> +#endif + +#ifndef _COM_SUN_STAR_FRAME_XTITLE_HPP_ +#include <com/sun/star/frame/XTitle.hpp> +#endif + +#ifndef _COM_SUN_STAR_FRAME_XFRAMEACTIONLISTENER_HPP_ +#include <com/sun/star/frame/XFrameActionListener.hpp> +#endif + +#ifndef _COM_SUN_STAR_FRAME_XTITLECHANGELISTENER_HPP_ +#include <com/sun/star/frame/XTitleChangeListener.hpp> +#endif + +#ifndef _COM_SUN_STAR_LANG_XEVENTLISTENER_HPP_ +#include <com/sun/star/lang/XEventListener.hpp> +#endif + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ + +#ifndef INCLUDED_SVTOOLS_MODULEOPTIONS_HXX +#include <unotools/moduleoptions.hxx> +#endif + +#ifndef _CPPUHELPER_WEAK_HXX_ +#include <cppuhelper/weak.hxx> +#endif + +#ifndef _RTL_USTRBUF_HXX_ +#include <rtl/ustrbuf.hxx> +#endif + +//_________________________________________________________________________________________________________________ +// const +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ +// declarations +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short helps our frame on setting title/icon on the titlebar (including updates) + + @devstatus draft + @threadsafe yes +*//*-*************************************************************************************************************/ +class TitleBarUpdate : // interfaces + public css::lang::XTypeProvider + , public css::lang::XInitialization + , public css::frame::XTitleChangeListener // => XEventListener + , public css::frame::XFrameActionListener // => XEventListener + // baseclasses (order neccessary for right initialization!) + , private ThreadHelpBase + , public ::cppu::OWeakObject +{ + //________________________________ + // structs, types + + private: + + struct TModuleInfo + { + /// internal id of this module + ::rtl::OUString sID; + /// localized name for this module + ::rtl::OUString sUIName; + /// configured icon for this module + ::sal_Int32 nIcon; + }; + + //________________________________ + // member + + private: + + /// may we need an uno service manager to create own services + css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR; + + /// reference to the frame which was created by the office himself + css::uno::WeakReference< css::frame::XFrame > m_xFrame; + + //________________________________ + // interface + + public: + + //____________________________ + // ctor/dtor + TitleBarUpdate(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR); + virtual ~TitleBarUpdate( ); + + //____________________________ + // XInterface, XTypeProvider + FWK_DECLARE_XINTERFACE + FWK_DECLARE_XTYPEPROVIDER + + //____________________________ + // XInitialization + virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any >& lArguments) + throw(css::uno::Exception , + css::uno::RuntimeException); + + //____________________________ + // XFrameActionListener + virtual void SAL_CALL frameAction(const css::frame::FrameActionEvent& aEvent) + throw(css::uno::RuntimeException); + + //____________________________ + // XTitleChangeListener + virtual void SAL_CALL titleChanged(const css::frame::TitleChangedEvent& aEvent) + throw (css::uno::RuntimeException); + + //____________________________ + // XEventListener + virtual void SAL_CALL disposing(const css::lang::EventObject& aEvent) + throw(css::uno::RuntimeException); + + //________________________________ + // helper + + private: + + //____________________________ + /** @short identify the application module, which is used behind the component + of our frame. + + @param xFrame + contains the component, wich must be identified. + + @param rInfo + describe the module in its details. + Is set only if return value is true. + + @return [sal_Bool] + sal_True in casee module could be identified and all needed values could be read. + sal_False otherwise. + */ + ::sal_Bool implst_getModuleInfo(const css::uno::Reference< css::frame::XFrame >& xFrame, + TModuleInfo& rInfo ); + + //____________________________ + /** @short set a new icon and title on the title bar of our connected frame window. + + @descr It does not check if an update is realy needed. That has to be done outside. + It retrieves all needed informations and update the title bar - nothing less - + nothing more. + */ + void impl_forceUpdate(); + + //____________________________ + /** @short identify the current component (inside the connected frame) + and set the right module icon on the title bar. + + @param xFrame + the frame which contains the component and where the icon must be set + on the window title bar. + */ + void impl_updateIcon(const css::uno::Reference< css::frame::XFrame >& xFrame); + + //____________________________ + /** @short gets the current title from the frame and set it on the window. + + @param xFrame + the frame which contains the component and where the title must be set + on the window title bar. + */ + void impl_updateTitle(const css::uno::Reference< css::frame::XFrame >& xFrame); + +}; // class TitleBarUpdate + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_HELPER_TITLEBARUPDATE_HXX_ diff --git a/framework/inc/helper/uiconfigelementwrapperbase.hxx b/framework/inc/helper/uiconfigelementwrapperbase.hxx new file mode 100644 index 000000000000..d2df4bc541b3 --- /dev/null +++ b/framework/inc/helper/uiconfigelementwrapperbase.hxx @@ -0,0 +1,164 @@ +/************************************************************************* + * + * 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_HELPER_UICONFIGELEMENTWRAPPERBASE_HXX_ +#define __FRAMEWORK_HELPER_UICONFIGELEMENTWRAPPERBASE_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <threadhelp/threadhelpbase.hxx> +#include <macros/generic.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/ui/XUIElement.hpp> +#include <com/sun/star/ui/XUIElementSettings.hpp> +#include <com/sun/star/ui/XUIConfigurationManager.hpp> +#include <com/sun/star/ui/XUIConfigurationListener.hpp> +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/awt/XMenuBar.hpp> +#include <com/sun/star/util/XUpdatable.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <rtl/ustring.hxx> +#include <cppuhelper/propshlp.hxx> +#include <cppuhelper/interfacecontainer.hxx> +#include <cppuhelper/weak.hxx> + +namespace framework +{ + +class UIConfigElementWrapperBase : public ::com::sun::star::lang::XTypeProvider , + public ::com::sun::star::ui::XUIElement , + public ::com::sun::star::ui::XUIElementSettings , + public ::com::sun::star::lang::XInitialization , + public ::com::sun::star::lang::XComponent , + public ::com::sun::star::util::XUpdatable , + public ::com::sun::star::ui::XUIConfigurationListener , + protected ThreadHelpBase , + public ::cppu::OBroadcastHelper , + public ::cppu::OPropertySetHelper , + public ::cppu::OWeakObject +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + public: + UIConfigElementWrapperBase( sal_Int16 nType,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xServiceFactory ); + virtual ~UIConfigElementWrapperBase(); + + // 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(); + + // 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 ); + + // XComponent + virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException) = 0; + virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException); + + // XInitialization + virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + + // XUIElementSettings + virtual void SAL_CALL updateSettings() throw (::com::sun::star::uno::RuntimeException) = 0; + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > SAL_CALL getSettings( sal_Bool bWriteable ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setSettings( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& UISettings ) throw (::com::sun::star::uno::RuntimeException); + + // XUIElement + virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > SAL_CALL getFrame() throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getResourceURL() throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Int16 SAL_CALL getType() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getRealInterface() throw (::com::sun::star::uno::RuntimeException) = 0; + + // XUpdatable + virtual void SAL_CALL update() throw (::com::sun::star::uno::RuntimeException); + + // XUIConfigurationListener + virtual void SAL_CALL elementInserted( const ::com::sun::star::ui::ConfigurationEvent& Event ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL elementRemoved( const ::com::sun::star::ui::ConfigurationEvent& Event ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL elementReplaced( const ::com::sun::star::ui::ConfigurationEvent& Event ) throw (::com::sun::star::uno::RuntimeException); + + // XEventListener + using cppu::OPropertySetHelper::disposing; + virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& aEvent ) throw(::com::sun::star::uno::RuntimeException); + + //------------------------------------------------------------------------------------------------------------- + // protected methods + //------------------------------------------------------------------------------------------------------------- + protected: + + // 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); + + virtual void impl_fillNewData(); + + static const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > impl_getStaticPropertyDescriptor(); + + sal_Int16 m_nType; + bool m_bPersistent : 1, + m_bInitialized : 1, + m_bConfigListener : 1, + m_bConfigListening : 1, + m_bDisposed : 1, + m_bNoClose : 1; + rtl::OUString m_aResourceURL; + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceFactory; + com::sun::star::uno::Reference< ::com::sun::star::ui::XUIConfigurationManager > m_xConfigSource; + com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess > m_xConfigData; + com::sun::star::uno::WeakReference< com::sun::star::frame::XFrame > m_xWeakFrame; + com::sun::star::uno::Reference< com::sun::star::awt::XMenuBar > m_xMenuBar; + ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; /// container for ALL Listener +}; + +} // namespace framework + +#endif // __FRAMEWORK_HELPER_UIELEMENTWRAPPERBASE_HXX_ diff --git a/framework/inc/helper/uielementwrapperbase.hxx b/framework/inc/helper/uielementwrapperbase.hxx new file mode 100644 index 000000000000..667af7d7f97b --- /dev/null +++ b/framework/inc/helper/uielementwrapperbase.hxx @@ -0,0 +1,133 @@ +/************************************************************************* + * + * 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_HELPER_UIELEMENTWRAPPERBASE_HXX_ +#define __FRAMEWORK_HELPER_UIELEMENTWRAPPERBASE_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <threadhelp/threadhelpbase.hxx> +#include <macros/generic.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/ui/XUIElement.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/util/XUpdatable.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <rtl/ustring.hxx> +#include <cppuhelper/propshlp.hxx> +#include <cppuhelper/interfacecontainer.hxx> +#include <cppuhelper/weak.hxx> + +namespace framework +{ + +class UIElementWrapperBase : public ::com::sun::star::lang::XTypeProvider , + public ::com::sun::star::ui::XUIElement , + public ::com::sun::star::lang::XInitialization , + public ::com::sun::star::lang::XComponent , + public ::com::sun::star::util::XUpdatable , + protected ThreadHelpBase , + public ::cppu::OBroadcastHelper , + public ::cppu::OPropertySetHelper , + public ::cppu::OWeakObject +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + public: + UIElementWrapperBase( sal_Int16 nType ); + virtual ~UIElementWrapperBase(); + + // 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(); + + // 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 ); + + // XComponent + virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException) = 0; + virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException); + + // XInitialization + virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + + // XUpdatable + virtual void SAL_CALL update() throw (::com::sun::star::uno::RuntimeException); + + // XUIElement + virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > SAL_CALL getFrame() throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getResourceURL() throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Int16 SAL_CALL getType() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getRealInterface() throw (::com::sun::star::uno::RuntimeException) = 0; + + //------------------------------------------------------------------------------------------------------------- + // protected methods + //------------------------------------------------------------------------------------------------------------- + protected: + + // 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(); + + ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; /// container for ALL Listener + rtl::OUString m_aResourceURL; + com::sun::star::uno::WeakReference< com::sun::star::frame::XFrame > m_xWeakFrame; + sal_Int16 m_nType; + sal_Bool m_bInitialized : 1, + m_bDisposed; +}; + +} // namespace framework + +#endif // __FRAMEWORK_HELPER_UIELEMENTWRAPPERBASE_HXX_ diff --git a/framework/inc/helper/vclstatusindicator.hxx b/framework/inc/helper/vclstatusindicator.hxx new file mode 100644 index 000000000000..ec2d5ce72bc5 --- /dev/null +++ b/framework/inc/helper/vclstatusindicator.hxx @@ -0,0 +1,133 @@ +/************************************************************************* + * + * 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_HELPER_VCLSTATUSINDICATOR_HXX_ +#define __FRAMEWORK_HELPER_VCLSTATUSINDICATOR_HXX_ + +//----------------------------------------------- +// includes of own modules + +#include <threadhelp/threadhelpbase.hxx> +#include <macros/generic.hxx> +#include <macros/xinterface.hxx> +#include <general.h> + +//----------------------------------------------- +// includes of interfaces +#include <com/sun/star/task/XStatusIndicator.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/awt/XWindow.hpp> + +//----------------------------------------------- +// includes of external modules +#include <cppuhelper/weak.hxx> +#include <vcl/status.hxx> + +//----------------------------------------------- +// namespace + +namespace framework { + +//----------------------------------------------- +// declaration + +class VCLStatusIndicator : public css::task::XStatusIndicator + , private ThreadHelpBase // must be the first real base class! + , public ::cppu::OWeakObject +{ + //------------------------------------------- + // member + + private: + + /** can be used to create own needed uno resources. */ + css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR; + + /** points to the parent window of this progress and + hold it alive. */ + css::uno::Reference< css::awt::XWindow > m_xParentWindow; + + /** shows the progress. + + @attention This member isnt synchronized using our own mutex! + Its guarded by the solarmutex only. Otherwhise + we have to lock two of them, which can force a deadlock ... + */ + StatusBar* m_pStatusBar; + + /** knows the current info text of the progress. */ + ::rtl::OUString m_sText; + + /** knows the current range of the progress. */ + sal_Int32 m_nRange; + + /** knows the current value of the progress. */ + sal_Int32 m_nValue; + + //------------------------------------------- + // interface + + public: + + FWK_DECLARE_XINTERFACE + + /// ctor + VCLStatusIndicator(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR , + const css::uno::Reference< css::awt::XWindow >& xParentWindow); + + /// dtor + virtual ~VCLStatusIndicator(); + + /// XStatusIndicator + virtual void SAL_CALL start(const ::rtl::OUString& sText , + sal_Int32 nRange) + throw(css::uno::RuntimeException); + + virtual void SAL_CALL reset() + throw(css::uno::RuntimeException); + + virtual void SAL_CALL end() + throw(css::uno::RuntimeException); + + virtual void SAL_CALL setText(const ::rtl::OUString& sText) + throw(css::uno::RuntimeException); + + virtual void SAL_CALL setValue(sal_Int32 nValue) + throw(css::uno::RuntimeException); + + //------------------------------------------- + // helper + + private: + + static void impl_recalcLayout(Window* pStatusBar , + Window* pParentWindow); +}; + +} // namespace framework + +#endif // __FRAMEWORK_HELPER_VCLSTATUSINDICATOR_HXX_ diff --git a/framework/inc/helper/wakeupthread.hxx b/framework/inc/helper/wakeupthread.hxx new file mode 100644 index 000000000000..7d3ca0539ef8 --- /dev/null +++ b/framework/inc/helper/wakeupthread.hxx @@ -0,0 +1,100 @@ +/************************************************************************* + * + * 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_HELPER_WAKEUPTHREAD_HXX_ +#define __FRAMEWORK_HELPER_WAKEUPTHREAD_HXX_ + +//_______________________________________________ +// include files of own module + +#include <threadhelp/threadhelpbase.hxx> +#include <macros/debug.hxx> +#include <macros/generic.hxx> + +#ifndef __FRAMEWORK_GENERAL_HXX_ +#include <general.h> +#endif + +//_______________________________________________ +// include UNO interfaces + +#ifndef _COM_SUN_STAR_URTIL_XUPDATABLE_HPP_ +#include <com/sun/star/util/XUpdatable.hpp> +#endif + +//_______________________________________________ +// include all others +#include <cppuhelper/weakref.hxx> +#include <osl/thread.hxx> + +//_______________________________________________ +// namespace + +namespace framework{ + +//_______________________________________________ +// definitions + +//=============================================== +/** @short implements a "sleeping" thread, which try to sleep + without a using cpu consumption :-) */ +class WakeUpThread : public ThreadHelpBase + , public ::osl::Thread +{ + //------------------------------------------- + // member + private: + + /** @short this listener will be notified if this thread + waked up. */ + css::uno::WeakReference< css::util::XUpdatable > m_xListener; + + //------------------------------------------- + // interface + public: + + /** @short Register a new listener on this thread. + + @descr The listener is holded as a weak reference. + If the thread detects, that no listener exists ... + he will terminate itself. + */ + WakeUpThread(const css::uno::Reference< css::util::XUpdatable >& xListener); + + /** @descr The thread waits on a condition using a fix timeout value. + If the thread wakes up he notify the internal set listener. + The listener can use this "timeout" info for it's own purpose. + The thread itself will wait on the condition again. + */ + virtual void SAL_CALL run(); + + virtual void SAL_CALL onTerminated(); +}; + +} // namespace framework + +#endif // __FRAMEWORK_HELPER_WAKEUPTHREAD_HXX_ diff --git a/framework/inc/helpid.hrc b/framework/inc/helpid.hrc new file mode 100644 index 000000000000..b5cd1f6a4ac1 --- /dev/null +++ b/framework/inc/helpid.hrc @@ -0,0 +1,39 @@ +/************************************************************************* + * + * 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_HELPID_HRC +#define _FRAMEWORK_HELPID_HRC + +#define HID_BACKINGWINDOW "FWK_HID_BACKINGWINDOW" +#define HID_LICENSEDIALOG "FWK_HID_LICENSEDIALOG" +#define HID_STATUSBAR "FWK_HID_STATUSBAR" +#define HID_SVX_COMMON_MACRO_ORGANIZER "FWK_HID_SVX_COMMON_MACRO_ORGANIZER" +#define HID_SVX_BASIC_MACRO_ORGANIZER "FWK_HID_SVX_BASIC_MACRO_ORGANIZER" + +#endif // #ifndef _FRAMEWORK_HELPID_HRC + +// ******************************************************************* EOF + diff --git a/framework/inc/interaction/quietinteraction.hxx b/framework/inc/interaction/quietinteraction.hxx new file mode 100644 index 000000000000..0d812774e583 --- /dev/null +++ b/framework/inc/interaction/quietinteraction.hxx @@ -0,0 +1,164 @@ +/************************************************************************* + * + * 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_INTERACTION_QUIETINTERACTION_HXX_ +#define __FRAMEWORK_INTERACTION_QUIETINTERACTION_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <threadhelp/threadhelpbase.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <general.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/task/XInteractionHandler.hpp> +#include <com/sun/star/task/XInteractionRequest.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <cppuhelper/weak.hxx> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ +// exported const +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// exported definitions +//_________________________________________________________________________________________________________________ + +/** + @short handle interactions non visible + @descr Sometimes it's neccessary to use a non visible interaction handler. + He can't do anything, which a visible one can handle. + But it can be used to intercept problems e.g. during loading of documents. + + In current implementation we solve conflicts for following situations only: + - AmbigousFilterRequest + - InteractiveIOException + - InteractiveAugmentedIOException + All other requests will be aborted. + + @modified 12.07.2002 14:06 + @by Andreas Schlüns + */ +class QuietInteraction : public css::lang::XTypeProvider + , public css::task::XInteractionHandler + , private ThreadHelpBase + , public ::cppu::OWeakObject +{ + //_____________________________________ + // member + private: + + /// in case an unknown interaction was aborted - we save it for our external user! + css::uno::Any m_aRequest; + + //_____________________________________ + // uno interface + public: + + // XInterface, XTypeProvider + FWK_DECLARE_XINTERFACE + FWK_DECLARE_XTYPEPROVIDER + + //_________________________________ + /** + @interface XInteractionHandler + @short called from outside to handle a problem + @descr The only interaction we can handle here is to + decide which of two ambigous filters should be realy used. + We use the user selected one every time. + All other request will be aborted and can break the code, + which use this interaction handler. + + But you can use another method of this class to check for + some special interactions too: IO Exceptions + May a ComponentLoader needs that to throw suitable exception + on his own interface. + + @threadsafe yes + */ + virtual void SAL_CALL handle( const css::uno::Reference< css::task::XInteractionRequest >& xRequest ) throw( css::uno::RuntimeException ); + + //_____________________________________ + // c++ interface + public: + + //_________________________________ + /** + @short ctor to guarantee right initialized instances of this class + @descr - + + @threadsafe not neccessary + */ + QuietInteraction(); + + //_________________________________ + /** + @short return the handled interaction request + @descr We saved any getted interaction request internaly. + May the outside user of this class is interessted + on that. Especialy we gotted an unknown interaction + and aborted it hard. + + @return [com.sun.star.uno.Any] + the packed interaction request + Can be empty if no interaction was used! + + @threadsafe yes + */ + css::uno::Any getRequest() const; + + //_________________________________ + /** + @short returns information if interaction was used + @descr It can be usefully to know the reason for a failed operation. + + @return [boolean] + <TRUE/> for used interaction + <FALSE/> otherwhise + + @threadsafe yes + */ + sal_Bool wasUsed() const; +}; + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_INTERACTION_STILLINTERACTION_HXX_ diff --git a/framework/inc/jobs/configaccess.hxx b/framework/inc/jobs/configaccess.hxx new file mode 100644 index 000000000000..31fb5d757656 --- /dev/null +++ b/framework/inc/jobs/configaccess.hxx @@ -0,0 +1,118 @@ +/************************************************************************* + * + * 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_CONFIG_CONFIGACCESS_HXX_ +#define __FRAMEWORK_CONFIG_CONFIGACCESS_HXX_ + +//_______________________________________ +// my own includes + +#include <threadhelp/threadhelpbase.hxx> +#include <macros/debug.hxx> +#include <general.h> + +//_______________________________________ +// interface includes +#include <com/sun/star/lang/XMultiServiceFactory.hpp> + +//_______________________________________ +// other includes +#include <rtl/ustring.hxx> +#include <fwidllapi.h> + +//_______________________________________ +// namespace + +namespace framework{ + +//_______________________________________ +// public const + +//_______________________________________ +/** + @short implements a simple configuration access + @descr Sometimes it's better to have direct config access + instead of using soecialize config items of the svtools + project. This class can wrapp such configuration access. + */ +class FWI_DLLPUBLIC ConfigAccess : public ThreadHelpBase +{ + //___________________________________ + // const + + public: + + /** represent the possible modes of the internal wrapped configuration access */ + enum EOpenMode + { + /// config isn't used yet + E_CLOSED, + /// config access is open for reading only + E_READONLY, + /// config access is open for reading/writing data + E_READWRITE + }; + + //___________________________________ + // member + + private: + + /** + reference to the uno service manager + It's neccessary to instanciate own needed services. + */ + css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR; + + /** hold an opened configuration alive */ + css::uno::Reference< css::uno::XInterface > m_xConfig; + + /** knows the root of the opened config access point */ + ::rtl::OUString m_sRoot; + + /** represent the current open mode */ + EOpenMode m_eMode; + + //___________________________________ + // native interface methods + + public: + + ConfigAccess( const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR , + const ::rtl::OUString& sRoot ); + virtual ~ConfigAccess(); + + virtual void open ( EOpenMode eMode ); + virtual void close ( ); + virtual EOpenMode getMode( ) const; + + virtual const css::uno::Reference< css::uno::XInterface >& cfg(); +}; + +} // namespace framework + +#endif // __FRAMEWORK_CONFIG_CONFIGACCESS_HXX_ diff --git a/framework/inc/jobs/helponstartup.hxx b/framework/inc/jobs/helponstartup.hxx new file mode 100644 index 000000000000..b893403c79ce --- /dev/null +++ b/framework/inc/jobs/helponstartup.hxx @@ -0,0 +1,231 @@ +/************************************************************************* + * + * 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_JOBS_HELPONSTARTUP_HXX_ +#define __FRAMEWORK_JOBS_HELPONSTARTUP_HXX_ + +//_______________________________________________ +// my own includes + +#include <threadhelp/threadhelpbase.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> + +//_______________________________________________ +// other includes +#include <cppuhelper/implbase3.hxx> + +//_______________________________________________ +// uno includes +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/task/XJob.hpp> +#include <com/sun/star/lang/XEventListener.hpp> +#include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/frame/XModuleManager.hpp> + +//_______________________________________________ +// namespace + +namespace framework{ + +//_______________________________________________ +// declarations + +//_______________________________________________ +/** @short implements a job component, which handle the special + feature to show a suitable help page for every (visible!) + loaded document. + + @author as96863 + */ +class HelpOnStartup : private ThreadHelpBase + ,public ::cppu::WeakImplHelper3< ::com::sun::star::lang::XServiceInfo,::com::sun::star::lang::XEventListener,::com::sun::star::task::XJob > +{ + //------------------------------------------- + // member + private: + + //....................................... + /** @short reference to an uno service manager. */ + css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR; + + //....................................... + /** @short such module manager is used to classify new opened documents. */ + css::uno::Reference< css::frame::XModuleManager > m_xModuleManager; + + //....................................... + /** @short is needed to locate a might open help frame. */ + css::uno::Reference< css::frame::XFrame > m_xDesktop; + + //....................................... + /** @short provides read access to the underlying configuration. */ + css::uno::Reference< css::container::XNameAccess > m_xConfig; + + //....................................... + /** @short knows the current locale of this office session, + which is needed to build complete help URLs. + */ + ::rtl::OUString m_sLocale; + + //....................................... + /** @short knows the current operating system of this office session, + which is needed to build complete help URLs. + */ + ::rtl::OUString m_sSystem; + + //------------------------------------------- + // native interface + public: + + //--------------------------------------- + /** @short create new instance of this class. + + @param xSMGR + reference to the uno service manager, which created this instance. + Can be used later to create own needed uno resources on demand. + */ + HelpOnStartup(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR); + + //--------------------------------------- + /** @short does nothing real ... + + @descr But it should exists as virtual function, + so this class cant make trouble + related to inline/symbols etcpp.! + */ + virtual ~HelpOnStartup(); + + //------------------------------------------- + // uno interface + public: + + //--------------------------------------- + // css.lang.XServiceInfo + DECLARE_XSERVICEINFO + + // css.task.XJob + virtual css::uno::Any SAL_CALL execute(const css::uno::Sequence< css::beans::NamedValue >& lArguments) + throw(css::lang::IllegalArgumentException, + css::uno::Exception , + css::uno::RuntimeException ); + + // css.lang.XEventListener + virtual void SAL_CALL disposing(const css::lang::EventObject& aEvent) + throw(css::uno::RuntimeException); + + //------------------------------------------- + // helper + private: + + //--------------------------------------- + /** @short analyze the given job arguments, try to locate a model reference + and try to classify this model. + + @descr As a result of this operation a module identifier will be returned. + It can be used against the module configuration then to retrieve further informations. + + @param lArguments + the list of job arguments which is given on our interface method execute(). + + @return [string] + a module identifier ... or an empty value if no model could be located ... + or if it could not be classified successfully. + */ + ::rtl::OUString its_getModuleIdFromEnv(const css::uno::Sequence< css::beans::NamedValue >& lArguments); + + //--------------------------------------- + /** @short tries to locate the open help module and return + the url of the currently shown help content. + + @descr It returns an empty string, if the help isnt still + open at calling time. + + @return The URL of the current shown help content; + or an empty value if the help isnt still open. + */ + ::rtl::OUString its_getCurrentHelpURL(); + + //--------------------------------------- + /** @short checks if the given help url match to a default help url + of any office module. + + @param sHelpURL + the help url for checking. + + @return [bool] + sal_True if the given URL is any default one ... + sal_False otherwise. + */ + ::sal_Bool its_isHelpUrlADefaultOne(const ::rtl::OUString& sHelpURL); + + //--------------------------------------- + /** @short checks, if the help module should be shown automaticly for the + currently opened office module. + + @descr This value is readed from the module configuration. + In case the help should be shown, this method returns + a help URL, which can be used to show the right help content. + + @param sModule + identifies the used office module. + + @return [string] + A valid help URL in case the help content should be shown; + an empty value if such automatism was disabled for the specified office module. + */ + ::rtl::OUString its_checkIfHelpEnabledAndGetURL(const ::rtl::OUString& sModule); + + //--------------------------------------- + /** @short create a help URL for the given parameters. + + @param sBaseURL + must be the base URL for a requested help content + e.g. "vnd.sun.star.help://swriter/" + or "vnd.sun.star.help://swriter/67351" + + @param sLocale + the current office locale + e.g. "en-US" + + @param sSystem + the current operating system + e.g. "WIN" + + @return The URL which was generated. + e.g. + e.g. "vnd.sun.star.help://swriter/?Language=en-US&System=WIN" + or "vnd.sun.star.help://swriter/67351?Language=en-US&System=WIN" + */ + static ::rtl::OUString ist_createHelpURL(const ::rtl::OUString& sBaseURL, + const ::rtl::OUString& sLocale , + const ::rtl::OUString& sSystem ); +}; + +} // namespace framework + +#endif // __FRAMEWORK_JOBS_HELPONSTARTUP_HXX_ diff --git a/framework/inc/jobs/job.hxx b/framework/inc/jobs/job.hxx new file mode 100644 index 000000000000..9a4541896e4f --- /dev/null +++ b/framework/inc/jobs/job.hxx @@ -0,0 +1,247 @@ +/************************************************************************* + * + * 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_JOBS_JOB_HXX_ +#define __FRAMEWORK_JOBS_JOB_HXX_ + +//_______________________________________ +// my own includes + +#include <jobs/jobresult.hxx> +#include <jobs/jobdata.hxx> +#include <threadhelp/threadhelpbase.hxx> +#include <macros/debug.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <stdtypes.h> +#include <general.h> + +//_______________________________________ +// interface includes +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/frame/XDispatchResultListener.hpp> +#include <com/sun/star/task/XJobListener.hpp> +#include <com/sun/star/util/XCloseListener.hpp> +#include <com/sun/star/frame/DispatchResultEvent.hpp> + +//_______________________________________ +// other includes +#include <cppuhelper/weak.hxx> +#include <rtl/ustring.hxx> + +//_______________________________________ +// namespace + +namespace framework{ + +//_______________________________________ +// public const + +//_______________________________________ +// definitions + +/** + @short it represent a job; execute it and control it's lifetime + + @descr This implemetation can be used to wrapp jobs, execute it + synchronously or asynchronous, control it's lifetime + and differe between jobs with and without configuration. + */ +class Job : public css::lang::XTypeProvider + , public css::task::XJobListener + , public css::frame::XTerminateListener + , public css::util::XCloseListener + , private ThreadHelpBase + , public ::cppu::OWeakObject +{ + //___________________________________ + // structs + + private: + + /** different possible states for the internal wrapped job. + It can be started, stopped by a queryClosing() request or + disposed() by a notifyClosing() request ... + */ + enum ERunState + { + E_NEW, + E_RUNNING, + E_STOPPED_OR_FINISHED, + E_DISPOSED + }; + + //___________________________________ + // member + + private: + + /** + hold all neccessary informations about this job. + It can be used for both modes: with and without configuration. + */ + JobData m_aJobCfg; + + /** + We need it to create own services on demand. + */ + css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR; + + /** + Hold the (may asynchronous) job alive. + */ + css::uno::Reference< css::uno::XInterface > m_xJob; + + /** + Used to wait for finishing of asynchronous started jobs. + */ + ::osl::Condition m_aAsyncWait; + + /** + For some special cases we must know the environment, in which + this job runs. Means the frame inside which we may was triggered. + We use it too, to listen for closing events of this ressource. + + Please note: If m_xFrame is set - m_xModel should be NULL. + Only one environment can be supported realy. + */ + css::uno::Reference< css::frame::XFrame > m_xFrame; + + /** + For some special cases we must know the environment, in which + this job runs. Means the document inside which we may was triggered. + We use it too, to listen for closing events of this ressource. + + Please note: If m_xModel is set - m_xFrame should be NULL. + Only one environment can be supported realy. + */ + css::uno::Reference< css::frame::XModel > m_xModel; + + /** + We are registered at this instance to listen for office shutdown events. + It's neccessary supress it (if possible) or to react in the right way. + */ + css::uno::Reference< css::frame::XDesktop > m_xDesktop; + + /** + A job can return a dispatch result event after finishing its work. + We have to transport it to any outside interested listener then. + (see m_xResultSourceFake for further informations too!) + */ + css::uno::Reference< css::frame::XDispatchResultListener > m_xResultListener; + + /** + We can't set ourself as source of a dispatch result event ... nor our job. + Because the listener (set as m_xResultListener) expect the original instance, + where it was registered. This original instance is the user of this class. + It must be set explicitly and will be used to fake the source of the event! + */ + css::uno::Reference< css::uno::XInterface > m_xResultSourceFake; + + /** + Holds the state, if we are listen for desktop/frame or model closing events or not. + The used references are not realy enough to detect a valid listener connection. + Thats why we use this additional information here too. + */ + sal_Bool m_bListenOnDesktop; + sal_Bool m_bListenOnFrame; + sal_Bool m_bListenOnModel; + + /** + In case we got a close request from our desktop/frame/model (on which we listen) ... and + the ownership was delivered there ... we have to close ourself and this object + in case the internal wrapped and running job finish his work. + */ + sal_Bool m_bPendingCloseFrame; + sal_Bool m_bPendingCloseModel; + + /** + indicates in which state the internal job currently exist. + + We can use this information to throw any suitable veto exception + to prevent the environment against dieing or supress superflous dispose() + calls at the job. + */ + ERunState m_eRunState; + + //___________________________________ + // native interface + + public: + + Job( const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR , + const css::uno::Reference< css::frame::XFrame >& xFrame ); + Job( const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR , + const css::uno::Reference< css::frame::XModel >& xModel ); + virtual ~Job( ); + + void setDispatchResultFake( const css::uno::Reference< css::frame::XDispatchResultListener >& xListener , + const css::uno::Reference< css::uno::XInterface >& xSourceFake ); + void setJobData ( const JobData& aData ); + void execute ( const css::uno::Sequence< css::beans::NamedValue >& lDynamicArgs ); + void die ( ); + + private: + + css::uno::Sequence< css::beans::NamedValue > impl_generateJobArgs ( const css::uno::Sequence< css::beans::NamedValue >& lDynamicArgs ); + void impl_reactForJobResult( const css::uno::Any& aResult ); + void impl_startListening ( ); + void impl_stopListening ( ); + + //___________________________________ + // uno interface + + public: + + FWK_DECLARE_XINTERFACE + FWK_DECLARE_XTYPEPROVIDER + + // XJobListener + virtual void SAL_CALL jobFinished( const css::uno::Reference< css::task::XAsyncJob >& xJob, + const css::uno::Any& aResult ) throw(css::uno::RuntimeException); + + // XTerminateListener + virtual void SAL_CALL queryTermination ( const css::lang::EventObject& aEvent ) throw(css::frame::TerminationVetoException, + css::uno::RuntimeException ); + virtual void SAL_CALL notifyTermination( const css::lang::EventObject& aEvent ) throw(css::uno::RuntimeException ); + + // XCloseListener + virtual void SAL_CALL queryClosing ( const css::lang::EventObject& aEvent , + sal_Bool bGetsOwnership ) throw(css::util::CloseVetoException, + css::uno::RuntimeException ); + virtual void SAL_CALL notifyClosing( const css::lang::EventObject& aEvent ) throw(css::uno::RuntimeException ); + + // XEventListener + virtual void SAL_CALL disposing( const css::lang::EventObject& aEvent ) throw(css::uno::RuntimeException); +}; + +} // namespace framework + +#endif // __FRAMEWORK_JOBS_JOB_HXX_ diff --git a/framework/inc/jobs/jobconst.hxx b/framework/inc/jobs/jobconst.hxx new file mode 100644 index 000000000000..3222479af82f --- /dev/null +++ b/framework/inc/jobs/jobconst.hxx @@ -0,0 +1,73 @@ +/************************************************************************* + * + * 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_JOBS_JOBCONST_HXX_ +#define __FRAMEWORK_JOBS_JOBCONST_HXX_ + +//_______________________________________ +// my own includes + +#include <stdtypes.h> +#include <general.h> + +//_______________________________________ +// interface includes + +//_______________________________________ +// other includes + +#include <rtl/ustring.hxx> +#include <fwidllapi.h> + +//_______________________________________ +// namespace + +namespace framework{ + +//_______________________________________ +// public const + +//_______________________________________ +/** + @short defines all constant values used within a job environment. + + @descr The protocol between job executor/dispatch and jobs is fix and well defined. + But why every implemented job should write such constant values directly into + it's code. Typos can occure or code will be changed by new developers ... + Shared set of constant values can help to improve the mentainance of this code. + */ +class FWI_DLLPUBLIC JobConst +{ + public: + static const ::rtl::OUString ANSWER_DEACTIVATE_JOB(); + static const ::rtl::OUString ANSWER_SAVE_ARGUMENTS(); + static const ::rtl::OUString ANSWER_SEND_DISPATCHRESULT(); +}; + +} // namespace framework + +#endif // __FRAMEWORK_JOBS_JOBCONST_HXX_ diff --git a/framework/inc/jobs/jobdata.hxx b/framework/inc/jobs/jobdata.hxx new file mode 100644 index 000000000000..e9cc79030770 --- /dev/null +++ b/framework/inc/jobs/jobdata.hxx @@ -0,0 +1,295 @@ +/************************************************************************* + * + * 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_JOBS_JOBDATA_HXX_ +#define __FRAMEWORK_JOBS_JOBDATA_HXX_ + +//_______________________________________ +// my own includes + +#include <jobs/configaccess.hxx> +#include <jobs/jobresult.hxx> +#include <threadhelp/threadhelpbase.hxx> +#include <macros/debug.hxx> +#include <stdtypes.h> +#include <general.h> + +//_______________________________________ +// interface includes +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/beans/NamedValue.hpp> +#include <com/sun/star/frame/DispatchResultEvent.hpp> + +//_______________________________________ +// other includes +#include <tools/datetime.hxx> +#include <rtl/ustring.hxx> + +//_______________________________________ +// namespace + +namespace framework{ + +//_______________________________________ +// public const + +//_______________________________________ +// definitions + +/** + @short holds all neccessary informations about a job and + handle it's configuration (if any exist!) + @descr It can be used rom different use cases as a container + (or proxy) for all config data of a registered job. + But it doesn't implement any execute functionality! + */ +class JobData : private ThreadHelpBase +{ + //___________________________________ + // const + + public: + + /// specifies the root package and key to find registered jobs + static const sal_Char* JOBCFG_ROOT; + /// define the cfg key "Arguments" of a job relativ to JOBCFG_ROOT/<job alias> + static const sal_Char* JOBCFG_PROP_ARGUMENTS; + /// define the cfg key "Service" of a job relativ to JOBCFG_ROOT/<job alias> + static const sal_Char* JOBCFG_PROP_SERVICE; + /// define the cfg key "Context" of a job relativ to JOBCFG_ROOT/<job alias> + static const sal_Char* JOBCFG_PROP_CONTEXT; + + /// specifies the root package and key to find event registrations + static const sal_Char* EVENTCFG_ROOT; + /// define the cfg key "JobList" of an event relativ to EVENTCFG_ROOT/<event> + static const sal_Char* EVENTCFG_PATH_JOBLIST; + /// define the cfg key "AdminTime" of a job registration relativ to EVENTCFG_ROOT/<event>/EVENTCFG_PROP_JOBLIST/<job alias> + static const sal_Char* EVENTCFG_PROP_ADMINTIME; + /// define the cfg key "UserTime" of a job registration relativ to EVENTCFG_ROOT/<event>/EVENTCFG_PROP_JOBLIST/<job alias> + static const sal_Char* EVENTCFG_PROP_USERTIME; + + /// mark the starting point of static job data inside argument list of job execution + static const sal_Char* PROPSET_CONFIG; + /// mark the starting point of job specific data inside argument list of job execution + static const sal_Char* PROPSET_OWNCONFIG; + /// mark the starting point of environment data inside argument list of job execution + static const sal_Char* PROPSET_ENVIRONMENT; + /// mark the starting point of any other dynamic generated data inside argument list of job execution (e.g. from a dispatch() request) + static const sal_Char* PROPSET_DYNAMICDATA; + + static const sal_Char* PROP_ALIAS; + static const sal_Char* PROP_EVENTNAME; + static const sal_Char* PROP_ENVTYPE; + static const sal_Char* PROP_FRAME; + static const sal_Char* PROP_MODEL; + static const sal_Char* PROP_SERVICE; + static const sal_Char* PROP_CONTEXT; + + //___________________________________ + // structs + + public: + + /** These values can be used to differe between jobs with and jobs without + a configuration. Of course an "unknown state" should be available too, + to detect a missing initialization. + */ + enum EMode + { + /// indicates a missing initialization + E_UNKNOWN_MODE, + /// indicates a job with configuration (They alias represent the config key name.) + E_ALIAS, + /// indicates a job without configuration (The pure UNO implementation is used only.) + E_SERVICE, + /// indicates a job with configuration, which was triggered by an event + E_EVENT + }; + + /** These values represent the environment type, in which a job can run. + A job must known, from which binding it will be started. Because + it's initialization data depends from that! + */ + enum EEnvironment + { + /// indicates a missing initialization + E_UNKNOWN_ENVIRONMENT, + /// this job is used by the global JobExecutor service + E_EXECUTION, + /// this job is used by the global dispatch framework + E_DISPATCH, + /// this job is used by the global event broadcaster + E_DOCUMENTEVENT + }; + + /** Some jobs can be registered to "logical events", which are generated on demand if another document event + occures. E.g. "onDocumentOpened" in case "OnNew" or "OnLoad" was notified to the JobExecutor instance. + And normaly the original event is transported as parameter set to the executed job. But then such job + cant differ between e.g. "OnNew" and "onDocumentOpened". + That's why we must know, for which type of event the job was realy triggered .-) + + The information "sDocEvent" from this struct must be set on the member JobData::m_sEvent from outside + user of such Jobdata structure. + */ + struct TJob2DocEventBinding + { + ::rtl::OUString m_sJobName; + ::rtl::OUString m_sDocEvent; + + TJob2DocEventBinding(const ::rtl::OUString& sJobName , + const ::rtl::OUString& sDocEvent) + : m_sJobName (sJobName ) + , m_sDocEvent(sDocEvent) + {} + }; + + //___________________________________ + // member + + private: + + /** + reference to the uno service manager. + We need it for creating of own uno services ... e.g. for + opening the configuration. + */ + css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR; + + /** + An instance of this class can be used in two different modes: + - as a configured job + - as a job without any configuration + First mode is triggered by an alias, which points to the + configuration entries. Second mode is specified by an uno service + or implementation name. Then we does the same things (use the same interfaces) + but don't handle any configuration data. + The effect: This mode can be detected by this member. + */ + EMode m_eMode; + + /** + Because jobs can be bind to different mechanism inside office, a job + should know inside which environment it runs. E.g. a job can be executed + by the global JobExecutor service (triggered by an event) or e.g. as part + of the global dispatch framework (triggered by an UI control e.g. a menu entry). + */ + EEnvironment m_eEnvironment; + + /** + the alias name of this job. + Is used as entry of configuration set for job registration, to find all + neccessary properties of it.. + */ + ::rtl::OUString m_sAlias; + + /** + the uno implementation name of this job. + It's readed from the configuration. Don't set it from outside! + */ + ::rtl::OUString m_sService; + + /** + the module context list of this job. + It's readed from the configuration. Don't set it from outside! + */ + ::rtl::OUString m_sContext; + + /** + a job can be registered for an event. + It can be an empty value! But it will be set from outside any times. + Because it's not clear which job this instance should represent if an event + (instaed of an alias) comes in. Because there can be multiple registrations + for this event. We use this information only, to merge it with the job specific + arguments. A job can be called so, with a) it's onw config data and b) some dynamic + environment data. + */ + ::rtl::OUString m_sEvent; + + /** + job specific configuration items ... unknown for us! + It's readed from the configuration. Don't set it from outside! + */ + css::uno::Sequence< css::beans::NamedValue > m_lArguments; + + /** + after a job was sucessfully executed (by any outside code using our + informations) it can return a result. This member make it part of this + container too. So it can be used for further things. + We use it also to update our internal state and the configuration + of the job. But note: only the last result will be saved here! + */ + JobResult m_aLastExecutionResult; + + //___________________________________ + // native interface + + public: + + JobData( const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR ); + JobData( const JobData& rCopy ); + virtual ~JobData( ); + + void operator=( const JobData& rCopy ); + + EMode getMode () const; + EEnvironment getEnvironment () const; + ::rtl::OUString getEnvironmentDescriptor() const; + ::rtl::OUString getService () const; + ::rtl::OUString getEvent () const; + css::uno::Sequence< css::beans::NamedValue > getConfig () const; + css::uno::Sequence< css::beans::NamedValue > getJobConfig () const; + + sal_Bool hasConfig () const; + sal_Bool hasCorrectContext ( const ::rtl::OUString& rModuleIdent ) const; + + void setEnvironment ( EEnvironment eEnvironment ); + void setAlias ( const ::rtl::OUString& sAlias ); + void setService ( const ::rtl::OUString& sService ); + void setEvent ( const ::rtl::OUString& sEvent , + const ::rtl::OUString& sAlias ); + void setJobConfig ( const css::uno::Sequence< css::beans::NamedValue >& lArguments ); + void setResult ( const JobResult& aResult ); + void disableJob ( ); + + static css::uno::Sequence< ::rtl::OUString > getEnabledJobsForEvent( const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR , + const ::rtl::OUString& sEvent ); + + static void appendEnabledJobsForEvent( const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR , + const ::rtl::OUString& sEvent , + ::comphelper::SequenceAsVector< JobData::TJob2DocEventBinding >& lJobs ); + + //___________________________________ + // private helper + + private: + + void impl_reset(); +}; + +} // namespace framework + +#endif // __FRAMEWORK_JOBS_JOBDATA_HXX_ diff --git a/framework/inc/jobs/jobdispatch.hxx b/framework/inc/jobs/jobdispatch.hxx new file mode 100644 index 000000000000..49b6b31b8cac --- /dev/null +++ b/framework/inc/jobs/jobdispatch.hxx @@ -0,0 +1,161 @@ +/************************************************************************* + * + * 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_JOBS_JOBDISPATCH_HXX_ +#define __FRAMEWORK_JOBS_JOBDISPATCH_HXX_ + +//_______________________________________ +// my own includes + +#include <jobs/configaccess.hxx> +#include <threadhelp/threadhelpbase.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> +#include <macros/debug.hxx> +#include <stdtypes.h> +#include <general.h> + +//_______________________________________ +// interface includes +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/frame/XNotifyingDispatch.hpp> +#include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/frame/XStatusListener.hpp> +#include <com/sun/star/frame/XDispatchResultListener.hpp> +#include <com/sun/star/task/XJobListener.hpp> +#include <com/sun/star/frame/XTerminateListener.hpp> +#include <com/sun/star/frame/XDispatchProvider.hpp> +#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/uno/XInterface.hpp> +#include <com/sun/star/beans/NamedValue.hpp> +#include <com/sun/star/frame/FeatureStateEvent.hpp> +#include <com/sun/star/frame/DispatchResultEvent.hpp> +#include <com/sun/star/lang/XInitialization.hpp> + +//_______________________________________ +// other includes +#include <unotools/configpathes.hxx> +#include <cppuhelper/weak.hxx> +#include <rtl/ustring.hxx> + +//_______________________________________ +// namespace + +namespace framework{ + +//_______________________________________ +// public const + +//_______________________________________ +/** + @short implements a dispatch object for jobs + @descr Such dispatch object will be used by the generic dispatch mechanism if + an URL "vnd.sun.star.job:alias=<name>" occures. + Then an instance of this class will be created and used. + This new instance will be called within his method + dispatch() or dispatchWithNotification() for executing the + real job. We do it, control the life cycle of this internal + wrapped job and inform any interested listener if it finish. + */ +class JobDispatch : public css::lang::XTypeProvider + , public css::lang::XServiceInfo + , public css::lang::XInitialization + , public css::frame::XDispatchProvider + , public css::frame::XNotifyingDispatch // => XDispatch + , private ThreadHelpBase + , public ::cppu::OWeakObject +{ + //___________________________________ + // member + + private: + + /** reference to the uno service manager */ + css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR; + + /** reference to the frame, inside which this dispatch is used */ + css::uno::Reference< css::frame::XFrame > m_xFrame; + + /** name of module (writer, impress etc.) the frame is for */ + ::rtl::OUString m_sModuleIdentifier; + + //___________________________________ + // native interface methods + + public: + + JobDispatch( const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR ); + virtual ~JobDispatch( ); + + void impl_dispatchEvent ( const ::rtl::OUString& sEvent , + const css::uno::Sequence< css::beans::PropertyValue >& lArgs , + const css::uno::Reference< css::frame::XDispatchResultListener >& xListener ); + void impl_dispatchService( const ::rtl::OUString& sService , + const css::uno::Sequence< css::beans::PropertyValue >& lArgs , + const css::uno::Reference< css::frame::XDispatchResultListener >& xListener ); + void impl_dispatchAlias ( const ::rtl::OUString& sAlias , + const css::uno::Sequence< css::beans::PropertyValue >& lArgs , + const css::uno::Reference< css::frame::XDispatchResultListener >& xListener ); + + //___________________________________ + // uno interface methods + + public: + + // XInterface, XTypeProvider, XServiceInfo + FWK_DECLARE_XINTERFACE + FWK_DECLARE_XTYPEPROVIDER + DECLARE_XSERVICEINFO + + // Xinitialization + virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& lArguments ) throw(css::uno::Exception , + css::uno::RuntimeException); + + // XDispatchProvider + virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL queryDispatch ( const css::util::URL& aURL , + const ::rtl::OUString& sTargetFrameName , + sal_Int32 nSearchFlags ) throw(css::uno::RuntimeException); + virtual css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL queryDispatches( const css::uno::Sequence< css::frame::DispatchDescriptor >& lDescriptor ) throw(css::uno::RuntimeException); + + // XNotifyingDispatch + virtual void SAL_CALL dispatchWithNotification( const css::util::URL& aURL , + const css::uno::Sequence< css::beans::PropertyValue >& lArgs , + const css::uno::Reference< css::frame::XDispatchResultListener >& xListener ) throw(css::uno::RuntimeException); + + // XDispatch + virtual void SAL_CALL dispatch ( const css::util::URL& aURL , + const css::uno::Sequence< css::beans::PropertyValue >& lArgs ) throw(css::uno::RuntimeException); + virtual void SAL_CALL addStatusListener ( const css::uno::Reference< css::frame::XStatusListener >& xListener , + const css::util::URL& aURL ) throw(css::uno::RuntimeException); + virtual void SAL_CALL removeStatusListener( const css::uno::Reference< css::frame::XStatusListener >& xListener , + const css::util::URL& aURL ) throw(css::uno::RuntimeException); +}; + +} // namespace framework + +#endif // __FRAMEWORK_JOBS_JOBDISPATCH_HXX_ diff --git a/framework/inc/jobs/jobexecutor.hxx b/framework/inc/jobs/jobexecutor.hxx new file mode 100644 index 000000000000..955b2978f791 --- /dev/null +++ b/framework/inc/jobs/jobexecutor.hxx @@ -0,0 +1,133 @@ +/************************************************************************* + * + * 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_JOBS_JOBEXECUTOR_HXX_ +#define __FRAMEWORK_JOBS_JOBEXECUTOR_HXX_ + +//_______________________________________ +// my own includes + +#include <jobs/configaccess.hxx> +#include <threadhelp/threadhelpbase.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> +#include <macros/debug.hxx> +#include <stdtypes.h> +#include <general.h> + +//_______________________________________ +// interface includes +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/task/XJobExecutor.hpp> +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/container/XContainerListener.hpp> +#include <com/sun/star/lang/XEventListener.hpp> +#include <com/sun/star/document/XEventListener.hpp> +#include <com/sun/star/frame/XModuleManager.hpp> + +//_______________________________________ +// other includes +#include <cppuhelper/weak.hxx> +#include <rtl/ustring.hxx> + +//_______________________________________ +// namespace + +namespace framework{ + +//_______________________________________ +// public const + +//_______________________________________ +/** + @short implements a job executor, which can be triggered from any code + @descr It uses the given trigger event to locate any registered job service + inside the configuration and execute it. Of course it controls the + liftime of such jobs too. + */ +class JobExecutor : public css::lang::XTypeProvider + , public css::lang::XServiceInfo + , public css::task::XJobExecutor + , public css::container::XContainerListener // => lang.XEventListener + , public css::document::XEventListener + , private ThreadHelpBase + , public ::cppu::OWeakObject +{ + //___________________________________ + // member + + private: + + /** reference to the uno service manager */ + css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR; + + /** reference to the module info service */ + css::uno::Reference< css::frame::XModuleManager > m_xModuleManager; + + /** cached list of all registered event names of cfg for call optimization. */ + OUStringList m_lEvents; + + /** we listen at the configuration for changes at the event list. */ + ConfigAccess m_aConfig; + + //___________________________________ + // native interface methods + + public: + + JobExecutor( const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR ); + virtual ~JobExecutor( ); + + //___________________________________ + // uno interface methods + + public: + + // XInterface, XTypeProvider, XServiceInfo + FWK_DECLARE_XINTERFACE + FWK_DECLARE_XTYPEPROVIDER + DECLARE_XSERVICEINFO + + // task.XJobExecutor + virtual void SAL_CALL trigger( const ::rtl::OUString& sEvent ) throw(css::uno::RuntimeException); + + // document.XEventListener + virtual void SAL_CALL notifyEvent( const css::document::EventObject& aEvent ) throw(css::uno::RuntimeException); + + // container.XContainerListener + virtual void SAL_CALL elementInserted( const css::container::ContainerEvent& aEvent ) throw(css::uno::RuntimeException); + virtual void SAL_CALL elementRemoved ( const css::container::ContainerEvent& aEvent ) throw(css::uno::RuntimeException); + virtual void SAL_CALL elementReplaced( const css::container::ContainerEvent& aEvent ) throw(css::uno::RuntimeException); + + // lang.XEventListener + virtual void SAL_CALL disposing( const css::lang::EventObject& aEvent ) throw(css::uno::RuntimeException); +}; + +} // namespace framework + +#endif // __FRAMEWORK_JOBS_JOBEXECUTOR_HXX_ diff --git a/framework/inc/jobs/jobresult.hxx b/framework/inc/jobs/jobresult.hxx new file mode 100644 index 000000000000..9d2a7c1419cd --- /dev/null +++ b/framework/inc/jobs/jobresult.hxx @@ -0,0 +1,147 @@ +/************************************************************************* + * + * 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_JOBS_JOBRESULT_HXX_ +#define __FRAMEWORK_JOBS_JOBRESULT_HXX_ + +//_______________________________________ +// my own includes + +#include <threadhelp/threadhelpbase.hxx> +#include <macros/debug.hxx> +#include <stdtypes.h> +#include <general.h> + +//_______________________________________ +// interface includes +#include <com/sun/star/beans/NamedValue.hpp> +#include <com/sun/star/frame/DispatchResultEvent.hpp> + +//_______________________________________ +// other includes +#include <rtl/ustring.hxx> + +//_______________________________________ +// namespace + +namespace framework{ + +//_______________________________________ +// public const + +//_______________________________________ +/** + @short represent a result of a finished job execution + @descr Such result instance transport all neccessarry + data from the code place where the job was finished + to the outside code, where e.g. listener must be notified. + */ +class JobResult : private ThreadHelpBase +{ + //___________________________________ + // types + + public: + + /** + These enum values are used to build a flag mask of possible set + parts of an analyzed pure job execution result. + An user of this class can decide, if a member of us can be valid + or not. So it can indicate, if a job used the special part inside + his returned result protocol. + To be usable as flags - it must be values of set {0,1,2,4,8,16 ...}! + */ + enum EParts + { + E_NOPART = 0, + E_ARGUMENTS = 1, + E_DEACTIVATE = 2, + E_DISPATCHRESULT = 4 + }; + + //___________________________________ + // member + + private: + + /** hold the original pure result, which was given back by an + executed job + We analyze it and use it to set all our other members. + */ + css::uno::Any m_aPureResult; + + /** + an user of us must know, which (possible) parts of + a "pure result" was realy set by an executed job. + Means which other members of this class are valid. + This mask can be used to find it out. + */ + sal_uInt32 m_eParts; + + /** + a job can have persistent data + They are part of the pure result and will be used to + write it to the configuration. But that's part of any + user of us. We provide this information here only. + */ + css::uno::Sequence< css::beans::NamedValue > m_lArguments; + + /** + an executed job can force his deactivation + But we provide this information here only. + Doing so is part of any user of us. + */ + sal_Bool m_bDeactivate; + + /** + represent the part "DispatchResult" + It's a full filled event type, which was given + back by the executed job. Any user of us can send + it to his registered result listener directly. + */ + css::frame::DispatchResultEvent m_aDispatchResult; + + //___________________________________ + // native interface + + public: + + JobResult( ); + JobResult( const com::sun::star::uno::Any& aResult ); + JobResult( const JobResult& rCopy ); + virtual ~JobResult( ); + + void operator=( const JobResult& rCopy ); + + sal_Bool existPart ( sal_uInt32 eParts ) const; + css::uno::Sequence< css::beans::NamedValue > getArguments ( ) const; + css::frame::DispatchResultEvent getDispatchResult( ) const; +}; + +} // namespace framework + +#endif // __FRAMEWORK_JOBS_JOBRESULT_HXX_ diff --git a/framework/inc/jobs/joburl.hxx b/framework/inc/jobs/joburl.hxx new file mode 100644 index 000000000000..15cc4f37da2e --- /dev/null +++ b/framework/inc/jobs/joburl.hxx @@ -0,0 +1,177 @@ +/************************************************************************* + * + * 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_JOBS_JOBURL_HXX_ +#define __FRAMEWORK_JOBS_JOBURL_HXX_ + +//_______________________________________ +// my own includes + +#include <threadhelp/threadhelpbase.hxx> +#include <macros/debug.hxx> +#include <stdtypes.h> +#include <general.h> + +//_______________________________________ +// interface includes + +//_______________________________________ +// other includes +#include <rtl/ustring.hxx> + +//_______________________________________ +// namespace + +namespace framework{ + +//_______________________________________ +// const + +#define JOBURL_PROTOCOL_STR "vnd.sun.star.job:" +#define JOBURL_PROTOCOL_LEN 17 + +#define JOBURL_EVENT_STR "event=" +#define JOBURL_EVENT_LEN 6 + +#define JOBURL_ALIAS_STR "alias=" +#define JOBURL_ALIAS_LEN 6 + +#define JOBURL_SERVICE_STR "service=" +#define JOBURL_SERVICE_LEN 8 + +#define JOBURL_PART_SEPERATOR ';' +#define JOBURL_PARTARGS_SEPERATOR ',' + +//_______________________________________ +/** + @short can be used to parse, validate and work with job URL's + @descr Job URLs are specified by the following syntax: + vnd.sun.star.job:{[event=<name>]|[alias=<name>]|[service=<name>]} + This class can analyze this structure and seperate it into his different parts. + After doing that these parts are accessible by the methods of this class. + */ +class JobURL : private ThreadHelpBase +{ + //___________________________________ + // types + + private: + + /** + possible states of a job URL + Note: These values are used in combination. So they must be + values in form 2^n. + */ + enum ERequest + { + /// mark a job URL as not valid + E_UNKNOWN = 0, + /// it's an event + E_EVENT = 1, + /// it's an alias + E_ALIAS = 2, + /// it's a service + E_SERVICE = 4 + }; + + //___________________________________ + // types + + private: + + /** knows the state of this URL instance */ + sal_uInt32 m_eRequest; + + /** holds the event part of a job URL */ + ::rtl::OUString m_sEvent; + + /** holds the alias part of a job URL */ + ::rtl::OUString m_sAlias; + + /** holds the service part of a job URL */ + ::rtl::OUString m_sService; + + /** holds the event arguments */ + ::rtl::OUString m_sEventArgs; + + /** holds the alias arguments */ + ::rtl::OUString m_sAliasArgs; + + /** holds the service arguments */ + ::rtl::OUString m_sServiceArgs; + + //___________________________________ + // native interface + + public: + + JobURL ( const ::rtl::OUString& sURL ); + sal_Bool isValid ( ) const; + sal_Bool getEvent ( ::rtl::OUString& sEvent ) const; + sal_Bool getAlias ( ::rtl::OUString& sAlias ) const; + sal_Bool getService ( ::rtl::OUString& sService ) const; + + //___________________________________ + // private helper + + private: + + static sal_Bool implst_split( const ::rtl::OUString& sPart , + const sal_Char* pPartIdentifier , + sal_Int32 nPartLength , + ::rtl::OUString& rPartValue , + ::rtl::OUString& rPartArguments ); + + //___________________________________ + // debug methods! + + #ifdef ENABLE_COMPONENT_SELF_CHECK + + public: + static void impldbg_checkIt(); + + private: + static void impldbg_checkURL( const sal_Char* pURL , + sal_uInt32 eExpectedPart , + const sal_Char* pExpectedEvent , + const sal_Char* pExpectedAlias , + const sal_Char* pExpectedService , + const sal_Char* pExpectedEventArgs , + const sal_Char* pExpectedAliasArgs , + const sal_Char* pExpectedServiceArgs ); + ::rtl::OUString impldbg_toString() const; + + sal_Bool getServiceArgs( ::rtl::OUString& sServiceArgs ) const; + sal_Bool getEventArgs ( ::rtl::OUString& sEventArgs ) const; + sal_Bool getAliasArgs ( ::rtl::OUString& sAliasArgs ) const; + + #endif // ENABLE_COMPONENT_SELF_CHECK +}; + +} // namespace framework + +#endif // __FRAMEWORK_JOBS_JOBURL_HXX_ diff --git a/framework/inc/jobs/shelljob.hxx b/framework/inc/jobs/shelljob.hxx new file mode 100644 index 000000000000..48096a9449e3 --- /dev/null +++ b/framework/inc/jobs/shelljob.hxx @@ -0,0 +1,169 @@ +/************************************************************************* + * + * 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_JOBS_SHELLJOB_HXX_ +#define __FRAMEWORK_JOBS_SHELLJOB_HXX_ + +//_______________________________________________ +// my own includes + +#include <threadhelp/threadhelpbase.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> + +//_______________________________________________ +// other includes +#include <cppuhelper/implbase2.hxx> + +//_______________________________________________ +// uno includes +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/task/XJob.hpp> +#include <com/sun/star/lang/XEventListener.hpp> +#include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/frame/XModuleManager.hpp> + +//_______________________________________________ +// namespace + +namespace framework{ + +//_______________________________________________ +// declarations + +//_______________________________________________ +/** @short implements a job component which can be used + to execute system shell commands. + + @descr Because the job will be implemented generic + it can be bound to any event where jobs can be + registered for. Further there is a generic + way to configure the shell command and it's list + of arguments. + + @author as96863 + */ +class ShellJob : private ThreadHelpBase + ,public ::cppu::WeakImplHelper2< ::com::sun::star::lang::XServiceInfo,::com::sun::star::task::XJob > +{ + //------------------------------------------- + // member + private: + + //....................................... + /** @short reference to an uno service manager. */ + css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR; + + //------------------------------------------- + // native interface + public: + + //--------------------------------------- + /** @short create new instance of this class. + + @param xSMGR + reference to the uno service manager, which created this instance. + Can be used later to create own needed uno resources on demand. + */ + ShellJob(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR); + + //--------------------------------------- + /** @short does nothing real ... + + @descr But it should exists as virtual function, + so this class cant make trouble + related to inline/symbols etcpp.! + */ + virtual ~ShellJob(); + + //------------------------------------------- + // uno interface + public: + + //--------------------------------------- + // css.lang.XServiceInfo + DECLARE_XSERVICEINFO + + // css.task.XJob + virtual css::uno::Any SAL_CALL execute(const css::uno::Sequence< css::beans::NamedValue >& lArguments) + throw(css::lang::IllegalArgumentException, + css::uno::Exception , + css::uno::RuntimeException ); + + //------------------------------------------- + // helper + private: + + //--------------------------------------- + /** generate a return value for method execute() + which will force deactivation of this job for further requests. + + @return an Any following the job protocol for deactivation. + */ + static css::uno::Any impl_generateAnswer4Deactivation(); + + //--------------------------------------- + /** substitute all might existing placeholder variables + within the configured command. + + The command is part of the job configuration. + These will make changes more easy (no code changes required). + Further the command can use placeholder as they are supported + by the global substitution service (e.g. $(prog) etcpp) + + @param sCommand + the command containing placeholder variables. + + @return the substituted command. + */ + ::rtl::OUString impl_substituteCommandVariables(const ::rtl::OUString& sCommand); + + //--------------------------------------- + /** executes the command. + + @param sCommand + the absolute command as URL or system path (without any argument !). + + @param lArguments + the complete list of arguments configured for these job. + + @param bCheckExitCode + bind the execution result to the exit code of the started process. + If it's set to false we return false only in case executable couldnt be found + or couldnt be started. + + @return sal_True if command was executed successfully; sal_False otherwise. + */ + ::sal_Bool impl_execute(const ::rtl::OUString& sCommand , + const css::uno::Sequence< ::rtl::OUString >& lArguments , + ::sal_Bool bCheckExitCode); +}; + +} // namespace framework + +#endif // __FRAMEWORK_JOBS_SHELLJOB_HXX_ diff --git a/framework/inc/loadstate.h b/framework/inc/loadstate.h new file mode 100644 index 000000000000..5ed1e86e8e44 --- /dev/null +++ b/framework/inc/loadstate.h @@ -0,0 +1,115 @@ +/************************************************************************* + * + * 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_LOADSTATE_H_ +#define __FRAMEWORK_LOADSTATE_H_ + +//_________________________________________________________________________________________________________________ +// includes +//_________________________________________________________________________________________________________________ + +#include <com/sun/star/ucb/InteractiveIOException.hpp> +#include <com/sun/star/ucb/InteractiveAugmentedIOException.hpp> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_______________________________________________________________________ +/** + These enum values specify all possible results of a load request. + It doesn't matter, if this load operation used dispatch() or loadComponentFromURL(). + The meaning is everytime the same. + */ +enum ELoadState +{ + E_UNSPECIFIED = 0, // indicates the operation was not already started + E_SUCCESS = 1, // the load request was successfull + E_IOERROR = 2, // there was an io error internaly + E_INTERACTION = 3, // there was an interaction, which couldn't be handled (doesn't include IO interactions => see E_IOERROR before) + E_FAILED = 4 // for unknown or unspecified errors +}; + +//_______________________________________________________________________ +/** + Helper, which provides some functionality to identify the reason for + a failed load request and can describe it. + */ +class LoadStateHelper +{ + public: + + //_________________________________ + /** + @short checks if the given interaction request was an io error + @descr This information can be used to throw + a suitable IOException. (e.g. loadComponentFromURL()) + + @param aRequest + the original interaction request, which may produced + the failed load request + + @param rReason + in case this Method returns <sal_True/> the referred string object + will be used to set the original message of the + aborted io exception on it. + If method returns <sal_False/> rReason was not used. + + @return [boolean] + <sal_True/> in case it was an IO error + <sal_False/> in case it wasn't an IO error or interaction was not used + */ + static sal_Bool wasIOError( const css::uno::Any& aRequest , + rtl::OUString& rReason ) + { + if ( ! aRequest.hasValue() ) + return sal_False; + + css::ucb::InteractiveIOException exIOInteractive ; + css::ucb::InteractiveAugmentedIOException exIOAugmented ; + + if (aRequest>>=exIOInteractive) + { + rReason = exIOInteractive.Message; + return sal_True; + } + + if (aRequest>>=exIOAugmented) + { + rReason = exIOAugmented.Message; + return sal_True; + } + + return sal_False; + } +}; + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_LOADSTATE_H_ diff --git a/framework/inc/macros/debug.hxx b/framework/inc/macros/debug.hxx new file mode 100644 index 000000000000..f48d816460d2 --- /dev/null +++ b/framework/inc/macros/debug.hxx @@ -0,0 +1,137 @@ +/************************************************************************* + * + * 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_MACROS_DEBUG_HXX_ +#define __FRAMEWORK_MACROS_DEBUG_HXX_ + +//***************************************************************************************************************** +// Disable all feature of this file in produkt version! +// But enable normal assertion handling (as messagebox) in normal debug version. +// User can overwrite these adjustment with his own values! We will do it only if nothing is set. +//***************************************************************************************************************** + +//----------------------------------------------------------------------------------------------------------------- +// => "personal debug code" +#if OSL_DEBUG_LEVEL > 1 + + // Enable log mechanism for normal assertion and error handling. + // Look for user decisions before! + #ifndef ENABLE_LOGMECHANISM + #define ENABLE_LOGMECHANISM + #endif + // Enable assertion handling himself AND additional warnings. + // The default logtype is MESSAGEBOX. + // see "assertion.hxx" for further informations + #ifndef ENABLE_ASSERTIONS + #define ENABLE_ASSERTIONS + #endif + #ifndef ENABLE_WARNINGS + #define ENABLE_WARNINGS + #endif + +//----------------------------------------------------------------------------------------------------------------- +// => "non product" +#elif OSL_DEBUG_LEVEL > 0 + + // Enable log mechanism for normal assertion and error handling. + // Look for user decisions before! + #ifndef ENABLE_LOGMECHANISM + #define ENABLE_LOGMECHANISM + #endif + // Enable assertion handling himself. + // The default logtype is MESSAGEBOX. + // see "assertion.hxx" for further informations + #ifndef ENABLE_ASSERTIONS + #define ENABLE_ASSERTIONS + #endif + +//----------------------------------------------------------------------------------------------------------------- +// => "product" (OSL_DEBUG_LEVEL == 0) +#else + + #undef ENABLE_LOGMECHANISM + #undef ENABLE_ASSERTIONS + #undef ENABLE_WARNINGS + #undef ENABLE_EVENTDEBUG + #undef ENABLE_REGISTRATIONDEBUG + #undef ENABLE_TARGETINGDEBUG + #undef ENABLE_MUTEXDEBUG +// #undef ENABLE_TIMEMEASURE + #undef ENABLE_MEMORYMEASURE + #undef ENABLE_FILTERDBG + +#endif + +//***************************************************************************************************************** +// generic macros for logging +//***************************************************************************************************************** + +#include <macros/debug/logmechanism.hxx> + +//***************************************************************************************************************** +// special macros for assertion handling +//***************************************************************************************************************** +#include <macros/debug/assertion.hxx> + +//***************************************************************************************************************** +// special macros for event handling +//***************************************************************************************************************** +#include <macros/debug/event.hxx> + +//***************************************************************************************************************** +// special macros to debug service registration +//***************************************************************************************************************** +#include <macros/debug/registration.hxx> + +//***************************************************************************************************************** +// special macros to debug targeting of frames +//***************************************************************************************************************** +#include <macros/debug/targeting.hxx> + +//***************************************************************************************************************** +// special macros to debug threading mechanism +//***************************************************************************************************************** +#include <macros/debug/mutex.hxx> + +//***************************************************************************************************************** +// special macros to measure times of some operations +//***************************************************************************************************************** + +/*OBSOLETE +#include <macros/debug/timemeasure.hxx> +*/ + +//***************************************************************************************************************** +// special macros to debug our filter cache! +//***************************************************************************************************************** +#include <macros/debug/filterdbg.hxx> + +//***************************************************************************************************************** +// end of file +//***************************************************************************************************************** + +#endif // #ifndef __FRAMEWORK_MACROS_DEBUG_HXX_ diff --git a/framework/inc/macros/debug/assertion.hxx b/framework/inc/macros/debug/assertion.hxx new file mode 100644 index 000000000000..080dd5805b30 --- /dev/null +++ b/framework/inc/macros/debug/assertion.hxx @@ -0,0 +1,235 @@ +/************************************************************************* + * + * 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_MACROS_DEBUG_ASSERTION_HXX_ +#define __FRAMEWORK_MACROS_DEBUG_ASSERTION_HXX_ + +//_________________________________________________________________________________________________________________ +// includes +//_________________________________________________________________________________________________________________ + +#if defined( ENABLE_ASSERTIONS ) || defined( ENABLE_WARNINGS ) + + #ifndef _OSL_DIAGNOSE_H_ + #include <osl/diagnose.h> + #endif + + #ifndef _RTL_STRBUF_HXX_ + #include <rtl/strbuf.hxx> + #endif + +#endif + +//***************************************************************************************************************** +// special macros for assertion handling +// 1) LOGTYPE use it to define the output of all assertions, errors, exception infos +// 2) LOGFILE_ASSERTIONS use it to define the file name to log assertions if LOGTYPE=LOGTYPE_FILE... +// 3) LOGFILE_WARNINGS use it to define the file name to log warnings if LOGTYPE=LOGTYPE_FILE... +// +// active for "non product": +// +// 4) LOG_ASSERT( BCONDITION, STEXT ) assert some critical errors wich depend from given condition +// 4a) LOG_ASSERT2( BCONDITION, SMETHOD, STEXT ) same like 4) + additional location of error +// 5) LOG_ERROR( SMETHOD, STEXT ) show errors without any condition +// +// active for debug only! +// +// 6) LOG_EXCEPTION( SMETHOD, SOWNMESSAGE, SEXCEPTIONMESSAGE ) show/log an exception for easier debug +// 7) LOG_WARNING( SMETHOD, STEXT ) should be used to detect leaks in algorithm, mechanism or operation handling +//***************************************************************************************************************** + +//_________________________________________________________________________________________________________________ +#if defined( ENABLE_ASSERTIONS ) || defined( ENABLE_WARNINGS ) + + /*_____________________________________________________________________________________________________________ + LOGFILE_ASSERTIONS + + For follow macros we need a special log file. If user forget to specify anyone, we must do it for him! + _____________________________________________________________________________________________________________*/ + + #ifndef LOGFILE_ASSERTIONS + #define LOGFILE_ASSERTIONS "_framework_assertions.log" + #endif + + /*_____________________________________________________________________________________________________________ + LOG_ASSERT ( BCONDITION, STEXT ) + LOG_ASSERT2( BCONDITION, SMETHOD, STEXT ) + + Forward assertion to logfile (if condition is sal_False - like a DBG_ASSERT!) and continue with program. + Set LOGTYPE to LOGTYPE_FILECONTINUE to do this. + BCONDITION is inserted in "(...)" because user can call this macro with an complex expression! + _____________________________________________________________________________________________________________*/ + #if LOGTYPE==LOGTYPE_FILECONTINUE + + #define LOG_ASSERT( BCONDITION, STEXT ) \ + if ( ( BCONDITION ) == sal_False ) \ + { \ + WRITE_LOGFILE( LOGFILE_ASSERTIONS, STEXT ) \ + } + + #define LOG_ASSERT2( BCONDITION, SMETHOD, STEXT ) \ + if ( ( BCONDITION ) == sal_True ) \ + { \ + ::rtl::OStringBuffer _sAssertBuffer( 256 ); \ + _sAssertBuffer.append( "ASSERT:\n\t" ); \ + _sAssertBuffer.append( SMETHOD ); \ + _sAssertBuffer.append( "\n\t\"" ); \ + _sAssertBuffer.append( STEXT ); \ + _sAssertBuffer.append( "\"\n" ); \ + WRITE_LOGFILE( LOGFILE_ASSERTIONS, _sAssertBuffer.makeStringAndClear() ) \ + } + + #endif + + /*_____________________________________________________________________________________________________________ + LOG_ASSERT ( BCONDITION, STEXT ) + LOG_ASSERT2( BCONDITION, SMETHOD, STEXT ) + + Forward assertion to file and exit the program. + Set LOGTYPE to LOGTYPE_FILEEXIT to do this. + BCONDITION is inserted in "(...)" because user can call this macro with an complex expression! + _____________________________________________________________________________________________________________*/ + #if LOGTYPE==LOGTYPE_FILEEXIT + + #define LOG_ASSERT( BCONDITION, STEXT ) \ + if ( ( BCONDITION ) == sal_False ) \ + { \ + WRITE_LOGFILE( LOGFILE_ASSERTIONS, STEXT ) \ + exit(-1); \ + } + + #define LOG_ASSERT2( BCONDITION, SMETHODE, STEXT ) \ + if ( ( BCONDITION ) == sal_True ) \ + { \ + ::rtl::OStringBuffer _sAssertBuffer( 256 ); \ + _sAssertBuffer.append( "ASSERT:\n\t" ); \ + _sAssertBuffer.append( SMETHOD ); \ + _sAssertBuffer.append( "\n\t\"" ); \ + _sAssertBuffer.append( STEXT ); \ + _sAssertBuffer.append( "\"\n" ); \ + WRITE_LOGFILE( LOGFILE_ASSERTIONS, _sAssertBuffer.makeStringAndClear() ) \ + exit(-1); \ + } + + #endif + + /*_____________________________________________________________________________________________________________ + LOG_ASSERT ( BCONDITION, STEXT ) + LOG_ASSERT2( BCONDITION, SMETHOD, STEXT ) + + Forward assertions to messagebox. (We use OSL_ENSURE to do this.) + Set LOGTYPE to LOGTYPE_MESSAGEBOX to do this. + BCONDITION is inserted in "(...)" because user can call this macro with an complex expression! + _____________________________________________________________________________________________________________*/ + #if LOGTYPE==LOGTYPE_MESSAGEBOX + + #define LOG_ASSERT( BCONDITION, STEXT ) \ + OSL_ENSURE( ( BCONDITION ), STEXT ); + + #define LOG_ASSERT2( BCONDITION, SMETHOD, STEXT ) \ + { \ + ::rtl::OStringBuffer _sAssertBuffer( 256 ); \ + _sAssertBuffer.append( "ASSERT:\n\t" ); \ + _sAssertBuffer.append( SMETHOD ); \ + _sAssertBuffer.append( "\n\t\"" ); \ + _sAssertBuffer.append( STEXT ); \ + _sAssertBuffer.append( "\"\n" ); \ + OSL_ENSURE( !( BCONDITION ), _sAssertBuffer.makeStringAndClear() ); \ + } + + #endif + + /*_____________________________________________________________________________________________________________ + LOG_ERROR( SMETHOD, STEXT ) + + Show an error by using current set output mode by define LOGTYPE! + _____________________________________________________________________________________________________________*/ + + #define LOG_ERROR( SMETHOD, STEXT ) \ + LOG_ASSERT2( sal_True, SMETHOD, STEXT ) + +#else + + // If right testmode is'nt set - implements these macros empty! + #undef LOGFILE_ASSERTIONS + #define LOG_ASSERT( BCONDITION, STEXT ) + #define LOG_ASSERT2( BCONDITION, SMETHOD, STEXT ) + #define LOG_ERROR( SMETHOD, STEXT ) + +#endif // ENABLE_ASSERTIONS + +//_________________________________________________________________________________________________________________ +#if defined( ENABLE_WARNINGS ) + + /*_____________________________________________________________________________________________________________ + LOGFILE_WARNINGS + + For follow macros we need a special log file. If user forget to specify anyone, we must do it for him! + _____________________________________________________________________________________________________________*/ + + #ifndef LOGFILE_WARNINGS + #define LOGFILE_WARNINGS "_framework_warnings.log" + #endif + + /*_____________________________________________________________________________________________________________ + LOG_EXCEPTION( SMETHOD, SOWNMESSAGE, SEXCEPTIONMESSAGE ) + + Show some exception info by using current set output mode by define LOGTYPE! + We use a seperated scope {} do protect us against multiple variable definitions. + _____________________________________________________________________________________________________________*/ + + #define LOG_EXCEPTION( SMETHOD, SOWNMESSAGE, SEXCEPTIONMESSAGE ) \ + { \ + ::rtl::OStringBuffer _sAssertBuffer2( 256 ); \ + _sAssertBuffer2.append( SOWNMESSAGE ); \ + _sAssertBuffer2.append( "\n" ); \ + _sAssertBuffer2.append( U2B(SEXCEPTIONMESSAGE) ); \ + LOG_ERROR( SMETHOD, _sAssertBuffer2.makeStringAndClear() ) \ + } + + /*_____________________________________________________________________________________________________________ + LOG_WARNING( SMETHOD, STEXT ) + + Use it to show/log warnings for programmer for follow reasons: + - algorithm errors + - undefined states + - unknown errors from other modules ... + _____________________________________________________________________________________________________________*/ + + #define LOG_WARNING( SMETHOD, STEXT ) \ + LOG_ERROR( SMETHOD, STEXT ) + +#else + + // If right testmode is'nt set - implements these macros empty! + #undef LOGFILE_WARNINGS + #define LOG_EXCEPTION( SMETHOD, SOWNMESSAGE, SEXCEPTIONMESSAGE ) + #define LOG_WARNING( SMETHOD, STEXT ) + +#endif // ENABLE_WARNINGS + +#endif // #ifndef __FRAMEWORK_MACROS_DEBUG_ASSERTION_HXX_ diff --git a/framework/inc/macros/debug/event.hxx b/framework/inc/macros/debug/event.hxx new file mode 100644 index 000000000000..794057100766 --- /dev/null +++ b/framework/inc/macros/debug/event.hxx @@ -0,0 +1,132 @@ +/************************************************************************* + * + * 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_MACROS_DEBUG_EVENT_HXX_ +#define __FRAMEWORK_MACROS_DEBUG_EVENT_HXX_ + +//************************************************************************************************************* +// special macros for event handling +//************************************************************************************************************* + +#ifdef ENABLE_EVENTDEBUG + + //_________________________________________________________________________________________________________________ + // includes + //_________________________________________________________________________________________________________________ + + #ifndef _RTL_STRBUF_HXX_ + #include <rtl/strbuf.hxx> + #endif + + /*_____________________________________________________________________________________________________________ + LOGFILE_EVENTDEBUG + + For follow macros we need a special log file. If user forget to specify anyone, we must do it for him! + _____________________________________________________________________________________________________________*/ + + #ifndef LOGFILE_EVENTDEBUG + #define LOGFILE_EVENTDEBUG \ + "events.log" + #endif + + /*_____________________________________________________________________________________________________________ + LOG_FRAMEACTIONEVENT( SFRAMETYPE, SFRAMENAME, AFRAMEACTION ) + + Use this macro to print debug informations about sending of events to listener for controling right order. + ( Use new scope in macro to declare sBuffer more then on time in same "parentscope"! ) + _____________________________________________________________________________________________________________*/ + + #define LOG_FRAMEACTIONEVENT( SFRAMETYPE, SFRAMENAME, AFRAMEACTION ) \ + { \ + ::rtl::OStringBuffer sBuffer(1024); \ + sBuffer.append( "[ " ); \ + sBuffer.append( SFRAMETYPE ); \ + sBuffer.append( " ] \"" ); \ + sBuffer.append( U2B( SFRAMENAME ) ); \ + sBuffer.append( "\" send event \"" ); \ + switch( AFRAMEACTION ) \ + { \ + case ::com::sun::star::frame::FrameAction_COMPONENT_ATTACHED : sBuffer.append("COMPONENT ATTACHED" ); \ + break; \ + case ::com::sun::star::frame::FrameAction_COMPONENT_DETACHING : sBuffer.append("COMPONENT DETACHING" ); \ + break; \ + case ::com::sun::star::frame::FrameAction_COMPONENT_REATTACHED : sBuffer.append("COMPONENT REATTACHED" ); \ + break; \ + case ::com::sun::star::frame::FrameAction_FRAME_ACTIVATED : sBuffer.append("FRAME ACTIVATED" ); \ + break; \ + case ::com::sun::star::frame::FrameAction_FRAME_DEACTIVATING : sBuffer.append("FRAME DEACTIVATING" ); \ + break; \ + case ::com::sun::star::frame::FrameAction_CONTEXT_CHANGED : sBuffer.append("CONTEXT CHANGED" ); \ + break; \ + case ::com::sun::star::frame::FrameAction_FRAME_UI_ACTIVATED : sBuffer.append("FRAME UI ACTIVATED" ); \ + break; \ + case ::com::sun::star::frame::FrameAction_FRAME_UI_DEACTIVATING : sBuffer.append("FRAME UI DEACTIVATING" ); \ + break; \ + case ::com::sun::star::frame::FrameAction_MAKE_FIXED_SIZE : sBuffer.append("MAKE_FIXED_SIZE" ); \ + break; \ + default: sBuffer.append("... ERROR: invalid FrameAction detected!" ); \ + break; \ + } \ + sBuffer.append( " ... event to listener.\n\n" ); \ + WRITE_LOGFILE( LOGFILE_EVENTDEBUG, sBuffer.makeStringAndClear() ) \ + } + + /*_____________________________________________________________________________________________________________ + LOG_FRAMEACTIONEVENT( SFRAMETYPE, SFRAMENAME ) + + These macro log information about sending of dispose events to listener. + ( Use new scope in macro to declare sBuffer more then on time in same "parentscope"! ) + _____________________________________________________________________________________________________________*/ + + #define LOG_DISPOSEEVENT( SFRAMETYPE, SFRAMENAME ) \ + { \ + ::rtl::OStringBuffer sBuffer(1024); \ + sBuffer.append( "[ " ); \ + sBuffer.append( SFRAMETYPE ); \ + sBuffer.append( " ] \"" ); \ + sBuffer.append( U2B( SFRAMENAME ) ); \ + sBuffer.append( "\" send dispose event to listener.\n\n"); \ + WRITE_LOGFILE( LOGFILE_EVENTDEBUG, sBuffer.makeStringAndClear() ) \ + } + +#else // #ifdef ENABLE_EVENTDEBUG + + /*_____________________________________________________________________________________________________________ + If right testmode is'nt set - implements these macros empty! + _____________________________________________________________________________________________________________*/ + + #undef LOGFILE_EVENTDEBUG + #define LOG_FRAMEACTIONEVENT( SFRAMETYPE, SFRAMENAME, AFRAMEACTION ) + #define LOG_DISPOSEEVENT( SFRAMETYPE, SFRAMENAME ) + +#endif // #ifdef ENABLE_EVENTDEBUG + +//***************************************************************************************************************** +// end of file +//***************************************************************************************************************** + +#endif // #ifndef __FRAMEWORK_MACROS_DEBUG_EVENT_HXX_ diff --git a/framework/inc/macros/debug/filterdbg.hxx b/framework/inc/macros/debug/filterdbg.hxx new file mode 100644 index 000000000000..ab408f1b50e5 --- /dev/null +++ b/framework/inc/macros/debug/filterdbg.hxx @@ -0,0 +1,130 @@ +/************************************************************************* + * + * 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_MACROS_DEBUG_FILTERDBG_HXX_ +#define __FRAMEWORK_MACROS_DEBUG_FILTERDBG_HXX_ + +//************************************************************************************************************* +// special macros for time measures +// 1) LOGFILE_FILTERDBG used it to define log file for this operations (default will be set automaticly) +// 4) LOG_FILTERDBG write debug info to log file +//************************************************************************************************************* + +#ifdef ENABLE_FILTERDBG + + //_________________________________________________________________________________________________________________ + // includes + //_________________________________________________________________________________________________________________ + + #ifndef _RTL_STRBUF_HXX_ + #include <rtl/strbuf.hxx> + #endif + + /*_____________________________________________________________________________________________________________ + LOGFILE_FILTERDBG + + For follow macros we need a special log file. If user forget to specify anyone, we must do it for him! + _____________________________________________________________________________________________________________*/ + + #ifndef LOGFILE_FILTERDBG + #define LOGFILE_FILTERDBG "filterdbg.log" + #endif + + /*_____________________________________________________________________________________________________________ + LOG_FILTERDBG( SOPERATION, SMESSAGE ) + + Write special debug info to the log file. + _____________________________________________________________________________________________________________*/ + + #define LOG_FILTERDBG( SOPERATION, SMESSAGE ) \ + { \ + ::rtl::OStringBuffer _sBuffer( 256 ); \ + _sBuffer.append( SOPERATION ); \ + _sBuffer.append( "\t" ); \ + _sBuffer.append( SMESSAGE ); \ + _sBuffer.append( "\n" ); \ + WRITE_LOGFILE( LOGFILE_FILTERDBG, _sBuffer.makeStringAndClear().getStr() ) \ + } + + /*_____________________________________________________________________________________________________________ + LOG_FILTERDBG_1_PARAM( SOPERATION, SPARAM, SMESSAGE ) + + Write special debug info into the log file and mark SNAME as special parameter before SMESSAGE is printed. + _____________________________________________________________________________________________________________*/ + + #define LOG_FILTERDBG_1_PARAM( SOPERATION, SPARAM, SMESSAGE ) \ + { \ + ::rtl::OStringBuffer _sBuffer( 256 ); \ + _sBuffer.append( SOPERATION ); \ + _sBuffer.append( "\t\"" ); \ + _sBuffer.append( SPARAM ); \ + _sBuffer.append( "\" " ); \ + _sBuffer.append( SMESSAGE ); \ + _sBuffer.append( "\n" ); \ + WRITE_LOGFILE( LOGFILE_FILTERDBG, _sBuffer.makeStringAndClear().getStr() ) \ + } + + /*_____________________________________________________________________________________________________________ + LOG_COND_FILTERDBG( CONDITION, SOPERATION, SMESSAGE ) + + Write special debug info to the log file, if given condition returns true. + _____________________________________________________________________________________________________________*/ + + #define LOG_COND_FILTERDBG( CONDITION, SOPERATION, SMESSAGE ) \ + if (CONDITION) \ + LOG_FILTERDBG( SOPERATION, SMESSAGE ) + + /*_____________________________________________________________________________________________________________ + LOG_COND_FILTERDBG_1_PARAM( CONDITION, SOPERATION, SPARAM, SMESSAGE ) + + Write special debug info into the log file and mark SNAME as special parameter before SMESSAGE is printed. + But it will be done only, if CONDITION returns true. + _____________________________________________________________________________________________________________*/ + + #define LOG_COND_FILTERDBG_1_PARAM( CONDITION, SOPERATION, SPARAM, SMESSAGE ) \ + if (CONDITION) \ + LOG_FILTERDBG_1_PARAM( SOPERATION, SPARAM, SMESSAGE ) + +#else // #ifdef ENABLE_FILTERDBG + + /*_____________________________________________________________________________________________________________ + If right testmode is'nt set - implements these macros empty! + _____________________________________________________________________________________________________________*/ + + #undef LOGFILE_FILTERDBG + #define LOG_FILTERDBG( SOPERATION, SMESSAGE ) + #define LOG_COND_FILTERDBG( CONDITION, SOPERATION, SMESSAGE ) + #define LOG_FILTERDBG_1_PARAM( SOPERATION, SPARAM, SMESSAGE ) + #define LOG_COND_FILTERDBG_1_PARAM( CONDITION, SOPERATION, SPARAM, SMESSAGE ) + +#endif // #ifdef ENABLE_FILTERDBG + +//***************************************************************************************************************** +// end of file +//***************************************************************************************************************** + +#endif // #ifndef __FRAMEWORK_MACROS_DEBUG_FILTERDBG_HXX_ diff --git a/framework/inc/macros/debug/logmechanism.hxx b/framework/inc/macros/debug/logmechanism.hxx new file mode 100644 index 000000000000..a2f6e4ec6f48 --- /dev/null +++ b/framework/inc/macros/debug/logmechanism.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_MACROS_DEBUG_LOGMECHANISM_HXX_ +#define __FRAMEWORK_MACROS_DEBUG_LOGMECHANISM_HXX_ + +//***************************************************************************************************************** +// generic macros for logging +//***************************************************************************************************************** + +#ifdef ENABLE_LOGMECHANISM + + //_____________________________________________________________________________________________________________ + // includes + //_____________________________________________________________________________________________________________ + + #ifndef _RTL_STRING_HXX_ + #include <rtl/string.hxx> + #endif + + #include <stdio.h> + + /*_____________________________________________________________________________________________________________ + WRITE_LOGFILE( SFILENAME, STEXT ) + + Log any information in file. We append any information at file and don't clear it anymore. + ( Use new scope in macro to declare pFile more then on time in same "parentscope"! + Don't control pFile before access! What will you doing if its not valid? Log an error ... + An error and an error is an error ... ) + + Attention: You must use "%s" and STEXT as parameter ... because otherwise encoded strings (they include e.g. %...) + are handled wrong. + _____________________________________________________________________________________________________________*/ + + #define WRITE_LOGFILE( SFILENAME, STEXT ) \ + { \ + ::rtl::OString _swriteLogfileFileName ( SFILENAME ); \ + ::rtl::OString _swriteLogfileText ( STEXT ); \ + FILE* pFile = fopen( _swriteLogfileFileName.getStr(), "a" ); \ + fprintf( pFile, "%s", _swriteLogfileText.getStr() ); \ + fclose ( pFile ); \ + } + + /*_____________________________________________________________________________________________________________ + LOGTYPE + + For other debug macros we need information about the output mode. If user forget to set this information we + do it for him. Valid values are: LOGTYPE_FILECONTINUE + LOGTYPE_FILEEXIT + LOGTYPE_MESSAGEBOX + The normal case is LOGTYPE_MESSAGEBOX to show assertions in normal manner! + _____________________________________________________________________________________________________________*/ + + #define LOGTYPE_MESSAGEBOX 1 + #define LOGTYPE_FILECONTINUE 2 + #define LOGTYPE_FILEEXIT 3 + + #ifndef LOGTYPE + #define LOGTYPE \ + LOGTYPE_MESSAGEBOX + #endif + +#else // #ifdef ENABLE_LOGMECHANISM + + /*_____________________________________________________________________________________________________________ + If right testmode is'nt set - implements these macro empty! + _____________________________________________________________________________________________________________*/ + + #define WRITE_LOGFILE( SFILENAME, STEXT ) + #undef LOGTYPE + +#endif // #ifdef ENABLE_LOGMECHANISM + +//***************************************************************************************************************** +// end of file +//***************************************************************************************************************** + +#endif // #ifndef __FRAMEWORK_MACROS_DEBUG_LOGMECHANISM_HXX_ diff --git a/framework/inc/macros/debug/memorymeasure.hxx b/framework/inc/macros/debug/memorymeasure.hxx new file mode 100644 index 000000000000..0c5be0d237c9 --- /dev/null +++ b/framework/inc/macros/debug/memorymeasure.hxx @@ -0,0 +1,223 @@ +/************************************************************************* + * + * 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_MACROS_DEBUG_MEMORYMEASURE_HXX_ +#define __FRAMEWORK_MACROS_DEBUG_MEMORYMEASURE_HXX_ + +//************************************************************************************************************* +// special macros for time measures +// 1) LOGFILE_MEMORYMEASURE used it to define log file for this operations (default will be set automaticly) +// 2) MAKE_MEMORY_SNAPSHOT make snapshot of currently set memory informations of OS +// 3) LOG_MEMORYMEASURE write measured time to logfile +//************************************************************************************************************* + +#ifdef ENABLE_MEMORYMEASURE + + #if !defined( WNT ) + #error "Macros to measure memory access not available under platforms different from windows!" + #endif + + //_________________________________________________________________________________________________________________ + // includes + //_________________________________________________________________________________________________________________ + + #ifndef _RTL_STRBUF_HXX_ + #include <rtl/strbuf.hxx> + #endif + + #ifndef __SGI_STL_VECTOR + #include <vector> + #endif + + /*_____________________________________________________________________________________________________________ + LOGFILE_MEMORYMEASURE + + For follow macros we need a special log file. If user forget to specify anyone, we must do it for him! + _____________________________________________________________________________________________________________*/ + + #ifndef LOGFILE_MEMORYMEASURE + #define LOGFILE_MEMORYMEASURE "memorymeasure.log" + #endif + + /*_____________________________________________________________________________________________________________ + class MemoryMeasure + + We use this baseclass to collect all snapshots in one object and analyze this information at one point. + Macros of this file are used to enable using of this class by special compile-parameter only! + _____________________________________________________________________________________________________________*/ + + class _DBGMemoryMeasure + { + //--------------------------------------------------------------------------------------------------------- + private: + struct _MemoryInfo + { + MEMORYSTATUS aStatus ; + ::rtl::OString sComment ; + }; + + //--------------------------------------------------------------------------------------------------------- + public: + //_____________________________________________________________________________________________________ + inline _DBGMemoryMeasure() + { + } + + //_____________________________________________________________________________________________________ + // clear used container! + inline ~_DBGMemoryMeasure() + { + ::std::vector< _MemoryInfo >().swap( m_lSnapshots ); + } + + //_____________________________________________________________________________________________________ + inline void makeSnapshot( const ::rtl::OString& sComment ) + { + _MemoryInfo aInfo; + aInfo.sComment = sComment; + GlobalMemoryStatus ( &(aInfo.aStatus) ); + m_lSnapshots.push_back( aInfo ); + } + + //_____________________________________________________________________________________________________ + inline ::rtl::OString getLog() + { + ::rtl::OStringBuffer sBuffer( 10000 ); + + if( !m_lSnapshots.empty() ) + { + // Write informations to return buffer + ::std::vector< _MemoryInfo >::const_iterator pItem1; + ::std::vector< _MemoryInfo >::const_iterator pItem2; + + pItem1 = m_lSnapshots.begin(); + pItem2 = pItem1; + ++pItem2; + + while( pItem1!=m_lSnapshots.end() ) + { + sBuffer.append( "snap [ " ); + sBuffer.append( pItem1->sComment ); + sBuffer.append( " ]\n\tavail phys\t=\t" ); + sBuffer.append( (sal_Int32)pItem1->aStatus.dwAvailPhys ); + sBuffer.append( "\n\tavail page\t=\t" ); + sBuffer.append( (sal_Int32)pItem1->aStatus.dwAvailPageFile ); + sBuffer.append( "\n\tavail virt\t=\t" ); + sBuffer.append( (sal_Int32)pItem1->aStatus.dwAvailVirtual ); + sBuffer.append( "\n\tdifference\t=\t[ " ); + + if( pItem1 == m_lSnapshots.begin() ) + { + sBuffer.append( (sal_Int32)pItem1->aStatus.dwAvailPhys ); + sBuffer.append( ", " ); + sBuffer.append( (sal_Int32)pItem1->aStatus.dwAvailPageFile ); + sBuffer.append( ", " ); + sBuffer.append( (sal_Int32)pItem1->aStatus.dwAvailVirtual ); + sBuffer.append( " ]\n\n" ); + } + else if( pItem2 != m_lSnapshots.end() ) + { + sBuffer.append( (sal_Int32)(pItem2->aStatus.dwAvailPhys - pItem1->aStatus.dwAvailPhys ) ); + sBuffer.append( ", " ); + sBuffer.append( (sal_Int32)(pItem2->aStatus.dwAvailPageFile - pItem1->aStatus.dwAvailPageFile ) ); + sBuffer.append( ", " ); + sBuffer.append( (sal_Int32)(pItem2->aStatus.dwAvailVirtual - pItem1->aStatus.dwAvailVirtual ) ); + sBuffer.append( " ]\n\n" ); + } + else + { + sBuffer.append( "0, 0, 0 ]\n\n" ); + } + if( pItem1!=m_lSnapshots.end() ) ++pItem1; + if( pItem2!=m_lSnapshots.end() ) ++pItem2; + } + // clear current list ... make it empty for further snapshots! + ::std::vector< _MemoryInfo >().swap( m_lSnapshots ); + } + + return sBuffer.makeStringAndClear(); + } + + //--------------------------------------------------------------------------------------------------------- + private: + ::std::vector< _MemoryInfo > m_lSnapshots; + }; + + /*_____________________________________________________________________________________________________________ + START_MEMORY_MEASURE + + Create new object to measure memory access. + _____________________________________________________________________________________________________________*/ + + #define START_MEMORYMEASURE( AOBJECT ) \ + _DBGMemoryMeasure AOBJECT; + + /*_____________________________________________________________________________________________________________ + MAKE_MEMORY_SNAPSHOT + + Make snapshot of currently set memory informations of OS. + see _DBGMemoryMeasure for further informations + _____________________________________________________________________________________________________________*/ + + #define MAKE_MEMORY_SNAPSHOT( AOBJECT, SCOMMENT ) \ + AOBJECT.makeSnapshot( SCOMMENT ); + + /*_____________________________________________________________________________________________________________ + LOG_MEMORYMEASURE( SOPERATION, SCOMMENT, AOBJECT ) + + Write measured values to logfile. + _____________________________________________________________________________________________________________*/ + + #define LOG_MEMORYMEASURE( SOPERATION, SCOMMENT, AOBJECT ) \ + { \ + ::rtl::OStringBuffer _sBuffer( 256 ); \ + _sBuffer.append( SOPERATION ); \ + _sBuffer.append( "\n" ); \ + _sBuffer.append( SCOMMENT ); \ + _sBuffer.append( "\n\n" ); \ + _sBuffer.append( AOBJECT.getLog() ); \ + WRITE_LOGFILE( LOGFILE_MEMORYMEASURE, _sBuffer.makeStringAndClear() ) \ + } + +#else // #ifdef ENABLE_MEMORYMEASURE + + /*_____________________________________________________________________________________________________________ + If right testmode is'nt set - implements these macros empty! + _____________________________________________________________________________________________________________*/ + + #undef LOGFILE_MEMORYMEASURE + #define START_MEMORYMEASURE( AOBJECT ) + #define MAKE_MEMORY_SNAPSHOT( AOBJECT, SCOMMENT ) + #define LOG_MEMORYMEASURE( SOPERATION, SCOMMENT, AOBJECT ) + +#endif // #ifdef ENABLE_MEMORYMEASURE + +//***************************************************************************************************************** +// end of file +//***************************************************************************************************************** + +#endif // #ifndef __FRAMEWORK_MACROS_DEBUG_MEMORYMEASURE_HXX_ diff --git a/framework/inc/macros/debug/mutex.hxx b/framework/inc/macros/debug/mutex.hxx new file mode 100644 index 000000000000..85aec5acd9cd --- /dev/null +++ b/framework/inc/macros/debug/mutex.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_MACROS_DEBUG_MUTEX_HXX_ +#define __FRAMEWORK_MACROS_DEBUG_MUTEX_HXX_ + +//***************************************************************************************************************** +// special macros for mutex handling +//***************************************************************************************************************** + +#ifdef ENABLE_MUTEXDEBUG + + //_____________________________________________________________________________________________________________ + // includes + //_____________________________________________________________________________________________________________ + + #ifndef _RTL_STRBUF_HXX_ + #include <rtl/strbuf.hxx> + #endif + + /*_____________________________________________________________________________________________________________ + LOGFILE_MUTEX + + For follow macros we need a special log file. If user forget to specify anyone, we must do it for him! + _____________________________________________________________________________________________________________*/ + + #ifndef LOGFILE_MUTEX + #define LOGFILE_MUTEX "mutex.log" + #endif + + /*_____________________________________________________________________________________________________________ + LOG_LOCKTYPE( _EFALLBACK, _ECURRENT ) + + Write informations about current set lock type for whole framework project to special file. + _____________________________________________________________________________________________________________*/ + + #define LOG_LOCKTYPE( _EFALLBACK, _ECURRENT ) \ + /* new scope to prevent us against multiple definitions of variables ... */ \ + { \ + ::rtl::OStringBuffer _sBuffer( 256 ); \ + _sBuffer.append( "Set framework lock type to fallback: \"" ); \ + switch( _EFALLBACK ) \ + { \ + case E_NOTHING : _sBuffer.append( "E_NOTHING" ); \ + break; \ + case E_OWNMUTEX : _sBuffer.append( "E_OWNMUTEX" ); \ + break; \ + case E_SOLARMUTEX : _sBuffer.append( "E_SOLARMUTEX" ); \ + break; \ + case E_FAIRRWLOCK : _sBuffer.append( "E_FAIRRWLOCK" ); \ + break; \ + } \ + _sBuffer.append( "\"\n" ); \ + if( _EFALLBACK != _ECURRENT ) \ + { \ + _sBuffer.append( "... environment overwrite framework lock type with: \"" ); \ + switch( _ECURRENT ) \ + { \ + case E_NOTHING : _sBuffer.append( "E_NOTHING" ); \ + break; \ + case E_OWNMUTEX : _sBuffer.append( "E_OWNMUTEX" ); \ + break; \ + case E_SOLARMUTEX : _sBuffer.append( "E_SOLARMUTEX" ); \ + break; \ + case E_FAIRRWLOCK : _sBuffer.append( "E_FAIRRWLOCK" ); \ + break; \ + } \ + _sBuffer.append( "\"\n" ); \ + } \ + else \ + { \ + _sBuffer.append( "... use fallback, because user don't set another value!\n" ); \ + } \ + WRITE_LOGFILE( LOGFILE_MUTEX, _sBuffer.makeStringAndClear() ) \ + } + +#else // #ifdef ENABLE_MUTEXDEBUG + + /*_____________________________________________________________________________________________________________ + If right testmode is'nt set - implements these macro with normal functionality! + We need the guard but not the log mechanism. + _____________________________________________________________________________________________________________*/ + + #undef LOGFILE_MUTEX + #define LOG_LOCKTYPE( _EFALLBACK, _ECURRENT ) + +#endif // #ifdef ENABLE_MUTEXDEBUG + +//***************************************************************************************************************** +// end of file +//***************************************************************************************************************** + +#endif // #ifndef __FRAMEWORK_MACROS_DEBUG_MUTEX_HXX_ diff --git a/framework/inc/macros/debug/plugin.hxx b/framework/inc/macros/debug/plugin.hxx new file mode 100644 index 000000000000..6ef4af316877 --- /dev/null +++ b/framework/inc/macros/debug/plugin.hxx @@ -0,0 +1,202 @@ +/************************************************************************* + * + * 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_MACROS_DEBUG_PLUGIN_HXX_ +#define __FRAMEWORK_MACROS_DEBUG_PLUGIN_HXX_ + +//***************************************************************************************************************** +// special macros to debug asynchronous methods of plugin frame +//***************************************************************************************************************** + +#ifdef ENABLE_PLUGINDEBUG + + //_____________________________________________________________________________________________________________ + // includes + //_____________________________________________________________________________________________________________ + + #ifndef _RTL_STRBUF_HXX_ + #include <rtl/strbuf.hxx> + #endif + + #ifndef _RTL_STRING_HXX_ + #include <rtl/string.hxx> + #endif + + /*_____________________________________________________________________________________________________________ + LOGFILE_PLUGIN + + For follow macros we need a special log file. If user forget to specify anyone, we must do it for him! + _____________________________________________________________________________________________________________*/ + + #ifndef LOGFILE_PLUGIN + #define LOGFILE_PLUGIN \ + "plugin.log" + #endif + + /*_____________________________________________________________________________________________________________ + LOG_URLSEND( SFRAMENAME, SSENDMODE, SINTERNALURL, SEXTERNALURL ) + + Our plugin forward special url's to plugin dll, browser and webserver. + We convert internal url's to an external notation. + With this macro you can log some parameter of this operation. + _____________________________________________________________________________________________________________*/ + + #define LOG_URLSEND( SFRAMENAME, SSENDMODE, SINTERNALURL, SEXTERNALURL ) \ + /* Use new scope to declare local private variables! */ \ + { \ + ::rtl::OStringBuffer sBuffer(1024); \ + sBuffer.append( "PlugInFrame [ \"" ); \ + sBuffer.append( SFRAMENAME ); \ + sBuffer.append( "\" ] send " ); \ + sBuffer.append( SSENDMODE ); \ + sBuffer.append( "( internalURL=\"" ); \ + sBuffer.append( U2B( SINTERNALURL ) ); \ + sBuffer.append( "\", externalURL=\""); \ + sBuffer.append( U2B( SEXTERNALURL ) ); \ + sBuffer.append( "\" ) to browser.\n"); \ + WRITE_LOGFILE( LOGFILE_PLUGIN, sBuffer.makeStringAndClear() ) \ + } + + /*_____________________________________________________________________________________________________________ + LOG_URLRECEIVE( SFRAMENAME, SRECEIVEMODE, SEXTERNALURL, SINTERNALURL ) + + A plugin frame can get a url request in two different modes. + 1) newURL() + 2) newStream() + We convert external url's to an internal notation. + With this macro you can log some parameter of this operations. + _____________________________________________________________________________________________________________*/ + + #define LOG_URLRECEIVE( SFRAMENAME, SRECEIVEMODE, SEXTERNALURL, SINTERNALURL ) \ + /* Use new scope to declare local private variables! */ \ + { \ + ::rtl::OStringBuffer sBuffer(1024); \ + sBuffer.append( "PlugInFrame [ \"" ); \ + sBuffer.append( U2B( SFRAMENAME ) ); \ + sBuffer.append( "\" ] receive " ); \ + sBuffer.append( SRECEIVEMODE ); \ + sBuffer.append( "( externalURL=\"" ); \ + sBuffer.append( U2B( SEXTERNALURL ) ); \ + sBuffer.append( "\", internalURL=\"" ); \ + sBuffer.append( U2B( SINTERNALURL ) ); \ + sBuffer.append( "\" ) from browser.\n" ); \ + WRITE_LOGFILE( LOGFILE_PLUGIN, sBuffer.makeStringAndClear() ) \ + } + + /*_____________________________________________________________________________________________________________ + LOG_PARAMETER_NEWURL( SFRAMENAME, SMIMETYPE, SURL, AANY ) + + Log information about parameter of a newURL() at a plugin frame. + _____________________________________________________________________________________________________________*/ + + #define LOG_PARAMETER_NEWURL( SFRAMENAME, SMIMETYPE, SURL, sFILTER, AANY ) \ + /* Use new scope to declare local private variables! */ \ + { \ + ::rtl::OStringBuffer sBuffer(1024); \ + sBuffer.append( "PlugInFrame [ \"" ); \ + sBuffer.append( U2B( SFRAMENAME ) ); \ + sBuffer.append( "\" ] called with newURL( \"" ); \ + sBuffer.append( U2B( SMIMETYPE ) ); \ + sBuffer.append( "\", \"" ); \ + sBuffer.append( U2B( SURL ) ); \ + sBuffer.append( "\", \"" ); \ + sBuffer.append( U2B( SFILTER ) ); \ + sBuffer.append( "\", " ); \ + if( AANY.hasValue() == sal_True ) \ + { \ + sBuffer.append( "filled Any )" ); \ + } \ + else \ + { \ + sBuffer.append( "empty Any )" ); \ + } \ + sBuffer.append( "\n" ); \ + WRITE_LOGFILE( LOGFILE_PLUGIN, sBuffer.makeStringAndClear() ) \ + } + + /*_____________________________________________________________________________________________________________ + LOG_PARAMETER_NEWSTREAM( SFRAMENAME, SMIMETYPE, SURL, ASTREAM, AANY ) + + Log information about parameter of a newStream() at a plugin frame. + _____________________________________________________________________________________________________________*/ + + #define LOG_PARAMETER_NEWSTREAM( SFRAMENAME, SMIMETYPE, SURL, SFILTER, XSTREAM, AANY ) \ + /* Use new scope to declare local private variables! */ \ + { \ + ::rtl::OStringBuffer sBuffer(1024); \ + sBuffer.append( "PlugInFrame [ \"" ); \ + sBuffer.append( U2B( SFRAMENAME ) ); \ + sBuffer.append( "\" ] called with newStream( \""); \ + sBuffer.append( U2B( SMIMETYPE ) ); \ + sBuffer.append( "\", \"" ); \ + sBuffer.append( U2B( SURL ) ); \ + sBuffer.append( "\", \"" ); \ + sBuffer.append( U2B( SFILTER ) ); \ + sBuffer.append( "\", " ); \ + if( XSTREAM.is() == sal_True ) \ + { \ + sal_Int32 nBytes = XSTREAM->available(); \ + OString sInfo("Stream with "); \ + sInfo += OString::valueOf( (sal_Int32)nBytes ); \ + sInfo += " Bytes, "; \ + sBuffer.append( sInfo ); \ + } \ + else \ + { \ + sBuffer.append( "empty Stream, " ); \ + } \ + if( AANY.hasValue() == sal_True ) \ + { \ + sBuffer.append( "filled Any )" ); \ + } \ + else \ + { \ + sBuffer.append( "empty Any )" ); \ + } \ + sBuffer.append( "\n" ); \ + WRITE_LOGFILE( LOGFILE_PLUGIN, sBuffer.makeStringAndClear() ) \ + } + +#else // #ifdef ENABLE_PLUGINDEBUG + + /*_____________________________________________________________________________________________________________ + If right testmode is'nt set - implements these macro empty! + _____________________________________________________________________________________________________________*/ + + #undef LOGFILE_PLUGIN + #define LOG_URLSEND( SFRAMENAME, SSENDMODE, SINTERNALURL, SEXTERNALURL ) + #define LOG_URLRECEIVE( SFRAMENAME, SRECEIVEMODE, SEXTERNALURL, SINTERNALURL ) + #define LOG_PARAMETER_NEWURL( SFRAMENAME, SMIMETYPE, SURL, SFILTER, AANY ) + #define LOG_PARAMETER_NEWSTREAM( SFRAMENAME, SMIMETYPE, SURL, SFILTER, XSTREAM, AANY ) + +#endif // #ifdef ENABLE_PLUGINDEBUG + +//***************************************************************************************************************** +// end of file +//***************************************************************************************************************** + +#endif // #ifndef __FRAMEWORK_MACROS_DEBUG_PLUGIN_HXX_ diff --git a/framework/inc/macros/debug/registration.hxx b/framework/inc/macros/debug/registration.hxx new file mode 100644 index 000000000000..afb359348349 --- /dev/null +++ b/framework/inc/macros/debug/registration.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_MACROS_DEBUG_REGISTRATION_HXX_ +#define __FRAMEWORK_MACROS_DEBUG_REGISTRATION_HXX_ + +//***************************************************************************************************************** +// special macros for assertion handling +//***************************************************************************************************************** + +#ifdef ENABLE_REGISTRATIONDEBUG + + //_____________________________________________________________________________________________________________ + // includes + //_____________________________________________________________________________________________________________ + + #ifndef _RTL_STRBUF_HXX_ + #include <rtl/strbuf.hxx> + #endif + + /*_____________________________________________________________________________________________________________ + LOGFILE_ASSERTIONS + + For follow macros we need a special log file. If user forget to specify anyone, we must do it for him! + _____________________________________________________________________________________________________________*/ + + #ifndef LOGFILE_REGISTRATION + #define LOGFILE_REGISTRATION \ + "registration.log" + #endif + + #define LOG_REGISTRATION_GETFACTORY( SINFOTEXT ) \ + { \ + ::rtl::OStringBuffer sOut( 1024 ); \ + sOut.append( "component_getFactory():" ); \ + sOut.append( SINFOTEXT ); \ + WRITE_LOGFILE( LOGFILE_REGISTRATION, sOut.makeStringAndClear() ) \ + } + +#else // #ifdef ENABLE_REGISTRATIONDEBUG + + /*_____________________________________________________________________________________________________________ + If right testmode is'nt set - implements these macro empty! + _____________________________________________________________________________________________________________*/ + + #undef LOGFILE_REGISTRATION + #define LOG_REGISTRATION_GETFACTORY( SINFOTEXT ) + +#endif // #ifdef ENABLE_REGISTRATIONDEBUG + +//***************************************************************************************************************** +// end of file +//***************************************************************************************************************** + +#endif // #ifndef __FRAMEWORK_MACROS_DEBUG_REGISTRATION_HXX_ diff --git a/framework/inc/macros/debug/targeting.hxx b/framework/inc/macros/debug/targeting.hxx new file mode 100644 index 000000000000..3f87b2fb7a30 --- /dev/null +++ b/framework/inc/macros/debug/targeting.hxx @@ -0,0 +1,252 @@ +/************************************************************************* + * + * 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_MACROS_DEBUG_TARGETING_HXX_ +#define __FRAMEWORK_MACROS_DEBUG_TARGETING_HXX_ + +//***************************************************************************************************************** +// special macros for targeting of frames +//***************************************************************************************************************** + +#ifdef ENABLE_TARGETINGDEBUG + + //_____________________________________________________________________________________________________________ + // includes + //_____________________________________________________________________________________________________________ + + #ifndef _RTL_STRBUF_HXX_ + #include <rtl/strbuf.hxx> + #endif + + /*_____________________________________________________________________________________________________________ + LOGFILE_TARGETING + + For follow macros we need a special log file. If user forget to specify anyone, we must do it for him! + _____________________________________________________________________________________________________________*/ + + #ifndef LOGFILE_TARGETING + #define LOGFILE_TARGETSTEPS "targetsteps.log" + #define LOGFILE_TARGETPARAM "targetparam.log" + #endif + + /*_____________________________________________________________________________________________________________ + LOG_PARAMETER_FINDFRAME( SSERVICE, SFRAMENAME, STARGETNAME, NSEARCHFLAGS ) + + Log format for parameter e.g.: Desktop::findFrame( "frame1", 23 ) my name is "desktop" + Log format for steps e.g.: desktop-- + + With this macro you can log informations about search parameter of method "findFrame()" of an service. + Use it at beginning of search only! + _____________________________________________________________________________________________________________*/ + + #define LOG_PARAMETER_FINDFRAME( SSERVICE, SFRAMENAME, STARGETNAME, NSEARCHFLAGS ) \ + /* Use new scope to prevent code against multiple variable defines! */ \ + { \ + ::rtl::OStringBuffer sBufferParam(256); \ + ::rtl::OStringBuffer sBufferSteps(256); \ + sBufferParam.append( SSERVICE ); \ + sBufferParam.append( "::findFrame( \"" ); \ + sBufferParam.append( U2B( STARGETNAME ) ); \ + sBufferParam.append( "\", " ); \ + sBufferParam.append( ::rtl::OString::valueOf( sal_Int32( NSEARCHFLAGS ) ) ); \ + sBufferParam.append( " ) my name is \"" ); \ + sBufferParam.append( U2B( SFRAMENAME ) ); \ + sBufferParam.append( "\"\n" ); \ + sBufferSteps.append( U2B( SFRAMENAME ) ); \ + sBufferSteps.append( "--" ); \ + WRITE_LOGFILE( LOGFILE_TARGETPARAM, sBufferParam.makeStringAndClear() ) \ + WRITE_LOGFILE( LOGFILE_TARGETSTEPS, sBufferSteps.makeStringAndClear() ) \ + } + + /*_____________________________________________________________________________________________________________ + LOG_PARAMETER_QUERYDISPATCH( SSERVICE, SFRAMENAME, AURL, STARGETNAME, NSEARCHFLAGS ) + + With this macro you can log informations about search parameter of method "queryDispatch()" of an service. + Use it at beginning of search only! + _____________________________________________________________________________________________________________*/ + + #define LOG_PARAMETER_QUERYDISPATCH( SSERVICE, SFRAMENAME, AURL, STARGETNAME, NSEARCHFLAGS ) \ + /* Use new scope to prevent code against multiple variable defines! */ \ + { \ + ::rtl::OStringBuffer sBuffer(1024); \ + sBuffer.append( "[ " ); \ + sBuffer.append( U2B( SFRAMENAME ) ); \ + sBuffer.append( "] " ); \ + sBuffer.append( SSERVICE ); \ + sBuffer.append( "::queryDispatch( \"" ); \ + sBuffer.append( U2B( AURL.Complete ) ); \ + sBuffer.append( "\", \"" ); \ + sBuffer.append( U2B( STARGETNAME ) ); \ + sBuffer.append( "\", " ); \ + sBuffer.append( ::rtl::OString::valueOf( sal_Int32( NSEARCHFLAGS ) ) ); \ + sBuffer.append( " )\n" ); \ + WRITE_LOGFILE( LOGFILE_TARGETPARAM, sBuffer.makeStringAndClear() ) \ + } + + /*_____________________________________________________________________________________________________________ + LOG_PARAMETER_LOADCOMPONENTFROMURL( SSERVICE, SFRAMENAME, SURL, STARGETNAME, NSEARCHFLAGS, SEQPARAMETER ) + + With this macro you can log informations about search parameter of method "loadComponentFromURL()" of an service. + Use it at beginning of search only! + _____________________________________________________________________________________________________________*/ + + #define LOG_PARAMETER_LOADCOMPONENTFROMURL( SSERVICE, SFRAMENAME, SURL, STARGETNAME, NSEARCHFLAGS, SEQPARAMETER ) \ + /* Use new scope to prevent code against multiple variable defines! */ \ + { \ + ::rtl::OStringBuffer sBuffer(1024); \ + sBuffer.append( "[ " ); \ + sBuffer.append( U2B( SFRAMENAME ) ); \ + sBuffer.append( "] " ); \ + sBuffer.append( SSERVICE ); \ + sBuffer.append( "::loadComponentFromURL( \"" ); \ + sBuffer.append( U2B( SURL ) ); \ + sBuffer.append( "\", \"" ); \ + sBuffer.append( U2B( STARGETNAME ) ); \ + sBuffer.append( "\", " ); \ + sBuffer.append( ::rtl::OString::valueOf( sal_Int32( NSEARCHFLAGS ) ) ); \ + sBuffer.append( ", " ); \ + sal_Int32 nCount = SEQPARAMETER.getLength(); \ + for( sal_Int32 nParameter=0; nParameter<nCount; ++nParameter ) \ + { \ + sBuffer.append( U2B( SEQPARAMETER[nParameter].Name )); \ + if( nParameter<(nCount-1) ) \ + { \ + sBuffer.append( " | " ); \ + } \ + } \ + sBuffer.append( " )\n" ); \ + WRITE_LOGFILE( LOGFILE_TARGETPARAM, sBuffer.makeStringAndClear() ) \ + } + + /*_____________________________________________________________________________________________________________ + LOG_RESULT_FINDFRAME( SSERVICE, SFRAMENAME, XFRAME ) + + With this macro you can log informations about search result of "findFrame()". + Use it at the end of this method only! + _____________________________________________________________________________________________________________*/ + + #define LOG_RESULT_FINDFRAME( SSERVICE, SFRAMENAME, XFRAME ) \ + /* Use new scope to prevent code against multiple variable defines! */ \ + { \ + ::rtl::OStringBuffer sBufferParam(256); \ + ::rtl::OStringBuffer sBufferSteps(256); \ + sBufferParam.append( SSERVICE ); \ + sBufferParam.append( "::findFrame() at \"" ); \ + sBufferParam.append( U2B( SFRAMENAME ) ); \ + sBufferParam.append( "\" " ); \ + if( XFRAME.is() == sal_True ) \ + { \ + sBufferParam.append( "return with valid frame.\n" ); \ + sBufferSteps.append( "OK [" ); \ + sBufferSteps.append( U2B( XFRAME->getName() ) ); \ + sBufferSteps.append( "]\n" ); \ + } \ + else \ + { \ + sBufferParam.append( "return with NULL frame!\n"); \ + sBufferSteps.append( "??\n" ); \ + } \ + WRITE_LOGFILE( LOGFILE_TARGETPARAM, sBufferParam.makeStringAndClear() ) \ + WRITE_LOGFILE( LOGFILE_TARGETSTEPS, sBufferSteps.makeStringAndClear() ) \ + } + + /*_____________________________________________________________________________________________________________ + LOG_RESULT_QUERYDISPATCH( SSERVICE, SFRAMENAME, XDISPATCHER ) + + With this macro you can log informations about search result of "queryDispatch()". + Use it at the end of this method only! + _____________________________________________________________________________________________________________*/ + + #define LOG_RESULT_QUERYDISPATCH( SSERVICE, SFRAMENAME, XDISPATCHER ) \ + /* Use new scope to prevent code against multiple variable defines! */ \ + { \ + ::rtl::OStringBuffer sBuffer(1024); \ + sBuffer.append( "[ " ); \ + sBuffer.append( U2B( SFRAMENAME ) ); \ + sBuffer.append( "] " ); \ + sBuffer.append( SSERVICE ); \ + if( XDISPATCHER.is() == sal_True ) \ + { \ + sBuffer.append( "::queryDispatch() return with valid dispatcher." ); \ + } \ + else \ + { \ + sBuffer.append( "::queryDispatch() return with NULL dispatcher!" ); \ + } \ + sBuffer.append( "\n" ); \ + WRITE_LOGFILE( LOGFILE_TARGETPARAM, sBuffer.makeStringAndClear() ) \ + } + + /*_____________________________________________________________________________________________________________ + LOG_RESULT_LOADCOMPONENTFROMURL( SSERVICE, SFRAMENAME, XCOMPONENT ) + + With this macro you can log informations about search result of "loadComponentFromURL()". + Use it at the end of this method only! + _____________________________________________________________________________________________________________*/ + + #define LOG_RESULT_LOADCOMPONENTFROMURL( SSERVICE, SFRAMENAME, XCOMPONENT ) \ + /* Use new scope to prevent code against multiple variable defines! */ \ + { \ + ::rtl::OStringBuffer sBuffer(1024); \ + sBuffer.append( "[ " ); \ + sBuffer.append( U2B( SFRAMENAME ) ); \ + sBuffer.append( "] " ); \ + sBuffer.append( SSERVICE ); \ + if( XCOMPONENT.is() == sal_True ) \ + { \ + sBuffer.append( "::loadComponentFromURL() return with valid component." ); \ + } \ + else \ + { \ + sBuffer.append( "::loadComponentFromURL() return with NULL component!" ); \ + } \ + sBuffer.append( "\n" ); \ + WRITE_LOGFILE( LOGFILE_TARGETPARAM, sBuffer.makeStringAndClear() ) \ + } + +#else // #ifdef ENABLE_TARGETINGDEBUG + + /*_____________________________________________________________________________________________________________ + If right testmode is'nt set - implements these macro empty! + _____________________________________________________________________________________________________________*/ + + #undef LOGFILE_TARGETPARAM + #undef LOGFILE_TARGETSTEPS + #define LOG_PARAMETER_FINDFRAME( SSERVICE, SFRAMENAME, STARGETNAME, NSEARCHFLAGS ) + #define LOG_PARAMETER_QUERYDISPATCH( SSERVICE, SFRAMENAME, AURL, STARGETNAME, NSEARCHFLAGS ) + #define LOG_PARAMETER_LOADCOMPONENTFROMURL( SSERVICE, SFRAMENAME, SURL, STARGETNAME, NSEARCHFLAGS, SEQPARAMETER ) + #define LOG_RESULT_FINDFRAME( SSERVICE, SFRAMENAME, XFRAME ) + #define LOG_RESULT_QUERYDISPATCH( SSERVICE, SFRAMENAME, XDISPATCHER ) + #define LOG_RESULT_LOADCOMPONENTFROMURL( SSERVICE, SFRAMENAME, XCOMPONENT ) + +#endif // #ifdef ENABLE_TARGETINGDEBUG + +//***************************************************************************************************************** +// end of file +//***************************************************************************************************************** + +#endif // #ifndef __FRAMEWORK_MACROS_DEBUG_TARGETING_HXX_ diff --git a/framework/inc/macros/debug/timemeasure.hxx b/framework/inc/macros/debug/timemeasure.hxx new file mode 100644 index 000000000000..119c6f7b1eb1 --- /dev/null +++ b/framework/inc/macros/debug/timemeasure.hxx @@ -0,0 +1,140 @@ +/************************************************************************* + * + * 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_MACROS_DEBUG_TIMEMEASURE_HXX_ +#define __FRAMEWORK_MACROS_DEBUG_TIMEMEASURE_HXX_ + +//************************************************************************************************************* +// special macros for time measures +// 1) LOGFILE_TIMEMEASURE used it to define log file for this operations (default will be set automaticly) +// 2) START_TIMEMEASURE start new measure by using given variable names +// 3) START_TIMEMEASURE stop current measure by using given variable names and return time +// 4) LOG_TIMEMEASURE write measured time to logfile +//************************************************************************************************************* + +#ifdef ENABLE_TIMEMEASURE + + //_________________________________________________________________________________________________________________ + // includes + //_________________________________________________________________________________________________________________ + + #ifndef _RTL_STRBUF_HXX_ + #include <rtl/strbuf.hxx> + #endif + + #ifndef _OSL_TIME_H_ + #include <osl/time.h> + #endif + + /*_____________________________________________________________________________________________________________ + LOGFILE_TIMEMEASURE + + For follow macros we need a special log file. If user forget to specify anyone, we must do it for him! + _____________________________________________________________________________________________________________*/ + + #ifndef LOGFILE_TIMEMEASURE + #define LOGFILE_TIMEMEASURE "timemeasure.log" + #endif + + /*_____________________________________________________________________________________________________________ + class TimeMeasure + + We need this inline class as global timer to make it possible measure times over different objects! + zB. Use it as baseclass to start timer at ctor (must be first called baseclass!!!) and stop it by calling stop method. + _____________________________________________________________________________________________________________*/ + + class DBGTimeMeasureBase + { + public: + inline DBGTimeMeasureBase() + { + m_nEnd = 0 ; + m_nStart = osl_getGlobalTimer(); + } + + inline sal_Int32 stopAndGet() + { + m_nEnd = osl_getGlobalTimer(); + return( m_nEnd-m_nStart ); + } + + private: + sal_Int32 m_nStart ; + sal_Int32 m_nEnd ; + }; + + /*_____________________________________________________________________________________________________________ + START_TIMEMEASURE( NSTART, NEND ) + STOP_TIMEMEASURE( NSTART, NEND, NTIME ) + + If you doesn't need a time measure above different classes ... you can try this macros! + They initialize your given members with start end end time ... You can calculate differenz by himself. + _____________________________________________________________________________________________________________*/ + + #define START_TIMEMEASURE( NSTART, NEND ) \ + sal_Int32 NSTART = 0; \ + sal_Int32 NEND = 0; \ + NSTART = osl_getGlobalTimer(); + + #define STOP_TIMEMEASURE( NSTART, NEND, NTIME ) \ + NEND = osl_getGlobalTimer(); \ + sal_Int32 NTIME = NEND-NSTART; + + /*_____________________________________________________________________________________________________________ + LOG_TIMEMEASURE( SOPERATION, NSTART ) + + Write measured time to logfile. + _____________________________________________________________________________________________________________*/ + + #define LOG_TIMEMEASURE( SOPERATION, NTIME ) \ + { \ + ::rtl::OStringBuffer _sBuffer( 256 ); \ + _sBuffer.append( SOPERATION ); \ + _sBuffer.append( "\t=\t" ); \ + _sBuffer.append( (sal_Int32)(NTIME) ); \ + _sBuffer.append( " ms\n" ); \ + WRITE_LOGFILE( LOGFILE_TIMEMEASURE, _sBuffer.makeStringAndClear().getStr() ) \ + } + +#else // #ifdef ENABLE_TIMEMEASURE + + /*_____________________________________________________________________________________________________________ + If right testmode is'nt set - implements these macros empty! + _____________________________________________________________________________________________________________*/ + + #undef LOGFILE_TIMEMEASURE + #define START_TIMEMEASURE( NSTART, NEND ) + #define STOP_TIMEMEASURE( NSTART, NEND, NTIME ) + #define LOG_TIMEMEASURE( SOPERATION, NTIME ) + +#endif // #ifdef ENABLE_TIMEMEASURE + +//***************************************************************************************************************** +// end of file +//***************************************************************************************************************** + +#endif // #ifndef __FRAMEWORK_MACROS_DEBUG_TIMEMEASURE_HXX_ diff --git a/framework/inc/macros/generic.hxx b/framework/inc/macros/generic.hxx new file mode 100644 index 000000000000..a18cf5cb9872 --- /dev/null +++ b/framework/inc/macros/generic.hxx @@ -0,0 +1,78 @@ +/************************************************************************* + * + * 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_MACROS_GENERIC_HXX_ +#define __FRAMEWORK_MACROS_GENERIC_HXX_ + +//_________________________________________________________________________________________________________________ +// includes +//_________________________________________________________________________________________________________________ + +#include <rtl/ustring.hxx> +#include <rtl/textenc.h> + +//***************************************************************************************************************** +// generic macros +//***************************************************************************************************************** + +/*_________________________________________________________________________________________________________________ + DECLARE_ASCII( SASCIIVALUE ) + + Use it to declare a constant ascii value at compile time in code. + zB. OUSting sTest = DECLARE_ASCII( "Test" ) +_________________________________________________________________________________________________________________*/ + +#define DECLARE_ASCII( SASCIIVALUE ) \ + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SASCIIVALUE ) ) + +/*_________________________________________________________________________________________________________________ + U2B( SUNICODEVALUE ) + B2U( SASCIIVALUE ) + U2B_ENC( SUNICODEVALUE, AENCODING ) + B2U_ENC( SASCIIVALUE, AENCODING ) + + Use it to convert unicode strings to ascii values and reverse ... + We use UTF8 as default textencoding. If you will change this use U2B_ENC and B2U_ENC! +_________________________________________________________________________________________________________________*/ + +#define U2B( SUNICODEVALUE ) \ + ::rtl::OUStringToOString( SUNICODEVALUE, RTL_TEXTENCODING_UTF8 ) + +#define B2U( SASCIIVALUE ) \ + ::rtl::OStringToOUString( SASCIIVALUE, RTL_TEXTENCODING_UTF8 ) + +#define U2B_ENC( SUNICODEVALUE, AENCODING ) \ + ::rtl::OUStringToOString( SUNICODEVALUE, AENCODING ) + +#define B2U_ENC( SASCIIVALUE, AENCODING ) \ + ::rtl::OStringToOUString( SASCIIVALUE, AENCODING ) + +//***************************************************************************************************************** +// end of file +//***************************************************************************************************************** + +#endif // #ifndef __FRAMEWORK_MACROS_GENERIC_HXX_ diff --git a/framework/inc/macros/registration.hxx b/framework/inc/macros/registration.hxx new file mode 100644 index 000000000000..11f7c297c645 --- /dev/null +++ b/framework/inc/macros/registration.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_MACROS_REGISTRATION_HXX_ +#define __FRAMEWORK_MACROS_REGISTRATION_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <macros/debug.hxx> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/lang/XSingleServiceFactory.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +//namespace framework{ + +/*_________________________________________________________________________________________________________________ + + macros for registration of services + Please use follow public macros only! + + IFFACTORY( CLASS ) => use it as parameter for COMPONENT_GETFACTORY( IFFACTORIES ) + COMPONENTGETIMPLEMENTATIONENVIRONMENT => use it to define exported function component_getImplementationEnvironment() + COMPONENTGETFACTORY( IFFACTORIES ) => use it to define exported function component_getFactory() + +_________________________________________________________________________________________________________________*/ + +//***************************************************************************************************************** +// public +// use it as parameter for COMPONENT_GETFACTORY( IFFACTORIES ) +//***************************************************************************************************************** +#define IFFACTORY( CLASS ) \ + /* If searched name found ... */ \ + /* You can't add some statements before follow line ... Here can be an ELSE-statement! */ \ + if ( CLASS::impl_getStaticImplementationName().equals( ::rtl::OUString::createFromAscii( pImplementationName ) ) ) \ + { \ + LOG_REGISTRATION_GETFACTORY( "\t\tImplementationname found - try to create factory! ...\n" ) \ + /* ... then create right factory for this service. */ \ + /* xFactory and xServiceManager are local variables of method which use this macro. */ \ + xFactory = CLASS::impl_createFactory( xServiceManager ); \ + } + +//***************************************************************************************************************** +// public +// define helper to get information about service environment +//***************************************************************************************************************** +#define COMPONENTGETIMPLEMENTATIONENVIRONMENT \ + extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( const sal_Char** ppEnvironmentTypeName , \ + uno_Environment** ) \ + { \ + *ppEnvironmentTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME ; \ + } + +//***************************************************************************************************************** +// public +// define method to instanciate new services +//***************************************************************************************************************** +#define COMPONENTGETFACTORY( IFFACTORIES ) \ + extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( const sal_Char* pImplementationName , \ + void* pServiceManager , \ + void* /*pRegistryKey*/ ) \ + { \ + LOG_REGISTRATION_GETFACTORY( "\t[start]\n" ) \ + /* Set default return value for this operation - if it failed. */ \ + void* pReturn = NULL ; \ + if ( \ + ( pImplementationName != NULL ) && \ + ( pServiceManager != NULL ) \ + ) \ + { \ + LOG_REGISTRATION_GETFACTORY( "\t\tpImplementationName and pServiceManager are valid ...\n" ) \ + /* Define variables which are used in following macros. */ \ + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory > xFactory ; \ + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceManager ; \ + xServiceManager = reinterpret_cast< ::com::sun::star::lang::XMultiServiceFactory* >( pServiceManager ) ; \ + /* These parameter will expand to */ \ + /* "IF_NAME_CREATECOMPONENTFACTORY(a) */ \ + /* else */ \ + /* ... */ \ + /* else */ \ + /* IF_NAME_CREATECOMPONENTFACTORY(z)" */ \ + IFFACTORIES \ + /* Factory is valid, if service was found. */ \ + if ( xFactory.is() == sal_True ) \ + { \ + LOG_REGISTRATION_GETFACTORY( "\t\t\txFactory valid - service was found ...\n" ) \ + xFactory->acquire(); \ + pReturn = xFactory.get(); \ + } \ + } \ + LOG_REGISTRATION_GETFACTORY( "\t[end]\n" ) \ + /* Return with result of this operation. */ \ + return pReturn ; \ + } + +//} // namespace framework + +#endif // #ifndef __FRAMEWORK_MACROS_REGISTRATION_HXX_ diff --git a/framework/inc/macros/xinterface.hxx b/framework/inc/macros/xinterface.hxx new file mode 100644 index 000000000000..48a8654486c3 --- /dev/null +++ b/framework/inc/macros/xinterface.hxx @@ -0,0 +1,708 @@ +/************************************************************************* + * + * 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_MACROS_XINTERFACE_HXX_ +#define __FRAMEWORK_MACROS_XINTERFACE_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ + +#include <com/sun/star/uno/RuntimeException.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/uno/Type.hxx> +#include <cppuhelper/queryinterface.hxx> +#include <rtl/ustring.hxx> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +/*_________________________________________________________________________________________________________________ + + macros for declaration and definition of XInterface + Please use follow public macros only! + + 1) DEFINE_XINTERFACE => use it in header to declare XInterface and his methods + 2) DIRECT_INTERFACE( INTERFACE ) => use it as parameter INTERFACEx at 4) if interface not ambigous + 3) DERIVED_INTERFACE( BASEINTERFACE, DERIVEDINTERFACE ) => use it as parameter INTERFACEx at 4) if interface can be ambigous + 4) DECLARE_XINTERFACE_0( CLASS, BASECLASS ) => use it to define implementation of XInterface for 0 additional interface to baseclass + DECLARE_XINTERFACE_1( CLASS, BASECLASS, INTERFACE1 ) => use it to define implementation of XInterface for 1 additional interface to baseclass + ... + DECLARE_XINTERFACE_16( CLASS, BASECLASS, INTERFACE1, ... , INTERFACE16 ) + +_________________________________________________________________________________________________________________*/ + +//***************************************************************************************************************** +// private +// implementation of XInterface::aquire() +// XInterface::release() +//***************************************************************************************************************** +#define PRIVATE_DEFINE_XINTERFACE_AQUIRE_RELEASE( CLASS, BASECLASS ) \ + void SAL_CALL CLASS::acquire() throw() \ + { \ + /* Don't use mutex in methods of XInterface! */ \ + BASECLASS::acquire(); \ + } \ + \ + void SAL_CALL CLASS::release() throw() \ + { \ + /* Don't use mutex in methods of XInterface! */ \ + BASECLASS::release(); \ + } + +//***************************************************************************************************************** +// private +// implementation of XInterface::queryInterface() without any other interfaces! +//***************************************************************************************************************** +#define PRIVATE_DEFINE_XINTERFACE_QUERYINTERFACE_PURE( CLASS, BASECLASS ) \ + ::com::sun::star::uno::Any SAL_CALL CLASS::queryInterface( const ::com::sun::star::uno::Type& aType ) throw( ::com::sun::star::uno::RuntimeException ) \ + { \ + /* Attention: Don't use mutex or guard in this method!!! Is a method of XInterface. */ \ + /* I have no own supported interfaces ... */ \ + /* ... ask baseclass for interfaces! */ \ + return BASECLASS::queryInterface( aType ); \ + } + +//***************************************************************************************************************** +// private +// implementation of XInterface::queryInterface() with max. 12 other interfaces! +//***************************************************************************************************************** +#define PRIVATE_DEFINE_XINTERFACE_QUERYINTERFACE( CLASS, BASECLASS, INTERFACES ) \ + ::com::sun::star::uno::Any SAL_CALL CLASS::queryInterface( const ::com::sun::star::uno::Type& aType ) throw( ::com::sun::star::uno::RuntimeException ) \ + { \ + /* Attention: Don't use mutex or guard in this method!!! Is a method of XInterface. */ \ + /* Ask for my own supported interfaces ... */ \ + ::com::sun::star::uno::Any aReturn ( ::cppu::queryInterface INTERFACES \ + ); \ + /* If searched interface not supported by this class ... */ \ + if ( aReturn.hasValue() == sal_False ) \ + { \ + /* ... ask baseclass for interfaces! */ \ + aReturn = BASECLASS::queryInterface( aType ); \ + } \ + /* Return result of this search. */ \ + return aReturn; \ + } + +//***************************************************************************************************************** +// private +// implementation of XInterface::queryInterface() with more then 12 other interfaces! +//***************************************************************************************************************** +#define PRIVATE_DEFINE_XINTERFACE_QUERYINTERFACE_LARGE( CLASS, BASECLASS, INTERFACES_FIRST, INTERFACES_SECOND ) \ + ::com::sun::star::uno::Any SAL_CALL CLASS::queryInterface( const ::com::sun::star::uno::Type& aType ) throw( ::com::sun::star::uno::RuntimeException ) \ + { \ + /* Attention: Don't use mutex or guard in this method!!! Is a method of XInterface. */ \ + /* Ask for my own supported interfaces ... */ \ + ::com::sun::star::uno::Any aReturn ( ::cppu::queryInterface INTERFACES_FIRST \ + ); \ + /* If searched interface not supported by first group ... */ \ + if ( aReturn.hasValue() == sal_False ) \ + { \ + /* ... search in second group. (cppuhelper support 12 items only!) */ \ + aReturn = ::cppu::queryInterface INTERFACES_SECOND ; \ + /* If searched interface not supported by this class ... */ \ + if ( aReturn.hasValue() == sal_False ) \ + { \ + /* ... ask baseclass for interfaces! */ \ + aReturn = BASECLASS::queryInterface( aType ); \ + } \ + } \ + /* Return result of this search. */ \ + return aReturn; \ + } + +//***************************************************************************************************************** +// private +// complete implementation of XInterface for different use cases +//***************************************************************************************************************** +#define PRIVATE_DEFINE_XINTERFACE_PURE( CLASS, BASECLASS ) \ + PRIVATE_DEFINE_XINTERFACE_AQUIRE_RELEASE( CLASS, BASECLASS ) \ + PRIVATE_DEFINE_XINTERFACE_QUERYINTERFACE_PURE( CLASS, BASECLASS ) + +#define PRIVATE_DEFINE_XINTERFACE( CLASS, BASECLASS, INTERFACES ) \ + PRIVATE_DEFINE_XINTERFACE_AQUIRE_RELEASE( CLASS, BASECLASS ) \ + PRIVATE_DEFINE_XINTERFACE_QUERYINTERFACE( CLASS, BASECLASS, INTERFACES ) + +#define PRIVATE_DEFINE_XINTERFACE_LARGE( CLASS, BASECLASS, INTERFACES_FIRST, INTERFACES_SECOND ) \ + PRIVATE_DEFINE_XINTERFACE_AQUIRE_RELEASE( CLASS, BASECLASS ) \ + PRIVATE_DEFINE_XINTERFACE_QUERYINTERFACE_LARGE( CLASS, BASECLASS, INTERFACES_FIRST, INTERFACES_SECOND ) + +//***************************************************************************************************************** +// private +// help macros to replace INTERFACES in queryInterface() [see before] +//***************************************************************************************************************** +/* +#ifdef ENABLE_SERVICEDEBUG + #define PRIVATE_DEFINE_INTERFACE_1( INTERFACE1 ) \ + static_cast< XSPECIALDEBUGINTERFACE##* >( this ), \ + INTERFACE1 +#else +*/ + #define PRIVATE_DEFINE_INTERFACE_1( INTERFACE1 ) \ + INTERFACE1 +//#endif // #ifdef ENABLE_SERVICEDEBUG + +#define PRIVATE_DEFINE_INTERFACE_2( INTERFACE1, INTERFACE2 ) \ + PRIVATE_DEFINE_INTERFACE_1( INTERFACE1 ), \ + INTERFACE2 + +#define PRIVATE_DEFINE_INTERFACE_3( INTERFACE1, INTERFACE2, INTERFACE3 ) \ + PRIVATE_DEFINE_INTERFACE_2( INTERFACE1, INTERFACE2 ), \ + INTERFACE3 + +#define PRIVATE_DEFINE_INTERFACE_4( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4 ) \ + PRIVATE_DEFINE_INTERFACE_3( INTERFACE1, INTERFACE2, INTERFACE3 ), \ + INTERFACE4 + +#define PRIVATE_DEFINE_INTERFACE_5( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5 ) \ + PRIVATE_DEFINE_INTERFACE_4( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4 ), \ + INTERFACE5 + +#define PRIVATE_DEFINE_INTERFACE_6( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6 ) \ + PRIVATE_DEFINE_INTERFACE_5( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5 ), \ + INTERFACE6 + +#define PRIVATE_DEFINE_INTERFACE_7( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7 ) \ + PRIVATE_DEFINE_INTERFACE_6( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6 ), \ + INTERFACE7 + +#define PRIVATE_DEFINE_INTERFACE_8( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8 ) \ + PRIVATE_DEFINE_INTERFACE_7( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7 ), \ + INTERFACE8 + +#define PRIVATE_DEFINE_INTERFACE_9( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9 ) \ + PRIVATE_DEFINE_INTERFACE_8( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8 ), \ + INTERFACE9 + +#define PRIVATE_DEFINE_INTERFACE_10( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10 ) \ + PRIVATE_DEFINE_INTERFACE_9( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9 ), \ + INTERFACE10 + +#define PRIVATE_DEFINE_INTERFACE_11( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10, INTERFACE11 ) \ + PRIVATE_DEFINE_INTERFACE_10( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10 ), \ + INTERFACE11 + +//***************************************************************************************************************** +// public +// help macros for follow XInterface definitions +//***************************************************************************************************************** + +// Use it as parameter for DEFINE_XINTERFACE_X(), if you CAN use an interface directly in queryInterface()! +#define DIRECT_INTERFACE( INTERFACE ) \ + static_cast< INTERFACE* >( this ) + +// Use it as parameter for DEFINE_XINTERFACE_X(), if you CAN'T use an interface directly in queryInterface()! +// (zB at ambigous errors!) +#define DERIVED_INTERFACE( BASEINTERFACE, DERIVEDINTERFACE ) \ + static_cast< BASEINTERFACE* >( static_cast< DERIVEDINTERFACE* >( this ) ) + +//***************************************************************************************************************** +// public +// declaration of XInterface +//***************************************************************************************************************** +#define FWK_DECLARE_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(); + +//***************************************************************************************************************** +// public +// implementation of XInterface +//***************************************************************************************************************** + +// implementation of XInterface with 0 additional interface for queryInterface() +#define DEFINE_XINTERFACE_0( CLASS, BASECLASS ) \ + PRIVATE_DEFINE_XINTERFACE_PURE ( CLASS, \ + BASECLASS \ + ) + +// implementation of XInterface with 1 additional interface for queryInterface() +#define DEFINE_XINTERFACE_1( CLASS, BASECLASS, INTERFACE1 ) \ + PRIVATE_DEFINE_XINTERFACE ( CLASS, \ + BASECLASS, \ + ( aType, PRIVATE_DEFINE_INTERFACE_1 ( INTERFACE1 \ + ) \ + ) \ + ) + +// implementation of XInterface with 2 additional interfaces for queryInterface() +#define DEFINE_XINTERFACE_2( CLASS, BASECLASS, INTERFACE1, INTERFACE2 ) \ + PRIVATE_DEFINE_XINTERFACE ( CLASS, \ + BASECLASS, \ + ( aType, PRIVATE_DEFINE_INTERFACE_2 ( INTERFACE1 , \ + INTERFACE2 \ + ) \ + ) \ + ) + +// implementation of XInterface with 3 additional interfaces for queryInterface() +#define DEFINE_XINTERFACE_3( CLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3 ) \ + PRIVATE_DEFINE_XINTERFACE ( CLASS, \ + BASECLASS, \ + ( aType, PRIVATE_DEFINE_INTERFACE_3 ( INTERFACE1 , \ + INTERFACE2 , \ + INTERFACE3 \ + ) \ + ) \ + ) + +// implementation of XInterface with 4 additional interfaces for queryInterface() +#define DEFINE_XINTERFACE_4( CLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4 ) \ + PRIVATE_DEFINE_XINTERFACE ( CLASS, \ + BASECLASS, \ + ( aType, PRIVATE_DEFINE_INTERFACE_4 ( INTERFACE1 , \ + INTERFACE2 , \ + INTERFACE3 , \ + INTERFACE4 \ + ) \ + ) \ + ) + +// implementation of XInterface with 5 additional interfaces for queryInterface() +#define DEFINE_XINTERFACE_5( CLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5 ) \ + PRIVATE_DEFINE_XINTERFACE ( CLASS, \ + BASECLASS, \ + ( aType, PRIVATE_DEFINE_INTERFACE_5 ( INTERFACE1 , \ + INTERFACE2 , \ + INTERFACE3 , \ + INTERFACE4 , \ + INTERFACE5 \ + ) \ + ) \ + ) + +// implementation of XInterface with 6 additional interfaces for queryInterface() +#define DEFINE_XINTERFACE_6( CLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6 ) \ + PRIVATE_DEFINE_XINTERFACE ( CLASS, \ + BASECLASS, \ + ( aType, PRIVATE_DEFINE_INTERFACE_6 ( INTERFACE1 , \ + INTERFACE2 , \ + INTERFACE3 , \ + INTERFACE4 , \ + INTERFACE5 , \ + INTERFACE6 \ + ) \ + ) \ + ) + +// implementation of XInterface with 7 additional interfaces for queryInterface() +#define DEFINE_XINTERFACE_7( CLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7 ) \ + PRIVATE_DEFINE_XINTERFACE ( CLASS, \ + BASECLASS, \ + ( aType, PRIVATE_DEFINE_INTERFACE_7 ( INTERFACE1 , \ + INTERFACE2 , \ + INTERFACE3 , \ + INTERFACE4 , \ + INTERFACE5 , \ + INTERFACE6 , \ + INTERFACE7 \ + ) \ + ) \ + ) + +// implementation of XInterface with 8 additional interfaces for queryInterface() +#define DEFINE_XINTERFACE_8( CLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8 ) \ + PRIVATE_DEFINE_XINTERFACE ( CLASS, \ + BASECLASS, \ + ( aType, PRIVATE_DEFINE_INTERFACE_8 ( INTERFACE1 , \ + INTERFACE2 , \ + INTERFACE3 , \ + INTERFACE4 , \ + INTERFACE5 , \ + INTERFACE6 , \ + INTERFACE7 , \ + INTERFACE8 \ + ) \ + ) \ + ) + +// implementation of XInterface with 9 additional interfaces for queryInterface() +#define DEFINE_XINTERFACE_9( CLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9 ) \ + PRIVATE_DEFINE_XINTERFACE ( CLASS, \ + BASECLASS, \ + ( aType, PRIVATE_DEFINE_INTERFACE_9 ( INTERFACE1 , \ + INTERFACE2 , \ + INTERFACE3 , \ + INTERFACE4 , \ + INTERFACE5 , \ + INTERFACE6 , \ + INTERFACE7 , \ + INTERFACE8 , \ + INTERFACE9 \ + ) \ + ) \ + ) + +// implementation of XInterface with 10 additional interfaces for queryInterface() +#define DEFINE_XINTERFACE_10( CLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10 ) \ + PRIVATE_DEFINE_XINTERFACE ( CLASS, \ + BASECLASS, \ + ( aType, PRIVATE_DEFINE_INTERFACE_10 ( INTERFACE1 , \ + INTERFACE2 , \ + INTERFACE3 , \ + INTERFACE4 , \ + INTERFACE5 , \ + INTERFACE6 , \ + INTERFACE7 , \ + INTERFACE8 , \ + INTERFACE9 , \ + INTERFACE10 \ + ) \ + ) \ + ) + +// implementation of XInterface with 11 additional interfaces for queryInterface() +#define DEFINE_XINTERFACE_11( CLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10, INTERFACE11 ) \ + PRIVATE_DEFINE_XINTERFACE ( CLASS, \ + BASECLASS, \ + ( aType, PRIVATE_DEFINE_INTERFACE_11 ( INTERFACE1 , \ + INTERFACE2 , \ + INTERFACE3 , \ + INTERFACE4 , \ + INTERFACE5 , \ + INTERFACE6 , \ + INTERFACE7 , \ + INTERFACE8 , \ + INTERFACE9 , \ + INTERFACE10 , \ + INTERFACE11 \ + ) \ + ) \ + ) + +// implementation of XInterface with 12 additional interfaces for queryInterface() +#define DEFINE_XINTERFACE_12( CLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10, INTERFACE11, INTERFACE12 ) \ + PRIVATE_DEFINE_XINTERFACE_LARGE ( CLASS, \ + BASECLASS, \ + ( aType, PRIVATE_DEFINE_INTERFACE_11 ( INTERFACE1 , \ + INTERFACE2 , \ + INTERFACE3 , \ + INTERFACE4 , \ + INTERFACE5 , \ + INTERFACE6 , \ + INTERFACE7 , \ + INTERFACE8 , \ + INTERFACE9 , \ + INTERFACE10 , \ + INTERFACE11 \ + ) \ + ), \ + ( aType, PRIVATE_DEFINE_INTERFACE_1 ( INTERFACE12 \ + ) \ + ) \ + ) + +// implementation of XInterface with 13 additional interfaces for queryInterface() +#define DEFINE_XINTERFACE_13( CLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10, INTERFACE11, INTERFACE12, INTERFACE13 ) \ + PRIVATE_DEFINE_XINTERFACE_LARGE ( CLASS, \ + BASECLASS, \ + ( aType, PRIVATE_DEFINE_INTERFACE_11 ( INTERFACE1 , \ + INTERFACE2 , \ + INTERFACE3 , \ + INTERFACE4 , \ + INTERFACE5 , \ + INTERFACE6 , \ + INTERFACE7 , \ + INTERFACE8 , \ + INTERFACE9 , \ + INTERFACE10 , \ + INTERFACE11 \ + ) \ + ), \ + ( aType, PRIVATE_DEFINE_INTERFACE_2 ( INTERFACE12 , \ + INTERFACE13 \ + ) \ + ) \ + ) + +// implementation of XInterface with 14 additional interfaces for queryInterface() +#define DEFINE_XINTERFACE_14( CLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10, INTERFACE11, INTERFACE12, INTERFACE13, INTERFACE14 ) \ + PRIVATE_DEFINE_XINTERFACE_LARGE ( CLASS, \ + BASECLASS, \ + ( aType, PRIVATE_DEFINE_INTERFACE_11 ( INTERFACE1 , \ + INTERFACE2 , \ + INTERFACE3 , \ + INTERFACE4 , \ + INTERFACE5 , \ + INTERFACE6 , \ + INTERFACE7 , \ + INTERFACE8 , \ + INTERFACE9 , \ + INTERFACE10 , \ + INTERFACE11 \ + ) \ + ), \ + ( aType, PRIVATE_DEFINE_INTERFACE_3 ( INTERFACE12 , \ + INTERFACE13 , \ + INTERFACE14 \ + ) \ + ) \ + ) + +// implementation of XInterface with 15 additional interfaces for queryInterface() +#define DEFINE_XINTERFACE_15( CLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10, INTERFACE11, INTERFACE12, INTERFACE13, INTERFACE14, INTERFACE15 ) \ + PRIVATE_DEFINE_XINTERFACE_LARGE ( CLASS, \ + BASECLASS, \ + ( aType, PRIVATE_DEFINE_INTERFACE_11 ( INTERFACE1 , \ + INTERFACE2 , \ + INTERFACE3 , \ + INTERFACE4 , \ + INTERFACE5 , \ + INTERFACE6 , \ + INTERFACE7 , \ + INTERFACE8 , \ + INTERFACE9 , \ + INTERFACE10 , \ + INTERFACE11 \ + ) \ + ), \ + ( aType, PRIVATE_DEFINE_INTERFACE_4 ( INTERFACE12 , \ + INTERFACE13 , \ + INTERFACE14 , \ + INTERFACE15 \ + ) \ + ) \ + ) + +// implementation of XInterface with 16 additional interfaces for queryInterface() +#define DEFINE_XINTERFACE_16( CLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10, INTERFACE11, INTERFACE12, INTERFACE13, INTERFACE14, INTERFACE15, INTERFACE16 ) \ + PRIVATE_DEFINE_XINTERFACE_LARGE ( CLASS, \ + BASECLASS, \ + ( aType, PRIVATE_DEFINE_INTERFACE_11 ( INTERFACE1 , \ + INTERFACE2 , \ + INTERFACE3 , \ + INTERFACE4 , \ + INTERFACE5 , \ + INTERFACE6 , \ + INTERFACE7 , \ + INTERFACE8 , \ + INTERFACE9 , \ + INTERFACE10 , \ + INTERFACE11 \ + ) \ + ), \ + ( aType, PRIVATE_DEFINE_INTERFACE_5 ( INTERFACE12 , \ + INTERFACE13 , \ + INTERFACE14 , \ + INTERFACE15 , \ + INTERFACE16 \ + ) \ + ) \ + ) + +// implementation of XInterface with 17 additional interfaces for queryInterface() +#define DEFINE_XINTERFACE_17( CLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10, INTERFACE11, INTERFACE12, INTERFACE13, INTERFACE14, INTERFACE15, INTERFACE16, INTERFACE17 ) \ + PRIVATE_DEFINE_XINTERFACE_LARGE ( CLASS, \ + BASECLASS, \ + ( aType, PRIVATE_DEFINE_INTERFACE_11 ( INTERFACE1 , \ + INTERFACE2 , \ + INTERFACE3 , \ + INTERFACE4 , \ + INTERFACE5 , \ + INTERFACE6 , \ + INTERFACE7 , \ + INTERFACE8 , \ + INTERFACE9 , \ + INTERFACE10 , \ + INTERFACE11 \ + ) \ + ), \ + ( aType, PRIVATE_DEFINE_INTERFACE_6 ( INTERFACE12 , \ + INTERFACE13 , \ + INTERFACE14 , \ + INTERFACE15 , \ + INTERFACE16 , \ + INTERFACE17 \ + ) \ + ) \ + ) + +// implementation of XInterface with 18 additional interfaces for queryInterface() +#define DEFINE_XINTERFACE_18( CLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10, INTERFACE11, INTERFACE12, INTERFACE13, INTERFACE14, INTERFACE15, INTERFACE16, INTERFACE17, INTERFACE18 ) \ + PRIVATE_DEFINE_XINTERFACE_LARGE ( CLASS, \ + BASECLASS, \ + ( aType, PRIVATE_DEFINE_INTERFACE_11 ( INTERFACE1 , \ + INTERFACE2 , \ + INTERFACE3 , \ + INTERFACE4 , \ + INTERFACE5 , \ + INTERFACE6 , \ + INTERFACE7 , \ + INTERFACE8 , \ + INTERFACE9 , \ + INTERFACE10 , \ + INTERFACE11 \ + ) \ + ), \ + ( aType, PRIVATE_DEFINE_INTERFACE_7 ( INTERFACE12 , \ + INTERFACE13 , \ + INTERFACE14 , \ + INTERFACE15 , \ + INTERFACE16 , \ + INTERFACE17 , \ + INTERFACE18 \ + ) \ + ) \ + ) + +// implementation of XInterface with 19 additional interfaces for queryInterface() +#define DEFINE_XINTERFACE_19( CLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10, INTERFACE11, INTERFACE12, INTERFACE13, INTERFACE14, INTERFACE15, INTERFACE16, INTERFACE17, INTERFACE18, INTERFACE19 ) \ + PRIVATE_DEFINE_XINTERFACE_LARGE ( CLASS, \ + BASECLASS, \ + ( aType, PRIVATE_DEFINE_INTERFACE_11 ( INTERFACE1 , \ + INTERFACE2 , \ + INTERFACE3 , \ + INTERFACE4 , \ + INTERFACE5 , \ + INTERFACE6 , \ + INTERFACE7 , \ + INTERFACE8 , \ + INTERFACE9 , \ + INTERFACE10 , \ + INTERFACE11 \ + ) \ + ), \ + ( aType, PRIVATE_DEFINE_INTERFACE_8 ( INTERFACE12 , \ + INTERFACE13 , \ + INTERFACE14 , \ + INTERFACE15 , \ + INTERFACE16 , \ + INTERFACE17 , \ + INTERFACE18 , \ + INTERFACE19 \ + ) \ + ) \ + ) + +// implementation of XInterface with 20 additional interfaces for queryInterface() +#define DEFINE_XINTERFACE_20( CLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10, INTERFACE11, INTERFACE12, INTERFACE13, INTERFACE14, INTERFACE15, INTERFACE16, INTERFACE17, INTERFACE18, INTERFACE19, INTERFACE20 ) \ + PRIVATE_DEFINE_XINTERFACE_LARGE ( CLASS, \ + BASECLASS, \ + ( aType, PRIVATE_DEFINE_INTERFACE_11 ( INTERFACE1 , \ + INTERFACE2 , \ + INTERFACE3 , \ + INTERFACE4 , \ + INTERFACE5 , \ + INTERFACE6 , \ + INTERFACE7 , \ + INTERFACE8 , \ + INTERFACE9 , \ + INTERFACE10 , \ + INTERFACE11 \ + ) \ + ), \ + ( aType, PRIVATE_DEFINE_INTERFACE_9 ( INTERFACE12 , \ + INTERFACE13 , \ + INTERFACE14 , \ + INTERFACE15 , \ + INTERFACE16 , \ + INTERFACE17 , \ + INTERFACE18 , \ + INTERFACE19 , \ + INTERFACE20 \ + ) \ + ) \ + ) + +// implementation of XInterface with 21 additional interfaces for queryInterface() +#define DEFINE_XINTERFACE_21( CLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10, INTERFACE11, INTERFACE12, INTERFACE13, INTERFACE14, INTERFACE15, INTERFACE16, INTERFACE17, INTERFACE18, INTERFACE19, INTERFACE20, INTERFACE21 ) \ + PRIVATE_DEFINE_XINTERFACE_LARGE ( CLASS, \ + BASECLASS, \ + ( aType, PRIVATE_DEFINE_INTERFACE_11 ( INTERFACE1 , \ + INTERFACE2 , \ + INTERFACE3 , \ + INTERFACE4 , \ + INTERFACE5 , \ + INTERFACE6 , \ + INTERFACE7 , \ + INTERFACE8 , \ + INTERFACE9 , \ + INTERFACE10 , \ + INTERFACE11 \ + ) \ + ), \ + ( aType, PRIVATE_DEFINE_INTERFACE_10 ( INTERFACE12 , \ + INTERFACE13 , \ + INTERFACE14 , \ + INTERFACE15 , \ + INTERFACE16 , \ + INTERFACE17 , \ + INTERFACE18 , \ + INTERFACE19 , \ + INTERFACE20 , \ + INTERFACE21 \ + ) \ + ) \ + ) + +// implementation of XInterface with 22 additional interfaces for queryInterface() +#define DEFINE_XINTERFACE_22( CLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10, INTERFACE11, INTERFACE12, INTERFACE13, INTERFACE14, INTERFACE15, INTERFACE16, INTERFACE17, INTERFACE18, INTERFACE19, INTERFACE20, INTERFACE21, INTERFACE22 ) \ + PRIVATE_DEFINE_XINTERFACE_LARGE ( CLASS, \ + BASECLASS, \ + ( aType, PRIVATE_DEFINE_INTERFACE_11 ( INTERFACE1 , \ + INTERFACE2 , \ + INTERFACE3 , \ + INTERFACE4 , \ + INTERFACE5 , \ + INTERFACE6 , \ + INTERFACE7 , \ + INTERFACE8 , \ + INTERFACE9 , \ + INTERFACE10 , \ + INTERFACE11 \ + ) \ + ), \ + ( aType, PRIVATE_DEFINE_INTERFACE_11 ( INTERFACE12 , \ + INTERFACE13 , \ + INTERFACE14 , \ + INTERFACE15 , \ + INTERFACE16 , \ + INTERFACE17 , \ + INTERFACE18 , \ + INTERFACE19 , \ + INTERFACE20 , \ + INTERFACE22 , \ + INTERFACE21 \ + ) \ + ) \ + ) + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_MACROS_XINTERFACE_HXX_ diff --git a/framework/inc/macros/xserviceinfo.hxx b/framework/inc/macros/xserviceinfo.hxx new file mode 100644 index 000000000000..473ce69a74e6 --- /dev/null +++ b/framework/inc/macros/xserviceinfo.hxx @@ -0,0 +1,272 @@ +/************************************************************************* + * + * 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_MACROS_XSERVICEINFO_HXX_ +#define __FRAMEWORK_MACROS_XSERVICEINFO_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <general.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/uno/Exception.hpp> +#include <com/sun/star/uno/RuntimeException.hpp> +#include <com/sun/star/lang/XSingleServiceFactory.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/uno/Type.hxx> +#include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <cppuhelper/factory.hxx> +#include <comphelper/sequence.hxx> +#include <rtl/ustring.hxx> +#include <rtl/logfile.hxx> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +/*_________________________________________________________________________________________________________________ + + macros for declaration and definition of XServiceInfo + Please use follow public macros only! + + 1) DECLARE_XSERVICEINFO => use it to declare XServiceInfo in your header + 2) DEFINE_XSERVICEINFO_MULTISERVICE( CLASS, XINTERFACECAST, SERVICENAME, IMPLEMENTATIONNAME ) => use it to define XServiceInfo for multi service mode + 3) DEFINE_XSERVICEINFO_ONEINSTANCESERVICE( CLASS, XINTERFACECAST, SERVICENAME, IMPLEMENTATIONNAME ) => use it to define XServiceInfo for one instance service mode + 4) DEFINE_INIT_SERVICE( CLASS ) => use it to implement your own impl_initService() method, which is neccessary for initializeing object by using his own reference! + +_________________________________________________________________________________________________________________*/ + +//***************************************************************************************************************** +// private +// implementation of XServiceInfo and helper functions +//***************************************************************************************************************** +#define PRIVATE_DEFINE_XSERVICEINFO_BASE( CLASS, XINTERFACECAST, SERVICENAME, IMPLEMENTATIONNAME ) \ + /*===========================================================================================================*/ \ + /* XServiceInfo */ \ + /*===========================================================================================================*/ \ + ::rtl::OUString SAL_CALL CLASS::getImplementationName() throw( css::uno::RuntimeException ) \ + { \ + return impl_getStaticImplementationName(); \ + } \ + \ + /*===========================================================================================================*/ \ + /* XServiceInfo */ \ + /*===========================================================================================================*/ \ + sal_Bool SAL_CALL CLASS::supportsService( const ::rtl::OUString& sServiceName ) throw( css::uno::RuntimeException ) \ + { \ + return ::comphelper::findValue(getSupportedServiceNames(), sServiceName, sal_True).getLength() != 0; \ + } \ + \ + /*===========================================================================================================*/ \ + /* XServiceInfo */ \ + /*===========================================================================================================*/ \ + css::uno::Sequence< ::rtl::OUString > SAL_CALL CLASS::getSupportedServiceNames() throw( css::uno::RuntimeException ) \ + { \ + return impl_getStaticSupportedServiceNames(); \ + } \ + \ + /*===========================================================================================================*/ \ + /* Helper for XServiceInfo */ \ + /*===========================================================================================================*/ \ + css::uno::Sequence< ::rtl::OUString > CLASS::impl_getStaticSupportedServiceNames() \ + { \ + css::uno::Sequence< ::rtl::OUString > seqServiceNames( 1 ); \ + seqServiceNames.getArray() [0] = SERVICENAME ; \ + return seqServiceNames; \ + } \ + \ + /*===========================================================================================================*/ \ + /* Helper for XServiceInfo */ \ + /*===========================================================================================================*/ \ + ::rtl::OUString CLASS::impl_getStaticImplementationName() \ + { \ + return IMPLEMENTATIONNAME ; \ + } + +#define PRIVATE_DEFINE_XSERVICEINFO_OLDSTYLE( CLASS, XINTERFACECAST, SERVICENAME, IMPLEMENTATIONNAME ) \ + PRIVATE_DEFINE_XSERVICEINFO_BASE( CLASS, XINTERFACECAST, SERVICENAME, IMPLEMENTATIONNAME ) \ + /*===========================================================================================================*/ \ + /* Helper for registry */ \ + /* Attention: To avoid against wrong ref counts during our own initialize procedure, we must */ \ + /* use right EXTERNAL handling of them. That's why you should do nothing in your ctor, which could*/ \ + /* work on your ref count! All other things are allowed. Do work with your own reference - please */ \ + /* use "impl_initService()" method. */ \ + /*===========================================================================================================*/ \ + css::uno::Reference< css::uno::XInterface > SAL_CALL CLASS::impl_createInstance( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ) throw( css::uno::Exception ) \ + { \ + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework","Ocke.Janssen@sun.com",U2B(IMPLEMENTATIONNAME).getStr()); \ + /* create new instance of service */ \ + CLASS* pClass = new CLASS( xServiceManager ); \ + /* hold it alive by increasing his ref count!!! */ \ + css::uno::Reference< css::uno::XInterface > xService( static_cast< XINTERFACECAST* >(pClass), css::uno::UNO_QUERY ); \ + /* initialize new service instance ... he can use his own refcount ... we hold it! */ \ + pClass->impl_initService(); \ + /* return new created service as reference */ \ + return xService; \ + } + +#define PRIVATE_DEFINE_XSERVICEINFO_NEWSTYLE( CLASS, XINTERFACECAST, SERVICENAME, IMPLEMENTATIONNAME ) \ + PRIVATE_DEFINE_XSERVICEINFO_BASE( CLASS, XINTERFACECAST, SERVICENAME, IMPLEMENTATIONNAME ) \ + /*===========================================================================================================*/ \ + /* Helper for registry */ \ + /* Attention: To avoid against wrong ref counts during our own initialize procedure, we must */ \ + /* use right EXTERNAL handling of them. That's why you should do nothing in your ctor, which could*/ \ + /* work on your ref count! All other things are allowed. Do work with your own reference - please */ \ + /* use "impl_initService()" method. */ \ + /*===========================================================================================================*/ \ + css::uno::Reference< css::uno::XInterface > SAL_CALL CLASS::impl_createInstance( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager )\ + throw( css::uno::Exception ) \ + { \ + /* retrieve component context from the given service manager */ \ + static const ::rtl::OUString PROP_DEFAULTCONTEXT = ::rtl::OUString::createFromAscii("DefaultContext"); \ + css::uno::Reference< css::beans::XPropertySet > xSMGRProps(xServiceManager, css::uno::UNO_QUERY_THROW); \ + css::uno::Reference< css::uno::XComponentContext > xComponentContext; \ + xSMGRProps->getPropertyValue( PROP_DEFAULTCONTEXT ) >>= xComponentContext; \ + /* create new instance of service */ \ + CLASS* pClass = new CLASS( xComponentContext ); \ + /* hold it alive by increasing his ref count!!! */ \ + css::uno::Reference< css::uno::XInterface > xService( static_cast< XINTERFACECAST* >(pClass), css::uno::UNO_QUERY ); \ + /* initialize new service instance ... he can use his own refcount ... we hold it! */ \ + pClass->impl_initService(); \ + /* return new created service as reference */ \ + return xService; \ + } + +//***************************************************************************************************************** +// private +// definition of helper function createFactory() for multiple services +//***************************************************************************************************************** +#define PRIVATE_DEFINE_SINGLEFACTORY( CLASS ) \ + css::uno::Reference< css::lang::XSingleServiceFactory > CLASS::impl_createFactory( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ) \ + { \ + css::uno::Reference< css::lang::XSingleServiceFactory > xReturn ( cppu::createSingleFactory ( xServiceManager , \ + CLASS::impl_getStaticImplementationName() , \ + CLASS::impl_createInstance , \ + CLASS::impl_getStaticSupportedServiceNames() \ + ) \ + ); \ + return xReturn; \ + } + +//***************************************************************************************************************** +// private +// definition of helper function createFactory() for one instance services +//***************************************************************************************************************** +#define PRIVATE_DEFINE_ONEINSTANCEFACTORY( CLASS ) \ + css::uno::Reference< css::lang::XSingleServiceFactory > CLASS::impl_createFactory( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ) \ + { \ + css::uno::Reference< css::lang::XSingleServiceFactory > xReturn ( cppu::createOneInstanceFactory ( xServiceManager , \ + CLASS::impl_getStaticImplementationName() , \ + CLASS::impl_createInstance , \ + CLASS::impl_getStaticSupportedServiceNames() \ + ) \ + ); \ + return xReturn; \ + } + +//***************************************************************************************************************** +// public +// declaration of XServiceInfo and helper functions +//***************************************************************************************************************** +#define DECLARE_XSERVICEINFO \ + /* interface XServiceInfo */ \ + virtual ::rtl::OUString SAL_CALL getImplementationName ( ) throw( css::uno::RuntimeException ); \ + virtual sal_Bool SAL_CALL supportsService ( const ::rtl::OUString& sServiceName ) throw( css::uno::RuntimeException ); \ + virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames ( ) throw( css::uno::RuntimeException ); \ + /* Helper for XServiceInfo */ \ + static css::uno::Sequence< ::rtl::OUString > SAL_CALL impl_getStaticSupportedServiceNames( ); \ + static ::rtl::OUString SAL_CALL impl_getStaticImplementationName ( ); \ + /* Helper for registry */ \ + static css::uno::Reference< css::uno::XInterface > SAL_CALL impl_createInstance ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ) throw( css::uno::Exception ); \ + static css::uno::Reference< css::lang::XSingleServiceFactory > SAL_CALL impl_createFactory ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ); \ + /* Helper for initialization of service by using own reference! */ \ + virtual void SAL_CALL impl_initService ( ); \ + +//***************************************************************************************************************** +// public +// implementation of XServiceInfo +//***************************************************************************************************************** +#define DEFINE_XSERVICEINFO_MULTISERVICE( CLASS, XINTERFACECAST, SERVICENAME, IMPLEMENTATIONNAME ) \ + PRIVATE_DEFINE_XSERVICEINFO_OLDSTYLE( CLASS, XINTERFACECAST, SERVICENAME, IMPLEMENTATIONNAME ) \ + PRIVATE_DEFINE_SINGLEFACTORY( CLASS ) + +#define DEFINE_XSERVICEINFO_ONEINSTANCESERVICE( CLASS, XINTERFACECAST, SERVICENAME, IMPLEMENTATIONNAME ) \ + PRIVATE_DEFINE_XSERVICEINFO_OLDSTYLE( CLASS, XINTERFACECAST, SERVICENAME, IMPLEMENTATIONNAME ) \ + PRIVATE_DEFINE_ONEINSTANCEFACTORY( CLASS ) + +#define DEFINE_XSERVICEINFO_MULTISERVICE_2( CLASS, XINTERFACECAST, SERVICENAME, IMPLEMENTATIONNAME ) \ + PRIVATE_DEFINE_XSERVICEINFO_NEWSTYLE( CLASS, XINTERFACECAST, SERVICENAME, IMPLEMENTATIONNAME ) \ + PRIVATE_DEFINE_SINGLEFACTORY( CLASS ) + +#define DEFINE_XSERVICEINFO_ONEINSTANCESERVICE_2( CLASS, XINTERFACECAST, SERVICENAME, IMPLEMENTATIONNAME ) \ + PRIVATE_DEFINE_XSERVICEINFO_NEWSTYLE( CLASS, XINTERFACECAST, SERVICENAME, IMPLEMENTATIONNAME ) \ + PRIVATE_DEFINE_ONEINSTANCEFACTORY( CLASS ) + +//***************************************************************************************************************** +// public +// implementation of service initialize! +// example of using: DEFINE_INIT_SERVICE( MyClassName, +// { +// ... +// Reference< XInterface > xThis( this, UNO_QUERY ); +// myMember* pMember = new myMember( xThis ); +// ... +// } +// ) +//***************************************************************************************************************** +#define DEFINE_INIT_SERVICE( CLASS, FUNCTIONBODY ) \ + void SAL_CALL CLASS::impl_initService() \ + { \ + FUNCTIONBODY \ + } + +#define DEFINE_INIT_SERVICE_WITH_BASECLASS( CLASS, BASECLASS, FUNCTIONBODY ) \ + void SAL_CALL CLASS::impl_initService() \ + { \ + BASECLASS::impl_initService(); \ + { \ + FUNCTIONBODY \ + } \ + } + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_MACROS_XSERVICEINFO_HXX_ diff --git a/framework/inc/macros/xtypeprovider.hxx b/framework/inc/macros/xtypeprovider.hxx new file mode 100644 index 000000000000..3e4decb3ac0f --- /dev/null +++ b/framework/inc/macros/xtypeprovider.hxx @@ -0,0 +1,714 @@ +/************************************************************************* + * + * 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_MACROS_XTYPEPROVIDER_HXX_ +#define __FRAMEWORK_MACROS_XTYPEPROVIDER_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ + +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/uno/RuntimeException.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/uno/Type.hxx> +#include <cppuhelper/typeprovider.hxx> +#include <osl/mutex.hxx> +#include <rtl/ustring.hxx> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +/*_________________________________________________________________________________________________________________ + + macros for declaration and definition of XTypeProvider + Please use follow public macros only! + + 1) DEFINE_XTYPEPROVIDER => use it in header to declare XTypeProvider and his methods + 2) DECLARE_TYPEPROVIDER_0( CLASS ) => use it to define implementation of XTypeProvider for 0 supported type + DECLARE_TYPEPROVIDER_1( CLASS, TYPE1 ) => use it to define implementation of XTypeProvider for 1 supported type + ... + DECLARE_TYPEPROVIDER_16( CLASS, TYPE1, ... , TYPE16 ) + 3) DEFINE_XTYPEPROVIDER_1_WITH_BASECLASS( CLASS, BASECLASS, TYPE1 ) => use it to define implementation of XTypeProvider for 1 additional supported type to baseclass + ... + DEFINE_XTYPEPROVIDER_5_WITH_BASECLASS( CLASS, BASECLASS, TYPE1, ..., TYPE5 ) + +_________________________________________________________________________________________________________________*/ + +//***************************************************************************************************************** +// private +// implementation of XTypeProvider::getImplementationId() +//***************************************************************************************************************** +#define PRIVATE_DEFINE_XTYPEPROVIDER_GETIMPLEMENTATIONID( CLASS ) \ + ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL CLASS::getImplementationId() throw( ::com::sun::star::uno::RuntimeException ) \ + { \ + /* Create one Id for all instances of this class. */ \ + /* Use ethernet address to do this! (sal_True) */ \ + /* Optimize this method */ \ + /* We initialize a static variable only one time. And we don't must use a mutex at every call! */ \ + /* For the first call; pID is NULL - for the second call pID is different from NULL! */ \ + static ::cppu::OImplementationId* pID = NULL ; \ + if ( pID == NULL ) \ + { \ + /* Ready for multithreading; get global mutex for first call of this method only! see before */ \ + ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); \ + /* Control these pointer again ... it can be, that another instance will be faster then these! */ \ + if ( pID == NULL ) \ + { \ + /* Create a new static ID ... */ \ + static ::cppu::OImplementationId aID( sal_False ); \ + /* ... and set his address to static pointer! */ \ + pID = &aID ; \ + } \ + } \ + return pID->getImplementationId(); \ + } + +//***************************************************************************************************************** +// private +// implementation of XTypeProvider::getTypes() with max. 12 interfaces! +//***************************************************************************************************************** +#define PRIVATE_DEFINE_XTYPEPROVIDER_GETTYPES( CLASS, TYPES ) \ + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL CLASS::getTypes() throw( ::com::sun::star::uno::RuntimeException ) \ + { \ + /* Optimize this method ! */ \ + /* We initialize a static variable only one time. */ \ + /* And we don't must use a mutex at every call! */ \ + /* For the first call; pTypeCollection is NULL - */ \ + /* for the second call pTypeCollection is different from NULL! */ \ + static ::cppu::OTypeCollection* pTypeCollection = NULL ; \ + if ( pTypeCollection == NULL ) \ + { \ + /* Ready for multithreading; get global mutex for first call of this method only! see before */ \ + ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); \ + /* Control these pointer again ... it can be, that another instance will be faster then these! */ \ + if ( pTypeCollection == NULL ) \ + { \ + /* Create a static typecollection ... */ \ + /* Attention: "TYPES" will expand to "(...)"! */ \ + static ::cppu::OTypeCollection aTypeCollection TYPES ; \ + /* ... and set his address to static pointer! */ \ + pTypeCollection = &aTypeCollection ; \ + } \ + } \ + return pTypeCollection->getTypes(); \ + } + +//***************************************************************************************************************** +// private +// implementation of XTypeProvider::getTypes() with more then 12 interfaces! +//***************************************************************************************************************** +#define PRIVATE_DEFINE_XTYPEPROVIDER_GETTYPES_LARGE( CLASS, TYPES_FIRST, TYPES_SECOND ) \ + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL CLASS::getTypes() throw( ::com::sun::star::uno::RuntimeException ) \ + { \ + /* Optimize this method ! */ \ + /* We initialize a static variable only one time. */ \ + /* And we don't must use a mutex at every call! */ \ + /* For the first call; pTypeCollection is NULL - */ \ + /* for the second call pTypeCollection is different from NULL! */ \ + static ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >* pTypeCollection = NULL ; \ + if ( pTypeCollection == NULL ) \ + { \ + /* Ready for multithreading; get global mutex for first call of this method only! see before */ \ + ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); \ + /* Control these pointer again ... it can be, that another instance will be faster then these! */ \ + if ( pTypeCollection == NULL ) \ + { \ + /* Create two typecollections */ \ + /* (cppuhelper support 12 items per collection only!) */ \ + ::cppu::OTypeCollection aTypeCollection1 TYPES_FIRST ; \ + ::cppu::OTypeCollection aTypeCollection2 TYPES_SECOND ; \ + /* Copy all items from both sequences to one result list! */ \ + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > seqTypes1 = aTypeCollection1.getTypes(); \ + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > seqTypes2 = aTypeCollection2.getTypes(); \ + sal_Int32 nCount1 = seqTypes1.getLength(); \ + sal_Int32 nCount2 = seqTypes2.getLength(); \ + static ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > seqResult ( nCount1+nCount2 ); \ + sal_Int32 nSource = 0; \ + sal_Int32 nDestination= 0; \ + while( nSource<nCount1 ) \ + { \ + seqResult[nDestination] = seqTypes1[nSource]; \ + ++nSource; \ + ++nDestination; \ + } \ + nSource = 0; \ + while( nSource<nCount2 ) \ + { \ + seqResult[nDestination] = seqTypes2[nSource]; \ + ++nSource; \ + ++nDestination; \ + } \ + /* ... and set his address to static pointer! */ \ + pTypeCollection = &seqResult; \ + } \ + } \ + return *pTypeCollection; \ + } + +//***************************************************************************************************************** +// private +// implementation of XTypeProvider::getTypes() with using max. 12 interfaces + baseclass! +//***************************************************************************************************************** +#define PRIVATE_DEFINE_XTYPEPROVIDER_GETTYPES_BASECLASS( CLASS, BASECLASS, TYPES ) \ + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL CLASS::getTypes() throw( ::com::sun::star::uno::RuntimeException ) \ + { \ + /* Optimize this method ! */ \ + /* We initialize a static variable only one time. */ \ + /* And we don't must use a mutex at every call! */ \ + /* For the first call; pTypeCollection is NULL - */ \ + /* for the second call pTypeCollection is different from NULL! */ \ + static ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >* pTypeCollection = NULL ; \ + if ( pTypeCollection == NULL ) \ + { \ + /* Ready for multithreading; get global mutex for first call of this method only! see before */ \ + ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); \ + /* Control these pointer again ... it can be, that another instance will be faster then these! */ \ + if ( pTypeCollection == NULL ) \ + { \ + /* Create static typecollection for my own interfaces! */ \ + static ::cppu::OTypeCollection aTypeCollection TYPES ; \ + /* Copy all items from my list sequences and from my baseclass */ \ + /* to one result list! */ \ + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > seqTypes1 = aTypeCollection.getTypes(); \ + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > seqTypes2 = BASECLASS::getTypes(); \ + sal_Int32 nCount1 = seqTypes1.getLength(); \ + sal_Int32 nCount2 = seqTypes2.getLength(); \ + static ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > seqResult ( nCount1+nCount2 ); \ + sal_Int32 nSource = 0; \ + sal_Int32 nDestination= 0; \ + while( nSource<nCount1 ) \ + { \ + seqResult[nDestination] = seqTypes1[nSource]; \ + ++nSource; \ + ++nDestination; \ + } \ + nSource = 0; \ + while( nSource<nCount2 ) \ + { \ + seqResult[nDestination] = seqTypes2[nSource]; \ + ++nSource; \ + ++nDestination; \ + } \ + /* ... and set his address to static pointer! */ \ + pTypeCollection = &seqResult; \ + } \ + } \ + return *pTypeCollection; \ + } + +//***************************************************************************************************************** +// private +// help macros to replace TYPES in getTypes() [see before] +//***************************************************************************************************************** +#define PRIVATE_DEFINE_TYPE_1( TYPE1 ) \ + ::getCppuType(( const ::com::sun::star::uno::Reference< TYPE1 >*)NULL ) + +#define PRIVATE_DEFINE_TYPE_2( TYPE1, TYPE2 ) \ + PRIVATE_DEFINE_TYPE_1( TYPE1 ), \ + ::getCppuType(( const ::com::sun::star::uno::Reference< TYPE2 >*)NULL ) + +#define PRIVATE_DEFINE_TYPE_3( TYPE1, TYPE2, TYPE3 ) \ + PRIVATE_DEFINE_TYPE_2( TYPE1, TYPE2 ), \ + ::getCppuType(( const ::com::sun::star::uno::Reference< TYPE3 >*)NULL ) + +#define PRIVATE_DEFINE_TYPE_4( TYPE1, TYPE2, TYPE3, TYPE4 ) \ + PRIVATE_DEFINE_TYPE_3( TYPE1, TYPE2, TYPE3 ), \ + ::getCppuType(( const ::com::sun::star::uno::Reference< TYPE4 >*)NULL ) + +#define PRIVATE_DEFINE_TYPE_5( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5 ) \ + PRIVATE_DEFINE_TYPE_4( TYPE1, TYPE2, TYPE3, TYPE4 ), \ + ::getCppuType(( const ::com::sun::star::uno::Reference< TYPE5 >*)NULL ) + +#define PRIVATE_DEFINE_TYPE_6( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6 ) \ + PRIVATE_DEFINE_TYPE_5( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5 ), \ + ::getCppuType(( const ::com::sun::star::uno::Reference< TYPE6 >*)NULL ) + +#define PRIVATE_DEFINE_TYPE_7( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7 ) \ + PRIVATE_DEFINE_TYPE_6( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6 ), \ + ::getCppuType(( const ::com::sun::star::uno::Reference< TYPE7 >*)NULL ) + +#define PRIVATE_DEFINE_TYPE_8( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8 ) \ + PRIVATE_DEFINE_TYPE_7( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7 ), \ + ::getCppuType(( const ::com::sun::star::uno::Reference< TYPE8 >*)NULL ) + +#define PRIVATE_DEFINE_TYPE_9( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9 ) \ + PRIVATE_DEFINE_TYPE_8( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8 ), \ + ::getCppuType(( const ::com::sun::star::uno::Reference< TYPE9 >*)NULL ) + +#define PRIVATE_DEFINE_TYPE_10( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10 ) \ + PRIVATE_DEFINE_TYPE_9( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9 ), \ + ::getCppuType(( const ::com::sun::star::uno::Reference< TYPE10 >*)NULL ) + +#define PRIVATE_DEFINE_TYPE_11( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10, TYPE11 ) \ + PRIVATE_DEFINE_TYPE_10( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10 ), \ + ::getCppuType(( const ::com::sun::star::uno::Reference< TYPE11 >*)NULL ) + +#define PRIVATE_DEFINE_TYPE_12( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10, TYPE11, TYPE12 ) \ + PRIVATE_DEFINE_TYPE_11( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10, TYPE11 ), \ + ::getCppuType(( const ::com::sun::star::uno::Reference< TYPE12 >*)NULL ) + +//***************************************************************************************************************** +// private +// complete implementation of XTypeProvider +//***************************************************************************************************************** +#define PRIVATE_DEFINE_XTYPEPROVIDER_PURE( CLASS ) \ + PRIVATE_DEFINE_XTYPEPROVIDER_GETIMPLEMENTATIONID( CLASS ) \ + PRIVATE_DEFINE_XTYPEPROVIDER_GETTYPES( CLASS, ::getCppuType(( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XTypeProvider >*)NULL ) ) + +#define PRIVATE_DEFINE_XTYPEPROVIDER( CLASS, TYPES ) \ + PRIVATE_DEFINE_XTYPEPROVIDER_GETIMPLEMENTATIONID( CLASS ) \ + PRIVATE_DEFINE_XTYPEPROVIDER_GETTYPES( CLASS, TYPES ) + +#define PRIVATE_DEFINE_XTYPEPROVIDER_LARGE( CLASS, TYPES_FIRST, TYPES_SECOND ) \ + PRIVATE_DEFINE_XTYPEPROVIDER_GETIMPLEMENTATIONID( CLASS ) \ + PRIVATE_DEFINE_XTYPEPROVIDER_GETTYPES_LARGE( CLASS, TYPES_FIRST, TYPES_SECOND ) + +#define PRIVATE_DEFINE_XTYPEPROVIDER_BASECLASS( CLASS, BASECLASS, TYPES ) \ + PRIVATE_DEFINE_XTYPEPROVIDER_GETIMPLEMENTATIONID( CLASS ) \ + PRIVATE_DEFINE_XTYPEPROVIDER_GETTYPES_BASECLASS( CLASS, BASECLASS, TYPES ) + +//***************************************************************************************************************** +// public +// declaration of XTypeProvider +//***************************************************************************************************************** +#define FWK_DECLARE_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 ); + +//***************************************************************************************************************** +// public +// implementation of XTypeProvider +//***************************************************************************************************************** +// implementation of XTypeProvider without additional interface for getTypes() +// XTypeProvider is used as the only one interface automaticly. +// Following defines don't use XTypeProvider automaticly!!!! +#define DEFINE_XTYPEPROVIDER_0( CLASS ) \ + PRIVATE_DEFINE_XTYPEPROVIDER_PURE( CLASS ) + +// implementation of XTypeProvider with 1 additional interface for getTypes() +#define DEFINE_XTYPEPROVIDER_1( CLASS, TYPE1 ) \ + PRIVATE_DEFINE_XTYPEPROVIDER ( CLASS, \ + (PRIVATE_DEFINE_TYPE_1 ( TYPE1 \ + )) \ + ) + +// implementation of XTypeProvider with 2 additional interfaces for getTypes() +#define DEFINE_XTYPEPROVIDER_2( CLASS, TYPE1, TYPE2 ) \ + PRIVATE_DEFINE_XTYPEPROVIDER ( CLASS, \ + (PRIVATE_DEFINE_TYPE_2 ( TYPE1 , \ + TYPE2 \ + )) \ + ) + +// implementation of XTypeProvider with 3 additional interfaces for getTypes() +#define DEFINE_XTYPEPROVIDER_3( CLASS, TYPE1, TYPE2, TYPE3 ) \ + PRIVATE_DEFINE_XTYPEPROVIDER ( CLASS, \ + (PRIVATE_DEFINE_TYPE_3 ( TYPE1 , \ + TYPE2 , \ + TYPE3 \ + )) \ + ) + +// implementation of XTypeProvider with 4 additional interfaces for getTypes() +#define DEFINE_XTYPEPROVIDER_4( CLASS, TYPE1, TYPE2, TYPE3, TYPE4 ) \ + PRIVATE_DEFINE_XTYPEPROVIDER ( CLASS, \ + (PRIVATE_DEFINE_TYPE_4 ( TYPE1 , \ + TYPE2 , \ + TYPE3 , \ + TYPE4 \ + )) \ + ) + +// implementation of XTypeProvider with 5 additional interfaces for getTypes() +#define DEFINE_XTYPEPROVIDER_5( CLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5 ) \ + PRIVATE_DEFINE_XTYPEPROVIDER ( CLASS, \ + (PRIVATE_DEFINE_TYPE_5 ( TYPE1 , \ + TYPE2 , \ + TYPE3 , \ + TYPE4 , \ + TYPE5 \ + )) \ + ) + +// implementation of XTypeProvider with 6 additional interfaces for getTypes() +#define DEFINE_XTYPEPROVIDER_6( CLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6 ) \ + PRIVATE_DEFINE_XTYPEPROVIDER ( CLASS, \ + (PRIVATE_DEFINE_TYPE_6 ( TYPE1 , \ + TYPE2 , \ + TYPE3 , \ + TYPE4 , \ + TYPE5 , \ + TYPE6 \ + )) \ + ) + +// implementation of XTypeProvider with 7 additional interfaces for getTypes() +#define DEFINE_XTYPEPROVIDER_7( CLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7 ) \ + PRIVATE_DEFINE_XTYPEPROVIDER ( CLASS, \ + (PRIVATE_DEFINE_TYPE_7 ( TYPE1 , \ + TYPE2 , \ + TYPE3 , \ + TYPE4 , \ + TYPE5 , \ + TYPE6 , \ + TYPE7 \ + )) \ + ) + +// implementation of XTypeProvider with 8 additional interfaces for getTypes() +#define DEFINE_XTYPEPROVIDER_8( CLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8 ) \ + PRIVATE_DEFINE_XTYPEPROVIDER ( CLASS, \ + (PRIVATE_DEFINE_TYPE_8 ( TYPE1 , \ + TYPE2 , \ + TYPE3 , \ + TYPE4 , \ + TYPE5 , \ + TYPE6 , \ + TYPE7 , \ + TYPE8 \ + )) \ + ) + +// implementation of XTypeProvider with 9 additional interfaces for getTypes() +#define DEFINE_XTYPEPROVIDER_9( CLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9 ) \ + PRIVATE_DEFINE_XTYPEPROVIDER ( CLASS, \ + (PRIVATE_DEFINE_TYPE_9 ( TYPE1 , \ + TYPE2 , \ + TYPE3 , \ + TYPE4 , \ + TYPE5 , \ + TYPE6 , \ + TYPE7 , \ + TYPE8 , \ + TYPE9 \ + )) \ + ) + +// implementation of XTypeProvider with 10 additional interfaces for getTypes() +#define DEFINE_XTYPEPROVIDER_10( CLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10 ) \ + PRIVATE_DEFINE_XTYPEPROVIDER ( CLASS, \ + (PRIVATE_DEFINE_TYPE_10 ( TYPE1 , \ + TYPE2 , \ + TYPE3 , \ + TYPE4 , \ + TYPE5 , \ + TYPE6 , \ + TYPE7 , \ + TYPE8 , \ + TYPE9 , \ + TYPE10 \ + )) \ + ) + +// implementation of XTypeProvider with 11 additional interfaces for getTypes() +#define DEFINE_XTYPEPROVIDER_11( CLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10, TYPE11 ) \ + PRIVATE_DEFINE_XTYPEPROVIDER ( CLASS, \ + (PRIVATE_DEFINE_TYPE_11 ( TYPE1 , \ + TYPE2 , \ + TYPE3 , \ + TYPE4 , \ + TYPE5 , \ + TYPE6 , \ + TYPE7 , \ + TYPE8 , \ + TYPE9 , \ + TYPE10 , \ + TYPE11 \ + )) \ + ) + +// implementation of XTypeProvider with 12 additional interfaces for getTypes() +#define DEFINE_XTYPEPROVIDER_12( CLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10, TYPE11, TYPE12 ) \ + PRIVATE_DEFINE_XTYPEPROVIDER ( CLASS, \ + (PRIVATE_DEFINE_TYPE_12 ( TYPE1 , \ + TYPE2 , \ + TYPE3 , \ + TYPE4 , \ + TYPE5 , \ + TYPE6 , \ + TYPE7 , \ + TYPE8 , \ + TYPE9 , \ + TYPE10 , \ + TYPE11 , \ + TYPE12 \ + )) \ + ) + +// implementation of XTypeProvider with 13 additional interfaces for getTypes() +#define DEFINE_XTYPEPROVIDER_13( CLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10, TYPE11, TYPE12, TYPE13 ) \ + PRIVATE_DEFINE_XTYPEPROVIDER_LARGE ( CLASS, \ + (PRIVATE_DEFINE_TYPE_12 ( TYPE1 , \ + TYPE2 , \ + TYPE3 , \ + TYPE4 , \ + TYPE5 , \ + TYPE6 , \ + TYPE7 , \ + TYPE8 , \ + TYPE9 , \ + TYPE10 , \ + TYPE11 , \ + TYPE12 \ + )), \ + (PRIVATE_DEFINE_TYPE_1 ( TYPE13 \ + )) \ + ) + +// implementation of XTypeProvider with 14 additional interfaces for getTypes() +#define DEFINE_XTYPEPROVIDER_14( CLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10, TYPE11, TYPE12, TYPE13, TYPE14 ) \ + PRIVATE_DEFINE_XTYPEPROVIDER_LARGE ( CLASS, \ + (PRIVATE_DEFINE_TYPE_12 ( TYPE1 , \ + TYPE2 , \ + TYPE3 , \ + TYPE4 , \ + TYPE5 , \ + TYPE6 , \ + TYPE7 , \ + TYPE8 , \ + TYPE9 , \ + TYPE10 , \ + TYPE11 , \ + TYPE12 \ + )), \ + (PRIVATE_DEFINE_TYPE_2 ( TYPE13 , \ + TYPE14 \ + )) \ + ) + +// implementation of XTypeProvider with 15 additional interfaces for getTypes() +#define DEFINE_XTYPEPROVIDER_15( CLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10, TYPE11, TYPE12, TYPE13, TYPE14, TYPE15 ) \ + PRIVATE_DEFINE_XTYPEPROVIDER_LARGE ( CLASS, \ + (PRIVATE_DEFINE_TYPE_12 ( TYPE1 , \ + TYPE2 , \ + TYPE3 , \ + TYPE4 , \ + TYPE5 , \ + TYPE6 , \ + TYPE7 , \ + TYPE8 , \ + TYPE9 , \ + TYPE10 , \ + TYPE11 , \ + TYPE12 \ + )), \ + (PRIVATE_DEFINE_TYPE_3 ( TYPE13 , \ + TYPE14 , \ + TYPE15 \ + )) \ + ) + +// implementation of XTypeProvider with 16 additional interfaces for getTypes() +#define DEFINE_XTYPEPROVIDER_16( CLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10, TYPE11, TYPE12, TYPE13, TYPE14, TYPE15, TYPE16 ) \ + PRIVATE_DEFINE_XTYPEPROVIDER_LARGE ( CLASS, \ + (PRIVATE_DEFINE_TYPE_12 ( TYPE1 , \ + TYPE2 , \ + TYPE3 , \ + TYPE4 , \ + TYPE5 , \ + TYPE6 , \ + TYPE7 , \ + TYPE8 , \ + TYPE9 , \ + TYPE10 , \ + TYPE11 , \ + TYPE12 \ + )), \ + (PRIVATE_DEFINE_TYPE_4 ( TYPE13 , \ + TYPE14 , \ + TYPE15 , \ + TYPE16 \ + )) \ + ) + +// implementation of XTypeProvider with 17 additional interfaces for getTypes() +#define DEFINE_XTYPEPROVIDER_17( CLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10, TYPE11, TYPE12, TYPE13, TYPE14, TYPE15, TYPE16, TYPE17 ) \ + PRIVATE_DEFINE_XTYPEPROVIDER_LARGE ( CLASS, \ + (PRIVATE_DEFINE_TYPE_12 ( TYPE1 , \ + TYPE2 , \ + TYPE3 , \ + TYPE4 , \ + TYPE5 , \ + TYPE6 , \ + TYPE7 , \ + TYPE8 , \ + TYPE9 , \ + TYPE10 , \ + TYPE11 , \ + TYPE12 \ + )), \ + (PRIVATE_DEFINE_TYPE_5 ( TYPE13 , \ + TYPE14 , \ + TYPE15 , \ + TYPE16 , \ + TYPE17 \ + )) \ + ) + +// implementation of XTypeProvider with 18 additional interfaces for getTypes() +#define DEFINE_XTYPEPROVIDER_18( CLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10, TYPE11, TYPE12, TYPE13, TYPE14, TYPE15, TYPE16, TYPE17, TYPE18 ) \ + PRIVATE_DEFINE_XTYPEPROVIDER_LARGE ( CLASS, \ + (PRIVATE_DEFINE_TYPE_12 ( TYPE1 , \ + TYPE2 , \ + TYPE3 , \ + TYPE4 , \ + TYPE5 , \ + TYPE6 , \ + TYPE7 , \ + TYPE8 , \ + TYPE9 , \ + TYPE10 , \ + TYPE11 , \ + TYPE12 \ + )), \ + (PRIVATE_DEFINE_TYPE_6 ( TYPE13 , \ + TYPE14 , \ + TYPE15 , \ + TYPE16 , \ + TYPE17 , \ + TYPE18 \ + )) \ + ) + +// implementation of XTypeProvider with 19 additional interfaces for getTypes() +#define DEFINE_XTYPEPROVIDER_19( CLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10, TYPE11, TYPE12, TYPE13, TYPE14, TYPE15, TYPE16, TYPE17, TYPE18, TYPE19 ) \ + PRIVATE_DEFINE_XTYPEPROVIDER_LARGE ( CLASS, \ + (PRIVATE_DEFINE_TYPE_12 ( TYPE1 , \ + TYPE2 , \ + TYPE3 , \ + TYPE4 , \ + TYPE5 , \ + TYPE6 , \ + TYPE7 , \ + TYPE8 , \ + TYPE9 , \ + TYPE10 , \ + TYPE11 , \ + TYPE12 \ + )), \ + (PRIVATE_DEFINE_TYPE_7 ( TYPE13 , \ + TYPE14 , \ + TYPE15 , \ + TYPE16 , \ + TYPE17 , \ + TYPE18 , \ + TYPE19 \ + )) \ + ) + +// implementation of XTypeProvider with 20 additional interfaces for getTypes() +#define DEFINE_XTYPEPROVIDER_20( CLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10, TYPE11, TYPE12, TYPE13, TYPE14, TYPE15, TYPE16, TYPE17, TYPE18, TYPE19, TYPE20 ) \ + PRIVATE_DEFINE_XTYPEPROVIDER_LARGE ( CLASS, \ + (PRIVATE_DEFINE_TYPE_12 ( TYPE1 , \ + TYPE2 , \ + TYPE3 , \ + TYPE4 , \ + TYPE5 , \ + TYPE6 , \ + TYPE7 , \ + TYPE8 , \ + TYPE9 , \ + TYPE10 , \ + TYPE11 , \ + TYPE12 \ + )), \ + (PRIVATE_DEFINE_TYPE_8 ( TYPE13 , \ + TYPE14 , \ + TYPE15 , \ + TYPE16 , \ + TYPE17 , \ + TYPE18 , \ + TYPE19 , \ + TYPE20 \ + )) \ + ) + +// implementation of XTypeProvider with 1 additional interface for getTypes() AND using 1 baseclass +#define DEFINE_XTYPEPROVIDER_1_WITH_BASECLASS( CLASS, BASECLASS, TYPE1 ) \ + PRIVATE_DEFINE_XTYPEPROVIDER_BASECLASS ( CLASS, \ + BASECLASS, \ + (PRIVATE_DEFINE_TYPE_1 ( TYPE1 \ + )) \ + ) + +// implementation of XTypeProvider with 2 additional interface for getTypes() AND using 1 baseclass +#define DEFINE_XTYPEPROVIDER_2_WITH_BASECLASS( CLASS, BASECLASS, TYPE1, TYPE2 ) \ + PRIVATE_DEFINE_XTYPEPROVIDER_BASECLASS ( CLASS, \ + BASECLASS, \ + (PRIVATE_DEFINE_TYPE_2 ( TYPE1 , \ + TYPE2 \ + )) \ + ) + +// implementation of XTypeProvider with 3 additional interface for getTypes() AND using 1 baseclass +#define DEFINE_XTYPEPROVIDER_3_WITH_BASECLASS( CLASS, BASECLASS, TYPE1, TYPE2, TYPE3 ) \ + PRIVATE_DEFINE_XTYPEPROVIDER_BASECLASS ( CLASS, \ + BASECLASS, \ + (PRIVATE_DEFINE_TYPE_3 ( TYPE1 , \ + TYPE2 , \ + TYPE3 \ + )) \ + ) +// implementation of XTypeProvider with 4 additional interface for getTypes() AND using 1 baseclass +#define DEFINE_XTYPEPROVIDER_4_WITH_BASECLASS( CLASS, BASECLASS, TYPE1, TYPE2, TYPE3, TYPE4 ) \ + PRIVATE_DEFINE_XTYPEPROVIDER_BASECLASS ( CLASS, \ + BASECLASS, \ + (PRIVATE_DEFINE_TYPE_4 ( TYPE1 , \ + TYPE2 , \ + TYPE3 , \ + TYPE4 \ + )) \ + ) +// implementation of XTypeProvider with 5 additional interface for getTypes() AND using 1 baseclass +#define DEFINE_XTYPEPROVIDER_5_WITH_BASECLASS( CLASS, BASECLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5 ) \ + PRIVATE_DEFINE_XTYPEPROVIDER_BASECLASS ( CLASS, \ + BASECLASS, \ + (PRIVATE_DEFINE_TYPE_5 ( TYPE1 , \ + TYPE2 , \ + TYPE3 , \ + TYPE4 , \ + TYPE5 \ + )) \ + ) + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_MACROS_XTYPEPROVIDER_HXX_ diff --git a/framework/inc/mediadescriptor.h b/framework/inc/mediadescriptor.h new file mode 100644 index 000000000000..278f13463ae7 --- /dev/null +++ b/framework/inc/mediadescriptor.h @@ -0,0 +1,77 @@ +/************************************************************************* + * + * 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_MEDIADESCRIPTOR_H_ +#define __FRAMEWORK_MEDIADESCRIPTOR_H_ + +//_______________________________________________ +// namespace + +namespace framework{ + +//static const ::rtl::OUString MEDIADESCRIPTOR_ASTEMPLATE = ::rtl::OUString::createFromAscii("AsTemplate" ); +//static const ::rtl::OUString MEDIADESCRIPTOR_CHARACTERSET = ::rtl::OUString::createFromAscii("CharacterSet" ); +//static const ::rtl::OUString MEDIADESCRIPTOR_DEEPDETECTION = ::rtl::OUString::createFromAscii("DeepDetection" ); +//static const ::rtl::OUString MEDIADESCRIPTOR_DETECTSERVICE = ::rtl::OUString::createFromAscii("DetectService" ); +//static const ::rtl::OUString MEDIADESCRIPTOR_EXTENSION = ::rtl::OUString::createFromAscii("Extension" ); +//static const ::rtl::OUString MEDIADESCRIPTOR_FILENAME = ::rtl::OUString::createFromAscii("FileName" ); // deprecated! +//static const ::rtl::OUString MEDIADESCRIPTOR_FILTERNAME = ::rtl::OUString::createFromAscii("FilterName" ); +//static const ::rtl::OUString MEDIADESCRIPTOR_FILTEROPTIONS = ::rtl::OUString::createFromAscii("FilterOptions" ); +//static const ::rtl::OUString MEDIADESCRIPTOR_FORMAT = ::rtl::OUString::createFromAscii("Format" ); +//static const ::rtl::OUString MEDIADESCRIPTOR_FRAMENAME = ::rtl::OUString::createFromAscii("FrameName" ); +//static const ::rtl::OUString MEDIADESCRIPTOR_HIDDEN = ::rtl::OUString::createFromAscii("Hidden" ); +//static const ::rtl::OUString MEDIADESCRIPTOR_INPUTSTREAM = ::rtl::OUString::createFromAscii("InputStream" ); +//static const ::rtl::OUString MEDIADESCRIPTOR_INTERACTIONHANDLER = ::rtl::OUString::createFromAscii("InteractionHandler"); +//static const ::rtl::OUString MEDIADESCRIPTOR_JUMPMARK = ::rtl::OUString::createFromAscii("JumpMark" ); +//static const ::rtl::OUString MEDIADESCRIPTOR_MACROEXECUTIONMODE = ::rtl::OUString::createFromAscii("MacroExecutionMode"); +//static const ::rtl::OUString MEDIADESCRIPTOR_MEDIATYPE = ::rtl::OUString::createFromAscii("MediaType" ); +//static const ::rtl::OUString MEDIADESCRIPTOR_MINIMIZED = ::rtl::OUString::createFromAscii("Minimized" ); +//static const ::rtl::OUString MEDIADESCRIPTOR_OPENNEWVIEW = ::rtl::OUString::createFromAscii("OpenNewView" ); +//static const ::rtl::OUString MEDIADESCRIPTOR_OUTPUTSTREAM = ::rtl::OUString::createFromAscii("OutputStream" ); +//static const ::rtl::OUString MEDIADESCRIPTOR_PATTERN = ::rtl::OUString::createFromAscii("Pattern" ); +//static const ::rtl::OUString MEDIADESCRIPTOR_POSSIZE = ::rtl::OUString::createFromAscii("PosSize" ); +//static const ::rtl::OUString MEDIADESCRIPTOR_POSTDATA = ::rtl::OUString::createFromAscii("PostData" ); +//static const ::rtl::OUString MEDIADESCRIPTOR_POSTSTRING = ::rtl::OUString::createFromAscii("PostString" ); +//static const ::rtl::OUString MEDIADESCRIPTOR_PREVIEW = ::rtl::OUString::createFromAscii("Preview" ); +//static const ::rtl::OUString MEDIADESCRIPTOR_READONLY = ::rtl::OUString::createFromAscii("ReadOnly" ); +//static const ::rtl::OUString MEDIADESCRIPTOR_REFERRER = ::rtl::OUString::createFromAscii("Referer" ); +//static const ::rtl::OUString MEDIADESCRIPTOR_SILENT = ::rtl::OUString::createFromAscii("Silent" ); +//static const ::rtl::OUString MEDIADESCRIPTOR_STATUSINDICATOR = ::rtl::OUString::createFromAscii("StatusIndicator" ); +//static const ::rtl::OUString MEDIADESCRIPTOR_TEMPLATENAME = ::rtl::OUString::createFromAscii("TemplateName" ); +//static const ::rtl::OUString MEDIADESCRIPTOR_TEMPLATEREGIONNAME = ::rtl::OUString::createFromAscii("TemplateRegionName"); +//static const ::rtl::OUString MEDIADESCRIPTOR_TYPENAME = ::rtl::OUString::createFromAscii("TypeName" ); +//static const ::rtl::OUString MEDIADESCRIPTOR_UPDATEDOCMODE = ::rtl::OUString::createFromAscii("UpdateDocMode" ); +//static const ::rtl::OUString MEDIADESCRIPTOR_URL = ::rtl::OUString::createFromAscii("URL" ); +//static const ::rtl::OUString MEDIADESCRIPTOR_VERSION = ::rtl::OUString::createFromAscii("Version" ); +//static const ::rtl::OUString MEDIADESCRIPTOR_VIEWID = ::rtl::OUString::createFromAscii("ViewId" ); +//static const ::rtl::OUString MEDIADESCRIPTOR_REPAIRPACKAGE = ::rtl::OUString::createFromAscii("RepairPackage" ); +//static const ::rtl::OUString MEDIADESCRIPTOR_DOCUMENTTITLE = ::rtl::OUString::createFromAscii("DocumentTitle" ); +//static const ::rtl::OUString MEDIADESCRIPTOR_MODEL = ::rtl::OUString::createFromAscii("Model" ); + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_MEDIADESCRIPTOR_H_ diff --git a/framework/inc/pch/precompiled_framework.cxx b/framework/inc/pch/precompiled_framework.cxx new file mode 100644 index 000000000000..0ce4985778a8 --- /dev/null +++ b/framework/inc/pch/precompiled_framework.cxx @@ -0,0 +1,29 @@ +/************************************************************************* + * + * 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. + * + ************************************************************************/ + +#include "precompiled_framework.hxx" + diff --git a/framework/inc/pch/precompiled_framework.hxx b/framework/inc/pch/precompiled_framework.hxx new file mode 100644 index 000000000000..b4afb017ebab --- /dev/null +++ b/framework/inc/pch/precompiled_framework.hxx @@ -0,0 +1,495 @@ +/************************************************************************* + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): Generated on 2006-09-01 17:49:44.077079 + +#ifdef PRECOMPILED_HEADERS + +//---MARKER--- +#include "sal/config.h" +#include "sal/types.h" + +#include "com/sun/star/awt/Command.hpp" +#include "com/sun/star/awt/DeviceInfo.hpp" +#include "com/sun/star/awt/FocusEvent.hpp" +#include "com/sun/star/awt/InvalidateStyle.hpp" +#include "com/sun/star/awt/Key.hpp" +#include "com/sun/star/awt/KeyEvent.hpp" +#include "com/sun/star/awt/KeyModifier.hpp" +#include "com/sun/star/awt/MenuItemStyle.hpp" +#include "com/sun/star/awt/Point.hpp" +#include "com/sun/star/awt/PosSize.hpp" +#include "com/sun/star/awt/Rectangle.hpp" +#include "com/sun/star/awt/Size.hpp" +#include "com/sun/star/awt/VclWindowPeerAttribute.hpp" +#include "com/sun/star/awt/WindowAttribute.hpp" +#include "com/sun/star/awt/WindowDescriptor.hpp" +#include "com/sun/star/awt/WindowEvent.hpp" +#include "com/sun/star/awt/XBitmap.hpp" +#include "com/sun/star/awt/XControl.hpp" +#include "com/sun/star/awt/XDataTransferProviderAccess.hpp" +#include "com/sun/star/awt/XDevice.hpp" +#include "com/sun/star/awt/XDialog.hpp" +#include "com/sun/star/awt/XDockableWindow.hpp" +#include "com/sun/star/awt/XDockableWindowListener.hpp" +#include "com/sun/star/awt/XFocusListener.hpp" +#include "com/sun/star/awt/XKeyListener.hpp" +#include "com/sun/star/awt/XLayoutConstrains.hpp" +#include "com/sun/star/awt/XMenuBar.hpp" +#include "com/sun/star/awt/XSimpleTabController.hpp" +#include "com/sun/star/awt/XSystemDependentMenuPeer.hpp" +#include "com/sun/star/awt/XSystemDependentWindowPeer.hpp" +#include "com/sun/star/awt/XTabListener.hpp" +#include "com/sun/star/awt/XToolkit.hpp" +#include "com/sun/star/awt/XTopWindow.hpp" +#include "com/sun/star/awt/XTopWindowListener.hpp" +#include "com/sun/star/awt/XVclWindowPeer.hpp" +#include "com/sun/star/awt/XWindow.hpp" +#include "com/sun/star/awt/XWindow2.hpp" +#include "com/sun/star/awt/XWindowListener.hpp" +#include "com/sun/star/awt/XWindowPeer.hpp" +#include "com/sun/star/beans/NamedValue.hpp" +#include "com/sun/star/beans/Property.hpp" +#include "com/sun/star/beans/PropertyAttribute.hpp" +#include "com/sun/star/beans/PropertyExistException.hpp" +#include "com/sun/star/beans/PropertyState.hpp" +#include "com/sun/star/beans/PropertyValue.hpp" +#include "com/sun/star/beans/UnknownPropertyException.hpp" +#include "com/sun/star/beans/XFastPropertySet.hpp" +#include "com/sun/star/beans/XMaterialHolder.hpp" +#include "com/sun/star/beans/XMultiHierarchicalPropertySet.hpp" +#include "com/sun/star/beans/XMultiPropertySet.hpp" +#include "com/sun/star/beans/XProperty.hpp" +#include "com/sun/star/beans/XPropertySet.hpp" +#include "com/sun/star/beans/XPropertySetInfo.hpp" +#include "com/sun/star/bridge/XBridgeFactory.hpp" +#include "com/sun/star/bridge/XInstanceProvider.hpp" +#include "com/sun/star/connection/XConnection.hpp" +#include "com/sun/star/container/ElementExistException.hpp" +#include "com/sun/star/container/NoSuchElementException.hpp" +#include "com/sun/star/container/XContainer.hpp" +#include "com/sun/star/container/XContainerListener.hpp" +#include "com/sun/star/container/XContainerQuery.hpp" +#include "com/sun/star/container/XContentEnumerationAccess.hpp" +#include "com/sun/star/container/XElementAccess.hpp" +#include "com/sun/star/container/XEnumeration.hpp" +#include "com/sun/star/container/XEnumerationAccess.hpp" +#include "com/sun/star/container/XHierarchicalNameAccess.hpp" +#include "com/sun/star/container/XIndexAccess.hpp" +#include "com/sun/star/container/XIndexContainer.hpp" +#include "com/sun/star/container/XIndexReplace.hpp" +#include "com/sun/star/container/XNameAccess.hpp" +#include "com/sun/star/container/XNameContainer.hpp" +#include "com/sun/star/container/XNameReplace.hpp" +#include "com/sun/star/container/XSet.hpp" +#include "com/sun/star/datatransfer/dnd/DNDConstants.hpp" +#include "com/sun/star/datatransfer/dnd/XDropTarget.hpp" +#include "com/sun/star/datatransfer/dnd/XDropTargetListener.hpp" +#include "com/sun/star/document/AmbigousFilterRequest.hpp" +#include "com/sun/star/document/CorruptedFilterConfigurationException.hpp" +#include "com/sun/star/document/MacroExecMode.hpp" +#include "com/sun/star/document/NoSuchFilterRequest.hpp" +#include "com/sun/star/document/UpdateDocMode.hpp" +#include "com/sun/star/document/XActionLockable.hpp" +#include "com/sun/star/document/XDocumentInfoSupplier.hpp" +#include "com/sun/star/document/XEventBroadcaster.hpp" +#include "com/sun/star/document/XEventListener.hpp" +#include "com/sun/star/document/XExtendedFilterDetection.hpp" +#include "com/sun/star/document/XInteractionFilterSelect.hpp" +#include "com/sun/star/document/XTypeDetection.hpp" +#include "com/sun/star/embed/ElementModes.hpp" +#include "com/sun/star/embed/VerbAttributes.hpp" +#include "com/sun/star/embed/VerbDescriptor.hpp" +#include "com/sun/star/embed/XPackageStructureCreator.hpp" +#include "com/sun/star/embed/XStorage.hpp" +#include "com/sun/star/embed/XTransactedObject.hpp" +#include "com/sun/star/form/XReset.hpp" +#include "com/sun/star/frame/CommandGroup.hpp" +#include "com/sun/star/frame/ControlCommand.hpp" +#include "com/sun/star/frame/DispatchDescriptor.hpp" +#include "com/sun/star/frame/DispatchResultEvent.hpp" +#include "com/sun/star/frame/DispatchResultState.hpp" +#include "com/sun/star/frame/DispatchStatement.hpp" +#include "com/sun/star/frame/FeatureStateEvent.hpp" +#include "com/sun/star/frame/FrameAction.hpp" +#include "com/sun/star/frame/FrameSearchFlag.hpp" +#include "com/sun/star/frame/LayoutManagerEvents.hpp" +#include "com/sun/star/frame/TerminationVetoException.hpp" +#include "com/sun/star/frame/WindowArrange.hpp" +#include "com/sun/star/frame/XComponentLoader.hpp" +#include "com/sun/star/frame/XConfigManager.hpp" +#include "com/sun/star/frame/XControlNotificationListener.hpp" +#include "com/sun/star/frame/XController.hpp" +#include "com/sun/star/frame/XDesktop.hpp" +#include "com/sun/star/frame/XDispatch.hpp" +#include "com/sun/star/frame/XDispatchHelper.hpp" +#include "com/sun/star/frame/XDispatchInformationProvider.hpp" +#include "com/sun/star/frame/XDispatchProvider.hpp" +#include "com/sun/star/frame/XDispatchProviderInterception.hpp" +#include "com/sun/star/frame/XDispatchProviderInterceptor.hpp" +#include "com/sun/star/frame/XDispatchRecorder.hpp" +#include "com/sun/star/frame/XDispatchRecorderSupplier.hpp" +#include "com/sun/star/frame/XDispatchResultListener.hpp" +#include "com/sun/star/frame/XFrame.hpp" +#include "com/sun/star/frame/XFrameActionListener.hpp" +#include "com/sun/star/frame/XFrameLoader.hpp" +#include "com/sun/star/frame/XFrames.hpp" +#include "com/sun/star/frame/XFramesSupplier.hpp" +#include "com/sun/star/frame/XInplaceLayout.hpp" +#include "com/sun/star/frame/XInterceptorInfo.hpp" +#include "com/sun/star/frame/XLayoutManager.hpp" +#include "com/sun/star/frame/XLayoutManagerEventBroadcaster.hpp" +#include "com/sun/star/frame/XLoadEventListener.hpp" +#include "com/sun/star/frame/XMenuBarMergingAcceptor.hpp" +#include "com/sun/star/frame/XModel.hpp" +#include "com/sun/star/frame/XModuleManager.hpp" +#include "com/sun/star/frame/XNotifyingDispatch.hpp" +#include "com/sun/star/frame/XPopupMenuController.hpp" +#include "com/sun/star/frame/XRecordableDispatch.hpp" +#include "com/sun/star/frame/XSessionManagerClient.hpp" +#include "com/sun/star/frame/XSessionManagerListener.hpp" +#include "com/sun/star/frame/XStatusListener.hpp" +#include "com/sun/star/frame/XStorable.hpp" +#include "com/sun/star/frame/XSubToolbarController.hpp" +#include "com/sun/star/frame/XSynchronousFrameLoader.hpp" +#include "com/sun/star/frame/XTask.hpp" +#include "com/sun/star/frame/XTasksSupplier.hpp" +#include "com/sun/star/frame/XTerminateListener.hpp" +#include "com/sun/star/frame/XToolbarController.hpp" +#include "com/sun/star/frame/XUIControllerRegistration.hpp" +#include "com/sun/star/frame/XWindowArranger.hpp" +#include "com/sun/star/frame/status/FontHeight.hpp" +#include "com/sun/star/frame/status/ItemState.hpp" +#include "com/sun/star/frame/status/ItemStatus.hpp" +#include "com/sun/star/frame/status/Verb.hpp" +#include "com/sun/star/frame/status/Visibility.hpp" +#include "com/sun/star/graphic/XGraphic.hpp" +#include "com/sun/star/io/IOException.hpp" +#include "com/sun/star/io/XActiveDataSource.hpp" +#include "com/sun/star/io/XInputStream.hpp" +#include "com/sun/star/io/XOutputStream.hpp" +#include "com/sun/star/io/XPersist.hpp" +#include "com/sun/star/io/XSeekable.hpp" +#include "com/sun/star/io/XStream.hpp" +#include "com/sun/star/io/XTruncate.hpp" +#include "com/sun/star/java/WrongJavaVersionException.hpp" +#include "com/sun/star/lang/DisposedException.hpp" +#include "com/sun/star/lang/EventObject.hpp" +#include "com/sun/star/lang/IllegalArgumentException.hpp" +#include "com/sun/star/lang/Locale.hpp" +#include "com/sun/star/lang/SystemDependent.hpp" +#include "com/sun/star/lang/WrappedTargetException.hpp" +#include "com/sun/star/lang/WrappedTargetRuntimeException.hpp" +#include "com/sun/star/lang/XComponent.hpp" +#include "com/sun/star/lang/XEventListener.hpp" +#include "com/sun/star/lang/XInitialization.hpp" +#include "com/sun/star/lang/XMultiComponentFactory.hpp" +#include "com/sun/star/lang/XMultiServiceFactory.hpp" +#include "com/sun/star/lang/XServiceInfo.hpp" +#include "com/sun/star/lang/XServiceName.hpp" +#include "com/sun/star/lang/XSingleComponentFactory.hpp" +#include "com/sun/star/lang/XSingleServiceFactory.hpp" +#include "com/sun/star/lang/XTypeProvider.hpp" +#include "com/sun/star/lang/XUnoTunnel.hpp" +#include "com/sun/star/mozilla/XPluginInstance.hpp" +#include "com/sun/star/mozilla/XPluginInstanceNotifySink.hpp" +#include "com/sun/star/mozilla/XPluginInstancePeer.hpp" +#include "com/sun/star/mozilla/XPluginWindowPeer.hpp" +#include "com/sun/star/registry/InvalidRegistryException.hpp" +#include "com/sun/star/registry/XRegistryKey.hpp" +#include "com/sun/star/registry/XSimpleRegistry.hpp" +#include "com/sun/star/script/XTypeConverter.hpp" +#include "com/sun/star/style/XStyleFamiliesSupplier.hpp" +#include "com/sun/star/sync2/BadPartnershipException.hpp" +#include "com/sun/star/system/SystemShellExecuteFlags.hpp" +#include "com/sun/star/system/XSystemShellExecute.hpp" +#include "com/sun/star/task/ErrorCodeRequest.hpp" +#include "com/sun/star/task/XAsyncJob.hpp" +#include "com/sun/star/task/XInteractionAbort.hpp" +#include "com/sun/star/task/XInteractionApprove.hpp" +#include "com/sun/star/task/XInteractionContinuation.hpp" +#include "com/sun/star/task/XInteractionDisapprove.hpp" +#include "com/sun/star/task/XInteractionHandler.hpp" +#include "com/sun/star/task/XInteractionRequest.hpp" +#include "com/sun/star/task/XInteractionRetry.hpp" +#include "com/sun/star/task/XJob.hpp" +#include "com/sun/star/task/XJobExecutor.hpp" +#include "com/sun/star/task/XJobListener.hpp" +#include "com/sun/star/task/XStatusIndicator.hpp" +#include "com/sun/star/task/XStatusIndicatorFactory.hpp" +#include "com/sun/star/task/XStatusIndicatorSupplier.hpp" +#include "com/sun/star/ucb/CommandAbortedException.hpp" +#include "com/sun/star/ucb/InteractiveAugmentedIOException.hpp" +#include "com/sun/star/ucb/InteractiveCHAOSException.hpp" +#include "com/sun/star/ucb/InteractiveIOException.hpp" +#include "com/sun/star/ucb/InteractiveNetworkException.hpp" +#include "com/sun/star/ucb/InteractiveWrongMediumException.hpp" +#include "com/sun/star/ucb/NameClash.hpp" +#include "com/sun/star/ucb/XContentProviderManager.hpp" +#include "com/sun/star/ui/ConfigurationEvent.hpp" +#include "com/sun/star/ui/DockingArea.hpp" +#include "com/sun/star/ui/ImageType.hpp" +#include "com/sun/star/ui/ItemStyle.hpp" +#include "com/sun/star/ui/ItemType.hpp" +#include "com/sun/star/ui/UIElementType.hpp" +#include "com/sun/star/ui/XAcceleratorConfiguration.hpp" +#include "com/sun/star/ui/XDockingAreaAcceptor.hpp" +#include "com/sun/star/ui/XImageManager.hpp" +#include "com/sun/star/ui/XModuleUIConfigurationManager.hpp" +#include "com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp" +#include "com/sun/star/ui/XUIConfiguration.hpp" +#include "com/sun/star/ui/XUIConfigurationListener.hpp" +#include "com/sun/star/ui/XUIConfigurationManager.hpp" +#include "com/sun/star/ui/XUIConfigurationManagerSupplier.hpp" +#include "com/sun/star/ui/XUIConfigurationPersistence.hpp" +#include "com/sun/star/ui/XUIConfigurationStorage.hpp" +#include "com/sun/star/ui/XUIElement.hpp" +#include "com/sun/star/ui/XUIElementFactory.hpp" +#include "com/sun/star/ui/XUIElementFactoryRegistration.hpp" +#include "com/sun/star/ui/XUIElementSettings.hpp" +#include "com/sun/star/ui/XUIFunctionListener.hpp" +#include "com/sun/star/uno/Any.h" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Exception.hpp" +#include "com/sun/star/uno/Reference.h" +#include "com/sun/star/uno/Reference.hxx" +#include "com/sun/star/uno/RuntimeException.hdl" +#include "com/sun/star/uno/RuntimeException.hpp" +#include "com/sun/star/uno/Sequence.h" +#include "com/sun/star/uno/Sequence.hxx" +#include "com/sun/star/uno/Type.hxx" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XInterface.hpp" +#include "com/sun/star/uri/XUriReference.hpp" +#include "com/sun/star/uri/XUriReferenceFactory.hpp" +#include "com/sun/star/util/CloseVetoException.hpp" +#include "com/sun/star/util/URL.hpp" +#include "com/sun/star/util/XChangesBatch.hpp" +#include "com/sun/star/util/XChangesListener.hpp" +#include "com/sun/star/util/XChangesNotifier.hpp" +#include "com/sun/star/util/XCloseBroadcaster.hpp" +#include "com/sun/star/util/XCloseListener.hpp" +#include "com/sun/star/util/XCloseable.hpp" +#include "com/sun/star/util/XFlushable.hpp" +#include "com/sun/star/util/XMacroExpander.hpp" +#include "com/sun/star/util/XModifiable.hpp" +#include "com/sun/star/util/XModifyListener.hpp" +#include "com/sun/star/util/XStringMapping.hpp" +#include "com/sun/star/util/XStringSubstitution.hpp" +#include "com/sun/star/util/XStringWidth.hpp" +#include "com/sun/star/util/XURLTransformer.hpp" +#include "com/sun/star/util/XUpdatable.hpp" +#include "com/sun/star/view/XPrintable.hpp" +#include "com/sun/star/xml/sax/InputSource.hpp" +#include "com/sun/star/xml/sax/SAXException.hpp" +#include "com/sun/star/xml/sax/XAttributeList.hpp" +#include "com/sun/star/xml/sax/XDocumentHandler.hpp" +#include "com/sun/star/xml/sax/XExtendedDocumentHandler.hpp" +#include "com/sun/star/xml/sax/XLocator.hpp" +#include "com/sun/star/xml/sax/XParser.hpp" + +#include "comphelper/broadcasthelper.hxx" +#include "comphelper/configurationhelper.hxx" +#include "comphelper/locale.hxx" +#include "comphelper/mediadescriptor.hxx" +#include "comphelper/processfactory.hxx" +#include "comphelper/regpathhelper.hxx" +#include "comphelper/sequence.hxx" +#include "comphelper/sequenceashashmap.hxx" +#include "comphelper/sequenceasvector.hxx" + +#include "cppuhelper/bootstrap.hxx" +#include "cppuhelper/factory.hxx" +#include "cppuhelper/implbase1.hxx" +#include "cppuhelper/implbase2.hxx" +#include "cppuhelper/interfacecontainer.h" +#include "cppuhelper/interfacecontainer.hxx" +#include "cppuhelper/propshlp.hxx" +#include "cppuhelper/queryinterface.hxx" +#include "cppuhelper/servicefactory.hxx" +#include "cppuhelper/typeprovider.hxx" +#include "cppuhelper/weak.hxx" +#include "cppuhelper/weakref.hxx" + +#include "i18npool/lang.h" +#include "i18npool/mslangid.hxx" + +#include "osl/conditn.hxx" +#include "osl/diagnose.h" +#include "osl/file.hxx" +#include "osl/interlck.h" +#include "osl/mutex.h" +#include "osl/mutex.hxx" +#include "osl/process.h" +#include "osl/security.hxx" +#include "osl/socket.hxx" +#include "osl/thread.h" +#include "osl/thread.hxx" +#include "osl/time.h" + +#include "recording/dispatchrecorder.hxx" +#include "recording/dispatchrecordersupplier.hxx" + +#include "rsc/rscsfx.hxx" + +#include "rtl/instance.hxx" +#include "rtl/logfile.hxx" +#include "rtl/random.h" +#include "rtl/strbuf.hxx" +#include "rtl/string.h" +#include "rtl/string.hxx" +#include "rtl/textenc.h" +#include "rtl/ustrbuf.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" + +#include "sal/alloca.h" +#include "sal/main.h" + +#include "salhelper/singletonref.hxx" + +#include "sot/exchange.hxx" +#include "sot/filelist.hxx" +#include "sot/storage.hxx" + +#include "svtools/acceleratorexecute.hxx" +#include "unotools/cmdoptions.hxx" +#include "svtools/colorcfg.hxx" +#include "svtools/ctrltool.hxx" +#include "unotools/dynamicmenuoptions.hxx" +#include "svtools/filter.hxx" +#include "svtools/framestatuslistener.hxx" +#include "svtools/helpopt.hxx" +#include "unotools/historyoptions.hxx" +#include "svl/imageitm.hxx" +#include "svtools/imgdef.hxx" +#include "svl/inettype.hxx" +#include "unotools/internaloptions.hxx" +#include "svl/lstner.hxx" +#include "svtools/menuoptions.hxx" +#include "svtools/miscopt.hxx" +#include "unotools/moduleoptions.hxx" +#include "unotools/pathoptions.hxx" +#include "svtools/sfxecode.hxx" +#include "svl/smplhint.hxx" +#include "svl/solar.hrc" +#include "svtools/statusbarcontroller.hxx" +#include "svl/svarray.hxx" +#include "svtools/svmedit.hxx" +#include "svtools/toolboxcontroller.hxx" +#include "svtools/transfer.hxx" +#include "svl/urihelper.hxx" +#include "svtools/xtextedt.hxx" + +#include "toolkit/awt/vclxmenu.hxx" +#include "toolkit/awt/vclxwindow.hxx" +#include "toolkit/helper/convert.hxx" +#include "toolkit/helper/vclunohelper.hxx" +#include "toolkit/unohlp.hxx" + +#include "tools/color.hxx" +#include "tools/config.hxx" +#include "tools/date.hxx" +#include "tools/datetime.hxx" +#include "tools/debug.hxx" +#include "tools/errinf.hxx" +#include "tools/link.hxx" +#include "tools/rc.h" +#include "tools/rcid.h" +#include "tools/resid.hxx" +#include "tools/resmgr.hxx" +#include "tools/solar.h" +#include "tools/stream.hxx" +#include "tools/string.hxx" +#include "tools/tempfile.hxx" +#include "tools/tenccvt.hxx" +#include "tools/time.hxx" +#include "tools/urlobj.hxx" +#include "tools/wldcrd.hxx" + +#include "typelib/typedescription.h" + +#include "ucbhelper/content.hxx" + +#include "unotools/bootstrap.hxx" +#include "unotools/configitem.hxx" +#include "unotools/configmgr.hxx" +#include "unotools/configpathes.hxx" +#include "unotools/intlwrapper.hxx" +#include "unotools/localfilehelper.hxx" +#include "unotools/processfactory.hxx" +#include "unotools/streamwrap.hxx" +#include "unotools/tempfile.hxx" +#include "unotools/ucbstreamhelper.hxx" + +#include "vcl/accel.hxx" +#include "vcl/bitmap.hxx" +#include "vcl/bitmapex.hxx" +#include "vcl/button.hxx" +#include "vcl/combobox.hxx" +#include "vcl/dockingarea.hxx" +#include "vcl/edit.hxx" +#include "vcl/event.hxx" +#include "vcl/evntpost.hxx" +#include "vcl/fixed.hxx" +#include "vcl/graph.hxx" +#include "vcl/help.hxx" +#include "vcl/i18nhelp.hxx" +#include "vcl/image.hxx" +#include "vcl/keycod.hxx" +#include "vcl/keycodes.hxx" +#include "vcl/lstbox.hxx" +#include "tools/mapunit.hxx" +#include "vcl/menu.hxx" +#include "vcl/mnemonic.hxx" +#include "vcl/morebtn.hxx" +#include "vcl/outdev.hxx" +#include "vcl/pngread.hxx" +#include "vcl/pngwrite.hxx" +#include "vcl/print.hxx" +#include "vcl/scrbar.hxx" +#include "vcl/sound.hxx" +#include "vcl/spinfld.hxx" +#include "vcl/status.hxx" +#include "vcl/svapp.hxx" +#include "vcl/tabctrl.hxx" +#include "vcl/taskpanelist.hxx" +#include "vcl/threadex.hxx" +#include "vcl/timer.hxx" +#include "vcl/wall.hxx" +#include "vcl/window.hxx" +#include "tools/wintypes.hxx" + +#include "vos/mutex.hxx" +#include "vos/process.hxx" +#include "vos/ref.hxx" +#include "vos/thread.hxx" +#include "vos/timer.hxx" + +//---MARKER--- +#endif + diff --git a/framework/inc/properties.h b/framework/inc/properties.h new file mode 100644 index 000000000000..df4489c4cd0a --- /dev/null +++ b/framework/inc/properties.h @@ -0,0 +1,354 @@ +/************************************************************************* + * + * 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_PROPERTIES_H_ +#define __FRAMEWORK_PROPERTIES_H_ + +//_______________________________________________ +// includes + +#include <macros/generic.hxx> +#include <general.h> + +//_______________________________________________ +// namespace + +namespace framework{ + +//_______________________________________________ +/** properties for "StatusIndicatorFactory" class */ + +#define STATUSINDICATORFACTORY_PROPNAME_ASCII_FRAME "Frame" +#define STATUSINDICATORFACTORY_PROPNAME_ASCII_WINDOW "Window" +#define STATUSINDICATORFACTORY_PROPNAME_ASCII_ALLOWPARENTSHOW "AllowParentShow" +#define STATUSINDICATORFACTORY_PROPNAME_ASCII_DISABLERESCHEDULE "DisableReschedule" + +#define STATUSINDICATORFACTORY_PROPNAME_FRAME DECLARE_ASCII(STATUSINDICATORFACTORY_PROPNAME_ASCII_FRAME ) +#define STATUSINDICATORFACTORY_PROPNAME_WINDOW DECLARE_ASCII(STATUSINDICATORFACTORY_PROPNAME_ASCII_WINDOW ) +#define STATUSINDICATORFACTORY_PROPNAME_ALLOWPARENTSHOW DECLARE_ASCII(STATUSINDICATORFACTORY_PROPNAME_ASCII_ALLOWPARENTSHOW ) +#define STATUSINDICATORFACTORY_PROPNAME_DISABLERESCHEDULE DECLARE_ASCII(STATUSINDICATORFACTORY_PROPNAME_ASCII_DISABLERESCHEDULE) + +//_______________________________________________ +/** properties for "Frame" class */ + +#define FRAME_PROPNAME_ASCII_DISPATCHRECORDERSUPPLIER "DispatchRecorderSupplier" +#define FRAME_PROPNAME_ASCII_ISHIDDEN "IsHidden" +#define FRAME_PROPNAME_ASCII_LAYOUTMANAGER "LayoutManager" +#define FRAME_PROPNAME_ASCII_TITLE "Title" +#define FRAME_PROPNAME_ASCII_INDICATORINTERCEPTION "IndicatorInterception" + +#define FRAME_PROPNAME_DISPATCHRECORDERSUPPLIER DECLARE_ASCII(FRAME_PROPNAME_ASCII_DISPATCHRECORDERSUPPLIER) +#define FRAME_PROPNAME_ISHIDDEN DECLARE_ASCII(FRAME_PROPNAME_ASCII_ISHIDDEN ) +#define FRAME_PROPNAME_LAYOUTMANAGER DECLARE_ASCII(FRAME_PROPNAME_ASCII_LAYOUTMANAGER ) +#define FRAME_PROPNAME_TITLE DECLARE_ASCII(FRAME_PROPNAME_ASCII_TITLE ) +#define FRAME_PROPNAME_INDICATORINTERCEPTION DECLARE_ASCII(FRAME_PROPNAME_ASCII_INDICATORINTERCEPTION ) + +// Please add new entries alphabetical sorted and correct all other handles! +// Start counting with 0, so it can be used as direct index into an array too. +// Don't forget updating of define FRAME_PROPCOUNT below!!! +#define FRAME_PROPHANDLE_DISPATCHRECORDERSUPPLIER 0 +#define FRAME_PROPHANDLE_ISHIDDEN 1 +#define FRAME_PROPHANDLE_LAYOUTMANAGER 2 +#define FRAME_PROPHANDLE_TITLE 3 +#define FRAME_PROPHANDLE_INDICATORINTERCEPTION 4 + +#define FRAME_PROPCOUNT 5 + +//_______________________________________________ +/** properties for "Desktop" class */ + +#define DESKTOP_PROPNAME_ASCII_ACTIVEFRAME "ActiveFrame" +#define DESKTOP_PROPNAME_ASCII_DISPATCHRECORDERSUPPLIER "DispatchRecorderSupplier" +#define DESKTOP_PROPNAME_ASCII_ISPLUGGED "IsPlugged" +#define DESKTOP_PROPNAME_ASCII_SUSPENDQUICKSTARTVETO "SuspendQuickstartVeto" +#define DESKTOP_PROPNAME_ASCII_TITLE "Title" + +#define DESKTOP_PROPNAME_ACTIVEFRAME DECLARE_ASCII(DESKTOP_PROPNAME_ASCII_ACTIVEFRAME ) +#define DESKTOP_PROPNAME_DISPATCHRECORDERSUPPLIER DECLARE_ASCII(DESKTOP_PROPNAME_ASCII_DISPATCHRECORDERSUPPLIER) +#define DESKTOP_PROPNAME_ISPLUGGED DECLARE_ASCII(DESKTOP_PROPNAME_ASCII_ISPLUGGED ) +#define DESKTOP_PROPNAME_SUSPENDQUICKSTARTVETO DECLARE_ASCII(DESKTOP_PROPNAME_ASCII_SUSPENDQUICKSTARTVETO ) +#define DESKTOP_PROPNAME_TITLE DECLARE_ASCII(DESKTOP_PROPNAME_ASCII_TITLE ) + +// Please add new entries alphabetical sorted and correct all other handles! +// Start counting with 0, so it can be used as direct index into an array too. +// Don't forget updating of define DESKTOP_PROPCOUNT below!!! +#define DESKTOP_PROPHANDLE_ACTIVEFRAME 0 +#define DESKTOP_PROPHANDLE_DISPATCHRECORDERSUPPLIER 1 +#define DESKTOP_PROPHANDLE_ISPLUGGED 2 +#define DESKTOP_PROPHANDLE_SUSPENDQUICKSTARTVETO 3 +#define DESKTOP_PROPHANDLE_TITLE 4 + +#define DESKTOP_PROPCOUNT 5 + +//_______________________________________________ +/** properties for "PathSettings" class */ + +#define PATHSETTINGS_PROPNAME_ASCII_ADDIN "Addin" +#define PATHSETTINGS_PROPNAME_ASCII_AUTOCORRECT "AutoCorrect" +#define PATHSETTINGS_PROPNAME_ASCII_AUTOTEXT "AutoText" +#define PATHSETTINGS_PROPNAME_ASCII_BACKUP "Backup" +#define PATHSETTINGS_PROPNAME_ASCII_BASIC "Basic" +#define PATHSETTINGS_PROPNAME_ASCII_BITMAP "Bitmap" +#define PATHSETTINGS_PROPNAME_ASCII_CONFIG "Config" +#define PATHSETTINGS_PROPNAME_ASCII_DICTIONARY "Dictionary" +#define PATHSETTINGS_PROPNAME_ASCII_FAVORITE "Favorite" +#define PATHSETTINGS_PROPNAME_ASCII_FILTER "Filter" +#define PATHSETTINGS_PROPNAME_ASCII_GALLERY "Gallery" +#define PATHSETTINGS_PROPNAME_ASCII_GRAPHIC "Graphic" +#define PATHSETTINGS_PROPNAME_ASCII_HELP "Help" +#define PATHSETTINGS_PROPNAME_ASCII_LINGUISTIC "Linguistic" +#define PATHSETTINGS_PROPNAME_ASCII_MODULE "Module" +#define PATHSETTINGS_PROPNAME_ASCII_PALETTE "Palette" +#define PATHSETTINGS_PROPNAME_ASCII_PLUGIN "Plugin" +#define PATHSETTINGS_PROPNAME_ASCII_STORAGE "Storage" +#define PATHSETTINGS_PROPNAME_ASCII_TEMP "Temp" +#define PATHSETTINGS_PROPNAME_ASCII_TEMPLATE "Template" +#define PATHSETTINGS_PROPNAME_ASCII_UICONFIG "UIConfig" +#define PATHSETTINGS_PROPNAME_ASCII_USERCONFIG "UserConfig" +#define PATHSETTINGS_PROPNAME_ASCII_USERDICTIONARY "UserDictionary" +#define PATHSETTINGS_PROPNAME_ASCII_WORK "Work" + +#define PATHSETTINGS_PROPNAME_ADDIN ::rtl::OUString::createFromAscii(PATHSETTINGS_PROPNAME_ASCII_ADDIN ) +#define PATHSETTINGS_PROPNAME_AUTOCORRECT ::rtl::OUString::createFromAscii(PATHSETTINGS_PROPNAME_ASCII_AUTOCORRECT ) +#define PATHSETTINGS_PROPNAME_AUTOTEXT ::rtl::OUString::createFromAscii(PATHSETTINGS_PROPNAME_ASCII_AUTOTEXT ) +#define PATHSETTINGS_PROPNAME_BACKUP ::rtl::OUString::createFromAscii(PATHSETTINGS_PROPNAME_ASCII_BACKUP ) +#define PATHSETTINGS_PROPNAME_BASIC ::rtl::OUString::createFromAscii(PATHSETTINGS_PROPNAME_ASCII_BASIC ) +#define PATHSETTINGS_PROPNAME_BITMAP ::rtl::OUString::createFromAscii(PATHSETTINGS_PROPNAME_ASCII_BITMAP ) +#define PATHSETTINGS_PROPNAME_CONFIG ::rtl::OUString::createFromAscii(PATHSETTINGS_PROPNAME_ASCII_CONFIG ) +#define PATHSETTINGS_PROPNAME_DICTIONARY ::rtl::OUString::createFromAscii(PATHSETTINGS_PROPNAME_ASCII_DICTIONARY ) +#define PATHSETTINGS_PROPNAME_FAVORITE ::rtl::OUString::createFromAscii(PATHSETTINGS_PROPNAME_ASCII_FAVORITE ) +#define PATHSETTINGS_PROPNAME_FILTER ::rtl::OUString::createFromAscii(PATHSETTINGS_PROPNAME_ASCII_FILTER ) +#define PATHSETTINGS_PROPNAME_GALLERY ::rtl::OUString::createFromAscii(PATHSETTINGS_PROPNAME_ASCII_GALLERY ) +#define PATHSETTINGS_PROPNAME_GRAPHIC ::rtl::OUString::createFromAscii(PATHSETTINGS_PROPNAME_ASCII_GRAPHIC ) +#define PATHSETTINGS_PROPNAME_HELP ::rtl::OUString::createFromAscii(PATHSETTINGS_PROPNAME_ASCII_HELP ) +#define PATHSETTINGS_PROPNAME_LINGUISTIC ::rtl::OUString::createFromAscii(PATHSETTINGS_PROPNAME_ASCII_LINGUISTIC ) +#define PATHSETTINGS_PROPNAME_MODULE ::rtl::OUString::createFromAscii(PATHSETTINGS_PROPNAME_ASCII_MODULE ) +#define PATHSETTINGS_PROPNAME_PALETTE ::rtl::OUString::createFromAscii(PATHSETTINGS_PROPNAME_ASCII_PALETTE ) +#define PATHSETTINGS_PROPNAME_PLUGIN ::rtl::OUString::createFromAscii(PATHSETTINGS_PROPNAME_ASCII_PLUGIN ) +#define PATHSETTINGS_PROPNAME_STORAGE ::rtl::OUString::createFromAscii(PATHSETTINGS_PROPNAME_ASCII_STORAGE ) +#define PATHSETTINGS_PROPNAME_TEMP ::rtl::OUString::createFromAscii(PATHSETTINGS_PROPNAME_ASCII_TEMP ) +#define PATHSETTINGS_PROPNAME_TEMPLATE ::rtl::OUString::createFromAscii(PATHSETTINGS_PROPNAME_ASCII_TEMPLATE ) +#define PATHSETTINGS_PROPNAME_UICONFIG ::rtl::OUString::createFromAscii(PATHSETTINGS_PROPNAME_ASCII_UICONFIG ) +#define PATHSETTINGS_PROPNAME_USERCONFIG ::rtl::OUString::createFromAscii(PATHSETTINGS_PROPNAME_ASCII_USERCONFIG ) +#define PATHSETTINGS_PROPNAME_USERDICTIONARY ::rtl::OUString::createFromAscii(PATHSETTINGS_PROPNAME_ASCII_USERDICTIONARY) +#define PATHSETTINGS_PROPNAME_WORK ::rtl::OUString::createFromAscii(PATHSETTINGS_PROPNAME_ASCII_WORK ) + +// Please add new entries alphabetical sorted and correct all other handles! +// Start counting with 0, so it can be used as direct index into an array too. +// Don't forget updating of define PATHSETTINGS_PROPCOUNT below!!! +#define PATHSETTINGS_PROPHANDLE_ADDIN 0 +#define PATHSETTINGS_PROPHANDLE_AUTOCORRECT 1 +#define PATHSETTINGS_PROPHANDLE_AUTOTEXT 2 +#define PATHSETTINGS_PROPHANDLE_BACKUP 3 +#define PATHSETTINGS_PROPHANDLE_BASIC 4 +#define PATHSETTINGS_PROPHANDLE_BITMAP 5 +#define PATHSETTINGS_PROPHANDLE_CONFIG 6 +#define PATHSETTINGS_PROPHANDLE_DICTIONARY 7 +#define PATHSETTINGS_PROPHANDLE_FAVORITE 8 +#define PATHSETTINGS_PROPHANDLE_FILTER 9 +#define PATHSETTINGS_PROPHANDLE_GALLERY 10 +#define PATHSETTINGS_PROPHANDLE_GRAPHIC 11 +#define PATHSETTINGS_PROPHANDLE_HELP 12 +#define PATHSETTINGS_PROPHANDLE_LINGUISTIC 13 +#define PATHSETTINGS_PROPHANDLE_MODULE 14 +#define PATHSETTINGS_PROPHANDLE_PALETTE 15 +#define PATHSETTINGS_PROPHANDLE_PLUGIN 16 +#define PATHSETTINGS_PROPHANDLE_STORAGE 17 +#define PATHSETTINGS_PROPHANDLE_TEMP 18 +#define PATHSETTINGS_PROPHANDLE_TEMPLATE 19 +#define PATHSETTINGS_PROPHANDLE_UICONFIG 20 +#define PATHSETTINGS_PROPHANDLE_USERCONFIG 21 +#define PATHSETTINGS_PROPHANDLE_USERDICTIONARY 22 +#define PATHSETTINGS_PROPHANDLE_WORK 23 + +#define PATHSETTINGS_PROPCOUNT 24 + +//_______________________________________________ +/** properties for "LayoutManager" class */ + +#define LAYOUTMANAGER_PROPNAME_ASCII_MENUBARCLOSER "MenuBarCloser" +#define LAYOUTMANAGER_PROPNAME_ASCII_AUTOMATICTOOLBARS "AutomaticToolbars" +#define LAYOUTMANAGER_PROPNAME_ASCII_REFRESHVISIBILITY "RefreshContextToolbarVisibility" +#define LAYOUTMANAGER_PROPNAME_ASCII_HIDECURRENTUI "HideCurrentUI" +#define LAYOUTMANAGER_PROPNAME_ASCII_LOCKCOUNT "LockCount" +#define LAYOUTMANAGER_PROPNAME_ASCII_PRESERVE_CONTENT_SIZE "PreserveContentSize" + +#define LAYOUTMANAGER_PROPNAME_MENUBARCLOSER ::rtl::OUString::createFromAscii( LAYOUTMANAGER_PROPNAME_ASCII_MENUBARCLOSER ) +#define LAYOUTMANAGER_PROPNAME_AUTOMATICTOOLBARS ::rtl::OUString::createFromAscii( LAYOUTMANAGER_PROPNAME_ASCII_AUTOMATICTOOLBARS ) +#define LAYOUTMANAGER_PROPNAME_REFRESHVISIBILITY ::rtl::OUString::createFromAscii( LAYOUTMANAGER_PROPNAME_ASCII_REFRESHVISIBILITY ) +#define LAYOUTMANAGER_PROPNAME_HIDECURRENTUI ::rtl::OUString::createFromAscii( LAYOUTMANAGER_PROPNAME_ASCII_HIDECURRENTUI ) +#define LAYOUTMANAGER_PROPNAME_LOCKCOUNT ::rtl::OUString::createFromAscii( LAYOUTMANAGER_PROPNAME_ASCII_LOCKCOUNT ) +#define LAYOUTMANAGER_PROPNAME_PRESERVE_CONTENT_SIZE ::rtl::OUString::createFromAscii( LAYOUTMANAGER_PROPNAME_ASCII_PRESERVE_CONTENT_SIZE ) + +#define LAYOUTMANAGER_PROPHANDLE_MENUBARCLOSER 0 +#define LAYOUTMANAGER_PROPHANDLE_AUTOMATICTOOLBARS 1 +#define LAYOUTMANAGER_PROPHANDLE_REFRESHVISIBILITY 2 +#define LAYOUTMANAGER_PROPHANDLE_HIDECURRENTUI 3 +#define LAYOUTMANAGER_PROPHANDLE_LOCKCOUNT 4 +#define LAYOUTMANAGER_PROPHANDLE_PRESERVE_CONTENT_SIZE 5 + +//_______________________________________________ +/** properties for "UICommandDescription" class */ +#define UICOMMANDDESCRIPTION_NAMEACCESS_COMMANDIMAGELIST "private:resource/image/commandimagelist" +#define UICOMMANDDESCRIPTION_NAMEACCESS_COMMANDROTATEIMAGELIST "private:resource/image/commandrotateimagelist" +#define UICOMMANDDESCRIPTION_NAMEACCESS_COMMANDMIRRORIMAGELIST "private:resource/image/commandmirrorimagelist" + +#define UICOMMANDDESCRIPTION_PROPNAME_PROPERTIES "Properties" +#define UICOMMANDDESCRIPTION_PROPNAME_POPUP "Popup" + +#define UICOMMANDDESCRIPTION_PROPERTIES_IMAGE 1 +#define UICOMMANDDESCRIPTION_PROPERTIES_IMAGE_MIRRORED 2 +#define UICOMMANDDESCRIPTION_PROPERTIES_IMAGE_ROTATED 4 +#define UICOMMANDDESCRIPTION_PROPERTIES_TOGGLEBUTTON 8 + +//_______________________________________________ +/** properties for "AutoRecovery" class */ + +#define AUTORECOVERY_PROPNAME_ASCII_EXISTS_RECOVERYDATA "ExistsRecoveryData" +#define AUTORECOVERY_PROPNAME_ASCII_EXISTS_SESSIONDATA "ExistsSessionData" +#define AUTORECOVERY_PROPNAME_ASCII_CRASHED "Crashed" + +#define AUTORECOVERY_PROPNAME_EXISTS_RECOVERYDATA ::rtl::OUString::createFromAscii( AUTORECOVERY_PROPNAME_ASCII_EXISTS_RECOVERYDATA ) +#define AUTORECOVERY_PROPNAME_EXISTS_SESSIONDATA ::rtl::OUString::createFromAscii( AUTORECOVERY_PROPNAME_ASCII_EXISTS_SESSIONDATA ) +#define AUTORECOVERY_PROPNAME_CRASHED ::rtl::OUString::createFromAscii( AUTORECOVERY_PROPNAME_ASCII_CRASHED ) + +#define AUTORECOVERY_PROPHANDLE_EXISTS_RECOVERYDATA 0 +#define AUTORECOVERY_PROPHANDLE_EXISTS_SESSIONDATA 1 +#define AUTORECOVERY_PROPHANDLE_CRASHED 2 + +#define AUTORECOVERY_PROPCOUNT 3 + +//_______________________________________________ +/** properties for Filter config */ + +#define FILTER_PROPNAME_ASCII_DOCUMENTSERVICE "DocumentService" + +#define FILTER_PROPNAME_DOCUMENTSERVICE ::rtl::OUString::createFromAscii( FILTER_PROPNAME_ASCII_DOCUMENTSERVICE ) + +//_______________________________________________ +/** properties for office module config (Setup.xcu) */ + +#define OFFICEFACTORY_PROPNAME_ASCII_WINDOWATTRIBUTES "ooSetupFactoryWindowAttributes" +#define OFFICEFACTORY_PROPNAME_ASCII_UINAME "ooSetupFactoryUIName" +#define OFFICEFACTORY_PROPNAME_ASCII_ICON "ooSetupFactoryIcon" + +#define OFFICEFACTORY_PROPNAME_WINDOWATTRIBUTES ::rtl::OUString::createFromAscii( OFFICEFACTORY_PROPNAME_ASCII_WINDOWATTRIBUTES ) +#define OFFICEFACTORY_PROPNAME_UINAME ::rtl::OUString::createFromAscii( OFFICEFACTORY_PROPNAME_ASCII_UINAME ) +#define OFFICEFACTORY_PROPNAME_ICON ::rtl::OUString::createFromAscii( OFFICEFACTORY_PROPNAME_ASCII_ICON ) + +//_______________________________________________ +/** properties for tab window (old) */ +#define TABWINDOW_PROPNAME_ASCII_PARENTWINDOW "ParentWindow" +#define TABWINDOW_PROPNAME_ASCII_TOPWINDOW "TopWindow" +#define TABWINDOW_PROPNAME_PARENTWINDOW ::rtl::OUString::createFromAscii( TABWINDOW_PROPNAME_ASCII_PARENTWINDOW ) +#define TABWINDOW_PROPNAME_TOPWINDOW ::rtl::OUString::createFromAscii( TABWINDOW_PROPNAME_ASCII_TOPWINDOW ) + +#define TABWINDOW_PROPHANDLE_PARENTWINDOW 0 +#define TABWINDOW_PROPHANDLE_TOPWINDOW 1 +#define TABWINDOW_PROPCOUNT 2 + +//_______________________________________________ +/** properties for tab window service (new) */ +#define TABWINDOWSERVICE_PROPNAME_ASCII_WINDOW "Window" +#define TABWINDOWSERVICE_PROPNAME_WINDOW ::rtl::OUString::createFromAscii( TABWINDOWSERVICE_PROPNAME_ASCII_WINDOW ) + +#define TABWINDOWSERVICE_PROPHANDLE_WINDOW 0 +#define TABWINDOWSERVICE_PROPCOUNT 1 + +//_______________________________________________ +/** properties of tabreg service */ +static const char* TABREG_PROPNAME_ASCII_TITLE = "title"; + +static const ::rtl::OUString TABREG_PROPNAME_TITLE = ::rtl::OUString::createFromAscii(TABREG_PROPNAME_ASCII_TITLE); + +//_______________________________________________ +/** properties of controller service */ +static const char* CONTROLLER_PROPNAME_ASCII_ICONID = "IconId"; + +static const ::rtl::OUString CONTROLLER_PROPNAME_ICONID = ::rtl::OUString::createFromAscii(CONTROLLER_PROPNAME_ASCII_ICONID); + +//_______________________________________________ +/** provides some helper methods to implement property sets. */ + +class PropHelper +{ + public: + + //___________________________________________ + + /** checks if given property will be changed by this settings. + * We compare the content of the given any values. If they are different we return sal_True - sal_False otherwhise. + * + * @param aCurrentValue contains the current value for this property + * @param aNewValue contains the new value for this property + * @param aOldValue returns the current value, in case somthing will be changed + * @param aChangedValue returns the new value, in case somthing will be changed + * + * @return <True/> if value of this property will be changed; <False/> otherwhise. + */ + + static sal_Bool willPropertyBeChanged( const css::uno::Any& aCurrentValue , + const css::uno::Any& aNewValue , + css::uno::Any& aOldValue , + css::uno::Any& aChangedValue ) + { + sal_Bool bChanged = sal_False; + + // clear return parameter to be shure, to put out only valid values ... + aOldValue.clear(); + aChangedValue.clear(); + + // if value change ... + bChanged = !(aCurrentValue==aNewValue); + if (bChanged) + { + // ... set information of change. + aOldValue = aCurrentValue; + aChangedValue = aNewValue ; + } + + return bChanged; + } + + //___________________________________________ + + /** calculates the count of items inside the given ascii array. + * + * @param pArray must point to an array of items from type sal_Char + * + * @return The count of items inside this array, calculated by knowing the size of sal_Char. + */ + + static sal_Int32 calculatePropArrayCount( const sal_Char* pArray[] ) + { + return (sal_Int32)(sizeof(pArray)/sizeof(sal_Char*)); + } +}; + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_PROPERTIES_H_ diff --git a/framework/inc/protocols.h b/framework/inc/protocols.h new file mode 100644 index 000000000000..20273e9a4325 --- /dev/null +++ b/framework/inc/protocols.h @@ -0,0 +1,157 @@ +/************************************************************************* + * + * 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 outline this implementation :-) */ + +#ifndef __FRAMEWORK_PROTOCOLS_H_ +#define __FRAMEWORK_PROTOCOLS_H_ + +//_________________________________________________________________________________________________________________ +// includes +//_________________________________________________________________________________________________________________ + +#include <macros/generic.hxx> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_______________________________________________________________________ +/** + some protocols must be checked during loading or dispatching URLs manually + It can be neccessary to decide, if a URL represent a non visible content or + a real visible component. + */ + +#define SPECIALPROTOCOL_PRIVATE DECLARE_ASCII("private:" ) // indicates a loadable content in general! +#define SPECIALPROTOCOL_PRIVATE_OBJECT DECLARE_ASCII("private:object" ) // indicates loading of components using a model directly +#define SPECIALPROTOCOL_PRIVATE_STREAM DECLARE_ASCII("private:stream" ) // indicates loading of components using a stream only +#define SPECIALPROTOCOL_PRIVATE_FACTORY DECLARE_ASCII("private:factory") // indicates creation of empty documents +#define SPECIALPROTOCOL_SLOT DECLARE_ASCII("slot:" ) // internal protocol of the sfx project for generic dispatch funtionality +#define SPECIALPROTOCOL_UNO DECLARE_ASCII(".uno:" ) // external representation of the slot protocol using names instead of id's +#define SPECIALPROTOCOL_MACRO DECLARE_ASCII("macro:" ) // special sfx protocol to execute macros +#define SPECIALPROTOCOL_SERVICE DECLARE_ASCII("service:" ) // generic way to start uno services during dispatch +#define SPECIALPROTOCOL_MAILTO DECLARE_ASCII("mailto:" ) // for sending mails +#define SPECIALPROTOCOL_NEWS DECLARE_ASCII("news:" ) // for sending news + +class ProtocolCheck +{ + public: + + //_______________________________________________________________________ + /** + enums for well known protocols + */ + enum EProtocol + { + E_UNKNOWN_PROTOCOL , + E_PRIVATE , + E_PRIVATE_OBJECT , + E_PRIVATE_STREAM , + E_PRIVATE_FACTORY , + E_SLOT , + E_UNO , + E_MACRO , + E_SERVICE , + E_MAILTO , + E_NEWS + }; + + //_______________________________________________________________________ + /** + it checks, if the given URL string match one of the well known protocols. + It returns the right enum value. + Protocols are defined above ... + */ + static EProtocol specifyProtocol( const ::rtl::OUString& sURL ) + { + // because "private:" is part of e.g. "private:object" too ... + // we must check it before all other ones!!! + if (sURL.compareTo(SPECIALPROTOCOL_PRIVATE,SPECIALPROTOCOL_PRIVATE.getLength()) == 0) + return E_PRIVATE; + else + if (sURL.compareTo(SPECIALPROTOCOL_PRIVATE_OBJECT,SPECIALPROTOCOL_PRIVATE_OBJECT.getLength()) == 0) + return E_PRIVATE_OBJECT; + else + if (sURL.compareTo(SPECIALPROTOCOL_PRIVATE_STREAM,SPECIALPROTOCOL_PRIVATE_STREAM.getLength()) == 0) + return E_PRIVATE_STREAM; + else + if (sURL.compareTo(SPECIALPROTOCOL_PRIVATE_FACTORY,SPECIALPROTOCOL_PRIVATE_FACTORY.getLength()) == 0) + return E_PRIVATE_FACTORY; + else + if (sURL.compareTo(SPECIALPROTOCOL_SLOT,SPECIALPROTOCOL_SLOT.getLength()) == 0) + return E_SLOT; + else + if (sURL.compareTo(SPECIALPROTOCOL_UNO,SPECIALPROTOCOL_UNO.getLength()) == 0) + return E_UNO; + else + if (sURL.compareTo(SPECIALPROTOCOL_MACRO,SPECIALPROTOCOL_MACRO.getLength()) == 0) + return E_MACRO; + else + if (sURL.compareTo(SPECIALPROTOCOL_SERVICE,SPECIALPROTOCOL_SERVICE.getLength()) == 0) + return E_SERVICE; + else + if (sURL.compareTo(SPECIALPROTOCOL_MAILTO,SPECIALPROTOCOL_MAILTO.getLength()) == 0) + return E_MAILTO; + else + if (sURL.compareTo(SPECIALPROTOCOL_NEWS,SPECIALPROTOCOL_NEWS.getLength()) == 0) + return E_NEWS; + else + return E_UNKNOWN_PROTOCOL; + } + + //_______________________________________________________________________ + /** + it checks if given URL match the required protocol only + It should be used instead of specifyProtocol() if only this question + is interesting to perform the code. We must not check for all possible protocols here... + */ + static sal_Bool isProtocol( const ::rtl::OUString& sURL, EProtocol eRequired ) + { + switch(eRequired) + { + case E_PRIVATE : return (sURL.compareTo(SPECIALPROTOCOL_PRIVATE ,SPECIALPROTOCOL_PRIVATE.getLength() ) == 0); + case E_PRIVATE_OBJECT : return (sURL.compareTo(SPECIALPROTOCOL_PRIVATE_OBJECT ,SPECIALPROTOCOL_PRIVATE_OBJECT.getLength() ) == 0); + case E_PRIVATE_STREAM : return (sURL.compareTo(SPECIALPROTOCOL_PRIVATE_STREAM ,SPECIALPROTOCOL_PRIVATE_STREAM.getLength() ) == 0); + case E_PRIVATE_FACTORY : return (sURL.compareTo(SPECIALPROTOCOL_PRIVATE_FACTORY,SPECIALPROTOCOL_PRIVATE_FACTORY.getLength()) == 0); + case E_SLOT : return (sURL.compareTo(SPECIALPROTOCOL_SLOT ,SPECIALPROTOCOL_SLOT.getLength() ) == 0); + case E_UNO : return (sURL.compareTo(SPECIALPROTOCOL_UNO ,SPECIALPROTOCOL_UNO.getLength() ) == 0); + case E_MACRO : return (sURL.compareTo(SPECIALPROTOCOL_MACRO ,SPECIALPROTOCOL_MACRO.getLength() ) == 0); + case E_SERVICE : return (sURL.compareTo(SPECIALPROTOCOL_SERVICE ,SPECIALPROTOCOL_SERVICE.getLength() ) == 0); + case E_MAILTO : return (sURL.compareTo(SPECIALPROTOCOL_MAILTO ,SPECIALPROTOCOL_MAILTO.getLength() ) == 0); + case E_NEWS : return (sURL.compareTo(SPECIALPROTOCOL_NEWS ,SPECIALPROTOCOL_NEWS.getLength() ) == 0); + default : return sal_False; + } + return sal_False; + } +}; + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_PROTOCOLS_H_ diff --git a/framework/inc/queries.h b/framework/inc/queries.h new file mode 100644 index 000000000000..b8d122118abf --- /dev/null +++ b/framework/inc/queries.h @@ -0,0 +1,402 @@ +/************************************************************************* + * + * 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_QUERIES_H_ +#define __FRAMEWORK_QUERIES_H_ + +//_________________________________________________________________________________________________________________ +// own includes +//_________________________________________________________________________________________________________________ + +#include <general.h> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/uno/Sequence.hxx> +#include <rtl/ustring.hxx> +#include <rtl/ustrbuf.hxx> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ +// const +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short These values describe our supported queries for type, filter ... properties. + They are used by our FilterFactory or ouer TypeDetection to return + subsets of our cached configuration. +*//*-*************************************************************************************************************/ +#define BASE_QUERY_ALL DECLARE_ASCII("_query_all" ) +#define BASE_QUERY_WRITER DECLARE_ASCII("_query_Writer" ) +#define BASE_QUERY_WEB DECLARE_ASCII("_query_web" ) +#define BASE_QUERY_GLOBAL DECLARE_ASCII("_query_global" ) +#define BASE_QUERY_CHART DECLARE_ASCII("_query_chart" ) +#define BASE_QUERY_CALC DECLARE_ASCII("_query_calc" ) +#define BASE_QUERY_IMPRESS DECLARE_ASCII("_query_impress" ) +#define BASE_QUERY_DRAW DECLARE_ASCII("_query_draw" ) +#define BASE_QUERY_MATH DECLARE_ASCII("_query_math" ) +#define BASE_QUERY_GRAPHICS DECLARE_ASCII("_query_graphics") + +/*-************************************************************************************************************//** + @short These parameters can be used in combination with BASE_QUERY_... defines to + specialize it. + use follow syntax to do so: "<query>[:<param>[=<value>]]" + e.g.: "_query_writer:default_first:use_order:sort_prop=uiname" + + argument description default + ----------------------------------------------------------------------------------------------- + iflags=<mask> include filters by given mask 0 + eflags=<mask> exclude filters by given mask 0 + sort_prop=<[name,uiname]> sort by internal name or uiname name + descending sort descending false + use_order use order flag of filters for sorting false + default_first set default filter on top of return list false + case_sensitive compare "sort_prop" case sensitive false +*//*-*************************************************************************************************************/ +#define SEPERATOR_QUERYPARAM ((sal_Unicode)':') +#define SEPERATOR_QUERYPARAMVALUE ((sal_Unicode)'=') + +#define QUERYPARAM_IFLAGS DECLARE_ASCII("iflags" ) +#define QUERYPARAM_EFLAGS DECLARE_ASCII("eflags" ) +#define QUERYPARAM_SORT_PROP DECLARE_ASCII("sort_prop" ) + +#define QUERYPARAM_DESCENDING DECLARE_ASCII("descending" ) +#define QUERYPARAM_USE_ORDER DECLARE_ASCII("use_order" ) +#define QUERYPARAM_DEFAULT_FIRST DECLARE_ASCII("default_first" ) +#define QUERYPARAM_CASE_SENSITIVE DECLARE_ASCII("case_sensitive" ) + +#define QUERYPARAMVALUE_SORT_PROP_NAME DECLARE_ASCII("name" ) +#define QUERYPARAMVALUE_SORT_PROP_UINAME DECLARE_ASCII("uiname" ) + +/*-************************************************************************************************************//** + @short Helper class to support easy building of a query statements. +*//*-*************************************************************************************************************/ +class QueryBuilder +{ + public: + //--------------------------------------------------------------------------------------------------------- + // start with empty query + //--------------------------------------------------------------------------------------------------------- + QueryBuilder() + { + resetAll(); + } + + //--------------------------------------------------------------------------------------------------------- + // returns full query as copy of internal set values + //--------------------------------------------------------------------------------------------------------- + ::rtl::OUString getQuery() + { + ::rtl::OUStringBuffer sCopy( m_sParams ); + sCopy.insert( 0, m_sBase ); + return sCopy.makeStringAndClear(); + } + + //--------------------------------------------------------------------------------------------------------- + // set new or change existing base query part + //--------------------------------------------------------------------------------------------------------- + void setBase( const ::rtl::OUString& sBase ) + { + m_sBase = sBase; + } + + //--------------------------------------------------------------------------------------------------------- + // add new parameter (with optional value) to param list + //--------------------------------------------------------------------------------------------------------- + void addParam( const ::rtl::OUString& sParam, const ::rtl::OUString& sValue = ::rtl::OUString() ) + { + m_sParams.append( SEPERATOR_QUERYPARAM ); + m_sParams.append( sParam ); + if( sValue.getLength() > 0 ) + { + m_sParams.append( SEPERATOR_QUERYPARAMVALUE ); + m_sParams.append( sValue ); + } + } + + //--------------------------------------------------------------------------------------------------------- + // forget all setted params and start with empty ones + // Attention: base of query isn't changed! + //--------------------------------------------------------------------------------------------------------- + void resetParams() + { + m_sParams.makeStringAndClear(); + m_sParams.ensureCapacity( 256 ); + } + + //--------------------------------------------------------------------------------------------------------- + // start with new empty query + //--------------------------------------------------------------------------------------------------------- + void resetAll() + { + m_sBase = ::rtl::OUString(); + resetParams(); + } + + private: + ::rtl::OUString m_sBase ; + ::rtl::OUStringBuffer m_sParams ; + +}; // class QueryBuilder + +/*-************************************************************************************************************//** + @short Helper class to analyze queries and split into his different parts (base, params and values). +*//*-*************************************************************************************************************/ +class QueryAnalyzer +{ + public: + + //--------------------------------------------------------------------------------------------------------- + // it's will not perform to compare strings as query type ... + // so we convert it into these enum values. + // default = E_ALL! + //--------------------------------------------------------------------------------------------------------- + enum EQuery + { + E_ALL , + E_WRITER , + E_WEB , + E_GLOBAL , + E_CHART , + E_CALC , + E_IMPRESS , + E_DRAW , + E_MATH , + E_GRAPHICS + }; + + //--------------------------------------------------------------------------------------------------------- + // these are valid values for param "sort_prop". + // other ones are not supported! + // default = E_NAME + //--------------------------------------------------------------------------------------------------------- + enum ESortProp + { + E_NAME , + E_UINAME + }; + + //--------------------------------------------------------------------------------------------------------- + // analyze given query and split it into his different parts; <base>:<param1>:<param2=value>... + //--------------------------------------------------------------------------------------------------------- + QueryAnalyzer( const ::rtl::OUString& sQuery ) + // Don't forget to set default values for non given params! + : m_eQuery ( E_ALL ) // return ALL filter ... + , m_nIFlags ( 0 ) // which has set ANY flag ... (we remove all entries which match with these mask .. => 0!) + , m_nEFlags ( 0 ) // (only used, if nIFlags==0 and himself!=0!) + , m_eSortProp ( E_NAME ) // sort it by internal name ... + , m_bDescending ( sal_False ) // in ascending order ... + , m_bCaseSensitive( sal_False ) // ignore case ... + , m_bUseOrder ( sal_False ) // don't use order flag ... + , m_bDefaultFirst ( sal_False ) // and don't handle default entries in special case! + { + // Translate old query format to new one first! + ::rtl::OUString sNewQuery( sQuery ); + if( sQuery == DECLARE_ASCII("_filterquery_textdocument_withdefault") ) + sNewQuery=DECLARE_ASCII("_query_writer:default_first:use_order:sort_prop=uiname"); + else + if( sQuery == DECLARE_ASCII("_filterquery_webdocument_withdefault") ) + sNewQuery=DECLARE_ASCII("_query_web:default_first:use_order:sort_prop=uiname"); + else + if( sQuery == DECLARE_ASCII("_filterquery_globaldocument_withdefault") ) + sNewQuery=DECLARE_ASCII("_query_global:default_first:use_order:sort_prop=uiname"); + else + if( sQuery == DECLARE_ASCII("_filterquery_chartdocument_withdefault") ) + sNewQuery=DECLARE_ASCII("_query_chart:default_first:use_order:sort_prop=uiname"); + else + if( sQuery == DECLARE_ASCII("_filterquery_spreadsheetdocument_withdefault") ) + sNewQuery=DECLARE_ASCII("_query_calc:default_first:use_order:sort_prop=uiname"); + else + if( sQuery == DECLARE_ASCII("_filterquery_presentationdocument_withdefault") ) + sNewQuery=DECLARE_ASCII("_query_impress:default_first:use_order:sort_prop=uiname"); + else + if( sQuery == DECLARE_ASCII("_filterquery_drawingdocument_withdefault") ) + sNewQuery=DECLARE_ASCII("_query_draw:default_first:use_order:sort_prop=uiname"); + else + if( sQuery == DECLARE_ASCII("_filterquery_formulaproperties_withdefault") ) + sNewQuery=DECLARE_ASCII("_query_math:default_first:use_order:sort_prop=uiname"); + else + if( sQuery == DECLARE_ASCII("_filterquery_textdocument") ) + sNewQuery=DECLARE_ASCII("_query_writer:use_order:sort_prop=uiname"); + else + if( sQuery == DECLARE_ASCII("_filterquery_webdocument") ) + sNewQuery=DECLARE_ASCII("_query_web:use_order:sort_prop=uiname"); + else + if( sQuery == DECLARE_ASCII("_filterquery_globaldocument") ) + sNewQuery=DECLARE_ASCII("_query_global:use_order:sort_prop=uiname"); + else + if( sQuery == DECLARE_ASCII("_filterquery_chartdocument") ) + sNewQuery=DECLARE_ASCII("_query_chart:use_order:sort_prop=uiname"); + else + if( sQuery == DECLARE_ASCII("_filterquery_spreadsheetdocument") ) + sNewQuery=DECLARE_ASCII("_query_calc:use_order:sort_prop=uiname"); + else + if( sQuery == DECLARE_ASCII("_filterquery_presentationdocument") ) + sNewQuery=DECLARE_ASCII("_query_impress:use_order:sort_prop=uiname"); + else + if( sQuery == DECLARE_ASCII("_filterquery_drawingdocument") ) + sNewQuery=DECLARE_ASCII("_query_draw:use_order:sort_prop=uiname"); + else + if( sQuery == DECLARE_ASCII("_filterquery_formulaproperties") ) + sNewQuery=DECLARE_ASCII("_query_math:use_order:sort_prop=uiname"); + + // Analyze query ... + // Try to find base of it and safe it for faster access as enum value! + sal_Int32 nToken = 0; + ::rtl::OUString sParam ; + ::rtl::OUString sBase = sNewQuery.getToken( 0, SEPERATOR_QUERYPARAM, nToken ); + + if( sBase.equalsIgnoreAsciiCase( BASE_QUERY_ALL ) == sal_True ) m_eQuery = E_ALL ; else + if( sBase.equalsIgnoreAsciiCase( BASE_QUERY_WRITER ) == sal_True ) m_eQuery = E_WRITER ; else + if( sBase.equalsIgnoreAsciiCase( BASE_QUERY_WEB ) == sal_True ) m_eQuery = E_WEB ; else + if( sBase.equalsIgnoreAsciiCase( BASE_QUERY_GLOBAL ) == sal_True ) m_eQuery = E_GLOBAL ; else + if( sBase.equalsIgnoreAsciiCase( BASE_QUERY_CHART ) == sal_True ) m_eQuery = E_CHART ; else + if( sBase.equalsIgnoreAsciiCase( BASE_QUERY_CALC ) == sal_True ) m_eQuery = E_CALC ; else + if( sBase.equalsIgnoreAsciiCase( BASE_QUERY_IMPRESS ) == sal_True ) m_eQuery = E_IMPRESS ; else + if( sBase.equalsIgnoreAsciiCase( BASE_QUERY_DRAW ) == sal_True ) m_eQuery = E_DRAW ; else + if( sBase.equalsIgnoreAsciiCase( BASE_QUERY_MATH ) == sal_True ) m_eQuery = E_MATH ; else + if( sBase.equalsIgnoreAsciiCase( BASE_QUERY_GRAPHICS ) == sal_True ) m_eQuery = E_GRAPHICS ; + + // Try to get additional parameters ... + while( nToken >= 0 ) + { + sParam = sNewQuery.getToken( 0, SEPERATOR_QUERYPARAM, nToken ); + // "default_first" + if( sParam.compareTo( QUERYPARAM_DEFAULT_FIRST, QUERYPARAM_DEFAULT_FIRST.getLength() ) == 0 ) + { + m_bDefaultFirst = sal_True; + } + else + // "use_order" + if( sParam.compareTo( QUERYPARAM_USE_ORDER, QUERYPARAM_USE_ORDER.getLength() ) == 0 ) + { + m_bUseOrder = sal_True; + } + else + // "descending" + if( sParam.compareTo( QUERYPARAM_DESCENDING, QUERYPARAM_DESCENDING.getLength() ) == 0 ) + { + m_bDescending = sal_True; + } + else + // "case_sensitive" + if( sParam.compareTo( QUERYPARAM_CASE_SENSITIVE, QUERYPARAM_CASE_SENSITIVE.getLength() ) == 0 ) + { + m_bCaseSensitive = sal_True; + } + else + // "iflags=<mask>" + if( sParam.compareTo( QUERYPARAM_IFLAGS, QUERYPARAM_IFLAGS.getLength() ) == 0 ) + { + sal_Int32 nSubToken = 0; + ::rtl::OUString sParamName = sParam.getToken( 0, SEPERATOR_QUERYPARAMVALUE, nSubToken ); + if( nSubToken > 0 ) + { + m_nIFlags = sParam.getToken( 0, SEPERATOR_QUERYPARAMVALUE, nSubToken ).toInt32(); + } + } + else + // "eflags=<mask>" + if( sParam.compareTo( QUERYPARAM_EFLAGS, QUERYPARAM_EFLAGS.getLength() ) == 0 ) + { + sal_Int32 nSubToken = 0; + ::rtl::OUString sParamName = sParam.getToken( 0, SEPERATOR_QUERYPARAMVALUE, nSubToken ); + if( nSubToken > 0 ) + { + m_nEFlags = sParam.getToken( 0, SEPERATOR_QUERYPARAMVALUE, nSubToken ).toInt32(); + } + } + else + // "sort_prop=<[name,uiname]>" + if( sParam.compareTo( QUERYPARAM_SORT_PROP, QUERYPARAM_SORT_PROP.getLength() ) == 0 ) + { + sal_Int32 nSubToken = 0; + ::rtl::OUString sParamName = sParam.getToken( 0, SEPERATOR_QUERYPARAMVALUE, nSubToken ); + if( nSubToken > 0 ) + { + ::rtl::OUString sParamValue = sParam.getToken( 0, SEPERATOR_QUERYPARAMVALUE, nSubToken ); + if( sParamValue.compareTo( QUERYPARAMVALUE_SORT_PROP_NAME, QUERYPARAMVALUE_SORT_PROP_NAME.getLength() ) == 0 ) + m_eSortProp = E_NAME; + else + if( sParamValue.compareTo( QUERYPARAMVALUE_SORT_PROP_UINAME, QUERYPARAMVALUE_SORT_PROP_UINAME.getLength() ) == 0 ) + m_eSortProp = E_UINAME; + } + } + } + } + + //--------------------------------------------------------------------------------------------------------- + // return type of query. User can decide then, which action should be started. + // For faster work we converted query string into corresponding enum value! + //--------------------------------------------------------------------------------------------------------- + EQuery getQueryType() const { return m_eQuery; } + + //--------------------------------------------------------------------------------------------------------- + // access to additional parameter values + // Methods return default of realy set values! + //--------------------------------------------------------------------------------------------------------- + sal_uInt32 getIFlags () const { return m_nIFlags ; } + sal_uInt32 getEFlags () const { return m_nEFlags ; } + ESortProp getSortProp () const { return m_eSortProp ; } + sal_Bool getDescending () const { return m_bDescending ; } + sal_Bool getCaseSensitive() const { return m_bCaseSensitive; } + sal_Bool getUseOrder () const { return m_bUseOrder ; } + sal_Bool getDefaultFirst () const { return m_bDefaultFirst ; } + + //--------------------------------------------------------------------------------------------------------- + // this method checks if given string match any supported query. + // (ignore additional parameters!) + //--------------------------------------------------------------------------------------------------------- + static sal_Bool isQuery( const ::rtl::OUString& sQuery ) + { + return( + ( sQuery.compareToAscii( "_query_" , 7 ) == 0 ) || // new style + ( sQuery.compareToAscii( "_filterquery_", 13 ) == 0 ) // old style! + ); + } + + private: + EQuery m_eQuery ; + sal_uInt32 m_nIFlags ; + sal_uInt32 m_nEFlags ; + ESortProp m_eSortProp ; + sal_Bool m_bDescending ; + sal_Bool m_bCaseSensitive ; + sal_Bool m_bUseOrder ; + sal_Bool m_bDefaultFirst ; + +}; // class QueryAnalyzer + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_QUERIES_H_ diff --git a/framework/inc/recording/dispatchrecorder.hxx b/framework/inc/recording/dispatchrecorder.hxx new file mode 100644 index 000000000000..c24e29c8312a --- /dev/null +++ b/framework/inc/recording/dispatchrecorder.hxx @@ -0,0 +1,88 @@ + +#ifndef __FRAMEWORK_RECORDING_DISPATCHRECORDER_HXX_ +#define __FRAMEWORK_RECORDING_DISPATCHRECORDER_HXX_ + +/** Attention: stl headers must(!) be included at first. Otherwhise it can make trouble + with solaris headers ... +*/ +#include <vector> + +// own includes +#include <threadhelp/threadhelpbase.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> +#include <macros/debug.hxx> +#include <macros/generic.hxx> +#include <general.h> +#include <rtl/ustring.hxx> +#include <rtl/ustrbuf.hxx> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/frame/XDispatchRecorder.hpp> +#include <com/sun/star/frame/DispatchStatement.hpp> +#include <com/sun/star/container/XIndexReplace.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/util/URL.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/uno/RuntimeException.hdl> +#include <com/sun/star/script/XTypeConverter.hpp> +#include <cppuhelper/weak.hxx> + +namespace framework{ + +typedef ::std::vector < com::sun::star::frame::DispatchStatement > DispatchStatementList; + +class DispatchRecorder + : private ThreadHelpBase + , public css::lang::XTypeProvider + , public css::lang::XServiceInfo + , public css::frame::XDispatchRecorder + , public css::container::XIndexReplace + , public ::cppu::OWeakObject +{ + // private member + private: + css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR ; + DispatchStatementList m_aStatements; + sal_Int32 m_nRecordingID ; + css::uno::Reference< css::script::XTypeConverter > m_xConverter; + + // public interface + public: + DispatchRecorder( const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR ); + ~DispatchRecorder(); + + // XInterface, XTypeProvider, XServiceInfo + FWK_DECLARE_XINTERFACE + FWK_DECLARE_XTYPEPROVIDER + DECLARE_XSERVICEINFO + + // XDispatchRecorder + virtual void SAL_CALL startRecording ( const css::uno::Reference< css::frame::XFrame >& xFrame ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL recordDispatch ( const css::util::URL& aURL, const css::uno::Sequence< css::beans::PropertyValue >& lArguments ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL recordDispatchAsComment( const css::util::URL& aURL, const css::uno::Sequence< css::beans::PropertyValue >& lArguments ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL endRecording () throw( css::uno::RuntimeException ); + virtual ::rtl::OUString SAL_CALL getRecordedMacro () throw( css::uno::RuntimeException ); + + 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); + + virtual sal_Int32 SAL_CALL getCount() throw (::com::sun::star::uno::RuntimeException); + + virtual com::sun::star::uno::Any SAL_CALL getByIndex(sal_Int32) throw (com::sun::star::uno::RuntimeException, com::sun::star::lang::WrappedTargetException, com::sun::star::lang::IndexOutOfBoundsException); + + virtual void SAL_CALL replaceByIndex(sal_Int32, const com::sun::star::uno::Any&) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + + // private functions + private: + void SAL_CALL implts_recordMacro( const ::rtl::OUString& aURL, + const css::uno::Sequence< css::beans::PropertyValue >& lArguments, + sal_Bool bAsComment, ::rtl::OUStringBuffer& ); + void SAL_CALL AppendToBuffer( css::uno::Any aValue, ::rtl::OUStringBuffer& aArgumentBuffer ); + +}; // class DispatcRecorder + +} // namespace framework + +#endif // define __FRAMEWORK... diff --git a/framework/inc/recording/dispatchrecordersupplier.hxx b/framework/inc/recording/dispatchrecordersupplier.hxx new file mode 100644 index 000000000000..b1fa77114b98 --- /dev/null +++ b/framework/inc/recording/dispatchrecordersupplier.hxx @@ -0,0 +1,137 @@ +/************************************************************************* + * + * 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_RECORDING_DISPATCHRECORDERSUPPLIER_HXX_ +#define __FRAMEWORK_RECORDING_DISPATCHRECORDERSUPPLIER_HXX_ + +//_________________________________________________________________________________________________________________ +// include own things + +#include <threadhelp/threadhelpbase.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> +#include <macros/debug.hxx> +#include <macros/generic.hxx> +#include <general.h> +#include <stdtypes.h> + +//_________________________________________________________________________________________________________________ +// include interfaces +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/frame/XDispatchRecorderSupplier.hpp> + +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/util/URL.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> + +//_________________________________________________________________________________________________________________ +// include other projects +#include <cppuhelper/weak.hxx> + +//_________________________________________________________________________________________________________________ +// namespace + +namespace framework{ + +//_________________________________________________________________________________________________________________ +// exported const + +//_________________________________________________________________________________________________________________ +// exported definitions + +//_______________________________________________ + +/** @short implement a supplier for dispatch recorder + @descr This supplier can be set on property "DispatchRecorderSupplier" on a frame. + By using of this supplier and his internal XDispatchRecorder it's possible to + record XDispatch::dispatch() requests. + + @threadsafe yes + */ +class DispatchRecorderSupplier : // interfaces + public css::lang::XTypeProvider , + public css::lang::XServiceInfo , + public css::frame::XDispatchRecorderSupplier , + // baseclasses + // Order is neccessary for right initialization! + private ThreadHelpBase , + public ::cppu::OWeakObject +{ + //___________________________________________ + // member + + private: + + //_______________________________________ + /** provided dispatch recorder of this supplier instance + + @life Is controled from outside. Because this variable is setted + from there and not created internaly. But we release our + reference to it if we die. + */ + css::uno::Reference< css::frame::XDispatchRecorder > m_xDispatchRecorder; + + //_______________________________________ + /** reference to the global uno service manager + */ + css::uno::Reference< css::lang::XMultiServiceFactory > m_xFactory; + + //___________________________________________ + // uno interface + + public: + + //_______________________________________ + // XInterface, XTypeProvider, XServiceInfo + + FWK_DECLARE_XINTERFACE + FWK_DECLARE_XTYPEPROVIDER + DECLARE_XSERVICEINFO + + //_______________________________________ + // XDispatchRecorderSupplier + + virtual void SAL_CALL setDispatchRecorder( const css::uno::Reference< css::frame::XDispatchRecorder >& xRecorder ) throw (css::uno::RuntimeException); + virtual css::uno::Reference< css::frame::XDispatchRecorder > SAL_CALL getDispatchRecorder( ) throw (css::uno::RuntimeException); + virtual void SAL_CALL dispatchAndRecord ( const css::util::URL& aURL , + const css::uno::Sequence< css::beans::PropertyValue >& lArguments , + const css::uno::Reference< css::frame::XDispatch >& xDispatcher ) throw (css::uno::RuntimeException); + + //___________________________________________ + // native interface + + public: + + DispatchRecorderSupplier( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory ); + ~DispatchRecorderSupplier(); + +}; // class DispatchRecorderSupplier + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_RECORDING_DISPATCHRECORDERSUPPLIER_HXX_ diff --git a/framework/inc/services.h b/framework/inc/services.h new file mode 100644 index 000000000000..bdd6221eff9c --- /dev/null +++ b/framework/inc/services.h @@ -0,0 +1,222 @@ +/************************************************************************* + * + * 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_SERVICES_H_ +#define __FRAMEWORK_SERVICES_H_ + +//_________________________________________________________________________________________________________________ +// includes +//_________________________________________________________________________________________________________________ + +#include <macros/generic.hxx> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ +// used servicenames by framework +//_________________________________________________________________________________________________________________ + +#define SERVICENAME_FRAME DECLARE_ASCII("com.sun.star.frame.Frame" ) +#define SERVICENAME_DESKTOP DECLARE_ASCII("com.sun.star.frame.Desktop" ) +#define SERVICENAME_TASK DECLARE_ASCII("com.sun.star.frame.Task" ) +#define SERVICENAME_FRAMELOADERFACTORY DECLARE_ASCII("com.sun.star.frame.FrameLoaderFactory" ) +#define SERVICENAME_FILTERFACTORY DECLARE_ASCII("com.sun.star.document.FilterFactory" ) +#define SERVICENAME_URLTRANSFORMER DECLARE_ASCII("com.sun.star.util.URLTransformer" ) +#define SERVICENAME_PLUGINFRAME DECLARE_ASCII("com.sun.star.mozilla.Plugin" ) +#define SERVICENAME_BRIDGEFACTORY DECLARE_ASCII("com.sun.star.bridge.BridgeFactory" ) +#define SERVICENAME_INIMANAGER DECLARE_ASCII("com.sun.star.config.INIManager" ) +#define SERVICENAME_MEDIATYPEDETECTIONHELPER DECLARE_ASCII("com.sun.star.frame.MediaTypeDetectionHelper" ) +#define SERVICENAME_LOGINDIALOG DECLARE_ASCII("com.sun.star.framework.LoginDialog" ) +#define SERVICENAME_CONFIGURATION DECLARE_ASCII("com.sun.star.configuration.ConfigurationRegistry" ) +#define SERVICENAME_VCLTOOLKIT DECLARE_ASCII("com.sun.star.awt.Toolkit" ) +#define SERVICENAME_SIMPLEREGISTRY DECLARE_ASCII("com.sun.star.registry.SimpleRegistry" ) +#define SERVICENAME_NESTEDREGISTRY DECLARE_ASCII("com.sun.star.registry.NestedRegistry" ) +#define SERVICENAME_GENERICFRAMELOADER DECLARE_ASCII("com.sun.star.comp.office.FilterDetect" ) +#define SERVICENAME_TYPEDETECTION DECLARE_ASCII("com.sun.star.document.TypeDetection" ) +#define SERVICENAME_DOCUMENTPROPERTIES DECLARE_ASCII("com.sun.star.document.DocumentProperties" ) +#define SERVICENAME_CFGREGISTRY DECLARE_ASCII("com.sun.star.configuration.ConfigurationRegistry" ) // describe simple registry service for read access to configuration +#define SERVICENAME_CFGPROVIDER DECLARE_ASCII("com.sun.star.configuration.ConfigurationProvider" ) // describe cfg-provider service for fatoffice, network installation +#define SERVICENAME_ADMINPROVIDER DECLARE_ASCII("com.sun.star.configuration.AdministrationProvider" ) // describe cfg-provider service for sun webtop +#define SERVICENAME_CFGUPDATEACCESS DECLARE_ASCII("com.sun.star.configuration.ConfigurationUpdateAccess") // provides read/write access to the configuration +#define SERVICENAME_CFGREADACCESS DECLARE_ASCII("com.sun.star.configuration.ConfigurationAccess" ) // provides readonly access to the configuration +#define SERVICENAME_CONTENTHANDLER DECLARE_ASCII("com.sun.star.frame.ContentHandler" ) +#define SERVICENAME_CONTENTHANDLERFACTORY DECLARE_ASCII("com.sun.star.frame.ContentHandlerFactory" ) +#define SERVICENAME_UCBCONTENTBROKER DECLARE_ASCII("com.sun.star.ucb.UniversalContentBroker" ) +#define SERVICENAME_STATUSINDICATORFACTORY DECLARE_ASCII("com.sun.star.task.StatusIndicatorFactory" ) +#define SERVICENAME_UIINTERACTIONHANDLER DECLARE_ASCII("com.sun.star.task.InteractionHandler" ) +#define SERVICENAME_JOBEXECUTOR DECLARE_ASCII("com.sun.star.task.JobExecutor" ) +#define SERVICENAME_JOB DECLARE_ASCII("com.sun.star.task.Job" ) +#define SERVICENAME_DISPATCHRECORDERSUPPLIER DECLARE_ASCII("com.sun.star.frame.DispatchRecorderSupplier" ) +#define SERVICENAME_DISPATCHRECORDER DECLARE_ASCII("com.sun.star.frame.DispatchRecorder" ) +#define SERVICENAME_SYSTEMSHELLEXECUTE DECLARE_ASCII("com.sun.star.system.SystemShellExecute" ) +#define SERVICENAME_PROTOCOLHANDLER DECLARE_ASCII("com.sun.star.frame.ProtocolHandler" ) +#define SERVICENAME_SUBSTITUTEPATHVARIABLES DECLARE_ASCII("com.sun.star.util.PathSubstitution" ) +#define SERVICENAME_PATHSETTINGS DECLARE_ASCII("com.sun.star.util.PathSettings" ) +#define SERVICENAME_DISPATCHHELPER DECLARE_ASCII("com.sun.star.frame.DispatchHelper" ) +#define SERVICENAME_DETECTORFACTORY DECLARE_ASCII("com.sun.star.document.ExtendedTypeDetectionFactory" ) +#define SERVICENAME_SCRIPTCONVERTER DECLARE_ASCII("com.sun.star.script.Converter" ) +#define SERVICENAME_LAYOUTMANAGER DECLARE_ASCII("com.sun.star.frame.LayoutManager" ) +#define SERVICENAME_POPUPMENUCONTROLLERFACTORY DECLARE_ASCII("com.sun.star.frame.PopupMenuControllerFactory" ) +#define SERVICENAME_POPUPMENUCONTROLLER DECLARE_ASCII("com.sun.star.frame.PopupMenuController" ) +#define SERVICENAME_UICOMMANDDESCRIPTION DECLARE_ASCII("com.sun.star.frame.UICommandDescription" ) +#define SERVICENAME_UIELEMENTFACTORYMANAGER DECLARE_ASCII("com.sun.star.ui.UIElementFactoryManager" ) +#define SERVICENAME_MODULEMANAGER DECLARE_ASCII("com.sun.star.frame.ModuleManager" ) +#define SERVICENAME_UICONFIGURATIONMANAGER DECLARE_ASCII("com.sun.star.ui.UIConfigurationManager" ) +#define SERVICENAME_MODULEUICONFIGURATIONMANAGERSUPPLIER DECLARE_ASCII("com.sun.star.ui.ModuleUIConfigurationManagerSupplier" ) +#define SERVICENAME_MODULEUICONFIGURATIONMANAGER DECLARE_ASCII("com.sun.star.ui.ModuleUIConfigurationManager" ) +#define SERVICENAME_MENUBARFACTORY DECLARE_ASCII("com.sun.star.ui.UIElementFactory" ) +#define SERVICENAME_WINDOWSTATECONFIGURATION DECLARE_ASCII("com.sun.star.ui.WindowStateConfiguration" ) +#define SERVICENAME_STARTMODULE DECLARE_ASCII("com.sun.star.frame.StartModule" ) +#define SERVICENAME_FRAMECONTROLLER DECLARE_ASCII("com.sun.star.frame.Controller" ) +#define SERVICENAME_GLOBALACCELERATORCONFIGURATION DECLARE_ASCII("com.sun.star.ui.GlobalAcceleratorConfiguration") +#define SERVICENAME_MODULEACCELERATORCONFIGURATION DECLARE_ASCII("com.sun.star.ui.ModuleAcceleratorConfiguration") +#define SERVICENAME_DOCUMENTACCELERATORCONFIGURATION DECLARE_ASCII("com.sun.star.ui.DocumentAcceleratorConfiguration") +#define SERVICENAME_SAXPARSER DECLARE_ASCII("com.sun.star.xml.sax.Parser" ) +#define SERVICENAME_SAXWRITER DECLARE_ASCII("com.sun.star.xml.sax.Writer" ) +#define SERVICENAME_SIMPLEFILEACCESS DECLARE_ASCII("com.sun.star.ucb.SimpleFileAccess" ) +#define SERVICENAME_STORAGEFACTORY DECLARE_ASCII("com.sun.star.embed.StorageFactory" ) +#define SERVICENAME_FILESYSTEMSTORAGEFACTORY DECLARE_ASCII("com.sun.star.embed.FileSystemStorageFactory" ) +#define SERVICENAME_TEMPFILE DECLARE_ASCII("com.sun.star.io.TempFile" ) +#define SERVICENAME_PACKAGESTRUCTURECREATOR DECLARE_ASCII("com.sun.star.embed.PackageStructureCreator" ) +#define SERVICENAME_TOOLBARFACTORY DECLARE_ASCII("com.sun.star.ui.ToolBarFactory" ) +#define SERVICENAME_TOOLBARCONTROLLERFACTORY DECLARE_ASCII("com.sun.star.frame.ToolBarControllerFactory" ) +#define SERVICENAME_LICENSE SERVICENAME_JOB +#define SERVICENAME_AUTORECOVERY DECLARE_ASCII("com.sun.star.frame.AutoRecovery" ) +#define SERVICENAME_GLOBALEVENTBROADCASTER DECLARE_ASCII("com.sun.star.frame.GlobalEventBroadcaster" ) +#define SERVICENAME_STATUSBARFACTORY DECLARE_ASCII("com.sun.star.ui.StatusBarFactory" ) +#define SERVICENAME_UICATEGORYDESCRIPTION DECLARE_ASCII("com.sun.star.ui.UICategoryDescription" ) +#define SERVICENAME_STATUSBARCONTROLLERFACTORY DECLARE_ASCII("com.sun.star.frame.StatusbarControllerFactory" ) +#define SERVICENAME_SESSIONLISTENER DECLARE_ASCII("com.sun.star.frame.SessionListener" ) +#define SERVICENAME_STATUSBARCONTROLLER DECLARE_ASCII("com.sun.star.frame.StatusbarController" ) +#define SERVICENAME_TABREG DECLARE_ASCII("com.sun.star.tab.tabreg" ) +#define SERVICENAME_TASKCREATOR DECLARE_ASCII("com.sun.star.frame.TaskCreator" ) +#define SERVICENAME_TABWINFACTORY DECLARE_ASCII("com.sun.star.frame.TabWindowFactory" ) +#define SERVICENAME_TABWINDOW DECLARE_ASCII("com.sun.star.frame.TabWindow" ) +#define SERVICENAME_STRINGABBREVIATION DECLARE_ASCII("com.sun.star.util.UriAbbreviation" ) +#define SERVICENAME_IMAGEMANAGER DECLARE_ASCII("com.sun.star.ui.ImageManager" ) +#define SERVICENAME_TABWINDOWSERVICE DECLARE_ASCII("com.sun.star.ui.dialogs.TabContainerWindow" ) +#define SERVICENAME_WINDOWCONTENTFACTORYMANAGER DECLARE_ASCII("com.sun.star.ui.WindowContentFactoryManager" ) +#define SERVICENAME_DISPLAYACCESS DECLARE_ASCII("com.sun.star.awt.DisplayAccess" ) +#define SERVICENAME_PANELFACTORY DECLARE_ASCII("com.sun.star.ui.PanelFactory" ) +#define SERVICENAME_MODELWINSERVICE DECLARE_ASCII("com.sun.star.ui.ModelWinService" ) + +//_________________________________________________________________________________________________________________ +// used implementationnames by framework +//_________________________________________________________________________________________________________________ + +#define IMPLEMENTATIONNAME_FRAME DECLARE_ASCII("com.sun.star.comp.framework.Frame" ) +#define IMPLEMENTATIONNAME_DESKTOP DECLARE_ASCII("com.sun.star.comp.framework.Desktop" ) +#define IMPLEMENTATIONNAME_TASK DECLARE_ASCII("com.sun.star.comp.framework.Task" ) +//#define IMPLEMENTATIONNAME_FRAMELOADERFACTORY DECLARE_ASCII("com.sun.star.comp.framework.FrameLoaderFactory" ) +//#define IMPLEMENTATIONNAME_FILTERFACTORY DECLARE_ASCII("com.sun.star.comp.framework.FilterFactory" ) +#define IMPLEMENTATIONNAME_URLTRANSFORMER DECLARE_ASCII("com.sun.star.comp.framework.URLTransformer" ) +// #define IMPLEMENTATIONNAME_PLUGINFRAME DECLARE_ASCII("com.sun.star.comp.framework.PluginFrame" ) +#define IMPLEMENTATIONNAME_GENERICFRAMELOADER DECLARE_ASCII("com.sun.star.comp.office.FrameLoader" ) +#define IMPLEMENTATIONNAME_MEDIATYPEDETECTIONHELPER DECLARE_ASCII("com.sun.star.comp.framework.MediaTypeDetectionHelper") +//#define IMPLEMENTATIONNAME_LOGINDIALOG DECLARE_ASCII("com.sun.star.comp.framework.LoginDialog" ) +//#define IMPLEMENTATIONNAME_TYPEDETECTION DECLARE_ASCII("com.sun.star.comp.framework.TypeDetection" ) +//#define IMPLEMENTATIONNAME_DOCUMENTPROPERTIES DECLARE_ASCII("com.sun.star.comp.framework.DocumentProperties" ) +#define IMPLEMENTATIONNAME_OXT_HANDLER DECLARE_ASCII("com.sun.star.comp.framework.OXTFileHandler" ) +//#define IMPLEMENTATIONNAME_CONTENTHANDLERFACTORY DECLARE_ASCII("com.sun.star.comp.framework.ContentHandlerFactory" ) +#define IMPLEMENTATIONNAME_SFXTERMINATOR DECLARE_ASCII("com.sun.star.comp.sfx2.SfxTerminateListener" ) +#define IMPLEMENTATIONNAME_PIPETERMINATOR DECLARE_ASCII("com.sun.star.comp.OfficeIPCThreadController" ) +#define IMPLEMENTATIONNAME_QUICKLAUNCHER DECLARE_ASCII("com.sun.star.comp.desktop.QuickstartWrapper" ) +#define IMPLEMENTATIONNAME_SWTHREADMANAGER DECLARE_ASCII("com.sun.star.util.comp.FinalThreadManager" ) +#define IMPLEMENTATIONNAME_JOBEXECUTOR DECLARE_ASCII("com.sun.star.comp.framework.JobExecutor" ) +#define IMPLEMENTATIONNAME_DISPATCHRECORDERSUPPLIER DECLARE_ASCII("com.sun.star.comp.framework.DispatchRecorderSupplier") +#define IMPLEMENTATIONNAME_DISPATCHRECORDER DECLARE_ASCII("com.sun.star.comp.framework.DispatchRecorder" ) +#define IMPLEMENTATIONNAME_MAILTODISPATCHER DECLARE_ASCII("com.sun.star.comp.framework.MailToDispatcher" ) +#define IMPLEMENTATIONNAME_SERVICEHANDLER DECLARE_ASCII("com.sun.star.comp.framework.ServiceHandler" ) +#define IMPLEMENTATIONNAME_UIINTERACTIONHANDLER DECLARE_ASCII("com.sun.star.comp.uui.UUIInteractionHandler" ) +#define IMPLEMENTATIONNAME_SUBSTITUTEPATHVARIABLES DECLARE_ASCII("com.sun.star.comp.framework.PathSubstitution" ) +#define IMPLEMENTATIONNAME_PATHSETTINGS DECLARE_ASCII("com.sun.star.comp.framework.PathSettings" ) +#define IMPLEMENTATIONNAME_JOBDISPATCH DECLARE_ASCII("com.sun.star.comp.framework.jobs.JobDispatch" ) +#define IMPLEMENTATIONNAME_DISPATCHHELPER DECLARE_ASCII("com.sun.star.comp.framework.services.DispatchHelper" ) +//#define IMPLEMENTATIONNAME_DETECTORFACTORY DECLARE_ASCII("com.sun.star.comp.framework.DetectorFactory" ) +#define IMPLEMENTATIONNAME_LAYOUTMANAGER DECLARE_ASCII("com.sun.star.comp.framework.LayoutManager" ) +#define IMPLEMENTATIONNAME_POPUPMENUCONTROLLERFACTORY DECLARE_ASCII("com.sun.star.comp.framework.PopupMenuControllerFactory" ) +#define IMPLEMENTATIONNAME_MACROSMENUCONTROLLER DECLARE_ASCII("com.sun.star.comp.framework.MacrosMenuController" ) +#define IMPLEMENTATIONNAME_FONTMENUCONTROLLER DECLARE_ASCII("com.sun.star.comp.framework.FontMenuController" ) +#define IMPLEMENTATIONNAME_FONTSIZEMENUCONTROLLER DECLARE_ASCII("com.sun.star.comp.framework.FontSizeMenuController" ) +// #define IMPLEMENTATIONNAME_FORMATMENUCONTROLLER DECLARE_ASCII("com.sun.star.comp.framework.FormatMenuController" ) +#define IMPLEMENTATIONNAME_OBJECTMENUCONTROLLER DECLARE_ASCII("com.sun.star.comp.framework.ObjectMenuController" ) +#define IMPLEMENTATIONNAME_HEADERMENUCONTROLLER DECLARE_ASCII("com.sun.star.comp.framework.HeaderMenuController" ) +#define IMPLEMENTATIONNAME_FOOTERMENUCONTROLLER DECLARE_ASCII("com.sun.star.comp.framework.FooterMenuController" ) +#define IMPLEMENTATIONNAME_CONTROLMENUCONTROLLER DECLARE_ASCII("com.sun.star.comp.framework.ControlMenuController" ) +#define IMPLEMENTATIONNAME_NEWMENUCONTROLLER DECLARE_ASCII("com.sun.star.comp.framework.NewMenuController" ) +#define IMPLEMENTATIONNAME_UICOMMANDDESCRIPTION DECLARE_ASCII("com.sun.star.comp.framework.UICommandDescription" ) +#define IMPLEMENTATIONNAME_UIELEMENTFACTORYMANAGER DECLARE_ASCII("com.sun.star.comp.framework.UIElementFactoryManager" ) +#define IMPLEMENTATIONNAME_MODULEMANAGER DECLARE_ASCII("com.sun.star.comp.framework.ModuleManager" ) +#define IMPLEMENTATIONNAME_UICONFIGURATIONMANAGER DECLARE_ASCII("com.sun.star.comp.framework.UIConfigurationManager" ) +#define IMPLEMENTATIONNAME_MODULEUICONFIGURATIONMANAGERSUPPLIER DECLARE_ASCII("com.sun.star.comp.framework.ModuleUIConfigurationManagerSupplier" ) +#define IMPLEMENTATIONNAME_MODULEUICONFIGURATIONMANAGER DECLARE_ASCII("com.sun.star.comp.framework.ModuleUIConfigurationManager" ) +#define IMPLEMENTATIONNAME_MENUBARFACTORY DECLARE_ASCII("com.sun.star.comp.framework.MenuBarFactory" ) +#define IMPLEMENTATIONNAME_STARTMODULE DECLARE_ASCII("com.sun.star.comp.framework.BackingComp" ) +#define IMPLEMENTATIONNAME_GLOBALACCELERATORCONFIGURATION DECLARE_ASCII("com.sun.star.comp.framework.GlobalAcceleratorConfiguration") +#define IMPLEMENTATIONNAME_MODULEACCELERATORCONFIGURATION DECLARE_ASCII("com.sun.star.comp.framework.ModuleAcceleratorConfiguration") +#define IMPLEMENTATIONNAME_DOCUMENTACCELERATORCONFIGURATION DECLARE_ASCII("com.sun.star.comp.framework.DocumentAcceleratorConfiguration") +#define IMPLEMENTATIONNAME_WINDOWSTATECONFIGURATION DECLARE_ASCII("com.sun.star.comp.framework.WindowStateConfiguration" ) +#define IMPLEMENTATIONNAME_TOOLBARFACTORY DECLARE_ASCII("com.sun.star.comp.framework.ToolBarFactory" ) +#define IMPLEMENTATIONNAME_ADDONSTOOLBARFACTORY DECLARE_ASCII("com.sun.star.comp.framework.AddonsToolBarFactory" ) +#define IMPLEMENTATIONNAME_TOOLBARSMENUCONTROLLER DECLARE_ASCII("com.sun.star.comp.framework.ToolBarsMenuController" ) +#define IMPLEMENTATIONNAME_TOOLBARCONTROLLERFACTORY DECLARE_ASCII("com.sun.star.comp.framework.ToolBarControllerFactory" ) +#define IMPLEMENTATIONNAME_LICENSE DECLARE_ASCII("com.sun.star.comp.framework.License" ) +#define IMPLEMENTATIONNAME_AUTORECOVERY DECLARE_ASCII("com.sun.star.comp.framework.AutoRecovery" ) +#define IMPLEMENTATIONNAME_STATUSINDICATORFACTORY DECLARE_ASCII("com.sun.star.comp.framework.StatusIndicatorFactory" ) +#define IMPLEMENTATIONNAME_RECENTFILESMENUCONTROLLER DECLARE_ASCII("com.sun.star.comp.framework.RecentFilesMenuController" ) +#define IMPLEMENTATIONNAME_STATUSBARFACTORY DECLARE_ASCII("com.sun.star.comp.framework.StatusBarFactory" ) +#define IMPLEMENTATIONNAME_STATUSBARCONTROLLERFACTORY DECLARE_ASCII("com.sun.star.comp.framework.StatusBarControllerFactory" ) +#define IMPLEMENTATIONNAME_UICATEGORYDESCRIPTION DECLARE_ASCII("com.sun.star.comp.framework.UICategoryDescription" ) +#define IMPLEMENTATIONNAME_APPDISPATCHPROVIDER DECLARE_ASCII("com.sun.star.comp.sfx2.AppDispatchProvider" ) +#define IMPLEMENTATIONNAME_SESSIONLISTENER DECLARE_ASCII("com.sun.star.comp.frame.SessionListener" ) +#define IMPLEMENTATIONNAME_HELPONSTARTUP DECLARE_ASCII("com.sun.star.comp.framework.HelpOnStartup" ) +#define IMPLEMENTATIONNAME_SHELLJOB DECLARE_ASCII("com.sun.star.comp.framework.ShellJob" ) +#define IMPLEMENTATIONNAME_LOGOIMAGESTATUSBARCONTROLLER DECLARE_ASCII("com.sun.star.comp.framework.LogoImageStatusbarController" ) +#define IMPLEMENTATIONNAME_LOGOTEXTSTATUSBARCONTROLLER DECLARE_ASCII("com.sun.star.comp.framework.LogoTextStatusbarController" ) +#define IMPLEMENTATIONNAME_FWK_TASKCREATOR DECLARE_ASCII("com.sun.star.comp.framework.TaskCreator" ) +#define IMPLEMENTATIONNAME_TABWINFACTORY DECLARE_ASCII("com.sun.star.comp.framework.TabWindowFactory" ) +#define IMPLEMENTATIONNAME_TABWINDOW DECLARE_ASCII("com.sun.star.comp.framework.TabWindow" ) +#define IMPLEMENTATIONNAME_SYSTEMEXEC DECLARE_ASCII("com.sun.star.comp.framework.SystemExecute" ) +#define IMPLEMENTATIONNAME_SIMPLETEXTSTATUSBARCONTROLLER DECLARE_ASCII("com.sun.star.comp.framework.SimpleTextStatusbarController" ) +#define IMPLEMENTATIONNAME_URIABBREVIATION DECLARE_ASCII("com.sun.star.comp.framework.UriAbbreviation" ) +#define IMPLEMENTATIONNAME_POPUPMENUDISPATCHER DECLARE_ASCII("com.sun.star.comp.framework.PopupMenuControllerDispatcher" ) +#define IMPLEMENTATIONNAME_LANGSELECTIONSTATUSBARCONTROLLER DECLARE_ASCII("com.sun.star.comp.framework.LangSelectionStatusbarController" ) +#define IMPLEMENTATIONNAME_LANGUAGESELECTIONMENUCONTROLLER DECLARE_ASCII("com.sum.star.comp.framework.LanguageSelectionMenuController" ) +#define IMPLEMENTATIONNAME_IMAGEMANAGER DECLARE_ASCII("com.sun.star.comp.framework.ImageManager" ) +#define IMPLEMENTATIONNAME_TABWINDOWSERVICE DECLARE_ASCII("com.sun.star.comp.framework.TabWindowService" ) +#define IMPLEMENTATIONNAME_WINDOWCONTENTFACTORYMANAGER DECLARE_ASCII("com.sun.star.comp.framework.WindowContentFactoryManager" ) +#define IMPLEMENTATIONNAME_PANELFACTORY DECLARE_ASCII("com.sun.star.comp.framework.PanelFactory" ) +#define IMPLEMENTATIONNAME_MODELWINSERVICE DECLARE_ASCII("com.sun.star.comp.framework.ModelWinService" ) + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_SERVICES_H_ + diff --git a/framework/inc/services/autorecovery.hxx b/framework/inc/services/autorecovery.hxx new file mode 100644 index 000000000000..ef35522333a9 --- /dev/null +++ b/framework/inc/services/autorecovery.hxx @@ -0,0 +1,1022 @@ +/************************************************************************* + * + * 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_SERVICES_AUTORECOVERY_HXX_ +#define __FRAMEWORK_SERVICES_AUTORECOVERY_HXX_ + +//_______________________________________________ +// own includes + +#include <threadhelp/threadhelpbase.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> +#include <general.h> +#include <stdtypes.h> + +//_______________________________________________ +// interface includes +#include <com/sun/star/uno/XInterface.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/document/XEventListener.hpp> +#include <com/sun/star/document/XEventBroadcaster.hpp> +#include <com/sun/star/frame/XModel.hpp> +#include <com/sun/star/util/XChangesListener.hpp> +#include <com/sun/star/task/XStatusIndicator.hpp> +#include <com/sun/star/util/XModifyListener.hpp> + +//_______________________________________________ +// other includes +#include <comphelper/mediadescriptor.hxx> +#include <vcl/timer.hxx> +#include <vcl/evntpost.hxx> +#include <cppuhelper/interfacecontainer.hxx> +#include <cppuhelper/propshlp.hxx> +#include <cppuhelper/weak.hxx> + +//_______________________________________________ +// definition + +#ifndef css +namespace css = ::com::sun::star; +#endif + +namespace framework +{ + +//--------------------------------------- +/** @short hold all needed informations for an asynchronous dispatch alive. + + @descr Because some operations are forced to be executed asynchronously + (e.g. requested by our CreashSave/Recovery dialog) ... we must make sure + that these informations wont be set as "normal" members of our AtoRecovery + instance. Otherwise they can disturb our normal AutoSave-timer handling. + e.g. it can be unclear then, which progress has to be used for storing documents ... + */ +struct DispatchParams +{ + public: + DispatchParams(); + DispatchParams(const ::comphelper::SequenceAsHashMap& lArgs , + const css::uno::Reference< css::uno::XInterface >& xOwner); + DispatchParams(const DispatchParams& rCopy); + ~DispatchParams(); + + DispatchParams& operator=(const DispatchParams& rCopy); + void forget(); + + public: + + //--------------------------------------- + /** @short can be set from outside and is provided to + our internal started operations. + + @descr Normaly we use the normal status indicator + of the document windows to show a progress. + But in case we are used by any special UI, + it can provide its own status indicator object + to us - so we use it instead of the normal one. + */ + css::uno::Reference< css::task::XStatusIndicator > m_xProgress; + + //--------------------------------------- + /** TODO document me */ + ::rtl::OUString m_sSavePath; + + //--------------------------------------- + /** @short define the current cache entry, which should be used for current + backup or cleanUp operation ... which is may be done asynchronous */ + sal_Int32 m_nWorkingEntryID; + + //--------------------------------------- + /** @short used for asyncoperations, to prevent us from dying. + + @descr If our dispatch() method was forced to start the + internal operation asynchronous ... we send an event + to start and return immediatly. But we must be shure that + our instance live if the event callback reach us. + So we hold an uno reference to ourself. + */ + css::uno::Reference< css::uno::XInterface > m_xHoldRefForAsyncOpAlive; +}; + +//_______________________________________________ +/** + implements the functionality of AutoSave and AutoRecovery + of documents - including features of an EmergencySave in + case a GPF occures. + */ +class AutoRecovery : public css::lang::XTypeProvider + , public css::lang::XServiceInfo + , public css::frame::XDispatch + , public css::document::XEventListener // => css.lang.XEventListener + , public css::util::XChangesListener // => css.lang.XEventListener + , public css::util::XModifyListener // => css.lang.XEventListener + // attention! Must be the first base class to guarentee right initialize lock ... + , private ThreadHelpBase + , public ::cppu::OBroadcastHelper + , public ::cppu::OPropertySetHelper // => XPropertySet, XFastPropertySet, XMultiPropertySet + , public ::cppu::OWeakObject +{ + //___________________________________________ + // types + + public: + + /** These values are used as flags and represent the current state of a document. + Every state of the life time of a document has to be recognized here. + + @attention Do not change (means reorganize) already used numbers. + There exists some code inside SVX, which uses the same numbers, + to analyze such document states. + Not the best design ... but may be it will be changed later .-) + */ + enum EDocStates + { + /* TEMP STATES */ + + /// default state, if a document was new created or loaded + E_UNKNOWN = 0, + /// modified against the original file + E_MODIFIED = 1, + /// an active document can be postponed to be saved later. + E_POSTPONED = 2, + /// was already handled during one AutoSave/Recovery session. + E_HANDLED = 4, + /** an action was started (saving/loading) ... Can be interesting later if the process may be was interrupted by an exception. */ + E_TRY_SAVE = 8, + E_TRY_LOAD_BACKUP = 16, + E_TRY_LOAD_ORIGINAL = 32, + + /* FINAL STATES */ + + /// the Auto/Emergency saved document isnt useable any longer + E_DAMAGED = 64, + /// the Auto/Emergency saved document isnt realy up-to-date (some changes can be missing) + E_INCOMPLETE = 128, + /// the Auto/Emergency saved document was processed successfully + E_SUCCEDED = 512 + }; + + /** @short indicates the results of a FAILURE_SAFE operation + + @descr We must know, which reason was the real one in case + we couldnt copy a "failure document" to a user specified path. + We must know, if we can forget our cache entry or not. + */ + enum EFailureSafeResult + { + E_COPIED, + E_ORIGINAL_FILE_MISSING, + E_WRONG_TARGET_PATH + }; + + // TODO document me + enum ETimerType + { + /** the timer shouldnt be used next time */ + E_DONT_START_TIMER, + /** timer (was/must be) started with normal AutoSaveTimeIntervall */ + E_NORMAL_AUTOSAVE_INTERVALL, + /** timer must be started with special short time intervall, + to poll for an user idle period */ + E_POLL_FOR_USER_IDLE, + /** timer mst be started with a very(!) short time intervall, + to poll for the end of an user action, which does not allow saving documents in general */ + E_POLL_TILL_AUTOSAVE_IS_ALLOWED, + /** dont start the timer - but calls the same action then before immediatly again! */ + E_CALL_ME_BACK + }; + + // TODO document me ... flag field + // Emergency_Save and Recovery overwrites Auto_Save! + enum EJob + { + E_NO_JOB = 0, + E_AUTO_SAVE = 1, + E_EMERGENCY_SAVE = 2, + E_RECOVERY = 4, + E_ENTRY_BACKUP = 8, + E_ENTRY_CLEANUP = 16, + E_PREPARE_EMERGENCY_SAVE = 32, + E_SESSION_SAVE = 64, + E_SESSION_RESTORE = 128, + E_DISABLE_AUTORECOVERY = 256, + E_SET_AUTOSAVE_STATE = 512, + E_SESSION_QUIET_QUIT = 1024 + }; + + //--------------------------------------- + /** @short combine different informations about one office document. */ + struct TDocumentInfo + { + public: + + //------------------------------- + TDocumentInfo() + : DocumentState (E_UNKNOWN) + , UsedForSaving (sal_False) + , ListenForModify (sal_False) + , IgnoreClosing (sal_False) + , ID (-1 ) + {} + + //------------------------------- + /** @short points to the document. */ + css::uno::Reference< css::frame::XModel > Document; + + //------------------------------- + /** @short knows, if the document is realy modified since the last autosave, + or was postponed, because it was an active one etcpp... + + @descr Because we have no CHANGE TRACKING mechanism, based on office document, + we implements it by ourself. We listen for MODIFIED events + of each document and update this state flag here. + + Further we postpone saving of active documents, e.g. if the user + works currently on it. We wait for an idle period then ... + */ + sal_Int32 DocumentState; + + //------------------------------- + /** Because our applications not ready for concurrent save requests at the same time, + we have supress our own AutoSave for the moment, a document will be already saved + by others. + */ + sal_Bool UsedForSaving; + + //------------------------------- + /** For every user action, which modifies a document (e.g. key input) we get + a notification as XModifyListener. That seams to be a "performance issue" .-) + So we decided to listen for such modify events only for the time in which the document + was stored as temp. file and was not modified again by the user. + */ + sal_Bool ListenForModify; + + //------------------------------- + /** For SessionSave we must close all open documents by ourself. + But because we are listen for documents events, we get some ... + and deregister these documents from our configuration. + That's why we mark these documents as "Closed by ourself" so we can + ignore these "OnUnload" or disposing() events .-) + */ + sal_Bool IgnoreClosing; + + //------------------------------- + /** TODO: document me */ + ::rtl::OUString OrgURL; + ::rtl::OUString FactoryURL; + ::rtl::OUString TemplateURL; + + ::rtl::OUString OldTempURL; + ::rtl::OUString NewTempURL; + + ::rtl::OUString AppModule; // e.g. com.sun.star.text.TextDocument - used to identify app module + ::rtl::OUString FactoryService; // the service to create a document of the module + ::rtl::OUString RealFilter; // real filter, which was used at loading time + ::rtl::OUString DefaultFilter; // supports saving of the default format without loosing data + ::rtl::OUString Extension; // file extension of the default filter + ::rtl::OUString Title; // can be used as "DisplayName" on every recovery UI! + ::com::sun::star::uno::Sequence< ::rtl::OUString > + ViewNames; // names of the view which were active at emergency-save time + + sal_Int32 ID; + }; + + //--------------------------------------- + /** @short used to know every currently open document. */ + typedef ::std::vector< TDocumentInfo > TDocumentList; + + //___________________________________________ + // member + + private: + + //--------------------------------------- + /** @short the global uno service manager. + @descr Must be used to create own needed services. + */ + css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR; + + //--------------------------------------- + /** @short points to the underlying recovery configuration. + @descr This instance does not cache - it calls directly the + configuration API! + */ + css::uno::Reference< css::container::XNameAccess > m_xRecoveryCFG; + + //--------------------------------------- + /** @short points to the used configuration package or.openoffice.Setup + @descr This instance does not cache - it calls directly the + configuration API! + */ + css::uno::Reference< css::container::XNameAccess > m_xModuleCFG; + + //--------------------------------------- + /** @short holds the global event broadcaster alive, + where we listen for new created documents. + */ + css::uno::Reference< css::document::XEventBroadcaster > m_xNewDocBroadcaster; + + //--------------------------------------- + /** @short because we stop/restart listening sometimes, it's a good idea to know + if we already registered as listener .-) + */ + sal_Bool m_bListenForDocEvents; + sal_Bool m_bListenForConfigChanges; + + //--------------------------------------- + /** @short specify the time intervall between two save actions. + @descr Time is measured in [min]. + */ + sal_Int32 m_nAutoSaveTimeIntervall; + + //--------------------------------------- + /** @short for an asynchronous operation we must know, if there is + at least one running job (may be asynchronous!). + */ + sal_Int32 m_eJob; + + //--------------------------------------- + /** @short the timer, which is used to be informed about the next + saving time ... + */ + Timer m_aTimer; + + //--------------------------------------- + /** @short make our dispatch asynchronous ... if required to do so! */ + ::vcl::EventPoster m_aAsyncDispatcher; + + //--------------------------------------- + /** @see DispatchParams + */ + DispatchParams m_aDispatchParams; + + //--------------------------------------- + /** @short indicates, which time period is currently used by the + internal timer. + */ + ETimerType m_eTimerType; + + //--------------------------------------- + /** @short this cache is used to hold all informations about + recovery/emergency save documents alive. + */ + TDocumentList m_lDocCache; + + //--------------------------------------- + // TODO document me + sal_Int32 m_nIdPool; + + //--------------------------------------- + /** @short contains all status listener registered at this instance. + */ + ListenerHash m_lListener; + + /** @descr This member is used to prevent us against re-entrance problems. + A mutex cant help to prevent us from concurrent using of members + inside the same thread. But e.g. our internaly used stl structures + are not threadsafe ... and furthermore they cant be used at the same time + for iteration and add/remove requests! + So we have to detect such states and ... show a warning. + May be there will be a better solution next time ... (copying the cache temp. + bevor using). + + And further it's not possible to use a simple boolean value here. + Because if more then one operation iterates over the same stl container ... + (only to modify it's elements but dont add new or removing existing ones!) + it should be possible doing so. But we must guarantee that the last operation reset + this lock ... not the first one ! So we use a "ref count" mechanism for that." + */ + sal_Int32 m_nDocCacheLock; + + /** @descr These members are used to check the minimum disc space, which must exists + to start the corresponding operation. + */ + sal_Int32 m_nMinSpaceDocSave; + sal_Int32 m_nMinSpaceConfigSave; + + //--------------------------------------- + /** @short special debug option to make testing faster. + + @descr We dont interpret the timer unit as [min] ... + we use [ms] instead of that. Further we dont + wait 10 s for user idle ... + */ + #if OSL_DEBUG_LEVEL > 1 + sal_Bool m_dbg_bMakeItFaster; + #endif + + //--------------------------------------- + // HACK ... TODO + css::uno::Reference< css::task::XStatusIndicator > m_xExternalProgress; + + //___________________________________________ + // interface + + public: + + AutoRecovery(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR); + virtual ~AutoRecovery( ); + + // XInterface, XTypeProvider, XServiceInfo + FWK_DECLARE_XINTERFACE + FWK_DECLARE_XTYPEPROVIDER + DECLARE_XSERVICEINFO + + //--------------------------------------- + // css.frame.XDispatch + virtual void SAL_CALL dispatch(const css::util::URL& aURL , + const css::uno::Sequence< css::beans::PropertyValue >& lArguments) + throw(css::uno::RuntimeException); + + virtual void SAL_CALL addStatusListener(const css::uno::Reference< css::frame::XStatusListener >& xListener, + const css::util::URL& aURL ) + throw(css::uno::RuntimeException); + + virtual void SAL_CALL removeStatusListener(const css::uno::Reference< css::frame::XStatusListener >& xListener, + const css::util::URL& aURL ) + throw(css::uno::RuntimeException); + + //--------------------------------------- + // css.document.XEventListener + /** @short informs about created/opened documents. + + @descr Every new opened/created document will be saved internaly + so it can be checked if its modified. This modified state + is used later to decide, if it must be saved or not. + + @param aEvent + points to the new created/opened document. + */ + virtual void SAL_CALL notifyEvent(const css::document::EventObject& aEvent) + throw(css::uno::RuntimeException); + + //--------------------------------------- + // css.util.XChangesListener + virtual void SAL_CALL changesOccurred(const css::util::ChangesEvent& aEvent) + throw(css::uno::RuntimeException); + + //--------------------------------------- + // css.util.XModifyListener + virtual void SAL_CALL modified(const css::lang::EventObject& aEvent) + throw(css::uno::RuntimeException); + + //--------------------------------------- + // css.lang.XEventListener + using cppu::OPropertySetHelper::disposing; + virtual void SAL_CALL disposing(const css::lang::EventObject& aEvent) + throw(css::uno::RuntimeException); + + //___________________________________________ + // helper + + protected: + + //--------------------------------------- + // OPropertySetHelper + + virtual sal_Bool SAL_CALL convertFastPropertyValue( css::uno::Any& aConvertedValue, + css::uno::Any& aOldValue , + sal_Int32 nHandle , + const css::uno::Any& aValue ) + throw(css::lang::IllegalArgumentException); + + virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, + const css::uno::Any& aValue ) + throw(css::uno::Exception); + using cppu::OPropertySetHelper::getFastPropertyValue; + virtual void SAL_CALL getFastPropertyValue(css::uno::Any& aValue , + sal_Int32 nHandle) const; + + virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); + + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() + throw(css::uno::RuntimeException); + //___________________________________________ + // helper + + private: + + //--------------------------------------- + /** @short open the underlying configuration. + + @descr This method must be called everytimes + a configuartion call is needed. Because + method works together with the member + m_xCFG, open it on demand and cache it + afterwards. + + @return [com.sun.star.container.XNameAccess] + the configuration object + + @throw [com.sun.star.uno.RuntimeException] + if config could not be opened successfully! + + @threadsafe + */ + css::uno::Reference< css::container::XNameAccess > implts_openConfig(); + + //--------------------------------------- + /** @short read the underlying configuration. + + @descr After that we know the initial state - means: + - if AutoSave was enabled by the user + - which time intervall has to be used + - which recovery entries may already exists + + @throw [com.sun.star.uno.RuntimeException] + if config could not be opened or readed successfully! + + @threadsafe + */ + void implts_readConfig(); + + //--------------------------------------- + /** @short read the underlying configuration... + + @descr ... but only keys related to the AutoSave mechanism. + Means: State and Timer intervall. + E.g. the recovery list isnt adressed here. + + @throw [com.sun.star.uno.RuntimeException] + if config could not be opened or readed successfully! + + @threadsafe + */ + void implts_readAutoSaveConfig(); + + //--------------------------------------- + // TODO document me + void implts_flushConfigItem(const AutoRecovery::TDocumentInfo& rInfo , + sal_Bool bRemoveIt = sal_False); + + //--------------------------------------- + // TODO document me + void implts_startListening(); + void implts_startModifyListeningOnDoc(AutoRecovery::TDocumentInfo& rInfo); + + //--------------------------------------- + // TODO document me + void implts_stopListening(); + void implts_stopModifyListeningOnDoc(AutoRecovery::TDocumentInfo& rInfo); + + //--------------------------------------- + /** @short stops and may be(!) restarts the timer. + + @descr A running timer is stopped everytimes here. + But starting depends from the different internal + timer variables (e.g. AutoSaveEnabled, AutoSaveTimeIntervall, + TimerType etcpp.) + + @throw [com.sun.star.uno.RuntimeException] + if timer could not be stopped or started! + + @threadsafe + */ + void implts_updateTimer(); + + //--------------------------------------- + /** @short stop the timer. + + @descr Double calls will be ignored - means we do + nothing here, if the timer is already disabled. + + @throw [com.sun.star.uno.RuntimeException] + if timer could not be stopped! + + @threadsafe + */ + void implts_stopTimer(); + + //--------------------------------------- + /** @short callback of our internal timer. + */ + DECL_LINK(implts_timerExpired, void*); + + //--------------------------------------- + /** @short makes our dispatch() method asynchronous! + */ + DECL_LINK(implts_asyncDispatch, void*); + + //--------------------------------------- + /** @short implements the dispatch real. */ + void implts_dispatch(const DispatchParams& aParams); + + //--------------------------------------- + /** @short validate new detected document and add it into the internal + document list. + + @descr This method should be called only, if its clear that a new + document was opened/created during office runtime. + This method checks, if its a top level document (means not an embedded one). + Only such top level documents can be recognized by this auto save mechanism. + + @param xDocument + the new document, which should be checked and registered. + + @threadsafe + */ + void implts_registerDocument(const css::uno::Reference< css::frame::XModel >& xDocument); + + //--------------------------------------- + /** @short remove the specified document from our internal document list. + + @param xDocument + the new document, which should be deregistered. + + @param bStopListening + sal_False: must be used in case this method is called withion disposing() of the document, + where it make no sense to deregister our listener. The container dies ... + sal_True : must be used in case this method is used on "dergistration" of this document, where + we must deregister our listener .-) + + @threadsafe + */ + void implts_deregisterDocument(const css::uno::Reference< css::frame::XModel >& xDocument , + sal_Bool bStopListening = sal_True); + + //--------------------------------------- + // TODO document me + void implts_markDocumentModifiedAgainstLastBackup(const css::uno::Reference< css::frame::XModel >& xDocument); + + //--------------------------------------- + // TODO document me + void implts_updateModifiedState(const css::uno::Reference< css::frame::XModel >& xDocument); + + //--------------------------------------- + // TODO document me + void implts_updateDocumentUsedForSavingState(const css::uno::Reference< css::frame::XModel >& xDocument , + sal_Bool bSaveInProgress); + + //--------------------------------------- + // TODO document me + void implts_markDocumentAsSaved(const css::uno::Reference< css::frame::XModel >& xDocument); + + //--------------------------------------- + /** @short search a document inside given list. + + @param rList + reference to a vector, which can contain such + document. + + @param xDocument + the document, which should be located inside the + given list. + + @return [TDocumentList::iterator] + which points to the located document. + If document does not exists - its set to + rList.end()! + */ + static TDocumentList::iterator impl_searchDocument( AutoRecovery::TDocumentList& rList , + const css::uno::Reference< css::frame::XModel >& xDocument); + + //--------------------------------------- + /** TODO document me */ + void implts_changeAllDocVisibility(sal_Bool bVisible); + void implts_prepareSessionShutdown(); + + //--------------------------------------- + /** @short save all current opened documents to a specific + backup directory. + + @descr Only realy changed documents will be saved here. + + Further this method returns a suggestion, if and how it should + be called again. May be some documents was not saved yet + and must wait for an user idle period ... + + @param bAllowUserIdleLoop + Because this method is used for different uses cases, it must + know, which actions are allowed or not. + AUTO_SAVE => + If a document is the most active one, saving it + will be postponed if there exists other unsaved + documents. This feature was implemented, because + we dont wish to disturb the user on it's work. + ... bAllowUserIdleLoop should be set to sal_True + EMERGENCY_SAVE / SESSION_SAVE => + Here we must finish our work ASAP! It's not allowed + to postpone any document. + ... bAllowUserIdleLoop must(!) be set to sal_False + + @param pParams + sometimes this method is required inside an external dispatch request. + The it contains some special environment variables, which overwrites + our normal environment. + AutoSave => pParams == 0 + SessionSave/CrashSave => pParams != 0 + + @return A suggestion, how the timer (if its not already disabled!) + should be restarted to full fill the requirements. + + @threadsafe + */ + AutoRecovery::ETimerType implts_saveDocs( sal_Bool bAllowUserIdleLoop, + sal_Bool bRemoveLockFiles, + const DispatchParams* pParams = 0); + + //--------------------------------------- + /** @short save one of the current documents to a specific + backup directory. + + @descr It: + - defines a new(!) unique temp file name + - save the new temp file + - remove the old temp file + - patch the given info struct + - and return errors. + + It does not: + - patch the configuration. + + Note further: It paches the info struct + more then ones. E.g. the new temp URL is set + before the file is saved. And the old URL is removed + only if removing oft he old file was successfully. + If this method returns without an exception - everything + was OK. Otherwhise the info struct can be analyzed to + get more information, e.g. when the problem occures. + + @param sBackupPath + the base path for saving such temp files. + + @param rInfo + points to an informations structure, where + e.g. the document, its modified state, the count + of autosave-retries etcpp. exists. + Its used also to return the new temp file name + and some other state values! + + @threadsafe + */ + void implts_saveOneDoc(const ::rtl::OUString& sBackupPath , + AutoRecovery::TDocumentInfo& rInfo , + const css::uno::Reference< css::task::XStatusIndicator >& xExternalProgress); + + //--------------------------------------- + /** @short recovery all documents, which was saved during + a crash before. + + @return A suggestion, how this method must be called back! + + @threadsafe + */ + AutoRecovery::ETimerType implts_openDocs(const DispatchParams& aParams); + + //--------------------------------------- + // TODO document me + void implts_openOneDoc(const ::rtl::OUString& sURL , + ::comphelper::MediaDescriptor& lDescriptor, + AutoRecovery::TDocumentInfo& rInfo ); + + //--------------------------------------- + // TODO document me + void implts_generateNewTempURL(const ::rtl::OUString& sBackupPath , + ::comphelper::MediaDescriptor& rMediaDescriptor, + AutoRecovery::TDocumentInfo& rInfo ); + + //--------------------------------------- + /** @short notifies all interested listener about the current state + of the currently running operation. + + @descr We support different set's of functions. AUTO_SAVE, EMERGENCY_SAVE, + AUTO_RECOVERY, FAILURE_SAVE ... etcpp. + Listener can register itself for any type of supported + functionality ... but not for document URL's in special. + + @param eJob + is used to know, which set of listener we must notify. + + @param aEvent + describe the event more in detail. + + @threadsafe + */ + void implts_informListener( sal_Int32 eJob , + const css::frame::FeatureStateEvent& aEvent); + + //--------------------------------------- + /** short create a feature event struct, which can be send + to any interested listener. + + @param eJob + describe the current running operation + AUTOSAVE, EMERGENCYSAVE, RECOVERY + + @param sEventType + describe the type of this event + START, STOP, UPDATE + + @param pInfo + if sOperation is an update, this parameter must be different from NULL + and is used to send informations regarding the current handled document. + + @return [css::frame::FeatureStateEvent] + the event structure for sending. + */ + static css::frame::FeatureStateEvent implst_createFeatureStateEvent( sal_Int32 eJob , + const ::rtl::OUString& sEventType, + AutoRecovery::TDocumentInfo* pInfo ); + + //--------------------------------------- + + // TODO document me + void implts_resetHandleStates(sal_Bool bLoadCache); + + //--------------------------------------- + // TODO document me + void implts_specifyDefaultFilterAndExtension(AutoRecovery::TDocumentInfo& rInfo); + + //--------------------------------------- + // TODO document me + void implts_specifyAppModuleAndFactory(AutoRecovery::TDocumentInfo& rInfo); + + /** retrieves the names of all active views of the given document + @param rInfo + the document info, whose <code>Document</code> member must not be <NULL/>. + */ + void implts_collectActiveViewNames( AutoRecovery::TDocumentInfo& rInfo ); + + /** updates the configuration so that for all documents, their current view/names are stored + */ + void implts_persistAllActiveViewNames(); + + //--------------------------------------- + // TODO document me + void implts_prepareEmergencySave(); + + //--------------------------------------- + // TODO document me + void implts_doEmergencySave(const DispatchParams& aParams); + + //--------------------------------------- + // TODO document me + void implts_doRecovery(const DispatchParams& aParams); + + //--------------------------------------- + // TODO document me + void implts_doSessionSave(const DispatchParams& aParams); + + //--------------------------------------- + // TODO document me + void implts_doSessionQuietQuit(const DispatchParams& aParams); + + //--------------------------------------- + // TODO document me + void implts_doSessionRestore(const DispatchParams& aParams); + + //--------------------------------------- + // TODO document me + void implts_backupWorkingEntry(const DispatchParams& aParams); + + //--------------------------------------- + // TODO document me + void implts_cleanUpWorkingEntry(const DispatchParams& aParams); + + //--------------------------------------- + /** try to make sure that all changed config items (not our used + config access only) will be flushed back to disc. + + E.g. our svtools::ConfigItems() has to be flushed explicitly .-( + + Note: This method cant fail. Flushing of config entries is an + optional feature. Errors can be ignored. + */ + void impl_flushALLConfigChanges(); + + //--------------------------------------- + // TODO document me + AutoRecovery::EFailureSafeResult implts_copyFile(const ::rtl::OUString& sSource , + const ::rtl::OUString& sTargetPath, + const ::rtl::OUString& sTargetName); + + //--------------------------------------- + /** @short converts m_eJob into a job description, which + can be used to inform an outside listener + about the current running operation + + @param eJob + describe the current running operation + AUTOSAVE, EMERGENCYSAVE, RECOVERY + + @return [string] + a suitable job description of form: + vnd.sun.star.autorecovery:/do... + */ + static ::rtl::OUString implst_getJobDescription(sal_Int32 eJob); + + //--------------------------------------- + /** @short mape the given URL to an internal int representation. + + @param aURL + the url, which describe the next starting or may be already running + operation. + + @return [long] + the internal int representation + see enum EJob + */ + static sal_Int32 implst_classifyJob(const css::util::URL& aURL); + + /// TODO + void implts_verifyCacheAgainstDesktopDocumentList(); + + /// TODO document me + sal_Bool impl_enoughDiscSpace(sal_Int32 nRequiredSpace); + + /// TODO document me + static void impl_showFullDiscError(); + + //--------------------------------------- + /** @short try to create/use a progress and set it inside the + environment. + + @descr The problem behind: There exists different use case of this method. + a) An external progress is provided by our CrashSave or Recovery dialog. + b) We must create our own progress e.g. for an AutoSave + c) Sometimes our application filters dont use the progress + provided by the MediaDescriptor. They uses the Frame everytime to create + it's own progress. So we implemented a HACK for these and now we set + an InterceptedProgress there for the time WE use this frame for loading/storing documents .-) + + @param xNewFrame + must be set only in case WE create a new frame (e.g. for loading documents + on session restore or recovery). Then search for a frame using rInfo.Document must + be supressed and xFrame must be preferred instead .-) + + @param rInfo + used e.g. to find the frame corresponding to a document. + This frame must be used to create a new progress e.g. for an AutoSave. + + @param rArgs + is used to set the new created progress as parameter on these set. + */ + void impl_establishProgress(const AutoRecovery::TDocumentInfo& rInfo , + ::comphelper::MediaDescriptor& rArgs , + const css::uno::Reference< css::frame::XFrame >& xNewFrame); + + void impl_forgetProgress(const AutoRecovery::TDocumentInfo& rInfo , + ::comphelper::MediaDescriptor& rArgs , + const css::uno::Reference< css::frame::XFrame >& xNewFrame); + + //--------------------------------------- + /** try to remove the specified file from disc. + + Every URL supported by our UCB component can be used here. + Further it doesnt matter if the file realy exists or not. + Because removing a non exsistent file will have the same + result at the end ... a non existing file .-) + + On the other side removing of files from disc is an optional + feature. If we are not able doing so ... its not a real problem. + Ok - users disc place will be samller then ... but we should produce + a crash during crash save because we cant delete a temporary file only ! + + @param sURL + the url of the file, which should be removed. + */ + static void st_impl_removeFile(const ::rtl::OUString& sURL); + + //--------------------------------------- + /** try to remove ".lock" file from disc if office will be terminated + not using the offical way .-) + + This method has to be handled "optional". So every error inside + has to be ignored ! This method CANT FAIL ... it can forget something only .-) + */ + static void st_impl_removeLockFile(); +}; + +} // namespace framework + +#endif // __FRAMEWORK_SERVICES_AUTORECOVERY_HXX_ diff --git a/framework/inc/services/backingcomp.hxx b/framework/inc/services/backingcomp.hxx new file mode 100644 index 000000000000..17a902f7d24d --- /dev/null +++ b/framework/inc/services/backingcomp.hxx @@ -0,0 +1,166 @@ +/************************************************************************* + * + * 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_SERVICES_BACKINGCOMP_HXX_ +#define __FRAMEWORK_SERVICES_BACKINGCOMP_HXX_ + +//__________________________________________ +// own includes + +#include <threadhelp/threadhelpbase.hxx> +#include <general.h> +#include <stdtypes.h> + +//__________________________________________ +// interface includes +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/lang/XSingleServiceFactory.hpp> +#include <com/sun/star/awt/XWindow.hpp> +#include <com/sun/star/awt/XKeyListener.hpp> + +#ifndef _COM_SUN_STAR_FAME_XFRAME_HPP_ +#include <com/sun/star/frame/XFrame.hpp> +#endif + +#ifndef _COM_SUN_STAR_DATATRANSFER_DND_XDROPTARGETELISTENER_HPP_ +#include <com/sun/star/datatransfer/dnd/XDropTargetListener.hpp> +#endif +#include <com/sun/star/lang/XEventListener.hpp> +#include <com/sun/star/lang/XComponent.hpp> + +//__________________________________________ +// other includes +#include <cppuhelper/weak.hxx> + +//__________________________________________ +// definition + +namespace framework +{ + +//__________________________________________ +/** + implements the backing component. + + This component is a special one, which doesn't provide a controller + nor a model. It supports the following features: + - Drag & Drop + - Key Accelerators + - Simple Menu + - Progress Bar + - Background + */ +class BackingComp : public css::lang::XTypeProvider + , public css::lang::XServiceInfo + , public css::lang::XInitialization + , public css::frame::XController // => XComponent + , public css::awt::XKeyListener // => XEventListener + // attention! Must be the first base class to guarentee right initialize lock ... + , private ThreadHelpBase + , public ::cppu::OWeakObject +{ + //______________________________________ + // member + + private: + + /** the global uno service manager. + Must be used to create own needed services. */ + css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR; + + /** reference to the component window. */ + css::uno::Reference< css::awt::XWindow > m_xWindow; + + /** the owner frame of this component. */ + css::uno::Reference< css::frame::XFrame > m_xFrame; + + /** helper for drag&drop. */ + css::uno::Reference< css::datatransfer::dnd::XDropTargetListener > m_xDropTargetListener; + + //______________________________________ + // interface + + public: + + BackingComp( const css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR ); + virtual ~BackingComp( ); + + // XInterface + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) throw(css::uno::RuntimeException); + virtual void SAL_CALL acquire ( ) throw( ); + virtual void SAL_CALL release ( ) throw( ); + + // XTypeProvide + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes () throw(css::uno::RuntimeException); + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(css::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName ( ) throw(css::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService ( const ::rtl::OUString& sServiceName ) throw(css::uno::RuntimeException); + virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(css::uno::RuntimeException); + + // XInitialization + virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& lArgs ) throw(css::uno::Exception, css::uno::RuntimeException); + + // XController + virtual void SAL_CALL attachFrame ( const css::uno::Reference< css::frame::XFrame >& xFrame ) throw(css::uno::RuntimeException); + virtual sal_Bool SAL_CALL attachModel ( const css::uno::Reference< css::frame::XModel >& xModel ) throw(css::uno::RuntimeException); + virtual sal_Bool SAL_CALL suspend ( sal_Bool bSuspend ) throw(css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL getViewData ( ) throw(css::uno::RuntimeException); + virtual void SAL_CALL restoreViewData( const css::uno::Any& aData ) throw(css::uno::RuntimeException); + virtual css::uno::Reference< css::frame::XModel > SAL_CALL getModel ( ) throw(css::uno::RuntimeException); + virtual css::uno::Reference< css::frame::XFrame > SAL_CALL getFrame ( ) throw(css::uno::RuntimeException); + + // XKeyListener + virtual void SAL_CALL keyPressed ( const css::awt::KeyEvent& aEvent ) throw(css::uno::RuntimeException); + virtual void SAL_CALL keyReleased( const css::awt::KeyEvent& aEvent ) throw(css::uno::RuntimeException); + + // XEventListener + virtual void SAL_CALL disposing( const css::lang::EventObject& aEvent ) throw(css::uno::RuntimeException); + + // XComponent + virtual void SAL_CALL dispose ( ) throw(css::uno::RuntimeException); + virtual void SAL_CALL addEventListener ( const css::uno::Reference< css::lang::XEventListener >& xListener ) throw(css::uno::RuntimeException); + virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) throw(css::uno::RuntimeException); + + //______________________________________ + // helper + + public: + + static css::uno::Sequence< ::rtl::OUString > SAL_CALL impl_getStaticSupportedServiceNames( ); + static ::rtl::OUString SAL_CALL impl_getStaticImplementationName ( ); + static css::uno::Reference< css::uno::XInterface > SAL_CALL impl_createInstance ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR ) throw( css::uno::Exception ); + static css::uno::Reference< css::lang::XSingleServiceFactory > SAL_CALL impl_createFactory ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR ); +}; + +} // namespace framework + +#endif // __FRAMEWORK_SERVICES_BACKINGCOMP_HXX_ diff --git a/framework/inc/services/contenthandlerfactory.hxx b/framework/inc/services/contenthandlerfactory.hxx new file mode 100644 index 000000000000..68960e101157 --- /dev/null +++ b/framework/inc/services/contenthandlerfactory.hxx @@ -0,0 +1,242 @@ +/************************************************************************* + * + * 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_SERVICES_CONTENTHANDLERFACTORY_HXX_ +#define __FRAMEWORK_SERVICES_CONTENTHANDLERFACTORY_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <classes/filtercache.hxx> +#include <macros/generic.hxx> +#include <macros/debug.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> +#include <threadhelp/threadhelpbase.hxx> + +#ifndef __FRAMEWORK_THREADHELP_TRANSACTIONBASE_HXX_ +#include <threadhelp/transactionbase.hxx> +#endif +#include <general.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/lang/WrappedTargetException.hpp> +#include <com/sun/star/lang/IllegalArgumentException.hpp> +#include <com/sun/star/container/ElementExistException.hpp> +#include <com/sun/star/container/NoSuchElementException.hpp> +#include <com/sun/star/container/XNameContainer.hpp> +#include <com/sun/star/container/NoSuchElementException.hpp> +#include <com/sun/star/io/XInputStream.hpp> +#include <com/sun/star/util/XFlushable.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <cppuhelper/interfacecontainer.hxx> +#include <cppuhelper/weak.hxx> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ +// exported const +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// exported definitions +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short factory to create handler-objects + @descr These class can be used to create new handler for specified contents. + We use cached values of our configuration to lay down, which handler match + a given URL or handlername. (use service TypeDetection to do that) + With a detected type name you can search a registered handler and create it with these factory. + + @implements XInterface + XTypeProvider + XServiceInfo + XMultiServiceFactory + XNameContainer + XNameReplace + XNameAccess + XElementAccess + XFlushable + + @base ThreadHelpBase + OWeakObject + + @devstatus ready to use + @threadsafe yes +*//*-*************************************************************************************************************/ + +class ContentHandlerFactory : // interfaces + public css::lang::XTypeProvider , + public css::lang::XServiceInfo , + public css::lang::XMultiServiceFactory , + public css::container::XNameContainer , // => XNameReplace => XNameAccess => XElementAccess + public css::util::XFlushable , + // base classes + // Order is neccessary for right initialization of it! + private ThreadHelpBase , + private TransactionBase , + public ::cppu::OWeakObject +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + + public: + + //--------------------------------------------------------------------------------------------------------- + // constructor / destructor + //--------------------------------------------------------------------------------------------------------- + ContentHandlerFactory( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory ); + virtual ~ContentHandlerFactory( ); + + //--------------------------------------------------------------------------------------------------------- + // XInterface, XTypeProvider, XServiceInfo + //--------------------------------------------------------------------------------------------------------- + DECLARE_XINTERFACE + DECLARE_XTYPEPROVIDER + DECLARE_XSERVICEINFO + + //--------------------------------------------------------------------------------------------------------- + // XMultiServiceFactory + //--------------------------------------------------------------------------------------------------------- + virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance ( const ::rtl::OUString& sTypeName ) throw( css::uno::Exception , + css::uno::RuntimeException ); + virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstanceWithArguments( const ::rtl::OUString& sTypeName , + const css::uno::Sequence< css::uno::Any >& lArguments ) throw( css::uno::Exception, css::uno::RuntimeException ); + virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getAvailableServiceNames ( ) throw( css::uno::RuntimeException ); + + //--------------------------------------------------------------------------------------------------------- + // XNameContainer + //--------------------------------------------------------------------------------------------------------- + virtual void SAL_CALL insertByName( const ::rtl::OUString& sHandlerName , + const css::uno::Any& aHandlerProperties ) throw( css::lang::IllegalArgumentException , + css::container::ElementExistException , + css::lang::WrappedTargetException , + css::uno::RuntimeException ); + virtual void SAL_CALL removeByName( const ::rtl::OUString& sHandlerName ) throw( css::container::NoSuchElementException , + css::lang::WrappedTargetException , + css::uno::RuntimeException ); + + //--------------------------------------------------------------------------------------------------------- + // XNameReplace + //--------------------------------------------------------------------------------------------------------- + virtual void SAL_CALL replaceByName( const ::rtl::OUString& sHandlerName , + const css::uno::Any& aHandlerProperties ) throw( css::lang::IllegalArgumentException , + css::container::NoSuchElementException , + css::lang::WrappedTargetException , + css::uno::RuntimeException ); + + //--------------------------------------------------------------------------------------------------------- + // XNameAccess + //--------------------------------------------------------------------------------------------------------- + virtual css::uno::Any SAL_CALL getByName ( const ::rtl::OUString& sName ) throw( css::container::NoSuchElementException , + css::lang::WrappedTargetException , + css::uno::RuntimeException ); + virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw( css::uno::RuntimeException ); + virtual sal_Bool SAL_CALL hasByName ( const ::rtl::OUString& sName ) throw( css::uno::RuntimeException ); + + //--------------------------------------------------------------------------------------------------------- + // XElementAccess + //--------------------------------------------------------------------------------------------------------- + virtual css::uno::Type SAL_CALL getElementType() throw( css::uno::RuntimeException ); + virtual sal_Bool SAL_CALL hasElements () throw( css::uno::RuntimeException ); + + //--------------------------------------------------------------------------------------------------------- + // XFlushable + //--------------------------------------------------------------------------------------------------------- + virtual void SAL_CALL flush ( ) throw ( css::uno::RuntimeException ); + virtual void SAL_CALL addFlushListener ( const css::uno::Reference< css::util::XFlushListener >& xListener ) throw ( css::uno::RuntimeException ); + virtual void SAL_CALL removeFlushListener( const css::uno::Reference< css::util::XFlushListener >& xListener ) throw ( css::uno::RuntimeException ); + + //------------------------------------------------------------------------------------------------------------- + // protected methods + //------------------------------------------------------------------------------------------------------------- + + protected: + + //------------------------------------------------------------------------------------------------------------- + // 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 + @return sal_True ,otherwise + + @onerror - + *//*-*****************************************************************************************************/ + + #ifdef ENABLE_ASSERTIONS + + private: + + static sal_Bool implcp_ContentHandlerFactory ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory ); + static sal_Bool implcp_createInstanceWithArguments ( const ::rtl::OUString& sTypeName , + const css::uno::Sequence< css::uno::Any >& lArguments ); + static sal_Bool implcp_getByName ( const ::rtl::OUString& sName ); + static sal_Bool implcp_hasByName ( const ::rtl::OUString& sName ); + static sal_Bool implcp_removeByName ( const ::rtl::OUString& sHandlerName ); + + #endif // #ifdef ENABLE_ASSERTIONS + + //------------------------------------------------------------------------------------------------------------- + // private variables + // (should be private everyway!) + //------------------------------------------------------------------------------------------------------------- + + private: + + css::uno::Reference< css::lang::XMultiServiceFactory > m_xFactory ; + FilterCache m_aCache ; +// ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer ; + +}; // class ContentHandlerFactory + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_SERVICES_CONTENTHANDLERFACTORY_HXX_ diff --git a/framework/inc/services/desktop.hxx b/framework/inc/services/desktop.hxx new file mode 100644 index 000000000000..47bb501aeef8 --- /dev/null +++ b/framework/inc/services/desktop.hxx @@ -0,0 +1,513 @@ +/************************************************************************* + * + * 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_SERVICES_DESKTOP_HXX_ +#define __FRAMEWORK_SERVICES_DESKTOP_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <classes/framecontainer.hxx> +#include <threadhelp/threadhelpbase.hxx> +#include <helper/oframes.hxx> +#include <macros/generic.hxx> +#include <macros/debug.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ + +#include <com/sun/star/frame/XUntitledNumbers.hpp> + +#include <com/sun/star/frame/XController.hpp> +#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/frame/WindowArrange.hpp> +#include <com/sun/star/frame/TerminationVetoException.hpp> +#include <com/sun/star/frame/XTerminateListener.hpp> +#include <com/sun/star/frame/XWindowArranger.hpp> +#include <com/sun/star/frame/XTask.hpp> +#include <com/sun/star/frame/XStorable.hpp> +#include <com/sun/star/frame/XModel.hpp> +#include <com/sun/star/frame/XFramesSupplier.hpp> +#include <com/sun/star/frame/XFrames.hpp> +#include <com/sun/star/lang/XServiceName.hpp> +#include <com/sun/star/frame/XDispatchProvider.hpp> +#include <com/sun/star/frame/XDispatchProviderInterception.hpp> +#include <com/sun/star/frame/XComponentLoader.hpp> +#include <com/sun/star/frame/FrameAction.hpp> +#include <com/sun/star/task/XStatusIndicatorFactory.hpp> +#include <com/sun/star/frame/XTasksSupplier.hpp> +#include <com/sun/star/container/XEnumerationAccess.hpp> +#include <com/sun/star/lang/Locale.hpp> +#include <com/sun/star/frame/XDispatchResultListener.hpp> +#include <com/sun/star/lang/XEventListener.hpp> +#include <com/sun/star/frame/FeatureStateEvent.hpp> +#include <com/sun/star/task/XInteractionHandler.hpp> +#include <com/sun/star/frame/XDispatchRecorderSupplier.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <unotools/cmdoptions.hxx> +#include <cppuhelper/propshlp.hxx> +#include <cppuhelper/interfacecontainer.hxx> +#include <cppuhelper/weak.hxx> + +#include <comphelper/numberedcollection.hxx> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ +// exported const +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// exported definitions +//_________________________________________________________________________________________________________________ + +enum ELoadState +{ + E_NOTSET , + E_SUCCESSFUL , + E_FAILED , + E_INTERACTION +}; + +/*-************************************************************************************************************//** + @short implement the topframe of frame tree + @descr This is the root of the frame tree. The desktop has no window, is not visible but he is the logical + "masternode" to build the hierarchy. + + @implements XInterface + XTypeProvider + XServiceInfo + XDesktop + XComponentLoader + XTasksSupplier + XDispatchProvider + XFramesSupplier + XFrame + XComponent + XPropertySet + XFastPropertySet + XMultiPropertySet + XDispatchResultListener + XEventListener + XInteractionHandler + + @base ThreadHelpBase + TransactionBase + OBroadcastHelper + OPropertySetHelper + + @devstatus ready to use + @threadsafe yes +*//*-*************************************************************************************************************/ +class Desktop : // interfaces + public css::lang::XTypeProvider , + public css::lang::XServiceInfo , + public css::frame::XDesktop , + public css::frame::XComponentLoader , + public css::frame::XTasksSupplier , + public css::frame::XDispatchProvider , + public css::frame::XDispatchProviderInterception, + public css::frame::XFramesSupplier , // => XFrame => XComponent + public css::frame::XDispatchResultListener , // => XEventListener + public css::task::XInteractionHandler , + public css::frame::XUntitledNumbers , + // base classes + // Order is neccessary for right initialization! + private ThreadHelpBase , + private TransactionBase , + public ::cppu::OBroadcastHelper , + public ::cppu::OPropertySetHelper , + public ::cppu::OWeakObject +{ + // internal used types, const etcpp. + private: + + //--------------------------------------------------------------------- + /** used temporary to know which listener was already called or not. */ + typedef ::std::vector< css::uno::Reference< css::frame::XTerminateListener > > TTerminateListenerList; + + // public methods + public: + + // constructor / destructor + Desktop( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory ); + virtual ~Desktop( ); + + // XInterface, XTypeProvider, XServiceInfo + FWK_DECLARE_XINTERFACE + FWK_DECLARE_XTYPEPROVIDER + DECLARE_XSERVICEINFO + + //--------------------------------------------------------------------- + /** + @interface XDesktop + + @short try to shutdown these desktop environment. + + @descr Will try to close all frames. If at least one frame could + not be closed successfully termination will be stopped. + + Registered termination listener will be taken into account + also. As special feature some of our registered listener + are well known by it's UNO implementation name. They are handled + different to all other listener. + + Btw: Desktop.terminate() was designed in the past to be used + within an UI based envrionment. So it's allowed e.g. to + call XController.suspend() here. If UI isnt an option ... please + use XCloseable.close() at these desktop implementation. + ... if it will be supported in the future .-)) + + @seealso XTerminateListener + @seealso XTerminateListener2 + + @return true if all open frames could be closed and no listener throwed + a veto exception; false otherwise. + + @onerror False will be returned. + @threadsafe yes + */ + virtual ::sal_Bool SAL_CALL terminate() + throw( css::uno::RuntimeException ); + + //--------------------------------------------------------------------- + /** + @interface XDesktop + + @short add a listener for termination events + + @descr Additional to adding normal listener these method was implemented special. + Every listener will be asked for it's uno implementation name. + Some of them are well known ... and the corresponding listener wont be added + to the container of "normal listener". Those listener will be set as special + member. + see e.g. member m_xSfxTerminator + + @seealso terminate() + + @param xListener + the listener for registration. + + @threadsafe yes + */ + virtual void SAL_CALL addTerminateListener( const css::uno::Reference< css::frame::XTerminateListener >& xListener ) + throw( css::uno::RuntimeException ); + + //--------------------------------------------------------------------- + /** + @interface XDesktop + + @short remove a listener from this container. + + @descr Additional to removing normal listener these method was implemented special. + Every listener will be asked for it's uno implementation name. + Some of them are well known ... and the corresponding listener was set as special member. + Now those special member will be reseted also. + see e.g. member m_xSfxTerminator + + @seealso terminate() + + @param xListener + the listener for deregistration. + + @threadsafe yes + */ + virtual void SAL_CALL removeTerminateListener( const css::uno::Reference< css::frame::XTerminateListener >& xListener ) + throw( css::uno::RuntimeException ); + + virtual css::uno::Reference< css::container::XEnumerationAccess > SAL_CALL getComponents ( ) throw( css::uno::RuntimeException ); + virtual css::uno::Reference< css::lang::XComponent > SAL_CALL getCurrentComponent ( ) throw( css::uno::RuntimeException ); + virtual css::uno::Reference< css::frame::XFrame > SAL_CALL getCurrentFrame ( ) throw( css::uno::RuntimeException ); + + // XComponentLoader + virtual css::uno::Reference< css::lang::XComponent > SAL_CALL loadComponentFromURL ( const ::rtl::OUString& sURL , + const ::rtl::OUString& sTargetFrameName , + sal_Int32 nSearchFlags , + const css::uno::Sequence< css::beans::PropertyValue >& lArguments ) throw( css::io::IOException , + css::lang::IllegalArgumentException , + css::uno::RuntimeException ); + + // XTasksSupplier + virtual css::uno::Reference< css::container::XEnumerationAccess > SAL_CALL getTasks ( ) throw( css::uno::RuntimeException ); + virtual css::uno::Reference< css::frame::XTask > SAL_CALL getActiveTask ( ) throw( css::uno::RuntimeException ); + + // XDispatchProvider + virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL queryDispatch ( const css::util::URL& aURL , + const ::rtl::OUString& sTargetFrameName , + sal_Int32 nSearchFlags ) throw( css::uno::RuntimeException ); + virtual css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL queryDispatches ( const css::uno::Sequence< css::frame::DispatchDescriptor >& lQueries ) throw( css::uno::RuntimeException ); + + // XDispatchProviderInterception + virtual void SAL_CALL registerDispatchProviderInterceptor( const css::uno::Reference< css::frame::XDispatchProviderInterceptor >& xInterceptor) throw( css::uno::RuntimeException); + virtual void SAL_CALL releaseDispatchProviderInterceptor ( const css::uno::Reference< css::frame::XDispatchProviderInterceptor >& xInterceptor) throw( css::uno::RuntimeException); + + // XFramesSupplier + virtual css::uno::Reference< css::frame::XFrames > SAL_CALL getFrames ( ) throw( css::uno::RuntimeException ); + virtual css::uno::Reference< css::frame::XFrame > SAL_CALL getActiveFrame ( ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL setActiveFrame ( const css::uno::Reference< css::frame::XFrame >& xFrame ) throw( css::uno::RuntimeException ); + + // XFrame + // Attention: findFrame() is implemented only! Other methods make no sense for our desktop! + virtual css::uno::Reference< css::frame::XFrame > SAL_CALL findFrame ( const ::rtl::OUString& sTargetFrameName , + sal_Int32 nSearchFlags ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL initialize ( const css::uno::Reference< css::awt::XWindow >& xWindow ) throw( css::uno::RuntimeException ); + virtual css::uno::Reference< css::awt::XWindow > SAL_CALL getContainerWindow ( ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL setCreator ( const css::uno::Reference< css::frame::XFramesSupplier >& xCreator ) throw( css::uno::RuntimeException ); + virtual css::uno::Reference< css::frame::XFramesSupplier > SAL_CALL getCreator ( ) throw( css::uno::RuntimeException ); + virtual ::rtl::OUString SAL_CALL getName ( ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL setName ( const ::rtl::OUString& sName ) throw( css::uno::RuntimeException ); + virtual sal_Bool SAL_CALL isTop ( ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL activate ( ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL deactivate ( ) throw( css::uno::RuntimeException ); + virtual sal_Bool SAL_CALL isActive ( ) throw( css::uno::RuntimeException ); + virtual sal_Bool SAL_CALL setComponent ( const css::uno::Reference< css::awt::XWindow >& xComponentWindow , + const css::uno::Reference< css::frame::XController >& xController ) throw( css::uno::RuntimeException ); + virtual css::uno::Reference< css::awt::XWindow > SAL_CALL getComponentWindow ( ) throw( css::uno::RuntimeException ); + virtual css::uno::Reference< css::frame::XController > SAL_CALL getController ( ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL contextChanged ( ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL addFrameActionListener ( const css::uno::Reference< css::frame::XFrameActionListener >& xListener ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL removeFrameActionListener ( const css::uno::Reference< css::frame::XFrameActionListener >& xListener ) throw( css::uno::RuntimeException ); + + // XComponent + using cppu::OPropertySetHelper::disposing; + virtual void SAL_CALL dispose ( ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL addEventListener ( const css::uno::Reference< css::lang::XEventListener >& xListener ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL removeEventListener ( const css::uno::Reference< css::lang::XEventListener >& xListener ) throw( css::uno::RuntimeException ); + + // XDispatchResultListener + virtual void SAL_CALL dispatchFinished ( const css::frame::DispatchResultEvent& aEvent ) throw( css::uno::RuntimeException ); + + // XEventListener + virtual void SAL_CALL disposing ( const css::lang::EventObject& aSource ) throw( css::uno::RuntimeException ); + + // XInteractionHandler + virtual void SAL_CALL handle ( const css::uno::Reference< css::task::XInteractionRequest >& xRequest ) throw( css::uno::RuntimeException ); + + // css.frame.XUntitledNumbers + virtual ::sal_Int32 SAL_CALL leaseNumber( const css::uno::Reference< css::uno::XInterface >& xComponent ) + throw (css::lang::IllegalArgumentException, + css::uno::RuntimeException ); + + // css.frame.XUntitledNumbers + virtual void SAL_CALL releaseNumber( ::sal_Int32 nNumber ) + throw (css::lang::IllegalArgumentException, + css::uno::RuntimeException ); + + // css.frame.XUntitledNumbers + virtual void SAL_CALL releaseNumberForComponent( const css::uno::Reference< css::uno::XInterface >& xComponent ) + throw (css::lang::IllegalArgumentException, + css::uno::RuntimeException ); + + // css.frame.XUntitledNumbers + virtual ::rtl::OUString SAL_CALL getUntitledPrefix() + throw (css::uno::RuntimeException); + + //------------------------------------------------------------------------------------------------------------- + // protected methods + //------------------------------------------------------------------------------------------------------------- + protected: + + // OPropertySetHelper + virtual sal_Bool SAL_CALL convertFastPropertyValue ( css::uno::Any& aConvertedValue , + css::uno::Any& aOldValue , + sal_Int32 nHandle , + const css::uno::Any& aValue ) throw( css::lang::IllegalArgumentException ); + virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle , + const css::uno::Any& aValue ) throw( css::uno::Exception ); + using cppu::OPropertySetHelper::getFastPropertyValue; + virtual void SAL_CALL getFastPropertyValue ( css::uno::Any& aValue , + sal_Int32 nHandle ) const; + virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper ( ); + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo ( ) throw (css::uno::RuntimeException); + + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + private: + + css::uno::Reference< css::lang::XComponent > impl_getFrameComponent ( const css::uno::Reference< css::frame::XFrame >& xFrame ) const; + static const css::uno::Sequence< css::beans::Property > impl_getStaticPropertyDescriptor( ); + + //--------------------------------------------------------------------- + /** calls queryTermination() on every registered termination listener. + * + * Note: Only normal termination listener (registered in list m_aListenerContainer + * will be recognized here. Special listener like quick starter, pipe or others + * has to be handled explicitly ! + * + * @param [out] lCalledListener + * every called listener will be returned here. + * Those list will be used to informa all called listener + * about cancel this termination request. + * + * @param [out] bVeto + * will be true if at least one listener throwed a veto exception; + * false otherwise. + * + * @see impl_sendCancelTerminationEvent() + */ + void impl_sendQueryTerminationEvent(TTerminateListenerList& lCalledListener, + ::sal_Bool& bVeto ); + + //--------------------------------------------------------------------- + /** calls cancelTermination() on every termination listener + * where queryTermination() was called before. + * + * Note: Only normal termination listener (registered in list m_aListenerContainer + * will be recognized here. Special listener like quick starter, pipe or others + * has to be handled explicitly ! + * + * @param [in] lCalledListener + * every listener in this list was called within its method + * queryTermination() before. + * + * @see impl_sendQueryTerminationEvent() + */ + void impl_sendCancelTerminationEvent(const TTerminateListenerList& lCalledListener); + + //--------------------------------------------------------------------- + /** calls notifyTermination() on every registered termination listener. + * + * Note: Only normal termination listener (registered in list m_aListenerContainer + * will be recognized here. Special listener like quick starter, pipe or others + * has to be handled explicitly ! + */ + void impl_sendNotifyTerminationEvent(); + + //--------------------------------------------------------------------- + /** try to close all open frames. + * + * Iterates over all child frames and try to close them. + * Given parameter bAllowUI enable/disable showing any UI + * (which mostly occure on calling XController->suspend()). + * + * These method doesnt stop if one frame could not be closed. + * It will ignore such frames and try all other ones. + * But it returns false in such case - true otherwise. + * + * @param bAllowUI + * enable/disable showing of UI. + * + * @return true if all frames could be closed; false otherwise. + */ + ::sal_Bool impl_closeFrames(::sal_Bool bAllowUI); + + //------------------------------------------------------------------------------------------------------------- + // debug methods + // (should be private everytime!) + //------------------------------------------------------------------------------------------------------------- + #ifdef ENABLE_ASSERTIONS + private: + + static sal_Bool implcp_ctor ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory ); + static sal_Bool implcp_addEventListener ( const css::uno::Reference< css::lang::XEventListener >& xListener ); + static sal_Bool implcp_removeEventListener ( const css::uno::Reference< css::lang::XEventListener >& xListener ); + + sal_Bool m_bIsTerminated ; /// check flag to protect us against dispose before terminate! + /// see dispose() for further informations! + + #endif // #ifdef ENABLE_ASSERTIONS + + //------------------------------------------------------------------------------------------------------------- + // variables + // (should be private everytime!) + //------------------------------------------------------------------------------------------------------------- + private: + + css::uno::Reference< css::lang::XMultiServiceFactory > m_xFactory ; /// reference to factory, which has create this instance + FrameContainer m_aChildTaskContainer ; /// array of child tasks (childs of desktop are tasks; and tasks are also frames - But pure frames are not accepted!) + ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer ; /// container for ALL Listener + css::uno::Reference< css::frame::XFrames > m_xFramesHelper ; /// helper for XFrames, XIndexAccess, XElementAccess and implementation of a childcontainer! + css::uno::Reference< css::frame::XDispatchProvider > m_xDispatchHelper ; /// helper to dispatch something for new tasks, created by "_blank"! + ELoadState m_eLoadState ; /// hold information about state of asynchron loading of component for loadComponentFromURL()! + css::uno::Reference< css::frame::XFrame > m_xLastFrame ; /// last target of "loadComponentFromURL()"! + css::uno::Any m_aInteractionRequest ; + sal_Bool m_bSuspendQuickstartVeto ; /// don't ask quickstart for a veto + SvtCommandOptions m_aCommandOptions ; /// ref counted class to support disabling commands defined by configuration file + ::rtl::OUString m_sName ; + ::rtl::OUString m_sTitle ; + css::uno::Reference< css::frame::XDispatchRecorderSupplier > m_xDispatchRecorderSupplier ; + + //--------------------------------------------------------------------- + /** special terminate listener to close pipe and block external requests + * during/after termination process is/was running + */ + css::uno::Reference< css::frame::XTerminateListener > m_xPipeTerminator; + + //--------------------------------------------------------------------- + /** special terminate listener shown inside system tray (quick starter) + * Will hinder the office on shutdown ... but wish to allow closing + * of open documents. And because thats different to a normal terminate listener + * it has to be handled special .-) + */ + css::uno::Reference< css::frame::XTerminateListener > m_xQuickLauncher; + + //--------------------------------------------------------------------- + /** special terminate listener which loads images asynchronous for current open documents. + * Because internaly it uses blocking system APIs ... it cant be guaranteed that + * running jobs can be cancelled successfully if the corressponding document will be closed ... + * it will not hinder those documents on closing. Instead it let all jobs running ... + * but at least on terminate we have to wait for all those blocked requests. + * So these implementation must be a special terminate listener too .-( + */ + css::uno::Reference< css::frame::XTerminateListener > m_xSWThreadManager; + + //--------------------------------------------------------------------- + /** special terminate listener shuting down the SfxApplication. + * Because these desktop instance closes documents and informs listener + * only ... it does not realy shutdown the whole application. + * + * Btw: That wouldnt be possible by design ... because Desktop.terminate() + * has to return a boolean value about success ... it cant realy shutdown the + * process .-) + * + * So we uses a trick: A special listener (exactly these one here) listen for notifyTermination() + * and shutdown the process asynchronous. But desktop has to make this special + * notification as realy last one ... Otherwhise it can happen that asynchronous + * shutdown will be faster then all other code around Desktop.terminate() .-)) + */ + css::uno::Reference< css::frame::XTerminateListener > m_xSfxTerminator; + + css::uno::Reference< css::frame::XUntitledNumbers > m_xTitleNumberGenerator; + +}; // class Desktop + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_SERVICES_DESKTOP_HXX_ diff --git a/framework/inc/services/detectorfactory.hxx b/framework/inc/services/detectorfactory.hxx new file mode 100644 index 000000000000..d24261ce290d --- /dev/null +++ b/framework/inc/services/detectorfactory.hxx @@ -0,0 +1,461 @@ +/************************************************************************* + * + * 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_SERVICES_DETECTORFACTORY_HXX_ +#define __FRAMEWORK_SERVICES_DETECTORFACTORY_HXX_ + +//_______________________________________________ +// includes of own project + +#include <classes/filtercache.hxx> +#include <threadhelp/threadhelpbase.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> +#include <macros/generic.hxx> +#include <macros/debug.hxx> +#include <general.h> + +//_______________________________________________ +// includes of interfaces +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/lang/WrappedTargetException.hpp> +#include <com/sun/star/lang/IllegalArgumentException.hpp> +#include <com/sun/star/container/ElementExistException.hpp> +#include <com/sun/star/container/NoSuchElementException.hpp> +#include <com/sun/star/container/XNameContainer.hpp> +#include <com/sun/star/container/NoSuchElementException.hpp> +#include <com/sun/star/io/XInputStream.hpp> +#include <com/sun/star/util/XFlushable.hpp> + +//_______________________________________________ +// includes of other projects +#include <cppuhelper/interfacecontainer.hxx> +#include <cppuhelper/weak.hxx> + +//_______________________________________________ +// namespace + +namespace framework{ + +//_______________________________________________ +// exported const + +//_______________________________________________ +// exported definitions + +/// @HTML +/** @short factory to create detect service objects and initialize it in the right way. + + @descr This class can be used to create new detect services for specified contents. + It uses cached values of the configuration to lay down, which detector match + a given name. Further this class provides full access to the configuration data + of such detect services and following implementations will support some special + query modes. + + @author as96863 + + @docdate 07.03.2003 by as96863 + + @todo <ul> + <li>implementation of query mode</li> + <li>simple restore mechanism of last consistent cache state, + if flush failed</li> + </ul> + */ +/// @NOHTML + +class DetectorFactory : // interfaces + public css::lang::XTypeProvider , + public css::lang::XServiceInfo , + public css::lang::XMultiServiceFactory , + public css::container::XNameContainer , // => XNameReplace => XNameAccess => XElementAccess + public css::util::XFlushable , + // base classes + // Order is neccessary for right initialization of it! + private ThreadHelpBase , + public ::cppu::OWeakObject +{ + //------------------------------------------- + // member + + private: + + /** reference to the global uno service manager. + It will be used to create own needed services on demand. */ + css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR; + + /** singleton, which contains all needed configuration data and provides + read/write access on it. */ + FilterCache m_aCache; + + /** contains all registered listener. */ + ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; + + //------------------------------------------- + // interface + + public: + + //--------------------------------------- + // XInterface, XTypeProvider, XServiceInfo + + DECLARE_XINTERFACE + DECLARE_XTYPEPROVIDER + DECLARE_XSERVICEINFO + + #ifdef ENABLE_AUTODOC_FIX + ; + #endif + + //--------------------------------------- + + /** @short initialize new instance of this class. + + @param xSMGR + reference to the global uno service manager, which created this new factory instance. + It must be used during runtime to create own needed services. + */ + + DetectorFactory( const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR ); + + //--------------------------------------- + + /** @short release internal structures. + */ + + virtual ~DetectorFactory(); + + //--------------------------------------- + // XMultiServiceFactory + + /** @short create a new detect service and initialize it with it's own configuration data. + + @param sName + means the uno implementation name of a detect service. + + @exception com::sun::star::uno::Exception + if the requested service could not be created or initialized. + */ + + virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance( const ::rtl::OUString& sName ) + throw(css::uno::Exception , + css::uno::RuntimeException); + + //--------------------------------------- + // XMultiServiceFactory + + /** @short does the same as createInstance() method, but initialize created detect service with some + additional data. + + @param sName + means the uno implementation name of a detect service. + + @param lArguments + the optional arguments, which are passed to the created detect service against + it's own configuration data. + + @exception com::sun::star::uno::Exception + if the requested service could not be created or initialized. + */ + + virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstanceWithArguments( const ::rtl::OUString& sName , + const css::uno::Sequence< css::uno::Any >& lArguments ) + throw(css::uno::Exception , + css::uno::RuntimeException); + + //--------------------------------------- + // XMultiServiceFactory + + /** @short return list of all well know detect services, which can be created by this factory. + + @attention Because this service implements read/write access to the configuration too, + this list is dynamic. Means: in multithreaded environments some items of this + return list could be invalid next time! + + @return A list of all registered detect services. + */ + + virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getAvailableServiceNames() + throw(css::uno::RuntimeException); + + //--------------------------------------- + // XNameContainer + + /** @short add new detect service entry to this container. + + @descr This will change all internal structures only! + Updating of the configuration layer and notify of all registered + listener will be done inside API call XFlushable::flush() on this + container. + + @param sName + means the uno implementation name of this new detect service entry. + + @param aPropertySet [sequence< com::sun::star::beans::PropertyValue >!] + describe this new entry. For a list of all supported properties + have a look on method >>getByName()<<. + Note: Missing values will be created with defaults! + + @exception com::sun::star::lang::IllegalArgumentException + if one of the incoming parameters seams to be invalid. + That doesn't include the check, if this item already exist! + + @exception com::sun::star::container::ElementExistException + if this item already exist inside this container. + + @exception com::sun::star::lang::WrappedTargetException + f creation of the internal structures failed. + */ + + virtual void SAL_CALL insertByName( const ::rtl::OUString& sName , + const css::uno::Any& aPropertySet ) + throw(css::lang::IllegalArgumentException , + css::container::ElementExistException, + css::lang::WrappedTargetException , + css::uno::RuntimeException ); + + //--------------------------------------- + // XNameContainer + + /** @short remove a detect service entry from this container. + + @descr This will change all internal structures only! + Updating of the configuration layer and notify of all registered + listener will be done inside API call XFlushable::flush() on this + container. + + @param sName + means the uno implementation name of a detect service entry. + + @exception com::sun::star::container::NoSuchElementException + if the requested item does not exist inside this container. + + @exception com::sun::star::lang::WrappedTargetException + if creation of the internal structures failed. + */ + + virtual void SAL_CALL removeByName( const ::rtl::OUString& sName ) + throw(css::container::NoSuchElementException, + css::lang::WrappedTargetException , + css::uno::RuntimeException ); + + //--------------------------------------- + // XNameReplace + + /** @short change a detect service entry inside this container. + + @descr This will change all internal structures only! + Updating of the configuration layer and notify of all registered + listener will be done inside API call XFlushable::flush() on this + container. + + @param sName + means the uno implementation name of a detect service entry. + + @param aPropertySet [sequence< com::sun::star::beans::PropertyValue >!] + describe the changes on this entry. For a list of all supported properties + have a look on method getByName(). + Note: Missing properties will be untouched. + + @exception com::sun::star::lang::IllegalArgumentException + if one of the incoming parameters seams to be invalid. + That doesn't include the check, if this item exist! + + @exception com::sun::star::container::NoSuchElementException + if the requested item does not exist inside this container. + + @exception com::sun::star::lang::WrappedTargetException + if updating of the internal structures failed. + */ + + virtual void SAL_CALL replaceByName( const ::rtl::OUString& sName , + const css::uno::Any& aPropertySet ) + throw(css::lang::IllegalArgumentException , + css::container::NoSuchElementException, + css::lang::WrappedTargetException , + css::uno::RuntimeException ); + + //--------------------------------------- + // XNameAccess + + /// @HTML + /** @short return properties of queried detector item. + + @descr Use this method to get all informations about a detector item of this cache. + A sequence< com::sun::star::beans::PropertyValue > packed inside an Any will be returned. + Following properties are defined: + <table border=1> + <tr> + <td><b>Property</b></td> + <td><b>Value<b></td> + <td><b>Description<b></td> + </tr> + <tr> + <td>Name</td> + <td>[string]</td> + <td>the uno implementation name for this detect service</td> + </tr> + <tr> + <td>Types</td> + <td>[sequence< string >]</td> + <td>a list of all internbal type names, which this detect service is registered for</td> + </tr> + </table> + + @param sName + the uno implementation name the requested detector. + + @return A property set, which describe this detect service. + It uses a sequence< com::sun::star::beans::PropertyValue > internaly. + + @exception com::sun::star::container::NoSuchElementException + if the requested entry does not exist inside this container. + */ + /// @NOHTML + + virtual css::uno::Any SAL_CALL getByName( const ::rtl::OUString& sName ) + throw(css::container::NoSuchElementException, + css::lang::WrappedTargetException , + css::uno::RuntimeException ); + + //--------------------------------------- + // XNameAccess + + /** @short return list of all well know container entries available on this container. + + @attention Because this service implements read/write access to the configuration too, + this list is dynamic. Means: in multithreaded environments some items of this + return list could be invalid next time! + + @return A list of all well known container items. + */ + + virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() + throw(css::uno::RuntimeException); + + //--------------------------------------- + // XNameAccess + + /** @short check if searched entry exist inside this container. + + @attention In multithreaded environments it's not guaranteed, that a + queried item exist next time realy! It can be deleted by + another thread ... + + @param sName + the name of the queried container entry. + + @return sal_True if the requested item exist; sal_False otherwise. + */ + + virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& sName ) + throw(css::uno::RuntimeException); + + //--------------------------------------- + // XElementAccess + + /** @short return the uno type, which is used for all container items. + + @return Type of sequence< com::sun::star::beans::PropertyValue > everytime - because it's fix. + */ + + virtual css::uno::Type SAL_CALL getElementType() + throw(css::uno::RuntimeException); + + //--------------------------------------- + // XElementAccess + + /** @short return fill state of this cache. + + @return sal_True if any item exist inside this conatiner; sal_False otherwhise. + */ + + virtual sal_Bool SAL_CALL hasElements() + throw(css::uno::RuntimeException); + + //--------------------------------------- + // XFlushable + + /** @short update the configuration layer and notify all registered listener. + + @descr All container interface methods update the internal structures of + this container only. But the underlying configuration layer and + may some possible other caches was not updated. + Calling of flush() will do that. + At the same time all currently registered flush listener will be informed, + so they can update her structures too. + Note: Before all these operations are started realy, all changes will be + verified and if neccessary some corrections will be done. + In case the cache will be invalid and could not be repaired an exception is thrown! + Normaly this container will not work correctly afterwards ... + + @exception com::sun::star::uno::RuntimeException + if the changes on this container was invald and could not be repaired. + */ + + virtual void SAL_CALL flush() + throw(css::uno::RuntimeException); + + //--------------------------------------- + // XFlushable + + /** @short register listener for container updates. + + @param xListener + reference to listener, which wish to be registered. + + @exception com::sun::star::uno::RuntimeException + if the given listener is an invalid reference. + Note: multiple calls of this method for the same listener won't be checked! + */ + + virtual void SAL_CALL addFlushListener( const css::uno::Reference< css::util::XFlushListener >& xListener ) + throw(css::uno::RuntimeException); + + //--------------------------------------- + // XFlushable + + /** @short deregister listener for container updates. + + @param xListener + reference to listener, which wish to be deregistered. + + @exception com::sun::star::uno::RuntimeException + if the given listener is an invalid reference. + Note: multiple calls of this method for the same listener won't be checked! + */ + + virtual void SAL_CALL removeFlushListener( const css::uno::Reference< css::util::XFlushListener >& xListener ) + throw(css::uno::RuntimeException); + +}; // class DetectorFactory + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_SERVICES_DETECTORFACTORY_HXX_ diff --git a/framework/inc/services/dispatchhelper.hxx b/framework/inc/services/dispatchhelper.hxx new file mode 100644 index 000000000000..0d5c2f097d9d --- /dev/null +++ b/framework/inc/services/dispatchhelper.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_SERVICES_DISPATCHHELPER_HXX_ +#define __FRAMEWORK_SERVICES_DISPATCHHELPER_HXX_ + +//_______________________________________________ +// my own includes + +#include <threadhelp/threadhelpbase.hxx> +#include <macros/generic.hxx> +#include <macros/debug.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> +#include <general.h> + +//_______________________________________________ +// interface includes +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/frame/XDispatchHelper.hpp> +#include <com/sun/star/frame/XDispatchResultListener.hpp> +#include <com/sun/star/frame/DispatchResultEvent.hpp> + +//_______________________________________________ +// other includes +#include <cppuhelper/implbase3.hxx> +#include <osl/conditn.hxx> + +//_______________________________________________ +// namespace + +namespace framework{ + +//_______________________________________________ +// exported const + +//_______________________________________________ +// exported definitions + +/** + @short implements an easy way for dispatches + @descr Dispatches are splitted into different parts: + - parsing of the URL + - searching for a dispatcgh object + - dispatching of the URL + All these steps are done inside one method call here. +*/ + +class DispatchHelper : public ThreadHelpBase // must be the first base class! + ,public ::cppu::WeakImplHelper3< ::com::sun::star::lang::XServiceInfo,::com::sun::star::frame::XDispatchHelper,::com::sun::star::frame::XDispatchResultListener > +{ + + //------------------------------------------- + // member + + private: + + /** global uno service manager. + Can be used to create own needed services. */ + css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR; + + /** used to wait for asynchronous listener callbacks. */ + ::osl::Condition m_aBlock; + + css::uno::Any m_aResult; + + css::uno::Reference< css::uno::XInterface > m_xBroadcaster; + + //------------------------------------------- + // interface + + public: + + //--------------------------------------- + // ctor/dtor + + DispatchHelper( const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR ); + virtual ~DispatchHelper( ); + + //--------------------------------------- + // XInterface, XTypeProvider, XServiceInfo + + DECLARE_XSERVICEINFO + + //--------------------------------------- + // XDispatchHelper + virtual css::uno::Any SAL_CALL executeDispatch( + const css::uno::Reference< css::frame::XDispatchProvider >& xDispatchProvider , + const ::rtl::OUString& sURL , + const ::rtl::OUString& sTargetFrameName , + sal_Int32 nSearchFlags , + const css::uno::Sequence< css::beans::PropertyValue >& lArguments ) + throw(css::uno::RuntimeException); + + //--------------------------------------- + // XDispatchResultListener + virtual void SAL_CALL dispatchFinished( + const css::frame::DispatchResultEvent& aResult ) + throw(css::uno::RuntimeException); + + //--------------------------------------- + // XEventListener + virtual void SAL_CALL disposing( + const css::lang::EventObject& aEvent ) + throw(css::uno::RuntimeException); +}; + +} + +#endif diff --git a/framework/inc/services/frame.hxx b/framework/inc/services/frame.hxx new file mode 100644 index 000000000000..6c8a6ed4dd58 --- /dev/null +++ b/framework/inc/services/frame.hxx @@ -0,0 +1,480 @@ +/************************************************************************* + * + * 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_SERVICES_FRAME_HXX_ +#define __FRAMEWORK_SERVICES_FRAME_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <classes/framecontainer.hxx> +#include <classes/propertysethelper.hxx> +#include <threadhelp/resetableguard.hxx> +#include <threadhelp/writeguard.hxx> +#include <threadhelp/readguard.hxx> +#include <threadhelp/threadhelpbase.hxx> + +#ifndef __FRAMEWORK_THREADHELP_TRANSACTIONBASE_HXX_ +#include <threadhelp/transactionbase.hxx> +#endif +#include <macros/generic.hxx> +#include <macros/debug.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> +#include <general.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/frame/XDispatchInformationProvider.hpp> +#include <com/sun/star/frame/XComponentLoader.hpp> +#include <com/sun/star/frame/XController.hpp> +#include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/frame/XDispatchProvider.hpp> +#include <com/sun/star/frame/XDispatchRecorderSupplier.hpp> +#include <com/sun/star/frame/XDispatchProviderInterception.hpp> +#include <com/sun/star/frame/XDispatchProviderInterceptor.hpp> +#include <com/sun/star/lang/XEventListener.hpp> +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/frame/XFrameActionListener.hpp> +#include <com/sun/star/frame/XFrames.hpp> +#include <com/sun/star/frame/XFramesSupplier.hpp> +#include <com/sun/star/frame/XTitle.hpp> +#include <com/sun/star/frame/XTitleChangeBroadcaster.hpp> +#include <com/sun/star/task/XStatusIndicator.hpp> +#include <com/sun/star/task/XStatusIndicatorFactory.hpp> +#include <com/sun/star/awt/XTopWindowListener.hpp> +#include <com/sun/star/awt/XWindow.hpp> +#include <com/sun/star/awt/XTopWindow.hpp> +#include <com/sun/star/awt/XWindowListener.hpp> +#include <com/sun/star/awt/XFocusListener.hpp> +#include <com/sun/star/awt/FocusEvent.hpp> +#include <com/sun/star/datatransfer/dnd/XDropTargetListener.hpp> +#include <com/sun/star/document/XActionLockable.hpp> +#include <com/sun/star/util/XCloseable.hpp> +#include <com/sun/star/frame/XLayoutManager.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <unotools/cmdoptions.hxx> +#include <cppuhelper/interfacecontainer.hxx> +#include <cppuhelper/weak.hxx> +#include <rtl/string.hxx> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ +// exported const +//_________________________________________________________________________________________________________________ + +// This enum can be used to set differnt active states of frames +enum EActiveState +{ + E_INACTIVE , // I'am not a member of active path in tree and i don't have the focus. + E_ACTIVE , // I'am in the middle of an active path in tree and i don't have the focus. + E_FOCUS // I have the focus now. I must a member of an active path! +}; + +//_________________________________________________________________________________________________________________ +// exported definitions +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short implements a normal frame of hierarchy + @descr An instance of these class can be a normal node in frame tree. A frame support influencing of his + subtree, find of subframes, activate- and deactivate-mechanism as well as + set/get of a frame window, component or controller. + + @attention This implementation supports three states: a)uninitialized, b)working, c)disposed + If you call wrong methods in modes a) or c) ... you will get some exceptions. + How you should work with this service: + i) create it by using "xServiceManager->createInstance(...)" + ii) call XInitialization::initialize() with a valid window reference or use createInstanceWithArguments() at i) + iii) works with object + iv) dispose object by calling XComponent::dispose() + After iv) all further requests are rejected by exceptions! (DisposedException) + + @base ThreadHelpBase + help to guarantee correct initialized lock member at startup + @base TransactionBase + help to implement unbreakable interface calls + @base OBroadcastHelper + OPropertySetHelper + implements the property set + @base OWeakObject + provides the refcount and XInterface, XWeak + + @devstatus ready to use + @threadsafe yes + @modified 04.10.2004 10:47, as96863 +*//*-*************************************************************************************************************/ +class Frame : // interfaces + public css::lang::XTypeProvider , + public css::lang::XServiceInfo , + public css::frame::XFramesSupplier , // => XFrame => XComponent + public css::frame::XDispatchProvider , + public css::frame::XDispatchProviderInterception , + public css::frame::XDispatchInformationProvider , + public css::task::XStatusIndicatorFactory , + public css::awt::XWindowListener , // => XEventListener + public css::awt::XTopWindowListener , + public css::awt::XFocusListener , + public css::document::XActionLockable , + public css::util::XCloseable , // => XCloseBroadcaster + public css::frame::XComponentLoader , + public css::frame::XTitle , + public css::frame::XTitleChangeBroadcaster , + // base classes + // Order is neccessary for right initialization of this class! + public ThreadHelpBase , + public TransactionBase , + public PropertySetHelper , // helper implements ThreadHelpbase, TransactionBase, XPropertySet, XPropertySetInfo + public ::cppu::OWeakObject // helper implements XInterface, XWeak +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + + public: + + //--------------------------------------------------------------------------------------------------------- + // constructor / destructor + //--------------------------------------------------------------------------------------------------------- + Frame( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory ); + virtual ~Frame( ); + + //--------------------------------------------------------------------------------------------------------- + // XInterface, XTypeProvider, XServiceInfo + //--------------------------------------------------------------------------------------------------------- + FWK_DECLARE_XINTERFACE + FWK_DECLARE_XTYPEPROVIDER + DECLARE_XSERVICEINFO + + //--------------------------------------------------------------------------------------------------------- + // XComponentLoader + //--------------------------------------------------------------------------------------------------------- + virtual css::uno::Reference< css::lang::XComponent > SAL_CALL loadComponentFromURL ( const ::rtl::OUString& sURL , + const ::rtl::OUString& sTargetFrameName , + sal_Int32 nSearchFlags , + const css::uno::Sequence< css::beans::PropertyValue >& lArguments ) throw( css::io::IOException , + css::lang::IllegalArgumentException , + css::uno::RuntimeException ); + + + //--------------------------------------------------------------------------------------------------------- + // XFramesSupplier + //--------------------------------------------------------------------------------------------------------- + virtual css::uno::Reference< css::frame::XFrames > SAL_CALL getFrames ( ) throw( css::uno::RuntimeException ); + virtual css::uno::Reference< css::frame::XFrame > SAL_CALL getActiveFrame ( ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL setActiveFrame ( const css::uno::Reference< css::frame::XFrame >& xFrame ) throw( css::uno::RuntimeException ); + + //--------------------------------------------------------------------------------------------------------- + // XFrame + //--------------------------------------------------------------------------------------------------------- + virtual void SAL_CALL initialize ( const css::uno::Reference< css::awt::XWindow >& xWindow ) throw( css::uno::RuntimeException ); + virtual css::uno::Reference< css::awt::XWindow > SAL_CALL getContainerWindow ( ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL setCreator ( const css::uno::Reference< css::frame::XFramesSupplier >& xCreator ) throw( css::uno::RuntimeException ); + virtual css::uno::Reference< css::frame::XFramesSupplier > SAL_CALL getCreator ( ) throw( css::uno::RuntimeException ); + virtual ::rtl::OUString SAL_CALL getName ( ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL setName ( const ::rtl::OUString& sName ) throw( css::uno::RuntimeException ); + virtual css::uno::Reference< css::frame::XFrame > SAL_CALL findFrame ( const ::rtl::OUString& sTargetFrameName , + sal_Int32 nSearchFlags ) throw( css::uno::RuntimeException ); + virtual sal_Bool SAL_CALL isTop ( ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL activate ( ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL deactivate ( ) throw( css::uno::RuntimeException ); + virtual sal_Bool SAL_CALL isActive ( ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL contextChanged ( ) throw( css::uno::RuntimeException ); + virtual sal_Bool SAL_CALL setComponent ( const css::uno::Reference< css::awt::XWindow >& xComponentWindow , + const css::uno::Reference< css::frame::XController >& xController ) throw( css::uno::RuntimeException ); + virtual css::uno::Reference< css::awt::XWindow > SAL_CALL getComponentWindow ( ) throw( css::uno::RuntimeException ); + virtual css::uno::Reference< css::frame::XController > SAL_CALL getController ( ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL addFrameActionListener ( const css::uno::Reference< css::frame::XFrameActionListener >& xListener ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL removeFrameActionListener ( const css::uno::Reference< css::frame::XFrameActionListener >& xListener ) throw( css::uno::RuntimeException ); + + //--------------------------------------------------------------------------------------------------------- + // XComponent + //--------------------------------------------------------------------------------------------------------- + virtual void SAL_CALL dispose ( ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL addEventListener ( const css::uno::Reference< css::lang::XEventListener >& xListener ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL removeEventListener ( const css::uno::Reference< css::lang::XEventListener >& xListener ) throw( css::uno::RuntimeException ); + + //--------------------------------------------------------------------------------------------------------- + // XStatusIndicatorFactory + //--------------------------------------------------------------------------------------------------------- + virtual css::uno::Reference< css::task::XStatusIndicator > SAL_CALL createStatusIndicator ( ) throw( css::uno::RuntimeException ); + + //--------------------------------------------------------------------------------------------------------- + // XDispatchProvider + //--------------------------------------------------------------------------------------------------------- + virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL queryDispatch ( const css::util::URL& aURL , + const ::rtl::OUString& sTargetFrameName , + sal_Int32 nSearchFlags ) throw( css::uno::RuntimeException ); + virtual css::uno::Sequence< + css::uno::Reference< css::frame::XDispatch > > SAL_CALL queryDispatches ( const css::uno::Sequence< css::frame::DispatchDescriptor >& lDescriptor ) throw( css::uno::RuntimeException ); + + //--------------------------------------------------------------------------------------------------------- + // XDispatchProviderInterception + //--------------------------------------------------------------------------------------------------------- + virtual void SAL_CALL registerDispatchProviderInterceptor( const css::uno::Reference< css::frame::XDispatchProviderInterceptor >& xInterceptor ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL releaseDispatchProviderInterceptor ( const css::uno::Reference< css::frame::XDispatchProviderInterceptor >& xInterceptor ) throw( css::uno::RuntimeException ); + + //--------------------------------------------------------------------------------------------------------- + // XDispatchInformationProvider + //--------------------------------------------------------------------------------------------------------- + virtual css::uno::Sequence< sal_Int16 > SAL_CALL getSupportedCommandGroups ( ) throw (css::uno::RuntimeException); + virtual css::uno::Sequence< css::frame::DispatchInformation > SAL_CALL getConfigurableDispatchInformation(sal_Int16 nCommandGroup) throw (css::uno::RuntimeException); + + //--------------------------------------------------------------------------------------------------------- + // XWindowListener + // Attention: windowResized() and windowShown() are implement only! All other are empty! + //--------------------------------------------------------------------------------------------------------- + virtual void SAL_CALL windowResized ( const css::awt::WindowEvent& aEvent ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL windowMoved ( const css::awt::WindowEvent& /*aEvent*/ ) throw( css::uno::RuntimeException ) {}; + virtual void SAL_CALL windowShown ( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL windowHidden ( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException ); + + //--------------------------------------------------------------------------------------------------------- + // XFocusListener + // Attention: focusLost() not implemented yet! + //--------------------------------------------------------------------------------------------------------- + virtual void SAL_CALL focusGained ( const css::awt::FocusEvent& aEvent ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL focusLost ( const css::awt::FocusEvent& /*aEvent*/ ) throw( css::uno::RuntimeException ) {}; + + //--------------------------------------------------------------------------------------------------------- + // XTopWindowListener + // Attention: windowActivated(), windowDeactivated() and windowClosing() are implement only! All other are empty! + //--------------------------------------------------------------------------------------------------------- + virtual void SAL_CALL windowActivated ( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL windowDeactivated ( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL windowOpened ( const css::lang::EventObject& /*aEvent*/ ) throw( css::uno::RuntimeException ) {}; + virtual void SAL_CALL windowClosing ( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL windowClosed ( const css::lang::EventObject& /*aEvent*/ ) throw( css::uno::RuntimeException ) {}; + virtual void SAL_CALL windowMinimized ( const css::lang::EventObject& /*aEvent*/ ) throw( css::uno::RuntimeException ) {}; + virtual void SAL_CALL windowNormalized ( const css::lang::EventObject& /*aEvent*/ ) throw( css::uno::RuntimeException ) {}; + + //--------------------------------------------------------------------------------------------------------- + // XEventListener + //--------------------------------------------------------------------------------------------------------- + virtual void SAL_CALL disposing ( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException ); + + //--------------------------------------------------------------------------------------------------------- + // XActionLockable + //--------------------------------------------------------------------------------------------------------- + virtual sal_Bool SAL_CALL isActionLocked ( ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL addActionLock ( ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL removeActionLock( ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL setActionLocks ( sal_Int16 nLock ) throw( css::uno::RuntimeException ); + virtual sal_Int16 SAL_CALL resetActionLocks( ) throw( css::uno::RuntimeException ); + + //--------------------------------------------------------------------------------------------------------- + // XCloseable + //--------------------------------------------------------------------------------------------------------- + virtual void SAL_CALL close( sal_Bool bDeliverOwnerShip ) throw( css::util::CloseVetoException, + css::uno::RuntimeException ); + + //--------------------------------------------------------------------------------------------------------- + // XCloseBroadcaster + //--------------------------------------------------------------------------------------------------------- + virtual void SAL_CALL addCloseListener ( const css::uno::Reference< css::util::XCloseListener >& xListener ) throw (css::uno::RuntimeException); + virtual void SAL_CALL removeCloseListener( const css::uno::Reference< css::util::XCloseListener >& xListener ) throw (css::uno::RuntimeException); + + //--------------------------------------------------------------------------------------------------------- + // XTitle + //--------------------------------------------------------------------------------------------------------- + virtual ::rtl::OUString SAL_CALL getTitle( ) throw (css::uno::RuntimeException); + virtual void SAL_CALL setTitle( const ::rtl::OUString& sTitle ) throw (css::uno::RuntimeException); + + //--------------------------------------------------------------------------------------------------------- + // XTitleChangeBroadcaster + //--------------------------------------------------------------------------------------------------------- + virtual void SAL_CALL addTitleChangeListener ( const css::uno::Reference< css::frame::XTitleChangeListener >& xListener) throw (css::uno::RuntimeException); + virtual void SAL_CALL removeTitleChangeListener( const css::uno::Reference< css::frame::XTitleChangeListener >& xListenr ) throw (css::uno::RuntimeException); + + //--------------------------------------------------------------------------------------------------------- + // PropertySetHelper => XPropertySet, XPropertySetInfo + //--------------------------------------------------------------------------------------------------------- + private: + + void impl_initializePropInfo(); + + virtual void SAL_CALL impl_setPropertyValue(const ::rtl::OUString& sProperty, + sal_Int32 nHandle , + const css::uno::Any& aValue ); + + virtual css::uno::Any SAL_CALL impl_getPropertyValue(const ::rtl::OUString& sProperty, + sal_Int32 nHandle ); + + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + + private: + + /*-****************************************************************************************************//** + @short helper methods + @descr Follow methods are needed at different points of our code (more then ones!). + + @attention Threadsafe methods are signed by "implts_..."! + *//*-*****************************************************************************************************/ + + // threadsafe + void implts_sendFrameActionEvent ( const css::frame::FrameAction& aAction ); + void implts_resizeComponentWindow ( ); + void implts_setIconOnWindow ( ); + void implts_startWindowListening ( ); + void implts_stopWindowListening ( ); + void implts_saveWindowAttributes ( ); + void implts_checkSuicide ( ); + void implts_forgetSubFrames ( ); + DECL_LINK( implts_windowClosing, void* ); + css::uno::Reference< css::awt::XTopWindow > impl_searchTopWindow ( const css::uno::Reference< css::awt::XWindow >& xWindow ); + + // non threadsafe + void impl_checkMenuCloser ( ); + void impl_setCloser ( const css::uno::Reference< css::frame::XFrame >& xFrame , + sal_Bool bState ); + void impl_disposeContainerWindow ( css::uno::Reference< css::awt::XWindow >& xWindow ); + static const css::uno::Sequence< css::beans::Property > impl_getStaticPropertyDescriptor( ); + + //------------------------------------------------------------------------------------------------------------- + // 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(...). + + @attention This methods are static and can't use our member directly! It's better for threadsafe code... + because we call it with references or pointer to check variables ... and must make it safe + by himself! + + @seealso ASSERTs in implementation! + + @param references to checking variables + @return sal_True ,on invalid parameter + @return sal_False ,otherwise + + @onerror We return sal_True + *//*-*****************************************************************************************************/ + + #ifdef ENABLE_ASSERTIONS + + private: + + static sal_Bool implcp_ctor ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory ); + static sal_Bool implcp_setActiveFrame ( const css::uno::Reference< css::frame::XFrame >& xFrame ); + static sal_Bool implcp_addFrameActionListener ( const css::uno::Reference< css::frame::XFrameActionListener >& xListener ); + static sal_Bool implcp_removeFrameActionListener ( const css::uno::Reference< css::frame::XFrameActionListener >& xListener ); + static sal_Bool implcp_addEventListener ( const css::uno::Reference< css::lang::XEventListener >& xListener ); + static sal_Bool implcp_removeEventListener ( const css::uno::Reference< css::lang::XEventListener >& xListener ); + static sal_Bool implcp_windowResized ( const css::awt::WindowEvent& aEvent ); + static sal_Bool implcp_focusGained ( const css::awt::FocusEvent& aEvent ); + static sal_Bool implcp_windowActivated ( const css::lang::EventObject& aEvent ); + static sal_Bool implcp_windowDeactivated ( const css::lang::EventObject& aEvent ); + static sal_Bool implcp_disposing ( const css::lang::EventObject& aEvent ); + + #endif // #ifdef ENABLE_ASSERTIONS + + //************************************************************************************************************* + // variables + // -threadsafe by own read/write lock "m_aLock" + //************************************************************************************************************* + private: + + css::uno::Reference< css::lang::XMultiServiceFactory > m_xFactory ; /// reference to factory, which has create this instance + css::uno::Reference< css::task::XStatusIndicatorFactory > m_xIndicatorFactoryHelper ; /// reference to factory helper to create status indicator objects + css::uno::WeakReference< css::task::XStatusIndicator > m_xIndicatorInterception ; /// points to an external set progress, which should be used instead of the internal one. + css::uno::Reference< css::frame::XDispatchProvider > m_xDispatchHelper ; /// helper for XDispatch/Provider and interception interfaces + css::uno::Reference< css::frame::XFrames > m_xFramesHelper ; /// helper for XFrames, XIndexAccess and XElementAccess interfaces + ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer ; /// container for ALL Listener + css::uno::Reference< css::frame::XFramesSupplier > m_xParent ; /// parent of this frame + css::uno::Reference< css::awt::XWindow > m_xContainerWindow ; /// containerwindow of this frame for embedded components + css::uno::Reference< css::awt::XWindow > m_xComponentWindow ; /// window of the actual component + css::uno::Reference< css::frame::XController > m_xController ; /// controller of the actual frame + css::uno::Reference< css::datatransfer::dnd::XDropTargetListener > m_xDropTargetListener ; /// listen to drag & drop + EActiveState m_eActiveState ; /// state, if i'am a member of active path in tree or i have the focus or ... + ::rtl::OUString m_sName ; /// name of this frame + sal_Bool m_bIsFrameTop ; /// frame has no parent or the parent is a taskor the desktop + sal_Bool m_bConnected ; /// due to FrameActionEvent + sal_Int16 m_nExternalLockCount ; + css::uno::Reference< css::frame::XDispatchRecorderSupplier > m_xDispatchRecorderSupplier ; /// is used for dispatch recording and will be set/get from outside. Frame provide it only! + SvtCommandOptions m_aCommandOptions ; /// ref counted class to support disabling commands defined by configuration file + sal_Bool m_bSelfClose ; /// in case of CloseVetoException on method close() wqs thrown by ourself - we must close ourself later if no internal processes are running + sal_Bool m_bIsHidden ; /// indicates, if this frame is used in hidden mode or not + static css::uno::WeakReference< css::frame::XFrame > m_xCloserFrame ; /// holds the only frame, which must show the special closer menu item (can be NULL!) + css::uno::Reference< ::com::sun::star::frame::XLayoutManager > m_xLayoutManager ; /// is used to layout the child windows of the frame. + css::uno::Reference< css::frame::XDispatchInformationProvider > m_xDispatchInfoHelper ; + css::uno::Reference< css::frame::XTitle > m_xTitleHelper ; + + protected: + + FrameContainer m_aChildFrameContainer ; /// array of child frames + + inline css::uno::Reference< css::lang::XMultiServiceFactory > impl_getFactory() + { + ReadGuard aReadLock( m_aLock ); + return m_xFactory; + } + + inline ::rtl::OUString impl_getName() + { + ReadGuard aReadLock( m_aLock ); + return m_sName; + } + + inline css::uno::Reference< css::awt::XWindow > impl_getContainerWindow() + { + ReadGuard aReadLock( m_aLock ); + return m_xContainerWindow; + } + + inline css::uno::Reference< css::frame::XDispatchProvider > impl_getDispatchHelper() + { + ReadGuard aReadLock( m_aLock ); + return m_xDispatchHelper; + } + + inline css::uno::Reference< css::frame::XFramesSupplier > impl_getParent() + { + ReadGuard aReadLock( m_aLock ); + return m_xParent; + } + +}; // class Frame + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_SERVICES_FRAME_HXX_ diff --git a/framework/inc/services/frameloaderfactory.hxx b/framework/inc/services/frameloaderfactory.hxx new file mode 100644 index 000000000000..01749f841072 --- /dev/null +++ b/framework/inc/services/frameloaderfactory.hxx @@ -0,0 +1,388 @@ +/************************************************************************* + * + * 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_SERVICES_FRAMELOADERFACTORY_HXX_ +#define __FRAMEWORK_SERVICES_FRAMELOADERFACTORY_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <classes/filtercache.hxx> +#include <threadhelp/threadhelpbase.hxx> +#include <macros/generic.hxx> +#include <macros/debug.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> +#include <general.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/lang/WrappedTargetException.hpp> +#include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/container/NoSuchElementException.hpp> +#include <com/sun/star/io/XInputStream.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <cppuhelper/implbase3.hxx> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ +// exported const +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// exported definitions +//_________________________________________________________________________________________________________________ + +struct tIMPLExtractedArguments +{ + ::rtl::OUString sMimeType ; + sal_Int32 nFlags ; + ::rtl::OUString sFilterName ; + sal_Int32 nClipboardFormat ; + ::rtl::OUString sDetectService ; + css::uno::Reference< css::io::XInputStream > xInputStream ; + + sal_Int32 nValidMask ; +}; + +/*-************************************************************************************************************//** + @short factory to create frameloader-objects + @descr These class can be used to create new loader for specified contents. + We use cached values of the registry to lay down, wich frameloader match + a given URL or filtername. To do this, we use the XMultiServiceFactory-interface. + + @ATTENTION In a specialmode of these implementation we support a simple filterdetection. + But there is no special interface. You must call some existing methods in another context! + see createInstanceWithArguments() fo rfurther informations! + + @implements XInterface + XTypeProvider + XServiceInfo + XMultiServiceFactory + XNameAccess + XElementAccess + @base ThreadHelpBase + OWeakObject + + @devstatus deprecated +*//*-*************************************************************************************************************/ + +class FrameLoaderFactory : public ThreadHelpBase , // Struct for right initalization of mutex member! Mst first of baseclasses + public ::cppu::WeakImplHelper3< ::com::sun::star::lang::XServiceInfo,::com::sun::star::lang::XMultiServiceFactory,::com::sun::star::container::XNameAccess > +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + + public: + + //--------------------------------------------------------------------------------------------------------- + // constructor / destructor + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short standard constructor + @descr Initialize a new instance and fill the registrycache with values. + To do this - xFactory must be valid! + + @seealso class RegistryCache + @seealso member m_aRegistryCache + + @param "xFactory", factory which has created us. + @return - + + @onerror An ASSERTION is thrown in debug version, if xFactory is invalid or cache can't filled. + *//*-*****************************************************************************************************/ + + FrameLoaderFactory( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory ); + + /*-****************************************************************************************************//** + @short standard destructor to delete instance + @descr We use it to clear ouer cache. + + @seealso class RegistryCache + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual ~FrameLoaderFactory(); + + //--------------------------------------------------------------------------------------------------------- + // XInterface, XTypeProvider, XServiceInfo + //--------------------------------------------------------------------------------------------------------- + + DECLARE_XSERVICEINFO + + //--------------------------------------------------------------------------------------------------------- + // XMultiServiceFactory + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short create a new frameloder (without arguments!) + @descr We search for an agreement between given type name and our cache-content. + If we found some information, we create the registered frameloader for these type. + Otherwise - we return NULL. + We search from begin to end of internal loader list! + + @seealso method impl_createFrameLoader() + @seealso method createInstanceWithArguments() + + @param "sTypeName", type name of a document to filter, open or save. + @return A reference to a new created frameloader. + + @onerror A null reference is returned. + *//*-*****************************************************************************************************/ + + virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance( const ::rtl::OUString& sTypeName ) throw( css::uno::Exception , + css::uno::RuntimeException ); + + /*-****************************************************************************************************//** + @short create a new frameloder + @descr We search for an agreement between given type name and our cache-content. + If we found some information, we create the registered frameloader for these type. + Otherwise - we return NULL. + You can give us some optional arguments to influence our search! + + @seealso method impl_createFrameLoader() + @seealso method createInstance() + + @param "sTypeName", type name of a document to filter, open or save. + @param "seqArguments", list of optional arguments for initializing of new frameloader. + @return A reference to a new created frameloader. + + @onerror A null reference is returned. + *//*-*****************************************************************************************************/ + + virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstanceWithArguments( const ::rtl::OUString& sTypeName , + const css::uno::Sequence< css::uno::Any >& seqArguments) throw( css::uno::Exception , + css::uno::RuntimeException); + + /*-****************************************************************************************************//** + @short not supported + @descr Please use XNameAcces instead of these! + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getAvailableServiceNames() throw( css::uno::RuntimeException ); + + //--------------------------------------------------------------------------------------------------------- + // XNameAccess + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short return properties of registered frame loader specified by his implementation name + @descr Use these method to get all informations about our internal loader cache + and a special frame loader. + We return a Sequence< PropertyValue > in an Any packed as result. + + structure of return value: + [0].Name = "Types" + [0].Value = list of supported types of these loader as [sequence< oustring >] + + [1].Name = "UIName" + [1].Value = localized name of loader as [string] + + @seealso method getElementNames() + @seealso method hasByName() + + @param "sName", the name of searched frame loader (use getElementNames() to get it!) + @return A Sequence< PropertyValue > packed in an Any. + + @onerror If given name not exist a NoSuchElementException is thrown. + *//*-*****************************************************************************************************/ + + virtual css::uno::Any SAL_CALL getByName( const ::rtl::OUString& sName ) throw( css::container::NoSuchElementException , + css::lang::WrappedTargetException , + css::uno::RuntimeException ); + + /*-****************************************************************************************************//** + @short return list of all well known loader names from configuration + @descr Use these method to get all names of well known loader. + You can use it to get the properties of a loader by calling getByName()! + + @seealso method getByName() + @seealso method hasByName() + + @param - + @return A list of well known loader. Is static at runtime! + + @onerror No error should occure. + *//*-*****************************************************************************************************/ + + virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() throw( css::uno::RuntimeException ); + + /*-****************************************************************************************************//** + @short check if searched frame loader exist in configuration + @descr Normaly nobody need these method realy (use getElementNames() in combination with getByName()). + We guarantee correctness of these mechanism. There is no reason to check for existing elements then ... + but if you have an unknwon name and has no fun to search it in returned sequence ... + you can call these ... + + @seealso method getByName() + @seealso method getElementNames() + + @param "sName", implementation name of searched frame loader + @return sal_True if loader exist, sal_False otherwise. + + @onerror No error should occure. + *//*-*****************************************************************************************************/ + + virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& sName ) throw( css::uno::RuntimeException ); + + //--------------------------------------------------------------------------------------------------------- + // XElementAccess + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short return the type of retrun value of method XNameAccess::getByName() + @descr In these implementation its a Sequence< PropertyValue > everytime! + + @seealso description of interface XNameAccess + + @param - + @return Type of Sequence< PropertyValue >. + + @onerror No error should occure. + *//*-*****************************************************************************************************/ + + virtual css::uno::Type SAL_CALL getElementType() throw( css::uno::RuntimeException ); + + /*-****************************************************************************************************//** + @short return state if informations about frame loader available + @descr If these method return false - no information could'nt read from configuration ... + I think nothing will work then. Normaly we return sal_True! + + @seealso class FilterCache! + + @param - + @return sal_True if information available, sal_False otherwise. + + @onerror No error should occure. + *//*-*****************************************************************************************************/ + + virtual sal_Bool SAL_CALL hasElements() throw( css::uno::RuntimeException ); + + //------------------------------------------------------------------------------------------------------------- + // protected methods + //------------------------------------------------------------------------------------------------------------- + + protected: + + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + + private: + + /*-****************************************************************************************************//** + @short try to set configuration properties at created loader + @descr We support the old async. loader interface ( XFrameLoader ) and the new one XSynchronousFrameLoader. + The new one should implement a property set on which we can set his configuration values! + We try to cast given loader to these interface - if it's exist we set the values - otherwise not! + + @seealso service FrameLoader + @seealso service SynchronousFrameLoader + + @param "xLoader" loader with generic XInterface! (We don't know before which service type is used!) + @param "pLoaderInfo" configuration structure of these loader. + @return - + + @onerror No error should occure. + *//*-*****************************************************************************************************/ + + void impl_initializeLoader( css::uno::Reference< css::uno::XInterface >& xLoader, const Loader& pLoaderInfo ); + + //------------------------------------------------------------------------------------------------------------- + // 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 + @return sal_True ,otherwise + + @onerror - + *//*-*****************************************************************************************************/ + + + #ifdef ENABLE_ASSERTIONS + + private: + + static sal_Bool impldbg_checkParameter_FrameLoaderFactory ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory ); + static sal_Bool impldbg_checkParameter_createInstance ( const ::rtl::OUString& sTypeName ); + static sal_Bool impldbg_checkParameter_createInstanceWithArguments ( const ::rtl::OUString& sTypeName , + const css::uno::Sequence< css::uno::Any >& seqArguments); + static sal_Bool impldbg_checkParameter_getByName ( const ::rtl::OUString& sName ); + static sal_Bool impldbg_checkParameter_hasByName ( const ::rtl::OUString& sName ); + + #endif // #ifdef ENABLE_ASSERTIONS + + //------------------------------------------------------------------------------------------------------------- + // private variables + // (should be private everyway!) + //------------------------------------------------------------------------------------------------------------- + + private: + + css::uno::Reference< css::lang::XMultiServiceFactory > m_xFactory ; + FilterCache m_aCache ; + +}; // class FrameLoaderFactory + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_SERVICES_FRAMELOADERFACTORY_HXX_ diff --git a/framework/inc/services/layoutmanager.hxx b/framework/inc/services/layoutmanager.hxx new file mode 100644 index 000000000000..e6a638c654e9 --- /dev/null +++ b/framework/inc/services/layoutmanager.hxx @@ -0,0 +1,376 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: layoutmanager.hxx,v $ + * $Revision: 1.34 $ + * + * 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_SERVICES_LAYOUTMANAGER_HXX_ +#define __FRAMEWORK_SERVICES_LAYOUTMANAGER_HXX_ + +/** Attention: stl headers must(!) be included at first. Otherwhise it can make trouble + with solaris headers ... +*/ +#include <vector> + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ +#include <threadhelp/threadhelpbase.hxx> +#include <threadhelp/resetableguard.hxx> +#include <threadhelp/writeguard.hxx> +#include <threadhelp/readguard.hxx> +#include <macros/generic.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> +#include <stdtypes.h> +#include <properties.h> +#include <stdtypes.h> +#include <uielement/menubarmanager.hxx> +#include <uiconfiguration/windowstateconfiguration.hxx> +#include <framework/addonsoptions.hxx> +#include <uielement/panelwindow.hxx> +#include <uielement/uielement.hxx> +#include <helper/ilayoutnotifications.hxx> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/frame/XLayoutManager.hpp> +#include <com/sun/star/ui/XUIConfigurationManager.hpp> +#include <com/sun/star/ui/XUIConfiguration.hpp> +#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/frame/XFrameActionListener.hpp> +#include <com/sun/star/awt/XWindowListener.hpp> +#include <com/sun/star/util/XURLTransformer.hpp> +#include <com/sun/star/ui/XUIElementFactory.hpp> +#include <com/sun/star/frame/XInplaceLayout.hpp> +#include <com/sun/star/ui/DockingArea.hpp> +#include <com/sun/star/awt/XTopWindow2.hpp> +#include <com/sun/star/awt/XDockableWindow.hpp> +#include <com/sun/star/awt/XDockableWindowListener.hpp> +#include <com/sun/star/frame/XMenuBarMergingAcceptor.hpp> +#include <com/sun/star/frame/XLayoutManagerEventBroadcaster.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <cppuhelper/propshlp.hxx> +#include <cppuhelper/implbase8.hxx> +#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/propertycontainer.hxx> +#include <tools/wintypes.hxx> +#include <svtools/miscopt.hxx> +#include <vcl/toolbox.hxx> +#include <vcl/timer.hxx> + +class MenuBar; +namespace framework +{ + class ToolbarLayoutManager; + class PanelManager; + class GlobalSettings; + typedef ::cppu::WeakImplHelper8 < ::com::sun::star::lang::XServiceInfo + , ::com::sun::star::frame::XLayoutManager + , ::com::sun::star::awt::XWindowListener + , ::com::sun::star::frame::XFrameActionListener + , ::com::sun::star::ui::XUIConfigurationListener + , ::com::sun::star::frame::XInplaceLayout + , ::com::sun::star::frame::XMenuBarMergingAcceptor + , ::com::sun::star::frame::XLayoutManagerEventBroadcaster + > LayoutManager_Base; + typedef ::comphelper::OPropertyContainer LayoutManager_PBase; + class LayoutManager : public LayoutManager_Base , + // base classes + // Order is neccessary for right initialization! + private ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses. + public ::cppu::OBroadcastHelper , + public ILayoutNotifications , + public LayoutManager_PBase + { + public: + enum { DOCKINGAREAS_COUNT = 4 }; + + LayoutManager( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rSMGR ); + virtual ~LayoutManager(); + + /** declaration of XInterface, XTypeProvider, XServiceInfo */ + FWK_DECLARE_XINTERFACE + FWK_DECLARE_XTYPEPROVIDER + DECLARE_XSERVICEINFO + + //--------------------------------------------------------------------------------------------------------- + // XLayoutManager + //--------------------------------------------------------------------------------------------------------- + virtual void SAL_CALL attachFrame( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& Frame ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL reset() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::awt::Rectangle SAL_CALL getCurrentDockingArea( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::ui::XDockingAreaAcceptor > SAL_CALL getDockingAreaAcceptor() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setDockingAreaAcceptor( const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XDockingAreaAcceptor >& xDockingAreaAcceptor ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL createElement( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL destroyElement( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL requestElement( const ::rtl::OUString& ResourceURL ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElement > SAL_CALL getElement( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElement > > SAL_CALL getElements( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL showElement( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hideElement( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL dockWindow( const ::rtl::OUString& aName, ::com::sun::star::ui::DockingArea DockingArea, const ::com::sun::star::awt::Point& Pos ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL dockAllWindows( ::sal_Int16 nElementType ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL floatWindow( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL lockWindow( const ::rtl::OUString& ResourceURL ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL unlockWindow( const ::rtl::OUString& ResourceURL ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setElementSize( const ::rtl::OUString& aName, const ::com::sun::star::awt::Size& aSize ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setElementPos( const ::rtl::OUString& aName, const ::com::sun::star::awt::Point& aPos ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setElementPosSize( const ::rtl::OUString& aName, const ::com::sun::star::awt::Point& aPos, const ::com::sun::star::awt::Size& aSize ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isElementVisible( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isElementFloating( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isElementDocked( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL isElementLocked( const ::rtl::OUString& ResourceURL ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::awt::Size SAL_CALL getElementSize( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::awt::Point SAL_CALL getElementPos( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL lock( ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL unlock( ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL doLayout( ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setVisible( sal_Bool bVisible ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isVisible() throw (::com::sun::star::uno::RuntimeException); + + //--------------------------------------------------------------------------------------------------------- + // XInplaceLayout + //--------------------------------------------------------------------------------------------------------- + virtual void SAL_CALL setInplaceMenuBar( sal_Int64 pInplaceMenuBarPointer ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL resetInplaceMenuBar( ) throw (::com::sun::star::uno::RuntimeException); + + //--------------------------------------------------------------------------------------------------------- + // XMenuBarMergingAcceptor + //--------------------------------------------------------------------------------------------------------- + virtual sal_Bool SAL_CALL setMergedMenuBar( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& xMergedMenuBar ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeMergedMenuBar( ) throw (::com::sun::star::uno::RuntimeException); + + //--------------------------------------------------------------------------------------------------------- + // XWindowListener + //--------------------------------------------------------------------------------------------------------- + virtual void SAL_CALL windowResized( const css::awt::WindowEvent& aEvent ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL windowMoved( const css::awt::WindowEvent& aEvent ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL windowShown( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL windowHidden( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException ); + + //--------------------------------------------------------------------------------------------------------- + // XFrameActionListener + //--------------------------------------------------------------------------------------------------------- + virtual void SAL_CALL frameAction( const css::frame::FrameActionEvent& aEvent ) throw ( css::uno::RuntimeException ); + + //--------------------------------------------------------------------------------------------------------- + // XEventListener + //--------------------------------------------------------------------------------------------------------- + using cppu::OPropertySetHelper::disposing; + virtual void SAL_CALL disposing( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException ); + + //--------------------------------------------------------------------------------------------------------- + // XUIConfigurationListener + //--------------------------------------------------------------------------------------------------------- + virtual void SAL_CALL elementInserted( const ::com::sun::star::ui::ConfigurationEvent& Event ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL elementRemoved( const ::com::sun::star::ui::ConfigurationEvent& Event ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL elementReplaced( const ::com::sun::star::ui::ConfigurationEvent& Event ) throw (::com::sun::star::uno::RuntimeException); + + //--------------------------------------------------------------------------------------------------------- + // XLayoutManagerEventBroadcaster + //--------------------------------------------------------------------------------------------------------- + virtual void SAL_CALL addLayoutManagerEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XLayoutManagerListener >& aLayoutManagerListener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeLayoutManagerEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XLayoutManagerListener >& aLayoutManagerListener ) throw (::com::sun::star::uno::RuntimeException); + + DECL_LINK( MenuBarClose, MenuBar * ); + DECL_LINK( WindowEventListener, VclSimpleEvent* ); + + //--------------------------------------------------------------------------------------------------------- + // ILayoutNotifications + //--------------------------------------------------------------------------------------------------------- + virtual void requestLayout( Hint eHint ); + + protected: + DECL_LINK( AsyncLayoutHdl, Timer * ); + + private: + //--------------------------------------------------------------------------------------------------------- + // helper + //--------------------------------------------------------------------------------------------------------- + + //--------------------------------------------------------------------------------------------------------- + // menu bar + //--------------------------------------------------------------------------------------------------------- + void impl_clearUpMenuBar(); + void implts_reset( sal_Bool bAttach ); + void implts_setMenuBarCloser(sal_Bool bCloserState); + void implts_updateMenuBarClose(); + sal_Bool implts_resetMenuBar(); + + //--------------------------------------------------------------------------------------------------------- + // locking + //--------------------------------------------------------------------------------------------------------- + void implts_lock(); + sal_Bool implts_unlock(); + + //--------------------------------------------------------------------------------------------------------- + // query + //--------------------------------------------------------------------------------------------------------- + ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElement > implts_findElement( const rtl::OUString& aName ); + UIElement& impl_findElement( const rtl::OUString& aName ); + + void implts_writeNewStateData( const rtl::OUString aName, const ::com::sun::star::uno::Reference< com::sun::star::awt::XWindow >& xWindow ); + sal_Bool implts_readWindowStateData( const rtl::OUString& rName, UIElement& rElementData ); + void implts_writeWindowStateData( const rtl::OUString& rName, const UIElement& rElementData ); + void implts_setElementData( UIElement& rUIElement, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDockableWindow >& rDockWindow ); + void implts_sortUIElements(); + void implts_destroyElements(); + void implts_toggleFloatingUIElementsVisibility( sal_Bool bActive ); + void implts_reparentChildWindows(); + ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElement > implts_createDockingWindow( const ::rtl::OUString& aElementName ); + + sal_Bool implts_isEmbeddedLayoutManager() const; + sal_Int16 implts_getCurrentSymbolsSize(); + sal_Int16 implts_getCurrentSymbolsStyle(); + ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElement > implts_createElement( const rtl::OUString& aName ); + + // layouting methods + sal_Bool implts_resizeContainerWindow( const ::com::sun::star::awt::Size& rContainerSize, const ::com::sun::star::awt::Point& rComponentPos ); + ::Size implts_getTopBottomDockingAreaSizes(); + ::Size implts_getContainerWindowOutputSize(); + + void implts_setDockingAreaWindowSizes( const css::awt::Rectangle& rBorderSpace ); + ::com::sun::star::awt::Rectangle implts_calcDockingAreaSizes(); + sal_Bool implts_doLayout( sal_Bool bForceRequestBorderSpace, sal_Bool bOuterResize ); + void implts_doLayout_notify( sal_Bool bOuterResize ); + + // internal methods to control status/progress bar + ::Size implts_getStatusBarSize(); + void implts_destroyStatusBar(); + void implts_createStatusBar( const rtl::OUString& rStatusBarName ); + void implts_createProgressBar(); + void implts_destroyProgressBar(); + void implts_setStatusBarPosSize( const ::Point& rPos, const ::Size& rSize ); + sal_Bool implts_showStatusBar( sal_Bool bStoreState=sal_False ); + sal_Bool implts_hideStatusBar( sal_Bool bStoreState=sal_False ); + void implts_readStatusBarState( const rtl::OUString& rStatusBarName ); + sal_Bool implts_showProgressBar(); + sal_Bool implts_hideProgressBar(); + void implts_backupProgressBarWrapper(); + void implts_setOffset( const sal_Int32 nBottomOffset ); + + void implts_setInplaceMenuBar( + const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& xMergedMenuBar ) + throw (::com::sun::star::uno::RuntimeException); + void implts_resetInplaceMenuBar() + throw (::com::sun::star::uno::RuntimeException); + + void implts_setVisibleState( sal_Bool bShow ); + void implts_updateUIElementsVisibleState( sal_Bool bShow ); + void implts_setCurrentUIVisibility( sal_Bool bShow ); + void implts_notifyListeners( short nEvent, ::com::sun::star::uno::Any aInfoParam ); + + DECL_LINK( OptionsChanged, void* ); + DECL_LINK( SettingsChanged, void* ); + + //--------------------------------------------------------------------------------------------------------- + // 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); + + css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR; /** reference to factory, which has created this instance. */ + css::uno::Reference< css::util::XURLTransformer > m_xURLTransformer; + css::uno::Reference< css::container::XIndexAccess > m_xDisplayAccess; + css::uno::Reference< css::frame::XFrame > m_xFrame; + css::uno::Reference< ::com::sun::star::ui::XUIConfigurationManager > m_xModuleCfgMgr; + css::uno::Reference< ::com::sun::star::ui::XUIConfigurationManager > m_xDocCfgMgr; + css::uno::WeakReference< css::frame::XModel > m_xModel; + css::uno::Reference< css::awt::XWindow > m_xContainerWindow; + css::uno::Reference< css::awt::XTopWindow2 > m_xContainerTopWindow; + sal_Int32 m_nLockCount; + bool m_bActive; + bool m_bInplaceMenuSet; + bool m_bDockingInProgress; + bool m_bMenuVisible; + bool m_bComponentAttached; + bool m_bDoLayout; + bool m_bVisible; + bool m_bParentWindowVisible; + bool m_bMustDoLayout; + bool m_bAutomaticToolbars; + bool m_bStoreWindowState; + bool m_bHideCurrentUI; + bool m_bGlobalSettings; + bool m_bPreserveContentSize; + bool m_bMenuBarCloser; + css::awt::Rectangle m_aDockingArea; + css::uno::Reference< ::com::sun::star::ui::XDockingAreaAcceptor > m_xDockingAreaAcceptor; + css::uno::Reference< ::com::sun::star::lang::XComponent > m_xInplaceMenuBar; + MenuBarManager* m_pInplaceMenuBar; + css::uno::Reference< ::com::sun::star::ui::XUIElement > m_xMenuBar; + UIElement m_aStatusBarElement; + UIElement m_aProgressBarElement; + com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElement > m_xProgressBarBackup; + css::uno::Reference< ::com::sun::star::frame::XModuleManager > m_xModuleManager; + css::uno::Reference< ::com::sun::star::ui::XUIElementFactory > m_xUIElementFactoryManager; + css::uno::Reference< ::com::sun::star::container::XNameAccess > m_xPersistentWindowState; + css::uno::Reference< ::com::sun::star::container::XNameAccess > m_xPersistentWindowStateSupplier; + GlobalSettings* m_pGlobalSettings; + rtl::OUString m_aModuleIdentifier; + rtl::OUString m_aStatusBarAlias; + rtl::OUString m_aProgressBarAlias; + rtl::OUString m_aPropDocked; + rtl::OUString m_aPropVisible; + rtl::OUString m_aPropDockingArea; + rtl::OUString m_aPropDockPos; + rtl::OUString m_aPropPos; + rtl::OUString m_aPropSize; + rtl::OUString m_aPropUIName; + rtl::OUString m_aPropStyle; + rtl::OUString m_aPropLocked; + rtl::OUString m_aCustomizeCmd; + sal_Int16 m_eSymbolsSize; + sal_Int16 m_eSymbolsStyle; + Timer m_aAsyncLayoutTimer; + ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; // container for ALL Listener + PanelManager* m_pPanelManager; + ToolbarLayoutManager* m_pToolbarManager; + css::uno::Reference< ::com::sun::star::ui::XUIConfigurationListener > m_xToolbarManager; + }; + +} // namespace framework + +#endif // __FRAMEWORK_SERVICES_LAYOUTMANAGER_HXX_ diff --git a/framework/inc/services/license.hxx b/framework/inc/services/license.hxx new file mode 100644 index 000000000000..59e7f036961e --- /dev/null +++ b/framework/inc/services/license.hxx @@ -0,0 +1,123 @@ +/************************************************************************* + * + * 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_SERVICES_LICENSE_HXX_ +#define __FRAMEWORK_SERVICES_LICENSE_HXX_ + +/** Attention: stl headers must(!) be included at first. Otherwhise it can make trouble + with solaris headers ... +*/ +#include <vector> + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ +#include <threadhelp/threadhelpbase.hxx> +#include <threadhelp/resetableguard.hxx> +#include <threadhelp/writeguard.hxx> +#include <threadhelp/readguard.hxx> +#include <macros/generic.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> +#include <stdtypes.h> +#include <properties.h> +#include <stdtypes.h> +#include <uielement/menubarmanager.hxx> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/task/XJob.hpp> +#include <com/sun/star/util/XCloseable.hpp> +#include <com/sun/star/util/CloseVetoException.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <cppuhelper/propshlp.hxx> +#include <cppuhelper/interfacecontainer.hxx> +#include <cppuhelper/weak.hxx> + +namespace framework +{ + class License : public css::lang::XTypeProvider , + public css::lang::XServiceInfo , + public css::task::XJob , + public css::util::XCloseable , + // base classes + // Order is neccessary for right initialization! + private ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses. + public ::cppu::OWeakObject // => XWeak, XInterface + { + private: + css::uno::Reference< css::lang::XMultiServiceFactory > m_xFactory; + sal_Bool m_bTerminate; + public: + License( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rSMGR ); + virtual ~License(); + + /** declaration of XInterface, XTypeProvider, XServiceInfo */ + FWK_DECLARE_XINTERFACE + FWK_DECLARE_XTYPEPROVIDER + DECLARE_XSERVICEINFO + +#if 0 + DECL_STATIC_LINK( License, Terminate, void* ); +#endif + + /* + XJob... + any execute([in] sequence< ::com::sun::star::beans::NamedValue > Arguments ) + raises( + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::uno::Exception ); + */ + virtual css::uno::Any SAL_CALL execute(const css::uno::Sequence<css::beans::NamedValue>& args) + throw( css::lang::IllegalArgumentException, css::uno::Exception); + + /* + XCLoseable + void close( [in] boolean DeliverOwnership ) raises(CloseVetoException ); + */ + virtual void SAL_CALL close(sal_Bool bDeliverOwnership) throw (css::util::CloseVetoException); + + /* + XCloseVroadcaster + [oneway] void addCloseListener([in] XCloseListenerListener ); + [oneway] void removeCloseListener([in] XCloseListenerListener ); + */ + virtual void SAL_CALL addCloseListener(const css::uno::Reference< css::util::XCloseListener >& aListener) throw (css::uno::RuntimeException); + virtual void SAL_CALL removeCloseListener(const css::uno::Reference< css::util::XCloseListener >& aListener) throw (css::uno::RuntimeException); + +}; + +} // namespace framework + +#endif // __FRAMEWORK_SERVICES_LAYOUTMANAGER_HXX_ diff --git a/framework/inc/services/licensedlg.hxx b/framework/inc/services/licensedlg.hxx new file mode 100644 index 000000000000..683a147adfd6 --- /dev/null +++ b/framework/inc/services/licensedlg.hxx @@ -0,0 +1,104 @@ +/************************************************************************* + * + * 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 __LICENSEDLG_HXX__ +#define __LICENSEDLG_HXX__ + +#include <sal/types.h> +#include <rtl/string.hxx> +#include <rtl/ustring.hxx> +#include <rtl/ustrbuf.hxx> +#include <tools/string.hxx> +#include <tools/resmgr.hxx> +#include <vcl/button.hxx> +#include <vcl/edit.hxx> +#include <vcl/fixed.hxx> +#include <vcl/dialog.hxx> +#include <vcl/scrbar.hxx> +#include <svtools/svmedit.hxx> +#include <svl/lstner.hxx> + +namespace framework { + +class LicenseView : public MultiLineEdit, public SfxListener +{ + sal_Bool mbEndReached; + Link maEndReachedHdl; + Link maScrolledHdl; + +public: + LicenseView( Window* pParent, const ResId& rResId ); + ~LicenseView(); + + void ScrollDown( ScrollType eScroll ); + + sal_Bool IsEndReached() const; + sal_Bool EndReached() const { return mbEndReached; } + void SetEndReached( sal_Bool bEnd ) { mbEndReached = bEnd; } + + void SetEndReachedHdl( const Link& rHdl ) { maEndReachedHdl = rHdl; } + const Link& GetAutocompleteHdl() const { return maEndReachedHdl; } + + void SetScrolledHdl( const Link& rHdl ) { maScrolledHdl = rHdl; } + const Link& GetScrolledHdl() const { return maScrolledHdl; } + + using MultiLineEdit::Notify; + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); +}; + +class LicenseDialog : public ModalDialog +{ + LicenseView aLicenseML; + FixedText aInfo1FT; + FixedText aInfo2FT; + FixedText aInfo3FT; + FixedText aInfo2_1FT; + FixedText aInfo3_1FT; + FixedLine aFixedLine; + PushButton aPBPageDown; + PushButton aPBDecline; + PushButton aPBAccept; + FixedImage aArrow; + String aStrAccept; + String aStrNotAccept; + String aOldCancelText; + sal_Bool bEndReached; + + void EnableControls(); + + DECL_LINK( PageDownHdl, PushButton * ); + DECL_LINK( EndReachedHdl, LicenseView * ); + DECL_LINK( ScrolledHdl, LicenseView * ); + DECL_LINK( AcceptBtnHdl, PushButton * ); + DECL_LINK( DeclineBtnHdl, PushButton * ); + + public: + LicenseDialog(const rtl::OUString& aLicense, ResMgr *pResMgr); + virtual ~LicenseDialog(); + +}; +} +#endif diff --git a/framework/inc/services/logindialog.hrc b/framework/inc/services/logindialog.hrc new file mode 100644 index 000000000000..0d845d273fd8 --- /dev/null +++ b/framework/inc/services/logindialog.hrc @@ -0,0 +1,52 @@ +/************************************************************************* + * + * 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. + * + ************************************************************************/ +// windows / dialogs +#define RID_DLG_LOGIN 1000 + +// controls +#define RID_FI_HEADER 1 +#define RID_FT_LOGINTEXT 2 +#define RID_FT_USERNAME 3 +#define RID_FT_PASSWORD 4 +#define RID_FT_SERVER 5 +#define RID_ED_USERNAME 6 +#define RID_ED_PASSWORD 7 +#define RID_FL_SERVER 8 +#define RID_CB_SERVER 9 +#define RID_FL_PROXYSETTINGS 10 +#define RID_RB_NOPROXY 11 +#define RID_RB_USEBROWSERPROXY 12 +#define RID_RB_USECUSTOMPROXY 13 +#define RID_FT_SECURITYPROXY 15 +#define RID_FT_SECURITYPROXYHOST 16 +#define RID_ED_SECURITYPROXYHOST 17 +#define RID_FT_SECURITYPROXYPORT 18 +#define RID_ED_SECURITYPROXYPORT 19 +#define RID_FL_BUTTONS 20 +#define RID_PB_OK 21 +#define RID_PB_CANCEL 22 +#define RID_PB_ADDITIONALSETTINGS 23 diff --git a/framework/inc/services/logindialog.hxx b/framework/inc/services/logindialog.hxx new file mode 100644 index 000000000000..14e4f39462ed --- /dev/null +++ b/framework/inc/services/logindialog.hxx @@ -0,0 +1,890 @@ +/************************************************************************* + * + * 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_LOGINDIALOG_LOGINDIALOG_HXX_ +#define __FRAMEWORK_LOGINDIALOG_LOGINDIALOG_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#ifndef __FRAMEWORK_THREADHELPER_THREADHELPBASE_HXX_ +#include <threadhelp/threadhelpbase.hxx> +#endif +#include <macros/generic.hxx> +#include <macros/debug.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> + +#include <services/logindialog.hrc> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/awt/XDialog.hpp> +#include <com/sun/star/lang/IllegalArgumentException.hpp> +#include <com/sun/star/beans/XPropertySetInfo.hpp> +#include <com/sun/star/beans/Property.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/lang/Locale.hpp> +#include <com/sun/star/util/XFlushable.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <tools/config.hxx> +#include <cppuhelper/weak.hxx> +#include <cppuhelper/propshlp.hxx> +#include <vcl/dialog.hxx> +#include <vcl/fixed.hxx> +#include <vcl/edit.hxx> +#include <vcl/combobox.hxx> + +#ifndef _SV_BUTTON_HXX +#include <vcl/button.hxx> +#endif + +#ifndef _SV_BUTTON_HXX +#include <vcl/button.hxx> +#endif +#include <vcl/morebtn.hxx> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +#define ANY ::com::sun::star::uno::Any +#define EXCEPTION ::com::sun::star::uno::Exception +#define ILLEGALARGUMENTEXCEPTION ::com::sun::star::lang::IllegalArgumentException +#define IPROPERTYARRAYHELPER ::cppu::IPropertyArrayHelper +#define OBROADCASTHELPER ::cppu::OBroadcastHelper +#define OPROPERTYSETHELPER ::cppu::OPropertySetHelper +#define OUSTRING ::rtl::OUString +#define OWEAKOBJECT ::cppu::OWeakObject +#define PROPERTY ::com::sun::star::beans::Property +#define REFERENCE ::com::sun::star::uno::Reference +#define RUNTIMEEXCEPTION ::com::sun::star::uno::RuntimeException +#define SEQUENCE ::com::sun::star::uno::Sequence +#define XDIALOG ::com::sun::star::awt::XDialog +#define XMULTISERVICEFACTORY ::com::sun::star::lang::XMultiServiceFactory +#define XPROPERTYSETINFO ::com::sun::star::beans::XPropertySetInfo +#define XSERVICEINFO ::com::sun::star::lang::XServiceInfo +#define XTYPEPROVIDER ::com::sun::star::lang::XTypeProvider +#define PROPERTYVALUE ::com::sun::star::beans::PropertyValue +#define LOCALE ::com::sun::star::lang::Locale +#define XFLUSHABLE ::com::sun::star::util::XFlushable +#define XFLUSHLISTENER ::com::sun::star::util::XFlushListener + +//_________________________________________________________________________________________________________________ +// exported const +//_________________________________________________________________________________________________________________ + +#ifdef WNT + #define ININAME DECLARE_ASCII("login.ini") +#elif defined UNIX + #define ININAME DECLARE_ASCII("loginrc") +#else + #error "name of login profile unknown!" +#endif + +#define UNCPATHSEPERATOR sal_Unicode(0x002F) +#define MAX_SERVERHISTORY 10 + +// Use follow keys in follow order. +// [Global] +// UserName=as +// ActiveServer=2 +// ConnectionType=https +// Language=en-US +// UseProxy=[browser|custom|none] +// SecurityProxy=so-webcache:3128 +// dialog=[big|small] +// +// [DefaultPorts] +// https=8445 +// http=8090 +// +// [ServerHistory] +// Server_1=localhost +// Server_2=munch:7202 +// Server_3=www.xxx.com:8000 + +#define SECTION_GLOBAL "Global" +#define SECTION_DEFAULTPORTS "DefaultPorts" +#define SECTION_SERVERHISTORY "ServerHistory" + +#define SECTION_USERNAME SECTION_GLOBAL +#define SECTION_ACTIVESERVER SECTION_GLOBAL +#define SECTION_CONNECTIONTYPE SECTION_GLOBAL +#define SECTION_LANGUAGE SECTION_GLOBAL +#define SECTION_SECURITYPROXY SECTION_GLOBAL +#define SECTION_DIALOG SECTION_GLOBAL +#define SECTION_HTTP SECTION_DEFAULTPORTS +#define SECTION_HTTPS SECTION_DEFAULTPORTS +#define SECTION_SERVER_X SECTION_SERVERHISTORY + +#define KEY_USERNAME "UserName" +#define KEY_ACTIVESERVER "ActiveServer" +#define KEY_CONNECTIONTYPE "ConnectionType" +#define KEY_LANGUAGE "Language" +#define KEY_SERVER_X "Server_" +#define KEY_SECURITYPROXY "SecurityProxy" +#define KEY_USESECURITYPROXY "UseProxy" +#define KEY_DIALOG "dialog" +#define KEY_HTTP "http" +#define KEY_HTTPS "https" + +#define PROPERTYNAME_CONNECTIONTYPE DECLARE_ASCII("ConnectionType" ) +#define PROPERTYNAME_LANGUAGE DECLARE_ASCII("Language" ) +#define PROPERTYNAME_PARENTWINDOW DECLARE_ASCII("ParentWindow" ) +#define PROPERTYNAME_PASSWORD DECLARE_ASCII("Password" ) +#define PROPERTYNAME_SECURITYPROXY DECLARE_ASCII("SecurityProxy" ) +#define PROPERTYNAME_SERVER DECLARE_ASCII("Server" ) +#define PROPERTYNAME_SERVERHISTORY DECLARE_ASCII("ServerHistory" ) +#define PROPERTYNAME_USERNAME DECLARE_ASCII("UserName" ) +#define PROPERTYNAME_USEPROXY DECLARE_ASCII("UseProxy" ) +#define PROPERTYNAME_DIALOG DECLARE_ASCII("Dialog" ) +#define PROPERTYNAME_HTTP DECLARE_ASCII("http" ) +#define PROPERTYNAME_HTTPS DECLARE_ASCII("https" ) + +#define PROPERTYHANDLE_CONNECTIONTYPE 1 +#define PROPERTYHANDLE_LANGUAGE 2 +#define PROPERTYHANDLE_PARENTWINDOW 3 +#define PROPERTYHANDLE_PASSWORD 4 +#define PROPERTYHANDLE_SERVER 5 +#define PROPERTYHANDLE_SERVERHISTORY 6 +#define PROPERTYHANDLE_USERNAME 7 +#define PROPERTYHANDLE_SECURITYPROXY 8 +#define PROPERTYHANDLE_USEPROXY 9 +#define PROPERTYHANDLE_DIALOG 10 +#define PROPERTYHANDLE_HTTP 11 +#define PROPERTYHANDLE_HTTPS 12 + +#define PROPERTYCOUNT 12 + +//_________________________________________________________________________________________________________________ +// exported definitions +//_________________________________________________________________________________________________________________ + +struct tIMPL_DialogData +{ + OUSTRING sUserName ; + OUSTRING sPassword ; + SEQUENCE< OUSTRING > seqServerList ; + sal_Int32 nActiveServer ; + OUSTRING sConnectionType ; + LOCALE aLanguage ; + sal_Int32 nPortHttp ; + sal_Int32 nPortHttps ; + ANY aParentWindow ; + OUSTRING sSecurityProxy ; + OUSTRING sUseProxy ; + OUSTRING sDialog ; + sal_Bool bProxyChanged ; + + // default ctor to initialize empty structure. + tIMPL_DialogData() + : sUserName ( OUSTRING() ) + , sPassword ( OUSTRING() ) + , seqServerList ( SEQUENCE< OUSTRING >() ) + , nActiveServer ( 1 ) + , sConnectionType ( OUSTRING() ) + , aLanguage ( OUSTRING(), OUSTRING(), OUSTRING() ) + , nPortHttp ( 0 ) + , nPortHttps ( 0 ) + , aParentWindow ( ) + , sSecurityProxy ( OUSTRING() ) + , sUseProxy ( OUSTRING() ) + , sDialog ( OUSTRING() ) + , bProxyChanged ( sal_False ) + { + } + + // copy ctor to initialize structure with values from another one. + tIMPL_DialogData( const tIMPL_DialogData& aCopyDataSet ) + : sUserName ( aCopyDataSet.sUserName ) + , sPassword ( aCopyDataSet.sPassword ) + , seqServerList ( aCopyDataSet.seqServerList ) + , nActiveServer ( aCopyDataSet.nActiveServer ) + , sConnectionType ( aCopyDataSet.sConnectionType ) + , aLanguage ( aCopyDataSet.aLanguage ) + , nPortHttp ( aCopyDataSet.nPortHttp ) + , nPortHttps ( aCopyDataSet.nPortHttps ) + , aParentWindow ( aCopyDataSet.aParentWindow ) + , sSecurityProxy ( aCopyDataSet.sSecurityProxy ) + , sUseProxy ( aCopyDataSet.sUseProxy ) + , sDialog ( aCopyDataSet.sDialog ) + , bProxyChanged ( aCopyDataSet.bProxyChanged ) + { + } + + // assignment operator to cop values from another struct to this one. + tIMPL_DialogData& operator=( const tIMPL_DialogData& aCopyDataSet ) + { + sUserName = aCopyDataSet.sUserName ; + sPassword = aCopyDataSet.sPassword ; + seqServerList = aCopyDataSet.seqServerList ; + nActiveServer = aCopyDataSet.nActiveServer ; + sConnectionType = aCopyDataSet.sConnectionType ; + aLanguage = aCopyDataSet.aLanguage ; + nPortHttp = aCopyDataSet.nPortHttp ; + nPortHttps = aCopyDataSet.nPortHttps ; + aParentWindow = aCopyDataSet.aParentWindow ; + sSecurityProxy = aCopyDataSet.sSecurityProxy ; + sUseProxy = aCopyDataSet.sUseProxy ; + sDialog = aCopyDataSet.sDialog ; + bProxyChanged = aCopyDataSet.bProxyChanged ; + return *this; + } +}; + +/*-************************************************************************************************************//** + @short implements an "private inline" dialog class used by follow class LoginDialog to show the dialog + @descr This is a VCL- modal dialog and not threadsafe! We use it as private definition in the context of login dialog only! + + @implements - + + @base ModalDialog +*//*-*************************************************************************************************************/ + +class cIMPL_Dialog : public ModalDialog +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + + public: + + /*-****************************************************************************************************//** + @short default ctor + @descr This ctor initialize the dialog, load ressources but not set values on edits or check boxes! + These is implemented by setValues() on the same class. + You must give us a language identifier to describe which ressource should be used! + + @seealso method setValues() + + @param "aLanguage" , identifier to describe ressource language + @param "pParent" , parent window handle for dialog! If is it NULL -> no parent exist ... + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + cIMPL_Dialog( ::com::sun::star::lang::Locale aLocale, Window* pParent ); + + /*-****************************************************************************************************//** + @short default dtor + @descr This dtor deinitialize the dialog and free all used ressources. + But you can't get the values of the dialog. Use getValues() to do this. + + @seealso method getValues() + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + ~cIMPL_Dialog(); + + /*-****************************************************************************************************//** + @short set new values on dialog to show + @descr Use this to initialize the dialg with new values for showing before execute. + + @seealso method getValues() + + @param "aDataSet"; struct of variables to set it on dialog controls + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + void setValues( const tIMPL_DialogData& aDataSet ); + + /*-****************************************************************************************************//** + @short get current values from dialog controls + @descr Use this if you will get all values of dialog after execute. + + @seealso method setValues() + + @param "aDataSet"; struct of variables filled by dialog + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + tIMPL_DialogData getValues(); + + /*-****************************************************************************************************/ + /* handler + */ + + DECL_LINK( ClickHdl, void* ); + + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + + private: + void setCustomSettings(); + + void showDialogExpanded(); + void showDialogCollapsed(); + + /*-****************************************************************************************************//** + @short get a host and port from a concated string form <host>:<port> + + @param "aProxyHostPort" ; a string with the following format <host>:<port> + @param "aHost" ; a host string + @param "aPort" ; a port string + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + void getProxyHostPort( const OUSTRING& aProxyHostPort, OUSTRING& aHost, OUSTRING& aPort ); + + /*-****************************************************************************************************//** + @short get a ressource for given id from right ressource file + @descr This dialog need his own ressource. We can't use the global ressource manager! + We must use our own. + You must give us the ressource language. If no right ressource could be found - + any existing one is used automaticly! + + @seealso method setValues() + + @param "nId" ; id to convert it in right ressource id + @param "aLanguage" ; type of ressource language + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + static ResId impl_getResId( sal_uInt16 nId , + ::com::sun::star::lang::Locale aLocale ); + + //------------------------------------------------------------------------------------------------------------- + // private member + //------------------------------------------------------------------------------------------------------------- + + private: + + FixedImage m_imageHeader ; + FixedText m_textLoginText ; + FixedText m_textUserName ; + Edit m_editUserName ; + FixedText m_textPassword ; + Edit m_editPassword ; + FixedLine m_fixedLineServer ; + FixedText m_textServer ; + ComboBox m_comboServer ; + FixedLine m_fixedLineProxySettings ; + RadioButton m_radioNoProxy ; + RadioButton m_radioBrowserProxy ; + RadioButton m_radioCustomProxy ; + FixedText m_textSecurityProxy ; + FixedText m_textSecurityProxyHost ; + Edit m_editSecurityProxyHost ; + FixedText m_textSecurityProxyPort ; + Edit m_editSecurityProxyPort ; + FixedLine m_fixedLineButtons ; + OKButton m_buttonOK ; + CancelButton m_buttonCancel ; + PushButton m_buttonAdditionalSettings ; + Size m_expandedDialogSize ; + Size m_collapsedDialogSize ; + Point m_expOKButtonPos ; + Point m_expCancelButtonPos ; + Point m_expAdditionalButtonPos ; + Point m_colOKButtonPos ; + Point m_colCancelButtonPos ; + Point m_colAdditionalButtonPos ; + OUSTRING m_colButtonAddText ; + OUSTRING m_expButtonAddText ; + tIMPL_DialogData m_aDataSet ; +}; + +/*-************************************************************************************************************//** + @short + + @descr - + + @implements XInterface + XTypeProvider + XServiceInfo + XDialog + + @base ThreadHelpBase + OWeakObject +*//*-*************************************************************************************************************/ + +class LoginDialog : public XTYPEPROVIDER , + public XSERVICEINFO , + public XDIALOG , + public XFLUSHABLE , + private ThreadHelpBase , // Order of baseclasses is neccessary for right initialization! + public OBROADCASTHELPER , + public OPROPERTYSETHELPER , + public OWEAKOBJECT +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + + public: + + //--------------------------------------------------------------------------------------------------------- + // constructor / destructor + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short - + @descr - + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + LoginDialog( const REFERENCE< XMULTISERVICEFACTORY >& sFactory ); + + /*-****************************************************************************************************//** + @short - + @descr - + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual ~LoginDialog(); + + //--------------------------------------------------------------------------------------------------------- + // XInterface, XTypeProvider, XServiceInfo + //--------------------------------------------------------------------------------------------------------- + + DECLARE_XINTERFACE + DECLARE_XTYPEPROVIDER + DECLARE_XSERVICEINFO + + //--------------------------------------------------------------------------------------------------------- + // XFlushable + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short write changed values to configuration + @descr Normaly the dialog returns with an OK or ERROR value. If OK occure - we flush data + auomaticly. But otherwise we do nothing. If user of this service wish to use property set + only without any UI(!) - he must call "flush()" explicitly to write data! + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL flush() throw( RUNTIMEEXCEPTION ); + virtual void SAL_CALL addFlushListener( const REFERENCE< XFLUSHLISTENER >& xListener ) throw( RUNTIMEEXCEPTION ); + virtual void SAL_CALL removeFlushListener( const REFERENCE< XFLUSHLISTENER >& xListener ) throw( RUNTIMEEXCEPTION ); + + //--------------------------------------------------------------------------------------------------------- + // XDialog + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short set new title of dialog + @descr - + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL setTitle( const OUSTRING& sTitle ) throw( RUNTIMEEXCEPTION ); + + /*-****************************************************************************************************//** + @short return the current title of this dialog + @descr - + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual OUSTRING SAL_CALL getTitle() throw( RUNTIMEEXCEPTION ); + + /*-****************************************************************************************************//** + @short show the dialog and return user reaction + @descr If user close dialog with OK we return 1 else + user has cancelled this dialog and we return 0. + You can use this return value directly as boolean. + + @seealso - + + @param - + @return 1; if closed with OK + @return 0; if cancelled + + @onerror We return 0(sal_False). + *//*-*****************************************************************************************************/ + + virtual sal_Int16 SAL_CALL execute() throw( RUNTIMEEXCEPTION ); + + /*-****************************************************************************************************//** + @short not implemented yet! + @descr - + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL endExecute() throw( RUNTIMEEXCEPTION ); + + //------------------------------------------------------------------------------------------------------------- + // protected methods + //------------------------------------------------------------------------------------------------------------- + + protected: + + //--------------------------------------------------------------------------- + // OPropertySetHelper + //--------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short try to convert a property value + @descr This method is calling from helperclass "OPropertySetHelper". + Don't use this directly! + You must try to convert the value of given propertyhandle and + return results of this operation. This will be use to ask vetoable + listener. If no listener have a veto, we will change value realy! + ( in method setFastPropertyValue_NoBroadcast(...) ) + + @seealso class OPropertySetHelper + @seealso method setFastPropertyValue_NoBroadcast() + @seealso method impl_tryToChangeProperty() + + @param "aConvertedValue" new converted value of property + @param "aOldValue" old value of property + @param "nHandle" handle of property + @param "aValue" new value of property + @return sal_True if value will be changed, sal_FALSE otherway + + @onerror IllegalArgumentException, if you call this with an invalid argument + *//*-*****************************************************************************************************/ + + virtual sal_Bool SAL_CALL convertFastPropertyValue( ANY& aConvertedValue , + ANY& aOldValue , + sal_Int32 nHandle , + const ANY& aValue ) throw( ILLEGALARGUMENTEXCEPTION ); + + /*-****************************************************************************************************//** + @short set value of a transient property + @descr This method is calling from helperclass "OPropertySetHelper". + Don't use this directly! + Handle and value are valid everyway! You must set the new value only. + After this, baseclass send messages to all listener automaticly. + + @seealso OPropertySetHelper + + @param "nHandle" handle of property to change + @param "aValue" new value of property + @return - + + @onerror An exception is thrown. + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle , + const ANY& aValue ) throw( EXCEPTION ); + + /*-****************************************************************************************************//** + @short get value of a transient property + @descr This method is calling from helperclass "OPropertySetHelper". + Don't use this directly! + + @seealso OPropertySetHelper + + @param "nHandle" handle of property to change + @param "aValue" current value of property + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL getFastPropertyValue( ANY& aValue , + sal_Int32 nHandle ) const; + + /*-****************************************************************************************************//** + @short return structure and information about transient properties + @descr This method is calling from helperclass "OPropertySetHelper". + Don't use this directly! + + @seealso OPropertySetHelper + + @param - + @return structure with property-informations + + @onerror - + *//*-*****************************************************************************************************/ + + virtual IPROPERTYARRAYHELPER& SAL_CALL getInfoHelper(); + + /*-****************************************************************************************************//** + @short return propertysetinfo + @descr You can call this method to get information about transient properties + of this object. + + @seealso OPropertySetHelper + @seealso XPropertySet + @seealso XMultiPropertySet + + @param - + @return reference to object with information [XPropertySetInfo] + + @onerror - + *//*-*****************************************************************************************************/ + + virtual REFERENCE< XPROPERTYSETINFO > SAL_CALL getPropertySetInfo() throw (::com::sun::star::uno::RuntimeException); + + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + + private: + + /*-****************************************************************************************************//** + @short return table of all supported properties + @descr We need this table to initialize our helper baseclass OPropertySetHelper + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + const SEQUENCE< PROPERTY > impl_getStaticPropertyDescriptor(); + + /*-****************************************************************************************************//** + @short helper method to check if a property will change his value + @descr Is neccessary for vetoable listener mechanism of OPropertySethelper. + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + sal_Bool impl_tryToChangeProperty( const OUSTRING& sProperty , + const ANY& aValue , + ANY& aOldValue , + ANY& aConvertedValue ) throw( ILLEGALARGUMENTEXCEPTION ); + + sal_Bool impl_tryToChangeProperty( const SEQUENCE< OUSTRING >& seqProperty , + const ANY& aValue , + ANY& aOldValue , + ANY& aConvertedValue ) throw( ILLEGALARGUMENTEXCEPTION ); + + sal_Bool impl_tryToChangeProperty( const sal_Int32& nProperty , + const ANY& aValue , + ANY& aOldValue , + ANY& aConvertedValue ) throw( ILLEGALARGUMENTEXCEPTION ); + + sal_Bool impl_tryToChangeProperty( const LOCALE& aProperty , + const ANY& aValue , + ANY& aOldValue , + ANY& aConvertedValue ) throw( ILLEGALARGUMENTEXCEPTION ); + + sal_Bool impl_tryToChangeProperty( const ANY& aProperty , + const ANY& aValue , + ANY& aOldValue , + ANY& aConvertedValue ) throw( ILLEGALARGUMENTEXCEPTION ); + + /*-****************************************************************************************************//** + @short search and open profile + @descr This method search and open the ini file. It initialize some member too. + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + void impl_openProfile(); + + /*-****************************************************************************************************//** + @short close profile and free some member + @descr This method close current opened ini file and deinitialize some member too. + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + void impl_closeProfile(); + + /*-****************************************************************************************************//** + @short write profile and free some member + @descr This method writes current settings and deinitialize some member too. + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + void impl_writeProfile(); + + /*-****************************************************************************************************//** + @short check current server history + @descr Our current server history implementation can handle 10 elements as maximum. + If more then 10 elements exist; old ones will be deleted. + + @seealso - + + @param "seqHistory"; current history + @return Sequence< OUString >; checked and repaired history + + @onerror - + *//*-*****************************************************************************************************/ + + void impl_addServerToHistory( SEQUENCE< OUSTRING >& seqHistory , + sal_Int32& nActiveServer , + const OUSTRING& sServer ); + + /*-****************************************************************************************************//** + @short helper methods to read/write properties from/to ini file + @descr Using of Config-Class isn't easy everytime :-( + Thats the reason for these helper. State of operation isn't realy important .. + but we assert impossible cases or occured errors! + + @seealso - + + @param - + @return - + + @onerror Assertions are shown. + *//*-*****************************************************************************************************/ + + void impl_writeUserName ( const OUSTRING& sUserName ); + void impl_writeActiveServer ( sal_Int32 nActiveServer ); + void impl_writeServerHistory ( const SEQUENCE< OUSTRING >& lHistory ); + void impl_writeConnectionType ( const OUSTRING& sConnectionType ); + void impl_writeLanguage ( const LOCALE& aLanguage ); + void impl_writePortHttp ( sal_Int32 nPort ); + void impl_writePortHttps ( sal_Int32 nPort ); + void impl_writeSecurityProxy ( const OUSTRING& sSecurityProxy ); + void impl_writeUseProxy ( const OUSTRING& sUseProxy ); + void impl_writeDialog ( const OUSTRING& sDialog ); + + OUSTRING impl_readUserName ( ); + sal_Int32 impl_readActiveServer ( ); + SEQUENCE< OUSTRING > impl_readServerHistory ( ); + OUSTRING impl_readConnectionType ( ); + LOCALE impl_readLanguage ( ); + sal_Int32 impl_readPortHttp ( ); + sal_Int32 impl_readPortHttps ( ); + OUSTRING impl_readSecurityProxy ( ); + OUSTRING impl_readUseProxy ( ); + OUSTRING impl_readDialog ( ); + + //------------------------------------------------------------------------------------------------------------- + // 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: + + sal_Bool impldbg_checkParameter_LoginDialog ( const REFERENCE< XMULTISERVICEFACTORY >& xFactory ); + sal_Bool impldbg_checkParameter_setTitle ( const OUSTRING& sTitle ); + + #endif // #ifdef ENABLE_ASSERTIONS + + //------------------------------------------------------------------------------------------------------------- + // variables + // (should be private everyway!) + //------------------------------------------------------------------------------------------------------------- + + private: + + REFERENCE< XMULTISERVICEFACTORY > m_xFactory ; /// reference to factory, which has created this instance + OUSTRING m_sININame ; /// full qualified path to profile UNC-notation + Config* m_pINIManager ; /// manager for full access to ini file + sal_Bool m_bInExecuteMode ; /// protection against setting of properties during showing of dialog + cIMPL_Dialog* m_pDialog ; /// VCL dialog + tIMPL_DialogData m_aPropertySet ; + +}; // class LoginDialog + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_LOGINDIALOG_LOGINDIALOG_HXX_ diff --git a/framework/inc/services/mediatypedetectionhelper.hxx b/framework/inc/services/mediatypedetectionhelper.hxx new file mode 100644 index 000000000000..0451f0f1e52c --- /dev/null +++ b/framework/inc/services/mediatypedetectionhelper.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_SERVICES_MEDIATYPEDETECTIONHELPER_HXX_ +#define __FRAMEWORK_SERVICES_MEDIATYPEDETECTIONHELPER_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <macros/generic.hxx> +#include <macros/debug.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> +#include <general.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/util/XStringMapping.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <cppuhelper/implbase2.hxx> +//_________________________________________________________________________________________________________________ +// namespaces +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ +// definitions +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short - + @descr - + + @implements XInterface + XTypeProvider + XServiceInfo + XStringMapping + @base OWeakObject + + @devstatus deprecated +*//*-*************************************************************************************************************/ + +class MediaTypeDetectionHelper : public ::cppu::WeakImplHelper2< ::com::sun::star::util::XStringMapping, css::lang::XServiceInfo> +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + + public: + + //--------------------------------------------------------------------------------------------------------- + // constructor / destructor + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short standard ctor + @descr These initialize a new instance of this class with all needed informations for work. + + @seealso - + + @param "xFactory", reference to factory which has created ouer owner(!). We can use these to create new uno-services. + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + MediaTypeDetectionHelper( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory ); + + /*-****************************************************************************************************//** + @short standard destructor + @descr This method destruct an instance of this class and clear some member. + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual ~MediaTypeDetectionHelper(); + + //--------------------------------------------------------------------------------------------------------- + // XInterface, XTypeProvider, XServiceInfo + //--------------------------------------------------------------------------------------------------------- + + DECLARE_XSERVICEINFO + + //--------------------------------------------------------------------------------------------------------- + // XStringMapping + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short - + @descr - + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual sal_Bool SAL_CALL mapStrings( css::uno::Sequence< ::rtl::OUString >& seqParameter ) throw( css::uno::RuntimeException ); + + //------------------------------------------------------------------------------------------------------------- + // variables + // should be private every time + //------------------------------------------------------------------------------------------------------------- + + private: + + css::uno::Reference< css::lang::XMultiServiceFactory > m_xFactory; /// reference to global servicemanager + +}; + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_SERVICES_MEDIATYPEDETECTIONHELPER_HXX_ diff --git a/framework/inc/services/modelwinservice.hxx b/framework/inc/services/modelwinservice.hxx new file mode 100755 index 000000000000..7e07fcb0cd37 --- /dev/null +++ b/framework/inc/services/modelwinservice.hxx @@ -0,0 +1,122 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: urltransformer.hxx,v $ + * $Revision: 1.8 $ + * + * 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_SERVICES_MODELWINSERVICE_HXX_ +#define __FRAMEWORK_SERVICES_MODELWINSERVICE_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <threadhelp/threadhelpbase.hxx> +#include <macros/generic.hxx> +#include <macros/debug.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> +#include <general.h> +#include <stdtypes.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ + +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/awt/XWindow.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/awt/XControlModel.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ + +#include <cppuhelper/weak.hxx> +#include <vcl/window.hxx> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +class IModelWin +{ + public: + virtual void registerModelForXWindow( const css::uno::Reference< css::awt::XWindow >& rWindow, const css::uno::Reference< css::awt::XControlModel >& rModel ) = 0; + virtual void deregisterModelForXWindow( const css::uno::Reference< css::awt::XWindow >& rWindow ) = 0; +}; + +class ModelWinService : public css::lang::XTypeProvider + , public css::lang::XServiceInfo + , public css::container::XNameAccess + , public IModelWin + , public ::cppu::OWeakObject +{ + public: + ModelWinService(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rServiceManager ); + virtual ~ModelWinService(); + + //--------------------------------------------------------------------------------------------------------- + // XInterface, XTypeProvider, XServiceInfo + //--------------------------------------------------------------------------------------------------------- + + FWK_DECLARE_XINTERFACE + FWK_DECLARE_XTYPEPROVIDER + DECLARE_XSERVICEINFO + + //--------------------------------------------------------------------------------------------------------- + // IModelWin + //--------------------------------------------------------------------------------------------------------- + virtual void registerModelForXWindow( const css::uno::Reference< css::awt::XWindow >& rWindow, const css::uno::Reference< css::awt::XControlModel >& rModel ); + virtual void deregisterModelForXWindow( const css::uno::Reference< css::awt::XWindow >& rWindow ); + + //--------------------------------------------------------------------------------------------------------- + // XNameAccess + //--------------------------------------------------------------------------------------------------------- + virtual css::uno::Any SAL_CALL getByName( const ::rtl::OUString& sName ) throw( css::container::NoSuchElementException , + css::lang::WrappedTargetException , + css::uno::RuntimeException ); + virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() throw( css::uno::RuntimeException ); + virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& sName ) throw( css::uno::RuntimeException ); + + //--------------------------------------------------------------------------------------------------------- + // XElementAccess + //--------------------------------------------------------------------------------------------------------- + virtual css::uno::Type SAL_CALL getElementType() throw( css::uno::RuntimeException ); + virtual sal_Bool SAL_CALL hasElements() throw( css::uno::RuntimeException ); + + private: + css::uno::Reference< css::lang::XMultiServiceFactory > m_xServiceManager; +}; + +} + +#endif // __FRAMEWORK_SERVICES_MODELWINSERVICE_HXX_ diff --git a/framework/inc/services/modulemanager.hxx b/framework/inc/services/modulemanager.hxx new file mode 100644 index 000000000000..f1f6de71567f --- /dev/null +++ b/framework/inc/services/modulemanager.hxx @@ -0,0 +1,201 @@ +/************************************************************************* + * + * 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_SERVICES_MODULEMANAGER_HXX_ +#define __FRAMEWORK_SERVICES_MODULEMANAGER_HXX_ + +//_______________________________________________ +// own includes + +#include <threadhelp/threadhelpbase.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> +#include <general.h> +#include <general.h> +#include <stdtypes.h> + +//_______________________________________________ +// interface includes +#include <com/sun/star/uno/XInterface.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/container/XNameReplace.hpp> +#include <com/sun/star/container/XContainerQuery.hpp> + +//_______________________________________________ +// other includes +#include <cppuhelper/weak.hxx> + +//_______________________________________________ +// definition + +namespace framework +{ + +//_______________________________________________ +/** + implements the service com.sun.star.frame.ModuleManager + */ +class ModuleManager : public css::lang::XTypeProvider + , public css::lang::XServiceInfo + , public css::frame::XModuleManager + , public css::container::XNameReplace // => XNameAccess, XElementAccess + , public css::container::XContainerQuery + // attention! Must be the first base class to guarentee right initialize lock ... + , private ThreadHelpBase + , public ::cppu::OWeakObject +{ + //___________________________________________ + // member + + private: + + //--------------------------------------- + /** the global uno service manager. + Must be used to create own needed services. + */ + css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR; + + //--------------------------------------- + /** points to the underlying configuration. + This ModuleManager does not cache - it calls directly the + configuration API! + */ + css::uno::Reference< css::container::XNameAccess > m_xCFG; + + //___________________________________________ + // interface + + public: + + ModuleManager(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR); + virtual ~ModuleManager( ); + + // XInterface, XTypeProvider, XServiceInfo + FWK_DECLARE_XINTERFACE + FWK_DECLARE_XTYPEPROVIDER + DECLARE_XSERVICEINFO + + // XModuleManager + virtual ::rtl::OUString SAL_CALL identify(const css::uno::Reference< css::uno::XInterface >& xModule) + throw(css::lang::IllegalArgumentException, + css::frame::UnknownModuleException, + css::uno::RuntimeException ); + + // XNameReplace + virtual void SAL_CALL replaceByName(const ::rtl::OUString& sName , + const css::uno::Any& aValue) + throw (css::lang::IllegalArgumentException , + css::container::NoSuchElementException, + css::lang::WrappedTargetException , + css::uno::RuntimeException ); + + // XNameAccess + virtual css::uno::Any SAL_CALL getByName(const ::rtl::OUString& sName) + throw(css::container::NoSuchElementException, + css::lang::WrappedTargetException , + css::uno::RuntimeException ); + + virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() + throw(css::uno::RuntimeException); + + virtual sal_Bool SAL_CALL hasByName(const ::rtl::OUString& sName) + throw(css::uno::RuntimeException); + + // XElementAccess + virtual css::uno::Type SAL_CALL getElementType() + throw(css::uno::RuntimeException); + + virtual sal_Bool SAL_CALL hasElements() + throw(css::uno::RuntimeException); + + // XContainerQuery + virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createSubSetEnumerationByQuery(const ::rtl::OUString& sQuery) + throw(css::uno::RuntimeException); + + virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createSubSetEnumerationByProperties(const css::uno::Sequence< css::beans::NamedValue >& lProperties) + throw(css::uno::RuntimeException); + //___________________________________________ + // helper + + private: + + //--------------------------------------- + /** @short open the underlying configuration. + + @descr This method must be called everytimes + a (reaonly!) configuration is needed. Because + method works together with the member + m_xCFG, open it on demand and cache it + afterwards. + + Note: A writable configuration access + must be created explicitly. Otherwise + we cant make sure that broken write requests + wont affect our read access ! + + @return [com.sun.star.container.XNameAccess] + the configuration object + + @throw [com.sun.star.uno.RuntimeException] + if config could not be opened successfully! + + @threadsafe + */ + css::uno::Reference< css::container::XNameAccess > implts_getConfig() + throw(css::uno::RuntimeException); + + //--------------------------------------- + /** @short makes the real identification of the module. + + @descr It checks for the optional but preferred interface + XModule first. If this module does not exists at the + given component it tries to use XServiceInfo instead. + + Note: This method try to locate a suitable module name. + Nothing else. Selecting the right component and throwing suitable + exceptions must be done outside. + + @see identify() + + @param xComponent + the module for identification. + + @return The identifier of the given module. + Can be empty if given component is not a real module ! + + @threadsafe + */ + ::rtl::OUString implts_identify(const css::uno::Reference< css::uno::XInterface >& xComponent); +}; + +} // namespace framework + +#endif // __FRAMEWORK_SERVICES_MODULEMANAGER_HXX_ diff --git a/framework/inc/services/pathsettings.hxx b/framework/inc/services/pathsettings.hxx new file mode 100644 index 000000000000..52c81c4fedeb --- /dev/null +++ b/framework/inc/services/pathsettings.hxx @@ -0,0 +1,295 @@ +/************************************************************************* + * + * 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_SERVICES_PATHSETTINGS_HXX_ +#define __FRAMEWORK_SERVICES_PATHSETTINGS_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <threadhelp/threadhelpbase.hxx> +#include <macros/generic.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> +#include <stdtypes.h> +#include <properties.h> +#include <stdtypes.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/util/XStringSubstitution.hpp> +#include <com/sun/star/util/XChangesListener.hpp> +#include <com/sun/star/container/XNameAccess.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <cppuhelper/propshlp.hxx> +#include <cppuhelper/interfacecontainer.hxx> +#include <cppuhelper/weak.hxx> +#include <unotools/configitem.hxx> +#include <comphelper/sequenceasvector.hxx> + +/* enable it if you whish to migrate old user settings (using the old cfg schema) on demand .... + disable it in case only the new schema must be used. + */ +#define MIGRATE_OLD_USER_PATHES + +namespace framework +{ + +class PathSettings : public css::lang::XTypeProvider , + public css::lang::XServiceInfo , + public css::util::XChangesListener , // => XEventListener + // base classes + // Order is neccessary for right initialization! + private ThreadHelpBase , + public ::cppu::OBroadcastHelper , + public ::cppu::OPropertySetHelper , // => XPropertySet / XFastPropertySet / XMultiPropertySet + public ::cppu::OWeakObject // => XWeak, XInterface +{ + struct PathInfo + { + public: + + PathInfo() + : sPathName () + , lInternalPaths() + , lUserPaths () + , sWritePath () + , bIsSinglePath (sal_False) + , bIsReadonly (sal_False) + {} + + PathInfo(const PathInfo& rCopy) + { + takeOver(rCopy); + } + + void takeOver(const PathInfo& rCopy) + { + sPathName = rCopy.sPathName; + lInternalPaths = rCopy.lInternalPaths; + lUserPaths = rCopy.lUserPaths; + sWritePath = rCopy.sWritePath; + bIsSinglePath = rCopy.bIsSinglePath; + bIsReadonly = rCopy.bIsReadonly; + } + + /// an internal name describing this path + ::rtl::OUString sPathName; + + /// contains all paths, which are used internaly - but are not visible for the user. + OUStringList lInternalPaths; + + /// contains all paths configured by the user + OUStringList lUserPaths; + + /// this special path is used to generate feature depending content there + ::rtl::OUString sWritePath; + + /// indicates real single pathes, which uses WritePath property only + sal_Bool bIsSinglePath; + + /// simple handling of finalized/mandatory states ... => we know one state READONLY only .-) + sal_Bool bIsReadonly; + }; + + typedef BaseHash< PathSettings::PathInfo > PathHash; + + enum EChangeOp + { + E_UNDEFINED, + E_ADDED, + E_CHANGED, + E_REMOVED + }; + + // ______________________________________ + // member + + private: + + /** reference to factory, which has create this instance. */ + css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR; + + /** list of all path variables and her corresponding values. */ + PathSettings::PathHash m_lPaths; + + /** describes all properties available on our interface. + Will be generated on demand based on our path list m_lPaths. */ + css::uno::Sequence< css::beans::Property > m_lPropDesc; + + /** helper needed to (re-)substitute all internal save path values. */ + css::uno::Reference< css::util::XStringSubstitution > m_xSubstitution; + + /** provides access to the old configuration schema (which will be migrated on demand). */ + css::uno::Reference< css::container::XNameAccess > m_xCfgOld; + + /** provides access to the new configuration schema. */ + css::uno::Reference< css::container::XNameAccess > m_xCfgNew; + + ::cppu::OPropertyArrayHelper* m_pPropHelp; + + ::sal_Bool m_bIgnoreEvents; + + // ___________________________________________ + // interface + + public: + + /** initialize a new instance of this class. + Attention: It's neccessary for right function of this class, that the order of base + classes is the right one. Because we transfer information from one base to another + during this ctor runs! */ + PathSettings(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR); + + /** free all used ressources ... if it was not already done. */ + virtual ~PathSettings(); + + /** declaration of XInterface, XTypeProvider, XServiceInfo */ + FWK_DECLARE_XINTERFACE + FWK_DECLARE_XTYPEPROVIDER + DECLARE_XSERVICEINFO + + // css::util::XChangesListener + virtual void SAL_CALL changesOccurred(const css::util::ChangesEvent& aEvent) throw (css::uno::RuntimeException); + + // css::lang::XEventListener + virtual void SAL_CALL disposing(const css::lang::EventObject& aSource) + throw(css::uno::RuntimeException); + + using ::cppu::OPropertySetHelper::disposing; + + // ___________________________________________ + // helper + + private: + + /** read all configured paths and create all needed internal structures. */ + void impl_readAll(); + + /** read a path info using the old cfg schema. + This is needed for "migration on demand" reasons only. + Can be removed for next major release .-) */ + OUStringList impl_readOldFormat(const ::rtl::OUString& sPath); + + /** read a path info using the new cfg schema. */ + PathSettings::PathInfo impl_readNewFormat(const ::rtl::OUString& sPath); + + /** filter "real user defined paths" from the old configuration schema + and set it as UserPaths on the new schema. + Can be removed with new major release ... */ + #ifdef MIGRATE_OLD_USER_PATHES + void impl_mergeOldUserPaths( PathSettings::PathInfo& rPath, + const OUStringList& lOld ); + #endif + + /** reload one path directly from the new configuration schema (because + it was updated by any external code) */ + PathSettings::EChangeOp impl_updatePath(const ::rtl::OUString& sPath , + sal_Bool bNotifyListener); + + /** replace all might existing placeholder variables inside the given path ... + or check if the given path value uses paths, which can be replaced with predefined + placeholder variables ... + */ + void impl_subst( OUStringList& lVals , + const css::uno::Reference< css::util::XStringSubstitution >& xSubst , + sal_Bool bReSubst); + + void impl_subst(PathSettings::PathInfo& aPath , + sal_Bool bReSubst); + + + /** converts our new string list schema to the old ";" seperated schema ... */ + ::rtl::OUString impl_convertPath2OldStyle(const PathSettings::PathInfo& rPath ) const; + OUStringList impl_convertOldStyle2Path(const ::rtl::OUString& sOldStylePath) const; + + /** remove still known paths from the given lList argument. + So real user defined paths can be extracted from the list of + fix internal paths ! + */ + void impl_purgeKnownPaths(const PathSettings::PathInfo& rPath, + OUStringList& lList); + + /** rebuild the member m_lPropDesc using the path list m_lPaths. */ + void impl_rebuildPropertyDescriptor(); + + /** provides direct access to the list of path values + using it's internal property id. + */ + css::uno::Any impl_getPathValue( sal_Int32 nID ) const; + void impl_setPathValue( sal_Int32 nID , + const css::uno::Any& aVal); + + /** check the given handle and return the corresponding PathInfo reference. + These reference can be used then directly to manipulate these path. */ + PathSettings::PathInfo* impl_getPathAccess (sal_Int32 nHandle); + const PathSettings::PathInfo* impl_getPathAccessConst(sal_Int32 nHandle) const; + + /** it checks, if the given path value seams to be a valid URL or system path. */ + sal_Bool impl_isValidPath(const ::rtl::OUString& sPath) const; + sal_Bool impl_isValidPath(const OUStringList& lPath) const; + + void impl_storePath(const PathSettings::PathInfo& aPath); + + css::uno::Sequence< sal_Int32 > impl_mapPathName2IDList(const ::rtl::OUString& sPath); + + void impl_notifyPropListener( PathSettings::EChangeOp eOp , + const ::rtl::OUString& sPath , + const PathSettings::PathInfo* pPathOld, + const PathSettings::PathInfo* pPathNew); + + + // OPropertySetHelper + virtual sal_Bool SAL_CALL convertFastPropertyValue ( css::uno::Any& aConvertedValue , + css::uno::Any& aOldValue , + sal_Int32 nHandle , + const css::uno::Any& aValue ) throw(css::lang::IllegalArgumentException); + virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle , + const css::uno::Any& aValue ) throw(css::uno::Exception); + using cppu::OPropertySetHelper::getFastPropertyValue; + virtual void SAL_CALL getFastPropertyValue ( css::uno::Any& aValue , + sal_Int32 nHandle ) const; + virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper ( ); + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo ( ) throw(::com::sun::star::uno::RuntimeException); + + /** factory methods to guarantee right (but on demand) initialized members ... */ + css::uno::Reference< css::util::XStringSubstitution > fa_getSubstitution(); + css::uno::Reference< css::container::XNameAccess > fa_getCfgOld(); + css::uno::Reference< css::container::XNameAccess > fa_getCfgNew(); +}; + +} // namespace framework + +#endif // __FRAMEWORK_SERVICES_PATHSETTINGS_HXX_ diff --git a/framework/inc/services/pluginframe.hxx b/framework/inc/services/pluginframe.hxx new file mode 100644 index 000000000000..13f374f353c7 --- /dev/null +++ b/framework/inc/services/pluginframe.hxx @@ -0,0 +1,375 @@ +/************************************************************************* + * + * 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_SERVICES_PLUGINFRAME_HXX_ +#define __FRAMEWORK_SERVICES_PLUGINFRAME_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <services/frame.hxx> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/mozilla/XPluginInstance.hpp> +#include <com/sun/star/mozilla/XPluginInstancePeer.hpp> +#include <com/sun/star/mozilla/XPluginWindowPeer.hpp> +#include <com/sun/star/io/XInputStream.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/awt/XWindow.hpp> +#include <com/sun/star/frame/XDispatchResultListener.hpp> +#include <com/sun/star/frame/FeatureStateEvent.hpp> +#include <com/sun/star/lang/EventObject.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ + +#ifndef _VCL_ATOM_HXX +#include <vcl/threadex.hxx> +#endif +#include <unotools/cmdoptions.hxx> + + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ +// exported const +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// exported definitions +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short implements an special frame - a plugin frame + @descr - + + @implements XInitialization + XPluginInstance + XDispatchResultListener + @base Frame +*//*-*************************************************************************************************************/ + +class PlugInFrame : public css::lang::XInitialization , + public css::mozilla::XPluginInstance , + public css::frame::XDispatchResultListener , // => XEVENTLISTENER + public Frame // Order of baseclasses is neccessary for right initialization! +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + + public: + + //--------------------------------------------------------------------------------------------------------- + // constructor / destructor + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short standard constructor to create instance + @descr This constructor initialize a new instance of this class, + and will be set valid values on his member and baseclasses. + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + PlugInFrame( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory ); + + /*-****************************************************************************************************//** + @short standard destructor + @descr This method destruct an instance of this class and clear some member. + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual ~PlugInFrame(); + + //--------------------------------------------------------------------------------------------------------- + // XInterface, XTypeProvider, XServiceInfo + //--------------------------------------------------------------------------------------------------------- + + DECLARE_XINTERFACE + DECLARE_XTYPEPROVIDER + DECLARE_XSERVICEINFO + + //--------------------------------------------------------------------------------------------------------- + // XInitialization + //--------------------------------------------------------------------------------------------------------- + + void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& seqArguments ) throw( css::uno::Exception , + css::uno::RuntimeException ); + + //--------------------------------------------------------------------------------------------------------- + // XPluginInstance + //--------------------------------------------------------------------------------------------------------- + + void SAL_CALL start () throw( css::uno::RuntimeException ); + void SAL_CALL implcb_start () throw( css::uno::RuntimeException ); + void SAL_CALL stop () throw( css::uno::RuntimeException ); + void SAL_CALL implcb_stop () throw( css::uno::RuntimeException ); + void SAL_CALL destroy () throw( css::uno::RuntimeException ); + void SAL_CALL implcb_destroy() throw( css::uno::RuntimeException ); + void SAL_CALL createWindow ( const css::uno::Any& aPlatformWindowHandle , + sal_Bool bEmbedded ) throw( css::uno::RuntimeException ); + void SAL_CALL implcb_createWindow ( const css::uno::Any& aPlatformWindowHandle , + sal_Bool bEmbedded ) throw( css::uno::RuntimeException ); + void SAL_CALL newStream ( const ::rtl::OUString& sMIMEDescription, + const ::rtl::OUString& sURL , + const ::rtl::OUString& sFilter , + const css::uno::Reference< css::io::XInputStream >& xStream , + const css::uno::Any& aSessionId ) throw( css::uno::RuntimeException ); + void SAL_CALL implcb_newStream + ( const ::rtl::OUString& sMIMEDescription, + const ::rtl::OUString& sURL , + const ::rtl::OUString& sFilter , + const css::uno::Reference< css::io::XInputStream >& xStream , + const css::uno::Any& aSessionId ) throw( css::uno::RuntimeException ); + void SAL_CALL newURL ( const ::rtl::OUString& sMIMEDescription, + const ::rtl::OUString& sURL , + const ::rtl::OUString& sFilter , + const css::uno::Any& aSessionId ) throw( css::uno::RuntimeException ); + void SAL_CALL implcb_newURL ( const ::rtl::OUString& sMIMEDescription, + const ::rtl::OUString& sURL , + const ::rtl::OUString& sFilter , + const css::uno::Any& aSessionId ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL getHttpServerURL( ::rtl::OUString& sHost , + sal_uInt16& nPort , + ::rtl::OUString& sPrefix ) throw( css::uno::RuntimeException ); + + //--------------------------------------------------------------------------------------------------------- + // XDispatchProvider + //--------------------------------------------------------------------------------------------------------- + + virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL queryDispatch( const css::util::URL& aURL , + const ::rtl::OUString& sTargetFrameName, + sal_Int32 nSearchFlags ) throw( css::uno::RuntimeException ); + virtual css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL queryDispatches( const css::uno::Sequence< css::frame::DispatchDescriptor >& seqDescripts ) throw( css::uno::RuntimeException ); + + //--------------------------------------------------------------------------------------------------------- + // XDispatchResultListener + //--------------------------------------------------------------------------------------------------------- + + virtual void SAL_CALL dispatchFinished ( const css::frame::DispatchResultEvent& aEvent ) throw( css::uno::RuntimeException ); + + //--------------------------------------------------------------------------------------------------------- + // XEventListener + //--------------------------------------------------------------------------------------------------------- + + void SAL_CALL disposing( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException ); + + //------------------------------------------------------------------------------------------------------------- + // protected methods + //------------------------------------------------------------------------------------------------------------- + + protected: + + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + + private: + + void impl_tryToLoadDocument(); + sal_Bool impl_registerRemoteFactories( const css::uno::Reference< css::lang::XMultiServiceFactory >& xRemoteServiceManager ); + + //------------------------------------------------------------------------------------------------------------- + // 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: + + static sal_Bool impldbg_checkParameter_initialize ( const css::uno::Sequence< css::uno::Any >& seqArguments ); + static sal_Bool impldbg_checkParameter_createWindow ( const css::uno::Any& aPlatformWindowHandle , + sal_Bool bEmbedded ); + static sal_Bool impldbg_checkParameter_newStream ( const ::rtl::OUString& sMIMEDescription , + const ::rtl::OUString& sURL , + const ::rtl::OUString& sFilter , + const css::uno::Reference< css::io::XInputStream >& xStream ); + static sal_Bool impldbg_checkParameter_newURL ( const ::rtl::OUString& sMIMEDescription , + const ::rtl::OUString& sURL , + const ::rtl::OUString& sFilter ); + static sal_Bool impldbg_checkParameter_getHttpServerURL ( ::rtl::OUString& sHost , + sal_uInt16& nPort , + ::rtl::OUString& sPrefix ); + static sal_Bool impldbg_checkParameter_queryDispatch ( const css::util::URL& aURL , + const ::rtl::OUString& sTargetFrameName , + sal_Int32 nSearchFlags ); + static sal_Bool impldbg_checkParameter_queryDispatches ( const css::uno::Sequence< css::frame::DispatchDescriptor >& seqDescripts ); + static sal_Bool impldbg_checkParameter_statusChanged ( const css::frame::FeatureStateEvent& aEvent ); + static sal_Bool impldbg_checkParameter_disposing ( const css::lang::EventObject& aEvent ); + + #endif // #ifdef ENABLE_ASSERTIONS + + //------------------------------------------------------------------------------------------------------------- + // variables + // (should be private everyway!) + //------------------------------------------------------------------------------------------------------------- + + private: + + css::uno::Reference< css::mozilla::XPluginInstancePeer > m_xPlugInInstancePeer ; /// Reference to UNO interface of PlugIn dll for communication with browser + css::uno::Reference< css::mozilla::XPluginWindowPeer > m_xPlugInWindowPeer ; /// Reference to set child window at plugin window + css::uno::Sequence< css::beans::PropertyValue > m_seqProperties ; /// Sequence of properties as arguments for load document + css::util::URL m_aURL ; /// URL for document to load + sal_Bool m_bILoad ; /// PlugInFrame has a valid loader which load the document and wait for finished/cancelled + sal_Bool m_bIHaveDocument ; /// We have a document loaded successful. + css::uno::Reference< css::frame::XDispatchProvider > m_xPlugInDispatcher ; /// Dispatcher to forward dispatches to browser + static sal_Bool m_bRemoteFactoriesExist ; /// indicates, if remote factories was already registered (neccessary one times only!) + SvtCommandOptions m_aCommandOptions ; /// ref counted class to support disabling commands defined by configuration file + +}; // class PlugInFrame + +/*-************************************************************************************************************//** + @short used to forward all asynchronous calls which use VCL internal to the main thread + @descr We need this asynchronous mechanism to prevent us against dead locks. Sometimes our main thread + can call us for event handling like FOCUS, ACTIVATE and something else. But at the same time we will call + the main thread to CREATE A WINDOW, SET IT VISIBLE ... Then we have a problem. We must send us himself a event + to run our code synchronized with our main thread! + + @implements + @base - +*//*-*************************************************************************************************************/ + +enum eIMPL_PluginCommand +{ + START , + STOP , + CREATEWINDOW , + DESTROY , + NEWSTREAM , + NEWURL +}; + +class cIMPL_MainThreadExecutorRequest +{ + public: + cIMPL_MainThreadExecutorRequest( eIMPL_PluginCommand eCommand , + PlugInFrame* pPluginInstance ); + + cIMPL_MainThreadExecutorRequest( eIMPL_PluginCommand eCommand , + PlugInFrame* pPluginInstance , + const css::uno::Any& aPlatformWindowHandle , + sal_Bool bEmbedded ); + + cIMPL_MainThreadExecutorRequest( eIMPL_PluginCommand eCommand , + PlugInFrame* pPluginInstance , + const ::rtl::OUString& sMIMEDescription , + const ::rtl::OUString& sURL , + const ::rtl::OUString& sFilter , + const css::uno::Reference< css::io::XInputStream >& xStream , + const css::uno::Any& aSessionId ); + + /*-****************************************************************************************************//** + @short - + @descr - + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual long doIt(); + + //------------------------------------------------------------------------------------------------------------- + // private variables + //------------------------------------------------------------------------------------------------------------- + private: + + eIMPL_PluginCommand m_eCommand ; /// switch to specify forward function + PlugInFrame* m_pPluginInstance ; /// instance wich has started this swicth mechanism and wish to called back from us + css::uno::Reference< css::uno::XInterface > m_xPluginInstance ; /// reference to our plugin frame to prevent that plugin frame dies before we call back + css::uno::Any m_aPlatformWindowHandle ; /// parameter for XPluginInstance->createWindow() + sal_Bool m_bEmbedded ; /// parameter for XPluginInstance->createWindow() + ::rtl::OUString m_sMIMEDescription ; /// parameter for XPluginInstance->newStream()/newURL() + ::rtl::OUString m_sURL ; /// parameter for XPluginInstance->newStream()/newURL() + ::rtl::OUString m_sFilter ; /// parameter for XPluginInstance->newStream()/newURL() + css::uno::Reference< css::io::XInputStream > m_xStream ; /// parameter for XPluginInstance->newStream()/newURL() + css::uno::Any m_aSessionId ; /// parameter for XPluginInstance->newStream()/newURL() +}; + +class cIMPL_MainThreadExecutor +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + public: + static void execute( cIMPL_MainThreadExecutorRequest* pRequest ); + + /*-****************************************************************************************************//** + @short - + @descr - + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + DECL_STATIC_LINK( cIMPL_MainThreadExecutor, worker, cIMPL_MainThreadExecutorRequest* ); +}; + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_SERVICES_PLUGINFRAME_HXX_ diff --git a/framework/inc/services/sessionlistener.hxx b/framework/inc/services/sessionlistener.hxx new file mode 100644 index 000000000000..8795d578ea15 --- /dev/null +++ b/framework/inc/services/sessionlistener.hxx @@ -0,0 +1,188 @@ +/************************************************************************* + * + * 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_SERVICES_SESSIONLISTENER_HXX_ +#define __FRAMEWORK_SERVICES_SESSIONLISTENER_HXX_ + +//_______________________________________________ +// my own includes + +#include <classes/filtercache.hxx> +#include <threadhelp/threadhelpbase.hxx> +#include <macros/generic.hxx> +#include <macros/debug.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> +#include <general.h> + +//_______________________________________________ +// interface includes +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/lang/XInitialization.hpp> + + +#include <com/sun/star/frame/XSessionManagerListener2.hpp> +#include <com/sun/star/frame/XSessionManagerClient.hpp> +#include <com/sun/star/frame/XStatusListener.hpp> +#include <com/sun/star/frame/FeatureStateEvent.hpp> +#include <com/sun/star/lang/EventObject.hpp> +#include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/uno/Any.hxx> + +//_______________________________________________ +// other includes +#include <cppuhelper/weak.hxx> +#include <cppuhelper/interfacecontainer.h> + +//_______________________________________________ +// namespace + +namespace framework{ + +//_______________________________________________ +// exported const + +//_______________________________________________ +// exported definitions + +/// @HTML +/** @short implements flat/deep detection of file/stream formats and provides + further read/write access to the global office type configuration. + + @descr Using of this class makes it possible to get information about the + format type of a given URL or stream. The returned internal type name + can be used to get more informations about this format. Further this + class provides full access to the configuration data and following + implementations will support some special query modes. + + @author as96863 + + @docdate 10.03.2003 by as96863 + + @todo <ul> + <li>implementation of query mode</li> + <li>simple restore mechanism of last consistent cache state, + if flush failed</li> + </ul> + */ +/// @NOHTML + +class SessionListener : // interfaces + public css::lang::XTypeProvider, + public css::lang::XInitialization, + public css::frame::XSessionManagerListener2, + public css::frame::XStatusListener, + public css::lang::XServiceInfo, + // baseclasses (order important for initialization!) + // Struct for right initalization of mutex member! Must be the first one of baseclasses! + private ThreadHelpBase, + public ::cppu::OWeakObject +{ + //------------------------------------------- + // member + + private: + + /** reference to the uno service manager, which created this service. + It can be used to create own needed helper services. */ + css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR; + + css::uno::Reference< css::frame::XSessionManagerClient > m_rSessionManager; + + // restore handling + sal_Bool m_bRestored; + + sal_Bool m_bSessionStoreRequested; + + sal_Bool m_bAllowUserInteractionOnQuit; + sal_Bool m_bTerminated; + + + // in case of synchronous call the caller should do saveDone() call himself! + void StoreSession( sal_Bool bAsync ); + + // let session quietly close the documents, remove lock files, store configuration and etc. + void QuitSessionQuietly(); + + public: + + //--------------------------------------- + // XInterface, XTypeProvider, XServiceInfo + + FWK_DECLARE_XINTERFACE + FWK_DECLARE_XTYPEPROVIDER + DECLARE_XSERVICEINFO + + #ifdef ENABLE_AUTODOC_FIX + ; + #endif + + //--------------------------------------- + + /** @short initialize new instance of this class. + + @param xSMGR + reference to the global uno service manager, which created this new + factory instance. It must be used during runtime to create own + needed services. + */ + + SessionListener( const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR ); + + virtual ~SessionListener(); + + virtual void SAL_CALL disposing(const com::sun::star::lang::EventObject&) throw (css::uno::RuntimeException); + + + // XInitialization + virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any >& args) throw (css::uno::RuntimeException); + + // XSessionManagerListener + virtual void SAL_CALL doSave( sal_Bool bShutdown, sal_Bool bCancelable ) + throw (css::uno::RuntimeException); + virtual void SAL_CALL approveInteraction( sal_Bool bInteractionGranted ) + throw (css::uno::RuntimeException); + virtual void SAL_CALL shutdownCanceled() + throw (css::uno::RuntimeException); + virtual sal_Bool SAL_CALL doRestore() + throw (css::uno::RuntimeException); + + // XSessionManagerListener2 + virtual void SAL_CALL doQuit() + throw (::com::sun::star::uno::RuntimeException); + + // XStatusListener + virtual void SAL_CALL statusChanged(const com::sun::star::frame::FeatureStateEvent& event) + throw (css::uno::RuntimeException); + + void doSaveImpl( sal_Bool bShutdown, sal_Bool bCancelable ) throw (css::uno::RuntimeException); +}; + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_SERVICES_TYPEDETECTION_HXX_ diff --git a/framework/inc/services/substitutepathvars.hxx b/framework/inc/services/substitutepathvars.hxx new file mode 100644 index 000000000000..8825386d1b57 --- /dev/null +++ b/framework/inc/services/substitutepathvars.hxx @@ -0,0 +1,307 @@ +/************************************************************************* + * + * 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_SERVICES_SUBSTPATHVARS_HXX_ +#define __FRAMEWORK_SERVICES_SUBSTPATHVARS_HXX_ + +/** Attention: stl headers must(!) be included at first. Otherwhise it can make trouble + with solaris headers ... +*/ +#include <vector> +#include <list> +#include <hash_map> + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ +#include <threadhelp/threadhelpbase.hxx> +#include <macros/generic.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> +#include <stdtypes.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/container/NoSuchElementException.hpp> +#include <com/sun/star/util/XStringSubstitution.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <cppuhelper/implbase2.hxx> +#include <rtl/ustring.hxx> +#include <unotools/configitem.hxx> +#include <tools/link.hxx> +#include <i18npool/lang.h> + +namespace framework +{ + +// Must be zero value based +enum EnvironmentType +{ + ET_HOST = 0 , + ET_YPDOMAIN , + ET_DNSDOMAIN , + ET_NTDOMAIN , + ET_OS , + ET_UNKNOWN , + ET_COUNT +}; + +// Must be zero value based +enum OperatingSystem +{ + OS_WINDOWS = 0, + OS_UNIX , + OS_SOLARIS , + OS_LINUX , + OS_UNKNOWN , + OS_COUNT +}; + +struct SubstituteRule +{ + SubstituteRule() {} + SubstituteRule( const rtl::OUString& aVarName, + const rtl::OUString& aValue, + const com::sun::star::uno::Any& aVal, + EnvironmentType aType ) : + aSubstVariable( aVarName ), aSubstValue( aValue ), aEnvValue( aVal ), aEnvType( aType ) {} + + rtl::OUString aSubstVariable; + rtl::OUString aSubstValue; + com::sun::star::uno::Any aEnvValue; + EnvironmentType aEnvType; +}; + +struct SubstitutePathNotify +{ + SubstitutePathNotify() {}; + + const com::sun::star::uno::Sequence<rtl::OUString> aPropertyNames; +}; + +class SubstituteVariables : public ::std::hash_map< ::rtl::OUString, + SubstituteRule, + OUStringHashCode, + ::std::equal_to< ::rtl::OUString > > +{ + public: + inline void free() + { + SubstituteVariables().swap( *this ); + } +}; + +typedef std::vector< SubstituteRule > SubstituteRuleVector; +class SubstitutePathVariables_Impl : public utl::ConfigItem +{ + public: + SubstitutePathVariables_Impl( const Link& aNotifyLink ); + virtual ~SubstitutePathVariables_Impl(); + + static OperatingSystem GetOperatingSystemFromString( const rtl::OUString& ); + static EnvironmentType GetEnvTypeFromString( const rtl::OUString& ); + + void GetSharePointsRules( SubstituteVariables& aSubstVarMap ); + + /** is called from the ConfigManager before application ends or from the + PropertyChangeListener if the sub tree broadcasts changes. */ + virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames ); + virtual void Commit(); + + private: + // Wrapper methods for low-level functions + OperatingSystem GetOperatingSystem(); + const rtl::OUString& GetYPDomainName(); + const rtl::OUString& GetDNSDomainName(); + const rtl::OUString& GetNTDomainName(); + const rtl::OUString& GetHostName(); + + bool FilterRuleSet( const SubstituteRuleVector& aRuleSet, SubstituteRule& aActiveRule ); + + void ReadSharePointsFromConfiguration( com::sun::star::uno::Sequence< rtl::OUString >& aSharePointsSeq ); + void ReadSharePointRuleSetFromConfiguration( const rtl::OUString& aSharePointName, + const rtl::OUString& aSharePointNodeName, + SubstituteRuleVector& aRuleSet ); + + // Stored values for domains and host + bool m_bYPDomainRetrieved; + rtl::OUString m_aYPDomain; + bool m_bDNSDomainRetrieved; + rtl::OUString m_aDNSDomain; + bool m_bNTDomainRetrieved; + rtl::OUString m_aNTDomain; + bool m_bHostRetrieved; + rtl::OUString m_aHost; + bool m_bOSRetrieved; + OperatingSystem m_eOSType; + + Link m_aListenerNotify; + const rtl::OUString m_aSharePointsNodeName; + const rtl::OUString m_aDirPropertyName; + const rtl::OUString m_aEnvPropertyName; + const rtl::OUString m_aLevelSep; +}; + +enum PreDefVariable +{ + PREDEFVAR_INST, + PREDEFVAR_PROG, + PREDEFVAR_USER, + PREDEFVAR_WORK, + PREDEFVAR_HOME, + PREDEFVAR_TEMP, + PREDEFVAR_PATH, + PREDEFVAR_LANG, + PREDEFVAR_LANGID, + PREDEFVAR_VLANG, + PREDEFVAR_INSTPATH, + PREDEFVAR_PROGPATH, + PREDEFVAR_USERPATH, + PREDEFVAR_INSTURL, + PREDEFVAR_PROGURL, + PREDEFVAR_USERURL, + PREDEFVAR_WORKDIRURL, + // --> PB 2004-10-27 #i32656# - new variable of hierachy service + PREDEFVAR_BASEINSTURL, + PREDEFVAR_USERDATAURL, + // <-- + PREDEFVAR_BRANDBASEURL, + PREDEFVAR_COUNT +}; + +struct PredefinedPathVariables +{ + // Predefined variables supported by substitute variables + LanguageType m_eLanguageType; // Lanuage type of Office + rtl::OUString m_FixedVar[ PREDEFVAR_COUNT ]; // Variable value access by PreDefVariable + rtl::OUString m_FixedVarNames[ PREDEFVAR_COUNT ]; // Variable name access by PreDefVariable +}; + +struct ReSubstFixedVarOrder +{ + sal_Int32 nVarValueLength; + PreDefVariable eVariable; + + bool operator< ( const ReSubstFixedVarOrder& aFixedVarOrder ) const + { + // Reverse operator< to have high to low ordering + return ( nVarValueLength > aFixedVarOrder.nVarValueLength ); + } +}; + +struct ReSubstUserVarOrder +{ + sal_Int32 nVarValueLength; + rtl::OUString aVarName; + + bool operator< ( const ReSubstUserVarOrder& aUserVarOrder ) const + { + // Reverse operator< to have high to low ordering + return ( nVarValueLength > aUserVarOrder.nVarValueLength ); + } +}; + +typedef std::list< ReSubstFixedVarOrder > ReSubstFixedVarOrderVector; +typedef std::list< ReSubstUserVarOrder > ReSubstUserVarOrderVector; + +class SubstitutePathVariables : private ThreadHelpBase, // Struct for right initalization of mutex member! Must be first of baseclasses. + public ::cppu::WeakImplHelper2< ::com::sun::star::util::XStringSubstitution, css::lang::XServiceInfo > +{ + friend class SubstitutePathVariables_Impl; + + public: + SubstitutePathVariables( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); + virtual ~SubstitutePathVariables(); + + // XInterface, XTypeProvider, XServiceInfo + DECLARE_XSERVICEINFO + + // XStringSubstitution + virtual rtl::OUString SAL_CALL substituteVariables( const ::rtl::OUString& aText, sal_Bool bSubstRequired ) + throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); + virtual rtl::OUString SAL_CALL reSubstituteVariables( const ::rtl::OUString& aText ) + throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getSubstituteVariableValue( const ::rtl::OUString& variable ) + throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); + + protected: + DECL_LINK( implts_ConfigurationNotify, SubstitutePathNotify* ); + + void SetPredefinedPathVariables( PredefinedPathVariables& ); + rtl::OUString ConvertOSLtoUCBURL( const rtl::OUString& aOSLCompliantURL ) const; + + // Special case (transient) values can change during runtime! + // Don't store them in the pre defined struct + rtl::OUString GetWorkPath() const; + rtl::OUString GetWorkVariableValue() const; + rtl::OUString GetPathVariableValue() const; + + rtl::OUString GetHomeVariableValue() const; + + // XStringSubstitution implementation methods + rtl::OUString impl_substituteVariable( const ::rtl::OUString& aText, bool bSustRequired ) + throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); + rtl::OUString impl_reSubstituteVariables( const ::rtl::OUString& aText ) + throw (::com::sun::star::uno::RuntimeException); + ::rtl::OUString impl_getSubstituteVariableValue( const ::rtl::OUString& variable ) + throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); + + private: + class VarNameToIndexMap : public std::hash_map< ::rtl::OUString, + PreDefVariable, + OUStringHashCode, + ::std::equal_to< ::rtl::OUString > > + { + inline void free() + { + VarNameToIndexMap().swap( *this ); + } + }; + + // heavy used string + const rtl::OUString m_aVarStart; + const rtl::OUString m_aVarEnd; + + VarNameToIndexMap m_aPreDefVarMap; // Mapping from pre-def variable names to enum for array access + SubstituteVariables m_aSubstVarMap; // Active rule set map indexed by variable name! + PredefinedPathVariables m_aPreDefVars; // All predefined variables + SubstitutePathVariables_Impl m_aImpl; // Implementation class that access the configuration + ReSubstFixedVarOrderVector m_aReSubstFixedVarOrder; // To speed up resubstitution fixed variables (order for lookup) + ReSubstUserVarOrderVector m_aReSubstUserVarOrder; // To speed up resubstitution user variables + com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; +}; + +} + +#endif // __FRAMEWORK_SERVICES_SUBSTPATHVARS_HXX_ diff --git a/framework/inc/services/tabwindowservice.hxx b/framework/inc/services/tabwindowservice.hxx new file mode 100644 index 000000000000..ee3c6903b896 --- /dev/null +++ b/framework/inc/services/tabwindowservice.hxx @@ -0,0 +1,232 @@ +/************************************************************************* + * + * 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_SERVICES_TABWINDOWSERVICE_HXX_ +#define __FRAMEWORK_SERVICES_TABWINDOWSERVICE_HXX_ + +/** Attention: stl headers must(!) be included at first. Otherwhise it can make trouble + with solaris headers ... +*/ +#include <vector> + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <classes/fwktabwindow.hxx> +#include <classes/propertysethelper.hxx> +#include <threadhelp/threadhelpbase.hxx> +#include <macros/generic.hxx> +#include <macros/debug.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> +#include <general.h> +#include <stdtypes.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ + +#include <com/sun/star/awt/XSimpleTabController.hpp> +#include <com/sun/star/awt/XWindow.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ + +#include <cppuhelper/weak.hxx> +#include <vcl/window.hxx> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ +// exported const +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// exported definitions +//_________________________________________________________________________________________________________________ + +struct TTabPageInfo +{ + public: + + TTabPageInfo() + : m_nIndex ( -1 ) + , m_bCreated (sal_False) + , m_pPage ( NULL ) + , m_lProperties ( ) + {} + + TTabPageInfo(::sal_Int32 nID) + : m_nIndex ( nID ) + , m_bCreated (sal_False) + , m_pPage ( NULL ) + , m_lProperties ( ) + {} + + public: + + ::sal_Int32 m_nIndex; + ::sal_Bool m_bCreated; + FwkTabPage* m_pPage; + css::uno::Sequence< css::beans::NamedValue > m_lProperties; +}; + +typedef ::std::hash_map< ::sal_Int32 , + TTabPageInfo , + Int32HashCode , + ::std::equal_to< ::sal_Int32 > > TTabPageInfoHash; + +/*-************************************************************************************************************//** + @short implements a helper service providing a dockable tab control window +*//*-*************************************************************************************************************/ + +class TabWindowService : public css::lang::XTypeProvider + , public css::lang::XServiceInfo + , public css::awt::XSimpleTabController + , public css::lang::XComponent + , public ThreadHelpBase + , public TransactionBase + , public PropertySetHelper + , public ::cppu::OWeakObject +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + + public: + + //--------------------------------------------------------------------------------------------------------- + // constructor / destructor + //--------------------------------------------------------------------------------------------------------- + + TabWindowService( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory ); + virtual ~TabWindowService(); + + //--------------------------------------------------------------------------------------------------------- + // XInterface, XTypeProvider, XServiceInfo + //--------------------------------------------------------------------------------------------------------- + + FWK_DECLARE_XINTERFACE + FWK_DECLARE_XTYPEPROVIDER + DECLARE_XSERVICEINFO + + //--------------------------------------------------------------------------------------------------------- + // XSimpleTabController + //--------------------------------------------------------------------------------------------------------- + + virtual sal_Int32 SAL_CALL insertTab() throw ( css::uno::RuntimeException ); + virtual void SAL_CALL removeTab( sal_Int32 nID ) throw ( css::lang::IndexOutOfBoundsException, css::uno::RuntimeException ); + virtual void SAL_CALL setTabProps( sal_Int32 nID, const css::uno::Sequence< css::beans::NamedValue >& aProperties ) throw ( css::lang::IndexOutOfBoundsException, css::uno::RuntimeException ); + virtual css::uno::Sequence< css::beans::NamedValue > SAL_CALL getTabProps( sal_Int32 nID ) throw ( css::lang::IndexOutOfBoundsException, css::uno::RuntimeException ); + virtual void SAL_CALL activateTab( sal_Int32 nID ) throw ( css::lang::IndexOutOfBoundsException, css::uno::RuntimeException ); + virtual sal_Int32 SAL_CALL getActiveTabID() throw ( css::uno::RuntimeException ); + virtual void SAL_CALL addTabListener( const css::uno::Reference< css::awt::XTabListener >& Listener ) throw ( css::uno::RuntimeException ); + virtual void SAL_CALL removeTabListener( const css::uno::Reference< css::awt::XTabListener >& Listener ) throw ( css::uno::RuntimeException ); + + //--------------------------------------------------------------------------------------------------------- + // XComponent + //--------------------------------------------------------------------------------------------------------- + + virtual void SAL_CALL dispose() throw ( css::uno::RuntimeException ); + virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) throw ( css::uno::RuntimeException ); + virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) throw ( css::uno::RuntimeException ); + + //------------------------------------------------------------------------------------------------------------- + // protected methods + //------------------------------------------------------------------------------------------------------------- + + protected: + + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + + private: + + void impl_initializePropInfo(); + virtual void SAL_CALL impl_setPropertyValue(const ::rtl::OUString& sProperty, + sal_Int32 nHandle , + const css::uno::Any& aValue ); + virtual css::uno::Any SAL_CALL impl_getPropertyValue(const ::rtl::OUString& sProperty, + sal_Int32 nHandle ); + + DECL_DLLPRIVATE_LINK( EventListener, VclSimpleEvent * ); + + void impl_checkTabIndex (::sal_Int32 nID) throw (css::lang::IndexOutOfBoundsException); + TTabPageInfoHash::iterator impl_getTabPageInfo(::sal_Int32 nID) throw (css::lang::IndexOutOfBoundsException); + FwkTabWindow* mem_TabWin (); +/* + ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); + const css::uno::Sequence< css::beans::Property > impl_getStaticPropertyDescriptor(); + static css::uno::Reference < css::beans::XPropertySetInfo > SAL_CALL + createPropertySetInfo( ::cppu::IPropertyArrayHelper& rProperties ) SAL_THROW( () ); +*/ + //------------------------------------------------------------------------------------------------------------- + // variables + // (should be private everyway!) + //------------------------------------------------------------------------------------------------------------- + + private: + + /// reference to factory, which has created this instance + css::uno::Reference< css::lang::XMultiServiceFactory > m_xFactory; + + /// the tab window as XWindow ( to hold window* alive !) + css::uno::Reference< css::awt::XWindow > m_xTabWin; + + /// the VCL tab window + FwkTabWindow* m_pTabWin; + + /// container of inserted tab pages + TTabPageInfoHash m_lTabPageInfos; + + /// container of the added TabListener + ::cppu::OMultiTypeInterfaceContainerHelper m_lListener; + + /// counter of the tabpage indexes + ::sal_Int32 m_nPageIndexCounter; + + /// index of the current active page + ::sal_Int32 m_nCurrentPageIndex; + + /// title of the tabcontrolled window + ::rtl::OUString m_sTitle; + +}; // class TabWindowService + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_SERVICES_TABWINDOWSERVICE_HXX_ + diff --git a/framework/inc/services/task.hxx b/framework/inc/services/task.hxx new file mode 100644 index 000000000000..651d8caac826 --- /dev/null +++ b/framework/inc/services/task.hxx @@ -0,0 +1,610 @@ +/************************************************************************* + * + * 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_SERVICES_TASK_HXX_ +#define __FRAMEWORK_SERVICES_TASK_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <services/frame.hxx> +#include <macros/generic.hxx> +#include <macros/debug.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/frame/XTask.hpp> +#include <com/sun/star/awt/Point.hpp> +#include <com/sun/star/awt/Size.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <cppuhelper/weak.hxx> +#include <cppuhelper/propshlp.hxx> + +#include <tools/link.hxx> +#include <vcl/evntpost.hxx> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ +// exported const +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// exported definitions +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short implements an special frame - a task frame + + @descr - + + @implements XTask + + @base Frame + OPropertySet +*//*-*************************************************************************************************************/ + +class Task : public css::frame::XTask , // => XFrame => XComponent + public Frame // Order of baseclasses is neccessary for right initialization! +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + + public: + + //--------------------------------------------------------------------------------------------------------- + // constructor / destructor + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short standard constructor to create instance + + @descr This constructor initialize a new instance of this class, + and will be set valid values on his member and baseclasses. + + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + Task( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory ); + + /*-****************************************************************************************************//** + @short standard destructor + + @descr This method destruct an instance of this class and clear some member. + + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual ~Task(); + + //--------------------------------------------------------------------------------------------------------- + // XInterface, XTypeProvider, XServiceInfo + //--------------------------------------------------------------------------------------------------------- + + DECLARE_XINTERFACE + DECLARE_XTYPEPROVIDER + DECLARE_XSERVICEINFO + + //--------------------------------------------------------------------------------------------------------- + // XTask + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short - + + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual sal_Bool SAL_CALL close() throw( css::uno::RuntimeException ); + + /*-****************************************************************************************************//** + @short - + + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL tileWindows() throw( css::uno::RuntimeException ); + + /*-****************************************************************************************************//** + @short - + + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL arrangeWindowsVertical() throw( css::uno::RuntimeException ); + + /*-****************************************************************************************************//** + @short - + + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL arrangeWindowsHorizontal() throw( css::uno::RuntimeException ); + + //--------------------------------------------------------------------------------------------------------- + // XComponent + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short - + + @descr We must overwrite this method, because baseclass Frame implements XFrame and XComponent. + XTask is derived from these classes to! The compiler don't know, which base is the right one. + + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL dispose() throw( css::uno::RuntimeException ) + { + Frame::dispose(); + } + + /*-*******************************************************************************************************/ + virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) throw( css::uno::RuntimeException ) + { + Frame::addEventListener( xListener ); + } + + /*-*******************************************************************************************************/ + virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) throw( css::uno::RuntimeException ) + { + Frame::removeEventListener( xListener ); + } + + //--------------------------------------------------------------------------------------------------------- + // XFrame + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short - + + @descr We must overwrite this method, because baseclass Frame implements XFrame and XComponent. + XTask is derived from these classes to! The compiler don't know, which base is right. + + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL initialize( const css::uno::Reference< css::awt::XWindow >& xWindow ) throw( css::uno::RuntimeException ) + { + Frame::initialize( xWindow ); + } + + virtual css::uno::Reference< css::awt::XWindow > SAL_CALL getContainerWindow() throw( css::uno::RuntimeException ) + { + return Frame::getContainerWindow(); + } + + virtual void SAL_CALL setCreator( const css::uno::Reference< css::frame::XFramesSupplier >& xCreator ) throw( css::uno::RuntimeException ) + { + Frame::setCreator( xCreator ); + } + + virtual css::uno::Reference< css::frame::XFramesSupplier > SAL_CALL getCreator() throw( css::uno::RuntimeException ) + { + return Frame::getCreator(); + } + + virtual ::rtl::OUString SAL_CALL getName() throw( css::uno::RuntimeException ) + { + return Frame::getName(); + } + + virtual void SAL_CALL setName( const ::rtl::OUString& sName ) throw( css::uno::RuntimeException ) + { + Frame::setName( sName ); + } + + virtual sal_Bool SAL_CALL isTop() throw( css::uno::RuntimeException ) + { + return Frame::isTop(); + } + + virtual void SAL_CALL activate() throw( css::uno::RuntimeException ) + { + Frame::activate(); + } + + virtual void SAL_CALL deactivate() throw( css::uno::RuntimeException ) + { + Frame::deactivate(); + } + + virtual sal_Bool SAL_CALL isActive() throw( css::uno::RuntimeException ) + { + return Frame::isActive(); + } + + virtual sal_Bool SAL_CALL setComponent( const css::uno::Reference< css::awt::XWindow >& xComponentWindow , + const css::uno::Reference< css::frame::XController >& xController ) throw( css::uno::RuntimeException ) + { + return Frame::setComponent( xComponentWindow, xController ); + } + + virtual css::uno::Reference< css::awt::XWindow > SAL_CALL getComponentWindow() throw( css::uno::RuntimeException ) + { + return Frame::getComponentWindow(); + } + + virtual css::uno::Reference< css::frame::XController > SAL_CALL getController() throw( css::uno::RuntimeException ) + { + return Frame::getController(); + } + + virtual void SAL_CALL contextChanged() throw( css::uno::RuntimeException ) + { + Frame::contextChanged(); + } + + virtual void SAL_CALL addFrameActionListener( const css::uno::Reference< css::frame::XFrameActionListener >& xListener ) throw( css::uno::RuntimeException ) + { + Frame::addFrameActionListener( xListener ); + } + + virtual void SAL_CALL removeFrameActionListener( const css::uno::Reference< css::frame::XFrameActionListener >& xListener ) throw( css::uno::RuntimeException ) + { + Frame::removeFrameActionListener( xListener ); + } + + virtual css::uno::Reference< css::frame::XFrame > SAL_CALL findFrame( const ::rtl::OUString& sTargetFrameName , + sal_Int32 nSearchFlags ) throw( css::uno::RuntimeException ); + + //--------------------------------------------------------------------------------------------------------- + // XTopWindowListener + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short - + + @descr - + + @seealso - + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL windowClosing( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException ); + + /*-****************************************************************************************************//** + @short - + + @descr - + + @seealso - + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL windowActivated( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException ); + + /*-****************************************************************************************************//** + @short - + + @descr - + + @seealso - + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL windowDeactivated( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException ); + + //--------------------------------------------------------------------------------------------------------- + // XEventListener + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short - + + @descr This object is forced to release all references to the interfaces given + by the parameter Source. + + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL disposing( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException ); + + //------------------------------------------------------------------------------------------------------------- + // protected methods + //------------------------------------------------------------------------------------------------------------- + + protected: + + //--------------------------------------------------------------------------- + // OPropertySetHelper + //--------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short try to convert a property value + @descr This method is calling from helperclass "OPropertySetHelper". + Don't use this directly! + You must try to convert the value of given propertyhandle and + return results of this operation. This will be use to ask vetoable + listener. If no listener have a veto, we will change value realy! + ( in method setFastPropertyValue_NoBroadcast(...) ) + + @seealso OPropertySetHelper + @seealso setFastPropertyValue_NoBroadcast() + + @param "aConvertedValue" new converted value of property + @param "aOldValue" old value of property + @param "nHandle" handle of property + @param "aValue" new value of property + + @return sal_True if value will be changed, sal_FALSE otherway + + @onerror IllegalArgumentException, if you call this with an invalid argument + *//*-*****************************************************************************************************/ +/* + virtual sal_Bool SAL_CALL convertFastPropertyValue( css::uno::Any& aConvertedValue , + css::uno::Any& aOldValue , + sal_Int32 nHandle , + const css::uno::Any& aValue ) throw( css::lang::IllegalArgumentException ); +*/ + /*-****************************************************************************************************//** + @short set value of a transient property + @descr This method is calling from helperclass "OPropertySetHelper". + Don't use this directly! + Handle and value are valid everyway! You must set the new value only. + After this, baseclass send messages to all listener automaticly. + + @seealso OPropertySetHelper + + @param "nHandle" handle of property to change + @param "aValue" new value of property + + @return - + + @onerror An exception is thrown. + *//*-*****************************************************************************************************/ +/* + virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle , + const css::uno::Any& aValue ) throw( css::uno::Exception ); +*/ + /*-****************************************************************************************************//** + @short get value of a transient property + @descr This method is calling from helperclass "OPropertySetHelper". + Don't use this directly! + + @seealso OPropertySetHelper + + @param "nHandle" handle of property to change + @param "aValue" current value of property + + @return - + + @onerror - + *//*-*****************************************************************************************************/ +/* + virtual void SAL_CALL getFastPropertyValue( css::uno::Any& aValue , + sal_Int32 nHandle ) const; +*/ + /*-****************************************************************************************************//** + @short return structure and information about transient properties + @descr This method is calling from helperclass "OPropertySetHelper". + Don't use this directly! + + @seealso OPropertySetHelper + + @param - + + @return structure with property-informations + + @onerror - + *//*-*****************************************************************************************************/ +/* + virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); +*/ + /*-****************************************************************************************************//** + @short return propertysetinfo + @descr You can call this method to get information about transient properties + of this object. + + @seealso OPropertySetHelper + @seealso XPropertySet + @seealso XMultiPropertySet + + @param - + + @return reference to object with information [XPropertySetInfo] + + @onerror - + *//*-*****************************************************************************************************/ +/* + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo(); +*/ + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + + private: + + DECL_LINK( Close_Impl, void* ); + +// void impl_SaveWindowAttributes(); + +/* sal_Bool impl_tryToChangeProperty( sal_Bool bProperty , + const css::uno::Any& aValue , + css::uno::Any& aOldValue , + css::uno::Any& aConvertedValue ) throw( css::lang::IllegalArgumentException ); + sal_Bool impl_tryToChangeProperty( const ::rtl::OUString& sProperty , + const css::uno::Any& aValue , + css::uno::Any& aOldValue , + css::uno::Any& aConvertedValue ) throw( css::lang::IllegalArgumentException ); + sal_Bool impl_tryToChangeProperty( const css::awt::Point& aProperty , + const css::uno::Any& aValue , + css::uno::Any& aOldValue , + css::uno::Any& aConvertedValue ) throw( css::lang::IllegalArgumentException ); + sal_Bool impl_tryToChangeProperty( const css::awt::Size& aProperty , + const css::uno::Any& aValue , + css::uno::Any& aOldValue , + css::uno::Any& aConvertedValue ) throw( css::lang::IllegalArgumentException ); + + static const css::uno::Sequence< css::beans::Property > impl_getStaticPropertyDescriptor(); +*/ + + //------------------------------------------------------------------------------------------------------------- + // 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: + + // Not used in the moment! + + #endif // #ifdef ENABLE_ASSERTIONS + + //------------------------------------------------------------------------------------------------------------- + // variables + // (should be private everyway!) + //------------------------------------------------------------------------------------------------------------- + + protected: + + // But some values are neede by derived classes! +// sal_Bool m_bIsPlugIn ; /// In objects of these class this member is set to sal_False. + /// But in derived class PlugInFrame it's overwrited with sal_True! + + private: + + // Properties + sal_Bool m_bIsAlwaysVisible ; + sal_Bool m_bIsFloating ; + css::awt::Point m_aPosition ; + css::awt::Size m_aSize ; + ::vcl::EventPoster m_aPoster ; + +}; // class Tasks + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_SERVICES_TASKS_HXX_ diff --git a/framework/inc/services/taskcreatorsrv.hxx b/framework/inc/services/taskcreatorsrv.hxx new file mode 100644 index 000000000000..17ffd540ba55 --- /dev/null +++ b/framework/inc/services/taskcreatorsrv.hxx @@ -0,0 +1,167 @@ +/************************************************************************* + * + * 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_SERVICES_TASKCREATORSRV_HXX_ +#define __FRAMEWORK_SERVICES_TASKCREATORSRV_HXX_ + +//_______________________________________________ +// own includes + +#include <threadhelp/threadhelpbase.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> +#include <general.h> +#include <stdtypes.h> + +//_______________________________________________ +// interface includes +#include <com/sun/star/uno/XInterface.hpp> +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/lang/XSingleServiceFactory.hpp> +#include <com/sun/star/awt/Rectangle.hpp> + +//_______________________________________________ +// other includes +#include <cppuhelper/weak.hxx> +#include <comphelper/sequenceashashmap.hxx> + +//_______________________________________________ +// definition + +namespace framework +{ + +//_______________________________________________ +/** + * TODO document me + */ +class TaskCreatorService : public css::lang::XTypeProvider + , public css::lang::XServiceInfo + , public css::lang::XSingleServiceFactory + // attention! Must be the first base class to guarentee right initialize lock ... + , private ThreadHelpBase + , public ::cppu::OWeakObject +{ + //___________________________________________ + // types + + public: + + /// [XFrame] if it's set, it will be used as parent frame for the new created frame. + static const ::rtl::OUString ARGUMENT_PARENTFRAME; + + /** [OUString] if it's not a special name (beginning with "_" ... which are not allowed here!) + it will be set as the API name of the new created frame. + */ + static const ::rtl::OUString ARGUMENT_FRAMENAME; + + /// [sal_Bool] If its set to sal_True we will make the new created frame visible. + static const ::rtl::OUString ARGUMENT_MAKEVISIBLE; + + /** [sal_Bool] If not "ContainerWindow" property is set it force creation of a + top level window as new container window. + */ + static const ::rtl::OUString ARGUMENT_CREATETOPWINDOW; + + /// [Rectangle] Place the new created frame on this place and resize the container window. + static const ::rtl::OUString ARGUMENT_POSSIZE; + + /// [XWindow] an outside created window, used as container window of the new created frame. + static const ::rtl::OUString ARGUMENT_CONTAINERWINDOW; + + /** [sal_Bool] enable/disable special mode, where this frame will be part of + the persistent window state feature suitable for any office module window + */ + static const ::rtl::OUString ARGUMENT_SUPPORTPERSISTENTWINDOWSTATE; + + /** [sal_Bool] enable/disable special mode, where the title bar of our + the new created frame will be updated automaticly. + Default = ON ! + */ + static const ::rtl::OUString ARGUMENT_ENABLE_TITLEBARUPDATE; + //___________________________________________ + // member + + private: + + //--------------------------------------- + /** @short the global uno service manager. + @descr Must be used to create own needed services. + */ + css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR; + + //___________________________________________ + // interface + + public: + + TaskCreatorService(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR); + virtual ~TaskCreatorService( ); + + // XInterface, XTypeProvider, XServiceInfo + FWK_DECLARE_XINTERFACE + FWK_DECLARE_XTYPEPROVIDER + DECLARE_XSERVICEINFO + + // XSingleServiceFactory + virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance() + throw(css::uno::Exception , + css::uno::RuntimeException); + + virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstanceWithArguments(const css::uno::Sequence< css::uno::Any >& lArguments) + throw(css::uno::Exception , + css::uno::RuntimeException); + //___________________________________________ + // helper + + private: + + css::uno::Reference< css::awt::XWindow > implts_createContainerWindow( const css::uno::Reference< css::awt::XWindow >& xParentWindow , + const css::awt::Rectangle& aPosSize , + sal_Bool bTopWindow ); + + void implts_applyDocStyleToWindow(const css::uno::Reference< css::awt::XWindow >& xWindow) const; + + css::uno::Reference< css::frame::XFrame > implts_createFrame( const css::uno::Reference< css::frame::XFrame >& xParentFrame , + const css::uno::Reference< css::awt::XWindow >& xContainerWindow , + const ::rtl::OUString& sName ); + + void implts_establishWindowStateListener( const css::uno::Reference< css::frame::XFrame >& xFrame ); + void implts_establishTitleBarUpdate( const css::uno::Reference< css::frame::XFrame >& xFrame ); + + void implts_establishDocModifyListener( const css::uno::Reference< css::frame::XFrame >& xFrame ); + + ::rtl::OUString impl_filterNames( const ::rtl::OUString& sName ); +}; + +} // namespace framework + +#endif // __FRAMEWORK_SERVICES_TASKCREATORSRV_HXX_ diff --git a/framework/inc/services/uriabbreviation.hxx b/framework/inc/services/uriabbreviation.hxx new file mode 100644 index 000000000000..42d5fa444d6e --- /dev/null +++ b/framework/inc/services/uriabbreviation.hxx @@ -0,0 +1,66 @@ +/************************************************************************* + * + * 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_SERVICES_URIABBREVIATION_HXX_ +#define __FRAMEWORK_SERVICES_URIABBREVIATION_HXX_ + +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> +#include <general.h> + +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/util/XStringAbbreviation.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> + +#include <cppuhelper/implbase2.hxx> + +namespace framework +{ + +class UriAbbreviation: public ::cppu::WeakImplHelper2< ::com::sun::star::util::XStringAbbreviation, css::lang::XServiceInfo> +{ +public: + explicit UriAbbreviation(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & context); + + DECLARE_XSERVICEINFO + + // ::com::sun::star::util::XStringAbbreviation: + virtual ::rtl::OUString SAL_CALL abbreviateString(const ::com::sun::star::uno::Reference< ::com::sun::star::util::XStringWidth > & xStringWidth, ::sal_Int32 nWidth, const ::rtl::OUString & aString) throw (::com::sun::star::uno::RuntimeException); + +private: + UriAbbreviation(UriAbbreviation &); // not defined + void operator =(UriAbbreviation &); // not defined + + virtual ~UriAbbreviation() {} + + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; +}; + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_SERVICES_URIABBREVIATION_HXX_ diff --git a/framework/inc/services/urltransformer.hxx b/framework/inc/services/urltransformer.hxx new file mode 100644 index 000000000000..069227446aa8 --- /dev/null +++ b/framework/inc/services/urltransformer.hxx @@ -0,0 +1,223 @@ +/************************************************************************* + * + * 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_SERVICES_URLTRANSFORMER_HXX_ +#define __FRAMEWORK_SERVICES_URLTRANSFORMER_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#ifndef __FRAMEWORK_OMUTEXMEMBER_HXX_ +#include <threadhelp/threadhelpbase.hxx> +#endif +#include <macros/generic.hxx> +#include <macros/debug.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> +#include <general.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/util/XURLTransformer.hpp> +#include <com/sun/star/util/URL.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <cppuhelper/implbase2.hxx> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ +// exported const +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// exported definitions +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short + + @descr - + + @implements XInterface + XTypeProvider + XServiceInfo + XURLTransformer + + @base ThreadHelpBase + OWeakObject +*//*-*************************************************************************************************************/ + +class URLTransformer : public ::cppu::WeakImplHelper2< ::com::sun::star::util::XURLTransformer, css::lang::XServiceInfo> +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + + public: + + //--------------------------------------------------------------------------------------------------------- + // constructor / destructor + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short - + @descr - + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + URLTransformer( const css::uno::Reference< css::lang::XMultiServiceFactory >& sFactory ); + + /*-****************************************************************************************************//** + @short - + @descr - + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual ~URLTransformer(); + + //--------------------------------------------------------------------------------------------------------- + // XInterface, XTypeProvider, XServiceInfo + //--------------------------------------------------------------------------------------------------------- + + DECLARE_XSERVICEINFO + + //--------------------------------------------------------------------------------------------------------- + // XURLTransformer + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short - + @descr - + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual sal_Bool SAL_CALL parseStrict( css::util::URL& aURL ) throw( css::uno::RuntimeException ); + + /*-****************************************************************************************************//** + @short - + @descr - + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual sal_Bool SAL_CALL parseSmart( css::util::URL& aURL , + const ::rtl::OUString& sSmartProtocol ) throw( css::uno::RuntimeException ); + + /*-****************************************************************************************************//** + @short - + @descr - + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual sal_Bool SAL_CALL assemble( css::util::URL& aURL ) throw( css::uno::RuntimeException ); + + /*-****************************************************************************************************//** + @short - + @descr - + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual ::rtl::OUString SAL_CALL getPresentation( const css::util::URL& aURL , + sal_Bool bWithPassword ) throw( css::uno::RuntimeException ); + + //------------------------------------------------------------------------------------------------------------- + // protected methods + //------------------------------------------------------------------------------------------------------------- + + protected: + + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + + private: + + //------------------------------------------------------------------------------------------------------------- + // debug methods + // (should be private everyway!) + //------------------------------------------------------------------------------------------------------------- + + + //------------------------------------------------------------------------------------------------------------- + // variables + // (should be private everyway!) + //------------------------------------------------------------------------------------------------------------- + + private: + + css::uno::Reference< css::lang::XMultiServiceFactory > m_xFactory ; /// reference to factory, which has created this instance + +}; // class URLTransformer + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_SERVICES_URLTRANSFORMER_HXX_ diff --git a/framework/inc/stdtypes.h b/framework/inc/stdtypes.h new file mode 100644 index 000000000000..08e0f700a241 --- /dev/null +++ b/framework/inc/stdtypes.h @@ -0,0 +1,213 @@ +/************************************************************************* + * + * 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_STDTYPES_H_ +#define __FRAMEWORK_STDTYPES_H_ + +#include <vector> +#include <queue> +#include <hash_map> + +//_________________________________________________________________________________________________________________ +// own includes +//_________________________________________________________________________________________________________________ +#include <general.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ + +#ifndef __COM_SUN_STAR_AWT_KEYEVENT_HPP_ +#include <com/sun/star/awt/KeyEvent.hpp> +#endif + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <comphelper/sequenceasvector.hxx> +#include <cppuhelper/interfacecontainer.hxx> +#include <rtl/ustring.hxx> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ +// definitions +//_________________________________________________________________________________________________________________ + +/** + Own hash functions used for stl-structures ... e.g. hash tables/maps ... +*/ +struct OUStringHashCode +{ + size_t operator()( const ::rtl::OUString& sString ) const + { + return sString.hashCode(); + } +}; + +struct ShortHashCode +{ + size_t operator()( const ::sal_Int16& nShort ) const + { + return (size_t)nShort; + } +}; + +struct Int32HashCode +{ + size_t operator()( const ::sal_Int32& nValue ) const + { + return (size_t)nValue; + } +}; + +struct KeyEventHashCode +{ + size_t operator()( const css::awt::KeyEvent& aEvent ) const + { + return (size_t)(aEvent.KeyCode + + //aEvent.KeyChar + + //aEvent.KeyFunc + + aEvent.Modifiers); + } +}; + +struct KeyEventEqualsFunc +{ + bool operator()(const css::awt::KeyEvent aKey1, + const css::awt::KeyEvent aKey2) const + { + return ( + (aKey1.KeyCode == aKey2.KeyCode ) && + //(aKey1.KeyChar == aKey2.KeyChar ) && + //(aKey1.KeyFunc == aKey2.KeyFunc ) && + (aKey1.Modifiers == aKey2.Modifiers) + ); + } +}; + +//_________________________________________________________________________________________________________________ + +/** + Basic string list based on a std::vector() + It implements some additional funtionality which can be usefull but + is missing at the normal vector implementation. +*/ +class OUStringList : public ::comphelper::SequenceAsVector< ::rtl::OUString > +{ + public: + + // insert given element as the first one into the vector + void push_front( const ::rtl::OUString& sElement ) + { + insert( begin(), sElement ); + } + + // search for given element + iterator find( const ::rtl::OUString& sElement ) + { + return ::std::find(begin(), end(), sElement); + } + + const_iterator findConst( const ::rtl::OUString& sElement ) const + { + return ::std::find(begin(), end(), sElement); + } + + // the only way to free used memory realy! + void free() + { + OUStringList().swap( *this ); + } +}; + +//_________________________________________________________________________________________________________________ + +/** + Basic string queue based on a std::queue() + It implements some additional funtionality which can be usefull but + is missing at the normal std implementation. +*/ +typedef ::std::queue< ::rtl::OUString > OUStringQueue; + +//_________________________________________________________________________________________________________________ + +/** + Basic hash based on a std::hash_map() which provides key=[OUString] and value=[template type] pairs + It implements some additional funtionality which can be usefull but + is missing at the normal hash implementation. +*/ +template< class TType > +class BaseHash : public ::std::hash_map< ::rtl::OUString , + TType , + OUStringHashCode , + ::std::equal_to< ::rtl::OUString > > +{ + public: + + // the only way to free used memory realy! + void free() + { + BaseHash().swap( *this ); + } +}; + +//_________________________________________________________________________________________________________________ + +/** + Basic OUString hash. + Key and values are OUStrings. +*/ +typedef BaseHash< ::rtl::OUString > OUStringHash; + +//_________________________________________________________________________________________________________________ + +/** + It can be used to map names (e.g. of properties) to her corresponding handles. + Our helper class OPropertySetHelper works optimized with handles but sometimes we have only a property name. + Mapping between these two parts of a property should be done in the fastest way :-) +*/ +typedef BaseHash< sal_Int32 > NameToHandleHash; + +//_________________________________________________________________________________________________________________ + +/** + Sometimes we need this template to implement listener container ... + and we need it at different positions ... + So it's better to declare it one times only! +*/ +typedef ::cppu::OMultiTypeInterfaceContainerHelperVar< ::rtl::OUString , + OUStringHashCode , + ::std::equal_to< ::rtl::OUString > > ListenerHash; + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_STDTYPES_H_ diff --git a/framework/inc/tabwin/tabwindow.hxx b/framework/inc/tabwin/tabwindow.hxx new file mode 100644 index 000000000000..3f0072be212f --- /dev/null +++ b/framework/inc/tabwin/tabwindow.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_TABWIN_TABWINDOW_HXX_ +#define __FRAMEWORK_TABWIN_TABWINDOW_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <stdtypes.h> +#include <threadhelp/threadhelpbase.hxx> +#include <macros/generic.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> +#include <services.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> +#ifndef _COM_SUN_STAR_LANG_XWINDOW_HPP_ +#include <com/sun/star/awt/XWindow.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_XTOPWINDOW_HPP_ +#include <com/sun/star/awt/XTopWindow.hpp> +#endif +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/awt/XSimpleTabController.hpp> +#include <com/sun/star/awt/XTabListener.hpp> + +//_________________________________________________________________________________________________________________ +// includes of other projects +//_________________________________________________________________________________________________________________ +#include <cppuhelper/propshlp.hxx> +#include <cppuhelper/interfacecontainer.hxx> +#include <cppuhelper/weak.hxx> +#include <rtl/ustring.hxx> +#include <vcl/tabctrl.hxx> + +namespace framework +{ + +class TabWindow : public ::com::sun::star::lang::XTypeProvider , + public ::com::sun::star::lang::XServiceInfo , + public ::com::sun::star::lang::XInitialization , + public ::com::sun::star::lang::XComponent , + public ::com::sun::star::awt::XWindowListener , + public ::com::sun::star::awt::XTopWindowListener , + public ::com::sun::star::awt::XSimpleTabController , + protected ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses. + public ::cppu::OBroadcastHelper , + public ::cppu::OPropertySetHelper , // => XPropertySet / XFastPropertySet / XMultiPropertySet + public ::cppu::OWeakObject +{ + public: + TabWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); + virtual ~TabWindow(); + + // XInterface, XTypeProvider, XServiceInfo + FWK_DECLARE_XINTERFACE + DECLARE_XSERVICEINFO + FWK_DECLARE_XTYPEPROVIDER + + using ::cppu::OPropertySetHelper::disposing; + using ::cppu::OPropertySetHelper::getFastPropertyValue; + + //--------------------------------------------------------------------------------------------------------- + // XInitialization + //--------------------------------------------------------------------------------------------------------- + virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + + //--------------------------------------------------------------------------------------------------------- + // XComponent + //--------------------------------------------------------------------------------------------------------- + virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException); + + //--------------------------------------------------------------------------------------------------------- + // XSimpleTabController + //--------------------------------------------------------------------------------------------------------- + virtual ::sal_Int32 SAL_CALL insertTab() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeTab( ::sal_Int32 ID ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setTabProps( ::sal_Int32 ID, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& Properties ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > SAL_CALL getTabProps( ::sal_Int32 ID ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL activateTab( ::sal_Int32 ID ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getActiveTabID( ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addTabListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabListener >& Listener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeTabListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabListener >& Listener ) throw (::com::sun::star::uno::RuntimeException); + + //--------------------------------------------------------------------------------------------------------- + // XEventListener + //--------------------------------------------------------------------------------------------------------- + virtual void SAL_CALL disposing( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException ); + + //--------------------------------------------------------------------------------------------------------- + // XTopWindowListener + //--------------------------------------------------------------------------------------------------------- + virtual void SAL_CALL windowOpened( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL windowClosing( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL windowClosed( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL windowMinimized( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL windowNormalized( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL windowActivated( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL windowDeactivated( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException); + + //--------------------------------------------------------------------------------------------------------- + // XWindowListener + //--------------------------------------------------------------------------------------------------------- + virtual void SAL_CALL windowResized( const css::awt::WindowEvent& aEvent ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL windowMoved( const css::awt::WindowEvent& aEvent ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL windowShown( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL windowHidden( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException ); + + protected: + DECL_LINK( Activate, TabControl* ); + DECL_LINK( Deactivate, TabControl* ); + + 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 ); + 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(); + + private: + enum Notification + { + NOTIFY_INSERTED, + NOTIFY_REMOVED, + NOTIFY_CHANGED, + NOTIFY_ACTIVATED, + NOTIFY_DEACTIVATED + }; + + sal_Int32 impl_GetPageIdFromIndex( ::sal_Int32 nIndex ) const; + sal_Bool impl_CheckIndex( ::sal_Int32 nIndex ) const; + void implts_LayoutWindows() const; + void impl_SetTitle( const ::rtl::OUString& rTitle ); + TabControl* impl_GetTabControl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& xTabControlWindow ) const; + void implts_SendNotification( Notification eNotify, sal_Int32 ID ) const; + void implts_SendNotification( Notification eNotify, sal_Int32 ID, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& rSeq ) const; + + typedef std::vector< sal_uInt16 > PageIdVector; + + sal_Bool m_bInitialized : 1, + m_bDisposed : 1; + sal_Int32 m_nNextTabID; + ::rtl::OUString m_aTitlePropName; + ::rtl::OUString m_aPosPropName; + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTopWindow > m_xTopWindow; + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > m_xContainerWindow; + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > m_xTabControlWindow; + ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; // container for ALL Listener +}; + +} + +#endif // __FRAMEWORK_TABWIN_TABWINDOW_HXX_ diff --git a/framework/inc/tabwin/tabwinfactory.hxx b/framework/inc/tabwin/tabwinfactory.hxx new file mode 100644 index 000000000000..c2c33d014819 --- /dev/null +++ b/framework/inc/tabwin/tabwinfactory.hxx @@ -0,0 +1,83 @@ +/************************************************************************* + * + * 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_TABWIN_TABWINFACTORY_HXX_ +#define __FRAMEWORK_TABWIN_TABWINFACTORY_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <stdtypes.h> +#include <threadhelp/threadhelpbase.hxx> +#include <macros/generic.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> +#include <services.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/lang/XSingleComponentFactory.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/awt/XToolkit.hpp> + +//_________________________________________________________________________________________________________________ +// includes of other projects +//_________________________________________________________________________________________________________________ +#include <cppuhelper/implbase2.hxx> +#include <rtl/ustring.hxx> + +namespace framework +{ + +class TabWinFactory : protected ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses. + public ::cppu::WeakImplHelper2< ::com::sun::star::lang::XSingleComponentFactory, com::sun::star::lang::XServiceInfo> +{ + public: + TabWinFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); + virtual ~TabWinFactory(); + + // XInterface, XTypeProvider, XServiceInfo + DECLARE_XSERVICEINFO + + // XSingleComponentFactory + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceWithContext( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& Context ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceWithArgumentsAndContext( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Arguments, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& Context ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + + private: + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit > m_xToolkit; +}; + +} + +#endif // __FRAMEWORK_TABWIN_TABWINFACTORY_HXX_ diff --git a/framework/inc/targets.h b/framework/inc/targets.h new file mode 100644 index 000000000000..df96d0db7f03 --- /dev/null +++ b/framework/inc/targets.h @@ -0,0 +1,69 @@ +/************************************************************************* + * + * 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_TARGETS_H_ +#define __FRAMEWORK_TARGETS_H_ + +//_________________________________________________________________________________________________________________ +// includes +//_________________________________________________________________________________________________________________ + +#include <macros/generic.hxx> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ +// Values for special frame search ... sTargetFrameName of findFrame() or queryDispatch() or loadComponentFromURL() +//_________________________________________________________________________________________________________________ + +#define SPECIALTARGET_ASCII_SELF "_self" // The frame himself is searched. +#define SPECIALTARGET_ASCII_PARENT "_parent" // The direct parent frame is searched. +#define SPECIALTARGET_ASCII_TOP "_top" // Search at ouer parents for the first task (if any exist) or a frame without a parent. +#define SPECIALTARGET_ASCII_BLANK "_blank" // Create a new task. +#define SPECIALTARGET_ASCII_DEFAULT "_default" // Create a new task or recycle an existing one +#define SPECIALTARGET_ASCII_BEAMER "_beamer" // special frame in hierarchy +#define SPECIALTARGET_ASCII_MENUBAR "_menubar" // special target for menubars +#define SPECIALTARGET_ASCII_HELPAGENT "_helpagent" // special target for the help agent window +#define SPECIALTARGET_ASCII_HELPTASK "OFFICE_HELP_TASK" // special name for our help task + +#define SPECIALTARGET_SELF DECLARE_ASCII(SPECIALTARGET_ASCII_SELF ) +#define SPECIALTARGET_PARENT DECLARE_ASCII(SPECIALTARGET_ASCII_PARENT ) +#define SPECIALTARGET_TOP DECLARE_ASCII(SPECIALTARGET_ASCII_TOP ) +#define SPECIALTARGET_BLANK DECLARE_ASCII(SPECIALTARGET_ASCII_BLANK ) +#define SPECIALTARGET_DEFAULT DECLARE_ASCII(SPECIALTARGET_ASCII_DEFAULT ) +#define SPECIALTARGET_BEAMER DECLARE_ASCII(SPECIALTARGET_ASCII_BEAMER ) +#define SPECIALTARGET_MENUBAR DECLARE_ASCII(SPECIALTARGET_ASCII_MENUBAR ) +#define SPECIALTARGET_HELPAGENT DECLARE_ASCII(SPECIALTARGET_ASCII_HELPAGENT ) +#define SPECIALTARGET_HELPTASK DECLARE_ASCII(SPECIALTARGET_ASCII_HELPTASK ) + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_TARGETS_H_ diff --git a/framework/inc/threadhelp/fairrwlock.hxx b/framework/inc/threadhelp/fairrwlock.hxx new file mode 100644 index 000000000000..0f984c8d03f9 --- /dev/null +++ b/framework/inc/threadhelp/fairrwlock.hxx @@ -0,0 +1,286 @@ +/************************************************************************* + * + * 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_THREADHELP_FAIRRWLOCK_HXX_ +#define __FRAMEWORK_THREADHELP_FAIRRWLOCK_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <threadhelp/inoncopyable.h> +#include <threadhelp/irwlock.h> +#include <macros/debug.hxx> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/uno/XInterface.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <osl/mutex.hxx> +#include <osl/conditn.hxx> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ +// const +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// declarations +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short implement a read/write lock with fairness between read/write accessors + @descr These implementation never should used as base class! Use it as a member every time. + Use ReadGuard and/or WriteGuard in your methods (which work with these lock) + to make your code threadsafe. + Fair means: All reading or writing threads are synchronized AND serialzed by using one + mutex. For reader this mutex is used to access internal variables of this lock only; + for writer this mutex is used to have an exclusiv access on your class member! + => It's a multi-reader/single-writer lock, which no preferred accessor. + + @implements IRWlock + @base INonCopyable + IRWLock + + @devstatus ready to use +*//*-*************************************************************************************************************/ +class FairRWLock : public IRWLock + , private INonCopyable +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + public: + + /*-****************************************************************************************************//** + @short standard ctor + @descr Initialize instance with right start values for correct working. + no reader could exist => m_nReadCount = 0 + don't block first comming writer => m_aWriteCondition.set() + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + inline FairRWLock() + : m_nReadCount( 0 ) + { + m_aWriteCondition.set(); + } + + inline virtual ~FairRWLock() + { + } + + /*-****************************************************************************************************//** + @interface IRWLock + @short set lock for reading + @descr A guard should call this method to acquire read access on your member. + Writing isn't allowed then - but nobody could check it for you! + + @seealso method releaseReadAccess() + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + inline virtual void acquireReadAccess() + { + // Put call in "SERIALIZE"-queue! + // After successful acquiring this mutex we are alone ... + ::osl::MutexGuard aSerializeGuard( m_aSerializer ); + + // ... but we should synchronize us with other reader! + // May be - they will unregister himself by using releaseReadAccess()! + ::osl::MutexGuard aAccessGuard( m_aAccessLock ); + + // Now we must register us as reader by increasing counter. + // If this the first writer we must close door for possible writer. + // Other reader don't look for this barrier - they work parallel to us! + if( m_nReadCount == 0 ) + { + m_aWriteCondition.reset(); + } + ++m_nReadCount; + } + + /*-****************************************************************************************************//** + @interface IRWLock + @short reset lock for reading + @descr A guard should call this method to release read access on your member. + + @seealso method acquireReadAccess() + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + inline virtual void releaseReadAccess() + { + // The access lock is enough at this point + // because it's not allowed to wait for all reader or writer here! + // That will cause a deadlock! + ::osl::MutexGuard aAccessGuard( m_aAccessLock ); + + // Unregister as reader first! + // Open writer barrier then if it was the last reader. + --m_nReadCount; + if( m_nReadCount == 0 ) + { + m_aWriteCondition.set(); + } + } + + /*-****************************************************************************************************//** + @interface IRWLock + @short set lock for writing + @descr A guard should call this method to acquire write access on your member. + Reading is allowed too - of course. + After successfully calling of this method you are the only writer. + + @seealso method releaseWriteAccess() + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + inline virtual void acquireWriteAccess() + { + // You have to stand in our serialize-queue till all reader + // are registered (not for releasing them!) or writer finished their work! + // Don't use a guard to do so - because you must hold the mutex till + // you call releaseWriteAccess()! + // After succesfull acquire you have to wait for current working reader. + // Used condition will open by last gone reader object. + m_aSerializer.acquire(); + m_aWriteCondition.wait(); + + #ifdef ENABLE_MUTEXDEBUG + // A writer is an exclusiv accessor! + LOG_ASSERT2( m_nReadCount!=0, "FairRWLock::acquireWriteAccess()", "No threadsafe code detected ... : Read count != 0!" ) + #endif + } + + /*-****************************************************************************************************//** + @interface IRWLock + @short reset lock for writing + @descr A guard should call this method to release write access on your member. + + @seealso method acquireWriteAccess() + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + inline virtual void releaseWriteAccess() + { + // The only one you have to do here is to release + // hold seriliaze-mutex. All other user of these instance are blocked + // by these mutex! + // You don't need any other mutex here - you are the only one in the moment! + + #ifdef ENABLE_MUTEXDEBUG + // A writer is an exclusiv accessor! + LOG_ASSERT2( m_nReadCount!=0, "FairRWLock::releaseWriteAccess()", "No threadsafe code detected ... : Read count != 0!" ) + #endif + + m_aSerializer.release(); + } + + /*-****************************************************************************************************//** + @interface IRWLock + @short downgrade a write access to a read access + @descr A guard should call this method to change a write to a read access. + New readers can work too - new writer are blocked! + + @attention Don't call this method if you are not a writer! + Results are not defined then ... + An upgrade can't be implemented realy ... because acquiring new access + will be the same - there no differences! + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + inline virtual void downgradeWriteAccess() + { + // You must be a writer to call this method! + // We can't check it - but otherwise it's your problem ... + // Thats why you don't need any mutex here. + + #ifdef ENABLE_MUTEXDEBUG + // A writer is an exclusiv accessor! + LOG_ASSERT2( m_nReadCount!=0, "FairRWLock::downgradeWriteAccess()", "No threadsafe code detected ... : Read count != 0!" ) + #endif + + // Register himself as "new" reader. + // This value must be 0 before - because we support single writer access only! + ++m_nReadCount; + // Close barrier for other writer! + // Why? + // You hold the serializer mutex - next one can be a reader OR a writer. + // They must blocked then - because you will be a reader after this call + // and writer use this condition to wait for current reader! + m_aWriteCondition.reset(); + // Open door for next waiting thread in serialize queue! + m_aSerializer.release(); + } + + //------------------------------------------------------------------------------------------------------------- + // private member + //------------------------------------------------------------------------------------------------------------- + private: + + ::osl::Mutex m_aAccessLock ; /// regulate access on internal member of this instance + ::osl::Mutex m_aSerializer ; /// serialze incoming read/write access threads + ::osl::Condition m_aWriteCondition ; /// a writer must wait till current working reader are gone + sal_Int32 m_nReadCount ; /// every reader is registered - the last one open the door for waiting writer + +}; // class FairRWLock + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_THREADHELP_FAIRRWLOCK_HXX_ diff --git a/framework/inc/threadhelp/gate.hxx b/framework/inc/threadhelp/gate.hxx new file mode 100644 index 000000000000..c3d4712d4fc9 --- /dev/null +++ b/framework/inc/threadhelp/gate.hxx @@ -0,0 +1,248 @@ +/************************************************************************* + * + * 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_THREADHELP_GATE_HXX_ +#define __FRAMEWORK_THREADHELP_GATE_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <threadhelp/inoncopyable.h> +#include <threadhelp/igate.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <osl/mutex.hxx> +#include <osl/conditn.hxx> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ +// const +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// declarations +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short implement a gate to block multiple threads at same time or unblock all + @descr A gate can be used as a negative-condition! You can open a "door" - wait() will not block ... + or you can close it - wait() blocks till open() is called again. + As a special feature you can open the gate a little bit by sing openGap(). + Then all currently waiting threads are running immediately - but new ones are blocked! + + @attention To prevent us against wrong using, the default ctor, copy ctor and the =operator are maked private! + + @implements IGate + @base IGate + INonCopyable + + @devstatus ready to use +*//*-*************************************************************************************************************/ +class Gate : public IGate + , private INonCopyable +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + public: + + /*-****************************************************************************************************//** + @short ctor + @descr These initialize the object right as an open gate. + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + inline Gate() + : m_bClosed ( sal_False ) + , m_bGapOpen ( sal_False ) + { + open(); + } + + /*-****************************************************************************************************//** + @short dtor + @descr Is user forget it - we open the gate ... + blocked threads can running ... but I don't know + if it's right - we are destroyed yet!? + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + inline virtual ~Gate() + { + open(); + } + + /*-****************************************************************************************************//** + @interface IGate + @short open the gate + @descr A wait() call will not block then. + + @seealso method close() + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + inline virtual void open() + { + // We must safe access to our internal member! + ::osl::MutexGuard aLock( m_aAccessLock ); + // Set condition -> wait don't block any longer -> gate is open + m_aPassage.set(); + // Check if operation was successful! + // Check returns false if condition isn't set => m_bClosed will be true then => we must return false; opening failed + m_bClosed = ( m_aPassage.check() == sal_False ); + } + + /*-****************************************************************************************************//** + @interface IGate + @short close the gate + @descr A wait() call will block then. + + @seealso method open() + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + inline virtual void close() + { + // We must safe access to our internal member! + ::osl::MutexGuard aLock( m_aAccessLock ); + // Reset condition -> wait blocks now -> gate is closed + m_aPassage.reset(); + // Check if operation was successful! + // Check returns false if condition was reseted => m_bClosed will be true then => we can return true; closing ok + m_bClosed = ( m_aPassage.check() == sal_False ); + } + + /*-****************************************************************************************************//** + @interface IGate + @short open gate for current waiting threads + @descr All current waiting threads stand in wait() at line "m_aPassage.wait()" ... + With this call you can open the passage for these waiting ones. + The "gap" is closed by any new thread which call wait() automaticly! + + @seealso method wait() + @seealso method open() + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + inline virtual void openGap() + { + // We must safe access to our internal member! + ::osl::MutexGuard aLock( m_aAccessLock ); + // Open passage for current waiting threads. + m_aPassage.set(); + // Check state of condition. + // If condition is set check() returns true => m_bGapOpen will be true too => we can use it as return value. + m_bGapOpen = ( m_aPassage.check() == sal_True ); + } + + /*-****************************************************************************************************//** + @interface IGate + @short must be called to pass the gate + @descr If gate "open" => wait() will not block. + If gate "closed" => wait() will block till somewhere open it again. + If gap "open" => currently waiting threads unblocked, new ones blocked + + @seealso method wait() + @seealso method open() + + @param "pTimeOut", optional parameter to wait a certain time + @return true, if wait was successful (gate was opened) + false, if condition has an error or timeout was reached! + + @onerror We return false. + *//*-*****************************************************************************************************/ + inline virtual sal_Bool wait( const TimeValue* pTimeOut = NULL ) + { + // We must safe access to our internal member! + ::osl::ClearableMutexGuard aLock( m_aAccessLock ); + // If gate not closed - caller can pass it. + sal_Bool bSuccessful = sal_True; + if( m_bClosed == sal_True ) + { + // Otherwise first new thread must close an open gap! + if( m_bGapOpen == sal_True ) + { + m_bGapOpen = sal_False; + m_aPassage.reset(); + } + // Then we must release used access lock - + // because next call will block ... + // and if we hold the access lock nobody else can use this object without a dadlock! + aLock.clear(); + // Wait for opening gate ... + bSuccessful = ( m_aPassage.wait( pTimeOut ) == ::osl::Condition::result_ok ); + } + + return bSuccessful; + } + + //------------------------------------------------------------------------------------------------------------- + // private member + //------------------------------------------------------------------------------------------------------------- + private: + + ::osl::Mutex m_aAccessLock ; + ::osl::Condition m_aPassage ; + sal_Bool m_bClosed ; + sal_Bool m_bGapOpen ; + +}; // class Gate + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_THREADHELP_GATE_HXX_ diff --git a/framework/inc/threadhelp/igate.h b/framework/inc/threadhelp/igate.h new file mode 100644 index 000000000000..b599dcd4ac25 --- /dev/null +++ b/framework/inc/threadhelp/igate.h @@ -0,0 +1,73 @@ +/************************************************************************* + * + * 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_THREADHELP_IGATE_H_ +#define __FRAMEWORK_THREADHELP_IGATE_H_ + +//_________________________________________________________________________________________________________________ +// includes +//_________________________________________________________________________________________________________________ + +#include <osl/time.h> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ +// declarations +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @descr We need this interface to support using of different gate implementations in a generic way. +*//*-*************************************************************************************************************/ +class IGate +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + public: + + /*-****************************************************************************************************//** + @descr These functions must be supported by a derived class! + open() -open access for all waiting threads + close() -close access for all further coming threads + openGap() -open access for current waiting threads only + wait() -must be called to pass the gate + *//*-*****************************************************************************************************/ + virtual void open ( ) = 0; + virtual void close ( ) = 0; + virtual void openGap ( ) = 0; + virtual sal_Bool wait ( const TimeValue* pTimeOut = NULL ) = 0; + +}; // class IGate + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_THREADHELP_IGATE_H_ diff --git a/framework/inc/threadhelp/inoncopyable.h b/framework/inc/threadhelp/inoncopyable.h new file mode 100644 index 000000000000..a0652ff2ea39 --- /dev/null +++ b/framework/inc/threadhelp/inoncopyable.h @@ -0,0 +1,77 @@ +/************************************************************************* + * + * 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_THREADHELP_INONCOPYABLE_H_ +#define __FRAMEWORK_THREADHELP_INONCOPYABLE_H_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ +// const +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// declarations +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @descr Use this as one of your base classes to disable + all possiblities to copy or assign one object to another one! + We declare neccessary functions private to do so. +*//*-*************************************************************************************************************/ +class INonCopyable +{ + public: + + INonCopyable() {} + + private: + + INonCopyable ( const INonCopyable& rCopy ); + INonCopyable& operator= ( const INonCopyable& rCopy ); + +}; // class INonCopyable + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_THREADHELP_INONCOPYABLE_H_ diff --git a/framework/inc/threadhelp/irwlock.h b/framework/inc/threadhelp/irwlock.h new file mode 100644 index 000000000000..e34b310a8fe8 --- /dev/null +++ b/framework/inc/threadhelp/irwlock.h @@ -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_THREADHELP_IRWLOCK_H_ +#define __FRAMEWORK_THREADHELP_IRWLOCK_H_ + +//_________________________________________________________________________________________________________________ +// includes +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ +// declarations +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @descr A guard (specialy a write guard) support different internal working states. + His lock can set for reading or writing/reading! Or he was unlocked by user ... +*//*-*************************************************************************************************************/ +enum ELockMode +{ + E_NOLOCK , + E_READLOCK , + E_WRITELOCK +}; + +/*-************************************************************************************************************//** + @descr We implement two guards for using an rw-lock. But if you wish to implement + different rw-locks to you will have problems by using with same guard implementation! + Thats why we define this "pure virtual base class" ... + All rw-locks must support this base interface for working and all guard must use this one too! +*//*-*************************************************************************************************************/ +class IRWLock +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + public: + + /*-****************************************************************************************************//** + @descr These functions must be supported by a derived class! + acquireReadAccess() -try to register thread as reader + releaseReadAccess() -unregister thread as reader + acquireWriteAccess() -try to register thread as writer + releaseWriteAccess() -unregister thread as writer + downgradeWriteAccess() -make writer to reader + *//*-*****************************************************************************************************/ + virtual void acquireReadAccess () =0; + virtual void releaseReadAccess () =0; + virtual void acquireWriteAccess () =0; + virtual void releaseWriteAccess () =0; + virtual void downgradeWriteAccess () =0; + +}; // class IRWLock + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_THREADHELP_IRWLOCK_H_ diff --git a/framework/inc/threadhelp/itransactionmanager.h b/framework/inc/threadhelp/itransactionmanager.h new file mode 100644 index 000000000000..f0db5a24a113 --- /dev/null +++ b/framework/inc/threadhelp/itransactionmanager.h @@ -0,0 +1,149 @@ +/************************************************************************* + * + * 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_THREADHELP_ITRANSACTIONMANAGER_H_ +#define __FRAMEWORK_THREADHELP_ITRANSACTIONMANAGER_H_ + +//_________________________________________________________________________________________________________________ +// includes +//_________________________________________________________________________________________________________________ + +#include <general.h> +#include <com/sun/star/uno/RuntimeException.hpp> +#include <com/sun/star/lang/DisposedException.hpp> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ +// declarations +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @descr Describe different states of a feature of following implementation. + During live time of an object different working states occure: + initialization - working - closing - closed + If you whish to implement thread safe classes you should use these feature to protect + your code against calls at wrong time. e.g. you are not full initialized but somewhere + call an interface method (initialize phase means startup time from creating object till + calling specified first method e.g. XInitialization::initialze()!) then you should refuse + this call. The same for closing/disposing the object! +*//*-*************************************************************************************************************/ +enum EWorkingMode +{ + E_INIT , // We stand in a init method -> some calls are accepted - some one are rejected + E_WORK , // Object is ready for working -> all calls are accepted + E_BEFORECLOSE, // We stand in a close method -> some calls are accepted - some one are rejected + E_CLOSE // Object is dead! -> all calls are rejected! +}; + +/*-************************************************************************************************************//** + @descr If a request was refused by a transaction manager (internal state different E_WORK ...) + user can check the reason by using this enum values. +*//*-*************************************************************************************************************/ +enum ERejectReason +{ + E_UNINITIALIZED , + E_NOREASON , + E_INCLOSE , + E_CLOSED +}; + +/*-************************************************************************************************************//** + @descr A transaction object should support throwing exceptions if user used it at wrong working mode. + e.g. We can throw a DisposedException if user try to work and our mode is E_CLOSE! + But sometimes he dont need this feature - will handle it by himself. + Then we must differ between some exception-modi: + E_NOEXCEPTIONS We never throw any exceptions! User handle it private and looks for ERejectReason. + E_HARDEXCEPTIONS We throw exceptions for all working modes different from E_WORK! + E_SOFTEXCEPTIONS We throw exceptions for all working modes different from E_WORK AND E_INCLOSE! + This mode is useful for impl-methods which should be callable from dispose() method! + + e.g. void dispose() + { + m_aTransactionManager.setWorkingMode( E_BEFORECLOSE ); + ... + impl_setA( 0 ); + ... + m_aTransactionManager.setWorkingMode( E_CLOSE ); + } + + void impl_setA( int nA ) + { + ERejectReason EReason; + TransactionGuard aTransactionGuard( m_aTransactionManager, E_SOFTEXCEPTIONS, eReason ); + + m_nA = nA; + } + + Normaly (if E_HARDEXCEPTIONS was used!) creation of guard + will throw an exception ... but using of E_SOFTEXCEPTIONS suppress it + and member "A" can be set. +*//*-*************************************************************************************************************/ +enum EExceptionMode +{ + E_NOEXCEPTIONS , + E_HARDEXCEPTIONS, + E_SOFTEXCEPTIONS +}; + +/*-************************************************************************************************************//** + @descr How can you use the transaction manager? + Use it in combination with an TransactionGuard, which register your transaction in ctor + and release in dtor automaticly! Follow interface class can be used to make using + of different manager implmentations possible by using same guard. +*//*-*************************************************************************************************************/ +class ITransactionManager +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + public: + + /*-****************************************************************************************************//** + @descr These functions must be supported by a derived class! + getWorkingMode() -return current set working mode + setWorkingMode() -change working mode + (This will block till all current transactions are finished!) + isCallRejected() -test method to check if a call will be rejected by wrong working mode or not + registerTransaction() -start new transaction (increase internal transaction count) + unregisterTransaction() -finish transaction (decrease internal transaction count) + *//*-*****************************************************************************************************/ + virtual EWorkingMode getWorkingMode ( ) const = 0; + virtual void setWorkingMode ( EWorkingMode eMode ) = 0; + virtual sal_Bool isCallRejected ( ERejectReason& eReason ) const = 0; + virtual void registerTransaction ( EExceptionMode eMode , ERejectReason& eReason ) throw( css::uno::RuntimeException, css::lang::DisposedException ) = 0; + virtual void unregisterTransaction ( ) throw( css::uno::RuntimeException, css::lang::DisposedException ) = 0; + +}; // class ITransactionManager + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_THREADHELP_ITRANSACTIONMANAGER_H_ diff --git a/framework/inc/threadhelp/lockhelper.hxx b/framework/inc/threadhelp/lockhelper.hxx new file mode 100644 index 000000000000..0210ad975c29 --- /dev/null +++ b/framework/inc/threadhelp/lockhelper.hxx @@ -0,0 +1,180 @@ +/************************************************************************* + * + * 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_THREADHELP_LOCKHELPER_HXX_ +#define __FRAMEWORK_THREADHELP_LOCKHELPER_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <threadhelp/inoncopyable.h> +#include <framework/imutex.hxx> +#include <threadhelp/irwlock.h> +#include <threadhelp/fairrwlock.hxx> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <osl/mutex.hxx> +#include <vos/mutex.hxx> +#include <fwidllapi.h> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ +// const +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @descr If you use a lock or mutex as a member of your class and whish to use it earlier then other ones + you should have a look on this implementation. You must use it as the first base class + of your implementation - because base classes are initialized by his order and before your + member! Thats why ist a good place to declare your thread help member so. +*//*-*************************************************************************************************************/ +enum ELockType +{ + E_NOTHING = 0 , + E_OWNMUTEX = 1 , + E_SOLARMUTEX = 2 , + E_FAIRRWLOCK = 3 +}; + +#define ENVVAR_LOCKTYPE DECLARE_ASCII("LOCKTYPE_FRAMEWORK") +#define FALLBACK_LOCKTYPE E_SOLARMUTEX + +//_________________________________________________________________________________________________________________ +// declarations +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short helper to set right lock in right situation + @descr This helper support different types of locking: + a) no locks - transparent for user! + This could be usefull for simluation or single threaded environments! + b) own mutex + An object use his own osl-mutex to be threadsafe. Usefull for easy and exclusiv locking. + c) solar mutex + An object use our solar mutex and will be a part of a greater safed "threadsafe code block". + Could be usefull for simulation and testing of higher modules! + d) fair rw-lock + An object use an implementation of a fair rw-lock. This increase granularity of t hreadsafe mechanism + and should be used for high performance threadsafe code! + + @attention We support two interfaces - "IMutex" and "IRWLock". Don't mix using of it! + A guard implementation should use one interface only! + + @implements IMutex + @implements IRWLock + + @base INonCopyable + IMutex + IRWLock + + @devstatus draft +*//*-*************************************************************************************************************/ +class FWI_DLLPUBLIC LockHelper : public IMutex + , public IRWLock + , private INonCopyable +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + public: + + //------------------------------------------------------------------------------------------------------------- + // ctor/dtor + //------------------------------------------------------------------------------------------------------------- + LockHelper( ::vos::IMutex* pSolarMutex = NULL ); + virtual ~LockHelper( ); + + //------------------------------------------------------------------------------------------------------------- + // interface ::framework::IMutex + //------------------------------------------------------------------------------------------------------------- + virtual void acquire(); + virtual void release(); + + //------------------------------------------------------------------------------------------------------------- + // interface ::framework::IRWLock + //------------------------------------------------------------------------------------------------------------- + virtual void acquireReadAccess (); + virtual void releaseReadAccess (); + virtual void acquireWriteAccess (); + virtual void releaseWriteAccess (); + virtual void downgradeWriteAccess(); + + //------------------------------------------------------------------------------------------------------------- + // something else + //------------------------------------------------------------------------------------------------------------- + static LockHelper& getGlobalLock ( ::vos::IMutex* pSolarMutex = NULL ); + ::osl::Mutex& getShareableOslMutex( ); + + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + private: + + static ELockType& implts_getLockType(); + + //------------------------------------------------------------------------------------------------------------- + // private member + // a) Make some member mutable for using in const functions! + // b) "m_eLockType" define, which of follow members is used! + // You can use "m_pFairRWLock" as a fair rw-lock (multiple reader / one writer / looks for incoming order of threads too) ... + // or you can use a normal osl mutex ("m_pOwnMutex") ... + // ... or the solarmuex as "m_pSolarMutex" (must be set from outside! because some components must be vcl-free!) + // ... but sometimes you need a shareable osl mutex! + // In this case you has some problems: i ) If your lock type is set to E_OWNMUTEX => it's easy; you can use your member "m_pOwnMutex" - it's a osl mutex. + // Creation and using of "m_pShareableOslMutex" isn't neccessary! + // ii ) Otherwise you have no osl mutex ... so you must create "m_pShareableOslMutex" and use it twice! + // In this case you must lock two member everytime - "m_pShareableMutex" AND "m_pFairRWLock" or "m_pSolarMutex" or ... + // It isn't realy fine - but the only possible way. + // iii) There exist another special case - E_NOTHING is set! Then we should create this shareable mutex ... + // nad you can use it ... but this implmentation ignore it. + //------------------------------------------------------------------------------------------------------------- + private: + + ELockType m_eLockType ; + + mutable FairRWLock* m_pFairRWLock ; + mutable ::osl::Mutex* m_pOwnMutex ; + mutable ::vos::IMutex* m_pSolarMutex ; + mutable ::osl::Mutex* m_pShareableOslMutex ; + mutable sal_Bool m_bDummySolarMutex ; +}; + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_THREADHELP_LOCKHELPER_HXX_ diff --git a/framework/inc/threadhelp/readguard.hxx b/framework/inc/threadhelp/readguard.hxx new file mode 100644 index 000000000000..997042c9e601 --- /dev/null +++ b/framework/inc/threadhelp/readguard.hxx @@ -0,0 +1,204 @@ +/************************************************************************* + * + * 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_THREADHELP_READGUARD_HXX_ +#define __FRAMEWORK_THREADHELP_READGUARD_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <threadhelp/inoncopyable.h> +#include <threadhelp/irwlock.h> + +//#ifndef __FRAMEWORK_THREADHELP_THREADHELPBASE_HXX_ +//#include <threadhelp/threadhelpbase.hxx> +//#endif + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <sal/types.h> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ +// const +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// declarations +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short implement a guard to set read locks + @descr This guard should be used to set a lock for reading object internal member. + Nobody can control it but don't use member after successfuly locking for writing! + We never need a own mutex to safe our internal member access - because + a guard is used as function-local member only. There exist no multithreaded access to it realy ... + + @attention a) To prevent us against wrong using, the default ctor, copy ctor and the =operator are maked private! + b) Use interface "IRWLock" of set LockHelper only - because we must support a finer granularity of locking. + Interface "IMutex" should be used by easier guard implementations ... like "ResetableGuard"! + + @implements - + @base INonCopyable + + @devstatus ready to use +*//*-*************************************************************************************************************/ +class ReadGuard : private INonCopyable +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + public: + + /*-****************************************************************************************************//** + @short ctor + @descr These ctors initialize the guard with a reference to used lock member of object to protect. + Null isn't allowed as value! + + @seealso - + + @param "pLock" ,reference to used lock member of object to protect + @param "rLock" ,reference to used lock member of object to protect + @return - + + @onerror - + *//*-*****************************************************************************************************/ + inline ReadGuard( IRWLock* pLock ) + : m_pLock ( pLock ) + , m_bLocked ( sal_False ) + { + lock(); + } + + //********************************************************************************************************* + inline ReadGuard( IRWLock& rLock ) + : m_pLock ( &rLock ) + , m_bLocked ( sal_False ) + { + lock(); + } + + /*-****************************************************************************************************//** + @short dtor + @descr We unlock the used lock member automaticly if user forget it. + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + inline ~ReadGuard() + { + unlock(); + } + + /*-****************************************************************************************************//** + @short set read lock + @descr Call this method to set the read lock. The call will block till all current threads are synchronized! + + @seealso method unlock() + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + inline void lock() + { + if( m_bLocked == sal_False ) + { + m_pLock->acquireReadAccess(); + m_bLocked = sal_True; + } + } + + /*-****************************************************************************************************//** + @short unset read lock + @descr Call this method to unlock the rw-lock temp.! + Normaly we do it at dtor automaticly for you ... + + @seealso method lock() + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + inline void unlock() + { + if( m_bLocked == sal_True ) + { + m_pLock->releaseReadAccess(); + m_bLocked = sal_False; + } + } + + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + private: + + /*-****************************************************************************************************//** + @short disable using of these functions! + @descr It's not allowed to use this methods. Different problem can occure otherwise. + Thats why we disable it by make it private. + + @seealso other ctor + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + ReadGuard(); + + //------------------------------------------------------------------------------------------------------------- + // private member + //------------------------------------------------------------------------------------------------------------- + private: + + IRWLock* m_pLock ; /// reference to lock-member of protected object + sal_Bool m_bLocked ; /// protection against multiple lock calls without unlock! + +}; // class ReadGuard + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_THREADHELP_READGUARD_HXX_ diff --git a/framework/inc/threadhelp/resetableguard.hxx b/framework/inc/threadhelp/resetableguard.hxx new file mode 100644 index 000000000000..3b88294a80e3 --- /dev/null +++ b/framework/inc/threadhelp/resetableguard.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_THREADHELP_RESETABLEGUARD_HXX_ +#define __FRAMEWORK_THREADHELP_RESETABLEGUARD_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <threadhelp/inoncopyable.h> +#include <framework/imutex.hxx> + +//#ifndef __FRAMEWORK_THREADHELP_THREADHELPBASE_HXX_ +//#include <threadhelp/threadhelpbase.hxx> +//#endif + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <sal/types.h> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ +// const +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// declarations +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short implement a guard for implementing save thread access + @descr These guard has an additional feature to well known one ::osl::Guard. + You can lock() and unlock() it very often! + A set bool flag inside protect this implementation against multiple lock() calls + without any unlock()! So the increasing of guarded mutex couldn't be greater then 1 ... + + @attention a) To prevent us against wrong using, the default ctor, copy ctor and the =operator are maked private! + b) Use interface "IMutex" of set LockHelper only - because we must support an exclusiv locking. + Interface "IRWLock" should be used by special guard implementations ... like "ReadGuard" or "WriteGuard"! + + @implements - + @base INonCopyable + + @devstatus ready to use +*//*-*************************************************************************************************************/ +class ResetableGuard : private INonCopyable +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + public: + + /*-****************************************************************************************************//** + @short ctors + @descr Use these ctor methods to initialize the guard right. + Given lock reference must be valid - otherwise crashes could occure! + + @seealso - + + @param "pLock", pointer to lock helper of user + @param "rLock", reference to lock helper of user + @return - + + @onerror - + *//*-*****************************************************************************************************/ + inline ResetableGuard( IMutex* pLock ) + : m_pLock ( pLock ) + , m_bLocked ( sal_False ) + { + lock(); + } + + //********************************************************************************************************* + inline ResetableGuard( IMutex& rLock ) + : m_pLock ( &rLock ) + , m_bLocked ( sal_False ) + { + lock(); + } + + /*-****************************************************************************************************//** + @short dtor + @descr We must release set mutex if programmer forget it ... + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + inline ~ResetableGuard() + { + unlock(); + } + + /*-****************************************************************************************************//** + @short enable/disable the lock + @descr Use this methods to lock or unlock the mutex. + You can do it so often you wish to do that ... + + @attention We use another member to prevent us against multiple acquire calls of the same guard + without suitable release calls! + You don't must protect access at these bool member by using an own mutex .... + because nobody use the same guard instance from different threads! + It will be a function-local object every time. + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + inline void lock() + { + if( m_bLocked == sal_False ) + { + m_pLock->acquire(); + m_bLocked = sal_True; + } + } + + //********************************************************************************************************* + inline void unlock() + { + if( m_bLocked == sal_True ) + { + m_pLock->release(); + m_bLocked = sal_False; + } + } + + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + private: + + /*-****************************************************************************************************//** + @short disable using of these functions! + @descr It's not allowed to use this methods. Different problem can occure otherwise. + Thats why we disable it by make it private. + + @seealso other ctor + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + ResetableGuard(); + + //------------------------------------------------------------------------------------------------------------- + // private member + //------------------------------------------------------------------------------------------------------------- + private: + + IMutex* m_pLock ; /// pointer to safed lock member of user + sal_Bool m_bLocked ; /// protection against multiple lock() calls without unlock() + +}; // class ResetableGuard + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_THREADHELP_RESETABLEGUARD_HXX_ diff --git a/framework/inc/threadhelp/threadhelpbase.hxx b/framework/inc/threadhelp/threadhelpbase.hxx new file mode 100644 index 000000000000..499d6324d6ca --- /dev/null +++ b/framework/inc/threadhelp/threadhelpbase.hxx @@ -0,0 +1,96 @@ +/************************************************************************* + * + * 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_THREADHELP_THREADHELPBASE_HXX_ +#define __FRAMEWORK_THREADHELP_THREADHELPBASE_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <threadhelp/lockhelper.hxx> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ +// const +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// declarations +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short "baseclass" to make own classes threadsafe + @descr Sometimes you must share your lock- or mutex member with any other baseclasses. + And baseclasses are initialized erlier then members! That's why you should use + this struct as first of your baseclasses!!! + Then you will get a public member "m_aLock" which can be used by special guard implementations + to make your code threadsafe. + + @seealso class LockHelper + + @implements - + @base - + + @devstatus ready to use +*//*-*************************************************************************************************************/ +struct ThreadHelpBase +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + public: + ThreadHelpBase( ::vos::IMutex* pSolarMutex = NULL ) + : m_aLock( pSolarMutex ) + { + } + + //------------------------------------------------------------------------------------------------------------- + // public member + // Make it mutable for using in const functions! + //------------------------------------------------------------------------------------------------------------- + public: + + mutable LockHelper m_aLock; +}; + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_THREADHELP_THREADHELPBASE_HXX_ diff --git a/framework/inc/threadhelp/transactionbase.hxx b/framework/inc/threadhelp/transactionbase.hxx new file mode 100644 index 000000000000..7cb0eba2eb61 --- /dev/null +++ b/framework/inc/threadhelp/transactionbase.hxx @@ -0,0 +1,85 @@ +/************************************************************************* + * + * 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_THREADHELP_TRANSACTIONBASE_H_ +#define __FRAMEWORK_THREADHELP_TRANSACTIONBASE_H_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <threadhelp/transactionmanager.hxx> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ +// const +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// declarations +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short make it possible to instanciate a transacion manager as first member! + @descr If you use a transaction manager as a member of your class and whish to use it earlier then other ones + you should have a look on this implementation. You must use it as the first base class + of your implementation - because base classes are initialized by his order and before your + member! Thats why ist a good place to declare this member. + + @implements - + @base - + + @devstatus ready to use +*//*-*************************************************************************************************************/ +struct TransactionBase +{ + //------------------------------------------------------------------------------------------------------------- + // public member + //------------------------------------------------------------------------------------------------------------- + public: + + mutable TransactionManager m_aTransactionManager ; /// "your" public manager-member! + /// Make it mutable for using in const functions! + +}; // struct TransactionBase + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_THREADHELP_TRANSACTIONBASE_H_ diff --git a/framework/inc/threadhelp/transactionguard.hxx b/framework/inc/threadhelp/transactionguard.hxx new file mode 100644 index 000000000000..e116cf8a2185 --- /dev/null +++ b/framework/inc/threadhelp/transactionguard.hxx @@ -0,0 +1,188 @@ +/************************************************************************* + * + * 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_THREADHELP_TRANSACTIONGUARD_HXX_ +#define __FRAMEWORK_THREADHELP_TRANSACTIONGUARD_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <threadhelp/inoncopyable.h> +#include <threadhelp/itransactionmanager.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ +// const +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// declarations +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short implement a guard to support non breakable transactions + @descr If you whish to support non breakable method calls without lockingf any mutex, rw-lock or + something like that - you should use this guard implementation. + Initialize it at first in your method and don't release it till end of your function! + Your "transaction" is registered in ctor and automaticly released in dtor. + Use set/get of working mode to enable/disable further transactions. + It's possible too, to enable automaticly throwing of some exceptions for illegal + transaction requests ... e.g. interface call for already disposed objects. + + @attention To prevent us against wrong using, the default ctor, copy ctor and the =operator are maked private! + + @implements - + @base INonCopyable + + @devstatus draft +*//*-*************************************************************************************************************/ +class TransactionGuard : private INonCopyable +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + public: + + /*-****************************************************************************************************//** + @short ctors + @descr Use these ctor methods to initialize the guard right. + Given reference must be valid - otherwise crashes could occure! + + @attention It's not neccessary to lock any mutex here! Because a ctor should not be called + from different threads at the same time ... this class use no refcount mechanism! + + @seealso - + + @param "rManager" reference to transaction manager for using to register a request + @param "eMode" enable/disable throwing of exceptions for rejected calls + @param "eReason" returns reason for rejected calls if "eMode=E_NOEXCEPTIONS"! + @return - + + @onerror - + *//*-*****************************************************************************************************/ + inline TransactionGuard( ITransactionManager& rManager, EExceptionMode eMode, ERejectReason* eReason = NULL ) + : m_pManager( &rManager ) + { + // If exception mode is set to E_HARDEXCETIONS we don't need a buffer to return reason! + // We handle it private. If a call is rejected, our manager throw some exceptions ... and the reason + // could be ignorable ... + if( eReason == NULL ) + { + ERejectReason eMyReason; + m_pManager->registerTransaction( eMode, eMyReason ); + } + else + { + m_pManager->registerTransaction( eMode, *eReason ); + } + } + + /*-************************************************************************************************************//** + @short dtor + @descr We must release the transaction manager and can forget his pointer. + + @seealso - + + @param - + @return - + + @onerror - + *//*-*************************************************************************************************************/ + inline ~TransactionGuard() + { + stop(); + } + + /*-************************************************************************************************************//** + @short stop current transaction + @descr We must release the transaction manager and can forget his pointer. + + @attention We don't support any start() method here - because it is not easy to + detect if a transaction already started or not! + (combination of EExceptionMode and ERejectReason) + + @seealso - + + @param - + @return - + + @onerror - + *//*-*************************************************************************************************************/ + inline void stop() + { + if( m_pManager != NULL ) + { + m_pManager->unregisterTransaction(); + m_pManager = NULL; + } + } + + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + private: + + /*-****************************************************************************************************//** + @short disable using of these functions! + @descr It's not allowed to use this methods. Different problem can occure otherwise. + Thats why we disable it by make it private. + + @seealso other ctor + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + TransactionGuard(); + + //------------------------------------------------------------------------------------------------------------- + // private member + //------------------------------------------------------------------------------------------------------------- + private: + + ITransactionManager* m_pManager ; /// pointer to safed transaction manager + +}; // class TransactionGuard + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_THREADHELP_TRANSACTIONGUARD_HXX_ diff --git a/framework/inc/threadhelp/transactionmanager.hxx b/framework/inc/threadhelp/transactionmanager.hxx new file mode 100644 index 000000000000..a9608de0164d --- /dev/null +++ b/framework/inc/threadhelp/transactionmanager.hxx @@ -0,0 +1,119 @@ +/************************************************************************* + * + * 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_THREADHELP_TRANSACTIONMANAGER_HXX_ +#define __FRAMEWORK_THREADHELP_TRANSACTIONMANAGER_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <threadhelp/inoncopyable.h> +#include <threadhelp/itransactionmanager.h> +#include <threadhelp/gate.hxx> +#include <macros/debug.hxx> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/uno/XInterface.hpp> +#include <com/sun/star/uno/RuntimeException.hpp> +#include <com/sun/star/lang/DisposedException.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <osl/mutex.hxx> +#include <fwidllapi.h> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ +// const +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// declarations +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short implement a transaction manager to support non breakable interface methods + @descr Use it to support non breakable interface methods without using any thread + synchronization like e.g. mutex, rw-lock! + That protect your code against wrong calls at wrong time ... e.g. calls after disposing an object! + Use combination of EExceptionMode and ERejectReason to detect rejected requests + and react for it. You can enable automaticly throwing of exceptions too. + + @implements ITransactionManager + @base INonCopyable + ITransactionManager + + @devstatus draft +*//*-*************************************************************************************************************/ +class FWI_DLLPUBLIC TransactionManager : public ITransactionManager + , private INonCopyable +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + public: + + TransactionManager ( ); + virtual ~TransactionManager ( ); + virtual void setWorkingMode ( EWorkingMode eMode ); + virtual EWorkingMode getWorkingMode ( ) const; + virtual sal_Bool isCallRejected ( ERejectReason& eReason ) const; + virtual void registerTransaction ( EExceptionMode eMode, ERejectReason& eReason ) throw( css::uno::RuntimeException, css::lang::DisposedException ); + virtual void unregisterTransaction ( ) throw( css::uno::RuntimeException, css::lang::DisposedException ); + + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + private: + + void impl_throwExceptions( EExceptionMode eMode, ERejectReason eReason ) const throw( css::uno::RuntimeException, css::lang::DisposedException ); + + //------------------------------------------------------------------------------------------------------------- + // private member + //------------------------------------------------------------------------------------------------------------- + private: + + mutable ::osl::Mutex m_aAccessLock ; /// regulate access on internal member of this instance + Gate m_aBarrier ; /// used to block transactions requests during change or work mode + EWorkingMode m_eWorkingMode ; /// current working mode of object which use this manager (used to reject calls at wrong time) + sal_Int32 m_nTransactionCount ; /// every transaction request is registered by this counter + +}; // class TransactionManager + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_THREADHELP_TRANSACTIONMANAGER_HXX_ diff --git a/framework/inc/threadhelp/writeguard.hxx b/framework/inc/threadhelp/writeguard.hxx new file mode 100644 index 000000000000..07dbdf6fe466 --- /dev/null +++ b/framework/inc/threadhelp/writeguard.hxx @@ -0,0 +1,264 @@ +/************************************************************************* + * + * 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_THREADHELP_WRITEGUARD_HXX_ +#define __FRAMEWORK_THREADHELP_WRITEGUARD_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <threadhelp/inoncopyable.h> +#include <threadhelp/irwlock.h> + +//#ifndef __FRAMEWORK_THREADHELP_THREADHELPBASE_HXX_ +//#include <threadhelp/threadhelpbase.hxx> +//#endif + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ +// const +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// declarations +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short implement a guard to set write locks + @descr This guard should be used to set a lock for reading AND writing object internal member. + We never need a own mutex to safe our internal member access - because + a guard is used as function-local member only. There exist no multithreaded access to it realy ... + + @attention a) To prevent us against wrong using, the default ctor, copy ctor and the =operator are maked private! + b) Use interface "IRWLock" of set LockHelper only - because we must support a finer granularity of locking. + Interface "IMutex" should be used by easier guard implementations ... like "ResetableGuard"! + + @implements - + @base INonCopyable + + @devstatus ready to use +*//*-*************************************************************************************************************/ +class WriteGuard : private INonCopyable +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + public: + + /*-****************************************************************************************************//** + @short ctor + @descr These ctors initialize the guard with a reference to used lock member of object to protect. + Null isn't allowed as value! + + @seealso - + + @param "pLock" ,reference to used lock member of object to protect + @param "rLock" ,reference to used lock member of object to protect + @return - + + @onerror - + *//*-*****************************************************************************************************/ + inline WriteGuard( IRWLock* pLock ) + : m_pLock ( pLock ) + , m_eMode ( E_NOLOCK ) + { + lock(); + } + + //********************************************************************************************************* + inline WriteGuard( IRWLock& rLock ) + : m_pLock ( &rLock ) + , m_eMode ( E_NOLOCK ) + { + lock(); + } + + /*-****************************************************************************************************//** + @short dtor + @descr We unlock the used lock member automaticly if user forget it. + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + inline ~WriteGuard() + { + unlock(); + } + + /*-****************************************************************************************************//** + @short set write lock + @descr Call this method to set the write lock. The call will block till all current threads are synchronized! + + @seealso method unlock() + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + inline void lock() + { + switch( m_eMode ) + { + case E_NOLOCK : { + // Acquire write access and set return state. + // Mode is set later if it was successful! + m_pLock->acquireWriteAccess(); + m_eMode = E_WRITELOCK; + } + break; + case E_READLOCK : { + // User has downgrade to read access before! + // We must release it before we can set a new write access! + m_pLock->releaseReadAccess(); + m_pLock->acquireWriteAccess(); + m_eMode = E_WRITELOCK; + } + break; + default: break; // nothing to do + } + } + + /*-****************************************************************************************************//** + @short unset write lock + @descr Call this method to unlock the rw-lock temp.! + Normaly we do it at dtor automaticly for you ... + + @seealso method lock() + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + inline void unlock() + { + switch( m_eMode ) + { + case E_READLOCK : { + // User has downgraded to a read lock before! + // => There isn't realy a write lock ... + m_pLock->releaseReadAccess(); + m_eMode = E_NOLOCK; + } + break; + case E_WRITELOCK : { + m_pLock->releaseWriteAccess(); + m_eMode = E_NOLOCK; + } + break; + default: break; // nothing to do + } + } + + /*-****************************************************************************************************//** + @short downgrade write access to read access without new blocking! + @descr If this write lock is set you can change it to a "read lock". + An "upgrade" is the same like new calling "lock()"! + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + inline void downgrade() + { + if( m_eMode == E_WRITELOCK ) + { + m_pLock->downgradeWriteAccess(); + m_eMode = E_READLOCK; + } + } + + /*-****************************************************************************************************//** + @short return internal states + @descr For user they dont know what they are doing ... + + @seealso - + + @param - + @return Current set lock mode. + + @onerror No error should occure. + *//*-*****************************************************************************************************/ + inline ELockMode getMode() const + { + return m_eMode; + } + + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + private: + + /*-****************************************************************************************************//** + @short disable using of these functions! + @descr It's not allowed to use this methods. Different problem can occure otherwise. + Thats why we disable it by make it private. + + @seealso other ctor + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + WriteGuard(); + + //------------------------------------------------------------------------------------------------------------- + // private member + //------------------------------------------------------------------------------------------------------------- + private: + + IRWLock* m_pLock ; /// reference to lock-member of protected object + ELockMode m_eMode ; /// protection against multiple lock calls without unlock and difference between supported lock modi + +}; // class WriteGuard + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_THREADHELP_WRITEGUARD_HXX_ diff --git a/framework/inc/uiconfiguration/globalsettings.hxx b/framework/inc/uiconfiguration/globalsettings.hxx new file mode 100644 index 000000000000..b1b83de369a0 --- /dev/null +++ b/framework/inc/uiconfiguration/globalsettings.hxx @@ -0,0 +1,97 @@ +/************************************************************************* + * + * 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_UICONFIGURATION_GLOBALSETTINGS_HXX_ +#define __FRAMEWORK_UICONFIGURATION_GLOBALSETTINGS_HXX_ + +/** Attention: stl headers must(!) be included at first. Otherwhise it can make trouble + with solaris headers ... +*/ +#include <vector> +#include <list> +#include <hash_map> + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ +#include <threadhelp/threadhelpbase.hxx> +#include <macros/generic.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> +#include <stdtypes.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/container/XNameAccess.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <cppuhelper/weak.hxx> +#include <rtl/ustring.hxx> + +namespace framework +{ + +class GlobalSettings +{ + public: + GlobalSettings( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rSrvMgr ); + ~GlobalSettings(); + + enum UIElementType + { + UIELEMENT_TYPE_TOOLBAR, + UIELEMENT_TYPE_DOCKWINDOW, + UIELEMENT_TYPE_STATUSBAR + }; + + enum StateInfo + { + STATEINFO_LOCKED, + STATEINFO_DOCKED + }; + + // settings access + sal_Bool HasStatesInfo( UIElementType eElementType ); + sal_Bool GetStateInfo( UIElementType eElementType, StateInfo eStateInfo, ::com::sun::star::uno::Any& aValue ); + + private: + GlobalSettings(); + GlobalSettings(const GlobalSettings&); + GlobalSettings& operator=(const GlobalSettings& ); + + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xSrvMgr; +}; + +} // namespace framework + +#endif // __FRAMEWORK_UIELEMENT_WINDOWSTATECONFIGURATION_HXX_ diff --git a/framework/inc/uiconfiguration/graphicnameaccess.hxx b/framework/inc/uiconfiguration/graphicnameaccess.hxx new file mode 100644 index 000000000000..1526f57fc4c5 --- /dev/null +++ b/framework/inc/uiconfiguration/graphicnameaccess.hxx @@ -0,0 +1,74 @@ +/************************************************************************* + * + * 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_UICONFIGURATION_GRAPHICNAMEACCESS_HXX_ +#define __FRAMEWORK_UICONFIGURATION_GRAPHICNAMEACCESS_HXX_ + +#include <stdtypes.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/container/XNameContainer.hpp> +#ifndef _COM_SUN_STAR_GRAPHIC_XGRAPHIC_HXX_ +#include <com/sun/star/graphic/XGraphic.hpp> +#endif +#include <cppuhelper/implbase1.hxx> + +namespace framework +{ + class GraphicNameAccess : public ::cppu::WeakImplHelper1< ::com::sun::star::container::XNameAccess > + { + public: + GraphicNameAccess(); + virtual ~GraphicNameAccess(); + + void addElement( const rtl::OUString& rName, const ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >& rElement ); + + // XNameAccess + virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) + throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) + throw(::com::sun::star::uno::RuntimeException); + + // XElementAccess + virtual sal_Bool SAL_CALL hasElements() + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) + throw(::com::sun::star::uno::RuntimeException); + + private: + typedef BaseHash< ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > > NameGraphicHashMap; + NameGraphicHashMap m_aNameToElementMap; + ::com::sun::star::uno::Sequence< rtl::OUString > m_aSeq; + }; +} + +#endif // __FRAMEWORK_UICONFIGURATION_GRAPHICNAMEACCESS_HXX_ diff --git a/framework/inc/uiconfiguration/imagemanager.hxx b/framework/inc/uiconfiguration/imagemanager.hxx new file mode 100644 index 000000000000..f30cb70e8387 --- /dev/null +++ b/framework/inc/uiconfiguration/imagemanager.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_UICONFIGURATION_IMAGEMANAGER_HXX_ +#define __FRAMEWORK_UICONFIGURATION_IMAGEMANAGER_HXX_ + + +/** Attention: stl headers must(!) be included at first. Otherwhise it can make trouble + with solaris headers ... +*/ +#include <vector> +#include <list> +#include <hash_map> +#include <memory> + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ +#include <threadhelp/threadhelpbase.hxx> +#include <macros/generic.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> +#include <stdtypes.h> +#include <uiconfiguration/imagetype.hxx> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/ui/XUIConfigurationPersistence.hpp> +#include <com/sun/star/ui/XUIConfigurationStorage.hpp> +#include <com/sun/star/ui/XUIConfiguration.hpp> +#include <com/sun/star/ui/XImageManager.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/ui/ConfigurationEvent.hpp> +#include <com/sun/star/embed/XTransactedObject.hpp> +#include <com/sun/star/ui/XImageManager.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <cppuhelper/implbase2.hxx> +#include <cppuhelper/interfacecontainer.hxx> +#include <rtl/ustring.hxx> + +#include <vcl/image.hxx> +#include <tools/color.hxx> +#include <rtl/ref.hxx> + +#include <vector> + +namespace framework +{ + class ImageManagerImpl; + class ImageManager : private ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses. + public ::cppu::WeakImplHelper2< ::com::sun::star::ui::XImageManager, css::lang::XServiceInfo> + { + public: + // XInterface, XTypeProvider, XServiceInfo + DECLARE_XSERVICEINFO + + ImageManager( com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > xServiceManager ); + virtual ~ImageManager(); + + // XComponent + virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException); + + // XInitialization + virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + + // XImageManager + virtual void SAL_CALL reset() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getAllImageNames( ::sal_Int16 nImageType ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL hasImage( ::sal_Int16 nImageType, const ::rtl::OUString& aCommandURL ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > > SAL_CALL getImages( ::sal_Int16 nImageType, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aCommandURLSequence ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL replaceImages( ::sal_Int16 nImageType, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aCommandURLSequence, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > >& aGraphicsSequence ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IllegalAccessException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeImages( ::sal_Int16 nImageType, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aResourceURLSequence ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IllegalAccessException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL insertImages( ::sal_Int16 nImageType, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aCommandURLSequence, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > >& aGraphicSequence ) throw (::com::sun::star::container::ElementExistException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IllegalAccessException, ::com::sun::star::uno::RuntimeException); + + // XUIConfiguration + virtual void SAL_CALL addConfigurationListener( const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIConfigurationListener >& Listener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeConfigurationListener( const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIConfigurationListener >& Listener ) throw (::com::sun::star::uno::RuntimeException); + + // XUIConfigurationPersistence + virtual void SAL_CALL reload() throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL store() throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL storeToStorage( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& Storage ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isModified() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isReadOnly() throw (::com::sun::star::uno::RuntimeException); + + // Non-UNO methods + void setStorage( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& Storage ) throw (::com::sun::star::uno::RuntimeException); + + private: + ::std::auto_ptr<ImageManagerImpl> m_pImpl; + }; +} + +#endif // __FRAMEWORK_UICONFIGURATION_IMAGEMANAGER_HXX_ diff --git a/framework/inc/uiconfiguration/imagetype.hxx b/framework/inc/uiconfiguration/imagetype.hxx new file mode 100644 index 000000000000..d96ec77c374e --- /dev/null +++ b/framework/inc/uiconfiguration/imagetype.hxx @@ -0,0 +1,57 @@ +/************************************************************************* + * + * 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_UICONFIGURATION_IMAGETYPE_HXX_ +#define __FRAMEWORK_UICONFIGURATION_IMAGETYPE_HXX_ + +#include <hash_map> +#include <rtl/ustring.hxx> + +namespace framework +{ + +enum ImageType +{ + ImageType_Color = 0, + ImageType_Color_Large, + ImageType_HC, + ImageType_HC_Large, + ImageType_COUNT +}; + +typedef std::hash_map< rtl::OUString, + rtl::OUString, + OUStringHashCode, + ::std::equal_to< ::rtl::OUString > > CommandToImageNameMap; +typedef std::hash_map< rtl::OUString, + bool, + OUStringHashCode, + ::std::equal_to< ::rtl::OUString > > CommandMap; + +} + +#endif // __FRAMEWORK_UICONFIGURATION_IMAGETYPE_HXX_ diff --git a/framework/inc/uiconfiguration/moduleimagemanager.hxx b/framework/inc/uiconfiguration/moduleimagemanager.hxx new file mode 100644 index 000000000000..f9d18670ddce --- /dev/null +++ b/framework/inc/uiconfiguration/moduleimagemanager.hxx @@ -0,0 +1,123 @@ +/************************************************************************* + * + * 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_UICONFIGURATION_MODULEIMAGEMANAGER_HXX_ +#define __FRAMEWORK_UICONFIGURATION_MODULEIMAGEMANAGER_HXX_ + + +/** Attention: stl headers must(!) be included at first. Otherwhise it can make trouble + with solaris headers ... +*/ +#include <vector> +#include <list> +#include <hash_map> +#include <memory> + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ +#include <threadhelp/threadhelpbase.hxx> +#include <macros/generic.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> +#include <stdtypes.h> +#include <uiconfiguration/imagetype.hxx> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/ui/XUIConfigurationPersistence.hpp> +#include <com/sun/star/ui/XUIConfigurationStorage.hpp> +#include <com/sun/star/ui/XUIConfiguration.hpp> +#include <com/sun/star/ui/XImageManager.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/ui/ConfigurationEvent.hpp> +#include <com/sun/star/embed/XTransactedObject.hpp> +#include <com/sun/star/ui/XImageManager.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <cppuhelper/implbase1.hxx> +#include <cppuhelper/interfacecontainer.hxx> +#include <rtl/ustring.hxx> + +#include <vcl/image.hxx> +#include <tools/color.hxx> +#include <rtl/ref.hxx> + +#include <vector> + +namespace framework +{ + class ImageManagerImpl; + + class ModuleImageManager : private ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses. + public ::cppu::WeakImplHelper1< ::com::sun::star::ui::XImageManager> + { + public: + ModuleImageManager( com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > xServiceManager ); + virtual ~ModuleImageManager(); + + // XComponent + virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException); + + // XInitialization + virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + + // XImageManager + virtual void SAL_CALL reset() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getAllImageNames( ::sal_Int16 nImageType ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL hasImage( ::sal_Int16 nImageType, const ::rtl::OUString& aCommandURL ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > > SAL_CALL getImages( ::sal_Int16 nImageType, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aCommandURLSequence ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL replaceImages( ::sal_Int16 nImageType, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aCommandURLSequence, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > >& aGraphicsSequence ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IllegalAccessException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeImages( ::sal_Int16 nImageType, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aResourceURLSequence ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IllegalAccessException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL insertImages( ::sal_Int16 nImageType, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aCommandURLSequence, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > >& aGraphicSequence ) throw (::com::sun::star::container::ElementExistException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IllegalAccessException, ::com::sun::star::uno::RuntimeException); + + // XUIConfiguration + virtual void SAL_CALL addConfigurationListener( const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIConfigurationListener >& Listener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeConfigurationListener( const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIConfigurationListener >& Listener ) throw (::com::sun::star::uno::RuntimeException); + + // XUIConfigurationPersistence + virtual void SAL_CALL reload() throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL store() throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL storeToStorage( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& Storage ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isModified() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isReadOnly() throw (::com::sun::star::uno::RuntimeException); + + private: + ::std::auto_ptr<ImageManagerImpl> m_pImpl; + }; +} + +#endif // __FRAMEWORK_UICONFIGURATION_MODULEUICONFIGMANAGER_HXX_ diff --git a/framework/inc/uiconfiguration/moduleuicfgsupplier.hxx b/framework/inc/uiconfiguration/moduleuicfgsupplier.hxx new file mode 100644 index 000000000000..33c4a2737cc6 --- /dev/null +++ b/framework/inc/uiconfiguration/moduleuicfgsupplier.hxx @@ -0,0 +1,119 @@ +/************************************************************************* + * + * 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_UICONFIGURATION_MODULEUICFGSUPPLIER_HXX_ +#define __FRAMEWORK_UICONFIGURATION_MODULEUICFGSUPPLIER_HXX_ + + +/** Attention: stl headers must(!) be included at first. Otherwhise it can make trouble + with solaris headers ... +*/ +#include <vector> +#include <list> +#include <hash_map> + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ +#include <threadhelp/threadhelpbase.hxx> +#include <macros/generic.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> +#include <stdtypes.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp> +#include <com/sun/star/ui/XUIConfigurationManager.hpp> +#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/embed/XStorage.hpp> +#include <com/sun/star/embed/XTransactedObject.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <cppuhelper/weak.hxx> +#include <cppuhelper/interfacecontainer.hxx> +#include <rtl/ustring.hxx> + + +namespace framework +{ + class ModuleUIConfigurationManagerSupplier : public com::sun::star::lang::XTypeProvider , + public com::sun::star::lang::XServiceInfo , + public com::sun::star::lang::XComponent , + public ::com::sun::star::ui::XModuleUIConfigurationManagerSupplier , + private ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses. + public ::cppu::OWeakObject + { + public: + // XInterface, XTypeProvider, XServiceInfo + FWK_DECLARE_XINTERFACE + FWK_DECLARE_XTYPEPROVIDER + DECLARE_XSERVICEINFO + + ModuleUIConfigurationManagerSupplier( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager ); + virtual ~ModuleUIConfigurationManagerSupplier(); + + // XComponent + virtual void SAL_CALL dispose() + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) + throw (::com::sun::star::uno::RuntimeException); + + // XModuleUIConfigurationManagerSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIConfigurationManager > SAL_CALL getUIConfigurationManager( const ::rtl::OUString& ModuleIdentifier ) + throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); + + private: + typedef ::std::hash_map< rtl::OUString, com::sun::star::uno::Reference< ::com::sun::star::ui::XUIConfigurationManager >, OUStringHashCode, ::std::equal_to< rtl::OUString > > ModuleToModuleCfgMgr; + +//TODO_AS void impl_initStorages(); + + // private methods + ModuleToModuleCfgMgr m_aModuleToModuleUICfgMgrMap; + bool m_bDisposed; +// TODO_AS bool m_bInit; + rtl::OUString m_aDefaultConfigURL; + rtl::OUString m_aUserConfigURL; + com::sun::star::uno::Reference< com::sun::star::embed::XStorage > m_xDefaultCfgRootStorage; + com::sun::star::uno::Reference< com::sun::star::embed::XStorage > m_xUserCfgRootStorage; + com::sun::star::uno::Reference< com::sun::star::embed::XTransactedObject > m_xUserRootCommit; + com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager > m_xModuleMgr; + com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; + ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; /// container for ALL Listener + }; +} + +#endif // __FRAMEWORK_UICONFIGURATION_MODULEUICFGSUPPLIER_HXX_ diff --git a/framework/inc/uiconfiguration/moduleuiconfigurationmanager.hxx b/framework/inc/uiconfiguration/moduleuiconfigurationmanager.hxx new file mode 100644 index 000000000000..856746139b68 --- /dev/null +++ b/framework/inc/uiconfiguration/moduleuiconfigurationmanager.hxx @@ -0,0 +1,226 @@ +/************************************************************************* + * + * 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_UICONFIGURATION_MODULEUICONFIGMANAGER_HXX_ +#define __FRAMEWORK_UICONFIGURATION_MODULEUICONFIGMANAGER_HXX_ + + +/** Attention: stl headers must(!) be included at first. Otherwhise it can make trouble + with solaris headers ... +*/ +#include <vector> +#include <list> +#include <hash_map> + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ +#include <accelerators/presethandler.hxx> +#include <threadhelp/threadhelpbase.hxx> +#include <macros/generic.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> +#include <stdtypes.h> +#include <uiconfiguration/moduleimagemanager.hxx> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/ui/XUIConfigurationPersistence.hpp> +#include <com/sun/star/ui/XUIConfiguration.hpp> +#include <com/sun/star/ui/XUIConfigurationManager.hpp> +#include <com/sun/star/ui/XModuleUIConfigurationManager.hpp> +#include <com/sun/star/ui/UIElementType.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/ui/ConfigurationEvent.hpp> +#include <com/sun/star/embed/XTransactedObject.hpp> +#include <com/sun/star/container/XIndexContainer.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <cppuhelper/weak.hxx> +#include <cppuhelper/interfacecontainer.hxx> +#include <rtl/ustring.hxx> + + +namespace framework +{ + class ModuleUIConfigurationManager : public com::sun::star::lang::XTypeProvider , + public com::sun::star::lang::XServiceInfo , + public com::sun::star::lang::XComponent , + public com::sun::star::lang::XInitialization , + public ::com::sun::star::ui::XUIConfiguration , + public ::com::sun::star::ui::XUIConfigurationManager , + public ::com::sun::star::ui::XModuleUIConfigurationManager , + public ::com::sun::star::ui::XUIConfigurationPersistence , + private ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses. + public ::cppu::OWeakObject + { + public: + // XInterface, XTypeProvider, XServiceInfo + FWK_DECLARE_XINTERFACE + FWK_DECLARE_XTYPEPROVIDER + DECLARE_XSERVICEINFO + + ModuleUIConfigurationManager( com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > xServiceManager ); + virtual ~ModuleUIConfigurationManager(); + + // XComponent + virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException); + + // XInitialization + virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + + // XUIConfiguration + virtual void SAL_CALL addConfigurationListener( const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIConfigurationListener >& Listener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeConfigurationListener( const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIConfigurationListener >& Listener ) throw (::com::sun::star::uno::RuntimeException); + + // XUIConfigurationManager + virtual void SAL_CALL reset() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > > SAL_CALL getUIElementsInfo( sal_Int16 ElementType ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer > SAL_CALL createSettings( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasSettings( const ::rtl::OUString& ResourceURL ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > SAL_CALL getSettings( const ::rtl::OUString& ResourceURL, sal_Bool bWriteable ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL replaceSettings( const ::rtl::OUString& ResourceURL, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& aNewData ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IllegalAccessException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeSettings( const ::rtl::OUString& ResourceURL ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IllegalAccessException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL insertSettings( const ::rtl::OUString& NewResourceURL, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& aNewData ) throw (::com::sun::star::container::ElementExistException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IllegalAccessException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getImageManager() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getShortCutManager() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getEventsManager() throw (::com::sun::star::uno::RuntimeException); + + // XModuleUIConfigurationManager + virtual sal_Bool SAL_CALL isDefaultSettings( const ::rtl::OUString& ResourceURL ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > SAL_CALL getDefaultSettings( const ::rtl::OUString& ResourceURL ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + + // XUIConfigurationPersistence + virtual void SAL_CALL reload() throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL store() throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL storeToStorage( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& Storage ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isModified() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isReadOnly() throw (::com::sun::star::uno::RuntimeException); + + private: + // private data types + enum Layer + { + LAYER_DEFAULT, + LAYER_USERDEFINED, + LAYER_COUNT + }; + + enum NotifyOp + { + NotifyOp_Remove, + NotifyOp_Insert, + NotifyOp_Replace + }; + + struct UIElementInfo + { + UIElementInfo( const rtl::OUString& rResourceURL, const rtl::OUString& rUIName ) : + aResourceURL( rResourceURL), aUIName( rUIName ) {} + rtl::OUString aResourceURL; + rtl::OUString aUIName; + }; + + struct UIElementData + { + UIElementData() : bModified( false ), bDefault( true ), bDefaultNode( true ) {}; + + rtl::OUString aResourceURL; + rtl::OUString aName; + bool bModified; // has been changed since last storing + bool bDefault; // default settings + bool bDefaultNode; // this is a default layer element data + com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess > xSettings; + }; + + struct UIElementType; + friend struct UIElementType; + typedef ::std::hash_map< rtl::OUString, UIElementData, OUStringHashCode, ::std::equal_to< rtl::OUString > > UIElementDataHashMap; + + struct UIElementType + { + UIElementType() : bModified( false ), + bLoaded( false ), + bDefaultLayer( false ), + nElementType( ::com::sun::star::ui::UIElementType::UNKNOWN ) {} + + + bool bModified; + bool bLoaded; + bool bDefaultLayer; + sal_Int16 nElementType; + UIElementDataHashMap aElementsHashMap; + com::sun::star::uno::Reference< com::sun::star::embed::XStorage > xStorage; + }; + + typedef ::std::vector< UIElementType > UIElementTypesVector; + typedef ::std::vector< ::com::sun::star::ui::ConfigurationEvent > ConfigEventNotifyContainer; + typedef ::std::hash_map< rtl::OUString, UIElementInfo, OUStringHashCode, ::std::equal_to< rtl::OUString > > UIElementInfoHashMap; + + // private methods + void impl_Initialize(); + void implts_notifyContainerListener( const ::com::sun::star::ui::ConfigurationEvent& aEvent, NotifyOp eOp ); + void impl_fillSequenceWithElementTypeInfo( UIElementInfoHashMap& aUIElementInfoCollection, sal_Int16 nElementType ); + void impl_preloadUIElementTypeList( Layer eLayer, sal_Int16 nElementType ); + UIElementData* impl_findUIElementData( const rtl::OUString& aResourceURL, sal_Int16 nElementType, bool bLoad = true ); + void impl_requestUIElementData( sal_Int16 nElementType, Layer eLayer, UIElementData& aUIElementData ); + void impl_storeElementTypeData( com::sun::star::uno::Reference< com::sun::star::embed::XStorage > xStorage, UIElementType& rElementType, bool bResetModifyState = true ); + void impl_resetElementTypeData( UIElementType& rUserElementType, UIElementType& rDefaultElementType, ConfigEventNotifyContainer& rRemoveNotifyContainer, ConfigEventNotifyContainer& rReplaceNotifyContainer ); + void impl_reloadElementTypeData( UIElementType& rUserElementType, UIElementType& rDefaultElementType, ConfigEventNotifyContainer& rRemoveNotifyContainer, ConfigEventNotifyContainer& rReplaceNotifyContainer ); + + UIElementTypesVector m_aUIElements[LAYER_COUNT]; + PresetHandler* m_pStorageHandler[::com::sun::star::ui::UIElementType::COUNT]; + com::sun::star::uno::Reference< com::sun::star::embed::XStorage > m_xDefaultConfigStorage; + com::sun::star::uno::Reference< com::sun::star::embed::XStorage > m_xUserConfigStorage; + bool m_bReadOnly; + bool m_bInitialized; + bool m_bModified; + bool m_bConfigRead; + bool m_bDisposed; + rtl::OUString m_aXMLPostfix; + rtl::OUString m_aPropUIName; + rtl::OUString m_aPropResourceURL; + rtl::OUString m_aModuleIdentifier; + rtl::OUString m_aModuleShortName; + com::sun::star::uno::Reference< com::sun::star::embed::XTransactedObject > m_xUserRootCommit; + com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; + ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; /// container for ALL Listener + com::sun::star::uno::Reference< com::sun::star::lang::XComponent > m_xModuleImageManager; + com::sun::star::uno::Reference< com::sun::star::uno::XInterface > m_xModuleAcceleratorManager; + }; +} + +#endif // __FRAMEWORK_UICONFIGURATION_MODULEUICONFIGMANAGER_HXX_ diff --git a/framework/inc/uiconfiguration/uicategorydescription.hxx b/framework/inc/uiconfiguration/uicategorydescription.hxx new file mode 100644 index 000000000000..b29df7c643e3 --- /dev/null +++ b/framework/inc/uiconfiguration/uicategorydescription.hxx @@ -0,0 +1,74 @@ +/************************************************************************* + * + * 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_UIELEMENT_UICOMMANDCATEGORY_HXX_ +#define __FRAMEWORK_UIELEMENT_UICOMMANDCATEGORY_HXX_ + +/** Attention: stl headers must(!) be included at first. Otherwhise it can make trouble + with solaris headers ... +*/ +#include <vector> +#include <list> +#include <hash_map> + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ +#include <threadhelp/threadhelpbase.hxx> +#include <macros/generic.hxx> +#include <macros/xserviceinfo.hxx> +#include <uielement/uicommanddescription.hxx> +#include <stdtypes.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/frame/XModuleManager.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ + +namespace framework +{ +class UICategoryDescription : public UICommandDescription +{ + public: + UICategoryDescription( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); + virtual ~UICategoryDescription(); + + DECLARE_XSERVICEINFO + private: + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > impl_createConfigAccess(const ::rtl::OUString& _sName); +}; + +} // namespace framework + +#endif // __FRAMEWORK_SERVICES_UICOMMANDCATEGORY_HXX_ diff --git a/framework/inc/uiconfiguration/uiconfigurationmanager.hxx b/framework/inc/uiconfiguration/uiconfigurationmanager.hxx new file mode 100644 index 000000000000..875ee7fb10b6 --- /dev/null +++ b/framework/inc/uiconfiguration/uiconfigurationmanager.hxx @@ -0,0 +1,210 @@ +/************************************************************************* + * + * 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_UICONFIGURATION_UICONFIGMANAGER_HXX_ +#define __FRAMEWORK_UICONFIGURATION_UICONFIGMANAGER_HXX_ + + +/** Attention: stl headers must(!) be included at first. Otherwhise it can make trouble + with solaris headers ... +*/ +#include <vector> +#include <list> +#include <hash_map> + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ +#include <threadhelp/threadhelpbase.hxx> +#include <macros/generic.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> +#include <stdtypes.h> +#include <uiconfiguration/imagemanager.hxx> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/ui/XUIConfiguration.hpp> +#include <com/sun/star/ui/XUIConfigurationPersistence.hpp> + +#ifndef _COM_SUN_STAR_UI_XUICONFIGURATIONSTORGAE_HPP_ +#include <com/sun/star/ui/XUIConfigurationStorage.hpp> +#endif +#include <com/sun/star/ui/XUIConfigurationManager.hpp> +#include <com/sun/star/ui/ConfigurationEvent.hpp> +#include <com/sun/star/ui/UIElementType.hpp> +#include <com/sun/star/container/XIndexContainer.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <cppuhelper/weak.hxx> +#include <cppuhelper/interfacecontainer.hxx> +#include <rtl/ustring.hxx> + + +namespace framework +{ + class UIConfigurationManager : public com::sun::star::lang::XTypeProvider , + public com::sun::star::lang::XServiceInfo , + public com::sun::star::lang::XComponent , + public ::com::sun::star::ui::XUIConfiguration , + public ::com::sun::star::ui::XUIConfigurationManager , + public ::com::sun::star::ui::XUIConfigurationPersistence , + public ::com::sun::star::ui::XUIConfigurationStorage , + private ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses. + public ::cppu::OWeakObject + { + public: + // XInterface, XTypeProvider, XServiceInfo + FWK_DECLARE_XINTERFACE + FWK_DECLARE_XTYPEPROVIDER + DECLARE_XSERVICEINFO + + UIConfigurationManager( com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > xServiceManager ); + virtual ~UIConfigurationManager(); + + // XComponent + virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException); + + // XUIConfiguration + virtual void SAL_CALL addConfigurationListener( const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIConfigurationListener >& Listener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeConfigurationListener( const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIConfigurationListener >& Listener ) throw (::com::sun::star::uno::RuntimeException); + + // XUIConfigurationManager + virtual void SAL_CALL reset() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > > SAL_CALL getUIElementsInfo( sal_Int16 ElementType ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer > SAL_CALL createSettings( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasSettings( const ::rtl::OUString& ResourceURL ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > SAL_CALL getSettings( const ::rtl::OUString& ResourceURL, sal_Bool bWriteable ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL replaceSettings( const ::rtl::OUString& ResourceURL, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& aNewData ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IllegalAccessException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeSettings( const ::rtl::OUString& ResourceURL ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IllegalAccessException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL insertSettings( const ::rtl::OUString& NewResourceURL, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& aNewData ) throw (::com::sun::star::container::ElementExistException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IllegalAccessException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getImageManager() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getShortCutManager() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getEventsManager() throw (::com::sun::star::uno::RuntimeException); + + // XUIConfigurationPersistence + virtual void SAL_CALL reload() throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL store() throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL storeToStorage( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& Storage ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isModified() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isReadOnly() throw (::com::sun::star::uno::RuntimeException); + + // XUIConfigurationStorage + virtual void SAL_CALL setStorage( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& Storage ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasStorage() throw (::com::sun::star::uno::RuntimeException); + + private: + // private data types + enum NotifyOp + { + NotifyOp_Remove, + NotifyOp_Insert, + NotifyOp_Replace + }; + + struct UIElementInfo + { + UIElementInfo( const rtl::OUString& rResourceURL, const rtl::OUString& rUIName ) : + aResourceURL( rResourceURL), aUIName( rUIName ) {} + rtl::OUString aResourceURL; + rtl::OUString aUIName; + }; + + struct UIElementData + { + UIElementData() : bModified( false ), bDefault( true ) {}; + + rtl::OUString aResourceURL; + rtl::OUString aName; + bool bModified; // has been changed since last storing + bool bDefault; // default settings + com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess > xSettings; + }; + + struct UIElementType; + friend struct UIElementType; + typedef ::std::hash_map< rtl::OUString, UIElementData, OUStringHashCode, ::std::equal_to< rtl::OUString > > UIElementDataHashMap; + + struct UIElementType + { + UIElementType() : bModified( false ), + bLoaded( false ), + bDefaultLayer( false ), + nElementType( ::com::sun::star::ui::UIElementType::UNKNOWN ) {} + + + bool bModified; + bool bLoaded; + bool bDefaultLayer; + sal_Int16 nElementType; + UIElementDataHashMap aElementsHashMap; + com::sun::star::uno::Reference< com::sun::star::embed::XStorage > xStorage; + }; + + typedef ::std::vector< UIElementType > UIElementTypesVector; + typedef ::std::vector< ::com::sun::star::ui::ConfigurationEvent > ConfigEventNotifyContainer; + typedef ::std::hash_map< rtl::OUString, UIElementInfo, OUStringHashCode, ::std::equal_to< rtl::OUString > > UIElementInfoHashMap; + + // private methods + void impl_Initialize(); + void implts_notifyContainerListener( const ::com::sun::star::ui::ConfigurationEvent& aEvent, NotifyOp eOp ); + void impl_fillSequenceWithElementTypeInfo( UIElementInfoHashMap& aUIElementInfoCollection, sal_Int16 nElementType ); + void impl_preloadUIElementTypeList( sal_Int16 nElementType ); + UIElementData* impl_findUIElementData( const rtl::OUString& aResourceURL, sal_Int16 nElementType, bool bLoad = true ); + void impl_requestUIElementData( sal_Int16 nElementType, UIElementData& aUIElementData ); + void impl_storeElementTypeData( com::sun::star::uno::Reference< com::sun::star::embed::XStorage >& xStorage, UIElementType& rElementType, bool bResetModifyState = true ); + void impl_resetElementTypeData( UIElementType& rDocElementType, ConfigEventNotifyContainer& rRemoveNotifyContainer ); + void impl_reloadElementTypeData( UIElementType& rDocElementType, ConfigEventNotifyContainer& rRemoveNotifyContainer, ConfigEventNotifyContainer& rReplaceNotifyContainer ); + + UIElementTypesVector m_aUIElements; + com::sun::star::uno::Reference< com::sun::star::embed::XStorage > m_xDocConfigStorage; + bool m_bReadOnly; + bool m_bInitialized; + bool m_bModified; + bool m_bConfigRead; + bool m_bDisposed; + rtl::OUString m_aXMLPostfix; + rtl::OUString m_aPropUIName; + rtl::OUString m_aPropResourceURL; + rtl::OUString m_aModuleIdentifier; + com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; + ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; /// container for ALL Listener + com::sun::star::uno::Reference< com::sun::star::lang::XComponent > m_xImageManager; + com::sun::star::uno::Reference< com::sun::star::uno::XInterface > m_xAccConfig; + }; +} + +#endif // __FRAMEWORK_UICONFIGURATION_UICONFIGMANAGER_HXX_ diff --git a/framework/inc/uiconfiguration/windowstateconfiguration.hxx b/framework/inc/uiconfiguration/windowstateconfiguration.hxx new file mode 100644 index 000000000000..861237c0bf6f --- /dev/null +++ b/framework/inc/uiconfiguration/windowstateconfiguration.hxx @@ -0,0 +1,131 @@ +/************************************************************************* + * + * 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_UICONFIGURATION_WINDOWSTATECONFIGURATION_HXX_ +#define __FRAMEWORK_UICONFIGURATION_WINDOWSTATECONFIGURATION_HXX_ + +/** Attention: stl headers must(!) be included at first. Otherwhise it can make trouble + with solaris headers ... +*/ +#include <vector> +#include <list> +#include <hash_map> + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ +#include <threadhelp/threadhelpbase.hxx> +#include <macros/generic.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> +#include <stdtypes.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/frame/XModuleManager.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <cppuhelper/implbase2.hxx> +#include <rtl/ustring.hxx> + +namespace framework +{ + +#define WINDOWSTATE_PROPERTY_LOCKED "Locked" +#define WINDOWSTATE_PROPERTY_DOCKED "Docked" +#define WINDOWSTATE_PROPERTY_VISIBLE "Visible" +#define WINDOWSTATE_PROPERTY_DOCKINGAREA "DockingArea" +#define WINDOWSTATE_PROPERTY_DOCKPOS "DockPos" +#define WINDOWSTATE_PROPERTY_DOCKSIZE "DockSize" +#define WINDOWSTATE_PROPERTY_POS "Pos" +#define WINDOWSTATE_PROPERTY_SIZE "Size" +#define WINDOWSTATE_PROPERTY_UINAME "UIName" +#define WINDOWSTATE_PROPERTY_INTERNALSTATE "InternalState" +#define WINDOWSTATE_PROPERTY_STYLE "Style" +#define WINDOWSTATE_PROPERTY_CONTEXT "ContextSensitive" +#define WINDOWSTATE_PROPERTY_HIDEFROMENU "HideFromToolbarMenu" +#define WINDOWSTATE_PROPERTY_NOCLOSE "NoClose" +#define WINDOWSTATE_PROPERTY_SOFTCLOSE "SoftClose" +#define WINDOWSTATE_PROPERTY_CONTEXTACTIVE "ContextActive" + +class ConfigurationAccess_Windows; +class WindowStateConfiguration : private ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses. + public ::cppu::WeakImplHelper2< ::com::sun::star::container::XNameAccess, css::lang::XServiceInfo> +{ + public: + WindowStateConfiguration( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); + virtual ~WindowStateConfiguration(); + + // XInterface, XTypeProvider, XServiceInfo + FWK_DECLARE_XINTERFACE + FWK_DECLARE_XTYPEPROVIDER + DECLARE_XSERVICEINFO + + // XNameAccess + virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) + throw ( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() + throw (::com::sun::star::uno::RuntimeException); + + virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) + throw (::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); + + typedef ::std::hash_map< ::rtl::OUString, + ::rtl::OUString, + OUStringHashCode, + ::std::equal_to< ::rtl::OUString > > ModuleToWindowStateFileMap; + + typedef ::std::hash_map< ::rtl::OUString, + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >, + OUStringHashCode, + ::std::equal_to< ::rtl::OUString > > ModuleToWindowStateConfigHashMap; + + private: + sal_Bool m_bConfigRead; + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; + ModuleToWindowStateFileMap m_aModuleToFileHashMap; + ModuleToWindowStateConfigHashMap m_aModuleToWindowStateHashMap; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager > m_xModuleManager; +}; + +} // namespace framework + +#endif // __FRAMEWORK_UIELEMENT_WINDOWSTATECONFIGURATION_HXX_ diff --git a/framework/inc/uielement/addonstoolbarmanager.hxx b/framework/inc/uielement/addonstoolbarmanager.hxx new file mode 100644 index 000000000000..bf1525cf5f63 --- /dev/null +++ b/framework/inc/uielement/addonstoolbarmanager.hxx @@ -0,0 +1,100 @@ +/************************************************************************* + * + * 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_UIELEMENT_ADDONSTOOLBARMANAGER_HXX_ +#define __FRAMEWORK_UIELEMENT_ADDONSTOOLBARMANAGER_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#ifndef __FRAMEWORK_UILEMENT_TOOLBARMANAGER_HXX_ +#include <uielement/toolbarmanager.hxx> +#endif +#include <threadhelp/threadhelpbase.hxx> +#include <macros/generic.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/frame/XStatusListener.hpp> +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/container/XIndexAccess.hpp> +#include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <rtl/ustring.hxx> +#include <cppuhelper/weak.hxx> +#include <cppuhelper/interfacecontainer.hxx> + +#include <vcl/toolbox.hxx> + + +namespace framework +{ + +class ToolBar; +class AddonsToolBarManager : public ToolBarManager +{ + public: + AddonsToolBarManager( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServicveManager, + const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame, + const rtl::OUString& rResourceName, + ToolBar* pToolBar ); + virtual ~AddonsToolBarManager(); + + // XComponent + void SAL_CALL dispose() throw ( ::com::sun::star::uno::RuntimeException ); + + virtual void RefreshImages(); + using ToolBarManager::FillToolbar; + void FillToolbar( const com::sun::star::uno::Sequence< com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > >& rAddonToolbar ); + + protected: + DECL_LINK( Click, ToolBox * ); + DECL_LINK( DoubleClick, ToolBox * ); + DECL_LINK( Command, CommandEvent * ); + DECL_LINK( Select, ToolBox * ); + DECL_LINK( Highlight, ToolBox * ); + DECL_LINK( Activate, ToolBox * ); + DECL_LINK( Deactivate, ToolBox * ); + DECL_LINK( StateChanged, StateChangedType* ); + DECL_LINK( DataChanged, DataChangedEvent* ); + + virtual bool MenuItemAllowed( sal_uInt16 ) const; +}; + +} + +#endif // __FRAMEWORK_UIELEMENT_ADDONSTOOLBARMANAGER_HXX_ diff --git a/framework/inc/uielement/addonstoolbarwrapper.hxx b/framework/inc/uielement/addonstoolbarwrapper.hxx new file mode 100644 index 000000000000..e1a04acef2eb --- /dev/null +++ b/framework/inc/uielement/addonstoolbarwrapper.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_UIELEMENT_ADDONSTOOLBARWRAPPER_HXX_ +#define __FRAMEWORK_UIELEMENT_ADDONSTOOLBARWRAPPER_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <helper/uielementwrapperbase.hxx> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ + +namespace framework +{ + +class AddonsToolBarManager; +class AddonsToolBarWrapper : public UIElementWrapperBase +{ + public: + AddonsToolBarWrapper( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); + virtual ~AddonsToolBarWrapper(); + + // XComponent + virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException); + + // XInitialization + virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + + // XUIElement + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getRealInterface() throw (::com::sun::star::uno::RuntimeException); + + //------------------------------------------------------------------------------------------------------------- + // protected methods + //------------------------------------------------------------------------------------------------------------- + private: + com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; + com::sun::star::uno::Reference< com::sun::star::lang::XComponent > m_xToolBarManager; + com::sun::star::uno::Reference< com::sun::star::awt::XWindow > m_xToolBarWindow; + com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > > m_aConfigData; +}; + +} + +#endif // __FRAMEWORK_UIELEMENT_ADDONSTOOLBARWRAPPER_HXX_ diff --git a/framework/inc/uielement/buttontoolbarcontroller.hxx b/framework/inc/uielement/buttontoolbarcontroller.hxx new file mode 100644 index 000000000000..eba7914e9430 --- /dev/null +++ b/framework/inc/uielement/buttontoolbarcontroller.hxx @@ -0,0 +1,111 @@ +/************************************************************************* + * + * 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_UIELEMENT_BUTTONTOOLBARCONTROLLER_HXX_ +#define __FRAMEWORK_UIELEMENT_BUTTONTOOLBARCONTROLLER_HXX_ + +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/util/XUpdatable.hpp> +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/frame/XStatusListener.hpp> +#include <com/sun/star/util/XURLTransformer.hpp> +#include <com/sun/star/beans/NamedValue.hpp> +#include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/frame/ControlCommand.hpp> +#include <com/sun/star/frame/XLayoutManager.hpp> +#include <com/sun/star/frame/XToolbarController.hpp> + +//_________________________________________________________________________________________________________________ +// includes of other projects +//_________________________________________________________________________________________________________________ + +#include <comphelper/broadcasthelper.hxx> +#include <cppuhelper/weak.hxx> +#include <vcl/toolbox.hxx> + +namespace framework +{ + +class ToolBar; +class ButtonToolbarController : public ::com::sun::star::frame::XStatusListener, + public ::com::sun::star::frame::XToolbarController, + public ::com::sun::star::lang::XInitialization, + public ::com::sun::star::util::XUpdatable, + public ::com::sun::star::lang::XComponent, + public ::comphelper::OBaseMutex, + public ::cppu::OWeakObject +{ + public: + ButtonToolbarController( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager, + ToolBox* pToolBar, + const rtl::OUString& aCommand ); + virtual ~ButtonToolbarController(); + + // 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 (); + + // XInitialization + virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + + // XUpdatable + virtual void SAL_CALL update() throw (::com::sun::star::uno::RuntimeException); + + // XComponent + virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException); + + // XEventListener + virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw ( ::com::sun::star::uno::RuntimeException ); + + // XStatusListener + virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); + + // XToolbarController + virtual void SAL_CALL execute( sal_Int16 KeyModifier ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL click() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL doubleClick() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createPopupWindow() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createItemWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& Parent ) throw (::com::sun::star::uno::RuntimeException); + + private: + sal_Bool m_bInitialized : 1, + m_bDisposed : 1; + rtl::OUString m_aCommandURL; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xFrame; + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; + ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer > m_xURLTransformer; + ToolBox* m_pToolbar; +}; + +} + +#endif // __FRAMEWORK_UIELEMENT_BUTTONTOOLBARCONTROLLER_HXX_ diff --git a/framework/inc/uielement/comboboxtoolbarcontroller.hxx b/framework/inc/uielement/comboboxtoolbarcontroller.hxx new file mode 100644 index 000000000000..7cdcb5d268a9 --- /dev/null +++ b/framework/inc/uielement/comboboxtoolbarcontroller.hxx @@ -0,0 +1,96 @@ +/************************************************************************* + * + * 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_UIELEMENT_COMBOBOXTOOLBARCONTROLLER_HXX_ +#define __FRAMEWORK_UIELEMENT_COMBOBOXTOOLBARCONTROLLER_HXX_ + +#include <com/sun/star/beans/NamedValue.hpp> +#include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/frame/ControlCommand.hpp> + +//_________________________________________________________________________________________________________________ +// includes of other projects +//_________________________________________________________________________________________________________________ + +//#include <vcl/toolbox.hxx> +//#include <vcl/combobox.hxx> +#include <uielement/complextoolbarcontroller.hxx> + +namespace framework +{ + +class ToolBar; +class ComboBoxControl; + +class IComboBoxListener +{ + public: + virtual void Select() = 0; + virtual void DoubleClick() = 0; + virtual void Modify() = 0; + virtual void KeyInput( const KeyEvent& rKEvt ) = 0; + virtual void GetFocus() = 0; + virtual void LoseFocus() = 0; + virtual long PreNotify( NotifyEvent& rNEvt ) = 0; +}; + +class ComboboxToolbarController : public IComboBoxListener, + public ComplexToolbarController + +{ + public: + ComboboxToolbarController( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager, + const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame, + ToolBox* pToolBar, + sal_uInt16 nID, + sal_Int32 nWidth, + const rtl::OUString& aCommand ); + virtual ~ComboboxToolbarController(); + + // XComponent + virtual void SAL_CALL dispose() throw ( ::com::sun::star::uno::RuntimeException ); + + // IComboBoxListener + virtual void Select(); + virtual void DoubleClick(); + virtual void Modify(); + virtual void KeyInput( const KeyEvent& rKEvt ); + virtual void GetFocus(); + virtual void LoseFocus(); + virtual long PreNotify( NotifyEvent& rNEvt ); + + protected: + virtual void executeControlCommand( const ::com::sun::star::frame::ControlCommand& rControlCommand ); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue> getExecuteArgs(sal_Int16 KeyModifier) const; + + private: + ComboBoxControl* m_pComboBox; +}; + +} + +#endif // __FRAMEWORK_UIELEMENT_COMBOBOXTOOLBARCONTROLLER_HXX_ diff --git a/framework/inc/uielement/commandinfo.hxx b/framework/inc/uielement/commandinfo.hxx new file mode 100644 index 000000000000..016cee039796 --- /dev/null +++ b/framework/inc/uielement/commandinfo.hxx @@ -0,0 +1,68 @@ +/************************************************************************* + * + * 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_UIELEMENT_COMMANDINFO_HXX_ +#define __FRAMEWORK_UIELEMENT_COMMANDINFO_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <macros/generic.hxx> +#include <stdtypes.h> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ + +#include <tools/solar.h> + +namespace framework +{ + +struct CommandInfo +{ + CommandInfo() : nId( 0 ), + nWidth( 0 ), + nImageInfo( 0 ), + bMirrored( false ), + bRotated( false ) {} + + sal_uInt16 nId; + sal_uInt16 nWidth; + ::std::vector< sal_uInt16 > aIds; + sal_Int16 nImageInfo; + sal_Bool bMirrored : 1, + bRotated : 1; +}; + +typedef BaseHash< CommandInfo > CommandToInfoMap; + +} // namespace framework + +#endif // __FRAMEWORK_UIELEMENT_COMMANDINFO_HXX_ + diff --git a/framework/inc/uielement/complextoolbarcontroller.hxx b/framework/inc/uielement/complextoolbarcontroller.hxx new file mode 100644 index 000000000000..557523aa5359 --- /dev/null +++ b/framework/inc/uielement/complextoolbarcontroller.hxx @@ -0,0 +1,110 @@ +/************************************************************************* + * + * 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_UIELEMENT_COMPLEXTOOLBARCONTROLLER_HXX_ +#define __FRAMEWORK_UIELEMENT_COMPLEXTOOLBARCONTROLLER_HXX_ + +#include <com/sun/star/util/URL.hpp> +#include <com/sun/star/beans/NamedValue.hpp> +#include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/frame/ControlCommand.hpp> +#include <com/sun/star/frame/XControlNotificationListener.hpp> + +//_________________________________________________________________________________________________________________ +// includes of other projects +//_________________________________________________________________________________________________________________ +#include <svtools/toolboxcontroller.hxx> + +#include <vcl/toolbox.hxx> + +namespace framework +{ + +struct ExecuteInfo +{ + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > xDispatch; + ::com::sun::star::util::URL aTargetURL; + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aArgs; +}; + +struct NotifyInfo +{ + ::rtl::OUString aEventName; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XControlNotificationListener > xNotifyListener; + ::com::sun::star::util::URL aSourceURL; + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > aInfoSeq; +}; + +class ToolBar; + +class ComplexToolbarController : public svt::ToolboxController + +{ + public: + ComplexToolbarController( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager, + const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame, + ToolBox* pToolBar, + sal_uInt16 nID, + const rtl::OUString& aCommand ); + virtual ~ComplexToolbarController(); + + // XComponent + virtual void SAL_CALL dispose() throw ( ::com::sun::star::uno::RuntimeException ); + + // XToolbarController + virtual void SAL_CALL execute( sal_Int16 KeyModifier ) throw (::com::sun::star::uno::RuntimeException); + + // XStatusListener + virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); + + DECL_STATIC_LINK( ComplexToolbarController, ExecuteHdl_Impl, ExecuteInfo* ); + DECL_STATIC_LINK( ComplexToolbarController, Notify_Impl, NotifyInfo* ); + + protected: + static sal_Int32 getFontSizePixel( const Window* pWindow ); + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > getDispatchFromCommand( const rtl::OUString& aCommand ) const; + void addNotifyInfo( const ::rtl::OUString& aEventName, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch >& xDispatch, + const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& rInfo ); + + virtual void executeControlCommand( const ::com::sun::star::frame::ControlCommand& rControlCommand ) = 0; + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue> getExecuteArgs(sal_Int16 KeyModifier) const; + const ::com::sun::star::util::URL& getInitializedURL(); + void notifyFocusGet(); + void notifyFocusLost(); + void notifyTextChanged( const ::rtl::OUString& aText ); + + ToolBox* m_pToolbar; + sal_uInt16 m_nID; + sal_Bool m_bMadeInvisible; + mutable ::com::sun::star::util::URL m_aURL; + ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer > m_xURLTransformer; +}; + +} + +#endif // __FRAMEWORK_UIELEMENT_COMPLEXTOOLBARCONTROLLER_HXX_ diff --git a/framework/inc/uielement/constitemcontainer.hxx b/framework/inc/uielement/constitemcontainer.hxx new file mode 100644 index 000000000000..04db0513fd86 --- /dev/null +++ b/framework/inc/uielement/constitemcontainer.hxx @@ -0,0 +1,138 @@ +/************************************************************************* + * + * 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_UIELEMENT_CONSTITEMCONTAINER_HXX_ +#define __FRAMEWORK_UIELEMENT_CONSTITEMCONTAINER_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <threadhelp/threadhelpbase.hxx> +#include <macros/generic.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/container/XIndexContainer.hpp> +#include <com/sun/star/lang/XSingleComponentFactory.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/beans/XFastPropertySet.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <rtl/ustring.hxx> +#include <cppuhelper/weak.hxx> +#include <cppuhelper/propshlp.hxx> + +#include <vector> +#include <fwidllapi.h> + +namespace framework +{ + +class RootItemContainer; +class ItemContainer; +class FWI_DLLPUBLIC ConstItemContainer : public ::com::sun::star::lang::XTypeProvider , + public com::sun::star::container::XIndexAccess , + public ::com::sun::star::lang::XUnoTunnel , + public ::com::sun::star::beans::XFastPropertySet, + public ::com::sun::star::beans::XPropertySet , + public ::cppu::OWeakObject +{ + friend class RootItemContainer; + friend class ItemContainer; + + public: + ConstItemContainer(); + ConstItemContainer( const ItemContainer& rtemContainer ); + ConstItemContainer( const RootItemContainer& rRootItemContainer, sal_Bool bFastCopy = sal_False ); + ConstItemContainer( const com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess >& rSourceContainer, sal_Bool bFastCopy = sal_False ); + virtual ~ConstItemContainer(); + + //--------------------------------------------------------------------------------------------------------- + // XInterface, XTypeProvider + //--------------------------------------------------------------------------------------------------------- + FWK_DECLARE_XINTERFACE + FWK_DECLARE_XTYPEPROVIDER + + // XUnoTunnel + static const ::com::sun::star::uno::Sequence< sal_Int8 >& GetUnoTunnelId() throw(); + static ConstItemContainer* GetImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxIFace ) throw(); + sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier ) throw(::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) + { + return ::getCppuType((com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >*)0); + } + + virtual sal_Bool SAL_CALL hasElements() + throw (::com::sun::star::uno::RuntimeException); + + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + + // XFastPropertySet + virtual void SAL_CALL setFastPropertyValue( sal_Int32 nHandle, const ::com::sun::star::uno::Any& aValue ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getFastPropertyValue( sal_Int32 nHandle ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + + private: + ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); + const com::sun::star::uno::Sequence< com::sun::star::beans::Property > impl_getStaticPropertyDescriptor(); + static ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySetInfo > SAL_CALL createPropertySetInfo( ::cppu::IPropertyArrayHelper & rProperties ) SAL_THROW( () ); + + void copyItemContainer( const std::vector< com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > >& rSourceVector ); + com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess > deepCopyContainer( const com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess >& rSubContainer ); + + std::vector< com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > > m_aItemVector; + rtl::OUString m_aUIName; +}; + +} + +#endif // #ifndef __FRAMEWORK_UIELEMENT_CONSTITEMCONTAINER_HXX_ diff --git a/framework/inc/uielement/controlmenucontroller.hxx b/framework/inc/uielement/controlmenucontroller.hxx new file mode 100644 index 000000000000..6e0c9deb03c0 --- /dev/null +++ b/framework/inc/uielement/controlmenucontroller.hxx @@ -0,0 +1,115 @@ +/************************************************************************* + * + * 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_UIELEMENT_CONTROLMENUCONTROLLER_HXX_ +#define __FRAMEWORK_UIELEMENT_CONTROLMENUCONTROLLER_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <macros/xserviceinfo.hxx> +#include <stdtypes.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/frame/XStatusListener.hpp> +#include <com/sun/star/frame/XPopupMenuController.hpp> +#include <com/sun/star/frame/status/Verb.hpp> +#include <com/sun/star/frame/XModel.hpp> + +//_________________________________________________________________________________________________________________ +// includes of other projects +//_________________________________________________________________________________________________________________ +#include <svtools/popupmenucontrollerbase.hxx> +#include <toolkit/awt/vclxmenu.hxx> +#include <cppuhelper/weak.hxx> +#include <rtl/ustring.hxx> + +class PopupMenu; +namespace framework +{ + class ControlMenuController : public svt::PopupMenuControllerBase + { + using svt::PopupMenuControllerBase::disposing; + + public: + ControlMenuController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); + virtual ~ControlMenuController(); + + // XServiceInfo + DECLARE_XSERVICEINFO + + // XPopupMenuController + virtual void SAL_CALL updatePopupMenu() throw (::com::sun::star::uno::RuntimeException); + + // XInitialization + virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + + // XStatusListener + virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); + + // XMenuListener + virtual void SAL_CALL activate( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException); + + // XEventListener + virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw ( ::com::sun::star::uno::RuntimeException ); + + private: + virtual void impl_setPopupMenu(); + virtual void impl_select(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch >& _xDispatch,const ::com::sun::star::util::URL& aURL); + + class UrlToDispatchMap : public ::std::hash_map< ::rtl::OUString, + com::sun::star::uno::Reference< com::sun::star::frame::XDispatch >, + OUStringHashCode, + ::std::equal_to< ::rtl::OUString > > + { + public: + inline void free() + { + UrlToDispatchMap().swap( *this ); + } + }; + + void updateImagesPopupMenu( PopupMenu* pPopupMenu ); + void fillPopupMenu( com::sun::star::uno::Reference< com::sun::star::awt::XPopupMenu >& rPopupMenu ); + + sal_Bool m_bWasHiContrast : 1, + m_bShowMenuImages : 1; + PopupMenu* m_pResPopupMenu; + UrlToDispatchMap m_aURLToDispatchMap; + }; +} + +#endif // __FRAMEWORK_UIELEMENT_CONTROLMENUCONTROLLER_HXX_ diff --git a/framework/inc/uielement/dropdownboxtoolbarcontroller.hxx b/framework/inc/uielement/dropdownboxtoolbarcontroller.hxx new file mode 100644 index 000000000000..eb146bcacdd1 --- /dev/null +++ b/framework/inc/uielement/dropdownboxtoolbarcontroller.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_UIELEMENT_DROPDOWNBOXTOOLBARCONTROLLER_HXX_ +#define __FRAMEWORK_UIELEMENT_DROPDOWNBOXTOOLBARCONTROLLER_HXX_ + +#include <com/sun/star/beans/NamedValue.hpp> +#include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/frame/ControlCommand.hpp> + +//_________________________________________________________________________________________________________________ +// includes of other projects +//_________________________________________________________________________________________________________________ + +#include <uielement/complextoolbarcontroller.hxx> +#include <vcl/toolbox.hxx> +#include <vcl/lstbox.hxx> + +namespace framework +{ + +class ToolBar; +class ListBoxControl; + +class IListBoxListener +{ + public: + virtual void Select() = 0; + virtual void DoubleClick() = 0; + virtual void GetFocus() = 0; + virtual void LoseFocus() = 0; + virtual long PreNotify( NotifyEvent& rNEvt ) = 0; +}; + +class DropdownToolbarController : public IListBoxListener, + public ComplexToolbarController + +{ + public: + DropdownToolbarController( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager, + const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame, + ToolBox* pToolBar, + sal_uInt16 nID, + sal_Int32 nWidth, + const rtl::OUString& aCommand ); + virtual ~DropdownToolbarController(); + + // XComponent + virtual void SAL_CALL dispose() throw ( ::com::sun::star::uno::RuntimeException ); + + // IComboBoxListener + virtual void Select(); + virtual void DoubleClick(); + virtual void GetFocus(); + virtual void LoseFocus(); + virtual long PreNotify( NotifyEvent& rNEvt ); + + protected: + virtual void executeControlCommand( const ::com::sun::star::frame::ControlCommand& rControlCommand ); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue> getExecuteArgs(sal_Int16 KeyModifier) const; + + private: + ListBoxControl* m_pListBoxControl; +}; + +} + +#endif // __FRAMEWORK_UIELEMENT_DROPDOWNBOXTOOLBARCONTROLLER_HXX_ diff --git a/framework/inc/uielement/edittoolbarcontroller.hxx b/framework/inc/uielement/edittoolbarcontroller.hxx new file mode 100644 index 000000000000..d8b48630da50 --- /dev/null +++ b/framework/inc/uielement/edittoolbarcontroller.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_UIELEMENT_EDITTOOLBARCONTROLLER_HXX_ +#define __FRAMEWORK_UIELEMENT_EDITTOOLBARCONTROLLER_HXX_ + +#include <com/sun/star/beans/NamedValue.hpp> +#include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/frame/ControlCommand.hpp> + +//_________________________________________________________________________________________________________________ +// includes of other projects +//_________________________________________________________________________________________________________________ + +#include <uielement/complextoolbarcontroller.hxx> +#include <vcl/toolbox.hxx> +#include <vcl/edit.hxx> + +namespace framework +{ + +class ToolBar; +class EditControl; + +class IEditListener +{ + public: + virtual void Modify() = 0; + virtual void KeyInput( const KeyEvent& rKEvt ) = 0; + virtual void GetFocus() = 0; + virtual void LoseFocus() = 0; + virtual long PreNotify( NotifyEvent& rNEvt ) = 0; +}; + +class EditToolbarController : public IEditListener, + public ComplexToolbarController + +{ + public: + EditToolbarController( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager, + const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame, + ToolBox* pToolBar, + sal_uInt16 nID, + sal_Int32 nWidth, + const rtl::OUString& aCommand ); + virtual ~EditToolbarController(); + + // XComponent + virtual void SAL_CALL dispose() throw ( ::com::sun::star::uno::RuntimeException ); + + // IEditListener + virtual void Modify(); + virtual void KeyInput( const KeyEvent& rKEvt ); + virtual void GetFocus(); + virtual void LoseFocus(); + virtual long PreNotify( NotifyEvent& rNEvt ); + + protected: + virtual void executeControlCommand( const ::com::sun::star::frame::ControlCommand& rControlCommand ); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue> getExecuteArgs(sal_Int16 KeyModifier) const; + + private: + EditControl* m_pEditControl; +}; + +} + +#endif // __FRAMEWORK_UIELEMENT_EDITTOOLBARCONTROLLER_HXX_ diff --git a/framework/inc/uielement/fontmenucontroller.hxx b/framework/inc/uielement/fontmenucontroller.hxx new file mode 100644 index 000000000000..79905658839b --- /dev/null +++ b/framework/inc/uielement/fontmenucontroller.hxx @@ -0,0 +1,93 @@ +/************************************************************************* + * + * 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_UIELEMENT_FONTMENUCONTROLLER_HXX_ +#define __FRAMEWORK_UIELEMENT_FONTMENUCONTROLLER_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <macros/xserviceinfo.hxx> +#include <stdtypes.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/frame/XStatusListener.hpp> +#include <com/sun/star/frame/XPopupMenuController.hpp> + +//_________________________________________________________________________________________________________________ +// includes of other projects +//_________________________________________________________________________________________________________________ +#include <svtools/popupmenucontrollerbase.hxx> +#include <toolkit/awt/vclxmenu.hxx> +#include <cppuhelper/weak.hxx> +#include <rtl/ustring.hxx> + +namespace framework +{ + class FontMenuController : public svt::PopupMenuControllerBase + { + using svt::PopupMenuControllerBase::disposing; + + public: + FontMenuController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); + virtual ~FontMenuController(); + + // XServiceInfo + DECLARE_XSERVICEINFO + + // XPopupMenuController + virtual void SAL_CALL updatePopupMenu() throw (::com::sun::star::uno::RuntimeException); + + // XStatusListener + virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); + + // XMenuListener + virtual void SAL_CALL activate( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException); + + // XEventListener + virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw ( ::com::sun::star::uno::RuntimeException ); + + private: + virtual void impl_setPopupMenu(); + virtual void impl_select(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch >& _xDispatch,const ::com::sun::star::util::URL& aURL); + void fillPopupMenu( const com::sun::star::uno::Sequence< ::rtl::OUString >& rFontNameSeq, com::sun::star::uno::Reference< com::sun::star::awt::XPopupMenu >& rPopupMenu ); + + rtl::OUString m_aFontFamilyName; + com::sun::star::uno::Reference< com::sun::star::frame::XDispatch > m_xFontListDispatch; + }; +} + +#endif // __FRAMEWORK_UIELEMENT_FONTMENUCONTROLLER_HXX_ diff --git a/framework/inc/uielement/fontsizemenucontroller.hxx b/framework/inc/uielement/fontsizemenucontroller.hxx new file mode 100644 index 000000000000..4e5623084908 --- /dev/null +++ b/framework/inc/uielement/fontsizemenucontroller.hxx @@ -0,0 +1,96 @@ +/************************************************************************* + * + * 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_UIELEMENT_FONTSIZEMENUCONTROLLER_HXX_ +#define __FRAMEWORK_UIELEMENT_FONTSIZEMENUCONTROLLER_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <macros/xserviceinfo.hxx> +#include <stdtypes.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/frame/XStatusListener.hpp> +#include <com/sun/star/frame/XPopupMenuController.hpp> +#include <com/sun/star/frame/status/FontHeight.hpp> + +//_________________________________________________________________________________________________________________ +// includes of other projects +//_________________________________________________________________________________________________________________ +#include <svtools/popupmenucontrollerbase.hxx> +#include <toolkit/awt/vclxmenu.hxx> +#include <cppuhelper/weak.hxx> +#include <rtl/ustring.hxx> + +namespace framework +{ + class FontSizeMenuController : public svt::PopupMenuControllerBase + { + using svt::PopupMenuControllerBase::disposing; + + public: + FontSizeMenuController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); + virtual ~FontSizeMenuController(); + + // XServiceInfo + DECLARE_XSERVICEINFO + + // XPopupMenuController + virtual void SAL_CALL updatePopupMenu() throw (::com::sun::star::uno::RuntimeException); + + // XStatusListener + virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); + + // XEventListener + virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw ( ::com::sun::star::uno::RuntimeException ); + + private: + virtual void impl_setPopupMenu(); + virtual void impl_select(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch >& _xDispatch,const ::com::sun::star::util::URL& aURL); + void setCurHeight( long nHeight, com::sun::star::uno::Reference< com::sun::star::awt::XPopupMenu >& rPopupMenu ); + void fillPopupMenu( com::sun::star::uno::Reference< com::sun::star::awt::XPopupMenu >& rPopupMenu ); + rtl::OUString retrievePrinterName( com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame ); + + long* m_pHeightArray; + sal_Bool m_bRebuildMenu; + com::sun::star::awt::FontDescriptor m_aFontDescriptor; + ::com::sun::star::frame::status::FontHeight m_aFontHeight; + com::sun::star::uno::Reference< com::sun::star::frame::XDispatch > m_xCurrentFontDispatch; + }; +} + +#endif // __FRAMEWORK_UIELEMENT_FONTSIZEMENUCONTROLLER_HXX_ diff --git a/framework/inc/uielement/footermenucontroller.hxx b/framework/inc/uielement/footermenucontroller.hxx new file mode 100644 index 000000000000..cc154e41a6c3 --- /dev/null +++ b/framework/inc/uielement/footermenucontroller.hxx @@ -0,0 +1,57 @@ +/************************************************************************* + * + * 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_UIELEMENT_FOOTERMENUCONTROLLER_HXX_ +#define __FRAMEWORK_UIELEMENT_FOOTERMENUCONTROLLER_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ +#include <uielement/headermenucontroller.hxx> + +namespace framework +{ + class FooterMenuController : public HeaderMenuController + { + public: + FooterMenuController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); + virtual ~FooterMenuController(); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName ( ) throw( css::uno::RuntimeException ); + virtual sal_Bool SAL_CALL supportsService ( const ::rtl::OUString& sServiceName ) throw( css::uno::RuntimeException ); + virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames ( ) throw( css::uno::RuntimeException ); + /* Helper for XServiceInfo */ + static css::uno::Sequence< ::rtl::OUString > SAL_CALL impl_getStaticSupportedServiceNames( ); + static ::rtl::OUString SAL_CALL impl_getStaticImplementationName ( ); + /* Helper for registry */ + static css::uno::Reference< css::uno::XInterface > SAL_CALL impl_createInstance ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ) throw( css::uno::Exception ); + static css::uno::Reference< css::lang::XSingleServiceFactory > SAL_CALL impl_createFactory ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ); + }; +} + +#endif // __FRAMEWORK_UIELEMENT_FOOTERMENUCONTROLLER_HXX_ diff --git a/framework/inc/uielement/generictoolbarcontroller.hxx b/framework/inc/uielement/generictoolbarcontroller.hxx new file mode 100644 index 000000000000..1db3bfcc593f --- /dev/null +++ b/framework/inc/uielement/generictoolbarcontroller.hxx @@ -0,0 +1,99 @@ +/************************************************************************* + * + * 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_UIELEMENT_GENERICTOOLBARCONTROLLER_HXX_ +#define __FRAMEWORK_UIELEMENT_GENERICTOOLBARCONTROLLER_HXX_ + +//_________________________________________________________________________________________________________________ +// includes of other projects +//_________________________________________________________________________________________________________________ + +#include <svtools/toolboxcontroller.hxx> +#include <vcl/toolbox.hxx> +#include <memory> + +class PopupMenu; + +namespace framework +{ + +struct ExecuteInfo; +class ToolBar; +class GenericToolbarController : public svt::ToolboxController +{ + public: + GenericToolbarController( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager, + const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame, + ToolBox* pToolBar, + sal_uInt16 nID, + const rtl::OUString& aCommand ); + virtual ~GenericToolbarController(); + + // XComponent + virtual void SAL_CALL dispose() throw ( ::com::sun::star::uno::RuntimeException ); + + // XToolbarController + virtual void SAL_CALL execute( sal_Int16 KeyModifier ) throw (::com::sun::star::uno::RuntimeException); + + // XStatusListener + virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); + + DECL_STATIC_LINK( GenericToolbarController, ExecuteHdl_Impl, ExecuteInfo* ); + + protected: + ToolBox* m_pToolbar; + sal_uInt16 m_nID; + sal_Bool m_bEnumCommand : 1, + m_bMadeInvisible : 1; + rtl::OUString m_aEnumCommand; +}; + +class MenuToolbarController : public GenericToolbarController +{ + com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess > m_xMenuDesc; + PopupMenu* pMenu; + com::sun::star::uno::Reference< com::sun::star::lang::XComponent > m_xMenuManager; + rtl::OUString m_aModuleIdentifier; + public: + MenuToolbarController( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager, + const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame, + ToolBox* pToolBar, + sal_uInt16 nID, + const rtl::OUString& aCommand, + const rtl::OUString& aModuleIdentifier, + const com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess >& xMenuDesc ); + + ~MenuToolbarController(); + // XToolbarController + virtual void SAL_CALL click() throw ( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createPopupWindow() throw (::com::sun::star::uno::RuntimeException); + +}; + +} + +#endif // __FRAMEWORK_UIELEMENT_GENERICTOOLBARCONTROLLER_HXX_ diff --git a/framework/inc/uielement/headermenucontroller.hxx b/framework/inc/uielement/headermenucontroller.hxx new file mode 100644 index 000000000000..0deeb878156d --- /dev/null +++ b/framework/inc/uielement/headermenucontroller.hxx @@ -0,0 +1,91 @@ +/************************************************************************* + * + * 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_UIELEMENT_HEADERMENUCONTROLLER_HXX_ +#define __FRAMEWORK_UIELEMENT_HEADERMENUCONTROLLER_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <macros/xserviceinfo.hxx> +#include <stdtypes.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/frame/XStatusListener.hpp> +#include <com/sun/star/frame/XPopupMenuController.hpp> +#include <com/sun/star/frame/status/Verb.hpp> +#include <com/sun/star/frame/XModel.hpp> + +//_________________________________________________________________________________________________________________ +// includes of other projects +//_________________________________________________________________________________________________________________ +#include <svtools/popupmenucontrollerbase.hxx> +#include <toolkit/awt/vclxmenu.hxx> +#include <cppuhelper/weak.hxx> +#include <rtl/ustring.hxx> + +namespace framework +{ + class HeaderMenuController : public svt::PopupMenuControllerBase + { + using svt::PopupMenuControllerBase::disposing; + + public: + HeaderMenuController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager,bool _bFooter = sal_False ); + virtual ~HeaderMenuController(); + + // XServiceInfo + DECLARE_XSERVICEINFO + + // XPopupMenuController + virtual void SAL_CALL updatePopupMenu() throw (::com::sun::star::uno::RuntimeException); + + // XStatusListener + virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); + + // XEventListener + virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw ( ::com::sun::star::uno::RuntimeException ); + + private: + virtual void impl_select(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch >& _xDispatch,const ::com::sun::star::util::URL& aURL); + void fillPopupMenu( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rModel, com::sun::star::uno::Reference< com::sun::star::awt::XPopupMenu >& rPopupMenu ); + + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > m_xModel; + bool m_bFooter; + }; +} + +#endif // __FRAMEWORK_UIELEMENT_HEADERMENUCONTROLLER_HXX_ diff --git a/framework/inc/uielement/imagebuttontoolbarcontroller.hxx b/framework/inc/uielement/imagebuttontoolbarcontroller.hxx new file mode 100644 index 000000000000..f99138cd6939 --- /dev/null +++ b/framework/inc/uielement/imagebuttontoolbarcontroller.hxx @@ -0,0 +1,70 @@ +/************************************************************************* + * + * 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_UIELEMENT_IMAGEBUTTONTOOLBARCONTROLLER_HXX_ +#define __FRAMEWORK_UIELEMENT_IMAGEBUTTONTOOLBARCONTROLLER_HXX_ + +#include <com/sun/star/beans/NamedValue.hpp> +#include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/frame/ControlCommand.hpp> + +//_________________________________________________________________________________________________________________ +// includes of other projects +//_________________________________________________________________________________________________________________ + +#include <uielement/complextoolbarcontroller.hxx> +#include <vcl/toolbox.hxx> +#include <vcl/image.hxx> + +namespace framework +{ + +class ToolBar; +class ImageButtonToolbarController : public ComplexToolbarController + +{ + public: + ImageButtonToolbarController( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager, + const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame, + ToolBox* pToolBar, + sal_uInt16 nID, + const rtl::OUString& aCommand ); + virtual ~ImageButtonToolbarController(); + + // XComponent + virtual void SAL_CALL dispose() throw ( ::com::sun::star::uno::RuntimeException ); + + protected: + virtual void executeControlCommand( const ::com::sun::star::frame::ControlCommand& rControlCommand ); + + private: + sal_Bool ReadImageFromURL( sal_Bool bBigImage, const rtl::OUString& aImageURL, Image& aImage ); +}; + +} + +#endif // __FRAMEWORK_UIELEMENT_IMAGEBUTTONTOOLBARCONTROLLER_HXX_ diff --git a/framework/inc/uielement/itemcontainer.hxx b/framework/inc/uielement/itemcontainer.hxx new file mode 100644 index 000000000000..91e5429f4e82 --- /dev/null +++ b/framework/inc/uielement/itemcontainer.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_UIELEMENT_ITEMCONTAINER_HXX_ +#define __FRAMEWORK_UIELEMENT_ITEMCONTAINER_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <threadhelp/threadhelpbase.hxx> +#include <macros/generic.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <helper/shareablemutex.hxx> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/container/XIndexContainer.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <rtl/ustring.hxx> +#include <cppuhelper/implbase1.hxx> + +#include <vector> +#include <fwidllapi.h> + +namespace framework +{ +class ConstItemContainer; +class FWI_DLLPUBLIC ItemContainer : public ::cppu::WeakImplHelper1< ::com::sun::star::container::XIndexContainer> +{ + friend class ConstItemContainer; + + public: + ItemContainer( const ShareableMutex& ); + ItemContainer( const ConstItemContainer& rConstItemContainer, const ShareableMutex& rMutex ); + ItemContainer( const com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess >& rItemAccessContainer, const ShareableMutex& rMutex ); + virtual ~ItemContainer(); + + //--------------------------------------------------------------------------------------------------------- + // XInterface, XTypeProvider + //--------------------------------------------------------------------------------------------------------- + // XUnoTunnel + static const ::com::sun::star::uno::Sequence< sal_Int8 >& GetUnoTunnelId() throw(); + static ItemContainer* GetImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxIFace ) throw(); + sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier ) 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) + { + return ::getCppuType((com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >*)0); + } + + virtual sal_Bool SAL_CALL hasElements() + throw (::com::sun::star::uno::RuntimeException); + + private: + ItemContainer(); + void copyItemContainer( const std::vector< com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > >& rSourceVector, const ShareableMutex& rMutex ); + com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess > deepCopyContainer( const com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess >& rSubContainer, const ShareableMutex& rMutex ); + + mutable ShareableMutex m_aShareMutex; + std::vector< com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > > m_aItemVector; +}; + +} + +#endif // #ifndef __FRAMEWORK_UIELEMENT_ITEMCONTAINER_HXX_ diff --git a/framework/inc/uielement/langselectionmenucontroller.hxx b/framework/inc/uielement/langselectionmenucontroller.hxx new file mode 100644 index 000000000000..257638ecd77f --- /dev/null +++ b/framework/inc/uielement/langselectionmenucontroller.hxx @@ -0,0 +1,115 @@ +/************************************************************************* + * + * 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_UIELEMENT_LANGUAGESELECTIONMENUCONTROLLER_HXX_ +#define __FRAMEWORK_UIELEMENT_LANGUAGESELECTIONMENUCONTROLLER_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <macros/xserviceinfo.hxx> +#include <stdtypes.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/frame/XStatusListener.hpp> +#include <com/sun/star/frame/XPopupMenuController.hpp> +#include <com/sun/star/linguistic2/XLanguageGuessing.hpp> + +//_________________________________________________________________________________________________________________ +// includes of other projects +//_________________________________________________________________________________________________________________ +#include <svtools/popupmenucontrollerbase.hxx> +#include <toolkit/awt/vclxmenu.hxx> +#include <cppuhelper/weak.hxx> +#include <rtl/ustring.hxx> + +#include "helper/mischelper.hxx" + +namespace framework +{ + class LanguageSelectionMenuController : public svt::PopupMenuControllerBase + { + using svt::PopupMenuControllerBase::disposing; + + public: + LanguageSelectionMenuController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); + virtual ~LanguageSelectionMenuController(); + + // XServiceInfo + DECLARE_XSERVICEINFO + + // XPopupMenuController + virtual void SAL_CALL updatePopupMenu() throw (::com::sun::star::uno::RuntimeException); + + // XInitialization + virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + + // XStatusListener + virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); + + // XEventListener + virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw ( ::com::sun::star::uno::RuntimeException ); + + private: + virtual void impl_setPopupMenu(); + virtual void impl_select(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch >& _xDispatch,const ::com::sun::star::util::URL& aURL); + enum Mode + { + MODE_SetLanguageSelectionMenu, + MODE_SetLanguageParagraphMenu, + MODE_SetLanguageAllTextMenu + }; + + sal_Bool m_bShowMenu; + ::rtl::OUString m_aLangStatusCommandURL; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > m_xLanguageDispatch; + ::rtl::OUString m_aMenuCommandURL_Lang; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > m_xMenuDispatch_Lang; + ::rtl::OUString m_aMenuCommandURL_Font; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > m_xMenuDispatch_Font; + ::rtl::OUString m_aMenuCommandURL_CharDlgForParagraph; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > m_xMenuDispatch_CharDlgForParagraph; + ::rtl::OUString m_aCurLang; + sal_Int16 m_nScriptType; + ::rtl::OUString m_aKeyboardLang; + ::rtl::OUString m_aGuessedTextLang; + LanguageGuessingHelper m_aLangGuessHelper; + + void fillPopupMenu( com::sun::star::uno::Reference< com::sun::star::awt::XPopupMenu >& rPopupMenu, const Mode rMode ); + }; +} + +#endif // __FRAMEWORK_UIELEMENT_LANGUAGESELECTIONMENUCONTROLLER_HXX_ diff --git a/framework/inc/uielement/langselectionstatusbarcontroller.hxx b/framework/inc/uielement/langselectionstatusbarcontroller.hxx new file mode 100644 index 000000000000..4d46538eb6d6 --- /dev/null +++ b/framework/inc/uielement/langselectionstatusbarcontroller.hxx @@ -0,0 +1,107 @@ +/************************************************************************* + * + * 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_UIELEMENT_LANGSELECTIONSTATUSBARCONTROLLER_HXX_ +#define __FRAMEWORK_UIELEMENT_LANGSELECTIONSTATUSBARCONTROLLER_HXX_ + +#include <macros/generic.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> +#include <stdtypes.h> +#include <com/sun/star/linguistic2/XLanguageGuessing.hpp> +#include <svtools/statusbarcontroller.hxx> +#include <rtl/ustring.hxx> + +#include "helper/mischelper.hxx" + +#include <set> + +class SvtLanguageTable; + + +// component helper namespace +namespace framework { + +class LangSelectionStatusbarController : public svt::StatusbarController +{ + public: + explicit LangSelectionStatusbarController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); + + // XServiceInfo + DECLARE_XSERVICEINFO + + // 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 (); + + // XInitialization + virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + + // XComponent + virtual void SAL_CALL dispose() throw ( ::com::sun::star::uno::RuntimeException ); + + // XEventListener + virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw ( ::com::sun::star::uno::RuntimeException ); + + // XStatusListener + virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); + + // XStatusbarController + virtual ::sal_Bool SAL_CALL mouseButtonDown( const ::com::sun::star::awt::MouseEvent& aMouseEvent ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL mouseMove( const ::com::sun::star::awt::MouseEvent& aMouseEvent ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL mouseButtonUp( const ::com::sun::star::awt::MouseEvent& aMouseEvent ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL command( const ::com::sun::star::awt::Point& aPos, + ::sal_Int32 nCommand, + ::sal_Bool bMouseEvent, + const ::com::sun::star::uno::Any& aData ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL paint( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics >& xGraphics, + const ::com::sun::star::awt::Rectangle& rOutputRectangle, + ::sal_Int32 nItemId, ::sal_Int32 nStyle ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL click() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL doubleClick() throw (::com::sun::star::uno::RuntimeException); + + private: + virtual ~LangSelectionStatusbarController() {} + LangSelectionStatusbarController(LangSelectionStatusbarController &); // not defined + void operator =(LangSelectionStatusbarController &); // not defined + + + sal_Bool m_bShowMenu; // if the menu is to be displayed or not (depending on the selected object/text) + sal_Int16 m_nScriptType; // the flags for the different script types available in the selection, LATIN = 0x0001, ASIAN = 0x0002, COMPLEX = 0x0004 + ::rtl::OUString m_aCurLang; // the language of the current selection, "*" if there are more than one languages + ::rtl::OUString m_aKeyboardLang; // the keyboard language + ::rtl::OUString m_aGuessedTextLang; // the 'guessed' language for the selection, "" if none could be guessed + LanguageGuessingHelper m_aLangGuessHelper; + + void LangMenu() throw (::com::sun::star::uno::RuntimeException); +}; + +} // framework namespace + +#endif // __FRAMEWORK_UIELEMENT_LANGSELECTIONSTATUSBARCONTROLLER_HXX_ diff --git a/framework/inc/uielement/logoimagestatusbarcontroller.hxx b/framework/inc/uielement/logoimagestatusbarcontroller.hxx new file mode 100644 index 000000000000..6f4a3ffb6563 --- /dev/null +++ b/framework/inc/uielement/logoimagestatusbarcontroller.hxx @@ -0,0 +1,88 @@ +/************************************************************************* + * + * 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_UIELEMENT_LOGOIMAGESTATUSBARCONTROLLER_HXX_ +#define __FRAMEWORK_UIELEMENT_LOGOIMAGESTATUSBARCONTROLLER_HXX_ + +#include <macros/generic.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> +#include <stdtypes.h> +#include <svtools/statusbarcontroller.hxx> +#include <vcl/image.hxx> + +namespace framework +{ + +class LogoImageStatusbarController : public svt::StatusbarController +{ + public: + LogoImageStatusbarController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); + virtual ~LogoImageStatusbarController(); + + // XServiceInfo + DECLARE_XSERVICEINFO + + // 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 (); + + // XInitialization + virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + + // XComponent + virtual void SAL_CALL dispose() throw ( ::com::sun::star::uno::RuntimeException ); + + // XEventListener + virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw ( ::com::sun::star::uno::RuntimeException ); + + // XStatusListener + virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); + + // XStatusbarController + virtual ::sal_Bool SAL_CALL mouseButtonDown( const ::com::sun::star::awt::MouseEvent& aMouseEvent ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL mouseMove( const ::com::sun::star::awt::MouseEvent& aMouseEvent ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL mouseButtonUp( const ::com::sun::star::awt::MouseEvent& aMouseEvent ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL command( const ::com::sun::star::awt::Point& aPos, + ::sal_Int32 nCommand, + ::sal_Bool bMouseEvent, + const ::com::sun::star::uno::Any& aData ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL paint( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics >& xGraphics, + const ::com::sun::star::awt::Rectangle& rOutputRectangle, + ::sal_Int32 nItemId, ::sal_Int32 nStyle ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL click() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL doubleClick() throw (::com::sun::star::uno::RuntimeException); + + private: + Image m_aLogoImage; +}; + +} + +#endif // __FRAMEWORK_UIELEMENT_LOGOIMAGESTATUSBARCONTROLLER_HXX_ diff --git a/framework/inc/uielement/logotextstatusbarcontroller.hxx b/framework/inc/uielement/logotextstatusbarcontroller.hxx new file mode 100644 index 000000000000..5adba49186eb --- /dev/null +++ b/framework/inc/uielement/logotextstatusbarcontroller.hxx @@ -0,0 +1,88 @@ +/************************************************************************* + * + * 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_UIELEMENT_LOGOTEXTSTATUSBARCONTROLLER_HXX_ +#define __FRAMEWORK_UIELEMENT_LOGOTEXTSTATUSBARCONTROLLER_HXX_ + +#include <macros/generic.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> +#include <stdtypes.h> +#include <svtools/statusbarcontroller.hxx> +#include <vcl/image.hxx> + +namespace framework +{ + +class LogoTextStatusbarController : public svt::StatusbarController +{ + public: + LogoTextStatusbarController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); + virtual ~LogoTextStatusbarController(); + + // XServiceInfo + DECLARE_XSERVICEINFO + + // 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 (); + + // XInitialization + virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + + // XComponent + virtual void SAL_CALL dispose() throw ( ::com::sun::star::uno::RuntimeException ); + + // XEventListener + virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw ( ::com::sun::star::uno::RuntimeException ); + + // XStatusListener + virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); + + // XStatusbarController + virtual ::sal_Bool SAL_CALL mouseButtonDown( const ::com::sun::star::awt::MouseEvent& aMouseEvent ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL mouseMove( const ::com::sun::star::awt::MouseEvent& aMouseEvent ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL mouseButtonUp( const ::com::sun::star::awt::MouseEvent& aMouseEvent ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL command( const ::com::sun::star::awt::Point& aPos, + ::sal_Int32 nCommand, + ::sal_Bool bMouseEvent, + const ::com::sun::star::uno::Any& aData ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL paint( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics >& xGraphics, + const ::com::sun::star::awt::Rectangle& rOutputRectangle, + ::sal_Int32 nItemId, ::sal_Int32 nStyle ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL click() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL doubleClick() throw (::com::sun::star::uno::RuntimeException); + + private: + rtl::OUString m_aLogoText; +}; + +} + +#endif // __FRAMEWORK_UIELEMENT_LOGOTEXTSTATUSBARCONTROLLER_HXX_ diff --git a/framework/inc/uielement/macrosmenucontroller.hxx b/framework/inc/uielement/macrosmenucontroller.hxx new file mode 100644 index 000000000000..a9d323365dce --- /dev/null +++ b/framework/inc/uielement/macrosmenucontroller.hxx @@ -0,0 +1,88 @@ +/************************************************************************* + * + * 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_UIELEMENT_MACROSMENUCONTROLLER_HXX_ +#define __FRAMEWORK_UIELEMENT_MACROSMENUCONTROLLER_HXX_ + +#include <macros/xserviceinfo.hxx> +#include <stdtypes.h> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/frame/XDispatchProvider.hpp> +#include <com/sun/star/frame/XStatusListener.hpp> +#include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/frame/XPopupMenuController.hpp> +#include <svtools/popupmenucontrollerbase.hxx> +#include <toolkit/awt/vclxmenu.hxx> +#include <cppuhelper/weak.hxx> +#include <vcl/menu.hxx> +#include <rtl/ustring.hxx> + +namespace framework +{ + class MacrosMenuController : public svt::PopupMenuControllerBase + { + using svt::PopupMenuControllerBase::disposing; + + struct ExecuteInfo + { + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > xDispatch; + ::com::sun::star::util::URL aTargetURL; + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aArgs; + }; + DECL_STATIC_LINK( MacrosMenuController, ExecuteHdl_Impl, ExecuteInfo* ); + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > m_xDispatchProvider; + ::rtl::OUString m_aModuleIdentifier; + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xUICommandLabels; + + public: + MacrosMenuController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); + virtual ~MacrosMenuController(); + + // XServiceInfo + DECLARE_XSERVICEINFO + + // XStatusListener + virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); + + // XEventListener + virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw ( ::com::sun::star::uno::RuntimeException ); + + private: + virtual void impl_select(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch >& _xDispatch,const ::com::sun::star::util::URL& aURL); + void fillPopupMenu( com::sun::star::uno::Reference< com::sun::star::awt::XPopupMenu >& rPopupMenu ); + String RetrieveLabelFromCommand( const String& aCmdURL ); + void addScriptItems( PopupMenu* pPopupMenu, sal_uInt16 startItemId ); + }; +} + +#endif // __FRAMEWORK_UIELEMENT_MACROSMENUCONTROLLER_HXX_ diff --git a/framework/inc/uielement/menubarmanager.hxx b/framework/inc/uielement/menubarmanager.hxx new file mode 100644 index 000000000000..64f8667924d7 --- /dev/null +++ b/framework/inc/uielement/menubarmanager.hxx @@ -0,0 +1,278 @@ +/************************************************************************* + * + * 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_UIELEMENT_MENUBARMANAGER_HXX_ +#define __FRAMEWORK_UIELEMENT_MENUBARMANAGER_HXX_ + +/** Attention: stl headers must(!) be included at first. Otherwhise it can make trouble + with solaris headers ... +*/ +#include <vector> + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ +#include <threadhelp/threadhelpbase.hxx> +#include <macros/debug.hxx> +#include <stdtypes.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/frame/XDispatchProvider.hpp> +#include <com/sun/star/frame/FeatureStateEvent.hpp> +#include <com/sun/star/frame/XFrameActionListener.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/frame/XPopupMenuController.hpp> +#include <com/sun/star/awt/XSystemDependentMenuPeer.hpp> +#include <com/sun/star/container/XIndexAccess.hpp> +#include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/lang/XMultiComponentFactory.hpp> +#include <com/sun/star/frame/XUIControllerRegistration.hpp> +#include <com/sun/star/ui/XUIConfigurationListener.hpp> +#include <com/sun/star/ui/XImageManager.hpp> +#include <com/sun/star/ui/XAcceleratorConfiguration.hpp> +#include <com/sun/star/util/XURLTransformer.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <rtl/ustring.hxx> +#include <vcl/menu.hxx> +#include <vcl/accel.hxx> +#include <vcl/timer.hxx> +#include <toolkit/awt/vclxmenu.hxx> +#include <cppuhelper/weak.hxx> +#include <cppuhelper/interfacecontainer.hxx> +#include <framework/addonsoptions.hxx> + +namespace framework +{ + +struct PopupControllerEntry +{ + ::com::sun::star::uno::WeakReference< ::com::sun::star::frame::XDispatchProvider > m_xDispatchProvider; +}; + +typedef std::hash_map< rtl::OUString, PopupControllerEntry, OUStringHashCode, ::std::equal_to< rtl::OUString > > PopupControllerCache; + +class BmkMenu; +class AddonMenu; +class AddonPopupMenu; +class MenuBarManager : public com::sun::star::frame::XStatusListener , + public com::sun::star::frame::XFrameActionListener , + public com::sun::star::ui::XUIConfigurationListener , + public com::sun::star::lang::XComponent , + public com::sun::star::awt::XSystemDependentMenuPeer , + public ThreadHelpBase , + public ::cppu::OWeakObject +{ + protected: + // #110897# + MenuBarManager( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, + const ::com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame, + const ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer >& _xURLTransformer, + AddonMenu* pAddonMenu, + sal_Bool bDelete, + sal_Bool bDeleteChildren ); + + // #110897# + MenuBarManager( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, + const ::com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame, + const ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer >& _xURLTransformer, + AddonPopupMenu* pAddonMenu, + sal_Bool bDelete, + sal_Bool bDeleteChildren ); + + public: + // #110897# + MenuBarManager( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, + const ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer >& _xURLTransformer, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& rDispatchProvider, + const rtl::OUString& aModuleIdentifier, + Menu* pMenu, + sal_Bool bDelete, + sal_Bool bDeleteChildren ); + + // #110897# + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& getServiceFactory(); + + virtual ~MenuBarManager(); + + // XInterface + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw( ::com::sun::star::uno::RuntimeException ); + + // XComponent + virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException); + + // XStatusListener + virtual void SAL_CALL statusChanged( const com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); + + // XFrameActionListener + virtual void SAL_CALL frameAction( const com::sun::star::frame::FrameActionEvent& Action ) throw ( ::com::sun::star::uno::RuntimeException ); + + // XEventListener + virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw ( ::com::sun::star::uno::RuntimeException ); + + // XUIConfigurationListener + virtual void SAL_CALL elementInserted( const ::com::sun::star::ui::ConfigurationEvent& Event ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL elementRemoved( const ::com::sun::star::ui::ConfigurationEvent& Event ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL elementReplaced( const ::com::sun::star::ui::ConfigurationEvent& Event ) throw (::com::sun::star::uno::RuntimeException); + + // XSystemDependentMenuPeer + virtual ::com::sun::star::uno::Any SAL_CALL getMenuHandle( const ::com::sun::star::uno::Sequence< sal_Int8 >& ProcessId, sal_Int16 SystemType ) throw (::com::sun::star::uno::RuntimeException); + + DECL_LINK( Select, Menu * ); + + Menu* GetMenuBar() const { return m_pVCLMenu; } + + // Configuration methods + static void FillMenuWithConfiguration( sal_uInt16& nId, Menu* pMenu, + const ::rtl::OUString& rModuleIdentifier, + const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& rItemContainer, + const ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer >& rTransformer ); + static void FillMenu( sal_uInt16& nId, + Menu* pMenu, + const ::rtl::OUString& rModuleIdentifier, + const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& rItemContainer, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& rDispatchProvider ); + + void FillMenuManager( Menu* pMenu, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& rDispatchProvider, + const rtl::OUString& rModuleIdentifier, + sal_Bool bDelete, + sal_Bool bDeleteChildren ); + void SetItemContainer( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& rItemContainer ); + void GetPopupController( PopupControllerCache& rPopupController ); + + protected: + DECL_LINK( Highlight, Menu * ); + DECL_LINK( Activate, Menu * ); + DECL_LINK( Deactivate, Menu * ); + DECL_LINK( AsyncSettingsHdl, Timer * ); + + void RemoveListener(); + void RequestImages(); + void RetrieveImageManagers(); + static sal_Bool MustBeHidden( PopupMenu* pPopupMenu, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer >& rTransformer ); + String RetrieveLabelFromCommand( const String& aCmdURL ); + + private: + + + + void Destroy(); + + struct MenuItemHandler + { + MenuItemHandler( sal_uInt16 aItemId, + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& xManager, + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch >& rDispatch ) : + nItemId( aItemId ), + bCheckHide( sal_True ), + xSubMenuManager( xManager ), + xMenuItemDispatch( rDispatch ) {} + + sal_uInt16 nItemId; + sal_Bool bCheckHide; + ::rtl::OUString aTargetFrame; + ::rtl::OUString aMenuItemURL; + ::rtl::OUString aFilter; + ::rtl::OUString aPassword; + ::rtl::OUString aTitle; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > xSubMenuManager; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > xMenuItemDispatch; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XPopupMenuController > xPopupMenuController; + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu > xPopupMenu; + KeyCode aKeyCode; + }; + + void RetrieveShortcuts( std::vector< MenuItemHandler* >& aMenuShortCuts ); + void CreatePicklistArguments( + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArgsList, + const MenuItemHandler* ); + void CheckAndAddMenuExtension( Menu* pMenu ); + static void impl_RetrieveShortcutsFromConfiguration( const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XAcceleratorConfiguration >& rAccelCfg, + const ::com::sun::star::uno::Sequence< rtl::OUString >& rCommands, + std::vector< MenuItemHandler* >& aMenuShortCuts ); + static void MergeAddonMenus( Menu* pMenuBar, const MergeMenuInstructionContainer&, const ::rtl::OUString& aModuleIdentifier ); + + MenuItemHandler* GetMenuItemHandler( sal_uInt16 nItemId ); + sal_Bool CreatePopupMenuController( MenuItemHandler* pMenuItemHandler ); + void AddMenu(MenuBarManager* pSubMenuManager,const ::rtl::OUString& _sItemCommand,sal_uInt16 _nItemId); + sal_uInt16 FillItemCommand(::rtl::OUString& _rItemCommand,Menu* _pMenu,sal_uInt16 _nIndex) const; + void Init(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame,AddonMenu* pAddonMenu,sal_Bool bDelete,sal_Bool bDeleteChildren,bool _bHandlePopUp = false); + void SetHdl(); + + sal_Bool m_bDisposed : 1, + m_bInitialized : 1, + m_bDeleteMenu : 1, + m_bDeleteChildren : 1, + m_bActive : 1, + m_bIsBookmarkMenu : 1, + m_bWasHiContrast : 1, + m_bShowMenuImages : 1; + sal_Bool m_bRetrieveImages : 1, + m_bAcceleratorCfg : 1; + sal_Bool m_bModuleIdentified; + ::rtl::OUString m_aMenuItemCommand; + ::rtl::OUString m_aModuleIdentifier; + Menu* m_pVCLMenu; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xFrame; + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xUICommandLabels; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XUIControllerRegistration > m_xPopupMenuControllerRegistration; + ::std::vector< MenuItemHandler* > m_aMenuItemHandlerVector; + ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; /// container for ALL Listener + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > m_xDispatchProvider; + ::com::sun::star::uno::Reference< ::com::sun::star::ui::XImageManager > m_xDocImageManager; + ::com::sun::star::uno::Reference< ::com::sun::star::ui::XImageManager > m_xModuleImageManager; + ::com::sun::star::uno::Reference< ::com::sun::star::ui::XAcceleratorConfiguration > m_xDocAcceleratorManager; + ::com::sun::star::uno::Reference< ::com::sun::star::ui::XAcceleratorConfiguration > m_xModuleAcceleratorManager; + ::com::sun::star::uno::Reference< ::com::sun::star::ui::XAcceleratorConfiguration > m_xGlobalAcceleratorManager; + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxServiceFactory; + ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer > m_xURLTransformer; + ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > m_xDeferedItemContainer; + sal_Int16 m_nSymbolsStyle; + Timer m_aAsyncSettingsTimer; +}; + +} // namespace + +#endif diff --git a/framework/inc/uielement/menubarmerger.hxx b/framework/inc/uielement/menubarmerger.hxx new file mode 100644 index 000000000000..e4e930faafe2 --- /dev/null +++ b/framework/inc/uielement/menubarmerger.hxx @@ -0,0 +1,124 @@ +/************************************************************************* + * + * 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_UIELEMENT_MENUBARMERGER_HXX_ +#define __FRAMEWORK_UIELEMENT_MENUBARMERGER_HXX_ + +#include <com/sun/star/beans/PropertyValue.hpp> + +#include <rtl/ustring.hxx> +#include <vcl/menu.hxx> + +namespace framework +{ + +struct AddonMenuItem; +typedef ::std::vector< AddonMenuItem > AddonMenuContainer; + +struct AddonMenuItem +{ + ::rtl::OUString aTitle; + ::rtl::OUString aURL; + ::rtl::OUString aTarget; + ::rtl::OUString aImageId; + ::rtl::OUString aContext; + AddonMenuContainer aSubMenu; +}; + +enum RPResultInfo +{ + RP_OK, + RP_POPUPMENU_NOT_FOUND, + RP_MENUITEM_NOT_FOUND, + RP_MENUITEM_INSTEAD_OF_POPUPMENU_FOUND +}; + +struct ReferencePathInfo +{ + Menu* pPopupMenu; + sal_uInt16 nPos; + sal_Int32 nLevel; + RPResultInfo eResult; +}; + +class MenuBarMerger +{ + public: + static bool IsCorrectContext( const ::rtl::OUString& aContext, const ::rtl::OUString& aModuleIdentifier ); + + static void RetrieveReferencePath( const ::rtl::OUString&, + std::vector< ::rtl::OUString >& aReferencePath ); + static ReferencePathInfo FindReferencePath( const std::vector< ::rtl::OUString >& aReferencePath, Menu* pMenu ); + static sal_uInt16 FindMenuItem( const ::rtl::OUString& rCmd, + Menu* pMenu ); + static void GetMenuEntry( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rAddonMenuEntry, + AddonMenuItem& aAddonMenu ); + static void GetSubMenu( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > >& rSubMenuEntries, + AddonMenuContainer& rSubMenu ); + static bool ProcessMergeOperation( Menu* pMenu, + sal_uInt16 nPos, + sal_uInt16& rItemId, + const ::rtl::OUString& rMergeCommand, + const ::rtl::OUString& rMergeCommandParameter, + const ::rtl::OUString& rModuleIdentifier, + const AddonMenuContainer& rAddonMenuItems ); + static bool ProcessFallbackOperation( const ReferencePathInfo& aRefPathInfo, + sal_uInt16& rItemId, + const ::rtl::OUString& rMergeCommand, + const ::rtl::OUString& rMergeFallback, + const ::std::vector< ::rtl::OUString >& rReferencePath, + const ::rtl::OUString& rModuleIdentifier, + const AddonMenuContainer& rAddonMenuItems ); + static bool ProcessFallbackOperation(); + static bool MergeMenuItems( Menu* pMenu, + sal_uInt16 nPos, + sal_uInt16 nModIndex, + sal_uInt16& rItemId, + const ::rtl::OUString& rModuleIdentifier, + const AddonMenuContainer& rAddonMenuItems ); + static bool ReplaceMenuItem( Menu* pMenu, + sal_uInt16 nPos, + sal_uInt16& rItemId, + const ::rtl::OUString& rModuleIdentifier, + const AddonMenuContainer& rAddonMenuItems ); + static bool RemoveMenuItems( Menu* pMenu, + sal_uInt16 nPos, + const ::rtl::OUString& rMergeCommandParameter ); + static bool CreateSubMenu( Menu* pSubMenu, + sal_uInt16& nItemId, + const ::rtl::OUString& rModuleIdentifier, + const AddonMenuContainer& rAddonSubMenu ); + + private: + MenuBarMerger(); + MenuBarMerger( const MenuBarMerger& ); + MenuBarMerger& operator=( const MenuBarMerger& ); +}; + +} // namespace framework + +#endif // __FRAMEWORK_UIELEMENT_MENUBARMERGER_HXX_ diff --git a/framework/inc/uielement/menubarwrapper.hxx b/framework/inc/uielement/menubarwrapper.hxx new file mode 100644 index 000000000000..e5ccacd28c8f --- /dev/null +++ b/framework/inc/uielement/menubarwrapper.hxx @@ -0,0 +1,109 @@ +/************************************************************************* + * + * 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_UIELEMENT_MENUBARWRAPPER_HXX_ +#define __FRAMEWORK_UIELEMENT_MENUBARWRAPPER_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <helper/uiconfigelementwrapperbase.hxx> +#include <uielement/menubarmanager.hxx> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/frame/XDispatchProvider.hpp> +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#ifndef __COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_ +#include <com/sun/star/container/XNameAccess.hpp> +#endif + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ + +#include <hash_map> + +namespace framework +{ + +class MenuBarWrapper : public UIConfigElementWrapperBase, + public ::com::sun::star::container::XNameAccess + +{ + public: + // #110897# + MenuBarWrapper( + const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); + virtual ~MenuBarWrapper(); + + //--------------------------------------------------------------------------------------------------------- + // XInterface, XTypeProvider + //--------------------------------------------------------------------------------------------------------- + FWK_DECLARE_XINTERFACE + FWK_DECLARE_XTYPEPROVIDER + + MenuBarManager* GetMenuBarManager() const { return static_cast< MenuBarManager* >( m_xMenuBarManager.get() ); } + void InvalidatePopupControllerCache() { m_bRefreshPopupControllerCache = sal_True; } + + // XComponent + virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException); + + // XInitialization + virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + + // XUIElement + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getRealInterface() throw (::com::sun::star::uno::RuntimeException); + + // XUIElementSettings + virtual void SAL_CALL updateSettings( ) throw (::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); + + // XNameAccess + virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException); + + private: + virtual void impl_fillNewData(); + void fillPopupControllerCache(); + + sal_Bool m_bRefreshPopupControllerCache : 1; + com::sun::star::uno::Reference< com::sun::star::lang::XComponent > m_xMenuBarManager; + PopupControllerCache m_aPopupControllerCache; +}; + +} // namespace framework + +#endif // __FRAMEWORK_UIELEMENT_MENUBARWRAPPER_HXX_ diff --git a/framework/inc/uielement/newmenucontroller.hxx b/framework/inc/uielement/newmenucontroller.hxx new file mode 100644 index 000000000000..5e14b70f0044 --- /dev/null +++ b/framework/inc/uielement/newmenucontroller.hxx @@ -0,0 +1,136 @@ +/************************************************************************* + * + * 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_UIELEMENT_NEWMENUCONTROLLER_HXX_ +#define __FRAMEWORK_UIELEMENT_NEWMENUCONTROLLER_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <macros/xserviceinfo.hxx> +#include <stdtypes.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/frame/XDispatchProvider.hpp> +#include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/frame/XStatusListener.hpp> +#include <com/sun/star/frame/XPopupMenuController.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/ui/XAcceleratorConfiguration.hpp> + +//_________________________________________________________________________________________________________________ +// includes of other projects +//_________________________________________________________________________________________________________________ +#include <svtools/popupmenucontrollerbase.hxx> +#include <toolkit/awt/vclxmenu.hxx> +#include <cppuhelper/weak.hxx> +#include <rtl/ustring.hxx> +#include <vcl/accel.hxx> +#ifndef _VCL_MENU_HXX_ +#include <vcl/menu.hxx> +#endif +#include <hash_map> + +namespace framework +{ + struct NewDocument + { + ::com::sun::star::util::URL aTargetURL; + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aArgSeq; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > xDispatch; + }; + + class NewMenuController : public svt::PopupMenuControllerBase + { + using svt::PopupMenuControllerBase::disposing; + + public: + NewMenuController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); + virtual ~NewMenuController(); + + // XServiceInfo + DECLARE_XSERVICEINFO + + // XInitialization + virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + + // XStatusListener + virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); + + // XMenuListener + virtual void SAL_CALL select( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL activate( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException); + + // XEventListener + virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw ( ::com::sun::star::uno::RuntimeException ); + + DECL_STATIC_LINK( NewMenuController, ExecuteHdl_Impl, NewDocument* ); + + private: + virtual void impl_setPopupMenu(); + struct AddInfo + { + rtl::OUString aTargetFrame; + rtl::OUString aImageId; + }; + + typedef ::std::hash_map< int, AddInfo > AddInfoForId; + + void fillPopupMenu( com::sun::star::uno::Reference< com::sun::star::awt::XPopupMenu >& rPopupMenu ); + void retrieveShortcutsFromConfiguration( const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XAcceleratorConfiguration >& rAccelCfg, + const ::com::sun::star::uno::Sequence< rtl::OUString >& rCommands, + std::vector< KeyCode >& aMenuShortCuts ); + void setAccelerators( PopupMenu* pPopupMenu ); + void determineAndSetNewDocAccel( PopupMenu* pPopupMenu, const KeyCode& rKeyCode ); + void setMenuImages( PopupMenu* pPopupMenu, sal_Bool bSetImages, sal_Bool bHiContrast ); + + private: + // members + sal_Bool m_bShowImages : 1, + m_bHiContrast : 1, + m_bNewMenu : 1, + m_bModuleIdentified : 1, + m_bAcceleratorCfg : 1; + AddInfoForId m_aAddInfoForItem; + rtl::OUString m_aTargetFrame; + rtl::OUString m_aModuleIdentifier; + rtl::OUString m_aEmptyDocURL; + ::com::sun::star::uno::Reference< ::com::sun::star::ui::XAcceleratorConfiguration > m_xDocAcceleratorManager; + ::com::sun::star::uno::Reference< ::com::sun::star::ui::XAcceleratorConfiguration > m_xModuleAcceleratorManager; + ::com::sun::star::uno::Reference< ::com::sun::star::ui::XAcceleratorConfiguration > m_xGlobalAcceleratorManager; + }; +} + +#endif // __FRAMEWORK_UIELEMENT_NEWMENUCONTROLLER_HXX_ diff --git a/framework/inc/uielement/objectmenucontroller.hxx b/framework/inc/uielement/objectmenucontroller.hxx new file mode 100644 index 000000000000..7a03dfd1458e --- /dev/null +++ b/framework/inc/uielement/objectmenucontroller.hxx @@ -0,0 +1,86 @@ +/************************************************************************* + * + * 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_UIELEMENT_OBJECTMENUCONTROLLER_HXX_ +#define __FRAMEWORK_UIELEMENT_OBJECTMENUCONTROLLER_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <macros/xserviceinfo.hxx> +#include <stdtypes.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/frame/XStatusListener.hpp> +#include <com/sun/star/frame/XPopupMenuController.hpp> +#include <com/sun/star/embed/VerbDescriptor.hpp> + +//_________________________________________________________________________________________________________________ +// includes of other projects +//_________________________________________________________________________________________________________________ +#include <svtools/popupmenucontrollerbase.hxx> +#include <toolkit/awt/vclxmenu.hxx> +#include <cppuhelper/weak.hxx> +#include <rtl/ustring.hxx> + +namespace framework +{ + class ObjectMenuController : public svt::PopupMenuControllerBase + { + using svt::PopupMenuControllerBase::disposing; + + public: + ObjectMenuController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); + virtual ~ObjectMenuController(); + + // XServiceInfo + DECLARE_XSERVICEINFO + + // XStatusListener + virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); + + // XEventListener + virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw ( ::com::sun::star::uno::RuntimeException ); + + private: + void fillPopupMenu( const com::sun::star::uno::Sequence< com::sun::star::embed::VerbDescriptor >& rVerbCommandSeq, com::sun::star::uno::Reference< com::sun::star::awt::XPopupMenu >& rPopupMenu ); + virtual void impl_select(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch >& _xDispatch,const ::com::sun::star::util::URL& aURL); + + com::sun::star::uno::Reference< com::sun::star::frame::XDispatch > m_xObjectUpdateDispatch; + }; +} + +#endif // __FRAMEWORK_UIELEMENT_OBJECTMENUCONTROLLER_HXX_ diff --git a/framework/inc/uielement/panelwindow.hxx b/framework/inc/uielement/panelwindow.hxx new file mode 100755 index 000000000000..e1b8ae2abcc7 --- /dev/null +++ b/framework/inc/uielement/panelwindow.hxx @@ -0,0 +1,81 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: layoutmanager.hxx,v $ + * $Revision: 1.34 $ + * + * 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_LAYOUTMANAGER_PANELWINDOW_HXX_ +#define __FRAMEWORK_LAYOUTMANAGER_PANELWINDOW_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <vcl/dockwin.hxx> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework +{ + +class PanelWindow : public DockingWindow +{ + public: + PanelWindow( Window* pParent, WinBits nWinBits =0); + virtual ~PanelWindow(); + + const ::rtl::OUString& getResourceURL() const; + void setResourceURL(const ::rtl::OUString& rResourceURL); + Window* getContentWindow() const; + void setContentWindow( Window* pContentWindow ); + + virtual void Command ( const CommandEvent& rCEvt ); + virtual void StateChanged( StateChangedType nType ); + virtual void DataChanged( const DataChangedEvent& rDCEvt ); + virtual void Resize(); + + // Provide additional handlers to support external implementations + void SetCommandHdl( const Link& aLink ) { m_aCommandHandler = aLink; } + const Link& GetCommandHdl() const { return m_aCommandHandler; } + void SetStateChangedHdl( const Link& aLink ) { m_aStateChangedHandler = aLink; } + const Link& GetStateChangedHdl() const { return m_aStateChangedHandler; } + void SetDataChangedHdl( const Link& aLink ) { m_aDataChangedHandler = aLink; } + const Link& GetDataChangedHdl() { return m_aDataChangedHandler; } + + private: + ::rtl::OUString m_aResourceURL; + Link m_aCommandHandler; + Link m_aStateChangedHandler; + Link m_aDataChangedHandler; + Window* m_pContentWindow; +}; + +} + +#endif // __FRAMEWORK_UIELEMENT_PANELWINDOW_HXX_ diff --git a/framework/inc/uielement/panelwrapper.hxx b/framework/inc/uielement/panelwrapper.hxx new file mode 100755 index 000000000000..348fd679db9f --- /dev/null +++ b/framework/inc/uielement/panelwrapper.hxx @@ -0,0 +1,68 @@ + + +#ifndef __FRAMEWORK_UIELEMENT_PANELWRAPPER_HXX_ +#define __FRAMEWORK_UIELEMENT_PANELWRAPPER_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <helper/uielementwrapperbase.hxx> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ + +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ + +namespace framework +{ + +class PanelWrapper : public UIElementWrapperBase +{ + public: + PanelWrapper( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); + virtual ~PanelWrapper(); + + // XInterface + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw( ::com::sun::star::uno::RuntimeException ); + + // XComponent + virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException); + + // XInitialization + virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + + // XUIElement + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getRealInterface() throw (::com::sun::star::uno::RuntimeException); + + // XUpdatable + virtual void SAL_CALL update() throw (::com::sun::star::uno::RuntimeException); + + // XEventListener + using cppu::OPropertySetHelper::disposing; + virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException); + + //------------------------------------------------------------------------------------------------------------- + // protected methods + //------------------------------------------------------------------------------------------------------------- + protected: + virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const com::sun::star::uno::Any& aValue ) throw( com::sun::star::uno::Exception ); + + private: + com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; + com::sun::star::uno::Reference< com::sun::star::awt::XWindow > m_xPanelWindow; + bool m_bNoClose; +}; + +} + +#endif // __FRAMEWORK_UIELEMENT_PANELWRAPPER_HXX_ diff --git a/framework/inc/uielement/popupmenucontroller.hxx b/framework/inc/uielement/popupmenucontroller.hxx new file mode 100644 index 000000000000..ef44a4703ca2 --- /dev/null +++ b/framework/inc/uielement/popupmenucontroller.hxx @@ -0,0 +1,80 @@ +/************************************************************************* + * + * 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_POPUPMENUCONTROLLER_HXX_ +#define __FRAMEWORK_POPUPMENUCONTROLLER_HXX_ + +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/frame/XPopupMenuController.hpp> + +#include "svtools/toolboxcontroller.hxx" +#include "boost/scoped_ptr.hpp" + +#include <macros/xserviceinfo.hxx> + +class Window; + +namespace framework +{ +class PopupMenuControllerImpl; + +class PopupMenuController : public svt::ToolboxController, public ::com::sun::star::lang::XServiceInfo +{ +public: + PopupMenuController( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager ); + ~PopupMenuController(); + + // 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 + DECLARE_XSERVICEINFO + + // XComponent + virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException); + + // XStatusListener + virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); + + // XToolbarController + virtual void SAL_CALL execute( sal_Int16 KeyModifier ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL click() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL doubleClick() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createPopupWindow() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createItemWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& Parent ) throw (::com::sun::star::uno::RuntimeException); + + bool CreatePopupMenuController() throw (::com::sun::star::uno::Exception); + + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XPopupMenuController > mxPopupMenuController; + ::com::sun::star::uno::Reference< com::sun::star::awt::XPopupMenu > mxPopupMenu; +}; + +} // namespace framework + +#endif // __FRAMEWORK_POPUPMENUCONTROLLER_HXX_ diff --git a/framework/inc/uielement/progressbarwrapper.hxx b/framework/inc/uielement/progressbarwrapper.hxx new file mode 100644 index 000000000000..e16d050e7d42 --- /dev/null +++ b/framework/inc/uielement/progressbarwrapper.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_UIELEMENT_PROGRESSBARWRAPPER_HXX_ +#define _FRAMEWORK_UIELEMENT_PROGRESSBARWRAPPER_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <helper/uielementwrapperbase.hxx> +#include <threadhelp/threadhelpbase.hxx> +#include <macros/generic.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/debug.hxx> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/task/XStatusIndicator.hpp> +#include <com/sun/star/awt/XWindow.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <cppuhelper/weak.hxx> +#include <cppuhelper/weakref.hxx> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +class ProgressBarWrapper : public UIElementWrapperBase +{ + public: + //--------------------------------------------------------------------------------------------------------- + // constructor / destructor + //--------------------------------------------------------------------------------------------------------- + ProgressBarWrapper(); + virtual ~ProgressBarWrapper(); + + // public interfaces + void setStatusBar( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& rStatusBar, sal_Bool bOwnsInstance = sal_False ); + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > getStatusBar() const; + + // wrapped methods of ::com::sun::star::task::XStatusIndicator + void start( const ::rtl::OUString& Text, ::sal_Int32 Range ) throw (::com::sun::star::uno::RuntimeException); + void end() throw (::com::sun::star::uno::RuntimeException); + void setText( const ::rtl::OUString& Text ) throw (::com::sun::star::uno::RuntimeException); + void setValue( ::sal_Int32 Value ) throw (::com::sun::star::uno::RuntimeException); + void reset() throw (::com::sun::star::uno::RuntimeException); + + // UNO interfaces + // XComponent + virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException); + + // XInitialization + virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + + // XUpdatable + virtual void SAL_CALL update() throw (::com::sun::star::uno::RuntimeException); + + // XUIElement + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getRealInterface() throw (::com::sun::star::uno::RuntimeException); + + //------------------------------------------------------------------------------------------------------------- + // variables + // (should be private everyway!) + //------------------------------------------------------------------------------------------------------------- + private: + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > m_xStatusBar; // Reference to our status bar XWindow + ::com::sun::star::uno::WeakReference< ::com::sun::star::uno::XInterface > m_xProgressBarIfacWrapper; + sal_Bool m_bOwnsInstance; // Indicator that we are owner of the XWindow + sal_Int32 m_nRange; + sal_Int32 m_nValue; + rtl::OUString m_aText; +}; // class ProgressBarWrapper + +} // namespace framework + +#endif // _FRAMEWORK_UIELEMENT_PROGRESSBARWRAPPER_HXX_ diff --git a/framework/inc/uielement/recentfilesmenucontroller.hxx b/framework/inc/uielement/recentfilesmenucontroller.hxx new file mode 100644 index 000000000000..26a8e38dd49c --- /dev/null +++ b/framework/inc/uielement/recentfilesmenucontroller.hxx @@ -0,0 +1,121 @@ +/************************************************************************* + * + * 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_UIELEMENT_RECENTFILESMENUCONTROLLER_HXX_ +#define __FRAMEWORK_UIELEMENT_RECENTFILESMENUCONTROLLER_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <macros/xserviceinfo.hxx> +#include <stdtypes.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/frame/XDispatchProvider.hpp> +#include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/frame/XStatusListener.hpp> +#include <com/sun/star/frame/XPopupMenuController.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> + +//_________________________________________________________________________________________________________________ +// includes of other projects +//_________________________________________________________________________________________________________________ +#include <svtools/popupmenucontrollerbase.hxx> +#include <toolkit/awt/vclxmenu.hxx> +#include <cppuhelper/weak.hxx> +#include <rtl/ustring.hxx> + +namespace framework +{ + struct LoadRecentFile + { + ::com::sun::star::util::URL aTargetURL; + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aArgSeq; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > xDispatch; + }; + + class RecentFilesMenuController : public svt::PopupMenuControllerBase + { + using svt::PopupMenuControllerBase::disposing; + + public: + RecentFilesMenuController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); + virtual ~RecentFilesMenuController(); + + // XServiceInfo + DECLARE_XSERVICEINFO + + // XPopupMenuController + virtual void SAL_CALL updatePopupMenu() throw (::com::sun::star::uno::RuntimeException); + + // XStatusListener + virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); + + // XMenuListener + virtual void SAL_CALL select( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL activate( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException); + + // XDispatchProvider + virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > SAL_CALL queryDispatch( const ::com::sun::star::util::URL& aURL, const ::rtl::OUString& sTarget, sal_Int32 nFlags ) throw( ::com::sun::star::uno::RuntimeException ); + + // XDispatch + virtual void SAL_CALL dispatch( const ::com::sun::star::util::URL& aURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& seqProperties ) throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL addStatusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& xControl, const ::com::sun::star::util::URL& aURL ) throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL removeStatusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& xControl, const ::com::sun::star::util::URL& aURL ) throw( ::com::sun::star::uno::RuntimeException ); + + // XEventListener + virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw ( ::com::sun::star::uno::RuntimeException ); + + DECL_STATIC_LINK( RecentFilesMenuController, ExecuteHdl_Impl, LoadRecentFile* ); + + private: + virtual void impl_setPopupMenu(); + struct RecentFile + { + rtl::OUString aURL; + rtl::OUString aFilter; + rtl::OUString aTitle; + rtl::OUString aPassword; + }; + + void fillPopupMenu( com::sun::star::uno::Reference< com::sun::star::awt::XPopupMenu >& rPopupMenu ); + void executeEntry( sal_Int32 nIndex ); + + std::vector< RecentFile > m_aRecentFilesItems; + sal_Bool m_bDisabled : 1; + }; +} + +#endif // __FRAMEWORK_UIELEMENT_RECENTFILESMENUCONTROLLER_HXX_ diff --git a/framework/inc/uielement/rootitemcontainer.hxx b/framework/inc/uielement/rootitemcontainer.hxx new file mode 100644 index 000000000000..df2920983c3d --- /dev/null +++ b/framework/inc/uielement/rootitemcontainer.hxx @@ -0,0 +1,155 @@ +/************************************************************************* + * + * 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_UIELEMENT_ROOTITEMCONTAINER_HXX_ +#define __FRAMEWORK_UIELEMENT_ROOTITEMCONTAINER_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <threadhelp/threadhelpbase.hxx> +#include <macros/generic.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <helper/shareablemutex.hxx> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/container/XIndexContainer.hpp> +#include <com/sun/star/container/XIndexAccess.hpp> +#include <com/sun/star/lang/XSingleComponentFactory.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <rtl/ustring.hxx> +#include <cppuhelper/weak.hxx> +#include <cppuhelper/propshlp.hxx> +#include <cppuhelper/interfacecontainer.hxx> + +#include <vector> +#include <fwidllapi.h> + +namespace framework +{ +class ConstItemContainer; +class RootItemContainer : public ::com::sun::star::lang::XTypeProvider , + public ::com::sun::star::container::XIndexContainer , + public ::com::sun::star::lang::XSingleComponentFactory , + public ::com::sun::star::lang::XUnoTunnel , + protected ThreadHelpBase , + public ::cppu::OBroadcastHelper , + public ::cppu::OPropertySetHelper , + public ::cppu::OWeakObject +{ + friend class ConstItemContainer; + + public: + FWI_DLLPUBLIC RootItemContainer(); + FWI_DLLPUBLIC RootItemContainer( const ConstItemContainer& rConstItemContainer ); + FWI_DLLPUBLIC RootItemContainer( const com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess >& rItemAccessContainer ); + virtual FWI_DLLPUBLIC ~RootItemContainer(); + + //--------------------------------------------------------------------------------------------------------- + // XInterface, XTypeProvider + //--------------------------------------------------------------------------------------------------------- + FWK_DECLARE_XINTERFACE + FWK_DECLARE_XTYPEPROVIDER + + // XUnoTunnel + static FWI_DLLPUBLIC const ::com::sun::star::uno::Sequence< sal_Int8 >& GetUnoTunnelId() throw(); + static FWI_DLLPUBLIC RootItemContainer* GetImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxIFace ) throw(); + sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier ) 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) + { + return ::getCppuType((com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >*)0); + } + + virtual sal_Bool SAL_CALL hasElements() + throw (::com::sun::star::uno::RuntimeException); + + // XSingleComponentFactory + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceWithContext( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& Context ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceWithArgumentsAndContext( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Arguments, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& Context ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + + protected: + // 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(); + + private: + RootItemContainer& operator=( const RootItemContainer& ); + RootItemContainer( const RootItemContainer& ); + + void copyItemContainer( const std::vector< com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > >& rSourceVector ); + com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess > deepCopyContainer( const com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess >& rSubContainer ); + + mutable ShareableMutex m_aShareMutex; + std::vector< com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > > m_aItemVector; + rtl::OUString m_aUIName; +}; + +} + +#endif // #ifndef __FRAMEWORK_UIELEMENT_ROOTITEMCONTAINER_HXX_ diff --git a/framework/inc/uielement/simpletextstatusbarcontroller.hxx b/framework/inc/uielement/simpletextstatusbarcontroller.hxx new file mode 100644 index 000000000000..6c13b2f6ced9 --- /dev/null +++ b/framework/inc/uielement/simpletextstatusbarcontroller.hxx @@ -0,0 +1,90 @@ +/************************************************************************* + * + * 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_UIELEMENT_SIMPLETEXTSTATUSBARCONTROLLER_HXX_ +#define __FRAMEWORK_UIELEMENT_SIMPLETEXTSTATUSBARCONTROLLER_HXX_ + +#include <macros/generic.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> +#include <stdtypes.h> + +#include <hash_map> +#include <svtools/statusbarcontroller.hxx> +#include <vcl/image.hxx> + +namespace framework +{ + +class SimpleTextStatusbarController : public svt::StatusbarController +{ + public: + SimpleTextStatusbarController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); + virtual ~SimpleTextStatusbarController(); + + // XServiceInfo + DECLARE_XSERVICEINFO + + // 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 (); + + // XInitialization + virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + + // XComponent + virtual void SAL_CALL dispose() throw ( ::com::sun::star::uno::RuntimeException ); + + // XEventListener + virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw ( ::com::sun::star::uno::RuntimeException ); + + // XStatusListener + virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); + + // XStatusbarController + virtual ::sal_Bool SAL_CALL mouseButtonDown( const ::com::sun::star::awt::MouseEvent& aMouseEvent ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL mouseMove( const ::com::sun::star::awt::MouseEvent& aMouseEvent ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL mouseButtonUp( const ::com::sun::star::awt::MouseEvent& aMouseEvent ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL command( const ::com::sun::star::awt::Point& aPos, + ::sal_Int32 nCommand, + ::sal_Bool bMouseEvent, + const ::com::sun::star::uno::Any& aData ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL paint( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics >& xGraphics, + const ::com::sun::star::awt::Rectangle& rOutputRectangle, + ::sal_Int32 nItemId, ::sal_Int32 nStyle ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL click() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL doubleClick() throw (::com::sun::star::uno::RuntimeException); + + private: + rtl::OUString m_aText; +}; + +} + +#endif // __FRAMEWORK_UIELEMENT_SIMPLETEXTSTATUSBARCONTROLLER_HXX_ diff --git a/framework/inc/uielement/spinfieldtoolbarcontroller.hxx b/framework/inc/uielement/spinfieldtoolbarcontroller.hxx new file mode 100644 index 000000000000..cd86f5951b74 --- /dev/null +++ b/framework/inc/uielement/spinfieldtoolbarcontroller.hxx @@ -0,0 +1,115 @@ +/************************************************************************* + * + * 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_UIELEMENT_SPINFIELDTOOLBARCONTROLLER_HXX_ +#define __FRAMEWORK_UIELEMENT_SPINFIELDTOOLBARCONTROLLER_HXX_ + +#include <com/sun/star/beans/NamedValue.hpp> +#include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/frame/ControlCommand.hpp> + +//_________________________________________________________________________________________________________________ +// includes of other projects +//_________________________________________________________________________________________________________________ + +#include <uielement/complextoolbarcontroller.hxx> +#include <vcl/toolbox.hxx> +#include <vcl/spinfld.hxx> + +namespace framework +{ + +class ToolBar; +class SpinfieldControl; + +class ISpinfieldListener +{ + public: + virtual void Up() = 0; + virtual void Down() = 0; + virtual void First() = 0; + virtual void Last() = 0; + virtual void KeyInput( const KeyEvent& rKEvt ) = 0; + virtual void Modify() = 0; + virtual void GetFocus() = 0; + virtual void LoseFocus() = 0; + virtual void StateChanged( StateChangedType nType ) = 0; + virtual void DataChanged( const DataChangedEvent& rDCEvt ) = 0; + virtual long PreNotify( NotifyEvent& rNEvt ) = 0; + }; + +class SpinfieldToolbarController : public ISpinfieldListener, + public ComplexToolbarController + +{ + public: + SpinfieldToolbarController( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager, + const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame, + ToolBox* pToolBar, + sal_uInt16 nID, + sal_Int32 nWidth, + const rtl::OUString& aCommand ); + virtual ~SpinfieldToolbarController(); + + // XComponent + virtual void SAL_CALL dispose() throw ( ::com::sun::star::uno::RuntimeException ); + + // ISpinfieldListener + virtual void Up(); + virtual void Down(); + virtual void First(); + virtual void Last(); + virtual void KeyInput( const KeyEvent& rKEvt ); + virtual void Modify(); + virtual void GetFocus(); + virtual void LoseFocus(); + virtual void StateChanged( StateChangedType nType ); + virtual void DataChanged( const DataChangedEvent& rDCEvt ); + virtual long PreNotify( NotifyEvent& rNEvt ); + + protected: + virtual void executeControlCommand( const ::com::sun::star::frame::ControlCommand& rControlCommand ); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue> getExecuteArgs(sal_Int16 KeyModifier) const; + + private: + bool impl_getValue( const ::com::sun::star::uno::Any& rAny, sal_Int32& nValue, double& fValue, bool& bFloat ); + rtl::OUString impl_formatOutputString( double fValue ); + + bool m_bFloat, + m_bMaxSet, + m_bMinSet; + double m_nMax; + double m_nMin; + double m_nValue; + double m_nStep; + SpinfieldControl* m_pSpinfieldControl; + rtl::OUString m_aOutFormat; +}; + +} + +#endif // __FRAMEWORK_UIELEMENT_SPINFIELDTOOLBARCONTROLLER_HXX_ diff --git a/framework/inc/uielement/statusbar.hxx b/framework/inc/uielement/statusbar.hxx new file mode 100644 index 000000000000..70ea373917eb --- /dev/null +++ b/framework/inc/uielement/statusbar.hxx @@ -0,0 +1,76 @@ +/************************************************************************* + * + * 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_UIELEMENT_STATUSBAR_HXX_ +#define __FRAMEWORK_UIELEMENT_STATUSBAR_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <uielement/statusbarmanager.hxx> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ + +#include <vcl/status.hxx> + +namespace framework +{ + +class FrameworkStatusBar : public StatusBar +{ + public: + + FrameworkStatusBar( Window* pParent, + WinBits nWinBits ); + virtual ~FrameworkStatusBar(); + + void SetStatusBarManager( StatusBarManager* pStatusBarManager ); + + virtual void StateChanged( StateChangedType nType ); + virtual void DataChanged( const DataChangedEvent& rDCEvt ); + virtual void UserDraw(const UserDrawEvent& rUDEvt); + virtual void Command( const CommandEvent &rEvt ); + virtual void MouseMove( const MouseEvent& rMEvt ); + virtual void MouseButtonDown( const MouseEvent& rMEvt ); + virtual void MouseButtonUp( const MouseEvent& rMEvt ); + + private: + StatusBarManager* m_pMgr; + sal_Bool m_bShow : 1, + m_bLock : 1; +}; + +} + +#endif // __FRAMEWORK_UIELEMENT_STATUSBAR_HXX_ diff --git a/framework/inc/uielement/statusbarmanager.hxx b/framework/inc/uielement/statusbarmanager.hxx new file mode 100644 index 000000000000..cfcb71960304 --- /dev/null +++ b/framework/inc/uielement/statusbarmanager.hxx @@ -0,0 +1,143 @@ +/************************************************************************* + * + * 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_UIELEMENT_STATUSBARMANAGER_HXX_ +#define __FRAMEWORK_UIELEMENT_STATUSBARMANAGER_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <threadhelp/threadhelpbase.hxx> +#include <macros/generic.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <stdtypes.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/frame/XStatusListener.hpp> +#include <com/sun/star/frame/XStatusbarController.hpp> +#include <com/sun/star/frame/XUIControllerRegistration.hpp> +#include <com/sun/star/ui/XUIConfiguration.hpp> +#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/container/XNameAccess.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <rtl/ustring.hxx> +#include <cppuhelper/weak.hxx> +#include <cppuhelper/interfacecontainer.hxx> +#include <vcl/status.hxx> + +namespace framework +{ + +class FrameworkStatusBar; +class StatusBarManager : public ::com::sun::star::frame::XFrameActionListener , + public ::com::sun::star::lang::XComponent , + public ::com::sun::star::lang::XTypeProvider , + public ::com::sun::star::ui::XUIConfigurationListener, + public ThreadHelpBase , + public ::cppu::OWeakObject +{ + friend class FrameworkStatusBar; + + public: + StatusBarManager( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServicveManager, + const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame, + const rtl::OUString& rResourceName, + StatusBar* pStatusBar ); + virtual ~StatusBarManager(); + + // XInterface, XTypeProvider, XServiceInfo + FWK_DECLARE_XINTERFACE + FWK_DECLARE_XTYPEPROVIDER + + StatusBar* GetStatusBar() const; + + // XFrameActionListener + virtual void SAL_CALL frameAction( const com::sun::star::frame::FrameActionEvent& Action ) throw ( ::com::sun::star::uno::RuntimeException ); + + // XEventListener + virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw ( ::com::sun::star::uno::RuntimeException ); + + // XUIConfigurationListener + virtual void SAL_CALL elementInserted( const ::com::sun::star::ui::ConfigurationEvent& Event ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL elementRemoved( const ::com::sun::star::ui::ConfigurationEvent& Event ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL elementReplaced( const ::com::sun::star::ui::ConfigurationEvent& Event ) throw (::com::sun::star::uno::RuntimeException); + + // XComponent + void SAL_CALL dispose() throw ( ::com::sun::star::uno::RuntimeException ); + void SAL_CALL addEventListener( const com::sun::star::uno::Reference< XEventListener >& xListener ) throw( com::sun::star::uno::RuntimeException ); + void SAL_CALL removeEventListener( const com::sun::star::uno::Reference< XEventListener >& xListener ) throw( com::sun::star::uno::RuntimeException ); + + void FillStatusBar( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& rStatusBarData ); + + protected: + void StateChanged( StateChangedType nType ); + void DataChanged( const DataChangedEvent& rDCEvt ); + void UserDraw( const UserDrawEvent& rUDEvt ); + void Command( const CommandEvent& rEvt ); + void MouseMove( const MouseEvent& rMEvt ); + void MouseButtonDown( const MouseEvent& rMEvt ); + void MouseButtonUp( const MouseEvent& rMEvt ); + DECL_LINK( Click, StatusBar* ); + DECL_LINK( DoubleClick, StatusBar* ); + + void RemoveControllers(); + rtl::OUString RetrieveLabelFromCommand( const rtl::OUString& aCmdURL ); + void CreateControllers(); + void UpdateControllers(); + void AddFrameActionListener(); + void MouseButton( const MouseEvent& rMEvt ,sal_Bool ( SAL_CALL ::com::sun::star::frame::XStatusbarController::*_pMethod )(const ::com::sun::star::awt::MouseEvent&)); + + protected: + typedef std::vector< ::com::sun::star::uno::Reference< com::sun::star::frame::XStatusListener > > StatusBarControllerVector; + + sal_Bool m_bDisposed : 1, + m_bFrameActionRegistered : 1, + m_bUpdateControllers : 1; + sal_Bool m_bModuleIdentified; + StatusBar* m_pStatusBar; + rtl::OUString m_aModuleIdentifier; + rtl::OUString m_aResourceName; + com::sun::star::uno::Reference< com::sun::star::frame::XFrame > m_xFrame; + com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > m_xUICommandLabels; + StatusBarControllerVector m_aControllerVector; + ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; /// container for ALL Listener + ::com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XUIControllerRegistration > m_xStatusbarControllerRegistration; +}; + +} + +#endif // __FRAMEWORK_UIELEMENT_STATUSBARMANAGER_HXX_ diff --git a/framework/inc/uielement/statusbarwrapper.hxx b/framework/inc/uielement/statusbarwrapper.hxx new file mode 100644 index 000000000000..7bb1a0bee352 --- /dev/null +++ b/framework/inc/uielement/statusbarwrapper.hxx @@ -0,0 +1,77 @@ +/************************************************************************* + * + * 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_UIELEMENT_STATUSBARWRAPPER_HXX_ +#define __FRAMEWORK_UIELEMENT_STATUSBARWRAPPER_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <helper/uiconfigelementwrapperbase.hxx> +#include <uielement/statusbarmanager.hxx> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ + +namespace framework +{ + +class StatusBarWrapper : public UIConfigElementWrapperBase +{ + public: + StatusBarWrapper( + const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); + virtual ~StatusBarWrapper(); + + // XComponent + virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException); + + // XInitialization + virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + + // XUIElement + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getRealInterface() throw (::com::sun::star::uno::RuntimeException); + + // XUIElementSettings + virtual void SAL_CALL updateSettings() throw (::com::sun::star::uno::RuntimeException); + + private: + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > m_xStatusBarManager; +}; + +} // namespace framework + +#endif // __FRAMEWORK_UIELEMENT_STATUSBARWRAPPER_HXX_ diff --git a/framework/inc/uielement/statusindicatorinterfacewrapper.hxx b/framework/inc/uielement/statusindicatorinterfacewrapper.hxx new file mode 100644 index 000000000000..085d2d58ffa9 --- /dev/null +++ b/framework/inc/uielement/statusindicatorinterfacewrapper.hxx @@ -0,0 +1,82 @@ +/************************************************************************* + * + * 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_UIELEMENT_STATUSINDICATORINTERFACEWRAPPER_HXX_ +#define __FRAMEWORK_UIELEMENT_STATUSINDICATORINTERFACEWRAPPER_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <threadhelp/threadhelpbase.hxx> +#include <macros/generic.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/task/XStatusIndicator.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/lang/XComponent.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <rtl/ustring.hxx> +#include <cppuhelper/implbase1.hxx> + +#include <vector> + +namespace framework +{ + +class StatusIndicatorInterfaceWrapper : public ::cppu::WeakImplHelper1< ::com::sun::star::task::XStatusIndicator> +{ + public: + StatusIndicatorInterfaceWrapper( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& rStatusIndicatorImpl ); + virtual ~StatusIndicatorInterfaceWrapper(); + + //--------------------------------------------------------------------------------------------------------- + // XStatusIndicator + //--------------------------------------------------------------------------------------------------------- + virtual void SAL_CALL start ( const ::rtl::OUString& sText , + sal_Int32 nRange ) throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL end ( ) throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL reset ( ) throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL setText ( const ::rtl::OUString& sText ) throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL setValue( sal_Int32 nValue ) throw( ::com::sun::star::uno::RuntimeException ); + + private: + StatusIndicatorInterfaceWrapper(); + + ::com::sun::star::uno::WeakReference< ::com::sun::star::lang::XComponent > m_xStatusIndicatorImpl; +}; + +} + +#endif // __FRAMEWORK_UIELEMENT_STATUSINDICATORINTERFACEWRAPPER_HXX_ diff --git a/framework/inc/uielement/togglebuttontoolbarcontroller.hxx b/framework/inc/uielement/togglebuttontoolbarcontroller.hxx new file mode 100644 index 000000000000..d8748648af58 --- /dev/null +++ b/framework/inc/uielement/togglebuttontoolbarcontroller.hxx @@ -0,0 +1,86 @@ +/************************************************************************* + * + * 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_UIELEMENT_TOGGLEBUTTONTOOLBARCONTROLLER_HXX_ +#define __FRAMEWORK_UIELEMENT_TOGGLEBUTTONTOOLBARCONTROLLER_HXX_ + +#include <com/sun/star/beans/NamedValue.hpp> +#include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/frame/ControlCommand.hpp> + +//_________________________________________________________________________________________________________________ +// includes of other projects +//_________________________________________________________________________________________________________________ + +#include <uielement/complextoolbarcontroller.hxx> +#include <vcl/toolbox.hxx> +#include <vcl/image.hxx> + +namespace framework +{ + +class ToolBar; +class ToggleButtonToolbarController : public ComplexToolbarController + +{ + public: + enum Style + { + STYLE_TOGGLEBUTTON, + STYLE_DROPDOWNBUTTON, + STYLE_TOGGLE_DROPDOWNBUTTON + }; + + ToggleButtonToolbarController( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager, + const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame, + ToolBox* pToolBar, + sal_uInt16 nID, + Style eStyle, + const rtl::OUString& aCommand ); + virtual ~ToggleButtonToolbarController(); + + // XComponent + virtual void SAL_CALL dispose() throw ( ::com::sun::star::uno::RuntimeException ); + + // XToolbarController + virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createPopupWindow() throw (::com::sun::star::uno::RuntimeException); + + protected: + virtual void executeControlCommand( const ::com::sun::star::frame::ControlCommand& rControlCommand ); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue> getExecuteArgs(sal_Int16 KeyModifier) const; + + private: + DECL_LINK( MenuSelectHdl, Menu *); + + Style m_eStyle; + rtl::OUString m_aCurrentSelection; + std::vector< rtl::OUString > m_aDropdownMenuList; +}; + +} + +#endif // __FRAMEWORK_UIELEMENT_TOGGLEBUTTONTOOLBARCONTROLLER_HXX_ diff --git a/framework/inc/uielement/toolbar.hxx b/framework/inc/uielement/toolbar.hxx new file mode 100644 index 000000000000..a5329bab3f75 --- /dev/null +++ b/framework/inc/uielement/toolbar.hxx @@ -0,0 +1,73 @@ +/************************************************************************* + * + * 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. + * + ************************************************************************/ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + + +#ifndef __FRAMEWORK_UIELEMENT_TOOLBAR_HXX_ +#define __FRAMEWORK_UIELEMENT_TOOLBAR_HXX_ + +#include <vcl/toolbox.hxx> + +namespace framework +{ + +class ToolBarManager; +class ToolBar : public ToolBox +{ + public: + ToolBar( Window* pParent, WinBits nWinBits ); + virtual ~ToolBar(); + + virtual void Command ( const CommandEvent& rCEvt ); + virtual void StateChanged( StateChangedType nType ); + virtual void DataChanged( const DataChangedEvent& rDCEvt ); + + // Toolbar manager + void SetToolBarManager( ToolBarManager* pTbMgr ); + ToolBarManager* GetToolBarManager() const { return m_pToolBarManager; } + + // Provide additional handlers to support external implementations + void SetCommandHdl( const Link& aLink ) { m_aCommandHandler = aLink; } + const Link& GetCommandHdl() const { return m_aCommandHandler; } + void SetStateChangedHdl( const Link& aLink ) { m_aStateChangedHandler = aLink; } + const Link& GetStateChangedHdl() const { return m_aStateChangedHandler; } + void SetDataChangedHdl( const Link& aLink ) { m_aDataChangedHandler = aLink; } + const Link& GetDataChangedHdl() { return m_aDataChangedHandler; } + + private: + Link m_aCommandHandler; + Link m_aStateChangedHandler; + Link m_aDataChangedHandler; + ToolBarManager* m_pToolBarManager; +}; + +} + +#endif // __FRAMEWORK_UIELEMENT_TOOLBAR_HXX_ diff --git a/framework/inc/uielement/toolbarmanager.hxx b/framework/inc/uielement/toolbarmanager.hxx new file mode 100644 index 000000000000..5e780edb366b --- /dev/null +++ b/framework/inc/uielement/toolbarmanager.hxx @@ -0,0 +1,257 @@ +/************************************************************************* + * + * 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_UIELEMENT_TOOLBARMANAGER_HXX_ +#define __FRAMEWORK_UIELEMENT_TOOLBARMANAGER_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <threadhelp/threadhelpbase.hxx> +#include <macros/generic.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <stdtypes.h> +#include <uielement/commandinfo.hxx> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/frame/XStatusListener.hpp> +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/container/XIndexAccess.hpp> +#include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/container/XIndexContainer.hpp> +#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/frame/XUIControllerRegistration.hpp> +#include <com/sun/star/ui/XImageManager.hpp> +#include <com/sun/star/ui/XUIConfigurationManager.hpp> +#include <com/sun/star/frame/XStatusListener.hpp> +#include <com/sun/star/frame/XSubToolbarController.hpp> +#include <com/sun/star/frame/XToolbarController.hpp> +#include <com/sun/star/ui/ItemStyle.hpp> +#include <com/sun/star/util/XURLTransformer.hpp> +#include <com/sun/star/ui/XAcceleratorConfiguration.hpp> + +//shizhoubo +#include <com/sun/star/frame/XToolbarController.hpp> +//end +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <rtl/ustring.hxx> +#include <cppuhelper/weak.hxx> +#include <cppuhelper/interfacecontainer.hxx> + +#include <vcl/toolbox.hxx> +#include <vcl/accel.hxx> + +namespace com +{ + namespace sun + { + namespace star + { + namespace frame + { + class XLayoutManager; + } + } + } +} + +namespace framework +{ + +class ToolBar; +class ToolBarManager : public ::com::sun::star::frame::XFrameActionListener , + public ::com::sun::star::frame::XStatusListener , + public ::com::sun::star::lang::XComponent , + public ::com::sun::star::lang::XTypeProvider , + public ::com::sun::star::ui::XUIConfigurationListener, + public ThreadHelpBase , + public ::cppu::OWeakObject +{ + public: + ToolBarManager( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServicveManager, + const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame, + const rtl::OUString& rResourceName, + ToolBar* pToolBar ); + virtual ~ToolBarManager(); + + // XInterface, XTypeProvider, XServiceInfo + FWK_DECLARE_XINTERFACE + FWK_DECLARE_XTYPEPROVIDER + + ToolBox* GetToolBar() const; + + // XFrameActionListener + virtual void SAL_CALL frameAction( const com::sun::star::frame::FrameActionEvent& Action ) throw ( ::com::sun::star::uno::RuntimeException ); + + // XStatusListener + virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); + + // XEventListener + virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw ( ::com::sun::star::uno::RuntimeException ); + + // XUIConfigurationListener + virtual void SAL_CALL elementInserted( const ::com::sun::star::ui::ConfigurationEvent& Event ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL elementRemoved( const ::com::sun::star::ui::ConfigurationEvent& Event ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL elementReplaced( const ::com::sun::star::ui::ConfigurationEvent& Event ) throw (::com::sun::star::uno::RuntimeException); + + // XComponent + void SAL_CALL dispose() throw ( ::com::sun::star::uno::RuntimeException ); + void SAL_CALL addEventListener( const com::sun::star::uno::Reference< XEventListener >& xListener ) throw( com::sun::star::uno::RuntimeException ); + void SAL_CALL removeEventListener( const com::sun::star::uno::Reference< XEventListener >& xListener ) throw( com::sun::star::uno::RuntimeException ); + + void CheckAndUpdateImages(); + virtual void RefreshImages(); + void FillToolbar( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& rToolBarData ); + void notifyRegisteredControllers( const rtl::OUString& aUIElementName, const rtl::OUString& aCommand ); + void Destroy(); + + enum ExecuteCommand + { + EXEC_CMD_CLOSETOOLBAR, + EXEC_CMD_DOCKTOOLBAR, + EXEC_CMD_DOCKALLTOOLBARS, + EXEC_CMD_NONE, + EXEC_CMD_COUNT + }; + + struct ExecuteInfo + { + rtl::OUString aToolbarResName; + ExecuteCommand nCmd; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XLayoutManager > xLayoutManager; + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xWindow; + }; + struct ControllerParams + { + sal_Int16 nWidth; + }; + typedef std::vector< ControllerParams > ControllerParamsVector; + + protected: + //added for 33668 by shizhoubo : 2008:04 + DECL_LINK( Command, CommandEvent * ); + PopupMenu * GetToolBarCustomMeun(ToolBox* pToolBar); + //end + DECL_LINK( Click, ToolBox * ); + DECL_LINK( DropdownClick, ToolBox * ); + DECL_LINK( DoubleClick, ToolBox * ); + DECL_LINK( Select, ToolBox * ); + DECL_LINK( Highlight, ToolBox * ); + DECL_LINK( Activate, ToolBox * ); + DECL_LINK( Deactivate, ToolBox * ); + DECL_LINK( StateChanged, StateChangedType* ); + DECL_LINK( DataChanged, DataChangedEvent* ); + + DECL_LINK( MenuButton, ToolBox * ); + DECL_LINK( MenuSelect, Menu * ); + DECL_LINK( MenuDeactivate, Menu * ); + DECL_LINK( AsyncUpdateControllersHdl, Timer * ); + DECL_STATIC_LINK( ToolBarManager, ExecuteHdl_Impl, ExecuteInfo* ); + + virtual bool MenuItemAllowed( sal_uInt16 ) const; + + void RemoveControllers(); + rtl::OUString RetrieveLabelFromCommand( const rtl::OUString& aCmdURL ); + sal_Int32 RetrievePropertiesFromCommand( const rtl::OUString& aCmdURL ); + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > GetPropsForCommand( const ::rtl::OUString& rCmdURL ); + void CreateControllers(); + void UpdateControllers(); + //for update controller via Support Visiable by shizhoubo + void UpdateController( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XToolbarController > xController); + //end + void AddFrameActionListener(); + void AddImageOrientationListener(); + void UpdateImageOrientation(); + void ImplClearPopupMenu( ToolBox *pToolBar ); + void RequestImages(); + sal_uInt16 ConvertStyleToToolboxItemBits( sal_Int32 nStyle ); + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > GetModelFromFrame() const; + sal_Bool IsPluginMode() const; + Image QueryAddonsImage( const ::rtl::OUString& aCommandURL, bool bBigImages, bool bHiContrast ); + long HandleClick(void ( SAL_CALL ::com::sun::star::frame::XToolbarController::*_pClick )( )); + void setToolBarImage(const Image& _aImage,const CommandToInfoMap::const_iterator& _pIter); + void impl_elementChanged(bool _bRemove,const ::com::sun::star::ui::ConfigurationEvent& Event ); + + static bool impl_RetrieveShortcutsFromConfiguration( const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XAcceleratorConfiguration >& rAccelCfg, const rtl::OUString& rCommand, rtl::OUString& rShortCut ); + bool RetrieveShortcut( const rtl::OUString& rCommandURL, rtl::OUString& rShortCut ); + + protected: + typedef ::std::hash_map< sal_uInt16, ::com::sun::star::uno::Reference< com::sun::star::frame::XStatusListener > > ToolBarControllerMap; + typedef ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::frame::XSubToolbarController > > SubToolBarControllerVector; + typedef BaseHash< SubToolBarControllerVector > SubToolBarToSubToolBarControllerMap; + + typedef ::std::hash_map< sal_uInt16, ::com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess > > MenuDescriptionMap; + sal_Bool m_bDisposed : 1, + m_bIsHiContrast : 1, + m_bSmallSymbols : 1, + m_bModuleIdentified : 1, + m_bAddedToTaskPaneList : 1, + m_bVerticalTextEnabled : 1, + m_bFrameActionRegistered : 1, + m_bUpdateControllers : 1; + sal_Bool m_bImageOrientationRegistered : 1, + m_bImageMirrored : 1, + m_bCanBeCustomized : 1; + long m_lImageRotation; + ToolBar* m_pToolBar; + rtl::OUString m_aModuleIdentifier; + rtl::OUString m_aResourceName; + com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer > m_xURLTransformer; + com::sun::star::uno::Reference< com::sun::star::frame::XFrame > m_xFrame; + com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > m_xUICommandLabels; + ToolBarControllerMap m_aControllerMap; + ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; /// container for ALL Listener + ::com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XUIControllerRegistration > m_xToolbarControllerRegistration; + ::com::sun::star::uno::Reference< ::com::sun::star::ui::XImageManager > m_xModuleImageManager; + ::com::sun::star::uno::Reference< ::com::sun::star::ui::XImageManager > m_xDocImageManager; + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > m_xImageOrientationListener; + ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIConfigurationManager > m_xUICfgMgr; + ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIConfigurationManager > m_xDocUICfgMgr; + + CommandToInfoMap m_aCommandMap; + SubToolBarToSubToolBarControllerMap m_aSubToolBarControllerMap; + Timer m_aAsyncUpdateControllersTimer; + sal_Int16 m_nSymbolsStyle; + MenuDescriptionMap m_aMenuMap; + sal_Bool m_bAcceleratorCfg; + ::com::sun::star::uno::Reference< ::com::sun::star::ui::XAcceleratorConfiguration > m_xDocAcceleratorManager; + ::com::sun::star::uno::Reference< ::com::sun::star::ui::XAcceleratorConfiguration > m_xModuleAcceleratorManager; + ::com::sun::star::uno::Reference< ::com::sun::star::ui::XAcceleratorConfiguration > m_xGlobalAcceleratorManager; +}; + +} + +#endif // __FRAMEWORK_UIELEMENT_TOOLBARMANAGER_HXX_ diff --git a/framework/inc/uielement/toolbarmerger.hxx b/framework/inc/uielement/toolbarmerger.hxx new file mode 100644 index 000000000000..12301f170f26 --- /dev/null +++ b/framework/inc/uielement/toolbarmerger.hxx @@ -0,0 +1,161 @@ +/************************************************************************* + * + * 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_UIELEMENT_TOOLBARMERGER_HXX_ +#define __FRAMEWORK_UIELEMENT_TOOLBARMERGER_HXX_ + +#include <uielement/comboboxtoolbarcontroller.hxx> +#include <uielement/imagebuttontoolbarcontroller.hxx> +#include <uielement/togglebuttontoolbarcontroller.hxx> +#include <uielement/buttontoolbarcontroller.hxx> +#include <uielement/spinfieldtoolbarcontroller.hxx> +#include <uielement/edittoolbarcontroller.hxx> +#include <uielement/dropdownboxtoolbarcontroller.hxx> +#include <uielement/commandinfo.hxx> + +#include <com/sun/star/beans/PropertyValue.hpp> + +#include <svtools/toolboxcontroller.hxx> + +#include <rtl/ustring.hxx> +#include <vcl/toolbox.hxx> + +namespace framework +{ + +struct AddonsParams +{ + ::rtl::OUString aImageId; + ::rtl::OUString aTarget; + ::rtl::OUString aControlType; +}; + +struct AddonToolbarItem +{ + ::rtl::OUString aCommandURL; + ::rtl::OUString aLabel; + ::rtl::OUString aImageIdentifier; + ::rtl::OUString aTarget; + ::rtl::OUString aContext; + ::rtl::OUString aControlType; + sal_uInt16 nWidth; +}; + +typedef ::std::vector< AddonToolbarItem > AddonToolbarItemContainer; + +struct ReferenceToolbarPathInfo +{ + ToolBox* pToolbar; + sal_uInt16 nPos; + bool bResult; +}; + +class ToolBarMerger +{ + public: + static bool IsCorrectContext( const ::rtl::OUString& aContext, const ::rtl::OUString& aModuleIdentifier ); + + static bool ConvertSeqSeqToVector( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > > rSequence, + AddonToolbarItemContainer& rContainer ); + + static void ConvertSequenceToValues( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > rSequence, + ::rtl::OUString& rCommandURL, + ::rtl::OUString& rLabel, + ::rtl::OUString& rImageIdentifier, + ::rtl::OUString& rTarget, + ::rtl::OUString& rContext, + ::rtl::OUString& rControlType, + sal_uInt16& rWidth ); + + static ReferenceToolbarPathInfo FindReferencePoint( ToolBox* pToolbar, + const ::rtl::OUString& rReferencePoint ); + + static bool ProcessMergeOperation( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame, + ToolBox* pToolbar, + sal_uInt16 nPos, + sal_uInt16& rItemId, + CommandToInfoMap& rCommandMap, + const ::rtl::OUString& rModuleIdentifier, + const ::rtl::OUString& rMergeCommand, + const ::rtl::OUString& rMergeCommandParameter, + const AddonToolbarItemContainer& rItems ); + + static bool ProcessMergeFallback( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame, + ToolBox* pToolbar, + sal_uInt16 nPos, + sal_uInt16& rItemId, + CommandToInfoMap& rCommandMap, + const ::rtl::OUString& rModuleIdentifier, + const ::rtl::OUString& rMergeCommand, + const ::rtl::OUString& rMergeFallback, + const AddonToolbarItemContainer& rItems ); + + static bool MergeItems( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame, + ToolBox* pToolbar, + sal_uInt16 nPos, + sal_uInt16 nModIndex, + sal_uInt16& rItemId, + CommandToInfoMap& rCommandMap, + const ::rtl::OUString& rModuleIdentifier, + const AddonToolbarItemContainer& rAddonToolbarItems ); + + static bool ReplaceItem( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame, + ToolBox* pToolbar, + sal_uInt16 nPos, + sal_uInt16& rItemId, + CommandToInfoMap& rCommandMap, + const ::rtl::OUString& rModuleIdentifier, + const AddonToolbarItemContainer& rAddonToolbarItems ); + + static bool RemoveItems( ToolBox* pToolbar, + sal_uInt16 nPos, + const ::rtl::OUString& rMergeCommandParameter ); + + static ::cppu::OWeakObject* CreateController( + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xSMGR, + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xFrame, + ToolBox* pToolbar, + const ::rtl::OUString& rCommandURL, + sal_uInt16 nId, + sal_uInt16 nWidth, + const ::rtl::OUString& rControlType ); + + static void CreateToolbarItem( ToolBox* pToolbox, + CommandToInfoMap& rCommandMap, + sal_uInt16 nPos, + sal_uInt16 nItemId, + const AddonToolbarItem& rAddonToolbarItem ); + + private: + ToolBarMerger(); + ToolBarMerger( const ToolBarMerger& ); + ToolBarMerger& operator=( const ToolBarMerger& ); +}; + +} // namespace framework + +#endif // __FRAMEWORK_UIELEMENT_TOOLBARMERGER_HXX_ diff --git a/framework/inc/uielement/toolbarsmenucontroller.hxx b/framework/inc/uielement/toolbarsmenucontroller.hxx new file mode 100644 index 000000000000..169923b00e47 --- /dev/null +++ b/framework/inc/uielement/toolbarsmenucontroller.hxx @@ -0,0 +1,125 @@ +/************************************************************************* + * + * 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_UIELEMENT_TOOLBARSMENUCONTROLLER_HXX_ +#define __FRAMEWORK_UIELEMENT_TOOLBARSMENUCONTROLLER_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <macros/xserviceinfo.hxx> +#include <stdtypes.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/frame/XStatusListener.hpp> +#include <com/sun/star/frame/XPopupMenuController.hpp> +#include <com/sun/star/frame/XLayoutManager.hpp> +#include <com/sun/star/frame/XModel.hpp> +#include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/ui/XUIConfigurationManager.hpp> + +//_________________________________________________________________________________________________________________ +// includes of other projects +//_________________________________________________________________________________________________________________ +#include <svtools/popupmenucontrollerbase.hxx> +#include <toolkit/awt/vclxmenu.hxx> +#include <cppuhelper/weak.hxx> +#include <rtl/ustring.hxx> +#include <unotools/intlwrapper.hxx> + +#include <vector> + +namespace framework +{ + class ToolbarsMenuController : public svt::PopupMenuControllerBase + { + using svt::PopupMenuControllerBase::disposing; + + public: + ToolbarsMenuController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); + virtual ~ToolbarsMenuController(); + + // XServiceInfo + DECLARE_XSERVICEINFO + + // XPopupMenuController + virtual void SAL_CALL setPopupMenu( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu >& PopupMenu ) throw (::com::sun::star::uno::RuntimeException); + + // XInitialization + virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + + // XStatusListener + virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); + + // XMenuListener + virtual void SAL_CALL select( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL activate( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException); + + // XEventListener + virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw ( ::com::sun::star::uno::RuntimeException ); + + struct ExecuteInfo + { + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > xDispatch; + ::com::sun::star::util::URL aTargetURL; + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aArgs; + }; + + DECL_STATIC_LINK( ToolbarsMenuController, ExecuteHdl_Impl, ExecuteInfo* ); + + private: + void fillPopupMenu( com::sun::star::uno::Reference< com::sun::star::awt::XPopupMenu >& rPopupMenu ); + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > > getLayoutManagerToolbars( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XLayoutManager >& rLayoutManager ); + rtl::OUString getUINameFromCommand( const rtl::OUString& rCommandURL ); + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > getDispatchFromCommandURL( const rtl::OUString& rCommandURL ); + void addCommand( com::sun::star::uno::Reference< com::sun::star::awt::XPopupMenu >& rPopupMenu, const rtl::OUString& rCommandURL, const rtl::OUString& aLabel ); + sal_Bool isContextSensitiveToolbarNonVisible(); + + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xPersistentWindowState; + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xUICommandDescription; + ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIConfigurationManager > m_xModuleCfgMgr; + ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIConfigurationManager > m_xDocCfgMgr; + rtl::OUString m_aModuleIdentifier; + rtl::OUString m_aPropUIName; + rtl::OUString m_aPropResourceURL; + sal_Bool m_bModuleIdentified; + sal_Bool m_bResetActive; + std::vector< rtl::OUString > m_aCommandVector; + IntlWrapper m_aIntlWrapper; + }; +} + +#endif // __FRAMEWORK_UIELEMENT_TOOLBARSMENUCONTROLLER_HXX_ diff --git a/framework/inc/uielement/toolbarwrapper.hxx b/framework/inc/uielement/toolbarwrapper.hxx new file mode 100644 index 000000000000..06e99d2017b4 --- /dev/null +++ b/framework/inc/uielement/toolbarwrapper.hxx @@ -0,0 +1,101 @@ +/************************************************************************* + * + * 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_UIELEMENT_TOOLBARWRAPPER_HXX_ +#define __FRAMEWORK_UIELEMENT_TOOLBARWRAPPER_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <helper/uiconfigelementwrapperbase.hxx> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/ui/XUIFunctionListener.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ + +namespace framework +{ + +class ToolBarManager; +class ToolBarWrapper : public ::com::sun::star::ui::XUIFunctionListener, + public UIConfigElementWrapperBase +{ + public: + ToolBarWrapper( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); + virtual ~ToolBarWrapper(); + + // XInterface + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw( ::com::sun::star::uno::RuntimeException ); + + // XComponent + virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException); + + // XInitialization + virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + + // XUIElement + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getRealInterface() throw (::com::sun::star::uno::RuntimeException); + + // XUpdatable + virtual void SAL_CALL update() throw (::com::sun::star::uno::RuntimeException); + + // XUIElementSettings + virtual void SAL_CALL updateSettings() throw (::com::sun::star::uno::RuntimeException); + + // XUIFunctionListener + virtual void SAL_CALL functionExecute( const ::rtl::OUString& aUIElementName, const ::rtl::OUString& aCommand ) throw (::com::sun::star::uno::RuntimeException); + + // XEventListener + using cppu::OPropertySetHelper::disposing; + virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException); + + //------------------------------------------------------------------------------------------------------------- + // protected methods + //------------------------------------------------------------------------------------------------------------- + protected: + virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const com::sun::star::uno::Any& aValue ) throw( com::sun::star::uno::Exception ); + virtual void impl_fillNewData(); + + private: + com::sun::star::uno::Reference< com::sun::star::lang::XComponent > m_xToolBarManager; + com::sun::star::uno::Reference< com::sun::star::awt::XWindow > m_xToolBarWindow; +}; + +} + +#endif // __FRAMEWORK_UIELEMENT_TOOLBARWRAPPER_HXX_ diff --git a/framework/inc/uielement/uicommanddescription.hxx b/framework/inc/uielement/uicommanddescription.hxx new file mode 100644 index 000000000000..dd95981bba90 --- /dev/null +++ b/framework/inc/uielement/uicommanddescription.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_UIELEMENT_UICOMMANDDESCRPTION_HXX_ +#define __FRAMEWORK_UIELEMENT_UICOMMANDDESCRPTION_HXX_ + +/** Attention: stl headers must(!) be included at first. Otherwhise it can make trouble + with solaris headers ... +*/ +#include <vector> +#include <list> +#include <hash_map> + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ +#include <threadhelp/threadhelpbase.hxx> +#include <macros/generic.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> +#include <stdtypes.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/frame/XModuleManager.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <cppuhelper/implbase2.hxx> +#include <rtl/ustring.hxx> + +namespace framework +{ +class UICommandDescription : private ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses. + public ::cppu::WeakImplHelper2< com::sun::star::lang::XServiceInfo , + com::sun::star::container::XNameAccess > +{ + public: + UICommandDescription( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); + virtual ~UICommandDescription(); + + // XInterface, XTypeProvider, XServiceInfo + DECLARE_XSERVICEINFO +private: + // XNameAccess + virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) + throw ( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() + throw (::com::sun::star::uno::RuntimeException); + + virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) + throw (::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); + +public: + typedef ::std::hash_map< ::rtl::OUString, + ::rtl::OUString, + OUStringHashCode, + ::std::equal_to< ::rtl::OUString > > ModuleToCommandFileMap; + + typedef ::std::hash_map< ::rtl::OUString, + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >, + OUStringHashCode, + ::std::equal_to< ::rtl::OUString > > UICommandsHashMap; + + protected: + UICommandDescription( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager,bool ); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > impl_createConfigAccess(const ::rtl::OUString& _sName); + void impl_fillElements(const sal_Char* _pName); + sal_Bool m_bConfigRead; + rtl::OUString m_aPrivateResourceURL; + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; + ModuleToCommandFileMap m_aModuleToCommandFileMap; + UICommandsHashMap m_aUICommandsHashMap; + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xGenericUICommands; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager > m_xModuleManager; +}; + +} // namespace framework + +#endif // __FRAMEWORK_SERVICES_UICOMMANDDESCRPTION_HXX_ diff --git a/framework/inc/uielement/uielement.hxx b/framework/inc/uielement/uielement.hxx new file mode 100755 index 000000000000..b4ad9e2cbb6d --- /dev/null +++ b/framework/inc/uielement/uielement.hxx @@ -0,0 +1,146 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: layoutmanager.hxx,v $ + * $Revision: 1.34 $ + * + * 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_LAYOUTMANAGER_UIELEMENT_HXX_ +#define __FRAMEWORK_LAYOUTMANAGER_UIELEMENT_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ + +#include <com/sun/star/ui/XUIElement.hpp> +#include <com/sun/star/ui/DockingArea.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ + +#include <rtl/ustring.hxx> +#include <vcl/toolbox.hxx> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework +{ + +struct DockedData +{ + DockedData() : m_aPos( LONG_MAX, LONG_MAX ), + m_nDockedArea( ::com::sun::star::ui::DockingArea_DOCKINGAREA_TOP ), + m_bLocked( false ) {} + + Point m_aPos; + Size m_aSize; + sal_Int16 m_nDockedArea; + bool m_bLocked; +}; + +struct FloatingData +{ + FloatingData() : m_aPos( LONG_MAX, LONG_MAX ), + m_nLines( 1 ), + m_bIsHorizontal( true ) {} + + Point m_aPos; + Size m_aSize; + sal_Int16 m_nLines; + bool m_bIsHorizontal; +}; + +struct UIElement +{ + UIElement() : m_bFloating( false ), + m_bVisible( true ), + m_bUserActive( false ), + m_bCreateNewRowCol0( false ), + m_bDeactiveHide( false ), + m_bMasterHide( false ), + m_bContextSensitive( false ), + m_bContextActive( true ), + m_bNoClose( false ), + m_bSoftClose( false ), + m_bStateRead( false ), + m_nStyle( BUTTON_SYMBOL ) + {} + + UIElement( const rtl::OUString& rName, + const rtl::OUString& rType, + const com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElement >& rUIElement, + bool bFloating = false + ) : m_aType( rType ), + m_aName( rName ), + m_xUIElement( rUIElement ), + m_bFloating( bFloating ), + m_bVisible( true ), + m_bUserActive( false ), + m_bCreateNewRowCol0( false ), + m_bDeactiveHide( false ), + m_bMasterHide( false ), + m_bContextSensitive( false ), + m_bContextActive( true ), + m_bNoClose( false ), + m_bSoftClose( false ), + m_bStateRead( false ), + m_nStyle( BUTTON_SYMBOL ) {} + + bool operator< ( const UIElement& aUIElement ) const; + UIElement& operator=( const UIElement& rUIElement ); + + rtl::OUString m_aType; + rtl::OUString m_aName; + rtl::OUString m_aUIName; + com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElement > m_xUIElement; + bool m_bFloating, + m_bVisible, + m_bUserActive, + m_bCreateNewRowCol0, + m_bDeactiveHide, + m_bMasterHide, + m_bContextSensitive, + m_bContextActive; + bool m_bNoClose, + m_bSoftClose, + m_bStateRead; + sal_Int16 m_nStyle; + DockedData m_aDockedData; + FloatingData m_aFloatingData; +}; + +typedef std::vector< UIElement > UIElementVector; + +} // namespace framework + +#endif // __FRAMEWORK_LAYOUTMANAGER_UIELEMENT_HXX_ diff --git a/framework/inc/uielement/uielementtypenames.hxx b/framework/inc/uielement/uielementtypenames.hxx new file mode 100644 index 000000000000..ca7815f90af7 --- /dev/null +++ b/framework/inc/uielement/uielementtypenames.hxx @@ -0,0 +1,12 @@ +#ifndef __FRAMEWORK_UIELEMENT_UIELEMENTTYPENAMES_HXX_ +#define __FRAMEWORK_UIELEMENT_UIELEMENTTYPENAMES_HXX_ + +#define UIELEMENTTYPE_MENUBAR_NAME "menubar" +#define UIELEMENTTYPE_POPUPMENU_NAME "popupmenu" +#define UIELEMENTTYPE_TOOLBAR_NAME "toolbar" +#define UIELEMENTTYPE_STATUSBAR_NAME "statusbar" +#define UIELEMENTTYPE_FLOATINGWINDOW_NAME "floater" +#define UIELEMENTTYPE_PROGRESSBAR_NAME "progressbar" +#define UIELEMENTTYPE_TOOLPANEL_NAME "toolpanel" + +#endif // __FRAMEWORK_UIELEMENT_UIELEMENTTYPENAMES_HXX_ diff --git a/framework/inc/uifactory/addonstoolboxfactory.hxx b/framework/inc/uifactory/addonstoolboxfactory.hxx new file mode 100644 index 000000000000..4a77e85e73a5 --- /dev/null +++ b/framework/inc/uifactory/addonstoolboxfactory.hxx @@ -0,0 +1,88 @@ +/************************************************************************* + * + * 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_UIFACTORY_ADDONSTOOLBOXFACTORY_HXX_ +#define __FRAMEWORK_UIFACTORY_ADDONSTOOLBOXFACTORY_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <stdtypes.h> +#include <threadhelp/threadhelpbase.hxx> +#include <macros/generic.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> +#include <services.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/ui/XUIElementFactory.hpp> +#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/frame/XModel.hpp> + +//_________________________________________________________________________________________________________________ +// includes of other projects +//_________________________________________________________________________________________________________________ +#include <cppuhelper/implbase2.hxx> +#include <rtl/ustring.hxx> + +namespace framework +{ + +class AddonsToolBoxFactory : protected ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses. + public ::cppu::WeakImplHelper2< com::sun::star::lang::XServiceInfo , + com::sun::star::ui::XUIElementFactory > +{ + public: + AddonsToolBoxFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); + virtual ~AddonsToolBoxFactory(); + + // XInterface, XTypeProvider, XServiceInfo + DECLARE_XSERVICEINFO + + // XUIElementFactory + virtual ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElement > SAL_CALL createUIElement( const ::rtl::OUString& ResourceURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& Args ) throw ( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException ); + + sal_Bool hasButtonsInContext( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > >& rPropSeq, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame ); + + private: + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager > m_xModuleManager; +}; + +} + +#endif // __FRAMEWORK_UIFACTORY_ADDONSTOOLBOXFACTORY_HXX_ diff --git a/framework/inc/uifactory/factoryconfiguration.hxx b/framework/inc/uifactory/factoryconfiguration.hxx new file mode 100755 index 000000000000..14a62daca285 --- /dev/null +++ b/framework/inc/uifactory/factoryconfiguration.hxx @@ -0,0 +1,124 @@ +/************************************************************************* + * + * 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_UIFACTORY_FACTORYCONFIGURATION_HXX_ +#define __FRAMEWORK_UIFACTORY_FACTORYCONFIGURATION_HXX_ +#include <threadhelp/threadhelpbase.hxx> +#include <macros/generic.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> +#include <stdtypes.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/container/XContainerListener.hpp> +#include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/lang/XMultiComponentFactory.hpp> +#include <com/sun/star/frame/XUIControllerRegistration.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <cppuhelper/implbase1.hxx> +#include <rtl/ustring.hxx> + +//_________________________________________________________________________________________________________________ +// Namespace +//_________________________________________________________________________________________________________________ +// + +namespace framework +{ + +//***************************************************************************************************************** +// Configuration access class for PopupMenuControllerFactory implementation +//***************************************************************************************************************** +class ConfigurationAccess_ControllerFactory : // interfaces + private ThreadHelpBase, + public ::cppu::WeakImplHelper1< ::com::sun::star::container::XContainerListener> +{ +public: + ConfigurationAccess_ControllerFactory( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rServiceManager,const ::rtl::OUString& _sRoot,bool _bAskValue = false ); + virtual ~ConfigurationAccess_ControllerFactory(); + + void readConfigurationData(); + void updateConfigurationData(); + + rtl::OUString getServiceFromCommandModule( const rtl::OUString& rCommandURL, const rtl::OUString& rModule ) const; + rtl::OUString getValueFromCommandModule( const rtl::OUString& rCommandURL, const rtl::OUString& rModule ) const; + void addServiceToCommandModule( const rtl::OUString& rCommandURL, const rtl::OUString& rModule, const rtl::OUString& rServiceSpecifier ); + void removeServiceFromCommandModule( const rtl::OUString& rCommandURL, const rtl::OUString& rModule ); + inline bool hasValue() const { return m_bAskValue; } + + // container.XContainerListener + virtual void SAL_CALL elementInserted( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL elementRemoved( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL elementReplaced( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException); + + // lang.XEventListener + virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException); + +private: + struct ControllerInfo + { + rtl::OUString m_aImplementationName; + rtl::OUString m_aValue; + ControllerInfo(const ::rtl::OUString& _aImplementationName,const ::rtl::OUString& _aValue) : m_aImplementationName(_aImplementationName),m_aValue(_aValue){} + ControllerInfo(){} + }; + class MenuControllerMap : public std::hash_map< rtl::OUString, + ControllerInfo, + OUStringHashCode, + ::std::equal_to< ::rtl::OUString > > + { + inline void free() + { + MenuControllerMap().swap( *this ); + } + }; + + sal_Bool impl_getElementProps( const ::com::sun::star::uno::Any& aElement, rtl::OUString& aCommand, rtl::OUString& aModule, rtl::OUString& aServiceSpecifier,rtl::OUString& aValue ) const; + + rtl::OUString m_aPropCommand; + rtl::OUString m_aPropModule; + rtl::OUString m_aPropController; + rtl::OUString m_aPropValue; + rtl::OUString m_sRoot; + MenuControllerMap m_aMenuControllerMap; + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xConfigProvider; + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xConfigAccess; + sal_Bool m_bConfigAccessInitialized; + bool m_bAskValue; +}; + +} // namespace framework +#endif // __FRAMEWORK_UIFACTORY_FACTORYCONFIGURATION_HXX_ diff --git a/framework/inc/uifactory/menubarfactory.hxx b/framework/inc/uifactory/menubarfactory.hxx new file mode 100644 index 000000000000..85f6e84d08ad --- /dev/null +++ b/framework/inc/uifactory/menubarfactory.hxx @@ -0,0 +1,91 @@ +/************************************************************************* + * + * 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_UIFACTORY_MENUBARFACTORY_HXX_ +#define __FRAMEWORK_UIFACTORY_MENUBARFACTORY_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <stdtypes.h> +#include <threadhelp/threadhelpbase.hxx> +#include <macros/generic.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/ui/XUIElementFactory.hpp> +#include <com/sun/star/frame/XModuleManager.hpp> + +//_________________________________________________________________________________________________________________ +// includes of other projects +//_________________________________________________________________________________________________________________ +#include <toolkit/awt/vclxmenu.hxx> +#include <cppuhelper/implbase2.hxx> +#include <rtl/ustring.hxx> + +namespace framework +{ + class MenuBarFactory : protected ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses. + public ::cppu::WeakImplHelper2< com::sun::star::lang::XServiceInfo, + ::com::sun::star::ui::XUIElementFactory> + { + public: + MenuBarFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); + virtual ~MenuBarFactory(); + + // XInterface, XTypeProvider, XServiceInfo + DECLARE_XSERVICEINFO + + // XUIElementFactory + virtual ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElement > SAL_CALL createUIElement( const ::rtl::OUString& ResourceURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& Args ) throw ( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException ); + + static void CreateUIElement(const ::rtl::OUString& ResourceURL + , const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& Args + ,const char* _pExtraMode + ,const char* _pAsciiName + ,const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElement >& _xMenuBar + ,const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager >& _xModuleManager + ,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xServiceManager); + + protected: + MenuBarFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager,bool ); + + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager > m_xModuleManager; + }; +} + +#endif // __FRAMEWORK_UIFACTORY_MENUBARFACTORY_HXX_ diff --git a/framework/inc/uifactory/popupmenucontrollerfactory.hxx b/framework/inc/uifactory/popupmenucontrollerfactory.hxx new file mode 100644 index 000000000000..9e10cc4d2ef5 --- /dev/null +++ b/framework/inc/uifactory/popupmenucontrollerfactory.hxx @@ -0,0 +1,67 @@ +/************************************************************************* + * + * 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_UIFACTORY_POPUPMENUCONTROLLERFACTORY_HXX_ +#define __FRAMEWORK_UIFACTORY_POPUPMENUCONTROLLERFACTORY_HXX_ + +/** Attention: stl headers must(!) be included at first. Otherwhise it can make trouble + with solaris headers ... +*/ +#include <vector> +#include <list> + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ +#include <macros/xserviceinfo.hxx> +#include <stdtypes.h> +#include <uifactory/toolbarcontrollerfactory.hxx> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ + +namespace framework +{ + +class ConfigurationAccess_ControllerFactory; +class PopupMenuControllerFactory : public ToolbarControllerFactory +{ + public: + PopupMenuControllerFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); + + // XInterface, XTypeProvider, XServiceInfo + DECLARE_XSERVICEINFO +}; + +} // namespace framework + +#endif // __FRAMEWORK_SERVICES_POPUPMENUCONTROLLERFACTORY_HXX_ diff --git a/framework/inc/uifactory/statusbarcontrollerfactory.hxx b/framework/inc/uifactory/statusbarcontrollerfactory.hxx new file mode 100644 index 000000000000..6dd8fa3b5040 --- /dev/null +++ b/framework/inc/uifactory/statusbarcontrollerfactory.hxx @@ -0,0 +1,62 @@ +/************************************************************************* + * + * 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_UIFACTORY_STATUSBARCONTROLLERFACTORY_HXX_ +#define __FRAMEWORK_UIFACTORY_STATUSBARCONTROLLERFACTORY_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ +#include <macros/xserviceinfo.hxx> +#include <uifactory/toolbarcontrollerfactory.hxx> +#include <stdtypes.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ + + +namespace framework +{ + +class ConfigurationAccess_ControllerFactory; +class StatusbarControllerFactory : public ToolbarControllerFactory +{ + public: + StatusbarControllerFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); + + // XInterface, XTypeProvider, XServiceInfo + DECLARE_XSERVICEINFO +}; + +} // namespace framework + +#endif // __FRAMEWORK_SERVICES_STATUSBARCONTROLLERFACTORY_HXX_ diff --git a/framework/inc/uifactory/statusbarfactory.hxx b/framework/inc/uifactory/statusbarfactory.hxx new file mode 100644 index 000000000000..6f275ed9a21e --- /dev/null +++ b/framework/inc/uifactory/statusbarfactory.hxx @@ -0,0 +1,67 @@ +/************************************************************************* + * + * 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_UIFACTORY_STATUSBARFACTORY_HXX_ +#define __FRAMEWORK_UIFACTORY_STATUSBARFACTORY_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <stdtypes.h> + +#include <macros/xserviceinfo.hxx> +#include <services.h> +#include <uifactory/menubarfactory.hxx> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +//_________________________________________________________________________________________________________________ +// includes of other projects +//_________________________________________________________________________________________________________________ +#include <rtl/ustring.hxx> + +namespace framework +{ + +class StatusBarFactory : public MenuBarFactory +{ + public: + StatusBarFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); + + // XInterface, XTypeProvider, XServiceInfo + DECLARE_XSERVICEINFO + + // XUIElementFactory + virtual ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElement > SAL_CALL createUIElement( const ::rtl::OUString& ResourceURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& Args ) throw ( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException ); + +}; + +} + +#endif // __FRAMEWORK_UIFACTORY_STATUSBARFACTORY_HXX_ diff --git a/framework/inc/uifactory/toolbarcontrollerfactory.hxx b/framework/inc/uifactory/toolbarcontrollerfactory.hxx new file mode 100644 index 000000000000..7b093d6cb681 --- /dev/null +++ b/framework/inc/uifactory/toolbarcontrollerfactory.hxx @@ -0,0 +1,91 @@ +/************************************************************************* + * + * 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_UIFACTORY_TOOLBARCONTROLLERFACTORY_HXX_ +#define __FRAMEWORK_UIFACTORY_TOOLBARCONTROLLERFACTORY_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <threadhelp/threadhelpbase.hxx> +#include <macros/generic.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> +#include <stdtypes.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/lang/XMultiComponentFactory.hpp> +#include <com/sun/star/frame/XUIControllerRegistration.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <cppuhelper/implbase3.hxx> +#include <rtl/ustring.hxx> + +namespace framework +{ + +class ConfigurationAccess_ControllerFactory; +class ToolbarControllerFactory : protected ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses. + public ::cppu::WeakImplHelper3< com::sun::star::lang::XServiceInfo, + com::sun::star::lang::XMultiComponentFactory, + com::sun::star::frame::XUIControllerRegistration> +{ + public: + ToolbarControllerFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); + virtual ~ToolbarControllerFactory(); + + // XInterface, XTypeProvider, XServiceInfo + DECLARE_XSERVICEINFO + + // XMultiComponentFactory + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceWithContext( const ::rtl::OUString& aServiceSpecifier, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& Context ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceWithArgumentsAndContext( const ::rtl::OUString& ServiceSpecifier, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Arguments, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& Context ) 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); + + // XUIControllerRegistration + virtual sal_Bool SAL_CALL hasController( const ::rtl::OUString& aCommandURL, const rtl::OUString& aModuleName ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL registerController( const ::rtl::OUString& aCommandURL, const rtl::OUString& aModuleName, const ::rtl::OUString& aControllerImplementationName ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL deregisterController( const ::rtl::OUString& aCommandURL, const rtl::OUString& aModuleName ) throw (::com::sun::star::uno::RuntimeException); + + protected: + ToolbarControllerFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager,bool ); + sal_Bool m_bConfigRead; + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; + ConfigurationAccess_ControllerFactory* m_pConfigAccess; +}; + +} // namespace framework + +#endif // __FRAMEWORK_SERVICES_TOOLBARCONTROLLERFACTORY_HXX_ diff --git a/framework/inc/uifactory/toolboxfactory.hxx b/framework/inc/uifactory/toolboxfactory.hxx new file mode 100644 index 000000000000..0197f3ec298d --- /dev/null +++ b/framework/inc/uifactory/toolboxfactory.hxx @@ -0,0 +1,66 @@ +/************************************************************************* + * + * 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_UIFACTORY_TOOLBOXFACTORY_HXX_ +#define __FRAMEWORK_UIFACTORY_TOOLBOXFACTORY_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <stdtypes.h> +#include <macros/xserviceinfo.hxx> +#include <services.h> +#include <uifactory/menubarfactory.hxx> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +//_________________________________________________________________________________________________________________ +// includes of other projects +//_________________________________________________________________________________________________________________ +#include <cppuhelper/weak.hxx> +#include <rtl/ustring.hxx> + +namespace framework +{ + +class ToolBoxFactory : public MenuBarFactory +{ + public: + ToolBoxFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); + + // XInterface, XTypeProvider, XServiceInfo + DECLARE_XSERVICEINFO + + // XUIElementFactory + virtual ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElement > SAL_CALL createUIElement( const ::rtl::OUString& ResourceURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& Args ) throw ( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException ); +}; + +} + +#endif // SFX_TOOLBOXFACTORY_HXX diff --git a/framework/inc/uifactory/uielementfactorymanager.hxx b/framework/inc/uifactory/uielementfactorymanager.hxx new file mode 100644 index 000000000000..4cf2cb769a27 --- /dev/null +++ b/framework/inc/uifactory/uielementfactorymanager.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_UIFACTORY_UIELEMENTFACTORYMANAGER_HXX_ +#define __FRAMEWORK_UIFACTORY_UIELEMENTFACTORYMANAGER_HXX_ + +/** Attention: stl headers must(!) be included at first. Otherwhise it can make trouble + with solaris headers ... +*/ +#include <vector> +#include <list> + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ +#include <threadhelp/threadhelpbase.hxx> +#include <macros/generic.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> +#include <stdtypes.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/ui/XUIElementFactory.hpp> +#include <com/sun/star/ui/XUIElementFactoryRegistration.hpp> +#include <com/sun/star/container/XContainerListener.hpp> +#include <com/sun/star/container/XNameAccess.hpp> +#include "com/sun/star/frame/XModuleManager.hpp" + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <cppuhelper/implbase1.hxx> +#include <cppuhelper/implbase3.hxx> +#include <rtl/ustring.hxx> + +namespace framework +{ + + class ConfigurationAccess_FactoryManager : // interfaces + // baseclasses + // Order is neccessary for right initialization! + private ThreadHelpBase , + public ::cppu::WeakImplHelper1< ::com::sun::star::container::XContainerListener> +{ + public: + ConfigurationAccess_FactoryManager( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rServiceManager,const ::rtl::OUString& _sRoot ); + virtual ~ConfigurationAccess_FactoryManager(); + + void readConfigurationData(); + + rtl::OUString getFactorySpecifierFromTypeNameModule( const rtl::OUString& rType, const rtl::OUString& rName, const rtl::OUString& rModule ) const; + void addFactorySpecifierToTypeNameModule( const rtl::OUString& rType, const rtl::OUString& rName, const rtl::OUString& rModule, const rtl::OUString& aServiceSpecifier ); + void removeFactorySpecifierFromTypeNameModule( const rtl::OUString& rType, const rtl::OUString& rName, const rtl::OUString& rModule ); + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > > getFactoriesDescription() const; + + // container.XContainerListener + virtual void SAL_CALL elementInserted( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL elementRemoved( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL elementReplaced( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException); + + // lang.XEventListener + virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException); + + private: + class FactoryManagerMap : public std::hash_map< rtl::OUString, + rtl::OUString, + OUStringHashCode, + ::std::equal_to< ::rtl::OUString > > + { + inline void free() + { + FactoryManagerMap().swap( *this ); + } + }; + + sal_Bool impl_getElementProps( const ::com::sun::star::uno::Any& rElement, rtl::OUString& rType, rtl::OUString& rName, rtl::OUString& rModule, rtl::OUString& rServiceSpecifier ) const; + + rtl::OUString m_aPropType; + rtl::OUString m_aPropName; + rtl::OUString m_aPropModule; + rtl::OUString m_aPropFactory; + ::rtl::OUString m_sRoot; + FactoryManagerMap m_aFactoryManagerMap; + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xConfigProvider; + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xConfigAccess; + sal_Bool m_bConfigAccessInitialized; + bool m_bConfigDirty; +}; + + +class UIElementFactoryManager : private ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses. + public ::cppu::WeakImplHelper3< ::com::sun::star::lang::XServiceInfo, + ::com::sun::star::ui::XUIElementFactory, + ::com::sun::star::ui::XUIElementFactoryRegistration> +{ + public: + UIElementFactoryManager( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); + virtual ~UIElementFactoryManager(); + + // XInterface, XTypeProvider, XServiceInfo + DECLARE_XSERVICEINFO + + // XUIElementFactory + virtual ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElement > SAL_CALL createUIElement( const ::rtl::OUString& ResourceURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& Args ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + + // XUIElementFactoryRegistration + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > > SAL_CALL getRegisteredFactories( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElementFactory > SAL_CALL getFactory( const ::rtl::OUString& ResourceURL, const ::rtl::OUString& ModuleIdentifier ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL registerFactory( const ::rtl::OUString& aType, const ::rtl::OUString& aName, const ::rtl::OUString& aModuleIdentifier, const ::rtl::OUString& aFactoryImplementationName ) throw (::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL deregisterFactory( const ::rtl::OUString& aType, const ::rtl::OUString& aName, const ::rtl::OUString& aModuleIdentifier ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); + + private: + + sal_Bool m_bConfigRead; + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager > m_xModuleManager; + ConfigurationAccess_FactoryManager* m_pConfigAccess; +}; + +} // namespace framework + +#endif // __FRAMEWORK_UIFACTORY_UIELEMENTFACTORYMANAGER_HXX_ diff --git a/framework/inc/uifactory/windowcontentfactorymanager.hxx b/framework/inc/uifactory/windowcontentfactorymanager.hxx new file mode 100644 index 000000000000..5e299204e485 --- /dev/null +++ b/framework/inc/uifactory/windowcontentfactorymanager.hxx @@ -0,0 +1,90 @@ +/************************************************************************* + * + * 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_UIFACTORY_WINDOWCONTENTFACTORYMANAGER_HXX_ +#define __FRAMEWORK_UIFACTORY_WINDOWCONTENTFACTORYMANAGER_HXX_ + +/** Attention: stl headers must(!) be included at first. Otherwhise it can make trouble + with solaris headers ... +*/ +#include <vector> +#include <list> + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ +#include <threadhelp/threadhelpbase.hxx> +#include <macros/generic.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> +#include <stdtypes.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/container/XNameAccess.hpp> +#include "com/sun/star/frame/XModuleManager.hpp" + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <cppuhelper/implbase2.hxx> +#include <rtl/ustring.hxx> + +namespace framework +{ + +class ConfigurationAccess_FactoryManager; +class WindowContentFactoryManager : private ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses. + public ::cppu::WeakImplHelper2< com::sun::star::lang::XServiceInfo , + com::sun::star::lang::XSingleComponentFactory> +{ + public: + WindowContentFactoryManager( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); + virtual ~WindowContentFactoryManager(); + + // XInterface, XTypeProvider, XServiceInfo + DECLARE_XSERVICEINFO + + // XSingleComponentFactory + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceWithContext( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& Context ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceWithArgumentsAndContext( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Arguments, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& Context ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + + static void RetrieveTypeNameFromResourceURL( const ::rtl::OUString& aResourceURL, rtl::OUString& aType, rtl::OUString& aName ); + private: + + sal_Bool m_bConfigRead; + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager > m_xModuleManager; + ConfigurationAccess_FactoryManager* m_pConfigAccess; +}; + +} // namespace framework + +#endif // __FRAMEWORK_UIFACTORY_WINDOWCONTENTFACTORYMANAGER_HXX_ diff --git a/framework/inc/xml/acceleratorconfigurationreader.hxx b/framework/inc/xml/acceleratorconfigurationreader.hxx new file mode 100644 index 000000000000..745dea7ecee9 --- /dev/null +++ b/framework/inc/xml/acceleratorconfigurationreader.hxx @@ -0,0 +1,220 @@ +/************************************************************************* + * + * 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_XML_ACCELERATORCONFIGURATIONREADER_HXX_ +#define _FRAMEWORK_XML_ACCELERATORCONFIGURATIONREADER_HXX_ + +//_______________________________________________ +// own includes + +#include <accelerators/acceleratorcache.hxx> +#include <accelerators/keymapping.hxx> +#include <macros/xinterface.hxx> +#include <threadhelp/threadhelpbase.hxx> +#include <general.h> + +//_______________________________________________ +// interface includes + +#ifndef __COM_SUN_STAR_XML_SAX_XDOCUMENTHANDLER_HPP_ +#include <com/sun/star/xml/sax/XDocumentHandler.hpp> +#endif + +#ifndef __COM_SUN_STAR_XML_SAX_XLOCATOR_HPP_ +#include <com/sun/star/xml/sax/XLocator.hpp> +#endif + +//_______________________________________________ +// other includes +#include <salhelper/singletonref.hxx> +#include <cppuhelper/weak.hxx> +#include <rtl/ustring.hxx> + +namespace framework{ + +class AcceleratorConfigurationReader : public css::xml::sax::XDocumentHandler + , private ThreadHelpBase + , public ::cppu::OWeakObject +{ + //------------------------------------------- + // const, types + + private: + + //--------------------------------------- + /** @short classification of XML elements. */ + enum EXMLElement + { + E_ELEMENT_ACCELERATORLIST, + E_ELEMENT_ITEM + }; + + //--------------------------------------- + /** @short classification of XML attributes. */ + enum EXMLAttribute + { + E_ATTRIBUTE_KEYCODE, + E_ATTRIBUTE_MOD_SHIFT, + E_ATTRIBUTE_MOD_MOD1, + E_ATTRIBUTE_MOD_MOD2, + E_ATTRIBUTE_MOD_MOD3, + E_ATTRIBUTE_URL + }; + + //--------------------------------------- + /** @short some namespace defines */ + enum EAcceleratorXMLNamespace + { + E_NAMESPACE_ACCEL, + E_NAMESPACE_XLINK + }; + + //------------------------------------------- + // member + + private: + + //--------------------------------------- + /** @short needed to read the xml configuration. */ + css::uno::Reference< css::xml::sax::XDocumentHandler > m_xReader; + + //--------------------------------------- + /** @short reference to the outside container, where this + reader/writer must work on. */ + AcceleratorCache& m_rContainer; + + //--------------------------------------- + /** @short used to detect if an accelerator list + occures recursive inside xml. */ + sal_Bool m_bInsideAcceleratorList; + + //--------------------------------------- + /** @short used to detect if an accelerator item + occures recursive inside xml. */ + sal_Bool m_bInsideAcceleratorItem; + + //--------------------------------------- + /** @short is used to map key codes to its + string representation. + + @descr To perform this operatio is + created only one times and holded + alive forever ...*/ + ::salhelper::SingletonRef< KeyMapping > m_rKeyMapping; + + //--------------------------------------- + /** @short provide informations abou the parsing state. + + @descr We use it to find out the line and column, where + an error occure. + */ + css::uno::Reference< css::xml::sax::XLocator > m_xLocator; + +/* SfxAcceleratorItemList& m_aReadAcceleratorList; +*/ + + //------------------------------------------- + // interface + + public: + + //--------------------------------------- + /** @short connect this new reader/writer instance + to an outside container, which should be used + flushed to the underlying XML configuration or + filled from there. + + @param rContainer + a reference to the outside container. + */ + AcceleratorConfigurationReader(AcceleratorCache& rContainer); + + //--------------------------------------- + /** @short does nothing real ... */ + virtual ~AcceleratorConfigurationReader(); + + //--------------------------------------- + // XInterface + FWK_DECLARE_XINTERFACE + + //--------------------------------------- + // XDocumentHandler + virtual void SAL_CALL startDocument() + throw(css::xml::sax::SAXException, + css::uno::RuntimeException ); + + virtual void SAL_CALL endDocument() + throw(css::xml::sax::SAXException, + css::uno::RuntimeException ); + + virtual void SAL_CALL startElement(const ::rtl::OUString& sElement , + const css::uno::Reference< css::xml::sax::XAttributeList >& xAttributeList) + throw(css::xml::sax::SAXException, + css::uno::RuntimeException ); + + virtual void SAL_CALL endElement(const ::rtl::OUString& sElement) + throw(css::xml::sax::SAXException, + css::uno::RuntimeException ); + + virtual void SAL_CALL characters(const ::rtl::OUString& sChars) + throw(css::xml::sax::SAXException, + css::uno::RuntimeException ); + + virtual void SAL_CALL ignorableWhitespace(const ::rtl::OUString& sWhitespaces) + throw(css::xml::sax::SAXException, + css::uno::RuntimeException ); + + virtual void SAL_CALL processingInstruction(const ::rtl::OUString& sTarget, + const ::rtl::OUString& sData ) + throw(css::xml::sax::SAXException, + css::uno::RuntimeException ); + + virtual void SAL_CALL setDocumentLocator(const css::uno::Reference< css::xml::sax::XLocator >& xLocator) + throw(css::xml::sax::SAXException, + css::uno::RuntimeException ); + + //------------------------------------------- + // helper + + private: + + //--------------------------------------- + /** TODO document me */ + static EXMLElement implst_classifyElement(const ::rtl::OUString& sElement); + + //--------------------------------------- + /** TODO document me */ + static EXMLAttribute implst_classifyAttribute(const ::rtl::OUString& sAttribute); + + //--------------------------------------- + /** TODO document me */ + ::rtl::OUString implts_getErrorLineString(); +}; + +} // namespace framework + +#endif // _FRAMEWORK_XML_ACCELERATORCONFIGURATIONREADER_HXX_ diff --git a/framework/inc/xml/acceleratorconfigurationwriter.hxx b/framework/inc/xml/acceleratorconfigurationwriter.hxx new file mode 100644 index 000000000000..caba9b8fa02f --- /dev/null +++ b/framework/inc/xml/acceleratorconfigurationwriter.hxx @@ -0,0 +1,119 @@ +/************************************************************************* + * + * 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_XML_ACCELERATORCONFIGURATIONWRITER_HXX_ +#define _FRAMEWORK_XML_ACCELERATORCONFIGURATIONWRITER_HXX_ + +//_______________________________________________ +// own includes + +#include <accelerators/acceleratorcache.hxx> +#include <accelerators/keymapping.hxx> +#include <threadhelp/threadhelpbase.hxx> +#include <general.h> + +//_______________________________________________ +// interface includes + +#ifndef __COM_SUN_STAR_XML_SAX_XDOCUMENTHANDLER_HPP_ +#include <com/sun/star/xml/sax/XDocumentHandler.hpp> +#endif + +//_______________________________________________ +// other includes +#include <salhelper/singletonref.hxx> +#include <rtl/ustring.hxx> + +namespace framework{ + +class AcceleratorConfigurationWriter : private ThreadHelpBase +{ + //------------------------------------------- + // member + + private: + + //--------------------------------------- + /** @short needed to write the xml configuration. */ + css::uno::Reference< css::xml::sax::XDocumentHandler > m_xConfig; + + //--------------------------------------- + /** @short reference to the outside container, where this + writer must work on. */ + const AcceleratorCache& m_rContainer; + + //--------------------------------------- + /** @short is used to map key codes to its + string representation. + + @descr To perform this operatio is + created only one times and holded + alive forever ...*/ + ::salhelper::SingletonRef< KeyMapping > m_rKeyMapping; + + //------------------------------------------- + // interface + + public: + + //--------------------------------------- + /** @short connect this new writer instance + to an outside container, which should be + flushed to the underlying XML configuration. + + @param rContainer + a reference to the outside container. + + @param xConfig + used to write the configuration there. + */ + AcceleratorConfigurationWriter(const AcceleratorCache& rContainer, + const css::uno::Reference< css::xml::sax::XDocumentHandler >& xConfig ); + + //--------------------------------------- + /** @short does nothing real ... */ + virtual ~AcceleratorConfigurationWriter(); + + //--------------------------------------- + /** @short TODO */ + virtual void flush(); + + //------------------------------------------- + // helper + + private: + + //--------------------------------------- + /** @short TODO */ + void impl_ts_writeKeyCommandPair(const css::awt::KeyEvent& aKey , + const ::rtl::OUString& sCommand, + const css::uno::Reference< css::xml::sax::XDocumentHandler >& xConfig ); +}; + +} // namespace framework + +#endif // _FRAMEWORK_XML_ACCELERATORCONFIGURATIONWRITER_HXX_ diff --git a/framework/inc/xml/eventsdocumenthandler.hxx b/framework/inc/xml/eventsdocumenthandler.hxx new file mode 100644 index 000000000000..ffce5c1a348b --- /dev/null +++ b/framework/inc/xml/eventsdocumenthandler.hxx @@ -0,0 +1,188 @@ +/************************************************************************* + * + * 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_XML_EVENTSDOCUMENTHANDLER_HXX_ +#define __FRAMEWORK_XML_EVENTSDOCUMENTHANDLER_HXX_ + +#ifndef __FRAMEWORK_XML_TOOLBOXCONFIGURATION_HXX_ +#include <framework/eventsconfiguration.hxx> +#endif + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ + +#ifndef __COM_SUN_STAR_XML_SAX_XDOCUMENTHANDLER_HPP_ +#include <com/sun/star/xml/sax/XDocumentHandler.hpp> +#endif + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <threadhelp/threadhelpbase.hxx> +#include <rtl/ustring.hxx> +#include <cppuhelper/implbase1.hxx> + +#include <hash_map> +#include <stdtypes.h> + +#include <framework/fwedllapi.h> +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//***************************************************************************************************************** +// Hash code function for using in all hash maps of follow implementation. + +class FWE_DLLPUBLIC OReadEventsDocumentHandler : private ThreadHelpBase, // Struct for right initalization of lock member! Must be first of baseclasses. + public ::cppu::WeakImplHelper1< ::com::sun::star::xml::sax::XDocumentHandler > +{ + public: + enum Events_XML_Entry + { + EV_ELEMENT_EVENTS, + EV_ELEMENT_EVENT, + EV_ATTRIBUTE_TYPE, + EV_ATTRIBUTE_NAME, + XL_ATTRIBUTE_HREF, + XL_ATTRIBUTE_TYPE, + EV_ATTRIBUTE_MACRONAME, + EV_ATTRIBUTE_LIBRARY, + EV_XML_ENTRY_COUNT + }; + + enum Event_XML_Namespace + { + EV_NS_EVENT, + EV_NS_XLINK, + EV_XML_NAMESPACES_COUNT + }; + + OReadEventsDocumentHandler( EventsConfig& aItems ); + + + // XDocumentHandler + virtual void SAL_CALL startDocument(void) + throw ( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL endDocument(void) + throw( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL startElement( + const rtl::OUString& aName, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > &xAttribs) + throw( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL endElement(const rtl::OUString& aName) + throw( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL characters(const rtl::OUString& aChars) + throw( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL ignorableWhitespace(const rtl::OUString& aWhitespaces) + throw( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL processingInstruction(const rtl::OUString& aTarget, + const rtl::OUString& aData) + throw( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL setDocumentLocator( + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator > &xLocator) + throw( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ); + + protected: + virtual ~OReadEventsDocumentHandler(); + + private: + ::rtl::OUString getErrorLineString(); + + class EventsHashMap : public ::std::hash_map< ::rtl::OUString , + Events_XML_Entry , + OUStringHashCode , + ::std::equal_to< ::rtl::OUString > > + { + public: + inline void free() + { + EventsHashMap().swap( *this ); + } + }; + + sal_Bool m_bEventsStartFound; + sal_Bool m_bEventsEndFound; + sal_Bool m_bEventStartFound; + EventsHashMap m_aEventsMap; + EventsConfig& m_aEventItems; + ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator > m_xLocator; +}; + +class FWE_DLLPUBLIC OWriteEventsDocumentHandler : private ThreadHelpBase // Struct for right initalization of lock member! Must be first of baseclasses. +{ + public: + OWriteEventsDocumentHandler( + const EventsConfig& aItems, + ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > ); + virtual ~OWriteEventsDocumentHandler(); + + void WriteEventsDocument() throw + ( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ); + + protected: + virtual void WriteEvent( + const ::rtl::OUString& aEventName, + const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aPropertyValue ) throw + ( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ); + + const EventsConfig& m_aItems; + ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > m_xWriteDocumentHandler; + ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > m_xEmptyList; + ::rtl::OUString m_aXMLEventNS; + ::rtl::OUString m_aXMLXlinkNS; + ::rtl::OUString m_aAttributeType; + ::rtl::OUString m_aAttributeURL; + ::rtl::OUString m_aAttributeLanguage; + ::rtl::OUString m_aAttributeLinkType; + ::rtl::OUString m_aAttributeMacroName; + ::rtl::OUString m_aAttributeLibrary; + ::rtl::OUString m_aAttributeName; +}; + +} // namespace framework + +#endif diff --git a/framework/inc/xml/imagesdocumenthandler.hxx b/framework/inc/xml/imagesdocumenthandler.hxx new file mode 100644 index 000000000000..59d1e4abdb3a --- /dev/null +++ b/framework/inc/xml/imagesdocumenthandler.hxx @@ -0,0 +1,204 @@ +/************************************************************************* + * + * 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_XML_IMAGEDOCUMENTHANDLER_HXX_ +#define __FRAMEWORK_XML_IMAGEDOCUMENTHANDLER_HXX_ + +#include <framework/fwedllapi.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ + +#ifndef __COM_SUN_STAR_XML_SAX_XDOCUMENTHANDLER_HPP_ +#include <com/sun/star/xml/sax/XDocumentHandler.hpp> +#endif + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <framework/imagesconfiguration.hxx> +#include <threadhelp/threadhelpbase.hxx> +#include <rtl/ustring.hxx> +#include <cppuhelper/implbase1.hxx> + +#include <hash_map> +#include <stdtypes.h> + + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//***************************************************************************************************************** +// Hash code function for using in all hash maps of follow implementation. + +class FWE_DLLPUBLIC OReadImagesDocumentHandler : private ThreadHelpBase, // Struct for right initalization of lock member! Must be first of baseclasses. + public ::cppu::WeakImplHelper1< ::com::sun::star::xml::sax::XDocumentHandler > +{ + public: + enum Image_XML_Entry + { + IMG_ELEMENT_IMAGECONTAINER, + IMG_ELEMENT_IMAGES, + IMG_ELEMENT_ENTRY, + IMG_ELEMENT_EXTERNALIMAGES, + IMG_ELEMENT_EXTERNALENTRY, + IMG_ATTRIBUTE_HREF, + IMG_ATTRIBUTE_MASKCOLOR, + IMG_ATTRIBUTE_COMMAND, + IMG_ATTRIBUTE_BITMAPINDEX, + IMG_ATTRIBUTE_MASKURL, + IMG_ATTRIBUTE_MASKMODE, + IMG_ATTRIBUTE_HIGHCONTRASTURL, + IMG_ATTRIBUTE_HIGHCONTRASTMASKURL, + IMG_XML_ENTRY_COUNT + }; + + enum Image_XML_Namespace + { + IMG_NS_IMAGE, + IMG_NS_XLINK, + TBL_XML_NAMESPACES_COUNT + }; + + OReadImagesDocumentHandler( ImageListsDescriptor& aItems ); + virtual ~OReadImagesDocumentHandler(); + + // XDocumentHandler + virtual void SAL_CALL startDocument(void) + throw ( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL endDocument(void) + throw( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL startElement( + const rtl::OUString& aName, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > &xAttribs) + throw( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL endElement(const rtl::OUString& aName) + throw( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL characters(const rtl::OUString& aChars) + throw( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL ignorableWhitespace(const rtl::OUString& aWhitespaces) + throw( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL processingInstruction(const rtl::OUString& aTarget, + const rtl::OUString& aData) + throw( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL setDocumentLocator( + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator > &xLocator) + throw( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ); + + private: + ::rtl::OUString getErrorLineString(); + + class ImageHashMap : public ::std::hash_map< ::rtl::OUString , + Image_XML_Entry , + OUStringHashCode , + ::std::equal_to< ::rtl::OUString > > + { + public: + inline void free() + { + ImageHashMap().swap( *this ); + } + }; + + sal_Bool m_bImageContainerStartFound; + sal_Bool m_bImageContainerEndFound; + sal_Bool m_bImagesStartFound; + sal_Bool m_bImagesEndFound; + sal_Bool m_bImageStartFound; + sal_Bool m_bExternalImagesStartFound; + sal_Bool m_bExternalImagesEndFound; + sal_Bool m_bExternalImageStartFound; + sal_Int32 m_nHashMaskModeBitmap; + sal_Int32 m_nHashMaskModeColor; + ImageHashMap m_aImageMap; + ImageListsDescriptor& m_aImageList; + ImageListItemDescriptor* m_pImages; + ExternalImageItemListDescriptor* m_pExternalImages; + ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator > m_xLocator; +}; + +class FWE_DLLPUBLIC OWriteImagesDocumentHandler : private ThreadHelpBase // Struct for right initalization of lock member! Must be first of baseclasses. +{ + public: + OWriteImagesDocumentHandler( + const ImageListsDescriptor& aItems, + ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > ); + virtual ~OWriteImagesDocumentHandler(); + + void WriteImagesDocument() throw + ( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ); + + protected: + virtual void WriteImageList( const ImageListItemDescriptor* ) throw + ( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ); + + virtual void WriteExternalImageList( const ExternalImageItemListDescriptor* ) throw + ( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ); + + virtual void WriteImage( const ImageItemDescriptor* ) throw + ( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ); + + virtual void WriteExternalImage( const ExternalImageItemDescriptor* ) throw + ( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ); + + const ImageListsDescriptor& m_aImageListsItems; + ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > m_xWriteDocumentHandler; + ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > m_xEmptyList; + ::rtl::OUString m_aXMLXlinkNS; + ::rtl::OUString m_aXMLImageNS; + ::rtl::OUString m_aAttributeType; + ::rtl::OUString m_aAttributeXlinkType; + ::rtl::OUString m_aAttributeValueSimple; +}; + +} // namespace framework + +#endif diff --git a/framework/inc/xml/menudocumenthandler.hxx b/framework/inc/xml/menudocumenthandler.hxx new file mode 100644 index 000000000000..5c6064cdd4f1 --- /dev/null +++ b/framework/inc/xml/menudocumenthandler.hxx @@ -0,0 +1,319 @@ +/************************************************************************* + * + * 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_XML_MENUDOCUMENTHANDLER_HXX_ +#define __FRAMEWORK_XML_MENUDOCUMENTHANDLER_HXX_ + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ + +#ifndef __COM_SUN_STAR_XML_SAX_XDOCUMENTHANDLER_HPP_ +#include <com/sun/star/xml/sax/XDocumentHandler.hpp> +#endif +#include <com/sun/star/container/XIndexContainer.hpp> +#include <com/sun/star/lang/XSingleComponentFactory.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/uno/Sequence.h> +#include <com/sun/star/uno/XComponentContext.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <threadhelp/threadhelpbase.hxx> +#include <rtl/ustring.hxx> +#include <cppuhelper/implbase1.hxx> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <framework/fwedllapi.h> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +class FWE_DLLPUBLIC ReadMenuDocumentHandlerBase : public ThreadHelpBase, // Struct for right initalization of mutex member! Must be first of baseclasses. + public ::cppu::WeakImplHelper1< ::com::sun::star::xml::sax::XDocumentHandler > +{ + public: + ReadMenuDocumentHandlerBase(); + virtual ~ReadMenuDocumentHandlerBase(); + + // XDocumentHandler + virtual void SAL_CALL startDocument(void) + throw ( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ) = 0; + + virtual void SAL_CALL endDocument(void) + throw( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ) = 0; + + virtual void SAL_CALL startElement( + const rtl::OUString& aName, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > &xAttribs) + throw( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ) = 0; + + virtual void SAL_CALL endElement(const rtl::OUString& aName) + throw( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ) = 0; + + virtual void SAL_CALL characters(const rtl::OUString& aChars) + throw( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ) = 0; + + virtual void SAL_CALL ignorableWhitespace(const rtl::OUString& aWhitespaces) + throw( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL processingInstruction(const rtl::OUString& aTarget, + const rtl::OUString& aData) + throw( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL setDocumentLocator( + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator > &xLocator) + throw( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ); + + protected: + ::rtl::OUString getErrorLineString(); + + ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator > m_xLocator; + ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler> m_xReader; + void initPropertyCommon( com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > &rProps, + const rtl::OUString &rCommandURL, const rtl::OUString &rHelpId, + const rtl::OUString &rLabel, sal_Int16 nItemStyleBits ); + private: + rtl::OUString m_aType; + rtl::OUString m_aLabel; + rtl::OUString m_aContainer; + rtl::OUString m_aHelpURL; + rtl::OUString m_aCommandURL; + rtl::OUString m_aStyle; + ::com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > m_aItemProp; +}; + + +class FWE_DLLPUBLIC OReadMenuDocumentHandler : public ReadMenuDocumentHandlerBase +{ + public: + // #110897# + OReadMenuDocumentHandler( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, + const com::sun::star::uno::Reference< com::sun::star::container::XIndexContainer >& rItemContainer ); + virtual ~OReadMenuDocumentHandler(); + + // #110897# + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& getServiceFactory(); + + // XDocumentHandler + virtual void SAL_CALL startDocument(void) + throw ( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL endDocument(void) + throw( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL startElement( + const rtl::OUString& aName, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > &xAttribs) + throw( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL endElement(const rtl::OUString& aName) + throw( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL characters(const rtl::OUString& aChars) + throw( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ); + + private: + int m_nElementDepth; + sal_Bool m_bMenuBarMode; + com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer > m_xMenuBarContainer; + com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleComponentFactory > m_xContainerFactory; + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& mxServiceFactory; +}; // OReadMenuDocumentHandler + + +class FWE_DLLPUBLIC OReadMenuBarHandler : public ReadMenuDocumentHandlerBase +{ + public: + // #110897# + OReadMenuBarHandler( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, + const com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer >& rMenuBarContainer, + const com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleComponentFactory >& rContainerFactory ); + virtual ~OReadMenuBarHandler(); + + // #110897# + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& getServiceFactory(); + + // XDocumentHandler + virtual void SAL_CALL startDocument(void) + throw ( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL endDocument(void) + throw( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL startElement( + const rtl::OUString& aName, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > &xAttribs) + throw( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL endElement(const rtl::OUString& aName) + throw( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL characters(const rtl::OUString& aChars) + throw( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ); + + private: + int m_nElementDepth; + sal_Bool m_bMenuMode; + com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer > m_xMenuBarContainer; + com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleComponentFactory > m_xContainerFactory; + + // #110897# + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& mxServiceFactory; +}; // OReadMenuBarHandler + + +class FWE_DLLPUBLIC OReadMenuHandler : public ReadMenuDocumentHandlerBase +{ + public: + OReadMenuHandler( const com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer >& rMenuContainer, + const com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleComponentFactory >& rContainerFactory ); + virtual ~OReadMenuHandler(); + + // XDocumentHandler + virtual void SAL_CALL startDocument(void) + throw ( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL endDocument(void) + throw( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL startElement( + const rtl::OUString& aName, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > &xAttribs) + throw( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL endElement(const rtl::OUString& aName) + throw( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL characters(const rtl::OUString& aChars) + throw( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ); + + private: + int m_nElementDepth; + sal_Bool m_bMenuPopupMode; + com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer > m_xMenuContainer; + com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleComponentFactory > m_xContainerFactory; +}; // OReadMenuHandler + + +class FWE_DLLPUBLIC OReadMenuPopupHandler : public ReadMenuDocumentHandlerBase +{ + public: + OReadMenuPopupHandler( const com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer >& rMenuContainer, + const com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleComponentFactory >& rContainerFactory ); + virtual ~OReadMenuPopupHandler(); + + // XDocumentHandler + virtual void SAL_CALL startDocument(void) + throw ( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL endDocument(void) + throw ( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL startElement( + const rtl::OUString& aName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList > &xAttribs) + throw ( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL endElement(const rtl::OUString& aName) + throw ( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL characters(const rtl::OUString& aChars) + throw ( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ); + + private: + enum NextElementClose { ELEM_CLOSE_NONE, ELEM_CLOSE_MENUITEM, ELEM_CLOSE_MENUSEPARATOR }; + + int m_nElementDepth; + sal_Bool m_bMenuMode; + com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer > m_xMenuContainer; + com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleComponentFactory > m_xContainerFactory; + com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xComponentContext; + NextElementClose m_nNextElementExpected; +}; // OReadMenuPopupHandler + + +class FWE_DLLPUBLIC OWriteMenuDocumentHandler +{ + public: + OWriteMenuDocumentHandler( + const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& rMenuBarContainer, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler >& rDocumentHandler ); + virtual ~OWriteMenuDocumentHandler(); + + void WriteMenuDocument() throw + ( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); + protected: + virtual void WriteMenu( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& rSubMenuContainer ) throw + ( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); + + virtual void WriteMenuItem( const rtl::OUString& aCommandURL, const rtl::OUString& aLabel, const rtl::OUString& aHelpURL, sal_Int16 nStyle = 0 ); + virtual void WriteMenuSeparator(); + + com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > m_xMenuBarContainer; + ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > m_xWriteDocumentHandler; + ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > m_xEmptyList; + ::rtl::OUString m_aAttributeType; +}; + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_XML_MENUDOCUMENTHANDLER_HXX_ diff --git a/framework/inc/xml/saxnamespacefilter.hxx b/framework/inc/xml/saxnamespacefilter.hxx new file mode 100644 index 000000000000..f4bdfcf677e9 --- /dev/null +++ b/framework/inc/xml/saxnamespacefilter.hxx @@ -0,0 +1,105 @@ +/************************************************************************* + * + * 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_SERVICES_SAXNAMESPACEFILTER_HXX_ +#define __FRAMEWORK_SERVICES_SAXNAMESPACEFILTER_HXX_ + +#include <com/sun/star/xml/sax/XDocumentHandler.hpp> +#include <threadhelp/threadhelpbase.hxx> +#include <xml/xmlnamespaces.hxx> +#include <rtl/ustring.hxx> +#include <vcl/menu.hxx> +#include <cppuhelper/implbase1.hxx> + +#include <stack> +#include <framework/fwedllapi.h> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework +{ + +class FWE_DLLPUBLIC SaxNamespaceFilter : public ThreadHelpBase, // Struct for right initalization of mutex member! Must be first of baseclasses. + public ::cppu::WeakImplHelper1< ::com::sun::star::xml::sax::XDocumentHandler > +{ + public: + SaxNamespaceFilter( ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler >& rSax1DocumentHandler ); + virtual ~SaxNamespaceFilter(); + + // XDocumentHandler + virtual void SAL_CALL startDocument(void) + throw ( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL endDocument(void) + throw( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL startElement( + const rtl::OUString& aName, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > &xAttribs) + throw( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL endElement(const rtl::OUString& aName) + throw( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL characters(const rtl::OUString& aChars) + throw( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL ignorableWhitespace(const rtl::OUString& aWhitespaces) + throw( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL processingInstruction(const rtl::OUString& aTarget, + const rtl::OUString& aData) + throw( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL setDocumentLocator( + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator > &xLocator) + throw( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ); + + protected: + typedef ::std::stack< XMLNamespaces > NamespaceStack; + + ::rtl::OUString getErrorLineString(); + + ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator > m_xLocator; + ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler> xDocumentHandler; + NamespaceStack m_aNamespaceStack; + sal_Int32 m_nDepth; +}; + +} + +#endif // __FRAMEWORK_SERVICES_SAXNAMESPACEFILTER_HXX_ diff --git a/framework/inc/xml/statusbardocumenthandler.hxx b/framework/inc/xml/statusbardocumenthandler.hxx new file mode 100644 index 000000000000..82c2d0c55111 --- /dev/null +++ b/framework/inc/xml/statusbardocumenthandler.hxx @@ -0,0 +1,185 @@ +/************************************************************************* + * + * 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_XML_STATUSBARDOCUMENTHANDLER_HXX_ +#define __FRAMEWORK_XML_STATUSBARDOCUMENTHANDLER_HXX_ + +#ifndef __FRAMEWORK_XML_STATUSBARCONFIGURATION_HXX_ +#include <framework/statusbarconfiguration.hxx> +#endif + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ + +#ifndef __COM_SUN_STAR_XML_SAX_XDOCUMENTHANDLER_HPP_ +#include <com/sun/star/xml/sax/XDocumentHandler.hpp> +#endif + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <threadhelp/threadhelpbase.hxx> +#include <rtl/ustring.hxx> +#include <cppuhelper/implbase1.hxx> + +#include <hash_map> +#include <stdtypes.h> +#include <framework/fwedllapi.h> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//***************************************************************************************************************** +// Hash code function for using in all hash maps of follow implementation. + +class FWE_DLLPUBLIC OReadStatusBarDocumentHandler : private ThreadHelpBase, // Struct for right initalization of lock member! Must be first of baseclasses. + public ::cppu::WeakImplHelper1< ::com::sun::star::xml::sax::XDocumentHandler > +{ + public: + enum StatusBar_XML_Entry + { + SB_ELEMENT_STATUSBAR, + SB_ELEMENT_STATUSBARITEM, + SB_ATTRIBUTE_URL, + SB_ATTRIBUTE_ALIGN, + SB_ATTRIBUTE_STYLE, + SB_ATTRIBUTE_AUTOSIZE, + SB_ATTRIBUTE_OWNERDRAW, + SB_ATTRIBUTE_WIDTH, + SB_ATTRIBUTE_OFFSET, + SB_ATTRIBUTE_HELPURL, + SB_XML_ENTRY_COUNT + }; + + enum StatusBar_XML_Namespace + { + SB_NS_STATUSBAR, + SB_NS_XLINK, + SB_XML_NAMESPACES_COUNT + }; + + OReadStatusBarDocumentHandler( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer >& aStatusBarItems ); + virtual ~OReadStatusBarDocumentHandler(); + + // XDocumentHandler + virtual void SAL_CALL startDocument(void) + throw ( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL endDocument(void) + throw( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL startElement( + const rtl::OUString& aName, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > &xAttribs) + throw( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL endElement(const rtl::OUString& aName) + throw( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL characters(const rtl::OUString& aChars) + throw( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL ignorableWhitespace(const rtl::OUString& aWhitespaces) + throw( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL processingInstruction(const rtl::OUString& aTarget, + const rtl::OUString& aData) + throw( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL setDocumentLocator( + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator > &xLocator) + throw( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ); + + private: + ::rtl::OUString getErrorLineString(); + + class StatusBarHashMap : public ::std::hash_map< ::rtl::OUString , + StatusBar_XML_Entry , + OUStringHashCode , + ::std::equal_to< ::rtl::OUString > > + { + public: + inline void free() + { + StatusBarHashMap().swap( *this ); + } + }; + + sal_Bool m_bStatusBarStartFound; + sal_Bool m_bStatusBarEndFound; + sal_Bool m_bStatusBarItemStartFound; + StatusBarHashMap m_aStatusBarMap; + ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer > m_aStatusBarItems; + ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator > m_xLocator; +}; + +class FWE_DLLPUBLIC OWriteStatusBarDocumentHandler : private ThreadHelpBase // Struct for right initalization of lock member! Must be first of baseclasses. +{ + public: + OWriteStatusBarDocumentHandler( + const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& rStatusBarItems, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler >& rWriteDocHandler ); + virtual ~OWriteStatusBarDocumentHandler(); + + void WriteStatusBarDocument() throw + ( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ); + + protected: + virtual void WriteStatusBarItem( + const rtl::OUString& rCommandURL, + const rtl::OUString& rHelpURL, + sal_Int16 nOffset, + sal_Int16 nStyle, + sal_Int16 nWidth ) throw + ( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ); + + ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > m_aStatusBarItems; + ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > m_xWriteDocumentHandler; + ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > m_xEmptyList; + ::rtl::OUString m_aXMLStatusBarNS; + ::rtl::OUString m_aXMLXlinkNS; + ::rtl::OUString m_aAttributeType; + ::rtl::OUString m_aAttributeURL; +}; + +} // namespace framework + +#endif diff --git a/framework/inc/xml/toolboxconfigurationdefines.hxx b/framework/inc/xml/toolboxconfigurationdefines.hxx new file mode 100644 index 000000000000..0b514b927bc1 --- /dev/null +++ b/framework/inc/xml/toolboxconfigurationdefines.hxx @@ -0,0 +1,112 @@ +/************************************************************************* + * + * 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_XML_TOOLBOXCONFIGURATIONDEFINES_HXX_ +#define __FRAMEWORK_XML_TOOLBOXCONFIGURATIONDEFINES_HXX_ + +#define XMLNS_TOOLBAR "http://openoffice.org/2001/toolbar" +#define XMLNS_XLINK "http://www.w3.org/1999/xlink" +#define XMLNS_TOOLBAR_PREFIX "toolbar:" +#define XMLNS_XLINK_PREFIX "xlink:" + +#define XMLNS_FILTER_SEPARATOR "^" + +#define ELEMENT_TOOLBAR "toolbar" +#define ELEMENT_TOOLBARITEM "toolbaritem" +#define ELEMENT_TOOLBARSPACE "toolbarspace" +#define ELEMENT_TOOLBARBREAK "toolbarbreak" +#define ELEMENT_TOOLBARSEPARATOR "toolbarseparator" + +#define ELEMENT_TOOLBARLAYOUTS "toolbarlayouts" +#define ELEMENT_TOOLBARLAYOUT "toolbarlayout" +#define ELEMENT_TOOLBARCONFIGITEMS "toolbarconfigitems" +#define ELEMENT_TOOLBARCONFIGITEM "toolbarconfigitem" + +#define ATTRIBUTE_UINAME "uiname" + +#define ATTRIBUTE_BITMAP "bitmap" +#define ATTRIBUTE_TEXT "text" +#define ATTRIBUTE_URL "href" +#define ATTRIBUTE_ITEMBITS "property" +#define ATTRIBUTE_VISIBLE "visible" +#define ATTRIBUTE_WIDTH "width" +#define ATTRIBUTE_USER "userdefined" +#define ATTRIBUTE_HELPID "helpid" +#define ATTRIBUTE_TOOLTIP "tooltip" +#define ATTRIBUTE_ITEMSTYLE "style" + +#define ATTRIBUTE_ID "id" +#define ATTRIBUTE_FLOATINGPOSLEFT "floatingposleft" +#define ATTRIBUTE_FLOATINGPOSTOP "floatingpostop" +#define ATTRIBUTE_TOOLBARNAME "toolbarname" +#define ATTRIBUTE_CONTEXT "context" +#define ATTRIBUTE_FLOATINGLINES "floatinglines" +#define ATTRIBUTE_DOCKINGLINES "dockinglines" +#define ATTRIBUTE_ALIGN "align" +#define ATTRIBUTE_FLOATING "floating" +#define ATTRIBUTE_BUTTONTYPE "style" +#define ATTRIBUTE_USERDEFNAME "userdefname" + +#define ELEMENT_NS_TOOLBAR "toolbar:toolbar" +#define ELEMENT_NS_TOOLBARITEM "toolbar:toolbaritem" +#define ELEMENT_NS_TOOLBARSPACE "toolbar:toolbarspace" +#define ELEMENT_NS_TOOLBARBREAK "toolbar:toolbarbreak" +#define ELEMENT_NS_TOOLBARSEPARATOR "toolbar:toolbarseparator" + +#define ELEMENT_NS_TOOLBARLAYOUTS "toolbar:toolbarlayouts" +#define ELEMENT_NS_TOOLBARLAYOUT "toolbar:toolbarlayout" +#define ELEMENT_NS_TOOLBARCONFIGITEMS "toolbar:toolbarconfigitems" +#define ELEMENT_NS_TOOLBARCONFIGITEM "toolbar:toolbarconfigitem" + +#define ATTRIBUTE_XMLNS_TOOLBAR "xmlns:toolbar" +#define ATTRIBUTE_XMLNS_XLINK "xmlns:xlink" + +#define ATTRIBUTE_TYPE_CDATA "CDATA" + +#define ATTRIBUTE_BOOLEAN_TRUE "true" +#define ATTRIBUTE_BOOLEAN_FALSE "false" + +#define ATTRIBUTE_ALIGN_LEFT "left" +#define ATTRIBUTE_ALIGN_RIGHT "right" +#define ATTRIBUTE_ALIGN_TOP "top" +#define ATTRIBUTE_ALIGN_BOTTOM "bottom" + +#define ATTRIBUTE_STYLE_TEXT "text" +#define ATTRIBUTE_STYLE_SYMBOL "symbol" +#define ATTRIBUTE_STYLE_SYMBOLTEXT "symboltext" +#define ATTRIBUTE_STYLE_SYMBOLPLUSTEXT "symbol+text" + +#define ATTRIBUTE_ITEMSTYLE_RADIO "radio" +#define ATTRIBUTE_ITEMSTYLE_AUTO "auto" +#define ATTRIBUTE_ITEMSTYLE_LEFT "left" +#define ATTRIBUTE_ITEMSTYLE_AUTOSIZE "autosize" +#define ATTRIBUTE_ITEMSTYLE_DROPDOWN "dropdown" +#define ATTRIBUTE_ITEMSTYLE_REPEAT "repeat" +#define ATTRIBUTE_ITEMSTYLE_TEXT "text" +#define ATTRIBUTE_ITEMSTYLE_DROPDOWNONLY "dropdownonly" +#define ATTRIBUTE_ITEMSTYLE_IMAGE "image" + +#endif // __FRAMEWORK_XML_TOOLBOXCONFIGURATIONDEFINES_HXX_ diff --git a/framework/inc/xml/toolboxdocumenthandler.hxx b/framework/inc/xml/toolboxdocumenthandler.hxx new file mode 100644 index 000000000000..d90d91cee036 --- /dev/null +++ b/framework/inc/xml/toolboxdocumenthandler.hxx @@ -0,0 +1,214 @@ +/************************************************************************* + * + * 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_XML_TOOLBOXDOCUMENTHANDLER_HXX_ +#define __FRAMEWORK_XML_TOOLBOXDOCUMENTHANDLER_HXX_ + +#include <framework/toolboxconfiguration.hxx> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/xml/sax/XDocumentHandler.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <threadhelp/threadhelpbase.hxx> +#include <rtl/ustring.hxx> +#include <cppuhelper/implbase1.hxx> +#include <stdtypes.h> +#include <framework/fwedllapi.h> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//***************************************************************************************************************** +// Hash code function for using in all hash maps of follow implementation. + +class FWE_DLLPUBLIC OReadToolBoxDocumentHandler : private ThreadHelpBase, // Struct for right initalization of lock member! Must be first of baseclasses. + public ::cppu::WeakImplHelper1< ::com::sun::star::xml::sax::XDocumentHandler > +{ + public: + enum ToolBox_XML_Entry + { + TB_ELEMENT_TOOLBAR, + TB_ELEMENT_TOOLBARITEM, + TB_ELEMENT_TOOLBARSPACE, + TB_ELEMENT_TOOLBARBREAK, + TB_ELEMENT_TOOLBARSEPARATOR, + TB_ATTRIBUTE_TEXT, + TB_ATTRIBUTE_BITMAP, + TB_ATTRIBUTE_URL, + TB_ATTRIBUTE_ITEMBITS, + TB_ATTRIBUTE_VISIBLE, + TB_ATTRIBUTE_WIDTH, + TB_ATTRIBUTE_USER, + TB_ATTRIBUTE_HELPID, + TB_ATTRIBUTE_STYLE, + TB_ATTRIBUTE_UINAME, + TB_ATTRIBUTE_TOOLTIP, + TB_XML_ENTRY_COUNT + }; + + enum ToolBox_XML_Namespace + { + TB_NS_TOOLBAR, + TB_NS_XLINK, + TB_XML_NAMESPACES_COUNT + }; + + OReadToolBoxDocumentHandler( const ::com::sun::star::uno::Reference< com::sun::star::container::XIndexContainer >& rItemContainer ); + virtual ~OReadToolBoxDocumentHandler(); + + // XDocumentHandler + virtual void SAL_CALL startDocument(void) + throw ( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL endDocument(void) + throw( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL startElement( + const rtl::OUString& aName, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > &xAttribs) + throw( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL endElement(const rtl::OUString& aName) + throw( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL characters(const rtl::OUString& aChars) + throw( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL ignorableWhitespace(const rtl::OUString& aWhitespaces) + throw( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL processingInstruction(const rtl::OUString& aTarget, + const rtl::OUString& aData) + throw( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL setDocumentLocator( + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator > &xLocator) + throw( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ); + + private: + ::rtl::OUString getErrorLineString(); + + class ToolBoxHashMap : public ::std::hash_map< ::rtl::OUString , + ToolBox_XML_Entry , + OUStringHashCode , + ::std::equal_to< ::rtl::OUString > > + { + public: + inline void free() + { + ToolBoxHashMap().swap( *this ); + } + }; + + sal_Bool m_bToolBarStartFound : 1; + sal_Bool m_bToolBarEndFound : 1; + sal_Bool m_bToolBarItemStartFound : 1; + sal_Bool m_bToolBarSpaceStartFound : 1; + sal_Bool m_bToolBarBreakStartFound : 1; + sal_Bool m_bToolBarSeparatorStartFound : 1; + ToolBoxHashMap m_aToolBoxMap; + com::sun::star::uno::Reference< com::sun::star::container::XIndexContainer > m_rItemContainer; + ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator > m_xLocator; + + sal_Int32 m_nHashCode_Style_Radio; + sal_Int32 m_nHashCode_Style_Auto; + sal_Int32 m_nHashCode_Style_Left; + sal_Int32 m_nHashCode_Style_AutoSize; + sal_Int32 m_nHashCode_Style_DropDown; + sal_Int32 m_nHashCode_Style_Repeat; + sal_Int32 m_nHashCode_Style_DropDownOnly; + sal_Int32 m_nHashCode_Style_Text; + sal_Int32 m_nHashCode_Style_Image; + rtl::OUString m_aType; + rtl::OUString m_aLabel; + rtl::OUString m_aStyle; + rtl::OUString m_aHelpURL; + rtl::OUString m_aTooltip; + rtl::OUString m_aIsVisible; + rtl::OUString m_aCommandURL; +}; + + +class FWE_DLLPUBLIC OWriteToolBoxDocumentHandler : private ThreadHelpBase // Struct for right initalization of lock member! Must be first of baseclasses. +{ + public: + OWriteToolBoxDocumentHandler( + const ::com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess >& rItemAccess, + ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler >& rDocumentHandler ); + virtual ~OWriteToolBoxDocumentHandler(); + + void WriteToolBoxDocument() throw + ( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ); + + protected: + virtual void WriteToolBoxItem( const rtl::OUString& aCommandURL, const rtl::OUString& aLabel, const rtl::OUString& aHelpURL, const rtl::OUString& aTooltip, sal_Int16 nStyle, + sal_Int16 nWidth, sal_Bool bVisible ) throw + ( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ); + + virtual void WriteToolBoxSpace() throw + ( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ); + + virtual void WriteToolBoxBreak() throw + ( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ); + + virtual void WriteToolBoxSeparator() throw + ( ::com::sun::star::xml::sax::SAXException, + ::com::sun::star::uno::RuntimeException ); + + ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > m_xWriteDocumentHandler; + ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > m_xEmptyList; + com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess > m_rItemAccess; + ::rtl::OUString m_aXMLToolbarNS; + ::rtl::OUString m_aXMLXlinkNS; + ::rtl::OUString m_aAttributeType; + ::rtl::OUString m_aAttributeURL; +}; + +} // namespace framework + +#endif diff --git a/framework/inc/xml/xmlnamespaces.hxx b/framework/inc/xml/xmlnamespaces.hxx new file mode 100644 index 000000000000..bcb9ec4cb5e3 --- /dev/null +++ b/framework/inc/xml/xmlnamespaces.hxx @@ -0,0 +1,66 @@ +/************************************************************************* + * + * 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_XML_XMLNAMESPACES_HXX_ +#define __FRAMEWORK_XML_XMLNAMESPACES_HXX_ + +#include <com/sun/star/xml/sax/SAXException.hpp> + +#include <map> +#include <framework/fwedllapi.h> + +namespace framework +{ + +class FWE_DLLPUBLIC XMLNamespaces +{ + public: + XMLNamespaces(); + XMLNamespaces( const XMLNamespaces& ); + virtual ~XMLNamespaces(); + + void addNamespace( const ::rtl::OUString& aName, const ::rtl::OUString& aValue ) + throw( ::com::sun::star::xml::sax::SAXException ); + + ::rtl::OUString applyNSToAttributeName( const ::rtl::OUString& ) const + throw( ::com::sun::star::xml::sax::SAXException ); + ::rtl::OUString applyNSToElementName( const ::rtl::OUString& ) const + throw( ::com::sun::star::xml::sax::SAXException ); + + private: + typedef ::std::map< ::rtl::OUString, ::rtl::OUString > NamespaceMap; + + ::rtl::OUString getNamespaceValue( const ::rtl::OUString& aNamespace ) const + throw( ::com::sun::star::xml::sax::SAXException ); + + ::rtl::OUString m_aDefaultNamespace; + NamespaceMap m_aNamespaceMap; +}; + +} + +#endif // __FRAMEWORK_XML_XMLNAMESPACES_HXX_ |