diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-05-02 12:39:43 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-05-03 21:55:24 +0200 |
commit | 7e64aaebce8667f7ab173ea3807c62f81138b4af (patch) | |
tree | 0fe1c975221f32b742a8a09aa05ed431b55f8d9a /include | |
parent | 55fcb23ea5caa509d8254910c581d234f7ec9199 (diff) |
weld SvxTextAttrPage
with a a11y rework to be more like the insert special char a11y
also, route a11y questions about a custom widgets parent to the gtk toolkits
underlying default implementation, keeping only questions about ourself to
be handled by the XAccessible
focus rectangles in RectCtl work again, seems that got lost somewhere
along the way
Change-Id: I62237d45668f4438aec6031cc5a48c38de21bf98
Reviewed-on: https://gerrit.libreoffice.org/53767
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/svx/dlgctrl.hxx | 82 | ||||
-rw-r--r-- | include/vcl/layout.hxx | 14 | ||||
-rw-r--r-- | include/vcl/weld.hxx | 6 |
3 files changed, 98 insertions, 4 deletions
diff --git a/include/svx/dlgctrl.hxx b/include/svx/dlgctrl.hxx index 0cf9220cb34f..075a008fe0c0 100644 --- a/include/svx/dlgctrl.hxx +++ b/include/svx/dlgctrl.hxx @@ -24,6 +24,7 @@ #include <svx/svxdllapi.h> #include <svx/rectenum.hxx> #include <vcl/graph.hxx> +#include <vcl/weld.hxx> #include <svx/xtable.hxx> #include <rtl/ref.hxx> #include <o3tl/typed_flags_set.hxx> @@ -49,7 +50,12 @@ public: : SfxTabPage(pParent, rID, rUIXMLDescription, &rAttrSet) { } - virtual void PointChanged( vcl::Window* pWindow, RectPoint eRP ) = 0; + SvxTabPage(TabPageParent pParent, const OUString& rUIXMLDescription, const OString& rID, const SfxItemSet &rAttrSet) + : SfxTabPage(pParent, rUIXMLDescription, rID, &rAttrSet) + { + } + virtual void PointChanged(vcl::Window* pWindow, RectPoint eRP) = 0; + virtual void PointChanged(weld::DrawingArea* pArea, RectPoint eRP) = 0; }; /************************************************************************* @@ -69,6 +75,7 @@ namespace o3tl } class SvxRectCtlAccessibleContext; +class RectCtlAccessibleContext; class SvxPixelCtlAccessible; class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxRectCtl : public Control @@ -141,6 +148,79 @@ public: void DoCompletelyDisable(bool bNew); }; +class SAL_WARN_UNUSED SVX_DLLPUBLIC RectCtl +{ +private: + std::unique_ptr<weld::DrawingArea> m_xControl; + VclPtr<SvxTabPage> m_pPage; + + SVX_DLLPRIVATE void InitSettings(vcl::RenderContext& rRenderContext); + SVX_DLLPRIVATE void InitRectBitmap(); + SVX_DLLPRIVATE BitmapEx& GetRectBitmap(); + SVX_DLLPRIVATE void Resize_Impl(); + +protected: + rtl::Reference<RectCtlAccessibleContext> pAccContext; + sal_uInt16 nBorderWidth; + sal_uInt16 nRadius; + Size m_aSize; + Point aPtLT, aPtMT, aPtRT; + Point aPtLM, aPtMM, aPtRM; + Point aPtLB, aPtMB, aPtRB; + Point aPtNew; + RectPoint eRP, eDefRP; + BitmapEx* pBitmap; + CTL_STATE m_nState; + + bool mbCompleteDisable : 1; + + void MarkToResetSettings(); + + RectPoint GetRPFromPoint( Point, bool bRTL = false ) const; + const Point& GetPointFromRP( RectPoint ) const; + Point SetActualRPWithoutInvalidate( RectPoint eNewRP ); // returns the last point + + Point GetApproxLogPtFromPixPt( const Point& rRoughPixelPoint ) const; +public: + RectCtl(weld::Builder& rBuilder, const OString& rDrawingId, SvxTabPage* pPage, + RectPoint eRpt = RectPoint::MM, sal_uInt16 nBorder = 200, sal_uInt16 nCircle = 80); + void SetControlSettings(RectPoint eRpt, sal_uInt16 nBorder, sal_uInt16 nCircl); + ~RectCtl(); + + DECL_LINK(DoPaint, weld::DrawingArea::draw_args, void); + DECL_LINK(DoResize, const Size& rSize, void); + DECL_LINK(DoMouseButtonDown, const MouseEvent&, void); + DECL_LINK(DoKeyDown, const KeyEvent&, bool); + DECL_LINK(DoGetFocus, weld::Widget&, void); + DECL_LINK(DoLoseFocus, weld::Widget&, void); + DECL_LINK(MarkToResetSettings, weld::Widget&, void); + + void Reset(); + RectPoint GetActualRP() const { return eRP;} + void SetActualRP( RectPoint eNewRP ); + + void SetState( CTL_STATE nState ); + + static const sal_uInt8 NO_CHILDREN = 9; // returns number of usable radio buttons + + tools::Rectangle CalculateFocusRectangle() const; + tools::Rectangle CalculateFocusRectangle( RectPoint eRectPoint ) const; + + css::uno::Reference<css::accessibility::XAccessible> getAccessibleParent() { return m_xControl->get_accessible_parent(); } + css::uno::Reference<css::accessibility::XAccessible> CreateAccessible(); + a11yrelationset get_accessible_relation_set() { return m_xControl->get_accessible_relation_set(); } + + RectPoint GetApproxRPFromPixPt( const css::awt::Point& rPixelPoint ) const; + + bool IsCompletelyDisabled() const { return mbCompleteDisable; } + void DoCompletelyDisable(bool bNew); + + bool IsVisible() const { return m_xControl->get_visible(); } + bool HasFocus() const { return m_xControl->has_focus(); } + void GrabFocus() { m_xControl->grab_focus(); } + Size GetSize() const { return m_aSize; } +}; + /************************************************************************* |* Control for editing bitmaps \************************************************************************/ diff --git a/include/vcl/layout.hxx b/include/vcl/layout.hxx index 9aff1794a53c..31ff24e2d2ee 100644 --- a/include/vcl/layout.hxx +++ b/include/vcl/layout.hxx @@ -623,6 +623,7 @@ private: Link<const MouseEvent&, void> m_aMouseReleaseHdl; Link<const KeyEvent&, bool> m_aKeyPressHdl; Link<const KeyEvent&, bool> m_aKeyReleaseHdl; + Link<VclDrawingArea&, void> m_aStyleUpdatedHdl; virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override { @@ -655,21 +656,24 @@ private: if (!m_aKeyReleaseHdl.Call(rKEvt)) Control::KeyUp(rKEvt); } - virtual void StateChanged(StateChangedType nType) override { Control::StateChanged(nType); if (nType == StateChangedType::ControlForeground || nType == StateChangedType::ControlBackground) + { + m_aStyleUpdatedHdl.Call(*this); Invalidate(); + } } - virtual void DataChanged(const DataChangedEvent& rDCEvt) override { Control::DataChanged(rDCEvt); if ((rDCEvt.GetType() == DataChangedEventType::SETTINGS) && (rDCEvt.GetFlags() & AllSettingsFlags::STYLE)) + { + m_aStyleUpdatedHdl.Call(*this); Invalidate(); + } } - virtual FactoryFunction GetUITestFactory() const override { if (m_pFactoryFunction) @@ -721,6 +725,10 @@ public: { m_aKeyReleaseHdl = rLink; } + void SetStyleUpdatedHdl(const Link<VclDrawingArea&, void>& rLink) + { + m_aStyleUpdatedHdl = rLink; + } }; //Get first window of a pTopLevel window as diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index 93f8657e6852..309c1447a80d 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -17,7 +17,10 @@ #include <vcl/field.hxx> #include <vcl/virdev.hxx> +#include <com/sun/star/accessibility/XAccessibleRelationSet.hpp> + typedef css::uno::Reference<css::accessibility::XAccessible> a11yref; +typedef css::uno::Reference<css::accessibility::XAccessibleRelationSet> a11yrelationset; namespace weld { @@ -697,6 +700,7 @@ protected: Link<const MouseEvent&, void> m_aMouseReleaseHdl; Link<const KeyEvent&, bool> m_aKeyPressHdl; Link<const KeyEvent&, bool> m_aKeyReleaseHdl; + Link<Widget&, void> m_aStyleUpdatedHdl; public: void connect_draw(const Link<draw_args, void>& rLink) { m_aDrawHdl = rLink; } @@ -715,9 +719,11 @@ public: } void connect_key_press(const Link<const KeyEvent&, bool>& rLink) { m_aKeyPressHdl = rLink; } void connect_key_release(const Link<const KeyEvent&, bool>& rLink) { m_aKeyReleaseHdl = rLink; } + void connect_style_updated(const Link<Widget&, void>& rLink) { m_aStyleUpdatedHdl = rLink; } virtual void queue_draw() = 0; virtual void queue_draw_area(int x, int y, int width, int height) = 0; virtual a11yref get_accessible_parent() = 0; + virtual a11yrelationset get_accessible_relation_set() = 0; }; class VCL_DLLPUBLIC Menu |