Blob Blame History Raw
From 28d59a1a48d633f438e344f247362af0858d8911 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zolnai=20Tam=C3=A1s?= <tamas.zolnai@collabora.com>
Date: Fri, 3 Jan 2014 11:38:05 +0100
Subject: [PATCH 100/109] cp#2013101510000026: wrong highlight of commented
 text range imported from doc

When makeFieldBookmark() method is called with
ODF_COMMENTRANGE it will ignore the added field name and
generate an own one. We have to set the name of the
SwPostItField to this generated name so these two names will match.

Note: lTagBkmk is only an identifier but not the exported name
of the fieldmark so we don't need to stick to use it as
a name.

(cherry picked from commit 12e287220ebaf3a8f5eaf7bf526dce2c47f45a20)

Conflicts:
	sw/source/filter/ww8/ww8par.cxx

(cherry picked from commit d6fc6624e1319257945f49388d635c36685108d5)

Change-Id: I499abdcce1be0563c308bcf9f5c0a959a07f858b
---
 sw/qa/extras/ww8import/ww8import.cxx | 1 -
 sw/source/filter/ww8/ww8par.cxx      | 7 +++----
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/sw/qa/extras/ww8import/ww8import.cxx b/sw/qa/extras/ww8import/ww8import.cxx
index ef68da6..50ef934 100644
--- a/sw/qa/extras/ww8import/ww8import.cxx
+++ b/sw/qa/extras/ww8import/ww8import.cxx
@@ -242,7 +242,6 @@ void Test::testFdo59530()
     uno::Reference<container::XEnumerationAccess> xFieldsAccess(xTextFieldsSupplier->getTextFields());
     uno::Reference<container::XEnumeration> xFields(xFieldsAccess->createEnumeration());
     xPropertySet.set(xFields->nextElement(), uno::UNO_QUERY);
-    CPPUNIT_ASSERT_EQUAL(OUString("346376201"), getProperty<OUString>(xPropertySet, "Name"));
     CPPUNIT_ASSERT_EQUAL(OUString("M"), getProperty<OUString>(xPropertySet, "Initials"));
 }
 
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index b34b966..56040b7 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -1790,7 +1790,6 @@ long SwWW8ImplReader::Read_And(WW8PLCFManResult* pRes)
 
     String sAuthor;
     String sInitials;
-    String sName;
     if( bVer67 )
     {
         const WW67_ATRD* pDescri = (const WW67_ATRD*)pSD->GetData();
@@ -1820,7 +1819,6 @@ long SwWW8ImplReader::Read_And(WW8PLCFManResult* pRes)
         sal_uInt32 nTagBkmk = SVBT32ToUInt32(pDescri->ITagBkmk);
         if (nTagBkmk != 0xFFFFFFFF)
         {
-            sName = OUString::valueOf(sal_Int32(nTagBkmk));
             int nAtnIndex = GetAnnotationIndex(nTagBkmk);
             if (nAtnIndex != -1)
             {
@@ -1855,14 +1853,15 @@ long SwWW8ImplReader::Read_And(WW8PLCFManResult* pRes)
     this->pFmtOfJustInsertedApo = 0;
     SwPostItField aPostIt(
         (SwPostItFieldType*)rDoc.GetSysFldType(RES_POSTITFLD), sAuthor,
-        sTxt, sInitials, sName, aDate );
+        sTxt, sInitials, String(), aDate );
     aPostIt.SetTextObject(pOutliner);
 
     // If this is a range, create the associated fieldmark.
     if (pPaM->HasMark())
     {
         IDocumentMarkAccess* pMarksAccess = rDoc.getIDocumentMarkAccess();
-        pMarksAccess->makeFieldBookmark(*pPaM, aPostIt.GetName(), ODF_COMMENTRANGE);
+        sw::mark::IFieldmark* pFieldmark = pMarksAccess->makeFieldBookmark(*pPaM, OUString(), ODF_COMMENTRANGE);
+        aPostIt.SetName(pFieldmark->GetName());
         pPaM->Exchange();
         pPaM->DeleteMark();
     }
-- 
1.8.4.2