diff options
142 files changed, 2725 insertions, 1488 deletions
diff --git a/chart2/source/controller/dialogs/dlg_View3D.cxx b/chart2/source/controller/dialogs/dlg_View3D.cxx index 7cfd50f41fd1..eb0150b1ad7a 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) +View3DDialog::View3DDialog(vcl::Window* pParent, const uno::Reference< frame::XModel > & xChartModel, const XColorListRef &pColorTable ) : 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); + m_pIllumination = VclPtr<ThreeD_SceneIllumination_TabPage>::Create(m_pTabControl,xSceneProperties,xChartModel,pColorTable); 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 40f2857859bb..bdd53ff10d21 100644 --- a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx +++ b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx @@ -22,7 +22,6 @@ #include "Bitmaps.hrc" #include "CommonConverters.hxx" -#include <svx/colorbox.hxx> #include "svx/dialogs.hrc" #include <svx/dialmgr.hxx> #include <rtl/math.hxx> @@ -104,7 +103,7 @@ void LightSourceInfo::initButtonFromSource() namespace { - OUString lcl_makeColorName(const Color& rColor) + OUString lcl_makeColorName( Color rColor ) { OUString aStr = SVX_RESSTR(RID_SVXFLOAT3D_FIX_R) + OUString::number(rColor.GetRed()) + @@ -116,11 +115,15 @@ namespace OUString::number(rColor.GetBlue()); return aStr; } - - void lcl_selectColor(SvxColorListBox& rListBox, const Color& rColor) + void lcl_selectColor( ColorListBox& rListBox, const Color& rColor ) { rListBox.SetNoSelection(); - rListBox.SelectEntry(std::make_pair(rColor, lcl_makeColorName(rColor))); + rListBox.SelectEntry( rColor ); + if( rListBox.GetSelectEntryCount() == 0 ) + { + const sal_Int32 nPos = rListBox.InsertEntry( rColor, lcl_makeColorName( rColor ) ); + rListBox.SelectEntryPos( nPos ); + } } ::chart::LightSource lcl_getLightSourceFromProperties( @@ -212,7 +215,8 @@ namespace ThreeD_SceneIllumination_TabPage::ThreeD_SceneIllumination_TabPage( vcl::Window* pWindow , const uno::Reference< beans::XPropertySet > & xSceneProperties - , const uno::Reference< frame::XModel >& xChartModel ) + , const uno::Reference< frame::XModel >& xChartModel + , const XColorListRef & pColorTable ) : TabPage ( pWindow ,"tp_3D_SceneIllumination" ,"modules/schart/ui/tp_3D_SceneIllumination.ui") @@ -238,6 +242,14 @@ 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; @@ -396,7 +408,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); - SvxColorListBox* pListBox = ( bIsAmbientLight ? m_pLB_AmbientLight : m_pLB_LightSource); + ColorLB* pListBox = ( bIsAmbientLight ? m_pLB_AmbientLight : m_pLB_LightSource); SvColorDialog aColorDlg( this ); aColorDlg.SetColor( pListBox->GetSelectEntryColor() ); @@ -429,9 +441,9 @@ IMPL_LINK( ThreeD_SceneIllumination_TabPage, ColorDialogHdl, Button*, pButton, v } } -IMPL_LINK( ThreeD_SceneIllumination_TabPage, SelectColorHdl, SvxColorListBox&, rBox, void ) +IMPL_LINK( ThreeD_SceneIllumination_TabPage, SelectColorHdl, ListBox&, rBox, void ) { - SvxColorListBox* pListBox = &rBox; + ColorLB* pListBox = static_cast<ColorLB*>(&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 42517359f6fc..515ace16b8e4 100644 --- a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.hxx +++ b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.hxx @@ -29,8 +29,6 @@ #include <svx/dlgctrl.hxx> #include <svx/dlgctl3d.hxx> -class SvxColorListBox; - namespace chart { @@ -54,13 +52,14 @@ public: ThreeD_SceneIllumination_TabPage( vcl::Window* pWindow, const css::uno::Reference< css::beans::XPropertySet > & xSceneProperties, - const css::uno::Reference< css::frame::XModel >& xChartModel ); + const css::uno::Reference< css::frame::XModel >& xChartModel, + const XColorListRef &pColorTable ); virtual ~ThreeD_SceneIllumination_TabPage() override; virtual void dispose() override; private: DECL_LINK( ClickLightSourceButtonHdl, Button*, void ); - DECL_LINK( SelectColorHdl, SvxColorListBox&, void ); + DECL_LINK( SelectColorHdl, ListBox&, void ); DECL_LINK( ColorDialogHdl, Button*, void ); DECL_LINK( PreviewChangeHdl, SvxLightCtl3D*, void ); DECL_LINK( PreviewSelectHdl, SvxLightCtl3D*, void ); @@ -82,10 +81,10 @@ private: VclPtr<LightButton> m_pBtn_Light7; VclPtr<LightButton> m_pBtn_Light8; - VclPtr<SvxColorListBox> m_pLB_LightSource; + VclPtr<ColorLB> m_pLB_LightSource; VclPtr<PushButton> m_pBtn_LightSource_Color; - VclPtr<SvxColorListBox> m_pLB_AmbientLight; + VclPtr<ColorLB> 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 a5646ab535bc..b63ece7bea10 100644 --- a/chart2/source/controller/inc/dlg_View3D.hxx +++ b/chart2/source/controller/inc/dlg_View3D.hxx @@ -38,7 +38,8 @@ class View3DDialog : public TabDialog { public: View3DDialog( vcl::Window* pWindow, - const css::uno::Reference< css::frame::XModel > & xChartModel ); + const css::uno::Reference< css::frame::XModel > & xChartModel, + const XColorListRef &pColorTable ); 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 7636aa982176..00e7294f824a 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()); + ScopedVclPtrInstance< View3DDialog > aDlg( m_pChartWindow, getModel(), m_pDrawModelWrapper->GetColorList() ); if( aDlg->Execute() == RET_OK ) aUndoGuard.commit(); } diff --git a/chart2/source/controller/sidebar/ChartColorWrapper.cxx b/chart2/source/controller/sidebar/ChartColorWrapper.cxx index ee931d06503f..b2ff6196916d 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 NamedColor& rColor) +void ChartColorWrapper::operator()(const OUString& , const Color& rColor) { css::uno::Reference<css::beans::XPropertySet> xPropSet = getPropSet(mxModel); assert(xPropSet.is()); - xPropSet->setPropertyValue(maPropertyName, css::uno::makeAny(rColor.first.GetColor())); + xPropSet->setPropertyValue(maPropertyName, css::uno::makeAny(rColor.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 b98750312c16..68fb5141b564 100644 --- a/chart2/source/controller/sidebar/ChartColorWrapper.hxx +++ b/chart2/source/controller/sidebar/ChartColorWrapper.hxx @@ -12,7 +12,6 @@ #include <com/sun/star/frame/XFramesSupplier.hpp> #include <tools/color.hxx> -#include <svx/Palette.hxx> class SvxColorToolBoxControl; @@ -27,7 +26,7 @@ public: SvxColorToolBoxControl* pControl, const OUString& rPropertyName); - void operator()(const OUString& rCommand, const NamedColor& rColor); + void operator()(const OUString& rCommand, const Color& 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 e445660771bd..7ff9fbf4d097 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-SvxColorListBox" id="LB_LIGHTSOURCE"> + <object class="svxlo-ColorLB" 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-SvxColorListBox" id="LB_AMBIENTLIGHT"> + <object class="svxlo-ColorLB" 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 915debae2dfc..9675b1029a94 100644 --- a/cui/source/inc/border.hxx +++ b/cui/source/inc/border.hxx @@ -25,7 +25,6 @@ #include <vcl/fixed.hxx> #include <svtools/valueset.hxx> #include <sfx2/tabdlg.hxx> -#include <svx/colorbox.hxx> #include <svx/frmsel.hxx> #include <svx/flagsdef.hxx> @@ -73,7 +72,7 @@ private: VclPtr<svx::FrameSelector> m_pFrameSel; VclPtr<LineListBox> m_pLbLineStyle; - VclPtr<SvxColorListBox> m_pLbLineColor; + VclPtr<ColorListBox> m_pLbLineColor; VclPtr<MetricField> m_pLineWidthMF; VclPtr<VclContainer> m_pSpacingFrame; @@ -92,7 +91,7 @@ private: VclPtr<FixedText> m_pFtShadowSize; VclPtr<MetricField> m_pEdShadowSize; VclPtr<FixedText> m_pFtShadowColor; - VclPtr<SvxColorListBox> m_pLbShadowColor; + VclPtr<ColorListBox> m_pLbShadowColor; VclPtr<VclContainer> m_pPropertiesFrame;///< properties - "Merge with next paragraph" in Writer @@ -121,7 +120,7 @@ private: // Handler DECL_LINK( SelStyleHdl_Impl, ListBox&, void ); - DECL_LINK( SelColHdl_Impl, SvxColorListBox&, void ); + DECL_LINK( SelColHdl_Impl, ListBox&, 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 484897d93afe..bea73e4f253e 100644 --- a/cui/source/inc/chardlg.hxx +++ b/cui/source/inc/chardlg.hxx @@ -23,7 +23,6 @@ #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> @@ -176,7 +175,7 @@ class SvxCharEffectsPage : public SvxCharBasePage private: static const sal_uInt16 pEffectsRanges[]; VclPtr<FixedText> m_pFontColorFT; - VclPtr<SvxColorListBox> m_pFontColorLB; + VclPtr<ColorListBox> m_pFontColorLB; VclPtr<FixedText> m_pEffectsFT; VclPtr<ListBox> m_pEffectsLB; @@ -191,13 +190,13 @@ private: VclPtr<ListBox> m_pOverlineLB; VclPtr<FixedText> m_pOverlineColorFT; - VclPtr<SvxColorListBox> m_pOverlineColorLB; + VclPtr<ColorListBox> m_pOverlineColorLB; VclPtr<ListBox> m_pStrikeoutLB; VclPtr<ListBox> m_pUnderlineLB; VclPtr<FixedText> m_pUnderlineColorFT; - VclPtr<SvxColorListBox> m_pUnderlineColorLB; + VclPtr<ColorListBox> m_pUnderlineColorLB; VclPtr<CheckBox> m_pIndividualWordsBtn; @@ -211,6 +210,8 @@ private: sal_uInt16 m_nHtmlMode; + OUString m_aTransparentColorName; + SvxCharEffectsPage( vcl::Window* pParent, const SfxItemSet& rSet ); void Initialize(); @@ -224,7 +225,7 @@ private: DECL_LINK(CbClickHdl_Impl, Button*, void); DECL_LINK(TristClickHdl_Impl, Button*, void); DECL_LINK(UpdatePreview_Impl, ListBox&, void); - DECL_LINK(ColorBoxSelectHdl_Impl, SvxColorListBox&, void); + DECL_LINK(ColorBoxSelectHdl_Impl, ListBox&, void); public: virtual ~SvxCharEffectsPage() override; diff --git a/cui/source/inc/cuires.hrc b/cui/source/inc/cuires.hrc index 33f5ea39e1a1..0f57cf68ef32 100644 --- a/cui/source/inc/cuires.hrc +++ b/cui/source/inc/cuires.hrc @@ -85,6 +85,7 @@ #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 362777aa0e02..52d4fce87273 100644 --- a/cui/source/inc/cuitabarea.hxx +++ b/cui/source/inc/cuitabarea.hxx @@ -39,7 +39,6 @@ class SdrModel; class SvxBitmapCtl; -class SvxColorListBox; /************************************************************************/ class ButtonBox @@ -322,7 +321,7 @@ private: VclPtr<VclGrid> m_pGridShadow; VclPtr<SvxRectCtl> m_pCtlPosition; VclPtr<MetricField> m_pMtrDistance; - VclPtr<SvxColorListBox> m_pLbShadowColor; + VclPtr<ColorLB> m_pLbShadowColor; VclPtr<MetricField> m_pMtrTransparent; VclPtr<SvxXShadowPreview> m_pCtlXRectPreview; @@ -341,13 +340,14 @@ private: DECL_LINK( ClickShadowHdl_Impl, Button*, void ); DECL_LINK( ModifyShadowHdl_Impl, Edit&, void ); - DECL_LINK( SelectShadowHdl_Impl, SvxColorListBox&, void ); + DECL_LINK( SelectShadowHdl_Impl, ListBox&, 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<SvxColorListBox> m_pLbColorFrom; + VclPtr<ColorLB> m_pLbColorFrom; VclPtr<MetricField> m_pMtrColorFrom; - VclPtr<SvxColorListBox> m_pLbColorTo; + VclPtr<ColorLB> m_pLbColorTo; VclPtr<MetricField> m_pMtrColorTo; VclPtr<SvxPresetListBox> m_pGradientLB; VclPtr<NumericField> m_pMtrIncrement; @@ -413,7 +413,6 @@ 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 ); @@ -456,9 +455,9 @@ private: VclPtr<MetricField> m_pMtrAngle; VclPtr<Slider> m_pSliderAngle; VclPtr<ListBox> m_pLbLineType; - VclPtr<SvxColorListBox> m_pLbLineColor; + VclPtr<ColorLB> m_pLbLineColor; VclPtr<CheckBox> m_pCbBackgroundColor; - VclPtr<SvxColorListBox> m_pLbBackgroundColor; + VclPtr<ColorLB> m_pLbBackgroundColor; VclPtr<SvxPresetListBox> m_pHatchLB; VclPtr<SvxXRectPreview> m_pCtlPreview; VclPtr<PushButton> m_pBtnAdd; @@ -484,9 +483,8 @@ 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, SvxColorListBox&, void ); + DECL_LINK( ModifiedBackgroundHdl_Impl, ListBox&, void ); DECL_LINK( ModifiedSliderHdl_Impl, Slider*, void ); void ModifiedHdl_Impl(void*); DECL_LINK( ClickAddHdl_Impl, Button*, void ); @@ -615,8 +613,8 @@ class SvxPatternTabPage : public SvxTabPage private: VclPtr<VclBox> m_pBxPixelEditor; VclPtr<SvxPixelCtl> m_pCtlPixel; - VclPtr<SvxColorListBox> m_pLbColor; - VclPtr<SvxColorListBox> m_pLbBackgroundColor; + VclPtr<ColorLB> m_pLbColor; + VclPtr<ColorLB> m_pLbBackgroundColor; VclPtr<SvxPresetListBox> m_pPatternLB; VclPtr<SvxXRectPreview> m_pCtlPreview; VclPtr<PushButton> m_pBtnAdd; @@ -644,7 +642,7 @@ private: DECL_LINK( ClickAddHdl_Impl, Button*, void ); DECL_LINK( ClickModifyHdl_Impl, Button*, void ); DECL_LINK( ChangePatternHdl_Impl, ValueSet*, void ); - DECL_LINK( ChangeColorHdl_Impl, SvxColorListBox&, void ); + DECL_LINK( ChangeColorHdl_Impl, ListBox&, 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 39e7498e5fdb..957b421ecd2f 100644 --- a/cui/source/inc/cuitabline.hxx +++ b/cui/source/inc/cuitabline.hxx @@ -25,7 +25,6 @@ #include <svx/tabarea.hxx> enum class PageType; -class SvxColorListBox; class SvxLineTabDialog : public SfxTabDialog { @@ -93,7 +92,7 @@ class SvxLineTabPage : public SvxTabPage private: VclPtr<VclBox> m_pBoxColor; VclPtr<LineLB> m_pLbLineStyle; - VclPtr<SvxColorListBox> m_pLbColor; + VclPtr<ColorLB> m_pLbColor; VclPtr<VclBox> m_pBoxWidth; VclPtr<MetricField> m_pMtrLineWidth; VclPtr<VclBox> m_pBoxTransparency; @@ -183,7 +182,7 @@ private: DECL_LINK( ChangeEndModifyHdl_Impl, Edit&, void ); DECL_LINK( ChangeEndClickHdl_Impl, Button*, void ); void ChangeEndHdl_Impl(void*); - DECL_LINK( ChangePreviewListBoxHdl_Impl, SvxColorListBox&, void ); + DECL_LINK( ChangePreviewListBoxHdl_Impl, ListBox&, 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 afaaf1e61ba1..7f65cbf65511 100644 --- a/cui/source/inc/numpages.hxx +++ b/cui/source/inc/numpages.hxx @@ -23,7 +23,6 @@ #include <memory> #include <sfx2/tabdlg.hxx> -#include <svx/Palette.hxx> #include <vcl/group.hxx> #include <vcl/fixed.hxx> #include <vcl/menubtn.hxx> @@ -34,7 +33,6 @@ #include <svtools/ctrlbox.hxx> #include <vcl/dialog.hxx> -class SvxColorListBox; class SvxNumRule; class SvxBmpNumValueSet; class SvxNumValueSet; @@ -256,7 +254,7 @@ class SvxNumOptionsTabPage : public SfxTabPage VclPtr<FixedText> m_pCharFmtFT; VclPtr<ListBox> m_pCharFmtLB; VclPtr<FixedText> m_pBulColorFT; - VclPtr<SvxColorListBox> m_pBulColLB; + VclPtr<ColorListBox> m_pBulColLB; VclPtr<FixedText> m_pBulRelSizeFT; VclPtr<MetricField> m_pBulRelSizeMF; VclPtr<FixedText> m_pAllLevelFT; @@ -329,7 +327,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, SvxColorListBox&, void ); + DECL_LINK( BulColorHdl_Impl, ListBox&, 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 060d3b0b6587..3d95da759c74 100644 --- a/cui/source/options/optchart.cxx +++ b/cui/source/options/optchart.cxx @@ -21,99 +21,24 @@ #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> -Color SvxDefaultColorOptPage::GetSelectEntryColor() const +namespace { - 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) + void FillBoxChartColorLB(ColorLB *pLB, const SvxChartColorTable & rTab) { - if ( static_cast<size_t>(nPos) < aColorList.size() ) + pLB->SetUpdateMode(false); + pLB->Clear(); + long nCount = rTab.size(); + for(long i = 0; i < nCount; ++i) { - ImpColorList::iterator it = aColorList.begin(); - ::std::advance( it, nPos ); - aColorList.insert( it, rColor ); - } - else - { - aColorList.push_back( rColor ); - nPos = aColorList.size() - 1; + pLB->Append(rTab[i]); } + 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) { @@ -184,7 +109,9 @@ void SvxDefaultColorOptPage::dispose() void SvxDefaultColorOptPage::Construct() { - FillBoxChartColorLB(); + if( pColorConfig ) + FillBoxChartColorLB(m_pLbChartColors, pColorConfig->GetColorList()); + FillColorBox(); m_pLbChartColors->SelectEntryPos( 0 ); @@ -257,7 +184,7 @@ IMPL_LINK_NOARG(SvxDefaultColorOptPage, ResetToDefaults, Button*, void) { pColorConfig->GetColorList().useDefault(); - FillBoxChartColorLB(); + FillBoxChartColorLB(m_pLbChartColors, pColorConfig->GetColorList()); m_pLbChartColors->GetFocus(); m_pLbChartColors->SelectEntryPos( 0 ); @@ -276,7 +203,7 @@ IMPL_LINK_NOARG(SvxDefaultColorOptPage, AddChartColor, Button*, void) pColorConfig->GetColorList().append (XColorEntry ( black, pColorConfig->GetColorList().getDefaultName(pColorConfig->GetColorList().size()))); - FillBoxChartColorLB(); + FillBoxChartColorLB(m_pLbChartColors, pColorConfig->GetColorList()); m_pLbChartColors->GetFocus(); m_pLbChartColors->SelectEntryPos( pColorConfig->GetColorList().size() - 1 ); @@ -304,7 +231,7 @@ IMPL_LINK( SvxDefaultColorOptPage, RemoveChartColor, Button*, pButton, void ) { pColorConfig->GetColorList().remove( nIndex ); - FillBoxChartColorLB(); + FillBoxChartColorLB(m_pLbChartColors, pColorConfig->GetColorList()); m_pLbChartColors->GetFocus(); @@ -318,9 +245,9 @@ IMPL_LINK( SvxDefaultColorOptPage, RemoveChartColor, Button*, pButton, void ) } } -IMPL_LINK_NOARG( SvxDefaultColorOptPage, ListClickedHdl, ListBox&, void ) +IMPL_LINK( SvxDefaultColorOptPage, ListClickedHdl, ListBox&, _rBox, void ) { - Color aCol = GetSelectEntryColor(); + Color aCol = static_cast<ColorLB&>(_rBox).GetSelectEntryColor(); long nIndex = GetColorIndex( aCol ); @@ -337,7 +264,7 @@ IMPL_LINK_NOARG(SvxDefaultColorOptPage, BoxClickedHdl, ValueSet*, void) { const XColorEntry aEntry( m_pValSetColorBox->GetItemColor( m_pValSetColorBox->GetSelectItemId() ), m_pLbChartColors->GetSelectEntry() ); - ModifyColorEntry(aEntry, nIdx); + m_pLbChartColors->Modify( 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 79af3c1dd8b8..34cd2113f2a3 100644 --- a/cui/source/options/optchart.hxx +++ b/cui/source/options/optchart.hxx @@ -29,12 +29,11 @@ #include "cfgchart.hxx" -typedef std::vector<Color> ImpColorList; - class SvxDefaultColorOptPage : public SfxTabPage { + private: - VclPtr<ListBox> m_pLbChartColors; + VclPtr<ColorLB> m_pLbChartColors; VclPtr<ValueSet> m_pValSetColorBox; VclPtr<PushButton> m_pPBDefault; VclPtr<PushButton> m_pPBAdd; @@ -43,7 +42,6 @@ private: SvxChartOptions* pChartOptions; SvxChartColorTableItem* pColorConfig; XColorListRef pColorList; - ImpColorList aColorList; DECL_LINK( ResetToDefaults, Button *, void ); DECL_LINK( AddChartColor, Button *, void ); @@ -54,15 +52,6 @@ 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 1d962bddbd3b..43f76b4b6884 100644 --- a/cui/source/options/optcolor.cxx +++ b/cui/source/options/optcolor.cxx @@ -21,13 +21,11 @@ #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> @@ -179,12 +177,12 @@ public: virtual void dispose() override; public: - void SetLinks (Link<Button*,void> const&, Link<SvxColorListBox&,void> const&, Link<Control&,void> const&); + void SetLinks (Link<Button*,void> const&, Link<ListBox&,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*, SvxColorListBox*); + void ColorHdl (EditableColorConfig*, EditableExtendedColorConfig*, ColorListBox*); void Init(ScrollBar *pVScroll, HeaderBar *m_pHeaderHB); void AdjustScrollBar(); void AdjustHeaderBar(); @@ -216,10 +214,10 @@ private: public: void Show (); void Hide (); - void SetAppearance(Wallpaper const& rTextWall); + void SetAppearance(Wallpaper const& aTextWall, ColorListBox const& aSampleList); void SetTextColor (Color C) { m_pText->SetTextColor(C); } public: - void SetLinks (Link<Button*,void> const&, Link<SvxColorListBox&,void> const&, Link<Control&,void> const&); + void SetLinks (Link<Button*,void> const&, Link<ListBox&,void> const&, Link<Control&,void> const&); void Update (ColorConfigEntry, ColorConfigValue const&); void Update (ExtendedColorConfigValue const&); void ColorChanged (ColorConfigEntry, ColorConfigValue&); @@ -229,7 +227,7 @@ private: unsigned GetHeight () const { return m_pColorList->GetSizePixel().Height(); } public: bool Is (CheckBox* pBox) const { return m_pText == pBox; } - bool Is (SvxColorListBox* pBox) const { return m_pColorList == pBox; } + bool Is (ColorListBox* pBox) const { return m_pColorList == pBox; } void dispose() { m_pText.disposeAndClear(); @@ -241,7 +239,7 @@ private: // checkbox (CheckBox) or simple text (FixedText) VclPtr<Control> m_pText; // color list box - VclPtr<SvxColorListBox> m_pColorList; + VclPtr<ColorListBox> m_pColorList; // color preview box VclPtr<vcl::Window> m_pPreview; // default color @@ -352,7 +350,9 @@ ColorConfigWindow_Impl::Entry::Entry( vcl::Window *pGrid, unsigned nYPos, m_pText->set_margin_left(6 + nCheckBoxLabelOffset); m_pText->SetText(rColorEntry.getDisplayName()); - m_pColorList = VclPtr<SvxColorListBox>::Create(pGrid); + 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->set_grid_left_attach(1); m_pColorList->set_grid_top_attach(nYPos); @@ -390,22 +390,24 @@ void ColorConfigWindow_Impl::Entry::Hide() // SetAppearance() // iEntry: which entry is this? -// rTextWall: background of the text (transparent) +// aTextWall: background of the text (transparent) // aSampleList: sample color listbox (to copy from) -void ColorConfigWindow_Impl::Entry::SetAppearance(Wallpaper const& rTextWall) +void ColorConfigWindow_Impl::Entry::SetAppearance( + Wallpaper const& aTextWall, + ColorListBox const& aSampleList) { // text (and optionally checkbox) - m_pText->SetBackground(rTextWall); + m_pText->SetBackground(aTextWall); // preview m_pPreview->SetBorderStyle(WindowBorderStyle::MONO); // color list - m_pColorList->SetSlotId(SID_ATTR_CHAR_COLOR); - m_pColorList->SetAutoDisplayColor(m_aDefaultColor); + m_pColorList->CopyEntries(aSampleList); + m_pColorList->InsertAutomaticEntryColor(m_aDefaultColor); } // SetLinks() void ColorConfigWindow_Impl::Entry::SetLinks( - Link<Button*,void> const& aCheckLink, Link<SvxColorListBox&,void> const& aColorLink, + Link<Button*,void> const& aCheckLink, Link<ListBox&,void> const& aColorLink, Link<Control&,void> const& aGetFocusLink) { m_pColorList->SetSelectHdl(aColorLink); @@ -421,10 +423,17 @@ void ColorConfigWindow_Impl::Entry::SetLinks( void ColorConfigWindow_Impl::Entry::Update ( ColorConfigEntry aColorEntry, ColorConfigValue const& rValue ) { - Color aColor(rValue.nColor); - m_pColorList->SelectEntry(aColor); - if (aColor.GetColor() == COL_AUTO) + Color aColor; + if ((unsigned)rValue.nColor == 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); @@ -436,7 +445,7 @@ void ColorConfigWindow_Impl::Entry::Update ( ) { Color aColor(rValue.getColor()); if (rValue.getColor() == rValue.getDefaultColor()) - m_pColorList->SelectEntry(Color(COL_AUTO)); + m_pColorList->SelectEntryPos(0); else m_pColorList->SelectEntry(aColor); SetColor(aColor); @@ -447,10 +456,17 @@ void ColorConfigWindow_Impl::Entry::ColorChanged ( ColorConfigEntry aColorEntry, ColorConfigValue& rValue ) { - Color aColor = m_pColorList->GetSelectEntryColor(); - rValue.nColor = aColor.GetColor(); - if (aColor.GetColor() == COL_AUTO) + Color aColor; + if (m_pColorList->IsAutomaticSelected()) + { aColor = ColorConfig::GetDefaultColor(aColorEntry); + rValue.nColor = COL_AUTO; + } + else + { + aColor = m_pColorList->GetSelectEntryColor(); + rValue.nColor = aColor.GetColor(); + } SetColor(aColor); } @@ -460,7 +476,8 @@ void ColorConfigWindow_Impl::Entry::ColorChanged ( ) { Color aColor = m_pColorList->GetSelectEntryColor(); rValue.setColor(aColor.GetColor()); - if (aColor.GetColor() == COL_AUTO) + // automatic? + if (m_pColorList->GetSelectEntryPos() == 0) { rValue.setColor(rValue.getDefaultColor()); aColor.SetColor(rValue.getColor()); @@ -611,11 +628,22 @@ 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); + vEntries[i]->SetAppearance(aTransparentWall, *aSampleColorList.get()); } } @@ -653,7 +681,7 @@ void ColorConfigWindow_Impl::Init(ScrollBar *pVScroll, HeaderBar *pHeaderHB) // SetLinks() void ColorConfigWindow_Impl::SetLinks ( - Link<Button*,void> const& aCheckLink, Link<SvxColorListBox&,void> const& aColorLink, Link<Control&,void> const& aGetFocusLink + Link<Button*,void> const& aCheckLink, Link<ListBox&,void> const& aColorLink, Link<Control&,void> const& aGetFocusLink ) { for (unsigned i = 0; i != vEntries.size(); ++i) vEntries[i]->SetLinks(aCheckLink, aColorLink, aGetFocusLink); @@ -714,10 +742,10 @@ void ColorConfigWindow_Impl::ClickHdl (EditableColorConfig* pConfig, CheckBox* p } // ColorHdl() -void ColorConfigWindow_Impl::ColorHdl( +void ColorConfigWindow_Impl::ColorHdl ( EditableColorConfig* pConfig, EditableExtendedColorConfig* pExtConfig, - SvxColorListBox* pBox) -{ + ColorListBox* pBox +) { unsigned i = 0; // default entries @@ -810,7 +838,7 @@ class ColorConfigCtrl_Impl : public VclVBox DECL_LINK(ScrollHdl, ScrollBar*, void); DECL_LINK(ClickHdl, Button*, void); - DECL_LINK(ColorHdl, SvxColorListBox&, void); + DECL_LINK(ColorHdl, ListBox&, void); DECL_LINK(ControlFocusHdl, Control&, void); virtual bool PreNotify (NotifyEvent& rNEvt) override; @@ -864,7 +892,7 @@ ColorConfigCtrl_Impl::ColorConfigCtrl_Impl(vcl::Window* pParent) m_pVScroll->SetEndScrollHdl(aScrollLink); Link<Button*,void> aCheckLink = LINK(this, ColorConfigCtrl_Impl, ClickHdl); - Link<SvxColorListBox&,void> aColorLink = LINK(this, ColorConfigCtrl_Impl, ColorHdl); + Link<ListBox&,void> aColorLink = LINK(this, ColorConfigCtrl_Impl, ColorHdl); Link<Control&,void> aGetFocusLink = LINK(this, ColorConfigCtrl_Impl, ControlFocusHdl); m_pScrollWindow->SetLinks(aCheckLink, aColorLink, aGetFocusLink); @@ -970,12 +998,11 @@ IMPL_LINK(ColorConfigCtrl_Impl, ClickHdl, Button*, pBox, void) } // a color list has changed -IMPL_LINK(ColorConfigCtrl_Impl, ColorHdl, SvxColorListBox&, rBox, void) +IMPL_LINK(ColorConfigCtrl_Impl, ColorHdl, ListBox&, rBox, void) { DBG_ASSERT(pColorConfig, "Configuration not set" ); - m_pScrollWindow->ColorHdl(pColorConfig, pExtColorConfig, &rBox); + m_pScrollWindow->ColorHdl(pColorConfig, pExtColorConfig, static_cast<ColorListBox*>(&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 41e525d2d358..ce9948c6c79f 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_NOFILL)); + m_pBackgroundColorSet->SetText(SVX_RESSTR(RID_SVXSTR_TRANSPARENT)); } SvxBackgroundTabPage::~SvxBackgroundTabPage() diff --git a/cui/source/tabpages/border.cxx b/cui/source/tabpages/border.cxx index f989a7ce7af6..d74ae35b723a 100644 --- a/cui/source/tabpages/border.cxx +++ b/cui/source/tabpages/border.cxx @@ -284,13 +284,45 @@ 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 ) ); @@ -312,8 +344,7 @@ SvxBorderTabPage::SvxBorderTabPage(vcl::Window* pParent, const SfxItemSet& rCore AddItemConnection( new sfx::CheckBoxConnection( SID_SW_COLLAPSING_BORDERS, *m_pMergeAdjacentBordersCB, ItemConnFlags::NONE ) ); m_pMergeAdjacentBordersCB->Hide(); - SfxObjectShell* pDocSh = SfxObjectShell::Current(); - if (pDocSh) + if( pDocSh ) { Reference< XServiceInfo > xSI( pDocSh->GetModel(), UNO_QUERY ); if ( xSI.is() ) @@ -533,8 +564,12 @@ void SvxBorderTabPage::Reset( const SfxItemSet* rSet ) if( !bColorEq ) aColor.SetColor( COL_BLACK ); - m_pLbLineColor->SelectEntry(aColor); - m_pLbLineStyle->SetColor(aColor); + 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 ); // Select all visible lines, if they are all equal. if( bWidthEq && bColorEq ) @@ -542,6 +577,7 @@ 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 ; @@ -832,6 +868,7 @@ 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). @@ -851,11 +888,16 @@ IMPL_LINK_NOARG(SvxBorderTabPage, SelSdwHdl_Impl, ValueSet*, void) m_pLbShadowColor->Enable(bEnable); } -IMPL_LINK(SvxBorderTabPage, SelColHdl_Impl, SvxColorListBox&, rColorBox, void) + +IMPL_LINK( SvxBorderTabPage, SelColHdl_Impl, ListBox&, rLb, void ) { - Color aColor = rColorBox.GetSelectEntryColor(); - m_pFrameSel->SetColorToSelection(aColor); - m_pLbLineStyle->SetColor(aColor); + ColorListBox* pColLb = static_cast<ColorListBox*>(&rLb); + + if (&rLb == m_pLbLineColor) + { + m_pFrameSel->SetColorToSelection( pColLb->GetSelectEntryColor() ); + m_pLbLineStyle->SetColor( pColLb->GetSelectEntryColor() ); + } } IMPL_LINK_NOARG(SvxBorderTabPage, ModifyWidthHdl_Impl, Edit&, void) diff --git a/cui/source/tabpages/borderconn.cxx b/cui/source/tabpages/borderconn.cxx index 70243d055a47..5aec14626802 100644 --- a/cui/source/tabpages/borderconn.cxx +++ b/cui/source/tabpages/borderconn.cxx @@ -22,7 +22,6 @@ #include "editeng/lineitem.hxx" #include <editeng/boxitem.hxx> #include <svx/algitem.hxx> -#include <svx/colorbox.hxx> #include <editeng/shaditem.hxx> namespace svx { @@ -204,7 +203,7 @@ static const ShadowPosWrapper::MapEntryType s_pShadowPosMap[] = class ShadowControlsWrapper : public sfx::MultiControlWrapper< SvxShadowItem > { public: - explicit ShadowControlsWrapper( ValueSet& rVsPos, MetricField& rMfSize, SvxColorListBox& rLbColor ); + explicit ShadowControlsWrapper( ValueSet& rVsPos, MetricField& rMfSize, ColorListBox& rLbColor ); virtual SvxShadowItem GetControlValue() const override; virtual void SetControlValue( SvxShadowItem aItem ) override; @@ -212,11 +211,11 @@ public: private: ShadowPosWrapper maPosWrp; sfx::MetricFieldWrapper<sal_uInt16> maSizeWrp; - SvxColorListBoxWrapper maColorWrp; + sfx::ColorListBoxWrapper maColorWrp; }; ShadowControlsWrapper::ShadowControlsWrapper( - ValueSet& rVsPos, MetricField& rMfSize, SvxColorListBox& rLbColor ) : + ValueSet& rVsPos, MetricField& rMfSize, ColorListBox& rLbColor ) : maPosWrp( rVsPos, s_pShadowPosMap ), maSizeWrp( rMfSize, FUNIT_TWIP ), maColorWrp( rLbColor ) @@ -251,11 +250,11 @@ class ShadowConnection : public sfx::ItemControlConnection< ShadowItemWrapper, S { public: explicit ShadowConnection( const SfxItemSet& rItemSet, - ValueSet& rVsPos, MetricField& rMfSize, SvxColorListBox& rLbColor ); + ValueSet& rVsPos, MetricField& rMfSize, ColorListBox& rLbColor ); }; ShadowConnection::ShadowConnection( const SfxItemSet& rItemSet, - ValueSet& rVsPos, MetricField& rMfSize, SvxColorListBox& rLbColor ) : + ValueSet& rVsPos, MetricField& rMfSize, ColorListBox& rLbColor ) : ItemControlConnectionType( SID_ATTR_BORDER_SHADOW, new ShadowControlsWrapper( rVsPos, rMfSize, rLbColor ), ItemConnFlags::NONE ) { mxCtrlWrp->SetDefaultValue( maItemWrp.GetDefaultItem( rItemSet ) ); @@ -276,7 +275,7 @@ sfx::ItemConnectionBase* CreateMarginConnection( const SfxItemSet& rItemSet, } sfx::ItemConnectionBase* CreateShadowConnection( const SfxItemSet& rItemSet, - ValueSet& rVsPos, MetricField& rMfSize, SvxColorListBox& rLbColor ) + ValueSet& rVsPos, MetricField& rMfSize, ColorListBox& rLbColor ) { return new ShadowConnection( rItemSet, rVsPos, rMfSize, rLbColor ); } diff --git a/cui/source/tabpages/borderconn.hxx b/cui/source/tabpages/borderconn.hxx index b04d4a8b0c1f..17343d80025f 100644 --- a/cui/source/tabpages/borderconn.hxx +++ b/cui/source/tabpages/borderconn.hxx @@ -26,7 +26,7 @@ class SfxItemSet; class MetricField; class ValueSet; -class SvxColorListBox; +class ColorListBox; 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, SvxColorListBox& rLbColor ); + ValueSet& rVsPos, MetricField& rMfSize, ColorListBox& rLbColor ); } diff --git a/cui/source/tabpages/chardlg.cxx b/cui/source/tabpages/chardlg.cxx index 15a1020591e5..d1b7b8b50c28 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,12 +1363,10 @@ 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"); @@ -1433,14 +1431,55 @@ void SvxCharEffectsPage::Initialize() } } - m_pFontColorLB->SetSelectHdl(LINK(this, SvxCharEffectsPage, ColorBoxSelectHdl_Impl)); + // 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 ) ); // handler Link<ListBox&,void> aLink = LINK( this, SvxCharEffectsPage, SelectListBoxHdl_Impl ); m_pUnderlineLB->SetSelectHdl( aLink ); - m_pUnderlineColorLB->SetSelectHdl(LINK(this, SvxCharEffectsPage, ColorBoxSelectHdl_Impl)); + m_pUnderlineColorLB->SetSelectHdl( aLink ); m_pOverlineLB->SetSelectHdl( aLink ); - m_pOverlineColorLB->SetSelectHdl(LINK(this, SvxCharEffectsPage, ColorBoxSelectHdl_Impl)); + m_pOverlineColorLB->SetSelectHdl( aLink ); m_pStrikeoutLB->SetSelectHdl( aLink ); m_pEmphasisLB->SetSelectHdl( aLink ); m_pPositionLB->SetSelectHdl( aLink ); @@ -1448,7 +1487,9 @@ 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 ); @@ -1479,11 +1520,6 @@ 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(); @@ -1511,7 +1547,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 ); @@ -1595,38 +1631,71 @@ 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 ); - m_pFontColorLB->SelectEntry(aColor); + 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 ) ) ) ); + } 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 = m_pFontColorLB->GetSelectEntryColor(); + Color aSelectedColor; + if ( m_pFontColorLB->GetSelectEntry() == m_aTransparentColorName ) + aSelectedColor = Color( COL_TRANSPARENT ); + else + aSelectedColor = m_pFontColorLB->GetSelectEntryColor(); - if (pOld && pOld->GetValue() == aSelectedColor) + if ( pOld && pOld->GetValue() == aSelectedColor ) bChanged = false; - if (bChanged) + 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 ) + { rSet.Put( SvxColorItem( aSelectedColor, nWhich ) ); + bModified = true; + } else if ( SfxItemState::DEFAULT == rOldSet.GetItemState( nWhich, false ) ) CLEARTITEM; - return bChanged; + return bModified; } + IMPL_LINK( SvxCharEffectsPage, SelectListBoxHdl_Impl, ListBox&, rBox, void ) { SelectHdl_Impl(&rBox); } - void SvxCharEffectsPage::SelectHdl_Impl( ListBox* pBox ) { if ( m_pEmphasisLB == pBox ) @@ -1682,11 +1751,26 @@ IMPL_LINK_NOARG(SvxCharEffectsPage, TristClickHdl_Impl, Button*, void) } -IMPL_LINK_NOARG(SvxCharEffectsPage, ColorBoxSelectHdl_Impl, SvxColorListBox&, void) +IMPL_LINK( SvxCharEffectsPage, ColorBoxSelectHdl_Impl, ListBox&, rListBox, void ) { - UpdatePreview_Impl(); + 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(); } + DeactivateRC SvxCharEffectsPage::DeactivatePage( SfxItemSet* _pSet ) { if ( _pSet ) @@ -1743,11 +1827,24 @@ void SvxCharEffectsPage::Reset( const SfxItemSet* rSet ) } Color aColor = rItem.GetColor(); - m_pUnderlineColorLB->SelectEntry(aColor); + 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 ) ) ) ); + } } else { - m_pUnderlineColorLB->SelectEntry(Color(COL_AUTO)); + m_pUnderlineColorLB->SelectEntry( Color( COL_AUTO )); m_pUnderlineColorLB->Disable(); } } @@ -1787,11 +1884,24 @@ void SvxCharEffectsPage::Reset( const SfxItemSet* rSet ) } Color aColor = rItem.GetColor(); - m_pOverlineColorLB->SelectEntry(aColor); + 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 ) ) ) ); + } } else { - m_pOverlineColorLB->SelectEntry(Color(COL_AUTO)); + m_pOverlineColorLB->SelectEntry( Color( COL_AUTO )); m_pOverlineColorLB->Disable(); } } @@ -2104,10 +2214,12 @@ 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(); @@ -2119,8 +2231,10 @@ void SvxCharEffectsPage::ChangesApplied() m_pBlinkingBtn->SaveValue(); m_pHiddenBtn->SaveValue(); m_pFontColorLB->SaveValue(); + } + bool SvxCharEffectsPage::FillItemSet( SfxItemSet* rSet ) { const SfxPoolItem* pOld = nullptr; @@ -2191,7 +2305,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 88720242fb84..5846d9ea4f65 100644 --- a/cui/source/tabpages/numpages.cxx +++ b/cui/source/tabpages/numpages.cxx @@ -31,7 +31,6 @@ #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> @@ -1110,7 +1109,6 @@ 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"); @@ -1376,6 +1374,31 @@ 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()) && @@ -1905,9 +1928,10 @@ IMPL_LINK( SvxNumOptionsTabPage, SameLevelHdl_Impl, Button*, pBox, void ) InitControls(); } -IMPL_LINK(SvxNumOptionsTabPage, BulColorHdl_Impl, SvxColorListBox&, rColorBox, void) +IMPL_LINK( SvxNumOptionsTabPage, BulColorHdl_Impl, ListBox&, rListBox, void ) { - Color nSetColor = rColorBox.GetSelectEntryColor(); + ColorListBox* pBox = static_cast<ColorListBox*>(&rListBox); + Color nSetColor = pBox->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 0b296d647f89..2bf8809c0d97 100644 --- a/cui/source/tabpages/strings.src +++ b/cui/source/tabpages/strings.src @@ -87,6 +87,10 @@ 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 72538f070da7..6acbf08a03d7 100644 --- a/cui/source/tabpages/tabarea.cxx +++ b/cui/source/tabpages/tabarea.cxx @@ -266,6 +266,7 @@ 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 e8d080e3a812..b9efb53c7850 100644 --- a/cui/source/tabpages/tabline.cxx +++ b/cui/source/tabpages/tabline.cxx @@ -235,6 +235,7 @@ 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 7aac0c7fc14c..e28e17791d56 100644 --- a/cui/source/tabpages/tpgradnt.cxx +++ b/cui/source/tabpages/tpgradnt.cxx @@ -28,7 +28,6 @@ #include <cuires.hrc> #include "helpid.hrc" -#include <svx/colorbox.hxx> #include "svx/xattr.hxx" #include <svx/xtable.hxx> #include <svx/xpool.hxx> @@ -125,10 +124,9 @@ SvxGradientTabPage::SvxGradientTabPage m_pMtrBorder->SetModifyHdl( aLink ); m_pSliderBorder->SetSlideHdl( LINK( this, SvxGradientTabPage, ModifiedSliderHdl_Impl ) ); m_pMtrColorFrom->SetModifyHdl( aLink ); - Link<SvxColorListBox&,void> aLink3 = LINK( this, SvxGradientTabPage, ModifiedColorListBoxHdl_Impl ); - m_pLbColorFrom->SetSelectHdl( aLink3 ); + m_pLbColorFrom->SetSelectHdl( aLink2 ); m_pMtrColorTo->SetModifyHdl( aLink ); - m_pLbColorTo->SetSelectHdl( aLink3 ); + m_pLbColorTo->SetSelectHdl( aLink2 ); // #i76307# always paint the preview in LTR, because this is what the document does m_pCtlPreview->EnableRTL( false ); @@ -165,13 +163,21 @@ 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 @@ -183,6 +189,30 @@ 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 ); } @@ -280,12 +310,8 @@ 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 ) +IMPL_LINK( SvxGradientTabPage, ModifiedListBoxHdl_Impl, ListBox&, rListBox, void ) { ModifiedHdl_Impl(&rListBox); } @@ -591,9 +617,21 @@ 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 31efad7ad521..1f4fa526d9da 100644 --- a/cui/source/tabpages/tphatch.cxx +++ b/cui/source/tabpages/tphatch.cxx @@ -29,7 +29,6 @@ #include <cuires.hrc> #include "helpid.hrc" -#include <svx/colorbox.hxx> #include "svx/xattr.hxx" #include <svx/xpool.hxx> #include <svx/xtable.hxx> @@ -119,8 +118,7 @@ SvxHatchTabPage::SvxHatchTabPage m_pMtrAngle->SetModifyHdl( aLink ); m_pSliderAngle->SetSlideHdl( LINK( this, SvxHatchTabPage, ModifiedSliderHdl_Impl ) ); m_pLbLineType->SetSelectHdl( aLink2 ); - Link<SvxColorListBox&,void> aLink3 = LINK( this, SvxHatchTabPage, ModifiedColorListBoxHdl_Impl ); - m_pLbLineColor->SetSelectHdl( aLink3 ); + m_pLbLineColor->SetSelectHdl( aLink2 ); m_pCbBackgroundColor->SetToggleHdl( LINK( this, SvxHatchTabPage, ToggleHatchBackgroundColor_Impl ) ); m_pLbBackgroundColor->SetSelectHdl( LINK( this, SvxHatchTabPage, ModifiedBackgroundHdl_Impl ) ); @@ -152,13 +150,20 @@ 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 @@ -170,6 +175,18 @@ 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 ); } @@ -211,6 +228,12 @@ 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 @@ -272,10 +295,15 @@ 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()) { - NamedColor aColor = m_pLbBackgroundColor->GetSelectEntry(); - rSet->Put(XFillColorItem(aColor.second, aColor.first)); + 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() ) ); } return true; } @@ -307,12 +335,8 @@ 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 ) +IMPL_LINK( SvxHatchTabPage, ModifiedListBoxHdl_Impl, ListBox&, rListBox, void ) { ModifiedHdl_Impl(&rListBox); } @@ -327,7 +351,7 @@ IMPL_LINK_NOARG( SvxHatchTabPage, ToggleHatchBackgroundColor_Impl, CheckBox&, vo ModifiedBackgroundHdl_Impl(*m_pLbBackgroundColor); } -IMPL_LINK_NOARG( SvxHatchTabPage, ModifiedBackgroundHdl_Impl, SvxColorListBox&, void ) +IMPL_LINK_NOARG( SvxHatchTabPage, ModifiedBackgroundHdl_Impl, ListBox&, void ) { Color aColor(COL_TRANSPARENT); if(m_pCbBackgroundColor->IsChecked()) @@ -405,8 +429,15 @@ 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 3172081f1a2c..11ffd614387d 100644 --- a/cui/source/tabpages/tpline.cxx +++ b/cui/source/tabpages/tpline.cxx @@ -24,7 +24,6 @@ #include <sfx2/module.hxx> #include <cuires.hrc> -#include <svx/colorbox.hxx> #include "svx/xattr.hxx" #include <svx/xpool.hxx> #include <svx/xtable.hxx> @@ -269,6 +268,8 @@ void SvxLineTabPage::dispose() void SvxLineTabPage::Construct() { + // Color chart + m_pLbColor->Fill( m_pColorList ); FillListboxes(); } @@ -640,6 +641,17 @@ 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 ); } @@ -755,9 +767,9 @@ bool SvxLineTabPage::FillItemSet( SfxItemSet* rAttrs ) } // Line color + if( m_pLbColor->IsValueChangedFromSaved() ) { - NamedColor aColor = m_pLbColor->GetSelectEntry(); - XLineColorItem aItem(aColor.second, aColor.first); + XLineColorItem aItem( m_pLbColor->GetSelectEntry(), m_pLbColor->GetSelectEntryColor() ); pOld = GetOldItem( *rAttrs, XATTR_LINECOLOR ); if ( !pOld || !( *static_cast<const XLineColorItem*>(pOld) == aItem ) ) { @@ -1058,8 +1070,7 @@ void SvxLineTabPage::FillXLSet_Impl() m_rXLSet.Put( XLineEndWidthItem( GetCoreValue( *m_pMtrEndWidth, m_ePoolUnit ) ) ); m_rXLSet.Put( XLineWidthItem( GetCoreValue( *m_pMtrLineWidth, m_ePoolUnit ) ) ); - NamedColor aColor = m_pLbColor->GetSelectEntry(); - m_rXLSet.Put(XLineColorItem(aColor.second, aColor.first)); + m_rXLSet.Put( XLineColorItem( m_pLbColor->GetSelectEntry(), m_pLbColor->GetSelectEntryColor() ) ); // Centered line end if( m_pTsbCenterStart->GetState() == TRISTATE_TRUE ) @@ -1249,6 +1260,11 @@ 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 @@ -1482,11 +1498,11 @@ VclPtr<SfxTabPage> SvxLineTabPage::Create( vcl::Window* pWindow, return VclPtr<SvxLineTabPage>::Create( pWindow, *rAttrs ); } -IMPL_LINK( SvxLineTabPage, ChangePreviewListBoxHdl_Impl, SvxColorListBox&, rListBox, void ) + +IMPL_LINK( SvxLineTabPage, ChangePreviewListBoxHdl_Impl, ListBox&, 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 cb4c7a3d7b88..253b1984d478 100644 --- a/cui/source/tabpages/tppattern.cxx +++ b/cui/source/tabpages/tppattern.cxx @@ -27,7 +27,6 @@ #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> @@ -159,11 +158,17 @@ 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 @@ -174,6 +179,30 @@ 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 @@ -324,9 +353,34 @@ 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 ); @@ -554,7 +608,7 @@ IMPL_LINK_NOARG(SvxPatternTabPage, ClickDeleteHdl_Impl, SvxPresetListBox*, void) } } -IMPL_LINK_NOARG(SvxPatternTabPage, ChangeColorHdl_Impl, SvxColorListBox&, void) +IMPL_LINK_NOARG(SvxPatternTabPage, ChangeColorHdl_Impl, ListBox&, void) { ChangeColor_Impl(); } diff --git a/cui/source/tabpages/tpshadow.cxx b/cui/source/tabpages/tpshadow.cxx index 84179d24f7bb..d2b1dca3ce28 100644 --- a/cui/source/tabpages/tpshadow.cxx +++ b/cui/source/tabpages/tpshadow.cxx @@ -19,7 +19,6 @@ #include <sfx2/app.hxx> #include <sfx2/module.hxx> -#include <svx/colorbox.hxx> #include <svx/dialogs.hrc> #include "svx/xattr.hxx" @@ -183,8 +182,17 @@ 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()); @@ -212,6 +220,18 @@ 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, @@ -315,6 +335,9 @@ 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 ); @@ -465,11 +488,11 @@ IMPL_LINK_NOARG(SvxShadowTabPage, ClickShadowHdl_Impl, Button*, void) ModifyShadowHdl_Impl( *m_pMtrTransparent ); } -IMPL_LINK_NOARG(SvxShadowTabPage, SelectShadowHdl_Impl, SvxColorListBox&, void) + +IMPL_LINK_NOARG(SvxShadowTabPage, SelectShadowHdl_Impl, ListBox&, void) { ModifyShadowHdl_Impl(*m_pMtrTransparent); } - IMPL_LINK_NOARG(SvxShadowTabPage, ModifyShadowHdl_Impl, Edit&, void) { if( m_pTsbShowShadow->GetState() == TRISTATE_TRUE ) @@ -477,7 +500,11 @@ IMPL_LINK_NOARG(SvxShadowTabPage, ModifyShadowHdl_Impl, Edit&, void) else m_rXFSet.Put( XFillStyleItem( drawing::FillStyle_NONE ) ); - m_rXFSet.Put( XFillColorItem( OUString(), m_pLbShadowColor->GetSelectEntryColor() ) ); + sal_Int32 nPos = m_pLbShadowColor->GetSelectEntryPos(); + if( nPos != LISTBOX_ENTRY_NOTFOUND ) + { + m_rXFSet.Put( XFillColorItem( OUString(), m_pLbShadowColor->GetSelectEntryColor() ) ); + } sal_uInt16 nVal = (sal_uInt16)m_pMtrTransparent->GetValue(); XFillTransparenceItem aItem( nVal ); m_rXFSet.Put( XFillTransparenceItem( aItem ) ); @@ -526,6 +553,7 @@ 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 2a3265cde146..c783d268396a 100644 --- a/cui/uiconfig/ui/borderpage.ui +++ b/cui/uiconfig/ui/borderpage.ui @@ -233,7 +233,7 @@ </packing> </child> <child> - <object class="svxlo-SvxColorListBox" id="linecolorlb"> + <object class="svtlo-ColorListBox" id="linecolorlb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -505,7 +505,7 @@ </packing> </child> <child> - <object class="svxlo-SvxColorListBox" id="shadowcolorlb"> + <object class="svtlo-ColorListBox" 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 f4dd177a3c3d..d03daf7c34fd 100644 --- a/cui/uiconfig/ui/colorconfigwin.ui +++ b/cui/uiconfig/ui/colorconfigwin.ui @@ -38,7 +38,7 @@ </packing> </child> <child> - <object class="svxlo-SvxColorListBox" id="doccolor_lb"> + <object class="svtlo-ColorListBox" id="doccolor_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -72,7 +72,7 @@ </packing> </child> <child> - <object class="svxlo-SvxColorListBox" id="docboundaries_lb"> + <object class="svtlo-ColorListBox" id="docboundaries_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -98,7 +98,7 @@ </packing> </child> <child> - <object class="svxlo-SvxColorListBox" id="appback_lb"> + <object class="svtlo-ColorListBox" id="appback_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -148,7 +148,7 @@ </packing> </child> <child> - <object class="svxlo-SvxColorListBox" id="objboundaries_lb"> + <object class="svtlo-ColorListBox" id="objboundaries_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -185,7 +185,7 @@ </packing> </child> <child> - <object class="svxlo-SvxColorListBox" id="tblboundaries_lb"> + <object class="svtlo-ColorListBox" id="tblboundaries_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -220,7 +220,7 @@ </packing> </child> <child> - <object class="svxlo-SvxColorListBox" id="font_lb"> + <object class="svtlo-ColorListBox" id="font_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -257,7 +257,7 @@ </packing> </child> <child> - <object class="svxlo-SvxColorListBox" id="unvisitedlinks_lb"> + <object class="svtlo-ColorListBox" id="unvisitedlinks_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -294,7 +294,7 @@ </packing> </child> <child> - <object class="svxlo-SvxColorListBox" id="visitedlinks_lb"> + <object class="svtlo-ColorListBox" id="visitedlinks_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -354,7 +354,7 @@ </packing> </child> <child> - <object class="svxlo-SvxColorListBox" id="autospellcheck_lb"> + <object class="svtlo-ColorListBox" id="autospellcheck_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -364,7 +364,7 @@ </packing> </child> <child> - <object class="svxlo-SvxColorListBox" id="shadows_lb"> + <object class="svtlo-ColorListBox" id="shadows_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -374,7 +374,7 @@ </packing> </child> <child> - <object class="svxlo-SvxColorListBox" id="smarttags_lb"> + <object class="svtlo-ColorListBox" id="smarttags_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -400,7 +400,7 @@ </packing> </child> <child> - <object class="svxlo-SvxColorListBox" id="writergrid_lb"> + <object class="svtlo-ColorListBox" id="writergrid_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -435,7 +435,7 @@ </packing> </child> <child> - <object class="svxlo-SvxColorListBox" id="field_lb"> + <object class="svtlo-ColorListBox" id="field_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -457,7 +457,7 @@ </packing> </child> <child> - <object class="svxlo-SvxColorListBox" id="index_lb"> + <object class="svtlo-ColorListBox" id="index_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -479,7 +479,7 @@ </packing> </child> <child> - <object class="svxlo-SvxColorListBox" id="script_lb"> + <object class="svtlo-ColorListBox" id="script_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -559,7 +559,7 @@ </packing> </child> <child> - <object class="svxlo-SvxColorListBox" id="section_lb"> + <object class="svtlo-ColorListBox" id="section_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -581,7 +581,7 @@ </packing> </child> <child> - <object class="svxlo-SvxColorListBox" id="hdft_lb"> + <object class="svtlo-ColorListBox" id="hdft_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -616,7 +616,7 @@ </packing> </child> <child> - <object class="svxlo-SvxColorListBox" id="pagebreak_lb"> + <object class="svtlo-ColorListBox" id="pagebreak_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -651,7 +651,7 @@ </packing> </child> <child> - <object class="svxlo-SvxColorListBox" id="direct_lb"> + <object class="svtlo-ColorListBox" id="direct_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -702,7 +702,7 @@ </packing> </child> <child> - <object class="svxlo-SvxColorListBox" id="sgml_lb"> + <object class="svtlo-ColorListBox" id="sgml_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -737,7 +737,7 @@ </packing> </child> <child> - <object class="svxlo-SvxColorListBox" id="htmlcomment_lb"> + <object class="svtlo-ColorListBox" id="htmlcomment_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -772,7 +772,7 @@ </packing> </child> <child> - <object class="svxlo-SvxColorListBox" id="htmlkeyword_lb"> + <object class="svtlo-ColorListBox" id="htmlkeyword_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -807,7 +807,7 @@ </packing> </child> <child> - <object class="svxlo-SvxColorListBox" id="unknown_lb"> + <object class="svtlo-ColorListBox" id="unknown_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -858,7 +858,7 @@ </packing> </child> <child> - <object class="svxlo-SvxColorListBox" id="calcgrid_lb"> + <object class="svtlo-ColorListBox" id="calcgrid_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -893,7 +893,7 @@ </packing> </child> <child> - <object class="svxlo-SvxColorListBox" id="brk_lb"> + <object class="svtlo-ColorListBox" id="brk_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -928,7 +928,7 @@ </packing> </child> <child> - <object class="svxlo-SvxColorListBox" id="brkmanual_lb"> + <object class="svtlo-ColorListBox" id="brkmanual_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -963,7 +963,7 @@ </packing> </child> <child> - <object class="svxlo-SvxColorListBox" id="brkauto_lb"> + <object class="svtlo-ColorListBox" id="brkauto_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -998,7 +998,7 @@ </packing> </child> <child> - <object class="svxlo-SvxColorListBox" id="det_lb"> + <object class="svtlo-ColorListBox" id="det_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -1033,7 +1033,7 @@ </packing> </child> <child> - <object class="svxlo-SvxColorListBox" id="deterror_lb"> + <object class="svtlo-ColorListBox" id="deterror_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -1068,7 +1068,7 @@ </packing> </child> <child> - <object class="svxlo-SvxColorListBox" id="ref_lb"> + <object class="svtlo-ColorListBox" id="ref_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -1103,7 +1103,7 @@ </packing> </child> <child> - <object class="svxlo-SvxColorListBox" id="notes_lb"> + <object class="svtlo-ColorListBox" id="notes_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -1154,7 +1154,7 @@ </packing> </child> <child> - <object class="svxlo-SvxColorListBox" id="drawgrid_lb"> + <object class="svtlo-ColorListBox" id="drawgrid_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -1205,7 +1205,7 @@ </packing> </child> <child> - <object class="svxlo-SvxColorListBox" id="basicid_lb"> + <object class="svtlo-ColorListBox" id="basicid_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -1240,7 +1240,7 @@ </packing> </child> <child> - <object class="svxlo-SvxColorListBox" id="basiccomment_lb"> + <object class="svtlo-ColorListBox" id="basiccomment_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -1275,7 +1275,7 @@ </packing> </child> <child> - <object class="svxlo-SvxColorListBox" id="basicnumber_lb"> + <object class="svtlo-ColorListBox" id="basicnumber_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -1310,7 +1310,7 @@ </packing> </child> <child> - <object class="svxlo-SvxColorListBox" id="basicstring_lb"> + <object class="svtlo-ColorListBox" id="basicstring_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -1345,7 +1345,7 @@ </packing> </child> <child> - <object class="svxlo-SvxColorListBox" id="basicop_lb"> + <object class="svtlo-ColorListBox" id="basicop_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -1380,7 +1380,7 @@ </packing> </child> <child> - <object class="svxlo-SvxColorListBox" id="basickeyword_lb"> + <object class="svtlo-ColorListBox" id="basickeyword_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -1415,7 +1415,7 @@ </packing> </child> <child> - <object class="svxlo-SvxColorListBox" id="error_lb"> + <object class="svtlo-ColorListBox" id="error_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -1466,7 +1466,7 @@ </packing> </child> <child> - <object class="svxlo-SvxColorListBox" id="sqlid_lb"> + <object class="svtlo-ColorListBox" id="sqlid_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -1501,7 +1501,7 @@ </packing> </child> <child> - <object class="svxlo-SvxColorListBox" id="sqlnumber_lb"> + <object class="svtlo-ColorListBox" id="sqlnumber_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -1536,7 +1536,7 @@ </packing> </child> <child> - <object class="svxlo-SvxColorListBox" id="sqlstring_lb"> + <object class="svtlo-ColorListBox" id="sqlstring_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -1571,7 +1571,7 @@ </packing> </child> <child> - <object class="svxlo-SvxColorListBox" id="sqlop_lb"> + <object class="svtlo-ColorListBox" id="sqlop_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -1606,7 +1606,7 @@ </packing> </child> <child> - <object class="svxlo-SvxColorListBox" id="sqlkeyword_lb"> + <object class="svtlo-ColorListBox" id="sqlkeyword_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -1641,7 +1641,7 @@ </packing> </child> <child> - <object class="svxlo-SvxColorListBox" id="sqlparam_lb"> + <object class="svtlo-ColorListBox" id="sqlparam_lb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -1676,7 +1676,7 @@ </packing> </child> <child> - <object class="svxlo-SvxColorListBox" id="sqlcomment_lb"> + <object class="svtlo-ColorListBox" 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 46a42cd15e09..1e9171cae8ad 100644 --- a/cui/uiconfig/ui/effectspage.ui +++ b/cui/uiconfig/ui/effectspage.ui @@ -324,7 +324,7 @@ </packing> </child> <child> - <object class="svxlo-SvxColorListBox" id="fontcolorlb"> + <object class="svtlo-ColorListBox" id="fontcolorlb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -389,7 +389,7 @@ </packing> </child> <child> - <object class="svxlo-SvxColorListBox" id="underlinecolorlb"> + <object class="svtlo-ColorListBox" id="underlinecolorlb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -399,7 +399,7 @@ </packing> </child> <child> - <object class="svxlo-SvxColorListBox" id="overlinecolorlb"> + <object class="svtlo-ColorListBox" 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 b36b8d7aa678..8ab982badffd 100644 --- a/cui/uiconfig/ui/gradientpage.ui +++ b/cui/uiconfig/ui/gradientpage.ui @@ -450,7 +450,7 @@ </packing> </child> <child> - <object class="svxlo-SvxColorListBox" id="colorfromlb"> + <object class="svxlo-ColorLB" 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-SvxColorListBox" id="colortolb"> + <object class="svxlo-ColorLB" 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 f3098001b63a..fd12b3e547f7 100644 --- a/cui/uiconfig/ui/hatchpage.ui +++ b/cui/uiconfig/ui/hatchpage.ui @@ -266,7 +266,7 @@ </packing> </child> <child> - <object class="svxlo-SvxColorListBox" id="linecolorlb"> + <object class="svxlo-ColorLB" id="linecolorlb"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -292,7 +292,7 @@ </packing> </child> <child> - <object class="svxlo-SvxColorListBox" id="backgroundcolorlb"> + <object class="svxlo-ColorLB" 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 a70a0ae7bed9..0060a6fef564 100644 --- a/cui/uiconfig/ui/linetabpage.ui +++ b/cui/uiconfig/ui/linetabpage.ui @@ -156,7 +156,7 @@ </packing> </child> <child> - <object class="svxlo-SvxColorListBox" id="LB_COLOR"> + <object class="svxlo-ColorLB" 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 76b609fba613..71f392aab6df 100644 --- a/cui/uiconfig/ui/numberingoptionspage.ui +++ b/cui/uiconfig/ui/numberingoptionspage.ui @@ -485,7 +485,7 @@ </packing> </child> <child> - <object class="svxlo-SvxColorListBox" id="color"> + <object class="svtlo-ColorListBox" 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 3d1fc1a40b83..3cadc55c6bec 100644 --- a/cui/uiconfig/ui/optchartcolorspage.ui +++ b/cui/uiconfig/ui/optchartcolorspage.ui @@ -26,7 +26,8 @@ <property name="top_padding">6</property> <property name="left_padding">12</property> <child> - <object class="GtkTreeView" id="colors:border"> + <object class="svxlo-ColorLB" id="colors:border"> + <property name="dropdown">False</property> <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 07edfc9e1f22..03bfe52c374e 100644 --- a/cui/uiconfig/ui/patterntabpage.ui +++ b/cui/uiconfig/ui/patterntabpage.ui @@ -185,7 +185,7 @@ </packing> </child> <child> - <object class="svxlo-SvxColorListBox" id="LB_COLOR"> + <object class="svxlo-ColorLB" 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-SvxColorListBox" id="LB_BACKGROUND_COLOR"> + <object class="svxlo-ColorLB" 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 74ad9de4df4a..de63629337d3 100644 --- a/cui/uiconfig/ui/shadowtabpage.ui +++ b/cui/uiconfig/ui/shadowtabpage.ui @@ -99,7 +99,7 @@ </packing> </child> <child> - <object class="svxlo-SvxColorListBox" id="LB_SHADOW_COLOR"> + <object class="svxlo-ColorLB" 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 6e9cb6be093d..745880465b52 100644 --- a/extensions/source/propctrlr/commoncontrol.cxx +++ b/extensions/source/propctrlr/commoncontrol.cxx @@ -104,11 +104,6 @@ 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 0d46aaa5bcce..05771dd061f3 100644 --- a/extensions/source/propctrlr/commoncontrol.hxx +++ b/extensions/source/propctrlr/commoncontrol.hxx @@ -32,7 +32,6 @@ class NotifyEvent; class Control; class ListBox; -class SvxColorListBox; class Edit; namespace pcr @@ -91,7 +90,6 @@ 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 ); @@ -152,9 +150,8 @@ namespace pcr inline void impl_checkDisposed_throw(); private: VclPtr<TControlWindow> m_pControlWindow; - void implSetModifyHandler(const Edit&); - void implSetModifyHandler(const ListBox&); - void implSetModifyHandler(const SvxColorListBox&); + void implSetModifyHandler(std::true_type); + void implSetModifyHandler(std::false_type); }; @@ -168,7 +165,7 @@ namespace pcr { if ( _bDoSetHandlers ) { - implSetModifyHandler(*m_pControlWindow); + implSetModifyHandler(std::is_base_of<::Edit,TControlWindow>()); m_pControlWindow->SetGetFocusHdl( LINK( this, CommonBehaviourControlHelper, GetFocusHdl ) ); m_pControlWindow->SetLoseFocusHdl( LINK( this, CommonBehaviourControlHelper, LoseFocusHdl ) ); } @@ -176,24 +173,18 @@ namespace pcr } template< class TControlInterface, class TControlWindow > - inline void CommonBehaviourControl< TControlInterface, TControlWindow >::implSetModifyHandler(const Edit&) + inline void CommonBehaviourControl< TControlInterface, TControlWindow >::implSetModifyHandler(std::true_type) { m_pControlWindow->SetModifyHdl( LINK( this, CommonBehaviourControlHelper, EditModifiedHdl ) ); } template< class TControlInterface, class TControlWindow > - inline void CommonBehaviourControl< TControlInterface, TControlWindow >::implSetModifyHandler(const ListBox&) + inline void CommonBehaviourControl< TControlInterface, TControlWindow >::implSetModifyHandler(std::false_type) { 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 7d422966aff4..ca2412f9dbad 100644 --- a/extensions/source/propctrlr/standardcontrol.cxx +++ b/extensions/source/propctrlr/standardcontrol.cxx @@ -657,50 +657,141 @@ 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; - _rValue >>= nColor; - ::Color aRgbCol((ColorData)nColor); - getTypedControlWindow()->SelectEntry(std::make_pair(aRgbCol, MakeHexStr(nColor, 8))); + 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(); + } } else getTypedControlWindow()->SetNoSelection(); } + Any SAL_CALL OColorControl::getValue() throw (RuntimeException, std::exception) { Any aPropValue; - if (!getTypedControlWindow()->IsNoSelection()) + if ( getTypedControlWindow()->GetSelectEntryCount() > 0 ) { - ::Color aRgbCol = getTypedControlWindow()->GetSelectEntryColor(); - aPropValue <<= (css::util::Color)aRgbCol.GetColor(); + 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(); + } } 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(); - // fire a commit - notifyModifiedValue(); + if ( !getTypedControlWindow()->IsTravelSelect() ) + // 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 d3f64e703276..ab026d6e2ec4 100644 --- a/extensions/source/propctrlr/standardcontrol.hxx +++ b/extensions/source/propctrlr/standardcontrol.hxx @@ -34,7 +34,6 @@ #include <vcl/combobox.hxx> #include <svtools/calendar.hxx> #include <svtools/fmtfield.hxx> -#include <svx/colorbox.hxx> #include <set> @@ -61,18 +60,18 @@ namespace pcr TListboxWindow::SetSelectHdl( LINK(this, ListLikeControlWithModifyHandler, OnSelect) ); } - void SetModifyHdl( const Link<TListboxWindow&,void>& _rLink ) { aModifyHdl = _rLink;; } + void SetModifyHdl( const Link<ListBox&,void>& _rLink ) { aModifyHdl = _rLink;; } private: - DECL_LINK(OnSelect, TListboxWindow&, void); - Link<TListboxWindow&,void> aModifyHdl; + DECL_LINK(OnSelect, ListBox&, void); + Link<ListBox&,void> aModifyHdl; }; template< class LISTBOX_WINDOW > - void ListLikeControlWithModifyHandler< LISTBOX_WINDOW >::LinkStubOnSelect(void * instance, LISTBOX_WINDOW& data) { + void ListLikeControlWithModifyHandler< LISTBOX_WINDOW >::LinkStubOnSelect(void * instance, ListBox& data) { return static_cast<ListLikeControlWithModifyHandler< LISTBOX_WINDOW > *>(instance)->OnSelect(data); } template< class LISTBOX_WINDOW > - void ListLikeControlWithModifyHandler< LISTBOX_WINDOW >::OnSelect(LISTBOX_WINDOW& rListBox) + void ListLikeControlWithModifyHandler< LISTBOX_WINDOW >::OnSelect(ListBox& rListBox) { aModifyHdl.Call(rListBox); } @@ -261,11 +260,14 @@ namespace pcr //= OColorControl - typedef CommonBehaviourControl < css::inspection::XPropertyControl - , ListLikeControlWithModifyHandler<SvxColorListBox> + typedef CommonBehaviourControl < css::inspection::XStringListControl + , ListLikeControlWithModifyHandler< ColorListBox > > OColorControl_Base; class OColorControl : public OColorControl_Base { + private: + ::std::set< OUString > m_aNonColorEntries; + public: OColorControl( vcl::Window* pParent, WinBits nWinStyle ); @@ -274,6 +276,12 @@ 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 84a0558def61..b19f135e738d 100644 --- a/extras/source/glade/libreoffice-catalog.xml.in +++ b/extras/source/glade/libreoffice-catalog.xml.in @@ -94,11 +94,29 @@ </properties> </glade-widget-class> - <glade-widget-class title="Color ListBox" name="svxlo-ColorListBox" - generic-name="Color ListBox" parent="GtkComboBox" + <glade-widget-class title="Svt Color ListBox" name="svtlo-ColorListBox" + generic-name="Svt 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 1e4a2c8f28f2..079258dbfc1a 100644 --- a/include/sfx2/controlwrapper.hxx +++ b/include/sfx2/controlwrapper.hxx @@ -115,7 +115,7 @@ private: | +- DummyWindowWrapper [1] | +- CheckBoxWrapper [1] | +- EditWrapper [1] - | +- SvxColorListBoxWrapper [1] + | +- ColorListBoxWrapper [1] | | | +- MetricFieldWrapper< ValueT > [1] | | | @@ -241,6 +241,26 @@ 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 cb5e29d8ada3..c1ad071123eb 100644 --- a/include/svtools/ctrlbox.hxx +++ b/include/svtools/ctrlbox.hxx @@ -33,13 +33,26 @@ #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 @@ -128,6 +141,75 @@ 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 c149f8643c31..92cc8092ab7d 100644 --- a/include/svtools/svtools.hrc +++ b/include/svtools/svtools.hrc @@ -26,6 +26,8 @@ // 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 2347f0f65ef5..c527b85f0f88 100644 --- a/include/svx/PaletteManager.hxx +++ b/include/svx/PaletteManager.hxx @@ -48,10 +48,11 @@ class SVX_DLLPUBLIC PaletteManager XColorListRef pColorList; Color mLastColor; - std::deque<NamedColor> maRecentColors; + typedef std::pair<Color, OUString> color_and_name; + std::deque<color_and_name> maRecentColors; std::vector<std::unique_ptr<Palette>> m_Palettes; - std::function<void(const OUString&, const NamedColor&)> maColorSelectFunction; + std::function<void(const OUString&, const Color&)> maColorSelectFunction; css::uno::Reference < css::uno::XComponentContext > m_context; public: PaletteManager(); @@ -73,14 +74,14 @@ public: const Color& GetLastColor(); void SetLastColor(const Color& rLastColor); - void AddRecentColor(const Color& rRecentColor, const OUString& rColorName, bool bFront = true); + void AddRecentColor(const Color& rRecentColor, const OUString& rColorName); void SetBtnUpdater(svx::ToolboxButtonColorUpdater* pBtnUpdater); void PopupColorPicker(const OUString& aCommand); - void SetColorSelectFunction(const std::function<void(const OUString&, const NamedColor&)>& aColorSelectFunction); + void SetColorSelectFunction(const std::function<void(const OUString&, const Color&)>& aColorSelectFunction); - static void DispatchColorCommand(const OUString& aCommand, const NamedColor& rColor); + static void DispatchColorCommand(const OUString& aCommand, const Color& rColor); }; #endif // INCLUDED_SVX_PALETTEMANAGER_HXX diff --git a/include/svx/bmpmask.hxx b/include/svx/bmpmask.hxx index 6705b1c5fe5b..1f66ee5ef7b5 100644 --- a/include/svx/bmpmask.hxx +++ b/include/svx/bmpmask.hxx @@ -75,7 +75,6 @@ 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 { @@ -89,27 +88,28 @@ class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxBmpMask : public SfxDockingWindow VclPtr<CheckBox> m_pCbx1; VclPtr<MaskSet> m_pQSet1; VclPtr<MetricField> m_pSp1; - VclPtr<SvxColorListBox> m_pLbColor1; + VclPtr<ColorLB> m_pLbColor1; VclPtr<CheckBox> m_pCbx2; VclPtr<MaskSet> m_pQSet2; VclPtr<MetricField> m_pSp2; - VclPtr<SvxColorListBox> m_pLbColor2; + VclPtr<ColorLB> m_pLbColor2; VclPtr<CheckBox> m_pCbx3; VclPtr<MaskSet> m_pQSet3; VclPtr<MetricField> m_pSp3; - VclPtr<SvxColorListBox> m_pLbColor3; + VclPtr<ColorLB> m_pLbColor3; VclPtr<CheckBox> m_pCbx4; VclPtr<MaskSet> m_pQSet4; VclPtr<MetricField> m_pSp4; - VclPtr<SvxColorListBox> m_pLbColor4; + VclPtr<ColorLB> m_pLbColor4; MaskData* pData; VclPtr<CheckBox> m_pCbxTrans; - VclPtr<SvxColorListBox> m_pLbColorTrans; + VclPtr<ColorLB> m_pLbColorTrans; + XColorListRef pColLst; Color aPipetteColor; SvxBmpMaskSelectItem aSelItem; @@ -140,6 +140,9 @@ 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 deleted file mode 100644 index 4b7f2513a984..000000000000 --- a/include/svx/colorbox.hxx +++ /dev/null @@ -1,94 +0,0 @@ -/* -*- 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 1e417130effb..8b185d952de3 100644 --- a/include/svx/colorwindow.hxx +++ b/include/svx/colorwindow.hxx @@ -31,22 +31,8 @@ #include <functional> -class SVX_DLLPUBLIC BorderColorStatus -{ - Color maColor; - Color maTLBRColor; - Color maBLTRColor; -public: - BorderColorStatus(); - ~BorderColorStatus(); - bool statusChanged( const css::frame::FeatureStateEvent& rEvent ); - Color GetColor(); -}; - +class BorderColorStatus; 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 { @@ -57,49 +43,37 @@ private: VclPtr<ListBox> mpPaletteListBox; VclPtr<PushButton> mpButtonAutoColor; - VclPtr<PushButton> mpButtonNoneColor; VclPtr<PushButton> mpButtonPicker; VclPtr<FixedLine> mpAutomaticSeparator; OUString maCommand; - Link<const NamedColor&, void> maSelectedLink; + Link<const Color&, void> maSelectedLink; PaletteManager& mrPaletteManager; BorderColorStatus& mrBorderColorStatus; - ColorSelectFunction maColorSelectFunction; + std::function<void(const OUString&, const Color&)> 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, - ColorSelectFunction const& rColorSelectFunction); + 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); 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 NamedColor&, void>& rLink ) { maSelectedLink = rLink; } + void SetSelectedHdl( const Link<const Color&, void>& rLink ) { maSelectedLink = rLink; } }; #endif diff --git a/include/svx/dialogs.hrc b/include/svx/dialogs.hrc index 589b6a8a7413..3ccea55d2a4a 100644 --- a/include/svx/dialogs.hrc +++ b/include/svx/dialogs.hrc @@ -31,10 +31,8 @@ // some strings also used in CUI #define RID_SVXERRCTX (RID_SVX_START + 351) #define RID_SVXSTR_COLOR (RID_SVX_START + 179) -#define RID_SVXSTR_NOFILL (RID_SVX_START + 190) +#define RID_SVXSTR_TRANSPARENT (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) @@ -149,6 +147,9 @@ #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 39cc688b4ded..fbf9369eb608 100644 --- a/include/svx/dlgctrl.hxx +++ b/include/svx/dlgctrl.hxx @@ -207,6 +207,20 @@ 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: @@ -231,7 +245,7 @@ public: /************************************************************************/ -class SAL_WARN_UNUSED SVX_DLLPUBLIC FillAttrLB : public ListBox +class SAL_WARN_UNUSED SVX_DLLPUBLIC FillAttrLB : public ColorListBox { private: BitmapEx maBitmapEx; diff --git a/include/svx/float3d.hxx b/include/svx/float3d.hxx index 396d104a9f53..c9a9f957701c 100644 --- a/include/svx/float3d.hxx +++ b/include/svx/float3d.hxx @@ -41,13 +41,14 @@ enum class ViewType3D Material }; +class SdrModel; class FmFormModel; class VirtualDevice; class E3dView; class SdrPageView; class Svx3DCtrlItem; class SvxConvertTo3DItem; -class SvxColorListBox; + struct Svx3DWinImpl; @@ -112,16 +113,16 @@ private: VclPtr<PushButton> m_pBtnLight6; VclPtr<PushButton> m_pBtnLight7; VclPtr<PushButton> m_pBtnLight8; - 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<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<PushButton> m_pBtnLightColor; - VclPtr<SvxColorListBox> m_pLbAmbientlight; // ListBox + VclPtr<ColorLB> m_pLbAmbientlight; // ListBox VclPtr<PushButton> m_pBtnAmbientColor; // color button // Textures @@ -143,13 +144,13 @@ private: // material editor VclPtr<VclContainer> m_pFLMaterial; VclPtr<ListBox> m_pLbMatFavorites; - VclPtr<SvxColorListBox> m_pLbMatColor; + VclPtr<ColorLB> m_pLbMatColor; VclPtr<PushButton> m_pBtnMatColor; - VclPtr<SvxColorListBox> m_pLbMatEmission; + VclPtr<ColorLB> m_pLbMatEmission; VclPtr<PushButton> m_pBtnEmissionColor; VclPtr<VclContainer> m_pFLMatSpecular; - VclPtr<SvxColorListBox> m_pLbMatSpecular; + VclPtr<ColorLB> m_pLbMatSpecular; VclPtr<PushButton> m_pBtnSpecularColor; VclPtr<MetricField> m_pMtrMatSpecularIntensity; @@ -190,7 +191,6 @@ 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 void LBSelectColor( SvxColorListBox* pLb, const Color& rColor ); + SVX_DLLPRIVATE static bool LBSelectColor( ColorLB* pLb, const Color& rColor ); SVX_DLLPRIVATE sal_uInt16 GetLightSource( const PushButton* pBtn ); - SVX_DLLPRIVATE SvxColorListBox* GetLbByButton( const PushButton* pBtn = nullptr ); + SVX_DLLPRIVATE ColorLB* 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(); + void InitColorLB( const SdrModel* pDoc ); bool IsUpdateMode() const { return bUpdate; } void Update( SfxItemSet& rSet ); diff --git a/include/svx/fontwork.hxx b/include/svx/fontwork.hxx index 83d1f3c11ec3..5fe6ad0f7eb3 100644 --- a/include/svx/fontwork.hxx +++ b/include/svx/fontwork.hxx @@ -35,7 +35,6 @@ class SdrView; class SdrPageView; class SdrObject; -class SvxColorListBox; class XFormTextAdjustItem; class XFormTextDistanceItem; @@ -108,7 +107,7 @@ class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxFontWorkDialog : public SfxDockingWindow VclPtr<FixedImage> m_pFbShadowY; VclPtr<MetricField> m_pMtrFldShadowY; - VclPtr<SvxColorListBox> m_pShadowColorLB; + VclPtr<ColorLB> m_pShadowColorLB; SfxBindings& rBindings; Idle aInputIdle; @@ -139,6 +138,8 @@ class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxFontWorkDialog : public SfxDockingWindow long nSaveShadowAngle; long nSaveShadowSize; + XColorListRef pColorList; + friend class SvxFontWorkChildWindow; friend class SvxFontWorkControllerItem; @@ -149,7 +150,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, SvxColorListBox&, void ); + DECL_LINK( ColorSelectHdl_Impl, ListBox&, void ); void SetStyle_Impl(const XFormTextStyleItem*); void SetAdjust_Impl(const XFormTextAdjustItem*); @@ -174,6 +175,8 @@ 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 372d216f68ba..9d7e62199f3e 100644 --- a/include/svx/sidebar/AreaPropertyPanelBase.hxx +++ b/include/svx/sidebar/AreaPropertyPanelBase.hxx @@ -25,7 +25,6 @@ #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> @@ -125,8 +124,8 @@ protected: VclPtr<FixedText> mpColorTextFT; VclPtr<SvxFillTypeBox> mpLbFillType; VclPtr<SvxFillAttrBox> mpLbFillAttr; - VclPtr<SvxColorListBox> mpLbFillGradFrom; - VclPtr<SvxColorListBox> mpLbFillGradTo; + VclPtr<ColorLB> mpLbFillGradFrom; + VclPtr<ColorLB> mpLbFillGradTo; VclPtr<sfx2::sidebar::SidebarToolBox> mpToolBoxColor; // for new color picker VclPtr<FixedText> mpTrspTextFT; VclPtr<ListBox> mpLBTransType; @@ -157,7 +156,6 @@ 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 8a7f7c5fc4c5..f2a301c63797 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,11 +999,9 @@ #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_BMPMASK_COLOR + 1 ) +#define SID_SVX_FIRSTFREE ( SID_DRAW_MEASURELINE + 1 ) // Overflow check for slot IDs diff --git a/include/svx/tbcontrl.hxx b/include/svx/tbcontrl.hxx index bf808381c6ac..dfa129a7c00b 100644 --- a/include/svx/tbcontrl.hxx +++ b/include/svx/tbcontrl.hxx @@ -136,7 +136,6 @@ #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> @@ -204,8 +203,19 @@ friend class SfxStyleControllerItem_Impl; SVX_DLLPRIVATE SfxStyleFamily GetActFamily(); }; -typedef std::function<void(const OUString&, const NamedColor&)> ColorSelectFunction; +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 Color&)> ColorSelectFunction; class SVX_DLLPUBLIC SvxColorToolBoxControl : public SfxToolBoxControl { std::unique_ptr<svx::ToolboxButtonColorUpdater> m_xBtnUpdater; @@ -213,7 +223,7 @@ class SVX_DLLPUBLIC SvxColorToolBoxControl : public SfxToolBoxControl BorderColorStatus m_aBorderColorStatus; bool m_bSplitButton; ColorSelectFunction m_aColorSelectFunction; - DECL_LINK(SelectedHdl, const NamedColor&, void); + DECL_LINK(SelectedHdl, const Color&, 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 38102f399e38..7e57bba1525a 100644 --- a/reportdesign/inc/RptResId.hrc +++ b/reportdesign/inc/RptResId.hrc @@ -108,6 +108,10 @@ #define STR_SHOW_RULER ( RID_STRING_START + 63 ) #define STR_SHOW_GRID ( RID_STRING_START + 64 ) +#define STR_COLOR_WHITE ( RID_STRING_START + 65 ) +#define STR_CHARCOLOR ( RID_STRING_START + 66 ) +#define STR_CHARBACKGROUND ( RID_STRING_START + 67 ) +#define STR_TRANSPARENT ( RID_STRING_START + 68 ) #define RID_STR_FIELDSELECTION ( RID_STRING_START + 69 ) #define RID_STR_UNDO_ADD_GROUP_HEADER ( RID_STRING_START + 70 ) diff --git a/reportdesign/inc/helpids.hrc b/reportdesign/inc/helpids.hrc index aaa488316fe4..ed179679859c 100644 --- a/reportdesign/inc/helpids.hrc +++ b/reportdesign/inc/helpids.hrc @@ -31,6 +31,7 @@ #define HID_RPT_HORZ_SCROLLBAR "REPORTDESIGN_HID_RPT_HORZ_SCROLLBAR" #define HID_RPT_VERT_SCROLLBAR "REPORTDESIGN_HID_RPT_VERT_SCROLLBAR" #define HID_RPT_FIELDEXPRESSION "REPORTDESIGN_HID_RPT_FIELDEXPRESSION" +#define HID_RPT_POPUP_COLOR_CTRL "REPORTDESIGN_HID_RPT_POPUP_COLOR_CTRL" #define HID_RPT_POPUP_COLOR "REPORTDESIGN_HID_RPT_POPUP_COLOR" #define HID_RPT_FIELD_SEL "REPORTDESIGN_HID_RPT_FIELD_SEL" #define HID_RPT_FIELD_SEL_WIN "REPORTDESIGN_HID_RPT_FIELD_SEL_WIN" diff --git a/reportdesign/source/ui/dlg/CondFormat.src b/reportdesign/source/ui/dlg/CondFormat.src index ecf70cae59fd..e8f16c42975c 100644 --- a/reportdesign/source/ui/dlg/CondFormat.src +++ b/reportdesign/source/ui/dlg/CondFormat.src @@ -24,5 +24,21 @@ String STR_NUMBERED_CONDITION { Text [ en-US ] = "Condition $number$"; }; +String STR_COLOR_WHITE +{ + Text [ en-US ] = "White" ; +}; +String STR_CHARCOLOR +{ + Text [ en-US ] = "Font color" ; +}; +String STR_CHARBACKGROUND +{ + Text [ en-US ] = "Background"; +}; +String STR_TRANSPARENT +{ + Text [ en-US ] = "No Fill" ; +}; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/ui/dlg/Condition.cxx b/reportdesign/source/ui/dlg/Condition.cxx index 4632306d7b5e..3a216d81ea84 100644 --- a/reportdesign/source/ui/dlg/Condition.cxx +++ b/reportdesign/source/ui/dlg/Condition.cxx @@ -84,34 +84,144 @@ IMPL_LINK( ConditionField, OnFormula, Button*, _pClickedButton, void ) } } -ConditionColorWrapper::ConditionColorWrapper(Condition* pControl) - : mxControl(pControl) - , mnSlotId(0) +// TO-DO, this is yet another color selector, can it be replaced with SvxColorWindor/SvxColorToolBoxControl ? +#ifndef WB_NO_DIRECTSELECT +#define WB_NO_DIRECTSELECT ((WinBits)0x04000000) +#endif + +#define PALETTE_X 10 +#define PALETTE_Y 10 +#define PALETTE_SIZE (PALETTE_X * PALETTE_Y) +class OColorPopup : public FloatingWindow { + DECL_LINK( SelectHdl, ValueSet*, void ); + VclPtr<Condition> m_pCondition; + sal_uInt16 m_nSlotId; +public: + OColorPopup(vcl::Window* _pParent,Condition* _pCondition); + virtual ~OColorPopup() override; + virtual void dispose() override; + VclPtr<ValueSet> m_aColorSet; + + virtual void KeyInput( const KeyEvent& rKEvt ) override; + virtual void Resize() override; + + void StartSelection(); + void SetSlotId(sal_uInt16 _nSlotId); +}; + +OColorPopup::OColorPopup(vcl::Window* _pParent,Condition* _pCondition) +:FloatingWindow(_pParent, WinBits( WB_BORDER | WB_STDFLOATWIN | WB_3DLOOK|WB_DIALOGCONTROL )) +,m_pCondition(_pCondition) +,m_nSlotId(0) +,m_aColorSet( VclPtr<ValueSet>::Create(this, WinBits( WB_ITEMBORDER | WB_NAMEFIELD | WB_3DLOOK | WB_NO_DIRECTSELECT)) ) +{ + m_aColorSet->SetHelpId( HID_RPT_POPUP_COLOR_CTRL ); + SetHelpId( HID_RPT_POPUP_COLOR ); + const Size aSize12( 13, 13 ); + short i = 0; + XColorListRef pColorList( XColorList::CreateStdColorList() ); + long nCount = pColorList->Count(); + Color aColWhite( COL_WHITE ); + OUString aStrWhite( ModuleRes(STR_COLOR_WHITE) ); + + if ( nCount > PALETTE_SIZE ) + // Show scrollbar if more than PALLETTE_SIZE colors are available + m_aColorSet->SetStyle( m_aColorSet->GetStyle() | WB_VSCROLL ); + + for ( i = 0; i < nCount; i++ ) + { + const XColorEntry* pEntry = pColorList->GetColor(i); + m_aColorSet->InsertItem( i+1, pEntry->GetColor(), pEntry->GetName() ); + } + + while ( i < PALETTE_SIZE ) + { + // fill empty elements if less then PALLETTE_SIZE colors are available + m_aColorSet->InsertItem( i+1, aColWhite, aStrWhite ); + i++; + } + + m_aColorSet->SetSelectHdl( LINK( this, OColorPopup, SelectHdl ) ); + m_aColorSet->SetColCount( PALETTE_X ); + m_aColorSet->SetLineCount( PALETTE_Y ); + Size aSize = m_aColorSet->CalcWindowSizePixel( aSize12 ); + aSize.Width() += 4; + aSize.Height() += 4; + SetOutputSizePixel( aSize ); + m_aColorSet->Show(); +} + +OColorPopup::~OColorPopup() +{ + disposeOnce(); +} + +void OColorPopup::dispose() +{ + disposeBuilder(); + m_aColorSet.disposeAndClear(); + m_pCondition.clear(); + FloatingWindow::dispose(); +} + +void OColorPopup::KeyInput( const KeyEvent& rKEvt ) +{ + m_aColorSet->KeyInput(rKEvt); } -void ConditionColorWrapper::dispose() +void OColorPopup::Resize() { - mxControl.clear(); + Size aSize = GetOutputSizePixel(); + aSize.Width() -= 4; + aSize.Height() -= 4; + m_aColorSet->SetPosSizePixel( Point(2,2), aSize ); } -void ConditionColorWrapper::operator()(const OUString& /*rCommand*/, const NamedColor& rNamedColor) +void OColorPopup::StartSelection() { - mxControl->ApplyCommand(mnSlotId, rNamedColor.first); + m_aColorSet->StartSelection(); } +void OColorPopup::SetSlotId(sal_uInt16 _nSlotId) +{ + m_nSlotId = _nSlotId; + if ( SID_ATTR_CHAR_COLOR_BACKGROUND == _nSlotId || SID_BACKGROUND_COLOR == _nSlotId ) + { + m_aColorSet->SetStyle( m_aColorSet->GetStyle() | WB_NONEFIELD ); + m_aColorSet->SetText( OUString(ModuleRes( STR_TRANSPARENT )) ); + } +} + +IMPL_LINK_NOARG(OColorPopup, SelectHdl, ValueSet*, void) +{ + sal_uInt16 nItemId = m_aColorSet->GetSelectItemId(); + Color aColor( nItemId == 0 ? Color( COL_TRANSPARENT ) : m_aColorSet->GetItemColor( nItemId ) ); + + /* #i33380# Moved the following line above the Dispatch() calls. + This instance may be deleted in the meantime (i.e. when a dialog is opened + while in Dispatch()), accessing members will crash in this case. */ + m_aColorSet->SetNoSelection(); + + if ( IsInPopupMode() ) + EndPopupMode(); + + m_pCondition->ApplyCommand( m_nSlotId, aColor ); +} + + // = Condition Condition::Condition( vcl::Window* _pParent, IConditionalFormatAction& _rAction, ::rptui::OReportController& _rController ) - : VclHBox(_pParent) - , m_aColorWrapper(this) - , m_rController(_rController) - , m_rAction(_rAction) - , m_pBtnUpdaterFontColor(nullptr) - , m_pBtnUpdaterBackgroundColor(nullptr) - , m_nCondIndex(0) - , m_bInDestruction(false) + :VclHBox(_pParent) + ,m_rController( _rController ) + ,m_rAction( _rAction ) + ,m_pColorFloat(nullptr) + ,m_pBtnUpdaterFontColor(nullptr) + ,m_pBtnUpdaterBackgroundColor(nullptr) + ,m_nCondIndex( 0 ) + ,m_bInDestruction( false ) { m_pUIBuilder = new VclBuilder(this, getUIRootDir(), "modules/dbreport/ui/conditionwin.ui"); @@ -218,27 +328,31 @@ void Condition::dispose() m_pAddCondition.clear(); m_pRemoveCondition.clear(); m_pColorFloat.disposeAndClear(); - m_aColorWrapper.dispose(); disposeBuilder(); VclHBox::dispose(); } -IMPL_LINK(Condition, DropdownClick, ToolBox*, pToolBox, void) +IMPL_LINK_NOARG( Condition, DropdownClick, ToolBox*, void ) { sal_uInt16 nId( m_pActions->GetCurItemId() ); - m_pColorFloat.disposeAndClear(); - sal_uInt16 nSlotId(mapToolbarItemToSlotId(nId)); - m_aColorWrapper.SetSlotId(nSlotId); - m_pColorFloat = VclPtr<SvxColorWindow>::Create( - OUString() /*m_aCommandURL*/, - m_aPaletteManager, - m_aBorderColorStatus, - nSlotId, - nullptr, - pToolBox, - m_aColorWrapper); - - m_pColorFloat->StartPopupMode(pToolBox, FloatWinPopupFlags::GrabFocus); + if ( !m_pColorFloat ) + m_pColorFloat = VclPtr<OColorPopup>::Create(m_pActions,this); + + sal_uInt16 nTextId = 0; + if (nId == m_nFontColorId) + { + nTextId = STR_CHARCOLOR; + } + else if (nId == m_nBackgroundColorId) + { + nTextId = STR_CHARBACKGROUND; + } + if ( nTextId ) + m_pColorFloat->SetText(OUString(ModuleRes(nTextId))); + m_pColorFloat->SetSlotId(mapToolbarItemToSlotId(nId)); + m_pColorFloat->SetPosPixel(m_pActions->GetItemPopupPosition(nId,m_pColorFloat->GetSizePixel())); + m_pColorFloat->StartPopupMode(m_pActions); + m_pColorFloat->StartSelection(); } IMPL_LINK_NOARG( Condition, OnFormatAction, ToolBox*, void ) diff --git a/reportdesign/source/ui/dlg/Condition.hxx b/reportdesign/source/ui/dlg/Condition.hxx index 6a6d64e19b9e..ab5194ade94c 100644 --- a/reportdesign/source/ui/dlg/Condition.hxx +++ b/reportdesign/source/ui/dlg/Condition.hxx @@ -26,7 +26,6 @@ #include <dbaccess/ToolBoxHelper.hxx> -#include <svx/colorwindow.hxx> #include <svx/fntctrl.hxx> #include <vcl/fixed.hxx> @@ -63,18 +62,6 @@ namespace rptui OUString GetText() const { return m_pSubEdit->GetText(); } }; - class ConditionColorWrapper - { - public: - ConditionColorWrapper(Condition* pControl); - void SetSlotId(sal_uInt16 nSlotId) { mnSlotId = nSlotId; } - void operator()(const OUString& rCommand, const NamedColor& rColor); - void dispose(); - private: - VclPtr<Condition> mxControl; - sal_uInt16 mnSlotId; - }; - //= Condition class Condition :public VclHBox @@ -87,9 +74,6 @@ namespace rptui sal_uInt16 m_nBackgroundColorId; sal_uInt16 m_nFontColorId; sal_uInt16 m_nFontDialogId; - PaletteManager m_aPaletteManager; - BorderColorStatus m_aBorderColorStatus; - ConditionColorWrapper m_aColorWrapper; ::rptui::OReportController& m_rController; IConditionalFormatAction& m_rAction; @@ -105,7 +89,7 @@ namespace rptui VclPtr<PushButton> m_pMoveDown; VclPtr<PushButton> m_pAddCondition; VclPtr<PushButton> m_pRemoveCondition; - VclPtr<SvxColorWindow> m_pColorFloat; + VclPtr<OColorPopup> m_pColorFloat; svx::ToolboxButtonColorUpdater* m_pBtnUpdaterFontColor; // updates the color below the toolbar icon svx::ToolboxButtonColorUpdater* m_pBtnUpdaterBackgroundColor; diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc index 64ae387c84e3..26bd9e97885e 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) -//free +#define SCSTR_AUTHOR (STR_START + 113) #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 f6e9ebc4eb9d..ab2e08983b3f 100644 --- a/sc/source/ui/condformat/colorformat.cxx +++ b/sc/source/ui/condformat/colorformat.cxx @@ -13,7 +13,6 @@ #include "document.hxx" #include "sc.hrc" -#include <svx/colorbox.hxx> #include <svx/xtable.hxx> #include <svx/drawitem.hxx> #include <vcl/msgbox.hxx> @@ -67,6 +66,16 @@ 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): @@ -91,13 +100,14 @@ 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(); - mpLbPos->SelectEntry(rData.maPositiveColor); + ::SelectColor( rData.maPositiveColor, maCustomColor, *mpLbPos); mpLbFillType->SelectEntryPos( rData.mbGradient ? 1 : 0 ); - if (rData.mpNegativeColor) - mpLbNeg->SelectEntry(*rData.mpNegativeColor); + if(rData.mpNegativeColor) + ::SelectColor( *rData.mpNegativeColor, maCustomColor, *mpLbNeg ); switch (rData.meAxisPosition) { @@ -150,9 +160,42 @@ void ScDataBarSettingsDlg::dispose() void ScDataBarSettingsDlg::Init() { - mpLbNeg->SelectEntry(Color(COL_LIGHTRED)); - mpLbAxisCol->SelectEntry(Color(COL_BLACK)); - mpLbPos->SelectEntry(Color(COL_LIGHTBLUE)); + 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 ); + } 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 f4273992e9f4..415aa11274e5 100644 --- a/sc/source/ui/condformat/condformatdlgentry.cxx +++ b/sc/source/ui/condformat/condformatdlgentry.cxx @@ -18,7 +18,6 @@ #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> @@ -664,7 +663,7 @@ OUString convertNumberToString(double nVal, ScDocument* pDoc) return aText; } -void SetColorScaleEntryTypes( const ScColorScaleEntry& rEntry, ListBox& rLbType, Edit& rEdit, SvxColorListBox& rLbCol, ScDocument* pDoc ) +void SetColorScaleEntryTypes( const ScColorScaleEntry& rEntry, ListBox& rLbType, Edit& rEdit, ColorListBox& rLbCol, ScDocument* pDoc ) { // entry Automatic is not available for color scales sal_Int32 nIndex = static_cast<sal_Int32>(rEntry.GetType()); @@ -727,7 +726,7 @@ void SetColorScaleEntry( ScColorScaleEntry* pEntry, const ListBox& rType, const } } -ScColorScaleEntry* createColorScaleEntry( const ListBox& rType, const SvxColorListBox& rColor, const Edit& rValue, ScDocument* pDoc, const ScAddress& rPos ) +ScColorScaleEntry* createColorScaleEntry( const ListBox& rType, const ColorListBox& rColor, const Edit& rValue, ScDocument* pDoc, const ScAddress& rPos ) { ScColorScaleEntry* pEntry = new ScColorScaleEntry(); @@ -797,8 +796,38 @@ void ScColorScale2FrmtEntry::Init() { maLbEntryTypeMin->SetSelectHdl( LINK( this, ScColorScale2FrmtEntry, EntryTypeHdl ) ); maLbEntryTypeMax->SetSelectHdl( LINK( this, ScColorScale2FrmtEntry, EntryTypeHdl ) ); - maLbColMin->SelectEntry(Color(COL_LIGHTRED)); - maLbColMax->SelectEntry(Color(COL_LIGHTBLUE)); + + 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 ); + } } ScFormatEntry* ScColorScale2FrmtEntry::createColorscaleEntry() const @@ -947,9 +976,43 @@ void ScColorScale3FrmtEntry::Init() maLbEntryTypeMin->SetSelectHdl( LINK( this, ScColorScale3FrmtEntry, EntryTypeHdl ) ); maLbEntryTypeMax->SetSelectHdl( LINK( this, ScColorScale3FrmtEntry, EntryTypeHdl ) ); maLbEntryTypeMiddle->SetSelectHdl( LINK( this, ScColorScale3FrmtEntry, EntryTypeHdl ) ); - maLbColMin->SelectEntry(Color(COL_LIGHTRED)); - maLbColMiddle->SelectEntry(Color(COL_YELLOW)); - maLbColMax->SelectEntry(Color(0x00CC00)); + + 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 ); + } } ScFormatEntry* ScColorScale3FrmtEntry::createColorscaleEntry() const diff --git a/sc/source/ui/dbgui/scendlg.cxx b/sc/source/ui/dbgui/scendlg.cxx index efcd657caed7..3cd9044ca12d 100644 --- a/sc/source/ui/dbgui/scendlg.cxx +++ b/sc/source/ui/dbgui/scendlg.cxx @@ -21,7 +21,6 @@ #include "scitems.hxx" #include <comphelper/string.hxx> -#include <svx/colorbox.hxx> #include <svx/drawitem.hxx> #include <svx/xtable.hxx> #include <sfx2/objsh.hxx> @@ -59,6 +58,27 @@ 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 01d2576c7a61..9e620e5099b4 100644 --- a/sc/source/ui/drawfunc/drawsh4.cxx +++ b/sc/source/ui/drawfunc/drawsh4.cxx @@ -34,8 +34,17 @@ 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(); @@ -63,6 +72,22 @@ 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 a7eb77aea3e7..9a97a6aed7af 100644 --- a/sc/source/ui/drawfunc/drtxtob2.cxx +++ b/sc/source/ui/drawfunc/drtxtob2.cxx @@ -202,8 +202,17 @@ 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(); @@ -231,6 +240,22 @@ 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 8838418cfc18..682be33c87ad 100644 --- a/sc/source/ui/inc/colorformat.hxx +++ b/sc/source/ui/inc/colorformat.hxx @@ -19,7 +19,6 @@ struct ScDataBarFormatData; class ScDocument; -class SvxColorListBox; class ScDataBarSettingsDlg : public ModalDialog { @@ -27,9 +26,9 @@ private: VclPtr<OKButton> mpBtnOk; VclPtr<CancelButton> mpBtnCancel; - VclPtr<SvxColorListBox> mpLbPos; - VclPtr<SvxColorListBox> mpLbNeg; - VclPtr<SvxColorListBox> mpLbAxisCol; + VclPtr<ColorListBox> mpLbPos; + VclPtr<ColorListBox> mpLbNeg; + VclPtr<ColorListBox> mpLbAxisCol; VclPtr<ListBox> mpLbFillType; VclPtr<ListBox> mpLbTypeMin; @@ -44,6 +43,7 @@ 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 f7d446ff474b..cba12245772f 100644 --- a/sc/source/ui/inc/condformatdlgentry.hxx +++ b/sc/source/ui/inc/condformatdlgentry.hxx @@ -18,7 +18,6 @@ class ScIconSetFrmtDataEntry; class ScCondFormatDlg; -class SvxColorListBox; namespace condformat { @@ -173,8 +172,8 @@ class ScColorScale2FrmtEntry : public ScCondFrmtEntry VclPtr<Edit> maEdMin; VclPtr<Edit> maEdMax; - VclPtr<SvxColorListBox> maLbColMin; - VclPtr<SvxColorListBox> maLbColMax; + VclPtr<ColorListBox> maLbColMin; + VclPtr<ColorListBox> maLbColMax; ScFormatEntry* createColorscaleEntry() const; @@ -207,9 +206,9 @@ class ScColorScale3FrmtEntry : public ScCondFrmtEntry VclPtr<Edit> maEdMiddle; VclPtr<Edit> maEdMax; - VclPtr<SvxColorListBox> maLbColMin; - VclPtr<SvxColorListBox> maLbColMiddle; - VclPtr<SvxColorListBox> maLbColMax; + VclPtr<ColorListBox> maLbColMin; + VclPtr<ColorListBox> maLbColMiddle; + VclPtr<ColorListBox> maLbColMax; ScFormatEntry* createColorscaleEntry() const; diff --git a/sc/source/ui/inc/opredlin.hxx b/sc/source/ui/inc/opredlin.hxx index 69d1bfb31db4..a0a3e765c3be 100644 --- a/sc/source/ui/inc/opredlin.hxx +++ b/sc/source/ui/inc/opredlin.hxx @@ -36,10 +36,11 @@ class ScRedlineOptionsTabPage : public SfxTabPage { - VclPtr<SvxColorListBox> m_pContentColorLB; - VclPtr<SvxColorListBox> m_pRemoveColorLB; - VclPtr<SvxColorListBox> m_pInsertColorLB; - VclPtr<SvxColorListBox> m_pMoveColorLB; + VclPtr<ColorListBox> m_pContentColorLB; + VclPtr<ColorListBox> m_pRemoveColorLB; + VclPtr<ColorListBox> m_pInsertColorLB; + VclPtr<ColorListBox> m_pMoveColorLB; + OUString aAuthorStr; public: diff --git a/sc/source/ui/inc/scendlg.hxx b/sc/source/ui/inc/scendlg.hxx index 3d5ecf4ce7e5..e20073c17882 100644 --- a/sc/source/ui/inc/scendlg.hxx +++ b/sc/source/ui/inc/scendlg.hxx @@ -29,8 +29,6 @@ enum class ScScenarioFlags; -class SvxColorListBox; - class ScNewScenarioDlg : public ModalDialog { public: @@ -47,7 +45,7 @@ private: VclPtr<Edit> m_pEdName; VclPtr<VclMultiLineEdit> m_pEdComment; VclPtr<CheckBox> m_pCbShowFrame; - VclPtr<SvxColorListBox> m_pLbColor; + VclPtr<ColorListBox> 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 480d82432442..359be4889d81 100644 --- a/sc/source/ui/inc/tpview.hxx +++ b/sc/source/ui/inc/tpview.hxx @@ -28,14 +28,13 @@ #include <svx/strarray.hxx> class ScViewOptions; -class SvxColorListBox; class ScTpContentOptions : public SfxTabPage { friend class VclPtr<ScTpContentOptions>; VclPtr<ListBox> pGridLB; VclPtr<FixedText> pColorFT; - VclPtr<SvxColorListBox> pColorLB; + VclPtr<ColorListBox> pColorLB; VclPtr<CheckBox> pBreakCB; VclPtr<CheckBox> pGuideLineCB; diff --git a/sc/source/ui/optdlg/opredlin.cxx b/sc/source/ui/optdlg/opredlin.cxx index 8a769ad24dab..f8fb21682a47 100644 --- a/sc/source/ui/optdlg/opredlin.cxx +++ b/sc/source/ui/optdlg/opredlin.cxx @@ -19,7 +19,6 @@ #undef SC_DLLIMPLEMENTATION -#include <svx/colorbox.hxx> #include <svx/dlgutil.hxx> #include <svx/drawitem.hxx> #include <svx/xtable.hxx> @@ -41,16 +40,13 @@ ScRedlineOptionsTabPage::ScRedlineOptionsTabPage( vcl::Window* pParent, const SfxItemSet& rSet ) - : SfxTabPage(pParent,"OptChangesPage", "modules/scalc/ui/optchangespage.ui", &rSet) + : SfxTabPage(pParent,"OptChangesPage", "modules/scalc/ui/optchangespage.ui", &rSet), + aAuthorStr (ScResId(SCSTR_AUTHOR)) { 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() @@ -76,17 +72,53 @@ bool ScRedlineOptionsTabPage::FillItemSet( SfxItemSet* /* rSet */ ) { ScAppOptions aAppOptions=SC_MOD()->GetAppOptions(); - 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); + 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); + + } SC_MOD()->SetAppOptions(aAppOptions); @@ -101,19 +133,59 @@ 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(); - m_pContentColorLB->SelectEntry(Color(nColor)); + if (nColor == COL_TRANSPARENT) + m_pContentColorLB->SelectEntryPos(0); + else + m_pContentColorLB->SelectEntry(Color(nColor)); nColor = aAppOptions.GetTrackMoveColor(); - m_pMoveColorLB->SelectEntry(Color(nColor)); + if (nColor == COL_TRANSPARENT) + m_pMoveColorLB->SelectEntryPos(0); + else + m_pMoveColorLB->SelectEntry(Color(nColor)); nColor = aAppOptions.GetTrackInsertColor(); - m_pInsertColorLB->SelectEntry(Color(nColor)); + if (nColor == COL_TRANSPARENT) + m_pInsertColorLB->SelectEntryPos(0); + else + m_pInsertColorLB->SelectEntry(Color(nColor)); nColor = aAppOptions.GetTrackDeleteColor(); - m_pRemoveColorLB->SelectEntry(Color(nColor)); + if (nColor == COL_TRANSPARENT) + m_pRemoveColorLB->SelectEntryPos(0); + else + 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 0257ff228bc6..9e254fb83c93 100644 --- a/sc/source/ui/optdlg/tpview.cxx +++ b/sc/source/ui/optdlg/tpview.cxx @@ -31,7 +31,6 @@ #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> @@ -152,8 +151,8 @@ bool ScTpContentOptions::FillItemSet( SfxItemSet* rCoreSet ) pBreakCB ->IsValueChangedFromSaved() || pGuideLineCB ->IsValueChangedFromSaved()) { - NamedColor aNamedColor = pColorLB->GetSelectEntry(); - pLocalOptions->SetGridColor(aNamedColor.first, aNamedColor.second); + pLocalOptions->SetGridColor( pColorLB->GetSelectEntryColor(), + pColorLB->GetSelectEntry() ); rCoreSet->Put(ScTpViewItem(SID_SCVIEWOPTIONS, *pLocalOptions)); bRet = true; } @@ -303,14 +302,58 @@ void ScTpContentOptions::InitGridOpt() pGridLB->SelectEntryPos (nSelPos); - // select grid color entry + 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 + OUString aName; Color aCol = pLocalOptions->GetGridColor( &aName ); + nSelPos = pColorLB->GetEntryPos( aCol ); - if (aName.trim().isEmpty() && aCol == Color(SC_STD_GRIDCOLOR)) - aName = ScGlobal::GetRscString(STR_GRIDCOLOR); - - pColorLB->SelectEntry(std::make_pair(aCol, aName)); + if ( LISTBOX_ENTRY_NOTFOUND != nSelPos ) + pColorLB->SelectEntryPos( nSelPos ); + else + pColorLB->SelectEntryPos( pColorLB->InsertEntry( 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 e4e7e6ba9198..70dc4327beae 100644 --- a/sc/source/ui/src/scstring.src +++ b/sc/source/ui/src/scstring.src @@ -798,6 +798,11 @@ 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 a7f4f1402f20..86d18e199b5a 100644 --- a/sc/uiconfig/scalc/ui/conditionalentry.ui +++ b/sc/uiconfig/scalc/ui/conditionalentry.ui @@ -131,7 +131,7 @@ </packing> </child> <child> - <object class="svxlo-SvxColorListBox" id="lbcolmin"> + <object class="svtlo-ColorListBox" id="lbcolmin"> <property name="can_focus">False</property> </object> <packing> @@ -140,7 +140,7 @@ </packing> </child> <child> - <object class="svxlo-SvxColorListBox" id="lbcolmiddle"> + <object class="svtlo-ColorListBox" id="lbcolmiddle"> <property name="can_focus">False</property> </object> <packing> @@ -149,7 +149,7 @@ </packing> </child> <child> - <object class="svxlo-SvxColorListBox" id="lbcolmax"> + <object class="svtlo-ColorListBox" 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 0624e8b55e2c..c2a4ae233281 100644 --- a/sc/uiconfig/scalc/ui/databaroptions.ui +++ b/sc/uiconfig/scalc/ui/databaroptions.ui @@ -241,7 +241,7 @@ </packing> </child> <child> - <object class="svxlo-SvxColorListBox" id="positive_colour"> + <object class="svtlo-ColorListBox" 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="svxlo-SvxColorListBox" id="negative_colour"> + <object class="svtlo-ColorListBox" 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="svxlo-SvxColorListBox" id="axis_colour"> + <object class="svtlo-ColorListBox" id="axis_colour"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="hexpand">True</property> @@ -523,6 +523,17 @@ <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 7d4bba5bded0..df83ce92437f 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-SvxColorListBox" id="changes"> + <object class="svxlo-ColorLB" id="changes"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -97,7 +97,7 @@ </packing> </child> <child> - <object class="svxlo-SvxColorListBox" id="deletions"> + <object class="svxlo-ColorLB" id="deletions"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -107,7 +107,7 @@ </packing> </child> <child> - <object class="svxlo-SvxColorListBox" id="entries"> + <object class="svxlo-ColorLB" id="entries"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -117,7 +117,7 @@ </packing> </child> <child> - <object class="svxlo-SvxColorListBox" id="insertions"> + <object class="svxlo-ColorLB" 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 ece0490e4b48..846c05e4691f 100644 --- a/sc/uiconfig/scalc/ui/scenariodialog.ui +++ b/sc/uiconfig/scalc/ui/scenariodialog.ui @@ -253,7 +253,7 @@ </packing> </child> <child> - <object class="svxlo-SvxColorListBox" id="bordercolor"> + <object class="svtlo-ColorListBox" 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 9d1591ec3966..1e39a39f2ea0 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-SvxColorListBox" id="color"> + <object class="svxlo-ColorLB" 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 7f763c690346..e3269326c3c5 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, ::sd::View* pView ) = 0; + virtual VclPtr<AbstractCopyDlg> CreateCopyDlg(vcl::Window* pWindow, const SfxItemSet& rInAttrs, const rtl::Reference<XColorList> &pColTab, ::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 3b10d337a3ca..4acc570ca599 100644 --- a/sd/qa/unit/dialogs-test.cxx +++ b/sd/qa/unit/dialogs-test.cxx @@ -292,10 +292,16 @@ 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 6726317d95ba..2ba3459164ee 100644 --- a/sd/source/ui/animations/CustomAnimationDialog.cxx +++ b/sd/source/ui/animations/CustomAnimationDialog.cxx @@ -62,7 +62,6 @@ #include <editeng/flstitem.hxx> #include <svx/drawitem.hxx> -#include <svx/colorbox.hxx> #include <svx/xtable.hxx> #include <svx/gallery.hxx> @@ -192,24 +191,43 @@ public: virtual Control* getControl() override; private: - VclPtr<SvxColorListBox> mpControl; - DECL_LINK(OnSelect, SvxColorListBox&, void); + VclPtr<ColorListBox> mpControl; + DECL_LINK(OnSelect, ListBox&, 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<SvxColorListBox>::Create(pParent); + mpControl = VclPtr<ColorListBox>::Create( pParent, WB_BORDER|WB_TABSTOP|WB_DROPDOWN ); + mpControl->SetDropDownLineCount( 10 ); 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; - mpControl->SelectEntry(static_cast<Color>(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 ); + } } -IMPL_LINK_NOARG(ColorPropertyBox, OnSelect, SvxColorListBox&, void) +IMPL_LINK_NOARG(ColorPropertyBox, OnSelect, ListBox&, void) { maModifyLink.Call(nullptr); } @@ -227,7 +245,7 @@ void ColorPropertyBox::setValue( const Any& rValue, const OUString& ) rValue >>= nColor; mpControl->SetNoSelection(); - mpControl->SelectEntry(static_cast<Color>(nColor)); + mpControl->SelectEntryPos( mpControl->GetEntryPos( static_cast<Color>(nColor) ) ); } } @@ -1022,7 +1040,7 @@ private: VclPtr<FixedText> mpFTAfterEffect; VclPtr<ListBox> mpLBAfterEffect; VclPtr<FixedText> mpFTDimColor; - VclPtr<SvxColorListBox> mpCLBDimColor; + VclPtr<ColorListBox> mpCLBDimColor; VclPtr<FixedText> mpFTTextAnim; VclPtr<ListBox> mpLBTextAnim; VclPtr<MetricField> mpMFTextDelay; @@ -1047,7 +1065,6 @@ 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" ); @@ -1060,6 +1077,28 @@ 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 ) { @@ -1135,8 +1174,13 @@ CustomAnimationEffectTabPage::CustomAnimationEffectTabPage( vcl::Window* pParent { sal_Int32 nColor = 0; aDimColor >>= nColor; - Color aColor(nColor); - mpCLBDimColor->SelectEntry(aColor); + 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) ) ); } else { @@ -1288,7 +1332,16 @@ IMPL_LINK( CustomAnimationEffectTabPage, implSelectHdl, ListBox&, rListBox, void void CustomAnimationEffectTabPage::implHdl(Control* pControl ) { - if( pControl == mpLBTextAnim ) + 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( mpMFTextDelay->GetValue() == 0 ) mpMFTextDelay->SetValue( 100 ); @@ -1367,7 +1420,10 @@ void CustomAnimationEffectTabPage::update( STLPropertySet* pSet ) Any aDimColor; if( nPos == 1 ) { - Color aSelectedColor = mpCLBDimColor->GetSelectEntryColor(); + Color aSelectedColor; + if ( mpCLBDimColor->GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND ) + 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 efcebc1442f1..f68e06c38293 100644 --- a/sd/source/ui/dlg/copydlg.cxx +++ b/sd/source/ui/dlg/copydlg.cxx @@ -19,7 +19,6 @@ #include "copydlg.hxx" #include <comphelper/string.hxx> -#include <svx/colorbox.hxx> #include <svx/dlgutil.hxx> #include <sfx2/module.hxx> #include <svx/xcolit.hxx> @@ -41,9 +40,11 @@ namespace sd { #define TOKEN ';' -CopyDlg::CopyDlg(vcl::Window* pWindow, const SfxItemSet& rInAttrs, ::sd::View* pInView) +CopyDlg::CopyDlg(vcl::Window* pWindow, const SfxItemSet& rInAttrs, + const XColorListRef &pColList, ::sd::View* pInView) : SfxModalDialog(pWindow, "DuplicateDialog", "modules/sdraw/ui/copydlg.ui") , mrOutAttrs(rInAttrs) + , mpColorList(pColList) , maUIScale(pInView->GetDoc().GetUIScale()) , mpView(pInView) { @@ -59,6 +60,11 @@ CopyDlg::CopyDlg(vcl::Window* pWindow, const SfxItemSet& rInAttrs, ::sd::View* p 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 ) ); @@ -195,22 +201,31 @@ void CopyDlg::GetAttr( SfxItemSet& rOutAttrs ) rOutAttrs.Put( SfxInt32Item( ATTR_COPY_WIDTH, nWidth ) ); rOutAttrs.Put( SfxInt32Item( ATTR_COPY_HEIGHT, nHeight ) ); - 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)); + 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 ); + } } /** * enables and selects end color LB */ -IMPL_LINK_NOARG(CopyDlg, SelectColorHdl, SvxColorListBox&, void) +IMPL_LINK_NOARG(CopyDlg, SelectColorHdl, ListBox&, void) { - const Color aColor = m_pLbStartColor->GetSelectEntryColor(); + sal_Int32 nPos = m_pLbStartColor->GetSelectEntryPos(); - if (!m_pLbEndColor->IsEnabled()) + if( nPos != LISTBOX_ENTRY_NOTFOUND && + !m_pLbEndColor->IsEnabled() ) { - m_pLbEndColor->SelectEntry(aColor); + m_pLbEndColor->SelectEntryPos( nPos ); m_pLbEndColor->Enable(); m_pFtEndColor->Enable(); } diff --git a/sd/source/ui/dlg/sddlgfact.cxx b/sd/source/ui/dlg/sddlgfact.cxx index 23289ab93810..d2041f2c7554 100644 --- a/sd/source/ui/dlg/sddlgfact.cxx +++ b/sd/source/ui/dlg/sddlgfact.cxx @@ -315,9 +315,10 @@ 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, pView ) ); + return VclPtr<AbstractCopyDlg_Impl>::Create( VclPtr<::sd::CopyDlg>::Create( pParent, rInAttrs, pColTab, 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 5eb076b09b11..f014c8763e27 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, ::sd::View* pView) override; + virtual VclPtr<AbstractCopyDlg> CreateCopyDlg(vcl::Window* pParent, const SfxItemSet& rInAttrs, const rtl::Reference<XColorList> &pColTab, ::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 3fb2dc929646..a834258b78d2 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, mpView )); + ScopedVclPtr<AbstractCopyDlg> pDlg(pFact->CreateCopyDlg(mpViewShell->GetActiveWindow(), aSet, mpDoc->GetColorList(), mpView )); if (!pDlg) return; diff --git a/sd/source/ui/inc/copydlg.hxx b/sd/source/ui/inc/copydlg.hxx index 33a97c589943..98ac00ab7318 100644 --- a/sd/source/ui/inc/copydlg.hxx +++ b/sd/source/ui/inc/copydlg.hxx @@ -28,8 +28,6 @@ #include <sfx2/basedlgs.hxx> #include <tools/fract.hxx> -class SvxColorListBox; - namespace sd { class View; @@ -41,7 +39,8 @@ class CopyDlg : public SfxModalDialog { public: - CopyDlg(vcl::Window* pWindow, const SfxItemSet& rInAttrs, ::sd::View* pView); + CopyDlg( vcl::Window* pWindow, const SfxItemSet& rInAttrs, + const XColorListRef &pColList, ::sd::View* pView ); virtual ~CopyDlg() override; virtual void dispose() override; @@ -59,17 +58,18 @@ private: VclPtr<MetricField> m_pMtrFldWidth; VclPtr<MetricField> m_pMtrFldHeight; - VclPtr<SvxColorListBox> m_pLbStartColor; + VclPtr<ColorLB> m_pLbStartColor; VclPtr<FixedText> m_pFtEndColor; - VclPtr<SvxColorListBox> m_pLbEndColor; + VclPtr<ColorLB> m_pLbEndColor; VclPtr<PushButton> m_pBtnSetDefault; const SfxItemSet& mrOutAttrs; + XColorListRef mpColorList; Fraction maUIScale; ::sd::View* mpView; - DECL_LINK( SelectColorHdl, SvxColorListBox&, void ); + DECL_LINK( SelectColorHdl, ListBox&, 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 3957fbafbd0d..89587c52282d 100644 --- a/sd/source/ui/sidebar/SlideBackground.cxx +++ b/sd/source/ui/sidebar/SlideBackground.cxx @@ -38,7 +38,6 @@ #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> @@ -212,21 +211,48 @@ 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); + mpFillLB->SelectEntry( aColor ); + + if(mpFillLB->GetSelectEntryCount() == 0) + { + mpFillLB->InsertEntry(aColor, OUString()); + 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(); - mpFillGrad->SelectEntry(aEndColor); + 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); + } } break; @@ -805,7 +831,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, SvxColorListBox&, void) +IMPL_LINK_NOARG(SlideBackground, FillColorHdl, ListBox&, 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 fbbe7016b8aa..deb9a3b8118a 100644 --- a/sd/source/ui/sidebar/SlideBackground.hxx +++ b/sd/source/ui/sidebar/SlideBackground.hxx @@ -45,8 +45,6 @@ #include "EventMultiplexer.hxx" #include <sfx2/sidebar/IContextChangeReceiver.hxx> -class SvxColorListBox; - namespace sd { namespace sidebar { class SlideBackground : @@ -81,9 +79,9 @@ private: VclPtr<ListBox> mpPaperOrientation; VclPtr<ListBox> mpMasterSlide; VclPtr<SvxFillTypeBox> mpFillStyle; - VclPtr<SvxColorListBox> mpFillLB; + VclPtr<ColorLB> mpFillLB; VclPtr<SvxFillAttrBox> mpFillAttr; - VclPtr<SvxColorListBox> mpFillGrad; + VclPtr<ColorLB> mpFillGrad; VclPtr<CheckBox> mpDspMasterBackground; VclPtr<CheckBox> mpDspMasterObjects; VclPtr<Button> mpCloseMaster; @@ -122,7 +120,7 @@ private: DECL_LINK(FillBackgroundHdl, ListBox&, void); DECL_LINK(FillStyleModifyHdl, ListBox&, void); DECL_LINK(PaperSizeModifyHdl, ListBox&, void); - DECL_LINK(FillColorHdl, SvxColorListBox&, void); + DECL_LINK(FillColorHdl, ListBox&, 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 7fa40d53e97e..d34b08ffb694 100644 --- a/sd/source/ui/view/drviews6.cxx +++ b/sd/source/ui/view/drviews6.cxx @@ -87,6 +87,15 @@ 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(); @@ -116,6 +125,9 @@ void DrawViewShell::GetFormTextState(SfxItemSet& rSet) } else { + if ( pDlg ) + pDlg->SetColorList(GetDoc()->GetColorList()); + SfxItemSet aSet( GetDoc()->GetPool() ); mpDrawView->GetAttributes( aSet ); rSet.Set( aSet ); @@ -329,8 +341,17 @@ 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 4236050fe3b3..a2fe62bb2d36 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(); + p3DWin->InitColorLB( GetDoc() ); } } break; diff --git a/sd/uiconfig/sdraw/ui/copydlg.ui b/sd/uiconfig/sdraw/ui/copydlg.ui index 451c854ea7b3..2ae2610b38c5 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-SvxColorListBox" id="start"> + <object class="svxlo-ColorLB" 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-SvxColorListBox" id="end"> + <object class="svxlo-ColorLB" 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 758845856e8c..fffceb744ec9 100644 --- a/sd/uiconfig/simpress/ui/customanimationeffecttab.ui +++ b/sd/uiconfig/simpress/ui/customanimationeffecttab.ui @@ -254,7 +254,7 @@ </packing> </child> <child> - <object class="svxlo-SvxColorListBox" id="dim_color_list"> + <object class="svtlo-ColorListBox" 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 0ab82e1086de..9b5d24a435e3 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-SvxColorListBox" id="fillattr"> + <object class="svxlo-ColorLB" 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-SvxColorListBox" id="fillattr2"> + <object class="svxlo-ColorLB" 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 e793ef7879ce..f07e55131814 100644 --- a/sfx2/source/dialog/itemconnect.cxx +++ b/sfx2/source/dialog/itemconnect.cxx @@ -129,6 +129,34 @@ 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 ce7234810d16..4c6b107b1025 100644 --- a/svtools/source/control/ctrlbox.cxx +++ b/svtools/source/control/ctrlbox.cxx @@ -59,6 +59,230 @@ #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 4d04006cfbcd..36036d927a47 100644 --- a/svtools/source/control/ctrlbox.src +++ b/svtools/source/control/ctrlbox.src @@ -18,6 +18,11 @@ */ #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 2e8b2f6bd9cc..0693af63dc7c 100644 --- a/svx/sdi/svx.sdi +++ b/svx/sdi/svx.sdi @@ -3596,6 +3596,25 @@ 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 5eec4f8f7e8a..77ca04fc3a01 100644 --- a/svx/source/dialog/_bmpmask.cxx +++ b/svx/source/dialog/_bmpmask.cxx @@ -25,7 +25,6 @@ #include <sfx2/dispatch.hxx> #include <svtools/colrdlg.hxx> -#include <svx/colorbox.hxx> #include <svx/dialmgr.hxx> #include <svx/bmpmask.hxx> #include <svx/dialogs.hrc> @@ -35,6 +34,7 @@ #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 ) { - SvxColorListBox* pLb = static_cast<SvxColorListBox*>(&rControl); + ColorLB* pLb = static_cast<ColorLB*>(&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,7 +373,6 @@ 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); @@ -381,7 +380,6 @@ 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); @@ -389,7 +387,6 @@ 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); @@ -397,15 +394,14 @@ 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"); - 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)); + //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_pTbxPipette->SetSelectHdl( LINK( pData, MaskData, PipetteHdl ) ); m_pBtnExec->SetClickHdl( LINK( pData, MaskData, ExecHdl ) ); @@ -521,6 +517,40 @@ 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; @@ -708,7 +738,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 ] == COL_TRANSPARENT); + pTrans[ i ] = ( pDstCols[ i ] == TRANSP_COL ); } // Investigate actions and if necessary replace colors @@ -1024,7 +1054,7 @@ Graphic SvxBmpMask::Mask( const Graphic& rGraphic ) for( sal_uInt16 i = 0; i < nCount; i++ ) { // Do we have a transparent color? - if (pDstCols[i] == COL_TRANSPARENT) + if( pDstCols[i] == TRANSP_COL ) { BitmapEx aBmpEx( ImpMaskTransparent( aGraphic.GetBitmapEx(), pSrcCols[ i ], pTols[ i ] ) ); diff --git a/svx/source/dialog/bmpmask.hrc b/svx/source/dialog/bmpmask.hrc index bf054482824d..1e446c418145 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 16bf943d9f69..d154d7ed0db9 100644 --- a/svx/source/dialog/bmpmask.src +++ b/svx/source/dialog/bmpmask.src @@ -22,6 +22,11 @@ #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 d8f312bda281..740033df05e0 100644 --- a/svx/source/dialog/dlgctrl.cxx +++ b/svx/source/dialog/dlgctrl.cxx @@ -1103,6 +1103,52 @@ 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) @@ -1257,7 +1303,7 @@ namespace } // end of anonymous namespace FillAttrLB::FillAttrLB(vcl::Window* pParent, WinBits aWB) - : ListBox(pParent, aWB) +: ColorListBox(pParent, aWB) { } diff --git a/svx/source/dialog/fontwork.cxx b/svx/source/dialog/fontwork.cxx index b86ce464a860..166277cc42b4 100644 --- a/svx/source/dialog/fontwork.cxx +++ b/svx/source/dialog/fontwork.cxx @@ -20,7 +20,6 @@ #include <sfx2/module.hxx> #include <sfx2/dispatch.hxx> -#include <svx/colorbox.hxx> #include <svx/svdobj.hxx> #include <svx/svdopath.hxx> #include <svx/svdview.hxx> @@ -792,13 +791,23 @@ IMPL_LINK_NOARG(SvxFontWorkDialog, InputTimoutHdl_Impl, Idle *, void) { &aDistItem, &aStartItem, &aShadowXItem, &aShadowYItem }); } -IMPL_LINK_NOARG(SvxFontWorkDialog, ColorSelectHdl_Impl, SvxColorListBox&, void) +IMPL_LINK_NOARG(SvxFontWorkDialog, ColorSelectHdl_Impl, ListBox&, 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 80d065df7a22..b5ed0de3e87a 100644 --- a/svx/source/engine3d/float3d.cxx +++ b/svx/source/engine3d/float3d.cxx @@ -24,7 +24,6 @@ #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> @@ -274,20 +273,19 @@ 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( 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_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_pLbShademode->SetSelectHdl( aLink2 ); Link<Edit&,void> aLink3 = LINK( this, Svx3DWin, ModifyHdl ); @@ -943,7 +941,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs ) if( eState != SfxItemState::DONTCARE ) { aColor = static_cast<const SvxColorItem&>(rAttrs.Get(SDRATTR_3DSCENE_LIGHTCOLOR_1)).GetValue(); - SvxColorListBox* pLb = m_pLbLight1; + ColorLB* pLb = m_pLbLight1; if( aColor != pLb->GetSelectEntryColor() ) { LBSelectColor( pLb, aColor ); @@ -952,7 +950,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs ) } else { - if (!m_pLbLight1->IsNoSelection()) + if( m_pLbLight1->GetSelectEntryCount() != 0 ) { m_pLbLight1->SetNoSelection(); bUpdate = true; @@ -992,7 +990,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs ) if( eState != SfxItemState::DONTCARE ) { aColor = static_cast<const SvxColorItem&>(rAttrs.Get(SDRATTR_3DSCENE_LIGHTCOLOR_2)).GetValue(); - SvxColorListBox* pLb = m_pLbLight2; + ColorLB* pLb = m_pLbLight2; if( aColor != pLb->GetSelectEntryColor() ) { LBSelectColor( pLb, aColor ); @@ -1001,7 +999,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs ) } else { - if (!m_pLbLight2->IsNoSelection()) + if( m_pLbLight2->GetSelectEntryCount() != 0 ) { m_pLbLight2->SetNoSelection(); bUpdate = true; @@ -1041,7 +1039,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs ) if( eState != SfxItemState::DONTCARE ) { aColor = static_cast<const SvxColorItem&>(rAttrs.Get(SDRATTR_3DSCENE_LIGHTCOLOR_3)).GetValue(); - SvxColorListBox* pLb = m_pLbLight3; + ColorLB* pLb = m_pLbLight3; if( aColor != pLb->GetSelectEntryColor() ) { LBSelectColor( pLb, aColor ); @@ -1050,7 +1048,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs ) } else { - if (!m_pLbLight3->IsNoSelection()) + if( m_pLbLight3->GetSelectEntryCount() != 0 ) { m_pLbLight3->SetNoSelection(); bUpdate = true; @@ -1090,7 +1088,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs ) if( eState != SfxItemState::DONTCARE ) { aColor = static_cast<const SvxColorItem&>(rAttrs.Get(SDRATTR_3DSCENE_LIGHTCOLOR_4)).GetValue(); - SvxColorListBox* pLb = m_pLbLight4; + ColorLB* pLb = m_pLbLight4; if( aColor != pLb->GetSelectEntryColor() ) { LBSelectColor( pLb, aColor ); @@ -1099,7 +1097,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs ) } else { - if (!m_pLbLight4->IsNoSelection()) + if( m_pLbLight4->GetSelectEntryCount() != 0 ) { m_pLbLight4->SetNoSelection(); bUpdate = true; @@ -1139,7 +1137,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs ) if( eState != SfxItemState::DONTCARE ) { aColor = static_cast<const SvxColorItem&>(rAttrs.Get(SDRATTR_3DSCENE_LIGHTCOLOR_5)).GetValue(); - SvxColorListBox* pLb = m_pLbLight5; + ColorLB* pLb = m_pLbLight5; if( aColor != pLb->GetSelectEntryColor() ) { LBSelectColor( pLb, aColor ); @@ -1148,7 +1146,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs ) } else { - if (!m_pLbLight5->IsNoSelection()) + if( m_pLbLight5->GetSelectEntryCount() != 0 ) { m_pLbLight5->SetNoSelection(); bUpdate = true; @@ -1188,7 +1186,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs ) if( eState != SfxItemState::DONTCARE ) { aColor = static_cast<const SvxColorItem&>(rAttrs.Get(SDRATTR_3DSCENE_LIGHTCOLOR_6)).GetValue(); - SvxColorListBox* pLb = m_pLbLight6; + ColorLB* pLb = m_pLbLight6; if( aColor != pLb->GetSelectEntryColor() ) { LBSelectColor( pLb, aColor ); @@ -1197,7 +1195,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs ) } else { - if (!m_pLbLight6->IsNoSelection()) + if( m_pLbLight6->GetSelectEntryCount() != 0 ) { m_pLbLight6->SetNoSelection(); bUpdate = true; @@ -1237,7 +1235,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs ) if( eState != SfxItemState::DONTCARE ) { aColor = static_cast<const SvxColorItem&>(rAttrs.Get(SDRATTR_3DSCENE_LIGHTCOLOR_7)).GetValue(); - SvxColorListBox* pLb = m_pLbLight7; + ColorLB* pLb = m_pLbLight7; if( aColor != pLb->GetSelectEntryColor() ) { LBSelectColor( pLb, aColor ); @@ -1246,7 +1244,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs ) } else { - if (!m_pLbLight7->IsNoSelection()) + if( m_pLbLight7->GetSelectEntryCount() != 0 ) { m_pLbLight7->SetNoSelection(); bUpdate = true; @@ -1286,7 +1284,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs ) if( eState != SfxItemState::DONTCARE ) { aColor = static_cast<const SvxColorItem&>(rAttrs.Get(SDRATTR_3DSCENE_LIGHTCOLOR_8)).GetValue(); - SvxColorListBox* pLb = m_pLbLight8; + ColorLB* pLb = m_pLbLight8; if( aColor != pLb->GetSelectEntryColor() ) { LBSelectColor( pLb, aColor ); @@ -1295,7 +1293,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs ) } else { - if (!m_pLbLight8->IsNoSelection()) + if( m_pLbLight8->GetSelectEntryCount() != 0 ) { m_pLbLight8->SetNoSelection(); bUpdate = true; @@ -1335,7 +1333,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs ) if( eState != SfxItemState::DONTCARE ) { aColor = static_cast<const SvxColorItem&>(rAttrs.Get(SDRATTR_3DSCENE_AMBIENTCOLOR)).GetValue(); - SvxColorListBox* pLb = m_pLbAmbientlight; + ColorLB* pLb = m_pLbAmbientlight; if( aColor != pLb->GetSelectEntryColor() ) { LBSelectColor( pLb, aColor ); @@ -1344,7 +1342,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs ) } else { - if (!m_pLbAmbientlight->IsNoSelection()) + if( m_pLbAmbientlight->GetSelectEntryCount() != 0 ) { m_pLbAmbientlight->SetNoSelection(); bUpdate = true; @@ -1495,7 +1493,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs ) if( eState != SfxItemState::DONTCARE ) { aColor = static_cast<const XFillColorItem&>(rAttrs.Get(XATTR_FILLCOLOR)).GetColorValue(); - SvxColorListBox* pLb = m_pLbMatColor; + ColorLB* pLb = m_pLbMatColor; if( aColor != pLb->GetSelectEntryColor() ) { LBSelectColor( pLb, aColor ); @@ -1504,7 +1502,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs ) } else { - if (!m_pLbMatColor->IsNoSelection()) + if( m_pLbMatColor->GetSelectEntryCount() != 0 ) { m_pLbMatColor->SetNoSelection(); bUpdate = true; @@ -1516,7 +1514,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs ) if( eState != SfxItemState::DONTCARE ) { aColor = static_cast<const SvxColorItem&>(rAttrs.Get(SDRATTR_3DOBJ_MAT_EMISSION)).GetValue(); - SvxColorListBox* pLb = m_pLbMatEmission; + ColorLB* pLb = m_pLbMatEmission; if( aColor != pLb->GetSelectEntryColor() ) { LBSelectColor( pLb, aColor ); @@ -1525,7 +1523,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs ) } else { - if (!m_pLbMatEmission->IsNoSelection()) + if( m_pLbMatEmission->GetSelectEntryCount() != 0 ) { m_pLbMatEmission->SetNoSelection(); bUpdate = true; @@ -1537,7 +1535,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs ) if( eState != SfxItemState::DONTCARE ) { aColor = static_cast<const SvxColorItem&>(rAttrs.Get(SDRATTR_3DOBJ_MAT_SPECULAR)).GetValue(); - SvxColorListBox* pLb = m_pLbMatSpecular; + ColorLB* pLb = m_pLbMatSpecular; if( aColor != pLb->GetSelectEntryColor() ) { LBSelectColor( pLb, aColor ); @@ -1546,7 +1544,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs ) } else { - if (!m_pLbMatSpecular->IsNoSelection()) + if( m_pLbMatSpecular->GetSelectEntryCount() != 0 ) { m_pLbMatSpecular->SetNoSelection(); bUpdate = true; @@ -1854,7 +1852,7 @@ void Svx3DWin::GetAttr( SfxItemSet& rAttrs ) const SfxItemSet aLightItemSet(m_pCtlLightPreview->GetSvx3DLightControl().Get3DAttributes()); // Light 1 color - if (!m_pLbLight1->IsNoSelection()) + if( m_pLbLight1->GetSelectEntryCount() ) { aColor = m_pLbLight1->GetSelectEntryColor(); rAttrs.Put(makeSvx3DLightcolor1Item(aColor)); @@ -1879,7 +1877,7 @@ void Svx3DWin::GetAttr( SfxItemSet& rAttrs ) // Light 2 color - if (!m_pLbLight2->IsNoSelection()) + if( m_pLbLight2->GetSelectEntryCount() ) { aColor = m_pLbLight2->GetSelectEntryColor(); rAttrs.Put(makeSvx3DLightcolor2Item(aColor)); @@ -1903,7 +1901,7 @@ void Svx3DWin::GetAttr( SfxItemSet& rAttrs ) rAttrs.InvalidateItem(SDRATTR_3DSCENE_LIGHTON_2); // Light 3 color - if (!m_pLbLight3->IsNoSelection()) + if( m_pLbLight3->GetSelectEntryCount() ) { aColor = m_pLbLight3->GetSelectEntryColor(); rAttrs.Put(makeSvx3DLightcolor3Item(aColor)); @@ -1927,7 +1925,7 @@ void Svx3DWin::GetAttr( SfxItemSet& rAttrs ) rAttrs.InvalidateItem(SDRATTR_3DSCENE_LIGHTON_3); // Light 4 color - if (!m_pLbLight4->IsNoSelection()) + if( m_pLbLight4->GetSelectEntryCount() ) { aColor = m_pLbLight4->GetSelectEntryColor(); rAttrs.Put(makeSvx3DLightcolor4Item(aColor)); @@ -1951,7 +1949,7 @@ void Svx3DWin::GetAttr( SfxItemSet& rAttrs ) rAttrs.InvalidateItem(SDRATTR_3DSCENE_LIGHTON_4); // Light 5 color - if (!m_pLbLight5->IsNoSelection()) + if( m_pLbLight5->GetSelectEntryCount() ) { aColor = m_pLbLight5->GetSelectEntryColor(); rAttrs.Put(makeSvx3DLightcolor5Item(aColor)); @@ -1975,7 +1973,7 @@ void Svx3DWin::GetAttr( SfxItemSet& rAttrs ) rAttrs.InvalidateItem(SDRATTR_3DSCENE_LIGHTON_5); // Light 6 color - if (!m_pLbLight6->IsNoSelection()) + if( m_pLbLight6->GetSelectEntryCount() ) { aColor = m_pLbLight6->GetSelectEntryColor(); rAttrs.Put(makeSvx3DLightcolor6Item(aColor)); @@ -1999,7 +1997,7 @@ void Svx3DWin::GetAttr( SfxItemSet& rAttrs ) rAttrs.InvalidateItem(SDRATTR_3DSCENE_LIGHTON_6); // Light 7 color - if (!m_pLbLight7->IsNoSelection()) + if( m_pLbLight7->GetSelectEntryCount() ) { aColor = m_pLbLight7->GetSelectEntryColor(); rAttrs.Put(makeSvx3DLightcolor7Item(aColor)); @@ -2023,7 +2021,7 @@ void Svx3DWin::GetAttr( SfxItemSet& rAttrs ) rAttrs.InvalidateItem(SDRATTR_3DSCENE_LIGHTON_7); // Light 8 color - if (!m_pLbLight8->IsNoSelection()) + if( m_pLbLight8->GetSelectEntryCount() ) { aColor = m_pLbLight8->GetSelectEntryColor(); rAttrs.Put(makeSvx3DLightcolor8Item(aColor)); @@ -2047,7 +2045,7 @@ void Svx3DWin::GetAttr( SfxItemSet& rAttrs ) rAttrs.InvalidateItem(SDRATTR_3DSCENE_LIGHTON_8); // Ambient light - if (!m_pLbAmbientlight->IsNoSelection()) + if( m_pLbAmbientlight->GetSelectEntryCount() ) { aColor = m_pLbAmbientlight->GetSelectEntryColor(); rAttrs.Put(makeSvx3DAmbientcolorItem(aColor)); @@ -2123,7 +2121,7 @@ void Svx3DWin::GetAttr( SfxItemSet& rAttrs ) // Material // Object color - if (!m_pLbMatColor->IsNoSelection()) + if( m_pLbMatColor->GetSelectEntryCount() ) { aColor = m_pLbMatColor->GetSelectEntryColor(); rAttrs.Put( XFillColorItem( "", aColor) ); @@ -2134,7 +2132,7 @@ void Svx3DWin::GetAttr( SfxItemSet& rAttrs ) } // luminous color - if (!m_pLbMatEmission->IsNoSelection()) + if( m_pLbMatEmission->GetSelectEntryCount() ) { aColor = m_pLbMatEmission->GetSelectEntryColor(); rAttrs.Put(makeSvx3DMaterialEmissionItem(aColor)); @@ -2143,7 +2141,7 @@ void Svx3DWin::GetAttr( SfxItemSet& rAttrs ) rAttrs.InvalidateItem(SDRATTR_3DOBJ_MAT_EMISSION); // Specular - if (!m_pLbMatSpecular->IsNoSelection()) + if( m_pLbMatSpecular->GetSelectEntryCount() ) { aColor = m_pLbMatSpecular->GetSelectEntryColor(); rAttrs.Put(makeSvx3DMaterialSpecularItem(aColor)); @@ -2304,7 +2302,7 @@ IMPL_LINK( Svx3DWin, ClickViewTypeHdl, Button*, pBtn, void ) { m_pFLLight->Show(); - SvxColorListBox* pLb = GetLbByButton(); + ColorLB* pLb = GetLbByButton(); if( pLb ) pLb->Show(); @@ -2390,7 +2388,7 @@ IMPL_LINK( Svx3DWin, ClickHdl, Button *, pButton, void ) pBtn == m_pBtnLight8 ) { // Lighting - SvxColorListBox* pLb = GetLbByButton( pBtn ); + ColorLB* pLb = GetLbByButton( pBtn ); pLb->Show(); if( pBtn->IsChecked() ) @@ -2515,7 +2513,7 @@ IMPL_LINK( Svx3DWin, ClickHdl, Button *, pButton, void ) IMPL_LINK( Svx3DWin, ClickColorHdl, Button *, pBtn, void) { SvColorDialog aColorDlg( this ); - SvxColorListBox* pLb; + ColorLB* pLb; if( pBtn == m_pBtnLightColor ) pLb = GetLbByButton(); @@ -2534,11 +2532,12 @@ IMPL_LINK( Svx3DWin, ClickColorHdl, Button *, pBtn, void) if( aColorDlg.Execute() == RET_OK ) { aColor = aColorDlg.GetColor(); - LBSelectColor(pLb, aColor); - SelectColorHdl(*pLb); + if( LBSelectColor( pLb, aColor ) ) + SelectHdl( *pLb ); } } + IMPL_LINK( Svx3DWin, SelectHdl, ListBox&, rListBox, void ) { bool bUpdatePreview = false; @@ -2605,20 +2604,9 @@ IMPL_LINK( Svx3DWin, SelectHdl, ListBox&, rListBox, void ) bUpdatePreview = true; } - 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 ) + else if( &rListBox == m_pLbMatColor || + &rListBox == m_pLbMatEmission || + &rListBox == m_pLbMatSpecular ) { m_pLbMatFavorites->SelectEntryPos( 0 ); bUpdatePreview = true; @@ -2639,6 +2627,8 @@ IMPL_LINK( Svx3DWin, SelectColorHdl, SvxColorListBox&, rListBox, void ) { bUpdatePreview = true; } + else if (&rListBox == m_pLbShademode) + bUpdatePreview = true; if( bUpdatePreview ) UpdatePreview(); @@ -2675,7 +2665,7 @@ IMPL_LINK( Svx3DWin, ModifyHdl, Edit&, rField, void ) void Svx3DWin::ClickLight(PushButton& rBtn) { sal_uInt16 nLightSource = GetLightSource( &rBtn ); - SvxColorListBox* pLb = GetLbByButton( &rBtn ); + ColorLB* pLb = GetLbByButton( &rBtn ); Color aColor( pLb->GetSelectEntryColor() ); SfxItemSet aLightItemSet(m_pCtlLightPreview->GetSvx3DLightControl().Get3DAttributes()); const bool bOnOff(GetUILightState( static_cast<const ImageButton&>(rBtn) )); @@ -2766,29 +2756,36 @@ 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 -void Svx3DWin::LBSelectColor( SvxColorListBox* pLb, const Color& rColor ) +// returns true if color was added + +bool Svx3DWin::LBSelectColor( ColorLB* pLb, const Color& rColor ) { + bool bRet = false; + pLb->SetNoSelection(); - pLb->SelectEntry(std::make_pair(rColor, lcl_makeColorName(rColor))); + 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; } + void Svx3DWin::UpdatePreview() { if( pModel == nullptr ) @@ -2811,8 +2808,22 @@ void Svx3DWin::DocumentReload() mpRemember2DAttributes = nullptr; } -void Svx3DWin::InitColorLB() + +void Svx3DWin::InitColorLB( const SdrModel* pDoc ) { + 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 ); @@ -2877,9 +2888,9 @@ sal_uInt16 Svx3DWin::GetLightSource( const PushButton* pBtn ) }; -SvxColorListBox* Svx3DWin::GetLbByButton( const PushButton* pBtn ) +ColorLB* Svx3DWin::GetLbByButton( const PushButton* pBtn ) { - SvxColorListBox* pLb = nullptr; + ColorLB* pLb = nullptr; if( pBtn == nullptr ) { diff --git a/svx/source/engine3d/float3d.src b/svx/source/engine3d/float3d.src index 43a48855ae25..734117060173 100644 --- a/svx/source/engine3d/float3d.src +++ b/svx/source/engine3d/float3d.src @@ -41,6 +41,21 @@ 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 318b95b20e23..5f90b223781a 100644 --- a/svx/source/sidebar/area/AreaPropertyPanelBase.cxx +++ b/svx/source/sidebar/area/AreaPropertyPanelBase.cxx @@ -167,11 +167,10 @@ 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( aLink3 ); - mpLbFillGradTo->SetSelectHdl( aLink3 ); + mpLbFillGradFrom->SetSelectHdl( aLink ); + mpLbFillGradTo->SetSelectHdl( aLink ); mpMTRAngle->SetModifyHdl(LINK(this,AreaPropertyPanelBase, ChangeGradientAngle)); mpLBTransType->SetSelectHdl(LINK(this, AreaPropertyPanelBase, ChangeTrgrTypeHdl_Impl)); @@ -297,33 +296,61 @@ IMPL_LINK_NOARG(AreaPropertyPanelBase, SelectFillTypeHdl, ListBox&, void) mpToolBoxColor->Hide(); mpBmpImport->Hide(); - mpLbFillAttr->Enable(); - mpLbFillGradTo->Enable(); - mpLbFillGradFrom->Enable(); - mpGradientStyle->Enable(); - mpMTRAngle->Enable(); - mpLbFillAttr->Clear(); - - if (LISTBOX_ENTRY_NOTFOUND != mnLastPosGradient) + const SvxColorListItem* pColorListItem = static_cast<const SvxColorListItem*>(pSh->GetItem(SID_COLOR_TABLE)); + if(pColorListItem) { - const SvxGradientListItem aItem(*static_cast<const SvxGradientListItem*>(pSh->GetItem(SID_GRADIENT_LIST))); + mpLbFillAttr->Enable(); + mpLbFillGradTo->Enable(); + mpLbFillGradFrom->Enable(); + mpGradientStyle->Enable(); + mpMTRAngle->Enable(); + mpLbFillAttr->Clear(); + mpLbFillGradTo->Clear(); + mpLbFillGradFrom->Clear(); + mpLbFillGradTo->Fill(pColorListItem->GetColorList()); + mpLbFillGradFrom->Fill(pColorListItem->GetColorList()); - if(mnLastPosGradient < aItem.GetGradientList()->Count()) + mpLbFillGradFrom->AdaptDropDownLineCountToMaximum(); + mpLbFillGradTo->AdaptDropDownLineCountToMaximum(); + + if(LISTBOX_ENTRY_NOTFOUND != mnLastPosGradient) { - 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 )); + 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 )); + } } } + else + { + mpLbFillGradFrom->Disable(); + mpLbFillGradTo->Disable(); + mpMTRAngle->Disable(); + mpGradientStyle->Disable(); + } break; } case HATCH: @@ -448,11 +475,6 @@ 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(); @@ -1154,15 +1176,28 @@ 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 0766550e29cd..a1ea3879f3dd 100644 --- a/svx/source/sidebar/shadow/ShadowPropertyPanel.cxx +++ b/svx/source/sidebar/shadow/ShadowPropertyPanel.cxx @@ -10,7 +10,6 @@ #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> @@ -123,18 +122,25 @@ void ShadowPropertyPanel::dispose() void ShadowPropertyPanel::Initialize() { - 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(); + 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(); + } } IMPL_LINK_NOARG(ShadowPropertyPanel, ClickShadowHdl, Button*, void) @@ -153,7 +159,7 @@ IMPL_LINK_NOARG(ShadowPropertyPanel, ClickShadowHdl, Button*, void) } } -IMPL_LINK_NOARG(ShadowPropertyPanel, ModifyShadowColorHdl, SvxColorListBox&, void) +IMPL_LINK_NOARG(ShadowPropertyPanel, ModifyShadowColorHdl, ListBox&, void) { XColorItem aItem(makeSdrShadowColorItem(mpLBShadowColor->GetSelectEntryColor())); GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_SHADOW_COLOR, @@ -314,6 +320,9 @@ 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 f3fd1c7e12eb..7e7288617d32 100644 --- a/svx/source/sidebar/shadow/ShadowPropertyPanel.hxx +++ b/svx/source/sidebar/shadow/ShadowPropertyPanel.hxx @@ -25,7 +25,6 @@ #include <sfx2/request.hxx> #include <svx/dlgctrl.hxx> -class SvxColorListBox; namespace svx { namespace sidebar { @@ -61,10 +60,10 @@ public: SfxBindings* pBindings); private: - VclPtr<CheckBox> mpShowShadow; - VclPtr<MetricBox> mpShadowDistance; - VclPtr<SvxColorListBox> mpLBShadowColor; - VclPtr<MetricBox> mpShadowAngle; + VclPtr<CheckBox> mpShowShadow; + VclPtr<MetricBox> mpShadowDistance; + VclPtr<ColorLB> mpLBShadowColor; + VclPtr<MetricBox> mpShadowAngle; VclPtr<FixedText> mpFTAngle; VclPtr<FixedText> mpFTDistance; VclPtr<FixedText> mpFTTransparency; @@ -85,7 +84,7 @@ private: void SetTransparencyValue(long); void UpdateControls(); DECL_LINK(ClickShadowHdl, Button*, void); - DECL_LINK(ModifyShadowColorHdl, SvxColorListBox&, void); + DECL_LINK(ModifyShadowColorHdl, ListBox&, 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 7f1d5a140437..3ba048559620 100644 --- a/svx/source/tbxctrls/PaletteManager.cxx +++ b/svx/source/tbxctrls/PaletteManager.cxx @@ -254,21 +254,18 @@ void PaletteManager::SetLastColor(const Color& rLastColor) mLastColor = rLastColor; } -void PaletteManager::AddRecentColor(const Color& rRecentColor, const OUString& rName, bool bFront) +void PaletteManager::AddRecentColor(const Color& rRecentColor, const OUString& rName) { auto itColor = std::find_if(maRecentColors.begin(), maRecentColors.end(), - [rRecentColor] (const NamedColor &a) { return a.first == rRecentColor; }); + [rRecentColor] (const color_and_name &a) { return a.first == rRecentColor; }); // if recent color to be added is already in list, remove it if( itColor != maRecentColors.end() ) maRecentColors.erase( itColor ); - if (maRecentColors.size() == mnMaxRecentColors) + maRecentColors.push_front(std::make_pair(rRecentColor, rName)); + 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) @@ -288,7 +285,7 @@ void PaletteManager::SetBtnUpdater(svx::ToolboxButtonColorUpdater* pBtnUpdater) mLastColor = mpBtnUpdater->GetCurrentColor(); } -void PaletteManager::SetColorSelectFunction(const std::function<void(const OUString&, const NamedColor&)>& aColorSelectFunction) +void PaletteManager::SetColorSelectFunction(const std::function<void(const OUString&, const Color&)>& aColorSelectFunction) { maColorSelectFunction = aColorSelectFunction; } @@ -305,14 +302,12 @@ void PaletteManager::PopupColorPicker(const OUString& aCommand) if (mpBtnUpdater) mpBtnUpdater->Update( aColorDlg.GetColor() ); mLastColor = aColorDlg.GetColor(); - OUString sColorName = ("#" + mLastColor.AsRGBHexString().toAsciiUpperCase()); - NamedColor aNamedColor = std::make_pair(mLastColor, sColorName); - AddRecentColor(mLastColor, sColorName); - maColorSelectFunction(aCommandCopy, aNamedColor); + AddRecentColor(mLastColor, ("#" + mLastColor.AsRGBHexString().toAsciiUpperCase())); + maColorSelectFunction(aCommandCopy, mLastColor); } } -void PaletteManager::DispatchColorCommand(const OUString& aCommand, const NamedColor& rColor) +void PaletteManager::DispatchColorCommand(const OUString& aCommand, const Color& rColor) { using namespace css::uno; using namespace css::frame; @@ -328,7 +323,7 @@ void PaletteManager::DispatchColorCommand(const OUString& aCommand, const NamedC Sequence<PropertyValue> aArgs(1); aArgs[0].Name = aObj.GetURLPath(); - aArgs[0].Value = makeAny(sal_Int32(rColor.first.GetColor())); + aArgs[0].Value = makeAny(sal_Int32(rColor.GetColor())); URL aTargetURL; aTargetURL.Complete = aCommand; diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx index c5c0d568227c..5d3b359b144c 100644 --- a/svx/source/tbxctrls/tbcontrl.cxx +++ b/svx/source/tbxctrls/tbcontrl.cxx @@ -51,7 +51,6 @@ #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> @@ -86,7 +85,6 @@ #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" @@ -1247,13 +1245,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 NamedColor&)> 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 Color&)> const & aFunction): SfxPopupWindow( nSlotId, pParentWindow, "palette_popup_window", "svx/ui/colorwindow.ui", @@ -1266,7 +1264,6 @@ 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"); @@ -1281,16 +1278,6 @@ 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; } @@ -1298,7 +1285,15 @@ SvxColorWindow::SvxColorWindow(const OUString& rCommand, case SID_ATTR_CHAR_COLOR2: case SID_EXTRUSION_3D_COLOR: { - mpButtonAutoColor->SetText( SVX_RESSTR( RID_SVXSTR_AUTOMATIC ) ); + 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 ) ); break; } default: @@ -1358,7 +1353,6 @@ 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 ) ); @@ -1384,11 +1378,6 @@ SvxColorWindow::SvxColorWindow(const OUString& rCommand, } } -void SvxColorWindow::ShowNoneButton() -{ - mpButtonNoneColor->Show(); -} - SvxColorWindow::~SvxColorWindow() { disposeOnce(); @@ -1400,7 +1389,6 @@ void SvxColorWindow::dispose() mpRecentColorSet.clear(); mpPaletteListBox.clear(); mpButtonAutoColor.clear(); - mpButtonNoneColor.clear(); mpButtonPicker.clear(); mpAutomaticSeparator.clear(); SfxPopupWindow::dispose(); @@ -1411,29 +1399,11 @@ 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); - NamedColor aNamedColor = GetSelectEntryColor(pColorSet); + Color aColor = pColorSet->GetItemColor( pColorSet->GetSelectItemId() ); /* #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. */ @@ -1441,7 +1411,7 @@ IMPL_LINK(SvxColorWindow, SelectHdl, ValueSet*, pColorSet, void) if ( pColorSet != mpRecentColorSet ) { - mrPaletteManager.AddRecentColor(aNamedColor.first, aNamedColor.second); + mrPaletteManager.AddRecentColor(aColor, pColorSet->GetItemText(pColorSet->GetSelectItemId())); if ( !IsInPopupMode() ) mrPaletteManager.ReloadRecentColorSet( *mpRecentColorSet ); } @@ -1449,9 +1419,9 @@ IMPL_LINK(SvxColorWindow, SelectHdl, ValueSet*, pColorSet, void) if ( IsInPopupMode() ) EndPopupMode(); - maSelectedLink.Call(aNamedColor); + maSelectedLink.Call(aColor); - maColorSelectFunction(maCommand, aNamedColor); + maColorSelectFunction(maCommand, aColor); } IMPL_LINK_NOARG(SvxColorWindow, SelectPaletteHdl, ListBox&, void) @@ -1462,64 +1432,37 @@ IMPL_LINK_NOARG(SvxColorWindow, SelectPaletteHdl, ListBox&, void) mpColorSet->layoutToGivenHeight(mpColorSet->GetSizePixel().Height(), mrPaletteManager.GetColorCount()); } -NamedColor SvxColorWindow::GetNoneColor() const +IMPL_LINK_NOARG(SvxColorWindow, AutoColorClickHdl, Button*, void) { - 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); -} + VclPtr<SvxColorWindow> xThis(this); -NamedColor SvxColorWindow::GetAutoColor() const -{ Color aColor; - OUString sColorName; - switch (theSlotId) + 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(aNamedColor); + maSelectedLink.Call(aColor); - maColorSelectFunction(maCommand, aNamedColor); + maColorSelectFunction(maCommand, aColor); } IMPL_LINK_NOARG(SvxColorWindow, OpenPickerClickHdl, Button*, void) @@ -1536,23 +1479,6 @@ 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" @@ -1563,76 +1489,34 @@ void SvxColorWindow::statusChanged( const css::frame::FeatureStateEvent& rEvent } else { - Color aColor(COL_TRANSPARENT); + mpColorSet->SetNoSelection(); + 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; } - SelectEntry(aColor); - } -} + if ( aColor == COL_TRANSPARENT ) + return; -bool SvxColorWindow::SelectValueSetEntry(SvxColorValueSet* pColorSet, const Color& rColor) -{ - for (size_t i = 1; i <= pColorSet->GetItemCount(); ++i) - { - if (rColor == pColorSet->GetItemColor(i)) + for ( size_t i = 1; i <= mpColorSet->GetItemCount(); ++i ) { - pColorSet->SelectItem(i); - return true; + if ( aColor == mpColorSet->GetItemColor(i) ) + { + mpColorSet->SelectItem(i); + break; + } } } - 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 ), @@ -2833,18 +2717,19 @@ VclPtr<SfxPopupWindow> SvxColorToolBoxControl::CreatePopupWindow() &GetToolBox(), m_aColorSelectFunction); - pColorWin->StartPopupMode(&GetToolBox(), FloatWinPopupFlags::GrabFocus); + pColorWin->StartPopupMode( &GetToolBox(), + FloatWinPopupFlags::AllowTearOff|FloatWinPopupFlags::NoAppFocusClose ); pColorWin->StartSelection(); - SetPopupWindow(pColorWin); + SetPopupWindow( pColorWin ); if ( m_bSplitButton ) pColorWin->SetSelectedHdl( LINK( this, SvxColorToolBoxControl, SelectedHdl ) ); return pColorWin; } -IMPL_LINK(SvxColorToolBoxControl, SelectedHdl, const NamedColor&, rColor, void) +IMPL_LINK(SvxColorToolBoxControl, SelectedHdl, const Color&, rColor, void) { - m_xBtnUpdater->Update(rColor.first); - m_aPaletteManager.SetLastColor(rColor.first); + m_xBtnUpdater->Update( rColor ); + m_aPaletteManager.SetLastColor( rColor ); } void SvxColorToolBoxControl::statusChanged( const css::frame::FeatureStateEvent& rEvent ) @@ -3182,204 +3067,4 @@ 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 194d6a8d5997..27aed7b4d400 100644 --- a/svx/source/tbxctrls/tbcontrl.src +++ b/svx/source/tbxctrls/tbcontrl.src @@ -41,14 +41,9 @@ ImageList RID_SVXIL_FRAME IdCount = { 12 ; }; }; -String RID_SVXSTR_NOFILL -{ - Text [ en-US ] = "No Fill" ; -}; - String RID_SVXSTR_TRANSPARENT { - Text [ en-US ] = "Transparent"; + Text [ en-US ] = "No Fill" ; }; String RID_SVXSTR_FILLPATTERN @@ -140,11 +135,6 @@ 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 444797ff9714..9482562f83a6 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.20.0 --> +<!-- Generated with glade 3.18.3 --> <interface> <requires lib="gtk+" version="3.10"/> <requires lib="LibreOffice" version="1.0"/> @@ -13,14 +13,9 @@ <property name="can_focus">False</property> <property name="margin_right">6</property> <property name="xalign">0</property> - <property name="pixbuf">cmd/sc_square_unfilled.png</property> + <property name="pixbuf">cmd/sc_colorsettings.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> @@ -30,6 +25,7 @@ <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"> @@ -37,41 +33,13 @@ <property name="can_focus">False</property> <property name="orientation">vertical</property> <child> - <object class="GtkBox"> + <object class="GtkButton" id="auto_color_button"> <property name="visible">True</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> + <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> diff --git a/svx/uiconfig/ui/docking3deffects.ui b/svx/uiconfig/ui/docking3deffects.ui index fad6d1ca9d19..e3856ffbd3ca 100644 --- a/svx/uiconfig/ui/docking3deffects.ui +++ b/svx/uiconfig/ui/docking3deffects.ui @@ -1089,7 +1089,7 @@ </packing> </child> <child> - <object class="svxlo-SvxColorListBox" id="ambientcolor"> + <object class="svxlo-ColorLB" 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-SvxColorListBox" id="lightcolor1"> + <object class="svxlo-ColorLB" 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-SvxColorListBox" id="lightcolor2"> + <object class="svxlo-ColorLB" 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-SvxColorListBox" id="lightcolor3"> + <object class="svxlo-ColorLB" 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-SvxColorListBox" id="lightcolor4"> + <object class="svxlo-ColorLB" 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-SvxColorListBox" id="lightcolor5"> + <object class="svxlo-ColorLB" 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-SvxColorListBox" id="lightcolor6"> + <object class="svxlo-ColorLB" 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-SvxColorListBox" id="lightcolor7"> + <object class="svxlo-ColorLB" 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-SvxColorListBox" id="lightcolor8"> + <object class="svxlo-ColorLB" 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-SvxColorListBox" id="objcolor"> + <object class="svxlo-ColorLB" 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-SvxColorListBox" id="illumcolor"> + <object class="svxlo-ColorLB" 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-SvxColorListBox" id="speccolor"> + <object class="svxlo-ColorLB" 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 9b7e535c81a3..778c740f38bc 100644 --- a/svx/uiconfig/ui/dockingcolorreplace.ui +++ b/svx/uiconfig/ui/dockingcolorreplace.ui @@ -241,7 +241,7 @@ </packing> </child> <child> - <object class="svxlo-SvxColorListBox" id="color1"> + <object class="svxlo-ColorLB" 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-SvxColorListBox" id="color2"> + <object class="svxlo-ColorLB" 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-SvxColorListBox" id="color3"> + <object class="svxlo-ColorLB" 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-SvxColorListBox" id="color4"> + <object class="svxlo-ColorLB" 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-SvxColorListBox" id="color5"> + <object class="svxlo-ColorLB" 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 01e74c377e79..0c729be1b10e 100644 --- a/svx/uiconfig/ui/dockingfontwork.ui +++ b/svx/uiconfig/ui/dockingfontwork.ui @@ -437,7 +437,7 @@ </packing> </child> <child> - <object class="svxlo-SvxColorListBox" id="color"> + <object class="svxlo-ColorLB" 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 85a3122d68c6..e85fe45dfa20 100644 --- a/svx/uiconfig/ui/sidebararea.ui +++ b/svx/uiconfig/ui/sidebararea.ui @@ -100,7 +100,7 @@ </packing> </child> <child> - <object class="svxlo-SvxColorListBox" id="fillgrad1"> + <object class="svxlo-ColorLB" 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-SvxColorListBox" id="fillgrad2"> + <object class="svxlo-ColorLB" 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 356b6ff46933..0b2e8cf6d48b 100644 --- a/svx/uiconfig/ui/sidebarshadow.ui +++ b/svx/uiconfig/ui/sidebarshadow.ui @@ -184,7 +184,7 @@ </packing> </child> <child> - <object class="svxlo-SvxColorListBox" id="LB_SHADOW_COLOR"> + <object class="svxlo-ColorLB" 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 85873104a7e6..188da163ac90 100644 --- a/sw/inc/authratr.hxx +++ b/sw/inc/authratr.hxx @@ -24,6 +24,8 @@ #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 935495573295..0c7cb7dd2208 100644 --- a/sw/source/core/access/accpara.cxx +++ b/sw/source/core/access/accpara.cxx @@ -88,7 +88,6 @@ #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 e4c17d0ec431..c599a6ed3e0f 100644 --- a/sw/source/ui/config/optpage.cxx +++ b/sw/source/ui/config/optpage.cxx @@ -1730,22 +1730,20 @@ 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"); @@ -1762,6 +1760,8 @@ 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,13 +1781,14 @@ SwRedlineOptionsTabPage::SwRedlineOptionsTabPage( vcl::Window* pParent, pDeletedLB->SetSelectHdl( aLk ); pChangedLB->SetSelectHdl( aLk ); - Link<SvxColorListBox&,void> aLk2 = LINK(this, SwRedlineOptionsTabPage, ColorHdl); - pInsertColorLB->SetSelectHdl( aLk2 ); - pDeletedColorLB->SetSelectHdl( aLk2 ); - pChangedColorLB->SetSelectHdl( aLk2 ); + aLk = LINK(this, SwRedlineOptionsTabPage, ColorHdl); + pInsertColorLB->SetSelectHdl( aLk ); + pDeletedColorLB->SetSelectHdl( aLk ); + pChangedColorLB->SetSelectHdl( aLk ); - pMarkPosLB->SetSelectHdl(LINK(this, SwRedlineOptionsTabPage, ChangedMaskPrevHdl)); - pMarkColorLB->SetSelectHdl(LINK(this, SwRedlineOptionsTabPage, ChangedMaskColorPrevHdl)); + aLk = LINK(this, SwRedlineOptionsTabPage, ChangedMaskPrevHdl); + pMarkPosLB->SetSelectHdl( aLk ); + pMarkColorLB->SetSelectHdl( aLk ); } SwRedlineOptionsTabPage::~SwRedlineOptionsTabPage() @@ -1839,7 +1840,23 @@ bool SwRedlineOptionsTabPage::FillItemSet( SfxItemSet* ) pAttr = static_cast<CharAttr *>(pInsertLB->GetEntryData(nPos)); aInsertedAttr.nItemId = pAttr->nItemId; aInsertedAttr.nAttr = pAttr->nAttr; - aInsertedAttr.nColor = pInsertColorLB->GetSelectEntryColor().GetColor(); + + 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; + } + pOpt->SetInsertAuthorAttr(aInsertedAttr); } @@ -1849,7 +1866,23 @@ bool SwRedlineOptionsTabPage::FillItemSet( SfxItemSet* ) pAttr = static_cast<CharAttr *>(pDeletedLB->GetEntryData(nPos)); aDeletedAttr.nItemId = pAttr->nItemId; aDeletedAttr.nAttr = pAttr->nAttr; - aDeletedAttr.nColor = pDeletedColorLB->GetSelectEntryColor().GetColor(); + + 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; + } + pOpt->SetDeletedAuthorAttr(aDeletedAttr); } @@ -1859,7 +1892,23 @@ bool SwRedlineOptionsTabPage::FillItemSet( SfxItemSet* ) pAttr = static_cast<CharAttr *>(pChangedLB->GetEntryData(nPos)); aChangedAttr.nItemId = pAttr->nItemId; aChangedAttr.nAttr = pAttr->nAttr; - aChangedAttr.nColor = pChangedColorLB->GetSelectEntryColor().GetColor(); + + 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; + } + pOpt->SetFormatAuthorAttr(aChangedAttr); } @@ -1908,14 +1957,77 @@ 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; - pInsertColorLB->SelectEntry(Color(nColor)); + + switch (nColor) + { + case COL_TRANSPARENT: + pInsertColorLB->SelectEntryPos(1); + break; + case COL_NONE_COLOR: + pInsertColorLB->SelectEntryPos(0); + break; + default: + pInsertColorLB->SelectEntry(Color(nColor)); + } nColor = rDeletedAttr.nColor; - pDeletedColorLB->SelectEntry(Color(nColor)); + + switch (nColor) + { + case COL_TRANSPARENT: + pDeletedColorLB->SelectEntryPos(1); + break; + case COL_NONE_COLOR: + pDeletedColorLB->SelectEntryPos(0); + break; + default: + pDeletedColorLB->SelectEntry(Color(nColor)); + } nColor = rChangedAttr.nColor; - pChangedColorLB->SelectEntry(Color(nColor)); + + switch (nColor) + { + case COL_TRANSPARENT: + pChangedColorLB->SelectEntryPos(1); + break; + case COL_NONE_COLOR: + pChangedColorLB->SelectEntryPos(0); + break; + default: + pChangedColorLB->SelectEntry(Color(nColor)); + } pMarkColorLB->SelectEntry(pOpt->GetMarkAlignColor()); @@ -1946,13 +2058,13 @@ void SwRedlineOptionsTabPage::Reset( const SfxItemSet* ) AttribHdl(*pChangedLB); ColorHdl(*pChangedColorLB); - ChangedMaskPrev(); + ChangedMaskPrevHdl(*pMarkPosLB); } IMPL_LINK( SwRedlineOptionsTabPage, AttribHdl, ListBox&, rLB, void ) { SvxFontPrevWindow *pPrev = nullptr; - SvxColorListBox *pColorLB; + ColorListBox *pColorLB; if (&rLB == pInsertLB) { @@ -1984,25 +2096,26 @@ IMPL_LINK( SwRedlineOptionsTabPage, AttribHdl, ListBox&, rLB, void ) rFont.SetCaseMap(SVX_CASEMAP_NOT_MAPPED); rCJKFont.SetCaseMap(SVX_CASEMAP_NOT_MAPPED); - Color aColor = pColorLB->GetSelectEntryColor(); + sal_Int32 nPos = pColorLB->GetSelectEntryPos(); - if (aColor == COL_NONE_COLOR) - { - 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 + switch( nPos ) { - rFont.SetColor(aColor); - rCJKFont.SetColor(aColor); + 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; } - sal_Int32 nPos = rLB.GetSelectEntryPos(); + nPos = rLB.GetSelectEntryPos(); if( nPos == LISTBOX_ENTRY_NOTFOUND ) nPos = 0; @@ -2038,11 +2151,12 @@ IMPL_LINK( SwRedlineOptionsTabPage, AttribHdl, ListBox&, rLB, void ) case SID_ATTR_BRUSH: { - Color aBgColor = pColorLB->GetSelectEntryColor(); - if (aBgColor != COL_NONE_COLOR) - pPrev->SetColor(aBgColor); + nPos = pColorLB->GetSelectEntryPos(); + if( nPos ) + pPrev->SetColor( pColorLB->GetSelectEntryColor() ); else - pPrev->SetColor(Color(COL_LIGHTGRAY)); + pPrev->SetColor( Color( COL_LIGHTGRAY ) ); + rFont.SetColor( Color( COL_BLACK ) ); rCJKFont.SetColor( Color( COL_BLACK ) ); } @@ -2052,9 +2166,9 @@ IMPL_LINK( SwRedlineOptionsTabPage, AttribHdl, ListBox&, rLB, void ) pPrev->Invalidate(); } -IMPL_LINK( SwRedlineOptionsTabPage, ColorHdl, SvxColorListBox&, rListBox, void ) +IMPL_LINK( SwRedlineOptionsTabPage, ColorHdl, ListBox&, rListBox, void ) { - SvxColorListBox* pColorLB = &rListBox; + ColorListBox* pColorLB = static_cast<ColorListBox*>(&rListBox); SvxFontPrevWindow *pPrev = nullptr; ListBox* pLB; @@ -2086,38 +2200,38 @@ IMPL_LINK( SwRedlineOptionsTabPage, ColorHdl, SvxColorListBox&, rListBox, void ) { rFont.SetColor( Color( COL_BLACK ) ); rCJKFont.SetColor( Color( COL_BLACK ) ); - - Color aBgColor = pColorLB->GetSelectEntryColor(); - if (aBgColor != COL_NONE_COLOR) - pPrev->SetColor(aBgColor); + nPos = pColorLB->GetSelectEntryPos(); + if( nPos && nPos != LISTBOX_ENTRY_NOTFOUND ) + pPrev->SetColor( pColorLB->GetSelectEntryColor() ); else - pPrev->SetColor(Color(COL_LIGHTGRAY)); + pPrev->SetColor( Color( COL_LIGHTGRAY ) ); } else { - Color aColor = pColorLB->GetSelectEntryColor(); + nPos = pColorLB->GetSelectEntryPos(); - if (aColor == COL_NONE_COLOR) - { - rFont.SetColor( Color( COL_BLACK ) ); - rCJKFont.SetColor( Color( COL_BLACK ) ); - } - else if (aColor == COL_TRANSPARENT) + switch( nPos ) { - rFont.SetColor( Color( COL_RED ) ); - rCJKFont.SetColor( Color( COL_RED ) ); - } - else - { - rFont.SetColor(aColor); - rCJKFont.SetColor(aColor); + 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; } } pPrev->Invalidate(); } -void SwRedlineOptionsTabPage::ChangedMaskPrev() +IMPL_LINK_NOARG(SwRedlineOptionsTabPage, ChangedMaskPrevHdl, ListBox&, void) { pMarkPreviewWN->SetMarkPos(pMarkPosLB->GetSelectEntryPos()); pMarkPreviewWN->SetColor(pMarkColorLB->GetSelectEntryColor().GetColor()); @@ -2125,16 +2239,6 @@ void SwRedlineOptionsTabPage::ChangedMaskPrev() 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 6d038be747f1..f3d5931111e0 100644 --- a/sw/source/ui/frmdlg/column.cxx +++ b/sw/source/ui/frmdlg/column.cxx @@ -25,7 +25,6 @@ #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> @@ -498,11 +497,12 @@ SwColumnPage::SwColumnPage(vcl::Window *pParent, const SfxItemSet &rSet) m_pAutoWidthBox->SetClickHdl(LINK(this, SwColumnPage, AutoWidthHdl)); aLk = LINK( this, SwColumnPage, UpdateColMgr ); - m_pLineTypeDLB->SetSelectHdl(LINK(this, SwColumnPage, UpdateColMgrListBox)); + Link<ListBox&,void> aLk2 = LINK( this, SwColumnPage, UpdateColMgrListBox ); + m_pLineTypeDLB->SetSelectHdl( aLk2 ); m_pLineWidthEdit->SetModifyHdl( aLk ); - m_pLineColorDLB->SetSelectHdl(LINK( this, SwColumnPage, UpdateColMgrColorBox)); + m_pLineColorDLB->SetSelectHdl( aLk2 ); m_pLineHeightEdit->SetModifyHdl( aLk ); - m_pLinePosDLB->SetSelectHdl(LINK(this, SwColumnPage, UpdateColMgrListBox)); + m_pLinePosDLB->SetSelectHdl( aLk2 ); // Separator line m_pLineTypeDLB->SetUnit( FUNIT_POINT ); @@ -525,7 +525,29 @@ SwColumnPage::SwColumnPage(vcl::Window *pParent, const SfxItemSet &rSet) m_pLineWidthEdit->GetDecimalDigits( ), m_pLineWidthEdit->GetUnit(), MapUnit::MapTwip )); m_pLineTypeDLB->SetWidth( nLineWidth ); - m_pLineColorDLB->SelectEntry(COL_BLACK); + + // 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 ); } SwColumnPage::~SwColumnPage() @@ -679,18 +701,10 @@ 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 691105f269ad..43a51888edf1 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(SwFootNotePage, LineColorSelected_Impl, SvxColorListBox&, rColorBox, void) +IMPL_LINK_NOARG(SwFootNotePage, LineColorSelected_Impl, ListBox&, void) { - m_pLineTypeBox->SetColor(rColorBox.GetSelectEntryColor()); + m_pLineTypeBox->SetColor( m_pLineColorBox->GetSelectEntryColor() ); } SwFootNotePage::SwFootNotePage(vcl::Window *pParent, const SfxItemSet &rSet) @@ -211,9 +211,41 @@ void SwFootNotePage::Reset(const SfxItemSet *rSet) m_pLineTypeBox->SelectEntry( pFootnoteInfo->GetLineStyle() ); // Separator Color - m_pLineColorBox->SelectEntry(pFootnoteInfo->GetLineColor()); - m_pLineColorBox->SetSelectHdl(LINK(this, SwFootNotePage, LineColorSelected_Impl)); - m_pLineTypeBox->SetColor(pFootnoteInfo->GetLineColor()); + 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() ); // 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 e622569496ca..583e2c2332dc 100644 --- a/sw/source/ui/misc/pggrid.cxx +++ b/sw/source/ui/misc/pggrid.cxx @@ -23,7 +23,6 @@ #include <hintids.hxx> #include <swtypes.hxx> #include <globals.hrc> -#include <svx/colorbox.hxx> #include <svx/xtable.hxx> #include <uitool.hxx> #include <editeng/sizeitem.hxx> @@ -103,12 +102,23 @@ SwTextGridPage::SwTextGridPage(vcl::Window *pParent, const SfxItemSet &rSet) : m_pLinesGridRB->SetClickHdl(aGridTypeHdl); m_pCharsGridRB->SetClickHdl(aGridTypeHdl); - m_pColorLB->SetSelectHdl(LINK(this, SwTextGridPage, ColorModifyHdl)); + m_pColorLB->SetSelectHdl(LINK(this, SwTextGridPage, GridModifyHdl)); 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 ) @@ -424,7 +434,7 @@ IMPL_LINK(SwTextGridPage, CharorLineChangedHdl, SpinField&, rField, void) SetLinesOrCharsRanges( *m_pCharsRangeFT , m_pCharsPerLineNF->GetMax() ); } } - GridModifyHdl(); + GridModifyHdl(*m_pColorLB); } IMPL_LINK(SwTextGridPage, TextSizeLoseFocusHdl, Control&, rControl, void) @@ -479,7 +489,7 @@ IMPL_LINK(SwTextGridPage, TextSizeChangedHdl, SpinField&, rField, void) } //rubySize is disabled } - GridModifyHdl(); + GridModifyHdl(*m_pColorLB); } IMPL_LINK(SwTextGridPage, GridTypeHdl, Button*, pButton, void) @@ -505,7 +515,7 @@ IMPL_LINK(SwTextGridPage, GridTypeHdl, Button*, pButton, void) m_pCharWidthMF->Enable(false); } - GridModifyHdl(); + GridModifyHdl(*m_pColorLB); } IMPL_LINK_NOARG(SwTextGridPage, DisplayGridHdl, Button*, void) @@ -517,15 +527,9 @@ IMPL_LINK_NOARG(SwTextGridPage, DisplayGridHdl, Button*, void) IMPL_LINK_NOARG(SwTextGridPage, GridModifyClickHdl, Button*, void) { - GridModifyHdl(); -} - -IMPL_LINK_NOARG(SwTextGridPage, ColorModifyHdl, SvxColorListBox&, void) -{ - GridModifyHdl(); + GridModifyHdl(*m_pColorLB); } - -void SwTextGridPage::GridModifyHdl() +IMPL_LINK_NOARG(SwTextGridPage, GridModifyHdl, ListBox&, void) { const SfxItemSet& rOldSet = GetItemSet(); SfxItemSet aSet(rOldSet); diff --git a/sw/source/uibase/app/swmodul1.cxx b/sw/source/uibase/app/swmodul1.cxx index d3e4374ec5b5..6d0030bee543 100644 --- a/sw/source/uibase/app/swmodul1.cxx +++ b/sw/source/uibase/app/swmodul1.cxx @@ -28,7 +28,6 @@ #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 d52d9a7cbbbd..bbaaef6cad08 100644 --- a/sw/source/uibase/inc/column.hxx +++ b/sw/source/uibase/inc/column.hxx @@ -31,7 +31,6 @@ #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> @@ -106,7 +105,7 @@ class SwColumnPage : public SfxTabPage VclPtr<FixedText> m_pLineWidthLbl; VclPtr<MetricField> m_pLineWidthEdit; VclPtr<FixedText> m_pLineColorLbl; - VclPtr<SvxColorListBox> m_pLineColorDLB; + VclPtr<ColorListBox> m_pLineColorDLB; VclPtr<FixedText> m_pLineHeightLbl; VclPtr<MetricField> m_pLineHeightEdit; VclPtr<FixedText> m_pLinePosLbl; @@ -147,7 +146,6 @@ 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 cfc6bf16ecbd..5f768e2d27a5 100644 --- a/sw/source/uibase/inc/optpage.hxx +++ b/sw/source/uibase/inc/optpage.hxx @@ -30,7 +30,6 @@ #include <vcl/fixed.hxx> #include <svtools/ctrlbox.hxx> -#include <svx/colorbox.hxx> #include <svx/fntctrl.hxx> #include <fontcfg.hxx> class SfxPrinter; @@ -313,26 +312,27 @@ public: class SwRedlineOptionsTabPage : public SfxTabPage { VclPtr<ListBox> pInsertLB; - VclPtr<SvxColorListBox> pInsertColorLB; + VclPtr<ColorListBox> pInsertColorLB; VclPtr<SvxFontPrevWindow> pInsertedPreviewWN; VclPtr<ListBox> pDeletedLB; - VclPtr<SvxColorListBox> pDeletedColorLB; + VclPtr<ColorListBox> pDeletedColorLB; VclPtr<SvxFontPrevWindow> pDeletedPreviewWN; VclPtr<ListBox> pChangedLB; - VclPtr<SvxColorListBox> pChangedColorLB; + VclPtr<ColorListBox> pChangedColorLB; VclPtr<SvxFontPrevWindow> pChangedPreviewWN; VclPtr<ListBox> pMarkPosLB; - VclPtr<SvxColorListBox> pMarkColorLB; + VclPtr<ColorListBox> pMarkColorLB; VclPtr<SwMarkPreview> pMarkPreviewWN; + OUString sAuthor; + OUString sNone; + DECL_LINK(AttribHdl, ListBox&, void); - void ChangedMaskPrev(); DECL_LINK(ChangedMaskPrevHdl, ListBox&, void); - DECL_LINK(ChangedMaskColorPrevHdl, SvxColorListBox&, void); - DECL_LINK(ColorHdl, SvxColorListBox&, void); + DECL_LINK(ColorHdl, ListBox&, void); static void InitFontStyle(SvxFontPrevWindow& rExampleWin); diff --git a/sw/source/uibase/inc/pgfnote.hxx b/sw/source/uibase/inc/pgfnote.hxx index 81a69ab2bc90..4ca6e8d8edc1 100644 --- a/sw/source/uibase/inc/pgfnote.hxx +++ b/sw/source/uibase/inc/pgfnote.hxx @@ -27,7 +27,6 @@ #include <vcl/group.hxx> #include <svtools/ctrlbox.hxx> -#include <svx/colorbox.hxx> // footnote settings TabPage class SwFootNotePage: public SfxTabPage @@ -54,7 +53,7 @@ private: VclPtr<ListBox> m_pLinePosBox; VclPtr<LineListBox> m_pLineTypeBox; VclPtr<MetricField> m_pLineWidthEdit; - VclPtr<SvxColorListBox> m_pLineColorBox; + VclPtr<ColorListBox> m_pLineColorBox; VclPtr<MetricField> m_pLineLengthEdit; VclPtr<MetricField> m_pLineDistEdit; @@ -62,7 +61,7 @@ private: DECL_LINK( HeightMetric, Button*, void ); DECL_LINK( HeightModify, Control&, void ); DECL_LINK( LineWidthChanged_Impl, Edit&, void ); - DECL_LINK( LineColorSelected_Impl, SvxColorListBox&, void ); + DECL_LINK( LineColorSelected_Impl, ListBox&, void ); long lMaxHeight; diff --git a/sw/source/uibase/inc/pggrid.hxx b/sw/source/uibase/inc/pggrid.hxx index ab560a6baa31..be73daec9483 100644 --- a/sw/source/uibase/inc/pggrid.hxx +++ b/sw/source/uibase/inc/pggrid.hxx @@ -24,7 +24,6 @@ #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 @@ -58,7 +57,7 @@ class SwTextGridPage: public SfxTabPage VclPtr<CheckBox> m_pDisplayCB; VclPtr<CheckBox> m_pPrintCB; - VclPtr<SvxColorListBox> m_pColorLB; + VclPtr<ColorListBox> m_pColorLB; sal_Int32 m_nRubyUserValue; bool m_bRubyUserValue; @@ -72,14 +71,12 @@ 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(ColorModifyHdl, SvxColorListBox&, void); + DECL_LINK(GridModifyHdl, ListBox&, 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 d9aad7fb1c7a..a0b3b3504613 100644 --- a/sw/source/uibase/shells/drawsh.cxx +++ b/sw/source/uibase/shells/drawsh.cxx @@ -579,6 +579,16 @@ 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(); @@ -606,6 +616,9 @@ 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 2dde2604376f..c159843cb73c 100644 --- a/sw/source/uibase/shells/drwtxtsh.cxx +++ b/sw/source/uibase/shells/drwtxtsh.cxx @@ -239,6 +239,16 @@ 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(); @@ -266,6 +276,9 @@ 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 cde9ae9b5612..95985af7ed5a 100644 --- a/sw/source/uibase/sidebar/PageStylesPanel.cxx +++ b/sw/source/uibase/sidebar/PageStylesPanel.cxx @@ -22,7 +22,6 @@ #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" @@ -143,20 +142,22 @@ void PageStylesPanel::dispose() void PageStylesPanel::Initialize() { aCustomEntry = mpCustomEntry->GetText(); - 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, ModifyFillColorListHdl)); - mpBgGradientLB->SetSelectHdl( LINK(this, PageStylesPanel, ModifyFillColorListHdl)); + mpBgColorLB->SetSelectHdl( LINK(this, PageStylesPanel, ModifyFillColorHdl)); + mpBgGradientLB->SetSelectHdl( LINK(this, PageStylesPanel, ModifyFillColorHdl)); 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() @@ -179,22 +180,49 @@ 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); + mpBgColorLB->SelectEntry( aColor ); + + if(mpBgColorLB->GetSelectEntryCount() == 0) + { + mpBgColorLB->InsertEntry(aColor, OUString()); + 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(); - mpBgGradientLB->SelectEntry(aEndColor); + 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); + } } break; @@ -486,7 +514,7 @@ IMPL_LINK_NOARG(PageStylesPanel, ModifyFillStyleHdl, ListBox&, void) mpBgFillType->Selected(); } -void PageStylesPanel::ModifyFillColor() +IMPL_LINK_NOARG(PageStylesPanel, ModifyFillColorHdl, ListBox&, void) { const drawing::FillStyle eXFS = (drawing::FillStyle)mpBgFillType->GetSelectEntryPos(); SfxObjectShell* pSh = SfxObjectShell::Current(); @@ -536,16 +564,6 @@ void PageStylesPanel::ModifyFillColor() } } -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 558b74e73a67..c0dacdbfb10f 100644 --- a/sw/source/uibase/sidebar/PageStylesPanel.hxx +++ b/sw/source/uibase/sidebar/PageStylesPanel.hxx @@ -49,7 +49,6 @@ #include <svx/pagenumberlistbox.hxx> class List; -class SvxColorListBox; namespace sw { namespace sidebar { class PageStylesPanel: @@ -95,9 +94,9 @@ private: ::sfx2::sidebar::ControllerItem maBgBitmapControl; ::sfx2::sidebar::ControllerItem maBgFillStyleControl; - VclPtr<SvxColorListBox> mpBgColorLB; + VclPtr<ColorLB> mpBgColorLB; VclPtr<SvxFillAttrBox> mpBgHatchingLB; - VclPtr<SvxColorListBox> mpBgGradientLB; + VclPtr<ColorLB> mpBgGradientLB; VclPtr<SvxFillAttrBox> mpBgBitmapLB; VclPtr<ListBox> mpLayoutSelectLB; VclPtr<ListBox> mpColumnCount; @@ -113,14 +112,11 @@ 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 50be6e00d4d7..96f4db0adac5 100644 --- a/sw/uiconfig/swriter/ui/columnpage.ui +++ b/sw/uiconfig/swriter/ui/columnpage.ui @@ -538,7 +538,7 @@ </packing> </child> <child> - <object class="svxlo-SvxColorListBox" id="colorlb"> + <object class="svtlo-ColorListBox" 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 420d24127002..adcfbdb9ef93 100644 --- a/sw/uiconfig/swriter/ui/footnoteareapage.ui +++ b/sw/uiconfig/swriter/ui/footnoteareapage.ui @@ -342,7 +342,7 @@ </packing> </child> <child> - <object class="svxlo-SvxColorListBox" id="color"> + <object class="svtlo-ColorListBox" 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 8d35c0419afd..8f3fc93c0bc7 100644 --- a/sw/uiconfig/swriter/ui/optredlinepage.ui +++ b/sw/uiconfig/swriter/ui/optredlinepage.ui @@ -85,7 +85,7 @@ </packing> </child> <child> - <object class="svxlo-SvxColorListBox" id="insertcolor"> + <object class="svtlo-ColorListBox" 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="svxlo-SvxColorListBox" id="deletedcolor"> + <object class="svtlo-ColorListBox" 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="svxlo-SvxColorListBox" id="changedcolor"> + <object class="svtlo-ColorListBox" 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="svxlo-SvxColorListBox" id="markcolor"> + <object class="svtlo-ColorListBox" id="markcolor"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="valign">center</property> @@ -472,6 +472,18 @@ <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 a905ab333b70..4246cdedd22c 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-SvxColorListBox" id="lbcolor"> + <object class="svxlo-ColorLB" 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-SvxColorListBox" id="lbgradient"> + <object class="svxlo-ColorLB" 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 70ecde4b9d86..d95343da6f12 100644 --- a/sw/uiconfig/swriter/ui/textgridpage.ui +++ b/sw/uiconfig/swriter/ui/textgridpage.ui @@ -476,7 +476,7 @@ </packing> </child> <child> - <object class="svxlo-SvxColorListBox" id="listLB_COLOR"> + <object class="svtlo-ColorListBox" id="listLB_COLOR"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="halign">start</property> |