class DALI_ADAPTOR_API Collection;
class DALI_ADAPTOR_API Action;
class DALI_ADAPTOR_API Application;
+class DALI_ADAPTOR_API Hypertext;
+class DALI_ADAPTOR_API Hyperlink;
/**
* @brief Base class for different accessibility bridges.
};
/**
+ * @brief Interface representing hypertext that can store a collection of hyperlinks.
+ */
+class Hypertext : public virtual Accessible
+{
+public:
+ /**
+ * @brief Gets the handle to hyperlink object from a specified index in hyperlink collection of this hypertext.
+ *
+ * @param[in] linkIndex The 0-based index in hyperlink collection.
+ *
+ * @return Handle to hyperlink object at a specified index in hyperlink collection of hypertext.
+ */
+ virtual Hyperlink* GetLink(int32_t linkIndex) const = 0;
+
+ /**
+ * @brief Gets the index in hyperlink collection occupied by hyperlink which spans over a specified character offset in this hypertext.
+ *
+ * @param[in] characterOffset The 0-based index of character in hypertext.
+ *
+ * @return The value of 0-based index in hyperlink collection (-1 if there is no hyperlink at the specified character offset).
+ */
+ virtual int32_t GetLinkIndex(int32_t characterOffset) const = 0;
+
+ /**
+ * @brief Gets number of hyperlinks stored in this hypertext.
+ *
+ * @return The number of hyperlinks (zero if none or -1 if the number cannot be determined)
+ */
+ virtual int32_t GetLinkCount() const = 0;
+};
+
+/**
+ * @brief Interface representing a hyperlink in hypertext .
+ */
+class Hyperlink : public virtual Accessible
+{
+public:
+ /**
+ * @brief Gets the index of character in originating hypertext at which this hyperlink ends.
+ *
+ * @return The 0-based index of hyperlink's last character + 1, in its originating hypertext.
+ */
+ virtual int32_t GetEndIndex() const = 0;
+
+ /**
+ * @brief Gets the index of character in originating hypertext at which this hyperlink starts.
+ *
+ * @return The 0-based index of hyperlink's first character, in its originating hypertext.
+ */
+ virtual int32_t GetStartIndex() const = 0;
+
+ /**
+ * @brief Gets the total number of anchors which this hyperlink has. Though, typical hyperlinks will have only one anchor.
+ *
+ * @return The number of anchors.
+ */
+ virtual int32_t GetAnchorCount() const = 0;
+
+ /**
+ * @brief Gets the object associated with a particular hyperlink's anchor.
+ *
+ * @param[in] anchorIndex The 0-based index in anchor collection.
+ *
+ * @return The handle to accessible object.
+ */
+ virtual Accessible* GetAnchorAccessible(int32_t anchorIndex) const = 0;
+
+ /**
+ * @brief Gets the URI associated with a particular hyperlink's anchor.
+ *
+ * @param[in] anchorIndex The 0-based index in anchor collection.
+ *
+ * @return The string containing URI.
+ */
+ virtual std::string GetAnchorUri(int32_t anchorIndex) const = 0;
+
+ /**
+ * @brief Tells whether this hyperlink object is still valid with respect to its originating hypertext object.
+ *
+ * @return True if hyperlink object is valid, false otherwise
+ */
+ virtual bool IsValid() const = 0;
+};
+
+/**
* @brief Interface representing objects which can store a set of selected items.
*/
class DALI_ADAPTOR_API Selection : public virtual Accessible
{
tmp.push_back(AtspiDbusInterfaceSelection);
}
+ if(dynamic_cast<Hypertext*>(this))
+ {
+ tmp.push_back(AtspiDbusInterfaceHypertext);
+ }
+ if(dynamic_cast<Hyperlink*>(this))
+ {
+ tmp.push_back(AtspiDbusInterfaceHyperlink);
+ }
return tmp;
}
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <string>
+
+// INTERNAL INCLUDES
+#include <dali/internal/accessibility/bridge/bridge-hyperlink.h>
+
+using namespace Dali::Accessibility;
+
+void BridgeHyperlink::RegisterInterfaces()
+{
+ DBus::DBusInterfaceDescription desc{AtspiDbusInterfaceHyperlink};
+ AddGetPropertyToInterface(desc, "NAnchors", &BridgeHyperlink::GetAnchorCount);
+ AddGetPropertyToInterface(desc, "StartIndex", &BridgeHyperlink::GetStartIndex);
+ AddGetPropertyToInterface(desc, "EndIndex", &BridgeHyperlink::GetEndIndex);
+ AddFunctionToInterface(desc, "GetObject", &BridgeHyperlink::GetAnchorAccessible);
+ AddFunctionToInterface(desc, "GetURI", &BridgeHyperlink::GetAnchorUri);
+ AddFunctionToInterface(desc, "IsValid", &BridgeHyperlink::IsValid);
+ mDbusServer.addInterface("/", desc, true);
+}
+
+Hyperlink* BridgeHyperlink::FindSelf() const
+{
+ auto self = BridgeBase::FindSelf();
+ assert(self);
+ auto hyperlinkInterface = dynamic_cast<Hyperlink*>(self);
+ if(!hyperlinkInterface)
+ {
+ throw std::domain_error{"object " + self->GetAddress().ToString() + " doesn't have Hyperlink interface"};
+ }
+ return hyperlinkInterface;
+}
+
+DBus::ValueOrError<int32_t> BridgeHyperlink::GetEndIndex()
+{
+ return FindSelf()->GetEndIndex();
+}
+
+DBus::ValueOrError<int32_t> BridgeHyperlink::GetStartIndex()
+{
+ return FindSelf()->GetStartIndex();
+}
+
+DBus::ValueOrError<int32_t> BridgeHyperlink::GetAnchorCount()
+{
+ return FindSelf()->GetAnchorCount();
+}
+
+DBus::ValueOrError<Dali::Accessibility::Accessible*> BridgeHyperlink::GetAnchorAccessible(int32_t anchorIndex)
+{
+ return FindSelf()->GetAnchorAccessible(anchorIndex);
+}
+
+DBus::ValueOrError<std::string> BridgeHyperlink::GetAnchorUri(int32_t anchorIndex)
+{
+ return FindSelf()->GetAnchorUri(anchorIndex);
+}
+
+DBus::ValueOrError<bool> BridgeHyperlink::IsValid()
+{
+ return FindSelf()->IsValid();
+}
--- /dev/null
+#ifndef DALI_INTERNAL_ACCESSIBILITY_BRIDGE_HYPERLINK_H
+#define DALI_INTERNAL_ACCESSIBILITY_BRIDGE_HYPERLINK_H
+
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/internal/accessibility/bridge/bridge-base.h>
+
+class BridgeHyperlink : public virtual BridgeBase
+{
+protected:
+ BridgeHyperlink() = default;
+
+ /**
+ * @brief Registers Hyperlink functions to dbus interfaces.
+ */
+ void RegisterInterfaces();
+
+ /**
+ * @brief Returns the Hyperlink object of the currently executed DBus method call.
+ *
+ * @return The Hyperlink object
+ */
+ Dali::Accessibility::Hyperlink* FindSelf() const;
+
+public:
+ /**
+ * @copydoc Dali::Accessibility::Hyperlink::GetEndIndex()
+ */
+ DBus::ValueOrError<int32_t> GetEndIndex();
+
+ /**
+ * @copydoc Dali::Accessibility::Hyperlink::GetStartIndex()
+ */
+ DBus::ValueOrError<int32_t> GetStartIndex();
+
+ /**
+ * @copydoc Dali::Accessibility::Hyperlink::GetAnchorCount()
+ */
+ DBus::ValueOrError<int32_t> GetAnchorCount();
+
+ /**
+ * @copydoc Dali::Accessibility::Hyperlink::GetAnchorAccessible()
+ */
+ DBus::ValueOrError<Dali::Accessibility::Accessible*> GetAnchorAccessible(int32_t anchorIndex);
+
+ /**
+ * @copydoc Dali::Accessibility::Hyperlink::GetAnchorUri()
+ */
+ DBus::ValueOrError<std::string> GetAnchorUri(int32_t anchorIndex);
+
+ /**
+ * @copydoc Dali::Accessibility::Hyperlink::IsValid()
+ */
+ DBus::ValueOrError<bool> IsValid();
+};
+
+#endif // DALI_INTERNAL_ACCESSIBILITY_BRIDGE_HYPERLINK_H
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <string>
+
+// INTERNAL INCLUDES
+#include <dali/internal/accessibility/bridge/bridge-hypertext.h>
+
+using namespace Dali::Accessibility;
+
+void BridgeHypertext::RegisterInterfaces()
+{
+ DBus::DBusInterfaceDescription desc{AtspiDbusInterfaceHypertext};
+ AddFunctionToInterface(desc, "GetNLinks", &BridgeHypertext::GetLinkCount);
+ AddFunctionToInterface(desc, "GetLink", &BridgeHypertext::GetLink);
+ AddFunctionToInterface(desc, "GetLinkIndex", &BridgeHypertext::GetLinkIndex);
+ mDbusServer.addInterface("/", desc, true);
+}
+
+Hypertext* BridgeHypertext::FindSelf() const
+{
+ auto self = BridgeBase::FindSelf();
+ assert(self);
+ auto hypertextInterface = dynamic_cast<Hypertext*>(self);
+ if(!hypertextInterface)
+ {
+ throw std::domain_error{"object " + self->GetAddress().ToString() + " doesn't have Hypertext interface"};
+ }
+ return hypertextInterface;
+}
+
+DBus::ValueOrError<int32_t> BridgeHypertext::GetLinkCount()
+{
+ return FindSelf()->GetLinkCount();
+}
+
+DBus::ValueOrError<Dali::Accessibility::Accessible*> BridgeHypertext::GetLink(int32_t linkIndex)
+{
+ return FindSelf()->GetLink(linkIndex);
+}
+
+DBus::ValueOrError<int32_t> BridgeHypertext::GetLinkIndex(int32_t characterOffset)
+{
+ return FindSelf()->GetLinkIndex(characterOffset);
+}
\ No newline at end of file
--- /dev/null
+#ifndef DALI_INTERNAL_ACCESSIBILITY_BRIDGE_HYPERTEXT_H
+#define DALI_INTERNAL_ACCESSIBILITY_BRIDGE_HYPERTEXT_H
+
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/internal/accessibility/bridge/bridge-base.h>
+
+class BridgeHypertext : public virtual BridgeBase
+{
+protected:
+ BridgeHypertext() = default;
+
+ /**
+ * @brief Registers Hypertext functions to dbus interfaces.
+ */
+ void RegisterInterfaces();
+
+ /**
+ * @brief Returns the Hypertext object of the currently executed DBus method call.
+ *
+ * @return The Hypertext object
+ */
+ Dali::Accessibility::Hypertext* FindSelf() const;
+
+public:
+ /**
+ * @copydoc Dali::Accessibility::Hypertext::GetLink()
+ */
+ DBus::ValueOrError<Dali::Accessibility::Accessible*> GetLink(int32_t linkIndex);
+
+ /**
+ * @copydoc Dali::Accessibility::Hypertext::GetLinkIndex()
+ */
+ DBus::ValueOrError<int32_t> GetLinkIndex(int32_t characterOffset);
+
+ /**
+ * @copydoc Dali::Accessibility::Hypertext::GetLinkCount()
+ */
+ DBus::ValueOrError<int32_t> GetLinkCount();
+};
+
+#endif // DALI_INTERNAL_ACCESSIBILITY_BRIDGE_HYPERTEXT_H
\ No newline at end of file
#include <dali/internal/accessibility/bridge/bridge-collection.h>
#include <dali/internal/accessibility/bridge/bridge-component.h>
#include <dali/internal/accessibility/bridge/bridge-editable-text.h>
+#include <dali/internal/accessibility/bridge/bridge-hypertext.h>
+#include <dali/internal/accessibility/bridge/bridge-hyperlink.h>
#include <dali/internal/accessibility/bridge/bridge-object.h>
#include <dali/internal/accessibility/bridge/bridge-selection.h>
#include <dali/internal/accessibility/bridge/bridge-text.h>
public BridgeText,
public BridgeEditableText,
public BridgeSelection,
- public BridgeApplication
+ public BridgeApplication,
+ public BridgeHypertext,
+ public BridgeHyperlink
{
DBus::DBusClient mAccessibilityStatusClient;
DBus::DBusClient mRegistryClient;
BridgeEditableText::RegisterInterfaces();
BridgeSelection::RegisterInterfaces();
BridgeApplication::RegisterInterfaces();
+ BridgeHypertext::RegisterInterfaces();
+ BridgeHyperlink::RegisterInterfaces();
RegisterOnBridge(&mApplication);
${adaptor_accessibility_dir}/bridge/bridge-collection.cpp
${adaptor_accessibility_dir}/bridge/bridge-component.cpp
${adaptor_accessibility_dir}/bridge/bridge-editable-text.cpp
+ ${adaptor_accessibility_dir}/bridge/bridge-hyperlink.cpp
+ ${adaptor_accessibility_dir}/bridge/bridge-hypertext.cpp
${adaptor_accessibility_dir}/bridge/bridge-impl.cpp
${adaptor_accessibility_dir}/bridge/bridge-object.cpp
${adaptor_accessibility_dir}/bridge/bridge-selection.cpp