diff options
author | Mathias Bauer <mba@openoffice.org> | 2009-10-12 11:49:13 +0200 |
---|---|---|
committer | Mathias Bauer <mba@openoffice.org> | 2009-10-12 11:49:13 +0200 |
commit | 9a4d0581c72653e60562d1b8e2121772d21f8a9e (patch) | |
tree | c6c31d21be1d0489ecec6d49496d45cc4ebdfb50 /svl/inc | |
parent | e0cea8e136b36724c6b1298e6546a4dbb8f09d00 (diff) |
#i103496#: move SysLocale stuff to unotools
Diffstat (limited to 'svl/inc')
-rw-r--r-- | svl/inc/flbytes.hxx | 174 | ||||
-rw-r--r-- | svl/inc/misccfg.hxx | 75 | ||||
-rw-r--r-- | svl/inc/svl/ondemand.hxx | 2 | ||||
-rw-r--r-- | svl/inc/svl/syslocale.hxx | 78 | ||||
-rw-r--r-- | svl/inc/svl/syslocaleoptions.hxx | 164 |
5 files changed, 1 insertions, 492 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 |