summaryrefslogtreecommitdiff
path: root/sfx2/source/devtools/ObjectInspectorTreeHandler.cxx
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2021-03-15 16:16:05 +0900
committerTomaž Vajngerl <quikee@gmail.com>2021-03-16 03:41:39 +0100
commit2b9cf977810193b642761328ec15ec78ce245016 (patch)
treeceae57fbe83ba82ec739742ac68bc274e84da1d6 /sfx2/source/devtools/ObjectInspectorTreeHandler.cxx
parent173697822d6a598461f79da2e2f77f24723d40ab (diff)
devtools: add a text view to show the value of selected property
Sometimes the property value in textual form can take a lot of space, which can't be shown completely in the tree view. To solve this problem, this change adds a text view at the bottom of the tree view, that shows the complete value of currently selected property. The text view can be expanded if necessary, but to not require constant changing of the pane, the position of the text view is always reset to 90% of the total height. Change-Id: I209ee29c7b60ecaa15227cc4966f19a063a7dc0a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112548 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'sfx2/source/devtools/ObjectInspectorTreeHandler.cxx')
-rw-r--r--sfx2/source/devtools/ObjectInspectorTreeHandler.cxx24
1 files changed, 23 insertions, 1 deletions
diff --git a/sfx2/source/devtools/ObjectInspectorTreeHandler.cxx b/sfx2/source/devtools/ObjectInspectorTreeHandler.cxx
index b7f1391ff17f..d5a9c9b990cf 100644
--- a/sfx2/source/devtools/ObjectInspectorTreeHandler.cxx
+++ b/sfx2/source/devtools/ObjectInspectorTreeHandler.cxx
@@ -780,6 +780,7 @@ ObjectInspectorTreeHandler::ObjectInspectorTreeHandler(
std::unique_ptr<ObjectInspectorWidgets>& pObjectInspectorWidgets)
: mpObjectInspectorWidgets(pObjectInspectorWidgets)
, mxContext(comphelper::getProcessComponentContext())
+ , mbPanedResetSize(true)
{
mpObjectInspectorWidgets->mpInterfacesTreeView->connect_expanding(
LINK(this, ObjectInspectorTreeHandler, ExpandingHandlerInterfaces));
@@ -812,10 +813,15 @@ ObjectInspectorTreeHandler::ObjectInspectorTreeHandler(
mpObjectInspectorWidgets->mpToolbar->set_item_sensitive("inspect", false);
mpObjectInspectorWidgets->mpToolbar->set_item_sensitive("back", false);
+ mpObjectInspectorWidgets->mpTextView->hide();
+
mpObjectInspectorWidgets->mpNotebook->connect_leave_page(
LINK(this, ObjectInspectorTreeHandler, NotebookLeavePage));
mpObjectInspectorWidgets->mpNotebook->connect_enter_page(
LINK(this, ObjectInspectorTreeHandler, NotebookEnterPage));
+
+ mpObjectInspectorWidgets->mpPaned->connect_size_allocate(
+ LINK(this, ObjectInspectorTreeHandler, PanedSizeChange));
}
void ObjectInspectorTreeHandler::handleExpanding(std::unique_ptr<weld::TreeView>& pTreeView,
@@ -860,7 +866,7 @@ IMPL_LINK(ObjectInspectorTreeHandler, ExpandingHandlerMethods, weld::TreeIter co
IMPL_LINK(ObjectInspectorTreeHandler, SelectionChanged, weld::TreeView&, rTreeView, void)
{
bool bHaveNodeWithObject = false;
-
+ mpObjectInspectorWidgets->mpTextView->set_text("");
if (mpObjectInspectorWidgets->mpPropertiesTreeView.get() == &rTreeView)
{
auto* pNode = getSelectedNode(rTreeView);
@@ -869,6 +875,7 @@ IMPL_LINK(ObjectInspectorTreeHandler, SelectionChanged, weld::TreeView&, rTreeVi
uno::Any aAny = pBasicValueNode->getAny();
uno::Reference<uno::XInterface> xInterface(aAny, uno::UNO_QUERY);
bHaveNodeWithObject = xInterface.is();
+ mpObjectInspectorWidgets->mpTextView->set_text(AnyToString(aAny, mxContext));
}
}
@@ -929,6 +936,8 @@ IMPL_LINK(ObjectInspectorTreeHandler, ToolbarButtonClicked, const OString&, rSel
IMPL_LINK(ObjectInspectorTreeHandler, NotebookEnterPage, const OString&, rPageId, void)
{
+ mpObjectInspectorWidgets->mpTextView->hide();
+
uno::Any aAny = maInspectionStack.back();
if (aAny.hasValue())
{
@@ -949,10 +958,12 @@ IMPL_LINK(ObjectInspectorTreeHandler, NotebookEnterPage, const OString&, rPageId
}
else if (rPageId == "object_inspector_properties_tab")
{
+ mbPanedResetSize = true;
mpObjectInspectorWidgets->mpPropertiesTreeView->freeze();
clearAll(mpObjectInspectorWidgets->mpPropertiesTreeView);
appendProperties(xInterface);
mpObjectInspectorWidgets->mpPropertiesTreeView->thaw();
+ mpObjectInspectorWidgets->mpTextView->show();
}
else if (rPageId == "object_inspector_methods_tab")
{
@@ -993,6 +1004,17 @@ IMPL_LINK(ObjectInspectorTreeHandler, NotebookLeavePage, const OString&, rPageId
return true;
}
+IMPL_LINK(ObjectInspectorTreeHandler, PanedSizeChange, const Size&, rSize, void)
+{
+ if (mbPanedResetSize)
+ {
+ // Set position at 90% of the height
+ tools::Long nHeight = rSize.Height();
+ mpObjectInspectorWidgets->mpPaned->set_position(nHeight * 0.9);
+ mbPanedResetSize = false;
+ }
+}
+
void ObjectInspectorTreeHandler::clearObjectInspectorChildren(
std::unique_ptr<weld::TreeView>& pTreeView, weld::TreeIter const& rParent)
{