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

Shivam Kumar Singh (via logerrit) logerrit at kemper.freedesktop.org
Thu Jul 16 10:13:27 UTC 2020


 include/svx/sidebar/InspectorTextPanel.hxx            |    2 
 svx/source/sidebar/inspector/InspectorTextPanel.cxx   |   36 +++----
 sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx |   82 ++++++++----------
 sw/source/uibase/sidebar/WriterInspectorTextPanel.hxx |    4 
 4 files changed, 56 insertions(+), 68 deletions(-)

New commits:
commit 51ccfd3b39d1d32052e8d51ab9ba7324ccd843f5
Author:     Shivam Kumar Singh <shivamhere247 at gmail.com>
AuthorDate: Fri Jul 3 00:36:12 2020 +0530
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Thu Jul 16 12:12:50 2020 +0200

    Cleanup: Fix variable names for Inspector
    
    Fixing of variable names following LO naming conventions
    and some other minor fixes.
    
    Change-Id: Iad58584ecc07a02287193a615c428819363ed0c9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97810
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
    Tested-by: Jenkins

diff --git a/include/svx/sidebar/InspectorTextPanel.hxx b/include/svx/sidebar/InspectorTextPanel.hxx
index 77240cd5a671..e2c479950eac 100644
--- a/include/svx/sidebar/InspectorTextPanel.hxx
+++ b/include/svx/sidebar/InspectorTextPanel.hxx
@@ -45,7 +45,7 @@ public:
     void updateEntries(const std::vector<TreeNode>& rStore);
 
 private:
-    std::unique_ptr<weld::TreeView> mxListBoxStyles;
+    std::unique_ptr<weld::TreeView> mpListBoxStyles;
 };
 }
 } // end of namespace svx::sidebar
diff --git a/svx/source/sidebar/inspector/InspectorTextPanel.cxx b/svx/source/sidebar/inspector/InspectorTextPanel.cxx
index 1b0ea48a55c3..6157f2bc67fb 100644
--- a/svx/source/sidebar/inspector/InspectorTextPanel.cxx
+++ b/svx/source/sidebar/inspector/InspectorTextPanel.cxx
@@ -42,52 +42,50 @@ InspectorTextPanel::Create(vcl::Window* pParent,
 InspectorTextPanel::InspectorTextPanel(vcl::Window* pParent,
                                        const css::uno::Reference<css::frame::XFrame>& rxFrame)
     : PanelLayout(pParent, "InspectorTextPanel", "svx/ui/inspectortextpanel.ui", rxFrame)
-    , mxListBoxStyles(m_xBuilder->weld_tree_view("listbox_fonts"))
+    , mpListBoxStyles(m_xBuilder->weld_tree_view("listbox_fonts"))
 {
-    mxListBoxStyles->set_size_request(-1, mxListBoxStyles->get_height_rows(25));
+    mpListBoxStyles->set_size_request(-1, mpListBoxStyles->get_height_rows(25));
 }
 
-static void FillBox_Impl(weld::TreeView& rListBoxStyles, const TreeNode& current,
+static void FillBox_Impl(weld::TreeView& rListBoxStyles, const TreeNode& rCurrent,
                          weld::TreeIter* pParent)
 {
     std::unique_ptr<weld::TreeIter> pResult = rListBoxStyles.make_iterator();
-    const OUString& rName = current.sNodeName;
+    const OUString& rName = rCurrent.sNodeName;
     rListBoxStyles.insert(pParent, -1, &rName, nullptr, nullptr, nullptr, false, pResult.get());
 
-    for (const TreeNode& ChildNode : current.children)
-        FillBox_Impl(rListBoxStyles, ChildNode, pResult.get());
+    for (const TreeNode& rChildNode : rCurrent.children)
+        FillBox_Impl(rListBoxStyles, rChildNode, pResult.get());
 }
 
 void InspectorTextPanel::updateEntries(const std::vector<TreeNode>& rStore)
 {
-    mxListBoxStyles->freeze();
-    mxListBoxStyles->clear();
-    for (const TreeNode& ChildNode : rStore)
+    mpListBoxStyles->freeze();
+    mpListBoxStyles->clear();
+    for (const TreeNode& rChildNode : rStore)
     {
-        FillBox_Impl(*mxListBoxStyles, ChildNode, nullptr);
+        FillBox_Impl(*mpListBoxStyles, rChildNode, nullptr);
     }
 
-    mxListBoxStyles->thaw();
+    mpListBoxStyles->thaw();
 
-    weld::TreeView* pTreeDiagram = mxListBoxStyles.get();
+    weld::TreeView* pTreeDiagram = mpListBoxStyles.get();
     pTreeDiagram->all_foreach([pTreeDiagram](weld::TreeIter& rEntry) {
         pTreeDiagram->expand_row(rEntry);
         return false;
     });
 
-    std::unique_ptr<weld::TreeIter> xEntry = mxListBoxStyles->make_iterator();
-    if (!mxListBoxStyles->get_iter_first(*xEntry))
-        return;
-    if (!mxListBoxStyles->iter_next(*xEntry))
-        return;
-    mxListBoxStyles->collapse_row(*xEntry); // Collapse "Default Paragraph Style"
+    std::unique_ptr<weld::TreeIter> pEntry = mpListBoxStyles->make_iterator();
+    mpListBoxStyles->get_iter_first(*pEntry);
+    mpListBoxStyles->iter_next(*pEntry);
+    mpListBoxStyles->collapse_row(*pEntry); // Collapse "Default Paragraph Style"
 }
 
 InspectorTextPanel::~InspectorTextPanel() { disposeOnce(); }
 
 void InspectorTextPanel::dispose()
 {
-    mxListBoxStyles.reset();
+    mpListBoxStyles.reset();
 
     PanelLayout::dispose();
 }
diff --git a/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx b/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx
index da9f7eaa4709..30824925d935 100644
--- a/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx
+++ b/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx
@@ -18,7 +18,7 @@
  */
 
 #include "WriterInspectorTextPanel.hxx"
-#include <svx/svxids.hrc>
+
 #include <doc.hxx>
 #include <ndtxt.hxx>
 #include <docsh.hxx>
@@ -68,48 +68,42 @@ static bool GetPropertyValues(const beans::Property rProperty, const uno::Any& r
     if (SvtLanguageOptions().IsCTLFontEnabled() && rProperty.Name.indexOf("Complex") != -1)
         return false;
 
-    OUString aValue;
-    double fValue;
-    bool bValue;
-    short sValue;
-    long lValue;
-    awt::FontSlant iValue;
-
     rString = rProperty.Name + "     ";
 
-    if (rAny >>= bValue)
+    if (bool bValue; rAny >>= bValue)
     {
         rString += OUString::boolean(bValue);
     }
-    else if ((rAny >>= aValue) && !(aValue.isEmpty()))
+    else if (OUString aValue; (rAny >>= aValue) && !(aValue.isEmpty()))
     {
         rString += aValue;
     }
-    else if (rAny >>= iValue)
+    else if (awt::FontSlant eValue; rAny >>= eValue)
     {
-        rString += (iValue == awt::FontSlant_ITALIC) ? OUStringLiteral("italic")
+        rString += (eValue == awt::FontSlant_ITALIC) ? OUStringLiteral("italic")
                                                      : OUStringLiteral("normal");
     }
-    else if ((rAny >>= lValue) && lValue)
+    else if (long nValueLong; rAny >>= nValueLong)
     {
         if (rString.indexOf("Color") != -1)
-            rString += "0x" + OUString::number(lValue, 16);
+            rString += "0x" + OUString::number(nValueLong, 16);
         else
-            rString += OUString::number(lValue);
+            rString += OUString::number(nValueLong);
     }
-    else if ((rAny >>= fValue) && fValue)
+    else if (double fValue; rAny >>= fValue)
     {
         if (rString.indexOf("Weight") != -1)
             rString += (fValue > 100) ? OUStringLiteral("bold") : OUStringLiteral("normal");
         else
             rString += OUString::number((round(fValue * 100)) / 100.00);
     }
-    else if ((rAny >>= sValue) && sValue)
+    else if (short nValueShort; rAny >>= nValueShort)
     {
-        rString += OUString::number(sValue);
+        rString += OUString::number(nValueShort);
     }
     else
         return false;
+
     return true;
 }
 
@@ -117,13 +111,13 @@ static void UpdateTree(SwDocShell* pDocSh, std::vector<svx::sidebar::TreeNode>&
 {
     SwDoc* pDoc = pDocSh->GetDoc();
     SwPaM* pCursor = pDoc->GetEditShell()->GetCursor();
-    svx::sidebar::TreeNode pDFNode;
-    svx::sidebar::TreeNode pCharNode;
-    svx::sidebar::TreeNode pParaNode;
+    svx::sidebar::TreeNode aDFNode;
+    svx::sidebar::TreeNode aCharNode;
+    svx::sidebar::TreeNode aParaNode;
 
-    pDFNode.sNodeName = "Direct Formatting";
-    pCharNode.sNodeName = "Character Styles";
-    pParaNode.sNodeName = "Paragraph Styles";
+    aDFNode.sNodeName = "Direct Formatting";
+    aCharNode.sNodeName = "Character Styles";
+    aParaNode.sNodeName = "Paragraph Styles";
 
     uno::Reference<text::XTextRange> xRange(
         SwXTextRange::CreateXTextRange(*pDoc, *pCursor->GetPoint(), nullptr));
@@ -144,9 +138,9 @@ static void UpdateTree(SwDocShell* pDocSh, std::vector<svx::sidebar::TreeNode>&
             if (GetPropertyValues(rProperty, aAny, aPropertyValuePair))
             {
                 aIsDefined[rProperty.Name] = true;
-                svx::sidebar::TreeNode pTemp;
-                pTemp.sNodeName = aPropertyValuePair;
-                pDFNode.children.push_back(pTemp);
+                svx::sidebar::TreeNode aTemp;
+                aTemp.sNodeName = aPropertyValuePair;
+                aDFNode.children.push_back(aTemp);
             }
         }
     }
@@ -168,8 +162,8 @@ static void UpdateTree(SwDocShell* pDocSh, std::vector<svx::sidebar::TreeNode>&
         xPropertiesState.set(xPropertiesSet, css::uno::UNO_QUERY_THROW);
         xPropertiesSet->getPropertyValue("DisplayName") >>= sDisplayName;
         aProperties = xPropertiesSet->getPropertySetInfo()->getProperties();
-        svx::sidebar::TreeNode pCurrentChild;
-        pCurrentChild.sNodeName = sDisplayName;
+        svx::sidebar::TreeNode aCurrentChild;
+        aCurrentChild.sNodeName = sDisplayName;
 
         for (const beans::Property& rProperty : std::as_const(aProperties))
         {
@@ -184,14 +178,14 @@ static void UpdateTree(SwDocShell* pDocSh, std::vector<svx::sidebar::TreeNode>&
                         aPropertyValuePair = aPropertyValuePair + "  !!<GREY>!!";
                     else
                         aIsDefined[sPropName] = true;
-                    svx::sidebar::TreeNode pTemp;
-                    pTemp.sNodeName = aPropertyValuePair;
-                    pCurrentChild.children.push_back(pTemp);
+                    svx::sidebar::TreeNode aTemp;
+                    aTemp.sNodeName = aPropertyValuePair;
+                    aCurrentChild.children.push_back(aTemp);
                 }
             }
         }
 
-        pCharNode.children.push_back(pCurrentChild);
+        aCharNode.children.push_back(aCurrentChild);
     }
 
     xStyleFamily.set(xStyleFamilies->getByName("ParagraphStyles"), uno::UNO_QUERY_THROW);
@@ -205,8 +199,8 @@ static void UpdateTree(SwDocShell* pDocSh, std::vector<svx::sidebar::TreeNode>&
         xPropertiesSet->getPropertyValue("DisplayName") >>= sDisplayName;
         aProperties = xPropertiesSet->getPropertySetInfo()->getProperties();
         OUString aParentParaStyle = xPropertiesStyle->getParentStyle();
-        svx::sidebar::TreeNode pCurrentChild;
-        pCurrentChild.sNodeName = sDisplayName;
+        svx::sidebar::TreeNode aCurrentChild;
+        aCurrentChild.sNodeName = sDisplayName;
 
         for (const beans::Property& rProperty : std::as_const(aProperties))
         {
@@ -224,19 +218,19 @@ static void UpdateTree(SwDocShell* pDocSh, std::vector<svx::sidebar::TreeNode>&
                         aPropertyValuePair = aPropertyValuePair + "    !!<GREY>!! ";
                     else
                         aIsDefined[sPropName] = true;
-                    svx::sidebar::TreeNode pTemp;
-                    pTemp.sNodeName = aPropertyValuePair;
-                    pCurrentChild.children.push_back(pTemp);
+                    svx::sidebar::TreeNode aTemp;
+                    aTemp.sNodeName = aPropertyValuePair;
+                    aCurrentChild.children.push_back(aTemp);
                 }
             }
         }
 
-        pParaNode.children.push_back(pCurrentChild);
+        aParaNode.children.push_back(aCurrentChild);
         sCurrentParaStyle = aParentParaStyle;
     }
 
-    std::reverse(pParaNode.children.begin(),
-                 pParaNode.children.end()); // Parent style should be first then children
+    std::reverse(aParaNode.children.begin(),
+                 aParaNode.children.end()); // Parent style should be first then children
 
     /*
     Display Order :-
@@ -244,9 +238,9 @@ static void UpdateTree(SwDocShell* pDocSh, std::vector<svx::sidebar::TreeNode>&
     CHARACTER STYLE
     DEFAULT FORMATTING
     */
-    aStore.push_back(pParaNode);
-    aStore.push_back(pCharNode);
-    aStore.push_back(pDFNode);
+    aStore.push_back(aParaNode);
+    aStore.push_back(aCharNode);
+    aStore.push_back(aDFNode);
 }
 
 IMPL_LINK_NOARG(WriterInspectorTextPanel, AttrChangedNotify, LinkParamNone*, void)
diff --git a/sw/source/uibase/sidebar/WriterInspectorTextPanel.hxx b/sw/source/uibase/sidebar/WriterInspectorTextPanel.hxx
index 6f0c4e3fd6a9..e29c5fc14169 100644
--- a/sw/source/uibase/sidebar/WriterInspectorTextPanel.hxx
+++ b/sw/source/uibase/sidebar/WriterInspectorTextPanel.hxx
@@ -19,10 +19,6 @@
 #pragma once
 
 #include <sfx2/weldutils.hxx>
-#include <docsh.hxx>
-#include <unordered_map>
-
-#include <com/sun/star/beans/XPropertySet.hpp>
 #include <svx/sidebar/InspectorTextPanel.hxx>
 
 namespace sw


More information about the Libreoffice-commits mailing list