From 12e287220ebaf3a8f5eaf7bf526dce2c47f45a20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolnai=20Tam=C3=A1s?= Date: Fri, 3 Jan 2014 11:38:05 +0100 Subject: [PATCH] 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. 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 f7c5b6d2a23f..6b6ae44c90f9 100644 --- a/sw/qa/extras/ww8import/ww8import.cxx +++ b/sw/qa/extras/ww8import/ww8import.cxx @@ -194,7 +194,6 @@ DECLARE_WW8IMPORT_TEST(testFdo59530, "fdo59530.doc") uno::Reference xFieldsAccess(xTextFieldsSupplier->getTextFields()); uno::Reference xFields(xFieldsAccess->createEnumeration()); xPropertySet.set(xFields->nextElement(), uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(OUString("346376201"), getProperty(xPropertySet, "Name")); CPPUNIT_ASSERT_EQUAL(OUString("M"), getProperty(xPropertySet, "Initials")); } diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index ce10d21dfe84..1eba247c59e3 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -2124,7 +2124,6 @@ long SwWW8ImplReader::Read_And(WW8PLCFManResult* pRes) OUString sAuthor; OUString sInitials; - OUString sName; if( bVer67 ) { const WW67_ATRD* pDescri = (const WW67_ATRD*)pSD->GetData(); @@ -2157,7 +2156,6 @@ long SwWW8ImplReader::Read_And(WW8PLCFManResult* pRes) sal_uInt32 nTagBkmk = SVBT32ToUInt32(pDescri->ITagBkmk); if (nTagBkmk != 0xFFFFFFFF) { - sName = OUString::number(nTagBkmk); int nAtnIndex = GetAnnotationIndex(nTagBkmk); if (nAtnIndex != -1) { @@ -2192,14 +2190,15 @@ long SwWW8ImplReader::Read_And(WW8PLCFManResult* pRes) this->pFmtOfJustInsertedApo = 0; SwPostItField aPostIt( (SwPostItFieldType*)rDoc.GetSysFldType(RES_POSTITFLD), sAuthor, - sTxt, sInitials, sName, aDate ); + sTxt, sInitials, OUString(), 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(); }