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

Miklos Vajna vmiklos at collabora.co.uk
Wed Jul 29 00:17:27 PDT 2015


 sw/qa/extras/uiwriter/data/tdf89954.odt            |binary
 sw/qa/extras/uiwriter/uiwriter.cxx                 |   22 +++++++++++++++++++++
 sw/source/core/txtnode/thints.cxx                  |    2 -
 writerfilter/source/dmapper/GraphicImport.hxx      |    4 +--
 writerfilter/source/dmapper/StyleSheetTable.cxx    |    1 
 writerfilter/source/dmapper/StyleSheetTable.hxx    |    5 ++--
 writerfilter/source/dmapper/TextEffectsHandler.hxx |    4 +--
 7 files changed, 30 insertions(+), 8 deletions(-)

New commits:
commit e1953f22097d6f895fe27ea21635c37d3cb48f51
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Wed Jul 29 09:15:59 2015 +0200

    writerfilter: clean up remaining boost::scoped_ptr<> usage
    
    Change-Id: I270c91bec75ff96ac77b550e6adef8d03b07f2b5

diff --git a/writerfilter/source/dmapper/GraphicImport.hxx b/writerfilter/source/dmapper/GraphicImport.hxx
index 6a10ddb..736a580 100644
--- a/writerfilter/source/dmapper/GraphicImport.hxx
+++ b/writerfilter/source/dmapper/GraphicImport.hxx
@@ -20,7 +20,7 @@
 #define INCLUDED_WRITERFILTER_SOURCE_DMAPPER_GRAPHICIMPORT_HXX
 
 #include <queue>
-#include <boost/scoped_ptr.hpp>
+#include <memory>
 
 #include "LoggedResources.hxx"
 
@@ -64,7 +64,7 @@ enum GraphicImportType
 class GraphicImport : public LoggedProperties, public LoggedTable
                     ,public BinaryObj, public LoggedStream
 {
-    boost::scoped_ptr<GraphicImport_Impl> m_pImpl;
+    std::unique_ptr<GraphicImport_Impl> m_pImpl;
 
     css::uno::Reference<css::uno::XComponentContext>     m_xComponentContext;
     css::uno::Reference<css::lang::XMultiServiceFactory> m_xTextFactory;
diff --git a/writerfilter/source/dmapper/TextEffectsHandler.hxx b/writerfilter/source/dmapper/TextEffectsHandler.hxx
index 02bd9a9..cce0872 100644
--- a/writerfilter/source/dmapper/TextEffectsHandler.hxx
+++ b/writerfilter/source/dmapper/TextEffectsHandler.hxx
@@ -21,7 +21,7 @@
 
 #include <oox/helper/grabbagstack.hxx>
 
-#include <boost/scoped_ptr.hpp>
+#include <memory>
 #include <boost/optional.hpp>
 
 namespace writerfilter {
@@ -34,7 +34,7 @@ class TextEffectsHandler : public LoggedProperties
 private:
     boost::optional<PropertyIds>         maPropertyId;
     OUString                             maElementName;
-    boost::scoped_ptr<oox::GrabBagStack> mpGrabBagStack;
+    std::unique_ptr<oox::GrabBagStack> mpGrabBagStack;
 
     void convertElementIdToPropertyId(sal_Int32 aElementId);
 
commit 7b1c5b297746e1fbc7d8b728e888478a260c52e4
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Wed Jul 29 09:10:44 2015 +0200

    writerfilter: use std::unique_ptr<> in StyleSheetTable
    
    Change-Id: I38eebe098c87cceb69b9ff4c48e18d3434ad1557

diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx b/writerfilter/source/dmapper/StyleSheetTable.cxx
index 826172b..cdc0e59 100644
--- a/writerfilter/source/dmapper/StyleSheetTable.cxx
+++ b/writerfilter/source/dmapper/StyleSheetTable.cxx
@@ -390,7 +390,6 @@ StyleSheetTable::StyleSheetTable(DomainMapper& rDMapper,
 
 StyleSheetTable::~StyleSheetTable()
 {
-    delete m_pImpl;
 }
 
 PropertyMapPtr StyleSheetTable::GetDefaultCharProps()
diff --git a/writerfilter/source/dmapper/StyleSheetTable.hxx b/writerfilter/source/dmapper/StyleSheetTable.hxx
index 44d33ea..ba05630 100644
--- a/writerfilter/source/dmapper/StyleSheetTable.hxx
+++ b/writerfilter/source/dmapper/StyleSheetTable.hxx
@@ -19,6 +19,7 @@
 #ifndef INCLUDED_WRITERFILTER_SOURCE_DMAPPER_STYLESHEETTABLE_HXX
 #define INCLUDED_WRITERFILTER_SOURCE_DMAPPER_STYLESHEETTABLE_HXX
 
+#include <memory>
 #include "TblStylePrHandler.hxx"
 
 #include <DomainMapper.hxx>
@@ -77,7 +78,7 @@ public:
 };
 
 typedef std::shared_ptr<StyleSheetEntry> StyleSheetEntryPtr;
-typedef ::std::deque<StyleSheetEntryPtr> StyleSheetEntryDeque;
+typedef std::deque<StyleSheetEntryPtr> StyleSheetEntryDeque;
 typedef std::shared_ptr<StyleSheetEntryDeque> StyleSheetEntryDequePtr;
 
 class DomainMapper;
@@ -85,7 +86,7 @@ class StyleSheetTable :
         public LoggedProperties,
         public LoggedTable
 {
-    StyleSheetTable_Impl   *m_pImpl;
+    std::unique_ptr<StyleSheetTable_Impl> m_pImpl;
 
 public:
     StyleSheetTable(DomainMapper& rDMapper, css::uno::Reference<css::text::XTextDocument> const& xTextDocument, bool bIsNewDoc);
commit 89d615360e80a13fff6bc69885e5780d8fedf149
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Wed Jul 29 09:08:00 2015 +0200

    tdf#89954 sw: let annotation have CH_TXTATR_INWORD placeholder again
    
    Regression from commit 0761f81643a6890457e9ef7d913ab5c88c2593a4 (123792:
    complete annotations on text ranges feature, 2013-12-19), the problem
    was that while sw wanted CH_TXTATR_INWORD as a placeholder character for
    anchor positions that do not count as a word boundary, the commit
    changed GetCharOfTextAttr() so that annotations have CH_TXTATR_BREAKWORD
    as the placeholder.
    
    Fix the problem by reverting the last hunk of
    sw/source/core/txtnode/thints.cxx changes in that commit.
    
    Change-Id: Ia8c97efda9c1e90ae3c27ddb8247e3f3203a63fb

diff --git a/sw/qa/extras/uiwriter/data/tdf89954.odt b/sw/qa/extras/uiwriter/data/tdf89954.odt
new file mode 100644
index 0000000..538d978
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf89954.odt differ
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index ebac88b..8c06b0d 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -68,6 +68,7 @@
 #include "com/sun/star/text/TextMarkupType.hpp"
 #include <osl/file.hxx>
 #include <comphelper/propertysequence.hxx>
+#include <LibreOfficeKit/LibreOfficeKitEnums.h>
 
 static const char* DATA_DIRECTORY = "/sw/qa/extras/uiwriter/data/";
 
@@ -136,6 +137,7 @@ public:
     void testTextTableCellNames();
     void testShapeAnchorUndo();
     void testDde();
+    void testTdf89954();
 
     CPPUNIT_TEST_SUITE(SwUiWriterTest);
     CPPUNIT_TEST(testReplaceForward);
@@ -197,6 +199,7 @@ public:
     CPPUNIT_TEST(testTextTableCellNames);
     CPPUNIT_TEST(testShapeAnchorUndo);
     CPPUNIT_TEST(testDde);
+    CPPUNIT_TEST(testTdf89954);
     CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -2041,6 +2044,25 @@ void SwUiWriterTest::testDde()
     CPPUNIT_ASSERT(xField->getString().endsWith("asdf"));
 }
 
+void SwUiWriterTest::testTdf89954()
+{
+    SwDoc* pDoc = createDoc("tdf89954.odt");
+    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    pWrtShell->EndPara();
+    SwXTextDocument* pXTextDocument = dynamic_cast<SwXTextDocument *>(mxComponent.get());
+    pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 't', 0);
+    pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 'e', 0);
+    pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 's', 0);
+    pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 't', 0);
+    pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, '.', 0);
+
+    SwNodeIndex aNodeIndex(pDoc->GetNodes().GetEndOfContent(), -1);
+    // Placeholder character for the comment anchor was ^A (CH_TXTATR_BREAKWORD), not <fff9> (CH_TXTATR_INWORD).
+    // As a result, autocorrect did not turn the 't' input into 'T'.
+    OUString aExpected("Tes\xef\xbf\xb9t. Test.", 14, RTL_TEXTENCODING_UTF8);
+    CPPUNIT_ASSERT_EQUAL(aExpected, aNodeIndex.GetNode().GetTextNode()->GetText());
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest);
 CPPUNIT_PLUGIN_IMPLEMENT();
 
diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx
index 2b8c0f5..59205c2 100644
--- a/sw/source/core/txtnode/thints.cxx
+++ b/sw/source/core/txtnode/thints.cxx
@@ -3446,6 +3446,7 @@ sal_Unicode GetCharOfTextAttr( const SwTextAttr& rAttr )
     {
         case RES_TXTATR_REFMARK:
         case RES_TXTATR_TOXMARK:
+        case RES_TXTATR_ANNOTATION:
             cRet = CH_TXTATR_INWORD;
         break;
 
@@ -3454,7 +3455,6 @@ sal_Unicode GetCharOfTextAttr( const SwTextAttr& rAttr )
         case RES_TXTATR_FTN:
         case RES_TXTATR_META:
         case RES_TXTATR_METAFIELD:
-        case RES_TXTATR_ANNOTATION:
         {
             cRet = CH_TXTATR_BREAKWORD;
         }


More information about the Libreoffice-commits mailing list