[Libreoffice-commits] core.git: include/svx svx/source

Tomaž Vajngerl (via logerrit) logerrit at kemper.freedesktop.org
Wed Feb 10 23:33:48 UTC 2021


 include/svx/devtools/DocumentModelTreeHandler.hxx    |    1 +
 svx/source/devtools/DevelopmentToolDockingWindow.cxx |    3 +--
 svx/source/devtools/DocumentModelTreeHandler.cxx     |   17 +++++++++++++++++
 3 files changed, 19 insertions(+), 2 deletions(-)

New commits:
commit e0843b1fe6e39d3e5f14c8f13476008f17c8ed2e
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Fri Feb 5 18:29:32 2021 +0900
Commit:     Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Thu Feb 11 00:33:03 2021 +0100

    devtools: when selection changes, select obj. in DOM tree view
    
    When we inspect the current selected object, we search and select
    the object in the document model tree view if the object is in
    the tree view, or just unselect everything.
    
    Change-Id: I5dc5e323067bfb4aa3d2cd904d3f810719e45fad
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110467
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/include/svx/devtools/DocumentModelTreeHandler.hxx b/include/svx/devtools/DocumentModelTreeHandler.hxx
index 3b57ec1aca34..fad725726cfb 100644
--- a/include/svx/devtools/DocumentModelTreeHandler.hxx
+++ b/include/svx/devtools/DocumentModelTreeHandler.hxx
@@ -43,6 +43,7 @@ public:
     static css::uno::Reference<css::uno::XInterface> getObjectByID(OUString const& rID);
 
     void dispose();
+    void selectObject(css::uno::Reference<css::uno::XInterface> const& xInterface);
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/devtools/DevelopmentToolDockingWindow.cxx b/svx/source/devtools/DevelopmentToolDockingWindow.cxx
index 9ba52a5d5751..1ab3ab997808 100644
--- a/svx/source/devtools/DevelopmentToolDockingWindow.cxx
+++ b/svx/source/devtools/DevelopmentToolDockingWindow.cxx
@@ -544,12 +544,11 @@ void DevelopmentToolDockingWindow::updateSelection()
     if (eTriState == TRISTATE_TRUE)
     {
         introspect(mxCurrentSelection);
-        mpDocumentModelTreeView->set_sensitive(false);
+        maDocumentModelTreeHandler.selectObject(mxCurrentSelection);
     }
     else
     {
         mpDocumentModelTreeView->set_sensitive(true);
-        DocumentModelTreeViewSelectionHandler(*mpDocumentModelTreeView);
     }
 }
 
diff --git a/svx/source/devtools/DocumentModelTreeHandler.cxx b/svx/source/devtools/DocumentModelTreeHandler.cxx
index 12237bd6af7a..5cc293c7fe44 100644
--- a/svx/source/devtools/DocumentModelTreeHandler.cxx
+++ b/svx/source/devtools/DocumentModelTreeHandler.cxx
@@ -620,6 +620,23 @@ IMPL_LINK(DocumentModelTreeHandler, ExpandingHandler, weld::TreeIter const&, rPa
     return true;
 }
 
+void DocumentModelTreeHandler::selectObject(
+    css::uno::Reference<css::uno::XInterface> const& xInterface)
+{
+    mpDocumentModelTree->unselect_all();
+
+    mpDocumentModelTree->all_foreach([this, xInterface](weld::TreeIter& rEntry) {
+        OUString sID = mpDocumentModelTree->get_id(rEntry);
+        auto* pEntry = reinterpret_cast<DocumentModelTreeEntry*>(sID.toInt64());
+        if (xInterface == pEntry->getMainObject())
+        {
+            mpDocumentModelTree->select(rEntry);
+            return true;
+        }
+        return false;
+    });
+}
+
 void DocumentModelTreeHandler::inspectDocument()
 {
     uno::Reference<lang::XServiceInfo> xDocumentServiceInfo(mxDocument, uno::UNO_QUERY_THROW);


More information about the Libreoffice-commits mailing list