From 279ae5116119b96b25fa56b53ecde4d61878cad7 Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Tue, 1 Oct 2013 21:51:50 -0400 Subject: [PATCH] Add method to normalize strings in EditTextObject. Change-Id: I1adb57279db0afeb8387599ec11984380e5a2e4a --- editeng/source/editeng/editobj.cxx | 21 +++++++++++++++++++++ editeng/source/editeng/editobj2.hxx | 10 ++++++++++ include/editeng/editobj.hxx | 13 +++++++++++++ 3 files changed, 44 insertions(+) diff --git a/editeng/source/editeng/editobj.cxx b/editeng/source/editeng/editobj.cxx index 8e35a576f0e0..aaf5e5fa064f 100644 --- a/editeng/source/editeng/editobj.cxx +++ b/editeng/source/editeng/editobj.cxx @@ -44,6 +44,7 @@ #include #include +#include "svl/stringpool.hxx" #include #include @@ -148,6 +149,11 @@ ContentInfo::~ContentInfo() aAttribs.clear(); } +void ContentInfo::NormalizeString( svl::StringPool& rPool ) +{ + aText = OUString(rPool.intern(aText)); +} + const WrongList* ContentInfo::GetWrongList() const { return mpWrongs.get(); @@ -316,6 +322,11 @@ editeng::FieldUpdater EditTextObject::GetFieldUpdater() return mpImpl->GetFieldUpdater(); } +void EditTextObject::NormalizeString( svl::StringPool& rPool ) +{ + mpImpl->NormalizeString(rPool); +} + const SfxItemPool* EditTextObject::GetPool() const { return mpImpl->GetPool(); @@ -602,6 +613,16 @@ void EditTextObjectImpl::SetUserType( sal_uInt16 n ) nUserType = n; } +void EditTextObjectImpl::NormalizeString( svl::StringPool& rPool ) +{ + ContentInfosType::iterator it = aContents.begin(), itEnd = aContents.end(); + for (; it != itEnd; ++it) + { + ContentInfo& rInfo = *it; + rInfo.NormalizeString(rPool); + } +} + bool EditTextObjectImpl::IsVertical() const { return bVertical; diff --git a/editeng/source/editeng/editobj2.hxx b/editeng/source/editeng/editobj2.hxx index b704e48a1fb0..c331134801c9 100644 --- a/editeng/source/editeng/editobj2.hxx +++ b/editeng/source/editeng/editobj2.hxx @@ -35,6 +35,12 @@ struct Section; } +namespace svl { + +class StringPool; + +} + class XEditAttribute { private: @@ -136,6 +142,8 @@ private: public: ~ContentInfo(); + void NormalizeString( svl::StringPool& rPool ); + const XEditAttributesType& GetAttribs() const { return aAttribs; } XEditAttributesType& GetAttribs() { return aAttribs; } @@ -198,6 +206,8 @@ public: sal_uInt16 GetUserType() const; void SetUserType( sal_uInt16 n ); + void NormalizeString( svl::StringPool& rPool ); + bool IsVertical() const; void SetVertical( bool b ); diff --git a/include/editeng/editobj.hxx b/include/editeng/editobj.hxx index cdb8fbb3a434..36392e213e6c 100644 --- a/include/editeng/editobj.hxx +++ b/include/editeng/editobj.hxx @@ -49,6 +49,12 @@ struct Section; } +namespace svl { + +class StringPool; + +} + class EditTextObjectImpl; class EDITENG_DLLPUBLIC EditTextObject : public SfxItemPoolUser @@ -72,6 +78,13 @@ public: EditTextObject( const EditTextObject& r ); virtual ~EditTextObject(); + /** + * Set paragraph strings to the shared string pool. + * + * @param rPool shared string pool. + */ + void NormalizeString( svl::StringPool& rPool ); + const SfxItemPool* GetPool() const; sal_uInt16 GetUserType() const; // For OutlinerMode, it can however not save in compatible format void SetUserType( sal_uInt16 n );