diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-09-30 17:42:47 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-10-01 18:46:21 +0200 |
commit | 0d1df8d5ea2ee25903044d7cb72d00a721a1b902 (patch) | |
tree | b80e43a012428ba0c67129bfe9e74d211bf1fa51 | |
parent | 38bef03742c94376a974f84693ff2e48693e6839 (diff) |
weld SvxLineTabPage
Change-Id: I91d7ec8a51ce935db40c57feeeed7b160cf4dad8
Reviewed-on: https://gerrit.libreoffice.org/61172
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | cui/source/inc/cuitabline.hxx | 126 | ||||
-rw-r--r-- | cui/source/tabpages/tpline.cxx | 1246 | ||||
-rw-r--r-- | cui/uiconfig/ui/linetabpage.ui | 352 | ||||
-rw-r--r-- | extras/source/glade/libreoffice-catalog.xml.in | 27 | ||||
-rw-r--r-- | include/svx/dlgctrl.hxx | 49 | ||||
-rw-r--r-- | include/vcl/weld.hxx | 17 | ||||
-rw-r--r-- | solenv/sanitizers/ui/cui.suppr | 4 | ||||
-rw-r--r-- | svx/source/dialog/dlgctrl.cxx | 286 | ||||
-rw-r--r-- | vcl/source/app/salvtables.cxx | 65 | ||||
-rw-r--r-- | vcl/unx/gtk3/gtk3gtkinst.cxx | 29 |
10 files changed, 915 insertions, 1286 deletions
diff --git a/cui/source/inc/cuitabline.hxx b/cui/source/inc/cuitabline.hxx index 13e15ff5d388..b873f8ae1ec7 100644 --- a/cui/source/inc/cuitabline.hxx +++ b/cui/source/inc/cuitabline.hxx @@ -25,7 +25,7 @@ #include <svx/tabarea.hxx> enum class PageType; -class SvxColorListBox; +class ColorListBox; class SvxLineTabDialog final : public SfxTabDialog { @@ -81,7 +81,7 @@ public: struct SvxBmpItemInfo { std::unique_ptr<SvxBrushItem> pBrushItem; - sal_uInt16 nItemId; + OUString sItemId; }; class SvxLineTabPage : public SfxTabPage @@ -90,34 +90,6 @@ class SvxLineTabPage : public SfxTabPage using TabPage::DeactivatePage; static const sal_uInt16 pLineRanges[]; private: - VclPtr<VclBox> m_pBoxColor; - VclPtr<LineLB> m_pLbLineStyle; - VclPtr<SvxColorListBox> m_pLbColor; - VclPtr<VclBox> m_pBoxWidth; - VclPtr<MetricField> m_pMtrLineWidth; - VclPtr<VclBox> m_pBoxTransparency; - VclPtr<MetricField> m_pMtrTransparent; - - VclPtr<VclFrame> m_pFlLineEnds; - VclPtr<VclBox> m_pBoxArrowStyles; - VclPtr<LineEndLB> m_pLbStartStyle; - VclPtr<VclBox> m_pBoxStart; - VclPtr<MetricField> m_pMtrStartWidth; - VclPtr<TriStateBox> m_pTsbCenterStart; - VclPtr<VclBox> m_pBoxEnd; - VclPtr<LineEndLB> m_pLbEndStyle; - VclPtr<MetricField> m_pMtrEndWidth; - VclPtr<TriStateBox> m_pTsbCenterEnd; - VclPtr<CheckBox> m_pCbxSynchronize; - VclPtr<SvxXLinePreview> m_pCtlPreview; - - VclPtr<VclFrame> m_pFLEdgeStyle; - VclPtr<VclGrid> m_pGridEdgeCaps; - VclPtr<ListBox> m_pLBEdgeStyle; - - // LineCaps - VclPtr<ListBox> m_pLBCapStyle; - //#58425# symbols on a line (e. g. StarChart) -> /** a list of symbols to be shown in menu. Symbol at position SID_ATTR_SYMBOLTYPE is to be shown in preview. The list position is to be used cyclic. */ @@ -129,15 +101,12 @@ private: long m_nSymbolType; /// attributes for the shown symbols; only necessary if not equal to line properties SfxItemSet* m_pSymbolAttr; - VclPtr<VclFrame> m_pFlSymbol; - VclPtr<VclGrid> m_pGridIconSize; - VclPtr<MenuButton> m_pSymbolMB; - VclPtr<MetricField> m_pSymbolWidthMF; - VclPtr<MetricField> m_pSymbolHeightMF; - VclPtr<CheckBox> m_pSymbolRatioCB; + std::vector<OUString> m_aGrfNames; std::vector< std::unique_ptr<SvxBmpItemInfo> > - m_aGrfBrushItems; + m_aGalleryBrushItems; + std::vector< std::unique_ptr<SvxBmpItemInfo> > + m_aSymbolBrushItems; bool m_bLastWidthModified; Size m_aSymbolLastSize; Graphic m_aSymbolGraphic; @@ -166,41 +135,76 @@ private: sal_Int32 m_nActLineWidth; + XLinePreview m_aCtlPreview; + std::unique_ptr<weld::Widget> m_xBoxColor; + std::unique_ptr<SvxLineLB> m_xLbLineStyle; + std::unique_ptr<ColorListBox> m_xLbColor; + std::unique_ptr<weld::Widget> m_xBoxWidth; + std::unique_ptr<weld::MetricSpinButton> m_xMtrLineWidth; + std::unique_ptr<weld::Widget> m_xBoxTransparency; + std::unique_ptr<weld::MetricSpinButton> m_xMtrTransparent; + std::unique_ptr<weld::Widget> m_xFlLineEnds; + std::unique_ptr<weld::Widget> m_xBoxArrowStyles; + std::unique_ptr<SvxLineEndLB> m_xLbStartStyle; + std::unique_ptr<weld::Widget> m_xBoxStart; + std::unique_ptr<weld::MetricSpinButton> m_xMtrStartWidth; + std::unique_ptr<weld::CheckButton> m_xTsbCenterStart; + std::unique_ptr<weld::Widget> m_xBoxEnd; + std::unique_ptr<SvxLineEndLB> m_xLbEndStyle; + std::unique_ptr<weld::MetricSpinButton> m_xMtrEndWidth; + std::unique_ptr<weld::CheckButton> m_xTsbCenterEnd; + std::unique_ptr<weld::CheckButton> m_xCbxSynchronize; + std::unique_ptr<weld::Menu> m_xMenu; + std::unique_ptr<weld::Menu> m_xGalleryMenu; + std::unique_ptr<weld::Menu> m_xSymbolsMenu; + std::unique_ptr<weld::CustomWeld> m_xCtlPreview; + + std::unique_ptr<weld::Widget> m_xFLEdgeStyle; + std::unique_ptr<weld::Widget> m_xGridEdgeCaps; + std::unique_ptr<weld::ComboBox> m_xLBEdgeStyle; + + // LineCaps + std::unique_ptr<weld::ComboBox> m_xLBCapStyle; + + std::unique_ptr<weld::Widget> m_xFlSymbol; + std::unique_ptr<weld::Widget> m_xGridIconSize; + std::unique_ptr<weld::MenuButton> m_xSymbolMB; + std::unique_ptr<weld::MetricSpinButton> m_xSymbolWidthMF; + std::unique_ptr<weld::MetricSpinButton> m_xSymbolHeightMF; + std::unique_ptr<weld::CheckButton> m_xSymbolRatioCB; + // handler for gallery popup menu button + size - DECL_LINK( GraphicHdl_Impl, MenuButton *, void ); - DECL_LINK( MenuCreateHdl_Impl, MenuButton *, void ); - DECL_LINK( SizeHdl_Impl, Edit&, void ); - DECL_LINK( RatioHdl_Impl, Button*, void ); - - DECL_LINK( ClickInvisibleHdl_Impl, ListBox&, void ); - DECL_LINK( ChangeStartClickHdl_Impl, Button*, void ); - DECL_LINK( ChangeStartListBoxHdl_Impl, ListBox&, void ); - DECL_LINK( ChangeStartModifyHdl_Impl, Edit&, void ); - void ChangeStartHdl_Impl(void const *); - DECL_LINK( ChangeEndListBoxHdl_Impl, ListBox&, void ); - DECL_LINK( ChangeEndModifyHdl_Impl, Edit&, void ); - DECL_LINK( ChangeEndClickHdl_Impl, Button*, void ); - void ChangeEndHdl_Impl(void const *); - DECL_LINK( ChangePreviewListBoxHdl_Impl, SvxColorListBox&, void ); - DECL_LINK( ChangePreviewModifyHdl_Impl, Edit&, void ); - void ChangePreviewHdl_Impl(void const *); - DECL_LINK( ChangeTransparentHdl_Impl, Edit&, void ); - - DECL_LINK( ChangeEdgeStyleHdl_Impl, ListBox&, void ); + DECL_LINK(GraphicHdl_Impl, const OString&, void); + void MenuCreate(); + DECL_LINK(SizeHdl_Impl, weld::MetricSpinButton&, void); + DECL_LINK(RatioHdl_Impl, weld::ToggleButton&, void); + + DECL_LINK(ClickInvisibleHdl_Impl, weld::ComboBox&, void); + void ClickInvisibleHdl_Impl(); + DECL_LINK(ChangeStartClickHdl_Impl, weld::Button&, void); + DECL_LINK(ChangeStartListBoxHdl_Impl, weld::ComboBox&, void); + DECL_LINK(ChangeStartModifyHdl_Impl, weld::MetricSpinButton&, void); + DECL_LINK(ChangeEndListBoxHdl_Impl, weld::ComboBox&, void); + DECL_LINK(ChangeEndModifyHdl_Impl, weld::MetricSpinButton&, void); + DECL_LINK(ChangeEndClickHdl_Impl, weld::Button&, void); + DECL_LINK(ChangePreviewListBoxHdl_Impl, ColorListBox&, void); + DECL_LINK(ChangePreviewModifyHdl_Impl, weld::MetricSpinButton&, void); + void ChangePreviewHdl_Impl(const weld::MetricSpinButton*); + DECL_LINK(ChangeTransparentHdl_Impl, weld::MetricSpinButton&, void); + + DECL_LINK(ChangeEdgeStyleHdl_Impl, weld::ComboBox&, void); // LineCaps - DECL_LINK( ChangeCapStyleHdl_Impl, ListBox&, void ); + DECL_LINK(ChangeCapStyleHdl_Impl, weld::ComboBox&, void); void FillXLSet_Impl(); - void InitSymbols(MenuButton const * pButton); - void SymbolSelected(MenuButton const * pButton); void FillListboxes(); public: void ShowSymbolControls(bool bOn); - SvxLineTabPage( vcl::Window* pParent, const SfxItemSet& rInAttrs ); + SvxLineTabPage(TabPageParent pParent, const SfxItemSet& rInAttrs); virtual ~SvxLineTabPage() override; virtual void dispose() override; diff --git a/cui/source/tabpages/tpline.cxx b/cui/source/tabpages/tpline.cxx index d7d6d12de777..053389519570 100644 --- a/cui/source/tabpages/tpline.cxx +++ b/cui/source/tabpages/tpline.cxx @@ -57,12 +57,6 @@ #define MAX_BMP_WIDTH 16 #define MAX_BMP_HEIGHT 16 -#define MN_GALLERY 4 -#define MN_SYMBOLS 5 -#define MN_SYMBOLS_NONE 1 -#define MN_SYMBOLS_AUTO 2 -#define MN_GALLERY_ENTRY 100 - using namespace com::sun::star; // static ---------------------------------------------------------------- @@ -76,75 +70,58 @@ const sal_uInt16 SvxLineTabPage::pLineRanges[] = 0 }; -SvxLineTabPage::SvxLineTabPage -( - vcl::Window* pParent, - const SfxItemSet& rInAttrs -) : - SfxTabPage ( pParent - ,"LineTabPage" - ,"cui/ui/linetabpage.ui" - , &rInAttrs ), - - m_pSymbolList(nullptr), - m_bNewSize(false), - m_nNumMenuGalleryItems(0), - m_nSymbolType(SVX_SYMBOLTYPE_UNKNOWN), // unknown respectively unchanged - m_pSymbolAttr(nullptr), - - m_bLastWidthModified(false), - m_aSymbolLastSize(Size(0,0)), - m_bSymbols(false), - - m_rOutAttrs ( rInAttrs ), - m_bObjSelected( false ), - - m_aXLineAttr ( rInAttrs.GetPool() ), - m_rXLSet ( m_aXLineAttr.GetItemSet() ), - m_pnLineEndListState( nullptr ), - m_pnDashListState( nullptr ), - m_pnColorListState( nullptr ), - m_nPageType( PageType::Area ), - - m_nDlgType(0), - m_pPosDashLb(nullptr), - m_pPosLineEndLb(nullptr) +SvxLineTabPage::SvxLineTabPage(TabPageParent pParent, const SfxItemSet& rInAttrs) + : SfxTabPage(pParent, "cui/ui/linetabpage.ui", "SvxLineTabPage", &rInAttrs) + , m_pSymbolList(nullptr) + , m_bNewSize(false) + , m_nNumMenuGalleryItems(0) + , m_nSymbolType(SVX_SYMBOLTYPE_UNKNOWN) // unknown respectively unchanged + , m_pSymbolAttr(nullptr) + , m_bLastWidthModified(false) + , m_aSymbolLastSize(Size(0,0)) + , m_bSymbols(false) + , m_rOutAttrs(rInAttrs) + , m_bObjSelected(false) + , m_aXLineAttr(rInAttrs.GetPool()) + , m_rXLSet(m_aXLineAttr.GetItemSet()) + , m_pnLineEndListState(nullptr) + , m_pnDashListState(nullptr) + , m_pnColorListState(nullptr) + , m_nPageType(PageType::Area) + , m_nDlgType(0) + , m_pPosDashLb(nullptr) + , m_pPosLineEndLb(nullptr) + , m_xBoxColor(m_xBuilder->weld_widget("boxCOLOR")) + , m_xLbLineStyle(new SvxLineLB(m_xBuilder->weld_combo_box("LB_LINE_STYLE"))) + , m_xLbColor(new ColorListBox(m_xBuilder->weld_menu_button("LB_COLOR"), pParent.GetFrameWeld())) + , m_xBoxWidth(m_xBuilder->weld_widget("boxWIDTH")) + , m_xMtrLineWidth(m_xBuilder->weld_metric_spin_button("MTR_FLD_LINE_WIDTH", FUNIT_CM)) + , m_xBoxTransparency(m_xBuilder->weld_widget("boxTRANSPARENCY")) + , m_xMtrTransparent(m_xBuilder->weld_metric_spin_button("MTR_LINE_TRANSPARENT", FUNIT_PERCENT)) + , m_xFlLineEnds(m_xBuilder->weld_widget("FL_LINE_ENDS")) + , m_xBoxArrowStyles(m_xBuilder->weld_widget("boxARROW_STYLES")) + , m_xLbStartStyle(new SvxLineEndLB(m_xBuilder->weld_combo_box("LB_START_STYLE"))) + , m_xBoxStart(m_xBuilder->weld_widget("boxSTART")) + , m_xMtrStartWidth(m_xBuilder->weld_metric_spin_button("MTR_FLD_START_WIDTH", FUNIT_CM)) + , m_xTsbCenterStart(m_xBuilder->weld_check_button("TSB_CENTER_START")) + , m_xBoxEnd(m_xBuilder->weld_widget("boxEND")) + , m_xLbEndStyle(new SvxLineEndLB(m_xBuilder->weld_combo_box("LB_END_STYLE"))) + , m_xMtrEndWidth(m_xBuilder->weld_metric_spin_button("MTR_FLD_END_WIDTH", FUNIT_CM)) + , m_xTsbCenterEnd(m_xBuilder->weld_check_button("TSB_CENTER_END")) + , m_xCbxSynchronize(m_xBuilder->weld_check_button("CBX_SYNCHRONIZE")) + , m_xMenu(m_xBuilder->weld_menu("menuSELECT")) + , m_xCtlPreview(new weld::CustomWeld(*m_xBuilder, "CTL_PREVIEW", m_aCtlPreview)) + , m_xFLEdgeStyle(m_xBuilder->weld_widget("FL_EDGE_STYLE")) + , m_xGridEdgeCaps(m_xBuilder->weld_widget("gridEDGE_CAPS")) + , m_xLBEdgeStyle(m_xBuilder->weld_combo_box("LB_EDGE_STYLE")) + , m_xLBCapStyle(m_xBuilder->weld_combo_box("LB_CAP_STYLE")) // LineCaps + , m_xFlSymbol(m_xBuilder->weld_widget("FL_SYMBOL_FORMAT")) //#58425# Symbols on a line (e.g. StarChart) + , m_xGridIconSize(m_xBuilder->weld_widget("gridICON_SIZE")) + , m_xSymbolMB(m_xBuilder->weld_menu_button("MB_SYMBOL_BITMAP")) + , m_xSymbolWidthMF(m_xBuilder->weld_metric_spin_button("MF_SYMBOL_WIDTH", FUNIT_CM)) + , m_xSymbolHeightMF(m_xBuilder->weld_metric_spin_button("MF_SYMBOL_HEIGHT", FUNIT_CM)) + , m_xSymbolRatioCB(m_xBuilder->weld_check_button("CB_SYMBOL_RATIO")) { - get(m_pLbLineStyle,"LB_LINE_STYLE"); - get(m_pBoxColor,"boxCOLOR"); - get(m_pLbColor,"LB_COLOR"); - get(m_pBoxWidth,"boxWIDTH"); - get(m_pMtrLineWidth,"MTR_FLD_LINE_WIDTH"); - get(m_pBoxTransparency,"boxTRANSPARENCY"); - get(m_pMtrTransparent,"MTR_LINE_TRANSPARENT"); - - get(m_pFlLineEnds,"FL_LINE_ENDS"); - get(m_pBoxArrowStyles,"boxARROW_STYLES"); - get(m_pLbStartStyle,"LB_START_STYLE"); - get(m_pBoxStart,"boxSTART"); - get(m_pMtrStartWidth,"MTR_FLD_START_WIDTH"); - get(m_pTsbCenterStart,"TSB_CENTER_START"); - get(m_pBoxEnd,"boxEND"); - get(m_pLbEndStyle,"LB_END_STYLE"); - get(m_pMtrEndWidth,"MTR_FLD_END_WIDTH"); - get(m_pTsbCenterEnd,"TSB_CENTER_END"); - get(m_pCbxSynchronize,"CBX_SYNCHRONIZE"); - get(m_pCtlPreview,"CTL_PREVIEW"); - - get(m_pGridEdgeCaps,"gridEDGE_CAPS"); - get(m_pFLEdgeStyle,"FL_EDGE_STYLE"); - get(m_pLBEdgeStyle,"LB_EDGE_STYLE"); - // LineCaps - get(m_pLBCapStyle,"LB_CAP_STYLE"); - - //#58425# Symbols on a line (e.g. StarChart) - get(m_pFlSymbol,"FL_SYMBOL_FORMAT"); - get(m_pGridIconSize,"gridICON_SIZE"); - get(m_pSymbolMB,"MB_SYMBOL_BITMAP"); - get(m_pSymbolWidthMF,"MF_SYMBOL_WIDTH"); - get(m_pSymbolHeightMF,"MF_SYMBOL_HEIGHT"); - get(m_pSymbolRatioCB,"CB_SYMBOL_RATIO"); - // This Page requires ExchangeSupport SetExchangeSupport(); @@ -158,54 +135,53 @@ SvxLineTabPage::SvxLineTabPage eFUnit = FUNIT_MM; SAL_FALLTHROUGH; // we now have mm case FUNIT_MM: - m_pMtrLineWidth->SetSpinSize( 50 ); - m_pMtrStartWidth->SetSpinSize( 50 ); - m_pMtrEndWidth->SetSpinSize( 50 ); + m_xMtrLineWidth->set_increments(50, 500, FUNIT_NONE); + m_xMtrStartWidth->set_increments(50, 500, FUNIT_NONE); + m_xMtrEndWidth->set_increments(50, 500, FUNIT_NONE); break; case FUNIT_INCH: - m_pMtrLineWidth->SetSpinSize( 2 ); - m_pMtrStartWidth->SetSpinSize( 2 ); - m_pMtrEndWidth->SetSpinSize( 2 ); + m_xMtrLineWidth->set_increments(2, 20, FUNIT_NONE); + m_xMtrStartWidth->set_increments(2, 20, FUNIT_NONE); + m_xMtrEndWidth->set_increments(2, 20, FUNIT_NONE); break; default: ;// prevent warning } - SetFieldUnit( *m_pMtrLineWidth, eFUnit ); - SetFieldUnit( *m_pMtrStartWidth, eFUnit ); - SetFieldUnit( *m_pMtrEndWidth, eFUnit ); + SetFieldUnit( *m_xMtrLineWidth, eFUnit ); + SetFieldUnit( *m_xMtrStartWidth, eFUnit ); + SetFieldUnit( *m_xMtrEndWidth, eFUnit ); // determine PoolUnit SfxItemPool* pPool = m_rOutAttrs.GetPool(); DBG_ASSERT( pPool, "Where is the pool?" ); m_ePoolUnit = pPool->GetMetric( SID_ATTR_LINE_WIDTH ); - m_pLbLineStyle->SetSelectHdl( LINK( this, SvxLineTabPage, ClickInvisibleHdl_Impl ) ); - m_pLbColor->SetSelectHdl( LINK( this, SvxLineTabPage, ChangePreviewListBoxHdl_Impl ) ); - m_pMtrLineWidth->SetModifyHdl( LINK( this, SvxLineTabPage, ChangePreviewModifyHdl_Impl ) ); - m_pMtrTransparent->SetModifyHdl( LINK( this, SvxLineTabPage, ChangeTransparentHdl_Impl ) ); + m_xLbLineStyle->connect_changed(LINK(this, SvxLineTabPage, ClickInvisibleHdl_Impl)); + m_xLbColor->SetSelectHdl( LINK( this, SvxLineTabPage, ChangePreviewListBoxHdl_Impl ) ); + m_xMtrLineWidth->connect_value_changed(LINK(this, SvxLineTabPage, ChangePreviewModifyHdl_Impl)); + m_xMtrTransparent->connect_value_changed(LINK( this, SvxLineTabPage, ChangeTransparentHdl_Impl)); - m_pLbStartStyle->SetSelectHdl( LINK( this, SvxLineTabPage, ChangeStartListBoxHdl_Impl ) ); - m_pLbEndStyle->SetSelectHdl( LINK( this, SvxLineTabPage, ChangeEndListBoxHdl_Impl ) ); - m_pMtrStartWidth->SetModifyHdl( LINK( this, SvxLineTabPage, ChangeStartModifyHdl_Impl ) ); - m_pMtrEndWidth->SetModifyHdl( LINK( this, SvxLineTabPage, ChangeEndModifyHdl_Impl ) ); - m_pTsbCenterStart->SetClickHdl( LINK( this, SvxLineTabPage, ChangeStartClickHdl_Impl ) ); - m_pTsbCenterEnd->SetClickHdl( LINK( this, SvxLineTabPage, ChangeEndClickHdl_Impl ) ); + m_xLbStartStyle->connect_changed(LINK(this, SvxLineTabPage, ChangeStartListBoxHdl_Impl)); + m_xLbEndStyle->connect_changed(LINK(this, SvxLineTabPage, ChangeEndListBoxHdl_Impl)); + m_xMtrStartWidth->connect_value_changed(LINK(this, SvxLineTabPage, ChangeStartModifyHdl_Impl)); + m_xMtrEndWidth->connect_value_changed(LINK( this, SvxLineTabPage, ChangeEndModifyHdl_Impl)); + m_xTsbCenterStart->connect_clicked(LINK(this, SvxLineTabPage, ChangeStartClickHdl_Impl)); + m_xTsbCenterEnd->connect_clicked(LINK(this, SvxLineTabPage, ChangeEndClickHdl_Impl)); - Link<ListBox&,void> aEdgeStyle = LINK( this, SvxLineTabPage, ChangeEdgeStyleHdl_Impl ); - m_pLBEdgeStyle->SetSelectHdl( aEdgeStyle ); + Link<weld::ComboBox&,void> aEdgeStyle = LINK(this, SvxLineTabPage, ChangeEdgeStyleHdl_Impl); + m_xLBEdgeStyle->connect_changed(aEdgeStyle); // LineCaps - Link<ListBox&,void> aCapStyle = LINK( this, SvxLineTabPage, ChangeCapStyleHdl_Impl ); - m_pLBCapStyle->SetSelectHdl( aCapStyle ); + Link<weld::ComboBox&,void> aCapStyle = LINK(this, SvxLineTabPage, ChangeCapStyleHdl_Impl); + m_xLBCapStyle->connect_changed(aCapStyle); // Symbols on a line (eg star charts), MB-handler set - m_pSymbolMB->SetSelectHdl(LINK(this, SvxLineTabPage, GraphicHdl_Impl)); - m_pSymbolMB->SetActivateHdl(LINK(this, SvxLineTabPage, MenuCreateHdl_Impl)); - m_pSymbolWidthMF->SetModifyHdl(LINK(this, SvxLineTabPage, SizeHdl_Impl)); - m_pSymbolHeightMF->SetModifyHdl(LINK(this, SvxLineTabPage, SizeHdl_Impl)); - m_pSymbolRatioCB->SetClickHdl(LINK(this, SvxLineTabPage, RatioHdl_Impl)); + m_xSymbolMB->connect_selected(LINK(this, SvxLineTabPage, GraphicHdl_Impl)); + m_xSymbolWidthMF->connect_value_changed(LINK(this, SvxLineTabPage, SizeHdl_Impl)); + m_xSymbolHeightMF->connect_value_changed(LINK(this, SvxLineTabPage, SizeHdl_Impl)); + m_xSymbolRatioCB->connect_toggled(LINK(this, SvxLineTabPage, RatioHdl_Impl)); - m_pSymbolRatioCB->Check(); + m_xSymbolRatioCB->set_active(true); ShowSymbolControls(false); m_nActLineWidth = -1; @@ -216,8 +192,10 @@ void SvxLineTabPage::ShowSymbolControls(bool bOn) // Symbols on a line (e.g. StarCharts), symbol-enable controls m_bSymbols=bOn; - m_pFlSymbol->Show(bOn); - m_pCtlPreview->ShowSymbol(bOn); + m_xFlSymbol->show(bOn); + if (bOn) + MenuCreate(); + m_aCtlPreview.ShowSymbol(bOn); } SvxLineTabPage::~SvxLineTabPage() @@ -227,37 +205,14 @@ SvxLineTabPage::~SvxLineTabPage() void SvxLineTabPage::dispose() { - m_aGrfBrushItems.clear(); - - m_pBoxColor.clear(); - m_pLbLineStyle.clear(); - m_pLbColor.clear(); - m_pBoxWidth.clear(); - m_pMtrLineWidth.clear(); - m_pBoxTransparency.clear(); - m_pMtrTransparent.clear(); - m_pFlLineEnds.clear(); - m_pBoxArrowStyles.clear(); - m_pLbStartStyle.clear(); - m_pBoxStart.clear(); - m_pMtrStartWidth.clear(); - m_pTsbCenterStart.clear(); - m_pBoxEnd.clear(); - m_pLbEndStyle.clear(); - m_pMtrEndWidth.clear(); - m_pTsbCenterEnd.clear(); - m_pCbxSynchronize.clear(); - m_pCtlPreview.clear(); - m_pFLEdgeStyle.clear(); - m_pGridEdgeCaps.clear(); - m_pLBEdgeStyle.clear(); - m_pLBCapStyle.clear(); - m_pFlSymbol.clear(); - m_pGridIconSize.clear(); - m_pSymbolMB.clear(); - m_pSymbolWidthMF.clear(); - m_pSymbolHeightMF.clear(); - m_pSymbolRatioCB.clear(); + m_xCtlPreview.reset(); + m_xLbEndStyle.reset(); + m_xLbStartStyle.reset(); + m_xLbColor.reset(); + m_xLbLineStyle.reset(); + m_aGalleryBrushItems.clear(); + m_aSymbolBrushItems.clear(); + SfxTabPage::dispose(); } @@ -266,277 +221,28 @@ void SvxLineTabPage::Construct() FillListboxes(); } -void SvxLineTabPage::InitSymbols(MenuButton const * pButton) -{ - // Initialize popup - if(!pButton->GetPopupMenu()->GetPopupMenu( MN_GALLERY )) - { - // Get gallery entries - GalleryExplorer::FillObjList(GALLERY_THEME_BULLETS, m_aGrfNames); - - VclPtrInstance<PopupMenu> pPopup; - sal_uInt32 i = 0; - m_nNumMenuGalleryItems = m_aGrfNames.size(); - for (auto const& grfName : m_aGrfNames) - { - const OUString *pUIName = &grfName; - - // Convert URL encodings to UI characters (e.g. %20 for spaces) - OUString aPhysicalName; - if (osl::FileBase::getSystemPathFromFileURL(grfName, aPhysicalName) - == osl::FileBase::E_None) - { - pUIName = &aPhysicalName; - } - - SvxBmpItemInfo* pInfo = new SvxBmpItemInfo; - pInfo->pBrushItem.reset(new SvxBrushItem(grfName, "", GPOS_AREA, SID_ATTR_BRUSH)); - pInfo->nItemId = static_cast<sal_uInt16>(MN_GALLERY_ENTRY + i); - if ( i < m_aGrfBrushItems.size() ) - { - m_aGrfBrushItems.insert( m_aGrfBrushItems.begin() + i, std::unique_ptr<SvxBmpItemInfo>(pInfo) ); - } else - { - m_aGrfBrushItems.emplace_back( pInfo ); - } - const Graphic* pGraphic = pInfo->pBrushItem->GetGraphic(); - - if(pGraphic) - { - BitmapEx aBitmap(pGraphic->GetBitmapEx()); - Size aSize(aBitmap.GetSizePixel()); - if(aSize.Width() > MAX_BMP_WIDTH || aSize.Height() > MAX_BMP_HEIGHT) - { - bool bWidth = aSize.Width() > aSize.Height(); - double nScale = bWidth ? - double(MAX_BMP_WIDTH) / static_cast<double>(aSize.Width()): - double(MAX_BMP_HEIGHT) / static_cast<double>(aSize.Height()); - aBitmap.Scale(nScale, nScale); - - } - Image aImage(aBitmap); - pPopup->InsertItem(pInfo->nItemId, *pUIName, aImage ); - } - else - { - Image aImage; - pPopup->InsertItem(pInfo->nItemId, *pUIName, aImage ); - } - ++i; - } - m_pSymbolMB->GetPopupMenu()->SetPopupMenu( MN_GALLERY, pPopup ); - - if(m_aGrfNames.empty()) - m_pSymbolMB->GetPopupMenu()->EnableItem(MN_GALLERY, false); - } - - if(!pButton->GetPopupMenu()->GetPopupMenu( MN_SYMBOLS ) && m_pSymbolList) - { - ScopedVclPtrInstance< VirtualDevice > pVDev; - pVDev->SetMapMode(MapMode(MapUnit::Map100thMM)); - std::unique_ptr<SdrModel> pModel( - new SdrModel(nullptr, nullptr, true)); - pModel->GetItemPool().FreezeIdRanges(); - // Page - SdrPage* pPage = new SdrPage( *pModel, false ); - pPage->SetSize(Size(1000,1000)); - pModel->InsertPage( pPage, 0 ); - { - // 3D View - std::unique_ptr<SdrView> pView(new SdrView( *pModel, pVDev )); - pView->hideMarkHandles(); - pView->ShowSdrPage(pPage); - - VclPtrInstance<PopupMenu> pPopup; - - // Generate invisible square to give all symbols a - // bitmap size, which is independent from specific glyph - SdrObject *pInvisibleSquare=m_pSymbolList->GetObj(0); - - // directly clone to target SdrModel - pInvisibleSquare = pInvisibleSquare->CloneSdrObject(*pModel); - - pPage->NbcInsertObject(pInvisibleSquare); - pInvisibleSquare->SetMergedItem(XFillTransparenceItem(100)); - pInvisibleSquare->SetMergedItem(XLineTransparenceItem(100)); - - for(size_t i=0;; ++i) - { - SdrObject *pObj=m_pSymbolList->GetObj(i); - if(pObj==nullptr) - break; - - // directly clone to target SdrModel - pObj = pObj->CloneSdrObject(*pModel); - - m_aGrfNames.emplace_back(""); - pPage->NbcInsertObject(pObj); - if(m_pSymbolAttr) - { - pObj->SetMergedItemSet(*m_pSymbolAttr); - } - else - { - pObj->SetMergedItemSet(m_rOutAttrs); - } - pView->MarkAll(); - BitmapEx aBitmapEx(pView->GetMarkedObjBitmapEx()); - GDIMetaFile aMeta(pView->GetMarkedObjMetaFile()); - pView->UnmarkAll(); - pObj=pPage->RemoveObject(1); - SdrObject::Free(pObj); - - SvxBmpItemInfo* pInfo = new SvxBmpItemInfo; - pInfo->pBrushItem.reset(new SvxBrushItem(Graphic(aMeta), GPOS_AREA, SID_ATTR_BRUSH)); - pInfo->nItemId = static_cast<sal_uInt16>(MN_GALLERY_ENTRY + i + m_nNumMenuGalleryItems); - if ( static_cast<size_t>(m_nNumMenuGalleryItems + i) < m_aGrfBrushItems.size() ) { - m_aGrfBrushItems.insert( m_aGrfBrushItems.begin() + m_nNumMenuGalleryItems + i, std::unique_ptr<SvxBmpItemInfo>(pInfo) ); - } else { - m_aGrfBrushItems.emplace_back( pInfo ); - } - - Size aSize(aBitmapEx.GetSizePixel()); - if(aSize.Width() > MAX_BMP_WIDTH || aSize.Height() > MAX_BMP_HEIGHT) - { - bool bWidth = aSize.Width() > aSize.Height(); - double nScale = bWidth ? - double(MAX_BMP_WIDTH) / static_cast<double>(aSize.Width()): - double(MAX_BMP_HEIGHT) / static_cast<double>(aSize.Height()); - aBitmapEx.Scale(nScale, nScale); - } - Image aImage(aBitmapEx); - pPopup->InsertItem(pInfo->nItemId,"",aImage); - } - pInvisibleSquare=pPage->RemoveObject(0); - SdrObject::Free(pInvisibleSquare); - - m_pSymbolMB->GetPopupMenu()->SetPopupMenu( MN_SYMBOLS, pPopup ); - - if(m_aGrfNames.empty()) - m_pSymbolMB->GetPopupMenu()->EnableItem(MN_SYMBOLS, false); - - } - } -} - -void SvxLineTabPage::SymbolSelected(MenuButton const * pButton) -{ - sal_uInt16 nItemId = pButton->GetCurItemId(); - const Graphic* pGraphic = nullptr; - Graphic aGraphic; - bool bResetSize = false; - bool bEnable = true; - long nPreviousSymbolType = m_nSymbolType; - - if(nItemId >= MN_GALLERY_ENTRY) - { - if( (nItemId-MN_GALLERY_ENTRY) >= m_nNumMenuGalleryItems) - { - m_nSymbolType=nItemId-MN_GALLERY_ENTRY-m_nNumMenuGalleryItems; // List's index - } - else - { - m_nSymbolType=SVX_SYMBOLTYPE_BRUSHITEM; - bResetSize = true; - } - SvxBmpItemInfo* pInfo = m_aGrfBrushItems[ nItemId - MN_GALLERY_ENTRY ].get(); - pGraphic = pInfo->pBrushItem->GetGraphic(); - } - else switch(nItemId) - { - case MN_SYMBOLS_AUTO: - { - pGraphic=&m_aAutoSymbolGraphic; - m_aAutoSymbolGraphic.SetPrefSize( Size(253,253) ); - m_nSymbolType=SVX_SYMBOLTYPE_AUTO; - } - break; - - case MN_SYMBOLS_NONE: - { - m_nSymbolType=SVX_SYMBOLTYPE_NONE; - pGraphic=nullptr; - bEnable = false; - } - break; - default: - { - SvxOpenGraphicDialog aGrfDlg(CuiResId(RID_SVXSTR_EDIT_GRAPHIC), GetFrameWeld()); - aGrfDlg.EnableLink(false); - aGrfDlg.AsLink(false); - if( !aGrfDlg.Execute() ) - { - // Remember selected filters - if( !aGrfDlg.GetGraphic(aGraphic) ) - { - m_nSymbolType=SVX_SYMBOLTYPE_BRUSHITEM; - pGraphic = &aGraphic; - bResetSize = true; - } - } - if( !pGraphic ) - return; - } - break; - } - - if(pGraphic) - { - Size aSize = SvxNumberFormat::GetGraphicSizeMM100(pGraphic); - aSize = OutputDevice::LogicToLogic(aSize, MapMode(MapUnit::Map100thMM), MapMode(m_ePoolUnit)); - m_aSymbolGraphic=*pGraphic; - if( bResetSize ) - { - m_aSymbolSize=aSize; - } - else if( nPreviousSymbolType == SVX_SYMBOLTYPE_BRUSHITEM ) - { //#i31097# Data Point Symbol size changes when a different symbol is chosen(maoyg) - if( m_aSymbolSize.Width() != m_aSymbolSize.Height() ) - { - aSize.setWidth( static_cast<long>( m_aSymbolSize.Width() + m_aSymbolSize.Height() )/2 ); - aSize.setHeight( static_cast<long>( m_aSymbolSize.Width() + m_aSymbolSize.Height() )/2 ); - m_aSymbolSize = aSize; - } - } - m_pCtlPreview->SetSymbol(&m_aSymbolGraphic,m_aSymbolSize); - } - else - { - m_aSymbolGraphic=Graphic(); - m_pCtlPreview->SetSymbol(nullptr,m_aSymbolSize); - bEnable = false; - } - m_aSymbolLastSize=m_aSymbolSize; - SetMetricValue(*m_pSymbolWidthMF, m_aSymbolSize.Width(), m_ePoolUnit); - SetMetricValue(*m_pSymbolHeightMF, m_aSymbolSize.Height(), m_ePoolUnit); - - m_pGridIconSize->Enable(bEnable); - m_pCtlPreview->Invalidate(); -} - void SvxLineTabPage::FillListboxes() { // Line styles - sal_Int32 nOldSelect = m_pLbLineStyle->GetSelectedEntryPos(); + auto nOldSelect = m_xLbLineStyle->get_active(); // aLbLineStyle.FillStyles(); - m_pLbLineStyle->Fill( m_pDashList ); - m_pLbLineStyle->SelectEntryPos( nOldSelect ); + m_xLbLineStyle->Fill( m_pDashList ); + m_xLbLineStyle->set_active( nOldSelect ); // Line end style OUString sNone( SvxResId( RID_SVXSTR_NONE ) ); - nOldSelect = m_pLbStartStyle->GetSelectedEntryPos(); - m_pLbStartStyle->Clear(); - m_pLbStartStyle->InsertEntry( sNone ); - m_pLbStartStyle->Fill( m_pLineEndList ); - m_pLbStartStyle->SelectEntryPos( nOldSelect ); - nOldSelect = m_pLbEndStyle->GetSelectedEntryPos(); - m_pLbEndStyle->Clear(); - m_pLbEndStyle->InsertEntry( sNone ); - m_pLbEndStyle->Fill( m_pLineEndList, false ); - m_pLbEndStyle->SelectEntryPos( nOldSelect ); + nOldSelect = m_xLbStartStyle->get_active(); + m_xLbStartStyle->clear(); + m_xLbStartStyle->append_text(sNone); + m_xLbStartStyle->Fill(m_pLineEndList); + m_xLbStartStyle->set_active(nOldSelect); + nOldSelect = m_xLbEndStyle->get_active(); + m_xLbEndStyle->clear(); + m_xLbEndStyle->append_text(sNone); + m_xLbEndStyle->Fill(m_pLineEndList, false); + m_xLbEndStyle->set_active(nOldSelect); } - void SvxLineTabPage::ActivatePage( const SfxItemSet& rSet ) { const CntUInt16Item* pPageTypeItem = rSet.GetItem<CntUInt16Item>(SID_PAGE_TYPE, false); @@ -557,21 +263,20 @@ void SvxLineTabPage::ActivatePage( const SfxItemSet& rSet ) *m_pnDashListState = ChangeType::NONE; // Style list - nPos = m_pLbLineStyle->GetSelectedEntryPos(); + nPos = m_xLbLineStyle->get_active(); - m_pLbLineStyle->Clear(); - m_pLbLineStyle->InsertEntry( SvxResId( RID_SVXSTR_INVISIBLE ) ); - m_pLbLineStyle->InsertEntry( SvxResId( RID_SVXSTR_SOLID ) ); - m_pLbLineStyle->Fill( m_pDashList ); - nCount = m_pLbLineStyle->GetEntryCount(); + m_xLbLineStyle->clear(); + m_xLbLineStyle->append_text(SvxResId(RID_SVXSTR_INVISIBLE)); + m_xLbLineStyle->append_text(SvxResId(RID_SVXSTR_SOLID)); + m_xLbLineStyle->Fill(m_pDashList); + nCount = m_xLbLineStyle->get_count(); if ( nCount == 0 ) ; // This case should never occur else if( nCount <= nPos ) - m_pLbLineStyle->SelectEntryPos( 0 ); + m_xLbLineStyle->set_active(0); else - m_pLbLineStyle->SelectEntryPos( nPos ); - // SelectStyleHdl_Impl( this ); + m_xLbLineStyle->set_active(nPos); } INetURLObject aDashURL( m_pDashList->GetPath() ); @@ -586,49 +291,49 @@ void SvxLineTabPage::ActivatePage( const SfxItemSet& rSet ) *m_pnLineEndListState = ChangeType::NONE; - nPos = m_pLbLineStyle->GetSelectedEntryPos(); - OUString sNone( SvxResId( RID_SVXSTR_NONE ) ); - m_pLbStartStyle->Clear(); - m_pLbStartStyle->InsertEntry( sNone ); + nPos = m_xLbLineStyle->get_active(); + OUString sNone(SvxResId(RID_SVXSTR_NONE)); + m_xLbStartStyle->clear(); + m_xLbStartStyle->append_text(sNone); - m_pLbStartStyle->Fill( m_pLineEndList ); - nCount = m_pLbStartStyle->GetEntryCount(); + m_xLbStartStyle->Fill( m_pLineEndList ); + nCount = m_xLbStartStyle->get_count(); if( nCount == 0 ) ; // This case should never occur else if( nCount <= nPos ) - m_pLbStartStyle->SelectEntryPos( 0 ); + m_xLbStartStyle->set_active(0); else - m_pLbStartStyle->SelectEntryPos( nPos ); + m_xLbStartStyle->set_active(nPos); - m_pLbEndStyle->Clear(); - m_pLbEndStyle->InsertEntry( sNone ); + m_xLbEndStyle->clear(); + m_xLbEndStyle->append_text(sNone); - m_pLbEndStyle->Fill( m_pLineEndList, false ); - nCount = m_pLbEndStyle->GetEntryCount(); + m_xLbEndStyle->Fill( m_pLineEndList, false ); + nCount = m_xLbEndStyle->get_count(); if( nCount == 0 ) ; // This case should never occur else if( nCount <= nPos ) - m_pLbEndStyle->SelectEntryPos( 0 ); + m_xLbEndStyle->set_active(0); else - m_pLbEndStyle->SelectEntryPos( nPos ); + m_xLbEndStyle->set_active(nPos); } INetURLObject aLineURL( m_pLineEndList->GetPath() ); aLineURL.Append( m_pLineEndList->GetName() ); DBG_ASSERT( aLineURL.GetProtocol() != INetProtocol::NotValid, "invalid URL" ); // Evaluate if another TabPage set another fill type - if( m_pLbLineStyle->GetSelectedEntryPos() != 0 ) + if( m_xLbLineStyle->get_active() != 0 ) { if( m_nPageType == PageType::Hatch ) // 1 { - m_pLbLineStyle->SelectEntryPos( *m_pPosDashLb + 2 ); // +2 due to SOLID and INVISIBLE + m_xLbLineStyle->set_active(*m_pPosDashLb + 2); // +2 due to SOLID and INVISIBLE ChangePreviewHdl_Impl( nullptr ); } if( m_nPageType == PageType::Bitmap ) { - m_pLbStartStyle->SelectEntryPos( *m_pPosLineEndLb + 1 );// +1 due to SOLID - m_pLbEndStyle->SelectEntryPos( *m_pPosLineEndLb + 1 );// +1 due to SOLID + m_xLbStartStyle->set_active(*m_pPosLineEndLb + 1);// +1 due to SOLID + m_xLbEndStyle->set_active(*m_pPosLineEndLb + 1);// +1 due to SOLID ChangePreviewHdl_Impl( nullptr ); } } @@ -648,8 +353,8 @@ void SvxLineTabPage::ActivatePage( const SfxItemSet& rSet ) else if (m_nDlgType == 1101) // nNoArrowNoShadowDlg from chart2/source/controller/dialogs/dlg_ObjectProperties.cxx { - m_pFlLineEnds->Hide(); - m_pFLEdgeStyle->Hide(); + m_xFlLineEnds->hide(); + m_xFLEdgeStyle->hide(); } } @@ -659,9 +364,9 @@ DeactivateRC SvxLineTabPage::DeactivatePage( SfxItemSet* _pSet ) if( m_nDlgType == 0 ) // Line dialog { m_nPageType = PageType::Gradient; // possibly for extensions - *m_pPosDashLb = m_pLbLineStyle->GetSelectedEntryPos() - 2;// First entry SOLID!!! - sal_Int32 nPos = m_pLbStartStyle->GetSelectedEntryPos(); - if( nPos != LISTBOX_ENTRY_NOTFOUND ) + *m_pPosDashLb = m_xLbLineStyle->get_active() - 2;// First entry SOLID!!! + sal_Int32 nPos = m_xLbStartStyle->get_active(); + if (nPos != -1) nPos--; *m_pPosLineEndLb = nPos; } @@ -682,9 +387,9 @@ bool SvxLineTabPage::FillItemSet( SfxItemSet* rAttrs ) // To prevent modifications to the list, we do not set other page's items. if( m_nDlgType != 0 || m_nPageType != PageType::Hatch ) { - nPos = m_pLbLineStyle->GetSelectedEntryPos(); - if( nPos != LISTBOX_ENTRY_NOTFOUND && - m_pLbLineStyle->IsValueChangedFromSaved() ) + nPos = m_xLbLineStyle->get_active(); + if( nPos != -1 && + m_xLbLineStyle->get_value_changed_from_saved() ) { std::unique_ptr<XLineStyleItem> pStyleItem; @@ -699,7 +404,7 @@ bool SvxLineTabPage::FillItemSet( SfxItemSet* rAttrs ) // For added security if( m_pDashList->Count() > static_cast<long>( nPos - 2 ) ) { - XLineDashItem aDashItem( m_pLbLineStyle->GetSelectedEntry(), + XLineDashItem aDashItem( m_xLbLineStyle->get_active_text(), m_pDashList->GetDash( nPos - 2 )->GetDash() ); pOld = GetOldItem( *rAttrs, XATTR_LINEDASH ); if ( !pOld || !( *static_cast<const XLineDashItem*>(pOld) == aDashItem ) ) @@ -719,9 +424,9 @@ bool SvxLineTabPage::FillItemSet( SfxItemSet* rAttrs ) } // Line width // GetSavedValue() returns OUString! - if( m_pMtrLineWidth->IsValueChangedFromSaved() ) + if( m_xMtrLineWidth->get_value_changed_from_saved() ) { - XLineWidthItem aItem( GetCoreValue( *m_pMtrLineWidth, m_ePoolUnit ) ); + XLineWidthItem aItem( GetCoreValue( *m_xMtrLineWidth, m_ePoolUnit ) ); pOld = GetOldItem( *rAttrs, XATTR_LINEWIDTH ); if ( !pOld || !( *static_cast<const XLineWidthItem*>(pOld) == aItem ) ) { @@ -730,9 +435,9 @@ bool SvxLineTabPage::FillItemSet( SfxItemSet* rAttrs ) } } // Width line start - if( m_pMtrStartWidth->IsValueChangedFromSaved() ) + if( m_xMtrStartWidth->get_value_changed_from_saved() ) { - XLineStartWidthItem aItem( GetCoreValue( *m_pMtrStartWidth, m_ePoolUnit ) ); + XLineStartWidthItem aItem( GetCoreValue( *m_xMtrStartWidth, m_ePoolUnit ) ); pOld = GetOldItem( *rAttrs, XATTR_LINESTARTWIDTH ); if ( !pOld || !( *static_cast<const XLineStartWidthItem*>(pOld) == aItem ) ) { @@ -741,9 +446,9 @@ bool SvxLineTabPage::FillItemSet( SfxItemSet* rAttrs ) } } // Width line end - if( m_pMtrEndWidth->IsValueChangedFromSaved() ) + if( m_xMtrEndWidth->get_value_changed_from_saved() ) { - XLineEndWidthItem aItem( GetCoreValue( *m_pMtrEndWidth, m_ePoolUnit ) ); + XLineEndWidthItem aItem( GetCoreValue( *m_xMtrEndWidth, m_ePoolUnit ) ); pOld = GetOldItem( *rAttrs, XATTR_LINEENDWIDTH ); if ( !pOld || !( *static_cast<const XLineEndWidthItem*>(pOld) == aItem ) ) { @@ -754,7 +459,7 @@ bool SvxLineTabPage::FillItemSet( SfxItemSet* rAttrs ) // Line color { - NamedColor aColor = m_pLbColor->GetSelectedEntry(); + NamedColor aColor = m_xLbColor->GetSelectedEntry(); XLineColorItem aItem(aColor.second, aColor.first); pOld = GetOldItem( *rAttrs, XATTR_LINECOLOR ); if ( !pOld || !( *static_cast<const XLineColorItem*>(pOld) == aItem ) ) @@ -767,14 +472,14 @@ bool SvxLineTabPage::FillItemSet( SfxItemSet* rAttrs ) if( m_nDlgType != 0 || m_nPageType != PageType::Bitmap ) { // Line start - nPos = m_pLbStartStyle->GetSelectedEntryPos(); - if( nPos != LISTBOX_ENTRY_NOTFOUND && m_pLbStartStyle->IsValueChangedFromSaved() ) + nPos = m_xLbStartStyle->get_active(); + if( nPos != -1 && m_xLbStartStyle->get_value_changed_from_saved() ) { std::unique_ptr<XLineStartItem> pItem; if( nPos == 0 ) pItem.reset(new XLineStartItem()); else if( m_pLineEndList->Count() > static_cast<long>( nPos - 1 ) ) - pItem.reset(new XLineStartItem( m_pLbStartStyle->GetSelectedEntry(), m_pLineEndList->GetLineEnd( nPos - 1 )->GetLineEnd() )); + pItem.reset(new XLineStartItem( m_xLbStartStyle->get_active_text(), m_pLineEndList->GetLineEnd( nPos - 1 )->GetLineEnd() )); pOld = GetOldItem( *rAttrs, XATTR_LINESTART ); if( pItem && ( !pOld || !( *static_cast<const XLineEndItem*>(pOld) == *pItem ) ) ) { @@ -783,14 +488,14 @@ bool SvxLineTabPage::FillItemSet( SfxItemSet* rAttrs ) } } // Line end - nPos = m_pLbEndStyle->GetSelectedEntryPos(); - if( nPos != LISTBOX_ENTRY_NOTFOUND && m_pLbEndStyle->IsValueChangedFromSaved() ) + nPos = m_xLbEndStyle->get_active(); + if( nPos != -1 && m_xLbEndStyle->get_value_changed_from_saved() ) { std::unique_ptr<XLineEndItem> pItem; if( nPos == 0 ) pItem.reset(new XLineEndItem()); else if( m_pLineEndList->Count() > static_cast<long>( nPos - 1 ) ) - pItem.reset(new XLineEndItem( m_pLbEndStyle->GetSelectedEntry(), m_pLineEndList->GetLineEnd( nPos - 1 )->GetLineEnd() )); + pItem.reset(new XLineEndItem( m_xLbEndStyle->get_active_text(), m_pLineEndList->GetLineEnd( nPos - 1 )->GetLineEnd() )); pOld = GetOldItem( *rAttrs, XATTR_LINEEND ); if( pItem && ( !pOld || !( *static_cast<const XLineEndItem*>(pOld) == *pItem ) ) ) @@ -802,8 +507,8 @@ bool SvxLineTabPage::FillItemSet( SfxItemSet* rAttrs ) } // Centered line end - TriState eState = m_pTsbCenterStart->GetState(); - if( m_pTsbCenterStart->IsValueChangedFromSaved() ) + TriState eState = m_xTsbCenterStart->get_state(); + if( m_xTsbCenterStart->get_state_changed_from_saved() ) { XLineStartCenterItem aItem( eState != TRISTATE_FALSE ); pOld = GetOldItem( *rAttrs, XATTR_LINESTARTCENTER ); @@ -813,8 +518,8 @@ bool SvxLineTabPage::FillItemSet( SfxItemSet* rAttrs ) bModified = true; } } - eState = m_pTsbCenterEnd->GetState(); - if( m_pTsbCenterEnd->IsValueChangedFromSaved() ) + eState = m_xTsbCenterEnd->get_state(); + if( m_xTsbCenterEnd->get_state_changed_from_saved() ) { XLineEndCenterItem aItem( eState != TRISTATE_FALSE ); pOld = GetOldItem( *rAttrs, XATTR_LINEENDCENTER ); @@ -826,8 +531,8 @@ bool SvxLineTabPage::FillItemSet( SfxItemSet* rAttrs ) } // Transparency - sal_uInt16 nVal = static_cast<sal_uInt16>(m_pMtrTransparent->GetValue()); - if( m_pMtrTransparent->IsValueChangedFromSaved() ) + sal_uInt16 nVal = m_xMtrTransparent->get_value(FUNIT_PERCENT); + if( m_xMtrTransparent->get_value_changed_from_saved() ) { XLineTransparenceItem aItem( nVal ); pOld = GetOldItem( *rAttrs, XATTR_LINETRANSPARENCE ); @@ -838,8 +543,8 @@ bool SvxLineTabPage::FillItemSet( SfxItemSet* rAttrs ) } } - nPos = m_pLBEdgeStyle->GetSelectedEntryPos(); - if( LISTBOX_ENTRY_NOTFOUND != nPos && m_pLBEdgeStyle->IsValueChangedFromSaved() ) + nPos = m_xLBEdgeStyle->get_active(); + if (nPos != -1 && m_xLBEdgeStyle->get_value_changed_from_saved()) { std::unique_ptr<XLineJointItem> pNew; @@ -880,8 +585,8 @@ bool SvxLineTabPage::FillItemSet( SfxItemSet* rAttrs ) } // LineCaps - nPos = m_pLBCapStyle->GetSelectedEntryPos(); - if( LISTBOX_ENTRY_NOTFOUND != nPos && m_pLBCapStyle->IsValueChangedFromSaved() ) + nPos = m_xLBCapStyle->get_active(); + if (nPos != -1 && m_xLBCapStyle->get_value_changed_from_saved()) { std::unique_ptr<XLineCapItem> pNew; @@ -961,47 +666,47 @@ void SvxLineTabPage::FillXLSet_Impl() { sal_Int32 nPos; - if( m_pLbLineStyle->GetSelectedEntryPos() == LISTBOX_ENTRY_NOTFOUND ) + if (m_xLbLineStyle->get_active() == -1) { m_rXLSet.Put( XLineStyleItem( drawing::LineStyle_NONE ) ); } - else if( m_pLbLineStyle->IsEntryPosSelected( 0 ) ) + else if (m_xLbLineStyle->get_active() == 0) m_rXLSet.Put( XLineStyleItem( drawing::LineStyle_NONE ) ); - else if( m_pLbLineStyle->IsEntryPosSelected( 1 ) ) + else if (m_xLbLineStyle->get_active() == 1) m_rXLSet.Put( XLineStyleItem( drawing::LineStyle_SOLID ) ); else { m_rXLSet.Put( XLineStyleItem( drawing::LineStyle_DASH ) ); - nPos = m_pLbLineStyle->GetSelectedEntryPos(); - if( nPos != LISTBOX_ENTRY_NOTFOUND ) + nPos = m_xLbLineStyle->get_active(); + if (nPos != -1) { - m_rXLSet.Put( XLineDashItem( m_pLbLineStyle->GetSelectedEntry(), + m_rXLSet.Put( XLineDashItem( m_xLbLineStyle->get_active_text(), m_pDashList->GetDash( nPos - 2 )->GetDash() ) ); } } - nPos = m_pLbStartStyle->GetSelectedEntryPos(); - if( nPos != LISTBOX_ENTRY_NOTFOUND ) + nPos = m_xLbStartStyle->get_active(); + if (nPos != -1) { if( nPos == 0 ) m_rXLSet.Put( XLineStartItem() ); else - m_rXLSet.Put( XLineStartItem( m_pLbStartStyle->GetSelectedEntry(), + m_rXLSet.Put( XLineStartItem( m_xLbStartStyle->get_active_text(), m_pLineEndList->GetLineEnd( nPos - 1 )->GetLineEnd() ) ); } - nPos = m_pLbEndStyle->GetSelectedEntryPos(); - if( nPos != LISTBOX_ENTRY_NOTFOUND ) + nPos = m_xLbEndStyle->get_active(); + if (nPos != -1) { if( nPos == 0 ) m_rXLSet.Put( XLineEndItem() ); else - m_rXLSet.Put( XLineEndItem( m_pLbEndStyle->GetSelectedEntry(), + m_rXLSet.Put( XLineEndItem( m_xLbEndStyle->get_active_text(), m_pLineEndList->GetLineEnd( nPos - 1 )->GetLineEnd() ) ); } - nPos = m_pLBEdgeStyle->GetSelectedEntryPos(); - if(LISTBOX_ENTRY_NOTFOUND != nPos) + nPos = m_xLBEdgeStyle->get_active(); + if (nPos != -1) { switch(nPos) { @@ -1029,8 +734,8 @@ void SvxLineTabPage::FillXLSet_Impl() } // LineCaps - nPos = m_pLBCapStyle->GetSelectedEntryPos(); - if(LISTBOX_ENTRY_NOTFOUND != nPos) + nPos = m_xLBCapStyle->get_active(); + if (nPos != -1) { switch(nPos) { @@ -1052,29 +757,29 @@ void SvxLineTabPage::FillXLSet_Impl() } } - m_rXLSet.Put( XLineStartWidthItem( GetCoreValue( *m_pMtrStartWidth, m_ePoolUnit ) ) ); - m_rXLSet.Put( XLineEndWidthItem( GetCoreValue( *m_pMtrEndWidth, m_ePoolUnit ) ) ); + m_rXLSet.Put( XLineStartWidthItem( GetCoreValue( *m_xMtrStartWidth, m_ePoolUnit ) ) ); + m_rXLSet.Put( XLineEndWidthItem( GetCoreValue( *m_xMtrEndWidth, m_ePoolUnit ) ) ); - m_rXLSet.Put( XLineWidthItem( GetCoreValue( *m_pMtrLineWidth, m_ePoolUnit ) ) ); - NamedColor aColor = m_pLbColor->GetSelectedEntry(); + m_rXLSet.Put( XLineWidthItem( GetCoreValue( *m_xMtrLineWidth, m_ePoolUnit ) ) ); + NamedColor aColor = m_xLbColor->GetSelectedEntry(); m_rXLSet.Put(XLineColorItem(aColor.second, aColor.first)); // Centered line end - if( m_pTsbCenterStart->GetState() == TRISTATE_TRUE ) + if( m_xTsbCenterStart->get_state() == TRISTATE_TRUE ) m_rXLSet.Put( XLineStartCenterItem( true ) ); - else if( m_pTsbCenterStart->GetState() == TRISTATE_FALSE ) + else if( m_xTsbCenterStart->get_state() == TRISTATE_FALSE ) m_rXLSet.Put( XLineStartCenterItem( false ) ); - if( m_pTsbCenterEnd->GetState() == TRISTATE_TRUE ) + if( m_xTsbCenterEnd->get_state() == TRISTATE_TRUE ) m_rXLSet.Put( XLineEndCenterItem( true ) ); - else if( m_pTsbCenterEnd->GetState() == TRISTATE_FALSE ) + else if( m_xTsbCenterEnd->get_state() == TRISTATE_FALSE ) m_rXLSet.Put( XLineEndCenterItem( false ) ); // Transparency - sal_uInt16 nVal = static_cast<sal_uInt16>(m_pMtrTransparent->GetValue()); + sal_uInt16 nVal = m_xMtrTransparent->get_value(FUNIT_PERCENT); m_rXLSet.Put( XLineTransparenceItem( nVal ) ); - m_pCtlPreview->SetLineAttributes(m_aXLineAttr.GetItemSet()); + m_aCtlPreview.SetLineAttributes(m_aXLineAttr.GetItemSet()); } @@ -1201,13 +906,13 @@ void SvxLineTabPage::Reset( const SfxItemSet* rAttrs ) m_aSymbolSize = static_cast<const SvxSizeItem *>(pPoolItem)->GetSize(); } - m_pGridIconSize->Enable(bEnable); + m_xGridIconSize->set_sensitive(bEnable); if(bPrevSym) { - SetMetricValue(*m_pSymbolWidthMF, m_aSymbolSize.Width(), m_ePoolUnit); - SetMetricValue(*m_pSymbolHeightMF, m_aSymbolSize.Height(),m_ePoolUnit); - m_pCtlPreview->SetSymbol(&m_aSymbolGraphic,m_aSymbolSize); + SetMetricValue(*m_xSymbolWidthMF, m_aSymbolSize.Width(), m_ePoolUnit); + SetMetricValue(*m_xSymbolHeightMF, m_aSymbolSize.Height(),m_ePoolUnit); + m_aCtlPreview.SetSymbol(&m_aSymbolGraphic,m_aSymbolSize); m_aSymbolLastSize=m_aSymbolSize; } @@ -1218,15 +923,15 @@ void SvxLineTabPage::Reset( const SfxItemSet* rAttrs ) switch( eXLS ) { case drawing::LineStyle_NONE: - m_pLbLineStyle->SelectEntryPos( 0 ); + m_xLbLineStyle->set_active(0); break; case drawing::LineStyle_SOLID: - m_pLbLineStyle->SelectEntryPos( 1 ); + m_xLbLineStyle->set_active(1); break; case drawing::LineStyle_DASH: - m_pLbLineStyle->SetNoSelection(); - m_pLbLineStyle->SelectEntry( rAttrs->Get( XATTR_LINEDASH ).GetName() ); + m_xLbLineStyle->set_active(-1); + m_xLbLineStyle->set_active_text(rAttrs->Get( XATTR_LINEDASH ).GetName()); break; default: @@ -1235,30 +940,30 @@ void SvxLineTabPage::Reset( const SfxItemSet* rAttrs ) } else { - m_pLbLineStyle->SetNoSelection(); + m_xLbLineStyle->set_active(-1); } // Line strength if( rAttrs->GetItemState( XATTR_LINEWIDTH ) != SfxItemState::DONTCARE ) { - SetMetricValue( *m_pMtrLineWidth, rAttrs->Get( XATTR_LINEWIDTH ).GetValue(), m_ePoolUnit ); + SetMetricValue( *m_xMtrLineWidth, rAttrs->Get( XATTR_LINEWIDTH ).GetValue(), m_ePoolUnit ); } else - m_pMtrLineWidth->SetText( "" ); + m_xMtrLineWidth->set_text(""); // Line color - m_pLbColor->SetNoSelection(); + m_xLbColor->SetNoSelection(); if ( rAttrs->GetItemState( XATTR_LINECOLOR ) != SfxItemState::DONTCARE ) { Color aCol = rAttrs->Get( XATTR_LINECOLOR ).GetColorValue(); - m_pLbColor->SelectEntry( aCol ); + m_xLbColor->SelectEntry( aCol ); } // Line start if( m_bObjSelected && rAttrs->GetItemState( XATTR_LINESTART ) == SfxItemState::DEFAULT ) { - m_pLbStartStyle->Disable(); + m_xLbStartStyle->set_sensitive(false); } else if( rAttrs->GetItemState( XATTR_LINESTART ) != SfxItemState::DONTCARE ) { @@ -1274,23 +979,23 @@ void SvxLineTabPage::Reset( const SfxItemSet* rAttrs ) if(rItemPolygon == rEntryPolygon) { // select this entry - m_pLbStartStyle->SelectEntryPos(a + 1); + m_xLbStartStyle->set_active(a + 1); bSelected = true; } } if(!bSelected) - m_pLbStartStyle->SelectEntryPos( 0 ); + m_xLbStartStyle->set_active(0); } else { - m_pLbStartStyle->SetNoSelection(); + m_xLbStartStyle->set_active(-1); } // Line end if( m_bObjSelected && rAttrs->GetItemState( XATTR_LINEEND ) == SfxItemState::DEFAULT ) { - m_pLbEndStyle->Disable(); + m_xLbEndStyle->set_sensitive(false); } else if( rAttrs->GetItemState( XATTR_LINEEND ) != SfxItemState::DONTCARE ) { @@ -1306,115 +1011,111 @@ void SvxLineTabPage::Reset( const SfxItemSet* rAttrs ) if(rItemPolygon == rEntryPolygon) { // select this entry - m_pLbEndStyle->SelectEntryPos(a + 1); + m_xLbEndStyle->set_active(a + 1); bSelected = true; } } if(!bSelected) - m_pLbEndStyle->SelectEntryPos( 0 ); + m_xLbEndStyle->set_active(0); } else { - m_pLbEndStyle->SetNoSelection(); + m_xLbEndStyle->set_active(-1); } // Line start strength if( m_bObjSelected && rAttrs->GetItemState( XATTR_LINESTARTWIDTH ) == SfxItemState::DEFAULT ) { - m_pMtrStartWidth->Disable(); + m_xMtrStartWidth->set_sensitive(false); } else if( rAttrs->GetItemState( XATTR_LINESTARTWIDTH ) != SfxItemState::DONTCARE ) { - SetMetricValue( *m_pMtrStartWidth, + SetMetricValue( *m_xMtrStartWidth, rAttrs->Get( XATTR_LINESTARTWIDTH ).GetValue(), m_ePoolUnit ); } else - m_pMtrStartWidth->SetText( "" ); + m_xMtrStartWidth->set_text( "" ); // Line end strength if( m_bObjSelected && rAttrs->GetItemState( XATTR_LINEENDWIDTH ) == SfxItemState::DEFAULT ) { - m_pMtrEndWidth->Disable(); + m_xMtrEndWidth->set_sensitive(false); } else if( rAttrs->GetItemState( XATTR_LINEENDWIDTH ) != SfxItemState::DONTCARE ) { - SetMetricValue( *m_pMtrEndWidth, + SetMetricValue( *m_xMtrEndWidth, rAttrs->Get( XATTR_LINEENDWIDTH ).GetValue(), m_ePoolUnit ); } else - m_pMtrEndWidth->SetText( "" ); + m_xMtrEndWidth->set_text(""); // Centered line end (start) if( m_bObjSelected && rAttrs->GetItemState( XATTR_LINESTARTCENTER ) == SfxItemState::DEFAULT ) { - m_pTsbCenterStart->Disable(); + m_xTsbCenterStart->set_sensitive(false); } else if( rAttrs->GetItemState( XATTR_LINESTARTCENTER ) != SfxItemState::DONTCARE ) { - m_pTsbCenterStart->EnableTriState( false ); - if( rAttrs->Get( XATTR_LINESTARTCENTER ).GetValue() ) - m_pTsbCenterStart->SetState( TRISTATE_TRUE ); + m_xTsbCenterStart->set_state(TRISTATE_TRUE); else - m_pTsbCenterStart->SetState( TRISTATE_FALSE ); + m_xTsbCenterStart->set_state(TRISTATE_FALSE); } else { - m_pTsbCenterStart->SetState( TRISTATE_INDET ); + m_xTsbCenterStart->set_state(TRISTATE_INDET); } // Centered line end (end) if( m_bObjSelected && rAttrs->GetItemState( XATTR_LINEENDCENTER ) == SfxItemState::DEFAULT ) { - m_pTsbCenterEnd->Disable(); + m_xTsbCenterEnd->set_sensitive(false); } else if( rAttrs->GetItemState( XATTR_LINEENDCENTER ) != SfxItemState::DONTCARE ) { - m_pTsbCenterEnd->EnableTriState( false ); - if( rAttrs->Get( XATTR_LINEENDCENTER ).GetValue() ) - m_pTsbCenterEnd->SetState( TRISTATE_TRUE ); + m_xTsbCenterEnd->set_state(TRISTATE_TRUE); else - m_pTsbCenterEnd->SetState( TRISTATE_FALSE ); + m_xTsbCenterEnd->set_state(TRISTATE_FALSE); } else { - m_pTsbCenterEnd->SetState( TRISTATE_INDET ); + m_xTsbCenterEnd->set_state(TRISTATE_INDET); } // Transparency if( rAttrs->GetItemState( XATTR_LINETRANSPARENCE ) != SfxItemState::DONTCARE ) { sal_uInt16 nTransp = rAttrs->Get( XATTR_LINETRANSPARENCE ).GetValue(); - m_pMtrTransparent->SetValue( nTransp ); - ChangeTransparentHdl_Impl( *m_pMtrTransparent ); + m_xMtrTransparent->set_value(nTransp, FUNIT_PERCENT); + ChangeTransparentHdl_Impl(*m_xMtrTransparent); } else - m_pMtrTransparent->SetText( "" ); + m_xMtrTransparent->set_text( "" ); - if( !m_pLbStartStyle->IsEnabled() && - !m_pLbEndStyle->IsEnabled() && - !m_pMtrStartWidth->IsEnabled() && - !m_pMtrEndWidth->IsEnabled() && - !m_pTsbCenterStart->IsEnabled()&& - !m_pTsbCenterEnd->IsEnabled() ) + if( !m_xLbStartStyle->get_sensitive() && + !m_xLbEndStyle->get_sensitive() && + !m_xMtrStartWidth->get_sensitive() && + !m_xMtrEndWidth->get_sensitive() && + !m_xTsbCenterStart->get_sensitive()&& + !m_xTsbCenterEnd->get_sensitive() ) { - m_pCbxSynchronize->Disable(); - m_pFlLineEnds->Disable(); + m_xCbxSynchronize->set_sensitive(false); + m_xFlLineEnds->set_sensitive(false); } // Synchronize // We get the value from the INI file now OUString aStr = GetUserData(); - m_pCbxSynchronize->Check( aStr.toInt32() != 0 ); + m_xCbxSynchronize->set_active(aStr.toInt32() != 0); if(m_bObjSelected && SfxItemState::DEFAULT == rAttrs->GetItemState(XATTR_LINEJOINT)) { -// maFTEdgeStyle.Disable(); - m_pLBEdgeStyle->Disable(); +// maFTEdgeStyle.set_sensitive(false); + m_xLBEdgeStyle->set_sensitive(false); } else if(SfxItemState::DONTCARE != rAttrs->GetItemState(XATTR_LINEJOINT)) { @@ -1423,23 +1124,22 @@ void SvxLineTabPage::Reset( const SfxItemSet* rAttrs ) switch(eLineJoint) { case css::drawing::LineJoint::LineJoint_MAKE_FIXED_SIZE: // fallback to round, unused value - case css::drawing::LineJoint_ROUND : m_pLBEdgeStyle->SelectEntryPos(0); break; - case css::drawing::LineJoint_NONE : m_pLBEdgeStyle->SelectEntryPos(1); break; + case css::drawing::LineJoint_ROUND : m_xLBEdgeStyle->set_active(0); break; + case css::drawing::LineJoint_NONE : m_xLBEdgeStyle->set_active(1); break; case css::drawing::LineJoint_MIDDLE : // fallback to mitre, unused value - case css::drawing::LineJoint_MITER : m_pLBEdgeStyle->SelectEntryPos(2); break; - case css::drawing::LineJoint_BEVEL : m_pLBEdgeStyle->SelectEntryPos(3); break; + case css::drawing::LineJoint_MITER : m_xLBEdgeStyle->set_active(2); break; + case css::drawing::LineJoint_BEVEL : m_xLBEdgeStyle->set_active(3); break; } } else { - m_pLBEdgeStyle->SetNoSelection(); + m_xLBEdgeStyle->set_active(-1); } // fdo#43209 if(m_bObjSelected && SfxItemState::DEFAULT == rAttrs->GetItemState(XATTR_LINECAP)) { -// maFTCapStyle.Disable(); - m_pLBCapStyle->Disable(); + m_xLBCapStyle->set_sensitive(false); } else if(SfxItemState::DONTCARE != rAttrs->GetItemState(XATTR_LINECAP)) { @@ -1447,60 +1147,60 @@ void SvxLineTabPage::Reset( const SfxItemSet* rAttrs ) switch(eLineCap) { - case css::drawing::LineCap_ROUND: m_pLBCapStyle->SelectEntryPos(1); break; - case css::drawing::LineCap_SQUARE : m_pLBCapStyle->SelectEntryPos(2); break; - default /*css::drawing::LineCap_BUTT*/: m_pLBCapStyle->SelectEntryPos(0); break; + case css::drawing::LineCap_ROUND: m_xLBCapStyle->set_active(1); break; + case css::drawing::LineCap_SQUARE : m_xLBCapStyle->set_active(2); break; + default /*css::drawing::LineCap_BUTT*/: m_xLBCapStyle->set_active(0); break; } } else { - m_pLBCapStyle->SetNoSelection(); + m_xLBCapStyle->set_active(-1); } // Save values - m_pLbLineStyle->SaveValue(); - m_pMtrLineWidth->SaveValue(); - m_pLbColor->SaveValue(); - m_pLbStartStyle->SaveValue(); - m_pLbEndStyle->SaveValue(); - m_pMtrStartWidth->SaveValue(); - m_pMtrEndWidth->SaveValue(); - m_pTsbCenterStart->SaveValue(); - m_pTsbCenterEnd->SaveValue(); - m_pMtrTransparent->SaveValue(); - - m_pLBEdgeStyle->SaveValue(); + m_xLbLineStyle->save_value(); + m_xMtrLineWidth->save_value(); + m_xLbColor->SaveValue(); + m_xLbStartStyle->save_value(); + m_xLbEndStyle->save_value(); + m_xMtrStartWidth->save_value(); + m_xMtrEndWidth->save_value(); + m_xTsbCenterStart->save_state(); + m_xTsbCenterEnd->save_state(); + m_xMtrTransparent->save_value(); + + m_xLBEdgeStyle->save_value(); // LineCaps - m_pLBCapStyle->SaveValue(); + m_xLBCapStyle->save_value(); - ClickInvisibleHdl_Impl( *m_pLbLineStyle ); + ClickInvisibleHdl_Impl(); ChangePreviewHdl_Impl( nullptr ); } - -VclPtr<SfxTabPage> SvxLineTabPage::Create( TabPageParent pWindow, - const SfxItemSet* rAttrs ) +VclPtr<SfxTabPage> SvxLineTabPage::Create(TabPageParent pParent, + const SfxItemSet* rAttrs) { - return VclPtr<SvxLineTabPage>::Create( pWindow.pParent, *rAttrs ); + return VclPtr<SvxLineTabPage>::Create(pParent, *rAttrs); } -IMPL_LINK( SvxLineTabPage, ChangePreviewListBoxHdl_Impl, SvxColorListBox&, rListBox, void ) +IMPL_LINK_NOARG(SvxLineTabPage, ChangePreviewListBoxHdl_Impl, ColorListBox&, void) { - ChangePreviewHdl_Impl(&rListBox); + ChangePreviewHdl_Impl(nullptr); } -IMPL_LINK( SvxLineTabPage, ChangePreviewModifyHdl_Impl, Edit&, rEdit, void ) +IMPL_LINK(SvxLineTabPage, ChangePreviewModifyHdl_Impl, weld::MetricSpinButton&, rEdit, void) { ChangePreviewHdl_Impl(&rEdit); } -void SvxLineTabPage::ChangePreviewHdl_Impl(void const * pCntrl ) + +void SvxLineTabPage::ChangePreviewHdl_Impl(const weld::MetricSpinButton* pCntrl) { - if(pCntrl == m_pMtrLineWidth) + if (pCntrl == m_xMtrLineWidth.get()) { // Line width and start end width - sal_Int32 nNewLineWidth = GetCoreValue( *m_pMtrLineWidth, m_ePoolUnit ); + sal_Int32 nNewLineWidth = GetCoreValue( *m_xMtrLineWidth, m_ePoolUnit ); if(m_nActLineWidth == -1) { // Don't initialize yet, get the start value @@ -1514,17 +1214,17 @@ void SvxLineTabPage::ChangePreviewHdl_Impl(void const * pCntrl ) if(m_nActLineWidth != nNewLineWidth) { // Adapt start/end width - sal_Int32 nValAct = GetCoreValue( *m_pMtrStartWidth, m_ePoolUnit ); + sal_Int32 nValAct = GetCoreValue( *m_xMtrStartWidth, m_ePoolUnit ); sal_Int32 nValNew = nValAct + (((nNewLineWidth - m_nActLineWidth) * 15) / 10); if(nValNew < 0) nValNew = 0; - SetMetricValue( *m_pMtrStartWidth, nValNew, m_ePoolUnit ); + SetMetricValue( *m_xMtrStartWidth, nValNew, m_ePoolUnit ); - nValAct = GetCoreValue( *m_pMtrEndWidth, m_ePoolUnit ); + nValAct = GetCoreValue( *m_xMtrEndWidth, m_ePoolUnit ); nValNew = nValAct + (((nNewLineWidth - m_nActLineWidth) * 15) / 10); if(nValNew < 0) nValNew = 0; - SetMetricValue( *m_pMtrEndWidth, nValNew, m_ePoolUnit ); + SetMetricValue( *m_xMtrEndWidth, nValNew, m_ePoolUnit ); } // Remember current value @@ -1532,175 +1232,377 @@ void SvxLineTabPage::ChangePreviewHdl_Impl(void const * pCntrl ) } FillXLSet_Impl(); - m_pCtlPreview->Invalidate(); + m_aCtlPreview.Invalidate(); // Make transparency accessible accordingly - if( m_pLbLineStyle->GetSelectedEntryPos() == 0 ) // invisible + if( m_xLbLineStyle->get_active() == 0 ) // invisible { - m_pBoxTransparency->Disable(); + m_xBoxTransparency->set_sensitive(false); } else { - m_pBoxTransparency->Enable(); + m_xBoxTransparency->set_sensitive(true); } - const bool bHasLineStyle = m_pLbLineStyle->GetSelectedEntryPos() !=0; - const bool bHasLineStart = m_pLbStartStyle->GetSelectedEntryPos() != 0; + const bool bHasLineStyle = m_xLbLineStyle->get_active() !=0; + const bool bHasLineStart = m_xLbStartStyle->get_active() != 0; - m_pBoxStart->Enable(bHasLineStart && bHasLineStyle); + m_xBoxStart->set_sensitive(bHasLineStart && bHasLineStyle); - const bool bHasLineEnd = m_pLbEndStyle->GetSelectedEntryPos() != 0; + const bool bHasLineEnd = m_xLbEndStyle->get_active() != 0; - m_pBoxEnd->Enable(bHasLineEnd && bHasLineStyle); + m_xBoxEnd->set_sensitive(bHasLineEnd && bHasLineStyle); } - -IMPL_LINK( SvxLineTabPage, ChangeStartClickHdl_Impl, Button*, p, void ) +IMPL_LINK_NOARG(SvxLineTabPage, ChangeStartClickHdl_Impl, weld::Button&, void) { - ChangeStartHdl_Impl(p); + if (m_xCbxSynchronize->get_active()) + m_xTsbCenterEnd->set_state(m_xTsbCenterStart->get_state()); + ChangePreviewHdl_Impl(nullptr); } -IMPL_LINK( SvxLineTabPage, ChangeStartListBoxHdl_Impl, ListBox&, rListBox, void ) -{ - ChangeStartHdl_Impl(&rListBox); -} -IMPL_LINK( SvxLineTabPage, ChangeStartModifyHdl_Impl, Edit&, rEdit, void ) + +IMPL_LINK_NOARG(SvxLineTabPage, ChangeStartListBoxHdl_Impl, weld::ComboBox&, void) { - ChangeStartHdl_Impl(&rEdit); + if (m_xCbxSynchronize->get_active()) + m_xLbEndStyle->set_active(m_xLbStartStyle->get_active()); + + ChangePreviewHdl_Impl(nullptr); } -void SvxLineTabPage::ChangeStartHdl_Impl( void const * p ) + +IMPL_LINK_NOARG(SvxLineTabPage, ChangeStartModifyHdl_Impl, weld::MetricSpinButton&, void) { - if( m_pCbxSynchronize->IsChecked() ) - { - if( p == m_pMtrStartWidth ) - m_pMtrEndWidth->SetValue( m_pMtrStartWidth->GetValue() ); - if( p == m_pLbStartStyle ) - m_pLbEndStyle->SelectEntryPos( m_pLbStartStyle->GetSelectedEntryPos() ); - if( p == m_pTsbCenterStart ) - m_pTsbCenterEnd->SetState( m_pTsbCenterStart->GetState() ); - } + if (m_xCbxSynchronize->get_active()) + m_xMtrEndWidth->set_value(m_xMtrStartWidth->get_value(FUNIT_NONE), FUNIT_NONE); - ChangePreviewHdl_Impl( nullptr ); + ChangePreviewHdl_Impl(nullptr); } - -IMPL_LINK_NOARG(SvxLineTabPage, ChangeEdgeStyleHdl_Impl, ListBox&, void) +IMPL_LINK_NOARG(SvxLineTabPage, ChangeEdgeStyleHdl_Impl, weld::ComboBox&, void) { ChangePreviewHdl_Impl( nullptr ); } - // fdo#43209 - -IMPL_LINK_NOARG( SvxLineTabPage, ChangeCapStyleHdl_Impl, ListBox&, void ) +IMPL_LINK_NOARG(SvxLineTabPage, ChangeCapStyleHdl_Impl, weld::ComboBox&, void) { ChangePreviewHdl_Impl( nullptr ); } +IMPL_LINK_NOARG(SvxLineTabPage, ClickInvisibleHdl_Impl, weld::ComboBox&, void) +{ + ClickInvisibleHdl_Impl(); +} -IMPL_LINK_NOARG(SvxLineTabPage, ClickInvisibleHdl_Impl, ListBox&, void) +void SvxLineTabPage::ClickInvisibleHdl_Impl() { - if( m_pLbLineStyle->GetSelectedEntryPos() == 0 ) // invisible + if( m_xLbLineStyle->get_active() == 0 ) // invisible { if(!m_bSymbols) - m_pBoxColor->Disable(); + m_xBoxColor->set_sensitive(false); - m_pBoxWidth->Disable(); + m_xBoxWidth->set_sensitive(false); - if( m_pFlLineEnds->IsEnabled() ) + if( m_xFlLineEnds->get_sensitive() ) { - m_pBoxStart->Disable(); - m_pBoxArrowStyles->Disable(); - - - m_pGridEdgeCaps->Disable(); + m_xBoxStart->set_sensitive(false); + m_xBoxArrowStyles->set_sensitive(false); + m_xGridEdgeCaps->set_sensitive(false); } } else { - m_pBoxColor->Enable(); - m_pBoxWidth->Enable(); + m_xBoxColor->set_sensitive(true); + m_xBoxWidth->set_sensitive(true); - if( m_pFlLineEnds->IsEnabled() ) + if (m_xFlLineEnds->get_sensitive()) { - m_pBoxArrowStyles->Enable(); - m_pGridEdgeCaps->Enable(); + m_xBoxArrowStyles->set_sensitive(true); + m_xGridEdgeCaps->set_sensitive(true); } } ChangePreviewHdl_Impl( nullptr ); } - -IMPL_LINK( SvxLineTabPage, ChangeEndClickHdl_Impl, Button*, p, void ) -{ - ChangeEndHdl_Impl(p); -} -IMPL_LINK( SvxLineTabPage, ChangeEndListBoxHdl_Impl, ListBox&, rListBox, void ) +IMPL_LINK_NOARG(SvxLineTabPage, ChangeEndClickHdl_Impl, weld::Button&, void) { - ChangeEndHdl_Impl(&rListBox); + if (m_xCbxSynchronize->get_active()) + m_xTsbCenterStart->set_state(m_xTsbCenterEnd->get_state()); + + ChangePreviewHdl_Impl(nullptr); } -IMPL_LINK( SvxLineTabPage, ChangeEndModifyHdl_Impl, Edit&, rEdit, void ) + +IMPL_LINK_NOARG(SvxLineTabPage, ChangeEndListBoxHdl_Impl, weld::ComboBox&, void) { - ChangeEndHdl_Impl(&rEdit); + if (m_xCbxSynchronize->get_active()) + m_xLbStartStyle->set_active(m_xLbEndStyle->get_active()); + + ChangePreviewHdl_Impl(nullptr); } -void SvxLineTabPage::ChangeEndHdl_Impl( void const * p ) + +IMPL_LINK_NOARG(SvxLineTabPage, ChangeEndModifyHdl_Impl, weld::MetricSpinButton&, void) { - if( m_pCbxSynchronize->IsChecked() ) - { - if( p == m_pMtrEndWidth ) - m_pMtrStartWidth->SetValue( m_pMtrEndWidth->GetValue() ); - if( p == m_pLbEndStyle ) - m_pLbStartStyle->SelectEntryPos( m_pLbEndStyle->GetSelectedEntryPos() ); - if( p == m_pTsbCenterEnd ) - m_pTsbCenterStart->SetState( m_pTsbCenterEnd->GetState() ); - } + if (m_xCbxSynchronize->get_active()) + m_xMtrStartWidth->set_value(m_xMtrEndWidth->get_value(FUNIT_NONE), FUNIT_NONE); - ChangePreviewHdl_Impl( nullptr ); + ChangePreviewHdl_Impl(nullptr); } - -IMPL_LINK_NOARG(SvxLineTabPage, ChangeTransparentHdl_Impl, Edit&, void) +IMPL_LINK_NOARG(SvxLineTabPage, ChangeTransparentHdl_Impl, weld::MetricSpinButton&, void) { - sal_uInt16 nVal = static_cast<sal_uInt16>(m_pMtrTransparent->GetValue()); + sal_uInt16 nVal = m_xMtrTransparent->get_value(FUNIT_PERCENT); - m_rXLSet.Put( XLineTransparenceItem( nVal ) ); + m_rXLSet.Put(XLineTransparenceItem(nVal)); FillXLSet_Impl(); - m_pCtlPreview->Invalidate(); + m_aCtlPreview.Invalidate(); } void SvxLineTabPage::FillUserData() { // Write the synched value to the INI file -// OUString aStrUserData = OUString::valueOf( (sal_Int32) m_pCbxSynchronize->IsChecked() ); - OUString aStrUserData = OUString::boolean(m_pCbxSynchronize->IsChecked()); + OUString aStrUserData = OUString::boolean(m_xCbxSynchronize->get_active()); SetUserData( aStrUserData ); } - // #58425# Symbols on a list (e.g. StarChart) // Handler for the symbol selection's popup menu (NumMenueButton) // The following link originates from SvxNumOptionsTabPage -IMPL_LINK( SvxLineTabPage, MenuCreateHdl_Impl, MenuButton *, pButton, void ) +void SvxLineTabPage::MenuCreate() { - InitSymbols(pButton); + ScopedVclPtrInstance< VirtualDevice > pVD; + + // Initialize popup + if (!m_xGalleryMenu) + { + m_xGalleryMenu = m_xBuilder->weld_menu("gallerysubmenu"); + // Get gallery entries + GalleryExplorer::FillObjList(GALLERY_THEME_BULLETS, m_aGrfNames); + + sal_uInt32 i = 0; + m_nNumMenuGalleryItems = m_aGrfNames.size(); + for (auto const& grfName : m_aGrfNames) + { + const OUString *pUIName = &grfName; + + // Convert URL encodings to UI characters (e.g. %20 for spaces) + OUString aPhysicalName; + if (osl::FileBase::getSystemPathFromFileURL(grfName, aPhysicalName) + == osl::FileBase::E_None) + { + pUIName = &aPhysicalName; + } + + SvxBmpItemInfo* pInfo = new SvxBmpItemInfo; + pInfo->pBrushItem.reset(new SvxBrushItem(grfName, "", GPOS_AREA, SID_ATTR_BRUSH)); + pInfo->sItemId = "gallery" + OUString::number(i); + m_aGalleryBrushItems.emplace_back(pInfo); + const Graphic* pGraphic = pInfo->pBrushItem->GetGraphic(); + + if(pGraphic) + { + BitmapEx aBitmap(pGraphic->GetBitmapEx()); + Size aSize(aBitmap.GetSizePixel()); + if(aSize.Width() > MAX_BMP_WIDTH || aSize.Height() > MAX_BMP_HEIGHT) + { + bool bWidth = aSize.Width() > aSize.Height(); + double nScale = bWidth ? + double(MAX_BMP_WIDTH) / static_cast<double>(aSize.Width()): + double(MAX_BMP_HEIGHT) / static_cast<double>(aSize.Height()); + aBitmap.Scale(nScale, nScale); + + } + pVD->SetOutputSizePixel(aBitmap.GetSizePixel(), false); + pVD->DrawBitmapEx(Point(), aBitmap); + m_xGalleryMenu->append(pInfo->sItemId, *pUIName, *pVD); + } + else + { + m_xGalleryMenu->append(pInfo->sItemId, *pUIName); + } + ++i; + } + + if (m_aGrfNames.empty()) + m_xMenu->set_sensitive("gallery", false); + } + + if (!m_xSymbolsMenu && m_pSymbolList) + { + m_xSymbolsMenu = m_xBuilder->weld_menu("symbolssubmenu"); + ScopedVclPtrInstance< VirtualDevice > pVDev; + pVDev->SetMapMode(MapMode(MapUnit::Map100thMM)); + std::unique_ptr<SdrModel> pModel( + new SdrModel(nullptr, nullptr, true)); + pModel->GetItemPool().FreezeIdRanges(); + // Page + SdrPage* pPage = new SdrPage( *pModel, false ); + pPage->SetSize(Size(1000,1000)); + pModel->InsertPage( pPage, 0 ); + { + // 3D View + std::unique_ptr<SdrView> pView(new SdrView( *pModel, pVDev )); + pView->hideMarkHandles(); + pView->ShowSdrPage(pPage); + + // Generate invisible square to give all symbols a + // bitmap size, which is independent from specific glyph + SdrObject *pInvisibleSquare=m_pSymbolList->GetObj(0); + + // directly clone to target SdrModel + pInvisibleSquare = pInvisibleSquare->CloneSdrObject(*pModel); + + pPage->NbcInsertObject(pInvisibleSquare); + pInvisibleSquare->SetMergedItem(XFillTransparenceItem(100)); + pInvisibleSquare->SetMergedItem(XLineTransparenceItem(100)); + + for(size_t i=0;; ++i) + { + SdrObject *pObj=m_pSymbolList->GetObj(i); + if(pObj==nullptr) + break; + + // directly clone to target SdrModel + pObj = pObj->CloneSdrObject(*pModel); + + m_aGrfNames.emplace_back(""); + pPage->NbcInsertObject(pObj); + if(m_pSymbolAttr) + { + pObj->SetMergedItemSet(*m_pSymbolAttr); + } + else + { + pObj->SetMergedItemSet(m_rOutAttrs); + } + pView->MarkAll(); + BitmapEx aBitmapEx(pView->GetMarkedObjBitmapEx()); + GDIMetaFile aMeta(pView->GetMarkedObjMetaFile()); + pView->UnmarkAll(); + pObj=pPage->RemoveObject(1); + SdrObject::Free(pObj); + + SvxBmpItemInfo* pInfo = new SvxBmpItemInfo; + pInfo->pBrushItem.reset(new SvxBrushItem(Graphic(aMeta), GPOS_AREA, SID_ATTR_BRUSH)); + pInfo->sItemId = "symbol" + OUString::number(i); + m_aSymbolBrushItems.emplace_back(pInfo); + + Size aSize(aBitmapEx.GetSizePixel()); + if(aSize.Width() > MAX_BMP_WIDTH || aSize.Height() > MAX_BMP_HEIGHT) + { + bool bWidth = aSize.Width() > aSize.Height(); + double nScale = bWidth ? + double(MAX_BMP_WIDTH) / static_cast<double>(aSize.Width()): + double(MAX_BMP_HEIGHT) / static_cast<double>(aSize.Height()); + aBitmapEx.Scale(nScale, nScale); + } + pVD->SetOutputSizePixel(aBitmapEx.GetSizePixel(), false); + pVD->DrawBitmapEx(Point(), aBitmapEx); + m_xSymbolsMenu->append(pInfo->sItemId, "foo", *pVD); + } + pInvisibleSquare=pPage->RemoveObject(0); + SdrObject::Free(pInvisibleSquare); + + if (m_aGrfNames.empty()) + m_xMenu->set_sensitive("symbols", false); + } + } } // #58425# Symbols on a list (e.g. StarChart) // Handler for menu button -IMPL_LINK( SvxLineTabPage, GraphicHdl_Impl, MenuButton *, pButton, void ) +IMPL_LINK(SvxLineTabPage, GraphicHdl_Impl, const OString&, rIdent, void) { - SymbolSelected(pButton); + const Graphic* pGraphic = nullptr; + Graphic aGraphic; + bool bResetSize = false; + bool bEnable = true; + long nPreviousSymbolType = m_nSymbolType; + + OString sNumber; + if (rIdent.startsWith("gallery", &sNumber)) + { + SvxBmpItemInfo* pInfo = m_aGalleryBrushItems[sNumber.toUInt32()].get(); + pGraphic = pInfo->pBrushItem->GetGraphic(); + } + else if (rIdent.startsWith("symbol", &sNumber)) + { + SvxBmpItemInfo* pInfo = m_aSymbolBrushItems[sNumber.toUInt32()].get(); + pGraphic = pInfo->pBrushItem->GetGraphic(); + } + else if (rIdent == "automatic") + { + pGraphic=&m_aAutoSymbolGraphic; + m_aAutoSymbolGraphic.SetPrefSize( Size(253,253) ); + m_nSymbolType=SVX_SYMBOLTYPE_AUTO; + } + else if (rIdent == "none") + { + m_nSymbolType=SVX_SYMBOLTYPE_NONE; + pGraphic=nullptr; + bEnable = false; + } + else if (rIdent == "file") + { + SvxOpenGraphicDialog aGrfDlg(CuiResId(RID_SVXSTR_EDIT_GRAPHIC), GetDialogFrameWeld()); + aGrfDlg.EnableLink(false); + aGrfDlg.AsLink(false); + if( !aGrfDlg.Execute() ) + { + // Remember selected filters + if( !aGrfDlg.GetGraphic(aGraphic) ) + { + m_nSymbolType=SVX_SYMBOLTYPE_BRUSHITEM; + pGraphic = &aGraphic; + bResetSize = true; + } + } + if( !pGraphic ) + return; + } + + if(pGraphic) + { + Size aSize = SvxNumberFormat::GetGraphicSizeMM100(pGraphic); + aSize = OutputDevice::LogicToLogic(aSize, MapMode(MapUnit::Map100thMM), MapMode(m_ePoolUnit)); + m_aSymbolGraphic=*pGraphic; + if( bResetSize ) + { + m_aSymbolSize=aSize; + } + else if( nPreviousSymbolType == SVX_SYMBOLTYPE_BRUSHITEM ) + { //#i31097# Data Point Symbol size changes when a different symbol is chosen(maoyg) + if( m_aSymbolSize.Width() != m_aSymbolSize.Height() ) + { + aSize.setWidth( static_cast<long>( m_aSymbolSize.Width() + m_aSymbolSize.Height() )/2 ); + aSize.setHeight( static_cast<long>( m_aSymbolSize.Width() + m_aSymbolSize.Height() )/2 ); + m_aSymbolSize = aSize; + } + } + m_aCtlPreview.SetSymbol(&m_aSymbolGraphic,m_aSymbolSize); + } + else + { + m_aSymbolGraphic=Graphic(); + m_aCtlPreview.SetSymbol(nullptr,m_aSymbolSize); + bEnable = false; + } + m_aSymbolLastSize=m_aSymbolSize; + SetMetricValue(*m_xSymbolWidthMF, m_aSymbolSize.Width(), m_ePoolUnit); + SetMetricValue(*m_xSymbolHeightMF, m_aSymbolSize.Height(), m_ePoolUnit); + + m_xGridIconSize->set_sensitive(bEnable); + m_aCtlPreview.Invalidate(); } -IMPL_LINK( SvxLineTabPage, SizeHdl_Impl, Edit&, rField, void) +IMPL_LINK( SvxLineTabPage, SizeHdl_Impl, weld::MetricSpinButton&, rField, void) { m_bNewSize = true; - bool bWidth = &rField == m_pSymbolWidthMF; + bool bWidth = &rField == m_xSymbolWidthMF.get(); m_bLastWidthModified = bWidth; - bool bRatio = m_pSymbolRatioCB->IsChecked(); - long nWidthVal = static_cast<long>(m_pSymbolWidthMF->Denormalize(m_pSymbolWidthMF->GetValue(FUNIT_100TH_MM))); - long nHeightVal= static_cast<long>(m_pSymbolHeightMF->Denormalize(m_pSymbolHeightMF->GetValue(FUNIT_100TH_MM))); + bool bRatio = m_xSymbolRatioCB->get_active(); + long nWidthVal = static_cast<long>(m_xSymbolWidthMF->denormalize(m_xSymbolWidthMF->get_value(FUNIT_100TH_MM))); + long nHeightVal= static_cast<long>(m_xSymbolHeightMF->denormalize(m_xSymbolHeightMF->get_value(FUNIT_100TH_MM))); nWidthVal = OutputDevice::LogicToLogic(nWidthVal,MapUnit::Map100thMM, m_ePoolUnit ); nHeightVal = OutputDevice::LogicToLogic(nHeightVal,MapUnit::Map100thMM, m_ePoolUnit); m_aSymbolSize = Size(nWidthVal,nHeightVal); @@ -1712,9 +1614,7 @@ IMPL_LINK( SvxLineTabPage, SizeHdl_Impl, Edit&, rField, void) fSizeRatio = static_cast<double>(m_aSymbolLastSize.Width()) / m_aSymbolLastSize.Height(); } - //Size aSymbolSize(aSymbolLastSize); - - if(bWidth) + if (bWidth) { long nDelta = nWidthVal - m_aSymbolLastSize.Width(); m_aSymbolSize.setWidth( nWidthVal ); @@ -1722,7 +1622,8 @@ IMPL_LINK( SvxLineTabPage, SizeHdl_Impl, Edit&, rField, void) { m_aSymbolSize.setHeight( m_aSymbolLastSize.Height() + static_cast<long>(static_cast<double>(nDelta) / fSizeRatio) ); m_aSymbolSize.setHeight( OutputDevice::LogicToLogic( m_aSymbolSize.Height(), m_ePoolUnit, MapUnit::Map100thMM ) ); - m_pSymbolHeightMF->SetUserValue(m_pSymbolHeightMF->Normalize(m_aSymbolSize.Height()), FUNIT_100TH_MM); +//TODO m_xSymbolHeightMF->SetUserValue(m_xSymbolHeightMF->normalize(m_aSymbolSize.Height()), FUNIT_100TH_MM); + m_xSymbolHeightMF->set_value(m_xSymbolHeightMF->normalize(m_aSymbolSize.Height()), FUNIT_100TH_MM); } } else @@ -1733,24 +1634,25 @@ IMPL_LINK( SvxLineTabPage, SizeHdl_Impl, Edit&, rField, void) { m_aSymbolSize.setWidth( m_aSymbolLastSize.Width() + static_cast<long>(static_cast<double>(nDelta) * fSizeRatio) ); m_aSymbolSize.setWidth( OutputDevice::LogicToLogic( m_aSymbolSize.Width(), m_ePoolUnit, MapUnit::Map100thMM ) ); - m_pSymbolWidthMF->SetUserValue(m_pSymbolWidthMF->Normalize(m_aSymbolSize.Width()), FUNIT_100TH_MM); +//TODO m_xSymbolWidthMF->SetUserValue(m_xSymbolWidthMF->normalize(m_aSymbolSize.Width()), FUNIT_100TH_MM); + m_xSymbolWidthMF->set_value(m_xSymbolWidthMF->normalize(m_aSymbolSize.Width()), FUNIT_100TH_MM); } } - m_pCtlPreview->ResizeSymbol(m_aSymbolSize); + m_aCtlPreview.ResizeSymbol(m_aSymbolSize); m_aSymbolLastSize=m_aSymbolSize; } -IMPL_LINK( SvxLineTabPage, RatioHdl_Impl, Button*, pBox, void ) + +IMPL_LINK(SvxLineTabPage, RatioHdl_Impl, weld::ToggleButton&, rBox, void) { - if (static_cast<CheckBox*>(pBox)->IsChecked()) + if (rBox.get_active()) { if (m_bLastWidthModified) - SizeHdl_Impl(*m_pSymbolWidthMF); + SizeHdl_Impl(*m_xSymbolWidthMF); else - SizeHdl_Impl(*m_pSymbolHeightMF); + SizeHdl_Impl(*m_xSymbolHeightMF); } } - void SvxLineTabPage::DataChanged( const DataChangedEvent& rDCEvt ) { SfxTabPage::DataChanged( rDCEvt ); diff --git a/cui/uiconfig/ui/linetabpage.ui b/cui/uiconfig/ui/linetabpage.ui index f4f03032f4ce..b7594c38ea82 100644 --- a/cui/uiconfig/ui/linetabpage.ui +++ b/cui/uiconfig/ui/linetabpage.ui @@ -1,8 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.16.1 --> +<!-- Generated with glade 3.22.1 --> <interface domain="cui"> - <!-- interface-requires LibreOffice 1.0 --> <requires lib="gtk+" version="3.18"/> + <object class="GtkAdjustment" id="adjustmentHEIGHT_SYMBOL"> + <property name="upper">19.989999999999998</property> + <property name="step_increment">0.050000000000000003</property> + <property name="page_increment">1</property> + </object> <object class="GtkAdjustment" id="adjustmentPERCENT"> <property name="upper">100</property> <property name="step_increment">5</property> @@ -13,58 +17,106 @@ <property name="step_increment">0.10000000000000001</property> <property name="page_increment">1</property> </object> + <object class="GtkAdjustment" id="adjustmentWIDTH1"> + <property name="upper">5</property> + <property name="step_increment">0.10000000000000001</property> + <property name="page_increment">1</property> + </object> + <object class="GtkAdjustment" id="adjustmentWIDTH2"> + <property name="upper">5</property> + <property name="step_increment">0.10000000000000001</property> + <property name="page_increment">1</property> + </object> <object class="GtkAdjustment" id="adjustmentWIDTH_SYMBOL"> <property name="upper">19.989999999999998</property> <property name="step_increment">0.050000000000000003</property> <property name="page_increment">1</property> </object> - <object class="GtkListStore" id="liststoreCAP_STYLE"> + <object class="GtkListStore" id="liststore4"> + <columns> + <!-- column-name text --> + <column type="gchararray"/> + <!-- column-name id --> + <column type="gchararray"/> + <!-- column-name image --> + <column type="GdkPixbuf"/> + </columns> + </object> + <object class="GtkListStore" id="liststore5"> <columns> - <!-- column-name gchararray1 --> + <!-- column-name text --> + <column type="gchararray"/> + <!-- column-name id --> <column type="gchararray"/> - <!-- column-name guint1 --> - <column type="guint"/> + <!-- column-name image --> + <column type="GdkPixbuf"/> </columns> - <data> - <row> - <col id="0" translatable="yes" context="linetabpage|liststoreCAP_STYLE">Flat</col> - <col id="1">0</col> - </row> - <row> - <col id="0" translatable="yes" context="linetabpage|liststoreCAP_STYLE">Round</col> - <col id="1">1</col> - </row> - <row> - <col id="0" translatable="yes" context="linetabpage|liststoreCAP_STYLE">Square</col> - <col id="1">2</col> - </row> - </data> </object> - <object class="GtkListStore" id="liststoreEDGE_STYLE"> + <object class="GtkListStore" id="liststore6"> <columns> - <!-- column-name gchararray1 --> + <!-- column-name text --> <column type="gchararray"/> - <!-- column-name guint1 --> - <column type="guint"/> + <!-- column-name id --> + <column type="gchararray"/> + <!-- column-name image --> + <column type="GdkPixbuf"/> </columns> - <data> - <row> - <col id="0" translatable="yes" context="linetabpage|liststoreEDGE_STYLE">Rounded</col> - <col id="1">0</col> - </row> - <row> - <col id="0" translatable="yes" context="linetabpage|liststoreEDGE_STYLE">- none -</col> - <col id="1">1</col> - </row> - <row> - <col id="0" translatable="yes" context="linetabpage|liststoreEDGE_STYLE">Mitered</col> - <col id="1">2</col> - </row> - <row> - <col id="0" translatable="yes" context="linetabpage|liststoreEDGE_STYLE">Beveled</col> - <col id="1">3</col> - </row> - </data> + </object> + <object class="GtkMenu" id="menuSELECT"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <child> + <object class="GtkMenuItem" id="none"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes" context="linetabpage|menuitem1">_No Symbol</property> + <property name="use_underline">True</property> + </object> + </child> + <child> + <object class="GtkMenuItem" id="automatic"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes" context="linetabpage|menuitem2">_Automatic</property> + <property name="use_underline">True</property> + </object> + </child> + <child> + <object class="GtkMenuItem" id="file"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes" context="linetabpage|menuitem3">_From file...</property> + <property name="use_underline">True</property> + </object> + </child> + <child> + <object class="GtkMenuItem" id="gallery"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes" context="linetabpage|menuitem4">_Gallery</property> + <property name="use_underline">True</property> + <child type="submenu"> + <object class="GtkMenu" id="gallerysubmenu"> + <property name="visible">True</property> + <property name="can_focus">False</property> + </object> + </child> + </object> + </child> + <child> + <object class="GtkMenuItem" id="symbols"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes" context="linetabpage|menuitem5">_Symbols</property> + <property name="use_underline">True</property> + <child type="submenu"> + <object class="GtkMenu" id="symbolssubmenu"> + <property name="visible">True</property> + <property name="can_focus">False</property> + </object> + </child> + </object> + </child> </object> <object class="GtkBox" id="LineTabPage"> <property name="visible">True</property> @@ -105,10 +157,10 @@ <object class="GtkLabel" id="FT_LINE_STYLE"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="linetabpage|FT_LINE_STYLE">_Style:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">LB_LINE_STYLE</property> + <property name="xalign">0</property> </object> <packing> <property name="expand">False</property> @@ -117,9 +169,11 @@ </packing> </child> <child> - <object class="svxlo-LineLB" id="LB_LINE_STYLE"> + <object class="GtkComboBox" id="LB_LINE_STYLE"> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="model">liststore5</property> + <property name="id_column">1</property> </object> <packing> <property name="expand">False</property> @@ -144,10 +198,10 @@ <object class="GtkLabel" id="FT_COLOR"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="linetabpage|FT_COLOR">Colo_r:</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> @@ -156,9 +210,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="can_focus">True</property> + <property name="receives_default">False</property> + <property name="xalign">0</property> + <child> + <placeholder/> + </child> </object> <packing> <property name="expand">False</property> @@ -182,10 +241,10 @@ <object class="GtkLabel" id="FT_LINE_WIDTH"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="linetabpage|FT_LINE_WIDTH">_Width:</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">MTR_FLD_LINE_WIDTH:0cm</property> + <property name="mnemonic_widget">MTR_FLD_LINE_WIDTH</property> + <property name="xalign">0</property> </object> <packing> <property name="expand">False</property> @@ -194,7 +253,7 @@ </packing> </child> <child> - <object class="GtkSpinButton" id="MTR_FLD_LINE_WIDTH:0cm"> + <object class="GtkSpinButton" id="MTR_FLD_LINE_WIDTH"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="halign">start</property> @@ -223,10 +282,10 @@ <object class="GtkLabel" id="FT_TRANSPARENT"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="linetabpage|FT_TRANSPARENT">_Transparency:</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">MTR_LINE_TRANSPARENT:0%</property> + <property name="mnemonic_widget">MTR_LINE_TRANSPARENT</property> + <property name="xalign">0</property> </object> <packing> <property name="expand">False</property> @@ -235,7 +294,7 @@ </packing> </child> <child> - <object class="GtkSpinButton" id="MTR_LINE_TRANSPARENT:0%"> + <object class="GtkSpinButton" id="MTR_LINE_TRANSPARENT"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="halign">start</property> @@ -309,56 +368,52 @@ <object class="GtkLabel" id="FT_LINE_ENDS_STYLE"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="linetabpage|FT_LINE_ENDS_STYLE">Start st_yle:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">LB_START_STYLE</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> - <object class="svxlo-LineEndLB" id="LB_START_STYLE"> + <object class="GtkComboBox" id="LB_START_STYLE"> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="model">liststore4</property> + <property name="id_column">1</property> </object> <packing> <property name="left_attach">0</property> <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> - <object class="svxlo-LineEndLB" id="LB_END_STYLE"> + <object class="GtkComboBox" id="LB_END_STYLE"> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="model">liststore5</property> + <property name="id_column">1</property> </object> <packing> <property name="left_attach">1</property> <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> <object class="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="linetabpage|label5">End sty_le:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">LB_END_STYLE</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">1</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -371,10 +426,10 @@ <object class="GtkLabel" id="FT_LINE_START_WIDTH"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="linetabpage|FT_LINE_START_WIDTH">Wi_dth:</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">MTR_FLD_START_WIDTH:0cm</property> + <property name="mnemonic_widget">MTR_FLD_START_WIDTH</property> + <property name="xalign">0</property> </object> <packing> <property name="expand">False</property> @@ -383,11 +438,11 @@ </packing> </child> <child> - <object class="GtkSpinButton" id="MTR_FLD_START_WIDTH:0cm"> + <object class="GtkSpinButton" id="MTR_FLD_START_WIDTH"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can_focus">True</property> <property name="halign">start</property> - <property name="adjustment">adjustmentWIDTH</property> + <property name="adjustment">adjustmentWIDTH1</property> <property name="digits">2</property> </object> <packing> @@ -400,7 +455,7 @@ <object class="GtkCheckButton" id="TSB_CENTER_START"> <property name="label" translatable="yes" context="linetabpage|TSB_CENTER_START">Ce_nter</property> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can_focus">True</property> <property name="receives_default">False</property> <property name="use_underline">True</property> <property name="xalign">0</property> @@ -417,8 +472,6 @@ <packing> <property name="left_attach">0</property> <property name="top_attach">2</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -431,10 +484,10 @@ <object class="GtkLabel" id="FT_LINE_END_WIDTH"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="linetabpage|FT_LINE_END_WIDTH">W_idth:</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">MTR_FLD_END_WIDTH:0cm</property> + <property name="mnemonic_widget">MTR_FLD_END_WIDTH</property> + <property name="xalign">0</property> </object> <packing> <property name="expand">False</property> @@ -443,11 +496,11 @@ </packing> </child> <child> - <object class="GtkSpinButton" id="MTR_FLD_END_WIDTH:0cm"> + <object class="GtkSpinButton" id="MTR_FLD_END_WIDTH"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can_focus">True</property> <property name="halign">start</property> - <property name="adjustment">adjustmentWIDTH</property> + <property name="adjustment">adjustmentWIDTH2</property> <property name="digits">2</property> </object> <packing> @@ -460,7 +513,7 @@ <object class="GtkCheckButton" id="TSB_CENTER_END"> <property name="label" translatable="yes" context="linetabpage|TSB_CENTER_END">C_enter</property> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can_focus">True</property> <property name="receives_default">False</property> <property name="use_underline">True</property> <property name="xalign">0</property> @@ -477,8 +530,6 @@ <packing> <property name="left_attach">1</property> <property name="top_attach">2</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> </object> @@ -492,7 +543,7 @@ <object class="GtkCheckButton" id="CBX_SYNCHRONIZE"> <property name="label" translatable="yes" context="linetabpage|CBX_SYNCHRONIZE">Synchroni_ze ends</property> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can_focus">True</property> <property name="receives_default">False</property> <property name="use_underline">True</property> <property name="xalign">0</property> @@ -547,58 +598,59 @@ <object class="GtkLabel" id="FT_EDGE_STYLE"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="linetabpage|FT_EDGE_STYLE">_Corner style:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">LB_EDGE_STYLE</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> <object class="GtkLabel" id="FT_CAP_STYLE"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="linetabpage|FT_CAP_STYLE">Ca_p style:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">LB_CAP_STYLE</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">1</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> - <object class="GtkComboBox" id="LB_EDGE_STYLE"> + <object class="GtkComboBoxText" id="LB_EDGE_STYLE"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="model">liststoreEDGE_STYLE</property> + <items> + <item id="0" translatable="yes" context="linetabpage|liststoreEDGE_STYLE">Rounded</item> + <item id="1" translatable="yes" context="linetabpage|liststoreEDGE_STYLE">- none -</item> + <item id="2" translatable="yes" context="linetabpage|liststoreEDGE_STYLE">Mitered</item> + <item id="3" translatable="yes" context="linetabpage|liststoreEDGE_STYLE">Beveled</item> + </items> </object> <packing> <property name="left_attach">0</property> <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> - <object class="GtkComboBox" id="LB_CAP_STYLE"> + <object class="GtkComboBoxText" id="LB_CAP_STYLE"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="model">liststoreCAP_STYLE</property> + <items> + <item id="0" translatable="yes" context="linetabpage|liststoreCAP_STYLE">Flat</item> + <item id="1" translatable="yes" context="linetabpage|liststoreCAP_STYLE">Round</item> + <item id="2" translatable="yes" context="linetabpage|liststoreCAP_STYLE">Square</item> + </items> </object> <packing> <property name="left_attach">1</property> <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> </object> @@ -641,11 +693,16 @@ <property name="orientation">vertical</property> <property name="spacing">6</property> <child> - <object class="GtkButton" id="MB_SYMBOL_BITMAP:menuSELECT"> + <object class="GtkMenuButton" id="MB_SYMBOL_BITMAP"> <property name="label" translatable="yes" context="linetabpage|MB_SYMBOL_BITMAP">Select...</property> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can_focus">True</property> <property name="receives_default">True</property> + <property name="popup">menuSELECT</property> + <property name="use_popover">False</property> + <child> + <placeholder/> + </child> </object> <packing> <property name="expand">False</property> @@ -663,37 +720,33 @@ <object class="GtkLabel" id="FT_SYMBOL_WIDTH"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="linetabpage|FT_SYMBOL_WIDTH">Widt_h:</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">MF_SYMBOL_WIDTH:0cm</property> + <property name="mnemonic_widget">MF_SYMBOL_WIDTH</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> - <object class="GtkSpinButton" id="MF_SYMBOL_WIDTH:0cm"> + <object class="GtkSpinButton" id="MF_SYMBOL_WIDTH"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can_focus">True</property> <property name="adjustment">adjustmentWIDTH_SYMBOL</property> <property name="digits">2</property> </object> <packing> <property name="left_attach">1</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> <object class="GtkCheckButton" id="CB_SYMBOL_RATIO"> <property name="label" translatable="yes" context="linetabpage|CB_SYMBOL_RATIO">_Keep ratio</property> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can_focus">True</property> <property name="receives_default">False</property> <property name="use_underline">True</property> <property name="xalign">0</property> @@ -703,36 +756,32 @@ <property name="left_attach">0</property> <property name="top_attach">2</property> <property name="width">2</property> - <property name="height">1</property> </packing> </child> <child> <object class="GtkLabel" id="FT_SYMBOL_HEIGHT"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="linetabpage|FT_SYMBOL_HEIGHT">Hei_ght:</property> <property name="use_underline">True</property> + <property name="mnemonic_widget">MF_SYMBOL_HEIGHT</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> - <object class="GtkSpinButton" id="MF_SYMBOL_HEIGHT:0cm"> + <object class="GtkSpinButton" id="MF_SYMBOL_HEIGHT"> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="adjustment">adjustmentWIDTH_SYMBOL</property> + <property name="can_focus">True</property> + <property name="adjustment">adjustmentHEIGHT_SYMBOL</property> <property name="digits">2</property> </object> <packing> <property name="left_attach">1</property> <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> </object> @@ -784,12 +833,27 @@ <property name="can_focus">False</property> <property name="left_padding">12</property> <child> - <object class="svxlo-SvxXLinePreview" id="CTL_PREVIEW:border"> + <object class="GtkScrolledWindow"> <property name="visible">True</property> <property name="can_focus">False</property> - <child internal-child="accessible"> - <object class="AtkObject" id="CTL_PREVIEW:border-atkobject"> - <property name="AtkObject::accessible-name" translatable="yes" context="linetabpage|CTL_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_PREVIEW"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <child internal-child="accessible"> + <object class="AtkObject" id="CTL_PREVIEW-atkobject"> + <property name="AtkObject::accessible-name" translatable="yes" context="linetabpage|CTL_PREVIEW-atkobject">Example</property> + </object> + </child> + </object> + </child> </object> </child> </object> @@ -804,52 +868,8 @@ </object> <object class="GtkSizeGroup" id="sizegroup1"> <widgets> - <widget name="MTR_FLD_LINE_WIDTH:0cm"/> - <widget name="MTR_LINE_TRANSPARENT:0%"/> + <widget name="MTR_FLD_LINE_WIDTH"/> + <widget name="MTR_LINE_TRANSPARENT"/> </widgets> </object> - <object class="GtkMenu" id="menuSELECT"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <child> - <object class="GtkMenuItem" id="menuitem1"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes" context="linetabpage|menuitem1">_No Symbol</property> - <property name="use_underline">True</property> - </object> - </child> - <child> - <object class="GtkMenuItem" id="menuitem2"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes" context="linetabpage|menuitem2">_Automatic</property> - <property name="use_underline">True</property> - </object> - </child> - <child> - <object class="GtkMenuItem" id="menuitem3"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes" context="linetabpage|menuitem3">_From file...</property> - <property name="use_underline">True</property> - </object> - </child> - <child> - <object class="GtkMenuItem" id="menuitem4"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes" context="linetabpage|menuitem4">_Gallery</property> - <property name="use_underline">True</property> - </object> - </child> - <child> - <object class="GtkMenuItem" id="menuitem5"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes" context="linetabpage|menuitem5">_Symbols</property> - <property name="use_underline">True</property> - </object> - </child> - </object> </interface> diff --git a/extras/source/glade/libreoffice-catalog.xml.in b/extras/source/glade/libreoffice-catalog.xml.in index c69a6dac3b1f..9ee1cc971c6f 100644 --- a/extras/source/glade/libreoffice-catalog.xml.in +++ b/extras/source/glade/libreoffice-catalog.xml.in @@ -114,30 +114,6 @@ </properties> </glade-widget-class> - <glade-widget-class title="Svx Line End ListBox" name="svxlo-LineEndLB" - generic-name="Line End ListBox" parent="GtkComboBox" - icon-name="widget-gtk-combobox"> - <properties> - <property save="True" query="False" id="dropdown" default="True" name="Use DropDown"> - <parameter-spec> - <type>GParamBoolean</type> - </parameter-spec> - </property> - </properties> - </glade-widget-class> - - <glade-widget-class title="Svx Line ListBox" name="svxlo-LineLB" - generic-name="Line ListBox" parent="GtkComboBox" - icon-name="widget-gtk-combobox"> - <properties> - <property save="True" query="False" id="dropdown" default="True" name="Use DropDown"> - <parameter-spec> - <type>GParamBoolean</type> - </parameter-spec> - </property> - </properties> - </glade-widget-class> - <glade-widget-class title="Text Encoding ListBox" name="svxlo-SvxTextEncodingBox" generic-name="TextEncodingBox" parent="GtkComboBox" icon-name="widget-gtk-combobox"> @@ -197,9 +173,6 @@ <glade-widget-class title="Document Preview Window" name="sdlo-SdDocPreviewWin" generic-name="Document Preview Window" parent="GtkDrawingArea" icon-name="widget-gtk-drawingarea"/> - <glade-widget-class title="SvxXLinePreview" name="svxlo-SvxXLinePreview" - generic-name="Line Preview Window" 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/svx/dlgctrl.hxx b/include/svx/dlgctrl.hxx index db016d6d1dd6..4827842df60a 100644 --- a/include/svx/dlgctrl.hxx +++ b/include/svx/dlgctrl.hxx @@ -294,22 +294,15 @@ public: OUString get_active_text() const { return m_xControl->get_active_text(); } void connect_changed(const Link<weld::ComboBox&, void>& rLink) { m_xControl->connect_changed(rLink); } int get_count() const { return m_xControl->get_count(); } + void append_text(const OUString& rStr) { m_xControl->append_text(rStr); } + bool get_value_changed_from_saved() const { return m_xControl->get_value_changed_from_saved(); } + void save_value() { m_xControl->save_value(); } + void set_sensitive(bool bSensitive) { m_xControl->set_sensitive(bSensitive); } + bool get_sensitive() const { return m_xControl->get_sensitive(); } }; /************************************************************************/ -class SAL_WARN_UNUSED SVX_DLLPUBLIC LineEndLB : public ListBox -{ - -public: - LineEndLB( vcl::Window* pParent, WinBits aWB ); - - void Fill( const XLineEndListRef &pList, bool bStart = true ); - - void Append( const XLineEndEntry& rEntry, const BitmapEx& rBitmap ); - void Modify( const XLineEndEntry& rEntry, sal_Int32 nPos, const BitmapEx& rBitmap ); -}; - class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxLineEndLB { private: @@ -331,6 +324,11 @@ public: OUString get_active_text() const { return m_xControl->get_active_text(); } void connect_changed(const Link<weld::ComboBox&, void>& rLink) { m_xControl->connect_changed(rLink); } int get_count() const { return m_xControl->get_count(); } + void append_text(const OUString& rStr) { m_xControl->append_text(rStr); } + bool get_value_changed_from_saved() const { return m_xControl->get_value_changed_from_saved(); } + void save_value() { m_xControl->save_value(); } + void set_sensitive(bool bSensitive) { m_xControl->set_sensitive(bSensitive); } + bool get_sensitive() const { return m_xControl->get_sensitive(); } }; class SdrObject; @@ -425,33 +423,6 @@ public: |* \************************************************************************/ -class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxXLinePreview : public SvxPreviewBase -{ -private: - SdrPathObj* mpLineObjA; - SdrPathObj* mpLineObjB; - SdrPathObj* mpLineObjC; - - Graphic* mpGraphic; - bool mbWithSymbol; - Size maSymbolSize; - -public: - SvxXLinePreview( vcl::Window* pParent ); - virtual ~SvxXLinePreview() override; - virtual void dispose() override; - - void SetLineAttributes(const SfxItemSet& rItemSet); - - void ShowSymbol( bool b ) { mbWithSymbol = b; }; - void SetSymbol( Graphic* p, const Size& s ); - void ResizeSymbol( const Size& s ); - - virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override; - virtual void Resize() override; - virtual Size GetOptimalSize() const override; -}; - class SAL_WARN_UNUSED SVX_DLLPUBLIC XLinePreview : public PreviewBase { private: diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index 687f9d28ab1b..558e7a1d34f9 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -1039,6 +1039,23 @@ public: virtual void set_sensitive(const OString& rIdent, bool bSensitive) = 0; virtual void set_active(const OString& rIdent, bool bActive) = 0; virtual void show(const OString& rIdent, bool bShow) = 0; + + virtual void insert(int pos, const OUString& rId, const OUString& rStr, + const OUString* pIconName, VirtualDevice* pImageSufface) + = 0; + void append(const OUString& rId, const OUString& rStr) + { + insert(-1, rId, rStr, nullptr, nullptr); + } + void append(const OUString& rId, const OUString& rStr, const OUString& rImage) + { + insert(-1, rId, rStr, &rImage, nullptr); + } + void append(const OUString& rId, const OUString& rStr, VirtualDevice& rImage) + { + insert(-1, rId, rStr, nullptr, &rImage); + } + virtual ~Menu() {} }; diff --git a/solenv/sanitizers/ui/cui.suppr b/solenv/sanitizers/ui/cui.suppr index b0c922a78d26..d9eed42d3e83 100644 --- a/solenv/sanitizers/ui/cui.suppr +++ b/solenv/sanitizers/ui/cui.suppr @@ -260,10 +260,8 @@ cui/uiconfig/ui/insertfloatingframe.ui://GtkSpinButton[@id='height'] no-labelled cui/uiconfig/ui/insertoleobject.ui://GtkEntry[@id='urled'] no-labelled-by cui/uiconfig/ui/javastartparametersdialog.ui://GtkTreeViewColumn[@id='treeviewcolumn1'] no-labelled-by cui/uiconfig/ui/javastartparametersdialog.ui://GtkLabel[@id='label6'] orphan-label -cui/uiconfig/ui/linetabpage.ui://GtkLabel[@id='FT_SYMBOL_HEIGHT'] orphan-label -cui/uiconfig/ui/linetabpage.ui://GtkSpinButton[@id='MF_SYMBOL_HEIGHT:0cm'] no-labelled-by cui/uiconfig/ui/lineendstabpage.ui://GtkLabel[@id='FT_LINE_END_STYLE'] orphan-label -cui/uiconfig/ui/lineendstabpage.ui://svxlo-LineEndLB[@id='LB_LINEENDS'] no-labelled-by +cui/uiconfig/ui/lineendstabpage.ui://GtkComboBox[@id='LB_LINEENDS'] no-labelled-by cui/uiconfig/ui/lineendstabpage.ui://GtkLabel[@id='FI_TIP'] orphan-label cui/uiconfig/ui/linestyletabpage.ui://GtkComboBox[@id='LB_TYPE_2'] no-labelled-by cui/uiconfig/ui/linestyletabpage.ui://GtkSpinButton[@id='NUM_FLD_2'] no-labelled-by diff --git a/svx/source/dialog/dlgctrl.cxx b/svx/source/dialog/dlgctrl.cxx index 83292b9483bb..35f1964313f1 100644 --- a/svx/source/dialog/dlgctrl.cxx +++ b/svx/source/dialog/dlgctrl.cxx @@ -915,17 +915,6 @@ HatchingLB::HatchingLB( vcl::Window* pParent, WinBits nWinStyle) SetEdgeBlending(true); } -extern "C" SAL_DLLPUBLIC_EXPORT void makeHatchingLB(VclPtr<vcl::Window> & rRet, VclPtr<vcl::Window> & pParent, VclBuilder::stringmap & rMap) -{ - WinBits nWinStyle = WB_LEFT|WB_VCENTER|WB_3DLOOK|WB_SIMPLEMODE; - OUString sBorder = BuilderUtils::extractCustomProperty(rMap); - if (!sBorder.isEmpty()) - nWinStyle |= WB_BORDER; - VclPtrInstance<HatchingLB> pListBox(pParent, nWinStyle); - pListBox->EnableAutoSize(true); - rRet = pListBox; -} - // Fills the listbox (provisional) with strings GradientLB::GradientLB( vcl::Window* pParent, WinBits aWB) @@ -934,17 +923,6 @@ GradientLB::GradientLB( vcl::Window* pParent, WinBits aWB) SetEdgeBlending(true); } -extern "C" SAL_DLLPUBLIC_EXPORT void makeGradientLB(VclPtr<vcl::Window> & rRet, VclPtr<vcl::Window> & pParent, VclBuilder::stringmap & rMap) -{ - WinBits nWinStyle = WB_LEFT|WB_VCENTER|WB_3DLOOK|WB_SIMPLEMODE; - OUString sBorder = BuilderUtils::extractCustomProperty(rMap); - if (!sBorder.isEmpty()) - nWinStyle |= WB_BORDER; - VclPtrInstance<GradientLB> pListBox(pParent, nWinStyle); - pListBox->EnableAutoSize(true); - rRet = pListBox; -} - // BitmapLB Constructor BitmapLB::BitmapLB( vcl::Window* pParent, WinBits aWB) @@ -953,17 +931,6 @@ BitmapLB::BitmapLB( vcl::Window* pParent, WinBits aWB) SetEdgeBlending(true); } -extern "C" SAL_DLLPUBLIC_EXPORT void makeBitmapLB(VclPtr<vcl::Window> & rRet, VclPtr<vcl::Window> & pParent, VclBuilder::stringmap & rMap) -{ - WinBits nWinStyle = WB_LEFT|WB_VCENTER|WB_3DLOOK|WB_SIMPLEMODE; - OUString sBorder = BuilderUtils::extractCustomProperty(rMap); - if (!sBorder.isEmpty()) - nWinStyle |= WB_BORDER; - VclPtrInstance<BitmapLB> pListBox(pParent, nWinStyle); - pListBox->EnableAutoSize(true); - rRet = pListBox; -} - void FillTypeLB::Fill() { SetUpdateMode( false ); @@ -986,20 +953,6 @@ LineLB::LineLB(vcl::Window* pParent, WinBits aWB) // No EdgeBlending for LineStyle/Dash SetEdgeBlending(true); } -extern "C" SAL_DLLPUBLIC_EXPORT void makeLineLB(VclPtr<vcl::Window> & rRet, VclPtr<vcl::Window> & pParent, VclBuilder::stringmap & rMap) -{ - bool bDropdown = BuilderUtils::extractDropdown(rMap); - WinBits nWinBits = WB_LEFT|WB_VCENTER|WB_3DLOOK|WB_SIMPLEMODE|WB_TABSTOP; - if (bDropdown) - nWinBits |= WB_DROPDOWN; - OUString sBorder = BuilderUtils::extractCustomProperty(rMap); - if (!sBorder.isEmpty()) - nWinBits |= WB_BORDER; - VclPtrInstance<LineLB> pListBox(pParent, nWinBits); - pListBox->EnableAutoSize(true); - rRet = pListBox; -} - void LineLB::setAddStandardFields(bool bNew) { if(getAddStandardFields() != bNew) @@ -1175,106 +1128,6 @@ void SvxLineLB::Modify(const XDashEntry& rEntry, sal_Int32 nPos, const BitmapEx& } } -// Fills the listbox (provisional) with strings - -LineEndLB::LineEndLB( vcl::Window* pParent, WinBits aWB ) - : ListBox( pParent, aWB ) -{ - // No EdgeBlending for LineEnds SetEdgeBlending(true); -} - -extern "C" SAL_DLLPUBLIC_EXPORT void makeLineEndLB(VclPtr<vcl::Window> & rRet, VclPtr<vcl::Window> & pParent, VclBuilder::stringmap & rMap) -{ - bool bDropdown = BuilderUtils::extractDropdown(rMap); - WinBits nWinBits = WB_LEFT|WB_VCENTER|WB_3DLOOK|WB_SIMPLEMODE|WB_TABSTOP; - if (bDropdown) - nWinBits |= WB_DROPDOWN; - OUString sBorder = BuilderUtils::extractCustomProperty(rMap); - if (!sBorder.isEmpty()) - nWinBits |= WB_BORDER; - VclPtrInstance<LineEndLB> pListBox(pParent, nWinBits); - pListBox->EnableAutoSize(true); - rRet = pListBox; -} - -void LineEndLB::Fill( const XLineEndListRef &pList, bool bStart ) -{ - if( !pList.is() ) - return; - - long nCount = pList->Count(); - ScopedVclPtrInstance< VirtualDevice > pVD; - SetUpdateMode( false ); - - for( long i = 0; i < nCount; i++ ) - { - const XLineEndEntry* pEntry = pList->GetLineEnd(i); - const BitmapEx aBitmap = pList->GetUiBitmap( i ); - if( !aBitmap.IsEmpty() ) - { - Size aBmpSize( aBitmap.GetSizePixel() ); - pVD->SetOutputSizePixel( aBmpSize, false ); - pVD->DrawBitmapEx( Point(), aBitmap ); - InsertEntry( pEntry->GetName(), - Image(pVD->GetBitmapEx( - bStart ? Point() : Point(aBmpSize.Width() / 2, 0), - Size(aBmpSize.Width() / 2, aBmpSize.Height())))); - } - else - InsertEntry( pEntry->GetName() ); - } - - AdaptDropDownLineCountToMaximum(); - SetUpdateMode( true ); -} - -void LineEndLB::Append( const XLineEndEntry& rEntry, const BitmapEx& rBitmap ) -{ - if(!rBitmap.IsEmpty()) - { - ScopedVclPtrInstance< VirtualDevice > pVD; - const Size aBmpSize(rBitmap.GetSizePixel()); - - pVD->SetOutputSizePixel(aBmpSize, false); - pVD->DrawBitmapEx(Point(), rBitmap); - InsertEntry( - rEntry.GetName(), - Image(pVD->GetBitmapEx( - Point(), - Size(aBmpSize.Width() / 2, aBmpSize.Height())))); - } - else - { - InsertEntry(rEntry.GetName()); - } - - AdaptDropDownLineCountToMaximum(); -} - -void LineEndLB::Modify( const XLineEndEntry& rEntry, sal_Int32 nPos, const BitmapEx& rBitmap ) -{ - RemoveEntry( nPos ); - - if(!rBitmap.IsEmpty()) - { - ScopedVclPtrInstance< VirtualDevice > pVD; - const Size aBmpSize(rBitmap.GetSizePixel()); - - pVD->SetOutputSizePixel(aBmpSize, false); - pVD->DrawBitmapEx(Point(), rBitmap); - InsertEntry( - rEntry.GetName(), - Image(pVD->GetBitmapEx( - Point(), - Size(aBmpSize.Width() / 2, aBmpSize.Height()))), - nPos); - } - else - { - InsertEntry(rEntry.GetName(), nPos); - } -} - SvxLineEndLB::SvxLineEndLB(std::unique_ptr<weld::ComboBox> pControl) : m_xControl(std::move(pControl)) { @@ -1483,145 +1336,6 @@ void SvxPreviewBase::DataChanged(const DataChangedEvent& rDCEvt) } } -void SvxXLinePreview::Resize() -{ - SvxPreviewBase::Resize(); - - const Size aOutputSize(GetOutputSize()); - const sal_Int32 nDistance(500); - const sal_Int32 nAvailableLength(aOutputSize.Width() - (4 * nDistance)); - - // create DrawObectA - const sal_Int32 aYPosA(aOutputSize.Height() / 2); - const basegfx::B2DPoint aPointA1( nDistance, aYPosA); - const basegfx::B2DPoint aPointA2( aPointA1.getX() + ((nAvailableLength * 14) / 20), aYPosA ); - basegfx::B2DPolygon aPolygonA; - aPolygonA.append(aPointA1); - aPolygonA.append(aPointA2); - mpLineObjA->SetPathPoly(basegfx::B2DPolyPolygon(aPolygonA)); - - // create DrawObectB - const sal_Int32 aYPosB1((aOutputSize.Height() * 3) / 4); - const sal_Int32 aYPosB2((aOutputSize.Height() * 1) / 4); - const basegfx::B2DPoint aPointB1( aPointA2.getX() + nDistance, aYPosB1); - const basegfx::B2DPoint aPointB2( aPointB1.getX() + ((nAvailableLength * 2) / 20), aYPosB2 ); - const basegfx::B2DPoint aPointB3( aPointB2.getX() + ((nAvailableLength * 2) / 20), aYPosB1 ); - basegfx::B2DPolygon aPolygonB; - aPolygonB.append(aPointB1); - aPolygonB.append(aPointB2); - aPolygonB.append(aPointB3); - mpLineObjB->SetPathPoly(basegfx::B2DPolyPolygon(aPolygonB)); - - // create DrawObectC - basegfx::B2DPolygon aPolygonC; - const basegfx::B2DPoint aPointC1( aPointB3.getX() + nDistance, aYPosB1); - const basegfx::B2DPoint aPointC2( aPointC1.getX() + ((nAvailableLength * 1) / 20), aYPosB2 ); - const basegfx::B2DPoint aPointC3( aPointC2.getX() + ((nAvailableLength * 1) / 20), aYPosB1 ); - aPolygonC.append(aPointC1); - aPolygonC.append(aPointC2); - aPolygonC.append(aPointC3); - mpLineObjC->SetPathPoly(basegfx::B2DPolyPolygon(aPolygonC)); -} - -SvxXLinePreview::SvxXLinePreview(vcl::Window* pParent) - : SvxPreviewBase(pParent) - , mpLineObjA(nullptr) - , mpLineObjB(nullptr) - , mpLineObjC(nullptr) - , mpGraphic(nullptr) - , mbWithSymbol(false) -{ - InitSettings( true, true ); - - mpLineObjA = new SdrPathObj(getModel(), OBJ_LINE); - mpLineObjB = new SdrPathObj(getModel(), OBJ_PLIN); - mpLineObjC = new SdrPathObj(getModel(), OBJ_PLIN); -} - -VCL_BUILDER_FACTORY(SvxXLinePreview) - -Size SvxXLinePreview::GetOptimalSize() const -{ - return getPreviewStripSize(*this); -} - -SvxXLinePreview::~SvxXLinePreview() -{ - disposeOnce(); -} - -void SvxXLinePreview::dispose() -{ - SdrObject *pFoo = mpLineObjA; - SdrObject::Free( pFoo ); - pFoo = mpLineObjB; - SdrObject::Free( pFoo ); - pFoo = mpLineObjC; - SdrObject::Free( pFoo ); - SvxPreviewBase::dispose(); -} - - -void SvxXLinePreview::SetSymbol(Graphic* p,const Size& s) -{ - mpGraphic = p; - maSymbolSize = s; -} - - -void SvxXLinePreview::ResizeSymbol(const Size& s) -{ - if ( s != maSymbolSize ) - { - maSymbolSize = s; - Invalidate(); - } -} - - -void SvxXLinePreview::SetLineAttributes(const SfxItemSet& rItemSet) -{ - // Set ItemSet at objects - mpLineObjA->SetMergedItemSet(rItemSet); - - // At line joints, do not use arrows - SfxItemSet aTempSet(rItemSet); - aTempSet.ClearItem(XATTR_LINESTART); - aTempSet.ClearItem(XATTR_LINEEND); - - mpLineObjB->SetMergedItemSet(aTempSet); - mpLineObjC->SetMergedItemSet(aTempSet); -} - - -void SvxXLinePreview::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) -{ - LocalPrePaint(rRenderContext); - - // paint objects to buffer device - sdr::contact::SdrObjectVector aObjectVector; - aObjectVector.push_back(mpLineObjA); - aObjectVector.push_back(mpLineObjB); - aObjectVector.push_back(mpLineObjC); - - sdr::contact::ObjectContactOfObjListPainter aPainter(getBufferDevice(), aObjectVector, nullptr); - sdr::contact::DisplayInfo aDisplayInfo; - - // do processing - aPainter.ProcessDisplay(aDisplayInfo); - - if ( mbWithSymbol && mpGraphic ) - { - const Size aOutputSize(GetOutputSize()); - Point aPos = Point( aOutputSize.Width() / 3, aOutputSize.Height() / 2 ); - aPos.AdjustX( -(maSymbolSize.Width() / 2) ); - aPos.AdjustY( -(maSymbolSize.Height() / 2) ); - mpGraphic->Draw(&getBufferDevice(), aPos, maSymbolSize); - } - - LocalPostPaint(rRenderContext); -} - void XLinePreview::Resize() { PreviewBase::Resize(); diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index d70cae87ad36..08a59377cdaa 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -498,6 +498,29 @@ IMPL_LINK(SalInstanceWidget, FocusOutListener, VclWindowEvent&, rEvent, void) signal_focus_out(); } +namespace +{ + Image createImage(const OUString& rImage) + { + if (rImage.lastIndexOf('.') != rImage.getLength() - 4) + { + assert((rImage == "dialog-warning" || rImage == "dialog-error" || rImage == "dialog-information") && "unknown stock image"); + if (rImage == "dialog-warning") + return Image(BitmapEx(IMG_WARN)); + else if (rImage == "dialog-error") + return Image(BitmapEx(IMG_ERROR)); + else if (rImage == "dialog-information") + return Image(BitmapEx(IMG_INFO)); + } + return Image(BitmapEx(rImage)); + } + + Image createImage(VirtualDevice& rDevice) + { + return Image(BitmapEx(rDevice.GetBitmapEx(Point(), rDevice.GetOutputSizePixel()))); + } +} + class SalInstanceMenu : public weld::Menu { private: @@ -530,6 +553,25 @@ public: { m_xMenu->ShowItem(m_xMenu->GetItemId(rIdent), bShow); } + + virtual void insert(int pos, const OUString& rId, const OUString& rStr, + const OUString* pIconName, VirtualDevice* pImageSurface) override + { + const auto nCount = m_xMenu->GetItemCount(); + const sal_uInt16 nLastId = nCount ? m_xMenu->GetItemId(nCount-1) : 0; + const sal_uInt16 nNewid = nLastId + 1; + m_xMenu->InsertItem(nNewid, rStr, MenuItemBits::NONE, + OUStringToOString(rId, RTL_TEXTENCODING_UTF8), pos == -1 ? MENU_APPEND : pos); + if (pIconName) + { + m_xMenu->SetItemImage(nNewid, createImage(*pIconName)); + } + else if (pImageSurface) + { + m_xMenu->SetItemImage(nNewid, createImage(*pImageSurface)); + } + } + virtual ~SalInstanceMenu() override { if (m_bTakeOwnership) @@ -1594,29 +1636,6 @@ IMPL_LINK(SalInstanceEntry, CursorListener, VclWindowEvent&, rEvent, void) signal_cursor_position(); } -namespace -{ - Image createImage(const OUString& rImage) - { - if (rImage.lastIndexOf('.') != rImage.getLength() - 4) - { - assert((rImage == "dialog-warning" || rImage == "dialog-error" || rImage == "dialog-information") && "unknown stock image"); - if (rImage == "dialog-warning") - return Image(BitmapEx(IMG_WARN)); - else if (rImage == "dialog-error") - return Image(BitmapEx(IMG_ERROR)); - else if (rImage == "dialog-information") - return Image(BitmapEx(IMG_INFO)); - } - return Image(BitmapEx(rImage)); - } - - Image createImage(VirtualDevice& rDevice) - { - return Image(BitmapEx(rDevice.GetBitmapEx(Point(), rDevice.GetOutputSizePixel()))); - } -} - class SalInstanceTreeView : public SalInstanceContainer, public virtual weld::TreeView { private: diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx index 033c0be408f0..2c6a6ef5580d 100644 --- a/vcl/unx/gtk3/gtk3gtkinst.cxx +++ b/vcl/unx/gtk3/gtk3gtkinst.cxx @@ -1608,13 +1608,6 @@ private: } } - void add_to_map(GtkMenuItem* pMenuItem) - { - const gchar* pStr = gtk_buildable_get_name(GTK_BUILDABLE(pMenuItem)); - OString id(pStr, pStr ? strlen(pStr) : 0); - m_aMap[id] = pMenuItem; - } - static void signalActivate(GtkMenuItem* pItem, gpointer widget) { MenuHelper* pThis = static_cast<MenuHelper*>(widget); @@ -1632,8 +1625,14 @@ public: if (!m_pMenu) return; gtk_container_foreach(GTK_CONTAINER(m_pMenu), collect, this); - for (auto& a : m_aMap) - g_signal_connect(a.second, "activate", G_CALLBACK(signalActivate), this); + } + + void add_to_map(GtkMenuItem* pMenuItem) + { + const gchar* pStr = gtk_buildable_get_name(GTK_BUILDABLE(pMenuItem)); + OString id(pStr, pStr ? strlen(pStr) : 0); + m_aMap[id] = pMenuItem; + g_signal_connect(pMenuItem, "activate", G_CALLBACK(signalActivate), this); } void disable_item_notify_events() @@ -1789,6 +1788,18 @@ public: { show_item(rIdent, bShow); } + + + virtual void insert(int pos, const OUString& rId, const OUString& rStr, + const OUString* /*pIconName*/, VirtualDevice* /*pImageSufface*/) override + { + GtkWidget *pItem = gtk_menu_item_new_with_label(MapToGtkAccelerator(rStr).getStr()); + gtk_buildable_set_name(GTK_BUILDABLE(pItem), OUStringToOString(rId, RTL_TEXTENCODING_UTF8).getStr()); + gtk_menu_shell_append(GTK_MENU_SHELL(m_pMenu), pItem); + add_to_map(GTK_MENU_ITEM(pItem)); + if (pos != -1) + gtk_menu_reorder_child(m_pMenu, pItem, pos); + } }; class GtkInstanceSizeGroup : public weld::SizeGroup |