[Libreoffice-commits] core.git: vcl/inc vcl/source vcl/unx
Jan-Marek Glogowski (via logerrit)
logerrit at kemper.freedesktop.org
Wed May 15 17:09:13 UTC 2019
vcl/inc/window.h | 5 +++
vcl/source/window/accessibility.cxx | 46 +++++++++++++++++++++++++++++++++++
vcl/unx/gtk/gtksalframe.cxx | 47 ------------------------------------
vcl/unx/gtk3/gtk3gtkframe.cxx | 47 ------------------------------------
4 files changed, 53 insertions(+), 92 deletions(-)
New commits:
commit ffd98521de175057e47d53f80685a70215959384
Author: Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Wed May 15 13:39:38 2019 +0000
Commit: Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Wed May 15 19:07:52 2019 +0200
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 at fbihome.de>
diff --git a/vcl/inc/window.h b/vcl/inc/window.h
index 8e0e53b88202..bdd64c1de5db 100644
--- a/vcl/inc/window.h
+++ b/vcl/inc/window.h
@@ -58,6 +58,8 @@ namespace com { namespace sun { namespace star {
namespace accessibility {
class XAccessible;
+ class XAccessibleContext;
+ class XAccessibleEditableText;
}
namespace rendering {
@@ -424,6 +426,9 @@ void ImplHandleResize( vcl::Window* pWindow, long nNewWidth, long nNewHeight );
VCL_DLLPUBLIC void ImplWindowStateFromStr(WindowStateData& rData, const OString& rStr);
VCL_DLLPUBLIC OString ImplWindowStateToStr(const WindowStateData& rData);
+VCL_DLLPUBLIC css::uno::Reference<css::accessibility::XAccessibleEditableText>
+FindFocusedEditableText(css::uno::Reference<css::accessibility::XAccessibleContext> const&);
+
#endif // INCLUDED_VCL_INC_WINDOW_H
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/accessibility.cxx b/vcl/source/window/accessibility.cxx
index a4e800373347..1b858386eb06 100644
--- a/vcl/source/window/accessibility.cxx
+++ b/vcl/source/window/accessibility.cxx
@@ -73,6 +73,8 @@
#include <com/sun/star/accessibility/XAccessible.hpp>
#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/accessibility/XAccessibleEditableText.hpp>
#include <com/sun/star/datatransfer/dnd/XDragSource.hpp>
#include <com/sun/star/datatransfer/dnd/XDropTarget.hpp>
#include <com/sun/star/datatransfer/clipboard/XClipboard.hpp>
@@ -638,4 +640,48 @@ void Window::SetAccessibilityEventsSuppressed(bool bSuppressed)
} /* namespace vcl */
+uno::Reference<accessibility::XAccessibleEditableText>
+FindFocusedEditableText(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
+ = FindFocusedEditableText(xChildContext);
+ if (xText.is())
+ return xText;
+ }
+ return uno::Reference<accessibility::XAccessibleEditableText>();
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/gtk/gtksalframe.cxx b/vcl/unx/gtk/gtksalframe.cxx
index abad3d42a241..75be17dcddc9 100644
--- a/vcl/unx/gtk/gtksalframe.cxx
+++ b/vcl/unx/gtk/gtksalframe.cxx
@@ -69,9 +69,6 @@
#endif
#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 <config_folders.h>
@@ -3485,48 +3482,6 @@ void GtkSalFrame::IMHandler::signalIMPreeditEnd( GtkIMContext*, gpointer im_hand
pThis->updateIMSpotLocation();
}
-static uno::Reference<accessibility::XAccessibleEditableText>
- FindFocus(const uno::Reference< accessibility::XAccessibleContext >& 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;
@@ -3534,7 +3489,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)
{
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)
{
More information about the Libreoffice-commits
mailing list