[Libreoffice-commits] core.git: 2 commits - editeng/source include/editeng sw/qa sw/source writerfilter/source

Miklos Vajna vmiklos at collabora.co.uk
Mon Dec 8 00:18:21 PST 2014


 editeng/source/items/textitem.cxx                 |    8 ++++++++
 include/editeng/wghtitem.hxx                      |    2 ++
 sw/qa/extras/rtfimport/data/fdo86750.rtf          |    4 ++++
 sw/qa/extras/rtfimport/rtfimport.cxx              |    6 ++++++
 sw/source/core/docnode/nodedump.cxx               |    9 ++++++---
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |    9 +++++++++
 6 files changed, 35 insertions(+), 3 deletions(-)

New commits:
commit 4517c94000153eab6c034ea548698953dd93f794
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon Dec 8 09:16:22 2014 +0100

    fdo#86750 RTF import: fix table of contents links
    
    Change-Id: I0f3d35a0e64c9ce5646fa63eda317bee42de5540

diff --git a/sw/qa/extras/rtfimport/data/fdo86750.rtf b/sw/qa/extras/rtfimport/data/fdo86750.rtf
new file mode 100644
index 0000000..29f0b84
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/fdo86750.rtf
@@ -0,0 +1,4 @@
+{\rtf1
+{\field{\*\fldinst { HYPERLINK \\l "anchor" }}{\fldrslt click}}\par
+{\*\bkmkstart anchor}target{\*\bkmkend anchor}\par
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index e0b5100..0829057 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -2213,6 +2213,12 @@ DECLARE_RTFIMPORT_TEST(testFdo72031, "fdo72031.rtf")
     CPPUNIT_ASSERT_EQUAL(aExpected, getRun(getParagraph(1), 1)->getString());
 }
 
+DECLARE_RTFIMPORT_TEST(testFdo86750, "fdo86750.rtf")
+{
+    // This was 'HYPERLINK#anchor', the URL of the hyperlink had the field type as a prefix, leading to broken links.
+    CPPUNIT_ASSERT_EQUAL(OUString("#anchor"), getProperty<OUString>(getRun(getParagraph(1), 1), "HyperLinkURL"));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index ac7af0d..7176485 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -3656,6 +3656,15 @@ void DomainMapper_Impl::CloseFieldCommand()
                     case FIELD_HYPERLINK:
                     {
                         ::std::vector<OUString> aParts = pContext->GetCommandParts();
+
+                        // Syntax is either:
+                        // HYPERLINK "" \l "link"
+                        // or
+                        // HYPERLINK \l "link"
+                        // Make sure "HYPERLINK" doesn't end up as part of link in the second case.
+                        if (!aParts.empty() && aParts[0] == "HYPERLINK")
+                            aParts.erase(aParts.begin());
+
                         ::std::vector<OUString>::const_iterator aItEnd = aParts.end();
                         ::std::vector<OUString>::const_iterator aPartIt = aParts.begin();
 
commit 193c7ba9be48f00b46f9e789f233db577e7b3303
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon Dec 8 09:15:41 2014 +0100

    Factor out SvxWeightItem::dumpAsXml() from sw
    
    Change-Id: I97ccc04190b1f75c54e725e0612724a2ef62fe3e

diff --git a/editeng/source/items/textitem.cxx b/editeng/source/items/textitem.cxx
index 5ccc7c7..6ccbf9b 100644
--- a/editeng/source/items/textitem.cxx
+++ b/editeng/source/items/textitem.cxx
@@ -722,6 +722,14 @@ bool SvxWeightItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
     return true;
 }
 
+void SvxWeightItem::dumpAsXml(xmlTextWriterPtr pWriter) const
+{
+    xmlTextWriterStartElement(pWriter, BAD_CAST("svxWeightItem"));
+    xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("whichId"), "%d", Which());
+    xmlTextWriterWriteAttribute(pWriter, BAD_CAST("presentation"), BAD_CAST(GetValueTextByPos(GetValue()).toUtf8().getStr()));
+    xmlTextWriterEndElement(pWriter);
+}
+
 // class SvxFontHeightItem -----------------------------------------------
 
 SvxFontHeightItem::SvxFontHeightItem( const sal_uLong nSz,
diff --git a/include/editeng/wghtitem.hxx b/include/editeng/wghtitem.hxx
index 7ecca57..4f0c795 100644
--- a/include/editeng/wghtitem.hxx
+++ b/include/editeng/wghtitem.hxx
@@ -69,6 +69,8 @@ public:
                                 { return (FontWeight)GetValue(); }
     void                    SetWeight( FontWeight eNew )
                                 { SetValue( (sal_uInt16)eNew ); }
+
+    void dumpAsXml(struct _xmlTextWriter* pWriter) const;
 };
 
 #endif // INCLUDED_EDITENG_WGHTITEM_HXX
diff --git a/sw/source/core/docnode/nodedump.cxx b/sw/source/core/docnode/nodedump.cxx
index f0be0e2..ab35ecb 100644
--- a/sw/source/core/docnode/nodedump.cxx
+++ b/sw/source/core/docnode/nodedump.cxx
@@ -46,6 +46,7 @@
 #include <editeng/editobj.hxx>
 #include <editeng/outlobj.hxx>
 #include <editeng/postitem.hxx>
+#include <editeng/wghtitem.hxx>
 #include <svx/xdef.hxx>
 #include <svx/svdpage.hxx>
 #include <svx/svdmodel.hxx>
@@ -395,6 +396,11 @@ void lcl_dumpSfxItemSet(WriterHelper& writer, const SfxItemSet* pSet)
             case RES_CHRATR_CTL_POSTURE:
                 static_cast<const SvxPostureItem*>(pItem)->dumpAsXml(writer);
                 break;
+            case RES_CHRATR_WEIGHT:
+            case RES_CHRATR_CJK_WEIGHT:
+            case RES_CHRATR_CTL_WEIGHT:
+                static_cast<const SvxWeightItem*>(pItem)->dumpAsXml(writer);
+                break;
             default: bDone = false; break;
         }
         if (bDone)
@@ -409,9 +415,6 @@ void lcl_dumpSfxItemSet(WriterHelper& writer, const SfxItemSet* pSet)
         boost::optional<OString> oValue;
         switch (pItem->Which())
         {
-            case RES_CHRATR_WEIGHT: pWhich = "character weight"; break;
-            case RES_CHRATR_CJK_WEIGHT: pWhich = "character cjk weight"; break;
-            case RES_CHRATR_CTL_WEIGHT: pWhich = "character ctl weight"; break;
             case RES_CHRATR_RSID:
             {
                 pWhich = "character rsid";


More information about the Libreoffice-commits mailing list