summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorAndreas Schlüns <as@openoffice.org>2000-11-28 13:45:33 +0000
committerAndreas Schlüns <as@openoffice.org>2000-11-28 13:45:33 +0000
commit131c5ab3a1816a3d0ccef09661e4e360575473f5 (patch)
tree6947a81fed9f8aad15960a6c0c4340098712d58b /framework
parent171fac5f9fb4c46c5f4d897d054c526e8427288d (diff)
#79040# new version of new type detection
Diffstat (limited to 'framework')
-rw-r--r--framework/inc/classes/checkediterator.hxx314
-rw-r--r--framework/inc/classes/filtercache.hxx147
-rw-r--r--framework/source/register/registerservices.cxx8
-rw-r--r--framework/source/services/mediatypedetectionhelper.cxx13
-rw-r--r--framework/test/test.cxx30
5 files changed, 444 insertions, 68 deletions
diff --git a/framework/inc/classes/checkediterator.hxx b/framework/inc/classes/checkediterator.hxx
new file mode 100644
index 000000000000..cfa5d4f72cf1
--- /dev/null
+++ b/framework/inc/classes/checkediterator.hxx
@@ -0,0 +1,314 @@
+/*************************************************************************
+ *
+ * $RCSfile: checkediterator.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: as $ $Date: 2000-11-28 14:45:23 $
+ *
+ * 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_CHECKEDITERATOR_HXX_
+#define __FRAMEWORK_CLASSES_CHECKEDITERATOR_HXX_
+
+//_________________________________________________________________________________________________________________
+// my own includes
+//_________________________________________________________________________________________________________________
+
+#ifndef __FRAMEWORK_MACROS_DEBUG_HXX_
+#include <macros/debug.hxx>
+#endif
+
+//_________________________________________________________________________________________________________________
+// interface includes
+//_________________________________________________________________________________________________________________
+
+//_________________________________________________________________________________________________________________
+// other includes
+//_________________________________________________________________________________________________________________
+
+#ifndef __SGI_STL_ITERATOR
+#include <stl/iterator>
+#endif
+
+//_________________________________________________________________________________________________________________
+// namespace
+//_________________________________________________________________________________________________________________
+
+namespace framework{
+
+//_________________________________________________________________________________________________________________
+// exported const
+//_________________________________________________________________________________________________________________
+
+//_________________________________________________________________________________________________________________
+// exported definitions
+//_________________________________________________________________________________________________________________
+
+/*-************************************************************************************************************//**
+ @short implement a iterator which support 2 end states!
+ @descr For our search methods we need a "walking" iterator object with special functionality!
+ We must check for 3 different states of an iterator - normal position, exact end, after end.
+ It's neccessary to detect if we have not found a entry and must return our default or
+ default already returned and we must break loop!
+ see using in class FilterCache too for further informations!
+
+ @Attention If your wish to debug this inline code ...
+ under windows and msdev you can use "set ENVCFLAGS=/Ob0" to do that!
+
+ @implements -
+ @base -
+
+ @devstatus ready to use
+*//*-*************************************************************************************************************/
+
+template< class TContainer, class TIterator = typename TContainer::iterator >
+class CheckedIterator
+{
+ //-------------------------------------------------------------------------------------------------------------
+ // public methods
+ //-------------------------------------------------------------------------------------------------------------
+
+ public:
+
+ //---------------------------------------------------------------------------------------------------------
+ // constructor / destructor
+ //---------------------------------------------------------------------------------------------------------
+
+ /*-****************************************************************************************************//**
+ @short standard constructor
+ @descr Set default values on members. A normal constructed object stand AFTEREND always!
+ Use initialize() to change that.
+
+ @seealso -
+
+ @param -
+ @return -
+
+ @onerror -
+ *//*-*****************************************************************************************************/
+
+ inline CheckedIterator()
+ {
+ setAfterEnd();
+ }
+
+ //---------------------------------------------------------------------------------------------------------
+ // interface methods
+ //---------------------------------------------------------------------------------------------------------
+
+ /*-****************************************************************************************************//**
+ @short initialize instance with valid container
+ @descr Set new container at an instance of this class. The other member will set automaticly!
+ m_pPosition = first element in container
+ m_eEndState = BEFOREEND
+
+ @seealso -
+
+ @param "pContainer", must be a valid pointer to an existing container.
+ @return -
+
+ @onerror An assertion is thrown.
+ *//*-*****************************************************************************************************/
+
+ inline void initialize( const TContainer* pContainer )
+ {
+ // Check incoming parameter. We don't accept all!
+ LOG_ASSERT( !(pContainer==NULL), "CheckedIterator::initialize()\nInvalid parameter detected!\n" )
+
+ // Set new container and actualize other member.
+ m_pContainer = pContainer ;
+ m_pPosition = m_pContainer->begin() ;
+ m_eEndState = E_BEFOREEND ;
+ if( m_pPosition == m_pContainer->end() )
+ {
+ m_eEndState = E_END;
+ }
+ }
+
+ /*-****************************************************************************************************//**
+ @short set internal states to E_AFTEREND
+ @descr Sometimes we need a "walking" check-iterator which is initialized with AFTEREND-state!
+ We need it if we don't have a container but must prevent us against further searching!
+
+ @seealso using in class FilterCache!
+
+ @param -
+ @return -
+
+ @onerror -
+ *//*-*****************************************************************************************************/
+
+ inline void setAfterEnd()
+ {
+ m_pContainer = NULL ;
+ m_eEndState = E_AFTEREND ;
+ }
+
+ /*-****************************************************************************************************//**
+ @short step to next element in container.
+ @descr If end of container is reached we change our internal "m_eEndState".
+ If end reached for first time; we set it to E_END;
+ If you step to next element again; we set it to E_AFTEREND.
+ So you have a chance to differ between "exact end" and "after end"!
+
+ @seealso method isEnd()
+ @seealso method isAfterEnd()
+
+ @param -
+ @return A reference to our changed object himself.
+
+ @onerror -
+ *//*-*****************************************************************************************************/
+
+ inline CheckedIterator& operator++()
+ {
+ // Warn programmer if he forget to initailize object!
+ LOG_ASSERT( !(m_pContainer==NULL), "CheckedIterator::operator++()\nObject not initialized!\n" )
+ // Step to next element if any exist or set our end states.
+ switch( m_eEndState )
+ {
+ case E_BEFOREEND: {
+ ++m_pPosition;
+ if( m_pPosition == m_pContainer->end() )
+ {
+ m_eEndState = E_END;
+ }
+ }
+ break;
+ case E_END : {
+ m_eEndState = E_AFTEREND;
+ }
+ break;
+ }
+ return *this;
+ }
+
+ /*-****************************************************************************************************//**
+ @short return true if internal iterator reached end of container
+ @descr These will be true if you step to the end of internal container.
+
+ @seealso method isAfterEnd()
+
+ @param -
+ @return True if end reached; false otherwise.
+
+ @onerror -
+ *//*-*****************************************************************************************************/
+
+ inline sal_Bool isEnd()
+ {
+ // Is true if one end state is set!
+ return (
+ ( m_eEndState == E_END ) ||
+ ( m_eEndState == E_AFTEREND )
+ );
+ }
+
+ /*-****************************************************************************************************//**
+ @short return true if you call operator++ again and end already reached
+ @descr These indicate, that end already reached but you call operator++ again and again!
+
+ @seealso method isEnd()
+
+ @param -
+ @return True if end multiple reached; false otherwise.
+
+ @onerror -
+ *//*-*****************************************************************************************************/
+
+ inline sal_Bool isAfterEnd()
+ {
+ // Is true only, if special end state is set!
+ return( m_eEndState == E_AFTEREND );
+ }
+
+ /*-****************************************************************************************************//**
+ @short support readonly access to container entry
+ @descr Use it to get the value of current container item.
+
+ @seealso -
+
+ @param -
+ @return A reference to value of container entry.
+
+ @onerror -
+ *//*-*****************************************************************************************************/
+
+ inline TIterator& getEntry()
+ {
+ // Warn programmer if he forget to initialize these object ...
+ LOG_ASSERT( !(m_pContainer==NULL) , "CheckedIterator::getEntry()\nObject not initialized!\n" )
+ // or try to read a non existing element!
+ LOG_ASSERT( !(m_eEndState!=E_BEFOREEND) , "CheckedIterator::getEntry()\nWrong using of class detected!\n" )
+ return m_pPosition;
+ }
+
+ //-------------------------------------------------------------------------------------------------------------
+ // private member
+ //-------------------------------------------------------------------------------------------------------------
+
+ private:
+
+ enum EEndState{ E_BEFOREEND, E_END, E_AFTEREND }; // These enum defines our three states for an iterator position in curent container.
+
+ const TContainer* m_pContainer ; // pointer to current container
+ TIterator m_pPosition ; // current position in container
+ EEndState m_eEndState ; // position state of iterator!
+
+};
+
+} // namespace framework
+
+#endif // #ifndef __FRAMEWORK_CLASSES_CHECKEDITERATOR_HXX_
diff --git a/framework/inc/classes/filtercache.hxx b/framework/inc/classes/filtercache.hxx
index 6b0f87522503..0e400afb9acb 100644
--- a/framework/inc/classes/filtercache.hxx
+++ b/framework/inc/classes/filtercache.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: filtercache.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: as $ $Date: 2000-11-23 14:52:03 $
+ * last change: $Author: as $ $Date: 2000-11-28 14:45:23 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -66,6 +66,10 @@
// my own includes
//_________________________________________________________________________________________________________________
+#ifndef __FRAMEWORK_CLASSES_CHECKEDITERATOR_HXX_
+#include <classes/checkediterator.hxx>
+#endif
+
#ifndef __FRAMEWORK_MACROS_DEBUG_HXX_
#include <macros/debug.hxx>
#endif
@@ -110,6 +114,10 @@
#include <stl/vector>
#endif
+#ifndef __SGI_STL_ITERATOR
+#include <stl/iterator>
+#endif
+
//_________________________________________________________________________________________________________________
// namespace
//_________________________________________________________________________________________________________________
@@ -134,6 +142,7 @@ namespace framework{
// exported definitions
//_________________________________________________________________________________________________________________
+//*****************************************************************************************************************
// Hash code function for using in all hash maps of follow implementation.
struct TStringHashFunction
{
@@ -146,6 +155,7 @@ struct TStringHashFunction
// 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!
@@ -159,6 +169,7 @@ struct TType
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.
@@ -175,40 +186,43 @@ struct TFilter
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!
+ TStringList lTypes ; // empty not allowed! min 1 item need!
};
+//*****************************************************************************************************************
// 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!
+ TStringList lTypes ; // empty not allowed! min 1 item need!
};
+//*****************************************************************************************************************
// We need different hash maps for different tables of our configuration management.
-typedef HASH_MAP< OUSTRING , // Key name is the internal name!
+typedef HASH_MAP< OUSTRING , // structure of hash: key< internal name >{ value< TType > }
TType ,
TStringHashFunction ,
::std::equal_to< OUSTRING > > TTypeHash;
-typedef HASH_MAP< OUSTRING , // Key name is the internal name!
+typedef HASH_MAP< OUSTRING , // structure of hash: key< internal name >{ value< TFilter > }
TFilter ,
TStringHashFunction ,
::std::equal_to< OUSTRING > > TFilterHash;
-typedef HASH_MAP< OUSTRING , // Key name is the service or implementation name!
+typedef HASH_MAP< OUSTRING , // structure of hash: key< implmentation name >{ value< TDetector > }
TDetector ,
TStringHashFunction ,
::std::equal_to< OUSTRING > > TDetectorHash;
-typedef HASH_MAP< OUSTRING , // Key name is the service or implementation name!
+typedef HASH_MAP< OUSTRING , // structure of hash: key< implementation name >{ value< TLoader > }
TLoader ,
TStringHashFunction ,
::std::equal_to< OUSTRING > > TLoaderHash;
@@ -216,18 +230,21 @@ typedef HASH_MAP< OUSTRING , // Key n
// 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 ,
+typedef HASH_MAP< OUSTRING , // structure of detector hash: key< internal type name >{ value< list of detector names > }
+ TStringList , // structure of loader hash: key< internal type name >{ value< list of loader names > }
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 ;
+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 ;
+typedef CheckedIterator< TStringList, TConstStringIterator > TCheckedStringListIterator ;
+typedef CheckedIterator< TTypeHash, TConstTypeIterator > TCheckedTypeIterator ;
/*-************************************************************************************************************//**
@short cache for all filter and type information
@@ -319,23 +336,24 @@ class FilterCache
@onerror NULL is returned.
*//*-*****************************************************************************************************/
- const OUSTRING* searchFirstType ( const OUSTRING* pURL ,
- const OUSTRING* pMediaType ,
- const OUSTRING* pClipboardFormat ,
- TConstTypeIterator& rStartEntry ) const;
+ const OUSTRING* searchFirstType ( const OUSTRING* pURL ,
+ const OUSTRING* pMediaType ,
+ const OUSTRING* pClipboardFormat ,
+ TCheckedTypeIterator& rStartEntry ) const;
+
+ const OUSTRING* searchType ( const OUSTRING* pURL ,
+ const OUSTRING* pMediaType ,
+ const OUSTRING* pClipboardFormat ,
+ TCheckedTypeIterator& rFollowEntry ) const;
- const OUSTRING* searchType ( const OUSTRING* pURL ,
- const OUSTRING* pMediaType ,
- const OUSTRING* pClipboardFormat ,
- TConstTypeIterator& rFollowEntry ) const;
+ const OUSTRING* searchFirstFilterForType ( const OUSTRING& sInternalTypeName, TCheckedStringListIterator& rStartEntry ) const ;
+ const OUSTRING* searchFilterForType ( TCheckedStringListIterator& 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* searchFirstDetectorForType ( const OUSTRING& sInternalTypeName, TCheckedStringListIterator& rStartEntry ) const ;
+ const OUSTRING* searchDetectorForType ( TCheckedStringListIterator& rFollowEntry) const ;
- 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) ;
+ const OUSTRING* searchFirstLoaderForType ( const OUSTRING& sInternalTypeName, TCheckedStringListIterator& rStartEntry ) const ;
+ const OUSTRING* searchLoaderForType ( TCheckedStringListIterator& rFollowEntry) const ;
/*-****************************************************************************************************//**
@short get all properties of a cache entry by given name
@@ -431,6 +449,25 @@ class FilterCache
OUSTRING impl_extractURLExtension( const OUSTRING& sURL ) const;
/*-****************************************************************************************************//**
+ @short eliminate "*." from every extension
+ @descr Our configuration save extensions as "*.nnn" everytime. But this isn't a realy effective method
+ to search for mathcing with a given URL. That's why we eleminate this obsolete letters from every
+ saved extension in our internal cache. Now a normal compare is enough!
+
+ @ATTENTION impl_extractURLExtension() must return strings with same format!
+
+ @seealso method impl_extractURLExtensions()
+ @seealso search methods
+
+ @param "lExtension", string vector with extensions to convert
+ @return Parameter "lExtensions" is an in/out parameter!
+
+ @onerror No error should occure.
+ *//*-*****************************************************************************************************/
+
+ void impl_correctExtensions( TStringList& lExtensions );
+
+ /*-****************************************************************************************************//**
@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.
@@ -447,10 +484,10 @@ class FilterCache
*//*-*****************************************************************************************************/
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_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 );
+ void impl_fillLoaderCache ( const REFERENCE< XREGISTRYKEY >& xRootKey, TLoaderHash& rCache , TPerformanceHash& rFastCache );
//-------------------------------------------------------------------------------------------------------------
// debug methods
@@ -475,16 +512,23 @@ class FilterCache
private:
+ static sal_Bool impldbg_checkParameter_searchFirstType ( const OUSTRING* pURL ,
+ const OUSTRING* pMediaType ,
+ const OUSTRING* pClipboardFormat ,
+ const TCheckedTypeIterator& rStartEntry );
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 );
+ const TCheckedTypeIterator& rFollowEntry );
+ static sal_Bool impldbg_checkParameter_searchFirstFilterForType ( const OUSTRING& sInternalTypeName ,
+ const TCheckedStringListIterator& rStartEntry );
+ static sal_Bool impldbg_checkParameter_searchFilterForType ( const TCheckedStringListIterator& rFollowEntry );
+ static sal_Bool impldbg_checkParameter_searchFirstDetectorForType ( const OUSTRING& sInternalTypeName ,
+ const TCheckedStringListIterator& rStartEntry );
+ static sal_Bool impldbg_checkParameter_searchDetectorForType ( const TCheckedStringListIterator& rFollowEntry );
+ static sal_Bool impldbg_checkParameter_searchFirstLoaderForType ( const OUSTRING& sInternalTypeName ,
+ const TCheckedStringListIterator& rStartEntry );
+ static sal_Bool impldbg_checkParameter_searchLoaderForType ( const TCheckedStringListIterator& rFollowEntry );
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 );
@@ -494,17 +538,17 @@ class FilterCache
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 );
+ const TStringList& rDestination );
static sal_Bool impldbg_checkParameter_convertStringVectorToSequence ( const TStringList& rSource ,
- SEQUENCE< OUSTRING >& seqDestination );
+ const SEQUENCE< OUSTRING >& seqDestination );
static sal_Bool impldbg_checkParameter_convertTTypeToPropertySequence ( const TType& rSource ,
- SEQUENCE< PROPERTYVALUE >& seqDestination );
+ const SEQUENCE< PROPERTYVALUE >& seqDestination );
static sal_Bool impldbg_checkParameter_convertTFilterToPropertySequence ( const TFilter& rSource ,
- SEQUENCE< PROPERTYVALUE >& seqDestination );
+ const SEQUENCE< PROPERTYVALUE >& seqDestination );
static sal_Bool impldbg_checkParameter_convertTLoaderToPropertySequence ( const TLoader& rSource ,
- SEQUENCE< PROPERTYVALUE >& seqDestination );
+ const SEQUENCE< PROPERTYVALUE >& seqDestination );
static sal_Bool impldbg_checkParameter_convertTDetectorToPropertySequence ( const TDetector& rSource ,
- SEQUENCE< PROPERTYVALUE >& seqDestination );
+ const SEQUENCE< PROPERTYVALUE >& seqDestination );
#endif // #ifdef ENABLE_ASSERTIONS
@@ -522,13 +566,13 @@ class FilterCache
@onerror -
*//*-*****************************************************************************************************/
-// #ifdef ENABLE_FILTERCACHEDEBUG
+ #ifdef ENABLE_FILTERCACHEDEBUG
private:
void impldbg_showCacheContent();
-// #endif // #ifdef ENABLE_FILTERCACHEDEBUG
+ #endif // #ifdef ENABLE_FILTERCACHEDEBUG
//-------------------------------------------------------------------------------------------------------------
// private variables
@@ -547,11 +591,8 @@ class FilterCache
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 ;
+ static TDetector* m_pDefaultDetector ;
+ static TLoader* m_pGenericLoader ;
}; // class FilterCache
diff --git a/framework/source/register/registerservices.cxx b/framework/source/register/registerservices.cxx
index 2f731c6b5177..30776b384773 100644
--- a/framework/source/register/registerservices.cxx
+++ b/framework/source/register/registerservices.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: registerservices.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: as $ $Date: 2000-11-23 14:52:09 $
+ * last change: $Author: as $ $Date: 2000-11-28 14:45:29 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -119,7 +119,7 @@
#include <services/frameloaderfactory.hxx>
#endif
-#if TF_FILTER//MUSTFILTER
+#ifdef TF_FILTER//MUSTFILTER
#ifndef __FRAMEWORK_SERVICES_FILTERFACTORY_HXX_
#include <services/filterfactory.hxx>
#endif
@@ -131,7 +131,7 @@
COMPONENTGETIMPLEMENTATIONENVIRONMENT
-#if TF_FILTER//MUSTFILTER
+#ifdef TF_FILTER//MUSTFILTER
COMPONENTWRITEINFO ( COMPONENTINFO( ::framework::URLTransformer )
COMPONENTINFO( ::framework::PlugInFrame )
COMPONENTINFO( ::framework::Desktop )
diff --git a/framework/source/services/mediatypedetectionhelper.cxx b/framework/source/services/mediatypedetectionhelper.cxx
index 94b2a8867466..2b05b9898ca8 100644
--- a/framework/source/services/mediatypedetectionhelper.cxx
+++ b/framework/source/services/mediatypedetectionhelper.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: mediatypedetectionhelper.cxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: as $ $Date: 2000-11-23 14:52:10 $
+ * last change: $Author: as $ $Date: 2000-11-28 14:45:30 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -82,7 +82,7 @@
//_________________________________________________________________________________________________________________
// interface includes
//_________________________________________________________________________________________________________________
-#if !TF_FILTER//MUSTFILTER
+#ifndef TF_FILTER//MUSTFILTER
#ifndef _COM_SUN_STAR_FRAME_XFRAMELOADERQUERY_HPP_
#include <com/sun/star/frame/XFrameLoaderQuery.hpp>
#endif
@@ -94,7 +94,7 @@
namespace framework
{
-#if !TF_FILTER//MUSTFILTER
+#ifndef TF_FILTER//MUSTFILTER
using namespace ::com::sun::star::frame ;
#endif//MUSTFILTER
using namespace ::com::sun::star ;
@@ -159,7 +159,7 @@ sal_Bool SAL_CALL MediaTypeDetectionHelper::mapStrings(
return sal_False;
}
-#if !TF_FILTER//MUSTFILTER
+#ifndef TF_FILTER//MUSTFILTER
uno::Reference< frame::XFrameLoaderQuery > xQ(
m_xFactory->createInstance( SERVICENAME_FRAMELOADERFACTORY ),uno::UNO_QUERY );
//IMPLEMENTATIONNAME_FRAMELOADERFACTORY
@@ -210,6 +210,9 @@ sal_Bool SAL_CALL MediaTypeDetectionHelper::mapStrings(
/*-------------------------------------------------------------------------
$Log: not supported by cvs2svn $
+ Revision 1.1 2000/11/23 14:52:10 as
+ #79040# implement new filter detection - use TF_FILTER to enable
+
Revision 1.1.1.1 2000/09/18 16:29:23 hr
initial import
diff --git a/framework/test/test.cxx b/framework/test/test.cxx
index 47d8ade0d695..59844f13c0c5 100644
--- a/framework/test/test.cxx
+++ b/framework/test/test.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: test.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: as $ $Date: 2000-11-23 14:52:13 $
+ * last change: $Author: as $ $Date: 2000-11-28 14:45:33 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -162,11 +162,11 @@
#ifndef _COM_SUN_STAR_BRIDGE_XINSTANCEPROVIDER_HPP_
#include <com/sun/star/bridge/XInstanceProvider.hpp>
#endif
-
+#ifdef TF_FILTER//MUSTFILTER
#ifndef _COM_SUN_STAR_DOCUMENT_XTYPEDETECTION_HPP_
#include <com/sun/star/document/XTypeDetection.hpp>
#endif
-
+#endif
#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_
#include <com/sun/star/container/XNameAccess.hpp>
#endif
@@ -175,6 +175,10 @@
#include <com/sun/star/container/XElementAccess.hpp>
#endif
+#ifndef _COM_SUN_STAR_FRAME_XCONFIGMANAGER_HPP_
+#include <com/sun/star/frame/XConfigManager.hpp>
+#endif
+
//_________________________________________________________________________________________________________________
// other includes
//_________________________________________________________________________________________________________________
@@ -236,7 +240,9 @@ using namespace ::com::sun::star::util ;
using namespace ::com::sun::star::task ;
using namespace ::com::sun::star::mozilla ;
using namespace ::com::sun::star::bridge ;
+#ifdef TF_FILTER//MUSTFILTER
using namespace ::com::sun::star::document ;
+#endif
using namespace ::com::sun::star::container ;
//_________________________________________________________________________________________________________________
@@ -262,7 +268,9 @@ class TestApplication : public Application
void impl_testPlugIn ( const Reference< XDesktop >& xDesktop, const Reference< XMultiServiceFactory >& xFactory );
void impl_testLoginDialog ( );
void impl_testFilterCache ( );
+#ifdef TF_FILTER
void impl_testTypeDetection ( );
+#endif
//*********************************************************************************************************
// helper methods
@@ -284,6 +292,8 @@ TestApplication aTestApplication ;
void TestApplication::Main()
{
+ RegistryCache aCache;
+
/**-***********************************************************************************************************
initialize program
**************************************************************************************************************/
@@ -304,15 +314,22 @@ void TestApplication::Main()
test area
**************************************************************************************************************/
+ Reference< XInterface > xI( xGlobalServiceManager->createInstance( DECLARE_ASCII("com.sun.star.config.SpecialConfigManager") ), UNO_QUERY );
+ Reference< XConfigManager > xC( xI, UNO_QUERY );
+ LOG_ASSERT( xI.is(), "config not created\n" )
+ LOG_ASSERT( xC.is(), "config interface not found\n" )
+
//-------------------------------------------------------------------------------------------------------------
#ifdef TEST_FILTERCACHE
impl_testFilterCache();
#endif
//-------------------------------------------------------------------------------------------------------------
+#ifdef TF_FILTER
#ifdef TEST_TYPEDETECTION
impl_testTypeDetection();
#endif
+#endif
//-------------------------------------------------------------------------------------------------------------
#ifdef TEST_LOGINDIALOG
@@ -422,6 +439,7 @@ void TestApplication::Main()
//_________________________________________________________________________________________________________________
// test method
//_________________________________________________________________________________________________________________
+#ifdef TF_FILTER
void TestApplication::impl_testTypeDetection()
{
// We use a string buffer to log important informations and search results.
@@ -518,7 +536,7 @@ void TestApplication::impl_testTypeDetection()
WRITE_LOGFILE( "testTypeDetection.log", U2B(sBuffer.makeStringAndClear()).getStr() )
}
-
+#endif
//_________________________________________________________________________________________________________________
// test method
//_________________________________________________________________________________________________________________
@@ -580,7 +598,7 @@ void TestApplication::impl_testFilterCache()
}
*/
// searchFirstType( URL, MediaType, ClipboardFormat, startEntry )
- TConstTypeIterator aIterator;
+ TCheckedTypeIterator 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 );