[Libreoffice-commits] core.git: sc/source

Julien Nabet serval2412 at yahoo.fr
Sun Sep 15 05:52:03 PDT 2013


 sc/source/ui/dbgui/scendlg.cxx |   40 ++++++++++++++--------------------------
 sc/source/ui/inc/scendlg.hxx   |    6 +++---
 2 files changed, 17 insertions(+), 29 deletions(-)

New commits:
commit 3f2c8032bfc9bb6c5f8d5be258858bee787ceb83
Author: Julien Nabet <serval2412 at yahoo.fr>
Date:   Sun Sep 15 14:51:09 2013 +0200

    String -> OUString + avoid multiple concat
    
    Change-Id: I83f1475d804caf256ebc18a63d176c1127a7c0dc

diff --git a/sc/source/ui/dbgui/scendlg.cxx b/sc/source/ui/dbgui/scendlg.cxx
index 31c11d4..4499e72 100644
--- a/sc/source/ui/dbgui/scendlg.cxx
+++ b/sc/source/ui/dbgui/scendlg.cxx
@@ -42,7 +42,7 @@
 
 //========================================================================
 
-ScNewScenarioDlg::ScNewScenarioDlg( Window* pParent, const String& rName, sal_Bool bEdit, sal_Bool bSheetProtected)
+ScNewScenarioDlg::ScNewScenarioDlg( Window* pParent, const OUString& rName, sal_Bool bEdit, sal_Bool bSheetProtected)
 
     :   ModalDialog     ( pParent, ScResId( RID_SCDLG_NEWSCENARIO ) ),
         aFlName         ( this, ScResId( FL_NAME )),
@@ -65,7 +65,7 @@ ScNewScenarioDlg::ScNewScenarioDlg( Window* pParent, const String& rName, sal_Bo
         bIsEdit         ( bEdit )
 {
     if (bIsEdit)
-        SetText(String(ScResId(STR_EDIT)));
+        SetText(OUString(ScResId(STR_EDIT)));
 
     SfxObjectShell* pDocSh = SfxObjectShell::Current();
     if ( pDocSh )
@@ -90,25 +90,16 @@ ScNewScenarioDlg::ScNewScenarioDlg( Window* pParent, const String& rName, sal_Bo
 
     SvtUserOptions aUserOpt;
 
-    String aComment( ScResId( STR_CREATEDBY ) );
-
-    aComment += ' ';
-    aComment += (String)aUserOpt.GetFirstName();
-    aComment += ' ';
-    aComment += (String)aUserOpt.GetLastName();
-    aComment.AppendAscii(RTL_CONSTASCII_STRINGPARAM( ", " ));
-    aComment += String( ScResId( STR_ON ) );
-    aComment += ' ';
-    aComment += ScGlobal::GetpLocaleData()->getDate( Date( Date::SYSTEM ) );
-    aComment.AppendAscii(RTL_CONSTASCII_STRINGPARAM( ", " ));
-    aComment += ScGlobal::GetpLocaleData()->getTime( Time( Time::SYSTEM ) );
-
-    aEdComment  .SetText( aComment );
-    aEdName     .SetText( rName );
-    aBtnOk      .SetClickHdl( LINK( this, ScNewScenarioDlg, OkHdl ) );
+    OUString aComment(OUString(ScResId(STR_CREATEDBY)) + " " + aUserOpt.GetFirstName() + " " +aUserOpt.GetLastName()
+              + ", " + OUString(ScResId(STR_ON)) + " " + ScGlobal::GetpLocaleData()->getDate(Date(Date::SYSTEM))
+              + ", " + ScGlobal::GetpLocaleData()->getTime(Time(Time::SYSTEM)));
+
+    aEdComment.SetText(aComment);
+    aEdName.SetText(rName);
+    aBtnOk.SetClickHdl( LINK( this, ScNewScenarioDlg, OkHdl ) );
     aCbShowFrame.SetClickHdl( LINK( this, ScNewScenarioDlg, EnableHdl ) );
 
-    aLbColor.SetAccessibleName(String(ScResId( STR_COLOR ) ));
+    aLbColor.SetAccessibleName(OUString(ScResId( STR_COLOR ) ));
 
     FreeResource();
 
@@ -201,22 +192,19 @@ void ScNewScenarioDlg::SetScenarioData( const OUString& rName, const OUString& r
 
 IMPL_LINK_NOARG(ScNewScenarioDlg, OkHdl)
 {
-    String      aName = comphelper::string::strip(aEdName.GetText(), ' ');
-    ScDocument* pDoc    = ((ScTabViewShell*)SfxViewShell::Current())->
-                                GetViewData()->GetDocument();
+    OUString      aName = comphelper::string::strip(aEdName.GetText(), ' ');
+    ScDocument* pDoc    = ((ScTabViewShell*)SfxViewShell::Current())->GetViewData()->GetDocument();
 
     aEdName.SetText( aName );
 
     if ( !pDoc->ValidTabName( aName ) )
     {
-        InfoBox( this, ScGlobal::GetRscString( STR_INVALIDTABNAME ) ).
-            Execute();
+        InfoBox( this, ScGlobal::GetRscString( STR_INVALIDTABNAME ) ).Execute();
         aEdName.GrabFocus();
     }
     else if ( !bIsEdit && !pDoc->ValidNewTabName( aName ) )
     {
-        InfoBox( this, ScGlobal::GetRscString( STR_NEWTABNAMENOTUNIQUE ) ).
-            Execute();
+        InfoBox( this, ScGlobal::GetRscString( STR_NEWTABNAMENOTUNIQUE ) ).Execute();
         aEdName.GrabFocus();
     }
     else
diff --git a/sc/source/ui/inc/scendlg.hxx b/sc/source/ui/inc/scendlg.hxx
index c1b1e25..dbbbe13 100644
--- a/sc/source/ui/inc/scendlg.hxx
+++ b/sc/source/ui/inc/scendlg.hxx
@@ -33,7 +33,7 @@
 class ScNewScenarioDlg : public ModalDialog
 {
 public:
-        ScNewScenarioDlg( Window* pParent, const String& rName, sal_Bool bEdit = false, sal_Bool bSheetProtected = false );
+        ScNewScenarioDlg( Window* pParent, const OUString& rName, sal_Bool bEdit = false, sal_Bool bSheetProtected = false );
         ~ScNewScenarioDlg();
 
     void SetScenarioData( const OUString& rName, const OUString& rComment,
@@ -59,8 +59,8 @@ private:
     OKButton            aBtnOk;
     CancelButton        aBtnCancel;
     HelpButton          aBtnHelp;
-    const String        aDefScenarioName;
-    sal_Bool                bIsEdit;
+    const OUString      aDefScenarioName;
+    sal_Bool            bIsEdit;
 
     DECL_LINK(OkHdl, void *);
     DECL_LINK( EnableHdl, CheckBox * );


More information about the Libreoffice-commits mailing list