[Libreoffice-commits] .: Branch 'libreoffice-3-5-1' - sw/inc sw/source
Michael Meeks
michael at kemper.freedesktop.org
Tue Feb 28 04:07:34 PST 2012
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 0f2954dd3a1dcd9a4d2cc6a39e6b489acb223f10
Author: Caolán McNamara <caolanm at 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.
(cherry picked from commit 15547450bdba10959473c2cb5891f29ad5053b09)
Signed-off-by: Miklos Vajna <vmiklos at suse.cz>
Signed-off-by: Tor Lillqvist <tml at iki.fi>
Signed-off-by: Michael Meeks <michael.meeks at suse.com>
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 8165a57..29be2a7 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 10cd5f7..54a9707 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 e5fdd55..dfa85ed 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);
}
More information about the Libreoffice-commits
mailing list