diff options
author | Jan-Marek Glogowski <glogow@fbihome.de> | 2019-05-15 13:39:38 +0000 |
---|---|---|
committer | Jan-Marek Glogowski <glogow@fbihome.de> | 2019-05-15 19:07:52 +0200 |
commit | ffd98521de175057e47d53f80685a70215959384 (patch) | |
tree | d47de9306682fb3bd82a169d8e8ee6cb0abdc090 /vcl/unx/gtk3 | |
parent | ad9d2faff8ccb216c85e617d4d86464a91f317e0 (diff) |
Move FindFocusedEditableText from gtk* into vcl
Now that it will be used by four VCL plugins, move its code into
the common VCL library. The none-XAccessibility, none-UNO version
used on Windows needs much more work to function with various
widgets (including some API refactoring IMHO).
(see ImplHandleSalSurroundingTextRequest and friends).
Change-Id: I0fdf72336a66fc578b18b1edc8f8627d5dfdc57f
Reviewed-on: https://gerrit.libreoffice.org/72364
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
Diffstat (limited to 'vcl/unx/gtk3')
-rw-r--r-- | vcl/unx/gtk3/gtk3gtkframe.cxx | 47 |
1 files changed, 1 insertions, 46 deletions
diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx index 802359a38807..d16db67057e5 100644 --- a/vcl/unx/gtk3/gtk3gtkframe.cxx +++ b/vcl/unx/gtk3/gtk3gtkframe.cxx @@ -75,9 +75,6 @@ #include <cmath> #include <com/sun/star/accessibility/XAccessibleContext.hpp> -#include <com/sun/star/accessibility/AccessibleRole.hpp> -#include <com/sun/star/accessibility/XAccessibleStateSet.hpp> -#include <com/sun/star/accessibility/AccessibleStateType.hpp> #include <com/sun/star/accessibility/XAccessibleEditableText.hpp> #include <com/sun/star/awt/MouseButton.hpp> #include <com/sun/star/datatransfer/dnd/DNDConstants.hpp> @@ -4051,48 +4048,6 @@ void GtkSalFrame::IMHandler::signalIMPreeditEnd( GtkIMContext*, gpointer im_hand pThis->updateIMSpotLocation(); } -static uno::Reference<accessibility::XAccessibleEditableText> - FindFocus(uno::Reference< accessibility::XAccessibleContext > const & xContext) -{ - if (!xContext.is()) - return uno::Reference< accessibility::XAccessibleEditableText >(); - - uno::Reference<accessibility::XAccessibleStateSet> xState = xContext->getAccessibleStateSet(); - if (xState.is()) - { - if (xState->contains(accessibility::AccessibleStateType::FOCUSED)) - { - uno::Reference< accessibility::XAccessibleEditableText > xText = - uno::Reference<accessibility::XAccessibleEditableText>(xContext, uno::UNO_QUERY); - if (xText.is()) - return xText; - if (xState->contains(accessibility::AccessibleStateType::MANAGES_DESCENDANTS)) - return uno::Reference< accessibility::XAccessibleEditableText >(); - } - } - - bool bSafeToIterate = true; - sal_Int32 nCount = xContext->getAccessibleChildCount(); - if (nCount < 0 || nCount > SAL_MAX_UINT16 /* slow enough for anyone */) - bSafeToIterate = false; - if (!bSafeToIterate) - return uno::Reference< accessibility::XAccessibleEditableText >(); - - for (sal_Int32 i = 0; i < xContext->getAccessibleChildCount(); ++i) - { - uno::Reference< accessibility::XAccessible > xChild = xContext->getAccessibleChild(i); - if (!xChild.is()) - continue; - uno::Reference< accessibility::XAccessibleContext > xChildContext = xChild->getAccessibleContext(); - if (!xChildContext.is()) - continue; - uno::Reference< accessibility::XAccessibleEditableText > xText = FindFocus(xChildContext); - if (xText.is()) - return xText; - } - return uno::Reference< accessibility::XAccessibleEditableText >(); -} - static uno::Reference<accessibility::XAccessibleEditableText> lcl_GetxText(vcl::Window *pFocusWin) { uno::Reference<accessibility::XAccessibleEditableText> xText; @@ -4100,7 +4055,7 @@ static uno::Reference<accessibility::XAccessibleEditableText> lcl_GetxText(vcl:: { uno::Reference< accessibility::XAccessible > xAccessible( pFocusWin->GetAccessible() ); if (xAccessible.is()) - xText = FindFocus(xAccessible->getAccessibleContext()); + xText = FindFocusedEditableText(xAccessible->getAccessibleContext()); } catch(const uno::Exception& e) { |