summaryrefslogtreecommitdiff
path: root/svl
diff options
context:
space:
mode:
Diffstat (limited to 'svl')
-rw-r--r--svl/Library_svl.mk2
-rw-r--r--svl/Package_inc.mk1
-rw-r--r--svl/inc/svl/itempool.hxx2
-rw-r--r--svl/source/items/dateitem.cxx1
-rw-r--r--svl/source/items/itempool.cxx1
-rw-r--r--svl/source/items/poolio.cxx7
-rw-r--r--svl/source/misc/getstringresource.cxx101
-rw-r--r--svl/source/misc/getstringresource.hxx (renamed from svl/inc/svl/svldata.hxx)48
-rw-r--r--svl/source/misc/inettype.cxx5
-rw-r--r--svl/source/misc/svldata.cxx87
10 files changed, 124 insertions, 131 deletions
diff --git a/svl/Library_svl.mk b/svl/Library_svl.mk
index 3c7164ca3153..0fb7477c12f7 100644
--- a/svl/Library_svl.mk
+++ b/svl/Library_svl.mk
@@ -117,6 +117,7 @@ $(eval $(call gb_Library_add_exception_objects,svl,\
svl/source/misc/filenotation \
svl/source/misc/folderrestriction \
svl/source/misc/fstathelper \
+ svl/source/misc/getstringresource \
svl/source/misc/inethist \
svl/source/misc/inettype \
svl/source/misc/lngmisc \
@@ -125,7 +126,6 @@ $(eval $(call gb_Library_add_exception_objects,svl,\
svl/source/misc/restrictedpaths \
svl/source/misc/sharecontrolfile \
svl/source/misc/strmadpt \
- svl/source/misc/svldata \
svl/source/misc/urihelper \
svl/source/notify/brdcst \
svl/source/notify/broadcast \
diff --git a/svl/Package_inc.mk b/svl/Package_inc.mk
index 5f65c0330bce..7e72d1cedca0 100644
--- a/svl/Package_inc.mk
+++ b/svl/Package_inc.mk
@@ -114,7 +114,6 @@ $(eval $(call gb_Package_add_file,svl_inc,inc/svl/stylepool.hxx,svl/stylepool.hx
$(eval $(call gb_Package_add_file,svl_inc,inc/svl/svarray.hxx,svl/svarray.hxx))
$(eval $(call gb_Package_add_file,svl_inc,inc/svl/svdde.hxx,svl/svdde.hxx))
$(eval $(call gb_Package_add_file,svl_inc,inc/svl/svl.hrc,svl/svl.hrc))
-$(eval $(call gb_Package_add_file,svl_inc,inc/svl/svldata.hxx,svl/svldata.hxx))
$(eval $(call gb_Package_add_file,svl_inc,inc/svl/svldllapi.h,svl/svldllapi.h))
$(eval $(call gb_Package_add_file,svl_inc,inc/svl/svstdarr.hxx,svl/svstdarr.hxx))
$(eval $(call gb_Package_add_file,svl_inc,inc/svl/szitem.hxx,svl/szitem.hxx))
diff --git a/svl/inc/svl/itempool.hxx b/svl/inc/svl/itempool.hxx
index 9027b896431e..27a8038c5195 100644
--- a/svl/inc/svl/itempool.hxx
+++ b/svl/inc/svl/itempool.hxx
@@ -237,6 +237,8 @@ public:
private:
const SfxItemPool& operator=(const SfxItemPool &); // n.i.!!
+
+ static const SfxItemPool* pStoringPool_;
};
// --------------- Inline Implementierungen ------------------------------
diff --git a/svl/source/items/dateitem.cxx b/svl/source/items/dateitem.cxx
index 87c034e6dac9..28c78966e736 100644
--- a/svl/source/items/dateitem.cxx
+++ b/svl/source/items/dateitem.cxx
@@ -33,7 +33,6 @@
#define _DATETIMEITEM_CXX
#include <svl/dateitem.hxx>
-#include <svl/svldata.hxx>
#include <svl/svl.hrc>
#include <unotools/intlwrapper.hxx>
diff --git a/svl/source/items/itempool.cxx b/svl/source/items/itempool.cxx
index e5a499a035e5..2bcef79a1bfc 100644
--- a/svl/source/items/itempool.cxx
+++ b/svl/source/items/itempool.cxx
@@ -1060,5 +1060,6 @@ void SfxItemPool::SetFileFormatVersion( sal_uInt16 nFileFormatVersion )
pPool->pImp->mnFileFormatVersion = nFileFormatVersion;
}
+const SfxItemPool* SfxItemPool::pStoringPool_ = 0;
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svl/source/items/poolio.cxx b/svl/source/items/poolio.cxx
index d719e9801ec8..51744980705c 100644
--- a/svl/source/items/poolio.cxx
+++ b/svl/source/items/poolio.cxx
@@ -37,7 +37,6 @@
#include "whassert.hxx"
#include <svl/brdcst.hxx>
#include <svl/filerec.hxx>
-#include <svl/svldata.hxx>
#include "poolio.hxx"
// STATIC DATA -----------------------------------------------------------
@@ -58,7 +57,7 @@ const SfxItemPool* SfxItemPool::GetStoringPool()
*/
{
- return ImpSvlData::GetSvlData().pStoringPool;
+ return pStoringPool_;
}
//-------------------------------------------------------------------------
@@ -143,7 +142,7 @@ SvStream &SfxItemPool::Store(SvStream &rStream) const
// jeder Pool ist als ganzes ein Record
SfxMiniRecordWriter aPoolRec( &rStream, SFX_ITEMPOOL_REC );
- ImpSvlData::GetSvlData().pStoringPool = this;
+ pStoringPool_ = this;
// Einzel-Header (Version des Inhalts und Name)
{
@@ -281,7 +280,7 @@ SvStream &SfxItemPool::Store(SvStream &rStream) const
}
// weitere Pools rausschreiben
- ImpSvlData::GetSvlData().pStoringPool = 0;
+ pStoringPool_ = 0;
aPoolRec.Close();
if ( !rStream.GetError() && pImp->mpSecondary )
pImp->mpSecondary->Store( rStream );
diff --git a/svl/source/misc/getstringresource.cxx b/svl/source/misc/getstringresource.cxx
new file mode 100644
index 000000000000..6e5bbf88f64f
--- /dev/null
+++ b/svl/source/misc/getstringresource.cxx
@@ -0,0 +1,101 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_svl.hxx"
+#include "sal/config.h"
+
+#include <map>
+
+#include "boost/noncopyable.hpp"
+#include "boost/scoped_ptr.hpp"
+#include "com/sun/star/lang/Locale.hpp"
+#include "rtl/instance.hxx"
+#include "rtl/ustrbuf.hxx"
+#include "rtl/ustring.hxx"
+#include "sal/types.h"
+#include "tools/resmgr.hxx"
+#include "tools/simplerm.hxx"
+
+#include "getstringresource.hxx"
+
+namespace {
+
+namespace css = com::sun::star;
+
+class ResMgrMap: private boost::noncopyable {
+public:
+ ~ResMgrMap();
+
+ SimpleResMgr * get(css::lang::Locale const & locale);
+
+private:
+ typedef std::map< rtl::OUString, SimpleResMgr * > Map;
+
+ Map map_;
+ // one SimpleResMgr for each language for which a resource was requested
+ // (when using the "non-simple" resmgr, the first request for any
+ // language wins, any further requests for any other languages supply
+ // the resmgr of the first call; for the simple resmgr we have a mgr
+ // for each language ever requested)
+};
+
+ResMgrMap::~ResMgrMap() {
+ for (Map::iterator i(map_.begin()); i != map_.end(); ++i) {
+ delete i->second;
+ }
+}
+
+SimpleResMgr * ResMgrMap::get(css::lang::Locale const & locale) {
+ rtl::OUStringBuffer buf(locale.Language);
+ buf.append(sal_Unicode('-'));
+ buf.append(locale.Country);
+ rtl::OUString code(buf.makeStringAndClear());
+ Map::iterator i(map_.find(code));
+ if (i == map_.end()) {
+ boost::scoped_ptr< SimpleResMgr > mgr(
+ new SimpleResMgr(CREATEVERSIONRESMGR_NAME(svl), locale));
+ i = map_.insert(Map::value_type(code, mgr.get())).first;
+ mgr.reset();
+ }
+ return i->second;
+}
+
+struct theResMgrMap: public rtl::Static< ResMgrMap, theResMgrMap > {};
+
+}
+
+namespace svl {
+
+rtl::OUString getStringResource(sal_uInt16 id, css::lang::Locale const & locale)
+{
+ return theResMgrMap::get().get(locale)->ReadString(id);
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svl/inc/svl/svldata.hxx b/svl/source/misc/getstringresource.hxx
index c498dd01cba7..99c5352e0f10 100644
--- a/svl/inc/svl/svldata.hxx
+++ b/svl/source/misc/getstringresource.hxx
@@ -26,47 +26,25 @@
*
************************************************************************/
-#ifndef _SVL_SVLDATA_HXX
-#define _SVL_SVLDATA_HXX
+#ifndef INCLUDED_SVL_SOURCE_INC_GETSTRINGRESOURCE_HXX
+#define INCLUDED_SVL_SOURCE_INC_GETSTRINGRESOURCE_HXX
-#include <tools/simplerm.hxx>
-#include <rtl/instance.hxx>
+#include "sal/config.h"
-class SfxItemPool;
+#include "sal/types.h"
-//============================================================================
-class ImpSvlData
-{
-public:
- const SfxItemPool * pStoringPool;
- void* m_pThreadsafeRMs;
- // one SimpleResMgr for each language for which a resource was requested
- // (When using the 'non-simple' resmgr, the first request for any language wins, any
- // further request for any other language supply the resmgr of the first call.
- // For the simple resmgr we have a mgr for each language ever requested).
+namespace com { namespace sun { namespace star { namespace lang {
+ struct Locale;
+} } } }
+namespace rtl { class OUString; }
- public: //TODO: should be private
- ImpSvlData() : pStoringPool(0), m_pThreadsafeRMs(NULL) {}
- ~ImpSvlData();
+namespace svl {
-public:
- SimpleResMgr * GetSimpleRM(const ::com::sun::star::lang::Locale& rLocale);
- static ImpSvlData & GetSvlData();
-};
+rtl::OUString getStringResource(
+ sal_uInt16 id, com::sun::star::lang::Locale const & locale);
-//============================================================================
-class SvtSimpleResId
-{
- String m_sValue;
+}
-public:
- SvtSimpleResId(sal_uInt16 nId, const ::com::sun::star::lang::Locale aLocale) : m_sValue(ImpSvlData::GetSvlData().GetSimpleRM(aLocale)->ReadString(nId)) { };
-
- operator String () const { return m_sValue; }
-};
-
-
-
-#endif // _SVL_SVLDATA_HXX
+#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svl/source/misc/inettype.cxx b/svl/source/misc/inettype.cxx
index 686056e21ac1..1a75aba00408 100644
--- a/svl/source/misc/inettype.cxx
+++ b/svl/source/misc/inettype.cxx
@@ -31,9 +31,10 @@
#include <tools/table.hxx>
#include <tools/wldcrd.hxx>
#include <svl/inettype.hxx>
-#include <svl/svldata.hxx>
#include <svl/svl.hrc>
+#include "getstringresource.hxx"
+
#ifndef _SVSTDARR_STRINGSSORT_DECL
#define _SVSTDARR_STRINGSSORT
#include <svl/svstdarr.hxx>
@@ -929,7 +930,7 @@ UniString INetContentTypes::GetPresentation(INetContentType eTypeID,
else
return aPresentation;
}
- return SvtSimpleResId(nResID, aLocale);
+ return svl::getStringResource(nResID, aLocale);
}
//============================================================================
diff --git a/svl/source/misc/svldata.cxx b/svl/source/misc/svldata.cxx
deleted file mode 100644
index c03ee02acb82..000000000000
--- a/svl/source/misc/svldata.cxx
+++ /dev/null
@@ -1,87 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_svl.hxx"
-
-#include <map>
-#include <tools/resmgr.hxx>
-#include <tools/shl.hxx>
-#include <svl/svldata.hxx>
-
-namespace
-{
- typedef std::map< rtl::OUString, SimpleResMgr * > SimpleResMgrMap;
-}
-
-ImpSvlData::~ImpSvlData()
-{
- if (m_pThreadsafeRMs)
- {
- SimpleResMgrMap *pThreadsafeRMs =
- static_cast<SimpleResMgrMap*>(m_pThreadsafeRMs);
- for (SimpleResMgrMap::iterator t = pThreadsafeRMs->begin(),
- end = pThreadsafeRMs->end(); t != end; ++t)
- {
- delete t->second;
- }
- delete pThreadsafeRMs;
- }
-}
-
-//============================================================================
-SimpleResMgr* ImpSvlData::GetSimpleRM(const ::com::sun::star::lang::Locale& rLocale)
-{
- if (!m_pThreadsafeRMs)
- m_pThreadsafeRMs = new SimpleResMgrMap;
- rtl::OUString aISOcode = rLocale.Language;
- aISOcode += rtl::OStringToOUString("-", RTL_TEXTENCODING_UTF8);
- aISOcode += rLocale.Country;
-
- SimpleResMgr *& rResMgr
- = (*static_cast< SimpleResMgrMap * >(m_pThreadsafeRMs))[aISOcode];
- if (!rResMgr)
- {
- rResMgr = new SimpleResMgr(CREATEVERSIONRESMGR_NAME(svl), rLocale );
- }
- return rResMgr;
-}
-
-namespace
-{
- class theSvlData : public rtl::Static< ImpSvlData, theSvlData > {};
-}
-
-//============================================================================
-// static
-ImpSvlData & ImpSvlData::GetSvlData()
-{
- return theSvlData::get();
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */