diff options
author | Andreas Schlüns <as@openoffice.org> | 2001-04-11 10:25:50 +0000 |
---|---|---|
committer | Andreas Schlüns <as@openoffice.org> | 2001-04-11 10:25:50 +0000 |
commit | 7747670dbcbcd93cd013f6eb327d50a71fa8c404 (patch) | |
tree | c5be0890e31e60824a077d646eb939774e40c908 /framework | |
parent | 9adfc419cc05d47d15d7f5d4e272d49c4b9ffb29 (diff) |
#84766# filter registration, use ConfigItem, repair macros, threadsafe filtercache
Diffstat (limited to 'framework')
-rw-r--r-- | framework/inc/classes/checkediterator.hxx | 28 | ||||
-rw-r--r-- | framework/inc/classes/filtercache.hxx | 256 | ||||
-rw-r--r-- | framework/inc/commands.h | 124 | ||||
-rw-r--r-- | framework/inc/macros/debug/assertion.hxx | 56 | ||||
-rw-r--r-- | framework/inc/macros/debug/event.hxx | 8 | ||||
-rw-r--r-- | framework/inc/macros/debug/logmechanism.hxx | 16 | ||||
-rw-r--r-- | framework/inc/macros/debug/mutex.hxx | 24 | ||||
-rw-r--r-- | framework/inc/macros/debug/plugin.hxx | 12 | ||||
-rw-r--r-- | framework/inc/macros/debug/registration.hxx | 8 | ||||
-rw-r--r-- | framework/inc/macros/debug/targeting.hxx | 22 | ||||
-rw-r--r-- | framework/inc/macros/generic.hxx | 6 | ||||
-rw-r--r-- | framework/test/makefile.mk | 11 | ||||
-rw-r--r-- | framework/test/test.cxx | 41 | ||||
-rw-r--r-- | framework/test/test_filterregistration.bas | 95 | ||||
-rw-r--r-- | framework/test/threadtest.cxx | 32 |
15 files changed, 549 insertions, 190 deletions
diff --git a/framework/inc/classes/checkediterator.hxx b/framework/inc/classes/checkediterator.hxx index b5bd3cc2a0e1..3c1d3f0fb351 100644 --- a/framework/inc/classes/checkediterator.hxx +++ b/framework/inc/classes/checkediterator.hxx @@ -2,9 +2,9 @@ * * $RCSfile: checkediterator.hxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: as $ $Date: 2001-04-04 13:28:32 $ + * last change: $Author: as $ $Date: 2001-04-11 11:24:11 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -186,6 +186,28 @@ class CheckedIterator } /*-****************************************************************************************************//** + @short set internal states to E_END + @descr Sometimes we need a "walking" check-iterator which is initialized with the END-state! + We need it to return one default value if no other ones exist ... + + @seealso using in class FilterCache! + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + inline void setEnd() + { + m_pContainer = NULL ; + m_eEndState = E_END ; + m_bReverse = sal_False ; + m_nForward = 0 ; + m_nBackward = 0 ; + } + + /*-****************************************************************************************************//** @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! @@ -265,7 +287,7 @@ class CheckedIterator inline sal_Bool isUninitialized() { - return ( m_eEndState == E_UNKNOWN ); + return( m_eEndState == E_UNKNOWN ); } /*-****************************************************************************************************//** diff --git a/framework/inc/classes/filtercache.hxx b/framework/inc/classes/filtercache.hxx index e0f8994b00d8..36ee42338465 100644 --- a/framework/inc/classes/filtercache.hxx +++ b/framework/inc/classes/filtercache.hxx @@ -2,9 +2,9 @@ * * $RCSfile: filtercache.hxx,v $ * - * $Revision: 1.11 $ + * $Revision: 1.12 $ * - * last change: $Author: as $ $Date: 2001-04-05 13:26:56 $ + * last change: $Author: as $ $Date: 2001-04-11 11:24:11 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -122,6 +122,13 @@ #include <rtl/ustring> #endif +#define ENABLE_GENERATEFILTERCACHE +#ifdef ENABLE_GENERATEFILTERCACHE + #ifndef _RTL_USTRBUF_HXX_ + #include <rtl/ustrbuf.hxx> + #endif +#endif + #ifndef _OSL_MUTEX_HXX_ #include <osl/mutex.hxx> #endif @@ -189,6 +196,19 @@ class StringList : public ::std::vector< ::rtl::OUString > } }; +class StringHash : public ::std::hash_map< ::rtl::OUString , + ::rtl::OUString , + StringHashFunction , + ::std::equal_to< ::rtl::OUString > > +{ + public: + void free() + { + erase( begin(), end() ); + clear(); + } +}; + //***************************************************************************************************************** // These struct define a type, which present the type of a file. // He is used for easy filter detection without file stream detection! @@ -214,13 +234,12 @@ struct FileType inline void impl_clear() { - bPreferred = sal_False ; - sName = ::rtl::OUString() ; - sUIName = ::rtl::OUString() ; - lUINames = css::uno::Sequence< css::beans::PropertyValue >() ; - sMediaType = ::rtl::OUString() ; - sClipboardFormat = ::rtl::OUString() ; - nDocumentIconID = 0 ; + bPreferred = sal_False ; + sName = ::rtl::OUString() ; + sMediaType = ::rtl::OUString() ; + sClipboardFormat = ::rtl::OUString() ; + nDocumentIconID = 0 ; + lUINames.free (); lURLPattern.free(); lExtensions.free(); } @@ -229,7 +248,6 @@ struct FileType { bPreferred = rCopy.bPreferred ; sName = rCopy.sName ; - sUIName = rCopy.sUIName ; lUINames = rCopy.lUINames ; sMediaType = rCopy.sMediaType ; sClipboardFormat = rCopy.sClipboardFormat; @@ -244,15 +262,14 @@ struct FileType //------------------------------------------------------------------------------------------------------------- public: - sal_Bool bPreferred ; - ::rtl::OUString sName ; - ::rtl::OUString sUIName ; - css::uno::Sequence< css::beans::PropertyValue > lUINames ; - ::rtl::OUString sMediaType ; - ::rtl::OUString sClipboardFormat ; - sal_Int32 nDocumentIconID ; - StringList lURLPattern ; - StringList lExtensions ; + sal_Bool bPreferred ; + ::rtl::OUString sName ; + StringHash lUINames ; + ::rtl::OUString sMediaType ; + ::rtl::OUString sClipboardFormat ; + sal_Int32 nDocumentIconID ; + StringList lURLPattern ; + StringList lExtensions ; }; //***************************************************************************************************************** @@ -283,21 +300,19 @@ struct Filter { sName = ::rtl::OUString() ; sType = ::rtl::OUString() ; - sUIName = ::rtl::OUString() ; - lUINames = css::uno::Sequence< css::beans::PropertyValue >() ; sDocumentService = ::rtl::OUString() ; sFilterService = ::rtl::OUString() ; nFlags = 0 ; nFileFormatVersion = 0 ; sTemplateName = ::rtl::OUString() ; - lUserData.free(); + lUINames.free (); + lUserData.free (); } inline Filter& impl_copy( const Filter& rCopy ) { sName = rCopy.sName ; sType = rCopy.sType ; - sUIName = rCopy.sUIName ; lUINames = rCopy.lUINames ; sDocumentService = rCopy.sDocumentService ; sFilterService = rCopy.sFilterService ; @@ -313,16 +328,15 @@ struct Filter //------------------------------------------------------------------------------------------------------------- public: - ::rtl::OUString sName ; - ::rtl::OUString sType ; - ::rtl::OUString sUIName ; - css::uno::Sequence< css::beans::PropertyValue > lUINames ; - ::rtl::OUString sDocumentService ; - ::rtl::OUString sFilterService ; - sal_Int32 nFlags ; - StringList lUserData ; - sal_Int32 nFileFormatVersion ; - ::rtl::OUString sTemplateName ; + ::rtl::OUString sName ; + ::rtl::OUString sType ; + StringHash lUINames ; + ::rtl::OUString sDocumentService ; + ::rtl::OUString sFilterService ; + sal_Int32 nFlags ; + StringList lUserData ; + sal_Int32 nFileFormatVersion ; + ::rtl::OUString sTemplateName ; }; //***************************************************************************************************************** @@ -395,16 +409,14 @@ struct Loader inline void impl_clear() { - sName = ::rtl::OUString() ; - sUIName = ::rtl::OUString() ; - lUINames = css::uno::Sequence< css::beans::PropertyValue >() ; - lTypes.free(); + sName = ::rtl::OUString(); + lUINames.free (); + lTypes.free (); } inline Loader& impl_copy( const Loader& rCopy ) { sName = rCopy.sName ; - sUIName = rCopy.sUIName ; lUINames = rCopy.lUINames ; lTypes = rCopy.lTypes ; return (*this); @@ -415,10 +427,9 @@ struct Loader //------------------------------------------------------------------------------------------------------------- public: - ::rtl::OUString sName ; - ::rtl::OUString sUIName ; - css::uno::Sequence< css::beans::PropertyValue > lUINames ; - StringList lTypes ; + ::rtl::OUString sName ; + StringHash lUINames ; + StringList lTypes ; }; //***************************************************************************************************************** @@ -495,24 +506,14 @@ class PerformanceHash : public ::std::hash_map< ::rtl::OUString } }; -class PreferredHash : public ::std::hash_map< ::rtl::OUString , - ::rtl::OUString , - StringHashFunction , - ::std::equal_to< ::rtl::OUString > > -{ - public: - void free() - { - erase( begin(), end() ); - clear(); - } -}; +typedef StringHash PreferredHash; //***************************************************************************************************************** // Defines "pointers" to items of our hash maps. //***************************************************************************************************************** -typedef StringList::iterator StringIterator ; -typedef StringList::const_iterator ConstStringIterator ; +typedef StringList::iterator StringListIterator ; +typedef StringList::const_iterator ConstStringListIterator ; +typedef StringHash::const_iterator ConstStringHashIterator ; typedef FileTypeHash::const_iterator ConstTypeIterator ; typedef FilterHash::const_iterator ConstFilterIterator ; typedef DetectorHash::const_iterator ConstDetectorIterator ; @@ -810,6 +811,8 @@ class FilterCache : private FairRWLockBase static void impl_convertLoaderToPropertySequence ( const Loader& aSource, css::uno::Sequence< css::beans::PropertyValue >& lDestination ); static void impl_convertDetectorToPropertySequence ( const Detector& aSource, css::uno::Sequence< css::beans::PropertyValue >& lDestination ); static void impl_convertPropertySequenceToFilter ( const css::uno::Sequence< css::beans::PropertyValue >& lSource, Filter& aDestination ); + static void impl_convertStringHashToSequence ( const StringHash& lSource, css::uno::Sequence< css::beans::PropertyValue >& lDestination ); + static void impl_convertSequenceToStringHash ( const css::uno::Sequence< css::beans::PropertyValue >& lSource, StringHash& lDestination ); /*-****************************************************************************************************//** @short extract extension from given URL @@ -826,23 +829,62 @@ class FilterCache : private FairRWLockBase static ::rtl::OUString impl_extractURLExtension( const ::rtl::OUString& sURL ); /*-****************************************************************************************************//** - @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! + @short filter all "*." from an extension + @descr We search for extensions without wildcards at runtime! + Our configuration contains sometimes extensions WITH wildcards .. + We should correct it at runtime. - @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! + @param "lExtensions", list of extensions to correct + @return - + + @onerror No error should occure. + *//*-*****************************************************************************************************/ + + static void impl_correctExtensions( StringList& lExtensions ); + + /*-****************************************************************************************************//** + @short extract localized strings from given configuration item or reverse + @descr It exist to methods to get a localized value from our configuration. + a) cfg returns one value for current set locale + b) cfg returns a list of values for all possible locales + These method detect it and fills our internal "localelized" hash automaticly or + convert internal structures to external ones. + + @seealso baseclass ConfigItem + @seealso method impl_setLocalelizedString() + @seealso method impl_getLocalelizedString() + + @param "pLocale" , is used by a) only to insert value at right hash position + @param "aCFGValue" , contains a) [OUString] ... or b) [Sequence< PropertyValue >] + @param "lLocales" , internal description of localized values! + @return List of sorted locales with values. + + @onerror No error should occure. + *//*-*****************************************************************************************************/ + + static void impl_extractLocalizedStrings( const ::rtl::OUString* pCurrentLocale, const css::uno::Any& aCFGValue, StringHash& lLocales ); + static void impl_packLocalizedStrings ( const ::rtl::OUString* pCurrentLocale, css::uno::Any& aCFGValue, const StringHash& lLocales ); + + /*-****************************************************************************************************//** + @short return right value from list of all localized ones + @descr We hold a list of all e.g. UINames for every set item. + If user whish to get current UIName for current set locale ... you can call + this method to get this information. + + @seealso method impl_extractLocalizedStrings() + + @param "lLocales" , list of all localized values + @param "sLocale" , current set locale + @param "sValue" , new localized value to set in list for current locale + @return Matching UIName for current locale from list. @onerror No error should occure. *//*-*****************************************************************************************************/ -//obsolete static void impl_correctExtensions( StringList& lExtensions ); + static ::rtl::OUString impl_getLocalelizedString( const StringHash& lLocales, const ::rtl::OUString* pLocale ); + static void impl_setLocalelizedString( StringHash& lLocales, const ::rtl::OUString* pLocale, const ::rtl::OUString& sValue ); /*-****************************************************************************************************//** @short fill our cache with values from configuration @@ -969,13 +1011,6 @@ class FilterCache : private FairRWLockBase @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 @@ -984,6 +1019,8 @@ class FilterCache : private FairRWLockBase void impldbg_generateHTMLView (); + private: + void impl_generateTypeListHTML (); void impl_generateFilterListHTML (); void impl_generateDetectorListHTML (); @@ -998,6 +1035,78 @@ class FilterCache : private FairRWLockBase #endif // #ifdef ENABLE_FILTERCACHEDEBUG + /*-****************************************************************************************************//** + @short special methods to support comfortable changing of our configuration files + @descr We need a configuration file written in xml-format ... but we must generate it as an xcd file + and compile it to xml target format. + *//*-*****************************************************************************************************/ + + #ifdef ENABLE_GENERATEFILTERCACHE + + public: + + void impldbg_generateXCD ( const sal_Char* sFileName , + sal_Bool bWriteable , + sal_Unicode cSeparator ); + + private: + + void impl_generateCopyright ( ::rtl::OUStringBuffer& sXCD ); + void impl_generateTypeTemplate ( ::rtl::OUStringBuffer& sXCD , + sal_Bool bWriteable , + sal_Unicode cSeparator ); + void impl_generateFilterTemplate ( ::rtl::OUStringBuffer& sXCD , + sal_Bool bWriteable , + sal_Unicode cSeparator ); + void impl_generateDetectorTemplate ( ::rtl::OUStringBuffer& sXCD , + sal_Bool bWriteable , + sal_Unicode cSeparator ); + void impl_generateLoaderTemplate ( ::rtl::OUStringBuffer& sXCD , + sal_Bool bWriteable , + sal_Unicode cSeparator ); + void impl_generateFilterFlagTemplate ( ::rtl::OUStringBuffer& sXCD , + const ::rtl::OUString& sName , + sal_Int32 nValue , + const ::rtl::OString& sDescription = ::rtl::OString() ); + void impl_generateTypeSet ( ::rtl::OUStringBuffer& sXCD , + sal_Bool bWriteable , + sal_Unicode cSeparator ); + void impl_generateFilterSet ( ::rtl::OUStringBuffer& sXCD , + sal_Bool bWriteable , + sal_Unicode cSeparator ); + void impl_generateDetectorSet ( ::rtl::OUStringBuffer& sXCD , + sal_Bool bWriteable , + sal_Unicode cSeparator ); + void impl_generateLoaderSet ( ::rtl::OUStringBuffer& sXCD , + sal_Bool bWriteable , + sal_Unicode cSeparator ); + void impl_generateDefaults ( ::rtl::OUStringBuffer& sXCD ); + void impl_generateIntProperty ( ::rtl::OUStringBuffer& sXCD , + const ::rtl::OUString& sName , + sal_Int32 nValue , + sal_Bool bWriteable ); + void impl_generateBoolProperty ( ::rtl::OUStringBuffer& sXCD , + const ::rtl::OUString& sName , + sal_Bool bValue , + sal_Bool bWriteable ); + void impl_generateStringProperty ( ::rtl::OUStringBuffer& sXCD , + const ::rtl::OUString& sName , + const ::rtl::OUString& sValue , + sal_Bool bWriteable ); + void impl_generateStringListProperty ( ::rtl::OUStringBuffer& sXCD , + const ::rtl::OUString& sName , + const StringList& lValue , + sal_Bool bWriteable , + sal_Unicode cSeparator ); + void impl_generateUINamesProperty ( ::rtl::OUStringBuffer& sXCD , + const ::rtl::OUString& sName , + const StringHash& lUINames , + sal_Bool bWriteable , + sal_Unicode cSeparator ); + ::rtl::OUString impl_filterSpecialSigns ( const ::rtl::OUString& sValue ); + + #endif // #ifdef ENABLE_GENERATEFILTERCACHE + //------------------------------------------------------------------------------------------------------------- // private variables //------------------------------------------------------------------------------------------------------------- @@ -1015,6 +1124,7 @@ class FilterCache : private FairRWLockBase static PreferredHash* m_pPreferredTypesCache ; static Detector* m_pDefaultDetector ; static Loader* m_pGenericLoader ; + static ::rtl::OUString* m_pLocale ; }; // class FilterCache diff --git a/framework/inc/commands.h b/framework/inc/commands.h new file mode 100644 index 000000000000..514f8ac5fe86 --- /dev/null +++ b/framework/inc/commands.h @@ -0,0 +1,124 @@ +/************************************************************************* + * + * $RCSfile: commands.h,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: as $ $Date: 2001-04-11 11:25:21 $ + * + * 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_COMMANDS_H_ +#define __FRAMEWORK_COMMANDS_H_ + +//_________________________________________________________________________________________________________________ +// includes +//_________________________________________________________________________________________________________________ + +#ifndef __FRAMEWORK_MACROS_GENERIC_HXX_ +#include <macros/generic.hxx> +#endif + +#ifndef _VOS_PROCESS_HXX_ +#include <vos/process.hxx> +#endif + +#ifndef _RTL_USTRING_ +#include <rtl/ustring> +#endif + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +/*-************************************************************************************************************//** + @short These values describe some command line arguments of our office. + We need it e.g. to detect running mode of it - plugin, headless ... +*//*-*************************************************************************************************************/ + +#define COMMAND_PLUGIN DECLARE_ASCII("-plugin" ) /// office is plugged into a browser +#define COMMAND_HEADLESS DECLARE_ASCII("-headless" ) /// office runs in headless mode for scripting + +/*-************************************************************************************************************//** + @short This method parse command line of office and search for any argument. + We return true/false for existing/non existing values. +*//*-*************************************************************************************************************/ + +sal_Bool c_existCommand( const ::rtl::OUString& sSearchCommand ) +{ + // Set default return value if search failed or unknown commands are searched. + sal_Bool bState = sal_False ; + ::vos::OStartupInfo aCommandLine ; + sal_uInt32 nCount = aCommandLine.getCommandArgCount() ; + ::rtl::OUString sCommand ; + for( sal_uInt32 nCommand=0; nCommand<nCount; ++nCommand ) + { + if( aCommandLine.getCommandArg( nCommand, sCommand ) == ::vos::OStartupInfo::E_None ) + { + if( sCommand == sSearchCommand ) + { + bState = sal_True; + break; + } + } + } + + return bState; +} + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_TARGETS_H_ diff --git a/framework/inc/macros/debug/assertion.hxx b/framework/inc/macros/debug/assertion.hxx index 98b15f299e87..aafec3f86bba 100644 --- a/framework/inc/macros/debug/assertion.hxx +++ b/framework/inc/macros/debug/assertion.hxx @@ -2,9 +2,9 @@ * * $RCSfile: assertion.hxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: jl $ $Date: 2001-03-21 14:30:52 $ + * last change: $Author: as $ $Date: 2001-04-11 11:24:13 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -113,13 +113,13 @@ #define LOG_ASSERT2( BCONDITION, SMETHOD, STEXT ) \ if ( ( BCONDITION ) == sal_True ) \ { \ - ::rtl::OStringBuffer sBuffer( 256 ); \ - sBuffer.append( "ASSERT:\n\t" ); \ - sBuffer.append( SMETHOD ); \ - sBuffer.append( "\n\t\"" ); \ - sBuffer.append( STEXT ); \ - sBuffer.append( "\"\n" ); \ - WRITE_LOGFILE( LOGFILE_ASSERTIONS, sBuffer.makeStringAndClear().getStr() ) \ + ::rtl::OStringBuffer _sAssertBuffer( 256 ); \ + _sAssertBuffer.append( "ASSERT:\n\t" ); \ + _sAssertBuffer.append( SMETHOD ); \ + _sAssertBuffer.append( "\n\t\"" ); \ + _sAssertBuffer.append( STEXT ); \ + _sAssertBuffer.append( "\"\n" ); \ + WRITE_LOGFILE( LOGFILE_ASSERTIONS, _sAssertBuffer.makeStringAndClear() ) \ } #endif @@ -143,13 +143,13 @@ #define LOG_ASSERT2( BCONDITION, SMETHODE, STEXT ) \ if ( ( BCONDITION ) == sal_True ) \ { \ - ::rtl::OStringBuffer sBuffer( 256 ); \ - sBuffer.append( "ASSERT:\n\t" ); \ - sBuffer.append( SMETHOD ); \ - sBuffer.append( "\n\t\"" ); \ - sBuffer.append( STEXT ); \ - sBuffer.append( "\"\n" ); \ - WRITE_LOGFILE( LOGFILE_ASSERTIONS, sBuffer.makeStringAndClear().getStr() ) \ + ::rtl::OStringBuffer _sAssertBuffer( 256 ); \ + _sAssertBuffer.append( "ASSERT:\n\t" ); \ + _sAssertBuffer.append( SMETHOD ); \ + _sAssertBuffer.append( "\n\t\"" ); \ + _sAssertBuffer.append( STEXT ); \ + _sAssertBuffer.append( "\"\n" ); \ + WRITE_LOGFILE( LOGFILE_ASSERTIONS, _sAssertBuffer.makeStringAndClear() ) \ exit(-1); \ } @@ -169,13 +169,13 @@ #define LOG_ASSERT2( BCONDITION, SMETHOD, STEXT ) \ { \ - ::rtl::OStringBuffer sBuffer( 256 ); \ - sBuffer.append( "ASSERT:\n\t" ); \ - sBuffer.append( SMETHOD ); \ - sBuffer.append( "\n\t\"" ); \ - sBuffer.append( STEXT ); \ - sBuffer.append( "\"\n" ); \ - OSL_ENSURE( !( BCONDITION ), sBuffer.makeStringAndClear().getStr() ); \ + ::rtl::OStringBuffer _sAssertBuffer( 256 ); \ + _sAssertBuffer.append( "ASSERT:\n\t" ); \ + _sAssertBuffer.append( SMETHOD ); \ + _sAssertBuffer.append( "\n\t\"" ); \ + _sAssertBuffer.append( STEXT ); \ + _sAssertBuffer.append( "\"\n" ); \ + OSL_ENSURE( !( BCONDITION ), _sAssertBuffer.makeStringAndClear() ); \ } #endif @@ -198,11 +198,11 @@ #define LOG_EXCEPTION( SMETHOD, SOWNMESSAGE, SEXCEPTIONMESSAGE ) \ { \ - ::rtl::OStringBuffer sBuffer( 256 ); \ - sBuffer.append( SOWNMESSAGE ); \ - sBuffer.append( "\n" ); \ - sBuffer.append( U2B(SEXCEPTIONMESSAGE) ); \ - LOG_ERROR( SMETHOD, sBuffer.makeStringAndClear().getStr() ) \ + ::rtl::OStringBuffer _sAssertBuffer( 256 ); \ + _sAssertBuffer.append( SOWNMESSAGE ); \ + _sAssertBuffer.append( "\n" ); \ + _sAssertBuffer.append( U2B(SEXCEPTIONMESSAGE) ); \ + LOG_ERROR( SMETHOD, _sAssertBuffer.makeStringAndClear() ) \ } #else // #ifdef ENABLE_ASSERTIONS diff --git a/framework/inc/macros/debug/event.hxx b/framework/inc/macros/debug/event.hxx index 9638cdff6c39..d6d2623e82c5 100644 --- a/framework/inc/macros/debug/event.hxx +++ b/framework/inc/macros/debug/event.hxx @@ -2,9 +2,9 @@ * * $RCSfile: event.hxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 16:29:23 $ + * last change: $Author: as $ $Date: 2001-04-11 11:24:13 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -126,7 +126,7 @@ break; \ } \ sBuffer.append( " ... event to listener.\n\n" ); \ - WRITE_LOGFILE( LOGFILE_EVENTDEBUG, sBuffer.makeStringAndClear().getStr() ) \ + WRITE_LOGFILE( LOGFILE_EVENTDEBUG, sBuffer.makeStringAndClear() ) \ } /*_____________________________________________________________________________________________________________ @@ -144,7 +144,7 @@ sBuffer.append( " ] \"" ); \ sBuffer.append( U2B( SFRAMENAME ) ); \ sBuffer.append( "\" send dispose event to listener.\n\n"); \ - WRITE_LOGFILE( LOGFILE_EVENTDEBUG, sBuffer.makeStringAndClear().getStr() ) \ + WRITE_LOGFILE( LOGFILE_EVENTDEBUG, sBuffer.makeStringAndClear() ) \ } #else // #ifdef ENABLE_EVENTDEBUG diff --git a/framework/inc/macros/debug/logmechanism.hxx b/framework/inc/macros/debug/logmechanism.hxx index 4bed94c69edc..d91f3210358f 100644 --- a/framework/inc/macros/debug/logmechanism.hxx +++ b/framework/inc/macros/debug/logmechanism.hxx @@ -2,9 +2,9 @@ * * $RCSfile: logmechanism.hxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 16:29:23 $ + * last change: $Author: as $ $Date: 2001-04-11 11:24:13 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -72,6 +72,10 @@ // includes //_____________________________________________________________________________________________________________ + #ifndef _RTL_STRING_HXX_ + #include <rtl/string.hxx> + #endif + #include <stdio.h> /*_____________________________________________________________________________________________________________ @@ -85,9 +89,11 @@ #define WRITE_LOGFILE( SFILENAME, STEXT ) \ { \ - FILE* pFile = fopen( SFILENAME, "a" ); \ - fprintf( pFile, STEXT ); \ - fclose ( pFile ); \ + ::rtl::OString _swriteLogfileFileName ( SFILENAME ); \ + ::rtl::OString _swriteLogfileText ( STEXT ); \ + FILE* pFile = fopen( _swriteLogfileFileName.getStr(), "a" ); \ + fprintf( pFile, _swriteLogfileText.getStr() ); \ + fclose ( pFile ); \ } /*_____________________________________________________________________________________________________________ diff --git a/framework/inc/macros/debug/mutex.hxx b/framework/inc/macros/debug/mutex.hxx index c9a58c8d7a37..16ffc7df1f3b 100644 --- a/framework/inc/macros/debug/mutex.hxx +++ b/framework/inc/macros/debug/mutex.hxx @@ -2,9 +2,9 @@ * * $RCSfile: mutex.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: as $ $Date: 2001-03-02 12:47:06 $ + * last change: $Author: as $ $Date: 2001-04-11 11:24:13 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -117,7 +117,7 @@ sBuffer.append( " this=" ); sBuffer.append( (sal_Int32)(this) ); sBuffer.append( " )\n" ); - WRITE_LOGFILE( LOGFILE_MUTEX, sBuffer.makeStringAndClear().getStr() ); + WRITE_LOGFILE( LOGFILE_MUTEX, sBuffer.makeStringAndClear() ); m_pMutex->acquire(); } @@ -128,7 +128,7 @@ sBuffer.append( " this=" ); sBuffer.append( (sal_Int32)(this) ); sBuffer.append( " )\n" ); - WRITE_LOGFILE( LOGFILE_MUTEX, sBuffer.makeStringAndClear().getStr() ); + WRITE_LOGFILE( LOGFILE_MUTEX, sBuffer.makeStringAndClear() ); } dbgGuard( ::osl::Mutex& rMutex, const char* sMethod ) @@ -145,7 +145,7 @@ sBuffer.append( " this=" ); sBuffer.append( (sal_Int32)(this) ); sBuffer.append( " )\n" ); - WRITE_LOGFILE( LOGFILE_MUTEX, sBuffer.makeStringAndClear().getStr() ); + WRITE_LOGFILE( LOGFILE_MUTEX, sBuffer.makeStringAndClear() ); m_pMutex->acquire(); } @@ -156,7 +156,7 @@ sBuffer.append( " this=" ); sBuffer.append( (sal_Int32)(this) ); sBuffer.append( " )\n" ); - WRITE_LOGFILE( LOGFILE_MUTEX, sBuffer.makeStringAndClear().getStr() ); + WRITE_LOGFILE( LOGFILE_MUTEX, sBuffer.makeStringAndClear() ); } inline ~dbgGuard() @@ -178,7 +178,7 @@ sBuffer.append( " this=" ); sBuffer.append( (sal_Int32)(this) ); sBuffer.append( " )\n" ); - WRITE_LOGFILE( LOGFILE_MUTEX, sBuffer.makeStringAndClear().getStr() ); + WRITE_LOGFILE( LOGFILE_MUTEX, sBuffer.makeStringAndClear() ); m_pMutex = NULL; } @@ -209,7 +209,7 @@ // sBuffer.append( "mutex aquire block at \"" ); \ // sBuffer.append( SMETHOD ); \ // sBuffer.append( "\" ...\n" ); \ -// WRITE_LOGFILE( LOGFILE_MUTEX, sBuffer.makeStringAndClear().getStr() ); \ +// WRITE_LOGFILE( LOGFILE_MUTEX, sBuffer.makeStringAndClear() ); \ // } \ // else \ // { /* Don't forget to release successfull aquired mutex again! */ \ @@ -224,7 +224,7 @@ // sBuffer.append( "mutex successfull aquired at \"" ); \ // sBuffer.append( SMETHOD ); \ // sBuffer.append( "\" ....\n" ); \ -// WRITE_LOGFILE( LOGFILE_MUTEX, sBuffer.makeStringAndClear().getStr() ); \ +// WRITE_LOGFILE( LOGFILE_MUTEX, sBuffer.makeStringAndClear() ); \ // } /*_____________________________________________________________________________________________________________ @@ -248,7 +248,7 @@ // sBuffer.append( "\tAttention:\tglobal mutex aquire block at \"" ); \ // sBuffer.append( SMETHOD ); \ // sBuffer.append( "\" ...\n" ); \ -// WRITE_LOGFILE( LOGFILE_MUTEX, sBuffer.makeStringAndClear().getStr() ); \ +// WRITE_LOGFILE( LOGFILE_MUTEX, sBuffer.makeStringAndClear() ); \ // } \ // else \ // { /* Don't forget to release successfull aquired mutex again! */ \ @@ -263,7 +263,7 @@ // sBuffer.append( "global mutex successfull aquired at \""); \ // sBuffer.append( SMETHOD ); \ // sBuffer.append( "\" ....\n" ); \ -// WRITE_LOGFILE( LOGFILE_MUTEX, sBuffer.makeStringAndClear().getStr() ); \ +// WRITE_LOGFILE( LOGFILE_MUTEX, sBuffer.makeStringAndClear() ); \ // } /*_____________________________________________________________________________________________________________ @@ -283,7 +283,7 @@ // sBuffer.append( "mutex cleared at \"" ); \ // sBuffer.append( SMETHOD ); \ // sBuffer.append( "\" sucessful ...\n" ); \ -// WRITE_LOGFILE( LOGFILE_MUTEX, sBuffer.makeStringAndClear().getStr() ); \ +// WRITE_LOGFILE( LOGFILE_MUTEX, sBuffer.makeStringAndClear() ); \ // } #else // #ifdef ENABLE_MUTEXDEBUG diff --git a/framework/inc/macros/debug/plugin.hxx b/framework/inc/macros/debug/plugin.hxx index dd815d36b8c4..d61204c4c5b3 100644 --- a/framework/inc/macros/debug/plugin.hxx +++ b/framework/inc/macros/debug/plugin.hxx @@ -2,9 +2,9 @@ * * $RCSfile: plugin.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: as $ $Date: 2000-12-19 10:12:24 $ + * last change: $Author: as $ $Date: 2001-04-11 11:24:13 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -112,7 +112,7 @@ sBuffer.append( "\", externalURL=\""); \ sBuffer.append( U2B( SEXTERNALURL ) ); \ sBuffer.append( "\" ) to browser.\n"); \ - WRITE_LOGFILE( LOGFILE_PLUGIN, sBuffer.makeStringAndClear().getStr() ) \ + WRITE_LOGFILE( LOGFILE_PLUGIN, sBuffer.makeStringAndClear() ) \ } /*_____________________________________________________________________________________________________________ @@ -138,7 +138,7 @@ sBuffer.append( "\", internalURL=\"" ); \ sBuffer.append( U2B( SINTERNALURL ) ); \ sBuffer.append( "\" ) from browser.\n" ); \ - WRITE_LOGFILE( LOGFILE_PLUGIN, sBuffer.makeStringAndClear().getStr() ) \ + WRITE_LOGFILE( LOGFILE_PLUGIN, sBuffer.makeStringAndClear() ) \ } /*_____________________________________________________________________________________________________________ @@ -169,7 +169,7 @@ sBuffer.append( "empty Any )" ); \ } \ sBuffer.append( "\n" ); \ - WRITE_LOGFILE( LOGFILE_PLUGIN, sBuffer.makeStringAndClear().getStr() ) \ + WRITE_LOGFILE( LOGFILE_PLUGIN, sBuffer.makeStringAndClear() ) \ } /*_____________________________________________________________________________________________________________ @@ -212,7 +212,7 @@ sBuffer.append( "empty Any )" ); \ } \ sBuffer.append( "\n" ); \ - WRITE_LOGFILE( LOGFILE_PLUGIN, sBuffer.makeStringAndClear().getStr() ) \ + WRITE_LOGFILE( LOGFILE_PLUGIN, sBuffer.makeStringAndClear() ) \ } #else // #ifdef ENABLE_PLUGINDEBUG diff --git a/framework/inc/macros/debug/registration.hxx b/framework/inc/macros/debug/registration.hxx index 9c35acc0fb15..ac38f5cc4652 100644 --- a/framework/inc/macros/debug/registration.hxx +++ b/framework/inc/macros/debug/registration.hxx @@ -2,9 +2,9 @@ * * $RCSfile: registration.hxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 16:29:23 $ + * last change: $Author: as $ $Date: 2001-04-11 11:24:13 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -98,7 +98,7 @@ ::rtl::OStringBuffer sOut( 1024 ); \ sOut.append( "component_writeInfo():" ); \ sOut.append( SINFOTEXT ); \ - WRITE_LOGFILE( LOGFILE_REGISTRATION, sOut.makeStringAndClear().getStr() ) \ + WRITE_LOGFILE( LOGFILE_REGISTRATION, sOut.makeStringAndClear() ) \ } /*_____________________________________________________________________________________________________________ @@ -112,7 +112,7 @@ ::rtl::OStringBuffer sOut( 1024 ); \ sOut.append( "component_getFactory():" ); \ sOut.append( SINFOTEXT ); \ - WRITE_LOGFILE( LOGFILE_REGISTRATION, sOut.makeStringAndClear().getStr() ) \ + WRITE_LOGFILE( LOGFILE_REGISTRATION, sOut.makeStringAndClear() ) \ } #else // #ifdef ENABLE_REGISTRATIONDEBUG diff --git a/framework/inc/macros/debug/targeting.hxx b/framework/inc/macros/debug/targeting.hxx index 6d49e459a44b..a9692a5cd896 100644 --- a/framework/inc/macros/debug/targeting.hxx +++ b/framework/inc/macros/debug/targeting.hxx @@ -2,9 +2,9 @@ * * $RCSfile: targeting.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: as $ $Date: 2001-03-09 14:42:24 $ + * last change: $Author: as $ $Date: 2001-04-11 11:24:13 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -112,8 +112,8 @@ sBufferParam.append( "\"\n" ); \ sBufferSteps.append( U2B( SFRAMENAME ) ); \ sBufferSteps.append( "--" ); \ - WRITE_LOGFILE( LOGFILE_TARGETPARAM, sBufferParam.makeStringAndClear().getStr() ) \ - WRITE_LOGFILE( LOGFILE_TARGETSTEPS, sBufferSteps.makeStringAndClear().getStr() ) \ + WRITE_LOGFILE( LOGFILE_TARGETPARAM, sBufferParam.makeStringAndClear() ) \ + WRITE_LOGFILE( LOGFILE_TARGETSTEPS, sBufferSteps.makeStringAndClear() ) \ } /*_____________________________________________________________________________________________________________ @@ -138,7 +138,7 @@ sBuffer.append( "\", " ); \ sBuffer.append( ::rtl::OString::valueOf( sal_Int32( NSEARCHFLAGS ) ) ); \ sBuffer.append( " )\n" ); \ - WRITE_LOGFILE( LOGFILE_TARGETPARAM, sBuffer.makeStringAndClear().getStr() ) \ + WRITE_LOGFILE( LOGFILE_TARGETPARAM, sBuffer.makeStringAndClear() ) \ } /*_____________________________________________________________________________________________________________ @@ -173,7 +173,7 @@ } \ } \ sBuffer.append( " )\n" ); \ - WRITE_LOGFILE( LOGFILE_TARGETPARAM, sBuffer.makeStringAndClear().getStr() ) \ + WRITE_LOGFILE( LOGFILE_TARGETPARAM, sBuffer.makeStringAndClear() ) \ } /*_____________________________________________________________________________________________________________ @@ -196,7 +196,7 @@ { \ sBufferParam.append( "return with valid frame.\n" ); \ sBufferSteps.append( "OK [" ); \ - sBufferSteps.append( U2B( XFRAME->getName() ).getStr() ); \ + sBufferSteps.append( U2B( XFRAME->getName() ) ); \ sBufferSteps.append( "]\n" ); \ } \ else \ @@ -204,8 +204,8 @@ sBufferParam.append( "return with NULL frame!\n"); \ sBufferSteps.append( "??\n" ); \ } \ - WRITE_LOGFILE( LOGFILE_TARGETPARAM, sBufferParam.makeStringAndClear().getStr() ) \ - WRITE_LOGFILE( LOGFILE_TARGETSTEPS, sBufferSteps.makeStringAndClear().getStr() ) \ + WRITE_LOGFILE( LOGFILE_TARGETPARAM, sBufferParam.makeStringAndClear() ) \ + WRITE_LOGFILE( LOGFILE_TARGETSTEPS, sBufferSteps.makeStringAndClear() ) \ } /*_____________________________________________________________________________________________________________ @@ -232,7 +232,7 @@ sBuffer.append( "::queryDispatch() return with NULL dispatcher!" ); \ } \ sBuffer.append( "\n" ); \ - WRITE_LOGFILE( LOGFILE_TARGETPARAM, sBuffer.makeStringAndClear().getStr() ) \ + WRITE_LOGFILE( LOGFILE_TARGETPARAM, sBuffer.makeStringAndClear() ) \ } /*_____________________________________________________________________________________________________________ @@ -259,7 +259,7 @@ sBuffer.append( "::loadComponentFromURL() return with NULL component!" ); \ } \ sBuffer.append( "\n" ); \ - WRITE_LOGFILE( LOGFILE_TARGETPARAM, sBuffer.makeStringAndClear().getStr() ) \ + WRITE_LOGFILE( LOGFILE_TARGETPARAM, sBuffer.makeStringAndClear() ) \ } #else // #ifdef ENABLE_TARGETINGDEBUG diff --git a/framework/inc/macros/generic.hxx b/framework/inc/macros/generic.hxx index 15bbaa8653f5..1f63a67f2018 100644 --- a/framework/inc/macros/generic.hxx +++ b/framework/inc/macros/generic.hxx @@ -2,9 +2,9 @@ * * $RCSfile: generic.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: as $ $Date: 2000-12-12 10:14:24 $ + * last change: $Author: as $ $Date: 2001-04-11 11:24:12 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -90,7 +90,7 @@ _________________________________________________________________________________________________________________*/ #define DECLARE_ASCII( SASCIIVALUE ) \ - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( SASCIIVALUE )) + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SASCIIVALUE ) ) /*_________________________________________________________________________________________________________________ U2B( SUNICODEVALUE ) diff --git a/framework/test/makefile.mk b/framework/test/makefile.mk index 3122a0650dee..3545623a55c8 100644 --- a/framework/test/makefile.mk +++ b/framework/test/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.4 $ +# $Revision: 1.5 $ # -# last change: $Author: as $ $Date: 2001-03-29 13:17:17 $ +# last change: $Author: as $ $Date: 2001-04-11 11:24:14 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -140,7 +140,11 @@ APP3TARGET= typecfg APP3OBJS= $(SLO)$/typecfg.obj \ $(SLO)$/servicemanager.obj \ $(SLO)$/filtercache.obj \ - $(SLO)$/wildcard.obj + $(SLO)$/wildcard.obj \ + $(SLO)$/fairrwlock.obj \ + $(SLO)$/writeguard.obj \ + $(SLO)$/readguard.obj \ + $(SLO)$/resetableguard.obj APP3STDLIBS= $(CPPULIB) \ $(CPPUHELPERLIB) \ @@ -151,6 +155,7 @@ APP3STDLIBS= $(CPPULIB) \ $(SVTOOLLIB) \ $(TKLIB) \ $(COMPHELPERLIB) \ + $(UNOTOOLSLIB) \ $(SVLIB) APP3DEPN= $(SLO)$/servicemanager.obj \ diff --git a/framework/test/test.cxx b/framework/test/test.cxx index 7df3ce7860bc..fc6209f7389b 100644 --- a/framework/test/test.cxx +++ b/framework/test/test.cxx @@ -2,9 +2,9 @@ * * $RCSfile: test.cxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: as $ $Date: 2001-03-29 13:17:17 $ + * last change: $Author: as $ $Date: 2001-04-11 11:24:14 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -330,9 +330,6 @@ void TestApplication::Main() LOG_ASSERT( !(m_xFactory.is() ==sal_False ), "TestApplication::Main()\nCan't create global service manager.\n\n" ) LOG_ASSERT( !(getProcessServiceFactory()!=m_xFactory), "TestApplication::Main()\nGlobal servicemanager not set in UNOTOOLS.\n\n" ) - // For some follow operations, we need the vcl-toolkit! - InitExtVclToolkit(); - /**-*********************************************************************************************************** test area **************************************************************************************************************/ @@ -488,7 +485,7 @@ void TestApplication::impl_testTypeDetection() } } - WRITE_LOGFILE( "testTypeDetection.log", U2B(sBuffer.makeStringAndClear()).getStr() ) + WRITE_LOGFILE( "testTypeDetection.log", U2B(sBuffer.makeStringAndClear()) ) } #endif @@ -567,7 +564,7 @@ void TestApplication::impl_testFilterCache() } } - WRITE_LOGFILE( "test_FilterCache.log", U2B(sBuffer.makeStringAndClear()).getStr() ) + WRITE_LOGFILE( "test_FilterCache.log", U2B(sBuffer.makeStringAndClear()) ) } #endif @@ -593,27 +590,27 @@ void TestApplication::impl_testLoginDialog() UniString sExternalURL = OUString(); OString sOut = "internal: "; - sOut += OUStringToOString( sInternalURL, RTL_TEXTENCODING_UTF8 ).getStr(); + sOut += OUStringToOString( sInternalURL, RTL_TEXTENCODING_UTF8 ); sOut += "\nexternal: "; - sOut += OUStringToOString( sExternalURL, RTL_TEXTENCODING_UTF8 ).getStr(); + sOut += OUStringToOString( sExternalURL, RTL_TEXTENCODING_UTF8 ); sOut += "\n"; - LOG_ASSERT( sal_False, sOut.getStr() ) + LOG_ASSERT( sal_False, sOut ) INetURLObject::translateToExternal( sInternalURL, sExternalURL ); sOut = "internal: "; - sOut += OUStringToOString( sInternalURL, RTL_TEXTENCODING_UTF8 ).getStr(); + sOut += OUStringToOString( sInternalURL, RTL_TEXTENCODING_UTF8 ); sOut += "\nexternal: "; - sOut += OUStringToOString( sExternalURL, RTL_TEXTENCODING_UTF8 ).getStr(); + sOut += OUStringToOString( sExternalURL, RTL_TEXTENCODING_UTF8 ); sOut += "\n"; - LOG_ASSERT( sal_False, sOut.getStr() ) + LOG_ASSERT( sal_False, sOut ) INetURLObject::translateToInternal( sExternalURL, sInternalURL ); sOut = "internal: "; - sOut += OUStringToOString( sInternalURL, RTL_TEXTENCODING_UTF8 ).getStr(); + sOut += OUStringToOString( sInternalURL, RTL_TEXTENCODING_UTF8 ); sOut += "\nexternal: "; - sOut += OUStringToOString( sExternalURL, RTL_TEXTENCODING_UTF8 ).getStr(); + sOut += OUStringToOString( sExternalURL, RTL_TEXTENCODING_UTF8 ); sOut += "\n"; - LOG_ASSERT( sal_False, sOut.getStr() ) + LOG_ASSERT( sal_False, sOut ) // Work with properties of dialog. Reference< XPropertySet > xPropertySet( xDialog, UNO_QUERY ); @@ -670,11 +667,11 @@ void TestApplication::impl_testLoginDialog() xPropertySet->getPropertyValue( DECLARE_ASCII("ConnectionType" ) ) >>= sConnectionType ; xPropertySet->getPropertyValue( sConnectionType ) >>= nPort ; - LOG_ASSERT( sal_False, OUStringToOString( sUserName, RTL_TEXTENCODING_UTF8 ).getStr() ) - LOG_ASSERT( sal_False, OUStringToOString( sPassword, RTL_TEXTENCODING_UTF8 ).getStr() ) - LOG_ASSERT( sal_False, OUStringToOString( sServer , RTL_TEXTENCODING_UTF8 ).getStr() ) - LOG_ASSERT( sal_False, OUStringToOString( sConnectionType , RTL_TEXTENCODING_UTF8 ).getStr() ) - LOG_ASSERT( sal_False, OString::valueOf( (sal_Int32)nPort ).getStr() ) + LOG_ASSERT( sal_False, OUStringToOString( sUserName, RTL_TEXTENCODING_UTF8 ) ) + LOG_ASSERT( sal_False, OUStringToOString( sPassword, RTL_TEXTENCODING_UTF8 ) ) + LOG_ASSERT( sal_False, OUStringToOString( sServer , RTL_TEXTENCODING_UTF8 ) ) + LOG_ASSERT( sal_False, OUStringToOString( sConnectionType , RTL_TEXTENCODING_UTF8 ) ) + LOG_ASSERT( sal_False, OString::valueOf( (sal_Int32)nPort ) ) } #endif @@ -1137,7 +1134,7 @@ void TestApplication::impl_logTree( const Reference< XDesktop >& xDesktop ) // And write it to logfile. OString sOutPut = OUStringToOString( sTreeNamesStream, RTL_TEXTENCODING_UTF8 ); // WRITE_LOGFILE( LOGFILENAME_TREE, "\nNew tree log:\n\n" ); -// WRITE_LOGFILE( LOGFILENAME_TREE, sOutPut.getStr() ); +// WRITE_LOGFILE( LOGFILENAME_TREE, sOutPut ); // WRITE_LOGFILE( LOGFILENAME_TREE, "\n" ); #endif } diff --git a/framework/test/test_filterregistration.bas b/framework/test/test_filterregistration.bas new file mode 100644 index 000000000000..47a19acfc36d --- /dev/null +++ b/framework/test/test_filterregistration.bas @@ -0,0 +1,95 @@ +rem _______________________________________________________________________________________________________________________________________ +rem Test script for registering or changing filter of our configuration. +rem _______________________________________________________________________________________________________________________________________ + +Sub Main + Dim xFiterFactory as object + Dim sFilterName as string + + xFilterFactory = createUNOService("com.sun.star.document.FilterFactory") + + sFilterName = "MeinFilter_5" + +rem AddFilter ( xFilterFactory, sFilterName ) + ReadFilter ( xFilterFactory, sFilterName ) +rem QueryFilters ( xFilterFactory ) + + xFilterFactory.flush() + +End Sub + +rem ************************************************************************************************************* +Sub AddFilter( xFilterFactory, sFilterName ) + Dim lProperties(8) as new com.sun.star.beans.PropertyValue + Dim lUserData (1) as string + + lUserData(1) = "Userdata von TestFilter" + + lProperties(0).Name = "Type" + lProperties(0).Value = "bmp_MS_Windows" + + lProperties(1).Name = "UIName" + lProperties(1).Value = sFilterName + + lProperties(2).Name = "DocumentService" + lProperties(2).Value = "com.sun.star.text.TextDocument" + + lProperties(3).Name = "FilterService" + lProperties(3).Value = "com.sun.star.comp.framework.TestFilter" + + lProperties(4).Name = "Flags" + lProperties(4).Value = 256 + + lProperties(5).Name = "UserData" + lProperties(5).Value = lUserData() + + lProperties(6).Name = "FileFormatVersion" + lProperties(6).Value = 0 + + lProperties(7).Name = "TemplateName" + lProperties(7).Value = "" + + xFilterFactory.insertByName( sFilterName, lProperties() ) +End Sub + +rem ************************************************************************************************************* +Sub ReadFilter( xFilterFactory, sFilterName ) +rem Dim lFilters() as com.sun.star.beans.PropertyValue + Dim sOut as string + Dim nCount as integer + + lProperties = xFilterFactory.getByName( sFilterName ) + + sOut = "" + for nCount=0 to ubound(lProperties()) step 1 + sOut = sOut + lProperties(nCount).Name + sOut = sOut + " = " +rem #85829# Disable follow if statement to produce bug! +rem if( lProperties(nCount).Name <> "UserData" ) then + sOut = sOut + lProperties(nCount).Value +rem endif + sOut = sOut + chr(13) + next nCount + + msgbox sOut +End Sub + +rem ************************************************************************************************************* +Sub QueryFilters( xFilterFactory ) + Dim lFilters() as string + Dim sQuery as string + Dim sOut as string + Dim nCount as integer + + sQuery = "_filterquery_defaultfilter" +rem sQuery = "_filterquery_textdocument_withdefault" + + lFilters() = xFilterFactory.getByName( sQuery ) + + sOut = "" + for nCount=0 to ubound( lFilters() ) + sOut = sOut + lFilters(nCount) + chr(13) + next nCount + + msgbox sOut +End Sub diff --git a/framework/test/threadtest.cxx b/framework/test/threadtest.cxx index 0233c447e576..85294fde580a 100644 --- a/framework/test/threadtest.cxx +++ b/framework/test/threadtest.cxx @@ -2,9 +2,9 @@ * * $RCSfile: threadtest.cxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: as $ $Date: 2001-03-29 13:17:17 $ + * last change: $Author: as $ $Date: 2001-04-11 11:24:14 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -169,7 +169,7 @@ using namespace ::framework ; sLog.append( " ] call setA( " ); \ sLog.append( NA ); \ sLog.append( " )\n" ); \ - WRITE_LOGFILE( LOGFILE, sLog.makeStringAndClear().getStr() ) \ + WRITE_LOGFILE( LOGFILE, sLog.makeStringAndClear() ) \ } #define LOG_SETA_END( NA, EREASON, NID ) \ @@ -186,7 +186,7 @@ using namespace ::framework ; sLog.append( " ] was refused at setA( "); \ sLog.append( NA ); \ sLog.append( " )\n" ); \ - WRITE_LOGFILE( LOGFILE, sLog.makeStringAndClear().getStr() ) \ + WRITE_LOGFILE( LOGFILE, sLog.makeStringAndClear() ) \ } #define LOG_GETA_START( NID ) \ @@ -198,7 +198,7 @@ using namespace ::framework ; sLog.append( ": Thread[ " ); \ sLog.append( NID ); \ sLog.append( " ] call getA()\n" ); \ - WRITE_LOGFILE( LOGFILE, sLog.makeStringAndClear().getStr() ) \ + WRITE_LOGFILE( LOGFILE, sLog.makeStringAndClear() ) \ } #define LOG_GETA_END( NRETURN, EREASON, NID ) \ @@ -215,7 +215,7 @@ using namespace ::framework ; sLog.append( " ] was refused at getA() with " ); \ sLog.append( NRETURN ); \ sLog.append( "\n" ); \ - WRITE_LOGFILE( LOGFILE, sLog.makeStringAndClear().getStr() ) \ + WRITE_LOGFILE( LOGFILE, sLog.makeStringAndClear() ) \ } #define LOG_WORKA_START( NA, NID ) \ @@ -229,7 +229,7 @@ using namespace ::framework ; sLog.append( " ] call workA( " ); \ sLog.append( NA ); \ sLog.append( " )\n" ); \ - WRITE_LOGFILE( LOGFILE, sLog.makeStringAndClear().getStr() ) \ + WRITE_LOGFILE( LOGFILE, sLog.makeStringAndClear() ) \ } #define LOG_WORKA_END( NRETURN, EREASON, NID ) \ @@ -246,7 +246,7 @@ using namespace ::framework ; sLog.append( " ] was refused at workA() with " ); \ sLog.append( NRETURN ); \ sLog.append( "\n" ); \ - WRITE_LOGFILE( LOGFILE, sLog.makeStringAndClear().getStr() ) \ + WRITE_LOGFILE( LOGFILE, sLog.makeStringAndClear() ) \ } #define LOG_INITEXCEPTION( SMETHOD, NID ) \ @@ -260,7 +260,7 @@ using namespace ::framework ; sLog.append( " ] get EInitException from \"" ); \ sLog.append( SMETHOD ); \ sLog.append( "\"\n" ); \ - WRITE_LOGFILE( LOGFILE, sLog.makeStringAndClear().getStr() ) \ + WRITE_LOGFILE( LOGFILE, sLog.makeStringAndClear() ) \ } #define LOG_CLOSEEXCEPTION( SMETHOD, NID ) \ @@ -274,7 +274,7 @@ using namespace ::framework ; sLog.append( " ] get ECloseException from \"" ); \ sLog.append( SMETHOD ); \ sLog.append( "\"\n" ); \ - WRITE_LOGFILE( LOGFILE, sLog.makeStringAndClear().getStr() ) \ + WRITE_LOGFILE( LOGFILE, sLog.makeStringAndClear() ) \ } #define LOG_INIT( NA, NID ) \ @@ -288,7 +288,7 @@ using namespace ::framework ; sLog.append( " ] initialize me with " ); \ sLog.append( NA ); \ sLog.append( "\n" ); \ - WRITE_LOGFILE( LOGFILE, sLog.makeStringAndClear().getStr() ) \ + WRITE_LOGFILE( LOGFILE, sLog.makeStringAndClear() ) \ } #define LOG_CLOSE( NID ) \ @@ -300,7 +300,7 @@ using namespace ::framework ; sLog.append( ": Thread[ " ); \ sLog.append( NID ); \ sLog.append( " ] close me\n" ); \ - WRITE_LOGFILE( LOGFILE, sLog.makeStringAndClear().getStr() ) \ + WRITE_LOGFILE( LOGFILE, sLog.makeStringAndClear() ) \ } #else #define LOG_SETA_START( NA, NID ) @@ -460,7 +460,7 @@ void ThreadSafeClass::setA( sal_Int32 nA, sal_Int32 nThreadID ) // Try to set a write lock ... but look for // rejected calls. We must react for. - ERefusalReason eReason; + ERejectReason eReason; WriteGuard aGuard( m_aLock, eReason ); switch( eReason ) { @@ -501,7 +501,7 @@ sal_Int32 ThreadSafeClass::getA( sal_Int32 nThreadID ) // rejected calls. We must react for. // Define a default return value for this case. sal_Int32 nReturn = 0; - ERefusalReason eReason; + ERejectReason eReason; ReadGuard aGuard( m_aLock, eReason ); switch( eReason ) { @@ -540,7 +540,7 @@ sal_Int32 ThreadSafeClass::workA( sal_Int32 nA , // rejected calls. We must react for. // Define a default return value for this case. sal_Int32 nReturn = 0; - ERefusalReason eReason; + ERejectReason eReason; WriteGuard aGuard( m_aLock, eReason ); switch( eReason ) { @@ -823,6 +823,6 @@ void TestApplication::Main() sBuf.append( "\n" ); } - WRITE_LOGFILE( STATISTICS_FILE, sBuf.makeStringAndClear().getStr() ); + WRITE_LOGFILE( STATISTICS_FILE, sBuf.makeStringAndClear() ); LOG_ERROR( "TApplication::Main()", "Test finish successful!" ) } |