diff options
Diffstat (limited to 'unotools')
95 files changed, 1512 insertions, 1739 deletions
diff --git a/unotools/JunitTest_unotools_complex.mk b/unotools/JunitTest_unotools_complex.mk new file mode 100644 index 000000000000..18af03408953 --- /dev/null +++ b/unotools/JunitTest_unotools_complex.mk @@ -0,0 +1,50 @@ +# 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 or as specified alternatively below. 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 +# Bjoern Michaelsen, Canonical Ltd. <bjoern.michaelsen@canonical.com> +# Portions created by the Initial Developer are Copyright (C) 2010 the +# Initial Developer. All Rights Reserved. +# +# Major Contributor(s): +# +# For minor contributions see the git repository. +# +# 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. + +$(eval $(call gb_JunitTest_JunitTest,unotools_complex)) + +$(eval $(call gb_JunitTest_add_jars,unotools_complex,\ + $(OUTDIR)/bin/OOoRunner.jar \ + $(OUTDIR)/bin/ridl.jar \ + $(OUTDIR)/bin/test.jar \ + $(OUTDIR)/bin/unoil.jar \ + $(OUTDIR)/bin/jurt.jar \ +)) + +$(eval $(call gb_JunitTest_add_sourcefiles,unotools_complex,\ + unotools/qa/complex/tempfile/TempFileUnitTest \ + unotools/qa/complex/tempfile/Test01 \ + unotools/qa/complex/tempfile/Test02 \ + unotools/qa/complex/tempfile/TempFileTest \ + unotools/qa/complex/tempfile/TestHelper \ +)) + +$(eval $(call gb_JunitTest_add_classes,unotools_complex,\ + complex.tempfile.TempFileUnitTest \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/unotools/Makefile b/unotools/Makefile new file mode 100644 index 000000000000..a79aff831024 --- /dev/null +++ b/unotools/Makefile @@ -0,0 +1,38 @@ +#************************************************************************* +# +# 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. +# +#************************************************************************* + +ifeq ($(strip $(SOLARENV)),) +$(error No environment set!) +endif + +gb_PARTIALBUILD := T +GBUILDDIR := $(SOLARENV)/gbuild +include $(GBUILDDIR)/gbuild.mk + +$(eval $(call gb_Module_make_global_targets,$(shell ls $(dir $(realpath $(firstword $(MAKEFILE_LIST))))/Module*.mk))) + +# vim: set noet sw=4 ts=4: diff --git a/unotools/Module_unotools.mk b/unotools/Module_unotools.mk new file mode 100644 index 000000000000..e5d92eb677a6 --- /dev/null +++ b/unotools/Module_unotools.mk @@ -0,0 +1,34 @@ +# 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 or as specified alternatively below. 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 +# Bjoern Michaelsen, Canonical Ltd. <bjoern.michaelsen@canonical.com> +# Portions created by the Initial Developer are Copyright (C) 2010 the +# Initial Developer. All Rights Reserved. +# +# Major Contributor(s): +# +# For minor contributions see the git repository. +# +# 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. + +$(eval $(call gb_Module_Module,unotools)) + +$(eval $(call gb_Module_add_subsequentcheck_targets,unotools,\ + JunitTest_unotools_complex \ +)) + +# vim: set noet ts=4 sw=4: diff --git a/unotools/inc/unotools/accelcfg.hxx b/unotools/inc/unotools/accelcfg.hxx index 92ad6a0faaf5..9bc3f2178e34 100644 --- a/unotools/inc/unotools/accelcfg.hxx +++ b/unotools/inc/unotools/accelcfg.hxx @@ -79,7 +79,7 @@ public: void SetCommand( const SvtAcceleratorConfigItem& rItem ); // sets several or all configuration items - // if bClear=FALSE, all items not in the sequence remain unchanged + // if bClear=sal_False, all items not in the sequence remain unchanged void SetItems( const SvtAcceleratorItemList& rItems, bool bClear ); }; diff --git a/unotools/inc/unotools/atom.hxx b/unotools/inc/unotools/atom.hxx index ed32efb79626..c6cff2529343 100644 --- a/unotools/inc/unotools/atom.hxx +++ b/unotools/inc/unotools/atom.hxx @@ -33,10 +33,8 @@ #include <osl/mutex.hxx> #include <cppuhelper/implbase1.hxx> -#include <hash_map> -#ifndef __SGI_STL_LIST +#include <boost/unordered_map.hpp> #include <list> -#endif #include <com/sun/star/util/XAtomServer.hpp> #define INVALID_ATOM 0 @@ -52,8 +50,8 @@ namespace utl { class AtomProvider { int m_nAtoms; - ::std::hash_map< int, ::rtl::OUString, ::std::hash< int > > m_aStringMap; - ::std::hash_map< ::rtl::OUString, int, ::rtl::OUStringHash > m_aAtomMap; + ::boost::unordered_map< int, ::rtl::OUString, ::boost::hash< int > > m_aStringMap; + ::boost::unordered_map< ::rtl::OUString, int, ::rtl::OUStringHash > m_aAtomMap; public: AtomProvider(); ~AtomProvider(); @@ -74,7 +72,7 @@ namespace utl { class UNOTOOLS_DLLPUBLIC MultiAtomProvider { - ::std::hash_map< int, AtomProvider*, ::std::hash< int > > m_aAtomLists; + ::boost::unordered_map< int, AtomProvider*, ::boost::hash< int > > m_aAtomLists; public: MultiAtomProvider(); ~MultiAtomProvider(); diff --git a/unotools/inc/unotools/caserotate.hxx b/unotools/inc/unotools/caserotate.hxx new file mode 100644 index 000000000000..c88285788266 --- /dev/null +++ b/unotools/inc/unotools/caserotate.hxx @@ -0,0 +1,50 @@ +/* -*- 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> + * + * Contributor(s): + * Caolán McNamara <caolanm@redhat.com> + * Dózsa Bálint <dozsa@linux-dugf.site> + * + * 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 INCLUDED_UNOTOOLS_CASEROTATE_HXX +#define INCLUDED_UNOTOOLS_CASEROTATE_HXX + +#include <sal/config.h> + +#include "unotools/unotoolsdllapi.h" + +//TODO Use XCharacterClassification::getStringType to determine the current +//(possibly mixed) case type and rotate to the next one + +class UNOTOOLS_DLLPUBLIC RotateTransliteration +{ +private: + int nF3ShiftCounter; +public: + RotateTransliteration() : nF3ShiftCounter(0) + { + } + sal_uInt32 getNextMode(); +}; + +#endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/unotools/inc/unotools/componentresmodule.hxx b/unotools/inc/unotools/componentresmodule.hxx index 3f0924c5586a..5fa704951ac0 100644 --- a/unotools/inc/unotools/componentresmodule.hxx +++ b/unotools/inc/unotools/componentresmodule.hxx @@ -81,7 +81,7 @@ namespace utl class UNOTOOLS_DLLPUBLIC ModuleRes : public ::ResId { public: - ModuleRes( USHORT _nId, OComponentResourceModule& _rModule ) : ResId( _nId, *_rModule.getResManager() ) { } + ModuleRes( sal_uInt16 _nId, OComponentResourceModule& _rModule ) : ResId( _nId, *_rModule.getResManager() ) { } }; //==================================================================== @@ -120,7 +120,7 @@ namespace utl typedef ::utl::ModuleRes BaseClass; \ \ public: \ - ResClass( USHORT _nId ) : BaseClass( _nId, ModuleClass::getInstance() ) \ + ResClass( sal_uInt16 _nId ) : BaseClass( _nId, ModuleClass::getInstance() ) \ { \ } \ }; \ diff --git a/unotools/inc/unotools/configvaluecontainer.hxx b/unotools/inc/unotools/configvaluecontainer.hxx index fc7f1d732f63..ed336373f703 100644 --- a/unotools/inc/unotools/configvaluecontainer.hxx +++ b/unotools/inc/unotools/configvaluecontainer.hxx @@ -188,7 +188,7 @@ namespace utl <p>The current values in memory (your exchange locations registered using the registerXXX methods) is forwarded to their respective configuration nodes.</p> - <p>Note that calling <method>write</method>(<TRUE/) is the same as calling <method>commit</method>(<TRUE/>).</p> + <p>Note that calling <method>write</method>(<sal_True/) is the same as calling <method>commit</method>(<TRUE/>).</p> @precond The access must have been created for update access @@ -204,7 +204,7 @@ namespace utl /** commits any changes done - <p>Note that calling <method>write</method>(<TRUE/) is the same as calling <method>commit</method>(<TRUE/>).</p> + <p>Note that calling <method>write</method>(<sal_True/) is the same as calling <method>commit</method>(<TRUE/>).</p> @precond The access must have been created for update access diff --git a/unotools/inc/unotools/defaultoptions.hxx b/unotools/inc/unotools/defaultoptions.hxx index 1e7d04125aa4..ee6b005f05df 100644 --- a/unotools/inc/unotools/defaultoptions.hxx +++ b/unotools/inc/unotools/defaultoptions.hxx @@ -48,7 +48,7 @@ public: SvtDefaultOptions(); virtual ~SvtDefaultOptions(); - String GetDefaultPath( USHORT nId ) const; + String GetDefaultPath( sal_uInt16 nId ) const; }; #endif // #ifndef INCLUDED_unotools_DEFAULTOPTIONS_HXX diff --git a/unotools/inc/unotools/eventcfg.hxx b/unotools/inc/unotools/eventcfg.hxx index ec49bbc3090a..05dec2159595 100644 --- a/unotools/inc/unotools/eventcfg.hxx +++ b/unotools/inc/unotools/eventcfg.hxx @@ -35,7 +35,7 @@ #include <com/sun/star/frame/XFrame.hpp> #include <cppuhelper/weakref.hxx> #include <cppuhelper/implbase2.hxx> -#include <hash_map> +#include <boost/unordered_map.hpp> #include <vector> #define STR_EVENT_STARTAPP 0 @@ -67,7 +67,7 @@ #define STR_EVENT_MODECHANGED 26 #define STR_EVENT_STORAGECHANGED 27 -typedef ::std::hash_map< ::rtl::OUString, ::rtl::OUString, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > EventBindingHash; +typedef ::boost::unordered_map< ::rtl::OUString, ::rtl::OUString, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > EventBindingHash; typedef ::std::vector< ::com::sun::star::uno::WeakReference< ::com::sun::star::frame::XFrame > > FrameVector; typedef ::std::vector< ::rtl::OUString > SupportedEventsVector; diff --git a/unotools/inc/unotools/fontcfg.hxx b/unotools/inc/unotools/fontcfg.hxx index 56c93403197a..d370350484c1 100644 --- a/unotools/inc/unotools/fontcfg.hxx +++ b/unotools/inc/unotools/fontcfg.hxx @@ -35,8 +35,8 @@ #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/container/XNameAccess.hpp> -#include <hash_map> -#include <hash_set> +#include <boost/unordered_map.hpp> +#include <boost/unordered_set.hpp> #include <vector> namespace com { @@ -86,7 +86,7 @@ class UNOTOOLS_DLLPUBLIC DefaultFontConfiguration mutable com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > xAccess; }; - std::hash_map< com::sun::star::lang::Locale, + boost::unordered_map< com::sun::star::lang::Locale, LocaleAccess, utl::LocaleHash > m_aConfig; @@ -119,38 +119,38 @@ class UNOTOOLS_DLLPUBLIC DefaultFontConfiguration // IMPL_FONT_ATTR_COMIC - Like Comic Sans MS // IMPL_FONT_ATTR_BRUSHSCRIPT - More Script // IMPL_FONT_ATTR_OTHERSTYLE - OldStyle, ... so negativ points -#define IMPL_FONT_ATTR_DEFAULT ((ULONG)0x00000001) -#define IMPL_FONT_ATTR_STANDARD ((ULONG)0x00000002) -#define IMPL_FONT_ATTR_NORMAL ((ULONG)0x00000004) -#define IMPL_FONT_ATTR_SYMBOL ((ULONG)0x00000008) -#define IMPL_FONT_ATTR_FIXED ((ULONG)0x00000010) -#define IMPL_FONT_ATTR_SANSSERIF ((ULONG)0x00000020) -#define IMPL_FONT_ATTR_SERIF ((ULONG)0x00000040) -#define IMPL_FONT_ATTR_DECORATIVE ((ULONG)0x00000080) -#define IMPL_FONT_ATTR_SPECIAL ((ULONG)0x00000100) -#define IMPL_FONT_ATTR_ITALIC ((ULONG)0x00000200) -#define IMPL_FONT_ATTR_TITLING ((ULONG)0x00000400) -#define IMPL_FONT_ATTR_CAPITALS ((ULONG)0x00000800) -#define IMPL_FONT_ATTR_CJK ((ULONG)0x00001000) -#define IMPL_FONT_ATTR_CJK_JP ((ULONG)0x00002000) -#define IMPL_FONT_ATTR_CJK_SC ((ULONG)0x00004000) -#define IMPL_FONT_ATTR_CJK_TC ((ULONG)0x00008000) -#define IMPL_FONT_ATTR_CJK_KR ((ULONG)0x00010000) -#define IMPL_FONT_ATTR_CTL ((ULONG)0x00020000) -#define IMPL_FONT_ATTR_NONELATIN ((ULONG)0x00040000) -#define IMPL_FONT_ATTR_FULL ((ULONG)0x00080000) -#define IMPL_FONT_ATTR_OUTLINE ((ULONG)0x00100000) -#define IMPL_FONT_ATTR_SHADOW ((ULONG)0x00200000) -#define IMPL_FONT_ATTR_ROUNDED ((ULONG)0x00400000) -#define IMPL_FONT_ATTR_TYPEWRITER ((ULONG)0x00800000) -#define IMPL_FONT_ATTR_SCRIPT ((ULONG)0x01000000) -#define IMPL_FONT_ATTR_HANDWRITING ((ULONG)0x02000000) -#define IMPL_FONT_ATTR_CHANCERY ((ULONG)0x04000000) -#define IMPL_FONT_ATTR_COMIC ((ULONG)0x08000000) -#define IMPL_FONT_ATTR_BRUSHSCRIPT ((ULONG)0x10000000) -#define IMPL_FONT_ATTR_GOTHIC ((ULONG)0x20000000) -#define IMPL_FONT_ATTR_SCHOOLBOOK ((ULONG)0x40000000) -#define IMPL_FONT_ATTR_OTHERSTYLE ((ULONG)0x80000000) +#define IMPL_FONT_ATTR_DEFAULT ((sal_uLong)0x00000001) +#define IMPL_FONT_ATTR_STANDARD ((sal_uLong)0x00000002) +#define IMPL_FONT_ATTR_NORMAL ((sal_uLong)0x00000004) +#define IMPL_FONT_ATTR_SYMBOL ((sal_uLong)0x00000008) +#define IMPL_FONT_ATTR_FIXED ((sal_uLong)0x00000010) +#define IMPL_FONT_ATTR_SANSSERIF ((sal_uLong)0x00000020) +#define IMPL_FONT_ATTR_SERIF ((sal_uLong)0x00000040) +#define IMPL_FONT_ATTR_DECORATIVE ((sal_uLong)0x00000080) +#define IMPL_FONT_ATTR_SPECIAL ((sal_uLong)0x00000100) +#define IMPL_FONT_ATTR_ITALIC ((sal_uLong)0x00000200) +#define IMPL_FONT_ATTR_TITLING ((sal_uLong)0x00000400) +#define IMPL_FONT_ATTR_CAPITALS ((sal_uLong)0x00000800) +#define IMPL_FONT_ATTR_CJK ((sal_uLong)0x00001000) +#define IMPL_FONT_ATTR_CJK_JP ((sal_uLong)0x00002000) +#define IMPL_FONT_ATTR_CJK_SC ((sal_uLong)0x00004000) +#define IMPL_FONT_ATTR_CJK_TC ((sal_uLong)0x00008000) +#define IMPL_FONT_ATTR_CJK_KR ((sal_uLong)0x00010000) +#define IMPL_FONT_ATTR_CTL ((sal_uLong)0x00020000) +#define IMPL_FONT_ATTR_NONELATIN ((sal_uLong)0x00040000) +#define IMPL_FONT_ATTR_FULL ((sal_uLong)0x00080000) +#define IMPL_FONT_ATTR_OUTLINE ((sal_uLong)0x00100000) +#define IMPL_FONT_ATTR_SHADOW ((sal_uLong)0x00200000) +#define IMPL_FONT_ATTR_ROUNDED ((sal_uLong)0x00400000) +#define IMPL_FONT_ATTR_TYPEWRITER ((sal_uLong)0x00800000) +#define IMPL_FONT_ATTR_SCRIPT ((sal_uLong)0x01000000) +#define IMPL_FONT_ATTR_HANDWRITING ((sal_uLong)0x02000000) +#define IMPL_FONT_ATTR_CHANCERY ((sal_uLong)0x04000000) +#define IMPL_FONT_ATTR_COMIC ((sal_uLong)0x08000000) +#define IMPL_FONT_ATTR_BRUSHSCRIPT ((sal_uLong)0x10000000) +#define IMPL_FONT_ATTR_GOTHIC ((sal_uLong)0x20000000) +#define IMPL_FONT_ATTR_SCHOOLBOOK ((sal_uLong)0x40000000) +#define IMPL_FONT_ATTR_OTHERSTYLE ((sal_uLong)0x80000000) #define IMPL_FONT_ATTR_CJK_ALLLANG (IMPL_FONT_ATTR_CJK_JP | IMPL_FONT_ATTR_CJK_SC | IMPL_FONT_ATTR_CJK_TC | IMPL_FONT_ATTR_CJK_KR) #define IMPL_FONT_ATTR_ALLSCRIPT (IMPL_FONT_ATTR_SCRIPT | IMPL_FONT_ATTR_HANDWRITING | IMPL_FONT_ATTR_CHANCERY | IMPL_FONT_ATTR_COMIC | IMPL_FONT_ATTR_BRUSHSCRIPT) @@ -192,8 +192,8 @@ private: LocaleSubst() : bConfigRead( false ) {} }; - std::hash_map< com::sun::star::lang::Locale, LocaleSubst, utl::LocaleHash > m_aSubst; - typedef std::hash_set< rtl::OUString, rtl::OUStringHash > UniqueSubstHash; + boost::unordered_map< com::sun::star::lang::Locale, LocaleSubst, utl::LocaleHash > m_aSubst; + typedef boost::unordered_set< rtl::OUString, rtl::OUStringHash > UniqueSubstHash; mutable UniqueSubstHash maSubstHash; @@ -220,7 +220,7 @@ public: rtl::OUString(), rtl::OUString() ) ) const; - static void getMapName( const String& rOrgName, String& rShortName, String& rFamilyName, FontWeight& rWeight, FontWidth& rWidth, ULONG& rType ); + static void getMapName( const String& rOrgName, String& rShortName, String& rFamilyName, FontWeight& rWeight, FontWidth& rWidth, sal_uLong& rType ); }; } // namespace utl diff --git a/unotools/inc/unotools/fontcvt.hxx b/unotools/inc/unotools/fontcvt.hxx index b5f912d97c70..12d937cb62e4 100644 --- a/unotools/inc/unotools/fontcvt.hxx +++ b/unotools/inc/unotools/fontcvt.hxx @@ -36,12 +36,12 @@ // - FontToSubsFont - // ------------------ -#define FONTTOSUBSFONT_IMPORT ((ULONG)0x00000001) -#define FONTTOSUBSFONT_EXPORT ((ULONG)0x00000002) -#define FONTTOSUBSFONT_ONLYOLDSOSYMBOLFONTS ((ULONG)0x00000004) +#define FONTTOSUBSFONT_IMPORT ((sal_uLong)0x00000001) +#define FONTTOSUBSFONT_EXPORT ((sal_uLong)0x00000002) +#define FONTTOSUBSFONT_ONLYOLDSOSYMBOLFONTS ((sal_uLong)0x00000004) typedef void* FontToSubsFontConverter; -UNOTOOLS_DLLPUBLIC FontToSubsFontConverter CreateFontToSubsFontConverter( const String& rFontName, ULONG nFlags ); +UNOTOOLS_DLLPUBLIC FontToSubsFontConverter CreateFontToSubsFontConverter( const String& rFontName, sal_uLong nFlags ); UNOTOOLS_DLLPUBLIC void DestroyFontToSubsFontConverter( FontToSubsFontConverter hConverter ); UNOTOOLS_DLLPUBLIC sal_Unicode ConvertFontToSubsFontChar( FontToSubsFontConverter hConverter, sal_Unicode c ); UNOTOOLS_DLLPUBLIC String GetFontToSubsFontName( FontToSubsFontConverter hConverter ); diff --git a/unotools/inc/unotools/fontdefs.hxx b/unotools/inc/unotools/fontdefs.hxx index c48076f14b29..12d9c43a109d 100644 --- a/unotools/inc/unotools/fontdefs.hxx +++ b/unotools/inc/unotools/fontdefs.hxx @@ -41,12 +41,12 @@ namespace utl { // - SubsFontName - // ---------------- -#define SUBSFONT_ONLYONE ((ULONG)0x00000001) -#define SUBSFONT_MS ((ULONG)0x00000002) -#define SUBSFONT_PS ((ULONG)0x00000004) -#define SUBSFONT_HTML ((ULONG)0x00000008) +#define SUBSFONT_ONLYONE ((sal_uLong)0x00000001) +#define SUBSFONT_MS ((sal_uLong)0x00000002) +#define SUBSFONT_PS ((sal_uLong)0x00000004) +#define SUBSFONT_HTML ((sal_uLong)0x00000008) -UNOTOOLS_DLLPUBLIC String GetSubsFontName( const String& rName, ULONG nFlags ); +UNOTOOLS_DLLPUBLIC String GetSubsFontName( const String& rName, sal_uLong nFlags ); // ----------------- // - FontTokenName - @@ -80,29 +80,29 @@ public: // Default-Font -#define DEFAULTFONT_SANS_UNICODE ((USHORT)1) -#define DEFAULTFONT_SANS ((USHORT)2) -#define DEFAULTFONT_SERIF ((USHORT)3) -#define DEFAULTFONT_FIXED ((USHORT)4) -#define DEFAULTFONT_SYMBOL ((USHORT)5) -#define DEFAULTFONT_UI_SANS ((USHORT)1000) -#define DEFAULTFONT_UI_FIXED ((USHORT)1001) -#define DEFAULTFONT_LATIN_TEXT ((USHORT)2000) -#define DEFAULTFONT_LATIN_PRESENTATION ((USHORT)2001) -#define DEFAULTFONT_LATIN_SPREADSHEET ((USHORT)2002) -#define DEFAULTFONT_LATIN_HEADING ((USHORT)2003) -#define DEFAULTFONT_LATIN_DISPLAY ((USHORT)2004) -#define DEFAULTFONT_LATIN_FIXED ((USHORT)2005) -#define DEFAULTFONT_CJK_TEXT ((USHORT)3000) -#define DEFAULTFONT_CJK_PRESENTATION ((USHORT)3001) -#define DEFAULTFONT_CJK_SPREADSHEET ((USHORT)3002) -#define DEFAULTFONT_CJK_HEADING ((USHORT)3003) -#define DEFAULTFONT_CJK_DISPLAY ((USHORT)3004) -#define DEFAULTFONT_CTL_TEXT ((USHORT)4000) -#define DEFAULTFONT_CTL_PRESENTATION ((USHORT)4001) -#define DEFAULTFONT_CTL_SPREADSHEET ((USHORT)4002) -#define DEFAULTFONT_CTL_HEADING ((USHORT)4003) -#define DEFAULTFONT_CTL_DISPLAY ((USHORT)4004) +#define DEFAULTFONT_SANS_UNICODE ((sal_uInt16)1) +#define DEFAULTFONT_SANS ((sal_uInt16)2) +#define DEFAULTFONT_SERIF ((sal_uInt16)3) +#define DEFAULTFONT_FIXED ((sal_uInt16)4) +#define DEFAULTFONT_SYMBOL ((sal_uInt16)5) +#define DEFAULTFONT_UI_SANS ((sal_uInt16)1000) +#define DEFAULTFONT_UI_FIXED ((sal_uInt16)1001) +#define DEFAULTFONT_LATIN_TEXT ((sal_uInt16)2000) +#define DEFAULTFONT_LATIN_PRESENTATION ((sal_uInt16)2001) +#define DEFAULTFONT_LATIN_SPREADSHEET ((sal_uInt16)2002) +#define DEFAULTFONT_LATIN_HEADING ((sal_uInt16)2003) +#define DEFAULTFONT_LATIN_DISPLAY ((sal_uInt16)2004) +#define DEFAULTFONT_LATIN_FIXED ((sal_uInt16)2005) +#define DEFAULTFONT_CJK_TEXT ((sal_uInt16)3000) +#define DEFAULTFONT_CJK_PRESENTATION ((sal_uInt16)3001) +#define DEFAULTFONT_CJK_SPREADSHEET ((sal_uInt16)3002) +#define DEFAULTFONT_CJK_HEADING ((sal_uInt16)3003) +#define DEFAULTFONT_CJK_DISPLAY ((sal_uInt16)3004) +#define DEFAULTFONT_CTL_TEXT ((sal_uInt16)4000) +#define DEFAULTFONT_CTL_PRESENTATION ((sal_uInt16)4001) +#define DEFAULTFONT_CTL_SPREADSHEET ((sal_uInt16)4002) +#define DEFAULTFONT_CTL_HEADING ((sal_uInt16)4003) +#define DEFAULTFONT_CTL_DISPLAY ((sal_uInt16)4004) UNOTOOLS_DLLPUBLIC String GetNextFontToken( const String& rTokenStr, xub_StrLen& rIndex ); diff --git a/unotools/inc/unotools/inetoptions.hxx b/unotools/inc/unotools/inetoptions.hxx index ac738dd45e45..420705101d12 100644 --- a/unotools/inc/unotools/inetoptions.hxx +++ b/unotools/inc/unotools/inetoptions.hxx @@ -76,27 +76,21 @@ public: enum ProxyType { NONE, AUTOMATIC, MANUAL }; rtl::OUString GetProxyNoProxy() const; - sal_Int32 GetProxyType() const; rtl::OUString GetProxyFtpName() const; - sal_Int32 GetProxyFtpPort() const; rtl::OUString GetProxyHttpName() const; - sal_Int32 GetProxyHttpPort() const; void SetProxyNoProxy(rtl::OUString const & rValue, bool bFlush = false); - void SetProxyType(ProxyType eValue, bool bFlush = false); void SetProxyFtpName(rtl::OUString const & rValue, bool bFlush = false); - void SetProxyFtpPort(sal_Int32 nValue, bool bFlush = false); void SetProxyHttpName(rtl::OUString const & rValue, bool bFlush = false); - void SetProxyHttpPort(sal_Int32 nValue, bool bFlush = false); void flush(); diff --git a/unotools/inc/unotools/intlwrapper.hxx b/unotools/inc/unotools/intlwrapper.hxx index 4273d3611ddf..d614a2088e4e 100644 --- a/unotools/inc/unotools/intlwrapper.hxx +++ b/unotools/inc/unotools/intlwrapper.hxx @@ -70,7 +70,7 @@ private: void ImplNewCharClass() const; void ImplNewLocaleData() const; void ImplNewCalendar() const; - void ImplNewCollator( BOOL bCaseSensitive ) const; + void ImplNewCollator( sal_Bool bCaseSensitive ) const; public: @@ -109,14 +109,14 @@ public: const CollatorWrapper* getCollator() const { if ( !pCollator ) - ImplNewCollator( FALSE ); + ImplNewCollator( sal_False ); return pCollator; } /// case sensitive collator const CollatorWrapper* getCaseCollator() const { if ( !pCaseCollator ) - ImplNewCollator( TRUE ); + ImplNewCollator( sal_True ); return pCaseCollator; } }; diff --git a/unotools/inc/unotools/lingucfg.hxx b/unotools/inc/unotools/lingucfg.hxx index 415d825fb248..f1a2e119a2ed 100644 --- a/unotools/inc/unotools/lingucfg.hxx +++ b/unotools/inc/unotools/lingucfg.hxx @@ -53,89 +53,89 @@ struct UNOTOOLS_DLLPUBLIC SvtLinguOptions ::com::sun::star::uno::Sequence< rtl::OUString > aActiveDics; ::com::sun::star::uno::Sequence< rtl::OUString > aActiveConvDics; - BOOL bROActiveDics; - BOOL bROActiveConvDics; + sal_Bool bROActiveDics; + sal_Bool bROActiveConvDics; // Hyphenator service specific options - INT16 nHyphMinLeading, + sal_Int16 nHyphMinLeading, nHyphMinTrailing, nHyphMinWordLength; - BOOL bROHyphMinLeading, + sal_Bool bROHyphMinLeading, bROHyphMinTrailing, bROHyphMinWordLength; // misc options (non-service specific) - INT16 nDefaultLanguage; - INT16 nDefaultLanguage_CJK; - INT16 nDefaultLanguage_CTL; + sal_Int16 nDefaultLanguage; + sal_Int16 nDefaultLanguage_CJK; + sal_Int16 nDefaultLanguage_CTL; - BOOL bRODefaultLanguage; - BOOL bRODefaultLanguage_CJK; - BOOL bRODefaultLanguage_CTL; + sal_Bool bRODefaultLanguage; + sal_Bool bRODefaultLanguage_CJK; + sal_Bool bRODefaultLanguage_CTL; // spelling options (non-service specific) - BOOL bIsSpellSpecial; - BOOL bIsSpellAuto; - BOOL bIsSpellReverse; + sal_Bool bIsSpellSpecial; + sal_Bool bIsSpellAuto; + sal_Bool bIsSpellReverse; - BOOL bROIsSpellSpecial; - BOOL bROIsSpellAuto; - BOOL bROIsSpellReverse; + sal_Bool bROIsSpellSpecial; + sal_Bool bROIsSpellAuto; + sal_Bool bROIsSpellReverse; // hyphenation options (non-service specific) - BOOL bIsHyphSpecial; - BOOL bIsHyphAuto; + sal_Bool bIsHyphSpecial; + sal_Bool bIsHyphAuto; - BOOL bROIsHyphSpecial; - BOOL bROIsHyphAuto; + sal_Bool bROIsHyphSpecial; + sal_Bool bROIsHyphAuto; // common to SpellChecker, Hyphenator and Thesaurus service - BOOL bIsUseDictionaryList; - BOOL bIsIgnoreControlCharacters; + sal_Bool bIsUseDictionaryList; + sal_Bool bIsIgnoreControlCharacters; - BOOL bROIsUseDictionaryList; - BOOL bROIsIgnoreControlCharacters; + sal_Bool bROIsUseDictionaryList; + sal_Bool bROIsIgnoreControlCharacters; // SpellChecker service specific options - BOOL bIsSpellWithDigits, + sal_Bool bIsSpellWithDigits, bIsSpellUpperCase, bIsSpellCapitalization; - BOOL bROIsSpellWithDigits, + sal_Bool bROIsSpellWithDigits, bROIsSpellUpperCase, bROIsSpellCapitalization; // text conversion specific options - BOOL bIsIgnorePostPositionalWord; - BOOL bIsAutoCloseDialog; - BOOL bIsShowEntriesRecentlyUsedFirst; - BOOL bIsAutoReplaceUniqueEntries; - BOOL bIsDirectionToSimplified; - BOOL bIsUseCharacterVariants; - BOOL bIsTranslateCommonTerms; - BOOL bIsReverseMapping; - - BOOL bROIsIgnorePostPositionalWord; - BOOL bROIsAutoCloseDialog; - BOOL bROIsShowEntriesRecentlyUsedFirst; - BOOL bROIsAutoReplaceUniqueEntries; - BOOL bROIsDirectionToSimplified; - BOOL bROIsUseCharacterVariants; - BOOL bROIsTranslateCommonTerms; - BOOL bROIsReverseMapping; + sal_Bool bIsIgnorePostPositionalWord; + sal_Bool bIsAutoCloseDialog; + sal_Bool bIsShowEntriesRecentlyUsedFirst; + sal_Bool bIsAutoReplaceUniqueEntries; + sal_Bool bIsDirectionToSimplified; + sal_Bool bIsUseCharacterVariants; + sal_Bool bIsTranslateCommonTerms; + sal_Bool bIsReverseMapping; + + sal_Bool bROIsIgnorePostPositionalWord; + sal_Bool bROIsAutoCloseDialog; + sal_Bool bROIsShowEntriesRecentlyUsedFirst; + sal_Bool bROIsAutoReplaceUniqueEntries; + sal_Bool bROIsDirectionToSimplified; + sal_Bool bROIsUseCharacterVariants; + sal_Bool bROIsTranslateCommonTerms; + sal_Bool bROIsReverseMapping; // check value need to determine if the configuration needs to updatet // or not (used for a quick check if data files have been changed/added // or deleted - INT32 nDataFilesChangedCheckValue; - BOOL bRODataFilesChangedCheckValue; + sal_Int32 nDataFilesChangedCheckValue; + sal_Bool bRODataFilesChangedCheckValue; - BOOL bIsGrammarAuto; - BOOL bIsGrammarInteractive; + sal_Bool bIsGrammarAuto; + sal_Bool bIsGrammarInteractive; - BOOL bROIsGrammarAuto; - BOOL bROIsGrammarInteractive; + sal_Bool bROIsGrammarAuto; + sal_Bool bROIsGrammarInteractive; SvtLinguOptions(); }; @@ -197,29 +197,29 @@ public: com::sun::star::uno::Any GetProperty( const rtl::OUString &rPropertyName ) const; com::sun::star::uno::Any - GetProperty( INT32 nPropertyHandle ) const; + GetProperty( sal_Int32 nPropertyHandle ) const; - BOOL SetProperty( const rtl::OUString &rPropertyName, + sal_Bool SetProperty( const rtl::OUString &rPropertyName, const com::sun::star::uno::Any &rValue ); - BOOL SetProperty( INT32 nPropertyHandle, + sal_Bool SetProperty( sal_Int32 nPropertyHandle, const com::sun::star::uno::Any &rValue ); - BOOL GetOptions( SvtLinguOptions &rOptions ) const; - BOOL SetOptions( const SvtLinguOptions &rOptions ); + sal_Bool GetOptions( SvtLinguOptions &rOptions ) const; + sal_Bool SetOptions( const SvtLinguOptions &rOptions ); - BOOL IsReadOnly( const rtl::OUString &rPropertyName ) const; - BOOL IsReadOnly( INT32 nPropertyHandle ) const; + sal_Bool IsReadOnly( const rtl::OUString &rPropertyName ) const; + sal_Bool IsReadOnly( sal_Int32 nPropertyHandle ) const; //! //! the following functions work on the 'ServiceManager' sub node of the //! linguistic configuration only //! - BOOL GetElementNamesFor( const rtl::OUString &rNodeName, com::sun::star::uno::Sequence< rtl::OUString > &rElementNames ) const; + sal_Bool GetElementNamesFor( const rtl::OUString &rNodeName, com::sun::star::uno::Sequence< rtl::OUString > &rElementNames ) const; // - BOOL GetSupportedDictionaryFormatsFor( const rtl::OUString &rSetName, const rtl::OUString &rSetEntry, com::sun::star::uno::Sequence< rtl::OUString > &rFormatList ) const; + sal_Bool GetSupportedDictionaryFormatsFor( const rtl::OUString &rSetName, const rtl::OUString &rSetEntry, com::sun::star::uno::Sequence< rtl::OUString > &rFormatList ) const; void SetOrCreateSupportedDictionaryFormatsFor( const rtl::OUString &rSetName, const rtl::OUString &rSetEntry, const com::sun::star::uno::Sequence< rtl::OUString > &rFormatList ) const; // - BOOL GetDictionaryEntry( const rtl::OUString &rNodeName, SvtLinguConfigDictionaryEntry &rDicEntry ) const; + sal_Bool GetDictionaryEntry( const rtl::OUString &rNodeName, SvtLinguConfigDictionaryEntry &rDicEntry ) const; void SetOrCreateDictionaryEntry( const rtl::OUString &rNodeName, const SvtLinguConfigDictionaryEntry &rDicEntry ) const; // com::sun::star::uno::Sequence< rtl::OUString > GetDisabledDictionaries() const; @@ -228,11 +228,11 @@ public: std::vector< SvtLinguConfigDictionaryEntry > GetActiveDictionariesByFormat( const rtl::OUString &rFormatName ); // functions returning file URLs to the respective images (if found) and empty string otherwise - ::rtl::OUString GetSpellAndGrammarDialogImage( const ::rtl::OUString &rServiceImplName, bool bHighContrast = false ) const; - ::rtl::OUString GetSpellAndGrammarContextSuggestionImage( const ::rtl::OUString &rServiceImplName, bool bHighContrast = false ) const; - ::rtl::OUString GetSpellAndGrammarContextDictionaryImage( const ::rtl::OUString &rServiceImplName, bool bHighContrast = false ) const; - ::rtl::OUString GetThesaurusDialogImage( const ::rtl::OUString &rServiceImplName, bool bHighContrast = false ) const; - ::rtl::OUString GetSynonymsContextImage( const ::rtl::OUString &rServiceImplName, bool bHighContrast = false ) const; + ::rtl::OUString GetSpellAndGrammarDialogImage( const ::rtl::OUString &rServiceImplName ) const; + ::rtl::OUString GetSpellAndGrammarContextSuggestionImage( const ::rtl::OUString &rServiceImplName ) const; + ::rtl::OUString GetSpellAndGrammarContextDictionaryImage( const ::rtl::OUString &rServiceImplName ) const; + ::rtl::OUString GetThesaurusDialogImage( const ::rtl::OUString &rServiceImplName ) const; + ::rtl::OUString GetSynonymsContextImage( const ::rtl::OUString &rServiceImplName ) const; bool HasVendorImages( const char *pImageName ) const; bool HasGrammarChecker() const; diff --git a/unotools/inc/unotools/localedatawrapper.hxx b/unotools/inc/unotools/localedatawrapper.hxx index 865bddb455b3..306316683b94 100644 --- a/unotools/inc/unotools/localedatawrapper.hxx +++ b/unotools/inc/unotools/localedatawrapper.hxx @@ -64,7 +64,7 @@ enum MeasurementSystem { class UNOTOOLS_DLLPUBLIC LocaleDataWrapper { - static BYTE nLocaleDataChecking; // 0:=dontknow, 1:=yes, 2:=no + static sal_uInt8 nLocaleDataChecking; // 0:=dontknow, 1:=yes, 2:=no ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xSMgr; ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XLocaleData2 > xLD; @@ -80,11 +80,11 @@ class UNOTOOLS_DLLPUBLIC LocaleDataWrapper String aCurrBankSymbol; int nDateFormat; int nLongDateFormat; - USHORT nCurrPositiveFormat; - USHORT nCurrNegativeFormat; - USHORT nCurrDigits; - BOOL bLocaleDataItemValid; - BOOL bReservedWordValid; + sal_uInt16 nCurrPositiveFormat; + sal_uInt16 nCurrNegativeFormat; + sal_uInt16 nCurrDigits; + sal_Bool bLocaleDataItemValid; + sal_Bool bReservedWordValid; mutable ::utl::ReadWriteMutex aMutex; // dummies, to be implemented or provided by XML locale data @@ -118,8 +118,8 @@ class UNOTOOLS_DLLPUBLIC LocaleDataWrapper void getDefaultCalendarImpl(); sal_Unicode* ImplAddFormatNum( sal_Unicode* pBuf, - sal_Int64 nNumber, USHORT nDecimals, - BOOL bUseThousandSep, BOOL bTrailingZeros ) const; + sal_Int64 nNumber, sal_uInt16 nDecimals, + sal_Bool bUseThousandSep, sal_Bool bTrailingZeros ) const; void getDigitGroupingImpl(); @@ -241,19 +241,19 @@ public: // currency const String& getCurrSymbol() const; const String& getCurrBankSymbol() const; - USHORT getCurrPositiveFormat() const; - USHORT getCurrNegativeFormat() const; - USHORT getCurrDigits() const; + sal_uInt16 getCurrPositiveFormat() const; + sal_uInt16 getCurrNegativeFormat() const; + sal_uInt16 getCurrDigits() const; // simple date and time formatting DateFormat getDateFormat() const; DateFormat getLongDateFormat() const; /// only numerical values of Gregorian calendar String getDate( const Date& rDate ) const; - String getTime( const Time& rTime, BOOL bSec = TRUE, - BOOL b100Sec = FALSE ) const; + String getTime( const Time& rTime, sal_Bool bSec = sal_True, + sal_Bool b100Sec = sal_False ) const; String getDuration( const Time& rTime, - BOOL bSec = TRUE, BOOL b100Sec = FALSE ) const; + sal_Bool bSec = sal_True, sal_Bool b100Sec = sal_False ) const; /** The CalendarWrapper already <b>MUST</b> have loaded a calendar. @@ -282,37 +282,37 @@ public: @param nNumber value * 10**nDecimals @param bTrailingZeros - </TRUE> := always display trailing zeros in + </sal_True> := always display trailing zeros in decimal places, even if integer value. - </FALSE> := trailing zeros are only displayed + </sal_False> := trailing zeros are only displayed if the value is not an integer value. */ - String getNum( sal_Int64 nNumber, USHORT nDecimals, - BOOL bUseThousandSep = TRUE, - BOOL bTrailingZeros = TRUE ) const; + String getNum( sal_Int64 nNumber, sal_uInt16 nDecimals, + sal_Bool bUseThousandSep = sal_True, + sal_Bool bTrailingZeros = sal_True ) const; /// "Secure" currency formatted string. - String getCurr( sal_Int64 nNumber, USHORT nDecimals, + String getCurr( sal_Int64 nNumber, sal_uInt16 nDecimals, const String& rCurrencySymbol, - BOOL bUseThousandSep = TRUE ) const; + sal_Bool bUseThousandSep = sal_True ) const; /** Default currency formatted string, use with care as default currency may change in any locale, for example, DEM -> EUR */ - String getCurr( sal_Int64 nNumber, USHORT nDecimals, - BOOL bUseThousandSep = TRUE ) const + String getCurr( sal_Int64 nNumber, sal_uInt16 nDecimals, + sal_Bool bUseThousandSep = sal_True ) const { return getCurr( nNumber, nDecimals, getCurrSymbol(), bUseThousandSep ); } // dummy returns, to be implemented inline sal_Unicode getCurrZeroChar() const { return cCurrZeroChar; } - inline BOOL isNumLeadingZero() const - { return TRUE; } + inline sal_Bool isNumLeadingZero() const + { return sal_True; } /// standard decimal places - inline USHORT getNumDigits() const + inline sal_uInt16 getNumDigits() const { return 2; } - inline BOOL isNumTrailingZeros() const - { return TRUE; } + inline sal_Bool isNumTrailingZeros() const + { return sal_True; } // reserved words diff --git a/unotools/inc/unotools/loghelper.hxx b/unotools/inc/unotools/loghelper.hxx index 4427d45445f0..bae5c7ed09c4 100644 --- a/unotools/inc/unotools/loghelper.hxx +++ b/unotools/inc/unotools/loghelper.hxx @@ -45,7 +45,7 @@ inline void logIt(const css::uno::Exception& ex) sMsg.appendAscii("Unexpected exception catched. Original message was:\n\"" ); sMsg.append(ex.Message); sMsg.appendAscii("\""); - OSL_ENSURE(sal_False, ::rtl::OUStringToOString(sMsg.makeStringAndClear(), RTL_TEXTENCODING_UTF8).getStr()); + OSL_FAIL(::rtl::OUStringToOString(sMsg.makeStringAndClear(), RTL_TEXTENCODING_UTF8).getStr()); } #endif diff --git a/unotools/inc/unotools/misccfg.hxx b/unotools/inc/unotools/misccfg.hxx index 87b8173da42e..39777fc0b3d7 100644 --- a/unotools/inc/unotools/misccfg.hxx +++ b/unotools/inc/unotools/misccfg.hxx @@ -32,9 +32,6 @@ #include "tools/solar.h" #include "unotools/options.hxx" -/*-------------------------------------------------------------------- - Beschreibung: - --------------------------------------------------------------------*/ namespace utl { class SfxMiscCfg; @@ -47,14 +44,14 @@ public: MiscCfg( ); virtual ~MiscCfg( ); - BOOL IsNotFoundWarning() const; - void SetNotFoundWarning( BOOL bSet); + sal_Bool IsNotFoundWarning() const; + void SetNotFoundWarning( sal_Bool bSet); - BOOL IsPaperSizeWarning() const; - void SetPaperSizeWarning(BOOL bSet); + sal_Bool IsPaperSizeWarning() const; + void SetPaperSizeWarning(sal_Bool bSet); - BOOL IsPaperOrientationWarning() const; - void SetPaperOrientationWarning( BOOL bSet); + sal_Bool IsPaperOrientationWarning() const; + void SetPaperOrientationWarning( sal_Bool bSet); // 0 ... 99 sal_Int32 GetYear2000() const; diff --git a/unotools/inc/unotools/options.hxx b/unotools/inc/unotools/options.hxx index 56f877e03fe7..d743e9571524 100644 --- a/unotools/inc/unotools/options.hxx +++ b/unotools/inc/unotools/options.hxx @@ -31,6 +31,7 @@ #include "sal/config.h" #include "unotools/unotoolsdllapi.h" +#include <vector> /* The class utl::detail::Options provides a kind of multiplexer. It implements a ConfigurationListener @@ -44,7 +45,6 @@ namespace utl { class ConfigurationBroadcaster; - class IMPL_ConfigurationListenerList; // interface for configuration listener class UNOTOOLS_DLLPUBLIC ConfigurationListener @@ -52,6 +52,7 @@ namespace utl { public: virtual void ConfigurationChanged( ConfigurationBroadcaster* p, sal_uInt32 nHint=0 ) = 0; }; + typedef ::std::vector< ConfigurationListener* > IMPL_ConfigurationListenerList; // complete broadcasting implementation class UNOTOOLS_DLLPUBLIC ConfigurationBroadcaster diff --git a/unotools/inc/unotools/pathoptions.hxx b/unotools/inc/unotools/pathoptions.hxx index 7b471ed68a1d..53e6ccaca463 100644 --- a/unotools/inc/unotools/pathoptions.hxx +++ b/unotools/inc/unotools/pathoptions.hxx @@ -102,7 +102,7 @@ public: const String& GetUIConfigPath() const; const String& GetFingerprintPath() const; - BOOL IsPathReadonly(Pathes ePath)const; + sal_Bool IsPathReadonly(Pathes ePath)const; const String& GetPath(Pathes ePath) const; // set the pathes @@ -130,8 +130,9 @@ public: void SetWorkPath( const String& rPath ); void SetPath( SvtPathOptions::Pathes ePath, const String& rNewPath ); - String SubstituteVariable( const String& rVar ); - String UseVariable( const String& rVar ); + String SubstituteVariable( const String& rVar ) const; + String ExpandMacros( const String& rPath ) const; + String UseVariable( const String& rVar ) const; sal_Bool SearchFile( String& rIniFile, Pathes ePath = PATH_USERCONFIG ); ::com::sun::star::lang::Locale GetLocale() const; sal_Bool IsReadonly() const; diff --git a/unotools/inc/unotools/searchopt.hxx b/unotools/inc/unotools/searchopt.hxx index d8cf6819f389..10ed2ca79bce 100644 --- a/unotools/inc/unotools/searchopt.hxx +++ b/unotools/inc/unotools/searchopt.hxx @@ -48,71 +48,71 @@ public: SvtSearchOptions(); ~SvtSearchOptions(); - INT32 GetTransliterationFlags() const; + sal_Int32 GetTransliterationFlags() const; // // General Options // - BOOL IsWholeWordsOnly() const; - BOOL IsBackwards() const; - BOOL IsUseRegularExpression() const; - BOOL IsSearchForStyles() const; - BOOL IsSimilaritySearch() const; - BOOL IsUseAsianOptions() const; - BOOL IsMatchCase() const; // also Japanese search option - BOOL IsNotes() const; - - void SetWholeWordsOnly( BOOL bVal ); - void SetBackwards( BOOL bVal ); - void SetUseRegularExpression( BOOL bVal ); - void SetSearchForStyles( BOOL bVal ); - void SetSimilaritySearch( BOOL bVal ); - void SetUseAsianOptions( BOOL bVal ); - void SetMatchCase( BOOL bVal ); // also Japanese search option - void SetNotes( BOOL bVal); + sal_Bool IsWholeWordsOnly() const; + sal_Bool IsBackwards() const; + sal_Bool IsUseRegularExpression() const; + sal_Bool IsSearchForStyles() const; + sal_Bool IsSimilaritySearch() const; + sal_Bool IsUseAsianOptions() const; + sal_Bool IsMatchCase() const; // also Japanese search option + sal_Bool IsNotes() const; + + void SetWholeWordsOnly( sal_Bool bVal ); + void SetBackwards( sal_Bool bVal ); + void SetUseRegularExpression( sal_Bool bVal ); + void SetSearchForStyles( sal_Bool bVal ); + void SetSimilaritySearch( sal_Bool bVal ); + void SetUseAsianOptions( sal_Bool bVal ); + void SetMatchCase( sal_Bool bVal ); // also Japanese search option + void SetNotes( sal_Bool bVal); // // Japanese search options // - BOOL IsMatchFullHalfWidthForms() const; - BOOL IsMatchHiraganaKatakana() const; - BOOL IsMatchContractions() const; - BOOL IsMatchMinusDashChoon() const; - BOOL IsMatchRepeatCharMarks() const; - BOOL IsMatchVariantFormKanji() const; - BOOL IsMatchOldKanaForms() const; - BOOL IsMatchDiziDuzu() const; - BOOL IsMatchBavaHafa() const; - BOOL IsMatchTsithichiDhizi() const; - BOOL IsMatchHyuiyuByuvyu() const; - BOOL IsMatchSesheZeje() const; - BOOL IsMatchIaiya() const; - BOOL IsMatchKiku() const; - BOOL IsIgnorePunctuation() const; - BOOL IsIgnoreWhitespace() const; - BOOL IsIgnoreProlongedSoundMark() const; - BOOL IsIgnoreMiddleDot() const; - - void SetMatchFullHalfWidthForms( BOOL bVal ); - void SetMatchHiraganaKatakana( BOOL bVal ); - void SetMatchContractions( BOOL bVal ); - void SetMatchMinusDashChoon( BOOL bVal ); - void SetMatchRepeatCharMarks( BOOL bVal ); - void SetMatchVariantFormKanji( BOOL bVal ); - void SetMatchOldKanaForms( BOOL bVal ); - void SetMatchDiziDuzu( BOOL bVal ); - void SetMatchBavaHafa( BOOL bVal ); - void SetMatchTsithichiDhizi( BOOL bVal ); - void SetMatchHyuiyuByuvyu( BOOL bVal ); - void SetMatchSesheZeje( BOOL bVal ); - void SetMatchIaiya( BOOL bVal ); - void SetMatchKiku( BOOL bVal ); - void SetIgnorePunctuation( BOOL bVal ); - void SetIgnoreWhitespace( BOOL bVal ); - void SetIgnoreProlongedSoundMark( BOOL bVal ); - void SetIgnoreMiddleDot( BOOL bVal ); + sal_Bool IsMatchFullHalfWidthForms() const; + sal_Bool IsMatchHiraganaKatakana() const; + sal_Bool IsMatchContractions() const; + sal_Bool IsMatchMinusDashChoon() const; + sal_Bool IsMatchRepeatCharMarks() const; + sal_Bool IsMatchVariantFormKanji() const; + sal_Bool IsMatchOldKanaForms() const; + sal_Bool IsMatchDiziDuzu() const; + sal_Bool IsMatchBavaHafa() const; + sal_Bool IsMatchTsithichiDhizi() const; + sal_Bool IsMatchHyuiyuByuvyu() const; + sal_Bool IsMatchSesheZeje() const; + sal_Bool IsMatchIaiya() const; + sal_Bool IsMatchKiku() const; + sal_Bool IsIgnorePunctuation() const; + sal_Bool IsIgnoreWhitespace() const; + sal_Bool IsIgnoreProlongedSoundMark() const; + sal_Bool IsIgnoreMiddleDot() const; + + void SetMatchFullHalfWidthForms( sal_Bool bVal ); + void SetMatchHiraganaKatakana( sal_Bool bVal ); + void SetMatchContractions( sal_Bool bVal ); + void SetMatchMinusDashChoon( sal_Bool bVal ); + void SetMatchRepeatCharMarks( sal_Bool bVal ); + void SetMatchVariantFormKanji( sal_Bool bVal ); + void SetMatchOldKanaForms( sal_Bool bVal ); + void SetMatchDiziDuzu( sal_Bool bVal ); + void SetMatchBavaHafa( sal_Bool bVal ); + void SetMatchTsithichiDhizi( sal_Bool bVal ); + void SetMatchHyuiyuByuvyu( sal_Bool bVal ); + void SetMatchSesheZeje( sal_Bool bVal ); + void SetMatchIaiya( sal_Bool bVal ); + void SetMatchKiku( sal_Bool bVal ); + void SetIgnorePunctuation( sal_Bool bVal ); + void SetIgnoreWhitespace( sal_Bool bVal ); + void SetIgnoreProlongedSoundMark( sal_Bool bVal ); + void SetIgnoreMiddleDot( sal_Bool bVal ); }; diff --git a/unotools/inc/unotools/sourceviewconfig.hxx b/unotools/inc/unotools/sourceviewconfig.hxx index 2450ee27092b..02b2ab0ab79b 100644 --- a/unotools/inc/unotools/sourceviewconfig.hxx +++ b/unotools/inc/unotools/sourceviewconfig.hxx @@ -35,9 +35,6 @@ #include <rtl/ustring.hxx> #include <unotools/options.hxx> -/* -----------------------------12.10.00 11:40-------------------------------- - - ---------------------------------------------------------------------------*/ namespace utl { class SourceViewConfig_Impl; diff --git a/unotools/inc/unotools/streamwrap.hxx b/unotools/inc/unotools/streamwrap.hxx index 57eedfb533b6..f05be3584229 100644 --- a/unotools/inc/unotools/streamwrap.hxx +++ b/unotools/inc/unotools/streamwrap.hxx @@ -51,7 +51,7 @@ namespace utl //================================================================== typedef ::cppu::WeakImplHelper1 < stario::XInputStream > InputStreamWrapper_Base; - // needed for some compilers +// needed for some compilers /// helper class for wrapping an SvStream into an <type scope="com.sun.star.io">XInputStream</type> class UNOTOOLS_DLLPUBLIC OInputStreamWrapper : public InputStreamWrapper_Base { @@ -69,9 +69,6 @@ public: OInputStreamWrapper(SvStream* pStream, sal_Bool bOwner=sal_False); virtual ~OInputStreamWrapper(); -// UNO Anbindung - DECLARE_UNO3_AGG_DEFAULTS(OInputStreamWrapper, InputStreamWrapper_Base); - // 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); @@ -122,9 +119,6 @@ protected: public: OOutputStreamWrapper(SvStream& _rStream) :rStream(_rStream) { } -// UNO Anbindung - DECLARE_UNO3_AGG_DEFAULTS(OOutputStreamWrapper, OutputStreamWrapper_Base); - // 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); diff --git a/unotools/inc/unotools/syslocaleoptions.hxx b/unotools/inc/unotools/syslocaleoptions.hxx index dc3721bcaba7..7d70ebd589b3 100644 --- a/unotools/inc/unotools/syslocaleoptions.hxx +++ b/unotools/inc/unotools/syslocaleoptions.hxx @@ -39,10 +39,10 @@ #include <unotools/options.hxx> // bits for broadcasting hints of changes in a SfxSimpleHint, may be combined -const ULONG SYSLOCALEOPTIONS_HINT_LOCALE = 0x00000001; -const ULONG SYSLOCALEOPTIONS_HINT_CURRENCY = 0x00000002; -const ULONG SYSLOCALEOPTIONS_HINT_UILOCALE = 0x00000004; -const ULONG SYSLOCALEOPTIONS_HINT_DECSEP = 0x00000008; +const sal_uLong SYSLOCALEOPTIONS_HINT_LOCALE = 0x00000001; +const sal_uLong SYSLOCALEOPTIONS_HINT_CURRENCY = 0x00000002; +const sal_uLong SYSLOCALEOPTIONS_HINT_UILOCALE = 0x00000004; +const sal_uLong SYSLOCALEOPTIONS_HINT_DECSEP = 0x00000008; class SvtSysLocaleOptions_Impl; class SvtListener; @@ -93,8 +93,8 @@ public: @ATTENTION All SvtSysLocaleOptions instances point to exactly one refcounted internal representation instance and broadcast blocks are counted. - Thus if you issue a BlockBroadcasts(TRUE) you MUST issue a matching - BlockBroadcasts(FALSE) or otherwise pending hints would never be + Thus if you issue a BlockBroadcasts(sal_True) you MUST issue a matching + BlockBroadcasts(sal_False) or otherwise pending hints would never be broadcasted again. */ virtual void BlockBroadcasts( bool bBlock ); diff --git a/unotools/inc/unotools/textsearch.hxx b/unotools/inc/unotools/textsearch.hxx index 664105bb8b47..bbc40cda01bd 100644 --- a/unotools/inc/unotools/textsearch.hxx +++ b/unotools/inc/unotools/textsearch.hxx @@ -82,9 +82,9 @@ private: public: SearchParam( const String &rText, SearchType eSrchType = SearchParam::SRCH_NORMAL, - BOOL bCaseSens = TRUE, - BOOL bWrdOnly = FALSE, - BOOL bSrchInSel = FALSE ); + sal_Bool bCaseSens = sal_True, + sal_Bool bWrdOnly = sal_False, + sal_Bool bSrchInSel = sal_False ); SearchParam( const SearchParam& ); const String& GetSrchStr() const { return sSrchStr; } @@ -151,14 +151,14 @@ public: pStart - start position for the search pEnde - end position for the search - RETURN values == TRUE: something is found + RETURN values == sal_True: something is found - pStart start pos of the found text, - pStart end pos of the found text, - pSrchResult - the search result with all found positions. Is only filled with more positions if the regular expression handles groups. - == FALSE: nothing found, pStart,pEnde unchanged. + == sal_False: nothing found, pStart,pEnde unchanged. Definitions: start pos always inclusive, end pos always exclusive! The position must always in the right direction! diff --git a/unotools/inc/unotools/ucbhelper.hxx b/unotools/inc/unotools/ucbhelper.hxx index 7bfd0d4f4a8c..44af28b17ecc 100644 --- a/unotools/inc/unotools/ucbhelper.hxx +++ b/unotools/inc/unotools/ucbhelper.hxx @@ -74,12 +74,12 @@ namespace utl sal_Bool bNewOnly = sal_False ); static sal_Bool HasParentFolder( const String& rFolder ); - static ULONG GetSize( const String& rContent ); + static sal_uLong GetSize( const String& rContent ); static sal_Bool IsYounger( const String& rIsYoung, const String& rIsOlder ); static sal_Bool Exists( const String& rContent ); - static sal_Bool FindInPath( const String& rPath, const String& rName, String& rFile, char cDelim = ';', BOOL bAllowWildCards = TRUE ); - static sal_Bool Find( const String& rFolder, const String& rName, String& rFile, BOOL bAllowWildCards = FALSE ); + static sal_Bool FindInPath( const String& rPath, const String& rName, String& rFile, char cDelim = ';', sal_Bool bAllowWildCards = sal_True ); + static sal_Bool Find( const String& rFolder, const String& rName, String& rFile, sal_Bool bAllowWildCards = sal_False ); static sal_Bool IsSubPath( const ::rtl::OUString& rPath, const ::rtl::OUString& rChildCandidate, const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContentProvider >& xContentProvider = ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContentProvider >() ); static sal_Bool EqualURLs( const ::rtl::OUString& aFirstURL, const ::rtl::OUString& aSecondURL ); }; diff --git a/unotools/inc/unotools/ucblockbytes.hxx b/unotools/inc/unotools/ucblockbytes.hxx index a7090d5efebc..d3c53e882fec 100644 --- a/unotools/inc/unotools/ucblockbytes.hxx +++ b/unotools/inc/unotools/ucblockbytes.hxx @@ -91,7 +91,7 @@ public: {} virtual void Handle( LoadHandlerItem nWhich, UcbLockBytesRef xLockBytes ) = 0; - void Activate( BOOL bActivate = sal_True ) { m_bActive = bActivate; } + void Activate( sal_Bool bActivate = sal_True ) { m_bActive = bActivate; } sal_Bool IsActive() const { return m_bActive; } }; @@ -152,11 +152,11 @@ public: static UcbLockBytesRef CreateLockBytes( const NS_UNO::Reference < NS_IO::XStream >& xContent ); // SvLockBytes - virtual void SetSynchronMode (BOOL bSynchron); - virtual ErrCode ReadAt ( ULONG nPos, void *pBuffer, ULONG nCount, ULONG *pRead) const; - virtual ErrCode WriteAt ( ULONG, const void*, ULONG, ULONG *pWritten); + virtual void SetSynchronMode (sal_Bool bSynchron); + virtual ErrCode ReadAt ( sal_uLong nPos, void *pBuffer, sal_uLong nCount, sal_uLong *pRead) const; + virtual ErrCode WriteAt ( sal_uLong, const void*, sal_uLong, sal_uLong *pWritten); virtual ErrCode Flush (void) const; - virtual ErrCode SetSize (ULONG); + virtual ErrCode SetSize (sal_uLong); virtual ErrCode Stat ( SvLockBytesStat *pStat, SvLockBytesStatFlag) const; void SetError( ErrCode nError ) diff --git a/unotools/inc/unotools/unotunnelhelper.hxx b/unotools/inc/unotools/unotunnelhelper.hxx index de9c82da995a..b573fef7b883 100644 --- a/unotools/inc/unotools/unotunnelhelper.hxx +++ b/unotools/inc/unotools/unotunnelhelper.hxx @@ -34,8 +34,7 @@ #include <com/sun/star/lang/XUnoTunnel.hpp> #include <rtl/uuid.h> #include <rtl/memory.h> - -#include <cppuhelper/extract.hxx> +#include <comphelper/extract.hxx> namespace utl { diff --git a/unotools/inc/unotools/useroptions.hxx b/unotools/inc/unotools/useroptions.hxx index 7230e3bb2da6..17f4d52bc248 100644 --- a/unotools/inc/unotools/useroptions.hxx +++ b/unotools/inc/unotools/useroptions.hxx @@ -36,23 +36,23 @@ // define ---------------------------------------------------------------- -#define USER_OPT_CITY ((USHORT)0) -#define USER_OPT_COMPANY ((USHORT)1) -#define USER_OPT_COUNTRY ((USHORT)2) -#define USER_OPT_EMAIL ((USHORT)3) -#define USER_OPT_FAX ((USHORT)4) -#define USER_OPT_FIRSTNAME ((USHORT)5) -#define USER_OPT_LASTNAME ((USHORT)6) -#define USER_OPT_POSITION ((USHORT)7) -#define USER_OPT_STATE ((USHORT)8) -#define USER_OPT_STREET ((USHORT)9) -#define USER_OPT_TELEPHONEHOME ((USHORT)10) -#define USER_OPT_TELEPHONEWORK ((USHORT)11) -#define USER_OPT_TITLE ((USHORT)12) -#define USER_OPT_ID ((USHORT)13) -#define USER_OPT_ZIP ((USHORT)14) -#define USER_OPT_FATHERSNAME ((USHORT)15) -#define USER_OPT_APARTMENT ((USHORT)16) +#define USER_OPT_CITY ((sal_uInt16)0) +#define USER_OPT_COMPANY ((sal_uInt16)1) +#define USER_OPT_COUNTRY ((sal_uInt16)2) +#define USER_OPT_EMAIL ((sal_uInt16)3) +#define USER_OPT_FAX ((sal_uInt16)4) +#define USER_OPT_FIRSTNAME ((sal_uInt16)5) +#define USER_OPT_LASTNAME ((sal_uInt16)6) +#define USER_OPT_POSITION ((sal_uInt16)7) +#define USER_OPT_STATE ((sal_uInt16)8) +#define USER_OPT_STREET ((sal_uInt16)9) +#define USER_OPT_TELEPHONEHOME ((sal_uInt16)10) +#define USER_OPT_TELEPHONEWORK ((sal_uInt16)11) +#define USER_OPT_TITLE ((sal_uInt16)12) +#define USER_OPT_ID ((sal_uInt16)13) +#define USER_OPT_ZIP ((sal_uInt16)14) +#define USER_OPT_FATHERSNAME ((sal_uInt16)15) +#define USER_OPT_APARTMENT ((sal_uInt16)16) // class SvtUserOptions -------------------------------------------------- @@ -112,8 +112,8 @@ public: void SetFathersName( const ::rtl::OUString& rNewToken ); void SetApartment( const ::rtl::OUString& rNewToken ); - sal_Bool IsTokenReadonly( USHORT nToken ) const; - ::rtl::OUString GetToken(USHORT nToken) const; + sal_Bool IsTokenReadonly( sal_uInt16 nToken ) const; + ::rtl::OUString GetToken(sal_uInt16 nToken) const; }; #endif // #ifndef INCLUDED_unotools_USEROPTIONS_HXX diff --git a/unotools/prj/build.lst b/unotools/prj/build.lst index bb63ba975ed2..2d57eb6754aa 100644 --- a/unotools/prj/build.lst +++ b/unotools/prj/build.lst @@ -1,4 +1,4 @@ -ut unotools : comphelper cppuhelper offuh tools ucbhelper NULL +ut unotools : LIBXSLT:libxslt comphelper cppuhelper offuh tools ucbhelper NULL ut unotools usr1 - all ut_mkout NULL ut unotools\inc nmake - all ut_inc NULL ut unotools\source\misc nmake - all ut_misc ut_config ut_inc NULL diff --git a/unotools/prj/d.lst b/unotools/prj/d.lst index ad8a764055b2..38cafd0cc1f8 100644 --- a/unotools/prj/d.lst +++ b/unotools/prj/d.lst @@ -9,3 +9,4 @@ mkdir: %_DEST%\inc%_EXT%\unotools ..\inc\unotools\*.hxx %_DEST%\inc%_EXT%\unotools\*.hxx ..\inc\unotools\unotoolsdllapi.h %_DEST%\inc%_EXT%\unotools\unotoolsdllapi.h +..\%__SRC%\misc\utl.component %_DEST%\xml%_EXT%\utl.component diff --git a/unotools/qa/complex/tempfile/TempFileUnitTest.java b/unotools/qa/complex/tempfile/TempFileUnitTest.java index 5cd0b7292105..e5f1f2d6d6b2 100644 --- a/unotools/qa/complex/tempfile/TempFileUnitTest.java +++ b/unotools/qa/complex/tempfile/TempFileUnitTest.java @@ -26,60 +26,89 @@ ************************************************************************/ package complex.tempfile; -import complexlib.ComplexTestCase; +// import complexlib.ComplexTestCase; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.ucb.XSimpleFileAccess; import com.sun.star.uno.UnoRuntime; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.openoffice.test.OfficeConnection; +import static org.junit.Assert.*; + /* Document. */ -public class TempFileUnitTest extends ComplexTestCase { +public class TempFileUnitTest /* extends ComplexTestCase */ { private XMultiServiceFactory m_xMSF = null; private XSimpleFileAccess m_xSFA = null; - public String[] getTestMethodNames() { - return new String[] { - "ExecuteTest01", - "ExecuteTest02"}; - } - - public String getTestObjectName() { - return "TempFileUnitTest"; - } +// public String[] getTestMethodNames() { +// return new String[] { +// "ExecuteTest01", +// "ExecuteTest02"}; +// } +// +// public String getTestObjectName() { +// return "TempFileUnitTest"; +// } - public void before() { - m_xMSF = (XMultiServiceFactory)param.getMSF(); + @Before public void before() { + m_xMSF = getMSF(); if ( m_xMSF == null ) { - failed ( "Cannot create service factory!" ); + fail ( "Cannot create service factory!" ); } try { Object oSFA = m_xMSF.createInstance( "com.sun.star.ucb.SimpleFileAccess" ); - m_xSFA = ( XSimpleFileAccess )UnoRuntime.queryInterface( XSimpleFileAccess.class, - oSFA ); + m_xSFA = UnoRuntime.queryInterface( XSimpleFileAccess.class, oSFA ); } catch ( Exception e ) { - failed ( "Cannot get simple file access! Exception: " + e); + fail ( "Cannot get simple file access! Exception: " + e); } if ( m_xSFA == null ) { - failed ( "Cannot get simple file access!" ); + fail ( "Cannot get simple file access!" ); } } - public void after() { + @After public void after() { m_xMSF = null; m_xSFA = null; } - public void ExecuteTest01() { - TempFileTest aTest = new Test01( m_xMSF, m_xSFA, log ); - assure( "Test01 failed!", aTest.test() ); + @Test public void ExecuteTest01() { + TempFileTest aTest = new Test01( m_xMSF, m_xSFA ); + assertTrue( "Test01 failed!", aTest.test() ); + } + + @Test public void ExecuteTest02() { + TempFileTest aTest = new Test02( m_xMSF, m_xSFA ); + assertTrue( "Test02 failed!", aTest.test() ); } - public void ExecuteTest02() { - TempFileTest aTest = new Test02( m_xMSF, m_xSFA, log ); - assure( "Test02 failed!", aTest.test() ); + private XMultiServiceFactory getMSF() + { + final XMultiServiceFactory xMSF1 = UnoRuntime.queryInterface(XMultiServiceFactory.class, connection.getComponentContext().getServiceManager()); + return xMSF1; } -};
\ No newline at end of file + + // setup and close connections + @BeforeClass public static void setUpConnection() throws Exception { + System.out.println("setUpConnection()"); + connection.setUp(); + } + + @AfterClass public static void tearDownConnection() + throws InterruptedException, com.sun.star.uno.Exception + { + System.out.println("tearDownConnection()"); + connection.tearDown(); + } + + private static final OfficeConnection connection = new OfficeConnection(); +}; + diff --git a/unotools/qa/complex/tempfile/Test01.java b/unotools/qa/complex/tempfile/Test01.java index dbf3d6c15de2..3eac1c2ecf44 100644 --- a/unotools/qa/complex/tempfile/Test01.java +++ b/unotools/qa/complex/tempfile/Test01.java @@ -26,7 +26,7 @@ ************************************************************************/ package complex.tempfile; -import complexlib.ComplexTestCase; +// import complexlib.ComplexTestCase; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.ucb.XSimpleFileAccess; @@ -42,10 +42,10 @@ public class Test01 implements TempFileTest { XSimpleFileAccess m_xSFA = null; TestHelper m_aTestHelper = null; - public Test01(XMultiServiceFactory xMSF, XSimpleFileAccess xSFA, LogWriter aLogWriter) { + public Test01(XMultiServiceFactory xMSF, XSimpleFileAccess xSFA) { m_xMSF = xMSF; m_xSFA = xSFA; - m_aTestHelper = new TestHelper(aLogWriter, "Test01: "); + m_aTestHelper = new TestHelper( "Test01: "); } public boolean test() { @@ -56,11 +56,9 @@ public class Test01 implements TempFileTest { //create a temporary file. try { Object oTempFile = m_xMSF.createInstance( "com.sun.star.io.TempFile" ); - xTempFile = (XTempFile) UnoRuntime.queryInterface( XTempFile.class, - oTempFile ); + xTempFile = UnoRuntime.queryInterface(XTempFile.class, oTempFile); m_aTestHelper.Message( "Tempfile created." ); - xTruncate = (XTruncate)UnoRuntime.queryInterface( XTruncate.class, - oTempFile ); + xTruncate = UnoRuntime.queryInterface(XTruncate.class, oTempFile); } catch( Exception e ) { m_aTestHelper.Error( "Cannot create TempFile. exception: " + e ); return false; diff --git a/unotools/qa/complex/tempfile/Test02.java b/unotools/qa/complex/tempfile/Test02.java index 18ca4de2e04b..79e27720b31e 100644 --- a/unotools/qa/complex/tempfile/Test02.java +++ b/unotools/qa/complex/tempfile/Test02.java @@ -26,15 +26,13 @@ ************************************************************************/ package complex.tempfile; -import complexlib.ComplexTestCase; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.ucb.XSimpleFileAccess; import com.sun.star.io.*; -import com.sun.star.lang.XServiceInfo; + import com.sun.star.uno.UnoRuntime; import java.util.Random; -import share.LogWriter; public class Test02 implements TempFileTest { @@ -42,10 +40,10 @@ public class Test02 implements TempFileTest { XSimpleFileAccess m_xSFA; TestHelper m_aTestHelper; - public Test02(XMultiServiceFactory xMSF, XSimpleFileAccess xSFA, LogWriter aLogWriter) { + public Test02(XMultiServiceFactory xMSF, XSimpleFileAccess xSFA) { m_xMSF = xMSF; m_xSFA = xSFA; - m_aTestHelper = new TestHelper(aLogWriter, "Test02: "); + m_aTestHelper = new TestHelper( "Test02: "); } public boolean test() { @@ -57,11 +55,9 @@ public class Test02 implements TempFileTest { //create a temporary file. try { oTempFile = m_xMSF.createInstance( "com.sun.star.io.TempFile" ); - xTempFile = (XTempFile) UnoRuntime.queryInterface( XTempFile.class, - oTempFile ); + xTempFile = UnoRuntime.queryInterface(XTempFile.class, oTempFile); m_aTestHelper.Message( "Tempfile created." ); - xTruncate = (XTruncate)UnoRuntime.queryInterface( XTruncate.class, - oTempFile ); + xTruncate = UnoRuntime.queryInterface(XTruncate.class, oTempFile); } catch(Exception e) { m_aTestHelper.Error( "Cannot create TempFile. exception: " + e ); return false; diff --git a/unotools/qa/complex/tempfile/TestHelper.java b/unotools/qa/complex/tempfile/TestHelper.java index 6edc2c362fa8..cf93828624f5 100644 --- a/unotools/qa/complex/tempfile/TestHelper.java +++ b/unotools/qa/complex/tempfile/TestHelper.java @@ -26,22 +26,20 @@ ************************************************************************/ package complex.tempfile; -import complexlib.ComplexTestCase; -import com.sun.star.lang.XMultiServiceFactory; + import com.sun.star.io.*; import com.sun.star.uno.AnyConverter; import com.sun.star.ucb.XSimpleFileAccess; -import com.sun.star.uno.UnoRuntime; -import share.LogWriter; + public class TestHelper { - LogWriter m_aLogWriter; + String m_sTestPrefix; - public TestHelper( LogWriter aLogWriter, String sTestPrefix ) { - m_aLogWriter = aLogWriter; + public TestHelper( String sTestPrefix ) { + m_sTestPrefix = sTestPrefix; } public void SetTempFileRemove( XTempFile xTempFile, boolean b ) { @@ -69,7 +67,7 @@ public class TestHelper { } catch (Exception e) { Error ( "Cannot get TempFileURL. exception: " + e ); } - if ( sTempFileURL == null || sTempFileURL == "" ) { + if ( sTempFileURL == null || sTempFileURL.equals("") ) { Error ( "Temporary file not valid." ); } return sTempFileURL; @@ -82,7 +80,7 @@ public class TestHelper { } catch ( Exception e ) { Error( "Cannot get TempFileName. exception: " + e ); } - if ( sTempFileName == null || sTempFileName == "") { + if ( sTempFileName == null || sTempFileName.equals("") ) { Error( "Temporary file not valid." ); } return sTempFileName; @@ -216,10 +214,10 @@ public class TestHelper { } public void Error( String sError ) { - m_aLogWriter.println( m_sTestPrefix + "Error: " + sError ); + System.out.println( m_sTestPrefix + "Error: " + sError ); } public void Message( String sMessage ) { - m_aLogWriter.println( m_sTestPrefix + sMessage ); + System.out.println( m_sTestPrefix + sMessage ); } } diff --git a/unotools/qa/complex/tempfile/makefile.mk b/unotools/qa/complex/tempfile/makefile.mk deleted file mode 100644 index 13d66ca3edd1..000000000000 --- a/unotools/qa/complex/tempfile/makefile.mk +++ /dev/null @@ -1,85 +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. -# -#************************************************************************* - -PRJ = ..$/..$/.. -TARGET = TempFileUnitTest -PRJNAME = unotools -PACKAGE = complex$/tempfile - -# --- Settings ----------------------------------------------------- -.INCLUDE: settings.mk - - -#----- compile .java files ----------------------------------------- - -JARFILES = ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar - -JAVAFILES =\ - TempFileUnitTest.java\ - TempFileTest.java\ - TestHelper.java\ - Test01.java\ - Test02.java - -JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class) - -#----- make a jar from compiled files ------------------------------ - -MAXLINELENGTH = 100000 - -JARCLASSDIRS = $(PACKAGE) -JARTARGET = $(TARGET).jar -JARCOMPRESS = TRUE - -# --- Parameters for the test -------------------------------------- - -# start an office if the parameter is set for the makefile -.IF "$(OFFICE)" == "" -CT_APPEXECCOMMAND = -.ELSE -CT_APPEXECCOMMAND = -AppExecutionCommand "$(OFFICE)$/soffice -accept=socket,host=localhost,port=8100;urp;" -.ENDIF - -# test base is java complex -CT_TESTBASE = -TestBase java_complex - -# test looks something like the.full.package.TestName -CT_TEST = -o $(PACKAGE:s\$/\.\).$(JAVAFILES:b) - -# start the runner application -CT_APP = org.openoffice.Runner - -# --- Targets ------------------------------------------------------ - -.INCLUDE: target.mk - -RUN: run - -run: - +java -cp $(CLASSPATH) $(CT_APP) $(CT_TESTBASE) $(CT_APPEXECCOMMAND) $(CT_TEST) - - diff --git a/unotools/source/accessibility/accessiblestatesethelper.cxx b/unotools/source/accessibility/accessiblestatesethelper.cxx index d2f1e50960f6..f4705c5e25bc 100644 --- a/unotools/source/accessibility/accessiblestatesethelper.cxx +++ b/unotools/source/accessibility/accessiblestatesethelper.cxx @@ -50,11 +50,11 @@ public: AccessibleStateSetHelperImpl(const AccessibleStateSetHelperImpl& rImpl); ~AccessibleStateSetHelperImpl(); - sal_Bool IsEmpty () + sal_Bool IsEmpty () const throw (uno::RuntimeException); - sal_Bool Contains (sal_Int16 aState) + sal_Bool Contains (sal_Int16 aState) const throw (uno::RuntimeException); - uno::Sequence<sal_Int16> GetStates() + uno::Sequence<sal_Int16> GetStates() const throw (uno::RuntimeException); void AddState(sal_Int16 aState) throw (uno::RuntimeException); @@ -62,7 +62,7 @@ public: throw (uno::RuntimeException); sal_Bool Compare(const AccessibleStateSetHelperImpl* pComparativeValue, AccessibleStateSetHelperImpl* pOldStates, - AccessibleStateSetHelperImpl* pNewStates) + AccessibleStateSetHelperImpl* pNewStates) const throw (uno::RuntimeException); inline void AddStates( const sal_Int64 _nStates ) SAL_THROW( ( ) ); @@ -85,13 +85,13 @@ AccessibleStateSetHelperImpl::~AccessibleStateSetHelperImpl() { } -inline sal_Bool AccessibleStateSetHelperImpl::IsEmpty () +inline sal_Bool AccessibleStateSetHelperImpl::IsEmpty () const throw (uno::RuntimeException) { return maStates == 0; } -inline sal_Bool AccessibleStateSetHelperImpl::Contains (sal_Int16 aState) +inline sal_Bool AccessibleStateSetHelperImpl::Contains (sal_Int16 aState) const throw (uno::RuntimeException) { DBG_ASSERT(aState < BITFIELDSIZE, "the statesset is too small"); @@ -100,7 +100,7 @@ inline sal_Bool AccessibleStateSetHelperImpl::Contains (sal_Int16 aState) return ((aTempBitSet & maStates) != 0); } -inline uno::Sequence<sal_Int16> AccessibleStateSetHelperImpl::GetStates() +inline uno::Sequence<sal_Int16> AccessibleStateSetHelperImpl::GetStates() const throw (uno::RuntimeException) { uno::Sequence<sal_Int16> aRet(BITFIELDSIZE); @@ -144,7 +144,7 @@ inline void AccessibleStateSetHelperImpl::RemoveState(sal_Int16 aState) inline sal_Bool AccessibleStateSetHelperImpl::Compare( const AccessibleStateSetHelperImpl* pComparativeValue, AccessibleStateSetHelperImpl* pOldStates, - AccessibleStateSetHelperImpl* pNewStates) + AccessibleStateSetHelperImpl* pNewStates) const throw (uno::RuntimeException) { sal_Bool bResult(sal_False); diff --git a/unotools/source/config/accelcfg.cxx b/unotools/source/config/accelcfg.cxx index a44e9639dcbf..c1748e3b411c 100644 --- a/unotools/source/config/accelcfg.cxx +++ b/unotools/source/config/accelcfg.cxx @@ -54,11 +54,12 @@ using namespace utl; -using namespace rtl; using namespace com::sun::star::uno; using namespace com::sun::star::io; using namespace com::sun::star::xml::sax; +using ::rtl::OUString; + static SvtAcceleratorConfig_Impl* pOptions = NULL; static sal_Int32 nRefCount = 0; @@ -71,7 +72,7 @@ public: bool bModified; SvtAcceleratorConfig_Impl() - : bModified( FALSE ) + : bModified( sal_False ) {} SvtAcceleratorConfig_Impl( Reference< XInputStream >& xInputStream ); @@ -84,7 +85,7 @@ SvtAcceleratorConfig_Impl::SvtAcceleratorConfig_Impl( Reference< XInputStream >& : bModified( false ) { Reference< XParser > xParser( ::comphelper::getProcessServiceFactory()->createInstance( - ::rtl::OUString::createFromAscii( "com.sun.star.xml.sax.Parser" )), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Parser"))), UNO_QUERY); // connect stream to input stream to the parser @@ -104,7 +105,7 @@ bool SvtAcceleratorConfig_Impl::Commit( Reference< XOutputStream >& rOutputStrea Reference< XDocumentHandler > xWriter; xWriter = Reference< XDocumentHandler >( ::comphelper::getProcessServiceFactory()->createInstance( - ::rtl::OUString::createFromAscii( "com.sun.star.xml.sax.Writer" )), UNO_QUERY) ; + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Writer"))), UNO_QUERY) ; Reference< ::com::sun::star::io::XActiveDataSource> xDataSource( xWriter , UNO_QUERY ); xDataSource->setOutputStream( rOutputStream ); @@ -235,7 +236,7 @@ SvtAcceleratorConfiguration::~SvtAcceleratorConfiguration() nCode = rKeyEvent.KeyFunc; std::list< SvtAcceleratorConfigItem>::const_iterator p; - for ( p = pImp->aList.begin(); p != pImp->aList.end(); p++ ) + for ( p = pImp->aList.begin(); p != pImp->aList.end(); ++p ) if ( p->nCode == nCode && p->nModifier == nModifier ) return p->aCommand; @@ -250,7 +251,7 @@ const SvtAcceleratorItemList& SvtAcceleratorConfiguration::GetItems() void SvtAcceleratorConfiguration::SetCommand( const SvtAcceleratorConfigItem& rItem ) { std::list< SvtAcceleratorConfigItem>::iterator p; - for ( p = pImp->aList.begin(); p != pImp->aList.end(); p++ ) + for ( p = pImp->aList.begin(); p != pImp->aList.end(); ++p ) if ( p->nCode == rItem.nCode && p->nModifier == rItem.nModifier ) { p->aCommand = rItem.aCommand; @@ -270,7 +271,7 @@ void SvtAcceleratorConfiguration::SetItems( const SvtAcceleratorItemList& rItems else { std::list< SvtAcceleratorConfigItem>::const_iterator p; - for ( p = rItems.begin(); p != rItems.end(); p++ ) + for ( p = rItems.begin(); p != rItems.end(); ++p ) SetCommand( *p ); } } diff --git a/unotools/source/config/bootstrap.cxx b/unotools/source/config/bootstrap.cxx index a9248a03804f..b19ee6a3683f 100644 --- a/unotools/source/config/bootstrap.cxx +++ b/unotools/source/config/bootstrap.cxx @@ -261,7 +261,7 @@ bool implEnsureAbsolute(OUString & _rsURL) // also strips embedded dots !! using osl::File; OUString sBasePath; - OSL_VERIFY(tools::getProcessWorkingDir(&sBasePath)); + OSL_VERIFY(tools::getProcessWorkingDir(sBasePath)); OUString sAbsolute; if ( File::E_None == File::getAbsoluteFileURL(sBasePath, _rsURL, sAbsolute)) @@ -271,7 +271,7 @@ bool implEnsureAbsolute(OUString & _rsURL) // also strips embedded dots !! } else { - OSL_ENSURE(false, "Could not get absolute file URL for URL"); + OSL_FAIL("Could not get absolute file URL for URL"); return false; } } @@ -359,7 +359,7 @@ PathStatus checkStatusAndNormalizeURL(OUString & _sURL) if (eStatus == Bootstrap::PATH_EXISTS) { if (!implNormalizeURL(_sURL,aDirItem)) - OSL_ENSURE(false,"Unexpected failure getting actual URL for existing object"); + OSL_FAIL("Unexpected failure getting actual URL for existing object"); } } return eStatus; @@ -401,7 +401,7 @@ PathStatus getDerivedPath( OSL_ENSURE(sDerivedURL == _rURL,"Could not set derived URL via Bootstrap default parameter"); OSL_POSTCOND(RTL_BOOTSTRAP_DEFAULTS_BROKEN || - _rData.getFrom(_sBootstrapParameter,sDerivedURL) && sDerivedURL==_rURL,"Use of default did not affect bootstrap value"); + (_rData.getFrom(_sBootstrapParameter,sDerivedURL) && sDerivedURL==_rURL),"Use of default did not affect bootstrap value"); } else { diff --git a/unotools/source/config/cmdoptions.cxx b/unotools/source/config/cmdoptions.cxx index 3d8fea23c175..b17771cb4369 100644 --- a/unotools/source/config/cmdoptions.cxx +++ b/unotools/source/config/cmdoptions.cxx @@ -46,7 +46,7 @@ #include <itemholder1.hxx> #include <algorithm> -#include <hash_map> +#include <boost/unordered_map.hpp> //_________________________________________________________________________________________________________________ // namespaces @@ -105,11 +105,6 @@ class SvtCmdOptions return ( m_aCommandHashMap.size() > 0 ); } - void SetContainerSize( sal_Int32 nSize ) - { - m_aCommandHashMap.resize( nSize ); - } - sal_Bool Lookup( const OUString& aCmd ) const { CommandHashMap::const_iterator pEntry = m_aCommandHashMap.find( aCmd ); @@ -143,7 +138,7 @@ class SvtCmdOptions } private: - class CommandHashMap : public ::std::hash_map< ::rtl::OUString , + class CommandHashMap : public ::boost::unordered_map< ::rtl::OUString , sal_Int32 , OUStringHashCode , ::std::equal_to< ::rtl::OUString > > @@ -292,9 +287,6 @@ SvtCommandOptions_Impl::SvtCommandOptions_Impl() sal_Int32 nItem = 0 ; OUString sCmd ; - // Set size of hash_map reach a used size of approx. 60% - m_aDisabledCommands.SetContainerSize( lNames.getLength() * 10 / 6 ); - // Get names/values for disabled commands. for( nItem=0; nItem < lNames.getLength(); ++nItem ) { @@ -343,9 +335,7 @@ void SvtCommandOptions_Impl::Notify( const Sequence< OUString >& ) sal_Int32 nItem = 0 ; OUString sCmd ; - // Set size of hash_map reach a used size of approx. 60% m_aDisabledCommands.Clear(); - m_aDisabledCommands.SetContainerSize( lNames.getLength() * 10 / 6 ); // Get names/values for disabled commands. for( nItem=0; nItem < lNames.getLength(); ++nItem ) @@ -372,7 +362,7 @@ void SvtCommandOptions_Impl::Notify( const Sequence< OUString >& ) //***************************************************************************************************************** void SvtCommandOptions_Impl::Commit() { - DBG_ERROR( "SvtCommandOptions_Impl::Commit()\nNot implemented yet!\n" ); + OSL_FAIL( "SvtCommandOptions_Impl::Commit()\nNot implemented yet!\n" ); } //***************************************************************************************************************** diff --git a/unotools/source/config/compatibility.cxx b/unotools/source/config/compatibility.cxx index c65c83245e70..275230452919 100644 --- a/unotools/source/config/compatibility.cxx +++ b/unotools/source/config/compatibility.cxx @@ -41,9 +41,7 @@ #include <com/sun/star/uno/Any.hxx> #include <com/sun/star/uno/Sequence.hxx> -#ifndef __SGI_STL_VECTOR #include <vector> -#endif #include <itemholder1.hxx> @@ -225,7 +223,7 @@ class SvtCompatibility return lEntries.size(); } - const SvtCompatibilityEntry& operator[]( int i ) + const SvtCompatibilityEntry& operator[]( int i ) const { return lEntries[i]; } @@ -431,8 +429,9 @@ SvtCompatibilityOptions_Impl::SvtCompatibilityOptions_Impl() { SvtSysLocale aSysLocale; com::sun::star::lang::Locale aLocale = aSysLocale.GetLocale(); - if ( aLocale.Language.equalsAscii( "zh" ) || aLocale.Language.equalsAscii( "ja" ) || - aLocale.Language.equalsAscii( "ko" ) ) + if ( aLocale.Language.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("zh")) || + aLocale.Language.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("ja")) || + aLocale.Language.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("ko")) ) aItem.bExpandWordSpace = false; m_aDefOptions = aItem; diff --git a/unotools/source/config/configitem.cxx b/unotools/source/config/configitem.cxx index 4a330bcf18cc..4a3809c222fb 100644 --- a/unotools/source/config/configitem.cxx +++ b/unotools/source/config/configitem.cxx @@ -61,7 +61,7 @@ using namespace com::sun::star::beans; using namespace com::sun::star::container; using namespace com::sun::star::configuration; -#define C2U(cChar) OUString::createFromAscii(cChar) +#define C2U(cChar) OUString(RTL_CONSTASCII_USTRINGPARAM(cChar)) #include <cppuhelper/implbase1.hxx> // helper for implementations #ifdef DBG_UTIL @@ -69,7 +69,7 @@ inline void lcl_CFG_DBG_EXCEPTION(const sal_Char* cText, const Exception& rEx) { OString sMsg(cText); sMsg += OString(rEx.Message.getStr(), rEx.Message.getLength(), RTL_TEXTENCODING_ASCII_US); - OSL_ENSURE(sal_False, sMsg.getStr()); + OSL_FAIL(sMsg.getStr()); } #define CATCH_INFO(a) \ catch(Exception& rEx) \ @@ -106,9 +106,7 @@ namespace utl{ //XEventListener virtual void SAL_CALL disposing( const EventObject& Source ) throw(RuntimeException); }; -/* -----------------------------12.02.01 11:38-------------------------------- - ---------------------------------------------------------------------------*/ struct ConfigItem_Impl { utl::ConfigManager* pManager; @@ -126,9 +124,7 @@ struct ConfigItem_Impl {} }; } -/* -----------------------------04.12.00 10:25-------------------------------- - ---------------------------------------------------------------------------*/ class ValueCounter_Impl { sal_Int16& rCnt; @@ -142,9 +138,7 @@ public: rCnt--; } }; -/* -----------------------------03.12.02 ------------------------------------- - ---------------------------------------------------------------------------*/ namespace { // helper to achieve exception - safe handling of an Item under construction @@ -166,24 +160,18 @@ namespace void keep() { m_pItem = 0; } }; } -/* -----------------------------29.08.00 16:34-------------------------------- - ---------------------------------------------------------------------------*/ ConfigChangeListener_Impl::ConfigChangeListener_Impl( ConfigItem& rItem, const Sequence< OUString >& rNames) : pParent(&rItem), aPropertyNames(rNames) { } -/* -----------------------------29.08.00 16:34-------------------------------- - ---------------------------------------------------------------------------*/ ConfigChangeListener_Impl::~ConfigChangeListener_Impl() { } -/* -----------------------------29.08.00 16:34-------------------------------- - ---------------------------------------------------------------------------*/ sal_Bool lcl_Find( const rtl::OUString& rTemp, const OUString* pCheckPropertyNames, @@ -225,16 +213,12 @@ void ConfigChangeListener_Impl::changesOccurred( const ChangesEvent& rEvent ) th } } -/* -----------------------------29.08.00 16:34-------------------------------- - ---------------------------------------------------------------------------*/ void ConfigChangeListener_Impl::disposing( const EventObject& /*rSource*/ ) throw(RuntimeException) { pParent->RemoveChangesListener(); } -/* -----------------------------29.08.00 12:50-------------------------------- - ---------------------------------------------------------------------------*/ ConfigItem::ConfigItem(const OUString rSubTree, sal_Int16 nSetMode ) : sSubTree(rSubTree), pImpl(new ConfigItem_Impl) @@ -252,9 +236,7 @@ ConfigItem::ConfigItem(const OUString rSubTree, sal_Int16 nSetMode ) : aNewImpl.keep(); pImpl->nMode &= ~CONFIG_MODE_PROPAGATE_ERRORS; } -/* -----------------------------17.11.00 13:53-------------------------------- - ---------------------------------------------------------------------------*/ ConfigItem::ConfigItem(utl::ConfigManager& rManager, const rtl::OUString rSubTree) : sSubTree(rSubTree), pImpl(new ConfigItem_Impl) @@ -263,16 +245,12 @@ ConfigItem::ConfigItem(utl::ConfigManager& rManager, const rtl::OUString rSubTr pImpl->nMode = CONFIG_MODE_IMMEDIATE_UPDATE; // does not allow exceptions m_xHierarchyAccess = pImpl->pManager->AddConfigItem(*this); } -//--------------------------------------------------------------------- -//--- 02.08.2002 16:33:23 ----------------------------------------------- + sal_Bool ConfigItem::IsValidConfigMgr() const { return ( pImpl->pManager && pImpl->pManager->GetConfigurationProvider().is() ); } -/* -----------------------------29.08.00 12:52-------------------------------- - - ---------------------------------------------------------------------------*/ ConfigItem::~ConfigItem() { if(pImpl->pManager) @@ -282,9 +260,7 @@ ConfigItem::~ConfigItem() } delete pImpl; } -/* -----------------------------29.08.00 12:52-------------------------------- - ---------------------------------------------------------------------------*/ void ConfigItem::ReleaseConfigMgr() { Reference<XHierarchicalNameAccess> xHierarchyAccess = GetTree(); @@ -301,9 +277,7 @@ void ConfigItem::ReleaseConfigMgr() OSL_ENSURE(pImpl->pManager, "ConfigManager already released"); pImpl->pManager = 0; } -/* -----------------------------29.08.00 12:52-------------------------------- - ---------------------------------------------------------------------------*/ void ConfigItem::CallNotify( const com::sun::star::uno::Sequence<OUString>& rPropertyNames ) { // the call is forwarded to the virtual Notify() method @@ -313,9 +287,6 @@ void ConfigItem::CallNotify( const com::sun::star::uno::Sequence<OUString>& rPro Notify(rPropertyNames); } -/* -----------------------------12.12.00 17:09-------------------------------- - - ---------------------------------------------------------------------------*/ sal_Bool lcl_IsLocalProperty(const OUString& rSubTree, const OUString& rProperty) { static const sal_Char* aLocalProperties[] = @@ -338,9 +309,7 @@ sal_Bool lcl_IsLocalProperty(const OUString& rSubTree, const OUString& rProperty return sal_False; } -/* -----------------------------10.04.01 15:00-------------------------------- - ---------------------------------------------------------------------------*/ void ConfigItem::impl_packLocalizedProperties( const Sequence< OUString >& lInNames , const Sequence< Any >& lInValues , Sequence< Any >& lOutValues ) @@ -412,9 +381,7 @@ void ConfigItem::impl_packLocalizedProperties( const Sequence< OUString >& ++nDestinationCounter; } } -/* -----------------------------10.04.01 15:00-------------------------------- - ---------------------------------------------------------------------------*/ void ConfigItem::impl_unpackLocalizedProperties( const Sequence< OUString >& lInNames , const Sequence< Any >& lInValues , Sequence< OUString >& lOutNames , @@ -489,9 +456,7 @@ void ConfigItem::impl_unpackLocalizedProperties( const Sequence< OUString > } } } -/* -----------------------------03.02.2003 14:44------------------------------ - ---------------------------------------------------------------------------*/ Sequence< sal_Bool > ConfigItem::GetReadOnlyStates(const com::sun::star::uno::Sequence< rtl::OUString >& rNames) { sal_Int32 i; @@ -517,7 +482,7 @@ Sequence< sal_Bool > ConfigItem::GetReadOnlyStates(const com::sun::star::uno::Se { if(pImpl->pManager->IsLocalConfigProvider() && lcl_IsLocalProperty(sSubTree, rNames[i])) { - OSL_ENSURE(sal_False, "ConfigItem::IsReadonly()\nlocal mode seams to be used!?\n"); + OSL_FAIL("ConfigItem::IsReadonly()\nlocal mode seams to be used!?\n"); continue; } @@ -528,7 +493,7 @@ Sequence< sal_Bool > ConfigItem::GetReadOnlyStates(const com::sun::star::uno::Se ::utl::splitLastFromConfigurationPath(sName,sPath,sProperty); if (!sPath.getLength() && !sProperty.getLength()) { - OSL_ENSURE(sal_False, "ConfigItem::IsReadonly()\nsplitt failed\n"); + OSL_FAIL("ConfigItem::IsReadonly()\nsplitt failed\n"); continue; } @@ -540,7 +505,7 @@ Sequence< sal_Bool > ConfigItem::GetReadOnlyStates(const com::sun::star::uno::Se Any aNode = xHierarchyAccess->getByHierarchicalName(sPath); if (!(aNode >>= xNode) || !xNode.is()) { - OSL_ENSURE(sal_False, "ConfigItem::IsReadonly()\nno set available\n"); + OSL_FAIL("ConfigItem::IsReadonly()\nno set available\n"); continue; } } @@ -563,7 +528,7 @@ Sequence< sal_Bool > ConfigItem::GetReadOnlyStates(const com::sun::star::uno::Se if (!xInfo.is()) { - OSL_ENSURE(sal_False, "ConfigItem::IsReadonly()\nno prop info available\n"); + OSL_FAIL("ConfigItem::IsReadonly()\nno prop info available\n"); continue; } @@ -576,9 +541,6 @@ Sequence< sal_Bool > ConfigItem::GetReadOnlyStates(const com::sun::star::uno::Se return lStates; } -/* -----------------------------29.08.00 15:10-------------------------------- - - ---------------------------------------------------------------------------*/ Sequence< Any > ConfigItem::GetProperties(const Sequence< OUString >& rNames) { Sequence< Any > aRet(rNames.getLength()); @@ -619,7 +581,7 @@ Sequence< Any > ConfigItem::GetProperties(const Sequence< OUString >& rNames) sMsg += OString(pNames[i].getStr(), pNames[i].getLength(), RTL_TEXTENCODING_ASCII_US); - OSL_ENSURE(sal_False, sMsg.getStr()); + OSL_FAIL(sMsg.getStr()); #else (void) rEx; // avoid warning #endif @@ -636,9 +598,7 @@ Sequence< Any > ConfigItem::GetProperties(const Sequence< OUString >& rNames) } return aRet; } -/* -----------------------------29.08.00 17:28-------------------------------- - ---------------------------------------------------------------------------*/ sal_Bool ConfigItem::PutProperties( const Sequence< OUString >& rNames, const Sequence< Any>& rValues) { @@ -722,17 +682,13 @@ sal_Bool ConfigItem::PutProperties( const Sequence< OUString >& rNames, return bRet; } -/* -----------------------------08.12.05 15:27-------------------------------- - ---------------------------------------------------------------------------*/ void ConfigItem::DisableNotification() { OSL_ENSURE( xChangeLstnr.is(), "ConfigItem::DisableNotification: notifications not enabled currently!" ); RemoveChangesListener(); } -/* -----------------------------29.08.00 16:19-------------------------------- - ---------------------------------------------------------------------------*/ sal_Bool ConfigItem::EnableNotification(const Sequence< OUString >& rNames, sal_Bool bEnableInternalNotification ) @@ -760,9 +716,7 @@ sal_Bool ConfigItem::EnableNotification(const Sequence< OUString >& rNames, } return bRet; } -/* -----------------------------29.08.00 16:47-------------------------------- - ---------------------------------------------------------------------------*/ void ConfigItem::RemoveChangesListener() { Reference<XChangesNotifier> xChgNot(m_xHierarchyAccess, UNO_QUERY); @@ -778,9 +732,7 @@ void ConfigItem::RemoveChangesListener() } } } -/* -----------------------------10.07.00 -------------------------------- - ---------------------------------------------------------------------------*/ void lcl_normalizeLocalNames(Sequence< OUString >& _rNames, ConfigNameFormat _eFormat, Reference<XInterface> const& _xParentNode) { switch (_eFormat) @@ -804,7 +756,7 @@ void lcl_normalizeLocalNames(Sequence< OUString >& _rNames, ConfigNameFormat _eF break; } } - OSL_ENSURE(false, "Cannot create absolute pathes: missing interface"); + OSL_FAIL("Cannot create absolute pathes: missing interface"); // make local pathes instaed case CONFIG_NAME_LOCAL_PATH: @@ -855,18 +807,14 @@ void lcl_normalizeLocalNames(Sequence< OUString >& _rNames, ConfigNameFormat _eF } } -/* -----------------------------10.07.00 -------------------------------- - ---------------------------------------------------------------------------*/ Sequence< OUString > ConfigItem::GetNodeNames(const OUString& rNode) { ConfigNameFormat const eDefaultFormat = CONFIG_NAME_LOCAL_NAME; // CONFIG_NAME_DEFAULT; return GetNodeNames(rNode, eDefaultFormat); } -/* -----------------------------15.09.00 12:06-------------------------------- - ---------------------------------------------------------------------------*/ Sequence< OUString > ConfigItem::GetNodeNames(const OUString& rNode, ConfigNameFormat eFormat) { Sequence< OUString > aRet; @@ -894,9 +842,7 @@ Sequence< OUString > ConfigItem::GetNodeNames(const OUString& rNode, ConfigNameF } return aRet; } -/* -----------------------------15.09.00 15:52-------------------------------- - ---------------------------------------------------------------------------*/ sal_Bool ConfigItem::ClearNodeSet(const OUString& rNode) { ValueCounter_Impl aCounter(pImpl->nInValueChange); @@ -934,9 +880,7 @@ sal_Bool ConfigItem::ClearNodeSet(const OUString& rNode) } return bRet; } -/* -----------------------------24.11.00 10:58-------------------------------- - ---------------------------------------------------------------------------*/ sal_Bool ConfigItem::ClearNodeElements(const OUString& rNode, Sequence< OUString >& rElements) { ValueCounter_Impl aCounter(pImpl->nInValueChange); @@ -1008,9 +952,8 @@ Sequence< OUString > lcl_extractSetPropertyNames( const Sequence< PropertyValue return aSubNodeNames; } -/* -----------------------------15.09.00 15:52-------------------------------- - add or change properties - ---------------------------------------------------------------------------*/ + +// Add or change properties sal_Bool ConfigItem::SetSetProperties( const OUString& rNode, Sequence< PropertyValue > rValues) { @@ -1109,9 +1052,7 @@ sal_Bool ConfigItem::SetSetProperties( } return bRet; } -/* -----------------------------15.09.00 15:52-------------------------------- - ---------------------------------------------------------------------------*/ sal_Bool ConfigItem::ReplaceSetProperties( const OUString& rNode, Sequence< PropertyValue > rValues) { @@ -1248,9 +1189,7 @@ sal_Bool ConfigItem::ReplaceSetProperties( } return bRet; } -/* -----------------------------07.05.01 12:15-------------------------------- - ---------------------------------------------------------------------------*/ sal_Bool ConfigItem::getUniqueSetElementName( const ::rtl::OUString& _rSetNode, ::rtl::OUString& _rName) { ::rtl::OUString sNewElementName; @@ -1289,9 +1228,7 @@ sal_Bool ConfigItem::getUniqueSetElementName( const ::rtl::OUString& _rSetNode, } return bRet; } -/* -----------------------------23.01.01 12:49-------------------------------- - ---------------------------------------------------------------------------*/ sal_Bool ConfigItem::AddNode(const rtl::OUString& rNode, const rtl::OUString& rNewNode) { ValueCounter_Impl aCounter(pImpl->nInValueChange); @@ -1354,44 +1291,32 @@ sal_Bool ConfigItem::AddNode(const rtl::OUString& rNode, const rtl::OUString& rN } return bRet; } -/* -----------------------------12.02.01 11:38-------------------------------- - ---------------------------------------------------------------------------*/ sal_Int16 ConfigItem::GetMode() const { return pImpl->nMode; } -/* -----------------------------12.02.01 13:31-------------------------------- - ---------------------------------------------------------------------------*/ void ConfigItem::SetModified() { pImpl->bIsModified = sal_True; } -/* -----------------------------05.05.01 14:07-------------------------------- - ---------------------------------------------------------------------------*/ void ConfigItem::ClearModified() { pImpl->bIsModified = sal_False; } -/* -----------------------------12.02.01 13:31-------------------------------- - ---------------------------------------------------------------------------*/ sal_Bool ConfigItem::IsModified() const { return pImpl->bIsModified; } -/* -----------------------------12.02.01 13:33-------------------------------- - ---------------------------------------------------------------------------*/ sal_Bool ConfigItem::IsInValueChange() const { return pImpl->nInValueChange > 0; } -/* -----------------------------21.06.01 12:26-------------------------------- - ---------------------------------------------------------------------------*/ Reference< XHierarchicalNameAccess> ConfigItem::GetTree() { Reference< XHierarchicalNameAccess> xRet; @@ -1399,20 +1324,15 @@ Reference< XHierarchicalNameAccess> ConfigItem::GetTree() xRet = pImpl->pManager->AcquireTree(*this); else xRet = m_xHierarchyAccess; - OSL_ENSURE(xRet.is(), "AcquireTree failed"); return xRet; } -/* -----------------------------22.06.01 08:42-------------------------------- - ---------------------------------------------------------------------------*/ void ConfigItem::LockTree() { OSL_ENSURE(0 != (pImpl->nMode&CONFIG_MODE_RELEASE_TREE), "call LockTree in CONFIG_MODE_RELEASE_TREE mode, only"); m_xHierarchyAccess = GetTree(); } -/* -----------------------------22.06.01 08:42-------------------------------- - ---------------------------------------------------------------------------*/ void ConfigItem::UnlockTree() { OSL_ENSURE(0 != (pImpl->nMode&CONFIG_MODE_RELEASE_TREE), "call UnlockTree in CONFIG_MODE_RELEASE_TREE mode, only"); diff --git a/unotools/source/config/configmgr.cxx b/unotools/source/config/configmgr.cxx index 13583c5d841b..97c1776bf95b 100644 --- a/unotools/source/config/configmgr.cxx +++ b/unotools/source/config/configmgr.cxx @@ -50,12 +50,16 @@ //----------------------------------------------------------------------------- using namespace utl; -using namespace rtl; using namespace com::sun::star::uno; using namespace com::sun::star::lang; using namespace com::sun::star::beans; using namespace com::sun::star::container; +using ::rtl::OUString; +#if OSL_DEBUG_LEVEL > 0 +using ::rtl::OString; +#endif + #define UNISTRING(s) rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s)) //----------------------------------------------------------------------------- @@ -101,29 +105,27 @@ struct utl::ConfigMgr_Impl ConfigItemList aItemList; }; -/* -----------------------------28.08.00 15:35-------------------------------- - - ---------------------------------------------------------------------------*/ ConfigManager::ConfigManager() : pMgrImpl(new utl::ConfigMgr_Impl) { GetConfigurationProvider(); // attempt to create the provider early } -/* -----------------------------17.11.00 13:51-------------------------------- - ---------------------------------------------------------------------------*/ ConfigManager::ConfigManager(Reference< XMultiServiceFactory > xConfigProv) : xConfigurationProvider(xConfigProv), pMgrImpl(new utl::ConfigMgr_Impl) { } -/* -----------------------------28.08.00 15:35-------------------------------- - ---------------------------------------------------------------------------*/ ConfigManager::~ConfigManager() { //check list content -> should be empty! +#if OSL_DEBUG_LEVEL > 1 + // I think this is a pointless assertion, the code seems to cope + // fine with it being empty, no need to crash in a dbglevel=1 + // build. OSL_ENSURE(pMgrImpl->aItemList.empty(), "some ConfigItems are still alive"); +#endif if(!pMgrImpl->aItemList.empty()) { ConfigItemList::iterator aListIter; @@ -137,9 +139,7 @@ ConfigManager::~ConfigManager() delete pMgrImpl; } -/* -----------------------------28.08.00 16:17-------------------------------- - ---------------------------------------------------------------------------*/ Reference< XMultiServiceFactory > ConfigManager::GetConfigurationProvider() { if(!xConfigurationProvider.is()) @@ -154,7 +154,7 @@ Reference< XMultiServiceFactory > ConfigManager::GetConfigurationProvider() UNISTRING("com.sun.star.configuration.ConfigurationProvider")), UNO_QUERY); } -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 catch(Exception& rEx) { static sal_Bool bMessage = sal_True; @@ -165,7 +165,7 @@ Reference< XMultiServiceFactory > ConfigManager::GetConfigurationProvider() sMsg += OString(rEx.Message.getStr(), rEx.Message.getLength(), RTL_TEXTENCODING_ASCII_US); - OSL_ENSURE(sal_False, sMsg.getStr()); + OSL_FAIL(sMsg.getStr()); } } #else @@ -175,9 +175,7 @@ Reference< XMultiServiceFactory > ConfigManager::GetConfigurationProvider() } return xConfigurationProvider; } -/* -----------------------------03.12.02 ------------------------------------- - ---------------------------------------------------------------------------*/ namespace { // helper to achieve exception - safe registration of a ConfigItem under construction @@ -201,16 +199,12 @@ namespace void keep() { pCfgItem = 0; } }; } -/* -----------------------------12.12.00 17:19-------------------------------- - ---------------------------------------------------------------------------*/ Reference< XMultiServiceFactory > ConfigManager::GetLocalConfigurationProvider() { return GetConfigurationProvider(); } -/* -----------------------------29.08.00 12:35-------------------------------- - ---------------------------------------------------------------------------*/ Reference< XHierarchicalNameAccess > ConfigManager::AddConfigItem(utl::ConfigItem& rCfgItem) { RegisterConfigItemHelper registeredItem(*this,rCfgItem); @@ -218,30 +212,26 @@ Reference< XHierarchicalNameAccess > ConfigManager::AddConfigItem(utl::ConfigIte registeredItem.keep(); return xTree; } -/* -----------------------------21.06.01 12:20-------------------------------- - ---------------------------------------------------------------------------*/ void ConfigManager::RegisterConfigItem(utl::ConfigItem& rCfgItem) { ConfigItemList::iterator aListIter = pMgrImpl->aItemList.begin(); -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 for(aListIter = pMgrImpl->aItemList.begin(); aListIter != pMgrImpl->aItemList.end(); ++aListIter) { ConfigItemListEntry_Impl& rEntry = *aListIter; if(rEntry.pConfigItem == &rCfgItem) - OSL_ENSURE(sal_False, "RegisterConfigItem: already inserted!"); + OSL_FAIL("RegisterConfigItem: already inserted!"); } #endif pMgrImpl->aItemList.insert(aListIter, ConfigItemListEntry_Impl(&rCfgItem)); } -/* -----------------------------21.06.01 12:20-------------------------------- - ---------------------------------------------------------------------------*/ Reference< XHierarchicalNameAccess> ConfigManager::AcquireTree(utl::ConfigItem& rCfgItem) { - ConfigItemList::iterator aListIter = pMgrImpl->aItemList.begin(); -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 sal_Bool bFound = sal_False; + ConfigItemList::iterator aListIter = pMgrImpl->aItemList.begin(); for(aListIter = pMgrImpl->aItemList.begin(); aListIter != pMgrImpl->aItemList.end(); ++aListIter) { ConfigItemListEntry_Impl& rEntry = *aListIter; @@ -300,23 +290,21 @@ Reference< XHierarchicalNameAccess> ConfigManager::AcquireTree(utl::ConfigItem& throw; } -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 if(0 == (CONFIG_MODE_IGNORE_ERRORS & rCfgItem.GetMode())) { OString sMsg("CreateInstance exception: "); sMsg += OString(rEx.Message.getStr(), rEx.Message.getLength(), RTL_TEXTENCODING_ASCII_US); - OSL_ENSURE(sal_False, sMsg.getStr()); + OSL_FAIL(sMsg.getStr()); } #endif } } return Reference<XHierarchicalNameAccess>(xIFace, UNO_QUERY); } -/* -----------------------------29.08.00 12:35-------------------------------- - ---------------------------------------------------------------------------*/ void ConfigManager::RemoveConfigItem(utl::ConfigItem& rCfgItem) { if( !pMgrImpl->aItemList.empty() ) @@ -333,9 +321,7 @@ void ConfigManager::RemoveConfigItem(utl::ConfigItem& rCfgItem) } } } -/* -----------------------------30.08.00 15:04-------------------------------- - ---------------------------------------------------------------------------*/ void ConfigManager::StoreConfigItems() { if(!pMgrImpl->aItemList.empty()) @@ -352,47 +338,37 @@ void ConfigManager::StoreConfigItems() } } } -/* -----------------------------07.09.00 11:06-------------------------------- - ---------------------------------------------------------------------------*/ struct theConfigManager : public rtl::Static<ConfigManager, theConfigManager> {}; ConfigManager& ConfigManager::GetConfigManager() { return theConfigManager::get(); } -/* -----------------------------08.09.00 13:22-------------------------------- - ---------------------------------------------------------------------------*/ rtl::OUString ConfigManager::GetConfigBaseURL() { return OUString::createFromAscii(pConfigBaseURL); } -/* -----------------------------25.09.00 16:34-------------------------------- - ---------------------------------------------------------------------------*/ Any ConfigManager::GetDirectConfigProperty(ConfigProperty eProp) { switch(eProp) { case INSTALLPATH: - OSL_ENSURE( false, - "ConfigManager::GetDirectConfigProperty: " + OSL_FAIL( "ConfigManager::GetDirectConfigProperty: " "INSTALLPATH no longer supported." ); return Any(); case USERINSTALLURL: - OSL_ENSURE( false, - "ConfigManager::GetDirectConfigProperty: " + OSL_FAIL( "ConfigManager::GetDirectConfigProperty: " "USERINSTALLURL no longer supported." ); return Any(); case OFFICEINSTALL: - OSL_ENSURE( false, - "ConfigManager::GetDirectConfigProperty: " + OSL_FAIL( "ConfigManager::GetDirectConfigProperty: " "OFFICEINSTALL no longer supported." ); return Any(); case OFFICEINSTALLURL: - OSL_ENSURE( false, - "ConfigManager::GetDirectConfigProperty: " + OSL_FAIL( "ConfigManager::GetDirectConfigProperty: " "OFFICEINSTALLURL no longer supported." ); return Any(); default: @@ -405,7 +381,7 @@ Any ConfigManager::GetDirectConfigProperty(ConfigProperty eProp) #ifdef ENABLE_BROFFICE LanguageType nType = MsLangId::getRealLanguage( LANGUAGE_NONE ); if ( nType == LANGUAGE_PORTUGUESE_BRAZILIAN ) - sBrandName = OUString::createFromAscii("BrOffice"); + sBrandName = OUString(RTL_CONSTASCII_USTRINGPARAM("BrOffice")); else #endif sBrandName = BrandName::get(); @@ -475,9 +451,8 @@ Any ConfigManager::GetDirectConfigProperty(ConfigProperty eProp) if (eProp == PRODUCTEXTENSION) { rtl::OUString name( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( - "${BRAND_BASE_DIR}/program/edition/edition.ini"))); + "${BRAND_BASE_DIR}/program/edition/edition.ini")); rtl::Bootstrap::expandMacros(name); if (rtl::Bootstrap(name).getFrom( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("EDITIONNAME")), @@ -555,7 +530,7 @@ Any ConfigManager::GetDirectConfigProperty(ConfigProperty eProp) aBuf.append( "\" under \"" ); aBuf.append( rtl::OUStringToOString( sPath, RTL_TEXTENCODING_ASCII_US ) ); aBuf.append( "\" (caught an exception)!" ); - OSL_ENSURE( sal_False, aBuf.getStr() ); + OSL_FAIL( aBuf.getStr() ); #endif } } @@ -636,9 +611,6 @@ void ConfigManager::getBasisAboutBoxProductVersion( OUString& rVersion ) } } -/* -----------------------------12.12.00 17:22-------------------------------- - - ---------------------------------------------------------------------------*/ Reference< XHierarchicalNameAccess> ConfigManager::GetHierarchyAccess(const OUString& rFullPath) { Sequence< Any > aArgs(1); @@ -653,14 +625,14 @@ Reference< XHierarchicalNameAccess> ConfigManager::GetHierarchyAccess(const OUSt OUString::createFromAscii(pAccessSrvc), aArgs); } -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 catch(Exception& rEx) { OString sMsg("CreateInstance exception: "); sMsg += OString(rEx.Message.getStr(), rEx.Message.getLength(), RTL_TEXTENCODING_ASCII_US); - OSL_ENSURE(sal_False, sMsg.getStr()); + OSL_FAIL(sMsg.getStr()); } #else catch(Exception&){} @@ -668,9 +640,7 @@ Reference< XHierarchicalNameAccess> ConfigManager::GetHierarchyAccess(const OUSt } return Reference<XHierarchicalNameAccess>(xIFace, UNO_QUERY); } -/* -----------------------------12.12.00 17:17-------------------------------- - ---------------------------------------------------------------------------*/ Any ConfigManager::GetLocalProperty(const OUString& rProperty) { OUString sPath(OUString::createFromAscii(pConfigBaseURL)); @@ -686,23 +656,21 @@ Any ConfigManager::GetLocalProperty(const OUString& rProperty) if(xAccess.is()) aRet = xAccess->getByName(sProperty); } -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 catch(Exception& rEx) { OString sMsg("GetLocalProperty: "); sMsg += OString(rEx.Message.getStr(), rEx.Message.getLength(), RTL_TEXTENCODING_ASCII_US); - OSL_ENSURE(sal_False, sMsg.getStr()); + OSL_FAIL(sMsg.getStr()); } #else catch(Exception&){} #endif return aRet; } -/* -----------------------------12.12.00 17:17-------------------------------- - ---------------------------------------------------------------------------*/ void ConfigManager::PutLocalProperty(const OUString& rProperty, const Any& rValue) { OUString sPath(OUString::createFromAscii(pConfigBaseURL)); @@ -718,23 +686,21 @@ void ConfigManager::PutLocalProperty(const OUString& rProperty, const Any& rValu { xNodeReplace->replaceByName(sProperty, rValue); } -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 catch(Exception& rEx) { OString sMsg("PutLocalProperty: "); sMsg += OString(rEx.Message.getStr(), rEx.Message.getLength(), RTL_TEXTENCODING_ASCII_US); - OSL_ENSURE(sal_False, sMsg.getStr()); + OSL_FAIL(sMsg.getStr()); } #else catch(Exception& ){} #endif } } -/* -----------------------------13.12.00 08:47-------------------------------- - ---------------------------------------------------------------------------*/ sal_Bool ConfigManager::IsLocalConfigProvider() { return false; diff --git a/unotools/source/config/confignode.cxx b/unotools/source/config/confignode.cxx index 5fba8c9bbc51..264eda0f59ce 100644 --- a/unotools/source/config/confignode.cxx +++ b/unotools/source/config/confignode.cxx @@ -210,7 +210,7 @@ namespace utl } catch(Exception&) { - OSL_ENSURE(sal_False, "OConfigurationNode::getNodeNames: caught a generic exception!"); + OSL_FAIL("OConfigurationNode::getNodeNames: caught a generic exception!"); } } @@ -236,16 +236,16 @@ namespace utl aBuf.append("OConfigurationNode::removeNode: there is no element named!"); aBuf.append( rtl::OUStringToOString( _rName, RTL_TEXTENCODING_ASCII_US ) ); aBuf.append( "!" ); - OSL_ENSURE(sal_False, aBuf.getStr()); + OSL_FAIL(aBuf.getStr()); #endif } catch (WrappedTargetException&) { - OSL_ENSURE(sal_False, "OConfigurationNode::removeNode: caught a WrappedTargetException!"); + OSL_FAIL("OConfigurationNode::removeNode: caught a WrappedTargetException!"); } catch(Exception&) { - OSL_ENSURE(sal_False, "OConfigurationNode::removeNode: caught a generic exception!"); + OSL_FAIL("OConfigurationNode::removeNode: caught a generic exception!"); } } return sal_False; @@ -316,12 +316,12 @@ namespace utl if (m_xDirectAccess.is() && m_xDirectAccess->hasByName(sNormalized)) { if (!::cppu::extractInterface(xNode, m_xDirectAccess->getByName(sNormalized))) - OSL_ENSURE(sal_False, "OConfigurationNode::openNode: could not open the node!"); + OSL_FAIL("OConfigurationNode::openNode: could not open the node!"); } else if (m_xHierarchyAccess.is()) { if (!::cppu::extractInterface(xNode, m_xHierarchyAccess->getByHierarchicalName(_rPath))) - OSL_ENSURE(sal_False, "OConfigurationNode::openNode: could not open the node!"); + OSL_FAIL("OConfigurationNode::openNode: could not open the node!"); } if (xNode.is()) return OConfigurationNode( xNode ); @@ -334,12 +334,12 @@ namespace utl aBuf.append("OConfigurationNode::openNode: there is no element named "); aBuf.append( rtl::OUStringToOString( _rPath, RTL_TEXTENCODING_ASCII_US ) ); aBuf.append("!"); - OSL_ENSURE(sal_False, aBuf.getStr()); + OSL_FAIL(aBuf.getStr()); #endif } catch(Exception&) { - OSL_ENSURE(sal_False, "OConfigurationNode::openNode: caught an exception while retrieving the node!"); + OSL_FAIL("OConfigurationNode::openNode: caught an exception while retrieving the node!"); } return OConfigurationNode(); } @@ -363,9 +363,6 @@ namespace utl return bIsSet; } - //--------------------------------------------------------------------- - //--- 20.08.01 19:03:20 ----------------------------------------------- - sal_Bool OConfigurationNode::hasByHierarchicalName( const ::rtl::OUString& _rName ) const throw() { OSL_ENSURE( m_xHierarchyAccess.is(), "OConfigurationNode::hasByHierarchicalName: no hierarchy access!" ); @@ -440,19 +437,19 @@ namespace utl } catch(IllegalArgumentException&) { - OSL_ENSURE(sal_False, "OConfigurationNode::setNodeValue: could not replace the value: caught an IllegalArgumentException!"); + OSL_FAIL("OConfigurationNode::setNodeValue: could not replace the value: caught an IllegalArgumentException!"); } catch(NoSuchElementException&) { - OSL_ENSURE(sal_False, "OConfigurationNode::setNodeValue: could not replace the value: caught a NoSuchElementException!"); + OSL_FAIL("OConfigurationNode::setNodeValue: could not replace the value: caught a NoSuchElementException!"); } catch(WrappedTargetException&) { - OSL_ENSURE(sal_False, "OConfigurationNode::setNodeValue: could not replace the value: caught a WrappedTargetException!"); + OSL_FAIL("OConfigurationNode::setNodeValue: could not replace the value: caught a WrappedTargetException!"); } catch(Exception&) { - OSL_ENSURE(sal_False, "OConfigurationNode::setNodeValue: could not replace the value: caught a generic Exception!"); + OSL_FAIL("OConfigurationNode::setNodeValue: could not replace the value: caught a generic Exception!"); } @@ -533,10 +530,9 @@ namespace utl aArgs.put( "lazywrite", i_bLazyWrite ); aArgs.put( "depth", i_nDepth ); - ::rtl::OUString sAccessService = ::rtl::OUString::createFromAscii( - i_bUpdatable - ? "com.sun.star.configuration.ConfigurationUpdateAccess" - : "com.sun.star.configuration.ConfigurationAccess" ); + ::rtl::OUString sAccessService( i_bUpdatable ? + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationUpdateAccess" )) : + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationAccess" ))); Reference< XInterface > xRoot( i_rxConfigProvider->createInstanceWithArguments( sAccessService, aArgs.getWrappedPropertyValues() ), diff --git a/unotools/source/config/configpathes.cxx b/unotools/source/config/configpathes.cxx index fd813d4c7a9a..5c35e112bad0 100644 --- a/unotools/source/config/configpathes.cxx +++ b/unotools/source/config/configpathes.cxx @@ -98,7 +98,7 @@ sal_Bool splitLastFromConfigurationPath(OUString const& _sInPath, // strip trailing slash if (nPos > 0 && _sInPath[ nPos ] == sal_Unicode('/')) { - OSL_ENSURE(false, "Invalid config path: trailing '/' is not allowed"); + OSL_FAIL("Invalid config path: trailing '/' is not allowed"); --nPos; } diff --git a/unotools/source/config/configvaluecontainer.cxx b/unotools/source/config/configvaluecontainer.cxx index 46f22b9c7a0a..a7fc30699218 100644 --- a/unotools/source/config/configvaluecontainer.cxx +++ b/unotools/source/config/configvaluecontainer.cxx @@ -82,9 +82,6 @@ namespace utl bool operator != ( const NodeValueAccessor& rhs ) const { return !operator == ( rhs ); } }; - //--------------------------------------------------------------------- - //--- 20.08.01 17:21:13 ----------------------------------------------- - NodeValueAccessor::NodeValueAccessor( const ::rtl::OUString& _rNodePath ) :sRelativePath( _rNodePath ) ,eLocationType( ltUnbound ) @@ -92,9 +89,6 @@ namespace utl { } - //--------------------------------------------------------------------- - //--- 20.08.01 17:06:36 ----------------------------------------------- - bool NodeValueAccessor::operator == ( const NodeValueAccessor& rhs ) const { return ( sRelativePath == rhs.sRelativePath ) @@ -102,9 +96,6 @@ namespace utl && ( pLocation == rhs.pLocation ); } - //--------------------------------------------------------------------- - //--- 20.08.01 17:47:43 ----------------------------------------------- - void NodeValueAccessor::bind( void* _pLocation, const Type& _rType ) { DBG_ASSERT( !isBound(), "NodeValueAccessor::bind: already bound!" ); @@ -114,9 +105,6 @@ namespace utl aDataType = _rType; } - //--------------------------------------------------------------------- - //--- 20.08.01 17:48:47 ----------------------------------------------- - void NodeValueAccessor::bind( Any* _pLocation ) { DBG_ASSERT( !isBound(), "NodeValueAccessor::bind: already bound!" ); @@ -126,9 +114,6 @@ namespace utl aDataType = ::getCppuType( _pLocation ); } - //--------------------------------------------------------------------- - //--- 20.08.01 17:42:17 ----------------------------------------------- - #ifndef UNX static #endif @@ -174,9 +159,6 @@ namespace utl } } - //--------------------------------------------------------------------- - //--- 21.08.01 12:06:43 ----------------------------------------------- - #ifndef UNX static #endif @@ -205,9 +187,6 @@ namespace utl //= functors on NodeValueAccessor instances //===================================================================== - //--------------------------------------------------------------------- - //--- 21.08.01 12:01:16 ----------------------------------------------- - /// base class for functors syncronizing between exchange locations and config sub nodes struct SubNodeAccess : public ::std::unary_function< NodeValueAccessor, void > { @@ -223,9 +202,6 @@ namespace utl } }; - //--------------------------------------------------------------------- - //--- 21.08.01 11:25:56 ----------------------------------------------- - struct UpdateFromConfig : public SubNodeAccess { public: @@ -237,9 +213,6 @@ namespace utl } }; - //--------------------------------------------------------------------- - //--- 21.08.01 11:25:56 ----------------------------------------------- - struct UpdateToConfig : public SubNodeAccess { public: @@ -253,9 +226,6 @@ namespace utl } }; - //--------------------------------------------------------------------- - //--- 20.08.01 16:58:24 ----------------------------------------------- - DECLARE_STL_VECTOR( NodeValueAccessor, NodeValueAccessors ); //===================================================================== @@ -280,9 +250,6 @@ namespace utl //= OConfigurationValueContainer //===================================================================== - //--------------------------------------------------------------------- - //--- 20.08.01 15:53:35 ----------------------------------------------- - OConfigurationValueContainer::OConfigurationValueContainer( const Reference< XMultiServiceFactory >& _rxORB, ::osl::Mutex& _rAccessSafety, const sal_Char* _pConfigLocation, const sal_uInt16 _nAccessFlags, const sal_Int32 _nLevels ) @@ -291,9 +258,6 @@ namespace utl implConstruct( ::rtl::OUString::createFromAscii( _pConfigLocation ), _nAccessFlags, _nLevels ); } - //--------------------------------------------------------------------- - //--- 20.08.01 15:55:20 ----------------------------------------------- - OConfigurationValueContainer::OConfigurationValueContainer( const Reference< XMultiServiceFactory >& _rxORB, ::osl::Mutex& _rAccessSafety, const ::rtl::OUString& _rConfigLocation, const sal_uInt16 _nAccessFlags, const sal_Int32 _nLevels ) @@ -302,25 +266,16 @@ namespace utl implConstruct( _rConfigLocation, _nAccessFlags, _nLevels ); } - //--------------------------------------------------------------------- - //--- 20.08.01 16:01:29 ----------------------------------------------- - OConfigurationValueContainer::~OConfigurationValueContainer() { delete m_pImpl; } - //--------------------------------------------------------------------- - //--- 20.08.01 15:59:13 ----------------------------------------------- - const Reference< XMultiServiceFactory >& OConfigurationValueContainer::getServiceFactory( ) const { return m_pImpl->xORB; } - //--------------------------------------------------------------------- - //--- 20.08.01 16:02:07 ----------------------------------------------- - void OConfigurationValueContainer::implConstruct( const ::rtl::OUString& _rConfigLocation, const sal_uInt16 _nAccessFlags, const sal_Int32 _nLevels ) { @@ -344,9 +299,6 @@ namespace utl #endif } - //--------------------------------------------------------------------- - //--- 20.08.01 16:39:05 ----------------------------------------------- - void OConfigurationValueContainer::registerExchangeLocation( const sal_Char* _pRelativePath, void* _pContainer, const Type& _rValueType ) { @@ -370,9 +322,6 @@ namespace utl implRegisterExchangeLocation( aNewAccessor ); } - //--------------------------------------------------------------------- - //--- 21.08.01 14:44:45 ----------------------------------------------- - void OConfigurationValueContainer::registerNullValueExchangeLocation( const sal_Char* _pRelativePath, Any* _pContainer ) { // build an accessor for this container @@ -383,9 +332,6 @@ namespace utl implRegisterExchangeLocation( aNewAccessor ); } - //--------------------------------------------------------------------- - //--- 21.08.01 10:23:34 ----------------------------------------------- - void OConfigurationValueContainer::read( ) { std::for_each( @@ -395,9 +341,6 @@ namespace utl ); } - //--------------------------------------------------------------------- - //--- 21.08.01 12:04:48 ----------------------------------------------- - void OConfigurationValueContainer::write( sal_Bool _bCommit ) { // collect the current values in the exchange locations @@ -412,9 +355,6 @@ namespace utl commit( sal_False ); } - //--------------------------------------------------------------------- - //--- 21.08.01 12:09:45 ----------------------------------------------- - void OConfigurationValueContainer::commit( sal_Bool _bWrite ) { // write the current values in the exchange locations (if requested) @@ -425,9 +365,6 @@ namespace utl m_pImpl->aConfigRoot.commit( ); } - //--------------------------------------------------------------------- - //--- 20.08.01 17:29:27 ----------------------------------------------- - void OConfigurationValueContainer::implRegisterExchangeLocation( const NodeValueAccessor& _rAccessor ) { // some checks diff --git a/unotools/source/config/defaultoptions.cxx b/unotools/source/config/defaultoptions.cxx index a4611ab74ef5..0b9f1331b261 100644 --- a/unotools/source/config/defaultoptions.cxx +++ b/unotools/source/config/defaultoptions.cxx @@ -47,9 +47,10 @@ using namespace osl; using namespace utl; -using namespace rtl; using namespace com::sun::star::uno; +using ::rtl::OUString; + // define ---------------------------------------------------------------- #define ASCII_STR(s) OUString( RTL_CONSTASCII_USTRINGPARAM(s) ) @@ -107,7 +108,7 @@ public: SvtDefaultOptions_Impl(); - String GetDefaultPath( USHORT nId ) const; + String GetDefaultPath( sal_uInt16 nId ) const; virtual void Commit(); virtual void Notify( const com::sun::star::uno::Sequence<rtl::OUString>& aPropertyNames); }; @@ -125,7 +126,7 @@ struct PathToDefaultMapping_Impl PathStrPtr _pDefaultPath; }; -static PathToDefaultMapping_Impl __READONLY_DATA PathMap_Impl[] = +static PathToDefaultMapping_Impl const PathMap_Impl[] = { { SvtPathOptions::PATH_ADDIN, &SvtDefaultOptions_Impl::m_aAddinPath }, { SvtPathOptions::PATH_AUTOCORRECT, &SvtDefaultOptions_Impl::m_aAutoCorrectPath }, @@ -200,10 +201,10 @@ void SvtDefaultOptions_Impl::Commit() // class SvtDefaultOptions_Impl ------------------------------------------ -String SvtDefaultOptions_Impl::GetDefaultPath( USHORT nId ) const +String SvtDefaultOptions_Impl::GetDefaultPath( sal_uInt16 nId ) const { String aRet; - USHORT nIdx = 0; + sal_uInt16 nIdx = 0; while ( PathMap_Impl[nIdx]._ePath <= SvtPathOptions::PATH_WORK ) { @@ -356,7 +357,7 @@ SvtDefaultOptions::~SvtDefaultOptions() // ----------------------------------------------------------------------- -String SvtDefaultOptions::GetDefaultPath( USHORT nId ) const +String SvtDefaultOptions::GetDefaultPath( sal_uInt16 nId ) const { return pImp->GetDefaultPath( nId ); } diff --git a/unotools/source/config/docinfohelper.cxx b/unotools/source/config/docinfohelper.cxx index 4baa1d984687..beb381c51d37 100644 --- a/unotools/source/config/docinfohelper.cxx +++ b/unotools/source/config/docinfohelper.cxx @@ -72,8 +72,8 @@ namespace utl } aResult.append( (sal_Unicode)'$' ); - aResult.append( ::rtl::OUString::createFromAscii( - TOOLS_INETDEF_OS ).replace( ' ', '_' ) ); + aResult.append( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + TOOLS_INETDEF_OS )).replace( ' ', '_' ) ); aResult.append( (sal_Unicode)' ' ); } diff --git a/unotools/source/config/dynamicmenuoptions.cxx b/unotools/source/config/dynamicmenuoptions.cxx index 3dc775c6bdca..76950ee441bc 100644 --- a/unotools/source/config/dynamicmenuoptions.cxx +++ b/unotools/source/config/dynamicmenuoptions.cxx @@ -37,9 +37,7 @@ #include <com/sun/star/uno/Any.hxx> #include <com/sun/star/uno/Sequence.hxx> -#ifndef __SGI_STL_VECTOR #include <vector> -#endif #include <itemholder1.hxx> @@ -541,7 +539,7 @@ void SvtDynamicMenuOptions_Impl::Notify( const Sequence< OUString >& ) //***************************************************************************************************************** void SvtDynamicMenuOptions_Impl::Commit() { - DBG_ERROR( "SvtDynamicMenuOptions_Impl::Commit()\nNot implemented yet!\n" ); + OSL_FAIL( "SvtDynamicMenuOptions_Impl::Commit()\nNot implemented yet!\n" ); /* // Write all properties! // Delete complete sets first. diff --git a/unotools/source/config/eventcfg.cxx b/unotools/source/config/eventcfg.cxx index 5008c70cdb92..a1dbcda74e0b 100644 --- a/unotools/source/config/eventcfg.cxx +++ b/unotools/source/config/eventcfg.cxx @@ -38,7 +38,7 @@ #include <com/sun/star/beans/PropertyValue.hpp> #include <cppuhelper/weakref.hxx> -#include <hash_map> +#include <boost/unordered_map.hpp> #include <tools/urlobj.hxx> #include <rtl/ustrbuf.hxx> diff --git a/unotools/source/config/extendedsecurityoptions.cxx b/unotools/source/config/extendedsecurityoptions.cxx index d393ccad30bc..d64958b15b4e 100644 --- a/unotools/source/config/extendedsecurityoptions.cxx +++ b/unotools/source/config/extendedsecurityoptions.cxx @@ -45,7 +45,7 @@ #include <unotools/pathoptions.hxx> -#include <hash_map> +#include <boost/unordered_map.hpp> #include <rtl/logfile.hxx> #include "itemholder1.hxx" @@ -86,7 +86,7 @@ struct OUStringHashCode } }; -class ExtensionHashMap : public ::std::hash_map< ::rtl::OUString, +class ExtensionHashMap : public ::boost::unordered_map< ::rtl::OUString, sal_Int32, OUStringHashCode, ::std::equal_to< ::rtl::OUString > > @@ -257,7 +257,7 @@ SvtExtendedSecurityOptions_Impl::SvtExtendedSecurityOptions_Impl() if ( seqValues[nProperty] >>= nMode ) m_eOpenHyperlinkMode = (SvtExtendedSecurityOptions::OpenHyperlinkMode)nMode; else { - DBG_ERROR("Wrong type for Open mode!"); + OSL_FAIL("Wrong type for Open mode!"); } m_bROOpenHyperlinkMode = seqRO[nProperty]; } @@ -342,7 +342,7 @@ Sequence< OUString > SvtExtendedSecurityOptions_Impl::GetSecureExtensionList() c sal_Int32 nIndex = 0; for ( ExtensionHashMap::const_iterator pIter = m_aExtensionHashMap.begin(); - pIter != m_aExtensionHashMap.end(); pIter++ ) + pIter != m_aExtensionHashMap.end(); ++pIter ) { aResult[nIndex++] = pIter->first; } @@ -357,9 +357,7 @@ SvtExtendedSecurityOptions::OpenHyperlinkMode SvtExtendedSecurityOptions_Impl::G { return m_eOpenHyperlinkMode; } -/* -----------------09.07.2003 11:26----------------- - --------------------------------------------------*/ sal_Bool SvtExtendedSecurityOptions_Impl::IsOpenHyperlinkModeReadOnly() const { return m_bROOpenHyperlinkMode; @@ -496,9 +494,7 @@ SvtExtendedSecurityOptions::OpenHyperlinkMode SvtExtendedSecurityOptions::GetOpe MutexGuard aGuard( GetInitMutex() ); return m_pDataContainer->GetOpenHyperlinkMode(); } -/* -----------------09.07.2003 11:26----------------- - --------------------------------------------------*/ sal_Bool SvtExtendedSecurityOptions::IsOpenHyperlinkModeReadOnly() const { return m_pDataContainer->IsOpenHyperlinkModeReadOnly(); diff --git a/unotools/source/config/fltrcfg.cxx b/unotools/source/config/fltrcfg.cxx index 592ed8373475..805a38f98620 100644 --- a/unotools/source/config/fltrcfg.cxx +++ b/unotools/source/config/fltrcfg.cxx @@ -37,10 +37,11 @@ #include <com/sun/star/uno/Sequence.hxx> using namespace utl; -using namespace rtl; using namespace com::sun::star::uno; -#define C2U(cChar) OUString::createFromAscii(cChar) +using ::rtl::OUString; + +#define C2U(cChar) OUString(RTL_CONSTASCII_USTRINGPARAM(cChar)) // ----------------------------------------------------------------------- #define FILTERCFG_WORD_CODE 0x0001 @@ -66,9 +67,6 @@ using namespace com::sun::star::uno; static SvtFilterOptions* pOptions=0; -/* -----------------------------22.01.01 10:23-------------------------------- - - ---------------------------------------------------------------------------*/ class SvtAppFilterOptions_Impl : public utl::ConfigItem { sal_Bool bLoadVBA; @@ -99,17 +97,12 @@ public: } }; -/* -----------------------------22.01.01 11:08-------------------------------- - - ---------------------------------------------------------------------------*/ SvtAppFilterOptions_Impl::~SvtAppFilterOptions_Impl() { if(IsModified()) Commit(); } -/* -----------------------------22.01.01 10:38-------------------------------- - ---------------------------------------------------------------------------*/ void SvtAppFilterOptions_Impl::Commit() { Sequence<OUString> aNames(2); @@ -131,10 +124,6 @@ void SvtAppFilterOptions_Impl::Notify( const Sequence< rtl::OUString >& ) // no listeners supported yet } - -/* -----------------------------22.01.01 10:38-------------------------------- - - ---------------------------------------------------------------------------*/ void SvtAppFilterOptions_Impl::Load() { Sequence<OUString> aNames(2); @@ -243,12 +232,9 @@ void SvtCalcFilterOptions_Impl::Load() bLoadExecutable = *(sal_Bool*)pValues[0].getValue(); } -/* -----------------------------22.01.01 10:32-------------------------------- - - ---------------------------------------------------------------------------*/ struct SvtFilterOptions_Impl { - ULONG nFlags; + sal_uLong nFlags; SvtWriterFilterOptions_Impl aWriterCfg; SvtCalcFilterOptions_Impl aCalcCfg; SvtAppFilterOptions_Impl aImpressCfg; @@ -276,8 +262,8 @@ struct SvtFilterOptions_Impl Load(); } - void SetFlag( ULONG nFlag, BOOL bSet ); - BOOL IsFlag( ULONG nFlag ) const; + void SetFlag( sal_uLong nFlag, sal_Bool bSet ); + sal_Bool IsFlag( sal_uLong nFlag ) const; void Load() { aWriterCfg.Load(); @@ -285,10 +271,8 @@ struct SvtFilterOptions_Impl aImpressCfg.Load(); } }; -/* -----------------------------22.01.01 10:34-------------------------------- - ---------------------------------------------------------------------------*/ -void SvtFilterOptions_Impl::SetFlag( ULONG nFlag, BOOL bSet ) +void SvtFilterOptions_Impl::SetFlag( sal_uLong nFlag, sal_Bool bSet ) { switch(nFlag) { @@ -307,12 +291,10 @@ void SvtFilterOptions_Impl::SetFlag( ULONG nFlag, BOOL bSet ) nFlags &= ~nFlag; } } -/* -----------------------------22.01.01 10:35-------------------------------- - ---------------------------------------------------------------------------*/ -BOOL SvtFilterOptions_Impl::IsFlag( ULONG nFlag ) const +sal_Bool SvtFilterOptions_Impl::IsFlag( sal_uLong nFlag ) const { - BOOL bRet; + sal_Bool bRet; switch(nFlag) { case FILTERCFG_WORD_CODE : bRet = aWriterCfg.IsLoad();break; @@ -344,9 +326,7 @@ SvtFilterOptions::~SvtFilterOptions() { delete pImp; } -/* -----------------------------22.01.01 08:45-------------------------------- - ---------------------------------------------------------------------------*/ const Sequence<OUString>& SvtFilterOptions::GetPropertyNames() { static Sequence<OUString> aNames; @@ -371,14 +351,14 @@ const Sequence<OUString>& SvtFilterOptions::GetPropertyNames() }; OUString* pNames = aNames.getArray(); for(int i = 0; i < nCount; i++) - pNames[i] = C2U(aPropNames[i]); + pNames[i] = OUString::createFromAscii(aPropNames[i]); } return aNames; } //----------------------------------------------------------------------- -static ULONG lcl_GetFlag(sal_Int32 nProp) +static sal_uLong lcl_GetFlag(sal_Int32 nProp) { - ULONG nFlag = 0; + sal_uLong nFlag = 0; switch(nProp) { case 0: nFlag = FILTERCFG_MATH_LOAD; break; @@ -394,20 +374,16 @@ static ULONG lcl_GetFlag(sal_Int32 nProp) case 10: nFlag = FILTERCFG_ENABLE_WORD_PREVIEW; break; case 11: nFlag = FILTERCFG_USE_ENHANCED_FIELDS; break; - default: DBG_ERROR("illegal value"); + default: OSL_FAIL("illegal value"); } return nFlag; } -/*-- 22.01.01 08:53:03--------------------------------------------------- - -----------------------------------------------------------------------*/ void SvtFilterOptions::Notify( const Sequence<OUString>& ) { Load(); } -/*-- 22.01.01 08:53:04--------------------------------------------------- - -----------------------------------------------------------------------*/ void SvtFilterOptions::Commit() { const Sequence<OUString>& aNames = GetPropertyNames(); @@ -417,16 +393,14 @@ void SvtFilterOptions::Commit() const Type& rType = ::getBooleanCppuType(); for(int nProp = 0; nProp < aNames.getLength(); nProp++) { - ULONG nFlag = lcl_GetFlag(nProp); + sal_uLong nFlag = lcl_GetFlag(nProp); sal_Bool bVal = pImp->IsFlag( nFlag); pValues[nProp].setValue(&bVal, rType); } PutProperties(aNames, aValues); } -/*-- 22.01.01 08:53:04--------------------------------------------------- - -----------------------------------------------------------------------*/ void SvtFilterOptions::Load() { pImp->Load(); @@ -441,7 +415,7 @@ void SvtFilterOptions::Load() if(pValues[nProp].hasValue()) { sal_Bool bVal = *(sal_Bool*)pValues[nProp].getValue(); - ULONG nFlag = lcl_GetFlag(nProp); + sal_uLong nFlag = lcl_GetFlag(nProp); pImp->SetFlag( nFlag, bVal); } } @@ -466,7 +440,7 @@ void SvtFilterOptions::SetLoadWordBasicExecutable( sal_Bool bFlag ) SetModified(); } -BOOL SvtFilterOptions::IsLoadWordBasicExecutable() const +sal_Bool SvtFilterOptions::IsLoadWordBasicExecutable() const { return pImp->IsFlag( FILTERCFG_WORD_WBCTBL ); } diff --git a/unotools/source/config/fontcfg.cxx b/unotools/source/config/fontcfg.cxx index 408a208e7bee..6ff32c0b6e71 100644 --- a/unotools/source/config/fontcfg.cxx +++ b/unotools/source/config/fontcfg.cxx @@ -51,13 +51,14 @@ #define DEFAULTFONT_CONFIGNODE "VCL/DefaultFonts" #define SUBSTFONT_CONFIGNODE "VCL/FontSubstitutions" -using namespace rtl; using namespace utl; using namespace com::sun::star::uno; using namespace com::sun::star::lang; using namespace com::sun::star::beans; using namespace com::sun::star::container; +using ::rtl::OUString; + static DefaultFontConfiguration* mpDefaultFontConfiguration = 0; static FontSubstConfiguration* mpFontSubstConfiguration = 0; @@ -94,7 +95,7 @@ static const char* getKeyType( int nKeyType ) case DEFAULTFONT_UI_FIXED: return "UI_FIXED"; case DEFAULTFONT_UI_SANS: return "UI_SANS"; default: - DBG_ERROR( "unmatched type" ); + OSL_FAIL( "unmatched type" ); return ""; } } @@ -193,7 +194,7 @@ OUString DefaultFontConfiguration::tryLocale( const Locale& rLocale, const OUStr { OUString aRet; - std::hash_map< Locale, LocaleAccess, LocaleHash >::const_iterator it = + boost::unordered_map< Locale, LocaleAccess, LocaleHash >::const_iterator it = m_aConfig.find( rLocale ); if( it != m_aConfig.end() ) { @@ -327,40 +328,40 @@ OUString DefaultFontConfiguration::getUserInterfaceFont( const Locale& rLocale ) static const OUString aFallBackKorean( aFallBackKoreanLocalized ); // optimize font list for some locales, as long as Andale Sans UI does not support them - if( aLocale.Language.equalsAscii( "ar" ) || - aLocale.Language.equalsAscii( "he" ) || - aLocale.Language.equalsAscii( "iw" ) ) + if( aLocale.Language.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ar" ) ) || + aLocale.Language.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "he" ) ) || + aLocale.Language.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "iw" ) ) ) { return aFallBackArabic; } - else if( aLocale.Language.equalsAscii( "th" ) ) + else if( aLocale.Language.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "th" ) ) ) { return aFallBackThai; } - else if( aLocale.Language.equalsAscii( "ko" ) ) + else if( aLocale.Language.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ko" ) ) ) { return aFallBackKorean; } - else if( aLocale.Language.equalsAscii( "cs" ) || - aLocale.Language.equalsAscii( "hu" ) || - aLocale.Language.equalsAscii( "pl" ) || - aLocale.Language.equalsAscii( "ro" ) || - aLocale.Language.equalsAscii( "rm" ) || - aLocale.Language.equalsAscii( "hr" ) || - aLocale.Language.equalsAscii( "sk" ) || - aLocale.Language.equalsAscii( "sl" ) || - aLocale.Language.equalsAscii( "sb" ) ) + else if( aLocale.Language.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "cs" ) ) || + aLocale.Language.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "hu" ) ) || + aLocale.Language.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "pl" ) ) || + aLocale.Language.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ro" ) ) || + aLocale.Language.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "rm" ) ) || + aLocale.Language.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "hr" ) ) || + aLocale.Language.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "sk" ) ) || + aLocale.Language.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "sl" ) ) || + aLocale.Language.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "sb" ) ) ) { return aFallbackLatin2; } - else if( aLocale.Language.equalsAscii( "zh" ) ) + else if( aLocale.Language.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "zh" ) ) ) { - if( ! aLocale.Country.equalsAscii( "cn" ) ) + if( ! aLocale.Country.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "cn" ) ) ) return aFallBackChineseTRD; else return aFallBackChineseSIM; } - else if( aLocale.Language.equalsAscii( "ja" ) ) + else if( aLocale.Language.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ja" ) ) ) { return aFallBackJapanese; } @@ -614,7 +615,7 @@ static ImplFontAttrWidthSearchData const aImplWidthAttrSearchList[] = struct ImplFontAttrTypeSearchData { const char* mpStr; - ULONG mnType; + sal_uLong mnType; }; static ImplFontAttrTypeSearchData const aImplTypeAttrSearchList[] = @@ -778,23 +779,23 @@ static bool ImplKillTrailingWithExceptions( String& rName, const char* const* pp // ----------------------------------------------------------------------- -static BOOL ImplFindAndErase( String& rName, const char* pStr ) +static sal_Bool ImplFindAndErase( String& rName, const char* pStr ) { xub_StrLen nPos = rName.SearchAscii( pStr ); if ( nPos == STRING_NOTFOUND ) - return FALSE; + return sal_False; const char* pTempStr = pStr; while ( *pTempStr ) pTempStr++; rName.Erase( nPos, (xub_StrLen)(pTempStr-pStr) ); - return TRUE; + return sal_True; } // ======================================================================= void FontSubstConfiguration::getMapName( const String& rOrgName, String& rShortName, - String& rFamilyName, FontWeight& rWeight, FontWidth& rWidth, ULONG& rType ) + String& rFamilyName, FontWeight& rWeight, FontWidth& rWidth, sal_uLong& rType ) { rShortName = rOrgName; @@ -1093,7 +1094,7 @@ unsigned long FontSubstConfiguration::getSubstType( const com::sun::star::uno::R void FontSubstConfiguration::readLocaleSubst( const com::sun::star::lang::Locale& rLocale ) const { - std::hash_map< Locale, LocaleSubst, LocaleHash >::const_iterator it = + boost::unordered_map< Locale, LocaleSubst, LocaleHash >::const_iterator it = m_aSubst.find( rLocale ); if( it != m_aSubst.end() ) { @@ -1193,7 +1194,7 @@ const FontNameAttr* FontSubstConfiguration::getSubstInfo( const String& rFontNam while( aLocale.Language.getLength() ) { - std::hash_map< Locale, LocaleSubst, LocaleHash >::const_iterator lang = m_aSubst.find( aLocale ); + boost::unordered_map< Locale, LocaleSubst, LocaleHash >::const_iterator lang = m_aSubst.find( aLocale ); if( lang != m_aSubst.end() ) { if( ! lang->second.bConfigRead ) @@ -1216,7 +1217,7 @@ const FontNameAttr* FontSubstConfiguration::getSubstInfo( const String& rFontNam aLocale.Variant = OUString(); else if( aLocale.Country.getLength() ) aLocale.Country = OUString(); - else if( ! aLocale.Language.equalsAscii( "en" ) ) + else if( ! aLocale.Language.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "en" ) ) ) aLocale.Language = OUString( RTL_CONSTASCII_USTRINGPARAM( "en" ) ); else aLocale.Language = OUString(); diff --git a/unotools/source/config/historyoptions.cxx b/unotools/source/config/historyoptions.cxx index dd18d399bc10..7cc8d4eedefd 100644 --- a/unotools/source/config/historyoptions.cxx +++ b/unotools/source/config/historyoptions.cxx @@ -37,13 +37,8 @@ #include <com/sun/star/uno/Any.hxx> #include <com/sun/star/uno/Sequence.hxx> -#ifndef __SGI_STL_DEQUE #include <deque> -#endif - -#ifndef __SGI_STL_ALGORITHM #include <algorithm> -#endif #include <rtl/logfile.hxx> #include "itemholder1.hxx" @@ -107,7 +102,7 @@ struct IMPL_THistoryItem sPassword = sNewPassword ; } - sal_Bool operator==( const OUString& sSearchedURL ) + sal_Bool operator==( const OUString& sSearchedURL ) const { return( sURL == sSearchedURL ); } diff --git a/unotools/source/config/inetoptions.cxx b/unotools/source/config/inetoptions.cxx index 387bbe384edc..d851102d2d23 100644 --- a/unotools/source/config/inetoptions.cxx +++ b/unotools/source/config/inetoptions.cxx @@ -247,7 +247,7 @@ SvtInetOptions::Impl::notifyListeners( { aEvents.realloc(nCount); aNotifications. - push_back(std::make_pair< List::value_type::first_type, + push_back(std::pair< List::value_type::first_type, List::value_type::second_type >( aIt->first, aEvents)); } @@ -280,8 +280,7 @@ SvtInetOptions::Impl::Impl(): for (sal_Int32 i = 0; i < ENTRY_COUNT; ++i) aKeys[i] = m_aEntries[i].m_aName; if (!EnableNotification(aKeys)) - OSL_ENSURE(false, - "SvtInetOptions::Impl::Impl(): Bad EnableNotifications()"); + OSL_FAIL("SvtInetOptions::Impl::Impl(): Bad EnableNotifications()"); } //============================================================================ @@ -330,8 +329,7 @@ star::uno::Any SvtInetOptions::Impl::getProperty(Index nPropIndex) } } } - OSL_ENSURE(false, - "SvtInetOptions::Impl::getProperty(): Possible life lock"); + OSL_FAIL("SvtInetOptions::Impl::getProperty(): Possible life lock"); { osl::MutexGuard aGuard(m_aMutex); return m_aEntries[nPropIndex].m_aValue; diff --git a/unotools/source/config/itemholder1.cxx b/unotools/source/config/itemholder1.cxx index e906fc5da5b5..f9a22805dd6d 100644 --- a/unotools/source/config/itemholder1.cxx +++ b/unotools/source/config/itemholder1.cxx @@ -87,7 +87,7 @@ ItemHolder1::ItemHolder1() { css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory(); css::uno::Reference< css::lang::XComponent > xCfg( - xSMGR->createInstance(::rtl::OUString::createFromAscii("com.sun.star.configuration.ConfigurationProvider")), + xSMGR->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.ConfigurationProvider"))), css::uno::UNO_QUERY); if (xCfg.is()) xCfg->addEventListener(static_cast< css::lang::XEventListener* >(this)); @@ -104,7 +104,7 @@ ItemHolder1::ItemHolder1() sMsg += ::rtl::OString(rEx.Message.getStr(), rEx.Message.getLength(), RTL_TEXTENCODING_ASCII_US); - OSL_ENSURE(sal_False, sMsg.getStr()); + OSL_FAIL(sMsg.getStr()); } } #else @@ -313,7 +313,7 @@ void ItemHolder1::impl_newItem(TItemInfo& rItem) break; default: - OSL_ASSERT( "unknown item type" ); + OSL_FAIL( "unknown item type" ); break; } } diff --git a/unotools/source/config/javaoptions.cxx b/unotools/source/config/javaoptions.cxx index 0fa713c8d7b4..1ddef0dd409b 100644 --- a/unotools/source/config/javaoptions.cxx +++ b/unotools/source/config/javaoptions.cxx @@ -38,11 +38,9 @@ using namespace ::com::sun::star::uno; using namespace ::rtl; -#define C2U(cChar) OUString::createFromAscii(cChar) +#define C2U(cChar) OUString(RTL_CONSTASCII_USTRINGPARAM(cChar)) #define CFG_READONLY_DEFAULT sal_False -/* -----------------------------10.04.01 12:39-------------------------------- - ---------------------------------------------------------------------------*/ class SvtExecAppletsItem_Impl : public utl::ConfigItem { sal_Bool bExecute; @@ -57,9 +55,7 @@ public: void SetExecuteApplets(sal_Bool bSet); sal_Bool IsReadOnly() const {return bRO;} }; -/* -----------------------------10.02.2003 07:46------------------------------ - ---------------------------------------------------------------------------*/ void SvtExecAppletsItem_Impl::SetExecuteApplets(sal_Bool bSet) { OSL_ENSURE(!bRO, "SvtExecAppletsItem_Impl::SetExecuteApplets()\nYou tried to write on a readonly value!\n"); @@ -69,9 +65,7 @@ void SvtExecAppletsItem_Impl::SetExecuteApplets(sal_Bool bSet) SetModified(); } } -/* -----------------------------18.05.01 14:44-------------------------------- - ---------------------------------------------------------------------------*/ SvtExecAppletsItem_Impl::SvtExecAppletsItem_Impl() : utl::ConfigItem(C2U("Office.Common/Java/Applet")), bExecute (sal_False ), @@ -139,9 +133,7 @@ struct SvtJavaOptions_Impl pNames[3] = C2U("UserClassPath"); } }; -/* -----------------------------18.05.01 13:28-------------------------------- - ---------------------------------------------------------------------------*/ SvtJavaOptions::SvtJavaOptions() : utl::ConfigItem(C2U("Office.Java/VirtualMachine")), pImpl(new SvtJavaOptions_Impl) @@ -173,16 +165,12 @@ SvtJavaOptions::SvtJavaOptions() : pImpl->bROUserClassPath = pROStates[3]; } } -/* -----------------------------18.05.01 13:28-------------------------------- - ---------------------------------------------------------------------------*/ SvtJavaOptions::~SvtJavaOptions() { delete pImpl; } -/*-- 18.05.01 13:28:35--------------------------------------------------- - -----------------------------------------------------------------------*/ void SvtJavaOptions::Commit() { pImpl->aExecItem.Commit(); @@ -243,37 +231,27 @@ void SvtJavaOptions::Commit() aNames.realloc(nRealCount); PutProperties(aNames,aValues); } -/*-- 18.05.01 13:28:35--------------------------------------------------- - -----------------------------------------------------------------------*/ sal_Bool SvtJavaOptions::IsEnabled() const { return pImpl->bEnabled; } -/*-- 18.05.01 13:28:35--------------------------------------------------- - -----------------------------------------------------------------------*/ sal_Bool SvtJavaOptions::IsSecurity()const { return pImpl->bSecurity; } -/*-- 18.05.01 13:28:35--------------------------------------------------- - -----------------------------------------------------------------------*/ sal_Int32 SvtJavaOptions::GetNetAccess() const { return pImpl->nNetAccess; } -/*-- 18.05.01 13:28:36--------------------------------------------------- - -----------------------------------------------------------------------*/ rtl::OUString& SvtJavaOptions::GetUserClassPath()const { return pImpl->sUserClassPath; } -/*-- 18.05.01 13:28:37--------------------------------------------------- - -----------------------------------------------------------------------*/ void SvtJavaOptions::SetEnabled(sal_Bool bSet) { OSL_ENSURE(!pImpl->bROEnabled, "SvtJavaOptions::SetEnabled()\nYou tried to write on a readonly value!\n"); @@ -283,9 +261,7 @@ void SvtJavaOptions::SetEnabled(sal_Bool bSet) SetModified(); } } -/*-- 18.05.01 13:28:38--------------------------------------------------- - -----------------------------------------------------------------------*/ void SvtJavaOptions::SetSecurity(sal_Bool bSet) { OSL_ENSURE(!pImpl->bROSecurity, "SvtJavaOptions::SetSecurity()\nYou tried to write on a readonly value!\n"); @@ -295,9 +271,7 @@ void SvtJavaOptions::SetSecurity(sal_Bool bSet) SetModified(); } } -/*-- 18.05.01 13:28:38--------------------------------------------------- - -----------------------------------------------------------------------*/ void SvtJavaOptions::SetNetAccess(sal_Int32 nSet) { OSL_ENSURE(!pImpl->bRONetAccess, "SvtJavaOptions::SetNetAccess()\nYou tried to write on a readonly value!\n"); @@ -307,9 +281,7 @@ void SvtJavaOptions::SetNetAccess(sal_Int32 nSet) SetModified(); } } -/*-- 18.05.01 13:28:38--------------------------------------------------- - -----------------------------------------------------------------------*/ void SvtJavaOptions::SetUserClassPath(const rtl::OUString& rSet) { OSL_ENSURE(!pImpl->bROUserClassPath, "SvtJavaOptions::SetUserClassPath()\nYou tried to write on a readonly value!\n"); @@ -320,16 +292,12 @@ void SvtJavaOptions::SetUserClassPath(const rtl::OUString& rSet) } } -/*-- 18.05.01 14:34:32--------------------------------------------------- - -----------------------------------------------------------------------*/ sal_Bool SvtJavaOptions::IsExecuteApplets() const { return pImpl->aExecItem.IsExecuteApplets(); } -/*-- 18.05.01 14:34:32--------------------------------------------------- - -----------------------------------------------------------------------*/ void SvtJavaOptions::SetExecuteApplets(sal_Bool bSet) { if(!pImpl->aExecItem.IsReadOnly() && pImpl->aExecItem.IsExecuteApplets() != bSet) @@ -338,9 +306,7 @@ void SvtJavaOptions::SetExecuteApplets(sal_Bool bSet) SetModified(); } } -/*--10.02.2003 08:40--------------------------------------------------- ------------------------------------------------------------------------*/ sal_Bool SvtJavaOptions::IsReadOnly( EOption eOption ) const { sal_Bool bRO = sal_True; diff --git a/unotools/source/config/lingucfg.cxx b/unotools/source/config/lingucfg.cxx index c11403f47a26..9805c14c362d 100644 --- a/unotools/source/config/lingucfg.cxx +++ b/unotools/source/config/lingucfg.cxx @@ -51,10 +51,12 @@ #include <itemholder1.hxx> -using namespace rtl; using namespace com::sun::star; -#define A2OU(x) ::rtl::OUString::createFromAscii( x ) +using ::rtl::OUString; +using ::rtl::Uri; + +#define A2OU(x) ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( x )) #define EXPAND_PROTOCOL "vnd.sun.star.expand:" #define FILE_PROTOCOL "file:///" @@ -71,25 +73,25 @@ static osl::Mutex & GetOwnMutex() /////////////////////////////////////////////////////////////////////////// -static BOOL lcl_SetLocale( INT16 &rLanguage, const uno::Any &rVal ) +static sal_Bool lcl_SetLocale( sal_Int16 &rLanguage, const uno::Any &rVal ) { - BOOL bSucc = FALSE; + sal_Bool bSucc = sal_False; lang::Locale aNew; if (rVal >>= aNew) // conversion successful? { - INT16 nNew = MsLangId::convertLocaleToLanguage( aNew ); + sal_Int16 nNew = MsLangId::convertLocaleToLanguage( aNew ); if (nNew != rLanguage) { rLanguage = nNew; - bSucc = TRUE; + bSucc = sal_True; } } return bSucc; } -static inline const OUString lcl_LanguageToCfgLocaleStr( INT16 nLanguage ) +static inline const OUString lcl_LanguageToCfgLocaleStr( sal_Int16 nLanguage ) { OUString aRes; if (LANGUAGE_SYSTEM != nLanguage) @@ -98,7 +100,7 @@ static inline const OUString lcl_LanguageToCfgLocaleStr( INT16 nLanguage ) } -static INT16 lcl_CfgAnyToLanguage( const uno::Any &rVal ) +static sal_Int16 lcl_CfgAnyToLanguage( const uno::Any &rVal ) { OUString aTmp; rVal >>= aTmp; @@ -116,34 +118,34 @@ SvtLinguOptions::SvtLinguOptions() // general options bIsUseDictionaryList = - bIsIgnoreControlCharacters = TRUE; + bIsIgnoreControlCharacters = sal_True; // spelling options bIsSpellCapitalization = - bIsSpellSpecial = TRUE; + bIsSpellSpecial = sal_True; bIsSpellAuto = bIsSpellReverse = bIsSpellWithDigits = - bIsSpellUpperCase = FALSE; + bIsSpellUpperCase = sal_False; // text conversion options - bIsIgnorePostPositionalWord = TRUE; + bIsIgnorePostPositionalWord = sal_True; bIsAutoCloseDialog = bIsShowEntriesRecentlyUsedFirst = - bIsAutoReplaceUniqueEntries = FALSE; - bIsDirectionToSimplified = TRUE; + bIsAutoReplaceUniqueEntries = sal_False; + bIsDirectionToSimplified = sal_True; bIsUseCharacterVariants = bIsTranslateCommonTerms = - bIsReverseMapping = FALSE; + bIsReverseMapping = sal_False; bROIsDirectionToSimplified = bROIsUseCharacterVariants = bROIsTranslateCommonTerms = - bROIsReverseMapping = FALSE; + bROIsReverseMapping = sal_False; // hyphenation options - bIsHyphSpecial = TRUE; - bIsHyphAuto = FALSE; + bIsHyphSpecial = sal_True; + bIsHyphAuto = sal_False; nHyphMinLeading = nHyphMinTrailing = 2; nHyphMinWordLength = 0; @@ -168,10 +170,10 @@ class SvtLinguConfigItem : public utl::ConfigItem SvtLinguConfigItem( const SvtLinguConfigItem & ); SvtLinguConfigItem & operator = ( const SvtLinguConfigItem & ); - static BOOL GetHdlByName( INT32 &rnHdl, const OUString &rPropertyName, sal_Bool bFullPropName = sal_False ); + static sal_Bool GetHdlByName( sal_Int32 &rnHdl, const OUString &rPropertyName, sal_Bool bFullPropName = sal_False ); static const uno::Sequence< OUString > & GetPropertyNames(); - BOOL LoadOptions( const uno::Sequence< OUString > &rProperyNames ); - BOOL SaveOptions( const uno::Sequence< OUString > &rProperyNames ); + sal_Bool LoadOptions( const uno::Sequence< OUString > &rProperyNames ); + sal_Bool SaveOptions( const uno::Sequence< OUString > &rProperyNames ); public: SvtLinguConfigItem(); @@ -193,18 +195,18 @@ public: com::sun::star::uno::Any GetProperty( const rtl::OUString &rPropertyName ) const; com::sun::star::uno::Any - GetProperty( INT32 nPropertyHandle ) const; + GetProperty( sal_Int32 nPropertyHandle ) const; - BOOL SetProperty( const rtl::OUString &rPropertyName, + sal_Bool SetProperty( const rtl::OUString &rPropertyName, const com::sun::star::uno::Any &rValue ); - BOOL SetProperty( INT32 nPropertyHandle, + sal_Bool SetProperty( sal_Int32 nPropertyHandle, const com::sun::star::uno::Any &rValue ); - BOOL GetOptions( SvtLinguOptions &rOptions ) const; - BOOL SetOptions( const SvtLinguOptions &rOptions ); + sal_Bool GetOptions( SvtLinguOptions &rOptions ) const; + sal_Bool SetOptions( const SvtLinguOptions &rOptions ); - BOOL IsReadOnly( const rtl::OUString &rPropertyName ) const; - BOOL IsReadOnly( INT32 nPropertyHandle ) const; + sal_Bool IsReadOnly( const rtl::OUString &rPropertyName ) const; + sal_Bool IsReadOnly( sal_Int32 nPropertyHandle ) const; }; @@ -242,7 +244,7 @@ static struct NamesToHdl { const char *pFullPropName; // full qualified name as used in configuration const char *pPropName; // property name only (atom) of above - INT32 nHdl; // numeric handle representing the property + sal_Int32 nHdl; // numeric handle representing the property }aNamesToHdl[] = { {/* 0 */ "General/DefaultLocale", UPN_DEFAULT_LOCALE, UPH_DEFAULT_LOCALE}, @@ -294,16 +296,16 @@ const uno::Sequence< OUString > & SvtLinguConfigItem::GetPropertyNames() if (!bInitialized) { - INT32 nMax = SAL_N_ELEMENTS(aNamesToHdl); + sal_Int32 nMax = SAL_N_ELEMENTS(aNamesToHdl); aNames.realloc( nMax ); OUString *pNames = aNames.getArray(); - INT32 nIdx = 0; - for (INT32 i = 0; i < nMax; ++i) + sal_Int32 nIdx = 0; + for (sal_Int32 i = 0; i < nMax; ++i) { const sal_Char *pFullPropName = aNamesToHdl[i].pFullPropName; if (pFullPropName) - pNames[ nIdx++ ] = A2OU( pFullPropName ); + pNames[ nIdx++ ] = ::rtl::OUString::createFromAscii( pFullPropName ); } aNames.realloc( nIdx ); bInitialized = sal_True; @@ -312,8 +314,8 @@ const uno::Sequence< OUString > & SvtLinguConfigItem::GetPropertyNames() } -BOOL SvtLinguConfigItem::GetHdlByName( - INT32 &rnHdl, +sal_Bool SvtLinguConfigItem::GetHdlByName( + sal_Int32 &rnHdl, const OUString &rPropertyName, sal_Bool bFullPropName ) { @@ -352,20 +354,20 @@ uno::Any SvtLinguConfigItem::GetProperty( const OUString &rPropertyName ) const { osl::MutexGuard aGuard( GetOwnMutex() ); - INT32 nHdl; + sal_Int32 nHdl; return GetHdlByName( nHdl, rPropertyName ) ? GetProperty( nHdl ) : uno::Any(); } -uno::Any SvtLinguConfigItem::GetProperty( INT32 nPropertyHandle ) const +uno::Any SvtLinguConfigItem::GetProperty( sal_Int32 nPropertyHandle ) const { osl::MutexGuard aGuard( GetOwnMutex() ); uno::Any aRes; - const INT16 *pnVal = 0; - const BOOL *pbVal = 0; - const INT32 *pnInt32Val = 0; + const sal_Int16 *pnVal = 0; + const sal_Bool *pbVal = 0; + const sal_Int32 *pnInt32Val = 0; const SvtLinguOptions &rOpt = const_cast< SvtLinguConfigItem * >(this)->aOpt; switch (nPropertyHandle) @@ -440,31 +442,31 @@ uno::Any SvtLinguConfigItem::GetProperty( INT32 nPropertyHandle ) const } -BOOL SvtLinguConfigItem::SetProperty( const OUString &rPropertyName, const uno::Any &rValue ) +sal_Bool SvtLinguConfigItem::SetProperty( const OUString &rPropertyName, const uno::Any &rValue ) { osl::MutexGuard aGuard( GetOwnMutex() ); - BOOL bSucc = FALSE; - INT32 nHdl; + sal_Bool bSucc = sal_False; + sal_Int32 nHdl; if (GetHdlByName( nHdl, rPropertyName )) bSucc = SetProperty( nHdl, rValue ); return bSucc; } -BOOL SvtLinguConfigItem::SetProperty( INT32 nPropertyHandle, const uno::Any &rValue ) +sal_Bool SvtLinguConfigItem::SetProperty( sal_Int32 nPropertyHandle, const uno::Any &rValue ) { osl::MutexGuard aGuard( GetOwnMutex() ); - BOOL bSucc = FALSE; + sal_Bool bSucc = sal_False; if (!rValue.hasValue()) return bSucc; - BOOL bMod = FALSE; + sal_Bool bMod = sal_False; - INT16 *pnVal = 0; - BOOL *pbVal = 0; - INT32 *pnInt32Val = 0; + sal_Int16 *pnVal = 0; + sal_Bool *pbVal = 0; + sal_Int32 *pnInt32Val = 0; SvtLinguOptions &rOpt = aOpt; switch (nPropertyHandle) @@ -486,13 +488,13 @@ BOOL SvtLinguConfigItem::SetProperty( INT32 nPropertyHandle, const uno::Any &rVa case UPH_ACTIVE_DICTIONARIES : { rValue >>= rOpt.aActiveDics; - bMod = TRUE; + bMod = sal_True; break; } case UPH_ACTIVE_CONVERSION_DICTIONARIES : { rValue >>= rOpt.aActiveConvDics; - bMod = TRUE; + bMod = sal_True; break; } case UPH_DEFAULT_LOCALE : @@ -532,41 +534,41 @@ BOOL SvtLinguConfigItem::SetProperty( INT32 nPropertyHandle, const uno::Any &rVa if (pbVal) { - BOOL bNew = BOOL(); + sal_Bool bNew = sal_Bool(); if (rValue >>= bNew) { if (bNew != *pbVal) { *pbVal = bNew; - bMod = TRUE; + bMod = sal_True; } - bSucc = TRUE; + bSucc = sal_True; } } else if (pnVal) { - INT16 nNew = INT16(); + sal_Int16 nNew = sal_Int16(); if (rValue >>= nNew) { if (nNew != *pnVal) { *pnVal = nNew; - bMod = TRUE; + bMod = sal_True; } - bSucc = TRUE; + bSucc = sal_True; } } else if (pnInt32Val) { - INT32 nNew = INT32(); + sal_Int32 nNew = sal_Int32(); if (rValue >>= nNew) { if (nNew != *pnInt32Val) { *pnInt32Val = nNew; - bMod = TRUE; + bMod = sal_True; } - bSucc = TRUE; + bSucc = sal_True; } } @@ -578,34 +580,34 @@ BOOL SvtLinguConfigItem::SetProperty( INT32 nPropertyHandle, const uno::Any &rVa } -BOOL SvtLinguConfigItem::GetOptions( SvtLinguOptions &rOptions ) const +sal_Bool SvtLinguConfigItem::GetOptions( SvtLinguOptions &rOptions ) const { osl::MutexGuard aGuard( GetOwnMutex() ); rOptions = aOpt; - return TRUE; + return sal_True; } -BOOL SvtLinguConfigItem::SetOptions( const SvtLinguOptions &rOptions ) +sal_Bool SvtLinguConfigItem::SetOptions( const SvtLinguOptions &rOptions ) { osl::MutexGuard aGuard( GetOwnMutex() ); aOpt = rOptions; SetModified(); NotifyListeners(0); - return TRUE; + return sal_True; } -BOOL SvtLinguConfigItem::LoadOptions( const uno::Sequence< OUString > &rProperyNames ) +sal_Bool SvtLinguConfigItem::LoadOptions( const uno::Sequence< OUString > &rProperyNames ) { osl::MutexGuard aGuard( GetOwnMutex() ); - BOOL bRes = FALSE; + sal_Bool bRes = sal_False; const OUString *pProperyNames = rProperyNames.getConstArray(); - INT32 nProps = rProperyNames.getLength(); + sal_Int32 nProps = rProperyNames.getLength(); const uno::Sequence< uno::Any > aValues = GetProperties( rProperyNames ); const uno::Sequence< sal_Bool > aROStates = GetReadOnlyStates( rProperyNames ); @@ -616,10 +618,10 @@ BOOL SvtLinguConfigItem::LoadOptions( const uno::Sequence< OUString > &rProperyN const uno::Any *pValue = aValues.getConstArray(); const sal_Bool *pROStates = aROStates.getConstArray(); - for (INT32 i = 0; i < nProps; ++i) + for (sal_Int32 i = 0; i < nProps; ++i) { const uno::Any &rVal = pValue[i]; - INT32 nPropertyHandle; + sal_Int32 nPropertyHandle; GetHdlByName( nPropertyHandle, pProperyNames[i], sal_True ); switch ( nPropertyHandle ) { @@ -680,11 +682,11 @@ BOOL SvtLinguConfigItem::LoadOptions( const uno::Sequence< OUString > &rProperyN || rOpt.nDefaultLanguage_CJK == LANGUAGE_CHINESE_MACAU || rOpt.nDefaultLanguage_CJK == LANGUAGE_CHINESE_TRADITIONAL ) { - rOpt.bIsDirectionToSimplified = FALSE; + rOpt.bIsDirectionToSimplified = sal_False; } else { - rOpt.bIsDirectionToSimplified = TRUE; + rOpt.bIsDirectionToSimplified = sal_True; } } } break; @@ -710,7 +712,7 @@ BOOL SvtLinguConfigItem::LoadOptions( const uno::Sequence< OUString > &rProperyN } } - bRes = TRUE; + bRes = sal_True; } DBG_ASSERT( bRes, "LoadOptions failed" ); @@ -718,19 +720,19 @@ BOOL SvtLinguConfigItem::LoadOptions( const uno::Sequence< OUString > &rProperyN } -BOOL SvtLinguConfigItem::SaveOptions( const uno::Sequence< OUString > &rProperyNames ) +sal_Bool SvtLinguConfigItem::SaveOptions( const uno::Sequence< OUString > &rProperyNames ) { if (!IsModified()) - return TRUE; + return sal_True; osl::MutexGuard aGuard( GetOwnMutex() ); - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; const uno::Type &rBOOL = ::getBooleanCppuType(); - const uno::Type &rINT16 = ::getCppuType( (INT16 *) NULL ); - const uno::Type &rINT32 = ::getCppuType( (INT32 *) NULL ); + const uno::Type &rINT16 = ::getCppuType( (sal_Int16 *) NULL ); + const uno::Type &rINT32 = ::getCppuType( (sal_Int32 *) NULL ); - INT32 nProps = rProperyNames.getLength(); + sal_Int32 nProps = rProperyNames.getLength(); uno::Sequence< uno::Any > aValues( nProps ); uno::Any *pValue = aValues.getArray(); @@ -786,22 +788,22 @@ BOOL SvtLinguConfigItem::SaveOptions( const uno::Sequence< OUString > &rProperyN return bRet; } -BOOL SvtLinguConfigItem::IsReadOnly( const rtl::OUString &rPropertyName ) const +sal_Bool SvtLinguConfigItem::IsReadOnly( const rtl::OUString &rPropertyName ) const { osl::MutexGuard aGuard( GetOwnMutex() ); - BOOL bReadOnly = FALSE; - INT32 nHdl; + sal_Bool bReadOnly = sal_False; + sal_Int32 nHdl; if (GetHdlByName( nHdl, rPropertyName )) bReadOnly = IsReadOnly( nHdl ); return bReadOnly; } -BOOL SvtLinguConfigItem::IsReadOnly( INT32 nPropertyHandle ) const +sal_Bool SvtLinguConfigItem::IsReadOnly( sal_Int32 nPropertyHandle ) const { osl::MutexGuard aGuard( GetOwnMutex() ); - BOOL bReadOnly = FALSE; + sal_Bool bReadOnly = sal_False; const SvtLinguOptions &rOpt = const_cast< SvtLinguConfigItem * >(this)->aOpt; switch(nPropertyHandle) @@ -917,47 +919,47 @@ uno::Any SvtLinguConfig::GetProperty( const OUString &rPropertyName ) const } -uno::Any SvtLinguConfig::GetProperty( INT32 nPropertyHandle ) const +uno::Any SvtLinguConfig::GetProperty( sal_Int32 nPropertyHandle ) const { return GetConfigItem().GetProperty( nPropertyHandle ); } -BOOL SvtLinguConfig::SetProperty( const OUString &rPropertyName, const uno::Any &rValue ) +sal_Bool SvtLinguConfig::SetProperty( const OUString &rPropertyName, const uno::Any &rValue ) { return GetConfigItem().SetProperty( rPropertyName, rValue ); } -BOOL SvtLinguConfig::SetProperty( INT32 nPropertyHandle, const uno::Any &rValue ) +sal_Bool SvtLinguConfig::SetProperty( sal_Int32 nPropertyHandle, const uno::Any &rValue ) { return GetConfigItem().SetProperty( nPropertyHandle, rValue ); } -BOOL SvtLinguConfig::GetOptions( SvtLinguOptions &rOptions ) const +sal_Bool SvtLinguConfig::GetOptions( SvtLinguOptions &rOptions ) const { return GetConfigItem().GetOptions( rOptions ); } -BOOL SvtLinguConfig::SetOptions( const SvtLinguOptions &rOptions ) +sal_Bool SvtLinguConfig::SetOptions( const SvtLinguOptions &rOptions ) { return GetConfigItem().SetOptions( rOptions ); } -BOOL SvtLinguConfig::IsReadOnly( const rtl::OUString &rPropertyName ) const +sal_Bool SvtLinguConfig::IsReadOnly( const rtl::OUString &rPropertyName ) const { return GetConfigItem().IsReadOnly( rPropertyName ); } -BOOL SvtLinguConfig::IsReadOnly( INT32 nPropertyHandle ) const +sal_Bool SvtLinguConfig::IsReadOnly( sal_Int32 nPropertyHandle ) const { return GetConfigItem().IsReadOnly( nPropertyHandle ); } -BOOL SvtLinguConfig::GetElementNamesFor( +sal_Bool SvtLinguConfig::GetElementNamesFor( const rtl::OUString &rNodeName, uno::Sequence< rtl::OUString > &rElementNames ) const { @@ -998,7 +1000,7 @@ static uno::Reference< container::XNameAccess > GetOrCreateSetEntry_Impl( return xResult; } -BOOL SvtLinguConfig::GetSupportedDictionaryFormatsFor( +sal_Bool SvtLinguConfig::GetSupportedDictionaryFormatsFor( const rtl::OUString &rSetName, const rtl::OUString &rSetEntry, uno::Sequence< rtl::OUString > &rFormatList ) const @@ -1115,7 +1117,7 @@ static bool lcl_GetFileUrlFromOrigin( } -BOOL SvtLinguConfig::GetDictionaryEntry( +sal_Bool SvtLinguConfig::GetDictionaryEntry( const rtl::OUString &rNodeName, SvtLinguConfigDictionaryEntry &rDicEntry ) const { @@ -1364,13 +1366,13 @@ rtl::OUString SvtLinguConfig::GetVendorImageUrl_Impl( rtl::OUString SvtLinguConfig::GetSpellAndGrammarDialogImage( - const rtl::OUString &rServiceImplName, - bool bHighContrast ) const + const rtl::OUString &rServiceImplName +) const { rtl::OUString aRes; if (rServiceImplName.getLength() > 0) { - rtl::OUString aImageName( A2OU( bHighContrast ? "SpellAndGrammarDialogImage_HC" : "SpellAndGrammarDialogImage" )); + rtl::OUString aImageName( A2OU( "SpellAndGrammarDialogImage" )); rtl::OUString aPath( GetVendorImageUrl_Impl( rServiceImplName, aImageName ) ); aRes = aPath; } @@ -1379,13 +1381,13 @@ rtl::OUString SvtLinguConfig::GetSpellAndGrammarDialogImage( rtl::OUString SvtLinguConfig::GetSpellAndGrammarContextSuggestionImage( - const rtl::OUString &rServiceImplName, - bool bHighContrast ) const + const rtl::OUString &rServiceImplName +) const { rtl::OUString aRes; if (rServiceImplName.getLength() > 0) { - rtl::OUString aImageName( A2OU( bHighContrast ? "SpellAndGrammarContextMenuSuggestionImage_HC" : "SpellAndGrammarContextMenuSuggestionImage" )); + rtl::OUString aImageName( A2OU( "SpellAndGrammarContextMenuSuggestionImage" )); rtl::OUString aPath( GetVendorImageUrl_Impl( rServiceImplName, aImageName ) ); aRes = aPath; } @@ -1394,13 +1396,13 @@ rtl::OUString SvtLinguConfig::GetSpellAndGrammarContextSuggestionImage( rtl::OUString SvtLinguConfig::GetSpellAndGrammarContextDictionaryImage( - const rtl::OUString &rServiceImplName, - bool bHighContrast ) const + const rtl::OUString &rServiceImplName +) const { rtl::OUString aRes; if (rServiceImplName.getLength() > 0) { - rtl::OUString aImageName( A2OU( bHighContrast ? "SpellAndGrammarContextMenuDictionaryImage_HC" : "SpellAndGrammarContextMenuDictionaryImage" )); + rtl::OUString aImageName( A2OU( "SpellAndGrammarContextMenuDictionaryImage" )); rtl::OUString aPath( GetVendorImageUrl_Impl( rServiceImplName, aImageName ) ); aRes = aPath; } @@ -1409,13 +1411,13 @@ rtl::OUString SvtLinguConfig::GetSpellAndGrammarContextDictionaryImage( ::rtl::OUString SvtLinguConfig::GetThesaurusDialogImage( - const ::rtl::OUString &rServiceImplName, - bool bHighContrast ) const + const ::rtl::OUString &rServiceImplName +) const { rtl::OUString aRes; if (rServiceImplName.getLength() > 0) { - rtl::OUString aImageName( A2OU( bHighContrast ? "ThesaurusDialogImage_HC" : "ThesaurusDialogImage" )); + rtl::OUString aImageName( A2OU( "ThesaurusDialogImage" )); rtl::OUString aPath( GetVendorImageUrl_Impl( rServiceImplName, aImageName ) ); aRes = aPath; } @@ -1424,13 +1426,13 @@ rtl::OUString SvtLinguConfig::GetSpellAndGrammarContextDictionaryImage( ::rtl::OUString SvtLinguConfig::GetSynonymsContextImage( - const ::rtl::OUString &rServiceImplName, - bool bHighContrast ) const + const ::rtl::OUString &rServiceImplName +) const { rtl::OUString aRes; if (rServiceImplName.getLength() > 0) { - rtl::OUString aImageName( A2OU( bHighContrast ? "SynonymsContextMenuImage_HC" : "SynonymsContextMenuImage" )); + rtl::OUString aImageName( A2OU( "SynonymsContextMenuImage" )); rtl::OUString aPath( GetVendorImageUrl_Impl( rServiceImplName, aImageName ) ); aRes = aPath; } diff --git a/unotools/source/config/misccfg.cxx b/unotools/source/config/misccfg.cxx index bb09c47fe887..733818d17132 100644 --- a/unotools/source/config/misccfg.cxx +++ b/unotools/source/config/misccfg.cxx @@ -46,10 +46,9 @@ #define DEF_INCH 2540L #define DEF_RELTWIP 1440L -using namespace rtl; using namespace com::sun::star::uno; -#define C2U(cChar) OUString::createFromAscii(cChar) +using ::rtl::OUString; namespace utl { @@ -59,9 +58,9 @@ static sal_Int32 nRefCount = 0; class SfxMiscCfg : public utl::ConfigItem { - BOOL bPaperSize; // printer warnings - BOOL bPaperOrientation; - BOOL bNotFound; + sal_Bool bPaperSize; // printer warnings + sal_Bool bPaperOrientation; + sal_Bool bNotFound; sal_Int32 nYear2000; // two digit year representation const com::sun::star::uno::Sequence<rtl::OUString>& GetPropertyNames(); @@ -74,14 +73,14 @@ public: virtual void Notify( const com::sun::star::uno::Sequence<rtl::OUString>& aPropertyNames); virtual void Commit(); - BOOL IsNotFoundWarning() const {return bNotFound;} - void SetNotFoundWarning( BOOL bSet); + sal_Bool IsNotFoundWarning() const {return bNotFound;} + void SetNotFoundWarning( sal_Bool bSet); - BOOL IsPaperSizeWarning() const {return bPaperSize;} - void SetPaperSizeWarning(BOOL bSet); + sal_Bool IsPaperSizeWarning() const {return bPaperSize;} + void SetPaperSizeWarning(sal_Bool bSet); - BOOL IsPaperOrientationWarning() const {return bPaperOrientation;} - void SetPaperOrientationWarning( BOOL bSet); + sal_Bool IsPaperOrientationWarning() const {return bPaperOrientation;} + void SetPaperOrientationWarning( sal_Bool bSet); // 0 ... 99 sal_Int32 GetYear2000() const { return nYear2000; } @@ -89,60 +88,42 @@ public: }; -/*-------------------------------------------------------------------- - Beschreibung: - --------------------------------------------------------------------*/ SfxMiscCfg::SfxMiscCfg() : - ConfigItem(C2U("Office.Common") ), - bPaperSize(FALSE), - bPaperOrientation (FALSE), - bNotFound (FALSE), + ConfigItem(OUString(RTL_CONSTASCII_USTRINGPARAM("Office.Common")) ), + bPaperSize(sal_False), + bPaperOrientation (sal_False), + bNotFound (sal_False), nYear2000( 1930 ) { RTL_LOGFILE_CONTEXT(aLog, "svl SfxMiscCfg::SfxMiscCfg()"); Load(); } -/* -----------------------------02.03.01 15:31-------------------------------- - ---------------------------------------------------------------------------*/ SfxMiscCfg::~SfxMiscCfg() { } -/*-------------------------------------------------------------------- - Beschreibung: - --------------------------------------------------------------------*/ -void SfxMiscCfg::SetNotFoundWarning( BOOL bSet) +void SfxMiscCfg::SetNotFoundWarning( sal_Bool bSet) { if(bNotFound != bSet) SetModified(); bNotFound = bSet; } -/*-------------------------------------------------------------------- - Beschreibung: - --------------------------------------------------------------------*/ - -void SfxMiscCfg::SetPaperSizeWarning( BOOL bSet) +void SfxMiscCfg::SetPaperSizeWarning( sal_Bool bSet) { if(bPaperSize != bSet) SetModified(); bPaperSize = bSet; } -/*-------------------------------------------------------------------- - Beschreibung: - --------------------------------------------------------------------*/ -void SfxMiscCfg::SetPaperOrientationWarning( BOOL bSet) +void SfxMiscCfg::SetPaperOrientationWarning( sal_Bool bSet) { if(bPaperOrientation != bSet) SetModified(); bPaperOrientation = bSet; } -/*-------------------------------------------------------------------- - Beschreibung: - --------------------------------------------------------------------*/ void SfxMiscCfg::SetYear2000( sal_Int32 nSet ) { @@ -150,9 +131,7 @@ void SfxMiscCfg::SetYear2000( sal_Int32 nSet ) SetModified(); nYear2000 = nSet; } -/* -----------------------------02.03.01 15:31-------------------------------- - ---------------------------------------------------------------------------*/ const Sequence<OUString>& SfxMiscCfg::GetPropertyNames() { static Sequence<OUString> aNames; @@ -173,9 +152,7 @@ const Sequence<OUString>& SfxMiscCfg::GetPropertyNames() } return aNames; } -/* -----------------------------02.03.01 15:31-------------------------------- - ---------------------------------------------------------------------------*/ void SfxMiscCfg::Load() { const Sequence<OUString>& aNames = GetPropertyNames(); @@ -200,16 +177,12 @@ void SfxMiscCfg::Load() } } } -/* -----------------------------02.03.01 15:31-------------------------------- - ---------------------------------------------------------------------------*/ void SfxMiscCfg::Notify( const com::sun::star::uno::Sequence<rtl::OUString>& ) { Load(); } -/* -----------------------------02.03.01 15:31-------------------------------- - ---------------------------------------------------------------------------*/ void SfxMiscCfg::Commit() { const Sequence<OUString>& aNames = GetPropertyNames(); @@ -267,32 +240,32 @@ MiscCfg::~MiscCfg( ) } } -BOOL MiscCfg::IsNotFoundWarning() const +sal_Bool MiscCfg::IsNotFoundWarning() const { return pImpl->IsNotFoundWarning(); } -void MiscCfg::SetNotFoundWarning( BOOL bSet) +void MiscCfg::SetNotFoundWarning( sal_Bool bSet) { pImpl->SetNotFoundWarning( bSet ); } -BOOL MiscCfg::IsPaperSizeWarning() const +sal_Bool MiscCfg::IsPaperSizeWarning() const { return pImpl->IsPaperSizeWarning(); } -void MiscCfg::SetPaperSizeWarning(BOOL bSet) +void MiscCfg::SetPaperSizeWarning(sal_Bool bSet) { pImpl->SetPaperSizeWarning( bSet ); } -BOOL MiscCfg::IsPaperOrientationWarning() const +sal_Bool MiscCfg::IsPaperOrientationWarning() const { return pImpl->IsPaperOrientationWarning(); } -void MiscCfg::SetPaperOrientationWarning( BOOL bSet) +void MiscCfg::SetPaperOrientationWarning( sal_Bool bSet) { pImpl->SetPaperOrientationWarning( bSet ); } diff --git a/unotools/source/config/moduleoptions.cxx b/unotools/source/config/moduleoptions.cxx index 32b1a2d84a90..4edb4fb0968e 100644 --- a/unotools/source/config/moduleoptions.cxx +++ b/unotools/source/config/moduleoptions.cxx @@ -217,7 +217,6 @@ struct FactoryInfo ::rtl::OUString getShortName () const { return sShortName; }; ::rtl::OUString getTemplateFile () const { return sTemplateFile; }; ::rtl::OUString getWindowAttributes () const { return sWindowAttributes; }; - ::rtl::OUString getEmptyDocumentURL () const { return sEmptyDocumentURL; }; ::rtl::OUString getDefaultFilter () const { return sDefaultFilter; }; sal_Bool isDefaultFilterReadonly() const { return bDefaultFilterReadonly; } sal_Int32 getIcon () const { return nIcon; }; @@ -250,24 +249,6 @@ struct FactoryInfo } //--------------------------------------------------------------------------------------------------------- - void setInstalled( sal_Bool bNewInstalled ) - { - bInstalled = bNewInstalled; - }; - - //--------------------------------------------------------------------------------------------------------- - void setFactory( const ::rtl::OUString& sNewFactory ) - { - sFactory = sNewFactory; - }; - - //--------------------------------------------------------------------------------------------------------- - void setShortName( const ::rtl::OUString& sNewShortName ) - { - sShortName = sNewShortName; - }; - - //--------------------------------------------------------------------------------------------------------- void setTemplateFile( const ::rtl::OUString& sNewTemplateFile ) { if( sTemplateFile != sNewTemplateFile ) @@ -288,16 +269,6 @@ struct FactoryInfo }; //--------------------------------------------------------------------------------------------------------- - void setEmptyDocumentURL( const ::rtl::OUString& sNewEmptyDocumentURL ) - { - if( sEmptyDocumentURL != sNewEmptyDocumentURL ) - { - sEmptyDocumentURL = sNewEmptyDocumentURL; - bChangedEmptyDocumentURL = sal_True ; - } - }; - - //--------------------------------------------------------------------------------------------------------- void setDefaultFilter( const ::rtl::OUString& sNewDefaultFilter ) { if( sDefaultFilter != sNewDefaultFilter ) @@ -307,16 +278,6 @@ struct FactoryInfo } }; - //--------------------------------------------------------------------------------------------------------- - void setIcon( sal_Int32 nNewIcon ) - { - if( nNewIcon != nNewIcon ) - { - nNewIcon = nNewIcon; - bChangedIcon = sal_True; - } - }; - private: css::uno::Reference< css::util::XStringSubstitution > getStringSubstitution() { @@ -517,7 +478,7 @@ SvtModuleOptions_Impl::~SvtModuleOptions_Impl() *//*-*************************************************************************************************************/ void SvtModuleOptions_Impl::Notify( const css::uno::Sequence< ::rtl::OUString >& ) { - OSL_ENSURE( sal_False, "SvtModuleOptions_Impl::Notify()\nNot implemented yet!\n" ); + OSL_FAIL( "SvtModuleOptions_Impl::Notify()\nNot implemented yet!\n" ); } /*-****************************************************************************************************//** @@ -719,7 +680,7 @@ sal_Bool SvtModuleOptions_Impl::IsModuleInstalled( SvtModuleOptions::EModule eMo case SvtModuleOptions::E_DATABASE : sShortName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdatabase")); break; default: - OSL_ASSERT( "unknown factory" ); + OSL_FAIL( "unknown factory" ); break; } @@ -784,7 +745,7 @@ sal_Bool SvtModuleOptions_Impl::IsModuleInstalled( SvtModuleOptions::EModule eMo case SvtModuleOptions::E_DATABASE : sURL = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("private:factory/sdatabase?Interactive")); break; default: - OSL_ASSERT( "unknown factory" ); + OSL_FAIL( "unknown factory" ); break; } return sURL; @@ -897,7 +858,7 @@ css::uno::Sequence< ::rtl::OUString > SvtModuleOptions_Impl::impl_ExpandSetNames @short helper to classify given factory by name @descr Every factory has his own long and short name. So we can match right enum value for internal using. - @attention We change in/out parameter "eFactory" in every case! But you should use it only, if return value is TRUE! + @attention We change in/out parameter "eFactory" in every case! But you should use it only, if return value is sal_True! Algorithm: Set out-parameter to propably value ... and check the longname. If it match with these factory - break operation and return true AND right set parameter. Otherwise try next one and so on. If no factory was found return false. Out parameter eFactory @@ -1357,18 +1318,18 @@ sal_uInt32 SvtModuleOptions::GetFeatures() const { switch( eModule ) { - case SvtModuleOptions::E_SWRITER : { return ::rtl::OUString::createFromAscii("Writer"); } - case SvtModuleOptions::E_SWEB : { return ::rtl::OUString::createFromAscii("Web"); } - case SvtModuleOptions::E_SGLOBAL : { return ::rtl::OUString::createFromAscii("Global"); } - case SvtModuleOptions::E_SCALC : { return ::rtl::OUString::createFromAscii("Calc"); } - case SvtModuleOptions::E_SDRAW : { return ::rtl::OUString::createFromAscii("Draw"); } - case SvtModuleOptions::E_SIMPRESS : { return ::rtl::OUString::createFromAscii("Impress"); } - case SvtModuleOptions::E_SMATH : { return ::rtl::OUString::createFromAscii("Math"); } - case SvtModuleOptions::E_SCHART : { return ::rtl::OUString::createFromAscii("Chart"); } - case SvtModuleOptions::E_SBASIC : { return ::rtl::OUString::createFromAscii("Basic"); } - case SvtModuleOptions::E_SDATABASE : { return ::rtl::OUString::createFromAscii("Database"); } + case SvtModuleOptions::E_SWRITER : { return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Writer")); } + case SvtModuleOptions::E_SWEB : { return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Web")); } + case SvtModuleOptions::E_SGLOBAL : { return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Global")); } + case SvtModuleOptions::E_SCALC : { return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Calc")); } + case SvtModuleOptions::E_SDRAW : { return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Draw")); } + case SvtModuleOptions::E_SIMPRESS : { return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Impress")); } + case SvtModuleOptions::E_SMATH : { return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Math")); } + case SvtModuleOptions::E_SCHART : { return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Chart")); } + case SvtModuleOptions::E_SBASIC : { return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Basic")); } + case SvtModuleOptions::E_SDATABASE : { return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Database")); } default: - OSL_ASSERT( "unknown module" ); + OSL_FAIL( "unknown module" ); break; } @@ -1379,18 +1340,18 @@ sal_uInt32 SvtModuleOptions::GetFeatures() const { switch( eFactory ) { - case SvtModuleOptions::E_WRITER : { return ::rtl::OUString::createFromAscii("Writer"); } - case SvtModuleOptions::E_WRITERWEB : { return ::rtl::OUString::createFromAscii("Writer"); } - case SvtModuleOptions::E_WRITERGLOBAL : { return ::rtl::OUString::createFromAscii("Writer"); } - case SvtModuleOptions::E_CALC : { return ::rtl::OUString::createFromAscii("Calc"); } - case SvtModuleOptions::E_DRAW : { return ::rtl::OUString::createFromAscii("Draw"); } - case SvtModuleOptions::E_IMPRESS : { return ::rtl::OUString::createFromAscii("Impress"); } - case SvtModuleOptions::E_MATH : { return ::rtl::OUString::createFromAscii("Math"); } - case SvtModuleOptions::E_CHART : { return ::rtl::OUString::createFromAscii("Chart"); } - case SvtModuleOptions::E_BASIC : { return ::rtl::OUString::createFromAscii("Basic"); } - case SvtModuleOptions::E_DATABASE : { return ::rtl::OUString::createFromAscii("Database"); } + case SvtModuleOptions::E_WRITER : { return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Writer")); } + case SvtModuleOptions::E_WRITERWEB : { return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Writer")); } + case SvtModuleOptions::E_WRITERGLOBAL : { return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Writer")); } + case SvtModuleOptions::E_CALC : { return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Calc")); } + case SvtModuleOptions::E_DRAW : { return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Draw")); } + case SvtModuleOptions::E_IMPRESS : { return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Impress")); } + case SvtModuleOptions::E_MATH : { return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Math")); } + case SvtModuleOptions::E_CHART : { return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Chart")); } + case SvtModuleOptions::E_BASIC : { return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Basic")); } + case SvtModuleOptions::E_DATABASE : { return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Database")); } default: - OSL_ASSERT( "unknown factory" ); + OSL_FAIL( "unknown factory" ); break; } @@ -1402,25 +1363,25 @@ sal_uInt32 SvtModuleOptions::GetFeatures() const -----------------------------------------------*/ SvtModuleOptions::EFactory SvtModuleOptions::ClassifyFactoryByShortName(const ::rtl::OUString& sName) { - if (sName.equalsAscii("swriter")) + if (sName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("swriter"))) return E_WRITER; - if (sName.equalsIgnoreAsciiCaseAscii("swriter/Web")) // sometimes they are registerd for swriter/web :-( + if (sName.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("swriter/Web"))) // sometimes they are registerd for swriter/web :-( return E_WRITERWEB; - if (sName.equalsIgnoreAsciiCaseAscii("swriter/GlobalDocument")) // sometimes they are registerd for swriter/globaldocument :-( + if (sName.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("swriter/GlobalDocument"))) // sometimes they are registerd for swriter/globaldocument :-( return E_WRITERGLOBAL; - if (sName.equalsAscii("scalc")) + if (sName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("scalc"))) return E_CALC; - if (sName.equalsAscii("sdraw")) + if (sName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("sdraw"))) return E_DRAW; - if (sName.equalsAscii("simpress")) + if (sName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("simpress"))) return E_IMPRESS; - if (sName.equalsAscii("schart")) + if (sName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("schart"))) return E_CHART; - if (sName.equalsAscii("smath")) + if (sName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("smath"))) return E_MATH; - if (sName.equalsAscii("sbasic")) + if (sName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("sbasic"))) return E_BASIC; - if (sName.equalsAscii("sdatabase")) + if (sName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("sdatabase"))) return E_DATABASE; return E_UNKNOWN_FACTORY; @@ -1468,9 +1429,9 @@ SvtModuleOptions::EFactory SvtModuleOptions::ClassifyFactoryByURL(const ::rtl::O try { xFilterCfg = css::uno::Reference< css::container::XNameAccess >( - xSMGR->createInstance(::rtl::OUString::createFromAscii("com.sun.star.document.FilterFactory")), css::uno::UNO_QUERY); + xSMGR->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.FilterFactory"))), css::uno::UNO_QUERY); xTypeCfg = css::uno::Reference< css::container::XNameAccess >( - xSMGR->createInstance(::rtl::OUString::createFromAscii("com.sun.star.document.TypeDetection")), css::uno::UNO_QUERY); + xSMGR->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.TypeDetection"))), css::uno::UNO_QUERY); } catch(const css::uno::RuntimeException&) { throw; } @@ -1480,13 +1441,13 @@ SvtModuleOptions::EFactory SvtModuleOptions::ClassifyFactoryByURL(const ::rtl::O ::comphelper::SequenceAsHashMap stlDesc(lMediaDescriptor); // is there already a filter inside the descriptor? - ::rtl::OUString sFilterName = stlDesc.getUnpackedValueOrDefault(::rtl::OUString::createFromAscii("FilterName"), ::rtl::OUString()); + ::rtl::OUString sFilterName = stlDesc.getUnpackedValueOrDefault(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FilterName")), ::rtl::OUString()); if (sFilterName.getLength()) { try { ::comphelper::SequenceAsHashMap stlFilterProps (xFilterCfg->getByName(sFilterName)); - ::rtl::OUString sDocumentService = stlFilterProps.getUnpackedValueOrDefault(::rtl::OUString::createFromAscii("DocumentService"), ::rtl::OUString()); + ::rtl::OUString sDocumentService = stlFilterProps.getUnpackedValueOrDefault(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DocumentService")), ::rtl::OUString()); SvtModuleOptions::EFactory eApp = SvtModuleOptions::ClassifyFactoryByServiceName(sDocumentService); if (eApp != E_UNKNOWN_FACTORY) @@ -1499,7 +1460,7 @@ SvtModuleOptions::EFactory SvtModuleOptions::ClassifyFactoryByURL(const ::rtl::O } // is there already a type inside the descriptor? - ::rtl::OUString sTypeName = stlDesc.getUnpackedValueOrDefault(::rtl::OUString::createFromAscii("TypeName"), ::rtl::OUString()); + ::rtl::OUString sTypeName = stlDesc.getUnpackedValueOrDefault(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TypeName")), ::rtl::OUString()); if (!sTypeName.getLength()) { // no :-( @@ -1516,9 +1477,9 @@ SvtModuleOptions::EFactory SvtModuleOptions::ClassifyFactoryByURL(const ::rtl::O try { ::comphelper::SequenceAsHashMap stlTypeProps (xTypeCfg->getByName(sTypeName)); - ::rtl::OUString sPreferredFilter = stlTypeProps.getUnpackedValueOrDefault(::rtl::OUString::createFromAscii("PreferredFilter"), ::rtl::OUString()); + ::rtl::OUString sPreferredFilter = stlTypeProps.getUnpackedValueOrDefault(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PreferredFilter")), ::rtl::OUString()); ::comphelper::SequenceAsHashMap stlFilterProps (xFilterCfg->getByName(sPreferredFilter)); - ::rtl::OUString sDocumentService = stlFilterProps.getUnpackedValueOrDefault(::rtl::OUString::createFromAscii("DocumentService"), ::rtl::OUString()); + ::rtl::OUString sDocumentService = stlFilterProps.getUnpackedValueOrDefault(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DocumentService")), ::rtl::OUString()); SvtModuleOptions::EFactory eApp = SvtModuleOptions::ClassifyFactoryByServiceName(sDocumentService); if (eApp != E_UNKNOWN_FACTORY) diff --git a/unotools/source/config/options.cxx b/unotools/source/config/options.cxx index e8b5ad40bebd..5eee90dd28d9 100644 --- a/unotools/source/config/options.cxx +++ b/unotools/source/config/options.cxx @@ -30,14 +30,8 @@ #include "precompiled_unotools.hxx" #include "sal/config.h" -#include <tools/list.hxx> #include <unotools/options.hxx> -namespace utl -{ - DECLARE_LIST( IMPL_ConfigurationListenerList, ConfigurationListener* ) -} - using utl::detail::Options; using utl::ConfigurationBroadcaster; @@ -57,13 +51,22 @@ void ConfigurationBroadcaster::AddListener( utl::ConfigurationListener* pListene { if ( !mpList ) mpList = new IMPL_ConfigurationListenerList; - mpList->Insert( pListener ); + mpList->push_back( pListener ); } void ConfigurationBroadcaster::RemoveListener( utl::ConfigurationListener* pListener ) { - if ( mpList ) - mpList->Remove( pListener ); + if ( mpList ) { + for ( IMPL_ConfigurationListenerList::iterator it = mpList->begin(); + it < mpList->end(); + ++it + ) { + if ( *it == pListener ) { + mpList->erase( it ); + break; + } + } + } } void ConfigurationBroadcaster::NotifyListeners( sal_uInt32 nHint ) @@ -74,9 +77,11 @@ void ConfigurationBroadcaster::NotifyListeners( sal_uInt32 nHint ) { nHint |= m_nBlockedHint; m_nBlockedHint = 0; - if ( mpList ) - for ( sal_uInt32 n=0; n<mpList->Count(); n++ ) - mpList->GetObject(n)->ConfigurationChanged( this, nHint ); + if ( mpList ) { + for ( size_t n = 0; n < mpList->size(); n++ ) { + (*mpList)[ n ]->ConfigurationChanged( this, nHint ); + } + } } } diff --git a/unotools/source/config/optionsdlg.cxx b/unotools/source/config/optionsdlg.cxx index c922b1f2353b..c8a12c088804 100644 --- a/unotools/source/config/optionsdlg.cxx +++ b/unotools/source/config/optionsdlg.cxx @@ -38,14 +38,15 @@ #include <osl/mutex.hxx> #include <comphelper/stl_types.hxx> -#include <hash_map> +#include <boost/unordered_map.hpp> #include "itemholder1.hxx" using namespace utl; -using namespace rtl; using namespace com::sun::star::beans ; using namespace com::sun::star::uno; +using ::rtl::OUString; + #define CFG_FILENAME OUString( RTL_CONSTASCII_USTRINGPARAM( "Office.OptionsDialog" ) ) #define ROOT_NODE OUString( RTL_CONSTASCII_USTRINGPARAM( "OptionsDialogGroups" ) ) #define PAGES_NODE OUString( RTL_CONSTASCII_USTRINGPARAM( "Pages" ) ) @@ -66,7 +67,7 @@ private: } }; - typedef std::hash_map< OUString, sal_Bool, OUStringHashCode, ::std::equal_to< OUString > > OptionNodeList; + typedef boost::unordered_map< OUString, sal_Bool, OUStringHashCode, ::std::equal_to< OUString > > OptionNodeList; OUString m_sPathDelimiter; OptionNodeList m_aOptionNodeList; diff --git a/unotools/source/config/pathoptions.cxx b/unotools/source/config/pathoptions.cxx index 8c850a805372..8356064172c1 100644 --- a/unotools/source/config/pathoptions.cxx +++ b/unotools/source/config/pathoptions.cxx @@ -44,27 +44,32 @@ #include <unotools/ucbhelper.hxx> #include <comphelper/processfactory.hxx> +#include <comphelper/componentcontext.hxx> #include <com/sun/star/beans/XFastPropertySet.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/beans/XPropertySetInfo.hpp> #include <com/sun/star/util/XStringSubstitution.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/util/XMacroExpander.hpp> #include <rtl/instance.hxx> #include <itemholder1.hxx> #include <vector> -#include <hash_map> +#include <boost/unordered_map.hpp> using namespace osl; using namespace utl; -using namespace rtl; using namespace com::sun::star::uno; using namespace com::sun::star::beans; using namespace com::sun::star::util; using namespace com::sun::star::lang; +using ::rtl::OUString; +using ::rtl::OString; +using ::rtl::OStringToOUString; + // define ---------------------------------------------------------------- #define SEARCHPATH_DELIMITER ';' @@ -106,19 +111,19 @@ enum VarNameProperty VAR_NEEDS_FILEURL }; -class NameToHandleMap : public ::std::hash_map< ::rtl::OUString, sal_Int32, OUStringHashCode, ::std::equal_to< ::rtl::OUString > > +class NameToHandleMap : public ::boost::unordered_map< ::rtl::OUString, sal_Int32, OUStringHashCode, ::std::equal_to< ::rtl::OUString > > { public: inline void free() { NameToHandleMap().swap( *this ); } }; -class EnumToHandleMap : public ::std::hash_map< sal_Int32, sal_Int32, std::hash< sal_Int32 >, std::equal_to< sal_Int32 > > +class EnumToHandleMap : public ::boost::unordered_map< sal_Int32, sal_Int32, boost::hash< sal_Int32 >, std::equal_to< sal_Int32 > > { public: inline void free() { EnumToHandleMap().swap( *this ); } }; -class VarNameToEnumMap : public ::std::hash_map< OUString, VarNameProperty, OUStringHashCode, ::std::equal_to< OUString > > +class VarNameToEnumMap : public ::boost::unordered_map< OUString, VarNameProperty, OUStringHashCode, ::std::equal_to< OUString > > { public: inline void free() { VarNameToEnumMap().swap( *this ); } @@ -133,6 +138,7 @@ class SvtPathOptions_Impl std::vector< String > m_aPathArray; Reference< XFastPropertySet > m_xPathSettings; Reference< XStringSubstitution > m_xSubstVariables; + Reference< XMacroExpander > m_xMacroExpander; mutable EnumToHandleMap m_aMapEnumToPropHandle; VarNameToEnumMap m_aMapVarNamesToEnum; @@ -195,13 +201,13 @@ class SvtPathOptions_Impl void SetUserConfigPath( const String& rPath ) { SetPath( SvtPathOptions::PATH_USERCONFIG, rPath ); } void SetWorkPath( const String& rPath ) { SetPath( SvtPathOptions::PATH_WORK, rPath ); } - rtl::OUString SubstVar( const rtl::OUString& rVar ); - rtl::OUString SubstituteAndConvert( const rtl::OUString& rPath ); - rtl::OUString UsePathVariables( const rtl::OUString& rPath ); + rtl::OUString SubstVar( const rtl::OUString& rVar ) const; + rtl::OUString ExpandMacros( const rtl::OUString& rPath ) const; + rtl::OUString UsePathVariables( const rtl::OUString& rPath ) const; ::com::sun::star::lang::Locale GetLocale() const { return m_aLocale; } - BOOL IsPathReadonly(SvtPathOptions::Pathes ePath)const; + sal_Bool IsPathReadonly(SvtPathOptions::Pathes ePath)const; }; // global ---------------------------------------------------------------- @@ -299,10 +305,10 @@ const String& SvtPathOptions_Impl::GetPath( SvtPathOptions::Pathes ePath ) return m_aEmptyString; } // ----------------------------------------------------------------------- -BOOL SvtPathOptions_Impl::IsPathReadonly(SvtPathOptions::Pathes ePath)const +sal_Bool SvtPathOptions_Impl::IsPathReadonly(SvtPathOptions::Pathes ePath)const { ::osl::MutexGuard aGuard( m_aMutex ); - BOOL bReadonly = FALSE; + sal_Bool bReadonly = sal_False; if ( ePath < SvtPathOptions::PATH_COUNT ) { Reference<XPropertySet> xPrSet(m_xPathSettings, UNO_QUERY); @@ -360,29 +366,35 @@ void SvtPathOptions_Impl::SetPath( SvtPathOptions::Pathes ePath, const String& r } } -// ----------------------------------------------------------------------- +//------------------------------------------------------------------------- -OUString SvtPathOptions_Impl::SubstituteAndConvert( const rtl::OUString& rPath ) +OUString SvtPathOptions_Impl::ExpandMacros( const rtl::OUString& rPath ) const { - return SubstVar( rPath ); + ::rtl::OUString sExpanded( rPath ); + + const INetURLObject aParser( rPath ); + if ( aParser.GetProtocol() == INET_PROT_VND_SUN_STAR_EXPAND ) + sExpanded = m_xMacroExpander->expandMacros( aParser.GetURLPath( INetURLObject::DECODE_WITH_CHARSET ) ); + + return sExpanded; } //------------------------------------------------------------------------- -OUString SvtPathOptions_Impl::UsePathVariables( const OUString& rPath ) +OUString SvtPathOptions_Impl::UsePathVariables( const OUString& rPath ) const { return m_xSubstVariables->reSubstituteVariables( rPath ); } // ----------------------------------------------------------------------- -OUString SvtPathOptions_Impl::SubstVar( const OUString& rVar ) +OUString SvtPathOptions_Impl::SubstVar( const OUString& rVar ) const { // Don't work at parameter-string directly. Copy it. OUString aWorkText = rVar; // Convert the returned path to system path! - BOOL bConvertLocal = FALSE; + sal_Bool bConvertLocal = sal_False; // Search for first occure of "$(...". sal_Int32 nPosition = aWorkText.indexOf( SIGN_STARTVARIABLE ); // = first position of "$(" in string @@ -409,7 +421,7 @@ OUString SvtPathOptions_Impl::SubstVar( const OUString& rVar ) // Look for special variable that needs a system path. VarNameToEnumMap::const_iterator pIter = m_aMapVarNamesToEnum.find( aSubString ); if ( pIter != m_aMapVarNamesToEnum.end() ) - bConvertLocal = TRUE; + bConvertLocal = sal_True; nPosition += nLength; @@ -465,24 +477,15 @@ SvtPathOptions_Impl::SvtPathOptions_Impl() : if ( !m_xPathSettings.is() ) { // #112719#: check for existance - DBG_ERROR( "SvtPathOptions_Impl::SvtPathOptions_Impl(): #112719# happened again!" ); + OSL_FAIL( "SvtPathOptions_Impl::SvtPathOptions_Impl(): #112719# happened again!" ); throw RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Service com.sun.star.util.PathSettings cannot be created" )), Reference< XInterface >() ); } - m_xSubstVariables = Reference< XStringSubstitution >( xSMgr->createInstance( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.util.PathSubstitution" ))), - UNO_QUERY ); - if ( !m_xSubstVariables.is() ) - { - // #112719#: check for existance - DBG_ERROR( "SvtPathOptions_Impl::SvtPathOptions_Impl(): #112719# happened again!" ); - throw RuntimeException( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Service com.sun.star.util.PathSubstitution cannot be created" )), - Reference< XInterface >() ); - } + ::comphelper::ComponentContext aContext( xSMgr ); + m_xSubstVariables.set( aContext.createComponent( "com.sun.star.util.PathSubstitution" ), UNO_QUERY_THROW ); + m_xMacroExpander.set( aContext.getSingleton( "com.sun.star.util.theMacroExpander" ), UNO_QUERY_THROW ); // Create temporary hash map to have a mapping between property names and property handles Reference< XPropertySet > xPropertySet = Reference< XPropertySet >( m_xPathSettings, UNO_QUERY ); @@ -893,13 +896,22 @@ void SvtPathOptions::SetWorkPath( const String& rPath ) // ----------------------------------------------------------------------- -String SvtPathOptions::SubstituteVariable( const String& rVar ) +String SvtPathOptions::SubstituteVariable( const String& rVar ) const { - String aRet = pImp->SubstituteAndConvert( rVar ); + String aRet = pImp->SubstVar( rVar ); return aRet; } -String SvtPathOptions::UseVariable( const String& rPath ) +// ----------------------------------------------------------------------- + +String SvtPathOptions::ExpandMacros( const String& rPath ) const +{ + return pImp->ExpandMacros( rPath ); +} + +// ----------------------------------------------------------------------- + +String SvtPathOptions::UseVariable( const String& rPath ) const { String aRet = pImp->UsePathVariables( rPath ); return aRet; @@ -970,7 +982,7 @@ sal_Bool SvtPathOptions::SearchFile( String& rIniFile, Pathes ePath ) case PATH_TEMPLATE: aPath = GetTemplatePath(); break; case PATH_WORK: aPath = GetWorkPath(); break; case PATH_UICONFIG: aPath = GetUIConfigPath(); break; - case PATH_FINGERPRINT: aPath = GetFingerprintPath(); break; + case PATH_FINGERPRINT: aPath = GetFingerprintPath(); break; case PATH_USERCONFIG:/*-Wall???*/ break; case PATH_COUNT: /*-Wall???*/ break; } @@ -978,16 +990,27 @@ sal_Bool SvtPathOptions::SearchFile( String& rIniFile, Pathes ePath ) sal_uInt16 j, nIdx = 0, nTokenCount = aPath.GetTokenCount( SEARCHPATH_DELIMITER ); for ( j = 0; j < nTokenCount; ++j ) { - BOOL bIsURL = TRUE; + sal_Bool bIsURL = sal_True; String aPathToken = aPath.GetToken( 0, SEARCHPATH_DELIMITER, nIdx ); INetURLObject aObj( aPathToken ); if ( aObj.HasError() ) { - bIsURL = FALSE; + bIsURL = sal_False; String aURL; if ( LocalFileHelper::ConvertPhysicalNameToURL( aPathToken, aURL ) ) aObj.SetURL( aURL ); } + if ( aObj.GetProtocol() == INET_PROT_VND_SUN_STAR_EXPAND ) + { + ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); + Reference< XMacroExpander > xMacroExpander( aContext.getSingleton( "com.sun.star.util.theMacroExpander" ), UNO_QUERY ); + OSL_ENSURE( xMacroExpander.is(), "SvtPathOptions::SearchFile: unable to access the MacroExpander singleton!" ); + if ( xMacroExpander.is() ) + { + const ::rtl::OUString sExpandedPath = xMacroExpander->expandMacros( aObj.GetURLPath( INetURLObject::DECODE_WITH_CHARSET ) ); + aObj.SetURL( sExpandedPath ); + } + } xub_StrLen i, nCount = aIniFile.GetTokenCount( '/' ); for ( i = 0; i < nCount; ++i ) @@ -1017,7 +1040,7 @@ sal_Bool SvtPathOptions::SearchFile( String& rIniFile, Pathes ePath ) return pImp->GetLocale(); } // ----------------------------------------------------------------------- -BOOL SvtPathOptions::IsPathReadonly(Pathes ePath)const +sal_Bool SvtPathOptions::IsPathReadonly(Pathes ePath)const { return pImp->IsPathReadonly(ePath); } @@ -1032,52 +1055,4 @@ void SvtPathOptions::SetPath( SvtPathOptions::Pathes ePath, const String& rNewPa pImp->SetPath(ePath, rNewPath); } -// class PathService ----------------------------------------------------- -#include <com/sun/star/frame/XConfigManager.hpp> -#include <com/sun/star/lang/XServiceInfo.hpp> -#include <cppuhelper/implbase2.hxx> - -class PathService : public ::cppu::WeakImplHelper2< ::com::sun::star::frame::XConfigManager, ::com::sun::star::lang::XServiceInfo > -{ - virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL - getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL substituteVariables( const ::rtl::OUString& sText ) throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& sKeyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& sKeyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL flush( ) throw(::com::sun::star::uno::RuntimeException); -}; - -// class PathService ----------------------------------------------------- - -void SAL_CALL PathService::addPropertyChangeListener( const ::rtl::OUString&, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& ) throw(::com::sun::star::uno::RuntimeException) {} -void SAL_CALL PathService::removePropertyChangeListener( const ::rtl::OUString&, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& ) throw(::com::sun::star::uno::RuntimeException) {} -void SAL_CALL PathService::flush( ) throw(::com::sun::star::uno::RuntimeException) {} - -::rtl::OUString SAL_CALL PathService::substituteVariables( const ::rtl::OUString& sText ) throw(::com::sun::star::uno::RuntimeException) -{ - return SvtPathOptions().SubstituteVariable( sText ); -} - -::rtl::OUString SAL_CALL PathService::getImplementationName( ) throw(::com::sun::star::uno::RuntimeException) -{ - return OUString::createFromAscii("com.sun.star.comp.unotools.PathService"); -} - -sal_Bool SAL_CALL PathService::supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException) -{ - if ( ServiceName.compareToAscii("com.sun.star.config.SpecialConfigManager") == COMPARE_EQUAL ) - return sal_True; - else - return sal_False; -} - -::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL PathService::getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException) -{ - Sequence< OUString > aRet(1); - *aRet.getArray() = OUString::createFromAscii("com.sun.star.config.SpecialConfigManager"); - return aRet; -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/unotools/source/config/regoptions.cxx b/unotools/source/config/regoptions.cxx index f102285ccf16..fcd4c767ef8a 100644 --- a/unotools/source/config/regoptions.cxx +++ b/unotools/source/config/regoptions.cxx @@ -79,9 +79,9 @@ namespace utl if ( bValid ) { Date aDate; - aDate.SetDay ( (USHORT)_rStringRep.copy( 0, 2 ).toInt32( ) ); - aDate.SetMonth ( (USHORT)_rStringRep.copy( 3, 2 ).toInt32( ) ); - aDate.SetYear ( (USHORT)_rStringRep.copy( 6, 4 ).toInt32( ) ); + aDate.SetDay ( (sal_uInt16)_rStringRep.copy( 0, 2 ).toInt32( ) ); + aDate.SetMonth ( (sal_uInt16)_rStringRep.copy( 3, 2 ).toInt32( ) ); + aDate.SetYear ( (sal_uInt16)_rStringRep.copy( 6, 4 ).toInt32( ) ); nDateIntRep = aDate.GetDate(); } } @@ -139,7 +139,7 @@ namespace utl #define DECLARE_STATIC_LAZY_USTRING( name ) \ static const ::rtl::OUString& lcl_get##name##Name() \ { \ - static const ::rtl::OUString sName = ::rtl::OUString::createFromAscii( #name ); \ + static const ::rtl::OUString sName(RTL_CONSTASCII_USTRINGPARAM( #name )); \ return sName; \ } @@ -259,13 +259,13 @@ namespace utl // create the config node for all our registration information m_aRegistrationNode = OConfigurationTreeRoot::createWithServiceFactory( ::comphelper::getProcessServiceFactory(), - ::rtl::OUString::createFromAscii( "/org.openoffice.Office.Common/Help/Registration" ) + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.Office.Common/Help/Registration")) ); // cache some data //the URL to use for online registration ::rtl::OUString sStringValue; - m_aRegistrationNode.getNodeValue( ::rtl::OUString::createFromAscii( "URL" ) ) >>= sStringValue; + m_aRegistrationNode.getNodeValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("URL")) ) >>= sStringValue; m_sRegistrationURL = sStringValue; // the state of the dialog diff --git a/unotools/source/config/saveopt.cxx b/unotools/source/config/saveopt.cxx index 5a812fece4f0..754c65d63ccf 100644 --- a/unotools/source/config/saveopt.cxx +++ b/unotools/source/config/saveopt.cxx @@ -44,8 +44,10 @@ #include "itemholder1.hxx" using namespace utl; -using namespace rtl; using namespace com::sun::star::uno; + +using ::rtl::OUString; + namespace css = ::com::sun::star; class SvtSaveOptions_Impl; @@ -105,16 +107,16 @@ public: virtual void Commit(); sal_Int32 GetAutoSaveTime() const { return nAutoSaveTime; } - BOOL IsUseUserData() const { return bUseUserData; } - BOOL IsBackup() const { return bBackup; } - BOOL IsAutoSave() const { return bAutoSave; } - BOOL IsAutoSavePrompt() const { return bAutoSavePrompt; } - BOOL IsDocInfoSave() const { return bDocInfSave; } - BOOL IsSaveWorkingSet() const { return bSaveWorkingSet; } - BOOL IsSaveDocView() const { return bSaveDocView; } - BOOL IsSaveRelINet() const { return bSaveRelINet; } - BOOL IsSaveRelFSys() const { return bSaveRelFSys; } - BOOL IsSaveUnpacked() const { return bSaveUnpacked; } + sal_Bool IsUseUserData() const { return bUseUserData; } + sal_Bool IsBackup() const { return bBackup; } + sal_Bool IsAutoSave() const { return bAutoSave; } + sal_Bool IsAutoSavePrompt() const { return bAutoSavePrompt; } + sal_Bool IsDocInfoSave() const { return bDocInfSave; } + sal_Bool IsSaveWorkingSet() const { return bSaveWorkingSet; } + sal_Bool IsSaveDocView() const { return bSaveDocView; } + sal_Bool IsSaveRelINet() const { return bSaveRelINet; } + sal_Bool IsSaveRelFSys() const { return bSaveRelFSys; } + sal_Bool IsSaveUnpacked() const { return bSaveUnpacked; } sal_Bool IsPrettyPrintingEnabled( ) const { return bDoPrettyPrinting; } sal_Bool IsWarnAlienFormat() const { return bWarnAlienFormat; } sal_Bool IsLoadDocPrinter() const { return bLoadDocPrinter; } @@ -122,16 +124,16 @@ public: GetODFDefaultVersion() const { return eODFDefaultVersion; } void SetAutoSaveTime( sal_Int32 n ); - void SetUseUserData( BOOL b ); - void SetBackup( BOOL b ); - void SetAutoSave( BOOL b ); - void SetAutoSavePrompt( BOOL b ); - void SetDocInfoSave( BOOL b ); - void SetSaveWorkingSet( BOOL b ); - void SetSaveDocView( BOOL b ); - void SetSaveRelINet( BOOL b ); - void SetSaveRelFSys( BOOL b ); - void SetSaveUnpacked( BOOL b ); + void SetUseUserData( sal_Bool b ); + void SetBackup( sal_Bool b ); + void SetAutoSave( sal_Bool b ); + void SetAutoSavePrompt( sal_Bool b ); + void SetDocInfoSave( sal_Bool b ); + void SetSaveWorkingSet( sal_Bool b ); + void SetSaveDocView( sal_Bool b ); + void SetSaveRelINet( sal_Bool b ); + void SetSaveRelFSys( sal_Bool b ); + void SetSaveUnpacked( sal_Bool b ); void EnablePrettyPrinting( sal_Bool _bDoPP ); void SetWarnAlienFormat( sal_Bool _bDoPP ); void SetLoadDocPrinter( sal_Bool bNew ); @@ -150,7 +152,7 @@ void SvtSaveOptions_Impl::SetAutoSaveTime( sal_Int32 n ) } } -void SvtSaveOptions_Impl::SetUseUserData( BOOL b ) +void SvtSaveOptions_Impl::SetUseUserData( sal_Bool b ) { if (!bROUseUserData && bUseUserData!=b) { @@ -159,7 +161,7 @@ void SvtSaveOptions_Impl::SetUseUserData( BOOL b ) } } -void SvtSaveOptions_Impl::SetBackup( BOOL b ) +void SvtSaveOptions_Impl::SetBackup( sal_Bool b ) { if (!bROBackup && bBackup!=b) { @@ -168,7 +170,7 @@ void SvtSaveOptions_Impl::SetBackup( BOOL b ) } } -void SvtSaveOptions_Impl::SetAutoSave( BOOL b ) +void SvtSaveOptions_Impl::SetAutoSave( sal_Bool b ) { if (!bROAutoSave && bAutoSave!=b) { @@ -178,7 +180,7 @@ void SvtSaveOptions_Impl::SetAutoSave( BOOL b ) } } -void SvtSaveOptions_Impl::SetAutoSavePrompt( BOOL b ) +void SvtSaveOptions_Impl::SetAutoSavePrompt( sal_Bool b ) { if (!bROAutoSavePrompt && bAutoSavePrompt!=b) { @@ -187,7 +189,7 @@ void SvtSaveOptions_Impl::SetAutoSavePrompt( BOOL b ) } } -void SvtSaveOptions_Impl::SetDocInfoSave(BOOL b) +void SvtSaveOptions_Impl::SetDocInfoSave(sal_Bool b) { if (!bRODocInfSave && bDocInfSave!=b) { @@ -196,7 +198,7 @@ void SvtSaveOptions_Impl::SetDocInfoSave(BOOL b) } } -void SvtSaveOptions_Impl::SetSaveWorkingSet( BOOL b ) +void SvtSaveOptions_Impl::SetSaveWorkingSet( sal_Bool b ) { if (!bROSaveWorkingSet && bSaveWorkingSet!=b) { @@ -205,7 +207,7 @@ void SvtSaveOptions_Impl::SetSaveWorkingSet( BOOL b ) } } -void SvtSaveOptions_Impl::SetSaveDocView( BOOL b ) +void SvtSaveOptions_Impl::SetSaveDocView( sal_Bool b ) { if (!bROSaveDocView && bSaveDocView!=b) { @@ -214,7 +216,7 @@ void SvtSaveOptions_Impl::SetSaveDocView( BOOL b ) } } -void SvtSaveOptions_Impl::SetSaveRelINet( BOOL b ) +void SvtSaveOptions_Impl::SetSaveRelINet( sal_Bool b ) { if (!bROSaveRelINet && bSaveRelINet!=b) { @@ -223,7 +225,7 @@ void SvtSaveOptions_Impl::SetSaveRelINet( BOOL b ) } } -void SvtSaveOptions_Impl::SetSaveRelFSys( BOOL b ) +void SvtSaveOptions_Impl::SetSaveRelFSys( sal_Bool b ) { if (!bROSaveRelFSys && bSaveRelFSys!=b) { @@ -232,7 +234,7 @@ void SvtSaveOptions_Impl::SetSaveRelFSys( BOOL b ) } } -void SvtSaveOptions_Impl::SetSaveUnpacked( BOOL b ) +void SvtSaveOptions_Impl::SetSaveUnpacked( sal_Bool b ) { if (!bROSaveUnpacked && bSaveUnpacked!=b) { @@ -382,7 +384,7 @@ Sequence< OUString > GetPropertyNames() // ----------------------------------------------------------------------- SvtSaveOptions_Impl::SvtSaveOptions_Impl() - : ConfigItem( OUString::createFromAscii("Office.Common/Save") ) + : ConfigItem( OUString(RTL_CONSTASCII_USTRINGPARAM("Office.Common/Save")) ) , nAutoSaveTime( 0 ) , bUseUserData( sal_False ) , bBackup( sal_False ) @@ -440,7 +442,7 @@ SvtSaveOptions_Impl::SvtSaveOptions_Impl() if ( pValues[nProp] >>= nTemp ) nAutoSaveTime = nTemp; else { - DBG_ERROR( "Wrong Type!" ); + OSL_FAIL( "Wrong Type!" ); }; bROAutoSaveTime = pROStates[nProp]; break; @@ -531,7 +533,7 @@ SvtSaveOptions_Impl::SvtSaveOptions_Impl() } else { - DBG_ERROR( "Wrong Type!" ); + OSL_FAIL( "Wrong Type!" ); } } } @@ -543,21 +545,21 @@ SvtSaveOptions_Impl::SvtSaveOptions_Impl() { css::uno::Reference< css::uno::XInterface > xCFG = ::comphelper::ConfigurationHelper::openConfig( ::utl::getProcessServiceFactory(), - ::rtl::OUString::createFromAscii("org.openoffice.Office.Recovery"), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Office.Recovery")), ::comphelper::ConfigurationHelper::E_READONLY); ::comphelper::ConfigurationHelper::readRelativeKey( xCFG, - ::rtl::OUString::createFromAscii("AutoSave"), - ::rtl::OUString::createFromAscii("Enabled")) >>= bAutoSave; + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AutoSave")), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Enabled"))) >>= bAutoSave; ::comphelper::ConfigurationHelper::readRelativeKey( xCFG, - ::rtl::OUString::createFromAscii("AutoSave"), - ::rtl::OUString::createFromAscii("TimeIntervall")) >>= nAutoSaveTime; + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AutoSave")), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TimeIntervall"))) >>= nAutoSaveTime; } catch(const css::uno::Exception&) - { DBG_ERROR("Could not find needed informations for AutoSave feature."); } + { OSL_FAIL("Could not find needed informations for AutoSave feature."); } } SvtSaveOptions_Impl::~SvtSaveOptions_Impl() @@ -713,19 +715,19 @@ void SvtSaveOptions_Impl::Commit() css::uno::Reference< css::uno::XInterface > xCFG = ::comphelper::ConfigurationHelper::openConfig( ::utl::getProcessServiceFactory(), - ::rtl::OUString::createFromAscii("org.openoffice.Office.Recovery"), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Office.Recovery")), ::comphelper::ConfigurationHelper::E_STANDARD); ::comphelper::ConfigurationHelper::writeRelativeKey( xCFG, - ::rtl::OUString::createFromAscii("AutoSave"), - ::rtl::OUString::createFromAscii("TimeIntervall"), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AutoSave")), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TimeIntervall")), css::uno::makeAny(nAutoSaveTime)); ::comphelper::ConfigurationHelper::writeRelativeKey( xCFG, - ::rtl::OUString::createFromAscii("AutoSave"), - ::rtl::OUString::createFromAscii("Enabled"), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AutoSave")), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Enabled")), css::uno::makeAny(bAutoSave)); ::comphelper::ConfigurationHelper::flush(xCFG); @@ -757,7 +759,7 @@ public: const sal_Char cUserDefinedSettings[] = "UserDefinedSettings"; SvtLoadOptions_Impl::SvtLoadOptions_Impl() - : ConfigItem( OUString::createFromAscii("Office.Common/Load") ) + : ConfigItem( OUString(RTL_CONSTASCII_USTRINGPARAM("Office.Common/Load")) ) , bLoadUserDefinedSettings( sal_False ) { Sequence< OUString > aNames(1); diff --git a/unotools/source/config/searchopt.cxx b/unotools/source/config/searchopt.cxx index c4cae792c953..800672c3ac95 100644 --- a/unotools/source/config/searchopt.cxx +++ b/unotools/source/config/searchopt.cxx @@ -40,11 +40,12 @@ #include <sal/macros.h> -using namespace rtl; using namespace utl; using namespace com::sun::star::uno; using namespace com::sun::star::i18n; +using ::rtl::OUString; + #define MAX_FLAGS_OFFSET 25 ////////////////////////////////////////////////////////////////////// @@ -52,19 +53,19 @@ using namespace com::sun::star::i18n; class SvtSearchOptions_Impl : public ConfigItem { - INT32 nFlags; - BOOL bModified; + sal_Int32 nFlags; + sal_Bool bModified; // disallow copy-constructor and assignment-operator for now SvtSearchOptions_Impl( const SvtSearchOptions_Impl & ); SvtSearchOptions_Impl & operator = ( const SvtSearchOptions_Impl & ); protected: - BOOL IsModified() const { return bModified; } + sal_Bool IsModified() const { return bModified; } using ConfigItem::SetModified; - void SetModified( BOOL bVal ); - BOOL Load(); - BOOL Save(); + void SetModified( sal_Bool bVal ); + sal_Bool Load(); + sal_Bool Save(); Sequence< OUString > GetPropertyNames() const; @@ -76,19 +77,19 @@ public: virtual void Commit(); virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames ); - BOOL GetFlag( USHORT nOffset ) const; - void SetFlag( USHORT nOffset, BOOL bVal ); + sal_Bool GetFlag( sal_uInt16 nOffset ) const; + void SetFlag( sal_uInt16 nOffset, sal_Bool bVal ); }; SvtSearchOptions_Impl::SvtSearchOptions_Impl() : - ConfigItem( OUString::createFromAscii( "Office.Common/SearchOptions" ) ) + ConfigItem( OUString(RTL_CONSTASCII_USTRINGPARAM("Office.Common/SearchOptions")) ) { RTL_LOGFILE_CONTEXT(aLog, "unotools SvtSearchOptions_Impl::SvtSearchOptions_Impl()"); nFlags = 0x0003FFFF; // set all options values to 'true' Load(); - SetModified( FALSE ); + SetModified( sal_False ); } @@ -109,28 +110,28 @@ void SvtSearchOptions_Impl::Notify( const Sequence< rtl::OUString >& ) } -BOOL SvtSearchOptions_Impl::GetFlag( USHORT nOffset ) const +sal_Bool SvtSearchOptions_Impl::GetFlag( sal_uInt16 nOffset ) const { DBG_ASSERT( nOffset <= MAX_FLAGS_OFFSET, "offset out of range"); - return ((nFlags >> nOffset) & 0x01) ? TRUE : FALSE; + return ((nFlags >> nOffset) & 0x01) ? sal_True : sal_False; } -void SvtSearchOptions_Impl::SetFlag( USHORT nOffset, BOOL bVal ) +void SvtSearchOptions_Impl::SetFlag( sal_uInt16 nOffset, sal_Bool bVal ) { DBG_ASSERT( nOffset <= MAX_FLAGS_OFFSET, "offset out of range"); - INT32 nOldFlags = nFlags; - INT32 nMask = ((INT32) 1) << nOffset; + sal_Int32 nOldFlags = nFlags; + sal_Int32 nMask = ((sal_Int32) 1) << nOffset; if (bVal) nFlags |= nMask; else nFlags &= ~nMask; if (nFlags != nOldFlags) - SetModified( TRUE ); + SetModified( sal_True ); } -void SvtSearchOptions_Impl::SetModified( BOOL bVal ) +void SvtSearchOptions_Impl::SetModified( sal_Bool bVal ) { bModified = bVal; if (bModified) @@ -176,19 +177,19 @@ Sequence< OUString > SvtSearchOptions_Impl::GetPropertyNames() const const int nCount = SAL_N_ELEMENTS( aPropNames ); Sequence< OUString > aNames( nCount ); OUString* pNames = aNames.getArray(); - for (INT32 i = 0; i < nCount; ++i) + for (sal_Int32 i = 0; i < nCount; ++i) pNames[i] = OUString::createFromAscii( aPropNames[i] ); return aNames; } -BOOL SvtSearchOptions_Impl::Load() +sal_Bool SvtSearchOptions_Impl::Load() { - BOOL bSucc = FALSE; + sal_Bool bSucc = sal_False; Sequence< OUString > aNames = GetPropertyNames(); - INT32 nProps = aNames.getLength(); + sal_Int32 nProps = aNames.getLength(); const Sequence< Any > aValues = GetProperties( aNames ); DBG_ASSERT( aValues.getLength() == aNames.getLength(), @@ -197,16 +198,16 @@ BOOL SvtSearchOptions_Impl::Load() if (nProps && aValues.getLength() == nProps) { - bSucc = TRUE; + bSucc = sal_True; const Any* pValues = aValues.getConstArray(); - for (USHORT i = 0; i < nProps; ++i) + for (sal_uInt16 i = 0; i < nProps; ++i) { const Any &rVal = pValues[i]; DBG_ASSERT( rVal.hasValue(), "property value missing" ); if (rVal.hasValue()) { - BOOL bVal = BOOL(); + sal_Bool bVal = sal_Bool(); if (rVal >>= bVal) { if (i <= MAX_FLAGS_OFFSET) @@ -215,19 +216,19 @@ BOOL SvtSearchOptions_Impl::Load() SetFlag( i, bVal ); } else { - DBG_ERROR( "unexpected index" ); + OSL_FAIL( "unexpected index" ); } } else { - DBG_ERROR( "unexpected type" ); - bSucc = FALSE; + OSL_FAIL( "unexpected type" ); + bSucc = sal_False; } } else { - DBG_ERROR( "value missing" ); - bSucc = FALSE; + OSL_FAIL( "value missing" ); + bSucc = sal_False; } } } @@ -237,12 +238,12 @@ BOOL SvtSearchOptions_Impl::Load() } -BOOL SvtSearchOptions_Impl::Save() +sal_Bool SvtSearchOptions_Impl::Save() { - BOOL bSucc = FALSE; + sal_Bool bSucc = sal_False; const Sequence< OUString > aNames = GetPropertyNames(); - INT32 nProps = aNames.getLength(); + sal_Int32 nProps = aNames.getLength(); Sequence< Any > aValues( nProps ); Any *pValue = aValues.getArray(); @@ -251,13 +252,13 @@ BOOL SvtSearchOptions_Impl::Save() "unexpected size of index" ); if (nProps && nProps == MAX_FLAGS_OFFSET + 1) { - for (USHORT i = 0; i < nProps; ++i) - pValue[i] <<= (BOOL) GetFlag(i); + for (sal_uInt16 i = 0; i < nProps; ++i) + pValue[i] <<= (sal_Bool) GetFlag(i); bSucc |= PutProperties( aNames, aValues ); } if (bSucc) - SetModified( FALSE ); + SetModified( sal_False ); return bSucc; } @@ -277,9 +278,9 @@ SvtSearchOptions::~SvtSearchOptions() } -INT32 SvtSearchOptions::GetTransliterationFlags() const +sal_Int32 SvtSearchOptions::GetTransliterationFlags() const { - INT32 nRes = 0; + sal_Int32 nRes = 0; if (!IsMatchCase()) // 'IsMatchCase' means act case sensitive nRes |= TransliterationModules_IGNORE_CASE; @@ -324,312 +325,312 @@ INT32 SvtSearchOptions::GetTransliterationFlags() const } -BOOL SvtSearchOptions::IsWholeWordsOnly() const +sal_Bool SvtSearchOptions::IsWholeWordsOnly() const { return pImpl->GetFlag( 0 ); } -void SvtSearchOptions::SetWholeWordsOnly( BOOL bVal ) +void SvtSearchOptions::SetWholeWordsOnly( sal_Bool bVal ) { pImpl->SetFlag( 0, bVal ); } -BOOL SvtSearchOptions::IsBackwards() const +sal_Bool SvtSearchOptions::IsBackwards() const { return pImpl->GetFlag( 1 ); } -void SvtSearchOptions::SetBackwards( BOOL bVal ) +void SvtSearchOptions::SetBackwards( sal_Bool bVal ) { pImpl->SetFlag( 1, bVal ); } -BOOL SvtSearchOptions::IsUseRegularExpression() const +sal_Bool SvtSearchOptions::IsUseRegularExpression() const { return pImpl->GetFlag( 2 ); } -void SvtSearchOptions::SetUseRegularExpression( BOOL bVal ) +void SvtSearchOptions::SetUseRegularExpression( sal_Bool bVal ) { pImpl->SetFlag( 2, bVal ); } -BOOL SvtSearchOptions::IsSearchForStyles() const +sal_Bool SvtSearchOptions::IsSearchForStyles() const { return pImpl->GetFlag( 3 ); } -void SvtSearchOptions::SetSearchForStyles( BOOL bVal ) +void SvtSearchOptions::SetSearchForStyles( sal_Bool bVal ) { pImpl->SetFlag( 3, bVal ); } -BOOL SvtSearchOptions::IsSimilaritySearch() const +sal_Bool SvtSearchOptions::IsSimilaritySearch() const { return pImpl->GetFlag( 4 ); } -void SvtSearchOptions::SetSimilaritySearch( BOOL bVal ) +void SvtSearchOptions::SetSimilaritySearch( sal_Bool bVal ) { pImpl->SetFlag( 4, bVal ); } -BOOL SvtSearchOptions::IsUseAsianOptions() const +sal_Bool SvtSearchOptions::IsUseAsianOptions() const { return pImpl->GetFlag( 5 ); } -void SvtSearchOptions::SetUseAsianOptions( BOOL bVal ) +void SvtSearchOptions::SetUseAsianOptions( sal_Bool bVal ) { pImpl->SetFlag( 5, bVal ); } -BOOL SvtSearchOptions::IsMatchCase() const +sal_Bool SvtSearchOptions::IsMatchCase() const { return pImpl->GetFlag( 6 ); } -void SvtSearchOptions::SetMatchCase( BOOL bVal ) +void SvtSearchOptions::SetMatchCase( sal_Bool bVal ) { pImpl->SetFlag( 6, bVal ); } -BOOL SvtSearchOptions::IsMatchFullHalfWidthForms() const +sal_Bool SvtSearchOptions::IsMatchFullHalfWidthForms() const { return pImpl->GetFlag( 7 ); } -void SvtSearchOptions::SetMatchFullHalfWidthForms( BOOL bVal ) +void SvtSearchOptions::SetMatchFullHalfWidthForms( sal_Bool bVal ) { pImpl->SetFlag( 7, bVal ); } -BOOL SvtSearchOptions::IsMatchHiraganaKatakana() const +sal_Bool SvtSearchOptions::IsMatchHiraganaKatakana() const { return pImpl->GetFlag( 8 ); } -void SvtSearchOptions::SetMatchHiraganaKatakana( BOOL bVal ) +void SvtSearchOptions::SetMatchHiraganaKatakana( sal_Bool bVal ) { pImpl->SetFlag( 8, bVal ); } -BOOL SvtSearchOptions::IsMatchContractions() const +sal_Bool SvtSearchOptions::IsMatchContractions() const { return pImpl->GetFlag( 9 ); } -void SvtSearchOptions::SetMatchContractions( BOOL bVal ) +void SvtSearchOptions::SetMatchContractions( sal_Bool bVal ) { pImpl->SetFlag( 9, bVal ); } -BOOL SvtSearchOptions::IsMatchMinusDashChoon() const +sal_Bool SvtSearchOptions::IsMatchMinusDashChoon() const { return pImpl->GetFlag( 10 ); } -void SvtSearchOptions::SetMatchMinusDashChoon( BOOL bVal ) +void SvtSearchOptions::SetMatchMinusDashChoon( sal_Bool bVal ) { pImpl->SetFlag( 10, bVal ); } -BOOL SvtSearchOptions::IsMatchRepeatCharMarks() const +sal_Bool SvtSearchOptions::IsMatchRepeatCharMarks() const { return pImpl->GetFlag( 11 ); } -void SvtSearchOptions::SetMatchRepeatCharMarks( BOOL bVal ) +void SvtSearchOptions::SetMatchRepeatCharMarks( sal_Bool bVal ) { pImpl->SetFlag( 11, bVal ); } -BOOL SvtSearchOptions::IsMatchVariantFormKanji() const +sal_Bool SvtSearchOptions::IsMatchVariantFormKanji() const { return pImpl->GetFlag( 12 ); } -void SvtSearchOptions::SetMatchVariantFormKanji( BOOL bVal ) +void SvtSearchOptions::SetMatchVariantFormKanji( sal_Bool bVal ) { pImpl->SetFlag( 12, bVal ); } -BOOL SvtSearchOptions::IsMatchOldKanaForms() const +sal_Bool SvtSearchOptions::IsMatchOldKanaForms() const { return pImpl->GetFlag( 13 ); } -void SvtSearchOptions::SetMatchOldKanaForms( BOOL bVal ) +void SvtSearchOptions::SetMatchOldKanaForms( sal_Bool bVal ) { pImpl->SetFlag( 13, bVal ); } -BOOL SvtSearchOptions::IsMatchDiziDuzu() const +sal_Bool SvtSearchOptions::IsMatchDiziDuzu() const { return pImpl->GetFlag( 14 ); } -void SvtSearchOptions::SetMatchDiziDuzu( BOOL bVal ) +void SvtSearchOptions::SetMatchDiziDuzu( sal_Bool bVal ) { pImpl->SetFlag( 14, bVal ); } -BOOL SvtSearchOptions::IsMatchBavaHafa() const +sal_Bool SvtSearchOptions::IsMatchBavaHafa() const { return pImpl->GetFlag( 15 ); } -void SvtSearchOptions::SetMatchBavaHafa( BOOL bVal ) +void SvtSearchOptions::SetMatchBavaHafa( sal_Bool bVal ) { pImpl->SetFlag( 15, bVal ); } -BOOL SvtSearchOptions::IsMatchTsithichiDhizi() const +sal_Bool SvtSearchOptions::IsMatchTsithichiDhizi() const { return pImpl->GetFlag( 16 ); } -void SvtSearchOptions::SetMatchTsithichiDhizi( BOOL bVal ) +void SvtSearchOptions::SetMatchTsithichiDhizi( sal_Bool bVal ) { pImpl->SetFlag( 16, bVal ); } -BOOL SvtSearchOptions::IsMatchHyuiyuByuvyu() const +sal_Bool SvtSearchOptions::IsMatchHyuiyuByuvyu() const { return pImpl->GetFlag( 17 ); } -void SvtSearchOptions::SetMatchHyuiyuByuvyu( BOOL bVal ) +void SvtSearchOptions::SetMatchHyuiyuByuvyu( sal_Bool bVal ) { pImpl->SetFlag( 17, bVal ); } -BOOL SvtSearchOptions::IsMatchSesheZeje() const +sal_Bool SvtSearchOptions::IsMatchSesheZeje() const { return pImpl->GetFlag( 18 ); } -void SvtSearchOptions::SetMatchSesheZeje( BOOL bVal ) +void SvtSearchOptions::SetMatchSesheZeje( sal_Bool bVal ) { pImpl->SetFlag( 18, bVal ); } -BOOL SvtSearchOptions::IsMatchIaiya() const +sal_Bool SvtSearchOptions::IsMatchIaiya() const { return pImpl->GetFlag( 19 ); } -void SvtSearchOptions::SetMatchIaiya( BOOL bVal ) +void SvtSearchOptions::SetMatchIaiya( sal_Bool bVal ) { pImpl->SetFlag( 19, bVal ); } -BOOL SvtSearchOptions::IsMatchKiku() const +sal_Bool SvtSearchOptions::IsMatchKiku() const { return pImpl->GetFlag( 20 ); } -void SvtSearchOptions::SetMatchKiku( BOOL bVal ) +void SvtSearchOptions::SetMatchKiku( sal_Bool bVal ) { pImpl->SetFlag( 20, bVal ); } -BOOL SvtSearchOptions::IsIgnorePunctuation() const +sal_Bool SvtSearchOptions::IsIgnorePunctuation() const { return pImpl->GetFlag( 21 ); } -void SvtSearchOptions::SetIgnorePunctuation( BOOL bVal ) +void SvtSearchOptions::SetIgnorePunctuation( sal_Bool bVal ) { pImpl->SetFlag( 21, bVal ); } -BOOL SvtSearchOptions::IsIgnoreWhitespace() const +sal_Bool SvtSearchOptions::IsIgnoreWhitespace() const { return pImpl->GetFlag( 22 ); } -void SvtSearchOptions::SetIgnoreWhitespace( BOOL bVal ) +void SvtSearchOptions::SetIgnoreWhitespace( sal_Bool bVal ) { pImpl->SetFlag( 22, bVal ); } -BOOL SvtSearchOptions::IsIgnoreProlongedSoundMark() const +sal_Bool SvtSearchOptions::IsIgnoreProlongedSoundMark() const { return pImpl->GetFlag( 23 ); } -void SvtSearchOptions::SetIgnoreProlongedSoundMark( BOOL bVal ) +void SvtSearchOptions::SetIgnoreProlongedSoundMark( sal_Bool bVal ) { pImpl->SetFlag( 23, bVal ); } -BOOL SvtSearchOptions::IsIgnoreMiddleDot() const +sal_Bool SvtSearchOptions::IsIgnoreMiddleDot() const { return pImpl->GetFlag( 24 ); } -void SvtSearchOptions::SetIgnoreMiddleDot( BOOL bVal ) +void SvtSearchOptions::SetIgnoreMiddleDot( sal_Bool bVal ) { pImpl->SetFlag( 24, bVal ); } -BOOL SvtSearchOptions::IsNotes() const +sal_Bool SvtSearchOptions::IsNotes() const { return pImpl->GetFlag( 25 ); } -void SvtSearchOptions::SetNotes( BOOL bVal ) +void SvtSearchOptions::SetNotes( sal_Bool bVal ) { pImpl->SetFlag( 25, bVal ); } diff --git a/unotools/source/config/sourceviewconfig.cxx b/unotools/source/config/sourceviewconfig.cxx index 270a04702fef..82b71fbceabb 100644 --- a/unotools/source/config/sourceviewconfig.cxx +++ b/unotools/source/config/sourceviewconfig.cxx @@ -38,8 +38,10 @@ #include <itemholder1.hxx> using namespace utl; -using namespace rtl; using namespace com::sun::star::uno; + +using ::rtl::OUString; + namespace utl { class SourceViewConfig_Impl : public utl::ConfigItem @@ -97,25 +99,19 @@ public: SourceViewConfig_Impl* SourceViewConfig::m_pImplConfig = 0; sal_Int32 SourceViewConfig::m_nRefCount = 0; namespace { struct lclMutex : public rtl::Static< ::osl::Mutex, lclMutex > {}; } -/* -----------------------------28.08.2002 16:45------------------------------ - ---------------------------------------------------------------------------*/ SourceViewConfig_Impl::SourceViewConfig_Impl() : - ConfigItem(OUString::createFromAscii("Office.Common/Font/SourceViewFont")), + ConfigItem(OUString(RTL_CONSTASCII_USTRINGPARAM("Office.Common/Font/SourceViewFont"))), m_nFontHeight(12), m_bProportionalFontOnly(sal_False) { Load(); } -/* -----------------------------28.08.2002 16:45------------------------------ - ---------------------------------------------------------------------------*/ SourceViewConfig_Impl::~SourceViewConfig_Impl() { } -/* -----------------------------28.08.2002 16:25------------------------------ - ---------------------------------------------------------------------------*/ Sequence< OUString > SourceViewConfig_Impl::GetPropertyNames() { //this list needs exactly to mach the enum PropertyNameIndex @@ -134,9 +130,6 @@ Sequence< OUString > SourceViewConfig_Impl::GetPropertyNames() return aNames; } -/*-- 28.08.2002 16:37:59--------------------------------------------------- - - -----------------------------------------------------------------------*/ void SourceViewConfig_Impl::Load() { Sequence< OUString > aNames = GetPropertyNames(); @@ -160,16 +153,12 @@ void SourceViewConfig_Impl::Load() } } } -/*-- 28.08.2002 16:38:00--------------------------------------------------- - -----------------------------------------------------------------------*/ void SourceViewConfig_Impl::Notify( const Sequence< OUString >& ) { Load(); } -/*-- 28.08.2002 16:38:00--------------------------------------------------- - -----------------------------------------------------------------------*/ void SourceViewConfig_Impl::Commit() { ClearModified(); @@ -191,9 +180,7 @@ void SourceViewConfig_Impl::Commit() NotifyListeners(0); } -/*-- 28.08.2002 16:32:19--------------------------------------------------- - -----------------------------------------------------------------------*/ SourceViewConfig::SourceViewConfig() { { @@ -209,9 +196,7 @@ SourceViewConfig::SourceViewConfig() m_pImplConfig->AddListener( this ); } -/*-- 28.08.2002 16:32:19--------------------------------------------------- - -----------------------------------------------------------------------*/ SourceViewConfig::~SourceViewConfig() { m_pImplConfig->RemoveListener( this ); @@ -223,44 +208,32 @@ SourceViewConfig::~SourceViewConfig() DELETEZ( m_pImplConfig ); } } -/*-- 28.08.2002 16:32:19--------------------------------------------------- - -----------------------------------------------------------------------*/ const OUString& SourceViewConfig::GetFontName() const { return m_pImplConfig->GetFontName(); } -/*-- 28.08.2002 16:32:20--------------------------------------------------- - -----------------------------------------------------------------------*/ void SourceViewConfig::SetFontName(const OUString& rName) { m_pImplConfig->SetFontName(rName); } -/*-- 28.08.2002 16:32:20--------------------------------------------------- - -----------------------------------------------------------------------*/ sal_Int16 SourceViewConfig::GetFontHeight() const { return m_pImplConfig->GetFontHeight(); } -/*-- 28.08.2002 16:32:20--------------------------------------------------- - -----------------------------------------------------------------------*/ void SourceViewConfig::SetFontHeight(sal_Int16 nHeight) { m_pImplConfig->SetFontHeight(nHeight); } -/*-- 28.08.2002 16:32:20--------------------------------------------------- - -----------------------------------------------------------------------*/ sal_Bool SourceViewConfig::IsShowProportionalFontsOnly() const { return m_pImplConfig->IsShowProportionalFontsOnly(); } -/*-- 28.08.2002 16:32:20--------------------------------------------------- - -----------------------------------------------------------------------*/ void SourceViewConfig::SetShowProportionalFontsOnly(sal_Bool bSet) { m_pImplConfig->SetShowProportionalFontsOnly(bSet); diff --git a/unotools/source/config/syslocaleoptions.cxx b/unotools/source/config/syslocaleoptions.cxx index d16576be8fee..2b6f4f2cdc1b 100644 --- a/unotools/source/config/syslocaleoptions.cxx +++ b/unotools/source/config/syslocaleoptions.cxx @@ -47,10 +47,10 @@ using namespace osl; using namespace utl; -using namespace rtl; using namespace com::sun::star::uno; using namespace com::sun::star::lang; +using ::rtl::OUString; SvtSysLocaleOptions_Impl* SvtSysLocaleOptions::pOptions = NULL; sal_Int32 SvtSysLocaleOptions::nRefCount = 0; @@ -89,7 +89,7 @@ class SvtSysLocaleOptions_Impl : public utl::ConfigItem OUString m_aLocaleString; // en-US or de-DE or empty for SYSTEM OUString m_aUILocaleString; // en-US or de-DE or empty for SYSTEM OUString m_aCurrencyString; // USD-en-US or EUR-de-DE - ULONG m_nBlockedHint; // pending hints + sal_uLong m_nBlockedHint; // pending hints sal_Bool m_bDecimalSeparator; //use decimal separator same as locale sal_Bool m_bROLocale; @@ -387,7 +387,7 @@ void SvtSysLocaleOptions_Impl::SetLocaleString( const OUString& rStr ) MakeRealLocale(); MsLangId::setConfiguredSystemLanguage( m_eRealLanguage ); SetModified(); - ULONG nHint = SYSLOCALEOPTIONS_HINT_LOCALE; + sal_uLong nHint = SYSLOCALEOPTIONS_HINT_LOCALE; if ( !m_aCurrencyString.getLength() ) nHint |= SYSLOCALEOPTIONS_HINT_CURRENCY; NotifyListeners( nHint ); @@ -431,7 +431,7 @@ void SvtSysLocaleOptions_Impl::SetDecimalSeparatorAsLocale( sal_Bool bSet) void SvtSysLocaleOptions_Impl::Notify( const Sequence< rtl::OUString >& seqPropertyNames ) { - ULONG nHint = 0; + sal_uLong nHint = 0; Sequence< Any > seqValues = GetProperties( seqPropertyNames ); Sequence< sal_Bool > seqROStates = GetReadOnlyStates( seqPropertyNames ); sal_Int32 nCount = seqPropertyNames.getLength(); @@ -578,19 +578,12 @@ void SvtSysLocaleOptions::SetCurrencyConfigString( const OUString& rStr ) pOptions->SetCurrencyString( rStr ); } - - -/*-- 11.02.2004 13:31:41--------------------------------------------------- - - -----------------------------------------------------------------------*/ sal_Bool SvtSysLocaleOptions::IsDecimalSeparatorAsLocale() const { MutexGuard aGuard( GetMutex() ); return pOptions->IsDecimalSeparatorAsLocale(); } -/*-- 11.02.2004 13:31:41--------------------------------------------------- - -----------------------------------------------------------------------*/ void SvtSysLocaleOptions::SetDecimalSeparatorAsLocale( sal_Bool bSet) { MutexGuard aGuard( GetMutex() ); diff --git a/unotools/source/config/undoopt.cxx b/unotools/source/config/undoopt.cxx index f7e985c71318..36c1c2308ec5 100644 --- a/unotools/source/config/undoopt.cxx +++ b/unotools/source/config/undoopt.cxx @@ -42,8 +42,8 @@ #include "itemholder1.hxx" using namespace utl; -using namespace rtl; using namespace com::sun::star::uno; +using ::rtl::OUString; static SvtUndoOptions_Impl* pOptions = NULL; static sal_Int32 nRefCount = 0; @@ -69,7 +69,7 @@ public: // ----------------------------------------------------------------------- SvtUndoOptions_Impl::SvtUndoOptions_Impl() - : ConfigItem( OUString::createFromAscii("Office.Common/Undo") ) + : ConfigItem( OUString(RTL_CONSTASCII_USTRINGPARAM("Office.Common/Undo")) ) , nUndoCount( 20 ) { Load(); @@ -132,13 +132,13 @@ void SvtUndoOptions_Impl::Load() nUndoCount = nTemp; else { - DBG_ERROR( "Wrong Type!" ); + OSL_FAIL( "Wrong Type!" ); } break; } default: - DBG_ERROR( "Wrong Type!" ); + OSL_FAIL( "Wrong Type!" ); break; } } diff --git a/unotools/source/config/useroptions.cxx b/unotools/source/config/useroptions.cxx index 57f23586e6e7..ee88691535a2 100644 --- a/unotools/source/config/useroptions.cxx +++ b/unotools/source/config/useroptions.cxx @@ -55,9 +55,9 @@ #include <unotools/loghelper.hxx> using namespace utl; -using namespace rtl; using namespace com::sun::star; using namespace com::sun::star::uno; +using ::rtl::OUString; namespace css = ::com::sun::star; @@ -128,8 +128,8 @@ public: void SetFathersName( const ::rtl::OUString& rNewToken ); void SetApartment( const ::rtl::OUString& rNewToken ); - sal_Bool IsTokenReadonly( USHORT nToken ) const; - ::rtl::OUString GetToken(USHORT nToken) const; + sal_Bool IsTokenReadonly( sal_uInt16 nToken ) const; + ::rtl::OUString GetToken(sal_uInt16 nToken) const; void Notify(); private: @@ -146,30 +146,21 @@ static sal_Int32 nRefCount = 0; #define READONLY_DEFAULT sal_False -/*-- 16.06.2009 14:22:56--------------------------------------------------- - - -----------------------------------------------------------------------*/ SvtUserConfigChangeListener_Impl::SvtUserConfigChangeListener_Impl(SvtUserOptions_Impl& rParent) : m_rParent( rParent ) { } -/*-- 16.06.2009 14:22:56--------------------------------------------------- - -----------------------------------------------------------------------*/ SvtUserConfigChangeListener_Impl::~SvtUserConfigChangeListener_Impl() { } -/*-- 16.06.2009 14:22:56--------------------------------------------------- - -----------------------------------------------------------------------*/ void SvtUserConfigChangeListener_Impl::changesOccurred( const util::ChangesEvent& rEvent ) throw(RuntimeException) { if(rEvent.Changes.getLength()) m_rParent.Notify(); } -/*-- 16.06.2009 14:22:56--------------------------------------------------- - -----------------------------------------------------------------------*/ void SvtUserConfigChangeListener_Impl::disposing( const lang::EventObject& rSource ) throw(RuntimeException) { try @@ -235,7 +226,8 @@ SvtUserOptions_Impl::~SvtUserOptions_Impl() try { - m_xData->getPropertyValue(s_so) >>= sCompany; + if (m_xData.is()) + m_xData->getPropertyValue(s_so) >>= sCompany; } catch ( const css::uno::Exception& ex ) { @@ -251,7 +243,8 @@ SvtUserOptions_Impl::~SvtUserOptions_Impl() try { - m_xData->getPropertyValue(s_sgivenname) >>= sFirstName; + if (m_xData.is()) + m_xData->getPropertyValue(s_sgivenname) >>= sFirstName; } catch ( const css::uno::Exception& ex ) { @@ -267,7 +260,8 @@ SvtUserOptions_Impl::~SvtUserOptions_Impl() try { - m_xData->getPropertyValue(s_ssn) >>= sLastName; + if (m_xData.is()) + m_xData->getPropertyValue(s_ssn) >>= sLastName; } catch ( const css::uno::Exception& ex ) { @@ -283,7 +277,8 @@ SvtUserOptions_Impl::~SvtUserOptions_Impl() try { - m_xData->getPropertyValue(s_sinitials) >>= sID; + if (m_xData.is()) + m_xData->getPropertyValue(s_sinitials) >>= sID; } catch ( const css::uno::Exception& ex ) { @@ -299,7 +294,8 @@ SvtUserOptions_Impl::~SvtUserOptions_Impl() try { - m_xData->getPropertyValue(s_sstreet) >>= sStreet; + if (m_xData.is()) + m_xData->getPropertyValue(s_sstreet) >>= sStreet; } catch ( const css::uno::Exception& ex ) { @@ -315,7 +311,8 @@ SvtUserOptions_Impl::~SvtUserOptions_Impl() try { - m_xData->getPropertyValue(s_sl) >>= sCity; + if (m_xData.is()) + m_xData->getPropertyValue(s_sl) >>= sCity; } catch ( const css::uno::Exception& ex ) { @@ -331,7 +328,8 @@ SvtUserOptions_Impl::~SvtUserOptions_Impl() try { - m_xData->getPropertyValue(s_sst) >>= sState; + if (m_xData.is()) + m_xData->getPropertyValue(s_sst) >>= sState; } catch ( const css::uno::Exception& ex ) { @@ -347,7 +345,8 @@ SvtUserOptions_Impl::~SvtUserOptions_Impl() try { - m_xData->getPropertyValue(s_spostalcode) >>= sZip; + if (m_xData.is()) + m_xData->getPropertyValue(s_spostalcode) >>= sZip; } catch ( const css::uno::Exception& ex ) { @@ -363,7 +362,8 @@ SvtUserOptions_Impl::~SvtUserOptions_Impl() try { - m_xData->getPropertyValue(s_sc) >>= sCountry; + if (m_xData.is()) + m_xData->getPropertyValue(s_sc) >>= sCountry; } catch ( const css::uno::Exception& ex ) { @@ -379,7 +379,8 @@ SvtUserOptions_Impl::~SvtUserOptions_Impl() try { - m_xData->getPropertyValue(s_sposition) >>= sPosition; + if (m_xData.is()) + m_xData->getPropertyValue(s_sposition) >>= sPosition; } catch ( const css::uno::Exception& ex ) { @@ -395,7 +396,8 @@ SvtUserOptions_Impl::~SvtUserOptions_Impl() try { - m_xData->getPropertyValue(s_stitle) >>= sTitle; + if (m_xData.is()) + m_xData->getPropertyValue(s_stitle) >>= sTitle; } catch ( const css::uno::Exception& ex ) { @@ -411,7 +413,8 @@ SvtUserOptions_Impl::~SvtUserOptions_Impl() try { - m_xData->getPropertyValue(s_shomephone) >>= sTelephoneHome; + if (m_xData.is()) + m_xData->getPropertyValue(s_shomephone) >>= sTelephoneHome; } catch ( const css::uno::Exception& ex ) { @@ -427,7 +430,8 @@ SvtUserOptions_Impl::~SvtUserOptions_Impl() try { - m_xData->getPropertyValue(s_stelephonenumber) >>= sTelephoneWork; + if (m_xData.is()) + m_xData->getPropertyValue(s_stelephonenumber) >>= sTelephoneWork; } catch ( const css::uno::Exception& ex ) { @@ -443,7 +447,8 @@ SvtUserOptions_Impl::~SvtUserOptions_Impl() try { - m_xData->getPropertyValue(s_sfacsimiletelephonenumber) >>= sFax; + if (m_xData.is()) + m_xData->getPropertyValue(s_sfacsimiletelephonenumber) >>= sFax; } catch ( const css::uno::Exception& ex ) { @@ -459,7 +464,8 @@ SvtUserOptions_Impl::~SvtUserOptions_Impl() try { - m_xData->getPropertyValue(s_smail) >>= sEmail; + if (m_xData.is()) + m_xData->getPropertyValue(s_smail) >>= sEmail; } catch ( const css::uno::Exception& ex ) { @@ -475,7 +481,8 @@ SvtUserOptions_Impl::~SvtUserOptions_Impl() try { - m_xData->getPropertyValue(s_scustomernumber) >>= sCustomerNumber; + if (m_xData.is()) + m_xData->getPropertyValue(s_scustomernumber) >>= sCustomerNumber; } catch ( const css::uno::Exception& ex ) { @@ -491,7 +498,8 @@ SvtUserOptions_Impl::~SvtUserOptions_Impl() try { - m_xData->getPropertyValue(s_sfathersname) >>= sFathersName; + if (m_xData.is()) + m_xData->getPropertyValue(s_sfathersname) >>= sFathersName; } catch ( const css::uno::Exception& ex ) { @@ -507,7 +515,8 @@ SvtUserOptions_Impl::~SvtUserOptions_Impl() try { - m_xData->getPropertyValue(s_sapartment) >>= sApartment; + if (m_xData.is()) + m_xData->getPropertyValue(s_sapartment) >>= sApartment; } catch ( const css::uno::Exception& ex ) { @@ -521,7 +530,8 @@ void SvtUserOptions_Impl::SetCompany( const ::rtl::OUString& sCompany ) { try { - m_xData->setPropertyValue(s_so, css::uno::makeAny(::rtl::OUString(sCompany))); + if (m_xData.is()) + m_xData->setPropertyValue(s_so, css::uno::makeAny(::rtl::OUString(sCompany))); ::comphelper::ConfigurationHelper::flush(m_xCfg); } catch ( const css::uno::Exception& ex) @@ -534,7 +544,8 @@ void SvtUserOptions_Impl::SetFirstName( const ::rtl::OUString& sFirstName ) { try { - m_xData->setPropertyValue(s_sgivenname, css::uno::makeAny(::rtl::OUString(sFirstName))); + if (m_xData.is()) + m_xData->setPropertyValue(s_sgivenname, css::uno::makeAny(::rtl::OUString(sFirstName))); ::comphelper::ConfigurationHelper::flush(m_xCfg); } catch ( const css::uno::Exception& ex) @@ -547,7 +558,8 @@ void SvtUserOptions_Impl::SetLastName( const ::rtl::OUString& sLastName ) { try { - m_xData->setPropertyValue(s_ssn, css::uno::makeAny(::rtl::OUString(sLastName))); + if (m_xData.is()) + m_xData->setPropertyValue(s_ssn, css::uno::makeAny(::rtl::OUString(sLastName))); ::comphelper::ConfigurationHelper::flush(m_xCfg); } catch ( const css::uno::Exception& ex) @@ -559,7 +571,8 @@ void SvtUserOptions_Impl::SetID( const ::rtl::OUString& sID ) { try { - m_xData->setPropertyValue(s_sinitials, css::uno::makeAny(::rtl::OUString(sID))); + if (m_xData.is()) + m_xData->setPropertyValue(s_sinitials, css::uno::makeAny(::rtl::OUString(sID))); ::comphelper::ConfigurationHelper::flush(m_xCfg); } catch ( const css::uno::Exception& ex) @@ -572,7 +585,8 @@ void SvtUserOptions_Impl::SetStreet( const ::rtl::OUString& sStreet ) { try { - m_xData->setPropertyValue(s_sstreet, css::uno::makeAny(::rtl::OUString(sStreet))); + if (m_xData.is()) + m_xData->setPropertyValue(s_sstreet, css::uno::makeAny(::rtl::OUString(sStreet))); ::comphelper::ConfigurationHelper::flush(m_xCfg); } catch ( const css::uno::Exception& ex) @@ -585,7 +599,8 @@ void SvtUserOptions_Impl::SetCity( const ::rtl::OUString& sCity ) { try { - m_xData->setPropertyValue(s_sl, css::uno::makeAny(::rtl::OUString(sCity))); + if (m_xData.is()) + m_xData->setPropertyValue(s_sl, css::uno::makeAny(::rtl::OUString(sCity))); ::comphelper::ConfigurationHelper::flush(m_xCfg); } catch ( const css::uno::Exception& ex) @@ -598,7 +613,8 @@ void SvtUserOptions_Impl::SetState( const ::rtl::OUString& sState ) { try { - m_xData->setPropertyValue(s_sst, css::uno::makeAny(::rtl::OUString(sState))); + if (m_xData.is()) + m_xData->setPropertyValue(s_sst, css::uno::makeAny(::rtl::OUString(sState))); ::comphelper::ConfigurationHelper::flush(m_xCfg); } catch ( const css::uno::Exception& ex) @@ -611,7 +627,8 @@ void SvtUserOptions_Impl::SetZip( const ::rtl::OUString& sZip ) { try { - m_xData->setPropertyValue(s_spostalcode, css::uno::makeAny(::rtl::OUString(sZip))); + if (m_xData.is()) + m_xData->setPropertyValue(s_spostalcode, css::uno::makeAny(::rtl::OUString(sZip))); ::comphelper::ConfigurationHelper::flush(m_xCfg); } catch ( const css::uno::Exception& ex) @@ -624,7 +641,8 @@ void SvtUserOptions_Impl::SetCountry( const ::rtl::OUString& sCountry ) { try { - m_xData->setPropertyValue(s_sc, css::uno::makeAny(::rtl::OUString(sCountry))); + if (m_xData.is()) + m_xData->setPropertyValue(s_sc, css::uno::makeAny(::rtl::OUString(sCountry))); ::comphelper::ConfigurationHelper::flush(m_xCfg); } catch ( const css::uno::Exception& ex) @@ -637,7 +655,8 @@ void SvtUserOptions_Impl::SetPosition( const ::rtl::OUString& sPosition ) { try { - m_xData->setPropertyValue(s_sposition, css::uno::makeAny(::rtl::OUString(sPosition))); + if (m_xData.is()) + m_xData->setPropertyValue(s_sposition, css::uno::makeAny(::rtl::OUString(sPosition))); ::comphelper::ConfigurationHelper::flush(m_xCfg); } catch ( const css::uno::Exception& ex) @@ -650,7 +669,8 @@ void SvtUserOptions_Impl::SetTitle( const ::rtl::OUString& sTitle ) { try { - m_xData->setPropertyValue(s_stitle, css::uno::makeAny(::rtl::OUString(sTitle))); + if (m_xData.is()) + m_xData->setPropertyValue(s_stitle, css::uno::makeAny(::rtl::OUString(sTitle))); ::comphelper::ConfigurationHelper::flush(m_xCfg); } catch ( const css::uno::Exception& ex) @@ -663,7 +683,8 @@ void SvtUserOptions_Impl::SetTelephoneHome( const ::rtl::OUString& sTelephoneHom { try { - m_xData->setPropertyValue(s_shomephone, css::uno::makeAny(::rtl::OUString(sTelephoneHome))); + if (m_xData.is()) + m_xData->setPropertyValue(s_shomephone, css::uno::makeAny(::rtl::OUString(sTelephoneHome))); ::comphelper::ConfigurationHelper::flush(m_xCfg); } catch ( const css::uno::Exception& ex) @@ -676,7 +697,8 @@ void SvtUserOptions_Impl::SetTelephoneWork( const ::rtl::OUString& sTelephoneWor { try { - m_xData->setPropertyValue(s_stelephonenumber, css::uno::makeAny(::rtl::OUString(sTelephoneWork))); + if (m_xData.is()) + m_xData->setPropertyValue(s_stelephonenumber, css::uno::makeAny(::rtl::OUString(sTelephoneWork))); ::comphelper::ConfigurationHelper::flush(m_xCfg); } catch ( const css::uno::Exception& ex) @@ -689,7 +711,8 @@ void SvtUserOptions_Impl::SetFax( const ::rtl::OUString& sFax ) { try { - m_xData->setPropertyValue(s_sfacsimiletelephonenumber, css::uno::makeAny(::rtl::OUString(sFax))); + if (m_xData.is()) + m_xData->setPropertyValue(s_sfacsimiletelephonenumber, css::uno::makeAny(::rtl::OUString(sFax))); ::comphelper::ConfigurationHelper::flush(m_xCfg); } catch ( const css::uno::Exception& ex) @@ -702,7 +725,8 @@ void SvtUserOptions_Impl::SetEmail( const ::rtl::OUString& sEmail ) { try { - m_xData->setPropertyValue(s_smail, css::uno::makeAny(::rtl::OUString(sEmail))); + if (m_xData.is()) + m_xData->setPropertyValue(s_smail, css::uno::makeAny(::rtl::OUString(sEmail))); ::comphelper::ConfigurationHelper::flush(m_xCfg); } catch ( const css::uno::Exception& ex) @@ -715,7 +739,8 @@ void SvtUserOptions_Impl::SetCustomerNumber( const ::rtl::OUString& sCustomerNum { try { - m_xData->setPropertyValue(s_scustomernumber, css::uno::makeAny(::rtl::OUString(sCustomerNumber))); + if (m_xData.is()) + m_xData->setPropertyValue(s_scustomernumber, css::uno::makeAny(::rtl::OUString(sCustomerNumber))); ::comphelper::ConfigurationHelper::flush(m_xCfg); } catch ( const css::uno::Exception& ex) @@ -728,7 +753,8 @@ void SvtUserOptions_Impl::SetFathersName( const ::rtl::OUString& sFathersName ) { try { - m_xData->setPropertyValue(s_sfathersname, css::uno::makeAny(::rtl::OUString(sFathersName))); + if (m_xData.is()) + m_xData->setPropertyValue(s_sfathersname, css::uno::makeAny(::rtl::OUString(sFathersName))); ::comphelper::ConfigurationHelper::flush(m_xCfg); } catch ( const css::uno::Exception& ex) @@ -741,7 +767,8 @@ void SvtUserOptions_Impl::SetApartment( const ::rtl::OUString& sApartment ) { try { - m_xData->setPropertyValue(s_sapartment, css::uno::makeAny(::rtl::OUString(sApartment))); + if (m_xData.is()) + m_xData->setPropertyValue(s_sapartment, css::uno::makeAny(::rtl::OUString(sApartment))); ::comphelper::ConfigurationHelper::flush(m_xCfg); } catch ( const css::uno::Exception& ex) @@ -759,7 +786,7 @@ void SvtUserOptions_Impl::SetApartment( const ::rtl::OUString& sApartment ) sFullName = GetFirstName(); sFullName.trim(); if ( sFullName.getLength() ) - sFullName += ::rtl::OUString::createFromAscii(" "); + sFullName += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ")); sFullName += GetLastName(); sFullName.trim(); @@ -775,7 +802,7 @@ void SvtUserOptions_Impl::Notify() // ----------------------------------------------------------------------- -sal_Bool SvtUserOptions_Impl::IsTokenReadonly( USHORT nToken ) const +sal_Bool SvtUserOptions_Impl::IsTokenReadonly( sal_uInt16 nToken ) const { css::uno::Reference< css::beans::XPropertySet > xData(m_xCfg, css::uno::UNO_QUERY); css::uno::Reference< css::beans::XPropertySetInfo > xInfo = xData->getPropertySetInfo(); @@ -894,7 +921,7 @@ sal_Bool SvtUserOptions_Impl::IsTokenReadonly( USHORT nToken ) const } //------------------------------------------------------------------------ -::rtl::OUString SvtUserOptions_Impl::GetToken(USHORT nToken) const +::rtl::OUString SvtUserOptions_Impl::GetToken(sal_uInt16 nToken) const { ::rtl::OUString pRet; switch(nToken) @@ -1285,13 +1312,13 @@ void SvtUserOptions::SetApartment( const ::rtl::OUString& rNewToken ) // ----------------------------------------------------------------------- -sal_Bool SvtUserOptions::IsTokenReadonly( USHORT nToken ) const +sal_Bool SvtUserOptions::IsTokenReadonly( sal_uInt16 nToken ) const { ::osl::MutexGuard aGuard( GetInitMutex() ); return pImp->IsTokenReadonly( nToken ); } //------------------------------------------------------------------------ -::rtl::OUString SvtUserOptions::GetToken(USHORT nToken) const +::rtl::OUString SvtUserOptions::GetToken(sal_uInt16 nToken) const { ::osl::MutexGuard aGuard( GetInitMutex() ); return pImp->GetToken( nToken ); diff --git a/unotools/source/config/viewoptions.cxx b/unotools/source/config/viewoptions.cxx index f3b93da38189..c0eecd9e7edd 100644 --- a/unotools/source/config/viewoptions.cxx +++ b/unotools/source/config/viewoptions.cxx @@ -35,7 +35,7 @@ #include <unotools/viewoptions.hxx> #include <com/sun/star/uno/Any.hxx> -#include <hash_map> +#include <boost/unordered_map.hpp> #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/container/XNameContainer.hpp> #include <com/sun/star/container/XNameAccess.hpp> @@ -104,7 +104,6 @@ namespace css = ::com::sun::star; sMsg.appendAscii("Unexpected exception catched. Original message was:\n\"" ); \ sMsg.append (SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION_PARAM_EXCEPTION.Message); \ sMsg.appendAscii("\"" ); \ - OSL_ENSURE(sal_False, ::rtl::OUStringToOString(sMsg.makeStringAndClear(), RTL_TEXTENCODING_UTF8).getStr()); \ } //_________________________________________________________________________________________________________________ @@ -273,7 +272,7 @@ struct IMPL_TStringHashCode } }; -typedef ::std::hash_map< ::rtl::OUString , +typedef ::boost::unordered_map< ::rtl::OUString , IMPL_TViewData , IMPL_TStringHashCode , ::std::equal_to< ::rtl::OUString > > IMPL_TViewHash; @@ -782,7 +781,7 @@ css::uno::Reference< css::uno::XInterface > SvtViewOptionsBase_Impl::impl_getSet xNode = ::comphelper::ConfigurationHelper::makeSureSetNodeExists(m_xRoot, m_sListName, sNode); else { - if (m_xSet.is()) + if (m_xSet.is() && m_xSet->hasByName(sNode) ) m_xSet->getByName(sNode) >>= xNode; } } @@ -860,7 +859,7 @@ SvtViewOptions::SvtViewOptions( EViewType eType , } } break; - default : OSL_ENSURE( sal_False, "SvtViewOptions::SvtViewOptions()\nThese view type is unknown! All following calls at these instance will do nothing!\n" ); + default : OSL_FAIL( "SvtViewOptions::SvtViewOptions()\nThese view type is unknown! All following calls at these instance will do nothing!\n" ); } } diff --git a/unotools/source/config/xmlaccelcfg.cxx b/unotools/source/config/xmlaccelcfg.cxx index bd8f14c0373a..fbf33a889ca5 100644 --- a/unotools/source/config/xmlaccelcfg.cxx +++ b/unotools/source/config/xmlaccelcfg.cxx @@ -35,10 +35,11 @@ #include <com/sun/star/xml/sax/XAttributeList.hpp> #include <cppuhelper/implbase1.hxx> -using namespace rtl; using namespace com::sun::star::uno; using namespace com::sun::star::xml::sax; +using ::rtl::OUString; + #define ELEMENT_ACCELERATORLIST "acceleratorlist" #define ELEMENT_ACCELERATORITEM "item" @@ -377,7 +378,7 @@ void OWriteAccelatorDocumentHandler::WriteAcceleratorDocument() m_xWriteDocumentHandler->ignorableWhitespace( OUString() ); std::list< SvtAcceleratorConfigItem>::const_iterator p; - for ( p = m_aWriteAcceleratorList.begin(); p != m_aWriteAcceleratorList.end(); p++ ) + for ( p = m_aWriteAcceleratorList.begin(); p != m_aWriteAcceleratorList.end(); ++p ) WriteAcceleratorItem( *p ); m_xWriteDocumentHandler->endElement( OUString( RTL_CONSTASCII_USTRINGPARAM( ELEMENT_ACCELERATORLIST )) ); diff --git a/unotools/source/i18n/caserotate.cxx b/unotools/source/i18n/caserotate.cxx new file mode 100644 index 000000000000..85d820212e77 --- /dev/null +++ b/unotools/source/i18n/caserotate.cxx @@ -0,0 +1,65 @@ +/* -*- 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> + * + * Contributor(s): + * Caolán McNamara <caolanm@redhat.com> + * Dózsa Bálint <dozsa@linux-dugf.site> + * + * 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. + */ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_unotools.hxx" + +#include "unotools/caserotate.hxx" +#include <com/sun/star/i18n/TransliterationModules.hpp> +#include <com/sun/star/i18n/TransliterationModulesExtra.hpp> + +//TODO Use XCharacterClassification::getStringType to determine the current +//(possibly mixed) case type and rotate to the next one + +sal_uInt32 RotateTransliteration::getNextMode() +{ + using namespace ::com::sun::star::i18n; + + sal_uInt32 nMode = 0; + + switch (nF3ShiftCounter) + { + case 0: + nMode = TransliterationModulesExtra::TITLE_CASE; + break; + case 1: + nMode = TransliterationModules_LOWERCASE_UPPERCASE; + break; + default: + case 2: + nMode = TransliterationModules_UPPERCASE_LOWERCASE; + nF3ShiftCounter = -1; + break; + } + + nF3ShiftCounter++; + + return nMode; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/unotools/source/i18n/intlwrapper.cxx b/unotools/source/i18n/intlwrapper.cxx index ccf039c7f63d..f98d6828efb3 100644 --- a/unotools/source/i18n/intlwrapper.cxx +++ b/unotools/source/i18n/intlwrapper.cxx @@ -95,7 +95,7 @@ void IntlWrapper::ImplNewCalendar() const } -void IntlWrapper::ImplNewCollator( BOOL bCaseSensitive ) const +void IntlWrapper::ImplNewCollator( sal_Bool bCaseSensitive ) const { CollatorWrapper* p = new CollatorWrapper( xSMgr ); if ( bCaseSensitive ) diff --git a/unotools/source/i18n/localedatawrapper.cxx b/unotools/source/i18n/localedatawrapper.cxx index 212454c8bde0..656453dde274 100644 --- a/unotools/source/i18n/localedatawrapper.cxx +++ b/unotools/source/i18n/localedatawrapper.cxx @@ -57,8 +57,8 @@ #define LOCALEDATA_SERVICENAME "com.sun.star.i18n.LocaleData" static const int nDateFormatInvalid = -1; -static const USHORT nCurrFormatInvalid = 0xffff; -static const USHORT nCurrFormatDefault = 0; +static const sal_uInt16 nCurrFormatInvalid = 0xffff; +static const sal_uInt16 nCurrFormatDefault = 0; using namespace ::com::sun::star; using namespace ::com::sun::star::i18n; @@ -77,7 +77,7 @@ namespace {}; } -BYTE LocaleDataWrapper::nLocaleDataChecking = 0; +sal_uInt8 LocaleDataWrapper::nLocaleDataChecking = 0; LocaleDataWrapper::LocaleDataWrapper( const Reference< lang::XMultiServiceFactory > & xSF, @@ -85,8 +85,8 @@ LocaleDataWrapper::LocaleDataWrapper( ) : xSMgr( xSF ), - bLocaleDataItemValid( FALSE ), - bReservedWordValid( FALSE ) + bLocaleDataItemValid( sal_False ), + bReservedWordValid( sal_False ) { setLocale( rLocale ); if ( xSMgr.is() ) @@ -168,7 +168,7 @@ void LocaleDataWrapper::invalidateData() { aLocaleItem[j].Erase(); } - bLocaleDataItemValid = FALSE; + bLocaleDataItemValid = sal_False; } if ( bReservedWordValid ) { @@ -176,7 +176,7 @@ void LocaleDataWrapper::invalidateData() { aReservedWord[j].Erase(); } - bReservedWordValid = FALSE; + bReservedWordValid = sal_False; } xDefaultCalendar.reset(); if (aGrouping.getLength()) @@ -544,7 +544,7 @@ void LocaleDataWrapper::getOneLocaleItemImpl( sal_Int16 nItem ) if ( !bLocaleDataItemValid ) { aLocaleDataItem = getLocaleItem(); - bLocaleDataItemValid = TRUE; + bLocaleDataItemValid = sal_True; } switch ( nItem ) { @@ -610,7 +610,7 @@ void LocaleDataWrapper::getOneReservedWordImpl( sal_Int16 nWord ) if ( !bReservedWordValid ) { aReservedWordSeq = getReservedWord(); - bReservedWordValid = TRUE; + bReservedWordValid = sal_True; } DBG_ASSERT( nWord < aReservedWordSeq.getLength(), "getOneReservedWordImpl: which one?" ); if ( nWord < aReservedWordSeq.getLength() ) @@ -719,7 +719,7 @@ const String& LocaleDataWrapper::getCurrBankSymbol() const } -USHORT LocaleDataWrapper::getCurrPositiveFormat() const +sal_uInt16 LocaleDataWrapper::getCurrPositiveFormat() const { ::utl::ReadWriteGuard aGuard( aMutex ); if ( nCurrPositiveFormat == nCurrFormatInvalid ) @@ -731,7 +731,7 @@ USHORT LocaleDataWrapper::getCurrPositiveFormat() const } -USHORT LocaleDataWrapper::getCurrNegativeFormat() const +sal_uInt16 LocaleDataWrapper::getCurrNegativeFormat() const { ::utl::ReadWriteGuard aGuard( aMutex ); if ( nCurrNegativeFormat == nCurrFormatInvalid ) @@ -743,7 +743,7 @@ USHORT LocaleDataWrapper::getCurrNegativeFormat() const } -USHORT LocaleDataWrapper::getCurrDigits() const +sal_uInt16 LocaleDataWrapper::getCurrDigits() const { ::utl::ReadWriteGuard aGuard( aMutex ); if ( nCurrDigits == nCurrFormatInvalid ) @@ -802,13 +802,13 @@ void LocaleDataWrapper::scanCurrFormatImpl( const String& rCode, const sal_Unicode* const pStop = pStr + rCode.Len(); const sal_Unicode* p = pStr + nStart; int nInSection = 0; - BOOL bQuote = FALSE; + sal_Bool bQuote = sal_False; while ( p < pStop ) { if ( bQuote ) { if ( *p == '"' && *(p-1) != '\\' ) - bQuote = FALSE; + bQuote = sal_False; } else { @@ -816,7 +816,7 @@ void LocaleDataWrapper::scanCurrFormatImpl( const String& rCode, { case '"' : if ( pStr == p || *(p-1) != '\\' ) - bQuote = TRUE; + bQuote = sal_True; break; case '-' : if ( !nInSection && nSign == STRING_NOTFOUND ) @@ -1335,7 +1335,7 @@ static sal_Unicode* ImplAddUNum( sal_Unicode* pBuf, sal_uInt64 nNumber, int nMin } -static sal_Unicode* ImplAdd2UNum( sal_Unicode* pBuf, USHORT nNumber, int bLeading ) +static sal_Unicode* ImplAdd2UNum( sal_Unicode* pBuf, sal_uInt16 nNumber, int bLeading ) { DBG_ASSERT( nNumber < 100, "ImplAdd2UNum() - Number >= 100" ); @@ -1350,7 +1350,7 @@ static sal_Unicode* ImplAdd2UNum( sal_Unicode* pBuf, USHORT nNumber, int bLeadin } else { - USHORT nTemp = nNumber % 10; + sal_uInt16 nTemp = nNumber % 10; nNumber /= 10; *pBuf = nNumber + '0'; pBuf++; @@ -1393,29 +1393,25 @@ inline sal_Unicode* ImplAddString( sal_Unicode* pBuf, const sal_Unicode* pCopyBu sal_Unicode* LocaleDataWrapper::ImplAddFormatNum( sal_Unicode* pBuf, - sal_Int64 nNumber, USHORT nDecimals, BOOL bUseThousandSep, - BOOL bTrailingZeros ) const + sal_Int64 nNumber, sal_uInt16 nDecimals, sal_Bool bUseThousandSep, + sal_Bool bTrailingZeros ) const { sal_Unicode aNumBuf[64]; sal_Unicode* pNumBuf; - USHORT nNumLen; - USHORT i = 0; - BOOL bNeg; + sal_uInt16 nNumLen; + sal_uInt16 i = 0; // negative number if ( nNumber < 0 ) { nNumber *= -1; - bNeg = TRUE; *pBuf = '-'; pBuf++; } - else - bNeg = FALSE; // convert number pNumBuf = ImplAddUNum( aNumBuf, (sal_uInt64)nNumber ); - nNumLen = (USHORT)(ULONG)(pNumBuf-aNumBuf); + nNumLen = (sal_uInt16)(sal_uLong)(pNumBuf-aNumBuf); pNumBuf = aNumBuf; if ( nNumLen <= nDecimals ) @@ -1461,7 +1457,7 @@ sal_Unicode* LocaleDataWrapper::ImplAddFormatNum( sal_Unicode* pBuf, const String& rThoSep = getNumThousandSep(); // copy number to buffer (excluding decimals) - USHORT nNumLen2 = nNumLen-nDecimals; + sal_uInt16 nNumLen2 = nNumLen-nDecimals; uno::Sequence< sal_Bool > aGroupPos; if (bUseThousandSep) aGroupPos = utl::DigitGroupingIterator::createForwardSequence( @@ -1482,11 +1478,11 @@ sal_Unicode* LocaleDataWrapper::ImplAddFormatNum( sal_Unicode* pBuf, { pBuf = ImplAddString( pBuf, getNumDecimalSep() ); - BOOL bNullEnd = TRUE; + sal_Bool bNullEnd = sal_True; while ( i < nNumLen ) { if ( *pNumBuf != '0' ) - bNullEnd = FALSE; + bNullEnd = sal_False; *pBuf = *pNumBuf; pBuf++; @@ -1512,12 +1508,12 @@ String LocaleDataWrapper::getDate( const Date& rDate ) const //!TODO: leading zeros et al sal_Unicode aBuf[128]; sal_Unicode* pBuf = aBuf; - USHORT nDay = rDate.GetDay(); - USHORT nMonth = rDate.GetMonth(); - USHORT nYear = rDate.GetYear(); - USHORT nYearLen; + sal_uInt16 nDay = rDate.GetDay(); + sal_uInt16 nMonth = rDate.GetMonth(); + sal_uInt16 nYear = rDate.GetYear(); + sal_uInt16 nYearLen; - if ( TRUE /* IsDateCentury() */ ) + if ( sal_True /* IsDateCentury() */ ) nYearLen = 4; else { @@ -1528,39 +1524,39 @@ String LocaleDataWrapper::getDate( const Date& rDate ) const switch ( getDateFormat() ) { case DMY : - pBuf = ImplAdd2UNum( pBuf, nDay, TRUE /* IsDateDayLeadingZero() */ ); + pBuf = ImplAdd2UNum( pBuf, nDay, sal_True /* IsDateDayLeadingZero() */ ); pBuf = ImplAddString( pBuf, getDateSep() ); - pBuf = ImplAdd2UNum( pBuf, nMonth, TRUE /* IsDateMonthLeadingZero() */ ); + pBuf = ImplAdd2UNum( pBuf, nMonth, sal_True /* IsDateMonthLeadingZero() */ ); pBuf = ImplAddString( pBuf, getDateSep() ); pBuf = ImplAddUNum( pBuf, nYear, nYearLen ); break; case MDY : - pBuf = ImplAdd2UNum( pBuf, nMonth, TRUE /* IsDateMonthLeadingZero() */ ); + pBuf = ImplAdd2UNum( pBuf, nMonth, sal_True /* IsDateMonthLeadingZero() */ ); pBuf = ImplAddString( pBuf, getDateSep() ); - pBuf = ImplAdd2UNum( pBuf, nDay, TRUE /* IsDateDayLeadingZero() */ ); + pBuf = ImplAdd2UNum( pBuf, nDay, sal_True /* IsDateDayLeadingZero() */ ); pBuf = ImplAddString( pBuf, getDateSep() ); pBuf = ImplAddUNum( pBuf, nYear, nYearLen ); break; default: pBuf = ImplAddUNum( pBuf, nYear, nYearLen ); pBuf = ImplAddString( pBuf, getDateSep() ); - pBuf = ImplAdd2UNum( pBuf, nMonth, TRUE /* IsDateMonthLeadingZero() */ ); + pBuf = ImplAdd2UNum( pBuf, nMonth, sal_True /* IsDateMonthLeadingZero() */ ); pBuf = ImplAddString( pBuf, getDateSep() ); - pBuf = ImplAdd2UNum( pBuf, nDay, TRUE /* IsDateDayLeadingZero() */ ); + pBuf = ImplAdd2UNum( pBuf, nDay, sal_True /* IsDateDayLeadingZero() */ ); } - return String( aBuf, (xub_StrLen)(ULONG)(pBuf-aBuf) ); + return String( aBuf, (xub_StrLen)(sal_uLong)(pBuf-aBuf) ); } -String LocaleDataWrapper::getTime( const Time& rTime, BOOL bSec, BOOL b100Sec ) const +String LocaleDataWrapper::getTime( const Time& rTime, sal_Bool bSec, sal_Bool b100Sec ) const { ::utl::ReadWriteGuard aGuard( aMutex, ::utl::ReadWriteGuardMode::nBlockCritical ); //!TODO: leading zeros et al sal_Unicode aBuf[128]; sal_Unicode* pBuf = aBuf; - USHORT nHour = rTime.GetHour(); - BOOL bHour12 = FALSE; //!TODO: AM/PM from default time format code + sal_uInt16 nHour = rTime.GetHour(); + sal_Bool bHour12 = sal_False; //!TODO: AM/PM from default time format code if ( bHour12 ) { @@ -1572,22 +1568,22 @@ String LocaleDataWrapper::getTime( const Time& rTime, BOOL bSec, BOOL b100Sec ) else nHour %= 24; - pBuf = ImplAdd2UNum( pBuf, nHour, TRUE /* IsTimeLeadingZero() */ ); + pBuf = ImplAdd2UNum( pBuf, nHour, sal_True /* IsTimeLeadingZero() */ ); pBuf = ImplAddString( pBuf, getTimeSep() ); - pBuf = ImplAdd2UNum( pBuf, rTime.GetMin(), TRUE ); + pBuf = ImplAdd2UNum( pBuf, rTime.GetMin(), sal_True ); if ( bSec ) { pBuf = ImplAddString( pBuf, getTimeSep() ); - pBuf = ImplAdd2UNum( pBuf, rTime.GetSec(), TRUE ); + pBuf = ImplAdd2UNum( pBuf, rTime.GetSec(), sal_True ); if ( b100Sec ) { pBuf = ImplAddString( pBuf, getTime100SecSep() ); - pBuf = ImplAdd2UNum( pBuf, rTime.Get100Sec(), TRUE ); + pBuf = ImplAdd2UNum( pBuf, rTime.Get100Sec(), sal_True ); } } - String aStr( aBuf, (xub_StrLen)(ULONG)(pBuf-aBuf) ); + String aStr( aBuf, (xub_StrLen)(sal_uLong)(pBuf-aBuf) ); if ( bHour12 ) { @@ -1619,7 +1615,7 @@ String LocaleDataWrapper::getLongDate( const Date& rDate, CalendarWrapper& rCal, // day of month nVal = rCal.getValue( CalendarFieldIndex::DAY_OF_MONTH ); pBuf = ImplAdd2UNum( aBuf, nVal, bDayOfMonthWithLeadingZero ); - String aDay( aBuf, (xub_StrLen)(ULONG)(pBuf-aBuf) ); + String aDay( aBuf, (xub_StrLen)(sal_uLong)(pBuf-aBuf) ); // month of year nVal = rCal.getValue( CalendarFieldIndex::MONTH ); String aMonth( rCal.getDisplayName( CalendarDisplayIndex::MONTH, nVal, nDisplayMonth ) ); @@ -1629,7 +1625,7 @@ String LocaleDataWrapper::getLongDate( const Date& rDate, CalendarWrapper& rCal, pBuf = ImplAddUNum( aBuf, nVal % 100, 2 ); else pBuf = ImplAddUNum( aBuf, nVal ); - String aYear( aBuf, (xub_StrLen)(ULONG)(pBuf-aBuf) ); + String aYear( aBuf, (xub_StrLen)(sal_uLong)(pBuf-aBuf) ); // concatenate switch ( getLongDateFormat() ) { @@ -1658,7 +1654,7 @@ String LocaleDataWrapper::getLongDate( const Date& rDate, CalendarWrapper& rCal, } -String LocaleDataWrapper::getDuration( const Time& rTime, BOOL bSec, BOOL b100Sec ) const +String LocaleDataWrapper::getDuration( const Time& rTime, sal_Bool bSec, sal_Bool b100Sec ) const { ::utl::ReadWriteGuard aGuard( aMutex, ::utl::ReadWriteGuardMode::nBlockCritical ); sal_Unicode aBuf[128]; @@ -1667,31 +1663,31 @@ String LocaleDataWrapper::getDuration( const Time& rTime, BOOL bSec, BOOL b100Se if ( rTime < Time( 0 ) ) pBuf = ImplAddString( pBuf, ' ' ); - if ( TRUE /* IsTimeLeadingZero() */ ) + if ( sal_True /* IsTimeLeadingZero() */ ) pBuf = ImplAddUNum( pBuf, rTime.GetHour(), 2 ); else pBuf = ImplAddUNum( pBuf, rTime.GetHour() ); pBuf = ImplAddString( pBuf, getTimeSep() ); - pBuf = ImplAdd2UNum( pBuf, rTime.GetMin(), TRUE ); + pBuf = ImplAdd2UNum( pBuf, rTime.GetMin(), sal_True ); if ( bSec ) { pBuf = ImplAddString( pBuf, getTimeSep() ); - pBuf = ImplAdd2UNum( pBuf, rTime.GetSec(), TRUE ); + pBuf = ImplAdd2UNum( pBuf, rTime.GetSec(), sal_True ); if ( b100Sec ) { pBuf = ImplAddString( pBuf, getTime100SecSep() ); - pBuf = ImplAdd2UNum( pBuf, rTime.Get100Sec(), TRUE ); + pBuf = ImplAdd2UNum( pBuf, rTime.Get100Sec(), sal_True ); } } - return String( aBuf, (xub_StrLen)(ULONG)(pBuf-aBuf) ); + return String( aBuf, (xub_StrLen)(sal_uLong)(pBuf-aBuf) ); } // --- simple number formatting --------------------------------------- -inline size_t ImplGetNumberStringLengthGuess( const LocaleDataWrapper& rLoc, USHORT nDecimals ) +inline size_t ImplGetNumberStringLengthGuess( const LocaleDataWrapper& rLoc, sal_uInt16 nDecimals ) { // approximately 3.2 bits per digit const size_t nDig = ((sizeof(sal_Int64) * 8) / 3) + 1; @@ -1703,8 +1699,8 @@ inline size_t ImplGetNumberStringLengthGuess( const LocaleDataWrapper& rLoc, USH } -String LocaleDataWrapper::getNum( sal_Int64 nNumber, USHORT nDecimals, - BOOL bUseThousandSep, BOOL bTrailingZeros ) const +String LocaleDataWrapper::getNum( sal_Int64 nNumber, sal_uInt16 nDecimals, + sal_Bool bUseThousandSep, sal_Bool bTrailingZeros ) const { ::utl::ReadWriteGuard aGuard( aMutex, ::utl::ReadWriteGuardMode::nBlockCritical ); sal_Unicode aBuf[128]; // big enough for 64-bit long and crazy grouping @@ -1715,7 +1711,7 @@ String LocaleDataWrapper::getNum( sal_Int64 nNumber, USHORT nDecimals, sal_Unicode* pBuf = ImplAddFormatNum( pBuffer, nNumber, nDecimals, bUseThousandSep, bTrailingZeros ); - String aStr( pBuffer, (xub_StrLen)(ULONG)(pBuf-pBuffer) ); + String aStr( pBuffer, (xub_StrLen)(sal_uLong)(pBuf-pBuffer) ); if ( pBuffer != aBuf ) delete [] pBuffer; @@ -1723,8 +1719,8 @@ String LocaleDataWrapper::getNum( sal_Int64 nNumber, USHORT nDecimals, } -String LocaleDataWrapper::getCurr( sal_Int64 nNumber, USHORT nDecimals, - const String& rCurrencySymbol, BOOL bUseThousandSep ) const +String LocaleDataWrapper::getCurr( sal_Int64 nNumber, sal_uInt16 nDecimals, + const String& rCurrencySymbol, sal_Bool bUseThousandSep ) const { ::utl::ReadWriteGuard aGuard( aMutex, ::utl::ReadWriteGuardMode::nBlockCritical ); sal_Unicode aBuf[192]; @@ -1741,26 +1737,26 @@ String LocaleDataWrapper::getCurr( sal_Int64 nNumber, USHORT nDecimals, new sal_Unicode[ rCurrencySymbol.Len() + nGuess + 20 ]); sal_Unicode* pBuf = pBuffer; - BOOL bNeg; + sal_Bool bNeg; if ( nNumber < 0 ) { - bNeg = TRUE; + bNeg = sal_True; nNumber *= -1; } else - bNeg = FALSE; + bNeg = sal_False; // convert number sal_Unicode* pEndNumBuf = ImplAddFormatNum( pNumBuffer, nNumber, nDecimals, - bUseThousandSep, TRUE ); - xub_StrLen nNumLen = (xub_StrLen)(ULONG)(pEndNumBuf-pNumBuffer); + bUseThousandSep, sal_True ); + xub_StrLen nNumLen = (xub_StrLen)(sal_uLong)(pEndNumBuf-pNumBuffer); // replace zeros with zero character if ( (cZeroChar != '0') && nDecimals /* && IsNumTrailingZeros() */ ) { sal_Unicode* pTempBuf; - USHORT i; - BOOL bZero = TRUE; + sal_uInt16 i; + sal_Bool bZero = sal_True; pTempBuf = pNumBuffer+nNumLen-nDecimals; i = 0; @@ -1768,7 +1764,7 @@ String LocaleDataWrapper::getCurr( sal_Int64 nNumber, USHORT nDecimals, { if ( *pTempBuf != '0' ) { - bZero = FALSE; + bZero = sal_False; break; } @@ -1914,7 +1910,7 @@ String LocaleDataWrapper::getCurr( sal_Int64 nNumber, USHORT nDecimals, } } - String aNumber( pBuffer, (xub_StrLen)(ULONG)(pBuf-pBuffer) ); + String aNumber( pBuffer, (xub_StrLen)(sal_uLong)(pBuf-pBuffer) ); if ( pBuffer != aBuf ) delete [] pBuffer; @@ -1963,7 +1959,7 @@ void LocaleDataWrapper::outputCheckMessage( const char* pStr ) { fprintf( stderr, "\n%s\n", pStr); fflush( stderr); - DBG_ERROR( pStr); + OSL_TRACE("%s", pStr); } @@ -1974,7 +1970,7 @@ void LocaleDataWrapper::evaluateLocaleDataChecking() // accesses, since we want to assign the result to the static member // variable and would need to dereference the pointer returned and assign // the value unguarded. This is the same pattern manually coded. - BYTE nCheck = nLocaleDataChecking; + sal_uInt8 nCheck = nLocaleDataChecking; if (!nCheck) { ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex()); diff --git a/unotools/source/i18n/makefile.mk b/unotools/source/i18n/makefile.mk index bb21d65625cb..cbe42e626b79 100644 --- a/unotools/source/i18n/makefile.mk +++ b/unotools/source/i18n/makefile.mk @@ -40,6 +40,7 @@ ENABLE_EXCEPTIONS=TRUE # --- Files ------------------------------------- SLOFILES= \ + $(SLO)$/caserotate.obj \ $(SLO)$/charclass.obj \ $(SLO)$/calendarwrapper.obj \ $(SLO)$/collatorwrapper.obj \ diff --git a/unotools/source/i18n/textsearch.cxx b/unotools/source/i18n/textsearch.cxx index 1c4d2b4b2fd5..abf2ce5af79e 100644 --- a/unotools/source/i18n/textsearch.cxx +++ b/unotools/source/i18n/textsearch.cxx @@ -49,9 +49,9 @@ namespace utl SearchParam::SearchParam( const String &rText, SearchType eType, - BOOL bCaseSensitive, - BOOL bWrdOnly, - BOOL bSearchInSel ) + sal_Bool bCaseSensitive, + sal_Bool bWrdOnly, + sal_Bool bSearchInSel ) { sSrchStr = rText; eSrchType = eType; @@ -63,7 +63,7 @@ SearchParam::SearchParam( const String &rText, nTransliterationFlags = 0; // Werte fuer "Gewichtete Levenshtein-Distanz" - bLEV_Relaxed = TRUE; + bLEV_Relaxed = sal_True; nLEV_OtherX = 2; nLEV_ShorterY = 1; nLEV_LongerZ = 3; @@ -304,8 +304,8 @@ void TextSearch::ReplaceBackReferences( String& rReplaceStr, const String &rStr, { if( rReplaceStr.GetChar( nPos ) == '&') { - USHORT nStart = (USHORT)(rResult.startOffset[0]); - USHORT nLength = (USHORT)(rResult.endOffset[0] - rResult.startOffset[0]); + sal_uInt16 nStart = (sal_uInt16)(rResult.startOffset[0]); + sal_uInt16 nLength = (sal_uInt16)(rResult.endOffset[0] - rResult.startOffset[0]); rReplaceStr.Erase( nPos, 1 ); // delete ampersand // replace by found string rReplaceStr.Insert( rStr, nStart, nLength, nPos ); @@ -334,17 +334,17 @@ void TextSearch::ReplaceBackReferences( String& rReplaceStr, const String &rStr, int i = sFndChar - '0'; // index if(i < rResult.subRegExpressions) { - USHORT nSttReg = (USHORT)(rResult.startOffset[i]); - USHORT nRegLen = (USHORT)(rResult.endOffset[i]); + sal_uInt16 nSttReg = (sal_uInt16)(rResult.startOffset[i]); + sal_uInt16 nRegLen = (sal_uInt16)(rResult.endOffset[i]); if( nRegLen > nSttReg ) nRegLen = nRegLen - nSttReg; else { nRegLen = nSttReg - nRegLen; - nSttReg = (USHORT)(rResult.endOffset[i]); + nSttReg = (sal_uInt16)(rResult.endOffset[i]); } // Copy reference from found string - sTmp = rStr.Copy((USHORT)nSttReg, (USHORT)nRegLen); + sTmp = rStr.Copy((sal_uInt16)nSttReg, (sal_uInt16)nRegLen); // insert rReplaceStr.Insert( sTmp, nPos ); // and step over diff --git a/unotools/source/misc/atom.cxx b/unotools/source/misc/atom.cxx index f0e73014bf89..d8bf5bbfa053 100644 --- a/unotools/source/misc/atom.cxx +++ b/unotools/source/misc/atom.cxx @@ -47,7 +47,7 @@ AtomProvider::~AtomProvider() int AtomProvider::getAtom( const ::rtl::OUString& rString, sal_Bool bCreate ) { - ::std::hash_map< ::rtl::OUString, int, ::rtl::OUStringHash >::iterator it = m_aAtomMap.find( rString ); + ::boost::unordered_map< ::rtl::OUString, int, ::rtl::OUStringHash >::iterator it = m_aAtomMap.find( rString ); if( it != m_aAtomMap.end() ) return it->second; if( ! bCreate ) @@ -61,7 +61,7 @@ int AtomProvider::getAtom( const ::rtl::OUString& rString, sal_Bool bCreate ) void AtomProvider::getAll( ::std::list< ::utl::AtomDescription >& atoms ) { atoms.clear(); - ::std::hash_map< ::rtl::OUString, int, ::rtl::OUStringHash >::const_iterator it = m_aAtomMap.begin(); + ::boost::unordered_map< ::rtl::OUString, int, ::rtl::OUStringHash >::const_iterator it = m_aAtomMap.begin(); ::utl::AtomDescription aDesc; while( it != m_aAtomMap.end() ) @@ -77,7 +77,7 @@ void AtomProvider::getRecent( int atom, ::std::list< ::utl::AtomDescription >& a { atoms.clear(); - ::std::hash_map< ::rtl::OUString, int, ::rtl::OUStringHash >::const_iterator it = m_aAtomMap.begin(); + ::boost::unordered_map< ::rtl::OUString, int, ::rtl::OUStringHash >::const_iterator it = m_aAtomMap.begin(); ::utl::AtomDescription aDesc; while( it != m_aAtomMap.end() ) @@ -95,7 +95,7 @@ void AtomProvider::getRecent( int atom, ::std::list< ::utl::AtomDescription >& a const ::rtl::OUString& AtomProvider::getString( int nAtom ) const { static ::rtl::OUString aEmpty; - ::std::hash_map< int, ::rtl::OUString, ::std::hash< int > >::const_iterator it = m_aStringMap.find( nAtom ); + ::boost::unordered_map< int, ::rtl::OUString, ::boost::hash< int > >::const_iterator it = m_aStringMap.find( nAtom ); return it == m_aStringMap.end() ? aEmpty : it->second; } @@ -121,14 +121,14 @@ MultiAtomProvider::MultiAtomProvider() MultiAtomProvider::~MultiAtomProvider() { - for( ::std::hash_map< int, AtomProvider*, ::std::hash< int > >::iterator it = m_aAtomLists.begin(); it != m_aAtomLists.end(); ++it ) + for( ::boost::unordered_map< int, AtomProvider*, ::boost::hash< int > >::iterator it = m_aAtomLists.begin(); it != m_aAtomLists.end(); ++it ) delete it->second; } sal_Bool MultiAtomProvider::insertAtomClass( int atomClass ) { - ::std::hash_map< int, AtomProvider*, ::std::hash< int > >::iterator it = + ::boost::unordered_map< int, AtomProvider*, ::boost::hash< int > >::iterator it = m_aAtomLists.find( atomClass ); if( it != m_aAtomLists.end() ) return sal_False; @@ -138,7 +138,7 @@ sal_Bool MultiAtomProvider::insertAtomClass( int atomClass ) int MultiAtomProvider::getAtom( int atomClass, const ::rtl::OUString& rString, sal_Bool bCreate ) { - ::std::hash_map< int, AtomProvider*, ::std::hash< int > >::iterator it = + ::boost::unordered_map< int, AtomProvider*, ::boost::hash< int > >::iterator it = m_aAtomLists.find( atomClass ); if( it != m_aAtomLists.end() ) return it->second->getAtom( rString, bCreate ); @@ -154,7 +154,7 @@ int MultiAtomProvider::getAtom( int atomClass, const ::rtl::OUString& rString, s int MultiAtomProvider::getLastAtom( int atomClass ) const { - ::std::hash_map< int, AtomProvider*, ::std::hash< int > >::const_iterator it = + ::boost::unordered_map< int, AtomProvider*, ::boost::hash< int > >::const_iterator it = m_aAtomLists.find( atomClass ); return it != m_aAtomLists.end() ? it->second->getLastAtom() : INVALID_ATOM; @@ -162,7 +162,7 @@ int MultiAtomProvider::getLastAtom( int atomClass ) const void MultiAtomProvider::getRecent( int atomClass, int atom, ::std::list< ::utl::AtomDescription >& atoms ) { - ::std::hash_map< int, AtomProvider*, ::std::hash< int > >::const_iterator it = + ::boost::unordered_map< int, AtomProvider*, ::boost::hash< int > >::const_iterator it = m_aAtomLists.find( atomClass ); if( it != m_aAtomLists.end() ) it->second->getRecent( atom, atoms ); @@ -172,7 +172,7 @@ void MultiAtomProvider::getRecent( int atomClass, int atom, ::std::list< ::utl:: const ::rtl::OUString& MultiAtomProvider::getString( int atomClass, int atom ) const { - ::std::hash_map< int, AtomProvider*, ::std::hash< int > >::const_iterator it = + ::boost::unordered_map< int, AtomProvider*, ::boost::hash< int > >::const_iterator it = m_aAtomLists.find( atomClass ); if( it != m_aAtomLists.end() ) return it->second->getString( atom ); @@ -183,13 +183,13 @@ const ::rtl::OUString& MultiAtomProvider::getString( int atomClass, int atom ) c sal_Bool MultiAtomProvider::hasAtom( int atomClass, int atom ) const { - ::std::hash_map< int, AtomProvider*, ::std::hash< int > >::const_iterator it = m_aAtomLists.find( atomClass ); + ::boost::unordered_map< int, AtomProvider*, ::boost::hash< int > >::const_iterator it = m_aAtomLists.find( atomClass ); return it != m_aAtomLists.end() ? it->second->hasAtom( atom ) : sal_False; } void MultiAtomProvider::getClass( int atomClass, ::std::list< ::utl::AtomDescription >& atoms) const { - ::std::hash_map< int, AtomProvider*, ::std::hash< int > >::const_iterator it = m_aAtomLists.find( atomClass ); + ::boost::unordered_map< int, AtomProvider*, ::boost::hash< int > >::const_iterator it = m_aAtomLists.find( atomClass ); if( it != m_aAtomLists.end() ) it->second->getAll( atoms ); @@ -199,7 +199,7 @@ void MultiAtomProvider::getClass( int atomClass, ::std::list< ::utl::AtomDescrip void MultiAtomProvider::overrideAtom( int atomClass, int atom, const ::rtl::OUString& description ) { - ::std::hash_map< int, AtomProvider*, ::std::hash< int > >::const_iterator it = m_aAtomLists.find( atomClass ); + ::boost::unordered_map< int, AtomProvider*, ::boost::hash< int > >::const_iterator it = m_aAtomLists.find( atomClass ); if( it == m_aAtomLists.end() ) m_aAtomLists[ atomClass ] = new AtomProvider(); m_aAtomLists[ atomClass ]->overrideAtom( atom, description ); diff --git a/unotools/source/misc/desktopterminationobserver.cxx b/unotools/source/misc/desktopterminationobserver.cxx index 064855a3c4f3..b9f457792dde 100644 --- a/unotools/source/misc/desktopterminationobserver.cxx +++ b/unotools/source/misc/desktopterminationobserver.cxx @@ -123,7 +123,7 @@ namespace utl } catch( const Exception& ) { - OSL_ENSURE( sal_False, "OObserverImpl::ensureObservation: caught an exception!" ); + OSL_FAIL( "OObserverImpl::ensureObservation: caught an exception!" ); } } diff --git a/unotools/source/misc/eventlisteneradapter.cxx b/unotools/source/misc/eventlisteneradapter.cxx index fe555d906347..4ee8c8430027 100644 --- a/unotools/source/misc/eventlisteneradapter.cxx +++ b/unotools/source/misc/eventlisteneradapter.cxx @@ -169,7 +169,7 @@ namespace utl { if (!_rxComp.is()) { - OSL_ENSURE(sal_False, "OEventListenerAdapter::startComponentListening: invalid component!"); + OSL_FAIL("OEventListenerAdapter::startComponentListening: invalid component!"); return; } diff --git a/unotools/source/misc/fontcvt.cxx b/unotools/source/misc/fontcvt.cxx index 95342a0f896b..abeb9cbb6f80 100644 --- a/unotools/source/misc/fontcvt.cxx +++ b/unotools/source/misc/fontcvt.cxx @@ -1378,7 +1378,7 @@ sal_Unicode ConvertChar::RecodeChar( sal_Unicode cChar ) const // from an traditional symbol font (i.e. U+F020..U+F0FF) void ConvertChar::RecodeString( String& rStr, xub_StrLen nIndex, xub_StrLen nLen ) const { - ULONG nLastIndex = (ULONG)nIndex + nLen; + sal_uLong nLastIndex = (sal_uLong)nIndex + nLen; if( nLastIndex > rStr.Len() ) nLastIndex = rStr.Len(); @@ -1462,7 +1462,7 @@ const ConvertChar* ConvertChar::GetRecodeData( const String& rOrgFontName, const //======================================================================= FontToSubsFontConverter CreateFontToSubsFontConverter( - const String& rOrgName, ULONG nFlags ) + const String& rOrgName, sal_uLong nFlags ) { const ConvertChar* pCvt = NULL; diff --git a/unotools/source/misc/fontdefs.cxx b/unotools/source/misc/fontdefs.cxx index ec8d947add8c..c89427dd27a2 100644 --- a/unotools/source/misc/fontdefs.cxx +++ b/unotools/source/misc/fontdefs.cxx @@ -30,7 +30,7 @@ #include "precompiled_unotools.hxx" #include <unotools/fontdefs.hxx> #include <unotools/fontcfg.hxx> -#include <hash_map> +#include <boost/unordered_map.hpp> struct ImplLocalizedFontName { @@ -421,7 +421,7 @@ void GetEnglishSearchFontName( String& rName ) // translate normalized localized name to its normalized English ASCII name if( bNeedTranslation ) { - typedef std::hash_map<const String, const char*,FontNameHash> FontNameDictionary; + typedef boost::unordered_map<const String, const char*,FontNameHash> FontNameDictionary; static FontNameDictionary aDictionary( sizeof(aImplLocalizedNamesList) / sizeof(*aImplLocalizedNamesList) ); // the font name dictionary needs to be intialized once if( aDictionary.empty() ) @@ -528,7 +528,7 @@ void AddTokenFontName( String& rName, const String& rNewToken ) // ======================================================================= -String GetSubsFontName( const String& rName, ULONG nFlags ) +String GetSubsFontName( const String& rName, sal_uLong nFlags ) { String aName; diff --git a/unotools/source/misc/sharedunocomponent.cxx b/unotools/source/misc/sharedunocomponent.cxx index a921ebae3a58..8da98aa34954 100644 --- a/unotools/source/misc/sharedunocomponent.cxx +++ b/unotools/source/misc/sharedunocomponent.cxx @@ -71,7 +71,7 @@ namespace utl } catch( const Exception& ) { - OSL_ENSURE( sal_False, "DisposableComponent::~DisposableComponent: caught an exception!" ); + OSL_FAIL( "DisposableComponent::~DisposableComponent: caught an exception!" ); } m_xComponent.clear(); } @@ -157,7 +157,7 @@ namespace utl catch( const CloseVetoException& ) { /* fine */ } catch( const Exception& ) { - OSL_ENSURE( sal_False, "CloseableComponentImpl::nf_closeComponent: caught an unexpected exception!" ); + OSL_FAIL( "CloseableComponentImpl::nf_closeComponent: caught an unexpected exception!" ); } // reset @@ -179,7 +179,7 @@ namespace utl } catch( const Exception& ) { - OSL_ENSURE( sal_False, "CloseableComponentImpl::impl_nf_switchListening: caught an exception!" ); + OSL_FAIL( "CloseableComponentImpl::impl_nf_switchListening: caught an exception!" ); } } @@ -208,7 +208,7 @@ namespace utl // this should be unreachable: As long as we're a CloseListener, we veto the closing. If we're going // to close the component ourself, then we revoke ourself as listener *before* the close call. So, // if this here fires, something went definately wrong. - DBG_ERROR( "CloseableComponentImpl::notifyClosing: unreachable!" ); + OSL_FAIL( "CloseableComponentImpl::notifyClosing: unreachable!" ); } //-------------------------------------------------------------------- @@ -219,7 +219,7 @@ namespace utl ) throw (RuntimeException) { DBG_ASSERT( Source.Source == m_xCloseable, "CloseableComponentImpl::disposing: where did this come from?" ); - DBG_ERROR( "CloseableComponentImpl::disposing: unreachable!" ); + OSL_FAIL( "CloseableComponentImpl::disposing: unreachable!" ); // same reasoning for this assertion as in ->notifyClosing } diff --git a/unotools/source/property/propertysethelper.cxx b/unotools/source/property/propertysethelper.cxx index 26901e2ca46e..8e884cffbbea 100644 --- a/unotools/source/property/propertysethelper.cxx +++ b/unotools/source/property/propertysethelper.cxx @@ -285,17 +285,17 @@ Any SAL_CALL PropertySetHelper::getPropertyDefault( const ::rtl::OUString& aProp void PropertySetHelper::_getPropertyStates( const utl::PropertyMapEntry** /*ppEntries*/, PropertyState* /*pStates*/ ) throw(UnknownPropertyException ) { - DBG_ERROR( "you have to implement this yourself!" ); + OSL_FAIL( "you have to implement this yourself!" ); } void PropertySetHelper::_setPropertyToDefault( const utl::PropertyMapEntry* /*pEntry*/ ) throw(UnknownPropertyException ) { - DBG_ERROR( "you have to implement this yourself!" ); + OSL_FAIL( "you have to implement this yourself!" ); } Any PropertySetHelper::_getPropertyDefault( const utl::PropertyMapEntry* /*pEntry*/ ) throw(UnknownPropertyException, WrappedTargetException ) { - DBG_ERROR( "you have to implement this yourself!" ); + OSL_FAIL( "you have to implement this yourself!" ); Any aAny; return aAny; diff --git a/unotools/source/property/propertysetinfo.cxx b/unotools/source/property/propertysetinfo.cxx index a420ec3decd4..295486d3bf4c 100644 --- a/unotools/source/property/propertysetinfo.cxx +++ b/unotools/source/property/propertysetinfo.cxx @@ -81,12 +81,12 @@ void PropertyMapImpl::add( PropertyMapEntry* pMap ) throw() PropertyMap::iterator aIter = maPropertyMap.find( aName ); if( aIter != maPropertyMap.end() ) { - DBG_ERROR( "Warning: PropertyMapEntry added twice, possible error!" ); + OSL_FAIL( "Warning: PropertyMapEntry added twice, possible error!" ); } #endif if( NULL == pMap->mpType ) { - DBG_ERROR( "No type in PropertyMapEntry!" ); + OSL_FAIL( "No type in PropertyMapEntry!" ); pMap->mpType = &::getCppuType((const sal_Int32*)0); } @@ -127,8 +127,8 @@ Sequence< Property > PropertyMapImpl::getProperties() throw() pProperties->Handle = pEntry->mnWhich; pProperties->Type = *pEntry->mpType; pProperties->Attributes = pEntry->mnFlags; - pProperties++; - aIter++; + ++pProperties; + ++aIter; } } diff --git a/unotools/source/streaming/streamwrap.cxx b/unotools/source/streaming/streamwrap.cxx index e064f2222b20..fc29a63bb1ac 100644 --- a/unotools/source/streaming/streamwrap.cxx +++ b/unotools/source/streaming/streamwrap.cxx @@ -182,7 +182,7 @@ void OInputStreamWrapper::checkError() const //------------------------------------------------------------------------------ OSeekableInputStreamWrapper::OSeekableInputStreamWrapper(SvStream& _rStream) { - SetStream( &_rStream, FALSE ); + SetStream( &_rStream, sal_False ); } //------------------------------------------------------------------------------ @@ -329,7 +329,7 @@ sal_Int64 SAL_CALL OSeekableOutputStreamWrapper::getLength( ) throw (IOExceptio //------------------------------------------------------------------------------ OStreamWrapper::OStreamWrapper(SvStream& _rStream) { - SetStream( &_rStream, FALSE ); + SetStream( &_rStream, sal_False ); } //------------------------------------------------------------------------------ diff --git a/unotools/source/ucbhelper/localfilehelper.cxx b/unotools/source/ucbhelper/localfilehelper.cxx index 75b3dc650602..f1026f749f45 100644 --- a/unotools/source/ucbhelper/localfilehelper.cxx +++ b/unotools/source/ucbhelper/localfilehelper.cxx @@ -38,9 +38,9 @@ #include <rtl/ustring.hxx> #include <osl/file.hxx> #include <tools/debug.hxx> -#include <tools/list.hxx> #include <tools/urlobj.hxx> #include <ucbhelper/content.hxx> +#include <vector> using namespace ::osl; using namespace ::com::sun::star::uno; @@ -172,7 +172,7 @@ sal_Bool LocalFileHelper::IsFileContent( const String& rName ) return ConvertURLToSystemPath( rName, aTmp ); } -DECLARE_LIST( StringList_Impl, ::rtl::OUString* ) +typedef ::std::vector< ::rtl::OUString* > StringList_Impl; ::com::sun::star::uno::Sequence < ::rtl::OUString > LocalFileHelper::GetFolderContents( const ::rtl::OUString& rFolder, sal_Bool bFolder ) { @@ -183,7 +183,7 @@ DECLARE_LIST( StringList_Impl, ::rtl::OUString* ) Reference< ::com::sun::star::sdbc::XResultSet > xResultSet; ::com::sun::star::uno::Sequence< ::rtl::OUString > aProps(1); ::rtl::OUString* pProps = aProps.getArray(); - pProps[0] = ::rtl::OUString::createFromAscii( "Url" ); + pProps[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Url")); try { @@ -207,7 +207,7 @@ DECLARE_LIST( StringList_Impl, ::rtl::OUString* ) { ::rtl::OUString aId = xContentAccess->queryContentIdentifierString(); ::rtl::OUString* pFile = new ::rtl::OUString( aId ); - pFiles->Insert( pFile, LIST_APPEND ); + pFiles->push_back( pFile ); } } catch( ::com::sun::star::ucb::CommandAbortedException& ) @@ -224,12 +224,12 @@ DECLARE_LIST( StringList_Impl, ::rtl::OUString* ) if ( pFiles ) { - ULONG nCount = pFiles->Count(); + size_t nCount = pFiles->size(); Sequence < ::rtl::OUString > aRet( nCount ); ::rtl::OUString* pRet = aRet.getArray(); - for ( USHORT i = 0; i < nCount; ++i ) + for ( size_t i = 0; i < nCount; ++i ) { - ::rtl::OUString* pFile = pFiles->GetObject(i); + ::rtl::OUString* pFile = (*pFiles)[ i ]; pRet[i] = *( pFile ); delete pFile; } diff --git a/unotools/source/ucbhelper/tempfile.cxx b/unotools/source/ucbhelper/tempfile.cxx index 5a99c522035f..b0ceb14b1a57 100644 --- a/unotools/source/ucbhelper/tempfile.cxx +++ b/unotools/source/ucbhelper/tempfile.cxx @@ -75,10 +75,10 @@ rtl::OUString getParentName( const rtl::OUString& aFileName ) rtl::OUString aParent = aFileName.copy( 0,lastIndex ); if( aParent[ aParent.getLength()-1] == sal_Unicode(':') && aParent.getLength() == 6 ) - aParent += rtl::OUString::createFromAscii( "/" ); + aParent += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/")); if( 0 == aParent.compareToAscii( "file://" ) ) - aParent = rtl::OUString::createFromAscii( "file:///" ); + aParent = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("file:///")); return aParent; } @@ -199,25 +199,31 @@ String ConstructTempDir_Impl( const String* pParent ) void CreateTempName_Impl( String& rName, sal_Bool bKeep, sal_Bool bDir = sal_True ) { // add a suitable tempname - // Prefix can have 5 chars, leaving 3 for numbers. 26 ** 3 == 17576 - // ER 13.07.00 why not radix 36 [0-9A-Z] ?!? - const unsigned nRadix = 26; + // 36 ** 6 == 2176782336 + unsigned const nRadix = 36; + unsigned long const nMax = (nRadix*nRadix*nRadix*nRadix*nRadix*nRadix); String aName( rName ); - aName += String::CreateFromAscii( "sv" ); + aName += String::CreateFromAscii( "lu" ); rName.Erase(); - static unsigned long u = Time::GetSystemTicks(); - for ( unsigned long nOld = u; ++u != nOld; ) + unsigned long nSeed = Time::GetSystemTicks() % nMax; + for ( unsigned long u = nSeed; ++u != nSeed; ) { - u %= (nRadix*nRadix*nRadix); + u %= nMax; String aTmp( aName ); - aTmp += String::CreateFromInt32( (sal_Int32) (unsigned) u, nRadix ); + aTmp += String::CreateFromInt64( static_cast<sal_Int64>(u), nRadix ); aTmp += String::CreateFromAscii( ".tmp" ); if ( bDir ) { +#ifdef UNX /* RW permission for the user only! */ + mode_t old_mode = umask(077); +#endif FileBase::RC err = Directory::create( aTmp ); - if ( err == FileBase::E_None ) +#ifdef UNX + umask(old_mode); +#endif + if ( err == FileBase::E_None ) { // !bKeep: only for creating a name, not a file or directory if ( bKeep || Directory::remove( aTmp ) == FileBase::E_None ) @@ -234,13 +240,12 @@ void CreateTempName_Impl( String& rName, sal_Bool bKeep, sal_Bool bDir = sal_Tru { DBG_ASSERT( bKeep, "Too expensive, use directory for creating name!" ); File aFile( aTmp ); -#ifdef UNX -/* RW permission for the user only! */ - mode_t old_mode = umask(077); +#ifdef UNX /* RW permission for the user only! */ + mode_t old_mode = umask(077); #endif - FileBase::RC err = aFile.open(osl_File_OpenFlag_Create); + FileBase::RC err = aFile.open( osl_File_OpenFlag_Create | osl_File_OpenFlag_NoLock ); #ifdef UNX -umask(old_mode); + umask(old_mode); #endif if ( err == FileBase::E_None ) { diff --git a/unotools/source/ucbhelper/ucbhelper.cxx b/unotools/source/ucbhelper/ucbhelper.cxx index 01b99f85e8ec..513a8e0672ce 100644 --- a/unotools/source/ucbhelper/ucbhelper.cxx +++ b/unotools/source/ucbhelper/ucbhelper.cxx @@ -65,6 +65,7 @@ #include <ucbhelper/contentbroker.hxx> #include "unotools/localfilehelper.hxx" +#include <vector> using namespace ucbhelper; using namespace com::sun::star; @@ -75,11 +76,12 @@ using namespace com::sun::star::sdbc; using namespace com::sun::star::task; using namespace com::sun::star::uno; using namespace com::sun::star::ucb; -using namespace rtl; using namespace comphelper; using namespace osl; -DECLARE_LIST( StringList_Impl, OUString* ) +using ::rtl::OUString; + +typedef ::std::vector< OUString* > StringList_Impl; #define CONVERT_DATETIME( aUnoDT, aToolsDT ) \ aToolsDT = DateTime( Date( aUnoDT.Day, aUnoDT.Month, aUnoDT.Year ), \ @@ -109,7 +111,7 @@ sal_Bool UCBContentHelper::Transfer_Impl( const String& rSource, const String& r { Content aDestPath( aDestObj.GetMainURL( INetURLObject::NO_DECODE ), uno::Reference< ::com::sun::star::ucb::XCommandEnvironment > () ); uno::Reference< ::com::sun::star::ucb::XCommandInfo > xInfo = aDestPath.getCommands(); - OUString aTransferName = OUString::createFromAscii( "transfer" ); + OUString aTransferName(RTL_CONSTASCII_USTRINGPARAM("transfer")); if ( xInfo->hasCommandByName( aTransferName ) ) { aDestPath.executeCommand( aTransferName, makeAny( @@ -240,7 +242,7 @@ sal_Bool UCBContentHelper::GetTitle( const String& rContent, String& rTitle ) { Content aCnt( aObj.GetMainURL( INetURLObject::NO_DECODE ), uno::Reference< ::com::sun::star::ucb::XCommandEnvironment > () ); OUString aTemp; - if ( aCnt.getPropertyValue( OUString::createFromAscii( "Title" ) ) >>= aTemp ) + if ( aCnt.getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("Title")) ) >>= aTemp ) { rTitle = String( aTemp ); bRet = sal_True; @@ -266,7 +268,7 @@ sal_Bool UCBContentHelper::Kill( const String& rContent ) try { Content aCnt( aDeleteObj.GetMainURL( INetURLObject::NO_DECODE ), uno::Reference< ::com::sun::star::ucb::XCommandEnvironment > () ); - aCnt.executeCommand( OUString::createFromAscii( "delete" ), makeAny( sal_Bool( sal_True ) ) ); + aCnt.executeCommand( OUString(RTL_CONSTASCII_USTRINGPARAM("delete")), makeAny( sal_Bool( sal_True ) ) ); } catch( ::com::sun::star::ucb::CommandAbortedException& ) { @@ -295,9 +297,9 @@ Sequence < OUString > UCBContentHelper::GetFolderContents( const String& rFolder uno::Reference< XResultSet > xResultSet; Sequence< OUString > aProps( bSorted ? 2 : 1 ); OUString* pProps = aProps.getArray(); - pProps[0] = OUString::createFromAscii( "Title" ); + pProps[0] = OUString(RTL_CONSTASCII_USTRINGPARAM("Title")); if ( bSorted ) - pProps[1] = OUString::createFromAscii( "IsFolder" ); + pProps[1] = OUString(RTL_CONSTASCII_USTRINGPARAM("IsFolder")); try { @@ -314,7 +316,7 @@ Sequence < OUString > UCBContentHelper::GetFolderContents( const String& rFolder uno::Reference < com::sun::star::ucb::XAnyCompareFactory > xFactory; uno::Reference < XMultiServiceFactory > xMgr = getProcessServiceFactory(); uno::Reference < com::sun::star::ucb::XSortedDynamicResultSetFactory > xSRSFac( - xMgr->createInstance( ::rtl::OUString::createFromAscii("com.sun.star.ucb.SortedDynamicResultSetFactory") ), UNO_QUERY ); + xMgr->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.SortedDynamicResultSetFactory")) ), UNO_QUERY ); Sequence< com::sun::star::ucb::NumberedSortingInfo > aSortInfo( 2 ); com::sun::star::ucb::NumberedSortingInfo* pInfo = aSortInfo.getArray(); @@ -350,7 +352,7 @@ Sequence < OUString > UCBContentHelper::GetFolderContents( const String& rFolder { OUString aId = xContentAccess->queryContentIdentifierString(); OUString* pFile = new OUString( aId ); - pFiles->Insert( pFile, LIST_APPEND ); + pFiles->push_back( pFile ); } } catch( ::com::sun::star::ucb::CommandAbortedException& ) @@ -367,12 +369,12 @@ Sequence < OUString > UCBContentHelper::GetFolderContents( const String& rFolder if ( pFiles ) { - ULONG nCount = pFiles->Count(); + size_t nCount = pFiles->size(); Sequence < OUString > aRet( nCount ); OUString* pRet = aRet.getArray(); - for ( ULONG i = 0; i < nCount; ++i ) + for ( size_t i = 0; i < nCount; ++i ) { - OUString* pFile = pFiles->GetObject(i); + OUString* pFile = (*pFiles)[ i ]; pRet[i] = *( pFile ); delete pFile; } @@ -395,10 +397,10 @@ Sequence < OUString > UCBContentHelper::GetResultSet( const String& rURL ) uno::Reference< com::sun::star::ucb::XDynamicResultSet > xDynResultSet; Sequence< OUString > aProps(3); OUString* pProps = aProps.getArray(); - pProps[0] = OUString::createFromAscii( "Title" ); - pProps[1] = OUString::createFromAscii( "ContentType" ); + pProps[0] = OUString(RTL_CONSTASCII_USTRINGPARAM("Title")); + pProps[1] = OUString(RTL_CONSTASCII_USTRINGPARAM("ContentType")); // TODO: can be optimized, property never used: - pProps[2] = OUString::createFromAscii( "IsFolder" ); + pProps[2] = OUString(RTL_CONSTASCII_USTRINGPARAM("IsFolder")); try { @@ -431,7 +433,7 @@ Sequence < OUString > UCBContentHelper::GetResultSet( const String& rURL ) aRow += '\t'; aRow += String( xContentAccess->queryContentIdentifierString() ); OUString* pRow = new OUString( aRow ); - pList->Insert( pRow, LIST_APPEND ); + pList->push_back( pRow ); } } catch( ::com::sun::star::ucb::CommandAbortedException& ) @@ -448,12 +450,12 @@ Sequence < OUString > UCBContentHelper::GetResultSet( const String& rURL ) if ( pList ) { - ULONG nCount = pList->Count(); + size_t nCount = pList->size(); Sequence < OUString > aRet( nCount ); OUString* pRet = aRet.getArray(); - for ( ULONG i = 0; i < nCount; ++i ) + for ( size_t i = 0; i < nCount; ++i ) { - OUString* pEntry = pList->GetObject(i); + OUString* pEntry = (*pList)[ i ]; pRet[i] = *( pEntry ); delete pEntry; } @@ -627,16 +629,16 @@ sal_Bool UCBContentHelper::HasParentFolder( const String& rFolder ) // ----------------------------------------------------------------------- -ULONG UCBContentHelper::GetSize( const String& rContent ) +sal_uLong UCBContentHelper::GetSize( const String& rContent ) { - ULONG nSize = 0; + sal_uLong nSize = 0; sal_Int64 nTemp = 0; INetURLObject aObj( rContent ); DBG_ASSERT( aObj.GetProtocol() != INET_PROT_NOT_VALID, "Invalid URL!" ); try { Content aCnt( aObj.GetMainURL( INetURLObject::NO_DECODE ), uno::Reference< ::com::sun::star::ucb::XCommandEnvironment > () ); - aCnt.getPropertyValue( OUString::createFromAscii( "Size" ) ) >>= nTemp; + aCnt.getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("Size")) ) >>= nTemp; } catch( ::com::sun::star::ucb::CommandAbortedException& ) { @@ -644,7 +646,7 @@ ULONG UCBContentHelper::GetSize( const String& rContent ) catch( ::com::sun::star::uno::Exception& ) { } - nSize = (UINT32)nTemp; + nSize = (sal_uInt32)nTemp; return nSize; } @@ -662,11 +664,11 @@ sal_Bool UCBContentHelper::IsYounger( const String& rIsYoung, const String& rIsO uno::Reference< ::com::sun::star::ucb::XCommandEnvironment > aCmdEnv; Content aYoung( aYoungObj.GetMainURL( INetURLObject::NO_DECODE ), aCmdEnv ); ::com::sun::star::util::DateTime aTempYoungDate; - aYoung.getPropertyValue( OUString::createFromAscii( "DateModified" ) ) >>= aTempYoungDate; + aYoung.getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("DateModified")) ) >>= aTempYoungDate; CONVERT_DATETIME( aTempYoungDate, aYoungDate ); Content aOlder( aOlderObj.GetMainURL( INetURLObject::NO_DECODE ), aCmdEnv ); ::com::sun::star::util::DateTime aTempOlderDate; - aOlder.getPropertyValue( OUString::createFromAscii( "DateModified" ) ) >>= aTempOlderDate; + aOlder.getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("DateModified")) ) >>= aTempOlderDate; CONVERT_DATETIME( aTempOlderDate, aOlderDate ); } catch( ::com::sun::star::ucb::CommandAbortedException& ) @@ -680,9 +682,9 @@ sal_Bool UCBContentHelper::IsYounger( const String& rIsYoung, const String& rIsO } // ----------------------------------------------------------------------- -sal_Bool UCBContentHelper::Find( const String& rFolder, const String& rName, String& rFile, BOOL bAllowWildCards ) +sal_Bool UCBContentHelper::Find( const String& rFolder, const String& rName, String& rFile, sal_Bool bAllowWildCards ) { - BOOL bWild = bAllowWildCards && ( rName.Search( '*' ) != STRING_NOTFOUND || rName.Search( '?' ) != STRING_NOTFOUND ); + sal_Bool bWild = bAllowWildCards && ( rName.Search( '*' ) != STRING_NOTFOUND || rName.Search( '?' ) != STRING_NOTFOUND ); sal_Bool bRet = sal_False; @@ -690,7 +692,7 @@ sal_Bool UCBContentHelper::Find( const String& rFolder, const String& rName, Str Sequence< ::rtl::OUString > aFiles = GetFolderContents( rFolder, sal_False ); const ::rtl::OUString* pFiles = aFiles.getConstArray(); - UINT32 i, nCount = aFiles.getLength(); + sal_uInt32 i, nCount = aFiles.getLength(); for ( i = 0; i < nCount; ++i ) { // get the last name of the URLs and compare it with rName @@ -741,7 +743,7 @@ sal_Bool UCBContentHelper::Exists( const String& rURL ) Sequence< ::rtl::OUString > aFiles = GetFolderContents( aObj.GetMainURL( INetURLObject::NO_DECODE ), sal_True, sal_False ); const ::rtl::OUString* pFiles = aFiles.getConstArray(); - UINT32 i, nCount = aFiles.getLength(); + sal_uInt32 i, nCount = aFiles.getLength(); for ( i = 0; i < nCount; ++i ) { // get the last name of the URLs and compare it with rName @@ -760,18 +762,18 @@ sal_Bool UCBContentHelper::Exists( const String& rURL ) } // ----------------------------------------------------------------------- -sal_Bool UCBContentHelper::FindInPath( const String& rPath, const String& rName, String& rFile, char cDelim, BOOL bAllowWildCards ) +sal_Bool UCBContentHelper::FindInPath( const String& rPath, const String& rName, String& rFile, char cDelim, sal_Bool bAllowWildCards ) { // extract the single folder names from the path variable and try to find the file in one of these folders - USHORT nTokenCount = rPath.GetTokenCount( cDelim ); - for ( USHORT nToken = 0; nToken < nTokenCount; ++nToken ) + sal_uInt16 nTokenCount = rPath.GetTokenCount( cDelim ); + for ( sal_uInt16 nToken = 0; nToken < nTokenCount; ++nToken ) { String aPath = rPath.GetToken( nToken, cDelim ); if ( Find( aPath, rName, rFile, bAllowWildCards ) ) - return TRUE; + return sal_True; } - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- @@ -912,7 +914,7 @@ sal_Bool UCBContentHelper::EqualURLs( const ::rtl::OUString& aFirstURL, const :: } catch( uno::Exception& ) { - OSL_ENSURE( sal_False, "Can't compare URL's, treat as different!\n" ); + OSL_FAIL( "Can't compare URL's, treat as different!\n" ); } } } diff --git a/unotools/source/ucbhelper/ucblockbytes.cxx b/unotools/source/ucbhelper/ucblockbytes.cxx index 272412d39fe2..c95608c3faaf 100644 --- a/unotools/source/ucbhelper/ucblockbytes.cxx +++ b/unotools/source/ucbhelper/ucblockbytes.cxx @@ -118,7 +118,6 @@ class UcbStreamer_Impl : public ::cppu::WeakImplHelper2< XActiveDataStreamer, XA UcbLockBytesRef m_xLockBytes; public: - UcbStreamer_Impl( UcbLockBytes* pLockBytes ) : m_xLockBytes( pLockBytes ) {} @@ -170,7 +169,6 @@ public: , m_xProgressHandler( rxProgressHandler ) {} - virtual Reference<XInteractionHandler> SAL_CALL getInteractionHandler() throw (RuntimeException) { return m_xInteractionHandler; } @@ -201,7 +199,7 @@ void SAL_CALL UcbPropertiesChangeListener_Impl::propertiesChange ( const Sequenc for (i = 0; i < n; i++) { PropertyChangeEvent evt (rEvent[i]); - if (evt.PropertyName == ::rtl::OUString::createFromAscii ("DocumentHeader")) + if (evt.PropertyName == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM ("DocumentHeader"))) { Sequence<DocumentHeaderField> aHead; if (evt.NewValue >>= aHead) @@ -226,12 +224,12 @@ void SAL_CALL UcbPropertiesChangeListener_Impl::propertiesChange ( const Sequenc m_xLockBytes->SetStreamValid_Impl(); } - else if (evt.PropertyName == rtl::OUString::createFromAscii ("PresentationURL")) + else if (evt.PropertyName == rtl::OUString(RTL_CONSTASCII_USTRINGPARAM ("PresentationURL"))) { ::rtl::OUString aUrl; if (evt.NewValue >>= aUrl) { - ::rtl::OUString aBad (::rtl::OUString::createFromAscii ("private:")); + ::rtl::OUString aBad (RTL_CONSTASCII_USTRINGPARAM ("private:")); if (!(aUrl.compareTo (aBad, aBad.getLength()) == 0)) { // URL changed (Redirection). @@ -239,7 +237,7 @@ void SAL_CALL UcbPropertiesChangeListener_Impl::propertiesChange ( const Sequenc } } } - else if (evt.PropertyName == ::rtl::OUString::createFromAscii ("MediaType")) + else if (evt.PropertyName == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM ("MediaType"))) { ::rtl::OUString aContentType; if (evt.NewValue >>= aContentType) @@ -259,7 +257,6 @@ class Moderator // returns. This would imply that these class must be refcounted !!! public: - Moderator( Reference < XContent >& xContent, Reference < XInteractionHandler >& xInteract, @@ -300,7 +297,6 @@ public: : public salhelper::Condition { public: - ConditionRes(osl::Mutex& aMutex,Moderator& aModerator) : salhelper::Condition(aMutex), m_aModerator(aModerator) @@ -308,13 +304,11 @@ public: } protected: - bool applies() const { return m_aModerator.m_aResultType != NORESULT; } private: - Moderator& m_aModerator; }; @@ -325,10 +319,8 @@ public: sal_Int32 ioErrorCode; }; - Result getResult(const sal_uInt32 milliSec); - enum ReplyType { NOREPLY, EXIT, @@ -336,12 +328,10 @@ public: REQUESTHANDLED }; - class ConditionRep : public salhelper::Condition { public: - ConditionRep(osl::Mutex& aMutex,Moderator& aModerator) : salhelper::Condition(aMutex), m_aModerator(aModerator) @@ -349,40 +339,30 @@ public: } protected: - bool applies() const { return m_aModerator.m_aReplyType != NOREPLY; } private: - Moderator& m_aModerator; }; void setReply(ReplyType); - void handle( const Reference<XInteractionRequest >& Request ); - void push( const Any& Status ); - void update( const Any& Status ); - void pop( ); void setStream(const Reference< XStream >& aStream); - void setInputStream(const Reference<XInputStream> &rxInputStream); protected: - virtual void SAL_CALL run(); - virtual void SAL_CALL onTerminated(); private: - osl::Mutex m_aMutex; friend class ConditionRes; @@ -433,7 +413,6 @@ public: private: - Moderator& m_aModerator; osl::Mutex m_aMutex; @@ -441,7 +420,6 @@ private: }; - class ModeratorsActiveDataSink : public ::cppu::WeakImplHelper1<XActiveDataSink> { @@ -473,7 +451,6 @@ public: private: - Moderator& m_aModerator; osl::Mutex m_aMutex; Reference<XInputStream> m_xStream; @@ -557,7 +534,6 @@ class ModeratorsProgressHandler : public ::cppu::WeakImplHelper1<XProgressHandler> { public: - ModeratorsProgressHandler(Moderator &theModerator); ~ModeratorsProgressHandler(); @@ -574,7 +550,6 @@ public: private: - Moderator& m_aModerator; }; @@ -611,8 +586,6 @@ void SAL_CALL ModeratorsProgressHandler::pop( ) } - - ModeratorsInteractionHandler::ModeratorsInteractionHandler( Moderator &aModerator) : m_aModerator(aModerator) @@ -776,7 +749,6 @@ void Moderator::handle( const Reference<XInteractionRequest >& Request ) } - void Moderator::push( const Any& Status ) { { @@ -866,7 +838,6 @@ void Moderator::setInputStream(const Reference<XInputStream> &rxInputStream) } - void SAL_CALL Moderator::run() { ResultType aResultType; @@ -908,8 +879,6 @@ void SAL_CALL Moderator::run() } } - - void SAL_CALL Moderator::onTerminated() { { @@ -918,12 +887,10 @@ void SAL_CALL Moderator::onTerminated() delete this; } - /** Function for opening UCB contents synchronously, but with handled timeout; */ - static sal_Bool _UCBOpenContentSync( UcbLockBytesRef xLockBytes, Reference < XContent > xContent, @@ -956,10 +923,10 @@ static sal_Bool UCBOpenContentSync( aScheme = xContId->getContentProviderScheme(); // now determine wether we use a timeout or not; - if( ! aScheme.equalsIgnoreAsciiCaseAscii("http") && - ! aScheme.equalsIgnoreAsciiCaseAscii("https") && - ! aScheme.equalsIgnoreAsciiCaseAscii("vnd.sun.star.webdav") && - ! aScheme.equalsIgnoreAsciiCaseAscii("ftp")) + if( ! aScheme.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("http")) && + ! aScheme.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("https")) && + ! aScheme.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("vnd.sun.star.webdav")) && + ! aScheme.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("ftp"))) return _UCBOpenContentSync( xLockBytes,xContent,rArg,xSink,xInteract,xProgress,xHandler); @@ -1271,7 +1238,6 @@ static sal_Bool _UCBOpenContentSync( return ( bAborted || bException ); } - //---------------------------------------------------------------------------- UcbLockBytes::UcbLockBytes( UcbLockBytesHandler* pHandler ) : m_xInputStream (NULL) @@ -1282,7 +1248,7 @@ UcbLockBytes::UcbLockBytes( UcbLockBytesHandler* pHandler ) , m_bDontClose( sal_False ) , m_bStreamValid (sal_False) { - SetSynchronMode( TRUE ); + SetSynchronMode( sal_True ); } //---------------------------------------------------------------------------- @@ -1372,7 +1338,7 @@ sal_Bool UcbLockBytes::setInputStream_Impl( const Reference<XInputStream> &rxInp { Reference < XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory(); Reference< XOutputStream > rxTempOut = Reference < XOutputStream > ( - xFactory->createInstance ( ::rtl::OUString::createFromAscii( "com.sun.star.io.TempFile" ) ), + xFactory->createInstance ( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.io.TempFile")) ), UNO_QUERY ); if( rxTempOut.is() ) @@ -1411,7 +1377,7 @@ void UcbLockBytes::terminate_Impl() if ( GetError() == ERRCODE_NONE && !m_xInputStream.is() ) { - DBG_ERROR("No InputStream, but no error set!" ); + OSL_FAIL("No InputStream, but no error set!" ); SetError( ERRCODE_IO_NOTEXISTS ); } @@ -1420,13 +1386,13 @@ void UcbLockBytes::terminate_Impl() } //---------------------------------------------------------------------------- -void UcbLockBytes::SetSynchronMode (BOOL bSynchron) +void UcbLockBytes::SetSynchronMode (sal_Bool bSynchron) { SvLockBytes::SetSynchronMode (bSynchron); } //---------------------------------------------------------------------------- -ErrCode UcbLockBytes::ReadAt ( ULONG nPos, void *pBuffer, ULONG nCount, ULONG *pRead) const +ErrCode UcbLockBytes::ReadAt ( sal_uLong nPos, void *pBuffer, sal_uLong nCount, sal_uLong *pRead) const { if ( IsSynchronMode() ) { @@ -1485,13 +1451,13 @@ ErrCode UcbLockBytes::ReadAt ( ULONG nPos, void *pBuffer, ULONG nCount, ULONG *p rtl_copyMemory (pBuffer, aData.getConstArray(), nSize); if (pRead) - *pRead = ULONG(nSize); + *pRead = sal_uLong(nSize); return ERRCODE_NONE; } //---------------------------------------------------------------------------- -ErrCode UcbLockBytes::WriteAt ( ULONG nPos, const void *pBuffer, ULONG nCount, ULONG *pWritten) +ErrCode UcbLockBytes::WriteAt ( sal_uLong nPos, const void *pBuffer, sal_uLong nCount, sal_uLong *pWritten) { if ( pWritten ) *pWritten = 0; @@ -1535,16 +1501,25 @@ ErrCode UcbLockBytes::Flush() const Reference <XOutputStream > xOutputStream = getOutputStream_Impl(); if ( !xOutputStream.is() ) return ERRCODE_IO_CANTWRITE; - xOutputStream->flush(); + + try + { + xOutputStream->flush(); + } + catch( Exception ) + { + return ERRCODE_IO_CANTWRITE; + } + return ERRCODE_NONE; } //---------------------------------------------------------------------------- -ErrCode UcbLockBytes::SetSize (ULONG nNewSize) +ErrCode UcbLockBytes::SetSize (sal_uLong nNewSize) { SvLockBytesStat aStat; Stat( &aStat, (SvLockBytesStatFlag) 0 ); - ULONG nSize = aStat.nSize; + sal_uLong nSize = aStat.nSize; if ( nSize > nNewSize ) { @@ -1561,8 +1536,8 @@ ErrCode UcbLockBytes::SetSize (ULONG nNewSize) if ( nSize < nNewSize ) { - ULONG nDiff = nNewSize-nSize, nCount=0; - BYTE* pBuffer = new BYTE[ nDiff ]; + sal_uLong nDiff = nNewSize-nSize, nCount=0; + sal_uInt8* pBuffer = new sal_uInt8[ nDiff ]; memset(pBuffer, 0, nDiff); // initialize for enhanced security WriteAt( nSize, pBuffer, nDiff, &nCount ); delete[] pBuffer; @@ -1600,7 +1575,7 @@ ErrCode UcbLockBytes::Stat( SvLockBytesStat *pStat, SvLockBytesStatFlag) const try { - pStat->nSize = ULONG(xSeekable->getLength()); + pStat->nSize = sal_uLong(xSeekable->getLength()); } catch (IOException) { @@ -1667,7 +1642,7 @@ UcbLockBytesRef UcbLockBytes::CreateLockBytes( const Reference < XContent >& xCo aArgument.Referer = rReferer; Command aCommand; - aCommand.Name = ::rtl::OUString::createFromAscii ("post"); + aCommand.Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM ("post")); aCommand.Argument <<= aArgument; Reference< XProgressHandler > xProgressHdl = new ProgressHandler_Impl( LINK( &xLockBytes, UcbLockBytes, DataAvailHdl ) ); @@ -1682,7 +1657,7 @@ UcbLockBytesRef UcbLockBytes::CreateLockBytes( const Reference < XContent >& xCo if ( xLockBytes->GetError() == ERRCODE_NONE && ( bError || !xLockBytes->getInputStream().is() ) ) { - DBG_ERROR("No InputStream, but no error set!" ); + OSL_FAIL("No InputStream, but no error set!" ); xLockBytes->SetError( ERRCODE_IO_GENERAL ); } @@ -1707,7 +1682,7 @@ UcbLockBytesRef UcbLockBytes::CreateLockBytes( const Reference < XContent >& xCo { Reference < XCommandProcessor > xProcessor( xContent, UNO_QUERY ); Command aCommand; - aCommand.Name = ::rtl::OUString::createFromAscii("setPropertyValues"); + aCommand.Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("setPropertyValues")); aCommand.Handle = -1; /* unknown */ aCommand.Argument <<= rProps; xProcessor->execute( aCommand, 0, Reference < XCommandEnvironment >() ); @@ -1733,7 +1708,7 @@ UcbLockBytesRef UcbLockBytes::CreateLockBytes( const Reference < XContent >& xCo if ( xLockBytes->GetError() == ERRCODE_NONE && ( bError || !xLockBytes->getInputStream().is() ) ) { - DBG_ERROR("No InputStream, but no error set!" ); + OSL_FAIL("No InputStream, but no error set!" ); xLockBytes->SetError( ERRCODE_IO_GENERAL ); } diff --git a/unotools/source/ucbhelper/ucbstreamhelper.cxx b/unotools/source/ucbhelper/ucbstreamhelper.cxx index dc99c388594c..b6692e260940 100644 --- a/unotools/source/ucbhelper/ucbstreamhelper.cxx +++ b/unotools/source/ucbhelper/ucbstreamhelper.cxx @@ -72,7 +72,7 @@ static SvStream* lcl_CreateStream( const String& rFileName, StreamMode eOpenMode { // truncate is implemented with deleting the original file ::ucbhelper::Content aCnt( rFileName, Reference < XCommandEnvironment >() ); - aCnt.executeCommand( ::rtl::OUString::createFromAscii( "delete" ), makeAny( sal_Bool( sal_True ) ) ); + aCnt.executeCommand( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("delete")), makeAny( sal_Bool( sal_True ) ) ); } catch ( CommandAbortedException& ) @@ -103,7 +103,7 @@ static SvStream* lcl_CreateStream( const String& rFileName, StreamMode eOpenMode aInsertArg.ReplaceExisting = sal_False; Any aCmdArg; aCmdArg <<= aInsertArg; - aContent.executeCommand( ::rtl::OUString::createFromAscii( "insert" ), aCmdArg ); + aContent.executeCommand( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("insert")), aCmdArg ); } // it is NOT an error when the stream already exists and no truncation was desired diff --git a/unotools/source/ucbhelper/xtempfile.cxx b/unotools/source/ucbhelper/xtempfile.cxx index cbe09fcd7a0f..7883a3e85cb2 100644 --- a/unotools/source/ucbhelper/xtempfile.cxx +++ b/unotools/source/ucbhelper/xtempfile.cxx @@ -29,8 +29,6 @@ #include <XTempFile.hxx> #include <cppuhelper/factory.hxx> #include <cppuhelper/typeprovider.hxx> -#include <com/sun/star/registry/XRegistryKey.hpp> -#include <com/sun/star/beans/PropertyAttribute.hpp> #include <unotools/tempfile.hxx> #include <osl/file.hxx> #include <unotools/configmgr.hxx> @@ -486,43 +484,6 @@ throw ( ::css::uno::RuntimeException ) return ::cppu::createSingleComponentFactory( XTempFile_createInstance, getImplementationName_Static(), getSupportedServiceNames_Static() ); } -static sal_Bool writeInfo( void * pRegistryKey, - const ::rtl::OUString & rImplementationName, - ::css::uno::Sequence< ::rtl::OUString > const & rServiceNames ) -{ - ::rtl::OUString aKeyName( RTL_CONSTASCII_USTRINGPARAM ( "/" ) ); - aKeyName += rImplementationName; - aKeyName += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "/UNO/SERVICES" ) ); - - ::css::uno::Reference< ::css::registry::XRegistryKey > xKey; - try - { - xKey = static_cast< ::css::registry::XRegistryKey * >( - pRegistryKey )->createKey( aKeyName ); - } - catch ( ::css::registry::InvalidRegistryException const & ) - { - } - - if ( !xKey.is() ) - return sal_False; - - sal_Bool bSuccess = sal_True; - - for ( sal_Int32 n = 0; n < rServiceNames.getLength(); ++n ) - { - try - { - xKey->createKey( rServiceNames[ n ] ); - } - catch ( ::css::registry::InvalidRegistryException const & ) - { - bSuccess = sal_False; - break; - } - } - return bSuccess; -} // C functions to implement this as a component extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( @@ -532,21 +493,6 @@ extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnviron } /** - * This function creates an implementation section in the registry and another subkey - * for each supported service. - * @param pServiceManager generic uno interface providing a service manager - * @param pRegistryKey generic uno interface providing registry key to write - */ -extern "C" SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo( void* /*pServiceManager*/, void* pRegistryKey ) -{ - return pRegistryKey && - writeInfo (pRegistryKey, - OTempFileService::getImplementationName_Static(), - OTempFileService::getSupportedServiceNames_Static() ); -} - - -/** * This function is called to get service factories for an implementation. * @param pImplName name of implementation * @param pServiceManager generic uno interface providing a service manager to instantiate components diff --git a/unotools/util/makefile.mk b/unotools/util/makefile.mk index 9adb6d1466d1..dffbdf0b6953 100644 --- a/unotools/util/makefile.mk +++ b/unotools/util/makefile.mk @@ -93,3 +93,11 @@ $(MISC)$/$(SHL1TARGET).flt: makefile.mk @echo UpdateToConfig >> $@ @echo _Impl >> $@ + +ALLTAR : $(MISC)/utl.component + +$(MISC)/utl.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + utl.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt utl.component diff --git a/unotools/util/utl.component b/unotools/util/utl.component new file mode 100644 index 000000000000..8c8198741f55 --- /dev/null +++ b/unotools/util/utl.component @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* 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. +* +**********************************************************************--> + +<component loader="com.sun.star.loader.SharedLibrary" + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.io.comp.TempFile"> + <service name="com.sun.star.io.TempFile"/> + </implementation> +</component> |