From 64a708cba9b954afe3331f63c58218eb53b3d0ce Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Sat, 5 Nov 2016 20:28:27 +0000 Subject: Revert "Reverts a commit series that cripple windows ci." MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit with addition of... - svxlo-SvxColorListBox + svxcorelo-SvxColorListBox This reverts commit db380aab1063e8a5e40111c40ee9f7921aa82601. Change-Id: I3af7aa0abb1a430bce64188244404fcbd480b128 Reviewed-on: https://gerrit.libreoffice.org/30598 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- chart2/source/controller/dialogs/dlg_View3D.cxx | 4 +- .../controller/dialogs/tp_3D_SceneIllumination.cxx | 30 +- .../controller/dialogs/tp_3D_SceneIllumination.hxx | 11 +- chart2/source/controller/inc/dlg_View3D.hxx | 3 +- .../controller/main/ChartController_Properties.cxx | 2 +- .../controller/sidebar/ChartColorWrapper.cxx | 4 +- .../controller/sidebar/ChartColorWrapper.hxx | 3 +- chart2/uiconfig/ui/tp_3D_SceneIllumination.ui | 4 +- cui/source/inc/border.hxx | 7 +- cui/source/inc/chardlg.hxx | 11 +- cui/source/inc/cuires.hrc | 1 - cui/source/inc/cuitabarea.hxx | 24 +- cui/source/inc/cuitabline.hxx | 5 +- cui/source/inc/numpages.hxx | 6 +- cui/source/options/optchart.cxx | 107 +++++- cui/source/options/optchart.hxx | 15 +- cui/source/options/optcolor.cxx | 93 ++--- cui/source/tabpages/backgrnd.cxx | 2 +- cui/source/tabpages/border.cxx | 58 +-- cui/source/tabpages/borderconn.cxx | 13 +- cui/source/tabpages/borderconn.hxx | 4 +- cui/source/tabpages/chardlg.cxx | 166 ++------- cui/source/tabpages/numpages.cxx | 32 +- cui/source/tabpages/strings.src | 4 - cui/source/tabpages/tabarea.cxx | 1 - cui/source/tabpages/tabline.cxx | 1 - cui/source/tabpages/tpgradnt.cxx | 56 +-- cui/source/tabpages/tphatch.cxx | 55 +-- cui/source/tabpages/tpline.cxx | 30 +- cui/source/tabpages/tppattern.cxx | 58 +-- cui/source/tabpages/tpshadow.cxx | 36 +- cui/uiconfig/ui/borderpage.ui | 4 +- cui/uiconfig/ui/colorconfigwin.ui | 92 ++--- cui/uiconfig/ui/effectspage.ui | 6 +- cui/uiconfig/ui/gradientpage.ui | 4 +- cui/uiconfig/ui/hatchpage.ui | 4 +- cui/uiconfig/ui/linetabpage.ui | 2 +- cui/uiconfig/ui/numberingoptionspage.ui | 2 +- cui/uiconfig/ui/optchartcolorspage.ui | 3 +- cui/uiconfig/ui/patterntabpage.ui | 4 +- cui/uiconfig/ui/shadowtabpage.ui | 2 +- extensions/source/propctrlr/commoncontrol.cxx | 5 + extensions/source/propctrlr/commoncontrol.hxx | 19 +- extensions/source/propctrlr/standardcontrol.cxx | 109 +----- extensions/source/propctrlr/standardcontrol.hxx | 24 +- extras/source/glade/libreoffice-catalog.xml.in | 22 +- include/sfx2/controlwrapper.hxx | 22 +- include/svtools/ctrlbox.hxx | 82 ---- include/svtools/svtools.hrc | 2 - include/svx/PaletteManager.hxx | 11 +- include/svx/bmpmask.hxx | 15 +- include/svx/colorbox.hxx | 94 +++++ include/svx/colorwindow.hxx | 48 ++- include/svx/dialogs.hrc | 7 +- include/svx/dlgctrl.hxx | 16 +- include/svx/float3d.hxx | 34 +- include/svx/fontwork.hxx | 9 +- include/svx/sidebar/AreaPropertyPanelBase.hxx | 6 +- include/svx/svxids.hrc | 6 +- include/svx/tbcontrl.hxx | 16 +- reportdesign/inc/RptResId.hrc | 4 - reportdesign/inc/helpids.hrc | 1 - reportdesign/source/ui/dlg/CondFormat.src | 16 - reportdesign/source/ui/dlg/Condition.cxx | 174 ++------- reportdesign/source/ui/dlg/Condition.hxx | 18 +- sc/inc/sc.hrc | 2 +- sc/source/ui/condformat/colorformat.cxx | 57 +-- sc/source/ui/condformat/condformatdlgentry.cxx | 79 +--- sc/source/ui/dbgui/scendlg.cxx | 22 +- sc/source/ui/drawfunc/drawsh4.cxx | 25 -- sc/source/ui/drawfunc/drtxtob2.cxx | 25 -- sc/source/ui/inc/colorformat.hxx | 8 +- sc/source/ui/inc/condformatdlgentry.hxx | 11 +- sc/source/ui/inc/opredlin.hxx | 9 +- sc/source/ui/inc/scendlg.hxx | 4 +- sc/source/ui/inc/tpview.hxx | 3 +- sc/source/ui/optdlg/opredlin.cxx | 114 ++---- sc/source/ui/optdlg/tpview.cxx | 59 +-- sc/source/ui/src/scstring.src | 5 - sc/uiconfig/scalc/ui/conditionalentry.ui | 6 +- sc/uiconfig/scalc/ui/databaroptions.ui | 17 +- sc/uiconfig/scalc/ui/optchangespage.ui | 8 +- sc/uiconfig/scalc/ui/scenariodialog.ui | 2 +- sc/uiconfig/scalc/ui/tpviewpage.ui | 2 +- sd/inc/sdabstdlg.hxx | 2 +- sd/qa/unit/dialogs-test.cxx | 6 - sd/source/ui/animations/CustomAnimationDialog.cxx | 82 +--- sd/source/ui/dlg/copydlg.cxx | 35 +- sd/source/ui/dlg/sddlgfact.cxx | 3 +- sd/source/ui/dlg/sddlgfact.hxx | 2 +- sd/source/ui/func/fucopy.cxx | 2 +- sd/source/ui/inc/copydlg.hxx | 12 +- sd/source/ui/sidebar/SlideBackground.cxx | 36 +- sd/source/ui/sidebar/SlideBackground.hxx | 8 +- sd/source/ui/view/drviews6.cxx | 21 -- sd/source/ui/view/drviewsi.cxx | 2 +- sd/uiconfig/sdraw/ui/copydlg.ui | 4 +- .../simpress/ui/customanimationeffecttab.ui | 2 +- sd/uiconfig/simpress/ui/sidebarslidebackground.ui | 4 +- sfx2/source/dialog/itemconnect.cxx | 28 -- svtools/source/control/ctrlbox.cxx | 224 ----------- svtools/source/control/ctrlbox.src | 5 - svx/sdi/svx.sdi | 19 - svx/source/dialog/_bmpmask.cxx | 56 +-- svx/source/dialog/bmpmask.hrc | 2 +- svx/source/dialog/bmpmask.src | 5 - svx/source/dialog/dlgctrl.cxx | 48 +-- svx/source/dialog/fontwork.cxx | 13 +- svx/source/engine3d/float3d.cxx | 191 +++++----- svx/source/engine3d/float3d.src | 15 - svx/source/sidebar/area/AreaPropertyPanelBase.cxx | 97 ++--- svx/source/sidebar/shadow/ShadowPropertyPanel.cxx | 37 +- svx/source/sidebar/shadow/ShadowPropertyPanel.hxx | 11 +- svx/source/tbxctrls/PaletteManager.cxx | 23 +- svx/source/tbxctrls/tbcontrl.cxx | 411 ++++++++++++++++++--- svx/source/tbxctrls/tbcontrl.src | 12 +- svx/uiconfig/ui/colorwindow.ui | 50 ++- svx/uiconfig/ui/docking3deffects.ui | 24 +- svx/uiconfig/ui/dockingcolorreplace.ui | 10 +- svx/uiconfig/ui/dockingfontwork.ui | 2 +- svx/uiconfig/ui/sidebararea.ui | 4 +- svx/uiconfig/ui/sidebarshadow.ui | 2 +- sw/inc/authratr.hxx | 2 - sw/source/core/access/accpara.cxx | 1 + sw/source/ui/config/optpage.cxx | 240 ++++-------- sw/source/ui/frmdlg/column.cxx | 42 +-- sw/source/ui/misc/pgfnote.cxx | 42 +-- sw/source/ui/misc/pggrid.cxx | 30 +- sw/source/uibase/app/swmodul1.cxx | 1 + sw/source/uibase/inc/column.hxx | 4 +- sw/source/uibase/inc/optpage.hxx | 16 +- sw/source/uibase/inc/pgfnote.hxx | 5 +- sw/source/uibase/inc/pggrid.hxx | 7 +- sw/source/uibase/shells/drawsh.cxx | 13 - sw/source/uibase/shells/drwtxtsh.cxx | 13 - sw/source/uibase/sidebar/PageStylesPanel.cxx | 62 ++-- sw/source/uibase/sidebar/PageStylesPanel.hxx | 8 +- sw/uiconfig/swriter/ui/columnpage.ui | 2 +- sw/uiconfig/swriter/ui/footnoteareapage.ui | 2 +- sw/uiconfig/swriter/ui/optredlinepage.ui | 20 +- sw/uiconfig/swriter/ui/pagestylespanel.ui | 4 +- sw/uiconfig/swriter/ui/textgridpage.ui | 2 +- 142 files changed, 1488 insertions(+), 2725 deletions(-) create mode 100644 include/svx/colorbox.hxx diff --git a/chart2/source/controller/dialogs/dlg_View3D.cxx b/chart2/source/controller/dialogs/dlg_View3D.cxx index eb0150b1ad7a..7cfd50f41fd1 100644 --- a/chart2/source/controller/dialogs/dlg_View3D.cxx +++ b/chart2/source/controller/dialogs/dlg_View3D.cxx @@ -39,7 +39,7 @@ using namespace ::com::sun::star::chart2; sal_uInt16 View3DDialog::m_nLastPageId = 0; -View3DDialog::View3DDialog(vcl::Window* pParent, const uno::Reference< frame::XModel > & xChartModel, const XColorListRef &pColorTable ) +View3DDialog::View3DDialog(vcl::Window* pParent, const uno::Reference< frame::XModel > & xChartModel) : TabDialog(pParent, "3DViewDialog", "modules/schart/ui/3dviewdialog.ui") , m_pGeometry(nullptr) , m_pAppearance(nullptr) @@ -51,7 +51,7 @@ View3DDialog::View3DDialog(vcl::Window* pParent, const uno::Reference< frame::XM uno::Reference< beans::XPropertySet > xSceneProperties( ChartModelHelper::findDiagram( xChartModel ), uno::UNO_QUERY ); m_pGeometry = VclPtr::Create(m_pTabControl,xSceneProperties,m_aControllerLocker); m_pAppearance = VclPtr::Create(m_pTabControl,xChartModel,m_aControllerLocker); - m_pIllumination = VclPtr::Create(m_pTabControl,xSceneProperties,xChartModel,pColorTable); + m_pIllumination = VclPtr::Create(m_pTabControl,xSceneProperties,xChartModel); m_pTabControl->InsertPage( TP_3D_SCENEGEOMETRY, SCH_RESSTR(STR_PAGE_PERSPECTIVE) ); m_pTabControl->InsertPage( TP_3D_SCENEAPPEARANCE, SCH_RESSTR(STR_PAGE_APPEARANCE) ); diff --git a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx index bdd53ff10d21..40f2857859bb 100644 --- a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx +++ b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx @@ -22,6 +22,7 @@ #include "Bitmaps.hrc" #include "CommonConverters.hxx" +#include #include "svx/dialogs.hrc" #include #include @@ -103,7 +104,7 @@ void LightSourceInfo::initButtonFromSource() namespace { - OUString lcl_makeColorName( Color rColor ) + OUString lcl_makeColorName(const Color& rColor) { OUString aStr = SVX_RESSTR(RID_SVXFLOAT3D_FIX_R) + OUString::number(rColor.GetRed()) + @@ -115,15 +116,11 @@ namespace OUString::number(rColor.GetBlue()); return aStr; } - void lcl_selectColor( ColorListBox& rListBox, const Color& rColor ) + + void lcl_selectColor(SvxColorListBox& rListBox, const Color& rColor) { rListBox.SetNoSelection(); - rListBox.SelectEntry( rColor ); - if( rListBox.GetSelectEntryCount() == 0 ) - { - const sal_Int32 nPos = rListBox.InsertEntry( rColor, lcl_makeColorName( rColor ) ); - rListBox.SelectEntryPos( nPos ); - } + rListBox.SelectEntry(std::make_pair(rColor, lcl_makeColorName(rColor))); } ::chart::LightSource lcl_getLightSourceFromProperties( @@ -215,8 +212,7 @@ namespace ThreeD_SceneIllumination_TabPage::ThreeD_SceneIllumination_TabPage( vcl::Window* pWindow , const uno::Reference< beans::XPropertySet > & xSceneProperties - , const uno::Reference< frame::XModel >& xChartModel - , const XColorListRef & pColorTable ) + , const uno::Reference< frame::XModel >& xChartModel ) : TabPage ( pWindow ,"tp_3D_SceneIllumination" ,"modules/schart/ui/tp_3D_SceneIllumination.ui") @@ -242,14 +238,6 @@ ThreeD_SceneIllumination_TabPage::ThreeD_SceneIllumination_TabPage( vcl::Window* get(m_pCtl_Preview, "CTL_LIGHT_PREVIEW"); - if( pColorTable.is() ) - { - m_pLB_AmbientLight->Fill( pColorTable ); - m_pLB_LightSource->Fill( pColorTable ); - } - m_pLB_AmbientLight->SetDropDownLineCount(10); - m_pLB_LightSource->SetDropDownLineCount(10); - m_pLightSourceInfoList = new LightSourceInfo[8]; m_pLightSourceInfoList[0].pButton = m_pBtn_Light1; m_pLightSourceInfoList[1].pButton = m_pBtn_Light2; @@ -408,7 +396,7 @@ IMPL_LINK_NOARG(ThreeD_SceneIllumination_TabPage, PreviewSelectHdl, SvxLightCtl3 IMPL_LINK( ThreeD_SceneIllumination_TabPage, ColorDialogHdl, Button*, pButton, void ) { bool bIsAmbientLight = (pButton==m_pBtn_AmbientLight_Color); - ColorLB* pListBox = ( bIsAmbientLight ? m_pLB_AmbientLight : m_pLB_LightSource); + SvxColorListBox* pListBox = ( bIsAmbientLight ? m_pLB_AmbientLight : m_pLB_LightSource); SvColorDialog aColorDlg( this ); aColorDlg.SetColor( pListBox->GetSelectEntryColor() ); @@ -441,9 +429,9 @@ IMPL_LINK( ThreeD_SceneIllumination_TabPage, ColorDialogHdl, Button*, pButton, v } } -IMPL_LINK( ThreeD_SceneIllumination_TabPage, SelectColorHdl, ListBox&, rBox, void ) +IMPL_LINK( ThreeD_SceneIllumination_TabPage, SelectColorHdl, SvxColorListBox&, rBox, void ) { - ColorLB* pListBox = static_cast(&rBox); + SvxColorListBox* pListBox = &rBox; if(pListBox==m_pLB_AmbientLight) { m_bInCommitToModel = true; diff --git a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.hxx b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.hxx index 515ace16b8e4..42517359f6fc 100644 --- a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.hxx +++ b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.hxx @@ -29,6 +29,8 @@ #include #include +class SvxColorListBox; + namespace chart { @@ -52,14 +54,13 @@ public: ThreeD_SceneIllumination_TabPage( vcl::Window* pWindow, const css::uno::Reference< css::beans::XPropertySet > & xSceneProperties, - const css::uno::Reference< css::frame::XModel >& xChartModel, - const XColorListRef &pColorTable ); + const css::uno::Reference< css::frame::XModel >& xChartModel ); virtual ~ThreeD_SceneIllumination_TabPage() override; virtual void dispose() override; private: DECL_LINK( ClickLightSourceButtonHdl, Button*, void ); - DECL_LINK( SelectColorHdl, ListBox&, void ); + DECL_LINK( SelectColorHdl, SvxColorListBox&, void ); DECL_LINK( ColorDialogHdl, Button*, void ); DECL_LINK( PreviewChangeHdl, SvxLightCtl3D*, void ); DECL_LINK( PreviewSelectHdl, SvxLightCtl3D*, void ); @@ -81,10 +82,10 @@ private: VclPtr m_pBtn_Light7; VclPtr m_pBtn_Light8; - VclPtr m_pLB_LightSource; + VclPtr m_pLB_LightSource; VclPtr m_pBtn_LightSource_Color; - VclPtr m_pLB_AmbientLight; + VclPtr m_pLB_AmbientLight; VclPtr m_pBtn_AmbientLight_Color; VclPtr m_pCtl_Preview; diff --git a/chart2/source/controller/inc/dlg_View3D.hxx b/chart2/source/controller/inc/dlg_View3D.hxx index b63ece7bea10..a5646ab535bc 100644 --- a/chart2/source/controller/inc/dlg_View3D.hxx +++ b/chart2/source/controller/inc/dlg_View3D.hxx @@ -38,8 +38,7 @@ class View3DDialog : public TabDialog { public: View3DDialog( vcl::Window* pWindow, - const css::uno::Reference< css::frame::XModel > & xChartModel, - const XColorListRef &pColorTable ); + const css::uno::Reference< css::frame::XModel > & xChartModel ); virtual ~View3DDialog() override; virtual void dispose() override; diff --git a/chart2/source/controller/main/ChartController_Properties.cxx b/chart2/source/controller/main/ChartController_Properties.cxx index 00e7294f824a..7636aa982176 100644 --- a/chart2/source/controller/main/ChartController_Properties.cxx +++ b/chart2/source/controller/main/ChartController_Properties.cxx @@ -823,7 +823,7 @@ void ChartController::executeDispatch_View3D() //open dialog SolarMutexGuard aSolarGuard; - ScopedVclPtrInstance< View3DDialog > aDlg( m_pChartWindow, getModel(), m_pDrawModelWrapper->GetColorList() ); + ScopedVclPtrInstance< View3DDialog > aDlg(m_pChartWindow, getModel()); if( aDlg->Execute() == RET_OK ) aUndoGuard.commit(); } diff --git a/chart2/source/controller/sidebar/ChartColorWrapper.cxx b/chart2/source/controller/sidebar/ChartColorWrapper.cxx index b2ff6196916d..ee931d06503f 100644 --- a/chart2/source/controller/sidebar/ChartColorWrapper.cxx +++ b/chart2/source/controller/sidebar/ChartColorWrapper.cxx @@ -67,12 +67,12 @@ ChartColorWrapper::ChartColorWrapper( { } -void ChartColorWrapper::operator()(const OUString& , const Color& rColor) +void ChartColorWrapper::operator()(const OUString& , const NamedColor& rColor) { css::uno::Reference xPropSet = getPropSet(mxModel); assert(xPropSet.is()); - xPropSet->setPropertyValue(maPropertyName, css::uno::makeAny(rColor.GetColor())); + xPropSet->setPropertyValue(maPropertyName, css::uno::makeAny(rColor.first.GetColor())); } void ChartColorWrapper::updateModel(const css::uno::Reference& xModel) diff --git a/chart2/source/controller/sidebar/ChartColorWrapper.hxx b/chart2/source/controller/sidebar/ChartColorWrapper.hxx index 68fb5141b564..b98750312c16 100644 --- a/chart2/source/controller/sidebar/ChartColorWrapper.hxx +++ b/chart2/source/controller/sidebar/ChartColorWrapper.hxx @@ -12,6 +12,7 @@ #include #include +#include class SvxColorToolBoxControl; @@ -26,7 +27,7 @@ public: SvxColorToolBoxControl* pControl, const OUString& rPropertyName); - void operator()(const OUString& rCommand, const Color& rColor); + void operator()(const OUString& rCommand, const NamedColor& rColor); void updateModel(const css::uno::Reference& xModel); diff --git a/chart2/uiconfig/ui/tp_3D_SceneIllumination.ui b/chart2/uiconfig/ui/tp_3D_SceneIllumination.ui index 7ff9fbf4d097..626124a9c580 100644 --- a/chart2/uiconfig/ui/tp_3D_SceneIllumination.ui +++ b/chart2/uiconfig/ui/tp_3D_SceneIllumination.ui @@ -236,7 +236,7 @@ False 12 - + True False @@ -310,7 +310,7 @@ False 12 - + True False diff --git a/cui/source/inc/border.hxx b/cui/source/inc/border.hxx index 9675b1029a94..915debae2dfc 100644 --- a/cui/source/inc/border.hxx +++ b/cui/source/inc/border.hxx @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -72,7 +73,7 @@ private: VclPtr m_pFrameSel; VclPtr m_pLbLineStyle; - VclPtr m_pLbLineColor; + VclPtr m_pLbLineColor; VclPtr m_pLineWidthMF; VclPtr m_pSpacingFrame; @@ -91,7 +92,7 @@ private: VclPtr m_pFtShadowSize; VclPtr m_pEdShadowSize; VclPtr m_pFtShadowColor; - VclPtr m_pLbShadowColor; + VclPtr m_pLbShadowColor; VclPtr m_pPropertiesFrame;///< properties - "Merge with next paragraph" in Writer @@ -120,7 +121,7 @@ private: // Handler DECL_LINK( SelStyleHdl_Impl, ListBox&, void ); - DECL_LINK( SelColHdl_Impl, ListBox&, void ); + DECL_LINK( SelColHdl_Impl, SvxColorListBox&, void ); DECL_LINK( SelPreHdl_Impl, ValueSet*, void ); DECL_LINK( SelSdwHdl_Impl, ValueSet*, void ); DECL_LINK( LinesChanged_Impl, LinkParamNone*, void ); diff --git a/cui/source/inc/chardlg.hxx b/cui/source/inc/chardlg.hxx index bea73e4f253e..484897d93afe 100644 --- a/cui/source/inc/chardlg.hxx +++ b/cui/source/inc/chardlg.hxx @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -175,7 +176,7 @@ class SvxCharEffectsPage : public SvxCharBasePage private: static const sal_uInt16 pEffectsRanges[]; VclPtr m_pFontColorFT; - VclPtr m_pFontColorLB; + VclPtr m_pFontColorLB; VclPtr m_pEffectsFT; VclPtr m_pEffectsLB; @@ -190,13 +191,13 @@ private: VclPtr m_pOverlineLB; VclPtr m_pOverlineColorFT; - VclPtr m_pOverlineColorLB; + VclPtr m_pOverlineColorLB; VclPtr m_pStrikeoutLB; VclPtr m_pUnderlineLB; VclPtr m_pUnderlineColorFT; - VclPtr m_pUnderlineColorLB; + VclPtr m_pUnderlineColorLB; VclPtr m_pIndividualWordsBtn; @@ -210,8 +211,6 @@ private: sal_uInt16 m_nHtmlMode; - OUString m_aTransparentColorName; - SvxCharEffectsPage( vcl::Window* pParent, const SfxItemSet& rSet ); void Initialize(); @@ -225,7 +224,7 @@ private: DECL_LINK(CbClickHdl_Impl, Button*, void); DECL_LINK(TristClickHdl_Impl, Button*, void); DECL_LINK(UpdatePreview_Impl, ListBox&, void); - DECL_LINK(ColorBoxSelectHdl_Impl, ListBox&, void); + DECL_LINK(ColorBoxSelectHdl_Impl, SvxColorListBox&, void); public: virtual ~SvxCharEffectsPage() override; diff --git a/cui/source/inc/cuires.hrc b/cui/source/inc/cuires.hrc index 0f57cf68ef32..33f5ea39e1a1 100644 --- a/cui/source/inc/cuires.hrc +++ b/cui/source/inc/cuires.hrc @@ -85,7 +85,6 @@ #define RID_SVXSTR_CONNECTOR (RID_SVX_START + 221) #define RID_SVXSTR_DIMENSION_LINE (RID_SVX_START + 222) -#define RID_SVXSTR_CHARNAME_TRANSPARENT (RID_SVX_START + 237) #define RID_SVXSTR_DESC_LINEEND (RID_SVX_START + 238) #define RID_SVXSTR_CHARNAME_NOSTYLE (RID_SVX_START + 239) #define RID_SVXSTR_CHARNAME_FAMILY (RID_SVX_START + 240) diff --git a/cui/source/inc/cuitabarea.hxx b/cui/source/inc/cuitabarea.hxx index 52d4fce87273..362777aa0e02 100644 --- a/cui/source/inc/cuitabarea.hxx +++ b/cui/source/inc/cuitabarea.hxx @@ -39,6 +39,7 @@ class SdrModel; class SvxBitmapCtl; +class SvxColorListBox; /************************************************************************/ class ButtonBox @@ -321,7 +322,7 @@ private: VclPtr m_pGridShadow; VclPtr m_pCtlPosition; VclPtr m_pMtrDistance; - VclPtr m_pLbShadowColor; + VclPtr m_pLbShadowColor; VclPtr m_pMtrTransparent; VclPtr m_pCtlXRectPreview; @@ -340,14 +341,13 @@ private: DECL_LINK( ClickShadowHdl_Impl, Button*, void ); DECL_LINK( ModifyShadowHdl_Impl, Edit&, void ); - DECL_LINK( SelectShadowHdl_Impl, ListBox&, void ); + DECL_LINK( SelectShadowHdl_Impl, SvxColorListBox&, void ); public: SvxShadowTabPage( vcl::Window* pParent, const SfxItemSet& rInAttrs ); virtual ~SvxShadowTabPage() override; virtual void dispose() override; - void Construct(); static VclPtr Create( vcl::Window*, const SfxItemSet* ); static const sal_uInt16* GetRanges() { return pShadowRanges; } @@ -381,9 +381,9 @@ private: VclPtr m_pMtrAngle; VclPtr m_pMtrBorder; VclPtr m_pSliderBorder; - VclPtr m_pLbColorFrom; + VclPtr m_pLbColorFrom; VclPtr m_pMtrColorFrom; - VclPtr m_pLbColorTo; + VclPtr m_pLbColorTo; VclPtr m_pMtrColorTo; VclPtr m_pGradientLB; VclPtr m_pMtrIncrement; @@ -413,6 +413,7 @@ private: DECL_LINK( ClickRenameHdl_Impl, SvxPresetListBox*, void ); DECL_LINK( ClickDeleteHdl_Impl, SvxPresetListBox*, void ); DECL_LINK( ModifiedEditHdl_Impl, Edit&, void ); + DECL_LINK( ModifiedColorListBoxHdl_Impl, SvxColorListBox&, void ); DECL_LINK( ModifiedListBoxHdl_Impl, ListBox&, void ); DECL_LINK( ChangeAutoStepHdl_Impl, CheckBox&, void ); DECL_LINK( ModifiedSliderHdl_Impl, Slider*, void ); @@ -455,9 +456,9 @@ private: VclPtr m_pMtrAngle; VclPtr m_pSliderAngle; VclPtr m_pLbLineType; - VclPtr m_pLbLineColor; + VclPtr m_pLbLineColor; VclPtr m_pCbBackgroundColor; - VclPtr m_pLbBackgroundColor; + VclPtr m_pLbBackgroundColor; VclPtr m_pHatchLB; VclPtr m_pCtlPreview; VclPtr m_pBtnAdd; @@ -483,8 +484,9 @@ private: void ChangeHatchHdl_Impl(); DECL_LINK( ModifiedEditHdl_Impl, Edit&, void ); DECL_LINK( ModifiedListBoxHdl_Impl, ListBox&, void ); + DECL_LINK( ModifiedColorListBoxHdl_Impl, SvxColorListBox&, void ); DECL_LINK( ToggleHatchBackgroundColor_Impl, CheckBox&, void ); - DECL_LINK( ModifiedBackgroundHdl_Impl, ListBox&, void ); + DECL_LINK( ModifiedBackgroundHdl_Impl, SvxColorListBox&, void ); DECL_LINK( ModifiedSliderHdl_Impl, Slider*, void ); void ModifiedHdl_Impl(void*); DECL_LINK( ClickAddHdl_Impl, Button*, void ); @@ -613,8 +615,8 @@ class SvxPatternTabPage : public SvxTabPage private: VclPtr m_pBxPixelEditor; VclPtr m_pCtlPixel; - VclPtr m_pLbColor; - VclPtr m_pLbBackgroundColor; + VclPtr m_pLbColor; + VclPtr m_pLbBackgroundColor; VclPtr m_pPatternLB; VclPtr m_pCtlPreview; VclPtr m_pBtnAdd; @@ -642,7 +644,7 @@ private: DECL_LINK( ClickAddHdl_Impl, Button*, void ); DECL_LINK( ClickModifyHdl_Impl, Button*, void ); DECL_LINK( ChangePatternHdl_Impl, ValueSet*, void ); - DECL_LINK( ChangeColorHdl_Impl, ListBox&, void ); + DECL_LINK( ChangeColorHdl_Impl, SvxColorListBox&, void ); DECL_LINK( ClickRenameHdl_Impl, SvxPresetListBox*, void ); DECL_LINK( ClickDeleteHdl_Impl, SvxPresetListBox*, void ); diff --git a/cui/source/inc/cuitabline.hxx b/cui/source/inc/cuitabline.hxx index 957b421ecd2f..39e7498e5fdb 100644 --- a/cui/source/inc/cuitabline.hxx +++ b/cui/source/inc/cuitabline.hxx @@ -25,6 +25,7 @@ #include enum class PageType; +class SvxColorListBox; class SvxLineTabDialog : public SfxTabDialog { @@ -92,7 +93,7 @@ class SvxLineTabPage : public SvxTabPage private: VclPtr m_pBoxColor; VclPtr m_pLbLineStyle; - VclPtr m_pLbColor; + VclPtr m_pLbColor; VclPtr m_pBoxWidth; VclPtr m_pMtrLineWidth; VclPtr m_pBoxTransparency; @@ -182,7 +183,7 @@ private: DECL_LINK( ChangeEndModifyHdl_Impl, Edit&, void ); DECL_LINK( ChangeEndClickHdl_Impl, Button*, void ); void ChangeEndHdl_Impl(void*); - DECL_LINK( ChangePreviewListBoxHdl_Impl, ListBox&, void ); + DECL_LINK( ChangePreviewListBoxHdl_Impl, SvxColorListBox&, void ); DECL_LINK( ChangePreviewModifyHdl_Impl, Edit&, void ); void ChangePreviewHdl_Impl(void*); DECL_LINK( ChangeTransparentHdl_Impl, Edit&, void ); diff --git a/cui/source/inc/numpages.hxx b/cui/source/inc/numpages.hxx index 7f65cbf65511..afaaf1e61ba1 100644 --- a/cui/source/inc/numpages.hxx +++ b/cui/source/inc/numpages.hxx @@ -23,6 +23,7 @@ #include #include +#include #include #include #include @@ -33,6 +34,7 @@ #include #include +class SvxColorListBox; class SvxNumRule; class SvxBmpNumValueSet; class SvxNumValueSet; @@ -254,7 +256,7 @@ class SvxNumOptionsTabPage : public SfxTabPage VclPtr m_pCharFmtFT; VclPtr m_pCharFmtLB; VclPtr m_pBulColorFT; - VclPtr m_pBulColLB; + VclPtr m_pBulColLB; VclPtr m_pBulRelSizeFT; VclPtr m_pBulRelSizeMF; VclPtr m_pAllLevelFT; @@ -327,7 +329,7 @@ class SvxNumOptionsTabPage : public SfxTabPage DECL_LINK( AllLevelHdl_Impl, Edit&, void ); DECL_LINK( OrientHdl_Impl, ListBox&, void ); DECL_LINK( SameLevelHdl_Impl, Button*, void ); - DECL_LINK( BulColorHdl_Impl, ListBox&, void ); + DECL_LINK( BulColorHdl_Impl, SvxColorListBox&, void ); DECL_LINK( BulRelSizeHdl_Impl, Edit&, void); DECL_LINK( PreviewInvalidateHdl_Impl, Timer *, void); void EditModifyHdl_Impl(Edit*); diff --git a/cui/source/options/optchart.cxx b/cui/source/options/optchart.cxx index 3d95da759c74..060d3b0b6587 100644 --- a/cui/source/options/optchart.cxx +++ b/cui/source/options/optchart.cxx @@ -21,24 +21,99 @@ #include #include "optchart.hxx" #include +#include #include +#include #include -namespace +Color SvxDefaultColorOptPage::GetSelectEntryColor() const { - void FillBoxChartColorLB(ColorLB *pLB, const SvxChartColorTable & rTab) + sal_Int32 nPos = m_pLbChartColors->GetSelectEntryPos(); + Color aColor; + if (nPos != LISTBOX_ENTRY_NOTFOUND) + aColor = GetEntryColor(nPos); + return aColor; +} + +void SvxDefaultColorOptPage::InsertColorEntry(const XColorEntry& rEntry, sal_Int32 nPos) +{ + const Color& rColor = rEntry.GetColor(); + const OUString& rStr = rEntry.GetName(); + + const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); + Size aImageSize = rStyleSettings.GetListBoxPreviewDefaultPixelSize(); + + VclPtr xDevice = VclPtr::Create(); + xDevice->SetOutputSize(aImageSize); + const Rectangle aRect(Point(0, 0), aImageSize); + xDevice->SetFillColor(rColor); + xDevice->SetLineColor(rStyleSettings.GetDisableColor()); + xDevice->DrawRect(aRect); + Bitmap aBitmap(xDevice->GetBitmap(Point(0, 0), xDevice->GetOutputSize())); + + nPos = m_pLbChartColors->InsertEntry(rStr, Image(aBitmap), nPos); + + if (nPos != LISTBOX_ERROR) { - pLB->SetUpdateMode(false); - pLB->Clear(); - long nCount = rTab.size(); - for(long i = 0; i < nCount; ++i) + if ( static_cast(nPos) < aColorList.size() ) { - pLB->Append(rTab[i]); + ImpColorList::iterator it = aColorList.begin(); + ::std::advance( it, nPos ); + aColorList.insert( it, rColor ); + } + else + { + aColorList.push_back( rColor ); + nPos = aColorList.size() - 1; } - pLB->SetUpdateMode(true); } } +void SvxDefaultColorOptPage::RemoveColorEntry(sal_Int32 nPos) +{ + m_pLbChartColors->RemoveEntry(nPos); + if ( 0 <= nPos && static_cast(nPos) < aColorList.size() ) + { + ImpColorList::iterator it = aColorList.begin(); + std::advance(it, nPos); + aColorList.erase(it); + } +} + +void SvxDefaultColorOptPage::ClearColorEntries() +{ + aColorList.clear(); + m_pLbChartColors->Clear(); +} + +Color SvxDefaultColorOptPage::GetEntryColor(sal_Int32 nPos) const +{ + Color aColor; + if (0 <= nPos && static_cast(nPos) < aColorList.size()) + aColor = aColorList[nPos]; + return aColor; +} + +void SvxDefaultColorOptPage::ModifyColorEntry(const XColorEntry& rEntry, sal_Int32 nPos) +{ + RemoveColorEntry(nPos); + InsertColorEntry(rEntry, nPos); +} + +void SvxDefaultColorOptPage::FillBoxChartColorLB() +{ + if (!pColorConfig) + return; + + const SvxChartColorTable & rTab = pColorConfig->GetColorList(); + m_pLbChartColors->SetUpdateMode(false); + ClearColorEntries(); + long nCount = rTab.size(); + for (long i = 0; i < nCount; ++i) + InsertColorEntry(rTab[i]); + m_pLbChartColors->SetUpdateMode(true); +} + SvxDefaultColorOptPage::SvxDefaultColorOptPage(vcl::Window* pParent, const SfxItemSet& rInAttrs) : SfxTabPage(pParent, "OptChartColorsPage","cui/ui/optchartcolorspage.ui", &rInAttrs) { @@ -109,9 +184,7 @@ void SvxDefaultColorOptPage::dispose() void SvxDefaultColorOptPage::Construct() { - if( pColorConfig ) - FillBoxChartColorLB(m_pLbChartColors, pColorConfig->GetColorList()); - + FillBoxChartColorLB(); FillColorBox(); m_pLbChartColors->SelectEntryPos( 0 ); @@ -184,7 +257,7 @@ IMPL_LINK_NOARG(SvxDefaultColorOptPage, ResetToDefaults, Button*, void) { pColorConfig->GetColorList().useDefault(); - FillBoxChartColorLB(m_pLbChartColors, pColorConfig->GetColorList()); + FillBoxChartColorLB(); m_pLbChartColors->GetFocus(); m_pLbChartColors->SelectEntryPos( 0 ); @@ -203,7 +276,7 @@ IMPL_LINK_NOARG(SvxDefaultColorOptPage, AddChartColor, Button*, void) pColorConfig->GetColorList().append (XColorEntry ( black, pColorConfig->GetColorList().getDefaultName(pColorConfig->GetColorList().size()))); - FillBoxChartColorLB(m_pLbChartColors, pColorConfig->GetColorList()); + FillBoxChartColorLB(); m_pLbChartColors->GetFocus(); m_pLbChartColors->SelectEntryPos( pColorConfig->GetColorList().size() - 1 ); @@ -231,7 +304,7 @@ IMPL_LINK( SvxDefaultColorOptPage, RemoveChartColor, Button*, pButton, void ) { pColorConfig->GetColorList().remove( nIndex ); - FillBoxChartColorLB(m_pLbChartColors, pColorConfig->GetColorList()); + FillBoxChartColorLB(); m_pLbChartColors->GetFocus(); @@ -245,9 +318,9 @@ IMPL_LINK( SvxDefaultColorOptPage, RemoveChartColor, Button*, pButton, void ) } } -IMPL_LINK( SvxDefaultColorOptPage, ListClickedHdl, ListBox&, _rBox, void ) +IMPL_LINK_NOARG( SvxDefaultColorOptPage, ListClickedHdl, ListBox&, void ) { - Color aCol = static_cast(_rBox).GetSelectEntryColor(); + Color aCol = GetSelectEntryColor(); long nIndex = GetColorIndex( aCol ); @@ -264,7 +337,7 @@ IMPL_LINK_NOARG(SvxDefaultColorOptPage, BoxClickedHdl, ValueSet*, void) { const XColorEntry aEntry( m_pValSetColorBox->GetItemColor( m_pValSetColorBox->GetSelectItemId() ), m_pLbChartColors->GetSelectEntry() ); - m_pLbChartColors->Modify( aEntry, nIdx ); + ModifyColorEntry(aEntry, nIdx); pColorConfig->ReplaceColorByIndex( nIdx, aEntry ); m_pLbChartColors->SelectEntryPos( nIdx ); // reselect entry diff --git a/cui/source/options/optchart.hxx b/cui/source/options/optchart.hxx index 34cd2113f2a3..79af3c1dd8b8 100644 --- a/cui/source/options/optchart.hxx +++ b/cui/source/options/optchart.hxx @@ -29,11 +29,12 @@ #include "cfgchart.hxx" +typedef std::vector ImpColorList; + class SvxDefaultColorOptPage : public SfxTabPage { - private: - VclPtr m_pLbChartColors; + VclPtr m_pLbChartColors; VclPtr m_pValSetColorBox; VclPtr m_pPBDefault; VclPtr m_pPBAdd; @@ -42,6 +43,7 @@ private: SvxChartOptions* pChartOptions; SvxChartColorTableItem* pColorConfig; XColorListRef pColorList; + ImpColorList aColorList; DECL_LINK( ResetToDefaults, Button *, void ); DECL_LINK( AddChartColor, Button *, void ); @@ -52,6 +54,15 @@ private: void FillColorBox(); long GetColorIndex( const Color& rCol ); +private: + void InsertColorEntry(const XColorEntry& rEntry, sal_Int32 nPos = LISTBOX_APPEND); + void RemoveColorEntry(sal_Int32 nPos); + void ModifyColorEntry(const XColorEntry& rEntry, sal_Int32 nPos); + void ClearColorEntries(); + void FillBoxChartColorLB(); + Color GetEntryColor(sal_Int32 nPos) const; + Color GetSelectEntryColor() const; + public: SvxDefaultColorOptPage( vcl::Window* pParent, const SfxItemSet& rInAttrs ); virtual ~SvxDefaultColorOptPage() override; diff --git a/cui/source/options/optcolor.cxx b/cui/source/options/optcolor.cxx index 43f76b4b6884..1d962bddbd3b 100644 --- a/cui/source/options/optcolor.cxx +++ b/cui/source/options/optcolor.cxx @@ -21,11 +21,13 @@ #include +#include #include #include #include #include #include +#include #include #include #include @@ -177,12 +179,12 @@ public: virtual void dispose() override; public: - void SetLinks (Link const&, Link const&, Link const&); + void SetLinks (Link const&, Link const&, Link const&); unsigned GetEntryHeight () const { return vEntries[0]->GetHeight(); } void Update (EditableColorConfig const*, EditableExtendedColorConfig const*); void ScrollHdl(const ScrollBar&); void ClickHdl (EditableColorConfig*, CheckBox*); - void ColorHdl (EditableColorConfig*, EditableExtendedColorConfig*, ColorListBox*); + void ColorHdl (EditableColorConfig*, EditableExtendedColorConfig*, SvxColorListBox*); void Init(ScrollBar *pVScroll, HeaderBar *m_pHeaderHB); void AdjustScrollBar(); void AdjustHeaderBar(); @@ -214,10 +216,10 @@ private: public: void Show (); void Hide (); - void SetAppearance(Wallpaper const& aTextWall, ColorListBox const& aSampleList); + void SetAppearance(Wallpaper const& rTextWall); void SetTextColor (Color C) { m_pText->SetTextColor(C); } public: - void SetLinks (Link const&, Link const&, Link const&); + void SetLinks (Link const&, Link const&, Link const&); void Update (ColorConfigEntry, ColorConfigValue const&); void Update (ExtendedColorConfigValue const&); void ColorChanged (ColorConfigEntry, ColorConfigValue&); @@ -227,7 +229,7 @@ private: unsigned GetHeight () const { return m_pColorList->GetSizePixel().Height(); } public: bool Is (CheckBox* pBox) const { return m_pText == pBox; } - bool Is (ColorListBox* pBox) const { return m_pColorList == pBox; } + bool Is (SvxColorListBox* pBox) const { return m_pColorList == pBox; } void dispose() { m_pText.disposeAndClear(); @@ -239,7 +241,7 @@ private: // checkbox (CheckBox) or simple text (FixedText) VclPtr m_pText; // color list box - VclPtr m_pColorList; + VclPtr m_pColorList; // color preview box VclPtr m_pPreview; // default color @@ -350,9 +352,7 @@ ColorConfigWindow_Impl::Entry::Entry( vcl::Window *pGrid, unsigned nYPos, m_pText->set_margin_left(6 + nCheckBoxLabelOffset); m_pText->SetText(rColorEntry.getDisplayName()); - WinBits nWinBits = WB_LEFT|WB_VCENTER|WB_3DLOOK|WB_TABSTOP|WB_DROPDOWN; - m_pColorList = VclPtr::Create(pGrid, nWinBits); - m_pColorList->EnableAutoSize(true); + m_pColorList = VclPtr::Create(pGrid); m_pColorList->set_grid_left_attach(1); m_pColorList->set_grid_top_attach(nYPos); @@ -390,24 +390,22 @@ void ColorConfigWindow_Impl::Entry::Hide() // SetAppearance() // iEntry: which entry is this? -// aTextWall: background of the text (transparent) +// rTextWall: background of the text (transparent) // aSampleList: sample color listbox (to copy from) -void ColorConfigWindow_Impl::Entry::SetAppearance( - Wallpaper const& aTextWall, - ColorListBox const& aSampleList) +void ColorConfigWindow_Impl::Entry::SetAppearance(Wallpaper const& rTextWall) { // text (and optionally checkbox) - m_pText->SetBackground(aTextWall); + m_pText->SetBackground(rTextWall); // preview m_pPreview->SetBorderStyle(WindowBorderStyle::MONO); // color list - m_pColorList->CopyEntries(aSampleList); - m_pColorList->InsertAutomaticEntryColor(m_aDefaultColor); + m_pColorList->SetSlotId(SID_ATTR_CHAR_COLOR); + m_pColorList->SetAutoDisplayColor(m_aDefaultColor); } // SetLinks() void ColorConfigWindow_Impl::Entry::SetLinks( - Link const& aCheckLink, Link const& aColorLink, + Link const& aCheckLink, Link const& aColorLink, Link const& aGetFocusLink) { m_pColorList->SetSelectHdl(aColorLink); @@ -423,17 +421,10 @@ void ColorConfigWindow_Impl::Entry::SetLinks( void ColorConfigWindow_Impl::Entry::Update ( ColorConfigEntry aColorEntry, ColorConfigValue const& rValue ) { - Color aColor; - if ((unsigned)rValue.nColor == COL_AUTO) - { + Color aColor(rValue.nColor); + m_pColorList->SelectEntry(aColor); + if (aColor.GetColor() == COL_AUTO) aColor = ColorConfig::GetDefaultColor(aColorEntry); - m_pColorList->SelectEntryPos(0); - } - else - { - aColor = Color(rValue.nColor); - m_pColorList->SelectEntry(aColor); - } m_pPreview->SetBackground(Wallpaper(aColor)); if (CheckBox* pCheckBox = dynamic_cast(m_pText.get())) pCheckBox->Check(rValue.bIsVisible); @@ -445,7 +436,7 @@ void ColorConfigWindow_Impl::Entry::Update ( ) { Color aColor(rValue.getColor()); if (rValue.getColor() == rValue.getDefaultColor()) - m_pColorList->SelectEntryPos(0); + m_pColorList->SelectEntry(Color(COL_AUTO)); else m_pColorList->SelectEntry(aColor); SetColor(aColor); @@ -456,17 +447,10 @@ void ColorConfigWindow_Impl::Entry::ColorChanged ( ColorConfigEntry aColorEntry, ColorConfigValue& rValue ) { - Color aColor; - if (m_pColorList->IsAutomaticSelected()) - { + Color aColor = m_pColorList->GetSelectEntryColor(); + rValue.nColor = aColor.GetColor(); + if (aColor.GetColor() == COL_AUTO) aColor = ColorConfig::GetDefaultColor(aColorEntry); - rValue.nColor = COL_AUTO; - } - else - { - aColor = m_pColorList->GetSelectEntryColor(); - rValue.nColor = aColor.GetColor(); - } SetColor(aColor); } @@ -476,8 +460,7 @@ void ColorConfigWindow_Impl::Entry::ColorChanged ( ) { Color aColor = m_pColorList->GetSelectEntryColor(); rValue.setColor(aColor.GetColor()); - // automatic? - if (m_pColorList->GetSelectEntryPos() == 0) + if (aColor.GetColor() == COL_AUTO) { rValue.setColor(rValue.getDefaultColor()); aColor.SetColor(rValue.getColor()); @@ -628,22 +611,11 @@ void ColorConfigWindow_Impl::SetAppearance () OSL_ENSURE( vEntries.size() >= SAL_N_ELEMENTS(vEntryInfo), "wrong number of helpIDs for color listboxes" ); - // creating a sample color listbox with the color entries - ScopedVclPtrInstance< ColorListBox > aSampleColorList(this); - { - XColorListRef const xColorTable = XColorList::CreateStdColorList(); - for (sal_Int32 i = 0; i != xColorTable->Count(); ++i) - { - XColorEntry& rEntry = *xColorTable->GetColor(i); - aSampleColorList->InsertEntry(rEntry.GetColor(), rEntry.GetName()); - } - } - // appearance for (size_t i = 0; i != vEntries.size(); ++i) { // appearance - vEntries[i]->SetAppearance(aTransparentWall, *aSampleColorList.get()); + vEntries[i]->SetAppearance(aTransparentWall); } } @@ -681,7 +653,7 @@ void ColorConfigWindow_Impl::Init(ScrollBar *pVScroll, HeaderBar *pHeaderHB) // SetLinks() void ColorConfigWindow_Impl::SetLinks ( - Link const& aCheckLink, Link const& aColorLink, Link const& aGetFocusLink + Link const& aCheckLink, Link const& aColorLink, Link const& aGetFocusLink ) { for (unsigned i = 0; i != vEntries.size(); ++i) vEntries[i]->SetLinks(aCheckLink, aColorLink, aGetFocusLink); @@ -742,10 +714,10 @@ void ColorConfigWindow_Impl::ClickHdl (EditableColorConfig* pConfig, CheckBox* p } // ColorHdl() -void ColorConfigWindow_Impl::ColorHdl ( +void ColorConfigWindow_Impl::ColorHdl( EditableColorConfig* pConfig, EditableExtendedColorConfig* pExtConfig, - ColorListBox* pBox -) { + SvxColorListBox* pBox) +{ unsigned i = 0; // default entries @@ -838,7 +810,7 @@ class ColorConfigCtrl_Impl : public VclVBox DECL_LINK(ScrollHdl, ScrollBar*, void); DECL_LINK(ClickHdl, Button*, void); - DECL_LINK(ColorHdl, ListBox&, void); + DECL_LINK(ColorHdl, SvxColorListBox&, void); DECL_LINK(ControlFocusHdl, Control&, void); virtual bool PreNotify (NotifyEvent& rNEvt) override; @@ -892,7 +864,7 @@ ColorConfigCtrl_Impl::ColorConfigCtrl_Impl(vcl::Window* pParent) m_pVScroll->SetEndScrollHdl(aScrollLink); Link aCheckLink = LINK(this, ColorConfigCtrl_Impl, ClickHdl); - Link aColorLink = LINK(this, ColorConfigCtrl_Impl, ColorHdl); + Link aColorLink = LINK(this, ColorConfigCtrl_Impl, ColorHdl); Link aGetFocusLink = LINK(this, ColorConfigCtrl_Impl, ControlFocusHdl); m_pScrollWindow->SetLinks(aCheckLink, aColorLink, aGetFocusLink); @@ -998,11 +970,12 @@ IMPL_LINK(ColorConfigCtrl_Impl, ClickHdl, Button*, pBox, void) } // a color list has changed -IMPL_LINK(ColorConfigCtrl_Impl, ColorHdl, ListBox&, rBox, void) +IMPL_LINK(ColorConfigCtrl_Impl, ColorHdl, SvxColorListBox&, rBox, void) { DBG_ASSERT(pColorConfig, "Configuration not set" ); - m_pScrollWindow->ColorHdl(pColorConfig, pExtColorConfig, static_cast(&rBox)); + m_pScrollWindow->ColorHdl(pColorConfig, pExtColorConfig, &rBox); } + IMPL_LINK(ColorConfigCtrl_Impl, ControlFocusHdl, Control&, rCtrl, void) { // determine whether a control is completely visible diff --git a/cui/source/tabpages/backgrnd.cxx b/cui/source/tabpages/backgrnd.cxx index ce9948c6c79f..41e525d2d358 100644 --- a/cui/source/tabpages/backgrnd.cxx +++ b/cui/source/tabpages/backgrnd.cxx @@ -381,7 +381,7 @@ SvxBackgroundTabPage::SvxBackgroundTabPage(vcl::Window* pParent, const SfxItemSe m_pBackgroundColorSet->SetSelectHdl( HDL(BackgroundColorHdl_Impl) ); m_pBackgroundColorSet->SetStyle(m_pBackgroundColorSet->GetStyle() | WB_ITEMBORDER | WB_NAMEFIELD | WB_NONEFIELD); - m_pBackgroundColorSet->SetText(SVX_RESSTR(RID_SVXSTR_TRANSPARENT)); + m_pBackgroundColorSet->SetText(SVX_RESSTR(RID_SVXSTR_NOFILL)); } SvxBackgroundTabPage::~SvxBackgroundTabPage() diff --git a/cui/source/tabpages/border.cxx b/cui/source/tabpages/border.cxx index d74ae35b723a..f989a7ce7af6 100644 --- a/cui/source/tabpages/border.cxx +++ b/cui/source/tabpages/border.cxx @@ -284,45 +284,13 @@ SvxBorderTabPage::SvxBorderTabPage(vcl::Window* pParent, const SfxItemSet& rCore m_pLbLineStyle->SetSelectHdl( LINK( this, SvxBorderTabPage, SelStyleHdl_Impl ) ); m_pLbLineColor->SetSelectHdl( LINK( this, SvxBorderTabPage, SelColHdl_Impl ) ); m_pLineWidthMF->SetModifyHdl( LINK( this, SvxBorderTabPage, ModifyWidthHdl_Impl ) ); - m_pLbShadowColor->SetSelectHdl( LINK( this, SvxBorderTabPage, SelColHdl_Impl ) ); m_pWndPresets->SetSelectHdl( LINK( this, SvxBorderTabPage, SelPreHdl_Impl ) ); m_pWndShadows->SetSelectHdl( LINK( this, SvxBorderTabPage, SelSdwHdl_Impl ) ); FillValueSets(); FillLineListBox_Impl(); - // fill ColorBox out of the XColorList - SfxObjectShell* pDocSh = SfxObjectShell::Current(); - XColorListRef pColorTable; - - DBG_ASSERT( pDocSh, "DocShell not found!" ); - - if ( pDocSh ) - { - pItem = pDocSh->GetItem( SID_COLOR_TABLE ); - if ( pItem != nullptr ) - pColorTable = static_cast(pItem)->GetColorList(); - } - - DBG_ASSERT( pColorTable.is(), "ColorTable not found!" ); - - if ( pColorTable.is() ) - { - // filling the line color box - m_pLbLineColor->SetUpdateMode( false ); - - for ( long i = 0; i < pColorTable->Count(); ++i ) - { - const XColorEntry* pEntry = pColorTable->GetColor(i); - m_pLbLineColor->InsertEntry( pEntry->GetColor(), pEntry->GetName() ); - } - m_pLbLineColor->SetUpdateMode( true ); - - m_pLbShadowColor->CopyEntries(*m_pLbLineColor); - } - // connections - bool bSupportsShadow = !SfxItemPool::IsSlot( GetWhich( SID_ATTR_BORDER_SHADOW ) ); if( bSupportsShadow ) AddItemConnection( svx::CreateShadowConnection( rCoreAttrs, *m_pWndShadows, *m_pEdShadowSize, *m_pLbShadowColor ) ); @@ -344,7 +312,8 @@ SvxBorderTabPage::SvxBorderTabPage(vcl::Window* pParent, const SfxItemSet& rCore AddItemConnection( new sfx::CheckBoxConnection( SID_SW_COLLAPSING_BORDERS, *m_pMergeAdjacentBordersCB, ItemConnFlags::NONE ) ); m_pMergeAdjacentBordersCB->Hide(); - if( pDocSh ) + SfxObjectShell* pDocSh = SfxObjectShell::Current(); + if (pDocSh) { Reference< XServiceInfo > xSI( pDocSh->GetModel(), UNO_QUERY ); if ( xSI.is() ) @@ -564,12 +533,8 @@ void SvxBorderTabPage::Reset( const SfxItemSet* rSet ) if( !bColorEq ) aColor.SetColor( COL_BLACK ); - sal_Int32 nSelPos = m_pLbLineColor->GetEntryPos( aColor ); - if( nSelPos == LISTBOX_ENTRY_NOTFOUND ) - nSelPos = m_pLbLineColor->InsertEntry( aColor, SVX_RESSTR( RID_SVXSTR_COLOR_USER ) ); - - m_pLbLineColor->SelectEntryPos( nSelPos ); - m_pLbLineStyle->SetColor( aColor ); + m_pLbLineColor->SelectEntry(aColor); + m_pLbLineStyle->SetColor(aColor); // Select all visible lines, if they are all equal. if( bWidthEq && bColorEq ) @@ -577,7 +542,6 @@ void SvxBorderTabPage::Reset( const SfxItemSet* rSet ) // set the current style and color (caches style in control even if nothing is selected) SelStyleHdl_Impl(*m_pLbLineStyle); - SelColHdl_Impl(*m_pLbLineColor); } bool bEnable = m_pWndShadows->GetSelectItemId() > 1 ; @@ -868,7 +832,6 @@ IMPL_LINK_NOARG(SvxBorderTabPage, SelPreHdl_Impl, ValueSet*, void) // set current style to all previously selected lines SelStyleHdl_Impl(*m_pLbLineStyle); - SelColHdl_Impl(*m_pLbLineColor); } // Presets ValueSet does not show a selection (used as push buttons). @@ -888,16 +851,11 @@ IMPL_LINK_NOARG(SvxBorderTabPage, SelSdwHdl_Impl, ValueSet*, void) m_pLbShadowColor->Enable(bEnable); } - -IMPL_LINK( SvxBorderTabPage, SelColHdl_Impl, ListBox&, rLb, void ) +IMPL_LINK(SvxBorderTabPage, SelColHdl_Impl, SvxColorListBox&, rColorBox, void) { - ColorListBox* pColLb = static_cast(&rLb); - - if (&rLb == m_pLbLineColor) - { - m_pFrameSel->SetColorToSelection( pColLb->GetSelectEntryColor() ); - m_pLbLineStyle->SetColor( pColLb->GetSelectEntryColor() ); - } + Color aColor = rColorBox.GetSelectEntryColor(); + m_pFrameSel->SetColorToSelection(aColor); + m_pLbLineStyle->SetColor(aColor); } IMPL_LINK_NOARG(SvxBorderTabPage, ModifyWidthHdl_Impl, Edit&, void) diff --git a/cui/source/tabpages/borderconn.cxx b/cui/source/tabpages/borderconn.cxx index 5aec14626802..70243d055a47 100644 --- a/cui/source/tabpages/borderconn.cxx +++ b/cui/source/tabpages/borderconn.cxx @@ -22,6 +22,7 @@ #include "editeng/lineitem.hxx" #include #include +#include #include namespace svx { @@ -203,7 +204,7 @@ static const ShadowPosWrapper::MapEntryType s_pShadowPosMap[] = class ShadowControlsWrapper : public sfx::MultiControlWrapper< SvxShadowItem > { public: - explicit ShadowControlsWrapper( ValueSet& rVsPos, MetricField& rMfSize, ColorListBox& rLbColor ); + explicit ShadowControlsWrapper( ValueSet& rVsPos, MetricField& rMfSize, SvxColorListBox& rLbColor ); virtual SvxShadowItem GetControlValue() const override; virtual void SetControlValue( SvxShadowItem aItem ) override; @@ -211,11 +212,11 @@ public: private: ShadowPosWrapper maPosWrp; sfx::MetricFieldWrapper maSizeWrp; - sfx::ColorListBoxWrapper maColorWrp; + SvxColorListBoxWrapper maColorWrp; }; ShadowControlsWrapper::ShadowControlsWrapper( - ValueSet& rVsPos, MetricField& rMfSize, ColorListBox& rLbColor ) : + ValueSet& rVsPos, MetricField& rMfSize, SvxColorListBox& rLbColor ) : maPosWrp( rVsPos, s_pShadowPosMap ), maSizeWrp( rMfSize, FUNIT_TWIP ), maColorWrp( rLbColor ) @@ -250,11 +251,11 @@ class ShadowConnection : public sfx::ItemControlConnection< ShadowItemWrapper, S { public: explicit ShadowConnection( const SfxItemSet& rItemSet, - ValueSet& rVsPos, MetricField& rMfSize, ColorListBox& rLbColor ); + ValueSet& rVsPos, MetricField& rMfSize, SvxColorListBox& rLbColor ); }; ShadowConnection::ShadowConnection( const SfxItemSet& rItemSet, - ValueSet& rVsPos, MetricField& rMfSize, ColorListBox& rLbColor ) : + ValueSet& rVsPos, MetricField& rMfSize, SvxColorListBox& rLbColor ) : ItemControlConnectionType( SID_ATTR_BORDER_SHADOW, new ShadowControlsWrapper( rVsPos, rMfSize, rLbColor ), ItemConnFlags::NONE ) { mxCtrlWrp->SetDefaultValue( maItemWrp.GetDefaultItem( rItemSet ) ); @@ -275,7 +276,7 @@ sfx::ItemConnectionBase* CreateMarginConnection( const SfxItemSet& rItemSet, } sfx::ItemConnectionBase* CreateShadowConnection( const SfxItemSet& rItemSet, - ValueSet& rVsPos, MetricField& rMfSize, ColorListBox& rLbColor ) + ValueSet& rVsPos, MetricField& rMfSize, SvxColorListBox& rLbColor ) { return new ShadowConnection( rItemSet, rVsPos, rMfSize, rLbColor ); } diff --git a/cui/source/tabpages/borderconn.hxx b/cui/source/tabpages/borderconn.hxx index 17343d80025f..b04d4a8b0c1f 100644 --- a/cui/source/tabpages/borderconn.hxx +++ b/cui/source/tabpages/borderconn.hxx @@ -26,7 +26,7 @@ class SfxItemSet; class MetricField; class ValueSet; -class ColorListBox; +class SvxColorListBox; namespace svx { @@ -47,7 +47,7 @@ sfx::ItemConnectionBase* CreateMarginConnection( const SfxItemSet& rItemSet, /** Creates an item connection object that connects an SvxShadowItem with the controls of the SvxBorderTabPage. */ sfx::ItemConnectionBase* CreateShadowConnection( const SfxItemSet& rItemSet, - ValueSet& rVsPos, MetricField& rMfSize, ColorListBox& rLbColor ); + ValueSet& rVsPos, MetricField& rMfSize, SvxColorListBox& rLbColor ); } diff --git a/cui/source/tabpages/chardlg.cxx b/cui/source/tabpages/chardlg.cxx index d1b7b8b50c28..15a1020591e5 100644 --- a/cui/source/tabpages/chardlg.cxx +++ b/cui/source/tabpages/chardlg.cxx @@ -1348,10 +1348,10 @@ void SvxCharNamePage::PageCreated(const SfxAllItemSet& aSet) SvxCharEffectsPage::SvxCharEffectsPage( vcl::Window* pParent, const SfxItemSet& rInSet ) : SvxCharBasePage(pParent, "EffectsPage", "cui/ui/effectspage.ui", rInSet) - , m_aTransparentColorName(CUI_RES(RID_SVXSTR_CHARNAME_TRANSPARENT)) { get(m_pFontColorFT, "fontcolorft"); get(m_pFontColorLB, "fontcolorlb"); + m_pFontColorLB->SetSlotId(SID_ATTR_CHAR_COLOR); get(m_pEffectsFT, "effectsft"); get(m_pEffectsLB, "effectslb"); get(m_pReliefFT, "reliefft"); @@ -1363,10 +1363,12 @@ SvxCharEffectsPage::SvxCharEffectsPage( vcl::Window* pParent, const SfxItemSet& get(m_pOverlineLB, "overlinelb"); get(m_pOverlineColorFT, "overlinecolorft"); get(m_pOverlineColorLB, "overlinecolorlb"); + m_pOverlineColorLB->SetSlotId(SID_ATTR_CHAR_COLOR); get(m_pStrikeoutLB, "strikeoutlb"); get(m_pUnderlineLB, "underlinelb"); get(m_pUnderlineColorFT, "underlinecolorft"); get(m_pUnderlineColorLB, "underlinecolorlb"); + m_pUnderlineColorLB->SetSlotId(SID_ATTR_CHAR_COLOR); get(m_pIndividualWordsBtn, "individualwordscb"); get(m_pEmphasisFT, "emphasisft"); get(m_pEmphasisLB, "emphasislb"); @@ -1431,55 +1433,14 @@ void SvxCharEffectsPage::Initialize() } } - // fill the color box - SfxObjectShell* pDocSh = SfxObjectShell::Current(); - DBG_ASSERT( pDocSh, "DocShell not found!" ); - XColorListRef pColorTable; - - if ( pDocSh ) - { - pItem = pDocSh->GetItem( SID_COLOR_TABLE ); - if ( pItem != nullptr ) - pColorTable = static_cast(pItem)->GetColorList(); - } - - if ( !pColorTable.is() ) - pColorTable = XColorList::CreateStdColorList(); - - m_pUnderlineColorLB->SetUpdateMode( false ); - m_pOverlineColorLB->SetUpdateMode( false ); - m_pFontColorLB->SetUpdateMode( false ); - - { - std::unique_ptr pDummy; - SfxViewFrame* pFrame = SfxViewFrame::GetFirst( pDocSh ); - if ( !pFrame || - SfxItemState::DEFAULT > pFrame->GetBindings().QueryState( SID_ATTR_AUTO_COLOR_INVALID, pDummy ) ) - { - m_pUnderlineColorLB->InsertAutomaticEntryColor( Color( COL_AUTO ) ); - m_pOverlineColorLB->InsertAutomaticEntryColor( Color( COL_AUTO ) ); - m_pFontColorLB->InsertAutomaticEntryColor( Color( COL_AUTO ) ); - } - } - for ( long i = 0; i < pColorTable->Count(); i++ ) - { - const XColorEntry* pEntry = pColorTable->GetColor(i); - m_pUnderlineColorLB->InsertEntry( pEntry->GetColor(), pEntry->GetName() ); - m_pOverlineColorLB->InsertEntry( pEntry->GetColor(), pEntry->GetName() ); - m_pFontColorLB->InsertEntry( pEntry->GetColor(), pEntry->GetName() ); - } - - m_pUnderlineColorLB->SetUpdateMode( true ); - m_pOverlineColorLB->SetUpdateMode( true ); - m_pFontColorLB->SetUpdateMode( true ); - m_pFontColorLB->SetSelectHdl( LINK( this, SvxCharEffectsPage, ColorBoxSelectHdl_Impl ) ); + m_pFontColorLB->SetSelectHdl(LINK(this, SvxCharEffectsPage, ColorBoxSelectHdl_Impl)); // handler Link aLink = LINK( this, SvxCharEffectsPage, SelectListBoxHdl_Impl ); m_pUnderlineLB->SetSelectHdl( aLink ); - m_pUnderlineColorLB->SetSelectHdl( aLink ); + m_pUnderlineColorLB->SetSelectHdl(LINK(this, SvxCharEffectsPage, ColorBoxSelectHdl_Impl)); m_pOverlineLB->SetSelectHdl( aLink ); - m_pOverlineColorLB->SetSelectHdl( aLink ); + m_pOverlineColorLB->SetSelectHdl(LINK(this, SvxCharEffectsPage, ColorBoxSelectHdl_Impl)); m_pStrikeoutLB->SetSelectHdl( aLink ); m_pEmphasisLB->SetSelectHdl( aLink ); m_pPositionLB->SetSelectHdl( aLink ); @@ -1487,9 +1448,7 @@ void SvxCharEffectsPage::Initialize() m_pReliefLB->SetSelectHdl( aLink ); m_pUnderlineLB->SelectEntryPos( 0 ); - m_pUnderlineColorLB->SelectEntryPos( 0 ); m_pOverlineLB->SelectEntryPos( 0 ); - m_pOverlineColorLB->SelectEntryPos( 0 ); m_pStrikeoutLB->SelectEntryPos( 0 ); m_pEmphasisLB->SelectEntryPos( 0 ); m_pPositionLB->SelectEntryPos( 0 ); @@ -1520,6 +1479,11 @@ void SvxCharEffectsPage::UpdatePreview_Impl() SvxFont& rCJKFont = GetPreviewCJKFont(); SvxFont& rCTLFont = GetPreviewCTLFont(); + const Color& rSelectedColor = m_pFontColorLB->GetSelectEntryColor(); + rFont.SetColor(rSelectedColor.GetColor() == COL_AUTO ? Color(COL_BLACK) : rSelectedColor); + rCJKFont.SetColor(rSelectedColor.GetColor() == COL_AUTO ? Color(COL_BLACK) : rSelectedColor); + rCTLFont.SetColor(rSelectedColor.GetColor() == COL_AUTO ? Color(COL_BLACK) : rSelectedColor); + sal_Int32 nPos = m_pUnderlineLB->GetSelectEntryPos(); FontLineStyle eUnderline = (FontLineStyle)reinterpret_cast(m_pUnderlineLB->GetEntryData( nPos )); nPos = m_pOverlineLB->GetSelectEntryPos(); @@ -1547,7 +1511,7 @@ void SvxCharEffectsPage::UpdatePreview_Impl() rCTLFont.SetEmphasisMark( eMark ); sal_Int32 nRelief = m_pReliefLB->GetSelectEntryPos(); - if(LISTBOX_ENTRY_NOTFOUND != nRelief) + if (LISTBOX_ENTRY_NOTFOUND != nRelief) { rFont.SetRelief( (FontRelief)nRelief ); rCJKFont.SetRelief( (FontRelief)nRelief ); @@ -1631,71 +1595,38 @@ void SvxCharEffectsPage::ResetColor_Impl( const SfxItemSet& rSet ) rCTLFont.SetColor( aColor.GetColor() == COL_AUTO ? Color(COL_BLACK) : aColor ); m_pPreviewWin->Invalidate(); - sal_Int32 nSelPos = m_pFontColorLB->GetEntryPos( aColor ); - if ( nSelPos == LISTBOX_ENTRY_NOTFOUND && aColor == Color( COL_TRANSPARENT ) ) - nSelPos = m_pFontColorLB->GetEntryPos( m_aTransparentColorName ); - if ( LISTBOX_ENTRY_NOTFOUND != nSelPos ) - m_pFontColorLB->SelectEntryPos( nSelPos ); - else - { - nSelPos = m_pFontColorLB->GetEntryPos( aColor ); - if ( LISTBOX_ENTRY_NOTFOUND != nSelPos ) - m_pFontColorLB->SelectEntryPos( nSelPos ); - else - m_pFontColorLB->SelectEntryPos( - m_pFontColorLB->InsertEntry( aColor, OUString( SVX_RES( RID_SVXSTR_COLOR_USER ) ) ) ); - } + m_pFontColorLB->SelectEntry(aColor); break; } } } - bool SvxCharEffectsPage::FillItemSetColor_Impl( SfxItemSet& rSet ) { sal_uInt16 nWhich = GetWhich( SID_ATTR_CHAR_COLOR ); const SvxColorItem* pOld = static_cast(GetOldItem( rSet, SID_ATTR_CHAR_COLOR )); - const SvxColorItem* pItem = nullptr; bool bChanged = true; - const SfxItemSet* pExampleSet = GetTabDialog() ? GetTabDialog()->GetExampleSet() : nullptr; const SfxItemSet& rOldSet = GetItemSet(); - Color aSelectedColor; - if ( m_pFontColorLB->GetSelectEntry() == m_aTransparentColorName ) - aSelectedColor = Color( COL_TRANSPARENT ); - else - aSelectedColor = m_pFontColorLB->GetSelectEntryColor(); + Color aSelectedColor = m_pFontColorLB->GetSelectEntryColor(); - if ( pOld && pOld->GetValue() == aSelectedColor ) + if (pOld && pOld->GetValue() == aSelectedColor) bChanged = false; - if ( !bChanged ) - bChanged = ( m_pFontColorLB->GetSavedValue() == LISTBOX_ENTRY_NOTFOUND ); - - if ( !bChanged && pExampleSet && - pExampleSet->GetItemState( nWhich, false, reinterpret_cast(&pItem) ) == SfxItemState::SET && - pItem->GetValue() != aSelectedColor ) - bChanged = true; - - bool bModified = false; - - if ( bChanged && m_pFontColorLB->GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND ) - { + if (bChanged) rSet.Put( SvxColorItem( aSelectedColor, nWhich ) ); - bModified = true; - } else if ( SfxItemState::DEFAULT == rOldSet.GetItemState( nWhich, false ) ) CLEARTITEM; - return bModified; + return bChanged; } - IMPL_LINK( SvxCharEffectsPage, SelectListBoxHdl_Impl, ListBox&, rBox, void ) { SelectHdl_Impl(&rBox); } + void SvxCharEffectsPage::SelectHdl_Impl( ListBox* pBox ) { if ( m_pEmphasisLB == pBox ) @@ -1751,26 +1682,11 @@ IMPL_LINK_NOARG(SvxCharEffectsPage, TristClickHdl_Impl, Button*, void) } -IMPL_LINK( SvxCharEffectsPage, ColorBoxSelectHdl_Impl, ListBox&, rListBox, void ) +IMPL_LINK_NOARG(SvxCharEffectsPage, ColorBoxSelectHdl_Impl, SvxColorListBox&, void) { - ColorListBox* pBox = static_cast(&rListBox); - SvxFont& rFont = GetPreviewFont(); - SvxFont& rCJKFont = GetPreviewCJKFont(); - SvxFont& rCTLFont = GetPreviewCTLFont(); - - Color aSelectedColor; - if ( pBox->GetSelectEntry() == m_aTransparentColorName ) - aSelectedColor = Color( COL_TRANSPARENT ); - else - aSelectedColor = pBox->GetSelectEntryColor(); - rFont.SetColor( aSelectedColor.GetColor() == COL_AUTO ? Color(COL_BLACK) : aSelectedColor ); - rCJKFont.SetColor( aSelectedColor.GetColor() == COL_AUTO ? Color(COL_BLACK) : aSelectedColor ); - rCTLFont.SetColor( aSelectedColor.GetColor() == COL_AUTO ? Color(COL_BLACK) : aSelectedColor ); - - m_pPreviewWin->Invalidate(); + UpdatePreview_Impl(); } - DeactivateRC SvxCharEffectsPage::DeactivatePage( SfxItemSet* _pSet ) { if ( _pSet ) @@ -1827,24 +1743,11 @@ void SvxCharEffectsPage::Reset( const SfxItemSet* rSet ) } Color aColor = rItem.GetColor(); - sal_Int32 nPos = m_pUnderlineColorLB->GetEntryPos( aColor ); - - if ( LISTBOX_ENTRY_NOTFOUND != nPos ) - m_pUnderlineColorLB->SelectEntryPos( nPos ); - else - { - nPos = m_pUnderlineColorLB->GetEntryPos( aColor ); - if ( LISTBOX_ENTRY_NOTFOUND != nPos ) - m_pUnderlineColorLB->SelectEntryPos( nPos ); - else - m_pUnderlineColorLB->SelectEntryPos( - m_pUnderlineColorLB->InsertEntry( aColor, - OUString( SVX_RES( RID_SVXSTR_COLOR_USER ) ) ) ); - } + m_pUnderlineColorLB->SelectEntry(aColor); } else { - m_pUnderlineColorLB->SelectEntry( Color( COL_AUTO )); + m_pUnderlineColorLB->SelectEntry(Color(COL_AUTO)); m_pUnderlineColorLB->Disable(); } } @@ -1884,24 +1787,11 @@ void SvxCharEffectsPage::Reset( const SfxItemSet* rSet ) } Color aColor = rItem.GetColor(); - sal_Int32 nPos = m_pOverlineColorLB->GetEntryPos( aColor ); - - if ( LISTBOX_ENTRY_NOTFOUND != nPos ) - m_pOverlineColorLB->SelectEntryPos( nPos ); - else - { - nPos = m_pOverlineColorLB->GetEntryPos( aColor ); - if ( LISTBOX_ENTRY_NOTFOUND != nPos ) - m_pOverlineColorLB->SelectEntryPos( nPos ); - else - m_pOverlineColorLB->SelectEntryPos( - m_pOverlineColorLB->InsertEntry( aColor, - OUString( SVX_RES( RID_SVXSTR_COLOR_USER ) ) ) ); - } + m_pOverlineColorLB->SelectEntry(aColor); } else { - m_pOverlineColorLB->SelectEntry( Color( COL_AUTO )); + m_pOverlineColorLB->SelectEntry(Color(COL_AUTO)); m_pOverlineColorLB->Disable(); } } @@ -2214,12 +2104,10 @@ void SvxCharEffectsPage::Reset( const SfxItemSet* rSet ) ChangesApplied(); } -void SvxCharEffectsPage::ChangesApplied() +void SvxCharEffectsPage::ChangesApplied() { m_pUnderlineLB->SaveValue(); - m_pUnderlineColorLB->SaveValue(); m_pOverlineLB->SaveValue(); - m_pOverlineColorLB->SaveValue(); m_pStrikeoutLB->SaveValue(); m_pIndividualWordsBtn->SaveValue(); m_pEmphasisLB->SaveValue(); @@ -2231,10 +2119,8 @@ void SvxCharEffectsPage::ChangesApplied() m_pBlinkingBtn->SaveValue(); m_pHiddenBtn->SaveValue(); m_pFontColorLB->SaveValue(); - } - bool SvxCharEffectsPage::FillItemSet( SfxItemSet* rSet ) { const SfxPoolItem* pOld = nullptr; @@ -2305,7 +2191,7 @@ bool SvxCharEffectsPage::FillItemSet( SfxItemSet* rSet ) rSet->Put( aNewItem ); bModified = true; } - else if ( SfxItemState::DEFAULT == rOldSet.GetItemState( nWhich, false ) ) + else if ( SfxItemState::DEFAULT == rOldSet.GetItemState( nWhich, false ) ) rSet->InvalidateItem(nWhich); bChanged = true; diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx index 6aacd7e695b7..49564a9e1716 100644 --- a/cui/source/tabpages/numpages.cxx +++ b/cui/source/tabpages/numpages.cxx @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -1103,6 +1104,7 @@ SvxNumOptionsTabPage::SvxNumOptionsTabPage(vcl::Window* pParent, get(m_pBulColorFT, "colorft"); get(m_pBulColLB, "color"); + m_pBulColLB->SetSlotId(SID_ATTR_CHAR_COLOR); get(m_pBulRelSizeFT, "relsizeft"); get(m_pBulRelSizeMF, "relsize"); @@ -1368,31 +1370,6 @@ void SvxNumOptionsTabPage::Reset( const SfxItemSet* rSet ) m_pPreviewWIN->SetNumRule(pActNum); m_pSameLevelCB->Check(pActNum->IsContinuousNumbering()); - // fill ColorListBox as needed - if ( pActNum->IsFeatureSupported( SvxNumRuleFlags::BULLET_COLOR ) ) - { - SfxObjectShell* pDocSh = SfxObjectShell::Current(); - DBG_ASSERT( pDocSh, "DocShell not found!" ); - XColorListRef pColorTable; - if ( pDocSh ) - { - pItem = pDocSh->GetItem( SID_COLOR_TABLE ); - if ( pItem ) - pColorTable = static_cast(pItem)->GetColorList(); - } - - if ( !pColorTable.is() ) - pColorTable = XColorList::CreateStdColorList(); - - m_pBulColLB->InsertEntry( Color( COL_AUTO ), SVX_RESSTR( RID_SVXSTR_AUTOMATIC )); - - for ( long i = 0; i < pColorTable->Count(); i++ ) - { - const XColorEntry* pEntry = pColorTable->GetColor(i); - m_pBulColLB->InsertEntry( pEntry->GetColor(), pEntry->GetName() ); - } - } - SfxObjectShell* pShell; if ( SfxItemState::SET == rSet->GetItemState( SID_HTML_MODE, false, &pItem ) || ( nullptr != ( pShell = SfxObjectShell::Current()) && @@ -1922,10 +1899,9 @@ IMPL_LINK( SvxNumOptionsTabPage, SameLevelHdl_Impl, Button*, pBox, void ) InitControls(); } -IMPL_LINK( SvxNumOptionsTabPage, BulColorHdl_Impl, ListBox&, rListBox, void ) +IMPL_LINK(SvxNumOptionsTabPage, BulColorHdl_Impl, SvxColorListBox&, rColorBox, void) { - ColorListBox* pBox = static_cast(&rListBox); - Color nSetColor = pBox->GetSelectEntryColor(); + Color nSetColor = rColorBox.GetSelectEntryColor(); sal_uInt16 nMask = 1; for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++) diff --git a/cui/source/tabpages/strings.src b/cui/source/tabpages/strings.src index 2bf8809c0d97..0b296d647f89 100644 --- a/cui/source/tabpages/strings.src +++ b/cui/source/tabpages/strings.src @@ -87,10 +87,6 @@ String RID_SVXSTR_DESC_LINEEND { Text [ en-US ] = "Please enter a name for the new arrowhead:" ; }; -String RID_SVXSTR_CHARNAME_TRANSPARENT -{ - Text [ en-US ] = "Transparent"; -}; String RID_SVXSTR_CHARNAME_NOSTYLE { Text [ en-US ] = "No %1"; diff --git a/cui/source/tabpages/tabarea.cxx b/cui/source/tabpages/tabarea.cxx index 6acbf08a03d7..72538f070da7 100644 --- a/cui/source/tabpages/tabarea.cxx +++ b/cui/source/tabpages/tabarea.cxx @@ -266,7 +266,6 @@ void SvxAreaTabDialog::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) { static_cast(rPage).SetColorList( mpColorList ); static_cast(rPage).SetColorChgd( &mnColorListState ); - static_cast(rPage).Construct(); } else if (nId == m_nTransparenceTabPage) { diff --git a/cui/source/tabpages/tabline.cxx b/cui/source/tabpages/tabline.cxx index b9efb53c7850..e8d080e3a812 100644 --- a/cui/source/tabpages/tabline.cxx +++ b/cui/source/tabpages/tabline.cxx @@ -235,7 +235,6 @@ void SvxLineTabDialog::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) static_cast(rPage).SetDlgType( 0 ); static_cast(rPage).SetAreaTP( &mbAreaTP ); static_cast(rPage).SetColorChgd( &mnColorListState ); - static_cast(rPage).Construct(); } } diff --git a/cui/source/tabpages/tpgradnt.cxx b/cui/source/tabpages/tpgradnt.cxx index e28e17791d56..7aac0c7fc14c 100644 --- a/cui/source/tabpages/tpgradnt.cxx +++ b/cui/source/tabpages/tpgradnt.cxx @@ -28,6 +28,7 @@ #include #include "helpid.hrc" +#include #include "svx/xattr.hxx" #include #include @@ -124,9 +125,10 @@ SvxGradientTabPage::SvxGradientTabPage m_pMtrBorder->SetModifyHdl( aLink ); m_pSliderBorder->SetSlideHdl( LINK( this, SvxGradientTabPage, ModifiedSliderHdl_Impl ) ); m_pMtrColorFrom->SetModifyHdl( aLink ); - m_pLbColorFrom->SetSelectHdl( aLink2 ); + Link aLink3 = LINK( this, SvxGradientTabPage, ModifiedColorListBoxHdl_Impl ); + m_pLbColorFrom->SetSelectHdl( aLink3 ); m_pMtrColorTo->SetModifyHdl( aLink ); - m_pLbColorTo->SetSelectHdl( aLink2 ); + m_pLbColorTo->SetSelectHdl( aLink3 ); // #i76307# always paint the preview in LTR, because this is what the document does m_pCtlPreview->EnableRTL( false ); @@ -163,21 +165,13 @@ void SvxGradientTabPage::dispose() SfxTabPage::dispose(); } - void SvxGradientTabPage::Construct() { - m_pLbColorFrom->Fill( m_pColorList ); - m_pLbColorTo->CopyEntries( *m_pLbColorFrom ); - m_pGradientLB->FillPresetListBox( *m_pGradientList ); } - void SvxGradientTabPage::ActivatePage( const SfxItemSet& rSet ) { - sal_Int32 nPos; - sal_Int32 nCount; - if( m_pColorList.is() ) { // ColorList @@ -189,30 +183,6 @@ void SvxGradientTabPage::ActivatePage( const SfxItemSet& rSet ) if (pArea) m_pColorList = pArea->GetNewColorList(); - // LbColorFrom - nPos = m_pLbColorFrom->GetSelectEntryPos(); - m_pLbColorFrom->Clear(); - m_pLbColorFrom->Fill( m_pColorList ); - nCount = m_pLbColorFrom->GetEntryCount(); - if( nCount == 0 ) - ; // this case should not occur - else if( nCount <= nPos ) - m_pLbColorFrom->SelectEntryPos( 0 ); - else - m_pLbColorFrom->SelectEntryPos( nPos ); - - // LbColorTo - nPos = m_pLbColorTo->GetSelectEntryPos(); - m_pLbColorTo->Clear(); - m_pLbColorTo->CopyEntries( *m_pLbColorFrom ); - nCount = m_pLbColorTo->GetEntryCount(); - if( nCount == 0 ) - ; // this case should not occur - else if( nCount <= nPos ) - m_pLbColorTo->SelectEntryPos( 0 ); - else - m_pLbColorTo->SelectEntryPos( nPos ); - ModifiedHdl_Impl( this ); } @@ -310,12 +280,16 @@ VclPtr SvxGradientTabPage::Create( vcl::Window* pWindow, return VclPtr::Create( pWindow, *rOutAttrs ); } - IMPL_LINK( SvxGradientTabPage, ModifiedListBoxHdl_Impl, ListBox&, rListBox, void ) { ModifiedHdl_Impl(&rListBox); } +IMPL_LINK( SvxGradientTabPage, ModifiedColorListBoxHdl_Impl, SvxColorListBox&, rListBox, void ) +{ + ModifiedHdl_Impl(&rListBox); +} + IMPL_LINK( SvxGradientTabPage, ModifiedEditHdl_Impl, Edit&, rBox, void ) { ModifiedHdl_Impl(&rBox); @@ -617,21 +591,9 @@ void SvxGradientTabPage::ChangeGradientHdl_Impl() m_pLbColorFrom->SetNoSelection(); m_pLbColorFrom->SelectEntry( pGradient->GetStartColor() ); - if ( m_pLbColorFrom->GetSelectEntryCount() == 0 ) - { - m_pLbColorFrom->InsertEntry( pGradient->GetStartColor(), - OUString() ); - m_pLbColorFrom->SelectEntry( pGradient->GetStartColor() ); - } m_pLbColorTo->SetNoSelection(); m_pLbColorTo->SelectEntry( pGradient->GetEndColor() ); - if ( m_pLbColorTo->GetSelectEntryCount() == 0 ) - { - m_pLbColorTo->InsertEntry( pGradient->GetEndColor(), OUString() ); - m_pLbColorTo->SelectEntry( pGradient->GetEndColor() ); - } - m_pMtrAngle->SetValue( pGradient->GetAngle() / 10 ); // should be changed in resource m_pMtrBorder->SetValue( pGradient->GetBorder() ); m_pSliderBorder->SetThumbPos( pGradient->GetBorder() ); diff --git a/cui/source/tabpages/tphatch.cxx b/cui/source/tabpages/tphatch.cxx index 1f4fa526d9da..31efad7ad521 100644 --- a/cui/source/tabpages/tphatch.cxx +++ b/cui/source/tabpages/tphatch.cxx @@ -29,6 +29,7 @@ #include #include "helpid.hrc" +#include #include "svx/xattr.hxx" #include #include @@ -118,7 +119,8 @@ SvxHatchTabPage::SvxHatchTabPage m_pMtrAngle->SetModifyHdl( aLink ); m_pSliderAngle->SetSlideHdl( LINK( this, SvxHatchTabPage, ModifiedSliderHdl_Impl ) ); m_pLbLineType->SetSelectHdl( aLink2 ); - m_pLbLineColor->SetSelectHdl( aLink2 ); + Link aLink3 = LINK( this, SvxHatchTabPage, ModifiedColorListBoxHdl_Impl ); + m_pLbLineColor->SetSelectHdl( aLink3 ); m_pCbBackgroundColor->SetToggleHdl( LINK( this, SvxHatchTabPage, ToggleHatchBackgroundColor_Impl ) ); m_pLbBackgroundColor->SetSelectHdl( LINK( this, SvxHatchTabPage, ModifiedBackgroundHdl_Impl ) ); @@ -150,20 +152,13 @@ void SvxHatchTabPage::dispose() SvxTabPage::dispose(); } - void SvxHatchTabPage::Construct() { - m_pLbLineColor->Fill( m_pColorList ); - m_pLbBackgroundColor->Fill( m_pColorList ); m_pHatchLB->FillPresetListBox(*m_pHatchingList); } - void SvxHatchTabPage::ActivatePage( const SfxItemSet& rSet ) { - sal_Int32 nPos; - sal_Int32 nCount; - if( m_pColorList.is() ) { // ColorList @@ -175,18 +170,6 @@ void SvxHatchTabPage::ActivatePage( const SfxItemSet& rSet ) if (pArea) m_pColorList = pArea->GetNewColorList(); - // LbLineColor - nPos = m_pLbLineColor->GetSelectEntryPos(); - m_pLbLineColor->Clear(); - m_pLbLineColor->Fill( m_pColorList ); - nCount = m_pLbLineColor->GetEntryCount(); - if( nCount == 0 ) - ; // this case should not occur - else if( nCount <= nPos ) - m_pLbLineColor->SelectEntryPos( 0 ); - else - m_pLbLineColor->SelectEntryPos( nPos ); - ModifiedHdl_Impl( this ); } @@ -228,12 +211,6 @@ void SvxHatchTabPage::ActivatePage( const SfxItemSet& rSet ) Color aColor(aColorItem.GetColorValue()); m_pLbBackgroundColor->Enable(); m_pLbBackgroundColor->SelectEntry(aColor); - - if( m_pLbBackgroundColor->GetSelectEntryCount() == 0 ) - { - m_pLbBackgroundColor->InsertEntry( aColor , OUString() ); - m_pLbBackgroundColor->SelectEntry( aColor ); - } m_rXFSet.Put( aColorItem ); } else @@ -295,15 +272,10 @@ bool SvxHatchTabPage::FillItemSet( SfxItemSet* rSet ) rSet->Put( XFillStyleItem( drawing::FillStyle_HATCH ) ); rSet->Put( XFillHatchItem( aString, *pXHatch ) ); rSet->Put( XFillBackgroundItem( m_pCbBackgroundColor->IsChecked() ) ); - if(m_pCbBackgroundColor->IsChecked()) + if (m_pCbBackgroundColor->IsChecked()) { - sal_uInt32 nPosBckColor = m_pLbBackgroundColor->GetSelectEntryPos(); - OUString aBckColorString; - if( nPosBckColor != LISTBOX_ENTRY_NOTFOUND ) - aBckColorString = m_pLbBackgroundColor->GetSelectEntry(); - else - aBckColorString = OUString(); - rSet->Put( XFillColorItem( aBckColorString, m_pLbBackgroundColor->GetSelectEntryColor() ) ); + NamedColor aColor = m_pLbBackgroundColor->GetSelectEntry(); + rSet->Put(XFillColorItem(aColor.second, aColor.first)); } return true; } @@ -335,12 +307,16 @@ VclPtr SvxHatchTabPage::Create( vcl::Window* pWindow, return VclPtr::Create( pWindow, *rSet ); } - IMPL_LINK( SvxHatchTabPage, ModifiedListBoxHdl_Impl, ListBox&, rListBox, void ) { ModifiedHdl_Impl(&rListBox); } +IMPL_LINK( SvxHatchTabPage, ModifiedColorListBoxHdl_Impl, SvxColorListBox&, rListBox, void ) +{ + ModifiedHdl_Impl(&rListBox); +} + IMPL_LINK_NOARG( SvxHatchTabPage, ToggleHatchBackgroundColor_Impl, CheckBox&, void ) { if(m_pCbBackgroundColor->IsChecked()) @@ -351,7 +327,7 @@ IMPL_LINK_NOARG( SvxHatchTabPage, ToggleHatchBackgroundColor_Impl, CheckBox&, vo ModifiedBackgroundHdl_Impl(*m_pLbBackgroundColor); } -IMPL_LINK_NOARG( SvxHatchTabPage, ModifiedBackgroundHdl_Impl, ListBox&, void ) +IMPL_LINK_NOARG( SvxHatchTabPage, ModifiedBackgroundHdl_Impl, SvxColorListBox&, void ) { Color aColor(COL_TRANSPARENT); if(m_pCbBackgroundColor->IsChecked()) @@ -429,15 +405,8 @@ void SvxHatchTabPage::ChangeHatchHdl_Impl() { m_pLbLineType->SelectEntryPos( sal::static_int_cast< sal_Int32 >( pHatch->GetHatchStyle() ) ); - // if the entry is not in the listbox - // the color is added temporarily m_pLbLineColor->SetNoSelection(); m_pLbLineColor->SelectEntry( pHatch->GetColor() ); - if( m_pLbLineColor->GetSelectEntryCount() == 0 ) - { - m_pLbLineColor->InsertEntry( pHatch->GetColor(), OUString() ); - m_pLbLineColor->SelectEntry( pHatch->GetColor() ); - } SetMetricValue( *m_pMtrDistance, pHatch->GetDistance(), m_ePoolUnit ); long mHatchAngle = pHatch->GetAngle() / 10; m_pMtrAngle->SetValue( mHatchAngle ); diff --git a/cui/source/tabpages/tpline.cxx b/cui/source/tabpages/tpline.cxx index 11ffd614387d..3172081f1a2c 100644 --- a/cui/source/tabpages/tpline.cxx +++ b/cui/source/tabpages/tpline.cxx @@ -24,6 +24,7 @@ #include #include +#include #include "svx/xattr.hxx" #include #include @@ -268,8 +269,6 @@ void SvxLineTabPage::dispose() void SvxLineTabPage::Construct() { - // Color chart - m_pLbColor->Fill( m_pColorList ); FillListboxes(); } @@ -641,17 +640,6 @@ void SvxLineTabPage::ActivatePage( const SfxItemSet& rSet ) { if( *m_pnColorListState & ChangeType::CHANGED ) m_pColorList = static_cast( GetParentDialog() )->GetNewColorList(); - // aLbColor - sal_Int32 nColorPos = m_pLbColor->GetSelectEntryPos(); - m_pLbColor->Clear(); - m_pLbColor->Fill( m_pColorList ); - nCount = m_pLbColor->GetEntryCount(); - if( nCount == 0 ) - ; // This case should never occur - else if( nCount <= nColorPos ) - m_pLbColor->SelectEntryPos( 0 ); - else - m_pLbColor->SelectEntryPos( nColorPos ); ChangePreviewHdl_Impl( nullptr ); } @@ -767,9 +755,9 @@ bool SvxLineTabPage::FillItemSet( SfxItemSet* rAttrs ) } // Line color - if( m_pLbColor->IsValueChangedFromSaved() ) { - XLineColorItem aItem( m_pLbColor->GetSelectEntry(), m_pLbColor->GetSelectEntryColor() ); + NamedColor aColor = m_pLbColor->GetSelectEntry(); + XLineColorItem aItem(aColor.second, aColor.first); pOld = GetOldItem( *rAttrs, XATTR_LINECOLOR ); if ( !pOld || !( *static_cast(pOld) == aItem ) ) { @@ -1070,7 +1058,8 @@ void SvxLineTabPage::FillXLSet_Impl() m_rXLSet.Put( XLineEndWidthItem( GetCoreValue( *m_pMtrEndWidth, m_ePoolUnit ) ) ); m_rXLSet.Put( XLineWidthItem( GetCoreValue( *m_pMtrLineWidth, m_ePoolUnit ) ) ); - m_rXLSet.Put( XLineColorItem( m_pLbColor->GetSelectEntry(), m_pLbColor->GetSelectEntryColor() ) ); + NamedColor aColor = m_pLbColor->GetSelectEntry(); + m_rXLSet.Put(XLineColorItem(aColor.second, aColor.first)); // Centered line end if( m_pTsbCenterStart->GetState() == TRISTATE_TRUE ) @@ -1260,11 +1249,6 @@ void SvxLineTabPage::Reset( const SfxItemSet* rAttrs ) { Color aCol = static_cast( rAttrs->Get( XATTR_LINECOLOR ) ).GetColorValue(); m_pLbColor->SelectEntry( aCol ); - if( m_pLbColor->GetSelectEntryCount() == 0 ) - { - m_pLbColor->InsertEntry( aCol, OUString() ); - m_pLbColor->SelectEntry( aCol ); - } } // Line start @@ -1498,11 +1482,11 @@ VclPtr SvxLineTabPage::Create( vcl::Window* pWindow, return VclPtr::Create( pWindow, *rAttrs ); } - -IMPL_LINK( SvxLineTabPage, ChangePreviewListBoxHdl_Impl, ListBox&, rListBox, void ) +IMPL_LINK( SvxLineTabPage, ChangePreviewListBoxHdl_Impl, SvxColorListBox&, rListBox, void ) { ChangePreviewHdl_Impl(&rListBox); } + IMPL_LINK( SvxLineTabPage, ChangePreviewModifyHdl_Impl, Edit&, rEdit, void ) { ChangePreviewHdl_Impl(&rEdit); diff --git a/cui/source/tabpages/tppattern.cxx b/cui/source/tabpages/tppattern.cxx index 253b1984d478..cb4c7a3d7b88 100644 --- a/cui/source/tabpages/tppattern.cxx +++ b/cui/source/tabpages/tppattern.cxx @@ -27,6 +27,7 @@ #include #include #include "com/sun/star/ui/dialogs/TemplateDescription.hpp" +#include #include #include #include @@ -158,17 +159,11 @@ void SvxPatternTabPage::dispose() void SvxPatternTabPage::Construct() { - m_pLbColor->Fill( m_pColorList ); - m_pLbBackgroundColor->CopyEntries( *m_pLbColor ); m_pPatternLB->FillPresetListBox( *m_pPatternList ); } - void SvxPatternTabPage::ActivatePage( const SfxItemSet& rSet ) { - sal_Int32 nPos; - sal_Int32 nCount; - if( m_pColorList.is() ) { // ColorList @@ -179,30 +174,6 @@ void SvxPatternTabPage::ActivatePage( const SfxItemSet& rSet ) dynamic_cast(GetParentDialog()) : nullptr; if (pArea) m_pColorList = pArea->GetNewColorList(); - - // LbColor - nPos = m_pLbColor->GetSelectEntryPos(); - m_pLbColor->Clear(); - m_pLbColor->Fill( m_pColorList ); - nCount = m_pLbColor->GetEntryCount(); - if( nCount == 0 ) - ; // this case should not occur - else if( nCount <= nPos ) - m_pLbColor->SelectEntryPos( 0 ); - else - m_pLbColor->SelectEntryPos( nPos ); - - // LbColorBackground - nPos = m_pLbBackgroundColor->GetSelectEntryPos(); - m_pLbBackgroundColor->Clear(); - m_pLbBackgroundColor->CopyEntries( *m_pLbColor ); - nCount = m_pLbBackgroundColor->GetEntryCount(); - if( nCount == 0 ) - ; // this case should not occur - else if( nCount <= nPos ) - m_pLbBackgroundColor->SelectEntryPos( 0 ); - else - m_pLbBackgroundColor->SelectEntryPos( nPos ); } // determining (possibly cutting) the name and @@ -353,34 +324,9 @@ IMPL_LINK_NOARG(SvxPatternTabPage, ChangePatternHdl_Impl, ValueSet*, void) Color aPixelColor = aFront; Color aBackColor = aBack; - // #i123564# This causes the wrong color to be selected - // as foreground color when the 1st bitmap in the bitmap - // list is selected. I see no reason why this is done, - // thus I will take it out - - //if( 0 == m_pLbBitmaps->GetSelectEntryPos() ) - //{ - // m_pLbColor->SelectEntry( Color( COL_BLACK ) ); - // ChangePixelColorHdl_Impl( this ); - //} - //else - m_pLbColor->SelectEntry( aPixelColor ); - - if( m_pLbColor->GetSelectEntryCount() == 0 ) - { - m_pLbColor->InsertEntry( aPixelColor, OUString() ); - m_pLbColor->SelectEntry( aPixelColor ); - } - m_pLbBackgroundColor->SelectEntry( aBackColor ); - if( m_pLbBackgroundColor->GetSelectEntryCount() == 0 ) - { - m_pLbBackgroundColor->InsertEntry( aBackColor, OUString() ); - m_pLbBackgroundColor->SelectEntry( aBackColor ); - } - // update m_pBitmapCtl, rXFSet and m_pCtlPreview m_pBitmapCtl->SetPixelColor( aPixelColor ); m_pBitmapCtl->SetBackgroundColor( aBackColor ); @@ -608,7 +554,7 @@ IMPL_LINK_NOARG(SvxPatternTabPage, ClickDeleteHdl_Impl, SvxPresetListBox*, void) } } -IMPL_LINK_NOARG(SvxPatternTabPage, ChangeColorHdl_Impl, ListBox&, void) +IMPL_LINK_NOARG(SvxPatternTabPage, ChangeColorHdl_Impl, SvxColorListBox&, void) { ChangeColor_Impl(); } diff --git a/cui/source/tabpages/tpshadow.cxx b/cui/source/tabpages/tpshadow.cxx index d2b1dca3ce28..84179d24f7bb 100644 --- a/cui/source/tabpages/tpshadow.cxx +++ b/cui/source/tabpages/tpshadow.cxx @@ -19,6 +19,7 @@ #include #include +#include #include #include "svx/xattr.hxx" @@ -182,17 +183,8 @@ void SvxShadowTabPage::dispose() SvxTabPage::dispose(); } -void SvxShadowTabPage::Construct() -{ - m_pLbShadowColor->Fill( m_pColorList ); -} - - void SvxShadowTabPage::ActivatePage( const SfxItemSet& rSet ) { - sal_Int32 nPos; - sal_Int32 nCount; - const SfxUInt16Item* pPageTypeItem = rSet.GetItem(SID_PAGE_TYPE, false); if (pPageTypeItem) SetPageType((PageType) pPageTypeItem->GetValue()); @@ -220,18 +212,6 @@ void SvxShadowTabPage::ActivatePage( const SfxItemSet& rSet ) } } - // aLbShadowColor - nPos = m_pLbShadowColor->GetSelectEntryPos(); - m_pLbShadowColor->Clear(); - m_pLbShadowColor->Fill( m_pColorList ); - nCount = m_pLbShadowColor->GetEntryCount(); - if( nCount == 0 ) - ; // this case should not occur - else if( nCount <= nPos ) - m_pLbShadowColor->SelectEntryPos( 0 ); - else - m_pLbShadowColor->SelectEntryPos( nPos ); - SfxItemSet rAttribs( rSet ); // rSet contains shadow attributes too, but we want // to use it for updating rectangle attributes only, @@ -335,9 +315,6 @@ bool SvxShadowTabPage::FillItemSet( SfxItemSet* rAttrs ) } // ShadowColor - sal_Int32 nPos = m_pLbShadowColor->GetSelectEntryPos(); - if( nPos != LISTBOX_ENTRY_NOTFOUND && - m_pLbShadowColor->IsValueChangedFromSaved() ) { XColorItem aItem(makeSdrShadowColorItem(m_pLbShadowColor->GetSelectEntryColor())); pOld = GetOldItem( *rAttrs, SDRATTR_SHADOWCOLOR ); @@ -488,11 +465,11 @@ IMPL_LINK_NOARG(SvxShadowTabPage, ClickShadowHdl_Impl, Button*, void) ModifyShadowHdl_Impl( *m_pMtrTransparent ); } - -IMPL_LINK_NOARG(SvxShadowTabPage, SelectShadowHdl_Impl, ListBox&, void) +IMPL_LINK_NOARG(SvxShadowTabPage, SelectShadowHdl_Impl, SvxColorListBox&, void) { ModifyShadowHdl_Impl(*m_pMtrTransparent); } + IMPL_LINK_NOARG(SvxShadowTabPage, ModifyShadowHdl_Impl, Edit&, void) { if( m_pTsbShowShadow->GetState() == TRISTATE_TRUE ) @@ -500,11 +477,7 @@ IMPL_LINK_NOARG(SvxShadowTabPage, ModifyShadowHdl_Impl, Edit&, void) else m_rXFSet.Put( XFillStyleItem( drawing::FillStyle_NONE ) ); - sal_Int32 nPos = m_pLbShadowColor->GetSelectEntryPos(); - if( nPos != LISTBOX_ENTRY_NOTFOUND ) - { - m_rXFSet.Put( XFillColorItem( OUString(), m_pLbShadowColor->GetSelectEntryColor() ) ); - } + m_rXFSet.Put( XFillColorItem( OUString(), m_pLbShadowColor->GetSelectEntryColor() ) ); sal_uInt16 nVal = (sal_uInt16)m_pMtrTransparent->GetValue(); XFillTransparenceItem aItem( nVal ); m_rXFSet.Put( XFillTransparenceItem( aItem ) ); @@ -553,7 +526,6 @@ void SvxShadowTabPage::PageCreated(const SfxAllItemSet& aSet) SetPageType((PageType) pPageTypeItem->GetValue()); if (pDlgTypeItem) SetDlgType(pDlgTypeItem->GetValue()); - Construct(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/uiconfig/ui/borderpage.ui b/cui/uiconfig/ui/borderpage.ui index c783d268396a..a3cb06bb068a 100644 --- a/cui/uiconfig/ui/borderpage.ui +++ b/cui/uiconfig/ui/borderpage.ui @@ -233,7 +233,7 @@ - + True False @@ -505,7 +505,7 @@ - + True False start diff --git a/cui/uiconfig/ui/colorconfigwin.ui b/cui/uiconfig/ui/colorconfigwin.ui index d03daf7c34fd..6c8dd3f6aedb 100644 --- a/cui/uiconfig/ui/colorconfigwin.ui +++ b/cui/uiconfig/ui/colorconfigwin.ui @@ -38,7 +38,7 @@ - + True False @@ -72,7 +72,7 @@ - + True False @@ -98,7 +98,7 @@ - + True False @@ -148,7 +148,7 @@ - + True False @@ -185,7 +185,7 @@ - + True False @@ -220,7 +220,7 @@ - + True False @@ -257,7 +257,7 @@ - + True False @@ -294,7 +294,7 @@ - + True False @@ -354,7 +354,7 @@ - + True False @@ -364,7 +364,7 @@ - + True False @@ -374,7 +374,7 @@ - + True False @@ -400,7 +400,7 @@ - + True False @@ -435,7 +435,7 @@ - + True False @@ -457,7 +457,7 @@ - + True False @@ -479,7 +479,7 @@ - + True False @@ -559,7 +559,7 @@ - + True False @@ -581,7 +581,7 @@ - + True False @@ -616,7 +616,7 @@ - + True False @@ -651,7 +651,7 @@ - + True False @@ -702,7 +702,7 @@ - + True False @@ -737,7 +737,7 @@ - + True False @@ -772,7 +772,7 @@ - + True False @@ -807,7 +807,7 @@ - + True False @@ -858,7 +858,7 @@ - + True False @@ -893,7 +893,7 @@ - + True False @@ -928,7 +928,7 @@ - + True False @@ -963,7 +963,7 @@ - + True False @@ -998,7 +998,7 @@ - + True False @@ -1033,7 +1033,7 @@ - + True False @@ -1068,7 +1068,7 @@ - + True False @@ -1103,7 +1103,7 @@ - + True False @@ -1154,7 +1154,7 @@ - + True False @@ -1205,7 +1205,7 @@ - + True False @@ -1240,7 +1240,7 @@ - + True False @@ -1275,7 +1275,7 @@ - + True False @@ -1310,7 +1310,7 @@ - + True False @@ -1345,7 +1345,7 @@ - + True False @@ -1380,7 +1380,7 @@ - + True False @@ -1415,7 +1415,7 @@ - + True False @@ -1466,7 +1466,7 @@ - + True False @@ -1501,7 +1501,7 @@ - + True False @@ -1536,7 +1536,7 @@ - + True False @@ -1571,7 +1571,7 @@ - + True False @@ -1606,7 +1606,7 @@ - + True False @@ -1641,7 +1641,7 @@ - + True False @@ -1676,7 +1676,7 @@ - + True False diff --git a/cui/uiconfig/ui/effectspage.ui b/cui/uiconfig/ui/effectspage.ui index 1e9171cae8ad..bf80526b73e2 100644 --- a/cui/uiconfig/ui/effectspage.ui +++ b/cui/uiconfig/ui/effectspage.ui @@ -324,7 +324,7 @@ - + True False @@ -389,7 +389,7 @@ - + True False @@ -399,7 +399,7 @@ - + True False diff --git a/cui/uiconfig/ui/gradientpage.ui b/cui/uiconfig/ui/gradientpage.ui index 8ab982badffd..96bb4baa9d84 100644 --- a/cui/uiconfig/ui/gradientpage.ui +++ b/cui/uiconfig/ui/gradientpage.ui @@ -450,7 +450,7 @@ - + True False 0 @@ -496,7 +496,7 @@ 3 6 - + True False 0 diff --git a/cui/uiconfig/ui/hatchpage.ui b/cui/uiconfig/ui/hatchpage.ui index fd12b3e547f7..365ce1ba5927 100644 --- a/cui/uiconfig/ui/hatchpage.ui +++ b/cui/uiconfig/ui/hatchpage.ui @@ -266,7 +266,7 @@ - + True False @@ -292,7 +292,7 @@ - + True False diff --git a/cui/uiconfig/ui/linetabpage.ui b/cui/uiconfig/ui/linetabpage.ui index 0060a6fef564..26dd4db2b166 100644 --- a/cui/uiconfig/ui/linetabpage.ui +++ b/cui/uiconfig/ui/linetabpage.ui @@ -156,7 +156,7 @@ - + True False diff --git a/cui/uiconfig/ui/numberingoptionspage.ui b/cui/uiconfig/ui/numberingoptionspage.ui index 71f392aab6df..b1035671e78a 100644 --- a/cui/uiconfig/ui/numberingoptionspage.ui +++ b/cui/uiconfig/ui/numberingoptionspage.ui @@ -485,7 +485,7 @@ - + True False diff --git a/cui/uiconfig/ui/optchartcolorspage.ui b/cui/uiconfig/ui/optchartcolorspage.ui index 3cadc55c6bec..3d1fc1a40b83 100644 --- a/cui/uiconfig/ui/optchartcolorspage.ui +++ b/cui/uiconfig/ui/optchartcolorspage.ui @@ -26,8 +26,7 @@ 6 12 - - False + True True True diff --git a/cui/uiconfig/ui/patterntabpage.ui b/cui/uiconfig/ui/patterntabpage.ui index 03bfe52c374e..309608cd34ba 100644 --- a/cui/uiconfig/ui/patterntabpage.ui +++ b/cui/uiconfig/ui/patterntabpage.ui @@ -185,7 +185,7 @@ - + True False start @@ -223,7 +223,7 @@ - + True False start diff --git a/cui/uiconfig/ui/shadowtabpage.ui b/cui/uiconfig/ui/shadowtabpage.ui index de63629337d3..98c2563b5b14 100644 --- a/cui/uiconfig/ui/shadowtabpage.ui +++ b/cui/uiconfig/ui/shadowtabpage.ui @@ -99,7 +99,7 @@ - + True False start diff --git a/extensions/source/propctrlr/commoncontrol.cxx b/extensions/source/propctrlr/commoncontrol.cxx index 745880465b52..6e9cb6be093d 100644 --- a/extensions/source/propctrlr/commoncontrol.cxx +++ b/extensions/source/propctrlr/commoncontrol.cxx @@ -104,6 +104,11 @@ namespace pcr setModified(); } + IMPL_LINK_NOARG( CommonBehaviourControlHelper, ColorModifiedHdl, SvxColorListBox&, void ) + { + setModified(); + } + IMPL_LINK_NOARG( CommonBehaviourControlHelper, GetFocusHdl, Control&, void ) { try diff --git a/extensions/source/propctrlr/commoncontrol.hxx b/extensions/source/propctrlr/commoncontrol.hxx index 05771dd061f3..0d46aaa5bcce 100644 --- a/extensions/source/propctrlr/commoncontrol.hxx +++ b/extensions/source/propctrlr/commoncontrol.hxx @@ -32,6 +32,7 @@ class NotifyEvent; class Control; class ListBox; +class SvxColorListBox; class Edit; namespace pcr @@ -90,6 +91,7 @@ namespace pcr /// may be used by derived classes, they forward the event to the PropCtrListener DECL_LINK( ModifiedHdl, ListBox&, void ); + DECL_LINK( ColorModifiedHdl, SvxColorListBox&, void ); DECL_LINK( EditModifiedHdl, Edit&, void ); DECL_LINK( GetFocusHdl, Control&, void ); DECL_LINK( LoseFocusHdl, Control&, void ); @@ -150,8 +152,9 @@ namespace pcr inline void impl_checkDisposed_throw(); private: VclPtr m_pControlWindow; - void implSetModifyHandler(std::true_type); - void implSetModifyHandler(std::false_type); + void implSetModifyHandler(const Edit&); + void implSetModifyHandler(const ListBox&); + void implSetModifyHandler(const SvxColorListBox&); }; @@ -165,7 +168,7 @@ namespace pcr { if ( _bDoSetHandlers ) { - implSetModifyHandler(std::is_base_of<::Edit,TControlWindow>()); + implSetModifyHandler(*m_pControlWindow); m_pControlWindow->SetGetFocusHdl( LINK( this, CommonBehaviourControlHelper, GetFocusHdl ) ); m_pControlWindow->SetLoseFocusHdl( LINK( this, CommonBehaviourControlHelper, LoseFocusHdl ) ); } @@ -173,17 +176,23 @@ namespace pcr } template< class TControlInterface, class TControlWindow > - inline void CommonBehaviourControl< TControlInterface, TControlWindow >::implSetModifyHandler(std::true_type) + inline void CommonBehaviourControl< TControlInterface, TControlWindow >::implSetModifyHandler(const Edit&) { m_pControlWindow->SetModifyHdl( LINK( this, CommonBehaviourControlHelper, EditModifiedHdl ) ); } template< class TControlInterface, class TControlWindow > - inline void CommonBehaviourControl< TControlInterface, TControlWindow >::implSetModifyHandler(std::false_type) + inline void CommonBehaviourControl< TControlInterface, TControlWindow >::implSetModifyHandler(const ListBox&) { m_pControlWindow->SetModifyHdl( LINK( this, CommonBehaviourControlHelper, ModifiedHdl ) ); } + template< class TControlInterface, class TControlWindow > + inline void CommonBehaviourControl< TControlInterface, TControlWindow >::implSetModifyHandler(const SvxColorListBox&) + { + m_pControlWindow->SetModifyHdl( LINK( this, CommonBehaviourControlHelper, ColorModifiedHdl ) ); + } + template< class TControlInterface, class TControlWindow > inline void CommonBehaviourControl< TControlInterface, TControlWindow >::impl_checkDisposed_throw() { diff --git a/extensions/source/propctrlr/standardcontrol.cxx b/extensions/source/propctrlr/standardcontrol.cxx index ca2412f9dbad..7d422966aff4 100644 --- a/extensions/source/propctrlr/standardcontrol.cxx +++ b/extensions/source/propctrlr/standardcontrol.cxx @@ -657,141 +657,50 @@ namespace pcr return aStr.makeStringAndClear(); } - OColorControl::OColorControl(vcl::Window* pParent, WinBits nWinStyle) - :OColorControl_Base( PropertyControlType::ColorListBox, pParent, nWinStyle ) + : OColorControl_Base(PropertyControlType::ColorListBox, pParent, nWinStyle) { - // initialize the color listbox - XColorListRef pColorList; - SfxObjectShell* pDocSh = SfxObjectShell::Current(); - const SfxPoolItem* pItem = pDocSh ? pDocSh->GetItem( SID_COLOR_TABLE ) : nullptr; - if ( pItem ) - { - DBG_ASSERT(dynamic_cast< const SvxColorListItem* >(pItem) != nullptr, "OColorControl::OColorControl: invalid color item!"); - pColorList = static_cast( pItem )->GetColorList(); - } - - if ( !pColorList.is() ) - pColorList = XColorList::GetStdColorList(); - - - DBG_ASSERT(pColorList.is(), "OColorControl::OColorControl: no color table!"); - - if ( pColorList.is() ) - { - for (long i = 0; i < pColorList->Count(); ++i) - { - const XColorEntry* pEntry = pColorList->GetColor(i); - getTypedControlWindow()->InsertEntry( pEntry->GetColor(), pEntry->GetName() ); - } - } - - getTypedControlWindow()->SetDropDownLineCount( LB_DEFAULT_COUNT ); - if ( ( nWinStyle & WB_READONLY ) != 0 ) - { - getTypedControlWindow()->SetReadOnly(); - getTypedControlWindow()->Enable(); - } } - void SAL_CALL OColorControl::setValue( const Any& _rValue ) throw (IllegalTypeException, RuntimeException, std::exception) { if ( _rValue.hasValue() ) { css::util::Color nColor = COL_TRANSPARENT; - if ( _rValue >>= nColor ) - { - ::Color aRgbCol((ColorData)nColor); - - getTypedControlWindow()->SelectEntry( aRgbCol ); - if ( !getTypedControlWindow()->IsEntrySelected( aRgbCol ) ) - { // the given color is not part of the list -> insert a new entry with the hex code of the color - OUString aStr("0x"); - aStr += MakeHexStr(nColor,8); - getTypedControlWindow()->InsertEntry( aRgbCol, aStr ); - getTypedControlWindow()->SelectEntry( aRgbCol ); - } - } - else - { - OUString sNonColorValue; - if ( !( _rValue >>= sNonColorValue ) ) - throw IllegalTypeException(); - getTypedControlWindow()->SelectEntry( sNonColorValue ); - if ( !getTypedControlWindow()->IsEntrySelected( sNonColorValue ) ) - getTypedControlWindow()->SetNoSelection(); - } + _rValue >>= nColor; + ::Color aRgbCol((ColorData)nColor); + getTypedControlWindow()->SelectEntry(std::make_pair(aRgbCol, MakeHexStr(nColor, 8))); } else getTypedControlWindow()->SetNoSelection(); } - Any SAL_CALL OColorControl::getValue() throw (RuntimeException, std::exception) { Any aPropValue; - if ( getTypedControlWindow()->GetSelectEntryCount() > 0 ) + if (!getTypedControlWindow()->IsNoSelection()) { - OUString sSelectedEntry = getTypedControlWindow()->GetSelectEntry(); - if ( m_aNonColorEntries.find( sSelectedEntry ) != m_aNonColorEntries.end() ) - aPropValue <<= sSelectedEntry; - else - { - ::Color aRgbCol = getTypedControlWindow()->GetSelectEntryColor(); - aPropValue <<= (css::util::Color)aRgbCol.GetColor(); - } + ::Color aRgbCol = getTypedControlWindow()->GetSelectEntryColor(); + aPropValue <<= (css::util::Color)aRgbCol.GetColor(); } return aPropValue; } - Type SAL_CALL OColorControl::getValueType() throw (RuntimeException, std::exception) { return ::cppu::UnoType::get(); } - - void SAL_CALL OColorControl::clearList() throw (RuntimeException, std::exception) - { - getTypedControlWindow()->Clear(); - } - - - void SAL_CALL OColorControl::prependListEntry( const OUString& NewEntry ) throw (RuntimeException, std::exception) - { - getTypedControlWindow()->InsertEntry( NewEntry, 0 ); - m_aNonColorEntries.insert( NewEntry ); - } - - - void SAL_CALL OColorControl::appendListEntry( const OUString& NewEntry ) throw (RuntimeException, std::exception) - { - getTypedControlWindow()->InsertEntry( NewEntry ); - m_aNonColorEntries.insert( NewEntry ); - } - - Sequence< OUString > SAL_CALL OColorControl::getListEntries( ) throw (RuntimeException, std::exception) - { - if ( !m_aNonColorEntries.empty() ) - return Sequence< OUString >(&(*m_aNonColorEntries.begin()),m_aNonColorEntries.size()); - return Sequence< OUString >(); - } - - void OColorControl::setModified() { OColorControl_Base::setModified(); - if ( !getTypedControlWindow()->IsTravelSelect() ) - // fire a commit - notifyModifiedValue(); + // fire a commit + notifyModifiedValue(); } - //= OListboxControl - OListboxControl::OListboxControl( vcl::Window* pParent, WinBits nWinStyle) :OListboxControl_Base( PropertyControlType::ListBox, pParent, nWinStyle ) { diff --git a/extensions/source/propctrlr/standardcontrol.hxx b/extensions/source/propctrlr/standardcontrol.hxx index ab026d6e2ec4..d3f64e703276 100644 --- a/extensions/source/propctrlr/standardcontrol.hxx +++ b/extensions/source/propctrlr/standardcontrol.hxx @@ -34,6 +34,7 @@ #include #include #include +#include #include @@ -60,18 +61,18 @@ namespace pcr TListboxWindow::SetSelectHdl( LINK(this, ListLikeControlWithModifyHandler, OnSelect) ); } - void SetModifyHdl( const Link& _rLink ) { aModifyHdl = _rLink;; } + void SetModifyHdl( const Link& _rLink ) { aModifyHdl = _rLink;; } private: - DECL_LINK(OnSelect, ListBox&, void); - Link aModifyHdl; + DECL_LINK(OnSelect, TListboxWindow&, void); + Link aModifyHdl; }; template< class LISTBOX_WINDOW > - void ListLikeControlWithModifyHandler< LISTBOX_WINDOW >::LinkStubOnSelect(void * instance, ListBox& data) { + void ListLikeControlWithModifyHandler< LISTBOX_WINDOW >::LinkStubOnSelect(void * instance, LISTBOX_WINDOW& data) { return static_cast *>(instance)->OnSelect(data); } template< class LISTBOX_WINDOW > - void ListLikeControlWithModifyHandler< LISTBOX_WINDOW >::OnSelect(ListBox& rListBox) + void ListLikeControlWithModifyHandler< LISTBOX_WINDOW >::OnSelect(LISTBOX_WINDOW& rListBox) { aModifyHdl.Call(rListBox); } @@ -260,14 +261,11 @@ namespace pcr //= OColorControl - typedef CommonBehaviourControl < css::inspection::XStringListControl - , ListLikeControlWithModifyHandler< ColorListBox > + typedef CommonBehaviourControl < css::inspection::XPropertyControl + , ListLikeControlWithModifyHandler > OColorControl_Base; class OColorControl : public OColorControl_Base { - private: - ::std::set< OUString > m_aNonColorEntries; - public: OColorControl( vcl::Window* pParent, WinBits nWinStyle ); @@ -276,12 +274,6 @@ namespace pcr virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::beans::IllegalTypeException, css::uno::RuntimeException, std::exception) override; virtual css::uno::Type SAL_CALL getValueType() throw (css::uno::RuntimeException, std::exception) override; - // XStringListControl - virtual void SAL_CALL clearList( ) throw (css::uno::RuntimeException, std::exception) override; - virtual void SAL_CALL prependListEntry( const OUString& NewEntry ) throw (css::uno::RuntimeException, std::exception) override; - virtual void SAL_CALL appendListEntry( const OUString& NewEntry ) throw (css::uno::RuntimeException, std::exception) override; - virtual css::uno::Sequence< OUString > SAL_CALL getListEntries( ) throw (css::uno::RuntimeException, std::exception) override; - protected: // CommonBehaviourControlHelper::setModified virtual void setModified() override; diff --git a/extras/source/glade/libreoffice-catalog.xml.in b/extras/source/glade/libreoffice-catalog.xml.in index b19f135e738d..84a0558def61 100644 --- a/extras/source/glade/libreoffice-catalog.xml.in +++ b/extras/source/glade/libreoffice-catalog.xml.in @@ -94,29 +94,11 @@ - - - - - GParamBoolean - - - - - - - - GParamBoolean - - - - diff --git a/include/sfx2/controlwrapper.hxx b/include/sfx2/controlwrapper.hxx index 079258dbfc1a..1e4a2c8f28f2 100644 --- a/include/sfx2/controlwrapper.hxx +++ b/include/sfx2/controlwrapper.hxx @@ -115,7 +115,7 @@ private: | +- DummyWindowWrapper [1] | +- CheckBoxWrapper [1] | +- EditWrapper [1] - | +- ColorListBoxWrapper [1] + | +- SvxColorListBoxWrapper [1] | | | +- MetricFieldWrapper< ValueT > [1] | | | @@ -241,26 +241,6 @@ public: }; -/** A wrapper for the SVTOOLS ColorListBox. */ -class SFX2_DLLPUBLIC ColorListBoxWrapper: - public SingleControlWrapper< ColorListBox, Color > -{ - /* Note: cannot use 'const Color&' as template argument, because the - SVTOOLS ColorListBox returns the color by value and not by reference, - therefore GetControlValue() must return a temporary object too. */ -public: - explicit ColorListBoxWrapper(ColorListBox & rListBox); - - virtual ~ColorListBoxWrapper() override; - - virtual bool IsControlDontKnow() const override; - virtual void SetControlDontKnow( bool bSet ) override; - - virtual Color GetControlValue() const override; - virtual void SetControlValue( Color aColor ) override; -}; - - /** A wrapper for the VCL MetricField. Adds support for field units during accessing the control value. The diff --git a/include/svtools/ctrlbox.hxx b/include/svtools/ctrlbox.hxx index c1ad071123eb..cb5e29d8ada3 100644 --- a/include/svtools/ctrlbox.hxx +++ b/include/svtools/ctrlbox.hxx @@ -33,26 +33,13 @@ #include class FontList; -class ImplColorListData; class ImpLineListData; -typedef ::std::vector< ImplColorListData* > ImpColorList; typedef ::std::vector< ImpLineListData* > ImpLineList; typedef ::std::vector< FontMetric > ImplFontList; /************************************************************************* -Description -============ - -class ColorListBox - -Description - -Allows color selection - --------------------------------------------------------------------------- - class LineListBox Description @@ -141,75 +128,6 @@ FontList; FontNameBox; FontStyleBox; FontSizeMenu *************************************************************************/ -class SVT_DLLPUBLIC ColorListBox : public ListBox -{ - ImpColorList* pColorList; // separate liste, in case of user data are required from outside - Size aImageSize; - - using Window::ImplInit; - SVT_DLLPRIVATE void ImplInit(); - SVT_DLLPRIVATE void ImplDestroyColorEntries(); - -public: - ColorListBox( vcl::Window* pParent, - WinBits nWinStyle = WB_BORDER ); - virtual ~ColorListBox() override; - virtual void dispose() override; - - virtual void UserDraw( const UserDrawEvent& rUDEvt ) override; - - using ListBox::InsertEntry; - sal_Int32 InsertEntry( const OUString& rStr, - sal_Int32 nPos = LISTBOX_APPEND ); - sal_Int32 InsertEntry( const Color& rColor, const OUString& rStr, - sal_Int32 nPos = LISTBOX_APPEND ); - void InsertAutomaticEntryColor(const Color &rAutoColorValue); - bool IsAutomaticSelected() { return !GetSelectEntryPos(); } - using ListBox::RemoveEntry; - void RemoveEntry( sal_Int32 nPos ); - void Clear(); - void CopyEntries( const ColorListBox& rBox ); - - using ListBox::GetEntryPos; - sal_Int32 GetEntryPos( const Color& rColor ) const; - Color GetEntryColor( sal_Int32 nPos ) const; - - void SelectEntry( const OUString& rStr ) - { ListBox::SelectEntry( rStr ); } - void SelectEntry( const Color& rColor ); - Color GetSelectEntryColor() const; - using ListBox::IsEntrySelected; - - bool IsEntrySelected(const Color& rColor) const - { - sal_Int32 nPos = GetEntryPos( rColor ); - if ( nPos != LISTBOX_ENTRY_NOTFOUND ) - return IsEntryPosSelected( nPos ); - else - return false; - } - -private: - ColorListBox( const ColorListBox& ) = delete; - ColorListBox& operator =( const ColorListBox& ) = delete; -}; - -inline void ColorListBox::SelectEntry( const Color& rColor ) -{ - sal_Int32 nPos = GetEntryPos( rColor ); - if ( nPos != LISTBOX_ENTRY_NOTFOUND ) - ListBox::SelectEntryPos( nPos ); -} - -inline Color ColorListBox::GetSelectEntryColor() const -{ - sal_Int32 nPos = GetSelectEntryPos(); - Color aColor; - if ( nPos != LISTBOX_ENTRY_NOTFOUND ) - aColor = GetEntryColor( nPos ); - return aColor; -} - /** Class computing border widths shared between Line style listbox and the SvxBorderLine implementation. diff --git a/include/svtools/svtools.hrc b/include/svtools/svtools.hrc index 92cc8092ab7d..c149f8643c31 100644 --- a/include/svtools/svtools.hrc +++ b/include/svtools/svtools.hrc @@ -26,8 +26,6 @@ // various unsorted stuff -#define STR_SVT_AUTOMATIC_COLOR (RID_SVTOOLS_START+16) - #define STR_SVT_FILEVIEW_COLUMN_TITLE (RID_SVTOOLS_START + 20) #define STR_SVT_FILEVIEW_COLUMN_SIZE (RID_SVTOOLS_START + 21) #define STR_SVT_FILEVIEW_COLUMN_DATE (RID_SVTOOLS_START + 22) diff --git a/include/svx/PaletteManager.hxx b/include/svx/PaletteManager.hxx index c527b85f0f88..2347f0f65ef5 100644 --- a/include/svx/PaletteManager.hxx +++ b/include/svx/PaletteManager.hxx @@ -48,11 +48,10 @@ class SVX_DLLPUBLIC PaletteManager XColorListRef pColorList; Color mLastColor; - typedef std::pair color_and_name; - std::deque maRecentColors; + std::deque maRecentColors; std::vector> m_Palettes; - std::function maColorSelectFunction; + std::function maColorSelectFunction; css::uno::Reference < css::uno::XComponentContext > m_context; public: PaletteManager(); @@ -74,14 +73,14 @@ public: const Color& GetLastColor(); void SetLastColor(const Color& rLastColor); - void AddRecentColor(const Color& rRecentColor, const OUString& rColorName); + void AddRecentColor(const Color& rRecentColor, const OUString& rColorName, bool bFront = true); void SetBtnUpdater(svx::ToolboxButtonColorUpdater* pBtnUpdater); void PopupColorPicker(const OUString& aCommand); - void SetColorSelectFunction(const std::function& aColorSelectFunction); + void SetColorSelectFunction(const std::function& aColorSelectFunction); - static void DispatchColorCommand(const OUString& aCommand, const Color& rColor); + static void DispatchColorCommand(const OUString& aCommand, const NamedColor& rColor); }; #endif // INCLUDED_SVX_PALETTEMANAGER_HXX diff --git a/include/svx/bmpmask.hxx b/include/svx/bmpmask.hxx index 1f66ee5ef7b5..6705b1c5fe5b 100644 --- a/include/svx/bmpmask.hxx +++ b/include/svx/bmpmask.hxx @@ -75,6 +75,7 @@ class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxBmpMaskChildWindow : public SfxChildWindo class MaskData; class MaskSet; class ColorWindow; +class SvxColorListBox; class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxBmpMask : public SfxDockingWindow { @@ -88,28 +89,27 @@ class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxBmpMask : public SfxDockingWindow VclPtr m_pCbx1; VclPtr m_pQSet1; VclPtr m_pSp1; - VclPtr m_pLbColor1; + VclPtr m_pLbColor1; VclPtr m_pCbx2; VclPtr m_pQSet2; VclPtr m_pSp2; - VclPtr m_pLbColor2; + VclPtr m_pLbColor2; VclPtr m_pCbx3; VclPtr m_pQSet3; VclPtr m_pSp3; - VclPtr m_pLbColor3; + VclPtr m_pLbColor3; VclPtr m_pCbx4; VclPtr m_pQSet4; VclPtr m_pSp4; - VclPtr m_pLbColor4; + VclPtr m_pLbColor4; MaskData* pData; VclPtr m_pCbxTrans; - VclPtr m_pLbColorTrans; + VclPtr m_pLbColorTrans; - XColorListRef pColLst; Color aPipetteColor; SvxBmpMaskSelectItem aSelItem; @@ -140,9 +140,6 @@ public: void SetColor( const Color& rColor ); void PipetteClicked(); - bool NeedsColorList() const; - void SetColorList( const XColorListRef &pColorList ); - void SetExecState( bool bEnable ); Graphic Mask( const Graphic& rGraphic ); diff --git a/include/svx/colorbox.hxx b/include/svx/colorbox.hxx new file mode 100644 index 000000000000..4b7f2513a984 --- /dev/null +++ b/include/svx/colorbox.hxx @@ -0,0 +1,94 @@ +/* -*- 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/. + */ + +#ifndef INCLUDED_SVX_COLORBOX_HXX +#define INCLUDED_SVX_COLORBOX_HXX + +#include +#include +#include + +class SvxColorListBox; + +class SvxListBoxColorWrapper +{ +public: + SvxListBoxColorWrapper(SvxColorListBox* pControl); + void operator()(const OUString& rCommand, const NamedColor& rColor); + void dispose(); +private: + VclPtr mxControl; +}; + +class SVX_DLLPUBLIC SvxColorListBox : public MenuButton +{ +private: + friend class SvxListBoxColorWrapper; + VclPtr m_xColorWindow; + Link m_aSelectedLink; + SvxListBoxColorWrapper m_aColorWrapper; + Color m_aAutoDisplayColor; + NamedColor m_aSelectedColor; + sal_uInt16 m_nSlotId; + bool m_bShowNoneButton; + PaletteManager m_aPaletteManager; + BorderColorStatus m_aBorderColorStatus; + + DECL_LINK(MenuActivateHdl, MenuButton *, void); + void Selected(const NamedColor& rNamedColor); + void createColorWindow(); + void LockWidthRequest(); + VclPtr getColorWindow() const; +public: + SvxColorListBox(vcl::Window* pParent, WinBits nStyle = 0); + virtual ~SvxColorListBox() override; + virtual void dispose() override; + + void SetSelectHdl(const Link& rLink) + { + m_aSelectedLink = rLink; + } + + void SetSlotId(sal_uInt16 nSlotId, bool bShowNoneButton = false); + + NamedColor GetSelectEntry() const; + Color GetSelectEntryColor() const; + + void SelectEntry(const NamedColor& rColor); + void SelectEntry(const Color& rColor); + + void SetNoSelection() { getColorWindow()->SetNoSelection(); } + bool IsNoSelection() const { return getColorWindow()->IsNoSelection(); } + + void SetAutoDisplayColor(const Color &rColor) { m_aAutoDisplayColor = rColor; } + void ShowPreview(const NamedColor &rColor); +}; + +/** A wrapper for SvxColorListBox. */ +class SVX_DLLPUBLIC SvxColorListBoxWrapper + : public sfx::SingleControlWrapper +{ + /* Note: cannot use 'const Color&' as template argument, because the + SvxColorListBox returns the color by value and not by reference, + therefore GetControlValue() must return a temporary object too. */ +public: + explicit SvxColorListBoxWrapper(SvxColorListBox& rListBox); + + virtual ~SvxColorListBoxWrapper() override; + + virtual bool IsControlDontKnow() const override; + virtual void SetControlDontKnow( bool bSet ) override; + + virtual Color GetControlValue() const override; + virtual void SetControlValue( Color aColor ) override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/colorwindow.hxx b/include/svx/colorwindow.hxx index 8b185d952de3..1e417130effb 100644 --- a/include/svx/colorwindow.hxx +++ b/include/svx/colorwindow.hxx @@ -31,8 +31,22 @@ #include -class BorderColorStatus; +class SVX_DLLPUBLIC BorderColorStatus +{ + Color maColor; + Color maTLBRColor; + Color maBLTRColor; +public: + BorderColorStatus(); + ~BorderColorStatus(); + bool statusChanged( const css::frame::FeatureStateEvent& rEvent ); + Color GetColor(); +}; + class Button; +typedef std::function ColorSelectFunction; + +#define COL_NONE_COLOR TRGB_COLORDATA(0x80, 0xFF, 0xFF, 0xFF) class SVX_DLLPUBLIC SvxColorWindow : public SfxPopupWindow { @@ -43,37 +57,49 @@ private: VclPtr mpPaletteListBox; VclPtr mpButtonAutoColor; + VclPtr mpButtonNoneColor; VclPtr mpButtonPicker; VclPtr mpAutomaticSeparator; OUString maCommand; - Link maSelectedLink; + Link maSelectedLink; PaletteManager& mrPaletteManager; BorderColorStatus& mrBorderColorStatus; - std::function maColorSelectFunction; + ColorSelectFunction maColorSelectFunction; DECL_LINK( SelectHdl, ValueSet*, void ); DECL_LINK( SelectPaletteHdl, ListBox&, void); DECL_LINK( AutoColorClickHdl, Button*, void ); DECL_LINK( OpenPickerClickHdl, Button*, void ); + static bool SelectValueSetEntry(SvxColorValueSet* pColorSet, const Color& rColor); + static NamedColor GetSelectEntryColor(ValueSet* pColorSet); + NamedColor GetAutoColor() const; + NamedColor GetNoneColor() const; + public: - SvxColorWindow( const OUString& rCommand, - PaletteManager& rPaletteManager, - BorderColorStatus& rBorderColorStatus, - sal_uInt16 nSlotId, - const css::uno::Reference< css::frame::XFrame >& rFrame, - vcl::Window* pParentWindow, - std::function const & maColorSelectFunction); + SvxColorWindow(const OUString& rCommand, + PaletteManager& rPaletteManager, + BorderColorStatus& rBorderColorStatus, + sal_uInt16 nSlotId, + const css::uno::Reference< css::frame::XFrame >& rFrame, + vcl::Window* pParentWindow, + ColorSelectFunction const& rColorSelectFunction); virtual ~SvxColorWindow() override; virtual void dispose() override; + void ShowNoneButton(); void StartSelection(); + void SetNoSelection(); + bool IsNoSelection() const; + void SelectEntry(const NamedColor& rColor); + void SelectEntry(const Color& rColor); + NamedColor GetSelectEntryColor() const; virtual void KeyInput( const KeyEvent& rKEvt ) override; virtual void statusChanged( const css::frame::FeatureStateEvent& rEvent ) override; - void SetSelectedHdl( const Link& rLink ) { maSelectedLink = rLink; } + void SetSelectedHdl( const Link& rLink ) { maSelectedLink = rLink; } }; #endif diff --git a/include/svx/dialogs.hrc b/include/svx/dialogs.hrc index 3ccea55d2a4a..589b6a8a7413 100644 --- a/include/svx/dialogs.hrc +++ b/include/svx/dialogs.hrc @@ -31,8 +31,10 @@ // some strings also used in CUI #define RID_SVXERRCTX (RID_SVX_START + 351) #define RID_SVXSTR_COLOR (RID_SVX_START + 179) -#define RID_SVXSTR_TRANSPARENT (RID_SVX_START + 190) +#define RID_SVXSTR_NOFILL (RID_SVX_START + 190) #define RID_SVXSTR_AUTOMATIC (RID_SVX_START + 841) +#define RID_SVXSTR_BY_AUTHOR (RID_SVX_START + 842) +#define RID_SVXSTR_TRANSPARENT (RID_SVX_START + 843) #define RID_SVXSTR_INVISIBLE (RID_SVX_START + 178) #define RID_SVXSTR_NONE (RID_SVX_START + 183) #define RID_SVXSTR_SOLID (RID_SVX_START + 160) @@ -147,9 +149,6 @@ #define RID_SVXIMAGE_COLORDLG (RID_SVX_START + 214) #define RID_SVXFLOAT3D_FAVORITE (RID_SVX_START + 73) -#define RID_SVXFLOAT3D_FIX_X (RID_SVX_START + 74) -#define RID_SVXFLOAT3D_FIX_Y (RID_SVX_START + 75) -#define RID_SVXFLOAT3D_FIX_Z (RID_SVX_START + 76) #define RID_SVXFLOAT3D_FIX_R (RID_SVX_START + 77) #define RID_SVXFLOAT3D_FIX_G (RID_SVX_START + 78) #define RID_SVXFLOAT3D_FIX_B (RID_SVX_START + 84) diff --git a/include/svx/dlgctrl.hxx b/include/svx/dlgctrl.hxx index fbf9369eb608..39cc688b4ded 100644 --- a/include/svx/dlgctrl.hxx +++ b/include/svx/dlgctrl.hxx @@ -207,20 +207,6 @@ public: /************************************************************************/ -class SAL_WARN_UNUSED SVX_DLLPUBLIC ColorLB : public ColorListBox -{ - -public: - ColorLB( vcl::Window* pParent, WinBits aWB ) : ColorListBox( pParent, aWB ) {} - - void Fill( const XColorListRef &pTab ); - - void Append( const XColorEntry& rEntry ); - void Modify( const XColorEntry& rEntry, sal_Int32 nPos ); -}; - -/************************************************************************/ - class SAL_WARN_UNUSED SVX_DLLPUBLIC HatchingLB : public ListBox { public: @@ -245,7 +231,7 @@ public: /************************************************************************/ -class SAL_WARN_UNUSED SVX_DLLPUBLIC FillAttrLB : public ColorListBox +class SAL_WARN_UNUSED SVX_DLLPUBLIC FillAttrLB : public ListBox { private: BitmapEx maBitmapEx; diff --git a/include/svx/float3d.hxx b/include/svx/float3d.hxx index c9a9f957701c..396d104a9f53 100644 --- a/include/svx/float3d.hxx +++ b/include/svx/float3d.hxx @@ -41,14 +41,13 @@ enum class ViewType3D Material }; -class SdrModel; class FmFormModel; class VirtualDevice; class E3dView; class SdrPageView; class Svx3DCtrlItem; class SvxConvertTo3DItem; - +class SvxColorListBox; struct Svx3DWinImpl; @@ -113,16 +112,16 @@ private: VclPtr m_pBtnLight6; VclPtr m_pBtnLight7; VclPtr m_pBtnLight8; - VclPtr m_pLbLight1; - VclPtr m_pLbLight2; - VclPtr m_pLbLight3; - VclPtr m_pLbLight4; - VclPtr m_pLbLight5; - VclPtr m_pLbLight6; - VclPtr m_pLbLight7; - VclPtr m_pLbLight8; + VclPtr m_pLbLight1; + VclPtr m_pLbLight2; + VclPtr m_pLbLight3; + VclPtr m_pLbLight4; + VclPtr m_pLbLight5; + VclPtr m_pLbLight6; + VclPtr m_pLbLight7; + VclPtr m_pLbLight8; VclPtr m_pBtnLightColor; - VclPtr m_pLbAmbientlight; // ListBox + VclPtr m_pLbAmbientlight; // ListBox VclPtr m_pBtnAmbientColor; // color button // Textures @@ -144,13 +143,13 @@ private: // material editor VclPtr m_pFLMaterial; VclPtr m_pLbMatFavorites; - VclPtr m_pLbMatColor; + VclPtr m_pLbMatColor; VclPtr m_pBtnMatColor; - VclPtr m_pLbMatEmission; + VclPtr m_pLbMatEmission; VclPtr m_pBtnEmissionColor; VclPtr m_pFLMatSpecular; - VclPtr m_pLbMatSpecular; + VclPtr m_pLbMatSpecular; VclPtr m_pBtnSpecularColor; VclPtr m_pMtrMatSpecularIntensity; @@ -191,6 +190,7 @@ private: DECL_LINK( ClickHdl, Button*, void ); DECL_LINK( ClickColorHdl, Button*, void ); DECL_LINK( SelectHdl, ListBox&, void ); + DECL_LINK( SelectColorHdl, SvxColorListBox&, void ); DECL_LINK( ModifyHdl, Edit&, void ); void ClickLight(PushButton &rBtn); @@ -199,9 +199,9 @@ private: SVX_DLLPRIVATE void Construct(); SVX_DLLPRIVATE void Reset(); - SVX_DLLPRIVATE static bool LBSelectColor( ColorLB* pLb, const Color& rColor ); + SVX_DLLPRIVATE static void LBSelectColor( SvxColorListBox* pLb, const Color& rColor ); SVX_DLLPRIVATE sal_uInt16 GetLightSource( const PushButton* pBtn ); - SVX_DLLPRIVATE ColorLB* GetLbByButton( const PushButton* pBtn = nullptr ); + SVX_DLLPRIVATE SvxColorListBox* GetLbByButton( const PushButton* pBtn = nullptr ); SVX_DLLPRIVATE bool GetUILightState( const PushButton& rBtn ) const; SVX_DLLPRIVATE void SetUILightState( PushButton& aBtn, bool bState ); @@ -215,7 +215,7 @@ public: virtual ~Svx3DWin() override; virtual void dispose() override; - void InitColorLB( const SdrModel* pDoc ); + void InitColorLB(); bool IsUpdateMode() const { return bUpdate; } void Update( SfxItemSet& rSet ); diff --git a/include/svx/fontwork.hxx b/include/svx/fontwork.hxx index 5fe6ad0f7eb3..83d1f3c11ec3 100644 --- a/include/svx/fontwork.hxx +++ b/include/svx/fontwork.hxx @@ -35,6 +35,7 @@ class SdrView; class SdrPageView; class SdrObject; +class SvxColorListBox; class XFormTextAdjustItem; class XFormTextDistanceItem; @@ -107,7 +108,7 @@ class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxFontWorkDialog : public SfxDockingWindow VclPtr m_pFbShadowY; VclPtr m_pMtrFldShadowY; - VclPtr m_pShadowColorLB; + VclPtr m_pShadowColorLB; SfxBindings& rBindings; Idle aInputIdle; @@ -138,8 +139,6 @@ class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxFontWorkDialog : public SfxDockingWindow long nSaveShadowAngle; long nSaveShadowSize; - XColorListRef pColorList; - friend class SvxFontWorkChildWindow; friend class SvxFontWorkControllerItem; @@ -150,7 +149,7 @@ class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxFontWorkDialog : public SfxDockingWindow DECL_LINK( ModifyInputHdl_Impl, Edit&, void ); DECL_LINK( InputTimoutHdl_Impl, Idle *, void ); - DECL_LINK( ColorSelectHdl_Impl, ListBox&, void ); + DECL_LINK( ColorSelectHdl_Impl, SvxColorListBox&, void ); void SetStyle_Impl(const XFormTextStyleItem*); void SetAdjust_Impl(const XFormTextAdjustItem*); @@ -175,8 +174,6 @@ class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxFontWorkDialog : public SfxDockingWindow vcl::Window* pParent); virtual ~SvxFontWorkDialog() override; virtual void dispose() override; - - void SetColorList(const XColorListRef &pTable); }; #endif // INCLUDED_SVX_FONTWORK_HXX diff --git a/include/svx/sidebar/AreaPropertyPanelBase.hxx b/include/svx/sidebar/AreaPropertyPanelBase.hxx index 9d7e62199f3e..372d216f68ba 100644 --- a/include/svx/sidebar/AreaPropertyPanelBase.hxx +++ b/include/svx/sidebar/AreaPropertyPanelBase.hxx @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -124,8 +125,8 @@ protected: VclPtr mpColorTextFT; VclPtr mpLbFillType; VclPtr mpLbFillAttr; - VclPtr mpLbFillGradFrom; - VclPtr mpLbFillGradTo; + VclPtr mpLbFillGradFrom; + VclPtr mpLbFillGradTo; VclPtr mpToolBoxColor; // for new color picker VclPtr mpTrspTextFT; VclPtr mpLBTransType; @@ -156,6 +157,7 @@ protected: DECL_LINK(SelectFillTypeHdl, ListBox&, void ); DECL_LINK(SelectFillAttrHdl, ListBox&, void ); + DECL_LINK(SelectFillColorHdl, SvxColorListBox&, void); DECL_LINK(ChangeGradientAngle, Edit&, void); DECL_LINK(ChangeTrgrTypeHdl_Impl, ListBox&, void); DECL_LINK(ModifyTransparentHdl_Impl, Edit&, void); diff --git a/include/svx/svxids.hrc b/include/svx/svxids.hrc index f2a301c63797..8a7f7c5fc4c5 100644 --- a/include/svx/svxids.hrc +++ b/include/svx/svxids.hrc @@ -750,7 +750,7 @@ #define SID_READONLY_MODE ( SID_SVX_START + 930 ) #define SID_ATTR_ALIGN_HYPHENATION ( SID_SVX_START + 931 ) #define SID_ATTR_NUMBERFORMAT_SOURCE ( SID_SVX_START + 932 ) -#define SID_ATTR_AUTO_COLOR_INVALID ( SID_SVX_START + 933 ) + #define SID_RULER_BORDER_DISTANCE ( SID_SVX_START + 935 ) #define SID_INSERT_DATEFIELD ( SID_SVX_START + 936 ) #define SID_INSERT_TIMEFIELD ( SID_SVX_START + 937 ) @@ -999,9 +999,11 @@ #define SID_LINE_ARROW_START ( SID_SVX_START + 1165 ) #define SID_LINE_ARROW_END ( SID_SVX_START + 1166 ) #define SID_DRAW_MEASURELINE ( SID_SVX_START + 1167 ) +#define SID_AUTHOR_COLOR ( SID_SVX_START + 1168 ) +#define SID_BMPMASK_COLOR ( SID_SVX_START + 1169 ) // IMPORTANT NOTE: adjust SID_SVX_FIRSTFREE, when adding new slot id -#define SID_SVX_FIRSTFREE ( SID_DRAW_MEASURELINE + 1 ) +#define SID_SVX_FIRSTFREE ( SID_BMPMASK_COLOR + 1 ) // Overflow check for slot IDs diff --git a/include/svx/tbcontrl.hxx b/include/svx/tbcontrl.hxx index dfa129a7c00b..bf808381c6ac 100644 --- a/include/svx/tbcontrl.hxx +++ b/include/svx/tbcontrl.hxx @@ -136,6 +136,7 @@ #include #include #include +#include #include #include @@ -203,19 +204,8 @@ friend class SfxStyleControllerItem_Impl; SVX_DLLPRIVATE SfxStyleFamily GetActFamily(); }; -class BorderColorStatus -{ - Color maColor; - Color maTLBRColor; - Color maBLTRColor; -public: - BorderColorStatus(); - ~BorderColorStatus(); - bool statusChanged( const css::frame::FeatureStateEvent& rEvent ); - Color GetColor(); -}; +typedef std::function ColorSelectFunction; -typedef std::function ColorSelectFunction; class SVX_DLLPUBLIC SvxColorToolBoxControl : public SfxToolBoxControl { std::unique_ptr m_xBtnUpdater; @@ -223,7 +213,7 @@ class SVX_DLLPUBLIC SvxColorToolBoxControl : public SfxToolBoxControl BorderColorStatus m_aBorderColorStatus; bool m_bSplitButton; ColorSelectFunction m_aColorSelectFunction; - DECL_LINK(SelectedHdl, const Color&, void); + DECL_LINK(SelectedHdl, const NamedColor&, void); public: SFX_DECL_TOOLBOX_CONTROL(); SvxColorToolBoxControl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rToolBox); 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 m_pCondition; - sal_uInt16 m_nSlotId; -public: - OColorPopup(vcl::Window* _pParent,Condition* _pCondition); - virtual ~OColorPopup() override; - virtual void dispose() override; - VclPtr 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::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::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::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 +#include #include #include @@ -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 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 m_pMoveDown; VclPtr m_pAddCondition; VclPtr m_pRemoveCondition; - VclPtr m_pColorFloat; + VclPtr m_pColorFloat; svx::ToolboxButtonColorUpdater* m_pBtnUpdaterFontColor; // updates the color below the toolbar icon svx::ToolboxButtonColorUpdater* m_pBtnUpdaterBackgroundColor; diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc index 26bd9e97885e..64ae387c84e3 100644 --- a/sc/inc/sc.hrc +++ b/sc/inc/sc.hrc @@ -827,7 +827,7 @@ #define SCSTR_ORIENTATION_TOPBOTTOM (STR_START + 110) #define SCSTR_ORIENTATION_BOTTOMTOP (STR_START + 111) #define SCSTR_ORIENTATION_STANDARD (STR_START + 112) -#define SCSTR_AUTHOR (STR_START + 113) +//free #define SCSTR_UNIT (STR_START + 114) // print options diff --git a/sc/source/ui/condformat/colorformat.cxx b/sc/source/ui/condformat/colorformat.cxx index ab2e08983b3f..f6e9ebc4eb9d 100644 --- a/sc/source/ui/condformat/colorformat.cxx +++ b/sc/source/ui/condformat/colorformat.cxx @@ -13,6 +13,7 @@ #include "document.hxx" #include "sc.hrc" +#include #include #include #include @@ -66,16 +67,6 @@ void SetValue( ScDocument* pDoc, ScColorScaleEntry* pEntry, Edit& aEdit) aEdit.Disable(); } -void SelectColor(const Color& aColor, const OUString & aCustomName, ColorListBox& rLstBox) -{ - rLstBox.SelectEntry( aColor ); - if ( rLstBox.GetSelectEntryColor() != aColor ) - { - rLstBox.InsertEntry( aColor, aCustomName ); - rLstBox.SelectEntry( aColor ); - } -} - } ScDataBarSettingsDlg::ScDataBarSettingsDlg(vcl::Window* pWindow, const ScDataBarFormatData& rData, ScDocument* pDoc, const ScAddress& rPos): @@ -100,14 +91,13 @@ ScDataBarSettingsDlg::ScDataBarSettingsDlg(vcl::Window* pWindow, const ScDataBar get( mpCbOnlyBar, "only_bar"); maStrWarnSameValue = get("str_same_value")->GetText(); - maCustomColor = get("custom_color")->GetText(); Init(); - ::SelectColor( rData.maPositiveColor, maCustomColor, *mpLbPos); + mpLbPos->SelectEntry(rData.maPositiveColor); mpLbFillType->SelectEntryPos( rData.mbGradient ? 1 : 0 ); - if(rData.mpNegativeColor) - ::SelectColor( *rData.mpNegativeColor, maCustomColor, *mpLbNeg ); + if (rData.mpNegativeColor) + mpLbNeg->SelectEntry(*rData.mpNegativeColor); switch (rData.meAxisPosition) { @@ -160,42 +150,9 @@ void ScDataBarSettingsDlg::dispose() void ScDataBarSettingsDlg::Init() { - SfxObjectShell* pDocSh = SfxObjectShell::Current(); - XColorListRef pColorTable; - - DBG_ASSERT( pDocSh, "DocShell not found!" ); - - if ( pDocSh ) - { - const SfxPoolItem* pItem = pDocSh->GetItem( SID_COLOR_TABLE ); - if ( pItem != nullptr ) - pColorTable = static_cast(pItem)->GetColorList(); - } - if ( pColorTable.is() ) - { - // filling the line color box - mpLbPos->SetUpdateMode( false ); - mpLbNeg->SetUpdateMode( false ); - mpLbAxisCol->SetUpdateMode( false ); - - for ( long i = 0; i < pColorTable->Count(); ++i ) - { - const XColorEntry* pEntry = pColorTable->GetColor(i); - mpLbPos->InsertEntry( pEntry->GetColor(), pEntry->GetName() ); - mpLbNeg->InsertEntry( pEntry->GetColor(), pEntry->GetName() ); - mpLbAxisCol->InsertEntry( pEntry->GetColor(), pEntry->GetName() ); - - if(pEntry->GetColor() == Color(COL_LIGHTRED)) - mpLbNeg->SelectEntryPos(i); - if(pEntry->GetColor() == Color(COL_BLACK)) - mpLbAxisCol->SelectEntryPos(i); - if(pEntry->GetColor() == Color(COL_LIGHTBLUE)) - mpLbPos->SelectEntryPos(i); - } - mpLbPos->SetUpdateMode( true ); - mpLbNeg->SetUpdateMode( true ); - mpLbAxisCol->SetUpdateMode( true ); - } + mpLbNeg->SelectEntry(Color(COL_LIGHTRED)); + mpLbAxisCol->SelectEntry(Color(COL_BLACK)); + mpLbPos->SelectEntry(Color(COL_LIGHTBLUE)); mpBtnOk->SetClickHdl( LINK( this, ScDataBarSettingsDlg, OkBtnHdl ) ); mpLbTypeMin->SetSelectHdl( LINK( this, ScDataBarSettingsDlg, TypeSelectHdl ) ); diff --git a/sc/source/ui/condformat/condformatdlgentry.cxx b/sc/source/ui/condformat/condformatdlgentry.cxx index 415aa11274e5..f4273992e9f4 100644 --- a/sc/source/ui/condformat/condformatdlgentry.cxx +++ b/sc/source/ui/condformat/condformatdlgentry.cxx @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -663,7 +664,7 @@ OUString convertNumberToString(double nVal, ScDocument* pDoc) return aText; } -void SetColorScaleEntryTypes( const ScColorScaleEntry& rEntry, ListBox& rLbType, Edit& rEdit, ColorListBox& rLbCol, ScDocument* pDoc ) +void SetColorScaleEntryTypes( const ScColorScaleEntry& rEntry, ListBox& rLbType, Edit& rEdit, SvxColorListBox& rLbCol, ScDocument* pDoc ) { // entry Automatic is not available for color scales sal_Int32 nIndex = static_cast(rEntry.GetType()); @@ -726,7 +727,7 @@ void SetColorScaleEntry( ScColorScaleEntry* pEntry, const ListBox& rType, const } } -ScColorScaleEntry* createColorScaleEntry( const ListBox& rType, const ColorListBox& rColor, const Edit& rValue, ScDocument* pDoc, const ScAddress& rPos ) +ScColorScaleEntry* createColorScaleEntry( const ListBox& rType, const SvxColorListBox& rColor, const Edit& rValue, ScDocument* pDoc, const ScAddress& rPos ) { ScColorScaleEntry* pEntry = new ScColorScaleEntry(); @@ -796,38 +797,8 @@ void ScColorScale2FrmtEntry::Init() { maLbEntryTypeMin->SetSelectHdl( LINK( this, ScColorScale2FrmtEntry, EntryTypeHdl ) ); maLbEntryTypeMax->SetSelectHdl( LINK( this, ScColorScale2FrmtEntry, EntryTypeHdl ) ); - - SfxObjectShell* pDocSh = SfxObjectShell::Current(); - XColorListRef pColorTable; - - DBG_ASSERT( pDocSh, "DocShell not found!" ); - - if ( pDocSh ) - { - const SfxPoolItem* pItem = pDocSh->GetItem( SID_COLOR_TABLE ); - if ( pItem != nullptr ) - pColorTable = static_cast(pItem) ->GetColorList(); - } - if ( pColorTable.is() ) - { - // filling the line color box - maLbColMin->SetUpdateMode( false ); - maLbColMax->SetUpdateMode( false ); - - for ( long i = 0; i < pColorTable->Count(); ++i ) - { - const XColorEntry* pEntry = pColorTable->GetColor(i); - maLbColMin->InsertEntry( pEntry->GetColor(), pEntry->GetName() ); - maLbColMax->InsertEntry( pEntry->GetColor(), pEntry->GetName() ); - - if(pEntry->GetColor() == Color(COL_LIGHTRED)) - maLbColMin->SelectEntryPos(i); - if(pEntry->GetColor() == Color(COL_LIGHTBLUE)) - maLbColMax->SelectEntryPos(i); - } - maLbColMin->SetUpdateMode( true ); - maLbColMax->SetUpdateMode( true ); - } + maLbColMin->SelectEntry(Color(COL_LIGHTRED)); + maLbColMax->SelectEntry(Color(COL_LIGHTBLUE)); } ScFormatEntry* ScColorScale2FrmtEntry::createColorscaleEntry() const @@ -976,43 +947,9 @@ void ScColorScale3FrmtEntry::Init() maLbEntryTypeMin->SetSelectHdl( LINK( this, ScColorScale3FrmtEntry, EntryTypeHdl ) ); maLbEntryTypeMax->SetSelectHdl( LINK( this, ScColorScale3FrmtEntry, EntryTypeHdl ) ); maLbEntryTypeMiddle->SetSelectHdl( LINK( this, ScColorScale3FrmtEntry, EntryTypeHdl ) ); - - SfxObjectShell* pDocSh = SfxObjectShell::Current(); - XColorListRef pColorTable; - - DBG_ASSERT( pDocSh, "DocShell not found!" ); - - if ( pDocSh ) - { - const SfxPoolItem* pItem = pDocSh->GetItem( SID_COLOR_TABLE ); - if ( pItem != nullptr ) - pColorTable = static_cast(pItem)->GetColorList(); - } - if ( pColorTable.is() ) - { - // filling the line color box - maLbColMin->SetUpdateMode( false ); - maLbColMiddle->SetUpdateMode( false ); - maLbColMax->SetUpdateMode( false ); - - for ( long i = 0; i < pColorTable->Count(); ++i ) - { - const XColorEntry* pEntry = pColorTable->GetColor(i); - maLbColMin->InsertEntry( pEntry->GetColor(), pEntry->GetName() ); - maLbColMiddle->InsertEntry( pEntry->GetColor(), pEntry->GetName() ); - maLbColMax->InsertEntry( pEntry->GetColor(), pEntry->GetName() ); - - if(pEntry->GetColor() == Color(COL_LIGHTRED)) - maLbColMin->SelectEntryPos(i); - if(pEntry->GetColor() == Color(COL_YELLOW)) - maLbColMiddle->SelectEntryPos(i); - if(pEntry->GetColor() == Color(0x00CC00)) // Green 3 - maLbColMax->SelectEntryPos(i); - } - maLbColMin->SetUpdateMode( true ); - maLbColMiddle->SetUpdateMode( true ); - maLbColMax->SetUpdateMode( true ); - } + maLbColMin->SelectEntry(Color(COL_LIGHTRED)); + maLbColMiddle->SelectEntry(Color(COL_YELLOW)); + maLbColMax->SelectEntry(Color(0x00CC00)); } ScFormatEntry* ScColorScale3FrmtEntry::createColorscaleEntry() const diff --git a/sc/source/ui/dbgui/scendlg.cxx b/sc/source/ui/dbgui/scendlg.cxx index 3cd9044ca12d..efcd657caed7 100644 --- a/sc/source/ui/dbgui/scendlg.cxx +++ b/sc/source/ui/dbgui/scendlg.cxx @@ -21,6 +21,7 @@ #include "scitems.hxx" #include +#include #include #include #include @@ -58,27 +59,6 @@ ScNewScenarioDlg::ScNewScenarioDlg( vcl::Window* pParent, const OUString& rName, if (bIsEdit) SetText(get("alttitle")->GetText()); - SfxObjectShell* pDocSh = SfxObjectShell::Current(); - if ( pDocSh ) - { - const SfxPoolItem* pItem = pDocSh->GetItem( SID_COLOR_TABLE ); - if ( pItem ) - { - XColorListRef pColorList = static_cast(pItem)->GetColorList(); - if (pColorList.is()) - { - m_pLbColor->SetUpdateMode( false ); - long nCount = pColorList->Count(); - for ( long n=0; nGetColor(n); - m_pLbColor->InsertEntry( pEntry->GetColor(), pEntry->GetName() ); - } - m_pLbColor->SetUpdateMode( true ); - } - } - } - SvtUserOptions aUserOpt; OUString sCreatedBy(get("createdft")->GetText()); diff --git a/sc/source/ui/drawfunc/drawsh4.cxx b/sc/source/ui/drawfunc/drawsh4.cxx index 9e620e5099b4..01d2576c7a61 100644 --- a/sc/source/ui/drawfunc/drawsh4.cxx +++ b/sc/source/ui/drawfunc/drawsh4.cxx @@ -34,17 +34,8 @@ void ScDrawShell::GetFormTextState(SfxItemSet& rSet) { const SdrObject* pObj = nullptr; - SvxFontWorkDialog* pDlg = nullptr; ScDrawView* pDrView = pViewData->GetScDrawView(); const SdrMarkList& rMarkList = pDrView->GetMarkedObjectList(); - sal_uInt16 nId = SvxFontWorkChildWindow::GetChildWindowId(); - - SfxViewFrame* pViewFrm = pViewData->GetViewShell()->GetViewFrame(); - if (pViewFrm->HasChildWindow(nId)) - { - SfxChildWindow* pWnd = pViewFrm->GetChildWindow(nId); - pDlg = pWnd ? static_cast(pWnd->GetWindow()) : nullptr; - } if ( rMarkList.GetMarkCount() == 1 ) pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); @@ -72,22 +63,6 @@ void ScDrawShell::GetFormTextState(SfxItemSet& rSet) } else { - if ( pDlg ) - { - SfxObjectShell* pDocSh = SfxObjectShell::Current(); - - if ( pDocSh ) - { - const SfxPoolItem* pItem = pDocSh->GetItem( SID_COLOR_TABLE ); - XColorListRef pColorList; - - if ( pItem ) - pColorList = static_cast(pItem)->GetColorList(); - - if ( pColorList.is() ) - pDlg->SetColorList( pColorList ); - } - } SfxItemSet aViewAttr(pDrView->GetModel()->GetItemPool()); pDrView->GetAttributes(aViewAttr); rSet.Set(aViewAttr); diff --git a/sc/source/ui/drawfunc/drtxtob2.cxx b/sc/source/ui/drawfunc/drtxtob2.cxx index 9a97a6aed7af..a7eb77aea3e7 100644 --- a/sc/source/ui/drawfunc/drtxtob2.cxx +++ b/sc/source/ui/drawfunc/drtxtob2.cxx @@ -202,17 +202,8 @@ void ScDrawTextObjectBar::ExecFormText(SfxRequest& rReq) void ScDrawTextObjectBar::GetFormTextState(SfxItemSet& rSet) { const SdrObject* pObj = nullptr; - SvxFontWorkDialog* pDlg = nullptr; ScDrawView* pDrView = pViewData->GetView()->GetScDrawView(); const SdrMarkList& rMarkList = pDrView->GetMarkedObjectList(); - sal_uInt16 nId = SvxFontWorkChildWindow::GetChildWindowId(); - - SfxViewFrame* pViewFrm = pViewData->GetViewShell()->GetViewFrame(); - if (pViewFrm->HasChildWindow(nId)) - { - SfxChildWindow* pWnd = pViewFrm->GetChildWindow(nId); - pDlg = pWnd ? static_cast(pWnd->GetWindow()) : nullptr; - } if ( rMarkList.GetMarkCount() == 1 ) pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); @@ -240,22 +231,6 @@ void ScDrawTextObjectBar::GetFormTextState(SfxItemSet& rSet) } else { - if ( pDlg ) - { - SfxObjectShell* pDocSh = SfxObjectShell::Current(); - - if ( pDocSh ) - { - const SfxPoolItem* pItem = pDocSh->GetItem( SID_COLOR_TABLE ); - XColorListRef pColorList; - - if ( pItem ) - pColorList = static_cast(pItem)->GetColorList(); - - if ( pColorList.is() ) - pDlg->SetColorList( pColorList ); - } - } SfxItemSet aViewAttr(pDrView->GetModel()->GetItemPool()); pDrView->GetAttributes(aViewAttr); rSet.Set(aViewAttr); diff --git a/sc/source/ui/inc/colorformat.hxx b/sc/source/ui/inc/colorformat.hxx index 682be33c87ad..8838418cfc18 100644 --- a/sc/source/ui/inc/colorformat.hxx +++ b/sc/source/ui/inc/colorformat.hxx @@ -19,6 +19,7 @@ struct ScDataBarFormatData; class ScDocument; +class SvxColorListBox; class ScDataBarSettingsDlg : public ModalDialog { @@ -26,9 +27,9 @@ private: VclPtr mpBtnOk; VclPtr mpBtnCancel; - VclPtr mpLbPos; - VclPtr mpLbNeg; - VclPtr mpLbAxisCol; + VclPtr mpLbPos; + VclPtr mpLbNeg; + VclPtr mpLbAxisCol; VclPtr mpLbFillType; VclPtr mpLbTypeMin; @@ -43,7 +44,6 @@ private: VclPtr mpCbOnlyBar; OUString maStrWarnSameValue; - OUString maCustomColor; SvNumberFormatter* mpNumberFormatter; ScDocument* mpDoc; diff --git a/sc/source/ui/inc/condformatdlgentry.hxx b/sc/source/ui/inc/condformatdlgentry.hxx index cba12245772f..f7d446ff474b 100644 --- a/sc/source/ui/inc/condformatdlgentry.hxx +++ b/sc/source/ui/inc/condformatdlgentry.hxx @@ -18,6 +18,7 @@ class ScIconSetFrmtDataEntry; class ScCondFormatDlg; +class SvxColorListBox; namespace condformat { @@ -172,8 +173,8 @@ class ScColorScale2FrmtEntry : public ScCondFrmtEntry VclPtr maEdMin; VclPtr maEdMax; - VclPtr maLbColMin; - VclPtr maLbColMax; + VclPtr maLbColMin; + VclPtr maLbColMax; ScFormatEntry* createColorscaleEntry() const; @@ -206,9 +207,9 @@ class ScColorScale3FrmtEntry : public ScCondFrmtEntry VclPtr maEdMiddle; VclPtr maEdMax; - VclPtr maLbColMin; - VclPtr maLbColMiddle; - VclPtr maLbColMax; + VclPtr maLbColMin; + VclPtr maLbColMiddle; + VclPtr maLbColMax; ScFormatEntry* createColorscaleEntry() const; diff --git a/sc/source/ui/inc/opredlin.hxx b/sc/source/ui/inc/opredlin.hxx index a0a3e765c3be..69d1bfb31db4 100644 --- a/sc/source/ui/inc/opredlin.hxx +++ b/sc/source/ui/inc/opredlin.hxx @@ -36,11 +36,10 @@ class ScRedlineOptionsTabPage : public SfxTabPage { - VclPtr m_pContentColorLB; - VclPtr m_pRemoveColorLB; - VclPtr m_pInsertColorLB; - VclPtr m_pMoveColorLB; - OUString aAuthorStr; + VclPtr m_pContentColorLB; + VclPtr m_pRemoveColorLB; + VclPtr m_pInsertColorLB; + VclPtr m_pMoveColorLB; public: diff --git a/sc/source/ui/inc/scendlg.hxx b/sc/source/ui/inc/scendlg.hxx index e20073c17882..3d5ecf4ce7e5 100644 --- a/sc/source/ui/inc/scendlg.hxx +++ b/sc/source/ui/inc/scendlg.hxx @@ -29,6 +29,8 @@ enum class ScScenarioFlags; +class SvxColorListBox; + class ScNewScenarioDlg : public ModalDialog { public: @@ -45,7 +47,7 @@ private: VclPtr m_pEdName; VclPtr m_pEdComment; VclPtr m_pCbShowFrame; - VclPtr m_pLbColor; + VclPtr m_pLbColor; VclPtr m_pCbTwoWay; VclPtr m_pCbCopyAll; VclPtr m_pCbProtect; diff --git a/sc/source/ui/inc/tpview.hxx b/sc/source/ui/inc/tpview.hxx index 359be4889d81..480d82432442 100644 --- a/sc/source/ui/inc/tpview.hxx +++ b/sc/source/ui/inc/tpview.hxx @@ -28,13 +28,14 @@ #include class ScViewOptions; +class SvxColorListBox; class ScTpContentOptions : public SfxTabPage { friend class VclPtr; VclPtr pGridLB; VclPtr pColorFT; - VclPtr pColorLB; + VclPtr pColorLB; VclPtr pBreakCB; VclPtr pGuideLineCB; diff --git a/sc/source/ui/optdlg/opredlin.cxx b/sc/source/ui/optdlg/opredlin.cxx index f8fb21682a47..8a769ad24dab 100644 --- a/sc/source/ui/optdlg/opredlin.cxx +++ b/sc/source/ui/optdlg/opredlin.cxx @@ -19,6 +19,7 @@ #undef SC_DLLIMPLEMENTATION +#include #include #include #include @@ -40,13 +41,16 @@ ScRedlineOptionsTabPage::ScRedlineOptionsTabPage( vcl::Window* pParent, const SfxItemSet& rSet ) - : SfxTabPage(pParent,"OptChangesPage", "modules/scalc/ui/optchangespage.ui", &rSet), - aAuthorStr (ScResId(SCSTR_AUTHOR)) + : SfxTabPage(pParent,"OptChangesPage", "modules/scalc/ui/optchangespage.ui", &rSet) { get(m_pContentColorLB, "changes"); + m_pContentColorLB->SetSlotId(SID_AUTHOR_COLOR); get(m_pRemoveColorLB, "deletions"); + m_pRemoveColorLB->SetSlotId(SID_AUTHOR_COLOR); get(m_pInsertColorLB, "entries"); + m_pInsertColorLB->SetSlotId(SID_AUTHOR_COLOR); get(m_pMoveColorLB, "insertions"); + m_pMoveColorLB->SetSlotId(SID_AUTHOR_COLOR); } ScRedlineOptionsTabPage::~ScRedlineOptionsTabPage() @@ -72,53 +76,17 @@ bool ScRedlineOptionsTabPage::FillItemSet( SfxItemSet* /* rSet */ ) { ScAppOptions aAppOptions=SC_MOD()->GetAppOptions(); - sal_uLong nNew=0; - sal_Int32 nPos=0; - - nPos = m_pContentColorLB->GetSelectEntryPos(); - if (nPos != LISTBOX_ENTRY_NOTFOUND) - { - if (nPos!=0) - nNew= m_pContentColorLB->GetEntryColor(nPos).GetColor(); - else - nNew= COL_TRANSPARENT; - - aAppOptions.SetTrackContentColor(nNew); - - } - nPos = m_pMoveColorLB->GetSelectEntryPos(); - if (nPos != LISTBOX_ENTRY_NOTFOUND) - { - if (nPos!=0) - nNew= m_pMoveColorLB->GetEntryColor(nPos).GetColor(); - else - nNew= COL_TRANSPARENT; - - aAppOptions.SetTrackMoveColor(nNew); - - } - nPos = m_pInsertColorLB->GetSelectEntryPos(); - if (nPos != LISTBOX_ENTRY_NOTFOUND) - { - if (nPos!=0) - nNew= m_pInsertColorLB->GetEntryColor(nPos).GetColor(); - else - nNew= COL_TRANSPARENT; - - aAppOptions.SetTrackInsertColor(nNew); - - } - nPos = m_pRemoveColorLB->GetSelectEntryPos(); - if (nPos != LISTBOX_ENTRY_NOTFOUND) - { - if (nPos!=0) - nNew= m_pRemoveColorLB->GetEntryColor(nPos).GetColor(); - else - nNew= COL_TRANSPARENT; - - aAppOptions.SetTrackDeleteColor(nNew); - - } + sal_uLong nNew = m_pContentColorLB->GetSelectEntryColor().GetColor(); + aAppOptions.SetTrackContentColor(nNew); + + nNew = m_pMoveColorLB->GetSelectEntryColor().GetColor(); + aAppOptions.SetTrackMoveColor(nNew); + + nNew = m_pInsertColorLB->GetSelectEntryColor().GetColor(); + aAppOptions.SetTrackInsertColor(nNew); + + nNew = m_pRemoveColorLB->GetSelectEntryColor().GetColor(); + aAppOptions.SetTrackDeleteColor(nNew); SC_MOD()->SetAppOptions(aAppOptions); @@ -133,59 +101,19 @@ bool ScRedlineOptionsTabPage::FillItemSet( SfxItemSet* /* rSet */ ) void ScRedlineOptionsTabPage::Reset( const SfxItemSet* /* rSet */ ) { - m_pContentColorLB->InsertEntry(aAuthorStr); - m_pMoveColorLB->InsertEntry(aAuthorStr); - m_pInsertColorLB->InsertEntry(aAuthorStr); - m_pRemoveColorLB->InsertEntry(aAuthorStr); - - m_pContentColorLB->SetUpdateMode( false); - m_pMoveColorLB->SetUpdateMode( false); - m_pInsertColorLB->SetUpdateMode( false); - m_pRemoveColorLB->SetUpdateMode( false); - - XColorListRef xColorLst = XColorList::GetStdColorList(); - for( long i = 0; i < xColorLst->Count(); ++i ) - { - const XColorEntry* pEntry = xColorLst->GetColor(i); - Color aColor = pEntry->GetColor(); - OUString sName = pEntry->GetName(); - - m_pContentColorLB->InsertEntry( aColor, sName ); - m_pMoveColorLB->InsertEntry( aColor, sName ); - m_pInsertColorLB->InsertEntry( aColor, sName ); - m_pRemoveColorLB->InsertEntry( aColor, sName ); - } - m_pContentColorLB->SetUpdateMode( true ); - m_pMoveColorLB->SetUpdateMode( true ); - m_pInsertColorLB->SetUpdateMode( true ); - m_pRemoveColorLB->SetUpdateMode( true ); - ScAppOptions aAppOptions=SC_MOD()->GetAppOptions(); sal_uLong nColor = aAppOptions.GetTrackContentColor(); - if (nColor == COL_TRANSPARENT) - m_pContentColorLB->SelectEntryPos(0); - else - m_pContentColorLB->SelectEntry(Color(nColor)); + m_pContentColorLB->SelectEntry(Color(nColor)); nColor = aAppOptions.GetTrackMoveColor(); - if (nColor == COL_TRANSPARENT) - m_pMoveColorLB->SelectEntryPos(0); - else - m_pMoveColorLB->SelectEntry(Color(nColor)); + m_pMoveColorLB->SelectEntry(Color(nColor)); nColor = aAppOptions.GetTrackInsertColor(); - if (nColor == COL_TRANSPARENT) - m_pInsertColorLB->SelectEntryPos(0); - else - m_pInsertColorLB->SelectEntry(Color(nColor)); + m_pInsertColorLB->SelectEntry(Color(nColor)); nColor = aAppOptions.GetTrackDeleteColor(); - if (nColor == COL_TRANSPARENT) - m_pRemoveColorLB->SelectEntryPos(0); - else - m_pRemoveColorLB->SelectEntry(Color(nColor)); - + m_pRemoveColorLB->SelectEntry(Color(nColor)); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/optdlg/tpview.cxx b/sc/source/ui/optdlg/tpview.cxx index 9e254fb83c93..0257ff228bc6 100644 --- a/sc/source/ui/optdlg/tpview.cxx +++ b/sc/source/ui/optdlg/tpview.cxx @@ -31,6 +31,7 @@ #include "globstr.hrc" #include #include +#include #include #include #include @@ -151,8 +152,8 @@ bool ScTpContentOptions::FillItemSet( SfxItemSet* rCoreSet ) pBreakCB ->IsValueChangedFromSaved() || pGuideLineCB ->IsValueChangedFromSaved()) { - pLocalOptions->SetGridColor( pColorLB->GetSelectEntryColor(), - pColorLB->GetSelectEntry() ); + NamedColor aNamedColor = pColorLB->GetSelectEntry(); + pLocalOptions->SetGridColor(aNamedColor.first, aNamedColor.second); rCoreSet->Put(ScTpViewItem(SID_SCVIEWOPTIONS, *pLocalOptions)); bRet = true; } @@ -302,58 +303,14 @@ void ScTpContentOptions::InitGridOpt() pGridLB->SelectEntryPos (nSelPos); - if ( pColorLB->GetEntryCount() == 0 ) - { - SfxObjectShell* pDocSh = SfxObjectShell::Current(); - // there might be another DocShell here - pDocSh = dynamic_cast( pDocSh ); - - XColorListRef pColorList; - if ( pDocSh ) - { - const SfxPoolItem* pItem = pDocSh->GetItem( SID_COLOR_TABLE ); - if ( pItem ) - pColorList = static_cast(pItem)->GetColorList(); - } - else - pColorList = XColorList::GetStdColorList(); - - if ( !pColorList.is() ) - return; - - pColorLB->SetUpdateMode( false ); - - // items from ColorTable - - long nCount = pColorList->Count(); - for ( long n=0; nGetColor(n); - pColorLB->InsertEntry( pEntry->GetColor(), pEntry->GetName() ); - } - - // default GridColor - - Color aStdCol( SC_STD_GRIDCOLOR ); // same default as in ScViewOptions - if ( LISTBOX_ENTRY_NOTFOUND == - pColorLB->GetEntryPos( aStdCol ) ) - pColorLB->InsertEntry( aStdCol, ScGlobal::GetRscString( STR_GRIDCOLOR ) ); - - pColorLB->SetUpdateMode( true ); - - Invalidate(); - } - - // also select grid color entry on subsequent calls - + // select grid color entry OUString aName; Color aCol = pLocalOptions->GetGridColor( &aName ); - nSelPos = pColorLB->GetEntryPos( aCol ); - if ( LISTBOX_ENTRY_NOTFOUND != nSelPos ) - pColorLB->SelectEntryPos( nSelPos ); - else - pColorLB->SelectEntryPos( pColorLB->InsertEntry( aCol, aName ) ); + if (aName.trim().isEmpty() && aCol == Color(SC_STD_GRIDCOLOR)) + aName = ScGlobal::GetRscString(STR_GRIDCOLOR); + + pColorLB->SelectEntry(std::make_pair(aCol, aName)); } IMPL_LINK( ScTpContentOptions, GridHdl, ListBox&, rLb, void ) diff --git a/sc/source/ui/src/scstring.src b/sc/source/ui/src/scstring.src index 70dc4327beae..e4e7e6ba9198 100644 --- a/sc/source/ui/src/scstring.src +++ b/sc/source/ui/src/scstring.src @@ -798,11 +798,6 @@ String SCSTR_ROW_LABEL Text [ en-US ] = "Range contains ~row labels" ; }; -String SCSTR_AUTHOR -{ - Text [ en-US ] = "By author" ; -}; - StringArray SCSTR_UNIT { ItemList [ en-US ] = diff --git a/sc/uiconfig/scalc/ui/conditionalentry.ui b/sc/uiconfig/scalc/ui/conditionalentry.ui index 86d18e199b5a..c5803074e635 100644 --- a/sc/uiconfig/scalc/ui/conditionalentry.ui +++ b/sc/uiconfig/scalc/ui/conditionalentry.ui @@ -131,7 +131,7 @@ - + False @@ -140,7 +140,7 @@ - + False @@ -149,7 +149,7 @@ - + False diff --git a/sc/uiconfig/scalc/ui/databaroptions.ui b/sc/uiconfig/scalc/ui/databaroptions.ui index c2a4ae233281..580f3053f5d5 100644 --- a/sc/uiconfig/scalc/ui/databaroptions.ui +++ b/sc/uiconfig/scalc/ui/databaroptions.ui @@ -241,7 +241,7 @@ - + True False True @@ -252,7 +252,7 @@ - + True False True @@ -374,7 +374,7 @@ - + True False True @@ -523,17 +523,6 @@ 5 - - - False - Custom - - - False - True - 6 - - False diff --git a/sc/uiconfig/scalc/ui/optchangespage.ui b/sc/uiconfig/scalc/ui/optchangespage.ui index df83ce92437f..c64f8726b2e0 100644 --- a/sc/uiconfig/scalc/ui/optchangespage.ui +++ b/sc/uiconfig/scalc/ui/optchangespage.ui @@ -87,7 +87,7 @@ - + True False @@ -97,7 +97,7 @@ - + True False @@ -107,7 +107,7 @@ - + True False @@ -117,7 +117,7 @@ - + True False diff --git a/sc/uiconfig/scalc/ui/scenariodialog.ui b/sc/uiconfig/scalc/ui/scenariodialog.ui index 846c05e4691f..56b8186de491 100644 --- a/sc/uiconfig/scalc/ui/scenariodialog.ui +++ b/sc/uiconfig/scalc/ui/scenariodialog.ui @@ -253,7 +253,7 @@ - + True False diff --git a/sc/uiconfig/scalc/ui/tpviewpage.ui b/sc/uiconfig/scalc/ui/tpviewpage.ui index 1e39a39f2ea0..1f3ef716cb5e 100644 --- a/sc/uiconfig/scalc/ui/tpviewpage.ui +++ b/sc/uiconfig/scalc/ui/tpviewpage.ui @@ -345,7 +345,7 @@ 6 12 - + True False True diff --git a/sd/inc/sdabstdlg.hxx b/sd/inc/sdabstdlg.hxx index e3269326c3c5..7f763c690346 100644 --- a/sd/inc/sdabstdlg.hxx +++ b/sd/inc/sdabstdlg.hxx @@ -180,7 +180,7 @@ public: SD_DLLPUBLIC static SdAbstractDialogFactory* Create(); virtual VclPtr CreateBreakDlg(vcl::Window* pWindow, ::sd::DrawView* pDrView, ::sd::DrawDocShell* pShell, sal_uLong nSumActionCount, sal_uLong nObjCount ) = 0; - virtual VclPtr CreateCopyDlg(vcl::Window* pWindow, const SfxItemSet& rInAttrs, const rtl::Reference &pColTab, ::sd::View* pView ) = 0; + virtual VclPtr CreateCopyDlg(vcl::Window* pWindow, const SfxItemSet& rInAttrs, ::sd::View* pView ) = 0; virtual VclPtr CreateSdCustomShowDlg(vcl::Window* pWindow, SdDrawDocument& rDrawDoc) = 0; virtual VclPtr CreateSdTabCharDialog(vcl::Window* pWindow, const SfxItemSet* pAttr, SfxObjectShell* pDocShell) = 0; virtual VclPtr CreateSdTabPageDialog(vcl::Window* pWindow, const SfxItemSet* pAttr, SfxObjectShell* pDocShell, bool bAreaPage) = 0; diff --git a/sd/qa/unit/dialogs-test.cxx b/sd/qa/unit/dialogs-test.cxx index 4acc570ca599..3b10d337a3ca 100644 --- a/sd/qa/unit/dialogs-test.cxx +++ b/sd/qa/unit/dialogs-test.cxx @@ -292,16 +292,10 @@ VclAbstractDialog* SdDialogsTest::createDialogByID(sal_uInt32 nID) } case 2: { - // CreateCopyDlg(const SfxItemSet& rInAttrs, const rtl::Reference &pColTab, ::sd::View* pView) override; - // works without XColorList (DropDowns will be empty), but - // it's easy to access, so use it - XColorListRef pColorList(XColorList::CreateStdColorList()); - // needs an SfxItemSet, use the one from the 1st object pRetval = getSdAbstractDialogFactory()->CreateCopyDlg( getViewShell()->GetActiveWindow(), getSfxItemSetFromSdrObject(), - pColorList, getDrawView()); break; } diff --git a/sd/source/ui/animations/CustomAnimationDialog.cxx b/sd/source/ui/animations/CustomAnimationDialog.cxx index 2ba3459164ee..6726317d95ba 100644 --- a/sd/source/ui/animations/CustomAnimationDialog.cxx +++ b/sd/source/ui/animations/CustomAnimationDialog.cxx @@ -62,6 +62,7 @@ #include #include +#include #include #include @@ -191,43 +192,24 @@ public: virtual Control* getControl() override; private: - VclPtr mpControl; - DECL_LINK(OnSelect, ListBox&, void); + VclPtr mpControl; + DECL_LINK(OnSelect, SvxColorListBox&, void); Link maModifyLink; }; ColorPropertyBox::ColorPropertyBox( sal_Int32 nControlType, vcl::Window* pParent, const Any& rValue, const Link& rModifyHdl ) : PropertySubControl( nControlType ), maModifyLink(rModifyHdl) { - mpControl = VclPtr::Create( pParent, WB_BORDER|WB_TABSTOP|WB_DROPDOWN ); - mpControl->SetDropDownLineCount( 10 ); + mpControl = VclPtr::Create(pParent); mpControl->SetSelectHdl( LINK(this, ColorPropertyBox, OnSelect) ); mpControl->SetHelpId( HID_SD_CUSTOMANIMATIONPANE_COLORPROPERTYBOX ); - SfxObjectShell* pDocSh = SfxObjectShell::Current(); - DBG_ASSERT( pDocSh, "DocShell not found!" ); - XColorListRef pColorList; - const SfxPoolItem* pItem = nullptr; - - if ( pDocSh && ( ( pItem = pDocSh->GetItem( SID_COLOR_TABLE ) ) != nullptr) ) - pColorList = static_cast(pItem)->GetColorList(); - - if ( !pColorList.is() ) - pColorList = XColorList::CreateStdColorList(); - sal_Int32 nColor = 0; rValue >>= nColor; - - for ( long i = 0; i < pColorList->Count(); i++ ) - { - const XColorEntry* pEntry = pColorList->GetColor(i); - sal_Int32 nPos = mpControl->InsertEntry( pEntry->GetColor(), pEntry->GetName() ); - if( pEntry->GetColor().GetRGBColor() == (sal_uInt32)nColor ) - mpControl->SelectEntryPos( nPos ); - } + mpControl->SelectEntry(static_cast(nColor)); } -IMPL_LINK_NOARG(ColorPropertyBox, OnSelect, ListBox&, void) +IMPL_LINK_NOARG(ColorPropertyBox, OnSelect, SvxColorListBox&, void) { maModifyLink.Call(nullptr); } @@ -245,7 +227,7 @@ void ColorPropertyBox::setValue( const Any& rValue, const OUString& ) rValue >>= nColor; mpControl->SetNoSelection(); - mpControl->SelectEntryPos( mpControl->GetEntryPos( static_cast(nColor) ) ); + mpControl->SelectEntry(static_cast(nColor)); } } @@ -1040,7 +1022,7 @@ private: VclPtr mpFTAfterEffect; VclPtr mpLBAfterEffect; VclPtr mpFTDimColor; - VclPtr mpCLBDimColor; + VclPtr mpCLBDimColor; VclPtr mpFTTextAnim; VclPtr mpLBTextAnim; VclPtr mpMFTextDelay; @@ -1065,6 +1047,7 @@ CustomAnimationEffectTabPage::CustomAnimationEffectTabPage( vcl::Window* pParent get(mpLBAfterEffect, "aeffect_list" ); get(mpFTDimColor, "dim_color_label" ); get(mpCLBDimColor, "dim_color_list" ); + mpCLBDimColor->SelectEntry(Color(COL_BLACK)); get(mpFTTextAnim, "text_animation_label" ); get(mpLBTextAnim, "text_animation_list" ); get(mpMFTextDelay,"text_delay" ); @@ -1077,28 +1060,6 @@ CustomAnimationEffectTabPage::CustomAnimationEffectTabPage( vcl::Window* pParent mpPBSoundPreview->SetClickHdl( LINK( this, CustomAnimationEffectTabPage, implClickHdl ) ); - // fill the color box - SfxObjectShell* pDocSh = SfxObjectShell::Current(); - DBG_ASSERT( pDocSh, "DocShell not found!" ); - XColorListRef pColorList; - const SfxPoolItem* pItem = nullptr; - - if ( pDocSh && ( (pItem = pDocSh->GetItem( SID_COLOR_TABLE ) ) != nullptr ) ) - pColorList = static_cast(pItem)->GetColorList(); - - if ( !pColorList.is() ) - pColorList = XColorList::CreateStdColorList(); - - mpCLBDimColor->SetUpdateMode( false ); - - for ( long i = 0; i < pColorList->Count(); i++ ) - { - const XColorEntry* pEntry = pColorList->GetColor(i); - mpCLBDimColor->InsertEntry( pEntry->GetColor(), pEntry->GetName() ); - } - - mpCLBDimColor->SetUpdateMode( true ); - // only show settings if all selected effects have the same preset-id if( pSet->getPropertyState( nHandlePresetId ) != STLPropertyState::Ambiguous ) { @@ -1174,13 +1135,8 @@ CustomAnimationEffectTabPage::CustomAnimationEffectTabPage( vcl::Window* pParent { sal_Int32 nColor = 0; aDimColor >>= nColor; - Color aColor( nColor ); - sal_Int32 nColorPos = mpCLBDimColor->GetEntryPos( aColor ); - if ( LISTBOX_ENTRY_NOTFOUND != nColorPos ) - mpCLBDimColor->SelectEntryPos( nColorPos ); - else - mpCLBDimColor->SelectEntryPos( - mpCLBDimColor->InsertEntry( aColor, SVX_RESSTR(RID_SVXSTR_COLOR_USER) ) ); + Color aColor(nColor); + mpCLBDimColor->SelectEntry(aColor); } else { @@ -1332,16 +1288,7 @@ IMPL_LINK( CustomAnimationEffectTabPage, implSelectHdl, ListBox&, rListBox, void void CustomAnimationEffectTabPage::implHdl(Control* pControl ) { - if( pControl == mpLBAfterEffect ) - { - sal_Int32 nPos = static_cast( mpLBAfterEffect )->GetSelectEntryPos(); - if( nPos == 1 ) - { - if( mpCLBDimColor->GetSelectEntryPos() == LISTBOX_ENTRY_NOTFOUND ) - mpCLBDimColor->SelectEntryPos(0); - } - } - else if( pControl == mpLBTextAnim ) + if( pControl == mpLBTextAnim ) { if( mpMFTextDelay->GetValue() == 0 ) mpMFTextDelay->SetValue( 100 ); @@ -1420,10 +1367,7 @@ void CustomAnimationEffectTabPage::update( STLPropertySet* pSet ) Any aDimColor; if( nPos == 1 ) { - Color aSelectedColor; - if ( mpCLBDimColor->GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND ) - aSelectedColor = mpCLBDimColor->GetSelectEntryColor(); - + Color aSelectedColor = mpCLBDimColor->GetSelectEntryColor(); aDimColor = makeAny( (sal_Int32)aSelectedColor.GetRGBColor() ); } diff --git a/sd/source/ui/dlg/copydlg.cxx b/sd/source/ui/dlg/copydlg.cxx index f68e06c38293..efcebc1442f1 100644 --- a/sd/source/ui/dlg/copydlg.cxx +++ b/sd/source/ui/dlg/copydlg.cxx @@ -19,6 +19,7 @@ #include "copydlg.hxx" #include +#include #include #include #include @@ -40,11 +41,9 @@ namespace sd { #define TOKEN ';' -CopyDlg::CopyDlg(vcl::Window* pWindow, const SfxItemSet& rInAttrs, - const XColorListRef &pColList, ::sd::View* pInView) +CopyDlg::CopyDlg(vcl::Window* pWindow, const SfxItemSet& rInAttrs, ::sd::View* pInView) : SfxModalDialog(pWindow, "DuplicateDialog", "modules/sdraw/ui/copydlg.ui") , mrOutAttrs(rInAttrs) - , mpColorList(pColList) , maUIScale(pInView->GetDoc().GetUIScale()) , mpView(pInView) { @@ -60,11 +59,6 @@ CopyDlg::CopyDlg(vcl::Window* pWindow, const SfxItemSet& rInAttrs, get(m_pLbEndColor, "end"); get(m_pBtnSetDefault, "default"); - // color tables - DBG_ASSERT( mpColorList.is(), "No colortable available !" ); - m_pLbStartColor->Fill( mpColorList ); - m_pLbEndColor->CopyEntries( *m_pLbStartColor ); - m_pLbStartColor->SetSelectHdl( LINK( this, CopyDlg, SelectColorHdl ) ); m_pBtnSetViewData->SetClickHdl( LINK( this, CopyDlg, SetViewData ) ); m_pBtnSetDefault->SetClickHdl( LINK( this, CopyDlg, SetDefault ) ); @@ -201,31 +195,22 @@ void CopyDlg::GetAttr( SfxItemSet& rOutAttrs ) rOutAttrs.Put( SfxInt32Item( ATTR_COPY_WIDTH, nWidth ) ); rOutAttrs.Put( SfxInt32Item( ATTR_COPY_HEIGHT, nHeight ) ); - if( m_pLbStartColor->GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND ) - { - XColorItem aXColorItem( ATTR_COPY_START_COLOR, m_pLbStartColor->GetSelectEntry(), - m_pLbStartColor->GetSelectEntryColor() ); - rOutAttrs.Put( aXColorItem ); - } - if( m_pLbEndColor->GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND ) - { - XColorItem aXColorItem( ATTR_COPY_END_COLOR, m_pLbEndColor->GetSelectEntry(), - m_pLbEndColor->GetSelectEntryColor() ); - rOutAttrs.Put( aXColorItem ); - } + NamedColor aColor = m_pLbStartColor->GetSelectEntry(); + rOutAttrs.Put(XColorItem(ATTR_COPY_START_COLOR, aColor.second, aColor.first)); + aColor = m_pLbEndColor->GetSelectEntry(); + rOutAttrs.Put(XColorItem(ATTR_COPY_END_COLOR, aColor.second, aColor.first)); } /** * enables and selects end color LB */ -IMPL_LINK_NOARG(CopyDlg, SelectColorHdl, ListBox&, void) +IMPL_LINK_NOARG(CopyDlg, SelectColorHdl, SvxColorListBox&, void) { - sal_Int32 nPos = m_pLbStartColor->GetSelectEntryPos(); + const Color aColor = m_pLbStartColor->GetSelectEntryColor(); - if( nPos != LISTBOX_ENTRY_NOTFOUND && - !m_pLbEndColor->IsEnabled() ) + if (!m_pLbEndColor->IsEnabled()) { - m_pLbEndColor->SelectEntryPos( nPos ); + m_pLbEndColor->SelectEntry(aColor); m_pLbEndColor->Enable(); m_pFtEndColor->Enable(); } diff --git a/sd/source/ui/dlg/sddlgfact.cxx b/sd/source/ui/dlg/sddlgfact.cxx index d2041f2c7554..23289ab93810 100644 --- a/sd/source/ui/dlg/sddlgfact.cxx +++ b/sd/source/ui/dlg/sddlgfact.cxx @@ -315,10 +315,9 @@ VclPtr SdAbstractDialogFactory_Impl::CreateBreakDlg( VclPtr SdAbstractDialogFactory_Impl::CreateCopyDlg(vcl::Window* pParent, const SfxItemSet& rInAttrs, - const rtl::Reference &pColTab, ::sd::View* pView ) { - return VclPtr::Create( VclPtr<::sd::CopyDlg>::Create( pParent, rInAttrs, pColTab, pView ) ); + return VclPtr::Create( VclPtr<::sd::CopyDlg>::Create( pParent, rInAttrs, pView ) ); } VclPtr SdAbstractDialogFactory_Impl::CreateSdCustomShowDlg(vcl::Window* pParent, SdDrawDocument& rDrawDoc ) diff --git a/sd/source/ui/dlg/sddlgfact.hxx b/sd/source/ui/dlg/sddlgfact.hxx index f014c8763e27..5eb076b09b11 100644 --- a/sd/source/ui/dlg/sddlgfact.hxx +++ b/sd/source/ui/dlg/sddlgfact.hxx @@ -215,7 +215,7 @@ public: virtual ~SdAbstractDialogFactory_Impl() {} virtual VclPtr CreateBreakDlg(vcl::Window* pWindow, ::sd::DrawView* pDrView, ::sd::DrawDocShell* pShell, sal_uLong nSumActionCount, sal_uLong nObjCount) override; - virtual VclPtr CreateCopyDlg(vcl::Window* pParent, const SfxItemSet& rInAttrs, const rtl::Reference &pColTab, ::sd::View* pView) override; + virtual VclPtr CreateCopyDlg(vcl::Window* pParent, const SfxItemSet& rInAttrs, ::sd::View* pView) override; virtual VclPtr CreateSdCustomShowDlg(vcl::Window* pParent, SdDrawDocument& rDrawDoc) override; virtual VclPtr CreateSdTabCharDialog(vcl::Window* pWindow, const SfxItemSet* pAttr, SfxObjectShell* pDocShell) override; virtual VclPtr CreateSdTabPageDialog(vcl::Window* pWindow, const SfxItemSet* pAttr, SfxObjectShell* pDocShell, bool bAreaPage) override; diff --git a/sd/source/ui/func/fucopy.cxx b/sd/source/ui/func/fucopy.cxx index a834258b78d2..3fb2dc929646 100644 --- a/sd/source/ui/func/fucopy.cxx +++ b/sd/source/ui/func/fucopy.cxx @@ -102,7 +102,7 @@ void FuCopy::DoExecute( SfxRequest& rReq ) SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create(); if( pFact ) { - ScopedVclPtr pDlg(pFact->CreateCopyDlg(mpViewShell->GetActiveWindow(), aSet, mpDoc->GetColorList(), mpView )); + ScopedVclPtr pDlg(pFact->CreateCopyDlg(mpViewShell->GetActiveWindow(), aSet, mpView )); if (!pDlg) return; diff --git a/sd/source/ui/inc/copydlg.hxx b/sd/source/ui/inc/copydlg.hxx index 98ac00ab7318..33a97c589943 100644 --- a/sd/source/ui/inc/copydlg.hxx +++ b/sd/source/ui/inc/copydlg.hxx @@ -28,6 +28,8 @@ #include #include +class SvxColorListBox; + namespace sd { class View; @@ -39,8 +41,7 @@ class CopyDlg : public SfxModalDialog { public: - CopyDlg( vcl::Window* pWindow, const SfxItemSet& rInAttrs, - const XColorListRef &pColList, ::sd::View* pView ); + CopyDlg(vcl::Window* pWindow, const SfxItemSet& rInAttrs, ::sd::View* pView); virtual ~CopyDlg() override; virtual void dispose() override; @@ -58,18 +59,17 @@ private: VclPtr m_pMtrFldWidth; VclPtr m_pMtrFldHeight; - VclPtr m_pLbStartColor; + VclPtr m_pLbStartColor; VclPtr m_pFtEndColor; - VclPtr m_pLbEndColor; + VclPtr m_pLbEndColor; VclPtr m_pBtnSetDefault; const SfxItemSet& mrOutAttrs; - XColorListRef mpColorList; Fraction maUIScale; ::sd::View* mpView; - DECL_LINK( SelectColorHdl, ListBox&, void ); + DECL_LINK( SelectColorHdl, SvxColorListBox&, void ); DECL_LINK( SetViewData, Button*, void ); DECL_LINK( SetDefault, Button*, void ); }; diff --git a/sd/source/ui/sidebar/SlideBackground.cxx b/sd/source/ui/sidebar/SlideBackground.cxx index 89587c52282d..3957fbafbd0d 100644 --- a/sd/source/ui/sidebar/SlideBackground.cxx +++ b/sd/source/ui/sidebar/SlideBackground.cxx @@ -38,6 +38,7 @@ #include #include "sdresid.hxx" #include +#include #include #include #include @@ -211,48 +212,21 @@ void SlideBackground::Update() mpFillAttr->Hide(); mpFillGrad->Hide(); mpFillLB->Show(); - mpFillLB->Clear(); - const SvxColorListItem aItem( *static_cast(pSh->GetItem(SID_COLOR_TABLE))); - mpFillLB->Fill(aItem.GetColorList()); - const Color aColor = GetColorSetOrDefault(); - mpFillLB->SelectEntry( aColor ); - - if(mpFillLB->GetSelectEntryCount() == 0) - { - mpFillLB->InsertEntry(aColor, OUString()); - mpFillLB->SelectEntry(aColor); - } + mpFillLB->SelectEntry(aColor); } break; case GRADIENT: { mpFillLB->Show(); - const SvxColorListItem aItem(*static_cast(pSh->GetItem(SID_COLOR_TABLE))); mpFillAttr->Hide(); mpFillGrad->Show(); - mpFillLB->Clear(); - mpFillGrad->Clear(); - mpFillLB->Fill(aItem.GetColorList()); - mpFillGrad->Fill(aItem.GetColorList()); const XGradient xGradient = GetGradientSetOrDefault(); const Color aStartColor = xGradient.GetStartColor(); + mpFillLB->SelectEntry(aStartColor); const Color aEndColor = xGradient.GetEndColor(); - mpFillLB->SelectEntry( aStartColor ); - mpFillGrad->SelectEntry( aEndColor ); - - if(mpFillLB->GetSelectEntryCount() == 0) - { - mpFillLB->InsertEntry(aStartColor, OUString()); - mpFillLB->SelectEntry(aStartColor); - } - - if(mpFillGrad->GetSelectEntryCount() == 0) - { - mpFillGrad->InsertEntry(aEndColor, OUString()); - mpFillGrad->SelectEntry(aEndColor); - } + mpFillGrad->SelectEntry(aEndColor); } break; @@ -831,7 +805,7 @@ IMPL_LINK_NOARG(SlideBackground, PaperSizeModifyHdl, ListBox&, void) GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_PAGE_SIZE, SfxCallMode::RECORD, { &aSizeItem, mpPageItem.get() }); } -IMPL_LINK_NOARG(SlideBackground, FillColorHdl, ListBox&, void) +IMPL_LINK_NOARG(SlideBackground, FillColorHdl, SvxColorListBox&, void) { const drawing::FillStyle eXFS = (drawing::FillStyle)mpFillStyle->GetSelectEntryPos(); switch(eXFS) diff --git a/sd/source/ui/sidebar/SlideBackground.hxx b/sd/source/ui/sidebar/SlideBackground.hxx index deb9a3b8118a..fbbe7016b8aa 100644 --- a/sd/source/ui/sidebar/SlideBackground.hxx +++ b/sd/source/ui/sidebar/SlideBackground.hxx @@ -45,6 +45,8 @@ #include "EventMultiplexer.hxx" #include +class SvxColorListBox; + namespace sd { namespace sidebar { class SlideBackground : @@ -79,9 +81,9 @@ private: VclPtr mpPaperOrientation; VclPtr mpMasterSlide; VclPtr mpFillStyle; - VclPtr mpFillLB; + VclPtr mpFillLB; VclPtr mpFillAttr; - VclPtr mpFillGrad; + VclPtr mpFillGrad; VclPtr mpDspMasterBackground; VclPtr mpDspMasterObjects; VclPtr