diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-06-18 21:30:10 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-06-20 16:34:13 +0200 |
commit | d148e5c5db3f3ea32abd6f7bed30665a3931e937 (patch) | |
tree | 7d1f69735f8846bf2f966fd1f878ba9aee76dd7a | |
parent | 361434e4e8fa58e02e694ec8cfa8187eecdf8c7f (diff) |
weld SvxColorTabPage
Change-Id: I5dc6f949edcb34aa110dfa9415e2ac886d0dfa4c
Reviewed-on: https://gerrit.libreoffice.org/56155
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | cui/source/inc/cuitabarea.hxx | 94 | ||||
-rw-r--r-- | cui/source/tabpages/tpcolor.cxx | 419 | ||||
-rw-r--r-- | cui/uiconfig/ui/colorpage.ui | 242 | ||||
-rw-r--r-- | extras/source/glade/libreoffice-catalog.xml.in | 3 | ||||
-rw-r--r-- | include/svtools/valueset.hxx | 15 | ||||
-rw-r--r-- | include/svx/Palette.hxx | 1 | ||||
-rw-r--r-- | include/svx/PaletteManager.hxx | 2 | ||||
-rw-r--r-- | include/svx/SvxColorValueSet.hxx | 2 | ||||
-rw-r--r-- | include/svx/hexcolorcontrol.hxx | 15 | ||||
-rw-r--r-- | include/vcl/vclenum.hxx | 7 | ||||
-rw-r--r-- | include/vcl/weld.hxx | 3 | ||||
-rw-r--r-- | sc/source/ui/miscdlgs/tabbgcolordlg.cxx | 3 | ||||
-rw-r--r-- | svtools/source/control/valueset.cxx | 118 | ||||
-rw-r--r-- | svx/inc/palettes.hxx | 3 | ||||
-rw-r--r-- | svx/source/dialog/hexcolorcontrol.cxx | 107 | ||||
-rw-r--r-- | svx/source/tbxctrls/Palette.cxx | 37 | ||||
-rw-r--r-- | svx/source/tbxctrls/PaletteManager.cxx | 52 | ||||
-rw-r--r-- | svx/source/tbxctrls/SvxColorValueSet.cxx | 52 | ||||
-rw-r--r-- | vcl/source/app/salvtables.cxx | 26 | ||||
-rw-r--r-- | vcl/source/window/layout.cxx | 4 | ||||
-rw-r--r-- | vcl/unx/gtk3/gtk3gtkinst.cxx | 154 |
21 files changed, 770 insertions, 589 deletions
diff --git a/cui/source/inc/cuitabarea.hxx b/cui/source/inc/cuitabarea.hxx index 7a72431bb9a5..2c8e55234fe9 100644 --- a/cui/source/inc/cuitabarea.hxx +++ b/cui/source/inc/cuitabarea.hxx @@ -654,43 +654,6 @@ class SvxColorTabPage : public SfxTabPage private: VclPtr<Window> mpTopDlg; - PaletteManager maPaletteManager; - VclPtr<ListBox> m_pSelectPalette; - VclPtr<SvxColorValueSet> m_pValSetColorList; - VclPtr<SvxColorValueSet> m_pValSetRecentList; - - VclPtr<SvxXRectPreview> m_pCtlPreviewOld; - VclPtr<SvxXRectPreview> m_pCtlPreviewNew; - - VclPtr<RadioButton> m_pRbRGB; - VclPtr<RadioButton> m_pRbCMYK; - - VclPtr<VclContainer> m_pRGBcustom; - VclPtr<VclContainer> m_pRGBpreset; - VclPtr<NumericField> m_pRcustom; - VclPtr<NumericField> m_pRpreset; - VclPtr<NumericField> m_pGcustom; - VclPtr<NumericField> m_pGpreset; - VclPtr<NumericField> m_pBcustom; - VclPtr<NumericField> m_pBpreset; - VclPtr<HexColorControl> m_pHexpreset; - VclPtr<HexColorControl> m_pHexcustom; - - VclPtr<VclContainer> m_pCMYKcustom; - VclPtr<VclContainer> m_pCMYKpreset; - VclPtr<MetricField> m_pCcustom; - VclPtr<MetricField> m_pCpreset; - VclPtr<MetricField> m_pYcustom; - VclPtr<MetricField> m_pYpreset; - VclPtr<MetricField> m_pMcustom; - VclPtr<MetricField> m_pMpreset; - VclPtr<MetricField> m_pKcustom; - VclPtr<MetricField> m_pKpreset; - - VclPtr<PushButton> m_pBtnAdd; - VclPtr<PushButton> m_pBtnDelete; - VclPtr<PushButton> m_pBtnWorkOn; - const SfxItemSet& rOutAttrs; XColorListRef pColorList; @@ -705,6 +668,44 @@ private: Color aPreviousColor; Color aCurrentColor; + css::uno::Reference< css::uno::XComponentContext > m_context; + + PaletteManager maPaletteManager; + XRectPreview m_aCtlPreviewOld; + XRectPreview m_aCtlPreviewNew; + std::unique_ptr<ColorValueSet> m_xValSetColorList; + std::unique_ptr<ColorValueSet> m_xValSetRecentList; + std::unique_ptr<weld::ComboBoxText> m_xSelectPalette; + std::unique_ptr<weld::RadioButton> m_xRbRGB; + std::unique_ptr<weld::RadioButton> m_xRbCMYK; + std::unique_ptr<weld::Widget> m_xRGBcustom; + std::unique_ptr<weld::Widget> m_xRGBpreset; + std::unique_ptr<weld::Entry> m_xRpreset; + std::unique_ptr<weld::Entry> m_xGpreset; + std::unique_ptr<weld::Entry> m_xBpreset; + std::unique_ptr<weld::SpinButton> m_xRcustom; + std::unique_ptr<weld::SpinButton> m_xGcustom; + std::unique_ptr<weld::SpinButton> m_xBcustom; + std::unique_ptr<weld::HexColorControl> m_xHexpreset; + std::unique_ptr<weld::HexColorControl> m_xHexcustom; + std::unique_ptr<weld::Widget> m_xCMYKcustom; + std::unique_ptr<weld::Widget> m_xCMYKpreset; + std::unique_ptr<weld::Entry> m_xCpreset; + std::unique_ptr<weld::Entry> m_xYpreset; + std::unique_ptr<weld::Entry> m_xMpreset; + std::unique_ptr<weld::Entry> m_xKpreset; + std::unique_ptr<weld::MetricSpinButton> m_xCcustom; + std::unique_ptr<weld::MetricSpinButton> m_xYcustom; + std::unique_ptr<weld::MetricSpinButton> m_xMcustom; + std::unique_ptr<weld::MetricSpinButton> m_xKcustom; + std::unique_ptr<weld::Button> m_xBtnAdd; + std::unique_ptr<weld::Button> m_xBtnDelete; + std::unique_ptr<weld::Button> m_xBtnWorkOn; + std::unique_ptr<weld::CustomWeld> m_xCtlPreviewOld; + std::unique_ptr<weld::CustomWeld> m_xCtlPreviewNew; + std::unique_ptr<weld::CustomWeld> m_xValSetColorListWin; + std::unique_ptr<weld::CustomWeld> m_xValSetRecentListWin; + static void ConvertColorValues (Color& rColor, ColorModel eModell); static void RgbToCmyk_Impl( Color& rColor, sal_uInt16& rK ); static void CmykToRgb_Impl( Color& rColor, const sal_uInt16 nKey ); @@ -714,27 +715,28 @@ private: void ImpColorCountChanged(); void FillPaletteLB(); - DECL_LINK( ClickAddHdl_Impl, Button*, void ); - DECL_LINK( ClickWorkOnHdl_Impl, Button*, void ); - DECL_LINK( ClickDeleteHdl_Impl, Button*, void ); + DECL_LINK(ClickAddHdl_Impl, weld::Button&, void); + DECL_LINK(ClickWorkOnHdl_Impl, weld::Button&, void); + DECL_LINK(ClickDeleteHdl_Impl, weld::Button&, void); - DECL_LINK( SelectPaletteLBHdl, ListBox&, void ); - DECL_LINK( SelectValSetHdl_Impl, ValueSet*, void ); - DECL_LINK( SelectColorModeHdl_Impl, RadioButton&, void ); + DECL_LINK(SelectPaletteLBHdl, weld::ComboBoxText&, void); + DECL_LINK( SelectValSetHdl_Impl, SvtValueSet*, void ); + DECL_LINK( SelectColorModeHdl_Impl, weld::ToggleButton&, void ); void ChangeColor(const Color &rNewColor, bool bUpdatePreset = true); void SetColorModel(ColorModel eModel); void ChangeColorModel(); void UpdateColorValues( bool bUpdatePreset = true ); - DECL_LINK( ModifiedHdl_Impl, Edit&, void ); + DECL_LINK(SpinValueHdl_Impl, weld::SpinButton&, void); + DECL_LINK(MetricSpinValueHdl_Impl, weld::MetricSpinButton&, void); + DECL_LINK(ModifiedHdl_Impl, weld::Entry&, void); void UpdateModified(); - css::uno::Reference< css::uno::XComponentContext > m_context; static sal_Int32 FindInCustomColors( OUString const & aColorName ); sal_Int32 FindInPalette( const Color& rColor ); public: - SvxColorTabPage( vcl::Window* pParent, const SfxItemSet& rInAttrs ); + SvxColorTabPage(TabPageParent pParent, const SfxItemSet& rInAttrs); virtual ~SvxColorTabPage() override; virtual void dispose() override; diff --git a/cui/source/tabpages/tpcolor.cxx b/cui/source/tabpages/tpcolor.cxx index f73359468cbe..113d1f9fb8a8 100644 --- a/cui/source/tabpages/tpcolor.cxx +++ b/cui/source/tabpages/tpcolor.cxx @@ -18,6 +18,7 @@ */ #include <memory> +#include <i18nutil/unicode.hxx> #include <tools/urlobj.hxx> #include <unotools/pathoptions.hxx> #include <sfx2/app.hxx> @@ -53,8 +54,8 @@ using namespace com::sun::star; -SvxColorTabPage::SvxColorTabPage(vcl::Window* pParent, const SfxItemSet& rInAttrs) - : SfxTabPage(pParent, "ColorPage", "cui/ui/colorpage.ui", &rInAttrs) +SvxColorTabPage::SvxColorTabPage(TabPageParent pParent, const SfxItemSet& rInAttrs) + : SfxTabPage(pParent, "cui/ui/colorpage.ui", "ColorPage", &rInAttrs) , mpTopDlg( GetParentDialog() ) , rOutAttrs ( rInAttrs ) // All the horrific pointers we store and should not @@ -63,99 +64,98 @@ SvxColorTabPage::SvxColorTabPage(vcl::Window* pParent, const SfxItemSet& rInAttr , rXFSet( aXFillAttr.GetItemSet() ) , eCM( ColorModel::RGB ) , m_context(comphelper::getProcessComponentContext()) + , m_xValSetColorList(new ColorValueSet(m_xBuilder->weld_scrolled_window("colorsetwin"))) + , m_xValSetRecentList(new ColorValueSet(nullptr)) + , m_xSelectPalette(m_xBuilder->weld_combo_box_text("paletteselector")) + , m_xRbRGB(m_xBuilder->weld_radio_button("RGB")) + , m_xRbCMYK(m_xBuilder->weld_radio_button("CMYK")) + , m_xRGBcustom(m_xBuilder->weld_widget("rgbcustom")) + , m_xRGBpreset(m_xBuilder->weld_widget("rgbpreset")) + , m_xRpreset(m_xBuilder->weld_entry("R_preset")) + , m_xGpreset(m_xBuilder->weld_entry("G_preset")) + , m_xBpreset(m_xBuilder->weld_entry("B_preset")) + , m_xRcustom(m_xBuilder->weld_spin_button("R_custom")) + , m_xGcustom(m_xBuilder->weld_spin_button("G_custom")) + , m_xBcustom(m_xBuilder->weld_spin_button("B_custom")) + , m_xHexpreset(new weld::HexColorControl(m_xBuilder->weld_entry("hex_preset"))) + , m_xHexcustom(new weld::HexColorControl(m_xBuilder->weld_entry("hex_custom"))) + , m_xCMYKcustom(m_xBuilder->weld_widget("cmykcustom")) + , m_xCMYKpreset(m_xBuilder->weld_widget("cmykpreset")) + , m_xCpreset(m_xBuilder->weld_entry("C_preset")) + , m_xYpreset(m_xBuilder->weld_entry("Y_preset")) + , m_xMpreset(m_xBuilder->weld_entry("M_preset")) + , m_xKpreset(m_xBuilder->weld_entry("K_preset")) + , m_xCcustom(m_xBuilder->weld_metric_spin_button("C_custom", FUNIT_PERCENT)) + , m_xYcustom(m_xBuilder->weld_metric_spin_button("Y_custom", FUNIT_PERCENT)) + , m_xMcustom(m_xBuilder->weld_metric_spin_button("M_custom", FUNIT_PERCENT)) + , m_xKcustom(m_xBuilder->weld_metric_spin_button("K_custom", FUNIT_PERCENT)) + , m_xBtnAdd(m_xBuilder->weld_button("add")) + , m_xBtnDelete(m_xBuilder->weld_button("delete")) + , m_xBtnWorkOn(m_xBuilder->weld_button("edit")) + , m_xCtlPreviewOld(new weld::CustomWeld(*m_xBuilder, "oldpreview", m_aCtlPreviewOld)) + , m_xCtlPreviewNew(new weld::CustomWeld(*m_xBuilder, "newpreview", m_aCtlPreviewNew)) + , m_xValSetColorListWin(new weld::CustomWeld(*m_xBuilder, "colorset", *m_xValSetColorList)) + , m_xValSetRecentListWin(new weld::CustomWeld(*m_xBuilder, "recentcolorset", *m_xValSetRecentList)) { - get(m_pSelectPalette, "paletteselector"); - get(m_pValSetColorList, "colorset"); Size aSize = LogicToPixel(Size(100 , 120), MapMode(MapUnit::MapAppFont)); - m_pValSetColorList->set_width_request(aSize.Width()); - m_pValSetColorList->set_height_request(aSize.Height()); - get(m_pValSetRecentList, "recentcolorset"); - get(m_pCtlPreviewOld, "oldpreview"); - get(m_pCtlPreviewNew, "newpreview"); + m_xValSetColorList->set_size_request(aSize.Width(), aSize.Height()); aSize = LogicToPixel(Size(34 , 25), MapMode(MapUnit::MapAppFont)); - m_pCtlPreviewOld->set_width_request(aSize.Width()); - m_pCtlPreviewOld->set_height_request(aSize.Height()); - m_pCtlPreviewNew->set_width_request(aSize.Width()); - m_pCtlPreviewNew->set_height_request(aSize.Height()); - get(m_pRbRGB, "RGB"); - get(m_pRbCMYK, "CMYK"); - get(m_pRGBcustom, "rgbcustom"); - get(m_pRGBpreset, "rgbpreset"); - get(m_pRcustom, "R_custom"); - get(m_pRpreset, "R_preset-nospin"); - get(m_pGcustom, "G_custom"); - get(m_pGpreset, "G_preset-nospin"); - get(m_pBcustom, "B_custom"); - get(m_pBpreset, "B_preset-nospin"); - get(m_pHexpreset, "hex_preset"); - get(m_pHexcustom, "hex_custom"); - get(m_pCMYKcustom, "cmykcustom"); - get(m_pCMYKpreset, "cmykpreset"); - get(m_pCcustom, "C_custom"); - get(m_pCpreset, "C_preset-nospin"); - get(m_pYcustom, "Y_custom"); - get(m_pYpreset, "Y_preset-nospin"); - get(m_pMcustom, "M_custom"); - get(m_pMpreset, "M_preset-nospin"); - get(m_pKcustom, "K_custom"); - get(m_pKpreset, "K_preset-nospin"); - get(m_pBtnAdd, "add"); - get(m_pBtnDelete, "delete"); - get(m_pBtnWorkOn, "edit"); - + m_aCtlPreviewOld.set_size_request(aSize.Width(), aSize.Height()); + m_aCtlPreviewNew.set_size_request(aSize.Width(), aSize.Height()); // this page needs ExchangeSupport SetExchangeSupport(); // setting the output device rXFSet.Put( XFillStyleItem(drawing::FillStyle_SOLID) ); rXFSet.Put( XFillColorItem(OUString(), COL_BLACK) ); - m_pCtlPreviewOld->SetAttributes( aXFillAttr.GetItemSet() ); - m_pCtlPreviewNew->SetAttributes( aXFillAttr.GetItemSet() ); + m_aCtlPreviewOld.SetAttributes( aXFillAttr.GetItemSet() ); + m_aCtlPreviewNew.SetAttributes( aXFillAttr.GetItemSet() ); // set handler - m_pSelectPalette->SetSelectHdl( LINK(this, SvxColorTabPage, SelectPaletteLBHdl) ); - Link<ValueSet*, void> aValSelectLink = LINK( this, SvxColorTabPage, SelectValSetHdl_Impl ); - m_pValSetColorList->SetSelectHdl( aValSelectLink ); - m_pValSetRecentList->SetSelectHdl( aValSelectLink ); - - Link<Edit&,void> aLink = LINK( this, SvxColorTabPage, ModifiedHdl_Impl ); - m_pRcustom->SetModifyHdl( aLink ); - m_pGcustom->SetModifyHdl( aLink ); - m_pBcustom->SetModifyHdl( aLink ); - m_pHexpreset->SetModifyHdl( aLink ); - m_pHexcustom->SetModifyHdl( aLink ); - m_pCcustom->SetModifyHdl( aLink ); - m_pYcustom->SetModifyHdl( aLink ); - m_pMcustom->SetModifyHdl( aLink ); - m_pKcustom->SetModifyHdl( aLink ); - - Link<RadioButton&,void> aLink2 = LINK( this, SvxColorTabPage, SelectColorModeHdl_Impl ); - m_pRbRGB->SetToggleHdl( aLink2 ); - m_pRbCMYK->SetToggleHdl( aLink2 ); + m_xSelectPalette->connect_changed(LINK(this, SvxColorTabPage, SelectPaletteLBHdl)); + Link<SvtValueSet*, void> aValSelectLink = LINK(this, SvxColorTabPage, SelectValSetHdl_Impl); + m_xValSetColorList->SetSelectHdl(aValSelectLink); + m_xValSetRecentList->SetSelectHdl(aValSelectLink); + + Link<weld::SpinButton&,void> aSpinLink = LINK(this, SvxColorTabPage, SpinValueHdl_Impl); + m_xRcustom->connect_value_changed(aSpinLink); + m_xGcustom->connect_value_changed(aSpinLink); + m_xBcustom->connect_value_changed(aSpinLink); + Link<weld::Entry&,void> aEntryLink = LINK(this, SvxColorTabPage, ModifiedHdl_Impl); + m_xHexcustom->connect_changed(aEntryLink); + Link<weld::MetricSpinButton&,void> aMetricSpinLink = LINK(this, SvxColorTabPage, MetricSpinValueHdl_Impl); + m_xCcustom->connect_value_changed(aMetricSpinLink); + m_xYcustom->connect_value_changed(aMetricSpinLink); + m_xMcustom->connect_value_changed(aMetricSpinLink); + m_xKcustom->connect_value_changed(aMetricSpinLink); + + Link<weld::ToggleButton&,void> aLink2 = LINK( this, SvxColorTabPage, SelectColorModeHdl_Impl ); + m_xRbRGB->connect_toggled(aLink2); + m_xRbCMYK->connect_toggled(aLink2); SetColorModel( eCM ); ChangeColorModel(); - m_pBtnAdd->SetClickHdl( LINK( this, SvxColorTabPage, ClickAddHdl_Impl ) ); - m_pBtnWorkOn->SetClickHdl( LINK( this, SvxColorTabPage, ClickWorkOnHdl_Impl ) ); - m_pBtnDelete->SetClickHdl( LINK( this, SvxColorTabPage, ClickDeleteHdl_Impl ) ); + m_xBtnAdd->connect_clicked( LINK( this, SvxColorTabPage, ClickAddHdl_Impl ) ); + m_xBtnWorkOn->connect_clicked( LINK( this, SvxColorTabPage, ClickWorkOnHdl_Impl ) ); + m_xBtnDelete->connect_clicked( LINK( this, SvxColorTabPage, ClickDeleteHdl_Impl ) ); // disable modify buttons // Color palettes can't be modified - m_pBtnDelete->Disable(); + m_xBtnDelete->set_sensitive(false); // disable preset color values - m_pRGBpreset->Disable(); - m_pCMYKpreset->Disable(); + m_xRGBpreset->set_sensitive(false); + m_xCMYKpreset->set_sensitive(false); // ValueSet - m_pValSetColorList->SetStyle( m_pValSetColorList->GetStyle() | WB_ITEMBORDER ); - m_pValSetColorList->Show(); + m_xValSetColorList->SetStyle(m_xValSetColorList->GetStyle() | WB_ITEMBORDER); + m_xValSetColorList->Show(); + + m_xValSetRecentList->SetStyle(m_xValSetRecentList->GetStyle() | WB_ITEMBORDER); + m_xValSetRecentList->Show(); - m_pValSetRecentList->SetStyle( m_pValSetColorList->GetStyle() | WB_ITEMBORDER ); - m_pValSetRecentList->Show(); - maPaletteManager.ReloadRecentColorSet( *m_pValSetRecentList ); - aSize = m_pValSetRecentList->layoutAllVisible(maPaletteManager.GetRecentColorCount()); - m_pValSetRecentList->set_height_request(aSize.Height()); - m_pValSetRecentList->set_width_request(aSize.Width()); + maPaletteManager.ReloadRecentColorSet(*m_xValSetRecentList); + aSize = m_xValSetRecentList->layoutAllVisible(maPaletteManager.GetRecentColorCount()); + m_xValSetRecentList->set_size_request(aSize.Width(), aSize.Height()); } SvxColorTabPage::~SvxColorTabPage() @@ -166,36 +166,8 @@ SvxColorTabPage::~SvxColorTabPage() void SvxColorTabPage::dispose() { mpTopDlg.clear(); - m_pSelectPalette.clear(); - m_pValSetColorList.clear(); - m_pValSetRecentList.clear(); - m_pCtlPreviewOld.clear(); - m_pCtlPreviewNew.clear(); - m_pRbRGB.clear(); - m_pRbCMYK.clear(); - m_pRGBcustom.clear(); - m_pRGBpreset.clear(); - m_pRcustom.clear(); - m_pRpreset.clear(); - m_pGcustom.clear(); - m_pGpreset.clear(); - m_pBcustom.clear(); - m_pBpreset.clear(); - m_pHexpreset.clear(); - m_pHexcustom.clear(); - m_pCMYKcustom.clear(); - m_pCMYKpreset.clear(); - m_pCcustom.clear(); - m_pCpreset.clear(); - m_pYcustom.clear(); - m_pYpreset.clear(); - m_pMcustom.clear(); - m_pMpreset.clear(); - m_pKcustom.clear(); - m_pKpreset.clear(); - m_pBtnAdd.clear(); - m_pBtnDelete.clear(); - m_pBtnWorkOn.clear(); + m_xValSetRecentList.reset(); + m_xValSetColorList.reset(); SfxTabPage::dispose(); } @@ -203,23 +175,23 @@ void SvxColorTabPage::ImpColorCountChanged() { if (!pColorList.is()) return; - m_pValSetColorList->SetColCount(SvxColorValueSet::getColumnCount()); - m_pValSetRecentList->SetColCount(SvxColorValueSet::getColumnCount()); + m_xValSetColorList->SetColCount(SvxColorValueSet::getColumnCount()); + m_xValSetRecentList->SetColCount(SvxColorValueSet::getColumnCount()); } void SvxColorTabPage::FillPaletteLB() { - m_pSelectPalette->Clear(); + m_xSelectPalette->clear(); std::vector<OUString> aPaletteList = maPaletteManager.GetPaletteList(); for (auto const& palette : aPaletteList) { - m_pSelectPalette->InsertEntry(palette); + m_xSelectPalette->append_text(palette); } OUString aPaletteName( officecfg::Office::Common::UserColors::PaletteName::get() ); - m_pSelectPalette->SelectEntry(aPaletteName); - if (m_pSelectPalette->GetSelectedEntryPos() != LISTBOX_ENTRY_NOTFOUND) + m_xSelectPalette->set_active_text(aPaletteName); + if (m_xSelectPalette->get_active() != -1) { - SelectPaletteLBHdl( *m_pSelectPalette ); + SelectPaletteLBHdl(*m_xSelectPalette); } } @@ -247,15 +219,15 @@ void SvxColorTabPage::ActivatePage( const SfxItemSet& ) sal_Int32 nPos = FindInPalette( aColor ); if ( nPos != -1 ) - m_pValSetColorList->SelectItem( m_pValSetColorList->GetItemId( nPos ) ); + m_xValSetColorList->SelectItem(m_xValSetColorList->GetItemId(nPos)); // else search in other palettes? } - m_pCtlPreviewOld->SetAttributes( aXFillAttr.GetItemSet() ); - m_pCtlPreviewOld->Invalidate(); + m_aCtlPreviewOld.SetAttributes(aXFillAttr.GetItemSet()); + m_aCtlPreviewOld.Invalidate(); - SelectValSetHdl_Impl( m_pValSetColorList ); + SelectValSetHdl_Impl(m_xValSetColorList.get()); } } @@ -267,7 +239,6 @@ DeactivateRC SvxColorTabPage::DeactivatePage( SfxItemSet* _pSet ) return DeactivateRC::LeavePage; } - bool SvxColorTabPage::FillItemSet( SfxItemSet* rSet ) { maPaletteManager.AddRecentColor( aCurrentColor, OUString() ); @@ -279,7 +250,7 @@ bool SvxColorTabPage::FillItemSet( SfxItemSet* rSet ) void SvxColorTabPage::UpdateModified() { bool bEnable = pColorList.is() && pColorList->Count(); - m_pBtnWorkOn->Enable( bEnable ); + m_xBtnWorkOn->set_sensitive(bEnable); } void SvxColorTabPage::Reset( const SfxItemSet* rSet ) @@ -306,48 +277,53 @@ void SvxColorTabPage::Reset( const SfxItemSet* rSet ) UpdateModified(); } - -VclPtr<SfxTabPage> SvxColorTabPage::Create( TabPageParent pWindow, - const SfxItemSet* rOutAttrs ) +VclPtr<SfxTabPage> SvxColorTabPage::Create(TabPageParent pParent, const SfxItemSet* rOutAttrs) { - return VclPtr<SvxColorTabPage>::Create( pWindow.pParent, *rOutAttrs ); + return VclPtr<SvxColorTabPage>::Create(pParent, *rOutAttrs); } // is called when the content of the MtrFields is changed for color values -IMPL_LINK(SvxColorTabPage, ModifiedHdl_Impl, Edit&, rEdit, void) +IMPL_LINK_NOARG(SvxColorTabPage, SpinValueHdl_Impl, weld::SpinButton&, void) { - if (eCM == ColorModel::RGB) - { - // read current MtrFields, if cmyk, then k-value as transparency - if(&rEdit == m_pHexcustom) - aCurrentColor = m_pHexcustom->GetColor(); - else - { - aCurrentColor = Color( static_cast<sal_uInt8>(PercentToColor_Impl( static_cast<sal_uInt16>(m_pRcustom->GetValue()) )), - static_cast<sal_uInt8>(PercentToColor_Impl( static_cast<sal_uInt16>(m_pGcustom->GetValue()) )), - static_cast<sal_uInt8>(PercentToColor_Impl( static_cast<sal_uInt16>(m_pBcustom->GetValue()) )) ); + // read current MtrFields, if cmyk, then k-value as transparency + aCurrentColor = Color(static_cast<sal_uInt8>(PercentToColor_Impl(m_xRcustom->get_value())), + static_cast<sal_uInt8>(PercentToColor_Impl(m_xGcustom->get_value())), + static_cast<sal_uInt8>(PercentToColor_Impl(m_xBcustom->get_value()))); + UpdateColorValues(); - } - UpdateColorValues(); - } - else - { - // read current MtrFields, if cmyk, then k-value as transparency - aCurrentColor = Color( static_cast<sal_uInt8>(PercentToColor_Impl( static_cast<sal_uInt16>(m_pKcustom->GetValue()) )), - static_cast<sal_uInt8>(PercentToColor_Impl( static_cast<sal_uInt16>(m_pCcustom->GetValue()) )), - static_cast<sal_uInt8>(PercentToColor_Impl( static_cast<sal_uInt16>(m_pYcustom->GetValue()) )), - static_cast<sal_uInt8>(PercentToColor_Impl( static_cast<sal_uInt16>(m_pMcustom->GetValue()) )) ); - ConvertColorValues (aCurrentColor, ColorModel::RGB); - } + rXFSet.Put( XFillColorItem( OUString(), aCurrentColor ) ); + m_aCtlPreviewNew.SetAttributes( aXFillAttr.GetItemSet() ); + + m_aCtlPreviewNew.Invalidate(); +} + +IMPL_LINK_NOARG(SvxColorTabPage, MetricSpinValueHdl_Impl, weld::MetricSpinButton&, void) +{ + // read current MtrFields, if cmyk, then k-value as transparency + aCurrentColor = Color(static_cast<sal_uInt8>(PercentToColor_Impl(m_xKcustom->get_value(FUNIT_NONE))), + static_cast<sal_uInt8>(PercentToColor_Impl(m_xCcustom->get_value(FUNIT_NONE))), + static_cast<sal_uInt8>(PercentToColor_Impl(m_xYcustom->get_value(FUNIT_NONE))), + static_cast<sal_uInt8>(PercentToColor_Impl(m_xMcustom->get_value(FUNIT_NONE)))); + ConvertColorValues (aCurrentColor, ColorModel::RGB); rXFSet.Put( XFillColorItem( OUString(), aCurrentColor ) ); - m_pCtlPreviewNew->SetAttributes( aXFillAttr.GetItemSet() ); + m_aCtlPreviewNew.SetAttributes( aXFillAttr.GetItemSet() ); - m_pCtlPreviewNew->Invalidate(); + m_aCtlPreviewNew.Invalidate(); } +IMPL_LINK_NOARG(SvxColorTabPage, ModifiedHdl_Impl, weld::Entry&, void) +{ + aCurrentColor = m_xHexcustom->GetColor(); + UpdateColorValues(); + + rXFSet.Put( XFillColorItem( OUString(), aCurrentColor ) ); + m_aCtlPreviewNew.SetAttributes( aXFillAttr.GetItemSet() ); -IMPL_LINK_NOARG(SvxColorTabPage, ClickAddHdl_Impl, Button*, void) + m_aCtlPreviewNew.Invalidate(); +} + +IMPL_LINK_NOARG(SvxColorTabPage, ClickAddHdl_Impl, weld::Button&, void) { OUString aNewName( SvxResId( RID_SVXSTR_COLOR ) ); OUString aDesc( CuiResId( RID_SVXSTR_DESC_COLOR ) ); @@ -387,8 +363,8 @@ IMPL_LINK_NOARG(SvxColorTabPage, ClickAddHdl_Impl, Button*, void) if (!nError) { - m_pSelectPalette->SelectEntryPos(0); - SelectPaletteLBHdl( *m_pSelectPalette ); + m_xSelectPalette->set_active(0); + SelectPaletteLBHdl(*m_xSelectPalette); std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create(m_context)); css::uno::Sequence< sal_Int32 > aCustomColorList(officecfg::Office::Common::UserColors::CustomColor::get()); css::uno::Sequence< OUString > aCustomColorNameList(officecfg::Office::Common::UserColors::CustomColorName::get()); @@ -400,17 +376,17 @@ IMPL_LINK_NOARG(SvxColorTabPage, ClickAddHdl_Impl, Button*, void) officecfg::Office::Common::UserColors::CustomColor::set(aCustomColorList, batch); officecfg::Office::Common::UserColors::CustomColorName::set(aCustomColorNameList, batch); batch->commit(); - sal_uInt16 nId = m_pValSetColorList->GetItemId(nSize - 1); - m_pValSetColorList->InsertItem( nId + 1 , aCurrentColor, aName ); - m_pValSetColorList->SelectItem( nId + 1 ); - m_pBtnDelete->Enable(); + sal_uInt16 nId = m_xValSetColorList->GetItemId(nSize - 1); + m_xValSetColorList->InsertItem( nId + 1 , aCurrentColor, aName ); + m_xValSetColorList->SelectItem( nId + 1 ); + m_xBtnDelete->set_sensitive(false); ImpColorCountChanged(); } UpdateModified(); } -IMPL_LINK_NOARG(SvxColorTabPage, ClickWorkOnHdl_Impl, Button*, void) +IMPL_LINK_NOARG(SvxColorTabPage, ClickWorkOnHdl_Impl, weld::Button&, void) { std::unique_ptr<SvColorDialog> pColorDlg(new SvColorDialog( GetParentDialog() )); @@ -424,18 +400,18 @@ IMPL_LINK_NOARG(SvxColorTabPage, ClickWorkOnHdl_Impl, Button*, void) UpdateColorValues( false ); // fill ItemSet and pass it on to XOut rXFSet.Put( XFillColorItem( OUString(), aPreviewColor ) ); - //m_pCtlPreviewOld->SetAttributes( aXFillAttr ); - m_pCtlPreviewNew->SetAttributes( aXFillAttr.GetItemSet() ); + //m_aCtlPreviewOld.SetAttributes( aXFillAttr ); + m_aCtlPreviewNew.SetAttributes( aXFillAttr.GetItemSet() ); - m_pCtlPreviewNew->Invalidate(); + m_aCtlPreviewNew.Invalidate(); } } -IMPL_LINK_NOARG(SvxColorTabPage, ClickDeleteHdl_Impl, Button*, void) +IMPL_LINK_NOARG(SvxColorTabPage, ClickDeleteHdl_Impl, weld::Button&, void) { - sal_uInt16 nId = m_pValSetColorList->GetSelectedItemId(); - size_t nPos = m_pValSetColorList->GetSelectItemPos(); - if(m_pSelectPalette->GetSelectedEntryPos() == 0 && nPos != VALUESET_ITEM_NOTFOUND ) + sal_uInt16 nId = m_xValSetColorList->GetSelectedItemId(); + size_t nPos = m_xValSetColorList->GetSelectItemPos(); + if (m_xSelectPalette->get_active() == 0 && nPos != VALUESET_ITEM_NOTFOUND ) { std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create(m_context)); css::uno::Sequence< sal_Int32 > aCustomColorList(officecfg::Office::Common::UserColors::CustomColor::get()); @@ -451,24 +427,24 @@ IMPL_LINK_NOARG(SvxColorTabPage, ClickDeleteHdl_Impl, Button*, void) officecfg::Office::Common::UserColors::CustomColor::set(aCustomColorList, batch); officecfg::Office::Common::UserColors::CustomColorName::set(aCustomColorNameList, batch); batch->commit(); - m_pValSetColorList->RemoveItem(nId); - if(m_pValSetColorList->GetItemCount() != 0) + m_xValSetColorList->RemoveItem(nId); + if (m_xValSetColorList->GetItemCount() != 0) { - nId = m_pValSetColorList->GetItemId(0); - m_pValSetColorList->SelectItem(nId); - SelectValSetHdl_Impl( m_pValSetColorList ); + nId = m_xValSetColorList->GetItemId(0); + m_xValSetColorList->SelectItem(nId); + SelectValSetHdl_Impl(m_xValSetColorList.get()); } else - m_pBtnDelete->Disable(); + m_xBtnDelete->set_sensitive(false); } } -IMPL_LINK_NOARG(SvxColorTabPage, SelectPaletteLBHdl, ListBox&, void) +IMPL_LINK_NOARG(SvxColorTabPage, SelectPaletteLBHdl, weld::ComboBoxText&, void) { - m_pValSetColorList->Clear(); - sal_Int32 nPos = m_pSelectPalette->GetSelectedEntryPos(); + m_xValSetColorList->Clear(); + sal_Int32 nPos = m_xSelectPalette->get_active(); maPaletteManager.SetPalette( nPos ); - maPaletteManager.ReloadColorSet( *m_pValSetColorList ); + maPaletteManager.ReloadColorSet(*m_xValSetColorList); if(nPos != maPaletteManager.GetPaletteCount() - 1 && nPos != 0) { @@ -491,13 +467,13 @@ IMPL_LINK_NOARG(SvxColorTabPage, SelectPaletteLBHdl, ListBox&, void) *pnColorListState &= ~ChangeType::MODIFIED; } } - if(nPos != 0) - m_pBtnDelete->Disable(); + if (nPos != 0) + m_xBtnDelete->set_sensitive(false); - m_pValSetColorList->Resize(); + m_xValSetColorList->Resize(); } -IMPL_LINK(SvxColorTabPage, SelectValSetHdl_Impl, ValueSet*, pValSet, void) +IMPL_LINK(SvxColorTabPage, SelectValSetHdl_Impl, SvtValueSet*, pValSet, void) { sal_Int32 nPos = pValSet->GetSelectedItemId(); if( nPos != 0 ) @@ -505,22 +481,22 @@ IMPL_LINK(SvxColorTabPage, SelectValSetHdl_Impl, ValueSet*, pValSet, void) Color aColor = pValSet->GetItemColor( nPos ); rXFSet.Put( XFillColorItem( OUString(), aColor ) ); - m_pCtlPreviewNew->SetAttributes( aXFillAttr.GetItemSet() ); - m_pCtlPreviewNew->Invalidate(); + m_aCtlPreviewNew.SetAttributes( aXFillAttr.GetItemSet() ); + m_aCtlPreviewNew.Invalidate(); ChangeColor(aColor, false); - if(pValSet == m_pValSetColorList) + if (pValSet == m_xValSetColorList.get()) { - m_pValSetRecentList->SetNoSelection(); - if(m_pSelectPalette->GetSelectedEntryPos() == 0 && m_pValSetColorList->GetSelectedItemId() != 0) - m_pBtnDelete->Enable(); + m_xValSetRecentList->SetNoSelection(); + if (m_xSelectPalette->get_active() == 0 && m_xValSetColorList->GetSelectedItemId() != 0) + m_xBtnDelete->set_sensitive(true); else - m_pBtnDelete->Disable(); + m_xBtnDelete->set_sensitive(false); } - if(pValSet == m_pValSetRecentList) + if (pValSet == m_xValSetRecentList.get()) { - m_pValSetColorList->SetNoSelection(); - m_pBtnDelete->Disable(); + m_xValSetColorList->SetNoSelection(); + m_xBtnDelete->set_sensitive(false); } } } @@ -545,11 +521,12 @@ void SvxColorTabPage::ConvertColorValues (Color& rColor, ColorModel eModell) break; } } -IMPL_LINK(SvxColorTabPage, SelectColorModeHdl_Impl, RadioButton&, rRadioButton, void) + +IMPL_LINK_NOARG(SvxColorTabPage, SelectColorModeHdl_Impl, weld::ToggleButton&, void) { - if( &rRadioButton == m_pRbRGB ) + if (m_xRbRGB->get_active()) eCM = ColorModel::RGB; - if( &rRadioButton == m_pRbCMYK ) + else if (m_xRbCMYK->get_active()) eCM = ColorModel::CMYK; ChangeColorModel(); UpdateColorValues(); @@ -562,18 +539,16 @@ void SvxColorTabPage::ChangeColor(const Color &rNewColor, bool bUpdatePreset ) UpdateColorValues( bUpdatePreset ); // fill ItemSet and pass it on to XOut rXFSet.Put( XFillColorItem( OUString(), aCurrentColor ) ); - m_pCtlPreviewNew->SetAttributes( aXFillAttr.GetItemSet() ); - m_pCtlPreviewNew->Invalidate(); + m_aCtlPreviewNew.SetAttributes(aXFillAttr.GetItemSet()); + m_aCtlPreviewNew.Invalidate(); } void SvxColorTabPage::SetColorModel( ColorModel eModel ) { - m_pRbRGB->SetState(false); - m_pRbCMYK->SetState(false); - if(eModel == ColorModel::RGB) - m_pRbRGB->SetState(true); - if(eModel == ColorModel::CMYK) - m_pRbCMYK->SetState(true); + if (eModel == ColorModel::RGB) + m_xRbRGB->set_active(true); + else if (eModel == ColorModel::CMYK) + m_xRbCMYK->set_active(true); } void SvxColorTabPage::ChangeColorModel() @@ -582,19 +557,19 @@ void SvxColorTabPage::ChangeColorModel() { case ColorModel::RGB: { - m_pRGBcustom->Show(); - m_pRGBpreset->Show(); - m_pCMYKcustom->Hide(); - m_pCMYKpreset->Hide(); + m_xRGBcustom->show(); + m_xRGBpreset->show(); + m_xCMYKcustom->hide(); + m_xCMYKpreset->hide(); } break; case ColorModel::CMYK: { - m_pCMYKcustom->Show(); - m_pCMYKpreset->Show(); - m_pRGBcustom->Hide(); - m_pRGBpreset->Hide(); + m_xCMYKcustom->show(); + m_xCMYKpreset->show(); + m_xRGBcustom->hide(); + m_xRGBpreset->hide(); } break; } @@ -607,17 +582,21 @@ void SvxColorTabPage::UpdateColorValues( bool bUpdatePreset ) ConvertColorValues (aPreviousColor, eCM ); ConvertColorValues (aCurrentColor, eCM); - m_pCcustom->SetValue( ColorToPercent_Impl( aCurrentColor.GetRed() ) ); - m_pMcustom->SetValue( ColorToPercent_Impl( aCurrentColor.GetBlue() ) ); - m_pYcustom->SetValue( ColorToPercent_Impl( aCurrentColor.GetGreen() ) ); - m_pKcustom->SetValue( ColorToPercent_Impl( aCurrentColor.GetTransparency() ) ); + m_xCcustom->set_value( ColorToPercent_Impl( aCurrentColor.GetRed() ), FUNIT_PERCENT ); + m_xMcustom->set_value( ColorToPercent_Impl( aCurrentColor.GetBlue() ), FUNIT_PERCENT ); + m_xYcustom->set_value( ColorToPercent_Impl( aCurrentColor.GetGreen() ), FUNIT_PERCENT ); + m_xKcustom->set_value( ColorToPercent_Impl( aCurrentColor.GetTransparency() ), FUNIT_PERCENT ); if( bUpdatePreset ) { - m_pCpreset->SetValue( ColorToPercent_Impl( aPreviousColor.GetRed() ) ); - m_pMpreset->SetValue( ColorToPercent_Impl( aPreviousColor.GetBlue() ) ); - m_pYpreset->SetValue( ColorToPercent_Impl( aPreviousColor.GetGreen() ) ); - m_pKpreset->SetValue( ColorToPercent_Impl( aPreviousColor.GetTransparency() ) ); + m_xCpreset->set_text(unicode::formatPercent(ColorToPercent_Impl(aPreviousColor.GetRed()), + Application::GetSettings().GetUILanguageTag())); + m_xMpreset->set_text(unicode::formatPercent(ColorToPercent_Impl(aPreviousColor.GetBlue()), + Application::GetSettings().GetUILanguageTag())); + m_xYpreset->set_text(unicode::formatPercent(ColorToPercent_Impl(aPreviousColor.GetGreen()), + Application::GetSettings().GetUILanguageTag())); + m_xKpreset->set_text(unicode::formatPercent(ColorToPercent_Impl(aPreviousColor.GetTransparency()), + Application::GetSettings().GetUILanguageTag())); } ConvertColorValues (aPreviousColor, ColorModel::RGB); @@ -625,17 +604,17 @@ void SvxColorTabPage::UpdateColorValues( bool bUpdatePreset ) } else { - m_pRcustom->SetValue( ColorToPercent_Impl( aCurrentColor.GetRed() ) ); - m_pGcustom->SetValue( ColorToPercent_Impl( aCurrentColor.GetGreen() ) ); - m_pBcustom->SetValue( ColorToPercent_Impl( aCurrentColor.GetBlue() ) ); - m_pHexcustom->SetColor( aCurrentColor ); + m_xRcustom->set_value( ColorToPercent_Impl( aCurrentColor.GetRed() ) ); + m_xGcustom->set_value( ColorToPercent_Impl( aCurrentColor.GetGreen() ) ); + m_xBcustom->set_value( ColorToPercent_Impl( aCurrentColor.GetBlue() ) ); + m_xHexcustom->SetColor( aCurrentColor ); if( bUpdatePreset ) { - m_pRpreset->SetValue( ColorToPercent_Impl( aPreviousColor.GetRed() ) ); - m_pGpreset->SetValue( ColorToPercent_Impl( aPreviousColor.GetGreen() ) ); - m_pBpreset->SetValue( ColorToPercent_Impl( aPreviousColor.GetBlue() ) ); - m_pHexpreset->SetColor( aPreviousColor ); + m_xRpreset->set_text(OUString::number(ColorToPercent_Impl(aPreviousColor.GetRed()))); + m_xGpreset->set_text(OUString::number(ColorToPercent_Impl(aPreviousColor.GetGreen()))); + m_xBpreset->set_text(OUString::number(ColorToPercent_Impl(aPreviousColor.GetBlue()))); + m_xHexpreset->SetColor( aPreviousColor ); } } } diff --git a/cui/uiconfig/ui/colorpage.ui b/cui/uiconfig/ui/colorpage.ui index 915092fe3c89..f563456cf7e5 100644 --- a/cui/uiconfig/ui/colorpage.ui +++ b/cui/uiconfig/ui/colorpage.ui @@ -1,8 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.16.1 --> +<!-- Generated with glade 3.22.1 --> <interface domain="cui"> <requires lib="gtk+" version="3.18"/> - <!-- interface-requires LibreOffice 1.0 --> <object class="GtkAdjustment" id="adjustment1"> <property name="upper">100</property> <property name="step_increment">1</property> @@ -13,6 +12,31 @@ <property name="step_increment">1</property> <property name="page_increment">10</property> </object> + <object class="GtkAdjustment" id="adjustment3"> + <property name="upper">100</property> + <property name="step_increment">1</property> + <property name="page_increment">10</property> + </object> + <object class="GtkAdjustment" id="adjustment4"> + <property name="upper">100</property> + <property name="step_increment">1</property> + <property name="page_increment">10</property> + </object> + <object class="GtkAdjustment" id="adjustment5"> + <property name="upper">100</property> + <property name="step_increment">1</property> + <property name="page_increment">10</property> + </object> + <object class="GtkAdjustment" id="adjustment6"> + <property name="upper">255</property> + <property name="step_increment">1</property> + <property name="page_increment">10</property> + </object> + <object class="GtkAdjustment" id="adjustment7"> + <property name="upper">255</property> + <property name="step_increment">1</property> + <property name="page_increment">10</property> + </object> <object class="GtkImage" id="image3"> <property name="visible">True</property> <property name="can_focus">False</property> @@ -55,11 +79,11 @@ <property name="visible">True</property> <property name="can_focus">False</property> <property name="valign">center</property> - <property name="xalign">0</property> - <property name="yalign">0</property> <property name="label" translatable="yes" context="colorpage|label21">Palette:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">paletteselector</property> + <property name="xalign">0</property> + <property name="yalign">0</property> </object> <packing> <property name="expand">False</property> @@ -68,7 +92,7 @@ </packing> </child> <child> - <object class="GtkComboBox" id="paletteselector"> + <object class="GtkComboBoxText" id="paletteselector"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -82,8 +106,6 @@ <packing> <property name="left_attach">0</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -97,10 +119,10 @@ <object class="GtkLabel" id="label20"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="colorpage|label20">Recent Colors</property> <property name="use_underline">True</property> <property name="mnemonic_widget">recentcolorset</property> + <property name="xalign">0</property> </object> <packing> <property name="expand">False</property> @@ -109,7 +131,7 @@ </packing> </child> <child> - <object class="svxcorelo-SvxColorValueSet" id="recentcolorset"> + <object class="GtkDrawingArea" id="recentcolorset"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="hexpand">True</property> @@ -125,8 +147,6 @@ <packing> <property name="left_attach">0</property> <property name="top_attach">2</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -147,8 +167,6 @@ <packing> <property name="left_attach">0</property> <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -164,8 +182,6 @@ <packing> <property name="left_attach">0</property> <property name="top_attach">2</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -175,14 +191,12 @@ <property name="receives_default">False</property> <property name="use_underline">True</property> <property name="xalign">0</property> - <property name="active">True</property> <property name="draw_indicator">True</property> + <property name="group">RGB</property> </object> <packing> <property name="left_attach">1</property> <property name="top_attach">2</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -195,8 +209,6 @@ <packing> <property name="left_attach">1</property> <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -204,22 +216,19 @@ <property name="visible">True</property> <property name="can_focus">False</property> <property name="margin_bottom">3</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="colorpage|label22">Custom Palette</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> <property name="top_attach">0</property> <property name="width">2</property> - <property name="height">1</property> </packing> </child> </object> <packing> <property name="left_attach">0</property> <property name="top_attach">3</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -229,11 +238,25 @@ <property name="valign">start</property> <property name="orientation">vertical</property> <child> - <object class="svxcorelo-SvxColorValueSet" id="colorset"> + <object class="GtkScrolledWindow" id="colorsetwin"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="hexpand">True</property> - <property name="vexpand">True</property> + <property name="hscrollbar_policy">never</property> + <property name="shadow_type">in</property> + <child> + <object class="GtkViewport"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <child> + <object class="GtkDrawingArea" id="colorset"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + </object> + </child> + </object> + </child> </object> <packing> <property name="expand">False</property> @@ -245,8 +268,6 @@ <packing> <property name="left_attach">0</property> <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> </object> @@ -295,7 +316,7 @@ <property name="can_focus">False</property> <property name="orientation">vertical</property> <child> - <object class="svxlo-SvxXRectPreview" id="oldpreview"> + <object class="GtkDrawingArea" id="oldpreview"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="hexpand">True</property> @@ -334,13 +355,11 @@ <property name="can_focus">False</property> <property name="label" translatable="yes" context="colorpage|label7">B</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">B_custom</property> + <property name="mnemonic_widget">B_preset</property> </object> <packing> <property name="left_attach">0</property> <property name="top_attach">2</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -349,13 +368,11 @@ <property name="can_focus">False</property> <property name="label" translatable="yes" context="colorpage|label8">G</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">G_custom</property> + <property name="mnemonic_widget">G_preset</property> </object> <packing> <property name="left_attach">0</property> <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -364,13 +381,11 @@ <property name="can_focus">False</property> <property name="label" translatable="yes" context="colorpage|label9">R</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">R_custom</property> + <property name="mnemonic_widget">R_preset</property> </object> <packing> <property name="left_attach">0</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -378,64 +393,60 @@ <property name="visible">True</property> <property name="can_focus">False</property> <property name="label" translatable="yes" context="colorpage|label18">Hex</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">hex_preset</property> </object> <packing> <property name="left_attach">0</property> <property name="top_attach">3</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> - <object class="svxcorelo-HexColorControl" id="hex_preset"> + <object class="GtkEntry" id="hex_preset"> <property name="width_request">6</property> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="editable">False</property> </object> <packing> <property name="left_attach">1</property> <property name="top_attach">3</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> - <object class="GtkSpinButton" id="R_preset-nospin"> + <object class="GtkEntry" id="R_preset"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="adjustment">adjustment2</property> + <property name="editable">False</property> + <property name="width_chars">3</property> </object> <packing> <property name="left_attach">1</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> - <object class="GtkSpinButton" id="G_preset-nospin"> + <object class="GtkEntry" id="G_preset"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="adjustment">adjustment2</property> + <property name="editable">False</property> + <property name="width_chars">3</property> </object> <packing> <property name="left_attach">1</property> <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> - <object class="GtkSpinButton" id="B_preset-nospin"> + <object class="GtkEntry" id="B_preset"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="adjustment">adjustment2</property> + <property name="editable">False</property> + <property name="width_chars">3</property> </object> <packing> <property name="left_attach">1</property> <property name="top_attach">2</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> </object> @@ -459,13 +470,11 @@ <property name="can_focus">False</property> <property name="label" translatable="yes" context="colorpage|label10">_C</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">C_custom:0%</property> + <property name="mnemonic_widget">C_preset</property> </object> <packing> <property name="left_attach">0</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -474,13 +483,11 @@ <property name="can_focus">False</property> <property name="label" translatable="yes" context="colorpage|label16">_K</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">K_custom:0%</property> + <property name="mnemonic_widget">K_preset</property> </object> <packing> <property name="left_attach">0</property> <property name="top_attach">3</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -489,64 +496,59 @@ <property name="can_focus">False</property> <property name="label" translatable="yes" context="colorpage|label17">_Y</property> <property name="use_underline">True</property> + <property name="mnemonic_widget">Y_preset</property> </object> <packing> <property name="left_attach">0</property> <property name="top_attach">2</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> - <object class="GtkSpinButton" id="C_preset-nospin:0%"> + <object class="GtkEntry" id="C_preset"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="adjustment">adjustment1</property> + <property name="editable">False</property> + <property name="width_chars">3</property> </object> <packing> <property name="left_attach">1</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> - <object class="GtkSpinButton" id="M_preset-nospin:0%"> + <object class="GtkEntry" id="M_preset"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="adjustment">adjustment1</property> + <property name="editable">False</property> + <property name="width_chars">3</property> </object> <packing> <property name="left_attach">1</property> <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> - <object class="GtkSpinButton" id="Y_preset-nospin:0%"> + <object class="GtkEntry" id="Y_preset"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="adjustment">adjustment1</property> + <property name="editable">False</property> + <property name="width_chars">3</property> </object> <packing> <property name="left_attach">1</property> <property name="top_attach">2</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> - <object class="GtkSpinButton" id="K_preset-nospin:0%"> + <object class="GtkEntry" id="K_preset"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="adjustment">adjustment1</property> + <property name="editable">False</property> + <property name="width_chars">3</property> </object> <packing> <property name="left_attach">1</property> <property name="top_attach">3</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -555,12 +557,11 @@ <property name="can_focus">False</property> <property name="label" translatable="yes" context="colorpage|label15">_M</property> <property name="use_underline">True</property> + <property name="mnemonic_widget">M_preset</property> </object> <packing> <property name="left_attach">0</property> <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> </object> @@ -617,7 +618,7 @@ <property name="can_focus">False</property> <property name="orientation">vertical</property> <child> - <object class="svxlo-SvxXRectPreview" id="newpreview"> + <object class="GtkDrawingArea" id="newpreview"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="hexpand">True</property> @@ -654,28 +655,26 @@ <object class="GtkSpinButton" id="B_custom"> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="activates_default">True</property> <property name="primary_icon_tooltip_text" translatable="yes" context="colorpage|B_custom">Blue</property> - <property name="adjustment">adjustment2</property> + <property name="adjustment">adjustment7</property> </object> <packing> <property name="left_attach">1</property> <property name="top_attach">2</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> <object class="GtkSpinButton" id="R_custom"> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="activates_default">True</property> <property name="primary_icon_tooltip_text" translatable="yes" context="colorpage|R_custom">Red</property> <property name="adjustment">adjustment2</property> </object> <packing> <property name="left_attach">1</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -684,12 +683,11 @@ <property name="can_focus">False</property> <property name="label" translatable="yes" context="colorpage|label4">_B</property> <property name="use_underline">True</property> + <property name="mnemonic_widget">B_custom</property> </object> <packing> <property name="left_attach">0</property> <property name="top_attach">2</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -698,12 +696,11 @@ <property name="can_focus">False</property> <property name="label" translatable="yes" context="colorpage|label3">_G</property> <property name="use_underline">True</property> + <property name="mnemonic_widget">G_custom</property> </object> <packing> <property name="left_attach">0</property> <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -712,26 +709,24 @@ <property name="can_focus">False</property> <property name="label" translatable="yes" context="colorpage|label2">_R</property> <property name="use_underline">True</property> + <property name="mnemonic_widget">R_custom</property> </object> <packing> <property name="left_attach">0</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> <object class="GtkSpinButton" id="G_custom"> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="activates_default">True</property> <property name="primary_icon_tooltip_text" translatable="yes" context="colorpage|G_custom">Green</property> - <property name="adjustment">adjustment2</property> + <property name="adjustment">adjustment6</property> </object> <packing> <property name="left_attach">1</property> <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -745,21 +740,18 @@ <packing> <property name="left_attach">0</property> <property name="top_attach">3</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> - <object class="svxcorelo-HexColorControl" id="hex_custom"> + <object class="GtkEntry" id="hex_custom"> <property name="width_request">6</property> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="activates_default">True</property> </object> <packing> <property name="left_attach">1</property> <property name="top_attach">3</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> </object> @@ -784,13 +776,11 @@ <property name="can_focus">False</property> <property name="label" translatable="yes" context="colorpage|label11">_C</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">C_custom:0%</property> + <property name="mnemonic_widget">C_custom</property> </object> <packing> <property name="left_attach">0</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -799,12 +789,11 @@ <property name="can_focus">False</property> <property name="label" translatable="yes" context="colorpage|label12">_M</property> <property name="use_underline">True</property> + <property name="mnemonic_widget">M_custom</property> </object> <packing> <property name="left_attach">0</property> <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -813,39 +802,35 @@ <property name="can_focus">False</property> <property name="label" translatable="yes" context="colorpage|label13">_K</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">K_custom:0%</property> + <property name="mnemonic_widget">K_custom</property> </object> <packing> <property name="left_attach">0</property> <property name="top_attach">3</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> - <object class="GtkSpinButton" id="C_custom:0%"> + <object class="GtkSpinButton" id="C_custom"> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="activates_default">True</property> <property name="adjustment">adjustment1</property> </object> <packing> <property name="left_attach">1</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> - <object class="GtkSpinButton" id="K_custom:0%"> + <object class="GtkSpinButton" id="K_custom"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="adjustment">adjustment1</property> + <property name="activates_default">True</property> + <property name="adjustment">adjustment5</property> </object> <packing> <property name="left_attach">1</property> <property name="top_attach">3</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -854,38 +839,35 @@ <property name="can_focus">False</property> <property name="label" translatable="yes" context="colorpage|label14">_Y</property> <property name="use_underline">True</property> + <property name="mnemonic_widget">Y_custom</property> </object> <packing> <property name="left_attach">0</property> <property name="top_attach">2</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> - <object class="GtkSpinButton" id="Y_custom:0%"> + <object class="GtkSpinButton" id="Y_custom"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="adjustment">adjustment1</property> + <property name="activates_default">True</property> + <property name="adjustment">adjustment4</property> </object> <packing> <property name="left_attach">1</property> <property name="top_attach">2</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> - <object class="GtkSpinButton" id="M_custom:0%"> + <object class="GtkSpinButton" id="M_custom"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="adjustment">adjustment1</property> + <property name="activates_default">True</property> + <property name="adjustment">adjustment3</property> </object> <packing> <property name="left_attach">1</property> <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> </object> @@ -937,10 +919,10 @@ <widgets> <widget name="R_custom"/> <widget name="hex_custom"/> - <widget name="C_custom:0%"/> - <widget name="C_preset-nospin:0%"/> + <widget name="C_custom"/> + <widget name="C_preset"/> <widget name="hex_preset"/> - <widget name="R_preset-nospin"/> + <widget name="R_preset"/> </widgets> </object> </interface> diff --git a/extras/source/glade/libreoffice-catalog.xml.in b/extras/source/glade/libreoffice-catalog.xml.in index 3dcf1294d3c6..8f2fa93b9b9a 100644 --- a/extras/source/glade/libreoffice-catalog.xml.in +++ b/extras/source/glade/libreoffice-catalog.xml.in @@ -36,9 +36,6 @@ <glade-widget-class title="Spelling View" name="cuilo-SentenceEditWindow" generic-name="SentenceEditWindow" parent="GtkTextView" icon-name="widget-gtk-textview"/> - <glade-widget-class title="Hex Color Control" name="svxcorelo-HexColorControl" - generic-name="Hex Color Control" parent="GtkEntry" - icon-name="widget-gtk-textentry"/> <glade-widget-class title="Thesaurus Edit" name="cuilo-ReplaceEdit" generic-name="ReplaceEdit" parent="GtkEntry" icon-name="widget-gtk-textentry"/> diff --git a/include/svtools/valueset.hxx b/include/svtools/valueset.hxx index 5530adf33da8..290c347c8f10 100644 --- a/include/svtools/valueset.hxx +++ b/include/svtools/valueset.hxx @@ -416,6 +416,7 @@ private: css::uno::Reference<css::accessibility::XAccessible> mxAccessible; SvtValueItemList mItemList; std::unique_ptr<SvtValueSetItem> mpNoneItem; + std::unique_ptr<weld::ScrolledWindow> mxScrolledWindow; tools::Rectangle maNoneItemRect; tools::Rectangle maItemListRect; long mnItemWidth; @@ -439,7 +440,6 @@ private: WinBits mnStyle; Link<SvtValueSet*,void> maDoubleClickHdl; Link<SvtValueSet*,void> maSelectHdl; - Link<SvtValueSet*,void> maHighlightHdl; bool mbFormat : 1; bool mbNoSelection : 1; @@ -471,7 +471,7 @@ private: SVT_DLLPRIVATE tools::Rectangle ImplGetItemRect( size_t nPos ) const; SVT_DLLPRIVATE void ImplFireAccessibleEvent( short nEventId, const css::uno::Any& rOldValue, const css::uno::Any& rNewValue ); SVT_DLLPRIVATE bool ImplHasAccessibleListeners(); - DECL_DLLPRIVATE_LINK( ImplScrollHdl, ScrollBar*, void ); + DECL_DLLPRIVATE_LINK(ImplScrollHdl, weld::ScrolledWindow&, void); SvtValueSet (const SvtValueSet &) = delete; SvtValueSet & operator= (const SvtValueSet &) = delete; @@ -480,7 +480,7 @@ protected: virtual css::uno::Reference<css::accessibility::XAccessible> CreateAccessible() override; public: - SvtValueSet(); + SvtValueSet(weld::ScrolledWindow* pScrolledWindow); virtual ~SvtValueSet() override; virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override; @@ -495,11 +495,10 @@ public: virtual OUString RequestHelp(tools::Rectangle& rHelpRect) override; virtual void Select(); - virtual void UserDraw( const UserDrawEvent& rUDEvt ); OUString GetText() const { return maText; } void SetText(const OUString& rText) { maText = rText; } - void SetStyle(WinBits nStyle) { mnStyle = nStyle; } + void SetStyle(WinBits nStyle); WinBits GetStyle() const { return mnStyle; } /// Insert @rImage item. @@ -510,10 +509,6 @@ public: /// Insert an @rColor item with @rStr tooltip. void InsertItem(sal_uInt16 nItemId, const Color& rColor, const OUString& rStr); - /// Insert an User Drawn item. - void InsertItem(sal_uInt16 nItemId, size_t nPos = VALUESET_APPEND); - /// Insert an User Drawn item with @rStr tooltip. - void InsertItem(sal_uInt16 nItemId, const OUString& rStr, size_t nPos); void RemoveItem(sal_uInt16 nItemId); void Clear(); @@ -586,11 +581,13 @@ public: sal_uInt16 nCalcCols = 0, sal_uInt16 nCalcLines = 0) const; Size CalcItemSizePixel(const Size& rSize) const; + int GetScrollWidth() const; void SetSelectHdl(const Link<SvtValueSet*,void>& rLink) { maSelectHdl = rLink; } + void SetDoubleClickHdl(const Link<SvtValueSet*,void>& rLink) { maDoubleClickHdl = rLink; diff --git a/include/svx/Palette.hxx b/include/svx/Palette.hxx index a2d00f2ed166..3b9835bc739e 100644 --- a/include/svx/Palette.hxx +++ b/include/svx/Palette.hxx @@ -35,6 +35,7 @@ public: virtual const OUString& GetName() = 0; virtual const OUString& GetPath() = 0; virtual void LoadColorSet( SvxColorValueSet& rColorSet ) = 0; + virtual void LoadColorSet( ColorValueSet& rColorSet ) = 0; virtual bool IsValid() = 0; }; diff --git a/include/svx/PaletteManager.hxx b/include/svx/PaletteManager.hxx index 09662558ffdf..d4b6fd1a2298 100644 --- a/include/svx/PaletteManager.hxx +++ b/include/svx/PaletteManager.hxx @@ -56,7 +56,9 @@ public: PaletteManager& operator=(const PaletteManager&) = delete; void LoadPalettes(); void ReloadColorSet(SvxColorValueSet& rColorSet); + void ReloadColorSet(ColorValueSet& rColorSet); void ReloadRecentColorSet(SvxColorValueSet& rColorSet); + void ReloadRecentColorSet(ColorValueSet& rColorSet); std::vector<OUString> GetPaletteList(); void SetPalette( sal_Int32 nPos ); sal_Int32 GetPalette(); diff --git a/include/svx/SvxColorValueSet.hxx b/include/svx/SvxColorValueSet.hxx index 32026c351814..a1098fb7bd91 100644 --- a/include/svx/SvxColorValueSet.hxx +++ b/include/svx/SvxColorValueSet.hxx @@ -45,7 +45,7 @@ public: class SVX_DLLPUBLIC ColorValueSet : public SvtValueSet { public: - ColorValueSet(); + ColorValueSet(weld::ScrolledWindow* pWindow); virtual void Resize() override; diff --git a/include/svx/hexcolorcontrol.hxx b/include/svx/hexcolorcontrol.hxx index a39bb5941626..30302374d52b 100644 --- a/include/svx/hexcolorcontrol.hxx +++ b/include/svx/hexcolorcontrol.hxx @@ -32,21 +32,6 @@ #include <svx/svxdllapi.h> #include <tools/color.hxx> -class SVX_DLLPUBLIC HexColorControl : public Edit -{ -public: - HexColorControl( vcl::Window* pParent, WinBits nStyle ); - - virtual bool PreNotify( NotifyEvent& rNEvt ) override; - virtual void Paste() override; - - void SetColor( ::Color nColor ); - ::Color GetColor(); - -private: - static bool ImplProcessKeyInput( const KeyEvent& rKEv ); -}; - namespace weld { class SVX_DLLPUBLIC HexColorControl diff --git a/include/vcl/vclenum.hxx b/include/vcl/vclenum.hxx index 0de6703f6aba..0cf180cb6bc8 100644 --- a/include/vcl/vclenum.hxx +++ b/include/vcl/vclenum.hxx @@ -250,6 +250,13 @@ enum class VclSizeGroupMode Both }; +enum class VclPolicyType +{ + ALWAYS, + AUTOMATIC, + NEVER +}; + #endif // INCLUDED_VCL_VCLENUM_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index b15b77d0aff8..07360e8a43e5 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -129,10 +129,13 @@ public: virtual void vadjustment_set_value(int value) = 0; virtual int vadjustment_get_upper() const = 0; virtual void vadjustment_set_upper(int upper) = 0; + virtual void set_vpolicy(VclPolicyType eVPolicy) = 0; + virtual VclPolicyType get_vpolicy() const = 0; void connect_vadjustment_changed(const Link<ScrolledWindow&, void>& rLink) { m_aVChangeHdl = rLink; } + virtual int get_vscroll_width() const = 0; }; class VCL_DLLPUBLIC Frame : virtual public Container diff --git a/sc/source/ui/miscdlgs/tabbgcolordlg.cxx b/sc/source/ui/miscdlgs/tabbgcolordlg.cxx index b413da07bf16..0b90ef899ea0 100644 --- a/sc/source/ui/miscdlgs/tabbgcolordlg.cxx +++ b/sc/source/ui/miscdlgs/tabbgcolordlg.cxx @@ -114,7 +114,8 @@ IMPL_LINK_NOARG(ScTabBgColorDlg, TabBgColorOKHdl_Impl, weld::Button&, void) } ScTabBgColorDlg::ScTabBgColorValueSet::ScTabBgColorValueSet() - : m_pTabBgColorDlg(nullptr) + : ColorValueSet(nullptr) + , m_pTabBgColorDlg(nullptr) { } diff --git a/svtools/source/control/valueset.cxx b/svtools/source/control/valueset.cxx index 7ecb3b4159fe..23f8c82eb9c7 100644 --- a/svtools/source/control/valueset.cxx +++ b/svtools/source/control/valueset.cxx @@ -2275,8 +2275,9 @@ void ValueSet::SetEdgeBlending(bool bNew) } } -SvtValueSet::SvtValueSet() +SvtValueSet::SvtValueSet(weld::ScrolledWindow* pScrolledWindow) : maVirDev( VclPtr<VirtualDevice>::Create()) + , mxScrolledWindow(pScrolledWindow) , maColor(COL_TRANSPARENT) , mnStyle(0) , mbFormat(true) @@ -2308,6 +2309,12 @@ SvtValueSet::SvtValueSet() mbFullMode = true; mbEdgeBlending = false; mbHasVisibleItems = false; + + if (mxScrolledWindow) + { + mxScrolledWindow->set_user_managed_scrolling(); + mxScrolledWindow->connect_vadjustment_changed(LINK(this, SvtValueSet, ImplScrollHdl)); + } } void SvtValueSet::SetDrawingArea(weld::DrawingArea* pDrawingArea) @@ -2360,10 +2367,6 @@ void SvtValueSet::Select() maSelectHdl.Call( this ); } -void SvtValueSet::UserDraw( const UserDrawEvent& ) -{ -} - size_t SvtValueSet::ImplGetItem( const Point& rPos ) const { if (!mbHasVisibleItems) @@ -2442,6 +2445,17 @@ bool SvtValueSet::ImplHasAccessibleListeners() return( pAcc && pAcc->HasAccessibleListeners() ); } +IMPL_LINK(SvtValueSet, ImplScrollHdl, weld::ScrolledWindow&, rScrollWin, void) +{ + auto nNewFirstLine = rScrollWin.vadjustment_get_value(); + if ( nNewFirstLine != mnFirstLine ) + { + mnFirstLine = nNewFirstLine; + mbFormat = true; + Invalidate(); + } +} + void SvtValueSet::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) { if (GetStyle() & WB_FLATVALUESET) @@ -2663,6 +2677,50 @@ void SvtValueSet::MouseButtonDown( const MouseEvent& rMouseEvent ) CustomWidgetController::MouseButtonDown( rMouseEvent ); } +void SvtValueSet::RemoveItem( sal_uInt16 nItemId ) +{ + size_t nPos = GetItemPos( nItemId ); + + if ( nPos == VALUESET_ITEM_NOTFOUND ) + return; + + if ( nPos < mItemList.size() ) { + SvtValueItemList::iterator it = mItemList.begin(); + ::std::advance( it, nPos ); + delete *it; + mItemList.erase( it ); + } + + // reset variables + if (mnSelItemId == nItemId) + { + mnCurCol = 0; + mnSelItemId = 0; + mbNoSelection = true; + } + + queue_resize(); + + mbFormat = true; + if ( IsReallyVisible() && IsUpdateMode() ) + Invalidate(); +} + +void SvtValueSet::Clear() +{ + ImplDeleteItems(); + + // reset variables + mnFirstLine = 0; + mnCurCol = 0; + mnSelItemId = 0; + mbNoSelection = true; + + mbFormat = true; + if (IsReallyVisible() && IsUpdateMode()) + Invalidate(); +} + size_t SvtValueSet::GetItemCount() const { return mItemList.size(); @@ -2863,7 +2921,6 @@ void SvtValueSet::SelectItem( sal_uInt16 nItemId ) Any aNewAny; ImplFireAccessibleEvent(AccessibleEventId::SELECTION_CHANGED, aOldAny, aNewAny); } - maHighlightHdl.Call(this); } void SvtValueSet::SetNoSelection() @@ -2874,6 +2931,16 @@ void SvtValueSet::SetNoSelection() Invalidate(); } +void SvtValueSet::SetStyle(WinBits nStyle) +{ + if (nStyle != mnStyle) + { + mnStyle = nStyle; + mbFormat = false; + Invalidate(); + } +} + void SvtValueSet::Format(vcl::RenderContext const & rRenderContext) { Size aWinSize(GetOutputSizePixel()); @@ -2884,6 +2951,13 @@ void SvtValueSet::Format(vcl::RenderContext const & rRenderContext) long nNoneHeight; long nNoneSpace; + if (mxScrolledWindow && !(nStyle & WB_VSCROLL) && mxScrolledWindow->get_vpolicy() != VclPolicyType::NEVER) + { + mxScrolledWindow->set_vpolicy(VclPolicyType::NEVER); + Size aPrefSize(GetDrawingArea()->get_preferred_size()); + GetDrawingArea()->set_size_request(aPrefSize.Width() + GetScrollWidth(), aPrefSize.Height()); + } + // calculate item offset if (nStyle & WB_ITEMBORDER) { @@ -3028,6 +3102,13 @@ void SvtValueSet::Format(vcl::RenderContext const & rRenderContext) { mItemList[i]->mbVisible = false; } + + if (mxScrolledWindow && mxScrolledWindow->get_vpolicy() != VclPolicyType::NEVER) + { + mxScrolledWindow->set_vpolicy(VclPolicyType::NEVER); + Size aPrefSize(GetDrawingArea()->get_preferred_size()); + GetDrawingArea()->set_size_request(aPrefSize.Width() + GetScrollWidth(), aPrefSize.Height()); + } } else { @@ -3164,6 +3245,19 @@ void SvtValueSet::Format(vcl::RenderContext const & rRenderContext) pItem->mbVisible = false; } } + + // arrange ScrollBar, set values and show it + if (mxScrolledWindow && (nStyle & WB_VSCROLL) && mxScrolledWindow->get_vpolicy() != VclPolicyType::ALWAYS) + { + long nPageSize = mnVisLines; + if (nPageSize < 1) + nPageSize = 1; + mxScrolledWindow->vadjustment_configure(mnFirstLine, 0, mnLines, 1, + mnVisLines, nPageSize); + mxScrolledWindow->set_vpolicy(VclPolicyType::ALWAYS); + Size aPrefSize(GetDrawingArea()->get_preferred_size()); + GetDrawingArea()->set_size_request(aPrefSize.Width() - GetScrollWidth(), aPrefSize.Height()); + } } // waiting for the next since the formatting is finished @@ -3376,8 +3470,6 @@ void SvtValueSet::ImplFormatItem(vcl::RenderContext const & rRenderContext, SvtV if (pItem->meType == VALUESETITEM_USERDRAW) { - UserDrawEvent aUDEvt(nullptr, maVirDev.get(), aRect, pItem->mnId); - UserDraw(aUDEvt); } else { @@ -3597,6 +3689,9 @@ Size SvtValueSet::CalcWindowSizePixel( const Size& rItemSize, sal_uInt16 nDesire aSize.AdjustHeight(nTxtHeight + n + mnSpacing ); } + // sum possible ScrollBar width + aSize.AdjustWidth(GetScrollWidth()); + return aSize; } @@ -3632,6 +3727,13 @@ void SvtValueSet::ImplInsertItem( SvtValueSetItem *const pItem, const size_t nPo Invalidate(); } +int SvtValueSet::GetScrollWidth() const +{ + if (mxScrolledWindow) + return mxScrolledWindow->get_vscroll_width(); + return 0; +} + void SvtValueSet::SetEdgeBlending(bool bNew) { if(mbEdgeBlending != bNew) diff --git a/svx/inc/palettes.hxx b/svx/inc/palettes.hxx index 8aa05b8fecfd..da0cdd24e9b2 100644 --- a/svx/inc/palettes.hxx +++ b/svx/inc/palettes.hxx @@ -42,6 +42,7 @@ public: virtual const OUString& GetName() override; virtual const OUString& GetPath() override; virtual void LoadColorSet( SvxColorValueSet& rColorSet ) override; + virtual void LoadColorSet( ColorValueSet& rColorSet ) override; virtual bool IsValid() override; }; @@ -67,6 +68,7 @@ public: virtual const OUString& GetName() override; virtual const OUString& GetPath() override; virtual void LoadColorSet( SvxColorValueSet& rColorSet ) override; + virtual void LoadColorSet( ColorValueSet& rColorSet ) override; virtual bool IsValid() override; }; @@ -86,6 +88,7 @@ public: virtual const OUString& GetName() override; virtual const OUString& GetPath() override; virtual void LoadColorSet( SvxColorValueSet& rColorSet ) override; + virtual void LoadColorSet( ColorValueSet& rColorSet ) override; virtual bool IsValid() override; }; diff --git a/svx/source/dialog/hexcolorcontrol.cxx b/svx/source/dialog/hexcolorcontrol.cxx index 51927caa5202..afb910712b9b 100644 --- a/svx/source/dialog/hexcolorcontrol.cxx +++ b/svx/source/dialog/hexcolorcontrol.cxx @@ -19,113 +19,6 @@ #include <svx/hexcolorcontrol.hxx> -HexColorControl::HexColorControl( vcl::Window* pParent, WinBits nStyle ) - : Edit(pParent, nStyle) -{ - SetMaxTextLen( 6 ); -} - -VCL_BUILDER_FACTORY_ARGS(HexColorControl, WB_BORDER) - -void HexColorControl::SetColor(Color nColor) -{ - OUStringBuffer aBuffer; - sax::Converter::convertColor(aBuffer, nColor); - SetText(aBuffer.makeStringAndClear().copy(1)); -} - -Color HexColorControl::GetColor() -{ - sal_Int32 nColor = -1; - - OUString aStr("#"); - aStr += GetText(); - sal_Int32 nLen = aStr.getLength(); - - if (nLen < 7) - { - static const sal_Char* const pNullStr = "000000"; - aStr += OUString::createFromAscii( &pNullStr[nLen-1] ); - } - - sax::Converter::convertColor(nColor, aStr); - - if (nColor == -1) - SetControlBackground(COL_RED); - else - SetControlBackground(); - - return Color(nColor); -} - -bool HexColorControl::PreNotify( NotifyEvent& rNEvt ) -{ - if ( (rNEvt.GetType() == MouseNotifyEvent::KEYINPUT) && !rNEvt.GetKeyEvent()->GetKeyCode().IsMod2() ) - { - if ( ImplProcessKeyInput( *rNEvt.GetKeyEvent() ) ) - return true; - } - - return Edit::PreNotify( rNEvt ); -} - -void HexColorControl::Paste() -{ - css::uno::Reference<css::datatransfer::clipboard::XClipboard> aClipboard(GetClipboard()); - if (aClipboard.is()) - { - css::uno::Reference<css::datatransfer::XTransferable> xDataObj; - - try - { - SolarMutexReleaser aReleaser; - xDataObj = aClipboard->getContents(); - } - catch (const css::uno::Exception&) - { - } - - if (xDataObj.is()) - { - css::datatransfer::DataFlavor aFlavor; - SotExchange::GetFormatDataFlavor(SotClipboardFormatId::STRING, aFlavor); - try - { - css::uno::Any aData = xDataObj->getTransferData(aFlavor); - OUString aText; - aData >>= aText; - - if( !aText.isEmpty() && aText.startsWith( "#" ) ) - aText = aText.copy(1); - - if( aText.getLength() > 6 ) - aText = aText.copy( 0, 6 ); - - SetText(aText); - } - catch(const css::uno::Exception&) - {} - } - } -} - -bool HexColorControl::ImplProcessKeyInput( const KeyEvent& rKEv ) -{ - const vcl::KeyCode& rKeyCode = rKEv.GetKeyCode(); - - if( rKeyCode.GetGroup() == KEYGROUP_ALPHA && !rKeyCode.IsMod1() && !rKeyCode.IsMod2() ) - { - if( (rKeyCode.GetCode() < KEY_A) || (rKeyCode.GetCode() > KEY_F) ) - return true; - } - else if( rKeyCode.GetGroup() == KEYGROUP_NUM ) - { - if( rKeyCode.IsShift() ) - return true; - } - return false; -} - namespace weld { HexColorControl::HexColorControl(weld::Entry* pEntry) diff --git a/svx/source/tbxctrls/Palette.cxx b/svx/source/tbxctrls/Palette.cxx index a5c12db487e1..6f90ec00e4f3 100644 --- a/svx/source/tbxctrls/Palette.cxx +++ b/svx/source/tbxctrls/Palette.cxx @@ -49,6 +49,17 @@ void PaletteASE::LoadColorSet( SvxColorValueSet& rColorSet ) } } +void PaletteASE::LoadColorSet( ColorValueSet& rColorSet ) +{ + rColorSet.Clear(); + int nIx = 1; + for (ColorList::const_iterator it = maColors.begin(); it != maColors.end(); ++it) + { + rColorSet.InsertItem(nIx, it->first, it->second); + ++nIx; + } +} + const OUString& PaletteASE::GetName() { return maASEPaletteName; @@ -210,6 +221,19 @@ void PaletteGPL::LoadColorSet( SvxColorValueSet& rColorSet ) } } +void PaletteGPL::LoadColorSet( ColorValueSet& rColorSet ) +{ + LoadPalette(); + + rColorSet.Clear(); + int nIx = 1; + for (ColorList::const_iterator it = maColors.begin(); it != maColors.end(); ++it) + { + rColorSet.InsertItem(nIx, it->first, it->second); + ++nIx; + } +} + bool PaletteGPL::IsValid() { return mbValidPalette; @@ -356,6 +380,19 @@ void PaletteSOC::LoadColorSet( SvxColorValueSet& rColorSet ) rColorSet.addEntriesForXColorList( *mpColorList ); } +void PaletteSOC::LoadColorSet( ColorValueSet& rColorSet ) +{ + if( !mbLoadedPalette ) + { + mbLoadedPalette = true; + mpColorList = XPropertyList::AsColorList(XPropertyList::CreatePropertyListFromURL(XPropertyListType::Color, maFPath)); + (void)mpColorList->Load(); + } + rColorSet.Clear(); + if( mpColorList.is() ) + rColorSet.addEntriesForXColorList( *mpColorList ); +} + bool PaletteSOC::IsValid() { return true; diff --git a/svx/source/tbxctrls/PaletteManager.cxx b/svx/source/tbxctrls/PaletteManager.cxx index ddd952cf6cb2..48bd555893ee 100644 --- a/svx/source/tbxctrls/PaletteManager.cxx +++ b/svx/source/tbxctrls/PaletteManager.cxx @@ -155,6 +155,40 @@ void PaletteManager::ReloadColorSet(SvxColorValueSet &rColorSet) } } +void PaletteManager::ReloadColorSet(ColorValueSet &rColorSet) +{ + if( mnCurrentPalette == 0) + { + rColorSet.Clear(); + css::uno::Sequence< sal_Int32 > CustomColorList( officecfg::Office::Common::UserColors::CustomColor::get() ); + css::uno::Sequence< OUString > CustomColorNameList( officecfg::Office::Common::UserColors::CustomColorName::get() ); + int nIx = 1; + for (int i = 0; i < CustomColorList.getLength(); ++i) + { + Color aColor(CustomColorList[i]); + rColorSet.InsertItem(nIx, aColor, CustomColorNameList[i]); + ++nIx; + } + } + else if( mnCurrentPalette == mnNumOfPalettes - 1 ) + { + // Add doc colors to palette + SfxObjectShell* pDocSh = SfxObjectShell::Current(); + if (pDocSh) + { + std::set<Color> aColors = pDocSh->GetDocColors(); + mnColorCount = aColors.size(); + rColorSet.Clear(); + rColorSet.addEntriesForColorSet(aColors, SvxResId( RID_SVXSTR_DOC_COLOR_PREFIX ) + " " ); + } + } + else + { + m_Palettes[mnCurrentPalette - 1]->LoadColorSet( rColorSet ); + mnColorCount = rColorSet.GetItemCount(); + } +} + void PaletteManager::ReloadRecentColorSet(SvxColorValueSet& rColorSet) { maRecentColors.clear(); @@ -173,6 +207,24 @@ void PaletteManager::ReloadRecentColorSet(SvxColorValueSet& rColorSet) } } +void PaletteManager::ReloadRecentColorSet(ColorValueSet& rColorSet) +{ + maRecentColors.clear(); + rColorSet.Clear(); + css::uno::Sequence< sal_Int32 > Colorlist(officecfg::Office::Common::UserColors::RecentColor::get()); + css::uno::Sequence< OUString > ColorNamelist(officecfg::Office::Common::UserColors::RecentColorName::get()); + int nIx = 1; + const bool bHasColorNames = Colorlist.getLength() == ColorNamelist.getLength(); + for (int i = 0; i < Colorlist.getLength(); ++i) + { + Color aColor(Colorlist[i]); + OUString sColorName = bHasColorNames ? ColorNamelist[i] : ("#" + aColor.AsRGBHexString().toAsciiUpperCase()); + maRecentColors.emplace_back(aColor, sColorName); + rColorSet.InsertItem(nIx, aColor, sColorName); + ++nIx; + } +} + std::vector<OUString> PaletteManager::GetPaletteList() { std::vector<OUString> aPaletteNames; diff --git a/svx/source/tbxctrls/SvxColorValueSet.cxx b/svx/source/tbxctrls/SvxColorValueSet.cxx index 62e2dc8a596e..d7622100677a 100644 --- a/svx/source/tbxctrls/SvxColorValueSet.cxx +++ b/svx/source/tbxctrls/SvxColorValueSet.cxx @@ -29,7 +29,8 @@ SvxColorValueSet::SvxColorValueSet(vcl::Window* _pParent, WinBits nWinStyle) SetEdgeBlending(true); } -ColorValueSet::ColorValueSet() +ColorValueSet::ColorValueSet(weld::ScrolledWindow* pWindow) + : SvtValueSet(pWindow) { SetEdgeBlending(true); } @@ -95,6 +96,27 @@ void ColorValueSet::addEntriesForXColorList(const XColorList& rXColorList, sal_u } } +void ColorValueSet::addEntriesForColorSet(const std::set<Color>& rColorSet, const OUString& rNamePrefix) +{ + sal_uInt32 nStartIndex = 1; + if(rNamePrefix.getLength() != 0) + { + for(std::set<Color>::const_iterator it = rColorSet.begin(); + it != rColorSet.end(); ++it, nStartIndex++) + { + InsertItem(nStartIndex, *it, rNamePrefix + OUString::number(nStartIndex)); + } + } + else + { + for(std::set<Color>::const_iterator it = rColorSet.begin(); + it != rColorSet.end(); ++it, nStartIndex++) + { + InsertItem(nStartIndex, *it, ""); + } + } +} + void SvxColorValueSet::addEntriesForColorSet(const std::set<Color>& rColorSet, const OUString& rNamePrefix) { sal_uInt32 nStartIndex = 1; @@ -116,6 +138,34 @@ void SvxColorValueSet::addEntriesForColorSet(const std::set<Color>& rColorSet, c } } +Size ColorValueSet::layoutAllVisible(sal_uInt32 nEntryCount) +{ + if(!nEntryCount) + { + nEntryCount++; + } + + const sal_uInt32 nRowCount(ceil(double(nEntryCount)/SvxColorValueSet::getColumnCount())); + const Size aItemSize(SvxColorValueSet::getEntryEdgeLength() - 2, SvxColorValueSet::getEntryEdgeLength() - 2); + const WinBits aWinBits(GetStyle() & ~WB_VSCROLL); + + if (nRowCount > SvxColorValueSet::getMaxRowCount()) + { + SetStyle(aWinBits|WB_VSCROLL); + } + else + { + SetStyle(aWinBits); + } + + SetColCount(SvxColorValueSet::getColumnCount()); + SetLineCount(std::min(nRowCount, SvxColorValueSet::getMaxRowCount())); + SetItemWidth(aItemSize.Width()); + SetItemHeight(aItemSize.Height()); + + return CalcWindowSizePixel(aItemSize); +} + Size SvxColorValueSet::layoutAllVisible(sal_uInt32 nEntryCount) { if(!nEntryCount) diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index a703f1bc00f6..f17df42bd968 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -810,6 +810,32 @@ public: rVertScrollBar.SetRangeMax(upper); } + virtual void set_vpolicy(VclPolicyType eVPolicy) override + { + WinBits nWinBits = m_xScrolledWindow->GetStyle() & ~(WB_AUTOVSCROLL|WB_VSCROLL); + if (eVPolicy == VclPolicyType::ALWAYS) + nWinBits |= WB_VSCROLL; + else if (eVPolicy == VclPolicyType::AUTOMATIC) + nWinBits |= WB_AUTOVSCROLL; + m_xScrolledWindow->SetStyle(nWinBits); + m_xScrolledWindow->queue_resize(); + } + + virtual VclPolicyType get_vpolicy() const override + { + WinBits nWinBits = m_xScrolledWindow->GetStyle(); + if (nWinBits & WB_AUTOVSCROLL) + return VclPolicyType::AUTOMATIC; + else if (nWinBits & WB_VSCROLL) + return VclPolicyType::ALWAYS; + return VclPolicyType::NEVER; + } + + virtual int get_vscroll_width() const override + { + return m_xScrolledWindow->getVertScrollBar().GetSizePixel().Width(); + } + virtual void set_user_managed_scrolling() override { m_bUserManagedScrolling = true; diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx index 9d9e05325ddf..44b8777dba78 100644 --- a/vcl/source/window/layout.cxx +++ b/vcl/source/window/layout.cxx @@ -1926,6 +1926,8 @@ void VclScrolledWindow::setAllocation(const Size &rAllocation) { m_pVScroll->Show(nAvailHeight < aChildReq.Height()); } + else if (m_pVScroll->IsVisible() != bool(GetStyle() & WB_VSCROLL)) + m_pVScroll->Show((GetStyle() & WB_VSCROLL) != 0); if (m_pVScroll->IsVisible()) nAvailWidth -= getLayoutRequisition(*m_pVScroll).Width(); @@ -1942,6 +1944,8 @@ void VclScrolledWindow::setAllocation(const Size &rAllocation) if (GetStyle() & WB_AUTOVSCROLL) m_pVScroll->Show(nAvailHeight < aChildReq.Height()); } + else if (m_pHScroll->IsVisible() != bool(GetStyle() & WB_HSCROLL)) + m_pHScroll->Show((GetStyle() & WB_HSCROLL) != 0); Size aInnerSize(rAllocation); aInnerSize.AdjustWidth(-2); diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx index 47ef69b4077a..05035bb756ad 100644 --- a/vcl/unx/gtk3/gtk3gtkinst.cxx +++ b/vcl/unx/gtk3/gtk3gtkinst.cxx @@ -2339,6 +2339,91 @@ GType crippled_viewport_get_type() return type; } +VclPolicyType GtkToVcl(GtkPolicyType eType) +{ + VclPolicyType eRet(VclPolicyType::NEVER); + switch (eType) + { + case GTK_POLICY_ALWAYS: + eRet = VclPolicyType::ALWAYS; + break; + case GTK_POLICY_AUTOMATIC: + eRet = VclPolicyType::AUTOMATIC; + break; + case GTK_POLICY_EXTERNAL: + case GTK_POLICY_NEVER: + eRet = VclPolicyType::NEVER; + break; + } + return eRet; +} + +GtkPolicyType VclToGtk(VclPolicyType eType) +{ + GtkPolicyType eRet(GTK_POLICY_ALWAYS); + switch (eType) + { + case VclPolicyType::ALWAYS: + eRet = GTK_POLICY_ALWAYS; + break; + case VclPolicyType::AUTOMATIC: + eRet = GTK_POLICY_AUTOMATIC; + break; + case VclPolicyType::NEVER: + eRet = GTK_POLICY_NEVER; + break; + } + return eRet; +} + +GtkMessageType VclToGtk(VclMessageType eType) +{ + GtkMessageType eRet(GTK_MESSAGE_INFO); + switch (eType) + { + case VclMessageType::Info: + eRet = GTK_MESSAGE_INFO; + break; + case VclMessageType::Warning: + eRet = GTK_MESSAGE_WARNING; + break; + case VclMessageType::Question: + eRet = GTK_MESSAGE_QUESTION; + break; + case VclMessageType::Error: + eRet = GTK_MESSAGE_ERROR; + break; + } + return eRet; +} + +GtkButtonsType VclToGtk(VclButtonsType eType) +{ + GtkButtonsType eRet(GTK_BUTTONS_NONE); + switch (eType) + { + case VclButtonsType::NONE: + eRet = GTK_BUTTONS_NONE; + break; + case VclButtonsType::Ok: + eRet = GTK_BUTTONS_OK; + break; + case VclButtonsType::Close: + eRet = GTK_BUTTONS_CLOSE; + break; + case VclButtonsType::Cancel: + eRet = GTK_BUTTONS_CANCEL; + break; + case VclButtonsType::YesNo: + eRet = GTK_BUTTONS_YES_NO; + break; + case VclButtonsType::OkCancel: + eRet = GTK_BUTTONS_OK_CANCEL; + break; + } + return eRet; +} + class GtkInstanceScrolledWindow : public GtkInstanceContainer, public virtual weld::ScrolledWindow { private: @@ -2419,6 +2504,27 @@ public: enable_notify_events(); } + virtual void set_vpolicy(VclPolicyType eVPolicy) override + { + GtkPolicyType eGtkHPolicy; + gtk_scrolled_window_get_policy(m_pScrolledWindow, &eGtkHPolicy, nullptr); + gtk_scrolled_window_set_policy(m_pScrolledWindow, eGtkHPolicy, VclToGtk(eVPolicy)); + } + + virtual VclPolicyType get_vpolicy() const override + { + GtkPolicyType eGtkVPolicy; + gtk_scrolled_window_get_policy(m_pScrolledWindow, nullptr, &eGtkVPolicy); + return GtkToVcl(eGtkVPolicy); + } + + virtual int get_vscroll_width() const override + { + if (gtk_scrolled_window_get_overlay_scrolling(m_pScrolledWindow)) + return 0; + return gtk_widget_get_allocated_width(GTK_WIDGET(m_pScrolledWindow)); + } + virtual void disable_notify_events() override { g_signal_handler_block(m_pVAdjustment, m_nVAdjustChangedSignalId); @@ -4962,54 +5068,6 @@ weld::Builder* GtkInstance::CreateBuilder(weld::Widget* pParent, const OUString& return new GtkInstanceBuilder(pBuilderParent, rUIRoot, rUIFile); } -GtkMessageType VclToGtk(VclMessageType eType) -{ - GtkMessageType eRet(GTK_MESSAGE_INFO); - switch (eType) - { - case VclMessageType::Info: - eRet = GTK_MESSAGE_INFO; - break; - case VclMessageType::Warning: - eRet = GTK_MESSAGE_WARNING; - break; - case VclMessageType::Question: - eRet = GTK_MESSAGE_QUESTION; - break; - case VclMessageType::Error: - eRet = GTK_MESSAGE_ERROR; - break; - } - return eRet; -} - -GtkButtonsType VclToGtk(VclButtonsType eType) -{ - GtkButtonsType eRet(GTK_BUTTONS_NONE); - switch (eType) - { - case VclButtonsType::NONE: - eRet = GTK_BUTTONS_NONE; - break; - case VclButtonsType::Ok: - eRet = GTK_BUTTONS_OK; - break; - case VclButtonsType::Close: - eRet = GTK_BUTTONS_CLOSE; - break; - case VclButtonsType::Cancel: - eRet = GTK_BUTTONS_CANCEL; - break; - case VclButtonsType::YesNo: - eRet = GTK_BUTTONS_YES_NO; - break; - case VclButtonsType::OkCancel: - eRet = GTK_BUTTONS_OK_CANCEL; - break; - } - return eRet; -} - weld::MessageDialog* GtkInstance::CreateMessageDialog(weld::Widget* pParent, VclMessageType eMessageType, VclButtonsType eButtonsType, const OUString &rPrimaryMessage) { GtkInstanceWidget* pParentInstance = dynamic_cast<GtkInstanceWidget*>(pParent); |