summaryrefslogtreecommitdiff
path: root/unotools/inc/unotools
diff options
context:
space:
mode:
Diffstat (limited to 'unotools/inc/unotools')
-rw-r--r--unotools/inc/unotools/accelcfg.hxx85
-rw-r--r--unotools/inc/unotools/accessiblerelationsethelper.hxx161
-rw-r--r--unotools/inc/unotools/accessiblestatesethelper.hxx183
-rw-r--r--unotools/inc/unotools/atom.hxx132
-rw-r--r--unotools/inc/unotools/bootstrap.hxx138
-rw-r--r--unotools/inc/unotools/cacheoptions.hxx173
-rw-r--r--unotools/inc/unotools/calendarwrapper.hxx133
-rw-r--r--unotools/inc/unotools/charclass.hxx236
-rw-r--r--unotools/inc/unotools/cmdoptions.hxx255
-rw-r--r--unotools/inc/unotools/collatorwrapper.hxx97
-rw-r--r--unotools/inc/unotools/compatibility.hxx253
-rw-r--r--unotools/inc/unotools/componentresmodule.hxx203
-rw-r--r--unotools/inc/unotools/configitem.hxx212
-rw-r--r--unotools/inc/unotools/configmgr.hxx115
-rw-r--r--unotools/inc/unotools/confignode.hxx340
-rw-r--r--unotools/inc/unotools/configpathes.hxx177
-rw-r--r--unotools/inc/unotools/configvaluecontainer.hxx236
-rw-r--r--unotools/inc/unotools/datetime.hxx63
-rw-r--r--unotools/inc/unotools/defaultoptions.hxx54
-rw-r--r--unotools/inc/unotools/desktopterminationobserver.hxx79
-rw-r--r--unotools/inc/unotools/digitgroupingiterator.hxx204
-rw-r--r--unotools/inc/unotools/docinfohelper.hxx47
-rw-r--r--unotools/inc/unotools/dynamicmenuoptions.hxx219
-rw-r--r--unotools/inc/unotools/eventcfg.hxx122
-rw-r--r--unotools/inc/unotools/eventlisteneradapter.hxx71
-rw-r--r--unotools/inc/unotools/extendedsecurityoptions.hxx160
-rw-r--r--unotools/inc/unotools/fltrcfg.hxx100
-rw-r--r--unotools/inc/unotools/fontcfg.hxx227
-rw-r--r--unotools/inc/unotools/fontcvt.hxx79
-rw-r--r--unotools/inc/unotools/fontdefs.hxx110
-rw-r--r--unotools/inc/unotools/fontoptions.hxx173
-rw-r--r--unotools/inc/unotools/historyoptions.hxx248
-rw-r--r--unotools/inc/unotools/historyoptions_const.hxx55
-rw-r--r--unotools/inc/unotools/idhelper.hxx210
-rw-r--r--unotools/inc/unotools/inetoptions.hxx143
-rw-r--r--unotools/inc/unotools/internaloptions.hxx180
-rw-r--r--unotools/inc/unotools/intlwrapper.hxx123
-rw-r--r--unotools/inc/unotools/itemholderbase.hxx128
-rw-r--r--unotools/inc/unotools/javaoptions.hxx73
-rw-r--r--unotools/inc/unotools/lingucfg.hxx241
-rw-r--r--unotools/inc/unotools/linguprops.hxx121
-rw-r--r--unotools/inc/unotools/localedatawrapper.hxx363
-rw-r--r--unotools/inc/unotools/localfilehelper.hxx68
-rw-r--r--unotools/inc/unotools/localisationoptions.hxx178
-rw-r--r--unotools/inc/unotools/loghelper.hxx51
-rw-r--r--unotools/inc/unotools/misccfg.hxx67
-rw-r--r--unotools/inc/unotools/moduleoptions.hxx257
-rw-r--r--unotools/inc/unotools/nativenumberwrapper.hxx75
-rw-r--r--unotools/inc/unotools/numberformatcodewrapper.hxx76
-rw-r--r--unotools/inc/unotools/options.hxx97
-rw-r--r--unotools/inc/unotools/optionsdlg.hxx56
-rw-r--r--unotools/inc/unotools/pathoptions.hxx140
-rw-r--r--unotools/inc/unotools/printwarningoptions.hxx161
-rw-r--r--unotools/inc/unotools/processfactory.hxx59
-rw-r--r--unotools/inc/unotools/progresshandlerwrap.hxx57
-rw-r--r--unotools/inc/unotools/propertysethelper.hxx96
-rw-r--r--unotools/inc/unotools/propertysetinfo.hxx93
-rw-r--r--unotools/inc/unotools/querydeep.hxx486
-rw-r--r--unotools/inc/unotools/readwritemutexguard.hxx113
-rw-r--r--unotools/inc/unotools/regoptions.hxx126
-rw-r--r--unotools/inc/unotools/regpathhelper.hxx71
-rw-r--r--unotools/inc/unotools/saveopt.hxx130
-rw-r--r--unotools/inc/unotools/searchopt.hxx119
-rw-r--r--unotools/inc/unotools/securityoptions.hxx296
-rw-r--r--unotools/inc/unotools/sharedunocomponent.hxx370
-rw-r--r--unotools/inc/unotools/sourceviewconfig.hxx63
-rw-r--r--unotools/inc/unotools/startoptions.hxx170
-rw-r--r--unotools/inc/unotools/streamhelper.hxx116
-rw-r--r--unotools/inc/unotools/streamsection.hxx85
-rw-r--r--unotools/inc/unotools/streamwrap.hxx183
-rw-r--r--unotools/inc/unotools/syslocale.hxx88
-rw-r--r--unotools/inc/unotools/syslocaleoptions.hxx168
-rw-r--r--unotools/inc/unotools/tempfile.hxx161
-rw-r--r--unotools/inc/unotools/textsearch.hxx196
-rw-r--r--unotools/inc/unotools/transliterationwrapper.hxx145
-rw-r--r--unotools/inc/unotools/ucbhelper.hxx88
-rw-r--r--unotools/inc/unotools/ucblockbytes.hxx222
-rw-r--r--unotools/inc/unotools/ucbstreamhelper.hxx83
-rw-r--r--unotools/inc/unotools/undoopt.hxx49
-rw-r--r--unotools/inc/unotools/unotoolsdllapi.h41
-rw-r--r--unotools/inc/unotools/unotunnelhelper.hxx196
-rw-r--r--unotools/inc/unotools/useroptions.hxx118
-rw-r--r--unotools/inc/unotools/useroptions_const.hxx56
-rw-r--r--unotools/inc/unotools/viewoptions.hxx353
-rw-r--r--unotools/inc/unotools/workingsetoptions.hxx156
-rw-r--r--unotools/inc/unotools/xmlaccelcfg.hxx109
86 files changed, 12810 insertions, 0 deletions
diff --git a/unotools/inc/unotools/accelcfg.hxx b/unotools/inc/unotools/accelcfg.hxx
new file mode 100644
index 000000000000..a1884d34fbc3
--- /dev/null
+++ b/unotools/inc/unotools/accelcfg.hxx
@@ -0,0 +1,85 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef INCLUDED_unotools_ACCELCFG_HXX
+#define INCLUDED_unotools_ACCELCFG_HXX
+
+#include <com/sun/star/awt/KeyEvent.hpp>
+#include <unotools/options.hxx>
+
+#include <rtl/ustring.hxx>
+#include <tools/stream.hxx>
+
+struct SvtAcceleratorConfigItem
+{
+ sal_uInt16 nCode;
+ sal_uInt16 nModifier;
+ ::rtl::OUString aCommand;
+};
+
+#include <list>
+typedef ::std::list < SvtAcceleratorConfigItem > SvtAcceleratorItemList;
+
+class SvStream;
+class KeyEvent;
+class String;
+class SvtAcceleratorConfig_Impl;
+
+class SvtAcceleratorConfiguration: public utl::detail::Options
+{
+ SvtAcceleratorConfig_Impl* pImp;
+
+private:
+
+public:
+ // get the global accelerators
+ SvtAcceleratorConfiguration();
+
+ // get special accelerators
+ static SvtAcceleratorConfiguration* CreateFromStream( SvStream& rStream );
+ static String GetStreamName();
+ static SvStream* GetDefaultStream( StreamMode );
+
+ virtual ~SvtAcceleratorConfiguration();
+
+ // save the configuration to a stream, f.e. into a document
+ bool Commit( SvStream& rStream );
+
+ // returns the configured URL for a KeyEvent
+ ::rtl::OUString GetCommand( const ::com::sun::star::awt::KeyEvent& rKeyEvent );
+
+ // returns the whole configuration
+ const SvtAcceleratorItemList& GetItems();
+
+ // sets a single configuration item
+ void SetCommand( const SvtAcceleratorConfigItem& rItem );
+
+ // sets several or all configuration items
+ // if bClear=FALSE, all items not in the sequence remain unchanged
+ void SetItems( const SvtAcceleratorItemList& rItems, bool bClear );
+};
+
+#endif
diff --git a/unotools/inc/unotools/accessiblerelationsethelper.hxx b/unotools/inc/unotools/accessiblerelationsethelper.hxx
new file mode 100644
index 000000000000..ba853381329f
--- /dev/null
+++ b/unotools/inc/unotools/accessiblerelationsethelper.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 _UTL_ACCESSIBLERELATIONSETHELPER_HXX_
+#define _UTL_ACCESSIBLERELATIONSETHELPER_HXX_
+
+#include "unotools/unotoolsdllapi.h"
+
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLESSTATESET_HPP_
+#include <com/sun/star/accessibility/XAccessibleRelationSet.hpp>
+#endif
+#include <com/sun/star/uno/Reference.hxx>
+#include <cppuhelper/weak.hxx>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <com/sun/star/lang/XServiceName.hpp>
+#include <vos/mutex.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <comphelper/servicehelper.hxx>
+
+class AccessibleRelationSetHelperImpl;
+
+//=========================================================================
+//= XAccessibleRelationSet helper classes
+//=========================================================================
+
+//... namespace utl .......................................................
+namespace utl
+{
+//.........................................................................
+
+/** @descr
+ This base class provides an implementation of the
+ <code>AccessibleRelationSet</code> service.
+*/
+class UNOTOOLS_DLLPUBLIC AccessibleRelationSetHelper
+ : public cppu::WeakImplHelper1<
+ ::com::sun::star::accessibility::XAccessibleRelationSet
+ >
+{
+public:
+ //===== internal ========================================================
+ AccessibleRelationSetHelper ();
+ AccessibleRelationSetHelper (const AccessibleRelationSetHelper& rHelper);
+protected:
+ virtual ~AccessibleRelationSetHelper (void);
+public:
+
+ //===== XAccessibleRelationSet ==========================================
+
+ /** Returns the number of relations in this relation set.
+
+ @return
+ Returns the number of relations or zero if there are none.
+ */
+ virtual sal_Int32 SAL_CALL getRelationCount( )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** Returns the relation of this relation set that is specified by
+ the given index.
+
+ @param nIndex
+ This index specifies the relatio to return.
+
+ @return
+ For a valid index, i.e. inside the range 0 to the number of
+ relations minus one, the returned value is the requested
+ relation. If the index is invalid then the returned relation
+ has the type INVALID.
+
+ */
+ virtual ::com::sun::star::accessibility::AccessibleRelation SAL_CALL
+ getRelation( sal_Int32 nIndex )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException);
+
+ /** Tests whether the relation set contains a relation matching the
+ specified key.
+
+ @param aRelationType
+ The type of relation to look for in this set of relations. This
+ has to be one of the constants of
+ <type>AccessibleRelationType</type>.
+
+ @return
+ Returns <TRUE/> if there is a (at least one) relation of the
+ given type and <FALSE/> if there is no such relation in the set.
+ */
+ virtual sal_Bool SAL_CALL containsRelation( sal_Int16 aRelationType )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** Retrieve and return the relation with the given relation type.
+
+ @param aRelationType
+ The type of the relation to return. This has to be one of the
+ constants of <type>AccessibleRelationType</type>.
+
+ @return
+ If a relation with the given type could be found than (a copy
+ of) this relation is returned. Otherwise a relation with the
+ type INVALID is returned.
+ */
+ virtual ::com::sun::star::accessibility::AccessibleRelation SAL_CALL
+ getRelationByType( sal_Int16 aRelationType )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ void AddRelation(
+ const ::com::sun::star::accessibility::AccessibleRelation& rRelation)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ //===== XTypeProvider ===================================================
+
+ /** Returns a sequence of all supported interfaces.
+ */
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> SAL_CALL
+ getTypes (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** Returns a implementation id.
+ */
+ virtual ::com::sun::star::uno::Sequence<sal_Int8> SAL_CALL
+ getImplementationId (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+protected:
+ /// Mutex guarding this object.
+ ::vos::OMutex maMutex;
+
+private:
+ /// The implementation of this helper interface.
+ AccessibleRelationSetHelperImpl* mpHelperImpl;
+};
+
+//.........................................................................
+}
+//... namespace utl .......................................................
+#endif
diff --git a/unotools/inc/unotools/accessiblestatesethelper.hxx b/unotools/inc/unotools/accessiblestatesethelper.hxx
new file mode 100644
index 000000000000..3847beeee146
--- /dev/null
+++ b/unotools/inc/unotools/accessiblestatesethelper.hxx
@@ -0,0 +1,183 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _UTL_ACCESSIBLESTATESETHELPER_HXX_
+#define _UTL_ACCESSIBLESTATESETHELPER_HXX_
+
+#include "unotools/unotoolsdllapi.h"
+
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLESSTATESET_HPP_
+#include <com/sun/star/accessibility/XAccessibleStateSet.hpp>
+#endif
+#include <com/sun/star/uno/Reference.hxx>
+#include <cppuhelper/weak.hxx>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <com/sun/star/lang/XServiceName.hpp>
+#include <vos/mutex.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <comphelper/servicehelper.hxx>
+
+class AccessibleStateSetHelperImpl;
+
+//=========================================================================
+//= XAccessibleStateSet helper classes
+//=========================================================================
+
+//... namespace utl .......................................................
+namespace utl
+{
+//.........................................................................
+
+/** @descr
+ This base class provides an implementation of the
+ <code>AccessibleStateSet</code> service.
+*/
+class UNOTOOLS_DLLPUBLIC AccessibleStateSetHelper
+ : public cppu::WeakImplHelper1<
+ ::com::sun::star::accessibility::XAccessibleStateSet
+ >
+{
+public:
+ //===== internal ========================================================
+
+ AccessibleStateSetHelper ();
+ /** constructs an object with some states initially set
+
+ <p>This ctor is compatible with
+ <method scope="comphelper">OAccessibleImplementationAccess::implGetForeignControlledStates</method></p>
+
+ @param _nInitialStates
+ is a bit mask. Every bit 2^n means that the state number n (as got from the
+ AccessibleStateType constants) should be set initially.
+ */
+ AccessibleStateSetHelper ( const sal_Int64 _nInitialStates );
+
+ AccessibleStateSetHelper ( const AccessibleStateSetHelper& rHelper );
+protected:
+ virtual ~AccessibleStateSetHelper (void);
+public:
+
+ //===== XAccessibleStateSet ==============================================
+
+ /** Checks whether the current state set is empty.
+
+ @return
+ Returns <TRUE/> if there is no state in this state set and
+ <FALSE/> if there is at least one state set in it.
+ */
+ virtual sal_Bool SAL_CALL isEmpty ()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** Checks if the given state is a member of the state set of this
+ object.
+
+ @param aState
+ The state for which to check membership. This has to be one of
+ the constants of <type>AccessibleStateType</type>.
+
+ @return
+ Returns <TRUE/> if the given state is a memeber of this object's
+ state set and <FALSE/> otherwise.
+ */
+ virtual sal_Bool SAL_CALL contains (sal_Int16 aState)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** Checks if all of the given states are in this object's state
+ set.
+
+ @param aStateSet
+ This sequence of states is interpreted as set and every of its
+ members, duplicates are ignored, is checked for membership in
+ this object's state set. Each state has to be one of the
+ constants of <type>AccessibleStateType</type>.
+
+ @return
+ Returns <TRUE/> if all states of the given state set are members
+ of this object's state set. <FALSE/> is returned if at least
+ one of the states in the given state is not a member of this
+ object's state set.
+ */
+ virtual sal_Bool SAL_CALL containsAll (
+ const ::com::sun::star::uno::Sequence<sal_Int16>& rStateSet)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** Returns a sequence of all states.
+ */
+ virtual com::sun::star::uno::Sequence<sal_Int16> SAL_CALL getStates()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** Adds a state to the set.
+ */
+ void AddState(sal_Int16 aState)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** Removes a state from the set if the set contains the state, otherwise nothing is done.
+ */
+ void RemoveState(sal_Int16 aState)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** Compares the set with the set given by rComparativeValue and puts the results
+ into rOldStates and rNewStates.
+
+ rOldStates contains after call all states which are in the own set and
+ not in the comparative set.
+
+ rNewStates contains after call all states which are in the comparative
+ set and not in the own set.
+ */
+ sal_Bool Compare(const AccessibleStateSetHelper& rComparativeValue,
+ AccessibleStateSetHelper& rOldStates,
+ AccessibleStateSetHelper& rNewStates)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ //===== XTypeProvider ===================================================
+
+ /** Returns a sequence of all supported interfaces.
+ */
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> SAL_CALL
+ getTypes (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** Returns a implementation id.
+ */
+ virtual ::com::sun::star::uno::Sequence<sal_Int8> SAL_CALL
+ getImplementationId (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+protected:
+ /// Mutex guarding this object.
+ ::vos::OMutex maMutex;
+
+private:
+ /// The implementation of this helper interface.
+ AccessibleStateSetHelperImpl* mpHelperImpl;
+};
+
+//.........................................................................
+}
+//... namespace utl .......................................................
+#endif
diff --git a/unotools/inc/unotools/atom.hxx b/unotools/inc/unotools/atom.hxx
new file mode 100644
index 000000000000..8576b31f6970
--- /dev/null
+++ b/unotools/inc/unotools/atom.hxx
@@ -0,0 +1,132 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _UTL_ATOM_HXX_
+#define _UTL_ATOM_HXX_
+
+#include "unotools/unotoolsdllapi.h"
+#include <rtl/ustring.hxx>
+#include <osl/mutex.hxx>
+#include <cppuhelper/implbase1.hxx>
+
+#include <hash_map>
+#ifndef __SGI_STL_LIST
+#include <list>
+#endif
+#include <com/sun/star/util/XAtomServer.hpp>
+
+#define INVALID_ATOM 0
+
+namespace utl {
+
+ struct AtomDescription
+ {
+ int atom;
+ ::rtl::OUString description;
+ };
+
+ class AtomProvider
+ {
+ int m_nAtoms;
+ ::std::hash_map< int, ::rtl::OUString, ::std::hash< int > > m_aStringMap;
+ ::std::hash_map< ::rtl::OUString, int, ::rtl::OUStringHash > m_aAtomMap;
+ public:
+ AtomProvider();
+ ~AtomProvider();
+
+ int getAtom( const ::rtl::OUString&, sal_Bool bCreate = sal_False );
+ int getLastAtom() const { return m_nAtoms-1; }
+ const ::rtl::OUString& getString( int ) const;
+
+ void getAll( ::std::list< AtomDescription >& atoms );
+
+ void getRecent( int atom, ::std::list< AtomDescription >& atoms );
+
+ void overrideAtom( int atom, const ::rtl::OUString& description );
+
+ sal_Bool hasAtom( int atom ) const;
+ };
+
+
+ class UNOTOOLS_DLLPUBLIC MultiAtomProvider
+ {
+ ::std::hash_map< int, AtomProvider*, ::std::hash< int > > m_aAtomLists;
+ public:
+ MultiAtomProvider();
+ ~MultiAtomProvider();
+
+ int getLastAtom( int atomClass ) const;
+
+ sal_Bool insertAtomClass( int atomClass );
+
+ int getAtom( int atomClass, const ::rtl::OUString& rString, sal_Bool bCreate = sal_False );
+
+ void getRecent( int atomClass, int atom, ::std::list< AtomDescription >& atoms );
+
+ const ::rtl::OUString& getString( int atomClass, int atom ) const;
+ void getClass( int atomClass, ::std::list< AtomDescription >& atoms ) const;
+
+ void overrideAtom( int atomClass, int atom, const ::rtl::OUString& description );
+ void overrideAtom( int atomClass, const ::com::sun::star::util::AtomDescription& newDescription )
+ { overrideAtom( atomClass, newDescription.atom, newDescription.description ); }
+ sal_Bool hasAtom( int atomClass, int atom ) const;
+ };
+
+ class AtomServer : public ::cppu::WeakAggImplHelper1< ::com::sun::star::util::XAtomServer >
+ {
+ private:
+ MultiAtomProvider m_aProvider;
+ ::osl::Mutex m_aMutex;
+ public:
+ AtomServer();
+ virtual ~AtomServer();
+
+ const ::rtl::OUString& getString( int atomClass, int atom ) const
+ { return m_aProvider.getString( atomClass, atom ); }
+
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::util::AtomDescription > SAL_CALL getClass( sal_Int32 atomClass ) throw();
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::util::AtomDescription > > SAL_CALL getClasses( const ::com::sun::star::uno::Sequence< sal_Int32 >& atomClasses ) throw();
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getAtomDescriptions( const ::com::sun::star::uno::Sequence< ::com::sun::star::util::AtomClassRequest >& atoms ) throw();
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::util::AtomDescription > SAL_CALL getRecentAtoms( sal_Int32 atomClass, sal_Int32 atom ) throw();
+ virtual sal_Int32 SAL_CALL getAtom( sal_Int32 atomClass, const ::rtl::OUString& description, sal_Bool create ) throw();
+ };
+
+ class AtomClient
+ {
+ private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XAtomServer > m_xServer;
+ MultiAtomProvider m_aProvider;
+ public:
+ AtomClient( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XAtomServer >& );
+ ~AtomClient();
+
+ void updateAtomClasses( const ::com::sun::star::uno::Sequence< sal_Int32 >& atomClasses );
+ int getAtom( int atomClass, const ::rtl::OUString& description, sal_Bool bCreate );
+ const ::rtl::OUString& getString( int atomClass, int atom );
+ };
+}
+
+#endif
diff --git a/unotools/inc/unotools/bootstrap.hxx b/unotools/inc/unotools/bootstrap.hxx
new file mode 100644
index 000000000000..bbb476fdaf9e
--- /dev/null
+++ b/unotools/inc/unotools/bootstrap.hxx
@@ -0,0 +1,138 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "unotools/unotoolsdllapi.h"
+
+#ifndef _UTL_BOOTSTRAP_HXX
+#define _UTL_BOOTSTRAP_HXX
+
+namespace rtl
+{
+ class OUString;
+}
+
+namespace utl
+{
+//-----------------------------------------------------------------------------
+ /** provides configuration information needed for application startup.
+ <p>This class handles the startup information for the office application.
+ It encapsulates knowledge of how to retriev such information and how
+ to diagnose failures to retriev required data.
+ </p>
+ */
+ class UNOTOOLS_DLLPUBLIC Bootstrap
+ {
+ // the static interface
+ public: // some common information items
+
+ /// retrieve the product key; defaults to executable name (without extension)
+ static rtl::OUString getProductKey();
+
+ /// retrieve the product key; uses the given default, if not found
+ static rtl::OUString getProductKey(rtl::OUString const& _sDefault);
+
+ /// retrieve the product source (MWS name)
+ static ::rtl::OUString getProductSource(rtl::OUString const& _sDefault);
+
+ /// retrieve the BUILDID information item; uses the given default, if not found
+ static rtl::OUString getBuildIdData(rtl::OUString const& _sDefault);
+
+ /// retrieve the ALLUSERS information item from setup.ini file; uses the given default, if not found
+ static rtl::OUString getAllUsersValue(rtl::OUString const& _sDefault);
+
+ /// reload cached data
+ static void reloadData();
+
+ public: // retrieve path information about the installatíon location
+ enum PathStatus
+ {
+ PATH_EXISTS, // Success: Found a path to an existing file or directory
+ PATH_VALID, // Found a valid path, but the file or directory does not exist
+ DATA_INVALID, // Retrieved a string for this path, that is not a valid file url or system path
+ DATA_MISSING, // Could not retrieve any data for this path
+ DATA_UNKNOWN // No attempt to retrieve data for this path was made
+ };
+
+ /// get a file URL to the common base installation [${insturl}]
+ static PathStatus locateBaseInstallation(rtl::OUString& _rURL);
+
+ /// get a file URL to the user installation [${userurl}]
+ static PathStatus locateUserInstallation(rtl::OUString& _rURL);
+
+ /// get a file URL to the shared data directory [default is ${insturl}/share]
+ static PathStatus locateSharedData(rtl::OUString& _rURL);
+
+ /// get a file URL to the user data directory [default is ${userurl}/user]
+ static PathStatus locateUserData(rtl::OUString& _rURL);
+
+ // the next two items are mainly supported for diagnostic purposes. both items may be unused
+ /// get a file URL to the bootstrap INI file used [e.g. ${insturl}/program/bootraprc]
+ static PathStatus locateBootstrapFile(rtl::OUString& _rURL);
+ /// get a file URL to the version locator INI file used [e.g. ${SYSUSERCONFIG}/sversion.ini]
+ static PathStatus locateVersionFile(rtl::OUString& _rURL);
+
+ public: // evaluate the validity of the installation
+ /// high-level status of bootstrap success
+ enum Status
+ {
+ DATA_OK, /// user-dir and share-dir do exist, product key found or can be defaulted to exe-name
+ MISSING_USER_INSTALL, /// ${userurl} does not exist; or version-file cannot be found or is invalid
+ INVALID_USER_INSTALL, /// can locate ${userurl}, but user-dir is missing
+ INVALID_BASE_INSTALL /// other failure: e.g. cannot locate share-dir; bootstraprc missing or invalid; no product key
+ };
+
+ /// error code for detailed diagnostics of bootstrap failures
+ enum FailureCode
+ {
+ NO_FAILURE, /// bootstrap was successful
+ MISSING_INSTALL_DIRECTORY, /// the shared installation directory could not be located
+ MISSING_BOOTSTRAP_FILE, /// the bootstrap INI file could not be found or read
+ MISSING_BOOTSTRAP_FILE_ENTRY, /// the bootstrap INI is missing a required entry
+ INVALID_BOOTSTRAP_FILE_ENTRY, /// the bootstrap INI contains invalid data
+ MISSING_VERSION_FILE, /// the version locator INI file could not be found or read
+ MISSING_VERSION_FILE_ENTRY, /// the version locator INI has no entry for this version
+ INVALID_VERSION_FILE_ENTRY, /// the version locator INI entry is not a valid directory URL
+ MISSING_USER_DIRECTORY, /// the user installation directory does not exist
+ INVALID_BOOTSTRAP_DATA /// some bootstrap data was invalid in unexpected ways
+ };
+
+ /// Evaluates the status of the installation and returns a diagnostic message corresponding to this status
+ static Status checkBootstrapStatus(rtl::OUString& _rDiagnosticMessage);
+
+ /** Evaluates the status of the installation and returns a diagnostic
+ message and error code corresponding to this status
+ */
+ static Status checkBootstrapStatus(rtl::OUString& _rDiagnosticMessage, FailureCode& _rErrCode);
+
+ public:
+ // singleton impl-class
+ class Impl;
+ static Impl const& data(); // the data related to the bootstrap.ini file
+ };
+//-----------------------------------------------------------------------------
+} // namespace utl
+
+#endif // _UTL_BOOTSTRAP_HXX
diff --git a/unotools/inc/unotools/cacheoptions.hxx b/unotools/inc/unotools/cacheoptions.hxx
new file mode 100644
index 000000000000..432a91e67070
--- /dev/null
+++ b/unotools/inc/unotools/cacheoptions.hxx
@@ -0,0 +1,173 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_unotools_CACHEOPTIONS_HXX
+#define INCLUDED_unotools_CACHEOPTIONS_HXX
+
+//_________________________________________________________________________________________________________________
+// includes
+//_________________________________________________________________________________________________________________
+
+#include "unotools/unotoolsdllapi.h"
+#include <sal/types.h>
+#include <osl/mutex.hxx>
+#include <rtl/ustring.hxx>
+
+//_________________________________________________________________________________________________________________
+// forward declarations
+//_________________________________________________________________________________________________________________
+
+/*-************************************************************************************************************//**
+ @short forward declaration to our private date container implementation
+ @descr We use these class as internal member to support small memory requirements.
+ You can create the container if it is neccessary. The class which use these mechanism
+ is faster and smaller then a complete implementation!
+*//*-*************************************************************************************************************/
+
+class SvtCacheOptions_Impl;
+
+//_________________________________________________________________________________________________________________
+// declarations
+//_________________________________________________________________________________________________________________
+
+/*-************************************************************************************************************//**
+ @short collect informations about startup features
+ @descr -
+
+ @implements -
+ @base -
+
+ @devstatus ready to use
+*//*-*************************************************************************************************************/
+
+class UNOTOOLS_DLLPUBLIC SvtCacheOptions
+{
+ //-------------------------------------------------------------------------------------------------------------
+ // public methods
+ //-------------------------------------------------------------------------------------------------------------
+
+ public:
+
+ //---------------------------------------------------------------------------------------------------------
+ // constructor / destructor
+ //---------------------------------------------------------------------------------------------------------
+
+ /*-****************************************************************************************************//**
+ @short standard constructor and destructor
+ @descr This will initialize an instance with default values.
+ We implement these class with a refcount mechanism! Every instance of this class increase it
+ at create and decrease it at delete time - but all instances use the same data container!
+ He is implemented as a static member ...
+
+ @seealso member m_nRefCount
+ @seealso member m_pDataContainer
+
+ @param -
+ @return -
+
+ @onerror -
+ *//*-*****************************************************************************************************/
+
+ SvtCacheOptions();
+ ~SvtCacheOptions();
+
+ //---------------------------------------------------------------------------------------------------------
+ // interface
+ //---------------------------------------------------------------------------------------------------------
+
+ /*-****************************************************************************************************//**
+ @short interface methods to get and set value of config key "org.openoffice.Office.Common/_3D-Engine/..."
+ @descr These options describe internal states to enable/disable features of installed office.
+
+ GetWriterOLE_Objects()
+ SetWriterOLE_Objects() => set the number of Writer OLE objects to be cached
+
+ GetDrawingEngineOLE_Objects()
+ SetDrawingEngineOLE_Objects() => set the number of DrawingEngine OLE objects to be cached
+
+ GetGraphicManagerTotalCacheSize()
+ SetGraphicManagerTotalCacheSize() => set the maximum cache size used by GraphicManager to cache graphic objects
+
+ GetGraphicManagerObjectCacheSize()
+ SetGraphicManagerObjectCacheSize() => set the maximum cache size for one GraphicObject to be cached by GraphicManager
+
+ @seealso configuration package "org.openoffice.Office.Common/_3D-Engine"
+ *//*-*****************************************************************************************************/
+
+ sal_Int32 GetWriterOLE_Objects() const;
+ sal_Int32 GetDrawingEngineOLE_Objects() const;
+ sal_Int32 GetGraphicManagerTotalCacheSize() const;
+ sal_Int32 GetGraphicManagerObjectCacheSize() const;
+ sal_Int32 GetGraphicManagerObjectReleaseTime() const;
+
+ void SetWriterOLE_Objects( sal_Int32 nObjects );
+ void SetDrawingEngineOLE_Objects( sal_Int32 nObjects );
+ void SetGraphicManagerTotalCacheSize( sal_Int32 nTotalCacheSize );
+ void SetGraphicManagerObjectCacheSize( sal_Int32 nObjectCacheSize );
+ void SetGraphicManagerObjectReleaseTime( sal_Int32 nReleaseTimeSeconds );
+
+ //-------------------------------------------------------------------------------------------------------------
+ // private methods
+ //-------------------------------------------------------------------------------------------------------------
+
+ private:
+
+ /*-****************************************************************************************************//**
+ @short return a reference to a static mutex
+ @descr These class use his own static mutex to be threadsafe.
+ We create a static mutex only for one ime and use at different times.
+
+ @seealso -
+
+ @param -
+ @return A reference to a static mutex member.
+
+ @onerror -
+ *//*-*****************************************************************************************************/
+
+ UNOTOOLS_DLLPRIVATE static ::osl::Mutex& GetOwnStaticMutex();
+
+ //-------------------------------------------------------------------------------------------------------------
+ // private member
+ //-------------------------------------------------------------------------------------------------------------
+
+ private:
+
+ /*Attention
+
+ Don't initialize these static member in these header!
+ a) Double dfined symbols will be detected ...
+ b) and unresolved externals exist at linking time.
+ Do it in your source only.
+ */
+
+ static SvtCacheOptions_Impl* m_pDataContainer ; /// impl. data container as dynamic pointer for smaller memory requirements!
+ static sal_Int32 m_nRefCount ; /// internal ref count mechanism
+
+};
+
+#endif // #ifndef INCLUDED_unotools_CACHEOPTIONS_HXX
diff --git a/unotools/inc/unotools/calendarwrapper.hxx b/unotools/inc/unotools/calendarwrapper.hxx
new file mode 100644
index 000000000000..f5a8a06b1f6c
--- /dev/null
+++ b/unotools/inc/unotools/calendarwrapper.hxx
@@ -0,0 +1,133 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _UNOTOOLS_CALENDARWRAPPER_HXX
+#define _UNOTOOLS_CALENDARWRAPPER_HXX
+
+#include <tools/datetime.hxx>
+#include <tools/string.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/i18n/Calendar.hpp>
+#include <com/sun/star/lang/Locale.hpp>
+#include "unotools/unotoolsdllapi.h"
+
+namespace com { namespace sun { namespace star {
+ namespace lang {
+ class XMultiServiceFactory;
+ }
+}}}
+
+namespace com { namespace sun { namespace star {
+ namespace i18n {
+ class XExtendedCalendar;
+ }
+}}}
+
+
+class UNOTOOLS_DLLPUBLIC CalendarWrapper
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xSMgr;
+ ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XExtendedCalendar > xC;
+
+ DateTime aEpochStart; // 1Jan1970
+
+public:
+ CalendarWrapper(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & xSF
+ );
+ ~CalendarWrapper();
+
+
+ // wrapper implementations of XCalendar
+
+ void loadDefaultCalendar( const ::com::sun::star::lang::Locale& rLocale );
+ void loadCalendar( const ::rtl::OUString& rUniqueID, const ::com::sun::star::lang::Locale& rLocale );
+ ::com::sun::star::i18n::Calendar getLoadedCalendar() const;
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > getAllCalendars( const ::com::sun::star::lang::Locale& rLocale ) const;
+ ::rtl::OUString getUniqueID() const;
+ /// set UTC date/time
+ void setDateTime( double nTimeInDays );
+ /// get UTC date/time
+ double getDateTime() const;
+ /// convenience method to set local date/time
+ void setLocalDateTime( double nTimeInDays );
+ /// convenience method to get local date/time
+ double getLocalDateTime() const;
+
+ // wrapper implementations of XCalendar
+
+ void setValue( sal_Int16 nFieldIndex, sal_Int16 nValue );
+ sal_Bool isValid() const;
+ sal_Int16 getValue( sal_Int16 nFieldIndex ) const;
+ void addValue( sal_Int16 nFieldIndex, sal_Int32 nAmount );
+ sal_Int16 getFirstDayOfWeek() const;
+ void setFirstDayOfWeek( sal_Int16 nDay );
+ void setMinimumNumberOfDaysForFirstWeek( sal_Int16 nDays );
+ sal_Int16 getMinimumNumberOfDaysForFirstWeek() const;
+ sal_Int16 getNumberOfMonthsInYear() const;
+ sal_Int16 getNumberOfDaysInWeek() const;
+ ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::CalendarItem > getMonths() const;
+ ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::CalendarItem > getDays() const;
+ String getDisplayName( sal_Int16 nCalendarDisplayIndex, sal_Int16 nIdx, sal_Int16 nNameType ) const;
+
+ /** Convenience method to get timezone offset in milliseconds, taking both
+ fields ZONE_OFFSET and ZONE_OFFSET_SECOND_MILLIS into account. */
+ sal_Int32 getZoneOffsetInMillis() const;
+ /** Convenience method to get DST offset in milliseconds, taking both
+ fields DST_OFFSET and DST_OFFSET_SECOND_MILLIS into account. */
+ sal_Int32 getDSTOffsetInMillis() const;
+
+ // wrapper implementations of XExtendedCalendar
+
+ String getDisplayString( sal_Int32 nCalendarDisplayCode, sal_Int16 nNativeNumberMode ) const;
+
+
+ // convenience methods
+
+ /// get epoch start (should be 01Jan1970)
+ inline const DateTime& getEpochStart() const
+ { return aEpochStart; }
+
+ /// set a local (!) Gregorian DateTime
+ inline void setGregorianDateTime( const DateTime& rDateTime )
+ { setLocalDateTime( rDateTime - aEpochStart ); }
+
+ /// get the DateTime as a local (!) Gregorian DateTime
+ inline DateTime getGregorianDateTime() const
+ { return aEpochStart + getLocalDateTime(); }
+
+private:
+
+ /** get timezone or DST offset in milliseconds, fields are
+ CalendarFieldIndex ZONE_OFFSET and ZONE_OFFSET_SECOND_MILLIS
+ respectively DST_OFFSET and DST_OFFSET_SECOND_MILLIS.
+ */
+ sal_Int32 getCombinedOffsetInMillis( sal_Int16 nParentFieldIndex, sal_Int16 nChildFieldIndex ) const;
+};
+
+#endif
diff --git a/unotools/inc/unotools/charclass.hxx b/unotools/inc/unotools/charclass.hxx
new file mode 100644
index 000000000000..4469ed8ffc3d
--- /dev/null
+++ b/unotools/inc/unotools/charclass.hxx
@@ -0,0 +1,236 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "unotools/unotoolsdllapi.h"
+
+#ifndef _UNOTOOLS_CHARCLASS_HXX
+#define _UNOTOOLS_CHARCLASS_HXX
+
+#include <ctype.h> // isdigit(), isalpha()
+#include <tools/string.hxx>
+#include <tools/solar.h>
+#include <com/sun/star/i18n/KCharacterType.hpp>
+#include <com/sun/star/i18n/KParseTokens.hpp>
+#include <com/sun/star/i18n/KParseType.hpp>
+#include <com/sun/star/i18n/ParseResult.hpp>
+#include <com/sun/star/i18n/XCharacterClassification.hpp>
+#include <osl/mutex.hxx>
+
+class String;
+namespace com { namespace sun { namespace star {
+ namespace lang {
+ class XMultiServiceFactory;
+ }
+}}}
+
+const sal_Int32 nCharClassAlphaType =
+ ::com::sun::star::i18n::KCharacterType::UPPER |
+ ::com::sun::star::i18n::KCharacterType::LOWER |
+ ::com::sun::star::i18n::KCharacterType::TITLE_CASE;
+
+const sal_Int32 nCharClassAlphaTypeMask =
+ nCharClassAlphaType |
+ ::com::sun::star::i18n::KCharacterType::PRINTABLE |
+ ::com::sun::star::i18n::KCharacterType::BASE_FORM;
+
+const sal_Int32 nCharClassLetterType =
+ nCharClassAlphaType |
+ ::com::sun::star::i18n::KCharacterType::LETTER;
+
+const sal_Int32 nCharClassLetterTypeMask =
+ nCharClassAlphaTypeMask |
+ ::com::sun::star::i18n::KCharacterType::LETTER;
+
+const sal_Int32 nCharClassNumericType =
+ ::com::sun::star::i18n::KCharacterType::DIGIT;
+
+const sal_Int32 nCharClassNumericTypeMask =
+ nCharClassNumericType |
+ ::com::sun::star::i18n::KCharacterType::PRINTABLE |
+ ::com::sun::star::i18n::KCharacterType::BASE_FORM;
+
+
+class UNOTOOLS_DLLPUBLIC CharClass
+{
+ ::com::sun::star::lang::Locale aLocale;
+ ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XCharacterClassification > xCC;
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xSMgr;
+ mutable ::osl::Mutex aMutex;
+
+ // not implemented, prevent usage
+ CharClass( const CharClass& );
+ CharClass& operator=( const CharClass& );
+
+ // instantiate component somehow
+ void getComponentInstance();
+
+public:
+ /// Preferred ctor with service manager specified
+ CharClass(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & xSF,
+ const ::com::sun::star::lang::Locale& rLocale
+ );
+
+ /// Depricated ctor, tries to get a process service manager or to load the
+ /// library directly.
+ CharClass(
+ const ::com::sun::star::lang::Locale& rLocale
+ );
+
+ ~CharClass();
+
+ /// set a new Locale
+ void setLocale( const ::com::sun::star::lang::Locale& rLocale );
+
+ /// get current Locale
+ const ::com::sun::star::lang::Locale& getLocale() const;
+
+
+ /// isdigit() on ascii values
+ static inline sal_Bool isAsciiDigit( sal_Unicode c )
+ { return c < 128 ? sal_Bool(isdigit( (unsigned char) c ) != 0) : sal_False; }
+
+ /// isalpha() on ascii values
+ static inline sal_Bool isAsciiAlpha( sal_Unicode c )
+ { return c < 128 ? sal_Bool(isalpha( (unsigned char) c ) != 0) : sal_False; }
+
+ /// isalnum() on ascii values
+ static inline sal_Bool isAsciiAlphaNumeric( sal_Unicode c )
+ { return c < 128 ? sal_Bool(isalnum( (unsigned char) c ) != 0) : sal_False; }
+
+ /// isdigit() on ascii values of entire string
+ static sal_Bool isAsciiNumeric( const String& rStr );
+
+ /// isalpha() on ascii values of entire string
+ static sal_Bool isAsciiAlpha( const String& rStr );
+
+ /// isalnum() on ascii values of entire string
+ static sal_Bool isAsciiAlphaNumeric( const String& rStr );
+
+ /// whether type is pure alpha or not, e.g. return of getStringType
+ static inline sal_Bool isAlphaType( sal_Int32 nType )
+ {
+ return ((nType & nCharClassAlphaType) != 0) &&
+ ((nType & ~(nCharClassAlphaTypeMask)) == 0);
+ }
+
+ /// whether type is pure numeric or not, e.g. return of getStringType
+ static inline sal_Bool isNumericType( sal_Int32 nType )
+ {
+ return ((nType & nCharClassNumericType) != 0) &&
+ ((nType & ~(nCharClassNumericTypeMask)) == 0);
+ }
+
+ /// whether type is pure alphanumeric or not, e.g. return of getStringType
+ static inline sal_Bool isAlphaNumericType( sal_Int32 nType )
+ {
+ return ((nType & (nCharClassAlphaType |
+ nCharClassNumericType)) != 0) &&
+ ((nType & ~(nCharClassAlphaTypeMask |
+ nCharClassNumericTypeMask)) == 0);
+ }
+
+ /// whether type is pure letter or not, e.g. return of getStringType
+ static inline sal_Bool isLetterType( sal_Int32 nType )
+ {
+ return ((nType & nCharClassLetterType) != 0) &&
+ ((nType & ~(nCharClassLetterTypeMask)) == 0);
+ }
+
+ /// whether type is pure letternumeric or not, e.g. return of getStringType
+ static inline sal_Bool isLetterNumericType( sal_Int32 nType )
+ {
+ return ((nType & (nCharClassLetterType |
+ nCharClassNumericType)) != 0) &&
+ ((nType & ~(nCharClassLetterTypeMask |
+ nCharClassNumericTypeMask)) == 0);
+ }
+
+
+ // Wrapper implementations of class CharacterClassification
+
+ String toUpper( const String& rStr, xub_StrLen nPos, xub_StrLen nCount ) const;
+ String toLower( const String& rStr, xub_StrLen nPos, xub_StrLen nCount ) const;
+ String toTitle( const String& rStr, xub_StrLen nPos, xub_StrLen nCount ) const;
+
+ ::rtl::OUString toUpper_rtl( const ::rtl::OUString& rStr, sal_Int32 nPos, sal_Int32 nCount ) const;
+ ::rtl::OUString toLower_rtl( const ::rtl::OUString& rStr, sal_Int32 nPos, sal_Int32 nCount ) const;
+ // use the postfix because compilers could get confused by the both similar versions
+ // (me thinks they shouldn't, but in fact MSCV 6 does)
+
+ sal_Int16 getType( const String& rStr, xub_StrLen nPos ) const;
+ sal_Int16 getCharacterDirection( const String& rStr, xub_StrLen nPos ) const;
+ sal_Int16 getScript( const String& rStr, xub_StrLen nPos ) const;
+ sal_Int32 getCharacterType( const String& rStr, xub_StrLen nPos ) const;
+ sal_Int32 getStringType( const String& rStr, xub_StrLen nPos, xub_StrLen nCount ) const;
+
+ ::com::sun::star::i18n::ParseResult parseAnyToken(
+ const String& rStr,
+ sal_Int32 nPos,
+ sal_Int32 nStartCharFlags,
+ const String& userDefinedCharactersStart,
+ sal_Int32 nContCharFlags,
+ const String& userDefinedCharactersCont ) const;
+
+ ::com::sun::star::i18n::ParseResult parsePredefinedToken(
+ sal_Int32 nTokenType,
+ const String& rStr,
+ sal_Int32 nPos,
+ sal_Int32 nStartCharFlags,
+ const String& userDefinedCharactersStart,
+ sal_Int32 nContCharFlags,
+ const String& userDefinedCharactersCont ) const;
+
+
+ // Functionality of class International methods
+
+ sal_Bool isAlpha( const String& rStr, xub_StrLen nPos ) const;
+ sal_Bool isLetter( const String& rStr, xub_StrLen nPos ) const;
+ sal_Bool isDigit( const String& rStr, xub_StrLen nPos ) const;
+ sal_Bool isAlphaNumeric( const String& rStr, xub_StrLen nPos ) const;
+ sal_Bool isLetterNumeric( const String& rStr, xub_StrLen nPos ) const;
+ sal_Bool isAlpha( const String& rStr ) const;
+ sal_Bool isLetter( const String& rStr ) const;
+ sal_Bool isNumeric( const String& rStr ) const;
+ sal_Bool isAlphaNumeric( const String& rStr ) const;
+ sal_Bool isLetterNumeric( const String& rStr ) const;
+
+ void toUpper( String& rStr ) const
+ { rStr = toUpper( rStr, 0, rStr.Len() ); }
+ void toLower( String& rStr ) const
+ { rStr = toLower( rStr, 0, rStr.Len() ); }
+ inline String upper( const String& rStr ) const
+ { return toUpper( rStr, 0, rStr.Len() ); }
+ inline String lower( const String& rStr ) const
+ { return toLower( rStr, 0, rStr.Len() ); }
+
+ const ::rtl::OUString& toUpper_rtl( ::rtl::OUString& _rStr ) const { return _rStr = toUpper_rtl( _rStr, 0, _rStr.getLength() ); }
+ const ::rtl::OUString& toLower_rtl( ::rtl::OUString& _rStr ) const { return _rStr = toLower_rtl( _rStr, 0, _rStr.getLength() ); }
+};
+
+
+
+#endif // _UNOTOOLS_CHARCLASS_HXX
diff --git a/unotools/inc/unotools/cmdoptions.hxx b/unotools/inc/unotools/cmdoptions.hxx
new file mode 100644
index 000000000000..c2454d9582ee
--- /dev/null
+++ b/unotools/inc/unotools/cmdoptions.hxx
@@ -0,0 +1,255 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef INCLUDED_unotools_CMDOPTIONS_HXX
+#define INCLUDED_unotools_CMDOPTIONS_HXX
+
+//_________________________________________________________________________________________________________________
+// includes
+//_________________________________________________________________________________________________________________
+
+#include "unotools/unotoolsdllapi.h"
+#include <sal/types.h>
+#include <osl/mutex.hxx>
+#include <com/sun/star/uno/Sequence.h>
+#include <com/sun/star/frame/XFrame.hpp>
+#include <rtl/ustring.hxx>
+#include <unotools/options.hxx>
+
+//_________________________________________________________________________________________________________________
+// types, enums, ...
+//_________________________________________________________________________________________________________________
+
+/*-************************************************************************************************************//**
+ @descr The method GetList() returns a list of property values.
+ Use follow defines to seperate values by names.
+*//*-*************************************************************************************************************/
+#define CMDOPTIONS_PROPERTYNAME_URL ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "CommandURL" ))
+
+//_________________________________________________________________________________________________________________
+// forward declarations
+//_________________________________________________________________________________________________________________
+
+/*-************************************************************************************************************//**
+ @short forward declaration to our private date container implementation
+ @descr We use these class as internal member to support small memory requirements.
+ You can create the container if it is neccessary. The class which use these mechanism
+ is faster and smaller then a complete implementation!
+*//*-*************************************************************************************************************/
+
+class SvtCommandOptions_Impl;
+
+//_________________________________________________________________________________________________________________
+// declarations
+//_________________________________________________________________________________________________________________
+
+/*-************************************************************************************************************//**
+ @short collect informations about dynamic menus
+ @descr Make it possible to configure dynamic menu structures of menus like "new" or "wizard".
+
+ @implements -
+ @base -
+
+ @devstatus ready to use
+*//*-*************************************************************************************************************/
+
+class UNOTOOLS_DLLPUBLIC SvtCommandOptions: public utl::detail::Options
+{
+ friend class SvtCommandOptions_Impl;
+
+ //-------------------------------------------------------------------------------------------------------------
+ // public methods
+ //-------------------------------------------------------------------------------------------------------------
+
+ public:
+
+ enum CmdOption
+ {
+ CMDOPTION_DISABLED,
+ CMDOPTION_NONE
+ };
+
+ //---------------------------------------------------------------------------------------------------------
+ // constructor / destructor
+ //---------------------------------------------------------------------------------------------------------
+
+ /*-****************************************************************************************************//**
+ @short standard constructor and destructor
+ @descr This will initialize an instance with default values.
+ We implement these class with a refcount mechanism! Every instance of this class increase it
+ at create and decrease it at delete time - but all instances use the same data container!
+ He is implemented as a static member ...
+
+ @seealso member m_nRefCount
+ @seealso member m_pDataContainer
+
+ @param -
+ @return -
+
+ @onerror -
+ *//*-*****************************************************************************************************/
+
+ SvtCommandOptions();
+ virtual ~SvtCommandOptions();
+
+ //---------------------------------------------------------------------------------------------------------
+ // interface
+ //---------------------------------------------------------------------------------------------------------
+
+ /*-****************************************************************************************************//**
+ @short clear complete sepcified list
+ @descr Call this methods to clear the whole list.
+ To fill it again use AppendItem().
+
+ @seealso -
+
+ @param "eMenu" select right menu to clear.
+ @return -
+
+ @onerror -
+ *//*-*****************************************************************************************************/
+
+ void Clear( CmdOption eOption );
+
+ /*-****************************************************************************************************//**
+ @short return complete specified list
+ @descr Call it to get all entries of an dynamic menu.
+ We return a list of all nodes with his names and properties.
+
+ @seealso -
+
+ @param "eOption" select the list to retrieve.
+ @return A list of command strings is returned.
+
+ @onerror We return an empty list.
+ *//*-*****************************************************************************************************/
+
+ sal_Bool HasEntries( CmdOption eOption ) const;
+
+ /*-****************************************************************************************************//**
+ @short Lookup if a command URL is inside a given list
+ @descr Lookup if a command URL is inside a given lst
+
+ @seealso -
+
+ @param "eOption" select right command list
+ @param "aCommandURL" a command URL that is used for the look up
+ @return "sal_True" if the command is inside the list otherwise "sal_False"
+
+ @onerror -
+ *//*-*****************************************************************************************************/
+
+ sal_Bool Lookup( CmdOption eOption, const ::rtl::OUString& aCommandURL ) const;
+
+ /*-****************************************************************************************************//**
+ @short return complete specified list
+ @descr Call it to get all entries of an dynamic menu.
+ We return a list of all nodes with his names and properties.
+
+ @seealso -
+
+ @param "eOption" select the list to retrieve.
+ @return A list of command strings is returned.
+
+ @onerror We return an empty list.
+ *//*-*****************************************************************************************************/
+
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > GetList( CmdOption eOption ) const;
+
+ /*-****************************************************************************************************//**
+ @short adds a new command to specified options list
+ @descr You can add a command to specified options list!
+
+ @seealso method Clear()
+
+ @param "eOption" specifies the command list
+ @param "sURL" URL for dispatch
+ @return -
+
+ @onerror -
+ *//*-*****************************************************************************************************/
+
+ void AddCommand( CmdOption eOption, const ::rtl::OUString& sURL );
+
+ /*-****************************************************************************************************//**
+ @short register an office frame, which must update its dispatches if
+ the underlying configuration was changed.
+
+ @descr To avoid using of "dead" frame objects or implementing
+ deregistration mechanism too, we use weak references to
+ the given frames.
+
+ @param "xFrame" points to the frame, which wish to be
+ notified, if configuration was changed.
+ @return -
+
+ @onerror -
+ *//*-*****************************************************************************************************/
+
+ void EstablisFrameCallback(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame);
+
+ //-------------------------------------------------------------------------------------------------------------
+ // private methods
+ //-------------------------------------------------------------------------------------------------------------
+
+ private:
+
+ /*-****************************************************************************************************//**
+ @short return a reference to a static mutex
+ @descr These class is partially threadsafe (for de-/initialization only).
+ All access methods are'nt safe!
+ We create a static mutex only for one ime and use at different times.
+
+ @seealso -
+
+ @param -
+ @return A reference to a static mutex member.
+
+ @onerror -
+ *//*-*****************************************************************************************************/
+
+ UNOTOOLS_DLLPRIVATE static ::osl::Mutex& GetOwnStaticMutex();
+
+ //-------------------------------------------------------------------------------------------------------------
+ // private member
+ //-------------------------------------------------------------------------------------------------------------
+
+ private:
+
+ /*Attention
+
+ Don't initialize these static member in these header!
+ a) Double dfined symbols will be detected ...
+ b) and unresolved externals exist at linking time.
+ Do it in your source only.
+ */
+
+ static SvtCommandOptions_Impl* m_pDataContainer ; /// impl. data container as dynamic pointer for smaller memory requirements!
+ static sal_Int32 m_nRefCount ; /// internal ref count mechanism
+
+}; // class SvtCmdOptions
+
+#endif // #ifndef INCLUDED_unotools_CMDOPTIONS_HXX
diff --git a/unotools/inc/unotools/collatorwrapper.hxx b/unotools/inc/unotools/collatorwrapper.hxx
new file mode 100644
index 000000000000..e4f2a3443f1d
--- /dev/null
+++ b/unotools/inc/unotools/collatorwrapper.hxx
@@ -0,0 +1,97 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "unotools/unotoolsdllapi.h"
+
+#ifndef _UNOTOOLS_COLLATORWRAPPER_HXX
+#define _UNOTOOLS_COLLATORWRAPPER_HXX
+
+#ifndef _COM_SUN_STAR_UTIL_XCOLLATOR_HPP_
+#include <com/sun/star/i18n/XCollator.hpp>
+#endif
+
+namespace com { namespace sun { namespace star { namespace lang {
+ class XMultiServiceFactory;
+}}}}
+
+class UNOTOOLS_DLLPUBLIC CollatorWrapper
+{
+ private:
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory
+ > mxServiceFactory;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::i18n::XCollator
+ > mxInternationalCollator;
+
+ public:
+
+ CollatorWrapper (
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory > &xServiceFactoryIn);
+
+ ~CollatorWrapper();
+
+ sal_Int32
+ compareSubstring (
+ const ::rtl::OUString& s1, sal_Int32 off1, sal_Int32 len1,
+ const ::rtl::OUString& s2, sal_Int32 off2, sal_Int32 len2) const;
+
+ sal_Int32
+ compareString (
+ const ::rtl::OUString& s1, const ::rtl::OUString& s2) const;
+
+ ::com::sun::star::uno::Sequence< ::rtl::OUString >
+ listCollatorAlgorithms (
+ const ::com::sun::star::lang::Locale& rLocale) const;
+
+ ::com::sun::star::uno::Sequence< sal_Int32 >
+ listCollatorOptions (
+ const ::rtl::OUString& rAlgorithm) const;
+
+ sal_Int32
+ loadDefaultCollator (
+ const ::com::sun::star::lang::Locale& rLocale, sal_Int32 nOption);
+
+ sal_Int32
+ loadCollatorAlgorithm (
+ const ::rtl::OUString& rAlgorithm,
+ const ::com::sun::star::lang::Locale& rLocale, sal_Int32 nOption);
+
+ void
+ loadCollatorAlgorithmWithEndUserOption (
+ const ::rtl::OUString& rAlgorithm,
+ const ::com::sun::star::lang::Locale& rLocale,
+ const ::com::sun::star::uno::Sequence< sal_Int32 >& rOption);
+
+ protected:
+
+ CollatorWrapper();
+};
+
+#endif /* _UNOTOOLS_COLLATORWRAPPER_HXX */
diff --git a/unotools/inc/unotools/compatibility.hxx b/unotools/inc/unotools/compatibility.hxx
new file mode 100644
index 000000000000..eb01e43f3ba0
--- /dev/null
+++ b/unotools/inc/unotools/compatibility.hxx
@@ -0,0 +1,253 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef INCLUDED_unotools_COMPATIBILITY_HXX
+#define INCLUDED_unotools_COMPATIBILITY_HXX
+
+//_________________________________________________________________________________________________________________
+// includes
+//_________________________________________________________________________________________________________________
+
+#include "unotools/unotoolsdllapi.h"
+#include <sal/types.h>
+#include <osl/mutex.hxx>
+#include <com/sun/star/uno/Sequence.h>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <unotools/options.hxx>
+
+//_________________________________________________________________________________________________________________
+// types, enums, ...
+//_________________________________________________________________________________________________________________
+
+enum CompatibilityOptions
+{
+ COPT_USE_PRINTERDEVICE = 0,
+ COPT_ADD_SPACING,
+ COPT_ADD_SPACING_AT_PAGES,
+ COPT_USE_OUR_TABSTOPS,
+ COPT_NO_EXTLEADING,
+ COPT_USE_LINESPACING,
+ COPT_ADD_TABLESPACING,
+ COPT_USE_OBJECTPOSITIONING,
+ COPT_USE_OUR_TEXTWRAPPING,
+ COPT_CONSIDER_WRAPPINGSTYLE,
+ COPT_EXPAND_WORDSPACE
+};
+
+/*-************************************************************************************************************//**
+ @descr The method GetList() returns a list of property values.
+ Use follow defines to seperate values by names.
+*//*-*************************************************************************************************************/
+#define COMPATIBILITY_PROPERTYNAME_NAME OUString( RTL_CONSTASCII_USTRINGPARAM( "Name" ) )
+#define COMPATIBILITY_PROPERTYNAME_MODULE OUString( RTL_CONSTASCII_USTRINGPARAM( "Module" ) )
+#define COMPATIBILITY_PROPERTYNAME_USEPRTMETRICS OUString( RTL_CONSTASCII_USTRINGPARAM( "UsePrinterMetrics" ) )
+#define COMPATIBILITY_PROPERTYNAME_ADDSPACING OUString( RTL_CONSTASCII_USTRINGPARAM( "AddSpacing" ) )
+#define COMPATIBILITY_PROPERTYNAME_ADDSPACINGATPAGES OUString( RTL_CONSTASCII_USTRINGPARAM( "AddSpacingAtPages" ) )
+#define COMPATIBILITY_PROPERTYNAME_USEOURTABSTOPS OUString( RTL_CONSTASCII_USTRINGPARAM( "UseOurTabStopFormat" ) )
+#define COMPATIBILITY_PROPERTYNAME_NOEXTLEADING OUString( RTL_CONSTASCII_USTRINGPARAM( "NoExternalLeading" ) )
+#define COMPATIBILITY_PROPERTYNAME_USELINESPACING OUString( RTL_CONSTASCII_USTRINGPARAM( "UseLineSpacing" ) )
+#define COMPATIBILITY_PROPERTYNAME_ADDTABLESPACING OUString( RTL_CONSTASCII_USTRINGPARAM( "AddTableSpacing" ) )
+#define COMPATIBILITY_PROPERTYNAME_USEOBJECTPOSITIONING OUString( RTL_CONSTASCII_USTRINGPARAM( "UseObjectPositioning" ) )
+#define COMPATIBILITY_PROPERTYNAME_USEOURTEXTWRAPPING OUString( RTL_CONSTASCII_USTRINGPARAM( "UseOurTextWrapping" ) )
+#define COMPATIBILITY_PROPERTYNAME_CONSIDERWRAPPINGSTYLE OUString( RTL_CONSTASCII_USTRINGPARAM( "ConsiderWrappingStyle" ) )
+#define COMPATIBILITY_PROPERTYNAME_EXPANDWORDSPACE OUString( RTL_CONSTASCII_USTRINGPARAM( "ExpandWordSpace" ) )
+
+#define COMPATIBILITY_DEFAULT_NAME OUString( RTL_CONSTASCII_USTRINGPARAM( "_default" ) )
+
+//_________________________________________________________________________________________________________________
+// forward declarations
+//_________________________________________________________________________________________________________________
+
+/*-************************************************************************************************************//**
+ @short forward declaration to our private date container implementation
+ @descr We use these class as internal member to support small memory requirements.
+ You can create the container if it is neccessary. The class which use these mechanism
+ is faster and smaller then a complete implementation!
+*//*-*************************************************************************************************************/
+
+class SvtCompatibilityOptions_Impl;
+
+//_________________________________________________________________________________________________________________
+// declarations
+//_________________________________________________________________________________________________________________
+
+/*-************************************************************************************************************//**
+ @short collect informations about dynamic menus
+ @descr Make it possible to configure dynamic menu structures of menus like "new" or "wizard".
+
+ @implements -
+ @base -
+
+ @devstatus ready to use
+*//*-*************************************************************************************************************/
+
+class UNOTOOLS_DLLPUBLIC SvtCompatibilityOptions: public utl::detail::Options
+{
+ //-------------------------------------------------------------------------------------------------------------
+ // public methods
+ //-------------------------------------------------------------------------------------------------------------
+
+ public:
+
+ //---------------------------------------------------------------------------------------------------------
+ // constructor / destructor
+ //---------------------------------------------------------------------------------------------------------
+
+ /*-****************************************************************************************************//**
+ @short standard constructor and destructor
+ @descr This will initialize an instance with default values.
+ We implement these class with a refcount mechanism! Every instance of this class increase it
+ at create and decrease it at delete time - but all instances use the same data container!
+ He is implemented as a static member ...
+
+ @seealso member m_nRefCount
+ @seealso member m_pDataContainer
+
+ @param -
+ @return -
+
+ @onerror -
+ *//*-*****************************************************************************************************/
+
+ SvtCompatibilityOptions();
+ virtual ~SvtCompatibilityOptions();
+
+ //---------------------------------------------------------------------------------------------------------
+ // interface
+ //---------------------------------------------------------------------------------------------------------
+
+ /*-****************************************************************************************************//**
+ @short clear complete specified list
+ @descr Call this methods to clear the whole list.
+
+ @seealso -
+
+ @param -
+ @return -
+
+ @onerror -
+ *//*-*****************************************************************************************************/
+
+ void Clear();
+
+ /*-****************************************************************************************************//**
+ @short return complete specified list
+ @descr Call it to get all entries of compatibility options.
+ We return a list of all nodes with its names and properties.
+
+ @seealso -
+
+ @param -
+ @return A list of compatibility options is returned.
+
+ @onerror We return an empty list.
+ *//*-*****************************************************************************************************/
+
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > > GetList() const;
+
+ /*-****************************************************************************************************//**
+ @short append a new item
+ @descr
+
+ @seealso method Clear()
+
+ @param "sName" Name
+ @param "sModule" Module
+
+ @return -
+
+ @onerror -
+ *//*-*****************************************************************************************************/
+
+ void AppendItem( const ::rtl::OUString& sName,
+ const ::rtl::OUString& sModule,
+ bool bUsePrtMetrics,
+ bool bAddSpacing,
+ bool bAddSpacingAtPages,
+ bool bUseOurTabStops,
+ bool bNoExtLeading,
+ bool bUseLineSpacing,
+ bool bAddTableSpacing,
+ bool bUseObjectPositioning,
+ bool bUseOurTextWrapping,
+ bool bConsiderWrappingStyle,
+ bool bExpandWordSpace );
+
+ bool IsUsePrtDevice() const;
+ bool IsAddSpacing() const;
+ bool IsAddSpacingAtPages() const;
+ bool IsUseOurTabStops() const;
+ bool IsNoExtLeading() const;
+ bool IsUseLineSpacing() const;
+ bool IsAddTableSpacing() const;
+ bool IsUseObjectPositioning() const;
+ bool IsUseOurTextWrapping() const;
+ bool IsConsiderWrappingStyle() const;
+ bool IsExpandWordSpace() const;
+
+ //-------------------------------------------------------------------------------------------------------------
+ // private methods
+ //-------------------------------------------------------------------------------------------------------------
+
+ private:
+
+ /*-****************************************************************************************************//**
+ @short return a reference to a static mutex
+ @descr These class is partially threadsafe (for de-/initialization only).
+ All access methods are'nt safe!
+ We create a static mutex only for one ime and use at different times.
+
+ @seealso -
+
+ @param -
+ @return A reference to a static mutex member.
+
+ @onerror -
+ *//*-*****************************************************************************************************/
+
+ UNOTOOLS_DLLPRIVATE static ::osl::Mutex& GetOwnStaticMutex();
+
+ //-------------------------------------------------------------------------------------------------------------
+ // private member
+ //-------------------------------------------------------------------------------------------------------------
+
+ private:
+
+ /*Attention
+
+ Don't initialize these static member in these header!
+ a) Double dfined symbols will be detected ...
+ b) and unresolved externals exist at linking time.
+ Do it in your source only.
+ */
+
+ static SvtCompatibilityOptions_Impl* m_pDataContainer; /// impl. data container as dynamic pointer for smaller memory requirements!
+ static sal_Int32 m_nRefCount ; /// internal ref count mechanism
+
+}; // class SvtCompatibilityOptions
+
+#endif // #ifndef INCLUDED_unotools_COMPATIBILITY_HXX
+
diff --git a/unotools/inc/unotools/componentresmodule.hxx b/unotools/inc/unotools/componentresmodule.hxx
new file mode 100644
index 000000000000..0fe4e126ea74
--- /dev/null
+++ b/unotools/inc/unotools/componentresmodule.hxx
@@ -0,0 +1,203 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef UNOTOOLS_INC_UNOTOOLS_COMPONENTRESMODULE_HXX
+#define UNOTOOLS_INC_UNOTOOLS_COMPONENTRESMODULE_HXX
+
+#include <comphelper/componentmodule.hxx>
+#include <unotools/unotoolsdllapi.h>
+
+/** === begin UNO includes === **/
+/** === end UNO includes === **/
+#include <tools/resid.hxx>
+
+#include <memory>
+
+class ResMgr;
+
+//........................................................................
+namespace utl
+{
+//........................................................................
+
+ class OComponentResModuleImpl;
+
+ //====================================================================
+ //= OComponentResourceModule
+ //====================================================================
+ /** extends the <type scope="comphelper">OModule</type> implementation with
+ simply resource access
+ */
+ class UNOTOOLS_DLLPUBLIC OComponentResourceModule : public ::comphelper::OModule
+ {
+ private:
+ typedef ::comphelper::OModule BaseClass;
+
+ private:
+ ::std::auto_ptr< OComponentResModuleImpl > m_pImpl;
+
+ public:
+ OComponentResourceModule( const ::rtl::OString& _rResFilePrefix );
+ ~OComponentResourceModule();
+
+ /// get the vcl res manager of the module
+ ResMgr* getResManager();
+
+ protected:
+ // OModule overridables
+ virtual void onFirstClient();
+ virtual void onLastClient();
+ };
+
+ //=========================================================================
+ //= ModuleRes
+ //=========================================================================
+ /** specialized ResId, using the ressource manager provided by a given <type>OModule</type>
+ */
+ class UNOTOOLS_DLLPUBLIC ModuleRes : public ::ResId
+ {
+ public:
+ ModuleRes( USHORT _nId, OComponentResourceModule& _rModule ) : ResId( _nId, *_rModule.getResManager() ) { }
+ };
+
+ //====================================================================
+ //= defining a concrete module
+ //====================================================================
+#define DEFINE_MODULE( ModuleClass, ClientClass, ResClass ) \
+ /* -------------------------------------------------------------------- */ \
+ class ModuleClass : public ::utl::OComponentResourceModule \
+ { \
+ friend struct CreateModuleClass; \
+ typedef ::utl::OComponentResourceModule BaseClass; \
+ \
+ public: \
+ static ModuleClass& getInstance(); \
+ \
+ private: \
+ ModuleClass(); \
+ }; \
+ \
+ /* -------------------------------------------------------------------- */ \
+ class ClientClass : public ::comphelper::OModuleClient \
+ { \
+ private: \
+ typedef ::comphelper::OModuleClient BaseClass; \
+ \
+ public: \
+ ClientClass() : BaseClass( ModuleClass::getInstance() ) \
+ { \
+ } \
+ }; \
+ \
+ /* -------------------------------------------------------------------- */ \
+ class ResClass : public ::utl::ModuleRes \
+ { \
+ private: \
+ typedef ::utl::ModuleRes BaseClass; \
+ \
+ public: \
+ ResClass( USHORT _nId ) : BaseClass( _nId, ModuleClass::getInstance() ) \
+ { \
+ } \
+ }; \
+ \
+ /* -------------------------------------------------------------------- */ \
+ template < class TYPE > \
+ class OAutoRegistration : public ::comphelper::OAutoRegistration< TYPE > \
+ { \
+ private: \
+ typedef ::comphelper::OAutoRegistration< TYPE > BaseClass; \
+ \
+ public: \
+ OAutoRegistration() : BaseClass( ModuleClass::getInstance() ) \
+ { \
+ } \
+ }; \
+ \
+ /* -------------------------------------------------------------------- */ \
+ template < class TYPE > \
+ class OSingletonRegistration : public ::comphelper::OSingletonRegistration< TYPE > \
+ { \
+ private: \
+ typedef ::comphelper::OSingletonRegistration< TYPE > BaseClass; \
+ \
+ public: \
+ OSingletonRegistration() : BaseClass( ModuleClass::getInstance() ) \
+ { \
+ } \
+ }; \
+ \
+ /* -------------------------------------------------------------------- */ \
+ template < class TYPE > \
+ class OLegacySingletonRegistration : public ::comphelper::OLegacySingletonRegistration< TYPE > \
+ { \
+ private: \
+ typedef ::comphelper::OLegacySingletonRegistration< TYPE > BaseClass; \
+ \
+ public: \
+ OLegacySingletonRegistration() : BaseClass( ModuleClass::getInstance() ) \
+ { \
+ } \
+ };
+
+
+ //====================================================================
+ //= implementing a concrete module
+ //====================================================================
+#define IMPLEMENT_MODULE( ModuleClass, resprefix ) \
+ struct CreateModuleClass \
+ { \
+ ModuleClass* operator()() \
+ { \
+ static ModuleClass* pModule = new ModuleClass; \
+ return pModule; \
+ /* yes, in theory, this is a resource leak, since the ModuleClass \
+ will never be cleaned up. However, using a non-heap instance of ModuleClass \
+ would not work: It would be cleaned up when the module is unloaded. \
+ This might happen (and is likely to happen) *after* the tools-library \
+ has been unloaded. However, the module's dtor is where we would delete \
+ our resource manager (in case not all our clients de-registered) - which \
+ would call into the already-unloaded tools-library. */ \
+ } \
+ }; \
+ \
+ ModuleClass::ModuleClass() \
+ :BaseClass( ::rtl::OString( resprefix ) ) \
+ { \
+ } \
+ \
+ ModuleClass& ModuleClass::getInstance() \
+ { \
+ return *rtl_Instance< ModuleClass, CreateModuleClass, ::osl::MutexGuard, ::osl::GetGlobalMutex >:: \
+ create( CreateModuleClass(), ::osl::GetGlobalMutex() ); \
+ } \
+
+//........................................................................
+} // namespace utl
+//........................................................................
+
+#endif // UNOTOOLS_INC_UNOTOOLS_COMPONENTRESMODULE_HXX
+
diff --git a/unotools/inc/unotools/configitem.hxx b/unotools/inc/unotools/configitem.hxx
new file mode 100644
index 000000000000..d1477cba1b74
--- /dev/null
+++ b/unotools/inc/unotools/configitem.hxx
@@ -0,0 +1,212 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _UTL_CONFIGITEM_HXX_
+#define _UTL_CONFIGITEM_HXX_
+
+#include <sal/types.h>
+#include <rtl/ustring.hxx>
+#include <com/sun/star/uno/Sequence.h>
+#include <com/sun/star/uno/Reference.h>
+#include "unotools/unotoolsdllapi.h"
+#include "unotools/options.hxx"
+
+//-----------------------------------------------------------------------------
+namespace com{ namespace sun{ namespace star{
+ namespace uno{
+ class Any;
+ }
+ namespace beans{
+ struct PropertyValue;
+ }
+ namespace container{
+ class XHierarchicalNameAccess;
+ }
+ namespace util{
+ class XChangesListener;
+ }
+}}}
+//-----------------------------------------------------------------------------
+namespace utl
+{
+#define CONFIG_MODE_IMMEDIATE_UPDATE 0x00
+#define CONFIG_MODE_DELAYED_UPDATE 0x01
+#define CONFIG_MODE_ALL_LOCALES 0x02
+#define CONFIG_MODE_RELEASE_TREE 0x04
+#define CONFIG_MODE_IGNORE_ERRORS 0x08 // prevent assertions, if creation fails
+#define CONFIG_MODE_PROPAGATE_ERRORS 0x10 // throw exceptions, if creation fails
+
+ enum ConfigNameFormat
+ {
+ CONFIG_NAME_PLAINTEXT_NAME, // unescaped local node name, for user display etc.
+ CONFIG_NAME_LOCAL_NAME, // local node name, for use in XNameAccess etc. ("Item", "Q & A")
+ CONFIG_NAME_LOCAL_PATH, // one-level relative path, for use when building pathes etc. ("Item", "Typ['Q &amp; A']")
+ CONFIG_NAME_FULL_PATH, // full absolute path. ("/org.openoffice.Sample/Group/Item", "/org.openoffice.Sample/Set/Typ['Q &amp; A']")
+
+ CONFIG_NAME_DEFAULT = CONFIG_NAME_LOCAL_PATH // default format
+ };
+
+ class ConfigChangeListener_Impl;
+ class ConfigManager;
+ struct ConfigItem_Impl;
+
+ class UNOTOOLS_DLLPUBLIC ConfigItem : public ConfigurationBroadcaster
+ {
+ friend class ConfigChangeListener_Impl;
+ friend class ConfigManager;
+
+ const rtl::OUString sSubTree;
+ com::sun::star::uno::Reference< com::sun::star::container::XHierarchicalNameAccess>
+ m_xHierarchyAccess;
+ com::sun::star::uno::Reference< com::sun::star::util::XChangesListener >
+ xChangeLstnr;
+ ConfigItem_Impl* pImpl;
+
+ ConfigItem();//
+ void RemoveChangesListener();
+ void CallNotify(
+ const com::sun::star::uno::Sequence<rtl::OUString>& aPropertyNames);
+
+ //***********************************************************************************************************************
+ // In special mode ALL_LOCALES we must support reading/writing of localized cfg entries as Sequence< PropertyValue >.
+ // These methods are helper to convert given lists of names and Any-values.
+ // format: PropertyValue.Name = <locale as ISO string>
+ // PropertyValue.Value = <value; type depends from cfg entry!>
+ // e.g.
+ // LOCALIZED NODE
+ // "UIName"
+ // LOCALE VALUE
+ // "de" "Mein Name"
+ // "en-US" "my name"
+ void impl_packLocalizedProperties ( const com::sun::star::uno::Sequence< rtl::OUString >& lInNames ,
+ const com::sun::star::uno::Sequence< com::sun::star::uno::Any >& lInValues ,
+ com::sun::star::uno::Sequence< com::sun::star::uno::Any >& lOutValues );
+ void impl_unpackLocalizedProperties ( const com::sun::star::uno::Sequence< rtl::OUString >& lInNames ,
+ const com::sun::star::uno::Sequence< com::sun::star::uno::Any >& lInValues ,
+ com::sun::star::uno::Sequence< rtl::OUString >& lOutNames ,
+ com::sun::star::uno::Sequence< com::sun::star::uno::Any >& lOutValues );
+
+ com::sun::star::uno::Reference< com::sun::star::container::XHierarchicalNameAccess>
+ GetTree();
+
+ protected:
+ ConfigItem(const rtl::OUString rSubTree,
+ sal_Int16 nMode = CONFIG_MODE_DELAYED_UPDATE);
+ ConfigItem(utl::ConfigManager& rManager, const rtl::OUString rSubTree);
+
+ void SetModified (); // mark item as modified
+ void ClearModified(); // reset state after commit!
+
+ com::sun::star::uno::Sequence< com::sun::star::uno::Any>
+ GetProperties(const com::sun::star::uno::Sequence< rtl::OUString >& rNames);
+
+ com::sun::star::uno::Sequence< sal_Bool >
+ GetReadOnlyStates(const com::sun::star::uno::Sequence< rtl::OUString >& rNames);
+
+ sal_Bool PutProperties(
+ const com::sun::star::uno::Sequence< rtl::OUString >& rNames,
+ const com::sun::star::uno::Sequence< com::sun::star::uno::Any>& rValues);
+
+ /** enables notifications about changes on selected sub nodes/values
+
+ Before calling this method a second time for a possibly changed node/value set,
+ you must disable the current notifications by calling DisableNotification.
+
+ @see Notify
+ @see DisableNotification
+ */
+ sal_Bool EnableNotification(const com::sun::star::uno::Sequence< rtl::OUString >& rNames,
+ sal_Bool bEnableInternalNotification = sal_False);
+ /** disables notifications about changes on sub nodes/values, which previosly had
+ been enabled with EnableNotification
+ @see Notify
+ @see EnableNotification
+ */
+ void DisableNotification();
+ sal_Bool IsInternalNotification()const {return IsInValueChange();}
+
+ //returns all members of a node in a specific format
+ com::sun::star::uno::Sequence< rtl::OUString >
+ GetNodeNames(const rtl::OUString& rNode);
+ //returns all members of a node in a specific format
+ com::sun::star::uno::Sequence< rtl::OUString >
+ GetNodeNames(const rtl::OUString& rNode, ConfigNameFormat eFormat);
+ // remove all members of a set
+ sal_Bool ClearNodeSet(const rtl::OUString& rNode);
+ // remove selected members of a set
+ sal_Bool ClearNodeElements(const rtl::OUString& rNode,
+ com::sun::star::uno::Sequence< rtl::OUString >& rElements);
+ // change or add members to a set
+ sal_Bool SetSetProperties(const rtl::OUString& rNode, com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > rValues);
+ // remove, change or add members of a set
+ sal_Bool ReplaceSetProperties(const rtl::OUString& rNode, com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > rValues);
+ // add a new node without setting any properties
+ sal_Bool AddNode(const rtl::OUString& rNode, const rtl::OUString& rNewNode);
+
+ /** get a name for a new element of a set node
+ @param _rSetNode
+ relative path to the set node
+ @param _rBaseName
+ <ul><li><b>in</b>: the base to use when calculating a new name</li>
+ <li><b>out</b>: an unused element name</li>
+ </ul>
+ @return <TRUE/> if a free name could be generated
+ */
+ sal_Bool getUniqueSetElementName( const rtl::OUString& _rSetNode, rtl::OUString& _rBaseName);
+
+ public:
+ virtual ~ConfigItem();
+
+ /** is called from the ConfigManager before application ends of from the
+ PropertyChangeListener if the sub tree broadcasts changes. */
+ virtual void Notify( const com::sun::star::uno::Sequence<rtl::OUString>& aPropertyNames)=0;
+
+ /** is called from the ConfigManager if it is destroyed before the ConfigItem. */
+ void ReleaseConfigMgr();
+
+ /** enable locking of the XHierarchicalNameAccess if CONFIG_MODE_RELEASE_TREE is set to
+ prevent multiple calls ConfigManager::AcquireTree() from a single Commit() operation*/
+ void LockTree();
+ void UnlockTree();
+
+ const rtl::OUString& GetSubTreeName() const {return sSubTree;}
+
+ sal_Bool IsModified() const;
+
+ /** writes the changed values into the sub tree. Always called in the Dtor of the derived class. */
+ virtual void Commit()=0;
+
+ sal_Bool IsInValueChange() const;
+
+ sal_Int16 GetMode() const;
+
+ /** checks if the configuration manager used by this item is valid.
+ */
+ sal_Bool IsValidConfigMgr() const;
+ };
+}//namespace utl
+#endif //_UTL_CONFIGITEM_HXX_
diff --git a/unotools/inc/unotools/configmgr.hxx b/unotools/inc/unotools/configmgr.hxx
new file mode 100644
index 000000000000..82af190aab4f
--- /dev/null
+++ b/unotools/inc/unotools/configmgr.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 _UTL_CONFIGMGR_HXX_
+#define _UTL_CONFIGMGR_HXX_
+
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/Any.hxx>
+#include <rtl/ustring.hxx>
+#include "unotools/unotoolsdllapi.h"
+
+//-----------------------------------------------------------------------------
+namespace com{ namespace sun{ namespace star{
+ namespace lang{
+ class XMultiServiceFactory;
+ }
+ namespace container{
+ class XHierarchicalNameAccess;
+ }
+}}}
+
+//-----------------------------------------------------------------------------
+namespace utl
+{
+ struct ConfigMgr_Impl;
+ class ConfigItem;
+ class UNOTOOLS_DLLPUBLIC ConfigManager
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
+ xConfigurationProvider;
+ ConfigMgr_Impl* pMgrImpl;
+
+ static ConfigManager* pConfigManager;
+ static void getBasisAboutBoxProductVersion( rtl::OUString& rVersion );
+
+ public:
+ ConfigManager();
+ ConfigManager(com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > xConfigProvider);
+ ~ConfigManager();
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
+ GetConfigurationProvider();
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
+ GetLocalConfigurationProvider();
+
+ com::sun::star::uno::Reference< com::sun::star::container::XHierarchicalNameAccess>
+ AddConfigItem(utl::ConfigItem& rCfgItem);
+
+ void RegisterConfigItem(utl::ConfigItem& rCfgItem);
+ com::sun::star::uno::Reference< com::sun::star::container::XHierarchicalNameAccess>
+ AcquireTree(utl::ConfigItem& rCfgItem);
+
+
+ void RemoveConfigItem(utl::ConfigItem& rCfgItem);
+
+ void StoreConfigItems();
+
+ static ConfigManager* GetConfigManager();
+ static void RemoveConfigManager();
+ static rtl::OUString GetConfigBaseURL();
+
+ enum ConfigProperty
+ {
+ INSTALLPATH, // deprecated. don't use
+ LOCALE,
+ OFFICEINSTALL, // deprecated. don't use
+ USERINSTALLURL, // deprecated. don't use
+ OFFICEINSTALLURL, // deprecated. don't use
+ PRODUCTNAME,
+ PRODUCTVERSION,
+ PRODUCTEXTENSION,
+ DEFAULTCURRENCY,
+ PRODUCTXMLFILEFORMATNAME,
+ PRODUCTXMLFILEFORMATVERSION,
+ WRITERCOMPATIBILITYVERSIONOOO11,
+ OPENSOURCECONTEXT,
+ ABOUTBOXPRODUCTVERSION
+ };
+ //direct readonly access to some special configuration elements
+ static com::sun::star::uno::Any GetDirectConfigProperty(ConfigProperty eProp);
+
+ sal_Bool IsLocalConfigProvider();
+ com::sun::star::uno::Reference< com::sun::star::container::XHierarchicalNameAccess>
+ GetHierarchyAccess(const rtl::OUString& rFullPath);
+ com::sun::star::uno::Any GetLocalProperty(const rtl::OUString& rProperty);
+ void PutLocalProperty(const rtl::OUString& , const com::sun::star::uno::Any& rValue);
+
+ };
+}//namespace utl
+#endif //_UTL_CONFIGMGR_HXX_
diff --git a/unotools/inc/unotools/confignode.hxx b/unotools/inc/unotools/confignode.hxx
new file mode 100644
index 000000000000..8745508375a1
--- /dev/null
+++ b/unotools/inc/unotools/confignode.hxx
@@ -0,0 +1,340 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _UNOTOOLS_CONFIGNODE_HXX_
+#define _UNOTOOLS_CONFIGNODE_HXX_
+
+#include "unotools/unotoolsdllapi.h"
+#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/util/XChangesBatch.hpp>
+#include <unotools/eventlisteneradapter.hxx>
+
+//........................................................................
+namespace utl
+{
+//........................................................................
+
+ //========================================================================
+ //= OConfigurationNode
+ //========================================================================
+ class OConfigurationTreeRoot;
+ /** a small wrapper around a configuration node.<p/>
+ Nodes in the terminology used herein are <em>inner</em> nodes of a configuration
+ tree, which means <em>no leafs</em>.
+ */
+ class UNOTOOLS_DLLPUBLIC OConfigurationNode : public ::utl::OEventListenerAdapter
+ {
+ private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XHierarchicalNameAccess >
+ m_xHierarchyAccess; /// accessing children grandchildren (mandatory interface of our UNO object)
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >
+ m_xDirectAccess; /// accessing children (mandatory interface of our UNO object)
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace >
+ m_xReplaceAccess; /// replacing child values
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >
+ m_xContainerAccess; /// modifying set nodes (optional interface of our UNO object)
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
+ m_xProvider; /// the configuration provider which supplied the nodes of the hierarchy we're a part of
+ sal_Bool m_bEscapeNames; /// escape names before accessing children ?
+
+ ::rtl::OUString
+ m_sCompletePath;
+
+ OConfigurationNode insertNode(const ::rtl::OUString& _rName,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xNode) const throw();
+ protected:
+ /// constructs a node object with an interface representing a node
+ OConfigurationNode(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxNode,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxProvider);
+
+ public:
+ /// constructs an empty and invalid node object
+ OConfigurationNode() :m_bEscapeNames(sal_False) { }
+ /// copy ctor
+ OConfigurationNode(const OConfigurationNode& _rSource);
+
+ /// assigment
+ const OConfigurationNode& operator=(const OConfigurationNode& _rSource);
+
+ /// dtor
+ ~OConfigurationNode() {}
+
+ /// returns the local name of the node
+ ::rtl::OUString getLocalName() const;
+
+ /** open a sub node
+ @param _rPath access path of the to-be-opened sub node. May be a hierarchical path.
+ */
+ OConfigurationNode openNode(const ::rtl::OUString& _rPath) const throw();
+
+ OConfigurationNode openNode( const sal_Char* _pAsciiPath ) const
+ {
+ return openNode( ::rtl::OUString::createFromAscii( _pAsciiPath ) );
+ }
+
+ /** create a new child node
+
+ If the object represents a set node, this method may be used to create a new child. For non-set-nodes, the
+ method will fail.<br/>
+ Unless the respective operations on the pure configuration API, the to-be-created node immediately
+ becomes a part of it's hierarchy, no explicit insertion is necessary.
+ @param _rName name for the new child. Must be level-1-depth.
+ */
+ OConfigurationNode createNode(const ::rtl::OUString& _rName) const throw();
+
+ OConfigurationNode createNode( const sal_Char* _pAsciiName ) const
+ {
+ return createNode( ::rtl::OUString::createFromAscii( _pAsciiName ) );
+ }
+
+ /** appends a node under a new name
+
+ If the object represents a set node, this method may be used to create a new child. For non-set-nodes, the
+ method will fail.<br/>
+ Unless the respective operations on the pure configuration API, the to-be-created node immediately
+ becomes a part of it's hierarchy, no explicit insertion is necessary.
+ @param _rName name for the new child. Must be level-1-depth.
+ @param _aNewNode the node which should be appended
+ */
+ OConfigurationNode appendNode(const ::rtl::OUString& _rName,const OConfigurationNode& _aNewNode) const throw();
+
+ OConfigurationNode appendNode( const sal_Char* _pAsciiName, const OConfigurationNode& _aNewNode ) const
+ {
+ return appendNode( ::rtl::OUString::createFromAscii( _pAsciiName ), _aNewNode );
+ }
+
+ /** remove an existent child nod
+
+ If the object represents a set node, this method may be used to delete an existent child. For non-set-nodes,
+ the method will fail.
+ */
+ sal_Bool removeNode(const ::rtl::OUString& _rName) const throw();
+
+ sal_Bool removeNode( const sal_Char* _pAsciiName ) const
+ {
+ return removeNode( ::rtl::OUString::createFromAscii( _pAsciiName ) );
+ }
+
+ /** retrieves the content of a descendant
+
+ the returned value may contain anything from an interface (if <arg>_rPath</arg> refers to inner node of
+ the configuration tree) to any explicit value (e.g. string, integer) or even void.<br/>
+ Unfortunately, this implies that if a void value is returned, you won't have a clue if this means
+ "the path does not exist" (besides the assertion made :), or if the value is really void.
+ */
+ ::com::sun::star::uno::Any
+ getNodeValue(const ::rtl::OUString& _rPath) const throw();
+
+ ::com::sun::star::uno::Any
+ getNodeValue( const sal_Char* _pAsciiPath ) const
+ {
+ return getNodeValue( ::rtl::OUString::createFromAscii( _pAsciiPath ) );
+ }
+
+ /** write a node value<p/>
+ The value given is written into the node specified by the given relative path.<br/>
+ In opposite to <method>getNodeValue</method>, _rName must refer to a leaf in the configuration tree, not an inner
+ node.
+ @return sal_True if and only if the write was successfull.
+ */
+ sal_Bool setNodeValue(const ::rtl::OUString& _rPath, const ::com::sun::star::uno::Any& _rValue) const throw();
+
+ sal_Bool setNodeValue( const sal_Char* _pAsciiPath, const ::com::sun::star::uno::Any& _rValue ) const
+ {
+ return setNodeValue( ::rtl::OUString::createFromAscii( _pAsciiPath ), _rValue );
+ }
+
+ /// return the names of the existing children
+ ::com::sun::star::uno::Sequence< ::rtl::OUString >
+ getNodeNames() const throw();
+
+ /** enables or disables name escaping when accessing direct children<p/>
+ Escaping is disabled by default, usually you enable it for set nodes (e.g. with calling setEscape(isSetNode)).
+ Once escaping is enabled, you should not access indirect children (e.g. openNode("child/grandchild"), 'cause
+ escaping for such names may not be supported by the underlying API objects.
+ @see getEscape
+ */
+ void setEscape(sal_Bool _bEnable = sal_True);
+ /** get the flag specifying the current escape behaviour
+ @see setEscape
+ */
+ sal_Bool getEscape() const { return m_bEscapeNames; }
+
+ /** clone the object, creating a new hierarchy where the root represents the same node as the object
+ where this method is called does.<p/>
+ The new hierarchy does not share any updates with the one the object is a part of, i.e. any changes made
+ in the existing hierarchy are not visible to the newly created one until committed (and vice versa).
+ @param _rRoot out parameter. upon return, contains the object representing the root of the new hierarchy.
+ */
+ OConfigurationTreeRoot cloneAsRoot() const throw();
+
+ /// invalidate the object
+ virtual void clear() throw();
+
+ // -----------------------
+ // meta informations about the node
+
+ /// checks whether or not the object represents a set node.
+ sal_Bool isSetNode() const;
+
+ /// checks whether or not a direct child with a given name exists
+ sal_Bool hasByName(const ::rtl::OUString& _rName) const throw();
+ sal_Bool hasByName( const sal_Char* _pAsciiName ) const { return hasByName( ::rtl::OUString::createFromAscii( _pAsciiName ) ); }
+
+ /// checks whether or not a descendent (no matter if direct or indirect) with the given name exists
+ sal_Bool hasByHierarchicalName( const ::rtl::OUString& _rName ) const throw();
+ sal_Bool hasByHierarchicalName( const sal_Char* _pAsciiName ) const { return hasByHierarchicalName( ::rtl::OUString::createFromAscii( _pAsciiName ) ); }
+
+ /// check if the objects represents a valid configuration node
+ sal_Bool isValid() const { return m_xHierarchyAccess.is(); }
+
+ /// check whether the object is read-only of updatable
+ sal_Bool isReadonly() const { return !m_xReplaceAccess.is(); }
+
+ protected:
+ // OEventListenerAdapter
+ virtual void _disposing( const ::com::sun::star::lang::EventObject& _rSource );
+
+ protected:
+ enum NAMEORIGIN
+ {
+ NO_CONFIGURATION, /// the name came from a configuration node
+ NO_CALLER /// the name came from a client of this class
+ };
+ ::rtl::OUString normalizeName(const ::rtl::OUString& _rName, NAMEORIGIN _eOrigin) const;
+ };
+
+ //========================================================================
+ //= OConfigurationTreeRoot
+ //========================================================================
+ /** a specialized version of a OConfigurationNode, representing the root
+ of a configuration sub tree<p/>
+ Only this class is able to commit any changes made any any OConfigurationNode
+ objects.
+ */
+ class UNOTOOLS_DLLPUBLIC OConfigurationTreeRoot : public OConfigurationNode
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XChangesBatch >
+ m_xCommitter;
+ protected:
+ /** ctor<p/>
+ */
+ OConfigurationTreeRoot(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XChangesBatch >& _rxRootNode,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxProvider);
+
+ /** ctor for a readonly node
+ */
+ OConfigurationTreeRoot(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxRootNode,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxProvider);
+
+ public:
+ /// modes to used when creating a top-level node object
+ enum CREATION_MODE
+ {
+ CM_READONLY, /// open the node (i.e. sub tree) for read access only
+ CM_UPDATABLE, /// open the node (i.e. sub tree) for read and write access
+ CM_PREFER_UPDATABLE /// open the node (i.e. sub tree) for read and write access, if this fails, open it for read acces
+ };
+
+ public:
+ /** default ctor<p/>
+ The object constructed here is invalid (i.e. <method>isValid</method> will return sal_False).
+ */
+ OConfigurationTreeRoot() :OConfigurationNode() { }
+
+ /// copy ctor
+ OConfigurationTreeRoot(const OConfigurationTreeRoot& _rSource)
+ :OConfigurationNode(_rSource), m_xCommitter(_rSource.m_xCommitter) { }
+
+ /** open a new top-level configuration node
+
+ opens a new node which is the root if an own configuration sub tree. This is what "top level" means: The
+ node does not have a parent. It does not mean that the node represents a module tree (like org.openoffice.Office.Writer
+ or such).<br/>
+ In opposite to <method>createWithServiceFactory</method>, createWithProvider expects a configuration provider
+ to work with.
+
+ @param _rxConfProvider configuration provider to use when retrieving the node.
+ @param _rPath path to the node the object should represent
+ @param _nDepth depth for node retrieval
+ @param _eMode specifies which privileges should be applied when retrieving the node
+
+ @see createWithServiceFactory
+ */
+ static OConfigurationTreeRoot createWithProvider(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxConfProvider,
+ const ::rtl::OUString& _rPath,
+ sal_Int32 _nDepth = -1,
+ CREATION_MODE _eMode = CM_PREFER_UPDATABLE,
+ sal_Bool _bLazyWrite = sal_True
+ );
+
+ /** open a new top-level configuration node<p/>
+ opens a new node which is the root if an own configuration sub tree. This is what "top level" means: The
+ node does not have a parent. It does not mean that the node represents a module tree (like org.openoffice.Office.Writer
+ or such).<br/>
+ In opposite to <method>createWithProvider</method>, createWithProvider expects a service factory. This factory
+ is used to create a configuration provider, and this provider is used to retrieve the node
+ @see createWithProvider
+ @param _rxORB service factory to use to create the configuration provider.
+ @param _rPath path to the node the object should represent
+ @param _nDepth depth for node retrieval
+ @param _eMode specifies which privileges should be applied when retrieving the node
+ */
+ static OConfigurationTreeRoot createWithServiceFactory(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB,
+ const ::rtl::OUString& _rPath, sal_Int32 _nDepth = -1, CREATION_MODE _eMode = CM_PREFER_UPDATABLE, sal_Bool _bLazyWrite = sal_True);
+
+ /** tolerant version of the <member>createWithServiceFactory</member>
+
+ <p>No assertions are thrown in case of an failure to initialize the configuration service, but once
+ the configuration could be initialized, errors in the creation of the specific node (e.g. because the
+ given node path does not exist) are still asserted.</p>
+ */
+ static OConfigurationTreeRoot tryCreateWithServiceFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB,
+ const ::rtl::OUString& _rPath, sal_Int32 _nDepth = -1, CREATION_MODE _eMode = CM_PREFER_UPDATABLE, sal_Bool _bLazyWrite = sal_True );
+
+ /** commit all changes made on the subtree the object is the root for<p/>
+ All changes made on any <type>OConfigurationNode</type> object retrieved (maybe indirect) from this root
+ object are committed when calling this method.
+ @return sal_True if and only if the commit was successfull
+ */
+ sal_Bool commit() const throw();
+
+ /// invalidate the object
+ virtual void clear() throw();
+ };
+
+//........................................................................
+} // namespace utl
+//........................................................................
+
+#endif // _UNOTOOLS_CONFIGNODE_HXX_
+
diff --git a/unotools/inc/unotools/configpathes.hxx b/unotools/inc/unotools/configpathes.hxx
new file mode 100644
index 000000000000..2a1e76abf1fc
--- /dev/null
+++ b/unotools/inc/unotools/configpathes.hxx
@@ -0,0 +1,177 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "unotools/unotoolsdllapi.h"
+
+#ifndef UNOTOOLS_CONFIGPATHES_HXX_INCLUDED
+#define UNOTOOLS_CONFIGPATHES_HXX_INCLUDED
+#include <sal/types.h>
+
+namespace rtl
+{
+ class OUString;
+}
+
+//----------------------------------------------------------------------------
+namespace utl
+{
+//----------------------------------------------------------------------------
+ /** extract the local nodename and the parent nodepath
+ from a configuration path.
+
+ @param _sInPath
+ A configuration path that is not an empty or root path.<BR/>
+ If this is not a valid configuration path, it is interpreted as
+ local name of a node.
+
+ @param _rsOutPath
+ On exit: The configuration path obtained by dropping
+ the last level off <var>_sInPath</var>.<BR/>
+ If <var>_sInPath</var> could not be parsed as a valid
+ configuration path, this is set to an empty string.
+
+ @param _rsLocalName
+ On exit: The plain (non-escaped) name of the node identified by
+ <var>_sInPath</var>. <BR/>
+ If <var>_sInPath</var> could not be parsed as a valid
+ configuration path, this is set to <var>_sInPath</var>.
+
+ @returns
+ <TRUE/>, if a parent path could be set
+ <FALSE/>, if the path was a one-level path or an invalid path
+
+ */
+ UNOTOOLS_DLLPUBLIC sal_Bool splitLastFromConfigurationPath(::rtl::OUString const& _sInPath,
+ ::rtl::OUString& _rsOutPath,
+ ::rtl::OUString& _rsLocalName);
+
+//----------------------------------------------------------------------------
+ /** extract the first nodename from a configuration path.
+
+ @param _sInPath
+ A relative configuration path that is not empty.<BR/>
+ If this is not a valid configuration path, it is interpreted as
+ a single name of a node.
+
+ @returns
+ The plain (non-escaped) name of the node that is the first step
+ when traversing <var>_sInPath</var>.<BR/>
+ If <var>_sInPath</var> could not be parsed as a valid
+ configuration path, it is returned unaltered.
+
+ */
+ UNOTOOLS_DLLPUBLIC ::rtl::OUString extractFirstFromConfigurationPath(::rtl::OUString const& _sInPath);
+
+//----------------------------------------------------------------------------
+ /** check whether a path is to a nested node with respect to a parent path.
+
+ @param _sNestedPath
+ A configuration path that maybe points to a descendant of the node
+ identified by <var>_sPrefixPath</var>, with both pathes starting
+ from the same node (or both being absolute).
+
+ @param _sPrefixPath
+ A configuration path.<BR/>
+ If this path is absolute, <var>_sNestedPath</var> should be absolute;
+ If this path is relative, <var>_sNestedPath</var> should be relative;
+ If this path is empty, <var>_sNestedPath</var> may start with a '/',
+ which is disregarded.
+
+ @returns
+ <TRUE/>, if <var>_sPrefixPath</var> is a prefix of <var>_sNestedPath</var>;
+ <FALSE/> otherwise.<BR/>
+ If both pathes are equal <TRUE/> is returned.
+
+ */
+ sal_Bool isPrefixOfConfigurationPath(::rtl::OUString const& _sNestedPath,
+ ::rtl::OUString const& _sPrefixPath);
+
+//----------------------------------------------------------------------------
+ /** get the relative path to a nested node with respect to a parent path.
+
+ @param _sNestedPath
+ A configuration path that points to a descendant of the node
+ identified by <var>_sPrefixPath</var>, with both pathes starting
+ from the same node (or both being absolute).
+
+ @param _sPrefixPath
+ A configuration path.<BR/>
+ If this path is absolute, <var>_sNestedPath</var> must be absolute;
+ If this path is relative, <var>_sNestedPath</var> must be relative;
+ If this path is empty, <var>_sNestedPath</var> may start with a '/',
+ which is stripped.
+
+ @returns
+ The remaining relative path from the target of <var>_sPrefixPath</var>
+ to the target of <var>_sNestedPath</var>.<BR/>
+ If <var>_sPrefixPath</var> is not a prefix of <var>_sNestedPath</var>,
+ <var>_sNestedPath</var> is returned unaltered.
+
+ */
+ UNOTOOLS_DLLPUBLIC ::rtl::OUString dropPrefixFromConfigurationPath(::rtl::OUString const& _sNestedPath,
+ ::rtl::OUString const& _sPrefixPath);
+
+//----------------------------------------------------------------------------
+ /** Create a one-level relative configuration path from a set element name
+ without a known set element type.
+
+ @param _sElementName
+ An arbitrary string that is to be interpreted as
+ name of a configuration set element.
+
+ @returns
+ A one-level relative path to the element, of the form
+ "*['<Name>']", where <Name> is properly escaped.
+
+ */
+ UNOTOOLS_DLLPUBLIC ::rtl::OUString wrapConfigurationElementName(::rtl::OUString const& _sElementName);
+
+//----------------------------------------------------------------------------
+ /** Create a one-level relative configuration path from a set element name
+ and a known set element type.
+
+ @param _sElementName
+ An arbitrary string that is to be interpreted as
+ name of a configuration set element.
+
+ @param _sTypeName
+ An string identifying the type of the element. Usually this is be
+ the name of the element-template of the set.<BR/>
+
+ @returns
+ A one-level relative path to the element, of the form
+ "<Type>['<Name>']", where <Name> is properly escaped.
+
+ */
+ ::rtl::OUString wrapConfigurationElementName(::rtl::OUString const& _sElementName,
+ ::rtl::OUString const& _sTypeName);
+
+//----------------------------------------------------------------------------
+} // namespace utl
+//----------------------------------------------------------------------------
+
+#endif // UNOTOOLS_CONFIGPATHES_HXX_INCLUDED
+
diff --git a/unotools/inc/unotools/configvaluecontainer.hxx b/unotools/inc/unotools/configvaluecontainer.hxx
new file mode 100644
index 000000000000..a66ca4cb753a
--- /dev/null
+++ b/unotools/inc/unotools/configvaluecontainer.hxx
@@ -0,0 +1,236 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "unotools/unotoolsdllapi.h"
+
+#ifndef UNOTOOLS_CONFIGVALUECONTAINER_HXX
+#define UNOTOOLS_CONFIGVALUECONTAINER_HXX
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <osl/mutex.hxx>
+
+//.........................................................................
+namespace utl
+{
+//.........................................................................
+
+#define CVC_READONLY_ACCESS 0x0000
+#define CVC_UPDATE_ACCESS 0x0001
+
+#define CVC_LAZY_UPDATE 0x0000
+#define CVC_IMMEDIATE_UPDATE 0x0002
+
+ struct OConfigurationValueContainerImpl;
+ struct NodeValueAccessor;
+ //=====================================================================
+ //= OConfigurationValueContainer
+ //=====================================================================
+ /** allows simple access to static configuration structures.
+
+ <p>The basic idea of this class is that it's clients (usually derived classes) simply register an
+ address in memory and a node path, and upon explicit request, the configuration value and the memory
+ are syncronized.<br/>
+ This means that when calling <method>read</method>, the current configuration values are copied into
+ the memory registered for them, and upon calling <method>write</method> the current values in memory
+ are set in the configuration nodes.</p>
+
+ <p>This way, the usage of this class is pretty straight forward: derive your own class, spend some members
+ to it, and bind these members to configuration node (usually done in the ctor of the derived class).<br/>
+ In the dtor, simply call <method>write</method> and <method>commit</method>.</p>
+
+ <p>There is no auto-commit mechanism in the dtor: In the usual scenario, when you derive from this class
+ and bind some members of your derived class to config nodes, this means that your members will be destroyed
+ before your base class' dtor is called, so accessing the memory during such a theoretical auto-commit would
+ yield undefined behaviour.</p>
+ */
+ class UNOTOOLS_DLLPUBLIC OConfigurationValueContainer
+ {
+ private:
+ OConfigurationValueContainerImpl*
+ m_pImpl;
+
+ protected:
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&
+ getServiceFactory( ) const;
+
+ protected:
+ //-----------------------------------------------------------------
+ // construction/destruction
+
+ /** constructs the object
+
+ @param _rxORB
+ specifies the service factory which should be used to access the configuration
+ @param _rAccessSafety
+ As this class is intented to manipulate objects it does not hold itself (see the various
+ registerXXX methods), it needs to guard these access for muti threading safety.<br/>
+ The mutex given here is locked whenever such an access occurs.
+ @param _pConfigLocation
+ is an ASCII string describing the configurations node path
+ @param _nAccessFlags
+ specifies different aspects of the configuration aspect to be created, e.g. it's update mode etc.<br/>
+ See the CVC_xxx constants for what you can use here.
+ @param _nLevels
+ specifies the number of levels to access under the node given by <arg>_pConfigLocation</arg>
+ */
+ OConfigurationValueContainer(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB,
+ ::osl::Mutex& _rAccessSafety,
+ const sal_Char* _pConfigLocation,
+ const sal_uInt16 _nAccessFlags = CVC_UPDATE_ACCESS | CVC_LAZY_UPDATE,
+ const sal_Int32 _nLevels = -1
+ );
+
+ /** constructs the object
+
+ @param _rxORB
+ specifies the service factory which should be used to access the configuration
+ @param _rAccessSafety
+ As this class is intented to manipulate objects it does not hold itself (see the various
+ registerXXX methods), it needs to guard these access for muti threading safety.<br/>
+ The mutex given here is locked whenever such an access occurs.
+ @param _rConfigLocation
+ describes the configurations node path
+ @param _nAccessFlags
+ specifies different aspects of the configuration aspect to be created, e.g. it's update mode etc.<br/>
+ See the CVC_xxx constants for what you can use here.
+ @param _nLevels
+ specifies the number of levels to access under the node given by <arg>_pConfigLocation</arg>
+ */
+ OConfigurationValueContainer(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB,
+ ::osl::Mutex& _rAccessSafety,
+ const ::rtl::OUString& _rConfigLocation,
+ const sal_uInt16 _nAccessFlags = CVC_UPDATE_ACCESS | CVC_LAZY_UPDATE,
+ const sal_Int32 _nLevels = -1
+ );
+
+ /// dtor
+ ~OConfigurationValueContainer();
+
+ //-----------------------------------------------------------------
+ // registering data containers
+
+ /** registers a data accessor of an arbitrary type.
+
+ <p>Usually, in your derived class you simply add a member of the correct type of the configuration
+ value, and then call this method with the address of this member.</p>
+
+ <p>If the value you want to access may be <NULL/> at runtime, and if you want to recognize such
+ <NULL/> values, you may consider using <method>registerNullValueExchangeLocation</method>.</p>
+
+ @param _pRelativePathAscii
+ is a relative (ASCII) path of the node which should be "mirrored" into the accessor.
+ @param _pContainer
+ points to the accessors location in memory. Usually, this is simply an address of your derived class
+ @param _rValueType
+ is the type of your accessort. This type must be supported by the configuration.
+ */
+ void registerExchangeLocation(
+ const sal_Char* _pRelativePathAscii,
+ void* _pContainer,
+ const ::com::sun::star::uno::Type& _rValueType
+ );
+
+ /** registers a data accessor of an arbitrary type.
+
+ <p>Usually, in your derived class you simply add a member of type <type scope="com.sun.star.uno">Any</type>,
+ and then call this method with the address of this member.</p>
+
+ @param _pRelativePathAscii
+ is a relative (ASCII) path of the node which should be "mirrored" into the accessor.
+ @param _pContainer
+ points to the Any you want to hold the value
+ */
+ void registerNullValueExchangeLocation(
+ const sal_Char* _pRelativePathAscii,
+ ::com::sun::star::uno::Any* _pContainer
+ );
+
+ public:
+ /** reads the configuration data
+
+ <p>The current values of the nodes bound (using the registerXXX methods) is copied into their
+ respective exchange locations.</p>
+
+ <p>Please note that any changes done to your exchange locations are overridden with the current config
+ values.</p>
+
+ @see write
+ */
+ void read( );
+
+ /** updates the configuration data
+
+ <p>The current values in memory (your exchange locations registered using the registerXXX methods) is
+ forwarded to their respective configuration nodes.</p>
+
+ <p>Note that calling <method>write</method>(<TRUE/) is the same as calling <method>commit</method>(<TRUE/>).</p>
+
+ @precond
+ The access must have been created for update access
+
+ @param _bCommit
+ If set to <TRUE/>, an automatic commit is done after the values have been synchronized.<br/>
+ If set to <FALSE/>, you must explicitly call <method>commit</method> to make your changes persistent.
+
+ @see read
+ @see commit
+ */
+ void write( sal_Bool _bCommit = sal_True );
+
+ /** commits any changes done
+
+ <p>Note that calling <method>write</method>(<TRUE/) is the same as calling <method>commit</method>(<TRUE/>).</p>
+
+ @precond
+ The access must have been created for update access
+
+ @param _bWrite
+ If <TRUE/>, the current values in the exchange locations are written to the configuration nodes
+ before the changes are committed.<br/>
+ If <FALSE/>, only the current values in the config nodes (as present since the last call to
+ <method>write</method>) are committed.
+ */
+ void commit( sal_Bool _bWrite = sal_True );
+
+ private:
+ /// implements the ctors
+ void implConstruct(
+ const ::rtl::OUString& _rConfigLocation,
+ const sal_uInt16 _nAccessFlags,
+ const sal_Int32 _nLevels
+ );
+
+ /// registers a value container
+ void implRegisterExchangeLocation( const NodeValueAccessor& _rAccessor );
+ };
+
+//.........................................................................
+} // namespace utl
+//.........................................................................
+
+#endif // UNOTOOLS_CONFIGVALUECONTAINER_HXX
+
diff --git a/unotools/inc/unotools/datetime.hxx b/unotools/inc/unotools/datetime.hxx
new file mode 100644
index 000000000000..ef02822f1dc5
--- /dev/null
+++ b/unotools/inc/unotools/datetime.hxx
@@ -0,0 +1,63 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+//= conversions UNO3.TimeClass <-> Tools.TimeClass (Date/Time/DateTime)
+#include "unotools/unotoolsdllapi.h"
+
+#ifndef _UNOTOOLS_DATETIME_HXX_
+#define _UNOTOOLS_DATETIME_HXX_
+
+#include <com/sun/star/util/Date.hpp>
+#include <com/sun/star/util/Time.hpp>
+#include <com/sun/star/util/DateTime.hpp>
+
+class Date;
+class Time;
+class DateTime;
+
+//.........................................................................
+namespace utl
+{
+//.........................................................................
+
+ namespace starutil = ::com::sun::star::util;
+
+ UNOTOOLS_DLLPUBLIC void typeConvert(const Time& _rTime, starutil::Time& _rOut);
+ UNOTOOLS_DLLPUBLIC void typeConvert(const starutil::Time& _rTime, Time& _rOut);
+
+ UNOTOOLS_DLLPUBLIC void typeConvert(const Date& _rDate, starutil::Date& _rOut);
+ UNOTOOLS_DLLPUBLIC void typeConvert(const starutil::Date& _rDate, Date& _rOut);
+
+ UNOTOOLS_DLLPUBLIC void typeConvert(const DateTime& _rDateTime, starutil::DateTime& _rOut);
+ UNOTOOLS_DLLPUBLIC void typeConvert(const starutil::DateTime& _rDateTime, DateTime& _rOut);
+
+//.........................................................................
+} // namespace utl
+//.........................................................................
+
+#endif // _UNOTOOLS_DATETIME_HXX_
+
diff --git a/unotools/inc/unotools/defaultoptions.hxx b/unotools/inc/unotools/defaultoptions.hxx
new file mode 100644
index 000000000000..ecd6b7928629
--- /dev/null
+++ b/unotools/inc/unotools/defaultoptions.hxx
@@ -0,0 +1,54 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef INCLUDED_unotools_DEFAULTOPTIONS_HXX
+#define INCLUDED_unotools_DEFAULTOPTIONS_HXX
+
+#include "unotools/unotoolsdllapi.h"
+#include "tools/solar.h"
+#include <unotools/options.hxx>
+
+class String;
+class SvtDefaultOptions_Impl;
+
+// class SvtDefaultOptions -----------------------------------------------
+
+class SvtDefaultOptions_Impl;
+class UNOTOOLS_DLLPUBLIC SvtDefaultOptions: public utl::detail::Options
+{
+private:
+ SvtDefaultOptions_Impl* pImp;
+
+public:
+
+ SvtDefaultOptions();
+ virtual ~SvtDefaultOptions();
+
+ String GetDefaultPath( USHORT nId ) const;
+};
+
+#endif // #ifndef INCLUDED_unotools_DEFAULTOPTIONS_HXX
+
diff --git a/unotools/inc/unotools/desktopterminationobserver.hxx b/unotools/inc/unotools/desktopterminationobserver.hxx
new file mode 100644
index 000000000000..6b1f0d3e52f6
--- /dev/null
+++ b/unotools/inc/unotools/desktopterminationobserver.hxx
@@ -0,0 +1,79 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "unotools/unotoolsdllapi.h"
+
+#ifndef UNOTOOLS_INC_UNOTOOLS_DESKTOPTERMINATIONOBSERVER_HXX
+#define UNOTOOLS_INC_UNOTOOLS_DESKTOPTERMINATIONOBSERVER_HXX
+
+/** === begin UNO includes === **/
+/** === end UNO includes === **/
+
+//........................................................................
+namespace utl
+{
+//........................................................................
+
+ //====================================================================
+ //= ITerminationListener
+ //====================================================================
+ /** non-UNO version of the <type scope="com.sun.star.frame">XTerminateListener</type>
+ */
+ class ITerminationListener
+ {
+ public:
+ virtual bool queryTermination() const = 0;
+ virtual void notifyTermination() = 0;
+ };
+
+ //====================================================================
+ //= DesktopTerminationObserver
+ //====================================================================
+ /** a class which allows non-UNO components to observe the desktop (aka application)
+ for it's shutdown
+ */
+ class UNOTOOLS_DLLPUBLIC DesktopTerminationObserver
+ {
+ public:
+ /** registers a listener which should be notified when the desktop terminates
+ (which means the application is shutting down)
+ */
+ static void registerTerminationListener( ITerminationListener* _pListener );
+
+ /** revokes a termination listener
+ */
+ static void revokeTerminationListener( ITerminationListener* _pListener );
+
+ private:
+ DesktopTerminationObserver(); // never implemented, only static methods
+ };
+
+//........................................................................
+} // namespace utl
+//........................................................................
+
+#endif // UNOTOOLS_INC_UNOTOOLS_DESKTOPTERMINATIONOBSERVER_HXX
+
diff --git a/unotools/inc/unotools/digitgroupingiterator.hxx b/unotools/inc/unotools/digitgroupingiterator.hxx
new file mode 100644
index 000000000000..19f3ebf37abb
--- /dev/null
+++ b/unotools/inc/unotools/digitgroupingiterator.hxx
@@ -0,0 +1,204 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_UNOTOOLS_DIGITGROUPINGITERATOR_HXX
+#define INCLUDED_UNOTOOLS_DIGITGROUPINGITERATOR_HXX
+
+#include <com/sun/star/uno/Sequence.hxx>
+
+namespace utl {
+
+/** Iterator to be used with a digit grouping as obtained through
+ LocaleDataWrapper::getDigitGrouping().
+
+ The iterator advances over the digit groupings, returning the number of
+ digits per group. If the last group was encountered the iterator will
+ always return the last grouping.
+
+ Grouping values are sanitized to be 0 <= value <= SAL_MAX_UINT16, even if
+ originally Int32, to be able to easily cast it down to String's xub_StrLen.
+ This shouldn't make any difference in practice.
+
+ Usage example with a string buffer containing a decimal representation of
+ an integer number. Note that of course this loop could be optimized to not
+ count single characters but hunks of groups instead using the get() method,
+ this is just for illustrating usage. Anyway, for double values it is highly
+ more efficient to use ::rtl::math::doubleToString() and pass the grouping
+ sequence, instead of using this iterator and inserting charcters into
+ strings.
+
+ DigitGroupingIterator aGrouping(...)
+ sal_Int32 nCount = 0;
+ sal_Int32 n = aBuffer.getLength();
+ // >1 because we don't want to insert a separator if there is no leading digit.
+ while (n-- > 1)
+ {
+ if (++nCount >= aGrouping.getPos())
+ {
+ aBuffer.insert( n, cSeparator);
+ nGroupDigits = aGrouping.advance();
+ }
+ }
+
+ */
+
+class DigitGroupingIterator
+{
+ const ::com::sun::star::uno::Sequence< sal_Int32 > maGroupings;
+
+ sal_Int32 mnGroup; // current active grouping
+ sal_Int32 mnDigits; // current active digits per group
+ sal_Int32 mnNextPos; // position (in digits) of next grouping
+
+ void setInfinite()
+ {
+ mnGroup = maGroupings.getLength();
+ }
+
+ bool isInfinite() const
+ {
+ return mnGroup >= maGroupings.getLength();
+ }
+
+ sal_Int32 getGrouping() const
+ {
+ if (mnGroup < maGroupings.getLength())
+ {
+ sal_Int32 n = maGroupings[mnGroup];
+ OSL_ENSURE( 0 <= n && n <= SAL_MAX_UINT16, "DigitGroupingIterator::getGrouping: far out");
+ if (n < 0)
+ n = 0; // sanitize ...
+ else if (n > SAL_MAX_UINT16)
+ n = SAL_MAX_UINT16; // limit for use with xub_StrLen
+ return n;
+ }
+ return 0;
+ }
+
+ void setPos()
+ {
+ // someone might be playing jokes on us, so check for overflow
+ if (mnNextPos <= SAL_MAX_INT32 - mnDigits)
+ mnNextPos += mnDigits;
+ }
+
+ void setDigits()
+ {
+ sal_Int32 nPrev = mnDigits;
+ mnDigits = getGrouping();
+ if (!mnDigits)
+ {
+ mnDigits = nPrev;
+ setInfinite();
+ }
+ setPos();
+ }
+
+ void initGrouping()
+ {
+ mnDigits = 3; // just in case of constructed with empty grouping
+ mnGroup = 0;
+ mnNextPos = 0;
+ setDigits();
+ }
+
+ // not implemented, prevent usage
+ DigitGroupingIterator();
+ DigitGroupingIterator( const DigitGroupingIterator & );
+ DigitGroupingIterator & operator=( const DigitGroupingIterator & );
+
+public:
+
+ explicit DigitGroupingIterator( const ::com::sun::star::uno::Sequence< sal_Int32 > & rGroupings )
+ : maGroupings( rGroupings)
+ {
+ initGrouping();
+ }
+
+ /** Advance iterator to next grouping. */
+ DigitGroupingIterator & advance()
+ {
+ if (isInfinite())
+ setPos();
+ else
+ {
+ ++mnGroup;
+ setDigits();
+ }
+ return *this;
+ }
+
+ /** Obtain current grouping. Always > 0. */
+ sal_Int32 get() const
+ {
+ return mnDigits;
+ }
+
+ /** The next position (in integer digits) from the right where to insert a
+ group separator. */
+ sal_Int32 getPos()
+ {
+ return mnNextPos;
+ }
+
+ /** Reset iterator to start again from the right beginning. */
+ void reset()
+ {
+ initGrouping();
+ }
+
+ /** Create a sequence of bool values containing positions where to add a
+ separator when iterating forward over a string and copying digit per
+ digit. For example, for grouping in thousands and nIntegerDigits==7 the
+ sequence returned would be {1,0,0,1,0,0,0} so the caller would add a
+ separator after the 1st and the 4th digit. */
+ static ::com::sun::star::uno::Sequence< sal_Bool > createForwardSequence(
+ sal_Int32 nIntegerDigits,
+ const ::com::sun::star::uno::Sequence< sal_Int32 > & rGroupings )
+ {
+ if (nIntegerDigits <= 0)
+ return ::com::sun::star::uno::Sequence< sal_Bool >();
+ DigitGroupingIterator aIterator( rGroupings);
+ ::com::sun::star::uno::Sequence< sal_Bool > aSeq( nIntegerDigits);
+ sal_Bool* pArr = aSeq.getArray();
+ for (sal_Int32 j = 0; --nIntegerDigits >= 0; ++j)
+ {
+ if (j == aIterator.getPos())
+ {
+ pArr[nIntegerDigits] = sal_True;
+ aIterator.advance();
+ }
+ else
+ pArr[nIntegerDigits] = sal_False;
+ }
+ return aSeq;
+ }
+};
+
+} // namespace utl
+
+#endif // INCLUDED_UNOTOOLS_DIGITGROUPINGITERATOR_HXX
diff --git a/unotools/inc/unotools/docinfohelper.hxx b/unotools/inc/unotools/docinfohelper.hxx
new file mode 100644
index 000000000000..9ce9d346af20
--- /dev/null
+++ b/unotools/inc/unotools/docinfohelper.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 _UNOTOOLS_DOCINFOHELPER_HXX_
+#define _UNOTOOLS_DOCINFOHELPER_HXX_
+
+#include <unotools/unotoolsdllapi.h>
+#include <rtl/ustring.hxx>
+
+namespace utl
+{
+class UNOTOOLS_DLLPUBLIC DocInfoHelper
+{
+public:
+ static ::rtl::OUString GetGeneratorString();
+
+};
+
+} // namespace utl
+
+
+#endif // _UNOTOOLS_DOCINFOHELPER_HXX_
+
diff --git a/unotools/inc/unotools/dynamicmenuoptions.hxx b/unotools/inc/unotools/dynamicmenuoptions.hxx
new file mode 100644
index 000000000000..9d695e166471
--- /dev/null
+++ b/unotools/inc/unotools/dynamicmenuoptions.hxx
@@ -0,0 +1,219 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef INCLUDED_unotools_DYNAMICMENUOPTIONS_HXX
+#define INCLUDED_unotools_DYNAMICMENUOPTIONS_HXX
+
+//_________________________________________________________________________________________________________________
+// includes
+//_________________________________________________________________________________________________________________
+
+#include "unotools/unotoolsdllapi.h"
+#include <sal/types.h>
+#include <osl/mutex.hxx>
+#include <com/sun/star/uno/Sequence.h>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <unotools/options.hxx>
+
+//_________________________________________________________________________________________________________________
+// types, enums, ...
+//_________________________________________________________________________________________________________________
+
+/*-************************************************************************************************************//**
+ @descr The method GetList() returns a list of property values.
+ Use follow defines to seperate values by names.
+*//*-*************************************************************************************************************/
+#define DYNAMICMENU_PROPERTYNAME_URL ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("URL" ))
+#define DYNAMICMENU_PROPERTYNAME_TITLE ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Title" ))
+#define DYNAMICMENU_PROPERTYNAME_IMAGEIDENTIFIER ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ImageIdentifier" ))
+#define DYNAMICMENU_PROPERTYNAME_TARGETNAME ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TargetName" ))
+
+/*-************************************************************************************************************//**
+ @descr You can use these enum values to specify right menu if you call our interface methods.
+*//*-*************************************************************************************************************/
+enum EDynamicMenuType
+{
+ E_NEWMENU = 0,
+ E_WIZARDMENU = 1,
+ E_HELPBOOKMARKS = 2
+};
+//_________________________________________________________________________________________________________________
+// forward declarations
+//_________________________________________________________________________________________________________________
+
+/*-************************************************************************************************************//**
+ @short forward declaration to our private date container implementation
+ @descr We use these class as internal member to support small memory requirements.
+ You can create the container if it is neccessary. The class which use these mechanism
+ is faster and smaller then a complete implementation!
+*//*-*************************************************************************************************************/
+
+class SvtDynamicMenuOptions_Impl;
+
+//_________________________________________________________________________________________________________________
+// declarations
+//_________________________________________________________________________________________________________________
+
+/*-************************************************************************************************************//**
+ @short collect informations about dynamic menus
+ @descr Make it possible to configure dynamic menu structures of menus like "new" or "wizard".
+
+ @implements -
+ @base -
+
+ @devstatus ready to use
+*//*-*************************************************************************************************************/
+
+class UNOTOOLS_DLLPUBLIC SvtDynamicMenuOptions: public utl::detail::Options
+{
+ //-------------------------------------------------------------------------------------------------------------
+ // public methods
+ //-------------------------------------------------------------------------------------------------------------
+
+ public:
+
+ //---------------------------------------------------------------------------------------------------------
+ // constructor / destructor
+ //---------------------------------------------------------------------------------------------------------
+
+ /*-****************************************************************************************************//**
+ @short standard constructor and destructor
+ @descr This will initialize an instance with default values.
+ We implement these class with a refcount mechanism! Every instance of this class increase it
+ at create and decrease it at delete time - but all instances use the same data container!
+ He is implemented as a static member ...
+
+ @seealso member m_nRefCount
+ @seealso member m_pDataContainer
+
+ @param -
+ @return -
+
+ @onerror -
+ *//*-*****************************************************************************************************/
+
+ SvtDynamicMenuOptions();
+ virtual ~SvtDynamicMenuOptions();
+
+ //---------------------------------------------------------------------------------------------------------
+ // interface
+ //---------------------------------------------------------------------------------------------------------
+
+ /*-****************************************************************************************************//**
+ @short clear complete sepcified list
+ @descr Call this methods to clear the whole list.
+ To fill it again use AppendItem().
+
+ @seealso -
+
+ @param "eMenu" select right menu to clear.
+ @return -
+
+ @onerror -
+ *//*-*****************************************************************************************************/
+
+ void Clear( EDynamicMenuType eMenu );
+
+ /*-****************************************************************************************************//**
+ @short return complete specified list
+ @descr Call it to get all entries of an dynamic menu.
+ We return a list of all nodes with his names and properties.
+
+ @seealso -
+
+ @param "eMenu" select right menu.
+ @return A list of menu items is returned.
+
+ @onerror We return an empty list.
+ *//*-*****************************************************************************************************/
+
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > > GetMenu( EDynamicMenuType eMenu ) const;
+
+ /*-****************************************************************************************************//**
+ @short append a new item to specified menu
+ @descr You can append items to a menu only - removing isn't allowed for a special item!
+ We support a nothing or all mechanism only! Clear all or append something ...
+
+ @seealso method Clear()
+
+ @param "eMenu" select right menu.
+ @param "sURL" URL for dispatch
+ @param "sTitle" label of menu entry
+ @param "sImageIdentifier" icon identifier
+ @param "sTargetName" target for dispatch
+ @return -
+
+ @onerror -
+ *//*-*****************************************************************************************************/
+
+ void AppendItem( EDynamicMenuType eMenu ,
+ const ::rtl::OUString& sURL ,
+ const ::rtl::OUString& sTitle ,
+ const ::rtl::OUString& sImageIdentifier ,
+ const ::rtl::OUString& sTargetName );
+
+ //-------------------------------------------------------------------------------------------------------------
+ // private methods
+ //-------------------------------------------------------------------------------------------------------------
+
+ private:
+
+ /*-****************************************************************************************************//**
+ @short return a reference to a static mutex
+ @descr These class is partially threadsafe (for de-/initialization only).
+ All access methods are'nt safe!
+ We create a static mutex only for one ime and use at different times.
+
+ @seealso -
+
+ @param -
+ @return A reference to a static mutex member.
+
+ @onerror -
+ *//*-*****************************************************************************************************/
+
+ UNOTOOLS_DLLPRIVATE static ::osl::Mutex& GetOwnStaticMutex();
+
+ //-------------------------------------------------------------------------------------------------------------
+ // private member
+ //-------------------------------------------------------------------------------------------------------------
+
+ private:
+
+ /*Attention
+
+ Don't initialize these static member in these header!
+ a) Double dfined symbols will be detected ...
+ b) and unresolved externals exist at linking time.
+ Do it in your source only.
+ */
+
+ static SvtDynamicMenuOptions_Impl* m_pDataContainer ; /// impl. data container as dynamic pointer for smaller memory requirements!
+ static sal_Int32 m_nRefCount ; /// internal ref count mechanism
+
+}; // class SvtDynamicMenuOptions
+
+#endif // #ifndef INCLUDED_unotools_DYNAMICMENUOPTIONS_HXX
diff --git a/unotools/inc/unotools/eventcfg.hxx b/unotools/inc/unotools/eventcfg.hxx
new file mode 100644
index 000000000000..839811f9dd80
--- /dev/null
+++ b/unotools/inc/unotools/eventcfg.hxx
@@ -0,0 +1,122 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _EVENTCFG_HXX
+#define _EVENTCFG_HXX
+
+#include "unotools/unotoolsdllapi.h"
+#include <unotools/configitem.hxx>
+#include <com/sun/star/document/XEventsSupplier.hpp>
+#include <com/sun/star/container/XNameReplace.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
+#include <cppuhelper/weakref.hxx>
+#include <cppuhelper/implbase2.hxx>
+#include <hash_map>
+#include <vector>
+
+#define STR_EVENT_STARTAPP 0
+#define STR_EVENT_CLOSEAPP 1
+#define STR_EVENT_DOCCREATED 2
+#define STR_EVENT_CREATEDOC 3
+#define STR_EVENT_LOADFINISHED 4
+#define STR_EVENT_OPENDOC 5
+#define STR_EVENT_PREPARECLOSEDOC 6
+#define STR_EVENT_CLOSEDOC 7
+#define STR_EVENT_SAVEDOC 8
+#define STR_EVENT_SAVEDOCDONE 9
+#define STR_EVENT_SAVEDOCFAILED 10
+#define STR_EVENT_SAVEASDOC 11
+#define STR_EVENT_SAVEASDOCDONE 12
+#define STR_EVENT_SAVEASDOCFAILED 13
+#define STR_EVENT_SAVETODOC 14
+#define STR_EVENT_SAVETODOCDONE 15
+#define STR_EVENT_SAVETODOCFAILED 16
+#define STR_EVENT_ACTIVATEDOC 17
+#define STR_EVENT_DEACTIVATEDOC 18
+#define STR_EVENT_PRINTDOC 19
+#define STR_EVENT_VIEWCREATED 20
+#define STR_EVENT_PREPARECLOSEVIEW 21
+#define STR_EVENT_CLOSEVIEW 22
+#define STR_EVENT_MODIFYCHANGED 23
+#define STR_EVENT_TITLECHANGED 24
+#define STR_EVENT_VISAREACHANGED 25
+#define STR_EVENT_MODECHANGED 26
+#define STR_EVENT_STORAGECHANGED 27
+
+typedef ::std::hash_map< ::rtl::OUString, ::rtl::OUString, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > EventBindingHash;
+typedef ::std::vector< ::com::sun::star::uno::WeakReference< ::com::sun::star::frame::XFrame > > FrameVector;
+typedef ::std::vector< ::rtl::OUString > SupportedEventsVector;
+
+class GlobalEventConfig_Impl : public utl::ConfigItem
+{
+ EventBindingHash m_eventBindingHash;
+ FrameVector m_lFrames;
+ SupportedEventsVector m_supportedEvents;
+
+ void initBindingInfo();
+
+public:
+ GlobalEventConfig_Impl( );
+ ~GlobalEventConfig_Impl( );
+
+ void EstablishFrameCallback(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame);
+ void Notify( const com::sun::star::uno::Sequence<rtl::OUString>& aPropertyNames);
+ void Commit();
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > SAL_CALL getEvents( ) throw (::com::sun::star::uno::RuntimeException);
+ void SAL_CALL replaceByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (::com::sun::star::uno::RuntimeException);
+ ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw (::com::sun::star::uno::RuntimeException);
+ ::sal_Bool SAL_CALL hasElements( ) throw (::com::sun::star::uno::RuntimeException);
+ ::rtl::OUString GetEventName( sal_Int32 nID );
+};
+
+class UNOTOOLS_DLLPUBLIC GlobalEventConfig:
+ public ::cppu::WeakImplHelper2 < ::com::sun::star::document::XEventsSupplier, ::com::sun::star::container::XNameReplace >
+{
+ public:
+ GlobalEventConfig( );
+ ~GlobalEventConfig( );
+ static ::osl::Mutex& GetOwnStaticMutex();
+
+ void EstablishFrameCallback(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame);
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > SAL_CALL getEvents( ) throw (::com::sun::star::uno::RuntimeException);
+ void SAL_CALL replaceByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (::com::sun::star::uno::RuntimeException);
+ ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw (::com::sun::star::uno::RuntimeException);
+ ::sal_Bool SAL_CALL hasElements( ) throw (::com::sun::star::uno::RuntimeException);
+ static ::rtl::OUString GetEventName( sal_Int32 nID );
+
+ private:
+ static GlobalEventConfig_Impl* m_pImpl;
+ static sal_Int32 m_nRefCount;
+};
+
+#endif // _EVENTCFG_HXX
diff --git a/unotools/inc/unotools/eventlisteneradapter.hxx b/unotools/inc/unotools/eventlisteneradapter.hxx
new file mode 100644
index 000000000000..c46cabc4dffb
--- /dev/null
+++ b/unotools/inc/unotools/eventlisteneradapter.hxx
@@ -0,0 +1,71 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "unotools/unotoolsdllapi.h"
+
+#ifndef _UNOTOOLS_EVENTLISTENERADAPTER_HXX_
+#define _UNOTOOLS_EVENTLISTENERADAPTER_HXX_
+#include <com/sun/star/lang/XComponent.hpp>
+
+//.........................................................................
+namespace utl
+{
+//.........................................................................
+
+ struct OEventListenerAdapterImpl;
+ //=====================================================================
+ //= OEventListenerAdapter
+ //=====================================================================
+ /** base class for non-UNO dispose listeners
+ */
+ class UNOTOOLS_DLLPUBLIC OEventListenerAdapter
+ {
+ friend class OEventListenerImpl;
+
+ private:
+ UNOTOOLS_DLLPRIVATE OEventListenerAdapter( const OEventListenerAdapter& _rSource ); // never implemented
+ UNOTOOLS_DLLPRIVATE const OEventListenerAdapter& operator=( const OEventListenerAdapter& _rSource ); // never implemented
+
+ protected:
+ OEventListenerAdapterImpl* m_pImpl;
+
+ protected:
+ OEventListenerAdapter();
+ virtual ~OEventListenerAdapter();
+
+ void startComponentListening( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& _rxComp );
+ void stopComponentListening( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& _rxComp );
+ void stopAllComponentListening( );
+
+ virtual void _disposing( const ::com::sun::star::lang::EventObject& _rSource ) = 0;
+ };
+
+//.........................................................................
+} // namespace utl
+//.........................................................................
+
+#endif // _UNOTOOLS_EVENTLISTENERADAPTER_HXX_
+
diff --git a/unotools/inc/unotools/extendedsecurityoptions.hxx b/unotools/inc/unotools/extendedsecurityoptions.hxx
new file mode 100644
index 000000000000..6e6b04472d31
--- /dev/null
+++ b/unotools/inc/unotools/extendedsecurityoptions.hxx
@@ -0,0 +1,160 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef INCLUDED_unotools_EXTENDEDSECURITYOPTIONS_HXX
+#define INCLUDED_unotools_EXTENDEDSECURITYOPTIONS_HXX
+
+//_________________________________________________________________________________________________________________
+// includes
+//_________________________________________________________________________________________________________________
+
+#include "unotools/unotoolsdllapi.h"
+#include <sal/types.h>
+#include <osl/mutex.hxx>
+#include <com/sun/star/uno/Sequence.h>
+#include <rtl/ustring.hxx>
+#include <unotools/options.hxx>
+
+//_________________________________________________________________________________________________________________
+// forward declarations
+//_________________________________________________________________________________________________________________
+
+/*-************************************************************************************************************//**
+ @short forward declaration to our private date container implementation
+ @descr We use these class as internal member to support small memory requirements.
+ You can create the container if it is neccessary. The class which use these mechanism
+ is faster and smaller then a complete implementation!
+*//*-*************************************************************************************************************/
+
+class SvtExtendedSecurityOptions_Impl;
+
+//_________________________________________________________________________________________________________________
+// declarations
+//_________________________________________________________________________________________________________________
+
+/*-************************************************************************************************************//**
+ @short collect informations about security features
+ @descr -
+
+ @implements -
+ @base -
+
+ @ATTENTION This class is partially threadsafe.
+
+ @devstatus ready to use
+*//*-*************************************************************************************************************/
+
+class UNOTOOLS_DLLPUBLIC SvtExtendedSecurityOptions: public utl::detail::Options
+{
+ //-------------------------------------------------------------------------------------------------------------
+ // public methods
+ //-------------------------------------------------------------------------------------------------------------
+
+ public:
+ // Must be zero based!
+ enum OpenHyperlinkMode
+ {
+ OPEN_NEVER = 0,
+ OPEN_WITHSECURITYCHECK,
+ OPEN_ALWAYS
+ };
+
+ //---------------------------------------------------------------------------------------------------------
+ // constructor / destructor
+ //---------------------------------------------------------------------------------------------------------
+
+ /*-****************************************************************************************************//**
+ @short standard constructor and destructor
+ @descr This will initialize an instance with default values.
+ We implement these class with a refcount mechanism! Every instance of this class increase it
+ at create and decrease it at delete time - but all instances use the same data container!
+ He is implemented as a static member ...
+
+ @seealso member m_nRefCount
+ @seealso member m_pDataContainer
+
+ @param -
+ @return -
+
+ @onerror -
+ *//*-*****************************************************************************************************/
+
+ SvtExtendedSecurityOptions();
+ virtual ~SvtExtendedSecurityOptions();
+
+ //---------------------------------------------------------------------------------------------------------
+ // interface
+ //---------------------------------------------------------------------------------------------------------
+
+ sal_Bool IsSecureHyperlink( const rtl::OUString& aURL ) const;
+ com::sun::star::uno::Sequence< rtl::OUString > GetSecureExtensionList() const;
+
+ OpenHyperlinkMode GetOpenHyperlinkMode();
+ void SetOpenHyperlinkMode( OpenHyperlinkMode aMode );
+ sal_Bool IsOpenHyperlinkModeReadOnly() const;
+
+ //-------------------------------------------------------------------------------------------------------------
+ // private methods
+ //-------------------------------------------------------------------------------------------------------------
+
+ private:
+
+ /*-****************************************************************************************************//**
+ @short return a reference to a static mutex
+ @descr These class is partially threadsafe (for de-/initialization only).
+ All access methods are'nt safe!
+ We create a static mutex only for one ime and use at different times.
+
+ @seealso -
+
+ @param -
+ @return A reference to a static mutex member.
+
+ @onerror -
+ *//*-*****************************************************************************************************/
+
+ UNOTOOLS_DLLPRIVATE static ::osl::Mutex& GetInitMutex();
+
+ //-------------------------------------------------------------------------------------------------------------
+ // private member
+ //-------------------------------------------------------------------------------------------------------------
+
+ private:
+
+ /*Attention
+
+ Don't initialize these static member in these header!
+ a) Double dfined symbols will be detected ...
+ b) and unresolved externals exist at linking time.
+ Do it in your source only.
+ */
+
+ static SvtExtendedSecurityOptions_Impl* m_pDataContainer ; /// impl. data container as dynamic pointer for smaller memory requirements!
+ static sal_Int32 m_nRefCount ; /// internal ref count mechanism
+
+}; // class SvtExtendedSecurityOptions
+
+#endif // #ifndef INCLUDED_unotools_EXTENDEDSECURITYOPTIONS_HXX
diff --git a/unotools/inc/unotools/fltrcfg.hxx b/unotools/inc/unotools/fltrcfg.hxx
new file mode 100644
index 000000000000..890efebde071
--- /dev/null
+++ b/unotools/inc/unotools/fltrcfg.hxx
@@ -0,0 +1,100 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVT_FLTRCFG_HXX
+#define _SVT_FLTRCFG_HXX
+
+// -----------------------------------------------------------------------
+
+#include "unotools/unotoolsdllapi.h"
+#include <unotools/configitem.hxx>
+
+struct SvtFilterOptions_Impl;
+class UNOTOOLS_DLLPUBLIC SvtFilterOptions : public utl::ConfigItem
+{
+ SvtFilterOptions_Impl* pImp;
+
+ const com::sun::star::uno::Sequence<rtl::OUString>& GetPropertyNames();
+public:
+ SvtFilterOptions();
+ virtual ~SvtFilterOptions();
+
+ virtual void Notify( const com::sun::star::uno::Sequence<rtl::OUString>& aPropertyNames);
+ virtual void Commit();
+ void Load();
+
+ void SetLoadWordBasicCode( sal_Bool bFlag );
+ sal_Bool IsLoadWordBasicCode() const;
+ void SetLoadWordBasicStorage( sal_Bool bFlag );
+ sal_Bool IsLoadWordBasicStorage() const;
+
+ void SetLoadExcelBasicCode( sal_Bool bFlag );
+ sal_Bool IsLoadExcelBasicCode() const;
+ void SetLoadExcelBasicExecutable( sal_Bool bFlag );
+ sal_Bool IsLoadExcelBasicExecutable() const;
+ void SetLoadExcelBasicStorage( sal_Bool bFlag );
+ sal_Bool IsLoadExcelBasicStorage() const;
+
+ void SetLoadPPointBasicCode( sal_Bool bFlag );
+ sal_Bool IsLoadPPointBasicCode() const;
+ void SetLoadPPointBasicStorage( sal_Bool bFlag );
+ sal_Bool IsLoadPPointBasicStorage() const;
+
+ sal_Bool IsMathType2Math() const;
+ void SetMathType2Math( sal_Bool bFlag );
+ sal_Bool IsMath2MathType() const;
+ void SetMath2MathType( sal_Bool bFlag );
+
+ sal_Bool IsWinWord2Writer() const;
+ void SetWinWord2Writer( sal_Bool bFlag );
+ sal_Bool IsWriter2WinWord() const;
+ void SetWriter2WinWord( sal_Bool bFlag );
+
+ sal_Bool IsUseEnhancedFields() const;
+ void SetUseEnhancedFields( sal_Bool bFlag );
+
+ sal_Bool IsExcel2Calc() const;
+ void SetExcel2Calc( sal_Bool bFlag );
+ sal_Bool IsCalc2Excel() const;
+ void SetCalc2Excel( sal_Bool bFlag );
+
+ sal_Bool IsPowerPoint2Impress() const;
+ void SetPowerPoint2Impress( sal_Bool bFlag );
+ sal_Bool IsImpress2PowerPoint() const;
+ void SetImpress2PowerPoint( sal_Bool bFlag );
+
+ sal_Bool IsEnablePPTPreview() const;
+ sal_Bool IsEnableCalcPreview() const;
+ sal_Bool IsEnableWordPreview() const;
+
+ static SvtFilterOptions* Get();
+};
+
+#endif
+
+
+
+
diff --git a/unotools/inc/unotools/fontcfg.hxx b/unotools/inc/unotools/fontcfg.hxx
new file mode 100644
index 000000000000..633c12c4c99c
--- /dev/null
+++ b/unotools/inc/unotools/fontcfg.hxx
@@ -0,0 +1,227 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _UNOTOOLS_FONTCFG_HXX
+#define _UNOTOOLS_FONTCFG_HXX
+
+#include <unotools/unotoolsdllapi.h>
+#include <tools/string.hxx>
+#include <tools/fontenum.hxx>
+#include <com/sun/star/lang/Locale.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+
+#include <hash_map>
+#include <hash_set>
+#include <vector>
+
+namespace com {
+namespace sun {
+namespace star {
+namespace lang {
+
+// equality operator needed for hash_map;
+// (-> why does this need to be in the namespace of Locale ? g++ fails to compile else)
+inline bool operator==( const com::sun::star::lang::Locale& rLeft, const com::sun::star::lang::Locale& rRight )
+{
+ return
+ rLeft.Language.equals( rRight.Language ) &&
+ rLeft.Country.equals( rRight.Country ) &&
+ rLeft.Variant.equals( rRight.Variant )
+ ;
+}
+}}}}
+
+namespace utl
+{
+
+struct LocaleHash
+{
+ size_t operator()( const com::sun::star::lang::Locale& rLocale ) const
+ {
+ return
+ (size_t)rLocale.Language.hashCode() ^
+ (size_t)rLocale.Country.hashCode() ^
+ (size_t)rLocale.Variant.hashCode();
+ }
+};
+
+class UNOTOOLS_DLLPUBLIC DefaultFontConfiguration
+{
+ com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >
+ m_xConfigProvider;
+ com::sun::star::uno::Reference< com::sun::star::container::XNameAccess >
+ m_xConfigAccess;
+
+ struct LocaleAccess
+ {
+ // the real string used in the configuration
+ // used to get rid of upper/lower case problems
+ rtl::OUString aConfigLocaleString;
+ // xAccess is mutable to be able to be filled on demand
+ mutable com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > xAccess;
+ };
+
+ std::hash_map< com::sun::star::lang::Locale,
+ LocaleAccess,
+ utl::LocaleHash >
+ m_aConfig;
+
+ rtl::OUString tryLocale( const com::sun::star::lang::Locale& rLocale, const rtl::OUString& rType ) const;
+
+ DefaultFontConfiguration();
+ public:
+ ~DefaultFontConfiguration();
+
+ static DefaultFontConfiguration* get();
+
+ rtl::OUString getDefaultFont( const com::sun::star::lang::Locale& rLocale, int nType ) const;
+ rtl::OUString getUserInterfaceFont( const com::sun::star::lang::Locale& rLocale ) const;
+};
+
+// IMPL_FONT_ATTR_DEFAULT - Default-Font like Andale Sans UI, Palace Script, Albany, Thorndale, Cumberland, ...
+// IMPL_FONT_ATTR_STANDARD - Standard-Font like Arial, Times, Courier, ...
+// IMPL_FONT_ATTR_NORMAL - normal Font for writing text like Arial, Verdana, Arial Narrow, Trebuchet, Times, Courier, ...
+// IMPL_FONT_ATTR_SYMBOL - Font with symbols
+// IMPL_FONT_ATTR_DECORATIVE - Readable and normally used for drawings
+// IMPL_FONT_ATTR_SPECIAL - very special design
+// IMPL_FONT_ATTR_TITLING - only uppercase characters
+// IMPL_FONT_ATTR_FULL - Font with normally all characters
+// IMPL_FONT_ATTR_CAPITALS - only uppercase characters, but lowercase characters smaller as the uppercase characters
+// IMPL_FONT_ATTR_TYPEWRITER - like a typewriter: Courier, ...
+// IMPL_FONT_ATTR_SCRIPT - Handwriting or Script
+// IMPL_FONT_ATTR_HANDWRITING - More Handwriting with normal letters
+// IMPL_FONT_ATTR_CHANCERY - Like Zapf Chancery
+// IMPL_FONT_ATTR_COMIC - Like Comic Sans MS
+// IMPL_FONT_ATTR_BRUSHSCRIPT - More Script
+// IMPL_FONT_ATTR_OTHERSTYLE - OldStyle, ... so negativ points
+#define IMPL_FONT_ATTR_DEFAULT ((ULONG)0x00000001)
+#define IMPL_FONT_ATTR_STANDARD ((ULONG)0x00000002)
+#define IMPL_FONT_ATTR_NORMAL ((ULONG)0x00000004)
+#define IMPL_FONT_ATTR_SYMBOL ((ULONG)0x00000008)
+#define IMPL_FONT_ATTR_FIXED ((ULONG)0x00000010)
+#define IMPL_FONT_ATTR_SANSSERIF ((ULONG)0x00000020)
+#define IMPL_FONT_ATTR_SERIF ((ULONG)0x00000040)
+#define IMPL_FONT_ATTR_DECORATIVE ((ULONG)0x00000080)
+#define IMPL_FONT_ATTR_SPECIAL ((ULONG)0x00000100)
+#define IMPL_FONT_ATTR_ITALIC ((ULONG)0x00000200)
+#define IMPL_FONT_ATTR_TITLING ((ULONG)0x00000400)
+#define IMPL_FONT_ATTR_CAPITALS ((ULONG)0x00000800)
+#define IMPL_FONT_ATTR_CJK ((ULONG)0x00001000)
+#define IMPL_FONT_ATTR_CJK_JP ((ULONG)0x00002000)
+#define IMPL_FONT_ATTR_CJK_SC ((ULONG)0x00004000)
+#define IMPL_FONT_ATTR_CJK_TC ((ULONG)0x00008000)
+#define IMPL_FONT_ATTR_CJK_KR ((ULONG)0x00010000)
+#define IMPL_FONT_ATTR_CTL ((ULONG)0x00020000)
+#define IMPL_FONT_ATTR_NONELATIN ((ULONG)0x00040000)
+#define IMPL_FONT_ATTR_FULL ((ULONG)0x00080000)
+#define IMPL_FONT_ATTR_OUTLINE ((ULONG)0x00100000)
+#define IMPL_FONT_ATTR_SHADOW ((ULONG)0x00200000)
+#define IMPL_FONT_ATTR_ROUNDED ((ULONG)0x00400000)
+#define IMPL_FONT_ATTR_TYPEWRITER ((ULONG)0x00800000)
+#define IMPL_FONT_ATTR_SCRIPT ((ULONG)0x01000000)
+#define IMPL_FONT_ATTR_HANDWRITING ((ULONG)0x02000000)
+#define IMPL_FONT_ATTR_CHANCERY ((ULONG)0x04000000)
+#define IMPL_FONT_ATTR_COMIC ((ULONG)0x08000000)
+#define IMPL_FONT_ATTR_BRUSHSCRIPT ((ULONG)0x10000000)
+#define IMPL_FONT_ATTR_GOTHIC ((ULONG)0x20000000)
+#define IMPL_FONT_ATTR_SCHOOLBOOK ((ULONG)0x40000000)
+#define IMPL_FONT_ATTR_OTHERSTYLE ((ULONG)0x80000000)
+
+#define IMPL_FONT_ATTR_CJK_ALLLANG (IMPL_FONT_ATTR_CJK_JP | IMPL_FONT_ATTR_CJK_SC | IMPL_FONT_ATTR_CJK_TC | IMPL_FONT_ATTR_CJK_KR)
+#define IMPL_FONT_ATTR_ALLSCRIPT (IMPL_FONT_ATTR_SCRIPT | IMPL_FONT_ATTR_HANDWRITING | IMPL_FONT_ATTR_CHANCERY | IMPL_FONT_ATTR_COMIC | IMPL_FONT_ATTR_BRUSHSCRIPT)
+#define IMPL_FONT_ATTR_ALLSUBSCRIPT (IMPL_FONT_ATTR_HANDWRITING | IMPL_FONT_ATTR_CHANCERY | IMPL_FONT_ATTR_COMIC | IMPL_FONT_ATTR_BRUSHSCRIPT)
+#define IMPL_FONT_ATTR_ALLSERIFSTYLE (IMPL_FONT_ATTR_ALLSCRIPT |\
+ IMPL_FONT_ATTR_SANSSERIF | IMPL_FONT_ATTR_SERIF |\
+ IMPL_FONT_ATTR_FIXED | IMPL_FONT_ATTR_ITALIC |\
+ IMPL_FONT_ATTR_GOTHIC | IMPL_FONT_ATTR_SCHOOLBOOK |\
+ IMPL_FONT_ATTR_SHADOW | IMPL_FONT_ATTR_OUTLINE)
+
+struct UNOTOOLS_DLLPUBLIC FontNameAttr
+{
+ String Name;
+ ::std::vector< String > Substitutions;
+ ::std::vector< String > MSSubstitutions;
+ ::std::vector< String > PSSubstitutions;
+ ::std::vector< String > HTMLSubstitutions;
+ FontWeight Weight;
+ FontWidth Width;
+ unsigned long Type; // bitfield of IMPL_FONT_ATTR_*
+};
+
+class UNOTOOLS_DLLPUBLIC FontSubstConfiguration
+{
+private:
+ com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >
+ m_xConfigProvider;
+ com::sun::star::uno::Reference< com::sun::star::container::XNameAccess >
+ m_xConfigAccess;
+ struct LocaleSubst
+ {
+ rtl::OUString aConfigLocaleString;
+ mutable bool bConfigRead;
+ // note: aSubstAttributes must be sorted alphabetically by Name
+ // searches on the substitutes are done with Name as key, where
+ // a minimal match is sufficient (that is e.g. "Thorndale" will match
+ // "Thorndale BlaBlub"). Also names must be lower case.
+ mutable std::vector< FontNameAttr > aSubstAttributes;
+
+ LocaleSubst() : bConfigRead( false ) {}
+ };
+ std::hash_map< com::sun::star::lang::Locale, LocaleSubst, utl::LocaleHash > m_aSubst;
+ typedef std::hash_set< rtl::OUString, rtl::OUStringHash > UniqueSubstHash;
+ mutable UniqueSubstHash maSubstHash;
+
+
+ void fillSubstVector( const com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > xFont,
+ const rtl::OUString& rType,
+ std::vector< String >& rSubstVector ) const;
+ FontWeight getSubstWeight( const com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > xFont,
+ const rtl::OUString& rType ) const;
+ FontWidth getSubstWidth( const com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > xFont,
+ const rtl::OUString& rType ) const;
+ unsigned long getSubstType( const com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > xFont,
+ const rtl::OUString& rType ) const;
+ void readLocaleSubst( const com::sun::star::lang::Locale& rLocale ) const;
+ FontSubstConfiguration();
+public:
+ ~FontSubstConfiguration();
+
+ static FontSubstConfiguration* get();
+
+ const FontNameAttr* getSubstInfo(
+ const String& rFontName,
+ const com::sun::star::lang::Locale& rLocale =
+ com::sun::star::lang::Locale( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "en" ) ),
+ rtl::OUString(),
+ rtl::OUString() )
+ ) const;
+ static void getMapName( const String& rOrgName, String& rShortName, String& rFamilyName, FontWeight& rWeight, FontWidth& rWidth, ULONG& rType );
+};
+
+} // namespace utl
+
+#endif // _UNOTOOLS_FONTCFG_HXX
diff --git a/unotools/inc/unotools/fontcvt.hxx b/unotools/inc/unotools/fontcvt.hxx
new file mode 100644
index 000000000000..333ee36e706d
--- /dev/null
+++ b/unotools/inc/unotools/fontcvt.hxx
@@ -0,0 +1,79 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _UNOTOOLS_FONTCVT_HXX
+#define _UNOTOOLS_FONTCVT_HXX
+
+#include <unotools/unotoolsdllapi.h>
+#include <tools/string.hxx>
+
+// ------------------
+// - FontToSubsFont -
+// ------------------
+
+#define FONTTOSUBSFONT_IMPORT ((ULONG)0x00000001)
+#define FONTTOSUBSFONT_EXPORT ((ULONG)0x00000002)
+#define FONTTOSUBSFONT_ONLYOLDSOSYMBOLFONTS ((ULONG)0x00000004)
+
+typedef void* FontToSubsFontConverter;
+UNOTOOLS_DLLPUBLIC FontToSubsFontConverter CreateFontToSubsFontConverter( const String& rFontName, ULONG nFlags );
+UNOTOOLS_DLLPUBLIC void DestroyFontToSubsFontConverter( FontToSubsFontConverter hConverter );
+UNOTOOLS_DLLPUBLIC sal_Unicode ConvertFontToSubsFontChar( FontToSubsFontConverter hConverter, sal_Unicode c );
+UNOTOOLS_DLLPUBLIC String GetFontToSubsFontName( FontToSubsFontConverter hConverter );
+
+// ---------------------------
+// - StarSymbolToMSMultiFont -
+// ---------------------------
+
+class UNOTOOLS_DLLPUBLIC StarSymbolToMSMultiFont
+{
+public:
+ //Returns the name of the best windows symbol font which this char can be
+ //mapped to. Sets rChar to the correct position for that font. If no
+ //match found, then no name is returned, and rChar is unchanged. If you
+ //want to convert a string, you don't want to use this.
+ virtual String ConvertChar(sal_Unicode &rChar) = 0;
+
+ //Starts converting the string at position rIndex. It converts as much of
+ //the string that can be converted to the same symbol font and returns the
+ //name of that font. rIndex is modified to the last index that was
+ //converted. Typically you call if continously until rIndex ==
+ //rString.Len() and handle each section as seperate 8bit strings using
+ //seperate fonts. Will return an empty string for a continous section
+ //that has no possible mapping.
+ virtual String ConvertString(String &rString, xub_StrLen &rIndex) = 0;
+ virtual ~StarSymbolToMSMultiFont() {}
+};
+
+//with bPerfect set the converter will only try and convert symbols which have
+//perfect mappings to the windows symbols fonts. With it not set, it will
+//allow somewhat more dubious transformations that are nevertheless
+//recognizably similiar. Even in this mode there will be characters that fail.
+//The users of this might want to make a distinction between failed characters
+//which were inside and those outside the unicode private area.
+UNOTOOLS_DLLPUBLIC StarSymbolToMSMultiFont *CreateStarSymbolToMSMultiFont(bool bPerfectOnly=false);
+#endif // _UNOTOOLS_FONTCVT_HXX
diff --git a/unotools/inc/unotools/fontdefs.hxx b/unotools/inc/unotools/fontdefs.hxx
new file mode 100644
index 000000000000..12868aabe525
--- /dev/null
+++ b/unotools/inc/unotools/fontdefs.hxx
@@ -0,0 +1,110 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _UNOTOOLS_FONTDEFS_HXX
+#define _UNOTOOLS_FONTDEFS_HXX
+
+#include <unotools/unotoolsdllapi.h>
+#include <sal/types.h>
+#include <tools/string.hxx>
+
+namespace utl {
+ class FontSubstConfiguration;
+ struct FontNameAttr;
+}
+
+// ----------------
+// - SubsFontName -
+// ----------------
+
+#define SUBSFONT_ONLYONE ((ULONG)0x00000001)
+#define SUBSFONT_MS ((ULONG)0x00000002)
+#define SUBSFONT_PS ((ULONG)0x00000004)
+#define SUBSFONT_HTML ((ULONG)0x00000008)
+
+UNOTOOLS_DLLPUBLIC String GetSubsFontName( const String& rName, ULONG nFlags );
+
+// -----------------
+// - FontTokenName -
+// -----------------
+
+UNOTOOLS_DLLPUBLIC String GetFontToken( const String& rName, xub_StrLen nToken, xub_StrLen& rIndex );
+inline String GetFontToken( const String& rName, xub_StrLen nToken )
+{
+ xub_StrLen nTempIndex = 0;
+ return GetFontToken( rName, nToken, nTempIndex );
+}
+
+UNOTOOLS_DLLPUBLIC void AddTokenFontName( String& rName, const String& rNewToken );
+
+struct UNOTOOLS_DLLPUBLIC FontNameHash { int operator()(const String&) const; };
+
+// ---------------
+// - ConvertChar -
+// ---------------
+
+class UNOTOOLS_DLLPUBLIC ConvertChar
+{
+public:
+ const sal_Unicode* mpCvtTab;
+ const char* mpSubsFontName;
+ sal_Unicode (*mpCvtFunc)( sal_Unicode );
+ sal_Unicode RecodeChar( sal_Unicode c ) const;
+ void RecodeString( String& rStra, xub_StrLen nIndex, xub_StrLen nLen ) const;
+ static const ConvertChar* GetRecodeData( const String& rOrgFontName, const String& rMapFontName );
+};
+
+
+// Default-Font
+#define DEFAULTFONT_SANS_UNICODE ((USHORT)1)
+#define DEFAULTFONT_SANS ((USHORT)2)
+#define DEFAULTFONT_SERIF ((USHORT)3)
+#define DEFAULTFONT_FIXED ((USHORT)4)
+#define DEFAULTFONT_SYMBOL ((USHORT)5)
+#define DEFAULTFONT_UI_SANS ((USHORT)1000)
+#define DEFAULTFONT_UI_FIXED ((USHORT)1001)
+#define DEFAULTFONT_LATIN_TEXT ((USHORT)2000)
+#define DEFAULTFONT_LATIN_PRESENTATION ((USHORT)2001)
+#define DEFAULTFONT_LATIN_SPREADSHEET ((USHORT)2002)
+#define DEFAULTFONT_LATIN_HEADING ((USHORT)2003)
+#define DEFAULTFONT_LATIN_DISPLAY ((USHORT)2004)
+#define DEFAULTFONT_LATIN_FIXED ((USHORT)2005)
+#define DEFAULTFONT_CJK_TEXT ((USHORT)3000)
+#define DEFAULTFONT_CJK_PRESENTATION ((USHORT)3001)
+#define DEFAULTFONT_CJK_SPREADSHEET ((USHORT)3002)
+#define DEFAULTFONT_CJK_HEADING ((USHORT)3003)
+#define DEFAULTFONT_CJK_DISPLAY ((USHORT)3004)
+#define DEFAULTFONT_CTL_TEXT ((USHORT)4000)
+#define DEFAULTFONT_CTL_PRESENTATION ((USHORT)4001)
+#define DEFAULTFONT_CTL_SPREADSHEET ((USHORT)4002)
+#define DEFAULTFONT_CTL_HEADING ((USHORT)4003)
+#define DEFAULTFONT_CTL_DISPLAY ((USHORT)4004)
+
+UNOTOOLS_DLLPUBLIC String GetNextFontToken( const String& rTokenStr, xub_StrLen& rIndex );
+
+UNOTOOLS_DLLPUBLIC void GetEnglishSearchFontName( String& rName );
+
+#endif
diff --git a/unotools/inc/unotools/fontoptions.hxx b/unotools/inc/unotools/fontoptions.hxx
new file mode 100644
index 000000000000..7809fb4380cf
--- /dev/null
+++ b/unotools/inc/unotools/fontoptions.hxx
@@ -0,0 +1,173 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef INCLUDED_unotools_FONTOPTIONS_HXX
+#define INCLUDED_unotools_FONTOPTIONS_HXX
+
+//_________________________________________________________________________________________________________________
+// includes
+//_________________________________________________________________________________________________________________
+
+#include "unotools/unotoolsdllapi.h"
+#include <sal/types.h>
+#include <osl/mutex.hxx>
+#include <rtl/ustring.hxx>
+#include <unotools/options.hxx>
+
+//_________________________________________________________________________________________________________________
+// forward declarations
+//_________________________________________________________________________________________________________________
+
+/*-************************************************************************************************************//**
+ @short forward declaration to our private date container implementation
+ @descr We use these class as internal member to support small memory requirements.
+ You can create the container if it is neccessary. The class which use these mechanism
+ is faster and smaller then a complete implementation!
+*//*-*************************************************************************************************************/
+
+class SvtFontOptions_Impl;
+
+//_________________________________________________________________________________________________________________
+// declarations
+//_________________________________________________________________________________________________________________
+
+/*-************************************************************************************************************//**
+ @short collect informations about font features
+ @descr -
+
+ @implements -
+ @base -
+
+ @devstatus ready to use
+*//*-*************************************************************************************************************/
+
+class UNOTOOLS_DLLPUBLIC SvtFontOptions: public utl::detail::Options
+{
+ //-------------------------------------------------------------------------------------------------------------
+ // public methods
+ //-------------------------------------------------------------------------------------------------------------
+
+ public:
+
+ //---------------------------------------------------------------------------------------------------------
+ // constructor / destructor
+ //---------------------------------------------------------------------------------------------------------
+
+ /*-****************************************************************************************************//**
+ @short standard constructor and destructor
+ @descr This will initialize an instance with default values.
+ We implement these class with a refcount mechanism! Every instance of this class increase it
+ at create and decrease it at delete time - but all instances use the same data container!
+ He is implemented as a static member ...
+
+ @seealso member m_nRefCount
+ @seealso member m_pDataContainer
+
+ @param -
+ @return -
+
+ @onerror -
+ *//*-*****************************************************************************************************/
+
+ SvtFontOptions();
+ virtual ~SvtFontOptions();
+
+ //---------------------------------------------------------------------------------------------------------
+ // interface
+ //---------------------------------------------------------------------------------------------------------
+
+ /*-****************************************************************************************************//**
+ @short interface methods to get and set value of config key "org.openoffice.Office.Common/Font"
+ @descr These values defines different states of font handling.
+
+ ..ReplacementTable..() => Determines if the list of font replacements is applied or not.
+
+ ..FontHistory..() => The last 5 fonts will be shown and the last one will be the
+ first name on the list. These will be displayed in the Font name
+ combo box on the Object bar.
+
+ ..FontWYSIWYG..() => With this option the names of the selectable fonts
+ (for example, the fonts in the Font field in the object bar)
+ will be formatted as the current font.
+
+ @seealso -
+
+ @param -
+ @return -
+
+ @onerror No error should occurre!
+ *//*-*****************************************************************************************************/
+
+ sal_Bool IsReplacementTableEnabled ( ) const ;
+ void EnableReplacementTable ( sal_Bool bState ) ;
+
+ sal_Bool IsFontHistoryEnabled ( ) const ;
+ void EnableFontHistory ( sal_Bool bState ) ;
+
+ sal_Bool IsFontWYSIWYGEnabled ( ) const ;
+ void EnableFontWYSIWYG ( sal_Bool bState ) ;
+
+ //-------------------------------------------------------------------------------------------------------------
+ // private methods
+ //-------------------------------------------------------------------------------------------------------------
+
+ private:
+
+ /*-****************************************************************************************************//**
+ @short return a reference to a static mutex
+ @descr These class use his own static mutex to be threadsafe.
+ We create a static mutex only for one ime and use at different times.
+
+ @seealso -
+
+ @param -
+ @return A reference to a static mutex member.
+
+ @onerror -
+ *//*-*****************************************************************************************************/
+
+ UNOTOOLS_DLLPRIVATE static ::osl::Mutex& impl_GetOwnStaticMutex();
+
+ //-------------------------------------------------------------------------------------------------------------
+ // private member
+ //-------------------------------------------------------------------------------------------------------------
+
+ private:
+
+ /*Attention
+
+ Don't initialize these static member in these header!
+ a) Double dfined symbols will be detected ...
+ b) and unresolved externals exist at linking time.
+ Do it in your source only.
+ */
+
+ static SvtFontOptions_Impl* m_pDataContainer ; /// impl. data container as dynamic pointer for smaller memory requirements!
+ static sal_Int32 m_nRefCount ; /// internal ref count mechanism
+
+}; // class SvtFontOptions
+
+#endif // #ifndef INCLUDED_unotools_FONTOPTIONS_HXX
diff --git a/unotools/inc/unotools/historyoptions.hxx b/unotools/inc/unotools/historyoptions.hxx
new file mode 100644
index 000000000000..50b411e5d17e
--- /dev/null
+++ b/unotools/inc/unotools/historyoptions.hxx
@@ -0,0 +1,248 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef INCLUDED_SVTOOLS_HISTORYOPTIONS_HXX
+#define INCLUDED_SVTOOLS_HISTORYOPTIONS_HXX
+
+//_________________________________________________________________________________________________________________
+// includes
+//_________________________________________________________________________________________________________________
+
+#include "unotools/unotoolsdllapi.h"
+#include <sal/types.h>
+#include <osl/mutex.hxx>
+#include <com/sun/star/uno/Sequence.h>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <rtl/ustring.hxx>
+#include <unotools/options.hxx>
+
+//_________________________________________________________________________________________________________________
+// types, enums, ...
+//_________________________________________________________________________________________________________________
+
+/*-************************************************************************************************************//**
+ @descr The method GetList() returns a list of property values.
+ Use follow defines to seperate values by names.
+*//*-*************************************************************************************************************/
+
+#define HISTORY_PROPERTYNAME_URL ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("URL" ))
+#define HISTORY_PROPERTYNAME_FILTER ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Filter" ))
+#define HISTORY_PROPERTYNAME_TITLE ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Title" ))
+#define HISTORY_PROPERTYNAME_PASSWORD ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Password" ))
+
+/*-************************************************************************************************************//**
+ @descr You can use these enum values to specify right history if you call ouer interface methods.
+*//*-*************************************************************************************************************/
+
+enum EHistoryType
+{
+ ePICKLIST = 0,
+ eHISTORY = 1,
+ eHELPBOOKMARKS = 2
+};
+
+//_________________________________________________________________________________________________________________
+// forward declarations
+//_________________________________________________________________________________________________________________
+
+/*-************************************************************************************************************//**
+ @short forward declaration to our private date container implementation
+ @descr We use these class as internal member to support small memory requirements.
+ You can create the container if it is neccessary. The class which use these mechanism
+ is faster and smaller then a complete implementation!
+*//*-*************************************************************************************************************/
+
+class SvtHistoryOptions_Impl;
+
+//_________________________________________________________________________________________________________________
+// declarations
+//_________________________________________________________________________________________________________________
+
+/*-************************************************************************************************************//**
+ @short collect informations about history features
+ @descr -
+
+ @implements -
+ @base -
+
+ @devstatus ready to use
+*//*-*************************************************************************************************************/
+
+class UNOTOOLS_DLLPUBLIC SvtHistoryOptions: public utl::detail::Options
+{
+ //-------------------------------------------------------------------------------------------------------------
+ // public methods
+ //-------------------------------------------------------------------------------------------------------------
+
+ public:
+
+ //---------------------------------------------------------------------------------------------------------
+ // constructor / destructor
+ //---------------------------------------------------------------------------------------------------------
+
+ /*-****************************************************************************************************//**
+ @short standard constructor and destructor
+ @descr This will initialize an instance with default values.
+ We implement these class with a refcount mechanism! Every instance of this class increase it
+ at create and decrease it at delete time - but all instances use the same data container!
+ He is implemented as a static member ...
+
+ @seealso member m_nRefCount
+ @seealso member m_pDataContainer
+
+ @param -
+ @return -
+
+ @onerror -
+ *//*-*****************************************************************************************************/
+
+ SvtHistoryOptions();
+ virtual ~SvtHistoryOptions();
+
+ //---------------------------------------------------------------------------------------------------------
+ // interface
+ //---------------------------------------------------------------------------------------------------------
+
+ /*-****************************************************************************************************//**
+ @short interface methods to get and set value of config key "org.openoffice.Office.Common/History/..."
+ @descr key "PickList" : The last used documents displayed in the file menu.
+ key "History" : The last opened documents general.
+ *//*-*****************************************************************************************************/
+
+ /*-****************************************************************************************************//**
+ @short set/get max size of specified history
+ @descr Call this methods to get information about max. size of specified list.
+ These value lay down the max count of items in these history. If a new one
+ is add to it the oldest one is deleted automaticly!
+
+ @seealso -
+
+ @param "eHistory" select right history.
+ @param "nSize" is the new max size of specified list. If new size smaller then the old one
+ some oldest entries will be destroyed automaticly!
+ @return Current max size of specified list.
+
+ @onerror -
+ *//*-*****************************************************************************************************/
+
+ sal_uInt32 GetSize( EHistoryType eHistory ) const ;
+ void SetSize( EHistoryType eHistory, sal_uInt32 nSize ) ;
+
+ /*-****************************************************************************************************//**
+ @short clear complete sepcified list
+ @descr Call this methods to clear the whole list. After that GetItemCount() will return 0 ...
+ but GetSize() will return the old value!
+
+ @seealso -
+
+ @param "eHistory" select right history.
+ @return -
+
+ @onerror -
+ *//*-*****************************************************************************************************/
+
+ void Clear( EHistoryType eHistory );
+
+ /*-****************************************************************************************************//**
+ @short return complete sepcified list
+ @descr If you will show the whole list call this method to get it completly.
+
+ @seealso -
+
+ @param "eHistory" select right history.
+ @return A list of history items is returned.
+
+ @onerror -
+ *//*-*****************************************************************************************************/
+
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > > GetList( EHistoryType eHistory ) const ;
+
+ /*-****************************************************************************************************//**
+ @short append a new item to specified list
+ @descr You can append items to a list only - removing isn't allowed for a special item!
+ The oldest entry is deleted automaticly if max size arrived or you can call Clear() ...
+ It exist two different overload methods to do this.
+ One for user which have an complete history item and another one for uncompletly data sets!
+
+ @seealso method SetSize()
+ @seealso method Clear()
+
+ @param "eHistory" select right history.
+ @param "sURL" URL to save in history
+ @param "sFilter" filter name to save in history
+ @param "sTitle" document title to save in history
+ @param "sPassword" password to save in history
+ @return -
+
+ @onerror -
+ *//*-*****************************************************************************************************/
+
+ void AppendItem( EHistoryType eHistory ,
+ const ::rtl::OUString& sURL ,
+ const ::rtl::OUString& sFilter ,
+ const ::rtl::OUString& sTitle ,
+ const ::rtl::OUString& sPassword );
+
+ //-------------------------------------------------------------------------------------------------------------
+ // private methods
+ //-------------------------------------------------------------------------------------------------------------
+
+ private:
+
+ /*-****************************************************************************************************//**
+ @short return a reference to a static mutex
+ @descr Make these class threadsafe.
+
+ @seealso -
+
+ @param -
+ @return A reference to a static mutex member.
+
+ @onerror -
+ *//*-*****************************************************************************************************/
+
+ UNOTOOLS_DLLPRIVATE static ::osl::Mutex& GetOwnStaticMutex();
+
+ //-------------------------------------------------------------------------------------------------------------
+ // private member
+ //-------------------------------------------------------------------------------------------------------------
+
+ private:
+
+ /*Attention
+
+ Don't initialize these static member in these header!
+ a) Double dfined symbols will be detected ...
+ b) and unresolved externals exist at linking time.
+ Do it in your source only.
+ */
+
+ static SvtHistoryOptions_Impl* m_pDataContainer ; /// impl. data container as dynamic pointer for smaller memory requirements!
+ static sal_Int32 m_nRefCount ; /// internal ref count mechanism
+
+}; // class SvtHistoryOptions
+
+#endif // #ifndef INCLUDED_SVTOOLS_HISTORYOPTIONS_HXX
diff --git a/unotools/inc/unotools/historyoptions_const.hxx b/unotools/inc/unotools/historyoptions_const.hxx
new file mode 100644
index 000000000000..1d57d5146666
--- /dev/null
+++ b/unotools/inc/unotools/historyoptions_const.hxx
@@ -0,0 +1,55 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_unotools.hxx"
+
+#ifndef INCLUDE_CONFIGITEMS_HISTORYOPTIONS_CONST_HXX
+#define INCLUDE_CONFIGITEMS_HISTORYOPTIONS_CONST_HXX
+
+#include <rtl/ustring.hxx>
+
+namespace
+{
+ static const ::rtl::OUString s_sCommonHistory = ::rtl::OUString::createFromAscii("org.openoffice.Office.Common/History");
+ static const ::rtl::OUString s_sHistories = ::rtl::OUString::createFromAscii("org.openoffice.Office.Histories/Histories");
+ static const ::rtl::OUString s_sPickListSize = ::rtl::OUString::createFromAscii("PickListSize");
+ static const ::rtl::OUString s_sURLHistorySize = ::rtl::OUString::createFromAscii("Size");
+ static const ::rtl::OUString s_sHelpBookmarksSize = ::rtl::OUString::createFromAscii("HelpBookmarkSize");
+ static const ::rtl::OUString s_sPickList = ::rtl::OUString::createFromAscii("PickList");
+ static const ::rtl::OUString s_sURLHistory = ::rtl::OUString::createFromAscii("URLHistory");
+ static const ::rtl::OUString s_sHelpBookmarks = ::rtl::OUString::createFromAscii("HelpBookmarks");
+ static const ::rtl::OUString s_sItemList = ::rtl::OUString::createFromAscii("ItemList");
+ static const ::rtl::OUString s_sOrderList = ::rtl::OUString::createFromAscii("OrderList");
+ static const ::rtl::OUString s_sHistoryItemRef = ::rtl::OUString::createFromAscii("HistoryItemRef");
+ static const ::rtl::OUString s_sURL = ::rtl::OUString::createFromAscii("URL");
+ static const ::rtl::OUString s_sFilter = ::rtl::OUString::createFromAscii("Filter");
+ static const ::rtl::OUString s_sTitle = ::rtl::OUString::createFromAscii("Title");
+ static const ::rtl::OUString s_sPassword = ::rtl::OUString::createFromAscii("Password");
+}
+
+#endif // INCLUDE_CONFIGITEMS_HISTORYOPTIONS_CONST_HXX
diff --git a/unotools/inc/unotools/idhelper.hxx b/unotools/inc/unotools/idhelper.hxx
new file mode 100644
index 000000000000..d8c734025b12
--- /dev/null
+++ b/unotools/inc/unotools/idhelper.hxx
@@ -0,0 +1,210 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _UNOTOOLS_ID_HELPER_HXX_
+#define _UNOTOOLS_ID_HELPER_HXX_
+
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <osl/mutex.hxx>
+#include <comphelper/stl_types.hxx>
+#include <cppuhelper/typeprovider.hxx>
+#include <tools/debug.hxx>
+
+//.........................................................................
+namespace utl
+{
+//.........................................................................
+
+//=========================================================================
+// to shorten some lines ...
+typedef ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > TypeSequence;
+
+// compare to Sequences of Types
+struct TypeSequenceLess : public ::std::binary_function<TypeSequence, TypeSequence, bool>
+{
+public:
+ inline bool operator() (const TypeSequence& lhs, const TypeSequence& rhs) const
+ {
+ sal_Int32 nLengthLeft = lhs.getLength();
+ sal_Int32 nLengthRight = rhs.getLength();
+
+ // first check the two lengths
+ if (nLengthLeft < nLengthRight)
+ return sal_True;
+ if (nLengthLeft > nLengthRight)
+ return sal_False;
+
+ // both sequences have the same length -> check the type names
+ const ::com::sun::star::uno::Type* pTypesLeft = lhs.getConstArray();
+ const ::com::sun::star::uno::Type* pTypesRight = rhs.getConstArray();
+ for (sal_Int32 i=0; i<nLengthLeft; ++i, ++pTypesLeft, ++pTypesRight)
+ {
+ sal_Int32 nTypeNameCompare = pTypesLeft->getTypeName().compareTo(pTypesRight->getTypeName());
+ if (nTypeNameCompare < 0)
+ return sal_True;
+ if (nTypeNameCompare > 0)
+ return sal_False;
+ }
+
+ // both sequences are equal ...
+ return sal_False;
+ }
+};
+
+// declare the map
+DECLARE_STL_MAP ( TypeSequence,
+ ::cppu::OImplementationId,
+ TypeSequenceLess,
+ MapType2Id
+ );
+
+//.........................................................................
+} // namespace utl
+//.........................................................................
+
+//=========================================================================
+/** defines a helper class for implementing the XTypeProvider::getImplementationId.
+ it maps sequences of ::com::sun::star::uno::Type to implementation ids
+ (which means sequences of bytes).<BR>
+ As there is no possibility to determine the time where the id's are no longer
+ needed (e.g. because the last instance of the class using this mechanism died)
+ the helper is "refcounted", i.e. there are acquire and release methods.
+ To simplify this there is a class classname##Ref which you may want to
+ use as an member of your classes.
+ <BR><BR>
+ As we don't want a global helper class which handles implementation id's
+ of components from all over the office (supposing somebody want's to use this :)
+ this is only a define. Wherever you have a "closed" area (which is small enough
+ and large enough :), see below) where diffenrent components want to use an id helper,
+ define your own one with this macro.<BR>
+ The more classes use this helper, the later redundant map entries will be
+ cleared. The less classes use it, the earlier map entries which may have
+ been reused will be cleared.
+*/
+#define DECLARE_IMPLEMENTATIONID_HELPER(_namespace, classname) \
+namespace _namespace { \
+class classname \
+{ \
+ friend class classname##Ref; \
+ \
+ static sal_Int32 s_nReferenced; \
+ static void* s_pMap; \
+ \
+ static ::osl::Mutex s_aMutex; \
+ \
+public: \
+ static void acquire(); \
+ static void release(); \
+ \
+ static ::com::sun::star::uno::Sequence< sal_Int8 > getImplementationId( \
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >& _rTypes); \
+ \
+private: \
+ static void implCreateMap(); \
+ \
+ classname() { } \
+}; \
+ \
+/*=======================================================================*/ \
+class classname##Ref \
+{ \
+public: \
+ classname##Ref() { classname::acquire(); } \
+ ~classname##Ref() { classname::release(); } \
+}; \
+ \
+} /* _namespace */ \
+ \
+
+/*************************************************************************
+**************************************************************************
+*************************************************************************/
+
+/** implement an id helper
+*/
+#define IMPLEMENT_IMPLEMENTATIONID_HELPER(_namespace, classname) \
+namespace _namespace { \
+ \
+/*=======================================================================*/ \
+ \
+sal_Int32 classname::s_nReferenced(0); \
+void* classname::s_pMap = NULL; \
+::osl::Mutex classname::s_aMutex; \
+ \
+/*-----------------------------------------------------------------------*/ \
+void classname::acquire() \
+{ \
+ ::osl::MutexGuard aGuard(s_aMutex); \
+ ++s_nReferenced; \
+} \
+ \
+/*-----------------------------------------------------------------------*/ \
+void classname::release() \
+{ \
+ ::osl::MutexGuard aGuard(s_aMutex); \
+ if (!--s_nReferenced) \
+ { \
+ delete static_cast< ::utl::MapType2Id *>( s_pMap ); \
+ s_pMap = NULL; \
+ } \
+} \
+ \
+/*-----------------------------------------------------------------------*/ \
+::com::sun::star::uno::Sequence< sal_Int8 > classname::getImplementationId( \
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >& _rTypes) \
+{ \
+ ::osl::MutexGuard aGuard(s_aMutex); \
+ DBG_ASSERT(s_nReferenced, \
+ "classname::getImplementationId : you need to hold a reference to this class in order to use it !"); \
+ /* give the calling class a member of type classname##Ref and all is fine .... */ \
+ \
+ implCreateMap(); \
+ \
+ ::utl::MapType2Id* pMap = static_cast< ::utl::MapType2Id *>(s_pMap); \
+ \
+ ::cppu::OImplementationId& rId = (*pMap)[_rTypes]; \
+ /* this will create an entry for the given type sequence, if neccessary */ \
+ \
+ return rId.getImplementationId(); \
+} \
+ \
+/*-----------------------------------------------------------------------*/ \
+void classname::implCreateMap() \
+{ \
+ if (s_pMap) \
+ return; \
+ s_pMap = new ::utl::MapType2Id(); \
+} \
+ \
+ \
+} /* _namespace */ \
+ \
+
+
+#endif // _UNOTOOLS_ID_HELPER_HXX_
+
diff --git a/unotools/inc/unotools/inetoptions.hxx b/unotools/inc/unotools/inetoptions.hxx
new file mode 100644
index 000000000000..f69d3d211c9c
--- /dev/null
+++ b/unotools/inc/unotools/inetoptions.hxx
@@ -0,0 +1,143 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _unotools_INETOPTIONS_HXX_
+#define _unotools_INETOPTIONS_HXX_
+
+#include "unotools/unotoolsdllapi.h"
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <sal/types.h>
+#include <unotools/options.hxx>
+
+namespace com { namespace sun { namespace star { namespace beans {
+ class XPropertiesChangeListener;
+} } } }
+namespace rtl { class OUString; }
+
+//============================================================================
+/** The names of all the properties (options) accessible through
+ SvtInetOptions.
+
+ @descr These names are used in the methods
+ SvtInetOptions::addPropertiesChangeListener() and
+ SvtInetOptions::removePropertiesChangeListener().
+ */
+#define SVT_INET_OPTION_PROXY_NO_PROXY "Inet/Proxy/NoProxy"
+#define SVT_INET_OPTION_PROXY_TYPE "Inet/Proxy/Type"
+#define SVT_INET_OPTION_PROXY_FTP_NAME "Inet/Proxy/FTP/Name"
+#define SVT_INET_OPTION_PROXY_FTP_PORT "Inet/Proxy/FTP/Port"
+#define SVT_INET_OPTION_PROXY_HTTP_NAME "Inet/Proxy/HTTP/Name"
+#define SVT_INET_OPTION_PROXY_HTTP_PORT "Inet/Proxy/HTTP/Port"
+
+//============================================================================
+/** Interface to access those configuration database entries that are related
+ to the various Internet services.
+
+ @descr The Set...() methods all have a second parameter bFlush. If false
+ is passed (the default), the new value is not written back directly, but
+ only cached within this class. If the value in the configuration database
+ is also changed, the cached change will get lost. If, on the other hand,
+ true is passed, the new value is instantly written back to the
+ configuration database.
+ */
+class UNOTOOLS_DLLPUBLIC SvtInetOptions: public utl::detail::Options
+{
+public:
+ SvtInetOptions();
+
+ virtual ~SvtInetOptions();
+
+ enum ProxyType { NONE, AUTOMATIC, MANUAL };
+
+ rtl::OUString GetProxyNoProxy() const;
+
+ sal_Int32 GetProxyType() const;
+
+ rtl::OUString GetProxyFtpName() const;
+
+ sal_Int32 GetProxyFtpPort() const;
+
+ rtl::OUString GetProxyHttpName() const;
+
+ sal_Int32 GetProxyHttpPort() const;
+
+ void SetProxyNoProxy(rtl::OUString const & rValue, bool bFlush = false);
+
+ void SetProxyType(ProxyType eValue, bool bFlush = false);
+
+ void SetProxyFtpName(rtl::OUString const & rValue, bool bFlush = false);
+
+ void SetProxyFtpPort(sal_Int32 nValue, bool bFlush = false);
+
+ void SetProxyHttpName(rtl::OUString const & rValue, bool bFlush = false);
+
+ void SetProxyHttpPort(sal_Int32 nValue, bool bFlush = false);
+
+ void flush();
+
+ /** Add a listener on changes of certain properties (options).
+
+ @param rPropertyNames The names of the properties (options). If an
+ empty sequence is used, nothing is done.
+
+ @param rListener A listener. If the listener is already registered
+ on other properties, it continues to also get notifications about
+ changes of those properties. The
+ com::sun::star::beans::PropertyChangeEvents supplied to the listener
+ will have void OldValue and NewValue slots.
+ */
+ void
+ addPropertiesChangeListener(
+ com::sun::star::uno::Sequence< rtl::OUString > const & rPropertyNames,
+ com::sun::star::uno::Reference<
+ com::sun::star::beans::XPropertiesChangeListener > const &
+ rListener);
+
+ /** Remove a listener on changes of certain properties (options).
+
+ @param rPropertyNames The names of the properties (options). If an
+ empty sequence is used, nothing is done.
+
+ @param rListener A listener. If the listener is still registered on
+ other properties, it continues to get notifications about changes of
+ those properties.
+ */
+ void
+ removePropertiesChangeListener(
+ com::sun::star::uno::Sequence< rtl::OUString > const & rPropertyNames,
+ com::sun::star::uno::Reference<
+ com::sun::star::beans::XPropertiesChangeListener > const &
+ rListener);
+
+private:
+ class Impl;
+
+ static Impl * m_pImpl;
+};
+
+#endif // _unotools_INETOPTIONS_HXX_
diff --git a/unotools/inc/unotools/internaloptions.hxx b/unotools/inc/unotools/internaloptions.hxx
new file mode 100644
index 000000000000..7e2be078811d
--- /dev/null
+++ b/unotools/inc/unotools/internaloptions.hxx
@@ -0,0 +1,180 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef INCLUDED_unotools_INTERNALOPTIONS_HXX
+#define INCLUDED_unotools_INTERNALOPTIONS_HXX
+
+//_________________________________________________________________________________________________________________
+// includes
+//_________________________________________________________________________________________________________________
+
+#include "unotools/unotoolsdllapi.h"
+#include <sal/types.h>
+#include <osl/mutex.hxx>
+#include <rtl/ustring.hxx>
+#include <unotools/options.hxx>
+
+//_________________________________________________________________________________________________________________
+// namespaces!
+//_________________________________________________________________________________________________________________
+
+#define MUTEX ::osl::Mutex
+#define OUSTRING ::rtl::OUString
+
+//_________________________________________________________________________________________________________________
+// forward declarations
+//_________________________________________________________________________________________________________________
+
+/*-************************************************************************************************************//**
+ @short forward declaration to our private date container implementation
+ @descr We use these class as internal member to support small memory requirements.
+ You can create the container if it is neccessary. The class which use these mechanism
+ is faster and smaller then a complete implementation!
+*//*-*************************************************************************************************************/
+
+class SvtInternalOptions_Impl;
+
+//_________________________________________________________________________________________________________________
+// declarations
+//_________________________________________________________________________________________________________________
+
+/*-************************************************************************************************************//**
+ @short collect informations about internal features
+ @descr -
+
+ @implements -
+ @base -
+
+ @ATTENTION This class is partially threadsafe.
+
+ @devstatus ready to use
+*//*-*************************************************************************************************************/
+
+class UNOTOOLS_DLLPUBLIC SvtInternalOptions: public utl::detail::Options
+{
+ //-------------------------------------------------------------------------------------------------------------
+ // public methods
+ //-------------------------------------------------------------------------------------------------------------
+
+ public:
+
+ //---------------------------------------------------------------------------------------------------------
+ // constructor / destructor
+ //---------------------------------------------------------------------------------------------------------
+
+ /*-****************************************************************************************************//**
+ @short standard constructor and destructor
+ @descr This will initialize an instance with default values.
+ We implement these class with a refcount mechanism! Every instance of this class increase it
+ at create and decrease it at delete time - but all instances use the same data container!
+ He is implemented as a static member ...
+
+ @seealso member m_nRefCount
+ @seealso member m_pDataContainer
+
+ @param -
+ @return -
+
+ @onerror -
+ *//*-*****************************************************************************************************/
+
+ SvtInternalOptions();
+ virtual ~SvtInternalOptions();
+
+ //---------------------------------------------------------------------------------------------------------
+ // interface
+ //---------------------------------------------------------------------------------------------------------
+
+ /*-****************************************************************************************************//**
+ @short interface methods to get and set value of config key "org.openoffice.Office.Common/Internal/..."
+ @descr These options describe internal states to enable/disable features of installed office.
+ The values are fixed at runtime - and implemented as readonly!
+
+ SlotCFGEnabled() => If this option is set (true), StarOffice is searching for the slot.cfg.
+ If the slot.cfg cannot be found, the start is aborted.
+ If this option is not set (false), the slot.cfg must not be available,
+ otherwise the start is also aborted.
+
+ CrashMailEnabled() => Crash-Mail-Feature to document program crashes. After a crash,
+ an e-mail with information about the system used is generated
+ automatically when starting StarOffice.
+
+ @seealso configuration package "org.openoffice.Office.Common/Internal"
+ *//*-*****************************************************************************************************/
+
+ sal_Bool SlotCFGEnabled () const;
+ sal_Bool CrashMailEnabled () const;
+ sal_Bool MailUIEnabled () const;
+ sal_Bool IsRemoveMenuEntryClose() const;
+ sal_Bool IsRemoveMenuEntryBackToWebtop() const;
+ sal_Bool IsRemoveMenuEntryNewWebtop() const;
+ sal_Bool IsRemoveMenuEntryLogout() const;
+
+ OUSTRING GetCurrentTempURL() const;
+ void SetCurrentTempURL( const OUSTRING& aNewCurrentTempURL );
+
+ //-------------------------------------------------------------------------------------------------------------
+ // private methods
+ //-------------------------------------------------------------------------------------------------------------
+
+ private:
+
+ /*-****************************************************************************************************//**
+ @short return a reference to a static mutex
+ @descr These class is partially threadsafe (for de-/initialization only).
+ All access methods are'nt safe!
+ We create a static mutex only for one ime and use at different times.
+
+ @seealso -
+
+ @param -
+ @return A reference to a static mutex member.
+
+ @onerror -
+ *//*-*****************************************************************************************************/
+
+ UNOTOOLS_DLLPRIVATE static MUTEX& GetOwnStaticMutex();
+
+ //-------------------------------------------------------------------------------------------------------------
+ // private member
+ //-------------------------------------------------------------------------------------------------------------
+
+ private:
+
+ /*Attention
+
+ Don't initialize these static member in these header!
+ a) Double dfined symbols will be detected ...
+ b) and unresolved externals exist at linking time.
+ Do it in your source only.
+ */
+
+ static SvtInternalOptions_Impl* m_pDataContainer ; /// impl. data container as dynamic pointer for smaller memory requirements!
+ static sal_Int32 m_nRefCount ; /// internal ref count mechanism
+
+}; // class SvtInternalOptions
+
+#endif // #ifndef INCLUDED_unotools_INTERNALOPTIONS_HXX
diff --git a/unotools/inc/unotools/intlwrapper.hxx b/unotools/inc/unotools/intlwrapper.hxx
new file mode 100644
index 000000000000..e35f4cc9268f
--- /dev/null
+++ b/unotools/inc/unotools/intlwrapper.hxx
@@ -0,0 +1,123 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "unotools/unotoolsdllapi.h"
+
+#ifndef _UNOTOOLS_INTLWRAPPER_HXX
+#define _UNOTOOLS_INTLWRAPPER_HXX
+#include <unotools/charclass.hxx>
+#include <unotools/localedatawrapper.hxx>
+#include <unotools/calendarwrapper.hxx>
+#include <unotools/collatorwrapper.hxx>
+#include <i18npool/lang.h>
+
+
+/**
+ A wrapper of I18N wrappers. Using this is more expensive than using some
+ single wrapper classes so use it only if you must pass a single pointer
+ without knowing in advance what is needed, e.g. for
+ SfxPoolItem::GetPresentation(). Remember that this wrapper was only created
+ for convenience to bypass some oddities, if possible don't use it. <p>
+
+ Implemented are only the const get...() methods of the wrappers, which are
+ loaded on demand, for consistency reasons no change of locale is possible.
+ Only default calendar and default collator are supported. <p>
+
+ One exception though is the calendar wrapper: to be able to set a value and
+ retrieve calendar values it is not const, so methods using this should
+ reset the calendar to the previous value if it isn't sure where the
+ IntlWrapper did come from. <p>
+ */
+class UNOTOOLS_DLLPUBLIC IntlWrapper
+{
+private:
+
+ ::com::sun::star::lang::Locale aLocale;
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xSMgr;
+
+ CharClass* pCharClass;
+ LocaleDataWrapper* pLocaleData;
+ CalendarWrapper* pCalendar;
+ CollatorWrapper* pCollator;
+ CollatorWrapper* pCaseCollator;
+
+ LanguageType eLanguage;
+
+ void ImplNewCharClass() const;
+ void ImplNewLocaleData() const;
+ void ImplNewCalendar() const;
+ void ImplNewCollator( BOOL bCaseSensitive ) const;
+
+
+public:
+ IntlWrapper(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & xSF,
+ const ::com::sun::star::lang::Locale& rLocale
+ );
+ IntlWrapper(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & xSF,
+ LanguageType eLang
+ );
+ ~IntlWrapper();
+
+ LanguageType getLanguage() const { return eLanguage; }
+ const ::com::sun::star::lang::Locale& getLocale() const { return aLocale; }
+
+ const CharClass* getCharClass() const
+ {
+ if ( !pCharClass )
+ ImplNewCharClass();
+ return pCharClass;
+ }
+ const LocaleDataWrapper* getLocaleData() const
+ {
+ if ( !pLocaleData )
+ ImplNewLocaleData();
+ return pLocaleData;
+ }
+ CalendarWrapper* getCalendar() const
+ {
+ if ( !pCalendar )
+ ImplNewCalendar();
+ return pCalendar;
+ }
+ /// case insensitive collator, simple IGNORE_CASE
+ const CollatorWrapper* getCollator() const
+ {
+ if ( !pCollator )
+ ImplNewCollator( FALSE );
+ return pCollator;
+ }
+ /// case sensitive collator
+ const CollatorWrapper* getCaseCollator() const
+ {
+ if ( !pCaseCollator )
+ ImplNewCollator( TRUE );
+ return pCaseCollator;
+ }
+};
+
+#endif // _UNOTOOLS_INTLWRAPPER_HXX
diff --git a/unotools/inc/unotools/itemholderbase.hxx b/unotools/inc/unotools/itemholderbase.hxx
new file mode 100644
index 000000000000..df1892d41a12
--- /dev/null
+++ b/unotools/inc/unotools/itemholderbase.hxx
@@ -0,0 +1,128 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_unotools_ITEMHOLDERBASE_HXX_
+#define INCLUDED_unotools_ITEMHOLDERBASE_HXX_
+
+//-----------------------------------------------
+// includes
+
+#include <vector>
+#include <osl/mutex.hxx>
+
+namespace utl { namespace detail { class Options; } }
+
+//-----------------------------------------------
+// definitions
+
+struct ItemHolderMutexBase
+{
+ ::osl::Mutex m_aLock;
+};
+
+enum EItem
+{
+ E_ACCELCFG , //
+ E_ACCESSIBILITYOPTIONS , // 2
+ E_ADDXMLTOSTORAGEOPTIONS , //
+ E_APEARCFG , // 2
+
+ E_CJKOPTIONS , // 2
+ E_CMDOPTIONS , //
+ E_COLORCFG , // 2
+ E_COMPATIBILITY , //
+ E_CTLOPTIONS , // 2
+
+ E_DEFAULTOPTIONS , //
+ E_DYNAMICMENUOPTIONS , //
+
+ E_EVENTCFG , //
+ E_EXTENDEDSECURITYOPTIONS , //
+
+ E_FLTRCFG , //
+ E_FONTOPTIONS , //
+ E_FONTSUBSTCONFIG , // 2
+
+ E_HELPOPTIONS , // 2
+ E_HISTORYOPTIONS , //
+
+ E_INETOPTIONS , //
+ E_INTERNALOPTIONS , //
+
+ E_JAVAOPTIONS , //
+
+ E_LANGUAGEOPTIONS , // 2
+ E_LINGUCFG , //
+ E_LOCALISATIONOPTIONS , //
+
+ E_MENUOPTIONS , //
+ E_MISCCFG , // 2
+ E_MISCOPTIONS , //
+ E_MODULEOPTIONS , //
+
+ E_OPTIONSDLGOPTIONS , //
+
+ E_PATHOPTIONS , //
+ E_PRINTOPTIONS , // 2
+ E_PRINTFILEOPTIONS , // 2
+ E_PRINTWARNINGOPTIONS , //
+
+ E_REGOPTIONS , //
+
+ E_SAVEOPTIONS , //
+ E_SEARCHOPT , //
+ E_SECURITYOPTIONS , //
+ E_SOURCEVIEWCONFIG , //
+ E_STARTOPTIONS , //
+ E_SYSLOCALEOPTIONS , // 2
+
+ E_UNDOOPTIONS , // 2
+ E_USEROPTIONS , // 2
+
+ E_VIEWOPTIONS_DIALOG , //
+ E_VIEWOPTIONS_TABDIALOG , //
+ E_VIEWOPTIONS_TABPAGE , //
+ E_VIEWOPTIONS_WINDOW , //
+
+ E_WORKINGSETOPTIONS , //
+
+ E_XMLACCELCFG //
+};
+
+struct TItemInfo
+{
+ TItemInfo()
+ : pItem(0)
+ {}
+
+ utl::detail::Options * pItem;
+ EItem eItem;
+};
+
+typedef ::std::vector< TItemInfo > TItems;
+
+#endif // INCLUDED_unotools_ITEMHOLDERBASE_HXX_
diff --git a/unotools/inc/unotools/javaoptions.hxx b/unotools/inc/unotools/javaoptions.hxx
new file mode 100644
index 000000000000..38e023556716
--- /dev/null
+++ b/unotools/inc/unotools/javaoptions.hxx
@@ -0,0 +1,73 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _unotools_JAVAOPTIONS_HXX
+#define _unotools_JAVAOPTIONS_HXX
+
+#include "unotools/unotoolsdllapi.h"
+#include <sal/types.h>
+#include <unotools/configitem.hxx>
+
+
+// class SvtJavaOptions --------------------------------------------------
+
+struct SvtJavaOptions_Impl;
+
+class UNOTOOLS_DLLPUBLIC SvtJavaOptions : public utl::ConfigItem
+{
+ SvtJavaOptions_Impl* pImpl;
+public:
+ enum EOption
+ {
+ E_ENABLED,
+ E_SECURITY,
+ E_NETACCESS,
+ E_USERCLASSPATH,
+ E_EXECUTEAPPLETS
+ };
+
+ SvtJavaOptions();
+ ~SvtJavaOptions();
+
+ virtual void Commit();
+
+ sal_Bool IsEnabled() const;
+ sal_Bool IsSecurity()const;
+ sal_Int32 GetNetAccess() const;
+ rtl::OUString& GetUserClassPath()const;
+ sal_Bool IsExecuteApplets() const;
+
+ void SetEnabled(sal_Bool bSet) ;
+ void SetSecurity(sal_Bool bSet);
+ void SetNetAccess(sal_Int32 nSet) ;
+ void SetUserClassPath(const rtl::OUString& rSet);
+ void SetExecuteApplets(sal_Bool bSet);
+
+ sal_Bool IsReadOnly( EOption eOption ) const;
+};
+
+#endif //
+
diff --git a/unotools/inc/unotools/lingucfg.hxx b/unotools/inc/unotools/lingucfg.hxx
new file mode 100644
index 000000000000..720a2efb381c
--- /dev/null
+++ b/unotools/inc/unotools/lingucfg.hxx
@@ -0,0 +1,241 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _unotools_LINGUCFG_HXX_
+#define _unotools_LINGUCFG_HXX_
+
+#include "unotools/unotoolsdllapi.h"
+#include <com/sun/star/beans/PropertyValues.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/uno/Any.h>
+#include <com/sun/star/lang/Locale.hpp>
+#include <com/sun/star/util/XChangesBatch.hpp>
+#include <tools/solar.h>
+#include <rtl/ustring.hxx>
+#include <unotools/configitem.hxx>
+#include <osl/mutex.hxx>
+#include <unotools/options.hxx>
+#include <i18npool/lang.h>
+
+#include <vector>
+
+class SvtLinguConfigItem;
+
+//////////////////////////////////////////////////////////////////////
+
+struct UNOTOOLS_DLLPUBLIC SvtLinguOptions
+{
+ ::com::sun::star::uno::Sequence< rtl::OUString > aActiveDics;
+ ::com::sun::star::uno::Sequence< rtl::OUString > aActiveConvDics;
+
+ BOOL bROActiveDics;
+ BOOL bROActiveConvDics;
+
+ // Hyphenator service specific options
+ INT16 nHyphMinLeading,
+ nHyphMinTrailing,
+ nHyphMinWordLength;
+
+ BOOL bROHyphMinLeading,
+ bROHyphMinTrailing,
+ bROHyphMinWordLength;
+
+ // misc options (non-service specific)
+ INT16 nDefaultLanguage;
+ INT16 nDefaultLanguage_CJK;
+ INT16 nDefaultLanguage_CTL;
+
+ BOOL bRODefaultLanguage;
+ BOOL bRODefaultLanguage_CJK;
+ BOOL bRODefaultLanguage_CTL;
+
+ // spelling options (non-service specific)
+ BOOL bIsSpellSpecial;
+ BOOL bIsSpellAuto;
+ BOOL bIsSpellReverse;
+
+ BOOL bROIsSpellSpecial;
+ BOOL bROIsSpellAuto;
+ BOOL bROIsSpellReverse;
+
+ // hyphenation options (non-service specific)
+ BOOL bIsHyphSpecial;
+ BOOL bIsHyphAuto;
+
+ BOOL bROIsHyphSpecial;
+ BOOL bROIsHyphAuto;
+
+ // common to SpellChecker, Hyphenator and Thesaurus service
+ BOOL bIsUseDictionaryList;
+ BOOL bIsIgnoreControlCharacters;
+
+ BOOL bROIsUseDictionaryList;
+ BOOL bROIsIgnoreControlCharacters;
+
+ // SpellChecker service specific options
+ BOOL bIsSpellWithDigits,
+ bIsSpellUpperCase,
+ bIsSpellCapitalization;
+
+ BOOL bROIsSpellWithDigits,
+ bROIsSpellUpperCase,
+ bROIsSpellCapitalization;
+
+ // text conversion specific options
+ BOOL bIsIgnorePostPositionalWord;
+ BOOL bIsAutoCloseDialog;
+ BOOL bIsShowEntriesRecentlyUsedFirst;
+ BOOL bIsAutoReplaceUniqueEntries;
+ BOOL bIsDirectionToSimplified;
+ BOOL bIsUseCharacterVariants;
+ BOOL bIsTranslateCommonTerms;
+ BOOL bIsReverseMapping;
+
+ BOOL bROIsIgnorePostPositionalWord;
+ BOOL bROIsAutoCloseDialog;
+ BOOL bROIsShowEntriesRecentlyUsedFirst;
+ BOOL bROIsAutoReplaceUniqueEntries;
+ BOOL bROIsDirectionToSimplified;
+ BOOL bROIsUseCharacterVariants;
+ BOOL bROIsTranslateCommonTerms;
+ BOOL bROIsReverseMapping;
+
+ // check value need to determine if the configuration needs to updatet
+ // or not (used for a quick check if data files have been changed/added
+ // or deleted
+ INT32 nDataFilesChangedCheckValue;
+ BOOL bRODataFilesChangedCheckValue;
+
+ BOOL bIsGrammarAuto;
+ BOOL bIsGrammarInteractive;
+
+ BOOL bROIsGrammarAuto;
+ BOOL bROIsGrammarInteractive;
+
+ SvtLinguOptions();
+};
+
+//////////////////////////////////////////////////////////////////////
+
+struct UNOTOOLS_DLLPUBLIC SvtLinguConfigDictionaryEntry
+{
+ // the URL's pointing to the location of the files the dictionary consists of
+ com::sun::star::uno::Sequence< rtl::OUString > aLocations;
+ // the name of the dictionary format implement
+ rtl::OUString aFormatName;
+ // the list of languages (ISO names) the dictionary can be used for
+ com::sun::star::uno::Sequence< rtl::OUString > aLocaleNames;
+};
+
+//////////////////////////////////////////////////////////////////////
+
+class UNOTOOLS_DLLPUBLIC SvtLinguConfig: public utl::detail::Options
+{
+ // returns static object
+ UNOTOOLS_DLLPRIVATE SvtLinguConfigItem & GetConfigItem();
+
+ SvtLinguConfigItem & GetConfigItem() const { return const_cast< SvtLinguConfig * >( this )->GetConfigItem(); }
+
+ // configuration update access for the 'Linguistic' main node
+ mutable com::sun::star::uno::Reference< com::sun::star::util::XChangesBatch > m_xMainUpdateAccess;
+
+ com::sun::star::uno::Reference< com::sun::star::util::XChangesBatch > GetMainUpdateAccess() const;
+
+ com::sun::star::uno::Sequence< rtl::OUString > GetCurrentOrLastActiveDicts_Impl( const rtl::OUString &rPropName ) const;
+ void SetCurrentOrLastActiveDicts_Impl( const rtl::OUString &rPropName, const com::sun::star::uno::Sequence< rtl::OUString > &rDictionaries ) const;
+
+ rtl::OUString GetVendorImageUrl_Impl( const rtl::OUString &rServiceImplName, const rtl::OUString &rImageName ) const;
+
+ // disallow copy-constructor and assignment-operator for now
+ SvtLinguConfig( const SvtLinguConfig & );
+ SvtLinguConfig & operator = ( const SvtLinguConfig & );
+
+public:
+ SvtLinguConfig();
+ virtual ~SvtLinguConfig();
+
+ //
+ // borrowed from utl::ConfigItem
+ //
+ com::sun::star::uno::Sequence< rtl::OUString >
+ GetNodeNames( const rtl::OUString &rNode );
+ //
+ com::sun::star::uno::Sequence< com::sun::star::uno::Any >
+ GetProperties(
+ const com::sun::star::uno::Sequence< rtl::OUString > &rNames );
+ //
+ sal_Bool
+ ReplaceSetProperties(
+ const rtl::OUString &rNode,
+ com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > rValues );
+
+ com::sun::star::uno::Any
+ GetProperty( const rtl::OUString &rPropertyName ) const;
+ com::sun::star::uno::Any
+ GetProperty( INT32 nPropertyHandle ) const;
+
+ BOOL SetProperty( const rtl::OUString &rPropertyName,
+ const com::sun::star::uno::Any &rValue );
+ BOOL SetProperty( INT32 nPropertyHandle,
+ const com::sun::star::uno::Any &rValue );
+
+ BOOL GetOptions( SvtLinguOptions &rOptions ) const;
+ BOOL SetOptions( const SvtLinguOptions &rOptions );
+
+ BOOL IsReadOnly( const rtl::OUString &rPropertyName ) const;
+ BOOL IsReadOnly( INT32 nPropertyHandle ) const;
+
+ //!
+ //! the following functions work on the 'ServiceManager' sub node of the
+ //! linguistic configuration only
+ //!
+ BOOL GetElementNamesFor( const rtl::OUString &rNodeName, com::sun::star::uno::Sequence< rtl::OUString > &rElementNames ) const;
+ //
+ BOOL GetSupportedDictionaryFormatsFor( const rtl::OUString &rSetName, const rtl::OUString &rSetEntry, com::sun::star::uno::Sequence< rtl::OUString > &rFormatList ) const;
+ void SetOrCreateSupportedDictionaryFormatsFor( const rtl::OUString &rSetName, const rtl::OUString &rSetEntry, const com::sun::star::uno::Sequence< rtl::OUString > &rFormatList ) const;
+ //
+ BOOL GetDictionaryEntry( const rtl::OUString &rNodeName, SvtLinguConfigDictionaryEntry &rDicEntry ) const;
+ void SetOrCreateDictionaryEntry( const rtl::OUString &rNodeName, const SvtLinguConfigDictionaryEntry &rDicEntry ) const;
+ //
+ com::sun::star::uno::Sequence< rtl::OUString > GetDisabledDictionaries() const;
+ void SetDisabledDictionaries( const com::sun::star::uno::Sequence< rtl::OUString > &rDictionaries ) const;
+ //
+ std::vector< SvtLinguConfigDictionaryEntry > GetActiveDictionariesByFormat( const rtl::OUString &rFormatName );
+
+ // functions returning file URLs to the respective images (if found) and empty string otherwise
+ ::rtl::OUString GetSpellAndGrammarDialogImage( const ::rtl::OUString &rServiceImplName, bool bHighContrast = false ) const;
+ ::rtl::OUString GetSpellAndGrammarContextSuggestionImage( const ::rtl::OUString &rServiceImplName, bool bHighContrast = false ) const;
+ ::rtl::OUString GetSpellAndGrammarContextDictionaryImage( const ::rtl::OUString &rServiceImplName, bool bHighContrast = false ) const;
+
+ bool HasAnyVendorImages() const;
+ bool HasGrammarChecker() const;
+};
+
+//////////////////////////////////////////////////////////////////////
+
+#endif
+
diff --git a/unotools/inc/unotools/linguprops.hxx b/unotools/inc/unotools/linguprops.hxx
new file mode 100644
index 000000000000..4f2640116454
--- /dev/null
+++ b/unotools/inc/unotools/linguprops.hxx
@@ -0,0 +1,121 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _unotools_LINGUPROPS_HXX_
+#define _unotools_LINGUPROPS_HXX_
+
+
+// UNO property names for general options
+#define UPN_IS_GERMAN_PRE_REFORM "IsGermanPreReform" /*! deprecated #i91949 !*/
+#define UPN_IS_USE_DICTIONARY_LIST "IsUseDictionaryList"
+#define UPN_IS_IGNORE_CONTROL_CHARACTERS "IsIgnoreControlCharacters"
+#define UPN_ACTIVE_DICTIONARIES "ActiveDictionaries"
+
+// UNO property names for SpellChecker
+#define UPN_IS_SPELL_UPPER_CASE "IsSpellUpperCase"
+#define UPN_IS_SPELL_WITH_DIGITS "IsSpellWithDigits"
+#define UPN_IS_SPELL_CAPITALIZATION "IsSpellCapitalization"
+
+// UNO property names for Hyphenator
+#define UPN_HYPH_MIN_LEADING "HyphMinLeading"
+#define UPN_HYPH_MIN_TRAILING "HyphMinTrailing"
+#define UPN_HYPH_MIN_WORD_LENGTH "HyphMinWordLength"
+
+// UNO property names for Lingu
+// (those not covered by the SpellChecker and Hyphenator
+// properties and more likely to be used in other modules only)
+#define UPN_DEFAULT_LANGUAGE "DefaultLanguage"
+#define UPN_DEFAULT_LOCALE "DefaultLocale"
+#define UPN_DEFAULT_LOCALE_CJK "DefaultLocale_CJK"
+#define UPN_DEFAULT_LOCALE_CTL "DefaultLocale_CTL"
+#define UPN_IS_HYPH_AUTO "IsHyphAuto"
+#define UPN_IS_HYPH_SPECIAL "IsHyphSpecial"
+#define UPN_IS_SPELL_AUTO "IsSpellAuto"
+#define UPN_IS_SPELL_HIDE "IsSpellHide" /*! deprecated #i91949 !*/
+#define UPN_IS_SPELL_IN_ALL_LANGUAGES "IsSpellInAllLanguages" /*! deprecated #i91949 !*/
+#define UPN_IS_SPELL_SPECIAL "IsSpellSpecial"
+#define UPN_IS_WRAP_REVERSE "IsWrapReverse"
+#define UPN_DATA_FILES_CHANGED_CHECK_VALUE "DataFilesChangedCheckValue"
+
+// UNO property names for text conversion options
+#define UPN_ACTIVE_CONVERSION_DICTIONARIES "ActiveConversionDictionaries"
+#define UPN_IS_IGNORE_POST_POSITIONAL_WORD "IsIgnorePostPositionalWord"
+#define UPN_IS_AUTO_CLOSE_DIALOG "IsAutoCloseDialog"
+#define UPN_IS_SHOW_ENTRIES_RECENTLY_USED_FIRST "IsShowEntriesRecentlyUsedFirst"
+#define UPN_IS_AUTO_REPLACE_UNIQUE_ENTRIES "IsAutoReplaceUniqueEntries"
+#define UPN_IS_DIRECTION_TO_SIMPLIFIED "IsDirectionToSimplified"
+#define UPN_IS_USE_CHARACTER_VARIANTS "IsUseCharacterVariants"
+#define UPN_IS_TRANSLATE_COMMON_TERMS "IsTranslateCommonTerms"
+#define UPN_IS_REVERSE_MAPPING "IsReverseMapping"
+
+// new UNO propertynames to be used with 'dictionaries as extensions'
+#define UPN_DICTIONARIES "Dictionaries"
+#define UPN_SPELL_CHECKERS "SpellCheckers"
+#define UPN_HYPHENATORS "Hyphenators"
+#define UPN_THESAURI "Thesauri"
+#define UPN_CURRENT_ACTIVE_DICTIONARIES "CurrentActiveDictionaries"
+#define UPN_LAST_ACTIVE_DICTIONARIES "LastActiveDictionaries"
+
+#define UPN_IS_GRAMMAR_AUTO "IsAutoGrammarCheck"
+#define UPN_IS_GRAMMAR_INTERACTIVE "IsInteractiveGrammarCheck"
+
+// uno property handles
+#define UPH_IS_GERMAN_PRE_REFORM 0
+#define UPH_IS_USE_DICTIONARY_LIST 1
+#define UPH_IS_IGNORE_CONTROL_CHARACTERS 2
+#define UPH_IS_SPELL_UPPER_CASE 3
+#define UPH_IS_SPELL_WITH_DIGITS 4
+#define UPH_IS_SPELL_CAPITALIZATION 5
+#define UPH_HYPH_MIN_LEADING 6
+#define UPH_HYPH_MIN_TRAILING 7
+#define UPH_HYPH_MIN_WORD_LENGTH 8
+#define UPH_DEFAULT_LOCALE 9
+#define UPH_IS_SPELL_AUTO 10
+#define UPH_IS_SPELL_HIDE 11
+#define UPH_IS_SPELL_IN_ALL_LANGUAGES 12
+#define UPH_IS_SPELL_SPECIAL 13
+#define UPH_IS_HYPH_AUTO 14
+#define UPH_IS_HYPH_SPECIAL 15
+#define UPH_IS_WRAP_REVERSE 16
+#define UPH_DATA_FILES_CHANGED_CHECK_VALUE 17
+#define UPH_DEFAULT_LANGUAGE 21
+#define UPH_DEFAULT_LOCALE_CJK 22
+#define UPH_DEFAULT_LOCALE_CTL 23
+#define UPH_ACTIVE_DICTIONARIES 24
+#define UPH_ACTIVE_CONVERSION_DICTIONARIES 25
+#define UPH_IS_IGNORE_POST_POSITIONAL_WORD 26
+#define UPH_IS_AUTO_CLOSE_DIALOG 27
+#define UPH_IS_SHOW_ENTRIES_RECENTLY_USED_FIRST 28
+#define UPH_IS_AUTO_REPLACE_UNIQUE_ENTRIES 29
+#define UPH_IS_DIRECTION_TO_SIMPLIFIED 30
+#define UPH_IS_USE_CHARACTER_VARIANTS 31
+#define UPH_IS_TRANSLATE_COMMON_TERMS 32
+#define UPH_IS_REVERSE_MAPPING 33
+#define UPH_IS_GRAMMAR_AUTO 34
+#define UPH_IS_GRAMMAR_INTERACTIVE 35
+#endif
+
diff --git a/unotools/inc/unotools/localedatawrapper.hxx b/unotools/inc/unotools/localedatawrapper.hxx
new file mode 100644
index 000000000000..fd09b07e58cb
--- /dev/null
+++ b/unotools/inc/unotools/localedatawrapper.hxx
@@ -0,0 +1,363 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _UNOTOOLS_LOCALEDATAWRAPPER_HXX
+#define _UNOTOOLS_LOCALEDATAWRAPPER_HXX
+
+#include <tools/string.hxx>
+#include <com/sun/star/i18n/XLocaleData2.hpp>
+#include <com/sun/star/i18n/LocaleItem.hpp>
+#include <com/sun/star/i18n/reservedWords.hpp>
+#include <unotools/readwritemutexguard.hxx>
+#include "unotools/unotoolsdllapi.h"
+
+#ifndef BOOST_SHARED_PTR_HPP_INCLUDED
+#include <boost/shared_ptr.hpp>
+#endif
+
+
+namespace com { namespace sun { namespace star {
+ namespace lang {
+ class XMultiServiceFactory;
+ }
+}}}
+class Date;
+class Time;
+class CalendarWrapper;
+
+
+enum DateFormat {
+ MDY,
+ DMY,
+ YMD
+};
+
+
+enum MeasurementSystem {
+ MEASURE_METRIC,
+ MEASURE_US
+};
+
+
+class UNOTOOLS_DLLPUBLIC LocaleDataWrapper
+{
+ static BYTE nLocaleDataChecking; // 0:=dontknow, 1:=yes, 2:=no
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xSMgr;
+ ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XLocaleData2 > xLD;
+ ::com::sun::star::lang::Locale aLocale;
+ ::boost::shared_ptr< ::com::sun::star::i18n::Calendar > xDefaultCalendar;
+ ::com::sun::star::i18n::LocaleDataItem aLocaleDataItem;
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > aReservedWordSeq;
+ ::com::sun::star::uno::Sequence< sal_Int32 > aGrouping;
+ // cached items
+ String aLocaleItem[::com::sun::star::i18n::LocaleItem::COUNT];
+ String aReservedWord[::com::sun::star::i18n::reservedWords::COUNT];
+ String aCurrSymbol;
+ String aCurrBankSymbol;
+ int nDateFormat;
+ int nLongDateFormat;
+ USHORT nCurrPositiveFormat;
+ USHORT nCurrNegativeFormat;
+ USHORT nCurrDigits;
+ BOOL bLocaleDataItemValid;
+ BOOL bReservedWordValid;
+ mutable ::utl::ReadWriteMutex aMutex;
+
+ // dummies, to be implemented or provided by XML locale data
+ sal_Unicode cCurrZeroChar;
+
+
+ // not implemented, prevent usage
+ LocaleDataWrapper( const LocaleDataWrapper& );
+ LocaleDataWrapper& operator=( const LocaleDataWrapper& );
+
+ // whenever Locale changes
+ void invalidateData();
+
+ void getOneLocaleItemImpl( sal_Int16 nItem );
+ const String& getOneLocaleItem( sal_Int16 nItem ) const;
+
+ void getOneReservedWordImpl( sal_Int16 nWord );
+ const String& getOneReservedWord( sal_Int16 nWord ) const;
+
+ void getCurrSymbolsImpl();
+ void getCurrFormatsImpl();
+
+ void scanCurrFormatImpl( const String& rCode,
+ xub_StrLen nStart, xub_StrLen& nSign,
+ xub_StrLen& nPar, xub_StrLen& nNum,
+ xub_StrLen& nBlank, xub_StrLen& nSym );
+
+ void getDateFormatsImpl();
+ DateFormat scanDateFormatImpl( const String& rCode );
+
+ void getDefaultCalendarImpl();
+
+ sal_Unicode* ImplAddFormatNum( sal_Unicode* pBuf,
+ sal_Int64 nNumber, USHORT nDecimals,
+ BOOL bUseThousandSep, BOOL bTrailingZeros ) const;
+
+ void getDigitGroupingImpl();
+
+public:
+ LocaleDataWrapper(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & xSF,
+ const ::com::sun::star::lang::Locale& rLocale
+ );
+ ~LocaleDataWrapper();
+
+ /** Get the service factory, meant to be able to create a CalendarWrapper
+ from a LocaleDataWrapper. Note that the service factory may be
+ non-existent if this LocaleDataWrapper was created without one and
+ lives "on the grassland". The CalendarWrapper ctor can handle that
+ though. */
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory > & getServiceFactory()
+ const { return xSMgr; }
+
+ /// set a new Locale to request
+ void setLocale( const ::com::sun::star::lang::Locale& rLocale );
+
+ /// get current requested Locale
+ const ::com::sun::star::lang::Locale& getLocale() const;
+
+ /// get current loaded Locale, which might differ from the requested Locale
+ ::com::sun::star::lang::Locale getLoadedLocale() const;
+
+
+ // Wrapper implementations of service LocaleData
+
+ ::com::sun::star::i18n::LanguageCountryInfo getLanguageCountryInfo() const;
+ ::com::sun::star::i18n::LocaleDataItem getLocaleItem() const;
+ ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::Calendar > getAllCalendars() const;
+ /// NOTE: this wraps XLocaleData2::getAllCurrencies2() in fact.
+ ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::Currency2 > getAllCurrencies() const;
+ ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::FormatElement > getAllFormats() const;
+ ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::Implementation > getCollatorImplementations() const;
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > getTransliterations() const;
+ ::com::sun::star::i18n::ForbiddenCharacters getForbiddenCharacters() const;
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > getReservedWord() const;
+ ::com::sun::star::uno::Sequence< ::com::sun::star::lang::Locale > getAllInstalledLocaleNames() const;
+
+ /// same as the wrapper implementation but static
+ static ::com::sun::star::uno::Sequence< ::com::sun::star::lang::Locale > getInstalledLocaleNames();
+
+ /** Get LanguageTypes for all installed locales which are unambiguous
+ convertible back and forth between locale ISO strings and MS-LCID
+ LanguageType. Upon the first time the function is called when
+ locale data checking is enabled, messages are shown for locales not
+ matching, excluding already known problems.
+ (e.g. used in number formatter dialog init)
+ */
+ static ::com::sun::star::uno::Sequence< sal_uInt16 > getInstalledLanguageTypes();
+
+ /// maps the LocaleData string to the International enum
+ MeasurementSystem mapMeasurementStringToEnum( const String& rMS ) const;
+
+ /// Convenience method to obtain the default calendar.
+ const ::boost::shared_ptr< ::com::sun::star::i18n::Calendar > getDefaultCalendar() const;
+
+ /// Convenience method to obtain the day names of the default calendar.
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::CalendarItem > getDefaultCalendarDays() const;
+
+ /// Convenience method to obtain the month names of the default calendar.
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::CalendarItem > getDefaultCalendarMonths() const;
+
+ /** Obtain digit grouping. The usually known grouping by thousands (#,###)
+ is actually only one of possible groupings. Another one, for example,
+ used in India is group by 3 and then by 2 indefinitely (#,##,###). The
+ integer sequence returned here specifies grouping from right to left
+ (!), with a 0 entry designating the end of rules and the previous value
+ to be repeated indefinitely. Hence the sequence {3,0} specifies the
+ usual grouping by thousands, whereas the sequence {3,2,0} specifies
+ Indian grouping. The sal_Int32* getConstArray() can be passed directly
+ to the ::rtl::math::doubleToString() methods as argument for the
+ pGroups parameter. */
+ const ::com::sun::star::uno::Sequence< sal_Int32 > getDigitGrouping() const;
+
+ // Functionality of class International methods, LocaleItem
+
+ inline const String& getDateSep() const
+ { return getOneLocaleItem( ::com::sun::star::i18n::LocaleItem::DATE_SEPARATOR ); }
+ inline const String& getNumThousandSep() const
+ { return getOneLocaleItem( ::com::sun::star::i18n::LocaleItem::THOUSAND_SEPARATOR ); }
+ inline const String& getNumDecimalSep() const
+ { return getOneLocaleItem( ::com::sun::star::i18n::LocaleItem::DECIMAL_SEPARATOR ); }
+ inline const String& getTimeSep() const
+ { return getOneLocaleItem( ::com::sun::star::i18n::LocaleItem::TIME_SEPARATOR ); }
+ inline const String& getTime100SecSep() const
+ { return getOneLocaleItem( ::com::sun::star::i18n::LocaleItem::TIME_100SEC_SEPARATOR ); }
+ inline const String& getListSep() const
+ { return getOneLocaleItem( ::com::sun::star::i18n::LocaleItem::LIST_SEPARATOR ); }
+ inline const String& getQuotationMarkStart() const
+ { return getOneLocaleItem( ::com::sun::star::i18n::LocaleItem::SINGLE_QUOTATION_START ); }
+ inline const String& getQuotationMarkEnd() const
+ { return getOneLocaleItem( ::com::sun::star::i18n::LocaleItem::SINGLE_QUOTATION_END ); }
+ inline const String& getDoubleQuotationMarkStart() const
+ { return getOneLocaleItem( ::com::sun::star::i18n::LocaleItem::DOUBLE_QUOTATION_START ); }
+ inline const String& getDoubleQuotationMarkEnd() const
+ { return getOneLocaleItem( ::com::sun::star::i18n::LocaleItem::DOUBLE_QUOTATION_END ); }
+ inline const String& getMeasurementSystem() const
+ { return getOneLocaleItem( ::com::sun::star::i18n::LocaleItem::MEASUREMENT_SYSTEM ); }
+ inline MeasurementSystem getMeasurementSystemEnum() const
+ { return mapMeasurementStringToEnum( getOneLocaleItem( ::com::sun::star::i18n::LocaleItem::MEASUREMENT_SYSTEM ) ); }
+ inline const String& getTimeAM() const
+ { return getOneLocaleItem( ::com::sun::star::i18n::LocaleItem::TIME_AM ); }
+ inline const String& getTimePM() const
+ { return getOneLocaleItem( ::com::sun::star::i18n::LocaleItem::TIME_PM ); }
+ inline const String& getLongDateDayOfWeekSep() const
+ { return getOneLocaleItem( ::com::sun::star::i18n::LocaleItem::LONG_DATE_DAY_OF_WEEK_SEPARATOR ); }
+ inline const String& getLongDateDaySep() const
+ { return getOneLocaleItem( ::com::sun::star::i18n::LocaleItem::LONG_DATE_DAY_SEPARATOR ); }
+ inline const String& getLongDateMonthSep() const
+ { return getOneLocaleItem( ::com::sun::star::i18n::LocaleItem::LONG_DATE_MONTH_SEPARATOR ); }
+ inline const String& getLongDateYearSep() const
+ { return getOneLocaleItem( ::com::sun::star::i18n::LocaleItem::LONG_DATE_YEAR_SEPARATOR ); }
+
+ // currency
+ const String& getCurrSymbol() const;
+ const String& getCurrBankSymbol() const;
+ USHORT getCurrPositiveFormat() const;
+ USHORT getCurrNegativeFormat() const;
+ USHORT getCurrDigits() const;
+
+ // simple date and time formatting
+ DateFormat getDateFormat() const;
+ DateFormat getLongDateFormat() const;
+ /// only numerical values of Gregorian calendar
+ String getDate( const Date& rDate ) const;
+ String getTime( const Time& rTime, BOOL bSec = TRUE,
+ BOOL b100Sec = FALSE ) const;
+ String getDuration( const Time& rTime,
+ BOOL bSec = TRUE, BOOL b100Sec = FALSE ) const;
+
+ /** The CalendarWrapper already <b>MUST</b>
+ have loaded a calendar.
+ @param nDisplayDayOfWeek
+ 0 := abbreviated name
+ 1 := full name
+ @param bDayOfMonthWithLeadingZero
+ <FALSE/> := without leading zero
+ <TRUE/> := with leading zero if <10
+ @param nDisplayMonth
+ 0 := abbreviated name
+ 1 := full name
+ @param bTwoDigitYear
+ <FALSE/> := full year
+ <TRUE/> := year % 100
+ */
+ String getLongDate( const Date& rDate,
+ CalendarWrapper& rCal,
+ sal_Int16 nDisplayDayOfWeek = 1,
+ sal_Bool bDayOfMonthWithLeadingZero = sal_False,
+ sal_Int16 nDisplayMonth = 1,
+ sal_Bool bTwoDigitYear = sal_False
+ ) const;
+
+ /** Simple number formatting
+ @param nNumber
+ value * 10**nDecimals
+ @param bTrailingZeros
+ </TRUE> := always display trailing zeros in
+ decimal places, even if integer value.
+ </FALSE> := trailing zeros are only displayed
+ if the value is not an integer value.
+ */
+ String getNum( sal_Int64 nNumber, USHORT nDecimals,
+ BOOL bUseThousandSep = TRUE,
+ BOOL bTrailingZeros = TRUE ) const;
+
+ /// "Secure" currency formatted string.
+ String getCurr( sal_Int64 nNumber, USHORT nDecimals,
+ const String& rCurrencySymbol,
+ BOOL bUseThousandSep = TRUE ) const;
+ /** Default currency formatted string, use with
+ care as default currency may change in any
+ locale, for example, DEM -> EUR */
+ String getCurr( sal_Int64 nNumber, USHORT nDecimals,
+ BOOL bUseThousandSep = TRUE ) const
+ { return getCurr( nNumber, nDecimals,
+ getCurrSymbol(), bUseThousandSep ); }
+
+ // dummy returns, to be implemented
+ inline sal_Unicode getCurrZeroChar() const
+ { return cCurrZeroChar; }
+ inline BOOL isNumLeadingZero() const
+ { return TRUE; }
+ /// standard decimal places
+ inline USHORT getNumDigits() const
+ { return 2; }
+ inline BOOL isNumTrailingZeros() const
+ { return TRUE; }
+
+
+ // reserved words
+
+ inline const String& getTrueWord() const
+ { return getOneReservedWord( ::com::sun::star::i18n::reservedWords::TRUE_WORD ); }
+ inline const String& getFalseWord() const
+ { return getOneReservedWord( ::com::sun::star::i18n::reservedWords::FALSE_WORD ); }
+ /// return a quarter string matching nQuarter (0..3) => "1st quarter" .. "4th quarter"
+ inline const String& getQuarterWord( sal_Int16 nQuarter ) const
+ { return getOneReservedWord( ::com::sun::star::i18n::reservedWords::QUARTER1_WORD + nQuarter ); }
+ inline const String& getAboveWord() const
+ { return getOneReservedWord( ::com::sun::star::i18n::reservedWords::ABOVE_WORD ); }
+ inline const String& getBelowWord() const
+ { return getOneReservedWord( ::com::sun::star::i18n::reservedWords::BELOW_WORD ); }
+ /// return a quarter abbreviation string matching nQuarter (0..3) => "Q1" .. "Q2"
+ inline const String& getQuarterAbbreviation( sal_Int16 nQuarter ) const
+ { return getOneReservedWord( ::com::sun::star::i18n::reservedWords::QUARTER1_ABBREVIATION + nQuarter ); }
+
+ /** Return whether locale data checks are enabled.
+ Checks are enabled if the environment variable
+ OOO_ENABLE_LOCALE_DATA_CHECKS is set to 'Y' or 'Yes' (or any other
+ string starting with 'Y') or '1'.
+ Also used in conjunction with the number formatter. */
+ static inline bool areChecksEnabled()
+ {
+ if (nLocaleDataChecking == 0)
+ evaluateLocaleDataChecking();
+ return nLocaleDataChecking == 1;
+ }
+
+ /** Append locale info to string, used with locale data checking.
+ A string similar to "de_DE requested\n en_US loaded" is appended. */
+ String& appendLocaleInfo( String& rDebugMsg ) const;
+
+ /** Ouput a message during locale data checking. The (UTF-8) string is
+ written to stderr and in a non-product build or if DBG_UTIL is enabled
+ also raised as an assertion message box. */
+ static void outputCheckMessage( const String& rMsg );
+ static void outputCheckMessage( const char* pStr);
+
+private:
+ static void evaluateLocaleDataChecking();
+};
+
+
+#endif // _UNOTOOLS_LOCALEDATAWRAPPER_HXX
diff --git a/unotools/inc/unotools/localfilehelper.hxx b/unotools/inc/unotools/localfilehelper.hxx
new file mode 100644
index 000000000000..11e0851c3298
--- /dev/null
+++ b/unotools/inc/unotools/localfilehelper.hxx
@@ -0,0 +1,68 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _UNOTOOLS_LOCALFILEHELPER_HXX
+#define _UNOTOOLS_LOCALFILEHELPER_HXX
+
+#include <com/sun/star/uno/Sequence.hxx>
+#include "unotools/unotoolsdllapi.h"
+
+#include <rtl/ustring.hxx>
+#include <tools/string.hxx>
+
+namespace utl
+{
+
+class UNOTOOLS_DLLPUBLIC LocalFileHelper
+{
+public:
+ /**
+ Converts a "physical" file name into a "UCB compatible" URL ( if possible ).
+ If no UCP is available for the local file system, sal_False and an empty URL is returned.
+ Returning sal_True and an empty URL means that the URL doesn't point to a local file.
+ */
+ static sal_Bool ConvertPhysicalNameToURL( const String& rName, String& rReturn );
+ static sal_Bool ConvertSystemPathToURL( const String& rName, const String& rBaseURL, String& rReturn );
+
+ /**
+ Converts a "UCB compatible" URL into a "physical" file name.
+ If no UCP is available for the local file system, sal_False and an empty file name is returned,
+ otherwise sal_True and a valid URL, because a file name can always be converted if a UCP for the local
+ file system is present ( watch: this doesn't mean that this file really exists! )
+ */
+ static sal_Bool ConvertURLToPhysicalName( const String& rName, String& rReturn );
+ static sal_Bool ConvertURLToSystemPath( const String& rName, String& rReturn );
+
+ static sal_Bool IsLocalFile( const String& rName );
+ static sal_Bool IsFileContent( const String& rName );
+
+ static ::com::sun::star::uno::Sequence< ::rtl::OUString >
+ GetFolderContents( const ::rtl::OUString& rFolder, sal_Bool bFolder );
+};
+
+}
+
+#endif
diff --git a/unotools/inc/unotools/localisationoptions.hxx b/unotools/inc/unotools/localisationoptions.hxx
new file mode 100644
index 000000000000..acce942f6a42
--- /dev/null
+++ b/unotools/inc/unotools/localisationoptions.hxx
@@ -0,0 +1,178 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef INCLUDED_unotools_LOCALISATIONOPTIONS_HXX
+#define INCLUDED_unotools_LOCALISATIONOPTIONS_HXX
+
+//_________________________________________________________________________________________________________________
+// includes
+//_________________________________________________________________________________________________________________
+
+#include <sal/types.h>
+#include "unotools/unotoolsdllapi.h"
+#include <osl/mutex.hxx>
+#include <unotools/options.hxx>
+
+//_________________________________________________________________________________________________________________
+// forward declarations
+//_________________________________________________________________________________________________________________
+
+/*-************************************************************************************************************//**
+ @short forward declaration to our private date container implementation
+ @descr We use these class as internal member to support small memory requirements.
+ You can create the container if it is neccessary. The class which use these mechanism
+ is faster and smaller then a complete implementation!
+*//*-*************************************************************************************************************/
+
+class SvtLocalisationOptions_Impl;
+
+//_________________________________________________________________________________________________________________
+// declarations
+//_________________________________________________________________________________________________________________
+
+/*-************************************************************************************************************//**
+ @short collect informations about localisation features
+ @descr -
+
+ @implements -
+ @base -
+
+ @devstatus ready to use
+*//*-*************************************************************************************************************/
+
+class UNOTOOLS_DLLPUBLIC SvtLocalisationOptions: public utl::detail::Options
+{
+ //-------------------------------------------------------------------------------------------------------------
+ // public methods
+ //-------------------------------------------------------------------------------------------------------------
+
+ public:
+
+ //---------------------------------------------------------------------------------------------------------
+ // constructor / destructor
+ //---------------------------------------------------------------------------------------------------------
+
+ /*-****************************************************************************************************//**
+ @short standard constructor and destructor
+ @descr This will initialize an instance with default values.
+ We implement these class with a refcount mechanism! Every instance of this class increase it
+ at create and decrease it at delete time - but all instances use the same data container!
+ He is implemented as a static member ...
+
+ @seealso member m_nRefCount
+ @seealso member m_pDataContainer
+
+ @param -
+ @return -
+
+ @onerror -
+ *//*-*****************************************************************************************************/
+
+ SvtLocalisationOptions();
+ virtual ~SvtLocalisationOptions();
+
+ //---------------------------------------------------------------------------------------------------------
+ // interface
+ //---------------------------------------------------------------------------------------------------------
+
+ /*-****************************************************************************************************//**
+ @short interface methods to get and set value of config key "org.openoffice.Office.Common/View/Localisation/AutoMnemonic"
+ @descr These value specifies if shortcuts should be assigned automatically.
+
+ @seealso -
+
+ @param "bState", new value to set it in configuration.
+ @return The value which represent current state of internal variable.
+
+ @onerror No error should occurre!
+ *//*-*****************************************************************************************************/
+
+ sal_Bool IsAutoMnemonic ( ) const ;
+ void SetAutoMnemonic ( sal_Bool bState ) ;
+
+ /*-****************************************************************************************************//**
+ @short interface methods to get and set value of config key "org.openoffice.Office.Common/View/Localisation/DialogScale"
+ @descr These value specifies the factor for increasing controls.
+ Value from [0..100] are allowed.
+
+ @ATTENTION These methods don't check for valid or invalid values!
+ Our configuration server can do it ... but these implementation don't get any notifications
+ about wrong commits ...!
+ => If you set an invalid value - nothing will be changed. The information will lost.
+
+ @seealso baseclass ConfigItem
+
+ @param "nScale" new value to set it in configuration.
+ @return The value which represent current state of internal variable.
+
+ @onerror No error should occurre!
+ *//*-*****************************************************************************************************/
+
+ sal_Int32 GetDialogScale( ) const ;
+ void SetDialogScale( sal_Int32 nScale ) ;
+
+ //-------------------------------------------------------------------------------------------------------------
+ // private methods
+ //-------------------------------------------------------------------------------------------------------------
+
+ private:
+
+ /*-****************************************************************************************************//**
+ @short return a reference to a static mutex
+ @descr These class is partially threadsafe (for de-/initialization only).
+ All access methods are'nt safe!
+ We create a static mutex only for one ime and use at different times.
+
+ @seealso -
+
+ @param -
+ @return A reference to a static mutex member.
+
+ @onerror -
+ *//*-*****************************************************************************************************/
+
+ UNOTOOLS_DLLPRIVATE static ::osl::Mutex& GetOwnStaticMutex();
+
+ //-------------------------------------------------------------------------------------------------------------
+ // private member
+ //-------------------------------------------------------------------------------------------------------------
+
+ private:
+
+ /*Attention
+
+ Don't initialize these static member in these header!
+ a) Double dfined symbols will be detected ...
+ b) and unresolved externals exist at linking time.
+ Do it in your source only.
+ */
+
+ static SvtLocalisationOptions_Impl* m_pDataContainer ; /// impl. data container as dynamic pointer for smaller memory requirements!
+ static sal_Int32 m_nRefCount ; /// internal ref count mechanism
+
+}; // class SvtLocalisationOptions
+
+#endif // #ifndef INCLUDED_unotools_LOCALISATIONOPTIONS_HXX
diff --git a/unotools/inc/unotools/loghelper.hxx b/unotools/inc/unotools/loghelper.hxx
new file mode 100644
index 000000000000..d5421089dff4
--- /dev/null
+++ b/unotools/inc/unotools/loghelper.hxx
@@ -0,0 +1,51 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVT_LOGHELPER_HXX
+#define _SVT_LOGHELPER_HXX
+
+namespace css = ::com::sun::star;
+
+class LogHelper
+{
+public:
+ LogHelper();
+ ~LogHelper();
+
+ static void logIt(const css::uno::Exception&){}
+};
+
+inline void logIt(const css::uno::Exception& ex)
+{
+ ::rtl::OUStringBuffer sMsg(256);
+ sMsg.appendAscii("Unexpected exception catched. Original message was:\n\"" );
+ sMsg.append(ex.Message);
+ sMsg.appendAscii("\"");
+ OSL_ENSURE(sal_False, ::rtl::OUStringToOString(sMsg.makeStringAndClear(), RTL_TEXTENCODING_UTF8).getStr());
+}
+
+#endif
+
diff --git a/unotools/inc/unotools/misccfg.hxx b/unotools/inc/unotools/misccfg.hxx
new file mode 100644
index 000000000000..01b8db21138f
--- /dev/null
+++ b/unotools/inc/unotools/misccfg.hxx
@@ -0,0 +1,67 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _UTL_MISCCFG_HXX
+#define _UTL_MISCCFG_HXX
+
+#include "unotools/unotoolsdllapi.h"
+#include "tools/solar.h"
+#include "unotools/options.hxx"
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+namespace utl
+{
+ class SfxMiscCfg;
+
+class UNOTOOLS_DLLPUBLIC MiscCfg : public detail::Options
+{
+ SfxMiscCfg* pImpl;
+
+public:
+ MiscCfg( );
+ virtual ~MiscCfg( );
+
+ BOOL IsNotFoundWarning() const;
+ void SetNotFoundWarning( BOOL bSet);
+
+ BOOL IsPaperSizeWarning() const;
+ void SetPaperSizeWarning(BOOL bSet);
+
+ BOOL IsPaperOrientationWarning() const;
+ void SetPaperOrientationWarning( BOOL bSet);
+
+ // 0 ... 99
+ sal_Int32 GetYear2000() const;
+ void SetYear2000( sal_Int32 nSet );
+};
+
+}
+
+#endif // _MISCCFG_HXX
+
+
diff --git a/unotools/inc/unotools/moduleoptions.hxx b/unotools/inc/unotools/moduleoptions.hxx
new file mode 100644
index 000000000000..d48a390a30bc
--- /dev/null
+++ b/unotools/inc/unotools/moduleoptions.hxx
@@ -0,0 +1,257 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_SVTOOLS_MODULEOPTIONS_HXX
+#define INCLUDED_SVTOOLS_MODULEOPTIONS_HXX
+
+//_________________________________________________________________________________________________________________
+// includes
+//_________________________________________________________________________________________________________________
+
+#include "unotools/unotoolsdllapi.h"
+#include <salhelper/singletonref.hxx>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+#include <osl/mutex.hxx>
+#include <unotools/options.hxx>
+
+//_________________________________________________________________________________________________________________
+// const
+//_________________________________________________________________________________________________________________
+
+#define FEATUREFLAG_BASICIDE 0x00000020
+#define FEATUREFLAG_MATH 0x00000100
+#define FEATUREFLAG_CHART 0x00000200
+#define FEATUREFLAG_CALC 0x00000800
+#define FEATUREFLAG_DRAW 0x00001000
+#define FEATUREFLAG_WRITER 0x00002000
+#define FEATUREFLAG_IMPRESS 0x00008000
+#define FEATUREFLAG_INSIGHT 0x00010000
+
+//_________________________________________________________________________________________________________________
+// forward declarations
+//_________________________________________________________________________________________________________________
+
+/*-************************************************************************************************************//**
+ @short forward declaration to our private date container implementation
+ @descr We use these class as internal member to support small memory requirements.
+ You can create the container if it is neccessary. The class which use these mechanism
+ is faster and smaller then a complete implementation!
+*//*-*************************************************************************************************************/
+class SvtModuleOptions_Impl;
+
+//_________________________________________________________________________________________________________________
+// declarations
+//_________________________________________________________________________________________________________________
+
+/*-************************************************************************************************************//**
+ @short collect informations about installation state of modules
+ @descr Use these class to get installation state of different office modules like writer, calc etc
+ Further you can ask for additional informations; e.g. name of standard template file, which
+ should be used by corresponding module; or short/long name of these module factory.
+
+ @implements -
+ @base -
+
+ @devstatus ready to use
+ @threadsafe yes
+*//*-*************************************************************************************************************/
+class UNOTOOLS_DLLPUBLIC SvtModuleOptions: public utl::detail::Options
+{
+ //-------------------------------------------------------------------------------------------------------------
+ // public const declarations!
+ //-------------------------------------------------------------------------------------------------------------
+ public:
+
+ enum EModule
+ {
+ E_SWRITER = 0,
+ E_SCALC = 1,
+ E_SDRAW = 2,
+ E_SIMPRESS = 3,
+ E_SMATH = 4,
+ E_SCHART = 5,
+ E_SSTARTMODULE = 6,
+ E_SBASIC = 7,
+ E_SDATABASE = 8,
+ E_SWEB = 9,
+ E_SGLOBAL = 10
+ };
+
+ /*ATTENTION:
+ If you change these enum ... don't forget to change reading/writing and order of configuration values too!
+ See "SvtModuleOptions_Impl::impl_GetSetNames()" and his ctor for further informations.
+ */
+ enum EFactory
+ {
+ E_UNKNOWN_FACTORY = -1,
+ E_WRITER = 0,
+ E_WRITERWEB = 1,
+ E_WRITERGLOBAL = 2,
+ E_CALC = 3,
+ E_DRAW = 4,
+ E_IMPRESS = 5,
+ E_MATH = 6,
+ E_CHART = 7,
+ E_STARTMODULE = 8,
+ E_DATABASE = 9,
+ E_BASIC = 10
+
+ };
+
+ //-------------------------------------------------------------------------------------------------------------
+ // public methods
+ //-------------------------------------------------------------------------------------------------------------
+ public:
+
+ //---------------------------------------------------------------------------------------------------------
+ // constructor / destructor
+ //---------------------------------------------------------------------------------------------------------
+ SvtModuleOptions();
+ virtual ~SvtModuleOptions();
+
+ //---------------------------------------------------------------------------------------------------------
+ // interface
+ //---------------------------------------------------------------------------------------------------------
+ sal_Bool IsModuleInstalled ( EModule eModule ) const;
+ ::rtl::OUString GetModuleName ( EModule eModule ) const;
+ ::rtl::OUString GetModuleName ( EFactory eFactory ) const;
+ ::rtl::OUString GetFactoryName ( EFactory eFactory ) const;
+ ::rtl::OUString GetFactoryShortName ( EFactory eFactory ) const;
+ ::rtl::OUString GetFactoryStandardTemplate( EFactory eFactory ) const;
+ ::rtl::OUString GetFactoryWindowAttributes( EFactory eFactory ) const;
+ ::rtl::OUString GetFactoryEmptyDocumentURL( EFactory eFactory ) const;
+ ::rtl::OUString GetFactoryDefaultFilter ( EFactory eFactory ) const;
+ sal_Bool IsDefaultFilterReadonly ( EFactory eFactory ) const;
+ sal_Int32 GetFactoryIcon ( EFactory eFactory ) const;
+ static sal_Bool ClassifyFactoryByName ( const ::rtl::OUString& sName ,
+ EFactory& eFactory );
+ void SetFactoryStandardTemplate( EFactory eFactory ,
+ const ::rtl::OUString& sTemplate );
+ void SetFactoryWindowAttributes( EFactory eFactory ,
+ const ::rtl::OUString& sAttributes);
+ void SetFactoryDefaultFilter ( EFactory eFactory ,
+ const ::rtl::OUString& sFilter );
+
+ //_______________________________________
+
+ /** @short return the corresponding application ID for the given
+ document service name.
+ */
+ static EFactory ClassifyFactoryByServiceName(const ::rtl::OUString& sName);
+
+ //_______________________________________
+
+ /** @short return the corresponding application ID for the given
+ short name.
+ */
+ static EFactory ClassifyFactoryByShortName(const ::rtl::OUString& sName);
+
+ //_______________________________________
+
+ /** @short return the corresponding application ID for the given properties.
+
+ @descr Because this search base on filters currently (till we have a better solution)
+ a result is not guaranteed everytimes. May a filter does not exists for the specified
+ content (but a FrameLoader which is not bound to any application!) ... or
+ the given properties describe a stream (and we make no deep detection inside here!).
+
+ @attention The module BASIC cant be detected here. Because it does not
+ has an own URL schema.
+
+ @param sURL
+ the complete URL!
+
+ @param lMediaDescriptor
+ additional informations
+
+ @return A suitable enum value. See EFactory above.
+ */
+ static EFactory ClassifyFactoryByURL(const ::rtl::OUString& sURL ,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lMediaDescriptor);
+
+ //_______________________________________
+
+ /** @short return the corresponding application ID for the given properties.
+
+ @descr Here we try to use the list of supported service names of the given model
+ to find out the right application module.
+
+ @attention The module BASIC cant be detected here. Because it does not
+ support any model/ctrl/view paradigm.
+
+ @param xModel
+ the document model
+
+ @return A suitable enum value. See EFactory above.
+ */
+ static EFactory ClassifyFactoryByModel(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModel);
+
+ ::rtl::OUString GetDefaultModuleName();
+
+ //---------------------------------------------------------------------------------------------------------
+ // old interface ...
+ //---------------------------------------------------------------------------------------------------------
+ sal_Bool IsMath () const;
+ sal_Bool IsChart () const;
+ sal_Bool IsCalc () const;
+ sal_Bool IsDraw () const;
+ sal_Bool IsWriter () const;
+ sal_Bool IsImpress () const;
+ sal_Bool IsBasicIDE () const;
+ sal_Bool IsDataBase () const;
+ sal_uInt32 GetFeatures() const;
+
+ ::com::sun::star::uno::Sequence < ::rtl::OUString > GetAllServiceNames();
+
+ //-------------------------------------------------------------------------------------------------------------
+ // private methods
+ //-------------------------------------------------------------------------------------------------------------
+ private:
+ UNOTOOLS_DLLPRIVATE static ::osl::Mutex& impl_GetOwnStaticMutex();
+
+ //-------------------------------------------------------------------------------------------------------------
+ // private member
+ //-------------------------------------------------------------------------------------------------------------
+ private:
+
+ /*Attention
+
+ Don't initialize these static member in these header!
+ a) Double defined symbols will be detected ...
+ b) and unresolved externals exist at linking time.
+ Do it in your source only.
+ */
+
+ static SvtModuleOptions_Impl* m_pDataContainer ; /// impl. data container as dynamic pointer for smaller memory requirements!
+ static sal_Int32 m_nRefCount ; /// internal ref count mechanism
+
+}; // class SvtModuleOptions
+
+#endif // #ifndef INCLUDED_SVTOOLS_MODULEOPTIONS_HXX
diff --git a/unotools/inc/unotools/nativenumberwrapper.hxx b/unotools/inc/unotools/nativenumberwrapper.hxx
new file mode 100644
index 000000000000..9b7d5c130a51
--- /dev/null
+++ b/unotools/inc/unotools/nativenumberwrapper.hxx
@@ -0,0 +1,75 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "unotools/unotoolsdllapi.h"
+
+#ifndef _UNOTOOLS_NATIVENUMBERWRAPPER_HXX
+#define _UNOTOOLS_NATIVENUMBERWRAPPER_HXX
+#include <com/sun/star/i18n/XNativeNumberSupplier.hpp>
+
+namespace com { namespace sun { namespace star {
+ namespace lang {
+ class XMultiServiceFactory;
+ }
+}}}
+
+
+class UNOTOOLS_DLLPUBLIC NativeNumberWrapper
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xSMgr;
+ ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XNativeNumberSupplier > xNNS;
+ // not implemented, prevent usage
+ NativeNumberWrapper( const NativeNumberWrapper& );
+ NativeNumberWrapper& operator=( const NativeNumberWrapper& );
+
+public:
+ NativeNumberWrapper(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & xSF
+ );
+
+ ~NativeNumberWrapper();
+
+ // Wrapper implementations of XNativeNumberSupplier
+
+ ::rtl::OUString getNativeNumberString(
+ const ::rtl::OUString& rNumberString,
+ const ::com::sun::star::lang::Locale& rLocale,
+ sal_Int16 nNativeNumberMode ) const;
+
+ sal_Bool isValidNatNum(
+ const ::com::sun::star::lang::Locale& rLocale,
+ sal_Int16 nNativeNumberMode ) const;
+
+ ::com::sun::star::i18n::NativeNumberXmlAttributes convertToXmlAttributes(
+ const ::com::sun::star::lang::Locale& rLocale,
+ sal_Int16 nNativeNumberMode ) const;
+
+ sal_Int16 convertFromXmlAttributes(
+ const ::com::sun::star::i18n::NativeNumberXmlAttributes& rAttr ) const;
+
+};
+
+#endif // _UNOTOOLS_NATIVENUMBERWRAPPER_HXX
diff --git a/unotools/inc/unotools/numberformatcodewrapper.hxx b/unotools/inc/unotools/numberformatcodewrapper.hxx
new file mode 100644
index 000000000000..394346275b14
--- /dev/null
+++ b/unotools/inc/unotools/numberformatcodewrapper.hxx
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _UNOTOOLS_NUMBERFORMATCODEWRAPPER_HXX
+#define _UNOTOOLS_NUMBERFORMATCODEWRAPPER_HXX
+
+#include <com/sun/star/i18n/XNumberFormatCode.hpp>
+#include "unotools/unotoolsdllapi.h"
+
+namespace com { namespace sun { namespace star {
+ namespace lang {
+ class XMultiServiceFactory;
+ }
+}}}
+
+
+class UNOTOOLS_DLLPUBLIC NumberFormatCodeWrapper
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xSMgr;
+ ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XNumberFormatCode > xNFC;
+ ::com::sun::star::lang::Locale aLocale;
+
+ // not implemented, prevent usage
+ NumberFormatCodeWrapper( const NumberFormatCodeWrapper& );
+ NumberFormatCodeWrapper& operator=( const NumberFormatCodeWrapper& );
+
+public:
+ NumberFormatCodeWrapper(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & xSF,
+ const ::com::sun::star::lang::Locale& rLocale
+ );
+
+ ~NumberFormatCodeWrapper();
+
+
+ /// set a new Locale
+ void setLocale( const ::com::sun::star::lang::Locale& rLocale );
+
+ /// get current Locale
+ const ::com::sun::star::lang::Locale& getLocale() const { return aLocale; }
+
+
+ // Wrapper implementations of class NumberFormatCodeMapper
+
+ ::com::sun::star::i18n::NumberFormatCode getDefault( sal_Int16 nFormatType, sal_Int16 nFormatUsage ) const;
+ ::com::sun::star::i18n::NumberFormatCode getFormatCode( sal_Int16 nFormatIndex ) const;
+ ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::NumberFormatCode > getAllFormatCode( sal_Int16 nFormatUsage ) const;
+ ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::NumberFormatCode > getAllFormatCodes() const;
+
+};
+
+#endif // _UNOTOOLS_NUMBERFORMATCODEWRAPPER_HXX
diff --git a/unotools/inc/unotools/options.hxx b/unotools/inc/unotools/options.hxx
new file mode 100644
index 000000000000..0279e16df1d9
--- /dev/null
+++ b/unotools/inc/unotools/options.hxx
@@ -0,0 +1,97 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_unotools_OPTIONS_HXX
+#define INCLUDED_unotools_OPTIONS_HXX
+
+#include "sal/config.h"
+#include "unotools/unotoolsdllapi.h"
+
+/*
+ The class utl::detail::Options provides a kind of multiplexer. It implements a ConfigurationListener
+ that is usually registered at a ConfigItem class. At the same time it implements a ConfigurationBroadcaster
+ that allows further ("external") listeners to register.
+ Once the class deriving from Options is notified about
+ configuration changes by the ConfigItem if its content has been changed by calling some of its methods,
+ a call of the Options::NotifyListeners() method will send out notifications to all external listeners.
+*/
+
+namespace utl {
+
+ class ConfigurationBroadcaster;
+ class IMPL_ConfigurationListenerList;
+
+ // interface for configuration listener
+ class UNOTOOLS_DLLPUBLIC ConfigurationListener
+ {
+ public:
+ virtual void ConfigurationChanged( ConfigurationBroadcaster* p, sal_uInt32 nHint=0 ) = 0;
+ };
+
+ // complete broadcasting implementation
+ class UNOTOOLS_DLLPUBLIC ConfigurationBroadcaster
+ {
+ IMPL_ConfigurationListenerList* mpList;
+ sal_Int32 m_nBroadcastBlocked; // broadcast only if this is 0
+ sal_uInt32 m_nBlockedHint;
+
+ public:
+ void AddListener( utl::ConfigurationListener* pListener );
+ void RemoveListener( utl::ConfigurationListener* pListener );
+
+ // notify listeners; nHint is an implementation detail of the particular class deriving from ConfigurationBroadcaster
+ void NotifyListeners( sal_uInt32 nHint );
+ ConfigurationBroadcaster();
+ virtual ~ConfigurationBroadcaster();
+ virtual void BlockBroadcasts( bool bBlock );
+ };
+
+namespace detail {
+
+// A base class for the various option classes supported by
+// unotools/source/config/itemholderbase.hxx (which must be public, as it is
+// shared between unotools, svl and svt)
+// It also provides an implementation for a Configuration Listener and inherits a broadcaster implementation
+
+class UNOTOOLS_DLLPUBLIC Options : public utl::ConfigurationBroadcaster, public utl::ConfigurationListener
+{
+public:
+ Options();
+
+ virtual ~Options() = 0;
+
+private:
+ UNOTOOLS_DLLPRIVATE Options(Options &); // not defined
+ UNOTOOLS_DLLPRIVATE void operator =(Options &); // not defined
+
+protected:
+ virtual void ConfigurationChanged( ::utl::ConfigurationBroadcaster* p, sal_uInt32 nHint=0 );
+};
+
+} }
+
+#endif
diff --git a/unotools/inc/unotools/optionsdlg.hxx b/unotools/inc/unotools/optionsdlg.hxx
new file mode 100644
index 000000000000..833e8d5700c3
--- /dev/null
+++ b/unotools/inc/unotools/optionsdlg.hxx
@@ -0,0 +1,56 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef INCLUDED_unotools_OPTIONSDLG_HXX
+#define INCLUDED_unotools_OPTIONSDLG_HXX
+
+#ifndef INCLUDED_unotoolsdllapi_H
+#include "unotools/unotoolsdllapi.h"
+#endif
+#include <tools/string.hxx>
+#include <unotools/options.hxx>
+
+class SvtOptionsDlgOptions_Impl;
+
+class UNOTOOLS_DLLPUBLIC SvtOptionsDialogOptions: public utl::detail::Options
+{
+private:
+ SvtOptionsDlgOptions_Impl* m_pImp;
+
+public:
+ SvtOptionsDialogOptions();
+ virtual ~SvtOptionsDialogOptions();
+
+ sal_Bool IsGroupHidden ( const String& _rGroup ) const;
+ sal_Bool IsPageHidden ( const String& _rPage,
+ const String& _rGroup ) const;
+ sal_Bool IsOptionHidden ( const String& _rOption,
+ const String& _rPage,
+ const String& _rGroup ) const;
+};
+
+#endif
+
diff --git a/unotools/inc/unotools/pathoptions.hxx b/unotools/inc/unotools/pathoptions.hxx
new file mode 100644
index 000000000000..4d94c93cca4a
--- /dev/null
+++ b/unotools/inc/unotools/pathoptions.hxx
@@ -0,0 +1,140 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef INCLUDED_unotools_PATHOPTIONS_HXX
+#define INCLUDED_unotools_PATHOPTIONS_HXX
+
+#include "unotools/unotoolsdllapi.h"
+#include <tools/string.hxx>
+#include <com/sun/star/lang/Locale.hpp>
+#include <unotools/options.hxx>
+
+#define SVT_SEARCHPATH_DELIMITER ';'
+
+// class SvtPathOptions --------------------------------------------------
+
+class SvtPathOptions_Impl;
+class UNOTOOLS_DLLPUBLIC SvtPathOptions: public utl::detail::Options
+{
+private:
+ SvtPathOptions_Impl* pImp;
+
+public:
+ enum Pathes
+ {
+ PATH_ADDIN,
+ PATH_AUTOCORRECT,
+ PATH_AUTOTEXT,
+ PATH_BACKUP,
+ PATH_BASIC,
+ PATH_BITMAP,
+ PATH_CONFIG,
+ PATH_DICTIONARY,
+ PATH_FAVORITES,
+ PATH_FILTER,
+ PATH_GALLERY,
+ PATH_GRAPHIC,
+ PATH_HELP,
+ PATH_LINGUISTIC,
+ PATH_MODULE,
+ PATH_PALETTE,
+ PATH_PLUGIN,
+ PATH_STORAGE,
+ PATH_TEMP,
+ PATH_TEMPLATE,
+ PATH_USERCONFIG,
+ PATH_WORK,
+ PATH_UICONFIG,
+ PATH_FINGERPRINT,
+ PATH_COUNT // should always be the last element
+ };
+
+ SvtPathOptions();
+ virtual ~SvtPathOptions();
+
+ // get the pathes, not const because of using a mutex
+ const String& GetAddinPath() const;
+ const String& GetAutoCorrectPath() const;
+ const String& GetAutoTextPath() const;
+ const String& GetBackupPath() const;
+ const String& GetBasicPath() const;
+ const String& GetBitmapPath() const;
+ const String& GetConfigPath() const;
+ const String& GetDictionaryPath() const;
+ const String& GetFavoritesPath() const;
+ const String& GetFilterPath() const;
+ const String& GetGalleryPath() const;
+ const String& GetGraphicPath() const;
+ const String& GetHelpPath() const;
+ const String& GetLinguisticPath() const;
+ const String& GetModulePath() const;
+ const String& GetPalettePath() const;
+ const String& GetPluginPath() const;
+ const String& GetStoragePath() const;
+ const String& GetTempPath() const;
+ const String& GetTemplatePath() const;
+ const String& GetUserConfigPath() const;
+ const String& GetWorkPath() const;
+ const String& GetUIConfigPath() const;
+ const String& GetFingerprintPath() const;
+
+ BOOL IsPathReadonly(Pathes ePath)const;
+ const String& GetPath(Pathes ePath) const;
+
+ // set the pathes
+ void SetAddinPath( const String& rPath );
+ void SetAutoCorrectPath( const String& rPath );
+ void SetAutoTextPath( const String& rPath );
+ void SetBackupPath( const String& rPath );
+ void SetBasicPath( const String& rPath );
+ void SetBitmapPath( const String& rPath );
+ void SetConfigPath( const String& rPath );
+ void SetDictionaryPath( const String& rPath );
+ void SetFavoritesPath( const String& rPath );
+ void SetFilterPath( const String& rPath );
+ void SetGalleryPath( const String& rPath );
+ void SetGraphicPath( const String& rPath );
+ void SetHelpPath( const String& rPath );
+ void SetLinguisticPath( const String& rPath );
+ void SetModulePath( const String& rPath );
+ void SetPalettePath( const String& rPath );
+ void SetPluginPath( const String& rPath );
+ void SetStoragePath( const String& rPath );
+ void SetTempPath( const String& rPath );
+ void SetTemplatePath( const String& rPath );
+ void SetUserConfigPath( const String& rPath );
+ void SetWorkPath( const String& rPath );
+ void SetPath( SvtPathOptions::Pathes ePath, const String& rNewPath );
+
+ String SubstituteVariable( const String& rVar );
+ String UseVariable( const String& rVar );
+ sal_Bool SearchFile( String& rIniFile, Pathes ePath = PATH_USERCONFIG );
+ ::com::sun::star::lang::Locale GetLocale() const;
+ sal_Bool IsReadonly() const;
+};
+
+#endif // #ifndef INCLUDED_unotools_PATHOPTIONS_HXX
+
diff --git a/unotools/inc/unotools/printwarningoptions.hxx b/unotools/inc/unotools/printwarningoptions.hxx
new file mode 100644
index 000000000000..94f3bc6a3ddb
--- /dev/null
+++ b/unotools/inc/unotools/printwarningoptions.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 INCLUDED_unotools_PRINTWARNINGOPTIONS_HXX
+#define INCLUDED_unotools_PRINTWARNINGOPTIONS_HXX
+
+//_________________________________________________________________________________________________________________
+// includes
+//_________________________________________________________________________________________________________________
+
+#include "unotools/unotoolsdllapi.h"
+#include <sal/types.h>
+#include <osl/mutex.hxx>
+#include <rtl/ustring.hxx>
+#include <unotools/options.hxx>
+
+//_________________________________________________________________________________________________________________
+// forward declarations
+//_________________________________________________________________________________________________________________
+
+/*-************************************************************************************************************//**
+ @short forward declaration to our private date container implementation
+ @descr We use these class as internal member to support small memory requirements.
+ You can create the container if it is neccessary. The class which use these mechanism
+ is faster and smaller then a complete implementation!
+*//*-*************************************************************************************************************/
+
+class SvtPrintWarningOptions_Impl;
+
+//_________________________________________________________________________________________________________________
+// declarations
+//_________________________________________________________________________________________________________________
+
+/*-************************************************************************************************************//**
+ @short collect informations about startup features
+ @descr -
+
+ @implements -
+ @base -
+
+ @devstatus ready to use
+*//*-*************************************************************************************************************/
+
+class UNOTOOLS_DLLPUBLIC SvtPrintWarningOptions: public utl::detail::Options
+{
+ //-------------------------------------------------------------------------------------------------------------
+ // public methods
+ //-------------------------------------------------------------------------------------------------------------
+
+ public:
+
+ //---------------------------------------------------------------------------------------------------------
+ // constructor / destructor
+ //---------------------------------------------------------------------------------------------------------
+
+ /*-****************************************************************************************************//**
+ @short standard constructor and destructor
+ @descr This will initialize an instance with default values.
+ We implement these class with a refcount mechanism! Every instance of this class increase it
+ at create and decrease it at delete time - but all instances use the same data container!
+ He is implemented as a static member ...
+
+ @seealso member m_nRefCount
+ @seealso member m_pDataContainer
+
+ @param -
+ @return -
+
+ @onerror -
+ *//*-*****************************************************************************************************/
+
+ SvtPrintWarningOptions();
+ virtual ~SvtPrintWarningOptions();
+
+ //---------------------------------------------------------------------------------------------------------
+ // interface
+ //---------------------------------------------------------------------------------------------------------
+
+ /*-****************************************************************************************************//**
+ @short interface methods to get and set value of config key "org.openoffice.Office.Common/Print/Warning..."
+ @descr These options describe internal states to enable/disable features of installed office.
+
+ @seealso configuration package "org.openoffice.Office.Common/_3D-Engine"
+ *//*-*****************************************************************************************************/
+
+ sal_Bool IsPaperSize() const;
+ sal_Bool IsPaperOrientation() const;
+ sal_Bool IsNotFound() const;
+ sal_Bool IsTransparency() const;
+ sal_Bool IsModifyDocumentOnPrintingAllowed() const;
+
+ void SetPaperSize( sal_Bool bState );
+ void SetPaperOrientation( sal_Bool bState );
+ void SetNotFound( sal_Bool bState );
+ void SetTransparency( sal_Bool bState );
+ void SetModifyDocumentOnPrintingAllowed( sal_Bool bState );
+
+ //-------------------------------------------------------------------------------------------------------------
+ // private methods
+ //-------------------------------------------------------------------------------------------------------------
+
+ private:
+
+ /*-****************************************************************************************************//**
+ @short return a reference to a static mutex
+ @descr These class use his own static mutex to be threadsafe.
+ We create a static mutex only for one ime and use at different times.
+
+ @seealso -
+
+ @param -
+ @return A reference to a static mutex member.
+
+ @onerror -
+ *//*-*****************************************************************************************************/
+
+ UNOTOOLS_DLLPRIVATE static ::osl::Mutex& GetOwnStaticMutex();
+
+ //-------------------------------------------------------------------------------------------------------------
+ // private member
+ //-------------------------------------------------------------------------------------------------------------
+ private:
+
+ /*Attention
+
+ Don't initialize these static member in these header!
+ a) Double dfined symbols will be detected ...
+ b) and unresolved externals exist at linking time.
+ Do it in your source only.
+ */
+
+ static SvtPrintWarningOptions_Impl* m_pDataContainer ; /// impl. data container as dynamic pointer for smaller memory requirements!
+ static sal_Int32 m_nRefCount ; /// internal ref count mechanism
+
+}; // class SvtPrintWarningOptions
+
+#endif // #ifndef INCLUDED_unotools_PRINTWARNINGOPTIONS_HXX
diff --git a/unotools/inc/unotools/processfactory.hxx b/unotools/inc/unotools/processfactory.hxx
new file mode 100644
index 000000000000..fd852f2c46fa
--- /dev/null
+++ b/unotools/inc/unotools/processfactory.hxx
@@ -0,0 +1,59 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _UNOTOOLS_PROCESSFACTORY_HXX_
+#define _UNOTOOLS_PROCESSFACTORY_HXX_
+
+#include "unotools/unotoolsdllapi.h"
+#include <comphelper/processfactory.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+
+namespace com { namespace sun { namespace star { namespace lang {
+ class XMultiServiceFactory;
+} } } }
+
+namespace utl
+{
+
+/**
+ * This function set the process service factory.
+ *
+ * @author Juergen Schmidt
+ */
+UNOTOOLS_DLLPUBLIC void setProcessServiceFactory(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xSMgr);
+
+/**
+ * This function get the process service factory. If no service factory is set the function returns
+ * a null interface.
+ *
+ * @author Juergen Schmidt
+ */
+UNOTOOLS_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > getProcessServiceFactory();
+
+}
+
+#endif // _UNOTOOLS_PROCESSFACTORY_HXX_
+
diff --git a/unotools/inc/unotools/progresshandlerwrap.hxx b/unotools/inc/unotools/progresshandlerwrap.hxx
new file mode 100644
index 000000000000..4326da0a331f
--- /dev/null
+++ b/unotools/inc/unotools/progresshandlerwrap.hxx
@@ -0,0 +1,57 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "unotools/unotoolsdllapi.h"
+
+#ifndef _UTL_PROGRESSHANDLERWRAP_HXX_
+#define _UTL_PROGRESSHANDLERWRAP_HXX_
+#include <cppuhelper/implbase1.hxx>
+#include <com/sun/star/task/XStatusIndicator.hpp>
+#include <com/sun/star/ucb/XProgressHandler.hpp>
+
+namespace utl
+{
+
+class UNOTOOLS_DLLPUBLIC ProgressHandlerWrap : public ::cppu::WeakImplHelper1< ::com::sun::star::ucb::XProgressHandler >
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator > m_xStatusIndicator;
+
+public:
+ ProgressHandlerWrap( ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator > xSI );
+
+ // XProgressHandler
+ virtual void SAL_CALL push( const ::com::sun::star::uno::Any& Status )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL update( const ::com::sun::star::uno::Any& Status )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL pop()
+ throw (::com::sun::star::uno::RuntimeException);
+};
+
+} // namespace utl
+
+#endif // _UTL_PROGRESSHANDLERWRAP_HXX_
+
diff --git a/unotools/inc/unotools/propertysethelper.hxx b/unotools/inc/unotools/propertysethelper.hxx
new file mode 100644
index 000000000000..ad6508e76df3
--- /dev/null
+++ b/unotools/inc/unotools/propertysethelper.hxx
@@ -0,0 +1,96 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _UTL_PROPERTYSETHELPER_HXX_
+#define _UTL_PROPERTYSETHELPER_HXX_
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include <com/sun/star/beans/XMultiPropertySet.hpp>
+
+//=========================================================================
+//= property helper classes
+//=========================================================================
+
+//... namespace utl .......................................................
+namespace utl
+{
+//.........................................................................
+
+class PropertySetInfo;
+struct PropertyMapEntry;
+class PropertySetHelperImpl;
+
+class PropertySetHelper : public ::com::sun::star::beans::XPropertySet,
+ public ::com::sun::star::beans::XPropertyState,
+ public ::com::sun::star::beans::XMultiPropertySet
+{
+private:
+ PropertySetHelperImpl* mp;
+
+protected:
+ virtual void _setPropertyValues( const utl::PropertyMapEntry** ppEntries, const ::com::sun::star::uno::Any* pValues ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException ) = 0;
+ virtual void _getPropertyValues( const utl::PropertyMapEntry** ppEntries, ::com::sun::star::uno::Any* pValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException ) = 0;
+
+ virtual void _getPropertyStates( const utl::PropertyMapEntry** ppEntries, ::com::sun::star::beans::PropertyState* pStates ) throw(::com::sun::star::beans::UnknownPropertyException );
+ virtual void _setPropertyToDefault( const utl::PropertyMapEntry* pEntry ) throw(::com::sun::star::beans::UnknownPropertyException );
+ virtual ::com::sun::star::uno::Any _getPropertyDefault( const utl::PropertyMapEntry* pEntry ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException );
+
+public:
+ PropertySetHelper( utl::PropertySetInfo* pInfo ) throw();
+ virtual ~PropertySetHelper() throw();
+
+ // XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // XMultiPropertySet
+// virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertiesChangeListener( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertiesChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL firePropertiesChangeEvent( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XPropertyState
+ virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL getPropertyStates( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyToDefault( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( const ::rtl::OUString& aPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+};
+
+//.........................................................................
+}
+//... namespace utl .......................................................
+
+#endif // _UTL_PROPERTYSETHELPER_HXX_
+
diff --git a/unotools/inc/unotools/propertysetinfo.hxx b/unotools/inc/unotools/propertysetinfo.hxx
new file mode 100644
index 000000000000..7e3f26dfc73b
--- /dev/null
+++ b/unotools/inc/unotools/propertysetinfo.hxx
@@ -0,0 +1,93 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _UTL_PROPERTSETINFO_HXX_
+#define _UTL_PROPERTSETINFO_HXX_
+
+#include <com/sun/star/uno/Type.h>
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#include <cppuhelper/implbase1.hxx>
+#include <comphelper/stl_types.hxx>
+
+//=========================================================================
+//= property helper classes
+//=========================================================================
+
+//... namespace utl .......................................................
+namespace utl
+{
+//.........................................................................
+
+struct PropertyMapEntry
+{
+ const sal_Char* mpName;
+ sal_uInt16 mnNameLen;
+ sal_uInt16 mnWhich;
+ const com::sun::star::uno::Type* mpType;
+ sal_Int16 mnFlags;
+ sal_uInt8 mnMemberId;
+};
+
+DECLARE_STL_USTRINGACCESS_MAP( PropertyMapEntry*, PropertyMap );
+
+class PropertyMapImpl;
+
+/** this class implements a XPropertySetInfo that is initialized with arrays of PropertyMapEntry.
+ It is used by the class PropertySetHelper.
+*/
+class PropertySetInfo : public ::cppu::WeakImplHelper1< ::com::sun::star::beans::XPropertySetInfo >
+{
+private:
+ PropertyMapImpl* mpMap;
+public:
+ PropertySetInfo() throw();
+ virtual ~PropertySetInfo() throw();
+
+ /** returns a stl map with all PropertyMapEntry pointer.<p>
+ The key is the property name.
+ */
+ const PropertyMap* getPropertyMap() const throw();
+
+ /** adds an array of PropertyMapEntry to this instance.<p>
+ The end is marked with a PropertyMapEntry where mpName equals NULL
+ */
+ void add( PropertyMapEntry* pMap ) throw();
+
+ /** removes an already added PropertyMapEntry which string in mpName equals to aName */
+ void remove( const rtl::OUString& aName ) throw();
+
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > SAL_CALL getProperties() throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::beans::Property SAL_CALL getPropertyByName( const ::rtl::OUString& aName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasPropertyByName( const ::rtl::OUString& Name ) throw(::com::sun::star::uno::RuntimeException);
+};
+
+//.........................................................................
+}
+//... namespace utl .......................................................
+
+#endif // _UTL_PROPERTSETINFO_HXX_
+
diff --git a/unotools/inc/unotools/querydeep.hxx b/unotools/inc/unotools/querydeep.hxx
new file mode 100644
index 000000000000..fd57f38147d0
--- /dev/null
+++ b/unotools/inc/unotools/querydeep.hxx
@@ -0,0 +1,486 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _UNOTOOLS_QUERYDEEPINTERFACE_HXX
+#define _UNOTOOLS_QUERYDEEPINTERFACE_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Type.hxx>
+
+/** */ //for docpp
+namespace utl
+{
+
+//--------------------------------------------------------------------------------------------------------
+/**
+ * Inspect interfaces types whether they are related by inheritance.
+ *<BR>
+ * @return true if rType is derived from rBaseType
+ * @param rBaseType a <type>Type</type> of an interface.
+ * @param rType a <type>Type</type> of an interface.
+ */
+sal_Bool isDerivedFrom(
+ const ::com::sun::star::uno::Type & rBaseType,
+ const ::com::sun::star::uno::Type & rType );
+
+//--------------------------------------------------------------------------------------------------------
+/**
+ * Inspect interface types whether they are related by inheritance.
+ *<BR>
+ * @return true if p is of a type derived from rBaseType
+ * @param rBaseType a <type>Type</type> of an interface.
+ * @param p a pointer to an interface.
+ */
+template <class Interface>
+inline sal_Bool isDerivedFrom(
+ const ::com::sun::star::uno::Type& rBaseType,
+ Interface* /*p*/)
+{
+ return isDerivedFrom(
+ rBaseType,
+ ::getCppuType(static_cast<const ::com::sun::star::uno::Reference<Interface> *>(0)));
+}
+
+//--------------------------------------------------------------------------------------------------------
+// possible optimization ?
+// Any aRet(::cppu::queryInterface(rType, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12));
+// if (aRet.hasValue())
+// return aRet;
+
+/**
+ * Inspect types and choose return proper interface.
+ *<BR>
+ * @param p1 a pointer to an interface.
+ */
+template< class Interface1 >
+inline ::com::sun::star::uno::Any queryDeepInterface(
+ const ::com::sun::star::uno::Type & rType,
+ Interface1 * p1 )
+{
+ if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface1 > *>(0))))
+ return ::com::sun::star::uno::Any( &p1, rType );
+ else
+ return ::com::sun::star::uno::Any();
+}
+
+/**
+ * Inspect types and choose return proper interface.
+ *<BR>
+ * @param p1 a pointer to an interface.
+ * @param p2 a pointer to an interface.
+ */
+template< class Interface1, class Interface2 >
+inline ::com::sun::star::uno::Any queryDeepInterface(
+ const ::com::sun::star::uno::Type & rType,
+ Interface1 * p1, Interface2 * p2 )
+{
+ if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface1 > *>(0))))
+ return ::com::sun::star::uno::Any( &p1, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface2 > *>(0))))
+ return ::com::sun::star::uno::Any( &p2, rType );
+ else
+ return ::com::sun::star::uno::Any();
+}
+
+/**
+ * Inspect types and choose return proper interface.
+ *<BR>
+ * @param p1 a pointer to an interface.
+ * @param p2 a pointer to an interface.
+ * @param p3 a pointer to an interface.
+ */
+template< class Interface1, class Interface2, class Interface3 >
+inline ::com::sun::star::uno::Any queryDeepInterface(
+ const ::com::sun::star::uno::Type & rType,
+ Interface1 * p1, Interface2 * p2, Interface3 * p3 )
+{
+ if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface1 > *>(0))))
+ return ::com::sun::star::uno::Any( &p1, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface2 > *>(0))))
+ return ::com::sun::star::uno::Any( &p2, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface3 > *>(0))))
+ return ::com::sun::star::uno::Any( &p3, rType );
+ else
+ return ::com::sun::star::uno::Any();
+}
+
+/**
+ * Inspect types and choose return proper interface.
+ *<BR>
+ * @param p1 a pointer to an interface.
+ * @param p2 a pointer to an interface.
+ * @param p3 a pointer to an interface.
+ * @param p4 a pointer to an interface.
+ */
+template< class Interface1, class Interface2, class Interface3, class Interface4 >
+inline ::com::sun::star::uno::Any queryDeepInterface(
+ const ::com::sun::star::uno::Type & rType,
+ Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4 )
+{
+ if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface1 > *>(0))))
+ return ::com::sun::star::uno::Any( &p1, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface2 > *>(0))))
+ return ::com::sun::star::uno::Any( &p2, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface3 > *>(0))))
+ return ::com::sun::star::uno::Any( &p3, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface4 > *>(0))))
+ return ::com::sun::star::uno::Any( &p4, rType );
+ else
+ return ::com::sun::star::uno::Any();
+}
+
+/**
+ * Inspect types and choose return proper interface.
+ *<BR>
+ * @param p1 a pointer to an interface.
+ * @param p2 a pointer to an interface.
+ * @param p3 a pointer to an interface.
+ * @param p4 a pointer to an interface.
+ * @param p5 a pointer to an interface.
+ */
+template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5 >
+inline ::com::sun::star::uno::Any queryDeepInterface(
+ const ::com::sun::star::uno::Type & rType,
+ Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5 )
+{
+ if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface1 > *>(0))))
+ return ::com::sun::star::uno::Any( &p1, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface2 > *>(0))))
+ return ::com::sun::star::uno::Any( &p2, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface3 > *>(0))))
+ return ::com::sun::star::uno::Any( &p3, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface4 > *>(0))))
+ return ::com::sun::star::uno::Any( &p4, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface5 > *>(0))))
+ return ::com::sun::star::uno::Any( &p5, rType );
+ else
+ return ::com::sun::star::uno::Any();
+}
+
+/**
+ * Inspect types and choose return proper interface.
+ *<BR>
+ * @param p1 a pointer to an interface.
+ * @param p2 a pointer to an interface.
+ * @param p3 a pointer to an interface.
+ * @param p4 a pointer to an interface.
+ * @param p5 a pointer to an interface.
+ * @param p6 a pointer to an interface.
+ */
+template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5,
+ class Interface6 >
+inline ::com::sun::star::uno::Any queryDeepInterface(
+ const ::com::sun::star::uno::Type & rType,
+ Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5,
+ Interface6 * p6 )
+{
+ if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface1 > *>(0))))
+ return ::com::sun::star::uno::Any( &p1, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface2 > *>(0))))
+ return ::com::sun::star::uno::Any( &p2, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface3 > *>(0))))
+ return ::com::sun::star::uno::Any( &p3, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface4 > *>(0))))
+ return ::com::sun::star::uno::Any( &p4, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface5 > *>(0))))
+ return ::com::sun::star::uno::Any( &p5, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface6 > *>(0))))
+ return ::com::sun::star::uno::Any( &p6, rType );
+ else
+ return ::com::sun::star::uno::Any();
+}
+
+/**
+ * Inspect types and choose return proper interface.
+ *<BR>
+ * @param p1 a pointer to an interface.
+ * @param p2 a pointer to an interface.
+ * @param p3 a pointer to an interface.
+ * @param p4 a pointer to an interface.
+ * @param p5 a pointer to an interface.
+ * @param p6 a pointer to an interface.
+ * @param p7 a pointer to an interface.
+ */
+template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5,
+ class Interface6, class Interface7 >
+inline ::com::sun::star::uno::Any queryDeepInterface(
+ const ::com::sun::star::uno::Type & rType,
+ Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5,
+ Interface6 * p6, Interface7 * p7 )
+{
+ if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface1 > *>(0))))
+ return ::com::sun::star::uno::Any( &p1, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface2 > *>(0))))
+ return ::com::sun::star::uno::Any( &p2, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface3 > *>(0))))
+ return ::com::sun::star::uno::Any( &p3, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface4 > *>(0))))
+ return ::com::sun::star::uno::Any( &p4, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface5 > *>(0))))
+ return ::com::sun::star::uno::Any( &p5, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface6 > *>(0))))
+ return ::com::sun::star::uno::Any( &p6, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface7 > *>(0))))
+ return ::com::sun::star::uno::Any( &p7, rType );
+ else
+ return ::com::sun::star::uno::Any();
+}
+
+/**
+ * Inspect types and choose return proper interface.
+ *<BR>
+ * @param p1 a pointer to an interface.
+ * @param p2 a pointer to an interface.
+ * @param p3 a pointer to an interface.
+ * @param p4 a pointer to an interface.
+ * @param p5 a pointer to an interface.
+ * @param p6 a pointer to an interface.
+ * @param p7 a pointer to an interface.
+ * @param p8 a pointer to an interface.
+ */
+template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5,
+ class Interface6, class Interface7, class Interface8 >
+inline ::com::sun::star::uno::Any queryDeepInterface(
+ const ::com::sun::star::uno::Type & rType,
+ Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5,
+ Interface6 * p6, Interface7 * p7, Interface8 * p8 )
+{
+ if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface1 > *>(0))))
+ return ::com::sun::star::uno::Any( &p1, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface2 > *>(0))))
+ return ::com::sun::star::uno::Any( &p2, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface3 > *>(0))))
+ return ::com::sun::star::uno::Any( &p3, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface4 > *>(0))))
+ return ::com::sun::star::uno::Any( &p4, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface5 > *>(0))))
+ return ::com::sun::star::uno::Any( &p5, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface6 > *>(0))))
+ return ::com::sun::star::uno::Any( &p6, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface7 > *>(0))))
+ return ::com::sun::star::uno::Any( &p7, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface8 > *>(0))))
+ return ::com::sun::star::uno::Any( &p8, rType );
+ else
+ return ::com::sun::star::uno::Any();
+}
+
+/**
+ * Inspect types and choose return proper interface.
+ *<BR>
+ * @param p1 a pointer to an interface.
+ * @param p2 a pointer to an interface.
+ * @param p3 a pointer to an interface.
+ * @param p4 a pointer to an interface.
+ * @param p5 a pointer to an interface.
+ * @param p6 a pointer to an interface.
+ * @param p7 a pointer to an interface.
+ * @param p8 a pointer to an interface.
+ * @param p9 a pointer to an interface.
+ */
+template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5,
+ class Interface6, class Interface7, class Interface8, class Interface9 >
+inline ::com::sun::star::uno::Any queryDeepInterface(
+ const ::com::sun::star::uno::Type & rType,
+ Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5,
+ Interface6 * p6, Interface7 * p7, Interface8 * p8, Interface9 * p9 )
+{
+ if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface1 > *>(0))))
+ return ::com::sun::star::uno::Any( &p1, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface2 > *>(0))))
+ return ::com::sun::star::uno::Any( &p2, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface3 > *>(0))))
+ return ::com::sun::star::uno::Any( &p3, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface4 > *>(0))))
+ return ::com::sun::star::uno::Any( &p4, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface5 > *>(0))))
+ return ::com::sun::star::uno::Any( &p5, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface6 > *>(0))))
+ return ::com::sun::star::uno::Any( &p6, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface7 > *>(0))))
+ return ::com::sun::star::uno::Any( &p7, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface8 > *>(0))))
+ return ::com::sun::star::uno::Any( &p8, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface9 > *>(0))))
+ return ::com::sun::star::uno::Any( &p9, rType );
+ else
+ return ::com::sun::star::uno::Any();
+}
+
+/**
+ * Inspect types and choose return proper interface.
+ *<BR>
+ * @param p1 a pointer to an interface.
+ * @param p2 a pointer to an interface.
+ * @param p3 a pointer to an interface.
+ * @param p4 a pointer to an interface.
+ * @param p5 a pointer to an interface.
+ * @param p6 a pointer to an interface.
+ * @param p7 a pointer to an interface.
+ * @param p8 a pointer to an interface.
+ * @param p9 a pointer to an interface.
+ * @param p10 a pointer to an interface.
+ */
+template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5,
+ class Interface6, class Interface7, class Interface8, class Interface9, class Interface10 >
+inline ::com::sun::star::uno::Any queryDeepInterface(
+ const ::com::sun::star::uno::Type & rType,
+ Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5,
+ Interface6 * p6, Interface7 * p7, Interface8 * p8, Interface9 * p9, Interface10 * p10 )
+{
+ if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface1 > *>(0))))
+ return ::com::sun::star::uno::Any( &p1, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface2 > *>(0))))
+ return ::com::sun::star::uno::Any( &p2, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface3 > *>(0))))
+ return ::com::sun::star::uno::Any( &p3, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface4 > *>(0))))
+ return ::com::sun::star::uno::Any( &p4, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface5 > *>(0))))
+ return ::com::sun::star::uno::Any( &p5, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface6 > *>(0))))
+ return ::com::sun::star::uno::Any( &p6, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface7 > *>(0))))
+ return ::com::sun::star::uno::Any( &p7, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface8 > *>(0))))
+ return ::com::sun::star::uno::Any( &p8, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface9 > *>(0))))
+ return ::com::sun::star::uno::Any( &p9, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface10 > *>(0))))
+ return ::com::sun::star::uno::Any( &p10, rType );
+ else
+ return ::com::sun::star::uno::Any();
+}
+
+/**
+ * Inspect types and choose return proper interface.
+ *<BR>
+ * @param p1 a pointer to an interface.
+ * @param p2 a pointer to an interface.
+ * @param p3 a pointer to an interface.
+ * @param p4 a pointer to an interface.
+ * @param p5 a pointer to an interface.
+ * @param p6 a pointer to an interface.
+ * @param p7 a pointer to an interface.
+ * @param p8 a pointer to an interface.
+ * @param p9 a pointer to an interface.
+ * @param p10 a pointer to an interface.
+ * @param p11 a pointer to an interface.
+ */
+template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5,
+ class Interface6, class Interface7, class Interface8, class Interface9, class Interface10,
+ class Interface11 >
+inline ::com::sun::star::uno::Any queryDeepInterface(
+ const ::com::sun::star::uno::Type & rType,
+ Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5,
+ Interface6 * p6, Interface7 * p7, Interface8 * p8, Interface9 * p9, Interface10 * p10,
+ Interface11 * p11 )
+{
+ if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface1 > *>(0))))
+ return ::com::sun::star::uno::Any( &p1, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface2 > *>(0))))
+ return ::com::sun::star::uno::Any( &p2, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface3 > *>(0))))
+ return ::com::sun::star::uno::Any( &p3, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface4 > *>(0))))
+ return ::com::sun::star::uno::Any( &p4, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface5 > *>(0))))
+ return ::com::sun::star::uno::Any( &p5, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface6 > *>(0))))
+ return ::com::sun::star::uno::Any( &p6, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface7 > *>(0))))
+ return ::com::sun::star::uno::Any( &p7, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface8 > *>(0))))
+ return ::com::sun::star::uno::Any( &p8, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface9 > *>(0))))
+ return ::com::sun::star::uno::Any( &p9, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface10 > *>(0))))
+ return ::com::sun::star::uno::Any( &p10, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface11 > *>(0))))
+ return ::com::sun::star::uno::Any( &p11, rType );
+ else
+ return ::com::sun::star::uno::Any();
+}
+
+/**
+ * Inspect types and choose return proper interface.
+ *<BR>
+ * @param p1 a pointer to an interface.
+ * @param p2 a pointer to an interface.
+ * @param p3 a pointer to an interface.
+ * @param p4 a pointer to an interface.
+ * @param p5 a pointer to an interface.
+ * @param p6 a pointer to an interface.
+ * @param p7 a pointer to an interface.
+ * @param p8 a pointer to an interface.
+ * @param p9 a pointer to an interface.
+ * @param p10 a pointer to an interface.
+ * @param p11 a pointer to an interface.
+ * @param p12 a pointer to an interface.
+ */
+template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5,
+ class Interface6, class Interface7, class Interface8, class Interface9, class Interface10,
+ class Interface11, class Interface12 >
+inline ::com::sun::star::uno::Any queryDeepInterface(
+ const ::com::sun::star::uno::Type & rType,
+ Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5,
+ Interface6 * p6, Interface7 * p7, Interface8 * p8, Interface9 * p9, Interface10 * p10,
+ Interface11 * p11, Interface12 * p12 )
+{
+ if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface1 > *>(0))))
+ return ::com::sun::star::uno::Any( &p1, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface2 > *>(0))))
+ return ::com::sun::star::uno::Any( &p2, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface3 > *>(0))))
+ return ::com::sun::star::uno::Any( &p3, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface4 > *>(0))))
+ return ::com::sun::star::uno::Any( &p4, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface5 > *>(0))))
+ return ::com::sun::star::uno::Any( &p5, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface6 > *>(0))))
+ return ::com::sun::star::uno::Any( &p6, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface7 > *>(0))))
+ return ::com::sun::star::uno::Any( &p7, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface8 > *>(0))))
+ return ::com::sun::star::uno::Any( &p8, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface9 > *>(0))))
+ return ::com::sun::star::uno::Any( &p9, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface10 > *>(0))))
+ return ::com::sun::star::uno::Any( &p10, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface11 > *>(0))))
+ return ::com::sun::star::uno::Any( &p11, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface12 > *>(0))))
+ return ::com::sun::star::uno::Any( &p12, rType );
+ else
+ return ::com::sun::star::uno::Any();
+}
+
+} // namespace utl
+
+#endif // _UNOTOOLS_QUERYDEEPINTERFACE_HXX
+
diff --git a/unotools/inc/unotools/readwritemutexguard.hxx b/unotools/inc/unotools/readwritemutexguard.hxx
new file mode 100644
index 000000000000..3035d5bda878
--- /dev/null
+++ b/unotools/inc/unotools/readwritemutexguard.hxx
@@ -0,0 +1,113 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_UNOTOOLS_READWRITEMUTEXGUARD_HXX
+#define INCLUDED_UNOTOOLS_READWRITEMUTEXGUARD_HXX
+
+#include <osl/mutex.hxx>
+
+namespace utl {
+
+class ReadWriteGuard;
+class ReadWriteMutex
+{
+ friend class ReadWriteGuard;
+
+ sal_uInt32 nReadCount;
+ sal_uInt32 nBlockCriticalCount;
+ ::osl::Mutex* pMutex;
+ ::osl::Mutex* pWriteMutex;
+
+public:
+ ReadWriteMutex()
+ : nReadCount(0)
+ , nBlockCriticalCount(0)
+ , pMutex( new ::osl::Mutex )
+ , pWriteMutex( new ::osl::Mutex )
+ {}
+ ~ReadWriteMutex()
+ {
+ delete pMutex;
+ delete pWriteMutex;
+ }
+};
+
+
+namespace ReadWriteGuardMode {
+const sal_Int32 nWrite = 0x01;
+const sal_Int32 nCriticalChange = 0x02 | nWrite;
+const sal_Int32 nBlockCritical = 0x04; // only a block, not a read, exclusive flag!
+}
+
+/** Enable multiple threads to read simultaneously, but a write blocks all
+ other reads and writes, and a read blocks any write.
+ Used in I18N wrappers to be able to maintain a single instance of a wrapper
+ for the standard Office locale.
+ NEVER construct a writing guard if there is already a reading guard in the
+ same context, the following will dead lock EVEN IN THE SAME THREAD!
+ void foo()
+ {
+ ReadWriteGuard aGuard1( aMutex );
+ bar();
+ }
+ void bar()
+ {
+ // waits forever for aGuard1
+ ReadWriteGuard aGuard2( aMutex, ReadWriteGuardMode::nWrite );
+ }
+ */
+class ReadWriteGuard
+{
+ ReadWriteMutex& rMutex;
+ sal_Int32 nMode;
+public:
+ ReadWriteGuard(
+ ReadWriteMutex& rMutex,
+ sal_Int32 nRequestMode = 0 // read only
+ );
+ ~ReadWriteGuard();
+
+ /** Be careful with this, it does wait for ANY read to complete.
+ The following will dead lock EVEN IN THE SAME THREAD!
+ void foo()
+ {
+ ReadWriteGuard aGuard1( aMutex );
+ bar();
+ }
+ void bar()
+ {
+ ReadWriteGuard aGuard2( aMutex );
+ aGuard2.changeReadToWrite(); // waits forever for aGuard1
+ }
+ */
+ void changeReadToWrite();
+};
+
+} // namespace utl
+
+#endif // INCLUDED_UNOTOOLS_READWRITEMUTEXGUARD_HXX
+
diff --git a/unotools/inc/unotools/regoptions.hxx b/unotools/inc/unotools/regoptions.hxx
new file mode 100644
index 000000000000..1cca531886ca
--- /dev/null
+++ b/unotools/inc/unotools/regoptions.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 unotools_REGOPTIONS_HXX
+#define unotools_REGOPTIONS_HXX
+
+#include "unotools/unotoolsdllapi.h"
+#include <tools/string.hxx>
+
+//........................................................................
+namespace utl
+{
+//........................................................................
+
+ //====================================================================
+ //= RegOptions
+ //====================================================================
+ class RegOptionsImpl;
+ /** encapsulates access to the configuration settings for registering the product
+ */
+ class UNOTOOLS_DLLPUBLIC RegOptions
+ {
+ private:
+ RegOptionsImpl* m_pImpl;
+
+ // the impl class is constructed upon need only (as this is expensive)
+ UNOTOOLS_DLLPRIVATE void ensureImpl( );
+
+ public:
+ RegOptions( );
+ ~RegOptions( );
+
+ // retrieves the URL which should be used for online registration
+ String getRegistrationURL( ) const;
+
+ // checks if the menu item which can be used to trigger the online registration should be available
+ sal_Bool allowMenu( ) const;
+
+ enum DialogPermission
+ { // the registration dialog shall be executed ....
+ dpDisabled, // ... never - it has been disabled
+ dpNotThisSession, // ... later - no statement when, but _not now_
+ dpRemindLater, // ... later at a reminder date
+ dpThisSession // ... during this session
+ };
+
+ /** checks if the registration dialog is allowed
+ <p>A return value of <TRUE/> does not mean that during this session, the dialog is allowed to
+ be executed. It simply means executing it is allowed <em>in general</em></p>
+ */
+ DialogPermission getDialogPermission( ) const;
+
+ /** claims that the current session is done with respect to the registration dialog.
+
+ <p>This is not to be called if <method>getDialogPermission</method> returned dpDisabled previously<p>
+ <p>The behaviour changes as follows:
+ <ul>
+ <li>any subsequent calls to <method>getDialogPermission</method> will return dpNotThisSession, given
+ that it previously returned dpNotThisSession</li>
+ <li>any subsequent calls to <method>getDialogPermission</method> will return dpDisabled, given
+ that it previously returned dpThisSession</li>
+ <li>an internal (persistent) session counter is updated, so that during the next session,
+ <method>getDialogPermission</method> <em>may</em> return dpThisSession</li>
+ </ul></p>
+ */
+ void markSessionDone( );
+
+ /** activates the reminder
+
+ <p>If this method is called, the reminder for the dialog will be activated.
+ This means that during the next <arg>_nDaysFromNow</arg>-1 days,
+ <method>getDialogPermission</method> will return dpRemindLater</p>,
+ at the <arg>_nDaysFromNow</arg>th day from today onwards it will
+ return dpThisSession.</p>
+
+ <p>It is not allowed to call this method if the dialog is currently disabled.</p>
+
+ <p>If the current session has not been marked as done already
+ (i.e., <method>markSessionDone</method> has not been called, yet), this is
+ done implicitly when you call <method>activateReminder</method>.</p>
+ */
+ void activateReminder( sal_Int32 _nDaysFromNow );
+
+ /** removes the reminder
+
+ <p>If this method is called, the reminder for the dialog will be removed.
+ */
+ void removeReminder();
+
+ /** checks if the reminder date has come
+
+ <p>Returns <true/> if the current date is greater or equal the reminder date.
+ */
+ bool hasReminderDateCome() const;
+ };
+
+//........................................................................
+} // namespace utl
+//........................................................................
+
+#endif // unotools_REGOPTIONS_HXX
+
diff --git a/unotools/inc/unotools/regpathhelper.hxx b/unotools/inc/unotools/regpathhelper.hxx
new file mode 100644
index 000000000000..1f48dda63fc8
--- /dev/null
+++ b/unotools/inc/unotools/regpathhelper.hxx
@@ -0,0 +1,71 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _UNOTOOLS_REGPATHHELPER_HXX_
+#define _UNOTOOLS_REGPATHHELPER_HXX_
+
+#include <rtl/ustring.hxx>
+
+namespace utl
+{
+
+/**
+ * This function returns a path to the user registry file.
+ * Search for the user registry using the following rules:
+ * <dl>
+ * <dt> 1. (for further use) search in sversion.ini (.sversionrc) for an entry
+ * REGISTRY_VERSION_STRING (example: UserRegistry 5.0/505=test.rdb) in the section
+ * [Registry]. If found, then take this value instead of the name "user.rdb".
+ * <dt> 2. Search in the config directory of the user for a file "user.rdb". If
+ * found return the full path and name of the file. If not found, retry this
+ * step with a dot before ".user.rdb".
+ * <dt> 3. If not found a new user registry with name "user.rdb" will be created in the user
+ * config directory.
+ * </dl>
+ *<BR>
+ * @author Juergen Schmidt
+ */
+::rtl::OUString getPathToUserRegistry();
+
+/**
+ * This function returns a path to the system registry file.
+ * The system registry will always be searched in the same directory of the
+ * executable. The name of the system registry is "applicat.rdb". If the system
+ * registry was not found, then the environment variable STAR_REGISTRY will be checked.
+ * If this variable was set, it must contain a full path to a valid system registry.
+ * Search for the user registry using the following rules:
+ *
+ *<BR>
+ * @author Juergen Schmidt
+ */
+
+::rtl::OUString getPathToSystemRegistry();
+
+}
+
+#endif
+
diff --git a/unotools/inc/unotools/saveopt.hxx b/unotools/inc/unotools/saveopt.hxx
new file mode 100644
index 000000000000..dad0cd742323
--- /dev/null
+++ b/unotools/inc/unotools/saveopt.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 INCLUDED_unotools_SAVEOPT_HXX
+#define INCLUDED_unotools_SAVEOPT_HXX
+
+#include "unotools/unotoolsdllapi.h"
+#include <unotools/options.hxx>
+
+struct SvtLoadSaveOptions_Impl;
+class UNOTOOLS_DLLPUBLIC SvtSaveOptions: public utl::detail::Options
+{
+ SvtLoadSaveOptions_Impl* pImp;
+
+public:
+
+ enum EOption
+ {
+ E_AUTOSAVETIME,
+ E_USEUSERDATA,
+ E_BACKUP,
+ E_AUTOSAVE,
+ E_AUTOSAVEPROMPT,
+ E_DOCINFSAVE,
+ E_SAVEWORKINGSET,
+ E_SAVEDOCWINS,
+ E_SAVEDOCVIEW,
+ E_SAVERELINET,
+ E_SAVERELFSYS,
+ E_SAVEUNPACKED,
+ E_DOPRETTYPRINTING,
+ E_WARNALIENFORMAT,
+ E_LOADDOCPRINTER,
+ E_ODFDEFAULTVERSION
+ };
+
+ // keep enum values sorted that a less or greater compare maps to older and newer versions!
+ enum ODFDefaultVersion
+ {
+ ODFVER_UNKNOWN = 0, // unknown
+ ODFVER_010 = 1, // ODF 1.0
+ ODFVER_011 = 2, // ODF 1.1
+ DO_NOT_USE = 3, // Do not use this, only here for compatibility with pre OOo 3.2 configuration
+ ODFVER_012 = 4, // ODF 1.2
+
+ ODFVER_LATEST = SAL_MAX_ENUM, // ODF latest version with enhancements
+ };
+
+ SvtSaveOptions();
+ virtual ~SvtSaveOptions();
+
+ void SetAutoSaveTime( sal_Int32 n );
+ sal_Int32 GetAutoSaveTime() const;
+
+ void SetUseUserData( sal_Bool b );
+ sal_Bool IsUseUserData() const;
+
+ void SetBackup( sal_Bool b );
+ sal_Bool IsBackup() const;
+
+ void SetAutoSave( sal_Bool b );
+ sal_Bool IsAutoSave() const;
+
+ void SetAutoSavePrompt( sal_Bool b );
+ sal_Bool IsAutoSavePrompt() const;
+
+ void SetDocInfoSave(sal_Bool b);
+ sal_Bool IsDocInfoSave() const;
+
+ void SetSaveWorkingSet( sal_Bool b );
+ sal_Bool IsSaveWorkingSet() const;
+
+ void SetSaveDocWins( sal_Bool b );
+ sal_Bool IsSaveDocWins() const;
+
+ void SetSaveDocView( sal_Bool b );
+ sal_Bool IsSaveDocView() const;
+
+ void SetSaveRelINet( sal_Bool b );
+ sal_Bool IsSaveRelINet() const;
+
+ void SetSaveRelFSys( sal_Bool b );
+ sal_Bool IsSaveRelFSys() const;
+
+ void SetSaveUnpacked( sal_Bool b );
+ sal_Bool IsSaveUnpacked() const;
+
+ void SetLoadUserSettings(sal_Bool b);
+ sal_Bool IsLoadUserSettings() const;
+
+ void SetPrettyPrinting( sal_Bool _bEnable );
+ sal_Bool IsPrettyPrinting( ) const;
+
+ void SetWarnAlienFormat( sal_Bool _bEnable );
+ sal_Bool IsWarnAlienFormat( ) const;
+
+ void SetLoadDocumentPrinter( sal_Bool _bEnable );
+ sal_Bool IsLoadDocumentPrinter( ) const;
+
+ void SetODFDefaultVersion( ODFDefaultVersion eVersion );
+ ODFDefaultVersion GetODFDefaultVersion() const;
+
+ sal_Bool IsReadOnly( EOption eOption ) const;
+};
+
+#endif
+
diff --git a/unotools/inc/unotools/searchopt.hxx b/unotools/inc/unotools/searchopt.hxx
new file mode 100644
index 000000000000..ed4110011df7
--- /dev/null
+++ b/unotools/inc/unotools/searchopt.hxx
@@ -0,0 +1,119 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVT_SEARCHOPT_HXX_
+#define _SVT_SEARCHOPT_HXX_
+
+#include "unotools/unotoolsdllapi.h"
+#include "tools/solar.h"
+
+class SvtSearchOptions_Impl;
+
+class UNOTOOLS_DLLPUBLIC SvtSearchOptions
+{
+ SvtSearchOptions_Impl *pImpl;
+
+ // disallow copy-constructor and assignment-operator for now
+ SvtSearchOptions( const SvtSearchOptions & );
+ SvtSearchOptions & operator = ( const SvtSearchOptions & );
+
+protected:
+
+public:
+ SvtSearchOptions();
+ ~SvtSearchOptions();
+
+ INT32 GetTransliterationFlags() const;
+
+ //
+ // General Options
+ //
+
+ BOOL IsWholeWordsOnly() const;
+ BOOL IsBackwards() const;
+ BOOL IsUseRegularExpression() const;
+ BOOL IsSearchForStyles() const;
+ BOOL IsSimilaritySearch() const;
+ BOOL IsUseAsianOptions() const;
+ BOOL IsMatchCase() const; // also Japanese search option
+ BOOL IsNotes() const;
+
+ void SetWholeWordsOnly( BOOL bVal );
+ void SetBackwards( BOOL bVal );
+ void SetUseRegularExpression( BOOL bVal );
+ void SetSearchForStyles( BOOL bVal );
+ void SetSimilaritySearch( BOOL bVal );
+ void SetUseAsianOptions( BOOL bVal );
+ void SetMatchCase( BOOL bVal ); // also Japanese search option
+ void SetNotes( BOOL bVal);
+
+ //
+ // Japanese search options
+ //
+
+ BOOL IsMatchFullHalfWidthForms() const;
+ BOOL IsMatchHiraganaKatakana() const;
+ BOOL IsMatchContractions() const;
+ BOOL IsMatchMinusDashChoon() const;
+ BOOL IsMatchRepeatCharMarks() const;
+ BOOL IsMatchVariantFormKanji() const;
+ BOOL IsMatchOldKanaForms() const;
+ BOOL IsMatchDiziDuzu() const;
+ BOOL IsMatchBavaHafa() const;
+ BOOL IsMatchTsithichiDhizi() const;
+ BOOL IsMatchHyuiyuByuvyu() const;
+ BOOL IsMatchSesheZeje() const;
+ BOOL IsMatchIaiya() const;
+ BOOL IsMatchKiku() const;
+ BOOL IsIgnorePunctuation() const;
+ BOOL IsIgnoreWhitespace() const;
+ BOOL IsIgnoreProlongedSoundMark() const;
+ BOOL IsIgnoreMiddleDot() const;
+
+ void SetMatchFullHalfWidthForms( BOOL bVal );
+ void SetMatchHiraganaKatakana( BOOL bVal );
+ void SetMatchContractions( BOOL bVal );
+ void SetMatchMinusDashChoon( BOOL bVal );
+ void SetMatchRepeatCharMarks( BOOL bVal );
+ void SetMatchVariantFormKanji( BOOL bVal );
+ void SetMatchOldKanaForms( BOOL bVal );
+ void SetMatchDiziDuzu( BOOL bVal );
+ void SetMatchBavaHafa( BOOL bVal );
+ void SetMatchTsithichiDhizi( BOOL bVal );
+ void SetMatchHyuiyuByuvyu( BOOL bVal );
+ void SetMatchSesheZeje( BOOL bVal );
+ void SetMatchIaiya( BOOL bVal );
+ void SetMatchKiku( BOOL bVal );
+ void SetIgnorePunctuation( BOOL bVal );
+ void SetIgnoreWhitespace( BOOL bVal );
+ void SetIgnoreProlongedSoundMark( BOOL bVal );
+ void SetIgnoreMiddleDot( BOOL bVal );
+};
+
+
+#endif
+
diff --git a/unotools/inc/unotools/securityoptions.hxx b/unotools/inc/unotools/securityoptions.hxx
new file mode 100644
index 000000000000..ddeed4b94520
--- /dev/null
+++ b/unotools/inc/unotools/securityoptions.hxx
@@ -0,0 +1,296 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef INCLUDED_unotools_SECURITYOPTIONS_HXX
+#define INCLUDED_unotools_SECURITYOPTIONS_HXX
+
+//_________________________________________________________________________________________________________________
+// includes
+//_________________________________________________________________________________________________________________
+
+#include "unotools/unotoolsdllapi.h"
+#include <sal/types.h>
+#include <osl/mutex.hxx>
+#include <com/sun/star/uno/Sequence.h>
+#include <rtl/ustring.hxx>
+#include <unotools/options.hxx>
+
+//_________________________________________________________________________________________________________________
+// forward declarations
+//_________________________________________________________________________________________________________________
+
+/*-************************************************************************************************************//**
+ @short forward declaration to our private date container implementation
+ @descr We use these class as internal member to support small memory requirements.
+ You can create the container if it is neccessary. The class which use these mechanism
+ is faster and smaller then a complete implementation!
+*//*-*************************************************************************************************************/
+
+class SvtSecurityOptions_Impl;
+
+//_________________________________________________________________________________________________________________
+// declarations
+//_________________________________________________________________________________________________________________
+
+/*-************************************************************************************************************//**
+ @descr These values present modes to handle StarOffice basic scripts.
+ see GetBasicMode/SetBasicMode() for further informations
+*//*-*************************************************************************************************************/
+
+enum EBasicSecurityMode
+{
+ eNEVER_EXECUTE = 0,
+ eFROM_LIST = 1,
+ eALWAYS_EXECUTE = 2
+};
+
+/*-************************************************************************************************************//**
+ @short collect informations about security features
+ @descr -
+
+ @implements -
+ @base -
+
+ @ATTENTION This class is partially threadsafe.
+
+ @devstatus ready to use
+*//*-*************************************************************************************************************/
+
+class UNOTOOLS_DLLPUBLIC SvtSecurityOptions: public utl::detail::Options
+{
+ //-------------------------------------------------------------------------------------------------------------
+ // public types
+ //-------------------------------------------------------------------------------------------------------------
+ public:
+
+ enum EOption
+ {
+ E_SECUREURLS,
+ E_BASICMODE, // xmlsec05 depricated
+ E_EXECUTEPLUGINS, // xmlsec05 depricated
+ E_WARNING, // xmlsec05 depricated
+ E_CONFIRMATION, // xmlsec05 depricated
+ E_DOCWARN_SAVEORSEND,
+ E_DOCWARN_SIGNING,
+ E_DOCWARN_PRINT,
+ E_DOCWARN_CREATEPDF,
+ E_DOCWARN_REMOVEPERSONALINFO,
+ E_DOCWARN_RECOMMENDPASSWORD,
+ E_MACRO_SECLEVEL,
+ E_MACRO_TRUSTEDAUTHORS,
+ E_MACRO_DISABLE,
+ E_CTRLCLICK_HYPERLINK
+ };
+
+ enum MacroAction
+ {
+ MA_DONTRUN = 0,
+ MA_CONFIRM,
+ MA_RUN
+ };
+
+ typedef ::com::sun::star::uno::Sequence< ::rtl::OUString > Certificate;
+
+ /*
+ // MT: Doesn't work for sequence...
+ struct Certificate
+ {
+ ::rtl::OUString SubjectName;
+ ::rtl::OUString SerialNumber;
+ ::rtl::OUString RawData;
+ };
+ */
+
+ //-------------------------------------------------------------------------------------------------------------
+ // public methods
+ //-------------------------------------------------------------------------------------------------------------
+
+ public:
+
+ //---------------------------------------------------------------------------------------------------------
+ // constructor / destructor
+ //---------------------------------------------------------------------------------------------------------
+
+ /*-****************************************************************************************************//**
+ @short standard constructor and destructor
+ @descr This will initialize an instance with default values.
+ We implement these class with a refcount mechanism! Every instance of this class increase it
+ at create and decrease it at delete time - but all instances use the same data container!
+ He is implemented as a static member ...
+
+ @seealso member m_nRefCount
+ @seealso member m_pDataContainer
+
+ @param -
+ @return -
+
+ @onerror -
+ *//*-*****************************************************************************************************/
+
+ SvtSecurityOptions();
+ virtual ~SvtSecurityOptions();
+
+ //---------------------------------------------------------------------------------------------------------
+ // interface
+ //---------------------------------------------------------------------------------------------------------
+
+ /*-****************************************************************************************************//**
+ @short returns readonly state
+ @descr It can be called to get information about the readonly state of a provided item.
+ @seealso -
+
+ @param "eOption", specify, which item is queried
+ @return <TRUE/> if item is readonly; <FALSE/> otherwhise
+
+ @onerror No error should occurre!
+ *//*-*****************************************************************************************************/
+
+ sal_Bool IsReadOnly( EOption eOption ) const ;
+
+ /*-****************************************************************************************************//**
+ @short interface methods to get and set value of config key "org.openoffice.Office.Common/Security/Scripting/SecureURL"
+ @descr These value displays the list of all trustworthy URLs.
+ zB.: file:/ => All scripts from the local file system including a LAN;
+ private:explorer => Scripts from the Explorer;
+ private:help => Scripts in the help system;
+ private:newmenu => Scripts that are executed by the commands File-New and AutoPilot;
+ private:schedule => Scripts of the scheduler;
+ private:searchfolder => Scripts of the searchfolder;
+ private:user => Scripts that are entered in the URL field.
+ @seealso -
+
+ @param "seqURLList", new values to set it in configuration.
+ @return The values which represent current state of internal variable.
+
+ @onerror No error should occurre!
+ *//*-*****************************************************************************************************/
+
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > GetSecureURLs( ) const ;
+ void SetSecureURLs( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& seqURLList ) ;
+
+ /*-****************************************************************************************************//**
+ @short interface methods to get and set value of config key "org.openoffice.Office.Common/Security/Scripting/StarOfficeBasic"
+ @descr These value determines how StarOffice Basic scripts should be handled.
+ It exist 3 different modes:
+ 0 = never execute
+ 1 = from list
+ 2 = always execute
+
+ @ATTENTION These methods don't check for valid or invalid values!
+ Our configuration server can do it ... but these implementation don't get any notifications
+ about wrong commits ...!
+ => If you set an invalid value - nothing will be changed. The information will lost.
+
+ @seealso enum EBasicSecurityMode
+
+ @param "eMode" to set new mode ... Value must defined as an enum of type EBasicSecurityMode!
+ @return An enum value, which present current mode.
+
+ @onerror No error should occurre!
+ *//*-*****************************************************************************************************/
+
+ sal_Int32 GetMacroSecurityLevel ( ) const ;
+ void SetMacroSecurityLevel ( sal_Int32 _nLevel ) ;
+
+ sal_Bool IsMacroDisabled ( ) const ;
+
+ /*-****************************************************************************************************//**
+ @short special method to check an URL and his referer corresponding to ouer internal security cessation
+ @descr Give us an URL and his referer and we will say you if these url can be scripted or not!
+
+ @seealso -
+
+ @param "sURL" reference to URL for checking
+ @param "sReferer" reference to referer which whish to run script by given URL
+ @return sal_True if URL is secure or security is obsolete(!) or sal_False otherwise.
+
+ @onerror No error should occurre!
+ *//*-*****************************************************************************************************/
+
+ sal_Bool IsSecureURL( const ::rtl::OUString& sURL ,
+ const ::rtl::OUString& sReferer ) const ;
+
+ ::com::sun::star::uno::Sequence< Certificate > GetTrustedAuthors ( ) const ;
+ void SetTrustedAuthors ( const ::com::sun::star::uno::Sequence< Certificate >& rAuthors ) ;
+ sal_Bool IsTrustedAuthorsEnabled ( ) ;
+
+ // for bool options only!
+ bool IsOptionSet ( EOption eOption ) const ;
+ bool SetOption ( EOption eOption, bool bValue ) ;
+ bool IsOptionEnabled ( EOption eOption ) const ;
+
+ // xmlsec05 depricated methods
+ sal_Bool IsExecutePlugins() const;
+ void SetExecutePlugins( sal_Bool bSet );
+ EBasicSecurityMode GetBasicMode( ) const ;
+ void SetBasicMode( EBasicSecurityMode eMode ) ;
+ sal_Bool IsWarningEnabled() const;
+ void SetWarningEnabled( sal_Bool bSet );
+ sal_Bool IsConfirmationEnabled() const;
+ void SetConfirmationEnabled( sal_Bool bSet );
+
+ //-------------------------------------------------------------------------------------------------------------
+ // private methods
+ //-------------------------------------------------------------------------------------------------------------
+
+ private:
+
+ /*-****************************************************************************************************//**
+ @short return a reference to a static mutex
+ @descr These class is partially threadsafe (for de-/initialization only).
+ All access methods are'nt safe!
+ We create a static mutex only for one ime and use at different times.
+
+ @seealso -
+
+ @param -
+ @return A reference to a static mutex member.
+
+ @onerror -
+ *//*-*****************************************************************************************************/
+
+ UNOTOOLS_DLLPRIVATE static ::osl::Mutex& GetInitMutex();
+
+ //-------------------------------------------------------------------------------------------------------------
+ // private member
+ //-------------------------------------------------------------------------------------------------------------
+
+ private:
+
+ /*Attention
+
+ Don't initialize these static member in these header!
+ a) Double dfined symbols will be detected ...
+ b) and unresolved externals exist at linking time.
+ Do it in your source only.
+ */
+
+ static SvtSecurityOptions_Impl* m_pDataContainer ; /// impl. data container as dynamic pointer for smaller memory requirements!
+ static sal_Int32 m_nRefCount ; /// internal ref count mechanism
+
+}; // class SvtSecurityOptions
+
+#endif // #ifndef INCLUDED_unotools_SECURITYOPTIONS_HXX
diff --git a/unotools/inc/unotools/sharedunocomponent.hxx b/unotools/inc/unotools/sharedunocomponent.hxx
new file mode 100644
index 000000000000..70c01b0cc0af
--- /dev/null
+++ b/unotools/inc/unotools/sharedunocomponent.hxx
@@ -0,0 +1,370 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef UNOTOOLS_INC_SHAREDUNOCOMPONENT_HXX
+#define UNOTOOLS_INC_SHAREDUNOCOMPONENT_HXX
+
+#include "unotoolsdllapi.h"
+
+#include <boost/shared_ptr.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <rtl/ref.hxx>
+
+namespace com { namespace sun { namespace star {
+ namespace lang {
+ class XComponent;
+ }
+} } }
+//............................................................................
+namespace utl
+{
+//............................................................................
+
+ //========================================================================
+ //= DisposableComponent
+ //========================================================================
+ /** is a class which controls lifetime of an UNO component via ->XComponent::dispose
+
+ You'll usually never use this class directly, but only as parameter for a
+ ->SharedUNOComponent class.
+ */
+ class UNOTOOLS_DLLPUBLIC DisposableComponent
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >
+ m_xComponent;
+
+ public:
+ /** constructs a ->DisposableComponent instance
+
+ @param _rxComponent
+ the component whose life time should be controlled by the instance. Must not be <NULL/>.
+ */
+ DisposableComponent( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxComponent );
+
+ /** disposes the component represented by the instance
+
+ The component is queried for ->XComponent(which <em>must</em> be supported),
+ and ->XComponent::dispose is invoked. A failure of this invocation (e.g. a thrown
+ exception) is silenced in release builds, and reported in debug builds.
+ */
+ ~DisposableComponent();
+
+ private:
+ DisposableComponent(); // never implemented
+ DisposableComponent( const DisposableComponent& ); // never implemented
+ DisposableComponent& operator=( const DisposableComponent& ); // never implemented
+ };
+
+ //========================================================================
+ //= CloseableComponent
+ //========================================================================
+ class CloseableComponentImpl;
+ /** is a class which controls lifetime of an UNO component via ->XCloseable::close
+
+ You'll usually never use this class directly, but only as parameter for a
+ ->SharedUNOComponent class.
+ */
+ class UNOTOOLS_DLLPUBLIC CloseableComponent
+ {
+ private:
+ /** Our IMPL class.
+ */
+ ::rtl::Reference< CloseableComponentImpl > m_pImpl;
+
+ public:
+ /** constructs a ->CloseableComponent instance
+
+ @param _rxComponent
+ the component whose life time should be controlled by the instance. Must not be <NULL/>.
+ */
+ CloseableComponent( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxComponent );
+
+ /** destroys resources associated with this instance, and disposes the component
+
+ The component is queried for ->XCloseable (which <em>must</em> be supported),
+ and ->XCloseable::close is invoked, with delivering the ownership.
+ If the invocation fails with a ->CloseVetoException, this is ignored, since in
+ this case the vetoing instance took the ownership.
+
+ Any other failure will be reported in a debug version via assertion mechanisms,
+ and silenced in release builds.
+ */
+ ~CloseableComponent();
+
+ private:
+ CloseableComponent(); // never implemented
+ CloseableComponent( const CloseableComponent& ); // never implemented
+ CloseableComponent& operator=( const CloseableComponent& ); // never implemented
+ };
+
+ //========================================================================
+ //= SharedUNOComponent
+ //========================================================================
+ /** is a helper class for sharing ownership of a UNO component
+
+ If you need to share an UNO component, which normally needs a dedicated owner,
+ and is lifetime controlled by an explicit disposal action (not necessarily ->XComponent::dispose,
+ but <em>any</em> explicit method call, after which the object is considered
+ to be disposed), between different classes, ->SharedUNOComponent is what you need.
+
+ Instead of passing around a <code>Reference&lt; XFoo &gt;</code>, and bothering
+ with ownership and disposal, you just use a <code>SharedUNOComponent&lt; XFoo &gt;</code>.
+ This instance can be passed around, including copying, and in nearly all respects behaves
+ like the original <code>Reference&lt; XFoo &gt;</code>. However, when the last
+ ->SharedUNOComponent referencing a certain <code>Reference&lt; XFoo &gt;</code> dies, it
+ will automatically get rid of the object held by this reference.
+
+ @param INTERFACE
+ the UNO interface type as which the component should be held
+
+ @param COMPONENT_HOLDER
+ a class which can be used to represent and dispose a UNO component.
+ The class must support (maybe explicit only) construction from a
+ <code>Reference&lt; INTERFACE &gt;</code>, and destruction. Upon destruction,
+ the class must dispose (by any suitable means) the component instance it was
+ constructed with.
+ */
+ template < class INTERFACE, class COMPONENT = DisposableComponent >
+ class SharedUNOComponent
+ {
+ private:
+ typedef COMPONENT Component;
+ typedef ::boost::shared_ptr< Component > ComponentPointer;
+
+ private:
+ ComponentPointer m_pComponent;
+ ::com::sun::star::uno::Reference< INTERFACE > m_xTypedComponent;
+
+ public:
+ enum AssignmentMode
+ {
+ TakeOwnership,
+ NoTakeOwnership
+ };
+
+ public:
+ inline SharedUNOComponent()
+ {
+ }
+
+ explicit inline SharedUNOComponent( const ::com::sun::star::uno::Reference< INTERFACE >& _rxComponent, AssignmentMode eMode = TakeOwnership )
+ {
+ reset( _rxComponent, eMode );
+ }
+
+#ifndef EXCEPTIONS_OFF
+ inline SharedUNOComponent( const ::com::sun::star::uno::XInterface* _pInterface, ::com::sun::star::uno::UnoReference_QueryThrow _queryThrow )
+ {
+ set( _pInterface, _queryThrow );
+ }
+
+ inline SharedUNOComponent( const ::com::sun::star::uno::BaseReference & _rRef, ::com::sun::star::uno::UnoReference_QueryThrow _queryThrow )
+ {
+ set( _rRef, _queryThrow );
+ }
+
+ inline SharedUNOComponent( const ::com::sun::star::uno::Any& _rAny, ::com::sun::star::uno::UnoReference_QueryThrow _queryThrow )
+ {
+ set( _rAny, _queryThrow );
+ }
+
+ inline SharedUNOComponent( const SharedUNOComponent& _rxComponent, ::com::sun::star::uno::UnoReference_SetThrow _setThrow )
+ {
+ set( _rxComponent, _setThrow );
+ }
+#endif
+
+// SharedUNOComponent& operator=( const ::com::sun::star::uno::Reference< INTERFACE >& _rxComponent );
+ // this operator is not implemented by intention. There is no canonic ownership after this operatoer
+ // would hvae been applied: Should the SharedUNOComponent have the ownership of the component,
+ // or shouldn't it? Hard to guess, and probably wrong in 50 percent of all cases, anyway. So,
+ // instead of tempting clients of this class to use such a dangerous operator, we do
+ // not offer it at all. If you need to assign a Reference< INTERFACE > to your SharedUNOComponent,
+ // use the ->reset method.
+
+ /** assigns a new component, and releases the old one
+ */
+ void reset( const ::com::sun::star::uno::Reference< INTERFACE >& _rxComponent, AssignmentMode _eMode = TakeOwnership );
+
+ inline bool set( ::com::sun::star::uno::XInterface* _pInterface, ::com::sun::star::uno::UnoReference_Query _query );
+ inline bool set( const ::com::sun::star::uno::BaseReference& _rRef, ::com::sun::star::uno::UnoReference_Query _query );
+ inline bool set( const ::com::sun::star::uno::Any& _rAny, ::com::sun::star::uno::UnoReference_Query _query );
+
+#ifndef EXCEPTIONS_OFF
+ inline void set( const ::com::sun::star::uno::XInterface* _pInterface, ::com::sun::star::uno::UnoReference_QueryThrow _queryThrow );
+ inline void set( const ::com::sun::star::uno::BaseReference & _rRef, ::com::sun::star::uno::UnoReference_QueryThrow _queryThrow );
+ inline void set( const ::com::sun::star::uno::Any& _rAny, ::com::sun::star::uno::UnoReference_QueryThrow _queryThrow );
+
+ inline void set( const INTERFACE* _pInterface, ::com::sun::star::uno::UnoReference_SetThrow _setThrow );
+ inline void set( const ::com::sun::star::uno::Reference< INTERFACE >& _rRef, ::com::sun::star::uno::UnoReference_SetThrow _setThrow );
+ inline void set( const SharedUNOComponent& _rComp, ::com::sun::star::uno::UnoReference_SetThrow _setThrow );
+#endif
+
+ INTERFACE* SAL_CALL operator->() const;
+
+ inline operator const ::com::sun::star::uno::Reference< INTERFACE >&() const
+ {
+ return m_xTypedComponent;
+ }
+
+ inline const ::com::sun::star::uno::Reference< INTERFACE >& getTyped() const
+ {
+ return m_xTypedComponent;
+ }
+
+ inline bool is() const
+ {
+ return m_xTypedComponent.is();
+ }
+
+ inline void clear()
+ {
+ m_pComponent.reset();
+ m_xTypedComponent.clear();
+ }
+ };
+
+ //-------------------------------------------------------------------------
+ template < class INTERFACE, class COMPONENT >
+ INTERFACE* SAL_CALL SharedUNOComponent< INTERFACE, COMPONENT >::operator->() const
+ {
+ return m_xTypedComponent.operator->();
+ }
+
+ //-------------------------------------------------------------------------
+ // assignments
+ template < class INTERFACE, class COMPONENT >
+ void SharedUNOComponent< INTERFACE, COMPONENT >::reset( const ::com::sun::star::uno::Reference< INTERFACE >& _rxComponent, AssignmentMode _eMode )
+ {
+ m_pComponent.reset( _eMode == TakeOwnership ? new COMPONENT( _rxComponent ) : NULL );
+ m_xTypedComponent = _rxComponent;
+ }
+
+ //-------------------------------------------------------------------------
+ // comparison operators
+ template < class INTERFACE, class COMPONENT >
+ bool operator==( const ::com::sun::star::uno::Reference< INTERFACE >& _rLHS, const SharedUNOComponent< INTERFACE, COMPONENT >& _rRHS )
+ {
+ return _rLHS == _rRHS.getTyped();
+ }
+
+ template < class INTERFACE, class COMPONENT >
+ bool operator==( const SharedUNOComponent< INTERFACE, COMPONENT >& _rLHS, const ::com::sun::star::uno::Reference< INTERFACE >& _rRHS )
+ {
+ return _rLHS.getTyped() == _rRHS;
+ }
+
+ //-------------------------------------------------------------------------
+ // conversion to Any
+ template < class INTERFACE, class COMPONENT >
+ inline void SAL_CALL operator <<= ( ::com::sun::star::uno::Any & rAny, const SharedUNOComponent< INTERFACE, COMPONENT >& value ) SAL_THROW( () )
+ {
+ rAny <<= value.getTyped();
+ }
+
+ //-------------------------------------------------------------------------
+ template < class INTERFACE, class COMPONENT >
+ inline ::com::sun::star::uno::Any SAL_CALL makeAny( const SharedUNOComponent< INTERFACE, COMPONENT >& value ) SAL_THROW( () )
+ {
+ return makeAny( value.getTyped() );
+ }
+
+#ifndef EXCEPTIONS_OFF
+ //-------------------------------------------------------------------------
+ template < class INTERFACE, class COMPONENT >
+ void SharedUNOComponent< INTERFACE, COMPONENT >::set( const ::com::sun::star::uno::XInterface* _pInterface, ::com::sun::star::uno::UnoReference_QueryThrow _queryThrow )
+ {
+ reset( ::com::sun::star::uno::Reference< INTERFACE >( _pInterface, _queryThrow ), TakeOwnership );
+ }
+
+ //-------------------------------------------------------------------------
+ template < class INTERFACE, class COMPONENT >
+ void SharedUNOComponent< INTERFACE, COMPONENT >::set( const ::com::sun::star::uno::BaseReference & _rRef, ::com::sun::star::uno::UnoReference_QueryThrow _queryThrow )
+ {
+ reset( ::com::sun::star::uno::Reference< INTERFACE >( _rRef, _queryThrow ), TakeOwnership );
+ }
+
+ //-------------------------------------------------------------------------
+ template < class INTERFACE, class COMPONENT >
+ void SharedUNOComponent< INTERFACE, COMPONENT >::set( const ::com::sun::star::uno::Any& _rAny, ::com::sun::star::uno::UnoReference_QueryThrow _queryThrow )
+ {
+ reset( ::com::sun::star::uno::Reference< INTERFACE >( _rAny, _queryThrow ), TakeOwnership );
+ }
+
+ //-------------------------------------------------------------------------
+ template < class INTERFACE, class COMPONENT >
+ void SharedUNOComponent< INTERFACE, COMPONENT >::set( const INTERFACE* _pInterface, ::com::sun::star::uno::UnoReference_SetThrow _setThrow )
+ {
+ reset( ::com::sun::star::uno::Reference< INTERFACE >( _pInterface, _setThrow ), TakeOwnership );
+ }
+
+ //-------------------------------------------------------------------------
+ template < class INTERFACE, class COMPONENT >
+ void SharedUNOComponent< INTERFACE, COMPONENT >::set( const ::com::sun::star::uno::Reference< INTERFACE >& _rRef, ::com::sun::star::uno::UnoReference_SetThrow _setThrow )
+ {
+ reset( ::com::sun::star::uno::Reference< INTERFACE >( _rRef, _setThrow ), TakeOwnership );
+ }
+
+ //-------------------------------------------------------------------------
+ template < class INTERFACE, class COMPONENT >
+ void SharedUNOComponent< INTERFACE, COMPONENT >::set( const SharedUNOComponent& _rComp, ::com::sun::star::uno::UnoReference_SetThrow _setThrow )
+ {
+ *this = _rComp;
+ // provoke an exception in case the component is NULL
+ m_xTypedComponent.set( m_xTypedComponent, _setThrow );
+ }
+#endif
+
+ //-------------------------------------------------------------------------
+ template < class INTERFACE, class COMPONENT >
+ bool SharedUNOComponent< INTERFACE, COMPONENT >::set( ::com::sun::star::uno::XInterface* _pInterface, ::com::sun::star::uno::UnoReference_Query _query )
+ {
+ reset( ::com::sun::star::uno::Reference< INTERFACE >( _pInterface, _query ) );
+ return is();
+ }
+
+ //-------------------------------------------------------------------------
+ template < class INTERFACE, class COMPONENT >
+ bool SharedUNOComponent< INTERFACE, COMPONENT >::set( const ::com::sun::star::uno::BaseReference& _rRef, ::com::sun::star::uno::UnoReference_Query _query )
+ {
+ reset( ::com::sun::star::uno::Reference< INTERFACE >( _rRef, _query ) );
+ return is();
+ }
+
+ //-------------------------------------------------------------------------
+ template < class INTERFACE, class COMPONENT >
+ bool SharedUNOComponent< INTERFACE, COMPONENT >::set( const ::com::sun::star::uno::Any& _rAny, ::com::sun::star::uno::UnoReference_Query _query )
+ {
+ reset( ::com::sun::star::uno::Reference< INTERFACE >( _rAny, _query ) );
+ return is();
+ }
+
+//............................................................................
+} // namespace utl
+//............................................................................
+
+#endif // UNOTOOLS_INC_SHAREDUNOCOMPONENT_HXX
diff --git a/unotools/inc/unotools/sourceviewconfig.hxx b/unotools/inc/unotools/sourceviewconfig.hxx
new file mode 100644
index 000000000000..5f66d6d05c76
--- /dev/null
+++ b/unotools/inc/unotools/sourceviewconfig.hxx
@@ -0,0 +1,63 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _unotools_SOURCEVIEWCONFIG_HXX
+#define _unotools_SOURCEVIEWCONFIG_HXX
+
+// include ---------------------------------------------------------------
+
+#include "unotools/unotoolsdllapi.h"
+#include <osl/mutex.hxx>
+#include <rtl/ustring.hxx>
+#include <unotools/options.hxx>
+
+/* -----------------------------12.10.00 11:40--------------------------------
+
+ ---------------------------------------------------------------------------*/
+namespace utl
+{
+ class SourceViewConfig_Impl;
+ class UNOTOOLS_DLLPUBLIC SourceViewConfig: public utl::detail::Options
+ {
+ static SourceViewConfig_Impl* m_pImplConfig;
+ static sal_Int32 m_nRefCount;
+
+ public:
+ SourceViewConfig();
+ virtual ~SourceViewConfig();
+
+ const rtl::OUString& GetFontName() const;
+ void SetFontName(const rtl::OUString& rName);
+
+ sal_Int16 GetFontHeight() const;
+ void SetFontHeight(sal_Int16 nHeight);
+
+ sal_Bool IsShowProportionalFontsOnly() const;
+ void SetShowProportionalFontsOnly(sal_Bool bSet);
+ };
+}
+#endif
+
diff --git a/unotools/inc/unotools/startoptions.hxx b/unotools/inc/unotools/startoptions.hxx
new file mode 100644
index 000000000000..4fbb2c091864
--- /dev/null
+++ b/unotools/inc/unotools/startoptions.hxx
@@ -0,0 +1,170 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef INCLUDED_unotools_STARTOPTIONS_HXX
+#define INCLUDED_unotools_STARTOPTIONS_HXX
+
+//_________________________________________________________________________________________________________________
+// includes
+//_________________________________________________________________________________________________________________
+
+#include "unotools/unotoolsdllapi.h"
+#include <sal/types.h>
+#include <osl/mutex.hxx>
+#include <rtl/ustring.hxx>
+#include <unotools/options.hxx>
+
+//_________________________________________________________________________________________________________________
+// forward declarations
+//_________________________________________________________________________________________________________________
+
+/*-************************************************************************************************************//**
+ @short forward declaration to our private date container implementation
+ @descr We use these class as internal member to support small memory requirements.
+ You can create the container if it is neccessary. The class which use these mechanism
+ is faster and smaller then a complete implementation!
+*//*-*************************************************************************************************************/
+
+class SvtStartOptions_Impl;
+
+//_________________________________________________________________________________________________________________
+// declarations
+//_________________________________________________________________________________________________________________
+
+/*-************************************************************************************************************//**
+ @short collect informations about startup features
+ @descr -
+
+ @implements -
+ @base -
+
+ @devstatus ready to use
+*//*-*************************************************************************************************************/
+
+class UNOTOOLS_DLLPUBLIC SvtStartOptions: public utl::detail::Options
+{
+ //-------------------------------------------------------------------------------------------------------------
+ // public methods
+ //-------------------------------------------------------------------------------------------------------------
+
+ public:
+
+ //---------------------------------------------------------------------------------------------------------
+ // constructor / destructor
+ //---------------------------------------------------------------------------------------------------------
+
+ /*-****************************************************************************************************//**
+ @short standard constructor and destructor
+ @descr This will initialize an instance with default values.
+ We implement these class with a refcount mechanism! Every instance of this class increase it
+ at create and decrease it at delete time - but all instances use the same data container!
+ He is implemented as a static member ...
+
+ @seealso member m_nRefCount
+ @seealso member m_pDataContainer
+
+ @param -
+ @return -
+
+ @onerror -
+ *//*-*****************************************************************************************************/
+
+ SvtStartOptions();
+ virtual ~SvtStartOptions();
+
+ //---------------------------------------------------------------------------------------------------------
+ // interface
+ //---------------------------------------------------------------------------------------------------------
+
+ /*-****************************************************************************************************//**
+ @short interface methods to get and set value of config key "org.openoffice.Office.Common/Start/..."
+ @descr These options describe internal states to enable/disable features of installed office.
+ The values are fixed at runtime - and implemented as readonly!
+
+ IsIntroEnabled() : Setting, if the StarOffice Logo is displayed when starting StarOffice.
+ Default = true
+
+ EnableIntro() : Use it to enable/disable the logo at startup.
+
+ @seealso configuration package "org.openoffice.Office.Common/Start"
+ *//*-*****************************************************************************************************/
+
+ sal_Bool IsIntroEnabled ( ) const ;
+ void EnableIntro ( sal_Bool bState ) ;
+
+ /*-****************************************************************************************************//**
+ @short returns or set the connection URL of an office
+ @descr Specifies the URL for an UNO connection.
+ No default is given, the URL has to be entered manually by the admin/user.
+ zB.: "socket,host=pc1.test.de,port=6001;iiop;"
+
+ @seealso configuration package "org.openoffice.Office.Common/Start"
+ *//*-*****************************************************************************************************/
+
+ ::rtl::OUString GetConnectionURL( ) const ;
+ void SetConnectionURL( const ::rtl::OUString& sURL ) ;
+
+ //-------------------------------------------------------------------------------------------------------------
+ // private methods
+ //-------------------------------------------------------------------------------------------------------------
+
+ private:
+
+ /*-****************************************************************************************************//**
+ @short return a reference to a static mutex
+ @descr These class use his own static mutex to be threadsafe.
+ We create a static mutex only for one ime and use at different times.
+
+ @seealso -
+
+ @param -
+ @return A reference to a static mutex member.
+
+ @onerror -
+ *//*-*****************************************************************************************************/
+
+ UNOTOOLS_DLLPRIVATE static ::osl::Mutex& GetOwnStaticMutex();
+
+ //-------------------------------------------------------------------------------------------------------------
+ // private member
+ //-------------------------------------------------------------------------------------------------------------
+
+ private:
+
+ /*Attention
+
+ Don't initialize these static member in these header!
+ a) Double dfined symbols will be detected ...
+ b) and unresolved externals exist at linking time.
+ Do it in your source only.
+ */
+
+ static SvtStartOptions_Impl* m_pDataContainer ; /// impl. data container as dynamic pointer for smaller memory requirements!
+ static sal_Int32 m_nRefCount ; /// internal ref count mechanism
+
+}; // class SvtStartOptions
+
+#endif // #ifndef INCLUDED_unotools_STARTOPTIONS_HXX
diff --git a/unotools/inc/unotools/streamhelper.hxx b/unotools/inc/unotools/streamhelper.hxx
new file mode 100644
index 000000000000..d6250e7b0306
--- /dev/null
+++ b/unotools/inc/unotools/streamhelper.hxx
@@ -0,0 +1,116 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "unotools/unotoolsdllapi.h"
+
+#ifndef _UNOTOOLS_STREAMHELPER_HXX_
+#define _UNOTOOLS_STREAMHELPER_HXX_
+#include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/io/XSeekable.hpp>
+#include <osl/mutex.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/implbase2.hxx>
+#include <tools/stream.hxx>
+
+namespace utl
+{
+ namespace stario = ::com::sun::star::io;
+ namespace staruno = ::com::sun::star::uno;
+
+/**
+ * The helper implementation for a using input streams based on SvLockBytes.
+ *
+ * @author Dirk Grobler
+ * @since 00/28/03
+ */
+ typedef ::cppu::WeakImplHelper2<stario::XInputStream, stario::XSeekable> InputStreamHelper_Base;
+ // needed for some compilers
+class UNOTOOLS_DLLPUBLIC OInputStreamHelper : public InputStreamHelper_Base
+{
+ ::osl::Mutex m_aMutex;
+ SvLockBytesRef m_xLockBytes;
+ sal_uInt32 m_nActPos;
+ sal_Int32 m_nAvailable; // this is typically the chunk(buffer) size
+
+public:
+ OInputStreamHelper(const SvLockBytesRef& _xLockBytes,
+ sal_uInt32 _nAvailable,
+ sal_uInt32 _nPos = 0)
+ :m_xLockBytes(_xLockBytes)
+ ,m_nActPos(_nPos)
+ ,m_nAvailable(_nAvailable){}
+
+// staruno::XInterface
+ virtual void SAL_CALL acquire() throw ();
+ virtual void SAL_CALL release() throw ();
+
+// stario::XInputStream
+ virtual sal_Int32 SAL_CALL readBytes( staruno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead ) throw(stario::NotConnectedException, stario::BufferSizeExceededException, stario::IOException, staruno::RuntimeException);
+ virtual sal_Int32 SAL_CALL readSomeBytes( staruno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead ) throw(stario::NotConnectedException, stario::BufferSizeExceededException, stario::IOException, staruno::RuntimeException);
+ virtual void SAL_CALL skipBytes( sal_Int32 nBytesToSkip ) throw(stario::NotConnectedException, stario::BufferSizeExceededException, stario::IOException, staruno::RuntimeException);
+ virtual sal_Int32 SAL_CALL available( ) throw(stario::NotConnectedException, stario::IOException, staruno::RuntimeException);
+ virtual void SAL_CALL closeInput( ) throw (stario::NotConnectedException, stario::IOException, staruno::RuntimeException);
+
+ virtual void SAL_CALL seek( sal_Int64 location ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int64 SAL_CALL getPosition( ) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int64 SAL_CALL getLength( ) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+};
+
+/**
+ * The helper implementation for a using output streams based on SvLockBytes.
+ *
+ * @author Dirk Grobler
+ * @since 00/28/03
+ */
+typedef ::cppu::WeakImplHelper1<stario::XOutputStream> OutputStreamHelper_Base;
+ // needed for some compilers
+class UNOTOOLS_DLLPUBLIC OOutputStreamHelper : public OutputStreamHelper_Base
+{
+ ::osl::Mutex m_aMutex;
+ SvLockBytesRef m_xLockBytes;
+ sal_uInt32 m_nActPos;
+
+public:
+ OOutputStreamHelper(const SvLockBytesRef& _xLockBytes, sal_uInt32 _nPos = 0)
+ :m_xLockBytes(_xLockBytes)
+ ,m_nActPos(_nPos){}
+
+// staruno::XInterface
+ virtual void SAL_CALL acquire() throw ();
+ virtual void SAL_CALL release() throw ();
+
+// stario::XOutputStream
+ virtual void SAL_CALL writeBytes( const staruno::Sequence< sal_Int8 >& aData ) throw(stario::NotConnectedException, stario::BufferSizeExceededException, stario::IOException, staruno::RuntimeException);
+ virtual void SAL_CALL flush( ) throw(stario::NotConnectedException, stario::BufferSizeExceededException, stario::IOException, staruno::RuntimeException);
+ virtual void SAL_CALL closeOutput( ) throw(stario::NotConnectedException, stario::BufferSizeExceededException, stario::IOException, staruno::RuntimeException);
+};
+
+} // namespace utl
+
+
+#endif // _UNOTOOLS_STREAM_WRAPPER_HXX_
+
diff --git a/unotools/inc/unotools/streamsection.hxx b/unotools/inc/unotools/streamsection.hxx
new file mode 100644
index 000000000000..4c51ed648eb1
--- /dev/null
+++ b/unotools/inc/unotools/streamsection.hxx
@@ -0,0 +1,85 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _UNOTOOLS_STREAMSECTION_HXX_
+#define _UNOTOOLS_STREAMSECTION_HXX_
+
+#include <com/sun/star/io/XMarkableStream.hpp>
+#include <com/sun/star/io/XDataInputStream.hpp>
+#include <com/sun/star/io/XDataOutputStream.hpp>
+
+namespace utl
+{
+
+ namespace stario = ::com::sun::star::io;
+ namespace staruno = ::com::sun::star::uno;
+
+/** implements handling for compatibly reading/writing data from/into an input/output stream.
+ data written in a block secured by this class should be readable by older versions which
+ use the same mechanism.
+
+ @author Frank Schoenheit
+ @since 00/26/05
+*/
+
+class OStreamSection
+{
+ staruno::Reference< stario::XMarkableStream > m_xMarkStream;
+ staruno::Reference< stario::XDataInputStream > m_xInStream;
+ staruno::Reference< stario::XDataOutputStream > m_xOutStream;
+
+ sal_Int32 m_nBlockStart;
+ sal_Int32 m_nBlockLen;
+
+public:
+ /** starts reading of a "skippable" section of data within the given input stream<BR>
+ @param _rxInput the stream to read from. Must support the
+ <type scope="com::sun::star::io">XMarkableStream</type> interface
+ */
+ OStreamSection(const staruno::Reference< stario::XDataInputStream >& _rxInput);
+
+ /** starts writing of a "skippable" section of data into the given output stream
+ @param _rxOutput the stream the stream to write to. Must support the
+ <type scope="com::sun::star::io">XMarkableStream</type> interface
+ @param _nPresumedLength estimation for the length of the upcoming section. If greater 0, this
+ value will be written as section length and corrected (in the dtor) only if
+ needed. If you know how much bytes you are about to write, you may
+ want to use this param, saving some stream operations this way.
+ */
+ OStreamSection(const staruno::Reference< stario::XDataOutputStream >& _rxOutput, sal_Int32 _nPresumedLength = 0);
+
+ /** dtor. <BR>If constructed for writing, the section "opened" by this object will be "closed".<BR>
+ If constructed for reading, any remaining bytes 'til the end of the section will be skipped.
+ */
+ ~OStreamSection();
+};
+
+} // namespace utl
+
+#endif // _UNOTOOLS_STREAMSECTION_HXX_
+
+
diff --git a/unotools/inc/unotools/streamwrap.hxx b/unotools/inc/unotools/streamwrap.hxx
new file mode 100644
index 000000000000..d8544cc25f3e
--- /dev/null
+++ b/unotools/inc/unotools/streamwrap.hxx
@@ -0,0 +1,183 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "unotools/unotoolsdllapi.h"
+
+#ifndef _UTL_STREAM_WRAPPER_HXX_
+#define _UTL_STREAM_WRAPPER_HXX_
+#include <osl/mutex.hxx>
+#include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/io/XSeekable.hpp>
+#include <com/sun/star/io/XTruncate.hpp>
+#include <com/sun/star/io/XStream.hpp>
+#include <cppuhelper/implbase3.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <comphelper/uno3.hxx>
+
+class SvStream;
+
+namespace utl
+{
+ namespace stario = ::com::sun::star::io;
+ namespace staruno = ::com::sun::star::uno;
+
+//==================================================================
+//= OInputStreamWrapper
+//==================================================================
+typedef ::cppu::WeakImplHelper1 < stario::XInputStream
+ > InputStreamWrapper_Base;
+ // needed for some compilers
+/// helper class for wrapping an SvStream into an <type scope="com.sun.star.io">XInputStream</type>
+class UNOTOOLS_DLLPUBLIC OInputStreamWrapper : public InputStreamWrapper_Base
+{
+protected:
+ ::osl::Mutex m_aMutex;
+ SvStream* m_pSvStream;
+ sal_Bool m_bSvStreamOwner : 1;
+ OInputStreamWrapper()
+ { m_pSvStream = 0; m_bSvStreamOwner = sal_False; }
+ void SetStream(SvStream* _pStream, sal_Bool bOwner )
+ { m_pSvStream = _pStream; m_bSvStreamOwner = bOwner; }
+
+public:
+ OInputStreamWrapper(SvStream& _rStream);
+ OInputStreamWrapper(SvStream* pStream, sal_Bool bOwner=sal_False);
+ virtual ~OInputStreamWrapper();
+
+// UNO Anbindung
+ DECLARE_UNO3_AGG_DEFAULTS(OInputStreamWrapper, InputStreamWrapper_Base);
+
+// stario::XInputStream
+ virtual sal_Int32 SAL_CALL readBytes(staruno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead) throw(stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException);
+ virtual sal_Int32 SAL_CALL readSomeBytes(staruno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead) throw(stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException);
+ virtual void SAL_CALL skipBytes(sal_Int32 nBytesToSkip) throw(stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException);
+ virtual sal_Int32 SAL_CALL available() throw(stario::NotConnectedException, staruno::RuntimeException);
+ virtual void SAL_CALL closeInput() throw(stario::NotConnectedException, staruno::RuntimeException);
+
+protected:
+ /// throws a NotConnectedException if the object is not connected anymore
+ void checkConnected() const;
+ /// throws an exception according to the error flag of m_pSvStream
+ void checkError() const;
+};
+
+//==================================================================
+//= OSeekableInputStreamWrapper
+//==================================================================
+typedef ::cppu::ImplHelper1 < ::com::sun::star::io::XSeekable
+ > OSeekableInputStreamWrapper_Base;
+/** helper class for wrapping an SvStream into an <type scope="com.sun.star.io">XInputStream</type>
+ which is seekable (i.e. supports the <type scope="com.sun.star.io">XSeekable</type> interface).
+*/
+class UNOTOOLS_DLLPUBLIC OSeekableInputStreamWrapper : public ::cppu::ImplInheritanceHelper1 < OInputStreamWrapper, com::sun::star::io::XSeekable >
+{
+protected:
+ OSeekableInputStreamWrapper() {}
+public:
+ OSeekableInputStreamWrapper(SvStream& _rStream);
+ OSeekableInputStreamWrapper(SvStream* _pStream, sal_Bool _bOwner = sal_False);
+
+ // XSeekable
+ virtual void SAL_CALL seek( sal_Int64 _nLocation ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int64 SAL_CALL getPosition( ) throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int64 SAL_CALL getLength( ) throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+};
+
+//==================================================================
+//= OOutputStreamWrapper
+//==================================================================
+typedef ::cppu::WeakImplHelper1<stario::XOutputStream> OutputStreamWrapper_Base;
+ // needed for some compilers
+class UNOTOOLS_DLLPUBLIC OOutputStreamWrapper : public OutputStreamWrapper_Base
+{
+protected:
+ // TODO: thread safety!
+ SvStream& rStream;
+
+public:
+ OOutputStreamWrapper(SvStream& _rStream) :rStream(_rStream) { }
+
+// UNO Anbindung
+ DECLARE_UNO3_AGG_DEFAULTS(OOutputStreamWrapper, OutputStreamWrapper_Base);
+
+// stario::XOutputStream
+ virtual void SAL_CALL writeBytes(const staruno::Sequence< sal_Int8 >& aData) throw(stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException);
+ virtual void SAL_CALL flush() throw(stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException);
+ virtual void SAL_CALL closeOutput() throw(stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException);
+
+protected:
+ /// throws an exception according to the error flag of m_pSvStream
+ void checkError() const;
+};
+
+//==================================================================
+//= OSeekableOutputStreamWrapper
+//==================================================================
+typedef ::cppu::ImplHelper1 < ::com::sun::star::io::XSeekable
+ > OSeekableOutputStreamWrapper_Base;
+/** helper class for wrapping an SvStream into an <type scope="com.sun.star.io">XOutputStream</type>
+ which is seekable (i.e. supports the <type scope="com.sun.star.io">XSeekable</type> interface).
+*/
+class UNOTOOLS_DLLPUBLIC OSeekableOutputStreamWrapper
+ :public OOutputStreamWrapper
+ ,public OSeekableOutputStreamWrapper_Base
+{
+public:
+ OSeekableOutputStreamWrapper(SvStream& _rStream);
+
+ // disambiguate XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& _rType ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire( ) throw ();
+ virtual void SAL_CALL release( ) throw ();
+
+ // XSeekable
+ virtual void SAL_CALL seek( sal_Int64 _nLocation ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int64 SAL_CALL getPosition( ) throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int64 SAL_CALL getLength( ) throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+};
+
+class UNOTOOLS_DLLPUBLIC OStreamWrapper : public ::cppu::ImplInheritanceHelper3 < OSeekableInputStreamWrapper, com::sun::star::io::XStream, com::sun::star::io::XOutputStream, com::sun::star::io::XTruncate >
+{
+public:
+ OStreamWrapper(SvStream& _rStream);
+
+// stario::XStream
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getInputStream( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > SAL_CALL getOutputStream( ) throw (::com::sun::star::uno::RuntimeException);
+
+// stario::XOutputStream
+ virtual void SAL_CALL writeBytes(const staruno::Sequence< sal_Int8 >& aData) throw(stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException);
+ virtual void SAL_CALL flush() throw(stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException);
+ virtual void SAL_CALL closeOutput() throw(stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException);
+ virtual void SAL_CALL truncate() throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+};
+
+}
+// namespace utl
+
+#endif // _UTL_STREAM_WRAPPER_HXX_
+
diff --git a/unotools/inc/unotools/syslocale.hxx b/unotools/inc/unotools/syslocale.hxx
new file mode 100644
index 000000000000..5d653297fde1
--- /dev/null
+++ b/unotools/inc/unotools/syslocale.hxx
@@ -0,0 +1,88 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_UNOTOOLS_SYSLOCALE_HXX
+#define INCLUDED_UNOTOOLS_SYSLOCALE_HXX
+
+#include "unotools/unotoolsdllapi.h"
+#include <unotools/localedatawrapper.hxx>
+#include <unotools/charclass.hxx>
+#include <sal/types.h>
+#include <i18npool/lang.h>
+#include <rtl/textenc.h>
+
+class SvtSysLocale_Impl;
+class SvtSysLocaleOptions;
+
+namespace osl { class Mutex; }
+class LocaleDataWrapper;
+
+/**
+ SvtSysLocale provides a refcounted single instance of an application wide
+ <type>LocaleDataWrapper</type> and <type>CharClass</type> which always
+ follow the locale as it is currently configured by the user. You may use
+ it anywhere to access the locale data elements like decimal separator and
+ simple date formatting and so on. Contructing and destructing a
+ SvtSysLocale is not expensive as long as there is at least one instance
+ left.
+ */
+class UNOTOOLS_DLLPUBLIC SvtSysLocale
+{
+ friend class SvtSysLocale_Impl; // access to mutex
+
+ static SvtSysLocale_Impl* pImpl;
+ static sal_Int32 nRefCount;
+
+ UNOTOOLS_DLLPRIVATE static ::osl::Mutex& GetMutex();
+
+public:
+ SvtSysLocale();
+ ~SvtSysLocale();
+
+ const LocaleDataWrapper& GetLocaleData() const;
+ const CharClass& GetCharClass() const;
+
+ /** It is safe to store the pointers locally and use them AS LONG AS THE
+ INSTANCE OF SvtSysLocale LIVES!
+ It is a faster access but be sure what you do!
+ */
+ const LocaleDataWrapper* GetLocaleDataPtr() const;
+ const CharClass* GetCharClassPtr() const;
+ SvtSysLocaleOptions& GetOptions() const;
+ com::sun::star::lang::Locale GetLocale() const;
+ LanguageType GetLanguage() const;
+ com::sun::star::lang::Locale GetUILocale() const;
+ LanguageType GetUILanguage() const;
+
+ /** Get the best MIME encoding matching the system locale, or if that isn't
+ determinable one that matches the UI locale, or UTF8 if everything else
+ fails.
+ */
+ static rtl_TextEncoding GetBestMimeEncoding();
+};
+
+#endif // INCLUDED_SVTOOLS_SYSLOCALE_HXX
diff --git a/unotools/inc/unotools/syslocaleoptions.hxx b/unotools/inc/unotools/syslocaleoptions.hxx
new file mode 100644
index 000000000000..63e271f1c435
--- /dev/null
+++ b/unotools/inc/unotools/syslocaleoptions.hxx
@@ -0,0 +1,168 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_SVTOOLS_SYSLOCALEOPTIONS_HXX
+#define INCLUDED_SVTOOLS_SYSLOCALEOPTIONS_HXX
+
+#include "unotools/unotoolsdllapi.h"
+#include <sal/types.h>
+#include <rtl/ustring.hxx>
+#include <tools/solar.h>
+#include <tools/link.hxx>
+#include <i18npool/lang.h>
+#include <tools/string.hxx>
+#include <unotools/options.hxx>
+
+// bits for broadcasting hints of changes in a SfxSimpleHint, may be combined
+const ULONG SYSLOCALEOPTIONS_HINT_LOCALE = 0x00000001;
+const ULONG SYSLOCALEOPTIONS_HINT_CURRENCY = 0x00000002;
+const ULONG SYSLOCALEOPTIONS_HINT_UILOCALE = 0x00000004;
+const ULONG SYSLOCALEOPTIONS_HINT_DECSEP = 0x00000008;
+
+class SvtSysLocaleOptions_Impl;
+class SvtListener;
+namespace osl { class Mutex; }
+
+class UNOTOOLS_DLLPUBLIC SvtSysLocaleOptions: public utl::detail::Options
+{
+ static SvtSysLocaleOptions_Impl* pOptions;
+ static sal_Int32 nRefCount;
+
+ UNOTOOLS_DLLPRIVATE static ::osl::Mutex& GetMutex();
+ virtual void ConfigurationChanged( utl::ConfigurationBroadcaster* p, sal_uInt32 nHint );
+
+public:
+
+ enum EOption
+ {
+ E_LOCALE,
+ E_UILOCALE,
+ E_CURRENCY
+ };
+ SvtSysLocaleOptions();
+ virtual ~SvtSysLocaleOptions();
+
+ // ConfigItem methods
+
+ sal_Bool IsModified();
+ void Commit();
+
+ /** Add a listener to react on config changes
+ which are broadcasted in a SfxSimpleHint
+ @return
+ <TRUE/> if added
+ <FALSE/> if not added
+ */
+
+ /** Block broadcasts and accumulate hints. This may be useful if, for
+ example, the locale and currency are changed and the currency was
+ empty before, since changing the locale with an empty currency does
+ also broadcast a change hint for the currency which would result in
+ two currency changes broadcasted.
+
+ @param bBlock
+ <TRUE/>: broadcasts are blocked until reversed.
+ <FALSE/>: broadcasts are not blocked anymore. Pending hints are
+ broadcasted if no other instance blocks the broadcast.
+
+ @ATTENTION
+ All SvtSysLocaleOptions instances point to exactly one refcounted
+ internal representation instance and broadcast blocks are counted.
+ Thus if you issue a BlockBroadcasts(TRUE) you MUST issue a matching
+ BlockBroadcasts(FALSE) or otherwise pending hints would never be
+ broadcasted again.
+ */
+ virtual void BlockBroadcasts( bool bBlock );
+
+ // config value access methods
+
+ /// The config string may be empty to denote the SYSTEM locale
+ const ::rtl::OUString& GetLocaleConfigString() const;
+ void SetLocaleConfigString( const ::rtl::OUString& rStr );
+ com::sun::star::lang::Locale GetLocale() const;
+ com::sun::star::lang::Locale GetRealLocale() const;
+ LanguageType GetRealLanguage() const;
+
+ /// The config string may be empty to denote the SYSTEM locale
+ const ::rtl::OUString& GetUILocaleConfigString() const;
+ void SetUILocaleConfigString( const ::rtl::OUString& rStr );
+ com::sun::star::lang::Locale GetUILocale() const;
+ com::sun::star::lang::Locale GetRealUILocale() const;
+ LanguageType GetRealUILanguage() const;
+
+ /// The config string may be empty to denote the default currency of the locale
+ const ::rtl::OUString& GetCurrencyConfigString() const;
+ void SetCurrencyConfigString( const ::rtl::OUString& rStr );
+ // determine whether the decimal separator defined in the keyboard layout is used
+ // or the one approriate to the locale
+ sal_Bool IsDecimalSeparatorAsLocale() const;
+ void SetDecimalSeparatorAsLocale( sal_Bool bSet);
+
+ // convenience methods
+
+ /// Get currency abbreviation and locale from an USD-en-US or EUR-de-DE string
+ static void GetCurrencyAbbrevAndLanguage(
+ String& rAbbrev,
+ LanguageType& eLang,
+ const ::rtl::OUString& rConfigString );
+
+ /// Create an USD-en-US or EUR-de-DE string
+ static ::rtl::OUString CreateCurrencyConfigString(
+ const String& rAbbrev,
+ LanguageType eLang );
+
+ void GetCurrencyAbbrevAndLanguage(
+ String& rAbbrev,
+ LanguageType& eLang ) const
+ {
+ GetCurrencyAbbrevAndLanguage( rAbbrev,
+ eLang, GetCurrencyConfigString() );
+ }
+
+ void SetCurrencyAbbrevAndLanguage(
+ const String& rAbbrev,
+ LanguageType eLang )
+ {
+ SetCurrencyConfigString(
+ CreateCurrencyConfigString(
+ rAbbrev, eLang ) );
+ }
+
+ /** Set a link to a method to be called whenever the default currency
+ changes. This can be only one method, and normally it is the static
+ link method which calls SvNumberFormatter::SetDefaultSystemCurrency().
+ This is needed because the number formatter isn't part of the svl light
+ library, otherwise we could call SetDefaultSystemCurrency() directly.
+ */
+ static void SetCurrencyChangeLink( const Link& rLink );
+ static const Link& GetCurrencyChangeLink();
+
+ /** return the readonly state of the queried option. */
+ sal_Bool IsReadOnly( EOption eOption ) const;
+};
+
+#endif // INCLUDED_SVTOOLS_SYSLOCALEOPTIONS_HXX
diff --git a/unotools/inc/unotools/tempfile.hxx b/unotools/inc/unotools/tempfile.hxx
new file mode 100644
index 000000000000..29ca06a23c71
--- /dev/null
+++ b/unotools/inc/unotools/tempfile.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.
+ *
+ ************************************************************************/
+#include "unotools/unotoolsdllapi.h"
+
+#ifndef _UNOTOOLS_TEMPFILE_HXX
+#define _UNOTOOLS_TEMPFILE_HXX
+
+#include <tools/string.hxx>
+#include <tools/stream.hxx>
+
+namespace utl
+{
+
+struct TempFile_Impl;
+
+/**
+ The class TempFile gives access to temporary files in the local file system. Sometimes they are needed because a 3rd party
+ code has a file name based interface, or some file access has to be done locally without transferring tons of bytes to or
+ from a remote system.
+ Creating a UCB content on a TempFile is only possible if a UCP for the local file system is present.
+ TempFiles can always be accessed by SvFileStreams or Sot/SvStorages using the "physical" file name ( not the URL, because
+ this may be a non-file URL, see below ), but if a UCB content can be created, it is also possible to take the URL and use
+ the UCB helper classes for streams. For convenience use UcbStreamHelper.
+ A Tempfile always has a "physical" file name ( a file name in the local computers host notation ) but it has a
+ "UCB compatible" URL only if a UCP for the local file system exists. This URL may have its own URL scheme
+ ( not neccessarily "file://" ! ). The TempFile class methods take this into account, but other simple conversions like
+ the osl functions do not.
+ So it is a potential error to convert between the filename and the URL of a TempFile object using functions or methods
+ outside this class.
+*/
+
+class UNOTOOLS_DLLPUBLIC TempFile
+{
+ TempFile_Impl* pImp;
+ sal_Bool bKillingFileEnabled;
+
+protected:
+
+public:
+ /**
+ Create a temporary file or directory, in the default tempfile folder or if possible in a given folder.
+ This given folder ( the "parent" parameter ( if not NULL ) ) must be a "UCB compatible" URL.
+ The temporary object is created in the local file system, even if there is no UCB that can access it.
+ If the given folder is part of the local file system, the TempFile is created in this folder.
+ */
+ TempFile( const String* pParent=NULL, sal_Bool bDirectory=sal_False );
+
+ /**
+ Same as above; additionally the name starts with some given characters followed by a counter ( example:
+ rLeadingChars="abc" means "abc0","abc1" and so on, depending on existing files in the folder ).
+ The extension string may be f.e. ".txt" or "", if no extension string is given, ".tmp" is used
+ */
+ TempFile( const String& rLeadingChars, const String* pExtension=NULL, const String* pParent=NULL,
+ sal_Bool bDirectory=sal_False);
+
+ /**
+ Same as above; additionally the name starts with some given characters followed by a counter ( example:
+ rLeadingChars="abc" means "abc0","abc1" and so on, depending on existing files in the folder ).
+ The extension string may be f.e. ".txt" or "", if no extension string is given, ".tmp" is used
+ @param _bStartWithZero If set to false names will be generated like "abc","abc0","abc1"
+ */
+ TempFile( const String& rLeadingChars,sal_Bool _bStartWithZero, const String* pExtension=NULL, const String* pParent=NULL,sal_Bool bDirectory=sal_False);
+
+ /**
+ TempFile will be removed from disk in dtor if EnableKillingTempFile was called before.
+ Temporary directories will be removed recursively in that case.
+ */
+ ~TempFile();
+
+ /**
+ Returns sal_True if it has a valid file name.
+ */
+ sal_Bool IsValid() const;
+
+ /**
+ Returns the "UCB compatible" URL of the tempfile object.
+ If you want to have the "physical" file name, use the GetFileName() method of this object, because these
+ method uses the UCB for the conversion, but never use any external conversion functions for URLs into
+ "physical" names.
+ If no UCP is available for the local file system, an empty URL is returned. In this case you can't access
+ the file as a UCB content !
+ */
+ String GetURL() const;
+
+ /**
+ Returns the "physical" name of the tempfile in host notation ( should only be used for 3rd party code
+ with file name interfaces ).
+ If you want to have the URL, use the GetURL() method of this object, but never use any external
+ conversion functions for "physical" names into URLs.
+ */
+ String GetFileName() const;
+
+ /**
+ Returns a stream to the tempfiles data; the stream is owned by the tempfile object, so you have to keep this
+ alive as long as you want to use the stream. If the TempFile object is destroyed, it also destroys the
+ stream object, the underlying file is only deleted if EnableKillingFile( sal_True ) has been called before!
+ */
+ SvStream* GetStream( StreamMode eMode );
+
+ /**
+ Let the TempFile object close and destroy the owned stream object if any.
+ */
+ void CloseStream();
+
+ /**
+ If enabled the file will be removed from disk when the dtor is called ( default is not enabled )
+ */
+ void EnableKillingFile( sal_Bool bEnable=sal_True )
+ { bKillingFileEnabled = bEnable; }
+
+ sal_Bool IsKillingFileEnabled() const
+ { return bKillingFileEnabled; }
+
+ /**
+ Only create a "physical" file name for a temporary file that would be valid at that moment.
+ Should only be used for 3rd party code with a file name interface that wants to create the file by itself.
+ If you want to convert file name into a URL, always use class LocalFileHelper, but never use any
+ conversion functions of osl.
+ */
+ static String CreateTempName( const String* pParent=NULL );
+
+ /**
+ The TempNameBaseDirectory is a subfolder in the folder that is passed as a "physical" file name in the
+ SetTempNameBaseDirectory method.
+ This subfolder will be used if a TempFile or TempName is created without a parent name or a parent name
+ that does not belong to the local file system.
+ The caller of the SetTempNameBase is responsible for deleting this folder and all temporary files in it.
+ The return value of both methods is the complete "physical" name of the tempname base folder.
+ It is not a URL because alle URLs must be "UCB compatible", so there may be no suitable URL at all.
+ */
+ static String SetTempNameBaseDirectory( const String &rBaseName );
+ static String GetTempNameBaseDirectory();
+};
+
+}
+
+#endif
diff --git a/unotools/inc/unotools/textsearch.hxx b/unotools/inc/unotools/textsearch.hxx
new file mode 100644
index 000000000000..e4cd095fcc14
--- /dev/null
+++ b/unotools/inc/unotools/textsearch.hxx
@@ -0,0 +1,196 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "unotools/unotoolsdllapi.h"
+
+#ifndef _UNOTOOLS_TEXTSEARCH_HXX
+#define _UNOTOOLS_TEXTSEARCH_HXX
+#include <i18npool/lang.h>
+#include <tools/string.hxx>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/lang/Locale.hpp>
+#include <com/sun/star/util/XTextSearch.hpp>
+#include <com/sun/star/util/SearchOptions.hpp>
+
+// Forward-Deklaration
+class CharClass;
+
+namespace com {
+ namespace sun {
+ namespace star {
+ namespace util {
+ struct SearchResult;
+ }
+ }
+ }
+}
+
+// ............................................................................
+namespace utl
+{
+// ............................................................................
+
+// SS - Klasse fuers Suchen
+class UNOTOOLS_DLLPUBLIC SearchParam
+{
+public:
+ enum SearchType{ SRCH_NORMAL, SRCH_REGEXP, SRCH_LEVDIST };
+
+private:
+ String sSrchStr; // the search string
+ String sReplaceStr; // the replace string
+
+ SearchType eSrchType; // search normal/regular/LevDist
+
+ int bWordOnly : 1; // used by normal search
+ int bSrchInSel : 1; // search only in the selection
+ int bCaseSense : 1; //
+
+ // values for the "weight Levenshtein-Distance"
+ int bLEV_Relaxed : 1;
+ int nLEV_OtherX;
+ int nLEV_ShorterY;
+ int nLEV_LongerZ;
+
+ // asian flags - used for the transliteration
+ long nTransliterationFlags;
+
+public:
+ SearchParam( const String &rText,
+ SearchType eSrchType = SearchParam::SRCH_NORMAL,
+ BOOL bCaseSens = TRUE,
+ BOOL bWrdOnly = FALSE,
+ BOOL bSrchInSel = FALSE );
+ SearchParam( const SearchParam& );
+
+ const String& GetSrchStr() const { return sSrchStr; }
+ const String& GetReplaceStr() const { return sReplaceStr; }
+ SearchType GetSrchType() const { return eSrchType; }
+
+ int IsCaseSensitive() const { return bCaseSense; }
+ int IsSrchInSelection() const { return bSrchInSel; }
+ int IsSrchWordOnly() const { return bWordOnly; }
+
+
+ void SetSrchStr( const String& rStr ) { sSrchStr = rStr; }
+ void SetReplaceStr( const String& rStr ) { sReplaceStr = rStr; }
+ void SetSrchType( SearchType eType ) { eSrchType = eType; }
+
+ void SetCaseSensitive( int bFlag ) { bCaseSense = bFlag; }
+ void SetSrchInSelection( int bFlag ) { bSrchInSel = bFlag; }
+ void SetSrchWordOnly( int bFlag ) { bWordOnly = bFlag; }
+
+ int IsSrchRelaxed() const { return bLEV_Relaxed; }
+ int GetLEVOther() const { return nLEV_OtherX; }
+ int GetLEVShorter() const { return nLEV_ShorterY; }
+ int GetLEVLonger() const { return nLEV_LongerZ; }
+
+ void SetSrchRelaxed( int bFlag ) { bLEV_Relaxed = bFlag; }
+ void SetLEVOther( int nValue ) { nLEV_OtherX = nValue; }
+ void SetLEVShorter( int nValue ) { nLEV_ShorterY = nValue; }
+ void SetLEVLonger( int nValue ) { nLEV_LongerZ = nValue; }
+
+ long GetTransliterationFlags() const { return nTransliterationFlags; }
+ void SetTransliterationFlags( long nValue ) { nTransliterationFlags = nValue; }
+};
+
+// Klasse zum Suchen eines Strings in einem String.
+// Unterstuetzt werden folgende Verfahren:
+// - normalen Text (Bayer/Moore)
+// - regulaere Ausdruecke
+// - gewichtete Levenshtein Distanz
+//
+// Es kann Vorwaerts und Rueckwaerts gesucht werden!
+
+class UNOTOOLS_DLLPUBLIC TextSearch
+{
+ struct CachedTextSearch
+ {
+ ::osl::Mutex mutex;
+ ::com::sun::star::util::SearchOptions Options;
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XTextSearch > xTextSearch;
+ };
+
+ static CachedTextSearch maCache;
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::util::XTextSearch >
+ getXTextSearch( const ::com::sun::star::util::SearchOptions& rPara );
+
+ com::sun::star::uno::Reference < com::sun::star::util::XTextSearch >
+ xTextSearch;
+
+ void Init( const SearchParam & rParam,
+ const ::com::sun::star::lang::Locale& rLocale );
+
+public:
+ // rText ist der zusuchende String
+ // this first two CTORs are deprecated!
+ TextSearch( const SearchParam & rPara, LanguageType nLanguage );
+ TextSearch( const SearchParam & rPara, const CharClass& rCClass );
+
+ TextSearch( const ::com::sun::star::util::SearchOptions& rPara );
+ ~TextSearch();
+
+ /* search in the (selected) text the search string:
+ rScrTxt - the text, in in which we search
+ pStart - start position for the search
+ pEnde - end position for the search
+
+ RETURN values == TRUE: something is found
+ - pStart start pos of the found text,
+ - pStart end pos of the found text,
+ - pSrchResult - the search result with all found
+ positions. Is only filled with more positions
+ if the regular expression handles groups.
+
+ == FALSE: nothing found, pStart,pEnde unchanged.
+
+ Definitions: start pos always inclusive, end pos always exclusive!
+ The position must always in the right direction!
+ search forward: start <= end
+ search backward: end <= start
+ */
+ int SearchFrwrd( const String &rStr,
+ xub_StrLen* pStart, xub_StrLen* pEnde,
+ ::com::sun::star::util::SearchResult* pSrchResult = 0 );
+ int SearchBkwrd( const String &rStr,
+ xub_StrLen* pStart, xub_StrLen* pEnde,
+ ::com::sun::star::util::SearchResult* pSrchResult = 0 );
+
+ void SetLocale( const ::com::sun::star::util::SearchOptions& rOpt,
+ const ::com::sun::star::lang::Locale& rLocale );
+
+ /* replace back references in the replace string by the sub expressions from the search result */
+ void ReplaceBackReferences( String& rReplaceStr, const String &rStr, const ::com::sun::star::util::SearchResult& rResult );
+
+};
+
+// ............................................................................
+} // namespace utl
+// ............................................................................
+
+#endif
+
diff --git a/unotools/inc/unotools/transliterationwrapper.hxx b/unotools/inc/unotools/transliterationwrapper.hxx
new file mode 100644
index 000000000000..acd3bbf5dcf4
--- /dev/null
+++ b/unotools/inc/unotools/transliterationwrapper.hxx
@@ -0,0 +1,145 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "unotools/unotoolsdllapi.h"
+
+#ifndef _UNOTOOLS_TRANSLITERATIONWRAPPER_HXX
+#define _UNOTOOLS_TRANSLITERATIONWRAPPER_HXX
+#include <tools/string.hxx>
+#include <tools/solar.h>
+#include <com/sun/star/i18n/XExtendedTransliteration.hpp>
+
+namespace com { namespace sun { namespace star {
+ namespace lang {
+ class XMultiServiceFactory;
+ }
+}}}
+
+namespace utl
+{
+
+class UNOTOOLS_DLLPUBLIC TransliterationWrapper
+{
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory > xSMgr;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::i18n::XExtendedTransliteration > xTrans;
+ ::com::sun::star::lang::Locale aLocale;
+ sal_uInt32 nType;
+ sal_uInt16 nLanguage;
+ mutable sal_Bool bFirstCall;
+
+ // not implemented, prevent usage
+ TransliterationWrapper( const TransliterationWrapper& );
+ TransliterationWrapper& operator=( const TransliterationWrapper& );
+
+ void loadModuleImpl() const;
+ void setLanguageLocaleImpl( sal_uInt16 nLang );
+
+public:
+ TransliterationWrapper( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory > & xSF,
+ sal_uInt32 nType );
+
+ ~TransliterationWrapper();
+
+ // get current Locale / Language
+ const ::com::sun::star::lang::Locale& getLocale() const { return aLocale;}
+ sal_uInt16 getLanguage() const { return nLanguage; }
+
+ sal_uInt32 getType() const { return nType; }
+
+ sal_Bool needLanguageForTheMode() const;
+
+ /** set a new language and load the corresponding transliteration module if
+ needed for the mode set with nType in the ctor */
+ void loadModuleIfNeeded( sal_uInt16 nLang );
+
+ /** Load the transliteration module specified by rModuleName, which has to
+ be the UNO service implementation name that is expanded to the full UNO
+ service implementation name, for example, "NumToCharKanjiShort_ja_JP"
+ expands to
+ "com.sun.star.i18n.Transliteration.NumToCharKanjiShort_ja_JP".
+ @ATTENTION!
+ This method ignores the mode type set with the constructor and
+ interferes with the loadModuleIfNeeded() method and the transliterate()
+ method that gets a LanguageType passed as parameter. Using one of
+ those may load a different module and overwrite this setting. Only the
+ transliterate() method that takes no LanguageType parameter may be used
+ for a specific module loaded with this method. */
+ void loadModuleByImplName( const String& rModuleName, sal_uInt16 nLang );
+
+ /** This transliteration method corresponds with the loadModuleByImplName()
+ method. It relies on a module being loaded and does not try load one.
+ If for any reason the string can't be transliterated the original
+ string is returned. */
+ String transliterate( const String& rStr,
+ xub_StrLen nStart, xub_StrLen nLen,
+ ::com::sun::star::uno::Sequence <sal_Int32>* pOffset ) const;
+
+ // Wrapper implementations of class Transliteration
+ String transliterate( const String& rStr, sal_uInt16 nLanguage,
+ xub_StrLen nStart, xub_StrLen nLen,
+ ::com::sun::star::uno::Sequence <sal_Int32>* pOffset );
+
+ /** If two strings are equal per this transliteration.
+ Returns the number of matched code points in any case, even if strings
+ are not equal, for example:
+ equals( "a", 0, 1, nMatch1, "aaa", 0, 3, nMatch2 )
+ returns false and nMatch:=1 and nMatch2:=1
+ equals( "aab", 0, 3, nMatch1, "aaa", 0, 3, nMatch2 )
+ returns false and nMatch:=2 and nMatch2:=2
+ */
+ sal_Bool equals(
+ const String& rStr1, sal_Int32 nPos1, sal_Int32 nCount1, sal_Int32& nMatch1,
+ const String& rStr2, sal_Int32 nPos2, sal_Int32 nCount2, sal_Int32& nMatch2 ) const;
+
+ sal_Int32 compareSubstring(
+ const String& rStr1, sal_Int32 nOff1, sal_Int32 nLen1,
+ const String& rStr2, sal_Int32 nOff2, sal_Int32 nLen2 ) const;
+
+ sal_Int32 compareString( const String& rStr1, const String& rStr2 ) const;
+
+
+ // helpers
+
+ /** If two strings are really equal as per this translation, and not just
+ one string is matching the start of the other. Use this method instead
+ of compareString()==0 because it is much faster.
+ */
+ sal_Bool isEqual( const String& rStr1, const String& rStr2 ) const;
+
+ /** If string rStr1 matches the start of string rStr2, i.e. "a" in "aaa"
+ */
+ sal_Bool isMatch( const String& rStr1, const String& rStr2 ) const;
+
+};
+
+// ............................................................................
+} // namespace utl
+// ............................................................................
+
+#endif
diff --git a/unotools/inc/unotools/ucbhelper.hxx b/unotools/inc/unotools/ucbhelper.hxx
new file mode 100644
index 000000000000..687868adbdb4
--- /dev/null
+++ b/unotools/inc/unotools/ucbhelper.hxx
@@ -0,0 +1,88 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "unotools/unotoolsdllapi.h"
+
+#ifndef _UNOTOOLS_UCBHELPER_HXX
+#define _UNOTOOLS_UCBHELPER_HXX
+
+// include ---------------------------------------------------------------
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/ucb/NameClash.hpp>
+#include <com/sun/star/ucb/XContentProvider.hpp>
+
+#include <tools/string.hxx>
+
+namespace ucbhelper
+{
+ class Content;
+}
+
+namespace utl
+{
+ class UNOTOOLS_DLLPUBLIC UCBContentHelper
+ {
+ private:
+ static sal_Bool Transfer_Impl( const String& rSource, const String& rDest, sal_Bool bMoveData,
+ sal_Int32 nNameClash );
+
+ public:
+ static sal_Bool IsDocument( const String& rContent );
+ static sal_Bool IsFolder( const String& rContent );
+ static sal_Bool GetTitle( const String& rContent, String& rTitle );
+ static sal_Bool Kill( const String& rContent );
+
+ static ::com::sun::star::uno::Any GetProperty( const String& rURL, const ::rtl::OUString& rName );
+
+ static ::com::sun::star::uno::Sequence< ::rtl::OUString >
+ GetFolderContents( const String& rFolder, sal_Bool bFolder, sal_Bool bSorted = sal_False );
+ static ::com::sun::star::uno::Sequence< ::rtl::OUString > GetResultSet( const String& rURL );
+
+ static sal_Bool CopyTo( const String& rSource, const String& rDest );
+ static sal_Bool MoveTo( const String& rSource, const String& rDest, sal_Int32 nNameClash = com::sun::star::ucb::NameClash::ERROR );
+
+ static sal_Bool CanMakeFolder( const String& rFolder );
+ static sal_Bool MakeFolder( const String& rFolder, sal_Bool bNewOnly = sal_False );
+ static sal_Bool MakeFolder( ::ucbhelper::Content& rParent,
+ const String& rTitle,
+ ::ucbhelper::Content& rNewFolder,
+ sal_Bool bNewOnly = sal_False );
+ static sal_Bool HasParentFolder( const String& rFolder );
+
+ static ULONG GetSize( const String& rContent );
+ static sal_Bool IsYounger( const String& rIsYoung, const String& rIsOlder );
+
+ static sal_Bool Exists( const String& rContent );
+ static sal_Bool FindInPath( const String& rPath, const String& rName, String& rFile, char cDelim = ';', BOOL bAllowWildCards = TRUE );
+ static sal_Bool Find( const String& rFolder, const String& rName, String& rFile, BOOL bAllowWildCards = FALSE );
+ static sal_Bool IsSubPath( const ::rtl::OUString& rPath, const ::rtl::OUString& rChildCandidate, const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContentProvider >& xContentProvider = ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContentProvider >() );
+ };
+}
+
+#endif
+
+
diff --git a/unotools/inc/unotools/ucblockbytes.hxx b/unotools/inc/unotools/ucblockbytes.hxx
new file mode 100644
index 000000000000..2ba0a683745a
--- /dev/null
+++ b/unotools/inc/unotools/ucblockbytes.hxx
@@ -0,0 +1,222 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _UNTOOLS_UCBLOCKBYTES_HXX
+#define _UNTOOLS_UCBLOCKBYTES_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/ucb/XContent.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include "unotools/unotoolsdllapi.h"
+
+#include <vos/thread.hxx>
+#include <vos/conditn.hxx>
+#include <vos/mutex.hxx>
+#include <tools/stream.hxx>
+#include <tools/link.hxx>
+#include <tools/errcode.hxx>
+#include <tools/datetime.hxx>
+
+namespace com
+{
+ namespace sun
+ {
+ namespace star
+ {
+ namespace task
+ {
+ class XInteractionHandler;
+ }
+ namespace io
+ {
+ class XStream;
+ class XInputStream;
+ class XOutputStream;
+ class XSeekable;
+ }
+ namespace ucb
+ {
+ class XContent;
+ }
+ namespace beans
+ {
+ struct PropertyValue;
+ }
+ }
+ }
+}
+
+namespace utl
+{
+SV_DECL_REF( UcbLockBytes )
+
+class UcbLockBytesHandler : public SvRefBase
+{
+ sal_Bool m_bActive;
+public:
+ enum LoadHandlerItem
+ {
+ DATA_AVAILABLE,
+ DONE,
+ CANCEL
+ };
+
+ UcbLockBytesHandler()
+ : m_bActive( sal_True )
+ {}
+
+ virtual void Handle( LoadHandlerItem nWhich, UcbLockBytesRef xLockBytes ) = 0;
+ void Activate( BOOL bActivate = sal_True ) { m_bActive = bActivate; }
+ sal_Bool IsActive() const { return m_bActive; }
+};
+
+SV_DECL_IMPL_REF( UcbLockBytesHandler )
+
+#define NS_UNO ::com::sun::star::uno
+#define NS_IO ::com::sun::star::io
+#define NS_UCB ::com::sun::star::ucb
+#define NS_BEANS ::com::sun::star::beans
+#define NS_TASK ::com::sun::star::task
+
+class UNOTOOLS_DLLPUBLIC UcbLockBytes : public virtual SvLockBytes
+{
+ vos::OCondition m_aInitialized;
+ vos::OCondition m_aTerminated;
+ vos::OMutex m_aMutex;
+
+ String m_aContentType;
+ String m_aRealURL;
+ DateTime m_aExpireDate;
+
+ NS_UNO::Reference < NS_IO::XInputStream > m_xInputStream;
+ NS_UNO::Reference < NS_IO::XOutputStream > m_xOutputStream;
+ NS_UNO::Reference < NS_IO::XSeekable > m_xSeekable;
+ void* m_pCommandThread; // is alive only for compatibility reasons
+ UcbLockBytesHandlerRef m_xHandler;
+
+ sal_uInt32 m_nRead;
+ sal_uInt32 m_nSize;
+ ErrCode m_nError;
+
+ sal_Bool m_bTerminated : 1;
+ sal_Bool m_bDontClose : 1;
+ sal_Bool m_bStreamValid : 1;
+
+ DECL_LINK( DataAvailHdl, void * );
+
+ UcbLockBytes( UcbLockBytesHandler* pHandler=NULL );
+protected:
+ virtual ~UcbLockBytes (void);
+
+public:
+ // properties: Referer, PostMimeType
+ static UcbLockBytesRef CreateLockBytes( const NS_UNO::Reference < NS_UCB::XContent >& xContent,
+ const ::rtl::OUString& rReferer,
+ const ::rtl::OUString& rMediaType,
+ const NS_UNO::Reference < NS_IO::XInputStream >& xPostData,
+ const NS_UNO::Reference < NS_TASK::XInteractionHandler >& xInter,
+ UcbLockBytesHandler* pHandler=0 );
+
+ static UcbLockBytesRef CreateLockBytes( const NS_UNO::Reference < NS_UCB::XContent >& xContent,
+ const NS_UNO::Sequence < NS_BEANS::PropertyValue >& rProps,
+ StreamMode eMode,
+ const NS_UNO::Reference < NS_TASK::XInteractionHandler >& xInter,
+ UcbLockBytesHandler* pHandler=0 );
+
+ static UcbLockBytesRef CreateInputLockBytes( const NS_UNO::Reference < NS_IO::XInputStream >& xContent );
+ static UcbLockBytesRef CreateLockBytes( const NS_UNO::Reference < NS_IO::XStream >& xContent );
+
+ // SvLockBytes
+ virtual void SetSynchronMode (BOOL bSynchron);
+ virtual ErrCode ReadAt ( ULONG nPos, void *pBuffer, ULONG nCount, ULONG *pRead) const;
+ virtual ErrCode WriteAt ( ULONG, const void*, ULONG, ULONG *pWritten);
+ virtual ErrCode Flush (void) const;
+ virtual ErrCode SetSize (ULONG);
+ virtual ErrCode Stat ( SvLockBytesStat *pStat, SvLockBytesStatFlag) const;
+
+ void SetError( ErrCode nError )
+ { m_nError = nError; }
+
+ ErrCode GetError() const
+ { return m_nError; }
+
+ void Cancel(); // is alive only for compatibility reasons
+
+ // the following properties are available when and after the first DataAvailable callback has been executed
+ String GetContentType() const;
+ String GetRealURL() const;
+ DateTime GetExpireDate() const;
+
+ // calling this method delegates the responsibility to call closeinput to the caller!
+ NS_UNO::Reference < NS_IO::XInputStream > getInputStream();
+ NS_UNO::Reference < NS_IO::XStream > getStream();
+
+#if _SOLAR__PRIVATE
+ sal_Bool setInputStream_Impl( const NS_UNO::Reference < NS_IO::XInputStream > &rxInputStream,
+ sal_Bool bSetXSeekable = sal_True );
+ sal_Bool setStream_Impl( const NS_UNO::Reference < NS_IO::XStream > &rxStream );
+ void terminate_Impl (void);
+
+ NS_UNO::Reference < NS_IO::XInputStream > getInputStream_Impl() const
+ {
+ vos::OGuard aGuard( SAL_CONST_CAST(UcbLockBytes*, this)->m_aMutex );
+ return m_xInputStream;
+ }
+
+ NS_UNO::Reference < NS_IO::XOutputStream > getOutputStream_Impl() const
+ {
+ vos::OGuard aGuard( SAL_CONST_CAST(UcbLockBytes*, this)->m_aMutex );
+ return m_xOutputStream;
+ }
+
+ NS_UNO::Reference < NS_IO::XSeekable > getSeekable_Impl() const
+ {
+ vos::OGuard aGuard( SAL_CONST_CAST(UcbLockBytes*, this)->m_aMutex );
+ return m_xSeekable;
+ }
+
+ sal_Bool hasInputStream_Impl() const
+ {
+ vos::OGuard aGuard( SAL_CONST_CAST(UcbLockBytes*, this)->m_aMutex );
+ return m_xInputStream.is();
+ }
+
+ void setDontClose_Impl()
+ { m_bDontClose = sal_True; }
+
+ void SetContentType_Impl( const String& rType ) { m_aContentType = rType; }
+ void SetRealURL_Impl( const String& rURL ) { m_aRealURL = rURL; }
+ void SetExpireDate_Impl( const DateTime& rDateTime ) { m_aExpireDate = rDateTime; }
+ void SetStreamValid_Impl();
+#endif
+};
+
+SV_IMPL_REF( UcbLockBytes );
+
+}
+
+#endif
diff --git a/unotools/inc/unotools/ucbstreamhelper.hxx b/unotools/inc/unotools/ucbstreamhelper.hxx
new file mode 100644
index 000000000000..2c06d925ddb2
--- /dev/null
+++ b/unotools/inc/unotools/ucbstreamhelper.hxx
@@ -0,0 +1,83 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _UNTOOLS_UCBSTREAMHELPER_HXX
+#define _UNTOOLS_UCBSTREAMHELPER_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/io/XStream.hpp>
+#include "unotools/unotoolsdllapi.h"
+
+#include <tools/stream.hxx>
+
+namespace com
+{
+ namespace sun
+ {
+ namespace star
+ {
+ namespace task
+ {
+ class XInteractionHandler;
+ }
+ namespace io
+ {
+ class XStream;
+ class XInputStream;
+ }
+ }
+ }
+}
+
+#define NS_UNO ::com::sun::star::uno
+#define NS_IO ::com::sun::star::io
+#define NS_TASK ::com::sun::star::task
+
+class String;
+namespace utl
+{
+ class UcbLockBytesHandler;
+
+ class UNOTOOLS_DLLPUBLIC UcbStreamHelper : public SvStream
+ {
+ public:
+ static SvStream* CreateStream( const String& rFileName, StreamMode eOpenMode,
+ UcbLockBytesHandler* pHandler=0, sal_Bool bForceSynchron=sal_True );
+ static SvStream* CreateStream( const String& rFileName, StreamMode eOpenMode,
+ NS_UNO::Reference < NS_TASK::XInteractionHandler >,
+ UcbLockBytesHandler* pHandler=0, sal_Bool bForceSynchron=sal_True );
+ static SvStream* CreateStream( const String& rFileName, StreamMode eOpenMode,
+ sal_Bool bFileExists,
+ UcbLockBytesHandler* pHandler=0, sal_Bool bForceSynchron=sal_True );
+ static SvStream* CreateStream( NS_UNO::Reference < NS_IO::XInputStream > xStream );
+ static SvStream* CreateStream( NS_UNO::Reference < NS_IO::XStream > xStream );
+ static SvStream* CreateStream( NS_UNO::Reference < NS_IO::XInputStream > xStream, sal_Bool bCloseStream );
+ static SvStream* CreateStream( NS_UNO::Reference < NS_IO::XStream > xStream, sal_Bool bCloseStream );
+ };
+}
+
+#endif
diff --git a/unotools/inc/unotools/undoopt.hxx b/unotools/inc/unotools/undoopt.hxx
new file mode 100644
index 000000000000..319f5f4edf32
--- /dev/null
+++ b/unotools/inc/unotools/undoopt.hxx
@@ -0,0 +1,49 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef INCLUDED_unotools_UNDOOPT_HXX
+#define INCLUDED_unotools_UNDOOPT_HXX
+
+#include "unotools/unotoolsdllapi.h"
+#include <sal/types.h>
+#include <unotools/options.hxx>
+
+class SvtUndoOptions_Impl;
+
+class UNOTOOLS_DLLPUBLIC SvtUndoOptions: public utl::detail::Options
+{
+ SvtUndoOptions_Impl* pImp;
+
+public:
+ SvtUndoOptions();
+ virtual ~SvtUndoOptions();
+
+ void SetUndoCount( sal_Int32 n );
+ sal_Int32 GetUndoCount() const;
+};
+
+#endif
+
diff --git a/unotools/inc/unotools/unotoolsdllapi.h b/unotools/inc/unotools/unotoolsdllapi.h
new file mode 100644
index 000000000000..521c9c3af3f6
--- /dev/null
+++ b/unotools/inc/unotools/unotoolsdllapi.h
@@ -0,0 +1,41 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_UNOTOOLSDLLAPI_H
+#define INCLUDED_UNOTOOLSDLLAPI_H
+
+#include "sal/types.h"
+
+#if defined(UNOTOOLS_DLLIMPLEMENTATION)
+#define UNOTOOLS_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define UNOTOOLS_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+#define UNOTOOLS_DLLPRIVATE SAL_DLLPRIVATE
+
+#endif /* INCLUDED_UNOTOOLSDLLAPI_H */
+
diff --git a/unotools/inc/unotools/unotunnelhelper.hxx b/unotools/inc/unotools/unotunnelhelper.hxx
new file mode 100644
index 000000000000..ec4f1243f4d9
--- /dev/null
+++ b/unotools/inc/unotools/unotunnelhelper.hxx
@@ -0,0 +1,196 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _UNOTOOLS_UNOTUNNELHLP_HXX
+#define _UNOTOOLS_UNOTUNNELHLP_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <rtl/uuid.h>
+#include <rtl/memory.h>
+
+#ifndef _CPPUHELPER_EXTRACT_HXX_
+#include <cppuhelper/extract.hxx>
+#endif
+
+namespace utl
+{
+namespace staruno = ::com::sun::star::uno;
+namespace starlang = ::com::sun::star::lang;
+
+//-----------------------------------------------------------------------------------------------------------
+// to use the following, define
+// sal_Bool getTunneledImplementation(Classname*& pObjImpl, staruno::Reference<starlang::XUnoTunnel> const& xObj);
+
+template <class Classname>
+sal_Bool getImplementation(Classname*& pImpl, staruno::Reference<starlang::XUnoTunnel> const& xTunnel)
+ throw(staruno::RuntimeException)
+{
+ if (xTunnel.is())
+ return getTunneledImplementation(pImpl, xTunnel);
+
+ pImpl = 0;
+ return sal_False;
+}
+
+template <class Classname>
+sal_Bool getImplementation(Classname*& pImpl, staruno::Reference<staruno::XInterface> const& xObj)
+ throw(staruno::RuntimeException)
+{
+ staruno::Reference<starlang::XUnoTunnel> xTunnel(xObj,staruno::UNO_QUERY);
+ if (xTunnel.is())
+ return getTunneledImplementation(pImpl, xTunnel);
+
+ pImpl = 0;
+ return sal_False;
+}
+
+template <class Classname>
+sal_Bool getImplementation(Classname*& pImpl, staruno::Any const& aObj)
+ throw(staruno::RuntimeException)
+{
+ staruno::Reference<starlang::XUnoTunnel> xTunnel;
+ if (cppu::extractInterface(xTunnel, aObj))
+ getTunneledImplementation(pImpl, xTunnel);
+
+ pImpl = 0;
+ return sal_False;
+}
+
+template <class Classname>
+sal_Bool getImplementation(Classname*& pImpl, starlang::XUnoTunnel* pObj)
+ throw(staruno::RuntimeException)
+{
+ if (pObj)
+ {
+ staruno::Reference<starlang::XUnoTunnel> xTunnel(pObj);
+ return getTunneledImplementation(pImpl, xTunnel);
+ }
+
+ pImpl = 0;
+ return sal_False;
+}
+
+//-----------------------------------------------------------------------------------------------------------
+
+class UnoTunnelId
+{
+ sal_Int8 tunnelId[16];
+public:
+ UnoTunnelId(sal_Bool bUseMAC = sal_True) throw()
+ {
+ rtl_createUuid(reinterpret_cast<sal_uInt8*>(tunnelId),0,bUseMAC);
+ }
+
+ staruno::Sequence<sal_Int8> getId() const throw(staruno::RuntimeException)
+ {
+ return staruno::Sequence<sal_Int8>(tunnelId, sizeof(tunnelId));
+ }
+
+ sal_Bool equalTo(staruno::Sequence<sal_Int8> const& rIdentifier) throw()
+ {
+ return rIdentifier.getLength() == sizeof(tunnelId) &&
+ rtl_compareMemory(tunnelId, rIdentifier.getConstArray(), sizeof(tunnelId)) == 0;
+ }
+
+ sal_Int8 const (&getIdBytes() const)[16] { return tunnelId; }
+};
+
+//-----------------------------------------------------------------------------------------------------------
+template<class Classname>
+class UnoTunnelImplBase
+{
+protected:
+ Classname* ThisImplementation() throw() { return static_cast<Classname*>(this); }
+
+ sal_Int64 makeUnoSomething() throw()
+ {
+ return reinterpret_cast<sal_Int64>(static_cast<void*>(ThisImplementation()));
+ }
+
+ static Classname* extractUnoSomething(sal_Int64 nSomething) throw()
+ {
+ if (nSomething != sal_Int64())
+ return static_cast<Classname*>(reinterpret_cast<void*>(nSomething));
+
+ return NULL;
+ }
+#ifdef LINUX
+public:
+#endif
+ static Classname*
+ extractUnoSomething(
+ staruno::Reference<starlang::XUnoTunnel> const& xObj,
+ staruno::Sequence<sal_Int8> const& rMyTunnelId
+ )
+ throw(staruno::RuntimeException)
+ {
+ return xObj.is() ? extractUnoSomething(xObj->getSomething(rMyTunnelId)) : NULL;
+ }
+};
+//-----------------------------------------------------------------------------------------------------------
+
+
+template<class Classname>
+class UnoTunnelHelper : public UnoTunnelImplBase<Classname>
+{
+protected:
+ static UnoTunnelId s_aTunnelId;
+
+ sal_Int64 getSomething(staruno::Sequence<sal_Int8> const& rTunnelId) throw()
+ {
+ if (s_aTunnelId.equalTo(rTunnelId))
+ return this->makeUnoSomething();
+ else
+ return sal_Int64();
+ }
+public:
+ static staruno::Sequence<sal_Int8> getImplementationTunnelId()
+ throw(staruno::RuntimeException)
+ {
+ return s_aTunnelId.getId();
+ }
+#ifndef LINUX
+ friend sal_Bool getTunneledImplementation(Classname*& pImpl, staruno::Reference<starlang::XUnoTunnel> const& xObj)
+ throw(staruno::RuntimeException)
+ {
+ pImpl = UnoTunnelHelper<Classname>::UnoTunnelHelper<Classname>::extractUnoSomething( xObj, UnoTunnelHelper<Classname>::getImplementationTunnelId() );
+
+ return pImpl != 0;
+ }
+#endif
+};
+template<class Classname>
+UnoTunnelId UnoTunnelHelper<Classname>::s_aTunnelId;
+
+
+//-----------------------------------------------------------------------------------------------------------
+} // namespace utl
+
+#endif // _UNOTOOLS_UNOTUNNELHLP_HXX
+
diff --git a/unotools/inc/unotools/useroptions.hxx b/unotools/inc/unotools/useroptions.hxx
new file mode 100644
index 000000000000..020ddd657eaf
--- /dev/null
+++ b/unotools/inc/unotools/useroptions.hxx
@@ -0,0 +1,118 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef INCLUDED_unotools_USEROPTIONS_HXX
+#define INCLUDED_unotools_USEROPTIONS_HXX
+
+#include "unotools/unotoolsdllapi.h"
+#include <unotools/configitem.hxx>
+#include <tools/string.hxx>
+#include <osl/mutex.hxx>
+#include <unotools/options.hxx>
+
+// define ----------------------------------------------------------------
+
+#define USER_OPT_CITY ((USHORT)0)
+#define USER_OPT_COMPANY ((USHORT)1)
+#define USER_OPT_COUNTRY ((USHORT)2)
+#define USER_OPT_EMAIL ((USHORT)3)
+#define USER_OPT_FAX ((USHORT)4)
+#define USER_OPT_FIRSTNAME ((USHORT)5)
+#define USER_OPT_LASTNAME ((USHORT)6)
+#define USER_OPT_POSITION ((USHORT)7)
+#define USER_OPT_STATE ((USHORT)8)
+#define USER_OPT_STREET ((USHORT)9)
+#define USER_OPT_TELEPHONEHOME ((USHORT)10)
+#define USER_OPT_TELEPHONEWORK ((USHORT)11)
+#define USER_OPT_TITLE ((USHORT)12)
+#define USER_OPT_ID ((USHORT)13)
+#define USER_OPT_ZIP ((USHORT)14)
+#define USER_OPT_FATHERSNAME ((USHORT)15)
+#define USER_OPT_APARTMENT ((USHORT)16)
+
+// class SvtUserOptions --------------------------------------------------
+
+class SvtUserOptions_Impl;
+
+class UNOTOOLS_DLLPUBLIC SvtUserOptions: public utl::detail::Options
+{
+private:
+ SvtUserOptions_Impl* pImp;
+
+public:
+ SvtUserOptions();
+ virtual ~SvtUserOptions();
+
+ static ::osl::Mutex& GetInitMutex();
+
+ // get the address token
+ ::rtl::OUString GetCompany() const;
+ ::rtl::OUString GetFirstName() const;
+ ::rtl::OUString GetLastName() const;
+ ::rtl::OUString GetID() const;
+ ::rtl::OUString GetStreet() const;
+ ::rtl::OUString GetCity() const;
+ ::rtl::OUString GetState() const;
+ ::rtl::OUString GetZip() const;
+ ::rtl::OUString GetCountry() const;
+ ::rtl::OUString GetPosition() const;
+ ::rtl::OUString GetTitle() const;
+ ::rtl::OUString GetTelephoneHome() const;
+ ::rtl::OUString GetTelephoneWork() const;
+ ::rtl::OUString GetFax() const;
+ ::rtl::OUString GetEmail() const;
+ ::rtl::OUString GetCustomerNumber() const;
+ ::rtl::OUString GetFathersName() const;
+ ::rtl::OUString GetApartment() const;
+
+ ::rtl::OUString GetFullName() const;
+ ::rtl::OUString GetLocale() const;
+
+ // set the address token
+ void SetCompany( const ::rtl::OUString& rNewToken );
+ void SetFirstName( const ::rtl::OUString& rNewToken );
+ void SetLastName( const ::rtl::OUString& rNewToken );
+ void SetID( const ::rtl::OUString& rNewToken );
+ void SetStreet( const ::rtl::OUString& rNewToken );
+ void SetCity( const ::rtl::OUString& rNewToken );
+ void SetState( const ::rtl::OUString& rNewToken );
+ void SetZip( const ::rtl::OUString& rNewToken );
+ void SetCountry( const ::rtl::OUString& rNewToken );
+ void SetPosition( const ::rtl::OUString& rNewToken );
+ void SetTitle( const ::rtl::OUString& rNewToken );
+ void SetTelephoneHome( const ::rtl::OUString& rNewToken );
+ void SetTelephoneWork( const ::rtl::OUString& rNewToken );
+ void SetFax( const ::rtl::OUString& rNewToken );
+ void SetEmail( const ::rtl::OUString& rNewToken );
+ void SetCustomerNumber( const ::rtl::OUString& rNewToken );
+ void SetFathersName( const ::rtl::OUString& rNewToken );
+ void SetApartment( const ::rtl::OUString& rNewToken );
+
+ sal_Bool IsTokenReadonly( USHORT nToken ) const;
+ ::rtl::OUString GetToken(USHORT nToken) const;
+};
+
+#endif // #ifndef INCLUDED_unotools_USEROPTIONS_HXX
diff --git a/unotools/inc/unotools/useroptions_const.hxx b/unotools/inc/unotools/useroptions_const.hxx
new file mode 100644
index 000000000000..34a12f6519bf
--- /dev/null
+++ b/unotools/inc/unotools/useroptions_const.hxx
@@ -0,0 +1,56 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef INCLUDE_CONFIGITEMS_USEROPTIONS_CONST_HXX
+#define INCLUDE_CONFIGITEMS_USEROPTIONS_CONST_HXX
+
+#include <rtl/ustring.hxx>
+
+namespace
+{
+ static const ::rtl::OUString s_sData = ::rtl::OUString::createFromAscii("org.openoffice.UserProfile/Data");
+ static const ::rtl::OUString s_so = ::rtl::OUString::createFromAscii("o"); // USER_OPT_COMPANY
+ static const ::rtl::OUString s_sgivenname = ::rtl::OUString::createFromAscii("givenname"); // USER_OPT_FIRSTNAME
+ static const ::rtl::OUString s_ssn = ::rtl::OUString::createFromAscii("sn"); // USER_OPT_LASTNAME
+ static const ::rtl::OUString s_sinitials = ::rtl::OUString::createFromAscii("initials"); // USER_OPT_ID
+ static const ::rtl::OUString s_sstreet = ::rtl::OUString::createFromAscii("street"); // USER_OPT_STREET
+ static const ::rtl::OUString s_sl = ::rtl::OUString::createFromAscii("l"); // USER_OPT_CITY
+ static const ::rtl::OUString s_sst = ::rtl::OUString::createFromAscii("st"); // USER_OPT_STATE
+ static const ::rtl::OUString s_spostalcode = ::rtl::OUString::createFromAscii("postalcode"); // USER_OPT_ZIP
+ static const ::rtl::OUString s_sc = ::rtl::OUString::createFromAscii("c"); // USER_OPT_COUNTRY
+ static const ::rtl::OUString s_stitle = ::rtl::OUString::createFromAscii("title"); // USER_OPT_TITLE
+ static const ::rtl::OUString s_sposition = ::rtl::OUString::createFromAscii("position"); // USER_OPT_POSITION
+ static const ::rtl::OUString s_shomephone = ::rtl::OUString::createFromAscii("homephone"); // USER_OPT_TELEPHONEHOME
+ static const ::rtl::OUString s_stelephonenumber = ::rtl::OUString::createFromAscii("telephonenumber"); // USER_OPT_TELEPHONEWORK
+ static const ::rtl::OUString s_sfacsimiletelephonenumber = ::rtl::OUString::createFromAscii("facsimiletelephonenumber"); // USER_OPT_FAX
+ static const ::rtl::OUString s_smail = ::rtl::OUString::createFromAscii("mail"); // USER_OPT_EMAIL
+ static const ::rtl::OUString s_scustomernumber = ::rtl::OUString::createFromAscii("customernumber"); // USER_OPT_CUSTOMERNUMBER
+ static const ::rtl::OUString s_sfathersname = ::rtl::OUString::createFromAscii("fathersname"); // USER_OPT_FATHERSNAME
+ static const ::rtl::OUString s_sapartment = ::rtl::OUString::createFromAscii("apartment"); // USER_OPT_APARTMENT
+}
+
+#endif // INCLUDE_CONFIGITEMS_USEROPTIONS_CONST_HXX
diff --git a/unotools/inc/unotools/viewoptions.hxx b/unotools/inc/unotools/viewoptions.hxx
new file mode 100644
index 000000000000..6fa60ea3fb05
--- /dev/null
+++ b/unotools/inc/unotools/viewoptions.hxx
@@ -0,0 +1,353 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef INCLUDED_unotools_VIEWOPTIONS_HXX
+#define INCLUDED_unotools_VIEWOPTIONS_HXX
+
+//_________________________________________________________________________________________________________________
+// includes
+//_________________________________________________________________________________________________________________
+
+#include "unotools/unotoolsdllapi.h"
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/beans/NamedValue.hpp>
+#include <unotools/configmgr.hxx>
+#include <unotools/configitem.hxx>
+#include <sal/types.h>
+#include <osl/mutex.hxx>
+#include <rtl/ustring.hxx>
+#include <unotools/options.hxx>
+
+//_________________________________________________________________________________________________________________
+// forward declarations
+//_________________________________________________________________________________________________________________
+
+class SvtViewOptionsBase_Impl;
+
+//_________________________________________________________________________________________________________________
+// declarations
+//_________________________________________________________________________________________________________________
+
+/*-************************************************************************************************************//**
+ @descr Use these enum values to specify right list in configuration in which your view data are saved.
+*//*-*************************************************************************************************************/
+
+enum EViewType
+{
+ E_DIALOG = 0,
+ E_TABDIALOG = 1,
+ E_TABPAGE = 2,
+ E_WINDOW = 3
+};
+
+/*-************************************************************************************************************//**
+ @short collect informations about view features
+ @descr We support different basetypes of views like dialogs, tab-dialogs, tab-pages and normal windows.
+ You must specify your basetype by using right enum value and must give us a valid name for your
+ subkey in registry! We support some fix features for some bastypes and user data as string for all!
+ see also configuration package "org.openoffice.Office.Views/..." for further informations.
+
+ template of configuration:
+ DialogType
+ /WindowState [string]
+ /UserData [set of any scalar types]
+ TabDialogType
+ /WindowState [string]
+ /UserData [set of any scalar types]
+ /PageID [int]
+ TabPageType
+ /WindowState [string]
+ /UserData [set of any scalar types]
+ WindowType
+ /WindowState [string]
+ /UserData [set of any scalar types]
+ /Visible [boolean]
+
+ structure of configuration:
+
+ org.openoffice.Office.Views [package]
+ /Dialogs [set]
+ /Dialog_FileOpen [DialogType]
+ /Dialog_ImportGraphics [DialogType]
+ ...
+ /Dialog_<YourName> [DialogType]
+
+ /TabDialogs [set]
+ /TabDialog_001 [TabDialogType]
+ /TabDialog_Blubber [TabDialogType]
+ ...
+ /TabDialog_<YourName> [TabDialogType]
+
+ /TabPages [set]
+ /TabPage_XXX [TabPageType]
+ /TabPage_Date [TabPageType]
+ ...
+ /TabPage_<YourName> [TabPageType]
+
+ /Windows [set]
+ /Window_User [WindowType]
+ /Window_Options [WindowType]
+ ...
+ /Window_<YourName> [WindowType]
+
+ @implements -
+ @base -
+
+ @devstatus ready to use
+*//*-*************************************************************************************************************/
+
+class UNOTOOLS_DLLPUBLIC SvtViewOptions: public utl::detail::Options
+{
+ /*
+ #ifdef TF_OLDVIEW
+ public:
+ void GetPosition ( sal_Int32& nX ,
+ sal_Int32& nY ) const;
+ void SetPosition ( sal_Int32 nX ,
+ sal_Int32 nY );
+ void GetSize ( sal_Int32& nWidth ,
+ sal_Int32& nHeight ) const;
+ void SetSize ( sal_Int32 nWidth ,
+ sal_Int32 nHeight );
+ ::rtl::OUString GetUserData ( ) const;
+ void SetUserData ( const ::rtl::OUString& sData );
+ static ::com::sun::star::uno::Sequence< ::rtl::OUString > SeperateUserData( const ::rtl::OUString& sData ,
+ sal_Unicode cSeperator=';' );
+ static ::rtl::OUString GenerateUserData( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& seqData ,
+ sal_Unicode cSeperator=';' );
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > GetAnyData ( ) const;
+ void SetAnyData ( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lData );
+ #endif
+ */
+
+ //-------------------------------------------------------------------------------------------------------------
+ // public methods
+ //-------------------------------------------------------------------------------------------------------------
+
+ public:
+
+ //---------------------------------------------------------------------------------------------------------
+ // constructor / destructor
+ //---------------------------------------------------------------------------------------------------------
+
+ /*-****************************************************************************************************//**
+ @short standard constructor and destructor
+ @descr This will de-/initialize an instance with default values.
+ You must give us the basic type of your view and a name which specify right entry
+ in dynamical configuration list. If entry not exist, we create a new one!
+
+ @seealso enum EViewType
+
+ @param "eType" specify type of your view and is used to use right data container!
+ @param "sViewName" specify the name of your view and is the key name in data list too.
+ @return -
+
+ @onerror An assertion is thrown in debug version. Otherwise we do nothing!
+ *//*-*****************************************************************************************************/
+
+ SvtViewOptions( EViewType eType ,
+ const ::rtl::OUString& sViewName );
+ virtual ~SvtViewOptions();
+
+ /*-****************************************************************************************************//**
+ @short support preload of these config item
+ @descr Sometimes we need preloading of these configuration data without real using of it.
+
+ @seealso -
+
+ @param -
+ @return -
+
+ @onerror -
+ *//*-*****************************************************************************************************/
+
+ static void AcquireOptions();
+ static void ReleaseOptions();
+
+ //---------------------------------------------------------------------------------------------------------
+ // interface
+ //---------------------------------------------------------------------------------------------------------
+
+ /*-****************************************************************************************************//**
+ @short use it to get information about existing entries in configuration
+ @descr The methods to set/get the position or size will create a new entry automaticly if
+ it not already exist and work with default values!
+ If this a problem for you - you MUST call these method before and
+ you must make up your own mind about that.
+
+ @seealso -
+
+ @onerror No error should occure.
+ *//*-*****************************************************************************************************/
+
+ sal_Bool Exists() const;
+
+ /*-****************************************************************************************************//**
+ @short use it to delete an entry of dynamic view set
+ @descr You can use this method to delete anexisting node in configuration.
+ But if you call a Set- or Get- method again on this instance
+ the item is created again! If you do nothing after this call
+ your view will die relay in configuration ...
+
+ @seealso method Exist()
+
+ @return True if delete OK, False otherwise.
+
+ @onerror We return sal_False.
+ *//*-*****************************************************************************************************/
+
+ sal_Bool Delete();
+
+ /*-****************************************************************************************************//**
+ @short use it to set/get the window state of your view
+ @descr These value describe position/size and some other states of a window.
+ Use it with right vcl methods directly. Normaly it's not neccessary to
+ parse given string!
+
+ @seealso vcl methods
+
+ @onerror -
+ *//*-*****************************************************************************************************/
+
+ ::rtl::OUString GetWindowState( ) const;
+ void SetWindowState( const ::rtl::OUString& sState );
+
+ /*-****************************************************************************************************//**
+ @short use it to set/get the page number which was the last active one
+ @descr It's only supported for: - tab-dialogs
+ If you call it for other ones you will get an assertion in debug version.
+ In a product version we do nothing!
+
+ @seealso -
+
+ @onerror An assertion is thrown in debug version. Otherwise we do nothing!
+ *//*-*****************************************************************************************************/
+
+ sal_Int32 GetPageID( ) const;
+ void SetPageID( sal_Int32 nID );
+
+ /*-****************************************************************************************************//**
+ @short use it to set/get the visual state of a window
+ @descr It's only supported for: - windows
+ If you call it for other ones you will get an assertion in debug version.
+ In a product version we do nothing!
+
+ @seealso -
+
+ @onerror An assertion is thrown in debug version. Otherwise we do nothing!
+ *//*-*****************************************************************************************************/
+
+ sal_Bool IsVisible ( ) const;
+ void SetVisible( sal_Bool bState );
+
+ /*-****************************************************************************************************//**
+ @short use it to set/get the extended user data (consisting of a set of named scalar values)
+ @descr It's supported for ALL types!
+ Every view can handle its own user defined data set.
+
+ @seealso -
+
+ @onerror In the non-product version, an assertion is made. In a product version, errors are silently ignored.
+ *//*-*****************************************************************************************************/
+/*
+#ifdef TF_OLDVIEW
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > GetUserData( sal_Bool bMakeItDifferent ) const;
+#else
+*/
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > GetUserData( ) const;
+//#endif
+ void SetUserData( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& lData );
+
+ /*-****************************************************************************************************//**
+ @short use it to set/get ONE special user data item directly
+ @descr Normaly you can work on full user data list by using "Set/GetUserData()".
+ With this function you have an access on special list entries directly without any
+
+ @seealso -
+
+ @onerror In the non-product version, an assertion is made. In a product version, errors are silently ignored.
+ *//*-*****************************************************************************************************/
+
+ ::com::sun::star::uno::Any GetUserItem( const ::rtl::OUString& sName ) const;
+ void SetUserItem( const ::rtl::OUString& sName ,
+ const ::com::sun::star::uno::Any& aValue );
+
+ //-------------------------------------------------------------------------------------------------------------
+ // private methods
+ //-------------------------------------------------------------------------------------------------------------
+
+ private:
+
+ /*-****************************************************************************************************//**
+ @short return a reference to a static mutex
+ @descr These class is threadsafe.
+ We create a static mutex only for one time and use it to protect our refcount and container
+ member!
+
+ @seealso -
+
+ @param -
+ @return A reference to a static mutex member.
+
+ @onerror -
+ *//*-*****************************************************************************************************/
+
+ UNOTOOLS_DLLPRIVATE static ::osl::Mutex& GetOwnStaticMutex();
+
+ //-------------------------------------------------------------------------------------------------------------
+ // private member
+ //-------------------------------------------------------------------------------------------------------------
+
+ private:
+
+ /// specify which list of views in configuration is used! This can't be a static value!!!
+ /// ... because we need this value to work with right static data container.
+ EViewType m_eViewType ;
+ ::rtl::OUString m_sViewName ;
+
+ /// - impl. data container as dynamic pointer for smaller memory requirements!
+ /// - internal ref count mechanism
+
+ /*Attention
+
+ Don't initialize these static member in these header!
+ a) Double defined symbols will be detected ...
+ b) and unresolved externals exist at linking time.
+ Do it in your source only.
+ */
+
+ static SvtViewOptionsBase_Impl* m_pDataContainer_Dialogs ; /// hold data for all dialogs
+ static sal_Int32 m_nRefCount_Dialogs ;
+ static SvtViewOptionsBase_Impl* m_pDataContainer_TabDialogs ; /// hold data for all tab-dialogs
+ static sal_Int32 m_nRefCount_TabDialogs ;
+ static SvtViewOptionsBase_Impl* m_pDataContainer_TabPages ; /// hold data for all tab-pages
+ static sal_Int32 m_nRefCount_TabPages ;
+ static SvtViewOptionsBase_Impl* m_pDataContainer_Windows ; /// hold data for all windows
+ static sal_Int32 m_nRefCount_Windows ;
+
+}; // class SvtViewOptions
+
+#endif // #ifndef INCLUDED_unotools_VIEWOPTIONS_HXX
diff --git a/unotools/inc/unotools/workingsetoptions.hxx b/unotools/inc/unotools/workingsetoptions.hxx
new file mode 100644
index 000000000000..04a4a0bea6cb
--- /dev/null
+++ b/unotools/inc/unotools/workingsetoptions.hxx
@@ -0,0 +1,156 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef INCLUDED_unotools_WORKINGSETOPTIONS_HXX
+#define INCLUDED_unotools_WORKINGSETOPTIONS_HXX
+
+//_________________________________________________________________________________________________________________
+// includes
+//_________________________________________________________________________________________________________________
+
+#include <sal/types.h>
+#include <osl/mutex.hxx>
+#include <com/sun/star/uno/Sequence.h>
+#include <rtl/ustring.hxx>
+#include <unotools/options.hxx>
+
+//_________________________________________________________________________________________________________________
+// forward declarations
+//_________________________________________________________________________________________________________________
+
+/*-************************************************************************************************************//**
+ @short forward declaration to our private date container implementation
+ @descr We use these class as internal member to support small memory requirements.
+ You can create the container if it is neccessary. The class which use these mechanism
+ is faster and smaller then a complete implementation!
+*//*-*************************************************************************************************************/
+
+class SvtWorkingSetOptions_Impl;
+
+//_________________________________________________________________________________________________________________
+// declarations
+//_________________________________________________________________________________________________________________
+
+/*-************************************************************************************************************//**
+ @short collect informations about security features
+ @descr -
+
+ @implements -
+ @base -
+
+ @devstatus ready to use
+*//*-*************************************************************************************************************/
+
+class SvtWorkingSetOptions: public utl::detail::Options
+{
+ //-------------------------------------------------------------------------------------------------------------
+ // public methods
+ //-------------------------------------------------------------------------------------------------------------
+
+ public:
+
+ //---------------------------------------------------------------------------------------------------------
+ // constructor / destructor
+ //---------------------------------------------------------------------------------------------------------
+
+ /*-****************************************************************************************************//**
+ @short standard constructor and destructor
+ @descr This will initialize an instance with default values.
+ We implement these class with a refcount mechanism! Every instance of this class increase it
+ at create and decrease it at delete time - but all instances use the same data container!
+ He is implemented as a static member ...
+
+ @seealso member m_nRefCount
+ @seealso member m_pDataContainer
+
+ @param -
+ @return -
+
+ @onerror -
+ *//*-*****************************************************************************************************/
+
+ SvtWorkingSetOptions();
+ virtual ~SvtWorkingSetOptions();
+
+ //---------------------------------------------------------------------------------------------------------
+ // interface
+ //---------------------------------------------------------------------------------------------------------
+
+ /*-****************************************************************************************************//**
+ @short interface methods to get and set value of config key "org.openoffice.Office.Common/Security/Scripting/SecureURL"
+ @descr These value defines the editing view for documents and windows, which have to be restored
+ when restarting StarOffice. The list gets filled, if Save/WorkingSet = true.
+
+ @seealso -
+
+ @param "seqWindowList", new values to set it in configuration.
+ @return The values which represent current state of internal variable.
+
+ @onerror No error should occurre!
+ *//*-*****************************************************************************************************/
+
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > GetWindowList( ) const ;
+ void SetWindowList( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& seqWindowList ) ;
+
+ //-------------------------------------------------------------------------------------------------------------
+ // private methods
+ //-------------------------------------------------------------------------------------------------------------
+
+ /*-****************************************************************************************************//**
+ @short return a reference to a static mutex
+ @descr These class use his own static mutex to be threadsafe.
+ We create a static mutex only for one ime and use at different times.
+
+ @seealso -
+
+ @param -
+ @return A reference to a static mutex member.
+
+ @onerror -
+ *//*-*****************************************************************************************************/
+
+ static ::osl::Mutex& GetOwnStaticMutex();
+
+ //-------------------------------------------------------------------------------------------------------------
+ // private member
+ //-------------------------------------------------------------------------------------------------------------
+
+ private:
+
+ /*Attention
+
+ Don't initialize these static member in these header!
+ a) Double dfined symbols will be detected ...
+ b) and unresolved externals exist at linking time.
+ Do it in your source only.
+ */
+
+ static SvtWorkingSetOptions_Impl* m_pDataContainer ; /// impl. data container as dynamic pointer for smaller memory requirements!
+ static sal_Int32 m_nRefCount ; /// internal ref count mechanism
+
+}; // class SvtWorkingSetOptions
+
+#endif // #ifndef INCLUDED_unotools_WORKINGSETOPTIONS_HXX
diff --git a/unotools/inc/unotools/xmlaccelcfg.hxx b/unotools/inc/unotools/xmlaccelcfg.hxx
new file mode 100644
index 000000000000..db561660d3c2
--- /dev/null
+++ b/unotools/inc/unotools/xmlaccelcfg.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 INCLUDED_unotools_XMLACCELCFG_HXX
+#define INCLUDED_unotools_XMLACCELCFG_HXX
+
+#ifndef __COM_SUN_STAR_XML_SAX_XDOCUMENTHANDLER_HPP_
+#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#endif
+#include <cppuhelper/weak.hxx>
+
+#include <unotools/accelcfg.hxx>
+
+class OReadAccelatorDocumentHandler : public ::com::sun::star::xml::sax::XDocumentHandler,
+ public ::cppu::OWeakObject
+{
+ public:
+ OReadAccelatorDocumentHandler( SvtAcceleratorItemList& aNewAcceleratorItemList ) :
+ m_nElementDepth( 0 ),
+ m_bAcceleratorMode( sal_False ),
+ m_bItemCloseExpected( sal_False ),
+ m_xLocator( 0 ),
+ m_aReadAcceleratorList( aNewAcceleratorItemList ) {}
+ virtual ~OReadAccelatorDocumentHandler() {}
+
+ // XInterface
+ virtual void SAL_CALL acquire() throw()
+ { OWeakObject::acquire(); }
+ virtual void SAL_CALL release() throw()
+ { OWeakObject::release(); }
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
+ const ::com::sun::star::uno::Type & rType ) throw( ::com::sun::star::uno::RuntimeException );
+
+ // XDocumentHandler
+ virtual void SAL_CALL startDocument(void)
+ throw ( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL endDocument(void)
+ throw ( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL startElement(
+ const ::rtl::OUString& aName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > &xAttribs )
+ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL endElement(const ::rtl::OUString& aName) throw
+ ( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL characters(const ::rtl::OUString& aChars)
+ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL ignorableWhitespace(const ::rtl::OUString& aWhitespaces)
+ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL processingInstruction( const ::rtl::OUString& aTarget, const ::rtl::OUString& aData )
+ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL setDocumentLocator(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator > &xLocator)
+ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
+
+ private:
+ ::rtl::OUString getErrorLineString();
+
+ int m_nElementDepth;
+ sal_Bool m_bAcceleratorMode;
+ sal_Bool m_bItemCloseExpected;
+ ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator > m_xLocator;
+ SvtAcceleratorItemList& m_aReadAcceleratorList;
+};
+
+
+class OWriteAccelatorDocumentHandler
+{
+ public:
+ OWriteAccelatorDocumentHandler(
+ const SvtAcceleratorItemList& aWriteAcceleratorList,
+ ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > );
+ virtual ~OWriteAccelatorDocumentHandler();
+
+ void WriteAcceleratorDocument() throw ( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
+
+ private:
+ void WriteAcceleratorItem( const SvtAcceleratorConfigItem& aAcceleratorItem ) throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > m_xWriteDocumentHandler;
+ ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > m_xEmptyList;
+ ::rtl::OUString m_aAttributeType;
+ const SvtAcceleratorItemList& m_aWriteAcceleratorList;
+};
+
+#endif // INCLUDED_unotools_XMLACCELCFG_HXX