[Libreoffice-commits] core.git: sc/inc sc/source
Ariel Constenla-Haile
arielch at apache.org
Sat Mar 16 04:52:08 PDT 2013
sc/inc/globstr.hrc | 10 +++++++++-
sc/source/core/data/dpdimsave.cxx | 33 +++++++++++++++++++++++++--------
sc/source/ui/dbgui/dpgroupdlg.cxx | 25 +++++++++++++++++++------
sc/source/ui/dbgui/dpgroupdlg.src | 13 -------------
sc/source/ui/src/globstr.src | 29 +++++++++++++++++++++++++++++
5 files changed, 82 insertions(+), 28 deletions(-)
New commits:
commit 31ea9876fbb4b5a4faad94aff8ac914c2df9f266
Author: Ariel Constenla-Haile <arielch at apache.org>
Date: Mon May 28 12:07:30 2012 +0000
Resolves: #i119460# Use localized strings on Data Pilot fields grouped by date
Conflicts:
sc/inc/globstr.hrc
sc/source/core/data/dpdimsave.cxx
sc/source/ui/dbgui/dpgroupdlg.cxx
sc/source/ui/src/globstr.src
Change-Id: Ie5e1fd473d2e2c58de7ed6eb0aeddb768668f91e
diff --git a/sc/inc/globstr.hrc b/sc/inc/globstr.hrc
index 619d8ed..d49b1da 100644
--- a/sc/inc/globstr.hrc
+++ b/sc/inc/globstr.hrc
@@ -657,7 +657,15 @@
#define STR_UNDO_HIDETABS 526
#define STR_UNDO_SHOWTABS 527
-#define STR_COUNT 528
+#define STR_DPFIELD_GROUP_BY_SECONDS 528
+#define STR_DPFIELD_GROUP_BY_MINUTES 529
+#define STR_DPFIELD_GROUP_BY_HOURS 530
+#define STR_DPFIELD_GROUP_BY_DAYS 531
+#define STR_DPFIELD_GROUP_BY_MONTHS 532
+#define STR_DPFIELD_GROUP_BY_QUARTERS 533
+#define STR_DPFIELD_GROUP_BY_YEARS 534
+
+#define STR_COUNT 535
#endif
diff --git a/sc/source/core/data/dpdimsave.cxx b/sc/source/core/data/dpdimsave.cxx
index 5d795b9..b564b2b 100644
--- a/sc/source/core/data/dpdimsave.cxx
+++ b/sc/source/core/data/dpdimsave.cxx
@@ -30,6 +30,10 @@
#include <rtl/math.hxx>
#include <algorithm>
+#include "global.hxx"
+#include "scresid.hxx"
+#include "globstr.hrc"
+
using namespace com::sun::star;
// ============================================================================
@@ -818,6 +822,20 @@ rtl::OUString ScDPDimensionSaveData::CreateGroupDimName(
return rtl::OUString();
}
+namespace
+{
+ static const sal_uInt16 nDatePartIds[] =
+ {
+ STR_DPFIELD_GROUP_BY_SECONDS,
+ STR_DPFIELD_GROUP_BY_MINUTES,
+ STR_DPFIELD_GROUP_BY_HOURS,
+ STR_DPFIELD_GROUP_BY_DAYS,
+ STR_DPFIELD_GROUP_BY_MONTHS,
+ STR_DPFIELD_GROUP_BY_QUARTERS,
+ STR_DPFIELD_GROUP_BY_YEARS
+ };
+}
+
rtl::OUString ScDPDimensionSaveData::CreateDateGroupDimName(
sal_Int32 nDatePart, const ScDPObject& rObject, bool bAllowSource,
const std::vector<rtl::OUString>* pDeletedNames )
@@ -826,14 +844,13 @@ rtl::OUString ScDPDimensionSaveData::CreateDateGroupDimName(
rtl::OUString aPartName;
switch( nDatePart )
{
- //! use translated strings from globstr.src
- case SECONDS: aPartName = rtl::OUString::createFromAscii( "Seconds" ); break;
- case MINUTES: aPartName = rtl::OUString::createFromAscii( "Minutes" ); break;
- case HOURS: aPartName = rtl::OUString::createFromAscii( "Hours" ); break;
- case DAYS: aPartName = rtl::OUString::createFromAscii( "Days" ); break;
- case MONTHS: aPartName = rtl::OUString::createFromAscii( "Months" ); break;
- case QUARTERS: aPartName = rtl::OUString::createFromAscii( "Quarters" ); break;
- case YEARS: aPartName = rtl::OUString::createFromAscii( "Years" ); break;
+ case SECONDS: aPartName = ScGlobal::GetRscString( nDatePartIds[0] ); break;
+ case MINUTES: aPartName = ScGlobal::GetRscString( nDatePartIds[1] ); break;
+ case HOURS: aPartName = ScGlobal::GetRscString( nDatePartIds[2] ); break;
+ case DAYS: aPartName = ScGlobal::GetRscString( nDatePartIds[3] ); break;
+ case MONTHS: aPartName = ScGlobal::GetRscString( nDatePartIds[4] ); break;
+ case QUARTERS: aPartName = ScGlobal::GetRscString( nDatePartIds[5] ); break;
+ case YEARS: aPartName = ScGlobal::GetRscString( nDatePartIds[6] ); break;
}
OSL_ENSURE(!aPartName.isEmpty(), "ScDPDimensionSaveData::CreateDateGroupDimName - invalid date part");
return CreateGroupDimName( aPartName, rObject, bAllowSource, pDeletedNames );
diff --git a/sc/source/ui/dbgui/dpgroupdlg.cxx b/sc/source/ui/dbgui/dpgroupdlg.cxx
index b0153ae..6adbb22 100644
--- a/sc/source/ui/dbgui/dpgroupdlg.cxx
+++ b/sc/source/ui/dbgui/dpgroupdlg.cxx
@@ -25,9 +25,10 @@
#include "dpgroupdlg.hxx"
#include "dpgroupdlg.hrc"
-#include <tools/resary.hxx>
#include "scresid.hxx"
#include "sc.hrc"
+#include "globstr.hrc"
+
#include <com/sun/star/sheet/DataPilotFieldGroupBy.hpp>
// ============================================================================
@@ -46,6 +47,17 @@ static const sal_Int32 spnDateParts[] =
com::sun::star::sheet::DataPilotFieldGroupBy::YEARS
};
+static const sal_uInt16 nDatePartResIds[] =
+{
+ STR_DPFIELD_GROUP_BY_SECONDS,
+ STR_DPFIELD_GROUP_BY_MINUTES,
+ STR_DPFIELD_GROUP_BY_HOURS,
+ STR_DPFIELD_GROUP_BY_DAYS,
+ STR_DPFIELD_GROUP_BY_MONTHS,
+ STR_DPFIELD_GROUP_BY_QUARTERS,
+ STR_DPFIELD_GROUP_BY_YEARS
+};
+
} // namespace
// ============================================================================
@@ -226,12 +238,13 @@ ScDPDateGroupDlg::ScDPDateGroupDlg( Window* pParent,
maStartHelper ( maRbAutoStart, maRbManStart, maEdStart, rNullDate ),
maEndHelper ( maRbAutoEnd, maRbManEnd, maEdEnd, rNullDate )
{
+ FreeResource();
+
maLbUnits.SetHelpId( HID_SC_DPDATEGROUP_LB );
- ResStringArray aArr( ScResId( STR_UNITS ) );
- for( sal_uInt16 nIdx = 0, nCount = sal::static_int_cast<sal_uInt16>(aArr.Count()); nIdx < nCount; ++nIdx )
- maLbUnits.InsertEntry( aArr.GetString( nIdx ) );
- FreeResource();
+ static const size_t nCount = sizeof( nDatePartResIds ) / sizeof( nDatePartResIds[0] );
+ for( size_t nIdx = 0 ; nIdx < nCount; ++nIdx )
+ maLbUnits.InsertEntry( ScGlobal::GetRscString( nDatePartResIds[nIdx] ) );
maEdStart.SetShowDateCentury( sal_True );
maEdEnd.SetShowDateCentury( sal_True );
@@ -241,7 +254,7 @@ ScDPDateGroupDlg::ScDPDateGroupDlg( Window* pParent,
if( nDatePart == 0 )
nDatePart = com::sun::star::sheet::DataPilotFieldGroupBy::MONTHS;
- for( sal_uLong nIdx = 0, nCount = maLbUnits.GetEntryCount(); nIdx < nCount; ++nIdx )
+ for( size_t nIdx = 0; nIdx < nCount; ++nIdx )
maLbUnits.CheckEntryPos( static_cast< sal_uInt16 >( nIdx ), (nDatePart & spnDateParts[ nIdx ]) != 0 );
if( rInfo.mbDateValues )
diff --git a/sc/source/ui/dbgui/dpgroupdlg.src b/sc/source/ui/dbgui/dpgroupdlg.src
index 39b68b7..d5426d1 100644
--- a/sc/source/ui/dbgui/dpgroupdlg.src
+++ b/sc/source/ui/dbgui/dpgroupdlg.src
@@ -258,19 +258,6 @@ ModalDialog RID_SCDLG_DPDATEGROUP
Size = MAP_APPFONT ( 50 , 14 ) ;
TabStop = TRUE ;
};
- StringArray STR_UNITS
- {
- ItemList [ en-US ] =
- {
- < "Seconds" ; Default ; > ;
- < "Minutes" ; Default ; > ;
- < "Hours" ; Default ; > ;
- < "Days" ; Default ; > ;
- < "Months" ; Default ; > ;
- < "Quarters" ; Default ; > ;
- < "Years" ; Default ; > ;
- } ;
- } ;
Text [ en-US ] = "Grouping" ;
} ;
diff --git a/sc/source/ui/src/globstr.src b/sc/source/ui/src/globstr.src
index 9d8613e..1c5f224 100644
--- a/sc/source/ui/src/globstr.src
+++ b/sc/source/ui/src/globstr.src
@@ -2031,6 +2031,35 @@ Resource RID_GLOBSTR
{
Text [ en-US ] = "You cannot insert or delete cells when the affected range intersects with pivot table.";
};
+
+ String STR_DPFIELD_GROUP_BY_SECONDS
+ {
+ Text [ en-US ] = "Seconds" ;
+ };
+ String STR_DPFIELD_GROUP_BY_MINUTES
+ {
+ Text [ en-US ] = "Minutes" ;
+ };
+ String STR_DPFIELD_GROUP_BY_HOURS
+ {
+ Text [ en-US ] = "Hours" ;
+ };
+ String STR_DPFIELD_GROUP_BY_DAYS
+ {
+ Text [ en-US ] = "Days" ;
+ };
+ String STR_DPFIELD_GROUP_BY_MONTHS
+ {
+ Text [ en-US ] = "Months" ;
+ };
+ String STR_DPFIELD_GROUP_BY_QUARTERS
+ {
+ Text [ en-US ] = "Quarters" ;
+ };
+ String STR_DPFIELD_GROUP_BY_YEARS
+ {
+ Text [ en-US ] = "Years" ;
+ };
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
More information about the Libreoffice-commits
mailing list