[Libreoffice-commits] core.git: 4 commits - basic/source cppcanvas/source sfx2/source sfx2/uiconfig sfx2/UIConfig_sfx.mk

Caolán McNamara caolanm at redhat.com
Wed Jul 10 01:50:28 PDT 2013


 basic/source/runtime/inputbox.cxx             |    8 -
 cppcanvas/source/mtfrenderer/implrenderer.cxx |  118 ++-----------------
 sfx2/UIConfig_sfx.mk                          |    3 
 sfx2/source/dialog/dialog.hrc                 |    2 
 sfx2/source/dialog/versdlg.cxx                |   70 +++++------
 sfx2/source/dialog/versdlg.src                |   60 ---------
 sfx2/source/inc/versdlg.hxx                   |   22 +--
 sfx2/uiconfig/ui/versioncommentdialog.ui      |  160 ++++++++++++++++++++++++++
 8 files changed, 225 insertions(+), 218 deletions(-)

New commits:
commit 137e4bd885a913cb201d92dfc7815b2821986d49
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jul 9 17:11:15 2013 +0100

    convert version comment dialog to .ui format
    
    Change-Id: I7bbcc19062883932bf2e2fd68928f3f5624c4748

diff --git a/sfx2/UIConfig_sfx.mk b/sfx2/UIConfig_sfx.mk
index 2adb858..b865a71 100644
--- a/sfx2/UIConfig_sfx.mk
+++ b/sfx2/UIConfig_sfx.mk
@@ -13,6 +13,7 @@ $(eval $(call gb_UIConfig_add_uifiles,sfx,\
 	sfx2/uiconfig/ui/checkin \
 	sfx2/uiconfig/ui/custominfopage \
 	sfx2/uiconfig/ui/descriptioninfopage \
+	sfx2/uiconfig/ui/documentfontspage \
 	sfx2/uiconfig/ui/documentinfopage \
 	sfx2/uiconfig/ui/documentpropertiesdialog \
 	sfx2/uiconfig/ui/licensedialog \
@@ -23,7 +24,7 @@ $(eval $(call gb_UIConfig_add_uifiles,sfx,\
 	sfx2/uiconfig/ui/querysavedialog \
 	sfx2/uiconfig/ui/securityinfopage \
 	sfx2/uiconfig/ui/singletabdialog \
-	sfx2/uiconfig/ui/documentfontspage \
+	sfx2/uiconfig/ui/versioncommentdialog \
 ))
 
 # vim: set noet sw=4 ts=4:
diff --git a/sfx2/source/dialog/dialog.hrc b/sfx2/source/dialog/dialog.hrc
index a0158af..51c85a4 100644
--- a/sfx2/source/dialog/dialog.hrc
+++ b/sfx2/source/dialog/dialog.hrc
@@ -48,7 +48,7 @@
 #define MN_CONTEXT_TEMPLDLG             ( RC_DIALOG_BEGIN + 46)
 
 #define DLG_VERSIONS                    ( RC_DIALOG_BEGIN + 69 )
-#define DLG_COMMENTS                    ( RC_DIALOG_BEGIN + 70 )
+
 #define STR_VIEWVERSIONCOMMENT          ( RC_DIALOG_BEGIN + 71 )
 
 #define MSG_ERROR_WRONG_CONFIRM         ( RC_DIALOG_BEGIN + 76 )
diff --git a/sfx2/source/dialog/versdlg.cxx b/sfx2/source/dialog/versdlg.cxx
index 41ade0f..d4976c4 100644
--- a/sfx2/source/dialog/versdlg.cxx
+++ b/sfx2/source/dialog/versdlg.cxx
@@ -375,7 +375,7 @@ IMPL_LINK( SfxVersionDialog, ButtonHdl_Impl, Button*, pButton )
     {
         SfxVersionInfo aInfo;
         aInfo.aAuthor = SvtUserOptions().GetFullName();
-        SfxViewVersionDialog_Impl* pDlg = new SfxViewVersionDialog_Impl( this, aInfo, sal_True );
+        SfxViewVersionDialog_Impl* pDlg = new SfxViewVersionDialog_Impl(this, aInfo, true);
         short nRet = pDlg->Execute();
         if ( nRet == RET_OK )
         {
@@ -409,7 +409,7 @@ IMPL_LINK( SfxVersionDialog, ButtonHdl_Impl, Button*, pButton )
     else if ( pButton == &aViewButton && pEntry )
     {
         SfxVersionInfo* pInfo = (SfxVersionInfo*) pEntry->GetUserData();
-        SfxViewVersionDialog_Impl* pDlg = new SfxViewVersionDialog_Impl( this, *pInfo, sal_False );
+        SfxViewVersionDialog_Impl* pDlg = new SfxViewVersionDialog_Impl(this, *pInfo, false);
         pDlg->Execute();
         delete pDlg;
     }
@@ -435,54 +435,46 @@ IMPL_LINK( SfxVersionDialog, ButtonHdl_Impl, Button*, pButton )
     return 0L;
 }
 
-SfxViewVersionDialog_Impl::SfxViewVersionDialog_Impl ( Window *pParent, SfxVersionInfo& rInfo, sal_Bool bEdit )
-    : SfxModalDialog( pParent, SfxResId( DLG_COMMENTS ) )
-    , aDateTimeText( this, SfxResId( FT_DATETIME ) )
-    , aSavedByText( this, SfxResId( FT_SAVEDBY ) )
-    , aEdit( this, SfxResId( ME_VERSIONS ) )
-    , aOKButton( this, SfxResId( PB_OK ) )
-    , aCancelButton( this, SfxResId( PB_CANCEL ) )
-    , aCloseButton( this, SfxResId( PB_CLOSE ) )
-    , aHelpButton( this, SfxResId( PB_HELP ) )
-    , pInfo( &rInfo )
+SfxViewVersionDialog_Impl::SfxViewVersionDialog_Impl(Window *pParent, SfxVersionInfo& rInfo, bool bEdit)
+    : SfxModalDialog(pParent, "VersionCommentDialog", "sfx/ui/versioncommentdialog.ui")
+    , m_rInfo(rInfo)
 {
-    FreeResource();
+    get(m_pDateTimeText, "timestamp");
+    get(m_pSavedByText, "author");
+    get(m_pEdit, "textview");
+    get(m_pOKButton, "ok");
+    get(m_pCancelButton, "cancel");
+    get(m_pCloseButton, "close");
 
     const LocaleDataWrapper& rLocaleWrapper( Application::GetSettings().GetLocaleDataWrapper() );
-    aDateTimeText.SetText( aDateTimeText.GetText() + ConvertDateTime_Impl( pInfo->aCreationDate, rLocaleWrapper ) );
-    aSavedByText.SetText( aSavedByText.GetText() + pInfo->aAuthor );
-    aEdit.SetText( rInfo.aComment );
-
-    aCloseButton.SetClickHdl ( LINK( this, SfxViewVersionDialog_Impl, ButtonHdl ) );
-    aOKButton.SetClickHdl ( LINK( this, SfxViewVersionDialog_Impl, ButtonHdl ) );
-
-    aEdit.GrabFocus();
-    if ( !bEdit )
+    m_pDateTimeText->SetText(m_pDateTimeText->GetText() + ConvertDateTime_Impl(rInfo.aCreationDate, rLocaleWrapper));
+    m_pSavedByText->SetText(m_pSavedByText->GetText() + rInfo.aAuthor);
+    m_pEdit->SetText(rInfo.aComment);
+    m_pEdit->set_height_request(7 * m_pEdit->GetTextHeight());
+    m_pEdit->set_width_request(40 * m_pEdit->approximate_char_width());
+    m_pOKButton->SetClickHdl(LINK(this, SfxViewVersionDialog_Impl, ButtonHdl));
+
+    if (!bEdit)
     {
-        aOKButton.Hide();
-        aCancelButton.Hide();
-        aEdit.SetReadOnly( sal_True );
-        SetText( SfxResId( STR_VIEWVERSIONCOMMENT ) );
+        m_pOKButton->Hide();
+        m_pCancelButton->Hide();
+        m_pEdit->SetReadOnly(true);
+        SetText(SfxResId(STR_VIEWVERSIONCOMMENT));
+        m_pCloseButton->GrabFocus();
     }
     else
     {
-        aDateTimeText.Hide();
-        aCloseButton.Hide();
+        m_pDateTimeText->Hide();
+        m_pCloseButton->Hide();
+        m_pEdit->GrabFocus();
     }
 }
 
-IMPL_LINK( SfxViewVersionDialog_Impl, ButtonHdl, Button*, pButton )
+IMPL_LINK(SfxViewVersionDialog_Impl, ButtonHdl, Button*, pButton)
 {
-    if ( pButton == &aCloseButton )
-    {
-        EndDialog( RET_CANCEL );
-    }
-    else if ( pButton == &aOKButton )
-    {
-        pInfo->aComment = aEdit.GetText();
-        EndDialog( RET_OK );
-    }
-
+    assert(pButton == m_pOKButton);
+    m_rInfo.aComment = m_pEdit->GetText();
+    EndDialog(RET_OK);
     return 0L;
 }
 
diff --git a/sfx2/source/dialog/versdlg.src b/sfx2/source/dialog/versdlg.src
index 8dbab6f..5b02a4b 100644
--- a/sfx2/source/dialog/versdlg.src
+++ b/sfx2/source/dialog/versdlg.src
@@ -126,66 +126,6 @@ ModalDialog DLG_VERSIONS
     };
     Text [ en-US ] = "Versions of" ;
 };
-ModalDialog DLG_COMMENTS
-{
-    HelpID = "sfx2:ModalDialog:DLG_COMMENTS";
-    OutputSize = TRUE ;
-    Size = MAP_APPFONT ( 180 , 118 ) ;
-    SvLook = TRUE ;
-    Moveable = TRUE ;
-    FixedText FT_DATETIME
-    {
-        Pos = MAP_APPFONT ( 6 , 6 ) ;
-        Size = MAP_APPFONT ( 168 , 10 ) ;
-        Text [ en-US ] = "Date and time: " ;
-    };
-    FixedText FT_SAVEDBY
-    {
-        Pos = MAP_APPFONT ( 6 , 19 ) ;
-        Size = MAP_APPFONT ( 168 , 10 ) ;
-        Text [ en-US ] = "Saved by " ;
-    };
-    MultiLineEdit ME_VERSIONS
-    {
-        HelpID = "sfx2:MultiLineEdit:DLG_COMMENTS:ME_VERSIONS";
-        Border = TRUE ;
-        Pos = MAP_APPFONT ( 6 , 32 ) ;
-        Size = MAP_APPFONT ( 168 , 60 ) ;
-        TabStop = TRUE ;
-    };
-    OKButton PB_OK
-    {
-        Pos = MAP_APPFONT ( 15 , 98 ) ;
-        Size = MAP_APPFONT ( 50 , 14 ) ;
-        TabStop = TRUE ;
-        DefButton = TRUE ;
-    };
-    CancelButton PB_CANCEL
-    {
-        Pos = MAP_APPFONT ( 68 , 98 ) ;
-        Size = MAP_APPFONT ( 50 , 14 ) ;
-        TabStop = TRUE ;
-    };
-    PushButton PB_CLOSE
-    {
-        HelpID = "sfx2:PushButton:DLG_COMMENTS:PB_CLOSE";
-        Pos = MAP_APPFONT ( 68 , 98 ) ;
-        Size = MAP_APPFONT ( 50 , 14 ) ;
-        TabStop = TRUE ;
-        Text [ en-US ] = "~Close" ;
-    };
-    HelpButton PB_HELP
-    {
-        Pos = MAP_APPFONT ( 124 , 98 ) ;
-        Size = MAP_APPFONT ( 50 , 14 ) ;
-        TabStop = TRUE ;
-    };
-    Text [ en-US ] = "Insert Version Comment" ;
-};
-String DLG_COMMENTS
-{
-    Text [ en-US ] = "Version comment" ;
-};
 String STR_VIEWVERSIONCOMMENT
 {
     Text [ en-US ] = "View Version Comment" ;
diff --git a/sfx2/source/inc/versdlg.hxx b/sfx2/source/inc/versdlg.hxx
index a81e8ea..1853a3d 100644
--- a/sfx2/source/inc/versdlg.hxx
+++ b/sfx2/source/inc/versdlg.hxx
@@ -74,21 +74,19 @@ public:
 
 class SfxViewVersionDialog_Impl : public SfxModalDialog
 {
-    FixedText                   aDateTimeText;
-    FixedText                   aSavedByText;
-    MultiLineEdit               aEdit;
-    OKButton                    aOKButton;
-    CancelButton                aCancelButton;
-    PushButton                  aCloseButton;
-    HelpButton                  aHelpButton;
-    SfxVersionInfo*             pInfo;
+    FixedText*        m_pDateTimeText;
+    FixedText*        m_pSavedByText;
+    VclMultiLineEdit* m_pEdit;
+    OKButton*         m_pOKButton;
+    CancelButton*     m_pCancelButton;
+    CloseButton*      m_pCloseButton;
+    SfxVersionInfo&   m_rInfo;
 
-    DECL_LINK(                  ButtonHdl, Button* );
+    DECL_LINK(ButtonHdl, Button*);
 
 public:
-                                SfxViewVersionDialog_Impl( Window *pParent,
-                                    SfxVersionInfo& rInfo, sal_Bool bEdit );
- };
+    SfxViewVersionDialog_Impl(Window *pParent, SfxVersionInfo& rInfo, bool bEdit);
+};
 
 #endif
 
diff --git a/sfx2/uiconfig/ui/versioncommentdialog.ui b/sfx2/uiconfig/ui/versioncommentdialog.ui
new file mode 100644
index 0000000..0967148
--- /dev/null
+++ b/sfx2/uiconfig/ui/versioncommentdialog.ui
@@ -0,0 +1,160 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <!-- interface-requires gtk+ 3.6 -->
+  <object class="GtkDialog" id="VersionCommentDialog">
+    <property name="can_focus">False</property>
+    <property name="border_width">6</property>
+    <property name="title" translatable="yes">Insert Version Comment</property>
+    <property name="type_hint">dialog</property>
+    <child internal-child="vbox">
+      <object class="GtkBox" id="dialog-vbox1">
+        <property name="can_focus">False</property>
+        <property name="orientation">vertical</property>
+        <property name="spacing">12</property>
+        <child internal-child="action_area">
+          <object class="GtkButtonBox" id="dialog-action_area1">
+            <property name="can_focus">False</property>
+            <property name="layout_style">end</property>
+            <child>
+              <object class="GtkButton" id="ok">
+                <property name="label">gtk-ok</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="has_default">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="close">
+                <property name="label">gtk-close</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="has_default">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="cancel">
+                <property name="label">gtk-cancel</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">2</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="help">
+                <property name="label">gtk-help</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">3</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="pack_type">end</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkGrid" id="grid1">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="hexpand">True</property>
+            <property name="vexpand">True</property>
+            <property name="row_spacing">12</property>
+            <child>
+              <object class="GtkLabel" id="timestamp">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes">Date and time: </property>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">0</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="author">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes">Saved by: </property>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">1</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkScrolledWindow" id="scrolledwindow1">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="hexpand">True</property>
+                <property name="vexpand">True</property>
+                <property name="shadow_type">in</property>
+                <child>
+                  <object class="GtkTextView" id="textview">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="hexpand">True</property>
+                    <property name="vexpand">True</property>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">2</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <action-widgets>
+      <action-widget response="0">ok</action-widget>
+      <action-widget response="0">close</action-widget>
+      <action-widget response="0">cancel</action-widget>
+      <action-widget response="0">help</action-widget>
+    </action-widgets>
+  </object>
+</interface>
commit c6de82163e990478aa6448cf5b6537bcca1b80b5
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Jul 10 09:32:40 2013 +0100

    drop intermediate strings
    
    Change-Id: Ib4a2bf25fcb834bda1bc515152b01c292704893a

diff --git a/basic/source/runtime/inputbox.cxx b/basic/source/runtime/inputbox.cxx
index 14fe7f1..c009f88 100644
--- a/basic/source/runtime/inputbox.cxx
+++ b/basic/source/runtime/inputbox.cxx
@@ -65,12 +65,12 @@ SvRTLInputBox::SvRTLInputBox( Window* pParent, const String& rPrompt,
     aCancel.Show();
     aEdit.Show();
     aPromptText.Show();
-    SetText( OUString(rTitle) );
+    SetText( rTitle );
     Font aFont( GetFont());
     Color aColor( GetBackground().GetColor() );
     aFont.SetFillColor( aColor );
     aEdit.SetFont( aFont );
-    aEdit.SetText( OUString(rDefault) );
+    aEdit.SetText( rDefault );
     aEdit.SetSelection( Selection( SELECTION_MIN, SELECTION_MAX ) );
 }
 
@@ -107,9 +107,9 @@ void SvRTLInputBox::PositionPrompt(const String& rPrompt,const Size& rDlgSize)
 {
     if ( rPrompt.Len() == 0 )
         return;
-    String aText_(convertLineEnd(rPrompt, LINEEND_CR));
+    OUString aText_(convertLineEnd(rPrompt, LINEEND_CR));
     aPromptText.SetPosPixel( LogicToPixel(Point(5,5)));
-    aPromptText.SetText( OUString(aText_) );
+    aPromptText.SetText( aText_ );
     Size aSize( rDlgSize );
     aSize.Width() -= 70;
     aSize.Height() -= 50;
commit 1970b28c5c1fec03374bc053ea51e1147d0b3f49
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Jul 10 09:03:43 2013 +0100

    merge duplicated code
    
    Change-Id: Ib13f17a0fe3173f4cd0ae7139f56badb39dcb6cb

diff --git a/cppcanvas/source/mtfrenderer/implrenderer.cxx b/cppcanvas/source/mtfrenderer/implrenderer.cxx
index b26c0fb..8f1dd8d 100644
--- a/cppcanvas/source/mtfrenderer/implrenderer.cxx
+++ b/cppcanvas/source/mtfrenderer/implrenderer.cxx
@@ -224,99 +224,16 @@ namespace
         return BitmapEx( aSolid, aMask );
     }
 
-    /** Shameless rip from vcl/source/gdi/outdev3.cxx
-
-        Should consolidate, into something like basetxt...
-     */
-    sal_Unicode getLocalizedChar( sal_Unicode nChar, LanguageType eLang )
-    {
-        // currently only conversion from ASCII digits is interesting
-        if( (nChar < '0') || ('9' < nChar) )
-            return nChar;
-
-        sal_Unicode nOffset(0);
-        // eLang & LANGUAGE_MASK_PRIMARY catches language independent of region.
-        // CAVEAT! To some like Mongolian MS assigned the same primary language
-        // although the script type is different!
-        switch( eLang & LANGUAGE_MASK_PRIMARY )
-        {
-            default:
-                break;
-
-            case LANGUAGE_ARABIC_SAUDI_ARABIA  & LANGUAGE_MASK_PRIMARY:
-            case LANGUAGE_URDU          & LANGUAGE_MASK_PRIMARY:
-            case LANGUAGE_PUNJABI       & LANGUAGE_MASK_PRIMARY: //???
-                nOffset = 0x0660 - '0';  // arabic/persian/urdu
-                break;
-            case LANGUAGE_BENGALI       & LANGUAGE_MASK_PRIMARY:
-                nOffset = 0x09E6 - '0';  // bengali
-                break;
-            case LANGUAGE_BURMESE       & LANGUAGE_MASK_PRIMARY:
-                nOffset = 0x1040 - '0';  // burmese
-                break;
-            case LANGUAGE_HINDI         & LANGUAGE_MASK_PRIMARY:
-                nOffset = 0x0966 - '0';  // devanagari
-                break;
-            case LANGUAGE_GUJARATI      & LANGUAGE_MASK_PRIMARY:
-                nOffset = 0x0AE6 - '0';  // gujarati
-                break;
-            case LANGUAGE_KANNADA       & LANGUAGE_MASK_PRIMARY:
-                nOffset = 0x0CE6 - '0';  // kannada
-                break;
-            case LANGUAGE_KHMER         & LANGUAGE_MASK_PRIMARY:
-                nOffset = 0x17E0 - '0';  // khmer
-                break;
-            case LANGUAGE_LAO           & LANGUAGE_MASK_PRIMARY:
-                nOffset = 0x0ED0 - '0';  // lao
-                break;
-            case LANGUAGE_MALAYALAM     & LANGUAGE_MASK_PRIMARY:
-                nOffset = 0x0D66 - '0';   // malayalam
-                break;
-            case LANGUAGE_MONGOLIAN     & LANGUAGE_MASK_PRIMARY:
-                if (eLang == LANGUAGE_MONGOLIAN_MONGOLIAN)
-                    nOffset = 0x1810 - '0';   // mongolian
-                else
-                    nOffset = 0;              // mongolian cyrillic
-                break;
-            case LANGUAGE_ORIYA         & LANGUAGE_MASK_PRIMARY:
-                nOffset = 0x0B66 - '0';   // oriya
-                break;
-            case LANGUAGE_TAMIL         & LANGUAGE_MASK_PRIMARY:
-                nOffset = 0x0BE7 - '0';   // tamil
-                break;
-            case LANGUAGE_TELUGU        & LANGUAGE_MASK_PRIMARY:
-                nOffset = 0x0C66 - '0';   // telugu
-                break;
-            case LANGUAGE_THAI          & LANGUAGE_MASK_PRIMARY:
-                nOffset = 0x0E50 - '0';   // thai
-                break;
-            case LANGUAGE_TIBETAN       & LANGUAGE_MASK_PRIMARY:
-                nOffset = 0x0F20 - '0';   // tibetan
-                break;
-        }
-
-        nChar = sal::static_int_cast<sal_Unicode>(nChar + nOffset);
-        return nChar;
-    }
-
     OUString convertToLocalizedNumerals(const OUString& rStr,
         LanguageType eTextLanguage)
     {
         OUStringBuffer aBuf(rStr);
-
         for (sal_Int32 i = 0; i < aBuf.getLength(); ++i)
         {
-            // TODO: are there non-digit localizations?
-            sal_Unicode nOrigChar = aBuf[i];
-            if( (nOrigChar >= '0') && (nOrigChar <= '9') )
-            {
-                // translate characters to local preference
-                sal_Unicode cChar = getLocalizedChar(nOrigChar, eTextLanguage);
-                if (cChar != nOrigChar)
-                    aBuf[i] = cChar;
-            }
+            sal_Unicode nChar = aBuf[i];
+            if (nChar >= '0' && nChar <= '9')
+                aBuf[i] = GetLocalizedChar(nChar, eTextLanguage);
         }
-
         return aBuf.makeStringAndClear();
     }
 }
commit 6a9dc1a045d9f18255c3cb8a7bdbefdf226d8a37
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Jul 10 08:59:45 2013 +0100

    remove last XubString uses in cppcanvas
    
    Change-Id: I2ebc11a972f9a806889e13e7f69e20cd91d2ae6e

diff --git a/cppcanvas/source/mtfrenderer/implrenderer.cxx b/cppcanvas/source/mtfrenderer/implrenderer.cxx
index a852391..b26c0fb 100644
--- a/cppcanvas/source/mtfrenderer/implrenderer.cxx
+++ b/cppcanvas/source/mtfrenderer/implrenderer.cxx
@@ -299,29 +299,28 @@ namespace
         return nChar;
     }
 
-    void convertToLocalizedNumerals( XubString&   rStr,
-                                     LanguageType eTextLanguage )
+    OUString convertToLocalizedNumerals(const OUString& rStr,
+        LanguageType eTextLanguage)
     {
-        const sal_Unicode* pBase = rStr.GetBuffer();
-        const sal_Unicode* pBegin = pBase + 0;
-        const xub_StrLen nEndIndex = rStr.Len();
-        const sal_Unicode* pEnd = pBase + nEndIndex;
+        OUStringBuffer aBuf(rStr);
 
-        for( ; pBegin < pEnd; ++pBegin )
+        for (sal_Int32 i = 0; i < aBuf.getLength(); ++i)
         {
             // TODO: are there non-digit localizations?
-            if( (*pBegin >= '0') && (*pBegin <= '9') )
+            sal_Unicode nOrigChar = aBuf[i];
+            if( (nOrigChar >= '0') && (nOrigChar <= '9') )
             {
                 // translate characters to local preference
-                sal_Unicode cChar = getLocalizedChar( *pBegin, eTextLanguage );
-                if( cChar != *pBegin )
-                    rStr.SetChar( sal::static_int_cast<sal_uInt16>(pBegin - pBase), cChar );
+                sal_Unicode cChar = getLocalizedChar(nOrigChar, eTextLanguage);
+                if (cChar != nOrigChar)
+                    aBuf[i] = cChar;
             }
         }
+
+        return aBuf.makeStringAndClear();
     }
 }
 
-
 namespace cppcanvas
 {
     namespace internal
@@ -2557,10 +2556,10 @@ namespace cppcanvas
                     case META_TEXT_ACTION:
                     {
                         MetaTextAction* pAct = static_cast<MetaTextAction*>(pCurrAct);
-                        XubString sText = XubString( pAct->GetText() );
+                        OUString sText = pAct->GetText();
 
-                        if( rVDev.GetDigitLanguage())
-                            convertToLocalizedNumerals ( sText,rVDev.GetDigitLanguage() );
+                        if (rVDev.GetDigitLanguage())
+                            sText = convertToLocalizedNumerals(sText, rVDev.GetDigitLanguage());
 
                         createTextAction(
                             pAct->GetPoint(),
@@ -2576,10 +2575,10 @@ namespace cppcanvas
                     case META_TEXTARRAY_ACTION:
                     {
                         MetaTextArrayAction* pAct = static_cast<MetaTextArrayAction*>(pCurrAct);
-                        XubString sText = XubString( pAct->GetText() );
+                        OUString sText = pAct->GetText();
 
-                        if( rVDev.GetDigitLanguage())
-                            convertToLocalizedNumerals ( sText,rVDev.GetDigitLanguage() );
+                        if (rVDev.GetDigitLanguage())
+                            sText = convertToLocalizedNumerals(sText, rVDev.GetDigitLanguage());
 
                         createTextAction(
                             pAct->GetPoint(),
@@ -2654,10 +2653,10 @@ namespace cppcanvas
                     case META_STRETCHTEXT_ACTION:
                     {
                         MetaStretchTextAction* pAct = static_cast<MetaStretchTextAction*>(pCurrAct);
-                        XubString sText = XubString( pAct->GetText() );
+                        OUString sText = pAct->GetText();
 
-                        if( rVDev.GetDigitLanguage())
-                            convertToLocalizedNumerals ( sText,rVDev.GetDigitLanguage() );
+                        if (rVDev.GetDigitLanguage())
+                            sText = convertToLocalizedNumerals(sText, rVDev.GetDigitLanguage());
 
                         const sal_uInt16 nLen( pAct->GetLen() == (sal_uInt16)STRING_LEN ?
                                            pAct->GetText().getLength() - pAct->GetIndex() : pAct->GetLen() );


More information about the Libreoffice-commits mailing list