diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-02-27 12:39:06 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-02-27 12:41:53 +0000 |
commit | 15547450bdba10959473c2cb5891f29ad5053b09 (patch) | |
tree | ffd0f12ecde83db657223bcf5c2ff073a2de3be3 | |
parent | 26651585c02367011df196ec72a3d0bf84a60f27 (diff) |
Resolves: fdo#46038 don't copy page styles into temporary clipboard doc
writer rtf export has a nasty pgdsctbl extension
sd rtf import has nasty "if its got a table keyword in it its a table"
logic
Classically we never put our styles into the temporary clipboard, so fastest
and safest fix is to simply skip putting the page styles into it.
-rw-r--r-- | sw/inc/doc.hxx | 2 | ||||
-rw-r--r-- | sw/source/core/doc/docfmt.cxx | 48 | ||||
-rw-r--r-- | sw/source/ui/dochdl/swdtflvr.cxx | 2 |
3 files changed, 32 insertions, 20 deletions
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index 580108ea30ae..cfe9935a4252 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -1286,7 +1286,7 @@ public: SwGrfFmtColl* CopyGrfColl( const SwGrfFmtColl& rColl ); // Replace all styles with those from rSource. - void ReplaceStyles( const SwDoc& rSource ); + void ReplaceStyles( const SwDoc& rSource, bool bIncludePageStyles = true ); // Replace all property defaults with those from rSource. void ReplaceDefaults( const SwDoc& rSource ); diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx index 05227ea7c688..01176c9bf212 100644 --- a/sw/source/core/doc/docfmt.cxx +++ b/sw/source/core/doc/docfmt.cxx @@ -2134,7 +2134,7 @@ void SwDoc::CopyPageDesc( const SwPageDesc& rSrcDesc, SwPageDesc& rDstDesc, } } -void SwDoc::ReplaceStyles( const SwDoc& rSource ) +void SwDoc::ReplaceStyles( const SwDoc& rSource, bool bIncludePageStyles ) { ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo()); @@ -2145,26 +2145,38 @@ void SwDoc::ReplaceStyles( const SwDoc& rSource ) CopyFmtArr( *rSource.pTxtFmtCollTbl, *pTxtFmtCollTbl, &SwDoc::_MakeTxtFmtColl, *pDfltTxtFmtColl ); - // and now the page templates - sal_uInt16 nCnt = rSource.aPageDescs.Count(); - if( nCnt ) - { - // a different Doc -> Number formatter needs to be merged - SwTblNumFmtMerge aTNFM( rSource, *this ); + sal_uInt16 nCnt; - // 1st step: Create all formats (skip the 0th - it's the default!) - while( nCnt ) + //To-Do: + // a) in rtf export don't export our hideous pgdsctbl + // extension to rtf anymore + // b) in sd rtf import (View::InsertData) don't use + // a super-fragile test for mere presence of \trowd to + // indicate import of rtf into a table + // c) then drop use of bIncludePageStyles + if (bIncludePageStyles) + { + // and now the page templates + nCnt = rSource.aPageDescs.Count(); + if( nCnt ) { - SwPageDesc *pSrc = rSource.aPageDescs[ --nCnt ]; - if( 0 == ::lcl_FindPageDesc( aPageDescs, pSrc->GetName() ) ) - MakePageDesc( pSrc->GetName() ); - } + // a different Doc -> Number formatter needs to be merged + SwTblNumFmtMerge aTNFM( rSource, *this ); - // 2nd step: Copy all attributes, set the right parents - for( nCnt = rSource.aPageDescs.Count(); nCnt; ) - { - SwPageDesc *pSrc = rSource.aPageDescs[ --nCnt ]; - CopyPageDesc( *pSrc, *::lcl_FindPageDesc( aPageDescs, pSrc->GetName() )); + // 1st step: Create all formats (skip the 0th - it's the default!) + while( nCnt ) + { + SwPageDesc *pSrc = rSource.aPageDescs[ --nCnt ]; + if( 0 == ::lcl_FindPageDesc( aPageDescs, pSrc->GetName() ) ) + MakePageDesc( pSrc->GetName() ); + } + + // 2nd step: Copy all attributes, set the right parents + for( nCnt = rSource.aPageDescs.Count(); nCnt; ) + { + SwPageDesc *pSrc = rSource.aPageDescs[ --nCnt ]; + CopyPageDesc( *pSrc, *::lcl_FindPageDesc( aPageDescs, pSrc->GetName() )); + } } } diff --git a/sw/source/ui/dochdl/swdtflvr.cxx b/sw/source/ui/dochdl/swdtflvr.cxx index b7be519d4c41..adfa4d1f098e 100644 --- a/sw/source/ui/dochdl/swdtflvr.cxx +++ b/sw/source/ui/dochdl/swdtflvr.cxx @@ -379,7 +379,7 @@ namespace //It would probably make most sense here to only insert the styles used //by the selection, e.g. apply SwDoc::IsUsed on styles ? - rDest.ReplaceStyles(rSrc); + rDest.ReplaceStyles(rSrc, false); rSrcWrtShell.Copy(&rDest); } |