summaryrefslogtreecommitdiff
path: root/svl
diff options
context:
space:
mode:
authorMathias Bauer <mba@openoffice.org>2009-10-12 11:49:13 +0200
committerMathias Bauer <mba@openoffice.org>2009-10-12 11:49:13 +0200
commit9a4d0581c72653e60562d1b8e2121772d21f8a9e (patch)
treec6c31d21be1d0489ecec6d49496d45cc4ebdfb50 /svl
parente0cea8e136b36724c6b1298e6546a4dbb8f09d00 (diff)
#i103496#: move SysLocale stuff to unotools
Diffstat (limited to 'svl')
-rw-r--r--svl/inc/flbytes.hxx174
-rw-r--r--svl/inc/misccfg.hxx75
-rw-r--r--svl/inc/svl/ondemand.hxx2
-rw-r--r--svl/inc/svl/syslocale.hxx78
-rw-r--r--svl/inc/svl/syslocaleoptions.hxx164
-rw-r--r--svl/prj/build.lst3
-rw-r--r--svl/source/config/ctloptions.cxx13
-rw-r--r--svl/source/config/itemholder2.cxx10
-rw-r--r--svl/source/config/languageoptions.cxx13
-rw-r--r--svl/source/config/makefile.mk4
-rw-r--r--svl/source/config/misccfg.cxx190
-rw-r--r--svl/source/config/syslocaleoptions.cxx632
-rw-r--r--svl/source/items/dtritem.cxx3
-rw-r--r--svl/source/items/style.cxx5
-rw-r--r--svl/source/misc/flbytes.cxx432
-rw-r--r--svl/source/misc/makefile.mk1
-rw-r--r--svl/source/misc/restrictedpaths.cxx2
-rw-r--r--svl/source/numbers/numfmuno.cxx1
-rw-r--r--svl/source/numbers/supservs.cxx1
-rw-r--r--svl/source/numbers/zforlist.cxx48
-rw-r--r--svl/source/svdde/ddecli.cxx10
-rw-r--r--svl/source/syslocale/makefile.mk48
-rw-r--r--svl/source/syslocale/syslocale.cxx176
-rw-r--r--svl/util/makefile.mk2
24 files changed, 46 insertions, 2041 deletions
diff --git a/svl/inc/flbytes.hxx b/svl/inc/flbytes.hxx
deleted file mode 100644
index 86c19191de2a..000000000000
--- a/svl/inc/flbytes.hxx
+++ /dev/null
@@ -1,174 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: flbytes.hxx,v $
- * $Revision: 1.3 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _FLBYTES_HXX
-#define _FLBYTES_HXX
-
-#include <tools/debug.hxx>
-#include <tools/stream.hxx>
-
-//============================================================================
-class SvFillLockBytes : public SvLockBytes
-{
- SvLockBytesRef xLockBytes;
- ULONG nFilledSize;
- BOOL bTerminated;
- BOOL bSync;
-public:
- TYPEINFO();
-
- SvFillLockBytes( SvLockBytes* pLockBytes );
- virtual ErrCode ReadAt(
- ULONG nPos, void* pBuffer, ULONG nCount, ULONG* pRead ) const;
- virtual ErrCode WriteAt(
- ULONG nPos, const void* pBuffer, ULONG nCount, ULONG* pWritten );
- virtual ErrCode Flush() const;
- virtual ErrCode SetSize( ULONG nSize );
- virtual ErrCode LockRegion( ULONG nPos, ULONG nCount, LockType );
- virtual ErrCode UnlockRegion( ULONG nPos, ULONG nCount, LockType );
- virtual ErrCode Stat( SvLockBytesStat*, SvLockBytesStatFlag ) const;
- ErrCode FillAppend( const void* pBuffer, ULONG nCount, ULONG *pWritten );
- ULONG Tell() const { return nFilledSize; }
- void Seek( ULONG nPos ) { nFilledSize = nPos; }
-
- void Terminate();
-};
-
-SV_DECL_IMPL_REF( SvFillLockBytes )
-
-//============================================================================
-class SvSyncLockBytes: public SvOpenLockBytes
-{
- SvAsyncLockBytesRef m_xAsyncLockBytes;
-
-public:
- TYPEINFO();
-
- /// Create a synchronous wrapper around existing asynchronous lock bytes.
- ///
- /// @param pTheAsyncLockBytes Must not be null.
- inline SvSyncLockBytes(SvAsyncLockBytes * pTheAsyncLockBytes);
-
- /// Create a synchronous wrapper around an existing stream.
- ///
- /// @descr This is like first creating asynchronous lock bytes around the
- /// stream and than creating a synchronous wrapper around the asynchronous
- /// lock bytes.
- ///
- /// @param pStream Must not be null.
- ///
- /// @param bOwner True if these lock bytes own the stream (delete it on
- /// destruction).
- SvSyncLockBytes(SvStream * pStream, BOOL bOwner):
- m_xAsyncLockBytes(new SvAsyncLockBytes(pStream, bOwner)) {}
-
- virtual const SvStream * GetStream() const
- { return m_xAsyncLockBytes->GetStream(); }
-
- virtual void SetSynchronMode(BOOL bSync = TRUE)
- { m_xAsyncLockBytes->SetSynchronMode(bSync); }
-
- virtual BOOL IsSynchronMode() const
- { return m_xAsyncLockBytes->IsSynchronMode(); }
-
- virtual ErrCode ReadAt(ULONG nPos, void * pBuffer, ULONG nCount,
- ULONG * pRead) const;
-
- virtual ErrCode WriteAt(ULONG nPos, const void * pBuffer, ULONG nCount,
- ULONG * pWritten);
-
- virtual ErrCode Flush() const { return m_xAsyncLockBytes->Flush(); }
-
- virtual ErrCode SetSize(ULONG nSize)
- { return m_xAsyncLockBytes->SetSize(nSize); }
-
- virtual ErrCode LockRegion(ULONG nPos, ULONG nCount, LockType eType)
- { return m_xAsyncLockBytes->LockRegion(nPos, nCount, eType); }
-
- virtual ErrCode UnlockRegion(ULONG nPos, ULONG nCount, LockType eType)
- { return m_xAsyncLockBytes->UnlockRegion(nPos, nCount, eType); }
-
- virtual ErrCode Stat(SvLockBytesStat * pStat, SvLockBytesStatFlag eFlag)
- const
- { return m_xAsyncLockBytes->Stat(pStat, eFlag); }
-
- virtual ErrCode FillAppend(const void * pBuffer, ULONG nCount,
- ULONG * pWritten)
- { return m_xAsyncLockBytes->FillAppend(pBuffer, nCount, pWritten); }
-
- virtual ULONG Tell() const { return m_xAsyncLockBytes->Tell(); }
-
- virtual ULONG Seek(ULONG nPos)
- { return m_xAsyncLockBytes->Seek(nPos); }
-
- virtual void Terminate() { m_xAsyncLockBytes->Terminate(); }
-};
-
-inline SvSyncLockBytes::SvSyncLockBytes(SvAsyncLockBytes *
- pTheAsyncLockBytes):
- m_xAsyncLockBytes(pTheAsyncLockBytes)
-{
- DBG_ASSERT(m_xAsyncLockBytes.Is(),
- "SvSyncLockBytes::SvSyncLockBytes(): Null");
-}
-
-SV_DECL_IMPL_REF(SvSyncLockBytes);
-
-//============================================================================
-struct SvCompositeLockBytes_Impl;
-class SvCompositeLockBytes : public SvLockBytes
-{
- SvCompositeLockBytes_Impl* pImpl;
-public:
- TYPEINFO();
-
- SvCompositeLockBytes( );
- ~SvCompositeLockBytes();
-
- void Append( SvLockBytes* pLockBytes, ULONG nPos, ULONG nOffset );
- ULONG RelativeOffset( ULONG nPos ) const;
- void SetIsPending( BOOL bSet );
- SvLockBytes* GetLastLockBytes() const;
-
- virtual ErrCode ReadAt(
- ULONG nPos, void* pBuffer, ULONG nCount, ULONG* pRead ) const;
- virtual ErrCode WriteAt(
- ULONG nPos, const void* pBuffer, ULONG nCount, ULONG* pWritten );
- virtual ErrCode Flush() const;
- virtual ErrCode SetSize( ULONG nSize );
- virtual ErrCode LockRegion( ULONG nPos, ULONG nCount, LockType );
- virtual ErrCode UnlockRegion( ULONG nPos, ULONG nCount, LockType );
- virtual ErrCode Stat( SvLockBytesStat*, SvLockBytesStatFlag ) const;
-};
-
-SV_DECL_IMPL_REF( SvCompositeLockBytes )
-
-
-#endif
diff --git a/svl/inc/misccfg.hxx b/svl/inc/misccfg.hxx
deleted file mode 100644
index 7b89361b7390..000000000000
--- a/svl/inc/misccfg.hxx
+++ /dev/null
@@ -1,75 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: misccfg.hxx,v $
- * $Revision: 1.5 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SFX_MISCCFG_HXX
-#define _SFX_MISCCFG_HXX
-
-#include "svl/svldllapi.h"
-#include "tools/solar.h"
-#include "unotools/configitem.hxx"
-
-/*--------------------------------------------------------------------
- Beschreibung:
- --------------------------------------------------------------------*/
-
-class SVL_DLLPUBLIC SfxMiscCfg : public utl::ConfigItem
-{
- BOOL bPaperSize; // printer warnings
- BOOL bPaperOrientation;
- BOOL bNotFound;
- sal_Int32 nYear2000; // two digit year representation
-
- const com::sun::star::uno::Sequence<rtl::OUString>& GetPropertyNames();
- void Load();
-
-public:
- SfxMiscCfg( );
- ~SfxMiscCfg( );
-
- virtual void Notify( const com::sun::star::uno::Sequence<rtl::OUString>& aPropertyNames);
- virtual void Commit();
-
- BOOL IsNotFoundWarning() const {return bNotFound;}
- void SetNotFoundWarning( BOOL bSet);
-
- BOOL IsPaperSizeWarning() const {return bPaperSize;}
- void SetPaperSizeWarning(BOOL bSet);
-
- BOOL IsPaperOrientationWarning() const {return bPaperOrientation;}
- void SetPaperOrientationWarning( BOOL bSet);
-
- // 0 ... 99
- sal_Int32 GetYear2000() const { return nYear2000; }
- void SetYear2000( sal_Int32 nSet );
-
-};
-
-#endif // _MISCCFG_HXX
-
-
diff --git a/svl/inc/svl/ondemand.hxx b/svl/inc/svl/ondemand.hxx
index 76fd9efe3672..3369f286b2cd 100644
--- a/svl/inc/svl/ondemand.hxx
+++ b/svl/inc/svl/ondemand.hxx
@@ -31,7 +31,7 @@
#ifndef INCLUDED_SVTOOLS_ONDEMAND_HXX
#define INCLUDED_SVTOOLS_ONDEMAND_HXX
-#include <svl/syslocale.hxx>
+#include <unotools/syslocale.hxx>
#include <i18npool/lang.h>
#include <unotools/localedatawrapper.hxx>
#include <unotools/calendarwrapper.hxx>
diff --git a/svl/inc/svl/syslocale.hxx b/svl/inc/svl/syslocale.hxx
deleted file mode 100644
index e655f2eb3006..000000000000
--- a/svl/inc/svl/syslocale.hxx
+++ /dev/null
@@ -1,78 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: syslocale.hxx,v $
- * $Revision: 1.3 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef INCLUDED_SVTOOLS_SYSLOCALE_HXX
-#define INCLUDED_SVTOOLS_SYSLOCALE_HXX
-
-#include "svl/svldllapi.h"
-#include <unotools/localedatawrapper.hxx>
-#include <unotools/charclass.hxx>
-#include <sal/types.h>
-
-
-class SvtSysLocale_Impl;
-namespace osl { class Mutex; }
-class LocaleDataWrapper;
-
-/**
- SvtSysLocale provides a refcounted single instance of an application wide
- <type>LocaleDataWrapper</type> and <type>CharClass</type> which always
- follow the locale as it is currently configured by the user. You may use
- it anywhere to access the locale data elements like decimal separator and
- simple date formatting and so on. Contructing and destructing a
- SvtSysLocale is not expensive as long as there is at least one instance
- left.
- */
-class SVL_DLLPUBLIC SvtSysLocale
-{
- friend class SvtSysLocale_Impl; // access to mutex
-
- static SvtSysLocale_Impl* pImpl;
- static sal_Int32 nRefCount;
-
- SVL_DLLPRIVATE static ::osl::Mutex& GetMutex();
-
-public:
- SvtSysLocale();
- ~SvtSysLocale();
-
- const LocaleDataWrapper& GetLocaleData() const;
- const CharClass& GetCharClass() const;
-
- /** It is safe to store the pointers locally and use them AS LONG AS THE
- INSTANCE OF SvtSysLocale LIVES!
- It is a faster access but be sure what you do!
- */
- const LocaleDataWrapper* GetLocaleDataPtr() const;
- const CharClass* GetCharClassPtr() const;
-
-};
-
-#endif // INCLUDED_SVTOOLS_SYSLOCALE_HXX
diff --git a/svl/inc/svl/syslocaleoptions.hxx b/svl/inc/svl/syslocaleoptions.hxx
deleted file mode 100644
index 4570f7453ec0..000000000000
--- a/svl/inc/svl/syslocaleoptions.hxx
+++ /dev/null
@@ -1,164 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: syslocaleoptions.hxx,v $
- * $Revision: 1.3 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef INCLUDED_SVTOOLS_SYSLOCALEOPTIONS_HXX
-#define INCLUDED_SVTOOLS_SYSLOCALEOPTIONS_HXX
-
-#include "svl/svldllapi.h"
-#include <sal/types.h>
-#include <rtl/ustring.hxx>
-#include <tools/solar.h>
-#include <tools/link.hxx>
-#include <i18npool/lang.h>
-#include <tools/string.hxx>
-#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;
-
-class SvtSysLocaleOptions_Impl;
-class SvtListener;
-namespace osl { class Mutex; }
-
-class SVL_DLLPUBLIC SvtSysLocaleOptions: public utl::detail::Options
-{
- static SvtSysLocaleOptions_Impl* pOptions;
- static sal_Int32 nRefCount;
-
- SVL_DLLPRIVATE static ::osl::Mutex& GetMutex();
-
-public:
-
- enum EOption
- {
- E_LOCALE,
- E_CURRENCY
- };
- SvtSysLocaleOptions();
- virtual ~SvtSysLocaleOptions();
-
- // ConfigItem methods
-
- sal_Bool IsModified();
- void Commit();
-
- /** Add a listener to react on config changes
- which are broadcasted in a SfxSimpleHint
- @return
- <TRUE/> if added
- <FALSE/> if not added
- */
- BOOL AddListener( SvtListener& );
- BOOL RemoveListener( SvtListener& );
-
- /** Block broadcasts and accumulate hints. This may be useful if, for
- example, the locale and currency are changed and the currency was
- empty before, since changing the locale with an empty currency does
- also broadcast a change hint for the currency which would result in
- two currency changes broadcasted.
-
- @param bBlock
- <TRUE/>: broadcasts are blocked until reversed.
- <FALSE/>: broadcasts are not blocked anymore. Pending hints are
- broadcasted if no other instance blocks the broadcast.
-
- @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
- broadcasted again.
- */
- void BlockBroadcasts( BOOL bBlock );
-
- // config value access methods
-
- /// The config string may be empty to denote the SYSTEM locale
- const ::rtl::OUString& GetLocaleConfigString() const;
- void SetLocaleConfigString( const ::rtl::OUString& rStr );
-
- /// The config string may be empty to denote the default currency of the locale
- const ::rtl::OUString& GetCurrencyConfigString() const;
- void SetCurrencyConfigString( const ::rtl::OUString& rStr );
- // determine whether the decimal separator defined in the keyboard layout is used
- // or the one approriate to the locale
- sal_Bool IsDecimalSeparatorAsLocale() const;
- void SetDecimalSeparatorAsLocale( sal_Bool bSet);
-
- // convenience methods
-
- /** Get the LanguageType of the current locale, may be LANGUAGE_SYSTEM if
- LocaleConfigString is empty. If you need the real locale used in the
- application, call Application::GetSettings().GetLanguage() instead */
- LanguageType GetLocaleLanguageType() const;
-
- /// Get currency abbreviation and locale from an USD-en-US or EUR-de-DE string
- static void GetCurrencyAbbrevAndLanguage(
- String& rAbbrev,
- LanguageType& eLang,
- const ::rtl::OUString& rConfigString );
-
- /// Create an USD-en-US or EUR-de-DE string
- static ::rtl::OUString CreateCurrencyConfigString(
- const String& rAbbrev,
- LanguageType eLang );
-
- void GetCurrencyAbbrevAndLanguage(
- String& rAbbrev,
- LanguageType& eLang ) const
- {
- GetCurrencyAbbrevAndLanguage( rAbbrev,
- eLang, GetCurrencyConfigString() );
- }
-
- void SetCurrencyAbbrevAndLanguage(
- const String& rAbbrev,
- LanguageType eLang )
- {
- SetCurrencyConfigString(
- CreateCurrencyConfigString(
- rAbbrev, eLang ) );
- }
-
- /** Set a link to a method to be called whenever the default currency
- changes. This can be only one method, and normally it is the static
- link method which calls SvNumberFormatter::SetDefaultSystemCurrency().
- This is needed because the number formatter isn't part of the svl light
- library, otherwise we could call SetDefaultSystemCurrency() directly.
- */
- static void SetCurrencyChangeLink( const Link& rLink );
- static const Link& GetCurrencyChangeLink();
-
- /** return the readonly state of the queried option. */
- sal_Bool IsReadOnly( EOption eOption ) const;
-};
-
-#endif // INCLUDED_SVTOOLS_SYSLOCALEOPTIONS_HXX
diff --git a/svl/prj/build.lst b/svl/prj/build.lst
index 52bc7f82b3cd..8dc6d831f850 100644
--- a/svl/prj/build.lst
+++ b/svl/prj/build.lst
@@ -13,10 +13,9 @@ sl svl\source\notify nmake - all sl_not sl_inc NULL
sl svl\source\numbers nmake - all sl_num sl_inc NULL
sl svl\source\svdde nmake - all sl__dde sl_inc NULL
sl svl\source\svsql nmake - all sl_sql sl_inc NULL
-sl svl\source\syslocale nmake - all sl_sysloc sl_inc NULL
sl svl\source\undo nmake - all sl_undo sl_inc NULL
sl svl\source\uno nmake - all sl_uno sl_inc NULL
-sl svl\util nmake - all sl_util sl_usdde.u sl_psdde.p sl_conf sl_filepick sl_file sl__item sl_mem sl__misc sl_not sl_num sl__dde sl_sql sl_sysloc sl_undo sl_uno NULL
+sl svl\util nmake - all sl_util sl_usdde.u sl_psdde.p sl_conf sl_filepick sl_file sl__item sl_mem sl__misc sl_not sl_num sl__dde sl_sql sl_undo sl_uno NULL
sl svl\source\fsstor nmake - all sl_fsstor sl_inc NULL
sl svl\source\passwordcontainer nmake - all sl_passcont sl_inc NULL
diff --git a/svl/source/config/ctloptions.cxx b/svl/source/config/ctloptions.cxx
index f2f82425e7de..a63944140672 100644
--- a/svl/source/config/ctloptions.cxx
+++ b/svl/source/config/ctloptions.cxx
@@ -42,9 +42,9 @@
#include <osl/mutex.hxx>
#include <vos/mutex.hxx>
#include <svl/smplhint.hxx>
-#include <vcl/svapp.hxx>
#include <rtl/instance.hxx>
-
+#include <tools/solarmutex.hxx>
+#include <unotools/syslocale.hxx>
#include <itemholder2.hxx>
using namespace ::com::sun::star;
@@ -309,7 +309,7 @@ void SvtCTLOptions_Impl::Load()
((eSystemLanguage != LANGUAGE_SYSTEM) && ( nWinScript & SCRIPTTYPE_COMPLEX ))) )
{
m_bCTLFontEnabled = sal_True;
- sal_uInt16 nLanguage = Application::GetSettings().GetLanguage();
+ sal_uInt16 nLanguage = SvtSysLocale().GetLanguage();
//enable sequence checking for the appropriate languages
m_bCTLSequenceChecking = m_bCTLRestricted = m_bCTLTypeAndReplace =
(MsLangId::needsSequenceChecking( nLanguage) ||
@@ -490,8 +490,11 @@ sal_Bool SvtCTLOptions::IsReadOnly(EOption eOption) const
--------------------------------------------------*/
void SvtCTLOptions::Notify( SfxBroadcaster&, const SfxHint& rHint )
{
- vos::OGuard aVclGuard( Application::GetSolarMutex() );
- Broadcast( rHint );
+ if ( ::tools::SolarMutex::Acquire() )
+ {
+ Broadcast( rHint );
+ ::tools::SolarMutex::Release();
+ }
}
// -----------------------------------------------------------------------------
diff --git a/svl/source/config/itemholder2.cxx b/svl/source/config/itemholder2.cxx
index f8fc8a8427e7..695c6598140c 100644
--- a/svl/source/config/itemholder2.cxx
+++ b/svl/source/config/itemholder2.cxx
@@ -41,8 +41,6 @@
#include <svl/cjkoptions.hxx>
#include <svl/ctloptions.hxx>
#include <svl/languageoptions.hxx>
-#include <misccfg.hxx>
-#include <svl/syslocaleoptions.hxx>
#include <unotools/options.hxx>
#include <tools/debug.hxx>
@@ -167,14 +165,6 @@ void ItemHolder2::impl_newItem(TItemInfo& rItem)
// capsulate CTL and CJL options ! rItem.pItem = new SvtLanguageOptions();
break;
- case E_MISCCFG :
-// no ref count rItem.pItem = new SfxMiscCfg();
- break;
-
- case E_SYSLOCALEOPTIONS :
- rItem.pItem = new SvtSysLocaleOptions();
- break;
-
default:
OSL_ASSERT(false);
break;
diff --git a/svl/source/config/languageoptions.cxx b/svl/source/config/languageoptions.cxx
index fa01996b6a82..20a74bbba28a 100644
--- a/svl/source/config/languageoptions.cxx
+++ b/svl/source/config/languageoptions.cxx
@@ -34,13 +34,13 @@
#include <svl/languageoptions.hxx>
#include <svl/cjkoptions.hxx>
#include <svl/ctloptions.hxx>
-#include <vcl/svapp.hxx>
#include <i18npool/mslangid.hxx>
#include <vos/mutex.hxx>
-#include <vcl/svapp.hxx>
#include <osl/mutex.hxx>
#include <rtl/instance.hxx>
#include <com/sun/star/i18n/ScriptType.hpp>
+#include <tools/solarmutex.hxx>
+#include <unotools/syslocale.hxx>
using namespace ::com::sun::star;
// global ----------------------------------------------------------------------
@@ -205,8 +205,11 @@ sal_Bool SvtLanguageOptions::IsReadOnly(SvtLanguageOptions::EOption eOption) con
--------------------------------------------------*/
void SvtLanguageOptions::Notify( SfxBroadcaster&, const SfxHint& rHint )
{
- vos::OGuard aVclGuard( Application::GetSolarMutex() );
- Broadcast( rHint );
+ if ( ::tools::SolarMutex::Acquire() )
+ {
+ Broadcast( rHint );
+ ::tools::SolarMutex::Release();
+ }
}
// -----------------------------------------------------------------------------
@@ -216,7 +219,7 @@ sal_uInt16 SvtLanguageOptions::GetScriptTypeOfLanguage( sal_uInt16 nLang )
if( LANGUAGE_DONTKNOW == nLang )
nLang = LANGUAGE_ENGLISH_US;
else if( LANGUAGE_SYSTEM == nLang )
- nLang = Application::GetSettings().GetLanguage();
+ nLang = SvtSysLocale().GetLanguage();
sal_Int16 nScriptType = MsLangId::getScriptType( nLang );
USHORT nScript;
diff --git a/svl/source/config/makefile.mk b/svl/source/config/makefile.mk
index e9beacce6a8e..82c4ae12828f 100644
--- a/svl/source/config/makefile.mk
+++ b/svl/source/config/makefile.mk
@@ -46,9 +46,7 @@ SLOFILES= \
$(SLO)$/cjkoptions.obj \
$(SLO)$/ctloptions.obj \
$(SLO)$/itemholder2.obj \
- $(SLO)$/languageoptions.obj \
- $(SLO)$/misccfg.obj \
- $(SLO)$/syslocaleoptions.obj
+ $(SLO)$/languageoptions.obj
# --- Targets ------------------------------------------------------
diff --git a/svl/source/config/misccfg.cxx b/svl/source/config/misccfg.cxx
deleted file mode 100644
index b7a9f230c849..000000000000
--- a/svl/source/config/misccfg.cxx
+++ /dev/null
@@ -1,190 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: misccfg.cxx,v $
- * $Revision: 1.9 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_svl.hxx"
-
-#include "misccfg.hxx"
-#include <svl/zforlist.hxx>
-#include <tools/debug.hxx>
-
-#include <rtl/logfile.hxx>
-
-
-#define DEFAULT_TAB 2000
-
-#define DEF_INCH 2540L
-#define DEF_RELTWIP 1440L
-
-using namespace rtl;
-using namespace com::sun::star::uno;
-
-#define C2U(cChar) OUString::createFromAscii(cChar)
-/*--------------------------------------------------------------------
- Beschreibung:
- --------------------------------------------------------------------*/
-SfxMiscCfg::SfxMiscCfg() :
- ConfigItem(C2U("Office.Common") ),
- bPaperSize(FALSE),
- bPaperOrientation (FALSE),
- bNotFound (FALSE),
- nYear2000( SvNumberFormatter::GetYear2000Default() )
-{
- RTL_LOGFILE_CONTEXT(aLog, "svl SfxMiscCfg::SfxMiscCfg()");
-
- Load();
-}
-/* -----------------------------02.03.01 15:31--------------------------------
-
- ---------------------------------------------------------------------------*/
-SfxMiscCfg::~SfxMiscCfg()
-{
-}
-/*--------------------------------------------------------------------
- Beschreibung:
- --------------------------------------------------------------------*/
-
-void SfxMiscCfg::SetNotFoundWarning( BOOL bSet)
-{
- if(bNotFound != bSet)
- SetModified();
- bNotFound = bSet;
-}
-
-/*--------------------------------------------------------------------
- Beschreibung:
- --------------------------------------------------------------------*/
-
-void SfxMiscCfg::SetPaperSizeWarning( BOOL bSet)
-{
- if(bPaperSize != bSet)
- SetModified();
- bPaperSize = bSet;
-}
-
-/*--------------------------------------------------------------------
- Beschreibung:
- --------------------------------------------------------------------*/
-void SfxMiscCfg::SetPaperOrientationWarning( BOOL bSet)
-{
- if(bPaperOrientation != bSet)
- SetModified();
- bPaperOrientation = bSet;
-}
-/*--------------------------------------------------------------------
- Beschreibung:
- --------------------------------------------------------------------*/
-
-void SfxMiscCfg::SetYear2000( sal_Int32 nSet )
-{
- if(nYear2000 != nSet)
- SetModified();
- nYear2000 = nSet;
-}
-/* -----------------------------02.03.01 15:31--------------------------------
-
- ---------------------------------------------------------------------------*/
-const Sequence<OUString>& SfxMiscCfg::GetPropertyNames()
-{
- static Sequence<OUString> aNames;
- if(!aNames.getLength())
- {
- static const char* aPropNames[] =
- {
- "Print/Warning/PaperSize", // 0
- "Print/Warning/PaperOrientation", // 1
- "Print/Warning/NotFound", // 2
- "DateFormat/TwoDigitYear", // 3
- };
- const int nCount = 4;
- aNames.realloc(nCount);
- OUString* pNames = aNames.getArray();
- for(int i = 0; i < nCount; i++)
- pNames[i] = OUString::createFromAscii(aPropNames[i]);
- }
- return aNames;
-}
-/* -----------------------------02.03.01 15:31--------------------------------
-
- ---------------------------------------------------------------------------*/
-void SfxMiscCfg::Load()
-{
- const Sequence<OUString>& aNames = GetPropertyNames();
- Sequence<Any> aValues = GetProperties(aNames);
- EnableNotification(aNames);
- const Any* pValues = aValues.getConstArray();
- DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed");
- if(aValues.getLength() == aNames.getLength())
- {
- for(int nProp = 0; nProp < aNames.getLength(); nProp++)
- {
- if(pValues[nProp].hasValue())
- {
- switch(nProp)
- {
- case 0: bPaperSize = *(sal_Bool*)pValues[nProp].getValue(); break; //"Print/Warning/PaperSize",
- case 1: bPaperOrientation = *(sal_Bool*)pValues[nProp].getValue(); break; //"Print/Warning/PaperOrientation",
- case 2: bNotFound = *(sal_Bool*)pValues[nProp].getValue() ; break; //"Print/Warning/NotFound",
- case 3: pValues[nProp] >>= nYear2000;break; //"DateFormat/TwoDigitYear",
- }
- }
- }
- }
-}
-/* -----------------------------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();
- Sequence<Any> aValues(aNames.getLength());
- Any* pValues = aValues.getArray();
-
- const Type& rType = ::getBooleanCppuType();
- for(int nProp = 0; nProp < aNames.getLength(); nProp++)
- {
- switch(nProp)
- {
- case 0: pValues[nProp].setValue(&bPaperSize, rType);break; //"Print/Warning/PaperSize",
- case 1: pValues[nProp].setValue(&bPaperOrientation, rType);break; //"Print/Warning/PaperOrientation",
- case 2: pValues[nProp].setValue(&bNotFound, rType);break; //"Print/Warning/NotFound",
- case 3: pValues[nProp] <<= nYear2000;break; //"DateFormat/TwoDigitYear",
- }
- }
- PutProperties(aNames, aValues);
-}
-
diff --git a/svl/source/config/syslocaleoptions.cxx b/svl/source/config/syslocaleoptions.cxx
deleted file mode 100644
index dc6f7d630d40..000000000000
--- a/svl/source/config/syslocaleoptions.cxx
+++ /dev/null
@@ -1,632 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: syslocaleoptions.cxx,v $
- * $Revision: 1.23 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_svl.hxx"
-
-#include <svl/syslocaleoptions.hxx>
-#include <broadcast.hxx>
-#include <listener.hxx>
-#include <svl/smplhint.hxx>
-#include <i18npool/mslangid.hxx>
-#include <tools/string.hxx>
-#include <rtl/ustrbuf.hxx>
-#include <rtl/instance.hxx>
-#include <unotools/configmgr.hxx>
-#include <unotools/configitem.hxx>
-#include <tools/debug.hxx>
-#include <com/sun/star/uno/Any.hxx>
-#include <com/sun/star/uno/Sequence.hxx>
-#include <vcl/settings.hxx>
-#include <vcl/svapp.hxx>
-
-#include <rtl/logfile.hxx>
-
-#include "itemholder2.hxx"
-
-
-#define CFG_READONLY_DEFAULT sal_False
-
-using namespace osl;
-using namespace utl;
-using namespace rtl;
-using namespace com::sun::star::uno;
-using namespace com::sun::star::lang;
-
-
-SvtSysLocaleOptions_Impl* SvtSysLocaleOptions::pOptions = NULL;
-sal_Int32 SvtSysLocaleOptions::nRefCount = 0;
-namespace
-{
- struct CurrencyChangeLink
- : public rtl::Static<Link, CurrencyChangeLink> {};
-}
-
-class SvtSysLocaleOptions_Impl : public utl::ConfigItem
-{
- OUString m_aLocaleString; // en-US or de-DE or empty for SYSTEM
- LanguageType m_eLocaleLanguageType; // same for convenience access
- OUString m_aCurrencyString; // USD-en-US or EUR-de-DE
- SvtBroadcaster m_aBroadcaster;
- ULONG m_nBlockedHint; // pending hints
- sal_Int32 m_nBroadcastBlocked; // broadcast only if this is 0
- sal_Bool m_bDecimalSeparator; //use decimal separator same as locale
-
-
- sal_Bool m_bROLocale;
- sal_Bool m_bROCurrency;
- sal_Bool m_bRODecimalSeparator;
-
- static const Sequence< /* const */ OUString > GetPropertyNames();
-
- void UpdateMiscSettings_Impl();
- ULONG ChangeLocaleSettings();
- void ChangeDefaultCurrency() const;
- void Broadcast( ULONG nHint );
-
-public:
- SvtSysLocaleOptions_Impl();
- virtual ~SvtSysLocaleOptions_Impl();
-
- virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames );
- virtual void Commit();
-
- const OUString& GetLocaleString() const
- { return m_aLocaleString; }
- void SetLocaleString( const OUString& rStr );
- LanguageType GetLocaleLanguageType() const
- { return m_eLocaleLanguageType; }
-
- const OUString& GetCurrencyString() const
- { return m_aCurrencyString; }
- void SetCurrencyString( const OUString& rStr );
-
- sal_Bool IsDecimalSeparatorAsLocale() const { return m_bDecimalSeparator;}
- void SetDecimalSeparatorAsLocale( sal_Bool bSet);
-
- SvtBroadcaster& GetBroadcaster()
- { return m_aBroadcaster; }
- void BlockBroadcasts( BOOL bBlock );
- sal_Bool IsReadOnly( SvtSysLocaleOptions::EOption eOption ) const;
-};
-
-
-#define ROOTNODE_SYSLOCALE OUString(RTL_CONSTASCII_USTRINGPARAM("Setup/L10N"))
-
-#define PROPERTYNAME_LOCALE OUString(RTL_CONSTASCII_USTRINGPARAM("ooSetupSystemLocale"))
-#define PROPERTYNAME_CURRENCY OUString(RTL_CONSTASCII_USTRINGPARAM("ooSetupCurrency"))
-#define PROPERTYNAME_DECIMALSEPARATOR OUString(RTL_CONSTASCII_USTRINGPARAM("DecimalSeparatorAsLocale"))
-
-#define PROPERTYHANDLE_LOCALE 0
-#define PROPERTYHANDLE_CURRENCY 1
-#define PROPERTYHANDLE_DECIMALSEPARATOR 2
-
-#define PROPERTYCOUNT 3
-
-const Sequence< OUString > SvtSysLocaleOptions_Impl::GetPropertyNames()
-{
- static const OUString pProperties[] =
- {
- PROPERTYNAME_LOCALE,
- PROPERTYNAME_CURRENCY,
- PROPERTYNAME_DECIMALSEPARATOR
- };
- static const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT );
- return seqPropertyNames;
-}
-
-
-// -----------------------------------------------------------------------
-
-SvtSysLocaleOptions_Impl::SvtSysLocaleOptions_Impl()
- : ConfigItem( ROOTNODE_SYSLOCALE )
- , m_nBlockedHint( 0 )
- , m_nBroadcastBlocked( 0 )
- , m_bDecimalSeparator( sal_True )
- , m_bROLocale(CFG_READONLY_DEFAULT)
- , m_bROCurrency(CFG_READONLY_DEFAULT)
- , m_bRODecimalSeparator(sal_False)
-
-{
- if ( !IsValidConfigMgr() )
- ChangeLocaleSettings(); // assume SYSTEM defaults during Setup
- else
- {
- const Sequence< OUString > aNames = GetPropertyNames();
- Sequence< Any > aValues = GetProperties( aNames );
- Sequence< sal_Bool > aROStates = GetReadOnlyStates( aNames );
- const Any* pValues = aValues.getConstArray();
- const sal_Bool* pROStates = aROStates.getConstArray();
- DBG_ASSERT( aValues.getLength() == aNames.getLength(), "GetProperties failed" );
- DBG_ASSERT( aROStates.getLength() == aNames.getLength(), "GetReadOnlyStates failed" );
- if ( aValues.getLength() == aNames.getLength() && aROStates.getLength() == aNames.getLength() )
- {
- for ( sal_Int32 nProp = 0; nProp < aNames.getLength(); nProp++ )
- {
- DBG_ASSERT( pValues[nProp].hasValue(), "property value missing" );
- if ( pValues[nProp].hasValue() )
- {
- switch ( nProp )
- {
- case PROPERTYHANDLE_LOCALE :
- {
- OUString aStr;
- if ( pValues[nProp] >>= aStr )
- m_aLocaleString = aStr;
- else
- {
- DBG_ERRORFILE( "Wrong property type!" );
- }
- m_bROLocale = pROStates[nProp];
- }
- break;
- case PROPERTYHANDLE_CURRENCY :
- {
- OUString aStr;
- if ( pValues[nProp] >>= aStr )
- m_aCurrencyString = aStr;
- else
- {
- DBG_ERRORFILE( "Wrong property type!" );
- }
- m_bROCurrency = pROStates[nProp];
- }
- break;
- case PROPERTYHANDLE_DECIMALSEPARATOR:
- {
- sal_Bool bValue = sal_Bool();
- if ( pValues[nProp] >>= bValue )
- m_bDecimalSeparator = bValue;
- else
- {
- DBG_ERRORFILE( "Wrong property type!" );
- }
- m_bRODecimalSeparator = pROStates[nProp];
- }
- break;
- default:
- DBG_ERRORFILE( "Wrong property type!" );
- }
- }
- }
- }
- UpdateMiscSettings_Impl();
- ChangeLocaleSettings();
- EnableNotification( aNames );
- }
-}
-
-
-SvtSysLocaleOptions_Impl::~SvtSysLocaleOptions_Impl()
-{
- if ( IsModified() )
- Commit();
-}
-
-
-void SvtSysLocaleOptions_Impl::BlockBroadcasts( BOOL bBlock )
-{
- if ( bBlock )
- ++m_nBroadcastBlocked;
- else if ( m_nBroadcastBlocked )
- {
- if ( --m_nBroadcastBlocked == 0 )
- Broadcast( 0 );
- }
-}
-
-sal_Bool SvtSysLocaleOptions_Impl::IsReadOnly( SvtSysLocaleOptions::EOption eOption ) const
-{
- sal_Bool bReadOnly = CFG_READONLY_DEFAULT;
- switch(eOption)
- {
- case SvtSysLocaleOptions::E_LOCALE :
- {
- bReadOnly = m_bROLocale;
- break;
- }
- case SvtSysLocaleOptions::E_CURRENCY :
- {
- bReadOnly = m_bROCurrency;
- break;
- }
- }
- return bReadOnly;
-}
-
-
-void SvtSysLocaleOptions_Impl::Broadcast( ULONG nHint )
-{
- if ( m_nBroadcastBlocked )
- m_nBlockedHint |= nHint;
- else
- {
- nHint |= m_nBlockedHint;
- m_nBlockedHint = 0;
- if ( nHint )
- {
- if ( nHint & SYSLOCALEOPTIONS_HINT_CURRENCY )
- ChangeDefaultCurrency();
- SfxSimpleHint aHint( nHint );
- GetBroadcaster().Broadcast( aHint );
- }
- }
-}
-
-
-void SvtSysLocaleOptions_Impl::Commit()
-{
- const Sequence< OUString > aOrgNames = GetPropertyNames();
- sal_Int32 nOrgCount = aOrgNames.getLength();
-
- Sequence< OUString > aNames( nOrgCount );
- Sequence< Any > aValues( nOrgCount );
-
- OUString* pNames = aNames.getArray();
- Any* pValues = aValues.getArray();
- sal_Int32 nRealCount = 0;
-
- for ( sal_Int32 nProp = 0; nProp < nOrgCount; nProp++ )
- {
- switch ( nProp )
- {
- case PROPERTYHANDLE_LOCALE :
- {
- if (!m_bROLocale)
- {
- pNames[nRealCount] = aOrgNames[nProp];
- pValues[nRealCount] <<= m_aLocaleString;
- ++nRealCount;
- }
- }
- break;
- case PROPERTYHANDLE_CURRENCY :
- {
- if (!m_bROLocale)
- {
- pNames[nRealCount] = aOrgNames[nProp];
- pValues[nRealCount] <<= m_aCurrencyString;
- ++nRealCount;
- }
- }
- break;
- case PROPERTYHANDLE_DECIMALSEPARATOR:
- if( !m_bRODecimalSeparator )
- {
- pNames[nRealCount] = aOrgNames[nProp];
- pValues[nRealCount] <<= m_bDecimalSeparator;
- ++nRealCount;
- }
- break;
- default:
- DBG_ERRORFILE( "invalid index to save a path" );
- }
- }
- aNames.realloc(nRealCount);
- aValues.realloc(nRealCount);
- PutProperties( aNames, aValues );
- ClearModified();
-}
-
-
-void SvtSysLocaleOptions_Impl::SetLocaleString( const OUString& rStr )
-{
- if (!m_bROLocale && rStr != m_aLocaleString )
- {
- m_aLocaleString = rStr;
- SetModified();
- ULONG nHint = SYSLOCALEOPTIONS_HINT_LOCALE;
- nHint |= ChangeLocaleSettings();
- Broadcast( nHint );
- }
-}
-
-
-ULONG SvtSysLocaleOptions_Impl::ChangeLocaleSettings()
-{
- // An empty config value denotes SYSTEM locale
- if ( m_aLocaleString.getLength() )
- m_eLocaleLanguageType = MsLangId::convertIsoStringToLanguage( m_aLocaleString );
- else
- m_eLocaleLanguageType = LANGUAGE_SYSTEM;
- ULONG nHint = 0;
- // new locale and no fixed currency => locale default currency might change
- if ( !m_aCurrencyString.getLength() )
- nHint |= SYSLOCALEOPTIONS_HINT_CURRENCY;
- return nHint;
-}
-
-
-void SvtSysLocaleOptions_Impl::SetCurrencyString( const OUString& rStr )
-{
- if (!m_bROCurrency && rStr != m_aCurrencyString )
- {
- m_aCurrencyString = rStr;
- SetModified();
- Broadcast( SYSLOCALEOPTIONS_HINT_CURRENCY );
- }
-}
-
-void SvtSysLocaleOptions_Impl::SetDecimalSeparatorAsLocale( sal_Bool bSet)
-{
- if(bSet != m_bDecimalSeparator)
- {
- m_bDecimalSeparator = bSet;
- SetModified();
- UpdateMiscSettings_Impl();
- }
-}
-
-
-void SvtSysLocaleOptions_Impl::ChangeDefaultCurrency() const
-{
- const Link& rLink = SvtSysLocaleOptions::GetCurrencyChangeLink();
- if ( rLink.IsSet() )
- rLink.Call( NULL );
-}
-
-
-void SvtSysLocaleOptions_Impl::Notify( const Sequence< rtl::OUString >& seqPropertyNames )
-{
- ULONG nHint = 0;
- Sequence< Any > seqValues = GetProperties( seqPropertyNames );
- Sequence< sal_Bool > seqROStates = GetReadOnlyStates( seqPropertyNames );
- sal_Int32 nCount = seqPropertyNames.getLength();
- for( sal_Int32 nProp = 0; nProp < nCount; ++nProp )
- {
- if( seqPropertyNames[nProp] == PROPERTYNAME_LOCALE )
- {
- DBG_ASSERT( seqValues[nProp].getValueTypeClass() == TypeClass_STRING, "Locale property type" );
- seqValues[nProp] >>= m_aLocaleString;
- m_bROLocale = seqROStates[nProp];
- nHint |= SYSLOCALEOPTIONS_HINT_LOCALE;
- nHint |= ChangeLocaleSettings();
- }
- else if( seqPropertyNames[nProp] == PROPERTYNAME_CURRENCY )
- {
- DBG_ASSERT( seqValues[nProp].getValueTypeClass() == TypeClass_STRING, "Currency property type" );
- seqValues[nProp] >>= m_aCurrencyString;
- m_bROCurrency = seqROStates[nProp];
- nHint |= SYSLOCALEOPTIONS_HINT_CURRENCY;
- }
- else if( seqPropertyNames[nProp] == PROPERTYNAME_DECIMALSEPARATOR )
- {
- seqValues[nProp] >>= m_bDecimalSeparator;
- m_bRODecimalSeparator = seqROStates[nProp];
- UpdateMiscSettings_Impl();
- }
- }
- if ( nHint )
- Broadcast( nHint );
-}
-/* -----------------10.02.2004 15:25-----------------
-
- --------------------------------------------------*/
-void SvtSysLocaleOptions_Impl::UpdateMiscSettings_Impl()
-{
- AllSettings aAllSettings( Application::GetSettings() );
- MiscSettings aMiscSettings = aAllSettings.GetMiscSettings();
- aMiscSettings.SetEnableLocalizedDecimalSep(m_bDecimalSeparator);
- aAllSettings.SetMiscSettings( aMiscSettings );
- Application::SetSettings( aAllSettings );
-}
-
-// ====================================================================
-
-SvtSysLocaleOptions::SvtSysLocaleOptions()
-{
- MutexGuard aGuard( GetMutex() );
- if ( !pOptions )
- {
- RTL_LOGFILE_CONTEXT(aLog, "svl ( ??? ) ::SvtSysLocaleOptions_Impl::ctor()");
- pOptions = new SvtSysLocaleOptions_Impl;
-
- ItemHolder2::holdConfigItem(E_SYSLOCALEOPTIONS);
- }
- ++nRefCount;
-}
-
-
-SvtSysLocaleOptions::~SvtSysLocaleOptions()
-{
- MutexGuard aGuard( GetMutex() );
- if ( !--nRefCount )
- {
- delete pOptions;
- pOptions = NULL;
- }
-}
-
-
-// static
-Mutex& SvtSysLocaleOptions::GetMutex()
-{
- static Mutex* pMutex = NULL;
- if( !pMutex )
- {
- MutexGuard aGuard( Mutex::getGlobalMutex() );
- if( !pMutex )
- {
- // #i77768# Due to a static reference in the toolkit lib
- // we need a mutex that lives longer than the svl library.
- // Otherwise the dtor would use a destructed mutex!!
- pMutex = new Mutex;
- }
- }
- return *pMutex;
-}
-
-
-sal_Bool SvtSysLocaleOptions::IsModified()
-{
- MutexGuard aGuard( GetMutex() );
- return pOptions->IsModified();
-}
-
-
-void SvtSysLocaleOptions::Commit()
-{
- MutexGuard aGuard( GetMutex() );
- pOptions->Commit();
-}
-
-
-BOOL SvtSysLocaleOptions::AddListener( SvtListener& rLst )
-{
- MutexGuard aGuard( GetMutex() );
- return rLst.StartListening( pOptions->GetBroadcaster() );
-}
-
-
-BOOL SvtSysLocaleOptions::RemoveListener( SvtListener& rLst )
-{
- MutexGuard aGuard( GetMutex() );
- return rLst.EndListening( pOptions->GetBroadcaster() );
-}
-
-
-void SvtSysLocaleOptions::BlockBroadcasts( BOOL bBlock )
-{
- MutexGuard aGuard( GetMutex() );
- pOptions->BlockBroadcasts( bBlock );
-}
-
-
-const OUString& SvtSysLocaleOptions::GetLocaleConfigString() const
-{
- MutexGuard aGuard( GetMutex() );
- return pOptions->GetLocaleString();
-}
-
-
-void SvtSysLocaleOptions::SetLocaleConfigString( const OUString& rStr )
-{
- MutexGuard aGuard( GetMutex() );
- pOptions->SetLocaleString( rStr );
-}
-
-
-const OUString& SvtSysLocaleOptions::GetCurrencyConfigString() const
-{
- MutexGuard aGuard( GetMutex() );
- return pOptions->GetCurrencyString();
-}
-
-
-void SvtSysLocaleOptions::SetCurrencyConfigString( const OUString& rStr )
-{
- MutexGuard aGuard( GetMutex() );
- pOptions->SetCurrencyString( rStr );
-}
-
-
-LanguageType SvtSysLocaleOptions::GetLocaleLanguageType() const
-{
- MutexGuard aGuard( GetMutex() );
- return pOptions->GetLocaleLanguageType();
-}
-
-/*-- 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() );
- pOptions->SetDecimalSeparatorAsLocale(bSet);
-}
-
-
-sal_Bool SvtSysLocaleOptions::IsReadOnly( EOption eOption ) const
-{
- MutexGuard aGuard( GetMutex() );
- return pOptions->IsReadOnly( eOption );
-}
-
-// static
-void SvtSysLocaleOptions::GetCurrencyAbbrevAndLanguage( String& rAbbrev,
- LanguageType& eLang, const ::rtl::OUString& rConfigString )
-{
- sal_Int32 nDelim = rConfigString.indexOf( '-' );
- if ( nDelim >= 0 )
- {
- rAbbrev = rConfigString.copy( 0, nDelim );
- String aIsoStr( rConfigString.copy( nDelim+1 ) );
- eLang = MsLangId::convertIsoStringToLanguage( aIsoStr );
- }
- else
- {
- rAbbrev = rConfigString;
- eLang = (rAbbrev.Len() ? LANGUAGE_NONE : LANGUAGE_SYSTEM);
- }
-}
-
-
-// static
-::rtl::OUString SvtSysLocaleOptions::CreateCurrencyConfigString(
- const String& rAbbrev, LanguageType eLang )
-{
- String aIsoStr( MsLangId::convertLanguageToIsoString( eLang ) );
- if ( aIsoStr.Len() )
- {
- ::rtl::OUStringBuffer aStr( rAbbrev.Len() + 1 + aIsoStr.Len() );
- aStr.append( rAbbrev.GetBuffer(), rAbbrev.Len() );
- aStr.append( sal_Unicode('-') );
- aStr.append( aIsoStr.GetBuffer(), aIsoStr.Len() );
- return aStr.makeStringAndClear();
- }
- else
- return rAbbrev;
-}
-
-
-// static
-void SvtSysLocaleOptions::SetCurrencyChangeLink( const Link& rLink )
-{
- MutexGuard aGuard( GetMutex() );
- DBG_ASSERT( !CurrencyChangeLink::get().IsSet(), "SvtSysLocaleOptions::SetCurrencyChangeLink: already set" );
- CurrencyChangeLink::get() = rLink;
-}
-
-
-// static
-const Link& SvtSysLocaleOptions::GetCurrencyChangeLink()
-{
- MutexGuard aGuard( GetMutex() );
- return CurrencyChangeLink::get();
-}
-
diff --git a/svl/source/items/dtritem.cxx b/svl/source/items/dtritem.cxx
index 32a7fdc1c60d..12d7828350bb 100644
--- a/svl/source/items/dtritem.cxx
+++ b/svl/source/items/dtritem.cxx
@@ -40,9 +40,6 @@
#include <tools/debug.hxx>
#include <tools/datetime.hxx>
#include <rtl/math.hxx>
-
-#include <vcl/svapp.hxx>
-
#include <svl/dtritem.hxx>
diff --git a/svl/source/items/style.cxx b/svl/source/items/style.cxx
index 7ed44f7a9694..756a2f7edc21 100644
--- a/svl/source/items/style.cxx
+++ b/svl/source/items/style.cxx
@@ -52,8 +52,7 @@
#include <svl/itemiter.hxx>
#include <svl/style.hxx>
#include <svl/svstdarr.hxx>
-#include <vcl/svapp.hxx>
-
+#include <unotools/syslocale.hxx>
#include <algorithm>
#define STYLESTREAM "SfxStyleSheets"
@@ -393,7 +392,7 @@ XubString SfxStyleSheetBase::GetDescription( SfxMapUnit eMetric )
const SfxPoolItem* pItem = aIter.FirstItem();
IntlWrapper aIntlWrapper(comphelper::getProcessServiceFactory(),
- Application::GetSettings().GetLanguage());
+ SvtSysLocale().GetLanguage());
while ( pItem )
{
XubString aItemPresentation;
diff --git a/svl/source/misc/flbytes.cxx b/svl/source/misc/flbytes.cxx
deleted file mode 100644
index b8a124f8ec3b..000000000000
--- a/svl/source/misc/flbytes.cxx
+++ /dev/null
@@ -1,432 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: flbytes.cxx,v $
- * $Revision: 1.6 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_svl.hxx"
-#include <vcl/svapp.hxx>
-#include <flbytes.hxx>
-
-#ifndef _SVSTDARR_ULONGS_DECL
-#define _SVSTDARR_ULONGS
-#include <svl/svstdarr.hxx>
-#undef _SVSTDARR_ULONGS
-#endif
-
-namespace unnamed_svl_flbytes {} using namespace unnamed_svl_flbytes;
- // unnamed namespaces don't work well yet
-
-//============================================================================
-namespace unnamed_svl_flbytes {
-
-inline ULONG MyMin( long a, long b )
-{
- return Max( long( Min( a , b ) ), 0L );
-}
-
-}
-
-//============================================================================
-//
-// SvFillLockBytes
-//
-//============================================================================
-
-TYPEINIT1(SvFillLockBytes, SvLockBytes);
-
-//============================================================================
-SvFillLockBytes::SvFillLockBytes( SvLockBytes* pLockBytes )
- : xLockBytes( pLockBytes ),
- nFilledSize( 0 ),
- bTerminated( FALSE )
-{
-}
-
-//============================================================================
-ErrCode SvFillLockBytes::ReadAt( ULONG nPos, void* pBuffer, ULONG nCount,
- ULONG *pRead ) const
-{
- if( bTerminated )
- return xLockBytes->ReadAt( nPos, pBuffer, nCount, pRead );
- else
- {
- ULONG nWanted = nPos + nCount;
- if( IsSynchronMode() )
- {
- while( nWanted > nFilledSize && !bTerminated )
- Application::Yield();
- return xLockBytes->ReadAt( nPos, pBuffer, nCount, pRead );
- }
- else
- {
- ULONG nRead = MyMin( nCount, long( nFilledSize ) - nPos );
- ULONG nErr = xLockBytes->ReadAt( nPos, pBuffer, nRead, pRead );
- return ( !nCount || nRead == nCount || nErr ) ?
- nErr : ERRCODE_IO_PENDING;
- }
- }
-}
-
-//============================================================================
-ErrCode SvFillLockBytes::WriteAt( ULONG nPos, const void* pBuffer,
- ULONG nCount, ULONG *pWritten )
-{
- if( bTerminated )
- return xLockBytes->WriteAt( nPos, pBuffer, nCount, pWritten );
- else
- {
- ULONG nWanted = nPos + nCount;
- if( IsSynchronMode() )
- {
- while( nWanted > nFilledSize && !bTerminated )
- Application::Yield();
- return xLockBytes->WriteAt( nPos, pBuffer, nCount, pWritten );
- }
- else
- {
- ULONG nRead = MyMin( nCount, long( nFilledSize ) - nPos );
- ULONG nErr = xLockBytes->WriteAt( nPos, pBuffer, nRead, pWritten );
- return ( !nCount || nRead == nCount || nErr ) ?
- nErr : ERRCODE_IO_PENDING;
- }
- }
-}
-
-//============================================================================
-ErrCode SvFillLockBytes::Flush() const
-{
- return xLockBytes->Flush( );
-}
-
-//============================================================================
-ErrCode SvFillLockBytes::SetSize( ULONG nSize )
-{
- return xLockBytes->SetSize( nSize );
-}
-
-//============================================================================
-ErrCode SvFillLockBytes::LockRegion( ULONG nPos, ULONG nCount, LockType eType)
-{
- return xLockBytes->LockRegion( nPos, nCount, eType );
-}
-
-//============================================================================
-ErrCode SvFillLockBytes::UnlockRegion(
- ULONG nPos, ULONG nCount, LockType eType)
-{
- return xLockBytes->UnlockRegion( nPos, nCount, eType );
-}
-
-//============================================================================
-ErrCode SvFillLockBytes::Stat(
- SvLockBytesStat* pStat, SvLockBytesStatFlag eFlag) const
-{
- return xLockBytes->Stat( pStat, eFlag );
-}
-
-//============================================================================
-ErrCode SvFillLockBytes::FillAppend( const void* pBuffer, ULONG nCount, ULONG *pWritten )
-{
- ErrCode nRet = xLockBytes->WriteAt(
- nFilledSize, pBuffer, nCount, pWritten );
- nFilledSize += *pWritten;
- return nRet;
-}
-
-//============================================================================
-void SvFillLockBytes::Terminate()
-{
- bTerminated = TRUE;
-}
-
-//============================================================================
-SV_DECL_IMPL_REF_LIST( SvLockBytes, SvLockBytes* )
-
-//============================================================================
-//
-// SvSyncLockBytes
-//
-//============================================================================
-
-TYPEINIT1(SvSyncLockBytes, SvOpenLockBytes);
-
-//============================================================================
-// virtual
-ErrCode SvSyncLockBytes::ReadAt(ULONG nPos, void * pBuffer, ULONG nCount,
- ULONG * pRead) const
-{
- for (ULONG nReadTotal = 0;;)
- {
- ULONG nReadCount = 0;
- ErrCode nError = m_xAsyncLockBytes->ReadAt(nPos, pBuffer, nCount,
- &nReadCount);
- nReadTotal += nReadCount;
- if (nError != ERRCODE_IO_PENDING || !IsSynchronMode())
- {
- if (pRead)
- *pRead = nReadTotal;
- return nError;
- }
- nPos += nReadCount;
- pBuffer = static_cast< sal_Char * >(pBuffer) + nReadCount;
- nCount -= nReadCount;
- Application::Yield();
- }
-}
-
-//============================================================================
-// virtual
-ErrCode SvSyncLockBytes::WriteAt(ULONG nPos, const void * pBuffer,
- ULONG nCount, ULONG * pWritten)
-{
- for (ULONG nWrittenTotal = 0;;)
- {
- ULONG nWrittenCount = 0;
- ErrCode nError = m_xAsyncLockBytes->WriteAt(nPos, pBuffer, nCount,
- &nWrittenCount);
- nWrittenTotal += nWrittenCount;
- if (nError != ERRCODE_IO_PENDING || !IsSynchronMode())
- {
- if (pWritten)
- *pWritten = nWrittenTotal;
- return nError;
- }
- nPos += nWrittenCount;
- pBuffer = static_cast< sal_Char const * >(pBuffer) + nWrittenCount;
- nCount -= nWrittenCount;
- Application::Yield();
- }
-}
-
-//============================================================================
-//
-// SvCompositeLockBytes
-//
-//============================================================================
-
-struct SvCompositeLockBytes_Impl
-{
- SvLockBytesMemberList aLockBytes;
- SvULongs aPositions;
- SvULongs aOffsets;
- BOOL bPending;
- ULONG RelativeOffset( ULONG nPos ) const;
- ErrCode ReadWrite_Impl(
- ULONG nPos, void* pBuffer, ULONG nCount, ULONG* pProcessed,
- BOOL bRead );
- SvCompositeLockBytes_Impl() : bPending( FALSE ){}
-};
-
-//============================================================================
-ULONG SvCompositeLockBytes_Impl::RelativeOffset( ULONG nPos ) const
-{
- const SvULongs& rPositions = aPositions;
- const SvULongs& rOffsets = aOffsets;
-
- USHORT nMinPos = 0;
- USHORT nListCount = rPositions.Count();
-
- // Erster Lockbytes, der bearbeitet werden muss
- while( nMinPos + 1 < nListCount && rPositions[ nMinPos + 1 ] <= nPos )
- nMinPos ++;
- ULONG nSectionStart = rPositions[ nMinPos ];
- if( nSectionStart > nPos )
- return ULONG_MAX;
- return rOffsets[ nMinPos ] + nPos - nSectionStart;
-}
-
-//============================================================================
-ErrCode SvCompositeLockBytes_Impl::ReadWrite_Impl(
- ULONG nPos, void* pBuffer, ULONG nCount, ULONG* pProcessed,
- BOOL bRead )
-{
- ErrCode nErr = ERRCODE_NONE;
- SvULongs& rPositions = aPositions;
- SvULongs& rOffsets = aOffsets;
- SvLockBytesMemberList& rLockBytes = aLockBytes;
-
- ULONG nBytes = nCount;
- USHORT nListCount = rPositions.Count();
- USHORT nMinPos = 0;
-
- // Erster Lockbytes, der bearbeitet werden muss
- while( nMinPos + 1 < nListCount && rPositions[ nMinPos + 1 ] <= nPos )
- nMinPos ++;
- ULONG nSectionStart = rPositions[ nMinPos ];
-
- if( nSectionStart > nPos )
- {
- // Es wird aus fuehrendem Leerbereich gearbeitet
- *pProcessed = 0;
- return ERRCODE_IO_CANTREAD;
- }
-
- ULONG nDone;
- while( nMinPos < nListCount )
- {
- ULONG nToProcess;
- ULONG nSectionStop;
- if( nMinPos + 1 < nListCount )
- {
- nSectionStop = rPositions[ nMinPos + 1 ];
- nToProcess = MyMin( long( nSectionStop ) - nPos, nBytes );
- }
- else
- {
- nToProcess = nBytes;
- nSectionStop = 0;
- }
- ULONG nAbsPos = nPos - nSectionStart + rOffsets[ nMinPos ];
- SvLockBytes* pLB = rLockBytes.GetObject( nMinPos );
- if( bRead )
- nErr = pLB->ReadAt( nAbsPos, pBuffer, nToProcess, &nDone );
- else
- nErr = pLB->WriteAt( nAbsPos, pBuffer, nToProcess, &nDone );
- nBytes -= nDone;
- if( nErr || nDone < nToProcess || !nBytes )
- {
- *pProcessed = nCount - nBytes;
- // Wenn aus dem letzten LockBytes nichts mehr gelesen wurde und
- // bPending gesetzt ist, Pending zurueck
- if( !nDone && nMinPos == nListCount - 1 )
- return bPending ? ERRCODE_IO_PENDING : nErr;
- else return nErr;
- }
- pBuffer = static_cast< sal_Char * >(pBuffer) + nDone;
- nPos += nDone;
- nSectionStart = nSectionStop;
- nMinPos++;
- }
- return nErr;
-}
-
-//============================================================================
-TYPEINIT1(SvCompositeLockBytes, SvLockBytes);
-
-//============================================================================
-SvCompositeLockBytes::SvCompositeLockBytes()
- : pImpl( new SvCompositeLockBytes_Impl )
-{
-}
-
-//============================================================================
-SvCompositeLockBytes::~SvCompositeLockBytes()
-{
- delete pImpl;
-}
-
-//============================================================================
-void SvCompositeLockBytes::SetIsPending( BOOL bSet )
-{
- pImpl->bPending = bSet;
-}
-
-//============================================================================
-ULONG SvCompositeLockBytes::RelativeOffset( ULONG nPos ) const
-{
- return pImpl->RelativeOffset( nPos );
-}
-
-//============================================================================
-ErrCode SvCompositeLockBytes::ReadAt(
- ULONG nPos, void* pBuffer, ULONG nCount, ULONG* pRead ) const
-{
- return pImpl->ReadWrite_Impl( nPos, pBuffer, nCount, pRead, TRUE );
-}
-
-//============================================================================
-ErrCode SvCompositeLockBytes::WriteAt(
- ULONG nPos, const void* pBuffer, ULONG nCount, ULONG* pWritten )
-{
- return pImpl->ReadWrite_Impl(
- nPos, const_cast< void * >(pBuffer), nCount, pWritten, FALSE );
-}
-
-//============================================================================
-ErrCode SvCompositeLockBytes::Flush() const
-{
- SvLockBytesMemberList& rLockBytes = pImpl->aLockBytes;
- ErrCode nErr = ERRCODE_NONE;
- for( USHORT nCount = (USHORT)rLockBytes.Count(); !nErr && nCount--; )
- nErr = rLockBytes.GetObject( nCount )->Flush();
- return nErr;
-}
-
-//============================================================================
-ErrCode SvCompositeLockBytes::SetSize( ULONG )
-{
- DBG_ERROR( "not implemented" );
- return ERRCODE_IO_NOTSUPPORTED;
-}
-
-//============================================================================
-ErrCode SvCompositeLockBytes::LockRegion( ULONG, ULONG, LockType )
-{
- DBG_ERROR( "not implemented" );
- return ERRCODE_IO_NOTSUPPORTED;
-}
-
-//============================================================================
-ErrCode SvCompositeLockBytes::UnlockRegion(
- ULONG, ULONG, LockType )
-{
- DBG_ERROR( "not implemented" );
- return ERRCODE_IO_NOTSUPPORTED;
-}
-
-//============================================================================
-ErrCode SvCompositeLockBytes::Stat(
- SvLockBytesStat* pStat, SvLockBytesStatFlag eFlag) const
-{
- USHORT nMax = pImpl->aPositions.Count() - 1;
-
- SvLockBytesStat aStat;
- ErrCode nErr = pImpl->aLockBytes.GetObject( nMax )->Stat( &aStat, eFlag );
- pStat->nSize = pImpl->aPositions[ nMax ] + aStat.nSize;
-
- return nErr;
-}
-
-//============================================================================
-void SvCompositeLockBytes::Append(
- SvLockBytes* pLockBytes, ULONG nPos, ULONG nOffset )
-{
- USHORT nCount = pImpl->aOffsets.Count();
- pImpl->aLockBytes.Insert( pLockBytes, nCount );
- pImpl->aPositions.Insert( nPos, nCount );
- pImpl->aOffsets.Insert( nOffset, nCount );
-}
-
-//============================================================================
-SvLockBytes* SvCompositeLockBytes::GetLastLockBytes() const
-{
- return pImpl->aLockBytes.Count() ?
- pImpl->aLockBytes.GetObject( pImpl->aLockBytes.Count() - 1 ) : 0;
-}
-
diff --git a/svl/source/misc/makefile.mk b/svl/source/misc/makefile.mk
index 93ebc7f9470c..adc659a7b60b 100644
--- a/svl/source/misc/makefile.mk
+++ b/svl/source/misc/makefile.mk
@@ -42,7 +42,6 @@ TARGET=misc
EXCEPTIONSFILES=\
$(SLO)$/documentlockfile.obj \
- $(SLO)$/flbytes.obj \
$(SLO)$/folderrestriction.obj \
$(SLO)$/fstathelper.obj \
$(SLO)$/lockfilecommon.obj \
diff --git a/svl/source/misc/restrictedpaths.cxx b/svl/source/misc/restrictedpaths.cxx
index 3c45d43bdd5b..9eda454604b1 100644
--- a/svl/source/misc/restrictedpaths.cxx
+++ b/svl/source/misc/restrictedpaths.cxx
@@ -36,7 +36,7 @@
#include <osl/process.h>
#include <tools/urlobj.hxx>
#include <unotools/localfilehelper.hxx>
-#include <svl/syslocale.hxx>
+#include <unotools/syslocale.hxx>
namespace svt
{
diff --git a/svl/source/numbers/numfmuno.cxx b/svl/source/numbers/numfmuno.cxx
index 65ea024a7e34..23f627834955 100644
--- a/svl/source/numbers/numfmuno.cxx
+++ b/svl/source/numbers/numfmuno.cxx
@@ -33,7 +33,6 @@
#ifndef GCC
#endif
-#include <vcl/svapp.hxx>
#include <tools/color.hxx>
#include <tools/debug.hxx>
#include <i18npool/mslangid.hxx>
diff --git a/svl/source/numbers/supservs.cxx b/svl/source/numbers/supservs.cxx
index 67b9170d59fc..7e4d8560dae7 100644
--- a/svl/source/numbers/supservs.cxx
+++ b/svl/source/numbers/supservs.cxx
@@ -36,7 +36,6 @@
#include <i18npool/mslangid.hxx>
#include <tools/debug.hxx>
#include <vos/mutex.hxx>
-#include <vcl/svapp.hxx>
#include <tools/stream.hxx>
#include <strmadpt.hxx>
#include "instrm.hxx"
diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx
index 76bc6bad2bc0..eb867f67fb57 100644
--- a/svl/source/numbers/zforlist.cxx
+++ b/svl/source/numbers/zforlist.cxx
@@ -35,11 +35,6 @@
// #include <math.h>
#include <tools/debug.hxx>
-#ifndef _SOUND_HXX //autogen
-#include <vcl/sound.hxx>
-#endif
-#include <vcl/svapp.hxx>
-#include <vcl/settings.hxx>
#include <unotools/charclass.hxx>
#include <i18npool/mslangid.hxx>
#include <unotools/localedatawrapper.hxx>
@@ -48,6 +43,7 @@
#include <com/sun/star/i18n/KNumberFormatUsage.hpp>
#include <com/sun/star/i18n/KNumberFormatType.hpp>
#include <comphelper/processfactory.hxx>
+#include <unotools/misccfg.hxx>
#define _SVSTDARR_USHORTS
#include <svl/svstdarr.hxx>
@@ -62,7 +58,7 @@
#include <svl/zformat.hxx>
#include "numhead.hxx"
-#include <svl/syslocaleoptions.hxx>
+#include <unotools/syslocaleoptions.hxx>
#include "listener.hxx"
#include <svl/smplhint.hxx>
#include <unotools/digitgroupingiterator.hxx>
@@ -107,7 +103,7 @@ static sal_uInt32 __FAR_DATA theIndexTable[NF_INDEX_TABLE_ENTRIES];
also handles one instance of the SysLocale options
*/
-class SvNumberFormatterRegistry_Impl : public SvtListener
+class SvNumberFormatterRegistry_Impl : public utl::ConfigurationListener
{
List aFormatters;
SvtSysLocaleOptions aSysLocaleOptions;
@@ -124,30 +120,26 @@ public:
sal_uInt32 Count()
{ return aFormatters.Count(); }
- virtual void Notify( SvtBroadcaster& rBC, const SfxHint& rHint );
-
+ virtual void ConfigurationChanged( utl::ConfigurationBroadcaster* );
};
SvNumberFormatterRegistry_Impl::SvNumberFormatterRegistry_Impl()
{
eSysLanguage = MsLangId::getRealLanguage( LANGUAGE_SYSTEM );
- aSysLocaleOptions.AddListener( *this );
+ aSysLocaleOptions.AddListener( this );
}
SvNumberFormatterRegistry_Impl::~SvNumberFormatterRegistry_Impl()
{
- aSysLocaleOptions.RemoveListener( *this );
+ aSysLocaleOptions.RemoveListener( this );
}
-void SvNumberFormatterRegistry_Impl::Notify( SvtBroadcaster&, const SfxHint& rHint )
+void SvNumberFormatterRegistry_Impl::ConfigurationChanged( utl::ConfigurationBroadcaster* )
{
- const SfxSimpleHint* pHint = PTR_CAST( SfxSimpleHint, &rHint );
- if( pHint )
- {
- if ( pHint->GetId() & SYSLOCALEOPTIONS_HINT_LOCALE )
+ //if ( pHint->GetId() & SYSLOCALEOPTIONS_HINT_LOCALE )
{
::osl::MutexGuard aGuard( SvNumberFormatter::GetMutex() );
for ( SvNumberFormatter* p = (SvNumberFormatter*)aFormatters.First();
@@ -157,7 +149,7 @@ void SvNumberFormatterRegistry_Impl::Notify( SvtBroadcaster&, const SfxHint& rHi
}
eSysLanguage = MsLangId::getRealLanguage( LANGUAGE_SYSTEM );
}
- if ( pHint->GetId() & SYSLOCALEOPTIONS_HINT_CURRENCY )
+ //if ( pHint->GetId() & SYSLOCALEOPTIONS_HINT_CURRENCY )
{
::osl::MutexGuard aGuard( SvNumberFormatter::GetMutex() );
for ( SvNumberFormatter* p = (SvNumberFormatter*)aFormatters.First();
@@ -166,7 +158,6 @@ void SvNumberFormatterRegistry_Impl::Notify( SvtBroadcaster&, const SfxHint& rHi
p->ResetDefaultSystemCurrency();
}
}
- }
}
@@ -535,7 +526,6 @@ BOOL SvNumberFormatter::PutEntry(String& rString,
sal_uInt32 nPos = CLOffset + pStdFormat->GetLastInsertKey();
if (nPos - CLOffset >= SV_COUNTRY_LANGUAGE_OFFSET)
{
- Sound::Beep();
DBG_ERROR("SvNumberFormatter:: Zu viele Formate pro CL");
delete p_Entry;
}
@@ -601,15 +591,14 @@ sal_uInt32 SvNumberFormatter::GetIndexPuttingAndConverting( String & rString,
// #62389# empty format string (of Writer) => General standard format
if (!rString.Len())
; // nothing
- else if (eLnge == LANGUAGE_SYSTEM && eSysLnge !=
- Application::GetSettings().GetLanguage())
+ else if (eLnge == LANGUAGE_SYSTEM && eSysLnge != SvtSysLocale().GetLanguage())
{
sal_uInt32 nOrig = GetEntryKey( rString, eSysLnge );
if (nOrig == NUMBERFORMAT_ENTRY_NOT_FOUND)
nKey = nOrig; // none avaliable, maybe user-defined
else
- nKey = GetFormatForLanguageIfBuiltIn( nOrig,
- Application::GetSettings().GetLanguage());
+ nKey = GetFormatForLanguageIfBuiltIn( nOrig, SvtSysLocale().GetLanguage() );
+
if (nKey == nOrig)
{
// Not a builtin format, convert.
@@ -617,7 +606,7 @@ sal_uInt32 SvNumberFormatter::GetIndexPuttingAndConverting( String & rString,
// language and wouldn't match eSysLnge anymore, do that on a copy.
String aTmp( rString);
rNewInserted = PutandConvertEntrySystem( aTmp, rCheckPos, rType,
- nKey, eLnge, Application::GetSettings().GetLanguage());
+ nKey, eLnge, SvtSysLocale().GetLanguage());
if (rCheckPos > 0)
{
DBG_ERRORFILE("SvNumberFormatter::GetIndexPuttingAndConverting: bad format code string for current locale");
@@ -685,7 +674,7 @@ void SvNumberFormatter::SetFormatUsed(sal_uInt32 nFIndex)
BOOL SvNumberFormatter::Load( SvStream& rStream )
{
- LanguageType eSysLang = Application::GetSettings().GetLanguage();
+ LanguageType eSysLang = SvtSysLocale().GetLanguage();
SvNumberFormatter* pConverter = NULL;
ImpSvNumMultipleReadHeader aHdr( rStream );
@@ -894,7 +883,7 @@ BOOL SvNumberFormatter::Save( SvStream& rStream ) const
ImpSvNumMultipleWriteHeader aHdr( rStream );
// ab 364i wird gespeichert was SYSTEM wirklich war, vorher hart LANGUAGE_SYSTEM
rStream << (USHORT) SV_NUMBERFORMATTER_VERSION;
- rStream << (USHORT) Application::GetSettings().GetLanguage() << (USHORT) IniLnge;
+ rStream << (USHORT) SvtSysLocale().GetLanguage() << (USHORT) IniLnge;
SvNumberFormatTable* pTable = (SvNumberFormatTable*) &aFTable;
SvNumberformat* pEntry = (SvNumberformat*) pTable->First();
while (pEntry)
@@ -2900,7 +2889,6 @@ SvNumberFormatterIndexTable* SvNumberFormatter::MergeFormatter(SvNumberFormatter
nNewKey = nPos+1;
if (nPos - nCLOffset >= SV_COUNTRY_LANGUAGE_OFFSET)
{
- Sound::Beep();
DBG_ERROR(
"SvNumberFormatter:: Zu viele Formate pro CL");
delete pNewEntry;
@@ -3005,7 +2993,7 @@ USHORT SvNumberFormatter::ExpandTwoDigitYear( USHORT nYear ) const
// static
USHORT SvNumberFormatter::GetYear2000Default()
{
- return Application::GetSettings().GetMiscSettings().GetTwoDigitYearStart();
+ return (USHORT) ::utl::MiscCfg().GetYear2000();
}
@@ -3106,7 +3094,7 @@ void SvNumberFormatter::SetDefaultSystemCurrency( const String& rAbbrev, Languag
{
::osl::MutexGuard aGuard( GetMutex() );
if ( eLang == LANGUAGE_SYSTEM )
- eLang = Application::GetSettings().GetLanguage();
+ eLang = SvtSysLocale().GetLanguage();
const NfCurrencyTable& rTable = GetTheCurrencyTable();
USHORT nCount = rTable.Count();
const NfCurrencyEntryPtr* ppData = rTable.GetData();
@@ -3549,7 +3537,7 @@ void SvNumberFormatter::ImpInitCurrencyTable()
RTL_LOGFILE_CONTEXT_AUTHOR( aTimeLog, "svl", "er93726", "SvNumberFormatter::ImpInitCurrencyTable" );
- LanguageType eSysLang = Application::GetSettings().GetLanguage();
+ LanguageType eSysLang = SvtSysLocale().GetLanguage();
LocaleDataWrapper* pLocaleData = new LocaleDataWrapper(
::comphelper::getProcessServiceFactory(),
MsLangId::convertLanguageToLocale( eSysLang ) );
diff --git a/svl/source/svdde/ddecli.cxx b/svl/source/svdde/ddecli.cxx
index 3c224efe89a1..dd3c9c237f9a 100644
--- a/svl/source/svdde/ddecli.cxx
+++ b/svl/source/svdde/ddecli.cxx
@@ -38,7 +38,7 @@
#include <osl/thread.h>
#include <tools/debug.hxx>
-#include <vcl/svapp.hxx>
+#include <tools/solarmutex.hxx>
#include <vos/mutex.hxx>
// static DWORD hDdeInst = NULL;
@@ -367,9 +367,11 @@ const String& DdeTransaction::GetName() const
void __EXPORT DdeTransaction::Data( const DdeData* p )
{
- Application::GetSolarMutex().acquire();
- aData.Call( (void*)p );
- Application::GetSolarMutex().release();
+ if ( ::tools::SolarMutex::Acquire() )
+ {
+ aData.Call( (void*)p );
+ ::tools::SolarMutex::Release();
+ }
}
// --- DdeTransaction::Done() --------------------------------------
diff --git a/svl/source/syslocale/makefile.mk b/svl/source/syslocale/makefile.mk
deleted file mode 100644
index 1bb619a69ec3..000000000000
--- a/svl/source/syslocale/makefile.mk
+++ /dev/null
@@ -1,48 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2008 by Sun Microsystems, Inc.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# $RCSfile: makefile.mk,v $
-#
-# $Revision: 1.5 $
-#
-# 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=..$/..
-
-PRJNAME=svl
-TARGET=syslocale
-
-# --- Settings -----------------------------------------------------
-
-.INCLUDE : settings.mk
-.INCLUDE : $(PRJ)$/util$/svl.pmk
-
-# --- Files --------------------------------------------------------
-
-SLOFILES = \
- $(SLO)$/syslocale.obj
-
-# --- Targets ------------------------------------------------------
-
-.INCLUDE : target.mk
diff --git a/svl/source/syslocale/syslocale.cxx b/svl/source/syslocale/syslocale.cxx
deleted file mode 100644
index 074e900ea9ab..000000000000
--- a/svl/source/syslocale/syslocale.cxx
+++ /dev/null
@@ -1,176 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: syslocale.cxx,v $
- * $Revision: 1.11 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_svl.hxx"
-#ifndef GCC
-#endif
-
-#include <svl/syslocale.hxx>
-#include <broadcast.hxx>
-#include <listener.hxx>
-#include <svl/smplhint.hxx>
-#include <vcl/svapp.hxx>
-#include <tools/string.hxx>
-#include <svl/syslocaleoptions.hxx>
-#include <unotools/localedatawrapper.hxx>
-#include <comphelper/processfactory.hxx>
-
-
-using namespace osl;
-using namespace com::sun::star;
-
-
-SvtSysLocale_Impl* SvtSysLocale::pImpl = NULL;
-sal_Int32 SvtSysLocale::nRefCount = 0;
-
-
-class SvtSysLocale_Impl : public SvtListener
-{
- friend class SvtSysLocale;
-
- SvtSysLocaleOptions aSysLocaleOptions;
- LocaleDataWrapper* pLocaleData;
- CharClass* pCharClass;
-
-public:
- SvtSysLocale_Impl();
- virtual ~SvtSysLocale_Impl();
-
- virtual void Notify( SvtBroadcaster& rBC, const SfxHint& rHint );
-
- CharClass* GetCharClass();
-
-};
-
-
-// -----------------------------------------------------------------------
-
-SvtSysLocale_Impl::SvtSysLocale_Impl() : pCharClass(NULL)
-{
- const lang::Locale& rLocale = Application::GetSettings().GetLocale();
- pLocaleData = new LocaleDataWrapper(
- ::comphelper::getProcessServiceFactory(), rLocale );
- aSysLocaleOptions.AddListener( *this );
-}
-
-
-SvtSysLocale_Impl::~SvtSysLocale_Impl()
-{
- aSysLocaleOptions.RemoveListener( *this );
- delete pCharClass;
- delete pLocaleData;
-}
-
-CharClass* SvtSysLocale_Impl::GetCharClass()
-{
- if ( !pCharClass )
- {
- const lang::Locale& rLocale = Application::GetSettings().GetLocale();
- pCharClass = new CharClass(::comphelper::getProcessServiceFactory(), rLocale );
- }
- return pCharClass;
-}
-void SvtSysLocale_Impl::Notify( SvtBroadcaster&, const SfxHint& rHint )
-{
- const SfxSimpleHint* p = PTR_CAST( SfxSimpleHint, &rHint );
- if( p && (p->GetId() & SYSLOCALEOPTIONS_HINT_LOCALE) )
- {
- MutexGuard aGuard( SvtSysLocale::GetMutex() );
- const lang::Locale& rLocale = Application::GetSettings().GetLocale();
- pLocaleData->setLocale( rLocale );
- GetCharClass()->setLocale( rLocale );
- }
-}
-
-
-// ====================================================================
-
-SvtSysLocale::SvtSysLocale()
-{
- MutexGuard aGuard( GetMutex() );
- if ( !pImpl )
- pImpl = new SvtSysLocale_Impl;
- ++nRefCount;
-}
-
-
-SvtSysLocale::~SvtSysLocale()
-{
- MutexGuard aGuard( GetMutex() );
- if ( !--nRefCount )
- {
- delete pImpl;
- pImpl = NULL;
- }
-}
-
-
-// static
-Mutex& SvtSysLocale::GetMutex()
-{
- static Mutex* pMutex = NULL;
- if( !pMutex )
- {
- MutexGuard aGuard( Mutex::getGlobalMutex() );
- if( !pMutex )
- {
- // #i77768# Due to a static reference in the toolkit lib
- // we need a mutex that lives longer than the svl library.
- // Otherwise the dtor would use a destructed mutex!!
- pMutex = new Mutex;
- }
- }
- return *pMutex;
-}
-
-
-const LocaleDataWrapper& SvtSysLocale::GetLocaleData() const
-{
- return *(pImpl->pLocaleData);
-}
-
-
-const LocaleDataWrapper* SvtSysLocale::GetLocaleDataPtr() const
-{
- return pImpl->pLocaleData;
-}
-
-
-const CharClass& SvtSysLocale::GetCharClass() const
-{
- return *(pImpl->GetCharClass());
-}
-
-
-const CharClass* SvtSysLocale::GetCharClassPtr() const
-{
- return pImpl->GetCharClass();
-}
diff --git a/svl/util/makefile.mk b/svl/util/makefile.mk
index a8bdd52fd81c..522e1b3c0a3c 100644
--- a/svl/util/makefile.mk
+++ b/svl/util/makefile.mk
@@ -52,7 +52,6 @@ LIB2FILES= $(LB)$/_isvl.lib
LIB1TARGET= $(SLB)$/svl.lib
LIB1FILES= \
$(SLB)$/config.lib \
- $(SLB)$/syslocale.lib \
$(SLB)$/svdde.lib \
$(SLB)$/undo.lib \
$(SLB)$/numbers.lib \
@@ -69,7 +68,6 @@ LIB1FILES= \
RESLIB1NAME= $(RESTARGETSIMPLE)
RESLIB1SRSFILES=\
- $(SRS)$/items.srs \
$(SRS)$/misc.srs
# build the shared library --------------------------------------------------