summaryrefslogtreecommitdiff
path: root/framework/source/inc
diff options
context:
space:
mode:
Diffstat (limited to 'framework/source/inc')
-rw-r--r--framework/source/inc/accelerators/acceleratorcache.hxx187
-rw-r--r--framework/source/inc/accelerators/acceleratorconfiguration.hxx476
-rw-r--r--framework/source/inc/accelerators/documentacceleratorconfiguration.hxx124
-rw-r--r--framework/source/inc/accelerators/globalacceleratorconfiguration.hxx109
-rw-r--r--framework/source/inc/accelerators/istoragelistener.hxx64
-rw-r--r--framework/source/inc/accelerators/keymapping.hxx162
-rw-r--r--framework/source/inc/accelerators/moduleacceleratorconfiguration.hxx115
-rw-r--r--framework/source/inc/accelerators/presethandler.hxx535
-rw-r--r--framework/source/inc/accelerators/storageholder.hxx261
-rw-r--r--framework/source/inc/constant/containerquery.hxx47
-rw-r--r--framework/source/inc/constant/contenthandler.hxx47
-rw-r--r--framework/source/inc/constant/filter.hxx126
-rw-r--r--framework/source/inc/constant/frameloader.hxx47
-rw-r--r--framework/source/inc/dispatch/loaddispatcher.hxx161
-rw-r--r--framework/source/inc/dispatch/uieventloghelper.hxx82
-rwxr-xr-xframework/source/inc/dispatch/windowcommanddispatch.hxx174
-rw-r--r--framework/source/inc/loadenv/actionlockguard.hxx209
-rw-r--r--framework/source/inc/loadenv/loaddispatchlistener.hxx165
-rw-r--r--framework/source/inc/loadenv/loadenv.hxx695
-rw-r--r--framework/source/inc/loadenv/loadenvexception.hxx197
-rw-r--r--framework/source/inc/loadenv/targethelper.hxx124
-rw-r--r--framework/source/inc/pattern/configuration.hxx176
-rw-r--r--framework/source/inc/pattern/frame.hxx130
-rw-r--r--framework/source/inc/pattern/storages.hxx102
-rw-r--r--framework/source/inc/pattern/window.hxx155
25 files changed, 4670 insertions, 0 deletions
diff --git a/framework/source/inc/accelerators/acceleratorcache.hxx b/framework/source/inc/accelerators/acceleratorcache.hxx
new file mode 100644
index 000000000000..23ec86df8a00
--- /dev/null
+++ b/framework/source/inc/accelerators/acceleratorcache.hxx
@@ -0,0 +1,187 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public 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_ACCELERATORS_ACCELERATORCACHE_HXX_
+#define __FRAMEWORK_ACCELERATORS_ACCELERATORCACHE_HXX_
+
+//__________________________________________
+// own includes
+
+#include <threadhelp/threadhelpbase.hxx>
+#include <general.h>
+#include <stdtypes.h>
+
+//__________________________________________
+// interface includes
+
+#ifndef __COM_SUN_STAR_AWT_KEYEVENT_HPP_
+#include <com/sun/star/awt/KeyEvent.hpp>
+#endif
+
+//__________________________________________
+// other includes
+#include <comphelper/sequenceasvector.hxx>
+
+//__________________________________________
+// definition
+
+namespace framework
+{
+
+//__________________________________________
+/**
+ @short implements a cache for any accelerator configuration.
+
+ @descr Its implemented threadsafe, supports copy-on-write pattern
+ and a flush mechansim to support concurrent access to the same
+ configuration.
+
+ copy-on-write ... How? Do the following:
+ */
+class AcceleratorCache : public ThreadHelpBase // attention! Must be the first base class to guarentee right initialize lock ...
+{
+ //______________________________________
+ // const, types
+
+ public:
+
+ //---------------------------------------
+ /** TODO document me
+ commands -> keys
+ */
+ typedef ::comphelper::SequenceAsVector< css::awt::KeyEvent > TKeyList;
+ typedef BaseHash< TKeyList > TCommand2Keys;
+
+ //---------------------------------------
+ /** TODO document me
+ keys -> commands
+ */
+ typedef ::std::hash_map< css::awt::KeyEvent ,
+ ::rtl::OUString ,
+ KeyEventHashCode ,
+ KeyEventEqualsFunc > TKey2Commands;
+
+ //______________________________________
+ // member
+
+ private:
+
+ //---------------------------------------
+ /** map commands to keys in relation 1:n.
+ First key is interpreted as preferred one! */
+ TCommand2Keys m_lCommand2Keys;
+
+ //---------------------------------------
+ /** map keys to commands in relation 1:1. */
+ TKey2Commands m_lKey2Commands;
+
+ //______________________________________
+ // interface
+
+ public:
+
+ //---------------------------------------
+ /** @short creates a new - but empty - cache instance. */
+ AcceleratorCache();
+
+ //---------------------------------------
+ /** @short make a copy of this cache.
+ @descr Used for the copy-on-write feature.
+ */
+ AcceleratorCache(const AcceleratorCache& rCopy);
+
+ //---------------------------------------
+ /** @short does nothing real. */
+ virtual ~AcceleratorCache();
+
+ //---------------------------------------
+ /** @short write changes back to the original container.
+
+ @param rCopy
+ the (changed!) copy, which should be written
+ back to this original container.
+ */
+ virtual void takeOver(const AcceleratorCache& rCopy);
+
+ //---------------------------------------
+ /** TODO document me */
+ virtual AcceleratorCache& operator=(const AcceleratorCache& rCopy);
+
+ //---------------------------------------
+ /** @short checks if the specified key exists.
+
+ @param aKey
+ the key, which should be checked.
+
+ @return [bool]
+ TRUE if the speicfied key exists inside this container.
+ */
+ virtual sal_Bool hasKey(const css::awt::KeyEvent& aKey) const;
+ virtual sal_Bool hasCommand(const ::rtl::OUString& sCommand) const;
+
+ //---------------------------------------
+ /** TODO document me */
+ virtual TKeyList getAllKeys() const;
+
+ //---------------------------------------
+ /** @short add a new or change an existing key-command pair
+ of this container.
+
+ @param aKey
+ describe the key.
+
+ @param sCommand
+ describe the command.
+ */
+ virtual void setKeyCommandPair(const css::awt::KeyEvent& aKey ,
+ const ::rtl::OUString& sCommand);
+
+ //---------------------------------------
+ /** @short returns the list of keys, which are registered
+ for this command.
+
+ @param sCommand
+ describe the command.
+
+ @return [TKeyList]
+ the list of registered keys. Can be empty!
+ */
+ virtual TKeyList getKeysByCommand(const ::rtl::OUString& sCommand) const;
+
+ //---------------------------------------
+ /** TODO */
+ virtual ::rtl::OUString getCommandByKey(const css::awt::KeyEvent& aKey) const;
+
+ //---------------------------------------
+ /** TODO */
+ virtual void removeKey(const css::awt::KeyEvent& aKey);
+ virtual void removeCommand(const ::rtl::OUString& sCommand);
+};
+
+} // namespace framework
+
+#endif // __FRAMEWORK_ACCELERATORS_ACCELERATORCACHE_HXX_
diff --git a/framework/source/inc/accelerators/acceleratorconfiguration.hxx b/framework/source/inc/accelerators/acceleratorconfiguration.hxx
new file mode 100644
index 000000000000..36eed6a6d534
--- /dev/null
+++ b/framework/source/inc/accelerators/acceleratorconfiguration.hxx
@@ -0,0 +1,476 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public 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_ACCELERATORS_ACCELERATORCONFIGURATION_HXX_
+#define __FRAMEWORK_ACCELERATORS_ACCELERATORCONFIGURATION_HXX_
+
+//__________________________________________
+// own includes
+
+#include <accelerators/istoragelistener.hxx>
+#include <accelerators/presethandler.hxx>
+#include <accelerators/acceleratorcache.hxx>
+#include <accelerators/keymapping.hxx>
+#include <macros/xinterface.hxx>
+#include <macros/xtypeprovider.hxx>
+#include <threadhelp/threadhelpbase.hxx>
+#include <general.h>
+#include <stdtypes.h>
+
+//__________________________________________
+// interface includes
+
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/ui/XAcceleratorConfiguration.hpp>
+#include <com/sun/star/ui/XUIConfiguration.hpp>
+#include <com/sun/star/ui/XUIConfigurationPersistence.hpp>
+
+#include <com/sun/star/ui/XUIConfigurationStorage.hpp>
+#include <com/sun/star/io/XStream.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/util/XChangesListener.hpp>
+
+// TODO use XPresetHandler interface instead if available
+#include <com/sun/star/form/XReset.hpp>
+
+//__________________________________________
+// other includes
+#include <cppuhelper/propshlp.hxx>
+#include <cppuhelper/weak.hxx>
+#include <comphelper/locale.hxx>
+#include <salhelper/singletonref.hxx>
+
+//__________________________________________
+// definition
+
+namespace framework
+{
+//-----------------------------------------------
+// Accelerators.xcu
+
+static const ::rtl::OUString CFG_ENTRY_PRIMARY = ::rtl::OUString::createFromAscii("PrimaryKeys");
+static const ::rtl::OUString CFG_ENTRY_SECONDARY = ::rtl::OUString::createFromAscii("SecondaryKeys");
+
+static const ::rtl::OUString CFG_ENTRY_GLOBAL = ::rtl::OUString::createFromAscii("Global");
+static const ::rtl::OUString CFG_ENTRY_MODULES = ::rtl::OUString::createFromAscii("Modules");
+
+static const ::rtl::OUString CFG_PROP_COMMAND = ::rtl::OUString::createFromAscii("Command");
+
+/** "global" type to make accelerator presets unique, so they can be used
+ in combination with the salhelper::SingletonRef mechanism! */
+typedef PresetHandler AcceleratorPresets;
+
+//__________________________________________
+/**
+ implements a read/write access to the accelerator configuration.
+ */
+class XMLBasedAcceleratorConfiguration : protected ThreadHelpBase // attention! Must be the first base class to guarentee right initialize lock ...
+ , public IStorageListener
+ , public ::cppu::OWeakObject
+ , public css::lang::XTypeProvider
+ , public css::form::XReset // TODO use XPresetHandler instead if available
+ , public css::ui::XAcceleratorConfiguration // => css::ui::XUIConfigurationPersistence
+ // css::ui::XUIConfigurationStorage
+ // css::ui::XUIConfiguration
+{
+ //______________________________________
+ // member
+
+ protected:
+
+ //---------------------------------------
+ /** the global uno service manager.
+ Must be used to create own needed services. */
+ css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR;
+
+ //---------------------------------------
+ /** used to:
+ i ) copy configuration files from the share to the user layer
+ ii ) provide access to these config files
+ iii) cache all sub storages on the path from the top to the bottom(!)
+ iv ) provide commit for changes. */
+ PresetHandler m_aPresetHandler;
+
+ //---------------------------------------
+ /** contains the cached configuration data */
+ AcceleratorCache m_aReadCache;
+
+ //---------------------------------------
+ /** used to implement the copy on write pattern! */
+ AcceleratorCache* m_pWriteCache;
+
+ //______________________________________
+ // native interface!
+
+ public:
+
+ XMLBasedAcceleratorConfiguration( const css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR );
+ virtual ~XMLBasedAcceleratorConfiguration( );
+
+ //______________________________________
+ // uno interface!
+
+ public:
+
+ // XInterface, XTypeProvider
+ FWK_DECLARE_XINTERFACE
+ FWK_DECLARE_XTYPEPROVIDER
+
+ // XAcceleratorConfiguration
+ virtual css::uno::Sequence< css::awt::KeyEvent > SAL_CALL getAllKeyEvents()
+ throw(css::uno::RuntimeException);
+
+ virtual ::rtl::OUString SAL_CALL getCommandByKeyEvent(const css::awt::KeyEvent& aKeyEvent)
+ throw(css::container::NoSuchElementException,
+ css::uno::RuntimeException );
+
+ virtual void SAL_CALL setKeyEvent(const css::awt::KeyEvent& aKeyEvent,
+ const ::rtl::OUString& sCommand )
+ throw(css::lang::IllegalArgumentException,
+ css::uno::RuntimeException );
+
+ virtual void SAL_CALL removeKeyEvent(const css::awt::KeyEvent& aKeyEvent)
+ throw(css::container::NoSuchElementException,
+ css::uno::RuntimeException );
+
+ virtual css::uno::Sequence< css::awt::KeyEvent > SAL_CALL getKeyEventsByCommand(const ::rtl::OUString& sCommand)
+ throw(css::lang::IllegalArgumentException ,
+ css::container::NoSuchElementException,
+ css::uno::RuntimeException );
+
+ virtual css::uno::Sequence< css::uno::Any > SAL_CALL getPreferredKeyEventsForCommandList(const css::uno::Sequence< ::rtl::OUString >& lCommandList)
+ throw(css::lang::IllegalArgumentException ,
+ css::uno::RuntimeException );
+
+ virtual void SAL_CALL removeCommandFromAllKeyEvents(const ::rtl::OUString& sCommand)
+ throw(css::lang::IllegalArgumentException ,
+ css::container::NoSuchElementException,
+ css::uno::RuntimeException );
+
+ // XUIConfigurationPersistence
+ virtual void SAL_CALL reload()
+ throw(css::uno::Exception ,
+ css::uno::RuntimeException);
+
+ virtual void SAL_CALL store()
+ throw(css::uno::Exception ,
+ css::uno::RuntimeException);
+
+ virtual void SAL_CALL storeToStorage(const css::uno::Reference< css::embed::XStorage >& xStorage)
+ throw(css::uno::Exception ,
+ css::uno::RuntimeException);
+
+ virtual ::sal_Bool SAL_CALL isModified()
+ throw(css::uno::RuntimeException);
+
+ virtual ::sal_Bool SAL_CALL isReadOnly()
+ throw(css::uno::RuntimeException);
+
+ // XUIConfigurationStorage
+ virtual void SAL_CALL setStorage(const css::uno::Reference< css::embed::XStorage >& xStorage)
+ throw(css::uno::RuntimeException);
+
+ virtual ::sal_Bool SAL_CALL hasStorage()
+ throw(css::uno::RuntimeException);
+
+ // XUIConfiguration
+ virtual void SAL_CALL addConfigurationListener(const css::uno::Reference< css::ui::XUIConfigurationListener >& xListener)
+ throw(css::uno::RuntimeException);
+
+ virtual void SAL_CALL removeConfigurationListener(const css::uno::Reference< css::ui::XUIConfigurationListener >& xListener)
+ throw(css::uno::RuntimeException);
+
+ // XReset
+ // TODO use XPresetHandler instead if available
+ virtual void SAL_CALL reset()
+ throw(css::uno::RuntimeException);
+
+ virtual void SAL_CALL addResetListener(const css::uno::Reference< css::form::XResetListener >& xListener)
+ throw(css::uno::RuntimeException);
+
+ virtual void SAL_CALL removeResetListener(const css::uno::Reference< css::form::XResetListener >& xListener)
+ throw(css::uno::RuntimeException);
+
+ // IStorageListener
+ virtual void changesOccured(const ::rtl::OUString& sPath);
+
+ //______________________________________
+ // helper for derived classes
+
+ protected:
+
+ //---------------------------------------
+ /** @short return the current office locale.
+
+ @descr We does not cache this value, because we are not listen
+ for changes on the configuration layer ...
+
+ @return ::comphelper::Locale
+ The current office locale.
+ */
+ ::comphelper::Locale impl_ts_getLocale() const;
+
+ //______________________________________
+ // helper
+
+ private:
+
+ //---------------------------------------
+ /** @short load a configuration set, using the given stream.
+
+ @param xStream
+ provides the XML structure as stream.
+ */
+ void impl_ts_load(const css::uno::Reference< css::io::XInputStream >& xStream);
+
+ //---------------------------------------
+ /** @short save a configuration set, using the given stream.
+
+ @param xStream
+ the XML structure can be written there.
+ */
+ void impl_ts_save(const css::uno::Reference< css::io::XOutputStream >& xStream);
+
+ //---------------------------------------
+ /** @short try to locate and open a sub storage.
+
+ @descr It search at the root storage for the specified
+ sub storage. If it exists - it will be opened.
+ By default this method tries to open the storage
+ for reading. But the calli can request a writeable
+ storage.
+
+ @param xRooStorage
+ used to locate the sub storage.
+
+ @param sSubStorage
+ relativ path of the sub storage.
+
+ @param bOutStream
+ force open of the sub storage in
+ write mode - instead of read mode, which
+ is the default.
+
+ @return [XInterface]
+ will be a css::io::XInpoutStream or a css::io::XOutputStream.
+ Depends from the parameter bWriteable!
+ */
+ css::uno::Reference< css::uno::XInterface > impl_ts_openSubStorage(const css::uno::Reference< css::embed::XStorage >& xRootStorage,
+ const ::rtl::OUString& sSubStorage ,
+ sal_Bool bOutStream );
+
+ //---------------------------------------
+ /** @short returns a reference to one of our internal cache members.
+
+ @descr We implement the copy-on-write pattern. Doing so
+ we know two caches internaly. The second one is used
+ only, if the container was changed.
+
+ This method here returns access to one of these
+ caches - depending on the change state of this
+ configuration service.
+
+ @param bWriteAccessRequested
+ if the outside code whish to change the container
+ it must call this method with "TRUE". So the internal
+ cache can be prepared for that (means copy-on-write ...).
+
+ @return [AcceleratorCache]
+ c++ reference(!) to one of our internal caches.
+ */
+ AcceleratorCache& impl_getCFG(sal_Bool bWriteAccessRequested = sal_False);
+
+};
+
+class XCUBasedAcceleratorConfiguration : protected ThreadHelpBase // attention! Must be the first base class to guarentee right initialize lock ...
+ , public ::cppu::OWeakObject
+ , public css::lang::XTypeProvider
+ , public css::util::XChangesListener
+ , public css::form::XReset // TODO use XPresetHandler instead if available
+ , public css::ui::XAcceleratorConfiguration // => css::ui::XUIConfigurationPersistence
+ // css::ui::XUIConfigurationStorage
+ // css::ui::XUIConfiguration
+{
+ //______________________________________
+ // member
+
+ protected:
+
+ //---------------------------------------
+ /** the global uno service manager.
+ Must be used to create own needed services. */
+ css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR;
+
+ css::uno::Reference< css::container::XNameAccess > m_xCfg;
+ AcceleratorCache m_aPrimaryReadCache;
+ AcceleratorCache m_aSecondaryReadCache;
+ AcceleratorCache* m_pPrimaryWriteCache;
+ AcceleratorCache* m_pSecondaryWriteCache;
+
+ ::rtl::OUString m_sGlobalOrModules;
+ ::rtl::OUString m_sModuleCFG;
+
+ ::salhelper::SingletonRef< KeyMapping > m_rKeyMapping;
+
+ //______________________________________
+ // native interface!
+
+ public:
+
+ XCUBasedAcceleratorConfiguration( const css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR );
+ virtual ~XCUBasedAcceleratorConfiguration( );
+
+ //______________________________________
+ // uno interface!
+
+ public:
+
+ // XInterface, XTypeProvider
+ FWK_DECLARE_XINTERFACE
+ FWK_DECLARE_XTYPEPROVIDER
+
+ // XAcceleratorConfiguration
+ virtual css::uno::Sequence< css::awt::KeyEvent > SAL_CALL getAllKeyEvents()
+ throw(css::uno::RuntimeException);
+
+ virtual ::rtl::OUString SAL_CALL getCommandByKeyEvent(const css::awt::KeyEvent& aKeyEvent)
+ throw(css::container::NoSuchElementException,
+ css::uno::RuntimeException );
+
+ virtual void SAL_CALL setKeyEvent(const css::awt::KeyEvent& aKeyEvent,
+ const ::rtl::OUString& sCommand )
+ throw(css::lang::IllegalArgumentException,
+ css::uno::RuntimeException );
+
+ virtual void SAL_CALL removeKeyEvent(const css::awt::KeyEvent& aKeyEvent)
+ throw(css::container::NoSuchElementException,
+ css::uno::RuntimeException );
+
+ virtual css::uno::Sequence< css::awt::KeyEvent > SAL_CALL getKeyEventsByCommand(const ::rtl::OUString& sCommand)
+ throw(css::lang::IllegalArgumentException ,
+ css::container::NoSuchElementException,
+ css::uno::RuntimeException );
+
+ virtual css::uno::Sequence< css::uno::Any > SAL_CALL getPreferredKeyEventsForCommandList(const css::uno::Sequence< ::rtl::OUString >& lCommandList)
+ throw(css::lang::IllegalArgumentException ,
+ css::uno::RuntimeException );
+
+ virtual void SAL_CALL removeCommandFromAllKeyEvents(const ::rtl::OUString& sCommand)
+ throw(css::lang::IllegalArgumentException ,
+ css::container::NoSuchElementException,
+ css::uno::RuntimeException );
+
+ // XUIConfigurationPersistence
+ virtual void SAL_CALL reload()
+ throw(css::uno::Exception ,
+ css::uno::RuntimeException);
+
+ virtual void SAL_CALL store()
+ throw(css::uno::Exception ,
+ css::uno::RuntimeException);
+
+ virtual void SAL_CALL storeToStorage(const css::uno::Reference< css::embed::XStorage >& xStorage)
+ throw(css::uno::Exception ,
+ css::uno::RuntimeException);
+
+ virtual ::sal_Bool SAL_CALL isModified()
+ throw(css::uno::RuntimeException);
+
+ virtual ::sal_Bool SAL_CALL isReadOnly()
+ throw(css::uno::RuntimeException);
+
+ // XUIConfigurationStorage
+ virtual void SAL_CALL setStorage(const css::uno::Reference< css::embed::XStorage >& xStorage)
+ throw(css::uno::RuntimeException);
+
+ virtual ::sal_Bool SAL_CALL hasStorage()
+ throw(css::uno::RuntimeException);
+
+ // XUIConfiguration
+ virtual void SAL_CALL addConfigurationListener(const css::uno::Reference< css::ui::XUIConfigurationListener >& xListener)
+ throw(css::uno::RuntimeException);
+
+ virtual void SAL_CALL removeConfigurationListener(const css::uno::Reference< css::ui::XUIConfigurationListener >& xListener)
+ throw(css::uno::RuntimeException);
+
+ // XReset
+ // TODO use XPresetHandler instead if available
+ virtual void SAL_CALL reset()
+ throw(css::uno::RuntimeException);
+
+ virtual void SAL_CALL addResetListener(const css::uno::Reference< css::form::XResetListener >& xListener)
+ throw(css::uno::RuntimeException);
+
+ virtual void SAL_CALL removeResetListener(const css::uno::Reference< css::form::XResetListener >& xListener)
+ throw(css::uno::RuntimeException);
+
+ // 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& aEvent)
+ throw(css::uno::RuntimeException);
+
+ //______________________________________
+ // helper for derived classes
+
+ protected:
+
+ //---------------------------------------
+ /** @short return the current office locale.
+
+ @descr We does not cache this value, because we are not listen
+ for changes on the configuration layer ...
+
+ @return ::comphelper::Locale
+ The current office locale.
+ */
+ ::comphelper::Locale impl_ts_getLocale() const;
+
+ //______________________________________
+ // helper
+
+ private:
+
+ void impl_ts_load(sal_Bool bPreferred, const css::uno::Reference< css::container::XNameAccess >& xCfg);
+ void impl_ts_save(sal_Bool bPreferred, const css::uno::Reference< css::container::XNameAccess >& xCfg);
+
+ void insertKeyToConfiguration(const css::awt::KeyEvent& aKeyEvent, const ::rtl::OUString& sCommand, const sal_Bool bPreferred);
+ void removeKeyFromConfiguration(const css::awt::KeyEvent& aKeyEvent, const sal_Bool bPreferred);
+
+ void reloadChanged(const ::rtl::OUString& sPrimarySecondary, const ::rtl::OUString& sGlobalModules, const ::rtl::OUString& sModule, const ::rtl::OUString& sKey);
+ AcceleratorCache& impl_getCFG(sal_Bool bPreferred, sal_Bool bWriteAccessRequested = sal_False);
+
+};
+
+} // namespace framework
+
+#endif // __FRAMEWORK_ACCELERATORS_ACCELERATORCONFIGURATION_HXX_
diff --git a/framework/source/inc/accelerators/documentacceleratorconfiguration.hxx b/framework/source/inc/accelerators/documentacceleratorconfiguration.hxx
new file mode 100644
index 000000000000..43714abeee60
--- /dev/null
+++ b/framework/source/inc/accelerators/documentacceleratorconfiguration.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_ACCELERATORS_DOCUMENTACCELERATORCONFIGURATION_HXX_
+#define __FRAMEWORK_ACCELERATORS_DOCUMENTACCELERATORCONFIGURATION_HXX_
+
+//__________________________________________
+// own includes
+
+#include <accelerators/acceleratorconfiguration.hxx>
+#include <accelerators/istoragelistener.hxx>
+#include <accelerators/presethandler.hxx>
+
+#include <macros/xinterface.hxx>
+#include <macros/xtypeprovider.hxx>
+#include <macros/xserviceinfo.hxx>
+
+//__________________________________________
+// interface includes
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/ui/XUIConfigurationStorage.hpp>
+
+//__________________________________________
+// other includes
+
+//__________________________________________
+// definition
+
+namespace framework
+{
+
+//__________________________________________
+/**
+ implements a read/write access to a document
+ based accelerator configuration.
+ */
+class DocumentAcceleratorConfiguration : public XMLBasedAcceleratorConfiguration
+ , public css::lang::XServiceInfo
+ , public css::lang::XInitialization
+// , public css::ui::XUIConfigurationStorage
+{
+ //______________________________________
+ // member
+
+ private:
+
+ //----------------------------------
+ /** points to the root storage of the outside document,
+ where we can read/save our configuration data. */
+ css::uno::Reference< css::embed::XStorage > m_xDocumentRoot;
+
+ //______________________________________
+ // interface
+
+ public:
+
+ //----------------------------------
+ /** initialize this instance and fill the internal cache.
+
+ @param xSMGR
+ reference to an uno service manager, which is used internaly.
+ */
+ DocumentAcceleratorConfiguration(const css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR);
+ virtual ~DocumentAcceleratorConfiguration();
+
+ // 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);
+
+ // XUIConfigurationStorage
+ virtual void SAL_CALL setStorage(const css::uno::Reference< css::embed::XStorage >& xStorage)
+ throw(css::uno::RuntimeException);
+
+ virtual sal_Bool SAL_CALL hasStorage()
+ throw(css::uno::RuntimeException);
+
+ //______________________________________
+ // helper
+
+ private:
+
+ //----------------------------------
+ /** read all data into the cache. */
+ void impl_ts_fillCache();
+
+ //----------------------------------
+ /** forget all currently cached data AND(!)
+ forget all currently used storages. */
+ void impl_ts_clearCache();
+};
+
+} // namespace framework
+
+#endif // __FRAMEWORK_ACCELERATORS_DOCUMENTACCELERATORCONFIGURATION_HXX_
diff --git a/framework/source/inc/accelerators/globalacceleratorconfiguration.hxx b/framework/source/inc/accelerators/globalacceleratorconfiguration.hxx
new file mode 100644
index 000000000000..f2b0b1d6afb6
--- /dev/null
+++ b/framework/source/inc/accelerators/globalacceleratorconfiguration.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_ACCELERATORS_GLOBALACCELERATORCONFIGURATION_HXX_
+#define __FRAMEWORK_ACCELERATORS_GLOBALACCELERATORCONFIGURATION_HXX_
+
+//__________________________________________
+// own includes
+
+#include <accelerators/acceleratorconfiguration.hxx>
+#include <accelerators/presethandler.hxx>
+
+#ifndef __FRAMEWORK_MACROS_XINTERFACE_HXX_
+#include <macros/interface.hxx>
+#endif
+#include <macros/xtypeprovider.hxx>
+#include <macros/xserviceinfo.hxx>
+
+//__________________________________________
+// interface includes
+
+#ifndef _COM_SUN_STAR_LANG_XINITIALIZATION_HPP_
+#include <com/sun/star/lang/XInitialization.hpp>
+#endif
+
+//__________________________________________
+// other includes
+
+//__________________________________________
+// definition
+
+namespace framework
+{
+
+//__________________________________________
+/**
+ implements a read/write access to the global
+ accelerator configuration.
+ */
+class GlobalAcceleratorConfiguration : public XCUBasedAcceleratorConfiguration
+ , public css::lang::XServiceInfo
+ , public css::lang::XInitialization
+{
+ //______________________________________
+ // interface
+
+ public:
+
+ //----------------------------------
+ /** initialize this instance and fill the internal cache.
+
+ @param xSMGR
+ reference to an uno service manager, which is used internaly.
+ */
+ GlobalAcceleratorConfiguration(const css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR);
+
+ //----------------------------------
+ /** TODO */
+ virtual ~GlobalAcceleratorConfiguration();
+
+ // 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);
+
+ //______________________________________
+ // helper
+
+ private:
+
+ ::rtl::OUString m_sLocale;
+
+ //----------------------------------
+ /** read all data into the cache. */
+ void impl_ts_fillCache();
+};
+
+} // namespace framework
+
+#endif // __FRAMEWORK_ACCELERATORS_GLOBALACCELERATORCONFIGURATION_HXX_
diff --git a/framework/source/inc/accelerators/istoragelistener.hxx b/framework/source/inc/accelerators/istoragelistener.hxx
new file mode 100644
index 000000000000..44f0cc3cd5c5
--- /dev/null
+++ b/framework/source/inc/accelerators/istoragelistener.hxx
@@ -0,0 +1,64 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public 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_ACCELERATORS_ISTORAGELISTENER_HXX_
+#define __FRAMEWORK_ACCELERATORS_ISTORAGELISTENER_HXX_
+
+//__________________________________________
+// own includes
+
+#include <general.h>
+#include <stdtypes.h>
+
+//__________________________________________
+// interface includes
+
+//__________________________________________
+// other includes
+
+//__________________________________________
+// definition
+
+namespace framework
+{
+
+//__________________________________________
+/**
+ TODO document me
+ */
+class IStorageListener
+{
+ public:
+
+ //--------------------------------------
+ /** @short TODO */
+ virtual void changesOccured(const ::rtl::OUString& sPath) = 0;
+};
+
+} // namespace framework
+
+#endif // __FRAMEWORK_ACCELERATORS_ISTORAGELISTENER_HXX_
diff --git a/framework/source/inc/accelerators/keymapping.hxx b/framework/source/inc/accelerators/keymapping.hxx
new file mode 100644
index 000000000000..e254378867b6
--- /dev/null
+++ b/framework/source/inc/accelerators/keymapping.hxx
@@ -0,0 +1,162 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public 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_ACCELERATORS_KEYMAPPING_HXX_
+#define __FRAMEWORK_ACCELERATORS_KEYMAPPING_HXX_
+
+//__________________________________________
+// own includes
+
+#include <general.h>
+#include <stdtypes.h>
+
+//__________________________________________
+// interface includes
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
+
+//__________________________________________
+// other includes
+
+//__________________________________________
+// definition
+
+namespace framework
+{
+
+//__________________________________________
+/**
+ can be used to map key identifier to the
+ corresponding key codes ...
+ */
+class KeyMapping
+{
+ //______________________________________
+ // const, types
+
+ private:
+
+ //---------------------------------------
+ /** @short is used to map a key code
+ to the right key identifier, which is
+ used to make the xml file "human readable"
+ */
+ struct KeyIdentifierInfo
+ {
+ sal_Int16 Code ;
+ const char* Identifier;
+ };
+
+ //---------------------------------------
+ /** @short hash structure to map identifier to key codes. */
+ typedef BaseHash< sal_Int16 > Identifier2CodeHash;
+
+ //---------------------------------------
+ /** @short hash structure to map key codes to identifier. */
+ typedef ::std::hash_map< sal_Int16 ,
+ ::rtl::OUString ,
+ ShortHashCode ,
+ ::std::equal_to< sal_Int16 > > Code2IdentifierHash;
+
+ //______________________________________
+ // member
+
+ private:
+
+ static KeyIdentifierInfo KeyIdentifierMap[];
+
+ //---------------------------------------
+ /** @short hash to map identifier to key codes. */
+ Identifier2CodeHash m_lIdentifierHash;
+
+ //---------------------------------------
+ /** @short hash to map key codes to identifier. */
+ Code2IdentifierHash m_lCodeHash;
+
+ //______________________________________
+ // interface
+
+ public:
+
+ KeyMapping();
+ virtual ~KeyMapping();
+
+ //----------------------------------
+ /** @short return a suitable key code
+ for the specified key identifier.
+
+ @param sIdentifier
+ string value, which describe the key.
+
+ @return [css::awt::KeyEvent]
+ the corresponding key code as
+ short value.
+
+ @throw [css::lang::IllegalArgumentException]
+ if the given identifier does not describe
+ a well known key code.
+ */
+ virtual sal_uInt16 mapIdentifierToCode(const ::rtl::OUString& sIdentifier)
+ throw(css::lang::IllegalArgumentException);
+
+ //----------------------------------
+ /** @short return a suitable key identifier
+ for the specified key code.
+
+ @param nCode
+ short value, which describe the key.
+
+ @return The corresponding string identifier.
+ */
+ virtual ::rtl::OUString mapCodeToIdentifier(sal_uInt16 nCode);
+
+ //______________________________________
+ // helper
+
+ private:
+
+ //----------------------------------
+ /** @short check if the given string describe a numeric
+ value ... and convert it.
+
+ @param sIdentifier
+ the string value, which should be converted.
+
+
+ @param rCode
+ contains the converted code, but is defined only
+ if this method returns TRUE!
+
+ @return [boolean]
+ TRUE if convertion was successfully.
+ */
+ sal_Bool impl_st_interpretIdentifierAsPureKeyCode(const ::rtl::OUString& sIdentifier,
+ sal_uInt16& rCode );
+};
+
+} // namespace framework
+
+#endif // __FRAMEWORK_ACCELERATORS_KEYMAPPING_HXX_
diff --git a/framework/source/inc/accelerators/moduleacceleratorconfiguration.hxx b/framework/source/inc/accelerators/moduleacceleratorconfiguration.hxx
new file mode 100644
index 000000000000..8d83dcd459b3
--- /dev/null
+++ b/framework/source/inc/accelerators/moduleacceleratorconfiguration.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_ACCELERATORS_MODULEACCELERATORCONFIGURATION_HXX_
+#define __FRAMEWORK_ACCELERATORS_MODULEACCELERATORCONFIGURATION_HXX_
+
+//__________________________________________
+// own includes
+
+#include <accelerators/acceleratorconfiguration.hxx>
+#include <accelerators/presethandler.hxx>
+
+#ifndef __FRAMEWORK_MACROS_XINTERFACE_HXX_
+#include <macros/interface.hxx>
+#endif
+#include <macros/xtypeprovider.hxx>
+#include <macros/xserviceinfo.hxx>
+
+//__________________________________________
+// interface includes
+#include <com/sun/star/lang/XInitialization.hpp>
+
+//__________________________________________
+// other includes
+
+//__________________________________________
+// definition
+
+namespace framework
+{
+
+//__________________________________________
+/**
+ implements a read/write access to a module
+ dependend accelerator configuration.
+ */
+class ModuleAcceleratorConfiguration : public XCUBasedAcceleratorConfiguration
+ , public css::lang::XServiceInfo
+ , public css::lang::XInitialization
+{
+ //______________________________________
+ // member
+
+ private:
+
+ //----------------------------------
+ /** identify the application module, where this accelerator
+ configuration cache should work on. */
+ ::rtl::OUString m_sModule;
+ ::rtl::OUString m_sLocale;
+
+ //______________________________________
+ // interface
+
+ public:
+
+ //----------------------------------
+ /** initialize this instance and fill the internal cache.
+
+ @param xSMGR
+ reference to an uno service manager, which is used internaly.
+ */
+ ModuleAcceleratorConfiguration(const css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR);
+
+ //----------------------------------
+ /** TODO */
+ virtual ~ModuleAcceleratorConfiguration();
+
+ // 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);
+
+ //______________________________________
+ // helper
+
+ private:
+
+ //----------------------------------
+ /** read all data into the cache. */
+ void impl_ts_fillCache();
+};
+
+} // namespace framework
+
+#endif // __FRAMEWORK_ACCELERATORS_MODULEACCELERATORCONFIGURATION_HXX_
diff --git a/framework/source/inc/accelerators/presethandler.hxx b/framework/source/inc/accelerators/presethandler.hxx
new file mode 100644
index 000000000000..2d8f3ea57920
--- /dev/null
+++ b/framework/source/inc/accelerators/presethandler.hxx
@@ -0,0 +1,535 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public 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_ACCELERATORS_PRESETHANDLER_HXX_
+#define __FRAMEWORK_ACCELERATORS_PRESETHANDLER_HXX_
+
+//__________________________________________
+// own includes
+
+#include <accelerators/storageholder.hxx>
+#include <threadhelp/threadhelpbase.hxx>
+#include <general.h>
+#include <stdtypes.h>
+
+//__________________________________________
+// interface includes
+
+#ifndef __COM_SUN_STAR_EMBED_XSTORAGE_HPP_
+#include <com/sun/star/embed/XStorage.hpp>
+#endif
+
+#ifndef __COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#endif
+
+//__________________________________________
+// other includes
+#include <comphelper/processfactory.hxx>
+#include <salhelper/singletonref.hxx>
+#include <comphelper/locale.hxx>
+
+//__________________________________________
+// definition
+
+namespace framework
+{
+
+//__________________________________________
+/**
+ TODO document me
+
+ <layer>/global/<resourcetype>/<preset>.xml
+ <layer>/modules/<moduleid>/<resourcetype>/<preset>.xml
+
+ RESOURCETYPE PRESET TARGET
+ (share) (user)
+ "accelerator" "default" "current"
+ "word"
+ "excel"
+
+ "menubar" "default" "menubar"
+
+ */
+class PresetHandler : private ThreadHelpBase // attention! Must be the first base class to guarentee right initialize lock ...
+{
+ //-------------------------------------------
+ // const
+
+ public:
+
+ static ::rtl::OUString PRESET_DEFAULT();
+ static ::rtl::OUString TARGET_CURRENT();
+
+ static ::rtl::OUString RESOURCETYPE_MENUBAR();
+ static ::rtl::OUString RESOURCETYPE_TOOLBAR();
+ static ::rtl::OUString RESOURCETYPE_ACCELERATOR();
+ static ::rtl::OUString RESOURCETYPE_STATUSBAR();
+
+ //-------------------------------------------
+ // types
+
+ public:
+
+ //---------------------------------------
+ /** @short this handler can provide different
+ types of configuration.
+
+ @descr Means: a global or a module dependend
+ or ... configuration.
+ */
+ enum EConfigType
+ {
+ E_GLOBAL,
+ E_MODULES,
+ E_DOCUMENT
+ };
+
+ private:
+
+ //---------------------------------------
+ /** @short because a concurrent access to the same storage from different implementations
+ isnt supported, we have to share it with others.
+
+ @descr This struct makes it possible to use any shared storage
+ in combination with a SingletonRef<> template ...
+
+ Attention: Because these struct is shared it must be
+ used within a synchronized section. Thats why this struct
+ uses a base class ThreadHelpBase and can be locked
+ from outside doing so!
+ */
+ struct TSharedStorages : public ThreadHelpBase
+ {
+ public:
+
+ StorageHolder m_lStoragesShare;
+ StorageHolder m_lStoragesUser;
+
+ TSharedStorages()
+ : m_lStoragesShare(::comphelper::getProcessServiceFactory())
+ , m_lStoragesUser (::comphelper::getProcessServiceFactory())
+ {};
+
+ virtual ~TSharedStorages() {};
+ };
+
+ //-------------------------------------------
+ // member
+
+ private:
+
+ //---------------------------------------
+ /** @short can be used to create on needed uno resources. */
+ css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR;
+
+ //---------------------------------------
+ /** @short knows the type of provided configuration.
+
+ @descr e.g. global, modules, ...
+ */
+ EConfigType m_eConfigType;
+
+ //---------------------------------------
+ /** @short specify the type of resource, which configuration sets
+ must be provided here.
+
+ @descr e.g. menubars, toolbars, accelerators
+ */
+ ::rtl::OUString m_sResourceType;
+
+ //---------------------------------------
+ /** @short specify the application module for a module
+ dependend configuration.
+
+ @descr Will be used only, if m_sResourceType is set to
+ "module". Further it must be a valid module identifier
+ then ...
+ */
+ ::rtl::OUString m_sModule;
+
+ //---------------------------------------
+ /** @short provides access to the:
+ a) shared root storages
+ b) shared "inbetween" storages
+ of the share and user layer. */
+ ::salhelper::SingletonRef< TSharedStorages > m_aSharedStorages;
+
+ //---------------------------------------
+ /** @short if we run in document mode, we cant use the global root storages!
+ We have to use a special document storage explicitly. */
+ StorageHolder m_lDocumentStorages;
+
+ //---------------------------------------
+ /** @short holds the folder storage of the share layer alive,
+ where the current configuration set exists.
+
+ @descr Note: If this preset handler works in document mode
+ this member is meaned relative to the document root ...
+ not to the share layer root!
+
+ Further is defined, that m_xWorkingStorageUser
+ is equals to m_xWorkingStorageShare then!
+ */
+ css::uno::Reference< css::embed::XStorage > m_xWorkingStorageShare;
+
+ //---------------------------------------
+ /** @short global language-independent storage
+ */
+ css::uno::Reference< css::embed::XStorage > m_xWorkingStorageNoLang;
+
+ //---------------------------------------
+ /** @short holds the folder storage of the user layer alive,
+ where the current configuration set exists.
+
+ @descr Note: If this preset handler works in document mode
+ this member is meaned relative to the document root ...
+ not to the user layer root!
+
+ Further is defined, that m_xWorkingStorageUser
+ is equals to m_xWorkingStorageShare then!
+ */
+ css::uno::Reference< css::embed::XStorage > m_xWorkingStorageUser;
+
+ //---------------------------------------
+ /** @short knows the names of all presets inside the current
+ working storage of the share layer. */
+ OUStringList m_lPresets;
+
+ //---------------------------------------
+ /** @short knows the names of all targets inside the current
+ working storage of the user layer. */
+ OUStringList m_lTargets;
+
+ //---------------------------------------
+ /** @short its the current office locale and will be used
+ to handle localized presets.
+
+ @descr Default is "x-notranslate" which disable any
+ localized handling inside this class! */
+ ::comphelper::Locale m_aLocale;
+
+ //---------------------------------------
+ /** @short knows the relative path from the root. */
+ ::rtl::OUString m_sRelPathShare;
+ ::rtl::OUString m_sRelPathNoLang;
+ ::rtl::OUString m_sRelPathUser;
+
+ //-------------------------------------------
+ // native interface
+
+ public:
+
+ //---------------------------------------
+ /** @short does nothing real.
+
+ @descr Because this class should be useable in combination
+ with ::salhelper::SingletonRef template this ctor
+ cant have any special parameters!
+
+ @param xSMGR
+ points to an uno service manager, which is used internaly
+ to create own needed uno resources.
+ */
+ PresetHandler(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR);
+
+ //---------------------------------------
+ /** @short copy ctor */
+ PresetHandler(const PresetHandler& rCopy);
+
+ //---------------------------------------
+ /** @short closes all open storages ... if user forgot that .-) */
+ virtual ~PresetHandler();
+
+ //---------------------------------------
+ /** @short free all currently cache(!) storages. */
+ void forgetCachedStorages();
+
+ //---------------------------------------
+ /** @short return access to the internaly used and cached root storage.
+
+ @descr These root storages are the base of all further opened
+ presets and targets. They are provided here only, to support
+ older implementations, which base on them ...
+
+ getOrCreate...() - What does it mean?
+ Such root storage will be created one times only and
+ cached then internaly till the last instance of such PresetHandler
+ dies.
+
+ @return com::sun::star::embed::XStorage
+ which represent a root storage.
+ */
+ css::uno::Reference< css::embed::XStorage > getOrCreateRootStorageShare();
+ css::uno::Reference< css::embed::XStorage > getOrCreateRootStorageUser();
+
+ //---------------------------------------
+ /** @short provides access to the current working storages.
+
+ @descr Working storages are the "lowest" storages, where the
+ preset and target files exists.
+
+ @return com::sun::star::embed::XStorage
+ which the current working storage.
+ */
+ css::uno::Reference< css::embed::XStorage > getWorkingStorageShare();
+ css::uno::Reference< css::embed::XStorage > getWorkingStorageUser();
+
+ //---------------------------------------
+ /** @short check if there is a parent storage well known for
+ the specified child storage and return it.
+
+ @param xChild
+ the child storage where a paranet storage should be searched for.
+
+ @return com::sun::star::embed::XStorage
+ A valid storage if a paranet exists. NULL otherwise.
+ */
+ css::uno::Reference< css::embed::XStorage > getParentStorageShare(const css::uno::Reference< css::embed::XStorage >& xChild);
+ css::uno::Reference< css::embed::XStorage > getParentStorageUser (const css::uno::Reference< css::embed::XStorage >& xChild);
+
+ //---------------------------------------
+ /** @short free all internal structures and let this handler
+ work on a new type of configuration sets.
+
+ @param eConfigType
+ differ between global or module dependend configuration.
+
+ @param sResourceType
+ differ between menubar/toolbar/accelerator/... configuration.
+
+ @param sModule
+ if sResourceType is set to a module dependend configuration,
+ it address the current application module.
+
+ @param xDocumentRoot
+ if sResourceType is set to E_DOCUMENT, this value points to the
+ root storage inside the document, where we can save our
+ configuration files. Note: Thats not the real root of the document ...
+ its only a sub storage. But we interpret it as our root storage.
+
+ @param aLocale
+ in case this configuration supports localized entries,
+ the current locale must be set.
+
+ Localzation will be represented as directory structure
+ of provided presets. Means: you call us with a preset name "default";
+ and we use e.g. "/en-US/default.xml" internaly.
+
+ If no localization exists for this preset set, this class
+ will work in default mode - means "no locale" - automaticly.
+ e.g. "/default.xml"
+
+ @throw com::sun::star::uno::RuntimeException(!)
+ if the specified resource couldn't be located.
+ */
+ void connectToResource( EConfigType eConfigType ,
+ const ::rtl::OUString& sResourceType ,
+ const ::rtl::OUString& sModule ,
+ const css::uno::Reference< css::embed::XStorage >& xDocumentRoot ,
+ const ::comphelper::Locale& aLocale = ::comphelper::Locale(::comphelper::Locale::X_NOTRANSLATE()));
+
+ //---------------------------------------
+ /** @short try to copy the specified preset from the share
+ layer to the user layer and establish it as the
+ specified target.
+
+ @descr Means: copy share/.../<preset>.xml user/.../<target>.xml
+ Note: The target will be overwritten completly or
+ created as new by this operation!
+
+ @param sPreset
+ the ALIAS name of an existing preset.
+
+ @param sTarget
+ the ALIAS name of the target.
+
+ @throw com::sun::star::container::NoSuchElementException
+ if the specified preset does not exists.
+
+ @throw com::sun::star::io::IOException
+ if copying failed.
+ */
+ void copyPresetToTarget(const ::rtl::OUString& sPreset,
+ const ::rtl::OUString& sTarget);
+
+ //---------------------------------------
+ /** @short open the specified preset as stream object
+ and return it.
+
+ @descr Note: Because presets resist inside the share
+ layer, they will be opened readonly everytimes.
+
+ @param sPreset
+ the ALIAS name of an existing preset.
+
+ @param bNoLangGlobal
+ access the global language-independent storage instead of the preset storage
+
+ @return The opened preset stream ... or NULL if the preset does not exists.
+ */
+ css::uno::Reference< css::io::XStream > openPreset(const ::rtl::OUString& sPreset,
+ sal_Bool bUseNoLangGlobal = sal_False);
+
+ //---------------------------------------
+ /** @short open the specified target as stream object
+ and return it.
+
+ @descr Note: Targets resist inside the user
+ layer. Normaly they are opened in read/write mode.
+ But it will be opened readonly automaticly if that isnt possible
+ (may be the file is write protected on the system ...).
+
+ @param sTarget
+ the ALIAS name of the target.
+
+ @param bCreateIfMissing
+ create target file, if it does not still exists.
+ Note: That does not means reseting of an existing file!
+
+ @return The opened target stream ... or NULL if the target does not exists
+ or couldnt be created as new one.
+ */
+ css::uno::Reference< css::io::XStream > openTarget(const ::rtl::OUString& sTarget ,
+ sal_Bool bCreateIfMissing);
+
+ //---------------------------------------
+ /** @short do anything which is neccessary to flush all changes
+ back to disk.
+
+ @descr We have to call commit on all cached sub storages on the
+ path from the root storage upside down to the working storage
+ (which are not realy used, but required to be holded alive!).
+ */
+ void commitUserChanges();
+
+ //---------------------------------------
+ /** TODO */
+ void addStorageListener(IStorageListener* pListener);
+ void removeStorageListener(IStorageListener* pListener);
+
+ //-------------------------------------------
+ // helper
+
+ private:
+
+ //---------------------------------------
+ /** @short open a config path ignoring errors (catching exceptions).
+
+ @descr We catch only normal exceptions here - no runtime exceptions.
+
+ @param sPath
+ the configuration path, which should be opened.
+
+ @param eMode
+ the open mode (READ/READWRITE)
+
+ @param bShare
+ force using of the share layer instead of the user layer.
+
+ @return An opened storage in case method was successfully - null otherwise.
+ */
+ css::uno::Reference< css::embed::XStorage > impl_openPathIgnoringErrors(const ::rtl::OUString& sPath ,
+ sal_Int32 eMode ,
+ sal_Bool bShare);
+
+ //---------------------------------------
+ /** @short try to find the specified locale inside list of possible ones.
+
+ @descr The lits of possible locale values was e.g. retrieved from the system
+ (configuration, directory listing etcpp). The locale normaly represent
+ the current office locale. This method search for a suitable item by using
+ different algorithm.
+ a) exact search
+ b) search with using fallbacks
+
+ @param lLocalizedValues
+ list of ISO locale codes
+
+ @param aLocale
+ [IN ] the current office locale, which should be searched inside lLocalizedValues.
+ [OUT] in case fallbacks was allowed, it contains afterwards the fallback locale.
+
+ @param bAllowFallbacks
+ enable/disable using of fallbacks
+
+ @return An iterator, which points directly into lLocalizedValue list.
+ As a negative result the special iterator lLocalizedValues.end() will be returned.
+ */
+ ::std::vector< ::rtl::OUString >::const_iterator impl_findMatchingLocalizedValue(const ::std::vector< ::rtl::OUString >& lLocalizedValues,
+ ::comphelper::Locale& aLocale ,
+ sal_Bool bAllowFallbacks );
+
+ //---------------------------------------
+ /** @short open a config path ignoring errors (catching exceptions).
+
+ @descr We catch only normal exceptions here - no runtime exceptions.
+ Further the path itself is tries in different versions (using locale
+ specific attributes).
+ e.g. "path/e-US" => "path/en" => "path/de"
+
+ @param sPath
+ the configuration path, which should be opened.
+ Its further used as out parameter too, so we can return the localized
+ path to the calli!
+
+ @param eMode
+ the open mode (READ/READWRITE)
+
+ @param bShare
+ force using of the share layer instead of the user layer.
+
+ @param aLocale
+ [IN ] contains the start locale for searching localized sub dirs.
+ [OUT] contains the locale of a found localized sub dir
+
+ @param bAllowFallback
+ enable/disable fallback handling for locales
+
+ @return An opened storage in case method was successfully - null otherwise.
+ */
+ css::uno::Reference< css::embed::XStorage > impl_openLocalizedPathIgnoringErrors(::rtl::OUString& sPath ,
+ sal_Int32 eMode ,
+ sal_Bool bShare ,
+ ::comphelper::Locale& aLocale ,
+ sal_Bool bAllowFallback);
+
+ //---------------------------------------
+ /** @short returns the names of all sub storages of specified storage.
+
+ @param xFolder
+ the base storage for this operation.
+
+ @return [vector< string >]
+ a list of folder names.
+ */
+ ::std::vector< ::rtl::OUString > impl_getSubFolderNames(const css::uno::Reference< css::embed::XStorage >& xFolder);
+};
+
+} // namespace framework
+
+#endif // __FRAMEWORK_ACCELERATORS_PRESETHANDLER_HXX_
diff --git a/framework/source/inc/accelerators/storageholder.hxx b/framework/source/inc/accelerators/storageholder.hxx
new file mode 100644
index 000000000000..291fc29675eb
--- /dev/null
+++ b/framework/source/inc/accelerators/storageholder.hxx
@@ -0,0 +1,261 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public 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_ACCELERATORS_STORAGEHOLDER_HXX_
+#define __FRAMEWORK_ACCELERATORS_STORAGEHOLDER_HXX_
+
+//===============================================
+// own includes
+
+#include <accelerators/istoragelistener.hxx>
+#include <threadhelp/threadhelpbase.hxx>
+#include <general.h>
+#include <stdtypes.h>
+
+//===============================================
+// interface includes
+
+#ifndef __COM_SUN_STAR_EMBED_XSTORAGE_HPP_
+#include <com/sun/star/embed/XStorage.hpp>
+#endif
+
+#ifndef __COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#endif
+
+//===============================================
+// other includes
+
+
+//===============================================
+// namespace
+
+namespace framework
+{
+
+#ifdef css
+ #error "Who defines css? I will use it as namespace alias inside header."
+#else
+ #define css ::com::sun::star
+#endif
+
+//===============================================
+// definitions
+
+//-----------------------------------------------
+/**
+ TODO document me
+ */
+class StorageHolder : private ThreadHelpBase // attention! Must be the first base class to guarentee right initialize lock ...
+{
+ //-------------------------------------------
+ // types
+ public:
+
+ /** @short TODO */
+ typedef ::std::vector< css::uno::Reference< css::embed::XStorage > > TStorageList;
+
+ typedef ::std::vector< IStorageListener* > TStorageListenerList;
+
+ struct TStorageInfo
+ {
+ public:
+ css::uno::Reference< css::embed::XStorage > Storage;
+ sal_Int32 UseCount;
+ TStorageListenerList Listener;
+
+ TStorageInfo()
+ : UseCount(0)
+ {}
+ };
+
+ /** @short TODO */
+ typedef ::std::hash_map< ::rtl::OUString ,
+ TStorageInfo ,
+ ::rtl::OUStringHash ,
+ ::std::equal_to< ::rtl::OUString > > TPath2StorageInfo;
+
+ //-------------------------------------------
+ // member
+ private:
+
+ /** @short TODO */
+ css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR;
+
+ /** @short TODO */
+ css::uno::Reference< css::embed::XStorage > m_xRoot;
+
+ /** @short TODO */
+ TPath2StorageInfo m_lStorages;
+
+ //-------------------------------------------
+ // interface
+ public:
+
+ //---------------------------------------
+ /** @short TODO
+ */
+ StorageHolder();
+
+ //---------------------------------------
+ /** @short TODO
+ */
+ StorageHolder(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR);
+
+ //---------------------------------------
+ /** @short TODO
+ */
+ virtual ~StorageHolder();
+
+ //---------------------------------------
+ /** @short TODO
+ */
+ virtual void forgetCachedStorages();
+
+ //---------------------------------------
+ /** @short TODO
+ */
+ virtual void setRootStorage(const css::uno::Reference< css::embed::XStorage >& xRoot);
+
+ //---------------------------------------
+ /** @short TODO
+ */
+ virtual css::uno::Reference< css::embed::XStorage > getRootStorage() const;
+
+ //---------------------------------------
+ /** @short TODO
+ open or get!
+ */
+ virtual css::uno::Reference< css::embed::XStorage > openPath(const ::rtl::OUString& sPath ,
+ sal_Int32 nOpenMode);
+
+ //---------------------------------------
+ /** @short TODO
+ */
+ virtual StorageHolder::TStorageList getAllPathStorages(const ::rtl::OUString& sPath);
+
+ //---------------------------------------
+ /** @short TODO
+ */
+ virtual void commitPath(const ::rtl::OUString& sPath);
+
+ //---------------------------------------
+ /** @short TODO
+ */
+ virtual void closePath(const ::rtl::OUString& sPath);
+
+ //---------------------------------------
+ /** @short TODO
+ */
+ virtual void notifyPath(const ::rtl::OUString& sPath);
+
+ //---------------------------------------
+ /** @short TODO
+ */
+ virtual void addStorageListener( IStorageListener* pListener,
+ const ::rtl::OUString& sPath );
+
+ //---------------------------------------
+ /** @short TODO
+ */
+ virtual void removeStorageListener( IStorageListener* pListener,
+ const ::rtl::OUString& sPath );
+
+ //---------------------------------------
+ /** @short TODO
+ */
+ virtual ::rtl::OUString getPathOfStorage(const css::uno::Reference< css::embed::XStorage >& xStorage);
+
+ //---------------------------------------
+ /** @short TODO
+ */
+ virtual css::uno::Reference< css::embed::XStorage > getParentStorage(const css::uno::Reference< css::embed::XStorage >& xChild);
+
+ //---------------------------------------
+ /** @short TODO
+ */
+ virtual css::uno::Reference< css::embed::XStorage > getParentStorage(const ::rtl::OUString& sChildPath);
+
+ //---------------------------------------
+ /** @short TODO
+ */
+ virtual void operator=(const StorageHolder& rCopy);
+
+ //---------------------------------------
+ /** @short opens a sub element of the specified base storage.
+
+ @descr First this method try to open the requested sub element
+ using the given open mode. If it failed there is second step,
+ which tries to do the same again ... but removing a might existing
+ WRITE flag from the open mode. The user can supress this fallback
+ handling by setting the parameter bAllowFallback to FALSE.
+
+ @param xBaseStorage
+ the storage, where the sub element should be searched.
+
+ @param sSubElement
+ the full name of the sub element.
+ e.g. "default.xml"
+
+ @param eOpenMode
+ a flag field, which set the open mode for this operation.
+
+ @param bAllowFallback
+ if eOpenMode contains an ELEMENT_WRITE flag this parameter
+ allow to remove it and try it with the rest of eOpenMode flags
+ again.
+ */
+ static css::uno::Reference< css::embed::XStorage > openSubStorageWithFallback(const css::uno::Reference< css::embed::XStorage >& xBaseStorage ,
+ const ::rtl::OUString& sSubStorage ,
+ sal_Int32 eOpenMode ,
+ sal_Bool bAllowFallback);
+
+ static css::uno::Reference< css::io::XStream > openSubStreamWithFallback(const css::uno::Reference< css::embed::XStorage >& xBaseStorage ,
+ const ::rtl::OUString& sSubStream ,
+ sal_Int32 eOpenMode ,
+ sal_Bool bAllowFallback);
+
+ //---------------------------------------
+ // helper
+ private:
+
+ //-----------------------------------
+ /** @short TODO
+ */
+ static ::rtl::OUString impl_st_normPath(const ::rtl::OUString& sPath);
+
+ //-----------------------------------
+ /** @short TODO
+ */
+ static OUStringList impl_st_parsePath(const ::rtl::OUString& sPath);
+};
+
+#undef css // dont let it out!
+
+} // namespace framework
+
+#endif // __FRAMEWORK_ACCELERATORS_STORAGEHOLDER_HXX_
diff --git a/framework/source/inc/constant/containerquery.hxx b/framework/source/inc/constant/containerquery.hxx
new file mode 100644
index 000000000000..4d51b2586efe
--- /dev/null
+++ b/framework/source/inc/constant/containerquery.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_CONSTANT_CONTAINERQUERY_H_
+#define __FRAMEWORK_CONSTANT_CONTAINERQUERY_H_
+
+#include <sal/types.h>
+
+namespace framework{
+ namespace constant{
+
+struct ContainerQuery
+{
+ public:
+
+ static const sal_Unicode SEPERATOR_PARAM;
+ static const sal_Unicode SEPERATOR_VALUE;
+};
+
+ } // namespace constant
+} // namespace framework
+
+#endif // #ifndef __FRAMEWORK_CONSTANT_CONTAINERQUERY_H_
diff --git a/framework/source/inc/constant/contenthandler.hxx b/framework/source/inc/constant/contenthandler.hxx
new file mode 100644
index 000000000000..db10575ce8e7
--- /dev/null
+++ b/framework/source/inc/constant/contenthandler.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_CONSTANT_CONTENTHANDLER_H_
+#define __FRAMEWORK_CONSTANT_CONTENTHANDLER_H_
+
+#include <rtl/ustring.hxx>
+
+namespace framework{
+ namespace constant{
+
+struct ContentHandler
+{
+ public:
+
+ static const ::rtl::OUString PROP_NAME;
+ static const ::rtl::OUString PROP_TYPES;
+};
+
+ } // namespace constant
+} // namespace framework
+
+#endif // #ifndef __FRAMEWORK_CONSTANT_CONTENTHANDLER_H_
diff --git a/framework/source/inc/constant/filter.hxx b/framework/source/inc/constant/filter.hxx
new file mode 100644
index 000000000000..141440a77716
--- /dev/null
+++ b/framework/source/inc/constant/filter.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_CONSTANT_FILTER_H_
+#define __FRAMEWORK_CONSTANT_FILTER_H_
+
+#include <rtl/ustring.hxx>
+
+namespace framework{
+ namespace constant{
+
+struct Filter
+{
+ public:
+
+ static const ::rtl::OUString PROP_NAME; // string
+ static const ::rtl::OUString PROP_TYPE; // string
+ static const ::rtl::OUString PROP_DOCUMENTSERVICE; // string
+ static const ::rtl::OUString PROP_FILTERSERVICE; // string
+ static const ::rtl::OUString PROP_UICOMPONENT; // string
+ static const ::rtl::OUString PROP_FLAGS; // int32
+ static const ::rtl::OUString PROP_USERDATA; // seq< string >
+ static const ::rtl::OUString PROP_TEMPLATENAME; // string
+
+ static const ::rtl::OUString QUERY_GET_DEFAULT_FILTER_FOR_TYPE;
+ static const ::rtl::OUString QUERY_ALL;
+ static const ::rtl::OUString QUERY_WRITER;
+ static const ::rtl::OUString QUERY_WEB;
+ static const ::rtl::OUString QUERY_GLOBAL;
+ static const ::rtl::OUString QUERY_CHART;
+ static const ::rtl::OUString QUERY_CALC;
+ static const ::rtl::OUString QUERY_IMPRESS;
+ static const ::rtl::OUString QUERY_DRAW;
+ static const ::rtl::OUString QUERY_MATH;
+
+ static const ::rtl::OUString QUERYPARAM_IFLAGS;
+ static const ::rtl::OUString QUERYPARAM_EFLAGS;
+ static const ::rtl::OUString QUERYPARAM_SORT_PROP;
+ static const ::rtl::OUString QUERYPARAM_DESCENDING;
+ static const ::rtl::OUString QUERYPARAM_USE_ORDER;
+ static const ::rtl::OUString QUERYPARAM_DEFAULT_FIRST;
+ static const ::rtl::OUString QUERYPARAM_CASE_SENSITIVE;
+ static const ::rtl::OUString QUERYPARAMVALUE_SORT_PROP_NAME;
+ static const ::rtl::OUString QUERYPARAMVALUE_SORT_PROP_UINAME;
+
+ static const ::rtl::OUString FLAGNAME_IMPORT;
+ static const ::rtl::OUString FLAGNAME_EXPORT;
+ static const ::rtl::OUString FLAGNAME_TEMPLATE;
+ static const ::rtl::OUString FLAGNAME_INTERNAL;
+ static const ::rtl::OUString FLAGNAME_TEMPLATEPATH;
+ static const ::rtl::OUString FLAGNAME_OWN;
+ static const ::rtl::OUString FLAGNAME_ALIEN;
+ static const ::rtl::OUString FLAGNAME_USESOPTIONS;
+ static const ::rtl::OUString FLAGNAME_DEFAULT;
+ static const ::rtl::OUString FLAGNAME_EXECUTABLE;
+ static const ::rtl::OUString FLAGNAME_SUPPORTSSELECTION;
+ static const ::rtl::OUString FLAGNAME_MAPTOAPPPLUG;
+ static const ::rtl::OUString FLAGNAME_NOTINFILEDIALOG;
+ static const ::rtl::OUString FLAGNAME_NOTINCHOOSER;
+ static const ::rtl::OUString FLAGNAME_ASYNCHRON;
+ static const ::rtl::OUString FLAGNAME_CREATOR;
+ static const ::rtl::OUString FLAGNAME_READONLY;
+ static const ::rtl::OUString FLAGNAME_NOTINSTALLED;
+ static const ::rtl::OUString FLAGNAME_CONSULTSERVICE;
+ static const ::rtl::OUString FLAGNAME_3RDPARTYFILTER;
+ static const ::rtl::OUString FLAGNAME_PACKED;
+ static const ::rtl::OUString FLAGNAME_SILENTEXPORT;
+ static const ::rtl::OUString FLAGNAME_BROWSERPREFERED;
+ static const ::rtl::OUString FLAGNAME_PREFERED;
+
+ static const sal_Int32 FLAGVALUE_IMPORT;
+ static const sal_Int32 FLAGVALUE_EXPORT;
+ static const sal_Int32 FLAGVALUE_TEMPLATE;
+ static const sal_Int32 FLAGVALUE_INTERNAL;
+ static const sal_Int32 FLAGVALUE_TEMPLATEPATH;
+ static const sal_Int32 FLAGVALUE_OWN;
+ static const sal_Int32 FLAGVALUE_ALIEN;
+ static const sal_Int32 FLAGVALUE_USESOPTIONS;
+ static const sal_Int32 FLAGVALUE_DEFAULT;
+ static const sal_Int32 FLAGVALUE_EXECUTABLE;
+ static const sal_Int32 FLAGVALUE_SUPPORTSSELECTION;
+ static const sal_Int32 FLAGVALUE_MAPTOAPPPLUG;
+ static const sal_Int32 FLAGVALUE_NOTINFILEDIALOG;
+ static const sal_Int32 FLAGVALUE_NOTINCHOOSER;
+ static const sal_Int32 FLAGVALUE_ASYNCHRON;
+ static const sal_Int32 FLAGVALUE_CREATOR;
+ static const sal_Int32 FLAGVALUE_READONLY;
+ static const sal_Int32 FLAGVALUE_NOTINSTALLED;
+ static const sal_Int32 FLAGVALUE_CONSULTSERVICE;
+ static const sal_Int32 FLAGVALUE_3RDPARTYFILTER;
+ static const sal_Int32 FLAGVALUE_PACKED;
+ static const sal_Int32 FLAGVALUE_SILENTEXPORT;
+ static const sal_Int32 FLAGVALUE_BROWSERPREFERED;
+ //FREE! ... 0x00800000L
+ static const sal_Int32 FLAGVALUE_PREFERED;
+
+};
+
+ } // namespace constant
+} // namespace framework
+
+#endif // #ifndef __FRAMEWORK_CONSTANT_FILTER_H_
diff --git a/framework/source/inc/constant/frameloader.hxx b/framework/source/inc/constant/frameloader.hxx
new file mode 100644
index 000000000000..58e03638d3b2
--- /dev/null
+++ b/framework/source/inc/constant/frameloader.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_CONSTANT_FRAMELOADER_H_
+#define __FRAMEWORK_CONSTANT_FRAMELOADER_H_
+
+#include <rtl/ustring.hxx>
+
+namespace framework{
+ namespace constant{
+
+class FrameLoader
+{
+ public:
+
+ static const ::rtl::OUString PROP_NAME; // string
+ static const ::rtl::OUString PROP_TYPES; // seq< string >
+};
+
+ } // namespace constant
+} // namespace framework
+
+#endif // #ifndef __FRAMEWORK_CONSTANT_FRAMELOADER_H_
diff --git a/framework/source/inc/dispatch/loaddispatcher.hxx b/framework/source/inc/dispatch/loaddispatcher.hxx
new file mode 100644
index 000000000000..63ec4c4f28f0
--- /dev/null
+++ b/framework/source/inc/dispatch/loaddispatcher.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_DISPATCH_LOADDISPATCHER_HXX_
+#define __FRAMEWORK_DISPATCH_LOADDISPATCHER_HXX_
+
+//_______________________________________________
+// my own includes
+
+#include <loadenv/loadenv.hxx>
+
+//_______________________________________________
+// interface includes
+#include <com/sun/star/frame/XNotifyingDispatch.hpp>
+#include <com/sun/star/frame/XSynchronousDispatch.hpp>
+
+//_______________________________________________
+// other includes
+
+#include <cppuhelper/implbase2.hxx>
+
+//_______________________________________________
+// namespace
+
+namespace framework{
+
+namespace css = ::com::sun::star;
+
+//_______________________________________________
+// exported const
+
+//_______________________________________________
+// exported definitions
+
+/** @short implements a dispatch object which can be used to load
+ non-visible components (by using the mechanism of ContentHandler)
+ or visible-components (by using the mechanism of FrameLoader).
+
+ @author as96863
+ */
+class LoadDispatcher : private ThreadHelpBase
+ , public ::cppu::WeakImplHelper2< css::frame::XNotifyingDispatch, // => XDispatch => XInterface
+ css::frame::XSynchronousDispatch >
+{
+ //___________________________________________
+ // member
+
+ private:
+
+ /** @short can be used to create own needed services on demand. */
+ css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR;
+
+ /** @short TODO document me */
+ css::uno::WeakReference< css::frame::XFrame > m_xOwnerFrame;
+
+ /** @short TODO document me */
+ ::rtl::OUString m_sTarget;
+
+ /** @short TODO document me */
+ sal_Int32 m_nSearchFlags;
+
+ /** @short TODO document me */
+ LoadEnv m_aLoader;
+
+ //___________________________________________
+ // native interface
+
+ public:
+
+ /** @short creates a new instance and initialize it with all neccessary parameters.
+
+ @descr Every instance of such LoadDispatcher can be used for the specified context only.
+ That means: It can be used to load any further requested content into tzhe here(!)
+ specified target frame.
+
+ @param xSMGR
+ will be used to create own needed services on demand.
+
+ @param xOwnerFrame
+ used as startpoit to locate the right target frame.
+
+ @param sTargetName
+ the name or the target frame for loading or a special qualifier
+ which define such target.
+
+ @param nSearchFlags
+ used in case sTargetFrame isnt a special one.
+ */
+ LoadDispatcher(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR ,
+ const css::uno::Reference< css::frame::XFrame >& xOwnerFrame ,
+ const ::rtl::OUString sTargetName ,
+ sal_Int32 nSearchFlags);
+
+ //_______________________________________
+
+ /** @short used to free internal resources.
+ */
+ virtual ~LoadDispatcher();
+
+ //___________________________________________
+ // uno interface
+
+ public:
+
+ // 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);
+
+ // XSynchronousDispatch
+ virtual css::uno::Any SAL_CALL dispatchWithReturnValue( const css::util::URL& aURL ,
+ const css::uno::Sequence< css::beans::PropertyValue >& lArguments )
+ throw( css::uno::RuntimeException );
+
+ private:
+ css::uno::Any impl_dispatch( const css::util::URL& rURL,
+ const css::uno::Sequence< css::beans::PropertyValue >& lArguments,
+ const css::uno::Reference< css::frame::XDispatchResultListener >& xListener );
+}; // class LoadDispatcher
+
+} // namespace framework
+
+#endif // #ifndef __FRAMEWORK_DISPATCH_LOADDISPATCHER_HXX_
diff --git a/framework/source/inc/dispatch/uieventloghelper.hxx b/framework/source/inc/dispatch/uieventloghelper.hxx
new file mode 100644
index 000000000000..f2f0f6c95025
--- /dev/null
+++ b/framework/source/inc/dispatch/uieventloghelper.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_DISPATCH_UIEVENTLOGHELPER_HXX_
+#define __FRAMEWORK_DISPATCH_UIEVENTLOGHELPER_HXX_
+
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/frame/XModuleManager.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/util/URL.hpp>
+#include <comphelper/uieventslogger.hxx>
+#include <rtl/ustring.hxx>
+#include <services.h>
+
+namespace framework
+{
+ class UiEventLogHelper
+ {
+ public:
+ UiEventLogHelper(const ::rtl::OUString& aWidgetname)
+ : m_aWidgetName(aWidgetname)
+ , m_hasAppName(false)
+ { }
+
+ void log(const ::com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager,
+ const ::com::sun::star::uno::Reference< com::sun::star::uno::XInterface >& rModel,
+ const ::com::sun::star::util::URL& rUrl,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& rArgs)
+ {
+
+ if(!m_hasAppName && rServiceManager.is() && rModel.is())
+ {
+ try
+ {
+ static ::rtl::OUString our_aModuleManagerName = SERVICENAME_MODULEMANAGER;
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager > xModuleManager(
+ rServiceManager->createInstance(our_aModuleManagerName)
+ , ::com::sun::star::uno::UNO_QUERY_THROW);
+ m_aAppName = xModuleManager->identify(rModel);
+ m_hasAppName = true;
+ } catch(::com::sun::star::uno::Exception&) {}
+ }
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue> aArgsWithOrigin(rArgs);
+ ::comphelper::UiEventsLogger::appendDispatchOrigin(aArgsWithOrigin, m_aAppName, m_aWidgetName);
+ ::comphelper::UiEventsLogger::logDispatch(rUrl, aArgsWithOrigin);
+ }
+
+ private:
+ const ::rtl::OUString m_aWidgetName;
+ bool m_hasAppName;
+ ::rtl::OUString m_aAppName;
+ };
+}
+
+#endif // __FRAMEWORK_DISPATCH_UIEVENTLOGHELPER_HXX_
diff --git a/framework/source/inc/dispatch/windowcommanddispatch.hxx b/framework/source/inc/dispatch/windowcommanddispatch.hxx
new file mode 100755
index 000000000000..0844dd74bf02
--- /dev/null
+++ b/framework/source/inc/dispatch/windowcommanddispatch.hxx
@@ -0,0 +1,174 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public 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_WINDOWCOMMANDDISPATCH_HXX_
+#define __FRAMEWORK_DISPATCH_WINDOWCOMMANDDISPATCH_HXX_
+
+//_______________________________________________
+// my own includes
+
+#include <threadhelp/threadhelpbase.hxx>
+
+//_______________________________________________
+// interface includes
+
+#include <com/sun/star/awt/XWindow.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/lang/XEventListener.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+//_______________________________________________
+// other includes
+
+#include <cppuhelper/implbase1.hxx>
+#include <tools/link.hxx>
+
+//_______________________________________________
+// namespace
+
+namespace framework{
+
+namespace css = ::com::sun::star;
+
+//_______________________________________________
+// exported const
+
+//_______________________________________________
+// exported definitions
+
+/** @short internal helper to bind e.g. MAC-Menu events to our internal dispatch API.
+
+ @descr On e.g. MAC platform system menus are merged together with some fix entries as
+ e.g. "Pereferences" or "About". These menu entries trigger hard coded commands.
+ Here we map these commands to the right URLs and dispatch them.
+
+ This helper knows a frame and it's container window (where VCL provide the hard coded
+ commands). We hold those objects weak ... so there is no need to react for complex dispose/ing()
+ scenarios. On the other side VCL does not hold us alive (because it doesn't know our UNO reference).
+ So we register us at the XWindow as event listener also to be sure to live as long the XWindow/VCLWindow lives.
+ */
+class WindowCommandDispatch : private ThreadHelpBase
+ , public ::cppu::WeakImplHelper1< css::lang::XEventListener >
+{
+ //___________________________________________
+ // const
+
+ private:
+
+ /// dispatch URL to trigger our "Tools->Options" dialog
+ static const ::rtl::OUString COMMAND_PREFERENCES;
+
+ /// dispatch URL to trigger our About box
+ static const ::rtl::OUString COMMAND_ABOUTBOX;
+
+ //___________________________________________
+ // member
+
+ private:
+
+ /// can be used to create own needed services on demand.
+ css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR;
+
+ /// knows the frame, where we dispatch our commands as weak reference
+ css::uno::WeakReference< css::frame::XFrame > m_xFrame;
+
+ /// knows the VCL window (where the hard coded commands occured) as weak XWindow reference
+ css::uno::WeakReference< css::awt::XWindow > m_xWindow;
+
+ //___________________________________________
+ // native interface
+
+ public:
+
+ //_______________________________________
+
+ /** @short creates a new instance and initialize it with all necessary parameters.
+
+ @descr Every instance of such MACDispatch can be used for the specified context only.
+ Means: 1 MACDispatch object is bound to 1 Frame/Window pair in which context
+ the detected commands will be executed.
+
+ @param xSMGR
+ will be used to create own needed services on demand.
+
+ @param xFrame
+ used as for new detected commands.
+ */
+ WindowCommandDispatch(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR ,
+ const css::uno::Reference< css::frame::XFrame >& xFrame);
+
+ //_______________________________________
+
+ /** @short used to free internal resources.
+ */
+ virtual ~WindowCommandDispatch();
+
+ //___________________________________________
+ // uno interface
+
+ public:
+
+ // XEventListener
+ virtual void SAL_CALL disposing(const css::lang::EventObject& aSource)
+ throw (css::uno::RuntimeException);
+
+ //___________________________________________
+ // implementation
+
+ private:
+
+ //_______________________________________
+
+ /** @short establish all listener connections we need.
+
+ @descr Those listener connections will be created one times only (see ctor).
+ Afterwards we listen for incoming events till our referred frame/window pair
+ will be closed. All objects die by refcount automatically. Because we hold
+ it weak ...
+ */
+ void impl_startListening();
+
+ //_______________________________________
+
+ /** @short callback from VCL to notify new commands
+ */
+ DECL_LINK( impl_notifyCommand, void* );
+
+ //_______________________________________
+
+ /** @short dispatch right command URLs into our frame context.
+
+ @param sCommand
+ the command for dispatch
+ */
+ void impl_dispatchCommand(const ::rtl::OUString& sCommand);
+
+}; // class MACDispatch
+
+} // namespace framework
+
+#endif // #ifndef __FRAMEWORK_DISPATCH_MACDISPATCH_HXX_
diff --git a/framework/source/inc/loadenv/actionlockguard.hxx b/framework/source/inc/loadenv/actionlockguard.hxx
new file mode 100644
index 000000000000..5e1eaf64036d
--- /dev/null
+++ b/framework/source/inc/loadenv/actionlockguard.hxx
@@ -0,0 +1,209 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public 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_LOADENV_ACTIONLOCKGUARD_HXX_
+#define __FRAMEWORK_LOADENV_ACTIONLOCKGUARD_HXX_
+
+//_______________________________________________
+// includes of own project
+
+#include <threadhelp/threadhelpbase.hxx>
+#include <threadhelp/resetableguard.hxx>
+
+//_______________________________________________
+// includes of uno interface
+#include <com/sun/star/document/XActionLockable.hpp>
+
+//_______________________________________________
+// includes of an other project
+
+//_______________________________________________
+// namespace
+
+namespace framework{
+
+#ifndef css
+namespace css = ::com::sun::star;
+#endif
+
+//_______________________________________________
+// definitions
+
+/** @short implements a guard, which can use the interface
+ <type scope="com::sun::star::document">XActionLockable</type>.
+
+ @descr This guard should be used to be shure, that any lock will be
+ released. Otherwhise the locaked document can hinder the office on shutdown!
+*/
+class ActionLockGuard : private ThreadHelpBase
+{
+ //-------------------------------------------
+ // member
+
+ private:
+
+ /** @short points to the object, which can be locked from outside. */
+ css::uno::Reference< css::document::XActionLockable > m_xActionLock;
+
+ /** @short knows if a lock exists on the internal lock object
+ forced by this guard instance. */
+ sal_Bool m_bActionLocked;
+
+ //-------------------------------------------
+ // interface
+
+ public:
+
+ //---------------------------------------
+ /** @short default ctor to initialize a "non working guard".
+
+ @descr That can be usefull in cases, where no resource still exists,
+ but will be available next time. Then this guard can be used
+ in a mode "use guard for more then one resources".
+ */
+ ActionLockGuard()
+ : ThreadHelpBase ( )
+ , m_bActionLocked(sal_False)
+ {
+ }
+
+ //---------------------------------------
+ /** @short initialize new guard instance and lock the given resource immediatly.
+
+ @param xLock
+ points to the outside resource, which should be locked.
+ */
+ ActionLockGuard(const css::uno::Reference< css::document::XActionLockable >& xLock)
+ : ThreadHelpBase ( )
+ , m_bActionLocked(sal_False)
+ {
+ setResource(xLock);
+ }
+
+ //---------------------------------------
+ /** @short release this guard instance and make shure, that no lock
+ will exist afterwards on the internal wrapped resource.
+ */
+ virtual ~ActionLockGuard()
+ {
+ unlock();
+ }
+
+ //---------------------------------------
+ /** @short set a new resource for locking at this guard.
+
+ @descr This call will fail, if an internal resource already exists
+ and is currently locked.
+
+ @param xLock
+ points to the outside resource, which should be locked.
+
+ @return TRUE, if new resource could be set and locked.
+ FALSE otherwhise.
+ */
+ virtual sal_Bool setResource(const css::uno::Reference< css::document::XActionLockable >& xLock)
+ {
+ // SAFE -> ..........................
+ ResetableGuard aMutexLock(m_aLock);
+
+ if (m_bActionLocked || !xLock.is())
+ return sal_False;
+
+ m_xActionLock = xLock;
+ m_xActionLock->addActionLock();
+ m_bActionLocked = m_xActionLock->isActionLocked();
+ // <- SAFE ..........................
+
+ return sal_True;
+ }
+
+ //---------------------------------------
+ /** @short set a new resource for locking at this guard.
+
+ @descr This call will fail, if an internal resource already exists
+ and is currently locked.
+
+ @param xLock
+ points to the outside resource, which should be locked.
+
+ @return TRUE, if new resource could be set and locked.
+ FALSE otherwhise.
+ */
+ virtual void freeResource()
+ {
+ // SAFE -> ..........................
+ ResetableGuard aMutexLock(m_aLock);
+
+ css::uno::Reference< css::document::XActionLockable > xLock = m_xActionLock ;
+ sal_Bool bLocked = m_bActionLocked;
+
+ m_xActionLock.clear();
+ m_bActionLocked = sal_False;
+
+ aMutexLock.unlock();
+ // <- SAFE ..........................
+
+ if (bLocked && xLock.is())
+ xLock->removeActionLock();
+ }
+
+ //---------------------------------------
+ /** @short lock the internal wrapped resource, if its not already done. */
+ virtual void lock()
+ {
+ // SAFE -> ..........................
+ ResetableGuard aMutexLock(m_aLock);
+
+ if (!m_bActionLocked && m_xActionLock.is())
+ {
+ m_xActionLock->addActionLock();
+ m_bActionLocked = m_xActionLock->isActionLocked();
+ }
+ // <- SAFE ..........................
+ }
+
+ //---------------------------------------
+ /** @short unlock the internal wrapped resource, if its not already done. */
+ virtual void unlock()
+ {
+ // SAFE -> ..........................
+ ResetableGuard aMutexLock(m_aLock);
+
+ if (m_bActionLocked && m_xActionLock.is())
+ {
+ m_xActionLock->removeActionLock();
+ // dont check for any locks here ...
+ // May another guard use the same lock object :-(
+ m_bActionLocked = sal_False;
+ }
+ // <- SAFE ..........................
+ }
+};
+
+} // namespace framework
+
+#endif // __FRAMEWORK_LOADENV_ACTIONLOCKGUARD_HXX_
diff --git a/framework/source/inc/loadenv/loaddispatchlistener.hxx b/framework/source/inc/loadenv/loaddispatchlistener.hxx
new file mode 100644
index 000000000000..6d1bf8d165a2
--- /dev/null
+++ b/framework/source/inc/loadenv/loaddispatchlistener.hxx
@@ -0,0 +1,165 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public 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_LOADENV_LOADDISPATCHLISTENER_HXX_
+#define __FRAMEWORK_LOADENV_LOADDISPATCHLISTENER_HXX_
+
+//_______________________________________________
+// includes of own project
+
+#include <threadhelp/threadhelpbase.hxx>
+#include <threadhelp/gate.hxx>
+#include <macros/xinterface.hxx>
+
+//_______________________________________________
+// includes of uno interface
+#include <com/sun/star/frame/XDispatchResultListener.hpp>
+
+/*
+#include <com/sun/star/frame/DispatchResultEvent.hpp>
+*/
+
+//_______________________________________________
+// includes of an other project
+
+#ifndef _OSL_CONDITN_HXX_
+#include <osl/condition.hxx>
+#endif
+#include <cppuhelper/weak.hxx>
+
+//_______________________________________________
+// namespace
+
+namespace framework{
+
+namespace css = ::com::sun::star;
+
+//_______________________________________________
+// definitions
+
+/** @short listen for finished dispatches, where document will be loaded.
+
+ @descr This listener can be bound to an URL - so its well known
+ for which load request this event was triggered.
+ Thats needed - but not supported by the XDispatchResultListener
+ notification.
+ Further a condition can be used to synchronize any outside code
+ against the occurence of this event.
+
+ @author as96863
+ */
+class LoadDispatchListener : public css::frame::XDispatchResultListener // => css.lang.XEventListener
+ , private ThreadHelpBase
+ , public ::cppu::OWeakObject
+{
+ //___________________________________________
+ // member
+
+ private:
+
+ /** @short the URL which is bound to this callback. */
+ ::rtl::OUString m_sURL;
+
+ /** @short the original event, which was notified to this object. */
+ css::frame::DispatchResultEvent m_aResult;
+
+ /** @short used to let the user of this instance wait, till an
+ event occures.
+ */
+ ::osl::Condition m_aUserWait;
+
+ //___________________________________________
+ // native interface
+
+ public:
+
+ //_______________________________________
+ /** @short initialize a new instance of this class. */
+ LoadDispatchListener();
+
+ //_______________________________________
+ /** @short deinitialize an instance of this class. */
+ virtual ~LoadDispatchListener();
+
+ //_______________________________________
+ /** @short bind this listenerr to a new URL.
+
+ @param sURL
+ the new URL bound to this instance.
+ */
+ void setURL(const ::rtl::OUString & sURL);
+
+ //_______________________________________
+ /** @short let the user of this instance wait.
+
+ @descr If the call timed out - false is returned.
+ Otherwise it returns true.
+ Then the method getResult() has to be called,
+ to get the origianl event.
+
+ @param nWait_ms
+ the time for wait in [ms].
+ If its set to 0 this call is blocked till
+ an event occures!
+
+ @return TRUE if an event occured in time - FALSE otherwhise.
+ */
+ sal_Bool wait(sal_Int32 nWait_ms);
+
+ //_______________________________________
+ /** @short returns the result of this listener operation.
+
+ @descr If wait() (which must be called before!) returns FALSE
+ the return of getResult() is undefined!
+
+ @return The result of the got listener notification.
+ */
+ css::frame::DispatchResultEvent getResult() const;
+
+ //___________________________________________
+ // uno interface
+
+ public:
+
+ //_______________________________________
+ // css.uno.XInterface
+ FWK_DECLARE_XINTERFACE
+
+ //_______________________________________
+ // css.frame.XDispatchResultListener
+ virtual void SAL_CALL dispatchFinished(const css::frame::DispatchResultEvent& aEvent)
+ throw(css::uno::RuntimeException);
+
+ //_______________________________________
+ // css.lang.XEventListener
+ virtual void SAL_CALL disposing(const css::lang::EventObject& aEvent)
+ throw(css::uno::RuntimeException);
+};
+
+} // namespace framework
+
+#endif // __FRAMEWORK_LOADENV_LOADDISPATCHLISTENER_HXX_
diff --git a/framework/source/inc/loadenv/loadenv.hxx b/framework/source/inc/loadenv/loadenv.hxx
new file mode 100644
index 000000000000..f78117d7021b
--- /dev/null
+++ b/framework/source/inc/loadenv/loadenv.hxx
@@ -0,0 +1,695 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public 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_LOADENV_LOADENV_HXX_
+#define __FRAMEWORK_LOADENV_LOADENV_HXX_
+
+//_______________________________________________
+// includes of own project
+
+#include <loadenv/loadenvexception.hxx>
+#include <loadenv/actionlockguard.hxx>
+#include <threadhelp/threadhelpbase.hxx>
+
+//_______________________________________________
+// includes of uno interface
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/frame/XComponentLoader.hpp>
+#include <com/sun/star/frame/XFrameLoader.hpp>
+#include <com/sun/star/frame/XLoadEventListener.hpp>
+#include <com/sun/star/frame/XDispatchResultListener.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/util/URL.hpp>
+
+#ifndef _COM_SUN_STAR_LANG_IllegalArgumentException_HPP_
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_IO_IOException_HPP_
+#include <com/sun/star/io/IOException.hpp>
+#endif
+
+//_______________________________________________
+// includes of an other project
+#include <comphelper/mediadescriptor.hxx>
+#include <comphelper/sequenceashashmap.hxx>
+#include <cppuhelper/implbase2.hxx>
+
+//_______________________________________________
+// namespace
+
+namespace framework{
+
+namespace css = ::com::sun::star;
+class QuietInteraction;
+//_______________________________________________
+// definitions
+
+/** @short implements general mechainsm for loading documents.
+
+ @descr An instance of this class can be used inside the API calls
+ XComponentLoader::loadComponentFromURL() and XDispatch::dispatch()
+ (of course in its derived interfaces too :-)).
+
+ @author as96863
+ */
+class LoadEnv : private ThreadHelpBase
+{
+ //___________________________________________
+ // structs, types, etc.
+
+ public:
+
+ /** @short enable/disable special features
+ of a load request.
+
+ @desrc Such features must outcome without
+ any special parameters.
+ To make enableing/disabling of
+ features very easy (e.g. at the ctor of
+ this class) these values must be combinable
+ as flags. That means: its values must be in
+ range of [2^n]!
+ */
+ enum EFeature
+ {
+ /// we should be informed, if no feature is enabled :-)
+ E_NO_FEATURE = 0,
+ /// enable using of UI elements during loading (means progress, interaction handler etcpp.)
+ E_WORK_WITH_UI = 1,
+ /// enable loading of resources, which are not related to a target frame! (see concept of ContentHandler)
+ E_ALLOW_CONTENTHANDLER = 2
+ };
+
+ //_______________________________________
+
+ /** @short classify a content.
+
+ @descr The load environment must know, if a content
+ is related to a target frame or not. Only "visible"
+ components, which full fill the requirements of the
+ model-controller-view paradigm can be loaded into a frame.
+ Such contents are classified as E_CAN_BE_LOADED.
+
+ But e.g. for the dispatch framework exists special ContentHandler
+ objects, which can load a content in "non visible" mode ...
+ and do not need a target frame for its operation. Such
+ ContentHandler e.g. plays sounds.
+ Such contents are classified as E_CAN_BE_HANDLED.
+
+ And last but not least a content can be "not valid" in general.
+ */
+ enum EContentType
+ {
+ /// identifies a content, which seems to be invalid in general
+ E_UNSUPPORTED_CONTENT,
+ /// identifies a content, which can be used with a ContentHandler and is not related to a target frame
+ E_CAN_BE_HANDLED,
+ /// identifies a content, which can be loaded into a target frame
+ E_CAN_BE_LOADED,
+ /// special mode for non real loading, In such case the model is given directly!
+ E_CAN_BE_SET
+ };
+
+ //___________________________________________
+ // member
+
+ private:
+
+ /** @short reference to an uno service manager, which must be used
+ to created on needed services on demand.
+ */
+ css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR;
+
+ /** @short points to the frame, which uses this LoadEnv object
+ and must be used to start target search there.
+ */
+ css::uno::Reference< css::frame::XFrame > m_xBaseFrame;
+
+ /** @short points to the frame, into which the new component was loaded.
+
+ @descr Note: This reference will be empty if loading failed
+ or a non visible content was loaded!
+ It can be the same frame as m_xBaseFrame it describe, in case
+ the target "_self", "" or the search flag "SELF" was used.
+ Otherwhise its the new created or recycled frame, which was
+ used for loading and contains further the new component.
+
+ Please use method getTarget() or getTargetComponent()
+ to return the frame/controller or model to any interested
+ user of the results of this load request.
+ */
+ css::uno::Reference< css::frame::XFrame > m_xTargetFrame;
+
+ /** @short contains the name of the target, in which the specified resource
+ of this instance must be loaded.
+ */
+ ::rtl::OUString m_sTarget;
+
+ /** @short if m_sTarget is not a special one, this flags regulate searching
+ of a suitable one.
+ */
+ sal_Int32 m_nSearchFlags;
+
+ /** @short contains all needed informations about the resource,
+ which should be loaded.
+
+ @descr Inside this struct e.g. the URL, its type and filter name,
+ the stream or a model directly are saved.
+ */
+ ::comphelper::MediaDescriptor m_lMediaDescriptor;
+
+ /** @short because the mediadescriptor contains the complete URL ... but
+ some functionality need the structured version, we hold it twice :-(.
+ */
+ css::util::URL m_aURL;
+
+ /** @short enable/disable special features of a load request. */
+ EFeature m_eFeature;
+
+ /** @short classify the content, which should be loaded by this instance. */
+ EContentType m_eContentType;
+
+ /** @short it indicates, that the member m_xTargetFrame was new created for this
+ load request and must be closed in case loading (not handling!)
+ operation failed. The default value is FALSE!
+ */
+ sal_Bool m_bCloseFrameOnError;
+
+ /** @short it indicates, that the old document (which was located inside m_xBaseFrame
+ in combination with the m_sTarget value "_self") was suspended.
+ Normaly it will be replaced by the new loaded document. But in case
+ loading (not handling!) failed, it must be reactivated.
+ The default value is FALSE!
+ */
+ sal_Bool m_bReactivateControllerOnError;
+
+ /** @short it holds one (!) asynchronous used contenthandler or frameloader
+ alive, till the asynchronous operation will be finished.
+ */
+ css::uno::Reference< css::uno::XInterface > m_xAsynchronousJob;
+
+ /** @short holds the information about the finished load process.
+
+ @descr The content of m_xTargetFrame cant be used as valid indicator,
+ (in case the micht existing old document was reactivated)
+ we must hold the result of the load process explicitly.
+ */
+ sal_Bool m_bLoaded;
+
+ /** @short holds an XActionLock on the internal used task member.
+
+ @seealso m_xTargetFrame
+ */
+ ActionLockGuard m_aTargetLock;
+
+ /** TODO document me ... */
+ void* m_pCheck;
+
+ QuietInteraction* m_pQuietInteraction;
+
+ //___________________________________________
+ // native interface
+
+ public:
+
+ /** @short initialize a new instance of this load environment.
+
+ @param xSMGR
+ reference to an uno service manager, which can be used internaly
+ to create on needed services on demand.
+
+ @throw Currently there is no reason to throw such exception!
+
+ @throw A RuntimeException in case any internal process indicates, that
+ the whole runtime cant be used any longer.
+ */
+ LoadEnv(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR)
+ throw(LoadEnvException, css::uno::RuntimeException);
+
+ //_______________________________________
+
+ /** @short deinitialize an instance of this class in the right way.
+ */
+ virtual ~LoadEnv();
+
+ //_______________________________________
+
+ /** @short DRAFT TODO
+ */
+ static css::uno::Reference< css::lang::XComponent > loadComponentFromURL(const css::uno::Reference< css::frame::XComponentLoader >& xLoader,
+ const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR ,
+ const ::rtl::OUString& sURL ,
+ const ::rtl::OUString& sTarget,
+ sal_Int32 nFlags ,
+ const css::uno::Sequence< css::beans::PropertyValue >& lArgs )
+ throw(css::lang::IllegalArgumentException,
+ css::io::IOException ,
+ css::uno::RuntimeException );
+
+ //_______________________________________
+
+ /** @short set some changeable parameters for a new load request.
+
+ @descr The parameter for targeting, the content description, and
+ some environment specifier (UI, dispatch functionality)
+ can be set here ... BEFORE the real load process is started
+ by calling startLoading(). Of course a still running load request
+ will be detected here and a suitable exception will be thrown.
+ Such constellation can be detected outside by using provided
+ synchronisation methods or callbacks.
+
+ @param sURL
+ points to the resource, which should be loaded.
+
+ @param lMediaDescriptor
+ contains additional informations for the following load request.
+
+ @param xBaseFrame
+ points to the frame which must be used as start point for target search.
+
+ @param sTarget
+ regulate searching/creating of frames, which should contain the
+ new loaded component afterwards.
+
+ @param nSearchFlags
+ regulate searching of targets, if sTarget is not a special one.
+
+ @param eFeature
+ flag field, which enable/disable special features of this
+ new instance for following load call.
+
+ @param eContentType
+ classify the given content.
+ This value is set to a default value "UNKNWON_CONTENT", which force
+ an internal check, if this content is loadable or not.
+ But may this check was already made by the caller of this method and
+ passing this information to this LoadEnv instance can supress this
+ might expensive check.
+ That can be usefull in case this information is needed outside too,
+ to decide if its neccessary to create some resources for this load
+ request ... or to reject the request imidiatly if it seems to be not
+ loadable in general.
+
+ @throw A LoadEnvException e.g. if another load operation is till in progress
+ or initialization of a new one fail by other reasons.
+ The real reason, a suitable message and ID will be given here immidiatly.
+
+ @throw A RuntimeException in case any internal process indicates, that
+ the whole runtime cant be used any longer.
+ */
+ virtual void initializeLoading(const ::rtl::OUString& sURL ,
+ const css::uno::Sequence< css::beans::PropertyValue >& lMediaDescriptor,
+ const css::uno::Reference< css::frame::XFrame >& xBaseFrame ,
+ const ::rtl::OUString& sTarget ,
+ sal_Int32 nSearchFlags ,
+ EFeature eFeature = E_NO_FEATURE ,
+ EContentType eContentType = E_UNSUPPORTED_CONTENT)
+ throw(LoadEnvException, css::uno::RuntimeException);
+
+ //_______________________________________
+
+ /** @short start loading of the resource represented by this loadenv instance.
+
+ @descr There is no direct return value possible here. Because it depends
+ from the usage of this instance! E.g. for loading a "visible component"
+ a frame with a controller/model inside can be possible. For loading
+ of a "non visible component" only an information about a successfully start
+ can be provided.
+ Further it cant be guranteed, that the internal process runs synchronous.
+ Thats why we preferr using of specialized methods afterwards e.g. to:
+ - wait till the internal job will be finished
+ and get the results
+ - or to let it run without any further control from outside.
+
+ @throw A LoadEnvException if start of the load process failed (because
+ another is still in progress!).
+ The reason, a suitable message and ID will be given here immidiatly.
+
+ @throw A RuntimeException in case any internal process indicates, that
+ the whole runtime cant be used any longer.
+ */
+ virtual void startLoading()
+ throw(LoadEnvException, css::uno::RuntimeException);
+
+ //_______________________________________
+
+ /** @short wait for an alreay running load request (started by calling
+ startLoading() before).
+
+ @descr The timeout parameter can be used to wait some times only
+ or forever. The return value indicates if the load request
+ was finished during the specified timeout period.
+ But it indicates not, if the load request was successfully or not!
+
+ @param nTimeout
+ specify a timeout in [ms].
+ A value 0 let it wait forever!
+
+ @return TRUE if the started load process could be finished in time;
+ FALSE if the specified time was over.
+
+ @throw ... currently not used :-)
+
+ @throw A RuntimeException in case any internal process indicates, that
+ the whole runtime cant be used any longer.
+ */
+ virtual sal_Bool waitWhileLoading(sal_uInt32 nTimeout = 0)
+ throw(LoadEnvException, css::uno::RuntimeException);
+
+ //_______________________________________
+ /** TODO document me ... */
+ virtual void cancelLoading()
+ throw(LoadEnvException, css::uno::RuntimeException);
+
+ //_______________________________________
+ /** TODO document me ... */
+ virtual css::uno::Reference< css::frame::XFrame > getTarget() const;
+
+ //_______________________________________
+ /** TODO document me ... */
+ virtual css::uno::Reference< css::lang::XComponent > getTargetComponent() const;
+/*
+ //___________________________________________
+ // helper uno interface!
+ // You have to use the native interface only!
+
+ public:
+
+ //_______________________________________
+ // frame.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);
+
+ //_______________________________________
+ // frame.XDispatchResultListener
+ virtual void SAL_CALL dispatchFinished(const css::frame::DispatchResultEvent& aEvent)
+ throw(css::uno::RuntimeException);
+
+ //_______________________________________
+ // lang.XEventListener
+ virtual void SAL_CALL disposing(const css::lang::EventObject& aEvent)
+ throw(css::uno::RuntimeException);
+*/
+ //___________________________________________
+ // static interface
+
+ public:
+
+ /** @short checks if the specified content can be handled by a
+ ContentHandler only and is not related to a target frame,
+ or if it can be loaded by a FrameLoader into a target frame
+ as "visible" component.
+
+ @descr using:
+ switch(classifyContent(...))
+ {
+ case E_CAN_BE_HANDLED :
+ handleIt(...);
+ break;
+
+ case E_CAN_BE_LOADED :
+ xFrame = locateTargetFrame();
+ loadIt(xFrame);
+ break;
+
+ case E_NOT_A_CONTENT :
+ default : throw ...;
+ }
+
+ @param sURL
+ describe the content.
+
+ @param lMediaDescriptor
+ describe the content more detailed!
+
+ @return A suitable enum value, which classify the specified content.
+ */
+ static EContentType classifyContent(const ::rtl::OUString& sURL ,
+ const css::uno::Sequence< css::beans::PropertyValue >& lMediaDescriptor);
+
+ /** TODO document me ... */
+ void impl_setResult(sal_Bool bResult);
+
+ /** TODO document me ... */
+ css::uno::Reference< css::uno::XInterface > impl_searchLoader();
+
+ //_______________________________________
+
+ /** @short it means; show the frame, bring it to front,
+ might set the right icon etcpp. in case loading was
+ successfully or reactivate a might existing old document or
+ close the frame if it was created before in case loading failed.
+
+ @throw A LoadEnvException only in cases, where an internal error indicates,
+ that the complete load environment seems to be not useable in general.
+ In such cases a RuntimeException would be to hard for the outside code :-)
+
+ @throw A RuntimeException in case any internal process indicates, that
+ the whole runtime cant be used any longer.
+ */
+ void impl_reactForLoadingState()
+ throw(LoadEnvException, css::uno::RuntimeException);
+
+ //___________________________________________
+ // private helper
+
+ private:
+
+ /** @short tries to detect the type and the filter of the specified content.
+
+ @descr This method actualize the available media descriptor of this instance,
+ so it contains the right type, a corresponding filter, may a
+ valid frame loader etc. In case detection failed, this descriptor
+ is corrected first, before a suitable exception will be thrown.
+ (Excepting a RuntimeException occure!)
+
+ @attention Not all types we know, are supported by filters. So it does not
+ indicates an error, if no suitable filter(loader etcpp will be found
+ for a type. But a type must be detected for the specified content.
+ Otherwhise its an error and loading cant be finished successfully.
+
+ @throw A LoadEnvException if detection failed.
+
+ @throw A RuntimeException in case any internal process indicates, that
+ the whole runtime cant be used any longer.
+ */
+ void impl_detectTypeAndFilter()
+ throw(LoadEnvException, css::uno::RuntimeException);
+
+ //_______________________________________
+
+ /** @short tries to ask user for it's filter decision in case
+ normal detection failed.
+
+ @descr We use a may existing interaction handler to do so.
+
+ @return [string]
+ the type selected by the user.
+
+ @attention Internaly we update the member m_lMediaDescriptor!
+ */
+ ::rtl::OUString impl_askUserForTypeAndFilterIfAllowed()
+ throw(LoadEnvException, css::uno::RuntimeException);
+
+ //_______________________________________
+
+ /** @short tries to use ContentHandler objects for loading.
+
+ @descr It searches for a suitable content handler object, registered
+ for the detected content type (must be done before by calling
+ impl_detectTypeAndFilter()). Because such handler does not depend
+ from a real target frame, location of such frame will be
+ supressed here.
+ In case handle failed all new created resources will be
+ removed before a suitable exception is thrown.
+ (Excepting a RuntimeException occure!)
+
+ @return TODO
+
+ @throw A LoadEnvException if handling failed.
+
+ @throw A RuntimeException in case any internal process indicates, that
+ the whole runtime cant be used any longer.
+ */
+ sal_Bool impl_handleContent()
+ throw(LoadEnvException, css::uno::RuntimeException);
+
+ //_______________________________________
+
+ /** @short tries to use FrameLoader objects for loading.
+
+ @descr First the target frame will be located. If it could be found
+ or new created a filter/frame loader will be instanciated and
+ used to load the content into this frame.
+ In case loading failed all new created resources will be
+ removed before a suitable exception is thrown.
+ (Excepting a RuntimeException occure!)
+
+ @return TODO
+
+ @throw A LoadEnvException if loading failed.
+
+ @throw A RuntimeException in case any internal process indicates, that
+ the whole runtime cant be used any longer.
+ */
+ sal_Bool impl_loadContent()
+ throw(LoadEnvException, css::uno::RuntimeException);
+
+ //_______________________________________
+
+ /** @short checks if the specified content is already loaded.
+
+ @descr It depends from the set target information, if such
+ search is allowed or not! So this method checks first,
+ if the target is the special one "_default".
+ If not it returns with an empty result immidatly!
+ In case search is allowed, an existing document with the
+ same URL is searched. If it could be found, the corresponding
+ view will get the focus and this method return the corresponding frame.
+ Optional jumpmarks will be accepted here too. So the
+ view of the document will be updated to show the position
+ inside the document, which is related to the jumpmark.
+
+ @return A valid reference to the target frame, which contains the already loaded content
+ and could be activated successfully. An empty reference oterwhise.
+
+ @throw A LoadEnvException only in cases, where an internal error indicates,
+ that the complete load environment seems to be not useable in general.
+ In such cases a RuntimeException would be to hard for the outside code :-)
+
+ @throw A RuntimeException in case any internal process indicates, that
+ the whole runtime cant be used any longer.
+ */
+ css::uno::Reference< css::frame::XFrame > impl_searchAlreadyLoaded()
+ throw(LoadEnvException, css::uno::RuntimeException);
+
+ //_______________________________________
+
+ /** @short search for any target frame, which seems to be useable
+ for this load request.
+
+ @descr Because this special feature is bound to the target specifier "_default"
+ its checked inside first. If its not set => this method return an empty
+ reference. Otherwhise any currently existing frame will be analyzed, if
+ it can be used here. The following rules exists:
+
+ <ul>
+ <li>The frame must be empty ...</li>
+ <li>or contains an empty document of the same application module
+ which the new document will have (Note: the filter of the new content
+ must be well known here!)</li>
+ <li>and(!) this target must not be already used by any other load request.</li>
+ </ul>
+
+ If a suitable target is located it will be locked. Thats why the last rule
+ exists! If this method returns a valid frame reference, it was locked to be useable
+ for this load request only. (Dont forget to reset this state later!)
+ Concurrent LoadEnv instances can synchronize her work be using such locks :-) HOPEFULLY
+
+ @throw A LoadEnvException only in cases, where an internal error indicates,
+ that the complete load environment seems to be not useable in general.
+ In such cases a RuntimeException would be to hard for the outside code :-)
+
+ @throw A RuntimeException in case any internal process indicates, that
+ the whole runtime cant be used any longer.
+ */
+ css::uno::Reference< css::frame::XFrame > impl_searchRecycleTarget()
+ throw(LoadEnvException, css::uno::RuntimeException);
+
+ //_______________________________________
+
+ /** @short because showing of a frame is needed more then once ...
+ it's implemented as an seperate method .-)
+
+ @descr Note: Showing of a frame is bound to a special feature ...
+ a) If we recycle any existing frame, we must bring it to front.
+ Showing of such frame isnt needed realy .. because we recycle
+ visible frames only!
+ b) If the document was already shown (e.g. by our progress implementation)
+ we do nothing here. The reason behind: The document was already shown ..
+ and it was already make a top window ...
+ If the user activated another frame inbetween (because loading needed some time)
+ it's not allowed to disturb the user again. Then the frame must resists in the background.
+ c) If the frame was not shown before ... but loading of a visible document into this frame
+ was finished ... we need both actions: setVisible() and toFront().
+
+ @param xWindow
+ points to the container window of a frame.
+
+ @param bForceToFront
+ if it's set to FALSE ... showing of the window is done more intelligent.
+ setVisible() is called only if the window was not shown before.
+ This mode is needed by b) and c)
+ If it's set to TRUE ... both actions has to be done: setVisible(), toFront()!
+ This mode is needed by a)
+ */
+ void impl_makeFrameWindowVisible(const css::uno::Reference< css::awt::XWindow >& xWindow ,
+ sal_Bool bForceToFront);
+
+ //_______________________________________
+
+ /** @short checks weather a frame is already used for another load request or not.
+
+ @descr Such frames cant be used for our "recycle feature"!
+
+ @param xFrame
+ the frame, which should be checked.
+
+ @return [sal_Bool]
+ TRUE if this frame is already used for loading,
+ FALSE otherwise.
+ */
+ sal_Bool impl_isFrameAlreadyUsedForLoading(const css::uno::Reference< css::frame::XFrame >& xFrame) const;
+
+ //_______________________________________
+
+ /** @short try to determine the used application module
+ of this load request and applay right position and size
+ for this document window ... hopefully before we show it .-)
+ */
+ void impl_applyPersistentWindowState(const css::uno::Reference< css::awt::XWindow >& xWindow);
+
+ //_______________________________________
+
+ /** @short determine if it's allowed to open new document frames.
+ */
+ sal_Bool impl_furtherDocsAllowed();
+
+ //_______________________________________
+
+ /** @short jumps to the requested bookmark inside a given document.
+ */
+ void impl_jumpToMark(const css::uno::Reference< css::frame::XFrame >& xFrame,
+ const css::util::URL& aURL );
+};
+
+} // namespace framework
+
+#endif // __FRAMEWORK_LOADENV_LOADENV_HXX_
diff --git a/framework/source/inc/loadenv/loadenvexception.hxx b/framework/source/inc/loadenv/loadenvexception.hxx
new file mode 100644
index 000000000000..45282fb252bc
--- /dev/null
+++ b/framework/source/inc/loadenv/loadenvexception.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_LOADENV_LOADENVEXCEPTION_HXX_
+#define __FRAMEWORK_LOADENV_LOADENVEXCEPTION_HXX_
+
+//_______________________________________________
+// includes of own project
+
+//_______________________________________________
+// includes of uno interface
+
+#include <com/sun/star/uno/Any.h>
+#include <com/sun/star/uno/Exception.hpp>
+
+//_______________________________________________
+// includes of an other project
+#include <rtl/string.hxx>
+
+//_______________________________________________
+// namespace
+
+namespace framework{
+
+#ifndef css // conflict with define :-(
+namespace css = ::com::sun::star;
+#endif
+
+//_______________________________________________
+// definitions
+
+/** @short specify an exception, which can be used inside the
+ load environment only.
+
+ @descr Of course outside code must wrapp it, to transport
+ the occured information to its caller.
+
+ @author as96863
+ */
+class LoadEnvException
+{
+ //___________________________________________
+ // const
+
+ public:
+
+ /** @short Can be used as an ID for an instance of a LoadEnvException.
+ @descr To prevent errors on adding/removing/changing such IDs here,
+ an enum field is used. Its int values are self organized ...
+ */
+ enum EIDs
+ {
+ /** @short The specified URL/Stream/etcpp. can not be handled by a LoadEnv instance. */
+ ID_UNSUPPORTED_CONTENT,
+
+ /** @short It was not possible to get access to global filter configuration.
+ @descr Might som neccsessary services could not be created. */
+ ID_NO_CONFIG_ACCESS,
+
+ /** @short Some data obtained from the filter configuration seems to incorrect.
+ @descr Might a filter-type relation ship seem to be damaged. */
+ ID_INVALID_FILTER_CONFIG,
+
+ /** @short indicates a corrupted media descriptor.
+ @descr Some parts are required - some other ones are optional. Such exception
+ should be thrown, if a required item does not exists. */
+ ID_INVALID_MEDIADESCRIPTOR,
+
+ /** @short Its similar to an uno::RuntimeException ....
+ @descr But such runtime exception can break the whole office code.
+ So its capsulated to this specialized load environment only.
+ Mostly it indicates a missing but needed resource ... e.g the
+ global desktop reference! */
+ ID_INVALID_ENVIRONMENT,
+
+ /** @short indicates a failed search for the right target frame. */
+ ID_NO_TARGET_FOUND,
+
+ /** @short An already existing document was found inside a target frame.
+ But its controller could not be suspended successfully. Thats
+ why the new load request was cancelled. The document could not
+ be replaced. */
+ ID_COULD_NOT_SUSPEND_CONTROLLER,
+
+ /** @short TODO */
+ ID_COULD_NOT_REACTIVATE_CONTROLLER,
+
+ /** @short inidcates an already running load operation. Of yourse the same
+ instance cant be used for multiple load requests at the same time.
+ */
+ ID_STILL_RUNNING,
+
+ /** @short sometiems we cant specify the reason for an error, because we
+ was interrupted by an called code in an unexpected way ...
+ */
+ ID_GENERAL_ERROR
+ };
+
+ //___________________________________________
+ // member
+
+ public:
+
+ /** @short contains a suitable message, which describes the reason for this
+ exception. */
+ ::rtl::OString m_sMessage;
+
+ /** @short An ID, which make this exception unique among others. */
+ sal_Int32 m_nID;
+
+ /** @short Contains the original exception, if any occured. */
+ css::uno::Any m_exOriginal;
+
+ /** TODO
+ Experimental use! May it can be usefully to know, if an exception was already
+ catched and handled by an interaction and was might be rethrowed! */
+ sal_Bool m_bHandled;
+
+ //___________________________________________
+ // interface
+
+ public:
+
+ /** @short initialize a new instance with an ID.
+ @descr Some other items of this exception
+ (e.g. a suitable message) will be generated
+ automaticly.
+
+ @param nID
+ One of the defined const IDs of this class.
+ */
+ LoadEnvException(sal_Int32 nID)
+ {
+ m_nID = nID;
+ }
+
+ //_______________________________________
+
+ /** @short initialize a new instance with an ID
+ an wrap a detected exception into this one.
+ @descr Some other items of this exception
+ (e.g. a suitable message) will be generated
+ automaticly.
+
+ @param nID
+ One of the defined const IDs of this class.
+
+ @param exUno
+ the original catched uno exception.
+ */
+ LoadEnvException( sal_Int32 nID ,
+ const css::uno::Exception& exUno)
+ {
+ m_nID = nID ;
+ m_exOriginal <<= exUno;
+ }
+
+ //_______________________________________
+
+ /** @short destruct an instance of this exception.
+ */
+ ~LoadEnvException()
+ {
+ m_sMessage = ::rtl::OString();
+ m_nID = 0;
+ m_bHandled = false;
+ m_exOriginal.clear();
+ }
+};
+
+} // namespace framework
+
+#endif // __FRAMEWORK_LOADENV_LOADENVEXCEPTION_HXX_
diff --git a/framework/source/inc/loadenv/targethelper.hxx b/framework/source/inc/loadenv/targethelper.hxx
new file mode 100644
index 000000000000..179ec117ab19
--- /dev/null
+++ b/framework/source/inc/loadenv/targethelper.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_TARGETHELPER_HXX_
+#define __FRAMEWORK_TARGETHELPER_HXX_
+
+//_______________________________________________
+// own includes
+
+#include <sal/types.h>
+#include <rtl/ustring.hxx>
+#include <targets.h>
+//_______________________________________________
+// namespace
+
+namespace framework{
+
+//_______________________________________________
+// definitions
+
+/** @short can be used to detect, if a target name (used e.g. for XFrame.findFrame())
+ has a special meaning or can be used as normal frame name (e.g. for XFrame.setName()).
+
+ @author as96863
+ */
+class TargetHelper
+{
+ //___________________________________________
+ // const
+
+ public:
+
+ /** @short its used at the following interfaces to classify
+ target names.
+ */
+ enum ESpecialTarget
+ {
+ E_NOT_SPECIAL ,
+ E_SELF ,
+ E_PARENT ,
+ E_TOP ,
+ E_BLANK ,
+ E_DEFAULT ,
+ E_BEAMER ,
+ E_MENUBAR ,
+ E_HELPAGENT ,
+ E_HELPTASK
+ };
+
+ //___________________________________________
+ // interface
+
+ public:
+
+ //___________________________________________
+
+ /** @short it checks the given unknown target name,
+ if it's the expected special one.
+
+ @note An empty target is similar to "_self"!
+
+ @param sCheckTarget
+ must be the unknwon target name, which should be checked.
+
+ @param eSpecialTarget
+ represent the expected target.
+
+ @return It returns <TRUE/> if <var>sCheckTarget</var> represent
+ the expected <var>eSpecialTarget</var> value; <FALSE/> otherwhise.
+ */
+ static sal_Bool matchSpecialTarget(const ::rtl::OUString& sCheckTarget ,
+ ESpecialTarget eSpecialTarget);
+
+ //___________________________________________
+
+ /** @short it checks, if the given name can be used
+ to set it at a frame using XFrame.setName() method.
+
+ @descr Because we handle special targets in a hard coded way
+ (means we do not check the real name of a frame then)
+ such named frames will never be found!
+
+ And in case such special names can exists one times only
+ by definition inside the same frame tree (e.g. _beamer and
+ OFFICE_HELP_TASK) its not a good idea to allow anything here :-)
+
+ Of course we can't check unknwon names, which are not special ones.
+ But we decide, that it's not allowed to use "_" as first sign
+ (because we reserve this letter for our own purposes!)
+ and the value must not a well known special target.
+
+ @param sName
+ the new frame name, which sould be checked.
+ */
+ static sal_Bool isValidNameForFrame(const ::rtl::OUString& sName);
+};
+
+} // namespace framework
+
+#endif // #ifndef __FRAMEWORK_TARGETHELPER_HXX_
diff --git a/framework/source/inc/pattern/configuration.hxx b/framework/source/inc/pattern/configuration.hxx
new file mode 100644
index 000000000000..7cb9280ef0e2
--- /dev/null
+++ b/framework/source/inc/pattern/configuration.hxx
@@ -0,0 +1,176 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public 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_PATTERN_CONFIGURATION_HXX_
+#define __FRAMEWORK_PATTERN_CONFIGURATION_HXX_
+
+//_______________________________________________
+// own includes
+
+#include <services.h>
+#include <general.h>
+
+//_______________________________________________
+// interface includes
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/uno/Any.hxx>
+
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HXX_
+#include <com/sun/star/beans/PropertyValue.hpp>
+#endif
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+//_______________________________________________
+// other includes
+#include <rtl/ustrbuf.hxx>
+
+//_______________________________________________
+// namespaces
+
+#ifndef css
+namespace css = ::com::sun::star;
+#endif
+
+namespace framework{
+ namespace pattern{
+ namespace configuration{
+
+//_______________________________________________
+// definitions
+
+//-----------------------------------------------
+class ConfigurationHelper
+{
+ //-------------------------------------------
+ // const
+ public:
+
+ //---------------------------------------
+ /** @short allow opening of a configuration access
+ in different working modes.
+
+ @descr All enum values must be useable as flags
+ mapped into a int32 value!
+ */
+ enum EOpenMode
+ {
+ /// open it readonly (default=readwrite!)
+ E_READONLY = 1,
+ /// disable fallback handling for localized cfg nodes
+ E_ALL_LOCALES = 2
+ };
+
+ //-------------------------------------------
+ // interface
+ public:
+
+ //---------------------------------------
+ /**
+ @short opens a configuration access.
+
+ @descr TODO
+
+ @param xSMGR
+ this method need an uno service manager for internal work.
+
+ @param sPackage
+ name the configuration file.
+ e.g. "/.org.openoffice.Setup"
+ Note: It must start with "/" but end without(!) "/"!
+
+ @param sRelPath
+ describe the relativ path of the requested key inside
+ the specified package.
+ e.g. "Office/Factories"
+ Note: Its not allowed to start or end with a "/"!
+ Further you must use encoded path elements if
+ e.g. set nodes are involved.
+
+ @param nOpenFlags
+ force opening of the configuration access in special mode.
+ see enum EOpenMode for further informations.
+ */
+ static css::uno::Reference< css::uno::XInterface > openConfig(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR ,
+ const ::rtl::OUString& sPackage ,
+ const ::rtl::OUString& sRelPath ,
+ sal_Int32 nOpenFlags)
+ {
+ static ::rtl::OUString PATH_SEPERATOR = ::rtl::OUString::createFromAscii("/");
+
+ css::uno::Reference< css::uno::XInterface > xCFG;
+
+ try
+ {
+ css::uno::Reference< css::lang::XMultiServiceFactory > xConfigProvider(
+ xSMGR->createInstance(SERVICENAME_CFGPROVIDER), css::uno::UNO_QUERY_THROW);
+
+ ::rtl::OUStringBuffer sPath(1024);
+ sPath.append(sPackage );
+ sPath.append(PATH_SEPERATOR);
+ sPath.append(sRelPath );
+
+ sal_Bool bReadOnly = ((nOpenFlags & ConfigurationHelper::E_READONLY ) == ConfigurationHelper::E_READONLY );
+ sal_Bool bAllLocales = ((nOpenFlags & ConfigurationHelper::E_ALL_LOCALES) == ConfigurationHelper::E_ALL_LOCALES);
+
+ sal_Int32 c = 1;
+ if (bAllLocales)
+ c = 2;
+
+ css::uno::Sequence< css::uno::Any > lParams(c);
+ css::beans::PropertyValue aParam;
+
+ aParam.Name = ::rtl::OUString::createFromAscii("nodepath");
+ aParam.Value <<= sPath.makeStringAndClear();
+ lParams[0] <<= aParam;
+
+ if (bAllLocales)
+ {
+ aParam.Name = ::rtl::OUString::createFromAscii("*");
+ aParam.Value <<= sal_True;
+ lParams[1] <<= aParam;
+ }
+
+ if (bReadOnly)
+ xCFG = xConfigProvider->createInstanceWithArguments(SERVICENAME_CFGREADACCESS, lParams);
+ else
+ xCFG = xConfigProvider->createInstanceWithArguments(SERVICENAME_CFGUPDATEACCESS, lParams);
+ }
+ catch(const css::uno::RuntimeException& exRun)
+ { throw exRun; }
+ catch(const css::uno::Exception&)
+ { xCFG.clear(); }
+
+ return xCFG;
+ }
+};
+
+ } // namespace configuration
+ } // namespace pattern
+} // namespace framework
+
+#endif // __FRAMEWORK_PATTERN_CONFIGURATION_HXX_
diff --git a/framework/source/inc/pattern/frame.hxx b/framework/source/inc/pattern/frame.hxx
new file mode 100644
index 000000000000..3ffbfaeaebdc
--- /dev/null
+++ b/framework/source/inc/pattern/frame.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_PATTERN_FRAME_HXX_
+#define __FRAMEWORK_PATTERN_FRAME_HXX_
+
+//_______________________________________________
+// own includes
+
+#include <general.h>
+
+//_______________________________________________
+// interface includes
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/frame/XController.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <com/sun/star/util/XCloseable.hpp>
+
+//_______________________________________________
+// other includes
+
+//_______________________________________________
+// namespaces
+
+#ifndef css
+namespace css = ::com::sun::star;
+#endif
+
+namespace framework{
+ namespace pattern{
+ namespace frame{
+
+//_______________________________________________
+// definitions
+
+//-----------------------------------------------
+inline css::uno::Reference< css::frame::XModel > extractFrameModel(const css::uno::Reference< css::frame::XFrame >& xFrame)
+{
+ css::uno::Reference< css::frame::XModel > xModel;
+ css::uno::Reference< css::frame::XController > xController;
+ if (xFrame.is())
+ xController = xFrame->getController();
+ if (xController.is())
+ xModel = xController->getModel();
+ return xModel;
+}
+
+//-----------------------------------------------
+/** @short close (or dispose) the given resource.
+
+ @descr It try to close the given resource first.
+ Delegating of the ownership can be influenced from
+ outside. If closing isnt possible (because the
+ needed interface isnt available) dispose() is tried instead.
+ Al possible exception are handled inside.
+ So the user of this method has to look for the return value only.
+
+ @attention The given resource will not be cleared.
+ But later using of it can produce an exception!
+
+ @param xResource
+ the object, which should be closed here.
+
+ @param bDelegateOwnerShip
+ used at the XCloseable->close() method to define
+ the right owner in case closing failed.
+
+ @return [bool]
+ TRUE if closing failed.
+ */
+inline sal_Bool closeIt(const css::uno::Reference< css::uno::XInterface >& xResource ,
+ sal_Bool bDelegateOwnerShip)
+{
+ css::uno::Reference< css::util::XCloseable > xClose (xResource, css::uno::UNO_QUERY);
+ css::uno::Reference< css::lang::XComponent > xDispose(xResource, css::uno::UNO_QUERY);
+
+ try
+ {
+ if (xClose.is())
+ xClose->close(bDelegateOwnerShip);
+ else
+ if (xDispose.is())
+ xDispose->dispose();
+ else
+ return sal_False;
+ }
+ catch(const css::util::CloseVetoException&)
+ { return sal_False; }
+ catch(const css::lang::DisposedException&)
+ {} // disposed is closed is ...
+ catch(const css::uno::RuntimeException&)
+ { throw; } // shouldnt be suppressed!
+ catch(const css::uno::Exception&)
+ { return sal_False; } // ??? We defined to return a boolen value instead of throwing exceptions ...
+ // (OK: RuntimeExceptions shouldnt be catched inside the core ..)
+
+ return sal_True;
+}
+
+ } // namespace frame
+ } // namespace pattern
+} // namespace framework
+
+#endif // __FRAMEWORK_PATTERN_FRAME_HXX_
diff --git a/framework/source/inc/pattern/storages.hxx b/framework/source/inc/pattern/storages.hxx
new file mode 100644
index 000000000000..a785e307995d
--- /dev/null
+++ b/framework/source/inc/pattern/storages.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_PATTERN_STORAGES_HXX_
+#define __FRAMEWORK_PATTERN_STORAGES_HXX_
+
+//_______________________________________________
+// own includes
+
+#include <services.h>
+#include <general.h>
+
+//_______________________________________________
+// interface includes
+#include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/io/XSeekable.hpp>
+#include <com/sun/star/embed/ElementModes.hpp>
+#include <com/sun/star/embed/XStorage.hpp>
+#include <com/sun/star/embed/XPackageStructureCreator.hpp>
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+//_______________________________________________
+// other includes
+
+//_______________________________________________
+// namespaces
+
+#ifndef css
+namespace css = ::com::sun::star;
+#endif
+
+namespace framework{
+ namespace pattern{
+ namespace storages{
+
+//_______________________________________________
+// definitions
+
+//-----------------------------------------------
+css::uno::Reference< css::embed::XStorage > createTempStorageBasedOnFolder(const ::rtl::OUString& sFolder ,
+ const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR ,
+ sal_Bool bReadOnly)
+{
+ // error during opening the temp file isnt realy a runtime error -> handle it gracefully
+ css::uno::Reference< css::io::XOutputStream > xTempFile(xSMGR->createInstance(SERVICENAME_TEMPFILE), css::uno::UNO_QUERY);
+ if (!xTempFile.is())
+ return css::uno::Reference< css::embed::XStorage >();
+
+ // creation of needed resources is mandatory -> error = runtime error
+ css::uno::Reference< css::embed::XPackageStructureCreator > xPackageCreator(xSMGR->createInstance(SERVICENAME_PACKAGESTRUCTURECREATOR), css::uno::UNO_QUERY_THROW);
+ css::uno::Reference< css::lang::XSingleServiceFactory > xStorageFactory(xSMGR->createInstance(SERVICENAME_STORAGEFACTORY) , css::uno::UNO_QUERY_THROW);
+
+ // create zip package
+ xPackageCreator->convertToPackage(sFolder, xTempFile);
+
+ // seek it back - so it can be used in a defined way.
+ css::uno::Reference< css::io::XSeekable > xSeekable(xTempFile, css::uno::UNO_QUERY_THROW);
+ xSeekable->seek(0);
+
+ // open the temp. zip package - using the right open mode
+ sal_Int32 nOpenMode = css::embed::ElementModes::ELEMENT_READWRITE;
+ if (bReadOnly)
+ nOpenMode = css::embed::ElementModes::ELEMENT_READ;
+
+ css::uno::Sequence< css::uno::Any > lArgs(2);
+ lArgs[0] <<= xTempFile;
+ lArgs[1] <<= nOpenMode;
+
+ css::uno::Reference< css::embed::XStorage > xStorage(xStorageFactory->createInstanceWithArguments(lArgs), css::uno::UNO_QUERY_THROW);
+ return xStorage;
+}
+
+ } // namespace storages
+ } // namespace pattern
+} // namespace framework
+
+#endif // __FRAMEWORK_PATTERN_STORAGES_HXX_
diff --git a/framework/source/inc/pattern/window.hxx b/framework/source/inc/pattern/window.hxx
new file mode 100644
index 000000000000..619ce140d491
--- /dev/null
+++ b/framework/source/inc/pattern/window.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_PATTERN_WINDOW_HXX_
+#define __FRAMEWORK_PATTERN_WINDOW_HXX_
+
+//_______________________________________________
+// own includes
+
+#include <general.h>
+
+//_______________________________________________
+// interface includes
+#include <com/sun/star/awt/XWindow.hpp>
+#include <com/sun/star/awt/XTopWindow.hpp>
+
+//_______________________________________________
+// other includes
+
+#ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_
+#include <toolkit/unohlp.hxx>
+#endif
+#include <vcl/window.hxx>
+#include <vcl/syswin.hxx>
+#include <vcl/wrkwin.hxx>
+#include <vcl/svapp.hxx>
+#include <vos/mutex.hxx>
+#include <rtl/ustring.hxx>
+
+//_______________________________________________
+// namespaces
+
+#ifndef css
+namespace css = ::com::sun::star;
+#endif
+
+namespace framework{
+
+//_______________________________________________
+// definitions
+
+class WindowHelper
+{
+ public:
+
+//-----------------------------------------------
+static ::rtl::OUString getWindowState(const css::uno::Reference< css::awt::XWindow >& xWindow)
+{
+ if (!xWindow.is())
+ return ::rtl::OUString();
+
+ // SOLAR SAFE -> ----------------------------
+ ::vos::OClearableGuard aSolarGuard(Application::GetSolarMutex());
+
+ ByteString sWindowState;
+ Window* pWindow = VCLUnoHelper::GetWindow(xWindow);
+ // check for system window is neccessary to guarantee correct pointer cast!
+ if (pWindow!=NULL && pWindow->IsSystemWindow())
+ {
+ ULONG nMask = WINDOWSTATE_MASK_ALL;
+ nMask &= ~(WINDOWSTATE_MASK_MINIMIZED);
+ sWindowState = ((SystemWindow*)pWindow)->GetWindowState(nMask);
+ }
+
+ aSolarGuard.clear();
+ // <- SOLAR SAFE ----------------------------
+
+ return B2U_ENC(sWindowState,RTL_TEXTENCODING_UTF8);
+}
+
+//-----------------------------------------------
+static void setWindowState(const css::uno::Reference< css::awt::XWindow >& xWindow ,
+ const ::rtl::OUString& sWindowState)
+{
+ if (
+ (!xWindow.is() ) ||
+ (!sWindowState.getLength())
+ )
+ return;
+
+ // SOLAR SAFE -> ----------------------------
+ ::vos::OClearableGuard aSolarGuard(Application::GetSolarMutex());
+
+ Window* pWindow = VCLUnoHelper::GetWindow(xWindow);
+ // check for system window is neccessary to guarantee correct pointer cast!
+ if (
+ (pWindow ) &&
+ (pWindow->IsSystemWindow()) &&
+ (
+ // dont overwrite a might existing minimized mode!
+ (pWindow->GetType() != WINDOW_WORKWINDOW) ||
+ (!((WorkWindow*)pWindow)->IsMinimized() )
+ )
+ )
+ {
+ ((SystemWindow*)pWindow)->SetWindowState(U2B_ENC(sWindowState,RTL_TEXTENCODING_UTF8));
+ }
+
+ aSolarGuard.clear();
+ // <- SOLAR SAFE ----------------------------
+}
+
+//-----------------------------------------------
+static ::sal_Bool isTopWindow(const css::uno::Reference< css::awt::XWindow >& xWindow)
+{
+ // even child frame containing top level windows (e.g. query designer of database) will be closed
+ css::uno::Reference< css::awt::XTopWindow > xTopWindowCheck(xWindow, css::uno::UNO_QUERY);
+ if (xTopWindowCheck.is())
+ {
+ // Note: Toolkit interface XTopWindow sometimes is used by real VCL-child-windows also .-)
+ // Be sure that these window is realy a "top system window".
+ // Attention ! Checking Window->GetParent() isnt the right approach here.
+ // Because sometimes VCL create "implicit border windows" as parents even we created
+ // a simple XWindow using the toolkit only .-(
+ ::vos::OGuard aSolarLock(&Application::GetSolarMutex());
+ Window* pWindow = VCLUnoHelper::GetWindow( xWindow );
+ if (
+ (pWindow ) &&
+ (pWindow->IsSystemWindow())
+ )
+ return sal_True;
+ }
+
+ return sal_False;
+}
+
+};
+
+} // namespace framework
+
+#endif // __FRAMEWORK_PATTERN_WINDOW_HXX_