[Libreoffice-commits] core.git: 2 commits - editeng/source sc/CppunitTest_sc_ucalc.mk sc/Library_sc.mk sc/source sd/CppunitTest_sd_uimpress.mk sd/Library_sd.mk sd/source svx/Library_svxcore.mk svx/source sw/source

Caolán McNamara caolanm at redhat.com
Mon Jan 20 06:46:52 PST 2014


 editeng/source/items/frmitems.cxx                 |   46 +++++++++++++++++-----
 sc/CppunitTest_sc_ucalc.mk                        |    1 
 sc/Library_sc.mk                                  |    1 
 sc/source/core/data/docpool.cxx                   |   11 +++--
 sd/CppunitTest_sd_uimpress.mk                     |    1 
 sd/Library_sd.mk                                  |    1 
 sd/source/ui/animations/CustomAnimationDialog.cxx |    4 +
 svx/Library_svxcore.mk                            |    1 
 svx/source/svdraw/svdattr.cxx                     |    7 ++-
 svx/source/tbxctrls/grafctrl.cxx                  |    3 -
 svx/source/xoutdev/xattr2.cxx                     |    8 ++-
 sw/source/ui/ribbar/workctrl.cxx                  |    8 ++-
 sw/source/ui/utlui/unotools.cxx                   |    5 +-
 13 files changed, 73 insertions(+), 24 deletions(-)

New commits:
commit d33b4c311e3b9c0b8f50080cb38a31c19f587a16
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Jan 20 13:55:03 2014 +0000

    Related: #i56998# use locale rules to format percentage
    
    Change-Id: I4b744cf10165383153d2a71c05df0c0ed327c641

diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx
index 6fd9113..69bdcf1 100644
--- a/editeng/source/items/frmitems.cxx
+++ b/editeng/source/items/frmitems.cxx
@@ -43,6 +43,7 @@
 #include <com/sun/star/frame/status/UpperLowerMarginScale.hpp>
 #include <com/sun/star/drawing/ShadingPattern.hpp>
 
+#include <i18nutil/unicode.hxx>
 #include <unotools/securityoptions.hxx>
 #include <unotools/ucbstreamhelper.hxx>
 #include <limits.h>
@@ -56,6 +57,7 @@
 #include <rtl/ustring.hxx>
 #include <rtl/ustrbuf.hxx>
 #include <vcl/graphicfilter.hxx>
+#include <vcl/svapp.hxx>
 #include <editeng/editids.hrc>
 #include <editeng/editrids.hrc>
 #include <editeng/pbinitem.hxx>
@@ -600,19 +602,28 @@ SfxItemPresentation SvxLRSpaceItem::GetPresentation
         case SFX_ITEM_PRESENTATION_NAMELESS:
         {
             if ( 100 != nPropLeftMargin )
-                rText = OUString::number( nPropLeftMargin ) + "%";
+            {
+                rText = unicode::formatPercent(nPropLeftMargin,
+                    Application::GetSettings().GetUILanguageTag());
+            }
             else
                 rText = GetMetricText( (long)nLeftMargin,
                                        eCoreUnit, ePresUnit, pIntl );
             rText += OUString(cpDelim);
             if ( 100 != nPropFirstLineOfst )
-                rText = rText + OUString::number( nPropFirstLineOfst ) + "%";
+            {
+                rText += unicode::formatPercent(nPropFirstLineOfst,
+                    Application::GetSettings().GetUILanguageTag());
+            }
             else
                 rText += GetMetricText( (long)nFirstLineOfst,
                                         eCoreUnit, ePresUnit, pIntl );
             rText += OUString(cpDelim);
             if ( 100 != nRightMargin )
-                rText = rText + OUString::number( nRightMargin ) + "%";
+            {
+                rText += unicode::formatPercent(nRightMargin,
+                    Application::GetSettings().GetUILanguageTag());
+            }
             else
                 rText += GetMetricText( (long)nRightMargin,
                                         eCoreUnit, ePresUnit, pIntl );
@@ -622,7 +633,8 @@ SfxItemPresentation SvxLRSpaceItem::GetPresentation
         {
             rText = EE_RESSTR(RID_SVXITEMS_LRSPACE_LEFT);
             if ( 100 != nPropLeftMargin )
-                rText += OUString::number( nPropLeftMargin ) + "%";
+                rText += unicode::formatPercent(nPropLeftMargin,
+                    Application::GetSettings().GetUILanguageTag());
             else
             {
                 rText = rText +
@@ -634,7 +646,8 @@ SfxItemPresentation SvxLRSpaceItem::GetPresentation
             {
                 rText += EE_RESSTR(RID_SVXITEMS_LRSPACE_FLINE);
                 if ( 100 != nPropFirstLineOfst )
-                    rText = rText + OUString::number( nPropFirstLineOfst ) + "%";
+                    rText = rText + unicode::formatPercent(nPropFirstLineOfst,
+                    Application::GetSettings().GetUILanguageTag());
                 else
                 {
                     rText = rText +
@@ -646,7 +659,8 @@ SfxItemPresentation SvxLRSpaceItem::GetPresentation
             }
             rText += EE_RESSTR(RID_SVXITEMS_LRSPACE_RIGHT);
             if ( 100 != nPropRightMargin )
-                rText = rText + OUString::number( nPropRightMargin ) + "%";
+                rText = rText + unicode::formatPercent(nPropRightMargin,
+                    Application::GetSettings().GetUILanguageTag());
             else
             {
                 rText = rText +
@@ -961,12 +975,18 @@ SfxItemPresentation SvxULSpaceItem::GetPresentation
         case SFX_ITEM_PRESENTATION_NAMELESS:
         {
             if ( 100 != nPropUpper )
-                rText = OUString::number( nPropUpper ) + "%";
+            {
+                rText = unicode::formatPercent(nPropUpper,
+                    Application::GetSettings().GetUILanguageTag());
+            }
             else
                 rText = GetMetricText( (long)nUpper, eCoreUnit, ePresUnit, pIntl );
             rText += OUString(cpDelim);
             if ( 100 != nPropLower )
-                rText += OUString::number( nPropLower ) + "%";
+            {
+                rText += unicode::formatPercent(nPropLower,
+                    Application::GetSettings().GetUILanguageTag());
+            }
             else
                 rText += GetMetricText( (long)nLower, eCoreUnit, ePresUnit, pIntl );
             return SFX_ITEM_PRESENTATION_NAMELESS;
@@ -975,7 +995,10 @@ SfxItemPresentation SvxULSpaceItem::GetPresentation
         {
             rText = EE_RESSTR(RID_SVXITEMS_ULSPACE_UPPER);
             if ( 100 != nPropUpper )
-                rText += OUString::number( nPropUpper ) + "%";
+            {
+                rText += unicode::formatPercent(nPropUpper,
+                    Application::GetSettings().GetUILanguageTag());
+            }
             else
             {
                 rText = rText +
@@ -984,7 +1007,10 @@ SfxItemPresentation SvxULSpaceItem::GetPresentation
             }
             rText = rText + OUString(cpDelim) + EE_RESSTR(RID_SVXITEMS_ULSPACE_LOWER);
             if ( 100 != nPropLower )
-                rText += OUString::number( nPropLower ) + "%";
+            {
+                rText += unicode::formatPercent(nPropLower,
+                    Application::GetSettings().GetUILanguageTag());
+            }
             else
             {
                 rText = rText +
diff --git a/sc/CppunitTest_sc_ucalc.mk b/sc/CppunitTest_sc_ucalc.mk
index b7370a2..20001e5 100644
--- a/sc/CppunitTest_sc_ucalc.mk
+++ b/sc/CppunitTest_sc_ucalc.mk
@@ -50,6 +50,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sc_ucalc, \
     for \
     forui \
     i18nlangtag \
+    i18nutil \
     sal \
     salhelper \
     sax \
diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk
index a7f15a9..d75ce95 100644
--- a/sc/Library_sc.mk
+++ b/sc/Library_sc.mk
@@ -71,6 +71,7 @@ $(eval $(call gb_Library_use_libraries,sc,\
     for \
     forui \
     i18nlangtag \
+    i18nutil \
     sal \
     salhelper \
     sax \
diff --git a/sc/source/core/data/docpool.cxx b/sc/source/core/data/docpool.cxx
index 098790c..232a114 100644
--- a/sc/source/core/data/docpool.cxx
+++ b/sc/source/core/data/docpool.cxx
@@ -20,8 +20,10 @@
 
 #include "scitems.hxx"
 #include <comphelper/string.hxx>
+#include <i18nutil/unicode.hxx>
 #include <tools/shl.hxx>
 #include <vcl/outdev.hxx>
+#include <vcl/svapp.hxx>
 #include <svl/aeitem.hxx>
 #include <svl/itemiter.hxx>
 #include <svl/stritem.hxx>
@@ -743,7 +745,8 @@ static SfxItemPresentation lcl_HFPresentation
                 aText = EE_RESSTR(RID_SVXITEMS_LRSPACE_LEFT);
                 if ( 100 != nPropLeftMargin )
                 {
-                    aText = aText + OUString::number( nPropLeftMargin ) + "%";
+                    aText = aText + unicode::formatPercent(nPropLeftMargin,
+                        Application::GetSettings().GetUILanguageTag());
                 }
                 else
                 {
@@ -758,7 +761,8 @@ static SfxItemPresentation lcl_HFPresentation
                 aText += EE_RESSTR(RID_SVXITEMS_LRSPACE_RIGHT);
                 if ( 100 != nPropRightMargin )
                 {
-                    aText = aText + OUString::number( nPropLeftMargin ) + "%";
+                    aText = aText + unicode::formatPercent(nPropLeftMargin,
+                        Application::GetSettings().GetUILanguageTag());
                 }
                 else
                 {
@@ -974,7 +978,8 @@ SfxItemPresentation ScDocumentPool::GetPresentation(
                     rText = ScGlobal::GetRscString(STR_SCATTR_PAGE_SCALE) + aStrSep;
 //                  break; // DURCHFALLEN!!!
                     case SFX_ITEM_PRESENTATION_NAMELESS:
-                    rText = rText + OUString::number( nPercent ) + "%";
+                    rText = rText + unicode::formatPercent(nPercent,
+                        Application::GetSettings().GetUILanguageTag());
                     break;
                     default:
                     {
diff --git a/sd/CppunitTest_sd_uimpress.mk b/sd/CppunitTest_sd_uimpress.mk
index f232a91..ad43f7e 100644
--- a/sd/CppunitTest_sd_uimpress.mk
+++ b/sd/CppunitTest_sd_uimpress.mk
@@ -32,6 +32,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sd_uimpress,\
     drawinglayer \
     editeng \
     i18nlangtag \
+    i18nutil \
     msfilter \
     sal \
     sax \
diff --git a/sd/Library_sd.mk b/sd/Library_sd.mk
index f9b69c9..cb5ff9a 100644
--- a/sd/Library_sd.mk
+++ b/sd/Library_sd.mk
@@ -72,6 +72,7 @@ $(eval $(call gb_Library_use_libraries,sd,\
 	drawinglayer \
 	editeng \
 	i18nlangtag \
+	i18nutil \
 	msfilter \
 	oox \
 	sal \
diff --git a/sd/source/ui/animations/CustomAnimationDialog.cxx b/sd/source/ui/animations/CustomAnimationDialog.cxx
index 7c3677d..86a7304 100644
--- a/sd/source/ui/animations/CustomAnimationDialog.cxx
+++ b/sd/source/ui/animations/CustomAnimationDialog.cxx
@@ -35,6 +35,7 @@
 #include <boost/shared_ptr.hpp>
 
 #include <comphelper/processfactory.hxx>
+#include <i18nutil/unicode.hxx>
 #include <unotools/pathoptions.hxx>
 #include <vcl/tabctrl.hxx>
 #include <vcl/tabpage.hxx>
@@ -566,7 +567,8 @@ TransparencyPropertyBox::TransparencyPropertyBox( sal_Int32 nControlType, Window
     mpMenu = new PopupMenu();
     for( sal_Int32 i = 25; i < 101; i += 25 )
     {
-        OUString aStr(OUString::number(i) + "%");
+        OUString aStr(unicode::formatPercent(i,
+            Application::GetSettings().GetUILanguageTag()));
         mpMenu->InsertItem( i, aStr );
     }
 
diff --git a/svx/Library_svxcore.mk b/svx/Library_svxcore.mk
index 4b8914e..58eb5e9 100644
--- a/svx/Library_svxcore.mk
+++ b/svx/Library_svxcore.mk
@@ -60,6 +60,7 @@ $(eval $(call gb_Library_use_libraries,svxcore,\
     editeng \
     fwe \
     i18nlangtag \
+    i18nutil \
     lng \
     sal \
     salhelper \
diff --git a/svx/source/svdraw/svdattr.cxx b/svx/source/svdraw/svdattr.cxx
index 620ec27..a7a23db 100644
--- a/svx/source/svdraw/svdattr.cxx
+++ b/svx/source/svdraw/svdattr.cxx
@@ -38,6 +38,7 @@
 #include <editeng/adjustitem.hxx>
 #include <editeng/editdata.hxx>
 #include <editeng/writingmodeitem.hxx>
+#include <i18nutil/unicode.hxx>
 #include <svl/solar.hrc>
 #include <tools/bigint.hxx>
 #include <tools/stream.hxx>
@@ -837,7 +838,8 @@ SfxItemPresentation SdrPercentItem::GetPresentation(
     SfxItemPresentation ePres, SfxMapUnit /*eCoreMetric*/,
     SfxMapUnit /*ePresMetric*/, OUString& rText, const IntlWrapper *) const
 {
-    rText = OUString::number(GetValue()) + "%";
+    rText = unicode::formatPercent(GetValue(),
+        Application::GetSettings().GetUILanguageTag());
 
     if(ePres == SFX_ITEM_PRESENTATION_COMPLETE)
     {
@@ -2056,7 +2058,8 @@ SfxItemPresentation SdrSignedPercentItem::GetPresentation(
     SfxItemPresentation ePres, SfxMapUnit /*eCoreMetric*/, SfxMapUnit /*ePresMetric*/,
     OUString& rText, const IntlWrapper *) const
 {
-    rText = OUString::number(GetValue()) + "%";
+    rText = unicode::formatPercent(GetValue(),
+        Application::GetSettings().GetUILanguageTag());
 
     if(ePres == SFX_ITEM_PRESENTATION_COMPLETE)
     {
diff --git a/svx/source/xoutdev/xattr2.cxx b/svx/source/xoutdev/xattr2.cxx
index 8a644ac..c931ae9 100644
--- a/svx/source/xoutdev/xattr2.cxx
+++ b/svx/source/xoutdev/xattr2.cxx
@@ -21,6 +21,7 @@
 #include <com/sun/star/drawing/LineCap.hpp>
 #include <com/sun/star/uno/Any.hxx>
 
+#include <i18nutil/unicode.hxx>
 #include <svx/dialogs.hrc>
 #include "svx/xattr.hxx"
 #include <svx/xtable.hxx>
@@ -28,6 +29,7 @@
 #include <editeng/itemtype.hxx>
 #include <svx/xdef.hxx>
 #include <svx/AffineMatrixItem.hxx>
+#include <vcl/svapp.hxx>
 
 // class XLineTransparenceItem
 
@@ -70,7 +72,8 @@ SfxItemPresentation XLineTransparenceItem::GetPresentation
         case SFX_ITEM_PRESENTATION_COMPLETE:
             rText = OUString( ResId( RID_SVXSTR_TRANSPARENCE, DIALOG_MGR() ) ) + ": ";
         case SFX_ITEM_PRESENTATION_NAMELESS:
-            rText = rText + OUString::number( GetValue() ) + "%";
+            rText += unicode::formatPercent(GetValue(),
+                Application::GetSettings().GetUILanguageTag());
             return ePres;
         default:
             return SFX_ITEM_PRESENTATION_NONE;
@@ -459,7 +462,8 @@ SfxItemPresentation XFillTransparenceItem::GetPresentation
         case SFX_ITEM_PRESENTATION_COMPLETE:
             rText = OUString( ResId( RID_SVXSTR_TRANSPARENCE, DIALOG_MGR() ) ) + ": ";
         case SFX_ITEM_PRESENTATION_NAMELESS:
-            rText = rText + OUString::number( GetValue() ) + "%";
+            rText += unicode::formatPercent(GetValue(),
+                Application::GetSettings().GetUILanguageTag());
             return ePres;
         default:
             return SFX_ITEM_PRESENTATION_NONE;
diff --git a/sw/source/ui/ribbar/workctrl.cxx b/sw/source/ui/ribbar/workctrl.cxx
index 8e660dc..2833fef 100644
--- a/sw/source/ui/ribbar/workctrl.cxx
+++ b/sw/source/ui/ribbar/workctrl.cxx
@@ -19,6 +19,7 @@
 
 #include <string>
 #include <comphelper/string.hxx>
+#include <i18nutil/unicode.hxx>
 #include <svl/eitem.hxx>
 #include <sfx2/htmlmode.hxx>
 #include <sfx2/dispatch.hxx>
@@ -643,7 +644,8 @@ SwZoomBox_Impl::SwZoomBox_Impl(
     {   25, 50, 75, 100, 150, 200 };
     for(sal_uInt16 i = 0; i < sizeof(aZoomValues)/sizeof(sal_uInt16); i++)
     {
-        OUString sEntry = OUString::number(aZoomValues[i]) + "%";
+        OUString sEntry = unicode::formatPercent(aZoomValues[i],
+            Application::GetSettings().GetUILanguageTag());
         InsertEntry(sEntry);
     }
 }
@@ -758,8 +760,8 @@ void SwPreviewZoomControl::StateChanged( sal_uInt16 /*nSID*/,
     SwZoomBox_Impl* pBox = (SwZoomBox_Impl*)GetToolBox().GetItemWindow( GetId() );
     if(SFX_ITEM_AVAILABLE <= eState)
     {
-        OUString sZoom(OUString::number(((const SfxUInt16Item*)pState)->GetValue()));
-        sZoom += "%";
+        OUString sZoom(unicode::formatPercent(((const SfxUInt16Item*)pState)->GetValue(),
+            Application::GetSettings().GetUILanguageTag()));
         pBox->SetText(sZoom);
         pBox->SaveValue();
     }
diff --git a/sw/source/ui/utlui/unotools.cxx b/sw/source/ui/utlui/unotools.cxx
index ebc2aff..d685b56 100644
--- a/sw/source/ui/utlui/unotools.cxx
+++ b/sw/source/ui/utlui/unotools.cxx
@@ -26,8 +26,10 @@
 #include <unotools.hrc>
 #include <unotools.hxx>
 #include <unoprnms.hxx>
+#include <i18nutil/unicode.hxx>
 #include <osl/diagnose.h>
 #include <vcl/msgbox.hxx>
+#include <vcl/svapp.hxx>
 #include <com/sun/star/text/XTextViewCursorSupplier.hpp>
 #include <com/sun/star/view/XScreenCursor.hpp>
 #include <com/sun/star/view/DocumentZoomType.hpp>
@@ -471,7 +473,8 @@ void SwOneExampleFrame::CreatePopup(const Point& rPt)
         for (sal_uInt16 i = 0;
                 i < (sizeof(nZoomValues)/sizeof(nZoomValues[0])); ++i)
         {
-            OUString sTemp = OUString::number(nZoomValues[i]) + " %";
+            OUString sTemp = unicode::formatPercent(nZoomValues[i],
+                Application::GetSettings().GetUILanguageTag());
             aSubPop1.InsertItem( ITEM_ZOOM + i + 1, sTemp);
             if(nZoom == nZoomValues[i])
                 aSubPop1.CheckItem(ITEM_ZOOM + i + 1);
commit c6c70c93461d5da4464ef38c8420b53ee609a4d1
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Jan 20 13:41:56 2014 +0000

    Related: #i56998# use FUNIT_PERCENT instead of FUNIT_CUSTOM
    
    Change-Id: Ibac028120286c9deb2411fc547877eebac93f36f

diff --git a/svx/source/tbxctrls/grafctrl.cxx b/svx/source/tbxctrls/grafctrl.cxx
index 84b4844..3fbce72 100644
--- a/svx/source/tbxctrls/grafctrl.cxx
+++ b/svx/source/tbxctrls/grafctrl.cxx
@@ -130,8 +130,7 @@ ImplGrafMetricField::ImplGrafMetricField( Window* pParent, const OUString& rCmd,
     {
         const long nMinVal = maCommand.startsWith( ".uno:GrafTransparence" ) ? 0 : -100;
 
-        SetUnit( FUNIT_CUSTOM );
-        SetCustomUnitText( OUString(" %") );
+        SetUnit(FUNIT_PERCENT);
         SetDecimalDigits( 0 );
 
         SetMin( nMinVal );


More information about the Libreoffice-commits mailing list