diff options
142 files changed, 1488 insertions, 2725 deletions
diff --git a/chart2/source/controller/dialogs/dlg_View3D.cxx b/chart2/source/controller/dialogs/dlg_View3D.cxx index eb0150b1ad7a..7cfd50f41fd1 100644 --- a/chart2/source/controller/dialogs/dlg_View3D.cxx +++ b/chart2/source/controller/dialogs/dlg_View3D.cxx @@ -39,7 +39,7 @@ using namespace ::com::sun::star::chart2; sal_uInt16 View3DDialog::m_nLastPageId = 0; -View3DDialog::View3DDialog(vcl::Window* pParent, const uno::Reference< frame::XModel > & xChartModel, const XColorListRef &pColorTable ) +View3DDialog::View3DDialog(vcl::Window* pParent, const uno::Reference< frame::XModel > & xChartModel) : TabDialog(pParent, "3DViewDialog", "modules/schart/ui/3dviewdialog.ui") , m_pGeometry(nullptr) , m_pAppearance(nullptr) @@ -51,7 +51,7 @@ View3DDialog::View3DDialog(vcl::Window* pParent, const uno::Reference< frame::XM uno::Reference< beans::XPropertySet > xSceneProperties( ChartModelHelper::findDiagram( xChartModel ), uno::UNO_QUERY ); m_pGeometry = VclPtr<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 bdd53ff10d21..40f2857859bb 100644 --- a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx +++ b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx @@ -22,6 +22,7 @@ #include "Bitmaps.hrc" #include "CommonConverters.hxx" +#include <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 515ace16b8e4..42517359f6fc 100644 --- a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.hxx +++ b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.hxx @@ -29,6 +29,8 @@ #include <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 b63ece7bea10..a5646ab535bc 100644 --- a/chart2/source/controller/inc/dlg_View3D.hxx +++ b/chart2/source/controller/inc/dlg_View3D.hxx @@ -38,8 +38,7 @@ class View3DDialog : public TabDialog { public: View3DDialog( vcl::Window* pWindow, - const css::uno::Reference< css::frame::XModel > & xChartModel, - const XColorListRef &pColorTable ); + const css::uno::Reference< css::frame::XModel > & xChartModel ); virtual ~View3DDialog() override; virtual void dispose() override; diff --git a/chart2/source/controller/main/ChartController_Properties.cxx b/chart2/source/controller/main/ChartController_Properties.cxx index 00e7294f824a..7636aa982176 100644 --- a/chart2/source/controller/main/ChartController_Properties.cxx +++ b/chart2/source/controller/main/ChartController_Properties.cxx @@ -823,7 +823,7 @@ void ChartController::executeDispatch_View3D() //open dialog SolarMutexGuard aSolarGuard; - ScopedVclPtrInstance< View3DDialog > aDlg( m_pChartWindow, getModel(), m_pDrawModelWrapper->GetColorList() ); + ScopedVclPtrInstance< View3DDialog > aDlg(m_pChartWindow, getModel()); if( aDlg->Execute() == RET_OK ) aUndoGuard.commit(); } diff --git a/chart2/source/controller/sidebar/ChartColorWrapper.cxx b/chart2/source/controller/sidebar/ChartColorWrapper.cxx index b2ff6196916d..ee931d06503f 100644 --- a/chart2/source/controller/sidebar/ChartColorWrapper.cxx +++ b/chart2/source/controller/sidebar/ChartColorWrapper.cxx @@ -67,12 +67,12 @@ ChartColorWrapper::ChartColorWrapper( { } -void ChartColorWrapper::operator()(const OUString& , const Color& rColor) +void ChartColorWrapper::operator()(const OUString& , const NamedColor& rColor) { css::uno::Reference<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 68fb5141b564..b98750312c16 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 7ff9fbf4d097..626124a9c580 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 9675b1029a94..915debae2dfc 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 bea73e4f253e..484897d93afe 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 0f57cf68ef32..33f5ea39e1a1 100644 --- a/cui/source/inc/cuires.hrc +++ b/cui/source/inc/cuires.hrc @@ -85,7 +85,6 @@ #define RID_SVXSTR_CONNECTOR (RID_SVX_START + 221) #define RID_SVXSTR_DIMENSION_LINE (RID_SVX_START + 222) -#define RID_SVXSTR_CHARNAME_TRANSPARENT (RID_SVX_START + 237) #define RID_SVXSTR_DESC_LINEEND (RID_SVX_START + 238) #define RID_SVXSTR_CHARNAME_NOSTYLE (RID_SVX_START + 239) #define RID_SVXSTR_CHARNAME_FAMILY (RID_SVX_START + 240) diff --git a/cui/source/inc/cuitabarea.hxx b/cui/source/inc/cuitabarea.hxx index 52d4fce87273..362777aa0e02 100644 --- a/cui/source/inc/cuitabarea.hxx +++ b/cui/source/inc/cuitabarea.hxx @@ -39,6 +39,7 @@ class SdrModel; class SvxBitmapCtl; +class SvxColorListBox; /************************************************************************/ class ButtonBox @@ -321,7 +322,7 @@ private: VclPtr<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 957b421ecd2f..39e7498e5fdb 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 7f65cbf65511..afaaf1e61ba1 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 3d95da759c74..060d3b0b6587 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 34cd2113f2a3..79af3c1dd8b8 100644 --- a/cui/source/options/optchart.hxx +++ b/cui/source/options/optchart.hxx @@ -29,11 +29,12 @@ #include "cfgchart.hxx" +typedef std::vector<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 43f76b4b6884..1d962bddbd3b 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 ce9948c6c79f..41e525d2d358 100644 --- a/cui/source/tabpages/backgrnd.cxx +++ b/cui/source/tabpages/backgrnd.cxx @@ -381,7 +381,7 @@ SvxBackgroundTabPage::SvxBackgroundTabPage(vcl::Window* pParent, const SfxItemSe m_pBackgroundColorSet->SetSelectHdl( HDL(BackgroundColorHdl_Impl) ); m_pBackgroundColorSet->SetStyle(m_pBackgroundColorSet->GetStyle() | WB_ITEMBORDER | WB_NAMEFIELD | WB_NONEFIELD); - m_pBackgroundColorSet->SetText(SVX_RESSTR(RID_SVXSTR_TRANSPARENT)); + m_pBackgroundColorSet->SetText(SVX_RESSTR(RID_SVXSTR_NOFILL)); } SvxBackgroundTabPage::~SvxBackgroundTabPage() diff --git a/cui/source/tabpages/border.cxx b/cui/source/tabpages/border.cxx index d74ae35b723a..f989a7ce7af6 100644 --- a/cui/source/tabpages/border.cxx +++ b/cui/source/tabpages/border.cxx @@ -284,45 +284,13 @@ SvxBorderTabPage::SvxBorderTabPage(vcl::Window* pParent, const SfxItemSet& rCore m_pLbLineStyle->SetSelectHdl( LINK( this, SvxBorderTabPage, SelStyleHdl_Impl ) ); m_pLbLineColor->SetSelectHdl( LINK( this, SvxBorderTabPage, SelColHdl_Impl ) ); m_pLineWidthMF->SetModifyHdl( LINK( this, SvxBorderTabPage, ModifyWidthHdl_Impl ) ); - m_pLbShadowColor->SetSelectHdl( LINK( this, SvxBorderTabPage, SelColHdl_Impl ) ); m_pWndPresets->SetSelectHdl( LINK( this, SvxBorderTabPage, SelPreHdl_Impl ) ); m_pWndShadows->SetSelectHdl( LINK( this, SvxBorderTabPage, SelSdwHdl_Impl ) ); FillValueSets(); FillLineListBox_Impl(); - // fill ColorBox out of the XColorList - SfxObjectShell* pDocSh = SfxObjectShell::Current(); - XColorListRef pColorTable; - - DBG_ASSERT( pDocSh, "DocShell not found!" ); - - if ( pDocSh ) - { - pItem = pDocSh->GetItem( SID_COLOR_TABLE ); - if ( pItem != nullptr ) - pColorTable = static_cast<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 5aec14626802..70243d055a47 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 17343d80025f..b04d4a8b0c1f 100644 --- a/cui/source/tabpages/borderconn.hxx +++ b/cui/source/tabpages/borderconn.hxx @@ -26,7 +26,7 @@ class SfxItemSet; class MetricField; class ValueSet; -class ColorListBox; +class SvxColorListBox; namespace svx { @@ -47,7 +47,7 @@ sfx::ItemConnectionBase* CreateMarginConnection( const SfxItemSet& rItemSet, /** Creates an item connection object that connects an SvxShadowItem with the controls of the SvxBorderTabPage. */ sfx::ItemConnectionBase* CreateShadowConnection( const SfxItemSet& rItemSet, - ValueSet& rVsPos, MetricField& rMfSize, ColorListBox& rLbColor ); + ValueSet& rVsPos, MetricField& rMfSize, SvxColorListBox& rLbColor ); } diff --git a/cui/source/tabpages/chardlg.cxx b/cui/source/tabpages/chardlg.cxx index d1b7b8b50c28..15a1020591e5 100644 --- a/cui/source/tabpages/chardlg.cxx +++ b/cui/source/tabpages/chardlg.cxx @@ -1348,10 +1348,10 @@ void SvxCharNamePage::PageCreated(const SfxAllItemSet& aSet) SvxCharEffectsPage::SvxCharEffectsPage( vcl::Window* pParent, const SfxItemSet& rInSet ) : SvxCharBasePage(pParent, "EffectsPage", "cui/ui/effectspage.ui", rInSet) - , m_aTransparentColorName(CUI_RES(RID_SVXSTR_CHARNAME_TRANSPARENT)) { get(m_pFontColorFT, "fontcolorft"); get(m_pFontColorLB, "fontcolorlb"); + m_pFontColorLB->SetSlotId(SID_ATTR_CHAR_COLOR); get(m_pEffectsFT, "effectsft"); get(m_pEffectsLB, "effectslb"); get(m_pReliefFT, "reliefft"); @@ -1363,10 +1363,12 @@ SvxCharEffectsPage::SvxCharEffectsPage( vcl::Window* pParent, const SfxItemSet& get(m_pOverlineLB, "overlinelb"); get(m_pOverlineColorFT, "overlinecolorft"); get(m_pOverlineColorLB, "overlinecolorlb"); + m_pOverlineColorLB->SetSlotId(SID_ATTR_CHAR_COLOR); get(m_pStrikeoutLB, "strikeoutlb"); get(m_pUnderlineLB, "underlinelb"); get(m_pUnderlineColorFT, "underlinecolorft"); get(m_pUnderlineColorLB, "underlinecolorlb"); + m_pUnderlineColorLB->SetSlotId(SID_ATTR_CHAR_COLOR); get(m_pIndividualWordsBtn, "individualwordscb"); get(m_pEmphasisFT, "emphasisft"); get(m_pEmphasisLB, "emphasislb"); @@ -1431,55 +1433,14 @@ void SvxCharEffectsPage::Initialize() } } - // fill the color box - SfxObjectShell* pDocSh = SfxObjectShell::Current(); - DBG_ASSERT( pDocSh, "DocShell not found!" ); - XColorListRef pColorTable; - - if ( pDocSh ) - { - pItem = pDocSh->GetItem( SID_COLOR_TABLE ); - if ( pItem != nullptr ) - pColorTable = static_cast<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 6aacd7e695b7..49564a9e1716 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 2bf8809c0d97..0b296d647f89 100644 --- a/cui/source/tabpages/strings.src +++ b/cui/source/tabpages/strings.src @@ -87,10 +87,6 @@ String RID_SVXSTR_DESC_LINEEND { Text [ en-US ] = "Please enter a name for the new arrowhead:" ; }; -String RID_SVXSTR_CHARNAME_TRANSPARENT -{ - Text [ en-US ] = "Transparent"; -}; String RID_SVXSTR_CHARNAME_NOSTYLE { Text [ en-US ] = "No %1"; diff --git a/cui/source/tabpages/tabarea.cxx b/cui/source/tabpages/tabarea.cxx index 6acbf08a03d7..72538f070da7 100644 --- a/cui/source/tabpages/tabarea.cxx +++ b/cui/source/tabpages/tabarea.cxx @@ -266,7 +266,6 @@ void SvxAreaTabDialog::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) { static_cast<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 b9efb53c7850..e8d080e3a812 100644 --- a/cui/source/tabpages/tabline.cxx +++ b/cui/source/tabpages/tabline.cxx @@ -235,7 +235,6 @@ void SvxLineTabDialog::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) static_cast<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 e28e17791d56..7aac0c7fc14c 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 1f4fa526d9da..31efad7ad521 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 11ffd614387d..3172081f1a2c 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 253b1984d478..cb4c7a3d7b88 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 d2b1dca3ce28..84179d24f7bb 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 c783d268396a..a3cb06bb068a 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 d03daf7c34fd..6c8dd3f6aedb 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"> + <object class="svxcorelo-SvxColorListBox" id="error_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -1466,7 +1466,7 @@ </packing> </child> <child> - <object class="svtlo-ColorListBox" id="sqlid_lb"> + <object class="svxcorelo-SvxColorListBox" id="sqlid_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -1501,7 +1501,7 @@ </packing> </child> <child> - <object class="svtlo-ColorListBox" id="sqlnumber_lb"> + <object class="svxcorelo-SvxColorListBox" id="sqlnumber_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -1536,7 +1536,7 @@ </packing> </child> <child> - <object class="svtlo-ColorListBox" id="sqlstring_lb"> + <object class="svxcorelo-SvxColorListBox" id="sqlstring_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -1571,7 +1571,7 @@ </packing> </child> <child> - <object class="svtlo-ColorListBox" id="sqlop_lb"> + <object class="svxcorelo-SvxColorListBox" id="sqlop_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -1606,7 +1606,7 @@ </packing> </child> <child> - <object class="svtlo-ColorListBox" id="sqlkeyword_lb"> + <object class="svxcorelo-SvxColorListBox" id="sqlkeyword_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -1641,7 +1641,7 @@ </packing> </child> <child> - <object class="svtlo-ColorListBox" id="sqlparam_lb"> + <object class="svxcorelo-SvxColorListBox" id="sqlparam_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -1676,7 +1676,7 @@ </packing> </child> <child> - <object class="svtlo-ColorListBox" id="sqlcomment_lb"> + <object class="svxcorelo-SvxColorListBox" id="sqlcomment_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> diff --git a/cui/uiconfig/ui/effectspage.ui b/cui/uiconfig/ui/effectspage.ui index 1e9171cae8ad..bf80526b73e2 100644 --- a/cui/uiconfig/ui/effectspage.ui +++ b/cui/uiconfig/ui/effectspage.ui @@ -324,7 +324,7 @@ </packing> </child> <child> - <object class="svtlo-ColorListBox" id="fontcolorlb"> + <object class="svxcorelo-SvxColorListBox" id="fontcolorlb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -389,7 +389,7 @@ </packing> </child> <child> - <object class="svtlo-ColorListBox" id="underlinecolorlb"> + <object class="svxcorelo-SvxColorListBox" id="underlinecolorlb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -399,7 +399,7 @@ </packing> </child> <child> - <object class="svtlo-ColorListBox" id="overlinecolorlb"> + <object class="svxcorelo-SvxColorListBox" id="overlinecolorlb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> diff --git a/cui/uiconfig/ui/gradientpage.ui b/cui/uiconfig/ui/gradientpage.ui index 8ab982badffd..96bb4baa9d84 100644 --- a/cui/uiconfig/ui/gradientpage.ui +++ b/cui/uiconfig/ui/gradientpage.ui @@ -450,7 +450,7 @@ </packing> </child> <child> - <object class="svxlo-ColorLB" id="colorfromlb"> + <object class="svxcorelo-SvxColorListBox" id="colorfromlb"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="entry_text_column">0</property> @@ -496,7 +496,7 @@ <property name="row_spacing">3</property> <property name="column_spacing">6</property> <child> - <object class="svxlo-ColorLB" id="colortolb"> + <object class="svxcorelo-SvxColorListBox" id="colortolb"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="entry_text_column">0</property> diff --git a/cui/uiconfig/ui/hatchpage.ui b/cui/uiconfig/ui/hatchpage.ui index fd12b3e547f7..365ce1ba5927 100644 --- a/cui/uiconfig/ui/hatchpage.ui +++ b/cui/uiconfig/ui/hatchpage.ui @@ -266,7 +266,7 @@ </packing> </child> <child> - <object class="svxlo-ColorLB" id="linecolorlb"> + <object class="svxcorelo-SvxColorListBox" id="linecolorlb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -292,7 +292,7 @@ </packing> </child> <child> - <object class="svxlo-ColorLB" id="backgroundcolorlb"> + <object class="svxcorelo-SvxColorListBox" id="backgroundcolorlb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> diff --git a/cui/uiconfig/ui/linetabpage.ui b/cui/uiconfig/ui/linetabpage.ui index 0060a6fef564..26dd4db2b166 100644 --- a/cui/uiconfig/ui/linetabpage.ui +++ b/cui/uiconfig/ui/linetabpage.ui @@ -156,7 +156,7 @@ </packing> </child> <child> - <object class="svxlo-ColorLB" id="LB_COLOR"> + <object class="svxcorelo-SvxColorListBox" id="LB_COLOR"> <property name="visible">True</property> <property name="can_focus">False</property> </object> diff --git a/cui/uiconfig/ui/numberingoptionspage.ui b/cui/uiconfig/ui/numberingoptionspage.ui index 71f392aab6df..b1035671e78a 100644 --- a/cui/uiconfig/ui/numberingoptionspage.ui +++ b/cui/uiconfig/ui/numberingoptionspage.ui @@ -485,7 +485,7 @@ </packing> </child> <child> - <object class="svtlo-ColorListBox" id="color"> + <object class="svxcorelo-SvxColorListBox" id="color"> <property name="visible">True</property> <property name="can_focus">False</property> </object> diff --git a/cui/uiconfig/ui/optchartcolorspage.ui b/cui/uiconfig/ui/optchartcolorspage.ui index 3cadc55c6bec..3d1fc1a40b83 100644 --- a/cui/uiconfig/ui/optchartcolorspage.ui +++ b/cui/uiconfig/ui/optchartcolorspage.ui @@ -26,8 +26,7 @@ <property name="top_padding">6</property> <property name="left_padding">12</property> <child> - <object class="svxlo-ColorLB" id="colors:border"> - <property name="dropdown">False</property> + <object class="GtkTreeView" id="colors:border"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="hexpand">True</property> diff --git a/cui/uiconfig/ui/patterntabpage.ui b/cui/uiconfig/ui/patterntabpage.ui index 03bfe52c374e..309608cd34ba 100644 --- a/cui/uiconfig/ui/patterntabpage.ui +++ b/cui/uiconfig/ui/patterntabpage.ui @@ -185,7 +185,7 @@ </packing> </child> <child> - <object class="svxlo-ColorLB" id="LB_COLOR"> + <object class="svxcorelo-SvxColorListBox" id="LB_COLOR"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="halign">start</property> @@ -223,7 +223,7 @@ </packing> </child> <child> - <object class="svxlo-ColorLB" id="LB_BACKGROUND_COLOR"> + <object class="svxcorelo-SvxColorListBox" id="LB_BACKGROUND_COLOR"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="halign">start</property> diff --git a/cui/uiconfig/ui/shadowtabpage.ui b/cui/uiconfig/ui/shadowtabpage.ui index de63629337d3..98c2563b5b14 100644 --- a/cui/uiconfig/ui/shadowtabpage.ui +++ b/cui/uiconfig/ui/shadowtabpage.ui @@ -99,7 +99,7 @@ </packing> </child> <child> - <object class="svxlo-ColorLB" id="LB_SHADOW_COLOR"> + <object class="svxcorelo-SvxColorListBox" id="LB_SHADOW_COLOR"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="halign">start</property> diff --git a/extensions/source/propctrlr/commoncontrol.cxx b/extensions/source/propctrlr/commoncontrol.cxx index 745880465b52..6e9cb6be093d 100644 --- a/extensions/source/propctrlr/commoncontrol.cxx +++ b/extensions/source/propctrlr/commoncontrol.cxx @@ -104,6 +104,11 @@ namespace pcr setModified(); } + IMPL_LINK_NOARG( CommonBehaviourControlHelper, ColorModifiedHdl, SvxColorListBox&, void ) + { + setModified(); + } + IMPL_LINK_NOARG( CommonBehaviourControlHelper, GetFocusHdl, Control&, void ) { try diff --git a/extensions/source/propctrlr/commoncontrol.hxx b/extensions/source/propctrlr/commoncontrol.hxx index 05771dd061f3..0d46aaa5bcce 100644 --- a/extensions/source/propctrlr/commoncontrol.hxx +++ b/extensions/source/propctrlr/commoncontrol.hxx @@ -32,6 +32,7 @@ class NotifyEvent; class Control; class ListBox; +class SvxColorListBox; class Edit; namespace pcr @@ -90,6 +91,7 @@ namespace pcr /// may be used by derived classes, they forward the event to the PropCtrListener DECL_LINK( ModifiedHdl, ListBox&, void ); + DECL_LINK( ColorModifiedHdl, SvxColorListBox&, void ); DECL_LINK( EditModifiedHdl, Edit&, void ); DECL_LINK( GetFocusHdl, Control&, void ); DECL_LINK( LoseFocusHdl, Control&, void ); @@ -150,8 +152,9 @@ namespace pcr inline void impl_checkDisposed_throw(); private: VclPtr<TControlWindow> m_pControlWindow; - void implSetModifyHandler(std::true_type); - void implSetModifyHandler(std::false_type); + void implSetModifyHandler(const Edit&); + void implSetModifyHandler(const ListBox&); + void implSetModifyHandler(const SvxColorListBox&); }; @@ -165,7 +168,7 @@ namespace pcr { if ( _bDoSetHandlers ) { - implSetModifyHandler(std::is_base_of<::Edit,TControlWindow>()); + implSetModifyHandler(*m_pControlWindow); m_pControlWindow->SetGetFocusHdl( LINK( this, CommonBehaviourControlHelper, GetFocusHdl ) ); m_pControlWindow->SetLoseFocusHdl( LINK( this, CommonBehaviourControlHelper, LoseFocusHdl ) ); } @@ -173,18 +176,24 @@ namespace pcr } template< class TControlInterface, class TControlWindow > - inline void CommonBehaviourControl< TControlInterface, TControlWindow >::implSetModifyHandler(std::true_type) + inline void CommonBehaviourControl< TControlInterface, TControlWindow >::implSetModifyHandler(const Edit&) { m_pControlWindow->SetModifyHdl( LINK( this, CommonBehaviourControlHelper, EditModifiedHdl ) ); } template< class TControlInterface, class TControlWindow > - inline void CommonBehaviourControl< TControlInterface, TControlWindow >::implSetModifyHandler(std::false_type) + inline void CommonBehaviourControl< TControlInterface, TControlWindow >::implSetModifyHandler(const ListBox&) { m_pControlWindow->SetModifyHdl( LINK( this, CommonBehaviourControlHelper, ModifiedHdl ) ); } template< class TControlInterface, class TControlWindow > + inline void CommonBehaviourControl< TControlInterface, TControlWindow >::implSetModifyHandler(const SvxColorListBox&) + { + m_pControlWindow->SetModifyHdl( LINK( this, CommonBehaviourControlHelper, ColorModifiedHdl ) ); + } + + template< class TControlInterface, class TControlWindow > inline void CommonBehaviourControl< TControlInterface, TControlWindow >::impl_checkDisposed_throw() { if ( ComponentBaseClass::rBHelper.bDisposed ) diff --git a/extensions/source/propctrlr/standardcontrol.cxx b/extensions/source/propctrlr/standardcontrol.cxx index ca2412f9dbad..7d422966aff4 100644 --- a/extensions/source/propctrlr/standardcontrol.cxx +++ b/extensions/source/propctrlr/standardcontrol.cxx @@ -657,141 +657,50 @@ namespace pcr return aStr.makeStringAndClear(); } - OColorControl::OColorControl(vcl::Window* pParent, WinBits nWinStyle) - :OColorControl_Base( PropertyControlType::ColorListBox, pParent, nWinStyle ) + : OColorControl_Base(PropertyControlType::ColorListBox, pParent, nWinStyle) { - // initialize the color listbox - XColorListRef pColorList; - SfxObjectShell* pDocSh = SfxObjectShell::Current(); - const SfxPoolItem* pItem = pDocSh ? pDocSh->GetItem( SID_COLOR_TABLE ) : nullptr; - if ( pItem ) - { - DBG_ASSERT(dynamic_cast< const SvxColorListItem* >(pItem) != nullptr, "OColorControl::OColorControl: invalid color item!"); - pColorList = static_cast<const SvxColorListItem*>( pItem )->GetColorList(); - } - - if ( !pColorList.is() ) - pColorList = XColorList::GetStdColorList(); - - - DBG_ASSERT(pColorList.is(), "OColorControl::OColorControl: no color table!"); - - if ( pColorList.is() ) - { - for (long i = 0; i < pColorList->Count(); ++i) - { - const XColorEntry* pEntry = pColorList->GetColor(i); - getTypedControlWindow()->InsertEntry( pEntry->GetColor(), pEntry->GetName() ); - } - } - - getTypedControlWindow()->SetDropDownLineCount( LB_DEFAULT_COUNT ); - if ( ( nWinStyle & WB_READONLY ) != 0 ) - { - getTypedControlWindow()->SetReadOnly(); - getTypedControlWindow()->Enable(); - } } - void SAL_CALL OColorControl::setValue( const Any& _rValue ) throw (IllegalTypeException, RuntimeException, std::exception) { if ( _rValue.hasValue() ) { css::util::Color nColor = COL_TRANSPARENT; - if ( _rValue >>= nColor ) - { - ::Color aRgbCol((ColorData)nColor); - - getTypedControlWindow()->SelectEntry( aRgbCol ); - if ( !getTypedControlWindow()->IsEntrySelected( aRgbCol ) ) - { // the given color is not part of the list -> insert a new entry with the hex code of the color - OUString aStr("0x"); - aStr += MakeHexStr(nColor,8); - getTypedControlWindow()->InsertEntry( aRgbCol, aStr ); - getTypedControlWindow()->SelectEntry( aRgbCol ); - } - } - else - { - OUString sNonColorValue; - if ( !( _rValue >>= sNonColorValue ) ) - throw IllegalTypeException(); - getTypedControlWindow()->SelectEntry( sNonColorValue ); - if ( !getTypedControlWindow()->IsEntrySelected( sNonColorValue ) ) - getTypedControlWindow()->SetNoSelection(); - } + _rValue >>= nColor; + ::Color aRgbCol((ColorData)nColor); + getTypedControlWindow()->SelectEntry(std::make_pair(aRgbCol, MakeHexStr(nColor, 8))); } else getTypedControlWindow()->SetNoSelection(); } - Any SAL_CALL OColorControl::getValue() throw (RuntimeException, std::exception) { Any aPropValue; - if ( getTypedControlWindow()->GetSelectEntryCount() > 0 ) + if (!getTypedControlWindow()->IsNoSelection()) { - OUString sSelectedEntry = getTypedControlWindow()->GetSelectEntry(); - if ( m_aNonColorEntries.find( sSelectedEntry ) != m_aNonColorEntries.end() ) - aPropValue <<= sSelectedEntry; - else - { - ::Color aRgbCol = getTypedControlWindow()->GetSelectEntryColor(); - aPropValue <<= (css::util::Color)aRgbCol.GetColor(); - } + ::Color aRgbCol = getTypedControlWindow()->GetSelectEntryColor(); + aPropValue <<= (css::util::Color)aRgbCol.GetColor(); } return aPropValue; } - Type SAL_CALL OColorControl::getValueType() throw (RuntimeException, std::exception) { return ::cppu::UnoType<sal_Int32>::get(); } - - void SAL_CALL OColorControl::clearList() throw (RuntimeException, std::exception) - { - getTypedControlWindow()->Clear(); - } - - - void SAL_CALL OColorControl::prependListEntry( const OUString& NewEntry ) throw (RuntimeException, std::exception) - { - getTypedControlWindow()->InsertEntry( NewEntry, 0 ); - m_aNonColorEntries.insert( NewEntry ); - } - - - void SAL_CALL OColorControl::appendListEntry( const OUString& NewEntry ) throw (RuntimeException, std::exception) - { - getTypedControlWindow()->InsertEntry( NewEntry ); - m_aNonColorEntries.insert( NewEntry ); - } - - Sequence< OUString > SAL_CALL OColorControl::getListEntries( ) throw (RuntimeException, std::exception) - { - if ( !m_aNonColorEntries.empty() ) - return Sequence< OUString >(&(*m_aNonColorEntries.begin()),m_aNonColorEntries.size()); - return Sequence< OUString >(); - } - - void OColorControl::setModified() { OColorControl_Base::setModified(); - if ( !getTypedControlWindow()->IsTravelSelect() ) - // fire a commit - notifyModifiedValue(); + // fire a commit + notifyModifiedValue(); } - //= OListboxControl - OListboxControl::OListboxControl( vcl::Window* pParent, WinBits nWinStyle) :OListboxControl_Base( PropertyControlType::ListBox, pParent, nWinStyle ) { diff --git a/extensions/source/propctrlr/standardcontrol.hxx b/extensions/source/propctrlr/standardcontrol.hxx index ab026d6e2ec4..d3f64e703276 100644 --- a/extensions/source/propctrlr/standardcontrol.hxx +++ b/extensions/source/propctrlr/standardcontrol.hxx @@ -34,6 +34,7 @@ #include <vcl/combobox.hxx> #include <svtools/calendar.hxx> #include <svtools/fmtfield.hxx> +#include <svx/colorbox.hxx> #include <set> @@ -60,18 +61,18 @@ namespace pcr TListboxWindow::SetSelectHdl( LINK(this, ListLikeControlWithModifyHandler, OnSelect) ); } - void SetModifyHdl( const Link<ListBox&,void>& _rLink ) { aModifyHdl = _rLink;; } + void SetModifyHdl( const Link<TListboxWindow&,void>& _rLink ) { aModifyHdl = _rLink;; } private: - DECL_LINK(OnSelect, ListBox&, void); - Link<ListBox&,void> aModifyHdl; + DECL_LINK(OnSelect, TListboxWindow&, void); + Link<TListboxWindow&,void> aModifyHdl; }; template< class LISTBOX_WINDOW > - void ListLikeControlWithModifyHandler< LISTBOX_WINDOW >::LinkStubOnSelect(void * instance, ListBox& data) { + void ListLikeControlWithModifyHandler< LISTBOX_WINDOW >::LinkStubOnSelect(void * instance, LISTBOX_WINDOW& data) { return static_cast<ListLikeControlWithModifyHandler< LISTBOX_WINDOW > *>(instance)->OnSelect(data); } template< class LISTBOX_WINDOW > - void ListLikeControlWithModifyHandler< LISTBOX_WINDOW >::OnSelect(ListBox& rListBox) + void ListLikeControlWithModifyHandler< LISTBOX_WINDOW >::OnSelect(LISTBOX_WINDOW& rListBox) { aModifyHdl.Call(rListBox); } @@ -260,14 +261,11 @@ namespace pcr //= OColorControl - typedef CommonBehaviourControl < css::inspection::XStringListControl - , ListLikeControlWithModifyHandler< ColorListBox > + typedef CommonBehaviourControl < css::inspection::XPropertyControl + , ListLikeControlWithModifyHandler<SvxColorListBox> > OColorControl_Base; class OColorControl : public OColorControl_Base { - private: - ::std::set< OUString > m_aNonColorEntries; - public: OColorControl( vcl::Window* pParent, WinBits nWinStyle ); @@ -276,12 +274,6 @@ namespace pcr virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::beans::IllegalTypeException, css::uno::RuntimeException, std::exception) override; virtual css::uno::Type SAL_CALL getValueType() throw (css::uno::RuntimeException, std::exception) override; - // XStringListControl - virtual void SAL_CALL clearList( ) throw (css::uno::RuntimeException, std::exception) override; - virtual void SAL_CALL prependListEntry( const OUString& NewEntry ) throw (css::uno::RuntimeException, std::exception) override; - virtual void SAL_CALL appendListEntry( const OUString& NewEntry ) throw (css::uno::RuntimeException, std::exception) override; - virtual css::uno::Sequence< OUString > SAL_CALL getListEntries( ) throw (css::uno::RuntimeException, std::exception) override; - protected: // CommonBehaviourControlHelper::setModified virtual void setModified() override; diff --git a/extras/source/glade/libreoffice-catalog.xml.in b/extras/source/glade/libreoffice-catalog.xml.in index b19f135e738d..84a0558def61 100644 --- a/extras/source/glade/libreoffice-catalog.xml.in +++ b/extras/source/glade/libreoffice-catalog.xml.in @@ -94,29 +94,11 @@ </properties> </glade-widget-class> - <glade-widget-class title="Svt Color ListBox" name="svtlo-ColorListBox" - generic-name="Svt Color ListBox" parent="GtkComboBox" + <glade-widget-class title="Color ListBox" name="svxlo-ColorListBox" + generic-name="Color ListBox" parent="GtkComboBox" icon-name="widget-gtk-combobox"> - <properties> - <property save="True" query="False" id="dropdown" default="True" name="Use DropDown"> - <parameter-spec> - <type>GParamBoolean</type> - </parameter-spec> - </property> - </properties> </glade-widget-class> - <glade-widget-class title="Svx Color ListBox" name="svxlo-ColorLB" - generic-name="Svx Color ListBox" parent="GtkComboBox" - icon-name="widget-gtk-combobox"> - <properties> - <property save="True" query="False" id="dropdown" default="True" name="Use DropDown"> - <parameter-spec> - <type>GParamBoolean</type> - </parameter-spec> - </property> - </properties> - </glade-widget-class> <glade-widget-class title="Gradient ListBox" name="svxlo-GradientLB" generic-name="GradientListBox" parent="GtkComboBox" icon-name="widget-gtk-combobox"> diff --git a/include/sfx2/controlwrapper.hxx b/include/sfx2/controlwrapper.hxx index 079258dbfc1a..1e4a2c8f28f2 100644 --- a/include/sfx2/controlwrapper.hxx +++ b/include/sfx2/controlwrapper.hxx @@ -115,7 +115,7 @@ private: | +- DummyWindowWrapper [1] | +- CheckBoxWrapper [1] | +- EditWrapper [1] - | +- ColorListBoxWrapper [1] + | +- SvxColorListBoxWrapper [1] | | | +- MetricFieldWrapper< ValueT > [1] | | | @@ -241,26 +241,6 @@ public: }; -/** A wrapper for the SVTOOLS ColorListBox. */ -class SFX2_DLLPUBLIC ColorListBoxWrapper: - public SingleControlWrapper< ColorListBox, Color > -{ - /* Note: cannot use 'const Color&' as template argument, because the - SVTOOLS ColorListBox returns the color by value and not by reference, - therefore GetControlValue() must return a temporary object too. */ -public: - explicit ColorListBoxWrapper(ColorListBox & rListBox); - - virtual ~ColorListBoxWrapper() override; - - virtual bool IsControlDontKnow() const override; - virtual void SetControlDontKnow( bool bSet ) override; - - virtual Color GetControlValue() const override; - virtual void SetControlValue( Color aColor ) override; -}; - - /** A wrapper for the VCL MetricField. Adds support for field units during accessing the control value. The diff --git a/include/svtools/ctrlbox.hxx b/include/svtools/ctrlbox.hxx index c1ad071123eb..cb5e29d8ada3 100644 --- a/include/svtools/ctrlbox.hxx +++ b/include/svtools/ctrlbox.hxx @@ -33,26 +33,13 @@ #include <o3tl/typed_flags_set.hxx> class FontList; -class ImplColorListData; class ImpLineListData; -typedef ::std::vector< ImplColorListData* > ImpColorList; typedef ::std::vector< ImpLineListData* > ImpLineList; typedef ::std::vector< FontMetric > ImplFontList; /************************************************************************* -Description -============ - -class ColorListBox - -Description - -Allows color selection - --------------------------------------------------------------------------- - class LineListBox Description @@ -141,75 +128,6 @@ FontList; FontNameBox; FontStyleBox; FontSizeMenu *************************************************************************/ -class SVT_DLLPUBLIC ColorListBox : public ListBox -{ - ImpColorList* pColorList; // separate liste, in case of user data are required from outside - Size aImageSize; - - using Window::ImplInit; - SVT_DLLPRIVATE void ImplInit(); - SVT_DLLPRIVATE void ImplDestroyColorEntries(); - -public: - ColorListBox( vcl::Window* pParent, - WinBits nWinStyle = WB_BORDER ); - virtual ~ColorListBox() override; - virtual void dispose() override; - - virtual void UserDraw( const UserDrawEvent& rUDEvt ) override; - - using ListBox::InsertEntry; - sal_Int32 InsertEntry( const OUString& rStr, - sal_Int32 nPos = LISTBOX_APPEND ); - sal_Int32 InsertEntry( const Color& rColor, const OUString& rStr, - sal_Int32 nPos = LISTBOX_APPEND ); - void InsertAutomaticEntryColor(const Color &rAutoColorValue); - bool IsAutomaticSelected() { return !GetSelectEntryPos(); } - using ListBox::RemoveEntry; - void RemoveEntry( sal_Int32 nPos ); - void Clear(); - void CopyEntries( const ColorListBox& rBox ); - - using ListBox::GetEntryPos; - sal_Int32 GetEntryPos( const Color& rColor ) const; - Color GetEntryColor( sal_Int32 nPos ) const; - - void SelectEntry( const OUString& rStr ) - { ListBox::SelectEntry( rStr ); } - void SelectEntry( const Color& rColor ); - Color GetSelectEntryColor() const; - using ListBox::IsEntrySelected; - - bool IsEntrySelected(const Color& rColor) const - { - sal_Int32 nPos = GetEntryPos( rColor ); - if ( nPos != LISTBOX_ENTRY_NOTFOUND ) - return IsEntryPosSelected( nPos ); - else - return false; - } - -private: - ColorListBox( const ColorListBox& ) = delete; - ColorListBox& operator =( const ColorListBox& ) = delete; -}; - -inline void ColorListBox::SelectEntry( const Color& rColor ) -{ - sal_Int32 nPos = GetEntryPos( rColor ); - if ( nPos != LISTBOX_ENTRY_NOTFOUND ) - ListBox::SelectEntryPos( nPos ); -} - -inline Color ColorListBox::GetSelectEntryColor() const -{ - sal_Int32 nPos = GetSelectEntryPos(); - Color aColor; - if ( nPos != LISTBOX_ENTRY_NOTFOUND ) - aColor = GetEntryColor( nPos ); - return aColor; -} - /** Class computing border widths shared between Line style listbox and the SvxBorderLine implementation. diff --git a/include/svtools/svtools.hrc b/include/svtools/svtools.hrc index 92cc8092ab7d..c149f8643c31 100644 --- a/include/svtools/svtools.hrc +++ b/include/svtools/svtools.hrc @@ -26,8 +26,6 @@ // various unsorted stuff -#define STR_SVT_AUTOMATIC_COLOR (RID_SVTOOLS_START+16) - #define STR_SVT_FILEVIEW_COLUMN_TITLE (RID_SVTOOLS_START + 20) #define STR_SVT_FILEVIEW_COLUMN_SIZE (RID_SVTOOLS_START + 21) #define STR_SVT_FILEVIEW_COLUMN_DATE (RID_SVTOOLS_START + 22) diff --git a/include/svx/PaletteManager.hxx b/include/svx/PaletteManager.hxx index c527b85f0f88..2347f0f65ef5 100644 --- a/include/svx/PaletteManager.hxx +++ b/include/svx/PaletteManager.hxx @@ -48,11 +48,10 @@ class SVX_DLLPUBLIC PaletteManager XColorListRef pColorList; Color mLastColor; - typedef std::pair<Color, OUString> color_and_name; - std::deque<color_and_name> maRecentColors; + std::deque<NamedColor> maRecentColors; std::vector<std::unique_ptr<Palette>> m_Palettes; - std::function<void(const OUString&, const Color&)> maColorSelectFunction; + std::function<void(const OUString&, const NamedColor&)> maColorSelectFunction; css::uno::Reference < css::uno::XComponentContext > m_context; public: PaletteManager(); @@ -74,14 +73,14 @@ public: const Color& GetLastColor(); void SetLastColor(const Color& rLastColor); - void AddRecentColor(const Color& rRecentColor, const OUString& rColorName); + void AddRecentColor(const Color& rRecentColor, const OUString& rColorName, bool bFront = true); void SetBtnUpdater(svx::ToolboxButtonColorUpdater* pBtnUpdater); void PopupColorPicker(const OUString& aCommand); - void SetColorSelectFunction(const std::function<void(const OUString&, const Color&)>& aColorSelectFunction); + void SetColorSelectFunction(const std::function<void(const OUString&, const NamedColor&)>& aColorSelectFunction); - static void DispatchColorCommand(const OUString& aCommand, const Color& rColor); + static void DispatchColorCommand(const OUString& aCommand, const NamedColor& rColor); }; #endif // INCLUDED_SVX_PALETTEMANAGER_HXX diff --git a/include/svx/bmpmask.hxx b/include/svx/bmpmask.hxx index 1f66ee5ef7b5..6705b1c5fe5b 100644 --- a/include/svx/bmpmask.hxx +++ b/include/svx/bmpmask.hxx @@ -75,6 +75,7 @@ class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxBmpMaskChildWindow : public SfxChildWindo class MaskData; class MaskSet; class ColorWindow; +class SvxColorListBox; class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxBmpMask : public SfxDockingWindow { @@ -88,28 +89,27 @@ class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxBmpMask : public SfxDockingWindow VclPtr<CheckBox> m_pCbx1; VclPtr<MaskSet> m_pQSet1; VclPtr<MetricField> m_pSp1; - VclPtr<ColorLB> m_pLbColor1; + VclPtr<SvxColorListBox> m_pLbColor1; VclPtr<CheckBox> m_pCbx2; VclPtr<MaskSet> m_pQSet2; VclPtr<MetricField> m_pSp2; - VclPtr<ColorLB> m_pLbColor2; + VclPtr<SvxColorListBox> m_pLbColor2; VclPtr<CheckBox> m_pCbx3; VclPtr<MaskSet> m_pQSet3; VclPtr<MetricField> m_pSp3; - VclPtr<ColorLB> m_pLbColor3; + VclPtr<SvxColorListBox> m_pLbColor3; VclPtr<CheckBox> m_pCbx4; VclPtr<MaskSet> m_pQSet4; VclPtr<MetricField> m_pSp4; - VclPtr<ColorLB> m_pLbColor4; + VclPtr<SvxColorListBox> m_pLbColor4; MaskData* pData; VclPtr<CheckBox> m_pCbxTrans; - VclPtr<ColorLB> m_pLbColorTrans; + VclPtr<SvxColorListBox> m_pLbColorTrans; - XColorListRef pColLst; Color aPipetteColor; SvxBmpMaskSelectItem aSelItem; @@ -140,9 +140,6 @@ public: void SetColor( const Color& rColor ); void PipetteClicked(); - bool NeedsColorList() const; - void SetColorList( const XColorListRef &pColorList ); - void SetExecState( bool bEnable ); Graphic Mask( const Graphic& rGraphic ); diff --git a/include/svx/colorbox.hxx b/include/svx/colorbox.hxx new file mode 100644 index 000000000000..4b7f2513a984 --- /dev/null +++ b/include/svx/colorbox.hxx @@ -0,0 +1,94 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef INCLUDED_SVX_COLORBOX_HXX +#define INCLUDED_SVX_COLORBOX_HXX + +#include <vcl/menubtn.hxx> +#include <svx/colorwindow.hxx> +#include <sfx2/controlwrapper.hxx> + +class SvxColorListBox; + +class SvxListBoxColorWrapper +{ +public: + SvxListBoxColorWrapper(SvxColorListBox* pControl); + void operator()(const OUString& rCommand, const NamedColor& rColor); + void dispose(); +private: + VclPtr<SvxColorListBox> mxControl; +}; + +class SVX_DLLPUBLIC SvxColorListBox : public MenuButton +{ +private: + friend class SvxListBoxColorWrapper; + VclPtr<SvxColorWindow> m_xColorWindow; + Link<SvxColorListBox&, void> m_aSelectedLink; + SvxListBoxColorWrapper m_aColorWrapper; + Color m_aAutoDisplayColor; + NamedColor m_aSelectedColor; + sal_uInt16 m_nSlotId; + bool m_bShowNoneButton; + PaletteManager m_aPaletteManager; + BorderColorStatus m_aBorderColorStatus; + + DECL_LINK(MenuActivateHdl, MenuButton *, void); + void Selected(const NamedColor& rNamedColor); + void createColorWindow(); + void LockWidthRequest(); + VclPtr<SvxColorWindow> getColorWindow() const; +public: + SvxColorListBox(vcl::Window* pParent, WinBits nStyle = 0); + virtual ~SvxColorListBox() override; + virtual void dispose() override; + + void SetSelectHdl(const Link<SvxColorListBox&, void>& rLink) + { + m_aSelectedLink = rLink; + } + + void SetSlotId(sal_uInt16 nSlotId, bool bShowNoneButton = false); + + NamedColor GetSelectEntry() const; + Color GetSelectEntryColor() const; + + void SelectEntry(const NamedColor& rColor); + void SelectEntry(const Color& rColor); + + void SetNoSelection() { getColorWindow()->SetNoSelection(); } + bool IsNoSelection() const { return getColorWindow()->IsNoSelection(); } + + void SetAutoDisplayColor(const Color &rColor) { m_aAutoDisplayColor = rColor; } + void ShowPreview(const NamedColor &rColor); +}; + +/** A wrapper for SvxColorListBox. */ +class SVX_DLLPUBLIC SvxColorListBoxWrapper + : public sfx::SingleControlWrapper<SvxColorListBox, Color> +{ + /* Note: cannot use 'const Color&' as template argument, because the + SvxColorListBox returns the color by value and not by reference, + therefore GetControlValue() must return a temporary object too. */ +public: + explicit SvxColorListBoxWrapper(SvxColorListBox& rListBox); + + virtual ~SvxColorListBoxWrapper() override; + + virtual bool IsControlDontKnow() const override; + virtual void SetControlDontKnow( bool bSet ) override; + + virtual Color GetControlValue() const override; + virtual void SetControlValue( Color aColor ) override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/colorwindow.hxx b/include/svx/colorwindow.hxx index 8b185d952de3..1e417130effb 100644 --- a/include/svx/colorwindow.hxx +++ b/include/svx/colorwindow.hxx @@ -31,8 +31,22 @@ #include <functional> -class BorderColorStatus; +class SVX_DLLPUBLIC BorderColorStatus +{ + Color maColor; + Color maTLBRColor; + Color maBLTRColor; +public: + BorderColorStatus(); + ~BorderColorStatus(); + bool statusChanged( const css::frame::FeatureStateEvent& rEvent ); + Color GetColor(); +}; + class Button; +typedef std::function<void(const OUString&, const NamedColor&)> ColorSelectFunction; + +#define COL_NONE_COLOR TRGB_COLORDATA(0x80, 0xFF, 0xFF, 0xFF) class SVX_DLLPUBLIC SvxColorWindow : public SfxPopupWindow { @@ -43,37 +57,49 @@ private: VclPtr<ListBox> mpPaletteListBox; VclPtr<PushButton> mpButtonAutoColor; + VclPtr<PushButton> mpButtonNoneColor; VclPtr<PushButton> mpButtonPicker; VclPtr<FixedLine> mpAutomaticSeparator; OUString maCommand; - Link<const Color&, void> maSelectedLink; + Link<const NamedColor&, void> maSelectedLink; PaletteManager& mrPaletteManager; BorderColorStatus& mrBorderColorStatus; - std::function<void(const OUString&, const Color&)> maColorSelectFunction; + ColorSelectFunction maColorSelectFunction; DECL_LINK( SelectHdl, ValueSet*, void ); DECL_LINK( SelectPaletteHdl, ListBox&, void); DECL_LINK( AutoColorClickHdl, Button*, void ); DECL_LINK( OpenPickerClickHdl, Button*, void ); + static bool SelectValueSetEntry(SvxColorValueSet* pColorSet, const Color& rColor); + static NamedColor GetSelectEntryColor(ValueSet* pColorSet); + NamedColor GetAutoColor() const; + NamedColor GetNoneColor() const; + public: - SvxColorWindow( const OUString& rCommand, - PaletteManager& rPaletteManager, - BorderColorStatus& rBorderColorStatus, - sal_uInt16 nSlotId, - const css::uno::Reference< css::frame::XFrame >& rFrame, - vcl::Window* pParentWindow, - std::function<void(const OUString&, const Color&)> const & maColorSelectFunction); + SvxColorWindow(const OUString& rCommand, + PaletteManager& rPaletteManager, + BorderColorStatus& rBorderColorStatus, + sal_uInt16 nSlotId, + const css::uno::Reference< css::frame::XFrame >& rFrame, + vcl::Window* pParentWindow, + ColorSelectFunction const& rColorSelectFunction); virtual ~SvxColorWindow() override; virtual void dispose() override; + void ShowNoneButton(); void StartSelection(); + void SetNoSelection(); + bool IsNoSelection() const; + void SelectEntry(const NamedColor& rColor); + void SelectEntry(const Color& rColor); + NamedColor GetSelectEntryColor() const; virtual void KeyInput( const KeyEvent& rKEvt ) override; virtual void statusChanged( const css::frame::FeatureStateEvent& rEvent ) override; - void SetSelectedHdl( const Link<const Color&, void>& rLink ) { maSelectedLink = rLink; } + void SetSelectedHdl( const Link<const NamedColor&, void>& rLink ) { maSelectedLink = rLink; } }; #endif diff --git a/include/svx/dialogs.hrc b/include/svx/dialogs.hrc index 3ccea55d2a4a..589b6a8a7413 100644 --- a/include/svx/dialogs.hrc +++ b/include/svx/dialogs.hrc @@ -31,8 +31,10 @@ // some strings also used in CUI #define RID_SVXERRCTX (RID_SVX_START + 351) #define RID_SVXSTR_COLOR (RID_SVX_START + 179) -#define RID_SVXSTR_TRANSPARENT (RID_SVX_START + 190) +#define RID_SVXSTR_NOFILL (RID_SVX_START + 190) #define RID_SVXSTR_AUTOMATIC (RID_SVX_START + 841) +#define RID_SVXSTR_BY_AUTHOR (RID_SVX_START + 842) +#define RID_SVXSTR_TRANSPARENT (RID_SVX_START + 843) #define RID_SVXSTR_INVISIBLE (RID_SVX_START + 178) #define RID_SVXSTR_NONE (RID_SVX_START + 183) #define RID_SVXSTR_SOLID (RID_SVX_START + 160) @@ -147,9 +149,6 @@ #define RID_SVXIMAGE_COLORDLG (RID_SVX_START + 214) #define RID_SVXFLOAT3D_FAVORITE (RID_SVX_START + 73) -#define RID_SVXFLOAT3D_FIX_X (RID_SVX_START + 74) -#define RID_SVXFLOAT3D_FIX_Y (RID_SVX_START + 75) -#define RID_SVXFLOAT3D_FIX_Z (RID_SVX_START + 76) #define RID_SVXFLOAT3D_FIX_R (RID_SVX_START + 77) #define RID_SVXFLOAT3D_FIX_G (RID_SVX_START + 78) #define RID_SVXFLOAT3D_FIX_B (RID_SVX_START + 84) diff --git a/include/svx/dlgctrl.hxx b/include/svx/dlgctrl.hxx index fbf9369eb608..39cc688b4ded 100644 --- a/include/svx/dlgctrl.hxx +++ b/include/svx/dlgctrl.hxx @@ -207,20 +207,6 @@ public: /************************************************************************/ -class SAL_WARN_UNUSED SVX_DLLPUBLIC ColorLB : public ColorListBox -{ - -public: - ColorLB( vcl::Window* pParent, WinBits aWB ) : ColorListBox( pParent, aWB ) {} - - void Fill( const XColorListRef &pTab ); - - void Append( const XColorEntry& rEntry ); - void Modify( const XColorEntry& rEntry, sal_Int32 nPos ); -}; - -/************************************************************************/ - class SAL_WARN_UNUSED SVX_DLLPUBLIC HatchingLB : public ListBox { public: @@ -245,7 +231,7 @@ public: /************************************************************************/ -class SAL_WARN_UNUSED SVX_DLLPUBLIC FillAttrLB : public ColorListBox +class SAL_WARN_UNUSED SVX_DLLPUBLIC FillAttrLB : public ListBox { private: BitmapEx maBitmapEx; diff --git a/include/svx/float3d.hxx b/include/svx/float3d.hxx index c9a9f957701c..396d104a9f53 100644 --- a/include/svx/float3d.hxx +++ b/include/svx/float3d.hxx @@ -41,14 +41,13 @@ enum class ViewType3D Material }; -class SdrModel; class FmFormModel; class VirtualDevice; class E3dView; class SdrPageView; class Svx3DCtrlItem; class SvxConvertTo3DItem; - +class SvxColorListBox; struct Svx3DWinImpl; @@ -113,16 +112,16 @@ private: VclPtr<PushButton> m_pBtnLight6; VclPtr<PushButton> m_pBtnLight7; VclPtr<PushButton> m_pBtnLight8; - VclPtr<ColorLB> m_pLbLight1; - VclPtr<ColorLB> m_pLbLight2; - VclPtr<ColorLB> m_pLbLight3; - VclPtr<ColorLB> m_pLbLight4; - VclPtr<ColorLB> m_pLbLight5; - VclPtr<ColorLB> m_pLbLight6; - VclPtr<ColorLB> m_pLbLight7; - VclPtr<ColorLB> m_pLbLight8; + VclPtr<SvxColorListBox> m_pLbLight1; + VclPtr<SvxColorListBox> m_pLbLight2; + VclPtr<SvxColorListBox> m_pLbLight3; + VclPtr<SvxColorListBox> m_pLbLight4; + VclPtr<SvxColorListBox> m_pLbLight5; + VclPtr<SvxColorListBox> m_pLbLight6; + VclPtr<SvxColorListBox> m_pLbLight7; + VclPtr<SvxColorListBox> m_pLbLight8; VclPtr<PushButton> m_pBtnLightColor; - VclPtr<ColorLB> m_pLbAmbientlight; // ListBox + VclPtr<SvxColorListBox> m_pLbAmbientlight; // ListBox VclPtr<PushButton> m_pBtnAmbientColor; // color button // Textures @@ -144,13 +143,13 @@ private: // material editor VclPtr<VclContainer> m_pFLMaterial; VclPtr<ListBox> m_pLbMatFavorites; - VclPtr<ColorLB> m_pLbMatColor; + VclPtr<SvxColorListBox> m_pLbMatColor; VclPtr<PushButton> m_pBtnMatColor; - VclPtr<ColorLB> m_pLbMatEmission; + VclPtr<SvxColorListBox> m_pLbMatEmission; VclPtr<PushButton> m_pBtnEmissionColor; VclPtr<VclContainer> m_pFLMatSpecular; - VclPtr<ColorLB> m_pLbMatSpecular; + VclPtr<SvxColorListBox> m_pLbMatSpecular; VclPtr<PushButton> m_pBtnSpecularColor; VclPtr<MetricField> m_pMtrMatSpecularIntensity; @@ -191,6 +190,7 @@ private: DECL_LINK( ClickHdl, Button*, void ); DECL_LINK( ClickColorHdl, Button*, void ); DECL_LINK( SelectHdl, ListBox&, void ); + DECL_LINK( SelectColorHdl, SvxColorListBox&, void ); DECL_LINK( ModifyHdl, Edit&, void ); void ClickLight(PushButton &rBtn); @@ -199,9 +199,9 @@ private: SVX_DLLPRIVATE void Construct(); SVX_DLLPRIVATE void Reset(); - SVX_DLLPRIVATE static bool LBSelectColor( ColorLB* pLb, const Color& rColor ); + SVX_DLLPRIVATE static void LBSelectColor( SvxColorListBox* pLb, const Color& rColor ); SVX_DLLPRIVATE sal_uInt16 GetLightSource( const PushButton* pBtn ); - SVX_DLLPRIVATE ColorLB* GetLbByButton( const PushButton* pBtn = nullptr ); + SVX_DLLPRIVATE SvxColorListBox* GetLbByButton( const PushButton* pBtn = nullptr ); SVX_DLLPRIVATE bool GetUILightState( const PushButton& rBtn ) const; SVX_DLLPRIVATE void SetUILightState( PushButton& aBtn, bool bState ); @@ -215,7 +215,7 @@ public: virtual ~Svx3DWin() override; virtual void dispose() override; - void InitColorLB( const SdrModel* pDoc ); + void InitColorLB(); bool IsUpdateMode() const { return bUpdate; } void Update( SfxItemSet& rSet ); diff --git a/include/svx/fontwork.hxx b/include/svx/fontwork.hxx index 5fe6ad0f7eb3..83d1f3c11ec3 100644 --- a/include/svx/fontwork.hxx +++ b/include/svx/fontwork.hxx @@ -35,6 +35,7 @@ class SdrView; class SdrPageView; class SdrObject; +class SvxColorListBox; class XFormTextAdjustItem; class XFormTextDistanceItem; @@ -107,7 +108,7 @@ class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxFontWorkDialog : public SfxDockingWindow VclPtr<FixedImage> m_pFbShadowY; VclPtr<MetricField> m_pMtrFldShadowY; - VclPtr<ColorLB> m_pShadowColorLB; + VclPtr<SvxColorListBox> m_pShadowColorLB; SfxBindings& rBindings; Idle aInputIdle; @@ -138,8 +139,6 @@ class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxFontWorkDialog : public SfxDockingWindow long nSaveShadowAngle; long nSaveShadowSize; - XColorListRef pColorList; - friend class SvxFontWorkChildWindow; friend class SvxFontWorkControllerItem; @@ -150,7 +149,7 @@ class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxFontWorkDialog : public SfxDockingWindow DECL_LINK( ModifyInputHdl_Impl, Edit&, void ); DECL_LINK( InputTimoutHdl_Impl, Idle *, void ); - DECL_LINK( ColorSelectHdl_Impl, ListBox&, void ); + DECL_LINK( ColorSelectHdl_Impl, SvxColorListBox&, void ); void SetStyle_Impl(const XFormTextStyleItem*); void SetAdjust_Impl(const XFormTextAdjustItem*); @@ -175,8 +174,6 @@ class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxFontWorkDialog : public SfxDockingWindow vcl::Window* pParent); virtual ~SvxFontWorkDialog() override; virtual void dispose() override; - - void SetColorList(const XColorListRef &pTable); }; #endif // INCLUDED_SVX_FONTWORK_HXX diff --git a/include/svx/sidebar/AreaPropertyPanelBase.hxx b/include/svx/sidebar/AreaPropertyPanelBase.hxx index 9d7e62199f3e..372d216f68ba 100644 --- a/include/svx/sidebar/AreaPropertyPanelBase.hxx +++ b/include/svx/sidebar/AreaPropertyPanelBase.hxx @@ -25,6 +25,7 @@ #include <sfx2/sidebar/ControllerItem.hxx> #include <sfx2/sidebar/SidebarController.hxx> #include <sfx2/sidebar/SidebarToolBox.hxx> +#include <svx/colorbox.hxx> #include <svx/xgrad.hxx> #include <svx/itemwin.hxx> #include <svx/xfillit0.hxx> @@ -124,8 +125,8 @@ protected: VclPtr<FixedText> mpColorTextFT; VclPtr<SvxFillTypeBox> mpLbFillType; VclPtr<SvxFillAttrBox> mpLbFillAttr; - VclPtr<ColorLB> mpLbFillGradFrom; - VclPtr<ColorLB> mpLbFillGradTo; + VclPtr<SvxColorListBox> mpLbFillGradFrom; + VclPtr<SvxColorListBox> mpLbFillGradTo; VclPtr<sfx2::sidebar::SidebarToolBox> mpToolBoxColor; // for new color picker VclPtr<FixedText> mpTrspTextFT; VclPtr<ListBox> mpLBTransType; @@ -156,6 +157,7 @@ protected: DECL_LINK(SelectFillTypeHdl, ListBox&, void ); DECL_LINK(SelectFillAttrHdl, ListBox&, void ); + DECL_LINK(SelectFillColorHdl, SvxColorListBox&, void); DECL_LINK(ChangeGradientAngle, Edit&, void); DECL_LINK(ChangeTrgrTypeHdl_Impl, ListBox&, void); DECL_LINK(ModifyTransparentHdl_Impl, Edit&, void); diff --git a/include/svx/svxids.hrc b/include/svx/svxids.hrc index f2a301c63797..8a7f7c5fc4c5 100644 --- a/include/svx/svxids.hrc +++ b/include/svx/svxids.hrc @@ -750,7 +750,7 @@ #define SID_READONLY_MODE ( SID_SVX_START + 930 ) #define SID_ATTR_ALIGN_HYPHENATION ( SID_SVX_START + 931 ) #define SID_ATTR_NUMBERFORMAT_SOURCE ( SID_SVX_START + 932 ) -#define SID_ATTR_AUTO_COLOR_INVALID ( SID_SVX_START + 933 ) + #define SID_RULER_BORDER_DISTANCE ( SID_SVX_START + 935 ) #define SID_INSERT_DATEFIELD ( SID_SVX_START + 936 ) #define SID_INSERT_TIMEFIELD ( SID_SVX_START + 937 ) @@ -999,9 +999,11 @@ #define SID_LINE_ARROW_START ( SID_SVX_START + 1165 ) #define SID_LINE_ARROW_END ( SID_SVX_START + 1166 ) #define SID_DRAW_MEASURELINE ( SID_SVX_START + 1167 ) +#define SID_AUTHOR_COLOR ( SID_SVX_START + 1168 ) +#define SID_BMPMASK_COLOR ( SID_SVX_START + 1169 ) // IMPORTANT NOTE: adjust SID_SVX_FIRSTFREE, when adding new slot id -#define SID_SVX_FIRSTFREE ( SID_DRAW_MEASURELINE + 1 ) +#define SID_SVX_FIRSTFREE ( SID_BMPMASK_COLOR + 1 ) // Overflow check for slot IDs diff --git a/include/svx/tbcontrl.hxx b/include/svx/tbcontrl.hxx index dfa129a7c00b..bf808381c6ac 100644 --- a/include/svx/tbcontrl.hxx +++ b/include/svx/tbcontrl.hxx @@ -136,6 +136,7 @@ #include <svx/strarray.hxx> #include <svx/svxdllapi.h> #include <com/sun/star/awt/FontDescriptor.hpp> +#include <svx/colorwindow.hxx> #include <svx/PaletteManager.hxx> #include <memory> @@ -203,19 +204,8 @@ friend class SfxStyleControllerItem_Impl; SVX_DLLPRIVATE SfxStyleFamily GetActFamily(); }; -class BorderColorStatus -{ - Color maColor; - Color maTLBRColor; - Color maBLTRColor; -public: - BorderColorStatus(); - ~BorderColorStatus(); - bool statusChanged( const css::frame::FeatureStateEvent& rEvent ); - Color GetColor(); -}; +typedef std::function<void(const OUString&, const NamedColor&)> ColorSelectFunction; -typedef std::function<void(const OUString&, const Color&)> ColorSelectFunction; class SVX_DLLPUBLIC SvxColorToolBoxControl : public SfxToolBoxControl { std::unique_ptr<svx::ToolboxButtonColorUpdater> m_xBtnUpdater; @@ -223,7 +213,7 @@ class SVX_DLLPUBLIC SvxColorToolBoxControl : public SfxToolBoxControl BorderColorStatus m_aBorderColorStatus; bool m_bSplitButton; ColorSelectFunction m_aColorSelectFunction; - DECL_LINK(SelectedHdl, const Color&, void); + DECL_LINK(SelectedHdl, const NamedColor&, void); public: SFX_DECL_TOOLBOX_CONTROL(); SvxColorToolBoxControl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rToolBox); diff --git a/reportdesign/inc/RptResId.hrc b/reportdesign/inc/RptResId.hrc index 7e57bba1525a..38102f399e38 100644 --- a/reportdesign/inc/RptResId.hrc +++ b/reportdesign/inc/RptResId.hrc @@ -108,10 +108,6 @@ #define STR_SHOW_RULER ( RID_STRING_START + 63 ) #define STR_SHOW_GRID ( RID_STRING_START + 64 ) -#define STR_COLOR_WHITE ( RID_STRING_START + 65 ) -#define STR_CHARCOLOR ( RID_STRING_START + 66 ) -#define STR_CHARBACKGROUND ( RID_STRING_START + 67 ) -#define STR_TRANSPARENT ( RID_STRING_START + 68 ) #define RID_STR_FIELDSELECTION ( RID_STRING_START + 69 ) #define RID_STR_UNDO_ADD_GROUP_HEADER ( RID_STRING_START + 70 ) diff --git a/reportdesign/inc/helpids.hrc b/reportdesign/inc/helpids.hrc index ed179679859c..aaa488316fe4 100644 --- a/reportdesign/inc/helpids.hrc +++ b/reportdesign/inc/helpids.hrc @@ -31,7 +31,6 @@ #define HID_RPT_HORZ_SCROLLBAR "REPORTDESIGN_HID_RPT_HORZ_SCROLLBAR" #define HID_RPT_VERT_SCROLLBAR "REPORTDESIGN_HID_RPT_VERT_SCROLLBAR" #define HID_RPT_FIELDEXPRESSION "REPORTDESIGN_HID_RPT_FIELDEXPRESSION" -#define HID_RPT_POPUP_COLOR_CTRL "REPORTDESIGN_HID_RPT_POPUP_COLOR_CTRL" #define HID_RPT_POPUP_COLOR "REPORTDESIGN_HID_RPT_POPUP_COLOR" #define HID_RPT_FIELD_SEL "REPORTDESIGN_HID_RPT_FIELD_SEL" #define HID_RPT_FIELD_SEL_WIN "REPORTDESIGN_HID_RPT_FIELD_SEL_WIN" diff --git a/reportdesign/source/ui/dlg/CondFormat.src b/reportdesign/source/ui/dlg/CondFormat.src index e8f16c42975c..ecf70cae59fd 100644 --- a/reportdesign/source/ui/dlg/CondFormat.src +++ b/reportdesign/source/ui/dlg/CondFormat.src @@ -24,21 +24,5 @@ String STR_NUMBERED_CONDITION { Text [ en-US ] = "Condition $number$"; }; -String STR_COLOR_WHITE -{ - Text [ en-US ] = "White" ; -}; -String STR_CHARCOLOR -{ - Text [ en-US ] = "Font color" ; -}; -String STR_CHARBACKGROUND -{ - Text [ en-US ] = "Background"; -}; -String STR_TRANSPARENT -{ - Text [ en-US ] = "No Fill" ; -}; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/ui/dlg/Condition.cxx b/reportdesign/source/ui/dlg/Condition.cxx index 3a216d81ea84..4632306d7b5e 100644 --- a/reportdesign/source/ui/dlg/Condition.cxx +++ b/reportdesign/source/ui/dlg/Condition.cxx @@ -84,144 +84,34 @@ IMPL_LINK( ConditionField, OnFormula, Button*, _pClickedButton, void ) } } -// TO-DO, this is yet another color selector, can it be replaced with SvxColorWindor/SvxColorToolBoxControl ? -#ifndef WB_NO_DIRECTSELECT -#define WB_NO_DIRECTSELECT ((WinBits)0x04000000) -#endif - -#define PALETTE_X 10 -#define PALETTE_Y 10 -#define PALETTE_SIZE (PALETTE_X * PALETTE_Y) -class OColorPopup : public FloatingWindow +ConditionColorWrapper::ConditionColorWrapper(Condition* pControl) + : mxControl(pControl) + , mnSlotId(0) { - DECL_LINK( SelectHdl, ValueSet*, void ); - VclPtr<Condition> m_pCondition; - sal_uInt16 m_nSlotId; -public: - OColorPopup(vcl::Window* _pParent,Condition* _pCondition); - virtual ~OColorPopup() override; - virtual void dispose() override; - VclPtr<ValueSet> m_aColorSet; - - virtual void KeyInput( const KeyEvent& rKEvt ) override; - virtual void Resize() override; - - void StartSelection(); - void SetSlotId(sal_uInt16 _nSlotId); -}; - -OColorPopup::OColorPopup(vcl::Window* _pParent,Condition* _pCondition) -:FloatingWindow(_pParent, WinBits( WB_BORDER | WB_STDFLOATWIN | WB_3DLOOK|WB_DIALOGCONTROL )) -,m_pCondition(_pCondition) -,m_nSlotId(0) -,m_aColorSet( VclPtr<ValueSet>::Create(this, WinBits( WB_ITEMBORDER | WB_NAMEFIELD | WB_3DLOOK | WB_NO_DIRECTSELECT)) ) -{ - m_aColorSet->SetHelpId( HID_RPT_POPUP_COLOR_CTRL ); - SetHelpId( HID_RPT_POPUP_COLOR ); - const Size aSize12( 13, 13 ); - short i = 0; - XColorListRef pColorList( XColorList::CreateStdColorList() ); - long nCount = pColorList->Count(); - Color aColWhite( COL_WHITE ); - OUString aStrWhite( ModuleRes(STR_COLOR_WHITE) ); - - if ( nCount > PALETTE_SIZE ) - // Show scrollbar if more than PALLETTE_SIZE colors are available - m_aColorSet->SetStyle( m_aColorSet->GetStyle() | WB_VSCROLL ); - - for ( i = 0; i < nCount; i++ ) - { - const XColorEntry* pEntry = pColorList->GetColor(i); - m_aColorSet->InsertItem( i+1, pEntry->GetColor(), pEntry->GetName() ); - } - - while ( i < PALETTE_SIZE ) - { - // fill empty elements if less then PALLETTE_SIZE colors are available - m_aColorSet->InsertItem( i+1, aColWhite, aStrWhite ); - i++; - } - - m_aColorSet->SetSelectHdl( LINK( this, OColorPopup, SelectHdl ) ); - m_aColorSet->SetColCount( PALETTE_X ); - m_aColorSet->SetLineCount( PALETTE_Y ); - Size aSize = m_aColorSet->CalcWindowSizePixel( aSize12 ); - aSize.Width() += 4; - aSize.Height() += 4; - SetOutputSizePixel( aSize ); - m_aColorSet->Show(); -} - -OColorPopup::~OColorPopup() -{ - disposeOnce(); -} - -void OColorPopup::dispose() -{ - disposeBuilder(); - m_aColorSet.disposeAndClear(); - m_pCondition.clear(); - FloatingWindow::dispose(); -} - -void OColorPopup::KeyInput( const KeyEvent& rKEvt ) -{ - m_aColorSet->KeyInput(rKEvt); } -void OColorPopup::Resize() +void ConditionColorWrapper::dispose() { - Size aSize = GetOutputSizePixel(); - aSize.Width() -= 4; - aSize.Height() -= 4; - m_aColorSet->SetPosSizePixel( Point(2,2), aSize ); + mxControl.clear(); } -void OColorPopup::StartSelection() +void ConditionColorWrapper::operator()(const OUString& /*rCommand*/, const NamedColor& rNamedColor) { - m_aColorSet->StartSelection(); + mxControl->ApplyCommand(mnSlotId, rNamedColor.first); } -void OColorPopup::SetSlotId(sal_uInt16 _nSlotId) -{ - m_nSlotId = _nSlotId; - if ( SID_ATTR_CHAR_COLOR_BACKGROUND == _nSlotId || SID_BACKGROUND_COLOR == _nSlotId ) - { - m_aColorSet->SetStyle( m_aColorSet->GetStyle() | WB_NONEFIELD ); - m_aColorSet->SetText( OUString(ModuleRes( STR_TRANSPARENT )) ); - } -} - -IMPL_LINK_NOARG(OColorPopup, SelectHdl, ValueSet*, void) -{ - sal_uInt16 nItemId = m_aColorSet->GetSelectItemId(); - Color aColor( nItemId == 0 ? Color( COL_TRANSPARENT ) : m_aColorSet->GetItemColor( nItemId ) ); - - /* #i33380# Moved the following line above the Dispatch() calls. - This instance may be deleted in the meantime (i.e. when a dialog is opened - while in Dispatch()), accessing members will crash in this case. */ - m_aColorSet->SetNoSelection(); - - if ( IsInPopupMode() ) - EndPopupMode(); - - m_pCondition->ApplyCommand( m_nSlotId, aColor ); -} - - // = Condition Condition::Condition( vcl::Window* _pParent, IConditionalFormatAction& _rAction, ::rptui::OReportController& _rController ) - :VclHBox(_pParent) - ,m_rController( _rController ) - ,m_rAction( _rAction ) - ,m_pColorFloat(nullptr) - ,m_pBtnUpdaterFontColor(nullptr) - ,m_pBtnUpdaterBackgroundColor(nullptr) - ,m_nCondIndex( 0 ) - ,m_bInDestruction( false ) + : VclHBox(_pParent) + , m_aColorWrapper(this) + , m_rController(_rController) + , m_rAction(_rAction) + , m_pBtnUpdaterFontColor(nullptr) + , m_pBtnUpdaterBackgroundColor(nullptr) + , m_nCondIndex(0) + , m_bInDestruction(false) { m_pUIBuilder = new VclBuilder(this, getUIRootDir(), "modules/dbreport/ui/conditionwin.ui"); @@ -328,31 +218,27 @@ void Condition::dispose() m_pAddCondition.clear(); m_pRemoveCondition.clear(); m_pColorFloat.disposeAndClear(); + m_aColorWrapper.dispose(); disposeBuilder(); VclHBox::dispose(); } -IMPL_LINK_NOARG( Condition, DropdownClick, ToolBox*, void ) +IMPL_LINK(Condition, DropdownClick, ToolBox*, pToolBox, void) { sal_uInt16 nId( m_pActions->GetCurItemId() ); - if ( !m_pColorFloat ) - m_pColorFloat = VclPtr<OColorPopup>::Create(m_pActions,this); - - sal_uInt16 nTextId = 0; - if (nId == m_nFontColorId) - { - nTextId = STR_CHARCOLOR; - } - else if (nId == m_nBackgroundColorId) - { - nTextId = STR_CHARBACKGROUND; - } - if ( nTextId ) - m_pColorFloat->SetText(OUString(ModuleRes(nTextId))); - m_pColorFloat->SetSlotId(mapToolbarItemToSlotId(nId)); - m_pColorFloat->SetPosPixel(m_pActions->GetItemPopupPosition(nId,m_pColorFloat->GetSizePixel())); - m_pColorFloat->StartPopupMode(m_pActions); - m_pColorFloat->StartSelection(); + m_pColorFloat.disposeAndClear(); + sal_uInt16 nSlotId(mapToolbarItemToSlotId(nId)); + m_aColorWrapper.SetSlotId(nSlotId); + m_pColorFloat = VclPtr<SvxColorWindow>::Create( + OUString() /*m_aCommandURL*/, + m_aPaletteManager, + m_aBorderColorStatus, + nSlotId, + nullptr, + pToolBox, + m_aColorWrapper); + + m_pColorFloat->StartPopupMode(pToolBox, FloatWinPopupFlags::GrabFocus); } IMPL_LINK_NOARG( Condition, OnFormatAction, ToolBox*, void ) diff --git a/reportdesign/source/ui/dlg/Condition.hxx b/reportdesign/source/ui/dlg/Condition.hxx index ab5194ade94c..6a6d64e19b9e 100644 --- a/reportdesign/source/ui/dlg/Condition.hxx +++ b/reportdesign/source/ui/dlg/Condition.hxx @@ -26,6 +26,7 @@ #include <dbaccess/ToolBoxHelper.hxx> +#include <svx/colorwindow.hxx> #include <svx/fntctrl.hxx> #include <vcl/fixed.hxx> @@ -62,6 +63,18 @@ namespace rptui OUString GetText() const { return m_pSubEdit->GetText(); } }; + class ConditionColorWrapper + { + public: + ConditionColorWrapper(Condition* pControl); + void SetSlotId(sal_uInt16 nSlotId) { mnSlotId = nSlotId; } + void operator()(const OUString& rCommand, const NamedColor& rColor); + void dispose(); + private: + VclPtr<Condition> mxControl; + sal_uInt16 mnSlotId; + }; + //= Condition class Condition :public VclHBox @@ -74,6 +87,9 @@ namespace rptui sal_uInt16 m_nBackgroundColorId; sal_uInt16 m_nFontColorId; sal_uInt16 m_nFontDialogId; + PaletteManager m_aPaletteManager; + BorderColorStatus m_aBorderColorStatus; + ConditionColorWrapper m_aColorWrapper; ::rptui::OReportController& m_rController; IConditionalFormatAction& m_rAction; @@ -89,7 +105,7 @@ namespace rptui VclPtr<PushButton> m_pMoveDown; VclPtr<PushButton> m_pAddCondition; VclPtr<PushButton> m_pRemoveCondition; - VclPtr<OColorPopup> m_pColorFloat; + VclPtr<SvxColorWindow> m_pColorFloat; svx::ToolboxButtonColorUpdater* m_pBtnUpdaterFontColor; // updates the color below the toolbar icon svx::ToolboxButtonColorUpdater* m_pBtnUpdaterBackgroundColor; diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc index 26bd9e97885e..64ae387c84e3 100644 --- a/sc/inc/sc.hrc +++ b/sc/inc/sc.hrc @@ -827,7 +827,7 @@ #define SCSTR_ORIENTATION_TOPBOTTOM (STR_START + 110) #define SCSTR_ORIENTATION_BOTTOMTOP (STR_START + 111) #define SCSTR_ORIENTATION_STANDARD (STR_START + 112) -#define SCSTR_AUTHOR (STR_START + 113) +//free #define SCSTR_UNIT (STR_START + 114) // print options diff --git a/sc/source/ui/condformat/colorformat.cxx b/sc/source/ui/condformat/colorformat.cxx index ab2e08983b3f..f6e9ebc4eb9d 100644 --- a/sc/source/ui/condformat/colorformat.cxx +++ b/sc/source/ui/condformat/colorformat.cxx @@ -13,6 +13,7 @@ #include "document.hxx" #include "sc.hrc" +#include <svx/colorbox.hxx> #include <svx/xtable.hxx> #include <svx/drawitem.hxx> #include <vcl/msgbox.hxx> @@ -66,16 +67,6 @@ void SetValue( ScDocument* pDoc, ScColorScaleEntry* pEntry, Edit& aEdit) aEdit.Disable(); } -void SelectColor(const Color& aColor, const OUString & aCustomName, ColorListBox& rLstBox) -{ - rLstBox.SelectEntry( aColor ); - if ( rLstBox.GetSelectEntryColor() != aColor ) - { - rLstBox.InsertEntry( aColor, aCustomName ); - rLstBox.SelectEntry( aColor ); - } -} - } ScDataBarSettingsDlg::ScDataBarSettingsDlg(vcl::Window* pWindow, const ScDataBarFormatData& rData, ScDocument* pDoc, const ScAddress& rPos): @@ -100,14 +91,13 @@ ScDataBarSettingsDlg::ScDataBarSettingsDlg(vcl::Window* pWindow, const ScDataBar get( mpCbOnlyBar, "only_bar"); maStrWarnSameValue = get<FixedText>("str_same_value")->GetText(); - maCustomColor = get<FixedText>("custom_color")->GetText(); Init(); - ::SelectColor( rData.maPositiveColor, maCustomColor, *mpLbPos); + mpLbPos->SelectEntry(rData.maPositiveColor); mpLbFillType->SelectEntryPos( rData.mbGradient ? 1 : 0 ); - if(rData.mpNegativeColor) - ::SelectColor( *rData.mpNegativeColor, maCustomColor, *mpLbNeg ); + if (rData.mpNegativeColor) + mpLbNeg->SelectEntry(*rData.mpNegativeColor); switch (rData.meAxisPosition) { @@ -160,42 +150,9 @@ void ScDataBarSettingsDlg::dispose() void ScDataBarSettingsDlg::Init() { - SfxObjectShell* pDocSh = SfxObjectShell::Current(); - XColorListRef pColorTable; - - DBG_ASSERT( pDocSh, "DocShell not found!" ); - - if ( pDocSh ) - { - const SfxPoolItem* pItem = pDocSh->GetItem( SID_COLOR_TABLE ); - if ( pItem != nullptr ) - pColorTable = static_cast<const SvxColorListItem*>(pItem)->GetColorList(); - } - if ( pColorTable.is() ) - { - // filling the line color box - mpLbPos->SetUpdateMode( false ); - mpLbNeg->SetUpdateMode( false ); - mpLbAxisCol->SetUpdateMode( false ); - - for ( long i = 0; i < pColorTable->Count(); ++i ) - { - const XColorEntry* pEntry = pColorTable->GetColor(i); - mpLbPos->InsertEntry( pEntry->GetColor(), pEntry->GetName() ); - mpLbNeg->InsertEntry( pEntry->GetColor(), pEntry->GetName() ); - mpLbAxisCol->InsertEntry( pEntry->GetColor(), pEntry->GetName() ); - - if(pEntry->GetColor() == Color(COL_LIGHTRED)) - mpLbNeg->SelectEntryPos(i); - if(pEntry->GetColor() == Color(COL_BLACK)) - mpLbAxisCol->SelectEntryPos(i); - if(pEntry->GetColor() == Color(COL_LIGHTBLUE)) - mpLbPos->SelectEntryPos(i); - } - mpLbPos->SetUpdateMode( true ); - mpLbNeg->SetUpdateMode( true ); - mpLbAxisCol->SetUpdateMode( true ); - } + mpLbNeg->SelectEntry(Color(COL_LIGHTRED)); + mpLbAxisCol->SelectEntry(Color(COL_BLACK)); + mpLbPos->SelectEntry(Color(COL_LIGHTBLUE)); mpBtnOk->SetClickHdl( LINK( this, ScDataBarSettingsDlg, OkBtnHdl ) ); mpLbTypeMin->SetSelectHdl( LINK( this, ScDataBarSettingsDlg, TypeSelectHdl ) ); diff --git a/sc/source/ui/condformat/condformatdlgentry.cxx b/sc/source/ui/condformat/condformatdlgentry.cxx index 415aa11274e5..f4273992e9f4 100644 --- a/sc/source/ui/condformat/condformatdlgentry.cxx +++ b/sc/source/ui/condformat/condformatdlgentry.cxx @@ -18,6 +18,7 @@ #include <sfx2/dispatch.hxx> #include <svl/stritem.hxx> #include <svl/intitem.hxx> +#include <svx/colorbox.hxx> #include <svx/xtable.hxx> #include <svx/drawitem.hxx> #include <vcl/msgbox.hxx> @@ -663,7 +664,7 @@ OUString convertNumberToString(double nVal, ScDocument* pDoc) return aText; } -void SetColorScaleEntryTypes( const ScColorScaleEntry& rEntry, ListBox& rLbType, Edit& rEdit, ColorListBox& rLbCol, ScDocument* pDoc ) +void SetColorScaleEntryTypes( const ScColorScaleEntry& rEntry, ListBox& rLbType, Edit& rEdit, SvxColorListBox& rLbCol, ScDocument* pDoc ) { // entry Automatic is not available for color scales sal_Int32 nIndex = static_cast<sal_Int32>(rEntry.GetType()); @@ -726,7 +727,7 @@ void SetColorScaleEntry( ScColorScaleEntry* pEntry, const ListBox& rType, const } } -ScColorScaleEntry* createColorScaleEntry( const ListBox& rType, const ColorListBox& rColor, const Edit& rValue, ScDocument* pDoc, const ScAddress& rPos ) +ScColorScaleEntry* createColorScaleEntry( const ListBox& rType, const SvxColorListBox& rColor, const Edit& rValue, ScDocument* pDoc, const ScAddress& rPos ) { ScColorScaleEntry* pEntry = new ScColorScaleEntry(); @@ -796,38 +797,8 @@ void ScColorScale2FrmtEntry::Init() { maLbEntryTypeMin->SetSelectHdl( LINK( this, ScColorScale2FrmtEntry, EntryTypeHdl ) ); maLbEntryTypeMax->SetSelectHdl( LINK( this, ScColorScale2FrmtEntry, EntryTypeHdl ) ); - - SfxObjectShell* pDocSh = SfxObjectShell::Current(); - XColorListRef pColorTable; - - DBG_ASSERT( pDocSh, "DocShell not found!" ); - - if ( pDocSh ) - { - const SfxPoolItem* pItem = pDocSh->GetItem( SID_COLOR_TABLE ); - if ( pItem != nullptr ) - pColorTable = static_cast<const SvxColorListItem*>(pItem) ->GetColorList(); - } - if ( pColorTable.is() ) - { - // filling the line color box - maLbColMin->SetUpdateMode( false ); - maLbColMax->SetUpdateMode( false ); - - for ( long i = 0; i < pColorTable->Count(); ++i ) - { - const XColorEntry* pEntry = pColorTable->GetColor(i); - maLbColMin->InsertEntry( pEntry->GetColor(), pEntry->GetName() ); - maLbColMax->InsertEntry( pEntry->GetColor(), pEntry->GetName() ); - - if(pEntry->GetColor() == Color(COL_LIGHTRED)) - maLbColMin->SelectEntryPos(i); - if(pEntry->GetColor() == Color(COL_LIGHTBLUE)) - maLbColMax->SelectEntryPos(i); - } - maLbColMin->SetUpdateMode( true ); - maLbColMax->SetUpdateMode( true ); - } + maLbColMin->SelectEntry(Color(COL_LIGHTRED)); + maLbColMax->SelectEntry(Color(COL_LIGHTBLUE)); } ScFormatEntry* ScColorScale2FrmtEntry::createColorscaleEntry() const @@ -976,43 +947,9 @@ void ScColorScale3FrmtEntry::Init() maLbEntryTypeMin->SetSelectHdl( LINK( this, ScColorScale3FrmtEntry, EntryTypeHdl ) ); maLbEntryTypeMax->SetSelectHdl( LINK( this, ScColorScale3FrmtEntry, EntryTypeHdl ) ); maLbEntryTypeMiddle->SetSelectHdl( LINK( this, ScColorScale3FrmtEntry, EntryTypeHdl ) ); - - SfxObjectShell* pDocSh = SfxObjectShell::Current(); - XColorListRef pColorTable; - - DBG_ASSERT( pDocSh, "DocShell not found!" ); - - if ( pDocSh ) - { - const SfxPoolItem* pItem = pDocSh->GetItem( SID_COLOR_TABLE ); - if ( pItem != nullptr ) - pColorTable = static_cast<const SvxColorListItem*>(pItem)->GetColorList(); - } - if ( pColorTable.is() ) - { - // filling the line color box - maLbColMin->SetUpdateMode( false ); - maLbColMiddle->SetUpdateMode( false ); - maLbColMax->SetUpdateMode( false ); - - for ( long i = 0; i < pColorTable->Count(); ++i ) - { - const XColorEntry* pEntry = pColorTable->GetColor(i); - maLbColMin->InsertEntry( pEntry->GetColor(), pEntry->GetName() ); - maLbColMiddle->InsertEntry( pEntry->GetColor(), pEntry->GetName() ); - maLbColMax->InsertEntry( pEntry->GetColor(), pEntry->GetName() ); - - if(pEntry->GetColor() == Color(COL_LIGHTRED)) - maLbColMin->SelectEntryPos(i); - if(pEntry->GetColor() == Color(COL_YELLOW)) - maLbColMiddle->SelectEntryPos(i); - if(pEntry->GetColor() == Color(0x00CC00)) // Green 3 - maLbColMax->SelectEntryPos(i); - } - maLbColMin->SetUpdateMode( true ); - maLbColMiddle->SetUpdateMode( true ); - maLbColMax->SetUpdateMode( true ); - } + maLbColMin->SelectEntry(Color(COL_LIGHTRED)); + maLbColMiddle->SelectEntry(Color(COL_YELLOW)); + maLbColMax->SelectEntry(Color(0x00CC00)); } ScFormatEntry* ScColorScale3FrmtEntry::createColorscaleEntry() const diff --git a/sc/source/ui/dbgui/scendlg.cxx b/sc/source/ui/dbgui/scendlg.cxx index 3cd9044ca12d..efcd657caed7 100644 --- a/sc/source/ui/dbgui/scendlg.cxx +++ b/sc/source/ui/dbgui/scendlg.cxx @@ -21,6 +21,7 @@ #include "scitems.hxx" #include <comphelper/string.hxx> +#include <svx/colorbox.hxx> #include <svx/drawitem.hxx> #include <svx/xtable.hxx> #include <sfx2/objsh.hxx> @@ -58,27 +59,6 @@ ScNewScenarioDlg::ScNewScenarioDlg( vcl::Window* pParent, const OUString& rName, if (bIsEdit) SetText(get<FixedText>("alttitle")->GetText()); - SfxObjectShell* pDocSh = SfxObjectShell::Current(); - if ( pDocSh ) - { - const SfxPoolItem* pItem = pDocSh->GetItem( SID_COLOR_TABLE ); - if ( pItem ) - { - XColorListRef pColorList = static_cast<const SvxColorListItem*>(pItem)->GetColorList(); - if (pColorList.is()) - { - m_pLbColor->SetUpdateMode( false ); - long nCount = pColorList->Count(); - for ( long n=0; n<nCount; n++ ) - { - const XColorEntry* pEntry = pColorList->GetColor(n); - m_pLbColor->InsertEntry( pEntry->GetColor(), pEntry->GetName() ); - } - m_pLbColor->SetUpdateMode( true ); - } - } - } - SvtUserOptions aUserOpt; OUString sCreatedBy(get<FixedText>("createdft")->GetText()); diff --git a/sc/source/ui/drawfunc/drawsh4.cxx b/sc/source/ui/drawfunc/drawsh4.cxx index 9e620e5099b4..01d2576c7a61 100644 --- a/sc/source/ui/drawfunc/drawsh4.cxx +++ b/sc/source/ui/drawfunc/drawsh4.cxx @@ -34,17 +34,8 @@ void ScDrawShell::GetFormTextState(SfxItemSet& rSet) { const SdrObject* pObj = nullptr; - SvxFontWorkDialog* pDlg = nullptr; ScDrawView* pDrView = pViewData->GetScDrawView(); const SdrMarkList& rMarkList = pDrView->GetMarkedObjectList(); - sal_uInt16 nId = SvxFontWorkChildWindow::GetChildWindowId(); - - SfxViewFrame* pViewFrm = pViewData->GetViewShell()->GetViewFrame(); - if (pViewFrm->HasChildWindow(nId)) - { - SfxChildWindow* pWnd = pViewFrm->GetChildWindow(nId); - pDlg = pWnd ? static_cast<SvxFontWorkDialog*>(pWnd->GetWindow()) : nullptr; - } if ( rMarkList.GetMarkCount() == 1 ) pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); @@ -72,22 +63,6 @@ void ScDrawShell::GetFormTextState(SfxItemSet& rSet) } else { - if ( pDlg ) - { - SfxObjectShell* pDocSh = SfxObjectShell::Current(); - - if ( pDocSh ) - { - const SfxPoolItem* pItem = pDocSh->GetItem( SID_COLOR_TABLE ); - XColorListRef pColorList; - - if ( pItem ) - pColorList = static_cast<const SvxColorListItem*>(pItem)->GetColorList(); - - if ( pColorList.is() ) - pDlg->SetColorList( pColorList ); - } - } SfxItemSet aViewAttr(pDrView->GetModel()->GetItemPool()); pDrView->GetAttributes(aViewAttr); rSet.Set(aViewAttr); diff --git a/sc/source/ui/drawfunc/drtxtob2.cxx b/sc/source/ui/drawfunc/drtxtob2.cxx index 9a97a6aed7af..a7eb77aea3e7 100644 --- a/sc/source/ui/drawfunc/drtxtob2.cxx +++ b/sc/source/ui/drawfunc/drtxtob2.cxx @@ -202,17 +202,8 @@ void ScDrawTextObjectBar::ExecFormText(SfxRequest& rReq) void ScDrawTextObjectBar::GetFormTextState(SfxItemSet& rSet) { const SdrObject* pObj = nullptr; - SvxFontWorkDialog* pDlg = nullptr; ScDrawView* pDrView = pViewData->GetView()->GetScDrawView(); const SdrMarkList& rMarkList = pDrView->GetMarkedObjectList(); - sal_uInt16 nId = SvxFontWorkChildWindow::GetChildWindowId(); - - SfxViewFrame* pViewFrm = pViewData->GetViewShell()->GetViewFrame(); - if (pViewFrm->HasChildWindow(nId)) - { - SfxChildWindow* pWnd = pViewFrm->GetChildWindow(nId); - pDlg = pWnd ? static_cast<SvxFontWorkDialog*>(pWnd->GetWindow()) : nullptr; - } if ( rMarkList.GetMarkCount() == 1 ) pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); @@ -240,22 +231,6 @@ void ScDrawTextObjectBar::GetFormTextState(SfxItemSet& rSet) } else { - if ( pDlg ) - { - SfxObjectShell* pDocSh = SfxObjectShell::Current(); - - if ( pDocSh ) - { - const SfxPoolItem* pItem = pDocSh->GetItem( SID_COLOR_TABLE ); - XColorListRef pColorList; - - if ( pItem ) - pColorList = static_cast<const SvxColorListItem*>(pItem)->GetColorList(); - - if ( pColorList.is() ) - pDlg->SetColorList( pColorList ); - } - } SfxItemSet aViewAttr(pDrView->GetModel()->GetItemPool()); pDrView->GetAttributes(aViewAttr); rSet.Set(aViewAttr); diff --git a/sc/source/ui/inc/colorformat.hxx b/sc/source/ui/inc/colorformat.hxx index 682be33c87ad..8838418cfc18 100644 --- a/sc/source/ui/inc/colorformat.hxx +++ b/sc/source/ui/inc/colorformat.hxx @@ -19,6 +19,7 @@ struct ScDataBarFormatData; class ScDocument; +class SvxColorListBox; class ScDataBarSettingsDlg : public ModalDialog { @@ -26,9 +27,9 @@ private: VclPtr<OKButton> mpBtnOk; VclPtr<CancelButton> mpBtnCancel; - VclPtr<ColorListBox> mpLbPos; - VclPtr<ColorListBox> mpLbNeg; - VclPtr<ColorListBox> mpLbAxisCol; + VclPtr<SvxColorListBox> mpLbPos; + VclPtr<SvxColorListBox> mpLbNeg; + VclPtr<SvxColorListBox> mpLbAxisCol; VclPtr<ListBox> mpLbFillType; VclPtr<ListBox> mpLbTypeMin; @@ -43,7 +44,6 @@ private: VclPtr<CheckBox> mpCbOnlyBar; OUString maStrWarnSameValue; - OUString maCustomColor; SvNumberFormatter* mpNumberFormatter; ScDocument* mpDoc; diff --git a/sc/source/ui/inc/condformatdlgentry.hxx b/sc/source/ui/inc/condformatdlgentry.hxx index cba12245772f..f7d446ff474b 100644 --- a/sc/source/ui/inc/condformatdlgentry.hxx +++ b/sc/source/ui/inc/condformatdlgentry.hxx @@ -18,6 +18,7 @@ class ScIconSetFrmtDataEntry; class ScCondFormatDlg; +class SvxColorListBox; namespace condformat { @@ -172,8 +173,8 @@ class ScColorScale2FrmtEntry : public ScCondFrmtEntry VclPtr<Edit> maEdMin; VclPtr<Edit> maEdMax; - VclPtr<ColorListBox> maLbColMin; - VclPtr<ColorListBox> maLbColMax; + VclPtr<SvxColorListBox> maLbColMin; + VclPtr<SvxColorListBox> maLbColMax; ScFormatEntry* createColorscaleEntry() const; @@ -206,9 +207,9 @@ class ScColorScale3FrmtEntry : public ScCondFrmtEntry VclPtr<Edit> maEdMiddle; VclPtr<Edit> maEdMax; - VclPtr<ColorListBox> maLbColMin; - VclPtr<ColorListBox> maLbColMiddle; - VclPtr<ColorListBox> maLbColMax; + VclPtr<SvxColorListBox> maLbColMin; + VclPtr<SvxColorListBox> maLbColMiddle; + VclPtr<SvxColorListBox> maLbColMax; ScFormatEntry* createColorscaleEntry() const; diff --git a/sc/source/ui/inc/opredlin.hxx b/sc/source/ui/inc/opredlin.hxx index a0a3e765c3be..69d1bfb31db4 100644 --- a/sc/source/ui/inc/opredlin.hxx +++ b/sc/source/ui/inc/opredlin.hxx @@ -36,11 +36,10 @@ class ScRedlineOptionsTabPage : public SfxTabPage { - VclPtr<ColorListBox> m_pContentColorLB; - VclPtr<ColorListBox> m_pRemoveColorLB; - VclPtr<ColorListBox> m_pInsertColorLB; - VclPtr<ColorListBox> m_pMoveColorLB; - OUString aAuthorStr; + VclPtr<SvxColorListBox> m_pContentColorLB; + VclPtr<SvxColorListBox> m_pRemoveColorLB; + VclPtr<SvxColorListBox> m_pInsertColorLB; + VclPtr<SvxColorListBox> m_pMoveColorLB; public: diff --git a/sc/source/ui/inc/scendlg.hxx b/sc/source/ui/inc/scendlg.hxx index e20073c17882..3d5ecf4ce7e5 100644 --- a/sc/source/ui/inc/scendlg.hxx +++ b/sc/source/ui/inc/scendlg.hxx @@ -29,6 +29,8 @@ enum class ScScenarioFlags; +class SvxColorListBox; + class ScNewScenarioDlg : public ModalDialog { public: @@ -45,7 +47,7 @@ private: VclPtr<Edit> m_pEdName; VclPtr<VclMultiLineEdit> m_pEdComment; VclPtr<CheckBox> m_pCbShowFrame; - VclPtr<ColorListBox> m_pLbColor; + VclPtr<SvxColorListBox> m_pLbColor; VclPtr<CheckBox> m_pCbTwoWay; VclPtr<CheckBox> m_pCbCopyAll; VclPtr<CheckBox> m_pCbProtect; diff --git a/sc/source/ui/inc/tpview.hxx b/sc/source/ui/inc/tpview.hxx index 359be4889d81..480d82432442 100644 --- a/sc/source/ui/inc/tpview.hxx +++ b/sc/source/ui/inc/tpview.hxx @@ -28,13 +28,14 @@ #include <svx/strarray.hxx> class ScViewOptions; +class SvxColorListBox; class ScTpContentOptions : public SfxTabPage { friend class VclPtr<ScTpContentOptions>; VclPtr<ListBox> pGridLB; VclPtr<FixedText> pColorFT; - VclPtr<ColorListBox> pColorLB; + VclPtr<SvxColorListBox> pColorLB; VclPtr<CheckBox> pBreakCB; VclPtr<CheckBox> pGuideLineCB; diff --git a/sc/source/ui/optdlg/opredlin.cxx b/sc/source/ui/optdlg/opredlin.cxx index f8fb21682a47..8a769ad24dab 100644 --- a/sc/source/ui/optdlg/opredlin.cxx +++ b/sc/source/ui/optdlg/opredlin.cxx @@ -19,6 +19,7 @@ #undef SC_DLLIMPLEMENTATION +#include <svx/colorbox.hxx> #include <svx/dlgutil.hxx> #include <svx/drawitem.hxx> #include <svx/xtable.hxx> @@ -40,13 +41,16 @@ ScRedlineOptionsTabPage::ScRedlineOptionsTabPage( vcl::Window* pParent, const SfxItemSet& rSet ) - : SfxTabPage(pParent,"OptChangesPage", "modules/scalc/ui/optchangespage.ui", &rSet), - aAuthorStr (ScResId(SCSTR_AUTHOR)) + : SfxTabPage(pParent,"OptChangesPage", "modules/scalc/ui/optchangespage.ui", &rSet) { get(m_pContentColorLB, "changes"); + m_pContentColorLB->SetSlotId(SID_AUTHOR_COLOR); get(m_pRemoveColorLB, "deletions"); + m_pRemoveColorLB->SetSlotId(SID_AUTHOR_COLOR); get(m_pInsertColorLB, "entries"); + m_pInsertColorLB->SetSlotId(SID_AUTHOR_COLOR); get(m_pMoveColorLB, "insertions"); + m_pMoveColorLB->SetSlotId(SID_AUTHOR_COLOR); } ScRedlineOptionsTabPage::~ScRedlineOptionsTabPage() @@ -72,53 +76,17 @@ bool ScRedlineOptionsTabPage::FillItemSet( SfxItemSet* /* rSet */ ) { ScAppOptions aAppOptions=SC_MOD()->GetAppOptions(); - sal_uLong nNew=0; - sal_Int32 nPos=0; - - nPos = m_pContentColorLB->GetSelectEntryPos(); - if (nPos != LISTBOX_ENTRY_NOTFOUND) - { - if (nPos!=0) - nNew= m_pContentColorLB->GetEntryColor(nPos).GetColor(); - else - nNew= COL_TRANSPARENT; - - aAppOptions.SetTrackContentColor(nNew); - - } - nPos = m_pMoveColorLB->GetSelectEntryPos(); - if (nPos != LISTBOX_ENTRY_NOTFOUND) - { - if (nPos!=0) - nNew= m_pMoveColorLB->GetEntryColor(nPos).GetColor(); - else - nNew= COL_TRANSPARENT; - - aAppOptions.SetTrackMoveColor(nNew); - - } - nPos = m_pInsertColorLB->GetSelectEntryPos(); - if (nPos != LISTBOX_ENTRY_NOTFOUND) - { - if (nPos!=0) - nNew= m_pInsertColorLB->GetEntryColor(nPos).GetColor(); - else - nNew= COL_TRANSPARENT; - - aAppOptions.SetTrackInsertColor(nNew); - - } - nPos = m_pRemoveColorLB->GetSelectEntryPos(); - if (nPos != LISTBOX_ENTRY_NOTFOUND) - { - if (nPos!=0) - nNew= m_pRemoveColorLB->GetEntryColor(nPos).GetColor(); - else - nNew= COL_TRANSPARENT; - - aAppOptions.SetTrackDeleteColor(nNew); - - } + sal_uLong nNew = m_pContentColorLB->GetSelectEntryColor().GetColor(); + aAppOptions.SetTrackContentColor(nNew); + + nNew = m_pMoveColorLB->GetSelectEntryColor().GetColor(); + aAppOptions.SetTrackMoveColor(nNew); + + nNew = m_pInsertColorLB->GetSelectEntryColor().GetColor(); + aAppOptions.SetTrackInsertColor(nNew); + + nNew = m_pRemoveColorLB->GetSelectEntryColor().GetColor(); + aAppOptions.SetTrackDeleteColor(nNew); SC_MOD()->SetAppOptions(aAppOptions); @@ -133,59 +101,19 @@ bool ScRedlineOptionsTabPage::FillItemSet( SfxItemSet* /* rSet */ ) void ScRedlineOptionsTabPage::Reset( const SfxItemSet* /* rSet */ ) { - m_pContentColorLB->InsertEntry(aAuthorStr); - m_pMoveColorLB->InsertEntry(aAuthorStr); - m_pInsertColorLB->InsertEntry(aAuthorStr); - m_pRemoveColorLB->InsertEntry(aAuthorStr); - - m_pContentColorLB->SetUpdateMode( false); - m_pMoveColorLB->SetUpdateMode( false); - m_pInsertColorLB->SetUpdateMode( false); - m_pRemoveColorLB->SetUpdateMode( false); - - XColorListRef xColorLst = XColorList::GetStdColorList(); - for( long i = 0; i < xColorLst->Count(); ++i ) - { - const XColorEntry* pEntry = xColorLst->GetColor(i); - Color aColor = pEntry->GetColor(); - OUString sName = pEntry->GetName(); - - m_pContentColorLB->InsertEntry( aColor, sName ); - m_pMoveColorLB->InsertEntry( aColor, sName ); - m_pInsertColorLB->InsertEntry( aColor, sName ); - m_pRemoveColorLB->InsertEntry( aColor, sName ); - } - m_pContentColorLB->SetUpdateMode( true ); - m_pMoveColorLB->SetUpdateMode( true ); - m_pInsertColorLB->SetUpdateMode( true ); - m_pRemoveColorLB->SetUpdateMode( true ); - ScAppOptions aAppOptions=SC_MOD()->GetAppOptions(); sal_uLong nColor = aAppOptions.GetTrackContentColor(); - if (nColor == COL_TRANSPARENT) - m_pContentColorLB->SelectEntryPos(0); - else - m_pContentColorLB->SelectEntry(Color(nColor)); + m_pContentColorLB->SelectEntry(Color(nColor)); nColor = aAppOptions.GetTrackMoveColor(); - if (nColor == COL_TRANSPARENT) - m_pMoveColorLB->SelectEntryPos(0); - else - m_pMoveColorLB->SelectEntry(Color(nColor)); + m_pMoveColorLB->SelectEntry(Color(nColor)); nColor = aAppOptions.GetTrackInsertColor(); - if (nColor == COL_TRANSPARENT) - m_pInsertColorLB->SelectEntryPos(0); - else - m_pInsertColorLB->SelectEntry(Color(nColor)); + m_pInsertColorLB->SelectEntry(Color(nColor)); nColor = aAppOptions.GetTrackDeleteColor(); - if (nColor == COL_TRANSPARENT) - m_pRemoveColorLB->SelectEntryPos(0); - else - m_pRemoveColorLB->SelectEntry(Color(nColor)); - + m_pRemoveColorLB->SelectEntry(Color(nColor)); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/optdlg/tpview.cxx b/sc/source/ui/optdlg/tpview.cxx index 9e254fb83c93..0257ff228bc6 100644 --- a/sc/source/ui/optdlg/tpview.cxx +++ b/sc/source/ui/optdlg/tpview.cxx @@ -31,6 +31,7 @@ #include "globstr.hrc" #include <appoptio.hxx> #include <scmod.hxx> +#include <svx/colorbox.hxx> #include <svx/dlgutil.hxx> #include <svx/drawitem.hxx> #include <svx/xtable.hxx> @@ -151,8 +152,8 @@ bool ScTpContentOptions::FillItemSet( SfxItemSet* rCoreSet ) pBreakCB ->IsValueChangedFromSaved() || pGuideLineCB ->IsValueChangedFromSaved()) { - pLocalOptions->SetGridColor( pColorLB->GetSelectEntryColor(), - pColorLB->GetSelectEntry() ); + NamedColor aNamedColor = pColorLB->GetSelectEntry(); + pLocalOptions->SetGridColor(aNamedColor.first, aNamedColor.second); rCoreSet->Put(ScTpViewItem(SID_SCVIEWOPTIONS, *pLocalOptions)); bRet = true; } @@ -302,58 +303,14 @@ void ScTpContentOptions::InitGridOpt() pGridLB->SelectEntryPos (nSelPos); - if ( pColorLB->GetEntryCount() == 0 ) - { - SfxObjectShell* pDocSh = SfxObjectShell::Current(); - // there might be another DocShell here - pDocSh = dynamic_cast<ScDocShell*>( pDocSh ); - - XColorListRef pColorList; - if ( pDocSh ) - { - const SfxPoolItem* pItem = pDocSh->GetItem( SID_COLOR_TABLE ); - if ( pItem ) - pColorList = static_cast<const SvxColorListItem*>(pItem)->GetColorList(); - } - else - pColorList = XColorList::GetStdColorList(); - - if ( !pColorList.is() ) - return; - - pColorLB->SetUpdateMode( false ); - - // items from ColorTable - - long nCount = pColorList->Count(); - for ( long n=0; n<nCount; n++ ) - { - const XColorEntry* pEntry = pColorList->GetColor(n); - pColorLB->InsertEntry( pEntry->GetColor(), pEntry->GetName() ); - } - - // default GridColor - - Color aStdCol( SC_STD_GRIDCOLOR ); // same default as in ScViewOptions - if ( LISTBOX_ENTRY_NOTFOUND == - pColorLB->GetEntryPos( aStdCol ) ) - pColorLB->InsertEntry( aStdCol, ScGlobal::GetRscString( STR_GRIDCOLOR ) ); - - pColorLB->SetUpdateMode( true ); - - Invalidate(); - } - - // also select grid color entry on subsequent calls - + // select grid color entry OUString aName; Color aCol = pLocalOptions->GetGridColor( &aName ); - nSelPos = pColorLB->GetEntryPos( aCol ); - if ( LISTBOX_ENTRY_NOTFOUND != nSelPos ) - pColorLB->SelectEntryPos( nSelPos ); - else - pColorLB->SelectEntryPos( pColorLB->InsertEntry( aCol, aName ) ); + if (aName.trim().isEmpty() && aCol == Color(SC_STD_GRIDCOLOR)) + aName = ScGlobal::GetRscString(STR_GRIDCOLOR); + + pColorLB->SelectEntry(std::make_pair(aCol, aName)); } IMPL_LINK( ScTpContentOptions, GridHdl, ListBox&, rLb, void ) diff --git a/sc/source/ui/src/scstring.src b/sc/source/ui/src/scstring.src index 70dc4327beae..e4e7e6ba9198 100644 --- a/sc/source/ui/src/scstring.src +++ b/sc/source/ui/src/scstring.src @@ -798,11 +798,6 @@ String SCSTR_ROW_LABEL Text [ en-US ] = "Range contains ~row labels" ; }; -String SCSTR_AUTHOR -{ - Text [ en-US ] = "By author" ; -}; - StringArray SCSTR_UNIT { ItemList [ en-US ] = diff --git a/sc/uiconfig/scalc/ui/conditionalentry.ui b/sc/uiconfig/scalc/ui/conditionalentry.ui index 86d18e199b5a..c5803074e635 100644 --- a/sc/uiconfig/scalc/ui/conditionalentry.ui +++ b/sc/uiconfig/scalc/ui/conditionalentry.ui @@ -131,7 +131,7 @@ </packing> </child> <child> - <object class="svtlo-ColorListBox" id="lbcolmin"> + <object class="svxcorelo-SvxColorListBox" id="lbcolmin"> <property name="can_focus">False</property> </object> <packing> @@ -140,7 +140,7 @@ </packing> </child> <child> - <object class="svtlo-ColorListBox" id="lbcolmiddle"> + <object class="svxcorelo-SvxColorListBox" id="lbcolmiddle"> <property name="can_focus">False</property> </object> <packing> @@ -149,7 +149,7 @@ </packing> </child> <child> - <object class="svtlo-ColorListBox" id="lbcolmax"> + <object class="svxcorelo-SvxColorListBox" id="lbcolmax"> <property name="can_focus">False</property> </object> <packing> diff --git a/sc/uiconfig/scalc/ui/databaroptions.ui b/sc/uiconfig/scalc/ui/databaroptions.ui index c2a4ae233281..580f3053f5d5 100644 --- a/sc/uiconfig/scalc/ui/databaroptions.ui +++ b/sc/uiconfig/scalc/ui/databaroptions.ui @@ -241,7 +241,7 @@ </packing> </child> <child> - <object class="svtlo-ColorListBox" id="positive_colour"> + <object class="svxcorelo-SvxColorListBox" id="positive_colour"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="hexpand">True</property> @@ -252,7 +252,7 @@ </packing> </child> <child> - <object class="svtlo-ColorListBox" id="negative_colour"> + <object class="svxcorelo-SvxColorListBox" id="negative_colour"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="hexpand">True</property> @@ -374,7 +374,7 @@ </packing> </child> <child> - <object class="svtlo-ColorListBox" id="axis_colour"> + <object class="svxcorelo-SvxColorListBox" id="axis_colour"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="hexpand">True</property> @@ -523,17 +523,6 @@ <property name="position">5</property> </packing> </child> - <child> - <object class="GtkLabel" id="custom_color"> - <property name="can_focus">False</property> - <property name="label" translatable="yes">Custom</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">6</property> - </packing> - </child> </object> <packing> <property name="expand">False</property> diff --git a/sc/uiconfig/scalc/ui/optchangespage.ui b/sc/uiconfig/scalc/ui/optchangespage.ui index df83ce92437f..c64f8726b2e0 100644 --- a/sc/uiconfig/scalc/ui/optchangespage.ui +++ b/sc/uiconfig/scalc/ui/optchangespage.ui @@ -87,7 +87,7 @@ </packing> </child> <child> - <object class="svxlo-ColorLB" id="changes"> + <object class="svxcorelo-SvxColorListBox" id="changes"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -97,7 +97,7 @@ </packing> </child> <child> - <object class="svxlo-ColorLB" id="deletions"> + <object class="svxcorelo-SvxColorListBox" id="deletions"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -107,7 +107,7 @@ </packing> </child> <child> - <object class="svxlo-ColorLB" id="entries"> + <object class="svxcorelo-SvxColorListBox" id="entries"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -117,7 +117,7 @@ </packing> </child> <child> - <object class="svxlo-ColorLB" id="insertions"> + <object class="svxcorelo-SvxColorListBox" id="insertions"> <property name="visible">True</property> <property name="can_focus">False</property> </object> diff --git a/sc/uiconfig/scalc/ui/scenariodialog.ui b/sc/uiconfig/scalc/ui/scenariodialog.ui index 846c05e4691f..56b8186de491 100644 --- a/sc/uiconfig/scalc/ui/scenariodialog.ui +++ b/sc/uiconfig/scalc/ui/scenariodialog.ui @@ -253,7 +253,7 @@ </packing> </child> <child> - <object class="svtlo-ColorListBox" id="bordercolor"> + <object class="svxcorelo-SvxColorListBox" id="bordercolor"> <property name="visible">True</property> <property name="can_focus">False</property> <accessibility> diff --git a/sc/uiconfig/scalc/ui/tpviewpage.ui b/sc/uiconfig/scalc/ui/tpviewpage.ui index 1e39a39f2ea0..1f3ef716cb5e 100644 --- a/sc/uiconfig/scalc/ui/tpviewpage.ui +++ b/sc/uiconfig/scalc/ui/tpviewpage.ui @@ -345,7 +345,7 @@ <property name="row_spacing">6</property> <property name="column_spacing">12</property> <child> - <object class="svxlo-ColorLB" id="color"> + <object class="svxcorelo-SvxColorListBox" id="color"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="hexpand">True</property> diff --git a/sd/inc/sdabstdlg.hxx b/sd/inc/sdabstdlg.hxx index e3269326c3c5..7f763c690346 100644 --- a/sd/inc/sdabstdlg.hxx +++ b/sd/inc/sdabstdlg.hxx @@ -180,7 +180,7 @@ public: SD_DLLPUBLIC static SdAbstractDialogFactory* Create(); virtual VclPtr<VclAbstractDialog> CreateBreakDlg(vcl::Window* pWindow, ::sd::DrawView* pDrView, ::sd::DrawDocShell* pShell, sal_uLong nSumActionCount, sal_uLong nObjCount ) = 0; - virtual VclPtr<AbstractCopyDlg> CreateCopyDlg(vcl::Window* pWindow, const SfxItemSet& rInAttrs, const rtl::Reference<XColorList> &pColTab, ::sd::View* pView ) = 0; + virtual VclPtr<AbstractCopyDlg> CreateCopyDlg(vcl::Window* pWindow, const SfxItemSet& rInAttrs, ::sd::View* pView ) = 0; virtual VclPtr<AbstractSdCustomShowDlg> CreateSdCustomShowDlg(vcl::Window* pWindow, SdDrawDocument& rDrawDoc) = 0; virtual VclPtr<SfxAbstractTabDialog> CreateSdTabCharDialog(vcl::Window* pWindow, const SfxItemSet* pAttr, SfxObjectShell* pDocShell) = 0; virtual VclPtr<SfxAbstractTabDialog> CreateSdTabPageDialog(vcl::Window* pWindow, const SfxItemSet* pAttr, SfxObjectShell* pDocShell, bool bAreaPage) = 0; diff --git a/sd/qa/unit/dialogs-test.cxx b/sd/qa/unit/dialogs-test.cxx index 4acc570ca599..3b10d337a3ca 100644 --- a/sd/qa/unit/dialogs-test.cxx +++ b/sd/qa/unit/dialogs-test.cxx @@ -292,16 +292,10 @@ VclAbstractDialog* SdDialogsTest::createDialogByID(sal_uInt32 nID) } case 2: { - // CreateCopyDlg(const SfxItemSet& rInAttrs, const rtl::Reference<XColorList> &pColTab, ::sd::View* pView) override; - // works without XColorList (DropDowns will be empty), but - // it's easy to access, so use it - XColorListRef pColorList(XColorList::CreateStdColorList()); - // needs an SfxItemSet, use the one from the 1st object pRetval = getSdAbstractDialogFactory()->CreateCopyDlg( getViewShell()->GetActiveWindow(), getSfxItemSetFromSdrObject(), - pColorList, getDrawView()); break; } diff --git a/sd/source/ui/animations/CustomAnimationDialog.cxx b/sd/source/ui/animations/CustomAnimationDialog.cxx index 2ba3459164ee..6726317d95ba 100644 --- a/sd/source/ui/animations/CustomAnimationDialog.cxx +++ b/sd/source/ui/animations/CustomAnimationDialog.cxx @@ -62,6 +62,7 @@ #include <editeng/flstitem.hxx> #include <svx/drawitem.hxx> +#include <svx/colorbox.hxx> #include <svx/xtable.hxx> #include <svx/gallery.hxx> @@ -191,43 +192,24 @@ public: virtual Control* getControl() override; private: - VclPtr<ColorListBox> mpControl; - DECL_LINK(OnSelect, ListBox&, void); + VclPtr<SvxColorListBox> mpControl; + DECL_LINK(OnSelect, SvxColorListBox&, void); Link<LinkParamNone*,void> maModifyLink; }; ColorPropertyBox::ColorPropertyBox( sal_Int32 nControlType, vcl::Window* pParent, const Any& rValue, const Link<LinkParamNone*,void>& rModifyHdl ) : PropertySubControl( nControlType ), maModifyLink(rModifyHdl) { - mpControl = VclPtr<ColorListBox>::Create( pParent, WB_BORDER|WB_TABSTOP|WB_DROPDOWN ); - mpControl->SetDropDownLineCount( 10 ); + mpControl = VclPtr<SvxColorListBox>::Create(pParent); mpControl->SetSelectHdl( LINK(this, ColorPropertyBox, OnSelect) ); mpControl->SetHelpId( HID_SD_CUSTOMANIMATIONPANE_COLORPROPERTYBOX ); - SfxObjectShell* pDocSh = SfxObjectShell::Current(); - DBG_ASSERT( pDocSh, "DocShell not found!" ); - XColorListRef pColorList; - const SfxPoolItem* pItem = nullptr; - - if ( pDocSh && ( ( pItem = pDocSh->GetItem( SID_COLOR_TABLE ) ) != nullptr) ) - pColorList = static_cast<const SvxColorListItem*>(pItem)->GetColorList(); - - if ( !pColorList.is() ) - pColorList = XColorList::CreateStdColorList(); - sal_Int32 nColor = 0; rValue >>= nColor; - - for ( long i = 0; i < pColorList->Count(); i++ ) - { - const XColorEntry* pEntry = pColorList->GetColor(i); - sal_Int32 nPos = mpControl->InsertEntry( pEntry->GetColor(), pEntry->GetName() ); - if( pEntry->GetColor().GetRGBColor() == (sal_uInt32)nColor ) - mpControl->SelectEntryPos( nPos ); - } + mpControl->SelectEntry(static_cast<Color>(nColor)); } -IMPL_LINK_NOARG(ColorPropertyBox, OnSelect, ListBox&, void) +IMPL_LINK_NOARG(ColorPropertyBox, OnSelect, SvxColorListBox&, void) { maModifyLink.Call(nullptr); } @@ -245,7 +227,7 @@ void ColorPropertyBox::setValue( const Any& rValue, const OUString& ) rValue >>= nColor; mpControl->SetNoSelection(); - mpControl->SelectEntryPos( mpControl->GetEntryPos( static_cast<Color>(nColor) ) ); + mpControl->SelectEntry(static_cast<Color>(nColor)); } } @@ -1040,7 +1022,7 @@ private: VclPtr<FixedText> mpFTAfterEffect; VclPtr<ListBox> mpLBAfterEffect; VclPtr<FixedText> mpFTDimColor; - VclPtr<ColorListBox> mpCLBDimColor; + VclPtr<SvxColorListBox> mpCLBDimColor; VclPtr<FixedText> mpFTTextAnim; VclPtr<ListBox> mpLBTextAnim; VclPtr<MetricField> mpMFTextDelay; @@ -1065,6 +1047,7 @@ CustomAnimationEffectTabPage::CustomAnimationEffectTabPage( vcl::Window* pParent get(mpLBAfterEffect, "aeffect_list" ); get(mpFTDimColor, "dim_color_label" ); get(mpCLBDimColor, "dim_color_list" ); + mpCLBDimColor->SelectEntry(Color(COL_BLACK)); get(mpFTTextAnim, "text_animation_label" ); get(mpLBTextAnim, "text_animation_list" ); get(mpMFTextDelay,"text_delay" ); @@ -1077,28 +1060,6 @@ CustomAnimationEffectTabPage::CustomAnimationEffectTabPage( vcl::Window* pParent mpPBSoundPreview->SetClickHdl( LINK( this, CustomAnimationEffectTabPage, implClickHdl ) ); - // fill the color box - SfxObjectShell* pDocSh = SfxObjectShell::Current(); - DBG_ASSERT( pDocSh, "DocShell not found!" ); - XColorListRef pColorList; - const SfxPoolItem* pItem = nullptr; - - if ( pDocSh && ( (pItem = pDocSh->GetItem( SID_COLOR_TABLE ) ) != nullptr ) ) - pColorList = static_cast<const SvxColorListItem*>(pItem)->GetColorList(); - - if ( !pColorList.is() ) - pColorList = XColorList::CreateStdColorList(); - - mpCLBDimColor->SetUpdateMode( false ); - - for ( long i = 0; i < pColorList->Count(); i++ ) - { - const XColorEntry* pEntry = pColorList->GetColor(i); - mpCLBDimColor->InsertEntry( pEntry->GetColor(), pEntry->GetName() ); - } - - mpCLBDimColor->SetUpdateMode( true ); - // only show settings if all selected effects have the same preset-id if( pSet->getPropertyState( nHandlePresetId ) != STLPropertyState::Ambiguous ) { @@ -1174,13 +1135,8 @@ CustomAnimationEffectTabPage::CustomAnimationEffectTabPage( vcl::Window* pParent { sal_Int32 nColor = 0; aDimColor >>= nColor; - Color aColor( nColor ); - sal_Int32 nColorPos = mpCLBDimColor->GetEntryPos( aColor ); - if ( LISTBOX_ENTRY_NOTFOUND != nColorPos ) - mpCLBDimColor->SelectEntryPos( nColorPos ); - else - mpCLBDimColor->SelectEntryPos( - mpCLBDimColor->InsertEntry( aColor, SVX_RESSTR(RID_SVXSTR_COLOR_USER) ) ); + Color aColor(nColor); + mpCLBDimColor->SelectEntry(aColor); } else { @@ -1332,16 +1288,7 @@ IMPL_LINK( CustomAnimationEffectTabPage, implSelectHdl, ListBox&, rListBox, void void CustomAnimationEffectTabPage::implHdl(Control* pControl ) { - if( pControl == mpLBAfterEffect ) - { - sal_Int32 nPos = static_cast<ListBox*>( mpLBAfterEffect )->GetSelectEntryPos(); - if( nPos == 1 ) - { - if( mpCLBDimColor->GetSelectEntryPos() == LISTBOX_ENTRY_NOTFOUND ) - mpCLBDimColor->SelectEntryPos(0); - } - } - else if( pControl == mpLBTextAnim ) + if( pControl == mpLBTextAnim ) { if( mpMFTextDelay->GetValue() == 0 ) mpMFTextDelay->SetValue( 100 ); @@ -1420,10 +1367,7 @@ void CustomAnimationEffectTabPage::update( STLPropertySet* pSet ) Any aDimColor; if( nPos == 1 ) { - Color aSelectedColor; - if ( mpCLBDimColor->GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND ) - aSelectedColor = mpCLBDimColor->GetSelectEntryColor(); - + Color aSelectedColor = mpCLBDimColor->GetSelectEntryColor(); aDimColor = makeAny( (sal_Int32)aSelectedColor.GetRGBColor() ); } diff --git a/sd/source/ui/dlg/copydlg.cxx b/sd/source/ui/dlg/copydlg.cxx index f68e06c38293..efcebc1442f1 100644 --- a/sd/source/ui/dlg/copydlg.cxx +++ b/sd/source/ui/dlg/copydlg.cxx @@ -19,6 +19,7 @@ #include "copydlg.hxx" #include <comphelper/string.hxx> +#include <svx/colorbox.hxx> #include <svx/dlgutil.hxx> #include <sfx2/module.hxx> #include <svx/xcolit.hxx> @@ -40,11 +41,9 @@ namespace sd { #define TOKEN ';' -CopyDlg::CopyDlg(vcl::Window* pWindow, const SfxItemSet& rInAttrs, - const XColorListRef &pColList, ::sd::View* pInView) +CopyDlg::CopyDlg(vcl::Window* pWindow, const SfxItemSet& rInAttrs, ::sd::View* pInView) : SfxModalDialog(pWindow, "DuplicateDialog", "modules/sdraw/ui/copydlg.ui") , mrOutAttrs(rInAttrs) - , mpColorList(pColList) , maUIScale(pInView->GetDoc().GetUIScale()) , mpView(pInView) { @@ -60,11 +59,6 @@ CopyDlg::CopyDlg(vcl::Window* pWindow, const SfxItemSet& rInAttrs, get(m_pLbEndColor, "end"); get(m_pBtnSetDefault, "default"); - // color tables - DBG_ASSERT( mpColorList.is(), "No colortable available !" ); - m_pLbStartColor->Fill( mpColorList ); - m_pLbEndColor->CopyEntries( *m_pLbStartColor ); - m_pLbStartColor->SetSelectHdl( LINK( this, CopyDlg, SelectColorHdl ) ); m_pBtnSetViewData->SetClickHdl( LINK( this, CopyDlg, SetViewData ) ); m_pBtnSetDefault->SetClickHdl( LINK( this, CopyDlg, SetDefault ) ); @@ -201,31 +195,22 @@ void CopyDlg::GetAttr( SfxItemSet& rOutAttrs ) rOutAttrs.Put( SfxInt32Item( ATTR_COPY_WIDTH, nWidth ) ); rOutAttrs.Put( SfxInt32Item( ATTR_COPY_HEIGHT, nHeight ) ); - if( m_pLbStartColor->GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND ) - { - XColorItem aXColorItem( ATTR_COPY_START_COLOR, m_pLbStartColor->GetSelectEntry(), - m_pLbStartColor->GetSelectEntryColor() ); - rOutAttrs.Put( aXColorItem ); - } - if( m_pLbEndColor->GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND ) - { - XColorItem aXColorItem( ATTR_COPY_END_COLOR, m_pLbEndColor->GetSelectEntry(), - m_pLbEndColor->GetSelectEntryColor() ); - rOutAttrs.Put( aXColorItem ); - } + NamedColor aColor = m_pLbStartColor->GetSelectEntry(); + rOutAttrs.Put(XColorItem(ATTR_COPY_START_COLOR, aColor.second, aColor.first)); + aColor = m_pLbEndColor->GetSelectEntry(); + rOutAttrs.Put(XColorItem(ATTR_COPY_END_COLOR, aColor.second, aColor.first)); } /** * enables and selects end color LB */ -IMPL_LINK_NOARG(CopyDlg, SelectColorHdl, ListBox&, void) +IMPL_LINK_NOARG(CopyDlg, SelectColorHdl, SvxColorListBox&, void) { - sal_Int32 nPos = m_pLbStartColor->GetSelectEntryPos(); + const Color aColor = m_pLbStartColor->GetSelectEntryColor(); - if( nPos != LISTBOX_ENTRY_NOTFOUND && - !m_pLbEndColor->IsEnabled() ) + if (!m_pLbEndColor->IsEnabled()) { - m_pLbEndColor->SelectEntryPos( nPos ); + m_pLbEndColor->SelectEntry(aColor); m_pLbEndColor->Enable(); m_pFtEndColor->Enable(); } diff --git a/sd/source/ui/dlg/sddlgfact.cxx b/sd/source/ui/dlg/sddlgfact.cxx index d2041f2c7554..23289ab93810 100644 --- a/sd/source/ui/dlg/sddlgfact.cxx +++ b/sd/source/ui/dlg/sddlgfact.cxx @@ -315,10 +315,9 @@ VclPtr<VclAbstractDialog> SdAbstractDialogFactory_Impl::CreateBreakDlg( VclPtr<AbstractCopyDlg> SdAbstractDialogFactory_Impl::CreateCopyDlg(vcl::Window* pParent, const SfxItemSet& rInAttrs, - const rtl::Reference<XColorList> &pColTab, ::sd::View* pView ) { - return VclPtr<AbstractCopyDlg_Impl>::Create( VclPtr<::sd::CopyDlg>::Create( pParent, rInAttrs, pColTab, pView ) ); + return VclPtr<AbstractCopyDlg_Impl>::Create( VclPtr<::sd::CopyDlg>::Create( pParent, rInAttrs, pView ) ); } VclPtr<AbstractSdCustomShowDlg> SdAbstractDialogFactory_Impl::CreateSdCustomShowDlg(vcl::Window* pParent, SdDrawDocument& rDrawDoc ) diff --git a/sd/source/ui/dlg/sddlgfact.hxx b/sd/source/ui/dlg/sddlgfact.hxx index f014c8763e27..5eb076b09b11 100644 --- a/sd/source/ui/dlg/sddlgfact.hxx +++ b/sd/source/ui/dlg/sddlgfact.hxx @@ -215,7 +215,7 @@ public: virtual ~SdAbstractDialogFactory_Impl() {} virtual VclPtr<VclAbstractDialog> CreateBreakDlg(vcl::Window* pWindow, ::sd::DrawView* pDrView, ::sd::DrawDocShell* pShell, sal_uLong nSumActionCount, sal_uLong nObjCount) override; - virtual VclPtr<AbstractCopyDlg> CreateCopyDlg(vcl::Window* pParent, const SfxItemSet& rInAttrs, const rtl::Reference<XColorList> &pColTab, ::sd::View* pView) override; + virtual VclPtr<AbstractCopyDlg> CreateCopyDlg(vcl::Window* pParent, const SfxItemSet& rInAttrs, ::sd::View* pView) override; virtual VclPtr<AbstractSdCustomShowDlg> CreateSdCustomShowDlg(vcl::Window* pParent, SdDrawDocument& rDrawDoc) override; virtual VclPtr<SfxAbstractTabDialog> CreateSdTabCharDialog(vcl::Window* pWindow, const SfxItemSet* pAttr, SfxObjectShell* pDocShell) override; virtual VclPtr<SfxAbstractTabDialog> CreateSdTabPageDialog(vcl::Window* pWindow, const SfxItemSet* pAttr, SfxObjectShell* pDocShell, bool bAreaPage) override; diff --git a/sd/source/ui/func/fucopy.cxx b/sd/source/ui/func/fucopy.cxx index a834258b78d2..3fb2dc929646 100644 --- a/sd/source/ui/func/fucopy.cxx +++ b/sd/source/ui/func/fucopy.cxx @@ -102,7 +102,7 @@ void FuCopy::DoExecute( SfxRequest& rReq ) SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create(); if( pFact ) { - ScopedVclPtr<AbstractCopyDlg> pDlg(pFact->CreateCopyDlg(mpViewShell->GetActiveWindow(), aSet, mpDoc->GetColorList(), mpView )); + ScopedVclPtr<AbstractCopyDlg> pDlg(pFact->CreateCopyDlg(mpViewShell->GetActiveWindow(), aSet, mpView )); if (!pDlg) return; diff --git a/sd/source/ui/inc/copydlg.hxx b/sd/source/ui/inc/copydlg.hxx index 98ac00ab7318..33a97c589943 100644 --- a/sd/source/ui/inc/copydlg.hxx +++ b/sd/source/ui/inc/copydlg.hxx @@ -28,6 +28,8 @@ #include <sfx2/basedlgs.hxx> #include <tools/fract.hxx> +class SvxColorListBox; + namespace sd { class View; @@ -39,8 +41,7 @@ class CopyDlg : public SfxModalDialog { public: - CopyDlg( vcl::Window* pWindow, const SfxItemSet& rInAttrs, - const XColorListRef &pColList, ::sd::View* pView ); + CopyDlg(vcl::Window* pWindow, const SfxItemSet& rInAttrs, ::sd::View* pView); virtual ~CopyDlg() override; virtual void dispose() override; @@ -58,18 +59,17 @@ private: VclPtr<MetricField> m_pMtrFldWidth; VclPtr<MetricField> m_pMtrFldHeight; - VclPtr<ColorLB> m_pLbStartColor; + VclPtr<SvxColorListBox> m_pLbStartColor; VclPtr<FixedText> m_pFtEndColor; - VclPtr<ColorLB> m_pLbEndColor; + VclPtr<SvxColorListBox> m_pLbEndColor; VclPtr<PushButton> m_pBtnSetDefault; const SfxItemSet& mrOutAttrs; - XColorListRef mpColorList; Fraction maUIScale; ::sd::View* mpView; - DECL_LINK( SelectColorHdl, ListBox&, void ); + DECL_LINK( SelectColorHdl, SvxColorListBox&, void ); DECL_LINK( SetViewData, Button*, void ); DECL_LINK( SetDefault, Button*, void ); }; diff --git a/sd/source/ui/sidebar/SlideBackground.cxx b/sd/source/ui/sidebar/SlideBackground.cxx index 89587c52282d..3957fbafbd0d 100644 --- a/sd/source/ui/sidebar/SlideBackground.cxx +++ b/sd/source/ui/sidebar/SlideBackground.cxx @@ -38,6 +38,7 @@ #include <com/sun/star/beans/XPropertySet.hpp> #include "sdresid.hxx" #include <svtools/controldims.hrc> +#include <svx/colorbox.hxx> #include <svx/gallery.hxx> #include <svx/drawitem.hxx> #include <unotools/pathoptions.hxx> @@ -211,48 +212,21 @@ void SlideBackground::Update() mpFillAttr->Hide(); mpFillGrad->Hide(); mpFillLB->Show(); - mpFillLB->Clear(); - const SvxColorListItem aItem( *static_cast<const SvxColorListItem*>(pSh->GetItem(SID_COLOR_TABLE))); - mpFillLB->Fill(aItem.GetColorList()); - const Color aColor = GetColorSetOrDefault(); - mpFillLB->SelectEntry( aColor ); - - if(mpFillLB->GetSelectEntryCount() == 0) - { - mpFillLB->InsertEntry(aColor, OUString()); - mpFillLB->SelectEntry(aColor); - } + mpFillLB->SelectEntry(aColor); } break; case GRADIENT: { mpFillLB->Show(); - const SvxColorListItem aItem(*static_cast<const SvxColorListItem*>(pSh->GetItem(SID_COLOR_TABLE))); mpFillAttr->Hide(); mpFillGrad->Show(); - mpFillLB->Clear(); - mpFillGrad->Clear(); - mpFillLB->Fill(aItem.GetColorList()); - mpFillGrad->Fill(aItem.GetColorList()); const XGradient xGradient = GetGradientSetOrDefault(); const Color aStartColor = xGradient.GetStartColor(); + mpFillLB->SelectEntry(aStartColor); const Color aEndColor = xGradient.GetEndColor(); - mpFillLB->SelectEntry( aStartColor ); - mpFillGrad->SelectEntry( aEndColor ); - - if(mpFillLB->GetSelectEntryCount() == 0) - { - mpFillLB->InsertEntry(aStartColor, OUString()); - mpFillLB->SelectEntry(aStartColor); - } - - if(mpFillGrad->GetSelectEntryCount() == 0) - { - mpFillGrad->InsertEntry(aEndColor, OUString()); - mpFillGrad->SelectEntry(aEndColor); - } + mpFillGrad->SelectEntry(aEndColor); } break; @@ -831,7 +805,7 @@ IMPL_LINK_NOARG(SlideBackground, PaperSizeModifyHdl, ListBox&, void) GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_PAGE_SIZE, SfxCallMode::RECORD, { &aSizeItem, mpPageItem.get() }); } -IMPL_LINK_NOARG(SlideBackground, FillColorHdl, ListBox&, void) +IMPL_LINK_NOARG(SlideBackground, FillColorHdl, SvxColorListBox&, void) { const drawing::FillStyle eXFS = (drawing::FillStyle)mpFillStyle->GetSelectEntryPos(); switch(eXFS) diff --git a/sd/source/ui/sidebar/SlideBackground.hxx b/sd/source/ui/sidebar/SlideBackground.hxx index deb9a3b8118a..fbbe7016b8aa 100644 --- a/sd/source/ui/sidebar/SlideBackground.hxx +++ b/sd/source/ui/sidebar/SlideBackground.hxx @@ -45,6 +45,8 @@ #include "EventMultiplexer.hxx" #include <sfx2/sidebar/IContextChangeReceiver.hxx> +class SvxColorListBox; + namespace sd { namespace sidebar { class SlideBackground : @@ -79,9 +81,9 @@ private: VclPtr<ListBox> mpPaperOrientation; VclPtr<ListBox> mpMasterSlide; VclPtr<SvxFillTypeBox> mpFillStyle; - VclPtr<ColorLB> mpFillLB; + VclPtr<SvxColorListBox> mpFillLB; VclPtr<SvxFillAttrBox> mpFillAttr; - VclPtr<ColorLB> mpFillGrad; + VclPtr<SvxColorListBox> mpFillGrad; VclPtr<CheckBox> mpDspMasterBackground; VclPtr<CheckBox> mpDspMasterObjects; VclPtr<Button> mpCloseMaster; @@ -120,7 +122,7 @@ private: DECL_LINK(FillBackgroundHdl, ListBox&, void); DECL_LINK(FillStyleModifyHdl, ListBox&, void); DECL_LINK(PaperSizeModifyHdl, ListBox&, void); - DECL_LINK(FillColorHdl, ListBox&, void); + DECL_LINK(FillColorHdl, SvxColorListBox&, void); DECL_LINK(AssignMasterPage, ListBox&, void); DECL_LINK(DspBackground, Button*, void); DECL_LINK(DspObjects, Button*, void); diff --git a/sd/source/ui/view/drviews6.cxx b/sd/source/ui/view/drviews6.cxx index d34b08ffb694..7fa40d53e97e 100644 --- a/sd/source/ui/view/drviews6.cxx +++ b/sd/source/ui/view/drviews6.cxx @@ -87,15 +87,6 @@ void DrawViewShell::GetFormTextState(SfxItemSet& rSet) { const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList(); const SdrObject* pObj = nullptr; - SvxFontWorkDialog* pDlg = nullptr; - - sal_uInt16 nId = SvxFontWorkChildWindow::GetChildWindowId(); - - if (GetViewFrame()->HasChildWindow(nId)) - { - SfxChildWindow* pWnd = GetViewFrame()->GetChildWindow(nId); - pDlg = pWnd ? static_cast<SvxFontWorkDialog*>(pWnd->GetWindow()) : nullptr; - } if ( rMarkList.GetMarkCount() == 1 ) pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); @@ -125,9 +116,6 @@ void DrawViewShell::GetFormTextState(SfxItemSet& rSet) } else { - if ( pDlg ) - pDlg->SetColorList(GetDoc()->GetColorList()); - SfxItemSet aSet( GetDoc()->GetPool() ); mpDrawView->GetAttributes( aSet ); rSet.Set( aSet ); @@ -341,17 +329,8 @@ void DrawViewShell::GetBmpMaskState( SfxItemSet& rSet ) { const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList(); const SdrObject* pObj = nullptr; - sal_uInt16 nId = SvxBmpMaskChildWindow::GetChildWindowId(); bool bEnable = false; - if ( GetViewFrame()->HasChildWindow( nId ) ) - { - SfxChildWindow* pWnd = GetViewFrame()->GetChildWindow(nId); - SvxBmpMask* pDlg = pWnd ? static_cast<SvxBmpMask*>(pWnd->GetWindow()) : nullptr; - if (pDlg && pDlg->NeedsColorList()) - pDlg->SetColorList(GetDoc()->GetColorList()); - } - if ( rMarkList.GetMarkCount() == 1 ) pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); diff --git a/sd/source/ui/view/drviewsi.cxx b/sd/source/ui/view/drviewsi.cxx index a2fe62bb2d36..4236050fe3b3 100644 --- a/sd/source/ui/view/drviewsi.cxx +++ b/sd/source/ui/view/drviewsi.cxx @@ -72,7 +72,7 @@ void DrawViewShell::ExecEffectWin( SfxRequest& rReq ) { Svx3DWin* p3DWin = static_cast<Svx3DWin*>( pWindow->GetWindow() ); if( p3DWin ) - p3DWin->InitColorLB( GetDoc() ); + p3DWin->InitColorLB(); } } break; diff --git a/sd/uiconfig/sdraw/ui/copydlg.ui b/sd/uiconfig/sdraw/ui/copydlg.ui index 2ae2610b38c5..ddadc3fdcd77 100644 --- a/sd/uiconfig/sdraw/ui/copydlg.ui +++ b/sd/uiconfig/sdraw/ui/copydlg.ui @@ -448,7 +448,7 @@ </packing> </child> <child> - <object class="svxlo-ColorLB" id="start"> + <object class="svxcorelo-SvxColorListBox" id="start"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="hexpand">True</property> @@ -459,7 +459,7 @@ </packing> </child> <child> - <object class="svxlo-ColorLB" id="end"> + <object class="svxcorelo-SvxColorListBox" id="end"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="hexpand">True</property> diff --git a/sd/uiconfig/simpress/ui/customanimationeffecttab.ui b/sd/uiconfig/simpress/ui/customanimationeffecttab.ui index fffceb744ec9..0ae1fbcd335f 100644 --- a/sd/uiconfig/simpress/ui/customanimationeffecttab.ui +++ b/sd/uiconfig/simpress/ui/customanimationeffecttab.ui @@ -254,7 +254,7 @@ </packing> </child> <child> - <object class="svtlo-ColorListBox" id="dim_color_list"> + <object class="svxcorelo-SvxColorListBox" id="dim_color_list"> <property name="visible">True</property> <property name="can_focus">False</property> </object> diff --git a/sd/uiconfig/simpress/ui/sidebarslidebackground.ui b/sd/uiconfig/simpress/ui/sidebarslidebackground.ui index 9b5d24a435e3..5025ede8429a 100644 --- a/sd/uiconfig/simpress/ui/sidebarslidebackground.ui +++ b/sd/uiconfig/simpress/ui/sidebarslidebackground.ui @@ -67,7 +67,7 @@ </packing> </child> <child> - <object class="svxlo-ColorLB" id="fillattr"> + <object class="svxcorelo-SvxColorListBox" id="fillattr"> <property name="width_request">150</property> <property name="can_focus">False</property> <property name="has_tooltip">True</property> @@ -140,7 +140,7 @@ </packing> </child> <child> - <object class="svxlo-ColorLB" id="fillattr2"> + <object class="svxcorelo-SvxColorListBox" id="fillattr2"> <property name="width_request">150</property> <property name="visible">True</property> <property name="can_focus">False</property> diff --git a/sfx2/source/dialog/itemconnect.cxx b/sfx2/source/dialog/itemconnect.cxx index f07e55131814..e793ef7879ce 100644 --- a/sfx2/source/dialog/itemconnect.cxx +++ b/sfx2/source/dialog/itemconnect.cxx @@ -129,34 +129,6 @@ void CheckBoxWrapper::SetControlValue( bool bValue ) } -ColorListBoxWrapper::ColorListBoxWrapper(ColorListBox & rListBox): - SingleControlWrapper< ColorListBox, Color >(rListBox) -{} - -ColorListBoxWrapper::~ColorListBoxWrapper() -{} - -bool ColorListBoxWrapper::IsControlDontKnow() const -{ - return GetControl().GetSelectEntryCount() == 0; -} - -void ColorListBoxWrapper::SetControlDontKnow( bool bSet ) -{ - if( bSet ) GetControl().SetNoSelection(); -} - -Color ColorListBoxWrapper::GetControlValue() const -{ - return GetControl().GetSelectEntryColor(); -} - -void ColorListBoxWrapper::SetControlValue( Color aColor ) -{ - GetControl().SelectEntry( aColor ); -} - - // Multi control wrappers diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx index 4c6b107b1025..ce7234810d16 100644 --- a/svtools/source/control/ctrlbox.cxx +++ b/svtools/source/control/ctrlbox.cxx @@ -59,230 +59,6 @@ #define FONTNAMEBOXMRUENTRIESFILE "/user/config/fontnameboxmruentries" -class ImplColorListData -{ -public: - Color aColor; - bool bColor; - - ImplColorListData() : aColor( COL_BLACK ) { bColor = false; } - explicit ImplColorListData( const Color& rColor ) : aColor( rColor ) { bColor = true; } -}; - -void ColorListBox::ImplInit() -{ - pColorList = new ImpColorList(); - - const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); - aImageSize = rStyleSettings.GetListBoxPreviewDefaultPixelSize(); - EnableUserDraw( true ); - SetUserItemSize( aImageSize ); -} - -void ColorListBox::ImplDestroyColorEntries() -{ - for ( size_t n = pColorList->size(); n; ) - delete (*pColorList)[ --n ]; - pColorList->clear(); -} - -ColorListBox::ColorListBox( vcl::Window* pParent, WinBits nWinStyle ) : - ListBox( pParent, nWinStyle ) -{ - ImplInit(); - SetEdgeBlending(true); -} - -VCL_BUILDER_DECL_FACTORY(ColorListBox) -{ - bool bDropdown = VclBuilder::extractDropdown(rMap); - WinBits nWinBits = WB_LEFT|WB_VCENTER|WB_3DLOOK|WB_TABSTOP; - if (bDropdown) - nWinBits |= WB_DROPDOWN; - VclPtrInstance<ColorListBox> pListBox(pParent, nWinBits); - if (bDropdown) - pListBox->EnableAutoSize(true); - rRet = pListBox; -} - -ColorListBox::~ColorListBox() -{ - disposeOnce(); -} - -void ColorListBox::dispose() -{ - if ( pColorList ) - { - ImplDestroyColorEntries(); - delete pColorList; - pColorList = nullptr; - } - ListBox::dispose(); -} - -sal_Int32 ColorListBox::InsertEntry( const OUString& rStr, sal_Int32 nPos ) -{ - nPos = ListBox::InsertEntry( rStr, nPos ); - if ( nPos != LISTBOX_ERROR ) - { - ImplColorListData* pData = new ImplColorListData; - if ( static_cast<size_t>(nPos) < pColorList->size() ) - { - ImpColorList::iterator it = pColorList->begin(); - ::std::advance( it, nPos ); - pColorList->insert( it, pData ); - } - else - { - pColorList->push_back( pData ); - nPos = pColorList->size() - 1; - } - } - return nPos; -} - -sal_Int32 ColorListBox::InsertEntry( const Color& rColor, const OUString& rStr, - sal_Int32 nPos ) -{ - nPos = ListBox::InsertEntry( rStr, nPos ); - if ( nPos != LISTBOX_ERROR ) - { - ImplColorListData* pData = new ImplColorListData( rColor ); - if ( static_cast<size_t>(nPos) < pColorList->size() ) - { - ImpColorList::iterator it = pColorList->begin(); - ::std::advance( it, nPos ); - pColorList->insert( it, pData ); - } - else - { - pColorList->push_back( pData ); - nPos = pColorList->size() - 1; - } - } - return nPos; -} - -void ColorListBox::InsertAutomaticEntryColor(const Color &rColor) -{ - // insert the "Automatic"-entry always on the first position - InsertEntry( rColor, SVT_RESSTR(STR_SVT_AUTOMATIC_COLOR), 0 ); -} - -void ColorListBox::RemoveEntry( sal_Int32 nPos ) -{ - ListBox::RemoveEntry( nPos ); - if ( 0 <= nPos && static_cast<size_t>(nPos) < pColorList->size() ) - { - ImpColorList::iterator it = pColorList->begin(); - ::std::advance( it, nPos ); - delete *it; - pColorList->erase( it ); - } -} - -void ColorListBox::Clear() -{ - ImplDestroyColorEntries(); - ListBox::Clear(); -} - -void ColorListBox::CopyEntries( const ColorListBox& rBox ) -{ - // Liste leeren - ImplDestroyColorEntries(); - - // Daten kopieren - size_t nCount = rBox.pColorList->size(); - for ( size_t n = 0; n < nCount; n++ ) - { - ImplColorListData* pData = (*rBox.pColorList)[ n ]; - sal_Int32 nPos = InsertEntry( rBox.GetEntry( n ) ); - if ( nPos != LISTBOX_ERROR ) - { - if ( static_cast<size_t>(nPos) < pColorList->size() ) - { - ImpColorList::iterator it = pColorList->begin(); - ::std::advance( it, nPos ); - pColorList->insert( it, new ImplColorListData( *pData ) ); - } - else - { - pColorList->push_back( new ImplColorListData( *pData ) ); - } - } - } -} - -sal_Int32 ColorListBox::GetEntryPos( const Color& rColor ) const -{ - for( sal_Int32 n = (sal_Int32) pColorList->size(); n; ) - { - ImplColorListData* pData = (*pColorList)[ --n ]; - if ( pData->bColor && ( pData->aColor == rColor ) ) - return n; - } - return LISTBOX_ENTRY_NOTFOUND; -} - -Color ColorListBox::GetEntryColor( sal_Int32 nPos ) const -{ - Color aColor; - ImplColorListData* pData = ( 0 <= nPos && static_cast<size_t>(nPos) < pColorList->size() ) ? - (*pColorList)[ nPos ] : nullptr; - if ( pData && pData->bColor ) - aColor = pData->aColor; - return aColor; -} - -void ColorListBox::UserDraw( const UserDrawEvent& rUDEvt ) -{ - size_t nPos = rUDEvt.GetItemId(); - ImplColorListData* pData = ( nPos < pColorList->size() ) ? (*pColorList)[ nPos ] : nullptr; - if ( pData ) - { - if ( pData->bColor ) - { - Point aPos( rUDEvt.GetRect().TopLeft() ); - - aPos.X() += 2; - aPos.Y() += ( rUDEvt.GetRect().GetHeight() - aImageSize.Height() ) / 2; - - const Rectangle aRect(aPos, aImageSize); - - vcl::RenderContext* pRenderContext = rUDEvt.GetRenderContext(); - pRenderContext->Push(); - pRenderContext->SetFillColor(pData->aColor); - pRenderContext->SetLineColor(pRenderContext->GetTextColor()); - pRenderContext->DrawRect(aRect); - pRenderContext->Pop(); - - const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); - const sal_uInt16 nEdgeBlendingPercent(GetEdgeBlending() ? rStyleSettings.GetEdgeBlending() : 0); - - if(nEdgeBlendingPercent) - { - const Color& rTopLeft(rStyleSettings.GetEdgeBlendingTopLeftColor()); - const Color& rBottomRight(rStyleSettings.GetEdgeBlendingBottomRightColor()); - const sal_uInt8 nAlpha((nEdgeBlendingPercent * 255) / 100); - const BitmapEx aBlendFrame(createBlendFrame(aRect.GetSize(), nAlpha, rTopLeft, rBottomRight)); - - if(!aBlendFrame.IsEmpty()) - { - pRenderContext->DrawBitmapEx(aRect.TopLeft(), aBlendFrame); - } - } - - ListBox::DrawEntry( rUDEvt, false, false ); - } - else - ListBox::DrawEntry( rUDEvt, false, true ); - } - else - ListBox::DrawEntry( rUDEvt, true, false ); -} - BorderWidthImpl::BorderWidthImpl( BorderWidthImplFlags nFlags, double nRate1, double nRate2, double nRateGap ): m_nFlags( nFlags ), m_nRate1( nRate1 ), diff --git a/svtools/source/control/ctrlbox.src b/svtools/source/control/ctrlbox.src index 36036d927a47..4d04006cfbcd 100644 --- a/svtools/source/control/ctrlbox.src +++ b/svtools/source/control/ctrlbox.src @@ -18,11 +18,6 @@ */ #include <svtools/svtools.hrc> -String STR_SVT_AUTOMATIC_COLOR -{ - Text [ en-US ] = "Automatic"; -}; - /* * resources for CollatorResource / CollatorResourceData resp. */ diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi index 0693af63dc7c..2e8b2f6bd9cc 100644 --- a/svx/sdi/svx.sdi +++ b/svx/sdi/svx.sdi @@ -3596,25 +3596,6 @@ SfxBoolItem Freeline_Unfilled SID_DRAW_FREELINE_NOFILL ] -SfxBoolItem AutoColorInvalid SID_ATTR_AUTO_COLOR_INVALID - -[ - AutoUpdate = TRUE, - FastCall = FALSE, - ReadOnlyDoc = FALSE, - Toggle = FALSE, - Container = TRUE, - RecordAbsolute = FALSE, - RecordPerSet; - - - AccelConfig = FALSE, - MenuConfig = FALSE, - ToolBoxConfig = FALSE, - GroupId = GID_INSERT; -] - - SfxVoidItem Gallery SID_GALLERY [ diff --git a/svx/source/dialog/_bmpmask.cxx b/svx/source/dialog/_bmpmask.cxx index 77ca04fc3a01..5eec4f8f7e8a 100644 --- a/svx/source/dialog/_bmpmask.cxx +++ b/svx/source/dialog/_bmpmask.cxx @@ -25,6 +25,7 @@ #include <sfx2/dispatch.hxx> #include <svtools/colrdlg.hxx> +#include <svx/colorbox.hxx> #include <svx/dialmgr.hxx> #include <svx/bmpmask.hxx> #include <svx/dialogs.hrc> @@ -34,7 +35,6 @@ #include "helpid.hrc" #define BMP_RESID(nId) ResId(nId, DIALOG_MGR()) -#define TRANSP_COL (Color( 252, 252, 252 )) #define OWN_CALLMODE SfxCallMode::ASYNCHRON | SfxCallMode::RECORD @@ -293,7 +293,7 @@ IMPL_LINK( MaskData, CbxTransHdl, Button*, pButton, void ) IMPL_LINK( MaskData, FocusLbHdl, Control&, rControl, void ) { - ColorLB* pLb = static_cast<ColorLB*>(&rControl); + SvxColorListBox* pLb = static_cast<SvxColorListBox*>(&rControl); // MT: bFireFox as API parameter is ugly, find better solution???? pMask->m_pQSet1->SelectItem( pLb == pMask->m_pLbColor1 ? 1 : 0 /* , false */ ); pMask->m_pQSet2->SelectItem( pLb == pMask->m_pLbColor2 ? 1 : 0 /* , false */ ); @@ -373,6 +373,7 @@ SvxBmpMask::SvxBmpMask(SfxBindings *pBindinx, SfxChildWindow *pCW, vcl::Window* m_pQSet1->Show(); get(m_pSp1, "tol1"); get(m_pLbColor1, "color1"); + m_pLbColor1->SetSlotId(SID_BMPMASK_COLOR); get(m_pCbx2, "cbx2"); m_pQSet2 = VclPtr<MaskSet>::Create(this, pGrid); m_pQSet2->set_grid_left_attach(1); @@ -380,6 +381,7 @@ SvxBmpMask::SvxBmpMask(SfxBindings *pBindinx, SfxChildWindow *pCW, vcl::Window* m_pQSet2->Show(); get(m_pSp2, "tol2"); get(m_pLbColor2, "color2"); + m_pLbColor2->SetSlotId(SID_BMPMASK_COLOR); get(m_pCbx3, "cbx3"); m_pQSet3 = VclPtr<MaskSet>::Create(this, pGrid); m_pQSet3->set_grid_left_attach(1); @@ -387,6 +389,7 @@ SvxBmpMask::SvxBmpMask(SfxBindings *pBindinx, SfxChildWindow *pCW, vcl::Window* m_pQSet3->Show(); get(m_pSp3, "tol3"); get(m_pLbColor3, "color3"); + m_pLbColor3->SetSlotId(SID_BMPMASK_COLOR); get(m_pCbx4, "cbx4"); m_pQSet4 = VclPtr<MaskSet>::Create(this, pGrid); m_pQSet4->set_grid_left_attach(1); @@ -394,14 +397,15 @@ SvxBmpMask::SvxBmpMask(SfxBindings *pBindinx, SfxChildWindow *pCW, vcl::Window* m_pQSet4->Show(); get(m_pSp4, "tol4"); get(m_pLbColor4, "color4"); + m_pLbColor4->SetSlotId(SID_BMPMASK_COLOR); get(m_pCbxTrans, "cbx5"); get(m_pLbColorTrans, "color5"); - //temp fill it to get optimal size - m_pLbColor1->Fill(XColorList::GetStdColorList()); - m_pLbColor1->set_width_request(m_pLbColor1->get_preferred_size().Width()); - m_pLbColor1->Clear(); - //clear again + m_pLbColorTrans->SelectEntry(Color(COL_BLACK)); + m_pLbColor1->SelectEntry(Color(COL_TRANSPARENT)); + m_pLbColor2->SelectEntry(Color(COL_TRANSPARENT)); + m_pLbColor3->SelectEntry(Color(COL_TRANSPARENT)); + m_pLbColor4->SelectEntry(Color(COL_TRANSPARENT)); m_pTbxPipette->SetSelectHdl( LINK( pData, MaskData, PipetteHdl ) ); m_pBtnExec->SetClickHdl( LINK( pData, MaskData, ExecHdl ) ); @@ -517,40 +521,6 @@ bool SvxBmpMask::Close() return SfxDockingWindow::Close(); } -bool SvxBmpMask::NeedsColorList() const -{ - return ( m_pLbColor1->GetEntryCount() == 0 ); -} - -void SvxBmpMask::SetColorList( const XColorListRef &pList ) -{ - if ( pList.is() && ( pList != pColLst ) ) - { - const OUString aTransp(BMP_RESID(RID_SVXDLG_BMPMASK_STR_TRANSP).toString()); - - pColLst = pList; - - m_pLbColorTrans->Fill( pColLst ); - m_pLbColorTrans->SelectEntryPos( 0 ); - - m_pLbColor1->Fill( pColLst ); - m_pLbColor1->InsertEntry( TRANSP_COL, aTransp, 0 ); - m_pLbColor1->SelectEntryPos( 0 ); - - m_pLbColor2->Fill( pColLst ); - m_pLbColor2->InsertEntry( TRANSP_COL, aTransp, 0 ); - m_pLbColor2->SelectEntryPos( 0 ); - - m_pLbColor3->Fill( pColLst ); - m_pLbColor3->InsertEntry( TRANSP_COL, aTransp, 0 ); - m_pLbColor3->SelectEntryPos( 0 ); - - m_pLbColor4->Fill( pColLst ); - m_pLbColor4->InsertEntry( TRANSP_COL, aTransp, 0 ); - m_pLbColor4->SelectEntryPos( 0 ); - } -} - void SvxBmpMask::SetColor( const Color& rColor ) { aPipetteColor = rColor; @@ -738,7 +708,7 @@ GDIMetaFile SvxBmpMask::ImpMask( const GDIMetaFile& rMtf ) pMinB[i] = std::max( nVal - nTol, 0L ); pMaxB[i] = std::min( nVal + nTol, 255L ); - pTrans[ i ] = ( pDstCols[ i ] == TRANSP_COL ); + pTrans[ i ] = (pDstCols[ i ] == COL_TRANSPARENT); } // Investigate actions and if necessary replace colors @@ -1054,7 +1024,7 @@ Graphic SvxBmpMask::Mask( const Graphic& rGraphic ) for( sal_uInt16 i = 0; i < nCount; i++ ) { // Do we have a transparent color? - if( pDstCols[i] == TRANSP_COL ) + if (pDstCols[i] == COL_TRANSPARENT) { BitmapEx aBmpEx( ImpMaskTransparent( aGraphic.GetBitmapEx(), pSrcCols[ i ], pTols[ i ] ) ); diff --git a/svx/source/dialog/bmpmask.hrc b/svx/source/dialog/bmpmask.hrc index 1e446c418145..bf054482824d 100644 --- a/svx/source/dialog/bmpmask.hrc +++ b/svx/source/dialog/bmpmask.hrc @@ -16,7 +16,7 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#define RID_SVXDLG_BMPMASK_STR_TRANSP (RID_SVX_BMPMASK_START + 1) + #define RID_SVXDLG_BMPMASK_STR_PALETTE (RID_SVX_BMPMASK_START + 3) /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/dialog/bmpmask.src b/svx/source/dialog/bmpmask.src index d154d7ed0db9..16bf943d9f69 100644 --- a/svx/source/dialog/bmpmask.src +++ b/svx/source/dialog/bmpmask.src @@ -22,11 +22,6 @@ #include "bmpmask.hrc" #include "helpid.hrc" -String RID_SVXDLG_BMPMASK_STR_TRANSP -{ - Text [ en-US ] = "Transparent"; -}; - String RID_SVXDLG_BMPMASK_STR_PALETTE { Text [ en-US ] = "Color Palette"; diff --git a/svx/source/dialog/dlgctrl.cxx b/svx/source/dialog/dlgctrl.cxx index 740033df05e0..d8f312bda281 100644 --- a/svx/source/dialog/dlgctrl.cxx +++ b/svx/source/dialog/dlgctrl.cxx @@ -1103,52 +1103,6 @@ void SvxPixelCtl::Reset() Invalidate(); } -VCL_BUILDER_DECL_FACTORY(ColorLB) -{ - bool bDropdown = VclBuilder::extractDropdown(rMap); - WinBits nWinBits = WB_LEFT|WB_VCENTER|WB_3DLOOK|WB_SIMPLEMODE|WB_TABSTOP; - if (bDropdown) - nWinBits |= WB_DROPDOWN; - OString sBorder = VclBuilder::extractCustomProperty(rMap); - if (!sBorder.isEmpty()) - nWinBits |= WB_BORDER; - VclPtrInstance<ColorLB> pListBox(pParent, nWinBits); - pListBox->EnableAutoSize(true); - rRet = pListBox; -} - -// Fills the Listbox with color and strings - -void ColorLB::Fill( const XColorListRef &pColorTab ) -{ - if( !pColorTab.is() ) - return; - - long nCount = pColorTab->Count(); - SetUpdateMode( false ); - - for( long i = 0; i < nCount; i++ ) - { - const XColorEntry* pEntry = pColorTab->GetColor(i); - InsertEntry( pEntry->GetColor(), pEntry->GetName() ); - } - - AdaptDropDownLineCountToMaximum(); - SetUpdateMode( true ); -} - -void ColorLB::Append( const XColorEntry& rEntry ) -{ - InsertEntry( rEntry.GetColor(), rEntry.GetName() ); - AdaptDropDownLineCountToMaximum(); -} - -void ColorLB::Modify( const XColorEntry& rEntry, sal_Int32 nPos ) -{ - RemoveEntry( nPos ); - InsertEntry( rEntry.GetColor(), rEntry.GetName(), nPos ); -} - // Fills the listbox (provisional) with strings HatchingLB::HatchingLB( vcl::Window* pParent, WinBits nWinStyle) @@ -1303,7 +1257,7 @@ namespace } // end of anonymous namespace FillAttrLB::FillAttrLB(vcl::Window* pParent, WinBits aWB) -: ColorListBox(pParent, aWB) + : ListBox(pParent, aWB) { } diff --git a/svx/source/dialog/fontwork.cxx b/svx/source/dialog/fontwork.cxx index 166277cc42b4..b86ce464a860 100644 --- a/svx/source/dialog/fontwork.cxx +++ b/svx/source/dialog/fontwork.cxx @@ -20,6 +20,7 @@ #include <sfx2/module.hxx> #include <sfx2/dispatch.hxx> +#include <svx/colorbox.hxx> #include <svx/svdobj.hxx> #include <svx/svdopath.hxx> #include <svx/svdview.hxx> @@ -791,23 +792,13 @@ IMPL_LINK_NOARG(SvxFontWorkDialog, InputTimoutHdl_Impl, Idle *, void) { &aDistItem, &aStartItem, &aShadowXItem, &aShadowYItem }); } -IMPL_LINK_NOARG(SvxFontWorkDialog, ColorSelectHdl_Impl, ListBox&, void) +IMPL_LINK_NOARG(SvxFontWorkDialog, ColorSelectHdl_Impl, SvxColorListBox&, void) { XFormTextShadowColorItem aItem( "", m_pShadowColorLB->GetSelectEntryColor() ); GetBindings().GetDispatcher()->ExecuteList(SID_FORMTEXT_SHDWCOLOR, SfxCallMode::RECORD, { &aItem }); } -void SvxFontWorkDialog::SetColorList(const XColorListRef &pList) -{ - if ( pList.is() && pList != pColorList ) - { - pColorList = pList; - m_pShadowColorLB->Clear(); - m_pShadowColorLB->Fill(pColorList); - } -} - void SvxFontWorkDialog::ApplyImageList() { if (nLastShadowTbxId == nShadowSlantId) diff --git a/svx/source/engine3d/float3d.cxx b/svx/source/engine3d/float3d.cxx index b5ed0de3e87a..80d065df7a22 100644 --- a/svx/source/engine3d/float3d.cxx +++ b/svx/source/engine3d/float3d.cxx @@ -24,6 +24,7 @@ #include <svtools/colrdlg.hxx> #include <vcl/msgbox.hxx> #include <sfx2/viewsh.hxx> +#include <svx/colorbox.hxx> #include <svx/xflclit.hxx> #include <svx/svdmodel.hxx> #include <svx/globl3d.hxx> @@ -273,19 +274,20 @@ Svx3DWin::Svx3DWin(SfxBindings* pInBindings, SfxChildWindow *pCW, vcl::Window* p Link<ListBox&,void> aLink2 = LINK( this, Svx3DWin, SelectHdl ); + Link<SvxColorListBox&,void> aLink4 = LINK( this, Svx3DWin, SelectColorHdl ); m_pLbMatFavorites->SetSelectHdl( aLink2 ); - m_pLbMatColor->SetSelectHdl( aLink2 ); - m_pLbMatEmission->SetSelectHdl( aLink2 ); - m_pLbMatSpecular->SetSelectHdl( aLink2 ); - m_pLbLight1->SetSelectHdl( aLink2 ); - m_pLbLight2->SetSelectHdl( aLink2 ); - m_pLbLight3->SetSelectHdl( aLink2 ); - m_pLbLight4->SetSelectHdl( aLink2 ); - m_pLbLight5->SetSelectHdl( aLink2 ); - m_pLbLight6->SetSelectHdl( aLink2 ); - m_pLbLight7->SetSelectHdl( aLink2 ); - m_pLbLight8->SetSelectHdl( aLink2 ); - m_pLbAmbientlight->SetSelectHdl( aLink2 ); + m_pLbMatColor->SetSelectHdl( aLink4 ); + m_pLbMatEmission->SetSelectHdl( aLink4 ); + m_pLbMatSpecular->SetSelectHdl( aLink4 ); + m_pLbLight1->SetSelectHdl( aLink4 ); + m_pLbLight2->SetSelectHdl( aLink4 ); + m_pLbLight3->SetSelectHdl( aLink4 ); + m_pLbLight4->SetSelectHdl( aLink4 ); + m_pLbLight5->SetSelectHdl( aLink4 ); + m_pLbLight6->SetSelectHdl( aLink4 ); + m_pLbLight7->SetSelectHdl( aLink4 ); + m_pLbLight8->SetSelectHdl( aLink4 ); + m_pLbAmbientlight->SetSelectHdl( aLink4 ); m_pLbShademode->SetSelectHdl( aLink2 ); Link<Edit&,void> aLink3 = LINK( this, Svx3DWin, ModifyHdl ); @@ -941,7 +943,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs ) if( eState != SfxItemState::DONTCARE ) { aColor = static_cast<const SvxColorItem&>(rAttrs.Get(SDRATTR_3DSCENE_LIGHTCOLOR_1)).GetValue(); - ColorLB* pLb = m_pLbLight1; + SvxColorListBox* pLb = m_pLbLight1; if( aColor != pLb->GetSelectEntryColor() ) { LBSelectColor( pLb, aColor ); @@ -950,7 +952,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs ) } else { - if( m_pLbLight1->GetSelectEntryCount() != 0 ) + if (!m_pLbLight1->IsNoSelection()) { m_pLbLight1->SetNoSelection(); bUpdate = true; @@ -990,7 +992,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs ) if( eState != SfxItemState::DONTCARE ) { aColor = static_cast<const SvxColorItem&>(rAttrs.Get(SDRATTR_3DSCENE_LIGHTCOLOR_2)).GetValue(); - ColorLB* pLb = m_pLbLight2; + SvxColorListBox* pLb = m_pLbLight2; if( aColor != pLb->GetSelectEntryColor() ) { LBSelectColor( pLb, aColor ); @@ -999,7 +1001,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs ) } else { - if( m_pLbLight2->GetSelectEntryCount() != 0 ) + if (!m_pLbLight2->IsNoSelection()) { m_pLbLight2->SetNoSelection(); bUpdate = true; @@ -1039,7 +1041,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs ) if( eState != SfxItemState::DONTCARE ) { aColor = static_cast<const SvxColorItem&>(rAttrs.Get(SDRATTR_3DSCENE_LIGHTCOLOR_3)).GetValue(); - ColorLB* pLb = m_pLbLight3; + SvxColorListBox* pLb = m_pLbLight3; if( aColor != pLb->GetSelectEntryColor() ) { LBSelectColor( pLb, aColor ); @@ -1048,7 +1050,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs ) } else { - if( m_pLbLight3->GetSelectEntryCount() != 0 ) + if (!m_pLbLight3->IsNoSelection()) { m_pLbLight3->SetNoSelection(); bUpdate = true; @@ -1088,7 +1090,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs ) if( eState != SfxItemState::DONTCARE ) { aColor = static_cast<const SvxColorItem&>(rAttrs.Get(SDRATTR_3DSCENE_LIGHTCOLOR_4)).GetValue(); - ColorLB* pLb = m_pLbLight4; + SvxColorListBox* pLb = m_pLbLight4; if( aColor != pLb->GetSelectEntryColor() ) { LBSelectColor( pLb, aColor ); @@ -1097,7 +1099,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs ) } else { - if( m_pLbLight4->GetSelectEntryCount() != 0 ) + if (!m_pLbLight4->IsNoSelection()) { m_pLbLight4->SetNoSelection(); bUpdate = true; @@ -1137,7 +1139,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs ) if( eState != SfxItemState::DONTCARE ) { aColor = static_cast<const SvxColorItem&>(rAttrs.Get(SDRATTR_3DSCENE_LIGHTCOLOR_5)).GetValue(); - ColorLB* pLb = m_pLbLight5; + SvxColorListBox* pLb = m_pLbLight5; if( aColor != pLb->GetSelectEntryColor() ) { LBSelectColor( pLb, aColor ); @@ -1146,7 +1148,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs ) } else { - if( m_pLbLight5->GetSelectEntryCount() != 0 ) + if (!m_pLbLight5->IsNoSelection()) { m_pLbLight5->SetNoSelection(); bUpdate = true; @@ -1186,7 +1188,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs ) if( eState != SfxItemState::DONTCARE ) { aColor = static_cast<const SvxColorItem&>(rAttrs.Get(SDRATTR_3DSCENE_LIGHTCOLOR_6)).GetValue(); - ColorLB* pLb = m_pLbLight6; + SvxColorListBox* pLb = m_pLbLight6; if( aColor != pLb->GetSelectEntryColor() ) { LBSelectColor( pLb, aColor ); @@ -1195,7 +1197,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs ) } else { - if( m_pLbLight6->GetSelectEntryCount() != 0 ) + if (!m_pLbLight6->IsNoSelection()) { m_pLbLight6->SetNoSelection(); bUpdate = true; @@ -1235,7 +1237,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs ) if( eState != SfxItemState::DONTCARE ) { aColor = static_cast<const SvxColorItem&>(rAttrs.Get(SDRATTR_3DSCENE_LIGHTCOLOR_7)).GetValue(); - ColorLB* pLb = m_pLbLight7; + SvxColorListBox* pLb = m_pLbLight7; if( aColor != pLb->GetSelectEntryColor() ) { LBSelectColor( pLb, aColor ); @@ -1244,7 +1246,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs ) } else { - if( m_pLbLight7->GetSelectEntryCount() != 0 ) + if (!m_pLbLight7->IsNoSelection()) { m_pLbLight7->SetNoSelection(); bUpdate = true; @@ -1284,7 +1286,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs ) if( eState != SfxItemState::DONTCARE ) { aColor = static_cast<const SvxColorItem&>(rAttrs.Get(SDRATTR_3DSCENE_LIGHTCOLOR_8)).GetValue(); - ColorLB* pLb = m_pLbLight8; + SvxColorListBox* pLb = m_pLbLight8; if( aColor != pLb->GetSelectEntryColor() ) { LBSelectColor( pLb, aColor ); @@ -1293,7 +1295,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs ) } else { - if( m_pLbLight8->GetSelectEntryCount() != 0 ) + if (!m_pLbLight8->IsNoSelection()) { m_pLbLight8->SetNoSelection(); bUpdate = true; @@ -1333,7 +1335,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs ) if( eState != SfxItemState::DONTCARE ) { aColor = static_cast<const SvxColorItem&>(rAttrs.Get(SDRATTR_3DSCENE_AMBIENTCOLOR)).GetValue(); - ColorLB* pLb = m_pLbAmbientlight; + SvxColorListBox* pLb = m_pLbAmbientlight; if( aColor != pLb->GetSelectEntryColor() ) { LBSelectColor( pLb, aColor ); @@ -1342,7 +1344,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs ) } else { - if( m_pLbAmbientlight->GetSelectEntryCount() != 0 ) + if (!m_pLbAmbientlight->IsNoSelection()) { m_pLbAmbientlight->SetNoSelection(); bUpdate = true; @@ -1493,7 +1495,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs ) if( eState != SfxItemState::DONTCARE ) { aColor = static_cast<const XFillColorItem&>(rAttrs.Get(XATTR_FILLCOLOR)).GetColorValue(); - ColorLB* pLb = m_pLbMatColor; + SvxColorListBox* pLb = m_pLbMatColor; if( aColor != pLb->GetSelectEntryColor() ) { LBSelectColor( pLb, aColor ); @@ -1502,7 +1504,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs ) } else { - if( m_pLbMatColor->GetSelectEntryCount() != 0 ) + if (!m_pLbMatColor->IsNoSelection()) { m_pLbMatColor->SetNoSelection(); bUpdate = true; @@ -1514,7 +1516,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs ) if( eState != SfxItemState::DONTCARE ) { aColor = static_cast<const SvxColorItem&>(rAttrs.Get(SDRATTR_3DOBJ_MAT_EMISSION)).GetValue(); - ColorLB* pLb = m_pLbMatEmission; + SvxColorListBox* pLb = m_pLbMatEmission; if( aColor != pLb->GetSelectEntryColor() ) { LBSelectColor( pLb, aColor ); @@ -1523,7 +1525,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs ) } else { - if( m_pLbMatEmission->GetSelectEntryCount() != 0 ) + if (!m_pLbMatEmission->IsNoSelection()) { m_pLbMatEmission->SetNoSelection(); bUpdate = true; @@ -1535,7 +1537,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs ) if( eState != SfxItemState::DONTCARE ) { aColor = static_cast<const SvxColorItem&>(rAttrs.Get(SDRATTR_3DOBJ_MAT_SPECULAR)).GetValue(); - ColorLB* pLb = m_pLbMatSpecular; + SvxColorListBox* pLb = m_pLbMatSpecular; if( aColor != pLb->GetSelectEntryColor() ) { LBSelectColor( pLb, aColor ); @@ -1544,7 +1546,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs ) } else { - if( m_pLbMatSpecular->GetSelectEntryCount() != 0 ) + if (!m_pLbMatSpecular->IsNoSelection()) { m_pLbMatSpecular->SetNoSelection(); bUpdate = true; @@ -1852,7 +1854,7 @@ void Svx3DWin::GetAttr( SfxItemSet& rAttrs ) const SfxItemSet aLightItemSet(m_pCtlLightPreview->GetSvx3DLightControl().Get3DAttributes()); // Light 1 color - if( m_pLbLight1->GetSelectEntryCount() ) + if (!m_pLbLight1->IsNoSelection()) { aColor = m_pLbLight1->GetSelectEntryColor(); rAttrs.Put(makeSvx3DLightcolor1Item(aColor)); @@ -1877,7 +1879,7 @@ void Svx3DWin::GetAttr( SfxItemSet& rAttrs ) // Light 2 color - if( m_pLbLight2->GetSelectEntryCount() ) + if (!m_pLbLight2->IsNoSelection()) { aColor = m_pLbLight2->GetSelectEntryColor(); rAttrs.Put(makeSvx3DLightcolor2Item(aColor)); @@ -1901,7 +1903,7 @@ void Svx3DWin::GetAttr( SfxItemSet& rAttrs ) rAttrs.InvalidateItem(SDRATTR_3DSCENE_LIGHTON_2); // Light 3 color - if( m_pLbLight3->GetSelectEntryCount() ) + if (!m_pLbLight3->IsNoSelection()) { aColor = m_pLbLight3->GetSelectEntryColor(); rAttrs.Put(makeSvx3DLightcolor3Item(aColor)); @@ -1925,7 +1927,7 @@ void Svx3DWin::GetAttr( SfxItemSet& rAttrs ) rAttrs.InvalidateItem(SDRATTR_3DSCENE_LIGHTON_3); // Light 4 color - if( m_pLbLight4->GetSelectEntryCount() ) + if (!m_pLbLight4->IsNoSelection()) { aColor = m_pLbLight4->GetSelectEntryColor(); rAttrs.Put(makeSvx3DLightcolor4Item(aColor)); @@ -1949,7 +1951,7 @@ void Svx3DWin::GetAttr( SfxItemSet& rAttrs ) rAttrs.InvalidateItem(SDRATTR_3DSCENE_LIGHTON_4); // Light 5 color - if( m_pLbLight5->GetSelectEntryCount() ) + if (!m_pLbLight5->IsNoSelection()) { aColor = m_pLbLight5->GetSelectEntryColor(); rAttrs.Put(makeSvx3DLightcolor5Item(aColor)); @@ -1973,7 +1975,7 @@ void Svx3DWin::GetAttr( SfxItemSet& rAttrs ) rAttrs.InvalidateItem(SDRATTR_3DSCENE_LIGHTON_5); // Light 6 color - if( m_pLbLight6->GetSelectEntryCount() ) + if (!m_pLbLight6->IsNoSelection()) { aColor = m_pLbLight6->GetSelectEntryColor(); rAttrs.Put(makeSvx3DLightcolor6Item(aColor)); @@ -1997,7 +1999,7 @@ void Svx3DWin::GetAttr( SfxItemSet& rAttrs ) rAttrs.InvalidateItem(SDRATTR_3DSCENE_LIGHTON_6); // Light 7 color - if( m_pLbLight7->GetSelectEntryCount() ) + if (!m_pLbLight7->IsNoSelection()) { aColor = m_pLbLight7->GetSelectEntryColor(); rAttrs.Put(makeSvx3DLightcolor7Item(aColor)); @@ -2021,7 +2023,7 @@ void Svx3DWin::GetAttr( SfxItemSet& rAttrs ) rAttrs.InvalidateItem(SDRATTR_3DSCENE_LIGHTON_7); // Light 8 color - if( m_pLbLight8->GetSelectEntryCount() ) + if (!m_pLbLight8->IsNoSelection()) { aColor = m_pLbLight8->GetSelectEntryColor(); rAttrs.Put(makeSvx3DLightcolor8Item(aColor)); @@ -2045,7 +2047,7 @@ void Svx3DWin::GetAttr( SfxItemSet& rAttrs ) rAttrs.InvalidateItem(SDRATTR_3DSCENE_LIGHTON_8); // Ambient light - if( m_pLbAmbientlight->GetSelectEntryCount() ) + if (!m_pLbAmbientlight->IsNoSelection()) { aColor = m_pLbAmbientlight->GetSelectEntryColor(); rAttrs.Put(makeSvx3DAmbientcolorItem(aColor)); @@ -2121,7 +2123,7 @@ void Svx3DWin::GetAttr( SfxItemSet& rAttrs ) // Material // Object color - if( m_pLbMatColor->GetSelectEntryCount() ) + if (!m_pLbMatColor->IsNoSelection()) { aColor = m_pLbMatColor->GetSelectEntryColor(); rAttrs.Put( XFillColorItem( "", aColor) ); @@ -2132,7 +2134,7 @@ void Svx3DWin::GetAttr( SfxItemSet& rAttrs ) } // luminous color - if( m_pLbMatEmission->GetSelectEntryCount() ) + if (!m_pLbMatEmission->IsNoSelection()) { aColor = m_pLbMatEmission->GetSelectEntryColor(); rAttrs.Put(makeSvx3DMaterialEmissionItem(aColor)); @@ -2141,7 +2143,7 @@ void Svx3DWin::GetAttr( SfxItemSet& rAttrs ) rAttrs.InvalidateItem(SDRATTR_3DOBJ_MAT_EMISSION); // Specular - if( m_pLbMatSpecular->GetSelectEntryCount() ) + if (!m_pLbMatSpecular->IsNoSelection()) { aColor = m_pLbMatSpecular->GetSelectEntryColor(); rAttrs.Put(makeSvx3DMaterialSpecularItem(aColor)); @@ -2302,7 +2304,7 @@ IMPL_LINK( Svx3DWin, ClickViewTypeHdl, Button*, pBtn, void ) { m_pFLLight->Show(); - ColorLB* pLb = GetLbByButton(); + SvxColorListBox* pLb = GetLbByButton(); if( pLb ) pLb->Show(); @@ -2388,7 +2390,7 @@ IMPL_LINK( Svx3DWin, ClickHdl, Button *, pButton, void ) pBtn == m_pBtnLight8 ) { // Lighting - ColorLB* pLb = GetLbByButton( pBtn ); + SvxColorListBox* pLb = GetLbByButton( pBtn ); pLb->Show(); if( pBtn->IsChecked() ) @@ -2513,7 +2515,7 @@ IMPL_LINK( Svx3DWin, ClickHdl, Button *, pButton, void ) IMPL_LINK( Svx3DWin, ClickColorHdl, Button *, pBtn, void) { SvColorDialog aColorDlg( this ); - ColorLB* pLb; + SvxColorListBox* pLb; if( pBtn == m_pBtnLightColor ) pLb = GetLbByButton(); @@ -2532,12 +2534,11 @@ IMPL_LINK( Svx3DWin, ClickColorHdl, Button *, pBtn, void) if( aColorDlg.Execute() == RET_OK ) { aColor = aColorDlg.GetColor(); - if( LBSelectColor( pLb, aColor ) ) - SelectHdl( *pLb ); + LBSelectColor(pLb, aColor); + SelectColorHdl(*pLb); } } - IMPL_LINK( Svx3DWin, SelectHdl, ListBox&, rListBox, void ) { bool bUpdatePreview = false; @@ -2604,9 +2605,20 @@ IMPL_LINK( Svx3DWin, SelectHdl, ListBox&, rListBox, void ) bUpdatePreview = true; } - else if( &rListBox == m_pLbMatColor || - &rListBox == m_pLbMatEmission || - &rListBox == m_pLbMatSpecular ) + else if (&rListBox == m_pLbShademode) + bUpdatePreview = true; + + if( bUpdatePreview ) + UpdatePreview(); +} + +IMPL_LINK( Svx3DWin, SelectColorHdl, SvxColorListBox&, rListBox, void ) +{ + bool bUpdatePreview = false; + + if( &rListBox == m_pLbMatColor || + &rListBox == m_pLbMatEmission || + &rListBox == m_pLbMatSpecular ) { m_pLbMatFavorites->SelectEntryPos( 0 ); bUpdatePreview = true; @@ -2627,8 +2639,6 @@ IMPL_LINK( Svx3DWin, SelectHdl, ListBox&, rListBox, void ) { bUpdatePreview = true; } - else if (&rListBox == m_pLbShademode) - bUpdatePreview = true; if( bUpdatePreview ) UpdatePreview(); @@ -2665,7 +2675,7 @@ IMPL_LINK( Svx3DWin, ModifyHdl, Edit&, rField, void ) void Svx3DWin::ClickLight(PushButton& rBtn) { sal_uInt16 nLightSource = GetLightSource( &rBtn ); - ColorLB* pLb = GetLbByButton( &rBtn ); + SvxColorListBox* pLb = GetLbByButton( &rBtn ); Color aColor( pLb->GetSelectEntryColor() ); SfxItemSet aLightItemSet(m_pCtlLightPreview->GetSvx3DLightControl().Get3DAttributes()); const bool bOnOff(GetUILightState( static_cast<const ImageButton&>(rBtn) )); @@ -2756,36 +2766,29 @@ IMPL_LINK_NOARG(Svx3DWin, ChangeSelectionCallbackHdl, SvxLightCtl3D*, void) } } +namespace +{ + OUString lcl_makeColorName(const Color& rColor) + { + OUString aStr = SVX_RESSTR(RID_SVXFLOAT3D_FIX_R) + + OUString::number(rColor.GetRed()) + + " " + + SVX_RESSTR(RID_SVXFLOAT3D_FIX_G) + + OUString::number(rColor.GetGreen()) + + " " + + SVX_RESSTR(RID_SVXFLOAT3D_FIX_B) + + OUString::number(rColor.GetBlue()); + return aStr; + } +} // Method to ensure that the LB is also associated with a color -// returns true if color was added - -bool Svx3DWin::LBSelectColor( ColorLB* pLb, const Color& rColor ) +void Svx3DWin::LBSelectColor( SvxColorListBox* pLb, const Color& rColor ) { - bool bRet = false; - pLb->SetNoSelection(); - pLb->SelectEntry( rColor ); - if( pLb->GetSelectEntryCount() == 0 ) - { - OUString aStr(SVX_RESSTR(RID_SVXFLOAT3D_FIX_R)); - - aStr += OUString::number((sal_Int32)rColor.GetRed()); - aStr += " "; - aStr += SVX_RESSTR(RID_SVXFLOAT3D_FIX_G); - aStr += OUString::number((sal_Int32)rColor.GetGreen()); - aStr += " "; - aStr += SVX_RESSTR(RID_SVXFLOAT3D_FIX_B); - aStr += OUString::number((sal_Int32)rColor.GetBlue()); - - const sal_Int32 nPos = pLb->InsertEntry( rColor, aStr ); - pLb->SelectEntryPos( nPos ); - bRet = true; - } - return bRet; + pLb->SelectEntry(std::make_pair(rColor, lcl_makeColorName(rColor))); } - void Svx3DWin::UpdatePreview() { if( pModel == nullptr ) @@ -2808,22 +2811,8 @@ void Svx3DWin::DocumentReload() mpRemember2DAttributes = nullptr; } - -void Svx3DWin::InitColorLB( const SdrModel* pDoc ) +void Svx3DWin::InitColorLB() { - m_pLbLight1->Fill( pDoc->GetColorList() ); - m_pLbLight2->CopyEntries( *m_pLbLight1 ); - m_pLbLight3->CopyEntries( *m_pLbLight1 ); - m_pLbLight4->CopyEntries( *m_pLbLight1 ); - m_pLbLight5->CopyEntries( *m_pLbLight1 ); - m_pLbLight6->CopyEntries( *m_pLbLight1 ); - m_pLbLight7->CopyEntries( *m_pLbLight1 ); - m_pLbLight8->CopyEntries( *m_pLbLight1 ); - m_pLbAmbientlight->CopyEntries( *m_pLbLight1 ); - m_pLbMatColor->CopyEntries( *m_pLbLight1 ); - m_pLbMatEmission->CopyEntries( *m_pLbLight1 ); - m_pLbMatSpecular->CopyEntries( *m_pLbLight1 ); - // First... Color aColWhite( COL_WHITE ); Color aColBlack( COL_BLACK ); @@ -2888,9 +2877,9 @@ sal_uInt16 Svx3DWin::GetLightSource( const PushButton* pBtn ) }; -ColorLB* Svx3DWin::GetLbByButton( const PushButton* pBtn ) +SvxColorListBox* Svx3DWin::GetLbByButton( const PushButton* pBtn ) { - ColorLB* pLb = nullptr; + SvxColorListBox* pLb = nullptr; if( pBtn == nullptr ) { diff --git a/svx/source/engine3d/float3d.src b/svx/source/engine3d/float3d.src index 734117060173..43a48855ae25 100644 --- a/svx/source/engine3d/float3d.src +++ b/svx/source/engine3d/float3d.src @@ -41,21 +41,6 @@ String RID_SVXFLOAT3D_FAVORITE Text [ en-US ] = "Favorite"; }; -String RID_SVXFLOAT3D_FIX_X -{ - Text [ en-US ] = "X"; -}; - -String RID_SVXFLOAT3D_FIX_Y -{ - Text [ en-US ] = "Y"; -}; - -String RID_SVXFLOAT3D_FIX_Z -{ - Text [ en-US ] = "Z"; -}; - String RID_SVXFLOAT3D_FIX_R { Text [ en-US ] = "R:"; diff --git a/svx/source/sidebar/area/AreaPropertyPanelBase.cxx b/svx/source/sidebar/area/AreaPropertyPanelBase.cxx index 5f90b223781a..318b95b20e23 100644 --- a/svx/source/sidebar/area/AreaPropertyPanelBase.cxx +++ b/svx/source/sidebar/area/AreaPropertyPanelBase.cxx @@ -167,10 +167,11 @@ void AreaPropertyPanelBase::Initialize() mpLbFillType->SetSelectHdl( LINK( this, AreaPropertyPanelBase, SelectFillTypeHdl ) ); Link<ListBox&,void> aLink = LINK( this, AreaPropertyPanelBase, SelectFillAttrHdl ); + Link<SvxColorListBox&,void> aLink3 = LINK( this, AreaPropertyPanelBase, SelectFillColorHdl ); mpLbFillAttr->SetSelectHdl( aLink ); mpGradientStyle->SetSelectHdl( aLink ); - mpLbFillGradFrom->SetSelectHdl( aLink ); - mpLbFillGradTo->SetSelectHdl( aLink ); + mpLbFillGradFrom->SetSelectHdl( aLink3 ); + mpLbFillGradTo->SetSelectHdl( aLink3 ); mpMTRAngle->SetModifyHdl(LINK(this,AreaPropertyPanelBase, ChangeGradientAngle)); mpLBTransType->SetSelectHdl(LINK(this, AreaPropertyPanelBase, ChangeTrgrTypeHdl_Impl)); @@ -296,61 +297,33 @@ IMPL_LINK_NOARG(AreaPropertyPanelBase, SelectFillTypeHdl, ListBox&, void) mpToolBoxColor->Hide(); mpBmpImport->Hide(); - const SvxColorListItem* pColorListItem = static_cast<const SvxColorListItem*>(pSh->GetItem(SID_COLOR_TABLE)); - if(pColorListItem) - { - mpLbFillAttr->Enable(); - mpLbFillGradTo->Enable(); - mpLbFillGradFrom->Enable(); - mpGradientStyle->Enable(); - mpMTRAngle->Enable(); - mpLbFillAttr->Clear(); - mpLbFillGradTo->Clear(); - mpLbFillGradFrom->Clear(); - mpLbFillGradTo->Fill(pColorListItem->GetColorList()); - mpLbFillGradFrom->Fill(pColorListItem->GetColorList()); + mpLbFillAttr->Enable(); + mpLbFillGradTo->Enable(); + mpLbFillGradFrom->Enable(); + mpGradientStyle->Enable(); + mpMTRAngle->Enable(); + mpLbFillAttr->Clear(); - mpLbFillGradFrom->AdaptDropDownLineCountToMaximum(); - mpLbFillGradTo->AdaptDropDownLineCountToMaximum(); + if (LISTBOX_ENTRY_NOTFOUND != mnLastPosGradient) + { + const SvxGradientListItem aItem(*static_cast<const SvxGradientListItem*>(pSh->GetItem(SID_GRADIENT_LIST))); - if(LISTBOX_ENTRY_NOTFOUND != mnLastPosGradient) + if(mnLastPosGradient < aItem.GetGradientList()->Count()) { - const SvxGradientListItem aItem(*static_cast<const SvxGradientListItem*>(pSh->GetItem(SID_GRADIENT_LIST))); - - if(mnLastPosGradient < aItem.GetGradientList()->Count()) - { - const XGradient aGradient = aItem.GetGradientList()->GetGradient(mnLastPosGradient)->GetGradient(); - const XFillGradientItem aXFillGradientItem(aGradient); - - // #i122676# change FillStyle and Gradient in one call - XFillStyleItem aXFillStyleItem(drawing::FillStyle_GRADIENT); - setFillStyleAndGradient(&aXFillStyleItem, aXFillGradientItem); - mpLbFillGradFrom->SelectEntry(aGradient.GetStartColor()); - if(mpLbFillGradFrom->GetSelectEntryCount() == 0) - { - mpLbFillGradFrom->InsertEntry(aGradient.GetStartColor(), OUString()); - mpLbFillGradFrom->SelectEntry(aGradient.GetStartColor()); - } - mpLbFillGradTo->SelectEntry(aGradient.GetEndColor()); - if(mpLbFillGradTo->GetSelectEntryCount() == 0) - { - mpLbFillGradTo->InsertEntry(aGradient.GetEndColor(), OUString()); - mpLbFillGradTo->SelectEntry(aGradient.GetEndColor()); - } - - mpMTRAngle->SetValue(aGradient.GetAngle() / 10); - css::awt::GradientStyle eXGS = aGradient.GetGradientStyle(); - mpGradientStyle->SelectEntryPos(sal::static_int_cast< sal_Int32 >( eXGS )); - } + const XGradient aGradient = aItem.GetGradientList()->GetGradient(mnLastPosGradient)->GetGradient(); + const XFillGradientItem aXFillGradientItem(aGradient); + + // #i122676# change FillStyle and Gradient in one call + XFillStyleItem aXFillStyleItem(drawing::FillStyle_GRADIENT); + setFillStyleAndGradient(&aXFillStyleItem, aXFillGradientItem); + mpLbFillGradFrom->SelectEntry(aGradient.GetStartColor()); + mpLbFillGradTo->SelectEntry(aGradient.GetEndColor()); + + mpMTRAngle->SetValue(aGradient.GetAngle() / 10); + css::awt::GradientStyle eXGS = aGradient.GetGradientStyle(); + mpGradientStyle->SelectEntryPos(sal::static_int_cast< sal_Int32 >( eXGS )); } } - else - { - mpLbFillGradFrom->Disable(); - mpLbFillGradTo->Disable(); - mpMTRAngle->Disable(); - mpGradientStyle->Disable(); - } break; } case HATCH: @@ -475,6 +448,11 @@ IMPL_LINK_NOARG(AreaPropertyPanelBase, SelectFillTypeHdl, ListBox&, void) } } +IMPL_LINK_NOARG(AreaPropertyPanelBase, SelectFillColorHdl, SvxColorListBox&, void) +{ + SelectFillAttrHdl_Impl(); +} + IMPL_LINK_NOARG(AreaPropertyPanelBase, SelectFillAttrHdl, ListBox&, void) { SelectFillAttrHdl_Impl(); @@ -1176,28 +1154,15 @@ void AreaPropertyPanelBase::Update() mpLbFillAttr->Enable(); mpLbFillAttr->Clear(); mpLbFillAttr->Fill(aItem.GetGradientList()); - const SvxColorListItem aColorItem(*static_cast<const SvxColorListItem*>(pSh->GetItem(SID_COLOR_TABLE))); - mpLbFillGradFrom->Fill(aColorItem.GetColorList()); - mpLbFillGradTo->Fill(aColorItem.GetColorList()); mpLbFillGradTo->SetNoSelection(); mpLbFillGradFrom->SetNoSelection(); - if(mpFillGradientItem) + if (mpFillGradientItem) { const OUString aString(mpFillGradientItem->GetName()); mpLbFillAttr->SelectEntry(aString); const XGradient aGradient = mpFillGradientItem->GetGradientValue(); mpLbFillGradFrom->SelectEntry(aGradient.GetStartColor()); - if(mpLbFillGradFrom->GetSelectEntryCount() == 0) - { - mpLbFillGradFrom->InsertEntry(aGradient.GetStartColor(), OUString()); - mpLbFillGradFrom->SelectEntry(aGradient.GetStartColor()); - } mpLbFillGradTo->SelectEntry(aGradient.GetEndColor()); - if(mpLbFillGradTo->GetSelectEntryCount() == 0) - { - mpLbFillGradTo->InsertEntry(aGradient.GetEndColor(), OUString()); - mpLbFillGradTo->SelectEntry(aGradient.GetEndColor()); - } mpGradientStyle->SelectEntryPos(sal::static_int_cast< sal_Int32 >( aGradient.GetGradientStyle() )); if(mpGradientStyle->GetSelectEntryPos() == (sal_Int32)GradientStyle::Radial) mpMTRAngle->Disable(); diff --git a/svx/source/sidebar/shadow/ShadowPropertyPanel.cxx b/svx/source/sidebar/shadow/ShadowPropertyPanel.cxx index a1ea3879f3dd..0766550e29cd 100644 --- a/svx/source/sidebar/shadow/ShadowPropertyPanel.cxx +++ b/svx/source/sidebar/shadow/ShadowPropertyPanel.cxx @@ -10,6 +10,7 @@ #include <ShadowPropertyPanel.hxx> #include <comphelper/string.hxx> #include <sfx2/sidebar/ControlFactory.hxx> +#include <svx/colorbox.hxx> #include <svx/dialogs.hrc> #include <svx/dialmgr.hxx> #include <sfx2/objsh.hxx> @@ -122,25 +123,18 @@ void ShadowPropertyPanel::dispose() void ShadowPropertyPanel::Initialize() { - SfxObjectShell* pSh = SfxObjectShell::Current(); - - const SvxColorListItem* pColorListItem = static_cast<const SvxColorListItem*>(pSh ? pSh->GetItem(SID_COLOR_TABLE) : nullptr); - if (pColorListItem) - { - mpLBShadowColor->Fill(pColorListItem->GetColorList()); - mpShowShadow->SetState( TRISTATE_FALSE ); - mpShowShadow->SetClickHdl( LINK(this, ShadowPropertyPanel, ClickShadowHdl ) ); - mpShadowTransMetric->SetModifyHdl( LINK(this, ShadowPropertyPanel, ModifyShadowTransMetricHdl) ); - mpLBShadowColor->SetSelectHdl( LINK( this, ShadowPropertyPanel, ModifyShadowColorHdl ) ); - mpShadowAngle->SetModifyHdl( LINK(this, ShadowPropertyPanel, ModifyShadowDistanceHdl) ); - mpShadowDistance->SetModifyHdl( LINK(this, ShadowPropertyPanel, ModifyShadowDistanceHdl) ); - mpShadowTransSlider->SetRange(Range(0,100)); - mpShadowTransSlider->SetUpdateMode(true); - mpShadowTransSlider->SetSlideHdl( LINK(this, ShadowPropertyPanel, ModifyShadowTransSliderHdl) ); - for(sal_uInt16 i = 0; i <= 20 ; i++) - mpShadowDistance->InsertValue(i*2,FUNIT_POINT); - InsertAngleValues(); - } + mpShowShadow->SetState( TRISTATE_FALSE ); + mpShowShadow->SetClickHdl( LINK(this, ShadowPropertyPanel, ClickShadowHdl ) ); + mpShadowTransMetric->SetModifyHdl( LINK(this, ShadowPropertyPanel, ModifyShadowTransMetricHdl) ); + mpLBShadowColor->SetSelectHdl( LINK( this, ShadowPropertyPanel, ModifyShadowColorHdl ) ); + mpShadowAngle->SetModifyHdl( LINK(this, ShadowPropertyPanel, ModifyShadowDistanceHdl) ); + mpShadowDistance->SetModifyHdl( LINK(this, ShadowPropertyPanel, ModifyShadowDistanceHdl) ); + mpShadowTransSlider->SetRange(Range(0,100)); + mpShadowTransSlider->SetUpdateMode(true); + mpShadowTransSlider->SetSlideHdl( LINK(this, ShadowPropertyPanel, ModifyShadowTransSliderHdl) ); + for(sal_uInt16 i = 0; i <= 20 ; i++) + mpShadowDistance->InsertValue(i*2,FUNIT_POINT); + InsertAngleValues(); } IMPL_LINK_NOARG(ShadowPropertyPanel, ClickShadowHdl, Button*, void) @@ -159,7 +153,7 @@ IMPL_LINK_NOARG(ShadowPropertyPanel, ClickShadowHdl, Button*, void) } } -IMPL_LINK_NOARG(ShadowPropertyPanel, ModifyShadowColorHdl, ListBox&, void) +IMPL_LINK_NOARG(ShadowPropertyPanel, ModifyShadowColorHdl, SvxColorListBox&, void) { XColorItem aItem(makeSdrShadowColorItem(mpLBShadowColor->GetSelectEntryColor())); GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_SHADOW_COLOR, @@ -320,9 +314,6 @@ void ShadowPropertyPanel::NotifyItemUpdate( { mpLBShadowColor->SelectEntry(pColorItem->GetColorValue()); } - else - { - } } } break; diff --git a/svx/source/sidebar/shadow/ShadowPropertyPanel.hxx b/svx/source/sidebar/shadow/ShadowPropertyPanel.hxx index 7e7288617d32..f3fd1c7e12eb 100644 --- a/svx/source/sidebar/shadow/ShadowPropertyPanel.hxx +++ b/svx/source/sidebar/shadow/ShadowPropertyPanel.hxx @@ -25,6 +25,7 @@ #include <sfx2/request.hxx> #include <svx/dlgctrl.hxx> +class SvxColorListBox; namespace svx { namespace sidebar { @@ -60,10 +61,10 @@ public: SfxBindings* pBindings); private: - VclPtr<CheckBox> mpShowShadow; - VclPtr<MetricBox> mpShadowDistance; - VclPtr<ColorLB> mpLBShadowColor; - VclPtr<MetricBox> mpShadowAngle; + VclPtr<CheckBox> mpShowShadow; + VclPtr<MetricBox> mpShadowDistance; + VclPtr<SvxColorListBox> mpLBShadowColor; + VclPtr<MetricBox> mpShadowAngle; VclPtr<FixedText> mpFTAngle; VclPtr<FixedText> mpFTDistance; VclPtr<FixedText> mpFTTransparency; @@ -84,7 +85,7 @@ private: void SetTransparencyValue(long); void UpdateControls(); DECL_LINK(ClickShadowHdl, Button*, void); - DECL_LINK(ModifyShadowColorHdl, ListBox&, void); + DECL_LINK(ModifyShadowColorHdl, SvxColorListBox&, void); DECL_LINK(ModifyShadowTransMetricHdl, Edit&, void); DECL_LINK(ModifyShadowDistanceHdl, Edit&, void); DECL_LINK(ModifyShadowTransSliderHdl, Slider*, void); diff --git a/svx/source/tbxctrls/PaletteManager.cxx b/svx/source/tbxctrls/PaletteManager.cxx index 3ba048559620..7f1d5a140437 100644 --- a/svx/source/tbxctrls/PaletteManager.cxx +++ b/svx/source/tbxctrls/PaletteManager.cxx @@ -254,18 +254,21 @@ void PaletteManager::SetLastColor(const Color& rLastColor) mLastColor = rLastColor; } -void PaletteManager::AddRecentColor(const Color& rRecentColor, const OUString& rName) +void PaletteManager::AddRecentColor(const Color& rRecentColor, const OUString& rName, bool bFront) { auto itColor = std::find_if(maRecentColors.begin(), maRecentColors.end(), - [rRecentColor] (const color_and_name &a) { return a.first == rRecentColor; }); + [rRecentColor] (const NamedColor &a) { return a.first == rRecentColor; }); // if recent color to be added is already in list, remove it if( itColor != maRecentColors.end() ) maRecentColors.erase( itColor ); - maRecentColors.push_front(std::make_pair(rRecentColor, rName)); - if( maRecentColors.size() > mnMaxRecentColors ) + if (maRecentColors.size() == mnMaxRecentColors) maRecentColors.pop_back(); + if (bFront) + maRecentColors.push_front(std::make_pair(rRecentColor, rName)); + else + maRecentColors.push_back(std::make_pair(rRecentColor, rName)); css::uno::Sequence< sal_Int32 > aColorList(maRecentColors.size()); css::uno::Sequence< OUString > aColorNameList(maRecentColors.size()); for (size_t i = 0; i < maRecentColors.size(); ++i) @@ -285,7 +288,7 @@ void PaletteManager::SetBtnUpdater(svx::ToolboxButtonColorUpdater* pBtnUpdater) mLastColor = mpBtnUpdater->GetCurrentColor(); } -void PaletteManager::SetColorSelectFunction(const std::function<void(const OUString&, const Color&)>& aColorSelectFunction) +void PaletteManager::SetColorSelectFunction(const std::function<void(const OUString&, const NamedColor&)>& aColorSelectFunction) { maColorSelectFunction = aColorSelectFunction; } @@ -302,12 +305,14 @@ void PaletteManager::PopupColorPicker(const OUString& aCommand) if (mpBtnUpdater) mpBtnUpdater->Update( aColorDlg.GetColor() ); mLastColor = aColorDlg.GetColor(); - AddRecentColor(mLastColor, ("#" + mLastColor.AsRGBHexString().toAsciiUpperCase())); - maColorSelectFunction(aCommandCopy, mLastColor); + OUString sColorName = ("#" + mLastColor.AsRGBHexString().toAsciiUpperCase()); + NamedColor aNamedColor = std::make_pair(mLastColor, sColorName); + AddRecentColor(mLastColor, sColorName); + maColorSelectFunction(aCommandCopy, aNamedColor); } } -void PaletteManager::DispatchColorCommand(const OUString& aCommand, const Color& rColor) +void PaletteManager::DispatchColorCommand(const OUString& aCommand, const NamedColor& rColor) { using namespace css::uno; using namespace css::frame; @@ -323,7 +328,7 @@ void PaletteManager::DispatchColorCommand(const OUString& aCommand, const Color& Sequence<PropertyValue> aArgs(1); aArgs[0].Name = aObj.GetURLPath(); - aArgs[0].Value = makeAny(sal_Int32(rColor.GetColor())); + aArgs[0].Value = makeAny(sal_Int32(rColor.first.GetColor())); URL aTargetURL; aTargetURL.Complete = aCommand; diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx index 5d3b359b144c..c5c0d568227c 100644 --- a/svx/source/tbxctrls/tbcontrl.cxx +++ b/svx/source/tbxctrls/tbcontrl.cxx @@ -51,6 +51,7 @@ #include <sfx2/childwin.hxx> #include <sfx2/viewfrm.hxx> #include <unotools/fontoptions.hxx> +#include <vcl/builderfactory.hxx> #include <vcl/mnemonic.hxx> #include <vcl/svapp.hxx> #include <vcl/settings.hxx> @@ -85,6 +86,7 @@ #include <editeng/svxfont.hxx> #include <editeng/cmapitem.hxx> #include <svx/colorwindow.hxx> +#include <svx/colorbox.hxx> #include "svx/drawitem.hxx" #include <svx/tbcontrl.hxx> #include "svx/dlgutil.hxx" @@ -1245,13 +1247,13 @@ void SvxFontNameBox_Impl::Select() #endif -SvxColorWindow::SvxColorWindow( const OUString& rCommand, - PaletteManager& rPaletteManager, - BorderColorStatus& rBorderColorStatus, - sal_uInt16 nSlotId, - const Reference< XFrame >& rFrame, - vcl::Window* pParentWindow, - std::function<void(const OUString&, const Color&)> const & aFunction): +SvxColorWindow::SvxColorWindow(const OUString& rCommand, + PaletteManager& rPaletteManager, + BorderColorStatus& rBorderColorStatus, + sal_uInt16 nSlotId, + const Reference< XFrame >& rFrame, + vcl::Window* pParentWindow, + std::function<void(const OUString&, const NamedColor&)> const & aFunction): SfxPopupWindow( nSlotId, pParentWindow, "palette_popup_window", "svx/ui/colorwindow.ui", @@ -1264,6 +1266,7 @@ SvxColorWindow::SvxColorWindow( const OUString& rCommand, { get(mpPaletteListBox, "palette_listbox"); get(mpButtonAutoColor, "auto_color_button"); + get(mpButtonNoneColor, "none_color_button"); get(mpButtonPicker, "color_picker_button"); get(mpColorSet, "colorset"); get(mpRecentColorSet, "recent_colorset"); @@ -1278,6 +1281,16 @@ SvxColorWindow::SvxColorWindow( const OUString& rCommand, case SID_BACKGROUND_COLOR: case SID_ATTR_CHAR_BACK_COLOR: { + mpButtonAutoColor->SetText( SVX_RESSTR( RID_SVXSTR_NOFILL ) ); + break; + } + case SID_AUTHOR_COLOR: + { + mpButtonAutoColor->SetText( SVX_RESSTR( RID_SVXSTR_BY_AUTHOR ) ); + break; + } + case SID_BMPMASK_COLOR: + { mpButtonAutoColor->SetText( SVX_RESSTR( RID_SVXSTR_TRANSPARENT ) ); break; } @@ -1285,15 +1298,7 @@ SvxColorWindow::SvxColorWindow( const OUString& rCommand, case SID_ATTR_CHAR_COLOR2: case SID_EXTRUSION_3D_COLOR: { - SfxPoolItem* pDummy; - - Reference< XDispatchProvider > aDisp( GetFrame()->getController(), UNO_QUERY ); - SfxQueryStatus aQueryStatus( aDisp, - SID_ATTR_AUTO_COLOR_INVALID, - OUString( ".uno:AutoColorInvalid" )); - SfxItemState eState = aQueryStatus.QueryState( pDummy ); - if( (SfxItemState::DEFAULT > eState) || ( SID_EXTRUSION_3D_COLOR == theSlotId ) ) - mpButtonAutoColor->SetText( SVX_RESSTR( RID_SVXSTR_AUTOMATIC ) ); + mpButtonAutoColor->SetText( SVX_RESSTR( RID_SVXSTR_AUTOMATIC ) ); break; } default: @@ -1353,6 +1358,7 @@ SvxColorWindow::SvxColorWindow( const OUString& rCommand, SelectPaletteHdl( *mpPaletteListBox ); mpButtonAutoColor->SetClickHdl( LINK( this, SvxColorWindow, AutoColorClickHdl ) ); + mpButtonNoneColor->SetClickHdl( LINK( this, SvxColorWindow, AutoColorClickHdl ) ); mpButtonPicker->SetClickHdl( LINK( this, SvxColorWindow, OpenPickerClickHdl ) ); mpColorSet->SetSelectHdl( LINK( this, SvxColorWindow, SelectHdl ) ); @@ -1378,6 +1384,11 @@ SvxColorWindow::SvxColorWindow( const OUString& rCommand, } } +void SvxColorWindow::ShowNoneButton() +{ + mpButtonNoneColor->Show(); +} + SvxColorWindow::~SvxColorWindow() { disposeOnce(); @@ -1389,6 +1400,7 @@ void SvxColorWindow::dispose() mpRecentColorSet.clear(); mpPaletteListBox.clear(); mpButtonAutoColor.clear(); + mpButtonNoneColor.clear(); mpButtonPicker.clear(); mpAutomaticSeparator.clear(); SfxPopupWindow::dispose(); @@ -1399,11 +1411,29 @@ void SvxColorWindow::KeyInput( const KeyEvent& rKEvt ) mpColorSet->KeyInput(rKEvt); } +NamedColor SvxColorWindow::GetSelectEntryColor(ValueSet* pColorSet) +{ + Color aColor = pColorSet->GetItemColor(pColorSet->GetSelectItemId()); + OUString sColorName = pColorSet->GetItemText(pColorSet->GetSelectItemId()); + return std::make_pair(aColor, sColorName); +} + +NamedColor SvxColorWindow::GetSelectEntryColor() const +{ + if (!mpColorSet->IsNoSelection()) + return GetSelectEntryColor(mpColorSet); + if (!mpRecentColorSet->IsNoSelection()) + return GetSelectEntryColor(mpRecentColorSet); + if (mpButtonNoneColor->GetStyle() & WB_DEFBUTTON) + return GetNoneColor(); + return GetAutoColor(); +} + IMPL_LINK(SvxColorWindow, SelectHdl, ValueSet*, pColorSet, void) { VclPtr<SvxColorWindow> xThis(this); - Color aColor = pColorSet->GetItemColor( pColorSet->GetSelectItemId() ); + NamedColor aNamedColor = GetSelectEntryColor(pColorSet); /* #i33380# DR 2004-09-03 Moved the following line above the Dispatch() calls. This instance may be deleted in the meantime (i.e. when a dialog is opened while in Dispatch()), accessing members will crash in this case. */ @@ -1411,7 +1441,7 @@ IMPL_LINK(SvxColorWindow, SelectHdl, ValueSet*, pColorSet, void) if ( pColorSet != mpRecentColorSet ) { - mrPaletteManager.AddRecentColor(aColor, pColorSet->GetItemText(pColorSet->GetSelectItemId())); + mrPaletteManager.AddRecentColor(aNamedColor.first, aNamedColor.second); if ( !IsInPopupMode() ) mrPaletteManager.ReloadRecentColorSet( *mpRecentColorSet ); } @@ -1419,9 +1449,9 @@ IMPL_LINK(SvxColorWindow, SelectHdl, ValueSet*, pColorSet, void) if ( IsInPopupMode() ) EndPopupMode(); - maSelectedLink.Call(aColor); + maSelectedLink.Call(aNamedColor); - maColorSelectFunction(maCommand, aColor); + maColorSelectFunction(maCommand, aNamedColor); } IMPL_LINK_NOARG(SvxColorWindow, SelectPaletteHdl, ListBox&, void) @@ -1432,37 +1462,64 @@ IMPL_LINK_NOARG(SvxColorWindow, SelectPaletteHdl, ListBox&, void) mpColorSet->layoutToGivenHeight(mpColorSet->GetSizePixel().Height(), mrPaletteManager.GetColorCount()); } -IMPL_LINK_NOARG(SvxColorWindow, AutoColorClickHdl, Button*, void) +NamedColor SvxColorWindow::GetNoneColor() const { - VclPtr<SvxColorWindow> xThis(this); + Color aColor; + OUString sColorName; + if (theSlotId == SID_AUTHOR_COLOR) + { + aColor = COL_NONE_COLOR; + sColorName = SVX_RESSTR(RID_SVXSTR_NONE); + } + + return std::make_pair(aColor, sColorName); +} +NamedColor SvxColorWindow::GetAutoColor() const +{ Color aColor; - switch ( theSlotId ) + OUString sColorName; + switch (theSlotId) { case SID_ATTR_CHAR_COLOR_BACKGROUND: case SID_BACKGROUND_COLOR: case SID_ATTR_CHAR_BACK_COLOR: - { aColor = COL_TRANSPARENT; + sColorName = SVX_RESSTR(RID_SVXSTR_NOFILL); + break; + case SID_AUTHOR_COLOR: + aColor = COL_TRANSPARENT; + sColorName = SVX_RESSTR(RID_SVXSTR_BY_AUTHOR); + break; + case SID_BMPMASK_COLOR: + aColor = COL_TRANSPARENT; + sColorName = SVX_RESSTR(RID_SVXSTR_TRANSPARENT); break; - } case SID_ATTR_CHAR_COLOR: case SID_ATTR_CHAR_COLOR2: case SID_EXTRUSION_3D_COLOR: - { aColor = COL_AUTO; + sColorName = SVX_RESSTR(RID_SVXSTR_AUTOMATIC); break; - } } + return std::make_pair(aColor, sColorName); +} + +IMPL_LINK(SvxColorWindow, AutoColorClickHdl, Button*, pButton, void) +{ + VclPtr<SvxColorWindow> xThis(this); + + NamedColor aNamedColor = pButton == mpButtonAutoColor ? GetAutoColor() : GetNoneColor(); + mpRecentColorSet->SetNoSelection(); if ( IsInPopupMode() ) EndPopupMode(); - maSelectedLink.Call(aColor); + maSelectedLink.Call(aNamedColor); - maColorSelectFunction(maCommand, aColor); + maColorSelectFunction(maCommand, aNamedColor); } IMPL_LINK_NOARG(SvxColorWindow, OpenPickerClickHdl, Button*, void) @@ -1479,6 +1536,23 @@ void SvxColorWindow::StartSelection() mpColorSet->StartSelection(); } +void SvxColorWindow::SetNoSelection() +{ + mpColorSet->SetNoSelection(); + mpRecentColorSet->SetNoSelection(); + mpButtonAutoColor->set_property("has-default", "false"); + mpButtonNoneColor->set_property("has-default", "false"); +} + +bool SvxColorWindow::IsNoSelection() const +{ + if (!mpColorSet->IsNoSelection()) + return false; + if (!mpRecentColorSet->IsNoSelection()) + return false; + return !mpButtonAutoColor->IsVisible() && !mpButtonNoneColor->IsVisible(); +} + void SvxColorWindow::statusChanged( const css::frame::FeatureStateEvent& rEvent ) { if ( rEvent.IsEnabled && rEvent.FeatureURL.Complete == ".uno:ColorTableState" @@ -1489,34 +1563,76 @@ void SvxColorWindow::statusChanged( const css::frame::FeatureStateEvent& rEvent } else { - mpColorSet->SetNoSelection(); - Color aColor( COL_TRANSPARENT ); + Color aColor(COL_TRANSPARENT); - if ( mrBorderColorStatus.statusChanged( rEvent ) ) + if (mrBorderColorStatus.statusChanged(rEvent)) { aColor = mrBorderColorStatus.GetColor(); } - else if ( rEvent.IsEnabled ) + else if (rEvent.IsEnabled) { sal_Int32 nValue; - if ( rEvent.State >>= nValue ) + if (rEvent.State >>= nValue) aColor = nValue; } - if ( aColor == COL_TRANSPARENT ) - return; + SelectEntry(aColor); + } +} - for ( size_t i = 1; i <= mpColorSet->GetItemCount(); ++i ) +bool SvxColorWindow::SelectValueSetEntry(SvxColorValueSet* pColorSet, const Color& rColor) +{ + for (size_t i = 1; i <= pColorSet->GetItemCount(); ++i) + { + if (rColor == pColorSet->GetItemColor(i)) { - if ( aColor == mpColorSet->GetItemColor(i) ) - { - mpColorSet->SelectItem(i); - break; - } + pColorSet->SelectItem(i); + return true; } } + return false; } +void SvxColorWindow::SelectEntry(const NamedColor& rNamedColor) +{ + SetNoSelection(); + + const Color &rColor = rNamedColor.first; + + if (rColor == COL_TRANSPARENT || rColor == COL_AUTO) + { + mpButtonAutoColor->set_property("has-default", "true"); + return; + } + + if (mpButtonNoneColor->IsVisible() && rColor == COL_NONE_COLOR) + { + mpButtonNoneColor->set_property("has-default", "true"); + return; + } + + // try current palette + bool bFoundColor = SelectValueSetEntry(mpColorSet, rColor); + // try recently used + if (!bFoundColor) + bFoundColor = SelectValueSetEntry(mpRecentColorSet, rColor); + // if its not there, add it there now to the end of the recently used + // so its available somewhere handy, but not without trashing the + // whole recently used + if (!bFoundColor) + { + const OUString& rColorName = rNamedColor.second; + mrPaletteManager.AddRecentColor(rColor, rColorName, false); + mrPaletteManager.ReloadRecentColorSet(*mpRecentColorSet); + SelectValueSetEntry(mpRecentColorSet, rColor); + } +} + +void SvxColorWindow::SelectEntry(const Color& rColor) +{ + OUString sColorName = ("#" + rColor.AsRGBHexString().toAsciiUpperCase()); + SvxColorWindow::SelectEntry(std::make_pair(rColor, sColorName)); +} BorderColorStatus::BorderColorStatus() : maColor( COL_TRANSPARENT ), @@ -2717,19 +2833,18 @@ VclPtr<SfxPopupWindow> SvxColorToolBoxControl::CreatePopupWindow() &GetToolBox(), m_aColorSelectFunction); - pColorWin->StartPopupMode( &GetToolBox(), - FloatWinPopupFlags::AllowTearOff|FloatWinPopupFlags::NoAppFocusClose ); + pColorWin->StartPopupMode(&GetToolBox(), FloatWinPopupFlags::GrabFocus); pColorWin->StartSelection(); - SetPopupWindow( pColorWin ); + SetPopupWindow(pColorWin); if ( m_bSplitButton ) pColorWin->SetSelectedHdl( LINK( this, SvxColorToolBoxControl, SelectedHdl ) ); return pColorWin; } -IMPL_LINK(SvxColorToolBoxControl, SelectedHdl, const Color&, rColor, void) +IMPL_LINK(SvxColorToolBoxControl, SelectedHdl, const NamedColor&, rColor, void) { - m_xBtnUpdater->Update( rColor ); - m_aPaletteManager.SetLastColor( rColor ); + m_xBtnUpdater->Update(rColor.first); + m_aPaletteManager.SetLastColor(rColor.first); } void SvxColorToolBoxControl::statusChanged( const css::frame::FeatureStateEvent& rEvent ) @@ -3067,4 +3182,204 @@ void SvxCurrencyToolBoxControl::GetCurrencySymbols( std::vector<OUString>& rList } } +SvxListBoxColorWrapper::SvxListBoxColorWrapper(SvxColorListBox* pControl) + : mxControl(pControl) +{ +} + +void SvxListBoxColorWrapper::operator()(const OUString& /*rCommand*/, const NamedColor& rColor) +{ + mxControl->Selected(rColor); +} + +void SvxListBoxColorWrapper::dispose() +{ + mxControl.clear(); +} + +SvxColorListBox::SvxColorListBox(vcl::Window* pParent, WinBits nStyle) + : MenuButton(pParent, nStyle) + , m_aColorWrapper(this) + , m_aAutoDisplayColor(Application::GetSettings().GetStyleSettings().GetDialogColor()) + , m_nSlotId(0) + , m_bShowNoneButton(false) +{ + LockWidthRequest(); + m_aPaletteManager.SetColorSelectFunction(m_aColorWrapper); + SetActivateHdl(LINK(this, SvxColorListBox, MenuActivateHdl)); + SetNoSelection(); +} + +void SvxColorListBox::SetSlotId(sal_uInt16 nSlotId, bool bShowNoneButton) +{ + m_nSlotId = nSlotId; + m_bShowNoneButton = bShowNoneButton; + m_xColorWindow.disposeAndClear(); + createColorWindow(); +} + +//to avoid the box resizing every time the color is changed to +//the optimal size of the individual color, get the longest +//standard color and stick with that as the size for all +void SvxColorListBox::LockWidthRequest() +{ + if (get_width_request() != -1) + return; + NamedColor aLongestColor; + long nMaxStandardColorTextWidth = 0; + XColorListRef const xColorTable = XColorList::CreateStdColorList(); + for (sal_Int32 i = 0; i != xColorTable->Count(); ++i) + { + XColorEntry& rEntry = *xColorTable->GetColor(i); + long nColorTextWidth = GetTextWidth(rEntry.GetName()); + if (nColorTextWidth > nMaxStandardColorTextWidth) + { + nMaxStandardColorTextWidth = nColorTextWidth; + aLongestColor.second = rEntry.GetName(); + } + } + ShowPreview(aLongestColor); + set_width_request(get_preferred_size().Width()); +} + +void SvxColorListBox::ShowPreview(const NamedColor &rColor) +{ + 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); + if (m_bShowNoneButton && rColor.first == COL_NONE_COLOR) + xDevice->SetFillColor(COL_BLACK); + else if (rColor.first == COL_AUTO) + xDevice->SetFillColor(m_aAutoDisplayColor); + else + xDevice->SetFillColor(rColor.first); + xDevice->SetLineColor(rStyleSettings.GetDisableColor()); + xDevice->DrawRect(aRect); + + Bitmap aBitmap(xDevice->GetBitmap(Point(0, 0), xDevice->GetOutputSize())); + SetImageAlign(ImageAlign::Left); + SetModeImage(Image(aBitmap)); + SetText(rColor.second); +} + +IMPL_LINK(SvxColorListBox, MenuActivateHdl, MenuButton *, pBtn, void) +{ + (void)pBtn; + if (!m_xColorWindow || m_xColorWindow->isDisposed()) + createColorWindow(); +} + +void SvxColorListBox::createColorWindow() +{ + const SfxViewFrame* pViewFrame = SfxViewFrame::Current(); + const SfxFrame* pFrame = pViewFrame ? &pViewFrame->GetFrame() : nullptr; + css::uno::Reference<css::frame::XFrame> xFrame(pFrame ? pFrame->GetFrameInterface() : uno::Reference<css::frame::XFrame>()); + + m_xColorWindow = VclPtr<SvxColorWindow>::Create( + OUString() /*m_aCommandURL*/, + m_aPaletteManager, + m_aBorderColorStatus, + m_nSlotId, + xFrame, + this, + m_aColorWrapper); + if (m_bShowNoneButton) + m_xColorWindow->ShowNoneButton(); + m_xColorWindow->SelectEntry(m_aSelectedColor); + SetPopover(m_xColorWindow); +} + +void SvxColorListBox::Selected(const NamedColor& rColor) +{ + ShowPreview(rColor); + m_aPaletteManager.SetLastColor(rColor.first); + m_aSelectedColor = rColor; + if (m_aSelectedLink.IsSet()) + m_aSelectedLink.Call(*this); +} + +VCL_BUILDER_FACTORY(SvxColorListBox) + +SvxColorListBox::~SvxColorListBox() +{ + disposeOnce(); +} + +void SvxColorListBox::dispose() +{ + m_xColorWindow.disposeAndClear(); + m_aColorWrapper.dispose(); + MenuButton::dispose(); +} + +VclPtr<SvxColorWindow> SvxColorListBox::getColorWindow() const +{ + if (!m_xColorWindow || m_xColorWindow->isDisposed()) + const_cast<SvxColorListBox*>(this)->createColorWindow(); + return m_xColorWindow; +} + +void SvxColorListBox::SelectEntry(const NamedColor& rColor) +{ + if (rColor.second.trim().isEmpty()) + { + SelectEntry(rColor.first); + return; + } + VclPtr<SvxColorWindow> xColorWindow = getColorWindow(); + xColorWindow->SelectEntry(rColor); + m_aSelectedColor = xColorWindow->GetSelectEntryColor(); + ShowPreview(m_aSelectedColor); +} + +void SvxColorListBox::SelectEntry(const Color& rColor) +{ + VclPtr<SvxColorWindow> xColorWindow = getColorWindow(); + xColorWindow->SelectEntry(rColor); + m_aSelectedColor = xColorWindow->GetSelectEntryColor(); + ShowPreview(m_aSelectedColor); +} + +Color SvxColorListBox::GetSelectEntryColor() const +{ + return m_aSelectedColor.first; +} + +NamedColor SvxColorListBox::GetSelectEntry() const +{ + return m_aSelectedColor; +} + +SvxColorListBoxWrapper::SvxColorListBoxWrapper(SvxColorListBox& rListBox) + : sfx::SingleControlWrapper<SvxColorListBox, Color>(rListBox) +{ +} + +SvxColorListBoxWrapper::~SvxColorListBoxWrapper() +{ +} + +bool SvxColorListBoxWrapper::IsControlDontKnow() const +{ + return GetControl().IsNoSelection(); +} + +void SvxColorListBoxWrapper::SetControlDontKnow( bool bSet ) +{ + if( bSet ) GetControl().SetNoSelection(); +} + +Color SvxColorListBoxWrapper::GetControlValue() const +{ + return GetControl().GetSelectEntryColor(); +} + +void SvxColorListBoxWrapper::SetControlValue( Color aColor ) +{ + GetControl().SelectEntry( aColor ); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/tbxctrls/tbcontrl.src b/svx/source/tbxctrls/tbcontrl.src index 27aed7b4d400..194d6a8d5997 100644 --- a/svx/source/tbxctrls/tbcontrl.src +++ b/svx/source/tbxctrls/tbcontrl.src @@ -41,11 +41,16 @@ ImageList RID_SVXIL_FRAME IdCount = { 12 ; }; }; -String RID_SVXSTR_TRANSPARENT +String RID_SVXSTR_NOFILL { Text [ en-US ] = "No Fill" ; }; +String RID_SVXSTR_TRANSPARENT +{ + Text [ en-US ] = "Transparent"; +}; + String RID_SVXSTR_FILLPATTERN { Text [ en-US ] = "Pattern" ; @@ -135,6 +140,11 @@ String RID_SVXSTR_AUTOMATIC Text [ en-US ] = "Automatic"; }; +String RID_SVXSTR_BY_AUTHOR +{ + Text [ en-US ] = "By author"; +}; + String RID_SVXSTR_PAGES { Text [ en-US ] = "Pages"; diff --git a/svx/uiconfig/ui/colorwindow.ui b/svx/uiconfig/ui/colorwindow.ui index 9482562f83a6..444797ff9714 100644 --- a/svx/uiconfig/ui/colorwindow.ui +++ b/svx/uiconfig/ui/colorwindow.ui @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.18.3 --> +<!-- Generated with glade 3.20.0 --> <interface> <requires lib="gtk+" version="3.10"/> <requires lib="LibreOffice" version="1.0"/> @@ -13,9 +13,14 @@ <property name="can_focus">False</property> <property name="margin_right">6</property> <property name="xalign">0</property> - <property name="pixbuf">cmd/sc_colorsettings.png</property> + <property name="pixbuf">cmd/sc_square_unfilled.png</property> <property name="icon_size">1</property> </object> + <object class="GtkImage" id="none_icon"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="pixbuf">cmd/sc_square_unfilled.png</property> + </object> <object class="GtkWindow" id="palette_popup_window"> <property name="can_focus">False</property> <property name="hexpand">True</property> @@ -25,7 +30,6 @@ <property name="destroy_with_parent">True</property> <property name="type_hint">popup-menu</property> <property name="skip_pager_hint">True</property> - <property name="decorated">False</property> <property name="deletable">False</property> <child> <object class="GtkBox" id="box1"> @@ -33,13 +37,41 @@ <property name="can_focus">False</property> <property name="orientation">vertical</property> <child> - <object class="GtkButton" id="auto_color_button"> + <object class="GtkBox"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="image">auto_icon</property> - <property name="relief">none</property> - <property name="xalign">0</property> + <property name="can_focus">False</property> + <property name="spacing">6</property> + <property name="homogeneous">True</property> + <child> + <object class="GtkButton" id="auto_color_button"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="image">auto_icon</property> + <property name="relief">none</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkButton" id="none_color_button"> + <property name="label" translatable="yes">None</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="image">none_icon</property> + <property name="relief">none</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> </object> <packing> <property name="expand">False</property> diff --git a/svx/uiconfig/ui/docking3deffects.ui b/svx/uiconfig/ui/docking3deffects.ui index e3856ffbd3ca..b468ce2a076d 100644 --- a/svx/uiconfig/ui/docking3deffects.ui +++ b/svx/uiconfig/ui/docking3deffects.ui @@ -1089,7 +1089,7 @@ </packing> </child> <child> - <object class="svxlo-ColorLB" id="ambientcolor"> + <object class="svxcorelo-SvxColorListBox" id="ambientcolor"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="valign">center</property> @@ -1250,7 +1250,7 @@ <property name="can_focus">False</property> <property name="orientation">vertical</property> <child> - <object class="svxlo-ColorLB" id="lightcolor1"> + <object class="svxcorelo-SvxColorListBox" id="lightcolor1"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="valign">start</property> @@ -1263,7 +1263,7 @@ </packing> </child> <child> - <object class="svxlo-ColorLB" id="lightcolor2"> + <object class="svxcorelo-SvxColorListBox" id="lightcolor2"> <property name="can_focus">False</property> <property name="no_show_all">True</property> <property name="valign">start</property> @@ -1276,7 +1276,7 @@ </packing> </child> <child> - <object class="svxlo-ColorLB" id="lightcolor3"> + <object class="svxcorelo-SvxColorListBox" id="lightcolor3"> <property name="can_focus">False</property> <property name="no_show_all">True</property> <property name="valign">start</property> @@ -1289,7 +1289,7 @@ </packing> </child> <child> - <object class="svxlo-ColorLB" id="lightcolor4"> + <object class="svxcorelo-SvxColorListBox" id="lightcolor4"> <property name="can_focus">False</property> <property name="no_show_all">True</property> <property name="valign">start</property> @@ -1302,7 +1302,7 @@ </packing> </child> <child> - <object class="svxlo-ColorLB" id="lightcolor5"> + <object class="svxcorelo-SvxColorListBox" id="lightcolor5"> <property name="can_focus">False</property> <property name="no_show_all">True</property> <property name="valign">start</property> @@ -1315,7 +1315,7 @@ </packing> </child> <child> - <object class="svxlo-ColorLB" id="lightcolor6"> + <object class="svxcorelo-SvxColorListBox" id="lightcolor6"> <property name="can_focus">False</property> <property name="no_show_all">True</property> <property name="valign">start</property> @@ -1328,7 +1328,7 @@ </packing> </child> <child> - <object class="svxlo-ColorLB" id="lightcolor7"> + <object class="svxcorelo-SvxColorListBox" id="lightcolor7"> <property name="can_focus">False</property> <property name="no_show_all">True</property> <property name="valign">start</property> @@ -1341,7 +1341,7 @@ </packing> </child> <child> - <object class="svxlo-ColorLB" id="lightcolor8"> + <object class="svxcorelo-SvxColorListBox" id="lightcolor8"> <property name="can_focus">False</property> <property name="no_show_all">True</property> <property name="valign">start</property> @@ -1721,7 +1721,7 @@ </packing> </child> <child> - <object class="svxlo-ColorLB" id="objcolor"> + <object class="svxcorelo-SvxColorListBox" id="objcolor"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="valign">center</property> @@ -1733,7 +1733,7 @@ </packing> </child> <child> - <object class="svxlo-ColorLB" id="illumcolor"> + <object class="svxcorelo-SvxColorListBox" id="illumcolor"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="valign">center</property> @@ -1856,7 +1856,7 @@ </packing> </child> <child> - <object class="svxlo-ColorLB" id="speccolor"> + <object class="svxcorelo-SvxColorListBox" id="speccolor"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="valign">center</property> diff --git a/svx/uiconfig/ui/dockingcolorreplace.ui b/svx/uiconfig/ui/dockingcolorreplace.ui index 778c740f38bc..c74b4618e385 100644 --- a/svx/uiconfig/ui/dockingcolorreplace.ui +++ b/svx/uiconfig/ui/dockingcolorreplace.ui @@ -241,7 +241,7 @@ </packing> </child> <child> - <object class="svxlo-ColorLB" id="color1"> + <object class="svxcorelo-SvxColorListBox" id="color1"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="hexpand">True</property> @@ -257,7 +257,7 @@ </packing> </child> <child> - <object class="svxlo-ColorLB" id="color2"> + <object class="svxcorelo-SvxColorListBox" id="color2"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="hexpand">True</property> @@ -273,7 +273,7 @@ </packing> </child> <child> - <object class="svxlo-ColorLB" id="color3"> + <object class="svxcorelo-SvxColorListBox" id="color3"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="hexpand">True</property> @@ -289,7 +289,7 @@ </packing> </child> <child> - <object class="svxlo-ColorLB" id="color4"> + <object class="svxcorelo-SvxColorListBox" id="color4"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="hexpand">True</property> @@ -305,7 +305,7 @@ </packing> </child> <child> - <object class="svxlo-ColorLB" id="color5"> + <object class="svxcorelo-SvxColorListBox" id="color5"> <property name="visible">True</property> <property name="can_focus">False</property> </object> diff --git a/svx/uiconfig/ui/dockingfontwork.ui b/svx/uiconfig/ui/dockingfontwork.ui index 0c729be1b10e..32ab55392784 100644 --- a/svx/uiconfig/ui/dockingfontwork.ui +++ b/svx/uiconfig/ui/dockingfontwork.ui @@ -437,7 +437,7 @@ </packing> </child> <child> - <object class="svxlo-ColorLB" id="color"> + <object class="svxcorelo-SvxColorListBox" id="color"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="tooltip_text" translatable="yes">Shadow Color</property> diff --git a/svx/uiconfig/ui/sidebararea.ui b/svx/uiconfig/ui/sidebararea.ui index e85fe45dfa20..79bc5b65a520 100644 --- a/svx/uiconfig/ui/sidebararea.ui +++ b/svx/uiconfig/ui/sidebararea.ui @@ -100,7 +100,7 @@ </packing> </child> <child> - <object class="svxlo-ColorLB" id="fillgrad1"> + <object class="svxcorelo-SvxColorListBox" id="fillgrad1"> <property name="can_focus">False</property> <property name="has_tooltip">True</property> <property name="tooltip_text" translatable="yes">Fill gradient from.</property> @@ -144,7 +144,7 @@ </packing> </child> <child> - <object class="svxlo-ColorLB" id="fillgrad2"> + <object class="svxcorelo-SvxColorListBox" id="fillgrad2"> <property name="can_focus">False</property> <property name="has_tooltip">True</property> <property name="tooltip_text" translatable="yes">Fill gradient to.</property> diff --git a/svx/uiconfig/ui/sidebarshadow.ui b/svx/uiconfig/ui/sidebarshadow.ui index 0b2e8cf6d48b..31531ab823b1 100644 --- a/svx/uiconfig/ui/sidebarshadow.ui +++ b/svx/uiconfig/ui/sidebarshadow.ui @@ -184,7 +184,7 @@ </packing> </child> <child> - <object class="svxlo-ColorLB" id="LB_SHADOW_COLOR"> + <object class="svxcorelo-SvxColorListBox" id="LB_SHADOW_COLOR"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="halign">end</property> diff --git a/sw/inc/authratr.hxx b/sw/inc/authratr.hxx index 188da163ac90..85873104a7e6 100644 --- a/sw/inc/authratr.hxx +++ b/sw/inc/authratr.hxx @@ -24,8 +24,6 @@ #include <tools/color.hxx> #include "swdllapi.h" -#define COL_NONE_COLOR TRGB_COLORDATA( 0x80, 0xFF, 0xFF, 0xFF ) - class SW_DLLPUBLIC AuthorCharAttr { public: diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx index 0c7cb7dd2208..935495573295 100644 --- a/sw/source/core/access/accpara.cxx +++ b/sw/source/core/access/accpara.cxx @@ -88,6 +88,7 @@ #include <com/sun/star/text/TextMarkupType.hpp> #include <comphelper/servicehelper.hxx> #include <cppuhelper/supportsservice.hxx> +#include <svx/colorwindow.hxx> #include <reffld.hxx> #include <expfld.hxx> diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx index c599a6ed3e0f..e4c17d0ec431 100644 --- a/sw/source/ui/config/optpage.cxx +++ b/sw/source/ui/config/optpage.cxx @@ -1730,20 +1730,22 @@ SwRedlineOptionsTabPage::SwRedlineOptionsTabPage( vcl::Window* pParent, const SfxItemSet& rSet ) : SfxTabPage(pParent, "OptRedLinePage", "modules/swriter/ui/optredlinepage.ui" , &rSet) - , sNone(SW_RESSTR(SW_STR_NONE)) { Size aPreviewSize(getPreviewOptionsSize(this)); get(pInsertLB,"insert"); get(pInsertColorLB,"insertcolor"); + pInsertColorLB->SetSlotId(SID_AUTHOR_COLOR, true); get(pInsertedPreviewWN,"insertedpreview"); get(pDeletedLB,"deleted"); get(pDeletedColorLB,"deletedcolor"); + pDeletedColorLB->SetSlotId(SID_AUTHOR_COLOR, true); get(pDeletedPreviewWN,"deletedpreview"); get(pChangedLB,"changed"); get(pChangedColorLB,"changedcolor"); + pChangedColorLB->SetSlotId(SID_AUTHOR_COLOR, true); get(pChangedPreviewWN,"changedpreview"); get(pMarkPosLB,"markpos"); @@ -1760,8 +1762,6 @@ SwRedlineOptionsTabPage::SwRedlineOptionsTabPage( vcl::Window* pParent, pChangedPreviewWN->set_width_request(aPreviewSize.Width()); pMarkPreviewWN->set_width_request(aPreviewSize.Width()); - sAuthor = get<vcl::Window>("byauthor")->GetText(); - for (sal_Int32 i = 0; i < pInsertLB->GetEntryCount(); ++i) { const OUString sEntry(pInsertLB->GetEntry(i)); @@ -1781,14 +1781,13 @@ SwRedlineOptionsTabPage::SwRedlineOptionsTabPage( vcl::Window* pParent, pDeletedLB->SetSelectHdl( aLk ); pChangedLB->SetSelectHdl( aLk ); - aLk = LINK(this, SwRedlineOptionsTabPage, ColorHdl); - pInsertColorLB->SetSelectHdl( aLk ); - pDeletedColorLB->SetSelectHdl( aLk ); - pChangedColorLB->SetSelectHdl( aLk ); + Link<SvxColorListBox&,void> aLk2 = LINK(this, SwRedlineOptionsTabPage, ColorHdl); + pInsertColorLB->SetSelectHdl( aLk2 ); + pDeletedColorLB->SetSelectHdl( aLk2 ); + pChangedColorLB->SetSelectHdl( aLk2 ); - aLk = LINK(this, SwRedlineOptionsTabPage, ChangedMaskPrevHdl); - pMarkPosLB->SetSelectHdl( aLk ); - pMarkColorLB->SetSelectHdl( aLk ); + pMarkPosLB->SetSelectHdl(LINK(this, SwRedlineOptionsTabPage, ChangedMaskPrevHdl)); + pMarkColorLB->SetSelectHdl(LINK(this, SwRedlineOptionsTabPage, ChangedMaskColorPrevHdl)); } SwRedlineOptionsTabPage::~SwRedlineOptionsTabPage() @@ -1840,23 +1839,7 @@ bool SwRedlineOptionsTabPage::FillItemSet( SfxItemSet* ) pAttr = static_cast<CharAttr *>(pInsertLB->GetEntryData(nPos)); aInsertedAttr.nItemId = pAttr->nItemId; aInsertedAttr.nAttr = pAttr->nAttr; - - nPos = pInsertColorLB->GetSelectEntryPos(); - - switch (nPos) - { - case 0: - aInsertedAttr.nColor = COL_NONE_COLOR; - break; - case 1: - case LISTBOX_ENTRY_NOTFOUND: - aInsertedAttr.nColor = COL_TRANSPARENT; - break; - default: - aInsertedAttr.nColor = pInsertColorLB->GetEntryColor(nPos).GetColor(); - break; - } - + aInsertedAttr.nColor = pInsertColorLB->GetSelectEntryColor().GetColor(); pOpt->SetInsertAuthorAttr(aInsertedAttr); } @@ -1866,23 +1849,7 @@ bool SwRedlineOptionsTabPage::FillItemSet( SfxItemSet* ) pAttr = static_cast<CharAttr *>(pDeletedLB->GetEntryData(nPos)); aDeletedAttr.nItemId = pAttr->nItemId; aDeletedAttr.nAttr = pAttr->nAttr; - - nPos = pDeletedColorLB->GetSelectEntryPos(); - - switch (nPos) - { - case 0: - aDeletedAttr.nColor = COL_NONE_COLOR; - break; - case 1: - case LISTBOX_ENTRY_NOTFOUND: - aDeletedAttr.nColor = COL_TRANSPARENT; - break; - default: - aDeletedAttr.nColor = pDeletedColorLB->GetEntryColor(nPos).GetColor(); - break; - } - + aDeletedAttr.nColor = pDeletedColorLB->GetSelectEntryColor().GetColor(); pOpt->SetDeletedAuthorAttr(aDeletedAttr); } @@ -1892,23 +1859,7 @@ bool SwRedlineOptionsTabPage::FillItemSet( SfxItemSet* ) pAttr = static_cast<CharAttr *>(pChangedLB->GetEntryData(nPos)); aChangedAttr.nItemId = pAttr->nItemId; aChangedAttr.nAttr = pAttr->nAttr; - - nPos = pChangedColorLB->GetSelectEntryPos(); - - switch (nPos) - { - case 0: - aChangedAttr.nColor = COL_NONE_COLOR; - break; - case 1: - case LISTBOX_ENTRY_NOTFOUND: - aChangedAttr.nColor = COL_TRANSPARENT; - break; - default: - aChangedAttr.nColor = pChangedColorLB->GetEntryColor(nPos).GetColor(); - break; - } - + aChangedAttr.nColor = pChangedColorLB->GetSelectEntryColor().GetColor(); pOpt->SetFormatAuthorAttr(aChangedAttr); } @@ -1957,77 +1908,14 @@ void SwRedlineOptionsTabPage::Reset( const SfxItemSet* ) InitFontStyle(*pDeletedPreviewWN); InitFontStyle(*pChangedPreviewWN); - // initialise colour list box - pInsertColorLB->SetUpdateMode(false); - pDeletedColorLB->SetUpdateMode(false); - pChangedColorLB->SetUpdateMode(false); - pMarkColorLB->SetUpdateMode(false); - pInsertColorLB->InsertEntry(sNone); - pDeletedColorLB->InsertEntry(sNone); - pChangedColorLB->InsertEntry(sNone); - - pInsertColorLB->InsertEntry(sAuthor); - pDeletedColorLB->InsertEntry(sAuthor); - pChangedColorLB->InsertEntry(sAuthor); - - XColorListRef pColorLst = XColorList::GetStdColorList(); - for( long i = 0; i < pColorLst->Count(); ++i ) - { - const XColorEntry* pEntry = pColorLst->GetColor(i); - Color aColor = pEntry->GetColor(); - const OUString sName = pEntry->GetName(); - - pInsertColorLB->InsertEntry( aColor, sName ); - pDeletedColorLB->InsertEntry( aColor, sName ); - pChangedColorLB->InsertEntry( aColor, sName ); - pMarkColorLB->InsertEntry( aColor, sName ); - } - pInsertColorLB->SetUpdateMode( true ); - pDeletedColorLB->SetUpdateMode( true ); - pChangedColorLB->SetUpdateMode( true ); - pMarkColorLB->SetUpdateMode( true ); - ColorData nColor = rInsertAttr.nColor; - - switch (nColor) - { - case COL_TRANSPARENT: - pInsertColorLB->SelectEntryPos(1); - break; - case COL_NONE_COLOR: - pInsertColorLB->SelectEntryPos(0); - break; - default: - pInsertColorLB->SelectEntry(Color(nColor)); - } + pInsertColorLB->SelectEntry(Color(nColor)); nColor = rDeletedAttr.nColor; - - switch (nColor) - { - case COL_TRANSPARENT: - pDeletedColorLB->SelectEntryPos(1); - break; - case COL_NONE_COLOR: - pDeletedColorLB->SelectEntryPos(0); - break; - default: - pDeletedColorLB->SelectEntry(Color(nColor)); - } + pDeletedColorLB->SelectEntry(Color(nColor)); nColor = rChangedAttr.nColor; - - switch (nColor) - { - case COL_TRANSPARENT: - pChangedColorLB->SelectEntryPos(1); - break; - case COL_NONE_COLOR: - pChangedColorLB->SelectEntryPos(0); - break; - default: - pChangedColorLB->SelectEntry(Color(nColor)); - } + pChangedColorLB->SelectEntry(Color(nColor)); pMarkColorLB->SelectEntry(pOpt->GetMarkAlignColor()); @@ -2058,13 +1946,13 @@ void SwRedlineOptionsTabPage::Reset( const SfxItemSet* ) AttribHdl(*pChangedLB); ColorHdl(*pChangedColorLB); - ChangedMaskPrevHdl(*pMarkPosLB); + ChangedMaskPrev(); } IMPL_LINK( SwRedlineOptionsTabPage, AttribHdl, ListBox&, rLB, void ) { SvxFontPrevWindow *pPrev = nullptr; - ColorListBox *pColorLB; + SvxColorListBox *pColorLB; if (&rLB == pInsertLB) { @@ -2096,26 +1984,25 @@ IMPL_LINK( SwRedlineOptionsTabPage, AttribHdl, ListBox&, rLB, void ) rFont.SetCaseMap(SVX_CASEMAP_NOT_MAPPED); rCJKFont.SetCaseMap(SVX_CASEMAP_NOT_MAPPED); - sal_Int32 nPos = pColorLB->GetSelectEntryPos(); + Color aColor = pColorLB->GetSelectEntryColor(); - switch( nPos ) + if (aColor == COL_NONE_COLOR) { - case 0: - rFont.SetColor( Color( COL_BLACK ) ); - rCJKFont.SetColor( Color( COL_BLACK ) ); - break; - case 1: - case LISTBOX_ENTRY_NOTFOUND: - rFont.SetColor( Color( COL_RED ) ); - rCJKFont.SetColor( Color( COL_RED ) ); - break; - default: - rFont.SetColor( pColorLB->GetEntryColor( nPos ) ); - rCJKFont.SetColor( pColorLB->GetEntryColor( nPos ) ); - break; + rFont.SetColor( Color( COL_BLACK ) ); + rCJKFont.SetColor( Color( COL_BLACK ) ); + } + else if (aColor == COL_TRANSPARENT) + { + rFont.SetColor( Color( COL_RED ) ); + rCJKFont.SetColor( Color( COL_RED ) ); + } + else + { + rFont.SetColor(aColor); + rCJKFont.SetColor(aColor); } - nPos = rLB.GetSelectEntryPos(); + sal_Int32 nPos = rLB.GetSelectEntryPos(); if( nPos == LISTBOX_ENTRY_NOTFOUND ) nPos = 0; @@ -2151,12 +2038,11 @@ IMPL_LINK( SwRedlineOptionsTabPage, AttribHdl, ListBox&, rLB, void ) case SID_ATTR_BRUSH: { - nPos = pColorLB->GetSelectEntryPos(); - if( nPos ) - pPrev->SetColor( pColorLB->GetSelectEntryColor() ); + Color aBgColor = pColorLB->GetSelectEntryColor(); + if (aBgColor != COL_NONE_COLOR) + pPrev->SetColor(aBgColor); else - pPrev->SetColor( Color( COL_LIGHTGRAY ) ); - + pPrev->SetColor(Color(COL_LIGHTGRAY)); rFont.SetColor( Color( COL_BLACK ) ); rCJKFont.SetColor( Color( COL_BLACK ) ); } @@ -2166,9 +2052,9 @@ IMPL_LINK( SwRedlineOptionsTabPage, AttribHdl, ListBox&, rLB, void ) pPrev->Invalidate(); } -IMPL_LINK( SwRedlineOptionsTabPage, ColorHdl, ListBox&, rListBox, void ) +IMPL_LINK( SwRedlineOptionsTabPage, ColorHdl, SvxColorListBox&, rListBox, void ) { - ColorListBox* pColorLB = static_cast<ColorListBox*>(&rListBox); + SvxColorListBox* pColorLB = &rListBox; SvxFontPrevWindow *pPrev = nullptr; ListBox* pLB; @@ -2200,38 +2086,38 @@ IMPL_LINK( SwRedlineOptionsTabPage, ColorHdl, ListBox&, rListBox, void ) { rFont.SetColor( Color( COL_BLACK ) ); rCJKFont.SetColor( Color( COL_BLACK ) ); - nPos = pColorLB->GetSelectEntryPos(); - if( nPos && nPos != LISTBOX_ENTRY_NOTFOUND ) - pPrev->SetColor( pColorLB->GetSelectEntryColor() ); + + Color aBgColor = pColorLB->GetSelectEntryColor(); + if (aBgColor != COL_NONE_COLOR) + pPrev->SetColor(aBgColor); else - pPrev->SetColor( Color( COL_LIGHTGRAY ) ); + pPrev->SetColor(Color(COL_LIGHTGRAY)); } else { - nPos = pColorLB->GetSelectEntryPos(); + Color aColor = pColorLB->GetSelectEntryColor(); - switch( nPos ) + if (aColor == COL_NONE_COLOR) { - case 0: - rFont.SetColor( Color( COL_BLACK ) ); - rCJKFont.SetColor( Color( COL_BLACK ) ); - break; - case 1: - case LISTBOX_ENTRY_NOTFOUND: - rFont.SetColor( Color( COL_RED ) ); - rCJKFont.SetColor( Color( COL_RED ) ); - break; - default: - rFont.SetColor( pColorLB->GetEntryColor( nPos ) ); - rCJKFont.SetColor( pColorLB->GetEntryColor( nPos ) ); - break; + rFont.SetColor( Color( COL_BLACK ) ); + rCJKFont.SetColor( Color( COL_BLACK ) ); + } + else if (aColor == COL_TRANSPARENT) + { + rFont.SetColor( Color( COL_RED ) ); + rCJKFont.SetColor( Color( COL_RED ) ); + } + else + { + rFont.SetColor(aColor); + rCJKFont.SetColor(aColor); } } pPrev->Invalidate(); } -IMPL_LINK_NOARG(SwRedlineOptionsTabPage, ChangedMaskPrevHdl, ListBox&, void) +void SwRedlineOptionsTabPage::ChangedMaskPrev() { pMarkPreviewWN->SetMarkPos(pMarkPosLB->GetSelectEntryPos()); pMarkPreviewWN->SetColor(pMarkColorLB->GetSelectEntryColor().GetColor()); @@ -2239,6 +2125,16 @@ IMPL_LINK_NOARG(SwRedlineOptionsTabPage, ChangedMaskPrevHdl, ListBox&, void) pMarkPreviewWN->Invalidate(); } +IMPL_LINK_NOARG(SwRedlineOptionsTabPage, ChangedMaskPrevHdl, ListBox&, void) +{ + ChangedMaskPrev(); +} + +IMPL_LINK_NOARG(SwRedlineOptionsTabPage, ChangedMaskColorPrevHdl, SvxColorListBox&, void) +{ + ChangedMaskPrev(); +} + void SwRedlineOptionsTabPage::InitFontStyle(SvxFontPrevWindow& rExampleWin) { const AllSettings& rAllSettings = Application::GetSettings(); diff --git a/sw/source/ui/frmdlg/column.cxx b/sw/source/ui/frmdlg/column.cxx index f3d5931111e0..6d038be747f1 100644 --- a/sw/source/ui/frmdlg/column.cxx +++ b/sw/source/ui/frmdlg/column.cxx @@ -25,6 +25,7 @@ #include <svx/dialogs.hrc> #include <svx/dialmgr.hxx> #include <sfx2/htmlmode.hxx> +#include <svx/colorbox.hxx> #include <svx/xtable.hxx> #include <svx/drawitem.hxx> #include <editeng/borderline.hxx> @@ -497,12 +498,11 @@ SwColumnPage::SwColumnPage(vcl::Window *pParent, const SfxItemSet &rSet) m_pAutoWidthBox->SetClickHdl(LINK(this, SwColumnPage, AutoWidthHdl)); aLk = LINK( this, SwColumnPage, UpdateColMgr ); - Link<ListBox&,void> aLk2 = LINK( this, SwColumnPage, UpdateColMgrListBox ); - m_pLineTypeDLB->SetSelectHdl( aLk2 ); + m_pLineTypeDLB->SetSelectHdl(LINK(this, SwColumnPage, UpdateColMgrListBox)); m_pLineWidthEdit->SetModifyHdl( aLk ); - m_pLineColorDLB->SetSelectHdl( aLk2 ); + m_pLineColorDLB->SetSelectHdl(LINK( this, SwColumnPage, UpdateColMgrColorBox)); m_pLineHeightEdit->SetModifyHdl( aLk ); - m_pLinePosDLB->SetSelectHdl( aLk2 ); + m_pLinePosDLB->SetSelectHdl(LINK(this, SwColumnPage, UpdateColMgrListBox)); // Separator line m_pLineTypeDLB->SetUnit( FUNIT_POINT ); @@ -525,29 +525,7 @@ SwColumnPage::SwColumnPage(vcl::Window *pParent, const SfxItemSet &rSet) m_pLineWidthEdit->GetDecimalDigits( ), m_pLineWidthEdit->GetUnit(), MapUnit::MapTwip )); m_pLineTypeDLB->SetWidth( nLineWidth ); - - // Fill the color listbox - SfxObjectShell* pDocSh = SfxObjectShell::Current(); - XColorListRef pColorList; - if ( pDocSh ) - { - const SfxPoolItem* pItem = pDocSh->GetItem( SID_COLOR_TABLE ); - if ( pItem != nullptr ) - pColorList = static_cast<const SvxColorListItem*>(pItem)->GetColorList(); - } - - if ( pColorList.is() ) - { - m_pLineColorDLB->SetUpdateMode( false ); - - for (long i = 0; i < pColorList->Count(); ++i ) - { - const XColorEntry* pEntry = pColorList->GetColor(i); - m_pLineColorDLB->InsertEntry( pEntry->GetColor(), pEntry->GetName() ); - } - m_pLineColorDLB->SetUpdateMode( true ); - } - m_pLineColorDLB->SelectEntryPos( 0 ); + m_pLineColorDLB->SelectEntry(COL_BLACK); } SwColumnPage::~SwColumnPage() @@ -701,10 +679,18 @@ IMPL_LINK_NOARG( SwColumnPage, UpdateColMgrListBox, ListBox&, void ) { UpdateColMgr(*m_pLineWidthEdit); } + +IMPL_LINK_NOARG( SwColumnPage, UpdateColMgrColorBox, SvxColorListBox&, void ) +{ + UpdateColMgr(*m_pLineWidthEdit); +} + IMPL_LINK_NOARG( SwColumnPage, UpdateColMgr, Edit&, void ) { + if (!m_pColMgr) + return; long nGutterWidth = m_pColMgr->GetGutterWidth(); - if(m_nCols > 1) + if (m_nCols > 1) { // Determine whether the most narrow column is too narrow // for the adjusted column gap diff --git a/sw/source/ui/misc/pgfnote.cxx b/sw/source/ui/misc/pgfnote.cxx index 43a51888edf1..691105f269ad 100644 --- a/sw/source/ui/misc/pgfnote.cxx +++ b/sw/source/ui/misc/pgfnote.cxx @@ -93,9 +93,9 @@ IMPL_LINK_NOARG(SwFootNotePage, LineWidthChanged_Impl, Edit&, void) m_pLineTypeBox->SetWidth( nVal ); } -IMPL_LINK_NOARG(SwFootNotePage, LineColorSelected_Impl, ListBox&, void) +IMPL_LINK(SwFootNotePage, LineColorSelected_Impl, SvxColorListBox&, rColorBox, void) { - m_pLineTypeBox->SetColor( m_pLineColorBox->GetSelectEntryColor() ); + m_pLineTypeBox->SetColor(rColorBox.GetSelectEntryColor()); } SwFootNotePage::SwFootNotePage(vcl::Window *pParent, const SfxItemSet &rSet) @@ -211,41 +211,9 @@ void SwFootNotePage::Reset(const SfxItemSet *rSet) m_pLineTypeBox->SelectEntry( pFootnoteInfo->GetLineStyle() ); // Separator Color - SfxObjectShell* pDocSh = SfxObjectShell::Current(); - XColorListRef pColorList; - - OSL_ENSURE( pDocSh, "DocShell not found!" ); - - if ( pDocSh ) - { - const SfxPoolItem* pColorItem = pDocSh->GetItem( SID_COLOR_TABLE ); - if ( pColorItem != nullptr ) - pColorList = static_cast<const SvxColorListItem*>(pColorItem)->GetColorList(); - } - - OSL_ENSURE( pColorList.is(), "ColorTable not found!" ); - - if ( pColorList.is() ) - { - m_pLineColorBox->SetUpdateMode( false ); - - for ( long i = 0; i < pColorList->Count(); ++i ) - { - const XColorEntry* pEntry = pColorList->GetColor(i); - m_pLineColorBox->InsertEntry( pEntry->GetColor(), pEntry->GetName() ); - } - m_pLineColorBox->SetUpdateMode( true ); - } - - // select color in the list or add it as a user color - sal_Int32 nSelPos = m_pLineColorBox->GetEntryPos( pFootnoteInfo->GetLineColor() ); - if( nSelPos == LISTBOX_ENTRY_NOTFOUND ) - nSelPos = m_pLineColorBox->InsertEntry( pFootnoteInfo->GetLineColor(), - SVX_RESSTR(RID_SVXSTR_COLOR_USER) ); - - m_pLineColorBox->SetSelectHdl( LINK( this, SwFootNotePage, LineColorSelected_Impl ) ); - m_pLineColorBox->SelectEntryPos( nSelPos ); - m_pLineTypeBox->SetColor( pFootnoteInfo->GetLineColor() ); + m_pLineColorBox->SelectEntry(pFootnoteInfo->GetLineColor()); + m_pLineColorBox->SetSelectHdl(LINK(this, SwFootNotePage, LineColorSelected_Impl)); + m_pLineTypeBox->SetColor(pFootnoteInfo->GetLineColor()); // position m_pLinePosBox->SelectEntryPos( static_cast< sal_Int32 >(pFootnoteInfo->GetAdj()) ); diff --git a/sw/source/ui/misc/pggrid.cxx b/sw/source/ui/misc/pggrid.cxx index 583e2c2332dc..e622569496ca 100644 --- a/sw/source/ui/misc/pggrid.cxx +++ b/sw/source/ui/misc/pggrid.cxx @@ -23,6 +23,7 @@ #include <hintids.hxx> #include <swtypes.hxx> #include <globals.hrc> +#include <svx/colorbox.hxx> #include <svx/xtable.hxx> #include <uitool.hxx> #include <editeng/sizeitem.hxx> @@ -102,23 +103,12 @@ SwTextGridPage::SwTextGridPage(vcl::Window *pParent, const SfxItemSet &rSet) : m_pLinesGridRB->SetClickHdl(aGridTypeHdl); m_pCharsGridRB->SetClickHdl(aGridTypeHdl); - m_pColorLB->SetSelectHdl(LINK(this, SwTextGridPage, GridModifyHdl)); + m_pColorLB->SetSelectHdl(LINK(this, SwTextGridPage, ColorModifyHdl)); m_pPrintCB->SetClickHdl(LINK(this, SwTextGridPage, GridModifyClickHdl)); m_pRubyBelowCB->SetClickHdl(LINK(this, SwTextGridPage, GridModifyClickHdl)); m_pDisplayCB->SetClickHdl(LINK(this, SwTextGridPage, DisplayGridHdl)); - XColorListRef pColorLst = XColorList::GetStdColorList(); - m_pColorLB->InsertAutomaticEntryColor( Color( COL_AUTO ) ); - const long nCount = pColorLst->Count(); - for( long i = 0; i < nCount; ++i ) - { - const XColorEntry* pEntry = pColorLst->GetColor(i); - Color aColor = pEntry->GetColor(); - OUString sName = pEntry->GetName(); - m_pColorLB->InsertEntry( aColor, sName ); - } - m_pColorLB->SetUpdateMode( true ); //Get the default paper mode SwView *pView = ::GetActiveView(); if( pView ) @@ -434,7 +424,7 @@ IMPL_LINK(SwTextGridPage, CharorLineChangedHdl, SpinField&, rField, void) SetLinesOrCharsRanges( *m_pCharsRangeFT , m_pCharsPerLineNF->GetMax() ); } } - GridModifyHdl(*m_pColorLB); + GridModifyHdl(); } IMPL_LINK(SwTextGridPage, TextSizeLoseFocusHdl, Control&, rControl, void) @@ -489,7 +479,7 @@ IMPL_LINK(SwTextGridPage, TextSizeChangedHdl, SpinField&, rField, void) } //rubySize is disabled } - GridModifyHdl(*m_pColorLB); + GridModifyHdl(); } IMPL_LINK(SwTextGridPage, GridTypeHdl, Button*, pButton, void) @@ -515,7 +505,7 @@ IMPL_LINK(SwTextGridPage, GridTypeHdl, Button*, pButton, void) m_pCharWidthMF->Enable(false); } - GridModifyHdl(*m_pColorLB); + GridModifyHdl(); } IMPL_LINK_NOARG(SwTextGridPage, DisplayGridHdl, Button*, void) @@ -527,9 +517,15 @@ IMPL_LINK_NOARG(SwTextGridPage, DisplayGridHdl, Button*, void) IMPL_LINK_NOARG(SwTextGridPage, GridModifyClickHdl, Button*, void) { - GridModifyHdl(*m_pColorLB); + GridModifyHdl(); +} + +IMPL_LINK_NOARG(SwTextGridPage, ColorModifyHdl, SvxColorListBox&, void) +{ + GridModifyHdl(); } -IMPL_LINK_NOARG(SwTextGridPage, GridModifyHdl, ListBox&, void) + +void SwTextGridPage::GridModifyHdl() { const SfxItemSet& rOldSet = GetItemSet(); SfxItemSet aSet(rOldSet); diff --git a/sw/source/uibase/app/swmodul1.cxx b/sw/source/uibase/app/swmodul1.cxx index 6d0030bee543..d3e4374ec5b5 100644 --- a/sw/source/uibase/app/swmodul1.cxx +++ b/sw/source/uibase/app/swmodul1.cxx @@ -28,6 +28,7 @@ #include <cppuhelper/weak.hxx> #include <com/sun/star/frame/FrameSearchFlag.hpp> #include <com/sun/star/view/XSelectionSupplier.hpp> +#include <svx/colorwindow.hxx> #include <svx/dataaccessdescriptor.hxx> #include <editeng/wghtitem.hxx> #include <editeng/postitem.hxx> diff --git a/sw/source/uibase/inc/column.hxx b/sw/source/uibase/inc/column.hxx index bbaaef6cad08..d52d9a7cbbbd 100644 --- a/sw/source/uibase/inc/column.hxx +++ b/sw/source/uibase/inc/column.hxx @@ -31,6 +31,7 @@ #include <svtools/valueset.hxx> #include <sfx2/basedlgs.hxx> #include <sfx2/tabdlg.hxx> +#include <svx/colorbox.hxx> #include <fmtclbl.hxx> #include <colex.hxx> #include <prcntfld.hxx> @@ -105,7 +106,7 @@ class SwColumnPage : public SfxTabPage VclPtr<FixedText> m_pLineWidthLbl; VclPtr<MetricField> m_pLineWidthEdit; VclPtr<FixedText> m_pLineColorLbl; - VclPtr<ColorListBox> m_pLineColorDLB; + VclPtr<SvxColorListBox> m_pLineColorDLB; VclPtr<FixedText> m_pLineHeightLbl; VclPtr<MetricField> m_pLineHeightEdit; VclPtr<FixedText> m_pLinePosLbl; @@ -146,6 +147,7 @@ class SwColumnPage : public SfxTabPage DECL_LINK( Down, Button *, void ); DECL_LINK( UpdateColMgr, Edit&, void ); DECL_LINK( UpdateColMgrListBox, ListBox&, void ); + DECL_LINK( UpdateColMgrColorBox, SvxColorListBox&, void ); void Timeout(); void Update(MetricField *pInteractiveField); diff --git a/sw/source/uibase/inc/optpage.hxx b/sw/source/uibase/inc/optpage.hxx index 5f768e2d27a5..cfc6bf16ecbd 100644 --- a/sw/source/uibase/inc/optpage.hxx +++ b/sw/source/uibase/inc/optpage.hxx @@ -30,6 +30,7 @@ #include <vcl/fixed.hxx> #include <svtools/ctrlbox.hxx> +#include <svx/colorbox.hxx> #include <svx/fntctrl.hxx> #include <fontcfg.hxx> class SfxPrinter; @@ -312,27 +313,26 @@ public: class SwRedlineOptionsTabPage : public SfxTabPage { VclPtr<ListBox> pInsertLB; - VclPtr<ColorListBox> pInsertColorLB; + VclPtr<SvxColorListBox> pInsertColorLB; VclPtr<SvxFontPrevWindow> pInsertedPreviewWN; VclPtr<ListBox> pDeletedLB; - VclPtr<ColorListBox> pDeletedColorLB; + VclPtr<SvxColorListBox> pDeletedColorLB; VclPtr<SvxFontPrevWindow> pDeletedPreviewWN; VclPtr<ListBox> pChangedLB; - VclPtr<ColorListBox> pChangedColorLB; + VclPtr<SvxColorListBox> pChangedColorLB; VclPtr<SvxFontPrevWindow> pChangedPreviewWN; VclPtr<ListBox> pMarkPosLB; - VclPtr<ColorListBox> pMarkColorLB; + VclPtr<SvxColorListBox> pMarkColorLB; VclPtr<SwMarkPreview> pMarkPreviewWN; - OUString sAuthor; - OUString sNone; - DECL_LINK(AttribHdl, ListBox&, void); + void ChangedMaskPrev(); DECL_LINK(ChangedMaskPrevHdl, ListBox&, void); - DECL_LINK(ColorHdl, ListBox&, void); + DECL_LINK(ChangedMaskColorPrevHdl, SvxColorListBox&, void); + DECL_LINK(ColorHdl, SvxColorListBox&, void); static void InitFontStyle(SvxFontPrevWindow& rExampleWin); diff --git a/sw/source/uibase/inc/pgfnote.hxx b/sw/source/uibase/inc/pgfnote.hxx index 4ca6e8d8edc1..81a69ab2bc90 100644 --- a/sw/source/uibase/inc/pgfnote.hxx +++ b/sw/source/uibase/inc/pgfnote.hxx @@ -27,6 +27,7 @@ #include <vcl/group.hxx> #include <svtools/ctrlbox.hxx> +#include <svx/colorbox.hxx> // footnote settings TabPage class SwFootNotePage: public SfxTabPage @@ -53,7 +54,7 @@ private: VclPtr<ListBox> m_pLinePosBox; VclPtr<LineListBox> m_pLineTypeBox; VclPtr<MetricField> m_pLineWidthEdit; - VclPtr<ColorListBox> m_pLineColorBox; + VclPtr<SvxColorListBox> m_pLineColorBox; VclPtr<MetricField> m_pLineLengthEdit; VclPtr<MetricField> m_pLineDistEdit; @@ -61,7 +62,7 @@ private: DECL_LINK( HeightMetric, Button*, void ); DECL_LINK( HeightModify, Control&, void ); DECL_LINK( LineWidthChanged_Impl, Edit&, void ); - DECL_LINK( LineColorSelected_Impl, ListBox&, void ); + DECL_LINK( LineColorSelected_Impl, SvxColorListBox&, void ); long lMaxHeight; diff --git a/sw/source/uibase/inc/pggrid.hxx b/sw/source/uibase/inc/pggrid.hxx index be73daec9483..ab560a6baa31 100644 --- a/sw/source/uibase/inc/pggrid.hxx +++ b/sw/source/uibase/inc/pggrid.hxx @@ -24,6 +24,7 @@ #include <vcl/field.hxx> #include <vcl/fixed.hxx> #include <svtools/ctrlbox.hxx> +#include <svx/colorbox.hxx> // TabPage Format/(Styles/)Page/Text grid class SwTextGridPage: public SfxTabPage @@ -57,7 +58,7 @@ class SwTextGridPage: public SfxTabPage VclPtr<CheckBox> m_pDisplayCB; VclPtr<CheckBox> m_pPrintCB; - VclPtr<ColorListBox> m_pColorLB; + VclPtr<SvxColorListBox> m_pColorLB; sal_Int32 m_nRubyUserValue; bool m_bRubyUserValue; @@ -71,12 +72,14 @@ class SwTextGridPage: public SfxTabPage void PutGridItem(SfxItemSet& rSet); static void SetLinesOrCharsRanges(FixedText & rField, const sal_Int32 nValue ); + void GridModifyHdl(); + DECL_LINK(GridTypeHdl, Button*, void); DECL_LINK(CharorLineChangedHdl, SpinField&, void); DECL_LINK(CharorLineLoseFocusdHdl, Control&, void); DECL_LINK(TextSizeChangedHdl, SpinField&, void); DECL_LINK(TextSizeLoseFocusHdl, Control&, void); - DECL_LINK(GridModifyHdl, ListBox&, void); + DECL_LINK(ColorModifyHdl, SvxColorListBox&, void); DECL_LINK(GridModifyClickHdl, Button*, void); DECL_LINK(DisplayGridHdl, Button*, void); diff --git a/sw/source/uibase/shells/drawsh.cxx b/sw/source/uibase/shells/drawsh.cxx index a0b3b3504613..d9aad7fb1c7a 100644 --- a/sw/source/uibase/shells/drawsh.cxx +++ b/sw/source/uibase/shells/drawsh.cxx @@ -579,16 +579,6 @@ void SwDrawShell::GetFormTextState(SfxItemSet& rSet) SdrView* pDrView = rSh.GetDrawView(); const SdrMarkList& rMarkList = pDrView->GetMarkedObjectList(); const SdrObject* pObj = nullptr; - SvxFontWorkDialog* pDlg = nullptr; - - const sal_uInt16 nId = SvxFontWorkChildWindow::GetChildWindowId(); - - SfxViewFrame* pVFrame = GetView().GetViewFrame(); - if ( pVFrame->HasChildWindow(nId) ) - { - SfxChildWindow *pChildWindow = pVFrame->GetChildWindow(nId); - pDlg = pChildWindow ? static_cast<SvxFontWorkDialog*>(pChildWindow->GetWindow()) : nullptr; - } if ( rMarkList.GetMarkCount() == 1 ) pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); @@ -616,9 +606,6 @@ void SwDrawShell::GetFormTextState(SfxItemSet& rSet) } else { - if ( pDlg ) - pDlg->SetColorList(XColorList::GetStdColorList()); - pDrView->GetAttributes( rSet ); } } diff --git a/sw/source/uibase/shells/drwtxtsh.cxx b/sw/source/uibase/shells/drwtxtsh.cxx index c159843cb73c..2dde2604376f 100644 --- a/sw/source/uibase/shells/drwtxtsh.cxx +++ b/sw/source/uibase/shells/drwtxtsh.cxx @@ -239,16 +239,6 @@ void SwDrawTextShell::GetFormTextState(SfxItemSet& rSet) SdrView* pDrView = rSh.GetDrawView(); const SdrMarkList& rMarkList = pDrView->GetMarkedObjectList(); const SdrObject* pObj = nullptr; - SvxFontWorkDialog* pDlg = nullptr; - - const sal_uInt16 nId = SvxFontWorkChildWindow::GetChildWindowId(); - - SfxViewFrame* pVFrame = GetView().GetViewFrame(); - if (pVFrame->HasChildWindow(nId)) - { - SfxChildWindow* pWnd = pVFrame->GetChildWindow(nId); - pDlg = pWnd ? static_cast<SvxFontWorkDialog*>(pWnd->GetWindow()) : nullptr; - } if ( rMarkList.GetMarkCount() == 1 ) pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); @@ -276,9 +266,6 @@ void SwDrawTextShell::GetFormTextState(SfxItemSet& rSet) } else { - if ( pDlg ) - pDlg->SetColorList(XColorList::GetStdColorList()); - pDrView->GetAttributes( rSet ); } } diff --git a/sw/source/uibase/sidebar/PageStylesPanel.cxx b/sw/source/uibase/sidebar/PageStylesPanel.cxx index 95985af7ed5a..cde9ae9b5612 100644 --- a/sw/source/uibase/sidebar/PageStylesPanel.cxx +++ b/sw/source/uibase/sidebar/PageStylesPanel.cxx @@ -22,6 +22,7 @@ #include <editeng/sizeitem.hxx> #include <editeng/paperinf.hxx> #include <svx/svxids.hrc> +#include <svx/colorbox.hxx> #include <svx/dlgutil.hxx> #include <svx/rulritem.hxx> #include "svx/drawitem.hxx" @@ -142,22 +143,20 @@ void PageStylesPanel::dispose() void PageStylesPanel::Initialize() { aCustomEntry = mpCustomEntry->GetText(); - mpColumnCount->SetSelectHdl( LINK(this, PageStylesPanel, ModifyColumnCountHdl) ); + mpBindings->Invalidate(SID_ATTR_PAGE_COLUMN); + mpBindings->Invalidate(SID_ATTR_PAGE); + mpBindings->Invalidate(SID_ATTR_PAGE_FILLSTYLE); + Update(); + mpColumnCount->SetSelectHdl( LINK(this, PageStylesPanel, ModifyColumnCountHdl) ); SvxNumOptionsTabPageHelper::GetI18nNumbering( *mpNumberSelectLB, ::std::numeric_limits<sal_uInt16>::max()); mpNumberSelectLB->SetSelectHdl( LINK(this, PageStylesPanel, ModifyNumberingHdl) ); - mpLayoutSelectLB->SetSelectHdl( LINK(this, PageStylesPanel, ModifyLayoutHdl) ); mpBgFillType->SetSelectHdl( LINK(this, PageStylesPanel, ModifyFillStyleHdl)); - mpBgColorLB->SetSelectHdl( LINK(this, PageStylesPanel, ModifyFillColorHdl)); - mpBgGradientLB->SetSelectHdl( LINK(this, PageStylesPanel, ModifyFillColorHdl)); + mpBgColorLB->SetSelectHdl( LINK(this, PageStylesPanel, ModifyFillColorListHdl)); + mpBgGradientLB->SetSelectHdl( LINK(this, PageStylesPanel, ModifyFillColorListHdl)); mpBgHatchingLB->SetSelectHdl( LINK(this, PageStylesPanel, ModifyFillColorHdl)); mpBgBitmapLB->SetSelectHdl( LINK(this, PageStylesPanel, ModifyFillColorHdl)); - - mpBindings->Invalidate(SID_ATTR_PAGE_COLUMN); - mpBindings->Invalidate(SID_ATTR_PAGE); - mpBindings->Invalidate(SID_ATTR_PAGE_FILLSTYLE); - Update(); } void PageStylesPanel::Update() @@ -180,49 +179,22 @@ void PageStylesPanel::Update() mpBgGradientLB->Hide(); mpBgHatchingLB->Hide(); mpBgColorLB->Show(); - mpBgColorLB->Clear(); - const SvxColorListItem aItem( *static_cast<const SvxColorListItem*>(pSh->GetItem(SID_COLOR_TABLE))); - mpBgColorLB->Fill(aItem.GetColorList()); - const Color aColor = GetColorSetOrDefault(); - mpBgColorLB->SelectEntry( aColor ); - - if(mpBgColorLB->GetSelectEntryCount() == 0) - { - mpBgColorLB->InsertEntry(aColor, OUString()); - mpBgColorLB->SelectEntry(aColor); - } + mpBgColorLB->SelectEntry(aColor); } break; case drawing::FillStyle_GRADIENT: { - const SvxColorListItem aItem(*static_cast<const SvxColorListItem*>(pSh->GetItem(SID_COLOR_TABLE))); mpBgBitmapLB->Hide(); mpBgHatchingLB->Hide(); mpBgColorLB->Show(); mpBgGradientLB->Show(); - mpBgColorLB->Clear(); - mpBgGradientLB->Clear(); - mpBgColorLB->Fill(aItem.GetColorList()); - mpBgGradientLB->Fill(aItem.GetColorList()); const XGradient xGradient = GetGradientSetOrDefault(); const Color aStartColor = xGradient.GetStartColor(); + mpBgColorLB->SelectEntry(aStartColor); const Color aEndColor = xGradient.GetEndColor(); - mpBgColorLB->SelectEntry( aStartColor ); - mpBgGradientLB->SelectEntry( aEndColor ); - - if(mpBgColorLB->GetSelectEntryCount() == 0) - { - mpBgColorLB->InsertEntry(aStartColor, OUString()); - mpBgColorLB->SelectEntry(aStartColor); - } - - if(mpBgGradientLB->GetSelectEntryCount() == 0) - { - mpBgGradientLB->InsertEntry(aEndColor, OUString()); - mpBgGradientLB->SelectEntry(aEndColor); - } + mpBgGradientLB->SelectEntry(aEndColor); } break; @@ -514,7 +486,7 @@ IMPL_LINK_NOARG(PageStylesPanel, ModifyFillStyleHdl, ListBox&, void) mpBgFillType->Selected(); } -IMPL_LINK_NOARG(PageStylesPanel, ModifyFillColorHdl, ListBox&, void) +void PageStylesPanel::ModifyFillColor() { const drawing::FillStyle eXFS = (drawing::FillStyle)mpBgFillType->GetSelectEntryPos(); SfxObjectShell* pSh = SfxObjectShell::Current(); @@ -564,6 +536,16 @@ IMPL_LINK_NOARG(PageStylesPanel, ModifyFillColorHdl, ListBox&, void) } } +IMPL_LINK_NOARG(PageStylesPanel, ModifyFillColorHdl, ListBox&, void) +{ + ModifyFillColor(); +} + +IMPL_LINK_NOARG(PageStylesPanel, ModifyFillColorListHdl, SvxColorListBox&, void) +{ + ModifyFillColor(); +} + } } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/sidebar/PageStylesPanel.hxx b/sw/source/uibase/sidebar/PageStylesPanel.hxx index c0dacdbfb10f..558b74e73a67 100644 --- a/sw/source/uibase/sidebar/PageStylesPanel.hxx +++ b/sw/source/uibase/sidebar/PageStylesPanel.hxx @@ -49,6 +49,7 @@ #include <svx/pagenumberlistbox.hxx> class List; +class SvxColorListBox; namespace sw { namespace sidebar { class PageStylesPanel: @@ -94,9 +95,9 @@ private: ::sfx2::sidebar::ControllerItem maBgBitmapControl; ::sfx2::sidebar::ControllerItem maBgFillStyleControl; - VclPtr<ColorLB> mpBgColorLB; + VclPtr<SvxColorListBox> mpBgColorLB; VclPtr<SvxFillAttrBox> mpBgHatchingLB; - VclPtr<ColorLB> mpBgGradientLB; + VclPtr<SvxColorListBox> mpBgGradientLB; VclPtr<SvxFillAttrBox> mpBgBitmapLB; VclPtr<ListBox> mpLayoutSelectLB; VclPtr<ListBox> mpColumnCount; @@ -112,11 +113,14 @@ private: const OUString GetHatchingSetOrDefault(); const OUString GetBitmapSetOrDefault(); + void ModifyFillColor(); + DECL_LINK( ModifyColumnCountHdl, ListBox&, void ); DECL_LINK( ModifyNumberingHdl, ListBox&, void ); DECL_LINK( ModifyLayoutHdl, ListBox&, void ); DECL_LINK( ModifyFillStyleHdl, ListBox&, void ); DECL_LINK( ModifyFillColorHdl, ListBox&, void ); + DECL_LINK( ModifyFillColorListHdl, SvxColorListBox&, void ); }; } } //end of namespace sw::sidebar diff --git a/sw/uiconfig/swriter/ui/columnpage.ui b/sw/uiconfig/swriter/ui/columnpage.ui index 96f4db0adac5..9ff9a5f8bf67 100644 --- a/sw/uiconfig/swriter/ui/columnpage.ui +++ b/sw/uiconfig/swriter/ui/columnpage.ui @@ -538,7 +538,7 @@ </packing> </child> <child> - <object class="svtlo-ColorListBox" id="colorlb"> + <object class="svxcorelo-SvxColorListBox" id="colorlb"> <property name="visible">True</property> <property name="dropdown">True</property> <property name="can_focus">False</property> diff --git a/sw/uiconfig/swriter/ui/footnoteareapage.ui b/sw/uiconfig/swriter/ui/footnoteareapage.ui index adcfbdb9ef93..ba212099e4a4 100644 --- a/sw/uiconfig/swriter/ui/footnoteareapage.ui +++ b/sw/uiconfig/swriter/ui/footnoteareapage.ui @@ -342,7 +342,7 @@ </packing> </child> <child> - <object class="svtlo-ColorListBox" id="color"> + <object class="svxcorelo-SvxColorListBox" id="color"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="halign">start</property> diff --git a/sw/uiconfig/swriter/ui/optredlinepage.ui b/sw/uiconfig/swriter/ui/optredlinepage.ui index 8f3fc93c0bc7..9febbd1447a1 100644 --- a/sw/uiconfig/swriter/ui/optredlinepage.ui +++ b/sw/uiconfig/swriter/ui/optredlinepage.ui @@ -85,7 +85,7 @@ </packing> </child> <child> - <object class="svtlo-ColorListBox" id="insertcolor"> + <object class="svxcorelo-SvxColorListBox" id="insertcolor"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="valign">center</property> @@ -196,7 +196,7 @@ </packing> </child> <child> - <object class="svtlo-ColorListBox" id="deletedcolor"> + <object class="svxcorelo-SvxColorListBox" id="deletedcolor"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="valign">center</property> @@ -307,7 +307,7 @@ </packing> </child> <child> - <object class="svtlo-ColorListBox" id="changedcolor"> + <object class="svxcorelo-SvxColorListBox" id="changedcolor"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="valign">center</property> @@ -379,7 +379,7 @@ <property name="row_spacing">6</property> <property name="column_spacing">12</property> <child> - <object class="svtlo-ColorListBox" id="markcolor"> + <object class="svxcorelo-SvxColorListBox" id="markcolor"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="valign">center</property> @@ -472,18 +472,6 @@ <property name="top_attach">3</property> </packing> </child> - <child> - <object class="GtkLabel" id="byauthor"> - <property name="can_focus">False</property> - <property name="no_show_all">True</property> - <property name="label" translatable="yes">By author</property> - <property name="use_underline">True</property> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">4</property> - </packing> - </child> </object> <object class="GtkSizeGroup" id="sizegroup1"> <widgets> diff --git a/sw/uiconfig/swriter/ui/pagestylespanel.ui b/sw/uiconfig/swriter/ui/pagestylespanel.ui index 4246cdedd22c..a9f0817b6d4c 100644 --- a/sw/uiconfig/swriter/ui/pagestylespanel.ui +++ b/sw/uiconfig/swriter/ui/pagestylespanel.ui @@ -171,7 +171,7 @@ </packing> </child> <child> - <object class="svxlo-ColorLB" id="lbcolor"> + <object class="svxcorelo-SvxColorListBox" id="lbcolor"> <property name="width_request">150</property> <property name="visible">True</property> <property name="can_focus">False</property> @@ -184,7 +184,7 @@ </packing> </child> <child> - <object class="svxlo-ColorLB" id="lbgradient"> + <object class="svxcorelo-SvxColorListBox" id="lbgradient"> <property name="width_request">150</property> <property name="visible">True</property> <property name="can_focus">False</property> diff --git a/sw/uiconfig/swriter/ui/textgridpage.ui b/sw/uiconfig/swriter/ui/textgridpage.ui index d95343da6f12..a0f575fa39f6 100644 --- a/sw/uiconfig/swriter/ui/textgridpage.ui +++ b/sw/uiconfig/swriter/ui/textgridpage.ui @@ -476,7 +476,7 @@ </packing> </child> <child> - <object class="svtlo-ColorListBox" id="listLB_COLOR"> + <object class="svxcorelo-SvxColorListBox" id="listLB_COLOR"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="halign">start</property> |