diff options
author | Csikós Tamás <csks.tomi@gmail.com> | 2013-07-31 13:37:41 +0200 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-08-02 08:12:11 +0000 |
commit | 1f0da38c7d132cfc64e977454ebc2eab35f18ba0 (patch) | |
tree | 7e5f54bc35c7532e542b63a7f4ea4603189260bf /reportdesign/source | |
parent | 3aea6c121d3b962d8efafe9b15d35a0f93ddceb3 (diff) |
modern .ui widgetlayout for datetime
widget found at: database/insert/report -> insert/Date and Time
Change-Id: I8d0f388bd8e3eb7169e24570beeb7d6b513b8d05
Reviewed-on: https://gerrit.libreoffice.org/5213
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'reportdesign/source')
-rw-r--r-- | reportdesign/source/ui/dlg/DateTime.cxx | 70 | ||||
-rw-r--r-- | reportdesign/source/ui/dlg/DateTime.hrc | 49 | ||||
-rw-r--r-- | reportdesign/source/ui/dlg/DateTime.src | 126 | ||||
-rw-r--r-- | reportdesign/source/ui/inc/DateTime.hxx | 20 |
4 files changed, 42 insertions, 223 deletions
diff --git a/reportdesign/source/ui/dlg/DateTime.cxx b/reportdesign/source/ui/dlg/DateTime.cxx index 5ad27abcdb6a..fecfb0b6c3af 100644 --- a/reportdesign/source/ui/dlg/DateTime.cxx +++ b/reportdesign/source/ui/dlg/DateTime.cxx @@ -17,7 +17,6 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ #include "DateTime.hxx" -#include "DateTime.hrc" #include <com/sun/star/beans/XPropertySet.hpp> #include <tools/debug.hxx> #include "RptResId.hrc" @@ -52,23 +51,21 @@ DBG_NAME( rpt_ODateTimeDialog ) ODateTimeDialog::ODateTimeDialog( Window* _pParent ,const uno::Reference< report::XSection >& _xHoldAlive ,OReportController* _pController) - : ModalDialog( _pParent, ModuleRes(RID_DATETIME_DLG) ) - ,m_aDate(this, ModuleRes(CB_DATE ) ) - ,m_aFTDateFormat(this, ModuleRes(FT_DATE_FORMAT ) ) - ,m_aDateListBox(this, ModuleRes(LB_DATE_TYPE ) ) - ,m_aFL0(this, ModuleRes(FL_SEPARATOR0 ) ) - ,m_aTime(this, ModuleRes(CB_TIME ) ) - ,m_aFTTimeFormat(this, ModuleRes(FT_TIME_FORMAT ) ) - ,m_aTimeListBox(this, ModuleRes(LB_TIME_TYPE ) ) - ,m_aFL1(this, ModuleRes(FL_SEPARATOR1) ) - ,m_aPB_OK(this, ModuleRes(PB_OK)) - ,m_aPB_CANCEL(this, ModuleRes(PB_CANCEL)) - ,m_aPB_Help(this, ModuleRes(PB_HELP)) + : ModalDialog( _pParent, "DateTimeDialog" , "modules/dbreport/ui/datetimedialog.ui" ) + ,m_aDateControlling() ,m_aTimeControlling() ,m_pController(_pController) ,m_xHoldAlive(_xHoldAlive) { + get(m_pDate,"date"); + get(m_pFTDateFormat,"datelistbox_label"); + get(m_pDateListBox,"datelistbox"); + get(m_pTime,"time"); + get(m_pFTTimeFormat,"timelistbox_label"); + get(m_pTimeListBox,"timelistbox"); + get(m_pPB_OK,"ok"); + DBG_CTOR( rpt_ODateTimeDialog,NULL); try @@ -83,29 +80,28 @@ ODateTimeDialog::ODateTimeDialog( Window* _pParent { } - m_aDateListBox.SetDropDownLineCount(20); - m_aDateListBox.SelectEntryPos(0); + m_pDateListBox->SetDropDownLineCount(20); + m_pDateListBox->SelectEntryPos(0); - m_aTimeListBox.SetDropDownLineCount(20); - m_aTimeListBox.SelectEntryPos(0); + m_pTimeListBox->SetDropDownLineCount(20); + m_pTimeListBox->SelectEntryPos(0); // use nice enhancement, to toggle enable/disable if a checkbox is checked or not - m_aDateControlling.enableOnCheckMark( m_aDate, m_aFTDateFormat, m_aDateListBox); - m_aTimeControlling.enableOnCheckMark( m_aTime, m_aFTTimeFormat, m_aTimeListBox); + m_aDateControlling.enableOnCheckMark( *m_pDate, *m_pFTDateFormat, *m_pDateListBox); + m_aTimeControlling.enableOnCheckMark( *m_pTime, *m_pFTTimeFormat, *m_pTimeListBox); - CheckBox* pCheckBoxes[] = { &m_aDate,&m_aTime}; + CheckBox* pCheckBoxes[] = { m_pDate,m_pTime}; for ( size_t i = 0 ; i < sizeof(pCheckBoxes)/sizeof(pCheckBoxes[0]); ++i) pCheckBoxes[i]->SetClickHdl(LINK(this,ODateTimeDialog,CBClickHdl)); - FreeResource(); } // ----------------------------------------------------------------------------- void ODateTimeDialog::InsertEntry(sal_Int16 _nNumberFormatId) { const bool bTime = util::NumberFormat::TIME == _nNumberFormatId; - ListBox* pListBox = &m_aDateListBox; + ListBox* pListBox = m_pDateListBox; if ( bTime ) - pListBox = &m_aTimeListBox; + pListBox = m_pTimeListBox; const uno::Reference< util::XNumberFormatter> xNumberFormatter = m_pController->getReportNumberFormatter(); const uno::Reference< util::XNumberFormats> xFormats = xNumberFormatter->getNumberFormatsSupplier()->getNumberFormats(); @@ -128,7 +124,7 @@ short ODateTimeDialog::Execute() { DBG_CHKTHIS( rpt_ODateTimeDialog,NULL); short nRet = ModalDialog::Execute(); - if ( nRet == RET_OK && (m_aDate.IsChecked() || m_aTime.IsChecked()) ) + if ( nRet == RET_OK && (m_pDate->IsChecked() || m_pTime->IsChecked()) ) { try { @@ -138,10 +134,10 @@ short ODateTimeDialog::Execute() aValues[nLength++].Value <<= m_xHoldAlive; aValues[nLength].Name = PROPERTY_TIME_STATE; - aValues[nLength++].Value <<= m_aTime.IsChecked(); + aValues[nLength++].Value <<= m_pTime->IsChecked(); aValues[nLength].Name = PROPERTY_DATE_STATE; - aValues[nLength++].Value <<= m_aDate.IsChecked(); + aValues[nLength++].Value <<= m_pDate->IsChecked(); aValues[nLength].Name = PROPERTY_FORMATKEYDATE; aValues[nLength++].Value <<= getFormatKey(sal_True); @@ -150,14 +146,14 @@ short ODateTimeDialog::Execute() aValues[nLength++].Value <<= getFormatKey(sal_False); sal_Int32 nWidth = 0; - if ( m_aDate.IsChecked() ) + if ( m_pDate->IsChecked() ) { - String sDateFormat = m_aDateListBox.GetEntry( m_aDateListBox.GetSelectEntryPos() ); + String sDateFormat = m_pDateListBox->GetEntry( m_pDateListBox->GetSelectEntryPos() ); nWidth = LogicToLogic(PixelToLogic(Size(GetCtrlTextWidth(sDateFormat),0)).Width(),GetMapMode().GetMapUnit(),MAP_100TH_MM); } - if ( m_aTime.IsChecked() ) + if ( m_pTime->IsChecked() ) { - String sDateFormat = m_aTimeListBox.GetEntry( m_aTimeListBox.GetSelectEntryPos() ); + String sDateFormat = m_pTimeListBox->GetEntry( m_pTimeListBox->GetSelectEntryPos() ); nWidth = ::std::max<sal_Int32>(LogicToLogic(PixelToLogic(Size(GetCtrlTextWidth(sDateFormat),0)).Width(),GetMapMode().GetMapUnit(),MAP_100TH_MM),nWidth); } @@ -207,17 +203,17 @@ IMPL_LINK( ODateTimeDialog, CBClickHdl, CheckBox*, _pBox ) (void)_pBox; DBG_CHKTHIS( rpt_ODateTimeDialog,NULL); - if ( _pBox == &m_aDate || _pBox == &m_aTime) + if ( _pBox == m_pDate || _pBox == m_pTime) { - sal_Bool bDate = m_aDate.IsChecked(); - sal_Bool bTime = m_aTime.IsChecked(); + sal_Bool bDate = m_pDate->IsChecked(); + sal_Bool bTime = m_pTime->IsChecked(); if (!bDate && !bTime) { - m_aPB_OK.Disable(); + m_pPB_OK->Disable(); } else { - m_aPB_OK.Enable(); + m_pPB_OK->Enable(); } } return 1L; @@ -229,11 +225,11 @@ sal_Int32 ODateTimeDialog::getFormatKey(sal_Bool _bDate) const sal_Int32 nFormatKey; if ( _bDate ) { - nFormatKey = static_cast<sal_Int32>(reinterpret_cast<sal_IntPtr>(m_aDateListBox.GetEntryData( m_aDateListBox.GetSelectEntryPos() ))); + nFormatKey = static_cast<sal_Int32>(reinterpret_cast<sal_IntPtr>(m_pDateListBox->GetEntryData( m_pDateListBox->GetSelectEntryPos() ))); } else { - nFormatKey = static_cast<sal_Int32>(reinterpret_cast<sal_IntPtr>(m_aTimeListBox.GetEntryData( m_aTimeListBox.GetSelectEntryPos() ))); + nFormatKey = static_cast<sal_Int32>(reinterpret_cast<sal_IntPtr>(m_pTimeListBox->GetEntryData( m_pTimeListBox->GetSelectEntryPos() ))); } return nFormatKey; } diff --git a/reportdesign/source/ui/dlg/DateTime.hrc b/reportdesign/source/ui/dlg/DateTime.hrc deleted file mode 100644 index e05a53ca42b3..000000000000 --- a/reportdesign/source/ui/dlg/DateTime.hrc +++ /dev/null @@ -1,49 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef RPTUI_DATETIME_HRC -#define RPTUI_DATETIME_HRC - -#define CB_DATE (1) -#define FT_DATE_FORMAT (2) -#define LB_DATE_TYPE (3) -#define FL_SEPARATOR0 (4) -#define CB_TIME (5) -#define FT_TIME_FORMAT (6) -#define LB_TIME_TYPE (7) -#define FL_SEPARATOR1 (8) -#define PB_OK (9) -#define PB_CANCEL (10) -#define PB_HELP (11) - -#define CHECKBOX_HEIGHT 8 -#define FIXEDTEXT_HEIGHT 8 -#define RELATED_CONTROLS 4 -#define UNRELATED_CONTROLS 7 -#define EDIT_HEIGHT 12 -#define LISTBOX_HEIGHT 12 -#define BUTTON_HEIGHT 14 -#define BUTTON_WIDTH 50 -#define BROWSER_HEIGHT 75 -#define PAGE_WIDTH (RELATED_CONTROLS + 3*UNRELATED_CONTROLS + 3*BUTTON_WIDTH) -#define PAGE_HEIGHT (2*RELATED_CONTROLS + 6*UNRELATED_CONTROLS + 2*CHECKBOX_HEIGHT + 2*LISTBOX_HEIGHT + BUTTON_HEIGHT) -#define LISTBOX_WIDTH PAGE_WIDTH - 3*UNRELATED_CONTROLS - FIXEDTEXT_WIDTH - -#endif // RPTUI_DATETIME_HRC - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/ui/dlg/DateTime.src b/reportdesign/source/ui/dlg/DateTime.src deleted file mode 100644 index c46442075746..000000000000 --- a/reportdesign/source/ui/dlg/DateTime.src +++ /dev/null @@ -1,126 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#include "DateTime.hrc" -#include "RptResId.hrc" -#include "helpids.hrc" -#include <svx/globlmn.hrc> -#include <svx/svxids.hrc> - - -ModalDialog RID_DATETIME_DLG -{ - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( PAGE_WIDTH , PAGE_HEIGHT ) ; - Text [ en-US ] = "Date and Time" ; - HelpId = HID_RPT_DATETIME_DLG; - Moveable = TRUE ; - Closeable = TRUE ; - - CheckBox CB_DATE - { - HelpID = "reportdesign:CheckBox:RID_DATETIME_DLG:CB_DATE"; - Pos = MAP_APPFONT ( UNRELATED_CONTROLS , RELATED_CONTROLS /* + UNRELATED_CONTROLS + FIXEDTEXT_HEIGHT */) ; - Size = MAP_APPFONT ( PAGE_WIDTH - 2*UNRELATED_CONTROLS, FIXEDTEXT_HEIGHT ) ; - Check = TRUE; - Text [ en-US ] = "Include Date"; - }; - - FixedText FT_DATE_FORMAT - { - Pos = MAP_APPFONT ( RELATED_CONTROLS + 2*UNRELATED_CONTROLS, RELATED_CONTROLS + UNRELATED_CONTROLS + CHECKBOX_HEIGHT ); - Size = MAP_APPFONT( BUTTON_WIDTH - RELATED_CONTROLS, FIXEDTEXT_HEIGHT ); - Text [ en-US ] = "Format"; - }; - - ListBox LB_DATE_TYPE - { - HelpID = "reportdesign:ListBox:RID_DATETIME_DLG:LB_DATE_TYPE"; - Pos = MAP_APPFONT ( 2 * UNRELATED_CONTROLS + BUTTON_WIDTH, RELATED_CONTROLS + UNRELATED_CONTROLS + CHECKBOX_HEIGHT) ; - Size = MAP_APPFONT( PAGE_WIDTH - 3*UNRELATED_CONTROLS - BUTTON_WIDTH, 60 ); - Border = TRUE; - DropDown = TRUE; - TabStop = TRUE; - Sort = FALSE; - }; - - FixedLine FL_SEPARATOR0 - { - Pos = MAP_APPFONT ( RELATED_CONTROLS , RELATED_CONTROLS + 2*UNRELATED_CONTROLS + CHECKBOX_HEIGHT + LISTBOX_HEIGHT) ; - Size = MAP_APPFONT ( PAGE_WIDTH - 2*RELATED_CONTROLS , 1 ) ; - }; - - CheckBox CB_TIME - { - HelpID = "reportdesign:CheckBox:RID_DATETIME_DLG:CB_TIME"; - Pos = MAP_APPFONT ( UNRELATED_CONTROLS, RELATED_CONTROLS + 3*UNRELATED_CONTROLS + CHECKBOX_HEIGHT + LISTBOX_HEIGHT) ; - Size = MAP_APPFONT ( PAGE_WIDTH - 2*UNRELATED_CONTROLS, FIXEDTEXT_HEIGHT ) ; - Check = TRUE; - Text [ en-US ] = "Include Time"; - }; - - FixedText FT_TIME_FORMAT - { - Pos = MAP_APPFONT ( RELATED_CONTROLS + 2*UNRELATED_CONTROLS, RELATED_CONTROLS + 4*UNRELATED_CONTROLS + 2*CHECKBOX_HEIGHT + LISTBOX_HEIGHT); - Size = MAP_APPFONT( BUTTON_WIDTH - RELATED_CONTROLS, FIXEDTEXT_HEIGHT ); - Text [ en-US ] = "Format"; - }; - - ListBox LB_TIME_TYPE - { - HelpID = "reportdesign:ListBox:RID_DATETIME_DLG:LB_TIME_TYPE"; - Pos = MAP_APPFONT ( 2 * UNRELATED_CONTROLS + BUTTON_WIDTH, RELATED_CONTROLS + 4*UNRELATED_CONTROLS + 2*CHECKBOX_HEIGHT + LISTBOX_HEIGHT) ; - Size = MAP_APPFONT( PAGE_WIDTH - 3*UNRELATED_CONTROLS - BUTTON_WIDTH, 60 ); - Border = TRUE; - DropDown = TRUE; - TabStop = TRUE; - Sort = FALSE; - }; - - FixedLine FL_SEPARATOR1 - { - Pos = MAP_APPFONT ( RELATED_CONTROLS , RELATED_CONTROLS + 5*UNRELATED_CONTROLS + 2*CHECKBOX_HEIGHT + 2*LISTBOX_HEIGHT) ; - Size = MAP_APPFONT ( PAGE_WIDTH - 2*RELATED_CONTROLS , 1 ) ; - }; - - OKButton PB_OK - { - Pos = MAP_APPFONT ( UNRELATED_CONTROLS, RELATED_CONTROLS + 6*UNRELATED_CONTROLS + 2*CHECKBOX_HEIGHT + 2*LISTBOX_HEIGHT +1) ; - Size = MAP_APPFONT ( BUTTON_WIDTH , BUTTON_HEIGHT ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - - CancelButton PB_CANCEL - { - Pos = MAP_APPFONT ( RELATED_CONTROLS + UNRELATED_CONTROLS + BUTTON_WIDTH , RELATED_CONTROLS + 6*UNRELATED_CONTROLS + 2*CHECKBOX_HEIGHT + 2*LISTBOX_HEIGHT +1) ; - Size = MAP_APPFONT ( BUTTON_WIDTH , BUTTON_HEIGHT ) ; - TabStop = TRUE ; - }; - - HelpButton PB_HELP - { - TabStop = TRUE ; - Pos = MAP_APPFONT ( RELATED_CONTROLS + 2*UNRELATED_CONTROLS + 2*BUTTON_WIDTH , RELATED_CONTROLS + 6*UNRELATED_CONTROLS + 2*CHECKBOX_HEIGHT + 2*LISTBOX_HEIGHT +1) ; - Size = MAP_APPFONT ( BUTTON_WIDTH , BUTTON_HEIGHT ) ; - Text [ en-US ] = "~Help"; - }; -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/ui/inc/DateTime.hxx b/reportdesign/source/ui/inc/DateTime.hxx index 6d2e16612080..99fadcea7621 100644 --- a/reportdesign/source/ui/inc/DateTime.hxx +++ b/reportdesign/source/ui/inc/DateTime.hxx @@ -40,17 +40,15 @@ class OReportController; \************************************************************************/ class ODateTimeDialog : public ModalDialog { - CheckBox m_aDate; - FixedText m_aFTDateFormat; - ListBox m_aDateListBox; - FixedLine m_aFL0; - CheckBox m_aTime; - FixedText m_aFTTimeFormat; - ListBox m_aTimeListBox; - FixedLine m_aFL1; - OKButton m_aPB_OK; - CancelButton m_aPB_CANCEL; - HelpButton m_aPB_Help; + CheckBox* m_pDate; + FixedText* m_pFTDateFormat; + ListBox* m_pDateListBox; + CheckBox* m_pTime; + FixedText* m_pFTTimeFormat; + ListBox* m_pTimeListBox; + OKButton* m_pPB_OK; + CancelButton* m_pPB_CANCEL; + HelpButton* m_pPB_Help; svt::ControlDependencyManager m_aDateControlling; |