summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-02-27 12:39:06 +0000
committerMichael Meeks <michael.meeks@suse.com>2012-02-28 12:09:01 +0000
commit0f2954dd3a1dcd9a4d2cc6a39e6b489acb223f10 (patch)
tree96763371192551b242460e98b69fda189969b219
parentda7235196c138eed21065c94e2a855d6c3f217e0 (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. (cherry picked from commit 15547450bdba10959473c2cb5891f29ad5053b09) Signed-off-by: Miklos Vajna <vmiklos@suse.cz> Signed-off-by: Tor Lillqvist <tml@iki.fi> Signed-off-by: Michael Meeks <michael.meeks@suse.com>
-rw-r--r--sw/inc/doc.hxx2
-rw-r--r--sw/source/core/doc/docfmt.cxx48
-rwxr-xr-xsw/source/ui/dochdl/swdtflvr.cxx2
3 files changed, 32 insertions, 20 deletions
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 8165a57b5b72..29be2a7c28e2 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -1275,7 +1275,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 10cd5f7e4824..54a970721fda 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -2135,7 +2135,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());
@@ -2146,26 +2146,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 e5fdd55a98fc..dfa85ed489d3 100755
--- 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);
}