summaryrefslogtreecommitdiff
path: root/reportdesign
diff options
context:
space:
mode:
authorNorbert Thiebaud <nthiebaud@gmail.com>2016-11-05 13:28:17 -0500
committerNorbert Thiebaud <nthiebaud@gmail.com>2016-11-05 13:42:40 -0500
commitdb380aab1063e8a5e40111c40ee9f7921aa82601 (patch)
treef5057dfb205a7d7409251742888dfeaf4bfbee61 /reportdesign
parentee2144aafc5b4be14630f723be9a2bb674671412 (diff)
Reverts a commit series that cripple windows ci.
Revert "SvxShadowTabPage::Construct was removed" f9a2c1c12ecad833c63b894c89d6008907477eb5. Revert "replace OColorPopup with SvxColorWindow" f300754bb1c6a347c92bb9548be7a65237176542. Revert "drop AutoColorInvalid/SID_ATTR_AUTO_COLOR_INVALID" 347c2c334589b18cc62af292674bb3df1dd54b71. Revert "replace last ColorLB use with a listbox of colors" 604b35bf55351751a396e34dcca3f85e75860fd5. Revert "simplify, its just a vector of colors" 351a97ce6bda3075677b59fa1387ba3d1ab17d7a. Revert "replace user draw with an Image of the color" df738e0f8ceedb4bad756960be14d9c41adc165d. Revert "strip down to the used pieces" commit 08d6cd788f2584ce10ab8fa10665245e953c59d9. Revert "move now combined ColorLB to location of last user" a19b18ad7c9eb0197c10e6d7e451ec4542e4bc9e. Revert "fold ColorListBox and ColorLB together" a989a0b1f2b425f05b58d0e44ce2de31c842ed65. Revert "move ColorListBox beside sole thing that uses it" 760a198e697f3070a5e0e029e4eff7be220eb9cd. Revert "extensions leaks out details of Color Selector, patch it up" 8bea644d6117a49405e6426dc97214220fc869d1. Revert "inherit FillAttrLB from ListBox not ColorListBox" d2ce812f1d3a7a2aad89ca0bd11948b63d2db7b0. Revert "unify color selectors" 43bc3031483d172eccd72c3804e2d4fc2ef37de4.
Diffstat (limited to 'reportdesign')
-rw-r--r--reportdesign/inc/RptResId.hrc4
-rw-r--r--reportdesign/inc/helpids.hrc1
-rw-r--r--reportdesign/source/ui/dlg/CondFormat.src16
-rw-r--r--reportdesign/source/ui/dlg/Condition.cxx174
-rw-r--r--reportdesign/source/ui/dlg/Condition.hxx18
5 files changed, 166 insertions, 47 deletions
diff --git a/reportdesign/inc/RptResId.hrc b/reportdesign/inc/RptResId.hrc
index 38102f399e38..7e57bba1525a 100644
--- a/reportdesign/inc/RptResId.hrc
+++ b/reportdesign/inc/RptResId.hrc
@@ -108,6 +108,10 @@
#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 aaa488316fe4..ed179679859c 100644
--- a/reportdesign/inc/helpids.hrc
+++ b/reportdesign/inc/helpids.hrc
@@ -31,6 +31,7 @@
#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 ecf70cae59fd..e8f16c42975c 100644
--- a/reportdesign/source/ui/dlg/CondFormat.src
+++ b/reportdesign/source/ui/dlg/CondFormat.src
@@ -24,5 +24,21 @@ 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 4632306d7b5e..3a216d81ea84 100644
--- a/reportdesign/source/ui/dlg/Condition.cxx
+++ b/reportdesign/source/ui/dlg/Condition.cxx
@@ -84,34 +84,144 @@ IMPL_LINK( ConditionField, OnFormula, Button*, _pClickedButton, void )
}
}
-ConditionColorWrapper::ConditionColorWrapper(Condition* pControl)
- : mxControl(pControl)
- , mnSlotId(0)
+// 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
{
+ 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 ConditionColorWrapper::dispose()
+void OColorPopup::Resize()
{
- mxControl.clear();
+ Size aSize = GetOutputSizePixel();
+ aSize.Width() -= 4;
+ aSize.Height() -= 4;
+ m_aColorSet->SetPosSizePixel( Point(2,2), aSize );
}
-void ConditionColorWrapper::operator()(const OUString& /*rCommand*/, const NamedColor& rNamedColor)
+void OColorPopup::StartSelection()
{
- mxControl->ApplyCommand(mnSlotId, rNamedColor.first);
+ m_aColorSet->StartSelection();
}
+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_aColorWrapper(this)
- , m_rController(_rController)
- , m_rAction(_rAction)
- , m_pBtnUpdaterFontColor(nullptr)
- , m_pBtnUpdaterBackgroundColor(nullptr)
- , m_nCondIndex(0)
- , m_bInDestruction(false)
+ :VclHBox(_pParent)
+ ,m_rController( _rController )
+ ,m_rAction( _rAction )
+ ,m_pColorFloat(nullptr)
+ ,m_pBtnUpdaterFontColor(nullptr)
+ ,m_pBtnUpdaterBackgroundColor(nullptr)
+ ,m_nCondIndex( 0 )
+ ,m_bInDestruction( false )
{
m_pUIBuilder = new VclBuilder(this, getUIRootDir(), "modules/dbreport/ui/conditionwin.ui");
@@ -218,27 +328,31 @@ void Condition::dispose()
m_pAddCondition.clear();
m_pRemoveCondition.clear();
m_pColorFloat.disposeAndClear();
- m_aColorWrapper.dispose();
disposeBuilder();
VclHBox::dispose();
}
-IMPL_LINK(Condition, DropdownClick, ToolBox*, pToolBox, void)
+IMPL_LINK_NOARG( Condition, DropdownClick, ToolBox*, void )
{
sal_uInt16 nId( m_pActions->GetCurItemId() );
- 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);
+ 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();
}
IMPL_LINK_NOARG( Condition, OnFormatAction, ToolBox*, void )
diff --git a/reportdesign/source/ui/dlg/Condition.hxx b/reportdesign/source/ui/dlg/Condition.hxx
index 6a6d64e19b9e..ab5194ade94c 100644
--- a/reportdesign/source/ui/dlg/Condition.hxx
+++ b/reportdesign/source/ui/dlg/Condition.hxx
@@ -26,7 +26,6 @@
#include <dbaccess/ToolBoxHelper.hxx>
-#include <svx/colorwindow.hxx>
#include <svx/fntctrl.hxx>
#include <vcl/fixed.hxx>
@@ -63,18 +62,6 @@ 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
@@ -87,9 +74,6 @@ 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;
@@ -105,7 +89,7 @@ namespace rptui
VclPtr<PushButton> m_pMoveDown;
VclPtr<PushButton> m_pAddCondition;
VclPtr<PushButton> m_pRemoveCondition;
- VclPtr<SvxColorWindow> m_pColorFloat;
+ VclPtr<OColorPopup> m_pColorFloat;
svx::ToolboxButtonColorUpdater* m_pBtnUpdaterFontColor; // updates the color below the toolbar icon
svx::ToolboxButtonColorUpdater* m_pBtnUpdaterBackgroundColor;