diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2019-07-03 10:35:48 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2019-07-03 12:58:16 +0200 |
commit | 132803f99818bffbdc260918ad7a304f228f2843 (patch) | |
tree | 2ad2132ea85ce9bd554ec0e7d650fbd33de9e53b /sw/source/filter/ww8/wrtw8sty.cxx | |
parent | 58ef52cf3258030860d34f05bc19e2b42d9503c6 (diff) |
sw comments on frames: fix DOC handling
The export part didn't use HasFlysAt() to decide what to do with empty
annotation marks.
Regarding the import side, the only problem was that the start of the
annotation range wasn't adjusted to cover the comment anchor, similar to
what the UI and the UNO API already does.
Change-Id: Ibcbaafa9f3f70de95a70b424aca31ebdc9df099d
Reviewed-on: https://gerrit.libreoffice.org/75025
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'sw/source/filter/ww8/wrtw8sty.cxx')
-rw-r--r-- | sw/source/filter/ww8/wrtw8sty.cxx | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx index c65de3898ff6..35ecc773eb05 100644 --- a/sw/source/filter/ww8/wrtw8sty.cxx +++ b/sw/source/filter/ww8/wrtw8sty.cxx @@ -1962,9 +1962,20 @@ WW8_Annotation::WW8_Annotation(const SwRedlineData* pRedline) maDateTime = pRedline->GetTimeStamp(); } -void WW8_WrPlcAnnotations::AddRangeStartPosition(const OUString& rName, WW8_CP nStartCp) +bool WW8_Annotation::HasRange() const { - m_aRangeStartPositions[rName] = nStartCp; + if (m_nRangeStart != m_nRangeEnd) + { + return true; + } + + return !m_bIgnoreEmpty; +} + +void WW8_WrPlcAnnotations::AddRangeStartPosition(const OUString& rName, WW8_CP nStartCp, + bool bIgnoreEmpty) +{ + m_aRangeStartPositions[rName] = std::make_pair(nStartCp, bIgnoreEmpty); } void WW8_WrPlcAnnotations::Append( WW8_CP nCp, const SwPostItField *pPostIt ) @@ -1973,7 +1984,9 @@ void WW8_WrPlcAnnotations::Append( WW8_CP nCp, const SwPostItField *pPostIt ) WW8_Annotation* p; if( m_aRangeStartPositions.find(pPostIt->GetName()) != m_aRangeStartPositions.end() ) { - p = new WW8_Annotation(pPostIt, m_aRangeStartPositions[pPostIt->GetName()], nCp); + auto [nStartCp, bIgnoreEmpty] = m_aRangeStartPositions[pPostIt->GetName()]; + p = new WW8_Annotation(pPostIt, nStartCp, nCp); + p->m_bIgnoreEmpty = bIgnoreEmpty; m_aRangeStartPositions.erase(pPostIt->GetName()); } else @@ -2178,7 +2191,7 @@ void WW8_WrPlcSubDoc::WriteGenericPlc( WW8Export& rWrt, sal_uInt8 nTTyp, const WW8_Annotation& rAtn = *static_cast<const WW8_Annotation*>(aContent[i]); aStrArr.emplace_back(rAtn.msOwner,rAtn.m_sInitials); // record start and end positions for ranges - if( rAtn.m_nRangeStart != rAtn.m_nRangeEnd ) + if (rAtn.HasRange()) { aRangeStartPos.emplace_back(rAtn.m_nRangeStart, nIdx); aRangeEndPos.emplace_back(rAtn.m_nRangeEnd, nIdx); @@ -2403,7 +2416,7 @@ void WW8_WrPlcSubDoc::WriteGenericPlc( WW8Export& rWrt, sal_uInt8 nTTyp, SwWW8Writer::WriteShort( *rWrt.pTableStrm, nFndPos ); SwWW8Writer::WriteShort( *rWrt.pTableStrm, 0 ); SwWW8Writer::WriteShort( *rWrt.pTableStrm, 0 ); - if( rAtn.m_nRangeStart != rAtn.m_nRangeEnd ) + if (rAtn.HasRange()) { SwWW8Writer::WriteLong( *rWrt.pTableStrm, nlTag ); ++nlTag; |