From 554a61317267cc364b0bf53131db1be07e035cfb Mon Sep 17 00:00:00 2001 From: Palenik Mihály Date: Thu, 3 Jul 2014 20:35:20 +0200 Subject: Convert RID_CONDFORMAT to .ui Change-Id: I23ac6a7328a43c2fb63f2f804f6718f64e73eb8e --- reportdesign/UIConfig_dbreport.mk | 2 + reportdesign/inc/RptResId.hrc | 1 - reportdesign/source/ui/dlg/CondFormat.cxx | 113 +++--- reportdesign/source/ui/dlg/CondFormat.hrc | 19 - reportdesign/source/ui/dlg/CondFormat.src | 215 +---------- reportdesign/source/ui/dlg/Condition.cxx | 380 ++++++------------- reportdesign/source/ui/dlg/Condition.hxx | 63 ++-- reportdesign/source/ui/inc/CondFormat.hxx | 17 +- .../uiconfig/dbreport/ui/condformatdialog.ui | 131 +++++++ reportdesign/uiconfig/dbreport/ui/conditionwin.ui | 406 +++++++++++++++++++++ 10 files changed, 748 insertions(+), 599 deletions(-) create mode 100644 reportdesign/uiconfig/dbreport/ui/condformatdialog.ui create mode 100644 reportdesign/uiconfig/dbreport/ui/conditionwin.ui (limited to 'reportdesign') diff --git a/reportdesign/UIConfig_dbreport.mk b/reportdesign/UIConfig_dbreport.mk index 79a4db70bb4b..ec44450bf4a5 100644 --- a/reportdesign/UIConfig_dbreport.mk +++ b/reportdesign/UIConfig_dbreport.mk @@ -37,6 +37,8 @@ $(eval $(call gb_UIConfig_add_toolbarfiles,modules/dbreport,\ $(eval $(call gb_UIConfig_add_uifiles,modules/dbreport,\ reportdesign/uiconfig/dbreport/ui/backgrounddialog \ reportdesign/uiconfig/dbreport/ui/chardialog \ + reportdesign/uiconfig/dbreport/ui/condformatdialog \ + reportdesign/uiconfig/dbreport/ui/conditionwin \ reportdesign/uiconfig/dbreport/ui/datetimedialog \ reportdesign/uiconfig/dbreport/ui/pagedialog \ reportdesign/uiconfig/dbreport/ui/pagenumberdialog \ diff --git a/reportdesign/inc/RptResId.hrc b/reportdesign/inc/RptResId.hrc index 160d0347bc0c..ccdcf35c6c97 100644 --- a/reportdesign/inc/RptResId.hrc +++ b/reportdesign/inc/RptResId.hrc @@ -40,7 +40,6 @@ // Dialog Control Id's ----------------------------------------------------------- #define RID_GROUPS_SORTING ( RID_DIALOG_START + 0 ) #define RID_DATETIME_DLG ( RID_DIALOG_START + 2 ) -#define RID_CONDFORMAT ( RID_DIALOG_START + 3 ) #define WIN_CONDITION ( RID_DIALOG_START + 4 ) #define RID_NAVIGATOR ( RID_DIALOG_START + 5 ) diff --git a/reportdesign/source/ui/dlg/CondFormat.cxx b/reportdesign/source/ui/dlg/CondFormat.cxx index 706f2d65f349..a687b142ab09 100644 --- a/reportdesign/source/ui/dlg/CondFormat.cxx +++ b/reportdesign/source/ui/dlg/CondFormat.cxx @@ -80,40 +80,57 @@ namespace rptui } }; + void ConditionalFormattingDialog::impl_setPrefHeight(bool bFirst) + { + if (!m_bConstructed && !bFirst) + return; - // class ConditionalFormattingDialog + //allow dialog to resize itself + size_t nCount = impl_getConditionCount(); + if (nCount) + { + long nHeight = m_aConditions[0]->get_preferred_size().Height(); + size_t nVisibleConditions = ::std::min(nCount, MAX_CONDITIONS); + nHeight *= nVisibleConditions; + if (nHeight != m_pConditionPlayground->get_height_request()) + { + m_pConditionPlayground->set_height_request(nHeight); + if (!isCalculatingInitialLayoutSize() && !bFirst) + setOptimalLayoutSize(); + } + } + } + // class ConditionalFormattingDialog ConditionalFormattingDialog::ConditionalFormattingDialog( Window* _pParent, const Reference< XReportControlModel >& _rxFormatConditions, ::rptui::OReportController& _rController ) - :ModalDialog( _pParent, ModuleRes(RID_CONDFORMAT) ) - ,m_aConditionPlayground( this, ModuleRes( WND_COND_PLAYGROUND ) ) - ,m_aSeparator(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)) - ,m_aCondScroll( this, ModuleRes( SB_ALL_CONDITIONS ) ) + :ModalDialog( _pParent, "CondFormat", "modules/dbreport/ui/condformatdialog.ui" ) ,m_rController( _rController ) ,m_xFormatConditions( _rxFormatConditions ) ,m_bDeletingCondition( false ) + ,m_bConstructed( false ) { + get(m_pConditionPlayground, "condPlaygroundDrawingarea"); + get(m_pCondScroll, "condScrollbar"); + OSL_ENSURE( m_xFormatConditions.is(), "ConditionalFormattingDialog::ConditionalFormattingDialog: ReportControlModel is NULL -> Prepare for GPF!" ); m_xCopy.set( m_xFormatConditions->createClone(), UNO_QUERY_THROW ); - m_aCondScroll.SetScrollHdl( LINK( this, ConditionalFormattingDialog, OnScroll ) ); + m_pCondScroll->SetScrollHdl( LINK( this, ConditionalFormattingDialog, OnScroll ) ); impl_initializeConditions(); - FreeResource(); - } + impl_setPrefHeight(true); + m_bConstructed = true; + } ConditionalFormattingDialog::~ConditionalFormattingDialog() { m_aConditions.clear(); } - void ConditionalFormattingDialog::impl_updateConditionIndicies() { sal_Int32 nIndex = 0; @@ -126,18 +143,18 @@ namespace rptui } } - void ConditionalFormattingDialog::impl_conditionCountChanged() { if ( m_aConditions.empty() ) impl_addCondition_nothrow( 0 ); + impl_setPrefHeight(false); + impl_updateScrollBarRange(); impl_updateConditionIndicies(); impl_layoutAll(); } - void ConditionalFormattingDialog::addCondition( size_t _nAddAfterIndex ) { OSL_PRECOND( _nAddAfterIndex < impl_getConditionCount(), "ConditionalFormattingDialog::addCondition: illegal condition index!" ); @@ -164,11 +181,9 @@ namespace rptui ::comphelper::copyProperties(m_xCopy.get(),xCond.get()); m_xCopy->insertByIndex( _nNewCondIndex, makeAny( xCond ) ); - ConditionPtr pCon( new Condition( &m_aConditionPlayground, *this, m_rController ) ); + ConditionPtr pCon( new Condition( m_pConditionPlayground, *this, m_rController ) ); pCon->setCondition( xCond ); m_aConditions.insert( m_aConditions.begin() + _nNewCondIndex, pCon ); - - pCon->setPosSizePixel( 0, 0, impl_getConditionWidth(), 0, WINDOW_POSSIZE_WIDTH ); } catch( const Exception& ) { @@ -276,29 +291,18 @@ namespace rptui impl_updateConditionIndicies(); // re-layout all conditions - Point aDummy; - impl_layoutConditions( aDummy ); + impl_layoutConditions(); // ensure the moved condition is visible impl_ensureConditionVisible( nNewConditionIndex ); } - - long ConditionalFormattingDialog::impl_getConditionWidth() const - { - const Size aDialogSize( GetOutputSizePixel() ); - const Size aScrollBarWidth( LogicToPixel( Size( SCROLLBAR_WIDTH + UNRELATED_CONTROLS, 0 ), MAP_APPFONT ) ); - return aDialogSize.Width() - aScrollBarWidth.Width(); - } - - IMPL_LINK( ConditionalFormattingDialog, OnScroll, ScrollBar*, /*_pNotInterestedIn*/ ) { size_t nFirstCondIndex( impl_getFirstVisibleConditionIndex() ); size_t nFocusCondIndex = impl_getFocusedConditionIndex( nFirstCondIndex ); - Point aDummy; - impl_layoutConditions( aDummy ); + impl_layoutConditions(); if ( nFocusCondIndex < nFirstCondIndex ) impl_focusCondition( nFirstCondIndex ); @@ -308,15 +312,15 @@ namespace rptui return 0; } - - void ConditionalFormattingDialog::impl_layoutConditions( Point& _out_rBelowLastVisible ) + void ConditionalFormattingDialog::impl_layoutConditions() { +#if 0 // position the condition's playground long nConditionWidth = impl_getConditionWidth(); long nConditionHeight = LogicToPixel( Size( 0, CONDITION_HEIGHT ), MAP_APPFONT ).Height(); size_t nVisibleConditions = ::std::min( impl_getConditionCount(), MAX_CONDITIONS ); Size aPlaygroundSize( nConditionWidth, nVisibleConditions * nConditionHeight ); - m_aConditionPlayground.SetSizePixel( aPlaygroundSize ); + m_pConditionPlayground->SetSizePixel( aPlaygroundSize ); _out_rBelowLastVisible = Point( 0, aPlaygroundSize.Height() ); // position the single conditions @@ -329,34 +333,18 @@ namespace rptui (*cond)->setPosSizePixel( aConditionPos.X(), aConditionPos.Y(), nConditionWidth, nConditionHeight ); aConditionPos.Move( 0, nConditionHeight ); } +#endif } - void ConditionalFormattingDialog::impl_layoutAll() { // condition's positions - Point aPos; - impl_layoutConditions( aPos ); + impl_layoutConditions(); - // scrollbar size and visibility - m_aCondScroll.setPosSizePixel( 0, 0, 0, aPos.Y(), WINDOW_POSSIZE_HEIGHT ); + // scrollbar visibility if ( !impl_needScrollBar() ) // normalize the position, so it can, in all situations, be used as top index - m_aCondScroll.SetThumbPos( 0 ); - - // the separator and the buttons below it - aPos += LogicToPixel( Point( 0 , RELATED_CONTROLS ), MAP_APPFONT ); - m_aSeparator.setPosSizePixel( 0, aPos.Y(), 0, 0, WINDOW_POSSIZE_Y ); - - aPos += LogicToPixel( Point( 0 , UNRELATED_CONTROLS ), MAP_APPFONT ); - Window* pWindows[] = { &m_aPB_OK, &m_aPB_CANCEL, &m_aPB_Help }; - for ( size_t i= 0; i < sizeof(pWindows)/sizeof(pWindows[0]); ++i ) - { - pWindows[i]->setPosSizePixel( 0, aPos.Y(), 0, 0, WINDOW_POSSIZE_Y ); - } - - aPos += LogicToPixel( Point( 0, BUTTON_HEIGHT + RELATED_CONTROLS ), MAP_APPFONT ); - setPosSizePixel( 0, 0, 0, aPos.Y(), WINDOW_POSSIZE_HEIGHT ); + m_pCondScroll->SetThumbPos( 0 ); } void ConditionalFormattingDialog::impl_initializeConditions() @@ -366,7 +354,7 @@ namespace rptui sal_Int32 nCount = m_xCopy->getCount(); for ( sal_Int32 i = 0; i < nCount ; ++i ) { - ConditionPtr pCon( new Condition( &m_aConditionPlayground, *this, m_rController ) ); + ConditionPtr pCon( new Condition( m_pConditionPlayground, *this, m_rController ) ); Reference< XFormatCondition > xCond( m_xCopy->getByIndex(i), UNO_QUERY ); pCon->setCondition( xCond ); pCon->updateToolbar( xCond.get() ); @@ -381,7 +369,6 @@ namespace rptui impl_conditionCountChanged(); } - void ConditionalFormattingDialog::applyCommand( size_t _nCondIndex, sal_uInt16 _nCommandId, const ::Color _aColor ) { OSL_PRECOND( _nCommandId, "ConditionalFormattingDialog::applyCommand: illegal command id!" ); @@ -527,13 +514,13 @@ namespace rptui const Window* pPlaygroundCandidate = pConditionCandidate ? pConditionCandidate->GetParent() : NULL; while ( ( pPlaygroundCandidate ) && ( pPlaygroundCandidate != this ) - && ( pPlaygroundCandidate != &m_aConditionPlayground ) + && ( pPlaygroundCandidate != m_pConditionPlayground ) ) { pConditionCandidate = pConditionCandidate->GetParent(); pPlaygroundCandidate = pConditionCandidate ? pConditionCandidate->GetParent() : NULL; } - if ( pPlaygroundCandidate == &m_aConditionPlayground ) + if ( pPlaygroundCandidate == m_pConditionPlayground ) { impl_ensureConditionVisible( dynamic_cast< const Condition& >( *pConditionCandidate ).getConditionIndex() ); } @@ -547,7 +534,7 @@ namespace rptui size_t ConditionalFormattingDialog::impl_getFirstVisibleConditionIndex() const { - return (size_t)m_aCondScroll.GetThumbPos(); + return (size_t)m_pCondScroll->GetThumbPos(); } @@ -576,9 +563,9 @@ namespace rptui { long nMax = ( impl_getConditionCount() > MAX_CONDITIONS ) ? impl_getConditionCount() - MAX_CONDITIONS + 1 : 0; - m_aCondScroll.SetRangeMin( 0 ); - m_aCondScroll.SetRangeMax( nMax ); - m_aCondScroll.SetVisibleSize( 1 ); + m_pCondScroll->SetRangeMin( 0 ); + m_pCondScroll->SetRangeMax( nMax ); + m_pCondScroll->SetVisibleSize( 1 ); } @@ -586,8 +573,8 @@ namespace rptui { OSL_PRECOND( _nTopCondIndex + MAX_CONDITIONS <= impl_getConditionCount(), "ConditionalFormattingDialog::impl_scrollTo: illegal index!" ); - m_aCondScroll.SetThumbPos( _nTopCondIndex ); - OnScroll( &m_aCondScroll ); + m_pCondScroll->SetThumbPos( _nTopCondIndex ); + OnScroll( m_pCondScroll ); } diff --git a/reportdesign/source/ui/dlg/CondFormat.hrc b/reportdesign/source/ui/dlg/CondFormat.hrc index 515c2d0ee7bd..5d776ff9726b 100644 --- a/reportdesign/source/ui/dlg/CondFormat.hrc +++ b/reportdesign/source/ui/dlg/CondFormat.hrc @@ -35,25 +35,6 @@ #define IMAGE_BUTTON_WIDTH 12 #define IMAGE_BUTTON_HEIGHT 14 -#define FL_CONDITION_HEADER 2 -#define CRTL_FORMAT_PREVIEW 3 -#define TB_FORMAT 4 -#define LB_COND_TYPE 5 -#define LB_OP 6 -#define ED_CONDITION_LHS 7 -#define FT_AND 8 -#define PB_OK 9 -#define PB_CANCEL 10 -#define PB_HELP 11 -#define FL_SEPARATOR1 12 -#define ED_CONDITION_RHS 13 -#define SB_ALL_CONDITIONS 18 -#define WND_COND_PLAYGROUND 19 -#define BTN_MOVE_UP 20 -#define BTN_MOVE_DOWN 21 -#define BTN_ADD_CONDITION 22 -#define BTN_REMOVE_CONDITION 23 - #define ROW_0_POS ( RELATED_CONTROLS ) #define ROW_0_HEIGHT ( FIXEDTEXT_HEIGHT ) #define ROW_1_POS ( ROW_0_POS + ROW_0_HEIGHT + UNRELATED_CONTROLS ) diff --git a/reportdesign/source/ui/dlg/CondFormat.src b/reportdesign/source/ui/dlg/CondFormat.src index 688d27959636..5f933a8cc72a 100644 --- a/reportdesign/source/ui/dlg/CondFormat.src +++ b/reportdesign/source/ui/dlg/CondFormat.src @@ -21,220 +21,7 @@ #include "helpids.hrc" #include #include "rptui_slotid.hrc" - -Control WIN_CONDITION -{ - Size = MAP_APPFONT ( CONDITION_WIDTH , CONDITION_HEIGHT ) ; - HelpId = HID_RPT_COND_DLG; - DialogControl = TRUE; - Hide = TRUE; - - FixedLine FL_CONDITION_HEADER - { - Pos = MAP_APPFONT ( RELATED_CONTROLS, ROW_0_POS ) ; - Size = MAP_APPFONT ( CONDITION_WIDTH - 2 * RELATED_CONTROLS, ROW_0_HEIGHT ) ; - }; - - ListBox LB_COND_TYPE - { - Pos = MAP_APPFONT ( UNRELATED_CONTROLS, ROW_1_POS ) ; - Size = MAP_APPFONT( COND_TYPE_WIDTH, 60 ); - Border = TRUE; - DropDown = TRUE; - TabStop = TRUE; - Sort = FALSE; - StringList [ en-US ] = - { - < "Field Value Is" ; Default ; > ; - < "Expression Is" ; Default ; > ; - }; - }; - - ListBox LB_OP - { - Pos = MAP_APPFONT ( UNRELATED_CONTROLS + COND_TYPE_WIDTH + UNRELATED_CONTROLS, ROW_1_POS ) ; - Size = MAP_APPFONT( COND_OP_WIDTH, 60 ); - Border = TRUE; - DropDown = TRUE; - TabStop = TRUE; - Sort = FALSE; - StringList [ en-US ] = - { - < "between" ; 0; > ; - < "not between" ; 1; > ; - < "equal to" ; 2; > ; - < "not equal to" ; 3; > ; - < "greater than" ; 4; > ; - < "less than" ; 5; > ; - < "greater than or equal to" ; 6; > ; - < "less than or equal to" ; 7; > ; - }; - }; - - Edit ED_CONDITION_LHS - { - Pos = MAP_APPFONT ( 3*UNRELATED_CONTROLS + COND_TYPE_WIDTH + COND_OP_WIDTH, ROW_1_POS ) ; - Size = MAP_APPFONT( EDIT_WIDTH, EDIT_HEIGHT ); - Border = TRUE; - TabStop = TRUE; - }; - - FixedText FT_AND - { - Pos = MAP_APPFONT ( 4*UNRELATED_CONTROLS + COND_TYPE_WIDTH + COND_OP_WIDTH + EDIT_WIDTH, - ROW_1_POS + ( FIXEDTEXT_HEIGHT - EDIT_HEIGHT ) / 2 ); - Size = MAP_APPFONT( OPERATOR_SEP_WIDTH , FIXEDTEXT_HEIGHT ); - Text [ en-US ] = "and"; - }; - - Edit ED_CONDITION_RHS - { - Pos = MAP_APPFONT ( 5*UNRELATED_CONTROLS + COND_TYPE_WIDTH + COND_OP_WIDTH + EDIT_WIDTH + OPERATOR_SEP_WIDTH, - ROW_1_POS ); - Size = MAP_APPFONT( EDIT_WIDTH, EDIT_HEIGHT ); - Border = TRUE; - TabStop = TRUE; - }; - - ImageButton BTN_MOVE_UP - { - Pos = MAP_APPFONT ( CONDITION_WIDTH - UNRELATED_CONTROLS - IMAGE_BUTTON_WIDTH, ROW_1_POS ) ; - Size = MAP_APPFONT ( IMAGE_BUTTON_WIDTH, IMAGE_BUTTON_HEIGHT ) ; - TabStop = TRUE ; - Symbol = IMAGEBUTTON_ARROW_UP ; - }; - - ImageButton BTN_MOVE_DOWN - { - Pos = MAP_APPFONT ( CONDITION_WIDTH - UNRELATED_CONTROLS - IMAGE_BUTTON_WIDTH, ROW_1_POS + IMAGE_BUTTON_HEIGHT + RELATED_CONTROLS ) ; - Size = MAP_APPFONT ( IMAGE_BUTTON_WIDTH, IMAGE_BUTTON_HEIGHT ) ; - TabStop = TRUE ; - Symbol = IMAGEBUTTON_ARROW_DOWN ; - }; - - ToolBox TB_FORMAT - { - Pos = MAP_APPFONT ( UNRELATED_CONTROLS + RELATED_CONTROLS, ROW_2_POS ) ; - ButtonType = BUTTON_SYMBOL; - Align = BOXALIGN_TOP; - HelpId = HID_RPT_CONDFORMAT_TB; - Customize = FALSE; - ItemList = - { - ToolBoxItem - { - ITEM_FORMAT_ATTR_CHAR_WEIGHT - Checkable = TRUE; - }; - ToolBoxItem - { - ITEM_FORMAT_ATTR_CHAR_POSTURE - Checkable = TRUE; - }; - ToolBoxItem - { - ITEM_FORMAT_ATTR_CHAR_UNDERLINE - Checkable = TRUE; - }; - ToolBoxItem - { - Type = TOOLBOXITEM_SEPARATOR; - }; - ToolBoxItem - { - ITEM_TOOLBAR_BACKGROUND_COLOR - DropDown = TRUE; - }; - ToolBoxItem - { - ITEM_TOOLBAR_ATTR_CHAR_COLOR - Identifier = SID_ATTR_CHAR_COLOR2; - Command = ".uno:FontColor"; - }; - ToolBoxItem - { - ITEM_FORMAT_CHAR_DLG - }; - }; - }; - - Window CRTL_FORMAT_PREVIEW - { - Pos = MAP_APPFONT ( 2*UNRELATED_CONTROLS, ROW_2_POS ) ; - Size = MAP_APPFONT ( CONDITION_WIDTH - UNRELATED_CONTROLS, ROW_2_HEIGHT ) ; - Border = TRUE ; - HelpId = HID_RPT_CRTL_FORMAT_PREVIEW; - Text [ en-US ] = "Example"; - }; - - PushButton BTN_ADD_CONDITION - { - Pos = MAP_APPFONT( CONDITION_WIDTH - 2*UNRELATED_CONTROLS - 2*IMAGE_BUTTON_WIDTH - RELATED_CONTROLS, ROW_3_POS ); - Size = MAP_APPFONT( IMAGE_BUTTON_WIDTH, IMAGE_BUTTON_HEIGHT ); - Text = "+"; - }; - - PushButton BTN_REMOVE_CONDITION - { - Pos = MAP_APPFONT( CONDITION_WIDTH - 2*UNRELATED_CONTROLS - 2*IMAGE_BUTTON_WIDTH - RELATED_CONTROLS, ROW_3_POS ); - Size = MAP_APPFONT( IMAGE_BUTTON_WIDTH, IMAGE_BUTTON_HEIGHT ); - Text = "-"; - }; -}; - -ModalDialog RID_CONDFORMAT -{ - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( COND_DLG_WIDTH, COND_DLG_HEIGHT ) ; - Text [ en-US ] = "Conditional Formatting" ; - HelpId = HID_RPT_CONDFORMAT_DLG; - Moveable = TRUE ; - Closeable = TRUE ; - - Window WND_COND_PLAYGROUND - { - Pos = MAP_APPFONT ( 0, 0 ) ; - Size = MAP_APPFONT ( CONDITION_WIDTH, CONDITION_HEIGHT ) ; - DialogControl = TRUE; - Hide = FALSE; - }; - - FixedLine FL_SEPARATOR1 - { - Pos = MAP_APPFONT ( RELATED_CONTROLS, CONDITION_HEIGHT + RELATED_CONTROLS ) ; - Size = MAP_APPFONT ( CONDITION_WIDTH - 2*RELATED_CONTROLS , 1 ) ; - }; - - OKButton PB_OK - { - Pos = MAP_APPFONT ( CONDITION_WIDTH - 3*BUTTON_WIDTH - 2*UNRELATED_CONTROLS - RELATED_CONTROLS, CONDITION_HEIGHT + 2*RELATED_CONTROLS + 1) ; - Size = MAP_APPFONT ( BUTTON_WIDTH , BUTTON_HEIGHT ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - - CancelButton PB_CANCEL - { - Pos = MAP_APPFONT ( CONDITION_WIDTH - 2*BUTTON_WIDTH - 2*UNRELATED_CONTROLS , CONDITION_HEIGHT + 2*RELATED_CONTROLS + 1) ; - Size = MAP_APPFONT ( BUTTON_WIDTH , BUTTON_HEIGHT ) ; - TabStop = TRUE ; - }; - - HelpButton PB_HELP - { - TabStop = TRUE ; - Pos = MAP_APPFONT ( CONDITION_WIDTH - BUTTON_WIDTH - UNRELATED_CONTROLS, CONDITION_HEIGHT + 2*RELATED_CONTROLS + 1) ; - Size = MAP_APPFONT ( BUTTON_WIDTH , BUTTON_HEIGHT ) ; - Text [ en-US ] = "~Help"; - }; - - ScrollBar SB_ALL_CONDITIONS - { - Pos = MAP_APPFONT ( CONDITION_WIDTH, RELATED_CONTROLS ) ; - Size = MAP_APPFONT ( SCROLLBAR_WIDTH, CONDITION_HEIGHT + RELATED_CONTROLS ) ; - }; -}; +#include "rptui_slotid.hrc" String STR_NUMBERED_CONDITION { diff --git a/reportdesign/source/ui/dlg/Condition.cxx b/reportdesign/source/ui/dlg/Condition.cxx index d41009d02d3a..b14867af2591 100644 --- a/reportdesign/source/ui/dlg/Condition.cxx +++ b/reportdesign/source/ui/dlg/Condition.cxx @@ -56,39 +56,19 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; -ConditionField::ConditionField( Condition* _pParent, const ResId& _rResId ) : Edit(_pParent,_rResId) -,m_pParent(_pParent) -,m_aFormula(this) +ConditionField::ConditionField(Condition* pParent, Edit* pSubEdit, PushButton *pFormula) + : m_pParent(pParent) + , m_pSubEdit(pSubEdit) + , m_pFormula(pFormula) { - m_pSubEdit = new Edit(this,0); - SetSubEdit(m_pSubEdit); m_pSubEdit->EnableRTL( false ); m_pSubEdit->SetPosPixel( Point() ); - m_aFormula.SetText(OUString("...")); - m_aFormula.SetClickHdl( LINK( this, ConditionField, OnFormula ) ); - m_aFormula.Show(); - m_pSubEdit->Show(); - Resize(); + m_pFormula->SetText(OUString("...")); + m_pFormula->SetClickHdl( LINK( this, ConditionField, OnFormula ) ); } -ConditionField::~ConditionField() -{ - SetSubEdit(NULL); - delete m_pSubEdit; -} - -void ConditionField::Resize() -{ - Edit::Resize(); - const Size aSize = GetOutputSizePixel(); - const Size aButtonSize( LogicToPixel( Size( 12, 0 ), MAP_APPFONT ).Width(),aSize.Height()); - const Point aButtonPos(aSize.Width() - aButtonSize.Width(), 0); - m_aFormula.SetPosSizePixel(aButtonPos,aButtonSize); - m_pSubEdit->SetPosSizePixel(Point(0,0),Size(aButtonPos.X() ,aSize.Height())); -} - -IMPL_LINK( ConditionField, OnFormula, Button*, /*_pClickedButton*/ ) +IMPL_LINK( ConditionField, OnFormula, Button*, _pClickedButton ) { OUString sFormula(m_pSubEdit->GetText()); const sal_Int32 nLen = sFormula.getLength(); @@ -97,7 +77,7 @@ IMPL_LINK( ConditionField, OnFormula, Button*, /*_pClickedButton*/ ) ReportFormula aFormula( sFormula ); sFormula = aFormula.getCompleteFormula(); } - uno::Reference< awt::XWindow> xInspectorWindow = VCLUnoHelper::GetInterface(this); + uno::Reference< awt::XWindow> xInspectorWindow = VCLUnoHelper::GetInterface(_pClickedButton); uno::Reference< beans::XPropertySet> xProp(m_pParent->getController().getRowSet(),uno::UNO_QUERY); if ( rptui::openDialogFormula_nothrow( sFormula, m_pParent->getController().getContext(),xInspectorWindow,xProp ) ) { @@ -108,7 +88,6 @@ IMPL_LINK( ConditionField, OnFormula, Button*, /*_pClickedButton*/ ) } // class SvxColorWindow_Impl -------------------------------------------------- - #ifndef WB_NO_DIRECTSELECT #define WB_NO_DIRECTSELECT ((WinBits)0x04000000) #endif @@ -227,21 +206,9 @@ IMPL_LINK_NOARG(OColorPopup, SelectHdl) Condition::Condition( Window* _pParent, IConditionalFormatAction& _rAction, ::rptui::OReportController& _rController ) - :Control(_pParent, ModuleRes(WIN_CONDITION)) + :VclHBox(_pParent) ,m_rController( _rController ) ,m_rAction( _rAction ) - ,m_aHeader(this, ModuleRes(FL_CONDITION_HEADER)) - ,m_aConditionType(this, ModuleRes(LB_COND_TYPE)) - ,m_aOperationList( this, ModuleRes(LB_OP)) - ,m_aCondLHS(this, ModuleRes(ED_CONDITION_LHS)) - ,m_aOperandGlue(this, ModuleRes(FT_AND)) - ,m_aCondRHS(this, ModuleRes(ED_CONDITION_RHS)) - ,m_aActions(this, ModuleRes(TB_FORMAT)) - ,m_aPreview(this, ModuleRes(CRTL_FORMAT_PREVIEW)) - ,m_aMoveUp( this, ModuleRes( BTN_MOVE_UP ) ) - ,m_aMoveDown( this, ModuleRes( BTN_MOVE_DOWN ) ) - ,m_aAddCondition( this, ModuleRes( BTN_ADD_CONDITION ) ) - ,m_aRemoveCondition( this, ModuleRes( BTN_REMOVE_CONDITION ) ) ,m_pColorFloat(NULL) ,m_pBtnUpdaterFontColor(NULL) ,m_pBtnUpdaterBackgroundColor(NULL) @@ -249,63 +216,86 @@ Condition::Condition( Window* _pParent, IConditionalFormatAction& _rAction, ::rp ,m_nLastKnownWindowWidth( -1 ) ,m_bInDestruction( false ) { - FreeResource(); - m_aActions.SetStyle(m_aActions.GetStyle()|WB_LINESPACING); - m_aCondLHS.GrabFocus(); + m_pUIBuilder = new VclBuilder(this, getUIRootDir(), "modules/dbreport/ui/conditionwin.ui"); - m_aConditionType.SetSelectHdl( LINK( this, Condition, OnTypeSelected ) ); + get(m_pHeader, "headerLabel"); + get(m_pConditionType, "typeCombobox"); + get(m_pOperationList, "opCombobox"); + m_pCondLHS = new ConditionField(this, get("lhsEntry"), get("lhsButton")); + get(m_pOperandGlue, "andLabel"); + m_pCondRHS = new ConditionField(this, get("rhsEntry"), get("rhsButton")); + get(m_pActions, "formatToolbox"); + get(m_pPreview, "previewDrawingarea"); + get(m_pMoveUp, "upButton"); + get(m_pMoveDown, "downButton"); + get(m_pAddCondition, "addButton"); + get(m_pRemoveCondition, "removeButton"); - m_aOperationList.SetDropDownLineCount( 10 ); - m_aOperationList.SetSelectHdl( LINK( this, Condition, OnOperationSelected ) ); + m_pActions->SetStyle(m_pActions->GetStyle()|WB_LINESPACING); + m_pCondLHS->GrabFocus(); - m_aActions.SetSelectHdl(LINK(this, Condition, OnFormatAction)); - m_aActions.SetDropdownClickHdl( LINK( this, Condition, DropdownClick ) ); - setToolBox(&m_aActions); + m_pConditionType->SetSelectHdl( LINK( this, Condition, OnTypeSelected ) ); - m_aMoveUp.SetClickHdl( LINK( this, Condition, OnConditionAction ) ); - m_aMoveDown.SetClickHdl( LINK( this, Condition, OnConditionAction ) ); - m_aAddCondition.SetClickHdl( LINK( this, Condition, OnConditionAction ) ); - m_aRemoveCondition.SetClickHdl( LINK( this, Condition, OnConditionAction ) ); + m_pOperationList->SetDropDownLineCount( 10 ); + m_pOperationList->SetSelectHdl( LINK( this, Condition, OnOperationSelected ) ); - m_aMoveUp.SetStyle( m_aMoveUp.GetStyle() | WB_NOPOINTERFOCUS ); - m_aMoveDown.SetStyle( m_aMoveDown.GetStyle() | WB_NOPOINTERFOCUS ); - m_aAddCondition.SetStyle( m_aMoveUp.GetStyle() | WB_NOPOINTERFOCUS | WB_CENTER | WB_VCENTER ); - m_aRemoveCondition.SetStyle( m_aMoveDown.GetStyle() | WB_NOPOINTERFOCUS | WB_CENTER | WB_VCENTER ); + m_pActions->SetSelectHdl(LINK(this, Condition, OnFormatAction)); + m_pActions->SetDropdownClickHdl( LINK( this, Condition, DropdownClick ) ); + setToolBox(m_pActions); - Font aFont( m_aAddCondition.GetFont() ); - aFont.SetWeight( WEIGHT_BOLD ); - m_aAddCondition.SetFont( aFont ); - m_aRemoveCondition.SetFont( aFont ); + m_pMoveUp->SetClickHdl( LINK( this, Condition, OnConditionAction ) ); + m_pMoveDown->SetClickHdl( LINK( this, Condition, OnConditionAction ) ); + m_pAddCondition->SetClickHdl( LINK( this, Condition, OnConditionAction ) ); + m_pRemoveCondition->SetClickHdl( LINK( this, Condition, OnConditionAction ) ); - m_aOperandGlue.SetStyle( m_aOperandGlue.GetStyle() | WB_VCENTER ); + m_pMoveUp->SetStyle( m_pMoveUp->GetStyle() | WB_NOPOINTERFOCUS ); + m_pMoveDown->SetStyle( m_pMoveDown->GetStyle() | WB_NOPOINTERFOCUS ); + m_pAddCondition->SetStyle( m_pAddCondition->GetStyle() | WB_NOPOINTERFOCUS ); + m_pRemoveCondition->SetStyle( m_pRemoveCondition->GetStyle() | WB_NOPOINTERFOCUS ); - m_aConditionType.SelectEntryPos( 0 ); - m_aOperationList.SelectEntryPos( 0 ); + Font aFont( m_pAddCondition->GetFont() ); + aFont.SetWeight( WEIGHT_BOLD ); + m_pAddCondition->SetFont( aFont ); + m_pRemoveCondition->SetFont( aFont ); - // the toolbar got its site automatically, ensure that the preview is positioned - // right of it - Size aRelatedControls( LogicToPixel( Size( RELATED_CONTROLS, 0 ), MAP_APPFONT ) ); - Point aToolbarPos( m_aActions.GetPosPixel() ); - Size aToolbarSize( m_aActions.GetSizePixel() ); - m_aPreview.setPosSizePixel( aToolbarPos.X() + aToolbarSize.Width() + 2 * aRelatedControls.Width(), - 0, 0, 0, WINDOW_POSSIZE_X ); + m_pOperandGlue->SetStyle( m_pOperandGlue->GetStyle() | WB_VCENTER ); - // ensure the toolbar is vertically centered, relative to the preview - Size aPreviewSize( m_aPreview.GetSizePixel() ); - m_aActions.setPosSizePixel( 0, aToolbarPos.Y() + ( aPreviewSize.Height() - aToolbarSize.Height() ) / 2, 0, 0, WINDOW_POSSIZE_Y ); + m_pConditionType->SelectEntryPos( 0 ); + m_pOperationList->SelectEntryPos( 0 ); + + m_nBoldId = m_pActions->GetItemId(".uno:Bold"); + m_nItalicId = m_pActions->GetItemId(".uno:Italic"); + m_nUnderLineId = m_pActions->GetItemId(".uno:Underline"); + m_nBackgroundColorId = m_pActions->GetItemId(".uno:BackgroundColor"); + m_nFontColorId = m_pActions->GetItemId(".uno:FontColor"); + m_nFontDialogId = m_pActions->GetItemId(".uno:FontDialog"); m_pBtnUpdaterBackgroundColor = new ::svx::ToolboxButtonColorUpdater( - SID_BACKGROUND_COLOR, SID_BACKGROUND_COLOR, &m_aActions ); + SID_BACKGROUND_COLOR, m_nBackgroundColorId, m_pActions ); m_pBtnUpdaterFontColor = new ::svx::ToolboxButtonColorUpdater( - SID_ATTR_CHAR_COLOR2, SID_ATTR_CHAR_COLOR2, &m_aActions ); + SID_ATTR_CHAR_COLOR2, m_nFontColorId, m_pActions ); Show(); - impl_layoutAll(); - ConditionalExpressionFactory::getKnownConditionalExpressions( m_aConditionalExpressions ); } +sal_uInt16 Condition::mapToolbarItemToSlotId(sal_uInt16 nItemId) const +{ + if (nItemId == m_nBoldId) + return SID_ATTR_CHAR_WEIGHT; + if (nItemId == m_nItalicId) + return SID_ATTR_CHAR_POSTURE; + if (nItemId == m_nUnderLineId) + return SID_ATTR_CHAR_UNDERLINE; + if (nItemId == m_nBackgroundColorId) + return SID_BACKGROUND_COLOR; + if (nItemId == m_nFontColorId) + return SID_ATTR_CHAR_COLOR2; + if (nItemId == m_nFontDialogId) + return SID_CHAR_DLG; + return 0; +} Condition::~Condition() { @@ -313,32 +303,31 @@ Condition::~Condition() delete m_pColorFloat; delete m_pBtnUpdaterFontColor; + delete m_pCondLHS; + delete m_pCondRHS; delete m_pBtnUpdaterBackgroundColor; } IMPL_LINK( Condition, DropdownClick, ToolBox*, /*pToolBar*/ ) { - sal_uInt16 nId( m_aActions.GetCurItemId() ); + sal_uInt16 nId( m_pActions->GetCurItemId() ); if ( !m_pColorFloat ) - m_pColorFloat = new OColorPopup(&m_aActions,this); + m_pColorFloat = new OColorPopup(m_pActions,this); sal_uInt16 nTextId = 0; - switch(nId) + if (nId == m_nFontColorId) { - case SID_ATTR_CHAR_COLOR2: - nTextId = STR_CHARCOLOR; - break; - case SID_BACKGROUND_COLOR: - nTextId = STR_CHARBACKGROUND; - break; - default: - break; + nTextId = STR_CHARCOLOR; + } + else if (nId == m_nBackgroundColorId) + { + nTextId = STR_CHARBACKGROUND; } if ( nTextId ) m_pColorFloat->SetText(OUString(ModuleRes(nTextId))); - m_pColorFloat->SetSlotId(nId); - m_pColorFloat->SetPosPixel(m_aActions.GetItemPopupPosition(nId,m_pColorFloat->GetSizePixel())); - m_pColorFloat->StartPopupMode(&m_aActions); + m_pColorFloat->SetSlotId(mapToolbarItemToSlotId(nId)); + m_pColorFloat->SetPosPixel(m_pActions->GetItemPopupPosition(nId,m_pColorFloat->GetSizePixel())); + m_pColorFloat->StartPopupMode(m_pActions); m_pColorFloat->StartSelection(); return 1; @@ -347,20 +336,19 @@ IMPL_LINK( Condition, DropdownClick, ToolBox*, /*pToolBar*/ ) IMPL_LINK( Condition, OnFormatAction, ToolBox*, /*NOTINTERESTEDIN*/ ) { Color aCol(COL_AUTO); - ApplyCommand(m_aActions.GetCurItemId(),aCol); + ApplyCommand(mapToolbarItemToSlotId(m_pActions->GetCurItemId()),aCol); return 0L; } - IMPL_LINK( Condition, OnConditionAction, Button*, _pClickedButton ) { - if ( _pClickedButton == &m_aMoveUp ) + if ( _pClickedButton == m_pMoveUp ) m_rAction.moveConditionUp( getConditionIndex() ); - else if ( _pClickedButton == &m_aMoveDown ) + else if ( _pClickedButton == m_pMoveDown ) m_rAction.moveConditionDown( getConditionIndex() ); - else if ( _pClickedButton == &m_aAddCondition ) + else if ( _pClickedButton == m_pAddCondition ) m_rAction.addCondition( getConditionIndex() ); - else if ( _pClickedButton == &m_aRemoveCondition ) + else if ( _pClickedButton == m_pRemoveCondition ) m_rAction.deleteCondition( getConditionIndex() ); return 0L; } @@ -375,137 +363,34 @@ void Condition::ApplyCommand( sal_uInt16 _nCommandId, const ::Color& _rColor) m_rAction.applyCommand( m_nCondIndex, _nCommandId, _rColor ); } -void Condition::setImageList(sal_Int16 _eBitmapSet) +void Condition::setImageList(sal_Int16 /*_eBitmapSet*/) { +#if 0 sal_Int16 nN = IMG_CONDFORMAT_DLG_SC; if ( _eBitmapSet == SFX_SYMBOLS_SIZE_LARGE ) nN = IMG_CONDFORMAT_DLG_LC; - m_aActions.SetImageList(ImageList(ModuleRes(nN))); + m_pActions->SetImageList(ImageList(ModuleRes(nN))); +#endif } -void Condition::resizeControls(const Size& _rDiff) +void Condition::resizeControls(const Size& /*_rDiff*/) { +#if 0 // we use large images so we must change them if ( _rDiff.Width() || _rDiff.Height() ) { Invalidate(); } +#endif } -void Condition::Paint( const Rectangle& rRect ) -{ - Control::Paint(rRect); - - // draw border - const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - ColorChanger aColors( this, rStyleSettings.GetShadowColor(), rStyleSettings.GetDialogColor() ); - DrawRect( impl_getToolBarBorderRect() ); -} - -void Condition::StateChanged( StateChangedType nType ) -{ - Control::StateChanged( nType ); - - if ( nType == STATE_CHANGE_CONTROLBACKGROUND ) - { - // Check if we need to get new images for normal/high contrast mode - checkImageList(); - } - else if ( nType == STATE_CHANGE_TEXT ) - { - // The physical toolbar changed its outlook and shows another logical toolbar! - // We have to set the correct high contrast mode on the new tbx manager. - checkImageList(); - } -} - -void Condition::DataChanged( const DataChangedEvent& rDCEvt ) -{ - Control::DataChanged( rDCEvt ); - - if ((( rDCEvt.GetType() == DATACHANGED_SETTINGS ) || - ( rDCEvt.GetType() == DATACHANGED_DISPLAY )) && - ( rDCEvt.GetFlags() & SETTINGS_STYLE )) - { - // Check if we need to get new images for normal/high contrast mode - checkImageList(); - } -} - - void Condition::GetFocus() { - Control::GetFocus(); + VclHBox::GetFocus(); if ( !m_bInDestruction ) - m_aCondLHS.GrabFocus(); -} - - -void Condition::Resize() -{ - Control::Resize(); - impl_layoutAll(); -} - - -Rectangle Condition::impl_getToolBarBorderRect() const -{ - const Point aToolbarPos( m_aActions.GetPosPixel() ); - const Size aToolbarSize( m_aActions.GetSizePixel() ); - const Size aRelatedControls = LogicToPixel( Size( RELATED_CONTROLS, RELATED_CONTROLS ), MAP_APPFONT ); - - Rectangle aBorderRect( aToolbarPos, aToolbarSize ); - aBorderRect.Left() -= aRelatedControls.Width(); - aBorderRect.Top() -= aRelatedControls.Height(); - aBorderRect.Right() += aRelatedControls.Width(); - aBorderRect.Bottom() += aRelatedControls.Height(); - - return aBorderRect; -} - - -void Condition::impl_layoutAll() -{ - // if our width changed, resize/-position some controls - const Size aSize( GetOutputSizePixel() ); - if ( aSize.Width() == m_nLastKnownWindowWidth ) - return; - - m_nLastKnownWindowWidth = aSize.Width(); - - const Size aRelatedControls( LogicToPixel( Size( RELATED_CONTROLS, RELATED_CONTROLS ), MAP_APPFONT ) ); - const Size aUnrelatedControls( LogicToPixel( Size( UNRELATED_CONTROLS, 0 ), MAP_APPFONT ) ); - const Point aRow1( LogicToPixel( Point( 0, ROW_1_POS ), MAP_APPFONT ) ); - const Point aRow3( LogicToPixel( Point( 0, ROW_3_POS ), MAP_APPFONT ) ); - - // resize the header line - m_aHeader.setPosSizePixel( 0, 0, aSize.Width() - 2 * aRelatedControls.Width(), 0, WINDOW_POSSIZE_WIDTH ); - - // position the up/down buttons - const Size aButtonSize( LogicToPixel( Size( IMAGE_BUTTON_WIDTH, IMAGE_BUTTON_HEIGHT ), MAP_APPFONT ) ); - Point aButtonPos( aSize.Width() - aUnrelatedControls.Width() - aButtonSize.Width(), aRow1.Y() ); - m_aMoveUp.setPosSizePixel( aButtonPos.X(), aButtonPos.Y(), aButtonSize.Width(), aButtonSize.Height() ); - aButtonPos.Move( 0, aButtonSize.Height() + aRelatedControls.Height() ); - m_aMoveDown.setPosSizePixel( aButtonPos.X(), aButtonPos.Y(), aButtonSize.Width(), aButtonSize.Height() ); - - // resize the preview - const long nNewPreviewRight = aButtonPos.X() - aRelatedControls.Width(); - - const Point aPreviewPos( m_aPreview.GetPosPixel() ); - OSL_ENSURE( aPreviewPos.X() < nNewPreviewRight, "Condition::impl_layoutAll: being *that* small should not be allowed!" ); - m_aPreview.setPosSizePixel( 0, 0, nNewPreviewRight - aPreviewPos.X(), 0, WINDOW_POSSIZE_WIDTH ); - - // position the add/remove buttons - aButtonPos = Point( nNewPreviewRight - aButtonSize.Width(), aRow3.Y() ); - m_aRemoveCondition.setPosSizePixel( aButtonPos.X(), aButtonPos.Y(), aButtonSize.Width(), aButtonSize.Height() ); - aButtonPos.Move( -( aButtonSize.Width() + aRelatedControls.Width() ), 0 ); - m_aAddCondition.setPosSizePixel( aButtonPos.X(), aButtonPos.Y(), aButtonSize.Width(), aButtonSize.Height() ); - - // layout the operands input controls - impl_layoutOperands(); + m_pCondLHS->GrabFocus(); } - IMPL_LINK( Condition, OnTypeSelected, ListBox*, /*_pNotInterestedIn*/ ) { impl_layoutOperands(); @@ -519,7 +404,6 @@ IMPL_LINK( Condition, OnOperationSelected, ListBox*, /*_pNotInterestedIn*/ ) return 0L; } - void Condition::impl_layoutOperands() { const ConditionType eType( impl_getCurrentConditionType() ); @@ -533,43 +417,12 @@ void Condition::impl_layoutOperands() ) ); - const Size aRelatedControls( LogicToPixel( Size( RELATED_CONTROLS, 0 ), MAP_APPFONT ) ); - const Rectangle aPreviewRect( m_aPreview.GetPosPixel(), m_aPreview.GetSizePixel() ); - // the "condition type" list box - const Rectangle aCondTypeRect( m_aConditionType.GetPosPixel(), m_aConditionType.GetSizePixel() ); - const Point aOpListPos( aCondTypeRect.Right() + aRelatedControls.Width(), aCondTypeRect.Top() ); - const Size aOpListSize( LogicToPixel( Size( COND_OP_WIDTH, 60 ), MAP_APPFONT ) ); - m_aOperationList.setPosSizePixel( aOpListPos.X(), aOpListPos.Y(),aOpListSize.Width(), aOpListSize.Height() ); - m_aOperationList.Show( !bIsExpression ); - - // the LHS input field - Point aLHSPos( aOpListPos.X() + aOpListSize.Width() + aRelatedControls.Width(), aOpListPos.Y() ); - if ( bIsExpression ) - aLHSPos.X() = aOpListPos.X(); - Size aLHSSize( LogicToPixel( Size( EDIT_WIDTH, EDIT_HEIGHT ), MAP_APPFONT ) ); - if ( !bHaveRHS ) - aLHSSize.Width() = aPreviewRect.Right() - aLHSPos.X(); - m_aCondLHS.setPosSizePixel( aLHSPos.X(), aLHSPos.Y(), aLHSSize.Width(), aLHSSize.Height() ); - - if ( bHaveRHS ) - { - // the "and" text being the glue between LHS and RHS - const Point aOpGluePos( aLHSPos.X() + aLHSSize.Width() + aRelatedControls.Width(), aLHSPos.Y() ); - const Size aOpGlueSize( m_aOperandGlue.GetTextWidth( m_aOperandGlue.GetText() ) + aRelatedControls.Width(), aLHSSize.Height() ); - m_aOperandGlue.setPosSizePixel( aOpGluePos.X(), aOpGluePos.Y(), aOpGlueSize.Width(), aOpGlueSize.Height() ); - - // the RHS input field - const Point aRHSPos( aOpGluePos.X() + aOpGlueSize.Width() + aRelatedControls.Width(), aOpGluePos.Y() ); - const Size aRHSSize( aPreviewRect.Right() - aRHSPos.X(), aLHSSize.Height() ); - m_aCondRHS.setPosSizePixel( aRHSPos.X(), aRHSPos.Y(), aRHSSize.Width(), aRHSSize.Height() ); - } - - m_aOperandGlue.Show( bHaveRHS ); - m_aCondRHS.Show( bHaveRHS ); + m_pOperationList->Show( !bIsExpression ); + m_pOperandGlue->Show( bHaveRHS ); + m_pCondRHS->Show( bHaveRHS ); } - void Condition::impl_setCondition( const OUString& _rConditionFormula ) { // determine the condition's type and comparison operation @@ -612,10 +465,10 @@ void Condition::impl_setCondition( const OUString& _rConditionFormula ) } // update UI - m_aConditionType.SelectEntryPos( (sal_uInt16)eType ); - m_aOperationList.SelectEntryPos( (sal_uInt16)eOperation ); - m_aCondLHS.SetText( sLHS ); - m_aCondRHS.SetText( sRHS ); + m_pConditionType->SelectEntryPos( (sal_uInt16)eType ); + m_pOperationList->SelectEntryPos( (sal_uInt16)eOperation ); + m_pCondLHS->SetText( sLHS ); + m_pCondRHS->SetText( sRHS ); // re-layout impl_layoutOperands(); @@ -648,11 +501,12 @@ void Condition::updateToolbar(const uno::Reference< report::XReportControlFormat OSL_ENSURE(_xReportControlFormat.is(),"XReportControlFormat is NULL!"); if ( _xReportControlFormat.is() ) { - sal_uInt16 nItemCount = m_aActions.GetItemCount(); + sal_uInt16 nItemCount = m_pActions->GetItemCount(); for (sal_uInt16 j = 0; j< nItemCount; ++j) { - sal_uInt16 nItemId = m_aActions.GetItemId(j); - m_aActions.CheckItem( nItemId, m_rController.isFormatCommandEnabled( nItemId, _xReportControlFormat ) ); + sal_uInt16 nItemId = m_pActions->GetItemId(j); + m_pActions->CheckItem( nItemId, m_rController.isFormatCommandEnabled(mapToolbarItemToSlotId(nItemId), + _xReportControlFormat ) ); } try @@ -663,9 +517,9 @@ void Condition::updateToolbar(const uno::Reference< report::XReportControlFormat aFont.SetEmphasisMark( static_cast< FontEmphasisMark >( _xReportControlFormat->getControlTextEmphasis() ) ); aFont.SetRelief( static_cast< FontRelief >( _xReportControlFormat->getCharRelief() ) ); aFont.SetColor( _xReportControlFormat->getCharColor() ); - m_aPreview.SetFont( aFont, aFont, aFont ); - m_aPreview.SetBackColor( _xReportControlFormat->getControlBackground() ); - m_aPreview.SetTextLineColor( Color( _xReportControlFormat->getCharUnderlineColor() ) ); + m_pPreview->SetFont( aFont, aFont, aFont ); + m_pPreview->SetBackColor( _xReportControlFormat->getControlBackground() ); + m_pPreview->SetTextLineColor( Color( _xReportControlFormat->getCharUnderlineColor() ) ); } catch( const Exception& ) { @@ -679,8 +533,8 @@ void Condition::fillFormatCondition(const uno::Reference< report::XFormatConditi const ConditionType eType( impl_getCurrentConditionType() ); const ComparisonOperation eOperation( impl_getCurrentComparisonOperation() ); - const OUString sLHS( m_aCondLHS.GetText() ); - const OUString sRHS( m_aCondRHS.GetText() ); + const OUString sLHS( m_pCondLHS->GetText() ); + const OUString sRHS( m_pCondRHS->GetText() ); OUString sUndecoratedFormula( sLHS ); @@ -702,17 +556,17 @@ void Condition::setConditionIndex( size_t _nCondIndex, size_t _nCondCount ) m_nCondIndex = _nCondIndex; OUString sHeader( ModuleRes( STR_NUMBERED_CONDITION ) ); sHeader = sHeader.replaceFirst( "$number$", OUString::number( _nCondIndex + 1) ); - m_aHeader.SetText( sHeader ); + m_pHeader->SetText( sHeader ); - m_aMoveUp.Enable( _nCondIndex > 0 ); + m_pMoveUp->Enable( _nCondIndex > 0 ); OSL_PRECOND( _nCondCount > 0, "Condition::setConditionIndex: having no conditions at all is nonsense!" ); - m_aMoveDown.Enable( _nCondIndex < _nCondCount - 1 ); + m_pMoveDown->Enable( _nCondIndex < _nCondCount - 1 ); } bool Condition::isEmpty() const { - return m_aCondLHS.GetText().isEmpty(); + return m_pCondLHS->GetText().isEmpty(); } diff --git a/reportdesign/source/ui/dlg/Condition.hxx b/reportdesign/source/ui/dlg/Condition.hxx index b28b43ab3537..7635082a22f5 100644 --- a/reportdesign/source/ui/dlg/Condition.hxx +++ b/reportdesign/source/ui/dlg/Condition.hxx @@ -33,6 +33,8 @@ #include #include #include +#include +#include #include @@ -45,39 +47,48 @@ namespace rptui class IConditionalFormatAction; class Condition; - class ConditionField : public Edit + class ConditionField { Condition* m_pParent; Edit* m_pSubEdit; - PushButton m_aFormula; + PushButton* m_pFormula; DECL_LINK( OnFormula, Button* ); public: - ConditionField( Condition* pParent, const ResId& rResId ); - virtual ~ConditionField(); - virtual void Resize() SAL_OVERRIDE; + ConditionField(Condition* pParent, Edit* pSubEdit, PushButton *pFormula); + void GrabFocus() { m_pSubEdit->GrabFocus(); } + void Show(bool bShow) { m_pSubEdit->Show(bShow); m_pFormula->Show(bShow); } + void SetText(const OUString& rText) { m_pSubEdit->SetText(rText); } + OUString GetText() const { return m_pSubEdit->GetText(); } }; - //= Condition - class Condition :public Control + class Condition :public VclHBox ,public dbaui::OToolBoxHelper + ,public VclBuilderContainer { + sal_uInt16 m_nBoldId; + sal_uInt16 m_nItalicId; + sal_uInt16 m_nUnderLineId; + sal_uInt16 m_nBackgroundColorId; + sal_uInt16 m_nFontColorId; + sal_uInt16 m_nFontDialogId; + ::rptui::OReportController& m_rController; IConditionalFormatAction& m_rAction; - FixedLine m_aHeader; - ListBox m_aConditionType; - ListBox m_aOperationList; - ConditionField m_aCondLHS; - FixedText m_aOperandGlue; - ConditionField m_aCondRHS; - ToolBox m_aActions; - SvxFontPrevWindow m_aPreview; - ImageButton m_aMoveUp; - ImageButton m_aMoveDown; - PushButton m_aAddCondition; - PushButton m_aRemoveCondition; + FixedText* m_pHeader; + ListBox* m_pConditionType; + ListBox* m_pOperationList; + ConditionField* m_pCondLHS; + FixedText* m_pOperandGlue; + ConditionField* m_pCondRHS; + ToolBox* m_pActions; + SvxFontPrevWindow* m_pPreview; + PushButton* m_pMoveUp; + PushButton* m_pMoveDown; + PushButton* m_pAddCondition; + PushButton* m_pRemoveCondition; OColorPopup* m_pColorFloat; ::svx::ToolboxButtonColorUpdater* m_pBtnUpdaterFontColor; // updates the color below the toolbar icon @@ -139,20 +150,14 @@ namespace rptui inline ::rptui::OReportController& getController() const { return m_rController; } + sal_uInt16 mapToolbarItemToSlotId(sal_uInt16 nItemId) const; + protected: - virtual void StateChanged( StateChangedType nStateChange ) SAL_OVERRIDE; - virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE; - virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE; - virtual void Resize() SAL_OVERRIDE; virtual void GetFocus() SAL_OVERRIDE; private: - void impl_layoutAll(); void impl_layoutOperands(); - /// determines the rectangle to be occupied by the toolbar, including the border drawn around it - Rectangle impl_getToolBarBorderRect() const; - inline ConditionType impl_getCurrentConditionType() const; @@ -169,13 +174,13 @@ namespace rptui inline ConditionType Condition::impl_getCurrentConditionType() const { - return sal::static_int_cast< ConditionType >( m_aConditionType.GetSelectEntryPos() ); + return sal::static_int_cast< ConditionType >( m_pConditionType->GetSelectEntryPos() ); } inline ComparisonOperation Condition::impl_getCurrentComparisonOperation() const { - return sal::static_int_cast< ComparisonOperation >( m_aOperationList.GetSelectEntryPos() ); + return sal::static_int_cast< ComparisonOperation >( m_pOperationList->GetSelectEntryPos() ); } diff --git a/reportdesign/source/ui/inc/CondFormat.hxx b/reportdesign/source/ui/inc/CondFormat.hxx index 86b3d3c6c381..6edee15d1b55 100644 --- a/reportdesign/source/ui/inc/CondFormat.hxx +++ b/reportdesign/source/ui/inc/CondFormat.hxx @@ -73,13 +73,9 @@ namespace rptui typedef ::std::vector< ConditionPtr > Conditions; OModuleClient m_aModuleClient; - Window m_aConditionPlayground; + Window* m_pConditionPlayground; Conditions m_aConditions; - FixedLine m_aSeparator; - OKButton m_aPB_OK; - CancelButton m_aPB_CANCEL; - HelpButton m_aPB_Help; - ScrollBar m_aCondScroll; + ScrollBar* m_pCondScroll; ::rptui::OReportController& m_rController; ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportControlModel > @@ -88,6 +84,7 @@ namespace rptui m_xCopy; bool m_bDeletingCondition; + bool m_bConstructed; public: ConditionalFormattingDialog( @@ -134,7 +131,7 @@ namespace rptui void impl_layoutAll(); /// does the layout for the condition windows - void impl_layoutConditions( Point& _out_rBelowLastVisible ); + void impl_layoutConditions(); /// called when the number of conditions has changed in any way void impl_conditionCountChanged(); @@ -154,9 +151,6 @@ namespace rptui /// returns the index of the last visible condition size_t impl_getLastVisibleConditionIndex() const; - /// determines the width of a Condition - long impl_getConditionWidth() const; - /// focuses the condition with the given index, making it visible if necessary void impl_focusCondition( size_t _nCondIndex ); @@ -171,6 +165,9 @@ namespace rptui /// ensures the condition with the given index is visible void impl_ensureConditionVisible( size_t _nCondIndex ); + + /// set the preferred height of the action_area + void impl_setPrefHeight(bool bFirst); }; diff --git a/reportdesign/uiconfig/dbreport/ui/condformatdialog.ui b/reportdesign/uiconfig/dbreport/ui/condformatdialog.ui new file mode 100644 index 000000000000..b6b57f4de2f9 --- /dev/null +++ b/reportdesign/uiconfig/dbreport/ui/condformatdialog.ui @@ -0,0 +1,131 @@ + + + + + + False + True + True + 6 + Conditional Formatting + dialog + + + False + True + True + vertical + 12 + + + False + end + + + gtk-ok + False + True + True + True + True + True + True + + + False + True + 0 + + + + + gtk-cancel + False + True + True + True + True + True + + + False + True + 1 + + + + + gtk-help + False + True + True + True + True + True + + + False + True + 2 + + + + + False + True + end + 0 + + + + + True + False + True + True + + + True + False + True + True + vertical + + + + + + False + True + 0 + + + + + True + False + True + vertical + + + False + True + 1 + + + + + False + True + 1 + + + + + + ok + cancel + help + + + diff --git a/reportdesign/uiconfig/dbreport/ui/conditionwin.ui b/reportdesign/uiconfig/dbreport/ui/conditionwin.ui new file mode 100644 index 000000000000..9c141ffdc11f --- /dev/null +++ b/reportdesign/uiconfig/dbreport/ui/conditionwin.ui @@ -0,0 +1,406 @@ + + + + + + + True + False + gtk-go-up + + + True + False + gtk-go-down + + + True + False + True + True + 6 + vertical + 6 + + + True + False + start + + + False + True + 0 + + + + + True + False + True + True + 6 + 12 + + + True + False + True + True + 12 + + + True + False + + Field Value Is + Expression Is + + + + False + True + 0 + + + + + True + False + + between + not between + equal to + not equal to + greater than + less than + greater than or equal to + less than or equal to + + + + False + True + 1 + + + + + True + False + center + 6 + + + True + True + + + 0 + 0 + 1 + 1 + + + + + ... + True + True + True + + + 1 + 0 + 1 + 1 + + + + + False + True + 2 + + + + + True + False + and + + + False + True + 4 + + + + + True + False + center + 6 + + + True + True + + + 0 + 0 + 1 + 1 + + + + + ... + True + True + True + + + 1 + 0 + 1 + 1 + + + + + False + True + 4 + + + + + 0 + 0 + 1 + 1 + + + + + True + True + True + image1 + + + 1 + 0 + 1 + 1 + + + + + True + False + True + True + 12 + + + True + False + start + start + icons + False + + + False + True + False + .uno:Bold + Bold + True + cmd/sc_bold.png + + + False + True + + + + + False + True + False + .uno:Italic + Italic + True + cmd/sc_italic.png + + + False + True + + + + + False + True + False + .uno:Underline + Underline + True + cmd/sc_underline.png + + + False + True + + + + + True + False + + + False + False + + + + + False + True + False + .uno:BackgroundColor + Background Color + True + cmd/sc_backgroundcolor.png + + + False + True + + + + + False + True + False + .uno:FontColor + Font Color + True + cmd/sc_fontcolor.png + + + False + True + + + + + False + True + False + .uno:FontDialog + Character Formatting + True + cmd/sc_fontdialog.png + + + False + True + + + + + False + True + 0 + + + + + True + False + True + + + False + True + 1 + + + + + 0 + 1 + 1 + 1 + + + + + True + True + True + start + image2 + + + 1 + 1 + 1 + 1 + + + + + False + True + 1 + + + + + True + False + end + 6 + + + - + True + True + True + + + 1 + 0 + 1 + 1 + + + + + + + True + True + True + end + + + 0 + 0 + 1 + 1 + + + + + False + True + 2 + + + + -- cgit v1.2.3