reorganize trickier statics

This commit is contained in:
Caolán McNamara
2012-03-31 23:43:57 +01:00
parent ae92197691
commit 15f14ec794
9 changed files with 76 additions and 84 deletions

View File

@@ -400,9 +400,8 @@ SfxLibraryContainer* SfxDialogLibraryContainer::createInstanceImpl( void )
return new SfxDialogLibraryContainer(); return new SfxDialogLibraryContainer();
} }
const char aResourceFileNameBase[] = "DialogStrings";
static OUString aResourceFileNameBase(RTL_CONSTASCII_USTRINGPARAM("DialogStrings")); const char aResourceFileCommentBase[] = "# Strings for Dialog Library ";
static OUString aResourceFileCommentBase(RTL_CONSTASCII_USTRINGPARAM("# Strings for Dialog Library "));
// Resource handling // Resource handling
Reference< ::com::sun::star::resource::XStringResourcePersistence > Reference< ::com::sun::star::resource::XStringResourcePersistence >
@@ -415,7 +414,7 @@ Reference< ::com::sun::star::resource::XStringResourcePersistence >
// get ui locale // get ui locale
::com::sun ::star::lang::Locale aLocale = Application::GetSettings().GetUILocale(); ::com::sun ::star::lang::Locale aLocale = Application::GetSettings().GetUILocale();
OUString aComment = aResourceFileCommentBase; OUString aComment(aResourceFileCommentBase);
aComment += aLibName; aComment += aLibName;
sal_Bool bStorage = mxStorage.is(); sal_Bool bStorage = mxStorage.is();
@@ -424,7 +423,7 @@ Reference< ::com::sun::star::resource::XStringResourcePersistence >
Sequence<Any> aArgs( 5 ); Sequence<Any> aArgs( 5 );
aArgs[1] <<= bReadOnly; aArgs[1] <<= bReadOnly;
aArgs[2] <<= aLocale; aArgs[2] <<= aLocale;
aArgs[3] <<= aResourceFileNameBase; aArgs[3] <<= rtl::OUString(aResourceFileNameBase);
aArgs[4] <<= aComment; aArgs[4] <<= aComment;
// TODO: Ctor // TODO: Ctor
@@ -468,7 +467,7 @@ Reference< ::com::sun::star::resource::XStringResourcePersistence >
aArgs[0] <<= aLocation; aArgs[0] <<= aLocation;
aArgs[1] <<= bReadOnly; aArgs[1] <<= bReadOnly;
aArgs[2] <<= aLocale; aArgs[2] <<= aLocale;
aArgs[3] <<= aResourceFileNameBase; aArgs[3] <<= rtl::OUString(aResourceFileNameBase);
aArgs[4] <<= aComment; aArgs[4] <<= aComment;
// TODO: Real handler? // TODO: Real handler?
@@ -632,7 +631,7 @@ void SfxDialogLibrary::storeResources( void )
void SfxDialogLibrary::storeResourcesAsURL void SfxDialogLibrary::storeResourcesAsURL
( const ::rtl::OUString& URL, const ::rtl::OUString& NewName ) ( const ::rtl::OUString& URL, const ::rtl::OUString& NewName )
{ {
OUString aComment = aResourceFileCommentBase; OUString aComment(aResourceFileCommentBase);
m_aName = NewName; m_aName = NewName;
aComment += m_aName; aComment += m_aName;
@@ -650,26 +649,26 @@ void SfxDialogLibrary::storeResourcesAsURL
void SfxDialogLibrary::storeResourcesToURL( const OUString& URL, void SfxDialogLibrary::storeResourcesToURL( const OUString& URL,
const Reference< task::XInteractionHandler >& xHandler ) const Reference< task::XInteractionHandler >& xHandler )
{ {
OUString aComment = aResourceFileCommentBase; OUString aComment(aResourceFileCommentBase);
aComment += m_aName; aComment += m_aName;
if( m_xStringResourcePersistence.is() ) if( m_xStringResourcePersistence.is() )
{ {
m_xStringResourcePersistence->storeToURL m_xStringResourcePersistence->storeToURL
( URL, aResourceFileNameBase, aComment, xHandler ); ( URL, rtl::OUString(aResourceFileNameBase), aComment, xHandler );
} }
} }
void SfxDialogLibrary::storeResourcesToStorage( const ::com::sun::star::uno::Reference void SfxDialogLibrary::storeResourcesToStorage( const ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XStorage >& xStorage ) < ::com::sun::star::embed::XStorage >& xStorage )
{ {
OUString aComment = aResourceFileCommentBase; OUString aComment(aResourceFileCommentBase);
aComment += m_aName; aComment += m_aName;
if( m_xStringResourcePersistence.is() ) if( m_xStringResourcePersistence.is() )
{ {
m_xStringResourcePersistence->storeToStorage m_xStringResourcePersistence->storeToStorage
( xStorage, aResourceFileNameBase, aComment ); ( xStorage, rtl::OUString(aResourceFileNameBase), aComment );
} }
} }
@@ -698,6 +697,5 @@ bool SAL_CALL SfxDialogLibrary::isLibraryElementValid( ::com::sun::star::uno::An
} }
} }
//============================================================================
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -63,21 +63,21 @@ struct DeploymentResMgr : public rtl::StaticWithInit<
} }
}; };
osl::Mutex s_mutex; class theResourceMutex : public rtl::Static<osl::Mutex, theResourceMutex> {};
} // anon namespace } // anon namespace
//============================================================================== //==============================================================================
ResId getResId( sal_uInt16 id ) ResId getResId( sal_uInt16 id )
{ {
const osl::MutexGuard guard( s_mutex ); const osl::MutexGuard guard( theResourceMutex::get() );
return ResId( id, *DeploymentResMgr::get() ); return ResId( id, *DeploymentResMgr::get() );
} }
//============================================================================== //==============================================================================
String getResourceString( sal_uInt16 id ) String getResourceString( sal_uInt16 id )
{ {
const osl::MutexGuard guard( s_mutex ); const osl::MutexGuard guard( theResourceMutex::get() );
String ret( ResId( id, *DeploymentResMgr::get() ) ); String ret( ResId( id, *DeploymentResMgr::get() ) );
ret.SearchAndReplaceAllAscii( ret.SearchAndReplaceAllAscii(
"%PRODUCTNAME", utl::ConfigManager::getProductName() ); "%PRODUCTNAME", utl::ConfigManager::getProductName() );

View File

@@ -28,7 +28,6 @@
#include "fastserializer.hxx" #include "fastserializer.hxx"
#include <rtl/ustrbuf.hxx> #include <rtl/ustrbuf.hxx>
#include <rtl/byteseq.hxx>
#include <comphelper/sequenceasvector.hxx> #include <comphelper/sequenceasvector.hxx>
@@ -62,28 +61,32 @@ using ::com::sun::star::io::NotConnectedException;
using ::com::sun::star::io::IOException; using ::com::sun::star::io::IOException;
using ::com::sun::star::io::BufferSizeExceededException; using ::com::sun::star::io::BufferSizeExceededException;
static rtl::ByteSequence aClosingBracket((const sal_Int8 *)">", 1);
static rtl::ByteSequence aSlashAndClosingBracket((const sal_Int8 *)"/>", 2);
static rtl::ByteSequence aColon((const sal_Int8 *)":", 1);
static rtl::ByteSequence aOpeningBracket((const sal_Int8 *)"<", 1);
static rtl::ByteSequence aOpeningBracketAndSlash((const sal_Int8 *)"</", 2);
static rtl::ByteSequence aQuote((const sal_Int8 *)"\"", 1);
static rtl::ByteSequence aEqualSignAndQuote((const sal_Int8 *)"=\"", 2);
static rtl::ByteSequence aSpace((const sal_Int8 *)" ", 1);
static rtl::ByteSequence aXmlHeader((const sal_Int8*) "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n", 56);
#define HAS_NAMESPACE(x) ((x & 0xffff0000) != 0) #define HAS_NAMESPACE(x) ((x & 0xffff0000) != 0)
#define NAMESPACE(x) (x >> 16) #define NAMESPACE(x) (x >> 16)
#define TOKEN(x) (x & 0xffff) #define TOKEN(x) (x & 0xffff)
namespace sax_fastparser { namespace sax_fastparser {
FastSaxSerializer::FastSaxSerializer( ) : mxOutputStream(), mxFastTokenHandler(), maMarkStack() {} FastSaxSerializer::FastSaxSerializer( )
: mxOutputStream()
, mxFastTokenHandler()
, maMarkStack()
, maClosingBracket((const sal_Int8 *)">", 1)
, maSlashAndClosingBracket((const sal_Int8 *)"/>", 2)
, maColon((const sal_Int8 *)":", 1)
, maOpeningBracket((const sal_Int8 *)"<", 1)
, maOpeningBracketAndSlash((const sal_Int8 *)"</", 2)
, maQuote((const sal_Int8 *)"\"", 1)
, maEqualSignAndQuote((const sal_Int8 *)"=\"", 2)
, maSpace((const sal_Int8 *)" ", 1)
{
}
FastSaxSerializer::~FastSaxSerializer() {} FastSaxSerializer::~FastSaxSerializer() {}
void SAL_CALL FastSaxSerializer::startDocument( ) throw (SAXException, RuntimeException) void SAL_CALL FastSaxSerializer::startDocument( ) throw (SAXException, RuntimeException)
{ {
if (!mxOutputStream.is()) if (!mxOutputStream.is())
return; return;
rtl::ByteSequence aXmlHeader((const sal_Int8*) "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n", 56);
writeBytes(toUnoSequence(aXmlHeader)); writeBytes(toUnoSequence(aXmlHeader));
} }
@@ -126,7 +129,7 @@ namespace sax_fastparser {
{ {
if( HAS_NAMESPACE( nElement ) ) { if( HAS_NAMESPACE( nElement ) ) {
writeBytes(mxFastTokenHandler->getUTF8Identifier(NAMESPACE(nElement))); writeBytes(mxFastTokenHandler->getUTF8Identifier(NAMESPACE(nElement)));
writeBytes(toUnoSequence(aColon)); writeBytes(toUnoSequence(maColon));
writeBytes(mxFastTokenHandler->getUTF8Identifier(TOKEN(nElement))); writeBytes(mxFastTokenHandler->getUTF8Identifier(TOKEN(nElement)));
} else } else
writeBytes(mxFastTokenHandler->getUTF8Identifier(nElement)); writeBytes(mxFastTokenHandler->getUTF8Identifier(nElement));
@@ -141,12 +144,12 @@ namespace sax_fastparser {
if ( !maMarkStack.empty() ) if ( !maMarkStack.empty() )
maMarkStack.top()->setCurrentElement( Element ); maMarkStack.top()->setCurrentElement( Element );
writeBytes(toUnoSequence(aOpeningBracket)); writeBytes(toUnoSequence(maOpeningBracket));
writeId(Element); writeId(Element);
writeFastAttributeList(Attribs); writeFastAttributeList(Attribs);
writeBytes(toUnoSequence(aClosingBracket)); writeBytes(toUnoSequence(maClosingBracket));
} }
void SAL_CALL FastSaxSerializer::startUnknownElement( const OUString& Namespace, const OUString& Name, const Reference< XFastAttributeList >& Attribs ) void SAL_CALL FastSaxSerializer::startUnknownElement( const OUString& Namespace, const OUString& Name, const Reference< XFastAttributeList >& Attribs )
@@ -155,19 +158,19 @@ namespace sax_fastparser {
if (!mxOutputStream.is()) if (!mxOutputStream.is())
return; return;
writeBytes(toUnoSequence(aOpeningBracket)); writeBytes(toUnoSequence(maOpeningBracket));
if (!Namespace.isEmpty()) if (!Namespace.isEmpty())
{ {
write(Namespace); write(Namespace);
writeBytes(toUnoSequence(aColon)); writeBytes(toUnoSequence(maColon));
} }
write(Name); write(Name);
writeFastAttributeList(Attribs); writeFastAttributeList(Attribs);
writeBytes(toUnoSequence(aClosingBracket)); writeBytes(toUnoSequence(maClosingBracket));
} }
void SAL_CALL FastSaxSerializer::endFastElement( ::sal_Int32 Element ) void SAL_CALL FastSaxSerializer::endFastElement( ::sal_Int32 Element )
@@ -176,11 +179,11 @@ namespace sax_fastparser {
if (!mxOutputStream.is()) if (!mxOutputStream.is())
return; return;
writeBytes(toUnoSequence(aOpeningBracketAndSlash)); writeBytes(toUnoSequence(maOpeningBracketAndSlash));
writeId(Element); writeId(Element);
writeBytes(toUnoSequence(aClosingBracket)); writeBytes(toUnoSequence(maClosingBracket));
} }
void SAL_CALL FastSaxSerializer::endUnknownElement( const OUString& Namespace, const OUString& Name ) void SAL_CALL FastSaxSerializer::endUnknownElement( const OUString& Namespace, const OUString& Name )
@@ -189,17 +192,17 @@ namespace sax_fastparser {
if (!mxOutputStream.is()) if (!mxOutputStream.is())
return; return;
writeBytes(toUnoSequence(aOpeningBracketAndSlash)); writeBytes(toUnoSequence(maOpeningBracketAndSlash));
if (!Namespace.isEmpty()) if (!Namespace.isEmpty())
{ {
write(Namespace); write(Namespace);
writeBytes(toUnoSequence(aColon)); writeBytes(toUnoSequence(maColon));
} }
write(Name); write(Name);
writeBytes(toUnoSequence(aClosingBracket)); writeBytes(toUnoSequence(maClosingBracket));
} }
void SAL_CALL FastSaxSerializer::singleFastElement( ::sal_Int32 Element, const Reference< XFastAttributeList >& Attribs ) void SAL_CALL FastSaxSerializer::singleFastElement( ::sal_Int32 Element, const Reference< XFastAttributeList >& Attribs )
@@ -211,12 +214,12 @@ namespace sax_fastparser {
if ( !maMarkStack.empty() ) if ( !maMarkStack.empty() )
maMarkStack.top()->setCurrentElement( Element ); maMarkStack.top()->setCurrentElement( Element );
writeBytes(toUnoSequence(aOpeningBracket)); writeBytes(toUnoSequence(maOpeningBracket));
writeId(Element); writeId(Element);
writeFastAttributeList(Attribs); writeFastAttributeList(Attribs);
writeBytes(toUnoSequence(aSlashAndClosingBracket)); writeBytes(toUnoSequence(maSlashAndClosingBracket));
} }
void SAL_CALL FastSaxSerializer::singleUnknownElement( const OUString& Namespace, const OUString& Name, const Reference< XFastAttributeList >& Attribs ) void SAL_CALL FastSaxSerializer::singleUnknownElement( const OUString& Namespace, const OUString& Name, const Reference< XFastAttributeList >& Attribs )
@@ -225,19 +228,19 @@ namespace sax_fastparser {
if (!mxOutputStream.is()) if (!mxOutputStream.is())
return; return;
writeBytes(toUnoSequence(aOpeningBracket)); writeBytes(toUnoSequence(maOpeningBracket));
if (!Namespace.isEmpty()) if (!Namespace.isEmpty())
{ {
write(Namespace); write(Namespace);
writeBytes(toUnoSequence(aColon)); writeBytes(toUnoSequence(maColon));
} }
write(Name); write(Name);
writeFastAttributeList(Attribs); writeFastAttributeList(Attribs);
writeBytes(toUnoSequence(aSlashAndClosingBracket)); writeBytes(toUnoSequence(maSlashAndClosingBracket));
} }
void SAL_CALL FastSaxSerializer::characters( const OUString& aChars ) void SAL_CALL FastSaxSerializer::characters( const OUString& aChars )
@@ -267,12 +270,12 @@ namespace sax_fastparser {
sal_Int32 nAttrLength = aAttrSeq.getLength(); sal_Int32 nAttrLength = aAttrSeq.getLength();
for (sal_Int32 i = 0; i < nAttrLength; i++) for (sal_Int32 i = 0; i < nAttrLength; i++)
{ {
writeBytes(toUnoSequence(aSpace)); writeBytes(toUnoSequence(maSpace));
write(pAttr[i].Name); write(pAttr[i].Name);
writeBytes(toUnoSequence(aEqualSignAndQuote)); writeBytes(toUnoSequence(maEqualSignAndQuote));
write(escapeXml(pAttr[i].Value)); write(escapeXml(pAttr[i].Value));
writeBytes(toUnoSequence(aQuote)); writeBytes(toUnoSequence(maQuote));
} }
Sequence< FastAttribute > aFastAttrSeq = Attribs->getFastAttributes(); Sequence< FastAttribute > aFastAttrSeq = Attribs->getFastAttributes();
@@ -280,16 +283,16 @@ namespace sax_fastparser {
sal_Int32 nFastAttrLength = aFastAttrSeq.getLength(); sal_Int32 nFastAttrLength = aFastAttrSeq.getLength();
for (sal_Int32 j = 0; j < nFastAttrLength; j++) for (sal_Int32 j = 0; j < nFastAttrLength; j++)
{ {
writeBytes(toUnoSequence(aSpace)); writeBytes(toUnoSequence(maSpace));
sal_Int32 nToken = pFastAttr[j].Token; sal_Int32 nToken = pFastAttr[j].Token;
writeId(nToken); writeId(nToken);
writeBytes(toUnoSequence(aEqualSignAndQuote)); writeBytes(toUnoSequence(maEqualSignAndQuote));
write(escapeXml(Attribs->getValue(pFastAttr[j].Token))); write(escapeXml(Attribs->getValue(pFastAttr[j].Token)));
writeBytes(toUnoSequence(aQuote)); writeBytes(toUnoSequence(maQuote));
} }
} }

View File

@@ -34,6 +34,7 @@
#include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/io/XOutputStream.hpp> #include <com/sun/star/io/XOutputStream.hpp>
#include <cppuhelper/implbase2.hxx> #include <cppuhelper/implbase2.hxx>
#include <rtl/byteseq.hxx>
#include <stack> #include <stack>
#include <map> #include <map>
@@ -188,6 +189,15 @@ private:
void write( const ::rtl::OUString& s ); void write( const ::rtl::OUString& s );
protected: protected:
rtl::ByteSequence maClosingBracket;
rtl::ByteSequence maSlashAndClosingBracket;
rtl::ByteSequence maColon;
rtl::ByteSequence maOpeningBracket;
rtl::ByteSequence maOpeningBracketAndSlash;
rtl::ByteSequence maQuote;
rtl::ByteSequence maEqualSignAndQuote;
rtl::ByteSequence maSpace;
/** Forward the call to the output stream, or write to the stack. /** Forward the call to the output stream, or write to the stack.
The latter in the case that we are inside a mark(). The latter in the case that we are inside a mark().

View File

@@ -177,21 +177,16 @@ namespace sw { namespace mark
} }
} }
NavigatorReminder::NavigatorReminder(const SwPaM& rPaM) NavigatorReminder::NavigatorReminder(const SwPaM& rPaM)
: MarkBase(rPaM, our_sNamePrefix) : MarkBase(rPaM, rtl::OUString("__NavigatorReminder__")) //<-- everything else uses MarkBase::GenerateNewName ?
{ } { }
const ::rtl::OUString NavigatorReminder::our_sNamePrefix(RTL_CONSTASCII_USTRINGPARAM("__NavigatorReminder__"));
UnoMark::UnoMark(const SwPaM& aPaM) UnoMark::UnoMark(const SwPaM& aPaM)
: MarkBase(aPaM, MarkBase::GenerateNewName(our_sNamePrefix)) : MarkBase(aPaM, MarkBase::GenerateNewName(rtl::OUString("__UnoMark__")))
{ } { }
const ::rtl::OUString UnoMark::our_sNamePrefix(RTL_CONSTASCII_USTRINGPARAM("__UnoMark__"));
DdeBookmark::DdeBookmark(const SwPaM& aPaM) DdeBookmark::DdeBookmark(const SwPaM& aPaM)
: MarkBase(aPaM, MarkBase::GenerateNewName(our_sNamePrefix)) : MarkBase(aPaM, MarkBase::GenerateNewName(rtl::OUString("__DdeLink__")))
, m_aRefObj(NULL) , m_aRefObj(NULL)
{ } { }
@@ -200,8 +195,6 @@ namespace sw { namespace mark
m_aRefObj = pObj; m_aRefObj = pObj;
} }
const ::rtl::OUString DdeBookmark::our_sNamePrefix(RTL_CONSTASCII_USTRINGPARAM("__DdeLink__"));
void DdeBookmark::DeregisterFromDoc(SwDoc* const pDoc) void DdeBookmark::DeregisterFromDoc(SwDoc* const pDoc)
{ {
if(m_aRefObj.Is()) if(m_aRefObj.Is())
@@ -282,7 +275,7 @@ namespace sw { namespace mark
Fieldmark::Fieldmark(const SwPaM& rPaM) Fieldmark::Fieldmark(const SwPaM& rPaM)
: MarkBase(rPaM, MarkBase::GenerateNewName(our_sNamePrefix)) : MarkBase(rPaM, MarkBase::GenerateNewName(rtl::OUString("__Fieldmark__")))
{ {
if(!IsExpanded()) if(!IsExpanded())
SetOtherMarkPos(GetMarkPos()); SetOtherMarkPos(GetMarkPos());
@@ -315,8 +308,6 @@ namespace sw { namespace mark
aPaM.InvalidatePaM(); aPaM.InvalidatePaM();
} }
const ::rtl::OUString Fieldmark::our_sNamePrefix(RTL_CONSTASCII_USTRINGPARAM("__Fieldmark__"));
TextFieldmark::TextFieldmark(const SwPaM& rPaM) TextFieldmark::TextFieldmark(const SwPaM& rPaM)
: Fieldmark(rPaM) : Fieldmark(rPaM)
{ } { }

View File

@@ -70,32 +70,32 @@ namespace sw { namespace mark
return *static_cast<SwPosition*>(NULL); return *static_cast<SwPosition*>(NULL);
} }
const char CrossRefHeadingBookmark_NamePrefix[] = "__RefHeading__";
CrossRefHeadingBookmark::CrossRefHeadingBookmark(const SwPaM& rPaM, CrossRefHeadingBookmark::CrossRefHeadingBookmark(const SwPaM& rPaM,
const KeyCode& rCode, const KeyCode& rCode,
const OUString& rName, const OUString& rName,
const OUString& rShortName) const OUString& rShortName)
: CrossRefBookmark(rPaM, rCode, rName, rShortName, our_sNamePrefix) : CrossRefBookmark(rPaM, rCode, rName, rShortName, rtl::OUString(CrossRefHeadingBookmark_NamePrefix))
{ } { }
const ::rtl::OUString CrossRefHeadingBookmark::our_sNamePrefix(RTL_CONSTASCII_USTRINGPARAM("__RefHeading__"));
bool CrossRefHeadingBookmark::IsLegalName(const ::rtl::OUString& rName) bool CrossRefHeadingBookmark::IsLegalName(const ::rtl::OUString& rName)
{ {
return rName.match(our_sNamePrefix); return rName.matchAsciiL(RTL_CONSTASCII_STRINGPARAM(CrossRefHeadingBookmark_NamePrefix));
} }
const char CrossRefNumItemBookmark_NamePrefix[] = "__RefNumPara__";
CrossRefNumItemBookmark::CrossRefNumItemBookmark(const SwPaM& rPaM, CrossRefNumItemBookmark::CrossRefNumItemBookmark(const SwPaM& rPaM,
const KeyCode& rCode, const KeyCode& rCode,
const OUString& rName, const OUString& rName,
const OUString& rShortName) const OUString& rShortName)
: CrossRefBookmark(rPaM, rCode, rName, rShortName, our_sNamePrefix) : CrossRefBookmark(rPaM, rCode, rName, rShortName, rtl::OUString(CrossRefNumItemBookmark_NamePrefix))
{ } { }
const ::rtl::OUString CrossRefNumItemBookmark::our_sNamePrefix(RTL_CONSTASCII_USTRINGPARAM("__RefNumPara__"));
bool CrossRefNumItemBookmark::IsLegalName(const ::rtl::OUString& rName) bool CrossRefNumItemBookmark::IsLegalName(const ::rtl::OUString& rName)
{ {
return rName.match(our_sNamePrefix); return rName.matchAsciiL(RTL_CONSTASCII_STRINGPARAM(CrossRefNumItemBookmark_NamePrefix));
} }
}} }}

View File

@@ -132,8 +132,6 @@ namespace sw { namespace mark
{ {
public: public:
NavigatorReminder(const SwPaM& rPaM); NavigatorReminder(const SwPaM& rPaM);
private:
static const ::rtl::OUString our_sNamePrefix;
}; };
class UnoMark class UnoMark
@@ -141,8 +139,6 @@ namespace sw { namespace mark
{ {
public: public:
UnoMark(const SwPaM& rPaM); UnoMark(const SwPaM& rPaM);
private:
static const ::rtl::OUString our_sNamePrefix;
}; };
class DdeBookmark class DdeBookmark
@@ -167,7 +163,6 @@ namespace sw { namespace mark
virtual ~DdeBookmark(); virtual ~DdeBookmark();
private: private:
SwServerObjectRef m_aRefObj; SwServerObjectRef m_aRefObj;
static const ::rtl::OUString our_sNamePrefix;
}; };
class Bookmark class Bookmark
@@ -235,8 +230,6 @@ namespace sw { namespace mark
::rtl::OUString m_aFieldname; ::rtl::OUString m_aFieldname;
::rtl::OUString m_aFieldHelptext; ::rtl::OUString m_aFieldHelptext;
IFieldmark::parameter_map_t m_vParams; IFieldmark::parameter_map_t m_vParams;
static const ::rtl::OUString our_sNamePrefix;
}; };
class TextFieldmark class TextFieldmark

View File

@@ -80,7 +80,6 @@ namespace sw { namespace mark
const ::rtl::OUString& rShortName); const ::rtl::OUString& rShortName);
static ::rtl::OUString GenerateNewName(); static ::rtl::OUString GenerateNewName();
static bool IsLegalName(const ::rtl::OUString& rName); static bool IsLegalName(const ::rtl::OUString& rName);
static const ::rtl::OUString our_sNamePrefix;
}; };
class CrossRefNumItemBookmark class CrossRefNumItemBookmark
@@ -93,7 +92,6 @@ namespace sw { namespace mark
const ::rtl::OUString& rShortName); const ::rtl::OUString& rShortName);
static ::rtl::OUString GenerateNewName(); static ::rtl::OUString GenerateNewName();
static bool IsLegalName(const ::rtl::OUString& rName); static bool IsLegalName(const ::rtl::OUString& rName);
static const ::rtl::OUString our_sNamePrefix;
}; };
}} }}

View File

@@ -34,6 +34,7 @@
*************************************************************************/ *************************************************************************/
#include <osl/diagnose.h> #include <osl/diagnose.h>
#include <osl/mutex.hxx> #include <osl/mutex.hxx>
#include <rtl/instance.hxx>
#include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/lang/XComponent.hpp> #include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/ucb/XContentIdentifierFactory.hpp> #include <com/sun/star/ucb/XContentIdentifierFactory.hpp>
@@ -56,9 +57,7 @@ using ::rtl::OUString;
namespace namespace
{ {
osl::Mutex globalContentBrokerMutex; struct theContentBrokerMutex : public rtl::Static< osl::Mutex, theContentBrokerMutex > {};
osl::Mutex & getGlobalContentBrokerMutex() { return globalContentBrokerMutex; }
} // namespace } // namespace
namespace ucbhelper namespace ucbhelper
@@ -184,7 +183,7 @@ sal_Bool ContentBroker::initialize(
if ( !m_pTheBroker ) if ( !m_pTheBroker )
{ {
osl::Guard< osl::Mutex > aGuard( getGlobalContentBrokerMutex() ); osl::Guard< osl::Mutex > aGuard( theContentBrokerMutex::get() );
if ( !m_pTheBroker ) if ( !m_pTheBroker )
{ {
@@ -237,7 +236,7 @@ InitUCBHelper()
// static // static
void ContentBroker::deinitialize() void ContentBroker::deinitialize()
{ {
osl::MutexGuard aGuard( getGlobalContentBrokerMutex() ); osl::MutexGuard aGuard( theContentBrokerMutex::get() );
delete m_pTheBroker; delete m_pTheBroker;
m_pTheBroker = 0; m_pTheBroker = 0;