Kaydet (Commit) 7da37198 authored tarafından Ariel Constenla-Haile's avatar Ariel Constenla-Haile

i119460 - Use localized strings on Data Pilot fields grouped by date

üst 96c44a34
...@@ -573,7 +573,15 @@ ...@@ -573,7 +573,15 @@
#define STR_UNDO_SET_TAB_BG_COLOR 438 #define STR_UNDO_SET_TAB_BG_COLOR 438
#define STR_UNDO_SET_MULTI_TAB_BG_COLOR 439 #define STR_UNDO_SET_MULTI_TAB_BG_COLOR 439
#define STR_COUNT 440 #define STR_DPFIELD_GROUP_BY_SECONDS 440
#define STR_DPFIELD_GROUP_BY_MINUTES 441
#define STR_DPFIELD_GROUP_BY_HOURS 442
#define STR_DPFIELD_GROUP_BY_DAYS 443
#define STR_DPFIELD_GROUP_BY_MONTHS 444
#define STR_DPFIELD_GROUP_BY_QUARTERS 445
#define STR_DPFIELD_GROUP_BY_YEARS 446
#define STR_COUNT 447
#endif #endif
...@@ -36,6 +36,10 @@ ...@@ -36,6 +36,10 @@
#include <rtl/math.hxx> #include <rtl/math.hxx>
#include <algorithm> #include <algorithm>
#include "global.hxx"
#include "scresid.hxx"
#include "globstr.hrc"
// ============================================================================ // ============================================================================
ScDPSaveGroupItem::ScDPSaveGroupItem( const String& rName ) : ScDPSaveGroupItem::ScDPSaveGroupItem( const String& rName ) :
...@@ -557,20 +561,33 @@ String ScDPDimensionSaveData::CreateGroupDimName( const String& rSourceName, ...@@ -557,20 +561,33 @@ String ScDPDimensionSaveData::CreateGroupDimName( const String& rSourceName,
return EMPTY_STRING; return EMPTY_STRING;
} }
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
};
}
String ScDPDimensionSaveData::CreateDateGroupDimName( sal_Int32 nDatePart, const ScDPObject& rObject, bool bAllowSource, const ::std::vector< String >* pDeletedNames ) String ScDPDimensionSaveData::CreateDateGroupDimName( sal_Int32 nDatePart, const ScDPObject& rObject, bool bAllowSource, const ::std::vector< String >* pDeletedNames )
{ {
using namespace ::com::sun::star::sheet::DataPilotFieldGroupBy; using namespace ::com::sun::star::sheet::DataPilotFieldGroupBy;
String aPartName; String aPartName;
switch( nDatePart ) switch( nDatePart )
{ {
//! use translated strings from globstr.src case SECONDS: aPartName = ScGlobal::GetRscString( nDatePartIds[0] ); break;
case SECONDS: aPartName = String::CreateFromAscii( "Seconds" ); break; case MINUTES: aPartName = ScGlobal::GetRscString( nDatePartIds[1] ); break;
case MINUTES: aPartName = String::CreateFromAscii( "Minutes" ); break; case HOURS: aPartName = ScGlobal::GetRscString( nDatePartIds[2] ); break;
case HOURS: aPartName = String::CreateFromAscii( "Hours" ); break; case DAYS: aPartName = ScGlobal::GetRscString( nDatePartIds[3] ); break;
case DAYS: aPartName = String::CreateFromAscii( "Days" ); break; case MONTHS: aPartName = ScGlobal::GetRscString( nDatePartIds[4] ); break;
case MONTHS: aPartName = String::CreateFromAscii( "Months" ); break; case QUARTERS: aPartName = ScGlobal::GetRscString( nDatePartIds[5] ); break;
case QUARTERS: aPartName = String::CreateFromAscii( "Quarters" ); break; case YEARS: aPartName = ScGlobal::GetRscString( nDatePartIds[6] ); break;
case YEARS: aPartName = String::CreateFromAscii( "Years" ); break;
} }
DBG_ASSERT( aPartName.Len() > 0, "ScDPDimensionSaveData::CreateDateGroupDimName - invalid date part" ); DBG_ASSERT( aPartName.Len() > 0, "ScDPDimensionSaveData::CreateDateGroupDimName - invalid date part" );
return CreateGroupDimName( aPartName, rObject, bAllowSource, pDeletedNames ); return CreateGroupDimName( aPartName, rObject, bAllowSource, pDeletedNames );
......
...@@ -33,11 +33,14 @@ ...@@ -33,11 +33,14 @@
#ifndef SC_DPGROUPDLG_HRC #ifndef SC_DPGROUPDLG_HRC
#include "dpgroupdlg.hrc" #include "dpgroupdlg.hrc"
#endif #endif
#include <tools/resary.hxx>
#include "scresid.hxx" #include "scresid.hxx"
#ifndef SC_SC_HRC #ifndef SC_SC_HRC
#include "sc.hrc" #include "sc.hrc"
#endif #endif
#include "globstr.hrc"
#include <com/sun/star/sheet/DataPilotFieldGroupBy.hpp> #include <com/sun/star/sheet/DataPilotFieldGroupBy.hpp>
// ============================================================================ // ============================================================================
...@@ -56,6 +59,17 @@ static const sal_Int32 spnDateParts[] = ...@@ -56,6 +59,17 @@ static const sal_Int32 spnDateParts[] =
com::sun::star::sheet::DataPilotFieldGroupBy::YEARS 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 } // namespace
// ============================================================================ // ============================================================================
...@@ -236,12 +250,13 @@ ScDPDateGroupDlg::ScDPDateGroupDlg( Window* pParent, ...@@ -236,12 +250,13 @@ ScDPDateGroupDlg::ScDPDateGroupDlg( Window* pParent,
maStartHelper ( maRbAutoStart, maRbManStart, maEdStart, rNullDate ), maStartHelper ( maRbAutoStart, maRbManStart, maEdStart, rNullDate ),
maEndHelper ( maRbAutoEnd, maRbManEnd, maEdEnd, rNullDate ) maEndHelper ( maRbAutoEnd, maRbManEnd, maEdEnd, rNullDate )
{ {
FreeResource();
maLbUnits.SetHelpId( HID_SC_DPDATEGROUP_LB ); 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 ); maEdStart.SetShowDateCentury( sal_True );
maEdEnd.SetShowDateCentury( sal_True ); maEdEnd.SetShowDateCentury( sal_True );
...@@ -251,7 +266,7 @@ ScDPDateGroupDlg::ScDPDateGroupDlg( Window* pParent, ...@@ -251,7 +266,7 @@ ScDPDateGroupDlg::ScDPDateGroupDlg( Window* pParent,
if( nDatePart == 0 ) if( nDatePart == 0 )
nDatePart = com::sun::star::sheet::DataPilotFieldGroupBy::MONTHS; 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 ); maLbUnits.CheckEntryPos( static_cast< sal_uInt16 >( nIdx ), (nDatePart & spnDateParts[ nIdx ]) != 0 );
if( rInfo.DateValues ) if( rInfo.DateValues )
......
...@@ -262,19 +262,6 @@ ModalDialog RID_SCDLG_DPDATEGROUP ...@@ -262,19 +262,6 @@ ModalDialog RID_SCDLG_DPDATEGROUP
Size = MAP_APPFONT ( 50 , 14 ) ; Size = MAP_APPFONT ( 50 , 14 ) ;
TabStop = TRUE ; 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" ; Text [ en-US ] = "Grouping" ;
} ; } ;
......
...@@ -1734,5 +1734,33 @@ Resource RID_GLOBSTR ...@@ -1734,5 +1734,33 @@ Resource RID_GLOBSTR
{ {
Text [ en-US ] = "Pivot table needs at least two rows of data to create or refresh." ; Text [ en-US ] = "Pivot table needs at least two rows of data to create or refresh." ;
}; };
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" ;
};
}; };
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment