/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
double getIncrement() const;
/**
+ * @copydoc UiObject::getTextMinBoundingRect()
+ *
+ */
+ Rect<int> getTextMinBoundingRect() const;
+
+ /**
* @copydoc UiObject::isCheckable()
*/
bool isCheckable() const;
virtual bool setFocus() = 0;
/**
+ * @copydoc UIObject::updateTextMinBoundingRect()
+ */
+ virtual void updateTextMinBoundingRect() = 0;
+
+ /**
* @brief Updates Node information from atspi server.
*
* @since_tizen 6.5
std::string mToolkitName;
Rect<int> mScreenBoundingBox;
Rect<int> mWindowBoundingBox;
+ Rect<int> mTextMinBoundingRect;
int mSupportingIfaces;
int mFeatureProperty;
int mPid;
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
void updatePid() override;
/**
+ * @copydoc UiObject::updateTextMinBoundingRect()
+ */
+ void updateTextMinBoundingRect() override;
+
+ /**
* @copydoc UiObject::setFocus()
*/
bool setFocus() override;
static gdouble Atspi_value_get_minimum_increment(AtspiValue *iface, GError **error);
static guint Atspi_accessible_get_process_id(AtspiAccessible *node, GError **error);
static gchar *Atspi_accessible_get_toolkit_name(AtspiAccessible *node, GError **error);
+ static AtspiRect *Atspi_text_get_minimum_bounding_rectangles(AtspiText* obj, gint start_offset, gint end_offset, AtspiCoordType type, GError** error);
private:
static std::recursive_mutex mMutex;
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
bool setFocus() override;
+ /**
+ * @brief TBD
+ * @since_tizen 7.0
+ */
+ void updateTextMinBoundingRect() override;
+
/**
* @brief TBD
* @since_tizen 6.5
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
const double getIncrement() const;
/**
+ * @brief Gets text object's minimum bounding rectangle(MBR).
+ * It works only for NUI Text Object.
+ *
+ * @return Rect
+ *
+ * @since_tizen 7.0
+ */
+ const Rect<int> getTextMinBoundingRect() const;
+
+ /**
* @brief Sets object's value.
*
* @param[in] double value
* @since_tizen 7.0
*/
void updateToolkitName() const;
+
+ /*
+ * @brief Updates text object's minimum bounding rectangle(MBR).
+ * It works only for NUI Text Object.
+ *
+ * @since_tizen 7.0
+ */
+ void updateTextMinBoundingRect() const;
+
/**
* @brief Sets focus to object.
*
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
{
return mPid;
}
+
+Rect<int> AccessibleNode::getTextMinBoundingRect() const
+{
+ return mTextMinBoundingRect;
+}
\ No newline at end of file
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
mPid = AtspiWrapper::Atspi_accessible_get_process_id(mNode, NULL);
}
+void AtspiAccessibleNode::updateTextMinBoundingRect()
+{
+ AtspiWrapper::Atspi_accessible_clear_cache(mNode);
+
+ AtspiText *text = atspi_accessible_get_text_iface(mNode);
+ if (text)
+ {
+ gint cc = atspi_text_get_character_count(text, NULL);
+ AtspiRect *textMinBoundingRectExtent = AtspiWrapper::Atspi_text_get_minimum_bounding_rectangles(text, 0, cc, ATSPI_COORD_TYPE_WINDOW, NULL);
+
+ if (textMinBoundingRectExtent) {
+ mTextMinBoundingRect =
+ Rect<int>{textMinBoundingRectExtent->x, textMinBoundingRectExtent->y, textMinBoundingRectExtent->x + textMinBoundingRectExtent->width,
+ textMinBoundingRectExtent->y + textMinBoundingRectExtent->height};
+ g_free(textMinBoundingRectExtent);
+ }
+
+ g_object_unref(text);
+ }
+}
+
bool AtspiAccessibleNode::setFocus()
{
AtspiComponent *component = AtspiWrapper::Atspi_accessible_get_component_iface(mNode);
std::unique_lock<std::recursive_mutex> lock(mMutex);
return atspi_accessible_get_toolkit_name(node, error);
}
+
+AtspiRect *AtspiWrapper::Atspi_text_get_minimum_bounding_rectangles(AtspiText* obj, gint start_offset, gint end_offset, AtspiCoordType type, GError** error)
+{
+ std::unique_lock<std::recursive_mutex> lock(mMutex);
+ return atspi_text_get_range_extents(obj, start_offset, end_offset, type, error);
+}
+
return false;
}
+void MockAccessibleNode::updateTextMinBoundingRect()
+{
+}
+
void MockAccessibleNode::refresh(bool updateAll)
{
}
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
return getAccessibleNode()->getIncrement();
}
+const Rect<int> UiObject::getTextMinBoundingRect() const
+{
+ return getAccessibleNode()->getTextMinBoundingRect();
+}
+
bool UiObject::setValue(double value)
{
return getAccessibleNode()->setValue(value);
mNode->updateToolkitName();
}
+void UiObject::updateTextMinBoundingRect() const
+{
+ mNode->updateTextMinBoundingRect();
+}
+
bool UiObject::setFocus() const
{
return mNode->setFocus();
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
::grpc::Status enableScreenAnalyzer(::grpc::ServerContext *context,
const ::aurum::ReqEnableScreenAnalyzer *request,
::aurum::RspEnableScreenAnalyzer *response) override;
+ ::grpc::Status getTextMinBoundingRect(::grpc::ServerContext *context,
+ const ::aurum::ReqGetTextMinBoundingRect *request,
+ ::aurum::RspGetTextMinBoundingRect *response) override;
};
#endif
+
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include "Commands/SetFocusCommand.h"
#include "Commands/GetActiveAppToolkitNameCommand.h"
#include "Commands/EnableScreenAnalyzerCommand.h"
+
+#include "Commands/GetTextMinBoundingRectCommand.h"
--- /dev/null
+/*
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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.
+ *
+ */
+
+#include <gio/gio.h>
+#include <grpcpp/grpcpp.h>
+#include "Commands/Command.h"
+#include "ObjectMapper.h"
+#include <aurum.grpc.pb.h>
+#include "config.h"
+
+class GetTextMinBoundingRectCommand : public Command {
+private:
+ const ::aurum::ReqGetTextMinBoundingRect *mRequest;
+ ::aurum::RspGetTextMinBoundingRect *mResponse;
+
+public:
+ GetTextMinBoundingRectCommand(const ::aurum::ReqGetTextMinBoundingRect *request,
+ ::aurum::RspGetTextMinBoundingRect *response);
+ ::grpc::Status execute() override;
+};
\ No newline at end of file
files('src/Commands/SetFocusCommand.cc'),
files('src/Commands/GetActiveAppToolkitNameCommand.cc'),
files('src/Commands/EnableScreenAnalyzerCommand.cc'),
+ files('src/Commands/GetTextMinBoundingRectCommand.cc'),
]
bootstrap_svr_dep = [
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
return execute(cmd.get(), true);
}
+::grpc::Status aurumServiceImpl::getTextMinBoundingRect(::grpc::ServerContext *context,
+ const ::aurum::ReqGetTextMinBoundingRect *request,
+ ::aurum::RspGetTextMinBoundingRect *response)
+{
+ std::unique_ptr<GetTextMinBoundingRectCommand> cmd = std::make_unique<GetTextMinBoundingRectCommand>(request, response);
+ return execute(cmd.get(), true);
+}
+
--- /dev/null
+/*
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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.
+ *
+ */
+
+#include "bootstrap.h"
+#include "GetTextMinBoundingRectCommand.h"
+#include "UiObject.h"
+
+GetTextMinBoundingRectCommand::GetTextMinBoundingRectCommand(const ::aurum::ReqGetTextMinBoundingRect *request,
+ ::aurum::RspGetTextMinBoundingRect *response)
+ : mRequest{request}, mResponse{response}
+{
+}
+
+::grpc::Status GetTextMinBoundingRectCommand::execute()
+{
+ LOGI("GetTextMinBoundingRect --------------- ");
+
+ ObjectMapper *mObjMap = ObjectMapper::getInstance();
+ std::shared_ptr<UiObject> obj = mObjMap->getElement(mRequest->elementid());
+ if (obj) {
+ obj->updateTextMinBoundingRect();
+ ::aurum::Rect *rect = mResponse->mutable_size();
+ const Rect<int> &size = obj->getTextMinBoundingRect();
+
+ rect->set_x(size.mTopLeft.x);
+ rect->set_y(size.mTopLeft.y);
+ rect->set_width(size.width());
+ rect->set_height(size.height());
+
+ mResponse->set_status(::aurum::RspStatus::OK);
+ }
+ else
+ mResponse->set_status(::aurum::RspStatus::ERROR);
+
+ return grpc::Status::OK;
+}
\ No newline at end of file
rpc findElements(ReqFindElements) returns (RspFindElements) {}
rpc getActiveAppToolkitName(ReqGetActiveAppToolkitName) returns (RspGetActiveAppToolkitName) {}
rpc enableScreenAnalyzer(ReqEnableScreenAnalyzer) returns (RspEnableScreenAnalyzer) {}
+ rpc getTextMinBoundingRect(ReqGetTextMinBoundingRect) returns (RspGetTextMinBoundingRect) {}
}
// ------------------------------------ //
RspStatus status = 1;
}
+message ReqGetTextMinBoundingRect {
+ string elementId = 1;
+}
+
+message RspGetTextMinBoundingRect {
+ RspStatus status = 1;
+ Rect size = 2;
+}
+