[Libreoffice-commits] core.git: sfx2/source
Tomaž Vajngerl (via logerrit)
logerrit at kemper.freedesktop.org
Thu Mar 11 11:46:36 UTC 2021
sfx2/source/devtools/DocumentModelTreeHandler.cxx | 39 ++++++++++++++++++++--
1 file changed, 37 insertions(+), 2 deletions(-)
New commits:
commit 9f36bc3a4252ac795696c162accf5c8a20ae258f
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Wed Mar 3 20:58:47 2021 +0900
Commit: Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Thu Mar 11 12:45:54 2021 +0100
devtools: add text portions for paragraphs to DOM tree view
Change-Id: I224ffb230abf1142087b5f2c4a3bd94a11075213
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112107
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
diff --git a/sfx2/source/devtools/DocumentModelTreeHandler.cxx b/sfx2/source/devtools/DocumentModelTreeHandler.cxx
index a170e3551bc5..6d15c56f3a5a 100644
--- a/sfx2/source/devtools/DocumentModelTreeHandler.cxx
+++ b/sfx2/source/devtools/DocumentModelTreeHandler.cxx
@@ -122,6 +122,40 @@ public:
}
};
+class ParagraphEntry : public DocumentModelTreeEntry
+{
+public:
+ ParagraphEntry(css::uno::Reference<css::uno::XInterface> const& xObject)
+ : DocumentModelTreeEntry(xObject)
+ {
+ }
+
+ void fill(std::unique_ptr<weld::TreeView>& pDocumentModelTree,
+ weld::TreeIter const& rParent) override
+ {
+ uno::Reference<container::XEnumerationAccess> xEnumAccess(getMainObject(), uno::UNO_QUERY);
+ if (!xEnumAccess.is())
+ return;
+
+ uno::Reference<container::XEnumeration> xTextPortions = xEnumAccess->createEnumeration();
+
+ if (xTextPortions.is())
+ {
+ for (sal_Int32 i = 0; xTextPortions->hasMoreElements(); i++)
+ {
+ uno::Reference<text::XTextRange> const xTextPortion(xTextPortions->nextElement(),
+ uno::UNO_QUERY);
+ OUString aString = lclGetNamed(xTextPortion);
+ if (aString.isEmpty())
+ aString = "Text Portion " + OUString::number(i + 1);
+
+ auto pEntry = std::make_unique<DocumentModelTreeEntry>(xTextPortion);
+ lclAppendToParentEntry(pDocumentModelTree, rParent, aString, pEntry.release());
+ }
+ }
+ }
+};
+
class ParagraphsEntry : public DocumentModelTreeEntry
{
public:
@@ -158,8 +192,9 @@ public:
if (aString.isEmpty())
aString = "Paragraph " + OUString::number(i + 1);
- auto pEntry = std::make_unique<DocumentModelTreeEntry>(xParagraph);
- lclAppendToParentEntry(pDocumentModelTree, rParent, aString, pEntry.release());
+ auto pEntry = std::make_unique<ParagraphEntry>(xParagraph);
+ lclAppendToParentEntry(pDocumentModelTree, rParent, aString, pEntry.release(),
+ true);
}
}
}
More information about the Libreoffice-commits
mailing list