Anonymous avatar Anonymous committed 1022d1b

CWS-TOOLING: integrate CWS os131
2009-07-14 15:57:33 +0200 os r273979 : #i103542# no access to members after deletion
2009-06-15 13:18:52 +0200 os r272980 : #i40827# wrong param in Copy() fixed
2009-06-15 10:09:27 +0200 os r272964 : #i40827# first document copied with storage, later only copy SwDoc
2009-06-11 10:37:51 +0200 os r272851 : CWS-TOOLING: rebase CWS os131 to trunk@272827 (milestone: DEV300:m50)
2009-06-08 10:07:50 +0200 os r272721 : #i40827# warnings fixed
2009-06-04 16:31:04 +0200 os r272644 : #i40827# enable document copies - inactive

Comments (0)

Files changed (27)

sw/inc/IDocumentContentOperations.hxx

     /** Kopieren eines Bereiches im oder in ein anderes Dokument !
 	    Die Position kann auch im Bereich liegen !!
     */
-	virtual bool Copy(SwPaM&, SwPosition&) const = 0;
+    virtual bool Copy(SwPaM&, SwPosition&, bool bCopyAll ) const = 0;
 
 	/** Loesche die Section, in der der Node steht.
     */
 		// Kopieren eines Bereiches im oder in ein anderes Dokument !
 		// Die Position darf nicht im Bereich liegen !!
 	sal_Bool _Copy( SwPaM&, SwPosition&,
-				sal_Bool MakeNewFrms = sal_True, SwPaM* pCpyRng = 0 ) const;	// in ndcopy.cxx
+				sal_Bool MakeNewFrms /*= sal_True*/, bool bCopyAll, SwPaM* pCpyRng /*= 0*/ ) const;	// in ndcopy.cxx
 
 	SwFlyFrmFmt* _MakeFlySection( const SwPosition& rAnchPos,
 								const SwCntntNode& rNode, RndStdIds eRequestId,
 								const SfxItemSet* pGrfAttrSet,
 								SwFrmFmt* = 0 );
 
-	void _CopyFlyInFly( const SwNodeRange& rRg, const SwNodeIndex& rSttIdx,
+    void _CopyFlyInFly( const SwNodeRange& rRg, const xub_StrLen nEndContentIndex,
+                        const SwNodeIndex& rSttIdx,
 						sal_Bool bCopyFlyAtFly = sal_False ) const;	// steht im ndcopy.cxx
     sal_Int8 SetFlyFrmAnchor( SwFrmFmt& rFlyFmt, SfxItemSet& rSet, sal_Bool bNewFrms );
 
      SwFmt *_MakeTxtFmtColl(const String &, SwFmt *, BOOL, BOOL );
 
      void InitTOXTypes();
+     void   Paste( const SwDoc& );
 public:
 
     /** Life cycle
 
     /** IDocumentContentOperations
     */
-    virtual bool Copy(SwPaM&, SwPosition&) const;
+    virtual bool Copy(SwPaM&, SwPosition&, bool bCopyAll) const;
 	virtual void DeleteSection(SwNode* pNode);
 	virtual bool Delete(SwPaM&);
 	virtual bool DelFullPara(SwPaM&);
 								SwFrmFmt *pParent = 0 );
 
 	void CopyWithFlyInFly( const SwNodeRange& rRg,
+                            const xub_StrLen nEndContentIndex,
 							const SwNodeIndex& rInsPos,
 							sal_Bool bMakeNewFrms = sal_True,
 							sal_Bool bDelRedlines = sal_True,
 	}
 
     ::sfx2::IXmlIdRegistry& GetXmlIdRegistry();
+    SwDoc* CreateCopy() const;
 };
 
 

sw/inc/unotxdoc.hxx

 #include <com/sun/star/xforms/XFormsSupplier.hpp>
 #include <com/sun/star/container/XNameContainer.hpp>
 #include <com/sun/star/text/XFlatParagraphIteratorProvider.hpp>
-#ifndef _COM_SUN_STAR_DOCUMENT_XDOCUMENTLANGUAGES_HPP
 #include <com/sun/star/document/XDocumentLanguages.hpp>
-#endif
+#include <com/sun/star/util/XCloneable.hpp>
 #include <svtools/itemprop.hxx>
 #include <svx/fmdmod.hxx>
 #include <svx/UnoForbiddenCharsTable.hxx>
 #include <cppuhelper/implbase4.hxx>	// helper for implementations
 #include <RefreshListenerContainer.hxx>
 
-#define __IFC31 Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11, Ifc12, Ifc13, Ifc14, Ifc15, Ifc16, \
-Ifc17, Ifc18, Ifc19, Ifc20, Ifc21, Ifc22, Ifc23, Ifc24, Ifc25, Ifc26, Ifc27, Ifc28, Ifc29, Ifc30, Ifc31
+#define __IFC32 Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11, Ifc12, Ifc13, Ifc14, Ifc15, Ifc16, \
+Ifc17, Ifc18, Ifc19, Ifc20, Ifc21, Ifc22, Ifc23, Ifc24, Ifc25, Ifc26, Ifc27, Ifc28, Ifc29, Ifc30, Ifc31, Ifc32
 
-#define __CLASS_IFC31 class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, \
+#define __CLASS_IFC32 class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, \
 class Ifc8, class Ifc9, class Ifc10, class Ifc11, class Ifc12, class Ifc13, class Ifc14, class Ifc15, class Ifc16, \
 class Ifc17, class Ifc18, class Ifc19, class Ifc20, class Ifc21, class Ifc22, class Ifc23, class Ifc24,\
-class Ifc25, class Ifc26, class Ifc27, class Ifc28, class Ifc29, class Ifc30, class Ifc31
+class Ifc25, class Ifc26, class Ifc27, class Ifc28, class Ifc29, class Ifc30, class Ifc31 , class Ifc32
 
-#define __PUBLIC_IFC31 public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10, public Ifc11, public Ifc12, \
+#define __PUBLIC_IFC32 public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10, public Ifc11, public Ifc12, \
 public Ifc13, public Ifc14, public Ifc15, public Ifc16, public Ifc17, public Ifc18, \
 public Ifc19, public Ifc20, public Ifc21, public Ifc22, public Ifc23, public Ifc24, \
 public Ifc25, public Ifc26, public Ifc27, public Ifc28, public Ifc29, public Ifc30, \
-public Ifc31
+public Ifc31, public Ifc32
 #include <cppuhelper/implbase_ex.hxx>
 #include <cppuhelper/implbase_ex_pre.hxx>
-#define __IFC_EX_TYPE_INIT31( class_cast ) \
+#define __IFC_EX_TYPE_INIT32( class_cast ) \
     __IFC_EX_TYPE_INIT( class_cast, 1 ), __IFC_EX_TYPE_INIT( class_cast, 2 ), \
     __IFC_EX_TYPE_INIT( class_cast, 3 ), __IFC_EX_TYPE_INIT( class_cast, 4 ), \
     __IFC_EX_TYPE_INIT( class_cast, 5 ), __IFC_EX_TYPE_INIT( class_cast, 6 ), \
     __IFC_EX_TYPE_INIT( class_cast, 25 ), __IFC_EX_TYPE_INIT( class_cast, 26 ), \
     __IFC_EX_TYPE_INIT( class_cast, 27 ), __IFC_EX_TYPE_INIT( class_cast, 28 ), \
     __IFC_EX_TYPE_INIT( class_cast, 29 ), __IFC_EX_TYPE_INIT( class_cast, 30 ), \
-    __IFC_EX_TYPE_INIT( class_cast, 31)
+    __IFC_EX_TYPE_INIT( class_cast, 31 ), __IFC_EX_TYPE_INIT( class_cast, 32)
 #include <cppuhelper/implbase_ex_post.hxx>
 
-__DEF_IMPLHELPER_EX( 31 )
+__DEF_IMPLHELPER_EX( 32 )
 
 class SwDoc;
 class SwDocShell;
  ******************************************************************************/
 
 
-typedef cppu::WeakImplHelper31
+typedef cppu::WeakImplHelper32
 <
 	::com::sun::star::text::XTextDocument,
 	::com::sun::star::text::XLineNumberingProperties,
     ::com::sun::star::view::XRenderable,
     ::com::sun::star::xforms::XFormsSupplier,
     ::com::sun::star::text::XFlatParagraphIteratorProvider,
-	::com::sun::star::document::XDocumentLanguages
+    ::com::sun::star::document::XDocumentLanguages,
+    ::com::sun::star::util::XCloneable
 >
 SwXTextDocumentBaseClass;
 
     // ::com::sun::star::text::XFlatParagraphIteratorProvider:
     virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XFlatParagraphIterator > SAL_CALL getFlatParagraphIterator(::sal_Int32 nTextMarkupType, sal_Bool bAutomatic ) throw (::com::sun::star::uno::RuntimeException);
 
-	//
+    // ::com::sun::star::util::XCloneable
+    virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone(  ) throw (::com::sun::star::uno::RuntimeException);
+    
+    
+    //
 	void						Invalidate();
 	void						Reactivate(SwDocShell* pNewDocShell);
 	SwXDocumentPropertyHelper * GetPropertyHelper ();

sw/source/core/doc/doccomp.cxx

 					SwPaM aCpyPam( rSrcNd, nStt );
 					aCpyPam.SetMark();
 					aCpyPam.GetPoint()->nContent = nSEnd;
-					aCpyPam.GetDoc()->Copy( aCpyPam, *aPam.GetPoint() );
+                    aCpyPam.GetDoc()->Copy( aCpyPam, *aPam.GetPoint(), false );
 					pDoc->DoUndo( bUndo );
 				}
 
 	SwNodeIndex aInsPos( *pLineNd, nOffset );
 	SwNodeIndex aSavePos( aInsPos, -1 );
 
-	((SwCompareData&)rData).rDoc.CopyWithFlyInFly( aRg, aInsPos );
+    ((SwCompareData&)rData).rDoc.CopyWithFlyInFly( aRg, 0, aInsPos );
 	rDoc.SetModified();
 	aSavePos++;
 
 		RedlineMode_t eOld = pDoc->GetRedlineMode();
 		pDoc->SetRedlineMode_intern((RedlineMode_t)(eOld | nsRedlineMode_t::REDLINE_IGNORE));
 
-		pSrcRedl->GetDoc()->Copy( *(SwPaM*)pSrcRedl, *pDestRedl->GetPoint() );
+        pSrcRedl->GetDoc()->Copy( *(SwPaM*)pSrcRedl, *pDestRedl->GetPoint(), false );
 
 		pDoc->SetRedlineMode_intern( eOld );
 		pDoc->DoUndo( bUndo );

sw/source/core/doc/docfmt.cxx

 				aTmpIdx = *pSttNd->EndOfSectionNode();
 				rSrcNds._Copy( aRg, aTmpIdx );
 				aTmpIdx = *pSttNd;
-				rSrcFmt.GetDoc()->_CopyFlyInFly( aRg, aTmpIdx );
+                rSrcFmt.GetDoc()->_CopyFlyInFly( aRg, 0, aTmpIdx );
                 pNewFmt->SetFmtAttr( SwFmtCntnt( pSttNd ));
 			}
 			else

sw/source/core/doc/docglbl.cxx

 						pDoc->GetNodes().Delete( aIdx, 1 );
 
 					// alle Flys in dem Bereich
-					_CopyFlyInFly( aRg, aIdx );
+                    _CopyFlyInFly( aRg, 0, aIdx );
 
 
 					// und noch alle Bookmarks
 						pDoc->GetNodes().Delete( aIdx, 1 );
 
 					// alle Flys in dem Bereich
-					_CopyFlyInFly( aRg, aIdx );
+                    _CopyFlyInFly( aRg, 0, aIdx );
 
 
 					// und noch alle Bookmarks

sw/source/core/doc/docglos.cxx

                 SwDontExpandItem aACD;
 				aACD.SaveDontExpandItems( rInsPos );
 
-                pGDoc->Copy( aCpyPam, rInsPos );
+                pGDoc->Copy( aCpyPam, rInsPos, false );
 
 				aACD.RestoreDontExpandItems( rInsPos );
 				if( pShell )

sw/source/core/doc/doclay.cxx

 
 		// sorge dafuer das auch Fly's in Fly's kopiert werden
 		aIdx = *pSttNd->EndOfSectionNode();
-		pSrcDoc->CopyWithFlyInFly( aRg, aIdx, sal_False, sal_True, sal_True );
+        pSrcDoc->CopyWithFlyInFly( aRg, 0, aIdx, sal_False, sal_True, sal_True );
 	}
 	else
 	{
 				do {
 					if( pTmp->HasMark() &&
 						*pTmp->GetPoint() != *pTmp->GetMark() )
-						Copy( *pTmp, aPos );
+                        Copy( *pTmp, aPos, false );
 				} while( &rPam != ( pTmp = (SwPaM*)pTmp->GetNext() ) );
 				mbCopyIsMove = bOldFlag;
 				mbUndo = bOldUndo;

sw/source/core/doc/docnew.cxx

 #include "precompiled_sw.hxx"
 #define ROLBCK_HISTORY_ONLY 	// Der Kampf gegen die CLOOK's
 #include <doc.hxx>
+#include <dcontact.hxx>
 #include <com/sun/star/document/PrinterIndependentLayout.hpp>
 #include <com/sun/star/document/UpdateDocMode.hpp>
 #include <com/sun/star/text/XTextDocument.hpp>
 
 #include <svtools/macitem.hxx>
 #include <svx/svxids.hrc>
+#include <svx/svdogrp.hxx>
 #include <svx/linkmgr.hxx>
 #include <svx/forbiddencharacterstable.hxx>
 #include <svtools/zforlist.hxx>
 #include <istyleaccess.hxx>
 #include <swstylemanager.hxx>
 #include <IGrammarContact.hxx>
+#include <tblsel.hxx>
 #include <MarkManager.hxx>
-
 #include <unochart.hxx>
 
 #include <cmdid.h>              // fuer den dflt - Printer in SetJob
    pTOXTypes->Insert( pNew, pTOXTypes->Count() );
 }
 
+/*-- 08.05.2009 10:07:57---------------------------------------------------
+
+  -----------------------------------------------------------------------*/
+SwDoc* SwDoc::CreateCopy() const
+{
+    SwDoc* pRet = new SwDoc;
+    //copy settings
+/*
+    //aNodes( this ),
+    //aUndoNodes( this ),
+    mpAttrPool(new SwAttrPool(this)),*/
+    USHORT __FAR_DATA aRangeOfDefaults[] = {
+        RES_FRMATR_BEGIN, RES_FRMATR_END-1,
+        RES_CHRATR_BEGIN, RES_CHRATR_END-1,
+        RES_PARATR_BEGIN, RES_PARATR_END-1,
+        // --> OD 2008-02-25 #refactorlists##
+        RES_PARATR_LIST_BEGIN, RES_PARATR_LIST_END-1,
+        // <--
+        RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
+        0
+    };
+
+    SfxItemSet aNewDefaults( pRet->GetAttrPool(), aRangeOfDefaults );
+
+    USHORT nWhich;
+    USHORT nRange = 0;
+    while( aRangeOfDefaults[nRange] != 0)
+    {
+        for( nWhich = aRangeOfDefaults[nRange]; nWhich < aRangeOfDefaults[nRange + 1]; ++nWhich )
+        {
+            const SfxPoolItem& rSourceAttr = mpAttrPool->GetDefaultItem( nWhich );
+            if( rSourceAttr != pRet->mpAttrPool->GetDefaultItem( nWhich ) )
+                aNewDefaults.Put( rSourceAttr );
+        }
+        nRange += 2;
+    }
+    if( aNewDefaults.Count() )
+        pRet->SetDefault( aNewDefaults );
+    
+    /*
+    pDfltFrmFmt( new SwFrmFmt( GetAttrPool(), sFrmFmtStr, 0 ) ),
+    pEmptyPageFmt( new SwFrmFmt( GetAttrPool(), sEmptyPageStr, pDfltFrmFmt ) ),
+    pColumnContFmt( new SwFrmFmt( GetAttrPool(), sColumnCntStr, pDfltFrmFmt ) ),
+    pDfltCharFmt( new SwCharFmt( GetAttrPool(), sCharFmtStr, 0 ) ),
+    pDfltTxtFmtColl( new SwTxtFmtColl( GetAttrPool(), sTxtCollStr ) ),
+    pDfltGrfFmtColl( new SwGrfFmtColl( GetAttrPool(), sGrfCollStr ) ),
+    pFrmFmtTbl( new SwFrmFmts() ),
+    pCharFmtTbl( new SwCharFmts() ),
+    pSpzFrmFmtTbl( new SwSpzFrmFmts() ),
+    pSectionFmtTbl( new SwSectionFmts() ),
+    pTblFrmFmtTbl( new SwFrmFmts() ),
+    pTxtFmtCollTbl( new SwTxtFmtColls() ),
+    pGrfFmtCollTbl( new SwGrfFmtColls() ),
+    pBookmarkTbl( new SwBookmarks( 0, 16 ) ),
+    pTOXTypes( new SwTOXTypes() ),
+    pDefTOXBases( new SwDefTOXBase_Impl() ),
+    pLayout( 0 ),                   // Rootframe des spezifischen Layouts.
+    pDrawModel( 0 ),
+    pUndos( new SwUndos( 0, 20 ) ),
+    pUpdtFlds( new SwDocUpdtFld() ),
+    pFldTypes( new SwFldTypes() ),
+    pVirDev( 0 ),
+    pPrt( 0 ),
+    pPrtData( 0 ),
+    pGlossaryDoc( 0 ),
+    pOutlineRule( 0 ),
+    pFtnInfo( new SwFtnInfo ),
+    pEndNoteInfo( new SwEndNoteInfo ),
+    pLineNumberInfo( new SwLineNumberInfo ),
+    pFtnIdxs( new SwFtnIdxs ),
+    pDocStat( new SwDocStat ),
+    pDocShell( 0 ),
+    pDocShRef( 0 ),
+    pLinkMgr( new SvxLinkManager( 0 ) ),
+    pACEWord( 0 ),
+    pURLStateChgd( 0 ),
+    pNumberFormatter( 0 ),
+    pNumRuleTbl( new SwNumRuleTbl ),
+    // --> OD 2008-03-26 #refactorlists#
+    maLists(),
+    maListStyleLists(),
+    // <--
+    pRedlineTbl( new SwRedlineTbl ),
+    pAutoFmtRedlnComment( 0 ),
+    pUnoCrsrTbl( new SwUnoCrsrTbl( 0, 16 ) ),
+    pPgPViewPrtData( 0 ),
+    pExtInputRing( 0 ),
+    pLayouter( 0 ),
+    // --> OD 2008-03-07 #refactorlists#
+    pStyleAccess( 0 ),
+    // <--
+    pLayoutCache( 0 ),
+    pUnoCallBack(new SwUnoCallBack(0)),
+    mpGrammarContact( 0 ),
+    aChartDataProviderImplRef(),
+    pChartControllerHelper( 0 ),
+    // --> OD 2007-10-31 #i83479#
+    mpListItemsList( new tImplSortedNodeNumList() ),
+    // <--
+    nUndoPos( 0 ),
+    nUndoSavePos( 0 ),
+    nUndoCnt( 0 ),
+    nUndoSttEnd( 0 ),
+    nAutoFmtRedlnCommentNo( 0 ),
+    nLinkUpdMode( GLOBALSETTING ),
+    eFldUpdMode( AUTOUPD_GLOBALSETTING ),
+    eRedlineMode((RedlineMode_t)(nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE)),
+    eChrCmprType( CHARCOMPRESS_NONE ),
+    mReferenceCount(0),
+    mIdleBlockCount(0),
+    nLockExpFld( 0 ),
+    mbReadlineChecked(false),
+    mbWinEncryption(sal_False),
+    // --> OD 2005-02-11 #i38810#
+    mbLinksUpdated( sal_False ),
+    mbClipBoard( false ),
+    mbColumnSelection( false ),
+    // i#78591#
+    mbProtectForm(false),*/
+    pRet->n32DummyCompatabilityOptions1 = n32DummyCompatabilityOptions1;
+    pRet->n32DummyCompatabilityOptions2 = n32DummyCompatabilityOptions2;
+    /*
+    mbStartIdleTimer(sal_False)
+{
+    RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722",  "SwDoc::SwDoc" );
+
+    mbGlossDoc =
+    mbModified =
+    mbDtor =
+    mbUndo =
+    mbPageNums =
+    mbLoaded =
+    mbUpdateExpFld =
+    mbNewDoc =
+    mbCopyIsMove =
+    mbNoDrawUndoObj =
+    mbBrowseMode =
+    mbInReading =
+    mbInXMLImport =
+    mbUpdateTOX =
+    mbInLoadAsynchron =
+    mbHTMLMode =
+    mbInCallModified =
+    mbIsGlobalDoc =
+    mbGlblDocSaveLinks =
+    mbIsLabelDoc =
+    mbIsAutoFmtRedline =
+    mbOLEPrtNotifyPending =
+    mbAllOLENotify =
+    mbIsRedlineMove =
+    mbInsOnlyTxtGlssry =
+    mbContains_MSVBasic =
+    mbKernAsianPunctuation =
+#ifndef PRODUCT
+    mbXMLExport =
+#endif
+    // --> OD 2006-03-21 #b6375613#
+    mbApplyWorkaroundForB6375613 =
+    // <--
+                            false;
+
+    mbGroupUndo =
+    mbNewFldLst =
+    mbVisibleLinks =
+    mbPurgeOLE =
+                            true;
+
+    //
+    // COMPATIBILITY FLAGS START
+    //
+
+    // Note: Any non-hidden compatibility flag should obtain its default
+    // by asking SvtCompatibilityOptions, see below.
+    //
+    const SvtCompatibilityOptions aOptions;
+     */ 
+    pRet->mbParaSpaceMax                          = mbParaSpaceMax                          ;
+    pRet->mbParaSpaceMaxAtPages                   = mbParaSpaceMaxAtPages                   ;
+    pRet->mbTabCompat                             = mbTabCompat                             ;
+    pRet->mbUseVirtualDevice                      = mbUseVirtualDevice                      ;
+    pRet->mbAddExternalLeading                    = mbAddExternalLeading                    ;
+    pRet->mbOldLineSpacing                        = mbOldLineSpacing                        ;
+    pRet->mbAddParaSpacingToTableCells            = mbAddParaSpacingToTableCells            ;
+    pRet->mbUseFormerObjectPos                    = mbUseFormerObjectPos                    ;
+    pRet->mbUseFormerTextWrapping                 = mbUseFormerTextWrapping                 ;
+    pRet->mbConsiderWrapOnObjPos                  = mbConsiderWrapOnObjPos                  ;
+    pRet->mbAddFlyOffsets                         = mbAddFlyOffsets                         ;
+    pRet->mbOldNumbering                          = mbOldNumbering                          ;
+    pRet->mbUseHiResolutionVirtualDevice          = mbUseHiResolutionVirtualDevice          ;
+    pRet->mbIgnoreFirstLineIndentInNumbering      = mbIgnoreFirstLineIndentInNumbering      ;
+    pRet->mbDoNotJustifyLinesWithManualBreak      = mbDoNotJustifyLinesWithManualBreak      ;
+    pRet->mbDoNotResetParaAttrsForNumFont         = mbDoNotResetParaAttrsForNumFont         ;
+    pRet->mbOutlineLevelYieldsOutlineRule         = mbOutlineLevelYieldsOutlineRule         ;
+    pRet->mbTableRowKeep                          = mbTableRowKeep                          ;
+    pRet->mbIgnoreTabsAndBlanksForLineCalculation = mbIgnoreTabsAndBlanksForLineCalculation ;
+    pRet->mbDoNotCaptureDrawObjsOnPage            = mbDoNotCaptureDrawObjsOnPage            ;
+    pRet->mbClipAsCharacterAnchoredWriterFlyFrames= mbClipAsCharacterAnchoredWriterFlyFrames;
+    pRet->mbUnixForceZeroExtLeading               = mbUnixForceZeroExtLeading               ;
+    pRet->mbOldPrinterMetrics                     = mbOldPrinterMetrics                     ;
+    pRet->mbTabRelativeToIndent                   = mbTabRelativeToIndent                   ;
+    pRet->mbTabAtLeftIndentForParagraphsInList    = mbTabAtLeftIndentForParagraphsInList    ;
+                                            
+    //                                      
+    // COMPATIBILITY FLAGS END
+    //
+    /*
+    pMacroTable = new SvxMacroTableDtor;
+    
+    mpGrammarContact = ::createGrammarContact();
+
+    // Formate
+    pFrmFmtTbl->Insert(pDfltFrmFmt, 0 );
+    pCharFmtTbl->Insert(pDfltCharFmt, 0 );
+
+    // FmtColls 
+    // TXT
+    pTxtFmtCollTbl->Insert(pDfltTxtFmtColl, 0 );
+    // GRF
+    pGrfFmtCollTbl->Insert(pDfltGrfFmtColl, 0 );
+
+    // PageDesc, EmptyPageFmt und ColumnFmt anlegen
+    if ( !aPageDescs.Count() )
+        GetPageDescFromPool( RES_POOLPAGE_STANDARD );
+
+        //Leere Seite Einstellen.
+    pEmptyPageFmt->SetFmtAttr( SwFmtFrmSize( ATT_FIX_SIZE ) );
+        //BodyFmt fuer Spalten Einstellen.
+    pColumnContFmt->SetFmtAttr( SwFmtFillOrder( ATT_LEFT_TO_RIGHT ) );
+
+    _InitFieldTypes();
+
+    // lege (fuer die Filter) eine Default-OutlineNumRule an
+    // --> OD 2008-02-11 #newlistlevelattrs#
+    pOutlineRule = new SwNumRule( String::CreateFromAscii( SwNumRule::GetOutlineRuleName() ),
+                                  // --> OD 2008-06-06 #i89178#
+                                  numfunc::GetDefaultPositionAndSpaceMode(),
+                                  // <--
+                                  OUTLINE_RULE );
+    // <--
+    // #115901#
+    AddNumRule(pOutlineRule);
+    // --> OD 2005-10-21 - counting of phantoms depends on <IsOldNumbering()>
+    pOutlineRule->SetCountPhantoms( !get(IDocumentSettingAccess::OLD_NUMBERING) );
+    // <--
+
+    new SwTxtNode( SwNodeIndex( aUndoNodes.GetEndOfContent() ), pDfltTxtFmtColl );
+    new SwTxtNode( SwNodeIndex( aNodes.GetEndOfContent() ),
+                    GetTxtCollFromPool( RES_POOLCOLL_STANDARD ));
+
+    // den eigenen IdleTimer setzen
+    aIdleTimer.SetTimeout( 600 );
+    aIdleTimer.SetTimeoutHdl( LINK(this, SwDoc, DoIdleJobs) );
+
+    aOLEModifiedTimer.SetTimeout( 1000 );
+    aOLEModifiedTimer.SetTimeoutHdl( LINK( this, SwDoc, DoUpdateModifiedOLE ));
+
+    // DBMgr anlegen
+    pNewDBMgr = new SwNewDBMgr;
+
+    // create TOXTypes
+    ShellResource* pShellRes = ViewShell::GetShellRes();
+
+    SwTOXType * pNew = new SwTOXType(TOX_CONTENT,   pShellRes->aTOXContentName        );
+    pTOXTypes->Insert( pNew, pTOXTypes->Count() );
+    pNew = new SwTOXType(TOX_INDEX,                 pShellRes->aTOXIndexName  );
+    pTOXTypes->Insert( pNew, pTOXTypes->Count() );
+    pNew = new SwTOXType(TOX_USER,                  pShellRes->aTOXUserName  );
+    pTOXTypes->Insert( pNew, pTOXTypes->Count() );
+    pNew = new SwTOXType(TOX_ILLUSTRATIONS,         pShellRes->aTOXIllustrationsName );
+    pTOXTypes->Insert( pNew, pTOXTypes->Count() );
+    pNew = new SwTOXType(TOX_OBJECTS,               pShellRes->aTOXObjectsName       );
+    pTOXTypes->Insert( pNew, pTOXTypes->Count() );
+    pNew = new SwTOXType(TOX_TABLES,                pShellRes->aTOXTablesName        );
+    pTOXTypes->Insert( pNew, pTOXTypes->Count() );
+    pNew = new SwTOXType(TOX_AUTHORITIES,           pShellRes->aTOXAuthoritiesName   );
+    pTOXTypes->Insert( pNew, pTOXTypes->Count() );
+
+    {
+        SfxItemSet aIgnorableParagraphItems( GetAttrPool(),
+                                             RES_PARATR_LIST_BEGIN, RES_PARATR_LIST_END-1,
+                                             0 );
+        pStyleAccess = createStyleManager( &aIgnorableParagraphItems );
+    }
+
+    ResetModified();
+
+*/    
+    //copy content 
+    pRet->Paste( *this );
+    return pRet;
+}
+/*-- 08.05.2009 10:52:40---------------------------------------------------
+    copy document content - code from SwFEShell::Paste( SwDoc* , BOOL  )
+  -----------------------------------------------------------------------*/
+void SwDoc::Paste( const SwDoc& rSource )
+{
+//  this has to be empty const USHORT nStartPageNumber = GetPhyPageNum();
+    // until the end of the NodesArray
+    SwNodeIndex aSourceIdx( rSource.GetNodes().GetEndOfExtras(), 2 );
+    SwPaM aCpyPam( aSourceIdx ); //DocStart
+    SwNodeIndex aTargetIdx( GetNodes().GetEndOfExtras(), 2 );
+    SwPaM aInsertPam( aTargetIdx ); //replaces PCURCRSR from SwFEShell::Paste()
+
+
+    aCpyPam.SetMark();
+    aCpyPam.Move( fnMoveForward, fnGoDoc );
+
+    this->StartUndo( UNDO_INSGLOSSARY, NULL );
+    this->LockExpFlds();
+
+    {
+        SwPosition& rInsPos = *aInsertPam.GetPoint();
+        //find out if the clipboard document starts with a table
+        bool bStartWithTable = 0 != aCpyPam.Start()->nNode.GetNode().FindTableNode();
+        SwPosition aInsertPosition( rInsPos );
+
+        {
+            SwNodeIndex aIndexBefore(rInsPos.nNode);
+
+            aIndexBefore--;
+
+            rSource.Copy( aCpyPam, rInsPos, true );
+
+            {
+                aIndexBefore++;
+                SwPaM aPaM(SwPosition(aIndexBefore, 0),
+                           SwPosition(rInsPos.nNode, 0));
+
+                MakeUniqueNumRules(aPaM);
+            }
+        }
+
+        //TODO: Is this necessary here? SaveTblBoxCntnt( &rInsPos );
+        if(/*bIncludingPageFrames && */bStartWithTable)
+        {
+            //remove the paragraph in front of the table
+            SwPaM aPara(aInsertPosition);
+            this->DelFullPara(aPara);
+        }
+        //additionally copy page bound frames
+        if( /*bIncludingPageFrames && */rSource.GetSpzFrmFmts()->Count() )
+        {
+            for ( USHORT i = 0; i < rSource.GetSpzFrmFmts()->Count(); ++i )
+            {
+                BOOL bInsWithFmt = TRUE;
+                const SwFrmFmt& rCpyFmt = *(*rSource.GetSpzFrmFmts())[i];
+                if( bInsWithFmt  )
+                {
+                    SwFmtAnchor aAnchor( rCpyFmt.GetAnchor() );
+                    if( FLY_PAGE == aAnchor.GetAnchorId() )
+                    {
+                        aAnchor.SetPageNum( aAnchor.GetPageNum() + /*nStartPageNumber - */1 );
+                    }
+                    else
+                        continue;
+                    this->CopyLayoutFmt( rCpyFmt, aAnchor, true, true );
+                }
+            }
+        }
+    }
+
+    this->EndUndo( UNDO_INSGLOSSARY, NULL );
+
+    UnlockExpFlds();
+    UpdateFlds(NULL, false);
+}

sw/source/core/doc/docnum.cxx

                 }
             }
 
-			Copy( aPam, aInsPos );
+            Copy( aPam, aInsPos, false );
 			if( bDelLastPara )
 			{
 				// dann muss der letzte leere Node wieder entfernt werden

sw/source/core/doc/docredln.cxx

 			SwNodeIndex aNdIdx( *pSttNd, 1 );
 			SwTxtNode* pTxtNd = aNdIdx.GetNode().GetTxtNode();
 			SwPosition aPos( aNdIdx, SwIndex( pTxtNd ));
-			pDoc->Copy( *this, aPos );
+            pDoc->Copy( *this, aPos, false );
 
 			// JP 08.10.98: die Vorlage vom EndNode ggfs. mit uebernehmen
 			//				- ist im Doc::Copy nicht erwuenscht
 			if( pCEndNd )
 			{
 				SwPosition aPos( *pSttNd->EndOfSectionNode() );
-				pDoc->Copy( *this, aPos );
+                pDoc->Copy( *this, aPos, false );
 			}
 			else
 			{
 				SwNodeIndex aInsPos( *pSttNd->EndOfSectionNode() );
 				SwNodeRange aRg( pStt->nNode, 0, pEnd->nNode, 1 );
-				pDoc->CopyWithFlyInFly( aRg, aInsPos );
+                pDoc->CopyWithFlyInFly( aRg, 0, aInsPos );
 			}
 		}
 		pCntntSect = new SwNodeIndex( *pSttNd );

sw/source/core/doc/swserv.cxx

     if(eType == BOOKMARK_SERVER && CNTNT_TYPE.pBkmk)
     {
         ::sw::mark::DdeBookmark* const pDdeBookmark = dynamic_cast< ::sw::mark::DdeBookmark* >(CNTNT_TYPE.pBkmk);
-        if(pDdeBookmark) pDdeBookmark->SetRefObject(NULL);
+        if(pDdeBookmark) 
+		{
+            CNTNT_TYPE.pBkmk = 0, eType = NONE_SERVER;
+			pDdeBookmark->SetRefObject(NULL);
+		}
     }
-    CNTNT_TYPE.pBkmk = 0, eType = NONE_SERVER;
 }
 
 void SwServerObject::SetDdeBookmark( ::sw::mark::IMark& rBookmark)

sw/source/core/doc/tblcpy.cxx

 
 	SwNodeIndex aSavePos( aInsIdx, -1 );
     if( pRg.get() )
-        pCpyDoc->CopyWithFlyInFly( *pRg, aInsIdx, FALSE );
+        pCpyDoc->CopyWithFlyInFly( *pRg, 0, aInsIdx, FALSE );
     else
 		pDoc->GetNodes().MakeTxtNode( aInsIdx, (SwTxtFmtColl*)pDoc->GetDfltTxtFmtColl() );
 	aSavePos++;

sw/source/core/doc/tblrwcl.cxx

                             *rpFndBox->GetBox()->GetSttNd()->EndOfSectionNode() );
                 SwNodeIndex aInsIdx( *pBox->GetSttNd(), 1 );
 
-                pFromDoc->CopyWithFlyInFly( aCpyRg, aInsIdx, FALSE );
+                pFromDoc->CopyWithFlyInFly( aCpyRg, 0, aInsIdx, FALSE );
                 // den initialen TextNode loeschen
                 pCpyPara->pDoc->GetNodes().Delete( aInsIdx, 1 );
             }

sw/source/core/docnode/ndcopy.cxx

 
 // Kopieren eines Bereiches im oder in ein anderes Dokument !
 
-bool SwDoc::Copy( SwPaM& rPam, SwPosition& rPos ) const
+bool SwDoc::Copy( SwPaM& rPam, SwPosition& rPos, bool bCopyAll ) const
 {
 	const SwPosition *pStt = rPam.Start(), *pEnd = rPam.End();
 
 	BOOL bRet = FALSE;
 
 	if( pDoc != this )
-        bRet = _Copy( rPam, rPos, TRUE, pRedlineRange );    // nur normales Kopieren
+        bRet = _Copy( rPam, rPos, TRUE, bCopyAll, pRedlineRange );    // nur normales Kopieren
 	// Copy in sich selbst (ueber mehrere Nodes wird hier gesondert
 	// behandelt; in einem TextNode wird normal behandelt)
 	else if( ! ( *pStt <= rPos && rPos < *pEnd &&
 			( pStt->nNode != pEnd->nNode ||
 			  !pStt->nNode.GetNode().IsTxtNode() )) )
-		bRet = _Copy( rPam, rPos, TRUE, pRedlineRange );	// nur normales Kopieren
+		bRet = _Copy( rPam, rPos, TRUE, bCopyAll, pRedlineRange );	// nur normales Kopieren
 
 	else
 	{
 		SwStartNode* pSttNd = pDoc->GetNodes().MakeEmptySection(
 								SwNodeIndex( GetNodes().GetEndOfAutotext() ));
 		aPam.GetPoint()->nNode = *pSttNd->EndOfSectionNode();
-		pDoc->_Copy( rPam, *aPam.GetPoint(), FALSE );		// kopieren ohne Frames
+		pDoc->_Copy( rPam, *aPam.GetPoint(), FALSE, bCopyAll, 0 );		// kopieren ohne Frames
 
 		aPam.GetPoint()->nNode = pDoc->GetNodes().GetEndOfAutotext();
 		aPam.SetMark();
 }
 
 BOOL SwDoc::_Copy( SwPaM& rPam, SwPosition& rPos,
-					BOOL bMakeNewFrms, SwPaM* pCpyRange ) const
+					BOOL bMakeNewFrms, bool bCopyAll, SwPaM* pCpyRange ) const
 {
 	SwDoc* pDoc = rPos.nNode.GetNode().GetDoc();
     bool bColumnSel = pDoc->IsClipBoard() && pDoc->IsColumnSelection();
 			}
 		}
 
-		if( aRg.aStart != aRg.aEnd )
+		if( bCopyAll || aRg.aStart != aRg.aEnd )
 		{
 			SfxItemSet aBrkSet( pDoc->GetAttrPool(), aBreakSetRange );
             if( pSttNd && bCopyCollFmt && pDestNd->HasSwAttrSet() )
 			if( aInsPos == pEnd->nNode )
 			{
 				SwNodeIndex aSaveIdx( aInsPos, -1 );
-				CopyWithFlyInFly( aRg, aInsPos, bMakeNewFrms, FALSE );
+                CopyWithFlyInFly( aRg, 0,aInsPos, bMakeNewFrms, FALSE );
 				aSaveIdx++;
 				pEnd->nNode = aSaveIdx;
 				pEnd->nContent.Assign( aSaveIdx.GetNode().GetTxtNode(), 0 );
 			}
 			else
-				CopyWithFlyInFly( aRg, aInsPos, bMakeNewFrms, FALSE );
+                CopyWithFlyInFly( aRg, pEnd->nContent.GetIndex(), aInsPos, bMakeNewFrms, FALSE );
 
 			bCopyBookmarks = FALSE;
 
 
 //  ----- Copy-Methode vom SwDoc - "kopiere Fly's in Fly's" ------
 
-void SwDoc::CopyWithFlyInFly( const SwNodeRange& rRg,
+void SwDoc::CopyWithFlyInFly( const SwNodeRange& rRg, const xub_StrLen nEndContentIndex, 
 							const SwNodeIndex& rInsPos, BOOL bMakeNewFrms,
 							BOOL bDelRedlines, BOOL bCopyFlyAtFly ) const
 {
 	// Undo abschalten
 	BOOL bUndo = pDest->DoesUndo();
 	pDest->DoUndo( FALSE );
-	_CopyFlyInFly( rRg, aSavePos, bCopyFlyAtFly );
+	_CopyFlyInFly( rRg, nEndContentIndex, aSavePos, bCopyFlyAtFly );
 	pDest->DoUndo( bUndo );
 
 	SwNodeRange aCpyRange( aSavePos, rInsPos );
 	}
 }
 
-void SwDoc::_CopyFlyInFly( const SwNodeRange& rRg, const SwNodeIndex& rSttIdx,
+void SwDoc::_CopyFlyInFly( const SwNodeRange& rRg, const xub_StrLen nEndContentIndex, const SwNodeIndex& rSttIdx,
 							BOOL bCopyFlyAtFly ) const
 {
 	// Bug 22727: suche erst mal alle Flys zusammen, sortiere sie entsprechend
 		const SwFrmFmt* pFmt = (*GetSpzFrmFmts())[n];
 		const SwFmtAnchor* pAnchor = &pFmt->GetAnchor();
 		const SwPosition* pAPos;
-		if ( ( pAnchor->GetAnchorId() == FLY_AT_CNTNT ||
+        bool bAtCntnt = pAnchor->GetAnchorId() == FLY_AT_CNTNT;
+		if ( ( bAtCntnt ||
 			   pAnchor->GetAnchorId() == FLY_AT_FLY ||
 			   pAnchor->GetAnchorId() == FLY_AUTO_CNTNT ) &&
 			 0 != ( pAPos = pAnchor->GetCntntAnchor()) &&
 					: ( IsRedlineMove()
 							? rRg.aStart < pAPos->nNode
 							: rRg.aStart <= pAPos->nNode )) &&
-			 pAPos->nNode < rRg.aEnd )
+			 pAPos->nNode <= rRg.aEnd )
 		{
-			aArr.Insert( _ZSortFly( pFmt, pAnchor, nArrLen + aArr.Count() ));
+			//frames at the last source node are not always copied:
+            //- if the node is empty and is the last node of the document or a table cell
+            //  or a text frame then tey have to be copied
+            //- if the content index in this node is > 0 then paragph and frame bound objects are copied
+            //- to-character bound objects are copied if their index is <= nEndContentIndex
+            bool bAdd = false;
+            if( pAPos->nNode < rRg.aEnd )
+                bAdd = true;
+            if( !bAdd )
+            {
+                bool bEmptyNode = false;
+                bool bLastNode = false;
+                // is the node empty?
+                const SwNodes& rNodes = pAPos->nNode.GetNodes();
+                SwTxtNode* pTxtNode;
+                if( 0 != ( pTxtNode = pAPos->nNode.GetNode().GetTxtNode() ))
+                {
+                    bEmptyNode = !pTxtNode->GetTxt().Len();
+                    if( bEmptyNode )
+                    {
+                        //last node information is only necessary to know for the last TextNode
+                        SwNodeIndex aTmp( pAPos->nNode );
+                        ++aTmp;//goto next node
+                        while( rNodes[aTmp ]->IsEndNode() )
+                        {
+                            if( aTmp == rNodes.GetEndOfContent().GetIndex() )
+                            {
+                                bLastNode = true;
+                                break;
+                            }
+                            ++aTmp;
+                        }
+                    }
+                }
+                bAdd = bLastNode && bEmptyNode;
+                if( !bAdd )
+                {
+                    if( bAtCntnt )
+                        bAdd = nEndContentIndex > 0;
+                    else 
+                        bAdd = pAPos->nContent <= nEndContentIndex;
+                }
+            }
+            if( bAdd )                
+                aArr.Insert( _ZSortFly( pFmt, pAnchor, nArrLen + aArr.Count() ));
 		}
 	}
 

sw/source/core/docnode/section.cxx

 						if( pSrcDoc != pDoc ||
 							pCpyPam->Start()->nNode > rInsPos ||
 							rInsPos >= pCpyPam->End()->nNode )
-							pSrcDoc->Copy( *pCpyPam, *pPam->GetPoint() );
+                            pSrcDoc->Copy( *pCpyPam, *pPam->GetPoint(), false );
 						delete pCpyPam;
 					}
 					if( pCpyRg && pSrcDoc == pDoc &&
 
 					SwTblNumFmtMerge aTNFM( *pSrcDoc, *pDoc );
 
-					pSrcDoc->CopyWithFlyInFly( *pCpyRg, rInsPos, bCreateFrm );
+                    pSrcDoc->CopyWithFlyInFly( *pCpyRg, 0, rInsPos, bCreateFrm );
 					aSave++;
 
 					if( !bCreateFrm )

sw/source/core/edit/acorrect.cxx

 				SwDontExpandItem aExpItem;
 				aExpItem.SaveDontExpandItems( *aPam.GetPoint() );
 
-				pAutoDoc->Copy( aCpyPam, *aPam.GetPoint() );
+                pAutoDoc->Copy( aCpyPam, *aPam.GetPoint(), false );
 
 				aExpItem.RestoreDontExpandItems( *aPam.GetPoint() );
 

sw/source/core/edit/eddel.cxx

 			bFirstMove = FALSE;
 		}
 
-		if( !GetDoc()->Copy( *PCURCRSR, *pPos ))
+        if( !GetDoc()->Copy( *PCURCRSR, *pPos, false ))
 			continue;
 
         SwPaM aInsertPaM(*pPos, SwPosition(aSttNdIdx));

sw/source/core/edit/edglss.cxx

 			aStt = pGDoc->GetNodes().GetEndOfExtras();
 			pCntntNd = pGDoc->GetNodes().GoNext( &aStt );
 			SwPosition aInsPos( aStt, SwIndex( pCntntNd ));
-            pMyDoc->Copy( aCpyPam, aInsPos );
+            pMyDoc->Copy( aCpyPam, aInsPos, false );
 
 			nRet = rBlock.PutDoc();
 		}
 				{
 					PCURCRSR->SetMark();
 					PCURCRSR->Move( fnMoveForward, fnGoCntnt );
-                    bRet = GetDoc()->Copy( *PCURCRSR, aPos ) || bRet;
+                    bRet = GetDoc()->Copy( *PCURCRSR, aPos, false ) || bRet;
 					PCURCRSR->Exchange();
 					PCURCRSR->DeleteMark();
 				}
 			}
 			else
-				bRet = GetDoc()->Copy( *PCURCRSR, aPos ) || bRet;
+                bRet = GetDoc()->Copy( *PCURCRSR, aPos, false ) || bRet;
 
 		FOREACHPAM_END()
         }

sw/source/core/frmedt/fecopy.cxx

             {
                 SwNodeIndex aIndexBefore(rInsPos.nNode);
                 aIndexBefore--;
-                pClpDoc->Copy( rCopy, rInsPos );
+                pClpDoc->Copy( rCopy, rInsPos, false );
                 {
                     aIndexBefore++;
                     SwPaM aPaM(SwPosition(aIndexBefore, 0),
 
                 aIndexBefore--;
 
-                pClpDoc->Copy( aCpyPam, rInsPos );
+                pClpDoc->Copy( aCpyPam, rInsPos, false );
 
                 {
                     aIndexBefore++;

sw/source/core/txtnode/atrftn.cxx

 		SwNodeIndex aEnd( *aStart.GetNode().EndOfSectionNode() );
 		ULONG  nDestLen = aEnd.GetIndex() - aStart.GetIndex() - 1;
 
-        m_pTxtNode->GetDoc()->CopyWithFlyInFly( aRg, aEnd, TRUE );
+        m_pTxtNode->GetDoc()->CopyWithFlyInFly( aRg, 0, aEnd, TRUE );
 
 		// Wenn die Dest-Sektion nicht leer war, so muessen die alten
 		// Nodes geloescht werden:

sw/source/core/undo/untblk.cxx

 
 	SwPaM aPam( *rUndoIter.pAktPam->GetPoint() );
 	SetPaM( aPam );
-	aPam.GetDoc()->Copy( aPam, *rUndoIter.pAktPam->GetPoint() );
+    aPam.GetDoc()->Copy( aPam, *rUndoIter.pAktPam->GetPoint(), false );
 
 	rUndoIter.pLastUndoObj = this;
 }

sw/source/filter/ww8/ww8glsy.cxx

                         -1 );
                     pCNd = aIdx.GetNode().GetCntntNode();
                     SwPosition aPos( aIdx, SwIndex( pCNd, pCNd->Len() ));
-                    pD->Copy( aPam, aPos );
+                    pD->Copy( aPam, aPos, false );
                     rBlocks.PutDoc();
                 }
             }

sw/source/filter/xml/xmltbli.cxx

 					SwPaM aSrcPaM( *pSrcPaM->GetPoint(),
 								   *pSrcPaM->GetMark() );
 					SwPosition aDstPos( *pDstTxtCrsr->GetPaM()->GetPoint() );
-					pDoc->Copy( aSrcPaM, aDstPos );
+                    pDoc->Copy( aSrcPaM, aDstPos, false );
 
 					nColRepeat--;
 				}

sw/source/ui/dbui/dbmgr.cxx

 #endif
 
 #include <stdio.h>
-
+#include <unotxdoc.hxx>
 #include <com/sun/star/text/NotePrintMode.hpp>
 #include <sfx2/app.hxx>
 #include <com/sun/star/sdb/CommandType.hpp>
 #include <com/sun/star/frame/XComponentLoader.hpp>
 #include <com/sun/star/lang/DisposedException.hpp>
 #include <com/sun/star/lang/XEventListener.hpp>
-#ifndef _COM_SUN_STAR_UTIL_iXNUMBERFORMATTER_HPP_
 #include <com/sun/star/util/XNumberFormatter.hpp>
-#endif
 #include <com/sun/star/sdb/XCompletedConnection.hpp>
 #include <com/sun/star/sdb/XCompletedExecution.hpp>
 #include <com/sun/star/container/XChild.hpp>
-#ifndef _COM_SUN_STAR_TEXT_MAILMERGEEVENT_
 #include <com/sun/star/text/MailMergeEvent.hpp>
-#endif
 #include <com/sun/star/frame/XStorable.hpp>
-#include "com/sun/star/ui/dialogs/TemplateDescription.hpp"
+#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
 #include <com/sun/star/ui/dialogs/XFilePicker.hpp>
 #include <com/sun/star/ui/dialogs/XFilterManager.hpp>
 #include <com/sun/star/uno/XNamingService.hpp>
 #include <dbconfig.hxx>
 #include <swdbtoolsclient.hxx>
 #include <pagedesc.hxx>
-#ifndef _LSTBOX_HXX //autogen
 #include <vcl/lstbox.hxx>
-#endif
 #include <unotools/tempfile.hxx>
 #include <svtools/pathoptions.hxx>
 #include <svtools/urihelper.hxx>
 #include <goodies/mailenum.hxx>
 #include <cmdid.h>
 #include <swmodule.hxx>
-#ifndef _VIEW_HXX
 #include <view.hxx>
-#endif
-#ifndef _DOCSH_HXX
 #include <docsh.hxx>
-#endif
 #include <edtwin.hxx>
 #include <wrtsh.hxx>
 #include <fldbas.hxx>
 #include <initui.hxx>
 #include <swundo.hxx>
 #include <flddat.hxx>
-#ifndef _MODCFG_HXX
 #include <modcfg.hxx>
-#endif
 #include <swprtopt.hxx>
 #include <shellio.hxx>
 #include <dbui.hxx>
-#ifndef _DBMGR_HXX
 #include <dbmgr.hxx>
-#endif
 #include <doc.hxx>
 #include <swwait.hxx>
 #include <swunohelper.hxx>
-#ifndef _DBUI_HRC
 #include <dbui.hrc>
-#endif
-#ifndef _GLOBALS_HRC
 #include <globals.hrc>
-#endif
-#ifndef _STATSTR_HRC
 #include <statstr.hrc>
-#endif
 #include <mmconfigitem.hxx>
 #include <sfx2/request.hxx>
 #include <hintids.hxx>
 
     SwWrtShell& rSourceShell = rSourceView.GetWrtShell();
     BOOL bSynchronizedDoc = rSourceShell.IsLabelDoc() && rSourceShell.GetSectionFmtCount() > 1;
-    String sSourceDocURL;
     //save the settings of the first
     rSourceShell.SttEndDoc(TRUE);
     USHORT nStartingPageNo = rSourceShell.GetVirtPageNum();
 
     try
     {
-        // save the working document into a temporary location
-        sSourceDocURL = URIHelper::SmartRel2Abs(
-            INetURLObject(), utl::TempFile::CreateTempName(),
-            URIHelper::GetMaybeFileHdl());
-        const SfxFilter *pSfxFlt = SwIoSystem::GetFilterOfFormat(
-                String::CreateFromAscii( FILTER_XML ),
-                SwDocShell::Factory().GetFilterContainer() );
-
-        SfxStringItem aFilterName( SID_FILTER_NAME, pSfxFlt->GetFilterName());
-        uno::Sequence< beans::PropertyValue > aValues(1);
-        beans::PropertyValue* pValues = aValues.getArray();
-        pValues[0].Name = C2U("FilterName");
-        pValues[0].Value <<= ::rtl::OUString(pSfxFlt->GetFilterName());
-        uno::Reference< frame::XStorable > xStore( rSourceView.GetDocShell()->GetModel(), uno::UNO_QUERY);
-        xStore->storeToURL( sSourceDocURL, aValues );
-
         // create a target docshell to put the merged document into
         SfxObjectShellRef xTargetDocShell( new SwDocShell( SFX_CREATE_MODE_STANDARD ) );
         xTargetDocShell->DoInitNew( 0 );
                     Application::Reschedule();
             }
 
-            // create a new docshell from the temporary document
-            SfxBoolItem aHidden( SID_HIDDEN, TRUE );
-            SfxStringItem aReferer( SID_REFERER, String::CreateFromAscii(URL_PREFIX_PRIV_SOFFICE ));
-            SfxStringItem aTarget( SID_TARGETNAME, String::CreateFromAscii("_blank") );
-            SfxStringItem aURL( SID_FILE_NAME, sSourceDocURL );
-            const SfxPoolItem* pReturnValue =
-                            rSourceView.GetViewFrame()->GetDispatcher()->Execute( SID_OPENDOC, SFX_CALLMODE_SYNCHRON,
-                                    &aURL, &aFilterName, &aHidden, &aReferer, &aTarget, 0L);
-            if(pReturnValue)
+            // copy the source document
+            SfxObjectShellRef xWorkDocSh;
+            if(nDocNo == 1 )
             {
-                SfxViewFrameItem* pVItem = (SfxViewFrameItem*)pReturnValue;
-                SwView* pWorkView = (SwView*) pVItem->GetFrame()->GetViewShell();
-                SwWrtShell& rWorkShell = pWorkView->GetWrtShell();
-                pWorkView->AttrChangedNotify( &rWorkShell );//Damit SelectShell gerufen wird.
+                uno::Reference< util::XCloneable > xClone( rSourceView.GetDocShell()->GetModel(), uno::UNO_QUERY);
+                uno::Reference< lang::XUnoTunnel > xWorkDocShell( xClone->createClone(), uno::UNO_QUERY); 
+                SwXTextDocument* pWorkModel = reinterpret_cast<SwXTextDocument*>(xWorkDocShell->getSomething(SwXTextDocument::getUnoTunnelId()));
+                xWorkDocSh = pWorkModel->GetDocShell();
+            }
+            else
+            {
+                SwDoc* pNewDoc = rSourceView.GetDocShell()->GetDoc()->CreateCopy();
+                xWorkDocSh = new SwDocShell( pNewDoc, SFX_CREATE_MODE_STANDARD );
+                xWorkDocSh->DoInitNew();
+            }    
+            //create a ViewFrame
+            SwView* pWorkView = static_cast< SwView* >( SfxViewFrame::CreateViewFrame( *xWorkDocSh, 0, sal_True )->GetViewShell() );
+            SwWrtShell& rWorkShell = pWorkView->GetWrtShell();
+            pWorkView->AttrChangedNotify( &rWorkShell );//Damit SelectShell gerufen wird.
 
-                // merge the data
-                SwDoc* pWorkDoc = rWorkShell.GetDoc();
-                SwNewDBMgr* pWorkDBMgr = pWorkDoc->GetNewDBMgr();
-                pWorkDoc->SetNewDBMgr( this );
-                pWorkDoc->EmbedAllLinks();
-                if(UNDO_UI_DELETE_INVISIBLECNTNT == rWorkShell.GetUndoIds())
-                    rWorkShell.Undo();
-                // create a layout
-                rWorkShell.CalcLayout();
-                SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_FIELD_MERGE, rWorkShell.GetView().GetViewFrame()->GetObjectShell()));
-                rWorkShell.ViewShell::UpdateFlds();
-                SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_FIELD_MERGE_FINISHED, rWorkShell.GetView().GetViewFrame()->GetObjectShell()));
+            // merge the data
+            SwDoc* pWorkDoc = rWorkShell.GetDoc();
+            SwNewDBMgr* pWorkDBMgr = pWorkDoc->GetNewDBMgr();
+            pWorkDoc->SetNewDBMgr( this );
+            pWorkDoc->EmbedAllLinks();
+            if(UNDO_UI_DELETE_INVISIBLECNTNT == rWorkShell.GetUndoIds())
+                rWorkShell.Undo();
+            // create a layout
+            rWorkShell.CalcLayout();
+            SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_FIELD_MERGE, rWorkShell.GetView().GetViewFrame()->GetObjectShell()));
+            rWorkShell.ViewShell::UpdateFlds();
+            SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_FIELD_MERGE_FINISHED, rWorkShell.GetView().GetViewFrame()->GetObjectShell()));
 
-                // strip invisible content and convert fields to text
-                rWorkShell.RemoveInvisibleContent();
-                rWorkShell.ConvertFieldsToText();
-                rWorkShell.SetNumberingRestart();
+            // strip invisible content and convert fields to text
+            rWorkShell.RemoveInvisibleContent();
+            rWorkShell.ConvertFieldsToText();
+            rWorkShell.SetNumberingRestart();
 
 
-                // insert the document into the target document
-                rWorkShell.SttEndDoc(FALSE);
-                rWorkShell.SttEndDoc(TRUE);
-                rWorkShell.SelAll();
-                pTargetShell->SttEndDoc(FALSE);
+            // insert the document into the target document
+            rWorkShell.SttEndDoc(FALSE);
+            rWorkShell.SttEndDoc(TRUE);
+            rWorkShell.SelAll();
+            pTargetShell->SttEndDoc(FALSE);
 
-                //#i63806# put the styles to the target document
-                //if the source uses headers or footers each new copy need to copy a new page styles
-                if(bPageStylesWithHeaderFooter)
+            //#i63806# put the styles to the target document
+            //if the source uses headers or footers each new copy need to copy a new page styles
+            if(bPageStylesWithHeaderFooter)
+            {
+                //create a new pagestyle
+                //copy the pagedesc from the current document to the new document and change the name of the to-be-applied style
+
+                SwDoc* pTargetDoc = pTargetShell->GetDoc();
+                String sNewPageDescName = lcl_FindUniqueName(pTargetShell, sStartingPageDesc, nDocNo );
+                pTargetShell->GetDoc()->MakePageDesc( sNewPageDescName );
+                SwPageDesc* pTargetPageDesc = pTargetShell->FindPageDescByName( sNewPageDescName );
+                if(pSourcePageDesc && pTargetPageDesc)
                 {
-                    //create a new pagestyle
-                    //copy the pagedesc from the current document to the new document and change the name of the to-be-applied style
+                    pTargetDoc->CopyPageDesc( *pSourcePageDesc, *pTargetPageDesc, sal_False );
+                    sModifiedStartingPageDesc = sNewPageDescName;
+                    lcl_CopyFollowPageDesc( *pTargetShell, *pSourcePageDesc, *pTargetPageDesc, nDocNo );
+                }
+            }
+            if(nDocNo == 1 || bPageStylesWithHeaderFooter)
+            {
+                pTargetView->GetDocShell()->_LoadStyles( *pWorkView->GetDocShell(), sal_True );
+            }
+            if(nDocNo > 1)
+            {
+                pTargetShell->InsertPageBreak( &sModifiedStartingPageDesc, nStartingPageNo );
+            }
+            else
+            {
+                pTargetShell->SetPageStyle(sModifiedStartingPageDesc);
+            }
+            USHORT nPageCountBefore = pTargetShell->GetPageCnt();
+            DBG_ASSERT(!pTargetShell->GetTableFmt(),"target document ends with a table - paragraph should be appended");
+            //#i51359# add a second paragraph in case there's only one
+            {
+                SwNodeIndex aIdx( pWorkDoc->GetNodes().GetEndOfExtras(), 2 );
+              SwPosition aTestPos( aIdx );
+              SwCursor aTestCrsr(aTestPos,0,false);
+                if(!aTestCrsr.MovePara(fnParaNext, fnParaStart))
+                {
+                    //append a paragraph
+                    pWorkDoc->AppendTxtNode( aTestPos );
+                }
+            }
+            pTargetShell->Paste( rWorkShell.GetDoc(), sal_True );
+            //convert fields in page styles (header/footer - has to be done after the first document has been pasted
+            if(1 == nDocNo)
+            {
+                pTargetShell->CalcLayout();
+                pTargetShell->ConvertFieldsToText();
+            }
+            //add the document info to the config item
+            SwDocMergeInfo aMergeInfo;
+            aMergeInfo.nStartPageInTarget = nPageCountBefore;
+            //#i72820# calculate layout to be able to find the correct page index
+            pTargetShell->CalcLayout();
+            aMergeInfo.nEndPageInTarget = pTargetShell->GetPageCnt();
+            aMergeInfo.nDBRow = nStartRow;
+            rMMConfig.AddMergedDocument( aMergeInfo );
+            ++nRet;
 
-                    SwDoc* pTargetDoc = pTargetShell->GetDoc();
-                    String sNewPageDescName = lcl_FindUniqueName(pTargetShell, sStartingPageDesc, nDocNo );
-                    pTargetShell->GetDoc()->MakePageDesc( sNewPageDescName );
-                    SwPageDesc* pTargetPageDesc = pTargetShell->FindPageDescByName( sNewPageDescName );
-                    if(pSourcePageDesc && pTargetPageDesc)
-                    {
-                        pTargetDoc->CopyPageDesc( *pSourcePageDesc, *pTargetPageDesc, sal_False );
-                        sModifiedStartingPageDesc = sNewPageDescName;
-                        lcl_CopyFollowPageDesc( *pTargetShell, *pSourcePageDesc, *pTargetPageDesc, nDocNo );
-                    }
-                }
-                if(nDocNo == 1 || bPageStylesWithHeaderFooter)
-                {
-                    pTargetView->GetDocShell()->_LoadStyles( *pWorkView->GetDocShell(), sal_True );
-                }
-                if(nDocNo > 1)
-                {
-                    pTargetShell->InsertPageBreak( &sModifiedStartingPageDesc, nStartingPageNo );
-                }
-                else
-                {
-                    pTargetShell->SetPageStyle(sModifiedStartingPageDesc);
-                }
-                USHORT nPageCountBefore = pTargetShell->GetPageCnt();
-                DBG_ASSERT(!pTargetShell->GetTableFmt(),"target document ends with a table - paragraph should be appended");
-                //#i51359# add a second paragraph in case there's only one
-                {
-                    SwNodeIndex aIdx( pWorkDoc->GetNodes().GetEndOfExtras(), 2 );
-                  SwPosition aTestPos( aIdx );
-                  SwCursor aTestCrsr(aTestPos,0,false);
-                    if(!aTestCrsr.MovePara(fnParaNext, fnParaStart))
-                    {
-                        //append a paragraph
-                        pWorkDoc->AppendTxtNode( aTestPos );
-                    }
-                }
-                pTargetShell->Paste( rWorkShell.GetDoc(), sal_True );
-                //convert fields in page styles (header/footer - has to be done after the first document has been pasted
-                if(1 == nDocNo)
-                {
-                    pTargetShell->CalcLayout();
-                    pTargetShell->ConvertFieldsToText();
-                }
-                //add the document info to the config item
-                SwDocMergeInfo aMergeInfo;
-                aMergeInfo.nStartPageInTarget = nPageCountBefore;
-                //#i72820# calculate layout to be able to find the correct page index
-                pTargetShell->CalcLayout();
-                aMergeInfo.nEndPageInTarget = pTargetShell->GetPageCnt();
-                aMergeInfo.nDBRow = nStartRow;
-                rMMConfig.AddMergedDocument( aMergeInfo );
-                ++nRet;
+            // the print monitor needs some time to act
+            for( USHORT i = 0; i < 25; i++)
+                Application::Reschedule();
 
-                // the print monitor needs some time to act
-                for( USHORT i = 0; i < 25; i++)
-                    Application::Reschedule();
-
-                //restore the ole DBMgr
-                pWorkDoc->SetNewDBMgr( pWorkDBMgr );
-                //now the temporary document should be closed
-                SfxObjectShellRef xDocSh(pWorkView->GetDocShell());
-                xDocSh->DoClose();
-            }
+            //restore the ole DBMgr
+            pWorkDoc->SetNewDBMgr( pWorkDBMgr );
+            //now the temporary document should be closed
+            SfxObjectShellRef xDocSh(pWorkView->GetDocShell());
+            xDocSh->DoClose();
             nEndRow = pImpl->pMergeData->xResultSet->getRow();
             ++nDocNo;
         } while( !bCancel &&
     {
         DBG_ERROR("exception caught in SwNewDBMgr::MergeDocuments");
     }
-    if(sSourceDocURL.Len())
-        File::remove( sSourceDocURL );
     DELETEZ(pImpl->pMergeData);
     bInMerge = FALSE;
     return nRet;

sw/source/ui/uno/unoatxt.cxx

 		if(pxCursor)
 		{
 			SwPaM* pUnoCrsr = pxCursor->GetPaM();
-            bRet |= (true == pxCursor->GetDoc()->Copy( *pUnoCrsr, aPos ));
+            bRet |= (true == pxCursor->GetDoc()->Copy( *pUnoCrsr, aPos, false ));
 		}
 		else
 		{
             if(pBkmk && pBkmk->IsExpanded())
 			{
                 SwPaM aTmp(pBkmk->GetOtherMarkPos(), pBkmk->GetMarkPos());
-                bRet |= (true == pxRange->GetDoc()->Copy(aTmp, aPos));
+                bRet |= (true == pxRange->GetDoc()->Copy(aTmp, aPos, false));
 			}
 		}
 	}

sw/source/ui/uno/unotxdoc.cxx

 #include <vcl/virdev.hxx>
 #include <vcl/svapp.hxx>
 #include <sfx2/viewfrm.hxx>
-#ifndef _TOOLKIT_UNOHLP_HXX
 #include <toolkit/helper/vclunohelper.hxx>
-#endif
 #include <wdocsh.hxx>
 #include <wrtsh.hxx>
 #include <view.hxx>
 #include <pview.hxx>
-#ifndef _SRCVIEW_HXX
 #include <srcview.hxx>
-#endif
 #include <viewsh.hxx>
 #include <pvprtdat.hxx>
 #include <swprtopt.hxx>
 #include <com/sun/star/lang/ServiceNotRegisteredException.hpp>
 #include <com/sun/star/lang/DisposedException.hpp>
 #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
-#ifndef _COM_SUN_STAR_BEANS_PropertyAttribute_HPP_
 #include <com/sun/star/beans/PropertyAttribute.hpp>
-#endif
 #include <com/sun/star/document/RedlineDisplayType.hpp>
 #include <svx/linkmgr.hxx>
 #include <svx/unofill.hxx>
 #include <sfx2/progress.hxx>
 #include <swmodule.hxx>
 #include <docstat.hxx>
-#ifndef _MODOPT_HXX //
 #include <modcfg.hxx>
-#endif
 #include <ndtxt.hxx>
-#ifndef _UTLUI_HRC
 #include <utlui.hrc>
-#endif
 #include <swcont.hxx>
 #include <unodefaults.hxx>
 #include <SwXDocumentSettings.hxx>
 {
     return new SwXFlatParagraphIterator( *pDocShell->GetDoc(), nTextMarkupType, bAutomatic );
 }
-
+/*-- 07.05.2009 09:21:12---------------------------------------------------
+
+  -----------------------------------------------------------------------*/
+uno::Reference< util::XCloneable > SwXTextDocument::createClone(  ) throw (uno::RuntimeException)
+{
+    ::vos::OGuard aGuard(Application::GetSolarMutex());
+    if(!IsValid())
+        throw RuntimeException();
+    //create a new document - hidden - copy the storage and return it
+    SwDoc* pCopyDoc = pDocShell->GetDoc()->CreateCopy();
+    SfxObjectShell* pShell = new SwDocShell( pCopyDoc, SFX_CREATE_MODE_STANDARD );
+    pShell->DoInitNew();
+    
+    uno::Reference< embed::XStorage > xSourceStorage = getDocumentStorage();
+    uno::Reference< frame::XModel > xNewModel = pShell->GetModel();
+    //copy this storage
+    uno::Reference< document::XStorageBasedDocument > xStorageDoc( xNewModel, uno::UNO_QUERY );
+    uno::Reference< embed::XStorage > xNewStorage = xStorageDoc->getDocumentStorage();
+    xSourceStorage->copyToStorage( xNewStorage );
+    return uno::Reference< util::XCloneable >( xNewModel, UNO_QUERY );
+}
 /* -----------------------------20.06.00 09:54--------------------------------
 
  ---------------------------------------------------------------------------*/
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.