[Libreoffice-commits] core.git: sw/source

Aron Budea (via logerrit) logerrit at kemper.freedesktop.org
Sat Sep 19 21:00:45 UTC 2020


 sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx |   31 ++++++++++++++----
 1 file changed, 25 insertions(+), 6 deletions(-)

New commits:
commit bb369dd4f372f606a9a63ecefbd1c7d3b725cd02
Author:     Aron Budea <aron.budea at collabora.com>
AuthorDate: Sat Sep 19 02:11:25 2020 +0200
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Sat Sep 19 23:00:09 2020 +0200

    tdf#135115: show paragraph direct formatting in Styles Inspector
    
    Change-Id: I2300dadeb87870fe800d533d80ec4bbf5211b894
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103028
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>

diff --git a/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx b/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx
index 8ea4fda5e213..589cec4a967c 100644
--- a/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx
+++ b/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx
@@ -425,25 +425,35 @@ static void UpdateTree(SwDocShell* pDocSh, std::vector<svx::sidebar::TreeNode>&
     svx::sidebar::TreeNode aDFNode;
     svx::sidebar::TreeNode aCharNode;
     svx::sidebar::TreeNode aParaNode;
+    svx::sidebar::TreeNode aParaDFNode;
 
     aDFNode.sNodeName = "Direct Formatting";
     aCharNode.sNodeName = "Character Styles";
     aParaNode.sNodeName = "Paragraph Styles";
+    aParaDFNode.sNodeName = "Paragraph Direct Formatting";
     aDFNode.NodeType = svx::sidebar::TreeNode::Category;
     aCharNode.NodeType = svx::sidebar::TreeNode::Category;
     aParaNode.NodeType = svx::sidebar::TreeNode::Category;
+    aParaDFNode.NodeType = svx::sidebar::TreeNode::Category;
 
     uno::Reference<text::XTextRange> xRange(
         SwXTextRange::CreateXTextRange(*pDoc, *pCursor->GetPoint(), nullptr));
     uno::Reference<beans::XPropertySet> xPropertiesSet(xRange, uno::UNO_QUERY_THROW);
     std::unordered_map<OUString, bool> aIsDefined;
 
-    InsertValues(xRange, aIsDefined, aDFNode, false,
-                 { UNO_NAME_RSID, UNO_NAME_PARA_IS_NUMBERING_RESTART, UNO_NAME_PARA_STYLE_NAME,
-                   UNO_NAME_PARA_CONDITIONAL_STYLE_NAME, UNO_NAME_PAGE_STYLE_NAME,
-                   UNO_NAME_NUMBERING_START_VALUE, UNO_NAME_NUMBERING_IS_NUMBER,
-                   UNO_NAME_PARA_CONTINUEING_PREVIOUS_SUB_TREE, UNO_NAME_CHAR_STYLE_NAME,
-                   UNO_NAME_NUMBERING_LEVEL });
+    const std::vector<OUString> aHiddenProperties{ UNO_NAME_RSID,
+                                                   UNO_NAME_PARA_IS_NUMBERING_RESTART,
+                                                   UNO_NAME_PARA_STYLE_NAME,
+                                                   UNO_NAME_PARA_CONDITIONAL_STYLE_NAME,
+                                                   UNO_NAME_PAGE_STYLE_NAME,
+                                                   UNO_NAME_NUMBERING_START_VALUE,
+                                                   UNO_NAME_NUMBERING_IS_NUMBER,
+                                                   UNO_NAME_PARA_CONTINUEING_PREVIOUS_SUB_TREE,
+                                                   UNO_NAME_CHAR_STYLE_NAME,
+                                                   UNO_NAME_NUMBERING_LEVEL,
+                                                   UNO_NAME_PARRSID };
+
+    InsertValues(xRange, aIsDefined, aDFNode, false, aHiddenProperties);
 
     uno::Reference<style::XStyleFamiliesSupplier> xStyleFamiliesSupplier(pDocSh->GetBaseModel(),
                                                                          uno::UNO_QUERY);
@@ -469,6 +479,13 @@ static void UpdateTree(SwDocShell* pDocSh, std::vector<svx::sidebar::TreeNode>&
         aCharNode.children.push_back(aCurrentChild);
     }
 
+    // Collect paragraph direct formatting
+    uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xRange, uno::UNO_QUERY_THROW);
+    uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
+    uno::Reference<text::XTextRange> xThisParagraphRange(xParaEnum->nextElement(),
+                                                         uno::UNO_QUERY_THROW);
+    InsertValues(xThisParagraphRange, aIsDefined, aParaDFNode, false, aHiddenProperties);
+
     xStyleFamily.set(xStyleFamilies->getByName("ParagraphStyles"), uno::UNO_QUERY_THROW);
 
     while (!sCurrentParaStyle.isEmpty())
@@ -494,10 +511,12 @@ static void UpdateTree(SwDocShell* pDocSh, std::vector<svx::sidebar::TreeNode>&
     /*
     Display Order :-
     PARAGRAPH STYLE
+    PARAGRAPH DIRECT FORMATTING
     CHARACTER STYLE
     DIRECT FORMATTING
     */
     aStore.push_back(aParaNode);
+    aStore.push_back(aParaDFNode);
     aStore.push_back(aCharNode);
     aStore.push_back(aDFNode);
 }


More information about the Libreoffice-commits mailing list