Index: src/wp/impexp/xp/ie_exp_RTF.cpp =================================================================== RCS file: /cvsroot/abi/src/wp/impexp/xp/ie_exp_RTF.cpp,v retrieving revision 1.72 diff -u -r1.72 ie_exp_RTF.cpp --- src/wp/impexp/xp/ie_exp_RTF.cpp 4 Sep 2003 23:18:12 -0000 1.72 +++ src/wp/impexp/xp/ie_exp_RTF.cpp 12 Sep 2003 22:25:04 -0000 @@ -56,7 +56,6 @@ { m_error = 0; m_pListenerWriteDoc = NULL; - m_pListenerGetProps = NULL; m_bNeedUnicodeText = false; m_braceLevel = 0; m_bLastWasKeyword = false; @@ -69,7 +68,6 @@ { m_error = 0; m_pListenerWriteDoc = NULL; - m_pListenerGetProps = NULL; m_bNeedUnicodeText = false; m_braceLevel = 0; m_bLastWasKeyword = false; @@ -205,14 +203,20 @@ _addColor("000000"); // load black as color 0. _addColor("ffffff"); // load white as color 1. - m_pListenerGetProps = new s_RTF_ListenerGetProps(getDoc(),this); - if (!m_pListenerGetProps) + s_RTF_ListenerGetProps * listenerGetProps = new s_RTF_ListenerGetProps(getDoc(),this); + if (!listenerGetProps) return UT_IE_NOMEMORY; if (getDocRange()) - getDoc()->tellListenerSubset(static_cast(m_pListenerGetProps),getDocRange()); + getDoc()->tellListenerSubset(listenerGetProps,getDocRange()); else - getDoc()->tellListener(static_cast(m_pListenerGetProps)); - DELETEP(m_pListenerGetProps); + getDoc()->tellListener(listenerGetProps); + + // if the bit to be pasted contains a new block anywhere within it, + // then we also want the block props for the first block in the + // clipboard. mark this info down here, use it in the listener. + bool hasBlock = listenerGetProps->hasBlock(); + + DELETEP(listenerGetProps); // Important: This must come before the header is written so // every font used in a style is properly entered in the font table. @@ -226,13 +230,13 @@ // create and install a listener to receive the document // and write its content in rtf. - m_pListenerWriteDoc = new s_RTF_ListenerWriteDoc(getDoc(),this, (getDocRange()!=NULL)); + m_pListenerWriteDoc = new s_RTF_ListenerWriteDoc(getDoc(),this, (getDocRange()!=NULL), hasBlock); if (!m_pListenerWriteDoc) return UT_IE_NOMEMORY; if (getDocRange()) - getDoc()->tellListenerSubset(static_cast(m_pListenerWriteDoc),getDocRange()); + getDoc()->tellListenerSubset(m_pListenerWriteDoc,getDocRange()); else - getDoc()->tellListener(static_cast(m_pListenerWriteDoc)); + getDoc()->tellListener(m_pListenerWriteDoc); DELETEP(m_pListenerWriteDoc); // write any rtf trailer matter Index: src/wp/impexp/xp/ie_exp_RTF.h =================================================================== RCS file: /cvsroot/abi/src/wp/impexp/xp/ie_exp_RTF.h,v retrieving revision 1.29 diff -u -r1.29 ie_exp_RTF.h --- src/wp/impexp/xp/ie_exp_RTF.h 4 Sep 2003 23:18:13 -0000 1.29 +++ src/wp/impexp/xp/ie_exp_RTF.h 12 Sep 2003 22:25:04 -0000 @@ -172,7 +172,6 @@ private: s_RTF_ListenerWriteDoc * m_pListenerWriteDoc; - s_RTF_ListenerGetProps * m_pListenerGetProps; UT_Vector m_vecColors; /* vector of "const char * szColor" */ UT_Vector m_vecFonts; /* vector of struct _font */ bool m_bNeedUnicodeText; /* doc has unicode chars */ Index: src/wp/impexp/xp/ie_exp_RTF_listenerGetProps.cpp =================================================================== RCS file: /cvsroot/abi/src/wp/impexp/xp/ie_exp_RTF_listenerGetProps.cpp,v retrieving revision 1.14 diff -u -r1.14 ie_exp_RTF_listenerGetProps.cpp --- src/wp/impexp/xp/ie_exp_RTF_listenerGetProps.cpp 25 Jun 2003 17:09:45 -0000 1.14 +++ src/wp/impexp/xp/ie_exp_RTF_listenerGetProps.cpp 12 Sep 2003 22:25:04 -0000 @@ -119,6 +119,7 @@ m_apiLastSpan = 0; m_apiThisSection = 0; m_apiThisBlock = 0; + m_bHasBlock = false; } s_RTF_ListenerGetProps::~s_RTF_ListenerGetProps() @@ -262,6 +263,7 @@ _closeSpan(); _closeBlock(); m_bInBlock = true; + m_bHasBlock = true; m_apiThisBlock = pcr->getIndexAP(); return true; } Index: src/wp/impexp/xp/ie_exp_RTF_listenerGetProps.h =================================================================== RCS file: /cvsroot/abi/src/wp/impexp/xp/ie_exp_RTF_listenerGetProps.h,v retrieving revision 1.9 diff -u -r1.9 ie_exp_RTF_listenerGetProps.h --- src/wp/impexp/xp/ie_exp_RTF_listenerGetProps.h 25 Jun 2003 17:09:45 -0000 1.9 +++ src/wp/impexp/xp/ie_exp_RTF_listenerGetProps.h 12 Sep 2003 22:25:04 -0000 @@ -54,6 +54,7 @@ PL_StruxFmtHandle sfhNew)); virtual bool signal(UT_uint32 iSignal); + bool hasBlock() { return m_bHasBlock; } protected: void _closeSection(void); @@ -77,6 +78,8 @@ PT_AttrPropIndex m_apiThisSection; PT_AttrPropIndex m_apiThisBlock; PT_AttrPropIndex m_apiSavedBlock; + /*! true if we have a multi-block paste. */ + bool m_bHasBlock; }; #endif /* IE_EXP_RTF_LISTENERGETPROPS */ Index: src/wp/impexp/xp/ie_exp_RTF_listenerWriteDoc.cpp =================================================================== RCS file: /cvsroot/abi/src/wp/impexp/xp/ie_exp_RTF_listenerWriteDoc.cpp,v retrieving revision 1.121 diff -u -r1.121 ie_exp_RTF_listenerWriteDoc.cpp --- src/wp/impexp/xp/ie_exp_RTF_listenerWriteDoc.cpp 4 Sep 2003 23:18:15 -0000 1.121 +++ src/wp/impexp/xp/ie_exp_RTF_listenerWriteDoc.cpp 12 Sep 2003 22:25:04 -0000 @@ -37,6 +37,7 @@ #include "ie_exp_RTF_listenerWriteDoc.h" #include "ie_exp_RTF_AttrProp.h" #include "pd_Document.h" +#include "pf_Frag_Strux.h" #include "pp_AttrProp.h" #include "pp_Property.h" #include "px_ChangeRecord.h" @@ -375,7 +376,8 @@ s_RTF_ListenerWriteDoc::s_RTF_ListenerWriteDoc(PD_Document * pDocument, IE_Exp_RTF * pie, - bool bToClipboard) + bool bToClipboard, + bool bHasMultiBlock) : m_wctomb(XAP_EncodingManager::get_instance()->getNative8BitEncodingName()) { // The overall syntax for an RTF file is: @@ -424,6 +426,7 @@ m_bOpennedFootnote = false; m_iFirstTop = 0; m_bHyperLinkOpen = false; + m_bOpenBlockForSpan = bHasMultiBlock; //
+ will be handled by the populate code. } @@ -463,6 +466,27 @@ return true; } } + + if (m_bOpenBlockForSpan) + { + m_bOpenBlockForSpan = false; + + pf_Frag * pf1 = m_pDocument->getFragFromPosition(pcr->getPosition()); + if (pf1 != NULL) + { + // scan backwards for the block props of this span. + while (pf1 != NULL) + { + if (pf1->getType() == pf_Frag::PFT_Strux) + { + m_apiThisBlock = ((pf_Frag_Strux*)pf1)->getIndexAP(); + break; + } + pf1 = pf1->getPrev(); + } + } + } + _openSpan(api); _outputData(pData,length,pcr->getPosition(),false); Index: src/wp/impexp/xp/ie_exp_RTF_listenerWriteDoc.h =================================================================== RCS file: /cvsroot/abi/src/wp/impexp/xp/ie_exp_RTF_listenerWriteDoc.h,v retrieving revision 1.28 diff -u -r1.28 ie_exp_RTF_listenerWriteDoc.h --- src/wp/impexp/xp/ie_exp_RTF_listenerWriteDoc.h 29 Aug 2003 07:26:05 -0000 1.28 +++ src/wp/impexp/xp/ie_exp_RTF_listenerWriteDoc.h 12 Sep 2003 22:25:04 -0000 @@ -40,7 +40,8 @@ public: s_RTF_ListenerWriteDoc(PD_Document * pDocument, IE_Exp_RTF * pie, - bool bToClipboard); + bool bToClipboard, + bool bHasMultiBlock); virtual ~s_RTF_ListenerWriteDoc(); virtual bool populate(PL_StruxFmtHandle sfh, @@ -136,6 +137,7 @@ UT_String m_sLastColor; UT_sint32 m_iFirstTop; bool m_bHyperLinkOpen; + bool m_bOpenBlockForSpan; }; #endif /* IE_EXP_RTF_LISTENERWRITEDOC */