diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-09-19 13:15:36 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-09-19 17:05:29 +0100 |
commit | 1e882a1dc49cc60aed7bae98b4924871ea1bf935 (patch) | |
tree | 8dcad9781a06114768fd3c536163f099e52ed410 /sw/source | |
parent | b9b6e413f06d10b1a8dc5a25a45d7d8a26ff60ff (diff) |
consider following redline as well
a) In word each range that character properties affect are just stored by their
end. So the range is from the last end to the current one.
b) In word the paragraph end marker is a real character, in writer it is not.
c) So for redlining if a paragraph is redlined, but the previous one is not
then the redlining propes of the 2nd para will affect the end marker of the
previous one if the previous char properties do not include the para end mark.
We were currently handing the case where a paragraph end mark *is* inside
redlining and including it in the char property range, but we were not
considering the case where the paragraph end mark is *not* inside redlining
but the following paragraph *is*
to get the end of the previous paragraph not part of the following paragraph
character run, we emit an empty char section of it for this case.
Change-Id: I816335067f60d1d9332bfdb1117fb1448b564972
Diffstat (limited to 'sw/source')
-rw-r--r-- | sw/source/filter/ww8/attributeoutputbase.hxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtw8nds.cxx | 40 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtww8.hxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8atr.cxx | 4 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8attributeoutput.hxx | 2 |
5 files changed, 35 insertions, 15 deletions
diff --git a/sw/source/filter/ww8/attributeoutputbase.hxx b/sw/source/filter/ww8/attributeoutputbase.hxx index a823b5f89afb..0a644c21b7d2 100644 --- a/sw/source/filter/ww8/attributeoutputbase.hxx +++ b/sw/source/filter/ww8/attributeoutputbase.hxx @@ -224,7 +224,7 @@ public: /// Output FKP (Formatted disK Page) - necessary for binary formats only. /// FIXME having it in AttributeOutputBase is probably a hack, it /// should be in WW8AttributeOutput only... - virtual void OutputFKP() {} + virtual void OutputFKP(bool /*bForce*/ = false) {} /// Output style. virtual void ParagraphStyle( sal_uInt16 nStyle ) = 0; diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx index fbd1d54ae8a6..c17e3af5c573 100644 --- a/sw/source/filter/ww8/wrtw8nds.cxx +++ b/sw/source/filter/ww8/wrtw8nds.cxx @@ -1252,7 +1252,7 @@ int SwWW8AttrIter::OutAttrWithRange(sal_Int32 nPos) return nRet; } -bool SwWW8AttrIter::IsRedlineAtEnd( sal_Int32 nEnd ) const +bool SwWW8AttrIter::IncludeEndOfParaCRInRedlineProperties( sal_Int32 nEnd ) const { // search next Redline for( sal_uInt16 nPos = nCurRedlinePos; @@ -1260,16 +1260,32 @@ bool SwWW8AttrIter::IsRedlineAtEnd( sal_Int32 nEnd ) const { const SwRangeRedline *pRange = m_rExport.pDoc->getIDocumentRedlineAccess().GetRedlineTbl()[nPos]; const SwPosition* pEnd = pRange->End(); + const SwPosition* pStart = pRange->Start(); + // In word the paragraph end marker is a real character, in writer it is not. + // Here we find out if the para end marker we will emit is affected by + // redlining, in which case it must be included by the range of character + // attributes that contains the redlining information. if (pEnd->nNode == rNd) { - // In word the paragraph end marker is a real character, in writer it is not. if (pEnd->nContent.GetIndex() == nEnd) { - // This condition detects if the pseudo-char we will export is affected - // by redlining + // This condition detects if the pseudo-char we will export + // should be explicitly included by the redlining char + // properties on this node return true; } } + else if (pStart->nNode.GetIndex()-1 == rNd.GetIndex()) + { + if (pStart->nContent.GetIndex() == 0) + { + // This condition detects if the pseudo-char we will export + // should be implictly excluded by the redlining char + // properties starting on the next node. + return true; + } + } + else break; } @@ -2050,7 +2066,7 @@ void MSWordExportBase::OutputTextNode( const SwTxtNode& rNode ) sal_Int32 nAktPos = 0; sal_Int32 const nEnd = aStr.getLength(); - bool bRedlineAtEnd = false; + bool bIncludeEndOfParaCRInRedlineProperties = false; sal_Int32 nOpenAttrWithRange = 0; OUString aStringForImage("\001"); @@ -2236,8 +2252,8 @@ void MSWordExportBase::OutputTextNode( const SwTxtNode& rNode ) OSL_ENSURE( nOpenAttrWithRange >= 0, "odd to see this happening, expected >= 0" ); if ( !bTxtAtr && nOpenAttrWithRange <= 0 ) { - if ( aAttrIter.IsRedlineAtEnd( nEnd ) ) - bRedlineAtEnd = true; + if ( aAttrIter.IncludeEndOfParaCRInRedlineProperties( nEnd ) ) + bIncludeEndOfParaCRInRedlineProperties = true; else { // insert final graphic anchors if any before CR @@ -2287,7 +2303,7 @@ void MSWordExportBase::OutputTextNode( const SwTxtNode& rNode ) AttrOutput().OutputFKP(); - if ( bTxtAtr || bAttrWithRange || bRedlineAtEnd ) + if (bTxtAtr || bAttrWithRange || bIncludeEndOfParaCRInRedlineProperties) { // insert final graphic anchors if any before CR nStateOfFlyFrame = aAttrIter.OutFlys( nEnd ); @@ -2308,10 +2324,14 @@ void MSWordExportBase::OutputTextNode( const SwTxtNode& rNode ) AttrOutput().EndTOX( *pTOXSect ); } - if ( bRedlineAtEnd ) + if (bIncludeEndOfParaCRInRedlineProperties) { AttrOutput().Redline( aAttrIter.GetRunLevelRedline( nEnd ) ); - AttrOutput().OutputFKP(); + //If if there was no redline property emitted, force adding + //another entry for the CR so that in the case that this + //has no redline, but the next para does, then this one is + //not merged with the next + AttrOutput().OutputFKP(true); } } } diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx index 3d44e4ca973a..811016537574 100644 --- a/sw/source/filter/ww8/wrtww8.hxx +++ b/sw/source/filter/ww8/wrtww8.hxx @@ -1536,7 +1536,7 @@ public: SwWW8AttrIter( MSWordExportBase& rWr, const SwTxtNode& rNd ); bool IsTxtAttr( sal_Int32 nSwPos ); - bool IsRedlineAtEnd( sal_Int32 nPos ) const; + bool IncludeEndOfParaCRInRedlineProperties(sal_Int32 nPos) const; bool IsDropCap( int nSwPos ); bool RequiresImplicitBookmark(); diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index 684e00e1be86..ec257d58946a 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -1063,9 +1063,9 @@ void WW8AttributeOutput::RawText( const OUString& rText, bool bForceUnicode, rtl m_rWW8Export.OutSwString( rText, 0, rText.getLength(), bForceUnicode, eCharSet ); } -void WW8AttributeOutput::OutputFKP() +void WW8AttributeOutput::OutputFKP(bool bForce) { - if ( !m_rWW8Export.pO->empty() ) + if (!m_rWW8Export.pO->empty() || bForce) { m_rWW8Export.pChpPlc->AppendFkpEntry( m_rWW8Export.Strm().Tell(), m_rWW8Export.pO->size(), m_rWW8Export.pO->data() ); diff --git a/sw/source/filter/ww8/ww8attributeoutput.hxx b/sw/source/filter/ww8/ww8attributeoutput.hxx index 8e8f3923ddf2..5074c96694af 100644 --- a/sw/source/filter/ww8/ww8attributeoutput.hxx +++ b/sw/source/filter/ww8/ww8attributeoutput.hxx @@ -92,7 +92,7 @@ public: /// Output FKP (Formatted disK Page) - necessary for binary formats only. /// FIXME having it in AttributeOutputBase is probably a hack, it /// should be in WW8AttributeOutput only... - virtual void OutputFKP() SAL_OVERRIDE; + virtual void OutputFKP(bool bForce = false) SAL_OVERRIDE; /// Output style. virtual void ParagraphStyle( sal_uInt16 nStyle ) SAL_OVERRIDE; |