Kaydet (Commit) 4cf1c905 authored tarafından Matteo Casalin's avatar Matteo Casalin Kaydeden (comit) Michael Stahl

String to OUString

Change-Id: I73aef8d848e738fef987449ca60fe8340428e4c9
Reviewed-on: https://gerrit.libreoffice.org/5463Tested-by: 's avatarMichael Stahl <mstahl@redhat.com>
Reviewed-by: 's avatarMichael Stahl <mstahl@redhat.com>
üst cc65e4d2
...@@ -215,7 +215,7 @@ public: ...@@ -215,7 +215,7 @@ public:
sal_uInt16 GetStackCount() const; sal_uInt16 GetStackCount() const;
sal_uInt16 GetAuthor( sal_uInt16 nPos = 0) const; sal_uInt16 GetAuthor( sal_uInt16 nPos = 0) const;
const String& GetAuthorString( sal_uInt16 nPos = 0 ) const; OUString GetAuthorString( sal_uInt16 nPos = 0 ) const;
const DateTime& GetTimeStamp( sal_uInt16 nPos = 0) const; const DateTime& GetTimeStamp( sal_uInt16 nPos = 0) const;
RedlineType_t GetRealType( sal_uInt16 nPos = 0 ) const; RedlineType_t GetRealType( sal_uInt16 nPos = 0 ) const;
RedlineType_t GetType( sal_uInt16 nPos = 0) const RedlineType_t GetType( sal_uInt16 nPos = 0) const
......
...@@ -16,9 +16,8 @@ ...@@ -16,9 +16,8 @@
* except in compliance with the License. You may obtain a copy of * except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 . * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/ */
#ifndef _SWMODULE_HXX #ifndef SWMODULE_HXX
#define _SWMODULE_HXX #define SWMODULE_HXX
#include <tools/string.hxx>
#include <tools/fldunit.hxx> #include <tools/fldunit.hxx>
#include <svl/lstner.hxx> #include <svl/lstner.hxx>
#include <unotools/options.hxx> #include <unotools/options.hxx>
...@@ -66,7 +65,7 @@ namespace com{ namespace sun{ namespace star{ namespace scanner{ ...@@ -66,7 +65,7 @@ namespace com{ namespace sun{ namespace star{ namespace scanner{
class SW_DLLPUBLIC SwModule: public SfxModule, public SfxListener, public utl::ConfigurationListener class SW_DLLPUBLIC SwModule: public SfxModule, public SfxListener, public utl::ConfigurationListener
{ {
String sActAuthor; OUString sActAuthor;
// ConfigItems // ConfigItems
SwModuleOptions* pModuleConfig; SwModuleOptions* pModuleConfig;
...@@ -95,7 +94,7 @@ class SW_DLLPUBLIC SwModule: public SfxModule, public SfxListener, public utl::C ...@@ -95,7 +94,7 @@ class SW_DLLPUBLIC SwModule: public SfxModule, public SfxListener, public utl::C
SwView* pView; SwView* pView;
// List of all Redline-authors. // List of all Redline-authors.
std::vector<String>* pAuthorNames; std::vector<OUString>* pAuthorNames;
// DictionaryList listener to trigger spellchecking or hyphenation // DictionaryList listener to trigger spellchecking or hyphenation
::com::sun::star::uno::Reference< ::com::sun::star::uno::Reference<
...@@ -186,9 +185,9 @@ public: ...@@ -186,9 +185,9 @@ public:
// Redlining. // Redlining.
sal_uInt16 GetRedlineAuthor(); sal_uInt16 GetRedlineAuthor();
const String& GetRedlineAuthor(sal_uInt16 nPos); OUString GetRedlineAuthor(sal_uInt16 nPos);
sal_uInt16 InsertRedlineAuthor(const String& rAuthor); sal_uInt16 InsertRedlineAuthor(const OUString& rAuthor);
void SetRedlineAuthor(const String& rAuthor); // for unit tests void SetRedlineAuthor(const OUString& rAuthor); // for unit tests
void GetInsertAuthorAttr(sal_uInt16 nAuthor, SfxItemSet &rSet); void GetInsertAuthorAttr(sal_uInt16 nAuthor, SfxItemSet &rSet);
void GetDeletedAuthorAttr(sal_uInt16 nAuthor, SfxItemSet &rSet); void GetDeletedAuthorAttr(sal_uInt16 nAuthor, SfxItemSet &rSet);
......
...@@ -291,7 +291,7 @@ bool SwDoc::AppendRedline( SwRedline* pNewRedl, bool bCallDelete ) ...@@ -291,7 +291,7 @@ bool SwDoc::AppendRedline( SwRedline* pNewRedl, bool bCallDelete )
_CHECK_REDLINE( this ) _CHECK_REDLINE( this )
if( IsRedlineOn() && !IsShowOriginal( meRedlineMode ) && if( IsRedlineOn() && !IsShowOriginal( meRedlineMode ) &&
pNewRedl->GetAuthorString().Len() ) !pNewRedl->GetAuthorString().isEmpty() )
{ {
pNewRedl->InvalidateRange(); pNewRedl->InvalidateRange();
...@@ -3711,7 +3711,7 @@ sal_uInt16 SwRedline::GetAuthor( sal_uInt16 nPos ) const ...@@ -3711,7 +3711,7 @@ sal_uInt16 SwRedline::GetAuthor( sal_uInt16 nPos ) const
return GetRedlineData(nPos).nAuthor; return GetRedlineData(nPos).nAuthor;
} }
const String& SwRedline::GetAuthorString( sal_uInt16 nPos ) const OUString SwRedline::GetAuthorString( sal_uInt16 nPos ) const
{ {
return SW_MOD()->GetRedlineAuthor(GetRedlineData(nPos).nAuthor); return SW_MOD()->GetRedlineAuthor(GetRedlineData(nPos).nAuthor);
} }
......
...@@ -398,32 +398,36 @@ sal_uInt16 SwModule::GetRedlineAuthor() ...@@ -398,32 +398,36 @@ sal_uInt16 SwModule::GetRedlineAuthor()
if (!bAuthorInitialised) if (!bAuthorInitialised)
{ {
const SvtUserOptions& rOpt = GetUserOptions(); const SvtUserOptions& rOpt = GetUserOptions();
if( !(sActAuthor = rOpt.GetFullName()).Len() ) sActAuthor = rOpt.GetFullName();
if( !(sActAuthor = rOpt.GetID()).Len() ) if (sActAuthor.isEmpty())
sActAuthor = String( SW_RES( STR_REDLINE_UNKNOWN_AUTHOR )); {
sActAuthor = rOpt.GetID();
if (sActAuthor.isEmpty())
sActAuthor = SW_RESSTR( STR_REDLINE_UNKNOWN_AUTHOR );
}
bAuthorInitialised = sal_True; bAuthorInitialised = sal_True;
} }
return InsertRedlineAuthor( sActAuthor ); return InsertRedlineAuthor( sActAuthor );
} }
void SwModule::SetRedlineAuthor(const String &rAuthor) void SwModule::SetRedlineAuthor(const OUString &rAuthor)
{ {
bAuthorInitialised = sal_True; bAuthorInitialised = sal_True;
sActAuthor = rAuthor; sActAuthor = rAuthor;
InsertRedlineAuthor( sActAuthor ); InsertRedlineAuthor( sActAuthor );
} }
const String& SwModule::GetRedlineAuthor(sal_uInt16 nPos) OUString SwModule::GetRedlineAuthor(sal_uInt16 nPos)
{ {
OSL_ENSURE(nPos < pAuthorNames->size(), "author not found!"); //#i45342# RTF doc with no author table caused reader to crash OSL_ENSURE(nPos < pAuthorNames->size(), "author not found!"); //#i45342# RTF doc with no author table caused reader to crash
while(!(nPos < pAuthorNames->size())) while(!(nPos < pAuthorNames->size()))
{ {
InsertRedlineAuthor(String("nn")); InsertRedlineAuthor("nn");
}; };
return (*pAuthorNames)[nPos]; return (*pAuthorNames)[nPos];
} }
sal_uInt16 SwModule::InsertRedlineAuthor(const String& rAuthor) sal_uInt16 SwModule::InsertRedlineAuthor(const OUString& rAuthor)
{ {
sal_uInt16 nPos = 0; sal_uInt16 nPos = 0;
......
...@@ -191,7 +191,7 @@ SwModule::SwModule( SfxObjectFactory* pWebFact, ...@@ -191,7 +191,7 @@ SwModule::SwModule( SfxObjectFactory* pWebFact,
pStdFontConfig = new SwStdFontConfig; pStdFontConfig = new SwStdFontConfig;
pAuthorNames = new std::vector<String>; // All Redlining-Authors pAuthorNames = new std::vector<OUString>; // All Redlining-Authors
// replace SvxAutocorrect with SwAutocorrect // replace SvxAutocorrect with SwAutocorrect
SvxAutoCorrCfg& rACfg = SvxAutoCorrCfg::Get(); SvxAutoCorrCfg& rACfg = SvxAutoCorrCfg::Get();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment