chart2/source/controller/dialogs/dlg_View3D.cxx | 4 chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx | 30 chart2/source/controller/dialogs/tp_3D_SceneIllumination.hxx | 11 chart2/source/controller/inc/dlg_View3D.hxx | 3 chart2/source/controller/main/ChartController_Properties.cxx | 2 chart2/source/controller/sidebar/ChartColorWrapper.cxx | 4 chart2/source/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 sd/uiconfig/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(-)
New commits: commit 64a708cba9b954afe3331f63c58218eb53b3d0ce Author: Caolán McNamara <caol...@redhat.com> Date: Sat Nov 5 20:28:27 2016 +0000 Revert "Reverts a commit series that cripple windows ci." with addition of... - svxlo-SvxColorListBox + svxcorelo-SvxColorListBox This reverts commit db380aab1063e8a5e40111c40ee9f7921aa82601. Change-Id: I3af7aa0abb1a430bce64188244404fcbd480b128 Reviewed-on: https://gerrit.libreoffice.org/30598 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/chart2/source/controller/dialogs/dlg_View3D.cxx b/chart2/source/controller/dialogs/dlg_View3D.cxx index eb0150b..7cfd50f 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<ThreeD_SceneGeometry_TabPage>::Create(m_pTabControl,xSceneProperties,m_aControllerLocker); m_pAppearance = VclPtr<ThreeD_SceneAppearance_TabPage>::Create(m_pTabControl,xChartModel,m_aControllerLocker); - m_pIllumination = VclPtr<ThreeD_SceneIllumination_TabPage>::Create(m_pTabControl,xSceneProperties,xChartModel,pColorTable); + m_pIllumination = VclPtr<ThreeD_SceneIllumination_TabPage>::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 bdd53ff..40f2857 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 <svx/colorbox.hxx> #include "svx/dialogs.hrc" #include <svx/dialmgr.hxx> #include <rtl/math.hxx> @@ -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<ColorLB*>(&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 515ace1..4251735 100644 --- a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.hxx +++ b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.hxx @@ -29,6 +29,8 @@ #include <svx/dlgctrl.hxx> #include <svx/dlgctl3d.hxx> +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<LightButton> m_pBtn_Light7; VclPtr<LightButton> m_pBtn_Light8; - VclPtr<ColorLB> m_pLB_LightSource; + VclPtr<SvxColorListBox> m_pLB_LightSource; VclPtr<PushButton> m_pBtn_LightSource_Color; - VclPtr<ColorLB> m_pLB_AmbientLight; + VclPtr<SvxColorListBox> m_pLB_AmbientLight; VclPtr<PushButton> m_pBtn_AmbientLight_Color; VclPtr<SvxLightCtl3D> m_pCtl_Preview; diff --git a/chart2/source/controller/inc/dlg_View3D.hxx b/chart2/source/controller/inc/dlg_View3D.hxx index b63ece7..a5646ab 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 00e7294..7636aa9 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 b2ff619..ee931d0 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<css::beans::XPropertySet> 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<css::frame::XModel>& xModel) diff --git a/chart2/source/controller/sidebar/ChartColorWrapper.hxx b/chart2/source/controller/sidebar/ChartColorWrapper.hxx index 68fb514..b987503 100644 --- a/chart2/source/controller/sidebar/ChartColorWrapper.hxx +++ b/chart2/source/controller/sidebar/ChartColorWrapper.hxx @@ -12,6 +12,7 @@ #include <com/sun/star/frame/XFramesSupplier.hpp> #include <tools/color.hxx> +#include <svx/Palette.hxx> 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<css::frame::XModel>& xModel); diff --git a/chart2/uiconfig/ui/tp_3D_SceneIllumination.ui b/chart2/uiconfig/ui/tp_3D_SceneIllumination.ui index 7ff9fbf..626124a 100644 --- a/chart2/uiconfig/ui/tp_3D_SceneIllumination.ui +++ b/chart2/uiconfig/ui/tp_3D_SceneIllumination.ui @@ -236,7 +236,7 @@ <property name="can_focus">False</property> <property name="spacing">12</property> <child> - <object class="svxlo-ColorLB" id="LB_LIGHTSOURCE"> + <object class="svxcorelo-SvxColorListBox" id="LB_LIGHTSOURCE"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -310,7 +310,7 @@ <property name="can_focus">False</property> <property name="spacing">12</property> <child> - <object class="svxlo-ColorLB" id="LB_AMBIENTLIGHT"> + <object class="svxcorelo-SvxColorListBox" id="LB_AMBIENTLIGHT"> <property name="visible">True</property> <property name="can_focus">False</property> </object> diff --git a/cui/source/inc/border.hxx b/cui/source/inc/border.hxx index 9675b10..915deba 100644 --- a/cui/source/inc/border.hxx +++ b/cui/source/inc/border.hxx @@ -25,6 +25,7 @@ #include <vcl/fixed.hxx> #include <svtools/valueset.hxx> #include <sfx2/tabdlg.hxx> +#include <svx/colorbox.hxx> #include <svx/frmsel.hxx> #include <svx/flagsdef.hxx> @@ -72,7 +73,7 @@ private: VclPtr<svx::FrameSelector> m_pFrameSel; VclPtr<LineListBox> m_pLbLineStyle; - VclPtr<ColorListBox> m_pLbLineColor; + VclPtr<SvxColorListBox> m_pLbLineColor; VclPtr<MetricField> m_pLineWidthMF; VclPtr<VclContainer> m_pSpacingFrame; @@ -91,7 +92,7 @@ private: VclPtr<FixedText> m_pFtShadowSize; VclPtr<MetricField> m_pEdShadowSize; VclPtr<FixedText> m_pFtShadowColor; - VclPtr<ColorListBox> m_pLbShadowColor; + VclPtr<SvxColorListBox> m_pLbShadowColor; VclPtr<VclContainer> 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 bea73e4..484897d 100644 --- a/cui/source/inc/chardlg.hxx +++ b/cui/source/inc/chardlg.hxx @@ -23,6 +23,7 @@ #include <sfx2/tabdlg.hxx> #include <svx/fntctrl.hxx> #include <svx/checklbx.hxx> +#include <svx/colorbox.hxx> #include <svx/langbox.hxx> #include <vcl/layout.hxx> #include <memory> @@ -175,7 +176,7 @@ class SvxCharEffectsPage : public SvxCharBasePage private: static const sal_uInt16 pEffectsRanges[]; VclPtr<FixedText> m_pFontColorFT; - VclPtr<ColorListBox> m_pFontColorLB; + VclPtr<SvxColorListBox> m_pFontColorLB; VclPtr<FixedText> m_pEffectsFT; VclPtr<ListBox> m_pEffectsLB; @@ -190,13 +191,13 @@ private: VclPtr<ListBox> m_pOverlineLB; VclPtr<FixedText> m_pOverlineColorFT; - VclPtr<ColorListBox> m_pOverlineColorLB; + VclPtr<SvxColorListBox> m_pOverlineColorLB; VclPtr<ListBox> m_pStrikeoutLB; VclPtr<ListBox> m_pUnderlineLB; VclPtr<FixedText> m_pUnderlineColorFT; - VclPtr<ColorListBox> m_pUnderlineColorLB; + VclPtr<SvxColorListBox> m_pUnderlineColorLB; VclPtr<CheckBox> 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 0f57cf6..33f5ea3 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 52d4fce..362777a 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<VclGrid> m_pGridShadow; VclPtr<SvxRectCtl> m_pCtlPosition; VclPtr<MetricField> m_pMtrDistance; - VclPtr<ColorLB> m_pLbShadowColor; + VclPtr<SvxColorListBox> m_pLbShadowColor; VclPtr<MetricField> m_pMtrTransparent; VclPtr<SvxXShadowPreview> 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<SfxTabPage> Create( vcl::Window*, const SfxItemSet* ); static const sal_uInt16* GetRanges() { return pShadowRanges; } @@ -381,9 +381,9 @@ private: VclPtr<MetricField> m_pMtrAngle; VclPtr<MetricField> m_pMtrBorder; VclPtr<Slider> m_pSliderBorder; - VclPtr<ColorLB> m_pLbColorFrom; + VclPtr<SvxColorListBox> m_pLbColorFrom; VclPtr<MetricField> m_pMtrColorFrom; - VclPtr<ColorLB> m_pLbColorTo; + VclPtr<SvxColorListBox> m_pLbColorTo; VclPtr<MetricField> m_pMtrColorTo; VclPtr<SvxPresetListBox> m_pGradientLB; VclPtr<NumericField> 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<MetricField> m_pMtrAngle; VclPtr<Slider> m_pSliderAngle; VclPtr<ListBox> m_pLbLineType; - VclPtr<ColorLB> m_pLbLineColor; + VclPtr<SvxColorListBox> m_pLbLineColor; VclPtr<CheckBox> m_pCbBackgroundColor; - VclPtr<ColorLB> m_pLbBackgroundColor; + VclPtr<SvxColorListBox> m_pLbBackgroundColor; VclPtr<SvxPresetListBox> m_pHatchLB; VclPtr<SvxXRectPreview> m_pCtlPreview; VclPtr<PushButton> 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<VclBox> m_pBxPixelEditor; VclPtr<SvxPixelCtl> m_pCtlPixel; - VclPtr<ColorLB> m_pLbColor; - VclPtr<ColorLB> m_pLbBackgroundColor; + VclPtr<SvxColorListBox> m_pLbColor; + VclPtr<SvxColorListBox> m_pLbBackgroundColor; VclPtr<SvxPresetListBox> m_pPatternLB; VclPtr<SvxXRectPreview> m_pCtlPreview; VclPtr<PushButton> 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 957b421..39e7498 100644 --- a/cui/source/inc/cuitabline.hxx +++ b/cui/source/inc/cuitabline.hxx @@ -25,6 +25,7 @@ #include <svx/tabarea.hxx> enum class PageType; +class SvxColorListBox; class SvxLineTabDialog : public SfxTabDialog { @@ -92,7 +93,7 @@ class SvxLineTabPage : public SvxTabPage private: VclPtr<VclBox> m_pBoxColor; VclPtr<LineLB> m_pLbLineStyle; - VclPtr<ColorLB> m_pLbColor; + VclPtr<SvxColorListBox> m_pLbColor; VclPtr<VclBox> m_pBoxWidth; VclPtr<MetricField> m_pMtrLineWidth; VclPtr<VclBox> 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 7f65cbf..afaaf1e 100644 --- a/cui/source/inc/numpages.hxx +++ b/cui/source/inc/numpages.hxx @@ -23,6 +23,7 @@ #include <memory> #include <sfx2/tabdlg.hxx> +#include <svx/Palette.hxx> #include <vcl/group.hxx> #include <vcl/fixed.hxx> #include <vcl/menubtn.hxx> @@ -33,6 +34,7 @@ #include <svtools/ctrlbox.hxx> #include <vcl/dialog.hxx> +class SvxColorListBox; class SvxNumRule; class SvxBmpNumValueSet; class SvxNumValueSet; @@ -254,7 +256,7 @@ class SvxNumOptionsTabPage : public SfxTabPage VclPtr<FixedText> m_pCharFmtFT; VclPtr<ListBox> m_pCharFmtLB; VclPtr<FixedText> m_pBulColorFT; - VclPtr<ColorListBox> m_pBulColLB; + VclPtr<SvxColorListBox> m_pBulColLB; VclPtr<FixedText> m_pBulRelSizeFT; VclPtr<MetricField> m_pBulRelSizeMF; VclPtr<FixedText> 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 3d95da7..060d3b0 100644 --- a/cui/source/options/optchart.cxx +++ b/cui/source/options/optchart.cxx @@ -21,24 +21,99 @@ #include <cuires.hrc> #include "optchart.hxx" #include <dialmgr.hxx> +#include <vcl/builderfactory.hxx> #include <vcl/msgbox.hxx> +#include <vcl/svapp.hxx> #include <svx/svxids.hrc> -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<VirtualDevice> xDevice = VclPtr<VirtualDevice>::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<size_t>(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<size_t>(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<size_t>(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<ColorLB&>(_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 34cd211..79af3c1 100644 --- a/cui/source/options/optchart.hxx +++ b/cui/source/options/optchart.hxx @@ -29,11 +29,12 @@ #include "cfgchart.hxx" +typedef std::vector<Color> ImpColorList; + class SvxDefaultColorOptPage : public SfxTabPage { - private: - VclPtr<ColorLB> m_pLbChartColors; + VclPtr<ListBox> m_pLbChartColors; VclPtr<ValueSet> m_pValSetColorBox; VclPtr<PushButton> m_pPBDefault; VclPtr<PushButton> 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 43f76b4..1d962bd 100644 --- a/cui/source/options/optcolor.cxx +++ b/cui/source/options/optcolor.cxx @@ -21,11 +21,13 @@ #include <bitset> +#include <editeng/editids.hrc> #include <svtools/colorcfg.hxx> #include <svtools/extcolorcfg.hxx> #include <svtools/headbar.hxx> #include <svtools/ctrlbox.hxx> #include <vcl/scrbar.hxx> +#include <svx/colorbox.hxx> #include <svx/xtable.hxx> #include <unotools/moduleoptions.hxx> #include <unotools/pathoptions.hxx> @@ -177,12 +179,12 @@ public: virtual void dispose() override; public: - void SetLinks (Link<Button*,void> const&, Link<ListBox&,void> const&, Link<Control&,void> const&); + void SetLinks (Link<Button*,void> const&, Link<SvxColorListBox&,void> const&, Link<Control&,void> 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<Button*,void> const&, Link<ListBox&,void> const&, Link<Control&,void> const&); + void SetLinks (Link<Button*,void> const&, Link<SvxColorListBox&,void> const&, Link<Control&,void> 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<Control> m_pText; // color list box - VclPtr<ColorListBox> m_pColorList; + VclPtr<SvxColorListBox> m_pColorList; // color preview box VclPtr<vcl::Window> 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<ColorListBox>::Create(pGrid, nWinBits); - m_pColorList->EnableAutoSize(true); + m_pColorList = VclPtr<SvxColorListBox>::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<Button*,void> const& aCheckLink, Link<ListBox&,void> const& aColorLink, + Link<Button*,void> const& aCheckLink, Link<SvxColorListBox&,void> const& aColorLink, Link<Control&,void> 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<CheckBox*>(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<Button*,void> const& aCheckLink, Link<ListBox&,void> const& aColorLink, Link<Control&,void> const& aGetFocusLink + Link<Button*,void> const& aCheckLink, Link<SvxColorListBox&,void> const& aColorLink, Link<Control&,void> 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<Button*,void> aCheckLink = LINK(this, ColorConfigCtrl_Impl, ClickHdl); - Link<ListBox&,void> aColorLink = LINK(this, ColorConfigCtrl_Impl, ColorHdl); + Link<SvxColorListBox&,void> aColorLink = LINK(this, ColorConfigCtrl_Impl, ColorHdl); Link<Control&,void> 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<ColorListBox*>(&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 ce9948c..41e525d 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 d74ae35..f989a7c 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<const SvxColorListItem*>(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<ColorListBox*>(&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 5aec146..70243d055 100644 --- a/cui/source/tabpages/borderconn.cxx +++ b/cui/source/tabpages/borderconn.cxx @@ -22,6 +22,7 @@ #include "editeng/lineitem.hxx" #include <editeng/boxitem.hxx> #include <svx/algitem.hxx> +#include <svx/colorbox.hxx> #include <editeng/shaditem.hxx> 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<sal_uInt16> 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 17343d8..b04d4a8 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 d1b7b8b..15a1020 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<const SvxColorListItem*>(pItem)->GetColorList(); - } - - if ( !pColorTable.is() ) - pColorTable = XColorList::CreateStdColorList(); - - m_pUnderlineColorLB->SetUpdateMode( false ); - m_pOverlineColorLB->SetUpdateMode( false ); - m_pFontColorLB->SetUpdateMode( false ); - - { - std::unique_ptr<SfxPoolItem> 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<ListBox&,void> 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<sal_uLong>(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<const SvxColorItem*>(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<const SfxPoolItem**>(&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<ColorListBox*>(&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 6aacd7e..49564a9 100644 --- a/cui/source/tabpages/numpages.cxx +++ b/cui/source/tabpages/numpages.cxx @@ -31,6 +31,7 @@ #include <svl/eitem.hxx> #include <vcl/layout.hxx> #include <vcl/svapp.hxx> +#include <svx/colorbox.hxx> #include <svx/gallery.hxx> #include <svl/urihelper.hxx> #include <editeng/brushitem.hxx> @@ -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<const SvxColorListItem*>(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<ColorListBox*>(&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 2bf8809..0b296d6 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 6acbf08..72538f0 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<SvxShadowTabPage&>(rPage).SetColorList( mpColorList ); static_cast<SvxShadowTabPage&>(rPage).SetColorChgd( &mnColorListState ); - static_cast<SvxShadowTabPage&>(rPage).Construct(); } else if (nId == m_nTransparenceTabPage) { diff --git a/cui/source/tabpages/tabline.cxx b/cui/source/tabpages/tabline.cxx index b9efb53..e8d080e 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<SvxShadowTabPage&>(rPage).SetDlgType( 0 ); static_cast<SvxShadowTabPage&>(rPage).SetAreaTP( &mbAreaTP ); static_cast<SvxShadowTabPage&>(rPage).SetColorChgd( &mnColorListState ); - static_cast<SvxShadowTabPage&>(rPage).Construct(); } } diff --git a/cui/source/tabpages/tpgradnt.cxx b/cui/source/tabpages/tpgradnt.cxx index e28e177..7aac0c7 100644 --- a/cui/source/tabpages/tpgradnt.cxx +++ b/cui/source/tabpages/tpgradnt.cxx @@ -28,6 +28,7 @@ #include <cuires.hrc> #include "helpid.hrc" +#include <svx/colorbox.hxx> #include "svx/xattr.hxx" #include <svx/xtable.hxx> #include <svx/xpool.hxx> @@ -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<SvxColorListBox&,void> 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<SfxTabPage> SvxGradientTabPage::Create( vcl::Window* pWindow, return VclPtr<SvxGradientTabPage>::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 1f4fa52..31efad7 100644 --- a/cui/source/tabpages/tphatch.cxx +++ b/cui/source/tabpages/tphatch.cxx @@ -29,6 +29,7 @@ #include <cuires.hrc> #include "helpid.hrc" +#include <svx/colorbox.hxx> #include "svx/xattr.hxx" #include <svx/xpool.hxx> #include <svx/xtable.hxx> @@ -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<SvxColorListBox&,void> 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<SfxTabPage> SvxHatchTabPage::Create( vcl::Window* pWindow, return VclPtr<SvxHatchTabPage>::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 11ffd61..3172081 100644 --- a/cui/source/tabpages/tpline.cxx +++ b/cui/source/tabpages/tpline.cxx @@ -24,6 +24,7 @@ #include <sfx2/module.hxx> #include <cuires.hrc> +#include <svx/colorbox.hxx> #include "svx/xattr.hxx" #include <svx/xpool.hxx> #include <svx/xtable.hxx> @@ -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<SvxLineTabDialog*>( 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<const XLineColorItem*>(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<const XLineColorItem&>( 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<SfxTabPage> SvxLineTabPage::Create( vcl::Window* pWindow, return VclPtr<SvxLineTabPage>::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 253b198..cb4c7a3 100644 --- a/cui/source/tabpages/tppattern.cxx +++ b/cui/source/tabpages/tppattern.cxx @@ -27,6 +27,7 @@ #include <sfx2/filedlghelper.hxx> #include <unotools/localfilehelper.hxx> #include "com/sun/star/ui/dialogs/TemplateDescription.hpp" +#include <svx/colorbox.hxx> #include <svx/dialmgr.hxx> #include <vcl/bitmapaccess.hxx> #include <vcl/settings.hxx> @@ -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<SvxAreaTabDialog*>(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 d2b1dca..84179d2 100644 --- a/cui/source/tabpages/tpshadow.cxx +++ b/cui/source/tabpages/tpshadow.cxx @@ -19,6 +19,7 @@ #include <sfx2/app.hxx> #include <sfx2/module.hxx> +#include <svx/colorbox.hxx> #include <svx/dialogs.hrc> #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<SfxUInt16Item>(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 c783d26..a3cb06b 100644 --- a/cui/uiconfig/ui/borderpage.ui +++ b/cui/uiconfig/ui/borderpage.ui @@ -233,7 +233,7 @@ </packing> </child> <child> - <object class="svtlo-ColorListBox" id="linecolorlb"> + <object class="svxcorelo-SvxColorListBox" id="linecolorlb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -505,7 +505,7 @@ </packing> </child> <child> - <object class="svtlo-ColorListBox" id="shadowcolorlb"> + <object class="svxcorelo-SvxColorListBox" id="shadowcolorlb"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="halign">start</property> diff --git a/cui/uiconfig/ui/colorconfigwin.ui b/cui/uiconfig/ui/colorconfigwin.ui index d03daf7..6c8dd3f 100644 --- a/cui/uiconfig/ui/colorconfigwin.ui +++ b/cui/uiconfig/ui/colorconfigwin.ui @@ -38,7 +38,7 @@ </packing> </child> <child> - <object class="svtlo-ColorListBox" id="doccolor_lb"> + <object class="svxcorelo-SvxColorListBox" id="doccolor_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -72,7 +72,7 @@ </packing> </child> <child> - <object class="svtlo-ColorListBox" id="docboundaries_lb"> + <object class="svxcorelo-SvxColorListBox" id="docboundaries_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -98,7 +98,7 @@ </packing> </child> <child> - <object class="svtlo-ColorListBox" id="appback_lb"> + <object class="svxcorelo-SvxColorListBox" id="appback_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -148,7 +148,7 @@ </packing> </child> <child> - <object class="svtlo-ColorListBox" id="objboundaries_lb"> + <object class="svxcorelo-SvxColorListBox" id="objboundaries_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -185,7 +185,7 @@ </packing> </child> <child> - <object class="svtlo-ColorListBox" id="tblboundaries_lb"> + <object class="svxcorelo-SvxColorListBox" id="tblboundaries_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -220,7 +220,7 @@ </packing> </child> <child> - <object class="svtlo-ColorListBox" id="font_lb"> + <object class="svxcorelo-SvxColorListBox" id="font_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -257,7 +257,7 @@ </packing> </child> <child> - <object class="svtlo-ColorListBox" id="unvisitedlinks_lb"> + <object class="svxcorelo-SvxColorListBox" id="unvisitedlinks_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -294,7 +294,7 @@ </packing> </child> <child> - <object class="svtlo-ColorListBox" id="visitedlinks_lb"> + <object class="svxcorelo-SvxColorListBox" id="visitedlinks_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -354,7 +354,7 @@ </packing> </child> <child> - <object class="svtlo-ColorListBox" id="autospellcheck_lb"> + <object class="svxcorelo-SvxColorListBox" id="autospellcheck_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -364,7 +364,7 @@ </packing> </child> <child> - <object class="svtlo-ColorListBox" id="shadows_lb"> + <object class="svxcorelo-SvxColorListBox" id="shadows_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -374,7 +374,7 @@ </packing> </child> <child> - <object class="svtlo-ColorListBox" id="smarttags_lb"> + <object class="svxcorelo-SvxColorListBox" id="smarttags_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -400,7 +400,7 @@ </packing> </child> <child> - <object class="svtlo-ColorListBox" id="writergrid_lb"> + <object class="svxcorelo-SvxColorListBox" id="writergrid_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -435,7 +435,7 @@ </packing> </child> <child> - <object class="svtlo-ColorListBox" id="field_lb"> + <object class="svxcorelo-SvxColorListBox" id="field_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -457,7 +457,7 @@ </packing> </child> <child> - <object class="svtlo-ColorListBox" id="index_lb"> + <object class="svxcorelo-SvxColorListBox" id="index_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -479,7 +479,7 @@ </packing> </child> <child> - <object class="svtlo-ColorListBox" id="script_lb"> + <object class="svxcorelo-SvxColorListBox" id="script_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -559,7 +559,7 @@ </packing> </child> <child> - <object class="svtlo-ColorListBox" id="section_lb"> + <object class="svxcorelo-SvxColorListBox" id="section_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -581,7 +581,7 @@ </packing> </child> <child> - <object class="svtlo-ColorListBox" id="hdft_lb"> + <object class="svxcorelo-SvxColorListBox" id="hdft_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -616,7 +616,7 @@ </packing> </child> <child> - <object class="svtlo-ColorListBox" id="pagebreak_lb"> + <object class="svxcorelo-SvxColorListBox" id="pagebreak_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -651,7 +651,7 @@ </packing> </child> <child> - <object class="svtlo-ColorListBox" id="direct_lb"> + <object class="svxcorelo-SvxColorListBox" id="direct_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -702,7 +702,7 @@ </packing> </child> <child> - <object class="svtlo-ColorListBox" id="sgml_lb"> + <object class="svxcorelo-SvxColorListBox" id="sgml_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -737,7 +737,7 @@ </packing> </child> <child> - <object class="svtlo-ColorListBox" id="htmlcomment_lb"> + <object class="svxcorelo-SvxColorListBox" id="htmlcomment_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -772,7 +772,7 @@ </packing> </child> <child> - <object class="svtlo-ColorListBox" id="htmlkeyword_lb"> + <object class="svxcorelo-SvxColorListBox" id="htmlkeyword_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -807,7 +807,7 @@ </packing> </child> <child> - <object class="svtlo-ColorListBox" id="unknown_lb"> + <object class="svxcorelo-SvxColorListBox" id="unknown_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -858,7 +858,7 @@ </packing> </child> <child> - <object class="svtlo-ColorListBox" id="calcgrid_lb"> + <object class="svxcorelo-SvxColorListBox" id="calcgrid_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -893,7 +893,7 @@ </packing> </child> <child> - <object class="svtlo-ColorListBox" id="brk_lb"> + <object class="svxcorelo-SvxColorListBox" id="brk_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -928,7 +928,7 @@ </packing> </child> <child> - <object class="svtlo-ColorListBox" id="brkmanual_lb"> + <object class="svxcorelo-SvxColorListBox" id="brkmanual_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -963,7 +963,7 @@ </packing> </child> <child> - <object class="svtlo-ColorListBox" id="brkauto_lb"> + <object class="svxcorelo-SvxColorListBox" id="brkauto_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -998,7 +998,7 @@ </packing> </child> <child> - <object class="svtlo-ColorListBox" id="det_lb"> + <object class="svxcorelo-SvxColorListBox" id="det_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -1033,7 +1033,7 @@ </packing> </child> <child> - <object class="svtlo-ColorListBox" id="deterror_lb"> + <object class="svxcorelo-SvxColorListBox" id="deterror_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -1068,7 +1068,7 @@ </packing> </child> <child> - <object class="svtlo-ColorListBox" id="ref_lb"> + <object class="svxcorelo-SvxColorListBox" id="ref_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -1103,7 +1103,7 @@ </packing> </child> <child> - <object class="svtlo-ColorListBox" id="notes_lb"> + <object class="svxcorelo-SvxColorListBox" id="notes_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -1154,7 +1154,7 @@ </packing> </child> <child> - <object class="svtlo-ColorListBox" id="drawgrid_lb"> + <object class="svxcorelo-SvxColorListBox" id="drawgrid_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -1205,7 +1205,7 @@ </packing> </child> <child> - <object class="svtlo-ColorListBox" id="basicid_lb"> + <object class="svxcorelo-SvxColorListBox" id="basicid_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -1240,7 +1240,7 @@ </packing> </child> <child> - <object class="svtlo-ColorListBox" id="basiccomment_lb"> + <object class="svxcorelo-SvxColorListBox" id="basiccomment_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -1275,7 +1275,7 @@ </packing> </child> <child> - <object class="svtlo-ColorListBox" id="basicnumber_lb"> + <object class="svxcorelo-SvxColorListBox" id="basicnumber_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -1310,7 +1310,7 @@ </packing> </child> <child> - <object class="svtlo-ColorListBox" id="basicstring_lb"> + <object class="svxcorelo-SvxColorListBox" id="basicstring_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -1345,7 +1345,7 @@ </packing> </child> <child> - <object class="svtlo-ColorListBox" id="basicop_lb"> + <object class="svxcorelo-SvxColorListBox" id="basicop_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -1380,7 +1380,7 @@ </packing> </child> <child> - <object class="svtlo-ColorListBox" id="basickeyword_lb"> + <object class="svxcorelo-SvxColorListBox" id="basickeyword_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -1415,7 +1415,7 @@ </packing> </child> <child> - <object class="svtlo-ColorListBox" id="error_lb"> ... etc. - the rest is truncated
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits