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

Jim Raykowski raykowj at gmail.com
Tue Sep 26 11:56:31 UTC 2017


 svtools/source/contnr/treelistbox.cxx |    2 +
 sw/inc/strings.hrc                    |    3 +
 sw/source/core/edit/edfcol.cxx        |   65 ++++++++++++++--------------------
 3 files changed, 31 insertions(+), 39 deletions(-)

New commits:
commit 0b4bf5840e15e56cf5ebcda06fe567cd8ca0034c
Author: Jim Raykowski <raykowj at gmail.com>
Date:   Sat Sep 16 00:18:56 2017 -0800

    tdf#49634 Fix positioning of focus rectangle in Navigator content tree
    
    https://bugs.documentfoundation.org/show_bug.cgi?id=49634
    
    Change-Id: I3beb41142281b2cda337b457ed287a2cc1f665a6
    Reviewed-on: https://gerrit.libreoffice.org/42364
    Tested-by: Michael Meeks <michael.meeks at collabora.com>
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/svtools/source/contnr/treelistbox.cxx b/svtools/source/contnr/treelistbox.cxx
index 4c2b8806e47c..1264a1a9f745 100644
--- a/svtools/source/contnr/treelistbox.cxx
+++ b/svtools/source/contnr/treelistbox.cxx
@@ -2953,6 +2953,8 @@ void SvTreeListBox::PreparePaint(vcl::RenderContext& /*rRenderContext*/, SvTreeL
 
 tools::Rectangle SvTreeListBox::GetFocusRect( SvTreeListEntry* pEntry, long nLine )
 {
+    pImpl->UpdateContextBmpWidthMax( pEntry );
+
     Size aSize;
     tools::Rectangle aRect;
     aRect.Top() = nLine;
commit 54675b2a44c99d0956c899661bcad9813e6303f5
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Sat Sep 23 14:50:50 2017 -0400

    sw: refactor updating paragraph signature
    
    Change-Id: If86e4b1664f88c9e51ab4ac2d819f8726991fa98
    Reviewed-on: https://gerrit.libreoffice.org/42736
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/sw/inc/strings.hrc b/sw/inc/strings.hrc
index 915c0bab463b..75f64148a4e5 100644
--- a/sw/inc/strings.hrc
+++ b/sw/inc/strings.hrc
@@ -1340,8 +1340,9 @@
 /*--------------------------------------------------------------------
     Description: Paragraph Signature
  --------------------------------------------------------------------*/
-#define STR_VALID                               NC_("STR_VALID", "Valid")
+#define STR_VALID                               NC_("STR_VALID", " Valid ")
 #define STR_INVALID                             NC_("STR_INVALID", "Invalid")
+#define STR_INVALID_SIGNATURE                   NC_("STR_INVALID_SIGNATURE", "Invalid Signature")
 #define STR_SIGNED_BY                           NC_("STR_SIGNED_BY", "Signed-by")
 #define STR_PARAGRAPH_SIGNATURE                 NC_("STR_PARAGRAPH_SIGNATURE", "Paragraph Signature")
 
diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx
index 47bad4fe1e74..bf724e02c936 100644
--- a/sw/source/core/edit/edfcol.cxx
+++ b/sw/source/core/edit/edfcol.cxx
@@ -228,7 +228,7 @@ lcl_MakeParagraphSignatureFieldText(const uno::Reference<frame::XModel>& xModel,
 {
     static const OUString metaNS("urn:bails");
 
-    OUString msg = "Invalid Signature";
+    OUString msg = SwResId(STR_INVALID_SIGNATURE);
     bool valid = false;
 
     const css::uno::Reference<css::rdf::XResource> xSubject(xField, uno::UNO_QUERY);
@@ -258,6 +258,30 @@ lcl_MakeParagraphSignatureFieldText(const uno::Reference<frame::XModel>& xModel,
     return std::make_pair(valid, msg);
 }
 
+/// Creates and inserts Paragraph Signature Metadata field and creates the RDF entry
+uno::Reference<text::XTextField> lcl_InsertParagraphSignature(const uno::Reference<frame::XModel>& xModel,
+                                                              const uno::Reference<text::XTextContent>& xParent,
+                                                              const OUString& signature)
+{
+    static const OUString MetaFilename("bails.rdf");
+    static const OUString MetaNS("urn:bails");
+    static const OUString RDFName = "loext:signature:signature";
+    static const OUString ServiceName = "com.sun.star.text.textfield.MetadataField";
+
+    uno::Reference<lang::XMultiServiceFactory> xMultiServiceFactory(xModel, uno::UNO_QUERY);
+    auto xField = uno::Reference<text::XTextField>(xMultiServiceFactory->createInstance(ServiceName), uno::UNO_QUERY);
+
+    // Add the signature at the end.
+    // uno::Reference<text::XTextContent> xContent(xField, uno::UNO_QUERY);
+    // xContent->attach(xParent->getAnchor()->getEnd());
+    xField->attach(xParent->getAnchor()->getEnd());
+
+    const css::uno::Reference<css::rdf::XResource> xSubject(xField, uno::UNO_QUERY);
+    SwRDFHelper::addStatement(xModel, MetaNS, MetaFilename, xSubject, RDFName, signature);
+
+    return xField;
+}
+
 /// Updates the signature field text if changed and returns true only iff updated.
 bool lcl_UpdateParagraphSignatureField(SwDoc* pDoc,
                                        const uno::Reference<frame::XModel>& xModel,
@@ -276,7 +300,7 @@ bool lcl_UpdateParagraphSignatureField(SwDoc* pDoc,
     const OUString curText = xText->getString();
     if (curText != res.second)
     {
-        xText->setString(res.second);
+        xText->setString(res.second + " ");
         return true;
     }
 
@@ -977,30 +1001,6 @@ void SwUndoParagraphSigning::RepeatImpl(::sw::RepeatContext&)
 {
 }
 
-/// Creates and inserts Paragraph Signature Metadata field and creates the RDF entry
-uno::Reference<text::XTextField> lcl_InsertParagraphSignature(const uno::Reference<frame::XModel>& xModel,
-                                                              const uno::Reference<text::XTextContent>& xParent,
-                                                              const OUString& signature)
-{
-    static const OUString MetaFilename("bails.rdf");
-    static const OUString MetaNS("urn:bails");
-    static const OUString RDFName = "loext:signature:signature";
-    static const OUString ServiceName = "com.sun.star.text.textfield.MetadataField";
-
-    uno::Reference<lang::XMultiServiceFactory> xMultiServiceFactory(xModel, uno::UNO_QUERY);
-    auto xField = uno::Reference<text::XTextField>(xMultiServiceFactory->createInstance(ServiceName), uno::UNO_QUERY);
-
-    // Add the signature at the end.
-    // uno::Reference<text::XTextContent> xContent(xField, uno::UNO_QUERY);
-    // xContent->attach(xParent->getAnchor()->getEnd());
-    xField->attach(xParent->getAnchor()->getEnd());
-
-    const css::uno::Reference<css::rdf::XResource> xSubject(xField, uno::UNO_QUERY);
-    SwRDFHelper::addStatement(xModel, MetaNS, MetaFilename, xSubject, RDFName, signature);
-
-    return xField;
-}
-
 void SwUndoParagraphSigning::Insert()
 {
     // Disable undo to avoid introducing noise when we edit the metadata field.
@@ -1092,18 +1092,7 @@ void SwEditShell::SignParagraph(SwPaM* pPaM)
     const uno::Reference<frame::XModel> xModel = pDocShell->GetBaseModel();
     uno::Reference<css::text::XTextField> xField = lcl_InsertParagraphSignature(xModel, xParent, signature);
 
-    {
-        // Disable undo to avoid introducing noise when we edit the metadata field.
-        const bool isUndoEnabled = GetDoc()->GetIDocumentUndoRedo().DoesUndo();
-        GetDoc()->GetIDocumentUndoRedo().DoUndo(false);
-        comphelper::ScopeGuard const g2([&] () {
-                GetDoc()->GetIDocumentUndoRedo().DoUndo(isUndoEnabled);
-             });
-
-        const std::pair<bool, OUString> res = lcl_MakeParagraphSignatureFieldText(xModel, xField, utf8Text);
-        uno::Reference<css::text::XTextRange> xText(xField, uno::UNO_QUERY);
-        xText->setString(res.second + " ");
-    }
+    lcl_UpdateParagraphSignatureField(GetDoc(), xModel, xField, utf8Text);
 
     SwUndoParagraphSigning* pUndo = new SwUndoParagraphSigning(SwPosition(*pNode), xField, xParent, true);
     GetDoc()->GetIDocumentUndoRedo().AppendUndo(pUndo);


More information about the Libreoffice-commits mailing list