summaryrefslogtreecommitdiff
path: root/sw/source/filter/ww8/wrtw8nds.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/filter/ww8/wrtw8nds.cxx')
-rwxr-xr-xsw/source/filter/ww8/wrtw8nds.cxx72
1 files changed, 42 insertions, 30 deletions
diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx
index 6ffb4fa151bc..dea5332d181c 100755
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -179,7 +179,7 @@ MSWordAttrIter::~MSWordAttrIter()
// Mit OutAttr() werden die Attribute an der angegebenen SwPos
// ausgegeben.
-class SwAttrIter : public MSWordAttrIter
+class WW8SwAttrIter : public MSWordAttrIter
{
private:
const SwTxtNode& rNd;
@@ -210,10 +210,10 @@ private:
void IterToCurrent();
//No copying
- SwAttrIter(const SwAttrIter&);
- SwAttrIter& operator=(const SwAttrIter&);
+ WW8SwAttrIter(const WW8SwAttrIter&);
+ WW8SwAttrIter& operator=(const WW8SwAttrIter&);
public:
- SwAttrIter( MSWordExportBase& rWr, const SwTxtNode& rNd );
+ WW8SwAttrIter( MSWordExportBase& rWr, const SwTxtNode& rNd );
bool IsTxtAttr( xub_StrLen nSwPos );
bool IsRedlineAtEnd( xub_StrLen nPos ) const;
@@ -249,7 +249,7 @@ public:
}
};
-void SwAttrIter::IterToCurrent()
+void WW8SwAttrIter::IterToCurrent()
{
ASSERT(maCharRuns.begin() != maCharRuns.end(), "Impossible");
mnScript = maCharRunIter->mnScript;
@@ -257,7 +257,7 @@ void SwAttrIter::IterToCurrent()
mbCharIsRTL = maCharRunIter->mbRTL;
}
-SwAttrIter::SwAttrIter(MSWordExportBase& rWr, const SwTxtNode& rTxtNd) :
+WW8SwAttrIter::WW8SwAttrIter(MSWordExportBase& rWr, const SwTxtNode& rTxtNd) :
MSWordAttrIter(rWr),
rNd(rTxtNd),
maCharRuns(GetPseudoCharRuns(rTxtNd, 0, !rWr.HackIsWW8OrHigher())),
@@ -324,7 +324,7 @@ xub_StrLen lcl_getMinPos( xub_StrLen pos1, xub_StrLen pos2 )
return min;
}
-xub_StrLen SwAttrIter::SearchNext( xub_StrLen nStartPos )
+xub_StrLen WW8SwAttrIter::SearchNext( xub_StrLen nStartPos )
{
xub_StrLen nPos;
xub_StrLen nMinPos = STRING_MAXLEN;
@@ -457,7 +457,7 @@ xub_StrLen SwAttrIter::SearchNext( xub_StrLen nStartPos )
return nMinPos;
}
-void SwAttrIter::OutAttr( xub_StrLen nSwPos )
+void WW8SwAttrIter::OutAttr( xub_StrLen nSwPos )
{
m_rExport.AttrOutput().RTLAndCJKState( IsCharRTL(), GetScript() );
@@ -501,9 +501,7 @@ void SwAttrIter::OutAttr( xub_StrLen nSwPos )
: nSwPos == *pHt->GetStart() )
{
sal_uInt16 nWhich = pHt->GetAttr().Which();
- if (nWhich == nFontId)
- pFont = &(item_cast<SvxFontItem>(pHt->GetAttr()));
- else if( nWhich == RES_TXTATR_AUTOFMT )
+ if (nWhich == RES_TXTATR_AUTOFMT)
{
const SwFmtAutoFmt& rAutoFmt = static_cast<const SwFmtAutoFmt&>(pHt->GetAttr());
const boost::shared_ptr<SfxItemSet> pSet = rAutoFmt.GetStyleHandle();
@@ -583,7 +581,7 @@ void SwAttrIter::OutAttr( xub_StrLen nSwPos )
}
}
-void SwAttrIter::OutFlys(xub_StrLen nSwPos)
+void WW8SwAttrIter::OutFlys(xub_StrLen nSwPos)
{
/*
#i2916#
@@ -605,7 +603,7 @@ void SwAttrIter::OutFlys(xub_StrLen nSwPos)
}
}
-bool SwAttrIter::IsTxtAttr( xub_StrLen nSwPos )
+bool WW8SwAttrIter::IsTxtAttr( xub_StrLen nSwPos )
{
// search for attrs with CH_TXTATR
if (const SwpHints* pTxtAttrs = rNd.GetpSwpHints())
@@ -621,7 +619,7 @@ bool SwAttrIter::IsTxtAttr( xub_StrLen nSwPos )
return false;
}
-bool SwAttrIter::IsDropCap( int nSwPos )
+bool WW8SwAttrIter::IsDropCap( int nSwPos )
{
// see if the current position falls on a DropCap
int nDropChars = mrSwFmtDrop.GetChars();
@@ -640,7 +638,7 @@ bool SwAttrIter::IsDropCap( int nSwPos )
return false;
}
-bool SwAttrIter::RequiresImplicitBookmark()
+bool WW8SwAttrIter::RequiresImplicitBookmark()
{
SwImplBookmarksIter bkmkIterEnd = m_rExport.maImplicitBookmarks.end();
for ( SwImplBookmarksIter aIter = m_rExport.maImplicitBookmarks.begin(); aIter != bkmkIterEnd; ++aIter )
@@ -659,7 +657,7 @@ bool SwAttrIter::RequiresImplicitBookmark()
// Attribut-Anfangposition fragen kann.
// Es koennen nur Attribute mit Ende abgefragt werden.
// Es wird mit bDeep gesucht
-const SfxPoolItem* SwAttrIter::HasTextItem( sal_uInt16 nWhich ) const
+const SfxPoolItem* WW8SwAttrIter::HasTextItem( sal_uInt16 nWhich ) const
{
const SfxPoolItem* pRet = 0;
const SwpHints* pTxtAttrs = rNd.GetpSwpHints();
@@ -692,7 +690,7 @@ void WW8Export::GetCurrentItems(WW8Bytes& rItems) const
rItems.Insert((*pO)[nI], rItems.Count());
}
-const SfxPoolItem& SwAttrIter::GetItem(sal_uInt16 nWhich) const
+const SfxPoolItem& WW8SwAttrIter::GetItem(sal_uInt16 nWhich) const
{
const SfxPoolItem* pRet = HasTextItem(nWhich);
return pRet ? *pRet : rNd.SwCntntNode::GetAttr(nWhich);
@@ -1073,7 +1071,7 @@ String BookmarkToWriter(const String &rBookmark)
INetURLObject::DECODE_UNAMBIGUOUS, RTL_TEXTENCODING_ASCII_US);
}
-void SwAttrIter::OutSwFmtRefMark(const SwFmtRefMark& rAttr, bool)
+void WW8SwAttrIter::OutSwFmtRefMark(const SwFmtRefMark& rAttr, bool)
{
if ( m_rExport.HasRefToObject( REF_SETREFATTR, &rAttr.GetRefName(), 0 ) )
m_rExport.AppendBookmark( m_rExport.GetBookmarkName( REF_SETREFATTR,
@@ -1173,7 +1171,7 @@ void AttributeOutputBase::TOXMark( const SwTxtNode& rNode, const SwTOXMark& rAtt
FieldVanish( sTxt, eType );
}
-int SwAttrIter::OutAttrWithRange(xub_StrLen nPos)
+int WW8SwAttrIter::OutAttrWithRange(xub_StrLen nPos)
{
int nRet = 0;
if ( const SwpHints* pTxtAttrs = rNd.GetpSwpHints() )
@@ -1234,7 +1232,7 @@ int SwAttrIter::OutAttrWithRange(xub_StrLen nPos)
return nRet;
}
-bool SwAttrIter::IsRedlineAtEnd( xub_StrLen nEnd ) const
+bool WW8SwAttrIter::IsRedlineAtEnd( xub_StrLen nEnd ) const
{
bool bRet = false;
// search next Redline
@@ -1256,7 +1254,7 @@ bool SwAttrIter::IsRedlineAtEnd( xub_StrLen nEnd ) const
return bRet;
}
-const SwRedlineData* SwAttrIter::GetRedline( xub_StrLen nPos )
+const SwRedlineData* WW8SwAttrIter::GetRedline( xub_StrLen nPos )
{
if( pCurRedline )
{
@@ -1451,7 +1449,7 @@ Convert characters that need to be converted, the basic replacements and the
ridicously complicated title case attribute mapping to hardcoded upper case
because word doesn't have the feature
*/
-String SwAttrIter::GetSnippet(const String &rStr, xub_StrLen nAktPos,
+String WW8SwAttrIter::GetSnippet(const String &rStr, xub_StrLen nAktPos,
xub_StrLen nLen) const
{
String aSnippet(rStr, nAktPos, nLen);
@@ -1647,7 +1645,7 @@ void WW8AttributeOutput::FormatDrop( const SwTxtNode& rNode, const SwFmtDrop &rS
m_rWW8Export.pO->Remove( 0, m_rWW8Export.pO->Count() );
}
-xub_StrLen MSWordExportBase::GetNextPos( SwAttrIter* aAttrIter, const SwTxtNode& rNode, xub_StrLen nAktPos )
+xub_StrLen MSWordExportBase::GetNextPos( WW8SwAttrIter* aAttrIter, const SwTxtNode& rNode, xub_StrLen nAktPos )
{
// Get the bookmarks for the normal run
xub_StrLen nNextPos = aAttrIter->WhereNext();
@@ -1661,7 +1659,7 @@ xub_StrLen MSWordExportBase::GetNextPos( SwAttrIter* aAttrIter, const SwTxtNode&
return std::min( nNextPos, nNextBookmark );
}
-void MSWordExportBase::UpdatePosition( SwAttrIter* aAttrIter, xub_StrLen nAktPos, xub_StrLen /*nEnd*/ )
+void MSWordExportBase::UpdatePosition( WW8SwAttrIter* aAttrIter, xub_StrLen nAktPos, xub_StrLen /*nEnd*/ )
{
xub_StrLen nNextPos;
@@ -1799,7 +1797,7 @@ void MSWordExportBase::OutputTextNode( const SwTxtNode& rNode )
// have to remember it in nStyle
sal_uInt16 nStyle = nStyleBeforeFly;
- SwAttrIter aAttrIter( *this, rNode );
+ WW8SwAttrIter aAttrIter( *this, rNode );
rtl_TextEncoding eChrSet = aAttrIter.GetCharSet();
if ( bStartTOX )
@@ -1842,7 +1840,7 @@ void MSWordExportBase::OutputTextNode( const SwTxtNode& rNode )
String aStr( rNode.GetTxt() );
xub_StrLen nAktPos = 0;
- xub_StrLen nEnd = aStr.Len();
+ xub_StrLen const nEnd = aStr.Len();
bool bRedlineAtEnd = false;
int nOpenAttrWithRange = 0;
@@ -1934,6 +1932,15 @@ void MSWordExportBase::OutputTextNode( const SwTxtNode& rNode )
if ( aAttrIter.IsDropCap( nNextAttr ) )
AttrOutput().FormatDrop( rNode, aAttrIter.GetSwFmtDrop(), nStyle, pTextNodeInfo, pTextNodeInfoInner );
+ if (0 != nEnd)
+ {
+ // Output the character attributes
+ // #i51277# do this before writing flys at end of paragraph
+ AttrOutput().StartRunProperties();
+ aAttrIter.OutAttr( nAktPos );
+ AttrOutput().EndRunProperties( pRedlineData );
+ }
+
// At the end of line, output the attributes until the CR.
// Exception: footnotes at the end of line
if ( nNextAttr == nEnd )
@@ -1959,10 +1966,15 @@ void MSWordExportBase::OutputTextNode( const SwTxtNode& rNode )
}
}
- // Output the character attributes
- AttrOutput().StartRunProperties();
- aAttrIter.OutAttr( nAktPos ); // nAktPos - 1 ??
- AttrOutput().EndRunProperties( pRedlineData );
+ if (0 == nEnd)
+ {
+ // Output the character attributes
+ // do it after WriteCR for an empty paragraph (otherwise
+ // WW8_WrFkp::Append throws SPRMs away...)
+ AttrOutput().StartRunProperties();
+ aAttrIter.OutAttr( nAktPos );
+ AttrOutput().EndRunProperties( pRedlineData );
+ }
// Exception: footnotes at the end of line
if ( nNextAttr == nEnd )