diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-06-19 15:02:49 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-09-03 18:25:52 +0200 |
commit | 79daf40ec696e0855d4a2894f048e44188cfbbb6 (patch) | |
tree | 96cb3ec48472c06961c1f4392ea6e1b560980555 | |
parent | b094921089beeecb2333075e174c8b1fa6d1b812 (diff) |
weld SvxAreaTabPage
which itself has 5 sub tab pages
Change-Id: If71e91248b5771af4845ad6dba997ac4c7841b5d
Reviewed-on: https://gerrit.libreoffice.org/56112
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
43 files changed, 1908 insertions, 1993 deletions
diff --git a/Repository.mk b/Repository.mk index 5f62c277b33d..6787c1c0add5 100644 --- a/Repository.mk +++ b/Repository.mk @@ -66,8 +66,7 @@ $(eval $(call gb_Helper_register_executables,NONE, \ svdemo \ fftester \ svptest \ - svpclient \ - pixelctl ) \ + svpclient ) \ $(if $(filter LINUX %BSD SOLARIS,$(OS)), tilebench) \ $(if $(filter LINUX MACOSX SOLARIS WNT %BSD,$(OS)),icontest \ outdevgrind) \ diff --git a/cui/source/inc/backgrnd.hxx b/cui/source/inc/backgrnd.hxx index b08e9b92d249..078e78f05297 100644 --- a/cui/source/inc/backgrnd.hxx +++ b/cui/source/inc/backgrnd.hxx @@ -144,12 +144,12 @@ private: class SvxBkgTabPage : public SvxAreaTabPage { - VclPtr<ListBox> m_pTblLBox; + std::unique_ptr<weld::ComboBoxText> m_xTblLBox; bool bHighlighting : 1; public: using SvxAreaTabPage::DeactivatePage; - SvxBkgTabPage( vcl::Window* pParent, const SfxItemSet& rInAttrs ); + SvxBkgTabPage(TabPageParent pParent, const SfxItemSet& rInAttrs); virtual ~SvxBkgTabPage() override; virtual void dispose() override; diff --git a/cui/source/inc/cuitabarea.hxx b/cui/source/inc/cuitabarea.hxx index 119c466a9971..de7fd90cc3e7 100644 --- a/cui/source/inc/cuitabarea.hxx +++ b/cui/source/inc/cuitabarea.hxx @@ -37,6 +37,7 @@ #define NO_BUTTON_SELECTED -1 +class ColorListBox; class SdrModel; class SvxBitmapCtl; class SvxColorListBox; @@ -46,37 +47,37 @@ class ButtonBox { private: sal_Int32 mnCurrentButton; - std::vector< VclPtr<PushButton> > maButtonList; - std::map< VclPtr<PushButton>, sal_Int32 > maButtonToPos; + std::vector<weld::ToggleButton*> maButtonList; + std::map<weld::ToggleButton*, sal_Int32 > maButtonToPos; void SelectButtonImpl( sal_Int32 nPos ) { if(mnCurrentButton != NO_BUTTON_SELECTED) { - maButtonList[mnCurrentButton]->SetPressed(false); + maButtonList[mnCurrentButton]->set_active(false); } mnCurrentButton = nPos; - maButtonList[mnCurrentButton]->SetPressed(true); + maButtonList[mnCurrentButton]->set_active(true); }; public: ButtonBox() { mnCurrentButton = NO_BUTTON_SELECTED; }; - void AddButton(VclPtr<PushButton> pButton) + void AddButton(weld::ToggleButton* pButton) { maButtonList.push_back(pButton); maButtonToPos.insert( std::make_pair(pButton, maButtonList.size() - 1) ); } sal_Int32 GetCurrentButtonPos() { return mnCurrentButton; } - sal_Int32 GetButtonPos( VclPtr<PushButton> pButton ) + sal_Int32 GetButtonPos(weld::ToggleButton* pButton) { - std::map< VclPtr<PushButton>, sal_Int32 >::const_iterator aBtnPos = maButtonToPos.find(pButton); + std::map<weld::ToggleButton*, sal_Int32>::const_iterator aBtnPos = maButtonToPos.find(pButton); if(aBtnPos != maButtonToPos.end()) return aBtnPos->second; else return -1; } - void SelectButton( VclPtr<PushButton> pButton) + void SelectButton(weld::ToggleButton* pButton) { sal_Int32 nPos = GetButtonPos(pButton); if(nPos != -1) @@ -224,13 +225,6 @@ class SvxAreaTabPage : public SvxTabPage static const sal_uInt16 pAreaRanges[]; private: ScopedVclPtr<SfxTabPage> m_pFillTabPage; - VclPtr<VclBox> m_pFillTab; - VclPtr<PushButton> m_pBtnNone; - VclPtr<PushButton> m_pBtnColor; - VclPtr<PushButton> m_pBtnGradient; - VclPtr<PushButton> m_pBtnHatch; - VclPtr<PushButton> m_pBtnBitmap; - VclPtr<PushButton> m_pBtnPattern; ButtonBox maBox; XColorListRef m_pColorList; @@ -254,7 +248,17 @@ private: XFillAttrSetItem m_aXFillAttr; SfxItemSet& m_rXFSet; - DECL_LINK(SelectFillTypeHdl_Impl, Button*, void); +protected: + std::unique_ptr<weld::Container> m_xFillTab; + std::unique_ptr<weld::ToggleButton> m_xBtnNone; + std::unique_ptr<weld::ToggleButton> m_xBtnColor; + std::unique_ptr<weld::ToggleButton> m_xBtnGradient; + std::unique_ptr<weld::ToggleButton> m_xBtnHatch; + std::unique_ptr<weld::ToggleButton> m_xBtnBitmap; + std::unique_ptr<weld::ToggleButton> m_xBtnPattern; + +private: + DECL_LINK(SelectFillTypeHdl_Impl, weld::ToggleButton&, void); template< typename TabPage > bool FillItemSet_Impl( SfxItemSet* ); @@ -262,10 +266,11 @@ private: void Reset_Impl( const SfxItemSet* ); template< typename TabPage > DeactivateRC DeactivatePage_Impl( SfxItemSet* pSet ); + public: using TabPage::DeactivatePage; - SvxAreaTabPage( vcl::Window* pParent, const SfxItemSet& rInAttrs ); + SvxAreaTabPage(TabPageParent pParent, const SfxItemSet& rInAttrs); virtual ~SvxAreaTabPage() override; virtual void dispose() override; @@ -356,25 +361,6 @@ class SvxGradientTabPage : public SfxTabPage using TabPage::DeactivatePage; private: - VclPtr<ListBox> m_pLbGradientType; - VclPtr<FixedText> m_pFtCenter; - VclPtr<MetricField> m_pMtrCenterX; - VclPtr<MetricField> m_pMtrCenterY; - VclPtr<FixedText> m_pFtAngle; - VclPtr<MetricField> m_pMtrAngle; - VclPtr<MetricField> m_pMtrBorder; - VclPtr<Slider> m_pSliderBorder; - VclPtr<SvxColorListBox> m_pLbColorFrom; - VclPtr<MetricField> m_pMtrColorFrom; - VclPtr<SvxColorListBox> m_pLbColorTo; - VclPtr<MetricField> m_pMtrColorTo; - VclPtr<SvxPresetListBox> m_pGradientLB; - VclPtr<NumericField> m_pMtrIncrement; - VclPtr<CheckBox> m_pCbIncrement; - VclPtr<Slider> m_pSliderIncrement; - VclPtr<SvxXRectPreview> m_pCtlPreview; - VclPtr<PushButton> m_pBtnAdd; - VclPtr<PushButton> m_pBtnModify; const SfxItemSet& m_rOutAttrs; XColorListRef m_pColorList; @@ -386,24 +372,47 @@ private: XFillAttrSetItem m_aXFillAttr; SfxItemSet& m_rXFSet; - DECL_LINK( ClickAddHdl_Impl, Button*, void ); - DECL_LINK( ClickModifyHdl_Impl, Button*, void ); - DECL_LINK( ChangeGradientHdl, ValueSet*, void ); + XRectPreview m_aCtlPreview; + std::unique_ptr<weld::ComboBoxText> m_xLbGradientType; + std::unique_ptr<weld::Label> m_xFtCenter; + std::unique_ptr<weld::MetricSpinButton> m_xMtrCenterX; + std::unique_ptr<weld::MetricSpinButton> m_xMtrCenterY; + std::unique_ptr<weld::Label> m_xFtAngle; + std::unique_ptr<weld::MetricSpinButton> m_xMtrAngle; + std::unique_ptr<weld::MetricSpinButton> m_xMtrBorder; + std::unique_ptr<weld::Scale> m_xSliderBorder; + std::unique_ptr<ColorListBox> m_xLbColorFrom; + std::unique_ptr<weld::MetricSpinButton> m_xMtrColorFrom; + std::unique_ptr<ColorListBox> m_xLbColorTo; + std::unique_ptr<weld::MetricSpinButton> m_xMtrColorTo; + std::unique_ptr<PresetListBox> m_xGradientLB; + std::unique_ptr<weld::SpinButton> m_xMtrIncrement; + std::unique_ptr<weld::CheckButton> m_xCbIncrement; + std::unique_ptr<weld::Scale> m_xSliderIncrement; + std::unique_ptr<weld::Button> m_xBtnAdd; + std::unique_ptr<weld::Button> m_xBtnModify; + std::unique_ptr<weld::CustomWeld> m_xCtlPreview; + std::unique_ptr<weld::CustomWeld> m_xGradientLBWin; + + DECL_LINK( ClickAddHdl_Impl, weld::Button&, void ); + DECL_LINK( ClickModifyHdl_Impl, weld::Button&, void ); + DECL_LINK( ChangeGradientHdl, SvtValueSet*, void ); void ChangeGradientHdl_Impl(); - 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 ); + DECL_LINK( ClickRenameHdl_Impl, PresetListBox*, void ); + DECL_LINK( ClickDeleteHdl_Impl, PresetListBox*, void ); + DECL_LINK( ModifiedEditHdl_Impl, weld::SpinButton&, void ); + DECL_LINK( ModifiedMetricHdl_Impl, weld::MetricSpinButton&, void ); + DECL_LINK( ModifiedColorListBoxHdl_Impl, ColorListBox&, void ); + DECL_LINK( ModifiedListBoxHdl_Impl, weld::ComboBoxText&, void ); + DECL_LINK( ChangeAutoStepHdl_Impl, weld::ToggleButton&, void ); + DECL_LINK( ModifiedSliderHdl_Impl, weld::Scale&, void ); void ModifiedHdl_Impl(void const *); void SetControlState_Impl( css::awt::GradientStyle eXGS ); sal_Int32 SearchGradientList(const OUString& rGradientName); public: - SvxGradientTabPage( vcl::Window* pParent, const SfxItemSet& rInAttrs ); + SvxGradientTabPage(TabPageParent pParent, const SfxItemSet& rInAttrs); virtual ~SvxGradientTabPage() override; virtual void dispose() override; @@ -431,18 +440,6 @@ class SvxHatchTabPage : public SvxTabPage using TabPage::DeactivatePage; private: - VclPtr<MetricField> m_pMtrDistance; - VclPtr<MetricField> m_pMtrAngle; - VclPtr<Slider> m_pSliderAngle; - VclPtr<ListBox> m_pLbLineType; - VclPtr<SvxColorListBox> m_pLbLineColor; - VclPtr<CheckBox> m_pCbBackgroundColor; - VclPtr<SvxColorListBox> m_pLbBackgroundColor; - VclPtr<SvxPresetListBox> m_pHatchLB; - VclPtr<SvxXRectPreview> m_pCtlPreview; - VclPtr<PushButton> m_pBtnAdd; - VclPtr<PushButton> m_pBtnModify; - const SfxItemSet& m_rOutAttrs; XColorListRef m_pColorList; @@ -456,24 +453,38 @@ private: MapUnit m_ePoolUnit; - DECL_LINK( ChangeHatchHdl, ValueSet*, void ); + XRectPreview m_aCtlPreview; + std::unique_ptr<weld::MetricSpinButton> m_xMtrDistance; + std::unique_ptr<weld::MetricSpinButton> m_xMtrAngle; + std::unique_ptr<weld::Scale> m_xSliderAngle; + std::unique_ptr<weld::ComboBoxText> m_xLbLineType; + std::unique_ptr<ColorListBox> m_xLbLineColor; + std::unique_ptr<weld::CheckButton> m_xCbBackgroundColor; + std::unique_ptr<ColorListBox> m_xLbBackgroundColor; + std::unique_ptr<PresetListBox> m_xHatchLB; + std::unique_ptr<weld::Button> m_xBtnAdd; + std::unique_ptr<weld::Button> m_xBtnModify; + std::unique_ptr<weld::CustomWeld> m_xHatchLBWin; + std::unique_ptr<weld::CustomWeld> m_xCtlPreview; + + DECL_LINK(ChangeHatchHdl, SvtValueSet*, void); 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( ModifiedSliderHdl_Impl, Slider*, void ); + DECL_LINK( ModifiedEditHdl_Impl, weld::MetricSpinButton&, void ); + DECL_LINK( ModifiedListBoxHdl_Impl, weld::ComboBoxText&, void ); + DECL_LINK( ModifiedColorListBoxHdl_Impl, ColorListBox&, void ); + DECL_LINK( ToggleHatchBackgroundColor_Impl, weld::ToggleButton&, void ); + DECL_LINK( ModifiedBackgroundHdl_Impl, ColorListBox&, void ); + DECL_LINK( ModifiedSliderHdl_Impl, weld::Scale&, void ); void ModifiedHdl_Impl(void const *); - DECL_LINK( ClickAddHdl_Impl, Button*, void ); - DECL_LINK( ClickModifyHdl_Impl, Button*, void ); - DECL_LINK( ClickRenameHdl_Impl, SvxPresetListBox*, void ); - DECL_LINK( ClickDeleteHdl_Impl, SvxPresetListBox*, void ); + DECL_LINK( ClickAddHdl_Impl, weld::Button&, void ); + DECL_LINK( ClickModifyHdl_Impl, weld::Button&, void ); + DECL_LINK( ClickRenameHdl_Impl, PresetListBox*, void ); + DECL_LINK( ClickDeleteHdl_Impl, PresetListBox*, void ); sal_Int32 SearchHatchList(const OUString& rHatchName); public: - SvxHatchTabPage( vcl::Window* pParent, const SfxItemSet& rInAttrs ); + SvxHatchTabPage(TabPageParent pParent, const SfxItemSet& rInAttrs); virtual ~SvxHatchTabPage() override; virtual void dispose() override; @@ -508,23 +519,6 @@ class SvxBitmapTabPage : public SvxTabPage static const sal_uInt16 pBitmapRanges[]; private: - VclPtr<SvxPresetListBox> m_pBitmapLB; - VclPtr<ListBox> m_pBitmapStyleLB; - VclPtr<VclBox> m_pSizeBox; - VclPtr<CheckBox> m_pTsbScale; - VclPtr<MetricField> m_pBitmapWidth; - VclPtr<MetricField> m_pBitmapHeight; - VclPtr<VclBox> m_pPositionBox; - VclPtr<ListBox> m_pPositionLB; - VclPtr<VclBox> m_pPositionOffBox; - VclPtr<MetricField> m_pPositionOffX; - VclPtr<MetricField> m_pPositionOffY; - VclPtr<VclBox> m_pTileOffBox; - VclPtr<ListBox> m_pTileOffLB; - VclPtr<MetricField> m_pTileOffset; - VclPtr<PushButton> m_pBtnImport; - VclPtr<SvxXRectPreview> m_pCtlBitmapPreview; - const SfxItemSet& m_rOutAttrs; XBitmapListRef m_pBitmapList; @@ -542,22 +536,42 @@ private: Size rBitmapSize; Size rFilledSize; Size rZoomedSize; - DECL_LINK( ModifyBitmapHdl, ValueSet*, void ); - DECL_LINK( ClickScaleHdl, Button*, void ); - DECL_LINK( ModifyBitmapStyleHdl, ListBox&, void ); - DECL_LINK( ModifyBitmapSizeHdl, Edit&, void ); - DECL_LINK( ModifyBitmapPositionHdl, ListBox&, void ); - DECL_LINK( ModifyPositionOffsetHdl, Edit&, void ); - DECL_LINK( ModifyTileOffsetHdl, Edit&, void ); - DECL_LINK( ClickRenameHdl, SvxPresetListBox*, void ); - DECL_LINK( ClickDeleteHdl, SvxPresetListBox*, void ); - DECL_LINK( ClickImportHdl, Button*, void ); + + XRectPreview m_aCtlBitmapPreview; + std::unique_ptr<PresetListBox> m_xBitmapLB; + std::unique_ptr<weld::ComboBoxText> m_xBitmapStyleLB; + std::unique_ptr<weld::Container> m_xSizeBox; + std::unique_ptr<weld::CheckButton> m_xTsbScale; + std::unique_ptr<weld::MetricSpinButton> m_xBitmapWidth; + std::unique_ptr<weld::MetricSpinButton> m_xBitmapHeight; + std::unique_ptr<weld::Container> m_xPositionBox; + std::unique_ptr<weld::ComboBoxText> m_xPositionLB; + std::unique_ptr<weld::Container> m_xPositionOffBox; + std::unique_ptr<weld::MetricSpinButton> m_xPositionOffX; + std::unique_ptr<weld::MetricSpinButton> m_xPositionOffY; + std::unique_ptr<weld::Container> m_xTileOffBox; + std::unique_ptr<weld::ComboBoxText> m_xTileOffLB; + std::unique_ptr<weld::MetricSpinButton> m_xTileOffset; + std::unique_ptr<weld::Button> m_xBtnImport; + std::unique_ptr<weld::CustomWeld> m_xCtlBitmapPreview; + std::unique_ptr<weld::CustomWeld> m_xBitmapLBWin; + + DECL_LINK( ModifyBitmapHdl, SvtValueSet*, void ); + DECL_LINK( ClickScaleHdl, weld::Button&, void ); + DECL_LINK( ModifyBitmapStyleHdl, weld::ComboBoxText&, void ); + DECL_LINK( ModifyBitmapSizeHdl, weld::MetricSpinButton&, void ); + DECL_LINK( ModifyBitmapPositionHdl, weld::ComboBoxText&, void ); + DECL_LINK( ModifyPositionOffsetHdl, weld::MetricSpinButton&, void ); + DECL_LINK( ModifyTileOffsetHdl, weld::MetricSpinButton&, void ); + DECL_LINK( ClickRenameHdl, PresetListBox*, void ); + DECL_LINK( ClickDeleteHdl, PresetListBox*, void ); + DECL_LINK( ClickImportHdl, weld::Button&, void ); void ClickBitmapHdl_Impl(); void CalculateBitmapPresetSize(); sal_Int32 SearchBitmapList(const OUString& rBitmapName); public: - SvxBitmapTabPage( vcl::Window* pParent, const SfxItemSet& rInAttrs ); + SvxBitmapTabPage(TabPageParent pParent, const SfxItemSet& rInAttrs); virtual ~SvxBitmapTabPage() override; virtual void dispose() override; @@ -584,16 +598,6 @@ class SvxPatternTabPage : public SvxTabPage using TabPage::DeactivatePage; private: - VclPtr<SvxPixelCtl> m_pCtlPixel; - VclPtr<SvxColorListBox> m_pLbColor; - VclPtr<SvxColorListBox> m_pLbBackgroundColor; - VclPtr<SvxPresetListBox> m_pPatternLB; - VclPtr<SvxXRectPreview> m_pCtlPreview; - VclPtr<PushButton> m_pBtnAdd; - VclPtr<PushButton> m_pBtnModify; - - std::unique_ptr<SvxBitmapCtl> m_pBitmapCtl; - const SfxItemSet& m_rOutAttrs; XColorListRef m_pColorList; @@ -605,17 +609,29 @@ private: XFillAttrSetItem m_aXFillAttr; SfxItemSet& m_rXFSet; - 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( ClickRenameHdl_Impl, SvxPresetListBox*, void ); - DECL_LINK( ClickDeleteHdl_Impl, SvxPresetListBox*, void ); + SvxPixelCtl m_aCtlPixel; + XRectPreview m_aCtlPreview; + std::unique_ptr<ColorListBox> m_xLbColor; + std::unique_ptr<ColorListBox> m_xLbBackgroundColor; + std::unique_ptr<PresetListBox> m_xPatternLB; + std::unique_ptr<weld::Button> m_xBtnAdd; + std::unique_ptr<weld::Button> m_xBtnModify; + std::unique_ptr<weld::CustomWeld> m_xCtlPixel; + std::unique_ptr<weld::CustomWeld> m_xCtlPreview; + std::unique_ptr<weld::CustomWeld> m_xPatternLBWin; + std::unique_ptr<SvxBitmapCtl> m_xBitmapCtl; + + DECL_LINK( ClickAddHdl_Impl, weld::Button&, void ); + DECL_LINK( ClickModifyHdl_Impl, weld::Button&, void ); + DECL_LINK( ChangePatternHdl_Impl, SvtValueSet*, void ); + DECL_LINK( ChangeColorHdl_Impl, ColorListBox&, void ); + DECL_LINK( ClickRenameHdl_Impl, PresetListBox*, void ); + DECL_LINK( ClickDeleteHdl_Impl, PresetListBox*, void ); sal_Int32 SearchPatternList(const OUString& rPatternName); public: - SvxPatternTabPage( vcl::Window* pParent, const SfxItemSet& rInAttrs ); + SvxPatternTabPage(TabPageParent pParent, const SfxItemSet& rInAttrs); virtual ~SvxPatternTabPage() override; virtual void dispose() override; diff --git a/cui/source/tabpages/backgrnd.cxx b/cui/source/tabpages/backgrnd.cxx index 9d9fa98d1f54..c6c325b38fe3 100644 --- a/cui/source/tabpages/backgrnd.cxx +++ b/cui/source/tabpages/backgrnd.cxx @@ -1443,16 +1443,14 @@ void SvxBackgroundTabPage::PageCreated(const SfxAllItemSet& aSet) } } -SvxBkgTabPage::SvxBkgTabPage( vcl::Window* pParent, const SfxItemSet& rInAttrs ) : - SvxAreaTabPage( pParent, rInAttrs ), - m_pTblLBox(nullptr), - bHighlighting(false) +SvxBkgTabPage::SvxBkgTabPage(TabPageParent pParent, const SfxItemSet& rInAttrs) + : SvxAreaTabPage(pParent, rInAttrs) + , bHighlighting(false) { - VclPtr<vcl::Window> pBtn; - get(pBtn, "btngradient"); pBtn->Hide(); - get(pBtn, "btnhatch"); pBtn->Hide(); - get(pBtn, "btnbitmap"); pBtn->Hide(); - get(pBtn, "btnpattern"); pBtn->Hide(); + m_xBtnGradient->hide(); + m_xBtnHatch->hide(); + m_xBtnBitmap->hide(); + m_xBtnPattern->hide(); SfxObjectShell* pDocSh = SfxObjectShell::Current(); const SfxPoolItem* pItem = nullptr; @@ -1483,7 +1481,7 @@ SvxBkgTabPage::~SvxBkgTabPage() void SvxBkgTabPage::dispose() { - m_pTblLBox.clear(); + m_xTblLBox.reset(); SvxAreaTabPage::dispose(); } @@ -1501,9 +1499,9 @@ DeactivateRC SvxBkgTabPage::DeactivatePage( SfxItemSet* _pSet ) bool SvxBkgTabPage::FillItemSet( SfxItemSet* rCoreSet ) { sal_uInt16 nSlot = SID_ATTR_BRUSH; - if ( m_pTblLBox && m_pTblLBox->IsVisible() ) + if (m_xTblLBox && m_xTblLBox->get_visible()) { - switch( m_pTblLBox->GetSelectedEntryPos() ) + switch (m_xTblLBox->get_active()) { case TBL_DEST_CELL: nSlot = SID_ATTR_BRUSH; @@ -1549,10 +1547,9 @@ bool SvxBkgTabPage::FillItemSet( SfxItemSet* rCoreSet ) return true; } -VclPtr<SfxTabPage> SvxBkgTabPage::Create( TabPageParent pWindow, - const SfxItemSet* rAttrs ) +VclPtr<SfxTabPage> SvxBkgTabPage::Create(TabPageParent pWindow, const SfxItemSet* rAttrs) { - return VclPtr<SvxBkgTabPage>::Create( pWindow.pParent, *rAttrs ); + return VclPtr<SvxBkgTabPage>::Create(pWindow, *rAttrs); } void SvxBkgTabPage::PageCreated(const SfxAllItemSet& aSet) @@ -1563,21 +1560,15 @@ void SvxBkgTabPage::PageCreated(const SfxAllItemSet& aSet) SvxBackgroundTabFlags nFlags = static_cast<SvxBackgroundTabFlags>(pFlagItem->GetValue()); if ( nFlags & SvxBackgroundTabFlags::SHOW_TBLCTL ) { - VclPtr<vcl::Window> pBtn; - get(pBtn, "btnbitmap"); - pBtn->Show(); - get(m_pTblLBox, "tablelb"); - m_pTblLBox->SelectEntryPos(0); - m_pTblLBox->Show(); + m_xBtnBitmap->show(); + m_xTblLBox = m_xBuilder->weld_combo_box_text("tablelb"); + m_xTblLBox->set_active(0); + m_xTblLBox->show(); } else if (nFlags & SvxBackgroundTabFlags::SHOW_HIGHLIGHTING) bHighlighting = bool(nFlags & SvxBackgroundTabFlags::SHOW_HIGHLIGHTING); else if (nFlags & SvxBackgroundTabFlags::SHOW_SELECTOR) - { - VclPtr<vcl::Window> pBtn; - get(pBtn, "btnbitmap"); - pBtn->Show(); - } + m_xBtnBitmap->show(); } SvxAreaTabPage::PageCreated( aSet ); } diff --git a/cui/source/tabpages/tparea.cxx b/cui/source/tabpages/tparea.cxx index dbceed157716..655c532a1aab 100644 --- a/cui/source/tabpages/tparea.cxx +++ b/cui/source/tabpages/tparea.cxx @@ -82,72 +82,64 @@ void lclExtendSize(Size& rSize, const Size& rInputSize) |* \************************************************************************/ -SvxAreaTabPage::SvxAreaTabPage( vcl::Window* pParent, const SfxItemSet& rInAttrs ) : - - SvxTabPage( pParent, - "AreaTabPage", - "cui/ui/areatabpage.ui", - rInAttrs ), - m_pFillTabPage( nullptr ), - m_pColorList( nullptr ), - m_pGradientList( nullptr ), - m_pHatchingList( nullptr ), - m_pBitmapList( nullptr ), - m_pPatternList( nullptr ), - +SvxAreaTabPage::SvxAreaTabPage(TabPageParent pParent, const SfxItemSet& rInAttrs) + : SvxTabPage(pParent, "cui/ui/areatabpage.ui", "AreaTabPage", rInAttrs) + , m_pFillTabPage(nullptr) + , m_pColorList(nullptr) + , m_pGradientList(nullptr) + , m_pHatchingList(nullptr) + , m_pBitmapList(nullptr) + , m_pPatternList(nullptr) // local fixed not o be changed values for local pointers - maFixed_ChangeType(ChangeType::NONE), - + , maFixed_ChangeType(ChangeType::NONE) // init with pointers to fixed ChangeType - m_pnColorListState(&maFixed_ChangeType), - m_pnBitmapListState(&maFixed_ChangeType), - m_pnPatternListState(&maFixed_ChangeType), - m_pnGradientListState(&maFixed_ChangeType), - m_pnHatchingListState(&maFixed_ChangeType), - m_aXFillAttr ( rInAttrs.GetPool() ), - m_rXFSet ( m_aXFillAttr.GetItemSet() ) + , m_pnColorListState(&maFixed_ChangeType) + , m_pnBitmapListState(&maFixed_ChangeType) + , m_pnPatternListState(&maFixed_ChangeType) + , m_pnGradientListState(&maFixed_ChangeType) + , m_pnHatchingListState(&maFixed_ChangeType) + , m_aXFillAttr(rInAttrs.GetPool()) + , m_rXFSet(m_aXFillAttr.GetItemSet()) + , m_xFillTab(m_xBuilder->weld_container("fillstylebox")) + , m_xBtnNone(m_xBuilder->weld_toggle_button("btnnone")) + , m_xBtnColor(m_xBuilder->weld_toggle_button("btncolor")) + , m_xBtnGradient(m_xBuilder->weld_toggle_button("btngradient")) + , m_xBtnHatch(m_xBuilder->weld_toggle_button("btnhatch")) + , m_xBtnBitmap(m_xBuilder->weld_toggle_button("btnbitmap")) + , m_xBtnPattern(m_xBuilder->weld_toggle_button("btnpattern")) { - - get(m_pBtnNone, "btnnone"); - get(m_pBtnColor, "btncolor"); - get(m_pBtnGradient, "btngradient"); - get(m_pBtnHatch, "btnhatch"); - get(m_pBtnBitmap, "btnbitmap"); - get(m_pBtnPattern, "btnpattern"); - get(m_pFillTab, "fillstylebox"); - maBox.AddButton( m_pBtnNone ); - maBox.AddButton( m_pBtnColor ); - maBox.AddButton( m_pBtnGradient ); - maBox.AddButton( m_pBtnHatch ); - maBox.AddButton( m_pBtnBitmap ); - maBox.AddButton( m_pBtnPattern ); - Link< Button*, void > aLink = LINK(this, SvxAreaTabPage, SelectFillTypeHdl_Impl); - m_pBtnNone->SetClickHdl(aLink); - m_pBtnColor->SetClickHdl(aLink); - m_pBtnGradient->SetClickHdl(aLink); - m_pBtnHatch->SetClickHdl(aLink); - m_pBtnBitmap->SetClickHdl(aLink); - m_pBtnPattern->SetClickHdl(aLink); + maBox.AddButton(m_xBtnNone.get()); + maBox.AddButton(m_xBtnColor.get()); + maBox.AddButton(m_xBtnGradient.get()); + maBox.AddButton(m_xBtnHatch.get()); + maBox.AddButton(m_xBtnBitmap.get()); + maBox.AddButton(m_xBtnPattern.get()); + Link<weld::ToggleButton&, void> aLink = LINK(this, SvxAreaTabPage, SelectFillTypeHdl_Impl); + m_xBtnNone->connect_toggled(aLink); + m_xBtnColor->connect_toggled(aLink); + m_xBtnGradient->connect_toggled(aLink); + m_xBtnHatch->connect_toggled(aLink); + m_xBtnBitmap->connect_toggled(aLink); + m_xBtnPattern->connect_toggled(aLink); SetExchangeSupport(); - TabPageParent aFillTab(m_pFillTab); + TabPageParent aFillTab(m_xFillTab.get()); // Calculate optimal size of all pages.. m_pFillTabPage.disposeAndReset(SvxColorTabPage::Create(aFillTab, &m_rXFSet)); - Size aSize = m_pFillTabPage->GetOptimalSize(); + Size aSize = m_pFillTabPage->get_container_size(); m_pFillTabPage.disposeAndReset(SvxGradientTabPage::Create(aFillTab, &m_rXFSet)); - lclExtendSize(aSize, m_pFillTabPage->GetOptimalSize()); + lclExtendSize(aSize, m_pFillTabPage->get_container_size()); m_pFillTabPage.disposeAndReset(SvxBitmapTabPage::Create(aFillTab, &m_rXFSet)); - lclExtendSize(aSize, m_pFillTabPage->GetOptimalSize()); + lclExtendSize(aSize, m_pFillTabPage->get_container_size()); m_pFillTabPage.disposeAndReset(SvxHatchTabPage::Create(aFillTab, &m_rXFSet)); - lclExtendSize(aSize, m_pFillTabPage->GetOptimalSize()); + lclExtendSize(aSize, m_pFillTabPage->get_container_size()); m_pFillTabPage.disposeAndReset(SvxPatternTabPage::Create(aFillTab, &m_rXFSet)); - lclExtendSize(aSize, m_pFillTabPage->GetOptimalSize()); + lclExtendSize(aSize, m_pFillTabPage->get_container_size()); m_pFillTabPage.disposeAndClear(); - m_pFillTab->set_width_request(aSize.Width()); - m_pFillTab->set_height_request(aSize.Height()); + m_xFillTab->set_size_request(aSize.Width(), aSize.Height()); } SvxAreaTabPage::~SvxAreaTabPage() @@ -157,13 +149,6 @@ SvxAreaTabPage::~SvxAreaTabPage() void SvxAreaTabPage::dispose() { - m_pBtnNone.clear(); - m_pBtnColor.clear(); - m_pBtnGradient.clear(); - m_pBtnHatch.clear(); - m_pBtnBitmap.clear(); - m_pBtnPattern.clear(); - m_pFillTab.clear(); m_pFillTabPage.disposeAndClear(); SvxTabPage::dispose(); } @@ -183,25 +168,25 @@ void SvxAreaTabPage::ActivatePage( const SfxItemSet& rSet ) default: case drawing::FillStyle_NONE: { - SelectFillTypeHdl_Impl( m_pBtnNone ); + SelectFillTypeHdl_Impl(*m_xBtnNone); break; } case drawing::FillStyle_SOLID: { m_rXFSet.Put( static_cast<const XFillColorItem&>( rSet.Get( GetWhich( XATTR_FILLCOLOR ) ) ) ); - SelectFillTypeHdl_Impl( m_pBtnColor ); + SelectFillTypeHdl_Impl(*m_xBtnColor); break; } case drawing::FillStyle_GRADIENT: { m_rXFSet.Put( static_cast<const XFillGradientItem&>( rSet.Get( GetWhich( XATTR_FILLGRADIENT ) ) ) ); - SelectFillTypeHdl_Impl( m_pBtnGradient ); + SelectFillTypeHdl_Impl(*m_xBtnGradient); break; } case drawing::FillStyle_HATCH: { m_rXFSet.Put( rSet.Get(XATTR_FILLHATCH) ); - SelectFillTypeHdl_Impl( m_pBtnHatch ); + SelectFillTypeHdl_Impl(*m_xBtnHatch); break; } case drawing::FillStyle_BITMAP: @@ -210,9 +195,9 @@ void SvxAreaTabPage::ActivatePage( const SfxItemSet& rSet ) // pass full item set here, bitmap fill has many attributes (tiling, size, offset etc.) m_rXFSet.Put( rSet ); if(!aItem.isPattern()) - SelectFillTypeHdl_Impl( m_pBtnBitmap ); + SelectFillTypeHdl_Impl(*m_xBtnBitmap); else - SelectFillTypeHdl_Impl( m_pBtnPattern ); + SelectFillTypeHdl_Impl(*m_xBtnPattern); break; } } @@ -335,15 +320,14 @@ void SvxAreaTabPage::Reset( const SfxItemSet* rAttrs ) } } -VclPtr<SfxTabPage> SvxAreaTabPage::Create( TabPageParent pWindow, - const SfxItemSet* rAttrs ) +VclPtr<SfxTabPage> SvxAreaTabPage::Create(TabPageParent pParent, const SfxItemSet* rAttrs) { - return VclPtr<SvxAreaTabPage>::Create( pWindow.pParent, *rAttrs ); + return VclPtr<SvxAreaTabPage>::Create(pParent, *rAttrs); } namespace { -VclPtr<SfxTabPage> lcl_CreateFillStyleTabPage( sal_uInt16 nId, vcl::Window* pParent, const SfxItemSet& rSet ) +VclPtr<SfxTabPage> lcl_CreateFillStyleTabPage(sal_uInt16 nId, TabPageParent pParent, const SfxItemSet& rSet) { CreateTabPage fnCreate = nullptr; switch(nId) @@ -361,14 +345,16 @@ VclPtr<SfxTabPage> lcl_CreateFillStyleTabPage( sal_uInt16 nId, vcl::Window* pPar } -IMPL_LINK(SvxAreaTabPage, SelectFillTypeHdl_Impl, Button*, pButton, void) +IMPL_LINK(SvxAreaTabPage, SelectFillTypeHdl_Impl, weld::ToggleButton&, rButton, void) { - sal_Int32 nPos = maBox.GetButtonPos( static_cast<PushButton*>(pButton) ); + sal_Int32 nPos = maBox.GetButtonPos(&rButton); if(nPos != -1 && nPos != maBox.GetCurrentButtonPos()) { - maBox.SelectButton(static_cast<PushButton*>(pButton)); + maBox.SelectButton(&rButton); FillType eFillType = static_cast<FillType>(maBox.GetCurrentButtonPos()); - m_pFillTabPage.disposeAndReset( lcl_CreateFillStyleTabPage(eFillType, m_pFillTab, m_rXFSet) ); + m_pFillTabPage.disposeAndReset(lcl_CreateFillStyleTabPage(eFillType, m_xFillTab.get(), m_rXFSet)); + if (m_pFillTabPage) + m_pFillTabPage->SetTabDialog(GetTabDialog()); CreatePage( eFillType , m_pFillTabPage); } } diff --git a/cui/source/tabpages/tpbitmap.cxx b/cui/source/tabpages/tpbitmap.cxx index 982d15ae2669..edd5f5981c6e 100644 --- a/cui/source/tabpages/tpbitmap.cxx +++ b/cui/source/tabpages/tpbitmap.cxx @@ -67,73 +67,66 @@ const sal_uInt16 SvxBitmapTabPage::pBitmapRanges[] = 0 }; -SvxBitmapTabPage::SvxBitmapTabPage( vcl::Window* pParent, const SfxItemSet& rInAttrs ) : - - SvxTabPage( pParent, - "BitmapTabPage", - "cui/ui/bitmaptabpage.ui", - rInAttrs ), - m_rOutAttrs (rInAttrs ), - - m_pBitmapList( nullptr ), - - m_pnBitmapListState( nullptr ), - m_fObjectWidth(0.0), - m_fObjectHeight(0.0), - m_bLogicalSize(false), - m_aXFillAttr ( rInAttrs.GetPool() ), - m_rXFSet ( m_aXFillAttr.GetItemSet() ), - mpView(nullptr) +SvxBitmapTabPage::SvxBitmapTabPage(TabPageParent pParent, const SfxItemSet& rInAttrs) + : SvxTabPage(pParent, "cui/ui/bitmaptabpage.ui", "BitmapTabPage", rInAttrs) + , m_rOutAttrs(rInAttrs) + , m_pBitmapList(nullptr) + , m_pnBitmapListState(nullptr) + , m_fObjectWidth(0.0) + , m_fObjectHeight(0.0) + , m_bLogicalSize(false) + , m_aXFillAttr(rInAttrs.GetPool()) + , m_rXFSet(m_aXFillAttr.GetItemSet()) + , mpView(nullptr) + , m_xBitmapLB(new PresetListBox(m_xBuilder->weld_scrolled_window("bitmapwin"))) + , m_xBitmapStyleLB(m_xBuilder->weld_combo_box_text("bitmapstyle")) + , m_xSizeBox(m_xBuilder->weld_container("sizebox")) + , m_xTsbScale(m_xBuilder->weld_check_button("scaletsb")) + , m_xBitmapWidth(m_xBuilder->weld_metric_spin_button("width", FUNIT_PERCENT)) + , m_xBitmapHeight(m_xBuilder->weld_metric_spin_button("height", FUNIT_PERCENT)) + , m_xPositionBox(m_xBuilder->weld_container("posbox")) + , m_xPositionLB(m_xBuilder->weld_combo_box_text("positionlb")) + , m_xPositionOffBox(m_xBuilder->weld_container("posoffbox")) + , m_xPositionOffX(m_xBuilder->weld_metric_spin_button("posoffx", FUNIT_PERCENT)) + , m_xPositionOffY(m_xBuilder->weld_metric_spin_button("posoffy", FUNIT_PERCENT)) + , m_xTileOffBox(m_xBuilder->weld_container("tileoffbox")) + , m_xTileOffLB(m_xBuilder->weld_combo_box_text("tileofflb")) + , m_xTileOffset(m_xBuilder->weld_metric_spin_button("tileoffmtr", FUNIT_PERCENT)) + , m_xBtnImport(m_xBuilder->weld_button("BTN_IMPORT")) + , m_xCtlBitmapPreview(new weld::CustomWeld(*m_xBuilder, "CTL_BITMAP_PREVIEW", m_aCtlBitmapPreview)) + , m_xBitmapLBWin(new weld::CustomWeld(*m_xBuilder, "BITMAP", *m_xBitmapLB)) { - get(m_pBitmapLB,"BITMAP"); - get(m_pBitmapStyleLB, "bitmapstyle"); - get(m_pSizeBox, "sizebox"); - get(m_pBitmapWidth, "width"); - get(m_pBitmapHeight, "height"); - get(m_pTsbScale, "scaletsb"); - get(m_pPositionBox, "posbox"); - get(m_pPositionLB, "positionlb"); - get(m_pPositionOffBox, "posoffbox"); - get(m_pPositionOffX, "posoffx"); - get(m_pPositionOffY, "posoffy"); - get(m_pTileOffBox, "tileoffbox"); - get(m_pTileOffLB, "tileofflb"); - get(m_pTileOffset, "tileoffmtr"); - get(m_pCtlBitmapPreview,"CTL_BITMAP_PREVIEW"); - get(m_pBtnImport, "BTN_IMPORT"); - // setting the output device m_rXFSet.Put( XFillStyleItem(drawing::FillStyle_BITMAP) ); m_rXFSet.Put( XFillBitmapItem(OUString(), Graphic()) ); - m_pCtlBitmapPreview->SetAttributes( m_aXFillAttr.GetItemSet() ); - - m_pBitmapLB->SetSelectHdl( LINK(this, SvxBitmapTabPage, ModifyBitmapHdl) ); - m_pBitmapLB->SetRenameHdl( LINK(this, SvxBitmapTabPage, ClickRenameHdl) ); - m_pBitmapLB->SetDeleteHdl( LINK(this, SvxBitmapTabPage, ClickDeleteHdl) ); - m_pBitmapStyleLB->SetSelectHdl( LINK(this, SvxBitmapTabPage, ModifyBitmapStyleHdl) ); - Link<Edit&, void> aLink1( LINK(this, SvxBitmapTabPage, ModifyBitmapSizeHdl) ); - m_pBitmapWidth->SetModifyHdl( aLink1 ); - m_pBitmapHeight->SetModifyHdl( aLink1 ); - m_pTsbScale->SetClickHdl( LINK(this, SvxBitmapTabPage, ClickScaleHdl) ); - m_pPositionLB->SetSelectHdl( LINK( this, SvxBitmapTabPage, ModifyBitmapPositionHdl ) ); - Link<Edit&, void> aLink( LINK( this, SvxBitmapTabPage, ModifyPositionOffsetHdl ) ); - m_pPositionOffX->SetModifyHdl(aLink); - m_pPositionOffY->SetModifyHdl(aLink); - m_pTileOffset->SetModifyHdl( LINK( this, SvxBitmapTabPage, ModifyTileOffsetHdl ) ); - m_pBtnImport->SetClickHdl( LINK(this, SvxBitmapTabPage, ClickImportHdl) ); + m_aCtlBitmapPreview.SetAttributes( m_aXFillAttr.GetItemSet() ); + + m_xBitmapLB->SetSelectHdl( LINK(this, SvxBitmapTabPage, ModifyBitmapHdl) ); + m_xBitmapLB->SetRenameHdl( LINK(this, SvxBitmapTabPage, ClickRenameHdl) ); + m_xBitmapLB->SetDeleteHdl( LINK(this, SvxBitmapTabPage, ClickDeleteHdl) ); + m_xBitmapStyleLB->connect_changed( LINK(this, SvxBitmapTabPage, ModifyBitmapStyleHdl) ); + Link<weld::MetricSpinButton&, void> aLink1( LINK(this, SvxBitmapTabPage, ModifyBitmapSizeHdl) ); + m_xBitmapWidth->connect_value_changed( aLink1 ); + m_xBitmapHeight->connect_value_changed( aLink1 ); + m_xTsbScale->connect_clicked(LINK(this, SvxBitmapTabPage, ClickScaleHdl)); + m_xPositionLB->connect_changed( LINK( this, SvxBitmapTabPage, ModifyBitmapPositionHdl ) ); + Link<weld::MetricSpinButton&, void> aLink( LINK( this, SvxBitmapTabPage, ModifyPositionOffsetHdl ) ); + m_xPositionOffX->connect_value_changed(aLink); + m_xPositionOffY->connect_value_changed(aLink); + m_xTileOffset->set_value(0, FUNIT_PERCENT); + m_xTileOffset->connect_value_changed( LINK( this, SvxBitmapTabPage, ModifyTileOffsetHdl ) ); + m_xBtnImport->connect_clicked( LINK(this, SvxBitmapTabPage, ClickImportHdl) ); // Calculate size of display boxes Size aSize = getDrawPreviewOptimalSize(this); - m_pBitmapLB->set_width_request(aSize.Width()); - m_pBitmapLB->set_height_request(aSize.Height()); - m_pCtlBitmapPreview->set_width_request(aSize.Width()); - m_pCtlBitmapPreview->set_height_request(aSize.Height()); + m_xBitmapLB->set_size_request(aSize.Width(), aSize.Height()); + m_xCtlBitmapPreview->set_size_request(aSize.Width(), aSize.Height()); SfxItemPool* pPool = m_rXFSet.GetPool(); mePoolUnit = pPool->GetMetric( XATTR_FILLBMP_SIZEX ); meFieldUnit = GetModuleFieldUnit( rInAttrs ); - SetFieldUnit( *m_pBitmapWidth, meFieldUnit, true ); - SetFieldUnit( *m_pBitmapHeight, meFieldUnit, true ); + SetFieldUnit( *m_xBitmapWidth, meFieldUnit, true ); + SetFieldUnit( *m_xBitmapHeight, meFieldUnit, true ); SfxViewShell* pViewShell = SfxViewShell::Current(); if( pViewShell ) @@ -148,32 +141,17 @@ SvxBitmapTabPage::~SvxBitmapTabPage() void SvxBitmapTabPage::dispose() { - m_pBitmapLB.clear(); - m_pBitmapStyleLB.clear(); - m_pSizeBox.clear(); - m_pBitmapWidth.clear(); - m_pBitmapHeight.clear(); - m_pTsbScale.clear(); - m_pPositionBox.clear(); - m_pPositionLB.clear(); - m_pPositionOffBox.clear(); - m_pPositionOffX.clear(); - m_pPositionOffY.clear(); - m_pTileOffBox.clear(); - m_pTileOffLB.clear(); - m_pTileOffset.clear(); - m_pCtlBitmapPreview.clear(); - m_pBtnImport.clear(); + m_xBitmapLBWin.reset(); + m_xBitmapLB.reset(); + m_xCtlBitmapPreview.reset(); SvxTabPage::dispose(); } - void SvxBitmapTabPage::Construct() { - m_pBitmapLB->FillPresetListBox( *m_pBitmapList ); + m_xBitmapLB->FillPresetListBox( *m_pBitmapList ); } - void SvxBitmapTabPage::ActivatePage( const SfxItemSet& rSet ) { XFillBitmapItem aItem( rSet.Get(XATTR_FILLBITMAP) ); @@ -181,8 +159,8 @@ void SvxBitmapTabPage::ActivatePage( const SfxItemSet& rSet ) sal_Int32 nPos = SearchBitmapList( aItem.GetName() ); if ( nPos != LISTBOX_ENTRY_NOTFOUND ) { - sal_uInt16 nId = m_pBitmapLB->GetItemId( static_cast<size_t>( nPos ) ); - m_pBitmapLB->SelectItem( nId ); + sal_uInt16 nId = m_xBitmapLB->GetItemId( static_cast<size_t>( nPos ) ); + m_xBitmapLB->SelectItem( nId ); } } @@ -199,15 +177,15 @@ DeactivateRC SvxBitmapTabPage::DeactivatePage( SfxItemSet* _pSet ) bool SvxBitmapTabPage::FillItemSet( SfxItemSet* rAttrs ) { rAttrs->Put(XFillStyleItem(drawing::FillStyle_BITMAP)); - size_t nPos = m_pBitmapLB->GetSelectItemPos(); + size_t nPos = m_xBitmapLB->GetSelectItemPos(); if(VALUESET_ITEM_NOTFOUND != nPos) { const XBitmapEntry* pXBitmapEntry = m_pBitmapList->GetBitmap(nPos); - const OUString aString(m_pBitmapLB->GetItemText( m_pBitmapLB->GetSelectedItemId() )); + const OUString aString(m_xBitmapLB->GetItemText( m_xBitmapLB->GetSelectedItemId() )); rAttrs->Put(XFillBitmapItem(aString, pXBitmapEntry->GetGraphicObject())); } - BitmapStyle eStylePos = static_cast<BitmapStyle>(m_pBitmapStyleLB->GetSelectedEntryPos()); + BitmapStyle eStylePos = static_cast<BitmapStyle>(m_xBitmapStyleLB->get_active()); bool bIsStretched( eStylePos == STRETCHED ); bool bIsTiled( eStylePos == TILED ); @@ -222,17 +200,17 @@ bool SvxBitmapTabPage::FillItemSet( SfxItemSet* rAttrs ) case CUSTOM: case TILED: { - sal_Int64 nWidthPercent = m_pBitmapWidth->GetValue(); - sal_Int64 nHeightPercent = m_pBitmapHeight->GetValue(); - if(m_pTsbScale->IsEnabled() && m_pTsbScale->GetState() == TRISTATE_TRUE) + sal_Int64 nWidthPercent = m_xBitmapWidth->get_value(FUNIT_NONE); + sal_Int64 nHeightPercent = m_xBitmapHeight->get_value(FUNIT_NONE); + if (m_xTsbScale->get_sensitive() && m_xTsbScale->get_state() == TRISTATE_TRUE) { aSetBitmapSize.setWidth( -nWidthPercent ); aSetBitmapSize.setHeight( -nHeightPercent ); } else if (!m_bLogicalSize) { - aSetBitmapSize.setWidth( GetCoreValue(*m_pBitmapWidth, mePoolUnit) ); - aSetBitmapSize.setHeight( GetCoreValue(*m_pBitmapHeight, mePoolUnit) ); + aSetBitmapSize.setWidth( GetCoreValue(*m_xBitmapWidth, mePoolUnit) ); + aSetBitmapSize.setHeight( GetCoreValue(*m_xBitmapHeight, mePoolUnit) ); } else { @@ -251,16 +229,16 @@ bool SvxBitmapTabPage::FillItemSet( SfxItemSet* rAttrs ) rAttrs->Put( XFillBmpSizeYItem( aSetBitmapSize.Height() ) ); } - if(m_pPositionLB->IsEnabled()) - rAttrs->Put( XFillBmpPosItem( static_cast<RectPoint>( m_pPositionLB->GetSelectedEntryPos() ) ) ); - if(m_pPositionOffX->IsEnabled()) - rAttrs->Put( XFillBmpPosOffsetXItem( m_pPositionOffX->GetValue() ) ); - if(m_pPositionOffY->IsEnabled()) - rAttrs->Put( XFillBmpPosOffsetYItem( m_pPositionOffY->GetValue() ) ); - if(m_pTileOffBox->IsEnabled()) + if (m_xPositionLB->get_sensitive()) + rAttrs->Put( XFillBmpPosItem( static_cast<RectPoint>( m_xPositionLB->get_active() ) ) ); + if (m_xPositionOffX->get_sensitive()) + rAttrs->Put( XFillBmpPosOffsetXItem(m_xPositionOffX->get_value(FUNIT_PERCENT))); + if (m_xPositionOffY->get_sensitive()) + rAttrs->Put( XFillBmpPosOffsetYItem(m_xPositionOffY->get_value(FUNIT_PERCENT))); + if (m_xTileOffBox->get_sensitive()) { - TileOffset eValue = static_cast<TileOffset>(m_pTileOffLB->GetSelectedEntryPos()); - sal_uInt16 nOffsetValue = static_cast<sal_uInt16>(m_pTileOffset->GetValue()); + TileOffset eValue = static_cast<TileOffset>(m_xTileOffLB->get_active()); + sal_uInt16 nOffsetValue = static_cast<sal_uInt16>(m_xTileOffset->get_value(FUNIT_PERCENT)); sal_uInt16 nRowOff = (eValue == ROW) ? nOffsetValue : 0; sal_uInt16 nColOff = (eValue == COLUMN) ? nOffsetValue : 0; rAttrs->Put( XFillBmpTileOffsetXItem(nRowOff) ); @@ -300,11 +278,11 @@ void SvxBitmapTabPage::Reset( const SfxItemSet* rAttrs ) if(!aItem.isPattern()) { m_rXFSet.Put( aItem ); - m_pCtlBitmapPreview->SetAttributes( m_aXFillAttr.GetItemSet() ); - m_pCtlBitmapPreview->Invalidate(); + m_aCtlBitmapPreview.SetAttributes( m_aXFillAttr.GetItemSet() ); + m_aCtlBitmapPreview.Invalidate(); } else - m_pCtlBitmapPreview->Disable(); + m_xCtlBitmapPreview->set_sensitive(false); std::unique_ptr<GraphicObject> pGraphicObject; pGraphicObject.reset( new GraphicObject(aItem.GetGraphicObject()) ); @@ -324,34 +302,32 @@ void SvxBitmapTabPage::Reset( const SfxItemSet* rAttrs ) bStretched = rAttrs->Get( XATTR_FILLBMP_STRETCH ).GetValue(); if (bTiled) - m_pBitmapStyleLB->SelectEntryPos(static_cast<sal_Int32>(TILED)); + m_xBitmapStyleLB->set_active(static_cast<sal_Int32>(TILED)); else if (bStretched) - m_pBitmapStyleLB->SelectEntryPos( static_cast<sal_Int32>(STRETCHED) ); + m_xBitmapStyleLB->set_active(static_cast<sal_Int32>(STRETCHED)); else - m_pBitmapStyleLB->SelectEntryPos( static_cast<sal_Int32>(CUSTOM) ); + m_xBitmapStyleLB->set_active(static_cast<sal_Int32>(CUSTOM)); long nWidth = 0; long nHeight = 0; if(rAttrs->GetItemState(XATTR_FILLBMP_SIZELOG) != SfxItemState::DONTCARE) { - m_pTsbScale->EnableTriState( false ); - - if( rAttrs->Get( XATTR_FILLBMP_SIZELOG ).GetValue() ) + if (rAttrs->Get( XATTR_FILLBMP_SIZELOG ).GetValue()) { - m_pTsbScale->SetState( TRISTATE_FALSE ); + m_xTsbScale->set_state(TRISTATE_FALSE); m_bLogicalSize = true; } else { - m_pTsbScale->SetState( TRISTATE_TRUE ); + m_xTsbScale->set_state(TRISTATE_TRUE); m_bLogicalSize = false; } - ClickScaleHdl( nullptr ); + ClickScaleHdl(*m_xTsbScale); } else - m_pTsbScale->SetState( TRISTATE_INDET ); + m_xTsbScale->set_state(TRISTATE_INDET); TriState eRelative = TRISTATE_FALSE; if(rAttrs->GetItemState(XATTR_FILLBMP_SIZEX) != SfxItemState::DONTCARE) @@ -377,51 +353,51 @@ void SvxBitmapTabPage::Reset( const SfxItemSet* rAttrs ) nHeight = std::abs(nHeight); } } - m_pTsbScale->SetState(eRelative); + m_xTsbScale->set_state(eRelative); if(rBitmapSize.Width() > 0 && rBitmapSize.Height() > 0) { - if(eRelative == TRISTATE_TRUE) + if (eRelative == TRISTATE_TRUE) { - m_pBitmapWidth->SetValue(nWidth); - m_pBitmapHeight->SetValue(nHeight); + m_xBitmapWidth->set_value(nWidth, FUNIT_NONE); + m_xBitmapHeight->set_value(nHeight, FUNIT_NONE); } else { - SetMetricValue(*m_pBitmapWidth, nWidth, mePoolUnit); - SetMetricValue(*m_pBitmapHeight, nHeight, mePoolUnit); + SetMetricValue(*m_xBitmapWidth, nWidth, mePoolUnit); + SetMetricValue(*m_xBitmapHeight, nHeight, mePoolUnit); } } if( rAttrs->GetItemState( XATTR_FILLBMP_POS ) != SfxItemState::DONTCARE ) { RectPoint eValue = rAttrs->Get( XATTR_FILLBMP_POS ).GetValue(); - m_pPositionLB->SelectEntryPos( static_cast< sal_Int32 >(eValue) ); + m_xPositionLB->set_active( static_cast< sal_Int32 >(eValue) ); } if( rAttrs->GetItemState( XATTR_FILLBMP_POSOFFSETX ) != SfxItemState::DONTCARE ) { sal_Int32 nValue = rAttrs->Get( XATTR_FILLBMP_POSOFFSETX ).GetValue(); - m_pPositionOffX->SetValue( nValue ); + m_xPositionOffX->set_value(nValue, FUNIT_PERCENT); } else - m_pPositionOffX->SetText(""); + m_xPositionOffX->set_text(""); if( rAttrs->GetItemState( XATTR_FILLBMP_POSOFFSETY ) != SfxItemState::DONTCARE ) { sal_Int32 nValue = rAttrs->Get( XATTR_FILLBMP_POSOFFSETY ).GetValue(); - m_pPositionOffY->SetValue( nValue ); + m_xPositionOffY->set_value(nValue, FUNIT_PERCENT); } else - m_pPositionOffY->SetText(""); + m_xPositionOffY->set_text(""); if( rAttrs->GetItemState( XATTR_FILLBMP_TILEOFFSETX ) != SfxItemState::DONTCARE) { sal_Int32 nValue = rAttrs->Get( XATTR_FILLBMP_TILEOFFSETX ).GetValue(); if(nValue > 0) { - m_pTileOffLB->SelectEntryPos(static_cast<sal_Int32>(ROW)); - m_pTileOffset->SetValue( nValue ); + m_xTileOffLB->set_active(static_cast<sal_Int32>(ROW)); + m_xTileOffset->set_value(nValue, FUNIT_PERCENT); } } @@ -430,28 +406,25 @@ void SvxBitmapTabPage::Reset( const SfxItemSet* rAttrs ) sal_Int32 nValue = rAttrs->Get( XATTR_FILLBMP_TILEOFFSETY ).GetValue(); if(nValue > 0) { - m_pTileOffLB->SelectEntryPos(static_cast<sal_Int32>(COLUMN)); - m_pTileOffset->SetValue( nValue ); + m_xTileOffLB->set_active(static_cast<sal_Int32>(COLUMN)); + m_xTileOffset->set_value(nValue, FUNIT_PERCENT); } } ClickBitmapHdl_Impl(); } - -VclPtr<SfxTabPage> SvxBitmapTabPage::Create( TabPageParent pWindow, - const SfxItemSet* rAttrs ) +VclPtr<SfxTabPage> SvxBitmapTabPage::Create(TabPageParent pWindow, const SfxItemSet* rAttrs) { - return VclPtr<SvxBitmapTabPage>::Create( pWindow.pParent, *rAttrs ); + return VclPtr<SvxBitmapTabPage>::Create(pWindow, *rAttrs); } - void SvxBitmapTabPage::ClickBitmapHdl_Impl() { - m_pBitmapLB->Enable(); - m_pCtlBitmapPreview->Enable(); + m_xBitmapLBWin->set_sensitive(true); + m_xCtlBitmapPreview->set_sensitive(true); - ModifyBitmapHdl( m_pBitmapLB ); + ModifyBitmapHdl(m_xBitmapLB.get()); } void SvxBitmapTabPage::CalculateBitmapPresetSize() @@ -478,10 +451,10 @@ void SvxBitmapTabPage::CalculateBitmapPresetSize() } } -IMPL_LINK_NOARG(SvxBitmapTabPage, ModifyBitmapHdl, ValueSet*, void) +IMPL_LINK_NOARG(SvxBitmapTabPage, ModifyBitmapHdl, SvtValueSet*, void) { std::unique_ptr<GraphicObject> pGraphicObject; - size_t nPos = m_pBitmapLB->GetSelectItemPos(); + size_t nPos = m_xBitmapLB->GetSelectItemPos(); if( nPos != VALUESET_ITEM_NOTFOUND ) { @@ -503,8 +476,8 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ModifyBitmapHdl, ValueSet*, void) if(!pGraphicObject) { - sal_uInt16 nId = m_pBitmapLB->GetItemId(0); - m_pBitmapLB->SelectItem(nId); + sal_uInt16 nId = m_xBitmapLB->GetItemId(0); + m_xBitmapLB->SelectItem(nId); if(0 != nId) { @@ -522,16 +495,16 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ModifyBitmapHdl, ValueSet*, void) rBitmapSize.setWidth( (OutputDevice::LogicToLogic(static_cast<sal_Int32>(aTempBitmapSize.Width()),MapUnit::MapPixel, MapUnit::Map100thMM )) / fUIScale ); rBitmapSize.setHeight( (OutputDevice::LogicToLogic(static_cast<sal_Int32>(aTempBitmapSize.Height()),MapUnit::MapPixel, MapUnit::Map100thMM )) / fUIScale ); CalculateBitmapPresetSize(); - ModifyBitmapStyleHdl( *m_pBitmapStyleLB ); - ModifyBitmapPositionHdl( *m_pPositionLB ); + ModifyBitmapStyleHdl( *m_xBitmapStyleLB ); + ModifyBitmapPositionHdl( *m_xPositionLB ); m_rXFSet.ClearItem(); m_rXFSet.Put(XFillStyleItem(drawing::FillStyle_BITMAP)); m_rXFSet.Put(XFillBitmapItem(OUString(), *pGraphicObject)); - m_pCtlBitmapPreview->SetAttributes( m_aXFillAttr.GetItemSet() ); - m_pCtlBitmapPreview->Invalidate(); + m_aCtlBitmapPreview.SetAttributes( m_aXFillAttr.GetItemSet() ); + m_aCtlBitmapPreview.Invalidate(); } else { @@ -540,10 +513,10 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ModifyBitmapHdl, ValueSet*, void) } -IMPL_LINK_NOARG(SvxBitmapTabPage, ClickRenameHdl, SvxPresetListBox*, void) +IMPL_LINK_NOARG(SvxBitmapTabPage, ClickRenameHdl, PresetListBox*, void) { - sal_uInt16 nId = m_pBitmapLB->GetSelectedItemId(); - size_t nPos = m_pBitmapLB->GetSelectItemPos(); + sal_uInt16 nId = m_xBitmapLB->GetSelectedItemId(); + size_t nPos = m_xBitmapLB->GetSelectItemPos(); if( nPos != VALUESET_ITEM_NOTFOUND ) { @@ -551,7 +524,7 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ClickRenameHdl, SvxPresetListBox*, void) OUString aName( m_pBitmapList->GetBitmap( nPos )->GetName() ); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - ScopedVclPtr<AbstractSvxNameDialog> pDlg(pFact->CreateSvxNameDialog(GetFrameWeld(), aName, aDesc)); + ScopedVclPtr<AbstractSvxNameDialog> pDlg(pFact->CreateSvxNameDialog(GetTabDialog()->GetFrameWeld(), aName, aDesc)); bool bLoop = true; while( bLoop && pDlg->Execute() == RET_OK ) @@ -565,14 +538,14 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ClickRenameHdl, SvxPresetListBox*, void) bLoop = false; m_pBitmapList->GetBitmap(nPos)->SetName(aName); - m_pBitmapLB->SetItemText(nId, aName); - m_pBitmapLB->SelectItem( nId ); + m_xBitmapLB->SetItemText(nId, aName); + m_xBitmapLB->SelectItem( nId ); *m_pnBitmapListState |= ChangeType::MODIFIED; } else { - std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "cui/ui/queryduplicatedialog.ui")); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetTabDialog()->GetFrameWeld(), "cui/ui/queryduplicatedialog.ui")); std::unique_ptr<weld::MessageDialog> xBox(xBuilder->weld_message_dialog("DuplicateNameDialog")); xBox->run(); } @@ -580,91 +553,86 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ClickRenameHdl, SvxPresetListBox*, void) } } -IMPL_LINK_NOARG(SvxBitmapTabPage, ClickDeleteHdl, SvxPresetListBox*, void) +IMPL_LINK_NOARG(SvxBitmapTabPage, ClickDeleteHdl, PresetListBox*, void) { - sal_uInt16 nId = m_pBitmapLB->GetSelectedItemId(); - size_t nPos = m_pBitmapLB->GetSelectItemPos(); + sal_uInt16 nId = m_xBitmapLB->GetSelectedItemId(); + size_t nPos = m_xBitmapLB->GetSelectItemPos(); if( nPos != VALUESET_ITEM_NOTFOUND ) { - std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "cui/ui/querydeletebitmapdialog.ui")); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetTabDialog()->GetFrameWeld(), "cui/ui/querydeletebitmapdialog.ui")); std::unique_ptr<weld::MessageDialog> xQueryBox(xBuilder->weld_message_dialog("AskDelBitmapDialog")); if (xQueryBox->run() == RET_YES) { m_pBitmapList->Remove( static_cast<sal_uInt16>(nPos) ); - m_pBitmapLB->RemoveItem( nId ); - nId = m_pBitmapLB->GetItemId(0); - m_pBitmapLB->SelectItem( nId ); + m_xBitmapLB->RemoveItem( nId ); + nId = m_xBitmapLB->GetItemId(0); + m_xBitmapLB->SelectItem( nId ); - m_pCtlBitmapPreview->Invalidate(); - ModifyBitmapHdl( m_pBitmapLB ); + m_aCtlBitmapPreview.Invalidate(); + ModifyBitmapHdl(m_xBitmapLB.get()); *m_pnBitmapListState |= ChangeType::MODIFIED; } } } -IMPL_LINK_NOARG( SvxBitmapTabPage, ModifyBitmapSizeHdl, Edit&, void ) +IMPL_LINK_NOARG( SvxBitmapTabPage, ModifyBitmapSizeHdl, weld::MetricSpinButton&, void ) { m_bLogicalSize = false; - if( m_pTsbScale->GetState() != TRISTATE_TRUE && static_cast<BitmapStyle>(m_pBitmapStyleLB->GetSelectedEntryPos()) != TILED ) + if (m_xTsbScale->get_state() != TRISTATE_TRUE && static_cast<BitmapStyle>(m_xBitmapStyleLB->get_active()) != TILED) { - sal_Int64 nWidthPercent = m_pBitmapWidth->Denormalize( m_pBitmapWidth->GetValue() ); - sal_Int64 nHeightPercent = m_pBitmapHeight->Denormalize( m_pBitmapHeight->GetValue() ); - if( nWidthPercent == 100 && nHeightPercent == 100 ) - m_pBitmapStyleLB->SelectEntryPos( static_cast<sal_Int32>(CUSTOM) ); + sal_Int64 nWidthPercent = m_xBitmapWidth->denormalize(m_xBitmapWidth->get_value(FUNIT_NONE)); + sal_Int64 nHeightPercent = m_xBitmapHeight->denormalize(m_xBitmapHeight->get_value(FUNIT_NONE)); + if (nWidthPercent == 100 && nHeightPercent == 100) + m_xBitmapStyleLB->set_active(static_cast<sal_Int32>(CUSTOM)); } - ModifyBitmapStyleHdl(*m_pBitmapStyleLB); + ModifyBitmapStyleHdl(*m_xBitmapStyleLB); - m_pCtlBitmapPreview->SetAttributes( m_aXFillAttr.GetItemSet() ); - m_pCtlBitmapPreview->Invalidate(); + m_aCtlBitmapPreview.SetAttributes( m_aXFillAttr.GetItemSet() ); + m_aCtlBitmapPreview.Invalidate(); } -IMPL_LINK_NOARG( SvxBitmapTabPage, ClickScaleHdl, Button*, void ) +IMPL_LINK_NOARG( SvxBitmapTabPage, ClickScaleHdl, weld::Button&, void ) { - if( m_pTsbScale->GetState() == TRISTATE_TRUE ) + if (m_xTsbScale->get_state() == TRISTATE_TRUE) { - m_pBitmapWidth->SetDecimalDigits( 0 ); - m_pBitmapWidth->SetUnit(FUNIT_PERCENT); - m_pBitmapWidth->SetValue( 100 ); - m_pBitmapWidth->SetMax( 100 ); - m_pBitmapWidth->SetLast( 100 ); - - m_pBitmapHeight->SetDecimalDigits( 0 ); - m_pBitmapHeight->SetUnit(FUNIT_PERCENT); - m_pBitmapHeight->SetValue( 100 ); - m_pBitmapHeight->SetMax( 100 ); - m_pBitmapHeight->SetLast( 100 ); + m_xBitmapWidth->set_digits( 0 ); + m_xBitmapWidth->set_unit(FUNIT_PERCENT); + m_xBitmapWidth->set_value(100, FUNIT_NONE); + m_xBitmapWidth->set_range(0, 100, FUNIT_NONE); + + m_xBitmapHeight->set_digits( 0 ); + m_xBitmapHeight->set_unit(FUNIT_PERCENT); + m_xBitmapHeight->set_value(100, FUNIT_NONE); + m_xBitmapHeight->set_range(0, 100, FUNIT_NONE); } else { - m_pBitmapWidth->SetDecimalDigits( 2 ); - m_pBitmapWidth->SetUnit( meFieldUnit ); - m_pBitmapWidth->SetValue( 100 ); - m_pBitmapWidth->SetMax( 999900 ); - m_pBitmapWidth->SetLast( 100000 ); - - m_pBitmapHeight->SetDecimalDigits( 2 ); - m_pBitmapHeight->SetDecimalDigits( 2 ); - m_pBitmapHeight->SetUnit( meFieldUnit ); - m_pBitmapHeight->SetValue( 100 ); - m_pBitmapHeight->SetMax( 999900 ); - m_pBitmapHeight->SetLast( 100000 ); + m_xBitmapWidth->set_digits( 2 ); + m_xBitmapWidth->set_unit(meFieldUnit); + m_xBitmapWidth->set_value(100, FUNIT_NONE); + m_xBitmapWidth->set_range(0, 999900, FUNIT_NONE); + + m_xBitmapHeight->set_digits( 2 ); + m_xBitmapHeight->set_unit(meFieldUnit); + m_xBitmapHeight->set_value(100, FUNIT_NONE); + m_xBitmapHeight->set_range(0, 999900, FUNIT_NONE); } - ModifyBitmapStyleHdl( *m_pBitmapStyleLB ); + ModifyBitmapStyleHdl( *m_xBitmapStyleLB ); } -IMPL_LINK_NOARG( SvxBitmapTabPage, ModifyBitmapStyleHdl, ListBox&, void ) +IMPL_LINK_NOARG( SvxBitmapTabPage, ModifyBitmapStyleHdl, weld::ComboBoxText&, void ) { - BitmapStyle eStylePos = static_cast<BitmapStyle>(m_pBitmapStyleLB->GetSelectedEntryPos()); + BitmapStyle eStylePos = static_cast<BitmapStyle>(m_xBitmapStyleLB->get_active()); bool bIsStretched( eStylePos == STRETCHED ); bool bIsTiled( eStylePos == TILED ); - m_pSizeBox->Enable( !bIsStretched ); - m_pPositionBox->Enable( !bIsStretched ); - m_pPositionOffBox->Enable( bIsTiled ); - m_pTileOffBox->Enable( bIsTiled ); + m_xSizeBox->set_sensitive( !bIsStretched ); + m_xPositionBox->set_sensitive( !bIsStretched ); + m_xPositionOffBox->set_sensitive( bIsTiled ); + m_xTileOffBox->set_sensitive( bIsTiled ); m_rXFSet.Put( XFillBmpTileItem( bIsTiled ) ); m_rXFSet.Put( XFillBmpStretchItem( bIsStretched ) ); @@ -677,15 +645,15 @@ IMPL_LINK_NOARG( SvxBitmapTabPage, ModifyBitmapStyleHdl, ListBox&, void ) case CUSTOM: case TILED: { - if(m_pTsbScale->IsEnabled() && m_pTsbScale->GetState() == TRISTATE_TRUE) + if (m_xTsbScale->get_sensitive() && m_xTsbScale->get_state() == TRISTATE_TRUE) { - aSetBitmapSize.setWidth( -m_pBitmapWidth->GetValue() ); - aSetBitmapSize.setHeight( -m_pBitmapWidth->GetValue() ); + aSetBitmapSize.setWidth(-m_xBitmapWidth->get_value(FUNIT_NONE)); + aSetBitmapSize.setHeight(-m_xBitmapWidth->get_value(FUNIT_NONE)); } else { - aSetBitmapSize.setWidth( GetCoreValue( *m_pBitmapWidth, mePoolUnit ) ); - aSetBitmapSize.setHeight( GetCoreValue( *m_pBitmapHeight, mePoolUnit ) ); + aSetBitmapSize.setWidth( GetCoreValue( *m_xBitmapWidth, mePoolUnit ) ); + aSetBitmapSize.setHeight( GetCoreValue( *m_xBitmapHeight, mePoolUnit ) ); } } break; @@ -697,52 +665,52 @@ IMPL_LINK_NOARG( SvxBitmapTabPage, ModifyBitmapStyleHdl, ListBox&, void ) m_rXFSet.Put( XFillBmpSizeYItem( aSetBitmapSize.Height() ) ); } - m_pCtlBitmapPreview->SetAttributes( m_aXFillAttr.GetItemSet() ); - m_pCtlBitmapPreview->Invalidate(); + m_aCtlBitmapPreview.SetAttributes( m_aXFillAttr.GetItemSet() ); + m_aCtlBitmapPreview.Invalidate(); } -IMPL_LINK_NOARG(SvxBitmapTabPage, ModifyBitmapPositionHdl, ListBox&, void) +IMPL_LINK_NOARG(SvxBitmapTabPage, ModifyBitmapPositionHdl, weld::ComboBoxText&, void) { - if(m_pPositionLB->IsEnabled()) - m_rXFSet.Put( XFillBmpPosItem( static_cast< RectPoint >( m_pPositionLB->GetSelectedEntryPos() ) ) ); + if (m_xPositionLB->get_sensitive()) + m_rXFSet.Put( XFillBmpPosItem( static_cast< RectPoint >( m_xPositionLB->get_active() ) ) ); - m_pCtlBitmapPreview->SetAttributes( m_aXFillAttr.GetItemSet() ); - m_pCtlBitmapPreview->Invalidate(); + m_aCtlBitmapPreview.SetAttributes( m_aXFillAttr.GetItemSet() ); + m_aCtlBitmapPreview.Invalidate(); } -IMPL_LINK_NOARG(SvxBitmapTabPage, ModifyPositionOffsetHdl, Edit&, void) +IMPL_LINK_NOARG(SvxBitmapTabPage, ModifyPositionOffsetHdl, weld::MetricSpinButton&, void) { - if(m_pPositionOffX->IsEnabled()) - m_rXFSet.Put( XFillBmpPosOffsetXItem( m_pPositionOffX->GetValue() ) ); + if (m_xPositionOffX->get_sensitive()) + m_rXFSet.Put( XFillBmpPosOffsetXItem( m_xPositionOffX->get_value(FUNIT_PERCENT) ) ); - if(m_pPositionOffY->IsEnabled()) - m_rXFSet.Put( XFillBmpPosOffsetYItem( m_pPositionOffY->GetValue() ) ); + if (m_xPositionOffY->get_sensitive()) + m_rXFSet.Put( XFillBmpPosOffsetYItem( m_xPositionOffY->get_value(FUNIT_PERCENT) ) ); - m_pCtlBitmapPreview->SetAttributes( m_aXFillAttr.GetItemSet() ); - m_pCtlBitmapPreview->Invalidate(); + m_aCtlBitmapPreview.SetAttributes( m_aXFillAttr.GetItemSet() ); + m_aCtlBitmapPreview.Invalidate(); } -IMPL_LINK_NOARG(SvxBitmapTabPage, ModifyTileOffsetHdl, Edit&, void) +IMPL_LINK_NOARG(SvxBitmapTabPage, ModifyTileOffsetHdl, weld::MetricSpinButton&, void) { sal_uInt16 nTileXOff = 0; sal_uInt16 nTileYOff = 0; - if(m_pTileOffLB->GetSelectedEntryPos() == static_cast<sal_Int32>(ROW)) - nTileXOff = m_pTileOffset->GetValue(); + if(m_xTileOffLB->get_active() == static_cast<sal_Int32>(ROW)) + nTileXOff = m_xTileOffset->get_value(FUNIT_PERCENT); - if(m_pTileOffLB->GetSelectedEntryPos() == static_cast<sal_Int32>(COLUMN)) - nTileYOff = m_pTileOffset->GetValue(); + if(m_xTileOffLB->get_active() == static_cast<sal_Int32>(COLUMN)) + nTileYOff = m_xTileOffset->get_value(FUNIT_PERCENT); m_rXFSet.Put( XFillBmpTileOffsetXItem(nTileXOff) ); m_rXFSet.Put( XFillBmpTileOffsetYItem(nTileYOff) ); - m_pCtlBitmapPreview->SetAttributes( m_aXFillAttr.GetItemSet() ); - m_pCtlBitmapPreview->Invalidate(); + m_aCtlBitmapPreview.SetAttributes( m_aXFillAttr.GetItemSet() ); + m_aCtlBitmapPreview.Invalidate(); } -IMPL_LINK_NOARG(SvxBitmapTabPage, ClickImportHdl, Button*, void) +IMPL_LINK_NOARG(SvxBitmapTabPage, ClickImportHdl, weld::Button&, void) { - SvxOpenGraphicDialog aDlg("Import", GetFrameWeld()); + SvxOpenGraphicDialog aDlg("Import", GetTabDialog()->GetFrameWeld()); aDlg.EnableLink(false); long nCount = m_pBitmapList->Count(); @@ -762,7 +730,7 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ClickImportHdl, Button*, void) OUString aName; INetURLObject aURL( aDlg.GetPath() ); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - ScopedVclPtr<AbstractSvxNameDialog> pDlg(pFact->CreateSvxNameDialog(GetFrameWeld(), aURL.GetName().getToken(0, '.'), aDesc)); + ScopedVclPtr<AbstractSvxNameDialog> pDlg(pFact->CreateSvxNameDialog(GetTabDialog()->GetFrameWeld(), aURL.GetName().getToken(0, '.'), aDesc)); nError = ErrCode(1); while( pDlg->Execute() == RET_OK ) @@ -780,7 +748,7 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ClickImportHdl, Button*, void) break; } - std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "cui/ui/queryduplicatedialog.ui")); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetTabDialog()->GetFrameWeld(), "cui/ui/queryduplicatedialog.ui")); std::unique_ptr<weld::MessageDialog> xBox(xBuilder->weld_message_dialog("DuplicateNameDialog")); if (xBox->run() != RET_OK) break; @@ -792,20 +760,20 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ClickImportHdl, Button*, void) { m_pBitmapList->Insert(o3tl::make_unique<XBitmapEntry>(aGraphic, aName), nCount); - sal_Int32 nId = m_pBitmapLB->GetItemId( nCount - 1 ); - BitmapEx aBitmap = m_pBitmapList->GetBitmapForPreview( nCount, m_pBitmapLB->GetIconSize() ); + sal_Int32 nId = m_xBitmapLB->GetItemId( nCount - 1 ); + BitmapEx aBitmap = m_pBitmapList->GetBitmapForPreview( nCount, m_xBitmapLB->GetIconSize() ); - m_pBitmapLB->InsertItem( nId + 1, Image(aBitmap), aName ); - m_pBitmapLB->SelectItem( nId + 1 ); + m_xBitmapLB->InsertItem( nId + 1, Image(aBitmap), aName ); + m_xBitmapLB->SelectItem( nId + 1 ); *m_pnBitmapListState |= ChangeType::MODIFIED; - ModifyBitmapHdl( m_pBitmapLB ); + ModifyBitmapHdl(m_xBitmapLB.get()); } } else { // graphic couldn't be loaded - std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "cui/ui/querynoloadedfiledialog.ui")); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetTabDialog()->GetFrameWeld(), "cui/ui/querynoloadedfiledialog.ui")); std::unique_ptr<weld::MessageDialog> xBox(xBuilder->weld_message_dialog("NoLoadedFileDialog")); xBox->run(); } diff --git a/cui/source/tabpages/tpcolor.cxx b/cui/source/tabpages/tpcolor.cxx index 401c7f3d27d9..857bd6391276 100644 --- a/cui/source/tabpages/tpcolor.cxx +++ b/cui/source/tabpages/tpcolor.cxx @@ -341,7 +341,7 @@ IMPL_LINK_NOARG(SvxColorTabPage, ClickAddHdl_Impl, weld::Button&, void) } SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - ScopedVclPtr<AbstractSvxNameDialog> pDlg(pFact->CreateSvxNameDialog(GetFrameWeld(), aName, aDesc)); + ScopedVclPtr<AbstractSvxNameDialog> pDlg(pFact->CreateSvxNameDialog(GetTabDialog()->GetFrameWeld(), aName, aDesc)); sal_uInt16 nError = 1; while (pDlg->Execute() == RET_OK) @@ -355,7 +355,7 @@ IMPL_LINK_NOARG(SvxColorTabPage, ClickAddHdl_Impl, weld::Button&, void) break; } - std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "cui/ui/queryduplicatedialog.ui")); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetTabDialog()->GetFrameWeld(), "cui/ui/queryduplicatedialog.ui")); std::unique_ptr<weld::MessageDialog> xWarnBox(xBuilder->weld_message_dialog("DuplicateNameDialog")); if (xWarnBox->run() != RET_OK) break; @@ -395,7 +395,7 @@ IMPL_LINK_NOARG(SvxColorTabPage, ClickWorkOnHdl_Impl, weld::Button&, void) aColorDlg.SetColor (aCurrentColor); aColorDlg.SetMode( svtools::ColorPickerMode::Modify ); - if (aColorDlg.Execute(GetFrameWeld()) == RET_OK) + if (aColorDlg.Execute(GetTabDialog()->GetFrameWeld()) == RET_OK) { Color aPreviewColor = aColorDlg.GetColor(); aCurrentColor = aPreviewColor; diff --git a/cui/source/tabpages/tpgradnt.cxx b/cui/source/tabpages/tpgradnt.cxx index 8e3e9d3d579a..9e9c4342561f 100644 --- a/cui/source/tabpages/tpgradnt.cxx +++ b/cui/source/tabpages/tpgradnt.cxx @@ -49,87 +49,76 @@ using namespace com::sun::star; -SvxGradientTabPage::SvxGradientTabPage -( - vcl::Window* pParent, - const SfxItemSet& rInAttrs -) : - SfxTabPage ( pParent, "GradientPage", "cui/ui/gradientpage.ui", &rInAttrs ), - - m_rOutAttrs ( rInAttrs ), - m_pnGradientListState ( nullptr ), - m_pnColorListState ( nullptr ), - m_aXFillAttr ( rInAttrs.GetPool() ), - m_rXFSet ( m_aXFillAttr.GetItemSet() ) +SvxGradientTabPage::SvxGradientTabPage(TabPageParent pParent, const SfxItemSet& rInAttrs) + : SfxTabPage(pParent, "cui/ui/gradientpage.ui", "GradientPage", &rInAttrs) + , m_rOutAttrs(rInAttrs) + , m_pnGradientListState(nullptr) + , m_pnColorListState(nullptr) + , m_aXFillAttr(rInAttrs.GetPool()) + , m_rXFSet(m_aXFillAttr.GetItemSet()) + , m_xLbGradientType(m_xBuilder->weld_combo_box_text("gradienttypelb")) + , m_xFtCenter(m_xBuilder->weld_label("centerft")) + , m_xMtrCenterX(m_xBuilder->weld_metric_spin_button("centerxmtr", FUNIT_PERCENT)) + , m_xMtrCenterY(m_xBuilder->weld_metric_spin_button("centerymtr", FUNIT_PERCENT)) + , m_xFtAngle(m_xBuilder->weld_label("angleft")) + , m_xMtrAngle(m_xBuilder->weld_metric_spin_button("anglemtr", FUNIT_DEGREE)) + , m_xMtrBorder(m_xBuilder->weld_metric_spin_button("bordermtr", FUNIT_PERCENT)) + , m_xSliderBorder(m_xBuilder->weld_scale("borderslider")) + , m_xLbColorFrom(new ColorListBox(m_xBuilder->weld_menu_button("colorfromlb"), GetFrameWeld())) + , m_xMtrColorFrom(m_xBuilder->weld_metric_spin_button("colorfrommtr", FUNIT_PERCENT)) + , m_xLbColorTo(new ColorListBox(m_xBuilder->weld_menu_button("colortolb"), GetFrameWeld())) + , m_xMtrColorTo(m_xBuilder->weld_metric_spin_button("colortomtr", FUNIT_PERCENT)) + , m_xGradientLB(new PresetListBox(m_xBuilder->weld_scrolled_window("gradientpresetlistwin"))) + , m_xMtrIncrement(m_xBuilder->weld_spin_button("incrementmtr")) + , m_xCbIncrement(m_xBuilder->weld_check_button("autoincrement")) + , m_xSliderIncrement(m_xBuilder->weld_scale("incrementslider")) + , m_xBtnAdd(m_xBuilder->weld_button("add")) + , m_xBtnModify(m_xBuilder->weld_button("modify")) + , m_xCtlPreview(new weld::CustomWeld(*m_xBuilder, "previewctl", m_aCtlPreview)) + , m_xGradientLBWin(new weld::CustomWeld(*m_xBuilder, "gradientpresetlist", *m_xGradientLB)) { - get(m_pCbIncrement, "autoincrement"); - get(m_pMtrIncrement, "incrementmtr"); - get(m_pSliderIncrement,"incrementslider"); - get(m_pLbGradientType, "gradienttypelb"); - get(m_pFtCenter, "centerft"); - get(m_pMtrCenterX, "centerxmtr"); - get(m_pMtrCenterY, "centerymtr"); - get(m_pFtAngle, "angleft"); - get(m_pMtrAngle, "anglemtr"); - get(m_pMtrBorder, "bordermtr"); - get(m_pSliderBorder, "borderslider"); - get(m_pLbColorFrom, "colorfromlb"); - get(m_pMtrColorFrom, "colorfrommtr"); - get(m_pLbColorTo, "colortolb"); - get(m_pMtrColorTo, "colortomtr"); - get(m_pGradientLB, "gradientpresetlist"); - get(m_pCtlPreview, "previewctl"); Size aSize = getDrawPreviewOptimalSize(this); - m_pGradientLB->set_width_request(aSize.Width()); - m_pGradientLB->set_height_request(aSize.Height()); - m_pCtlPreview->set_width_request(aSize.Width()); - m_pCtlPreview->set_height_request(aSize.Height()); - get(m_pBtnAdd, "add"); - get(m_pBtnModify, "modify"); + m_xGradientLB->set_size_request(aSize.Width(), aSize.Height()); + m_xCtlPreview->set_size_request(aSize.Width(), aSize.Height()); // this page needs ExchangeSupport SetExchangeSupport(); // as long as NOT supported by the item - m_pSliderIncrement->SetRange(Range(3,256)); - m_pMtrColorTo->SetValue( 100 ); - m_pMtrColorFrom->SetValue( 100 ); - m_pSliderBorder->SetRange(Range(0,100)); + m_xMtrColorTo->set_value(100, FUNIT_PERCENT); + m_xMtrColorFrom->set_value(100, FUNIT_PERCENT); // setting the output device m_rXFSet.Put( XFillStyleItem(drawing::FillStyle_GRADIENT) ); m_rXFSet.Put( XFillGradientItem(OUString(), XGradient( COL_BLACK, COL_WHITE )) ); - m_pCtlPreview->SetAttributes( m_aXFillAttr.GetItemSet() ); + m_aCtlPreview.SetAttributes(m_aXFillAttr.GetItemSet()); // set handler - m_pGradientLB->SetSelectHdl( LINK( this, SvxGradientTabPage, ChangeGradientHdl ) ); - m_pGradientLB->SetRenameHdl( LINK( this, SvxGradientTabPage, ClickRenameHdl_Impl ) ); - m_pGradientLB->SetDeleteHdl( LINK( this, SvxGradientTabPage, ClickDeleteHdl_Impl ) ); - m_pBtnAdd->SetClickHdl( LINK( this, SvxGradientTabPage, ClickAddHdl_Impl ) ); - m_pBtnModify->SetClickHdl( - LINK( this, SvxGradientTabPage, ClickModifyHdl_Impl ) ); - - Link<Edit&,void> aLink = LINK( this, SvxGradientTabPage, ModifiedEditHdl_Impl ); - Link<ListBox&,void> aLink2 = LINK( this, SvxGradientTabPage, ModifiedListBoxHdl_Impl ); - m_pLbGradientType->SetSelectHdl( aLink2 ); - m_pCbIncrement->SetToggleHdl( LINK( this, SvxGradientTabPage, ChangeAutoStepHdl_Impl ) ); - m_pMtrIncrement->SetModifyHdl( aLink ); - m_pSliderIncrement->SetSlideHdl( LINK( this, SvxGradientTabPage, ModifiedSliderHdl_Impl ) ); - m_pMtrCenterX->SetModifyHdl( aLink ); - m_pMtrCenterY->SetModifyHdl( aLink ); - m_pMtrAngle->SetModifyHdl( aLink ); - 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_pMtrColorTo->SetModifyHdl( aLink ); - m_pLbColorTo->SetSelectHdl( aLink3 ); + m_xGradientLB->SetSelectHdl( LINK( this, SvxGradientTabPage, ChangeGradientHdl ) ); + m_xGradientLB->SetRenameHdl( LINK( this, SvxGradientTabPage, ClickRenameHdl_Impl ) ); + m_xGradientLB->SetDeleteHdl( LINK( this, SvxGradientTabPage, ClickDeleteHdl_Impl ) ); + m_xBtnAdd->connect_clicked(LINK(this, SvxGradientTabPage, ClickAddHdl_Impl)); + m_xBtnModify->connect_clicked(LINK(this, SvxGradientTabPage, ClickModifyHdl_Impl)); + + Link<weld::MetricSpinButton&,void> aLink = LINK( this, SvxGradientTabPage, ModifiedMetricHdl_Impl ); + Link<weld::ComboBoxText&,void> aLink2 = LINK( this, SvxGradientTabPage, ModifiedListBoxHdl_Impl ); + m_xLbGradientType->connect_changed( aLink2 ); + m_xCbIncrement->connect_toggled(LINK(this, SvxGradientTabPage, ChangeAutoStepHdl_Impl)); + m_xMtrIncrement->connect_value_changed(LINK(this, SvxGradientTabPage, ModifiedEditHdl_Impl)); + m_xSliderIncrement->connect_value_changed(LINK(this, SvxGradientTabPage, ModifiedSliderHdl_Impl)); + m_xMtrCenterX->connect_value_changed( aLink ); + m_xMtrCenterY->connect_value_changed( aLink ); + m_xMtrAngle->connect_value_changed( aLink ); + m_xMtrBorder->connect_value_changed( aLink ); + m_xSliderBorder->connect_value_changed(LINK(this, SvxGradientTabPage, ModifiedSliderHdl_Impl)); + m_xMtrColorFrom->connect_value_changed( aLink ); + Link<ColorListBox&,void> aLink3 = LINK( this, SvxGradientTabPage, ModifiedColorListBoxHdl_Impl ); + m_xLbColorFrom->SetSelectHdl( aLink3 ); + m_xMtrColorTo->connect_value_changed( aLink ); + m_xLbColorTo->SetSelectHdl( aLink3 ); // #i76307# always paint the preview in LTR, because this is what the document does - m_pCtlPreview->EnableRTL( false ); - - setPreviewsToSamePlace(pParent, this); + m_aCtlPreview.EnableRTL(false); } SvxGradientTabPage::~SvxGradientTabPage() @@ -139,31 +128,17 @@ SvxGradientTabPage::~SvxGradientTabPage() void SvxGradientTabPage::dispose() { - m_pCbIncrement.clear(); - m_pMtrIncrement.clear(); - m_pSliderIncrement.clear(); - m_pLbGradientType.clear(); - m_pFtCenter.clear(); - m_pMtrCenterX.clear(); - m_pMtrCenterY.clear(); - m_pFtAngle.clear(); - m_pMtrAngle.clear(); - m_pMtrBorder.clear(); - m_pSliderBorder.clear(); - m_pLbColorFrom.clear(); - m_pMtrColorFrom.clear(); - m_pLbColorTo.clear(); - m_pMtrColorTo.clear(); - m_pGradientLB.clear(); - m_pCtlPreview.clear(); - m_pBtnAdd.clear(); - m_pBtnModify.clear(); + m_xCtlPreview.reset(); + m_xGradientLBWin.reset(); + m_xGradientLB.reset(); + m_xLbColorTo.reset(); + m_xLbColorFrom.reset(); SfxTabPage::dispose(); } void SvxGradientTabPage::Construct() { - m_pGradientLB->FillPresetListBox( *m_pGradientList ); + m_xGradientLB->FillPresetListBox( *m_pGradientList ); } void SvxGradientTabPage::ActivatePage( const SfxItemSet& rSet ) @@ -201,8 +176,8 @@ void SvxGradientTabPage::ActivatePage( const SfxItemSet& rSet ) sal_Int32 nPos = SearchGradientList( rSet.Get(XATTR_FILLGRADIENT).GetName() ); if ( nPos != LISTBOX_ENTRY_NOTFOUND ) { - sal_uInt16 nId = m_pGradientLB->GetItemId( static_cast<size_t>( nPos ) ); - m_pGradientLB->SelectItem( nId ); + sal_uInt16 nId = m_xGradientLB->GetItemId( static_cast<size_t>( nPos ) ); + m_xGradientLB->SelectItem( nId ); } // colors could have been deleted ChangeGradientHdl_Impl(); @@ -222,31 +197,31 @@ bool SvxGradientTabPage::FillItemSet( SfxItemSet* rSet ) { std::unique_ptr<XGradient> pXGradient; OUString aString; - size_t nPos = m_pGradientLB->IsNoSelection() ? VALUESET_ITEM_NOTFOUND : m_pGradientLB->GetSelectItemPos(); + size_t nPos = m_xGradientLB->IsNoSelection() ? VALUESET_ITEM_NOTFOUND : m_xGradientLB->GetSelectItemPos(); if( nPos != VALUESET_ITEM_NOTFOUND ) { pXGradient.reset(new XGradient( m_pGradientList->GetGradient( static_cast<sal_uInt16>(nPos) )->GetGradient() )); - aString = m_pGradientLB->GetItemText( m_pGradientLB->GetSelectedItemId() ); + aString = m_xGradientLB->GetItemText( m_xGradientLB->GetSelectedItemId() ); } else // gradient was passed (unidentified) { aString = "gradient"; - pXGradient.reset(new XGradient( m_pLbColorFrom->GetSelectEntryColor(), - m_pLbColorTo->GetSelectEntryColor(), - static_cast<css::awt::GradientStyle>(m_pLbGradientType->GetSelectedEntryPos()), - static_cast<long>(m_pMtrAngle->GetValue() * 10), // should be changed in resource - static_cast<sal_uInt16>(m_pMtrCenterX->GetValue()), - static_cast<sal_uInt16>(m_pMtrCenterY->GetValue()), - static_cast<sal_uInt16>(m_pMtrBorder->GetValue()), - static_cast<sal_uInt16>(m_pMtrColorFrom->GetValue()), - static_cast<sal_uInt16>(m_pMtrColorTo->GetValue()), - static_cast<sal_uInt16>(m_pMtrIncrement->GetValue()) )); + pXGradient.reset(new XGradient( m_xLbColorFrom->GetSelectEntryColor(), + m_xLbColorTo->GetSelectEntryColor(), + static_cast<css::awt::GradientStyle>(m_xLbGradientType->get_active()), + static_cast<long>(m_xMtrAngle->get_value(FUNIT_NONE) * 10), // should be changed in resource + static_cast<sal_uInt16>(m_xMtrCenterX->get_value(FUNIT_NONE)), + static_cast<sal_uInt16>(m_xMtrCenterY->get_value(FUNIT_NONE)), + static_cast<sal_uInt16>(m_xMtrBorder->get_value(FUNIT_NONE)), + static_cast<sal_uInt16>(m_xMtrColorFrom->get_value(FUNIT_NONE)), + static_cast<sal_uInt16>(m_xMtrColorTo->get_value(FUNIT_NONE)), + static_cast<sal_uInt16>(m_xMtrIncrement->get_value()) )); } sal_uInt16 nValue = 0; - if( !m_pCbIncrement->IsChecked() ) - nValue = m_pMtrIncrement->GetValue(); + if (!m_xCbIncrement->get_active()) + nValue = m_xMtrIncrement->get_value(); assert( pXGradient && "XGradient could not be created" ); rSet->Put( XFillStyleItem( drawing::FillStyle_GRADIENT ) ); @@ -255,109 +230,111 @@ bool SvxGradientTabPage::FillItemSet( SfxItemSet* rSet ) return true; } - void SvxGradientTabPage::Reset( const SfxItemSet* ) { - m_pMtrIncrement->SetValue(DEFAULT_GRADIENTSTEP); - m_pSliderIncrement->SetThumbPos(DEFAULT_GRADIENTSTEP); + m_xMtrIncrement->set_value(DEFAULT_GRADIENTSTEP); + m_xSliderIncrement->set_value(DEFAULT_GRADIENTSTEP); ChangeGradientHdl_Impl(); // determine state of the buttons if( m_pGradientList->Count() ) - m_pBtnModify->Enable(); + m_xBtnModify->set_sensitive(true); else - m_pBtnModify->Disable(); + m_xBtnModify->set_sensitive(false); } - VclPtr<SfxTabPage> SvxGradientTabPage::Create( TabPageParent pWindow, const SfxItemSet* rOutAttrs ) { - return VclPtr<SvxGradientTabPage>::Create( pWindow.pParent, *rOutAttrs ); + return VclPtr<SvxGradientTabPage>::Create(pWindow, *rOutAttrs); } -IMPL_LINK( SvxGradientTabPage, ModifiedListBoxHdl_Impl, ListBox&, rListBox, void ) +IMPL_LINK( SvxGradientTabPage, ModifiedListBoxHdl_Impl, weld::ComboBoxText&, rListBox, void ) { ModifiedHdl_Impl(&rListBox); // gradient params changed, it is no longer one of the presets - m_pGradientLB->SetNoSelection(); + m_xGradientLB->SetNoSelection(); } -IMPL_LINK( SvxGradientTabPage, ModifiedColorListBoxHdl_Impl, SvxColorListBox&, rListBox, void ) +IMPL_LINK( SvxGradientTabPage, ModifiedColorListBoxHdl_Impl, ColorListBox&, rListBox, void ) { ModifiedHdl_Impl(&rListBox); - m_pGradientLB->SetNoSelection(); + m_xGradientLB->SetNoSelection(); } -IMPL_LINK( SvxGradientTabPage, ModifiedEditHdl_Impl, Edit&, rBox, void ) +IMPL_LINK( SvxGradientTabPage, ModifiedEditHdl_Impl, weld::SpinButton&, rBox, void ) { ModifiedHdl_Impl(&rBox); - m_pGradientLB->SetNoSelection(); + m_xGradientLB->SetNoSelection(); } -IMPL_LINK( SvxGradientTabPage, ModifiedSliderHdl_Impl, Slider*, rSlider, void ) +IMPL_LINK( SvxGradientTabPage, ModifiedMetricHdl_Impl, weld::MetricSpinButton&, rBox, void ) { - ModifiedHdl_Impl(rSlider); - m_pGradientLB->SetNoSelection(); + ModifiedHdl_Impl(&rBox); + m_xGradientLB->SetNoSelection(); } -IMPL_LINK_NOARG( SvxGradientTabPage, ChangeAutoStepHdl_Impl, CheckBox&, void ) +IMPL_LINK( SvxGradientTabPage, ModifiedSliderHdl_Impl, weld::Scale&, rSlider, void ) { - if(m_pCbIncrement->IsChecked()) + ModifiedHdl_Impl(&rSlider); + m_xGradientLB->SetNoSelection(); +} + +IMPL_LINK_NOARG( SvxGradientTabPage, ChangeAutoStepHdl_Impl, weld::ToggleButton&, void ) +{ + if (m_xCbIncrement->get_active()) { - m_pSliderIncrement->Disable(); - m_pMtrIncrement->Disable(); + m_xSliderIncrement->set_sensitive(false); + m_xMtrIncrement->set_sensitive(false); } else { - m_pSliderIncrement->Enable(); - m_pMtrIncrement->Enable(); + m_xSliderIncrement->set_sensitive(true); + m_xMtrIncrement->set_sensitive(true); } - ModifiedHdl_Impl(m_pMtrIncrement); + ModifiedHdl_Impl(m_xMtrIncrement.get()); } void SvxGradientTabPage::ModifiedHdl_Impl( void const * pControl ) { - if( pControl == m_pMtrBorder ) - m_pSliderBorder->SetThumbPos( m_pMtrBorder->GetValue() ); - if( pControl == m_pSliderBorder ) - m_pMtrBorder->SetValue( m_pSliderBorder->GetThumbPos() ); - if( pControl == m_pMtrIncrement ) - m_pSliderIncrement->SetThumbPos( m_pMtrIncrement->GetValue() ); - if(pControl == m_pSliderIncrement) - m_pMtrIncrement->SetValue( m_pSliderIncrement->GetThumbPos() ); - - css::awt::GradientStyle eXGS = static_cast<css::awt::GradientStyle>(m_pLbGradientType->GetSelectedEntryPos()); - - XGradient aXGradient( m_pLbColorFrom->GetSelectEntryColor(), - m_pLbColorTo->GetSelectEntryColor(), + if (pControl == m_xMtrBorder.get()) + m_xSliderBorder->set_value(m_xMtrBorder->get_value(FUNIT_NONE)); + if (pControl == m_xSliderBorder.get()) + m_xMtrBorder->set_value(m_xSliderBorder->get_value(), FUNIT_NONE); + if (pControl == m_xMtrIncrement.get()) + m_xSliderIncrement->set_value(m_xMtrIncrement->get_value()); + if (pControl == m_xSliderIncrement.get()) + m_xMtrIncrement->set_value(m_xSliderIncrement->get_value()); + + css::awt::GradientStyle eXGS = static_cast<css::awt::GradientStyle>(m_xLbGradientType->get_active()); + + XGradient aXGradient( m_xLbColorFrom->GetSelectEntryColor(), + m_xLbColorTo->GetSelectEntryColor(), eXGS, - static_cast<long>(m_pMtrAngle->GetValue() * 10), // should be changed in resource - static_cast<sal_uInt16>(m_pMtrCenterX->GetValue()), - static_cast<sal_uInt16>(m_pMtrCenterY->GetValue()), - static_cast<sal_uInt16>(m_pMtrBorder->GetValue()), - static_cast<sal_uInt16>(m_pMtrColorFrom->GetValue()), - static_cast<sal_uInt16>(m_pMtrColorTo->GetValue()), - static_cast<sal_uInt16>(m_pMtrIncrement->GetValue()) ); + static_cast<long>(m_xMtrAngle->get_value(FUNIT_NONE) * 10), // should be changed in resource + static_cast<sal_uInt16>(m_xMtrCenterX->get_value(FUNIT_NONE)), + static_cast<sal_uInt16>(m_xMtrCenterY->get_value(FUNIT_NONE)), + static_cast<sal_uInt16>(m_xMtrBorder->get_value(FUNIT_NONE)), + static_cast<sal_uInt16>(m_xMtrColorFrom->get_value(FUNIT_NONE)), + static_cast<sal_uInt16>(m_xMtrColorTo->get_value(FUNIT_NONE)), + static_cast<sal_uInt16>(m_xMtrIncrement->get_value()) ); // enable/disable controls - if( pControl == m_pLbGradientType || pControl == this ) + if (pControl == m_xLbGradientType.get() || pControl == this) SetControlState_Impl( eXGS ); sal_uInt16 nValue = 0; - if(!m_pCbIncrement->IsChecked()) - nValue = static_cast<sal_uInt16>(m_pMtrIncrement->GetValue()); + if (!m_xCbIncrement->get_active()) + nValue = static_cast<sal_uInt16>(m_xMtrIncrement->get_value()); m_rXFSet.Put( XGradientStepCountItem( nValue ) ); // displaying in XOutDev m_rXFSet.Put( XFillGradientItem( OUString(), aXGradient ) ); - m_pCtlPreview->SetAttributes( m_aXFillAttr.GetItemSet() ); - - m_pCtlPreview->Invalidate(); + m_aCtlPreview.SetAttributes(m_aXFillAttr.GetItemSet()); + m_aCtlPreview.Invalidate(); } - -IMPL_LINK_NOARG(SvxGradientTabPage, ClickAddHdl_Impl, Button*, void) +IMPL_LINK_NOARG(SvxGradientTabPage, ClickAddHdl_Impl, weld::Button&, void) { OUString aNewName( SvxResId( RID_SVXSTR_GRADIENT ) ); OUString aDesc( CuiResId( RID_SVXSTR_DESC_GRADIENT ) ); @@ -374,7 +351,7 @@ IMPL_LINK_NOARG(SvxGradientTabPage, ClickAddHdl_Impl, Button*, void) } SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - ScopedVclPtr<AbstractSvxNameDialog> pDlg(pFact->CreateSvxNameDialog(GetFrameWeld(), aName, aDesc)); + ScopedVclPtr<AbstractSvxNameDialog> pDlg(pFact->CreateSvxNameDialog(GetTabDialog()->GetFrameWeld(), aName, aDesc)); sal_uInt16 nError = 1; while (pDlg->Execute() == RET_OK) @@ -389,7 +366,7 @@ IMPL_LINK_NOARG(SvxGradientTabPage, ClickAddHdl_Impl, Button*, void) break; } - std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "cui/ui/queryduplicatedialog.ui")); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetTabDialog()->GetFrameWeld(), "cui/ui/queryduplicatedialog.ui")); std::unique_ptr<weld::MessageDialog> xWarnBox(xBuilder->weld_message_dialog("DuplicateNameDialog")); if (xWarnBox->run() != RET_OK) break; @@ -398,24 +375,24 @@ IMPL_LINK_NOARG(SvxGradientTabPage, ClickAddHdl_Impl, Button*, void) if( !nError ) { - XGradient aXGradient( m_pLbColorFrom->GetSelectEntryColor(), - m_pLbColorTo->GetSelectEntryColor(), - static_cast<css::awt::GradientStyle>(m_pLbGradientType->GetSelectedEntryPos()), - static_cast<long>(m_pMtrAngle->GetValue() * 10), // should be changed in resource - static_cast<sal_uInt16>(m_pMtrCenterX->GetValue()), - static_cast<sal_uInt16>(m_pMtrCenterY->GetValue()), - static_cast<sal_uInt16>(m_pMtrBorder->GetValue()), - static_cast<sal_uInt16>(m_pMtrColorFrom->GetValue()), - static_cast<sal_uInt16>(m_pMtrColorTo->GetValue()), - static_cast<sal_uInt16>(m_pMtrIncrement->GetValue()) ); + XGradient aXGradient( m_xLbColorFrom->GetSelectEntryColor(), + m_xLbColorTo->GetSelectEntryColor(), + static_cast<css::awt::GradientStyle>(m_xLbGradientType->get_active()), + static_cast<long>(m_xMtrAngle->get_value(FUNIT_NONE) * 10), // should be changed in resource + static_cast<sal_uInt16>(m_xMtrCenterX->get_value(FUNIT_NONE)), + static_cast<sal_uInt16>(m_xMtrCenterY->get_value(FUNIT_NONE)), + static_cast<sal_uInt16>(m_xMtrBorder->get_value(FUNIT_NONE)), + static_cast<sal_uInt16>(m_xMtrColorFrom->get_value(FUNIT_NONE)), + static_cast<sal_uInt16>(m_xMtrColorTo->get_value(FUNIT_NONE)), + static_cast<sal_uInt16>(m_xMtrIncrement->get_value()) ); m_pGradientList->Insert(o3tl::make_unique<XGradientEntry>(aXGradient, aName), nCount); - sal_Int32 nId = m_pGradientLB->GetItemId(nCount - 1); //calculate the last ID - BitmapEx aBitmap = m_pGradientList->GetBitmapForPreview( nCount, m_pGradientLB->GetIconSize() ); - m_pGradientLB->InsertItem( nId + 1, Image(aBitmap), aName ); - m_pGradientLB->SelectItem( nId + 1 ); - m_pGradientLB->Resize(); + sal_Int32 nId = m_xGradientLB->GetItemId(nCount - 1); //calculate the last ID + BitmapEx aBitmap = m_pGradientList->GetBitmapForPreview( nCount, m_xGradientLB->GetIconSize() ); + m_xGradientLB->InsertItem( nId + 1, Image(aBitmap), aName ); + m_xGradientLB->SelectItem( nId + 1 ); + m_xGradientLB->Resize(); *m_pnGradientListState |= ChangeType::MODIFIED; @@ -423,60 +400,60 @@ IMPL_LINK_NOARG(SvxGradientTabPage, ClickAddHdl_Impl, Button*, void) } // determine button state - if( m_pGradientList->Count() ) - m_pBtnModify->Enable(); + if (m_pGradientList->Count()) + m_xBtnModify->set_sensitive(true); } -IMPL_LINK_NOARG(SvxGradientTabPage, ClickModifyHdl_Impl, Button*, void) +IMPL_LINK_NOARG(SvxGradientTabPage, ClickModifyHdl_Impl, weld::Button&, void) { - sal_uInt16 nId = m_pGradientLB->GetSelectedItemId(); - size_t nPos = m_pGradientLB->GetSelectItemPos(); + sal_uInt16 nId = m_xGradientLB->GetSelectedItemId(); + size_t nPos = m_xGradientLB->GetSelectItemPos(); if ( nPos != VALUESET_ITEM_NOTFOUND ) { OUString aName( m_pGradientList->GetGradient( static_cast<sal_uInt16>(nPos) )->GetName() ); - XGradient aXGradient( m_pLbColorFrom->GetSelectEntryColor(), - m_pLbColorTo->GetSelectEntryColor(), - static_cast<css::awt::GradientStyle>(m_pLbGradientType->GetSelectedEntryPos()), - static_cast<long>(m_pMtrAngle->GetValue() * 10), // should be changed in resource - static_cast<sal_uInt16>(m_pMtrCenterX->GetValue()), - static_cast<sal_uInt16>(m_pMtrCenterY->GetValue()), - static_cast<sal_uInt16>(m_pMtrBorder->GetValue()), - static_cast<sal_uInt16>(m_pMtrColorFrom->GetValue()), - static_cast<sal_uInt16>(m_pMtrColorTo->GetValue()), - static_cast<sal_uInt16>(m_pMtrIncrement->GetValue()) ); + XGradient aXGradient( m_xLbColorFrom->GetSelectEntryColor(), + m_xLbColorTo->GetSelectEntryColor(), + static_cast<css::awt::GradientStyle>(m_xLbGradientType->get_active()), + static_cast<long>(m_xMtrAngle->get_value(FUNIT_NONE) * 10), // should be changed in resource + static_cast<sal_uInt16>(m_xMtrCenterX->get_value(FUNIT_NONE)), + static_cast<sal_uInt16>(m_xMtrCenterY->get_value(FUNIT_NONE)), + static_cast<sal_uInt16>(m_xMtrBorder->get_value(FUNIT_NONE)), + static_cast<sal_uInt16>(m_xMtrColorFrom->get_value(FUNIT_NONE)), + static_cast<sal_uInt16>(m_xMtrColorTo->get_value(FUNIT_NONE)), + static_cast<sal_uInt16>(m_xMtrIncrement->get_value()) ); m_pGradientList->Replace(o3tl::make_unique<XGradientEntry>(aXGradient, aName), nPos); - BitmapEx aBitmap = m_pGradientList->GetBitmapForPreview( static_cast<sal_uInt16>(nPos), m_pGradientLB->GetIconSize() ); - m_pGradientLB->RemoveItem( nId ); - m_pGradientLB->InsertItem( nId, Image(aBitmap), aName, static_cast<sal_uInt16>(nPos) ); - m_pGradientLB->SelectItem( nId ); + BitmapEx aBitmap = m_pGradientList->GetBitmapForPreview( static_cast<sal_uInt16>(nPos), m_xGradientLB->GetIconSize() ); + m_xGradientLB->RemoveItem( nId ); + m_xGradientLB->InsertItem( nId, Image(aBitmap), aName, static_cast<sal_uInt16>(nPos) ); + m_xGradientLB->SelectItem( nId ); *m_pnGradientListState |= ChangeType::MODIFIED; } } -IMPL_LINK_NOARG(SvxGradientTabPage, ClickDeleteHdl_Impl, SvxPresetListBox*, void) +IMPL_LINK_NOARG(SvxGradientTabPage, ClickDeleteHdl_Impl, PresetListBox*, void) { - sal_uInt16 nId = m_pGradientLB->GetSelectedItemId(); - size_t nPos = m_pGradientLB->GetSelectItemPos(); + sal_uInt16 nId = m_xGradientLB->GetSelectedItemId(); + size_t nPos = m_xGradientLB->GetSelectItemPos(); if( nPos != VALUESET_ITEM_NOTFOUND ) { - std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "cui/ui/querydeletegradientdialog.ui")); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetTabDialog()->GetFrameWeld(), "cui/ui/querydeletegradientdialog.ui")); std::unique_ptr<weld::MessageDialog> xQueryBox(xBuilder->weld_message_dialog("AskDelGradientDialog")); if (xQueryBox->run() == RET_YES) { m_pGradientList->Remove(nPos); - m_pGradientLB->RemoveItem( nId ); - nId = m_pGradientLB->GetItemId( 0 ); - m_pGradientLB->SelectItem( nId ); - m_pGradientLB->Resize(); + m_xGradientLB->RemoveItem( nId ); + nId = m_xGradientLB->GetItemId( 0 ); + m_xGradientLB->SelectItem( nId ); + m_xGradientLB->Resize(); - m_pCtlPreview->Invalidate(); + m_aCtlPreview.Invalidate(); ChangeGradientHdl_Impl(); @@ -485,13 +462,13 @@ IMPL_LINK_NOARG(SvxGradientTabPage, ClickDeleteHdl_Impl, SvxPresetListBox*, void } // determine button state if( !m_pGradientList->Count() ) - m_pBtnModify->Disable(); + m_xBtnModify->set_sensitive(false); } -IMPL_LINK_NOARG(SvxGradientTabPage, ClickRenameHdl_Impl, SvxPresetListBox*, void) +IMPL_LINK_NOARG(SvxGradientTabPage, ClickRenameHdl_Impl, PresetListBox*, void) { - sal_uInt16 nId = m_pGradientLB->GetSelectedItemId(); - size_t nPos = m_pGradientLB->GetSelectItemPos(); + sal_uInt16 nId = m_xGradientLB->GetSelectedItemId(); + size_t nPos = m_xGradientLB->GetSelectItemPos(); if ( nPos != VALUESET_ITEM_NOTFOUND ) { @@ -499,7 +476,7 @@ IMPL_LINK_NOARG(SvxGradientTabPage, ClickRenameHdl_Impl, SvxPresetListBox*, void OUString aName( m_pGradientList->GetGradient( nPos )->GetName() ); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - ScopedVclPtr<AbstractSvxNameDialog> pDlg(pFact->CreateSvxNameDialog(GetFrameWeld(), aName, aDesc)); + ScopedVclPtr<AbstractSvxNameDialog> pDlg(pFact->CreateSvxNameDialog(GetTabDialog()->GetFrameWeld(), aName, aDesc)); bool bLoop = true; while( bLoop && pDlg->Execute() == RET_OK ) @@ -513,14 +490,14 @@ IMPL_LINK_NOARG(SvxGradientTabPage, ClickRenameHdl_Impl, SvxPresetListBox*, void bLoop = false; m_pGradientList->GetGradient(nPos)->SetName(aName); - m_pGradientLB->SetItemText( nId, aName ); - m_pGradientLB->SelectItem( nId ); + m_xGradientLB->SetItemText( nId, aName ); + m_xGradientLB->SelectItem( nId ); *m_pnGradientListState |= ChangeType::MODIFIED; } else { - std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "cui/ui/queryduplicatedialog.ui")); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetTabDialog()->GetFrameWeld(), "cui/ui/queryduplicatedialog.ui")); std::unique_ptr<weld::MessageDialog> xBox(xBuilder->weld_message_dialog("DuplicateNameDialog")); xBox->run(); } @@ -528,7 +505,7 @@ IMPL_LINK_NOARG(SvxGradientTabPage, ClickRenameHdl_Impl, SvxPresetListBox*, void } } -IMPL_LINK_NOARG(SvxGradientTabPage, ChangeGradientHdl, ValueSet*, void) +IMPL_LINK_NOARG(SvxGradientTabPage, ChangeGradientHdl, SvtValueSet*, void) { ChangeGradientHdl_Impl(); } @@ -536,7 +513,7 @@ IMPL_LINK_NOARG(SvxGradientTabPage, ChangeGradientHdl, ValueSet*, void) void SvxGradientTabPage::ChangeGradientHdl_Impl() { std::unique_ptr<XGradient> pGradient; - size_t nPos = m_pGradientLB->GetSelectItemPos(); + size_t nPos = m_xGradientLB->GetSelectItemPos(); if( nPos != VALUESET_ITEM_NOTFOUND ) pGradient.reset(new XGradient( m_pGradientList->GetGradient( static_cast<sal_uInt16>( nPos ) )->GetGradient() )); @@ -553,8 +530,8 @@ void SvxGradientTabPage::ChangeGradientHdl_Impl() } if( !pGradient ) { - sal_uInt16 nPosition = m_pGradientLB->GetItemId(0); - m_pGradientLB->SelectItem( nPosition ); + sal_uInt16 nPosition = m_xGradientLB->GetItemId(0); + m_xGradientLB->SelectItem( nPosition ); if( nPosition != 0 ) pGradient.reset(new XGradient( m_pGradientList->GetGradient( 0 )->GetGradient() )); } @@ -566,35 +543,35 @@ void SvxGradientTabPage::ChangeGradientHdl_Impl() sal_uInt16 nValue = pGradient->GetSteps(); if( nValue == 0 ) { - m_pCbIncrement->SetState(TRISTATE_TRUE); - m_pMtrIncrement->Disable(); - m_pSliderIncrement->Disable(); + m_xCbIncrement->set_state(TRISTATE_TRUE); + m_xMtrIncrement->set_sensitive(false); + m_xSliderIncrement->set_sensitive(false); } else { - m_pCbIncrement->SetState(TRISTATE_FALSE); - m_pMtrIncrement->Enable(); - m_pMtrIncrement->SetValue( nValue ); - m_pSliderIncrement->Enable(); - m_pSliderIncrement->SetThumbPos( nValue ); + m_xCbIncrement->set_state(TRISTATE_FALSE); + m_xMtrIncrement->set_sensitive(true); + m_xMtrIncrement->set_value( nValue ); + m_xSliderIncrement->set_sensitive(true); + m_xSliderIncrement->set_value(nValue); } - m_pLbGradientType->SelectEntryPos( + m_xLbGradientType->set_active( sal::static_int_cast< sal_Int32 >( eXGS ) ); // if the entry is not in the listbox, // colors are added temporarily - m_pLbColorFrom->SetNoSelection(); - m_pLbColorFrom->SelectEntry( pGradient->GetStartColor() ); + m_xLbColorFrom->SetNoSelection(); + m_xLbColorFrom->SelectEntry( pGradient->GetStartColor() ); - m_pLbColorTo->SetNoSelection(); - m_pLbColorTo->SelectEntry( pGradient->GetEndColor() ); + m_xLbColorTo->SetNoSelection(); + m_xLbColorTo->SelectEntry( pGradient->GetEndColor() ); - m_pMtrAngle->SetValue( pGradient->GetAngle() / 10 ); // should be changed in resource - m_pMtrBorder->SetValue( pGradient->GetBorder() ); - m_pSliderBorder->SetThumbPos( pGradient->GetBorder() ); - m_pMtrCenterX->SetValue( pGradient->GetXOffset() ); - m_pMtrCenterY->SetValue( pGradient->GetYOffset() ); - m_pMtrColorFrom->SetValue( pGradient->GetStartIntens() ); - m_pMtrColorTo->SetValue( pGradient->GetEndIntens() ); + m_xMtrAngle->set_value(pGradient->GetAngle() / 10, FUNIT_NONE); // should be changed in resource + m_xMtrBorder->set_value(pGradient->GetBorder(), FUNIT_NONE); + m_xSliderBorder->set_value(pGradient->GetBorder()); + m_xMtrCenterX->set_value(pGradient->GetXOffset(), FUNIT_NONE); + m_xMtrCenterY->set_value(pGradient->GetYOffset(), FUNIT_NONE); + m_xMtrColorFrom->set_value(pGradient->GetStartIntens(), FUNIT_NONE); + m_xMtrColorTo->set_value(pGradient->GetEndIntens(), FUNIT_NONE); // disable/enable controls SetControlState_Impl( eXGS ); @@ -602,49 +579,48 @@ void SvxGradientTabPage::ChangeGradientHdl_Impl() // fill ItemSet and pass it on to aCtlPreview m_rXFSet.Put( XFillGradientItem( OUString(), *pGradient ) ); m_rXFSet.Put( XGradientStepCountItem( nValue ) ); - m_pCtlPreview->SetAttributes( m_aXFillAttr.GetItemSet() ); + m_aCtlPreview.SetAttributes(m_aXFillAttr.GetItemSet()); - m_pCtlPreview->Invalidate(); + m_aCtlPreview.Invalidate(); } } - void SvxGradientTabPage::SetControlState_Impl( css::awt::GradientStyle eXGS ) { switch( eXGS ) { case css::awt::GradientStyle_LINEAR: case css::awt::GradientStyle_AXIAL: - m_pFtCenter->Disable(); - m_pMtrCenterX->Disable(); - m_pMtrCenterY->Disable(); - m_pFtAngle->Enable(); - m_pMtrAngle->Enable(); + m_xFtCenter->set_sensitive(false); + m_xMtrCenterX->set_sensitive(false); + m_xMtrCenterY->set_sensitive(false); + m_xFtAngle->set_sensitive(true); + m_xMtrAngle->set_sensitive(true); break; case css::awt::GradientStyle_RADIAL: - m_pFtCenter->Enable(); - m_pMtrCenterX->Enable(); - m_pMtrCenterY->Enable(); - m_pFtAngle->Disable(); - m_pMtrAngle->Disable(); + m_xFtCenter->set_sensitive(true); + m_xMtrCenterX->set_sensitive(true); + m_xMtrCenterY->set_sensitive(true); + m_xFtAngle->set_sensitive(false); + m_xMtrAngle->set_sensitive(false); break; case css::awt::GradientStyle_ELLIPTICAL: - m_pFtCenter->Enable(); - m_pMtrCenterX->Enable(); - m_pMtrCenterY->Enable(); - m_pFtAngle->Enable(); - m_pMtrAngle->Enable(); + m_xFtCenter->set_sensitive(true); + m_xMtrCenterX->set_sensitive(true); + m_xMtrCenterY->set_sensitive(true); + m_xFtAngle->set_sensitive(true); + m_xMtrAngle->set_sensitive(true); break; case css::awt::GradientStyle_SQUARE: case css::awt::GradientStyle_RECT: - m_pFtCenter->Enable(); - m_pMtrCenterX->Enable(); - m_pMtrCenterY->Enable(); - m_pFtAngle->Enable(); - m_pMtrAngle->Enable(); + m_xFtCenter->set_sensitive(true); + m_xMtrCenterX->set_sensitive(true); + m_xMtrCenterY->set_sensitive(true); + m_xFtAngle->set_sensitive(true); + m_xMtrAngle->set_sensitive(true); break; default: break; diff --git a/cui/source/tabpages/tphatch.cxx b/cui/source/tabpages/tphatch.cxx index a51ceabe8378..110df65ceecd 100644 --- a/cui/source/tabpages/tphatch.cxx +++ b/cui/source/tabpages/tphatch.cxx @@ -49,36 +49,29 @@ using namespace com::sun::star; -SvxHatchTabPage::SvxHatchTabPage -( - vcl::Window* pParent, - const SfxItemSet& rInAttrs -) : - - SvxTabPage ( pParent, "HatchPage", "cui/ui/hatchpage.ui", rInAttrs ), - - m_rOutAttrs ( rInAttrs ), - m_pnHatchingListState ( nullptr ), - m_pnColorListState ( nullptr ), - m_aXFillAttr ( rInAttrs.GetPool() ), - m_rXFSet ( m_aXFillAttr.GetItemSet() ) +SvxHatchTabPage::SvxHatchTabPage(TabPageParent pParent, const SfxItemSet& rInAttrs) + : SvxTabPage(pParent, "cui/ui/hatchpage.ui", "HatchPage", rInAttrs) + , m_rOutAttrs(rInAttrs) + , m_pnHatchingListState(nullptr) + , m_pnColorListState(nullptr) + , m_aXFillAttr(rInAttrs.GetPool()) + , m_rXFSet(m_aXFillAttr.GetItemSet()) + , m_xMtrDistance(m_xBuilder->weld_metric_spin_button("distancemtr", FUNIT_MM)) + , m_xMtrAngle(m_xBuilder->weld_metric_spin_button("anglemtr", FUNIT_DEGREE)) + , m_xSliderAngle(m_xBuilder->weld_scale("angleslider")) + , m_xLbLineType(m_xBuilder->weld_combo_box_text("linetypelb")) + , m_xLbLineColor(new ColorListBox(m_xBuilder->weld_menu_button("linecolorlb"), GetFrameWeld())) + , m_xCbBackgroundColor(m_xBuilder->weld_check_button("backgroundcolor")) + , m_xLbBackgroundColor(new ColorListBox(m_xBuilder->weld_menu_button("backgroundcolorlb"), GetFrameWeld())) + , m_xHatchLB(new PresetListBox(m_xBuilder->weld_scrolled_window("hatchpresetlistwin"))) + , m_xBtnAdd(m_xBuilder->weld_button("add")) + , m_xBtnModify(m_xBuilder->weld_button("modify")) + , m_xHatchLBWin(new weld::CustomWeld(*m_xBuilder, "hatchpresetlist", *m_xHatchLB)) + , m_xCtlPreview(new weld::CustomWeld(*m_xBuilder, "previewctl", m_aCtlPreview)) { - get(m_pMtrDistance, "distancemtr"); - get(m_pMtrAngle, "anglemtr"); - get(m_pSliderAngle, "angleslider"); - get(m_pLbLineType, "linetypelb"); - get(m_pLbLineColor, "linecolorlb"); - get(m_pCbBackgroundColor, "backgroundcolor"); - get(m_pLbBackgroundColor, "backgroundcolorlb"); - get(m_pHatchLB , "hatchpresetlist"); - get(m_pCtlPreview, "previewctl"); Size aSize = getDrawPreviewOptimalSize(this); - m_pHatchLB->set_width_request(aSize.Width()); - m_pHatchLB->set_height_request(aSize.Height()); - m_pCtlPreview->set_width_request(aSize.Width()); - m_pCtlPreview->set_height_request(aSize.Height()); - get(m_pBtnAdd, "add"); - get(m_pBtnModify, "modify"); + m_xHatchLBWin->set_size_request(aSize.Width(), aSize.Height()); + m_xCtlPreview->set_size_request(aSize.Width(), aSize.Height()); // this page needs ExchangeSupport SetExchangeSupport(); @@ -94,7 +87,7 @@ SvxHatchTabPage::SvxHatchTabPage break; default: ;//prevent warning } - SetFieldUnit( *m_pMtrDistance, eFUnit ); + SetFieldUnit( *m_xMtrDistance, eFUnit ); // determine PoolUnit SfxItemPool* pPool = m_rOutAttrs.GetPool(); @@ -104,27 +97,26 @@ SvxHatchTabPage::SvxHatchTabPage // setting the output device m_rXFSet.Put( XFillStyleItem(drawing::FillStyle_HATCH) ); m_rXFSet.Put( XFillHatchItem(OUString(), XHatch()) ); - m_pCtlPreview->SetAttributes( m_aXFillAttr.GetItemSet() ); - m_pHatchLB->SetSelectHdl( LINK( this, SvxHatchTabPage, ChangeHatchHdl ) ); - m_pHatchLB->SetRenameHdl( LINK( this, SvxHatchTabPage, ClickRenameHdl_Impl ) ); - m_pHatchLB->SetDeleteHdl( LINK( this, SvxHatchTabPage, ClickDeleteHdl_Impl ) ); - - Link<Edit&,void> aLink = LINK( this, SvxHatchTabPage, ModifiedEditHdl_Impl ); - Link<ListBox&,void> aLink2 = LINK( this, SvxHatchTabPage, ModifiedListBoxHdl_Impl ); - m_pMtrDistance->SetModifyHdl( aLink ); - 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_pCbBackgroundColor->SetToggleHdl( LINK( this, SvxHatchTabPage, ToggleHatchBackgroundColor_Impl ) ); - m_pLbBackgroundColor->SetSelectHdl( LINK( this, SvxHatchTabPage, ModifiedBackgroundHdl_Impl ) ); - - m_pBtnAdd->SetClickHdl( LINK( this, SvxHatchTabPage, ClickAddHdl_Impl ) ); - m_pBtnModify->SetClickHdl( LINK( this, SvxHatchTabPage, ClickModifyHdl_Impl ) ); - - m_pCtlPreview->SetDrawMode( GetSettings().GetStyleSettings().GetHighContrastMode() ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR ); - + m_aCtlPreview.SetAttributes( m_aXFillAttr.GetItemSet() ); + m_xHatchLB->SetSelectHdl( LINK( this, SvxHatchTabPage, ChangeHatchHdl ) ); + m_xHatchLB->SetRenameHdl( LINK( this, SvxHatchTabPage, ClickRenameHdl_Impl ) ); + m_xHatchLB->SetDeleteHdl( LINK( this, SvxHatchTabPage, ClickDeleteHdl_Impl ) ); + + Link<weld::MetricSpinButton&,void> aLink = LINK( this, SvxHatchTabPage, ModifiedEditHdl_Impl ); + Link<weld::ComboBoxText&,void> aLink2 = LINK( this, SvxHatchTabPage, ModifiedListBoxHdl_Impl ); + m_xMtrDistance->connect_value_changed( aLink ); + m_xMtrAngle->connect_value_changed( aLink ); + m_xSliderAngle->connect_value_changed(LINK(this, SvxHatchTabPage, ModifiedSliderHdl_Impl)); + m_xLbLineType->connect_changed( aLink2 ); + Link<ColorListBox&,void> aLink3 = LINK( this, SvxHatchTabPage, ModifiedColorListBoxHdl_Impl ); + m_xLbLineColor->SetSelectHdl( aLink3 ); + m_xCbBackgroundColor->connect_toggled( LINK( this, SvxHatchTabPage, ToggleHatchBackgroundColor_Impl ) ); + m_xLbBackgroundColor->SetSelectHdl( LINK( this, SvxHatchTabPage, ModifiedBackgroundHdl_Impl ) ); + + m_xBtnAdd->connect_clicked( LINK( this, SvxHatchTabPage, ClickAddHdl_Impl ) ); + m_xBtnModify->connect_clicked( LINK( this, SvxHatchTabPage, ClickModifyHdl_Impl ) ); + + m_aCtlPreview.SetDrawMode( GetSettings().GetStyleSettings().GetHighContrastMode() ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR ); } SvxHatchTabPage::~SvxHatchTabPage() @@ -134,23 +126,17 @@ SvxHatchTabPage::~SvxHatchTabPage() void SvxHatchTabPage::dispose() { - m_pMtrDistance.clear(); - m_pMtrAngle.clear(); - m_pSliderAngle.clear(); - m_pLbLineType.clear(); - m_pLbLineColor.clear(); - m_pCbBackgroundColor.clear(); - m_pLbBackgroundColor.clear(); - m_pHatchLB.clear(); - m_pCtlPreview.clear(); - m_pBtnAdd.clear(); - m_pBtnModify.clear(); + m_xCtlPreview.reset(); + m_xHatchLBWin.reset(); + m_xHatchLB.reset(); + m_xLbBackgroundColor.reset(); + m_xLbLineColor.reset(); SvxTabPage::dispose(); } void SvxHatchTabPage::Construct() { - m_pHatchLB->FillPresetListBox(*m_pHatchingList); + m_xHatchLB->FillPresetListBox(*m_pHatchingList); } void SvxHatchTabPage::ActivatePage( const SfxItemSet& rSet ) @@ -188,8 +174,8 @@ void SvxHatchTabPage::ActivatePage( const SfxItemSet& rSet ) sal_Int32 nPos = SearchHatchList( rSet.Get(XATTR_FILLHATCH).GetName() ); if( nPos != LISTBOX_ENTRY_NOTFOUND ) { - sal_uInt16 nId = m_pHatchLB->GetItemId( static_cast<size_t>( nPos ) ); - m_pHatchLB->SelectItem( nId ); + sal_uInt16 nId = m_xHatchLB->GetItemId( static_cast<size_t>( nPos ) ); + m_xHatchLB->SelectItem( nId ); } // colors could have been deleted ChangeHatchHdl_Impl(); @@ -200,24 +186,23 @@ void SvxHatchTabPage::ActivatePage( const SfxItemSet& rSet ) if(aBckItem.GetValue()) { - m_pCbBackgroundColor->SetState(TRISTATE_TRUE); + m_xCbBackgroundColor->set_state(TRISTATE_TRUE); XFillColorItem aColorItem( rSet.Get(XATTR_FILLCOLOR) ); Color aColor(aColorItem.GetColorValue()); - m_pLbBackgroundColor->Enable(); - m_pLbBackgroundColor->SelectEntry(aColor); + m_xLbBackgroundColor->set_sensitive(true); + m_xLbBackgroundColor->SelectEntry(aColor); m_rXFSet.Put( aColorItem ); } else { - m_pCbBackgroundColor->SetState(TRISTATE_FALSE); - m_pLbBackgroundColor->Disable(); + m_xCbBackgroundColor->set_state(TRISTATE_FALSE); + m_xLbBackgroundColor->set_sensitive(false); } - m_pCtlPreview->SetAttributes( m_aXFillAttr.GetItemSet() ); - m_pCtlPreview->Invalidate(); + m_aCtlPreview.SetAttributes( m_aXFillAttr.GetItemSet() ); + m_aCtlPreview.Invalidate(); } - DeactivateRC SvxHatchTabPage::DeactivatePage( SfxItemSet* _pSet ) { if( _pSet ) @@ -226,7 +211,6 @@ DeactivateRC SvxHatchTabPage::DeactivatePage( SfxItemSet* _pSet ) return DeactivateRC::LeavePage; } - sal_Int32 SvxHatchTabPage::SearchHatchList(const OUString& rHatchName) { long nCount = m_pHatchingList->Count(); @@ -248,128 +232,127 @@ bool SvxHatchTabPage::FillItemSet( SfxItemSet* rSet ) { std::unique_ptr<XHatch> pXHatch; OUString aString; - size_t nPos = m_pHatchLB->IsNoSelection() ? VALUESET_ITEM_NOTFOUND : m_pHatchLB->GetSelectItemPos(); + size_t nPos = m_xHatchLB->IsNoSelection() ? VALUESET_ITEM_NOTFOUND : m_xHatchLB->GetSelectItemPos(); if( nPos != VALUESET_ITEM_NOTFOUND ) { pXHatch.reset(new XHatch( m_pHatchingList->GetHatch( static_cast<sal_uInt16>(nPos) )->GetHatch() )); - aString = m_pHatchLB->GetItemText( m_pHatchLB->GetSelectedItemId() ); + aString = m_xHatchLB->GetItemText( m_xHatchLB->GetSelectedItemId() ); } // unidentified hatch has been passed else { - pXHatch.reset(new XHatch( m_pLbLineColor->GetSelectEntryColor(), - static_cast<css::drawing::HatchStyle>(m_pLbLineType->GetSelectedEntryPos()), - GetCoreValue( *m_pMtrDistance, m_ePoolUnit ), - static_cast<long>(m_pMtrAngle->GetValue() * 10) )); + pXHatch.reset(new XHatch( m_xLbLineColor->GetSelectEntryColor(), + static_cast<css::drawing::HatchStyle>(m_xLbLineType->get_active()), + GetCoreValue( *m_xMtrDistance, m_ePoolUnit ), + static_cast<long>(m_xMtrAngle->get_value(FUNIT_NONE) * 10) )); } assert( pXHatch && "XHatch couldn't be created" ); rSet->Put( XFillStyleItem( drawing::FillStyle_HATCH ) ); rSet->Put( XFillHatchItem( aString, *pXHatch ) ); - rSet->Put( XFillBackgroundItem( m_pCbBackgroundColor->IsChecked() ) ); - if (m_pCbBackgroundColor->IsChecked()) + rSet->Put( XFillBackgroundItem( m_xCbBackgroundColor->get_active() ) ); + if (m_xCbBackgroundColor->get_active()) { - NamedColor aColor = m_pLbBackgroundColor->GetSelectedEntry(); + NamedColor aColor = m_xLbBackgroundColor->GetSelectedEntry(); rSet->Put(XFillColorItem(aColor.second, aColor.first)); } return true; } - void SvxHatchTabPage::Reset( const SfxItemSet* rSet ) { ChangeHatchHdl_Impl(); XFillBackgroundItem aBckItem( rSet->Get(XATTR_FILLBACKGROUND) ); if(aBckItem.GetValue()) - m_pCbBackgroundColor->SetState(TRISTATE_TRUE); + m_xCbBackgroundColor->set_state(TRISTATE_TRUE); else - m_pCbBackgroundColor->SetState(TRISTATE_FALSE); + m_xCbBackgroundColor->set_state(TRISTATE_FALSE); m_rXFSet.Put( aBckItem ); XFillColorItem aColItem( rSet->Get(XATTR_FILLCOLOR) ); - m_pLbBackgroundColor->SelectEntry(aColItem.GetColorValue()); + m_xLbBackgroundColor->SelectEntry(aColItem.GetColorValue()); m_rXFSet.Put( aColItem ); - m_pCtlPreview->SetAttributes( m_aXFillAttr.GetItemSet() ); - m_pCtlPreview->Invalidate(); + m_aCtlPreview.SetAttributes( m_aXFillAttr.GetItemSet() ); + m_aCtlPreview.Invalidate(); } - VclPtr<SfxTabPage> SvxHatchTabPage::Create( TabPageParent pWindow, const SfxItemSet* rSet ) { - return VclPtr<SvxHatchTabPage>::Create( pWindow.pParent, *rSet ); + return VclPtr<SvxHatchTabPage>::Create(pWindow, *rSet); } -IMPL_LINK( SvxHatchTabPage, ModifiedListBoxHdl_Impl, ListBox&, rListBox, void ) +IMPL_LINK( SvxHatchTabPage, ModifiedListBoxHdl_Impl, weld::ComboBoxText&, rListBox, void ) { ModifiedHdl_Impl(&rListBox); // hatch params have changed, it is no longer one of the presets - m_pHatchLB->SetNoSelection(); + m_xHatchLB->SetNoSelection(); } -IMPL_LINK( SvxHatchTabPage, ModifiedColorListBoxHdl_Impl, SvxColorListBox&, rListBox, void ) +IMPL_LINK( SvxHatchTabPage, ModifiedColorListBoxHdl_Impl, ColorListBox&, rListBox, void ) { ModifiedHdl_Impl(&rListBox); - m_pHatchLB->SetNoSelection(); + m_xHatchLB->SetNoSelection(); } -IMPL_LINK_NOARG( SvxHatchTabPage, ToggleHatchBackgroundColor_Impl, CheckBox&, void ) +IMPL_LINK_NOARG( SvxHatchTabPage, ToggleHatchBackgroundColor_Impl, weld::ToggleButton&, void ) { - if(m_pCbBackgroundColor->IsChecked()) - m_pLbBackgroundColor->Enable(); + if (m_xCbBackgroundColor->get_active()) + m_xLbBackgroundColor->set_sensitive(true); else - m_pLbBackgroundColor->Disable(); - m_rXFSet.Put( XFillBackgroundItem( m_pCbBackgroundColor->IsChecked() ) ); - ModifiedBackgroundHdl_Impl(*m_pLbBackgroundColor); + m_xLbBackgroundColor->set_sensitive(false); + m_rXFSet.Put( XFillBackgroundItem( m_xCbBackgroundColor->get_active() ) ); + ModifiedBackgroundHdl_Impl(*m_xLbBackgroundColor); } -IMPL_LINK_NOARG( SvxHatchTabPage, ModifiedBackgroundHdl_Impl, SvxColorListBox&, void ) +IMPL_LINK_NOARG( SvxHatchTabPage, ModifiedBackgroundHdl_Impl, ColorListBox&, void ) { Color aColor(COL_TRANSPARENT); - if(m_pCbBackgroundColor->IsChecked()) + if (m_xCbBackgroundColor->get_active()) { - aColor = m_pLbBackgroundColor->GetSelectEntryColor(); - m_pCtlPreview->SetAttributes( m_aXFillAttr.GetItemSet() ); - m_pCtlPreview->Invalidate(); + aColor = m_xLbBackgroundColor->GetSelectEntryColor(); + m_aCtlPreview.SetAttributes( m_aXFillAttr.GetItemSet() ); + m_aCtlPreview.Invalidate(); } m_rXFSet.Put(XFillColorItem( OUString(), aColor )); - m_pCtlPreview->SetAttributes( m_aXFillAttr.GetItemSet() ); - m_pCtlPreview->Invalidate(); + m_aCtlPreview.SetAttributes( m_aXFillAttr.GetItemSet() ); + m_aCtlPreview.Invalidate(); } -IMPL_LINK( SvxHatchTabPage, ModifiedEditHdl_Impl, Edit&, rEdit, void ) +IMPL_LINK( SvxHatchTabPage, ModifiedEditHdl_Impl, weld::MetricSpinButton&, rEdit, void ) { ModifiedHdl_Impl(&rEdit); - m_pHatchLB->SetNoSelection(); + m_xHatchLB->SetNoSelection(); } -IMPL_LINK( SvxHatchTabPage, ModifiedSliderHdl_Impl, Slider*, rSlider, void ) +IMPL_LINK( SvxHatchTabPage, ModifiedSliderHdl_Impl, weld::Scale&, rSlider, void ) { - ModifiedHdl_Impl(rSlider); - m_pHatchLB->SetNoSelection(); + ModifiedHdl_Impl(&rSlider); + m_xHatchLB->SetNoSelection(); } + void SvxHatchTabPage::ModifiedHdl_Impl( void const * p ) { - if( p == m_pMtrAngle ) - m_pSliderAngle->SetThumbPos( m_pMtrAngle->GetValue() ); + if (p == m_xMtrAngle.get()) + m_xSliderAngle->set_value(m_xMtrAngle->get_value(FUNIT_NONE)); - if( p == m_pSliderAngle ) - m_pMtrAngle->SetValue( m_pSliderAngle->GetThumbPos() ); + if (p == m_xSliderAngle.get()) + m_xMtrAngle->set_value(m_xSliderAngle->get_value(), FUNIT_NONE); - XHatch aXHatch( m_pLbLineColor->GetSelectEntryColor(), - static_cast<css::drawing::HatchStyle>(m_pLbLineType->GetSelectedEntryPos()), - GetCoreValue( *m_pMtrDistance, m_ePoolUnit ), - static_cast<long>(m_pMtrAngle->GetValue() * 10) ); + XHatch aXHatch( m_xLbLineColor->GetSelectEntryColor(), + static_cast<css::drawing::HatchStyle>(m_xLbLineType->get_active()), + GetCoreValue( *m_xMtrDistance, m_ePoolUnit ), + static_cast<long>(m_xMtrAngle->get_value(FUNIT_NONE) * 10) ); m_rXFSet.Put( XFillHatchItem( OUString(), aXHatch ) ); - m_pCtlPreview->SetAttributes( m_aXFillAttr.GetItemSet() ); - m_pCtlPreview->Invalidate(); + m_aCtlPreview.SetAttributes( m_aXFillAttr.GetItemSet() ); + m_aCtlPreview.Invalidate(); } -IMPL_LINK_NOARG(SvxHatchTabPage, ChangeHatchHdl, ValueSet*, void) +IMPL_LINK_NOARG(SvxHatchTabPage, ChangeHatchHdl, SvtValueSet*, void) { ChangeHatchHdl_Impl(); } @@ -377,7 +360,7 @@ IMPL_LINK_NOARG(SvxHatchTabPage, ChangeHatchHdl, ValueSet*, void) void SvxHatchTabPage::ChangeHatchHdl_Impl() { std::unique_ptr<XHatch> pHatch; - size_t nPos = m_pHatchLB->GetSelectItemPos(); + size_t nPos = m_xHatchLB->GetSelectItemPos(); if( nPos != VALUESET_ITEM_NOTFOUND ) pHatch.reset(new XHatch( m_pHatchingList->GetHatch( static_cast<sal_uInt16>(nPos) )->GetHatch() )); @@ -394,38 +377,38 @@ void SvxHatchTabPage::ChangeHatchHdl_Impl() } if( !pHatch ) { - sal_uInt16 nPosition = m_pHatchLB->GetItemId( 0 ); - m_pHatchLB->SelectItem( nPosition ); + sal_uInt16 nPosition = m_xHatchLB->GetItemId( 0 ); + m_xHatchLB->SelectItem( nPosition ); if( nPosition != 0 ) pHatch.reset( new XHatch( m_pHatchingList->GetHatch( 0 )->GetHatch() ) ); } } if( pHatch ) { - m_pLbLineType->SelectEntryPos( + m_xLbLineType->set_active( sal::static_int_cast< sal_Int32 >( pHatch->GetHatchStyle() ) ); - m_pLbLineColor->SetNoSelection(); - m_pLbLineColor->SelectEntry( pHatch->GetColor() ); - SetMetricValue( *m_pMtrDistance, pHatch->GetDistance(), m_ePoolUnit ); + m_xLbLineColor->SetNoSelection(); + m_xLbLineColor->SelectEntry( pHatch->GetColor() ); + SetMetricValue( *m_xMtrDistance, pHatch->GetDistance(), m_ePoolUnit ); long mHatchAngle = pHatch->GetAngle() / 10; - m_pMtrAngle->SetValue( mHatchAngle ); - m_pSliderAngle->SetThumbPos( mHatchAngle ); + m_xMtrAngle->set_value(mHatchAngle, FUNIT_NONE); + m_xSliderAngle->set_value(mHatchAngle); - // fill ItemSet and pass it on to m_pCtlPreview + // fill ItemSet and pass it on to m_aCtlPreview m_rXFSet.Put( XFillHatchItem( OUString(), *pHatch ) ); - m_pCtlPreview->SetAttributes( m_aXFillAttr.GetItemSet() ); + m_aCtlPreview.SetAttributes( m_aXFillAttr.GetItemSet() ); - m_pCtlPreview->Invalidate(); + m_aCtlPreview.Invalidate(); pHatch.reset(); } - m_pMtrDistance->SaveValue(); - m_pMtrAngle->SaveValue(); - m_pLbLineType->SaveValue(); - m_pLbLineColor->SaveValue(); - m_pLbBackgroundColor->SaveValue(); + m_xMtrDistance->save_value(); + m_xMtrAngle->save_value(); + m_xLbLineType->save_value(); + m_xLbLineColor->SaveValue(); + m_xLbBackgroundColor->SaveValue(); } -IMPL_LINK_NOARG(SvxHatchTabPage, ClickAddHdl_Impl, Button*, void) +IMPL_LINK_NOARG(SvxHatchTabPage, ClickAddHdl_Impl, weld::Button&, void) { OUString aNewName( SvxResId( RID_SVXSTR_HATCH ) ); OUString aDesc( CuiResId( RID_SVXSTR_DESC_HATCH ) ); @@ -442,7 +425,7 @@ IMPL_LINK_NOARG(SvxHatchTabPage, ClickAddHdl_Impl, Button*, void) } SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - ScopedVclPtr<AbstractSvxNameDialog> pDlg(pFact->CreateSvxNameDialog(GetFrameWeld(), aName, aDesc)); + ScopedVclPtr<AbstractSvxNameDialog> pDlg(pFact->CreateSvxNameDialog(GetTabDialog()->GetFrameWeld(), aName, aDesc)); sal_uInt16 nError = 1; while( pDlg->Execute() == RET_OK ) @@ -456,7 +439,7 @@ IMPL_LINK_NOARG(SvxHatchTabPage, ClickAddHdl_Impl, Button*, void) break; } - std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "cui/ui/queryduplicatedialog.ui")); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetTabDialog()->GetFrameWeld(), "cui/ui/queryduplicatedialog.ui")); std::unique_ptr<weld::MessageDialog> xWarnBox(xBuilder->weld_message_dialog("DuplicateNameDialog")); if (xWarnBox->run() != RET_OK) break; @@ -465,19 +448,19 @@ IMPL_LINK_NOARG(SvxHatchTabPage, ClickAddHdl_Impl, Button*, void) if( !nError ) { - XHatch aXHatch( m_pLbLineColor->GetSelectEntryColor(), - static_cast<css::drawing::HatchStyle>(m_pLbLineType->GetSelectedEntryPos()), - GetCoreValue( *m_pMtrDistance, m_ePoolUnit ), - static_cast<long>(m_pMtrAngle->GetValue() * 10) ); + XHatch aXHatch( m_xLbLineColor->GetSelectEntryColor(), + static_cast<css::drawing::HatchStyle>(m_xLbLineType->get_active()), + GetCoreValue( *m_xMtrDistance, m_ePoolUnit ), + static_cast<long>(m_xMtrAngle->get_value(FUNIT_NONE) * 10) ); m_pHatchingList->Insert(o3tl::make_unique<XHatchEntry>(aXHatch, aName), nCount); - sal_Int32 nId = m_pHatchLB->GetItemId(nCount - 1); // calculate the last ID - BitmapEx aBitmap = m_pHatchingList->GetBitmapForPreview( nCount, m_pHatchLB->GetIconSize() ); + sal_Int32 nId = m_xHatchLB->GetItemId(nCount - 1); // calculate the last ID + BitmapEx aBitmap = m_pHatchingList->GetBitmapForPreview( nCount, m_xHatchLB->GetIconSize() ); // Insert the new entry at the next ID - m_pHatchLB->InsertItem( nId + 1, Image(aBitmap), aName ); - m_pHatchLB->SelectItem( nId + 1 ); - m_pHatchLB->Resize(); + m_xHatchLB->InsertItem( nId + 1, Image(aBitmap), aName ); + m_xHatchLB->SelectItem( nId + 1 ); + m_xHatchLB->Resize(); *m_pnHatchingListState |= ChangeType::MODIFIED; @@ -485,56 +468,56 @@ IMPL_LINK_NOARG(SvxHatchTabPage, ClickAddHdl_Impl, Button*, void) } } -IMPL_LINK_NOARG(SvxHatchTabPage, ClickModifyHdl_Impl, Button*, void) +IMPL_LINK_NOARG(SvxHatchTabPage, ClickModifyHdl_Impl, weld::Button&, void) { - sal_uInt16 nId = m_pHatchLB->GetSelectedItemId(); - size_t nPos = m_pHatchLB->GetSelectItemPos(); + sal_uInt16 nId = m_xHatchLB->GetSelectedItemId(); + size_t nPos = m_xHatchLB->GetSelectItemPos(); if( nPos != VALUESET_ITEM_NOTFOUND ) { OUString aName( m_pHatchingList->GetHatch( static_cast<sal_uInt16>(nPos) )->GetName() ); - XHatch aXHatch( m_pLbLineColor->GetSelectEntryColor(), - static_cast<css::drawing::HatchStyle>(m_pLbLineType->GetSelectedEntryPos()), - GetCoreValue( *m_pMtrDistance, m_ePoolUnit ), - static_cast<long>(m_pMtrAngle->GetValue() * 10) ); + XHatch aXHatch( m_xLbLineColor->GetSelectEntryColor(), + static_cast<css::drawing::HatchStyle>(m_xLbLineType->get_active()), + GetCoreValue( *m_xMtrDistance, m_ePoolUnit ), + static_cast<long>(m_xMtrAngle->get_value(FUNIT_NONE) * 10) ); m_pHatchingList->Replace(o3tl::make_unique<XHatchEntry>(aXHatch, aName), nPos); - BitmapEx aBitmap = m_pHatchingList->GetBitmapForPreview( static_cast<sal_uInt16>(nPos), m_pHatchLB->GetIconSize() ); - m_pHatchLB->RemoveItem( nId ); - m_pHatchLB->InsertItem( nId, Image(aBitmap), aName, static_cast<sal_uInt16>(nPos) ); - m_pHatchLB->SelectItem( nId ); + BitmapEx aBitmap = m_pHatchingList->GetBitmapForPreview( static_cast<sal_uInt16>(nPos), m_xHatchLB->GetIconSize() ); + m_xHatchLB->RemoveItem( nId ); + m_xHatchLB->InsertItem( nId, Image(aBitmap), aName, static_cast<sal_uInt16>(nPos) ); + m_xHatchLB->SelectItem( nId ); // save values for changes recognition (-> method) - m_pMtrDistance->SaveValue(); - m_pMtrAngle->SaveValue(); - m_pLbLineType->SaveValue(); - m_pLbLineColor->SaveValue(); - m_pLbBackgroundColor->SaveValue(); + m_xMtrDistance->save_value(); + m_xMtrAngle->save_value(); + m_xLbLineType->save_value(); + m_xLbLineColor->SaveValue(); + m_xLbBackgroundColor->SaveValue(); *m_pnHatchingListState |= ChangeType::MODIFIED; } } -IMPL_LINK_NOARG(SvxHatchTabPage, ClickDeleteHdl_Impl, SvxPresetListBox*, void) +IMPL_LINK_NOARG(SvxHatchTabPage, ClickDeleteHdl_Impl, PresetListBox*, void) { - sal_uInt16 nId = m_pHatchLB->GetSelectedItemId(); - size_t nPos = m_pHatchLB->GetSelectItemPos(); + sal_uInt16 nId = m_xHatchLB->GetSelectedItemId(); + size_t nPos = m_xHatchLB->GetSelectItemPos(); if( nPos != VALUESET_ITEM_NOTFOUND ) { - std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "cui/ui/querydeletehatchdialog.ui")); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetTabDialog()->GetFrameWeld(), "cui/ui/querydeletehatchdialog.ui")); std::unique_ptr<weld::MessageDialog> xQueryBox(xBuilder->weld_message_dialog("AskDelHatchDialog")); if (xQueryBox->run() == RET_YES) { m_pHatchingList->Remove(nPos); - m_pHatchLB->RemoveItem( nId ); - nId = m_pHatchLB->GetItemId(0); - m_pHatchLB->SelectItem( nId ); - m_pHatchLB->Resize(); + m_xHatchLB->RemoveItem( nId ); + nId = m_xHatchLB->GetItemId(0); + m_xHatchLB->SelectItem( nId ); + m_xHatchLB->Resize(); - m_pCtlPreview->Invalidate(); + m_aCtlPreview.Invalidate(); ChangeHatchHdl_Impl(); @@ -543,10 +526,10 @@ IMPL_LINK_NOARG(SvxHatchTabPage, ClickDeleteHdl_Impl, SvxPresetListBox*, void) } } -IMPL_LINK_NOARG(SvxHatchTabPage, ClickRenameHdl_Impl, SvxPresetListBox*, void ) +IMPL_LINK_NOARG(SvxHatchTabPage, ClickRenameHdl_Impl, PresetListBox*, void ) { - sal_uInt16 nId = m_pHatchLB->GetSelectedItemId(); - size_t nPos = m_pHatchLB->GetSelectItemPos(); + sal_uInt16 nId = m_xHatchLB->GetSelectedItemId(); + size_t nPos = m_xHatchLB->GetSelectItemPos(); if( nPos != VALUESET_ITEM_NOTFOUND ) { @@ -554,7 +537,7 @@ IMPL_LINK_NOARG(SvxHatchTabPage, ClickRenameHdl_Impl, SvxPresetListBox*, void ) OUString aName( m_pHatchingList->GetHatch( nPos )->GetName() ); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - ScopedVclPtr<AbstractSvxNameDialog> pDlg(pFact->CreateSvxNameDialog(GetFrameWeld(), aName, aDesc)); + ScopedVclPtr<AbstractSvxNameDialog> pDlg(pFact->CreateSvxNameDialog(GetTabDialog()->GetFrameWeld(), aName, aDesc)); bool bLoop = true; while( bLoop && pDlg->Execute() == RET_OK ) @@ -568,14 +551,14 @@ IMPL_LINK_NOARG(SvxHatchTabPage, ClickRenameHdl_Impl, SvxPresetListBox*, void ) bLoop = false; m_pHatchingList->GetHatch(nPos)->SetName(aName); - m_pHatchLB->SetItemText(nId, aName); - m_pHatchLB->SelectItem( nId ); + m_xHatchLB->SetItemText(nId, aName); + m_xHatchLB->SelectItem( nId ); *m_pnHatchingListState |= ChangeType::MODIFIED; } else { - std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "cui/ui/queryduplicatedialog.ui")); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetTabDialog()->GetFrameWeld(), "cui/ui/queryduplicatedialog.ui")); std::unique_ptr<weld::MessageDialog> xBox(xBuilder->weld_message_dialog("DuplicateNameDialog")); xBox->run(); } @@ -595,7 +578,7 @@ void SvxHatchTabPage::PointChanged( weld::DrawingArea*, RectPoint ) void SvxHatchTabPage::DataChanged( const DataChangedEvent& rDCEvt ) { if ( ( rDCEvt.GetType() == DataChangedEventType::SETTINGS ) && ( rDCEvt.GetFlags() & AllSettingsFlags::STYLE ) ) - m_pCtlPreview->SetDrawMode( GetSettings().GetStyleSettings().GetHighContrastMode() ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR ); + m_aCtlPreview.SetDrawMode( GetSettings().GetStyleSettings().GetHighContrastMode() ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR ); SvxTabPage::DataChanged( rDCEvt ); } diff --git a/cui/source/tabpages/tppattern.cxx b/cui/source/tabpages/tppattern.cxx index a696204da30e..b7f72a6cbe01 100644 --- a/cui/source/tabpages/tppattern.cxx +++ b/cui/source/tabpages/tppattern.cxx @@ -83,35 +83,29 @@ public: void SetBackgroundColor( Color aColor ) { aBackgroundColor = aColor; } }; -SvxPatternTabPage::SvxPatternTabPage( vcl::Window* pParent, const SfxItemSet& rInAttrs) : - - SvxTabPage ( pParent, - "PatternTabPage", - "cui/ui/patterntabpage.ui", - rInAttrs ), - m_rOutAttrs ( rInAttrs ), - - m_pnPatternListState ( nullptr ), - m_pnColorListState ( nullptr ), - m_aXFillAttr ( rInAttrs.GetPool() ), - m_rXFSet ( m_aXFillAttr.GetItemSet() ) +SvxPatternTabPage::SvxPatternTabPage(TabPageParent pParent, const SfxItemSet& rInAttrs) + : SvxTabPage(pParent, "cui/ui/patterntabpage.ui", "PatternTabPage", rInAttrs) + , m_rOutAttrs(rInAttrs) + , m_pnPatternListState(nullptr) + , m_pnColorListState(nullptr) + , m_aXFillAttr(rInAttrs.GetPool()) + , m_rXFSet(m_aXFillAttr.GetItemSet()) + , m_aCtlPixel(this) + , m_xLbColor(new ColorListBox(m_xBuilder->weld_menu_button("LB_COLOR"), GetFrameWeld())) + , m_xLbBackgroundColor(new ColorListBox(m_xBuilder->weld_menu_button("LB_BACKGROUND_COLOR"), GetFrameWeld())) + , m_xPatternLB(new PresetListBox(m_xBuilder->weld_scrolled_window("patternpresetlistwin"))) + , m_xBtnAdd(m_xBuilder->weld_button("BTN_ADD")) + , m_xBtnModify(m_xBuilder->weld_button("BTN_MODIFY")) + , m_xCtlPixel(new weld::CustomWeld(*m_xBuilder, "CTL_PIXEL", m_aCtlPixel)) + , m_xCtlPreview(new weld::CustomWeld(*m_xBuilder, "CTL_PREVIEW", m_aCtlPreview)) + , m_xPatternLBWin(new weld::CustomWeld(*m_xBuilder, "patternpresetlist", *m_xPatternLB)) { - get(m_pCtlPixel,"CTL_PIXEL"); - get(m_pLbColor,"LB_COLOR"); - get(m_pLbBackgroundColor,"LB_BACKGROUND_COLOR"); - get(m_pCtlPreview,"CTL_PREVIEW"); - get(m_pPatternLB, "patternpresetlist"); - get(m_pBtnAdd,"BTN_ADD"); - get(m_pBtnModify,"BTN_MODIFY"); - // size of the bitmap display Size aSize = getDrawPreviewOptimalSize(this); - m_pPatternLB->set_width_request(aSize.Width()); - m_pPatternLB->set_height_request(aSize.Height()); - m_pCtlPreview->set_width_request(aSize.Width()); - m_pCtlPreview->set_height_request(aSize.Height()); + m_xPatternLB->set_size_request(aSize.Width(), aSize.Height()); + m_xCtlPreview->set_size_request(aSize.Width(), aSize.Height()); - m_pBitmapCtl.reset(new SvxBitmapCtl); + m_xBitmapCtl.reset(new SvxBitmapCtl); // this page needs ExchangeSupport SetExchangeSupport(); @@ -120,16 +114,14 @@ SvxPatternTabPage::SvxPatternTabPage( vcl::Window* pParent, const SfxItemSet& r m_rXFSet.Put( XFillStyleItem(drawing::FillStyle_BITMAP) ); m_rXFSet.Put( XFillBitmapItem(OUString(), Graphic()) ); - m_pBtnAdd->SetClickHdl( LINK( this, SvxPatternTabPage, ClickAddHdl_Impl ) ); - m_pBtnModify->SetClickHdl( LINK( this, SvxPatternTabPage, ClickModifyHdl_Impl ) ); - - m_pPatternLB->SetSelectHdl( LINK( this, SvxPatternTabPage, ChangePatternHdl_Impl ) ); - m_pPatternLB->SetRenameHdl( LINK( this, SvxPatternTabPage, ClickRenameHdl_Impl ) ); - m_pPatternLB->SetDeleteHdl( LINK( this, SvxPatternTabPage, ClickDeleteHdl_Impl ) ); - m_pLbColor->SetSelectHdl( LINK( this, SvxPatternTabPage, ChangeColorHdl_Impl ) ); - m_pLbBackgroundColor->SetSelectHdl( LINK( this, SvxPatternTabPage, ChangeColorHdl_Impl ) ); + m_xBtnAdd->connect_clicked( LINK( this, SvxPatternTabPage, ClickAddHdl_Impl ) ); + m_xBtnModify->connect_clicked( LINK( this, SvxPatternTabPage, ClickModifyHdl_Impl ) ); - setPreviewsToSamePlace(pParent, this); + m_xPatternLB->SetSelectHdl( LINK( this, SvxPatternTabPage, ChangePatternHdl_Impl ) ); + m_xPatternLB->SetRenameHdl( LINK( this, SvxPatternTabPage, ClickRenameHdl_Impl ) ); + m_xPatternLB->SetDeleteHdl( LINK( this, SvxPatternTabPage, ClickDeleteHdl_Impl ) ); + m_xLbColor->SetSelectHdl( LINK( this, SvxPatternTabPage, ChangeColorHdl_Impl ) ); + m_xLbBackgroundColor->SetSelectHdl( LINK( this, SvxPatternTabPage, ChangeColorHdl_Impl ) ); } SvxPatternTabPage::~SvxPatternTabPage() @@ -139,20 +131,18 @@ SvxPatternTabPage::~SvxPatternTabPage() void SvxPatternTabPage::dispose() { - m_pBitmapCtl.reset(); - m_pCtlPixel.clear(); - m_pLbColor.clear(); - m_pLbBackgroundColor.clear(); - m_pCtlPreview.clear(); - m_pBtnAdd.clear(); - m_pBtnModify.clear(); - m_pPatternLB.clear(); + m_xPatternLBWin.reset(); + m_xCtlPreview.reset(); + m_xCtlPixel.reset(); + m_xPatternLB.reset(); + m_xLbBackgroundColor.reset(); + m_xLbColor.reset(); SvxTabPage::dispose(); } void SvxPatternTabPage::Construct() { - m_pPatternLB->FillPresetListBox( *m_pPatternList ); + m_xPatternLB->FillPresetListBox( *m_pPatternList ); } void SvxPatternTabPage::ActivatePage( const SfxItemSet& rSet ) @@ -188,8 +178,8 @@ void SvxPatternTabPage::ActivatePage( const SfxItemSet& rSet ) sal_Int32 nPos = SearchPatternList( rSet.Get(XATTR_FILLBITMAP).GetName() ); if( nPos != LISTBOX_ENTRY_NOTFOUND ) { - sal_uInt16 nId = m_pPatternLB->GetItemId( static_cast<size_t>( nPos ) ); - m_pPatternLB->SelectItem( nId ); + sal_uInt16 nId = m_xPatternLB->GetItemId( static_cast<size_t>( nPos ) ); + m_xPatternLB->SelectItem( nId ); } } } @@ -207,17 +197,17 @@ DeactivateRC SvxPatternTabPage::DeactivatePage( SfxItemSet* _pSet) bool SvxPatternTabPage::FillItemSet( SfxItemSet* _rOutAttrs ) { _rOutAttrs->Put(XFillStyleItem(drawing::FillStyle_BITMAP)); - size_t nPos = m_pPatternLB->IsNoSelection() ? VALUESET_ITEM_NOTFOUND : m_pPatternLB->GetSelectItemPos(); + size_t nPos = m_xPatternLB->IsNoSelection() ? VALUESET_ITEM_NOTFOUND : m_xPatternLB->GetSelectItemPos(); if(VALUESET_ITEM_NOTFOUND != nPos) { const XBitmapEntry* pXBitmapEntry = m_pPatternList->GetBitmap( static_cast<sal_uInt16>(nPos) ); - const OUString aString( m_pPatternLB->GetItemText( m_pPatternLB->GetSelectedItemId() ) ); + const OUString aString( m_xPatternLB->GetItemText( m_xPatternLB->GetSelectedItemId() ) ); _rOutAttrs->Put(XFillBitmapItem(aString, pXBitmapEntry->GetGraphicObject())); } else { - const BitmapEx aBitmapEx(m_pBitmapCtl->GetBitmapEx()); + const BitmapEx aBitmapEx(m_xBitmapCtl->GetBitmapEx()); _rOutAttrs->Put(XFillBitmapItem(OUString(), Graphic(aBitmapEx))); } @@ -227,27 +217,27 @@ bool SvxPatternTabPage::FillItemSet( SfxItemSet* _rOutAttrs ) void SvxPatternTabPage::Reset( const SfxItemSet* ) { - m_pBitmapCtl->SetPixelColor( m_pLbColor->GetSelectEntryColor() ); - m_pBitmapCtl->SetBackgroundColor( m_pLbBackgroundColor->GetSelectEntryColor() ); - m_pBitmapCtl->SetBmpArray( m_pCtlPixel->GetBitmapPixelPtr() ); + m_xBitmapCtl->SetPixelColor( m_xLbColor->GetSelectEntryColor() ); + m_xBitmapCtl->SetBackgroundColor( m_xLbBackgroundColor->GetSelectEntryColor() ); + m_xBitmapCtl->SetBmpArray( m_aCtlPixel.GetBitmapPixelPtr() ); // get bitmap and display it - const XFillBitmapItem aBmpItem(OUString(), Graphic(m_pBitmapCtl->GetBitmapEx())); + const XFillBitmapItem aBmpItem(OUString(), Graphic(m_xBitmapCtl->GetBitmapEx())); m_rXFSet.Put( aBmpItem ); - m_pCtlPreview->SetAttributes( m_aXFillAttr.GetItemSet() ); - m_pCtlPreview->Invalidate(); + m_aCtlPreview.SetAttributes( m_aXFillAttr.GetItemSet() ); + m_aCtlPreview.Invalidate(); - ChangePatternHdl_Impl( m_pPatternLB ); + ChangePatternHdl_Impl(m_xPatternLB.get()); // determine button state if( m_pPatternList.is() && m_pPatternList->Count() ) { - m_pBtnAdd->Enable(); - m_pBtnModify->Enable(); + m_xBtnAdd->set_sensitive(true); + m_xBtnModify->set_sensitive(true); } else { - m_pBtnModify->Disable(); + m_xBtnModify->set_sensitive(false);; } } @@ -255,14 +245,14 @@ void SvxPatternTabPage::Reset( const SfxItemSet* ) VclPtr<SfxTabPage> SvxPatternTabPage::Create( TabPageParent pWindow, const SfxItemSet* rSet ) { - return VclPtr<SvxPatternTabPage>::Create( pWindow.pParent, *rSet ); + return VclPtr<SvxPatternTabPage>::Create(pWindow, *rSet); } -IMPL_LINK_NOARG(SvxPatternTabPage, ChangePatternHdl_Impl, ValueSet*, void) +IMPL_LINK_NOARG(SvxPatternTabPage, ChangePatternHdl_Impl, SvtValueSet*, void) { std::unique_ptr<GraphicObject> pGraphicObject; - size_t nPos = m_pPatternLB->GetSelectItemPos(); + size_t nPos = m_xPatternLB->GetSelectItemPos(); if(VALUESET_ITEM_NOTFOUND != nPos) { @@ -284,8 +274,8 @@ IMPL_LINK_NOARG(SvxPatternTabPage, ChangePatternHdl_Impl, ValueSet*, void) if(!pGraphicObject) { - sal_uInt16 nPosition = m_pPatternLB->GetItemId( 0 ); - m_pPatternLB->SelectItem( nPosition ); + sal_uInt16 nPosition = m_xPatternLB->GetItemId( 0 ); + m_xPatternLB->SelectItem( nPosition ); if( nPosition != 0 ) { pGraphicObject.reset(new GraphicObject(m_pPatternList->GetBitmap(0)->GetGraphicObject())); @@ -299,48 +289,47 @@ IMPL_LINK_NOARG(SvxPatternTabPage, ChangePatternHdl_Impl, ValueSet*, void) BitmapColor aFront; bool bIs8x8(vcl::bitmap::isHistorical8x8(pGraphicObject->GetGraphic().GetBitmapEx(), aBack, aFront)); - m_pLbColor->SetNoSelection(); - m_pLbBackgroundColor->SetNoSelection(); + m_xLbColor->SetNoSelection(); + m_xLbBackgroundColor->SetNoSelection(); if(bIs8x8) { - m_pCtlPixel->SetPaintable( true ); - m_pBtnModify->Enable(); - m_pBtnAdd->Enable(); + m_aCtlPixel.SetPaintable( true ); + m_xBtnModify->set_sensitive(true); + m_xBtnAdd->set_sensitive(true); // setting the pixel control - m_pCtlPixel->SetXBitmap(pGraphicObject->GetGraphic().GetBitmapEx()); + m_aCtlPixel.SetXBitmap(pGraphicObject->GetGraphic().GetBitmapEx()); Color aPixelColor = aFront.GetColor(); Color aBackColor = aBack.GetColor(); - m_pLbColor->SelectEntry( aPixelColor ); - m_pLbBackgroundColor->SelectEntry( aBackColor ); + m_xLbColor->SelectEntry( aPixelColor ); + m_xLbBackgroundColor->SelectEntry( aBackColor ); - // update m_pBitmapCtl, rXFSet and m_pCtlPreview - m_pBitmapCtl->SetPixelColor( aPixelColor ); - m_pBitmapCtl->SetBackgroundColor( aBackColor ); + // update m_xBitmapCtl, rXFSet and m_aCtlPreview + m_xBitmapCtl->SetPixelColor( aPixelColor ); + m_xBitmapCtl->SetBackgroundColor( aBackColor ); m_rXFSet.ClearItem(); m_rXFSet.Put(XFillStyleItem(drawing::FillStyle_BITMAP)); - m_rXFSet.Put(XFillBitmapItem(OUString(), Graphic(m_pBitmapCtl->GetBitmapEx()))); - m_pCtlPreview->SetAttributes( m_aXFillAttr.GetItemSet() ); - m_pCtlPreview->Invalidate(); + m_rXFSet.Put(XFillBitmapItem(OUString(), Graphic(m_xBitmapCtl->GetBitmapEx()))); + m_aCtlPreview.SetAttributes( m_aXFillAttr.GetItemSet() ); + m_aCtlPreview.Invalidate(); } else { - m_pCtlPixel->Reset(); - m_pCtlPixel->SetPaintable( false ); - m_pBtnModify->Disable(); - m_pBtnAdd->Disable(); + m_aCtlPixel.Reset(); + m_aCtlPixel.SetPaintable( false ); + m_xBtnModify->set_sensitive(false); + m_xBtnAdd->set_sensitive(false); } - m_pCtlPixel->Invalidate(); + m_aCtlPixel.Invalidate(); } } - -IMPL_LINK_NOARG(SvxPatternTabPage, ClickAddHdl_Impl, Button*, void) +IMPL_LINK_NOARG(SvxPatternTabPage, ClickAddHdl_Impl, weld::Button&, void) { OUString aNewName( SvxResId( RID_SVXSTR_PATTERN_UNTITLED ) ); @@ -358,7 +347,7 @@ IMPL_LINK_NOARG(SvxPatternTabPage, ClickAddHdl_Impl, Button*, void) } SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - ScopedVclPtr<AbstractSvxNameDialog> pDlg(pFact->CreateSvxNameDialog(GetFrameWeld(), aName, aDesc)); + ScopedVclPtr<AbstractSvxNameDialog> pDlg(pFact->CreateSvxNameDialog(GetTabDialog()->GetFrameWeld(), aName, aDesc)); sal_uInt16 nError(1); while( pDlg->Execute() == RET_OK ) @@ -372,7 +361,7 @@ IMPL_LINK_NOARG(SvxPatternTabPage, ClickAddHdl_Impl, Button*, void) break; } - std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "cui/ui/queryduplicatedialog.ui")); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetTabDialog()->GetFrameWeld(), "cui/ui/queryduplicatedialog.ui")); std::unique_ptr<weld::MessageDialog> xWarnBox(xBuilder->weld_message_dialog("DuplicateNameDialog")); if (xWarnBox->run() != RET_OK) break; @@ -383,9 +372,9 @@ IMPL_LINK_NOARG(SvxPatternTabPage, ClickAddHdl_Impl, Button*, void) if( !nError ) { std::unique_ptr<XBitmapEntry> pEntry; - if( m_pCtlPixel->IsEnabled() ) + if( m_aCtlPixel.IsEnabled() ) { - const BitmapEx aBitmapEx(m_pBitmapCtl->GetBitmapEx()); + const BitmapEx aBitmapEx(m_xBitmapCtl->GetBitmapEx()); pEntry.reset(new XBitmapEntry(Graphic(aBitmapEx), aName)); } @@ -404,58 +393,53 @@ IMPL_LINK_NOARG(SvxPatternTabPage, ClickAddHdl_Impl, Button*, void) if( pEntry ) { m_pPatternList->Insert(std::move(pEntry), nCount); - sal_Int32 nId = m_pPatternLB->GetItemId( nCount - 1 ); - BitmapEx aBitmap = m_pPatternList->GetBitmapForPreview( nCount, m_pPatternLB->GetIconSize() ); - m_pPatternLB->InsertItem( nId + 1, Image(aBitmap), aName ); - m_pPatternLB->SelectItem( nId + 1 ); - m_pPatternLB->Resize(); + sal_Int32 nId = m_xPatternLB->GetItemId( nCount - 1 ); + BitmapEx aBitmap = m_pPatternList->GetBitmapForPreview( nCount, m_xPatternLB->GetIconSize() ); + m_xPatternLB->InsertItem( nId + 1, Image(aBitmap), aName ); + m_xPatternLB->SelectItem( nId + 1 ); + m_xPatternLB->Resize(); *m_pnPatternListState |= ChangeType::MODIFIED; - ChangePatternHdl_Impl( m_pPatternLB ); + ChangePatternHdl_Impl(m_xPatternLB.get()); } } // determine button state if( m_pPatternList->Count() ) { - m_pBtnModify->Enable(); + m_xBtnModify->set_sensitive(true); } } - -/******************************************************************************/ -/******************************************************************************/ - - -IMPL_LINK_NOARG(SvxPatternTabPage, ClickModifyHdl_Impl, Button*, void) +IMPL_LINK_NOARG(SvxPatternTabPage, ClickModifyHdl_Impl, weld::Button&, void) { - sal_uInt16 nId = m_pPatternLB->GetSelectedItemId(); - size_t nPos = m_pPatternLB->GetSelectItemPos(); + sal_uInt16 nId = m_xPatternLB->GetSelectedItemId(); + size_t nPos = m_xPatternLB->GetSelectItemPos(); if ( nPos != VALUESET_ITEM_NOTFOUND ) { OUString aName( m_pPatternList->GetBitmap( static_cast<sal_uInt16>(nPos) )->GetName() ); - const BitmapEx aBitmapEx(m_pBitmapCtl->GetBitmapEx()); + const BitmapEx aBitmapEx(m_xBitmapCtl->GetBitmapEx()); // #i123497# Need to replace the existing entry with a new one (old returned needs to be deleted) m_pPatternList->Replace(o3tl::make_unique<XBitmapEntry>(Graphic(aBitmapEx), aName), nPos); - BitmapEx aBitmap = m_pPatternList->GetBitmapForPreview( static_cast<sal_uInt16>( nPos ), m_pPatternLB->GetIconSize() ); - m_pPatternLB->RemoveItem(nId); - m_pPatternLB->InsertItem( nId, Image(aBitmap), aName, static_cast<sal_uInt16>(nPos) ); - m_pPatternLB->SelectItem( nId ); + BitmapEx aBitmap = m_pPatternList->GetBitmapForPreview( static_cast<sal_uInt16>( nPos ), m_xPatternLB->GetIconSize() ); + m_xPatternLB->RemoveItem(nId); + m_xPatternLB->InsertItem( nId, Image(aBitmap), aName, static_cast<sal_uInt16>(nPos) ); + m_xPatternLB->SelectItem( nId ); *m_pnPatternListState |= ChangeType::MODIFIED; } } -IMPL_LINK_NOARG(SvxPatternTabPage, ClickRenameHdl_Impl, SvxPresetListBox*, void) +IMPL_LINK_NOARG(SvxPatternTabPage, ClickRenameHdl_Impl, PresetListBox*, void) { - size_t nPos = m_pPatternLB->GetSelectItemPos(); - sal_Int32 nId = m_pPatternLB->GetSelectedItemId(); + size_t nPos = m_xPatternLB->GetSelectItemPos(); + sal_Int32 nId = m_xPatternLB->GetSelectedItemId(); if ( nPos != VALUESET_ITEM_NOTFOUND ) { @@ -463,7 +447,7 @@ IMPL_LINK_NOARG(SvxPatternTabPage, ClickRenameHdl_Impl, SvxPresetListBox*, void) OUString aName(m_pPatternList->GetBitmap(nPos)->GetName()); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - ScopedVclPtr<AbstractSvxNameDialog> pDlg(pFact->CreateSvxNameDialog(GetFrameWeld(), aName, aDesc)); + ScopedVclPtr<AbstractSvxNameDialog> pDlg(pFact->CreateSvxNameDialog(GetTabDialog()->GetFrameWeld(), aName, aDesc)); bool bLoop = true; @@ -479,14 +463,14 @@ IMPL_LINK_NOARG(SvxPatternTabPage, ClickRenameHdl_Impl, SvxPresetListBox*, void) m_pPatternList->GetBitmap(nPos)->SetName(aName); - m_pPatternLB->SetItemText( nId, aName ); - m_pPatternLB->SelectItem( nId ); + m_xPatternLB->SetItemText( nId, aName ); + m_xPatternLB->SelectItem( nId ); *m_pnPatternListState |= ChangeType::MODIFIED; } else { - std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "cui/ui/queryduplicatedialog.ui")); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetTabDialog()->GetFrameWeld(), "cui/ui/queryduplicatedialog.ui")); std::unique_ptr<weld::MessageDialog> xWarnBox(xBuilder->weld_message_dialog("DuplicateNameDialog")); xWarnBox->run(); } @@ -494,27 +478,27 @@ IMPL_LINK_NOARG(SvxPatternTabPage, ClickRenameHdl_Impl, SvxPresetListBox*, void) } } -IMPL_LINK_NOARG(SvxPatternTabPage, ClickDeleteHdl_Impl, SvxPresetListBox*, void) +IMPL_LINK_NOARG(SvxPatternTabPage, ClickDeleteHdl_Impl, PresetListBox*, void) { - sal_uInt16 nId = m_pPatternLB->GetSelectedItemId(); - size_t nPos = m_pPatternLB->GetSelectItemPos(); + sal_uInt16 nId = m_xPatternLB->GetSelectedItemId(); + size_t nPos = m_xPatternLB->GetSelectItemPos(); if( nPos != VALUESET_ITEM_NOTFOUND ) { - std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "cui/ui/querydeletebitmapdialog.ui")); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetTabDialog()->GetFrameWeld(), "cui/ui/querydeletebitmapdialog.ui")); std::unique_ptr<weld::MessageDialog> xQueryBox(xBuilder->weld_message_dialog("AskDelBitmapDialog")); if (xQueryBox->run() == RET_YES) { m_pPatternList->Remove(nPos); - m_pPatternLB->RemoveItem( nId ); - nId = m_pPatternLB->GetItemId(0); - m_pPatternLB->SelectItem( nId ); - m_pPatternLB->Resize(); + m_xPatternLB->RemoveItem( nId ); + nId = m_xPatternLB->GetItemId(0); + m_xPatternLB->SelectItem( nId ); + m_xPatternLB->Resize(); - m_pCtlPreview->Invalidate(); - m_pCtlPixel->Invalidate(); + m_aCtlPreview.Invalidate(); + m_aCtlPixel.Invalidate(); - ChangePatternHdl_Impl( m_pPatternLB ); + ChangePatternHdl_Impl(m_xPatternLB.get()); *m_pnPatternListState |= ChangeType::MODIFIED; } @@ -522,56 +506,49 @@ IMPL_LINK_NOARG(SvxPatternTabPage, ClickDeleteHdl_Impl, SvxPresetListBox*, void) // determine button state if( !m_pPatternList->Count() ) { - m_pBtnModify->Disable(); + m_xBtnModify->set_sensitive(false); } } -IMPL_LINK_NOARG(SvxPatternTabPage, ChangeColorHdl_Impl, SvxColorListBox&, void) +IMPL_LINK_NOARG(SvxPatternTabPage, ChangeColorHdl_Impl, ColorListBox&, void) { ChangeColor_Impl(); - m_pPatternLB->SetNoSelection(); + m_xPatternLB->SetNoSelection(); } void SvxPatternTabPage::ChangeColor_Impl() { - m_pCtlPixel->SetPixelColor( m_pLbColor->GetSelectEntryColor() ); - m_pCtlPixel->SetBackgroundColor( m_pLbBackgroundColor->GetSelectEntryColor() ); - m_pCtlPixel->Invalidate(); + m_aCtlPixel.SetPixelColor( m_xLbColor->GetSelectEntryColor() ); + m_aCtlPixel.SetBackgroundColor( m_xLbBackgroundColor->GetSelectEntryColor() ); + m_aCtlPixel.Invalidate(); - m_pBitmapCtl->SetPixelColor( m_pLbColor->GetSelectEntryColor() ); - m_pBitmapCtl->SetBackgroundColor( m_pLbBackgroundColor->GetSelectEntryColor() ); + m_xBitmapCtl->SetPixelColor( m_xLbColor->GetSelectEntryColor() ); + m_xBitmapCtl->SetBackgroundColor( m_xLbBackgroundColor->GetSelectEntryColor() ); // get bitmap and display it - m_rXFSet.Put(XFillBitmapItem(OUString(), Graphic(m_pBitmapCtl->GetBitmapEx()))); - m_pCtlPreview->SetAttributes( m_aXFillAttr.GetItemSet() ); - m_pCtlPreview->Invalidate(); + m_rXFSet.Put(XFillBitmapItem(OUString(), Graphic(m_xBitmapCtl->GetBitmapEx()))); + m_aCtlPreview.SetAttributes( m_aXFillAttr.GetItemSet() ); + m_aCtlPreview.Invalidate(); } -void SvxPatternTabPage::PointChanged( vcl::Window* pWindow, RectPoint ) +void SvxPatternTabPage::PointChanged( vcl::Window*, RectPoint ) { - if( pWindow == m_pCtlPixel ) - { - m_pBitmapCtl->SetBmpArray( m_pCtlPixel->GetBitmapPixelPtr() ); - - // get bitmap and display it - m_rXFSet.Put(XFillBitmapItem(OUString(), Graphic(m_pBitmapCtl->GetBitmapEx()))); - m_pCtlPreview->SetAttributes( m_aXFillAttr.GetItemSet() ); - m_pCtlPreview->Invalidate(); - } - - m_pPatternLB->SetNoSelection(); + assert(false); } -void SvxPatternTabPage::PointChanged( weld::DrawingArea*, RectPoint ) +void SvxPatternTabPage::PointChanged(weld::DrawingArea* pDrawingArea, RectPoint) { - m_pBitmapCtl->SetBmpArray( m_pCtlPixel->GetBitmapPixelPtr() ); + if (pDrawingArea == m_aCtlPixel.GetDrawingArea()) + { + m_xBitmapCtl->SetBmpArray(m_aCtlPixel.GetBitmapPixelPtr()); - // get bitmap and display it - m_rXFSet.Put(XFillBitmapItem(OUString(), Graphic(m_pBitmapCtl->GetBitmapEx()))); - m_pCtlPreview->SetAttributes( m_aXFillAttr.GetItemSet() ); - m_pCtlPreview->Invalidate(); + // get bitmap and display it + m_rXFSet.Put(XFillBitmapItem(OUString(), Graphic(m_xBitmapCtl->GetBitmapEx()))); + m_aCtlPreview.SetAttributes( m_aXFillAttr.GetItemSet() ); + m_aCtlPreview.Invalidate(); + } - m_pPatternLB->SetNoSelection(); + m_xPatternLB->SetNoSelection(); } sal_Int32 SvxPatternTabPage::SearchPatternList(const OUString& rPatternName) diff --git a/cui/uiconfig/ui/areatabpage.ui b/cui/uiconfig/ui/areatabpage.ui index f1165815fe4c..6f21498a0467 100644 --- a/cui/uiconfig/ui/areatabpage.ui +++ b/cui/uiconfig/ui/areatabpage.ui @@ -41,7 +41,7 @@ </packing> </child> <child> - <object class="GtkButton" id="btnnone"> + <object class="GtkToggleButton" id="btnnone"> <property name="label" translatable="yes" context="areatabpage|btnnone">None</property> <property name="visible">True</property> <property name="can_focus">True</property> @@ -54,7 +54,7 @@ </packing> </child> <child> - <object class="GtkButton" id="btncolor"> + <object class="GtkToggleButton" id="btncolor"> <property name="label" translatable="yes" context="areatabpage|btncolor">Color</property> <property name="visible">True</property> <property name="can_focus">True</property> @@ -67,7 +67,7 @@ </packing> </child> <child> - <object class="GtkButton" id="btngradient"> + <object class="GtkToggleButton" id="btngradient"> <property name="label" translatable="yes" context="areatabpage|btngradient">Gradient</property> <property name="visible">True</property> <property name="can_focus">True</property> @@ -80,7 +80,7 @@ </packing> </child> <child> - <object class="GtkButton" id="btnbitmap"> + <object class="GtkToggleButton" id="btnbitmap"> <property name="label" translatable="yes" context="areatabpage|btnbitmap">Bitmap</property> <property name="visible">True</property> <property name="can_focus">True</property> @@ -93,7 +93,7 @@ </packing> </child> <child> - <object class="GtkButton" id="btnpattern"> + <object class="GtkToggleButton" id="btnpattern"> <property name="label" translatable="yes" context="areatabpage|btnpattern">Pattern</property> <property name="visible">True</property> <property name="can_focus">True</property> @@ -106,7 +106,7 @@ </packing> </child> <child> - <object class="GtkButton" id="btnhatch"> + <object class="GtkToggleButton" id="btnhatch"> <property name="label" translatable="yes" context="areatabpage|btnhatch">Hatch</property> <property name="visible">True</property> <property name="can_focus">True</property> diff --git a/cui/uiconfig/ui/bitmaptabpage.ui b/cui/uiconfig/ui/bitmaptabpage.ui index 69ebb75224ad..78792593c776 100644 --- a/cui/uiconfig/ui/bitmaptabpage.ui +++ b/cui/uiconfig/ui/bitmaptabpage.ui @@ -1,11 +1,17 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.18.3 --> +<!-- Generated with glade 3.22.1 --> <interface domain="cui"> <requires lib="gtk+" version="3.18"/> - <requires lib="LibreOffice" version="1.0"/> + <object class="GtkAdjustment" id="adjustment1"> + <property name="upper">100</property> + <property name="step_increment">1</property> + <property name="page_increment">10</property> + </object> <object class="GtkBox" id="BitmapTabPage"> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> <property name="border_width">6</property> <property name="spacing">6</property> <child> @@ -23,17 +29,35 @@ <property name="top_padding">6</property> <property name="left_padding">12</property> <child> - <object class="GtkVBox" id="box1"> + <object class="GtkBox" id="box1"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="halign">start</property> + <property name="orientation">vertical</property> <property name="spacing">6</property> <child> - <object class="svxcorelo-SvxPresetListBox" id="BITMAP"> + <object class="GtkScrolledWindow" id="bitmapwin"> <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="vscrollbar_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="BITMAP"> + <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> @@ -171,7 +195,7 @@ <property name="can_focus">False</property> <property name="label" translatable="yes" context="bitmaptabpage|label5">Width:</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">width:0%</property> + <property name="mnemonic_widget">width</property> </object> <packing> <property name="expand">False</property> @@ -180,7 +204,7 @@ </packing> </child> <child> - <object class="GtkSpinButton" id="width:0%"> + <object class="GtkSpinButton" id="width"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="hexpand">True</property> @@ -197,7 +221,7 @@ <property name="can_focus">False</property> <property name="label" translatable="yes" context="bitmaptabpage|label6">Height:</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">height:0%</property> + <property name="mnemonic_widget">height</property> </object> <packing> <property name="expand">False</property> @@ -206,7 +230,7 @@ </packing> </child> <child> - <object class="GtkSpinButton" id="height:0%"> + <object class="GtkSpinButton" id="height"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="hexpand">True</property> @@ -328,7 +352,7 @@ <property name="can_focus">False</property> <property name="label" translatable="yes" context="bitmaptabpage|label10">X-Offset:</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">posoffx:0%</property> + <property name="mnemonic_widget">posoffx</property> </object> <packing> <property name="expand">False</property> @@ -337,7 +361,7 @@ </packing> </child> <child> - <object class="GtkSpinButton" id="posoffx:0%"> + <object class="GtkSpinButton" id="posoffx"> <property name="visible">True</property> <property name="can_focus">True</property> </object> @@ -353,7 +377,7 @@ <property name="can_focus">False</property> <property name="label" translatable="yes" context="bitmaptabpage|label11">Y-Offset:</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">posoffy:0%</property> + <property name="mnemonic_widget">posoffy</property> </object> <packing> <property name="expand">False</property> @@ -362,7 +386,7 @@ </packing> </child> <child> - <object class="GtkSpinButton" id="posoffy:0%"> + <object class="GtkSpinButton" id="posoffy"> <property name="visible">True</property> <property name="can_focus">True</property> </object> @@ -429,10 +453,11 @@ </packing> </child> <child> - <object class="GtkSpinButton" id="tileoffmtr:0%"> + <object class="GtkSpinButton" id="tileoffmtr"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="hexpand">True</property> + <property name="adjustment">adjustment1</property> </object> <packing> <property name="expand">False</property> @@ -498,14 +523,31 @@ <property name="valign">start</property> <property name="orientation">vertical</property> <child> - <object class="svxlo-SvxXRectPreview" id="CTL_BITMAP_PREVIEW"> + <object class="GtkScrolledWindow"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can_focus">True</property> <property name="hexpand">True</property> <property name="vexpand">True</property> - <child internal-child="accessible"> - <object class="AtkObject" id="CTL_BITMAP_PREVIEW-atkobject"> - <property name="AtkObject::accessible-name" translatable="yes" context="bitmaptabpage|CTL_BITMAP_PREVIEW-atkobject">Example</property> + <property name="hscrollbar_policy">never</property> + <property name="vscrollbar_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="CTL_BITMAP_PREVIEW"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <child internal-child="accessible"> + <object class="AtkObject" id="CTL_BITMAP_PREVIEW-atkobject"> + <property name="AtkObject::accessible-name" translatable="yes" context="bitmaptabpage|CTL_BITMAP_PREVIEW-atkobject">Example</property> + </object> + </child> + </object> + </child> </object> </child> </object> diff --git a/cui/uiconfig/ui/colorpage.ui b/cui/uiconfig/ui/colorpage.ui index a629ee08c03a..431f0a7511c3 100644 --- a/cui/uiconfig/ui/colorpage.ui +++ b/cui/uiconfig/ui/colorpage.ui @@ -319,14 +319,31 @@ <property name="can_focus">False</property> <property name="orientation">vertical</property> <child> - <object class="GtkDrawingArea" id="oldpreview"> + <object class="GtkScrolledWindow"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can_focus">True</property> <property name="hexpand">True</property> <property name="vexpand">True</property> - <child internal-child="accessible"> - <object class="AtkObject" id="oldpreview-atkobject"> - <property name="AtkObject::accessible-name" translatable="yes" context="colorpage|oldpreview-atkobject">Old Color</property> + <property name="hscrollbar_policy">never</property> + <property name="vscrollbar_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="oldpreview"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <child internal-child="accessible"> + <object class="AtkObject" id="oldpreview-atkobject"> + <property name="AtkObject::accessible-name" translatable="yes" context="colorpage|oldpreview-atkobject">Old Color</property> + </object> + </child> + </object> + </child> </object> </child> </object> @@ -621,14 +638,31 @@ <property name="can_focus">False</property> <property name="orientation">vertical</property> <child> - <object class="GtkDrawingArea" id="newpreview"> + <object class="GtkScrolledWindow"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can_focus">True</property> <property name="hexpand">True</property> <property name="vexpand">True</property> - <child internal-child="accessible"> - <object class="AtkObject" id="newpreview-atkobject"> - <property name="AtkObject::accessible-name" translatable="yes" context="colorpage|newpreview-atkobject">New Color</property> + <property name="hscrollbar_policy">never</property> + <property name="vscrollbar_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="newpreview"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <child internal-child="accessible"> + <object class="AtkObject" id="newpreview-atkobject"> + <property name="AtkObject::accessible-name" translatable="yes" context="colorpage|newpreview-atkobject">New Color</property> + </object> + </child> + </object> + </child> </object> </child> </object> diff --git a/cui/uiconfig/ui/gradientpage.ui b/cui/uiconfig/ui/gradientpage.ui index f275b931cbd5..2021908ed03d 100644 --- a/cui/uiconfig/ui/gradientpage.ui +++ b/cui/uiconfig/ui/gradientpage.ui @@ -1,14 +1,25 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.18.3 --> +<!-- Generated with glade 3.22.1 --> <interface domain="cui"> <requires lib="gtk+" version="3.18"/> - <requires lib="LibreOffice" version="1.0"/> <object class="GtkAdjustment" id="adjustment1"> <property name="lower">3</property> <property name="upper">256</property> <property name="step_increment">1</property> <property name="page_increment">10</property> </object> + <object class="GtkAdjustment" id="adjustment2"> + <property name="lower">3</property> + <property name="upper">256</property> + <property name="value">3</property> + <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="angleadjustment"> <property name="upper">359</property> <property name="step_increment">15</property> @@ -17,6 +28,22 @@ <property name="upper">100</property> <property name="step_increment">5</property> </object> + <object class="GtkAdjustment" id="percentadjustment1"> + <property name="upper">100</property> + <property name="step_increment">5</property> + </object> + <object class="GtkAdjustment" id="percentadjustment2"> + <property name="upper">100</property> + <property name="step_increment">5</property> + </object> + <object class="GtkAdjustment" id="percentadjustment3"> + <property name="upper">100</property> + <property name="step_increment">5</property> + </object> + <object class="GtkAdjustment" id="percentadjustment4"> + <property name="upper">100</property> + <property name="step_increment">5</property> + </object> <object class="GtkBox" id="GradientPage"> <property name="visible">True</property> <property name="can_focus">False</property> @@ -41,11 +68,28 @@ <property name="orientation">vertical</property> <property name="spacing">6</property> <child> - <object class="svxcorelo-SvxPresetListBox" id="gradientpresetlist"> + <object class="GtkScrolledWindow" id="gradientpresetlistwin"> <property name="visible">True</property> - <property name="can_focus">False</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="vscrollbar_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="gradientpresetlist"> + <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> @@ -210,6 +254,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="hexpand">True</property> + <property name="adjustment">adjustment2</property> <property name="round_digits">1</property> <property name="draw_value">False</property> </object> @@ -271,7 +316,7 @@ <property name="can_focus">False</property> <property name="label" translatable="yes" context="gradientpage|angleft">A_ngle:</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">anglemtr:0degrees</property> + <property name="mnemonic_widget">anglemtr</property> <property name="xalign">0</property> <property name="yalign">0.43999999761581421</property> </object> @@ -281,7 +326,7 @@ </packing> </child> <child> - <object class="GtkSpinButton" id="anglemtr:0degrees"> + <object class="GtkSpinButton" id="anglemtr"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="adjustment">angleadjustment</property> @@ -312,11 +357,11 @@ <property name="hexpand">True</property> <property name="spacing">6</property> <child> - <object class="GtkSpinButton" id="centerxmtr:%"> + <object class="GtkSpinButton" id="centerxmtr"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="hexpand">True</property> - <property name="adjustment">percentadjustment</property> + <property name="adjustment">percentadjustment3</property> </object> <packing> <property name="expand">True</property> @@ -325,11 +370,11 @@ </packing> </child> <child> - <object class="GtkSpinButton" id="centerymtr:%"> + <object class="GtkSpinButton" id="centerymtr"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="hexpand">True</property> - <property name="adjustment">percentadjustment</property> + <property name="adjustment">percentadjustment4</property> </object> <packing> <property name="expand">True</property> @@ -363,7 +408,7 @@ <property name="can_focus">False</property> <property name="label" translatable="yes" context="gradientpage|borderft">_Border:</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">bordermtr:%</property> + <property name="mnemonic_widget">bordermtr</property> <property name="xalign">0</property> <property name="yalign">0.43999999761581421</property> </object> @@ -377,6 +422,8 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="hexpand">True</property> + <property name="adjustment">adjustment3</property> + <property name="fill_level">0</property> <property name="round_digits">1</property> <property name="draw_value">False</property> </object> @@ -386,7 +433,7 @@ </packing> </child> <child> - <object class="GtkSpinButton" id="bordermtr:%"> + <object class="GtkSpinButton" id="bordermtr"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="halign">end</property> @@ -429,11 +476,14 @@ </packing> </child> <child> - <object class="svxcorelo-SvxColorListBox" id="colorfromlb"> + <object class="GtkMenuButton" id="colorfromlb"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="entry_text_column">0</property> - <property name="id_column">1</property> + <property name="receives_default">False</property> + <property name="xalign">0</property> + <child> + <placeholder/> + </child> </object> <packing> <property name="left_attach">0</property> @@ -441,11 +491,11 @@ </packing> </child> <child> - <object class="GtkSpinButton" id="colorfrommtr:%"> + <object class="GtkSpinButton" id="colorfrommtr"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="margin_left">6</property> - <property name="adjustment">percentadjustment</property> + <property name="adjustment">percentadjustment1</property> </object> <packing> <property name="left_attach">1</property> @@ -470,11 +520,14 @@ <property name="row_spacing">3</property> <property name="column_spacing">6</property> <child> - <object class="svxcorelo-SvxColorListBox" id="colortolb"> + <object class="GtkMenuButton" id="colortolb"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="entry_text_column">0</property> - <property name="id_column">1</property> + <property name="receives_default">False</property> + <property name="xalign">0</property> + <child> + <placeholder/> + </child> </object> <packing> <property name="left_attach">0</property> @@ -482,11 +535,11 @@ </packing> </child> <child> - <object class="GtkSpinButton" id="colortomtr:%"> + <object class="GtkSpinButton" id="colortomtr"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="margin_left">6</property> - <property name="adjustment">percentadjustment</property> + <property name="adjustment">percentadjustment2</property> </object> <packing> <property name="left_attach">1</property> @@ -526,7 +579,7 @@ <property name="can_focus">False</property> <property name="label" translatable="yes" context="gradientpage|a11y_center_x">Center X</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">centerxmtr:%</property> + <property name="mnemonic_widget">centerxmtr</property> </object> <packing> <property name="expand">False</property> @@ -540,7 +593,7 @@ <property name="can_focus">False</property> <property name="label" translatable="yes" context="gradientpage|a11y_center_y">Center Y</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">centerymtr:%</property> + <property name="mnemonic_widget">centerymtr</property> </object> <packing> <property name="expand">False</property> @@ -554,7 +607,7 @@ <property name="can_focus">False</property> <property name="label" translatable="yes" context="gradientpage|a11y_percentage_from">From color percentage</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">colorfrommtr:%</property> + <property name="mnemonic_widget">colorfrommtr</property> </object> <packing> <property name="expand">False</property> @@ -568,7 +621,7 @@ <property name="can_focus">False</property> <property name="label" translatable="yes" context="gradientpage|a11y_percentage_to">To color percentage</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">colortomtr:%</property> + <property name="mnemonic_widget">colortomtr</property> </object> <packing> <property name="expand">False</property> @@ -628,14 +681,31 @@ <property name="valign">start</property> <property name="orientation">vertical</property> <child> - <object class="svxlo-SvxXRectPreview" id="previewctl"> + <object class="GtkScrolledWindow"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can_focus">True</property> <property name="hexpand">True</property> <property name="vexpand">True</property> - <child internal-child="accessible"> - <object class="AtkObject" id="previewctl-atkobject"> - <property name="AtkObject::accessible-name" translatable="yes" context="gradientpage|previewctl-atkobject">Example</property> + <property name="hscrollbar_policy">never</property> + <property name="vscrollbar_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="previewctl"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <child internal-child="accessible"> + <object class="AtkObject" id="previewctl-atkobject"> + <property name="AtkObject::accessible-name" translatable="yes" context="gradientpage|previewctl-atkobject">Example</property> + </object> + </child> + </object> + </child> </object> </child> </object> diff --git a/cui/uiconfig/ui/hatchpage.ui b/cui/uiconfig/ui/hatchpage.ui index 4fcf069914ba..e55dc25ea25e 100644 --- a/cui/uiconfig/ui/hatchpage.ui +++ b/cui/uiconfig/ui/hatchpage.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">359</property> <property name="step_increment">15</property> @@ -43,12 +42,29 @@ <property name="orientation">vertical</property> <property name="spacing">6</property> <child> - <object class="svxcorelo-SvxPresetListBox" id="hatchpresetlist"> + <object class="GtkScrolledWindow" id="hatchpresetlistwin"> + <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="vscrollbar_policy">never</property> + <property name="shadow_type">in</property> + <child> + <object class="GtkViewport"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="hexpand">True</property> - <property name="vexpand">True</property> + <child> + <object class="GtkDrawingArea" id="hatchpresetlist"> + <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">True</property> <property name="fill">True</property> @@ -144,9 +160,10 @@ <object class="GtkLabel" id="distanceft"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="hatchpage|distanceft">_Spacing:</property> <property name="use_underline">True</property> + <property name="mnemonic_widget">distancemtr</property> + <property name="xalign">0</property> </object> <packing> <property name="expand">False</property> @@ -155,7 +172,7 @@ </packing> </child> <child> - <object class="GtkSpinButton" id="distancemtr:0mm"> + <object class="GtkSpinButton" id="distancemtr"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="adjustment">distanceadjustment</property> @@ -170,9 +187,9 @@ <object class="GtkLabel" id="angleft"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="hatchpage|angleft">A_ngle:</property> <property name="use_underline">True</property> + <property name="xalign">0</property> </object> <packing> <property name="expand">False</property> @@ -201,7 +218,7 @@ </packing> </child> <child> - <object class="GtkSpinButton" id="anglemtr:0degrees"> + <object class="GtkSpinButton" id="anglemtr"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="adjustment">angleadjustment</property> @@ -223,9 +240,10 @@ <object class="GtkLabel" id="linetypeft"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="hatchpage|linetypeft">_Line type:</property> <property name="use_underline">True</property> + <property name="mnemonic_widget">linetypelb</property> + <property name="xalign">0</property> </object> <packing> <property name="expand">False</property> @@ -253,9 +271,10 @@ <object class="GtkLabel" id="linecolorft"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="hatchpage|linecolorft">Line _color:</property> <property name="use_underline">True</property> + <property name="mnemonic_widget">linecolorlb</property> + <property name="xalign">0</property> </object> <packing> <property name="expand">False</property> @@ -264,10 +283,17 @@ </packing> </child> <child> - <object class="svxcorelo-SvxColorListBox" id="linecolorlb"> - <property name="visible">True</property> - <property name="can_focus">False</property> - </object> + <object class="GtkMenuButton" id="linecolorlb"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="receives_default">False</property> + <property name="halign">start</property> + <property name="valign">center</property> + <property name="xalign">0</property> + <child> + <placeholder/> + </child> + </object> <packing> <property name="expand">False</property> <property name="fill">True</property> @@ -283,6 +309,9 @@ <property name="use_underline">True</property> <property name="xalign">0</property> <property name="draw_indicator">True</property> + <accessibility> + <relation type="label-for" target="backgroundcolorlb"/> + </accessibility> </object> <packing> <property name="expand">False</property> @@ -291,10 +320,20 @@ </packing> </child> <child> - <object class="svxcorelo-SvxColorListBox" id="backgroundcolorlb"> - <property name="visible">True</property> - <property name="can_focus">False</property> - </object> + <object class="GtkMenuButton" id="backgroundcolorlb"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="receives_default">False</property> + <property name="halign">start</property> + <property name="valign">center</property> + <property name="xalign">0</property> + <child> + <placeholder/> + </child> + <accessibility> + <relation type="labelled-by" target="backgroundcolor"/> + </accessibility> + </object> <packing> <property name="expand">False</property> <property name="fill">True</property> @@ -346,17 +385,34 @@ <property name="valign">start</property> <property name="orientation">vertical</property> <child> - <object class="svxlo-SvxXRectPreview" id="previewctl"> + <object class="GtkScrolledWindow"> + <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="vscrollbar_policy">never</property> + <property name="shadow_type">in</property> + <child> + <object class="GtkViewport"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="hexpand">True</property> - <property name="vexpand">True</property> - <child internal-child="accessible"> - <object class="AtkObject" id="previewctl-atkobject"> - <property name="AtkObject::accessible-name" translatable="yes" context="hatchpage|previewctl-atkobject">Example</property> + <child> + <object class="GtkDrawingArea" id="previewctl"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <child internal-child="accessible"> + <object class="AtkObject" id="previewctl-atkobject"> + <property name="AtkObject::accessible-name" translatable="yes" context="hatchpage|previewctl-atkobject">Example</property> + </object> + </child> </object> </child> </object> + </child> + </object> <packing> <property name="expand">False</property> <property name="fill">False</property> diff --git a/cui/uiconfig/ui/patterntabpage.ui b/cui/uiconfig/ui/patterntabpage.ui index 142eea461e33..57bf90ca763f 100644 --- a/cui/uiconfig/ui/patterntabpage.ui +++ b/cui/uiconfig/ui/patterntabpage.ui @@ -1,11 +1,12 @@ <?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="GtkBox" id="PatternTabPage"> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> <property name="border_width">6</property> <property name="spacing">6</property> <child> @@ -27,11 +28,28 @@ <property name="orientation">vertical</property> <property name="spacing">6</property> <child> - <object class="svxcorelo-SvxPresetListBox" id="patternpresetlist"> + <object class="GtkScrolledWindow" id="patternpresetlistwin"> <property name="visible">True</property> - <property name="can_focus">False</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="vscrollbar_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="patternpresetlist"> + <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">True</property> @@ -131,8 +149,8 @@ <object class="GtkLabel" id="label4"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="patterntabpage|label4">Pattern Editor:</property> + <property name="xalign">0</property> </object> <packing> <property name="expand">False</property> @@ -141,14 +159,31 @@ </packing> </child> <child> - <object class="svxlo-SvxPixelCtl" id="CTL_PIXEL"> + <object class="GtkScrolledWindow"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can_focus">True</property> <property name="halign">start</property> <property name="valign">start</property> - <child internal-child="accessible"> - <object class="AtkObject" id="CTL_PIXEL-atkobject"> - <property name="AtkObject::accessible-name" translatable="yes" context="patterntabpage|CTL_PIXEL-atkobject">Pattern Editor</property> + <property name="hscrollbar_policy">never</property> + <property name="vscrollbar_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="CTL_PIXEL"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="halign">start</property> + <property name="valign">start</property> + <child internal-child="accessible"> + <object class="AtkObject" id="CTL_PIXEL-atkobject"> + <property name="AtkObject::accessible-name" translatable="yes" context="patterntabpage|CTL_PIXEL-atkobject">Pattern Editor</property> + </object> + </child> + </object> + </child> </object> </child> </object> @@ -175,8 +210,10 @@ <object class="GtkLabel" id="label5"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="patterntabpage|label5">Foreground Color:</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">LB_COLOR</property> + <property name="xalign">0</property> </object> <packing> <property name="expand">False</property> @@ -185,10 +222,14 @@ </packing> </child> <child> - <object class="svxcorelo-SvxColorListBox" id="LB_COLOR"> + <object class="GtkMenuButton" id="LB_COLOR"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="halign">start</property> + <property name="receives_default">False</property> + <property name="xalign">0</property> + <child> + <placeholder/> + </child> </object> <packing> <property name="expand">False</property> @@ -213,8 +254,10 @@ <object class="GtkLabel" id="label6"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="patterntabpage|label6">Background Color:</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">LB_BACKGROUND_COLOR</property> + <property name="xalign">0</property> </object> <packing> <property name="expand">False</property> @@ -223,10 +266,14 @@ </packing> </child> <child> - <object class="svxcorelo-SvxColorListBox" id="LB_BACKGROUND_COLOR"> + <object class="GtkMenuButton" id="LB_BACKGROUND_COLOR"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="halign">start</property> + <property name="receives_default">False</property> + <property name="xalign">0</property> + <child> + <placeholder/> + </child> </object> <packing> <property name="expand">False</property> @@ -285,17 +332,34 @@ <property name="valign">start</property> <property name="orientation">vertical</property> <child> - <object class="svxlo-SvxXRectPreview" id="CTL_PREVIEW"> + <object class="GtkScrolledWindow"> + <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="vscrollbar_policy">never</property> + <property name="shadow_type">in</property> + <child> + <object class="GtkViewport"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="hexpand">True</property> - <property name="vexpand">True</property> - <child internal-child="accessible"> - <object class="AtkObject" id="CTL_PREVIEW-atkobject"> - <property name="AtkObject::accessible-name" translatable="yes" context="patterntabpage|CTL_PREVIEW-atkobject">Example</property> + <child> + <object class="GtkDrawingArea" id="CTL_PREVIEW"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <child internal-child="accessible"> + <object class="AtkObject" id="CTL_PREVIEW-atkobject"> + <property name="AtkObject::accessible-name" translatable="yes" context="patterntabpage|CTL_PREVIEW-atkobject">Example</property> + </object> + </child> </object> </child> </object> + </child> + </object> <packing> <property name="expand">False</property> <property name="fill">False</property> diff --git a/extras/source/glade/libreoffice-catalog.xml.in b/extras/source/glade/libreoffice-catalog.xml.in index 994bdd39273f..3e9db8c83a72 100644 --- a/extras/source/glade/libreoffice-catalog.xml.in +++ b/extras/source/glade/libreoffice-catalog.xml.in @@ -284,9 +284,6 @@ <glade-widget-class title="Shadow Preview" name="svxlo-SvxXShadowPreview" generic-name="Shadow Preview Window" parent="GtkDrawingArea" icon-name="widget-gtk-drawingarea"/> - <glade-widget-class title="Bitmap Pixel Editor" name="svxlo-SvxPixelCtl" - generic-name="Bitmap Pixel Editor" parent="GtkDrawingArea" - icon-name="widget-gtk-drawingarea"/> <glade-widget-class title="Svx 3D Light Control" name="svxlo-SvxLightCtl3D" generic-name="3D Light Control" parent="GtkDrawingArea" icon-name="widget-gtk-drawingarea"/> diff --git a/include/sfx2/tabdlg.hxx b/include/sfx2/tabdlg.hxx index ebcaf8c17268..d0c28f1c30f9 100644 --- a/include/sfx2/tabdlg.hxx +++ b/include/sfx2/tabdlg.hxx @@ -352,7 +352,9 @@ protected: } SfxTabDialog* GetTabDialog() const; +public: void SetTabDialog(SfxTabDialog* pDialog); +protected: SfxTabDialogController* GetDialogController() const; void SetDialogController(SfxTabDialogController* pDialog); @@ -394,6 +396,12 @@ public: css::uno::Reference< css::frame::XFrame > GetFrame(); OString GetConfigId() const; + + //TODO rename to get_preferred_size when SfxTabPage doesn't inherit from anything + Size get_container_size() const + { + return m_xContainer->get_preferred_size(); + } }; #endif diff --git a/include/svtools/valueset.hxx b/include/svtools/valueset.hxx index 1e2921ba7a5e..9acfd7712ca8 100644 --- a/include/svtools/valueset.hxx +++ b/include/svtools/valueset.hxx @@ -495,6 +495,9 @@ public: void SetStyle(WinBits nStyle); WinBits GetStyle() const { return mnStyle; } + /// Insert @rImage item with @rStr as either a legend or tooltip depending on @bShowLegend. + void InsertItem(sal_uInt16 nItemId, const Image& rImage, + const OUString& rStr, size_t nPos = VALUESET_APPEND, bool bShowLegend = false); /// Insert an @rColor item with @rStr tooltip. void InsertItem(sal_uInt16 nItemId, const Color& rColor, const OUString& rStr); @@ -533,12 +536,15 @@ public: } Color GetItemColor( sal_uInt16 nItemId ) const; + void SetItemText( sal_uInt16 nItemId, const OUString& rStr ); OUString GetItemText( sal_uInt16 nItemId ) const; bool IsColor() const { return maColor.GetTransparency() == 0; } + void SetExtraSpacing( sal_uInt16 nNewSpacing ); + void Format(vcl::RenderContext const & rRenderContext); Size CalcWindowSizePixel(const Size& rItemSize, diff --git a/include/svx/SvxPresetListBox.hxx b/include/svx/SvxPresetListBox.hxx index c9c75a5a8c7a..c886032f3b1e 100644 --- a/include/svx/SvxPresetListBox.hxx +++ b/include/svx/SvxPresetListBox.hxx @@ -65,6 +65,45 @@ public: }; +class SVX_DLLPUBLIC PresetListBox : public SvtValueSet +{ +private: + sal_uInt32 nColCount; + Size aIconSize; + Link<PresetListBox*,void> maRenameHdl; + Link<PresetListBox*,void> maDeleteHdl; + + void OnMenuItemSelected(const OString& rIdent); + + template< typename ListType, typename EntryType > + void FillPresetListBoxImpl(ListType& pList, sal_uInt32 nStartIndex); + +public: + PresetListBox(std::unique_ptr<weld::ScrolledWindow> pWindow); + + virtual void Resize() override; + virtual bool ContextMenu(const Point& rPos) override; + sal_uInt32 getColumnCount() const { return nColCount; } + Size const & GetIconSize() const { return aIconSize; } + + void SetRenameHdl( const Link<PresetListBox*,void>& rLink ) + { + maRenameHdl = rLink; + } + void SetDeleteHdl( const Link<PresetListBox*,void>& rLink ) + { + maDeleteHdl = rLink; + } + + void FillPresetListBox(XGradientList& pList, sal_uInt32 nStartIndex = 1); + void FillPresetListBox(XHatchList& pList, sal_uInt32 nStartIndex = 1); + void FillPresetListBox(XBitmapList& pList, sal_uInt32 nStartIndex = 1); + void FillPresetListBox(XPatternList& pList, sal_uInt32 nStartIndex = 1); + void DrawLayout(); + +}; + + #endif // INCLUDED_SVX_SVXPRESETLISTBOX_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/colorbox.hxx b/include/svx/colorbox.hxx index efa949db4081..6ce1d611486b 100644 --- a/include/svx/colorbox.hxx +++ b/include/svx/colorbox.hxx @@ -119,6 +119,7 @@ public: } Color const & GetSelectEntryColor() const { return m_aSelectedColor.first; } + NamedColor const & GetSelectedEntry() const { return m_aSelectedColor; } void SelectEntry(const Color& rColor); @@ -129,6 +130,8 @@ public: void SaveValue() { m_aSaveColor = GetSelectEntryColor(); } bool IsValueChangedFromSaved() const { return m_aSaveColor != GetSelectEntryColor(); } + + void set_sensitive(bool sensitive) { m_xButton->set_sensitive(sensitive); } }; /** A wrapper for SvxColorListBox. */ diff --git a/include/svx/dlgctrl.hxx b/include/svx/dlgctrl.hxx index a355c50e2907..467dc8af4961 100644 --- a/include/svx/dlgctrl.hxx +++ b/include/svx/dlgctrl.hxx @@ -216,11 +216,14 @@ public: |* Control for editing bitmaps \************************************************************************/ -class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxPixelCtl final : public Control +class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxPixelCtl final : public weld::CustomWidgetController { private: static sal_uInt16 constexpr nLines = 8; static sal_uInt16 constexpr nSquares = nLines * nLines; + + VclPtr<SvxTabPage> m_pPage; + Color aPixelColor; Color aBackgroundColor; Size aRectSize; @@ -230,20 +233,24 @@ private: Point aFocusPosition; rtl::Reference<SvxPixelCtlAccessible> m_xAccess; - using OutputDevice::SetLineColor; - tools::Rectangle implCalFocusRect( const Point& aPosition ); void ChangePixel( sal_uInt16 nPixel ); + SvxPixelCtl(SvxPixelCtl const&) = delete; + SvxPixelCtl(SvxPixelCtl&&) = delete; + SvxPixelCtl& operator=(SvxPixelCtl const&) = delete; + SvxPixelCtl& operator=(SvxPixelCtl&&) = delete; + public: - SvxPixelCtl( vcl::Window* pParent ); + SvxPixelCtl(SvxTabPage* pPage); virtual ~SvxPixelCtl() override; + virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override; virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override; virtual void MouseButtonDown( const MouseEvent& rMEvt ) override; virtual void Resize() override; - virtual Size GetOptimalSize() const override; + virtual tools::Rectangle GetFocusRect() override; void SetXBitmap( const BitmapEx& rBitmapEx ); @@ -257,10 +264,15 @@ public: void SetPaintable( bool bTmp ) { bPaintable = bTmp; } void Reset(); - virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override; + + css::uno::Reference<css::accessibility::XAccessible> getAccessibleParent() { return GetDrawingArea()->get_accessible_parent(); } + virtual css::uno::Reference<css::accessibility::XAccessible> CreateAccessible() override; + a11yrelationset get_accessible_relation_set() { return GetDrawingArea()->get_accessible_relation_set(); } + static long GetSquares() { return nSquares ; } long GetWidth() const { return aRectSize.getWidth() ; } long GetHeight() const { return aRectSize.getHeight() ; } + SvxTabPage* GetTabPage() const { return m_pPage; } //Device Pixel . long ShowPosition( const Point &pt); @@ -269,7 +281,7 @@ public: Point IndexToPoint(long nIndex) const ; long GetFocusPosIndex() const ; //Keyboard function for key input and focus handling function - virtual void KeyInput( const KeyEvent& rKEvt ) override; + virtual bool KeyInput( const KeyEvent& rKEvt ) override; virtual void GetFocus() override; virtual void LoseFocus() override; }; @@ -406,6 +418,11 @@ public: // change support virtual void StyleUpdated() override; + void SetDrawMode(DrawModeFlags nDrawMode) + { + mpBufferDevice->SetDrawMode(nDrawMode); + } + // dada read access SdrModel& getModel() const { diff --git a/include/vcl/customweld.hxx b/include/vcl/customweld.hxx index f6770c8fe4a4..167b5b97b32e 100644 --- a/include/vcl/customweld.hxx +++ b/include/vcl/customweld.hxx @@ -33,6 +33,7 @@ public: virtual void GetFocus() {} virtual void LoseFocus() {} virtual void StyleUpdated() { Invalidate(); } + virtual bool ContextMenu(const Point&) { return false; } virtual bool KeyInput(const KeyEvent&) { return false; } virtual tools::Rectangle GetFocusRect() { return tools::Rectangle(); } virtual FactoryFunction GetUITestFactory() const { return nullptr; } @@ -57,6 +58,10 @@ public: bool IsEnabled() const { return m_pDrawingArea->get_sensitive(); } int GetTextHeight() const { return m_pDrawingArea->get_text_height(); } OUString GetAccessibleName() const { return m_pDrawingArea->get_accessible_name(); } + OUString GetAccessibleDescription() const + { + return m_pDrawingArea->get_accessible_description(); + } void CaptureMouse() { m_pDrawingArea->grab_add(); } bool IsMouseCaptured() const { return m_pDrawingArea->has_grab(); } void EnableRTL(bool bEnable) { m_pDrawingArea->set_direction(bEnable); } @@ -95,6 +100,7 @@ private: DECL_LINK(DoLoseFocus, weld::Widget&, void); DECL_LINK(DoKeyPress, const KeyEvent&, bool); DECL_LINK(DoFocusRect, weld::Widget&, tools::Rectangle); + DECL_LINK(DoPopupMenu, const Point&, bool); DECL_LINK(DoStyleUpdated, weld::Widget&, void); DECL_LINK(DoRequestHelp, tools::Rectangle&, OUString); diff --git a/include/vcl/layout.hxx b/include/vcl/layout.hxx index d33a942c8717..50fd57663542 100644 --- a/include/vcl/layout.hxx +++ b/include/vcl/layout.hxx @@ -620,6 +620,7 @@ private: Link<const KeyEvent&, bool> m_aKeyPressHdl; Link<const KeyEvent&, bool> m_aKeyReleaseHdl; Link<VclDrawingArea&, void> m_aStyleUpdatedHdl; + Link<const Point&, bool> m_aPopupMenuHdl; Link<tools::Rectangle&, OUString> m_aQueryTooltipHdl; virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override @@ -671,6 +672,12 @@ private: Invalidate(); } } + virtual void Command(const CommandEvent& rEvent) override + { + if (rEvent.GetCommand() == CommandEventId::ContextMenu && m_aPopupMenuHdl.Call(rEvent.GetMousePosPixel())) + return; + Control::Command(rEvent); + } virtual void RequestHelp(const HelpEvent& rHelpEvent) override { if (rHelpEvent.GetMode() & (HelpEventMode::QUICK | HelpEventMode::BALLOON)) @@ -745,6 +752,10 @@ public: { m_aStyleUpdatedHdl = rLink; } + void SetPopupMenuHdl(const Link<const Point&, bool>& rLink) + { + m_aPopupMenuHdl = rLink; + } void SetQueryTooltipHdl(const Link<tools::Rectangle&, OUString>& rLink) { m_aQueryTooltipHdl = rLink; diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index cee22af8dc31..74ad3803bdc0 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -82,6 +82,8 @@ public: virtual void set_accessible_name(const OUString& rName) = 0; virtual OUString get_accessible_name() const = 0; + virtual OUString get_accessible_description() const = 0; + virtual void set_tooltip_text(const OUString& rTip) = 0; virtual void connect_focus_in(const Link<Widget&, void>& rLink) @@ -845,6 +847,7 @@ protected: Link<const KeyEvent&, bool> m_aKeyPressHdl; Link<const KeyEvent&, bool> m_aKeyReleaseHdl; Link<Widget&, void> m_aStyleUpdatedHdl; + Link<const Point&, bool> m_aPopupMenuHdl; Link<Widget&, tools::Rectangle> m_aGetFocusRectHdl; Link<tools::Rectangle&, OUString> m_aQueryTooltipHdl; @@ -871,6 +874,7 @@ public: void connect_key_press(const Link<const KeyEvent&, bool>& rLink) { m_aKeyPressHdl = rLink; } void connect_key_release(const Link<const KeyEvent&, bool>& rLink) { m_aKeyReleaseHdl = rLink; } void connect_style_updated(const Link<Widget&, void>& rLink) { m_aStyleUpdatedHdl = rLink; } + void connect_popup_menu(const Link<const Point&, bool>& rLink) { m_aPopupMenuHdl = rLink; } void connect_focus_rect(const Link<Widget&, tools::Rectangle>& rLink) { m_aGetFocusRectHdl = rLink; diff --git a/solenv/sanitizers/ui/cui.suppr b/solenv/sanitizers/ui/cui.suppr index b503cb85b775..e14c833fd97f 100644 --- a/solenv/sanitizers/ui/cui.suppr +++ b/solenv/sanitizers/ui/cui.suppr @@ -49,7 +49,7 @@ cui/uiconfig/ui/baselinksdialog.ui://GtkLabel[@id='FULL_SOURCE_NAME'] orphan-lab cui/uiconfig/ui/baselinksdialog.ui://GtkLabel[@id='FULL_TYPE_NAME'] orphan-label cui/uiconfig/ui/bitmaptabpage.ui://GtkLabel[@id='label4'] orphan-label cui/uiconfig/ui/bitmaptabpage.ui://GtkLabel[@id='label9'] orphan-label -cui/uiconfig/ui/bitmaptabpage.ui://GtkSpinButton[@id='tileoffmtr:0%'] no-labelled-by +cui/uiconfig/ui/bitmaptabpage.ui://GtkSpinButton[@id='tileoffmtr'] no-labelled-by cui/uiconfig/ui/blackorwhitelistentrydialog.ui://GtkComboBox[@id='os'] no-labelled-by cui/uiconfig/ui/blackorwhitelistentrydialog.ui://GtkEntry[@id='osversion'] no-labelled-by cui/uiconfig/ui/blackorwhitelistentrydialog.ui://GtkEntry[@id='platformvendor'] no-labelled-by @@ -235,16 +235,11 @@ cui/uiconfig/ui/hangulhanjaconversiondialog.ui://GtkLabel[@id='label4'] orphan-l cui/uiconfig/ui/hangulhanjaconversiondialog.ui://cuilo-SuggestionDisplay[@id='suggestions:border'] no-labelled-by cui/uiconfig/ui/hangulhanjaconversiondialog.ui://GtkLabel[@id='label5'] orphan-label cui/uiconfig/ui/hangulhanjaconversiondialog.ui://GtkLabel[@id='label6'] orphan-label -cui/uiconfig/ui/hatchpage.ui://GtkLabel[@id='distanceft'] orphan-label -cui/uiconfig/ui/hatchpage.ui://GtkSpinButton[@id='distancemtr:0mm'] no-labelled-by cui/uiconfig/ui/hatchpage.ui://GtkLabel[@id='angleft'] orphan-label cui/uiconfig/ui/hatchpage.ui://GtkScale[@id='angleslider'] no-labelled-by -cui/uiconfig/ui/hatchpage.ui://GtkSpinButton[@id='anglemtr:0degrees'] no-labelled-by -cui/uiconfig/ui/hatchpage.ui://GtkLabel[@id='linetypeft'] orphan-label -cui/uiconfig/ui/hatchpage.ui://GtkComboBoxText[@id='linetypelb'] no-labelled-by -cui/uiconfig/ui/hatchpage.ui://GtkLabel[@id='linecolorft'] orphan-label -cui/uiconfig/ui/hatchpage.ui://svxcorelo-SvxColorListBox[@id='linecolorlb'] no-labelled-by -cui/uiconfig/ui/hatchpage.ui://svxcorelo-SvxColorListBox[@id='backgroundcolorlb'] no-labelled-by +cui/uiconfig/ui/hatchpage.ui://GtkSpinButton[@id='anglemtr'] no-labelled-by +cui/uiconfig/ui/hatchpage.ui://GtkMenuButton[@id='linecolorlb'] button-no-label +cui/uiconfig/ui/hatchpage.ui://GtkMenuButton[@id='backgroundcolorlb'] button-no-label cui/uiconfig/ui/hyperlinkdocpage.ui://GtkLabel[@id='url_label'] orphan-label cui/uiconfig/ui/hyperlinkdocpage.ui://GtkLabel[@id='url'] orphan-label cui/uiconfig/ui/hyphenate.ui://GtkLabel[@id='label1'] orphan-label @@ -387,10 +382,8 @@ cui/uiconfig/ui/screenshotannotationdialog.ui://GtkTextView[@id='text:border'] n cui/uiconfig/ui/pastespecial.ui://GtkLabel[@id='label2'] orphan-label cui/uiconfig/ui/pastespecial.ui://GtkLabel[@id='source'] orphan-label cui/uiconfig/ui/patterntabpage.ui://GtkLabel[@id='label4'] orphan-label -cui/uiconfig/ui/patterntabpage.ui://GtkLabel[@id='label5'] orphan-label -cui/uiconfig/ui/patterntabpage.ui://svxcorelo-SvxColorListBox[@id='LB_COLOR'] no-labelled-by -cui/uiconfig/ui/patterntabpage.ui://GtkLabel[@id='label6'] orphan-label -cui/uiconfig/ui/patterntabpage.ui://svxcorelo-SvxColorListBox[@id='LB_BACKGROUND_COLOR'] no-labelled-by +cui/uiconfig/ui/patterntabpage.ui://GtkMenuButton[@id='LB_COLOR'] button-no-label +cui/uiconfig/ui/patterntabpage.ui://GtkMenuButton[@id='LB_BACKGROUND_COLOR'] button-no-label cui/uiconfig/ui/percentdialog.ui://GtkSpinButton[@id='margin'] no-labelled-by cui/uiconfig/ui/personalization_tab.ui://GtkButton[@id='default1'] button-no-label cui/uiconfig/ui/personalization_tab.ui://GtkButton[@id='default2'] button-no-label diff --git a/svtools/source/control/valueacc.cxx b/svtools/source/control/valueacc.cxx index 219243548702..d661c6f48064 100644 --- a/svtools/source/control/valueacc.cxx +++ b/svtools/source/control/valueacc.cxx @@ -1405,6 +1405,25 @@ sal_Int64 SAL_CALL SvtValueItemAcc::getSomething( const uno::Sequence< sal_Int8 return nRet; } +void SvtValueItemAcc::FireAccessibleEvent( short nEventId, const uno::Any& rOldValue, const uno::Any& rNewValue ) +{ + if( !nEventId ) + return; + + ::std::vector< uno::Reference< accessibility::XAccessibleEventListener > > aTmpListeners( mxEventListeners ); + accessibility::AccessibleEventObject aEvtObject; + + aEvtObject.EventId = nEventId; + aEvtObject.Source = static_cast<uno::XWeak*>(this); + aEvtObject.NewValue = rNewValue; + aEvtObject.OldValue = rOldValue; + + for (auto const& tmpListener : aTmpListeners) + { + tmpListener->notifyEvent( aEvtObject ); + } +} + SvtValueSetAcc::SvtValueSetAcc( SvtValueSet* pParent ) : ValueSetAccComponentBase (m_aMutex), mpParent( pParent ), diff --git a/svtools/source/control/valueimp.hxx b/svtools/source/control/valueimp.hxx index 7be6ca57b85a..ee685d283afd 100644 --- a/svtools/source/control/valueimp.hxx +++ b/svtools/source/control/valueimp.hxx @@ -75,6 +75,7 @@ struct SvtValueSetItem sal_uInt16 mnId; sal_uInt8 meType; bool mbVisible; + Image maImage; Color maColor; OUString maText; css::uno::Reference< css::accessibility::XAccessible > mxAcc; @@ -408,6 +409,8 @@ public: SvtValueItemAcc(SvtValueSetItem* pParent, bool bIsTransientChildrenDisabled); virtual ~SvtValueItemAcc() override; + void FireAccessibleEvent( short nEventId, const css::uno::Any& rOldValue, const css::uno::Any& rNewValue ); + static SvtValueItemAcc* getImplementation( const css::uno::Reference< css::uno::XInterface >& rxData ) throw(); public: diff --git a/svtools/source/control/valueset.cxx b/svtools/source/control/valueset.cxx index 50e674bee2da..e45cf996137c 100644 --- a/svtools/source/control/valueset.cxx +++ b/svtools/source/control/valueset.cxx @@ -3463,17 +3463,28 @@ void SvtValueSet::ImplFormatItem(vcl::RenderContext const & rRenderContext, SvtV } else { + Size aImageSize = pItem->maImage.GetSizePixel(); Size aRectSize = aRect.GetSize(); Point aPos(aRect.Left(), aRect.Top()); - aPos.AdjustX(aRectSize.Width() / 2 ); + aPos.AdjustX((aRectSize.Width() - aImageSize.Width()) / 2 ); if (pItem->meType != VALUESETITEM_IMAGE_AND_TEXT) - aPos.AdjustY(aRectSize.Height() / 2 ); + aPos.AdjustY((aRectSize.Height() - aImageSize.Height()) / 2 ); DrawImageFlags nImageStyle = DrawImageFlags::NONE; if (!IsEnabled()) nImageStyle |= DrawImageFlags::Disable; + if (aImageSize.Width() > aRectSize.Width() || + aImageSize.Height() > aRectSize.Height()) + { + maVirDev->SetClipRegion(vcl::Region(aRect)); + maVirDev->DrawImage(aPos, pItem->maImage, nImageStyle); + maVirDev->SetClipRegion(); + } + else + maVirDev->DrawImage(aPos, pItem->maImage, nImageStyle); + if (pItem->meType == VALUESETITEM_IMAGE_AND_TEXT) { maVirDev->SetFont(rRenderContext.GetFont()); @@ -3638,6 +3649,18 @@ Size SvtValueSet::CalcWindowSizePixel( const Size& rItemSize, sal_uInt16 nDesire return aSize; } +void SvtValueSet::InsertItem( sal_uInt16 nItemId, const Image& rImage, + const OUString& rText, size_t nPos, + bool bShowLegend ) +{ + SvtValueSetItem* pItem = new SvtValueSetItem( *this ); + pItem->mnId = nItemId; + pItem->meType = bShowLegend ? VALUESETITEM_IMAGE_AND_TEXT : VALUESETITEM_IMAGE; + pItem->maImage = rImage; + pItem->maText = rText; + ImplInsertItem( pItem, nPos ); +} + void SvtValueSet::InsertItem( sal_uInt16 nItemId, const Color& rColor, const OUString& rText ) { @@ -3771,4 +3794,52 @@ OUString SvtValueSet::GetItemText(sal_uInt16 nItemId) const return OUString(); } +void SvtValueSet::SetExtraSpacing( sal_uInt16 nNewSpacing ) +{ + if ( GetStyle() & WB_ITEMBORDER ) + { + mnSpacing = nNewSpacing; + + mbFormat = true; + queue_resize(); + if ( IsReallyVisible() && IsUpdateMode() ) + Invalidate(); + } +} + +void SvtValueSet::SetItemText(sal_uInt16 nItemId, const OUString& rText) +{ + size_t nPos = GetItemPos( nItemId ); + + if ( nPos == VALUESET_ITEM_NOTFOUND ) + return; + + SvtValueSetItem* pItem = mItemList[nPos]; + + // Remember old and new name for accessibility event. + Any aOldName; + Any aNewName; + OUString sString (pItem->maText); + aOldName <<= sString; + sString = rText; + aNewName <<= sString; + + pItem->maText = rText; + + if (!mbFormat && IsReallyVisible() && IsUpdateMode()) + { + sal_uInt16 nTempId = mnSelItemId; + + if (nTempId == nItemId) + Invalidate(); + } + + if (ImplHasAccessibleListeners()) + { + Reference<XAccessible> xAccessible(pItem->GetAccessible( false/*bIsTransientChildrenDisabled*/)); + SvtValueItemAcc* pValueItemAcc = static_cast<SvtValueItemAcc*>(xAccessible.get()); + pValueItemAcc->FireAccessibleEvent(AccessibleEventId::NAME_CHANGED, aOldName, aNewName); + } +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/Executable_pixelctl.mk b/svx/Executable_pixelctl.mk deleted file mode 100644 index 3140af42ee12..000000000000 --- a/svx/Executable_pixelctl.mk +++ /dev/null @@ -1,40 +0,0 @@ -# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- -# -# -# 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/. -# - -$(eval $(call gb_Executable_Executable,pixelctl)) - -$(eval $(call gb_Executable_use_api,pixelctl,\ - offapi \ - udkapi \ -)) - -$(eval $(call gb_Executable_use_external,pixelctl,boost_headers)) - -$(eval $(call gb_Executable_set_include,pixelctl,\ - $$(INCLUDE) \ - -I$(SRCDIR)/vcl/inc \ - -I$(SRCDIR)/svx/inc \ -)) - -$(eval $(call gb_Executable_use_libraries,pixelctl,\ - svx \ - tl \ - sal \ - vcl \ - cppu \ - cppuhelper \ - comphelper \ -)) - -$(eval $(call gb_Executable_add_exception_objects,pixelctl,\ - svx/workben/pixelctl \ -)) - -# vim: set noet sw=4 ts=4: diff --git a/svx/Module_svx.mk b/svx/Module_svx.mk index da7c3b2aba8f..48ab6bcb071d 100644 --- a/svx/Module_svx.mk +++ b/svx/Module_svx.mk @@ -44,8 +44,6 @@ $(eval $(call gb_Module_add_targets,svx,\ Executable_gengal \ $(if $(filter-out MACOSX WNT,$(OS)), \ Package_gengal) \ - $(if $(filter-out WNT,$(OS)), \ - Executable_pixelctl) \ )) endif diff --git a/svx/inc/pch/precompiled_svx.hxx b/svx/inc/pch/precompiled_svx.hxx index 30f2dae197dc..ec723151fdcc 100644 --- a/svx/inc/pch/precompiled_svx.hxx +++ b/svx/inc/pch/precompiled_svx.hxx @@ -13,7 +13,7 @@ manual changes will be rewritten by the next run of update_pch.sh (which presumably also fixes all possible problems, so it's usually better to use it). - Generated on 2017-09-20 22:54:10 using: + Generated on 2018-08-29 17:19:11 using: ./bin/update_pch svx svx --cutoff=3 --exclude:system --exclude:module --include:local If after updating build fails, use the following command to locate conflicting headers: @@ -21,6 +21,7 @@ */ #include <algorithm> +#include <array> #include <cassert> #include <climits> #include <config_features.h> @@ -34,7 +35,6 @@ #include <helpids.h> #include <iomanip> #include <limits.h> -#include <list> #include <map> #include <memory> #include <ostream> @@ -63,20 +63,31 @@ #include <rtl/instance.hxx> #include <rtl/math.hxx> #include <rtl/ref.hxx> +#include <rtl/strbuf.h> +#include <rtl/strbuf.hxx> #include <rtl/string.h> +#include <rtl/string.hxx> +#include <rtl/stringutils.hxx> #include <rtl/tencinfo.h> #include <rtl/textenc.h> +#include <rtl/uri.hxx> #include <rtl/ustrbuf.hxx> #include <rtl/ustring.h> #include <rtl/ustring.hxx> #include <rtl/uuid.h> #include <sal/config.h> +#include <sal/log.hxx> #include <sal/macros.h> #include <sal/saldllapi.h> #include <sal/types.h> #include <sal/typesizes.h> +#include <salhelper/simplereferenceobject.hxx> #include <salhelper/singletonref.hxx> +#include <vcl/BitmapFilter.hxx> #include <vcl/EnumContext.hxx> +#include <vcl/GraphicObject.hxx> +#include <vcl/IDialogRenderable.hxx> +#include <vcl/abstdlg.hxx> #include <vcl/bitmap.hxx> #include <vcl/bitmapex.hxx> #include <vcl/builder.hxx> @@ -87,6 +98,8 @@ #include <vcl/commandevent.hxx> #include <vcl/commandinfoprovider.hxx> #include <vcl/ctrl.hxx> +#include <vcl/cursor.hxx> +#include <vcl/customweld.hxx> #include <vcl/dialog.hxx> #include <vcl/dllapi.h> #include <vcl/dockwin.hxx> @@ -100,7 +113,6 @@ #include <vcl/font.hxx> #include <vcl/gradient.hxx> #include <vcl/graph.hxx> -#include <vcl/GraphicObject.hxx> #include <vcl/group.hxx> #include <vcl/idle.hxx> #include <vcl/image.hxx> @@ -112,6 +124,8 @@ #include <vcl/metric.hxx> #include <vcl/outdev.hxx> #include <vcl/region.hxx> +#include <vcl/salbtype.hxx> +#include <vcl/salgtype.hxx> #include <vcl/scopedbitmapaccess.hxx> #include <vcl/scrbar.hxx> #include <vcl/settings.hxx> @@ -126,6 +140,7 @@ #include <vcl/vclenum.hxx> #include <vcl/vclptr.hxx> #include <vcl/virdev.hxx> +#include <vcl/weld.hxx> #include <vcl/window.hxx> #include <vcl/wrkwin.hxx> #include <avmedia/avmediadllapi.h> @@ -140,11 +155,7 @@ #include <basegfx/polygon/b2dpolypolygon.hxx> #include <basegfx/polygon/b2dpolypolygontools.hxx> #include <basegfx/polygon/b3dpolypolygon.hxx> -#include <basegfx/range/b2drange.hxx> #include <basegfx/range/b3drange.hxx> -#include <basegfx/range/basicrange.hxx> -#include <basegfx/tuple/b2dtuple.hxx> -#include <basegfx/vector/b2dvector.hxx> #include <basegfx/vector/b2enums.hxx> #include <basegfx/vector/b3dvector.hxx> #include <com/sun/star/accessibility/AccessibleEventId.hpp> @@ -155,6 +166,7 @@ #include <com/sun/star/accessibility/TextSegment.hpp> #include <com/sun/star/accessibility/XAccessible.hpp> #include <com/sun/star/accessibility/XAccessibleContext.hpp> +#include <com/sun/star/accessibility/XAccessibleEventListener.hpp> #include <com/sun/star/awt/FontDescriptor.hpp> #include <com/sun/star/awt/FontSlant.hpp> #include <com/sun/star/awt/GradientStyle.hpp> @@ -183,7 +195,6 @@ #include <com/sun/star/drawing/DashStyle.hpp> #include <com/sun/star/drawing/FillStyle.hpp> #include <com/sun/star/drawing/LineCap.hpp> -#include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp> #include <com/sun/star/drawing/XShapeDescriptor.hpp> #include <com/sun/star/drawing/XShapes.hpp> #include <com/sun/star/embed/VerbDescriptor.hpp> @@ -207,6 +218,7 @@ #include <com/sun/star/i18n/NumberFormatMapper.hpp> #include <com/sun/star/i18n/ParseResult.hpp> #include <com/sun/star/i18n/UnicodeScript.hpp> +#include <com/sun/star/i18n/WordType.hpp> #include <com/sun/star/i18n/XCharacterClassification.hpp> #include <com/sun/star/io/XInputStream.hpp> #include <com/sun/star/lang/DisposedException.hpp> @@ -235,6 +247,7 @@ #include <com/sun/star/text/XTextRange.hpp> #include <com/sun/star/text/XTextRangeCompare.hpp> #include <com/sun/star/text/XTextRangeMover.hpp> +#include <com/sun/star/text/textfield/Type.hpp> #include <com/sun/star/ui/XContextChangeEventListener.hpp> #include <com/sun/star/ui/XSidebar.hpp> #include <com/sun/star/ui/XSidebarPanel.hpp> @@ -249,7 +262,6 @@ #include <com/sun/star/uno/Sequence.h> #include <com/sun/star/uno/Sequence.hxx> #include <com/sun/star/uno/Type.hxx> -#include <com/sun/star/uno/XAggregation.hpp> #include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/uno/XInterface.hpp> #include <com/sun/star/uno/XWeak.hpp> @@ -271,9 +283,9 @@ #include <comphelper/property.hxx> #include <comphelper/propertycontainer.hxx> #include <comphelper/propertysequence.hxx> +#include <comphelper/propertysetinfo.hxx> #include <comphelper/sequence.hxx> #include <comphelper/servicehelper.hxx> -#include <comphelper/string.hxx> #include <comphelper/types.hxx> #include <comphelper/uno3.hxx> #include <comphelper/weak.hxx> @@ -301,8 +313,11 @@ #include <editeng/editdata.hxx> #include <editeng/editeng.hxx> #include <editeng/editengdllapi.h> +#include <editeng/editstat.hxx> +#include <editeng/editview.hxx> #include <editeng/eeitem.hxx> #include <editeng/fhgtitem.hxx> +#include <editeng/flditem.hxx> #include <editeng/itemtype.hxx> #include <editeng/kernitem.hxx> #include <editeng/lrspitem.hxx> @@ -325,6 +340,7 @@ #include <i18nlangtag/mslangid.hxx> #include <o3tl/cow_wrapper.hxx> #include <o3tl/make_unique.hxx> +#include <o3tl/safeint.hxx> #include <o3tl/strong_int.hxx> #include <o3tl/typed_flags_set.hxx> #include <sfx2//dllapi.h> @@ -346,6 +362,7 @@ #include <sfx2/sfxuno.hxx> #include <sfx2/shell.hxx> #include <sfx2/sidebar/ControlFactory.hxx> +#include <sfx2/sidebar/DeckDescriptor.hxx> #include <sfx2/sidebar/IContextChangeReceiver.hxx> #include <sfx2/sidebar/ResourceManager.hxx> #include <sfx2/sidebar/SidebarPanelBase.hxx> @@ -375,6 +392,7 @@ #include <svl/style.hxx> #include <svl/stylesheetuser.hxx> #include <svl/svldllapi.h> +#include <svl/typedwhich.hxx> #include <svl/urihelper.hxx> #include <svl/zforlist.hxx> #include <svtools/colorcfg.hxx> @@ -428,6 +446,7 @@ #include <unotools/viewoptions.hxx> #include <svx/AccessibleShape.hxx> #include <svx/AccessibleShapeInfo.hxx> +#include <svx/ClassificationField.hxx> #include <svx/DescriptionGenerator.hxx> #include <svx/IAccessibleViewForwarder.hxx> #include <svx/ShapeTypeHandler.hxx> diff --git a/svx/source/accessibility/svxpixelctlaccessiblecontext.cxx b/svx/source/accessibility/svxpixelctlaccessiblecontext.cxx index 8908e36d3bde..f5821243a743 100644 --- a/svx/source/accessibility/svxpixelctlaccessiblecontext.cxx +++ b/svx/source/accessibility/svxpixelctlaccessiblecontext.cxx @@ -48,21 +48,19 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::accessibility; -SvxPixelCtlAccessible::SvxPixelCtlAccessible( SvxPixelCtl& rControl) : - SvxPixelCtlAccessible_BASE(m_aMutex), - mrPixelCtl(rControl), - mnClientId(0) +SvxPixelCtlAccessible::SvxPixelCtlAccessible(SvxPixelCtl* pControl) + : mpPixelCtl(pControl) { } SvxPixelCtlAccessible::~SvxPixelCtlAccessible() { - if( IsAlive() ) - { - osl_atomic_increment( &m_refCount ); - dispose(); // set mpRepr = NULL & release all children - } + ensureDisposed(); } + +IMPLEMENT_FORWARD_XINTERFACE2( SvxPixelCtlAccessible, OAccessibleSelectionHelper, OAccessibleHelper_Base ) +IMPLEMENT_FORWARD_XTYPEPROVIDER2( SvxPixelCtlAccessible, OAccessibleSelectionHelper, OAccessibleHelper_Base ) + uno::Reference< XAccessibleContext > SvxPixelCtlAccessible::getAccessibleContext( ) { return this; @@ -78,31 +76,18 @@ uno::Reference< XAccessible > SvxPixelCtlAccessible::getAccessibleChild( sal_Int ::osl::MutexGuard aGuard( m_aMutex ); if ( i < 0 || i >= getAccessibleChildCount()) throw lang::IndexOutOfBoundsException(); - return CreateChild(i, mrPixelCtl.IndexToPoint(i)); + Reference< XAccessible > xChild; + if (mpPixelCtl) + xChild = CreateChild(i, mpPixelCtl->IndexToPoint(i)); + return xChild; } uno::Reference< XAccessible > SvxPixelCtlAccessible::getAccessibleParent( ) { ::osl::MutexGuard aGuard( m_aMutex ); - vcl::Window *pTabPage = getNonLayoutParent(&mrPixelCtl); - if (!pTabPage || WindowType::TABPAGE != pTabPage->GetType()) - return uno::Reference< XAccessible >(); - else - return pTabPage->GetAccessible(); -} - -sal_Int32 SvxPixelCtlAccessible::getAccessibleIndexInParent( ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - sal_uInt16 nIdx = 0; - vcl::Window *pTabPage = getNonLayoutParent(&mrPixelCtl); - if (!pTabPage || WindowType::TABPAGE != pTabPage->GetType()) - return -1; - sal_uInt16 nChildren = pTabPage->GetChildCount(); - for(nIdx = 0; nIdx < nChildren; nIdx++) - if(pTabPage->GetChild( nIdx ) == &mrPixelCtl) - break; - return nIdx; + if (mpPixelCtl) + return mpPixelCtl->getAccessibleParent(); + return uno::Reference<css::accessibility::XAccessible>(); } sal_Int16 SvxPixelCtlAccessible::getAccessibleRole( ) @@ -114,282 +99,146 @@ OUString SvxPixelCtlAccessible::getAccessibleDescription( ) { ::osl::MutexGuard aGuard( m_aMutex ); - return mrPixelCtl.GetAccessibleDescription(); + return mpPixelCtl ? mpPixelCtl->GetAccessibleDescription() : ""; } OUString SvxPixelCtlAccessible::getAccessibleName( ) { - ::osl::MutexGuard aGuard( m_aMutex ); - return mrPixelCtl.GetAccessibleName(); + return mpPixelCtl ? mpPixelCtl->GetAccessibleName() : ""; } -uno::Reference< XAccessibleRelationSet > SvxPixelCtlAccessible::getAccessibleRelationSet( ) +Reference< XAccessibleRelationSet > SAL_CALL SvxPixelCtlAccessible::getAccessibleRelationSet() { - ::osl::MutexGuard aGuard( m_aMutex ); - utl::AccessibleRelationSetHelper* rRelationSet = new utl::AccessibleRelationSetHelper; - uno::Reference< css::accessibility::XAccessibleRelationSet > rSet = rRelationSet; - vcl::Window *pLabeledBy = mrPixelCtl.GetAccessibleRelationLabeledBy(); - if ( pLabeledBy && pLabeledBy != &mrPixelCtl ) - { - uno::Sequence< uno::Reference< uno::XInterface > > aSequence { pLabeledBy->GetAccessible() }; - rRelationSet->AddRelation( css::accessibility::AccessibleRelation( css::accessibility::AccessibleRelationType::LABELED_BY, aSequence ) ); - } - - vcl::Window* pMemberOf = mrPixelCtl.GetAccessibleRelationMemberOf(); - if ( pMemberOf && pMemberOf != &mrPixelCtl ) - { - uno::Sequence< uno::Reference< uno::XInterface > > aSequence { pMemberOf->GetAccessible() }; - rRelationSet->AddRelation( css::accessibility::AccessibleRelation( css::accessibility::AccessibleRelationType::MEMBER_OF, aSequence ) ); - } - return rSet; + if (mpPixelCtl) + return mpPixelCtl->get_accessible_relation_set(); + return uno::Reference<css::accessibility::XAccessibleRelationSet>(); } - uno::Reference< XAccessibleStateSet > SvxPixelCtlAccessible::getAccessibleStateSet( ) { ::osl::MutexGuard aGuard( m_aMutex ); utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper; uno::Reference< XAccessibleStateSet > xRet = pStateSetHelper; - const sal_Int16 aStandardStates[] = - { - AccessibleStateType::FOCUSABLE, - AccessibleStateType::SELECTABLE, - AccessibleStateType::SHOWING, - AccessibleStateType::VISIBLE, - AccessibleStateType::OPAQUE, - 0 - }; - - sal_Int16 nState = 0; - while(aStandardStates[nState]) + if (mpPixelCtl) { - pStateSetHelper->AddState(aStandardStates[nState++]); + const sal_Int16 aStandardStates[] = + { + AccessibleStateType::FOCUSABLE, + AccessibleStateType::SELECTABLE, + AccessibleStateType::SHOWING, + AccessibleStateType::VISIBLE, + AccessibleStateType::OPAQUE, + 0 + }; + + sal_Int16 nState = 0; + while (aStandardStates[nState]) + { + pStateSetHelper->AddState(aStandardStates[nState++]); + } + if (mpPixelCtl->IsEnabled()) + pStateSetHelper->AddState(AccessibleStateType::ENABLED); + if (mpPixelCtl->HasFocus()) + pStateSetHelper->AddState(AccessibleStateType::FOCUSED); + pStateSetHelper->AddState(AccessibleStateType::MANAGES_DESCENDANTS); } - if(mrPixelCtl.IsEnabled()) - pStateSetHelper->AddState(AccessibleStateType::ENABLED); - if(mrPixelCtl.HasFocus()) - pStateSetHelper->AddState(AccessibleStateType::FOCUSED); - pStateSetHelper->AddState(AccessibleStateType::MANAGES_DESCENDANTS); return xRet; } - -css::lang::Locale SvxPixelCtlAccessible::getLocale( ) +uno::Reference<XAccessible > SAL_CALL SvxPixelCtlAccessible::getAccessibleAtPoint ( + const awt::Point& rPoint) { ::osl::MutexGuard aGuard( m_aMutex ); - if( getAccessibleParent().is() ) + + Reference< XAccessible > xRet; + + if (mpPixelCtl) { - uno::Reference< XAccessibleContext > xParentContext( getAccessibleParent()->getAccessibleContext() ); - if( xParentContext.is() ) - return xParentContext->getLocale(); + long nIndex = mpPixelCtl->PointToIndex(Point(rPoint.X, rPoint.Y)); + xRet = CreateChild(nIndex, mpPixelCtl->IndexToPoint(nIndex)); } - // No locale and no parent. Therefore throw exception to indicate this - // cluelessness. - throw IllegalAccessibleComponentStateException(); + return xRet; } - -sal_Bool SvxPixelCtlAccessible::containsPoint( const awt::Point& aPt ) +awt::Rectangle SvxPixelCtlAccessible::implGetBounds() { ::osl::MutexGuard aGuard( m_aMutex ); - Point aPoint(aPt.X, aPt.Y); - return (aPoint.X() >= 0) - && (aPoint.X() < mrPixelCtl.GetSizePixel().getWidth()) - && (aPoint.Y() >= 0) - && (aPoint.Y() < mrPixelCtl.GetSizePixel().getHeight()); -} -uno::Reference<XAccessible > SAL_CALL SvxPixelCtlAccessible::getAccessibleAtPoint ( - const awt::Point& aPoint) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - if( !IsAlive() ) - throw lang::DisposedException(); - Point childPoint; - childPoint.setX( aPoint.X ); - childPoint.setY( aPoint.Y ); + awt::Rectangle aRet; - Point pt= mrPixelCtl.PixelToLogic(childPoint); - long nIndex = mrPixelCtl.PointToIndex(pt); - return CreateChild(nIndex, mrPixelCtl.IndexToPoint(nIndex)); -} + if (mpPixelCtl) + { + const Point aOutPos; + Size aOutSize(mpPixelCtl->GetOutputSizePixel()); -awt::Rectangle SvxPixelCtlAccessible::getBounds( ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - awt::Rectangle aRet; - Size aSz = mrPixelCtl.GetSizePixel(); - Point aPos = mrPixelCtl.GetPosPixel(); - aRet.X = aPos.X(); - aRet.Y = aPos.Y(); - aRet.Width = aSz.Width(); - aRet.Height = aSz.Height(); - return aRet; -} + aRet.X = aOutPos.X(); + aRet.Y = aOutPos.Y(); + aRet.Width = aOutSize.Width(); + aRet.Height = aOutSize.Height(); + } -awt::Point SvxPixelCtlAccessible::getLocation( ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - Point aPos; - aPos = mrPixelCtl.GetPosPixel(); - awt::Point aRet(aPos.X(), aPos.Y()); return aRet; } -awt::Point SvxPixelCtlAccessible::getLocationOnScreen( ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - tools::Rectangle rect = mrPixelCtl.GetWindowExtentsRelative(nullptr); - return awt::Point(rect.Left(),rect.Top() ); -} - -awt::Size SvxPixelCtlAccessible::getSize( ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - Size aSz = mrPixelCtl.GetSizePixel(); - return awt::Size(aSz.Width(),aSz.Height()); -} void SvxPixelCtlAccessible::grabFocus( ) { ::osl::MutexGuard aGuard( m_aMutex ); - mrPixelCtl.GrabFocus(); + if (mpPixelCtl) + mpPixelCtl->GrabFocus(); } sal_Int32 SvxPixelCtlAccessible::getForeground( ) { ::osl::MutexGuard aGuard( m_aMutex ); - return sal_Int32(mrPixelCtl.GetControlForeground()); + + //see SvxPixelCtl::Paint + const StyleSettings& rStyles = Application::GetSettings().GetStyleSettings(); + return sal_Int32(rStyles.GetLabelTextColor()); } sal_Int32 SvxPixelCtlAccessible::getBackground( ) { ::osl::MutexGuard aGuard( m_aMutex ); - return sal_Int32(mrPixelCtl.GetControlBackground()); -} - -OUString SvxPixelCtlAccessible::getImplementationName( ) -{ - return OUString("SvxPixelCtlAccessible"); -} -sal_Bool SvxPixelCtlAccessible::supportsService( const OUString& rServiceName ) -{ - return cppu::supportsService( this, rServiceName ); -} - -uno::Sequence< OUString > SvxPixelCtlAccessible::getSupportedServiceNames( ) -{ - return uno::Sequence< OUString >{ - "Accessible", - "AccessibleContext", - "AccessibleComponent" - }; + //see SvxPixelCtl::Paint + const StyleSettings& rStyles = Application::GetSettings().GetStyleSettings(); + return sal_Int32(rStyles.GetDialogColor()); } - -// XAccessibleSelection - -void SAL_CALL SvxPixelCtlAccessible::selectAccessibleChild( sal_Int32 nChildIndex ) +void SvxPixelCtlAccessible::implSelect(sal_Int32 nChildIndex, bool bSelect) { ::osl::MutexGuard aGuard( m_aMutex ); if ( nChildIndex < 0 || nChildIndex >= getAccessibleChildCount()) throw lang::IndexOutOfBoundsException(); - long nIndex = mrPixelCtl.ShowPosition(mrPixelCtl.IndexToPoint(nChildIndex)); - NotifyChild(nIndex,true,false); -} - -sal_Bool SAL_CALL SvxPixelCtlAccessible::isAccessibleChildSelected( sal_Int32 nChildIndex ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - return mrPixelCtl.GetFocusPosIndex() == nChildIndex; -} - -void SAL_CALL SvxPixelCtlAccessible::clearAccessibleSelection( ) -{ -} + if (!mpPixelCtl) + return; -void SAL_CALL SvxPixelCtlAccessible::selectAllAccessibleChildren( ) -{ + long nIndex = mpPixelCtl->ShowPosition(mpPixelCtl->IndexToPoint(nChildIndex)); + NotifyChild(nIndex, bSelect, false); } -sal_Int32 SAL_CALL SvxPixelCtlAccessible::getSelectedAccessibleChildCount( ) -{ - return 1; -} - -uno::Reference< XAccessible > SAL_CALL SvxPixelCtlAccessible::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) +bool SvxPixelCtlAccessible::implIsSelected(sal_Int32 nChildIndex) { ::osl::MutexGuard aGuard( m_aMutex ); - if ( nSelectedChildIndex >= 1) - throw lang::IndexOutOfBoundsException(); - - uno::Reference< XAccessible > xChild; - if(m_xCurChild.is()) - { - xChild = m_xCurChild; - } - return xChild; -} - -void SAL_CALL SvxPixelCtlAccessible::deselectAccessibleChild( sal_Int32 ) -{ -} - -//XAccessibleEventBroadcaster -void SAL_CALL SvxPixelCtlAccessible::addAccessibleEventListener( const uno::Reference< XAccessibleEventListener >& xListener ) -{ - if (xListener.is()) - { - ::osl::MutexGuard aGuard( m_aMutex ); - if (!mnClientId) - mnClientId = comphelper::AccessibleEventNotifier::registerClient( ); - comphelper::AccessibleEventNotifier::addEventListener( mnClientId, xListener ); - } -} - -void SAL_CALL SvxPixelCtlAccessible::removeAccessibleEventListener( const uno::Reference< XAccessibleEventListener >& xListener ) -{ - if (xListener.is()) - { - ::osl::MutexGuard aGuard( m_aMutex ); - if (!mnClientId) - return; - sal_Int32 nListenerCount = comphelper::AccessibleEventNotifier::removeEventListener( mnClientId, xListener ); - if ( !nListenerCount ) - { - comphelper::AccessibleEventNotifier::revokeClient( mnClientId ); - mnClientId = 0; - } - } -} + if (!mpPixelCtl) + return false; -//Solution:Add the event handling method -void SvxPixelCtlAccessible::FireAccessibleEvent (short nEventId, const css::uno::Any& rOld, const css::uno::Any& rNew) -{ - const uno::Reference< XInterface > xSource( *this ); - if (mnClientId) - comphelper::AccessibleEventNotifier::addEvent( mnClientId, AccessibleEventObject( xSource, nEventId, rNew,rOld ) ); + return mpPixelCtl->GetFocusPosIndex() == nChildIndex; } void SAL_CALL SvxPixelCtlAccessible::disposing() { - if( !rBHelper.bDisposed ) - { - ::osl::MutexGuard aGuard( m_aMutex ); - if ( mnClientId ) - { - comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing( mnClientId, *this ); - mnClientId = 0; - } - } + ::osl::MutexGuard aGuard(m_aMutex); + OAccessibleSelectionHelper::disposing(); + m_xCurChild.clear(); + mpPixelCtl = nullptr; } void SvxPixelCtlAccessible::NotifyChild(long nIndex,bool bSelect ,bool bCheck) @@ -410,21 +259,19 @@ void SvxPixelCtlAccessible::NotifyChild(long nIndex,bool bSelect ,bool bCheck) } if (bCheck) { - pChild->ChangePixelColorOrBG( mrPixelCtl.GetBitmapPixel(sal_uInt16(nIndex)) != 0); + pChild->ChangePixelColorOrBG(mpPixelCtl->GetBitmapPixel(sal_uInt16(nIndex)) != 0); pChild->CheckChild(); } return ; } } - uno::Reference <XAccessible> xNewChild =CreateChild(nIndex, mrPixelCtl.IndexToPoint(nIndex)); + uno::Reference <XAccessible> xNewChild =CreateChild(nIndex, mpPixelCtl->IndexToPoint(nIndex)); SvxPixelCtlAccessibleChild *pNewChild= static_cast<SvxPixelCtlAccessibleChild*>(xNewChild.get()); DBG_ASSERT(pNewChild,"Child Must be Valid"); Any aNewValue,aOldValue; aNewValue<<= xNewChild; - FireAccessibleEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, - aOldValue, - aNewValue ); + NotifyAccessibleEvent(AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, aOldValue, aNewValue); if (bSelect) { @@ -439,16 +286,14 @@ void SvxPixelCtlAccessible::NotifyChild(long nIndex,bool bSelect ,bool bCheck) pNewChild->CheckChild(); } m_xCurChild= xNewChild; - - } uno::Reference<XAccessible> SvxPixelCtlAccessible::CreateChild (long nIndex,Point mPoint) { - bool bPixelColorOrBG = mrPixelCtl.GetBitmapPixel(sal_uInt16(nIndex)) != 0; - Size size(mrPixelCtl.GetWidth() / SvxPixelCtl::GetLineCount(), mrPixelCtl.GetHeight() / SvxPixelCtl::GetLineCount()); + bool bPixelColorOrBG = mpPixelCtl->GetBitmapPixel(sal_uInt16(nIndex)) != 0; + Size size(mpPixelCtl->GetWidth() / SvxPixelCtl::GetLineCount(), mpPixelCtl->GetHeight() / SvxPixelCtl::GetLineCount()); uno::Reference<XAccessible> xChild; - xChild = new SvxPixelCtlAccessibleChild(mrPixelCtl, + xChild = new SvxPixelCtlAccessibleChild(*mpPixelCtl, bPixelColorOrBG, tools::Rectangle(mPoint,size), this, @@ -457,7 +302,6 @@ uno::Reference<XAccessible> SvxPixelCtlAccessible::CreateChild (long nIndex,Poin return xChild; } - void SvxPixelCtlAccessible::LoseFocus() { m_xCurChild.clear(); @@ -470,15 +314,11 @@ void SvxPixelCtlAccessibleChild::CheckChild() if (m_bPixelColorOrBG)//Current Child State { - FireAccessibleEvent( AccessibleEventId::STATE_CHANGED, - Any(), - aChecked); + NotifyAccessibleEvent(AccessibleEventId::STATE_CHANGED, Any(), aChecked); } else { - FireAccessibleEvent( AccessibleEventId::STATE_CHANGED, - aChecked, - Any() ); + NotifyAccessibleEvent(AccessibleEventId::STATE_CHANGED, aChecked, Any()); } } @@ -489,118 +329,58 @@ void SvxPixelCtlAccessibleChild::SelectChild( bool bSelect) if (bSelect) { - FireAccessibleEvent( AccessibleEventId::STATE_CHANGED, - Any(), - aSelected); + NotifyAccessibleEvent(AccessibleEventId::STATE_CHANGED, Any(), aSelected); } else { - FireAccessibleEvent( AccessibleEventId::STATE_CHANGED, - aSelected, - Any()); + NotifyAccessibleEvent(AccessibleEventId::STATE_CHANGED, aSelected, Any()); } } -void SvxPixelCtlAccessibleChild::FireAccessibleEvent ( - short nEventId, - const css::uno::Any& rOld, - const css::uno::Any& rNew) -{ - const uno::Reference< XInterface > xSource( *this ); - if (mnClientId) - comphelper::AccessibleEventNotifier::addEvent( mnClientId, AccessibleEventObject( xSource, nEventId, rNew,rOld ) ); -} -SvxPixelCtlAccessibleChild::SvxPixelCtlAccessibleChild( - SvxPixelCtl& rWindow, - bool bPixelColorOrBG, - const tools::Rectangle& rBoundingBox, - const uno::Reference<XAccessible>& rxParent, - long nIndexInParent ) : - SvxPixelCtlAccessibleChild_BASE( m_aMutex ), - mrParentWindow( rWindow ), - mxParent(rxParent), - m_bPixelColorOrBG(bPixelColorOrBG), - maBoundingBox( rBoundingBox ), - mnIndexInParent( nIndexInParent ), - mnClientId( 0 ) +SvxPixelCtlAccessibleChild::SvxPixelCtlAccessibleChild( SvxPixelCtl& rWindow, bool bPixelColorOrBG, + const tools::Rectangle& rBoundingBox, const rtl::Reference<SvxPixelCtlAccessible>& rxParent, + long nIndexInParent) + : mrParentWindow( rWindow ) + , mxParent(rxParent) + , m_bPixelColorOrBG(bPixelColorOrBG) + , maBoundingBox( rBoundingBox ) + , mnIndexInParent( nIndexInParent ) { } - SvxPixelCtlAccessibleChild::~SvxPixelCtlAccessibleChild() { - if( IsAlive() ) - { - osl_atomic_increment( &m_refCount ); - dispose(); // set mpRepr = NULL & release all children - } + ensureDisposed(); } +IMPLEMENT_FORWARD_XINTERFACE2( SvxPixelCtlAccessibleChild, OAccessibleComponentHelper, OAccessibleHelper_Base ) +IMPLEMENT_FORWARD_XTYPEPROVIDER2( SvxPixelCtlAccessibleChild, OAccessibleComponentHelper, OAccessibleHelper_Base ) + // XAccessible uno::Reference< XAccessibleContext> SAL_CALL SvxPixelCtlAccessibleChild::getAccessibleContext() { return this; } -// XAccessibleComponent -sal_Bool SAL_CALL SvxPixelCtlAccessibleChild::containsPoint( const awt::Point& rPoint ) -{ - // no guard -> done in getBounds() -// return GetBoundingBox().IsInside( VCLPoint( rPoint ) ); - return tools::Rectangle( Point( 0, 0 ), GetBoundingBox().GetSize() ).IsInside( VCLPoint( rPoint ) ); -} - uno::Reference< XAccessible > SAL_CALL SvxPixelCtlAccessibleChild::getAccessibleAtPoint( const awt::Point& ) { return uno::Reference< XAccessible >(); } -awt::Rectangle SAL_CALL SvxPixelCtlAccessibleChild::getBounds() -{ - // no guard -> done in getBoundingBox() - //Modified by lq, 09/26 - //return AWTRectangle( GetBoundingBox() ); - awt::Rectangle rect = AWTRectangle( GetBoundingBox() ); - rect.X = rect.X + mrParentWindow.GetClientWindowExtentsRelative().Left()-mrParentWindow.GetWindowExtentsRelative(nullptr).Left(); - rect.Y = rect.Y + mrParentWindow.GetClientWindowExtentsRelative().Top()-mrParentWindow.GetWindowExtentsRelative(nullptr).Top(); - return rect; - // End -} - -awt::Point SAL_CALL SvxPixelCtlAccessibleChild::getLocation() -{ - // no guard -> done in getBoundingBox() - return AWTPoint( GetBoundingBox().TopLeft() ); -} - -awt::Point SAL_CALL SvxPixelCtlAccessibleChild::getLocationOnScreen() -{ - // no guard -> done in getBoundingBoxOnScreen() - return AWTPoint( GetBoundingBoxOnScreen().TopLeft() ); -} - -awt::Size SAL_CALL SvxPixelCtlAccessibleChild::getSize() -{ - // no guard -> done in getBoundingBox() - return AWTSize( GetBoundingBox().GetSize() ); -} - void SAL_CALL SvxPixelCtlAccessibleChild::grabFocus() { } -sal_Int32 SvxPixelCtlAccessibleChild::getForeground( ) +sal_Int32 SvxPixelCtlAccessibleChild::getForeground() { ::osl::MutexGuard aGuard( m_aMutex ); - ThrowExceptionIfNotAlive(); - return sal_Int32(mrParentWindow.GetControlForeground()); + return mxParent.is() ? mxParent->getForeground() : -1; } -sal_Int32 SvxPixelCtlAccessibleChild::getBackground( ) + +sal_Int32 SvxPixelCtlAccessibleChild::getBackground() { ::osl::MutexGuard aGuard( m_aMutex ); - - ThrowExceptionIfNotAlive(); - return sal_Int32(mrParentWindow.GetControlBackground()); + return mxParent.is() ? mxParent->getBackground() : -1; } // XAccessibleContext @@ -616,12 +396,7 @@ uno::Reference< XAccessible > SAL_CALL SvxPixelCtlAccessibleChild::getAccessible uno::Reference< XAccessible > SAL_CALL SvxPixelCtlAccessibleChild::getAccessibleParent() { - return mxParent; -} - -sal_Int32 SAL_CALL SvxPixelCtlAccessibleChild::getAccessibleIndexInParent() -{ - return mnIndexInParent; + return mxParent.get(); } sal_Int16 SAL_CALL SvxPixelCtlAccessibleChild::getAccessibleRole() @@ -655,7 +430,7 @@ uno::Reference< XAccessibleStateSet > SAL_CALL SvxPixelCtlAccessibleChild::getAc ::osl::MutexGuard aGuard( m_aMutex ); utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper; - if( IsAlive() ) + if (!rBHelper.bDisposed) { pStateSetHelper->AddState( AccessibleStateType::TRANSIENT ); @@ -681,111 +456,16 @@ uno::Reference< XAccessibleStateSet > SAL_CALL SvxPixelCtlAccessibleChild::getAc return pStateSetHelper; } -lang::Locale SAL_CALL SvxPixelCtlAccessibleChild::getLocale() -{ - ::osl::MutexGuard aGuard( m_aMutex ); - if( mxParent.is() ) - { - uno::Reference< XAccessibleContext > xParentContext( mxParent->getAccessibleContext() ); - if( xParentContext.is() ) - return xParentContext->getLocale(); - } - - // No locale and no parent. Therefore throw exception to indicate this - // cluelessness. - throw IllegalAccessibleComponentStateException(); -} - -void SAL_CALL SvxPixelCtlAccessibleChild::addAccessibleEventListener( const uno::Reference< XAccessibleEventListener >& xListener ) -{ - if (xListener.is()) - { - ::osl::MutexGuard aGuard( m_aMutex ); - if (!mnClientId) - mnClientId = comphelper::AccessibleEventNotifier::registerClient( ); - comphelper::AccessibleEventNotifier::addEventListener( mnClientId, xListener ); - } -} - -void SAL_CALL SvxPixelCtlAccessibleChild::removeAccessibleEventListener( const uno::Reference< XAccessibleEventListener >& xListener ) -{ - if (xListener.is()) - { - ::osl::MutexGuard aGuard( m_aMutex ); - - sal_Int32 nListenerCount = comphelper::AccessibleEventNotifier::removeEventListener( mnClientId, xListener ); - if ( !nListenerCount ) - { - // no listeners anymore - // -> revoke ourself. This may lead to the notifier thread dying (if we were the last client), - // and at least to us not firing any events anymore, in case somebody calls - // NotifyAccessibleEvent, again - comphelper::AccessibleEventNotifier::revokeClient( mnClientId ); - mnClientId = 0; - } - } -} - -// XServiceInfo -OUString SAL_CALL SvxPixelCtlAccessibleChild::getImplementationName() -{ - return OUString( "SvxPixelCtlAccessibleChild" ); -} - -sal_Bool SAL_CALL SvxPixelCtlAccessibleChild::supportsService( const OUString& rServiceName ) -{ - return cppu::supportsService( this, rServiceName ); -} - -Sequence< OUString > SAL_CALL SvxPixelCtlAccessibleChild::getSupportedServiceNames() -{ - uno::Sequence< OUString > aRet(3); - OUString* pArray = aRet.getArray(); - pArray[0] = "Accessible"; - pArray[1] = "AccessibleContext"; - pArray[2] = "AccessibleComponent"; - return aRet; -} - void SAL_CALL SvxPixelCtlAccessibleChild::disposing() { - if( !rBHelper.bDisposed ) - { - ::osl::MutexGuard aGuard( m_aMutex ); - - // Send a disposing to all listeners. - if ( mnClientId ) - { - comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing( mnClientId, *this ); - mnClientId = 0; - } - - mxParent.clear(); - } -} - -void SvxPixelCtlAccessibleChild::ThrowExceptionIfNotAlive() -{ - if( rBHelper.bDisposed || rBHelper.bInDispose ) - throw lang::DisposedException(); + OAccessibleComponentHelper::disposing(); + mxParent.clear(); } -tools::Rectangle SvxPixelCtlAccessibleChild::GetBoundingBoxOnScreen() -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - // no ThrowExceptionIfNotAlive() because its done in GetBoundingBox() - tools::Rectangle aRect( GetBoundingBox() ); - - return tools::Rectangle( mrParentWindow.OutputToAbsoluteScreenPixel( aRect.TopLeft() ), aRect.GetSize() ); -} - -tools::Rectangle const & SvxPixelCtlAccessibleChild::GetBoundingBox() +awt::Rectangle SvxPixelCtlAccessibleChild::implGetBounds() { // no guard necessary, because no one changes maBoundingBox after creating it - ThrowExceptionIfNotAlive(); - - return maBoundingBox; + return AWTRectangle(maBoundingBox); } OUString SvxPixelCtlAccessibleChild::GetName() diff --git a/svx/source/accessibility/svxrectctaccessiblecontext.cxx b/svx/source/accessibility/svxrectctaccessiblecontext.cxx index d18fff3ad720..a92bdacbc632 100644 --- a/svx/source/accessibility/svxrectctaccessiblecontext.cxx +++ b/svx/source/accessibility/svxrectctaccessiblecontext.cxx @@ -400,6 +400,7 @@ sal_Int32 SvxRectCtlAccessibleContext::getForeground( ) return sal_Int32(mpRepr->GetControlForeground()); } + sal_Int32 SvxRectCtlAccessibleContext::getBackground( ) { ::SolarMutexGuard aSolarGuard; @@ -705,6 +706,7 @@ Reference< XAccessible > SAL_CALL RectCtlAccessibleContext::getAccessibleChild( Reference< XAccessible > SAL_CALL RectCtlAccessibleContext::getAccessibleParent() { + ::osl::MutexGuard aGuard( m_aMutex ); if (mpRepr) return mpRepr->getAccessibleParent(); return uno::Reference<css::accessibility::XAccessible>(); @@ -732,6 +734,7 @@ OUString SAL_CALL RectCtlAccessibleContext::getAccessibleName() */ Reference< XAccessibleRelationSet > SAL_CALL RectCtlAccessibleContext::getAccessibleRelationSet() { + ::osl::MutexGuard aGuard( m_aMutex ); if (mpRepr) return mpRepr->get_accessible_relation_set(); return uno::Reference<css::accessibility::XAccessibleRelationSet>(); diff --git a/svx/source/dialog/dlgctrl.cxx b/svx/source/dialog/dlgctrl.cxx index aee18ab17494..626debc835a8 100644 --- a/svx/source/dialog/dlgctrl.cxx +++ b/svx/source/dialog/dlgctrl.cxx @@ -103,14 +103,12 @@ void SvxRectCtl::dispose() Control::dispose(); } - void SvxRectCtl::Resize() { Resize_Impl(); Control::Resize(); } - void SvxRectCtl::Resize_Impl() { aSize = GetOutputSize(); @@ -612,7 +610,7 @@ Reference< XAccessible > SvxRectCtl::CreateAccessible() RectPoint SvxRectCtl::GetApproxRPFromPixPt( const css::awt::Point& r ) const { - return GetRPFromPoint( GetApproxLogPtFromPixPt( Point( r.X, r.Y ) ) ); + return GetRPFromPoint(GetApproxLogPtFromPixPt(Point(r.X, r.Y ))); } BitmapEx& RectCtl::GetRectBitmap() @@ -1135,14 +1133,11 @@ void RectCtl::DoCompletelyDisable(bool bNew) css::uno::Reference< css::accessibility::XAccessible > SvxPixelCtl::CreateAccessible() { - if(!m_xAccess.is()) - { - m_xAccess = new SvxPixelCtlAccessible(*this); - } + if (!m_xAccess.is()) + m_xAccess = new SvxPixelCtlAccessible(this); return m_xAccess.get(); } -//Logic Pixel long SvxPixelCtl::PointToIndex(const Point &aPt) const { long nX = aPt.X() * nLines / aRectSize.Width(); @@ -1170,56 +1165,48 @@ long SvxPixelCtl::GetFocusPosIndex() const return aFocusPosition.getX() + aFocusPosition.getY() * nLines ; } -long SvxPixelCtl::ShowPosition( const Point &pt) +long SvxPixelCtl::ShowPosition( const Point &rPt) { - Point aPt = PixelToLogic( pt ); - - sal_Int32 nX = aPt.X() * nLines / aRectSize.Width(); - sal_Int32 nY = aPt.Y() * nLines / aRectSize.Height(); + sal_Int32 nX = rPt.X() * nLines / aRectSize.Width(); + sal_Int32 nY = rPt.Y() * nLines / aRectSize.Height(); ChangePixel( nX + nY * nLines ); //Solution:Set new focus position and repaint - //Invalidate( Rectangle( aPtTl, aPtBr ) ); aFocusPosition.setX(nX); aFocusPosition.setY(nY); Invalidate(tools::Rectangle(Point(0,0),aRectSize)); - vcl::Window *pTabPage = getNonLayoutParent(this); - if (pTabPage && WindowType::TABPAGE == pTabPage->GetType()) - static_cast<SvxTabPage*>(pTabPage)->PointChanged( this, RectPoint::MM ); // RectPoint is dummy + if (m_pPage) + m_pPage->PointChanged(GetDrawingArea(), RectPoint::MM ); // RectPoint is dummy return GetFocusPosIndex(); } -SvxPixelCtl::SvxPixelCtl(vcl::Window* pParent) - : Control(pParent, WB_BORDER) +SvxPixelCtl::SvxPixelCtl(SvxTabPage* pPage) + : m_pPage(pPage) , bPaintable(true) , aFocusPosition(0,0) { - SetPixelColor( COL_BLACK ); - SetBackgroundColor( COL_WHITE ); - SetLineColor( COL_LIGHTGRAY ); maPixelData.fill(0); } void SvxPixelCtl::Resize() { - Control::Resize(); - aRectSize = GetOutputSize(); + CustomWidgetController::Resize(); + aRectSize = GetOutputSizePixel(); } -Size SvxPixelCtl::GetOptimalSize() const +void SvxPixelCtl::SetDrawingArea(weld::DrawingArea* pDrawingArea) { - return LogicToPixel(Size(72, 72), MapMode(MapUnit::MapAppFont)); + pDrawingArea->set_size_request(pDrawingArea->get_approximate_digit_width() * 25, + pDrawingArea->get_text_height() * 10); + CustomWidgetController::SetDrawingArea(pDrawingArea); } -VCL_BUILDER_FACTORY(SvxPixelCtl) - -SvxPixelCtl::~SvxPixelCtl( ) +SvxPixelCtl::~SvxPixelCtl() { - disposeOnce(); } // Changes the foreground or Background color @@ -1253,8 +1240,16 @@ void SvxPixelCtl::MouseButtonDown( const MouseEvent& rMEvt ) } } -// Draws the Control (Rectangle with nine circles) +tools::Rectangle SvxPixelCtl::GetFocusRect() +{ + tools::Rectangle aRet; + //Draw visual focus when has focus + if (HasFocus()) + aRet = implCalFocusRect(aFocusPosition); + return aRet; +} +// Draws the Control (Rectangle with nine circles) void SvxPixelCtl::Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& ) { if (!aRectSize.Width() || !aRectSize.Height()) @@ -1300,11 +1295,6 @@ void SvxPixelCtl::Paint( vcl::RenderContext& rRenderContext, const tools::Rectan rRenderContext.DrawRect(tools::Rectangle(aPtTl, aPtBr)); } } - //Draw visual focus when has focus - if (HasFocus()) - { - ShowFocus(implCalFocusRect(aFocusPosition)); - } } else { @@ -1330,7 +1320,7 @@ tools::Rectangle SvxPixelCtl::implCalFocusRect( const Point& aPosition ) } //Solution:Keyboard function -void SvxPixelCtl::KeyInput( const KeyEvent& rKEvt ) +bool SvxPixelCtl::KeyInput( const KeyEvent& rKEvt ) { vcl::KeyCode aKeyCode = rKEvt.GetKeyCode(); sal_uInt16 nCode = aKeyCode.GetCode(); @@ -1383,8 +1373,7 @@ void SvxPixelCtl::KeyInput( const KeyEvent& rKEvt ) Invalidate( implCalFocusRect(aFocusPosition) ); break; default: - Control::KeyInput( rKEvt ); - return; + return CustomWidgetController::KeyInput( rKEvt ); } if(m_xAccess.is()) { @@ -1407,10 +1396,11 @@ void SvxPixelCtl::KeyInput( const KeyEvent& rKEvt ) break; } } + return true; } else { - Control::KeyInput( rKEvt ); + return CustomWidgetController::KeyInput( rKEvt ); } } @@ -1419,23 +1409,15 @@ void SvxPixelCtl::GetFocus() { Invalidate(implCalFocusRect(aFocusPosition)); - if(m_xAccess.is()) + if (m_xAccess.is()) { m_xAccess->NotifyChild(GetFocusPosIndex(),true,false); } - - Control::GetFocus(); } -//Hide focus when lose focus void SvxPixelCtl::LoseFocus() { - HideFocus(); - if (m_xAccess.is()) - { - m_xAccess->LoseFocus(); - } - Control::LoseFocus(); + Invalidate(); } void SvxPixelCtl::SetXBitmap(const BitmapEx& rBitmapEx) diff --git a/svx/source/inc/svxpixelctlaccessiblecontext.hxx b/svx/source/inc/svxpixelctlaccessiblecontext.hxx index 4f399ea4a7a8..23af17a5c2ea 100644 --- a/svx/source/inc/svxpixelctlaccessiblecontext.hxx +++ b/svx/source/inc/svxpixelctlaccessiblecontext.hxx @@ -35,6 +35,7 @@ #include <com/sun/star/lang/XServiceName.hpp> #include <com/sun/star/lang/IndexOutOfBoundsException.hpp> #include <com/sun/star/lang/DisposedException.hpp> +#include <comphelper/accessibleselectionhelper.hxx> #include <cppuhelper/interfacecontainer.h> #include <cppuhelper/compbase6.hxx> #include <cppuhelper/compbase5.hxx> @@ -51,197 +52,121 @@ namespace com { namespace sun { namespace star { namespace awt { class XFocusListener; } } } }; class SvxPixelCtl; +class SvxPixelCtlAccessible; +typedef ::cppu::ImplHelper1<css::accessibility::XAccessible> OAccessibleHelper_Base; -typedef ::cppu::WeakAggComponentImplHelper5< - css::accessibility::XAccessible, - css::accessibility::XAccessibleComponent, - css::accessibility::XAccessibleContext, - css::accessibility::XAccessibleEventBroadcaster, - css::lang::XServiceInfo > - SvxPixelCtlAccessibleChild_BASE; - -class SvxPixelCtlAccessibleChild : - public ::cppu::BaseMutex, - public SvxPixelCtlAccessibleChild_BASE +class SvxPixelCtlAccessibleChild final : public ::comphelper::OAccessibleComponentHelper, + public OAccessibleHelper_Base { - SvxPixelCtl& mrParentWindow; - css::uno::Reference< css::accessibility::XAccessible > mxParent; - bool m_bPixelColorOrBG;//Pixel Color Or BackGround Color - tools::Rectangle maBoundingBox; - /// index of child in parent - long mnIndexInParent; public: SvxPixelCtlAccessibleChild( SvxPixelCtl& rWindow, bool bPixelColorOrBG, const tools::Rectangle& rBounds, - const css::uno::Reference< css::accessibility::XAccessible >& xParent, + const rtl::Reference<SvxPixelCtlAccessible>& xParent, long nIndexInParent ); - virtual ~SvxPixelCtlAccessibleChild() override; - //XAccessible - virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) override; + DECLARE_XINTERFACE( ) + DECLARE_XTYPEPROVIDER( ) + + //XAccessibleComponent + virtual void SAL_CALL grabFocus( ) override; + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const css::awt::Point& aPoint ) override; //XAccessibleContext virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) override; virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) override; virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) override; - virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) override; virtual sal_Int16 SAL_CALL getAccessibleRole( ) override; virtual OUString SAL_CALL getAccessibleDescription( ) override; virtual OUString SAL_CALL getAccessibleName( ) override; - virtual css::uno::Reference< css::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) override; virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) override; - virtual css::lang::Locale SAL_CALL getLocale( ) override; + virtual css::uno::Reference< css::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) override; + //XAccessible + virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) override; - //XAccessibleComponent - virtual sal_Bool SAL_CALL containsPoint( const css::awt::Point& aPoint ) override; - virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const css::awt::Point& aPoint ) override; - virtual css::awt::Rectangle SAL_CALL getBounds( ) override; - virtual css::awt::Point SAL_CALL getLocation( ) override; - virtual css::awt::Point SAL_CALL getLocationOnScreen( ) override; - virtual css::awt::Size SAL_CALL getSize( ) override; virtual sal_Int32 SAL_CALL getForeground( ) override; virtual sal_Int32 SAL_CALL getBackground( ) override; - virtual void SAL_CALL grabFocus( ) override; - - //XServiceInfo - virtual OUString SAL_CALL getImplementationName( ) override; - virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; - virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; - - //Methods for XAccessibleEventBroadcaster - sal_uInt32 mnClientId; - - virtual void SAL_CALL - addAccessibleEventListener( - const css::uno::Reference< css::accessibility::XAccessibleEventListener >& xListener ) override; - - virtual void SAL_CALL - removeAccessibleEventListener( - const css::uno::Reference< css::accessibility::XAccessibleEventListener >& xListener ) override; - - //Solution: Add the event handling method - void FireAccessibleEvent (short nEventId, const css::uno::Any& rOld, const css::uno::Any& rNew); - virtual void SAL_CALL disposing() override; - - /// @throws css::uno::RuntimeException - tools::Rectangle GetBoundingBoxOnScreen(); - - /// @throws css::uno::RuntimeException - tools::Rectangle const & GetBoundingBox(); - - /// @returns true if it's disposed or in disposing - inline bool IsAlive() const; - /// @throws css::lang::DisposedException if it's not alive - void ThrowExceptionIfNotAlive(); - void CheckChild(); void SelectChild( bool bSelect); void ChangePixelColorOrBG(bool bPixelColorOrBG){ m_bPixelColorOrBG = bPixelColorOrBG ;} OUString GetName(); -}; +private: + virtual ~SvxPixelCtlAccessibleChild() override; -typedef ::cppu::WeakAggComponentImplHelper6< - css::accessibility::XAccessible, - css::accessibility::XAccessibleComponent, - css::accessibility::XAccessibleContext, - css::accessibility::XAccessibleEventBroadcaster, - css::accessibility::XAccessibleSelection, - css::lang::XServiceInfo > - SvxPixelCtlAccessible_BASE; + virtual void SAL_CALL disposing() override; -class SvxPixelCtlAccessible : - public ::cppu::BaseMutex, - public SvxPixelCtlAccessible_BASE -{ - SvxPixelCtl& mrPixelCtl; + // OCommonAccessibleComponent + /// implements the calculation of the bounding rectangle + virtual css::awt::Rectangle implGetBounds( ) override; + SvxPixelCtl& mrParentWindow; + rtl::Reference<SvxPixelCtlAccessible> mxParent; + bool m_bPixelColorOrBG;//Pixel Color Or BackGround Color + tools::Rectangle maBoundingBox; + /// index of child in parent + long mnIndexInParent; +}; + +class SvxPixelCtlAccessible final : public ::comphelper::OAccessibleSelectionHelper, + public OAccessibleHelper_Base +{ public: - SvxPixelCtlAccessible(SvxPixelCtl& rWindow); - virtual ~SvxPixelCtlAccessible() override; + SvxPixelCtlAccessible(SvxPixelCtl* pPixelCtl); - //XAccessible - virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) override; + DECLARE_XINTERFACE( ) + DECLARE_XTYPEPROVIDER( ) + + //XAccessibleComponent + virtual void SAL_CALL grabFocus( ) override; + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const css::awt::Point& aPoint ) override; + //XAccessible //XAccessibleContext virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) override; virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) override; virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) override; - virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) override; virtual sal_Int16 SAL_CALL getAccessibleRole( ) override; virtual OUString SAL_CALL getAccessibleDescription( ) override; virtual OUString SAL_CALL getAccessibleName( ) override; - virtual css::uno::Reference< css::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) override; virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) override; - virtual css::lang::Locale SAL_CALL getLocale( ) override; - + virtual css::uno::Reference< css::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) override; - //XAccessibleComponent - virtual sal_Bool SAL_CALL containsPoint( const css::awt::Point& aPoint ) override; - virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const css::awt::Point& aPoint ) override; - virtual css::awt::Rectangle SAL_CALL getBounds( ) override; - virtual css::awt::Point SAL_CALL getLocation( ) override; - virtual css::awt::Point SAL_CALL getLocationOnScreen( ) override; - virtual css::awt::Size SAL_CALL getSize( ) override; + virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) override; virtual sal_Int32 SAL_CALL getForeground( ) override; virtual sal_Int32 SAL_CALL getBackground( ) override; - virtual void SAL_CALL grabFocus( ) override; - //XServiceInfo - virtual OUString SAL_CALL getImplementationName( ) override; - virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; - virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; - // XAccessibleSelection - void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) override; - sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) override; - void SAL_CALL clearAccessibleSelection( ) override; - void SAL_CALL selectAllAccessibleChildren( ) override; - sal_Int32 SAL_CALL getSelectedAccessibleChildCount( ) override; - css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) override; - void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) override; - - //Methods for XAccessibleEventBroadcaster - sal_uInt32 mnClientId; - - virtual void SAL_CALL - addAccessibleEventListener( - const css::uno::Reference< css::accessibility::XAccessibleEventListener >& xListener ) override; - - virtual void SAL_CALL - removeAccessibleEventListener( - const css::uno::Reference< css::accessibility::XAccessibleEventListener >& xListener ) override; - //Solution: Add the event handling method - void FireAccessibleEvent (short nEventId, const css::uno::Any& rOld, const css::uno::Any& rNew); - virtual void SAL_CALL disposing() override; css::uno::Reference< css::accessibility::XAccessible > CreateChild (long nIndex, Point mPoint); void LoseFocus(); - /// @returns true if it's disposed or in disposing - inline bool IsAlive() const; +private: + virtual ~SvxPixelCtlAccessible() override; + + // OCommonAccessibleSelection + // return if the specified child is visible => watch for special ChildIndexes (ACCESSIBLE_SELECTION_CHILD_xxx) + virtual bool implIsSelected(sal_Int32 nAccessibleChildIndex) override; + + // select the specified child => watch for special ChildIndexes (ACCESSIBLE_SELECTION_CHILD_xxx) + virtual void implSelect(sal_Int32 nAccessibleChildIndex, bool bSelect) override; -protected: + // OCommonAccessibleComponent + virtual css::awt::Rectangle implGetBounds() override; + + virtual void SAL_CALL disposing() override; + + SvxPixelCtl* mpPixelCtl; css::uno::Reference< css::accessibility::XAccessible> m_xCurChild; + public: void NotifyChild(long nIndex, bool bSelect, bool bCheck); }; -inline bool SvxPixelCtlAccessible::IsAlive() const -{ - return !rBHelper.bDisposed && !rBHelper.bInDispose; -} - -inline bool SvxPixelCtlAccessibleChild::IsAlive() const -{ - return !rBHelper.bDisposed && !rBHelper.bInDispose; -} - #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/inc/svxrectctaccessiblecontext.hxx b/svx/source/inc/svxrectctaccessiblecontext.hxx index de5df8a46ad7..6e3fb5b509bd 100644 --- a/svx/source/inc/svxrectctaccessiblecontext.hxx +++ b/svx/source/inc/svxrectctaccessiblecontext.hxx @@ -545,8 +545,8 @@ typedef ::cppu::ImplHelper3 < css::accessibility::XAccessible, css::accessibility::XAccessibleAction > OAccessibleHelper_Base_3; -class RectCtlChildAccessibleContext : public ::comphelper::OAccessibleComponentHelper, - public OAccessibleHelper_Base_3 +class RectCtlChildAccessibleContext final : public ::comphelper::OAccessibleComponentHelper, + public OAccessibleHelper_Base_3 { public: RectCtlChildAccessibleContext( @@ -554,13 +554,6 @@ public: const OUString& rName, const OUString& rDescription, const tools::Rectangle& rBoundingBox, long nIndexInParent ); -protected: - virtual ~RectCtlChildAccessibleContext() override; - - // OCommonAccessibleComponent - /// implements the calculation of the bounding rectangle - still waiting to be overwritten - virtual css::awt::Rectangle implGetBounds( ) override; -public: DECLARE_XINTERFACE( ) DECLARE_XTYPEPROVIDER( ) @@ -608,10 +601,14 @@ public: void setStateChecked(bool bChecked); void FireFocusEvent(); -protected: +private: + virtual ~RectCtlChildAccessibleContext() override; + virtual void SAL_CALL disposing() override; -private: + // OCommonAccessibleComponent + /// implements the calculation of the bounding rectangle + virtual css::awt::Rectangle implGetBounds( ) override; /** Description of this object. This is not a constant because it can be set from the outside. Furthermore, it changes according to the diff --git a/svx/source/tbxctrls/SvxPresetListBox.cxx b/svx/source/tbxctrls/SvxPresetListBox.cxx index fd320d81009c..d6ee0510a15a 100644 --- a/svx/source/tbxctrls/SvxPresetListBox.cxx +++ b/svx/source/tbxctrls/SvxPresetListBox.cxx @@ -130,4 +130,82 @@ IMPL_LINK(SvxPresetListBox, OnMenuItemSelected, Menu*, pMenu, bool) return false; } +PresetListBox::PresetListBox(std::unique_ptr<weld::ScrolledWindow> pWindow) + : SvtValueSet(std::move(pWindow)) + , nColCount(3) + , aIconSize(60, 64) +{ + SetEdgeBlending(true); + SetExtraSpacing(4); +} + +void PresetListBox::Resize() +{ + DrawLayout(); + WinBits aWinBits(GetStyle()); + aWinBits |= WB_VSCROLL; + SetStyle(aWinBits); + SvtValueSet::Resize(); +} + +bool PresetListBox::ContextMenu(const Point& rPos) +{ + const sal_uInt16 nIndex = GetSelectedItemId(); + if(nIndex > 0) + { + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetDrawingArea(), "svx/ui/presetmenu.ui")); + std::unique_ptr<weld::Menu> xMenu(xBuilder->weld_menu("menu")); + OnMenuItemSelected(xMenu->popup_at_rect(GetDrawingArea(), tools::Rectangle(rPos, Size(1,1)))); + return true; + } + return false; +} + +void PresetListBox::DrawLayout() +{ + SetColCount(getColumnCount()); + SetLineCount(5); +} + +template< typename ListType, typename EntryType > +void PresetListBox::FillPresetListBoxImpl(ListType & pList, sal_uInt32 nStartIndex) +{ + const Size aSize( GetIconSize() ); + BitmapEx aBitmap; + for(long nIndex = 0; nIndex < pList.Count(); nIndex++, nStartIndex++) + { + aBitmap = pList.GetBitmapForPreview(nIndex, aSize); + EntryType* pItem = static_cast<EntryType*>( pList.Get(nIndex) ); + InsertItem(nStartIndex, Image(aBitmap), pItem->GetName()); + } +} + +void PresetListBox::FillPresetListBox(XGradientList& pList, sal_uInt32 nStartIndex) +{ + FillPresetListBoxImpl< XGradientList, XGradientEntry>( pList, nStartIndex ); +} + +void PresetListBox::FillPresetListBox(XHatchList& pList, sal_uInt32 nStartIndex) +{ + FillPresetListBoxImpl< XHatchList, XHatchEntry>( pList, nStartIndex ); +} + +void PresetListBox::FillPresetListBox(XBitmapList& pList, sal_uInt32 nStartIndex) +{ + FillPresetListBoxImpl< XBitmapList, XBitmapEntry >( pList, nStartIndex ); +} + +void PresetListBox::FillPresetListBox(XPatternList& pList, sal_uInt32 nStartIndex) +{ + FillPresetListBoxImpl< XPatternList, XBitmapEntry >( pList, nStartIndex ); +} + +void PresetListBox::OnMenuItemSelected(const OString& rIdent) +{ + if (rIdent == "rename") + maRenameHdl.Call(this); + else if (rIdent == "delete") + maDeleteHdl.Call(this); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/workben/pixelctl.cxx b/svx/workben/pixelctl.cxx deleted file mode 100644 index 854dcd7b94eb..000000000000 --- a/svx/workben/pixelctl.cxx +++ /dev/null @@ -1,127 +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/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include <sal/main.h> - -#include <cppuhelper/bootstrap.hxx> -#include <comphelper/processfactory.hxx> - -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/uno/XComponentContext.hpp> - -#include <vcl/event.hxx> -#include <vcl/svapp.hxx> -#include <vcl/wrkwin.hxx> -#include <tools/extendapplicationenvironment.hxx> - -#include <svx/dlgctrl.hxx> - -#include <rtl/strbuf.hxx> -#include <rtl/ustrbuf.hxx> -#include <sal/log.hxx> - -#include <math.h> - -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::lang; -using namespace cppu; - -// Forward declaration -void Main(); - -SAL_IMPLEMENT_MAIN() -{ - try - { - tools::extendApplicationEnvironment(); - - // create the global service-manager - Reference< XComponentContext > xContext = defaultBootstrap_InitialComponentContext(); - Reference< XMultiServiceFactory > xServiceManager( xContext->getServiceManager(), UNO_QUERY ); - - if( !xServiceManager.is() ) - Application::Abort( "Failed to bootstrap" ); - - comphelper::setProcessServiceFactory( xServiceManager ); - - InitVCL(); - ::Main(); - DeInitVCL(); - } - catch (const Exception& e) - { - SAL_WARN("vcl.app", "Fatal: " << e); - return 1; - } - catch (const std::exception& e) - { - SAL_WARN("vcl.app", "Fatal: " << e.what()); - return 1; - } - - return 0; -} - -class MyWin : public WorkWindow -{ - VclPtr<SvxPixelCtl> maPixelCtl; - -public: - MyWin(vcl::Window* pParent, WinBits nWinStyle); - virtual ~MyWin() override - { - disposeOnce(); - } - virtual void dispose() override; - bool Close() override; -}; - -void Main() -{ - ScopedVclPtrInstance< MyWin > aMainWin( nullptr, WB_STDWORK ); - aMainWin->SetText( "SvxPixelCtl" ); - aMainWin->Show(); - - Application::Execute(); -} - -MyWin::MyWin( vcl::Window* pParent, WinBits nWinStyle ) : - WorkWindow( pParent, nWinStyle ), - maPixelCtl( VclPtr<SvxPixelCtl>::Create(this) ) -{ - maPixelCtl->SetPosSizePixel( Point( 10, 10 ), Size( 200, 200 ) ); - maPixelCtl->Show(); - -} - -void MyWin::dispose() -{ - maPixelCtl.disposeAndClear(); - WorkWindow::dispose(); -} - -bool MyWin::Close() -{ - bool bRet = WorkWindow::Close(); - if( bRet ) - Application::Quit(); - return bRet; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/app/customweld.cxx b/vcl/source/app/customweld.cxx index 860a9d2c515e..110d2e727a0c 100644 --- a/vcl/source/app/customweld.cxx +++ b/vcl/source/app/customweld.cxx @@ -30,6 +30,7 @@ CustomWeld::CustomWeld(weld::Builder& rBuilder, const OString& rDrawingId, m_xDrawingArea->connect_key_press(LINK(this, CustomWeld, DoKeyPress)); m_xDrawingArea->connect_focus_rect(LINK(this, CustomWeld, DoFocusRect)); m_xDrawingArea->connect_style_updated(LINK(this, CustomWeld, DoStyleUpdated)); + m_xDrawingArea->connect_popup_menu(LINK(this, CustomWeld, DoPopupMenu)); m_xDrawingArea->connect_query_tooltip(LINK(this, CustomWeld, DoRequestHelp)); m_rWidgetController.SetDrawingArea(m_xDrawingArea.get()); } @@ -79,6 +80,11 @@ IMPL_LINK_NOARG(CustomWeld, DoStyleUpdated, weld::Widget&, void) m_rWidgetController.StyleUpdated(); } +IMPL_LINK(CustomWeld, DoPopupMenu, const Point&, rPos, bool) +{ + return m_rWidgetController.ContextMenu(rPos); +} + IMPL_LINK(CustomWeld, DoRequestHelp, tools::Rectangle&, rHelpArea, OUString) { return m_rWidgetController.RequestHelp(rHelpArea); diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index 44d2aeea43f7..43eb8d510396 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -351,6 +351,11 @@ public: return m_xWidget->GetAccessibleName(); } + virtual OUString get_accessible_description() const override + { + return m_xWidget->GetAccessibleDescription(); + } + virtual void set_tooltip_text(const OUString& rTip) override { m_xWidget->SetQuickHelpText(rTip); @@ -455,7 +460,7 @@ public: { SalInstanceWidget* pVclWidget = dynamic_cast<SalInstanceWidget*>(pParent); assert(pVclWidget); - m_xMenu->Execute(pVclWidget->getWidget(), rRect, PopupMenuFlags::ExecuteDown); + m_xMenu->Execute(pVclWidget->getWidget(), rRect, PopupMenuFlags::ExecuteDown | PopupMenuFlags::NoMouseUpClose); return m_xMenu->GetCurItemIdent(); } virtual void set_sensitive(const OString& rIdent, bool bSensitive) override @@ -1855,6 +1860,7 @@ private: DECL_LINK(KeyPressHdl, const KeyEvent&, bool); DECL_LINK(KeyReleaseHdl, const KeyEvent&, bool); DECL_LINK(StyleUpdatedHdl, VclDrawingArea&, void); + DECL_LINK(PopupMenuHdl, const Point&, bool); DECL_LINK(QueryTooltipHdl, tools::Rectangle&, OUString); public: @@ -1873,6 +1879,7 @@ public: m_xDrawingArea->SetKeyPressHdl(LINK(this, SalInstanceDrawingArea, KeyPressHdl)); m_xDrawingArea->SetKeyReleaseHdl(LINK(this, SalInstanceDrawingArea, KeyReleaseHdl)); m_xDrawingArea->SetStyleUpdatedHdl(LINK(this, SalInstanceDrawingArea, StyleUpdatedHdl)); + m_xDrawingArea->SetPopupMenuHdl(LINK(this, SalInstanceDrawingArea, PopupMenuHdl)); m_xDrawingArea->SetQueryTooltipHdl(LINK(this, SalInstanceDrawingArea, QueryTooltipHdl)); } @@ -1930,6 +1937,7 @@ public: virtual ~SalInstanceDrawingArea() override { m_xDrawingArea->SetQueryTooltipHdl(Link<tools::Rectangle&, OUString>()); + m_xDrawingArea->SetPopupMenuHdl(Link<const Point&, bool>()); m_xDrawingArea->SetStyleUpdatedHdl(Link<VclDrawingArea&, void>()); m_xDrawingArea->SetMousePressHdl(Link<const MouseEvent&, void>()); m_xDrawingArea->SetMouseMoveHdl(Link<const MouseEvent&, void>()); @@ -1989,6 +1997,11 @@ IMPL_LINK_NOARG(SalInstanceDrawingArea, StyleUpdatedHdl, VclDrawingArea&, void) m_aStyleUpdatedHdl.Call(*this); } +IMPL_LINK(SalInstanceDrawingArea, PopupMenuHdl, const Point&, rPos, bool) +{ + return m_aPopupMenuHdl.Call(rPos); +} + IMPL_LINK(SalInstanceDrawingArea, QueryTooltipHdl, tools::Rectangle&, rHelpArea, OUString) { return m_aQueryTooltipHdl.Call(rHelpArea); diff --git a/vcl/source/uitest/uiobject.cxx b/vcl/source/uitest/uiobject.cxx index 7962a119fdd9..7d95907a9562 100644 --- a/vcl/source/uitest/uiobject.cxx +++ b/vcl/source/uitest/uiobject.cxx @@ -561,7 +561,16 @@ void ButtonUIObject::execute(const OUString& rAction, const StringMap& rParameters) { if (rAction == "CLICK") + { + //Click doesn't call toggle when its a pushbutton tweaked to be a toggle-button + if (PushButton *pPushButton = (mxButton->GetStyle() & WB_TOGGLE) ? dynamic_cast<PushButton*>(mxButton.get()) : nullptr) + { + pPushButton->Check(!pPushButton->IsChecked()); + pPushButton->Toggle(); + return; + } mxButton->Click(); + } else WindowUIObject::execute(rAction, rParameters); } diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx index 6cc7f982d900..039f4a78628a 100644 --- a/vcl/unx/gtk3/gtk3gtkinst.cxx +++ b/vcl/unx/gtk3/gtk3gtkinst.cxx @@ -1390,6 +1390,13 @@ public: return OUString(pStr, pStr ? strlen(pStr) : 0, RTL_TEXTENCODING_UTF8); } + virtual OUString get_accessible_description() const override + { + AtkObject* pAtkObject = gtk_widget_get_accessible(m_pWidget); + const char* pStr = pAtkObject ? atk_object_get_description(pAtkObject) : nullptr; + return OUString(pStr, pStr ? strlen(pStr) : 0, RTL_TEXTENCODING_UTF8); + } + virtual void set_tooltip_text(const OUString& rTip) override { gtk_widget_set_tooltip_text(m_pWidget, OUStringToOString(rTip, RTL_TEXTENCODING_UTF8).getStr()); @@ -4137,6 +4144,7 @@ private: gulong m_nKeyReleaseSignalId; gulong m_nStyleUpdatedSignalId; gulong m_nQueryTooltip; + gulong m_nPopupMenu; static gboolean signalDraw(GtkWidget*, cairo_t* cr, gpointer widget) { @@ -4207,6 +4215,19 @@ private: gtk_tooltip_set_tip_area(tooltip, &aGdkHelpArea); return true; } + bool signal_popup_menu(const Point& rPos) + { + return m_aPopupMenuHdl.Call(rPos); + } + static gboolean signalPopupMenu(GtkWidget* pWidget, gpointer widget) + { + GtkInstanceDrawingArea* pThis = static_cast<GtkInstanceDrawingArea*>(widget); + SolarMutexGuard aGuard; + //center it when we don't know where else to use + Point aPos(gtk_widget_get_allocated_width(pWidget) / 2, + gtk_widget_get_allocated_height(pWidget) / 2); + return pThis->signal_popup_menu(aPos); + } static gboolean signalButton(GtkWidget*, GdkEventButton* pEvent, gpointer widget) { GtkInstanceDrawingArea* pThis = static_cast<GtkInstanceDrawingArea*>(widget); @@ -4266,6 +4287,14 @@ private: Point aPos(pEvent->x, pEvent->y); if (AllSettings::GetLayoutRTL()) aPos.setX(gtk_widget_get_allocated_width(m_pWidget) - 1 - aPos.X()); + + if (gdk_event_triggers_context_menu(reinterpret_cast<GdkEvent*>(pEvent)) && pEvent->type == GDK_BUTTON_PRESS) + { + //if handled for context menu, stop processing + if (signal_popup_menu(aPos)) + return true; + } + sal_uInt32 nModCode = GtkSalFrame::GetMouseModCode(pEvent->state); sal_uInt16 nCode = m_nLastMouseButton | (nModCode & (KEY_SHIFT | KEY_MOD1 | KEY_MOD2)); MouseEvent aMEvt(aPos, nClicks, ImplGetMouseButtonMode(m_nLastMouseButton, nModCode), nCode, nCode); @@ -4339,6 +4368,7 @@ public: , m_nKeyReleaseSignalId(g_signal_connect(m_pDrawingArea,"key-release-event", G_CALLBACK(signalKey), this)) , m_nStyleUpdatedSignalId(g_signal_connect(m_pDrawingArea,"style-updated", G_CALLBACK(signalStyleUpdated), this)) , m_nQueryTooltip(g_signal_connect(m_pDrawingArea, "query-tooltip", G_CALLBACK(signalQueryTooltip), this)) + , m_nPopupMenu(g_signal_connect(m_pDrawingArea, "popup-menu", G_CALLBACK(signalPopupMenu), this)) { gtk_widget_set_has_tooltip(m_pWidget, true); g_object_set_data(G_OBJECT(m_pDrawingArea), "g-lo-GtkInstanceDrawingArea", this); @@ -4424,6 +4454,7 @@ public: g_object_steal_data(G_OBJECT(m_pDrawingArea), "g-lo-GtkInstanceDrawingArea"); if (m_pAccessible) g_object_unref(m_pAccessible); + g_signal_handler_disconnect(m_pDrawingArea, m_nPopupMenu); g_signal_handler_disconnect(m_pDrawingArea, m_nQueryTooltip); g_signal_handler_disconnect(m_pDrawingArea, m_nStyleUpdatedSignalId); g_signal_handler_disconnect(m_pDrawingArea, m_nKeyPressSignalId); @@ -5366,6 +5397,8 @@ void GtkInstanceWindow::help() weld::Builder* GtkInstance::CreateBuilder(weld::Widget* pParent, const OUString& rUIRoot, const OUString& rUIFile) { GtkInstanceWidget* pParentWidget = dynamic_cast<GtkInstanceWidget*>(pParent); + if (pParent && !pParentWidget) //remove when complete + return SalInstance::CreateBuilder(pParent, rUIRoot, rUIFile); GtkWidget* pBuilderParent = pParentWidget ? pParentWidget->getWidget() : nullptr; return new GtkInstanceBuilder(pBuilderParent, rUIRoot, rUIFile); } |