diff options
Diffstat (limited to 'comphelper/source/misc')
58 files changed, 582 insertions, 853 deletions
diff --git a/comphelper/source/misc/SelectionMultiplex.cxx b/comphelper/source/misc/SelectionMultiplex.cxx index d61dee3f29f0..8ec3158c6789 100644 --- a/comphelper/source/misc/SelectionMultiplex.cxx +++ b/comphelper/source/misc/SelectionMultiplex.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -172,3 +173,4 @@ void SAL_CALL OSelectionChangeMultiplexer::selectionChanged( const EventObject& } //......................................................................... +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/misc/accessiblecomponenthelper.cxx b/comphelper/source/misc/accessiblecomponenthelper.cxx index 5fb86f3f7b1d..8b6ebde6cc1c 100644 --- a/comphelper/source/misc/accessiblecomponenthelper.cxx +++ b/comphelper/source/misc/accessiblecomponenthelper.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -219,3 +220,4 @@ namespace comphelper //......................................................................... +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/misc/accessiblecontexthelper.cxx b/comphelper/source/misc/accessiblecontexthelper.cxx index 2e0281848e8c..fb89a0bf86a9 100644 --- a/comphelper/source/misc/accessiblecontexthelper.cxx +++ b/comphelper/source/misc/accessiblecontexthelper.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -318,7 +319,7 @@ namespace comphelper } catch( const Exception& ) { - OSL_ENSURE( sal_False, "OAccessibleContextHelper::getAccessibleIndexInParent: caught an exception!" ); + OSL_FAIL( "OAccessibleContextHelper::getAccessibleIndexInParent: caught an exception!" ); } return nRet; @@ -354,3 +355,4 @@ namespace comphelper //......................................................................... +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/misc/accessibleeventbuffer.cxx b/comphelper/source/misc/accessibleeventbuffer.cxx index 50c61d59b9e6..4137f91853f7 100644 --- a/comphelper/source/misc/accessibleeventbuffer.cxx +++ b/comphelper/source/misc/accessibleeventbuffer.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -108,3 +109,5 @@ void AccessibleEventBuffer::sendEvents() const } } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/misc/accessibleeventnotifier.cxx b/comphelper/source/misc/accessibleeventnotifier.cxx index 421fb9868d73..f03b1e78485a 100644 --- a/comphelper/source/misc/accessibleeventnotifier.cxx +++ b/comphelper/source/misc/accessibleeventnotifier.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -257,3 +258,4 @@ namespace comphelper } // namespace comphelper //......................................................................... +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/misc/accessiblekeybindinghelper.cxx b/comphelper/source/misc/accessiblekeybindinghelper.cxx index d3c22071bfd8..ee98678f0b70 100644 --- a/comphelper/source/misc/accessiblekeybindinghelper.cxx +++ b/comphelper/source/misc/accessiblekeybindinghelper.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -112,3 +113,5 @@ namespace comphelper //.............................................................................. } // namespace comphelper //.............................................................................. + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/misc/accessibleselectionhelper.cxx b/comphelper/source/misc/accessibleselectionhelper.cxx index 8e31410b337e..e6aeac52eac4 100644 --- a/comphelper/source/misc/accessibleselectionhelper.cxx +++ b/comphelper/source/misc/accessibleselectionhelper.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -190,3 +191,4 @@ namespace comphelper } // namespace comphelper //......................................................................... +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/misc/accessibletexthelper.cxx b/comphelper/source/misc/accessibletexthelper.cxx index e3247cae5b60..d344192e7b46 100644 --- a/comphelper/source/misc/accessibletexthelper.cxx +++ b/comphelper/source/misc/accessibletexthelper.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -32,9 +33,7 @@ #include <comphelper/accessibletexthelper.hxx> #include <com/sun/star/accessibility/AccessibleTextType.hpp> #include <com/sun/star/i18n/CharacterIteratorMode.hpp> -#ifndef _COM_SUN_STAR_TEXT_WORDTYPE_HPP_ #include <com/sun/star/i18n/WordType.hpp> -#endif #include <com/sun/star/i18n/KCharacterType.hpp> #include <comphelper/processfactory.hxx> #include <com/sun/star/accessibility/TextSegment.hpp> @@ -913,3 +912,5 @@ namespace comphelper //.............................................................................. } // namespace comphelper //.............................................................................. + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/misc/accessiblewrapper.cxx b/comphelper/source/misc/accessiblewrapper.cxx index 0ed694856b97..b9d26591f19f 100644 --- a/comphelper/source/misc/accessiblewrapper.cxx +++ b/comphelper/source/misc/accessiblewrapper.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -160,8 +161,7 @@ namespace comphelper if (!m_aChildrenMap.insert( AccessibleMap::value_type( _rxKey, xValue ) ).second) { - OSL_ENSURE( - false, + OSL_FAIL( "OWrappedAccessibleChildrenManager::" "getAccessibleWrapperFor: element was already" " inserted!" ); @@ -241,15 +241,14 @@ namespace comphelper case AccessibleEventId::TABLE_ROW_DESCRIPTION_CHANGED: case AccessibleEventId::TABLE_ROW_HEADER_CHANGED: case AccessibleEventId::TABLE_SUMMARY_CHANGED: - // --> PB 2006-03-21 #130798# EventId TEXT_SELECTION_CHANGED was missed + // #130798# // these Ids are also missed: SUB_WINDOW_OF_RELATION_CHANGED & TEXT_ATTRIBUTE_CHANGED case AccessibleEventId::TEXT_SELECTION_CHANGED: - // <-- // nothing to translate break; default: - OSL_ENSURE( sal_False, "OWrappedAccessibleChildrenManager::translateAccessibleEvent: unknown (or unexpected) event id!" ); + OSL_FAIL( "OWrappedAccessibleChildrenManager::translateAccessibleEvent: unknown (or unexpected) event id!" ); break; } } @@ -279,8 +278,7 @@ namespace comphelper #if OSL_DEBUG_LEVEL > 0 if ( m_aChildrenMap.end() == aDisposedPos ) { - OSL_ENSURE( sal_False, - "OWrappedAccessibleChildrenManager::disposing: where did this come from?" ); + OSL_FAIL( "OWrappedAccessibleChildrenManager::disposing: where did this come from?" ); // helper for dignostics Reference< XAccessible > xOwningAccessible( m_aOwningAccessible ); Reference< XAccessibleContext > xContext; @@ -681,3 +679,5 @@ namespace comphelper //............................................................................. } // namespace accessibility //............................................................................. + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/misc/accimplaccess.cxx b/comphelper/source/misc/accimplaccess.cxx index e792b9fe43c1..e06df35cde0c 100644 --- a/comphelper/source/misc/accimplaccess.cxx +++ b/comphelper/source/misc/accimplaccess.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -120,21 +121,13 @@ namespace comphelper return ( NULL != pImplementation ); } + namespace { struct lcl_ImplId : public rtl::Static< ::cppu::OImplementationId, lcl_ImplId > {}; } + //--------------------------------------------------------------------- - const Sequence< sal_Int8 >& OAccessibleImplementationAccess::getUnoTunnelImplementationId() + const Sequence< sal_Int8 > OAccessibleImplementationAccess::getUnoTunnelImplementationId() { - static Sequence< sal_Int8 > aId; - if ( !aId.getLength() ) - { - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if ( !aId.getLength() ) - { - static ::cppu::OImplementationId aImplId; - // unfortunately, the OImplementationId::getImplementationId returns a copy, not a static reference ... - aId = aImplId.getImplementationId(); - } - } - return aId; + ::cppu::OImplementationId &rID = lcl_ImplId::get(); + return rID.getImplementationId(); } //--------------------------------------------------------------------- @@ -165,7 +158,7 @@ namespace comphelper } catch( const Exception& ) { - OSL_ENSURE( sal_False, "OAccessibleImplementationAccess::setAccessibleParent: caught an exception while retrieving the implementation!" ); + OSL_FAIL( "OAccessibleImplementationAccess::setAccessibleParent: caught an exception while retrieving the implementation!" ); } return pImplementation; } @@ -187,3 +180,4 @@ namespace comphelper //......................................................................... +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/misc/anycompare.cxx b/comphelper/source/misc/anycompare.cxx index a86174daf08e..a86174daf08e 100755..100644 --- a/comphelper/source/misc/anycompare.cxx +++ b/comphelper/source/misc/anycompare.cxx diff --git a/comphelper/source/misc/anytostring.cxx b/comphelper/source/misc/anytostring.cxx index 01f282172f18..bdb6d44d6e1f 100644 --- a/comphelper/source/misc/anytostring.cxx +++ b/comphelper/source/misc/anytostring.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -333,3 +334,4 @@ rtl::OUString anyToString( uno::Any const & value ) } // namespace comphelper +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/misc/asyncnotification.cxx b/comphelper/source/misc/asyncnotification.cxx index e8bee632a9b4..5697eb62b6b5 100644 --- a/comphelper/source/misc/asyncnotification.cxx +++ b/comphelper/source/misc/asyncnotification.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -279,3 +280,4 @@ namespace comphelper } // namespace comphelper //........................................................................ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/misc/comphelper_module.cxx b/comphelper/source/misc/comphelper_module.cxx index 5f423691592a..8b9ee4221dfc 100644 --- a/comphelper/source/misc/comphelper_module.cxx +++ b/comphelper/source/misc/comphelper_module.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -39,3 +40,5 @@ namespace comphelper { namespace module //........................................................................ } } // namespace comphelper::module //........................................................................ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/misc/comphelper_services.cxx b/comphelper/source/misc/comphelper_services.cxx index b46dcea68ba7..32d1c53aff93 100644 --- a/comphelper/source/misc/comphelper_services.cxx +++ b/comphelper/source/misc/comphelper_services.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -29,6 +30,8 @@ #include "comphelper_module.hxx" +#include <rtl/instance.hxx> + //-------------------------------------------------------------------- extern void createRegistryInfo_OPropertyBag(); extern void createRegistryInfo_SequenceOutputStream(); @@ -48,13 +51,12 @@ namespace comphelper { namespace module { //........................................................................ - static void initializeModule() + namespace { - static bool bInitialized( false ); - if ( !bInitialized ) + class doInitialize { - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if ( !bInitialized ) + public: + doInitialize() { createRegistryInfo_OPropertyBag(); createRegistryInfo_SequenceOutputStream(); @@ -69,7 +71,14 @@ namespace comphelper { namespace module createRegistryInfo_OSimpleLogRing(); createRegistryInfo_OOfficeRestartManager(); } - } + }; + + struct theInitializer : public rtl::Static< doInitialize, theInitializer > {}; + } + + static void initializeModule() + { + theInitializer::get(); } //........................................................................ @@ -77,3 +86,5 @@ namespace comphelper { namespace module //........................................................................ IMPLEMENT_COMPONENT_LIBRARY_API( ::comphelper::module::ComphelperModule, ::comphelper::module::initializeModule ) + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/misc/componentbase.cxx b/comphelper/source/misc/componentbase.cxx index 657c2c6a5972..d6aa3c5fd50c 100644 --- a/comphelper/source/misc/componentbase.cxx +++ b/comphelper/source/misc/componentbase.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -72,3 +73,5 @@ namespace comphelper //........................................................................ } // namespace comphelper //........................................................................ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/misc/componentcontext.cxx b/comphelper/source/misc/componentcontext.cxx index 0f9ddad5d2f5..86224687d9f4 100644 --- a/comphelper/source/misc/componentcontext.cxx +++ b/comphelper/source/misc/componentcontext.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -104,7 +105,7 @@ namespace comphelper } catch( const Exception& ) { - OSL_ENSURE( sal_False, "ComponentContext::getContextValueByName: caught an exception!" ); + OSL_FAIL( "ComponentContext::getContextValueByName: caught an exception!" ); } return aReturn; } @@ -149,3 +150,4 @@ namespace comphelper } // namespace comphelper //........................................................................ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/misc/componentmodule.cxx b/comphelper/source/misc/componentmodule.cxx index 1dfd99bfa07e..c42308c71508 100644 --- a/comphelper/source/misc/componentmodule.cxx +++ b/comphelper/source/misc/componentmodule.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -177,3 +178,5 @@ namespace comphelper //........................................................................ } // namespace comphelper //........................................................................ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/misc/configurationhelper.cxx b/comphelper/source/misc/configurationhelper.cxx index b78d39217d90..1016c88b341c 100644 --- a/comphelper/source/misc/configurationhelper.cxx +++ b/comphelper/source/misc/configurationhelper.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -52,27 +53,27 @@ css::uno::Reference< css::uno::XInterface > ConfigurationHelper::openConfig(cons sal_Int32 eMode ) { css::uno::Reference< css::lang::XMultiServiceFactory > xConfigProvider( - xSMGR->createInstance(::rtl::OUString::createFromAscii("com.sun.star.configuration.ConfigurationProvider")), css::uno::UNO_QUERY_THROW); + xSMGR->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.ConfigurationProvider"))), css::uno::UNO_QUERY_THROW); ::comphelper::SequenceAsVector< css::uno::Any > lParams; css::beans::PropertyValue aParam ; // set root path - aParam.Name = ::rtl::OUString::createFromAscii("nodepath"); + aParam.Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("nodepath")); aParam.Value <<= sPackage; lParams.push_back(css::uno::makeAny(aParam)); // enable all locales mode if ((eMode & ConfigurationHelper::E_ALL_LOCALES)==ConfigurationHelper::E_ALL_LOCALES) { - aParam.Name = ::rtl::OUString::createFromAscii("locale"); - aParam.Value <<= ::rtl::OUString::createFromAscii("*"); + aParam.Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("locale")); + aParam.Value <<= ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("*")); lParams.push_back(css::uno::makeAny(aParam)); } // enable lazy writing sal_Bool bLazy = ((eMode & ConfigurationHelper::E_LAZY_WRITE)==ConfigurationHelper::E_LAZY_WRITE); - aParam.Name = ::rtl::OUString::createFromAscii("lazywrite"); + aParam.Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("lazywrite")); aParam.Value = css::uno::makeAny(bLazy); lParams.push_back(css::uno::makeAny(aParam)); @@ -82,11 +83,11 @@ css::uno::Reference< css::uno::XInterface > ConfigurationHelper::openConfig(cons sal_Bool bReadOnly = ((eMode & ConfigurationHelper::E_READONLY)==ConfigurationHelper::E_READONLY); if (bReadOnly) xCFG = xConfigProvider->createInstanceWithArguments( - ::rtl::OUString::createFromAscii("com.sun.star.configuration.ConfigurationAccess"), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.ConfigurationAccess")), lParams.getAsConstList()); else xCFG = xConfigProvider->createInstanceWithArguments( - ::rtl::OUString::createFromAscii("com.sun.star.configuration.ConfigurationUpdateAccess"), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.ConfigurationUpdateAccess")), lParams.getAsConstList()); return xCFG; @@ -205,3 +206,5 @@ void ConfigurationHelper::flush(const css::uno::Reference< css::uno::XInterface } } // namespace comphelper + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/misc/docpasswordhelper.cxx b/comphelper/source/misc/docpasswordhelper.cxx index 3c8d66bd57e4..36cb3cd15aff 100644 --- a/comphelper/source/misc/docpasswordhelper.cxx +++ b/comphelper/source/misc/docpasswordhelper.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /*********************************************************************** * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -470,3 +471,4 @@ Sequence< sal_Int8 > DocPasswordHelper::GetXLHashAsSequence( } // namespace comphelper +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/misc/docpasswordrequest.cxx b/comphelper/source/misc/docpasswordrequest.cxx index 15c2e09ba0f3..ec9cf0ca21ed 100755..100644 --- a/comphelper/source/misc/docpasswordrequest.cxx +++ b/comphelper/source/misc/docpasswordrequest.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -257,3 +258,4 @@ Sequence< Reference< XInteractionContinuation > > SAL_CALL DocPasswordRequest::g } // namespace comphelper +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/misc/documentinfo.cxx b/comphelper/source/misc/documentinfo.cxx index aee3a8e005a6..a9b9a85f7f69 100644 --- a/comphelper/source/misc/documentinfo.cxx +++ b/comphelper/source/misc/documentinfo.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -186,7 +187,7 @@ namespace comphelper { sMessage += "\nin function:\n"; sMessage += BOOST_CURRENT_FUNCTION; sMessage += "\n"; - OSL_ENSURE( false, sMessage ); + OSL_FAIL( sMessage ); } return sTitle; @@ -195,3 +196,5 @@ namespace comphelper { //........................................................................ } // namespace comphelper //........................................................................ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/misc/documentiologring.cxx b/comphelper/source/misc/documentiologring.cxx index 5f07f8058fb3..fdc17013a6d9 100644 --- a/comphelper/source/misc/documentiologring.cxx +++ b/comphelper/source/misc/documentiologring.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -177,3 +178,5 @@ void createRegistryInfo_OSimpleLogRing() static ::comphelper::module::OAutoRegistration< ::comphelper::OSimpleLogRing > aAutoRegistration; static ::comphelper::module::OSingletonRegistration< ::comphelper::OSimpleLogRing > aSingletonRegistration; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/misc/documentiologring.hxx b/comphelper/source/misc/documentiologring.hxx index f9626ffe5d62..90acd7f9152b 100644 --- a/comphelper/source/misc/documentiologring.hxx +++ b/comphelper/source/misc/documentiologring.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -86,3 +87,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/misc/evtlistenerhlp.cxx b/comphelper/source/misc/evtlistenerhlp.cxx index 6511b9a9ecf7..3d10c0d76ad8 100644 --- a/comphelper/source/misc/evtlistenerhlp.cxx +++ b/comphelper/source/misc/evtlistenerhlp.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -50,3 +51,4 @@ namespace comphelper +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/misc/evtmethodhelper.cxx b/comphelper/source/misc/evtmethodhelper.cxx index e91adee3912b..a94b85754e13 100755..100644 --- a/comphelper/source/misc/evtmethodhelper.cxx +++ b/comphelper/source/misc/evtmethodhelper.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -6,9 +7,6 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: evtlistenerhlp.cxx,v $ - * $Revision$ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -75,3 +73,4 @@ namespace comphelper +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/misc/ihwrapnofilter.cxx b/comphelper/source/misc/ihwrapnofilter.cxx index 1cbd1f09f4c6..7d9ef608a1ae 100644 --- a/comphelper/source/misc/ihwrapnofilter.cxx +++ b/comphelper/source/misc/ihwrapnofilter.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -51,13 +52,13 @@ namespace comphelper uno::Sequence< ::rtl::OUString > SAL_CALL OIHWrapNoFilterDialog::impl_staticGetSupportedServiceNames() { uno::Sequence< ::rtl::OUString > aRet(1); - aRet[0] = ::rtl::OUString::createFromAscii("com.sun.star.task.InteractionHandlerWrapper"); + aRet[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.task.InteractionHandlerWrapper")); return aRet; } ::rtl::OUString SAL_CALL OIHWrapNoFilterDialog::impl_staticGetImplementationName() { - return ::rtl::OUString::createFromAscii("com.sun.star.comp.task.InteractionHandlerWrapper"); + return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.task.InteractionHandlerWrapper")); } //---------------------------------------------------------------------------------------------------- @@ -115,3 +116,5 @@ namespace comphelper return impl_staticGetSupportedServiceNames(); } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/misc/instancelocker.cxx b/comphelper/source/misc/instancelocker.cxx index c147217f1e7f..c71f84b62309 100644 --- a/comphelper/source/misc/instancelocker.cxx +++ b/comphelper/source/misc/instancelocker.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -510,3 +511,5 @@ void createRegistryInfo_OInstanceLocker() { static ::comphelper::module::OAutoRegistration< OInstanceLocker > aAutoRegistration; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/misc/instancelocker.hxx b/comphelper/source/misc/instancelocker.hxx index 73800e3cee6f..809aced6e3c1 100644 --- a/comphelper/source/misc/instancelocker.hxx +++ b/comphelper/source/misc/instancelocker.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -131,3 +132,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/misc/interaction.cxx b/comphelper/source/misc/interaction.cxx index c97f879581e4..7a69ac4d5cbb 100644 --- a/comphelper/source/misc/interaction.cxx +++ b/comphelper/source/misc/interaction.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -97,3 +98,4 @@ namespace comphelper //......................................................................... +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/misc/legacysingletonfactory.cxx b/comphelper/source/misc/legacysingletonfactory.cxx deleted file mode 100644 index cfc1793e7db2..000000000000 --- a/comphelper/source/misc/legacysingletonfactory.cxx +++ /dev/null @@ -1,197 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_comphelper.hxx" - -#include "comphelper/legacysingletonfactory.hxx" - -/** === begin UNO includes === **/ -#include <com/sun/star/lang/XServiceInfo.hpp> -#include <com/sun/star/lang/XInitialization.hpp> -/** === end UNO includes === **/ - -#include <cppuhelper/implbase2.hxx> - -#include <algorithm> - -//........................................................................ -namespace comphelper -{ -//........................................................................ - - /** === begin UNO using === **/ - using ::com::sun::star::uno::Reference; - using ::com::sun::star::uno::XInterface; - using ::com::sun::star::uno::UNO_QUERY; - using ::com::sun::star::uno::UNO_QUERY_THROW; - using ::com::sun::star::uno::UNO_SET_THROW; - using ::com::sun::star::uno::Exception; - using ::com::sun::star::uno::RuntimeException; - using ::com::sun::star::uno::Any; - using ::com::sun::star::uno::makeAny; - using ::com::sun::star::lang::XSingleComponentFactory; - using ::com::sun::star::uno::Sequence; - using ::com::sun::star::uno::XComponentContext; - using ::com::sun::star::lang::XServiceInfo; - using ::com::sun::star::lang::XInitialization; - /** === end UNO using === **/ - - //==================================================================== - //= LegacySingletonFactory - //==================================================================== - typedef ::cppu::WeakImplHelper2 < XServiceInfo - , XSingleComponentFactory - > LegacySingletonFactory_Base; - - class COMPHELPER_DLLPRIVATE LegacySingletonFactory : public LegacySingletonFactory_Base - { - public: - LegacySingletonFactory( - ::cppu::ComponentFactoryFunc _componentFactoryFunc, const ::rtl::OUString& _rImplementationName, - const Sequence< ::rtl::OUString >& _rServiceNames, rtl_ModuleCount* _pModCount - ); - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (RuntimeException); - virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (RuntimeException); - virtual Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (RuntimeException); - - // XSingleComponentFactory - virtual Reference< XInterface > SAL_CALL createInstanceWithContext( const Reference< XComponentContext >& Context ) throw (Exception, RuntimeException); - virtual Reference< XInterface > SAL_CALL createInstanceWithArgumentsAndContext( const Sequence< Any >& Arguments, const Reference< XComponentContext >& Context ) throw (Exception, RuntimeException); - - protected: - ~LegacySingletonFactory(); - - private: - /** creates m_xInstance, returns whether it actually was created (<TRUE/>) or existed before (<FALSE/> - */ - bool impl_nts_ensureInstance( const Reference< XComponentContext >& _rxContext ); - - private: - ::osl::Mutex m_aMutex; - ::cppu::ComponentFactoryFunc m_componentFactoryFunc; - ::rtl::OUString m_sImplementationName; - Sequence< ::rtl::OUString > m_aServiceNames; - rtl_ModuleCount* m_pModuleCount; - Reference< XInterface > m_xTheInstance; - }; - - //-------------------------------------------------------------------- - LegacySingletonFactory::LegacySingletonFactory( ::cppu::ComponentFactoryFunc _componentFactoryFunc, const ::rtl::OUString& _rImplementationName, - const Sequence< ::rtl::OUString >& _rServiceNames, rtl_ModuleCount* _pModCount ) - :m_componentFactoryFunc ( _componentFactoryFunc ) - ,m_sImplementationName ( _rImplementationName ) - ,m_aServiceNames ( _rServiceNames ) - ,m_pModuleCount ( _pModCount ) - ,m_xTheInstance ( ) - { - if ( m_pModuleCount ) - m_pModuleCount->acquire( m_pModuleCount ); - } - - //-------------------------------------------------------------------- - LegacySingletonFactory::~LegacySingletonFactory() - { - if ( m_pModuleCount ) - m_pModuleCount->release( m_pModuleCount ); - } - - //-------------------------------------------------------------------- - ::rtl::OUString SAL_CALL LegacySingletonFactory::getImplementationName( ) throw (RuntimeException) - { - return m_sImplementationName; - } - - //-------------------------------------------------------------------- - ::sal_Bool SAL_CALL LegacySingletonFactory::supportsService( const ::rtl::OUString& _rServiceName ) throw (RuntimeException) - { - Sequence< ::rtl::OUString > aServices( getSupportedServiceNames() ); - const ::rtl::OUString* pStart = aServices.getConstArray(); - const ::rtl::OUString* pEnd = aServices.getConstArray() + aServices.getLength(); - return ::std::find( pStart, pEnd, _rServiceName ) != pEnd; - } - - //-------------------------------------------------------------------- - Sequence< ::rtl::OUString > SAL_CALL LegacySingletonFactory::getSupportedServiceNames( ) throw (RuntimeException) - { - return m_aServiceNames; - } - - //-------------------------------------------------------------------- - bool LegacySingletonFactory::impl_nts_ensureInstance( const Reference< XComponentContext >& _rxContext ) - { - if ( m_xTheInstance.is() ) - return false; - - m_xTheInstance = (*m_componentFactoryFunc)( _rxContext ); - if ( !m_xTheInstance.is() ) - throw RuntimeException(); - - return true; // true -> "was newly created" - } - - //-------------------------------------------------------------------- - Reference< XInterface > SAL_CALL LegacySingletonFactory::createInstanceWithContext( const Reference< XComponentContext >& _rxContext ) throw (Exception, RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - impl_nts_ensureInstance( _rxContext ); - - return m_xTheInstance; - } - - //-------------------------------------------------------------------- - Reference< XInterface > SAL_CALL LegacySingletonFactory::createInstanceWithArgumentsAndContext( const Sequence< Any >& _rArguments, const Reference< XComponentContext >& _rxContext ) throw (Exception, RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - if ( !impl_nts_ensureInstance( _rxContext ) ) - throw RuntimeException( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Instance already created before, unable to initialize it." ) ), - *this - ); - - Reference< XInitialization > xInit( m_xTheInstance, UNO_QUERY_THROW ); - xInit->initialize( _rArguments ); - - return m_xTheInstance; - } - - //==================================================================== - //= createLegacySingletonFactory - //==================================================================== - Reference< XSingleComponentFactory > createLegacySingletonFactory( - ::cppu::ComponentFactoryFunc _componentFactoryFunc, const ::rtl::OUString& _rImplementationName, - const Sequence< ::rtl::OUString >& _rServiceNames, rtl_ModuleCount* _pModCount ) - { - return new LegacySingletonFactory( _componentFactoryFunc, _rImplementationName, _rServiceNames, _pModCount ); - } - - -//........................................................................ -} // namespace comphelper -//........................................................................ diff --git a/comphelper/source/misc/listenernotification.cxx b/comphelper/source/misc/listenernotification.cxx index a9a14a0b9b72..0f7823a197c7 100644 --- a/comphelper/source/misc/listenernotification.cxx +++ b/comphelper/source/misc/listenernotification.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -125,3 +126,4 @@ namespace comphelper } // namespace comphelper //........................................................................ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/misc/locale.cxx b/comphelper/source/misc/locale.cxx index 53c53f1c3c48..0a791c41582c 100644 --- a/comphelper/source/misc/locale.cxx +++ b/comphelper/source/misc/locale.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -47,17 +48,8 @@ const sal_Unicode Locale::SEPERATOR_CV_LINUX = (sal_Unicode)'.'; const Locale Locale::X_DEFAULT() { static Locale aLocale( - ::rtl::OUString::createFromAscii("x"), - ::rtl::OUString::createFromAscii("default")); - return aLocale; -} - -//----------------------------------------------- -const Locale Locale::EN() -{ - static Locale aLocale( - ::rtl::OUString::createFromAscii("en"), - ::rtl::OUString()); + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("x")), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("default"))); return aLocale; } @@ -65,269 +57,8 @@ const Locale Locale::EN() const Locale Locale::EN_US() { static Locale aLocale( - ::rtl::OUString::createFromAscii("en"), - ::rtl::OUString::createFromAscii("US")); - return aLocale; -} - -//----------------------------------------------- -const Locale Locale::DE_DE() -{ - static Locale aLocale( - ::rtl::OUString::createFromAscii("de"), - ::rtl::OUString::createFromAscii("DE")); - return aLocale; -} - -//----------------------------------------------- -const Locale Locale::DE_CH() -{ - static Locale aLocale( - ::rtl::OUString::createFromAscii("de"), - ::rtl::OUString::createFromAscii("CH")); - return aLocale; -} - -//----------------------------------------------- -const Locale Locale::DE_AT() -{ - static Locale aLocale( - ::rtl::OUString::createFromAscii("de"), - ::rtl::OUString::createFromAscii("AT")); - return aLocale; -} - -//----------------------------------------------- -const Locale Locale::AR() -{ - static Locale aLocale( - ::rtl::OUString::createFromAscii("ar"), - ::rtl::OUString()); - return aLocale; -} - -//----------------------------------------------- -const Locale Locale::CA() -{ - static Locale aLocale( - ::rtl::OUString::createFromAscii("ca"), - ::rtl::OUString()); - return aLocale; -} - -//----------------------------------------------- -const Locale Locale::CS() -{ - static Locale aLocale( - ::rtl::OUString::createFromAscii("cs"), - ::rtl::OUString()); - return aLocale; -} - -//----------------------------------------------- -const Locale Locale::DA() -{ - static Locale aLocale( - ::rtl::OUString::createFromAscii("da"), - ::rtl::OUString()); - return aLocale; -} - -//----------------------------------------------- -const Locale Locale::EL() -{ - static Locale aLocale( - ::rtl::OUString::createFromAscii("el"), - ::rtl::OUString()); - return aLocale; -} - -//----------------------------------------------- -const Locale Locale::ES() -{ - static Locale aLocale( - ::rtl::OUString::createFromAscii("es"), - ::rtl::OUString()); - return aLocale; -} - -//----------------------------------------------- -const Locale Locale::FI() -{ - static Locale aLocale( - ::rtl::OUString::createFromAscii("fi"), - ::rtl::OUString()); - return aLocale; -} - -//----------------------------------------------- -const Locale Locale::FR() -{ - static Locale aLocale( - ::rtl::OUString::createFromAscii("fr"), - ::rtl::OUString()); - return aLocale; -} - -//----------------------------------------------- -const Locale Locale::HE() -{ - static Locale aLocale( - ::rtl::OUString::createFromAscii("he"), - ::rtl::OUString()); - return aLocale; -} - -//----------------------------------------------- -const Locale Locale::HI_IN() -{ - static Locale aLocale( - ::rtl::OUString::createFromAscii("hi"), - ::rtl::OUString::createFromAscii("IN")); - return aLocale; -} - -//----------------------------------------------- -const Locale Locale::HU() -{ - static Locale aLocale( - ::rtl::OUString::createFromAscii("hu"), - ::rtl::OUString()); - return aLocale; -} - -//----------------------------------------------- -const Locale Locale::IT() -{ - static Locale aLocale( - ::rtl::OUString::createFromAscii("it"), - ::rtl::OUString()); - return aLocale; -} - -//----------------------------------------------- -const Locale Locale::JA() -{ - static Locale aLocale( - ::rtl::OUString::createFromAscii("ja"), - ::rtl::OUString()); - return aLocale; -} - -//----------------------------------------------- -const Locale Locale::KO() -{ - static Locale aLocale( - ::rtl::OUString::createFromAscii("ko"), - ::rtl::OUString()); - return aLocale; -} - -//----------------------------------------------- -const Locale Locale::NL() -{ - static Locale aLocale( - ::rtl::OUString::createFromAscii("nl"), - ::rtl::OUString()); - return aLocale; -} - -//----------------------------------------------- -const Locale Locale::PL() -{ - static Locale aLocale( - ::rtl::OUString::createFromAscii("pl"), - ::rtl::OUString()); - return aLocale; -} - -//----------------------------------------------- -const Locale Locale::PT() -{ - static Locale aLocale( - ::rtl::OUString::createFromAscii("pt"), - ::rtl::OUString()); - return aLocale; -} - -//----------------------------------------------- -const Locale Locale::PT_BR() -{ - static Locale aLocale( - ::rtl::OUString::createFromAscii("pt"), - ::rtl::OUString::createFromAscii("BR")); - return aLocale; -} - -//----------------------------------------------- -const Locale Locale::RU() -{ - static Locale aLocale( - ::rtl::OUString::createFromAscii("ru"), - ::rtl::OUString()); - return aLocale; -} - -//----------------------------------------------- -const Locale Locale::SK() -{ - static Locale aLocale( - ::rtl::OUString::createFromAscii("sk"), - ::rtl::OUString()); - return aLocale; -} - -//----------------------------------------------- -const Locale Locale::SL() -{ - static Locale aLocale( - ::rtl::OUString::createFromAscii("sl"), - ::rtl::OUString()); - return aLocale; -} - -//----------------------------------------------- -const Locale Locale::SV() -{ - static Locale aLocale( - ::rtl::OUString::createFromAscii("sv"), - ::rtl::OUString()); - return aLocale; -} - -//----------------------------------------------- -const Locale Locale::TH() -{ - static Locale aLocale( - ::rtl::OUString::createFromAscii("th"), - ::rtl::OUString()); - return aLocale; -} - -//----------------------------------------------- -const Locale Locale::TR() -{ - static Locale aLocale( - ::rtl::OUString::createFromAscii("tr"), - ::rtl::OUString()); - return aLocale; -} - -//----------------------------------------------- -const Locale Locale::X_COMMENT() -{ - static Locale aLocale( - ::rtl::OUString::createFromAscii("x"), - ::rtl::OUString::createFromAscii("comment")); - return aLocale; -} - -//----------------------------------------------- -const Locale Locale::X_TRANSLATE() -{ - static Locale aLocale( - ::rtl::OUString::createFromAscii("x"), - ::rtl::OUString::createFromAscii("translate")); + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("en")), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("US"))); return aLocale; } @@ -335,26 +66,8 @@ const Locale Locale::X_TRANSLATE() const Locale Locale::X_NOTRANSLATE() { static Locale aLocale( - ::rtl::OUString::createFromAscii("x"), - ::rtl::OUString::createFromAscii("notranslate")); - return aLocale; -} - -//----------------------------------------------- -const Locale Locale::ZH_CN() -{ - static Locale aLocale( - ::rtl::OUString::createFromAscii("zh"), - ::rtl::OUString::createFromAscii("CN")); - return aLocale; -} - -//----------------------------------------------- -const Locale Locale::ZH_TW() -{ - static Locale aLocale( - ::rtl::OUString::createFromAscii("zh"), - ::rtl::OUString::createFromAscii("TW")); + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("x")), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("notranslate"))); return aLocale; } @@ -611,52 +324,6 @@ sal_Bool Locale::similar(const Locale& aComparable) const } //----------------------------------------------- -sal_Bool Locale::getFallback(Locale& aLocale) -{ - // a) - // this was our last fallback! - // break any further calls to this method ... - if (aLocale.equals(X_NOTRANSLATE())) - return sal_False; - - // b) - // switch from X_DEFAULT to X_NOTRANSLATE - // next time we will go to a) - if (aLocale.equals(X_DEFAULT())) - { - aLocale = X_NOTRANSLATE(); - return sal_True; - } - - // c) - // switch from EN to X_DEFAULT - // next time we will go to b) - if (aLocale.equals(EN())) - { - aLocale = X_DEFAULT(); - return sal_True; - } - - // d) remove country from incoming locale - // e.g. "de-DE" => "de" or "en-US" => "en"! - if (aLocale.getCountry().getLength()) - { - aLocale.setCountry(::rtl::OUString()); - return sal_True; - } - - // e) "en-US" possible? - if (!aLocale.equals(EN_US())) - { - aLocale = EN_US(); - return sal_True; - } - - // f) no more fallbacks - return sal_False; -} - -//----------------------------------------------- void Locale::operator=(const Locale& rCopy) { // Take over these values without checking ... @@ -681,3 +348,4 @@ sal_Bool Locale::operator!=(const Locale& aComparable) const } // namespace comphelper +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/misc/logging.cxx b/comphelper/source/misc/logging.cxx index 445f2cbe6c14..6d87b0fb528a 100644 --- a/comphelper/source/misc/logging.cxx +++ b/comphelper/source/misc/logging.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -103,7 +104,7 @@ namespace comphelper catch( const Exception& e ) { (void)e; - OSL_ENSURE( false, "EventLogger_Impl::impl_createLogger_nothrow: caught an exception!" ); + OSL_FAIL( "EventLogger_Impl::impl_createLogger_nothrow: caught an exception!" ); } } @@ -144,7 +145,7 @@ namespace comphelper catch( const Exception& e ) { (void)e; - OSL_ENSURE( false, "EventLogger::getLogLevel: caught an exception!" ); + OSL_FAIL( "EventLogger::getLogLevel: caught an exception!" ); } return LogLevel::OFF; @@ -161,7 +162,7 @@ namespace comphelper catch( const Exception& e ) { (void)e; - OSL_ENSURE( false, "EventLogger::setLogLevel: caught an exception!" ); + OSL_FAIL( "EventLogger::setLogLevel: caught an exception!" ); } } @@ -178,7 +179,7 @@ namespace comphelper catch( const Exception& e ) { (void)e; - OSL_ENSURE( false, "EventLogger::isLoggable: caught an exception!" ); + OSL_FAIL( "EventLogger::isLoggable: caught an exception!" ); } return false; @@ -198,7 +199,7 @@ namespace comphelper catch( const Exception& e ) { (void)e; - OSL_ENSURE( false, "EventLogger::addLogHandler: caught an exception!" ); + OSL_FAIL( "EventLogger::addLogHandler: caught an exception!" ); } return false; } @@ -217,7 +218,7 @@ namespace comphelper catch( const Exception& e ) { (void)e; - OSL_ENSURE( false, "EventLogger::removeLogHandler: caught an exception!" ); + OSL_FAIL( "EventLogger::removeLogHandler: caught an exception!" ); } return false; } @@ -291,7 +292,7 @@ namespace comphelper catch( const Exception& e ) { (void)e; - OSL_ENSURE( false, "EventLogger::impl_log: caught an exception!" ); + OSL_FAIL( "EventLogger::impl_log: caught an exception!" ); } return false; @@ -334,7 +335,7 @@ namespace comphelper catch( const Exception& e ) { (void)e; - OSL_ENSURE( false, "lcl_loadBundle_nothrow: caught an exception!" ); + OSL_FAIL( "lcl_loadBundle_nothrow: caught an exception!" ); } return _rLoggerData.xBundle.is(); @@ -355,7 +356,7 @@ namespace comphelper catch( const Exception& e ) { (void)e; - OSL_ENSURE( false, "lcl_loadString_nothrow: caught an exception!" ); + OSL_FAIL( "lcl_loadString_nothrow: caught an exception!" ); } return sMessage; } @@ -403,3 +404,5 @@ namespace comphelper //........................................................................ } // namespace comphelper //........................................................................ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/misc/mediadescriptor.cxx b/comphelper/source/misc/mediadescriptor.cxx index e0b3e797264a..68a2999b738e 100644 --- a/comphelper/source/misc/mediadescriptor.cxx +++ b/comphelper/source/misc/mediadescriptor.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -68,9 +69,6 @@ namespace css = ::com::sun::star; //_______________________________________________ // definitions -/*----------------------------------------------- - 10.03.2004 07:35 ------------------------------------------------*/ const ::rtl::OUString& MediaDescriptor::PROP_ABORTED() { static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("Aborted")); @@ -396,37 +394,25 @@ MediaDescriptor::MediaDescriptor() { } -/*----------------------------------------------- - 10.03.2004 08:09 ------------------------------------------------*/ MediaDescriptor::MediaDescriptor(const css::uno::Any& aSource) : SequenceAsHashMap(aSource) { } -/*----------------------------------------------- - 10.03.2004 08:09 ------------------------------------------------*/ MediaDescriptor::MediaDescriptor(const css::uno::Sequence< css::beans::PropertyValue >& lSource) : SequenceAsHashMap(lSource) { } -/*----------------------------------------------- - 10.03.2004 08:09 ------------------------------------------------*/ MediaDescriptor::MediaDescriptor(const css::uno::Sequence< css::beans::NamedValue >& lSource) : SequenceAsHashMap(lSource) { } -/*----------------------------------------------- - 18.11.2004 13:37 ------------------------------------------------*/ sal_Bool MediaDescriptor::isStreamReadOnly() const { - static ::rtl::OUString CONTENTSCHEME_FILE = ::rtl::OUString::createFromAscii("file"); - static ::rtl::OUString CONTENTPROP_ISREADONLY = ::rtl::OUString::createFromAscii("IsReadOnly"); + static ::rtl::OUString CONTENTSCHEME_FILE( RTL_CONSTASCII_USTRINGPARAM( "file" )); + static ::rtl::OUString CONTENTPROP_ISREADONLY( RTL_CONSTASCII_USTRINGPARAM( "IsReadOnly" )); static sal_Bool READONLY_FALLBACK = sal_False; sal_Bool bReadOnly = READONLY_FALLBACK; @@ -540,9 +526,6 @@ void MediaDescriptor::clearComponentDataEntry( const ::rtl::OUString& rName ) } } -/*----------------------------------------------- - 10.03.2004 09:02 ------------------------------------------------*/ sal_Bool MediaDescriptor::addInputStream() { return impl_addInputStream( sal_True ); @@ -602,20 +585,20 @@ sal_Bool MediaDescriptor::impl_addInputStream( sal_Bool bLockFile ) ::rtl::OUString sURL = getUnpackedValueOrDefault(MediaDescriptor::PROP_URL(), ::rtl::OUString()); if (!sURL.getLength()) throw css::uno::Exception( - ::rtl::OUString::createFromAscii("Found no URL."), + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Found no URL." )), css::uno::Reference< css::uno::XInterface >()); // Parse URL! Only the main part has to be used further. E.g. a jumpmark can make trouble ::rtl::OUString sNormalizedURL = impl_normalizeURL( sURL ); return impl_openStreamWithURL( sNormalizedURL, bLockFile ); } -#if OSL_DEBUG_LEVEL>0 +#if OSL_DEBUG_LEVEL > 0 catch(const css::uno::Exception& ex) { ::rtl::OUStringBuffer sMsg(256); sMsg.appendAscii("Invalid MediaDescriptor detected:\n"); sMsg.append (ex.Message ); - OSL_ENSURE(sal_False, ::rtl::OUStringToOString(sMsg.makeStringAndClear(), RTL_TEXTENCODING_UTF8).getStr()); + OSL_FAIL(::rtl::OUStringToOString(sMsg.makeStringAndClear(), RTL_TEXTENCODING_UTF8).getStr()); } #else catch(const css::uno::Exception&) @@ -625,15 +608,12 @@ sal_Bool MediaDescriptor::impl_addInputStream( sal_Bool bLockFile ) return sal_False; } -/*----------------------------------------------- - 25.03.2004 12:38 ------------------------------------------------*/ sal_Bool MediaDescriptor::impl_openStreamWithPostData( const css::uno::Reference< css::io::XInputStream >& _rxPostData ) throw(::com::sun::star::uno::RuntimeException) { if ( !_rxPostData.is() ) throw css::lang::IllegalArgumentException( - ::rtl::OUString::createFromAscii("Found invalid PostData."), + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Found invalid PostData." )), css::uno::Reference< css::uno::XInterface >(), 1); // PostData can't be used in read/write mode! @@ -651,7 +631,7 @@ sal_Bool MediaDescriptor::impl_openStreamWithPostData( const css::uno::Reference ::rtl::OUString sMediaType = getUnpackedValueOrDefault(MediaDescriptor::PROP_MEDIATYPE(), ::rtl::OUString()); if (!sMediaType.getLength()) { - sMediaType = ::rtl::OUString::createFromAscii("application/x-www-form-urlencoded"); + sMediaType = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "application/x-www-form-urlencoded" )); (*this)[MediaDescriptor::PROP_MEDIATYPE()] <<= sMediaType; } @@ -690,7 +670,7 @@ sal_Bool MediaDescriptor::impl_openStreamWithPostData( const css::uno::Reference // success? if ( !xResultStream.is() ) { - OSL_ENSURE( false, "no valid reply to the HTTP-Post" ); + OSL_FAIL( "no valid reply to the HTTP-Post" ); return sal_False; } @@ -699,10 +679,6 @@ sal_Bool MediaDescriptor::impl_openStreamWithPostData( const css::uno::Reference } /*-----------------------------------------------*/ - -/*----------------------------------------------- - 25.03.2004 12:29 ------------------------------------------------*/ sal_Bool MediaDescriptor::impl_openStreamWithURL( const ::rtl::OUString& sURL, sal_Bool bLockFile ) throw(::com::sun::star::uno::RuntimeException) { @@ -838,9 +814,6 @@ sal_Bool MediaDescriptor::impl_openStreamWithURL( const ::rtl::OUString& sURL, s return xInputStream.is(); } -/*----------------------------------------------- - 10.09.2004 10:51 ------------------------------------------------*/ ::rtl::OUString MediaDescriptor::impl_normalizeURL(const ::rtl::OUString& sURL) { /* Remove Jumpmarks (fragments) of an URL only here. @@ -853,7 +826,7 @@ sal_Bool MediaDescriptor::impl_openStreamWithURL( const ::rtl::OUString& sURL, s it parses the URL in another way. It's main part isnt enough and it's complete part contains the jumpmark (fragment) parameter ... */ - static ::rtl::OUString SERVICENAME_URIREFERENCEFACTORY = ::rtl::OUString::createFromAscii("com.sun.star.uri.UriReferenceFactory"); + static ::rtl::OUString SERVICENAME_URIREFERENCEFACTORY( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.uri.UriReferenceFactory" )); try { @@ -878,3 +851,4 @@ sal_Bool MediaDescriptor::impl_openStreamWithURL( const ::rtl::OUString& sURL, s } // namespace comphelper +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/misc/mimeconfighelper.cxx b/comphelper/source/misc/mimeconfighelper.cxx index 5be9df3d61b6..c81e761392b9 100644 --- a/comphelper/source/misc/mimeconfighelper.cxx +++ b/comphelper/source/misc/mimeconfighelper.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -59,7 +60,7 @@ MimeConfigurationHelper::MimeConfigurationHelper( const uno::Reference< lang::XM for ( sal_Int32 nInd = 0; nInd < aClassID.getLength(); nInd++ ) { if ( nInd == 4 || nInd == 6 || nInd == 8 || nInd == 10 ) - aResult += ::rtl::OUString::createFromAscii( "-" ); + aResult += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "-" )); sal_Int32 nDigit1 = (sal_Int32)( (sal_uInt8)aClassID[nInd] / 16 ); sal_Int32 nDigit2 = (sal_uInt8)aClassID[nInd] % 16; @@ -132,18 +133,18 @@ uno::Reference< container::XNameAccess > MimeConfigurationHelper::GetConfigurati if ( !m_xConfigProvider.is() ) m_xConfigProvider = uno::Reference< lang::XMultiServiceFactory >( m_xFactory->createInstance( - ::rtl::OUString::createFromAscii( "com.sun.star.configuration.ConfigurationProvider" ) ), + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationProvider" )) ), uno::UNO_QUERY_THROW ); uno::Sequence< uno::Any > aArgs( 1 ); beans::PropertyValue aPathProp; - aPathProp.Name = ::rtl::OUString::createFromAscii( "nodepath" ); + aPathProp.Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "nodepath" )); aPathProp.Value <<= aPath; aArgs[0] <<= aPathProp; xConfig = uno::Reference< container::XNameAccess >( m_xConfigProvider->createInstanceWithArguments( - ::rtl::OUString::createFromAscii( "com.sun.star.configuration.ConfigurationAccess" ), + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationAccess" )), aArgs ), uno::UNO_QUERY ); } @@ -160,7 +161,7 @@ uno::Reference< container::XNameAccess > MimeConfigurationHelper::GetObjConfigur if ( !m_xObjectConfig.is() ) m_xObjectConfig = GetConfigurationByPath( - ::rtl::OUString::createFromAscii( "/org.openoffice.Office.Embedding/Objects" ) ); + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Embedding/Objects" )) ); return m_xObjectConfig; } @@ -172,7 +173,7 @@ uno::Reference< container::XNameAccess > MimeConfigurationHelper::GetVerbsConfig if ( !m_xVerbsConfig.is() ) m_xVerbsConfig = GetConfigurationByPath( - ::rtl::OUString::createFromAscii( "/org.openoffice.Office.Embedding/Verbs" ) ); + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Embedding/Verbs" )) ); return m_xVerbsConfig; } @@ -184,7 +185,7 @@ uno::Reference< container::XNameAccess > MimeConfigurationHelper::GetMediaTypeCo if ( !m_xMediaTypeConfig.is() ) m_xMediaTypeConfig = GetConfigurationByPath( - ::rtl::OUString::createFromAscii( "/org.openoffice.Office.Embedding/MimeTypeClassIDRelations" ) ); + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Embedding/MimeTypeClassIDRelations" )) ); return m_xMediaTypeConfig; } @@ -196,7 +197,7 @@ uno::Reference< container::XNameAccess > MimeConfigurationHelper::GetFilterFacto if ( !m_xFilterFactory.is() ) m_xFilterFactory.set( - m_xFactory->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.document.FilterFactory" ) ), + m_xFactory->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.FilterFactory")) ), uno::UNO_QUERY ); return m_xFilterFactory; @@ -219,7 +220,7 @@ sal_Int32 MimeConfigurationHelper::GetFilterFlags( const ::rtl::OUString& aFilte if ( aFilterAny >>= aData ) { SequenceAsHashMap aFilterHM( aData ); - nFlags = aFilterHM.getUnpackedValueOrDefault( ::rtl::OUString::createFromAscii( "Flags" ), (sal_Int32)0 ); + nFlags = aFilterHM.getUnpackedValueOrDefault( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Flags")), (sal_Int32)0 ); } } } catch( uno::Exception& ) @@ -244,7 +245,7 @@ sal_Int32 MimeConfigurationHelper::GetFilterFlags( const ::rtl::OUString& aFilte if ( aFilterAnyData >>= aFilterData ) { for ( sal_Int32 nInd = 0; nInd < aFilterData.getLength(); nInd++ ) - if ( aFilterData[nInd].Name.equalsAscii( "DocumentService" ) ) + if ( aFilterData[nInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "DocumentService" ) ) ) aFilterData[nInd].Value >>= aDocServiceName; } } @@ -259,7 +260,7 @@ sal_Int32 MimeConfigurationHelper::GetFilterFlags( const ::rtl::OUString& aFilte { uno::Reference< container::XContainerQuery > xTypeCFG( m_xFactory->createInstance( - ::rtl::OUString::createFromAscii( "com.sun.star.document.TypeDetection" ) ), + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.TypeDetection" )) ), uno::UNO_QUERY ); if ( xTypeCFG.is() ) @@ -268,7 +269,7 @@ sal_Int32 MimeConfigurationHelper::GetFilterFlags( const ::rtl::OUString& aFilte { // make query for all types matching the properties uno::Sequence < beans::NamedValue > aSeq( 1 ); - aSeq[0].Name = ::rtl::OUString::createFromAscii( "MediaType" ); + aSeq[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MediaType" )); aSeq[0].Value <<= aMediaType; uno::Reference < container::XEnumeration > xEnum = xTypeCFG->createSubSetEnumerationByProperties( aSeq ); @@ -280,7 +281,7 @@ sal_Int32 MimeConfigurationHelper::GetFilterFlags( const ::rtl::OUString& aFilte for ( sal_Int32 nInd = 0; nInd < aType.getLength(); nInd++ ) { ::rtl::OUString aFilterName; - if ( aType[nInd].Name.equalsAscii( "PreferredFilter" ) + if ( aType[nInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "PreferredFilter" ) ) && ( aType[nInd].Value >>= aFilterName ) && aFilterName.getLength() ) { ::rtl::OUString aDocumentName = GetDocServiceNameFromFilter( aFilterName ); @@ -311,10 +312,10 @@ sal_Bool MimeConfigurationHelper::GetVerbByShortcut( const ::rtl::OUString& aVer if ( xVerbsConfig.is() && ( xVerbsConfig->getByName( aVerbShortcut ) >>= xVerbsProps ) && xVerbsProps.is() ) { embed::VerbDescriptor aTempDescr; - if ( ( xVerbsProps->getByName( ::rtl::OUString::createFromAscii( "VerbID" ) ) >>= aTempDescr.VerbID ) - && ( xVerbsProps->getByName( ::rtl::OUString::createFromAscii( "VerbUIName" ) ) >>= aTempDescr.VerbName ) - && ( xVerbsProps->getByName( ::rtl::OUString::createFromAscii( "VerbFlags" ) ) >>= aTempDescr.VerbFlags ) - && ( xVerbsProps->getByName( ::rtl::OUString::createFromAscii( "VerbAttributes" ) ) >>= aTempDescr.VerbAttributes ) ) + if ( ( xVerbsProps->getByName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VerbID" )) ) >>= aTempDescr.VerbID ) + && ( xVerbsProps->getByName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VerbUIName" )) ) >>= aTempDescr.VerbName ) + && ( xVerbsProps->getByName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VerbFlags" )) ) >>= aTempDescr.VerbFlags ) + && ( xVerbsProps->getByName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VerbAttributes" )) ) >>= aTempDescr.VerbAttributes ) ) { aDescriptor = aTempDescr; bResult = sal_True; @@ -342,14 +343,14 @@ uno::Sequence< beans::NamedValue > MimeConfigurationHelper::GetObjPropsFromConfi uno::Sequence< ::rtl::OUString > aObjPropNames = xObjectProps->getElementNames(); aResult.realloc( aObjPropNames.getLength() + 1 ); - aResult[0].Name = ::rtl::OUString::createFromAscii( "ClassID" ); + aResult[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ClassID" )); aResult[0].Value <<= aClassID; for ( sal_Int32 nInd = 0; nInd < aObjPropNames.getLength(); nInd++ ) { aResult[nInd + 1].Name = aObjPropNames[nInd]; - if ( aObjPropNames[nInd].equalsAscii( "ObjectVerbs" ) ) + if ( aObjPropNames[nInd].equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ObjectVerbs" ) ) ) { uno::Sequence< ::rtl::OUString > aVerbShortcuts; if ( xObjectProps->getByName( aObjPropNames[nInd] ) >>= aVerbShortcuts ) @@ -406,9 +407,9 @@ uno::Sequence< beans::NamedValue > MimeConfigurationHelper::GetObjectPropsByStri if ( ClassIDsEqual( aClassID, GetSequenceClassID( SO3_DUMMY_CLASSID ) ) ) { aObjProps.realloc(2); - aObjProps[0].Name = ::rtl::OUString::createFromAscii("ObjectFactory"); - aObjProps[0].Value <<= ::rtl::OUString::createFromAscii("com.sun.star.embed.OOoSpecialEmbeddedObjectFactory"); - aObjProps[1].Name = ::rtl::OUString::createFromAscii("ClassID"); + aObjProps[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ObjectFactory" )); + aObjProps[0].Value <<= ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.embed.OOoSpecialEmbeddedObjectFactory" )); + aObjProps[1].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ClassID" )); aObjProps[1].Value <<= aClassID; return aObjProps; } @@ -439,9 +440,9 @@ uno::Sequence< beans::NamedValue > MimeConfigurationHelper::GetObjectPropsByClas if ( ClassIDsEqual( aClassID, GetSequenceClassID( SO3_DUMMY_CLASSID ) ) ) { aObjProps.realloc(2); - aObjProps[0].Name = ::rtl::OUString::createFromAscii("ObjectFactory"); - aObjProps[0].Value <<= ::rtl::OUString::createFromAscii("com.sun.star.embed.OOoSpecialEmbeddedObjectFactory"); - aObjProps[1].Name = ::rtl::OUString::createFromAscii("ClassID"); + aObjProps[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ObjectFactory" )); + aObjProps[0].Value <<= ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.embed.OOoSpecialEmbeddedObjectFactory" )); + aObjProps[1].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ClassID" )); aObjProps[1].Value <<= aClassID; } @@ -506,7 +507,7 @@ uno::Sequence< beans::NamedValue > MimeConfigurationHelper::GetObjectPropsByDocu if ( ( xObjConfig->getByName( aClassIDs[nInd] ) >>= xObjectProps ) && xObjectProps.is() && ( xObjectProps->getByName( - ::rtl::OUString::createFromAscii( "ObjectDocumentServiceName" ) ) >>= aEntryDocName ) + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ObjectDocumentServiceName" )) ) >>= aEntryDocName ) && aEntryDocName.equals( aDocName ) ) { return GetObjPropsFromConfigEntry( GetSequenceClassIDRepresentation( aClassIDs[nInd] ), @@ -540,13 +541,13 @@ uno::Sequence< beans::NamedValue > MimeConfigurationHelper::GetObjectPropsByDocu try { if ( xObjConfig.is() && ( xObjConfig->getByName( aStringClassID.toAsciiUpperCase() ) >>= xObjectProps ) && xObjectProps.is() ) - xObjectProps->getByName( ::rtl::OUString::createFromAscii( "ObjectFactory" ) ) >>= aResult; + xObjectProps->getByName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ObjectFactory" )) ) >>= aResult; } catch( uno::Exception& ) { uno::Sequence< sal_Int8 > aClassID = GetSequenceClassIDRepresentation( aStringClassID ); if ( ClassIDsEqual( aClassID, GetSequenceClassID( SO3_DUMMY_CLASSID ) ) ) - return ::rtl::OUString::createFromAscii("com.sun.star.embed.OOoSpecialEmbeddedObjectFactory"); + return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.embed.OOoSpecialEmbeddedObjectFactory" )); } } @@ -573,10 +574,10 @@ uno::Sequence< beans::NamedValue > MimeConfigurationHelper::GetObjectPropsByDocu if ( ( xObjConfig->getByName( aClassIDs[nInd] ) >>= xObjectProps ) && xObjectProps.is() && ( xObjectProps->getByName( - ::rtl::OUString::createFromAscii( "ObjectDocumentServiceName" ) ) >>= aEntryDocName ) + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ObjectDocumentServiceName" )) ) >>= aEntryDocName ) && aEntryDocName.equals( aDocName ) ) { - xObjectProps->getByName( ::rtl::OUString::createFromAscii( "ObjectFactory" ) ) >>= aResult; + xObjectProps->getByName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ObjectFactory" )) ) >>= aResult; break; } } @@ -613,7 +614,7 @@ uno::Sequence< beans::NamedValue > MimeConfigurationHelper::GetObjectPropsByDocu ::rtl::OUString aFilterName; for ( sal_Int32 nInd = 0; nInd < aMediaDescr.getLength(); nInd++ ) - if ( aMediaDescr[nInd].Name.equalsAscii( "FilterName" ) ) + if ( aMediaDescr[nInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "FilterName" ) ) ) aMediaDescr[nInd].Value >>= aFilterName; if ( !aFilterName.getLength() ) @@ -621,7 +622,7 @@ uno::Sequence< beans::NamedValue > MimeConfigurationHelper::GetObjectPropsByDocu // filter name is not specified, so type detection should be done uno::Reference< document::XTypeDetection > xTypeDetection( - m_xFactory->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.document.TypeDetection" ) ), + m_xFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.TypeDetection" )) ), uno::UNO_QUERY ); if ( !xTypeDetection.is() ) @@ -635,14 +636,14 @@ uno::Sequence< beans::NamedValue > MimeConfigurationHelper::GetObjectPropsByDocu // get FilterName for ( sal_Int32 nInd = 0; nInd < aTempMD.getLength(); nInd++ ) - if ( aTempMD[nInd].Name.equalsAscii( "FilterName" ) ) + if ( aTempMD[nInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "FilterName" ) ) ) aTempMD[nInd].Value >>= aFilterName; if ( aFilterName.getLength() ) { sal_Int32 nOldLen = aMediaDescr.getLength(); aMediaDescr.realloc( nOldLen + 1 ); - aMediaDescr[nOldLen].Name = ::rtl::OUString::createFromAscii( "FilterName" ); + aMediaDescr[nOldLen].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FilterName" )); aMediaDescr[ nOldLen ].Value <<= aFilterName; } @@ -655,11 +656,11 @@ uno::Sequence< beans::NamedValue > MimeConfigurationHelper::GetObjectPropsByDocu { for ( sal_Int32 nInd = 0; nInd < aTypes.getLength(); nInd++ ) { - if ( aTypes[nInd].Name.equalsAscii( "PreferredFilter" ) && ( aTypes[nInd].Value >>= aFilterName ) ) + if ( aTypes[nInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "PreferredFilter" ) ) && ( aTypes[nInd].Value >>= aFilterName ) ) { sal_Int32 nOldLen = aMediaDescr.getLength(); aMediaDescr.realloc( nOldLen + 1 ); - aMediaDescr[nOldLen].Name = ::rtl::OUString::createFromAscii( "FilterName" ); + aMediaDescr[nOldLen].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FilterName" )); aMediaDescr[ nOldLen ].Value = aTypes[nInd].Value; break; } @@ -677,7 +678,7 @@ uno::Sequence< beans::NamedValue > MimeConfigurationHelper::GetObjectPropsByDocu { ::rtl::OUString aDocName; for ( sal_Int32 nInd = 0; nInd < aObject.getLength(); nInd++ ) - if ( aObject[nInd].Name.equalsAscii( "ObjectDocumentServiceName" ) ) + if ( aObject[nInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ObjectDocumentServiceName" ) ) ) { aObject[nInd].Value >>= aDocName; break; @@ -688,7 +689,7 @@ uno::Sequence< beans::NamedValue > MimeConfigurationHelper::GetObjectPropsByDocu sal_Bool bNeedsAddition = sal_True; for ( sal_Int32 nMedInd = 0; nMedInd < aMediaDescr.getLength(); nMedInd++ ) - if ( aMediaDescr[nMedInd].Name.equalsAscii( "DocumentService" ) ) + if ( aMediaDescr[nMedInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "DocumentService" ) ) ) { aMediaDescr[nMedInd].Value <<= aDocName; bNeedsAddition = sal_False; @@ -699,7 +700,7 @@ uno::Sequence< beans::NamedValue > MimeConfigurationHelper::GetObjectPropsByDocu { sal_Int32 nOldLen = aMediaDescr.getLength(); aMediaDescr.realloc( nOldLen + 1 ); - aMediaDescr[nOldLen].Name = ::rtl::OUString::createFromAscii( "DocumentService" ); + aMediaDescr[nOldLen].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DocumentService" )); aMediaDescr[nOldLen].Value <<= aDocName; } @@ -735,9 +736,9 @@ sal_Bool MimeConfigurationHelper::AddFilterNameCheckOwnFile( uno::UNO_QUERY_THROW ); uno::Sequence< beans::NamedValue > aSearchRequest( 2 ); - aSearchRequest[0].Name = ::rtl::OUString::createFromAscii( "DocumentService" ); + aSearchRequest[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DocumentService" )); aSearchRequest[0].Value <<= aServiceName; - aSearchRequest[1].Name = ::rtl::OUString::createFromAscii( "FileFormatVersion" ); + aSearchRequest[1].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FileFormatVersion" )); aSearchRequest[1].Value <<= nVersion; uno::Sequence< beans::PropertyValue > aFilterProps; @@ -752,7 +753,7 @@ sal_Bool MimeConfigurationHelper::AddFilterNameCheckOwnFile( if ( xFilterEnum->nextElement() >>= aProps ) { SequenceAsHashMap aPropsHM( aProps ); - sal_Int32 nFlags = aPropsHM.getUnpackedValueOrDefault( ::rtl::OUString::createFromAscii( "Flags" ), + sal_Int32 nFlags = aPropsHM.getUnpackedValueOrDefault( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Flags" )), (sal_Int32)0 ); // that should be import, export, own filter and not a template filter ( TemplatePath flag ) @@ -762,7 +763,7 @@ sal_Bool MimeConfigurationHelper::AddFilterNameCheckOwnFile( // if there are more than one filter the preffered one should be used // if there is no preffered filter the first one will be used if ( !aResult.getLength() || ( nFlags & SFX_FILTER_PREFERED ) ) - aResult = aPropsHM.getUnpackedValueOrDefault( ::rtl::OUString::createFromAscii( "Name" ), + aResult = aPropsHM.getUnpackedValueOrDefault( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Name" )), ::rtl::OUString() ); if ( nFlags & SFX_FILTER_PREFERED ) break; // the preffered filter was found @@ -794,12 +795,12 @@ sal_Bool MimeConfigurationHelper::AddFilterNameCheckOwnFile( if ( aImpFilterAny >>= aImpData ) { SequenceAsHashMap aImpFilterHM( aImpData ); - sal_Int32 nFlags = aImpFilterHM.getUnpackedValueOrDefault( ::rtl::OUString::createFromAscii( "Flags" ), + sal_Int32 nFlags = aImpFilterHM.getUnpackedValueOrDefault( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Flags")), (sal_Int32)0 ); if ( !( nFlags & SFX_FILTER_IMPORT ) ) { - OSL_ENSURE( sal_False, "This is no import filter!" ); + OSL_FAIL( "This is no import filter!" ); throw uno::Exception(); } @@ -809,16 +810,16 @@ sal_Bool MimeConfigurationHelper::AddFilterNameCheckOwnFile( } else { - ::rtl::OUString aDocumentServiceName = aImpFilterHM.getUnpackedValueOrDefault( ::rtl::OUString::createFromAscii( "DocumentService" ), ::rtl::OUString() ); - ::rtl::OUString aTypeName = aImpFilterHM.getUnpackedValueOrDefault( ::rtl::OUString::createFromAscii( "Type" ), ::rtl::OUString() ); + ::rtl::OUString aDocumentServiceName = aImpFilterHM.getUnpackedValueOrDefault( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DocumentService")), ::rtl::OUString() ); + ::rtl::OUString aTypeName = aImpFilterHM.getUnpackedValueOrDefault( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Type")), ::rtl::OUString() ); OSL_ENSURE( aDocumentServiceName.getLength() && aTypeName.getLength(), "Incomplete filter data!" ); if ( aDocumentServiceName.getLength() && aTypeName.getLength() ) { uno::Sequence< beans::NamedValue > aSearchRequest( 2 ); - aSearchRequest[0].Name = ::rtl::OUString::createFromAscii( "Type" ); + aSearchRequest[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Type")); aSearchRequest[0].Value <<= aTypeName; - aSearchRequest[1].Name = ::rtl::OUString::createFromAscii( "DocumentService" ); + aSearchRequest[1].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DocumentService")); aSearchRequest[1].Value <<= aDocumentServiceName; uno::Sequence< beans::PropertyValue > aExportFilterProps = SearchForFilter( @@ -830,7 +831,7 @@ sal_Bool MimeConfigurationHelper::AddFilterNameCheckOwnFile( if ( aExportFilterProps.getLength() ) { SequenceAsHashMap aExpPropsHM( aExportFilterProps ); - aExportFilterName = aExpPropsHM.getUnpackedValueOrDefault( ::rtl::OUString::createFromAscii( "Name" ), ::rtl::OUString() ); + aExportFilterName = aExpPropsHM.getUnpackedValueOrDefault( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Name")), ::rtl::OUString() ); } } } @@ -865,7 +866,7 @@ uno::Sequence< beans::PropertyValue > MimeConfigurationHelper::SearchForFilter( if ( xFilterEnum->nextElement() >>= aProps ) { SequenceAsHashMap aPropsHM( aProps ); - sal_Int32 nFlags = aPropsHM.getUnpackedValueOrDefault( ::rtl::OUString::createFromAscii( "Flags" ), + sal_Int32 nFlags = aPropsHM.getUnpackedValueOrDefault( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Flags")), (sal_Int32)0 ); if ( ( ( nFlags & nMustFlags ) == nMustFlags ) && !( nFlags & nDontFlags ) ) { @@ -939,3 +940,4 @@ uno::Sequence<sal_Int8> MimeConfigurationHelper::GetSequenceClassIDFromObjectNam return aClassId; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/misc/namedvaluecollection.cxx b/comphelper/source/misc/namedvaluecollection.cxx index 566e5526019c..6ed6cd1af22e 100644 --- a/comphelper/source/misc/namedvaluecollection.cxx +++ b/comphelper/source/misc/namedvaluecollection.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -29,17 +30,16 @@ #include "precompiled_comphelper.hxx" #include <comphelper/namedvaluecollection.hxx> -/** === begin UNO includes === **/ #include <com/sun/star/beans/NamedValue.hpp> #include <com/sun/star/lang/IllegalArgumentException.hpp> #include <com/sun/star/beans/PropertyState.hpp> -/** === end UNO includes === **/ #include <rtl/ustrbuf.hxx> #include <rtl/strbuf.hxx> +#include <rtl/instance.hxx> #include <osl/diagnose.h> -#include <hash_map> +#include <boost/unordered_map.hpp> #include <functional> #include <algorithm> @@ -65,7 +65,7 @@ namespace comphelper //==================================================================== //= NamedValueCollection_Impl //==================================================================== - typedef ::std::hash_map< ::rtl::OUString, Any, ::rtl::OUStringHash > NamedValueRepository; + typedef ::boost::unordered_map< ::rtl::OUString, Any, ::rtl::OUStringHash > NamedValueRepository; struct NamedValueCollection_Impl { @@ -158,13 +158,11 @@ namespace comphelper //-------------------------------------------------------------------- ::std::vector< ::rtl::OUString > NamedValueCollection::getNames() const { - ::std::vector< ::rtl::OUString > aNames( m_pImpl->aValues.size() ); - ::std::transform( - m_pImpl->aValues.begin(), - m_pImpl->aValues.end(), - aNames.begin(), - ::std::select1st< NamedValueRepository::value_type >() - ); + ::std::vector< ::rtl::OUString > aNames; + for ( NamedValueRepository::const_iterator it = m_pImpl->aValues.begin(), end = m_pImpl->aValues.end(); it != end; ++it ) + { + aNames.push_back( it->first ); + } return aNames; } @@ -213,7 +211,7 @@ namespace comphelper ::rtl::OStringBuffer message; message.append( "NamedValueCollection::impl_assign: encountered a value type which I cannot handle:\n" ); message.append( ::rtl::OUStringToOString( pArgument->getValueTypeName(), RTL_TEXTENCODING_ASCII_US ) ); - OSL_ENSURE( false, message.makeStringAndClear() ); + OSL_FAIL( message.makeStringAndClear() ); } #endif } @@ -278,6 +276,11 @@ namespace comphelper return false; } + namespace + { + class theEmptyDefault : public rtl::Static<Any, theEmptyDefault> {}; + } + //-------------------------------------------------------------------- const Any& NamedValueCollection::impl_get( const ::rtl::OUString& _rValueName ) const { @@ -285,8 +288,7 @@ namespace comphelper if ( pos != m_pImpl->aValues.end() ) return pos->second; - static Any aEmptyDefault; - return aEmptyDefault; + return theEmptyDefault::get(); } //-------------------------------------------------------------------- @@ -355,3 +357,4 @@ namespace comphelper } // namespace comphelper //........................................................................ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/misc/numberedcollection.cxx b/comphelper/source/misc/numberedcollection.cxx index 11f430a30fba..e8374efc2e4d 100644 --- a/comphelper/source/misc/numberedcollection.cxx +++ b/comphelper/source/misc/numberedcollection.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -45,8 +46,7 @@ namespace css = ::com::sun::star; //_______________________________________________ // definitions -static const ::rtl::OUString ERRMSG_INVALID_COMPONENT_PARAM = ::rtl::OUString::createFromAscii("NULL as component reference not allowed."); -static const ::rtl::OUString ERRMSG_INVALID_NUMBER_PARAM = ::rtl::OUString::createFromAscii("Special valkud INVALID_NUMBER not allowed as input parameter."); +static const ::rtl::OUString ERRMSG_INVALID_COMPONENT_PARAM(RTL_CONSTASCII_USTRINGPARAM("NULL as component reference not allowed.")); //----------------------------------------------- NumberedCollection::NumberedCollection() @@ -129,33 +129,33 @@ void SAL_CALL NumberedCollection::releaseNumber(::sal_Int32 nNumber) // SYNCHRONIZED -> ::osl::ResettableMutexGuard aLock(m_aMutex); - if (nNumber == css::frame::UntitledNumbersConst::INVALID_NUMBER) - throw css::lang::IllegalArgumentException (ERRMSG_INVALID_NUMBER_PARAM, m_xOwner.get(), 1); + if (nNumber == css::frame::UntitledNumbersConst::INVALID_NUMBER) + throw css::lang::IllegalArgumentException (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Special valkud INVALID_NUMBER not allowed as input parameter.")), m_xOwner.get(), 1); - TDeadItemList lDeadItems; - TNumberedItemHash::iterator pComponent; + TDeadItemList lDeadItems; + TNumberedItemHash::iterator pComponent; - for ( pComponent = m_lComponents.begin (); - pComponent != m_lComponents.end (); - ++pComponent ) - { - const TNumberedItem& rItem = pComponent->second; - const css::uno::Reference< css::uno::XInterface > xItem = rItem.xItem.get(); + for ( pComponent = m_lComponents.begin (); + pComponent != m_lComponents.end (); + ++pComponent ) + { + const TNumberedItem& rItem = pComponent->second; + const css::uno::Reference< css::uno::XInterface > xItem = rItem.xItem.get(); - if ( ! xItem.is ()) - { - lDeadItems.push_back(pComponent->first); - continue; - } + if ( ! xItem.is ()) + { + lDeadItems.push_back(pComponent->first); + continue; + } - if (rItem.nNumber == nNumber) - { - m_lComponents.erase (pComponent); - break; - } + if (rItem.nNumber == nNumber) + { + m_lComponents.erase (pComponent); + break; } + } - impl_cleanUpDeadItems(m_lComponents, lDeadItems); + impl_cleanUpDeadItems(m_lComponents, lDeadItems); // <- SYNCHRONIZED } @@ -274,3 +274,5 @@ void NumberedCollection::impl_cleanUpDeadItems ( TNumberedItemHash& lItems } } // namespace comphelper + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/misc/numbers.cxx b/comphelper/source/misc/numbers.cxx index 06f9f519c318..334a9e52178d 100644 --- a/comphelper/source/misc/numbers.cxx +++ b/comphelper/source/misc/numbers.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -52,7 +53,7 @@ sal_Int16 getNumberFormatType(const staruno::Reference<starutil::XNumberFormats> { staruno::Reference<starbeans::XPropertySet> xFormat(xFormats->getByKey(nKey)); if (xFormat.is()) - xFormat->getPropertyValue(rtl::OUString::createFromAscii("Type")) >>= nReturn; + xFormat->getPropertyValue(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Type" ))) >>= nReturn; } catch(...) { @@ -82,7 +83,7 @@ staruno::Any getNumberFormatDecimals(const staruno::Reference<starutil::XNumberF staruno::Reference<starbeans::XPropertySet> xFormat( xFormats->getByKey(nKey)); if (xFormat.is()) { - static ::rtl::OUString PROPERTY_DECIMALS = ::rtl::OUString::createFromAscii("Decimals"); + static ::rtl::OUString PROPERTY_DECIMALS( RTL_CONSTASCII_USTRINGPARAM( "Decimals" )); return xFormat->getPropertyValue(PROPERTY_DECIMALS); } } @@ -138,7 +139,7 @@ Any getNumberFormatProperty( const Reference< XNumberFormatter >& _rxFormatter, } catch( const Exception& ) { - OSL_ENSURE( sal_False, "::getNumberFormatProperty: caught an exception (did you create the key with another formatter?)!" ); + OSL_FAIL( "::getNumberFormatProperty: caught an exception (did you create the key with another formatter?)!" ); } return aReturn; @@ -148,3 +149,4 @@ Any getNumberFormatProperty( const Reference< XNumberFormatter >& _rxFormatter, } // namespace comphelper //......................................................................... +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/misc/officeresourcebundle.cxx b/comphelper/source/misc/officeresourcebundle.cxx index cbe5b0dc2659..2e2119cb2ee3 100644 --- a/comphelper/source/misc/officeresourcebundle.cxx +++ b/comphelper/source/misc/officeresourcebundle.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -136,7 +137,7 @@ namespace comphelper } catch( const Exception& ) { - OSL_ENSURE( false, "ResourceBundle_Impl::loadString: caught an exception!" ); + OSL_FAIL( "ResourceBundle_Impl::loadString: caught an exception!" ); } } return sString; @@ -157,7 +158,7 @@ namespace comphelper } catch( const Exception& ) { - OSL_ENSURE( false, "ResourceBundle_Impl::hasString: caught an exception!" ); + OSL_FAIL( "ResourceBundle_Impl::hasString: caught an exception!" ); } } return has; @@ -181,7 +182,7 @@ namespace comphelper } catch( const Exception& ) { - OSL_ENSURE( false, "ResourceBundle_Impl::impl_loadBundle_nopthrow: could not create the resource loader!" ); + OSL_FAIL( "ResourceBundle_Impl::impl_loadBundle_nopthrow: could not create the resource loader!" ); } if ( !xLoader.is() ) @@ -193,7 +194,7 @@ namespace comphelper } catch( const MissingResourceException& ) { - OSL_ENSURE( false, "ResourceBundle_Impl::impl_loadBundle_nopthrow: missing the given resource bundle!" ); + OSL_FAIL( "ResourceBundle_Impl::impl_loadBundle_nopthrow: missing the given resource bundle!" ); } return m_xBundle.is(); @@ -238,3 +239,5 @@ namespace comphelper //........................................................................ } // namespace comphelper //........................................................................ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/misc/officerestartmanager.cxx b/comphelper/source/misc/officerestartmanager.cxx index 1a98ddfce8da..20af7275ca4d 100644 --- a/comphelper/source/misc/officerestartmanager.cxx +++ b/comphelper/source/misc/officerestartmanager.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -103,7 +104,7 @@ void SAL_CALL OOfficeRestartManager::requestRestart( const uno::Reference< task: uno::Reference< awt::XRequestCallback > xRequestCallback( xFactory->createInstanceWithContext( - ::rtl::OUString::createFromAscii("com.sun.star.awt.AsyncCallback"), + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.AsyncCallback" )), m_xContext ), uno::UNO_QUERY_THROW ); @@ -208,3 +209,5 @@ void createRegistryInfo_OOfficeRestartManager() static ::comphelper::module::OAutoRegistration< ::comphelper::OOfficeRestartManager > aAutoRegistration; static ::comphelper::module::OSingletonRegistration< ::comphelper::OOfficeRestartManager > aSingletonRegistration; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/misc/officerestartmanager.hxx b/comphelper/source/misc/officerestartmanager.hxx index 2317d0217060..c0aabf65d531 100644 --- a/comphelper/source/misc/officerestartmanager.hxx +++ b/comphelper/source/misc/officerestartmanager.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -89,3 +90,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/misc/proxyaggregation.cxx b/comphelper/source/misc/proxyaggregation.cxx index 1a3dd73930ba..b24aa4407356 100644 --- a/comphelper/source/misc/proxyaggregation.cxx +++ b/comphelper/source/misc/proxyaggregation.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -274,3 +275,4 @@ namespace comphelper } // namespace comphelper //............................................................................. +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/misc/regpathhelper.cxx b/comphelper/source/misc/regpathhelper.cxx index 0ac8f0277236..1228e9278db9 100644 --- a/comphelper/source/misc/regpathhelper.cxx +++ b/comphelper/source/misc/regpathhelper.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -32,14 +33,16 @@ #include <osl/file.hxx> #include <osl/security.hxx> #include <osl/thread.h> -#include <vos/process.hxx> +#include <osl/process.h> #include <rtl/textenc.h> #include <rtl/uri.h> #include <rtl/uri.hxx> -using namespace vos; using namespace osl; -using namespace rtl; + +using ::rtl::OUString; +using ::rtl::OString; +using ::rtl::OStringToOUString; #define PATH_DELEMITTER '/' @@ -65,18 +68,17 @@ namespace comphelper */ static sal_Bool retrievePortalUserDir( OUString *pDirectory ) { - OStartupInfo startInfo; - sal_uInt32 nArgs = startInfo.getCommandArgCount(); + sal_uInt32 nArgs = osl_getCommandArgCount(); sal_Bool bIsPortalUser = sal_False; OUString sArg; while( nArgs > 0 ) - { - if ( !startInfo.getCommandArg(--nArgs, sArg) ) - { - if ( sArg.indexOf(OUString::createFromAscii("-userid")) == 0 ) + { + if ( !osl_getCommandArg(--nArgs, &sArg.pData) ) + { + if ( sArg.indexOf(OUString( RTL_CONSTASCII_USTRINGPARAM( "-userid" ))) == 0 ) { - bIsPortalUser = sal_True; + bIsPortalUser = sal_True; sal_Int32 nStart = sArg.lastIndexOf( '[' ); sal_Int32 nEnd = sArg.lastIndexOf( ']' ); if( -1 == nStart || -1 == nEnd || nEnd < nStart) @@ -188,8 +190,7 @@ OUString getPathToSystemRegistry() FILE *f=NULL; // search in the directory of the executable - OStartupInfo info; - if( OStartupInfo::E_None == info.getExecutableFile(uBuffer) ) + if(osl_Process_E_None == osl_getExecutableFile(&uBuffer.pData)) { sal_uInt32 lastIndex = uBuffer.lastIndexOf(PATH_DELEMITTER); if (lastIndex > 0) @@ -233,3 +234,4 @@ OUString getPathToSystemRegistry() } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/misc/scopeguard.cxx b/comphelper/source/misc/scopeguard.cxx index ccd5b618605b..c37484be5b07 100644 --- a/comphelper/source/misc/scopeguard.cxx +++ b/comphelper/source/misc/scopeguard.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -45,14 +46,14 @@ ScopeGuard::~ScopeGuard() } catch (com::sun::star::uno::Exception & exc) { (void) exc; // avoid warning about unused variable - OSL_ENSURE( - false, rtl::OUStringToOString( + OSL_FAIL( + rtl::OUStringToOString( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( - "UNO exception occured: ") ) + + "UNO exception occurred: ") ) + exc.Message, RTL_TEXTENCODING_UTF8 ).getStr() ); } catch (...) { - OSL_ENSURE( false, "unknown exception occured!" ); + OSL_FAIL( "unknown exception occurred!" ); } } else @@ -77,3 +78,4 @@ FlagRestorationGuard::~FlagRestorationGuard() } // namespace comphelper +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/misc/sequence.cxx b/comphelper/source/misc/sequence.cxx index b0d7c4da1587..622cfff4989d 100644 --- a/comphelper/source/misc/sequence.cxx +++ b/comphelper/source/misc/sequence.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -101,3 +102,4 @@ sal_Bool existsValue(const ::rtl::OUString& Value,const staruno::Sequence< ::rtl } // namespace comphelper //......................................................................... +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/misc/sequenceashashmap.cxx b/comphelper/source/misc/sequenceashashmap.cxx index a79ffc9037cc..d119f10a3a0d 100644 --- a/comphelper/source/misc/sequenceashashmap.cxx +++ b/comphelper/source/misc/sequenceashashmap.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -114,7 +115,7 @@ void SequenceAsHashMap::operator<<(const css::uno::Any& aSource) } throw css::beans::IllegalTypeException( - ::rtl::OUString::createFromAscii("Any contains wrong type."), + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Any contains wrong type." )), css::uno::Reference< css::uno::XInterface >()); } @@ -134,7 +135,7 @@ void SequenceAsHashMap::operator<<(const css::uno::Sequence< css::uno::Any >& lS (!lP.Value.hasValue()) ) throw css::beans::IllegalTypeException( - ::rtl::OUString::createFromAscii("PropertyValue struct contains no usefull informations."), + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PropertyValue struct contains no usefull informations." )), css::uno::Reference< css::uno::XInterface >()); (*this)[lP.Name] = lP.Value; continue; @@ -148,7 +149,7 @@ void SequenceAsHashMap::operator<<(const css::uno::Sequence< css::uno::Any >& lS (!lN.Value.hasValue()) ) throw css::beans::IllegalTypeException( - ::rtl::OUString::createFromAscii("NamedValue struct contains no usefull informations."), + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "NamedValue struct contains no usefull informations." )), css::uno::Reference< css::uno::XInterface >()); (*this)[lN.Name] = lN.Value; continue; @@ -157,7 +158,7 @@ void SequenceAsHashMap::operator<<(const css::uno::Sequence< css::uno::Any >& lS // ignore VOID Any ... but reject wrong filled ones! if (lSource[i].hasValue()) throw css::beans::IllegalTypeException( - ::rtl::OUString::createFromAscii("Any contains wrong type."), + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Any contains wrong type." )), css::uno::Reference< css::uno::XInterface >()); } } @@ -398,3 +399,5 @@ void SequenceAsHashMap::dbg_dumpToFile(const char* pFileName, #endif // OSL_DEBUG_LEVEL > 1 } // namespace comphelper + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/misc/servicedecl.cxx b/comphelper/source/misc/servicedecl.cxx index 7986407b0bd5..6048709fd061 100644 --- a/comphelper/source/misc/servicedecl.cxx +++ b/comphelper/source/misc/servicedecl.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -163,3 +164,4 @@ rtl::OUString ServiceDecl::getImplementationName() const } // namespace service_decl } // namespace comphelper +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/misc/serviceinfohelper.cxx b/comphelper/source/misc/serviceinfohelper.cxx index f2f9da278a06..97f7f96ad8df 100644 --- a/comphelper/source/misc/serviceinfohelper.cxx +++ b/comphelper/source/misc/serviceinfohelper.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -6,9 +7,6 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: unoprov.cxx,v $ - * $Revision: 1.72.92.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -110,3 +108,4 @@ void ServiceInfoHelper::addToSequence( ::com::sun::star::uno::Sequence< ::rtl::O } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/misc/sharedmutex.cxx b/comphelper/source/misc/sharedmutex.cxx index 4d3fade030a6..346fead794fe 100644 --- a/comphelper/source/misc/sharedmutex.cxx +++ b/comphelper/source/misc/sharedmutex.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -60,3 +61,5 @@ namespace comphelper //........................................................................ } // namespace comphelper //........................................................................ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/misc/stillreadwriteinteraction.cxx b/comphelper/source/misc/stillreadwriteinteraction.cxx index 9054f0754b5e..f51353e47897 100644 --- a/comphelper/source/misc/stillreadwriteinteraction.cxx +++ b/comphelper/source/misc/stillreadwriteinteraction.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -29,17 +30,11 @@ #include "precompiled_comphelper.hxx" #include <comphelper/stillreadwriteinteraction.hxx> -#ifndef __COM_SUN_STAR_UCB_INTERACTIVEIOEXCEPTION_HPP__ #include <com/sun/star/ucb/InteractiveIOException.hpp> -#endif -#ifndef __COM_SUN_STAR_TASK_XINTERACTIONABORT_HPP__ #include <com/sun/star/task/XInteractionAbort.hpp> -#endif -#ifndef __COM_SUN_STAR_UCB_UNSUPPORTEDDATASINKEXCEPTION_HPP__ #include <com/sun/star/ucb/UnsupportedDataSinkException.hpp> -#endif namespace comphelper{ @@ -142,3 +137,5 @@ ucbhelper::InterceptedInteraction::EInterceptionState StillReadWriteInteraction: return ::ucbhelper::InterceptedInteraction::E_INTERCEPTED; } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/misc/storagehelper.cxx b/comphelper/source/misc/storagehelper.cxx index 9b4e7a15cfca..3441e0a1736f 100644 --- a/comphelper/source/misc/storagehelper.cxx +++ b/comphelper/source/misc/storagehelper.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -63,7 +64,7 @@ uno::Reference< lang::XSingleServiceFactory > OStorageHelper::GetStorageFactory( throw uno::RuntimeException(); uno::Reference < lang::XSingleServiceFactory > xStorageFactory( - xFactory->createInstance ( ::rtl::OUString::createFromAscii( "com.sun.star.embed.StorageFactory" ) ), + xFactory->createInstance ( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.embed.StorageFactory" )) ), uno::UNO_QUERY ); if ( !xStorageFactory.is() ) @@ -82,7 +83,7 @@ uno::Reference< lang::XSingleServiceFactory > OStorageHelper::GetFileSystemStora throw uno::RuntimeException(); uno::Reference < lang::XSingleServiceFactory > xStorageFactory( - xFactory->createInstance ( ::rtl::OUString::createFromAscii( "com.sun.star.embed.FileSystemStorageFactory" ) ), + xFactory->createInstance ( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.embed.FileSystemStorageFactory" )) ), uno::UNO_QUERY ); if ( !xStorageFactory.is() ) @@ -228,7 +229,7 @@ uno::Reference< io::XInputStream > OStorageHelper::GetInputStreamFromURL( throw uno::RuntimeException(); uno::Reference < ::com::sun::star::ucb::XSimpleFileAccess > xTempAccess( - xFactory->createInstance ( ::rtl::OUString::createFromAscii( "com.sun.star.ucb.SimpleFileAccess" ) ), + xFactory->createInstance ( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ucb.SimpleFileAccess" )) ), uno::UNO_QUERY ); if ( !xTempAccess.is() ) @@ -262,7 +263,7 @@ sal_Int32 OStorageHelper::GetXStorageFormat( uno::Reference< beans::XPropertySet > xStorProps( xStorage, uno::UNO_QUERY_THROW ); ::rtl::OUString aMediaType; - xStorProps->getPropertyValue( ::rtl::OUString::createFromAscii( "MediaType" ) ) >>= aMediaType; + xStorProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MediaType" )) ) >>= aMediaType; sal_Int32 nResult = 0; @@ -554,3 +555,4 @@ sal_Bool OStorageHelper::PathHasSegment( const ::rtl::OUString& aPath, const ::r } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/misc/string.cxx b/comphelper/source/misc/string.cxx index 951baf0be8d2..18ad6ad4fe9f 100644 --- a/comphelper/source/misc/string.cxx +++ b/comphelper/source/misc/string.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -41,6 +42,8 @@ #include <comphelper/stlunosequence.hxx> #include <comphelper/stl_types.hxx> +#include <com/sun/star/i18n/CharType.hpp> + namespace comphelper { namespace string { @@ -91,20 +94,119 @@ rtl::OUString searchAndReplaceAsciiL( return _source; } +sal_uInt32 decimalStringToNumber( + ::rtl::OUString const & str ) +{ + sal_uInt32 result = 0; + for( sal_Int32 i = 0 ; i < str.getLength() ; ) + { + sal_uInt32 c = str.iterateCodePoints(&i); + sal_uInt32 value = 0; + if( c <= 0x0039) // ASCII decimal digits, most common + value = c - 0x0030; + else if( c >= 0x1D7F6 ) // mathematical monospace digits + value = c - 0x1D7F6; + else if( c >= 0x1D7EC ) // mathematical sans-serif bold digits + value = c - 0x1D7EC; + else if( c >= 0x1D7E2 ) // mathematical sans-serif digits + value = c - 0x1D7E2; + else if( c >= 0x1D7D8 ) // mathematical double-struck digits + value = c - 0x1D7D8; + else if( c >= 0x1D7CE ) // mathematical bold digits + value = c - 0x1D7CE; + else if( c >= 0x11066 ) // brahmi digits + value = c - 0x11066; + else if( c >= 0x104A0 ) // osmanya digits + value = c - 0x104A0; + else if( c >= 0xFF10 ) // fullwidth digits + value = c - 0xFF10; + else if( c >= 0xABF0 ) // meetei mayek digits + value = c - 0xABF0; + else if( c >= 0xAA50 ) // cham digits + value = c - 0xAA50; + else if( c >= 0xA9D0 ) // javanese digits + value = c - 0xA9D0; + else if( c >= 0xA900 ) // kayah li digits + value = c - 0xA900; + else if( c >= 0xA8D0 ) // saurashtra digits + value = c - 0xA8D0; + else if( c >= 0xA620 ) // vai digits + value = c - 0xA620; + else if( c >= 0x1C50 ) // ol chiki digits + value = c - 0x1C50; + else if( c >= 0x1C40 ) // lepcha digits + value = c - 0x1C40; + else if( c >= 0x1BB0 ) // sundanese digits + value = c - 0x1BB0; + else if( c >= 0x1B50 ) // balinese digits + value = c - 0x1B50; + else if( c >= 0x1A90 ) // tai tham tham digits + value = c - 0x1A90; + else if( c >= 0x1A80 ) // tai tham hora digits + value = c - 0x1A80; + else if( c >= 0x19D0 ) // new tai lue digits + value = c - 0x19D0; + else if( c >= 0x1946 ) // limbu digits + value = c - 0x1946; + else if( c >= 0x1810 ) // mongolian digits + value = c - 0x1810; + else if( c >= 0x17E0 ) // khmer digits + value = c - 0x17E0; + else if( c >= 0x1090 ) // myanmar shan digits + value = c - 0x1090; + else if( c >= 0x1040 ) // myanmar digits + value = c - 0x1040; + else if( c >= 0x0F20 ) // tibetan digits + value = c - 0x0F20; + else if( c >= 0x0ED0 ) // lao digits + value = c - 0x0ED0; + else if( c >= 0x0E50 ) // thai digits + value = c - 0x0E50; + else if( c >= 0x0D66 ) // malayalam digits + value = c - 0x0D66; + else if( c >= 0x0CE6 ) // kannada digits + value = c - 0x0CE6; + else if( c >= 0x0C66 ) // telugu digits + value = c - 0x0C66; + else if( c >= 0x0BE6 ) // tamil digits + value = c - 0x0BE6; + else if( c >= 0x0B66 ) // oriya digits + value = c - 0x0B66; + else if( c >= 0x0AE6 ) // gujarati digits + value = c - 0x0AE6; + else if( c >= 0x0A66 ) // gurmukhi digits + value = c - 0x0A66; + else if( c >= 0x09E6 ) // bengali digits + value = c - 0x09E6; + else if( c >= 0x0966 ) // devanagari digit + value = c - 0x0966; + else if( c >= 0x07C0 ) // nko digits + value = c - 0x07C0; + else if( c >= 0x06F0 ) // extended arabic-indic digits + value = c - 0x06F0; + else if( c >= 0x0660 ) // arabic-indic digits + value = c - 0x0660; + result = result * 10 + value; + } + return result; +} + +using namespace ::com::sun::star; + // convert between sequence of string and comma separated string ::rtl::OUString convertCommaSeparated( - ::com::sun::star::uno::Sequence< ::rtl::OUString > const& i_rSeq) + uno::Sequence< ::rtl::OUString > const& i_rSeq) { ::rtl::OUStringBuffer buf; ::comphelper::intersperse( ::comphelper::stl_begin(i_rSeq), ::comphelper::stl_end(i_rSeq), ::comphelper::OUStringBufferAppender(buf), - ::rtl::OUString::createFromAscii(", ")); + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ", " ))); return buf.makeStringAndClear(); } -::com::sun::star::uno::Sequence< ::rtl::OUString > +uno::Sequence< ::rtl::OUString > convertCommaSeparated( ::rtl::OUString const& i_rString ) { std::vector< ::rtl::OUString > vec; @@ -117,9 +219,95 @@ rtl::OUString searchAndReplaceAsciiL( vec.push_back(kw); } } while (idx >= 0); - ::com::sun::star::uno::Sequence< ::rtl::OUString > kws(vec.size()); + uno::Sequence< ::rtl::OUString > kws(vec.size()); std::copy(vec.begin(), vec.end(), stl_begin(kws)); return kws; } + +sal_Int32 compareNatural( const ::rtl::OUString & rLHS, const ::rtl::OUString & rRHS, + const uno::Reference< i18n::XCollator > &rCollator, + const uno::Reference< i18n::XBreakIterator > &rBI, + const lang::Locale &rLocale ) +{ + sal_Int32 nRet = 0; + + sal_Int32 nLHSLastNonDigitPos = 0; + sal_Int32 nRHSLastNonDigitPos = 0; + sal_Int32 nLHSFirstDigitPos = 0; + sal_Int32 nRHSFirstDigitPos = 0; + + while (nLHSFirstDigitPos < rLHS.getLength() || nRHSFirstDigitPos < rRHS.getLength()) + { + sal_Int32 nLHSChunkLen; + sal_Int32 nRHSChunkLen; + + //Compare non digit block as normal strings + nLHSFirstDigitPos = rBI->nextCharBlock(rLHS, nLHSLastNonDigitPos, + rLocale, i18n::CharType::DECIMAL_DIGIT_NUMBER); + nRHSFirstDigitPos = rBI->nextCharBlock(rRHS, nRHSLastNonDigitPos, + rLocale, i18n::CharType::DECIMAL_DIGIT_NUMBER); + if (nLHSFirstDigitPos == -1) + nLHSFirstDigitPos = rLHS.getLength(); + if (nRHSFirstDigitPos == -1) + nRHSFirstDigitPos = rRHS.getLength(); + nLHSChunkLen = nLHSFirstDigitPos - nLHSLastNonDigitPos; + nRHSChunkLen = nRHSFirstDigitPos - nRHSLastNonDigitPos; + + nRet = rCollator->compareSubstring(rLHS, nLHSLastNonDigitPos, + nLHSChunkLen, rRHS, nRHSLastNonDigitPos, nRHSChunkLen); + if (nRet != 0) + break; + + //Compare digit block as one number vs another + nLHSLastNonDigitPos = rBI->endOfCharBlock(rLHS, nLHSFirstDigitPos, + rLocale, i18n::CharType::DECIMAL_DIGIT_NUMBER); + nRHSLastNonDigitPos = rBI->endOfCharBlock(rRHS, nRHSFirstDigitPos, + rLocale, i18n::CharType::DECIMAL_DIGIT_NUMBER); + if (nLHSLastNonDigitPos == -1) + nLHSLastNonDigitPos = rLHS.getLength(); + if (nRHSLastNonDigitPos == -1) + nRHSLastNonDigitPos = rRHS.getLength(); + nLHSChunkLen = nLHSLastNonDigitPos - nLHSFirstDigitPos; + nRHSChunkLen = nRHSLastNonDigitPos - nRHSFirstDigitPos; + + //To-Do: Possibly scale down those unicode codepoints that relate to + //numbers outside of the normal 0-9 range, e.g. see GetLocalizedChar in + //vcl + + sal_uInt32 nLHS = comphelper::string::decimalStringToNumber(rLHS.copy(nLHSFirstDigitPos, nLHSChunkLen)); + sal_uInt32 nRHS = comphelper::string::decimalStringToNumber(rRHS.copy(nRHSFirstDigitPos, nRHSChunkLen)); + + nRet = nLHS-nRHS; + if (nRet != 0) + break; + } + + //Squeeze these down to -1, 0, 1 in case it gets casted to a StringCompare + if (nRet > 0) + nRet = 1; + else if (nRet < 0) + nRet = -1; + + return nRet; +} + +NaturalStringSorter::NaturalStringSorter( + const uno::Reference< uno::XComponentContext > &rContext, + const lang::Locale &rLocale) : m_aLocale(rLocale) +{ + uno::Reference< lang::XMultiComponentFactory > xFactory(rContext->getServiceManager(), + uno::UNO_SET_THROW); + + m_xCollator = uno::Reference< i18n::XCollator >(xFactory->createInstanceWithContext( + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.i18n.Collator")), rContext), + uno::UNO_QUERY_THROW); + m_xCollator->loadDefaultCollator(m_aLocale, 0); + m_xBI = uno::Reference< i18n::XBreakIterator >(xFactory->createInstanceWithContext( + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.i18n.BreakIterator")), rContext), + uno::UNO_QUERY_THROW); +} + } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/misc/synchronousdispatch.cxx b/comphelper/source/misc/synchronousdispatch.cxx index 3c55556973f3..ca4d4b36f72a 100644 --- a/comphelper/source/misc/synchronousdispatch.cxx +++ b/comphelper/source/misc/synchronousdispatch.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -89,7 +90,7 @@ uno::Reference< lang::XComponent > SynchronousDispatch::dispatch( catch ( uno::Exception& ) { rtl::OUString aMsg = UNISTRING( "SynchronousDispatch::dispatch() Error while dispatching! "); - OSL_ENSURE( sal_False, OUStringToOString(aMsg, RTL_TEXTENCODING_ASCII_US).getStr()); + OSL_FAIL( OUStringToOString(aMsg, RTL_TEXTENCODING_ASCII_US).getStr()); } } @@ -100,3 +101,4 @@ uno::Reference< lang::XComponent > SynchronousDispatch::dispatch( } // namespace comphelper //......................................................................... +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/misc/types.cxx b/comphelper/source/misc/types.cxx index 31719eec881a..629e890ae62a 100644 --- a/comphelper/source/misc/types.cxx +++ b/comphelper/source/misc/types.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -127,7 +128,7 @@ sal_Bool getBOOL(const Any& _rAny) if (_rAny.getValueType() == ::getCppuBooleanType()) nReturn = *(sal_Bool*)_rAny.getValue(); else - OSL_ENSURE(sal_False, "comphelper::getBOOL : invalid argument !"); + OSL_FAIL("comphelper::getBOOL : invalid argument !"); return nReturn; } @@ -475,3 +476,4 @@ Type getSequenceElementType(const Type& _rSequenceType) } // namespace comphelper //......................................................................... +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/misc/uieventslogger.cxx b/comphelper/source/misc/uieventslogger.cxx index 738a5ec6a8d3..0491d9991271 100644 --- a/comphelper/source/misc/uieventslogger.cxx +++ b/comphelper/source/misc/uieventslogger.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -28,7 +29,6 @@ #include "precompiled_comphelper.hxx" #include <comphelper/uieventslogger.hxx> -#include <boost/shared_ptr.hpp> #include <com/sun/star/frame/XDesktop.hpp> #include <com/sun/star/frame/XTerminateListener.hpp> #include <com/sun/star/lang/XEventListener.hpp> @@ -49,6 +49,7 @@ #include <osl/mutex.hxx> #include <osl/time.h> #include <rtl/ustrbuf.hxx> +#include <rtl/instance.hxx> using namespace com::sun::star::beans; @@ -60,41 +61,42 @@ using namespace com::sun::star::uno; using namespace com::sun::star::util; using namespace cppu; using namespace osl; -using namespace rtl; using namespace std; +using ::rtl::OUString; +using ::rtl::OUStringBuffer; namespace { static void lcl_SetupOriginAppAbbr(map<OUString, OUString>& abbrs) { - abbrs[OUString::createFromAscii("com.sun.star.text.TextDocument")] = OUString::createFromAscii("W"); // Writer - abbrs[OUString::createFromAscii("com.sun.star.sheet.SpreadsheetDocument")] = OUString::createFromAscii("C"); // Calc - abbrs[OUString::createFromAscii("com.sun.star.presentation.PresentationDocument")] = OUString::createFromAscii("I"); // Impress - abbrs[OUString::createFromAscii("com.sun.star.drawing.DrawingDocument")] = OUString::createFromAscii("D"); // Draw + abbrs[OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextDocument"))] = OUString(sal_Unicode('W')); // Writer + abbrs[OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sheet.SpreadsheetDocument"))] = OUString(sal_Unicode('C')); // Calc + abbrs[OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.PresentationDocument"))] = OUString(sal_Unicode('I')); // Impress + abbrs[OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.DrawingDocument"))] = OUString(sal_Unicode('D')); // Draw }; static void lcl_SetupOriginWidgetAbbr(map<OUString,OUString>& abbrs) { - abbrs[OUString::createFromAscii("ButtonToolbarController")] = OUString::createFromAscii("0"); - abbrs[OUString::createFromAscii("ComplexToolbarController")] = OUString::createFromAscii("1"); - abbrs[OUString::createFromAscii("ControlMenuController")] = OUString::createFromAscii("2"); - abbrs[OUString::createFromAscii("FontMenuController")] = OUString::createFromAscii("3"); - abbrs[OUString::createFromAscii("FontSizeMenuController")] = OUString::createFromAscii("4"); - abbrs[OUString::createFromAscii("FooterMenuController")] = OUString::createFromAscii("5"); - abbrs[OUString::createFromAscii("GenericToolbarController")] = OUString::createFromAscii("6"); - abbrs[OUString::createFromAscii("HeaderMenuController")] = OUString::createFromAscii("7"); - abbrs[OUString::createFromAscii("LanguageSelectionMenuController")] = OUString::createFromAscii("8"); - abbrs[OUString::createFromAscii("LangSelectionStatusbarController")] = OUString::createFromAscii("9"); - abbrs[OUString::createFromAscii("MacrosMenuController")] = OUString::createFromAscii("10"); - abbrs[OUString::createFromAscii("MenuBarManager")] = OUString::createFromAscii("11"); - abbrs[OUString::createFromAscii("NewMenuController")] = OUString::createFromAscii("12"); - abbrs[OUString::createFromAscii("ObjectMenuController")] = OUString::createFromAscii("13"); - abbrs[OUString::createFromAscii("RecentFilesMenuController")] = OUString::createFromAscii("14"); - abbrs[OUString::createFromAscii("ToolbarsMenuController")] = OUString::createFromAscii("15"); - abbrs[OUString::createFromAscii("SfxToolBoxControl")] = OUString::createFromAscii("16"); - abbrs[OUString::createFromAscii("SfxAsyncExec")] = OUString::createFromAscii("17"); - abbrs[OUString::createFromAscii("AcceleratorExecute")] = OUString::createFromAscii("18"); + abbrs[OUString(RTL_CONSTASCII_USTRINGPARAM("ButtonToolbarController"))] = OUString(sal_Unicode('0')); + abbrs[OUString(RTL_CONSTASCII_USTRINGPARAM("ComplexToolbarController"))] = OUString(sal_Unicode('1')); + abbrs[OUString(RTL_CONSTASCII_USTRINGPARAM("ControlMenuController"))] = OUString(sal_Unicode('2')); + abbrs[OUString(RTL_CONSTASCII_USTRINGPARAM("FontMenuController"))] = OUString(sal_Unicode('3')); + abbrs[OUString(RTL_CONSTASCII_USTRINGPARAM("FontSizeMenuController"))] = OUString(sal_Unicode('4')); + abbrs[OUString(RTL_CONSTASCII_USTRINGPARAM("FooterMenuController"))] = OUString(sal_Unicode('5')); + abbrs[OUString(RTL_CONSTASCII_USTRINGPARAM("GenericToolbarController"))] = OUString(sal_Unicode('6')); + abbrs[OUString(RTL_CONSTASCII_USTRINGPARAM("HeaderMenuController"))] = OUString(sal_Unicode('7')); + abbrs[OUString(RTL_CONSTASCII_USTRINGPARAM("LanguageSelectionMenuController"))] = OUString(sal_Unicode('8')); + abbrs[OUString(RTL_CONSTASCII_USTRINGPARAM("LangSelectionStatusbarController"))] = OUString(sal_Unicode('9')); + abbrs[OUString(RTL_CONSTASCII_USTRINGPARAM("MacrosMenuController"))] = OUString(RTL_CONSTASCII_USTRINGPARAM("10")); + abbrs[OUString(RTL_CONSTASCII_USTRINGPARAM("MenuBarManager"))] = OUString(RTL_CONSTASCII_USTRINGPARAM("11")); + abbrs[OUString(RTL_CONSTASCII_USTRINGPARAM("NewMenuController"))] = OUString(RTL_CONSTASCII_USTRINGPARAM("12")); + abbrs[OUString(RTL_CONSTASCII_USTRINGPARAM("ObjectMenuController"))] = OUString(RTL_CONSTASCII_USTRINGPARAM("13")); + abbrs[OUString(RTL_CONSTASCII_USTRINGPARAM("RecentFilesMenuController"))] = OUString(RTL_CONSTASCII_USTRINGPARAM("14")); + abbrs[OUString(RTL_CONSTASCII_USTRINGPARAM("ToolbarsMenuController"))] = OUString(RTL_CONSTASCII_USTRINGPARAM("15")); + abbrs[OUString(RTL_CONSTASCII_USTRINGPARAM("SfxToolBoxControl"))] = OUString(RTL_CONSTASCII_USTRINGPARAM("16")); + abbrs[OUString(RTL_CONSTASCII_USTRINGPARAM("SfxAsyncExec"))] = OUString(RTL_CONSTASCII_USTRINGPARAM("17")); + abbrs[OUString(RTL_CONSTASCII_USTRINGPARAM("AcceleratorExecute"))] = OUString(RTL_CONSTASCII_USTRINGPARAM("18")); }; } @@ -142,7 +144,6 @@ namespace comphelper // static methods and data static ptr getInstance(); - static void prepareMutex(); static bool shouldActivate(); static bool getEnabledFromCoreController(); static bool getEnabledFromCfg(); @@ -151,7 +152,6 @@ namespace comphelper static sal_Int32 findIdx(const Sequence<PropertyValue>& args, const OUString& key); static ptr instance; - static Mutex * singleton_mutex; static const sal_Int32 COLUMNS; static const OUString CFG_ENABLED; static const OUString CFG_IDLETIMEOUT; @@ -184,35 +184,39 @@ namespace comphelper { // consts const sal_Int32 UiEventsLogger_Impl::COLUMNS = 9; - const OUString UiEventsLogger_Impl::CFG_ENABLED = OUString::createFromAscii("EnablingAllowed"); - const OUString UiEventsLogger_Impl::CFG_IDLETIMEOUT = OUString::createFromAscii("IdleTimeout"); - const OUString UiEventsLogger_Impl::CFG_LOGGING = OUString::createFromAscii("/org.openoffice.Office.Logging"); - const OUString UiEventsLogger_Impl::CFG_LOGPATH = OUString::createFromAscii("LogPath"); - const OUString UiEventsLogger_Impl::CFG_OOOIMPROVEMENT = OUString::createFromAscii("OOoImprovement"); - - const OUString UiEventsLogger_Impl::CSSL_CSVFORMATTER = OUString::createFromAscii("com.sun.star.logging.CsvFormatter"); - const OUString UiEventsLogger_Impl::CSSL_FILEHANDLER = OUString::createFromAscii("com.sun.star.logging.FileHandler"); - const OUString UiEventsLogger_Impl::CSSL_LOGGERPOOL = OUString::createFromAscii("com.sun.star.logging.LoggerPool"); - const OUString UiEventsLogger_Impl::CSSO_CORECONTROLLER = OUString::createFromAscii("com.sun.star.oooimprovement.CoreController"); - const OUString UiEventsLogger_Impl::CSSU_PATHSUB = OUString::createFromAscii("com.sun.star.util.PathSubstitution"); - - const OUString UiEventsLogger_Impl::ETYPE_DISPATCH = OUString::createFromAscii("dispatch"); - const OUString UiEventsLogger_Impl::ETYPE_ROTATED = OUString::createFromAscii("rotated"); - const OUString UiEventsLogger_Impl::ETYPE_VCL = OUString::createFromAscii("vcl"); - - const OUString UiEventsLogger_Impl::LOGGERNAME = OUString::createFromAscii("org.openoffice.oooimprovement.Core.UiEventsLogger"); - const OUString UiEventsLogger_Impl::LOGORIGINWIDGET = OUString::createFromAscii("comphelper.UiEventsLogger.LogOriginWidget"); - const OUString UiEventsLogger_Impl::LOGORIGINAPP = OUString::createFromAscii("comphelper.UiEventsLogger.LogOriginApp"); - - const OUString UiEventsLogger_Impl::UNKNOWN_ORIGIN = OUString::createFromAscii("unknown origin"); - const OUString UiEventsLogger_Impl::FN_CURRENTLOG = OUString::createFromAscii("Current"); - const OUString UiEventsLogger_Impl::FN_ROTATEDLOG = OUString::createFromAscii("OOoImprove"); - const OUString UiEventsLogger_Impl::LOGROTATE_EVENTNAME = OUString::createFromAscii("onOOoImprovementLogRotated"); - - const OUString UiEventsLogger_Impl::URL_UNO = OUString::createFromAscii(".uno:"); - const OUString UiEventsLogger_Impl::URL_SPECIAL = OUString::createFromAscii(".special:"); - const OUString UiEventsLogger_Impl::URL_FILE = OUString::createFromAscii("file:"); - + const OUString UiEventsLogger_Impl::CFG_ENABLED(RTL_CONSTASCII_USTRINGPARAM("EnablingAllowed")); + const OUString UiEventsLogger_Impl::CFG_IDLETIMEOUT(RTL_CONSTASCII_USTRINGPARAM("IdleTimeout")); + const OUString UiEventsLogger_Impl::CFG_LOGGING(RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.Office.Logging")); + const OUString UiEventsLogger_Impl::CFG_LOGPATH(RTL_CONSTASCII_USTRINGPARAM("LogPath")); + const OUString UiEventsLogger_Impl::CFG_OOOIMPROVEMENT(RTL_CONSTASCII_USTRINGPARAM("OOoImprovement")); + + const OUString UiEventsLogger_Impl::CSSL_CSVFORMATTER(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.logging.CsvFormatter")); + const OUString UiEventsLogger_Impl::CSSL_FILEHANDLER(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.logging.FileHandler")); + const OUString UiEventsLogger_Impl::CSSL_LOGGERPOOL(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.logging.LoggerPool")); + const OUString UiEventsLogger_Impl::CSSO_CORECONTROLLER(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.oooimprovement.CoreController")); + const OUString UiEventsLogger_Impl::CSSU_PATHSUB(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.util.PathSubstitution")); + + const OUString UiEventsLogger_Impl::ETYPE_DISPATCH(RTL_CONSTASCII_USTRINGPARAM("dispatch")); + const OUString UiEventsLogger_Impl::ETYPE_ROTATED(RTL_CONSTASCII_USTRINGPARAM("rotated")); + const OUString UiEventsLogger_Impl::ETYPE_VCL(RTL_CONSTASCII_USTRINGPARAM("vcl")); + + const OUString UiEventsLogger_Impl::LOGGERNAME(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.oooimprovement.Core.UiEventsLogger")); + const OUString UiEventsLogger_Impl::LOGORIGINWIDGET(RTL_CONSTASCII_USTRINGPARAM("comphelper.UiEventsLogger.LogOriginWidget")); + const OUString UiEventsLogger_Impl::LOGORIGINAPP(RTL_CONSTASCII_USTRINGPARAM("comphelper.UiEventsLogger.LogOriginApp")); + + const OUString UiEventsLogger_Impl::UNKNOWN_ORIGIN(RTL_CONSTASCII_USTRINGPARAM("unknown origin")); + const OUString UiEventsLogger_Impl::FN_CURRENTLOG(RTL_CONSTASCII_USTRINGPARAM("Current")); + const OUString UiEventsLogger_Impl::FN_ROTATEDLOG(RTL_CONSTASCII_USTRINGPARAM("OOoImprove")); + const OUString UiEventsLogger_Impl::LOGROTATE_EVENTNAME(RTL_CONSTASCII_USTRINGPARAM("onOOoImprovementLogRotated")); + + const OUString UiEventsLogger_Impl::URL_UNO(RTL_CONSTASCII_USTRINGPARAM(".uno:")); + const OUString UiEventsLogger_Impl::URL_SPECIAL(RTL_CONSTASCII_USTRINGPARAM(".special:")); + const OUString UiEventsLogger_Impl::URL_FILE(RTL_CONSTASCII_USTRINGPARAM("file:")); + + namespace + { + struct theSingletonMutex : public rtl::Static< Mutex, theSingletonMutex > {}; + } // public UiEventsLogger interface sal_Bool UiEventsLogger::isEnabled() @@ -220,8 +224,7 @@ namespace comphelper if ( UiEventsLogger_Impl::getEnabledFromCfg() ) { try { - UiEventsLogger_Impl::prepareMutex(); - Guard<Mutex> singleton_guard(UiEventsLogger_Impl::singleton_mutex); + Guard<Mutex> singleton_guard(theSingletonMutex::get()); return UiEventsLogger_Impl::getInstance()->m_Active; } catch(...) { return false; } // never throws } // if ( ) @@ -231,8 +234,7 @@ namespace comphelper sal_Int32 UiEventsLogger::getSessionLogEventCount() { try { - UiEventsLogger_Impl::prepareMutex(); - Guard<Mutex> singleton_guard(UiEventsLogger_Impl::singleton_mutex); + Guard<Mutex> singleton_guard(theSingletonMutex::get()); return UiEventsLogger_Impl::getInstance()->m_SessionLogEventCount; } catch(...) { return 0; } // never throws } @@ -268,8 +270,7 @@ namespace comphelper const Sequence<PropertyValue>& args) { try { - UiEventsLogger_Impl::prepareMutex(); - Guard<Mutex> singleton_guard(UiEventsLogger_Impl::singleton_mutex); + Guard<Mutex> singleton_guard(theSingletonMutex::get()); UiEventsLogger_Impl::getInstance()->logDispatch(url, args); } catch(...) { } // never throws } @@ -282,8 +283,7 @@ namespace comphelper const OUString& param) { try { - UiEventsLogger_Impl::prepareMutex(); - Guard<Mutex> singleton_guard(UiEventsLogger_Impl::singleton_mutex); + Guard<Mutex> singleton_guard(theSingletonMutex::get()); UiEventsLogger_Impl::getInstance()->logVcl(parent_id, window_type, id, method, param); } catch(...) { } // never throws } @@ -312,16 +312,14 @@ namespace comphelper void UiEventsLogger::disposing() { // we dont want to create an instance just to dispose it - UiEventsLogger_Impl::prepareMutex(); - Guard<Mutex> singleton_guard(UiEventsLogger_Impl::singleton_mutex); + Guard<Mutex> singleton_guard(theSingletonMutex::get()); if(UiEventsLogger_Impl::instance!=UiEventsLogger_Impl::ptr()) UiEventsLogger_Impl::getInstance()->disposing(); } void UiEventsLogger::reinit() { - UiEventsLogger_Impl::prepareMutex(); - Guard<Mutex> singleton_guard(UiEventsLogger_Impl::singleton_mutex); + Guard<Mutex> singleton_guard(theSingletonMutex::get()); if(UiEventsLogger_Impl::instance) { UiEventsLogger_Impl::instance->disposing(); @@ -538,10 +536,10 @@ namespace comphelper // It will call disposing and make sure we clear all our references { Reference<XTerminateListener> xCore( - sm->createInstance(OUString::createFromAscii("com.sun.star.oooimprovement.Core")), + sm->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.oooimprovement.Core"))), UNO_QUERY); Reference<XDesktop> xDesktop( - sm->createInstance(OUString::createFromAscii("com.sun.star.frame.Desktop")), + sm->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop"))), UNO_QUERY); if(!(xCore.is() && xDesktop.is())) { @@ -574,15 +572,15 @@ namespace comphelper if(m_Formatter.is() && m_LogHandler.is() && m_Logger.is()) { Sequence<OUString> columns = Sequence<OUString>(COLUMNS); - columns[0] = OUString::createFromAscii("eventtype"); - columns[1] = OUString::createFromAscii("originapp"); - columns[2] = OUString::createFromAscii("originwidget"); - columns[3] = OUString::createFromAscii("uno url"); - columns[4] = OUString::createFromAscii("parent id"); - columns[5] = OUString::createFromAscii("window type"); - columns[6] = OUString::createFromAscii("id"); - columns[7] = OUString::createFromAscii("method"); - columns[8] = OUString::createFromAscii("parameter"); + columns[0] = OUString(RTL_CONSTASCII_USTRINGPARAM("eventtype")); + columns[1] = OUString(RTL_CONSTASCII_USTRINGPARAM("originapp")); + columns[2] = OUString(RTL_CONSTASCII_USTRINGPARAM("originwidget")); + columns[3] = OUString(RTL_CONSTASCII_USTRINGPARAM("uno url")); + columns[4] = OUString(RTL_CONSTASCII_USTRINGPARAM("parent id")); + columns[5] = OUString(RTL_CONSTASCII_USTRINGPARAM("window type")); + columns[6] = OUString(RTL_CONSTASCII_USTRINGPARAM("id")); + columns[7] = OUString(RTL_CONSTASCII_USTRINGPARAM("method")); + columns[8] = OUString(RTL_CONSTASCII_USTRINGPARAM("parameter")); m_Formatter->setColumnnames(columns); m_LogHandler->setFormatter(Reference<XLogFormatter>(m_Formatter, UNO_QUERY)); m_Logger->setLevel(LogLevel::ALL); @@ -650,7 +648,7 @@ namespace comphelper { Reference<XMultiServiceFactory> sm = getProcessServiceFactory(); Reference<XCoreController> core_c( - sm->createInstance(OUString::createFromAscii("com.sun.star.oooimprovement.CoreController")), + sm->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.oooimprovement.CoreController"))), UNO_QUERY); if(!core_c.is()) return false; return core_c->enablingUiEventsLoggerAllowed(1); @@ -664,17 +662,6 @@ namespace comphelper return instance; } - Mutex * UiEventsLogger_Impl::singleton_mutex = NULL; - void UiEventsLogger_Impl::prepareMutex() - { - if(singleton_mutex == NULL) - { - Guard<Mutex> global_guard(Mutex::getGlobalMutex()); - if(singleton_mutex == NULL) - singleton_mutex = new Mutex(); - } - } - sal_Int32 UiEventsLogger_Impl::findIdx(const Sequence<PropertyValue>& args, const OUString& key) { for(sal_Int32 i=0; i<args.getLength(); i++) @@ -691,3 +678,5 @@ namespace comphelper m_Formatter.clear(); } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/misc/weak.cxx b/comphelper/source/misc/weak.cxx index e84e069f0e38..247554495815 100644 --- a/comphelper/source/misc/weak.cxx +++ b/comphelper/source/misc/weak.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -74,3 +75,4 @@ Sequence< ::sal_Int8 > SAL_CALL OWeakTypeObject::getImplementationId( ) throw ( } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/misc/weakeventlistener.cxx b/comphelper/source/misc/weakeventlistener.cxx index 0a96698e7b92..333727e47a45 100644 --- a/comphelper/source/misc/weakeventlistener.cxx +++ b/comphelper/source/misc/weakeventlistener.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -91,3 +92,4 @@ namespace comphelper //......................................................................... +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |