dpgroupdlg.cxx (b3f79822) dpgroupdlg.cxx (58ae0c86)
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 19 unchanged lines hidden (view full) ---

28#undef SC_DLLIMPLEMENTATION
29#endif
30
31
32#include "dpgroupdlg.hxx"
33#ifndef SC_DPGROUPDLG_HRC
34#include "dpgroupdlg.hrc"
35#endif
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 19 unchanged lines hidden (view full) ---

28#undef SC_DLLIMPLEMENTATION
29#endif
30
31
32#include "dpgroupdlg.hxx"
33#ifndef SC_DPGROUPDLG_HRC
34#include "dpgroupdlg.hrc"
35#endif
36#include <tools/resary.hxx>
36
37#include "scresid.hxx"
38#ifndef SC_SC_HRC
39#include "sc.hrc"
40#endif
37#include "scresid.hxx"
38#ifndef SC_SC_HRC
39#include "sc.hrc"
40#endif
41
42#include "globstr.hrc"
43
41#include <com/sun/star/sheet/DataPilotFieldGroupBy.hpp>
42
43// ============================================================================
44
45namespace {
46
47/** Date part flags in order of the list box entries. */
48static const sal_Int32 spnDateParts[] =
49{
50 com::sun::star::sheet::DataPilotFieldGroupBy::SECONDS,
51 com::sun::star::sheet::DataPilotFieldGroupBy::MINUTES,
52 com::sun::star::sheet::DataPilotFieldGroupBy::HOURS,
53 com::sun::star::sheet::DataPilotFieldGroupBy::DAYS,
54 com::sun::star::sheet::DataPilotFieldGroupBy::MONTHS,
55 com::sun::star::sheet::DataPilotFieldGroupBy::QUARTERS,
56 com::sun::star::sheet::DataPilotFieldGroupBy::YEARS
57};
58
44#include <com/sun/star/sheet/DataPilotFieldGroupBy.hpp>
45
46// ============================================================================
47
48namespace {
49
50/** Date part flags in order of the list box entries. */
51static const sal_Int32 spnDateParts[] =
52{
53 com::sun::star::sheet::DataPilotFieldGroupBy::SECONDS,
54 com::sun::star::sheet::DataPilotFieldGroupBy::MINUTES,
55 com::sun::star::sheet::DataPilotFieldGroupBy::HOURS,
56 com::sun::star::sheet::DataPilotFieldGroupBy::DAYS,
57 com::sun::star::sheet::DataPilotFieldGroupBy::MONTHS,
58 com::sun::star::sheet::DataPilotFieldGroupBy::QUARTERS,
59 com::sun::star::sheet::DataPilotFieldGroupBy::YEARS
60};
61
62static const sal_uInt16 nDatePartResIds[] =
63{
64 STR_DPFIELD_GROUP_BY_SECONDS,
65 STR_DPFIELD_GROUP_BY_MINUTES,
66 STR_DPFIELD_GROUP_BY_HOURS,
67 STR_DPFIELD_GROUP_BY_DAYS,
68 STR_DPFIELD_GROUP_BY_MONTHS,
69 STR_DPFIELD_GROUP_BY_QUARTERS,
70 STR_DPFIELD_GROUP_BY_YEARS
71};
72
59} // namespace
60
61// ============================================================================
62
63ScDPGroupEditHelper::ScDPGroupEditHelper( RadioButton& rRbAuto, RadioButton& rRbMan, Edit& rEdValue ) :
64 mrRbAuto( rRbAuto ),
65 mrRbMan( rRbMan ),
66 mrEdValue( rEdValue )

--- 164 unchanged lines hidden (view full) ---

231 maEdNumDays ( this, ScResId( ED_NUMDAYS ) ),
232 maLbUnits ( this, ScResId( LB_UNITS ) ),
233 maBtnOk ( this, ScResId( BTN_OK ) ),
234 maBtnCancel ( this, ScResId( BTN_CANCEL ) ),
235 maBtnHelp ( this, ScResId( BTN_HELP ) ),
236 maStartHelper ( maRbAutoStart, maRbManStart, maEdStart, rNullDate ),
237 maEndHelper ( maRbAutoEnd, maRbManEnd, maEdEnd, rNullDate )
238{
73} // namespace
74
75// ============================================================================
76
77ScDPGroupEditHelper::ScDPGroupEditHelper( RadioButton& rRbAuto, RadioButton& rRbMan, Edit& rEdValue ) :
78 mrRbAuto( rRbAuto ),
79 mrRbMan( rRbMan ),
80 mrEdValue( rEdValue )

--- 164 unchanged lines hidden (view full) ---

245 maEdNumDays ( this, ScResId( ED_NUMDAYS ) ),
246 maLbUnits ( this, ScResId( LB_UNITS ) ),
247 maBtnOk ( this, ScResId( BTN_OK ) ),
248 maBtnCancel ( this, ScResId( BTN_CANCEL ) ),
249 maBtnHelp ( this, ScResId( BTN_HELP ) ),
250 maStartHelper ( maRbAutoStart, maRbManStart, maEdStart, rNullDate ),
251 maEndHelper ( maRbAutoEnd, maRbManEnd, maEdEnd, rNullDate )
252{
253 FreeResource();
254
239 maLbUnits.SetHelpId( HID_SC_DPDATEGROUP_LB );
255 maLbUnits.SetHelpId( HID_SC_DPDATEGROUP_LB );
240 ResStringArray aArr( ScResId( STR_UNITS ) );
241 for( sal_uInt16 nIdx = 0, nCount = sal::static_int_cast<sal_uInt16>(aArr.Count()); nIdx < nCount; ++nIdx )
242 maLbUnits.InsertEntry( aArr.GetString( nIdx ) );
243
256
244 FreeResource();
257 static const size_t nCount = sizeof( nDatePartResIds ) / sizeof( nDatePartResIds[0] );
258 for( size_t nIdx = 0 ; nIdx < nCount; ++nIdx )
259 maLbUnits.InsertEntry( ScGlobal::GetRscString( nDatePartResIds[nIdx] ) );
245
246 maEdStart.SetShowDateCentury( sal_True );
247 maEdEnd.SetShowDateCentury( sal_True );
248
249 maStartHelper.SetValue( rInfo.AutoStart, rInfo.Start );
250 maEndHelper.SetValue( rInfo.AutoEnd, rInfo.End );
251
252 if( nDatePart == 0 )
253 nDatePart = com::sun::star::sheet::DataPilotFieldGroupBy::MONTHS;
260
261 maEdStart.SetShowDateCentury( sal_True );
262 maEdEnd.SetShowDateCentury( sal_True );
263
264 maStartHelper.SetValue( rInfo.AutoStart, rInfo.Start );
265 maEndHelper.SetValue( rInfo.AutoEnd, rInfo.End );
266
267 if( nDatePart == 0 )
268 nDatePart = com::sun::star::sheet::DataPilotFieldGroupBy::MONTHS;
254 for( sal_uLong nIdx = 0, nCount = maLbUnits.GetEntryCount(); nIdx < nCount; ++nIdx )
269 for( size_t nIdx = 0; nIdx < nCount; ++nIdx )
255 maLbUnits.CheckEntryPos( static_cast< sal_uInt16 >( nIdx ), (nDatePart & spnDateParts[ nIdx ]) != 0 );
256
257 if( rInfo.DateValues )
258 {
259 maRbNumDays.Check();
260 ClickHdl( &maRbNumDays );
261
262 double fNumDays = rInfo.Step;

--- 94 unchanged lines hidden ---
270 maLbUnits.CheckEntryPos( static_cast< sal_uInt16 >( nIdx ), (nDatePart & spnDateParts[ nIdx ]) != 0 );
271
272 if( rInfo.DateValues )
273 {
274 maRbNumDays.Check();
275 ClickHdl( &maRbNumDays );
276
277 double fNumDays = rInfo.Step;

--- 94 unchanged lines hidden ---