summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorZolnai Tamás <tamas.zolnai@collabora.com>2014-01-03 15:26:21 +0100
committerZolnai Tamás <tamas.zolnai@collabora.com>2014-01-03 19:58:58 +0100
commit17ce7f9deab2b302e5a123805e6970ceba2110ce (patch)
treefb6c1883259016849814d65b7960b59885ef45d4 /sw
parent2f7b405765b929e53cb24b98b9fe1dcc1ff5c798 (diff)
cp#2013101510000026: fix doc export of comments initials
It seems comments' authers were exported twice. Once istead of initials. (cherry picked from commit 0127e3dbabaf24c6c0d828e6d26357ff0b63c3fb) Change-Id: I082fb5caea99df013922e16c5d8d4ef29e866665
Diffstat (limited to 'sw')
-rw-r--r--sw/source/filter/ww8/wrtw8sty.cxx53
-rw-r--r--sw/source/filter/ww8/wrtww8.hxx1
2 files changed, 31 insertions, 23 deletions
diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx
index e131dab08a00..d1ee7d3c8026 100644
--- a/sw/source/filter/ww8/wrtw8sty.cxx
+++ b/sw/source/filter/ww8/wrtw8sty.cxx
@@ -2069,6 +2069,7 @@ WW8_Annotation::WW8_Annotation(const SwPostItField* pPostIt)
if (!mpRichText)
msSimpleText = pPostIt->GetTxt();
msOwner = pPostIt->GetPar1();
+ m_sInitials = pPostIt->GetInitials();
maDateTime = DateTime(pPostIt->GetDate(), pPostIt->GetTime());
}
@@ -2245,10 +2246,14 @@ bool WW8_WrPlcSubDoc::WriteGenericTxt( WW8Export& rWrt, sal_uInt8 nTTyp,
return ( rCount != 0 );
}
+static bool lcl_AuthorComp( const std::pair<OUString,OUString>& aFirst, const std::pair<OUString,OUString>& aSecond)
+{
+ return aFirst.first < aSecond.first;
+}
+
void WW8_WrPlcSubDoc::WriteGenericPlc( WW8Export& rWrt, sal_uInt8 nTTyp,
WW8_FC& rTxtStart, sal_Int32& rTxtCount, WW8_FC& rRefStart, sal_Int32& rRefCount ) const
{
- typedef ::std::vector<OUString>::iterator myiter;
sal_uLong nFcStart = rWrt.pTableStrm->Tell();
sal_uInt16 nLen = aCps.size();
@@ -2257,7 +2262,8 @@ void WW8_WrPlcSubDoc::WriteGenericPlc( WW8Export& rWrt, sal_uInt8 nTTyp,
OSL_ENSURE( aCps.size() + 2 == pTxtPos->Count(), "WritePlc: DeSync" );
- ::std::vector<OUString> aStrArr;
+ ::std::vector<std::pair<OUString,OUString> > aStrArr;
+ typedef ::std::vector<std::pair<OUString,OUString> >::iterator myiter;
WW8Fib& rFib = *rWrt.pFib; // n+1-te CP-Pos nach Handbuch
sal_uInt16 i;
bool bWriteCP = true;
@@ -2270,11 +2276,11 @@ void WW8_WrPlcSubDoc::WriteGenericPlc( WW8Export& rWrt, sal_uInt8 nTTyp,
for ( i = 0; i < nLen; ++i )
{
const WW8_Annotation& rAtn = *(const WW8_Annotation*)aCntnt[i];
- aStrArr.push_back(rAtn.msOwner);
+ aStrArr.push_back(std::pair<OUString,OUString>(rAtn.msOwner,rAtn.m_sInitials));
}
//sort and remove duplicates
- ::std::sort(aStrArr.begin(), aStrArr.end());
+ ::std::sort(aStrArr.begin(), aStrArr.end(),&lcl_AuthorComp);
myiter aIter = ::std::unique(aStrArr.begin(), aStrArr.end());
aStrArr.erase(aIter, aStrArr.end());
@@ -2282,9 +2288,9 @@ void WW8_WrPlcSubDoc::WriteGenericPlc( WW8Export& rWrt, sal_uInt8 nTTyp,
{
for ( i = 0; i < aStrArr.size(); ++i )
{
- const OUString& rStr = aStrArr[i];
- SwWW8Writer::WriteShort(*rWrt.pTableStrm, rStr.getLength());
- SwWW8Writer::WriteString16(*rWrt.pTableStrm, rStr,
+ const OUString& sAuthor = aStrArr[i].first;
+ SwWW8Writer::WriteShort(*rWrt.pTableStrm, sAuthor.getLength());
+ SwWW8Writer::WriteString16(*rWrt.pTableStrm, sAuthor,
false);
}
}
@@ -2292,9 +2298,9 @@ void WW8_WrPlcSubDoc::WriteGenericPlc( WW8Export& rWrt, sal_uInt8 nTTyp,
{
for ( i = 0; i < aStrArr.size(); ++i )
{
- const OUString& rStr = aStrArr[i];
- *rWrt.pTableStrm << (sal_uInt8)rStr.getLength();
- SwWW8Writer::WriteString8(*rWrt.pTableStrm, rStr, false,
+ const OUString& sAuthor = aStrArr[i].first;
+ *rWrt.pTableStrm << (sal_uInt8)sAuthor.getLength();
+ SwWW8Writer::WriteString8(*rWrt.pTableStrm, sAuthor, false,
RTL_TEXTENCODING_MS_1252);
}
}
@@ -2409,35 +2415,36 @@ void WW8_WrPlcSubDoc::WriteGenericPlc( WW8Export& rWrt, sal_uInt8 nTTyp,
//aStrArr is sorted
myiter aIter = ::std::lower_bound(aStrArr.begin(),
- aStrArr.end(), rAtn.msOwner);
- OSL_ENSURE(aIter != aStrArr.end() && *aIter == rAtn.msOwner,
+ aStrArr.end(), std::pair<OUString,OUString>(rAtn.msOwner,OUString()),
+ &lcl_AuthorComp);
+ OSL_ENSURE(aIter != aStrArr.end() && aIter->first == rAtn.msOwner,
"Impossible");
sal_uInt16 nFndPos = static_cast< sal_uInt16 >(aIter - aStrArr.begin());
- OUString sAuthor(*aIter);
- sal_uInt8 nNameLen = (sal_uInt8)sAuthor.getLength();
- if ( nNameLen > 9 )
+ OUString sInitials( aIter->second );
+ sal_uInt8 nInitialsLen = (sal_uInt8)sInitials.getLength();
+ if ( nInitialsLen > 9 )
{
- sAuthor = sAuthor.copy( 0, 9 );
- nNameLen = 9;
+ sInitials = sInitials.copy( 0, 9 );
+ nInitialsLen = 9;
}
// xstUsrInitl[ 10 ] pascal-style String holding initials
// of annotation author
if ( rWrt.bWrtWW8 )
{
- SwWW8Writer::WriteShort(*rWrt.pTableStrm, nNameLen);
- SwWW8Writer::WriteString16(*rWrt.pTableStrm, sAuthor,
+ SwWW8Writer::WriteShort(*rWrt.pTableStrm, nInitialsLen);
+ SwWW8Writer::WriteString16(*rWrt.pTableStrm, sInitials,
false);
SwWW8Writer::FillCount( *rWrt.pTableStrm,
- (9 - nNameLen) * 2 );
+ (9 - nInitialsLen) * 2 );
}
else
{
- *rWrt.pTableStrm << nNameLen;
- SwWW8Writer::WriteString8(*rWrt.pTableStrm, sAuthor,
+ *rWrt.pTableStrm << nInitialsLen;
+ SwWW8Writer::WriteString8(*rWrt.pTableStrm, sInitials,
false, RTL_TEXTENCODING_MS_1252);
- SwWW8Writer::FillCount(*rWrt.pTableStrm, 9 - nNameLen);
+ SwWW8Writer::FillCount(*rWrt.pTableStrm, 9 - nInitialsLen);
}
// documents layout of WriteShort's below:
diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx
index 3e2dbff096c2..ad76945850ea 100644
--- a/sw/source/filter/ww8/wrtww8.hxx
+++ b/sw/source/filter/ww8/wrtww8.hxx
@@ -1193,6 +1193,7 @@ struct WW8_Annotation
const OutlinerParaObject* mpRichText;
OUString msSimpleText;
OUString msOwner;
+ OUString m_sInitials;
DateTime maDateTime;
WW8_Annotation(const SwPostItField* pPostIt);
WW8_Annotation(const SwRedlineData* pRedline);