summaryrefslogtreecommitdiff
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
parente0cea8e136b36724c6b1298e6546a4dbb8f09d00 (diff)
#i103496#: move SysLocale stuff to unotools
-rw-r--r--svl/inc/flbytes.hxx174
-rw-r--r--svl/inc/svl/ondemand.hxx2
-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/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/util/makefile.mk2
-rw-r--r--unotools/inc/unotools/configitem.hxx1
-rw-r--r--unotools/inc/unotools/misccfg.hxx (renamed from svl/inc/misccfg.hxx)37
-rw-r--r--unotools/inc/unotools/options.hxx3
-rw-r--r--unotools/inc/unotools/syslocale.hxx (renamed from svl/inc/svl/syslocale.hxx)14
-rw-r--r--unotools/inc/unotools/syslocaleoptions.hxx (renamed from svl/inc/svl/syslocaleoptions.hxx)8
-rw-r--r--unotools/source/config/configitem.cxx1
-rw-r--r--unotools/source/config/itemholder1.cxx10
-rw-r--r--unotools/source/config/makefile.mk2
-rw-r--r--unotools/source/config/misccfg.cxx (renamed from svl/source/config/misccfg.cxx)134
-rw-r--r--unotools/source/config/options.cxx23
-rw-r--r--unotools/source/config/syslocaleoptions.cxx (renamed from svl/source/config/syslocaleoptions.cxx)78
-rw-r--r--unotools/source/config/undoopt.cxx4
-rw-r--r--unotools/source/config/useroptions.cxx4
-rw-r--r--unotools/source/misc/makefile.mk1
-rw-r--r--unotools/source/misc/syslocale.cxx (renamed from svl/source/syslocale/syslocale.cxx)91
-rw-r--r--vcl/inc/vcl/settings.hxx12
-rw-r--r--vcl/source/app/settings.cxx44
-rw-r--r--vcl/source/app/svapp.cxx1
-rw-r--r--vcl/source/control/field2.cxx7
-rw-r--r--vcl/win/source/window/salframe.cxx3
38 files changed, 364 insertions, 886 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/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/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/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/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 --------------------------------------------------
diff --git a/unotools/inc/unotools/configitem.hxx b/unotools/inc/unotools/configitem.hxx
index 2af7a089bb54..0e938cedd47f 100644
--- a/unotools/inc/unotools/configitem.hxx
+++ b/unotools/inc/unotools/configitem.hxx
@@ -88,7 +88,6 @@ namespace utl
com::sun::star::uno::Reference< com::sun::star::util::XChangesListener >
xChangeLstnr;
ConfigItem_Impl* pImpl;
- IMPL_ConfigurationListenerList* mpList;
ConfigItem();//
void RemoveChangesListener();
diff --git a/svl/inc/misccfg.hxx b/unotools/inc/unotools/misccfg.hxx
index 7b89361b7390..2a1383d307a5 100644
--- a/svl/inc/misccfg.hxx
+++ b/unotools/inc/unotools/misccfg.hxx
@@ -27,46 +27,41 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-#ifndef _SFX_MISCCFG_HXX
-#define _SFX_MISCCFG_HXX
+#ifndef _UTL_MISCCFG_HXX
+#define _UTL_MISCCFG_HXX
-#include "svl/svldllapi.h"
+#include "unotools/unotoolsdllapi.h"
#include "tools/solar.h"
-#include "unotools/configitem.hxx"
+#include "unotools/options.hxx"
/*--------------------------------------------------------------------
Beschreibung:
--------------------------------------------------------------------*/
-
-class SVL_DLLPUBLIC SfxMiscCfg : public utl::ConfigItem
+namespace utl
{
- BOOL bPaperSize; // printer warnings
- BOOL bPaperOrientation;
- BOOL bNotFound;
- sal_Int32 nYear2000; // two digit year representation
+ class SfxMiscCfg;
- const com::sun::star::uno::Sequence<rtl::OUString>& GetPropertyNames();
- void Load();
+class UNOTOOLS_DLLPUBLIC MiscCfg : public detail::Options
+{
+ SfxMiscCfg* pImpl;
public:
- SfxMiscCfg( );
- ~SfxMiscCfg( );
+ MiscCfg( );
+ virtual ~MiscCfg( );
- virtual void Notify( const com::sun::star::uno::Sequence<rtl::OUString>& aPropertyNames);
- virtual void Commit();
-
- BOOL IsNotFoundWarning() const {return bNotFound;}
+ BOOL IsNotFoundWarning() const;
void SetNotFoundWarning( BOOL bSet);
- BOOL IsPaperSizeWarning() const {return bPaperSize;}
+ BOOL IsPaperSizeWarning() const;
void SetPaperSizeWarning(BOOL bSet);
- BOOL IsPaperOrientationWarning() const {return bPaperOrientation;}
+ BOOL IsPaperOrientationWarning() const;
void SetPaperOrientationWarning( BOOL bSet);
// 0 ... 99
- sal_Int32 GetYear2000() const { return nYear2000; }
+ sal_Int32 GetYear2000() const;
void SetYear2000( sal_Int32 nSet );
+};
};
diff --git a/unotools/inc/unotools/options.hxx b/unotools/inc/unotools/options.hxx
index 6e3b40075a04..ca8d70657f0f 100644
--- a/unotools/inc/unotools/options.hxx
+++ b/unotools/inc/unotools/options.hxx
@@ -48,12 +48,15 @@ namespace utl {
class UNOTOOLS_DLLPUBLIC ConfigurationBroadcaster
{
IMPL_ConfigurationListenerList* mpList;
+ sal_Int32 m_nBroadcastBlocked; // broadcast only if this is 0
+
public:
void AddListener( utl::ConfigurationListener* pListener );
void RemoveListener( utl::ConfigurationListener* pListener );
void NotifyListeners();
ConfigurationBroadcaster();
~ConfigurationBroadcaster();
+ void BlockBroadcasts( bool bBlock );
};
namespace detail {
diff --git a/svl/inc/svl/syslocale.hxx b/unotools/inc/unotools/syslocale.hxx
index e655f2eb3006..87482abbb117 100644
--- a/svl/inc/svl/syslocale.hxx
+++ b/unotools/inc/unotools/syslocale.hxx
@@ -31,13 +31,15 @@
#ifndef INCLUDED_SVTOOLS_SYSLOCALE_HXX
#define INCLUDED_SVTOOLS_SYSLOCALE_HXX
-#include "svl/svldllapi.h"
+#include "unotools/unotoolsdllapi.h"
#include <unotools/localedatawrapper.hxx>
#include <unotools/charclass.hxx>
#include <sal/types.h>
-
+#include <i18npool/lang.h>
class SvtSysLocale_Impl;
+class SvtSysLocaleOptions;
+
namespace osl { class Mutex; }
class LocaleDataWrapper;
@@ -50,14 +52,14 @@ class LocaleDataWrapper;
SvtSysLocale is not expensive as long as there is at least one instance
left.
*/
-class SVL_DLLPUBLIC SvtSysLocale
+class UNOTOOLS_DLLPUBLIC SvtSysLocale
{
friend class SvtSysLocale_Impl; // access to mutex
static SvtSysLocale_Impl* pImpl;
static sal_Int32 nRefCount;
- SVL_DLLPRIVATE static ::osl::Mutex& GetMutex();
+ UNOTOOLS_DLLPRIVATE static ::osl::Mutex& GetMutex();
public:
SvtSysLocale();
@@ -72,7 +74,9 @@ public:
*/
const LocaleDataWrapper* GetLocaleDataPtr() const;
const CharClass* GetCharClassPtr() const;
-
+ SvtSysLocaleOptions& GetOptions() const;
+ com::sun::star::lang::Locale GetLocale() const;
+ LanguageType GetLanguage() const;
};
#endif // INCLUDED_SVTOOLS_SYSLOCALE_HXX
diff --git a/svl/inc/svl/syslocaleoptions.hxx b/unotools/inc/unotools/syslocaleoptions.hxx
index 4570f7453ec0..6c48c83a8500 100644
--- a/svl/inc/svl/syslocaleoptions.hxx
+++ b/unotools/inc/unotools/syslocaleoptions.hxx
@@ -31,7 +31,7 @@
#ifndef INCLUDED_SVTOOLS_SYSLOCALEOPTIONS_HXX
#define INCLUDED_SVTOOLS_SYSLOCALEOPTIONS_HXX
-#include "svl/svldllapi.h"
+#include "unotools/unotoolsdllapi.h"
#include <sal/types.h>
#include <rtl/ustring.hxx>
#include <tools/solar.h>
@@ -48,12 +48,12 @@ class SvtSysLocaleOptions_Impl;
class SvtListener;
namespace osl { class Mutex; }
-class SVL_DLLPUBLIC SvtSysLocaleOptions: public utl::detail::Options
+class UNOTOOLS_DLLPUBLIC SvtSysLocaleOptions: public utl::detail::Options
{
static SvtSysLocaleOptions_Impl* pOptions;
static sal_Int32 nRefCount;
- SVL_DLLPRIVATE static ::osl::Mutex& GetMutex();
+ UNOTOOLS_DLLPRIVATE static ::osl::Mutex& GetMutex();
public:
@@ -76,8 +76,6 @@ public:
<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
diff --git a/unotools/source/config/configitem.cxx b/unotools/source/config/configitem.cxx
index 38aee1b39d16..ad83b9b79cae 100644
--- a/unotools/source/config/configitem.cxx
+++ b/unotools/source/config/configitem.cxx
@@ -1427,3 +1427,4 @@ void ConfigItem::UnlockTree()
m_xHierarchyAccess = 0;
}
+
diff --git a/unotools/source/config/itemholder1.cxx b/unotools/source/config/itemholder1.cxx
index cf1194f6e652..214b5a9b4276 100644
--- a/unotools/source/config/itemholder1.cxx
+++ b/unotools/source/config/itemholder1.cxx
@@ -38,6 +38,7 @@
#include <comphelper/processfactory.hxx>
#include <com/sun/star/lang/XComponent.hpp>
+#include <unotools/misccfg.hxx>
#include <unotools/undoopt.hxx>
#include <unotools/useroptions.hxx>
#include <unotools/accelcfg.hxx>
@@ -70,6 +71,7 @@
#include <unotools/workingsetoptions.hxx>
#include <unotools/xmlaccelcfg.hxx>
#include <unotools/options.hxx>
+#include <unotools/syslocaleoptions.hxx>
//-----------------------------------------------
// namespaces
@@ -252,8 +254,8 @@ void ItemHolder1::impl_newItem(TItemInfo& rItem)
rItem.pItem = new SvtPrintWarningOptions();
break;
- case E_REGOPTIONS :
-// no ref count rItem.pItem = new ::utl::RegOptions();
+ case E_MISCCFG :
+ rItem.pItem = new ::utl::MiscCfg();
break;
case E_SAVEOPTIONS :
@@ -308,6 +310,10 @@ void ItemHolder1::impl_newItem(TItemInfo& rItem)
rItem.pItem = new SvtUserOptions();
break;
+ case E_SYSLOCALEOPTIONS :
+ rItem.pItem = new SvtSysLocaleOptions();
+ break;
+
default:
OSL_ASSERT( "unknown item type" );
break;
diff --git a/unotools/source/config/makefile.mk b/unotools/source/config/makefile.mk
index edc0c9f2ad4f..eee8d4af9d73 100644
--- a/unotools/source/config/makefile.mk
+++ b/unotools/source/config/makefile.mk
@@ -45,6 +45,7 @@ ENABLE_EXCEPTIONS=TRUE
# --- Files -------------------------------------
SLOFILES=\
+ $(SLO)$/syslocaleoptions.obj \
$(SLO)$/configvaluecontainer.obj \
$(SLO)$/confignode.obj \
$(SLO)$/configitem.obj \
@@ -69,6 +70,7 @@ SLOFILES=\
$(SLO)$/javaoptions.obj \
$(SLO)$/lingucfg.obj \
$(SLO)$/localisationoptions.obj \
+ $(SLO)$/misccfg.obj \
$(SLO)$/moduleoptions.obj \
$(SLO)$/options.obj \
$(SLO)$/optionsdlg.obj \
diff --git a/svl/source/config/misccfg.cxx b/unotools/source/config/misccfg.cxx
index b7a9f230c849..febb3610f6a2 100644
--- a/svl/source/config/misccfg.cxx
+++ b/unotools/source/config/misccfg.cxx
@@ -29,14 +29,19 @@
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_svl.hxx"
+#include "precompiled_unotools.hxx"
-#include "misccfg.hxx"
-#include <svl/zforlist.hxx>
+#include <unotools/misccfg.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 <vos/mutex.hxx>
+#include <osl/mutex.hxx>
#include <rtl/logfile.hxx>
-
+#include "itemholder1.hxx"
#define DEFAULT_TAB 2000
@@ -47,6 +52,45 @@ using namespace rtl;
using namespace com::sun::star::uno;
#define C2U(cChar) OUString::createFromAscii(cChar)
+
+namespace utl
+{
+
+static SfxMiscCfg* pOptions = NULL;
+static sal_Int32 nRefCount = 0;
+
+class 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 );
+
+};
+
/*--------------------------------------------------------------------
Beschreibung:
--------------------------------------------------------------------*/
@@ -55,7 +99,7 @@ SfxMiscCfg::SfxMiscCfg() :
bPaperSize(FALSE),
bPaperOrientation (FALSE),
bNotFound (FALSE),
- nYear2000( SvNumberFormatter::GetYear2000Default() )
+ nYear2000( 1930 )
{
RTL_LOGFILE_CONTEXT(aLog, "svl SfxMiscCfg::SfxMiscCfg()");
@@ -187,4 +231,82 @@ void SfxMiscCfg::Commit()
}
PutProperties(aNames, aValues);
}
+// -----------------------------------------------------------------------
+namespace
+{
+ class LocalSingleton : public rtl::Static< osl::Mutex, LocalSingleton >
+ {
+ };
+}
+
+MiscCfg::MiscCfg( )
+{
+ // Global access, must be guarded (multithreading)
+ ::osl::MutexGuard aGuard( LocalSingleton::get() );
+ if ( !pOptions )
+ {
+ RTL_LOGFILE_CONTEXT(aLog, "unotools ( ??? ) SfxMiscCfg::ctor()");
+ pOptions = new SfxMiscCfg;
+
+ ItemHolder1::holdConfigItem(E_MISCCFG);
+ }
+
+ ++nRefCount;
+ pImpl = pOptions;
+ pImpl->AddListener(this);
+}
+
+MiscCfg::~MiscCfg( )
+{
+ // Global access, must be guarded (multithreading)
+ ::osl::MutexGuard aGuard( LocalSingleton::get() );
+ pImpl->RemoveListener(this);
+ if ( !--nRefCount )
+ {
+ if ( pOptions->IsModified() )
+ pOptions->Commit();
+ DELETEZ( pOptions );
+ }
+}
+
+BOOL MiscCfg::IsNotFoundWarning() const
+{
+ return pImpl->IsNotFoundWarning();
+}
+
+void MiscCfg::SetNotFoundWarning( BOOL bSet)
+{
+ pImpl->SetNotFoundWarning( bSet );
+}
+
+BOOL MiscCfg::IsPaperSizeWarning() const
+{
+ return pImpl->IsPaperSizeWarning();
+}
+
+void MiscCfg::SetPaperSizeWarning(BOOL bSet)
+{
+ pImpl->SetPaperSizeWarning( bSet );
+}
+
+BOOL MiscCfg::IsPaperOrientationWarning() const
+{
+ return pImpl->IsPaperOrientationWarning();
+}
+
+void MiscCfg::SetPaperOrientationWarning( BOOL bSet)
+{
+ pImpl->SetPaperOrientationWarning( bSet );
+}
+
+sal_Int32 MiscCfg::GetYear2000() const
+{
+ return pImpl->GetYear2000();
+}
+
+void MiscCfg::SetYear2000( sal_Int32 nSet )
+{
+ pImpl->SetYear2000( nSet );
+}
+} \ No newline at end of file
diff --git a/unotools/source/config/options.cxx b/unotools/source/config/options.cxx
index eba75b347edf..b4e9aec8c6dd 100644
--- a/unotools/source/config/options.cxx
+++ b/unotools/source/config/options.cxx
@@ -45,6 +45,7 @@ using utl::ConfigurationBroadcaster;
ConfigurationBroadcaster::ConfigurationBroadcaster()
: mpList(0)
+, m_nBroadcastBlocked( 0 )
{
}
@@ -68,9 +69,15 @@ void ConfigurationBroadcaster::RemoveListener( utl::ConfigurationListener* pList
void ConfigurationBroadcaster::NotifyListeners()
{
- if ( mpList )
- for ( sal_uInt32 n=0; n<mpList->Count(); n++ )
- mpList->GetObject(n)->ConfigurationChanged(this);
+// if ( m_nBroadcastBlocked )
+// m_nBlockedHint |= nHint;
+// else
+ if (!m_nBroadcastBlocked)
+ {
+ if ( mpList )
+ for ( sal_uInt32 n=0; n<mpList->Count(); n++ )
+ mpList->GetObject(n)->ConfigurationChanged(this);
+ }
}
Options::Options()
@@ -86,3 +93,13 @@ void Options::ConfigurationChanged( utl::ConfigurationBroadcaster* )
NotifyListeners();
}
+void ConfigurationBroadcaster::BlockBroadcasts( bool bBlock )
+{
+ if ( bBlock )
+ ++m_nBroadcastBlocked;
+ else if ( m_nBroadcastBlocked )
+ {
+ if ( --m_nBroadcastBlocked == 0 )
+ NotifyListeners();
+ }
+}
diff --git a/svl/source/config/syslocaleoptions.cxx b/unotools/source/config/syslocaleoptions.cxx
index dc6f7d630d40..3815136b27f0 100644
--- a/svl/source/config/syslocaleoptions.cxx
+++ b/unotools/source/config/syslocaleoptions.cxx
@@ -29,12 +29,9 @@
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_svl.hxx"
+#include "precompiled_unotools.hxx"
-#include <svl/syslocaleoptions.hxx>
-#include <broadcast.hxx>
-#include <listener.hxx>
-#include <svl/smplhint.hxx>
+#include <unotools/syslocaleoptions.hxx>
#include <i18npool/mslangid.hxx>
#include <tools/string.hxx>
#include <rtl/ustrbuf.hxx>
@@ -44,12 +41,9 @@
#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"
+#include "itemholder1.hxx"
#define CFG_READONLY_DEFAULT sal_False
@@ -74,22 +68,17 @@ 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();
@@ -111,9 +100,6 @@ public:
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;
};
@@ -148,7 +134,6 @@ const Sequence< OUString > SvtSysLocaleOptions_Impl::GetPropertyNames()
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)
@@ -217,7 +202,7 @@ SvtSysLocaleOptions_Impl::SvtSysLocaleOptions_Impl()
}
}
}
- UpdateMiscSettings_Impl();
+// UpdateMiscSettings_Impl();
ChangeLocaleSettings();
EnableNotification( aNames );
}
@@ -231,17 +216,6 @@ SvtSysLocaleOptions_Impl::~SvtSysLocaleOptions_Impl()
}
-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;
@@ -262,7 +236,7 @@ sal_Bool SvtSysLocaleOptions_Impl::IsReadOnly( SvtSysLocaleOptions::EOption eOpt
}
-void SvtSysLocaleOptions_Impl::Broadcast( ULONG nHint )
+/*void SvtSysLocaleOptions_Impl::Broadcast( ULONG nHint )
{
if ( m_nBroadcastBlocked )
m_nBlockedHint |= nHint;
@@ -278,7 +252,7 @@ void SvtSysLocaleOptions_Impl::Broadcast( ULONG nHint )
GetBroadcaster().Broadcast( aHint );
}
}
-}
+}*/
void SvtSysLocaleOptions_Impl::Commit()
@@ -344,7 +318,8 @@ void SvtSysLocaleOptions_Impl::SetLocaleString( const OUString& rStr )
SetModified();
ULONG nHint = SYSLOCALEOPTIONS_HINT_LOCALE;
nHint |= ChangeLocaleSettings();
- Broadcast( nHint );
+ //Broadcast( nHint );
+ NotifyListeners();
}
}
@@ -370,7 +345,8 @@ void SvtSysLocaleOptions_Impl::SetCurrencyString( const OUString& rStr )
{
m_aCurrencyString = rStr;
SetModified();
- Broadcast( SYSLOCALEOPTIONS_HINT_CURRENCY );
+ //Broadcast( SYSLOCALEOPTIONS_HINT_CURRENCY );
+ NotifyListeners();
}
}
@@ -380,7 +356,8 @@ void SvtSysLocaleOptions_Impl::SetDecimalSeparatorAsLocale( sal_Bool bSet)
{
m_bDecimalSeparator = bSet;
SetModified();
- UpdateMiscSettings_Impl();
+ //UpdateMiscSettings_Impl();
+ NotifyListeners();
}
}
@@ -420,22 +397,11 @@ void SvtSysLocaleOptions_Impl::Notify( const Sequence< rtl::OUString >& seqPrope
{
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 );
+ //Broadcast( nHint );
+ NotifyListeners();
}
// ====================================================================
@@ -448,7 +414,7 @@ SvtSysLocaleOptions::SvtSysLocaleOptions()
RTL_LOGFILE_CONTEXT(aLog, "svl ( ??? ) ::SvtSysLocaleOptions_Impl::ctor()");
pOptions = new SvtSysLocaleOptions_Impl;
- ItemHolder2::holdConfigItem(E_SYSLOCALEOPTIONS);
+ ItemHolder1::holdConfigItem(E_SYSLOCALEOPTIONS);
}
++nRefCount;
}
@@ -498,20 +464,6 @@ void SvtSysLocaleOptions::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() );
diff --git a/unotools/source/config/undoopt.cxx b/unotools/source/config/undoopt.cxx
index 006de02e084a..9b1712032e18 100644
--- a/unotools/source/config/undoopt.cxx
+++ b/unotools/source/config/undoopt.cxx
@@ -30,10 +30,6 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_unotools.hxx"
-#ifdef SVL_DLLIMPLEMENTATION
-#undef SVL_DLLIMPLEMENTATION
-#endif
-#define SVT_DLLIMPLEMENTATION
#include <unotools/undoopt.hxx>
#include "rtl/instance.hxx"
diff --git a/unotools/source/config/useroptions.cxx b/unotools/source/config/useroptions.cxx
index ad5f50977114..3b62e8225730 100644
--- a/unotools/source/config/useroptions.cxx
+++ b/unotools/source/config/useroptions.cxx
@@ -30,10 +30,6 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_unotools.hxx"
-#ifdef SVL_DLLIMPLEMENTATION
-#undef SVL_DLLIMPLEMENTATION
-#endif
-#define SVT_DLLIMPLEMENTATION
#include <unotools/useroptions.hxx>
#include <unotools/useroptions_const.hxx>
diff --git a/unotools/source/misc/makefile.mk b/unotools/source/misc/makefile.mk
index 8e505e41aaac..4d9f7f40746b 100644
--- a/unotools/source/misc/makefile.mk
+++ b/unotools/source/misc/makefile.mk
@@ -45,6 +45,7 @@ ENABLE_EXCEPTIONS=TRUE
SLOFILES= $(SLO)$/atom.obj \
$(SLO)$/datetime.obj \
+ $(SLO)$/syslocale.obj \
$(SLO)$/eventlisteneradapter.obj \
$(SLO)$/desktopterminationobserver.obj \
$(SLO)$/sharedunocomponent.obj \
diff --git a/svl/source/syslocale/syslocale.cxx b/unotools/source/misc/syslocale.cxx
index 074e900ea9ab..a299867f83e8 100644
--- a/svl/source/syslocale/syslocale.cxx
+++ b/unotools/source/misc/syslocale.cxx
@@ -29,20 +29,16 @@
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_svl.hxx"
+#include "precompiled_unotools.hxx"
#ifndef GCC
#endif
-#include <svl/syslocale.hxx>
-#include <broadcast.hxx>
-#include <listener.hxx>
-#include <svl/smplhint.hxx>
-#include <vcl/svapp.hxx>
+#include <unotools/syslocale.hxx>
#include <tools/string.hxx>
-#include <svl/syslocaleoptions.hxx>
+#include <unotools/syslocaleoptions.hxx>
#include <unotools/localedatawrapper.hxx>
#include <comphelper/processfactory.hxx>
-
+#include <i18npool/mslangid.hxx>
using namespace osl;
using namespace com::sun::star;
@@ -52,39 +48,64 @@ SvtSysLocale_Impl* SvtSysLocale::pImpl = NULL;
sal_Int32 SvtSysLocale::nRefCount = 0;
-class SvtSysLocale_Impl : public SvtListener
+class SvtSysLocale_Impl : public utl::ConfigurationListener
{
friend class SvtSysLocale;
SvtSysLocaleOptions aSysLocaleOptions;
LocaleDataWrapper* pLocaleData;
CharClass* pCharClass;
+ com::sun::star::lang::Locale maLocale;
public:
SvtSysLocale_Impl();
virtual ~SvtSysLocale_Impl();
- virtual void Notify( SvtBroadcaster& rBC, const SfxHint& rHint );
-
CharClass* GetCharClass();
-
+ SvtSysLocaleOptions& GetOptions() { return aSysLocaleOptions; }
+ void ConfigurationChanged( utl::ConfigurationBroadcaster* );
+ com::sun::star::lang::Locale GetLocale();
};
+com::sun::star::lang::Locale SvtSysLocale_Impl::GetLocale()
+{
+ // ask configuration
+ rtl::OUString aLocaleString = aSysLocaleOptions.GetLocaleConfigString();
+ if (!aLocaleString.getLength())
+ // if no configuration is set, use system locale
+ return maLocale;
+
+ com::sun::star::lang::Locale aLocale;
+ sal_Int32 nSep = aLocaleString.indexOf('-');
+ if (nSep < 0)
+ aLocale.Language = aLocaleString;
+ else
+ {
+ aLocale.Language = aLocaleString.copy(0, nSep);
+ if (nSep < aLocaleString.getLength())
+ aLocale.Country = aLocaleString.copy(nSep+1, aLocaleString.getLength() - (nSep+1));
+ }
+
+ return aLocale;
+}
// -----------------------------------------------------------------------
SvtSysLocale_Impl::SvtSysLocale_Impl() : pCharClass(NULL)
{
- const lang::Locale& rLocale = Application::GetSettings().GetLocale();
- pLocaleData = new LocaleDataWrapper(
- ::comphelper::getProcessServiceFactory(), rLocale );
- aSysLocaleOptions.AddListener( *this );
+ // first initialize maLocale with system locale
+ MsLangId::convertLanguageToLocale( MsLangId::getSystemLanguage(), maLocale );
+
+ pLocaleData = new LocaleDataWrapper( ::comphelper::getProcessServiceFactory(), GetLocale() );
+
+ // listen for further changes
+ aSysLocaleOptions.AddListener( this );
}
SvtSysLocale_Impl::~SvtSysLocale_Impl()
{
- aSysLocaleOptions.RemoveListener( *this );
+ aSysLocaleOptions.RemoveListener( this );
delete pCharClass;
delete pLocaleData;
}
@@ -92,25 +113,18 @@ SvtSysLocale_Impl::~SvtSysLocale_Impl()
CharClass* SvtSysLocale_Impl::GetCharClass()
{
if ( !pCharClass )
- {
- const lang::Locale& rLocale = Application::GetSettings().GetLocale();
- pCharClass = new CharClass(::comphelper::getProcessServiceFactory(), rLocale );
- }
+ pCharClass = new CharClass(::comphelper::getProcessServiceFactory(), GetLocale() );
return pCharClass;
}
-void SvtSysLocale_Impl::Notify( SvtBroadcaster&, const SfxHint& rHint )
+
+void SvtSysLocale_Impl::ConfigurationChanged( utl::ConfigurationBroadcaster* )
{
- 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 );
- }
+ MutexGuard aGuard( SvtSysLocale::GetMutex() );
+ lang::Locale aLocale = GetLocale();
+ pLocaleData->setLocale( aLocale );
+ GetCharClass()->setLocale( aLocale );
}
-
// ====================================================================
SvtSysLocale::SvtSysLocale()
@@ -174,3 +188,18 @@ const CharClass* SvtSysLocale::GetCharClassPtr() const
{
return pImpl->GetCharClass();
}
+
+SvtSysLocaleOptions& SvtSysLocale::GetOptions() const
+{
+ return pImpl->GetOptions();
+}
+
+com::sun::star::lang::Locale SvtSysLocale::GetLocale() const
+{
+ return pImpl->GetLocale();
+}
+
+LanguageType SvtSysLocale::GetLanguage() const
+{
+ return MsLangId::convertLocaleToLanguage( pImpl->GetLocale() );
+} \ No newline at end of file
diff --git a/vcl/inc/vcl/settings.hxx b/vcl/inc/vcl/settings.hxx
index decb7d01b2d4..9f41b933f516 100644
--- a/vcl/inc/vcl/settings.hxx
+++ b/vcl/inc/vcl/settings.hxx
@@ -38,6 +38,7 @@
#include "vcl/accel.hxx"
#include "vcl/wall.hxx"
#include "com/sun/star/lang/Locale.hpp"
+#include <unotools/syslocale.hxx>
class CollatorWrapper;
class LocaleDataWrapper;
@@ -993,7 +994,6 @@ class ImplMiscData
private:
ULONG mnRefCount;
- USHORT mnTwoDigitYearStart;
USHORT mnEnableATT;
BOOL mbEnableLocalizedDecimalSep;
USHORT mnDisablePrinting;
@@ -1015,10 +1015,6 @@ public:
MiscSettings( const MiscSettings& rSet );
~MiscSettings();
- void SetTwoDigitYearStart( USHORT nYearStart )
- { CopyData(); mpData->mnTwoDigitYearStart = nYearStart; }
- USHORT GetTwoDigitYearStart() const
- { return mpData->mnTwoDigitYearStart; }
void SetEnableATToolSupport( BOOL bEnable );
BOOL GetEnableATToolSupport() const;
void SetDisablePrinting( BOOL bEnable );
@@ -1141,7 +1137,7 @@ public:
// -----------------------
// - ImplAllSettingsData -
// -----------------------
-
+class LocaleConfigurationListener;
class ImplAllSettingsData
{
friend class AllSettings;
@@ -1171,6 +1167,8 @@ private:
CollatorWrapper* mpUICollatorWrapper;
vcl::I18nHelper* mpI18nHelper;
vcl::I18nHelper* mpUII18nHelper;
+ LocaleConfigurationListener* mpLocaleCfgListener;
+ SvtSysLocale maSysLocale;
};
// ---------------
@@ -1287,6 +1285,8 @@ public:
BOOL operator ==( const AllSettings& rSet ) const;
BOOL operator !=( const AllSettings& rSet ) const
{ return !(*this == rSet); }
+ static void LocaleSettingsChanged();
+ void StartListening();
};
#endif // _SV_SETTINGS_HXX
diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx
index 6aa453563596..d30a1c9745f4 100644
--- a/vcl/source/app/settings.cxx
+++ b/vcl/source/app/settings.cxx
@@ -45,6 +45,7 @@
#include "unotools/collatorwrapper.hxx"
#include "unotools/configmgr.hxx"
#include "unotools/confignode.hxx"
+#include <unotools/syslocaleoptions.hxx>
#ifdef WNT
#include "tools/prewin.h"
@@ -66,6 +67,16 @@ DBG_NAME( AllSettings )
STYLE_OPTION_NOMNEMONICS)
// =======================================================================
+class LocaleConfigurationListener : public utl::ConfigurationListener
+{
+public:
+ virtual void ConfigurationChanged( utl::ConfigurationBroadcaster* );
+};
+
+void LocaleConfigurationListener::ConfigurationChanged( utl::ConfigurationBroadcaster* )
+{
+ AllSettings::LocaleSettingsChanged();
+}
ImplMachineData::ImplMachineData()
{
@@ -1069,7 +1080,6 @@ BOOL StyleSettings::operator ==( const StyleSettings& rSet ) const
ImplMiscData::ImplMiscData()
{
mnRefCount = 1;
- mnTwoDigitYearStart = 1930;
mnEnableATT = sal::static_int_cast<USHORT>(~0U);
mnDisablePrinting = sal::static_int_cast<USHORT>(~0U);
static const char* pEnv = getenv("SAL_DECIMALSEP_ENABLED" ); // set default without UI
@@ -1081,7 +1091,6 @@ ImplMiscData::ImplMiscData()
ImplMiscData::ImplMiscData( const ImplMiscData& rData )
{
mnRefCount = 1;
- mnTwoDigitYearStart = rData.mnTwoDigitYearStart;
mnEnableATT = rData.mnEnableATT;
mnDisablePrinting = rData.mnDisablePrinting;
mbEnableLocalizedDecimalSep = rData.mbEnableLocalizedDecimalSep;
@@ -1155,8 +1164,7 @@ BOOL MiscSettings::operator ==( const MiscSettings& rSet ) const
if ( mpData == rSet.mpData )
return TRUE;
- if ( (mpData->mnTwoDigitYearStart == rSet.mpData->mnTwoDigitYearStart ) &&
- (mpData->mnEnableATT == rSet.mpData->mnEnableATT ) &&
+ if ( (mpData->mnEnableATT == rSet.mpData->mnEnableATT ) &&
(mpData->mnDisablePrinting == rSet.mpData->mnDisablePrinting ) &&
(mpData->mbEnableLocalizedDecimalSep == rSet.mpData->mbEnableLocalizedDecimalSep ) )
return TRUE;
@@ -1535,6 +1543,8 @@ ImplAllSettingsData::ImplAllSettingsData()
mpUICollatorWrapper = NULL;
mpI18nHelper = NULL;
mpUII18nHelper = NULL;
+ mpLocaleCfgListener = NULL;
+ maMiscSettings.SetEnableLocalizedDecimalSep( maSysLocale.GetOptions().IsDecimalSeparatorAsLocale() );
}
// -----------------------------------------------------------------------
@@ -1564,6 +1574,7 @@ ImplAllSettingsData::ImplAllSettingsData( const ImplAllSettingsData& rData ) :
mpUICollatorWrapper = NULL;
mpI18nHelper = NULL;
mpUII18nHelper = NULL;
+ mpLocaleCfgListener = NULL;
}
// -----------------------------------------------------------------------
@@ -1582,6 +1593,11 @@ ImplAllSettingsData::~ImplAllSettingsData()
delete mpI18nHelper;
if ( mpUII18nHelper )
delete mpUII18nHelper;
+ if (mpLocaleCfgListener )
+ {
+ maSysLocale.GetOptions().RemoveListener( mpLocaleCfgListener );
+ delete mpLocaleCfgListener;
+ }
}
// -----------------------------------------------------------------------
@@ -1640,6 +1656,13 @@ const AllSettings& AllSettings::operator =( const AllSettings& rSet )
return *this;
}
+void AllSettings::StartListening()
+{
+ if (!mpData->mpLocaleCfgListener)
+ mpData->mpLocaleCfgListener = new LocaleConfigurationListener;
+ mpData->maSysLocale.GetOptions().AddListener( mpData->mpLocaleCfgListener );
+}
+
// -----------------------------------------------------------------------
void AllSettings::CopyData()
@@ -2075,4 +2098,15 @@ const CollatorWrapper& AllSettings::GetUICollatorWrapper() const
return *mpData->mpUICollatorWrapper;
}
*/
-
+void AllSettings::LocaleSettingsChanged()
+{
+ AllSettings aAllSettings( Application::GetSettings() );
+ MiscSettings aMiscSettings = aAllSettings.GetMiscSettings();
+ BOOL bIsDecSepAsLocale = aAllSettings.mpData->maSysLocale.GetOptions().IsDecimalSeparatorAsLocale();
+ if ( aMiscSettings.GetEnableLocalizedDecimalSep() != bIsDecSepAsLocale )
+ {
+ aMiscSettings.SetEnableLocalizedDecimalSep( bIsDecSepAsLocale );
+ aAllSettings.SetMiscSettings( aMiscSettings );
+ Application::SetSettings( aAllSettings );
+ }
+} \ No newline at end of file
diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx
index b53ceceeb757..9f381381fae8 100644
--- a/vcl/source/app/svapp.cxx
+++ b/vcl/source/app/svapp.cxx
@@ -710,6 +710,7 @@ void Application::SetSettings( const AllSettings& rSettings )
if ( !pSVData->maAppData.mpSettings )
{
pSVData->maAppData.mpSettings = new AllSettings();
+ pSVData->maAppData.mpSettings->StartListening();
*pSVData->maAppData.mpSettings = rSettings;
ResMgr::SetDefaultLocale( rSettings.GetUILocale() );
}
diff --git a/vcl/source/control/field2.cxx b/vcl/source/control/field2.cxx
index b417774142d3..1d8f9a727be4 100644
--- a/vcl/source/control/field2.cxx
+++ b/vcl/source/control/field2.cxx
@@ -55,6 +55,7 @@
#include <unotools/localedatawrapper.hxx>
#include <unotools/calendarwrapper.hxx>
#include <unotools/charclass.hxx>
+#include <unotools/misccfg.hxx>
using namespace ::com::sun::star;
@@ -1312,7 +1313,7 @@ static BOOL ImplDateGetValue( const XubString& rStr, Date& rDate, ExtDateFieldFo
return FALSE;
Date aNewDate( nDay, nMonth, nYear );
- DateFormatter::ExpandCentury( aNewDate, rSettings.GetMiscSettings().GetTwoDigitYearStart() );
+ DateFormatter::ExpandCentury( aNewDate, utl::MiscCfg().GetYear2000() );
if ( aNewDate.IsValid() )
{
rDate = aNewDate;
@@ -1379,7 +1380,7 @@ XubString DateFormatter::ImplGetDateAsText( const Date& rDate,
if ( !bShowCentury )
{
// Check if I have to use force showing the century
- USHORT nTwoDigitYearStart = rSettings.GetMiscSettings().GetTwoDigitYearStart();
+ USHORT nTwoDigitYearStart = utl::MiscCfg().GetYear2000();
USHORT nYear = rDate.GetYear();
// Wenn Jahr nicht im 2stelligen Grenzbereich liegt,
@@ -2033,7 +2034,7 @@ void DateFormatter::Reformat()
void DateFormatter::ExpandCentury( Date& rDate )
{
- ExpandCentury( rDate, Application::GetSettings().GetMiscSettings().GetTwoDigitYearStart() );
+ ExpandCentury( rDate, utl::MiscCfg().GetYear2000() );
}
// -----------------------------------------------------------------------
diff --git a/vcl/win/source/window/salframe.cxx b/vcl/win/source/window/salframe.cxx
index 4a49d83918da..802ff48e41d6 100644
--- a/vcl/win/source/window/salframe.cxx
+++ b/vcl/win/source/window/salframe.cxx
@@ -39,6 +39,7 @@
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/awt/Rectangle.hpp>
#include <comphelper/processfactory.hxx>
+#include <unotools/misccfg.hxx>
#include <string.h>
#include <limits.h>
@@ -3085,7 +3086,7 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings )
if ( (nValue > 1000) && (nValue < 10000) )
{
MiscSettings aMiscSettings = rSettings.GetMiscSettings();
- aMiscSettings.SetTwoDigitYearStart( (USHORT)(nValue-99) );
+ utl::MiscCfg().SetYear2000( (sal_Int32)(nValue-99) );
rSettings.SetMiscSettings( aMiscSettings );
}
}