From 374599f8c26713905a310673d2b429083321186a Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Thu, 22 Mar 2018 13:41:50 +0000 Subject: weld SvxCharacterMap dialog MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit and SmSymDefineDialog There's a whole bunch of interrelated stuff which needs to work at the same time. add menu support, keyboard support, better mouse support, a gtk scrollable adaptor to support pseudo scrolling drawing bodge, plugable uitest support for custom widgets, plugable a11y support for custom widgets via the existing atk_object_wrapper_new wrapper for XAccessible In this specific case, change SvxCharacterMap from something that has an internal scrollbar to a scrolledwindow where the scrollbar is external, which drops the need for the a11y impl of SvxCharacterMap to emulate being a scrolled window and internal table and just needs the table a11y impl Change-Id: Ia2743d6958021c525a1900154dcbb69ae33fc400 Reviewed-on: https://gerrit.libreoffice.org/52084 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- starmath/inc/dialog.hxx | 130 +++++++++++++++++++++++++----------------------- 1 file changed, 69 insertions(+), 61 deletions(-) (limited to 'starmath/inc') diff --git a/starmath/inc/dialog.hxx b/starmath/inc/dialog.hxx index 6b71b2791a6c..2b5556a9ec97 100644 --- a/starmath/inc/dialog.hxx +++ b/starmath/inc/dialog.hxx @@ -382,62 +382,76 @@ public: }; -class SmShowChar : public Control +class SmShowChar { - virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) override; - virtual void Resize() override; +private: + std::unique_ptr m_xDrawingArea; + OUString m_aText; + vcl::Font m_aFont; + Size m_aSize; + + DECL_LINK(DoPaint, weld::DrawingArea::draw_args, void); + DECL_LINK(DoResize, const Size& rSize, void); public: - SmShowChar(vcl::Window *pParent, WinBits nStyle) - : Control(pParent, nStyle) + SmShowChar(weld::DrawingArea* pDrawingArea) + : m_xDrawingArea(pDrawingArea) { + m_xDrawingArea->connect_size_allocate(LINK(this, SmShowChar, DoResize)); + m_xDrawingArea->connect_draw(LINK(this, SmShowChar, DoPaint)); + m_xDrawingArea->set_size_request(m_xDrawingArea->get_approximate_digit_width() * 7, + m_xDrawingArea->get_text_height() * 3); } - void SetSymbol( const SmSym *pSym ); - void SetSymbol( sal_UCS4 cChar, const vcl::Font &rFont ); -}; + void SetSymbol(const SmSym *pSym); + void SetSymbol(sal_UCS4 cChar, const vcl::Font &rFont); + void SetText(const OUString& rText) { m_aText = rText; } + const OUString& GetText() const { return m_aText; } + void SetFont(const vcl::Font& rFont) { m_aFont = rFont; } + const vcl::Font& GetFont() const { return m_aFont; } + void queue_draw() { m_xDrawingArea->queue_draw(); } +}; -class SmSymDefineDialog : public ModalDialog +class SmSymDefineDialog : public weld::GenericDialogController { - VclPtr pOldSymbols; - VclPtr pOldSymbolSets; - VclPtr pCharsetDisplay; - VclPtr pSymbols; - VclPtr pSymbolSets; - VclPtr pFonts; - VclPtr pFontsSubsetLB; - VclPtr pStyles; - VclPtr pOldSymbolName; - VclPtr pOldSymbolDisplay; - VclPtr pOldSymbolSetName; - VclPtr pSymbolName; - VclPtr pSymbolDisplay; - VclPtr pSymbolSetName; - VclPtr pAddBtn; - VclPtr pChangeBtn; - VclPtr pDeleteBtn; - - SmSymbolManager aSymbolMgrCopy, - &rSymbolMgr; - std::unique_ptr pOrigSymbol; - - std::unique_ptr pSubsetMap; - FontList *pFontList; - - DECL_LINK(OldSymbolChangeHdl, ComboBox&, void); - DECL_LINK(OldSymbolSetChangeHdl, ComboBox&, void); - DECL_LINK(ModifyHdl, Edit&, void); - DECL_LINK(FontChangeHdl, ListBox&, void); - DECL_LINK(SubsetChangeHdl, ListBox&, void); - DECL_LINK(StyleChangeHdl, ComboBox&, void); + VclPtr m_xVirDev; + SmSymbolManager m_aSymbolMgrCopy; + SmSymbolManager& m_rSymbolMgr; + std::unique_ptr m_xOrigSymbol; + std::unique_ptr m_xSubsetMap; + std::unique_ptr m_xFontList; + std::unique_ptr m_xOldSymbols; + std::unique_ptr m_xOldSymbolSets; + std::unique_ptr m_xSymbols; + std::unique_ptr m_xSymbolSets; + std::unique_ptr m_xFonts; + std::unique_ptr m_xFontsSubsetLB; + std::unique_ptr m_xStyles; + std::unique_ptr m_xOldSymbolName; + std::unique_ptr m_xOldSymbolSetName; + std::unique_ptr m_xSymbolName; + std::unique_ptr m_xSymbolSetName; + std::unique_ptr m_xAddBtn; + std::unique_ptr m_xChangeBtn; + std::unique_ptr m_xDeleteBtn; + std::unique_ptr m_xOldSymbolDisplay; + std::unique_ptr m_xSymbolDisplay; + std::unique_ptr m_xCharsetDisplay; + + DECL_LINK(OldSymbolChangeHdl, weld::ComboBoxText&, void); + DECL_LINK(OldSymbolSetChangeHdl, weld::ComboBoxText&, void); + DECL_LINK(ModifyHdl, weld::ComboBoxText&, void); + DECL_LINK(FontChangeHdl, weld::ComboBoxText&, void); + DECL_LINK(SubsetChangeHdl, weld::ComboBoxText&, void); + DECL_LINK(StyleChangeHdl, weld::ComboBoxText&, void); DECL_LINK(CharHighlightHdl, SvxShowCharSet*, void); - DECL_LINK(AddClickHdl, Button *, void); - DECL_LINK(ChangeClickHdl, Button *, void); - DECL_LINK(DeleteClickHdl, Button *, void); + DECL_LINK(AddClickHdl, weld::Button&, void); + DECL_LINK(ChangeClickHdl, weld::Button&, void); + DECL_LINK(DeleteClickHdl, weld::Button&, void); - void FillSymbols(ComboBox &rComboBox, bool bDeleteText = true); - void FillSymbolSets(ComboBox &rComboBox, bool bDeleteText = true); + void FillSymbols(weld::ComboBoxText& rComboBox, bool bDeleteText = true); + void FillSymbolSets(weld::ComboBoxText& rComboBox, bool bDeleteText = true); void FillFonts(); void FillStyles(); @@ -446,49 +460,43 @@ class SmSymDefineDialog : public ModalDialog void SetOrigSymbol(const SmSym *pSymbol, const OUString &rSymbolSetName); void UpdateButtons(); - bool SelectSymbolSet(ComboBox &rComboBox, const OUString &rSymbolSetName, + bool SelectSymbolSet(weld::ComboBoxText &rComboBox, const OUString &rSymbolSetName, bool bDeleteText); - bool SelectSymbol(ComboBox &rComboBox, const OUString &rSymbolName, + bool SelectSymbol(weld::ComboBoxText& rComboBox, const OUString &rSymbolName, bool bDeleteText); bool SelectFont(const OUString &rFontName, bool bApplyFont); bool SelectStyle(const OUString &rStyleName, bool bApplyFont); - SmSym * GetSymbol(const ComboBox &rComboBox); - const SmSym * GetSymbol(const ComboBox &rComboBox) const + SmSym* GetSymbol(const weld::ComboBoxText& rComboBox); + const SmSym* GetSymbol(const weld::ComboBoxText& rComboBox) const { return const_cast(this)->GetSymbol(rComboBox); } - virtual void DataChanged( const DataChangedEvent& rDCEvt ) override; - public: - SmSymDefineDialog(vcl::Window *pParent, OutputDevice *pFntListDevice, SmSymbolManager &rMgr); + SmSymDefineDialog(weld::Window *pParent, OutputDevice *pFntListDevice, SmSymbolManager &rMgr); virtual ~SmSymDefineDialog() override; - virtual void dispose() override; - - using OutputDevice::SetFont; - // Dialog - virtual short Execute() override; + short execute(); void SelectOldSymbolSet(const OUString &rSymbolSetName) { - SelectSymbolSet(*pOldSymbolSets, rSymbolSetName, false); + SelectSymbolSet(*m_xOldSymbolSets, rSymbolSetName, false); } void SelectOldSymbol(const OUString &rSymbolName) { - SelectSymbol(*pOldSymbols, rSymbolName, false); + SelectSymbol(*m_xOldSymbols, rSymbolName, false); } bool SelectSymbolSet(const OUString &rSymbolSetName) { - return SelectSymbolSet(*pSymbolSets, rSymbolSetName, false); + return SelectSymbolSet(*m_xSymbolSets, rSymbolSetName, false); } bool SelectSymbol(const OUString &rSymbolName) { - return SelectSymbol(*pSymbols, rSymbolName, false); + return SelectSymbol(*m_xSymbols, rSymbolName, false); } bool SelectFont(const OUString &rFontName) { return SelectFont(rFontName, true); } -- cgit