diff options
author | Caolán McNamara <caolanm@redhat.com> | 2016-11-05 20:28:27 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2016-11-07 21:04:50 +0000 |
commit | 64a708cba9b954afe3331f63c58218eb53b3d0ce (patch) | |
tree | ddc1bea3b63f32a1c6d377c1d1dd7aee0803fb70 /reportdesign | |
parent | f01c49c4a89ecad2376fd0023625186e5cac642e (diff) |
Revert "Reverts a commit series that cripple windows ci."
with addition of...
- svxlo-SvxColorListBox
+ svxcorelo-SvxColorListBox
This reverts commit db380aab1063e8a5e40111c40ee9f7921aa82601.
Change-Id: I3af7aa0abb1a430bce64188244404fcbd480b128
Reviewed-on: https://gerrit.libreoffice.org/30598
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'reportdesign')
-rw-r--r-- | reportdesign/inc/RptResId.hrc | 4 | ||||
-rw-r--r-- | reportdesign/inc/helpids.hrc | 1 | ||||
-rw-r--r-- | reportdesign/source/ui/dlg/CondFormat.src | 16 | ||||
-rw-r--r-- | reportdesign/source/ui/dlg/Condition.cxx | 174 | ||||
-rw-r--r-- | reportdesign/source/ui/dlg/Condition.hxx | 18 |
5 files changed, 47 insertions, 166 deletions
diff --git a/reportdesign/inc/RptResId.hrc b/reportdesign/inc/RptResId.hrc index 7e57bba1525a..38102f399e38 100644 --- a/reportdesign/inc/RptResId.hrc +++ b/reportdesign/inc/RptResId.hrc @@ -108,10 +108,6 @@ #define STR_SHOW_RULER ( RID_STRING_START + 63 ) #define STR_SHOW_GRID ( RID_STRING_START + 64 ) -#define STR_COLOR_WHITE ( RID_STRING_START + 65 ) -#define STR_CHARCOLOR ( RID_STRING_START + 66 ) -#define STR_CHARBACKGROUND ( RID_STRING_START + 67 ) -#define STR_TRANSPARENT ( RID_STRING_START + 68 ) #define RID_STR_FIELDSELECTION ( RID_STRING_START + 69 ) #define RID_STR_UNDO_ADD_GROUP_HEADER ( RID_STRING_START + 70 ) diff --git a/reportdesign/inc/helpids.hrc b/reportdesign/inc/helpids.hrc index ed179679859c..aaa488316fe4 100644 --- a/reportdesign/inc/helpids.hrc +++ b/reportdesign/inc/helpids.hrc @@ -31,7 +31,6 @@ #define HID_RPT_HORZ_SCROLLBAR "REPORTDESIGN_HID_RPT_HORZ_SCROLLBAR" #define HID_RPT_VERT_SCROLLBAR "REPORTDESIGN_HID_RPT_VERT_SCROLLBAR" #define HID_RPT_FIELDEXPRESSION "REPORTDESIGN_HID_RPT_FIELDEXPRESSION" -#define HID_RPT_POPUP_COLOR_CTRL "REPORTDESIGN_HID_RPT_POPUP_COLOR_CTRL" #define HID_RPT_POPUP_COLOR "REPORTDESIGN_HID_RPT_POPUP_COLOR" #define HID_RPT_FIELD_SEL "REPORTDESIGN_HID_RPT_FIELD_SEL" #define HID_RPT_FIELD_SEL_WIN "REPORTDESIGN_HID_RPT_FIELD_SEL_WIN" diff --git a/reportdesign/source/ui/dlg/CondFormat.src b/reportdesign/source/ui/dlg/CondFormat.src index e8f16c42975c..ecf70cae59fd 100644 --- a/reportdesign/source/ui/dlg/CondFormat.src +++ b/reportdesign/source/ui/dlg/CondFormat.src @@ -24,21 +24,5 @@ String STR_NUMBERED_CONDITION { Text [ en-US ] = "Condition $number$"; }; -String STR_COLOR_WHITE -{ - Text [ en-US ] = "White" ; -}; -String STR_CHARCOLOR -{ - Text [ en-US ] = "Font color" ; -}; -String STR_CHARBACKGROUND -{ - Text [ en-US ] = "Background"; -}; -String STR_TRANSPARENT -{ - Text [ en-US ] = "No Fill" ; -}; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/ui/dlg/Condition.cxx b/reportdesign/source/ui/dlg/Condition.cxx index 3a216d81ea84..4632306d7b5e 100644 --- a/reportdesign/source/ui/dlg/Condition.cxx +++ b/reportdesign/source/ui/dlg/Condition.cxx @@ -84,144 +84,34 @@ IMPL_LINK( ConditionField, OnFormula, Button*, _pClickedButton, void ) } } -// TO-DO, this is yet another color selector, can it be replaced with SvxColorWindor/SvxColorToolBoxControl ? -#ifndef WB_NO_DIRECTSELECT -#define WB_NO_DIRECTSELECT ((WinBits)0x04000000) -#endif - -#define PALETTE_X 10 -#define PALETTE_Y 10 -#define PALETTE_SIZE (PALETTE_X * PALETTE_Y) -class OColorPopup : public FloatingWindow +ConditionColorWrapper::ConditionColorWrapper(Condition* pControl) + : mxControl(pControl) + , mnSlotId(0) { - DECL_LINK( SelectHdl, ValueSet*, void ); - VclPtr<Condition> m_pCondition; - sal_uInt16 m_nSlotId; -public: - OColorPopup(vcl::Window* _pParent,Condition* _pCondition); - virtual ~OColorPopup() override; - virtual void dispose() override; - VclPtr<ValueSet> m_aColorSet; - - virtual void KeyInput( const KeyEvent& rKEvt ) override; - virtual void Resize() override; - - void StartSelection(); - void SetSlotId(sal_uInt16 _nSlotId); -}; - -OColorPopup::OColorPopup(vcl::Window* _pParent,Condition* _pCondition) -:FloatingWindow(_pParent, WinBits( WB_BORDER | WB_STDFLOATWIN | WB_3DLOOK|WB_DIALOGCONTROL )) -,m_pCondition(_pCondition) -,m_nSlotId(0) -,m_aColorSet( VclPtr<ValueSet>::Create(this, WinBits( WB_ITEMBORDER | WB_NAMEFIELD | WB_3DLOOK | WB_NO_DIRECTSELECT)) ) -{ - m_aColorSet->SetHelpId( HID_RPT_POPUP_COLOR_CTRL ); - SetHelpId( HID_RPT_POPUP_COLOR ); - const Size aSize12( 13, 13 ); - short i = 0; - XColorListRef pColorList( XColorList::CreateStdColorList() ); - long nCount = pColorList->Count(); - Color aColWhite( COL_WHITE ); - OUString aStrWhite( ModuleRes(STR_COLOR_WHITE) ); - - if ( nCount > PALETTE_SIZE ) - // Show scrollbar if more than PALLETTE_SIZE colors are available - m_aColorSet->SetStyle( m_aColorSet->GetStyle() | WB_VSCROLL ); - - for ( i = 0; i < nCount; i++ ) - { - const XColorEntry* pEntry = pColorList->GetColor(i); - m_aColorSet->InsertItem( i+1, pEntry->GetColor(), pEntry->GetName() ); - } - - while ( i < PALETTE_SIZE ) - { - // fill empty elements if less then PALLETTE_SIZE colors are available - m_aColorSet->InsertItem( i+1, aColWhite, aStrWhite ); - i++; - } - - m_aColorSet->SetSelectHdl( LINK( this, OColorPopup, SelectHdl ) ); - m_aColorSet->SetColCount( PALETTE_X ); - m_aColorSet->SetLineCount( PALETTE_Y ); - Size aSize = m_aColorSet->CalcWindowSizePixel( aSize12 ); - aSize.Width() += 4; - aSize.Height() += 4; - SetOutputSizePixel( aSize ); - m_aColorSet->Show(); -} - -OColorPopup::~OColorPopup() -{ - disposeOnce(); -} - -void OColorPopup::dispose() -{ - disposeBuilder(); - m_aColorSet.disposeAndClear(); - m_pCondition.clear(); - FloatingWindow::dispose(); -} - -void OColorPopup::KeyInput( const KeyEvent& rKEvt ) -{ - m_aColorSet->KeyInput(rKEvt); } -void OColorPopup::Resize() +void ConditionColorWrapper::dispose() { - Size aSize = GetOutputSizePixel(); - aSize.Width() -= 4; - aSize.Height() -= 4; - m_aColorSet->SetPosSizePixel( Point(2,2), aSize ); + mxControl.clear(); } -void OColorPopup::StartSelection() +void ConditionColorWrapper::operator()(const OUString& /*rCommand*/, const NamedColor& rNamedColor) { - m_aColorSet->StartSelection(); + mxControl->ApplyCommand(mnSlotId, rNamedColor.first); } -void OColorPopup::SetSlotId(sal_uInt16 _nSlotId) -{ - m_nSlotId = _nSlotId; - if ( SID_ATTR_CHAR_COLOR_BACKGROUND == _nSlotId || SID_BACKGROUND_COLOR == _nSlotId ) - { - m_aColorSet->SetStyle( m_aColorSet->GetStyle() | WB_NONEFIELD ); - m_aColorSet->SetText( OUString(ModuleRes( STR_TRANSPARENT )) ); - } -} - -IMPL_LINK_NOARG(OColorPopup, SelectHdl, ValueSet*, void) -{ - sal_uInt16 nItemId = m_aColorSet->GetSelectItemId(); - Color aColor( nItemId == 0 ? Color( COL_TRANSPARENT ) : m_aColorSet->GetItemColor( nItemId ) ); - - /* #i33380# Moved the following line above the Dispatch() calls. - This instance may be deleted in the meantime (i.e. when a dialog is opened - while in Dispatch()), accessing members will crash in this case. */ - m_aColorSet->SetNoSelection(); - - if ( IsInPopupMode() ) - EndPopupMode(); - - m_pCondition->ApplyCommand( m_nSlotId, aColor ); -} - - // = Condition Condition::Condition( vcl::Window* _pParent, IConditionalFormatAction& _rAction, ::rptui::OReportController& _rController ) - :VclHBox(_pParent) - ,m_rController( _rController ) - ,m_rAction( _rAction ) - ,m_pColorFloat(nullptr) - ,m_pBtnUpdaterFontColor(nullptr) - ,m_pBtnUpdaterBackgroundColor(nullptr) - ,m_nCondIndex( 0 ) - ,m_bInDestruction( false ) + : VclHBox(_pParent) + , m_aColorWrapper(this) + , m_rController(_rController) + , m_rAction(_rAction) + , m_pBtnUpdaterFontColor(nullptr) + , m_pBtnUpdaterBackgroundColor(nullptr) + , m_nCondIndex(0) + , m_bInDestruction(false) { m_pUIBuilder = new VclBuilder(this, getUIRootDir(), "modules/dbreport/ui/conditionwin.ui"); @@ -328,31 +218,27 @@ void Condition::dispose() m_pAddCondition.clear(); m_pRemoveCondition.clear(); m_pColorFloat.disposeAndClear(); + m_aColorWrapper.dispose(); disposeBuilder(); VclHBox::dispose(); } -IMPL_LINK_NOARG( Condition, DropdownClick, ToolBox*, void ) +IMPL_LINK(Condition, DropdownClick, ToolBox*, pToolBox, void) { sal_uInt16 nId( m_pActions->GetCurItemId() ); - if ( !m_pColorFloat ) - m_pColorFloat = VclPtr<OColorPopup>::Create(m_pActions,this); - - sal_uInt16 nTextId = 0; - if (nId == m_nFontColorId) - { - nTextId = STR_CHARCOLOR; - } - else if (nId == m_nBackgroundColorId) - { - nTextId = STR_CHARBACKGROUND; - } - if ( nTextId ) - m_pColorFloat->SetText(OUString(ModuleRes(nTextId))); - m_pColorFloat->SetSlotId(mapToolbarItemToSlotId(nId)); - m_pColorFloat->SetPosPixel(m_pActions->GetItemPopupPosition(nId,m_pColorFloat->GetSizePixel())); - m_pColorFloat->StartPopupMode(m_pActions); - m_pColorFloat->StartSelection(); + m_pColorFloat.disposeAndClear(); + sal_uInt16 nSlotId(mapToolbarItemToSlotId(nId)); + m_aColorWrapper.SetSlotId(nSlotId); + m_pColorFloat = VclPtr<SvxColorWindow>::Create( + OUString() /*m_aCommandURL*/, + m_aPaletteManager, + m_aBorderColorStatus, + nSlotId, + nullptr, + pToolBox, + m_aColorWrapper); + + m_pColorFloat->StartPopupMode(pToolBox, FloatWinPopupFlags::GrabFocus); } IMPL_LINK_NOARG( Condition, OnFormatAction, ToolBox*, void ) diff --git a/reportdesign/source/ui/dlg/Condition.hxx b/reportdesign/source/ui/dlg/Condition.hxx index ab5194ade94c..6a6d64e19b9e 100644 --- a/reportdesign/source/ui/dlg/Condition.hxx +++ b/reportdesign/source/ui/dlg/Condition.hxx @@ -26,6 +26,7 @@ #include <dbaccess/ToolBoxHelper.hxx> +#include <svx/colorwindow.hxx> #include <svx/fntctrl.hxx> #include <vcl/fixed.hxx> @@ -62,6 +63,18 @@ namespace rptui OUString GetText() const { return m_pSubEdit->GetText(); } }; + class ConditionColorWrapper + { + public: + ConditionColorWrapper(Condition* pControl); + void SetSlotId(sal_uInt16 nSlotId) { mnSlotId = nSlotId; } + void operator()(const OUString& rCommand, const NamedColor& rColor); + void dispose(); + private: + VclPtr<Condition> mxControl; + sal_uInt16 mnSlotId; + }; + //= Condition class Condition :public VclHBox @@ -74,6 +87,9 @@ namespace rptui sal_uInt16 m_nBackgroundColorId; sal_uInt16 m_nFontColorId; sal_uInt16 m_nFontDialogId; + PaletteManager m_aPaletteManager; + BorderColorStatus m_aBorderColorStatus; + ConditionColorWrapper m_aColorWrapper; ::rptui::OReportController& m_rController; IConditionalFormatAction& m_rAction; @@ -89,7 +105,7 @@ namespace rptui VclPtr<PushButton> m_pMoveDown; VclPtr<PushButton> m_pAddCondition; VclPtr<PushButton> m_pRemoveCondition; - VclPtr<OColorPopup> m_pColorFloat; + VclPtr<SvxColorWindow> m_pColorFloat; svx::ToolboxButtonColorUpdater* m_pBtnUpdaterFontColor; // updates the color below the toolbar icon svx::ToolboxButtonColorUpdater* m_pBtnUpdaterBackgroundColor; |