sw/inc/doc.hxx | 2 - sw/source/core/doc/docfmt.cxx | 48 ++++++++++++++++++++++++--------------- sw/source/ui/dochdl/swdtflvr.cxx | 2 - 3 files changed, 32 insertions(+), 20 deletions(-)
New commits: commit 15547450bdba10959473c2cb5891f29ad5053b09 Author: Caolán McNamara <caol...@redhat.com> Date: Mon Feb 27 12:39:06 2012 +0000 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. diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index 580108e..cfe9935 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 05227ea..01176c9 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 b7be519..adfa4d1 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); }
_______________________________________________ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits