[Libreoffice-commits] core.git: sw/inc sw/source

Matteo Casalin matteo.casalin at yahoo.com
Tue Aug 20 05:35:43 PDT 2013


 sw/inc/AnnotationWin.hxx             |    2 +-
 sw/inc/SidebarWin.hxx                |    2 +-
 sw/source/ui/docvw/AnnotationWin.cxx |   17 ++++++++---------
 sw/source/ui/docvw/SidebarWin.cxx    |   29 +++++++++++++++--------------
 4 files changed, 25 insertions(+), 25 deletions(-)

New commits:
commit b623669b4d8a6f20f8aa40c7afb4a59f1ad8b5c3
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sun Aug 18 12:59:11 2013 +0200

    String to OUString, cleanup, typo
    
    Change-Id: I0c5d2b194a09002292990e74aeb10984c2b41d0e
    Reviewed-on: https://gerrit.libreoffice.org/5490
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/inc/AnnotationWin.hxx b/sw/inc/AnnotationWin.hxx
index 589f6d0..67cfe44 100644
--- a/sw/inc/AnnotationWin.hxx
+++ b/sw/inc/AnnotationWin.hxx
@@ -43,7 +43,7 @@ class SwAnnotationWin : public sw::sidebarwindows::SwSidebarWin
         virtual void    Delete();
         virtual void    GotoPos();
 
-        virtual String  GetAuthor();
+        virtual OUString GetAuthor();
         virtual Date    GetDate();
         virtual Time    GetTime();
 
diff --git a/sw/inc/SidebarWin.hxx b/sw/inc/SidebarWin.hxx
index f2078c2..cbd728d 100644
--- a/sw/inc/SidebarWin.hxx
+++ b/sw/inc/SidebarWin.hxx
@@ -98,7 +98,7 @@ class SwSidebarWin : public Window
         virtual void    Delete();
         virtual void    GotoPos() = 0;
 
-        virtual String  GetAuthor() = 0;
+        virtual OUString GetAuthor() = 0;
         virtual Date    GetDate() = 0;
         virtual Time    GetTime() = 0;
 
diff --git a/sw/source/ui/docvw/AnnotationWin.cxx b/sw/source/ui/docvw/AnnotationWin.cxx
index 2b0da09..0efc8fb 100644
--- a/sw/source/ui/docvw/AnnotationWin.cxx
+++ b/sw/source/ui/docvw/AnnotationWin.cxx
@@ -225,17 +225,16 @@ void SwAnnotationWin::InitAnswer(OutlinerParaObject* pText)
     SwSidebarWin* pWin = Mgr().GetNextPostIt(KEY_PAGEUP, this);
     const SvtSysLocale aSysLocale;
     const LocaleDataWrapper& rLocalData = aSysLocale.GetLocaleData();
-    String aText = String(SW_RES(STR_REPLY));
-        SwRewriter aRewriter;
-        aRewriter.AddRule(UndoArg1, pWin->GetAuthor());
-        aText = aRewriter.Apply(aText);
-        aText.Append(String(OUString(" (") +
-        String(rLocalData.getDate( pWin->GetDate())) + OUString(", ") +
-        String(rLocalData.getTime( pWin->GetTime(),false)) + OUString("): \"")));
+    SwRewriter aRewriter;
+    aRewriter.AddRule(UndoArg1, pWin->GetAuthor());
+    const OUString aText = aRewriter.Apply(SW_RESSTR(STR_REPLY))
+            + " (" + rLocalData.getDate( pWin->GetDate())
+            + ", " + rLocalData.getTime( pWin->GetTime(), false)
+            + "): \"";
     GetOutlinerView()->InsertText(aText,false);
 
     // insert old, selected text or "..."
-    // TOOD: iterate over all paragraphs, not only first one to find out if it is empty
+    // TODO: iterate over all paragraphs, not only first one to find out if it is empty
     if (pText->GetTextObject().GetText(0).Len())
         GetOutlinerView()->GetEditView().InsertText(pText->GetTextObject());
     else
@@ -299,7 +298,7 @@ bool SwAnnotationWin::IsProtected()
            ( mpFmtFld ? mpFmtFld->IsProtect() : false );
 }
 
-String SwAnnotationWin::GetAuthor()
+OUString SwAnnotationWin::GetAuthor()
 {
     return mpFld->GetPar1();
 }
diff --git a/sw/source/ui/docvw/SidebarWin.cxx b/sw/source/ui/docvw/SidebarWin.cxx
index fa0fed6..ab1471a 100644
--- a/sw/source/ui/docvw/SidebarWin.cxx
+++ b/sw/source/ui/docvw/SidebarWin.cxx
@@ -78,8 +78,6 @@ namespace sw { namespace sidebarwindows {
 #define POSTIT_META_HEIGHT  (sal_Int32)     30
 #define POSTIT_MINIMUMSIZE_WITHOUT_META     50
 
-#define EMPTYSTRING             OUString()
-
 SwSidebarWin::SwSidebarWin( SwEditWin& rEditWin,
                             WinBits nBits,
                             SwPostItMgr& aMgr,
@@ -260,8 +258,12 @@ SfxItemSet SwSidebarWin::DefaultItem()
 {
     SfxItemSet aItem( mrView.GetDocShell()->GetPool() );
     aItem.Put(SvxFontHeightItem(200,100,EE_CHAR_FONTHEIGHT));
-    aItem.Put(SvxFontItem(FAMILY_SWISS,GetSettings().GetStyleSettings().GetFieldFont().GetName(),
-        EMPTYSTRING,PITCH_DONTKNOW,RTL_TEXTENCODING_DONTKNOW,EE_CHAR_FONTINFO));
+    aItem.Put(SvxFontItem(FAMILY_SWISS,
+                          GetSettings().GetStyleSettings().GetFieldFont().GetName(),
+                          OUString(),
+                          PITCH_DONTKNOW,
+                          RTL_TEXTENCODING_DONTKNOW,
+                          EE_CHAR_FONTINFO));
     return aItem;
 }
 
@@ -378,11 +380,11 @@ void SwSidebarWin::CheckMetaText()
     OUString sMeta = GetAuthor();
     if (sMeta.isEmpty())
     {
-        sMeta = OUString(SW_RES(STR_NOAUTHOR));
+        sMeta = SW_RESSTR(STR_NOAUTHOR);
     }
     else if (sMeta.getLength() > 22)
     {
-        sMeta = sMeta.copy(0, 20) + OUString("...");
+        sMeta = sMeta.copy(0, 20) + "...";
     }
     if ( mpMetadataAuthor->GetText() != sMeta )
     {
@@ -393,11 +395,11 @@ void SwSidebarWin::CheckMetaText()
     Date aDate = GetDate();
     if (aDate==aSysDate)
     {
-        sMeta = String(SW_RES(STR_POSTIT_TODAY));
+        sMeta = SW_RESSTR(STR_POSTIT_TODAY);
     }
     else if (aDate == Date(aSysDate-1))
     {
-        sMeta = String(SW_RES(STR_POSTIT_YESTERDAY));
+        sMeta = SW_RESSTR(STR_POSTIT_YESTERDAY);
     }
     else if (aDate.IsValidAndGregorian() )
     {
@@ -405,11 +407,11 @@ void SwSidebarWin::CheckMetaText()
     }
     else
     {
-        sMeta = String(SW_RES(STR_NODATE));
+        sMeta = SW_RESSTR(STR_NODATE);
     }
     if (GetTime()!=0)
     {
-        sMeta = sMeta + OUString(" ")  + rLocalData.getTime( GetTime(),false );
+        sMeta += " " + rLocalData.getTime( GetTime(),false );
     }
     if ( mpMetadataDate->GetText() != sMeta )
     {
@@ -569,7 +571,7 @@ void SwSidebarWin::DoResize()
     aHeight -= GetMetaHeight();
     mpMetadataAuthor->Show();
     mpMetadataDate->Show();
-    mpSidebarTxtControl->SetQuickHelpText(EMPTYSTRING);
+    mpSidebarTxtControl->SetQuickHelpText(OUString());
 
     if ((aTextHeight > aHeight) && !IsPreview())
     {   // we need vertical scrollbars and have to reduce the width
@@ -866,8 +868,7 @@ void SwSidebarWin::DeactivatePostIt()
         GetOutlinerView()->SetBackgroundColor(COL_TRANSPARENT);
 
 
-    if ( !IsProtected() &&
-         Engine()->GetEditEngine().GetText()==OUString(EMPTYSTRING) )
+    if ( !IsProtected() && Engine()->GetEditEngine().GetText().isEmpty() )
     {
         mnEventId = Application::PostUserEvent( LINK( this, SwSidebarWin, DeleteHdl), 0 );
     }
@@ -899,7 +900,7 @@ void SwSidebarWin::ExecuteCommand(sal_uInt16 nSlot)
         {
             // if this note is empty, it will be deleted once losing the focus, so no reply, but only a new note
             // will be created
-            if (Engine()->GetEditEngine().GetText() != OUString(EMPTYSTRING))
+            if (!Engine()->GetEditEngine().GetText().isEmpty())
             {
                 OutlinerParaObject* pPara = new OutlinerParaObject(*GetOutlinerView()->GetEditView().CreateTextObject());
                 mrMgr.RegisterAnswer(pPara);


More information about the Libreoffice-commits mailing list