diff options
author | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2011-06-19 12:47:44 +0200 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2011-06-19 12:47:44 +0200 |
commit | 941020379b1ea1ec7c564c21e68ea1674cda7683 (patch) | |
tree | 40fcaf109d6d585bcdc0faf7ea6c0812b3cc9a39 /comphelper | |
parent | fixing rebase errors (diff) | |
parent | enable exceptions here (diff) | |
download | core-941020379b1ea1ec7c564c21e68ea1674cda7683.tar.gz core-941020379b1ea1ec7c564c21e68ea1674cda7683.zip |
Merge branch 'master' into feature/gnumake4
Conflicts:
basebmp/prj/d.lst
basebmp/test/basictest.cxx
basebmp/test/makefile.mk
basegfx/inc/basegfx/basegfxdllapi.h
basegfx/inc/basegfx/tools/debugplotter.hxx
basegfx/inc/basegfx/tuple/b2ituple.hxx
basegfx/prj/d.lst
basegfx/source/numeric/makefile.mk
basegfx/source/polygon/makefile.mk
basegfx/source/range/makefile.mk
basegfx/source/raster/makefile.mk
basegfx/source/tuple/makefile.mk
basegfx/source/vector/makefile.mk
basegfx/test/basegfx1d.cxx
basegfx/test/makefile.mk
basegfx/util/makefile.mk
canvas/Library_canvasfactory.mk
canvas/Module_canvas.mk
canvas/prj/build.lst
canvas/prj/d.lst
canvas/source/cairo/cairo_canvashelper_texturefill.cxx
canvas/source/cairo/makefile.mk
canvas/source/tools/makefile.mk
comphelper/qa/string/makefile.mk
cppcanvas/Module_cppcanvas.mk
cppcanvas/inc/cppcanvas/cppcanvasdllapi.h
cppcanvas/prj/build.lst
cppcanvas/prj/d.lst
cppcanvas/source/mtfrenderer/makefile.mk
cppcanvas/util/makefile.mk
i18npool/source/search/makefile.mk
regexp/Library_regexp.mk
regexp/prj/d.lst
sax/CppunitTest_sax.mk
sax/Library_sax.mk
sax/prj/d.lst
sax/qa/cppunit/test_converter.cxx
sax/source/expatwrap/attrlistimpl.hxx
sax/util/makefile.mk
svtools/Library_svt.mk
tools/Executable_sspretty.mk
ucbhelper/prj/d.lst
ucbhelper/source/provider/configureucb.cxx
ucbhelper/source/provider/provconf.cxx
ucbhelper/util/makefile.mk
unotools/Library_utl.mk
unotools/Module_unotools.mk
unotools/Package_inc.mk
unotools/prj/build.lst
vcl/Library_desktop_detector.mk
vcl/Library_vcl.mk
vcl/Library_vclplug_gtk.mk
vcl/aqua/source/gdi/salprn.cxx
vcl/inc/aqua/saldata.hxx
vcl/unx/generic/gdi/salgdi3.cxx
Diffstat (limited to 'comphelper')
226 files changed, 2102 insertions, 1662 deletions
diff --git a/comphelper/Library_comphelp.mk b/comphelper/Library_comphelp.mk index c50153b4f015..d00078860cc4 100644 --- a/comphelper/Library_comphelp.mk +++ b/comphelper/Library_comphelp.mk @@ -34,8 +34,8 @@ $(eval $(call gb_Library_add_precompiled_header,comphelper,$(SRCDIR)/comphelper/ $(eval $(call gb_Library_set_componentfile,comphelper,comphelper/util/comphelp)) $(eval $(call gb_Library_set_include,comphelper,\ - -I$(SRCDIR)/comphelper/inc/pch \ - -I$(SRCDIR)/comphelper/source/inc \ + -I$(realpath $(SRCDIR)/comphelper/inc/pch) \ + -I$(realpath $(SRCDIR)/comphelper/source/inc) \ $$(INCLUDE) \ -I$(OUTDIR)/inc/offuh \ )) @@ -49,8 +49,6 @@ $(eval $(call gb_Library_add_linked_libs,comphelper,\ cppuhelper \ cppu \ ucbhelper \ - vos3 \ - stl \ $(gb_STDLIBS) \ )) @@ -91,7 +89,6 @@ $(eval $(call gb_Library_add_exception_objects,comphelper,\ comphelper/source/misc/ihwrapnofilter \ comphelper/source/misc/instancelocker \ comphelper/source/misc/interaction \ - comphelper/source/misc/legacysingletonfactory \ comphelper/source/misc/listenernotification \ comphelper/source/misc/locale \ comphelper/source/misc/logging \ diff --git a/comphelper/Package_inc.mk b/comphelper/Package_inc.mk index 5794c56ab74d..a02bde6b7475 100644 --- a/comphelper/Package_inc.mk +++ b/comphelper/Package_inc.mk @@ -38,6 +38,7 @@ $(eval $(call gb_Package_add_file,comphelper_inc,inc/comphelper/stillreadwritein $(eval $(call gb_Package_add_file,comphelper_inc,inc/comphelper/anycompare.hxx,comphelper/anycompare.hxx)) $(eval $(call gb_Package_add_file,comphelper_inc,inc/comphelper/propagg.hxx,comphelper/propagg.hxx)) $(eval $(call gb_Package_add_file,comphelper_inc,inc/comphelper/scopeguard.hxx,comphelper/scopeguard.hxx)) +$(eval $(call gb_Package_add_file,comphelper_inc,inc/comphelper/scoped_disposing_ptr.hxx,comphelper/scoped_disposing_ptr.hxx)) $(eval $(call gb_Package_add_file,comphelper_inc,inc/comphelper/asyncnotification.hxx,comphelper/asyncnotification.hxx)) $(eval $(call gb_Package_add_file,comphelper_inc,inc/comphelper/namedvaluecollection.hxx,comphelper/namedvaluecollection.hxx)) $(eval $(call gb_Package_add_file,comphelper_inc,inc/comphelper/composedprops.hxx,comphelper/composedprops.hxx)) @@ -89,7 +90,6 @@ $(eval $(call gb_Package_add_file,comphelper_inc,inc/comphelper/ChainablePropert $(eval $(call gb_Package_add_file,comphelper_inc,inc/comphelper/stl_types.hxx,comphelper/stl_types.hxx)) $(eval $(call gb_Package_add_file,comphelper_inc,inc/comphelper/eventattachermgr.hxx,comphelper/eventattachermgr.hxx)) $(eval $(call gb_Package_add_file,comphelper_inc,inc/comphelper/componentcontext.hxx,comphelper/componentcontext.hxx)) -$(eval $(call gb_Package_add_file,comphelper_inc,inc/comphelper/legacysingletonfactory.hxx,comphelper/legacysingletonfactory.hxx)) $(eval $(call gb_Package_add_file,comphelper_inc,inc/comphelper/accessibleeventnotifier.hxx,comphelper/accessibleeventnotifier.hxx)) $(eval $(call gb_Package_add_file,comphelper_inc,inc/comphelper/ihwrapnofilter.hxx,comphelper/ihwrapnofilter.hxx)) $(eval $(call gb_Package_add_file,comphelper_inc,inc/comphelper/sequenceasvector.hxx,comphelper/sequenceasvector.hxx)) diff --git a/comphelper/inc/comphelper/ChainablePropertySet.hxx b/comphelper/inc/comphelper/ChainablePropertySet.hxx index 0d36c2d10144..1b11005a42c2 100644 --- a/comphelper/inc/comphelper/ChainablePropertySet.hxx +++ b/comphelper/inc/comphelper/ChainablePropertySet.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. @@ -38,10 +39,7 @@ namespace comphelper { class ChainablePropertySetInfo; } -namespace vos -{ - class IMutex; -} + /* * A ChainablePropertySet has the following features: * @@ -76,7 +74,7 @@ namespace comphelper friend class MasterPropertySet; protected: ChainablePropertySetInfo *mpInfo; - vos::IMutex *mpMutex; + osl::SolarMutex* mpMutex; ::com::sun::star::uno::Reference < com::sun::star::beans::XPropertySetInfo > mxInfo; void lockMutex(); void unlockMutex(); @@ -108,7 +106,7 @@ namespace comphelper throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException ); public: - ChainablePropertySet( comphelper::ChainablePropertySetInfo* pInfo, vos::IMutex *pMutex = NULL ) + ChainablePropertySet( comphelper::ChainablePropertySetInfo* pInfo, osl::SolarMutex* pMutex = NULL ) throw(); virtual ~ChainablePropertySet() throw(); @@ -154,3 +152,4 @@ namespace comphelper } #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/ChainablePropertySetInfo.hxx b/comphelper/inc/comphelper/ChainablePropertySetInfo.hxx index 76d181e21e7b..c7e1e88f260e 100644 --- a/comphelper/inc/comphelper/ChainablePropertySetInfo.hxx +++ b/comphelper/inc/comphelper/ChainablePropertySetInfo.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. @@ -75,3 +76,5 @@ namespace comphelper }; } #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/IdPropArrayHelper.hxx b/comphelper/inc/comphelper/IdPropArrayHelper.hxx index 187c52fdc446..a624ba7b2f5a 100644 --- a/comphelper/inc/comphelper/IdPropArrayHelper.hxx +++ b/comphelper/inc/comphelper/IdPropArrayHelper.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. @@ -121,3 +122,5 @@ namespace comphelper } } #endif // COMPHELPER_IDPROPERTYARRAYUSAGEHELPER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/InlineContainer.hxx b/comphelper/inc/comphelper/InlineContainer.hxx index a5d80e263aac..13ae8a5cabd0 100644 --- a/comphelper/inc/comphelper/InlineContainer.hxx +++ b/comphelper/inc/comphelper/InlineContainer.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. @@ -147,3 +148,5 @@ public: #endif // INCLUDED_COMPHELPER_INLINE_CONTAINER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/MasterPropertySet.hxx b/comphelper/inc/comphelper/MasterPropertySet.hxx index 170b4f72db3b..c5e335d6cf67 100644 --- a/comphelper/inc/comphelper/MasterPropertySet.hxx +++ b/comphelper/inc/comphelper/MasterPropertySet.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. @@ -33,10 +34,7 @@ #include <comphelper/PropertyInfoHash.hxx> #include "comphelper/comphelperdllapi.h" #include <map> -namespace vos -{ - class IMutex; -} + namespace comphelper { class MasterPropertySetInfo; @@ -71,7 +69,7 @@ namespace comphelper { protected: MasterPropertySetInfo *mpInfo; - vos::IMutex *mpMutex; + osl::SolarMutex* mpMutex; sal_uInt8 mnLastId; SlaveMap maSlaveMap; ::com::sun::star::uno::Reference < com::sun::star::beans::XPropertySetInfo > mxInfo; @@ -105,7 +103,7 @@ namespace comphelper throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException ); public: - MasterPropertySet( comphelper::MasterPropertySetInfo* pInfo, ::vos::IMutex *pMutex = NULL ) + MasterPropertySet( comphelper::MasterPropertySetInfo* pInfo, ::osl::SolarMutex* pMutex = NULL ) throw(); virtual ~MasterPropertySet() throw(); @@ -153,3 +151,4 @@ namespace comphelper } #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/MasterPropertySetInfo.hxx b/comphelper/inc/comphelper/MasterPropertySetInfo.hxx index 94a639fca755..c121289622b0 100644 --- a/comphelper/inc/comphelper/MasterPropertySetInfo.hxx +++ b/comphelper/inc/comphelper/MasterPropertySetInfo.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. @@ -67,3 +68,5 @@ namespace comphelper }; } #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/PropertyInfoHash.hxx b/comphelper/inc/comphelper/PropertyInfoHash.hxx index 106f40487f5b..7c75b99335f9 100644 --- a/comphelper/inc/comphelper/PropertyInfoHash.hxx +++ b/comphelper/inc/comphelper/PropertyInfoHash.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. @@ -30,7 +31,7 @@ #include <rtl/ustring.hxx> #include <comphelper/TypeGeneration.hxx> -#include <hash_map> +#include <boost/unordered_map.hpp> namespace comphelper { struct PropertyInfo @@ -60,12 +61,14 @@ namespace comphelper }; } -typedef std::hash_map < ::rtl::OUString, +typedef boost::unordered_map < ::rtl::OUString, ::comphelper::PropertyInfo*, ::rtl::OUStringHash, ::comphelper::eqFunc > PropertyInfoHash; -typedef std::hash_map < ::rtl::OUString, +typedef boost::unordered_map < ::rtl::OUString, ::comphelper::PropertyData*, ::rtl::OUStringHash, ::comphelper::eqFunc > PropertyDataHash; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/SelectionMultiplex.hxx b/comphelper/inc/comphelper/SelectionMultiplex.hxx index 633a86f4fdb8..d2ce6ba79d2c 100644 --- a/comphelper/inc/comphelper/SelectionMultiplex.hxx +++ b/comphelper/inc/comphelper/SelectionMultiplex.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. @@ -115,3 +116,4 @@ namespace comphelper #endif // INCLUDED_COMPHELPER_SELECTION_MULTIPLEX_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/SettingsHelper.hxx b/comphelper/inc/comphelper/SettingsHelper.hxx index fa954009c78e..ed951083df71 100644 --- a/comphelper/inc/comphelper/SettingsHelper.hxx +++ b/comphelper/inc/comphelper/SettingsHelper.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. @@ -31,10 +32,6 @@ #include <com/sun/star/beans/XMultiPropertySet.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <cppuhelper/implbase3.hxx> -namespace vos -{ - class IMutex; -} namespace comphelper { @@ -55,7 +52,7 @@ namespace comphelper public ComphelperBase { public: - SettingsHelperNoState ( ComphelperBaseInfo *pInfo, ::vos::IMutex *pMutex = NULL) + SettingsHelperNoState ( ComphelperBaseInfo *pInfo, ::osl::SolarMutex* pMutex = NULL) : ComphelperBase ( pInfo, pMutex ) {} virtual ~SettingsHelperNoState () throw( ) {} @@ -121,3 +118,5 @@ namespace comphelper } #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/TypeGeneration.hxx b/comphelper/inc/comphelper/TypeGeneration.hxx index 08401cb39944..c987b2adbe50 100644 --- a/comphelper/inc/comphelper/TypeGeneration.hxx +++ b/comphelper/inc/comphelper/TypeGeneration.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. @@ -109,9 +110,8 @@ namespace comphelper CPPUTYPE_OUSTRINGS, //getCppuType( (Sequence<OUString>*)0 ) CPPUTYPE_REFCOMPONENT, //getCppuType( (Reference< lang::XComponent >*)0 ) - // --> OD 2004-08-09 #i28749# + // #i28749# CPPUTYPE_TRANSFORMATIONINHORIL2R, //getCppuType( (drawing::HomogenMatrix3)* ) - // <-- CPPUTYPE_SEQNAMEDVALUE, //getCppuType( (Sequence<beans::NamedValue>*)0 ) CPPUTYPE_REFXGRAPHIC, //getCppuType( Reference< graphic::XGraphic >*)0) CPPUTYPE_TABLEBORDERDISTANCES, //getCppuType( (table::TableBorderDistances*)0 ) @@ -123,3 +123,5 @@ namespace comphelper CppuTypes eType, const com::sun::star::uno::Type*& pType ); } #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/accessiblecomponenthelper.hxx b/comphelper/inc/comphelper/accessiblecomponenthelper.hxx index 68fef8eb1f9e..582d77a99283 100644 --- a/comphelper/inc/comphelper/accessiblecomponenthelper.hxx +++ b/comphelper/inc/comphelper/accessiblecomponenthelper.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. @@ -142,3 +143,4 @@ namespace comphelper #endif // COMPHELPER_ACCESSIBLE_COMPONENT_HELPER_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/accessiblecontexthelper.hxx b/comphelper/inc/comphelper/accessiblecontexthelper.hxx index 32a83ca87219..310be9321a40 100644 --- a/comphelper/inc/comphelper/accessiblecontexthelper.hxx +++ b/comphelper/inc/comphelper/accessiblecontexthelper.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. @@ -374,3 +375,4 @@ namespace comphelper #endif // COMPHELPER_ACCESSIBLE_CONTEXT_HELPER_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/accessibleeventbuffer.hxx b/comphelper/inc/comphelper/accessibleeventbuffer.hxx index 7f1107df50ad..3819651569d7 100644 --- a/comphelper/inc/comphelper/accessibleeventbuffer.hxx +++ b/comphelper/inc/comphelper/accessibleeventbuffer.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,5 @@ private: } #endif // INCLUDED_COMPHELPER_ACCESSIBLEEVENTBUFFER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/accessibleeventnotifier.hxx b/comphelper/inc/comphelper/accessibleeventnotifier.hxx index 7bf5ba76fa0c..c80b8ffccf14 100644 --- a/comphelper/inc/comphelper/accessibleeventnotifier.hxx +++ b/comphelper/inc/comphelper/accessibleeventnotifier.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. @@ -171,3 +172,4 @@ namespace comphelper #endif // COMPHELPER_ACCESSIBLE_EVENT_NOTIFIER +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/accessiblekeybindinghelper.hxx b/comphelper/inc/comphelper/accessiblekeybindinghelper.hxx index 4a7777727290..6ac3373893bc 100644 --- a/comphelper/inc/comphelper/accessiblekeybindinghelper.hxx +++ b/comphelper/inc/comphelper/accessiblekeybindinghelper.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. @@ -81,3 +82,5 @@ namespace comphelper //.............................................................................. #endif // COMPHELPER_ACCESSIBLE_KEYBINDING_HELPER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/accessibleselectionhelper.hxx b/comphelper/inc/comphelper/accessibleselectionhelper.hxx index 12c31b39046c..d91693b81185 100644 --- a/comphelper/inc/comphelper/accessibleselectionhelper.hxx +++ b/comphelper/inc/comphelper/accessibleselectionhelper.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. @@ -29,9 +30,7 @@ #define COMPHELPER_ACCESSIBLE_SELECTION_HELPER_HXX #include <comphelper/uno3.hxx> -#ifndef COMPHELPER_ACCESSIBLE_CONTEXT_HELPER_HXX #include <comphelper/accessiblecomponenthelper.hxx> -#endif #include <cppuhelper/implbase1.hxx> #include <comphelper/uno3.hxx> #include <com/sun/star/accessibility/XAccessibleSelection.hpp> @@ -132,3 +131,4 @@ namespace comphelper #endif // COMPHELPER_ACCESSIBLE_SELECTION_HELPER_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/accessibletexthelper.hxx b/comphelper/inc/comphelper/accessibletexthelper.hxx index 85ad893fd4c4..4456c99b9bd1 100644 --- a/comphelper/inc/comphelper/accessibletexthelper.hxx +++ b/comphelper/inc/comphelper/accessibletexthelper.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. @@ -183,3 +184,5 @@ namespace comphelper // copyText // // ----------------------------------------------------------------------------- + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/accessiblewrapper.hxx b/comphelper/inc/comphelper/accessiblewrapper.hxx index 3157142e990f..d091f9fb458a 100644 --- a/comphelper/inc/comphelper/accessiblewrapper.hxx +++ b/comphelper/inc/comphelper/accessiblewrapper.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. @@ -237,7 +238,7 @@ namespace comphelper //========================================================================= //= OAccessibleContextWrapper //========================================================================= - typedef ::cppu::WeakComponentImplHelper2< ::com::sun::star::accessibility::XAccessibleEventBroadcaster + typedef ::cppu::PartialWeakComponentImplHelper2< ::com::sun::star::accessibility::XAccessibleEventBroadcaster , ::com::sun::star::accessibility::XAccessibleContext > OAccessibleContextWrapper_CBase; @@ -292,16 +293,18 @@ namespace comphelper virtual ::com::sun::star::lang::Locale SAL_CALL getLocale( ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException); // XAccessibleEventBroadcaster - using WeakComponentImplHelperBase::addEventListener; virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); - using WeakComponentImplHelperBase::removeEventListener; virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); // OAccessibleContextWrapper virtual void notifyTranslatedEvent( const ::com::sun::star::accessibility::AccessibleEventObject& _rEvent ) throw (::com::sun::star::uno::RuntimeException); - // XComponent/OComponentProxyAggregationHelper + // XComponent virtual void SAL_CALL dispose() throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL addEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & xListener)throw (::com::sun::star::uno::RuntimeException) + { WeakComponentImplHelperBase::addEventListener(xListener); } + virtual void SAL_CALL removeEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & xListener)throw (::com::sun::star::uno::RuntimeException) + { WeakComponentImplHelperBase::removeEventListener(xListener); } // OComponentHelper using OAccessibleContextWrapperHelper::disposing; @@ -409,3 +412,5 @@ namespace comphelper //............................................................................. #endif // COMPHELPER_ACCESSIBLE_WRAPPER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/accimplaccess.hxx b/comphelper/inc/comphelper/accimplaccess.hxx index 8c0052ceae61..fbbee6fbfde6 100644 --- a/comphelper/inc/comphelper/accimplaccess.hxx +++ b/comphelper/inc/comphelper/accimplaccess.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. @@ -153,7 +154,7 @@ namespace comphelper private: - COMPHELPER_DLLPRIVATE static const ::com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelImplementationId(); + COMPHELPER_DLLPRIVATE static const ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId(); }; //......................................................................... @@ -164,3 +165,4 @@ namespace comphelper #endif // COMPHELPER_ACCIMPLACCESS_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/anycompare.hxx b/comphelper/inc/comphelper/anycompare.hxx index 03f41e108ba9..03f41e108ba9 100755..100644 --- a/comphelper/inc/comphelper/anycompare.hxx +++ b/comphelper/inc/comphelper/anycompare.hxx diff --git a/comphelper/inc/comphelper/anytostring.hxx b/comphelper/inc/comphelper/anytostring.hxx index 92c1685fb440..f1f91b2c6e00 100644 --- a/comphelper/inc/comphelper/anytostring.hxx +++ b/comphelper/inc/comphelper/anytostring.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. @@ -48,3 +49,4 @@ COMPHELPER_DLLPUBLIC ::rtl::OUString anyToString( ::com::sun::star::uno::Any con #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/asyncnotification.hxx b/comphelper/inc/comphelper/asyncnotification.hxx index 22d901728ef7..6f2f1af34dee 100644 --- a/comphelper/inc/comphelper/asyncnotification.hxx +++ b/comphelper/inc/comphelper/asyncnotification.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. @@ -197,3 +198,5 @@ namespace comphelper //........................................................................ #endif // COMPHELPER_ASYNCNOTIFICATION_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/attributelist.hxx b/comphelper/inc/comphelper/attributelist.hxx index f408f6496fb9..d34b32f00ac6 100644 --- a/comphelper/inc/comphelper/attributelist.hxx +++ b/comphelper/inc/comphelper/attributelist.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. @@ -75,3 +76,4 @@ public: #endif // _COMPHELPER_ATTRIBUTE_LIST_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/basicio.hxx b/comphelper/inc/comphelper/basicio.hxx index 13ec58954d7d..7604b1a7029d 100644 --- a/comphelper/inc/comphelper/basicio.hxx +++ b/comphelper/inc/comphelper/basicio.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. @@ -104,3 +105,4 @@ const staruno::Reference<stario::XObjectOutputStream>& operator << (const starun #endif // _COMPHELPER_BASIC_IO_HXX_ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/broadcasthelper.hxx b/comphelper/inc/comphelper/broadcasthelper.hxx index 9e3f4816238c..aa61db5d3ff8 100644 --- a/comphelper/inc/comphelper/broadcasthelper.hxx +++ b/comphelper/inc/comphelper/broadcasthelper.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. @@ -67,3 +68,5 @@ namespace comphelper }; } #endif // _COMPHELPER_BROADCASTHELPER_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/classids.hxx b/comphelper/inc/comphelper/classids.hxx index fddd7c5ad8c1..dcfe50248d20 100644 --- a/comphelper/inc/comphelper/classids.hxx +++ b/comphelper/inc/comphelper/classids.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. @@ -572,3 +573,5 @@ #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/comphelperdllapi.h b/comphelper/inc/comphelper/comphelperdllapi.h index d7bd80d8a16d..32c86f8fd3b7 100644 --- a/comphelper/inc/comphelper/comphelperdllapi.h +++ b/comphelper/inc/comphelper/comphelperdllapi.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #ifndef INCLUDED_COMPHELPERDLLAPI_H #define INCLUDED_COMPHELPERDLLAPI_H @@ -12,3 +13,4 @@ #endif /* INCLUDED_COMPHELPERDLLAPI_H */ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/componentbase.hxx b/comphelper/inc/comphelper/componentbase.hxx index 12d5fdb64355..db3e558904b9 100644 --- a/comphelper/inc/comphelper/componentbase.hxx +++ b/comphelper/inc/comphelper/componentbase.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. * @@ -159,3 +160,5 @@ namespace comphelper //........................................................................ #endif // COMPHELPER_COMPONENTBASE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/componentcontext.hxx b/comphelper/inc/comphelper/componentcontext.hxx index c2f68aab96c0..5b6a901385c3 100644 --- a/comphelper/inc/comphelper/componentcontext.hxx +++ b/comphelper/inc/comphelper/componentcontext.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. @@ -141,7 +142,7 @@ namespace comphelper @throws ::com::sun::star::lang::ServiceNotRegisteredException if the given service is not registered @throws Exception - if an exception occured during creating the component + if an exception occurred during creating the component @return the newly created component. Is never <NULL/>. */ @@ -152,7 +153,7 @@ namespace comphelper @throws ::com::sun::star::lang::ServiceNotRegisteredException if the given service is not registered @throws Exception - if an exception occured during creating the component + if an exception occurred during creating the component @return the newly created component. Is never <NULL/>. */ @@ -166,7 +167,7 @@ namespace comphelper @throws ::com::sun::star::lang::ServiceNotRegisteredException if the given service is not registered @throws Exception - if an exception occured during creating the component + if an exception occurred during creating the component @return the newly created component. Is never <NULL/>. */ @@ -180,7 +181,7 @@ namespace comphelper @throws ::com::sun::star::lang::ServiceNotRegisteredException if the given service is not registered @throws Exception - if an exception occured during creating the component + if an exception occurred during creating the component @return the newly created component. Is never <NULL/>. */ @@ -250,3 +251,4 @@ namespace comphelper #endif // COMPHELPER_COMPONENTCONTEXT_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/componentfactory.hxx b/comphelper/inc/comphelper/componentfactory.hxx index c23fbbca80d1..2da7de3f3c82 100644 --- a/comphelper/inc/comphelper/componentfactory.hxx +++ b/comphelper/inc/comphelper/componentfactory.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. @@ -116,3 +117,5 @@ COMPHELPER_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::uno::XI } // namespace comphelper #endif // _COMPHELPER_COMPONENTFACTORY_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/componentguard.hxx b/comphelper/inc/comphelper/componentguard.hxx index 820b901a5c55..820b901a5c55 100755..100644 --- a/comphelper/inc/comphelper/componentguard.hxx +++ b/comphelper/inc/comphelper/componentguard.hxx diff --git a/comphelper/inc/comphelper/componentmodule.hxx b/comphelper/inc/comphelper/componentmodule.hxx index 61ddddebadbf..4bc917ef13d3 100644 --- a/comphelper/inc/comphelper/componentmodule.hxx +++ b/comphelper/inc/comphelper/componentmodule.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. @@ -28,7 +29,6 @@ #define COMPHELPER_INC_COMPHELPER_COMPONENTMODULE_HXX #include <comphelper/comphelperdllapi.h> -#include <comphelper/legacysingletonfactory.hxx> /** === begin UNO includes === **/ #include <com/sun/star/lang/XMultiServiceFactory.hpp> @@ -271,29 +271,6 @@ namespace comphelper } //========================================================================== - //= OLegacySingletonRegistration - //========================================================================== - template <class TYPE> - class OLegacySingletonRegistration - { - public: - OLegacySingletonRegistration( OModule& _rModule ); - }; - - //-------------------------------------------------------------------------- - template <class TYPE> - OLegacySingletonRegistration<TYPE>::OLegacySingletonRegistration( OModule& _rModule ) - { - _rModule.registerImplementation( ComponentDescription( - TYPE::getImplementationName_static(), - TYPE::getSupportedServiceNames_static(), - ::rtl::OUString(), - &TYPE::Create, - &::comphelper::createLegacySingletonFactory - ) ); - } - - //========================================================================== //= helpers //========================================================================== @@ -304,7 +281,7 @@ namespace comphelper /* -------------------------------------------------------------------- */ \ class ModuleClass : public ::comphelper::OModule \ { \ - friend struct CreateModuleClass; \ + friend struct ModuleClass##Creator; \ typedef ::comphelper::OModule BaseClass; \ \ public: \ @@ -349,32 +326,20 @@ namespace comphelper OSingletonRegistration() : BaseClass( ModuleClass::getInstance() ) \ { \ } \ - }; \ - /* -------------------------------------------------------------------- */ \ - template < class TYPE > \ - class OLegacySingletonRegistration : public ::comphelper::OLegacySingletonRegistration< TYPE > \ - { \ - private: \ - typedef ::comphelper::OLegacySingletonRegistration< TYPE > BaseClass; \ - \ - public: \ - OLegacySingletonRegistration() : BaseClass( ModuleClass::getInstance() ) \ - { \ - } \ - }; \ + }; //========================================================================== //= implementing a OModule for a component library #define IMPLEMENT_COMPONENT_MODULE( ModuleClass ) \ - struct CreateModuleClass \ + struct ModuleClass##Creator \ { \ - ModuleClass* operator()() \ - { \ - static ModuleClass* pModule = new ModuleClass; \ - return pModule; \ - } \ + ModuleClass m_aModuleClass; \ }; \ + namespace \ + { \ + class the##ModuleClass##Instance : public rtl::Static<ModuleClass##Creator, the##ModuleClass##Instance> {}; \ + } \ \ ModuleClass::ModuleClass() \ :BaseClass() \ @@ -383,16 +348,14 @@ namespace comphelper \ ModuleClass& ModuleClass::getInstance() \ { \ - return *rtl_Instance< ModuleClass, CreateModuleClass, ::osl::MutexGuard, ::osl::GetGlobalMutex >:: \ - create( CreateModuleClass(), ::osl::GetGlobalMutex() ); \ + return the##ModuleClass##Instance::get().m_aModuleClass; \ } \ //========================================================================== //= implementing the API of a component library (component_*) #define IMPLEMENT_COMPONENT_LIBRARY_API( module_class, initializer_function ) \ - extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL \ - component_getImplementationEnvironment( \ + extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( \ const sal_Char **ppEnvTypeName, uno_Environment ** /*ppEnv*/ ) \ { \ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; \ @@ -410,3 +373,4 @@ namespace comphelper #endif // COMPHELPER_INC_COMPHELPER_COMPONENTMODULE_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/composedprops.hxx b/comphelper/inc/comphelper/composedprops.hxx index 93dab60cde13..74a9cf30acd1 100644 --- a/comphelper/inc/comphelper/composedprops.hxx +++ b/comphelper/inc/comphelper/composedprops.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. @@ -125,3 +126,4 @@ namespace comphelper #endif // _COMPHELPER_COMPOSEDPROPS_HXX_ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/configurationhelper.hxx b/comphelper/inc/comphelper/configurationhelper.hxx index 52603cd78b06..3800cea7a0ba 100644 --- a/comphelper/inc/comphelper/configurationhelper.hxx +++ b/comphelper/inc/comphelper/configurationhelper.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. @@ -259,3 +260,5 @@ class COMPHELPER_DLLPUBLIC ConfigurationHelper #undef css // important! #endif // _COMPHELPER_CONFIGURATIONHELPER_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/container.hxx b/comphelper/inc/comphelper/container.hxx index d509cada5603..f0466fe3ae5e 100644 --- a/comphelper/inc/comphelper/container.hxx +++ b/comphelper/inc/comphelper/container.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. @@ -83,3 +84,4 @@ protected: #endif // _COMPHELPER_CONTAINER_HXX_ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/containermultiplexer.hxx b/comphelper/inc/comphelper/containermultiplexer.hxx index f623f3040cad..68990ec694f6 100644 --- a/comphelper/inc/comphelper/containermultiplexer.hxx +++ b/comphelper/inc/comphelper/containermultiplexer.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. @@ -113,3 +114,4 @@ namespace comphelper #endif // _COMPHELPER_CONTAINERMULTIPLEXER_HXX_ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/docpasswordhelper.hxx b/comphelper/inc/comphelper/docpasswordhelper.hxx index 7e9f06318a26..51c44d821def 100644 --- a/comphelper/inc/comphelper/docpasswordhelper.hxx +++ b/comphelper/inc/comphelper/docpasswordhelper.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. @@ -78,7 +79,7 @@ public: - DocPasswordVerifierResult_WRONG_PASSWORD, if the password is wrong. The user may be asked again for a new password. - DocPasswordVerifierResult_ABORT, if an unrecoverable error - occured while password verification. The password request loop + occurred while password verification. The password request loop will be aborted. */ virtual DocPasswordVerifierResult verifyPassword( const ::rtl::OUString& rPassword, ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& o_rEncryptionData ) = 0; @@ -373,3 +374,4 @@ private: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/docpasswordrequest.hxx b/comphelper/inc/comphelper/docpasswordrequest.hxx index effc47392078..2d42dcf453c8 100755..100644 --- a/comphelper/inc/comphelper/docpasswordrequest.hxx +++ b/comphelper/inc/comphelper/docpasswordrequest.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. @@ -129,3 +130,4 @@ private: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/documentconstants.hxx b/comphelper/inc/comphelper/documentconstants.hxx index e53bb03ce773..06653b023002 100644 --- a/comphelper/inc/comphelper/documentconstants.hxx +++ b/comphelper/inc/comphelper/documentconstants.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. @@ -147,4 +148,4 @@ #define SFX_FILTER_VERSION_NONE 0 #define SFX_FILTER_NOTINSTALLED SFX_FILTER_MUSTINSTALL | SFX_FILTER_CONSULTSERVICE - +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/documentinfo.hxx b/comphelper/inc/comphelper/documentinfo.hxx index c791b8d26aab..baa06e7d7d4b 100644 --- a/comphelper/inc/comphelper/documentinfo.hxx +++ b/comphelper/inc/comphelper/documentinfo.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. @@ -57,3 +58,5 @@ namespace comphelper { //........................................................................ #endif // COMPHELPER_DOCUMENTINFO_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/embeddedobjectcontainer.hxx b/comphelper/inc/comphelper/embeddedobjectcontainer.hxx index c1382557c52a..7983dec4b662 100644 --- a/comphelper/inc/comphelper/embeddedobjectcontainer.hxx +++ b/comphelper/inc/comphelper/embeddedobjectcontainer.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. @@ -177,7 +178,7 @@ public: * * \param _xStorage The storeage where to store the objects. * \param _bClearModifedFlag If <TRUE/> then the modifed flag will be set to <FALSE/> otherwise nothing happen. - * \return <FALSE/> if no error occured, otherwise <TRUE/>. + * \return <FALSE/> if no error occurred, otherwise <TRUE/>. */ sal_Bool SetPersistentEntries(const com::sun::star::uno::Reference< com::sun::star::embed::XStorage >& _xStorage,bool _bClearModifedFlag = true); }; @@ -186,3 +187,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/enumhelper.hxx b/comphelper/inc/comphelper/enumhelper.hxx index 7272d9e91d20..fbf42d0d5673 100644 --- a/comphelper/inc/comphelper/enumhelper.hxx +++ b/comphelper/inc/comphelper/enumhelper.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. @@ -148,3 +149,4 @@ public: +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/eventattachermgr.hxx b/comphelper/inc/comphelper/eventattachermgr.hxx index cae67a71d4d0..f534ba26dbe5 100644 --- a/comphelper/inc/comphelper/eventattachermgr.hxx +++ b/comphelper/inc/comphelper/eventattachermgr.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. @@ -66,3 +67,4 @@ createEventAttacherManager( #endif // _COMPHELPER_EVENTATTACHERMGR_HXX_ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/evtlistenerhlp.hxx b/comphelper/inc/comphelper/evtlistenerhlp.hxx index 422b44abe7a0..8abf94b915ce 100644 --- a/comphelper/inc/comphelper/evtlistenerhlp.hxx +++ b/comphelper/inc/comphelper/evtlistenerhlp.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. @@ -54,3 +55,5 @@ namespace comphelper } // namespace comphelper //........................................................................ #endif // COMPHELPER_EVENTLISTENERHELPER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/evtmethodhelper.hxx b/comphelper/inc/comphelper/evtmethodhelper.hxx index 8e34b0e00149..e65b73dc207b 100755..100644 --- a/comphelper/inc/comphelper/evtmethodhelper.hxx +++ b/comphelper/inc/comphelper/evtmethodhelper.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. @@ -6,9 +7,6 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: evtlistenerhlp.hxx,v $ - * $Revision$ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -39,3 +37,5 @@ namespace comphelper } // namespace comphelper //........................................................................ #endif // COMPHELPER_EVENTMEHODHELPER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/extract.hxx b/comphelper/inc/comphelper/extract.hxx index b44391c17911..4fcaab595b96 100644 --- a/comphelper/inc/comphelper/extract.hxx +++ b/comphelper/inc/comphelper/extract.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. @@ -162,3 +163,5 @@ inline ::com::sun::star::uno::Any SAL_CALL bool2any( sal_Bool bBool ) } #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/fileformat.h b/comphelper/inc/comphelper/fileformat.h index 65f37a2551b7..7b047e73d349 100644 --- a/comphelper/inc/comphelper/fileformat.h +++ b/comphelper/inc/comphelper/fileformat.h @@ -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,4 @@ #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/flagguard.hxx b/comphelper/inc/comphelper/flagguard.hxx index 4fc1f4e97833..4fc1f4e97833 100755..100644 --- a/comphelper/inc/comphelper/flagguard.hxx +++ b/comphelper/inc/comphelper/flagguard.hxx diff --git a/comphelper/inc/comphelper/genericpropertyset.hxx b/comphelper/inc/comphelper/genericpropertyset.hxx index 6364dea5f020..a5b3608fc964 100644 --- a/comphelper/inc/comphelper/genericpropertyset.hxx +++ b/comphelper/inc/comphelper/genericpropertyset.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. @@ -39,3 +40,4 @@ namespace comphelper #endif // _COMPHELPER_GENERICPROPERTYSET_HXX_ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/guarding.hxx b/comphelper/inc/comphelper/guarding.hxx index 66de00738601..7593b4846cd6 100644 --- a/comphelper/inc/comphelper/guarding.hxx +++ b/comphelper/inc/comphelper/guarding.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. @@ -61,3 +62,4 @@ typedef ORelease< ::osl::Mutex > MutexRelease; #endif // _COMPHELPER_GUARDING_HXX_ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/ihwrapnofilter.hxx b/comphelper/inc/comphelper/ihwrapnofilter.hxx index 1765716acb66..773946cd9af1 100644 --- a/comphelper/inc/comphelper/ihwrapnofilter.hxx +++ b/comphelper/inc/comphelper/ihwrapnofilter.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. @@ -44,12 +45,8 @@ #include <com/sun/star/frame/DoubleInitializationException.hpp> #endif -#ifndef _CPPUHELPER_IMPLBASE3_HXX_ #include <cppuhelper/implbase3.hxx> -#endif -#ifndef INCLUDED_COMPHELPERDLLAPI_H #include "comphelper/comphelperdllapi.h" -#endif namespace comphelper { @@ -100,3 +97,5 @@ namespace comphelper { }; } #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/implbase_var.hxx b/comphelper/inc/comphelper/implbase_var.hxx index 97d360f853a6..4ced6b8fce93 100644 --- a/comphelper/inc/comphelper/implbase_var.hxx +++ b/comphelper/inc/comphelper/implbase_var.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. @@ -395,9 +396,56 @@ public: { WeakComponentImplHelperBase::removeEventListener( xListener ); } }; +template < BOOST_PP_ENUM_PARAMS(COMPHELPER_IMPLBASE_INTERFACE_NUMBER, + typename Ifc) > +class SAL_NO_VTABLE BOOST_PP_CAT(PartialWeakComponentImplHelper, + COMPHELPER_IMPLBASE_INTERFACE_NUMBER) + : public ::cppu::WeakComponentImplHelperBase, + public ::com::sun::star::lang::XTypeProvider, + BOOST_PP_ENUM_PARAMS(COMPHELPER_IMPLBASE_INTERFACE_NUMBER, public Ifc) +{ + /// @internal + struct cd : public ::rtl::StaticAggregate< + ::cppu::class_data, + BOOST_PP_CAT(detail::ImplClassData, + COMPHELPER_IMPLBASE_INTERFACE_NUMBER) + < + BOOST_PP_ENUM_PARAMS(COMPHELPER_IMPLBASE_INTERFACE_NUMBER, Ifc), + BOOST_PP_CAT(PartialWeakComponentImplHelper, + COMPHELPER_IMPLBASE_INTERFACE_NUMBER)< + BOOST_PP_ENUM_PARAMS(COMPHELPER_IMPLBASE_INTERFACE_NUMBER, Ifc)> + > > {}; + +public: + BOOST_PP_CAT(PartialWeakComponentImplHelper, COMPHELPER_IMPLBASE_INTERFACE_NUMBER)( + ::osl::Mutex & rMutex ) : WeakComponentImplHelperBase(rMutex) {} + + virtual ::com::sun::star::uno::Any + SAL_CALL queryInterface( ::com::sun::star::uno::Type const& rType ) + throw (::com::sun::star::uno::RuntimeException) + { + return ::cppu::WeakComponentImplHelper_query( + rType, cd::get(), this, + static_cast< ::cppu::WeakComponentImplHelperBase * >(this) ); + } + virtual void SAL_CALL acquire() throw () + { WeakComponentImplHelperBase::acquire(); } + virtual void SAL_CALL release() throw () + { WeakComponentImplHelperBase::release(); } + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > + SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException) + { return ::cppu::WeakComponentImplHelper_getTypes( cd::get() ); } + virtual ::com::sun::star::uno::Sequence<sal_Int8> + SAL_CALL getImplementationId() + throw (::com::sun::star::uno::RuntimeException) + { return ::cppu::ImplHelper_getImplementationId( cd::get() ); } +}; + + } // namespace comphelper // undef for multiple use/inclusion of this header: #undef COMPHELPER_IMPLBASE_MAX_CTOR_ARGS #undef COMPHELPER_IMPLBASE_INTERFACE_NUMBER +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/implementationreference.hxx b/comphelper/inc/comphelper/implementationreference.hxx index 806cdc86f129..dff242b78307 100644 --- a/comphelper/inc/comphelper/implementationreference.hxx +++ b/comphelper/inc/comphelper/implementationreference.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. @@ -271,3 +272,5 @@ namespace comphelper } #endif // _COMPHELPER_IMPLEMENTATIONREFERENCE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/interaction.hxx b/comphelper/inc/comphelper/interaction.hxx index 1ae1dda61ec4..a8f0df51b0bd 100644 --- a/comphelper/inc/comphelper/interaction.hxx +++ b/comphelper/inc/comphelper/interaction.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. @@ -51,7 +52,7 @@ namespace comphelper */ class OInteractionSelect { - sal_Bool m_bSelected : 1; /// indicates if the select event occured + sal_Bool m_bSelected : 1; /// indicates if the select event occurred protected: OInteractionSelect() : m_bSelected(sal_False) { } @@ -168,3 +169,4 @@ namespace comphelper #endif // _COMPHELPER_INTERACTION_HXX_ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/legacysingletonfactory.hxx b/comphelper/inc/comphelper/legacysingletonfactory.hxx deleted file mode 100644 index 7180a66403bb..000000000000 --- a/comphelper/inc/comphelper/legacysingletonfactory.hxx +++ /dev/null @@ -1,72 +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. - * - ************************************************************************/ - -#ifndef COMPHELPER_LEGACYSINGLETONFACTORY_HXX -#define COMPHELPER_LEGACYSINGLETONFACTORY_HXX - -#include "comphelper/comphelperdllapi.h" - -/** === begin UNO includes === **/ -/** === end UNO includes === **/ - -#include <cppuhelper/factory.hxx> - -//........................................................................ -namespace comphelper -{ -//........................................................................ - -/** creates a factory which can be used when implementing old-style singletons - - Before UNO having the component context concept, singletons were implemented by providing - a factory which return the very same component instance for every creation request. - - Nowadays, singletons are implemented by making them available at the component context, - as dedicated property. - - To bridge between both worlds - sometimes necessary to support legacy code, which instantiates - singletons at the global service manager, instead of obtaining the property at the - component context -, you can use the function below. I creates a single-component - factory, which behaves like the old factories did: Upon multiple creation requests, - it will always return the same instance. Additionally, the signature of the function - is the same as the signature of <code>::cppu::createSingleComponentFactory</code> - (which creates a "normal" component factory), so you can use both factory functions - in the same context. -*/ -::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleComponentFactory > - COMPHELPER_DLLPUBLIC createLegacySingletonFactory( - ::cppu::ComponentFactoryFunc _componentFactoryFunc, - const ::rtl::OUString& _rImplementationName, - const ::com::sun::star::uno::Sequence< ::rtl::OUString >& _rServiceNames, - rtl_ModuleCount* _pModCount = NULL - ); - -//........................................................................ -} // namespace comphelper -//........................................................................ - -#endif // COMPHELPER_LEGACYSINGLETONFACTORY_HXX diff --git a/comphelper/inc/comphelper/listenernotification.hxx b/comphelper/inc/comphelper/listenernotification.hxx index f4bf2f916859..98143f1d3242 100644 --- a/comphelper/inc/comphelper/listenernotification.hxx +++ b/comphelper/inc/comphelper/listenernotification.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. @@ -306,3 +307,4 @@ namespace comphelper #endif // COMPHELPER_INC_COMPHELPER_LISTENERNOTIFICATION_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/locale.hxx b/comphelper/inc/comphelper/locale.hxx index 3fd8a15aa163..85821dd28a89 100644 --- a/comphelper/inc/comphelper/locale.hxx +++ b/comphelper/inc/comphelper/locale.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. @@ -69,40 +70,8 @@ class COMPHELPER_DLLPUBLIC Locale /** @short some predefined Locale objects. */ static const Locale EN_US(); - static const Locale EN(); - static const Locale DE_DE(); - static const Locale DE_CH(); - static const Locale DE_AT(); - static const Locale AR(); - static const Locale CA(); - static const Locale CS(); - static const Locale DA(); - static const Locale EL(); - static const Locale ES(); - static const Locale FI(); - static const Locale FR(); - static const Locale HE(); - static const Locale HI_IN(); - static const Locale HU(); - static const Locale IT(); - static const Locale JA(); - static const Locale KO(); - static const Locale NL(); - static const Locale PL(); - static const Locale PT(); - static const Locale PT_BR(); - static const Locale RU(); - static const Locale SK(); - static const Locale SL(); - static const Locale SV(); - static const Locale TH(); - static const Locale TR(); static const Locale X_DEFAULT(); - static const Locale X_COMMENT(); - static const Locale X_TRANSLATE(); static const Locale X_NOTRANSLATE(); - static const Locale ZH_CN(); - static const Locale ZH_TW(); //------------------------------------------- // types @@ -380,29 +349,6 @@ class COMPHELPER_DLLPUBLIC Locale throw(MalFormedLocaleException); //--------------------------------------- - /** @short search for the next possible fallback locale. - - @descr Instead of getFallback(vector<>, string) this method - uses the given locale and decide by using an algorithm - which locale can be the next possible one. - - Algorithm: - - if locale has country return language only - - if locale different "en-US" return "en-US" - - if locale "en-US" return "en" - - @param aLocale [in/out]! - the incoming value will be used to start - search for a possible fallback ... - and in case such fallback was found this parameter - will be used for return too. - - @return TRUE if the parameter aLocale contains a new fallback value; - FALSE otherwise. - */ - static sal_Bool getFallback(Locale& aLocale); - - //--------------------------------------- /** @short assign elements of another locale to this instance. @@ -441,3 +387,5 @@ class COMPHELPER_DLLPUBLIC Locale } // namespace salhelper #endif // _COMPHELPER_LOCALE_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/logging.hxx b/comphelper/inc/comphelper/logging.hxx index 20f9302cc853..e332f0541594 100644 --- a/comphelper/inc/comphelper/logging.hxx +++ b/comphelper/inc/comphelper/logging.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. @@ -792,3 +793,5 @@ namespace comphelper //........................................................................ #endif // COMPHELPER_LOGGING_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/make_shared_from_uno.hxx b/comphelper/inc/comphelper/make_shared_from_uno.hxx index 3acd4ec13dfe..4cbb3a17c362 100644 --- a/comphelper/inc/comphelper/make_shared_from_uno.hxx +++ b/comphelper/inc/comphelper/make_shared_from_uno.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. @@ -73,3 +74,4 @@ inline ::boost::shared_ptr<T> make_shared_from_UNO( T * p ) #endif // ! defined(INCLUDED_COMPHELPER_MAKE_SHARED_FROM_UNO_HXX) +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/makesequence.hxx b/comphelper/inc/comphelper/makesequence.hxx index 4273356bf9aa..d4e724309e94 100644 --- a/comphelper/inc/comphelper/makesequence.hxx +++ b/comphelper/inc/comphelper/makesequence.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. @@ -85,3 +86,4 @@ BOOST_PP_REPEAT_FROM_TO(2, BOOST_PP_ADD(COMPHELPER_MAKESEQUENCE_MAX_ARGS, 1), #endif // ! defined(COMPHELPER_MAKESEQUENCE_HXX_INCLUDED) +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/mediadescriptor.hxx b/comphelper/inc/comphelper/mediadescriptor.hxx index e92a6c4650f6..cc36fc62282e 100644 --- a/comphelper/inc/comphelper/mediadescriptor.hxx +++ b/comphelper/inc/comphelper/mediadescriptor.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. @@ -50,7 +51,7 @@ namespace comphelper{ /** @short can be used to work with a <type scope="::com::sun::star::document">MediaDescriptor</type> struct. - @descr It wraps a ::std::hash_map around the Sequence< css::beans::PropertyValue >, which + @descr It wraps a ::boost::unordered_map around the Sequence< css::beans::PropertyValue >, which represent the MediaDescriptor item. Further this helper defines often used functions (as e.g. open of the required streams, consistent checks etcpp.) and it defines all useable property names. @@ -337,3 +338,5 @@ class COMPHELPER_DLLPUBLIC MediaDescriptor : public SequenceAsHashMap } // namespace comphelper #endif // _COMPHELPER_MEDIADESCRIPTOR_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/mimeconfighelper.hxx b/comphelper/inc/comphelper/mimeconfighelper.hxx index 16a0a159d5a4..992f367d67df 100644 --- a/comphelper/inc/comphelper/mimeconfighelper.hxx +++ b/comphelper/inc/comphelper/mimeconfighelper.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. @@ -146,3 +147,4 @@ public: #endif // _COMPHELPER_MIMECONFIGHELPER_HXX_ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/namecontainer.hxx b/comphelper/inc/comphelper/namecontainer.hxx index 30d2326794b0..b251c553efd2 100644 --- a/comphelper/inc/comphelper/namecontainer.hxx +++ b/comphelper/inc/comphelper/namecontainer.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. @@ -40,3 +41,4 @@ namespace comphelper #endif // _COMPHELPER_NAMECONTAINER_HXX_ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/namedvaluecollection.hxx b/comphelper/inc/comphelper/namedvaluecollection.hxx index e13059361b0a..6ec12a6aa5c2 100644 --- a/comphelper/inc/comphelper/namedvaluecollection.hxx +++ b/comphelper/inc/comphelper/namedvaluecollection.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. @@ -365,3 +366,4 @@ namespace comphelper #endif // COMPHELPER_NAMEDVALUECOLLECTION_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/numberedcollection.hxx b/comphelper/inc/comphelper/numberedcollection.hxx index 03bc1e0b78ed..19bd542eaaab 100644 --- a/comphelper/inc/comphelper/numberedcollection.hxx +++ b/comphelper/inc/comphelper/numberedcollection.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. @@ -43,7 +44,7 @@ #include <cppuhelper/implbase1.hxx> #include <vector> -#include <hash_map> +#include <boost/unordered_map.hpp> //_______________________________________________ // namespace @@ -80,10 +81,10 @@ class COMPHELPER_DLLPUBLIC NumberedCollection : private ::cppu::BaseMutex ::sal_Int32 nNumber; }; - typedef ::std::hash_map< + typedef ::boost::unordered_map< long , TNumberedItem , - ::std::hash< long > , + ::boost::hash< long > , ::std::equal_to< long > > TNumberedItemHash; typedef ::std::vector< long > TDeadItemList; @@ -196,3 +197,5 @@ class COMPHELPER_DLLPUBLIC NumberedCollection : private ::cppu::BaseMutex } // namespace comphelper #endif // _COMPHELPER_NUMBEREDCOLLECTION_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/numbers.hxx b/comphelper/inc/comphelper/numbers.hxx index ef5bbe73931c..179889c7b720 100644 --- a/comphelper/inc/comphelper/numbers.hxx +++ b/comphelper/inc/comphelper/numbers.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. @@ -72,3 +73,4 @@ namespace comphelper #endif // _COMPHELPER_NUMBERS_HXX_ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/officeresourcebundle.hxx b/comphelper/inc/comphelper/officeresourcebundle.hxx index d45209da9374..345790e733f2 100644 --- a/comphelper/inc/comphelper/officeresourcebundle.hxx +++ b/comphelper/inc/comphelper/officeresourcebundle.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. @@ -114,3 +115,4 @@ namespace comphelper #endif // COMPHELPER_OFFICE_RESOURCE_BUNDLE_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/ofopxmlhelper.hxx b/comphelper/inc/comphelper/ofopxmlhelper.hxx index db203a08d750..8043ea818afd 100644 --- a/comphelper/inc/comphelper/ofopxmlhelper.hxx +++ b/comphelper/inc/comphelper/ofopxmlhelper.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. @@ -28,9 +29,7 @@ #ifndef _COMPHELPER_OFOPXMLHELPER_HXX #define _COMPHELPER_OFOPXMLHELPER_HXX -#ifndef _COM_SUN_STAR_XML_SAX_XDUCUMENTHANDLER_HPP_ #include <com/sun/star/xml/sax/XDocumentHandler.hpp> -#endif #include <com/sun/star/beans/StringPair.hpp> #include <com/sun/star/io/XInputStream.hpp> #include <com/sun/star/io/XOutputStream.hpp> @@ -137,3 +136,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/optional.hxx b/comphelper/inc/comphelper/optional.hxx index 790e117622fd..2ffec9b55b02 100644 --- a/comphelper/inc/comphelper/optional.hxx +++ b/comphelper/inc/comphelper/optional.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. @@ -88,3 +89,4 @@ inline ::com::sun::star::beans::Optional<sal_Bool> makeOptional( bool v ) #endif // ! defined(INCLUDED_COMPHELPER_OPTIONAL_HXX) +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/oslfile2streamwrap.hxx b/comphelper/inc/comphelper/oslfile2streamwrap.hxx index 1a0a7cc55e04..d62ca3db4108 100644 --- a/comphelper/inc/comphelper/oslfile2streamwrap.hxx +++ b/comphelper/inc/comphelper/oslfile2streamwrap.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. @@ -43,10 +44,7 @@ namespace comphelper // FmUnoIOStream, // stream zum schreiben un lesen von Daten, basieren auf File //================================================================== -struct InputStreamWrapper_Base : public ::cppu::WeakImplHelper1<stario::XInputStream> -{}; - -class COMPHELPER_DLLPUBLIC OSLInputStreamWrapper : public InputStreamWrapper_Base +class COMPHELPER_DLLPUBLIC OSLInputStreamWrapper : public ::cppu::WeakImplHelper1<stario::XInputStream> { ::osl::Mutex m_aMutex; ::osl::File* m_pFile; @@ -57,14 +55,6 @@ public: OSLInputStreamWrapper(::osl::File* pStream, sal_Bool bOwner=sal_False); virtual ~OSLInputStreamWrapper(); -// UNO Anbindung - virtual void SAL_CALL acquire() throw() - { InputStreamWrapper_Base::acquire(); } - virtual void SAL_CALL release() throw() - { InputStreamWrapper_Base::release(); } - virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(const ::com::sun::star::uno::Type& _rType) throw (::com::sun::star::uno::RuntimeException) - { return InputStreamWrapper_Base::queryInterface(_rType); } - // stario::XInputStream virtual sal_Int32 SAL_CALL readBytes(staruno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead) throw(stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException); virtual sal_Int32 SAL_CALL readSomeBytes(staruno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead) throw(stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException); @@ -77,24 +67,13 @@ public: // FmUnoOutStream, // Datensenke fuer Files //================================================================== -struct OutputStreamWrapper_Base : public ::cppu::WeakImplHelper1<stario::XOutputStream> -{}; - -class COMPHELPER_DLLPUBLIC OSLOutputStreamWrapper : public OutputStreamWrapper_Base +class COMPHELPER_DLLPUBLIC OSLOutputStreamWrapper : public ::cppu::WeakImplHelper1<stario::XOutputStream> { ::osl::File& rFile; public: OSLOutputStreamWrapper(::osl::File& _rFile) :rFile(_rFile) { } -// UNO Anbindung - virtual void SAL_CALL acquire() throw() - { OutputStreamWrapper_Base::acquire(); } - virtual void SAL_CALL release() throw() - { OutputStreamWrapper_Base::release(); } - virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(const ::com::sun::star::uno::Type& _rType) throw (::com::sun::star::uno::RuntimeException) - { return OutputStreamWrapper_Base::queryInterface(_rType); } - // stario::XOutputStream virtual void SAL_CALL writeBytes(const staruno::Sequence< sal_Int8 >& aData) throw(stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException); virtual void SAL_CALL flush() throw(stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException); @@ -106,3 +85,4 @@ public: #endif // _COMPHELPER_STREAM_OSLFILEWRAPPER_HXX_ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/otransactedfilestream.hxx b/comphelper/inc/comphelper/otransactedfilestream.hxx index b4533b5d9694..248aa22f02eb 100644 --- a/comphelper/inc/comphelper/otransactedfilestream.hxx +++ b/comphelper/inc/comphelper/otransactedfilestream.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. @@ -134,3 +135,4 @@ public: #endif //_COMPHELPER_OTRANSACTEDFILESTREAM_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/processfactory.hxx b/comphelper/inc/comphelper/processfactory.hxx index aeaaf498c918..b20d7302241d 100644 --- a/comphelper/inc/comphelper/processfactory.hxx +++ b/comphelper/inc/comphelper/processfactory.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. @@ -96,3 +97,4 @@ comphelper_getProcessComponentContext(); #endif // _COMPHELPER_PROCESSFACTORY_HXX_ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/propagg.hxx b/comphelper/inc/comphelper/propagg.hxx index b82f737d534b..6286e9d79088 100644 --- a/comphelper/inc/comphelper/propagg.hxx +++ b/comphelper/inc/comphelper/propagg.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. @@ -327,3 +328,4 @@ protected: #endif // _COMPHELPER_PROPERTY_AGGREGATION_HXX_ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/proparrhlp.hxx b/comphelper/inc/comphelper/proparrhlp.hxx index 193f7e100c4a..6af317420327 100644 --- a/comphelper/inc/comphelper/proparrhlp.hxx +++ b/comphelper/inc/comphelper/proparrhlp.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. @@ -180,3 +181,4 @@ template <class TYPE> inline #endif // _COMPHELPER_PROPERTY_ARRAY_HELPER_HXX_ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/property.hxx b/comphelper/inc/comphelper/property.hxx index 9b5b1a9804fe..662fa84903b8 100644 --- a/comphelper/inc/comphelper/property.hxx +++ b/comphelper/inc/comphelper/property.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. @@ -236,3 +237,4 @@ COMPHELPER_DLLPUBLIC sal_Bool tryPropertyValue(staruno::Any& _rConvertedValue, s #endif // _COMPHELPER_PROPERTY_HXX_ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/propertybag.hxx b/comphelper/inc/comphelper/propertybag.hxx index cf7e99768e44..74aa87d71517 100644 --- a/comphelper/inc/comphelper/propertybag.hxx +++ b/comphelper/inc/comphelper/propertybag.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. @@ -235,3 +236,4 @@ namespace comphelper #endif // COMPHELPER_PROPERTYBAG_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/propertycontainer.hxx b/comphelper/inc/comphelper/propertycontainer.hxx index 845ebd05e484..49961e559ea7 100644 --- a/comphelper/inc/comphelper/propertycontainer.hxx +++ b/comphelper/inc/comphelper/propertycontainer.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. @@ -95,3 +96,4 @@ protected: #endif // _COMPHELPER_PROPERTYCONTAINER_HXX_ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/propertycontainerhelper.hxx b/comphelper/inc/comphelper/propertycontainerhelper.hxx index 82848203699c..e6439ea34e96 100644 --- a/comphelper/inc/comphelper/propertycontainerhelper.hxx +++ b/comphelper/inc/comphelper/propertycontainerhelper.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. @@ -31,9 +32,7 @@ #include <cppuhelper/propshlp.hxx> #include <com/sun/star/uno/Type.hxx> #include <com/sun/star/beans/Property.hpp> -#ifndef __SGI_STL_VECTOR #include <vector> -#endif #include "comphelper/comphelperdllapi.h" //......................................................................... @@ -216,3 +215,5 @@ private: //......................................................................... #endif // COMPHELPER_PROPERTYCONTAINERHELPER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/propertysethelper.hxx b/comphelper/inc/comphelper/propertysethelper.hxx index 505a03c1b4ec..ea6204d6795f 100644 --- a/comphelper/inc/comphelper/propertysethelper.hxx +++ b/comphelper/inc/comphelper/propertysethelper.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. @@ -100,3 +101,4 @@ public: #endif // _UTL_PROPERTYSETHELPER_HXX_ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/propertysetinfo.hxx b/comphelper/inc/comphelper/propertysetinfo.hxx index 06ad4f4eecc3..80a200a79b3a 100644 --- a/comphelper/inc/comphelper/propertysetinfo.hxx +++ b/comphelper/inc/comphelper/propertysetinfo.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. @@ -101,3 +102,4 @@ public: #endif // _UTL_PROPERTSETINFO_HXX_ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/propertystatecontainer.hxx b/comphelper/inc/comphelper/propertystatecontainer.hxx index dde26ddf90cf..443c52fdf753 100644 --- a/comphelper/inc/comphelper/propertystatecontainer.hxx +++ b/comphelper/inc/comphelper/propertystatecontainer.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. @@ -118,3 +119,5 @@ namespace comphelper //......................................................................... #endif // COMPHELPER_PROPERTYSTATECONTAINER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/propmultiplex.hxx b/comphelper/inc/comphelper/propmultiplex.hxx index 4d640442a9ae..3c82dee247dd 100644 --- a/comphelper/inc/comphelper/propmultiplex.hxx +++ b/comphelper/inc/comphelper/propmultiplex.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. @@ -114,3 +115,4 @@ namespace comphelper #endif // _COMPHELPER_PROPERTY_MULTIPLEX_HXX_ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/propstate.hxx b/comphelper/inc/comphelper/propstate.hxx index b0c75147c95c..2c8f06f4118a 100644 --- a/comphelper/inc/comphelper/propstate.hxx +++ b/comphelper/inc/comphelper/propstate.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. @@ -110,3 +111,4 @@ namespace comphelper #endif // _COMPHELPER_PROPERTY_STATE_HXX_ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/proxyaggregation.hxx b/comphelper/inc/comphelper/proxyaggregation.hxx index c4c9281da8f2..490569844a81 100644 --- a/comphelper/inc/comphelper/proxyaggregation.hxx +++ b/comphelper/inc/comphelper/proxyaggregation.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. @@ -227,3 +228,5 @@ namespace comphelper #endif // COMPHELPER_PROXY_AGGREGATION + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/regpathhelper.hxx b/comphelper/inc/comphelper/regpathhelper.hxx index 431cdfb930a6..27bbcb84287a 100644 --- a/comphelper/inc/comphelper/regpathhelper.hxx +++ b/comphelper/inc/comphelper/regpathhelper.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. @@ -69,3 +70,4 @@ namespace comphelper #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/scoped_disposing_ptr.hxx b/comphelper/inc/comphelper/scoped_disposing_ptr.hxx new file mode 100644 index 000000000000..7278126c2633 --- /dev/null +++ b/comphelper/inc/comphelper/scoped_disposing_ptr.hxx @@ -0,0 +1,178 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is + * Caolán McNamara <caolanm@redhat.com> (Red Hat, Inc.) + * Portions created by the Initial Developer are Copyright (C) 2011 the + * Initial Developer. All Rights Reserved. + * + * Contributor(s): Caolán McNamara <caolanm@redhat.com> + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ +#ifndef _SCOPED_DISPOSING_PTR +#define _SCOPED_DISPOSING_PTR + +#include <cppuhelper/implbase1.hxx> +#include <boost/utility.hpp> +#include <boost/scoped_ptr.hpp> + +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/frame/XDesktop.hpp> + +// for locking SolarMutex: svapp + mutex +#include <vcl/svapp.hxx> +#include <osl/mutex.hxx> + +namespace comphelper +{ +//Similar to boost::scoped_ptr, except additionally releases the ptr on XComponent::disposing and/or XTerminateListener::notifyTermination if supported +template<class T> class scoped_disposing_ptr : private boost::noncopyable +{ +private: + boost::scoped_ptr<T> m_aItem; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XTerminateListener> m_xTerminateListener; +public: + scoped_disposing_ptr( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > &rComponent, T * p = 0 ) + : m_aItem(p) + { + m_xTerminateListener = new TerminateListener(rComponent, *this); + } + + virtual void reset(T * p = 0) + { + m_aItem.reset(p); + } + + T & operator*() const + { + return *m_aItem; + } + + T * get() const + { + return m_aItem.get(); + } + + T * operator->() const + { + return m_aItem.get(); + } + + operator bool () const + { + return m_aItem; + } + + virtual ~scoped_disposing_ptr() + { + reset(); + } +private: + class TerminateListener : public ::cppu::WeakImplHelper1< ::com::sun::star::frame::XTerminateListener > + { + private: + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > m_xComponent; + scoped_disposing_ptr<T>& m_rItem; + public: + TerminateListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > &rComponent, + scoped_disposing_ptr<T>& rItem) : m_xComponent(rComponent), m_rItem(rItem) + { + if (m_xComponent.is()) + { + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDesktop> xDesktop(m_xComponent, ::com::sun::star::uno::UNO_QUERY); + if (xDesktop.is()) + xDesktop->addTerminateListener(this); + else + m_xComponent->addEventListener(this); + } + } + + ~TerminateListener() + { + if ( m_xComponent.is() ) + { + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDesktop> xDesktop(m_xComponent, ::com::sun::star::uno::UNO_QUERY); + if (xDesktop.is()) + xDesktop->removeTerminateListener(this); + else + m_xComponent->removeEventListener(this); + } + } + + private: + // XEventListener + virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& rEvt ) + throw (::com::sun::star::uno::RuntimeException) + { + bool shutDown = (rEvt.Source == m_xComponent); + + if (shutDown && m_xComponent.is()) + { + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDesktop> xDesktop(m_xComponent, ::com::sun::star::uno::UNO_QUERY); + if (xDesktop.is()) + xDesktop->removeTerminateListener(this); + else + m_xComponent->removeEventListener(this); + m_xComponent.clear(); + } + + if (shutDown) + m_rItem.reset(); + } + + // XTerminateListener + virtual void SAL_CALL queryTermination( const ::com::sun::star::lang::EventObject& ) + throw(::com::sun::star::frame::TerminationVetoException, + ::com::sun::star::uno::RuntimeException) + { + } + + virtual void SAL_CALL notifyTermination( const ::com::sun::star::lang::EventObject& rEvt ) + throw (::com::sun::star::uno::RuntimeException) + { + disposing(rEvt); + } + }; +}; + +//Something like an OutputDevice requires the SolarMutex to be taken before use +//for threadsafety. The user can ensure this, except in the case of its dtor +//being called from reset due to a terminate on the XComponent being called +//from an aribitrary thread +template<class T> class scoped_disposing_solar_mutex_reset_ptr + : public scoped_disposing_ptr<T> +{ +public: + scoped_disposing_solar_mutex_reset_ptr( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > &rComponent, T * p = 0 ) + : scoped_disposing_ptr<T>(rComponent, p) + { + } + + virtual void reset(T * p = 0) + { + SolarMutexGuard aGuard; + scoped_disposing_ptr<T>::reset(p); + } +}; + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/scopeguard.hxx b/comphelper/inc/comphelper/scopeguard.hxx index e9c8f7ecc625..33c4f710c945 100644 --- a/comphelper/inc/comphelper/scopeguard.hxx +++ b/comphelper/inc/comphelper/scopeguard.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. @@ -71,3 +72,4 @@ private: #endif // ! defined(INCLUDED_COMPHELPER_SCOPEGUARD_HXX) +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/seekableinput.hxx b/comphelper/inc/comphelper/seekableinput.hxx index 5fc7ab5b369f..455ed7bb183c 100644 --- a/comphelper/inc/comphelper/seekableinput.hxx +++ b/comphelper/inc/comphelper/seekableinput.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. @@ -82,3 +83,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/seqstream.hxx b/comphelper/inc/comphelper/seqstream.hxx index dcde150953f6..82c335616926 100644 --- a/comphelper/inc/comphelper/seqstream.hxx +++ b/comphelper/inc/comphelper/seqstream.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. @@ -144,3 +145,4 @@ public: #endif //_COMPHELPER_SEQSTREAM_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/sequence.hxx b/comphelper/inc/comphelper/sequence.hxx index 5e9c5dc49040..125668172fb1 100644 --- a/comphelper/inc/comphelper/sequence.hxx +++ b/comphelper/inc/comphelper/sequence.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. @@ -47,7 +48,7 @@ namespace comphelper //------------------------------------------------------------------------- /** search the given string within the given sequence, return the positions where it was found. - if _bOnlyFirst is sal_True, only the first occurence will be returned. + if _bOnlyFirst is sal_True, only the first occurrence will be returned. */ COMPHELPER_DLLPUBLIC staruno::Sequence<sal_Int16> findValue(const staruno::Sequence< ::rtl::OUString >& _rList, const ::rtl::OUString& _rValue, sal_Bool _bOnlyFirst = sal_False); @@ -178,13 +179,9 @@ namespace comphelper ,m_pCurrent(NULL) { ::com::sun::star::uno::Sequence< TYPE > aContainer; - #ifdef DBG_UTIL - sal_Bool bSuccess = - #endif - _rSequenceAny >>= aContainer; - #ifdef DBG_UTIL + sal_Bool bSuccess = _rSequenceAny >>= aContainer; OSL_ENSURE(bSuccess, "OSequenceIterator::OSequenceIterator: invalid Any!"); - #endif + (void)bSuccess; construct(aContainer); } @@ -387,3 +384,4 @@ namespace comphelper #endif // _COMPHELPER_SEQUENCE_HXX_ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/sequenceashashmap.hxx b/comphelper/inc/comphelper/sequenceashashmap.hxx index 737fd41efb84..e809d6a78f78 100644 --- a/comphelper/inc/comphelper/sequenceashashmap.hxx +++ b/comphelper/inc/comphelper/sequenceashashmap.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. @@ -31,10 +32,7 @@ //_______________________________________________ // includes -#ifndef INCLUDED_HASH_MAP -#include <hash_map> -#define INCLUDED_HASH_MAP -#endif +#include <boost/unordered_map.hpp> #ifndef INCLUDED_ALGORITHM #include <algorithm> @@ -44,9 +42,7 @@ #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/beans/NamedValue.hpp> -#ifndef _COM_SUN_STAR_BEANS_IllegalTypeException_HPP_ #include <com/sun/star/beans/IllegalTypeException.hpp> -#endif #include "comphelper/comphelperdllapi.h" // see method dbg_dumpToFile() below! @@ -74,7 +70,7 @@ namespace comphelper{ such name sequences very easy ... */ -struct SequenceAsHashMapBase : public ::std::hash_map< +struct SequenceAsHashMapBase : public ::boost::unordered_map< ::rtl::OUString , ::com::sun::star::uno::Any , ::rtl::OUStringHash , @@ -382,3 +378,5 @@ class COMPHELPER_DLLPUBLIC SequenceAsHashMap : public SequenceAsHashMapBase } // namespace comphelper #endif // _COMPHELPER_SEQUENCEASHASHMAP_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/sequenceasvector.hxx b/comphelper/inc/comphelper/sequenceasvector.hxx index 48dfe50b1645..f44df7a63e1e 100644 --- a/comphelper/inc/comphelper/sequenceasvector.hxx +++ b/comphelper/inc/comphelper/sequenceasvector.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. @@ -35,9 +36,7 @@ #include <algorithm> #include <com/sun/star/uno/Sequence.hxx> -#ifndef _COM_SUN_STAR_BEANS_IllegalTypeException_HPP_ #include <com/sun/star/beans/IllegalTypeException.hpp> -#endif //_______________________________________________ // namespace @@ -69,6 +68,11 @@ class SequenceAsVector : public ::std::vector< TElementType > types from the base! */ typedef typename ::std::vector< TElementType >::const_iterator const_iterator; + //--------------------------------------- + /** @short When inheriting from a template using typename is generally required when using + types from the base! */ + typedef typename ::std::vector< TElementType >::iterator iterator; + //------------------------------------------- // interface public: @@ -175,7 +179,7 @@ class SequenceAsVector : public ::std::vector< TElementType > ::com::sun::star::uno::Sequence< TElementType > lSource; if (!(aSource >>= lSource)) throw ::com::sun::star::beans::IllegalTypeException( - ::rtl::OUString::createFromAscii("SequenceAsVector operator<<(Any) was called with an unsupported Any type."), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SequenceAsVector operator<<(Any) was called with an unsupported Any type.")), ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >()); (*this) << lSource; @@ -256,3 +260,4 @@ class SequenceAsVector : public ::std::vector< TElementType > #endif // _COMPHELPER_SEQUENCEASVECTOR_HXX_ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/servicedecl.hxx b/comphelper/inc/comphelper/servicedecl.hxx index a7d51824f7c0..b025cc7ffdce 100644 --- a/comphelper/inc/comphelper/servicedecl.hxx +++ b/comphelper/inc/comphelper/servicedecl.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. @@ -421,3 +422,4 @@ extern "C" \ #endif // ! defined(COMPHELPER_SERVICEDECL_HXX_INCLUDED) +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/servicehelper.hxx b/comphelper/inc/comphelper/servicehelper.hxx index e856ec9f64b5..0a095e1b987a 100644 --- a/comphelper/inc/comphelper/servicehelper.hxx +++ b/comphelper/inc/comphelper/servicehelper.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. @@ -28,6 +29,22 @@ #ifndef _COMPHELPER_SERVICEHELPER_HXX_ #define _COMPHELPER_SERVICEHELPER_HXX_ +#include <rtl/uuid.h> +#include <rtl/instance.hxx> +#include <com/sun/star/uno/Sequence.hxx> + +class UnoTunnelIdInit +{ +private: + ::com::sun::star::uno::Sequence< sal_Int8 > m_aSeq; +public: + UnoTunnelIdInit() : m_aSeq(16) + { + rtl_createUuid( (sal_uInt8*)m_aSeq.getArray(), 0, sal_True ); + } + const ::com::sun::star::uno::Sequence< sal_Int8 >& getSeq() const { return m_aSeq; } +}; + /** the UNO3_GETIMPLEMENTATION_* macros implement a static helper function that gives access to your implementation for a given interface reference, if possible. @@ -48,20 +65,13 @@ virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException); #define UNO3_GETIMPLEMENTATION_BASE_IMPL( classname ) \ +namespace \ +{ \ + class the##classname##UnoTunnelId : public rtl::Static< UnoTunnelIdInit, the##classname##UnoTunnelId> {}; \ +} \ const ::com::sun::star::uno::Sequence< sal_Int8 > & classname::getUnoTunnelId() throw() \ { \ - static ::com::sun::star::uno::Sequence< sal_Int8 > * pSeq = 0; \ - if( !pSeq ) \ - { \ - ::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() ); \ - if( !pSeq ) \ - { \ - static ::com::sun::star::uno::Sequence< sal_Int8 > aSeq( 16 ); \ - rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True ); \ - pSeq = &aSeq; \ - } \ - } \ - return *pSeq; \ + return the##classname##UnoTunnelId::get().getSeq(); \ } \ \ classname* classname::getImplementation( const uno::Reference< uno::XInterface >& xInt ) \ @@ -103,3 +113,4 @@ sal_Int64 SAL_CALL classname::getSomething( const ::com::sun::star::uno::Sequenc #endif // _COMPHELPER_SERVICEHELPER_HXX_ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/serviceinfohelper.hxx b/comphelper/inc/comphelper/serviceinfohelper.hxx index 87e450260b51..29ffe3bd9907 100644 --- a/comphelper/inc/comphelper/serviceinfohelper.hxx +++ b/comphelper/inc/comphelper/serviceinfohelper.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. @@ -6,9 +7,6 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: unoprov.hxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -61,3 +59,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/sharedmutex.hxx b/comphelper/inc/comphelper/sharedmutex.hxx index c57c241f1cbb..a1984121fc50 100644 --- a/comphelper/inc/comphelper/sharedmutex.hxx +++ b/comphelper/inc/comphelper/sharedmutex.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,5 @@ namespace comphelper //........................................................................ #endif // COMPHELPER_SHAREDMUTEX_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/stillreadwriteinteraction.hxx b/comphelper/inc/comphelper/stillreadwriteinteraction.hxx index 1ade47220c6f..5ad07f201f1a 100644 --- a/comphelper/inc/comphelper/stillreadwriteinteraction.hxx +++ b/comphelper/inc/comphelper/stillreadwriteinteraction.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. @@ -32,9 +33,7 @@ // includes #include <ucbhelper/interceptedinteraction.hxx> -#ifndef __COM_SUN_STAR_TASK_XINTERACTIONHANDLER_HPP__ #include <com/sun/star/task/XInteractionHandler.hpp> -#endif #include <ucbhelper/interceptedinteraction.hxx> #include "comphelper/comphelperdllapi.h" @@ -67,3 +66,5 @@ private: }; } #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/stl_types.hxx b/comphelper/inc/comphelper/stl_types.hxx index 7a8a56f5f238..4f6583192716 100644 --- a/comphelper/inc/comphelper/stl_types.hxx +++ b/comphelper/inc/comphelper/stl_types.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. @@ -27,8 +28,6 @@ #ifndef _COMPHELPER_STLTYPES_HXX_ #define _COMPHELPER_STLTYPES_HXX_ -#if !defined(__SGI_STL_VECTOR_H) || !defined(__SGI_STL_MAP_H) || !defined(__SGI_STL_MULTIMAP_H) - #include <vector> #include <map> @@ -276,7 +275,6 @@ OutputIter intersperse( typedef ::std::set< valuetype, comparefct > classname; \ DECLARE_STL_ITERATORS(classname) \ -#endif - #endif // _COMPHELPER_STLTYPES_HXX_ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/stlunosequence.hxx b/comphelper/inc/comphelper/stlunosequence.hxx index d9757bbd9b51..454de6400c32 100644 --- a/comphelper/inc/comphelper/stlunosequence.hxx +++ b/comphelper/inc/comphelper/stlunosequence.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. * @@ -84,3 +85,5 @@ namespace comphelper { return rSeq.getConstArray() + rSeq.getLength(); } } #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/storagehelper.hxx b/comphelper/inc/comphelper/storagehelper.hxx index 92a2411d6441..00da529ab967 100644 --- a/comphelper/inc/comphelper/storagehelper.hxx +++ b/comphelper/inc/comphelper/storagehelper.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. @@ -180,3 +181,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/streamsection.hxx b/comphelper/inc/comphelper/streamsection.hxx index e3b8d4ebfe8f..fb1758135e9e 100644 --- a/comphelper/inc/comphelper/streamsection.hxx +++ b/comphelper/inc/comphelper/streamsection.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,5 @@ public: } // namespace comphelper #endif // _COMPHELPER_STREAMSECTION_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/string.hxx b/comphelper/inc/comphelper/string.hxx index 8c262edaddfe..e71a008c5e3e 100644 --- a/comphelper/inc/comphelper/string.hxx +++ b/comphelper/inc/comphelper/string.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. @@ -35,6 +36,9 @@ #include "sal/types.h" #include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/i18n/XCollator.hpp> +#include <com/sun/star/i18n/XBreakIterator.hpp> namespace rtl { class OUString; } @@ -74,14 +78,14 @@ COMPHELPER_DLLPUBLIC rtl::OUString searchAndReplaceAsciiL( rtl::OUString const & to, sal_Int32 beginAt = 0, sal_Int32 * replacedAt = NULL); -/** replaces, in the given source string, all occurences of a given ASCII pattern +/** replaces, in the given source string, all occurrences of a given ASCII pattern with another ASCII pattern */ COMPHELPER_DLLPUBLIC ::rtl::OUString searchAndReplaceAllAsciiWithAscii( const ::rtl::OUString& source, const sal_Char* from, const sal_Char* to, const sal_Int32 beginAt = 0 ); -/** does an in-place replacement of the first occurance of a sub string with +/** does an in-place replacement of the first occurrence of a sub string with another string @param source @@ -118,6 +122,27 @@ COMPHELPER_DLLPUBLIC ::rtl::OUString& COMPHELPER_DLLPUBLIC ::rtl::OUString convertCommaSeparated( ::com::sun::star::uno::Sequence< ::rtl::OUString > const & i_rSeq); +/** Convert a decimal string to a number. + + The string must be base-10, no sign but can contain any + codepoint listed in the "Number, Decimal Digit" Unicode + category. + + No verification is made about the validity of the string, + passing string not containing decimal digit code points + gives unspecified results + + If your string is guaranteed to contain only ASCII digit + use rtl::OUString::toInt32 instead. + + @param str The string to convert containing only decimal + digit codepoints. + + @return The value of the string as an int32. + */ +COMPHELPER_DLLPUBLIC sal_uInt32 decimalStringToNumber( + ::rtl::OUString const & str ); + /** Convert a single comma separated string to a sequence of strings. Note that no escaping of commas or anything fancy is done. @@ -130,6 +155,46 @@ COMPHELPER_DLLPUBLIC ::rtl::OUString convertCommaSeparated( COMPHELPER_DLLPUBLIC ::com::sun::star::uno::Sequence< ::rtl::OUString > convertCommaSeparated( ::rtl::OUString const & i_rString ); +/** + Compares two strings using natural order. + + For non digit characters, the comparison use the same algorithm as + rtl_str_compare. When a number is encountered during the comparison, + natural order is used. Thus, Heading 10 will be considered as greater + than Heading 2. Numerical comparison is done using decimal representation. + + Beware that "MyString 001" and "MyString 1" will be considered as equal + since leading 0 are meaningless. + + @param str the object to be compared. + @return 0 - if both strings are equal + < 0 - if this string is less than the string argument + > 0 - if this string is greater than the string argument +*/ +COMPHELPER_DLLPUBLIC sal_Int32 compareNatural( const ::rtl::OUString &rLHS, const ::rtl::OUString &rRHS, + const ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XCollator > &rCollator, + const ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XBreakIterator > &rBI, + const ::com::sun::star::lang::Locale &rLocale ); + +class COMPHELPER_DLLPUBLIC NaturalStringSorter +{ +private: + ::com::sun::star::lang::Locale m_aLocale; + ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XCollator > m_xCollator; + ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XBreakIterator > m_xBI; +public: + NaturalStringSorter( + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > &rContext, + const ::com::sun::star::lang::Locale &rLocale); + sal_Int32 compare(const rtl::OUString &rLHS, const rtl::OUString &rRHS) const + { + return compareNatural(rLHS, rRHS, m_xCollator, m_xBI, m_aLocale); + } + const ::com::sun::star::lang::Locale& getLocale() const { return m_aLocale; } +}; + } } #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/synchronousdispatch.hxx b/comphelper/inc/comphelper/synchronousdispatch.hxx index b215ec2b990b..4bd0375086b6 100644 --- a/comphelper/inc/comphelper/synchronousdispatch.hxx +++ b/comphelper/inc/comphelper/synchronousdispatch.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. @@ -72,3 +73,4 @@ namespace comphelper #endif // _COMPHELPER_SYNCHRONOUSDISPATCH_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/types.hxx b/comphelper/inc/comphelper/types.hxx index 8d5b9f744451..dfa1565c4493 100644 --- a/comphelper/inc/comphelper/types.hxx +++ b/comphelper/inc/comphelper/types.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. @@ -103,7 +104,7 @@ namespace comphelper /** check if a type you have at hand at runtime is equal to another type you have at compile time */ template <class TYPE> - sal_Bool isAReference(const staruno::Any& _rVal, TYPE* pDummy) + sal_Bool isAReference(const staruno::Any& _rVal, TYPE*) { return _rVal.getValueType().equals( cppu::getTypeFavourUnsigned( @@ -178,3 +179,4 @@ namespace comphelper #endif // _COMPHELPER_TYPES_HXX_ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/uieventslogger.hxx b/comphelper/inc/comphelper/uieventslogger.hxx index 5cf270751dd1..40e9a68ad1cf 100644 --- a/comphelper/inc/comphelper/uieventslogger.hxx +++ b/comphelper/inc/comphelper/uieventslogger.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. * @@ -55,3 +56,5 @@ namespace comphelper }; } #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/uno3.hxx b/comphelper/inc/comphelper/uno3.hxx index cd6196e50e53..dff10cc994d3 100644 --- a/comphelper/inc/comphelper/uno3.hxx +++ b/comphelper/inc/comphelper/uno3.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. @@ -29,6 +30,7 @@ #define _COMPHELPER_UNO3_HXX_ #include <osl/interlck.h> +#include <rtl/instance.hxx> #include <comphelper/types.hxx> #include <com/sun/star/uno/XAggregation.hpp> #include <comphelper/sequence.hxx> @@ -196,19 +198,13 @@ namespace comphelper virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw (::com::sun::star::uno::RuntimeException); #define IMPLEMENT_GET_IMPLEMENTATION_ID( classname ) \ + namespace \ + { \ + class the##classname##ImplementationId : public rtl::Static< ::cppu::OImplementationId, the##classname##ImplementationId> {}; \ + } \ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL classname::getImplementationId( ) throw (::com::sun::star::uno::RuntimeException) \ { \ - static ::cppu::OImplementationId* pId = NULL; \ - if (!pId) \ - { \ - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); \ - if (!pId) \ - { \ - static ::cppu::OImplementationId aId; \ - pId = &aId; \ - } \ - } \ - return pId->getImplementationId(); \ + return the##classname##ImplementationId::get().getImplementationId(); \ } #define IMPLEMENT_FORWARD_XTYPEPROVIDER2( classname, baseclass1, baseclass2 ) \ @@ -300,3 +296,4 @@ namespace comphelper #endif // _COMPHELPER_UNO3_HXX_ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/unwrapargs.hxx b/comphelper/inc/comphelper/unwrapargs.hxx index 652187f9139f..94dfb2263f2d 100644 --- a/comphelper/inc/comphelper/unwrapargs.hxx +++ b/comphelper/inc/comphelper/unwrapargs.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. @@ -148,3 +149,4 @@ BOOST_PP_REPEAT(COMPHELPER_UNWRAPARGS_MAX_ARGS, COMPHELPER_UNWRAPARGS_make, ~) #endif // ! defined(COMPHELPER_UNWRAPARGS_HXX_INCLUDED) +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/weak.hxx b/comphelper/inc/comphelper/weak.hxx index b23b673e9b1c..5f3f8b14432a 100644 --- a/comphelper/inc/comphelper/weak.hxx +++ b/comphelper/inc/comphelper/weak.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. @@ -61,3 +62,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/weakbag.hxx b/comphelper/inc/comphelper/weakbag.hxx index 8b2fa1c4449d..b1c443338e06 100644 --- a/comphelper/inc/comphelper/weakbag.hxx +++ b/comphelper/inc/comphelper/weakbag.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. @@ -90,3 +91,5 @@ private: } #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/comphelper/weakeventlistener.hxx b/comphelper/inc/comphelper/weakeventlistener.hxx index 930f19f3a40f..c4cc42bc4052 100644 --- a/comphelper/inc/comphelper/weakeventlistener.hxx +++ b/comphelper/inc/comphelper/weakeventlistener.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. @@ -187,3 +188,4 @@ namespace comphelper #endif// COMPHELPER_WEAKEVENTLISTENER_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/pch/precompiled_comphelper.cxx b/comphelper/inc/pch/precompiled_comphelper.cxx index 2936d22924b7..ad6e1ab9b5ac 100644 --- a/comphelper/inc/pch/precompiled_comphelper.cxx +++ b/comphelper/inc/pch/precompiled_comphelper.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. @@ -27,3 +28,4 @@ #include "precompiled_comphelper.hxx" +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/inc/pch/precompiled_comphelper.hxx b/comphelper/inc/pch/precompiled_comphelper.hxx index a3679864b3b1..7fcb7d048fe2 100644 --- a/comphelper/inc/pch/precompiled_comphelper.hxx +++ b/comphelper/inc/pch/precompiled_comphelper.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. @@ -30,3 +31,4 @@ #ifdef PRECOMPILED_HEADERS #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/prj/build.lst b/comphelper/prj/build.lst index 01a022a0e0bc..a828870f2dbf 100644 --- a/comphelper/prj/build.lst +++ b/comphelper/prj/build.lst @@ -1,2 +1,2 @@ -ch comphelper : cppuhelper ucbhelper offuh vos salhelper LIBXSLT:libxslt NULL +ph comphelper : cppuhelper ucbhelper offuh salhelper LIBXSLT:libxslt NULL ch comphelper\prj nmake - all ch_all NULL diff --git a/comphelper/qa/string/test_string.cxx b/comphelper/qa/string/test_string.cxx new file mode 100644 index 000000000000..c448ebb9fb45 --- /dev/null +++ b/comphelper/qa/string/test_string.cxx @@ -0,0 +1,301 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "precompiled_comphelper.hxx" +#include "sal/config.h" + +#include "comphelper/string.hxx" +#include <cppuhelper/implbase1.hxx> +#include <com/sun/star/i18n/CharType.hpp> + +#include <cppunit/TestFixture.h> +#include <cppunit/extensions/HelperMacros.h> +#include <cppunit/plugin/TestPlugIn.h> + +#include "rtl/string.h" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" +#include "sal/types.h" + +namespace { + +class TestString: public CppUnit::TestFixture +{ +public: + void test(); + void testNatural(); + void testDecimalStringToNumber(); + + CPPUNIT_TEST_SUITE(TestString); + CPPUNIT_TEST(test); + CPPUNIT_TEST(testNatural); + CPPUNIT_TEST(testDecimalStringToNumber); + CPPUNIT_TEST_SUITE_END(); +}; + +void TestString::test() +{ + rtl::OUString s1(RTL_CONSTASCII_USTRINGPARAM("foobarbar")); + sal_Int32 n1; + rtl::OUString s2( + comphelper::string::searchAndReplaceAsciiL( + s1, RTL_CONSTASCII_STRINGPARAM("bar"), + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("baaz")), 0, &n1)); + CPPUNIT_ASSERT( + s2 == rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("foobaazbar"))); + CPPUNIT_ASSERT(n1 == 3); + sal_Int32 n2; + rtl::OUString s3( + comphelper::string::searchAndReplaceAsciiL( + s2, RTL_CONSTASCII_STRINGPARAM("bar"), + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("bz")), + n1 + RTL_CONSTASCII_LENGTH("baaz"), &n2)); + CPPUNIT_ASSERT( + s3 == rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("foobaazbz"))); + CPPUNIT_ASSERT(n2 == 7); + sal_Int32 n3; + rtl::OUString s4( + comphelper::string::searchAndReplaceAsciiL( + s3, RTL_CONSTASCII_STRINGPARAM("bar"), + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("baz")), + n2 + RTL_CONSTASCII_LENGTH("bz"), &n3)); + CPPUNIT_ASSERT(s4 == s3); + CPPUNIT_ASSERT(n3 == -1); +} + +void TestString::testDecimalStringToNumber() +{ + rtl::OUString s1(RTL_CONSTASCII_USTRINGPARAM("1234")); + CPPUNIT_ASSERT_EQUAL((sal_uInt32)1234, comphelper::string::decimalStringToNumber(s1)); + s1 += rtl::OUString(static_cast<sal_Unicode>(0x07C6)); + CPPUNIT_ASSERT_EQUAL((sal_uInt32)12346, comphelper::string::decimalStringToNumber(s1)); + // Codepoints on 2 16bits words + sal_uInt32 utf16String[] = { 0x1D7FE /* 8 */, 0x1D7F7 /* 1 */}; + s1 = rtl::OUString(utf16String, 2); + CPPUNIT_ASSERT_EQUAL((sal_uInt32)81, comphelper::string::decimalStringToNumber(s1)); +} + +using namespace ::com::sun::star; + +class testCollator : public cppu::WeakImplHelper1< i18n::XCollator > +{ +public: + virtual sal_Int32 SAL_CALL compareSubstring( + const rtl::OUString& str1, sal_Int32 off1, sal_Int32 len1, + const rtl::OUString& str2, sal_Int32 off2, sal_Int32 len2) throw(uno::RuntimeException) + { + return str1.copy(off1, len1).compareTo(str2.copy(off2, len2)); + } + virtual sal_Int32 SAL_CALL compareString( + const rtl::OUString& str1, + const rtl::OUString& str2) throw(uno::RuntimeException) + { + return str1.compareTo(str2); + } + virtual sal_Int32 SAL_CALL loadDefaultCollator(const lang::Locale&, sal_Int32) + throw(uno::RuntimeException) {return 0;} + virtual sal_Int32 SAL_CALL loadCollatorAlgorithm(const rtl::OUString&, + const lang::Locale&, sal_Int32) throw(uno::RuntimeException) {return 0;} + virtual void SAL_CALL loadCollatorAlgorithmWithEndUserOption(const rtl::OUString&, + const lang::Locale&, const uno::Sequence< sal_Int32 >&) throw(uno::RuntimeException) {} + virtual uno::Sequence< rtl::OUString > SAL_CALL listCollatorAlgorithms(const lang::Locale&) + throw(uno::RuntimeException) + { + return uno::Sequence< rtl::OUString >(); + } + virtual uno::Sequence< sal_Int32 > SAL_CALL listCollatorOptions(const rtl::OUString&) + throw(uno::RuntimeException) + { + return uno::Sequence< sal_Int32 >(); + } +}; + +#define IS_DIGIT(CHAR) (((CHAR) >= 48) && ((CHAR <= 57))) + +class testBreakIterator : public cppu::WeakImplHelper1< i18n::XBreakIterator > +{ +public: + virtual sal_Int32 SAL_CALL nextCharacters( const rtl::OUString&, sal_Int32, + const lang::Locale&, sal_Int16, sal_Int32, sal_Int32& ) + throw(uno::RuntimeException) {return -1;} + virtual sal_Int32 SAL_CALL previousCharacters( const rtl::OUString&, sal_Int32, + const lang::Locale&, sal_Int16, sal_Int32, sal_Int32& ) + throw(uno::RuntimeException) {return -1;} + + virtual i18n::Boundary SAL_CALL previousWord( const rtl::OUString&, sal_Int32, + const lang::Locale&, sal_Int16) throw(uno::RuntimeException) + { return i18n::Boundary(); } + virtual i18n::Boundary SAL_CALL nextWord( const rtl::OUString&, sal_Int32, + const lang::Locale&, sal_Int16) throw(uno::RuntimeException) + { return i18n::Boundary(); } + virtual i18n::Boundary SAL_CALL getWordBoundary( const rtl::OUString&, sal_Int32, + const lang::Locale&, sal_Int16, sal_Bool ) + throw(uno::RuntimeException) + { return i18n::Boundary(); } + + virtual sal_Bool SAL_CALL isBeginWord( const rtl::OUString&, sal_Int32, + const lang::Locale&, sal_Int16 ) throw(uno::RuntimeException) + { return false; } + virtual sal_Bool SAL_CALL isEndWord( const rtl::OUString&, sal_Int32, + const lang::Locale& , sal_Int16 ) throw(uno::RuntimeException) + { return false; } + virtual sal_Int16 SAL_CALL getWordType( const rtl::OUString&, sal_Int32, + const lang::Locale& ) throw(uno::RuntimeException) + { return 0; } + + virtual sal_Int32 SAL_CALL beginOfSentence( const rtl::OUString&, sal_Int32, + const lang::Locale& ) throw(uno::RuntimeException) + { return 0; } + virtual sal_Int32 SAL_CALL endOfSentence( const rtl::OUString& rText, sal_Int32, + const lang::Locale& ) throw(uno::RuntimeException) + { return rText.getLength(); } + + virtual i18n::LineBreakResults SAL_CALL getLineBreak( const rtl::OUString&, sal_Int32, + const lang::Locale&, sal_Int32, + const i18n::LineBreakHyphenationOptions&, + const i18n::LineBreakUserOptions&) + throw(uno::RuntimeException) + { + return i18n::LineBreakResults(); + } + + virtual sal_Int16 SAL_CALL getScriptType( const rtl::OUString&, sal_Int32 ) + throw(uno::RuntimeException) { return -1; } + virtual sal_Int32 SAL_CALL beginOfScript( const rtl::OUString&, sal_Int32, + sal_Int16 ) throw(uno::RuntimeException) { return -1; } + virtual sal_Int32 SAL_CALL endOfScript( const rtl::OUString&, sal_Int32, + sal_Int16 ) throw(uno::RuntimeException) { return -1; } + virtual sal_Int32 SAL_CALL previousScript( const rtl::OUString&, sal_Int32, + sal_Int16 ) throw(uno::RuntimeException) { return -1; } + virtual sal_Int32 SAL_CALL nextScript( const rtl::OUString&, sal_Int32, + sal_Int16 ) throw(uno::RuntimeException) { return -1; } + + virtual sal_Int32 SAL_CALL beginOfCharBlock( const rtl::OUString&, sal_Int32, + const lang::Locale&, sal_Int16 ) throw(uno::RuntimeException) { return -1; } + virtual sal_Int32 SAL_CALL endOfCharBlock( const rtl::OUString& rText, sal_Int32 nStartPos, + const lang::Locale&, sal_Int16 CharType ) throw(uno::RuntimeException) + { + const sal_Unicode *pStr = rText.getStr()+nStartPos; + for (sal_Int32 nI = nStartPos; nI < rText.getLength(); ++nI) + { + if (CharType == i18n::CharType::DECIMAL_DIGIT_NUMBER && !IS_DIGIT(*pStr)) + return nI; + else if (CharType != i18n::CharType::DECIMAL_DIGIT_NUMBER && IS_DIGIT(*pStr)) + return nI; + ++pStr; + } + return -1; + } + virtual sal_Int32 SAL_CALL previousCharBlock( const rtl::OUString&, sal_Int32, + const lang::Locale&, sal_Int16 ) throw(uno::RuntimeException) { return -1; } + virtual sal_Int32 SAL_CALL nextCharBlock( const rtl::OUString& rText, sal_Int32 nStartPos, + const lang::Locale&, sal_Int16 CharType ) throw(uno::RuntimeException) + { + const sal_Unicode *pStr = rText.getStr()+nStartPos; + for (sal_Int32 nI = nStartPos; nI < rText.getLength(); ++nI) + { + if (CharType == i18n::CharType::DECIMAL_DIGIT_NUMBER && IS_DIGIT(*pStr)) + return nI; + else if (CharType != i18n::CharType::DECIMAL_DIGIT_NUMBER && !IS_DIGIT(*pStr)) + return nI; + ++pStr; + } + return -1; + } +}; + +void TestString::testNatural() +{ + using namespace comphelper::string; + + uno::Reference< i18n::XCollator > xCollator(new testCollator); + uno::Reference< i18n::XBreakIterator > xBI(new testBreakIterator); + +// --- Some generic tests to ensure we do not alter original behavior +// outside what we want + CPPUNIT_ASSERT( + compareNatural(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(("ABC"))), rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(("ABC"))), xCollator, xBI, lang::Locale()) == 0 + ); + // Case sensitivity + CPPUNIT_ASSERT( + compareNatural(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(("ABC"))), rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(("abc"))), xCollator, xBI, lang::Locale()) < 0 + ); + // Reverse + CPPUNIT_ASSERT( + compareNatural(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(("abc"))), rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(("ABC"))), xCollator, xBI, lang::Locale()) > 0 + ); + // First shorter + CPPUNIT_ASSERT( + compareNatural(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(("alongstring"))), rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(("alongerstring"))), xCollator, xBI, lang::Locale()) > 0 + ); + // Second shorter + CPPUNIT_ASSERT( + compareNatural(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(("alongerstring"))), rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(("alongstring"))), xCollator, xBI, lang::Locale()) < 0 + ); +// -- Here we go on natural order, each one is followed by classic compare and the reverse comparison + // That's why we originally made the patch + CPPUNIT_ASSERT( + compareNatural(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(("Heading 9"))), rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(("Heading 10"))), xCollator, xBI, lang::Locale()) < 0 + ); + // Original behavior + CPPUNIT_ASSERT( + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(("Heading 9"))).compareTo(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(("Heading 10")))) > 0 + ); + CPPUNIT_ASSERT( + compareNatural(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(("Heading 10"))), rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(("Heading 9"))), xCollator, xBI, lang::Locale()) > 0 + ); + // Harder + CPPUNIT_ASSERT( + compareNatural(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(("July, the 4th"))), rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(("July, the 10th"))), xCollator, xBI, lang::Locale()) < 0 + ); + CPPUNIT_ASSERT( + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(("July, the 4th"))).compareTo(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(("July, the 10th")))) > 0 + ); + CPPUNIT_ASSERT( + compareNatural(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(("July, the 10th"))), rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(("July, the 4th"))), xCollator, xBI, lang::Locale()) > 0 + ); + // Hardest + CPPUNIT_ASSERT( + compareNatural(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(("abc08"))), rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(("abc010"))), xCollator, xBI, lang::Locale()) < 0 + ); + CPPUNIT_ASSERT( + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(("abc08"))).compareTo(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(("abc010")))) > 0 + ); + CPPUNIT_ASSERT( + compareNatural(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(("abc010"))), rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(("abc08"))), xCollator, xBI, lang::Locale()) > 0 + ); + CPPUNIT_ASSERT( + compareNatural(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(("apple10apple"))), rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(("apple10apple"))), xCollator, xBI, lang::Locale()) == 0 + ); +} + +CPPUNIT_TEST_SUITE_REGISTRATION(TestString); + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/qa/string/test_string_noadditional.cxx b/comphelper/qa/string/test_string_noadditional.cxx new file mode 100644 index 000000000000..9f3bfe5061ab --- /dev/null +++ b/comphelper/qa/string/test_string_noadditional.cxx @@ -0,0 +1,33 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <cppunit/plugin/TestPlugIn.h> + +CPPUNIT_PLUGIN_IMPLEMENT(); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/qa/test_string.cxx b/comphelper/qa/test_string.cxx deleted file mode 100644 index 648b7a204340..000000000000 --- a/comphelper/qa/test_string.cxx +++ /dev/null @@ -1,82 +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. - * - ************************************************************************/ - -#include "precompiled_comphelper.hxx" -#include "sal/config.h" - -#include "comphelper/string.hxx" -#include "testshl/simpleheader.hxx" -#include "rtl/string.h" -#include "rtl/ustring.h" -#include "rtl/ustring.hxx" -#include "sal/types.h" - -namespace { - -class Test: public CppUnit::TestFixture { -public: - void test(); - - CPPUNIT_TEST_SUITE(Test); - CPPUNIT_TEST(test); - CPPUNIT_TEST_SUITE_END(); -}; - -void Test::test() { - rtl::OUString s1(RTL_CONSTASCII_USTRINGPARAM("foobarbar")); - sal_Int32 n1; - rtl::OUString s2( - comphelper::string::searchAndReplace( - s1, RTL_CONSTASCII_STRINGPARAM("bar"), - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("baaz")), 0, &n1)); - CPPUNIT_ASSERT( - s2 == rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("foobaazbar"))); - CPPUNIT_ASSERT(n1 == 3); - sal_Int32 n2; - rtl::OUString s3( - comphelper::string::searchAndReplace( - s2, RTL_CONSTASCII_STRINGPARAM("bar"), - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("bz")), - n1 + RTL_CONSTASCII_LENGTH("baaz"), &n2)); - CPPUNIT_ASSERT( - s3 == rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("foobaazbz"))); - CPPUNIT_ASSERT(n2 == 7); - sal_Int32 n3; - rtl::OUString s4( - comphelper::string::searchAndReplace( - s3, RTL_CONSTASCII_STRINGPARAM("bar"), - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("baz")), - n2 + RTL_CONSTASCII_LENGTH("bz"), &n3)); - CPPUNIT_ASSERT(s4 == s3); - CPPUNIT_ASSERT(n3 == -1); -} - -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(Test, "alltests"); - -} - -NOADDITIONAL; diff --git a/comphelper/qa/version.map b/comphelper/qa/version.map index 7321bbca16ad..5e95a1532f8a 100644 --- a/comphelper/qa/version.map +++ b/comphelper/qa/version.map @@ -27,8 +27,7 @@ UDK_3_0_0 { global: - registerAllTestFunction; - + cppunitTestPlugIn; local: *; }; diff --git a/comphelper/qa/makefile.mk b/comphelper/qa/weakbag/makefile.mk index 0360d308529e..fdba94838a56 100644 --- a/comphelper/qa/makefile.mk +++ b/comphelper/qa/weakbag/makefile.mk @@ -25,13 +25,14 @@ # #************************************************************************* -PRJ := .. +PRJ := ..$/.. PRJNAME := comphelper -TARGET := qa +TARGET := qa_weakbag ENABLE_EXCEPTIONS := TRUE .INCLUDE: settings.mk +.INCLUDE : $(PRJ)$/version.mk CFLAGSCXX += $(CPPUNIT_CFLAGS) @@ -40,17 +41,13 @@ DLLPRE = # no leading "lib" on .so files INCPRE += $(MISC)$/$(TARGET)$/inc SHL1TARGET = $(TARGET)_weakbag -SHL1OBJS = $(SLO)$/test_weakbag.obj -SHL1STDLIBS = $(CPPUHELPERLIB) $(CPPULIB) $(CPPUNITLIB) $(TESTSHL2LIB) $(SALLIB) -SHL1VERSIONMAP = version.map +SHL1OBJS = $(SLO)$/test_weakbag.obj $(SLO)$/test_weakbag_noadditional.obj +SHL1STDLIBS = $(CPPUHELPERLIB) $(CPPULIB) $(CPPUNITLIB) $(SALLIB) $(COMPHELPERLIB) +SHL1VERSIONMAP = ..$/version.map SHL1IMPLIB = i$(SHL1TARGET) DEF1NAME = $(SHL1TARGET) SLOFILES = $(SHL1OBJS) .INCLUDE: target.mk - -ALLTAR: test - -test .PHONY: $(SHL1TARGETN) - $(TESTSHL2) $(SHL1TARGETN) +.INCLUDE: _cppunit.mk diff --git a/comphelper/qa/test_weakbag.cxx b/comphelper/qa/weakbag/test_weakbag.cxx index 3827e393b58d..84767f0ede0e 100644 --- a/comphelper/qa/test_weakbag.cxx +++ b/comphelper/qa/weakbag/test_weakbag.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,7 +33,10 @@ #include "com/sun/star/uno/XInterface.hpp" #include "comphelper/weakbag.hxx" #include "cppuhelper/weak.hxx" -#include "testshl/simpleheader.hxx" + +#include <cppunit/TestFixture.h> +#include <cppunit/extensions/HelperMacros.h> +#include <cppunit/plugin/TestPlugIn.h> namespace { @@ -63,8 +67,8 @@ public: CPPUNIT_TEST_SUITE_END(); }; -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(Test, "alltests"); +CPPUNIT_TEST_SUITE_REGISTRATION(Test); } -NOADDITIONAL; +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/qa/weakbag/test_weakbag_noadditional.cxx b/comphelper/qa/weakbag/test_weakbag_noadditional.cxx new file mode 100644 index 000000000000..9f3bfe5061ab --- /dev/null +++ b/comphelper/qa/weakbag/test_weakbag_noadditional.cxx @@ -0,0 +1,33 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <cppunit/plugin/TestPlugIn.h> + +CPPUNIT_PLUGIN_IMPLEMENT(); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/compare/AnyCompareFactory.cxx b/comphelper/source/compare/AnyCompareFactory.cxx index 136bff63f69b..074d3a5ffc3a 100644 --- a/comphelper/source/compare/AnyCompareFactory.cxx +++ b/comphelper/source/compare/AnyCompareFactory.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. @@ -49,7 +50,8 @@ using namespace com::sun::star::uno; using namespace com::sun::star::ucb; using namespace com::sun::star::lang; using namespace com::sun::star::i18n; -using namespace rtl; + +using ::rtl::OUString; //============================================================================= @@ -64,7 +66,7 @@ public: if ( xFactory.is() ) { m_rCollator = Reference< XCollator >( - xFactory->createInstanceWithContext( OUString::createFromAscii( "com.sun.star.i18n.Collator" ), xContext ), + xFactory->createInstanceWithContext( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.i18n.Collator" )), xContext ), UNO_QUERY ); m_rCollator->loadDefaultCollator( rLocale, 0 ); //??? @@ -132,7 +134,7 @@ Reference< XAnyCompare > SAL_CALL AnyCompareFactory::createAnyCompareByName( con // for now only OUString properties compare is implemented // so no check for the property name is done - if( aPropertyName.equals( OUString::createFromAscii( "Title" ) ) ) + if( aPropertyName.equals( OUString( RTL_CONSTASCII_USTRINGPARAM( "Title" )) ) ) return m_rAnyCompare; return Reference< XAnyCompare >(); @@ -189,3 +191,5 @@ void createRegistryInfo_AnyCompareFactory() { static ::comphelper::module::OAutoRegistration< AnyCompareFactory > aAutoRegistration; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/container/IndexedPropertyValuesContainer.cxx b/comphelper/source/container/IndexedPropertyValuesContainer.cxx index 928cb78a8b85..4608f9115bcb 100644 --- a/comphelper/source/container/IndexedPropertyValuesContainer.cxx +++ b/comphelper/source/container/IndexedPropertyValuesContainer.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. @@ -38,9 +39,7 @@ #include <com/sun/star/uno/XComponentContext.hpp> -#ifndef __SGI_STL_VECTOR #include <vector> -#endif using namespace com::sun::star; @@ -122,8 +121,8 @@ void SAL_CALL IndexedPropertyValuesContainer::insertByIndex( sal_Int32 nIndex, c sal_Int32 i(0); while(i < nIndex) { - i++; - aItr++; + ++i; + ++aItr; } } else @@ -132,8 +131,8 @@ void SAL_CALL IndexedPropertyValuesContainer::insertByIndex( sal_Int32 nIndex, c sal_Int32 i(nSize - 1); while(i > nIndex) { - i--; - aItr--; + --i; + --aItr; } } maProperties.insert(aItr, aProps); @@ -157,8 +156,8 @@ void SAL_CALL IndexedPropertyValuesContainer::removeByIndex( sal_Int32 nIndex ) sal_Int32 i(0); while(i < nIndex) { - i++; - aItr++; + ++i; + ++aItr; } } else @@ -167,8 +166,8 @@ void SAL_CALL IndexedPropertyValuesContainer::removeByIndex( sal_Int32 nIndex ) sal_Int32 i(nSize - 1); while(i > nIndex) { - i--; - aItr--; + --i; + --aItr; } } maProperties.erase(aItr); @@ -268,3 +267,5 @@ void createRegistryInfo_IndexedPropertyValuesContainer() { static ::comphelper::module::OAutoRegistration< IndexedPropertyValuesContainer > aAutoRegistration; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/container/NamedPropertyValuesContainer.cxx b/comphelper/source/container/NamedPropertyValuesContainer.cxx index e57efaec9118..329e6211c6ea 100644 --- a/comphelper/source/container/NamedPropertyValuesContainer.cxx +++ b/comphelper/source/container/NamedPropertyValuesContainer.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. @@ -237,3 +238,5 @@ void createRegistryInfo_NamedPropertyValuesContainer() { static ::comphelper::module::OAutoRegistration< NamedPropertyValuesContainer > aAutoRegistration; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/container/container.cxx b/comphelper/source/container/container.cxx index 9f834de85b66..ef99066c4bf5 100644 --- a/comphelper/source/container/container.cxx +++ b/comphelper/source/container/container.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. @@ -151,3 +152,4 @@ IndexAccessIterator::~IndexAccessIterator() {} //......................................................................... +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/container/containermultiplexer.cxx b/comphelper/source/container/containermultiplexer.cxx index 176f9cab6f8f..21c72fbbead1 100644 --- a/comphelper/source/container/containermultiplexer.cxx +++ b/comphelper/source/container/containermultiplexer.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. @@ -117,7 +118,7 @@ namespace comphelper } catch(const Exception&) { - OSL_ENSURE(0,"Exceptiopn catched!"); + OSL_FAIL("Exceptiopn caught!"); } ::comphelper::decrement(m_refCount); } @@ -152,7 +153,7 @@ namespace comphelper } catch(const Exception&) { - OSL_ENSURE(0,"Exception catched!"); + OSL_FAIL("Exception caught!"); } m_xContainer = NULL; m_pListener = NULL; @@ -201,3 +202,4 @@ namespace comphelper } // namespace comphelper //......................................................................... +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/container/embeddedobjectcontainer.cxx b/comphelper/source/container/embeddedobjectcontainer.cxx index 17740e7ef09b..9f84b7afa053 100644 --- a/comphelper/source/container/embeddedobjectcontainer.cxx +++ b/comphelper/source/container/embeddedobjectcontainer.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,7 +52,7 @@ #include <comphelper/embeddedobjectcontainer.hxx> #include <comphelper/sequence.hxx> #include <cppuhelper/weakref.hxx> -#include <hash_map> +#include <boost/unordered_map.hpp> #include <algorithm> #include <rtl/logfile.hxx> @@ -77,7 +78,7 @@ struct eqObjectName_Impl } }; -typedef std::hash_map +typedef boost::unordered_map < ::rtl::OUString, ::com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject >, @@ -108,12 +109,12 @@ const uno::Reference < embed::XStorage >& EmbedImpl::GetReplacements() try { mxImageStorage = mxStorage->openStorageElement( - ::rtl::OUString::createFromAscii( "ObjectReplacements" ), embed::ElementModes::READWRITE ); + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ObjectReplacements")), embed::ElementModes::READWRITE ); } catch ( uno::Exception& ) { mxImageStorage = mxStorage->openStorageElement( - ::rtl::OUString::createFromAscii( "ObjectReplacements" ), embed::ElementModes::READ ); + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ObjectReplacements")), embed::ElementModes::READ ); } } @@ -171,7 +172,7 @@ sal_Bool EmbeddedObjectContainer::CommitImageSubStorage() { // get the open mode from the parent storage sal_Int32 nMode = 0; - uno::Any aAny = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("OpenMode") ); + uno::Any aAny = xSet->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OpenMode")) ); if ( aAny >>= nMode ) bReadOnlyMode = !(nMode & embed::ElementModes::WRITE ); } // if ( xSet.is() ) @@ -203,7 +204,7 @@ void EmbeddedObjectContainer::ReleaseImageSubStorage() } catch( uno::Exception& ) { - OSL_ASSERT( "Problems releasing image substorage!\n" ); + OSL_FAIL( "Problems releasing image substorage!\n" ); } } } @@ -317,7 +318,7 @@ sal_Bool EmbeddedObjectContainer::HasInstantiatedEmbeddedObject( const ::rtl::OU aIt++; } - OSL_ENSURE( 0, "Unknown object!" ); + OSL_FAIL( "Unknown object!" ); return ::rtl::OUString(); } @@ -363,7 +364,7 @@ uno::Reference < embed::XEmbeddedObject > EmbeddedObjectContainer::Get_Impl( con { // get the open mode from the parent storage sal_Int32 nMode = 0; - uno::Any aAny = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("OpenMode") ); + uno::Any aAny = xSet->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OpenMode")) ); if ( aAny >>= nMode ) bReadOnlyMode = !(nMode & embed::ElementModes::WRITE ); } @@ -714,8 +715,7 @@ sal_Bool EmbeddedObjectContainer::CopyEmbeddedObject( EmbeddedObjectContainer& r { RTL_LOGFILE_CONTEXT( aLog, "comphelper (mv76033) comphelper::EmbeddedObjectContainer::CopyEmbeddedObject" ); - OSL_ENSURE( sal_False, - "This method is depricated! Use EmbeddedObjectContainer::CopyAndGetEmbeddedObject() to copy object!\n" ); + OSL_FAIL( "This method is depricated! Use EmbeddedObjectContainer::CopyAndGetEmbeddedObject() to copy object!\n" ); // get the object name before(!) it is assigned to a new storage ::rtl::OUString aOrigName; @@ -843,7 +843,7 @@ uno::Reference < embed::XEmbeddedObject > EmbeddedObjectContainer::CopyAndGetEmb { // impossibility to copy readonly property is not treated as an error for now // but the assertion is helpful to detect such scenarios and review them - OSL_ENSURE( sal_False, "Could not copy readonly property!\n" ); + OSL_FAIL( "Could not copy readonly property!\n" ); } } } @@ -911,7 +911,7 @@ sal_Bool EmbeddedObjectContainer::MoveEmbeddedObject( EmbeddedObjectContainer& r catch ( uno::Exception& e ) { (void)e; - OSL_ENSURE( sal_False, "Failed to insert embedded object into storage!" ); + OSL_FAIL( "Failed to insert embedded object into storage!" ); bRet = sal_False; } @@ -943,7 +943,7 @@ sal_Bool EmbeddedObjectContainer::MoveEmbeddedObject( EmbeddedObjectContainer& r } catch ( uno::Exception& ) { - OSL_ENSURE( sal_False, "Failed to remove object from storage!" ); + OSL_FAIL( "Failed to remove object from storage!" ); bRet = sal_False; } } @@ -1008,13 +1008,13 @@ sal_Bool EmbeddedObjectContainer::MoveEmbeddedObject( const ::rtl::OUString& rNa } catch ( uno::Exception& ) { - OSL_ENSURE(0,"Could not move object!"); + OSL_FAIL("Could not move object!"); return sal_False; } } else - OSL_ENSURE(0,"Unknown object!"); + OSL_FAIL("Unknown object!"); return sal_False; } @@ -1030,7 +1030,7 @@ sal_Bool EmbeddedObjectContainer::RemoveEmbeddedObject( const uno::Reference < e #if OSL_DEBUG_LEVEL > 1 uno::Reference < container::XNameAccess > xAccess( pImpl->mxStorage, uno::UNO_QUERY ); uno::Reference < embed::XLinkageSupport > xLink( xPersist, uno::UNO_QUERY ); - sal_Bool bIsNotEmbedded = !xPersist.is() || xLink.is() && xLink->isLink(); + sal_Bool bIsNotEmbedded = !xPersist.is() || ( xLink.is() && xLink->isLink() ); // if the object has a persistance and the object is not a link than it must have persistence entry in the storage OSL_ENSURE( bIsNotEmbedded || xAccess->hasByName(aName), "Removing element not present in storage!" ); @@ -1093,7 +1093,7 @@ sal_Bool EmbeddedObjectContainer::RemoveEmbeddedObject( const uno::Reference < e } catch( uno::Exception& ) { - OSL_ENSURE( sal_False, "Can not set the new media type to a storage!\n" ); + OSL_FAIL( "Can not set the new media type to a storage!\n" ); } } @@ -1135,6 +1135,7 @@ sal_Bool EmbeddedObjectContainer::RemoveEmbeddedObject( const uno::Reference < e } OSL_ENSURE( bFound, "Object not found for removal!" ); + (void)bFound; if ( xPersist.is() ) { // remove replacement image (if there is one) @@ -1152,7 +1153,7 @@ sal_Bool EmbeddedObjectContainer::RemoveEmbeddedObject( const uno::Reference < e } catch ( uno::Exception& ) { - OSL_ENSURE( sal_False, "Failed to remove object from storage!" ); + OSL_FAIL( "Failed to remove object from storage!" ); return sal_False; } } @@ -1216,7 +1217,7 @@ uno::Reference < io::XInputStream > EmbeddedObjectContainer::GetGraphicStream( c uno::Reference < beans::XPropertySet > xSet( xStream, uno::UNO_QUERY ); if ( xSet.is() ) { - uno::Any aAny = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("MediaType") ); + uno::Any aAny = xSet->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MediaType")) ); aAny >>= *pMediaType; } } @@ -1271,13 +1272,13 @@ sal_Bool EmbeddedObjectContainer::InsertGraphicStream( const com::sun::star::uno if ( !xPropSet.is() ) throw uno::RuntimeException(); - xPropSet->setPropertyValue( ::rtl::OUString::createFromAscii( "UseCommonStoragePasswordEncryption" ), + xPropSet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UseCommonStoragePasswordEncryption")), uno::makeAny( (sal_Bool)sal_True ) ); uno::Any aAny; aAny <<= rMediaType; - xPropSet->setPropertyValue( ::rtl::OUString::createFromAscii("MediaType"), aAny ); + xPropSet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MediaType")), aAny ); - xPropSet->setPropertyValue( ::rtl::OUString::createFromAscii( "Compressed" ), + xPropSet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Compressed")), uno::makeAny( (sal_Bool)sal_True ) ); } catch( uno::Exception& ) @@ -1363,7 +1364,7 @@ namespace { } catch( uno::Exception& ) { - OSL_ENSURE( sal_False, "The pictures storage is not available!\n" ); + OSL_FAIL( "The pictures storage is not available!\n" ); } } @@ -1661,3 +1662,5 @@ sal_Bool EmbeddedObjectContainer::SetPersistentEntries(const uno::Reference< emb return bError; } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/container/enumerablemap.cxx b/comphelper/source/container/enumerablemap.cxx index a73983517751..10727897b5a3 100644 --- a/comphelper/source/container/enumerablemap.cxx +++ b/comphelper/source/container/enumerablemap.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. * @@ -174,7 +175,7 @@ namespace comphelper return; } } - OSL_ENSURE( false, "lcl_revokeMapModificationListener: the listener is not registered!" ); + OSL_FAIL( "lcl_revokeMapModificationListener: the listener is not registered!" ); } //-------------------------------------------------------------------- @@ -387,16 +388,16 @@ namespace comphelper Type aKeyType, aValueType; if ( !( _arguments[0] >>= aKeyType ) ) - throw IllegalArgumentException( ::rtl::OUString::createFromAscii( "com.sun.star.uno.Type expected." ), *this, 1 ); + throw IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.uno.Type expected.")), *this, 1 ); if ( !( _arguments[1] >>= aValueType ) ) - throw IllegalArgumentException( ::rtl::OUString::createFromAscii( "com.sun.star.uno.Type expected." ), *this, 2 ); + throw IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.uno.Type expected.")), *this, 2 ); Sequence< Pair< Any, Any > > aInitialValues; bool bMutable = true; if ( nArgumentCount == 3 ) { if ( !( _arguments[2] >>= aInitialValues ) ) - throw IllegalArgumentException( ::rtl::OUString::createFromAscii( "[]com.sun.star.beans.Pair<any,any> expected." ), *this, 2 ); + throw IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("[]com.sun.star.beans.Pair<any,any> expected.")), *this, 2 ); bMutable = false; } @@ -805,3 +806,5 @@ void createRegistryInfo_Map() { ::comphelper::module::OAutoRegistration< ::comphelper::EnumerableMap > aAutoRegistration; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/container/enumhelper.cxx b/comphelper/source/container/enumhelper.cxx index 646bffa9810f..e688c50ab4a6 100644 --- a/comphelper/source/container/enumhelper.cxx +++ b/comphelper/source/container/enumhelper.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. @@ -295,3 +296,4 @@ staruno::Any SAL_CALL OAnyEnumeration::nextElement( ) //......................................................................... +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/container/namecontainer.cxx b/comphelper/source/container/namecontainer.cxx index 7239a8d573dc..48864d779326 100644 --- a/comphelper/source/container/namecontainer.cxx +++ b/comphelper/source/container/namecontainer.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. @@ -209,3 +210,5 @@ Reference< XNameContainer > comphelper::NameContainer_createInstance( Type aType { return (XNameContainer*) new NameContainer( aType ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/eventattachermgr/eventattachermgr.cxx b/comphelper/source/eventattachermgr/eventattachermgr.cxx index bf217f75c8db..dd4fa54f3354 100644 --- a/comphelper/source/eventattachermgr/eventattachermgr.cxx +++ b/comphelper/source/eventattachermgr/eventattachermgr.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. @@ -30,14 +31,11 @@ #include <deque> -#if defined( OS2 ) || defined( UNX ) +#if defined( UNX ) #include <wchar.h> #endif #include <osl/mutex.hxx> -#ifndef _VOS_DIAGNOSE_HXX_ -#include <vos/diagnose.hxx> -#endif -#include <vos/macros.hxx> +#include <osl/diagnose.h> #include <comphelper/eventattachermgr.hxx> #include <com/sun/star/beans/XIntrospection.hpp> #include <com/sun/star/io/XObjectInputStream.hpp> @@ -67,7 +65,8 @@ using namespace com::sun::star::script; using namespace com::sun::star::reflection; using namespace cppu; using namespace osl; -using namespace rtl; + +using ::rtl::OUString; namespace comphelper { @@ -96,32 +95,6 @@ struct AttacherIndex_Impl bool operator==( const AttacherIndex_Impl & ) const; }; -#if 0 -bool AttachedObject_Impl::operator<( const AttachedObject_Impl & r ) const -{ - VOS_ENSHURE( FALSE, "not implemented" ); - return FALSE; - return this < &r; -} - -bool AttachedObject_Impl::operator==( const AttachedObject_Impl & r ) const -{ - VOS_ENSHURE( FALSE, "not implemented" ); - return this == &r; -} - -bool AttacherIndex_Impl::operator<( const AttacherIndex_Impl & r ) const -{ - VOS_ENSHURE( FALSE, "not implemented" ); - return this < &r; -} -bool AttacherIndex_Impl::operator==( const AttacherIndex_Impl & r ) const -{ - VOS_ENSHURE( FALSE, "not implemented" ); - return this == &r; -} -#endif - //----------------------------------------------------------------------------- class ImplEventAttacherManager : public WeakImplHelper2< XEventAttacherManager, XPersistObject > @@ -409,7 +382,7 @@ Reference< XEventAttacherManager > createEventAttacherManager( const Reference< { if ( rSMgr.is() ) { - Reference< XInterface > xIFace( rSMgr->createInstance( OUString::createFromAscii("com.sun.star.beans.Introspection") ) ); + Reference< XInterface > xIFace( rSMgr->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.beans.Introspection" )) ) ); if ( xIFace.is() ) { Reference< XIntrospection > xIntrospection( xIFace, UNO_QUERY); @@ -429,12 +402,12 @@ ImplEventAttacherManager::ImplEventAttacherManager( const Reference< XIntrospect { if ( rSMgr.is() ) { - Reference< XInterface > xIFace( rSMgr->createInstance( OUString::createFromAscii("com.sun.star.script.EventAttacher") ) ); + Reference< XInterface > xIFace( rSMgr->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.script.EventAttacher" )) ) ); if ( xIFace.is() ) { xAttacher = Reference< XEventAttacher >::query( xIFace ); } - xIFace = rSMgr->createInstance( OUString::createFromAscii("com.sun.star.script.Converter") ); + xIFace = rSMgr->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.script.Converter" )) ); if ( xIFace.is() ) { xConverter = Reference< XTypeConverter >::query( xIFace ); @@ -461,7 +434,7 @@ Reference< XIdlReflection > ImplEventAttacherManager::getReflection() throw( Exc // Haben wir den Service schon? Sonst anlegen if( !mxCoreReflection.is() ) { - Reference< XInterface > xIFace( mxSMgr->createInstance( OUString::createFromAscii("com.sun.star.reflection.CoreReflection") ) ); + Reference< XInterface > xIFace( mxSMgr->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.reflection.CoreReflection" )) ) ); mxCoreReflection = Reference< XIdlReflection >( xIFace, UNO_QUERY); } return mxCoreReflection; @@ -497,7 +470,7 @@ void detachAll_Impl while( aObjIt != aObjEnd ) { pMgr->detach( nIdx, (*aObjIt).xTarget ); - aObjIt++; + ++aObjIt; } } @@ -514,7 +487,7 @@ void attachAll_Impl while( aObjIt != aObjEnd ) { pMgr->attach( nIdx, (*aObjIt).xTarget, (*aObjIt).aHelper ); - aObjIt++; + ++aObjIt; } } @@ -568,7 +541,7 @@ void SAL_CALL ImplEventAttacherManager::registerScriptEvent { } - aObjIt++; + ++aObjIt; } } @@ -632,7 +605,7 @@ void SAL_CALL ImplEventAttacherManager::revokeScriptEvent break; } - aEvtIt++; + ++aEvtIt; } #else Sequence< ScriptEventDescriptor >& rEventList = (*aIt).aEventList; @@ -725,7 +698,7 @@ Sequence< ScriptEventDescriptor > SAL_CALL ImplEventAttacherManager::getScriptEv while( aEvtIt != aEvtEnd ) { pArray[i++] = *aEvtIt; - aEvtIt++; + ++aEvtIt; } return aSeq; #else @@ -790,7 +763,7 @@ void SAL_CALL ImplEventAttacherManager::attach(sal_Int32 nIndex, const Reference } pArray[i++] = xAdapter; - aEvtIt++; + ++aEvtIt; } #else sal_Int32 nLen = aCurrentPosition->aEventList.getLength(); @@ -851,7 +824,7 @@ void SAL_CALL ImplEventAttacherManager::detach(sal_Int32 nIndex, const Reference } } i++; - aEvtIt++; + ++aEvtIt; } #else sal_Int32 nLen = aCurrentPosition->aEventList.getLength(); @@ -874,7 +847,7 @@ void SAL_CALL ImplEventAttacherManager::detach(sal_Int32 nIndex, const Reference aCurrentPosition->aObjList.erase( aObjIt ); break; } - aObjIt++; + ++aObjIt; } } @@ -937,7 +910,7 @@ void SAL_CALL ImplEventAttacherManager::write(const Reference< XObjectOutputStre OutStream->writeUTF( rDesc.ScriptType ); OutStream->writeUTF( rDesc.ScriptCode ); - aEvtIt++; + ++aEvtIt; } #else sal_Int32 nLen = (*aIt).aEventList.getLength(); @@ -954,7 +927,7 @@ void SAL_CALL ImplEventAttacherManager::write(const Reference< XObjectOutputStre OutStream->writeUTF( rDesc.ScriptCode ); } #endif - aIt++; + ++aIt; } // Die jetzt bekannte Laenge eintragen @@ -1016,7 +989,7 @@ void SAL_CALL ImplEventAttacherManager::read(const Reference< XObjectInputStream // Ganze richtig sein. Sonst ist etwas voellig daneben gegangen. if( nRealLen > nLen || nVersion == 1 ) { - VOS_ENSHURE( sal_False, "ImplEventAttacherManager::read(): Fatal Error, wrong object length" ); + OSL_FAIL( "ImplEventAttacherManager::read(): Fatal Error, wrong object length" ); } else { @@ -1034,3 +1007,4 @@ void SAL_CALL ImplEventAttacherManager::read(const Reference< XObjectInputStream } // namesapce comphelper +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/inc/comphelper_module.hxx b/comphelper/source/inc/comphelper_module.hxx index ea2fc7eeb4eb..9f8e32656715 100644 --- a/comphelper/source/inc/comphelper_module.hxx +++ b/comphelper/source/inc/comphelper_module.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. * @@ -41,3 +42,5 @@ namespace comphelper { namespace module //........................................................................ #endif // COMPHELPER_COMPHELPER_MODULE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 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: */ diff --git a/comphelper/source/officeinstdir/officeinstallationdirectories.cxx b/comphelper/source/officeinstdir/officeinstallationdirectories.cxx index ebeedc92839d..35bcfecc7f9d 100644 --- a/comphelper/source/officeinstdir/officeinstallationdirectories.cxx +++ b/comphelper/source/officeinstdir/officeinstallationdirectories.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. @@ -66,7 +67,7 @@ static bool makeCanonicalFileURL( rtl::OUString & rURL ) if ( osl::DirectoryItem::get( aNormalizedURL, aDirItem ) == osl::DirectoryItem::E_None ) { - osl::FileStatus aFileStatus( FileStatusMask_FileURL ); + osl::FileStatus aFileStatus( osl_FileStatus_Mask_FileURL ); if ( aDirItem.getFileStatus( aFileStatus ) == osl::DirectoryItem::E_None ) @@ -161,9 +162,9 @@ OfficeInstallationDirectories::makeRelocatableURL( const rtl::OUString& URL ) if ( nIndex != -1 ) { return rtl::OUString( - URL.replaceAt( nIndex, - m_pOfficeBrandDir->getLength(), - m_aOfficeBrandDirMacro ) ); + aCanonicalURL.replaceAt( nIndex, + m_pOfficeBrandDir->getLength(), + m_aOfficeBrandDirMacro ) ); } else { @@ -171,9 +172,9 @@ OfficeInstallationDirectories::makeRelocatableURL( const rtl::OUString& URL ) if ( nIndex != -1 ) { return rtl::OUString( - URL.replaceAt( nIndex, - m_pOfficeBaseDir->getLength(), - m_aOfficeBaseDirMacro ) ); + aCanonicalURL.replaceAt( nIndex, + m_pOfficeBaseDir->getLength(), + m_aOfficeBaseDirMacro ) ); } else { @@ -181,9 +182,9 @@ OfficeInstallationDirectories::makeRelocatableURL( const rtl::OUString& URL ) if ( nIndex != -1 ) { return rtl::OUString( - URL.replaceAt( nIndex, - m_pUserDir->getLength(), - m_aUserDirMacro ) ); + aCanonicalURL.replaceAt( nIndex, + m_pUserDir->getLength(), + m_aUserDirMacro ) ); } } } @@ -382,3 +383,5 @@ void createRegistryInfo_OfficeInstallationDirectories() { static ::comphelper::module::OSingletonRegistration< OfficeInstallationDirectories > aAutoRegistration; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/officeinstdir/officeinstallationdirectories.hxx b/comphelper/source/officeinstdir/officeinstallationdirectories.hxx index 9c56f7ce80fd..00f5b81df3f9 100644 --- a/comphelper/source/officeinstdir/officeinstallationdirectories.hxx +++ b/comphelper/source/officeinstdir/officeinstallationdirectories.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. @@ -107,3 +108,5 @@ private: } // namespace comphelper #endif /* !INCLUDED_OFFICEINSTALLATIONDIRECTORIES_HXX */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/processfactory/componentfactory.cxx b/comphelper/source/processfactory/componentfactory.cxx index 7a3b17111072..ec72a25dc615 100644 --- a/comphelper/source/processfactory/componentfactory.cxx +++ b/comphelper/source/processfactory/componentfactory.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. @@ -31,16 +32,10 @@ #include <comphelper/processfactory.hxx> #include <com/sun/star/lang/XMultiServiceFactory.hpp> -#ifndef _COM_SUN_STAR_REGISTRY_XREGISTRYKEY_HDL_ #include <com/sun/star/registry/XRegistryKey.hpp> -#endif #include <cppuhelper/shlib.hxx> -#ifndef GCC -#endif - - using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; @@ -84,3 +79,5 @@ Reference< XSingleServiceFactory > loadLibComponentFactory( } } // namespace comphelper + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/processfactory/processfactory.cxx b/comphelper/source/processfactory/processfactory.cxx index 514d3377edab..f9b2218f7018 100644 --- a/comphelper/source/processfactory/processfactory.cxx +++ b/comphelper/source/processfactory/processfactory.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 @@ uno::XComponentContext * comphelper_getProcessComponentContext() } } // extern "C" +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/property/ChainablePropertySet.cxx b/comphelper/source/property/ChainablePropertySet.cxx index 936510f21309..e3a02dce4c1b 100644 --- a/comphelper/source/property/ChainablePropertySet.cxx +++ b/comphelper/source/property/ChainablePropertySet.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,7 +30,7 @@ #include "precompiled_comphelper.hxx" #include <comphelper/ChainablePropertySet.hxx> #include <comphelper/ChainablePropertySetInfo.hxx> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <memory> // STL auto_ptr @@ -40,9 +41,8 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::beans; -using ::vos::IMutex; -ChainablePropertySet::ChainablePropertySet( comphelper::ChainablePropertySetInfo* pInfo, vos::IMutex *pMutex ) +ChainablePropertySet::ChainablePropertySet( comphelper::ChainablePropertySetInfo* pInfo, osl::SolarMutex* pMutex ) throw() : mpInfo ( pInfo ) , mpMutex ( pMutex ) @@ -78,9 +78,9 @@ void SAL_CALL ChainablePropertySet::setPropertyValue( const ::rtl::OUString& rPr throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException) { // acquire mutex in c-tor and releases it in the d-tor (exception safe!). - std::auto_ptr< vos::OGuard > pMutexGuard; + std::auto_ptr< osl::SolarGuard > pMutexGuard; if (mpMutex) - pMutexGuard.reset( new vos::OGuard(mpMutex) ); + pMutexGuard.reset( new osl::SolarGuard(mpMutex) ); PropertyInfoHash::const_iterator aIter = mpInfo->maMap.find ( rPropertyName ); @@ -96,9 +96,9 @@ Any SAL_CALL ChainablePropertySet::getPropertyValue( const ::rtl::OUString& rPro throw(UnknownPropertyException, WrappedTargetException, RuntimeException) { // acquire mutex in c-tor and releases it in the d-tor (exception safe!). - std::auto_ptr< vos::OGuard > pMutexGuard; + std::auto_ptr< osl::SolarGuard > pMutexGuard; if (mpMutex) - pMutexGuard.reset( new vos::OGuard(mpMutex) ); + pMutexGuard.reset( new osl::SolarGuard(mpMutex) ); PropertyInfoHash::const_iterator aIter = mpInfo->maMap.find ( rPropertyName ); @@ -142,9 +142,9 @@ void SAL_CALL ChainablePropertySet::setPropertyValues( const Sequence< ::rtl::OU throw(PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException) { // acquire mutex in c-tor and releases it in the d-tor (exception safe!). - std::auto_ptr< vos::OGuard > pMutexGuard; + std::auto_ptr< osl::SolarGuard > pMutexGuard; if (mpMutex) - pMutexGuard.reset( new vos::OGuard(mpMutex) ); + pMutexGuard.reset( new osl::SolarGuard(mpMutex) ); const sal_Int32 nCount = aPropertyNames.getLength(); @@ -176,9 +176,9 @@ Sequence< Any > SAL_CALL ChainablePropertySet::getPropertyValues( const Sequence throw(RuntimeException) { // acquire mutex in c-tor and releases it in the d-tor (exception safe!). - std::auto_ptr< vos::OGuard > pMutexGuard; + std::auto_ptr< osl::SolarGuard > pMutexGuard; if (mpMutex) - pMutexGuard.reset( new vos::OGuard(mpMutex) ); + pMutexGuard.reset( new osl::SolarGuard(mpMutex) ); const sal_Int32 nCount = aPropertyNames.getLength(); @@ -290,32 +290,34 @@ Any SAL_CALL ChainablePropertySet::getPropertyDefault( const ::rtl::OUString& rP void ChainablePropertySet::_preGetPropertyState () throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException ) { - OSL_ENSURE( sal_False, "you have to implement this yourself!"); + OSL_FAIL( "you have to implement this yourself!"); } void ChainablePropertySet::_getPropertyState( const comphelper::PropertyInfo&, PropertyState& ) throw(UnknownPropertyException ) { - OSL_ENSURE( sal_False, "you have to implement this yourself!"); + OSL_FAIL( "you have to implement this yourself!"); } void ChainablePropertySet::_postGetPropertyState () throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException ) { - OSL_ENSURE( sal_False, "you have to implement this yourself!"); + OSL_FAIL( "you have to implement this yourself!"); } void ChainablePropertySet::_setPropertyToDefault( const comphelper::PropertyInfo& ) throw(UnknownPropertyException ) { - OSL_ENSURE( sal_False, "you have to implement this yourself!"); + OSL_FAIL( "you have to implement this yourself!"); } Any ChainablePropertySet::_getPropertyDefault( const comphelper::PropertyInfo& ) throw(UnknownPropertyException, WrappedTargetException ) { - OSL_ENSURE( sal_False, "you have to implement this yourself!"); + OSL_FAIL( "you have to implement this yourself!"); Any aAny; return aAny; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/property/ChainablePropertySetInfo.cxx b/comphelper/source/property/ChainablePropertySetInfo.cxx index 6660517ef97e..0f53c6d0260b 100644 --- a/comphelper/source/property/ChainablePropertySetInfo.cxx +++ b/comphelper/source/property/ChainablePropertySetInfo.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. @@ -76,7 +77,7 @@ void ChainablePropertySetInfo::add( PropertyInfo* pMap, sal_Int32 nCount ) #ifdef DBG_UTIL PropertyInfoHash::iterator aIter = maMap.find( aName ); if( aIter != maMap.end() ) - OSL_ENSURE( sal_False, "Warning: PropertyInfo added twice, possible error!"); + OSL_FAIL( "Warning: PropertyInfo added twice, possible error!"); #endif maMap[aName] = pMap++; } @@ -140,3 +141,5 @@ sal_Bool SAL_CALL ChainablePropertySetInfo::hasPropertyByName( const ::rtl::OUSt { return static_cast < sal_Bool > ( maMap.find ( rName ) != maMap.end() ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/property/MasterPropertySet.cxx b/comphelper/source/property/MasterPropertySet.cxx index 28078a8019fc..78f33af7aed0 100644 --- a/comphelper/source/property/MasterPropertySet.cxx +++ b/comphelper/source/property/MasterPropertySet.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,13 +29,11 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_comphelper.hxx" -#ifndef _COMPHELPER_MASTERPROPERTYSET_HXX_ #include <comphelper/MasterPropertySet.hxx> -#endif #include <comphelper/MasterPropertySetInfo.hxx> #include <comphelper/ChainablePropertySet.hxx> #include <comphelper/ChainablePropertySetInfo.hxx> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <memory> // STL auto_ptr @@ -43,19 +42,19 @@ class AutoOGuardArray { sal_Int32 nSize; - std::auto_ptr< vos::OGuard > * pGuardArray; + std::auto_ptr< osl::SolarGuard > * pGuardArray; public: AutoOGuardArray( sal_Int32 nNumElements ); ~AutoOGuardArray(); - std::auto_ptr< vos::OGuard > & operator[] ( sal_Int32 i ) { return pGuardArray[i]; } + std::auto_ptr< osl::SolarGuard > & operator[] ( sal_Int32 i ) { return pGuardArray[i]; } }; AutoOGuardArray::AutoOGuardArray( sal_Int32 nNumElements ) { nSize = nNumElements; - pGuardArray = new std::auto_ptr< vos::OGuard >[ nSize ]; + pGuardArray = new std::auto_ptr< osl::SolarGuard >[ nSize ]; } AutoOGuardArray::~AutoOGuardArray() @@ -73,7 +72,7 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::beans; -using vos::IMutex; + SlaveData::SlaveData ( ChainablePropertySet *pSlave) : mpSlave ( pSlave ) @@ -82,7 +81,7 @@ SlaveData::SlaveData ( ChainablePropertySet *pSlave) { } -MasterPropertySet::MasterPropertySet( comphelper::MasterPropertySetInfo* pInfo, IMutex *pMutex ) +MasterPropertySet::MasterPropertySet( comphelper::MasterPropertySetInfo* pInfo, osl::SolarMutex* pMutex ) throw() : mpInfo ( pInfo ) , mpMutex ( pMutex ) @@ -109,7 +108,7 @@ MasterPropertySet::~MasterPropertySet() while (aIter != aEnd ) { delete (*aIter).second; - aIter++; + ++aIter; } } @@ -131,9 +130,9 @@ void SAL_CALL MasterPropertySet::setPropertyValue( const ::rtl::OUString& rPrope throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException) { // acquire mutex in c-tor and releases it in the d-tor (exception safe!). - std::auto_ptr< vos::OGuard > pMutexGuard; + std::auto_ptr< osl::SolarGuard > pMutexGuard; if (mpMutex) - pMutexGuard.reset( new vos::OGuard(mpMutex) ); + pMutexGuard.reset( new osl::SolarGuard(mpMutex) ); PropertyDataHash::const_iterator aIter = mpInfo->maMap.find ( rPropertyName ); @@ -151,9 +150,9 @@ void SAL_CALL MasterPropertySet::setPropertyValue( const ::rtl::OUString& rPrope ChainablePropertySet * pSlave = maSlaveMap [ (*aIter).second->mnMapId ]->mpSlave; // acquire mutex in c-tor and releases it in the d-tor (exception safe!). - std::auto_ptr< vos::OGuard > pMutexGuard2; + std::auto_ptr< osl::SolarGuard > pMutexGuard2; if (pSlave->mpMutex) - pMutexGuard2.reset( new vos::OGuard(pSlave->mpMutex) ); + pMutexGuard2.reset( new osl::SolarGuard(pSlave->mpMutex) ); pSlave->_preSetValues(); pSlave->_setSingleValue( *((*aIter).second->mpInfo), rValue ); @@ -165,9 +164,9 @@ Any SAL_CALL MasterPropertySet::getPropertyValue( const ::rtl::OUString& rProper throw(UnknownPropertyException, WrappedTargetException, RuntimeException) { // acquire mutex in c-tor and releases it in the d-tor (exception safe!). - std::auto_ptr< vos::OGuard > pMutexGuard; + std::auto_ptr< osl::SolarGuard > pMutexGuard; if (mpMutex) - pMutexGuard.reset( new vos::OGuard(mpMutex) ); + pMutexGuard.reset( new osl::SolarGuard(mpMutex) ); PropertyDataHash::const_iterator aIter = mpInfo->maMap.find ( rPropertyName ); @@ -186,9 +185,9 @@ Any SAL_CALL MasterPropertySet::getPropertyValue( const ::rtl::OUString& rProper ChainablePropertySet * pSlave = maSlaveMap [ (*aIter).second->mnMapId ]->mpSlave; // acquire mutex in c-tor and releases it in the d-tor (exception safe!). - std::auto_ptr< vos::OGuard > pMutexGuard2; + std::auto_ptr< osl::SolarGuard > pMutexGuard2; if (pSlave->mpMutex) - pMutexGuard2.reset( new vos::OGuard(pSlave->mpMutex) ); + pMutexGuard2.reset( new osl::SolarGuard(pSlave->mpMutex) ); pSlave->_preGetValues(); pSlave->_getSingleValue( *((*aIter).second->mpInfo), aAny ); @@ -226,9 +225,9 @@ void SAL_CALL MasterPropertySet::setPropertyValues( const Sequence< ::rtl::OUStr throw(PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException) { // acquire mutex in c-tor and releases it in the d-tor (exception safe!). - std::auto_ptr< vos::OGuard > pMutexGuard; + std::auto_ptr< osl::SolarGuard > pMutexGuard; if (mpMutex) - pMutexGuard.reset( new vos::OGuard(mpMutex) ); + pMutexGuard.reset( new osl::SolarGuard(mpMutex) ); const sal_Int32 nCount = aPropertyNames.getLength(); @@ -265,7 +264,7 @@ void SAL_CALL MasterPropertySet::setPropertyValues( const Sequence< ::rtl::OUStr { // acquire mutex in c-tor and releases it in the d-tor (exception safe!). if (pSlave->mpSlave->mpMutex) - aOGuardArray[i].reset( new vos::OGuard(pSlave->mpSlave->mpMutex) ); + aOGuardArray[i].reset( new osl::SolarGuard(pSlave->mpSlave->mpMutex) ); pSlave->mpSlave->_preSetValues(); pSlave->SetInit ( sal_True ); @@ -292,9 +291,9 @@ Sequence< Any > SAL_CALL MasterPropertySet::getPropertyValues( const Sequence< : throw(RuntimeException) { // acquire mutex in c-tor and releases it in the d-tor (exception safe!). - std::auto_ptr< vos::OGuard > pMutexGuard; + std::auto_ptr< osl::SolarGuard > pMutexGuard; if (mpMutex) - pMutexGuard.reset( new vos::OGuard(mpMutex) ); + pMutexGuard.reset( new osl::SolarGuard(mpMutex) ); const sal_Int32 nCount = aPropertyNames.getLength(); @@ -330,7 +329,7 @@ Sequence< Any > SAL_CALL MasterPropertySet::getPropertyValues( const Sequence< : { // acquire mutex in c-tor and releases it in the d-tor (exception safe!). if (pSlave->mpSlave->mpMutex) - aOGuardArray[i].reset( new vos::OGuard(pSlave->mpSlave->mpMutex) ); + aOGuardArray[i].reset( new osl::SolarGuard(pSlave->mpSlave->mpMutex) ); pSlave->mpSlave->_preGetValues(); pSlave->SetInit ( sal_True ); @@ -393,9 +392,9 @@ PropertyState SAL_CALL MasterPropertySet::getPropertyState( const ::rtl::OUStrin ChainablePropertySet * pSlave = maSlaveMap [ (*aIter).second->mnMapId ]->mpSlave; // acquire mutex in c-tor and releases it in the d-tor (exception safe!). - std::auto_ptr< vos::OGuard > pMutexGuard; + std::auto_ptr< osl::SolarGuard > pMutexGuard; if (pSlave->mpMutex) - pMutexGuard.reset( new vos::OGuard(pSlave->mpMutex) ); + pMutexGuard.reset( new osl::SolarGuard(pSlave->mpMutex) ); pSlave->_preGetPropertyState(); pSlave->_getPropertyState( *((*aIter).second->mpInfo), aState ); @@ -475,31 +474,33 @@ Any SAL_CALL MasterPropertySet::getPropertyDefault( const ::rtl::OUString& rProp void MasterPropertySet::_preGetPropertyState () throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException ) { - OSL_ENSURE( sal_False, "you have to implement this yourself!"); + OSL_FAIL( "you have to implement this yourself!"); } void MasterPropertySet::_getPropertyState( const comphelper::PropertyInfo&, PropertyState& ) throw(UnknownPropertyException ) { - OSL_ENSURE( sal_False, "you have to implement this yourself!"); + OSL_FAIL( "you have to implement this yourself!"); } void MasterPropertySet::_postGetPropertyState () throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException ) { - OSL_ENSURE( sal_False, "you have to implement this yourself!"); + OSL_FAIL( "you have to implement this yourself!"); } void MasterPropertySet::_setPropertyToDefault( const comphelper::PropertyInfo& ) throw(UnknownPropertyException ) { - OSL_ENSURE( sal_False, "you have to implement this yourself!"); + OSL_FAIL( "you have to implement this yourself!"); } Any MasterPropertySet::_getPropertyDefault( const comphelper::PropertyInfo& ) throw(UnknownPropertyException, WrappedTargetException ) { - OSL_ENSURE( sal_False, "you have to implement this yourself!"); + OSL_FAIL( "you have to implement this yourself!"); Any aAny; return aAny; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/property/MasterPropertySetInfo.cxx b/comphelper/source/property/MasterPropertySetInfo.cxx index 57cf22b77508..46dffe062c03 100644 --- a/comphelper/source/property/MasterPropertySetInfo.cxx +++ b/comphelper/source/property/MasterPropertySetInfo.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. @@ -27,9 +28,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_comphelper.hxx" -#ifndef _COMPHELPER_CHAINABLEPROPERTYSETINFO_HXX_ #include <comphelper/MasterPropertySetInfo.hxx> -#endif #include <comphelper/TypeGeneration.hxx> using ::rtl::OUString; @@ -64,7 +63,7 @@ MasterPropertySetInfo::~MasterPropertySetInfo() while (aIter != aEnd ) { delete (*aIter).second; - aIter++; + ++aIter; } } @@ -84,7 +83,7 @@ void MasterPropertySetInfo::add( PropertyInfo* pMap, sal_Int32 nCount, sal_uInt8 #ifdef DBG_UTIL PropertyDataHash::iterator aIter = maMap.find( aName ); if( aIter != maMap.end() ) - OSL_ENSURE( sal_False, "Warning: PropertyInfo added twice, possible error!"); + OSL_FAIL( "Warning: PropertyInfo added twice, possible error!"); #endif maMap[aName] = new PropertyData ( nMapId, pMap ); } @@ -102,10 +101,10 @@ void MasterPropertySetInfo::add( PropertyInfoHash &rHash, sal_uInt8 nMapId ) #ifdef DBG_UTIL PropertyDataHash::iterator aDebugIter = maMap.find( (*aIter).first ); if( aDebugIter != maMap.end() ) - OSL_ENSURE( sal_False, "Warning: PropertyInfo added twice, possible error!"); + OSL_FAIL( "Warning: PropertyInfo added twice, possible error!"); #endif maMap[(*aIter).first] = new PropertyData ( nMapId, (*aIter).second ); - aIter++; + ++aIter; } } @@ -168,3 +167,5 @@ sal_Bool SAL_CALL MasterPropertySetInfo::hasPropertyByName( const ::rtl::OUStrin { return static_cast < sal_Bool > ( maMap.find ( rName ) != maMap.end() ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/property/TypeGeneration.cxx b/comphelper/source/property/TypeGeneration.cxx index 649e50711d28..6c5f9e009e90 100644 --- a/comphelper/source/property/TypeGeneration.cxx +++ b/comphelper/source/property/TypeGeneration.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. @@ -27,9 +28,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_comphelper.hxx" -#ifndef _COMPHELPER_TYPEGENERATION_HXX #include <comphelper/TypeGeneration.hxx> -#endif #include <com/sun/star/script/XLibraryContainer.hpp> #include <com/sun/star/style/LineSpacingMode.hpp> #include <com/sun/star/style/ParagraphAdjust.hpp> @@ -97,9 +96,7 @@ #include <com/sun/star/beans/XVetoableChangeListener.hpp> #include <com/sun/star/beans/XPropertyState.hpp> #include <com/sun/star/beans/XPropertyStateChangeListener.hpp> -#ifndef _COM_SUN_STAR_BEANS_PropertyAttribute_HPP_ #include <com/sun/star/beans/PropertyAttribute.hpp> -#endif #include <com/sun/star/beans/XPropertiesChangeListener.hpp> #include <com/sun/star/beans/XPropertyChangeListener.hpp> #include <com/sun/star/beans/XPropertyAccess.hpp> @@ -129,9 +126,8 @@ #include <com/sun/star/sdbc/XResultSet.hpp> #include <com/sun/star/sdbc/XConnection.hpp> #include <com/sun/star/frame/XModel.hpp> -// --> OD 2004-08-09 #i28749# +// #i28749# #include <com/sun/star/drawing/HomogenMatrix3.hpp> -// <-- #include <com/sun/star/graphic/XGraphic.hpp> #include <com/sun/star/embed/XEmbeddedObject.hpp> @@ -221,19 +217,20 @@ namespace comphelper case CPPUTYPE_REFCONNECTION: pType = &::getCppuType( (Reference< sdbc::XConnection >*)0); break; case CPPUTYPE_REFMODEL: pType = &::getCppuType( (Reference< frame::XModel >*)0); break; case CPPUTYPE_REFCOMPONENT: pType = &::getCppuType( (Reference< lang::XComponent >*)0 ); break; - // --> OD 2004-08-09 #i28749# + // #i28749# case CPPUTYPE_TRANSFORMATIONINHORIL2R: { pType = &::getCppuType( (drawing::HomogenMatrix3*)0 ); } break; - // <-- case CPPUTYPE_SEQNAMEDVALUE: pType = &::getCppuType( (Sequence<beans::NamedValue>*)0 ); break; case CPPUTYPE_REFXGRAPHIC: pType = &::getCppuType( (Reference< graphic::XGraphic >*)0); break; case CPPUTYPE_TABLEBORDERDISTANCES: pType = &::getCppuType( (table::TableBorderDistances*)0 ); break; case CPPUTPYE_REFEMBEDDEDOBJECT: pType = &embed::XEmbeddedObject::static_type(); break; default: - OSL_ASSERT( "Unknown CPPU type" ); + OSL_FAIL( "Unknown CPPU type" ); } } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/property/composedprops.cxx b/comphelper/source/property/composedprops.cxx index 4b44a8fb474e..aa864f7ca47f 100644 --- a/comphelper/source/property/composedprops.cxx +++ b/comphelper/source/property/composedprops.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. @@ -299,13 +300,13 @@ namespace comphelper //------------------------------------------------------------------------------ void SAL_CALL OComposedPropertySet::addVetoableChangeListener( const ::rtl::OUString&, const Reference< XVetoableChangeListener >& ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException) { - OSL_ENSURE(sal_False, "OComposedPropertySet::addVetoableChangeListener: no implemented (yet)!"); + OSL_FAIL("OComposedPropertySet::addVetoableChangeListener: no implemented (yet)!"); } //------------------------------------------------------------------------------ void SAL_CALL OComposedPropertySet::removeVetoableChangeListener( const ::rtl::OUString&, const Reference< XVetoableChangeListener >& ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException) { - OSL_ENSURE(sal_False, "OComposedPropertySet::removeVetoableChangeListener: no implemented (yet)!"); + OSL_FAIL("OComposedPropertySet::removeVetoableChangeListener: no implemented (yet)!"); } //------------------------------------------------------------------------------ @@ -355,3 +356,4 @@ namespace comphelper //......................................................................... +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/property/genericpropertyset.cxx b/comphelper/source/property/genericpropertyset.cxx index b7fb09912153..008646001331 100644 --- a/comphelper/source/property/genericpropertyset.cxx +++ b/comphelper/source/property/genericpropertyset.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. @@ -36,11 +37,9 @@ #include <comphelper/genericpropertyset.hxx> #include <comphelper/propertysetinfo.hxx> #include <comphelper/stl_types.hxx> -#include <vos/mutex.hxx> +#include <comphelper/servicehelper.hxx> +#include <osl/mutex.hxx> #include <rtl/uuid.h> -#include <boost/mem_fn.hpp> -#include <boost/bind.hpp> -#include <boost/utility.hpp> /////////////////////////////////////////////////////////////////////// @@ -253,18 +252,15 @@ uno::Sequence< uno::Type > SAL_CALL GenericPropertySet::getTypes() return aTypes; } +namespace +{ + class theGenericPropertySetImplmentationId : public rtl::Static< UnoTunnelIdInit, theGenericPropertySetImplmentationId > {}; +} + uno::Sequence< sal_Int8 > SAL_CALL GenericPropertySet::getImplementationId() throw (uno::RuntimeException) { - MutexGuard aGuard( maMutex ); - - static uno::Sequence< sal_Int8 > aId; - if( aId.getLength() == 0 ) - { - aId.realloc( 16 ); - rtl_createUuid( (sal_uInt8 *)aId.getArray(), 0, sal_True ); - } - return aId; + return theGenericPropertySetImplmentationId::get().getSeq(); } // XServiceInfo @@ -299,3 +295,4 @@ Sequence< OUString > SAL_CALL GenericPropertySet::getSupportedServiceNames( ) return (XPropertySet*)new GenericPropertySet( pInfo ); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/property/opropertybag.cxx b/comphelper/source/property/opropertybag.cxx index f1282a48c2dd..c67605977ddf 100644 --- a/comphelper/source/property/opropertybag.cxx +++ b/comphelper/source/property/opropertybag.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. @@ -42,6 +43,7 @@ #include <algorithm> #include <functional> +#include <iterator> //-------------------------------------------------------------------------- @@ -484,8 +486,6 @@ namespace comphelper try { - ::cppu::IPropertyArrayHelper& rPropInfo = getInfoHelper(); - // check for unknown properties // we cannot simply rely on the XMultiPropertySet::setPropertyValues // implementation of our base class, since it does not throw @@ -502,6 +502,7 @@ namespace comphelper ++pName, ++pHandle, ++pProperty ) { + ::cppu::IPropertyArrayHelper& rPropInfo = getInfoHelper(); *pHandle = rPropInfo.getHandleByName( *pName ); if ( *pHandle != -1 ) continue; @@ -512,9 +513,6 @@ namespace comphelper // add the property sal_Int16 nAttributes = PropertyAttribute::BOUND | PropertyAttribute::REMOVEABLE | PropertyAttribute::MAYBEDEFAULT; addProperty( *pName, nAttributes, pProperty->Value ); - // rPropInfo is invalid, refetch - rPropInfo = getInfoHelper(); - *pHandle = rPropInfo.getHandleByName( *pName ); continue; } @@ -583,3 +581,4 @@ namespace comphelper } // namespace comphelper //........................................................................ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/property/opropertybag.hxx b/comphelper/source/property/opropertybag.hxx index 3b9549f7c023..6d0a6e1f4f54 100644 --- a/comphelper/source/property/opropertybag.hxx +++ b/comphelper/source/property/opropertybag.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. @@ -240,3 +241,5 @@ namespace comphelper //........................................................................ #endif // COMPHELPER_OPROPERTYBAG_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/property/propagg.cxx b/comphelper/source/property/propagg.cxx index 9c2fd868d973..b83c292689dc 100644 --- a/comphelper/source/property/propagg.cxx +++ b/comphelper/source/property/propagg.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. @@ -746,7 +747,7 @@ void SAL_CALL OPropertySetAggregationHelper::setPropertyValues( aMessage.append( "\n(implementation " ); aMessage.append( typeid( *this ).name() ); aMessage.append( ")" ); - OSL_ENSURE( false, aMessage.getStr() ); + OSL_FAIL( aMessage.getStr() ); #endif } } @@ -766,7 +767,6 @@ void SAL_CALL OPropertySetAggregationHelper::setPropertyValues( throw WrappedTargetException( ::rtl::OUString(), static_cast< XMultiPropertySet* >( this ), makeAny( UnknownPropertyException( ) ) ); // due to a flaw in the API design, this method is not allowed to throw an UnknownPropertyException // so we wrap it into a WrappedTargetException - // #107545# - 2002-02-20 - fs@openoffice.org if ( OPropertyArrayAggregationHelper::AGGREGATE_PROPERTY == ePropOrg ) ++nAggCount; @@ -959,7 +959,7 @@ void SAL_CALL OPropertySetAggregationHelper::setPropertyToDefault(const ::rtl::O catch( const RuntimeException& ) { throw; } catch( const Exception& ) { - OSL_ENSURE( sal_False, "OPropertySetAggregationHelper::setPropertyToDefault: caught an exception which is not allowed to leave here!" ); + OSL_FAIL( "OPropertySetAggregationHelper::setPropertyToDefault: caught an exception which is not allowed to leave here!" ); } } } @@ -1045,3 +1045,4 @@ bool OPropertySetAggregationHelper::isCurrentlyForwardingProperty( sal_Int32 _nH } // namespace comphelper //......................................................................... +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/property/property.cxx b/comphelper/source/property/property.cxx index 6ab48aa1965b..37bb62cc98ef 100644 --- a/comphelper/source/property/property.cxx +++ b/comphelper/source/property/property.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. @@ -77,7 +78,7 @@ void copyProperties(const Reference<XPropertySet>& _rxSource, { if (!_rxSource.is() || !_rxDest.is()) { - OSL_ENSURE(sal_False, "copyProperties: invalid arguments !"); + OSL_FAIL("copyProperties: invalid arguments !"); return; } @@ -135,7 +136,7 @@ void copyProperties(const Reference<XPropertySet>& _rxSource, } aBuffer.append( "." ); - OSL_ENSURE( sal_False, aBuffer.getStr() ); + OSL_FAIL( aBuffer.getStr() ); #endif } } @@ -243,3 +244,4 @@ sal_Bool tryPropertyValue(Any& _rConvertedValue, Any& _rOldValue, const Any& _rV } //......................................................................... +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/property/propertybag.cxx b/comphelper/source/property/propertybag.cxx index 88f925e20db7..3170411de510 100644 --- a/comphelper/source/property/propertybag.cxx +++ b/comphelper/source/property/propertybag.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 } // namespace comphelper //........................................................................ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/property/propertycontainer.cxx b/comphelper/source/property/propertycontainer.cxx index c385107733fe..a826eca2bd92 100644 --- a/comphelper/source/property/propertycontainer.cxx +++ b/comphelper/source/property/propertycontainer.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,3 +104,4 @@ void OPropertyContainer::getFastPropertyValue(Any& _rValue, sal_Int32 _nHandle) //......................................................................... +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/property/propertycontainerhelper.cxx b/comphelper/source/property/propertycontainerhelper.cxx index 0b420a3eebd8..6233efbc011f 100644 --- a/comphelper/source/property/propertycontainerhelper.cxx +++ b/comphelper/source/property/propertycontainerhelper.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. @@ -255,7 +256,7 @@ sal_Bool OPropertyContainerHelper::convertFastPropertyValue( PropertiesIterator aPos = searchHandle(_nHandle); if (aPos == m_aProperties.end()) { - OSL_ENSURE( false, "OPropertyContainerHelper::convertFastPropertyValue: unknown handle!" ); + OSL_FAIL( "OPropertyContainerHelper::convertFastPropertyValue: unknown handle!" ); // should not happen if the derived class has built a correct property set info helper to be used by // our base class OPropertySetHelper return bModified; @@ -274,8 +275,7 @@ sal_Bool OPropertyContainerHelper::convertFastPropertyValue( Any aNewRequestedValue( _rValue ); // normalization - // (#102329# - 2002-08-14 - fs@openoffice.org) - // (#i29490# - 2004-06-16 - fs@openoffice.org) + // #i29490# if ( !aNewRequestedValue.getValueType().equals( aPos->aProperty.Type ) ) { // the actually given value is not of the same type as the one required Any aProperlyTyped( NULL, aPos->aProperty.Type.getTypeLibType() ); @@ -399,7 +399,7 @@ void OPropertyContainerHelper::setFastPropertyValue(sal_Int32 _nHandle, const An PropertiesIterator aPos = searchHandle(_nHandle); if (aPos == m_aProperties.end()) { - OSL_ENSURE( false, "OPropertyContainerHelper::setFastPropertyValue: unknown handle!" ); + OSL_FAIL( "OPropertyContainerHelper::setFastPropertyValue: unknown handle!" ); // should not happen if the derived class has built a correct property set info helper to be used by // our base class OPropertySetHelper return; @@ -441,7 +441,7 @@ void OPropertyContainerHelper::getFastPropertyValue(Any& _rValue, sal_Int32 _nHa PropertiesIterator aPos = const_cast<OPropertyContainerHelper*>(this)->searchHandle(_nHandle); if (aPos == m_aProperties.end()) { - OSL_ENSURE( false, "OPropertyContainerHelper::getFastPropertyValue: unknown handle!" ); + OSL_FAIL( "OPropertyContainerHelper::getFastPropertyValue: unknown handle!" ); // should not happen if the derived class has built a correct property set info helper to be used by // our base class OPropertySetHelper return; @@ -501,7 +501,7 @@ void OPropertyContainerHelper::modifyAttributes(sal_Int32 _nHandle, sal_Int32 _n PropertiesIterator aPos = searchHandle(_nHandle); if (aPos == m_aProperties.end()) { - OSL_ENSURE( false, "OPropertyContainerHelper::modifyAttributes: unknown handle!" ); + OSL_FAIL( "OPropertyContainerHelper::modifyAttributes: unknown handle!" ); // should not happen if the derived class has built a correct property set info helper to be used by // our base class OPropertySetHelper return; @@ -550,3 +550,4 @@ void OPropertyContainerHelper::describeProperties(Sequence< Property >& _rProps) //......................................................................... +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/property/propertysethelper.cxx b/comphelper/source/property/propertysethelper.cxx index 9d2abf784c1b..0ad27a6949ed 100644 --- a/comphelper/source/property/propertysethelper.cxx +++ b/comphelper/source/property/propertysethelper.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. @@ -311,18 +312,20 @@ Any SAL_CALL PropertySetHelper::getPropertyDefault( const ::rtl::OUString& aProp void PropertySetHelper::_getPropertyStates( const comphelper::PropertyMapEntry**, PropertyState* ) throw(UnknownPropertyException ) { - OSL_ENSURE( sal_False, "you have to implement this yourself!"); + OSL_FAIL( "you have to implement this yourself!"); } void PropertySetHelper::_setPropertyToDefault( const comphelper::PropertyMapEntry* ) throw(UnknownPropertyException ) { - OSL_ENSURE( sal_False, "you have to implement this yourself!"); + OSL_FAIL( "you have to implement this yourself!"); } Any PropertySetHelper::_getPropertyDefault( const comphelper::PropertyMapEntry* ) throw(UnknownPropertyException, WrappedTargetException ) { - OSL_ENSURE( sal_False, "you have to implement this yourself!"); + OSL_FAIL( "you have to implement this yourself!"); Any aAny; return aAny; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/property/propertysetinfo.cxx b/comphelper/source/property/propertysetinfo.cxx index efdd495ac1bc..4746a7e9ce43 100644 --- a/comphelper/source/property/propertysetinfo.cxx +++ b/comphelper/source/property/propertysetinfo.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. @@ -83,12 +84,12 @@ void PropertyMapImpl::add( PropertyMapEntry* pMap, sal_Int32 nCount ) throw() PropertyMap::iterator aIter = maPropertyMap.find( aName ); if( aIter != maPropertyMap.end() ) { - OSL_ENSURE( sal_False, "Warning: PropertyMapEntry added twice, possible error!"); + OSL_FAIL( "Warning: PropertyMapEntry added twice, possible error!"); } #endif if( NULL == pMap->mpType ) { - OSL_ENSURE( sal_False, "No type in PropertyMapEntry!"); + OSL_FAIL( "No type in PropertyMapEntry!"); pMap->mpType = &::getCppuType((const sal_Int32*)0); } @@ -130,8 +131,8 @@ Sequence< Property > PropertyMapImpl::getProperties() throw() pProperties->Type = *pEntry->mpType; pProperties->Attributes = pEntry->mnAttributes; - pProperties++; - aIter++; + ++pProperties; + ++aIter; } } @@ -212,3 +213,5 @@ const PropertyMap* PropertySetInfo::getPropertyMap() const throw() { return mpMap->getPropertyMap(); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/property/propertystatecontainer.cxx b/comphelper/source/property/propertystatecontainer.cxx index 341dc1b43a78..f1611efd77f4 100644 --- a/comphelper/source/property/propertystatecontainer.cxx +++ b/comphelper/source/property/propertystatecontainer.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. @@ -193,147 +194,4 @@ namespace comphelper } // namespace comphelper //......................................................................... -#ifdef FS_PRIV_DEBUG -#define STATECONTAINER_TEST -#endif - -#ifdef STATECONTAINER_TEST -#include <com/sun/star/beans/PropertyAttribute.hpp> -#include <comphelper/proparrhlp.hxx> -#include <comphelper/broadcasthelper.hxx> - -//......................................................................... -namespace comphelper -{ -//......................................................................... - - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::beans; - - //===================================================================== - //= Test - compiler test - //===================================================================== - typedef ::cppu::OWeakAggObject Test_RefCountBase; - class Test :public OMutexAndBroadcastHelper - ,public OPropertyStateContainer - ,public OPropertyArrayUsageHelper< Test > - ,public Test_RefCountBase - { - private: - ::rtl::OUString m_sStringProperty; - Reference< XInterface > m_xInterfaceProperty; - Any m_aMayBeVoidProperty; - - protected: - Test( ); - - DECLARE_XINTERFACE( ) - - public: - static Test* Create( ); - - protected: - virtual Reference< XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(RuntimeException); - virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); - virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; - - protected: - // OPropertyStateContainer overridables - virtual void getPropertyDefaultByHandle( sal_Int32 _nHandle, Any& _rDefault ) const; - }; - - //--------------------------------------------------------------------- - Test::Test( ) - :OPropertyStateContainer( GetBroadcastHelper() ) - { - registerProperty( - ::rtl::OUString::createFromAscii( "StringProperty" ), - 1, - PropertyAttribute::BOUND, - &m_sStringProperty, - ::getCppuType( &m_sStringProperty ) - ); - - registerProperty( - ::rtl::OUString::createFromAscii( "InterfaceProperty" ), - 2, - PropertyAttribute::BOUND, - &m_xInterfaceProperty, - ::getCppuType( &m_xInterfaceProperty ) - ); - - registerMayBeVoidProperty( - ::rtl::OUString::createFromAscii( "IntProperty" ), - 3, - PropertyAttribute::BOUND, - &m_aMayBeVoidProperty, - ::getCppuType( static_cast< sal_Int32* >( NULL ) ) - ); - - registerPropertyNoMember( - ::rtl::OUString::createFromAscii( "OtherInterfaceProperty" ), - 4, - PropertyAttribute::BOUND | PropertyAttribute::MAYBEVOID, - ::getCppuType( static_cast< Reference< XInterface >* >( NULL ) ), - NULL - ); - } - - //--------------------------------------------------------------------- - IMPLEMENT_FORWARD_XINTERFACE2( Test, Test_RefCountBase, OPropertyStateContainer ) - - //--------------------------------------------------------------------- - void Test::getPropertyDefaultByHandle( sal_Int32 _nHandle, Any& _rDefault ) const - { - switch ( _nHandle ) - { - case 1: - _rDefault = makeAny( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "StringPropertyDefault" ) ) ); - break; - case 2: - _rDefault = makeAny( Reference< XInterface >( ) ); - break; - case 3: - // void - break; - case 4: - _rDefault = makeAny( Reference< XInterface >( ) ); - break; - default: - OSL_ENSURE( sal_False, "Test::getPropertyDefaultByHandle: invalid handle!" ); - } - } - - //--------------------------------------------------------------------- - Reference< XPropertySetInfo > SAL_CALL Test::getPropertySetInfo( ) throw(RuntimeException) - { - return createPropertySetInfo( getInfoHelper() ); - } - - //--------------------------------------------------------------------- - ::cppu::IPropertyArrayHelper& SAL_CALL Test::getInfoHelper() - { - return *getArrayHelper(); - } - - //--------------------------------------------------------------------- - ::cppu::IPropertyArrayHelper* Test::createArrayHelper( ) const - { - Sequence< Property > aProps; - describeProperties( aProps ); - return new ::cppu::OPropertyArrayHelper( aProps ); - } - - //--------------------------------------------------------------------- - Test* Test::Create( ) - { - Test* pInstance = new Test; - return pInstance; - } - -//......................................................................... -} // namespace comphelper -//......................................................................... - -#endif - +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/property/propmultiplex.cxx b/comphelper/source/property/propmultiplex.cxx index db0b35650d32..a7e9c1e395d0 100644 --- a/comphelper/source/property/propmultiplex.cxx +++ b/comphelper/source/property/propmultiplex.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. @@ -180,3 +181,4 @@ void OPropertyChangeMultiplexer::addProperty(const ::rtl::OUString& _sPropertyNa } //......................................................................... +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/property/propstate.cxx b/comphelper/source/property/propstate.cxx index 214bccb3f40f..ec621cb43833 100644 --- a/comphelper/source/property/propstate.cxx +++ b/comphelper/source/property/propstate.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. @@ -31,6 +32,7 @@ #include <com/sun/star/uno/genfunc.h> #include <cppuhelper/queryinterface.hxx> #include <comphelper/sequence.hxx> +#include <rtl/instance.hxx> //......................................................................... namespace comphelper @@ -66,18 +68,14 @@ namespace comphelper //--------------------------------------------------------------------- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> OPropertyStateHelper::getTypes() throw( ::com::sun::star::uno::RuntimeException) { - static ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> aTypes; - if (!aTypes.getLength()) - { - aTypes.realloc(4); - ::com::sun::star::uno::Type* pTypes = aTypes.getArray(); - // base class types - pTypes[0] = getCppuType(( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>*)NULL); - pTypes[1] = getCppuType(( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XMultiPropertySet>*)NULL); - pTypes[2] = getCppuType(( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XFastPropertySet>*)NULL); - // my own type - pTypes[3] = getCppuType(( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState>*)NULL); - } + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> aTypes(4); + ::com::sun::star::uno::Type* pTypes = aTypes.getArray(); + // base class types + pTypes[0] = getCppuType(( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>*)NULL); + pTypes[1] = getCppuType(( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XMultiPropertySet>*)NULL); + pTypes[2] = getCppuType(( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XFastPropertySet>*)NULL); + // my own type + pTypes[3] = getCppuType(( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState>*)NULL); return aTypes; } @@ -216,20 +214,13 @@ namespace comphelper ); } + namespace { struct lcl_ImplId : public rtl::Static< ::cppu::OImplementationId, lcl_ImplId > {}; } + //--------------------------------------------------------------------- Sequence< sal_Int8 > SAL_CALL OStatefulPropertySet::getImplementationId() throw(RuntimeException) { - static ::cppu::OImplementationId * pId = NULL; - if ( !pId ) - { - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if ( !pId ) - { - static ::cppu::OImplementationId aId; - pId = &aId; - } - } - return pId->getImplementationId(); + ::cppu::OImplementationId &rID = lcl_ImplId::get(); + return rID.getImplementationId(); } //--------------------------------------------------------------------- @@ -259,3 +250,4 @@ namespace comphelper } //......................................................................... +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/streaming/basicio.cxx b/comphelper/source/streaming/basicio.cxx index eef5c6b844fa..662c5545c56e 100644 --- a/comphelper/source/streaming/basicio.cxx +++ b/comphelper/source/streaming/basicio.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 @@ const staruno::Reference<stario::XObjectOutputStream>& operator << (const starun } // namespace comphelper //......................................................................... +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/streaming/memorystream.cxx b/comphelper/source/streaming/memorystream.cxx index 5298b7511f09..fd17bd9e5db6 100644 --- a/comphelper/source/streaming/memorystream.cxx +++ b/comphelper/source/streaming/memorystream.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. @@ -245,3 +246,5 @@ void createRegistryInfo_UNOMemoryStream() { static ::comphelper::module::OAutoRegistration< ::comphelper::UNOMemoryStream > aAutoRegistration; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/streaming/oslfile2streamwrap.cxx b/comphelper/source/streaming/oslfile2streamwrap.cxx index 9cf8eeaaf08a..68af33298336 100644 --- a/comphelper/source/streaming/oslfile2streamwrap.cxx +++ b/comphelper/source/streaming/oslfile2streamwrap.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. @@ -138,7 +139,7 @@ sal_Int32 SAL_CALL OSLInputStreamWrapper::available() throw( stario::NotConnecte throw stario::NotConnectedException(::rtl::OUString(), static_cast<staruno::XWeak*>(this)); sal_uInt64 nDummy = 0; - eError = m_pFile->setPos(Pos_End, nDummy); + eError = m_pFile->setPos(osl_Pos_End, nDummy); if (eError != FileBase::E_None) throw stario::NotConnectedException(::rtl::OUString(),static_cast<staruno::XWeak*>(this)); @@ -148,7 +149,7 @@ sal_Int32 SAL_CALL OSLInputStreamWrapper::available() throw( stario::NotConnecte throw stario::NotConnectedException(::rtl::OUString(),static_cast<staruno::XWeak*>(this)); nAvailable = nAvailable - nPos; - eError = m_pFile->setPos(Pos_Absolut, nPos); + eError = m_pFile->setPos(osl_Pos_Absolut, nPos); if (eError != FileBase::E_None) throw stario::NotConnectedException(::rtl::OUString(),static_cast<staruno::XWeak*>(this)); return sal::static_int_cast< sal_Int32 >( @@ -196,3 +197,4 @@ void SAL_CALL OSLOutputStreamWrapper::closeOutput() throw( stario::NotConnectedE } // namespace comphelper +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/streaming/otransactedfilestream.cxx b/comphelper/source/streaming/otransactedfilestream.cxx index 03539a12305b..9bcfac5fb66b 100644 --- a/comphelper/source/streaming/otransactedfilestream.cxx +++ b/comphelper/source/streaming/otransactedfilestream.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. @@ -231,7 +232,7 @@ void OTruncatedTransactedFileStream::CloseAll_Impl() xFileAccess->kill( aURL ); } catch( uno::Exception& ) { - OSL_ENSURE( sal_False, "Could not remove the file!" ); + OSL_FAIL( "Could not remove the file!" ); } } } @@ -303,16 +304,16 @@ void OTruncatedTransactedFileStream::Commit_Impl() ::rtl::OUString aTempURL; try { uno::Reference< beans::XPropertySet > xTempFile( m_pStreamData->m_xTempStream, uno::UNO_QUERY_THROW ); - uno::Any aUrl = xTempFile->getPropertyValue( ::rtl::OUString::createFromAscii( "Uri" ) ); + uno::Any aUrl = xTempFile->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Uri")) ); aUrl >>= aTempURL; - xTempFile->setPropertyValue( ::rtl::OUString::createFromAscii( "RemoveFile" ), + xTempFile->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("RemoveFile")), uno::makeAny( sal_False ) ); m_pStreamData->m_xTempSeekable->seek( nPos ); } catch( uno::Exception& ) { - OSL_ENSURE( sal_False, "These calls are pretty simple, they should not fail!\n" ); + OSL_FAIL( "These calls are pretty simple, they should not fail!\n" ); } m_pStreamData->FreeOriginal(); @@ -536,7 +537,7 @@ void SAL_CALL OTruncatedTransactedFileStream::flush( ) if ( !m_pStreamData ) { - OSL_ENSURE( sal_False, "flush() call on closed stream!\n" ); + OSL_FAIL( "flush() call on closed stream!\n" ); return; // in future throw exception, for now some code might call flush() on closed stream // since file ucp implementation allows it @@ -822,3 +823,4 @@ void SAL_CALL OTruncatedTransactedFileStream::removeVetoableChangeListener( cons } // namespace comphelper +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/streaming/seekableinput.cxx b/comphelper/source/streaming/seekableinput.cxx index abaf46faf014..f20153ee0aaf 100644 --- a/comphelper/source/streaming/seekableinput.cxx +++ b/comphelper/source/streaming/seekableinput.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,7 +102,7 @@ void OSeekableInputWrapper::PrepareCopy_Impl() throw uno::RuntimeException(); uno::Reference< io::XOutputStream > xTempOut( - m_xFactory->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.io.TempFile" ) ), + m_xFactory->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.io.TempFile")) ), uno::UNO_QUERY ); if ( xTempOut.is() ) @@ -265,3 +266,4 @@ sal_Int64 SAL_CALL OSeekableInputWrapper::getLength() } // namespace comphelper +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/streaming/seqinputstreamserv.cxx b/comphelper/source/streaming/seqinputstreamserv.cxx index 015387b9894d..4e1cc7ade660 100644 --- a/comphelper/source/streaming/seqinputstreamserv.cxx +++ b/comphelper/source/streaming/seqinputstreamserv.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. @@ -222,7 +223,7 @@ void SAL_CALL SequenceInputStreamService::initialize( const uno::Sequence< ::com throw frame::DoubleInitializationException(); if ( aArguments.getLength() != 1 ) - throw lang::IllegalArgumentException( ::rtl::OUString::createFromAscii( "Wrong number of arguments!\n" ), + throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Wrong number of arguments!\n")), uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ), 1 ); @@ -238,7 +239,7 @@ void SAL_CALL SequenceInputStreamService::initialize( const uno::Sequence< ::com m_bInitialized = sal_True; } else - throw lang::IllegalArgumentException( ::rtl::OUString::createFromAscii( "Unexpected type of argument!\n" ), + throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Unexpected type of argument!\n")), uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ), 1 ); } @@ -249,3 +250,5 @@ void createRegistryInfo_SequenceInputStream() { static ::comphelper::module::OAutoRegistration< SequenceInputStreamService > aAutoRegistration; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/streaming/seqoutputstreamserv.cxx b/comphelper/source/streaming/seqoutputstreamserv.cxx index a51653e6e419..02cfd2fe7bc6 100644 --- a/comphelper/source/streaming/seqoutputstreamserv.cxx +++ b/comphelper/source/streaming/seqoutputstreamserv.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. @@ -170,3 +171,5 @@ void createRegistryInfo_SequenceOutputStream() { static ::comphelper::module::OAutoRegistration< SequenceOutputStreamService > aAutoRegistration; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/streaming/seqstream.cxx b/comphelper/source/streaming/seqstream.cxx index 5c8a32b1f6e5..d2852b70a901 100644 --- a/comphelper/source/streaming/seqstream.cxx +++ b/comphelper/source/streaming/seqstream.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. @@ -241,3 +242,5 @@ void SAL_CALL OSequenceOutputStream::closeOutput( ) throw(NotConnectedException } } // namespace comphelper + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/streaming/streamsection.cxx b/comphelper/source/streaming/streamsection.cxx index 324299813986..1fa71fd42682 100644 --- a/comphelper/source/streaming/streamsection.cxx +++ b/comphelper/source/streaming/streamsection.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,3 +121,4 @@ sal_Int32 OStreamSection::available() } // namespace comphelper +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/xml/attributelist.cxx b/comphelper/source/xml/attributelist.cxx index bcf32b85011f..2442fd69f106 100644 --- a/comphelper/source/xml/attributelist.cxx +++ b/comphelper/source/xml/attributelist.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,14 +29,15 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_comphelper.hxx" #include <comphelper/attributelist.hxx> -#include <vos/diagnose.hxx> +#include <osl/diagnose.h> #include <vector> -using namespace rtl; using namespace osl; using namespace com::sun::star; +using ::rtl::OUString; + namespace comphelper { struct TagAttribute_Impl @@ -91,7 +93,7 @@ OUString SAL_CALL AttributeList::getTypeByName( const OUString& sName ) throw( : { ::std::vector<struct TagAttribute_Impl>::iterator ii = m_pImpl->vecAttribute.begin(); - for( ; ii != m_pImpl->vecAttribute.end() ; ii ++ ) { + for( ; ii != m_pImpl->vecAttribute.end() ; ++ii ) { if( (*ii).sName == sName ) { return (*ii).sType; } @@ -103,7 +105,7 @@ OUString SAL_CALL AttributeList::getValueByName(const OUString& sName) throw( :: { ::std::vector<struct TagAttribute_Impl>::iterator ii = m_pImpl->vecAttribute.begin(); - for( ; ii != m_pImpl->vecAttribute.end() ; ii ++ ) { + for( ; ii != m_pImpl->vecAttribute.end() ; ++ii ) { if( (*ii).sName == sName ) { return (*ii).sValue; } @@ -135,14 +137,14 @@ void AttributeList::Clear() { m_pImpl->vecAttribute.clear(); - VOS_ENSURE( ! getLength(), "Length > 0 after AttributeList::Clear!"); + OSL_ENSURE( ! getLength(), "Length > 0 after AttributeList::Clear!"); } void AttributeList::RemoveAttribute( const OUString sName ) { ::std::vector<struct TagAttribute_Impl>::iterator ii = m_pImpl->vecAttribute.begin(); - for( ; ii != m_pImpl->vecAttribute.end() ; ii ++ ) { + for( ; ii != m_pImpl->vecAttribute.end() ; ++ii ) { if( (*ii).sName == sName ) { m_pImpl->vecAttribute.erase( ii ); break; @@ -159,7 +161,7 @@ void AttributeList::SetAttributeList( const uno::Reference< ::com::sun::star::xm void AttributeList::AppendAttributeList( const uno::Reference< ::com::sun::star::xml::sax::XAttributeList > &r ) { - VOS_ENSURE( r.is(), "r isn't!" ); + OSL_ENSURE( r.is(), "r isn't!" ); sal_Int32 nMax = r->getLength(); sal_Int32 nTotalSize = m_pImpl->vecAttribute.size() + nMax; @@ -172,8 +174,9 @@ void AttributeList::AppendAttributeList( const uno::Reference< ::com::sun::star: r->getValueByIndex( i ))); } - VOS_ENSURE( nTotalSize == getLength(), "nTotalSize != getLength()"); + OSL_ENSURE( nTotalSize == getLength(), "nTotalSize != getLength()"); } } // namespace comphelper +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/xml/ofopxmlhelper.cxx b/comphelper/source/xml/ofopxmlhelper.cxx index 9ad617b0e6d1..9df5977efb04 100644 --- a/comphelper/source/xml/ofopxmlhelper.cxx +++ b/comphelper/source/xml/ofopxmlhelper.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,24 +29,12 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_comphelper.hxx" -#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_ #include <com/sun/star/beans/StringPair.hpp> -#endif -#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP #include <com/sun/star/lang/XMultiServiceFactory.hpp> -#endif -#ifndef _COM_SUN_STAR_IO_XACTIVEDATASOURCE_HPP #include <com/sun/star/io/XActiveDataSource.hpp> -#endif -#ifndef _COM_SUN_STAR_XML_SAX_XPARSER_HPP #include <com/sun/star/xml/sax/XParser.hpp> -#endif -#ifndef _COM_SUN_STAR_XML_SAX_XDOCUMENTHANDLER_HPP #include <com/sun/star/xml/sax/XDocumentHandler.hpp> -#endif -#ifndef _COM_SUN_STAR_LANG_ILLEGALARGUMENTEXCEPTION_HPP #include <com/sun/star/lang/IllegalArgumentException.hpp> -#endif #include <comphelper/ofopxmlhelper.hxx> #include <comphelper/attributelist.hxx> @@ -465,3 +454,4 @@ void SAL_CALL OFOPXMLHelper::setDocumentLocator( const uno::Reference< xml::sax: } // namespace comphelper +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/test/uno_iterators/uno_iterators.cxx b/comphelper/test/uno_iterators/uno_iterators.cxx new file mode 100644 index 000000000000..a242c614b508 --- /dev/null +++ b/comphelper/test/uno_iterators/uno_iterators.cxx @@ -0,0 +1,221 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * +************************************************************************/ + +#include <algorithm> +#include <comphelper/stlunosequence.hxx> +#include <com/sun/star/uno/Sequence.hxx> +#include <iostream> +#include <list> +#include <rtl/textenc.h> +#include <rtl/ustrbuf.hxx> +#include <rtl/ustring.hxx> +#include <vector> + +using namespace ::comphelper; +using namespace ::com::sun::star::uno; +using namespace ::rtl; +using namespace ::std; + +// some helpers for testing (imperative) +void fill_testdata(Sequence<OUString>& seq) +{ + OUStringBuffer buf; + for(sal_Int32 i=0; i<seq.getLength(); i++) + { + buf.appendAscii("Sampletext "); + buf.append(i); + seq[i] = buf.makeStringAndClear(); + } +} + +void print_oustring(const OUString& ustr) +{ cout << OUStringToOString(ustr, RTL_TEXTENCODING_ASCII_US).getStr() << endl; } + +void print_sequence(const Sequence<OUString>& seq) +{ + cout << "Sequence of " << seq.getLength() << " OUStrings: " << endl; + for(sal_Int32 i=0; i<seq.getLength(); i++) + print_oustring(seq[i]); + cout << endl; +} + +// some helpers for testing (functional) +class TestdataGenerator +{ + public: + TestdataGenerator() : m_Index(0) {}; + OUString operator()() { return m_Buf.appendAscii("Sampletext ").append(m_Index++).makeStringAndClear(); }; + OUStringBuffer m_Buf; + sal_Int32 m_Index; +}; + +void fill_testdata_stl(StlUnoSequence<OUString>& stl_seq) +{ + generate(stl_seq.begin(), stl_seq.end(), TestdataGenerator()); +} + +void print_sequence_stl(const StlUnoSequence<OUString>& stl_seq) +{ + cout << "Sequence of " << stl_seq.size() << " OUStrings: " << endl; + for_each(stl_seq.begin(), stl_seq.end(), &print_oustring); + cout << endl; +} + + +// code samples + +// imperative loops (just to show they work, using for_each would be better most of the time +void classic_loops() +{ + Sequence<OUString> s(10); + fill_testdata(s); + StlUnoSequence<OUString>::iterator stl_s_it; + + cout << "for iteration" << endl; + for(stl_s_it = stl_begin(s); stl_s_it != stl_end(s); ++stl_s_it) + cout << OUStringToOString(*stl_s_it, RTL_TEXTENCODING_ASCII_US).getStr() << endl; + + cout << "reverse for iteration" << endl; + for(stl_s_it = stl_end(s); stl_s_it != stl_begin(s); --stl_s_it) + cout << OUStringToOString(*(stl_s_it-1), RTL_TEXTENCODING_ASCII_US).getStr() << endl; + + cout << "skipping for iteration" << endl; + for(stl_s_it = stl_begin(s); stl_s_it != stl_end(s); stl_s_it+=2) + cout << OUStringToOString(*stl_s_it, RTL_TEXTENCODING_ASCII_US).getStr() << endl; + + cout << "skipping reverse for iteration" << endl; + for(stl_s_it = stl_end(s); stl_s_it != stl_begin(s); stl_s_it-=2) + std::cout << OUStringToOString(*(stl_s_it-1), RTL_TEXTENCODING_ASCII_US).getStr() << endl; +} + +void stl_algos() +{ + Sequence<OUString> s(10); + fill_testdata(s); + + random_shuffle(stl_begin(s), stl_end(s)); + cout << "shuffed" << std::endl; + print_sequence(s); + + sort(stl_begin(s), stl_end(s)); + cout << "sorted" << std::endl; + print_sequence(s); +} + +void stl_conversions() +{ + Sequence<OUString> s(10); + fill_testdata(s); + StlUnoSequence<OUString> stl_s = StlUnoSequence<OUString>::createInstance(s); + + // convert to stl::vector, modify in vector, copy back, print + cout << "vector conversion" << endl; + vector<OUString> vec(stl_s.begin(), stl_s.end()); + vec[2] = OUString( RTL_CONSTASCII_USTRINGPARAM( "changed in vector" )); + copy(vec.begin(), vec.end(), stl_s.begin()); + print_sequence(s); + + // convert to stl::list, modify in list, copy back, print + cout << "list conversion" << endl; + list<OUString> l(stl_s.begin(), stl_s.end()); + l.pop_back(); + l.push_back(OUString( RTL_CONSTASCII_USTRINGPARAM( "changed in list" ))); + copy(l.begin(), l.end(), stl_s.begin()); + print_sequence(s); +} + +// inserts the second half of the second sequence after the first element of the first sequence +void stl_inserting() +{ + Sequence<OUString> s1(10); + Sequence<OUString> s2(10); + Sequence<OUString> result(15); + StlUnoSequence<OUString> stl_s1 = StlUnoSequence<OUString>::createInstance(s1); + StlUnoSequence<OUString> stl_s2 = StlUnoSequence<OUString>::createInstance(s2); + StlUnoSequence<OUString> stl_result = StlUnoSequence<OUString>::createInstance(result); + fill_testdata(s1); + fill_testdata(s2); + + list<OUString> temp(stl_s1.begin(), stl_s1.end()); + copy(stl_s2.begin()+5, stl_s2.end(), insert_iterator<list<OUString> >(temp, ++temp.begin())); + copy(temp.begin(), temp.end(), stl_result.begin()); + print_sequence(result); +} + +void stl_compare() +{ + Sequence<OUString> s1(10); + Sequence<OUString> s2(10); + StlUnoSequence<OUString> stl_s1 = StlUnoSequence<OUString>::createInstance(s1); + StlUnoSequence<OUString> stl_s2 = StlUnoSequence<OUString>::createInstance(s2); + if (stl_s1 == stl_s2) + cout << "sequences are equal." << endl; + s2[9] = OUString( RTL_CONSTASCII_USTRINGPARAM( "ZZZZZ" )); + if(stl_s1 < stl_s2) + cout << "first sequence is smaller." << endl; +} + +void stl_const_sequence() +{ + const Sequence<OUString> s(10); + for(StlUnoSequence<OUString>::const_iterator stl_s_it = stl_begin(s); stl_s_it != stl_end(s); ++stl_s_it) + cout << OUStringToOString(*stl_s_it, RTL_TEXTENCODING_ASCII_US).getStr() << endl; +} + +void stl_helpers() +{ + Sequence<OUString> s(10); + StlUnoSequence<OUString> stl_s = StlUnoSequence<OUString>::createInstance(s); + fill_testdata_stl(stl_s); + print_sequence_stl(stl_s); +} + +int main() +{ + cout << "--- CLASSIC LOOPS" << endl; + classic_loops(); + + cout << "--- SOME STL ALGORITHMS" << endl; + stl_algos(); + + cout << "--- SOME STL CONVERSIONS" << endl; + stl_conversions(); + + cout << "--- INSERTING IN SEQUENCE" << endl; + stl_inserting(); + + cout << "--- COMPARING" << endl; + stl_compare(); + + cout << "--- CONST SEQUENCE" << endl; + stl_const_sequence(); + + cout << "--- HELPERS IN STL-STYLE" << endl; + stl_helpers(); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |