summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schlüns <as@openoffice.org>2000-11-23 13:52:13 +0000
committerAndreas Schlüns <as@openoffice.org>2000-11-23 13:52:13 +0000
commit9978d600411aa7a3506f72a1cbaefe2ee2983208 (patch)
tree2fa3862cc58f43597615ce042d97e1656e125cbe
parentcd8c17f426f42fa8081ebcf382159c96b08d5d55 (diff)
#79040# implement new filter detection - use TF_FILTER to enable
-rw-r--r--framework/inc/classes/filtercache.hxx560
-rw-r--r--framework/inc/services/frame.hxx5
-rw-r--r--framework/source/classes/makefile.mk8
-rw-r--r--framework/source/register/makefile.mk7
-rw-r--r--framework/source/register/registerservices.cxx75
-rw-r--r--framework/source/services/desktop.cxx2129
-rw-r--r--framework/source/services/frame.cxx158
-rw-r--r--framework/source/services/makefile.mk25
-rw-r--r--framework/source/services/mediatypedetectionhelper.cxx226
-rw-r--r--framework/source/services/urltransformer.cxx415
-rw-r--r--framework/test/makefile.mk47
-rw-r--r--framework/test/test.cxx281
-rw-r--r--framework/util/makefile.mk12
13 files changed, 3821 insertions, 127 deletions
diff --git a/framework/inc/classes/filtercache.hxx b/framework/inc/classes/filtercache.hxx
new file mode 100644
index 000000000000..6b0f87522503
--- /dev/null
+++ b/framework/inc/classes/filtercache.hxx
@@ -0,0 +1,560 @@
+/*************************************************************************
+ *
+ * $RCSfile: filtercache.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: as $ $Date: 2000-11-23 14:52:03 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef __FRAMEWORK_CLASSES_FILTERCACHE_HXX_
+#define __FRAMEWORK_CLASSES_FILTERCACHE_HXX_
+
+//_________________________________________________________________________________________________________________
+// my own includes
+//_________________________________________________________________________________________________________________
+
+#ifndef __FRAMEWORK_MACROS_DEBUG_HXX_
+#include <macros/debug.hxx>
+#endif
+
+//_________________________________________________________________________________________________________________
+// interface includes
+//_________________________________________________________________________________________________________________
+
+//_________________________________________________________________________________________________________________
+// other includes
+//_________________________________________________________________________________________________________________
+
+#ifndef _COM_SUN_STAR_UNO_REFERENCE_H_
+#include <com/sun/star/uno/Reference.h>
+#endif
+
+#ifndef _COM_SUN_STAR_UNO_SEQUENCE_H_
+#include <com/sun/star/uno/Sequence.h>
+#endif
+
+#ifndef _COM_SUN_STAR_REGISTRY_XREGISTRYKEY_HPP_
+#include <com/sun/star/registry/XRegistryKey.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_
+#include <com/sun/star/beans/PropertyValue.hpp>
+#endif
+
+#ifndef _RTL_USTRING_
+#include <rtl/ustring>
+#endif
+
+#ifndef _OSL_MUTEX_HXX_
+#include <osl/mutex.hxx>
+#endif
+
+#ifndef __SGI_STL_HASH_MAP
+#include <stl/hash_map>
+#endif
+
+#ifndef __SGI_STL_VECTOR
+#include <stl/vector>
+#endif
+
+//_________________________________________________________________________________________________________________
+// namespace
+//_________________________________________________________________________________________________________________
+
+namespace framework{
+
+#define EXCEPTION ::com::sun::star::uno::Exception
+#define MUTEX ::osl::Mutex
+#define OUSTRING ::rtl::OUString
+#define REFERENCE ::com::sun::star::uno::Reference
+#define SEQUENCE ::com::sun::star::uno::Sequence
+#define HASH_MAP ::std::hash_map
+#define VECTOR ::std::vector
+#define XREGISTRYKEY ::com::sun::star::registry::XRegistryKey
+#define PROPERTYVALUE ::com::sun::star::beans::PropertyValue
+
+//_________________________________________________________________________________________________________________
+// exported const
+//_________________________________________________________________________________________________________________
+
+//_________________________________________________________________________________________________________________
+// exported definitions
+//_________________________________________________________________________________________________________________
+
+// Hash code function for using in all hash maps of follow implementation.
+struct TStringHashFunction
+{
+ size_t operator()(const OUSTRING& sString) const
+ {
+ return sString.hashCode();
+ }
+};
+
+// A generic string list to hold different string informations with a fast access to it.
+typedef VECTOR< OUSTRING > TStringList;
+
+// These struct define a type, which present the type of a file.
+// He is used for easy filter detection without file stream detection!
+// The internal name is the keyname of an item with these structure in our hash map or our configuration set!
+struct TType
+{
+ OUSTRING sUIName ; // empty = ""
+ OUSTRING sMediaType ; // empty = ""
+ OUSTRING sClipboardFormat ; // empty = ""
+ TStringList lURLPattern ; // empty = {}
+ TStringList lExtensions ; // empty = {}
+ sal_Int32 nDocumentIconID ; // empty = 0
+};
+
+// These struct describe a filter wich is registered for one type.
+// He hold information about services which present the document himself (like a item) and a filter service which
+// filter a file in these document.
+// The internal name is the keyname of an item with these structure in our hash map or our configuration set!
+struct TFilter
+{
+ OUSTRING sType ; // empty not allowed!
+ OUSTRING sUIName ; // empty = ""
+ OUSTRING sDocumentService ; // empty = ""
+ OUSTRING sFilterService ; // empty = ""
+ sal_Int32 nFlags ; // empty = 0
+ TStringList lUserData ; // empty = {}
+ sal_Int32 nFileFormatVersion ; // empty = 0 ... should be moved in UserData ...!?
+ OUSTRING sTemplateName ; // empty = "" ... should be moved in UserData ...!?
+};
+
+// Programmer can register his own services for an content detection of different types.
+// The implementation or service name of these is the keyname of an item with these structure
+// in our hash map or our configuration set!
+struct TDetector
+{
+ TStringList lTypes ; // empty not allowed! min=1 item!
+};
+
+// Programmer can register his own services for loading documents in a frame.
+// The implementation or service name of these is the keyname of an item with these structure
+// in our hash map or our configuration set!
+struct TLoader
+{
+ OUSTRING sUIName ; // empty = ""
+ TStringList lTypes ; // empty not allowed! min=1 item!
+};
+
+// We need different hash maps for different tables of our configuration management.
+typedef HASH_MAP< OUSTRING , // Key name is the internal name!
+ TType ,
+ TStringHashFunction ,
+ ::std::equal_to< OUSTRING > > TTypeHash;
+
+typedef HASH_MAP< OUSTRING , // Key name is the internal name!
+ TFilter ,
+ TStringHashFunction ,
+ ::std::equal_to< OUSTRING > > TFilterHash;
+
+typedef HASH_MAP< OUSTRING , // Key name is the service or implementation name!
+ TDetector ,
+ TStringHashFunction ,
+ ::std::equal_to< OUSTRING > > TDetectorHash;
+
+typedef HASH_MAP< OUSTRING , // Key name is the service or implementation name!
+ TLoader ,
+ TStringHashFunction ,
+ ::std::equal_to< OUSTRING > > TLoaderHash;
+
+// Use these hash to implement different table which assign types to frame loader or detect services.
+// The normaly used TLoaderHash or TDetectorHash structures assign loader/detectors to types!
+// It's an optimism!
+typedef HASH_MAP< OUSTRING ,
+ TStringList ,
+ TStringHashFunction ,
+ ::std::equal_to< OUSTRING > > TPerformanceHash;
+
+// Defines "pointers" to items of our hash maps.
+typedef TStringList::const_iterator TConstStringIterator ;
+typedef TTypeHash::const_iterator TConstTypeIterator ;
+typedef TFilterHash::const_iterator TConstFilterIterator ;
+typedef TDetectorHash::const_iterator TConstDetectorIterator ;
+typedef TLoaderHash::const_iterator TConstLoaderIterator ;
+typedef TPerformanceHash::const_iterator TConstPerformanceIterator ;
+
+/*-************************************************************************************************************//**
+ @short cache for all filter and type information
+ @descr Fframeloader- and filterfactory need some informations about our current registered filters and types.
+ These keys are not changed during runtime (I hope it ...). For better performance its neccessary to
+ cache all needed values.
+
+ @implements -
+ @base -
+
+ @devstatus ready to use
+*//*-*************************************************************************************************************/
+
+class FilterCache
+{
+ //-------------------------------------------------------------------------------------------------------------
+ // public methods
+ //-------------------------------------------------------------------------------------------------------------
+
+ public:
+
+ //---------------------------------------------------------------------------------------------------------
+ // constructor / destructor
+ //---------------------------------------------------------------------------------------------------------
+
+ /*-****************************************************************************************************//**
+ @short standard constructor
+ @descr This will initialize the cache automaticly!
+
+ @seealso -
+
+ @param -
+ @return -
+
+ @onerror An assertion is thrown and the cache will be empty!
+ *//*-*****************************************************************************************************/
+
+ FilterCache();
+
+ /*-****************************************************************************************************//**
+ @short standard destructor to delete instance
+ @descr This will clear the cache.
+
+ @seealso -
+
+ @param -
+ @return -
+
+ @onerror -
+ *//*-*****************************************************************************************************/
+
+ virtual ~FilterCache();
+
+ /*-****************************************************************************************************//**
+ @short get the current state of the cache
+ @descr Call this method to get information about the state of the current cache.
+
+ @seealso -
+
+ @param -
+ @return sal_True ,if cache is initialzed and work correct
+ @return sal_False ,otherwise
+
+ @onerror The return value is sal_False.
+ *//*-*****************************************************************************************************/
+
+ sal_Bool isValid() const;
+
+ /*-****************************************************************************************************//**
+ @short search routines to find items which match given parameter
+ @descr Mostly we search for a type first and get all informations about filter, detector and loader
+ services from the other configuration tables which are registered for this type.
+ These operations support a FindFirst/Next mechanism.
+ If you call searchFirst...() we initialize "rStartEntry" with a right value and search for
+ the first entry. If these not return NULL you can work with these value.
+ If found value not the right one - you can use "rStartEntry" for search...() methods again.
+ DONT'T CHANGE THE VALUE OF "rStartEntry" between two search calls!
+
+ @attention returned type name is an internal name
+ returned filter name is an internal name
+ returned loader name is an implementation name of a service
+ returned detector name is an implementation name of a service
+
+ @seealso -
+
+ @param -
+ @return A pointer to valid information if search was ok, NULL otherwise.
+
+ @onerror NULL is returned.
+ *//*-*****************************************************************************************************/
+
+ const OUSTRING* searchFirstType ( const OUSTRING* pURL ,
+ const OUSTRING* pMediaType ,
+ const OUSTRING* pClipboardFormat ,
+ TConstTypeIterator& rStartEntry ) const;
+
+ const OUSTRING* searchType ( const OUSTRING* pURL ,
+ const OUSTRING* pMediaType ,
+ const OUSTRING* pClipboardFormat ,
+ TConstTypeIterator& rFollowEntry ) const;
+
+ const OUSTRING* searchFirstFilterForType ( const OUSTRING& sInternalTypeName , TConstStringIterator& rStartEntry ) const ;
+ const OUSTRING* searchFirstDetectorForType ( const OUSTRING& sInternalTypeName , TConstStringIterator& rStartEntry ) ;
+ const OUSTRING* searchFirstLoaderForType ( const OUSTRING& sInternalTypeName , TConstStringIterator& rStartEntry ) ;
+
+ const OUSTRING* searchFilterForType ( const OUSTRING& sInternalTypeName , TConstStringIterator& rFollowEntry) const ;
+ const OUSTRING* searchDetectorForType ( const OUSTRING& sInternalTypeName , TConstStringIterator& rFollowEntry) ;
+ const OUSTRING* searchLoaderForType ( const OUSTRING& sInternalTypeName , TConstStringIterator& rFollowEntry) ;
+
+ /*-****************************************************************************************************//**
+ @short get all properties of a cache entry by given name
+ @descr If you need additional informations about our internal cache values
+ you can use these methods to get a list of all cached config values
+ and subkeys of specified entry.
+
+ @seealso -
+
+ @param "sName", name of suspected entry in cache
+ @return A structure with valid information if item exists, an null pointer otherwise!
+
+ @onerror A null pointer is returned.
+ *//*-*****************************************************************************************************/
+
+ const SEQUENCE< OUSTRING > getAllTypeNames () const;
+ const SEQUENCE< OUSTRING > getAllFilterNames () const;
+ const SEQUENCE< OUSTRING > getAllDetectorNames () const;
+ const SEQUENCE< OUSTRING > getAllLoaderNames () const;
+
+ const TType* getTypeByName ( const OUSTRING& sName ) const;
+ const TFilter* getFilterByName ( const OUSTRING& sName ) const;
+ const TDetector* getDetectorByName ( const OUSTRING& sName ) const;
+ const TLoader* getLoaderByName ( const OUSTRING& sName ) const;
+
+ sal_Bool existsType ( const OUSTRING& sName ) const;
+ sal_Bool existsFilter ( const OUSTRING& sName ) const;
+ sal_Bool existsDetector ( const OUSTRING& sName ) const;
+ sal_Bool existsLoader ( const OUSTRING& sName ) const;
+
+ /*-****************************************************************************************************//**
+ @short convert between internal and external structures
+ @descr We use some vector or self defined structures internal - but get sequences from configuration or must
+ return uno compatible values.
+ Thats the reason for these convert methods.
+
+ @seealso -
+
+ @param -
+ @return -
+
+ @onerror No error should occure.
+ *//*-*****************************************************************************************************/
+
+ static void convertStringSequenceToVector ( const SEQUENCE< OUSTRING >& seqSource , TStringList& rDestination );
+ static void convertStringVectorToSequence ( const TStringList& rSource , SEQUENCE< OUSTRING >& seqDestination );
+
+ static void convertTTypeToPropertySequence ( const TType& rSource, SEQUENCE< PROPERTYVALUE >& seqDestination );
+ static void convertTFilterToPropertySequence ( const TFilter& rSource, SEQUENCE< PROPERTYVALUE >& seqDestination );
+ static void convertTLoaderToPropertySequence ( const TLoader& rSource, SEQUENCE< PROPERTYVALUE >& seqDestination );
+ static void convertTDetectorToPropertySequence ( const TDetector& rSource, SEQUENCE< PROPERTYVALUE >& seqDestination );
+
+ //-------------------------------------------------------------------------------------------------------------
+ // protected methods
+ //-------------------------------------------------------------------------------------------------------------
+
+ protected:
+
+ //-------------------------------------------------------------------------------------------------------------
+ // private methods
+ //-------------------------------------------------------------------------------------------------------------
+
+ private:
+
+ /*-****************************************************************************************************//**
+ @short create a static global mutex to protect our static member!
+ @descr For static member we need normal the Mutex::getGlobalMutex() ...
+ but we use it only one time and create our own static global mutex.
+ These is used to make these class threadsafe.
+
+ @seealso -
+
+ @param -
+ @return A reference to created static mutex.
+
+ @onerror No error should occure.
+ *//*-*****************************************************************************************************/
+
+ static MUTEX& impl_getOwnGlobalMutex();
+
+ /*-****************************************************************************************************//**
+ @short extract extension from given URL
+ @descr For our type detection we must search for matching registered extensions with given URL.
+
+ @seealso search methods
+
+ @param "sURL", URL to extract extension
+ @return The extension or an empty string if URL has no one.
+
+ @onerror No error should occure.
+ *//*-*****************************************************************************************************/
+
+ OUSTRING impl_extractURLExtension( const OUSTRING& sURL ) const;
+
+ /*-****************************************************************************************************//**
+ @short fill our cache with values from configuration
+ @descr We cache the complete type and filter information from our configuration as readonly values.
+ These helper method read the values and fill our static member with it.
+ The different fill-methods are specialized for the different lists of right configuration package!
+
+ @seealso structure of package "org.openoffice.Office.TypeDetection.xml"
+
+ @param "xRootKey" , start point if actual list
+ @param "rCache" , reference to our static member to fill it values
+ @param "rFastCache", we hold some tables for faster search - fill it too!
+ @return -
+
+ @onerror If an configuration item couldn't read we ignore it and warn programmer with an assertion.
+ *//*-*****************************************************************************************************/
+
+ void impl_loadConfiguration ( );
+ void impl_fillTypeCache ( const REFERENCE< XREGISTRYKEY >& xRootKey, TTypeHash& rCache );
+ void impl_fillFilterCache ( const REFERENCE< XREGISTRYKEY >& xRootKey, TFilterHash& rCache , TPerformanceHash& rFastCache );
+ void impl_fillDetectorCache ( const REFERENCE< XREGISTRYKEY >& xRootKey, TDetectorHash& rCache , TPerformanceHash& rFastCache );
+ void impl_fillLoaderCache ( const REFERENCE< XREGISTRYKEY >& xRootKey, TLoaderHash& rCache , TPerformanceHash& rFastCache );
+
+ //-------------------------------------------------------------------------------------------------------------
+ // debug methods
+ // (should be private everyway!)
+ //-------------------------------------------------------------------------------------------------------------
+
+ /*-****************************************************************************************************//**
+ @short debug-method to check incoming parameter of some other mehods of this class
+ @descr The following methods are used to check parameters for other methods
+ of this class. The return value is used directly for an ASSERT(...).
+
+ @seealso ASSERT in implementation!
+
+ @param references to checking variables
+ @return sal_False ,on invalid parameter
+ @return sal_True ,otherwise
+
+ @onerror -
+ *//*-*****************************************************************************************************/
+
+ #ifdef ENABLE_ASSERTIONS
+
+ private:
+
+ static sal_Bool impldbg_checkParameter_searchType ( const OUSTRING* pURL ,
+ const OUSTRING* pMediaType ,
+ const OUSTRING* pClipboardFormat ,
+ TConstTypeIterator& rStartEntry );
+ static sal_Bool impldbg_checkParameter_searchFilterForType ( const OUSTRING& sInternalTypeName ,
+ TConstStringIterator& rStartEntry );
+ static sal_Bool impldbg_checkParameter_searchDetectorForType ( const OUSTRING& sInternalTypeName ,
+ TConstStringIterator& rStartEntry );
+ static sal_Bool impldbg_checkParameter_searchLoaderForType ( const OUSTRING& sInternalTypeName ,
+ TConstStringIterator& rStartEntry );
+ static sal_Bool impldbg_checkParameter_getTypeByName ( const OUSTRING& sName );
+ static sal_Bool impldbg_checkParameter_getFilterByName ( const OUSTRING& sName );
+ static sal_Bool impldbg_checkParameter_getDetectorByName ( const OUSTRING& sName );
+ static sal_Bool impldbg_checkParameter_getLoaderByName ( const OUSTRING& sName );
+ static sal_Bool impldbg_checkParameter_existsType ( const OUSTRING& sName );
+ static sal_Bool impldbg_checkParameter_existsFilter ( const OUSTRING& sName );
+ static sal_Bool impldbg_checkParameter_existsDetector ( const OUSTRING& sName );
+ static sal_Bool impldbg_checkParameter_existsLoader ( const OUSTRING& sName );
+ static sal_Bool impldbg_checkParameter_convertStringSequenceToVector ( const SEQUENCE< OUSTRING >& seqSource ,
+ TStringList& rDestination );
+ static sal_Bool impldbg_checkParameter_convertStringVectorToSequence ( const TStringList& rSource ,
+ SEQUENCE< OUSTRING >& seqDestination );
+ static sal_Bool impldbg_checkParameter_convertTTypeToPropertySequence ( const TType& rSource ,
+ SEQUENCE< PROPERTYVALUE >& seqDestination );
+ static sal_Bool impldbg_checkParameter_convertTFilterToPropertySequence ( const TFilter& rSource ,
+ SEQUENCE< PROPERTYVALUE >& seqDestination );
+ static sal_Bool impldbg_checkParameter_convertTLoaderToPropertySequence ( const TLoader& rSource ,
+ SEQUENCE< PROPERTYVALUE >& seqDestination );
+ static sal_Bool impldbg_checkParameter_convertTDetectorToPropertySequence ( const TDetector& rSource ,
+ SEQUENCE< PROPERTYVALUE >& seqDestination );
+
+ #endif // #ifdef ENABLE_ASSERTIONS
+
+ /*-****************************************************************************************************//**
+ @short debug method to log current cache content
+ @descr The stl vector is not suitable enough to show informations about his current content.
+ To get a overview you can call this special debug method. It will log all important informations
+ to a file on disk.
+
+ @seealso -
+
+ @param -
+ @return -
+
+ @onerror -
+ *//*-*****************************************************************************************************/
+
+// #ifdef ENABLE_FILTERCACHEDEBUG
+
+ private:
+
+ void impldbg_showCacheContent();
+
+// #endif // #ifdef ENABLE_FILTERCACHEDEBUG
+
+ //-------------------------------------------------------------------------------------------------------------
+ // private variables
+ // (should be private everyway!)
+ //-------------------------------------------------------------------------------------------------------------
+
+ private:
+
+ static TTypeHash* m_pTypeCache ;
+ static TFilterHash* m_pFilterCache ;
+ static TDetectorHash* m_pDetectorCache ;
+ static TLoaderHash* m_pLoaderCache ;
+ static TPerformanceHash* m_pFastFilterCache ;
+ static TPerformanceHash* m_pFastDetectorCache;
+ static TPerformanceHash* m_pFastLoaderCache ;
+ static sal_Int32 m_nRefCount ;
+ static OUSTRING m_sDefaultDetector ;
+ static OUSTRING m_sGenericLoader ;
+ static TDetector m_aDefaultDetector ;
+ static TLoader m_aGenericLoader ;
+
+ sal_Bool m_bDefaultDetectorAlreadyReturned ;
+ sal_Bool m_bGenericLoaderAlreadyReturned ;
+
+}; // class FilterCache
+
+} // namespace framework
+
+#endif // #ifndef __FRAMEWORK_CLASSES_FILTERCACHE_HXX_
diff --git a/framework/inc/services/frame.hxx b/framework/inc/services/frame.hxx
index c113531009fc..f94d5d804fcd 100644
--- a/framework/inc/services/frame.hxx
+++ b/framework/inc/services/frame.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: frame.hxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: as $ $Date: 2000-10-23 13:56:42 $
+ * last change: $Author: as $ $Date: 2000-11-23 14:52:05 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -226,7 +226,6 @@ namespace framework{
#define XFOCUSLISTENER ::com::sun::star::awt::XFocusListener
#define XFRAME ::com::sun::star::frame::XFrame
#define XFRAMEACTIONLISTENER ::com::sun::star::frame::XFrameActionListener
-#define XFRAMELOADER ::com::sun::star::frame::XFrameLoader
#define XFRAMES ::com::sun::star::frame::XFrames
#define XFRAMESSUPPLIER ::com::sun::star::frame::XFramesSupplier
#define XMULTISERVICEFACTORY ::com::sun::star::lang::XMultiServiceFactory
diff --git a/framework/source/classes/makefile.mk b/framework/source/classes/makefile.mk
index 793a6b6317fa..7380743277a9 100644
--- a/framework/source/classes/makefile.mk
+++ b/framework/source/classes/makefile.mk
@@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.3 $
+# $Revision: 1.4 $
#
-# last change: $Author: as $ $Date: 2000-10-23 13:56:43 $
+# last change: $Author: as $ $Date: 2000-11-23 14:52:07 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
@@ -77,12 +77,14 @@ BOOTSTRAP_SERVICE= FALSE
# --- Generate -----------------------------------------------------
SLOFILES= $(SLO)$/servicemanager.obj \
+ $(SLO)$/filtercache.obj \
$(SLO)$/registrycache.obj \
$(SLO)$/wildcard.obj \
$(SLO)$/framecontainer.obj \
$(SLO)$/taskcreator.obj \
$(SLO)$/asyncquit.obj \
- $(SLO)$/targetfinder.obj
+ $(SLO)$/targetfinder.obj \
+ $(SLO)$/argumentanalyzer.obj
# --- Targets ------------------------------------------------------
diff --git a/framework/source/register/makefile.mk b/framework/source/register/makefile.mk
index a6af168fb720..8105ba96643a 100644
--- a/framework/source/register/makefile.mk
+++ b/framework/source/register/makefile.mk
@@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.1.1.1 $
+# $Revision: 1.2 $
#
-# last change: $Author: hr $ $Date: 2000-09-18 16:29:24 $
+# last change: $Author: as $ $Date: 2000-11-23 14:52:09 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
@@ -78,8 +78,7 @@ LIBTARGET= NO
# --- Generate -----------------------------------------------------
SLOFILES= \
- $(SLO)$/registerservices.obj \
- $(SLO)$/registerbaehservices.obj
+ $(SLO)$/registerservices.obj
# --- Targets ------------------------------------------------------
diff --git a/framework/source/register/registerservices.cxx b/framework/source/register/registerservices.cxx
index 837530e6ef4d..2f731c6b5177 100644
--- a/framework/source/register/registerservices.cxx
+++ b/framework/source/register/registerservices.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: registerservices.cxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: hr $ $Date: 2000-09-18 16:29:24 $
+ * last change: $Author: as $ $Date: 2000-11-23 14:52:09 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -58,7 +58,6 @@
*
*
************************************************************************/
-
//_________________________________________________________________________________________________________________
// includes of my own project
//_________________________________________________________________________________________________________________
@@ -92,6 +91,22 @@
)
=================================================================================================================*/
+#ifndef __FRAMEWORK_BAEHSERVICES_URLTRANSFORMER_HXX_
+#include <baeh_services/urltransformer.hxx>
+#endif
+
+#ifndef __FRAMEWORK_BAEHSERVICES_PLUGINFRAME_HXX_
+#include <baeh_services/pluginframe.hxx>
+#endif
+
+#ifndef __FRAMEWORK_BAEHSERVICES_DESKTOP_HXX_
+#include <baeh_services/desktop.hxx>
+#endif
+
+#ifndef __FRAMEWORK_BAEHSERVICES_MEDIATYPEDETECTIONHELPER_HXX_
+#include <baeh_services/mediatypedetectionhelper.hxx>
+#endif
+
#ifndef __FRAMEWORK_SERVICES_TASK_HXX_
#include <services/task.hxx>
#endif
@@ -104,14 +119,56 @@
#include <services/frameloaderfactory.hxx>
#endif
+#if TF_FILTER//MUSTFILTER
+ #ifndef __FRAMEWORK_SERVICES_FILTERFACTORY_HXX_
+ #include <services/filterfactory.hxx>
+ #endif
+
+ #ifndef __FRAMEWORK_SERVICES_TYPEDETECTION_HXX_
+ #include <services/typedetection.hxx>
+ #endif
+#endif//MUSTFILTER
+
COMPONENTGETIMPLEMENTATIONENVIRONMENT
-COMPONENTWRITEINFO ( COMPONENTINFO( ::framework::Task )
- COMPONENTINFO( ::framework::Frame )
- COMPONENTINFO( ::framework::FrameLoaderFactory )
+#if TF_FILTER//MUSTFILTER
+COMPONENTWRITEINFO ( COMPONENTINFO( ::framework::URLTransformer )
+ COMPONENTINFO( ::framework::PlugInFrame )
+ COMPONENTINFO( ::framework::Desktop )
+ COMPONENTINFO( ::framework::MediaTypeDetectionHelper )
+ COMPONENTINFO( ::framework::Task )
+ COMPONENTINFO( ::framework::Frame )
+ COMPONENTINFO( ::framework::FrameLoaderFactory )
+ COMPONENTINFO( ::framework::FilterFactory )
+ COMPONENTINFO( ::framework::TypeDetection )
+ )
+
+COMPONENTGETFACTORY ( IFFACTORY( ::framework::URLTransformer ) else
+ IFFACTORY( ::framework::PlugInFrame ) else
+ IFFACTORY( ::framework::Desktop ) else
+ IFFACTORY( ::framework::MediaTypeDetectionHelper ) else
+ IFFACTORY( ::framework::Task ) else
+ IFFACTORY( ::framework::Frame ) else
+ IFFACTORY( ::framework::FrameLoaderFactory ) else
+ IFFACTORY( ::framework::FilterFactory ) else
+ IFFACTORY( ::framework::TypeDetection )
+ )
+#else//MUSTFILTER
+COMPONENTWRITEINFO ( COMPONENTINFO( ::framework::URLTransformer )
+ COMPONENTINFO( ::framework::PlugInFrame )
+ COMPONENTINFO( ::framework::Desktop )
+ COMPONENTINFO( ::framework::MediaTypeDetectionHelper )
+ COMPONENTINFO( ::framework::Task )
+ COMPONENTINFO( ::framework::Frame )
+ COMPONENTINFO( ::framework::FrameLoaderFactory )
)
-COMPONENTGETFACTORY ( IFFACTORY( ::framework::Task ) else
- IFFACTORY( ::framework::Frame ) else
- IFFACTORY( ::framework::FrameLoaderFactory )
+COMPONENTGETFACTORY ( IFFACTORY( ::framework::URLTransformer ) else
+ IFFACTORY( ::framework::PlugInFrame ) else
+ IFFACTORY( ::framework::Desktop ) else
+ IFFACTORY( ::framework::MediaTypeDetectionHelper ) else
+ IFFACTORY( ::framework::Task ) else
+ IFFACTORY( ::framework::Frame ) else
+ IFFACTORY( ::framework::FrameLoaderFactory )
)
+#endif//MUSTFILTER
diff --git a/framework/source/services/desktop.cxx b/framework/source/services/desktop.cxx
new file mode 100644
index 000000000000..548dd9be4ce6
--- /dev/null
+++ b/framework/source/services/desktop.cxx
@@ -0,0 +1,2129 @@
+/*************************************************************************
+ *
+ * $RCSfile: desktop.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: as $ $Date: 2000-11-23 14:52:10 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+//_________________________________________________________________________________________________________________
+// my own includes
+//_________________________________________________________________________________________________________________
+
+#ifndef __FRAMEWORK_DESKTOP_HXX_
+#include <baeh_services/desktop.hxx>
+#endif
+
+#ifndef __FRAMEWORK_FRAME_HXX_
+#include <services/frame.hxx>
+#endif
+
+#ifndef __FRAMEWORK_OTASKSACCESS_HXX_
+#include <helper/otasksaccess.hxx>
+#endif
+
+#ifndef __FRAMEWORK_OCOMPONENTACCESS_HXX_
+#include <helper/ocomponentaccess.hxx>
+#endif
+
+#ifndef __FRAMEWORK_ODESKTOPDISPATCHER_HXX_
+#include <helper/odesktopdispatcher.hxx>
+#endif
+
+#ifndef __FRAMEWORK_DEFINES_HXX_
+#include <defines.hxx>
+#endif
+
+#ifndef __FRAMEWORK_CLASSES_TARGETFINDER_HXX_
+#include <classes/targetfinder.hxx>
+#endif
+
+//_________________________________________________________________________________________________________________
+// interface includes
+//_________________________________________________________________________________________________________________
+
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_FRAME_FRAMESEARCHFLAG_HPP_
+#include <com/sun/star/frame/FrameSearchFlag.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_XTOOLKIT_HPP_
+#include <com/sun/star/awt/XToolkit.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_XWINDOW_HPP_
+#include <com/sun/star/awt/XWindow.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_XWINDOWPEER_HPP_
+#include <com/sun/star/awt/XWindowPeer.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_WINDOWDESCRIPTOR_HPP_
+#include <com/sun/star/awt/WindowDescriptor.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_WINDOWATTRIBUTE_HPP_
+#include <com/sun/star/awt/WindowAttribute.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_POSSIZE_HPP_
+#include <com/sun/star/awt/PosSize.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_MOZILLA_XPLUGININSTANCE_HPP_
+#include <com/sun/star/mozilla/XPluginInstance.hpp>
+#endif
+
+//_________________________________________________________________________________________________________________
+// includes of other projects
+//_________________________________________________________________________________________________________________
+
+#ifndef _CPPUHELPER_QUERYINTERFACE_HXX_
+#include <cppuhelper/queryinterface.hxx>
+#endif
+
+#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_
+#include <cppuhelper/typeprovider.hxx>
+#endif
+
+#ifndef _CPPUHELPER_FACTORY_HXX_
+#include <cppuhelper/factory.hxx>
+#endif
+
+#ifndef _CPPUHELPER_PROPTYPEHLP_HXX
+#include <cppuhelper/proptypehlp.hxx>
+#endif
+
+#ifndef _RTL_USTRBUF_HXX_
+#include <rtl/ustrbuf.hxx>
+#endif
+
+#ifndef _SV_SVAPP_HXX
+#include <vcl/svapp.hxx>
+#endif
+
+//_________________________________________________________________________________________________________________
+// namespace
+//_________________________________________________________________________________________________________________
+
+namespace framework{
+
+using namespace ::com::sun::star::awt ;
+using namespace ::com::sun::star::beans ;
+using namespace ::com::sun::star::container ;
+using namespace ::com::sun::star::frame ;
+using namespace ::com::sun::star::io ;
+using namespace ::com::sun::star::lang ;
+using namespace ::com::sun::star::mozilla ;
+using namespace ::com::sun::star::task ;
+using namespace ::com::sun::star::uno ;
+using namespace ::com::sun::star::util ;
+using namespace ::cppu ;
+using namespace ::osl ;
+using namespace ::rtl ;
+
+//_________________________________________________________________________________________________________________
+// non exported const
+//_________________________________________________________________________________________________________________
+
+// names of properties
+#define PROPERTYNAME_ACTIVECOMPONENT DECLARE_ASCII("ActiveComponent" )
+#define PROPERTYNAME_ACTIVEFRAME DECLARE_ASCII("ActiveFrame" )
+#define PROPERTYNAME_HASBEAMER DECLARE_ASCII("HasBeamer" )
+#define PROPERTYNAME_HASCOMMONTASKBAR DECLARE_ASCII("HasCommonTaskBar")
+#define PROPERTYNAME_HASDESIGNER DECLARE_ASCII("HasDesigner" )
+#define PROPERTYNAME_HASEXPLORER DECLARE_ASCII("HasExplorer" )
+#define PROPERTYNAME_HASFUNCTIONBAR DECLARE_ASCII("HasFunctionBar" )
+#define PROPERTYNAME_HASMACROBAR DECLARE_ASCII("HasMacroBar" )
+#define PROPERTYNAME_HASNAVIGATOR DECLARE_ASCII("HasNavigator" )
+#define PROPERTYNAME_HASOBJECTBAR DECLARE_ASCII("HasObjectBar" )
+#define PROPERTYNAME_HASOPTIONBAR DECLARE_ASCII("HasOptionBar" )
+#define PROPERTYNAME_HASSTATUSBAR DECLARE_ASCII("HasStatusBar" )
+#define PROPERTYNAME_HASTOOLBAR DECLARE_ASCII("HasToolBar" )
+#define PROPERTYNAME_ISOLOCALE DECLARE_ASCII("ISOLocale" )
+#define PROPERTYNAME_ISPLUGGED DECLARE_ASCII("IsPlugged" )
+
+// handle of properties
+#define PROPERTYHANDLE_ACTIVECOMPONENT 1
+#define PROPERTYHANDLE_ACTIVEFRAME 2
+#define PROPERTYHANDLE_HASBEAMER 3
+#define PROPERTYHANDLE_HASCOMMONTASKBAR 4
+#define PROPERTYHANDLE_HASDESIGNER 5
+#define PROPERTYHANDLE_HASEXPLORER 6
+#define PROPERTYHANDLE_HASFUNCTIONBAR 7
+#define PROPERTYHANDLE_HASMACROBAR 8
+#define PROPERTYHANDLE_HASNAVIGATOR 9
+#define PROPERTYHANDLE_HASOBJECTBAR 10
+#define PROPERTYHANDLE_HASOPTIONBAR 11
+#define PROPERTYHANDLE_HASSTATUSBAR 12
+#define PROPERTYHANDLE_HASTOOLBAR 13
+#define PROPERTYHANDLE_ISOLOCALE 14
+#define PROPERTYHANDLE_ISPLUGGED 15
+
+// count of ALL properties
+#define PROPERTYCOUNT 15
+
+// Defines default name for desktop
+#define DEFAULT_NAME DECLARE_ASCII("Desktop")
+#define DEFAULT_LOADSTATE UNKNOWN
+
+//_________________________________________________________________________________________________________________
+// non exported definitions
+//_________________________________________________________________________________________________________________
+
+//_________________________________________________________________________________________________________________
+// declarations
+//_________________________________________________________________________________________________________________
+
+//*****************************************************************************************************************
+// constructor
+//*****************************************************************************************************************
+Desktop::Desktop( const Reference< XMultiServiceFactory >& xFactory )
+ // Init baseclasses first
+ // Attention:
+ // Don't change order of initialization!
+ // OMutexMember is a struct with a mutex as member. We can't use a mutex as member, while
+ // we must garant right initialization and a valid value of this! First initialize
+ // baseclasses and then members. And we need the mutex for other baseclasses !!!
+ : OMutexMember ( )
+ , OBroadcastHelper ( ((OMutexMember*)this)->m_aMutex )
+ , OPropertySetHelper ( *SAL_STATIC_CAST( OBroadcastHelper *, this ) )
+ , OWeakObject ( )
+ // Init member
+ , m_xFactory ( xFactory )
+ , m_aChildTaskContainer ( )
+ , m_aListenerContainer ( m_aMutex )
+ , m_sName ( DEFAULT_NAME )
+ , m_eLoadState ( DEFAULT_LOADSTATE )
+ , m_aTaskCreator ( xFactory )
+ // Init Properties
+ , m_bHasBeamer ( sal_True )
+ , m_bHasCommonTaskBar ( sal_True )
+ , m_bHasDesigner ( sal_True )
+ , m_bHasExplorer ( sal_True )
+ , m_bHasFunctionBar ( sal_True )
+ , m_bHasMacroBar ( sal_True )
+ , m_bHasNavigator ( sal_True )
+ , m_bHasObjectBar ( sal_True )
+ , m_bHasOptionBar ( sal_True )
+ , m_bHasStatusBar ( sal_True )
+ , m_bHasToolbar ( sal_True )
+ , m_aISOLocale ( )
+ #ifdef ENABLE_ASSERTIONS
+ , m_bIsTerminated ( sal_False ) // see dispose() for further informations!
+ #endif
+{
+ // Safe impossible cases
+ // We don't accept all incoming parameter.
+ LOG_ASSERT( impldbg_checkParameter_DesktopCtor( xFactory ), "Desktop::Desktop()\nInvalid parameter detected!\n")
+
+ // We cant create the frameshelper, because he hold a wekreference to us!
+ // But with a HACK (++refcount) its "OK" :-(
+ ++m_refCount ;
+
+ // Initialize a new frameshelper-object to handle indexaccess and elementaccess!
+ // Attention: OFrames need the this-pointer for initializing. You must use "this" directly.
+ // If you define an extra variable to do that (like: Reference< XFrame > xTHIS( ... )) and
+ // forget to clear this reference BEFORE "--m_refCount" (!), your refcount will be less then 0
+ // and the new Desktop-instance will be destroyed instantly!!!...
+ OFrames* pFramesHelper = new OFrames( m_xFactory, m_aMutex, this, &m_aChildTaskContainer );
+ m_xFramesHelper = Reference< XFrames >( (OWeakObject*)pFramesHelper, UNO_QUERY );
+
+ // Safe impossible cases
+ // We can't work without this helper!
+ LOG_ASSERT( !(m_xFramesHelper.is()==sal_False), "Desktop::Desktop()\nFramesHelper is not valid. XFrames, XIndexAccess and XElementAcces are not supported!\n")
+
+ // Create a new helper to dispatch "_blank" in a correctly way.
+ ODesktopDispatcher* pDispatchHelper = new ODesktopDispatcher( m_xFactory, this, m_aMutex );
+ m_xDispatchHelper = Reference< XDispatch >( (OWeakObject*)pDispatchHelper, UNO_QUERY );
+ LOG_ASSERT( !(m_xDispatchHelper.is()==sal_False), "Desktop::Desktop()\nDispatchHelper is not valid. XDispatch will not work correctly for \"_blank\"!\n")
+
+ // I'am the desktop - and use my frame container in a special mode.
+ // If last child task is removed I must die!
+ // My container should terminate me asynchronous by using a timer.
+ // Enable timer at container.
+ // (The timer will be initialized with right timeout value automaticly by himself. see class AsyncQuit for further informations!)
+ m_aChildTaskContainer.enableQuitTimer( this );
+
+ // Don't forget these - or we live for ever!
+ --m_refCount ;
+}
+
+//*****************************************************************************************************************
+// destructor
+//*****************************************************************************************************************
+Desktop::~Desktop()
+{
+ // Reset instance, free memory ....
+ impl_resetObject();
+}
+
+//*****************************************************************************************************************
+// XInterface, XTypeProvider, XServiceInfo
+//
+// Attention:
+// If any testmode is set (different from TEST_NOTHING!) the special debug interface XDebugging is automaticly
+// used in queryInterface() and getTypes()!
+// (see PRIVATE_DEFINE_TYPE_1 and PRIVATE_DEFINE_INTERFACE_1 in privatemacors.hxx for further informations)
+//*****************************************************************************************************************
+DEFINE_XINTERFACE_15 ( Desktop ,
+ OWeakObject ,
+ DIRECT_INTERFACE( XTypeProvider ),
+ DIRECT_INTERFACE( XServiceInfo ),
+ DIRECT_INTERFACE( XDesktop ),
+ DIRECT_INTERFACE( XComponentLoader ),
+ DIRECT_INTERFACE( XTasksSupplier ),
+ DIRECT_INTERFACE( XDispatchProvider ),
+ DIRECT_INTERFACE( XFramesSupplier ),
+ DIRECT_INTERFACE( XStatusIndicatorFactory ),
+ DIRECT_INTERFACE( XFrame ),
+ DIRECT_INTERFACE( XPropertySet ),
+ DIRECT_INTERFACE( XFastPropertySet ),
+ DIRECT_INTERFACE( XMultiPropertySet ),
+ DIRECT_INTERFACE( XComponent ),
+ DIRECT_INTERFACE( XStatusListener ),
+ DIRECT_INTERFACE( XEventListener )
+ )
+
+DEFINE_XTYPEPROVIDER_15 ( Desktop ,
+ XTypeProvider ,
+ XServiceInfo ,
+ XDesktop ,
+ XComponentLoader ,
+ XTasksSupplier ,
+ XDispatchProvider ,
+ XFramesSupplier ,
+ XStatusIndicatorFactory ,
+ XFrame ,
+ XPropertySet ,
+ XFastPropertySet ,
+ XMultiPropertySet ,
+ XComponent ,
+ XStatusListener ,
+ XEventListener
+ )
+
+DEFINE_XSERVICEINFO_ONEINSTANCESERVICE ( Desktop ,
+ SERVICENAME_DESKTOP ,
+ IMPLEMENTATIONNAME_DESKTOP
+ )
+
+// Attention: If you have enabled any testmode different from TEST_NOTHING => you have declared XDebugging-interface automaticly!
+// Bhere is no macro to define and implement the right methods. You are the only one, who know - how you will use this mechanism.
+// It exist a macro to switch on or off your implementation only.
+// ENABLE_SERVICEDEBUG must be defined, to activate your code!
+/*
+#ifdef ENABLE_SERVICEDEBUG
+
+ // In these implementation we use "dumpVariable()" to activate some special debug-operations.
+ OUString SAL_CALL Desktop::dumpVariable( const OUString& sVariableName ,
+ sal_Int16 nCallStackPos ) throw( RuntimeException )
+ {
+ // Set default return value.
+ OUString sReturn;
+
+ // We have a private impldbg-method to print out the current content of ouer frame hierarchy - the tree.
+ // This mechanism is started here. We collect the names of all frames and write the informations to a logfile.
+ if ( sVariableName.equals( DUMPVARIABLE_TREEINFO ) == sal_True )
+ {
+ sReturn = impldbg_getTreeNames();
+ }
+ else
+ // Safe impossible cases
+ // This method and his interface is used in a special context.
+ // If somebody don't know this and these implementation is invalid (zB. interface exported in release version!?)
+ // => we have problems!
+ {
+ LOG_ASSERT( sal_True, "Desktop::dumpVariable()\nERROR\nSpecial debug mode of service is used in another context!Please contact programmer.\n\n" )
+ }
+
+ // Return result of DEBUG.
+ return sReturn;
+ }
+
+ // Follow methods are unused in these implementation!
+ sal_Int32 SAL_CALL Desktop::setBreakPoint( const OUString& sModuleName, sal_Int32 nSourceCodeLine, sal_Bool bOn ) throw( RuntimeException ) { return 0; }
+ void SAL_CALL Desktop::clearAllBreakPoints( const OUString& sModuleName ) throw( RuntimeException ) {}
+ OUString SAL_CALL Desktop::eval( const OUString& sSourceCode, sal_Int16 nCallStackPos ) throw( RuntimeException ) { return OUString(); }
+ Sequence< OUString > SAL_CALL Desktop::getStackTrace() throw( RuntimeException ) { return Sequence< OUString >(); }
+ CONTEXTINFORMATION SAL_CALL Desktop::getContextInformation( sal_Int16 nCallStackPos) throw( RuntimeException ) { return CONTEXTINFORMATION(); }
+ void SAL_CALL Desktop::setVariable( const OUString& sVariableName, const OUSTRING& aValue, sal_Int16 nCallStackPos ) throw( RuntimeException ) {}
+ sal_Bool SAL_CALL Desktop::isVariable( const OUString& sVariableName, sal_Int16 nCallStackPos ) throw( RuntimeException ) { return sal_False; }
+ void SAL_CALL Desktop::stop() throw( RuntimeException ) {}
+ void SAL_CALL Desktop::stepOver() throw( RuntimeException ) {}
+ void SAL_CALL Desktop::stepIn() throw( RuntimeException ) {}
+ void SAL_CALL Desktop::stepOut() throw( RuntimeException ) {}
+ void SAL_CALL Desktop::doContinue() throw( RuntimeException ) {}
+
+
+#endif // #ifdef ENABLE_SERVICEDEBUG
+*/
+//*****************************************************************************************************************
+// XDesktop
+//*****************************************************************************************************************
+sal_Bool SAL_CALL Desktop::terminate() throw( RuntimeException )
+{
+ // Set default return value, if method failed.
+ // Default is "YES, YOU CAN TERMINATE ME!"
+ // If some of childs will not terminate, we reset this value to "NO".
+ sal_Bool bReturn = sal_True;
+ Reference < XDesktop > xThis( this );
+
+ // block for locked mutex
+ {
+ LOCK_MUTEX( aGuard, m_aMutex, "Desktop::terminate()" )
+
+ // We don't need the quit timer any more!
+ // We stand in terminate ... and these timer call terminate at us ... WE MUST DISABLE IT!
+ // He hold a reference (no weak reference!) to us.
+ // If we forget to disable it, nobody can't release us ...
+ m_aChildTaskContainer.disableQuitTimer();
+
+ // Step over all child tasks and ask they "CAN I TERMINATE YOU AND ME?"
+ Sequence< Reference< XFrame > > seqTasks = m_aChildTaskContainer.getAllElements();
+ sal_Int32 nCount = seqTasks.getLength();
+ for( sal_Int32 nPosition=0; nPosition<nCount; ++nPosition )
+ {
+ // Get an element from container and cast it to task.
+ // IT MUST BE A TASK! Childs of desktop everytime tasks. No pure frames accepted!
+ // It can be a plugin too, but a plugin is derived from a task ...!
+ Reference< XFrame > xFrame = seqTasks[nPosition];
+ Reference< XTask > xTask ( xFrame, UNO_QUERY );
+
+ // (xFrame and xTask must be valid every time or container is not valid!)
+ // Control this ...
+ LOG_ASSERT( !(xFrame.is() == sal_False), "Desktop::terminate()\nInvalid element in child container detected!\n")
+ LOG_ASSERT( !(xTask.is() == sal_False), "Desktop::terminate()\nElement in container is not a task!\n" )
+
+ // Ask task for terminating. If anyone say "NO" ...
+ if ( xTask->close() == sal_False )
+ {
+ // ... we must reset ouer default return value to "NO" too!
+ // But we don't break this loop ... we will close all task, which accept it.
+ bReturn = sal_False;
+ }
+ }
+ }
+
+ // If termination of tasks successful ask listener for his agreement.
+ if( bReturn == sal_True )
+ {
+ try
+ {
+ // A vetoable listener can throw an TerminateVetoException.
+ // Then we return false!
+ impl_sendQueryTerminationEvent();
+ }
+ catch( TerminationVetoException& )
+ {
+ bReturn = sal_False;
+ }
+ }
+
+ // All listener has no problem with termination!
+ // Send NotifyTermination event to all and return with true.
+ if( bReturn == sal_True )
+ {
+ #ifdef ENABLE_ASSERTIONS
+ // "Protect" us against dispose before terminate calls!
+ // see dispose() for further informations.
+ // Follow notify will start shutdown of office and somewhere call dispose() at us ...
+ // Set debug variable BEFORE notify!
+ m_bIsTerminated = sal_True ;
+ #endif
+
+ impl_sendNotifyTerminationEvent();
+ }
+
+ // Return result of this question.
+ return bReturn;
+}
+
+//*****************************************************************************************************************
+// XDesktop
+//*****************************************************************************************************************
+void SAL_CALL Desktop::addTerminateListener( const Reference< XTerminateListener >& xListener ) throw( RuntimeException )
+{
+ // Ready for multithreading
+ LOCK_MUTEX( aGuard, m_aMutex, "Desktop::addTerminateListener()" )
+ // Safe impossible cases
+ // Method not defined for all incoming parameter.
+ LOG_ASSERT( impldbg_checkParameter_addTerminateListener( xListener ), "Desktop::addTerminateListener()\nInvalid parameter detected!\n" )
+ // Add terminate-listener to container.
+ m_aListenerContainer.addInterface( ::getCppuType( ( const Reference< XTerminateListener >*) NULL ), xListener );
+}
+
+//*****************************************************************************************************************
+// XDesktop
+//*****************************************************************************************************************
+void SAL_CALL Desktop::removeTerminateListener( const Reference< XTerminateListener >& xListener ) throw( RuntimeException )
+{
+ // Ready for multithreading
+ LOCK_MUTEX( aGuard, m_aMutex, "Desktop::removeTerminateListener()" )
+ // Safe impossible cases
+ // Method not defined for all incoming parameter.
+ LOG_ASSERT( impldbg_checkParameter_removeTerminateListener( xListener ), "Desktop::removeTerminateListener()\nInvalid parameter detected!\n" )
+ // Remove terminate-listener from container.
+ m_aListenerContainer.removeInterface( ::getCppuType( ( const Reference< XTerminateListener >*) NULL ), xListener );
+}
+
+//*****************************************************************************************************************
+// XDesktop
+//*****************************************************************************************************************
+Reference< XEnumerationAccess > SAL_CALL Desktop::getComponents() throw( RuntimeException )
+{
+ // Ready for multithreading
+ LOCK_MUTEX( aGuard, m_aMutex, "Desktop::getComponents()" )
+
+ // We use a helper class OComponentAccess to have access on all child components.
+ OComponentAccess* pAccessor = new OComponentAccess( this, m_aMutex );
+ Reference< XEnumerationAccess > xAccessor( (OWeakObject*)pAccessor, UNO_QUERY );
+ return xAccessor;
+}
+
+//*****************************************************************************************************************
+// XDesktop
+//*****************************************************************************************************************
+Reference< XComponent > SAL_CALL Desktop::getCurrentComponent() throw( RuntimeException )
+{
+ // Ready for multithreading
+ LOCK_MUTEX( aGuard, m_aMutex, "Desktop::getCurrentComponent()" )
+
+ // Set return value if method failed.
+ Reference< XComponent > xComponent;
+
+ // Get reference to current frame ...
+ // ... get component of this frame ... (It can be the window, the model or the controller.)
+ Reference< XFrame > xCurrentFrame = getCurrentFrame();
+ if( xCurrentFrame.is() == sal_True )
+ {
+ xComponent = impl_getFrameComponent( xCurrentFrame );
+ }
+
+ // ... and return result.
+ return xComponent;
+}
+
+//*****************************************************************************************************************
+// XDesktop
+//*****************************************************************************************************************
+Reference< XFrame > SAL_CALL Desktop::getCurrentFrame() throw( RuntimeException )
+{
+ // Ready for multithreading
+ LOCK_MUTEX( aGuard, m_aMutex, "Desktop::getCurrentFrame()" )
+
+ // Set default return value, if method failed.
+ Reference< XFrame > xReturn = Reference< XFrame >();
+
+ // Start search with ouer direct active frame (if it exist!).
+ Reference< XFrame > xActiveFrame = getActiveFrame();
+ if ( xActiveFrame.is() == sal_True )
+ {
+ // The current frame is the most active frame.
+ // Search from there other active frames in hierarchy.
+ Reference< XFramesSupplier > xLast = Reference< XFramesSupplier >( xActiveFrame, UNO_QUERY );
+ Reference< XFramesSupplier > xNext = Reference< XFramesSupplier >( xLast->getActiveFrame(), UNO_QUERY );
+
+ // If a other frame in hierarchy is active to ...
+ while ( xNext.is() == sal_True )
+ {
+ // ... safe this new one as current and try to get a other active frame.
+ xLast = xNext;
+ xNext = Reference< XFramesSupplier >( xNext->getActiveFrame(), UNO_QUERY );
+ }
+
+ // Cast current active frame to XFrame.
+ xReturn = Reference< XFrame >( xLast, UNO_QUERY );
+ }
+
+ // Return result of search.
+ return xReturn;
+}
+
+//*****************************************************************************************************************
+// XComponentLoader
+//*****************************************************************************************************************
+Reference< XComponent > SAL_CALL Desktop::loadComponentFromURL( const OUString& sURL ,
+ const OUString& sTargetFrameName,
+ sal_Int32 nSearchFlags ,
+ const Sequence< PropertyValue >& seqArguments ) throw( IOException ,
+ IllegalArgumentException,
+ RuntimeException )
+{
+ // Ready for multithreading
+ LOCK_MUTEX( aBeforeGuard, m_aMutex, "Desktop::loadComponentFromURL() start" )
+ // Safe impossible cases
+ // Method not defined for all incoming parameter.
+ LOG_ASSERT( impldbg_checkParameter_loadComponentFromURL( sURL, sTargetFrameName, nSearchFlags, seqArguments ), "Desktop::loadComponentFromURL()\nInvalid parameter detected!\n" )
+
+ // Set default return value, if method failed.
+ Reference< XComponent > xReturn;
+
+ URL aURL;
+ aURL.Complete = sURL;
+ Reference< XDispatch > xDispatcher = queryDispatch( aURL, sTargetFrameName, nSearchFlags );
+ // Now we have found any destination frame with a valid dispatcher ... dispatch URL on it.
+ if( xDispatcher.is() == sal_True )
+ {
+ // ... dispatch URL at this dispatcher.
+ // Set us as listener for status events from this dispatcher.
+ // The dispatcher get a event loadFinished() or loadCancelled() from his frameloader
+ // and map this information for us! (see classes ODispatchProvider/ODesktopDispatcher for further informations)
+ xDispatcher->addStatusListener( static_cast< XStatusListener* >( this ), aURL );
+ // Attention: We must unlock our mutex before next call!
+ // Somewhere can call us back (zB. getActiveFrame() for set/unset focus)
+ // AND ...
+ m_eLoadState = UNKNOWN; // Reset loader state to default, because we must yield for a valid result! See next WHILE condition.
+ // And we must do it before we call dispatch AND before we unlock our mutex!
+ UNLOCK_MUTEX( aBeforeGuard, "Desktop::loadComponentFromURL() before dispatch" )
+ xDispatcher->dispatch( aURL, seqArguments );
+ // ... we must wait for asynchron result of this dispatch()-operation!
+ while( m_eLoadState == UNKNOWN )
+ {
+ Application::Yield();
+ }
+ // Try to get new current component.
+ // Look for result of loading.
+ // If loading was successful we can return a component.
+ // Otherwise our ODesktopDispatcher will delete these zombie task without any component automaticly!
+ if( m_eLoadState == SUCCESSFUL && m_xLastFrame.is() )
+ {
+ xReturn = impl_getFrameComponent( m_xLastFrame );
+ }
+ // We have all informations about result state of loading document.
+ // We can remove us as listener.
+ xDispatcher->removeStatusListener( static_cast< XStatusListener* >( this ), aURL );
+ }
+
+
+/*
+ // Search frame for given parameter.
+ // Attention: Don't use queryDispatch() to find this frame and get the dispatcher (see follow operations too)!
+ // We must the owner of new frames to dispose it if loading failed ... and if we use queryDispatch() we are not this user ...
+ // (We will be owner of found frame, if chance for creating of a new one is very high ...
+ // and this case is true if "_blank" is one of our parameters!)
+ sal_Bool bIAmOwnerOfFrame = (sTargetFrameName==FRAMETYPE_BLANK);
+
+ // We will forward all "_blank" or HIDDEN requests to one of our plugin frames if any exist!
+ // Search for any plugin frame.
+
+ // Now we must search for a valid dispatcher.
+ Reference< XFrame > xDestinationFrame;
+ Reference< XDispatch > xDispatcher;
+ URL aURL;
+ {
+ // Else we must search for a normal frame as target.
+ // Find normal frame of our hierarchy to dispatch this URL.
+ // Get the dispatcher of this frame to load the component.
+ // Use "_self" to get his own dispatcher!
+ xDestinationFrame = findFrame( sTargetFrameName, nSearchFlags );
+ if( xDestinationFrame.is() == sal_True )
+ {
+ aURL.Complete = sURL;
+ Reference< XDispatchProvider > xFrameProvider( xDestinationFrame, UNO_QUERY );
+ xDispatcher = xFrameProvider->queryDispatch( aURL, FRAMETYPE_SELF, 0 );
+ LOG_ASSERT( !(xDispatcher.is()==sal_False), "Desktop::loadComponentFromURL()\nNormal founded frame support no dispatcher interface ...?!\n" )
+ }
+ }
+ // Now we have found any destination frame with a valid dispatcher ... dispatch URL on it.
+ if( xDispatcher.is() == sal_True )
+ {
+ // ... dispatch URL at this dispatcher.
+ // Set us as listener for status events from this dispatcher.
+ // The dispatcher get a event loadFinished() or loadCancelled() from his frameloader
+ // and map this information for us! (see class ODispatchProvider for further informations)
+ xDispatcher->addStatusListener( static_cast< XStatusListener* >( this ), aURL );
+
+ // Attention: We must unlock our mutex before next call!
+ // Somewhere can call us back (zB. getActiveFrame() for set/unset focus)
+ // AND ...
+
+ m_eLoadState = UNKNOWN; // Reset loader state to default, because we must yield for a valid result! See next WHILE condition.
+ // And we must do it before we call dispatch AND before we unlock our mutex!
+
+ UNLOCK_MUTEX( aBeforeGuard, "Desktop::loadComponentFromURL() before dispatch" )
+
+ xDispatcher->dispatch( aURL, seqArguments );
+
+ // ... we must wait for asynchron result of this dispatch()-operation!
+ while( m_eLoadState == UNKNOWN )
+ {
+ Application::Yield();
+ }
+
+ // Try to get new current component.
+ // Look for result of loading.
+ switch( m_eLoadState )
+ {
+ case SUCCESSFUL : // If loading was successful we can return a component.
+ xReturn = impl_getFrameComponent( xDestinationFrame );
+ break;
+ case FAILED : // If loading was not successful we cant return a valid component ... but ...
+ if( bIAmOwnerOfFrame == sal_True )
+ {
+ // ... this frame was new created for this operation!
+ // We must dispose this task(!) It must be a task!
+ Reference< XTask > xTask( xDestinationFrame, UNO_QUERY );
+ LOG_ASSERT( !(xTask.is()==sal_False), "Desktop::loadComponentFromURL()\nWith \"_blank\" new created frame is no task ... ?!\n" )
+ xTask->close();
+ }
+ break;
+ }
+
+ // We have all informations about result state of loading document.
+ // We can remove us as listener.
+ xDispatcher->removeStatusListener( static_cast< XStatusListener* >( this ), aURL );
+ }
+*/
+ // Return result of this operation.
+ return xReturn;
+}
+
+//*****************************************************************************************************************
+// XTasksSupplier
+//*****************************************************************************************************************
+Reference< XEnumerationAccess > SAL_CALL Desktop::getTasks() throw( RuntimeException )
+{
+ // Ready for multithreading
+ LOCK_MUTEX( aGuard, m_aMutex, "Desktop::getTasks()" )
+
+ // Create a new EnumerationAccess and return it.
+ // Caller will be the new owner of this and HE must destroy the returned instance!
+ OTasksAccess* pTasksAccess = new OTasksAccess( this, &m_aChildTaskContainer, m_aMutex );
+ Reference< XEnumerationAccess > xAccess( (OWeakObject*)pTasksAccess, UNO_QUERY );
+
+ // Return result of operation.
+ return xAccess;
+}
+
+//*****************************************************************************************************************
+// XTasksSupplier
+//*****************************************************************************************************************
+Reference< XTask > SAL_CALL Desktop::getActiveTask() throw( RuntimeException )
+{
+ // Ready for multithreading
+ LOCK_MUTEX( aGuard, m_aMutex, "Desktop::getActiveTask()" )
+
+ // The current active task can only be an active child of us.
+ // And tasks allowed only as direct childs of desktop.
+ return Reference< XTask >( m_aChildTaskContainer.getActive(), UNO_QUERY );
+}
+
+//*****************************************************************************************************************
+// XDispatchProvider
+//*****************************************************************************************************************
+Reference< XDispatch > SAL_CALL Desktop::queryDispatch( const URL& aURL ,
+ const OUString& sTargetFrameName,
+ sal_Int32 nSearchFlags ) throw( RuntimeException )
+{
+ // Ready for multithreading
+ LOCK_MUTEX( aGuard, m_aMutex, "Desktop::queryDispatch()" )
+ // Safe impossible cases
+ // Method not defined for all incoming parameter.
+ LOG_ASSERT( impldbg_checkParameter_queryDispatch( aURL, sTargetFrameName, nSearchFlags ), "Desktop::queryDispatch()\nInvalid parameter detected!\n" )
+
+ // Set default return value.
+ Reference< XDispatch > xReturn;
+
+ // Use helper to classify search direction.
+ IMPL_ETargetClass eDirection = TargetFinder::classify( this ,
+ sTargetFrameName ,
+ nSearchFlags );
+ // Use returned recommendation to search right frame!
+ switch( eDirection )
+ {
+ case eCREATE : {
+ xReturn = m_xDispatchHelper;
+ }
+ break;
+
+ case eDOWN : {
+ Reference< XDispatchProvider > xTarget( TargetFinder::helpDownSearch( m_xFramesHelper, sTargetFrameName ), UNO_QUERY );
+ if( xTarget.is() == sal_True )
+ {
+ xReturn = xTarget->queryDispatch( aURL, SPECIALTARGET_SELF, 0 );
+ }
+ }
+ break;
+ }
+
+/* TODO
+ If new implementation of findFrame/queryDispatch works correctly we can delete these code!
+
+ //*************************************************************************************************************
+ // 1) Handle special mode "_blank"/CREATE TASK!
+ // We create a special dispatcher which create new tasks on demand if a new dispatch() is called.
+ //*************************************************************************************************************
+
+// Praeprozessor Bug!
+// Wenn nach CREATE ein Space steht wird versucht es durch das Define CREATE aus tools/rtti.hxx zu ersetzen
+// was fehlschlaegt und die naechsten 3 Klammern ")){" unterschlaegt!
+// Dann meckert der Compiler das natuerlich an ...
+
+ if((sTargetFrameName==FRAMETYPE_BLANK)||(nSearchFlags&FrameSearchFlag::CREATE))
+ {
+ xReturn = m_xDispatchHelper;
+ }
+ else
+ //*************************************************************************************************************
+ // 2) We search for an existing frame to dispatch this URL.
+ //*************************************************************************************************************
+ {
+ // Forbid creation of new tasks at follow calls! We have handled this before.
+// OUString sNewTargetFrameName;
+// if( sTargetFrameName != FRAMETYPE_BLANK )
+// {
+// sNewTargetFrameName = sTargetFrameName;
+// }
+// nSearchFlags |= UNMASK_CREATE ;
+
+ // Try to find right frame in current hierarchy to dispatch given URL to it.
+ Reference< XFrame > xDispatchFrame = findFrame( sTargetFrameName, nSearchFlags );
+ // Do the follow only, if we have any valid frame for dispatch!
+ // Otherwise ouer return value will be empty ...
+ if ( xDispatchFrame.is() == sal_True )
+ {
+ // Dispatch given URL on found frame.
+ Reference< XDispatchProvider > xDispatchProvider( xDispatchFrame, UNO_QUERY );
+ // Safe impossible cases.
+ // A frame of ouer hierarchy must support XDispatchProvider interface.
+ LOG_ASSERT( !(xDispatchProvider.is()==sal_False), "Desktop::queryDispatch()\nEvery frame of ouer hieararchy must support XDispatchProvider interface. But I have found a negative example ...!\n" )
+ xReturn = xDispatchProvider->queryDispatch( aURL, OUString(), FrameSearchFlag::SELF );
+ }
+ }
+*/
+ // Return dispatcher for given URL.
+ return xReturn;
+}
+
+//*****************************************************************************************************************
+// XDispatchProvider
+//*****************************************************************************************************************
+Sequence< Reference< XDispatch > > SAL_CALL Desktop::queryDispatches( const Sequence< DispatchDescriptor >& seqDescripts ) throw( RuntimeException )
+{
+ // Ready for multithreading
+ LOCK_MUTEX( aGuard, m_aMutex, "Desktop::queryDispatches()" )
+
+ // Set default return value if no dispatcher will be found.
+ Sequence< Reference< XDispatch > > seqDispatcher;
+
+ // Get count of all given discriptors ...
+ sal_Int32 nDescriptorCount = seqDescripts.getLength();
+ if ( nDescriptorCount > 0 )
+ {
+ // ... to get enough memory for expected dispatcher.
+ // We can't get more dispatcher as descriptors exist!
+ Reference< XDispatch >* pDispatcher = new Reference< XDispatch >[nDescriptorCount];
+ // Safe first position in "dynamic memory list" for later access!
+ Reference< XDispatch >* pAnchor = pDispatcher;
+ // We must count all getted dispatcher to create return sequence.
+ // There can't be more but fewer dispatcher then given descriptors!
+ sal_Int32 nDispatcher = 0;
+ // This is a helper variable to hold current returned dispatcher of query.
+ Reference< XDispatch > xDispatcher;
+
+ // Step over all descriptors and try to get any dispatcher for it.
+ for ( sal_Int32 nPosition=0; nPosition<nDescriptorCount; ++nPosition )
+ {
+ xDispatcher = queryDispatch( seqDescripts[nPosition].FeatureURL ,
+ seqDescripts[nPosition].FrameName ,
+ seqDescripts[nPosition].SearchFlags );
+ // If any dispatcher for given parameters found ...
+ if ( xDispatcher.is() == sal_True )
+ {
+ // ... safe it temporaly in "memory list" ...
+ *pDispatcher = xDispatcher;
+ // .. actualize position in these list ...
+ ++pDispatcher;
+ // ... and count of found dispatcher.
+ ++nDispatcher;
+ }
+ }
+
+ // Safe impossible cases.
+ // If we have more dispatcher then descriptors => we have a problem in algorithm!
+ LOG_ASSERT( !(nDispatcher>nDescriptorCount), "Desktop::queryDispatch()\nAlgorithm error. There are more dispatcher as reserved fields in memory!\n" )
+
+ // Copy "memory list" to return sequence.
+ // We copy all valid dispatcher to return sequence! (nDispatcher is count of these objects!)
+ seqDispatcher = Sequence< Reference< XDispatch > >( pDispatcher, nDispatcher );
+ }
+
+ // Return result of this operation.
+ return seqDispatcher;
+}
+
+//*****************************************************************************************************************
+// XFramesSupplier
+//*****************************************************************************************************************
+Reference< XFrames > SAL_CALL Desktop::getFrames() throw( RuntimeException )
+{
+ // Return helper for XFrames interface to handle operations on XFrames.
+ return m_xFramesHelper;
+}
+
+//*****************************************************************************************************************
+// XFramesSupplier
+//*****************************************************************************************************************
+void SAL_CALL Desktop::setActiveFrame( const Reference< XFrame >& xFrame ) throw( RuntimeException )
+{
+ // Ready for multithreading
+ LOCK_MUTEX( aGuard, m_aMutex, "Desktop::setActiveFrame()" )
+
+ // We don't must control incoming parameter! We use a helperclass to safe the current active frame.
+ // And these implementation do this for us!
+
+ // Set new active task.
+ // It must be an already existing child in container!
+
+ Reference< XFrame > xActiveChild = m_aChildTaskContainer.getActive();
+
+ // Don't work, if "new" active frame is'nt different from current one!
+ if ( xActiveChild != xFrame )
+ {
+ // Set the new active child frame.
+ m_aChildTaskContainer.setActive( xFrame );
+ if ( xActiveChild.is() )
+ xActiveChild->deactivate();
+ }
+}
+
+//*****************************************************************************************************************
+// XFramesSupplier
+//*****************************************************************************************************************
+Reference< XFrame > SAL_CALL Desktop::getActiveFrame() throw( RuntimeException )
+{
+ // Ready for multithreading
+ LOCK_MUTEX( aGuard, m_aMutex, "Desktop::getActiveFrame()" )
+
+ // Return current active frame.
+ // Ths information exist at the container!
+ return m_aChildTaskContainer.getActive();
+}
+
+//*****************************************************************************************************************
+// XFrame
+//*****************************************************************************************************************
+void SAL_CALL Desktop::initialize( const Reference< XWindow >& xWindow ) throw( RuntimeException )
+{
+ LOG_ASSERT( sal_False, "Desktop::initialize()\nDesktop has no window! I think so ... !?\n")
+}
+
+//*****************************************************************************************************************
+// XFrame
+//*****************************************************************************************************************
+Reference< XWindow > SAL_CALL Desktop::getContainerWindow() throw( RuntimeException )
+{
+ LOG_ASSERT( sal_False, "Desktop::getContainerWindow()\nDesktop has no window! I think so ... !?\n")
+ return Reference< XWindow >();
+}
+
+//*****************************************************************************************************************
+// XFrame
+//*****************************************************************************************************************
+void SAL_CALL Desktop::setCreator( const Reference< XFramesSupplier >& xCreator ) throw( RuntimeException )
+{
+ // The desktop is the topframe! He has no parent.
+ LOG_ASSERT( sal_False, "Desktop::setCreator()\nThe desktop is the topframe! He has no parent.\n" )
+}
+
+//*****************************************************************************************************************
+// XFrame
+//*****************************************************************************************************************
+Reference< XFramesSupplier > SAL_CALL Desktop::getCreator() throw( RuntimeException )
+{
+ // The desktop is the topframe! He has no parent.
+ LOG_ASSERT( sal_False, "Desktop::getCreator()\nThe desktop is the topframe! He has no parent.\n" )
+ return Reference< XFramesSupplier >();
+}
+
+//*****************************************************************************************************************
+// XFrame
+//*****************************************************************************************************************
+OUString SAL_CALL Desktop::getName() throw( RuntimeException )
+{
+ // Ready for multithreading
+ LOCK_MUTEX( aGuard, m_aMutex, "Desktop::getName()" )
+
+ // Return name of THIS frame.
+ return m_sName;
+}
+
+//*****************************************************************************************************************
+// XFrame
+//*****************************************************************************************************************
+void SAL_CALL Desktop::setName( const OUString& sName ) throw( RuntimeException )
+{
+ // Ready for multithreading
+ LOCK_MUTEX( aGuard, m_aMutex, "Desktop::setName()" )
+
+ // Safe new name of THIS frame.
+ m_sName = sName;
+}
+
+//*****************************************************************************************************************
+// XFrame
+//*****************************************************************************************************************
+Reference< XFrame > SAL_CALL Desktop::findFrame( const OUString& sTargetFrameName ,
+ sal_Int32 nSearchFlags ) throw( RuntimeException )
+{
+ // Ready for multithreading
+ LOCK_MUTEX( aGuard, m_aMutex, "Desktop::findFrame()" )
+ // Safe impossible cases
+ LOG_ASSERT( impldbg_checkParameter_findFrame( sTargetFrameName, nSearchFlags ), "Desktop::findFrame()\nInvalid parameter detected.\n" )
+
+ // Set default return value if method failed.
+ Reference< XFrame > xSearchedFrame;
+
+ // Use helper to classify search direction.
+ IMPL_ETargetClass eDirection = TargetFinder::classify( this ,
+ sTargetFrameName,
+ nSearchFlags );
+ // Use returned recommendation to search right frame or create a new one!
+ switch( eDirection )
+ {
+ case eDOWN : {
+ xSearchedFrame = TargetFinder::helpDownSearch( m_xFramesHelper, sTargetFrameName );
+ }
+ break;
+
+ case eCREATE : {
+ OUString sFrameName = sTargetFrameName;
+ if( sFrameName == SPECIALTARGET_BLANK )
+ {
+ sFrameName = OUString();
+ }
+ xSearchedFrame = m_aTaskCreator.createNewSystemTask( sFrameName );
+ }
+ break;
+ }
+ // return result of operation.
+ return xSearchedFrame;
+}
+/* TODO
+ If new implementation of findFrame/queryDispatch works correctly we can delete these code!
+
+//*****************************************************************************************************************
+// XFrame
+//*****************************************************************************************************************
+Reference< XFrame > SAL_CALL Desktop::findFrame( const OUString& sTargetFrameName ,
+ sal_Int32 nSearchFlags ) throw( RuntimeException )
+{
+ // Ready for multithreading
+ LOCK_MUTEX( aGuard, m_aMutex, "Desktop::findFrame()" )
+ // Safe impossible cases
+ LOG_ASSERT( impldbg_checkParameter_findFrame( sTargetFrameName, nSearchFlags ), "Desktop::findFrame()\nInvalid parameter detected.\n" )
+ // Log some special informations about search. (Active in debug version only, if special mode is set!)
+ LOG_PARAMETER_FINDFRAME( "Desktop", m_sName, sTargetFrameName, nSearchFlags )
+
+ // Set default return Value, if method failed
+ Reference< XFrame > xReturn = Reference< XFrame >();
+
+ //*************************************************************************************************************
+ // 1) If "_blank" searched we must create a new task!
+ // Attention:
+ // Don't set a name at new created frame! sTargetFrameName is not a normal name yet.
+ // "_blank" is not allowed as frame name.
+ // The helper method will create the new task, initialize it with an empty window and append it on
+ // ouer frame-hierarchy.
+ //*************************************************************************************************************
+ if( sTargetFrameName == FRAMETYPE_BLANK )
+ {
+ LOG_TARGETINGSTEP( "Desktop", m_sName, "react to \"_blank\"" )
+ //xReturn = impl_createNewTask( OUString() );
+ xReturn = m_aTaskCreator.createNewSystemTask( OUString() );
+ }
+ else
+ //*************************************************************************************************************
+ // ATTENTION!
+ // We have searched for special targets only ... but now we must search for any named frames and use search
+ // flags to do that!
+ //*************************************************************************************************************
+ {
+ //*********************************************************************************************************
+ // At first we must filter all other special target names!
+ // You can disable this statement if all these cases are handled before ...
+ //*********************************************************************************************************
+ if (
+ ( sTargetFrameName != FRAMETYPE_SELF ) &&
+ ( sTargetFrameName != FRAMETYPE_PARENT) &&
+ ( sTargetFrameName != FRAMETYPE_TOP ) &&
+ ( sTargetFrameName.getLength() > 0 )
+ )
+ {
+ //*****************************************************************************************************
+ // 2) Search for TASKS.
+ //*****************************************************************************************************
+ if (
+ ( nSearchFlags & FrameSearchFlag::TASKS ) &&
+ ( m_aChildTaskContainer.hasElements() == sal_True )
+ )
+ {
+ LOG_TARGETINGSTEP( "Desktop", m_sName, "react to TASKS" )
+ // Step over all direct childtasks and search in it.
+ // Lock container for exclusiv access.
+ // The container is not threadsafe and shared with some helper classes.
+ // It must be! But don't forget to unlock it.
+ m_aChildTaskContainer.lock();
+
+ sal_uInt32 nCount = m_aChildTaskContainer.getCount();
+ sal_uInt32 nPosition = 0;
+ while (
+ ( nPosition < nCount ) &&
+ ( xReturn.is() == sal_False )
+ )
+ {
+ // Get next child and compare with searched name.
+ // But allow task to search at himself only!
+ xReturn = m_aChildTaskContainer[nPosition]->findFrame( sTargetFrameName, FrameSearchFlag::SELF );
+ ++nPosition;
+ }
+ // Unlock the container.
+ m_aChildTaskContainer.unlock();
+ }
+ //*************************************************************************************************************
+ // 3) Search for CHILDREN
+ // Attention:
+ // We search for ouer childs and his subtrees. That is the reason for using of SELF and CHILDREN as searchflags.
+ // Never use SIBLINGS for searching. We step over ouer own container. Search for brothers at ouer direct
+ // childs will do the same and it can be a problem ... RECURSIVE SEARCH ...!
+ //*************************************************************************************************************
+ if (
+ ( xReturn.is() == sal_False ) &&
+ ( nSearchFlags & FrameSearchFlag::CHILDREN ) &&
+ ( m_aChildTaskContainer.hasElements() == sal_True )
+ )
+ {
+ LOG_TARGETINGSTEP( "Desktop", m_sName, "react to CHILDREN" )
+ // Lock container for exclusiv access.
+ // The container is not threadsafe and shared with some helper classes.
+ // It must be! But don't forget to unlock it.
+ m_aChildTaskContainer.lock();
+
+ sal_uInt32 nCount = m_aChildTaskContainer.getCount();
+ sal_uInt32 nPosition = 0;
+ while (
+ ( nPosition < nCount ) &&
+ ( xReturn.is() == sal_False )
+ )
+ {
+ // Get next child and search on it for subframes with searched name.
+ xReturn = m_aChildTaskContainer[nPosition]->findFrame( sTargetFrameName, FrameSearchFlag::SELF | FrameSearchFlag::CHILDREN );
+ ++nPosition;
+ }
+ m_aChildTaskContainer.unlock();
+ }
+ //*************************************************************************************************************
+ // 4) If we have the license to create a new task then we do it.
+ // Create a new task, initialize it with an empty window, set default parameters and append it on desktop!
+ //*************************************************************************************************************
+// Praeprozessor Bug!
+// Wenn nach CREATE ein Space steht wird versucht es durch das Define CREATE aus tools/rtti.hxx zu ersetzen
+// was fehlschlaegt und die naechsten 3 Klammern ")){" unterschlaegt!
+// Dann meckert der Compiler das natuerlich an ...
+ if((xReturn.is()==sal_False)&&(nSearchFlags&FrameSearchFlag::CREATE))
+ {
+ LOG_TARGETINGSTEP( "Desktop", m_sName, "react to CREATE" )
+ //xReturn = impl_createNewTask( sTargetFrameName );
+ xReturn = m_aTaskCreator.createNewSystemTask( sTargetFrameName );
+ }
+ }
+ }
+
+ // Log some special informations about search. (Active in debug version only, if special mode is set!)
+ LOG_RESULT_FINDFRAME( "Desktop", m_sName, xReturn )
+ // Return with result of operation.
+ return xReturn;
+}
+*/
+//*****************************************************************************************************************
+// XFrame
+//*****************************************************************************************************************
+sal_Bool SAL_CALL Desktop::isTop() throw( RuntimeException )
+{
+ // A desktop is the topframe everytime.
+ return sal_True;
+}
+
+//*****************************************************************************************************************
+// XFrame
+//*****************************************************************************************************************
+void SAL_CALL Desktop::activate() throw( RuntimeException )
+{
+ // Desktop is active everytime! Do nothing.
+}
+
+//*****************************************************************************************************************
+// XFrame
+//*****************************************************************************************************************
+void SAL_CALL Desktop::deactivate() throw( RuntimeException )
+{
+ // Desktop is active everytime! Do nothing.
+}
+
+//*****************************************************************************************************************
+// XFrame
+//*****************************************************************************************************************
+sal_Bool SAL_CALL Desktop::isActive() throw( RuntimeException )
+{
+ // Desktop is active everytime!
+ return sal_True;
+}
+
+//*****************************************************************************************************************
+// XFrame
+//*****************************************************************************************************************
+sal_Bool SAL_CALL Desktop::setComponent( const Reference< XWindow >& xComponentWindow,
+ const Reference< XController >& xController ) throw( RuntimeException )
+{
+ LOG_ASSERT( sal_False, "Desktop::setComponent()\nNo component allowed on desktop. We are the root of frame hierarchy only!\n")
+ return sal_False;
+}
+
+//*****************************************************************************************************************
+// XFrame
+//*****************************************************************************************************************
+Reference< XWindow > SAL_CALL Desktop::getComponentWindow() throw( RuntimeException )
+{
+ LOG_ASSERT( sal_False, "Desktop::getComponentWindow()\nNo component allowed on desktop. We are the root of frame hierarchy only!\n")
+ return Reference< XWindow >();
+}
+
+//*****************************************************************************************************************
+// XFrame
+//*****************************************************************************************************************
+Reference< XController > SAL_CALL Desktop::getController() throw( RuntimeException )
+{
+ LOG_ASSERT( sal_False, "Desktop::getController()\nNo controller allowed on desktop. We are the root of frame hierarchy only!\n")
+ return Reference< XController >();
+}
+
+//*****************************************************************************************************************
+// XFrame
+//*****************************************************************************************************************
+void SAL_CALL Desktop::contextChanged() throw( RuntimeException )
+{
+ LOG_ASSERT( sal_False, "Desktop::contextChanged()\nNot implemented yet!\n")
+}
+
+//*****************************************************************************************************************
+// XFrame
+//*****************************************************************************************************************
+void SAL_CALL Desktop::addFrameActionListener( const Reference< XFrameActionListener >& xListener ) throw( RuntimeException )
+{
+ // Ready for multithreading
+ LOCK_MUTEX( aGuard, m_aMutex, "Desktop::addFrameActionListener()" )
+
+ // Safe impossible cases
+ // Method not defined for all incoming parameter.
+ LOG_ASSERT( impldbg_checkParameter_addFrameActionListener( xListener ), "Desktop::addFrameActionListener()\nInvalid parameter detected!\n" )
+
+ // Add frameaction-listener to container.
+ m_aListenerContainer.addInterface( ::getCppuType( ( const Reference< XFrameActionListener >*) NULL ), xListener );
+}
+
+//*****************************************************************************************************************
+// XFrame
+//*****************************************************************************************************************
+void SAL_CALL Desktop::removeFrameActionListener( const Reference< XFrameActionListener >& xListener ) throw( RuntimeException )
+{
+ // Ready for multithreading
+ LOCK_MUTEX( aGuard, m_aMutex, "Desktop::removeFrameActionListener()" )
+
+ // Safe impossible cases
+ // Method not defined for all incoming parameter.
+ LOG_ASSERT( impldbg_checkParameter_removeFrameActionListener( xListener ), "Desktop::removeFrameActionListener()\nInvalid parameter detected!\n" )
+
+ // Remove frameaction-listener from container.
+ m_aListenerContainer.removeInterface( ::getCppuType( ( const Reference< XFrameActionListener >*) NULL ), xListener );
+}
+
+//*****************************************************************************************************************
+// XComponent
+//*****************************************************************************************************************
+void SAL_CALL Desktop::dispose() throw( RuntimeException )
+{
+ // Ready for multithreading
+ LOCK_MUTEX( aGuard, m_aMutex, "Desktop::dispose()" )
+
+ // Safe impossible cases
+ // It's an programming error if dispose is called before terminate!
+ LOG_ASSERT( !(m_bIsTerminated==sal_False), "Desktop::dispose()\nIt's not allowed to dispose the desktop before terminate() is called!\n" )
+
+ // Release all used references, delete all listener
+ // and free our child task container.
+
+ /* Attention 1:
+ We must disable the special quit timer of our frame container.
+ Because it will call terminate at THESE instance (last task is removed!) ...
+ */
+ m_aChildTaskContainer.disableQuitTimer();
+
+ /* Attention 2:
+ We must send the dispose message to all listener BEFORE we clear our container.
+ Otherwise our child tasks are disposed and try to remove it by himself at our container ...
+ Next call remove all frames which components are dispose listener at these desktop;
+ and then we clear all other frames from the container which are not listener!
+ */
+ EventObject aDisposeEvent( (OWeakObject*)this );
+ m_aListenerContainer.disposeAndClear( aDisposeEvent );
+
+ m_aChildTaskContainer.clear();
+
+ // Release some other references.
+ m_xFactory = Reference< XMultiServiceFactory >();
+ m_xFramesHelper = Reference< XFrames >();
+ m_xDispatchHelper = Reference< XDispatch >();
+}
+
+//*****************************************************************************************************************
+// XComponent
+//*****************************************************************************************************************
+void SAL_CALL Desktop::addEventListener( const Reference< XEventListener >& xListener ) throw( RuntimeException )
+{
+ // Ready for multithreading
+ LOCK_MUTEX( aGuard, m_aMutex, "Desktop::addEventListener()" )
+
+ // Safe impossible cases
+ // Method not defined for all incoming parameter.
+ LOG_ASSERT( impldbg_checkParameter_addEventListener( xListener ), "Desktop::addEventListener()\nInvalid parameter detected!\n" )
+
+ // Add listener to container.
+ m_aListenerContainer.addInterface( ::getCppuType( ( const Reference< XEventListener >*) NULL ), xListener );
+}
+
+//*****************************************************************************************************************
+// XComponent
+//*****************************************************************************************************************
+void SAL_CALL Desktop::removeEventListener( const Reference< XEventListener >& xListener ) throw( RuntimeException )
+{
+ // Ready for multithreading
+ LOCK_MUTEX( aGuard, m_aMutex, "Desktop::removeEventListener()" )
+ // Safe impossible cases
+ // Method not defined for all incoming parameter.
+ LOG_ASSERT( impldbg_checkParameter_removeEventListener( xListener ), "Desktop::removeEventListener()\nInvalid parameter detected!\n" )
+
+ // Remove listener to container.
+ m_aListenerContainer.removeInterface( ::getCppuType( ( const Reference< XEventListener >*) NULL ), xListener );
+}
+
+//*****************************************************************************************************************
+// XStatusIndicatorFactory
+//*****************************************************************************************************************
+Reference< XStatusIndicator > SAL_CALL Desktop::createStatusIndicator() throw( RuntimeException )
+{
+ LOG_ASSERT( sal_False, "Desktop::createStatusIndicator()\nNot implemented yet!\n")
+ return Reference< XStatusIndicator >();
+}
+//*****************************************************************************************************************
+// XStatusListener
+//*****************************************************************************************************************
+void SAL_CALL Desktop::statusChanged( const FeatureStateEvent& aEvent ) throw( RuntimeException )
+{
+ // Ready for multithreading
+ LOCK_MUTEX( aGuard, m_aMutex, "Desktop::statusChanged()" )
+ // Safe impossible cases
+ // Method not defined for all incoming parameter.
+ LOG_ASSERT( impldbg_checkParameter_statusChanged( aEvent ), "Desktop::statusChanged()\nInvalid parameter detected!\n" )
+
+ // Is message for me?
+ if( aEvent.FeatureDescriptor == FEATUREDESCRIPTOR_LOADSTATE )
+ {
+ // Map state of event to internal notation.
+ if( aEvent.IsEnabled == sal_True )
+ {
+ m_eLoadState = SUCCESSFUL;
+ aEvent.State >>= m_xLastFrame;
+ }
+ else
+ if( aEvent.IsEnabled == sal_False )
+ {
+ m_eLoadState = FAILED;
+ }
+ }
+}
+
+//*****************************************************************************************************************
+// XEventListener
+//*****************************************************************************************************************
+void SAL_CALL Desktop::disposing( const EventObject& aSource ) throw( RuntimeException )
+{
+ LOG_ASSERT( sal_False, "Desktop::disposing()\nNot implemented yet!\n" )
+}
+
+//*****************************************************************************************************************
+// protected method
+//*****************************************************************************************************************
+void Desktop::impl_resetObject()
+{
+}
+
+//*****************************************************************************************************************
+// OPropertySetHelper
+//*****************************************************************************************************************
+sal_Bool SAL_CALL Desktop::convertFastPropertyValue( Any& aConvertedValue ,
+ Any& aOldValue ,
+ sal_Int32 nHandle ,
+ const Any& aValue ) throw( IllegalArgumentException )
+{
+ // Ready for multithreading
+ LOCK_MUTEX( aGuard, m_aMutex, "Desktop::convertFastPropertyValue()" )
+
+ // Check, if value of property will changed in method "setFastPropertyValue_NoBroadcast()".
+ // Return TRUE, if changed - else return FALSE.
+ // Attention:
+ // Method "impl_tryToChangeProperty()" can throw the IllegalArgumentException !!!
+
+ // Initialize state with FALSE !!!
+ // (Handle can be invalid)
+ sal_Bool bReturn = sal_False;
+
+ switch ( nHandle )
+ {
+ case PROPERTYHANDLE_ACTIVECOMPONENT :
+ case PROPERTYHANDLE_ACTIVEFRAME :
+ case PROPERTYHANDLE_ISPLUGGED :
+ case PROPERTYHANDLE_ISOLOCALE : bReturn = sal_False; // These variables are readonly(!) and can't be changed.
+ break;
+ case PROPERTYHANDLE_HASBEAMER : bReturn = impl_tryToChangeProperty( m_bHasBeamer , aValue, aOldValue, aConvertedValue );
+ break;
+ case PROPERTYHANDLE_HASCOMMONTASKBAR : bReturn = impl_tryToChangeProperty( m_bHasCommonTaskBar , aValue, aOldValue, aConvertedValue );
+ break;
+ case PROPERTYHANDLE_HASDESIGNER : bReturn = impl_tryToChangeProperty( m_bHasDesigner , aValue, aOldValue, aConvertedValue );
+ break;
+ case PROPERTYHANDLE_HASEXPLORER : bReturn = impl_tryToChangeProperty( m_bHasExplorer , aValue, aOldValue, aConvertedValue );
+ break;
+ case PROPERTYHANDLE_HASFUNCTIONBAR : bReturn = impl_tryToChangeProperty( m_bHasFunctionBar , aValue, aOldValue, aConvertedValue );
+ break;
+ case PROPERTYHANDLE_HASMACROBAR : bReturn = impl_tryToChangeProperty( m_bHasMacroBar , aValue, aOldValue, aConvertedValue );
+ break;
+ case PROPERTYHANDLE_HASNAVIGATOR : bReturn = impl_tryToChangeProperty( m_bHasNavigator , aValue, aOldValue, aConvertedValue );
+ break;
+ case PROPERTYHANDLE_HASOBJECTBAR : bReturn = impl_tryToChangeProperty( m_bHasObjectBar , aValue, aOldValue, aConvertedValue );
+ break;
+ case PROPERTYHANDLE_HASOPTIONBAR : bReturn = impl_tryToChangeProperty( m_bHasOptionBar , aValue, aOldValue, aConvertedValue );
+ break;
+ case PROPERTYHANDLE_HASSTATUSBAR : bReturn = impl_tryToChangeProperty( m_bHasStatusBar , aValue, aOldValue, aConvertedValue );
+ break;
+ case PROPERTYHANDLE_HASTOOLBAR : bReturn = impl_tryToChangeProperty( m_bHasToolbar , aValue, aOldValue, aConvertedValue );
+ break;
+ }
+
+ // Return state of operation.
+ return bReturn ;
+}
+
+//*****************************************************************************************************************
+// OPropertySetHelper
+//*****************************************************************************************************************
+void SAL_CALL Desktop::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle ,
+ const Any& aValue ) throw( Exception )
+{
+ // Ready for multithreading
+ LOCK_MUTEX( aGuard, m_aMutex, "Desktop::setFastPropertyValue_NoBroadCast()" )
+
+ // Search for right handle ... and try to set property value.
+ switch ( nHandle )
+ {
+ case PROPERTYHANDLE_ACTIVECOMPONENT :
+ case PROPERTYHANDLE_ACTIVEFRAME :
+ case PROPERTYHANDLE_ISPLUGGED :
+ case PROPERTYHANDLE_ISOLOCALE : LOG_ASSERT( sal_False, "Desktop::setFastPropertyValue_NoBroadcast()\nSet of readonly property not allowed.\n" )
+ break;
+ case PROPERTYHANDLE_HASBEAMER : aValue >>= m_bHasBeamer ;
+ break;
+ case PROPERTYHANDLE_HASCOMMONTASKBAR : aValue >>= m_bHasCommonTaskBar ;
+ break;
+ case PROPERTYHANDLE_HASDESIGNER : aValue >>= m_bHasDesigner ;
+ break;
+ case PROPERTYHANDLE_HASEXPLORER : aValue >>= m_bHasExplorer ;
+ break;
+ case PROPERTYHANDLE_HASFUNCTIONBAR : aValue >>= m_bHasFunctionBar ;
+ break;
+ case PROPERTYHANDLE_HASMACROBAR : aValue >>= m_bHasMacroBar ;
+ break;
+ case PROPERTYHANDLE_HASNAVIGATOR : aValue >>= m_bHasNavigator ;
+ break;
+ case PROPERTYHANDLE_HASOBJECTBAR : aValue >>= m_bHasObjectBar ;
+ break;
+ case PROPERTYHANDLE_HASOPTIONBAR : aValue >>= m_bHasOptionBar ;
+ break;
+ case PROPERTYHANDLE_HASSTATUSBAR : aValue >>= m_bHasStatusBar ;
+ break;
+ case PROPERTYHANDLE_HASTOOLBAR : aValue >>= m_bHasToolbar ;
+ break;
+ }
+}
+
+//*****************************************************************************************************************
+// OPropertySetHelper
+//*****************************************************************************************************************
+void SAL_CALL Desktop::getFastPropertyValue( Any& aValue ,
+ sal_Int32 nHandle ) const
+{
+ // Ready for multithreading
+ LOCK_GLOBALMUTEX( aGuard, "Desktop::getFastPropertyValue()" )
+
+ // Search for right handle ... and try to set property value.
+ switch ( nHandle )
+ {
+ case PROPERTYHANDLE_ACTIVECOMPONENT : //aValue <<= getCurrentComponent();
+ aValue <<= Reference< XComponent >();
+ break;
+ case PROPERTYHANDLE_ACTIVEFRAME : aValue <<= m_aChildTaskContainer.getActive();
+ break;
+ case PROPERTYHANDLE_HASBEAMER : aValue <<= m_bHasBeamer ;
+ break;
+ case PROPERTYHANDLE_HASCOMMONTASKBAR : aValue <<= m_bHasCommonTaskBar ;
+ break;
+ case PROPERTYHANDLE_HASDESIGNER : aValue <<= m_bHasDesigner ;
+ break;
+ case PROPERTYHANDLE_HASEXPLORER : aValue <<= m_bHasExplorer ;
+ break;
+ case PROPERTYHANDLE_HASFUNCTIONBAR : aValue <<= m_bHasFunctionBar ;
+ break;
+ case PROPERTYHANDLE_HASMACROBAR : aValue <<= m_bHasMacroBar ;
+ break;
+ case PROPERTYHANDLE_HASNAVIGATOR : aValue <<= m_bHasNavigator ;
+ break;
+ case PROPERTYHANDLE_HASOBJECTBAR : aValue <<= m_bHasObjectBar ;
+ break;
+ case PROPERTYHANDLE_HASOPTIONBAR : aValue <<= m_bHasOptionBar ;
+ break;
+ case PROPERTYHANDLE_HASSTATUSBAR : aValue <<= m_bHasStatusBar ;
+ break;
+ case PROPERTYHANDLE_HASTOOLBAR : aValue <<= m_bHasToolbar ;
+ break;
+ case PROPERTYHANDLE_ISOLOCALE : aValue <<= m_aISOLocale ;
+ break;
+ case PROPERTYHANDLE_ISPLUGGED : {
+//TODO! sal_Bool bState = impl_checkPlugInState();
+//We can't ask a non const method from these one! aValue <<= bState;
+ aValue <<= sal_False;
+ }
+ break;
+ }
+}
+
+//*****************************************************************************************************************
+// OPropertySetHelper
+//*****************************************************************************************************************
+IPropertyArrayHelper& SAL_CALL Desktop::getInfoHelper()
+{
+ // Optimize this method !
+ // We initialize a static variable only one time. And we don't must use a mutex at every call!
+ // For the first call; pInfoHelper is NULL - for the second call pInfoHelper is different from NULL!
+ static OPropertyArrayHelper* pInfoHelper = NULL;
+
+ if ( pInfoHelper == NULL )
+ {
+ // Ready for multithreading
+ LOCK_GLOBALMUTEX( aGuard, "Desktop::getInfoHelper()" )
+ // Control this pointer again, another instance can be faster then these!
+ if ( pInfoHelper == NULL )
+ {
+ // Define static member to give structure of properties to baseclass "OPropertySetHelper".
+ // "impl_getStaticPropertyDescriptor" is a non exported and static funtion, who will define a static propertytable.
+ // "sal_True" say: Table is sorted by name.
+ static OPropertyArrayHelper aInfoHelper( impl_getStaticPropertyDescriptor(), sal_True );
+ pInfoHelper = &aInfoHelper;
+ }
+ }
+
+ return (*pInfoHelper);
+}
+
+//*****************************************************************************************************************
+// OPropertySetHelper
+//*****************************************************************************************************************
+Reference< XPropertySetInfo > SAL_CALL Desktop::getPropertySetInfo ()
+{
+ // Optimize this method !
+ // We initialize a static variable only one time. And we don't must use a mutex at every call!
+ // For the first call; pInfo is NULL - for the second call pInfo is different from NULL!
+ static Reference< XPropertySetInfo >* pInfo = NULL ;
+
+ if ( pInfo == NULL )
+ {
+ // Ready for multithreading
+ LOCK_GLOBALMUTEX( aGuard, "Desktop::getPropertySetInfo()" )
+ // Control this pointer again, another instance can be faster then these!
+ if ( pInfo == NULL )
+ {
+ // Create structure of propertysetinfo for baseclass "OPropertySetHelper".
+ // (Use method "getInfoHelper()".)
+ static Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ pInfo = &xInfo;
+ }
+ }
+
+ return (*pInfo);
+}
+
+//*****************************************************************************************************************
+// private method
+//*****************************************************************************************************************
+Reference< XComponent > Desktop::impl_getFrameComponent( const Reference< XFrame >& xFrame ) const
+{
+ // Set default return value, if method failed.
+ Reference< XComponent > xComponent = Reference< XComponent >();
+ // Does no controller exists?
+ Reference< XController > xController = xFrame->getController();
+ if ( xController.is() == sal_False )
+ {
+ // Controller not exist - use the VCL-component.
+ xComponent = Reference< XComponent >( xFrame->getComponentWindow(), UNO_QUERY );
+ }
+ else
+ {
+ // Does no model exists?
+ Reference< XModel > xModel( xController->getModel(), UNO_QUERY );
+ if ( xModel.is() == sal_True )
+ {
+ // Model exist - use the model as component.
+ xComponent = Reference< XComponent >( xModel, UNO_QUERY );
+ }
+ else
+ {
+ // Model not exist - use the controller as component.
+ xComponent = Reference< XComponent >( xController, UNO_QUERY );
+ }
+ }
+
+ return xComponent;
+}
+
+//*****************************************************************************************************************
+// private method
+//*****************************************************************************************************************
+sal_Bool Desktop::impl_tryToChangeProperty( sal_Bool bProperty ,
+ const Any& aNewValue ,
+ Any& aOldValue ,
+ Any& aConvertedValue ) throw( IllegalArgumentException )
+{
+ // Set default return value.
+ sal_Bool bReturn = sal_False;
+
+ // Clear information of return parameter!
+ aOldValue.clear();
+ aConvertedValue.clear();
+
+ // Get new value from any.
+ // IllegalArgumentException() can be thrown!
+ sal_Bool bNewValue;
+ convertPropertyValue( bNewValue, aNewValue );
+
+ // If value change ...
+ if ( bNewValue != bProperty )
+ {
+ // ... set information of change.
+ // Attention: Use setValue and getCppuBooleanType to set value in any!
+ // It's necessary, if BOOL can be int or char.
+ aOldValue.setValue ( &bProperty, ::getCppuBooleanType() );
+ aConvertedValue.setValue( &bNewValue, ::getCppuBooleanType() );
+ // Return OK - "value will be change ..."
+ bReturn = sal_True;
+ }
+
+ return bReturn;
+}
+
+//*****************************************************************************************************************
+// private method
+//*****************************************************************************************************************
+const Sequence< Property > Desktop::impl_getStaticPropertyDescriptor()
+{
+ // Create a new static property array to initialize sequence!
+ // Table of all predefined properties of this class. Its used from OPropertySetHelper-class!
+ // Don't forget to change the defines (see begin of this file), if you add, change or delete a property in this list!!!
+ // It's necessary for methods of OPropertySetHelper.
+ // ATTENTION:
+ // YOU MUST SORT FOLLOW TABLE BY NAME !!!
+
+ static const Property pPropertys[] =
+ {
+ Property( PROPERTYNAME_ACTIVECOMPONENT , PROPERTYHANDLE_ACTIVECOMPONENT , ::getCppuType((const Reference< XComponent >*)NULL) , PropertyAttribute::TRANSIENT | PropertyAttribute::READONLY),
+ Property( PROPERTYNAME_ACTIVEFRAME , PROPERTYHANDLE_ACTIVEFRAME , ::getCppuType((const Reference< XComponent >*)NULL) , PropertyAttribute::TRANSIENT | PropertyAttribute::READONLY),
+ Property( PROPERTYNAME_HASBEAMER , PROPERTYHANDLE_HASBEAMER , ::getBooleanCppuType() , PropertyAttribute::TRANSIENT ),
+ Property( PROPERTYNAME_HASCOMMONTASKBAR , PROPERTYHANDLE_HASCOMMONTASKBAR , ::getBooleanCppuType() , PropertyAttribute::TRANSIENT ),
+ Property( PROPERTYNAME_HASDESIGNER , PROPERTYHANDLE_HASDESIGNER , ::getBooleanCppuType() , PropertyAttribute::TRANSIENT ),
+ Property( PROPERTYNAME_HASEXPLORER , PROPERTYHANDLE_HASEXPLORER , ::getBooleanCppuType() , PropertyAttribute::TRANSIENT ),
+ Property( PROPERTYNAME_HASFUNCTIONBAR , PROPERTYHANDLE_HASFUNCTIONBAR , ::getBooleanCppuType() , PropertyAttribute::TRANSIENT ),
+ Property( PROPERTYNAME_HASMACROBAR , PROPERTYHANDLE_HASMACROBAR , ::getBooleanCppuType() , PropertyAttribute::TRANSIENT ),
+ Property( PROPERTYNAME_HASNAVIGATOR , PROPERTYHANDLE_HASNAVIGATOR , ::getBooleanCppuType() , PropertyAttribute::TRANSIENT ),
+ Property( PROPERTYNAME_HASOBJECTBAR , PROPERTYHANDLE_HASOBJECTBAR , ::getBooleanCppuType() , PropertyAttribute::TRANSIENT ),
+ Property( PROPERTYNAME_HASOPTIONBAR , PROPERTYHANDLE_HASOPTIONBAR , ::getBooleanCppuType() , PropertyAttribute::TRANSIENT ),
+ Property( PROPERTYNAME_HASSTATUSBAR , PROPERTYHANDLE_HASSTATUSBAR , ::getBooleanCppuType() , PropertyAttribute::TRANSIENT ),
+ Property( PROPERTYNAME_HASTOOLBAR , PROPERTYHANDLE_HASTOOLBAR , ::getBooleanCppuType() , PropertyAttribute::TRANSIENT ),
+ Property( PROPERTYNAME_ISOLOCALE , PROPERTYHANDLE_ISOLOCALE , ::getCppuType((const Locale*)NULL) , PropertyAttribute::TRANSIENT | PropertyAttribute::READONLY),
+ Property( PROPERTYNAME_ISPLUGGED , PROPERTYHANDLE_ISPLUGGED , ::getBooleanCppuType() , PropertyAttribute::TRANSIENT | PropertyAttribute::READONLY),
+ };
+ // Use it to initialize sequence!
+ static const Sequence< Property > seqPropertyDescriptor( pPropertys, PROPERTYCOUNT );
+ // Return static "PropertyDescriptor"
+ return seqPropertyDescriptor ;
+}
+
+//*****************************************************************************************************************
+// private method
+//*****************************************************************************************************************
+void Desktop::impl_sendQueryTerminationEvent() throw( TerminationVetoException )
+{
+ // Send QueryTermination event to all listener.
+ // Get container for right listener.
+ OInterfaceContainerHelper* pContainer = m_aListenerContainer.getContainer( ::getCppuType( ( const Reference< XTerminateListener >*) NULL ) );
+ if( pContainer != NULL )
+ {
+ // Build QueryTermination event.
+ EventObject aEvent( (OWeakObject*)this );
+ // Get iterator for access to listener.
+ OInterfaceIteratorHelper aIterator( *pContainer );
+ // Send message to all listener.
+ // Somewhere can throw a TerminationVetoException.
+ // We don't look for that(!) ... caller of this method will catch these.
+ while( aIterator.hasMoreElements() == sal_True )
+ {
+ ((XTerminateListener*)aIterator.next())->queryTermination( aEvent );
+ }
+ }
+}
+
+//*****************************************************************************************************************
+// private method
+//*****************************************************************************************************************
+void Desktop::impl_sendNotifyTerminationEvent()
+{
+ // Send NotifyTermination event to all listener.
+ // Get container for right listener.
+ OInterfaceContainerHelper* pContainer = m_aListenerContainer.getContainer( ::getCppuType( ( const Reference< XTerminateListener >*) NULL ) );
+ if( pContainer != NULL )
+ {
+ // Build QueryTermination event.
+ EventObject aEvent( (OWeakObject*)this );
+ // Get iterator for access to listener.
+ OInterfaceIteratorHelper aIterator( *pContainer );
+ // Send message to all listener.
+ while( aIterator.hasMoreElements() == sal_True )
+ {
+ ((XTerminateListener*)aIterator.next())->notifyTermination( aEvent );
+ }
+ }
+}
+
+//*****************************************************************************************************************
+// private method
+//*****************************************************************************************************************
+sal_Bool Desktop::impl_checkPlugInState()
+{
+ // set default return value if search failed or no plugin could be detected.
+ sal_Bool bReturn = sal_False;
+
+ // We must search at ouer childs. We make a deep search.
+ // Lock the container. Nobody should append or remove elements during next time.
+ // But don't forget to unlock it again!
+ m_aChildTaskContainer.lock();
+ // Break loop, if something was found or all container items was compared.
+ sal_uInt32 nCount = m_aChildTaskContainer.getCount();
+ sal_uInt32 nPosition = 0;
+ while (
+ ( bReturn == sal_False ) &&
+ ( nPosition < nCount )
+ )
+ {
+ Reference< XPluginInstance > xPlugInFrame( m_aChildTaskContainer[nPosition], UNO_QUERY );
+ bReturn = xPlugInFrame.is();
+ ++nPosition;
+ }
+ // Don't forget to unlock the container!
+ m_aChildTaskContainer.unlock();
+
+ return bReturn;
+}
+
+//_________________________________________________________________________________________________________________
+// debug methods
+//_________________________________________________________________________________________________________________
+
+/*-----------------------------------------------------------------------------------------------------------------
+ The follow methods checks the parameter for other functions. If a parameter or his value is non valid,
+ we return "sal_False". (else sal_True) This mechanism is used to throw an ASSERT!
+
+ ATTENTION
+
+ If you miss a test for one of this parameters, contact the autor or add it himself !(?)
+ But ... look for right testing! See using of this methods!
+-----------------------------------------------------------------------------------------------------------------*/
+
+#ifdef ENABLE_ASSERTIONS
+
+//*****************************************************************************************************************
+// We work with valid servicemanager only.
+sal_Bool Desktop::impldbg_checkParameter_DesktopCtor( const Reference< XMultiServiceFactory >& xFactory )
+{
+ // Set default return value.
+ sal_Bool bOK = sal_True;
+ // Check parameter.
+ if (
+ ( &xFactory == NULL ) ||
+ ( xFactory.is() == sal_False )
+ )
+ {
+ bOK = sal_False ;
+ }
+ // Return result of check.
+ return bOK ;
+}
+
+//*****************************************************************************************************************
+// We work with valid listener only.
+sal_Bool Desktop::impldbg_checkParameter_addTerminateListener( const Reference< XTerminateListener >& xListener )
+{
+ // Set default return value.
+ sal_Bool bOK = sal_True;
+ // Check parameter.
+ if (
+ ( &xListener == NULL ) ||
+ ( xListener.is() == sal_False )
+ )
+ {
+ bOK = sal_False ;
+ }
+ // Return result of check.
+ return bOK ;
+}
+
+//*****************************************************************************************************************
+// We work with valid listener only.
+sal_Bool Desktop::impldbg_checkParameter_removeTerminateListener( const Reference< XTerminateListener >& xListener )
+{
+ // Set default return value.
+ sal_Bool bOK = sal_True;
+ // Check parameter.
+ if (
+ ( &xListener == NULL ) ||
+ ( xListener.is() == sal_False )
+ )
+ {
+ bOK = sal_False ;
+ }
+ // Return result of check.
+ return bOK ;
+}
+
+//*****************************************************************************************************************
+// We need a url to work. But the target frame name and arguments are optional.
+// Flags must in range of right enum!
+sal_Bool Desktop::impldbg_checkParameter_loadComponentFromURL( const OUString& sURL ,
+ const OUString& sTargetFrameName,
+ sal_Int32 nSearchFlags ,
+ const Sequence< PropertyValue >& seqArguments )
+{
+ // Set default return value.
+ sal_Bool bOK = sal_True;
+ // Check parameter.
+ if (
+ ( &sURL == NULL ) ||
+ ( &sTargetFrameName == NULL ) ||
+ ( &seqArguments == NULL ) ||
+ ( sURL.getLength() < 1 ) ||
+ (
+ ( nSearchFlags != FrameSearchFlag::AUTO ) &&
+ ( !( nSearchFlags & FrameSearchFlag::PARENT ) ) &&
+ ( !( nSearchFlags & FrameSearchFlag::SELF ) ) &&
+ ( !( nSearchFlags & FrameSearchFlag::CHILDREN ) ) &&
+ ( !( nSearchFlags & FrameSearchFlag::CREATE ) ) &&
+ ( !( nSearchFlags & FrameSearchFlag::SIBLINGS ) ) &&
+ ( !( nSearchFlags & FrameSearchFlag::TASKS ) ) &&
+ ( !( nSearchFlags & FrameSearchFlag::ALL ) ) &&
+ ( !( nSearchFlags & FrameSearchFlag::GLOBAL ) )
+ )
+ )
+ {
+ bOK = sal_False ;
+ }
+ // Return result of check.
+ return bOK ;
+}
+
+//*****************************************************************************************************************
+// We need a url to work. But the target frame name is optional.
+// Flags must in range of right enum!
+sal_Bool Desktop::impldbg_checkParameter_queryDispatch( const URL& aURL ,
+ const OUString& sTargetFrameName,
+ sal_Int32 nSearchFlags )
+{
+ // Set default return value.
+ sal_Bool bOK = sal_True;
+ // Check parameter.
+ if (
+ ( &aURL == NULL ) ||
+ ( &sTargetFrameName == NULL ) ||
+ ( aURL.Complete.getLength() < 1 ) ||
+ (
+ ( nSearchFlags != FrameSearchFlag::AUTO ) &&
+ ( !( nSearchFlags & FrameSearchFlag::PARENT ) ) &&
+ ( !( nSearchFlags & FrameSearchFlag::SELF ) ) &&
+ ( !( nSearchFlags & FrameSearchFlag::CHILDREN ) ) &&
+ ( !( nSearchFlags & FrameSearchFlag::CREATE ) ) &&
+ ( !( nSearchFlags & FrameSearchFlag::SIBLINGS ) ) &&
+ ( !( nSearchFlags & FrameSearchFlag::TASKS ) ) &&
+ ( !( nSearchFlags & FrameSearchFlag::ALL ) ) &&
+ ( !( nSearchFlags & FrameSearchFlag::GLOBAL ) )
+ )
+ )
+ {
+ bOK = sal_False ;
+ }
+ // Return result of check.
+ return bOK ;
+}
+
+//*****************************************************************************************************************
+// The traget frame name is optional, but flags must be in range of right enum.
+sal_Bool Desktop::impldbg_checkParameter_findFrame( const OUString& sTargetFrameName,
+ sal_Int32 nSearchFlags )
+{
+ // Set default return value.
+ sal_Bool bOK = sal_True;
+ // Check parameter.
+ if (
+ ( &sTargetFrameName == NULL ) ||
+ (
+ ( nSearchFlags != FrameSearchFlag::AUTO ) &&
+ ( !( nSearchFlags & FrameSearchFlag::PARENT ) ) &&
+ ( !( nSearchFlags & FrameSearchFlag::SELF ) ) &&
+ ( !( nSearchFlags & FrameSearchFlag::CHILDREN ) ) &&
+ ( !( nSearchFlags & FrameSearchFlag::CREATE ) ) &&
+ ( !( nSearchFlags & FrameSearchFlag::SIBLINGS ) ) &&
+ ( !( nSearchFlags & FrameSearchFlag::TASKS ) ) &&
+ ( !( nSearchFlags & FrameSearchFlag::ALL ) ) &&
+ ( !( nSearchFlags & FrameSearchFlag::GLOBAL ) )
+ )
+ )
+ {
+ bOK = sal_False ;
+ }
+ // Return result of check.
+ return bOK ;
+}
+
+//*****************************************************************************************************************
+// We work with valid listener only.
+sal_Bool Desktop::impldbg_checkParameter_addFrameActionListener( const Reference< XFrameActionListener >& xListener )
+{
+ // Set default return value.
+ sal_Bool bOK = sal_True;
+
+ // Check parameter.
+ if (
+ ( &xListener == NULL ) ||
+ ( xListener.is() == sal_False )
+ )
+ {
+ bOK = sal_False ;
+ }
+
+ // Return result of check.
+ return bOK ;
+}
+
+//*****************************************************************************************************************
+// We work with valid listener only.
+sal_Bool Desktop::impldbg_checkParameter_removeFrameActionListener( const Reference< XFrameActionListener >& xListener )
+{
+ // Set default return value.
+ sal_Bool bOK = sal_True;
+
+ // Check parameter.
+ if (
+ ( &xListener == NULL ) ||
+ ( xListener.is() == sal_False )
+ )
+ {
+ bOK = sal_False ;
+ }
+
+ // Return result of check.
+ return bOK ;
+}
+
+//*****************************************************************************************************************
+// We work with valid listener only.
+sal_Bool Desktop::impldbg_checkParameter_addEventListener( const Reference< XEventListener >& xListener )
+{
+ // Set default return value.
+ sal_Bool bOK = sal_True;
+
+ // Check parameter.
+ if (
+ ( &xListener == NULL ) ||
+ ( xListener.is() == sal_False )
+ )
+ {
+ bOK = sal_False ;
+ }
+
+ // Return result of check.
+ return bOK ;
+}
+
+//*****************************************************************************************************************
+// We work with valid listener only.
+sal_Bool Desktop::impldbg_checkParameter_removeEventListener( const Reference< XEventListener >& xListener )
+{
+ // Set default return value.
+ sal_Bool bOK = sal_True;
+
+ // Check parameter.
+ if (
+ ( &xListener == NULL ) ||
+ ( xListener.is() == sal_False )
+ )
+ {
+ bOK = sal_False ;
+ }
+
+ // Return result of check.
+ return bOK ;
+}
+
+//*****************************************************************************************************************
+sal_Bool Desktop::impldbg_checkParameter_statusChanged( const FeatureStateEvent& aEvent )
+{
+ // Set default return value.
+ sal_Bool bOK = sal_True;
+ // Check parameter.
+ if (
+ ( &aEvent == NULL ) ||
+ ( aEvent.FeatureDescriptor.getLength() < 1 )
+ )
+ {
+ bOK = sal_False ;
+ }
+ // Return result of check.
+ return bOK ;
+}
+
+//*****************************************************************************************************************
+sal_Bool Desktop::impldbg_checkParameter_disposing( const EventObject& aSource )
+{
+ // Set default return value.
+ sal_Bool bOK = sal_True;
+ // Check parameter.
+ if (
+ ( &aSource == NULL ) ||
+ ( aSource.Source.is() == sal_False )
+ )
+ {
+ bOK = sal_False ;
+ }
+ // Return result of check.
+ return bOK ;
+}
+
+#endif // #ifdef ENABLE_ASSERTIONS
+
+/*-----------------------------------------------------------------------------------------------------------------
+ Follow method is used to print out the content of current container.
+ Use this to get information about the tree.
+-----------------------------------------------------------------------------------------------------------------*/
+
+#ifdef ENABLE_SERVICEDEBUG // Is defined in debug version only.
+
+//*****************************************************************************************************************
+OUString Desktop::impldbg_getTreeNames()
+{
+ // We start from here (the top) to bottom.
+ // Create an "empty stream" with enough place for ouer own container informations.
+ OUStringBuffer sOutPut(1024);
+
+ // Start with level 0! We are on the top.
+ sal_Int16 nLevel = 0;
+
+ // Add my own information to stream.
+ // Format of output : "<Level*TAB>[<level>:<name>:<extra informations>]\n"
+ sOutPut.appendAscii( "[0:\"" );
+ sOutPut.append( m_sName );
+ sOutPut.appendAscii( "\":ACTIVE]\n" );
+
+ // Then start with ouer own container.
+ // We must lock the container, to have exclusiv access to elements!
+ m_aChildTaskContainer.lock();
+ // Step over all elements in current container and add names.
+ sal_uInt32 nCount = m_aChildTaskContainer.getCount();
+ for ( sal_uInt32 nPosition=0; nPosition<nCount; ++nPosition )
+ {
+ // Step during tree deep first - from the left site to the right one.
+ // Print subtree of this child to stream!
+ Reference< XFrame > xItem = m_aChildTaskContainer[nPosition];
+ Reference< XSPECIALDEBUGINTERFACE > xDebug( xItem, UNO_QUERY );
+ sOutPut.append( xDebug->dumpVariable( DUMPVARIABLE_TREEINFO, nLevel+1 ) );
+ }
+ // Don't forget to unlock the container!
+ m_aChildTaskContainer.unlock();
+
+ // Now we have anough informations about tree.
+ // Return it to caller. He must print this informations!
+ return sOutPut.makeStringAndClear();
+}
+
+#endif // #ifdef ENABLE_SERVICEDEBUG
+
+} // namespace framework
diff --git a/framework/source/services/frame.cxx b/framework/source/services/frame.cxx
index ba5e438be9cf..bfe107b06fd1 100644
--- a/framework/source/services/frame.cxx
+++ b/framework/source/services/frame.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: frame.cxx,v $
*
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
*
- * last change: $Author: as $ $Date: 2000-10-23 13:56:44 $
+ * last change: $Author: as $ $Date: 2000-11-23 14:52:10 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -135,13 +135,33 @@
#include <rtl/ustrbuf.hxx>
#endif
+/*HACK for vcl and toolkit! ---------------------------------------------------------------------------------------*/
+
+#ifndef _SV_SVAPP_HXX
+#include <vcl/svapp.hxx>
+#endif
+
+#ifndef _SV_WINDOW_HXX
+#include <vcl/window.hxx>
+#endif
+
+#ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_
+#include <toolkit/helper/vclunohelper.hxx>
+#endif
+
+#ifndef _TOOLKIT_AWT_VCLXWINDOW_HXX_
+#include <toolkit/awt/vclxwindow.hxx>
+#endif
+
+/*HACK for vcl and toolkit! ---------------------------------------------------------------------------------------*/
+
//_________________________________________________________________________________________________________________
// namespace
//_________________________________________________________________________________________________________________
namespace framework{
-using namespace ::com::sun::star::awt ;
+using namespace ::com::sun::star ;
using namespace ::com::sun::star::beans ;
using namespace ::com::sun::star::container ;
using namespace ::com::sun::star::frame ;
@@ -249,10 +269,10 @@ DEFINE_XINTERFACE_13 ( Frame
DIRECT_INTERFACE(XDispatchProvider ),
DIRECT_INTERFACE(XDispatchProviderInterception ),
DIRECT_INTERFACE(XBrowseHistoryRegistry ),
- DIRECT_INTERFACE(XWindowListener ),
- DIRECT_INTERFACE(XTopWindowListener ),
- DIRECT_INTERFACE(XFocusListener ),
- DERIVED_INTERFACE(XEventListener, XWindowListener )
+ DIRECT_INTERFACE(awt::XWindowListener ),
+ DIRECT_INTERFACE(awt::XTopWindowListener ),
+ DIRECT_INTERFACE(awt::XFocusListener ),
+ DERIVED_INTERFACE(XEventListener, awt::XWindowListener )
)
DEFINE_XTYPEPROVIDER_13 ( Frame ,
@@ -265,9 +285,9 @@ DEFINE_XTYPEPROVIDER_13 ( Frame ,
XDispatchProvider ,
XDispatchProviderInterception ,
XBrowseHistoryRegistry ,
- XWindowListener ,
- XTopWindowListener ,
- XFocusListener ,
+ awt::XWindowListener ,
+ awt::XTopWindowListener ,
+ awt::XFocusListener ,
XEventListener
)
@@ -404,7 +424,7 @@ void SAL_CALL Frame::createNewEntry( const OUString& sURL
//*****************************************************************************************************************
// XWindowListener
//*****************************************************************************************************************
-void SAL_CALL Frame::windowResized( const WindowEvent& aEvent ) throw( RuntimeException )
+void SAL_CALL Frame::windowResized( const awt::WindowEvent& aEvent ) throw( RuntimeException )
{
// Ready for multithreading
LOCK_MUTEX( aGuard, m_aMutex, "Frame::windowResized()" )
@@ -418,7 +438,7 @@ void SAL_CALL Frame::windowResized( const WindowEvent& aEvent ) throw( RuntimeEx
//*****************************************************************************************************************
// XWindowListener
//*****************************************************************************************************************
-void SAL_CALL Frame::windowMoved( const WindowEvent& aEvent ) throw( RuntimeException )
+void SAL_CALL Frame::windowMoved( const awt::WindowEvent& aEvent ) throw( RuntimeException )
{
}
@@ -494,12 +514,66 @@ void SAL_CALL Frame::windowActivated( const EventObject& aEvent ) throw( Runtime
//*****************************************************************************************************************
void SAL_CALL Frame::windowDeactivated( const EventObject& aEvent ) throw( RuntimeException )
{
+/*HACK for vcl and toolkit! ---------------------------------------------------------------------------------------*/
+
+ if ( m_eActiveState == ACTIVE )
+ {
+ LOCK_MUTEX( aGuard, m_aMutex, "Frame::windowDeactivated()" )
+ // Safe impossible cases
+ LOG_ASSERT( impldbg_checkParameter_windowDeactivated( aEvent ), "Frame::windowDeactivated()\nInvalid parameter detected.\n" )
+
+ // Deactivation is always done implicitely by activation of another frame.
+ // Only if no activation is done, deactivations have to be processed if the activated window
+ // is a parent window of the last active Window!
+ Reference< awt::XWindowPeer > xOwnWindow ( m_xContainerWindow, UNO_QUERY );
+ Window* pFocusWindow = Application::GetFocusWindow();
+ if (
+ ( xOwnWindow.is() == sal_True ) &&
+ ( pFocusWindow != NULL ) &&
+ ( m_xParent.is() == sal_True )
+ )
+ {
+ Reference< awt::XWindow > xParentWindow = m_xParent->getContainerWindow() ;
+ VCLXWindow* pOwnWindow = (VCLXWindow*)VCLUnoHelper::GetWindow( xOwnWindow ) ;
+ VCLXWindow* pParentWindow = (VCLXWindow*)VCLUnoHelper::GetWindow( xParentWindow) ;
+
+ if (
+ ( pFocusWindow->IsChild( pOwnWindow->GetWindow() ) == sal_True ) && // new focus window is one of my parents AND
+ (
+ ( pParentWindow == NULL ) || // my parent window not exist OR
+ ( pFocusWindow->IsChild( pParentWindow->GetWindow() ) == sal_False ) // if it exist, it's a child of focus window too.
+ )
+ )
+ {
+ m_xParent->setActiveFrame( Reference< XFrame >() );
+ }
+ }
+ }
+
+/*HACK for vcl and toolkit! ---------------------------------------------------------------------------------------*/
+/*
+ if ( bActive )
+ {
+ // deactivation is always done implicitely by activation of another frame
+ // only if no activation is done, deactivations have to be processed if the activated window
+ // is a parent window of the last active Window
+ XWindowPeerRef aWindow( xWindow, USR_QUERY );
+ Window *pNewWindow = Application::GetFocusWindow();
+ if ( aWindow.is() && pNewWindow && xCreator.is() )
+ {
+ VCLXWindow* pComp = (VCLXWindow*) aWindow->getImplementation( VCLXWindow_getReflection() );
+ VCLXWindow* pParentComp = xCreator->getContainerWindow().is() ? (VCLXWindow*) xCreator->getContainerWindow()->getImplementation( VCLXWindow_getReflection() ) : NULL;
+ if ( pNewWindow->IsChild( pComp->GetWindow() ) && (!pParentComp || !pNewWindow->IsChild( pParentComp->GetWindow() ) ) )
+ xCreator->setActiveFrame( XFrameRef() );
+ }
+ }
+*/
}
//*****************************************************************************************************************
// XFrame
//*****************************************************************************************************************
-void SAL_CALL Frame::initialize( const Reference< XWindow >& xWindow ) throw( RuntimeException )
+void SAL_CALL Frame::initialize( const Reference< awt::XWindow >& xWindow ) throw( RuntimeException )
{
// Ready for multithreading
LOCK_MUTEX( aGuard, m_aMutex, "Frame::initialize()" )
@@ -524,7 +598,7 @@ void SAL_CALL Frame::initialize( const Reference< XWindow >& xWindow ) throw( Ru
//*****************************************************************************************************************
// XFrame
//*****************************************************************************************************************
-Reference< XWindow > SAL_CALL Frame::getContainerWindow() throw( RuntimeException )
+Reference< awt::XWindow > SAL_CALL Frame::getContainerWindow() throw( RuntimeException )
{
// Ready for multithreading
LOCK_MUTEX( aGuard, m_aMutex, "Frame::getContainerWindow()" )
@@ -1108,7 +1182,7 @@ sal_Bool SAL_CALL Frame::isActive() throw( RuntimeException )
//*****************************************************************************************************************
// XFrame
//*****************************************************************************************************************
-sal_Bool SAL_CALL Frame::setComponent( const Reference< XWindow >& xComponentWindow ,
+sal_Bool SAL_CALL Frame::setComponent( const Reference< awt::XWindow >& xComponentWindow ,
const Reference< XController >& xController ) throw( RuntimeException )
{
/* HACK for sfx2! */
@@ -1183,7 +1257,7 @@ sal_Bool SAL_CALL Frame::setComponent( const Reference< XWindow >& xCom
//*****************************************************************************************************************
// XFrame
//*****************************************************************************************************************
-Reference< XWindow > SAL_CALL Frame::getComponentWindow() throw( RuntimeException )
+Reference< awt::XWindow > SAL_CALL Frame::getComponentWindow() throw( RuntimeException )
{
// Ready for multithreading
LOCK_MUTEX( aGuard, m_aMutex, "Frame::getComponentWindow()" )
@@ -1260,16 +1334,8 @@ void SAL_CALL Frame::dispose() throw( RuntimeException )
m_bAlreadyDisposed = sal_True ;
// Send message to all DISPOSE-listener.
impl_sendDisposeEvent();
- // Free memory, release references and ...
- /* // Cancel current loading.
- if ( m_xLoader.is() == sal_True )
- {
- m_xLoader->cancel();
- m_xLoader = Reference< XFrameLoader >();
- }
- */
// Delete current component and controller.
- setComponent( Reference< XWindow >(), Reference< XController >() );
+ setComponent( Reference< awt::XWindow >(), Reference< XController >() );
// Tell all listeners to release this object.
Reference< XFrame > xThis( (OWeakObject*)this, UNO_QUERY );
@@ -1291,7 +1357,7 @@ void SAL_CALL Frame::dispose() throw( RuntimeException )
// If we have our own window ... release it!
if ( m_xContainerWindow.is() == sal_True )
{
- impl_setContainerWindow( Reference< XWindow >() );
+ impl_setContainerWindow( Reference< awt::XWindow >() );
}
// Forget global servicemanager
@@ -1356,14 +1422,14 @@ void SAL_CALL Frame::disposing( const EventObject& aEvent ) throw( RuntimeExcept
// This instance is forced to release references to the specified interfaces by event-source.
if ( aEvent.Source == m_xContainerWindow )
{
- impl_setContainerWindow( Reference< XWindow >() );
+ impl_setContainerWindow( Reference< awt::XWindow >() );
}
}
//*****************************************************************************************************************
// XFocusListener
//*****************************************************************************************************************
-void SAL_CALL Frame::focusGained( const FocusEvent& aEvent ) throw( RuntimeException )
+void SAL_CALL Frame::focusGained( const awt::FocusEvent& aEvent ) throw( RuntimeException )
{
// Ready for multithreading
LOCK_MUTEX( aGuard, m_aMutex, "Frame::focusGained()" )
@@ -1388,7 +1454,7 @@ void SAL_CALL Frame::focusGained( const FocusEvent& aEvent ) throw( RuntimeExcep
//*****************************************************************************************************************
// XFocusListener
//*****************************************************************************************************************
-void SAL_CALL Frame::focusLost( const FocusEvent& aEvent ) throw( RuntimeException )
+void SAL_CALL Frame::focusLost( const awt::FocusEvent& aEvent ) throw( RuntimeException )
{
// Ready for multithreading
LOCK_MUTEX( aGuard, m_aMutex, "Frame::focusLost()" )
@@ -1404,7 +1470,7 @@ void SAL_CALL Frame::focusLost( const FocusEvent& aEvent ) throw( RuntimeExcepti
//*****************************************************************************************************************
// private method
//*****************************************************************************************************************
-void Frame::impl_setContainerWindow( const Reference< XWindow >& xWindow )
+void Frame::impl_setContainerWindow( const Reference< awt::XWindow >& xWindow )
{
// Remove this instance himself from "old" window-listener-container.
if ( m_xContainerWindow.is() == sal_True )
@@ -1414,7 +1480,7 @@ void Frame::impl_setContainerWindow( const Reference< XWindow >& xWindow )
}
// Remember old window; dispose later to avoid flickering.
- Reference< XWindow > xOld = m_xContainerWindow;
+ Reference< awt::XWindow > xOld = m_xContainerWindow;
// Safe new window reference.
m_xContainerWindow = xWindow;
// Dispose old window now.
@@ -1434,7 +1500,7 @@ void Frame::impl_setContainerWindow( const Reference< XWindow >& xWindow )
}
// If new window a on top, register this instance a listener to.
- Reference< XTopWindow > xTopWindow( m_xContainerWindow, UNO_QUERY );
+ Reference< awt::XTopWindow > xTopWindow( m_xContainerWindow, UNO_QUERY );
if ( xTopWindow.is() == sal_True )
{
xTopWindow->addTopWindowListener( this );
@@ -1444,13 +1510,13 @@ void Frame::impl_setContainerWindow( const Reference< XWindow >& xWindow )
//*****************************************************************************************************************
// private method
//*****************************************************************************************************************
-void Frame::impl_setComponentWindow( const Reference< XWindow >& xWindow )
+void Frame::impl_setComponentWindow( const Reference< awt::XWindow >& xWindow )
{
// Work only, if window will changing.
if ( xWindow != m_xComponentWindow )
{
// Remember old component; dispose later to avoid flickering.
- Reference< XWindow > xOld = m_xComponentWindow;
+ Reference< awt::XWindow > xOld = m_xComponentWindow;
// Take the new one.
m_xComponentWindow = xWindow;
// Set correct size before showing the window.
@@ -1576,14 +1642,14 @@ void Frame::impl_resizeComponentWindow()
)
{
// Get reference to his device.
- Reference< XDevice > xDevice( m_xContainerWindow, UNO_QUERY );
+ Reference< awt::XDevice > xDevice( m_xContainerWindow, UNO_QUERY );
// Convert relativ size to output size.
- Rectangle aRectangle = m_xContainerWindow->getPosSize();
- DeviceInfo aInfo = xDevice->getInfo();
- Size aSize ( aRectangle.Width - aInfo.LeftInset - aInfo.RightInset ,
- aRectangle.Height - aInfo.TopInset - aInfo.BottomInset );
+ awt::Rectangle aRectangle = m_xContainerWindow->getPosSize();
+ awt::DeviceInfo aInfo = xDevice->getInfo();
+ awt::Size aSize ( aRectangle.Width - aInfo.LeftInset - aInfo.RightInset ,
+ aRectangle.Height - aInfo.TopInset - aInfo.BottomInset );
// Resize ouer component window.
- m_xComponentWindow->setPosSize( 0, 0, aSize.Width, aSize.Height, PosSize::SIZE );
+ m_xComponentWindow->setPosSize( 0, 0, aSize.Width, aSize.Height, awt::PosSize::SIZE );
}
}
@@ -1746,7 +1812,7 @@ sal_Bool Frame::impldbg_checkParameter_createNewEntry( const OUString&
}
//*****************************************************************************************************************
-sal_Bool Frame::impldbg_checkParameter_windowResized( const WindowEvent& aEvent )
+sal_Bool Frame::impldbg_checkParameter_windowResized( const awt::WindowEvent& aEvent )
{
// Set default return value.
sal_Bool bOK = sal_True;
@@ -1800,7 +1866,7 @@ sal_Bool Frame::impldbg_checkParameter_windowDeactivated( const EventObject& aEv
}
//*****************************************************************************************************************
-sal_Bool Frame::impldbg_checkParameter_initialize( const Reference< XWindow >& xWindow )
+sal_Bool Frame::impldbg_checkParameter_initialize( const Reference< awt::XWindow >& xWindow )
{
// Set default return value.
sal_Bool bOK = sal_True;
@@ -1888,8 +1954,8 @@ sal_Bool Frame::impldbg_checkParameter_findFrame( const OUString& sTargetF
}
//*****************************************************************************************************************
-sal_Bool Frame::impldbg_checkParameter_setComponent( const Reference< XWindow >& xComponentWindow ,
- const Reference< XController >& xController )
+sal_Bool Frame::impldbg_checkParameter_setComponent( const Reference< awt::XWindow >& xComponentWindow ,
+ const Reference< XController >& xController )
{
// Set default return value.
sal_Bool bOK = sal_True;
@@ -2003,7 +2069,7 @@ sal_Bool Frame::impldbg_checkParameter_disposing( const EventObject& aEvent )
}
//*****************************************************************************************************************
-sal_Bool Frame::impldbg_checkParameter_focusGained( const FocusEvent& aEvent )
+sal_Bool Frame::impldbg_checkParameter_focusGained( const awt::FocusEvent& aEvent )
{
// Set default return value.
sal_Bool bOK = sal_True;
@@ -2021,7 +2087,7 @@ sal_Bool Frame::impldbg_checkParameter_focusGained( const FocusEvent& aEvent )
}
//*****************************************************************************************************************
-sal_Bool Frame::impldbg_checkParameter_focusLost( const FocusEvent& aEvent )
+sal_Bool Frame::impldbg_checkParameter_focusLost( const awt::FocusEvent& aEvent )
{
// Set default return value.
sal_Bool bOK = sal_True;
diff --git a/framework/source/services/makefile.mk b/framework/source/services/makefile.mk
index db8bb1e73fbe..20cc7c32bd46 100644
--- a/framework/source/services/makefile.mk
+++ b/framework/source/services/makefile.mk
@@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.1.1.1 $
+# $Revision: 1.2 $
#
-# last change: $Author: hr $ $Date: 2000-09-18 16:29:24 $
+# last change: $Author: as $ $Date: 2000-11-23 14:52:10 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
@@ -76,12 +76,27 @@ BOOTSTRAP_SERVICE= FALSE
# --- Generate -----------------------------------------------------
+.IF "$(TF_FILTER)"!=""
SLOFILES= \
+ $(SLO)$/desktop.obj \
+ $(SLO)$/pluginframe.obj \
$(SLO)$/task.obj \
$(SLO)$/frame.obj \
- $(SLO)$/frameloaderfactory.obj
-
-# $(SLO)$/desktop.obj \
+ $(SLO)$/frameloaderfactory2.obj \
+ $(SLO)$/filterfactory.obj \
+ $(SLO)$/typedetection.obj \
+ $(SLO)$/urltransformer.obj \
+ $(SLO)$/mediatypedetectionhelper.obj
+.ELSE
+SLOFILES= \
+ $(SLO)$/desktop.obj \
+ $(SLO)$/pluginframe.obj \
+ $(SLO)$/task.obj \
+ $(SLO)$/frame.obj \
+ $(SLO)$/frameloaderfactory.obj \
+ $(SLO)$/urltransformer.obj \
+ $(SLO)$/mediatypedetectionhelper.obj
+.ENDIF
# --- Targets ------------------------------------------------------
diff --git a/framework/source/services/mediatypedetectionhelper.cxx b/framework/source/services/mediatypedetectionhelper.cxx
new file mode 100644
index 000000000000..94b2a8867466
--- /dev/null
+++ b/framework/source/services/mediatypedetectionhelper.cxx
@@ -0,0 +1,226 @@
+/*************************************************************************
+ *
+ * $RCSfile: mediatypedetectionhelper.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: as $ $Date: 2000-11-23 14:52:10 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+//_________________________________________________________________________________________________________________
+// my own includes
+//_________________________________________________________________________________________________________________
+
+#ifndef __FRAMEWORK_BAEHSERVICES_MEDIATYPEDETECTIONHELPER_HXX_
+#include <baeh_services/mediatypedetectionhelper.hxx>
+#endif
+
+#ifndef __FRAMEWORK_DEFINES_HXX_
+#include <defines.hxx>
+#endif
+
+#ifndef _INETTYPE_HXX
+#include <svtools/inettype.hxx>
+#endif
+
+#ifndef _STRING_HXX
+#include <tools/string.hxx>
+#endif
+
+//_________________________________________________________________________________________________________________
+// interface includes
+//_________________________________________________________________________________________________________________
+#if !TF_FILTER//MUSTFILTER
+#ifndef _COM_SUN_STAR_FRAME_XFRAMELOADERQUERY_HPP_
+#include <com/sun/star/frame/XFrameLoaderQuery.hpp>
+#endif
+#endif//MUSTFILTER
+//_________________________________________________________________________________________________________________
+// namespace
+//_________________________________________________________________________________________________________________
+
+namespace framework
+{
+
+#if !TF_FILTER//MUSTFILTER
+using namespace ::com::sun::star::frame ;
+#endif//MUSTFILTER
+using namespace ::com::sun::star ;
+using namespace ::rtl ;
+
+//_________________________________________________________________________________________________________________
+// declarations
+//_________________________________________________________________________________________________________________
+
+//*****************************************************************************************************************
+// constructor
+//*****************************************************************************************************************
+MediaTypeDetectionHelper::MediaTypeDetectionHelper( const uno::Reference< lang::XMultiServiceFactory >& xFactory )
+ : m_xFactory( xFactory )
+{
+}
+
+//*****************************************************************************************************************
+// destructor
+//*****************************************************************************************************************
+MediaTypeDetectionHelper::~MediaTypeDetectionHelper()
+{
+}
+
+//*****************************************************************************************************************
+// XInterface, XTypeProvider, XServiceInfo
+//*****************************************************************************************************************
+
+DEFINE_XINTERFACE_3 ( MediaTypeDetectionHelper
+ , OWeakObject
+ , DIRECT_INTERFACE( lang::XTypeProvider )
+ , DIRECT_INTERFACE( lang::XServiceInfo )
+ , DIRECT_INTERFACE( util::XStringMapping )
+ )
+
+DEFINE_XTYPEPROVIDER_3 ( MediaTypeDetectionHelper
+ , lang::XTypeProvider
+ , lang::XServiceInfo
+ , util::XStringMapping
+ )
+
+DEFINE_XSERVICEINFO_ONEINSTANCESERVICE ( MediaTypeDetectionHelper
+ , SERVICENAME_MEDIATYPEDETECTIONHELPER
+ , IMPLEMENTATIONNAME_MEDIATYPEDETECTIONHELPER
+ )
+
+//*****************************************************************************************************************
+// XStringMapping
+//*****************************************************************************************************************
+
+//virtual
+sal_Bool SAL_CALL MediaTypeDetectionHelper::mapStrings(
+ uno::Sequence< OUString >& rSeq )
+ throw(uno::RuntimeException)
+{
+ //osl::Guard aGuard( m_aMutex );
+ //uno::Reference< lang::XMultiServiceFactory > xFactory
+
+ if( !m_xFactory.is() )
+ {
+ LOG_ASSERT( !(m_xFactory.is()==sal_False), "MediaTypeDetectionHelper::mapStrings()\n member m_xFactory( XMultiServiceFactory ) not set\n" )
+ return sal_False;
+ }
+
+#if !TF_FILTER//MUSTFILTER
+ uno::Reference< frame::XFrameLoaderQuery > xQ(
+ m_xFactory->createInstance( SERVICENAME_FRAMELOADERFACTORY ),uno::UNO_QUERY );
+ //IMPLEMENTATIONNAME_FRAMELOADERFACTORY
+
+ if( !xQ.is() )
+ {
+ LOG_ASSERT( !(xQ.is()==sal_False), "MediaTypeDetectionHelper::mapStrings()\n could not get Service FrameLoaderQuery\n" )
+ return sal_False;
+ }
+#endif//MUSTFILTER
+
+ sal_Bool bModified = sal_False;
+ //uno::Sequence< beans::PropertyValue > aTmpSeq(1);
+ //aTmpSeq[0].Name = OUString(RTL_CONSTASCII_USTRINGPARAM("ContentType"));
+ for( sal_Int32 i = rSeq.getLength(); i--; )
+ {
+
+ OUString& rUrl = rSeq[i];
+ INetContentType eType = INetContentTypes::GetContentTypeFromURL( rUrl );
+
+ UniString aType( INetContentTypes::GetContentType( eType ) );
+ if( aType.Len() )
+ {
+ rUrl = aType;
+ bModified = sal_True;
+ }
+ /*
+ OUString aFilter( xQ->searchFilter( rUrl, aTmpSeq ) );
+ if( !aFilter.getLength() )
+ continue;
+ uno::Sequence< beans::PropertyValue > aProps = xQ->getLoaderProperties( aFilter );
+ for( sal_Int32 nN = aProps.getLength(); nN--; )
+ {
+ const beans::PropertyValue& rProp = aProps[nN];
+ if( rProp.Name.compareToAscii("ContentType") == 0 )
+ {
+ rProp.Value >>= rUrl;
+ bModified = sal_True;
+ break;
+ }
+ }
+ */
+ }
+ return bModified;
+}
+
+} // namespace framework
+/*-------------------------------------------------------------------------
+
+ $Log: not supported by cvs2svn $
+ Revision 1.1.1.1 2000/09/18 16:29:23 hr
+ initial import
+
+ Revision 1.4 2000/09/15 15:08:57 willem.vandorp
+ OpenOffice header added.
+
+ Revision 1.3 2000/09/01 13:05:41 as
+ new targeting, new macros, new dispatching ...
+
+ Revision 1.2 2000/07/31 10:13:38 iha
+ typemapping
+
+
+-------------------------------------------------------------------------*/
diff --git a/framework/source/services/urltransformer.cxx b/framework/source/services/urltransformer.cxx
new file mode 100644
index 000000000000..4df427440df0
--- /dev/null
+++ b/framework/source/services/urltransformer.cxx
@@ -0,0 +1,415 @@
+/*************************************************************************
+ *
+ * $RCSfile: urltransformer.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: as $ $Date: 2000-11-23 14:52:10 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+//_________________________________________________________________________________________________________________
+// my own includes
+//_________________________________________________________________________________________________________________
+
+#ifndef __FRAMEWORK_BAEHSERVICES_URLTRANSFORMER_HXX_
+#include <baeh_services/urltransformer.hxx>
+#endif
+
+#ifndef __FRAMEWORK_DEFINES_HXX_
+#include <defines.hxx>
+#endif
+
+#ifndef __FRAMEWORK_MACROS_DEBUG_HXX_
+#include <macros/debug.hxx>
+#endif
+
+//_________________________________________________________________________________________________________________
+// interface includes
+//_________________________________________________________________________________________________________________
+
+//_________________________________________________________________________________________________________________
+// includes of other projects
+//_________________________________________________________________________________________________________________
+
+#ifndef _URLOBJ_HXX
+#include <tools/urlobj.hxx>
+#endif
+
+//_________________________________________________________________________________________________________________
+// namespace
+//_________________________________________________________________________________________________________________
+
+namespace framework{
+
+using namespace ::osl ;
+using namespace ::rtl ;
+using namespace ::cppu ;
+using namespace ::com::sun::star::uno ;
+using namespace ::com::sun::star::lang ;
+using namespace ::com::sun::star::util ;
+
+//_________________________________________________________________________________________________________________
+// non exported const
+//_________________________________________________________________________________________________________________
+
+//_________________________________________________________________________________________________________________
+// non exported definitions
+//_________________________________________________________________________________________________________________
+
+//_________________________________________________________________________________________________________________
+// declarations
+//_________________________________________________________________________________________________________________
+
+//*****************************************************************************************************************
+// constructor
+//*****************************************************************************************************************
+URLTransformer::URLTransformer( const Reference< XMultiServiceFactory >& xFactory )
+ // Init baseclasses first
+ // Attention:
+ // Don't change order of initialization!
+ // OMutexMember is a struct with a mutex as member. We can't use a mutex as member, while
+ // we must garant right initialization and a valid value of this! First initialize
+ // baseclasses and then members. And we need the mutex for other baseclasses !!!
+ : OMutexMember ( )
+ , OWeakObject ( )
+ // Init member
+ , m_xFactory ( xFactory )
+{
+ // Safe impossible cases.
+ // Method not defined for all incoming parameter.
+ LOG_ASSERT( impldbg_checkParameter_URLTransformer( xFactory ), "URLTransformer::URLTransformer()\nInvalid parameter detected!\n" )
+}
+
+//*****************************************************************************************************************
+// destructor
+//*****************************************************************************************************************
+URLTransformer::~URLTransformer()
+{
+}
+
+//*****************************************************************************************************************
+// XInterface, XTypeProvider, XServiceInfo
+//*****************************************************************************************************************
+
+DEFINE_XINTERFACE_3 ( URLTransformer ,
+ OWeakObject ,
+ DIRECT_INTERFACE(XTypeProvider ),
+ DIRECT_INTERFACE(XServiceInfo ),
+ DIRECT_INTERFACE(XURLTransformer )
+ )
+
+DEFINE_XTYPEPROVIDER_3 ( URLTransformer ,
+ XTypeProvider ,
+ XServiceInfo ,
+ XURLTransformer
+ )
+
+DEFINE_XSERVICEINFO_MULTISERVICE ( URLTransformer ,
+ SERVICENAME_URLTRANSFORMER ,
+ IMPLEMENTATIONNAME_URLTRANSFORMER
+ )
+
+// Attention: If you have enabled any testmode different from TEST_NOTHING => you have declared XDebugging-interface automaticly!
+// Bhere is no macro to define and implement the right methods. You are the only one, who know - how you will use this mechanism.
+// It exist a macro to switch on or off your implementation only.
+// SERVICEDEBUG_ENABLED must be defined, to activate your code!
+
+//#ifdef SERVICEDEBUG_ENABLED
+
+ // Debug mechanism for services is not used in this implementation.
+ // This define will expand to nothing if SERVICEDEBUG_ENABLED unknown!
+ // But if you will implement your own code - activate this define before ... and deactivate follow line.
+ //DEFINE_EMPTY_XSPECIALDEBUGINTERFACE( URLTransformer )
+
+//#endif // #ifdef SERVICEDEBUG_ENABLED
+
+//*****************************************************************************************************************
+// XURLTransformer
+//*****************************************************************************************************************
+sal_Bool SAL_CALL URLTransformer::parseStrict( URL& aURL ) throw( RuntimeException )
+{
+ // Ready for multithreading
+ LOCK_MUTEX( aGuard, m_aMutex, "URLTransformer::parseStrict()" )
+ // Safe impossible cases.
+ // Method not defined for all incoming parameter.
+ LOG_ASSERT( impldbg_checkParameter_parseStrict( aURL ), "URLTransformer::parseStrict()\nInvalid parameter detected!\n" )
+
+ // Initialize parser with given URL.
+ INetURLObject aParser( aURL.Complete );
+
+ // Get all information about this URL.
+ aURL.Protocol = INetURLObject::GetScheme( aParser.GetProtocol() );
+ aURL.User = aParser.GetUser ( INetURLObject::NO_DECODE );
+ aURL.Password = aParser.GetPass ( INetURLObject::NO_DECODE );
+ aURL.Server = aParser.GetHost ( INetURLObject::NO_DECODE );
+ aURL.Port = aParser.GetPort ();
+ aURL.Path = aParser.GetURLPath( INetURLObject::NO_DECODE );
+// aURL.Name = aParser.GetName ();
+ aURL.Arguments = aParser.GetParam ( INetURLObject::NO_DECODE );
+ aURL.Mark = aParser.GetMark ( INetURLObject::NO_DECODE );
+
+ aParser.SetMark ( OUString() );
+ aParser.SetParam( OUString() );
+
+ aURL.Main = aParser.GetMainURL( INetURLObject::NO_DECODE );
+
+ // Return "URL is parsed".
+ return sal_True;
+}
+
+//*****************************************************************************************************************
+// XURLTransformer
+//*****************************************************************************************************************
+sal_Bool SAL_CALL URLTransformer::parseSmart( URL& aURL ,
+ const OUString& sSmartProtocol ) throw( RuntimeException )
+{
+ // Ready for multithreading
+ LOCK_MUTEX( aGuard, m_aMutex, "URLTransformer::parseSmart()" )
+ // Safe impossible cases.
+ // Method not defined for all incoming parameter.
+ LOG_ASSERT( impldbg_checkParameter_parseSmart( aURL, sSmartProtocol ), "URLTransformer::parseSmart()\nInvalid parameter detected!\n" )
+
+ // Initialize parser with given URL.
+ INetURLObject aParser;
+
+ aParser.SetSmartProtocol( INetURLObject::CompareProtocolScheme( sSmartProtocol ));
+ aParser.SetSmartURL ( aURL.Complete );
+
+ // Get all information about this URL.
+ aURL.Protocol = INetURLObject::GetScheme( aParser.GetProtocol() );
+ aURL.User = aParser.GetUser ( INetURLObject::NO_DECODE );
+ aURL.Password = aParser.GetPass ( INetURLObject::NO_DECODE );
+ aURL.Server = aParser.GetHost ( INetURLObject::NO_DECODE );
+ aURL.Port = aParser.GetPort ();
+ aURL.Path = aParser.GetURLPath( INetURLObject::NO_DECODE );
+// aURL.Name = aParser.GetName ();
+ aURL.Arguments = aParser.GetParam ( INetURLObject::NO_DECODE );
+ aURL.Mark = aParser.GetMark ( INetURLObject::NO_DECODE );
+
+ aParser.SetMark ( OUString() );
+ aParser.SetParam( OUString() );
+
+ aURL.Main = aParser.GetMainURL( INetURLObject::NO_DECODE );
+
+ // Return "URL is parsed".
+ return sal_True;
+}
+
+//*****************************************************************************************************************
+// XURLTransformer
+//*****************************************************************************************************************
+sal_Bool SAL_CALL URLTransformer::assemble( URL& aURL ) throw( RuntimeException )
+{
+ // Ready for multithreading
+ LOCK_MUTEX( aGuard, m_aMutex, "URLTransformer::assemble()" )
+ // Safe impossible cases.
+ // Method not defined for all incoming parameter.
+ LOG_ASSERT( impldbg_checkParameter_assemble( aURL ), "URLTransformer::assemble()\nInvalid parameter detected!\n" )
+
+ // Initialize parser.
+ INetURLObject aParser;
+
+ aParser.ConcatData( INetURLObject::CompareProtocolScheme( aURL.Protocol ) ,
+ aURL.User ,
+ aURL.Password ,
+ aURL.Server ,
+ aURL.Port ,
+ aURL.Path );
+
+ // First parse URL WITHOUT ...
+ aURL.Main = aParser.GetMainURL( INetURLObject::NO_DECODE );
+ // ...and then WITH parameter and mark.
+ aParser.SetParam( aURL.Arguments);
+ aParser.SetMark ( aURL.Mark );
+ aURL.Complete = aParser.GetMainURL( INetURLObject::NO_DECODE );
+
+ // Return "URL is assembled".
+ return sal_True;
+}
+
+//*****************************************************************************************************************
+// XURLTransformer
+//*****************************************************************************************************************
+OUString SAL_CALL URLTransformer::getPresentation( const URL& aURL ,
+ sal_Bool bWithPassword ) throw( RuntimeException )
+{
+ // Ready for multithreading
+ LOCK_MUTEX( aGuard, m_aMutex, "URLTransformer::getPresentation()" )
+ // Safe impossible cases.
+ // Method not defined for all incoming parameter.
+ LOG_ASSERT( impldbg_checkParameter_getPresentation( aURL, bWithPassword ), "URLTransformer::getPresentation()\nInvalid parameter detected!\n" )
+
+ // Convert internal URLs to "praesentation"-URLs!
+ UniString sPraesentationURL;
+ UniString sURL = aURL.Complete;
+ INetURLObject::translateToExternal( sURL, sPraesentationURL );
+
+ return sPraesentationURL;
+}
+
+//_________________________________________________________________________________________________________________
+// debug methods
+//_________________________________________________________________________________________________________________
+
+/*-----------------------------------------------------------------------------------------------------------------
+ The follow methods checks the parameter for other functions. If a parameter or his value is non valid,
+ we return "sal_False". (else sal_True) This mechanism is used to throw an ASSERT!
+
+ ATTENTION
+
+ If you miss a test for one of this parameters, contact Andreas Schluens [as] or add it himself !(?)
+ But ... look for right testing! See using of this methods!
+-----------------------------------------------------------------------------------------------------------------*/
+
+#ifdef ENABLE_ASSERTIONS
+
+//*****************************************************************************************************************
+// We need a valid factory to work with her.
+sal_Bool URLTransformer::impldbg_checkParameter_URLTransformer( const Reference< XMultiServiceFactory >& xFactory )
+{
+ // Set default return value.
+ sal_Bool bOK = sal_True;
+ // Check parameter.
+ if (
+ ( &xFactory == NULL ) ||
+ ( xFactory.is() == sal_False )
+ )
+ {
+ bOK = sal_False ;
+ }
+ // Return result of check.
+ return bOK ;
+}
+
+//*****************************************************************************************************************
+// We need a valid "Complete" value for parsing.
+sal_Bool URLTransformer::impldbg_checkParameter_parseStrict( URL& aURL )
+{
+ // Set default return value.
+ sal_Bool bOK = sal_True;
+ // Check parameter.
+ if (
+ ( &aURL == NULL ) ||
+ ( aURL.Complete.getLength() < 1 )
+ )
+ {
+ bOK = sal_False ;
+ }
+ // Return result of check.
+ return bOK ;
+}
+
+//*****************************************************************************************************************
+// We need a valid "Complete" value for URL and a non empty smart protocol description.
+sal_Bool URLTransformer::impldbg_checkParameter_parseSmart( URL& aURL ,
+ const OUString& sSmartProtocol )
+{
+ // Set default return value.
+ sal_Bool bOK = sal_True;
+ // Check parameter.
+ if (
+ ( &aURL == NULL ) ||
+ ( &sSmartProtocol == NULL ) ||
+ ( aURL.Complete.getLength() < 1 ) ||
+ ( sSmartProtocol.getLength() < 1 )
+ )
+ {
+ bOK = sal_False ;
+ }
+ // Return result of check.
+ return bOK ;
+}
+
+//*****************************************************************************************************************
+sal_Bool URLTransformer::impldbg_checkParameter_assemble( URL& aURL )
+{
+ // Set default return value.
+ sal_Bool bOK = sal_True;
+ // Check parameter.
+ if (
+ ( &aURL == NULL )
+ )
+ {
+ bOK = sal_False ;
+ }
+ // Return result of check.
+ return bOK ;
+}
+
+//*****************************************************************************************************************
+sal_Bool URLTransformer::impldbg_checkParameter_getPresentation ( const UNOURL& aURL ,
+ sal_Bool bWithPassword )
+{
+ // Set default return value.
+ sal_Bool bOK = sal_True;
+ // Check parameter.
+ if (
+ ( &aURL == NULL ) ||
+ ( aURL.Complete.getLength() < 1 ) ||
+ (
+ ( bWithPassword != sal_True ) &&
+ ( bWithPassword != sal_False )
+ )
+ )
+ {
+ bOK = sal_False ;
+ }
+ // Return result of check.
+ return bOK ;
+}
+
+#endif // #ifdef ENABLE_ASSERTIONS
+
+} // namespace framework
diff --git a/framework/test/makefile.mk b/framework/test/makefile.mk
index 49f3381bb7bf..665495e01009 100644
--- a/framework/test/makefile.mk
+++ b/framework/test/makefile.mk
@@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.1.1.1 $
+# $Revision: 1.2 $
#
-# last change: $Author: hr $ $Date: 2000-09-18 16:29:25 $
+# last change: $Author: as $ $Date: 2000-11-23 14:52:13 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
@@ -65,16 +65,18 @@ PRJNAME= framework
TARGET= test
LIBTARGET= NO
ENABLE_EXCEPTIONS= TRUE
+USE_DEFFILE= TRUE
+NO_BSYMBOLIC= TRUE
# --- Settings -----------------------------------------------------
-.INCLUDE : svpre.mk
-.INCLUDE : settings.mk
-.INCLUDE : sv.mk
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
-# --- Files --------------------------------------------------------
-
-SLOFILES= $(SLO)$/test.obj
+.IF "$(COM)"=="ICC"
+LINKFLAGS+=/SEGMENTS:1024 /PACKD:32768
+.ENDIF
# --- Applikation --------------------------------------------------
@@ -82,23 +84,26 @@ APP1TARGET= $(TARGET)
APP1OBJS= $(SLO)$/test.obj
-APP1STDLIBS= $(SLB)$/fwk_classes.lib \
- $(SLB)$/fwk_helper.lib \
- $(CPPULIB) \
- $(CPPUHELPERLIB) \
- $(OSLLIB) \
- $(SALLIB) \
- $(VOSLIB) \
- $(TOOLSLIB) \
- $(SVTOOLLIB) \
- $(TKLIB) \
- $(UNOTOOLSLIB) \
+APP1LIBS= $(SLB)$/fwk_classes.lib \
+ $(SLB)$/fwk_helper.lib
+
+APP1STDLIBS= \
+ $(CPPULIB) \
+ $(CPPUHELPERLIB) \
+ $(OSLLIB) \
+ $(SALLIB) \
+ $(VOSLIB) \
+ $(TOOLSLIB) \
+ $(SVTOOLLIB) \
+ $(TKLIB) \
+ $(COMPHELPERLIB) \
$(SVLIB)
-APP1DEPN= $(SLB)$/fwk_classes.lib
+APP1DEPN= $(SLB)$/fwk_helper.lib \
+ $(SLB)$/fwk_classes.lib
.IF "$(GUI)"=="WIN" || "$(GUI)"=="OS2"
-APP1DEF= $(MISC)$/$(TARGET).def
+APP1DEF= $(MISC)$/test.def
.ENDIF
# --- Targets ------------------------------------------------------
diff --git a/framework/test/test.cxx b/framework/test/test.cxx
index 6ba09f5b470b..47d8ade0d695 100644
--- a/framework/test/test.cxx
+++ b/framework/test/test.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: test.cxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: hr $ $Date: 2000-09-18 16:29:25 $
+ * last change: $Author: as $ $Date: 2000-11-23 14:52:13 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -71,6 +71,10 @@
#include <classes/servicemanager.hxx>
#endif
+#ifndef __FRAMEWORK_CLASSES_FILTERCACHE_HXX_
+#include <classes/filtercache.hxx>
+#endif
+
#ifndef __FRAMEWORK_MACROS_GENERIC_HXX_
#include <macros/generic.hxx>
#endif
@@ -159,12 +163,24 @@
#include <com/sun/star/bridge/XInstanceProvider.hpp>
#endif
+#ifndef _COM_SUN_STAR_DOCUMENT_XTYPEDETECTION_HPP_
+#include <com/sun/star/document/XTypeDetection.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_
+#include <com/sun/star/container/XNameAccess.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_CONTAINER_XELEMENTACCESS_HPP_
+#include <com/sun/star/container/XElementAccess.hpp>
+#endif
+
//_________________________________________________________________________________________________________________
// other includes
//_________________________________________________________________________________________________________________
-#ifndef _UNOTOOLS_PROCESSFACTORY_HXX_
-#include <unotools/processfactory.hxx>
+#ifndef _COMPHELPER_PROCESSFACTORY_HXX_
+#include <comphelper/processfactory.hxx>
#endif
#ifndef _COM_SUN_STAR_UNO_REFERENCE_H_
@@ -208,7 +224,7 @@
//_________________________________________________________________________________________________________________
using namespace ::rtl ;
-using namespace ::utl ;
+using namespace ::comphelper ;
using namespace ::framework ;
using namespace ::cppu ;
using namespace ::com::sun::star::uno ;
@@ -220,6 +236,8 @@ using namespace ::com::sun::star::util ;
using namespace ::com::sun::star::task ;
using namespace ::com::sun::star::mozilla ;
using namespace ::com::sun::star::bridge ;
+using namespace ::com::sun::star::document ;
+using namespace ::com::sun::star::container ;
//_________________________________________________________________________________________________________________
// defines
@@ -236,15 +254,21 @@ class TestApplication : public Application
void Main();
private:
- // Test the whole desktop implementation.
- void impl_testDesktop( const Reference< XDesktop >& xDesktop );
- // Build a new tree with desktop on top.
- void impl_buildTree( const Reference< XDesktop >& xDesktop );
- // Write names of all frames in tree to logfile.
- void impl_logTree( const Reference< XDesktop >& xDesktop );
- void impl_testPlugIn( const Reference< XDesktop >& xDesktop, const Reference< XMultiServiceFactory >& xFactory );
- // Test login dialog
- void impl_testLoginDialog();
+
+ //*********************************************************************************************************
+ // test methods
+ //*********************************************************************************************************
+ void impl_testDesktop ( const Reference< XDesktop >& xDesktop );
+ void impl_testPlugIn ( const Reference< XDesktop >& xDesktop, const Reference< XMultiServiceFactory >& xFactory );
+ void impl_testLoginDialog ( );
+ void impl_testFilterCache ( );
+ void impl_testTypeDetection ( );
+
+ //*********************************************************************************************************
+ // helper methods
+ //*********************************************************************************************************
+ void impl_buildTree ( const Reference< XDesktop >& xDesktop );// Build a new tree with desktop on top.
+ void impl_logTree ( const Reference< XDesktop >& xDesktop );// Write names of all frames in tree to logfile.
}; // class TestApplication
@@ -260,31 +284,53 @@ TestApplication aTestApplication ;
void TestApplication::Main()
{
- // 1) Init global servicemanager and set it.
+ /**-***********************************************************************************************************
+ initialize program
+ **************************************************************************************************************/
+
+ // Init global servicemanager and set it.
ServiceManager aManager;
Reference< XMultiServiceFactory > xGlobalServiceManager = aManager.getManager();
- LOG_ASSERT( !(xGlobalServiceManager.is()==sal_False), "TestApplication::Main()\nCan't create global service manager.\n\n" )
-
- // We must set this global servicemanager as global static variable.
- // Office must have access to this.
setProcessServiceFactory( xGlobalServiceManager );
- // Control this!
- LOG_ASSERT( !(getProcessServiceFactory()!=xGlobalServiceManager), "TestApplication::Main()\nGlobal servicemanager not set in UNOTOOLS.\n\n" )
- // For follow operations, we need the vcl-toolkit!
- // But there is nothing to test for us.
+ // Control sucess of operation.
+ LOG_ASSERT( !(xGlobalServiceManager.is()==sal_False ), "TestApplication::Main()\nCan't create global service manager.\n\n" )
+ LOG_ASSERT( !(getProcessServiceFactory()!=xGlobalServiceManager ), "TestApplication::Main()\nGlobal servicemanager not set in UNOTOOLS.\n\n" )
+
+ // For some follow operations, we need the vcl-toolkit!
InitExtVclToolkit();
- // 2) Try to create the root of ouer frame hierarchy - the desktop himself.
- Reference< XDesktop > xDesktop( xGlobalServiceManager->createInstance( SERVICENAME_DESKTOP ), UNO_QUERY );
- LOG_ASSERT( !(xDesktop.is()==sal_False), "TestApplication::Main()\nServicename of Desktop is unknown.\n\n" )
+ /**-***********************************************************************************************************
+ test area
+ **************************************************************************************************************/
+ //-------------------------------------------------------------------------------------------------------------
+ #ifdef TEST_FILTERCACHE
+ impl_testFilterCache();
+ #endif
+
+ //-------------------------------------------------------------------------------------------------------------
+ #ifdef TEST_TYPEDETECTION
+ impl_testTypeDetection();
+ #endif
+
+ //-------------------------------------------------------------------------------------------------------------
+ #ifdef TEST_LOGINDIALOG
ResMgr* pRessourceManager = CREATEVERSIONRESMGR( lgd );
Resource::SetResManager( pRessourceManager );
+ impl_testLoginDialog();
+ #endif
-// impl_testLoginDialog();
+ //-------------------------------------------------------------------------------------------------------------
+ #ifdef TEST_DESKTOP
+ Reference< XDesktop > xDesktop( xGlobalServiceManager->createInstance( SERVICENAME_DESKTOP ), UNO_QUERY );
impl_testDesktop( xDesktop );
-// impl_testPlugIn( xDesktop, xGlobalServiceManager );
+ #endif
+
+ //-------------------------------------------------------------------------------------------------------------
+ #ifdef TEST_PLUGIN
+ impl_testPlugIn( xDesktop, xGlobalServiceManager );
+ #endif
/*
Reference< XDispatchProvider > xProvider( xDesktop, UNO_QUERY );
@@ -370,6 +416,184 @@ void TestApplication::Main()
// Execute();
// xFrame->dispose();
// delete pMainWindow;
+ LOG_ASSERT( sal_False, "TestApplication: test successful ..." )
+}
+
+//_________________________________________________________________________________________________________________
+// test method
+//_________________________________________________________________________________________________________________
+void TestApplication::impl_testTypeDetection()
+{
+ // We use a string buffer to log important informations and search results.
+ // Errors are shown directly by an assert!
+ OUStringBuffer sBuffer( 100000 );
+
+ // Create a new type detection service.
+ Reference< XTypeDetection > xTypeDetection( getProcessServiceFactory()->createInstance( SERVICENAME_TYPEDETECTION ), UNO_QUERY );
+ LOG_ASSERT( !(xTypeDetection.is()==sal_False), "TestApplication::impl_testTypeDetection()\nCouldn't create the type detection service.\n" );
+
+ if( xTypeDetection.is() == sal_True )
+ {
+ // a) Check his implementation and his supported interfaces first.
+ Reference< XInterface > xInterface ( xTypeDetection, UNO_QUERY );
+ Reference< XTypeProvider > xTypeProvider ( xTypeDetection, UNO_QUERY );
+ Reference< XServiceInfo > xServiceInfo ( xTypeDetection, UNO_QUERY );
+ Reference< XNameAccess > xNameAccess ( xTypeDetection, UNO_QUERY );
+ Reference< XElementAccess > xElementAccess ( xTypeDetection, UNO_QUERY );
+
+ LOG_ASSERT( !( xInterface.is() == sal_False ||
+ xTypeProvider.is() == sal_False ||
+ xServiceInfo.is() == sal_False ||
+ xNameAccess.is() == sal_False ||
+ xElementAccess.is() == sal_False ), "TestApplication::impl_testTypeDetection()\nMiss supported for searched interface!\n" )
+
+ // b) Check OneInstance mode of service.
+ Reference< XTypeDetection > xTypeDetection2( getProcessServiceFactory()->createInstance( SERVICENAME_TYPEDETECTION ), UNO_QUERY );
+ LOG_ASSERT( !(xTypeDetection!=xTypeDetection2), "TestApplication::impl_testTypeDetection()\nService isn't \"OneInstance\" ...!\n" )
+ xTypeDetection2 = Reference< XTypeDetection >();
+
+ // c) Check "XTypeDetection" ... flat by URL
+ // Define list of URLs for checking.
+ OUString pURLs[] =
+ {
+ DECLARE_ASCII("file://c|/temp/test.sdw" ),
+ DECLARE_ASCII("private:factory/scalc" ),
+ DECLARE_ASCII("file://c|/temp/test.txt" ),
+ DECLARE_ASCII("slot:5000" ),
+ };
+ sal_uInt32 nCount = 4;
+ Sequence< OUString > seqURLs( pURLs, nCount );
+
+ Reference< XMultiServiceFactory > xFilterFactory( getProcessServiceFactory()->createInstance( SERVICENAME_FILTERFACTORY ), UNO_QUERY );
+ Reference< XMultiServiceFactory > xLoaderFactory( getProcessServiceFactory()->createInstance( SERVICENAME_FRAMELOADERFACTORY), UNO_QUERY );
+ LOG_ASSERT( !(xFilterFactory.is()==sal_False), "TestApplication::impl_testTypeDetection()\nCouldn't create filter factory!\n" )
+ LOG_ASSERT( !(xLoaderFactory.is()==sal_False), "TestApplication::impl_testTypeDetection()\nCouldn't create loader factory!\n" )
+
+ // Step over these list.
+ for( sal_uInt32 nURL=0; nURL<nCount; ++nURL )
+ {
+ // Try to get a type name for every URL from list and log search result.
+ OUString sTypeName = xTypeDetection->queryTypeByURL( seqURLs[nURL] );
+ sBuffer.appendAscii ( "queryTypeByURL( \"" );
+ sBuffer.append ( seqURLs[nURL] );
+ sBuffer.appendAscii ( "\" ) returns type \"" );
+ sBuffer.append ( sTypeName );
+ sBuffer.appendAscii ( "\"\n" );
+ // If a type was found - try to get a filter and a frame loader for it.
+ if( sTypeName.getLength() > 0 )
+ {
+ Reference< XInterface > xFilter = xFilterFactory->createInstance( sTypeName );
+ Reference< XInterface > xLoader = xLoaderFactory->createInstance( sTypeName );
+ if( xFilter.is() == sal_False )
+ {
+ sBuffer.appendAscii( "Couldn't find an filter.\n" );
+ }
+ else
+ {
+ Reference< XPropertySet > xFilterProperties( xFilter, UNO_QUERY );
+ LOG_ASSERT( !(xFilterProperties.is()==sal_False), "TestApplication::impl_testTypeDetection()\nFilter don't support XPropertySet!\n" )
+ if( xFilterProperties.is() == sal_True )
+ {
+ OUString sUIName;
+ xFilterProperties->getPropertyValue( DECLARE_ASCII("UIName") ) >>= sUIName;
+ sBuffer.appendAscii ( "Found filter \"" );
+ sBuffer.append ( sUIName );
+ sBuffer.appendAscii ( "\"\n" );
+ }
+
+ Reference< XPropertySet > xLoaderProperties( xLoader, UNO_QUERY );
+ LOG_ASSERT( !(xLoaderProperties.is()==sal_False), "TestApplication::impl_testTypeDetection()\nLoader don't support XPropertySet!\n" )
+ if( xLoaderProperties.is() == sal_True )
+ {
+ OUString sUIName;
+ xLoaderProperties->getPropertyValue( DECLARE_ASCII("UIName") ) >>= sUIName;
+ sBuffer.appendAscii ( "Found loader \"" );
+ sBuffer.append ( sUIName );
+ sBuffer.appendAscii ( "\"\n" );
+ }
+ }
+ }
+ }
+ }
+
+ WRITE_LOGFILE( "testTypeDetection.log", U2B(sBuffer.makeStringAndClear()).getStr() )
+}
+
+//_________________________________________________________________________________________________________________
+// test method
+//_________________________________________________________________________________________________________________
+void TestApplication::impl_testFilterCache()
+{
+ FilterCache aCache;
+
+ OUStringBuffer sBuffer( 100000 );
+ if( aCache.isValid() == sal_False )
+ {
+ sBuffer.appendAscii( "Cache isn't valid!\n" );
+ }
+ else
+ {
+/*
+ // Step over all types and log his values.
+ // These simulate a XNameAccess!
+ const Sequence< OUString > seqAllTypeNames = aCache.getAllTypeNames();
+ sal_uInt32 nCount = seqAllTypeNames.getLength();
+ for( sal_uInt32 nPosition=0; nPosition<nCount; ++nPosition )
+ {
+ sBuffer.appendAscii( "--------------------------------------------------------------------------------\n" );
+ const TType* pType = aCache.getTypeByName( seqAllTypeNames[nPosition] );
+ if( pType == NULL )
+ {
+ sBuffer.appendAscii ( "Type [" );
+ sBuffer.append ( (sal_Int32)nPosition );
+ sBuffer.appendAscii ( "] \"" );
+ sBuffer.append ( seqAllTypeNames[nPosition]);
+ sBuffer.appendAscii ( "\" isn't valid!" );
+ }
+ else
+ {
+ sBuffer.appendAscii ( "Type [" );
+ sBuffer.append ( (sal_Int32)nPosition );
+ sBuffer.appendAscii ( "] \"" );
+ sBuffer.append ( seqAllTypeNames[nPosition] );
+ sBuffer.appendAscii ( "\"\n\t\tUIName\t=\t" );
+ sBuffer.append ( pType->sUIName );
+ sBuffer.appendAscii ( "\n\t\tMediaType\t=\t" );
+ sBuffer.append ( pType->sMediaType );
+ sBuffer.appendAscii ( "\n\t\tClipboardFormat\t=\t" );
+ sBuffer.append ( pType->sClipboardFormat );
+ sBuffer.appendAscii ( "\n\t\tURLPattern\t=\t{" );
+ for( TConstStringIterator aIterator=pType->lURLPattern.begin(); aIterator!=pType->lURLPattern.end(); ++aIterator )
+ {
+ sBuffer.append ( *aIterator );
+ sBuffer.appendAscii ( ";\n\t\t" );
+ }
+ sBuffer.appendAscii( "}\nExtensions\t=\t" );
+ for( aIterator=pType->lExtensions.begin(); aIterator!=pType->lExtensions.end(); ++aIterator )
+ {
+ sBuffer.append ( *aIterator );
+ sBuffer.appendAscii ( ";\n\t\t" );
+ }
+ sBuffer.appendAscii ( "}\nDocumentIconID\t=\t" );
+ sBuffer.append ( (sal_Int32)pType->nDocumentIconID );
+ }
+ }
+*/
+ // searchFirstType( URL, MediaType, ClipboardFormat, startEntry )
+ TConstTypeIterator aIterator;
+ sBuffer.appendAscii( "search type for \"file://c|/temp/test.sdw\"; no media type; no clipboard format\n" );
+ OUString sURL = DECLARE_ASCII("file://c|/temp/test.sdw");
+ const OUString* pType = aCache.searchFirstType( &sURL, NULL, NULL, aIterator );
+ while( pType != NULL )
+ {
+ sBuffer.appendAscii ( "\tfound \"" );
+ sBuffer.append ( *pType );
+ sBuffer.appendAscii ( "\"\n" );
+ pType = aCache.searchType( &sURL, NULL, NULL, aIterator );
+ }
+ }
+
+ WRITE_LOGFILE( "test_FilterCache.log", U2B(sBuffer.makeStringAndClear()).getStr() )
}
//_________________________________________________________________________________________________________________
@@ -507,6 +731,7 @@ void TestApplication::impl_testPlugIn( const Reference< XDesktop >& xDesktop, co
//_________________________________________________________________________________________________________________
// test method
//_________________________________________________________________________________________________________________
+#define LOGFILE_TARGETING "targeting.log"
void TestApplication::impl_testDesktop( const Reference< XDesktop >& xDesktop )
{
//-------------------------------------------------------------------------------------------------------------
diff --git a/framework/util/makefile.mk b/framework/util/makefile.mk
index dd7e629c590c..4603237a6043 100644
--- a/framework/util/makefile.mk
+++ b/framework/util/makefile.mk
@@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.3 $
+# $Revision: 1.4 $
#
-# last change: $Author: as $ $Date: 2000-10-23 11:10:46 $
+# last change: $Author: as $ $Date: 2000-11-23 14:52:13 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
@@ -84,10 +84,9 @@ LINKFLAGS+=/SEGMENTS:1024 /PACKD:32768
SHL2TARGET= $(FRAMEWORK_TARGET)$(UPD)$(DLLPOSTFIX)
SHL2IMPLIB= i$(TARGET)$(UPD)$(DLLPOSTFIX)
-SHL2OBJS= $(SLO)$/registerbaehservices.obj
+SHL2OBJS= $(SLO)$/registerservices.obj
-SHL2LIBS= $(SLB)$/fwk_baehservices.lib \
- $(SLB)$/fwk_services.lib \
+SHL2LIBS= $(SLB)$/fwk_services.lib \
$(SLB)$/fwk_helper.lib \
$(SLB)$/fwk_classes.lib
@@ -102,7 +101,6 @@ SHL2STDLIBS= $(CPPULIB) \
$(COMPHELPERLIB) \
$(SVLLIB)
-
SHL2DEF= $(MISC)$/$(SHL2TARGET).def
DEF2NAME= $(SHL2TARGET)
@@ -119,8 +117,6 @@ APP1LIBS= $(SLB)$/fwk_classes.lib \
$(SLB)$/fwk_helper.lib \
$(SLB)$/fwk_services.lib
-
-
APP1STDLIBS= \
$(CPPULIB) \
$(CPPUHELPERLIB) \