diff options
Diffstat (limited to 'sw/source/ui/dochdl/swdtflvr.cxx')
-rwxr-xr-x | sw/source/ui/dochdl/swdtflvr.cxx | 523 |
1 files changed, 161 insertions, 362 deletions
diff --git a/sw/source/ui/dochdl/swdtflvr.cxx b/sw/source/ui/dochdl/swdtflvr.cxx index c12b4a9e7878..c7591f96cc28 100755 --- a/sw/source/ui/dochdl/swdtflvr.cxx +++ b/sw/source/ui/dochdl/swdtflvr.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -43,6 +44,7 @@ #include <unotools/tempfile.hxx> #include <comphelper/storagehelper.hxx> #include <comphelper/processfactory.hxx> +#include <comphelper/servicehelper.hxx> #include <unotools/ucbstreamhelper.hxx> #include <sot/filelist.hxx> #include <svx/svxdlg.hxx> @@ -103,7 +105,7 @@ #include <docsh.hxx> #include <wdocsh.hxx> #include <fldbas.hxx> //DDE -#include <swundo.hxx> // fuer Undo-Ids +#include <swundo.hxx> // for Undo-Ids #include <pam.hxx> #include <ndole.hxx> #include <swwait.hxx> @@ -124,7 +126,7 @@ #include <swcrsr.hxx> #include <SwRewriter.hxx> #include <globals.hrc> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <vcl/svapp.hxx> #include <swserv.hxx> #include <switerator.hxx> @@ -174,8 +176,8 @@ protected: public: SwTrnsfrDdeLink( SwTransferable& rTrans, SwWrtShell& rSh ); - virtual void DataChanged( const String& rMimeType, - const uno::Any & rValue ); + virtual ::sfx2::SvBaseLink::UpdateResult DataChanged( + const String& rMimeType, const ::com::sun::star::uno::Any & rValue ); virtual void Closed(); sal_Bool WriteData( SvStream& rStrm ); @@ -206,9 +208,6 @@ public: } }; - -// ----------------------------------------------------------------------- - SwTransferable::SwTransferable( SwWrtShell& rSh ) : pWrtShell( &rSh ), pCreatorView( 0 ), @@ -239,13 +238,11 @@ SwTransferable::SwTransferable( SwWrtShell& rSh ) } } -// ----------------------------------------------------------------------- - SwTransferable::~SwTransferable() { Application::GetSolarMutex().acquire(); - // der DDELink braucht noch die WrtShell! + // the DDELink still needs the WrtShell! if( refDdeLink.Is() ) { ((SwTrnsfrDdeLink*)&refDdeLink)->Disconnect( sal_True ); @@ -254,14 +251,13 @@ SwTransferable::~SwTransferable() pWrtShell = 0; - // dvo 2002-05-30, #99239#: release reference to the document so that - // aDocShellRef will delete it (if aDocShellRef is set). Otherwise, the OLE - // nodes keep references to their sub-storage when the storage is already - // dead. + // release reference to the document so that aDocShellRef will delete + // it (if aDocShellRef is set). Otherwise, the OLE nodes keep references + // to their sub-storage when the storage is already dead. delete pClpDocFac; - //JP 22.04.95: erst schliessen, dann kann die Ref. auch gecleared werden, - // so das die DocShell auch tatsaechlich geloescht wird! + // first close, then the Ref. can be cleared as well, so that + // the DocShell really gets deleted! if( aDocShellRef.Is() ) { SfxObjectShell * pObj = aDocShellRef; @@ -291,12 +287,10 @@ SwTransferable::~SwTransferable() Application::GetSolarMutex().release(); } -// ----------------------------------------------------------------------- - static SwDoc * lcl_GetDoc(SwDocFac & rDocFac) { SwDoc *const pDoc = rDocFac.GetDoc(); - ASSERT( pDoc, "Document not found" ); + OSL_ENSURE( pDoc, "Document not found" ); if (pDoc) { pDoc->SetClipBoard( true ); @@ -304,8 +298,6 @@ static SwDoc * lcl_GetDoc(SwDocFac & rDocFac) return pDoc; } -// ----------------------------------------------------------------------- - void SwTransferable::ObjectReleased() { SwModule *pMod = SW_MOD(); @@ -315,8 +307,6 @@ void SwTransferable::ObjectReleased() pMod->pXSelection = 0; } -// ----------------------------------------------------------------------- - void SwTransferable::AddSupportedFormats() { // only need if we are the current XSelection Object @@ -327,20 +317,16 @@ void SwTransferable::AddSupportedFormats() } } -// ----------------------------------------------------------------------- - void SwTransferable::InitOle( SfxObjectShell* pDoc, SwDoc& rDoc ) { - //OleVisArea einstellen. Linke obere Ecke der Seite und Groesse - //der RealSize in Twips. + //set OleVisArea. Upper left corner of the page and size of + //RealSize in Twips. const Size aSz( OLESIZE ); SwRect aVis( Point( DOCUMENTBORDER, DOCUMENTBORDER ), aSz ); pDoc->SetVisArea( aVis.SVRect() ); rDoc.set(IDocumentSettingAccess::BROWSE_MODE, true ); } -// ----------------------------------------------------------------------- - uno::Reference < embed::XEmbeddedObject > SwTransferable::FindOLEObj( sal_Int64& nAspect ) const { uno::Reference < embed::XEmbeddedObject > xObj; @@ -358,8 +344,6 @@ uno::Reference < embed::XEmbeddedObject > SwTransferable::FindOLEObj( sal_Int64& return xObj; } -// ----------------------------------------------------------------------- - Graphic* SwTransferable::FindOLEReplacementGraphic() const { if( pClpDocFac ) @@ -375,17 +359,12 @@ Graphic* SwTransferable::FindOLEReplacementGraphic() const return NULL; } - -// ----------------------------------------------------------------------- - void SwTransferable::RemoveDDELinkFormat( const Window& rWin ) { RemoveFormat( SOT_FORMATSTR_ID_LINK ); CopyToClipboard( (Window*)&rWin ); } -// ----------------------------------------------------------------------- - sal_Bool SwTransferable::GetData( const DATA_FLAVOR& rFlavor ) { sal_uInt32 nFormat = SotExchange::GetFormat( rFlavor ); @@ -401,7 +380,7 @@ sal_Bool SwTransferable::GetData( const DATA_FLAVOR& rFlavor ) { SelectionType nSelectionType = pWrtShell->GetSelectionType(); -// SEL_GRF kommt vom ContentType der editsh +// SEL_GRF comes from ContentType of editsh if( (nsSelectionType::SEL_GRF | nsSelectionType::SEL_DRW_FORM) & nSelectionType ) { pClpGraphic = new Graphic; @@ -411,7 +390,7 @@ sal_Bool SwTransferable::GetData( const DATA_FLAVOR& rFlavor ) if( !pWrtShell->GetDrawObjGraphic( FORMAT_BITMAP, *pClpBitmap )) pOrigGrf = pClpBitmap; - // ist es ein URL-Button ? + // is it an URL-Button ? String sURL, sDesc; if( pWrtShell->GetURLFromButton( sURL, sDesc ) ) { @@ -423,10 +402,10 @@ sal_Bool SwTransferable::GetData( const DATA_FLAVOR& rFlavor ) pClpDocFac = new SwDocFac; SwDoc *const pTmpDoc = lcl_GetDoc(*pClpDocFac); - pTmpDoc->LockExpFlds(); // nie die Felder updaten - Text so belassen + pTmpDoc->LockExpFlds(); // never update fields - leave text as it is pWrtShell->Copy( pTmpDoc ); - // es wurde in der CORE eine neu angelegt (OLE-Objekte kopiert!) + // in CORE a new one was created (OLE-Objekte copied!) aDocShellRef = pTmpDoc->GetTmpDocShell(); if( aDocShellRef.Is() ) SwTransferable::InitOle( aDocShellRef, *pTmpDoc ); @@ -469,8 +448,7 @@ sal_Bool SwTransferable::GetData( const DATA_FLAVOR& rFlavor ) if( TRNSFR_OLE == eBufferType ) { //TODO/MBA: testing - is this the "single OLE object" case?! - // aus dem ClipDoc das OLE-Object besorgen und von dem die Daten - // besorgen. + // get OLE-Object from ClipDoc and get the data from that. sal_Int64 nAspect = embed::Aspects::MSOLE_CONTENT; // will be set in the next statement uno::Reference < embed::XEmbeddedObject > xObj = FindOLEObj( nAspect ); Graphic* pOLEGraph = FindOLEReplacementGraphic(); @@ -544,7 +522,7 @@ sal_Bool SwTransferable::GetData( const DATA_FLAVOR& rFlavor ) bOK = SetGDIMetaFile( pClpGraphic->GetGDIMetaFile(), rFlavor ); break; case SOT_FORMAT_BITMAP: - // #126398# Neither pClpBitmap nor pClpGraphic are necessarily set + // Neither pClpBitmap nor pClpGraphic are necessarily set if( (eBufferType & TRNSFR_GRAPHIC) && (pClpBitmap != 0 || pClpGraphic != 0)) bOK = SetBitmap( (pClpBitmap ? pClpBitmap : pClpGraphic)->GetBitmap(), @@ -572,7 +550,6 @@ sal_Bool SwTransferable::GetData( const DATA_FLAVOR& rFlavor ) break; case SOT_FORMATSTR_ID_EMBED_SOURCE: -// default: if( !aDocShellRef.Is() ) { SwDoc *const pDoc = lcl_GetDoc(*pClpDocFac); @@ -590,8 +567,6 @@ sal_Bool SwTransferable::GetData( const DATA_FLAVOR& rFlavor ) return bOK; } -// ----------------------------------------------------------------------- - sal_Bool SwTransferable::WriteObject( SotStorageStreamRef& xStream, void* pObject, sal_uInt32 nObjectType, const DATA_FLAVOR& /*rFlavor*/ ) @@ -603,18 +578,17 @@ sal_Bool SwTransferable::WriteObject( SotStorageStreamRef& xStream, { case SWTRANSFER_OBJECTTYPE_DRAWMODEL: { - //JP 28.02.2001: dont change the sequence of commands - Bug 8 + // dont change the sequence of commands SdrModel *pModel = (SdrModel*)pObject; xStream->SetBufferSize( 16348 ); - // #108584# // for the changed pool defaults from drawing layer pool set those // attributes as hard attributes to preserve them for saving const SfxItemPool& rItemPool = pModel->GetItemPool(); const SvxFontHeightItem& rDefaultFontHeight = (const SvxFontHeightItem&)rItemPool.GetDefaultItem(EE_CHAR_FONTHEIGHT); // SW should have no MasterPages - DBG_ASSERT(0L == pModel->GetMasterPageCount(), "SW with MasterPages (!)"); + OSL_ENSURE(0L == pModel->GetMasterPageCount(), "SW with MasterPages (!)"); for(sal_uInt16 a(0); a < pModel->GetPageCount(); a++) { @@ -714,7 +688,7 @@ sal_Bool SwTransferable::WriteObject( SotStorageStreamRef& xStream, aAOpt.SetCharSet( RTL_TEXTENCODING_UTF8 ); xWrt->SetAsciiOptions( aAOpt ); - // #102841# no start char for clipboard + // no start char for clipboard xWrt->bUCS2_WithStartChar = sal_False; } break; @@ -738,8 +712,6 @@ sal_Bool SwTransferable::WriteObject( SotStorageStreamRef& xStream, return bRet; } -// ----------------------------------------------------------------------- - int SwTransferable::Cut() { int nRet = Copy( sal_True ); @@ -748,13 +720,11 @@ int SwTransferable::Cut() return nRet; } -// ----------------------------------------------------------------------- - void SwTransferable::DeleteSelection() { if(!pWrtShell) return; - // Selektionsart vor Action-Klammerung erfragen + // ask for type of selection before action-bracketing const int nSelection = pWrtShell->GetSelectionType(); pWrtShell->StartUndo( UNDO_DELETE ); if( ( nsSelectionType::SEL_TXT | nsSelectionType::SEL_TBL ) & nSelection ) @@ -763,8 +733,6 @@ void SwTransferable::DeleteSelection() pWrtShell->EndUndo( UNDO_DELETE ); } -// ----------------------------------------------------------------------- - int SwTransferable::PrepareForCopy( sal_Bool bIsCut ) { int nRet = 1; @@ -792,10 +760,8 @@ int SwTransferable::PrepareForCopy( sal_Bool bIsCut ) PrepareOLE( aObjDesc ); AddFormat( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR ); - // --> OD 2005-02-09 #119353# - robust const Graphic* pGrf = pWrtShell->GetGraphic(); if( pGrf && pGrf->IsSupportedGraphic() ) - // <-- { AddFormat( FORMAT_GDIMETAFILE ); AddFormat( FORMAT_BITMAP ); @@ -823,7 +789,7 @@ int SwTransferable::PrepareForCopy( sal_Bool bIsCut ) AddFormat( FORMAT_GDIMETAFILE ); eBufferType = TRNSFR_OLE; } - //Gibt es ueberhaupt etwas zum bereitstellen? + // Is there anything to provide anyway? else if ( pWrtShell->IsSelection() || pWrtShell->IsFrmSelected() || pWrtShell->IsObjSelected() ) { @@ -833,10 +799,10 @@ int SwTransferable::PrepareForCopy( sal_Bool bIsCut ) pClpDocFac = new SwDocFac; - // zusaetzlichen Cursor erzeugen, damit eine Gleichbehandlung - // von Tastatur- und Mausselektion moeglich ist. - // Im AddMode wird bei Tastaturselektion der neue Cursor erst - // beim Bewegen des Cursors nach Selektionsende erzeugt. + // create additional cursor so that equal treatment of keyboard + // and mouse selection is possible. + // In AddMode with keyboard selection, the new cursor is not created + // before the cursor is moved after end of selection. if( pWrtShell->IsAddMode() && pWrtShell->SwCrsrShell::HasSelection() ) pWrtShell->CreateCrsr(); @@ -863,7 +829,7 @@ int SwTransferable::PrepareForCopy( sal_Bool bIsCut ) pMarkAccess->deleteMark(*ppMark); } - // es wurde in der CORE eine neu angelegt (OLE-Objekte kopiert!) + // a new one was created in CORE (OLE-Objekte copied!) aDocShellRef = pTmpDoc->GetTmpDocShell(); if( aDocShellRef.Is() ) SwTransferable::InitOle( aDocShellRef, *pTmpDoc ); @@ -885,11 +851,10 @@ int SwTransferable::PrepareForCopy( sal_Bool bIsCut ) bDDELink = pWrtShell->HasWholeTabSelection(); } - //Wenn's einer braucht OLE'n wir ihm was. + //When someone needs it, we 'OLE' him something AddFormat( SOT_FORMATSTR_ID_EMBED_SOURCE ); - //RTF vor das Metafile von OLE stellen, weil mit weniger verlusten - //behaftet. + //put RTF ahead of the OLE's Metafile to have less loss if( !pWrtShell->IsObjSelected() ) { AddFormat( FORMAT_RTF ); @@ -915,7 +880,7 @@ int SwTransferable::PrepareForCopy( sal_Bool bIsCut ) if( !pWrtShell->GetDrawObjGraphic( FORMAT_BITMAP, *pClpBitmap )) pOrigGrf = pClpBitmap; - // ist es ein URL-Button ? + // is it an URL-Button ? String sURL, sDesc; if( pWrtShell->GetURLFromButton( sURL, sDesc ) ) { @@ -930,7 +895,7 @@ int SwTransferable::PrepareForCopy( sal_Bool bIsCut ) } } - // beim Cut hat DDE-Link keinen Sinn!! + // at Cut, DDE-Link doesn't make sense!! SwDocShell* pDShell; if( !bIsCut && bDDELink && 0 != ( pDShell = pWrtShell->GetDoc()->GetDocShell()) && @@ -940,9 +905,9 @@ int SwTransferable::PrepareForCopy( sal_Bool bIsCut ) refDdeLink = new SwTrnsfrDdeLink( *this, *pWrtShell ); } - //ObjectDescriptor wurde bereits aus der alten DocShell gefuellt. - //Jetzt noch anpassen. Dadurch kann im GetData die erste Anfrage - //auch noch mit delayed rendering beantwortet werden. + //ObjectDescriptor was already filly from the old DocShell. + //Now adjust it. Thus in GetData the first query can still + //be answered with delayed rendering. aObjDesc.mbCanLink = sal_False; Size aSz( OLESIZE ); aObjDesc.maSize = OutputDevice::LogicToLogic( aSz, MAP_TWIP, MAP_100TH_MM ); @@ -987,8 +952,6 @@ int SwTransferable::Copy( sal_Bool bIsCut ) return nRet; } -// ----------------------------------------------------------------------- - int SwTransferable::CalculateAndCopy() { if(!pWrtShell) @@ -1008,8 +971,6 @@ int SwTransferable::CalculateAndCopy() return 1; } -// ----------------------------------------------------------------------- - int SwTransferable::CopyGlossary( SwTextBlocks& rGlossary, const String& rStr ) { @@ -1022,14 +983,14 @@ int SwTransferable::CopyGlossary( SwTextBlocks& rGlossary, SwNodes& rNds = pCDoc->GetNodes(); SwNodeIndex aNodeIdx( *rNds.GetEndOfContent().StartOfSectionNode() ); - SwCntntNode* pCNd = rNds.GoNext( &aNodeIdx ); // gehe zum 1. ContentNode + SwCntntNode* pCNd = rNds.GoNext( &aNodeIdx ); // go to 1st ContentNode SwPaM aPam( *pCNd ); - pCDoc->LockExpFlds(); // nie die Felder updaten - Text so belassen + pCDoc->LockExpFlds(); // never update fields - leave text as it is pCDoc->InsertGlossary( rGlossary, rStr, aPam, 0 ); - // es wurde in der CORE eine neu angelegt (OLE-Objekte kopiert!) + // a new one was created in CORE (OLE-Objects copied!) aDocShellRef = pCDoc->GetTmpDocShell(); if( aDocShellRef.Is() ) SwTransferable::InitOle( aDocShellRef, *pCDoc ); @@ -1037,15 +998,15 @@ int SwTransferable::CopyGlossary( SwTextBlocks& rGlossary, eBufferType = TRNSFR_DOCUMENT; - //Wenn's einer braucht OLE'n wir ihm was. + //When someone needs it, we 'OLE' her something. AddFormat( SOT_FORMATSTR_ID_EMBED_SOURCE ); AddFormat( FORMAT_RTF ); AddFormat( SOT_FORMATSTR_ID_HTML ); AddFormat( FORMAT_STRING ); - //ObjectDescriptor wurde bereits aus der alten DocShell gefuellt. - //Jetzt noch anpassen. Dadurch kann im GetData die erste Anfrage - //auch noch mit delayed rendering beantwortet werden. + //ObjectDescriptor was already filled from the old DocShell. + //Now adjust it. Thus in GetData the first query can still + //be answered with delayed rendering. aObjDesc.mbCanLink = sal_False; Size aSz( OLESIZE ); aObjDesc.maSize = OutputDevice::LogicToLogic( aSz, MAP_TWIP, MAP_100TH_MM ); @@ -1062,13 +1023,12 @@ static inline uno::Reference < XTransferable > * lcl_getTransferPointer ( uno::R { return &xRef; } -// ----------------------------------------------------------------------- sal_Bool SwTransferable::IsPaste( const SwWrtShell& rSh, const TransferableDataHelper& rData ) { // Check the common case first: We can always paste our own data! - // #106503#: If _only_ the internal format can be pasted, this check will + // If _only_ the internal format can be pasted, this check will // yield 'true', while the one below would give a (wrong) result 'false'. bool bIsPaste = ( GetSwTransferable( rData ) != NULL ); @@ -1105,8 +1065,6 @@ sal_Bool SwTransferable::IsPaste( const SwWrtShell& rSh, return bIsPaste; } -// ----------------------------------------------------------------------- - int SwTransferable::Paste( SwWrtShell& rSh, TransferableDataHelper& rData ) { sal_uInt16 nEventAction, nAction=0, @@ -1151,8 +1109,6 @@ int SwTransferable::Paste( SwWrtShell& rSh, TransferableDataHelper& rData ) nDestination, sal_False, sal_False ); } -// ----------------------------------------------------------------------- - int SwTransferable::PasteData( TransferableDataHelper& rData, SwWrtShell& rSh, sal_uInt16 nAction, sal_uLong nFormat, sal_uInt16 nDestination, sal_Bool bIsPasteFmt, @@ -1183,13 +1139,10 @@ int SwTransferable::PasteData( TransferableDataHelper& rData, case EXCHG_DEST_DOC_DRAWOBJ: case EXCHG_DEST_DOC_URLBUTTON: case EXCHG_DEST_DOC_GROUPOBJ: - // Rahmen/Objecte selektieren + // select frames/objects SwTransferable::SetSelInShell( rSh, sal_True, pPt ); break; - // case EXCHG_DEST_DOC_TEXTFRAME: - // case EXCHG_DEST_SWDOC_FREE_AREA: - // case EXCHG_DEST_DOC_URLFIELD: default: SwTransferable::SetSelInShell( rSh, sal_False, pPt ); break; @@ -1199,13 +1152,13 @@ int SwTransferable::PasteData( TransferableDataHelper& rData, else if( ( !GetSwTransferable( rData ) || bIsPasteFmt ) && !rSh.IsTableMode() && rSh.HasSelection() ) { - // dann die Selektionen loeschen + // then delete the selections - //Selektierten Inhalt loeschen, - // - nicht bei Tabellen-Selektion - // - nicht bei ReRead einer Grafik/DDEDaten - // - nicht bei D&D, fuer die richtige Selektion wurde im - // Drop-Handler gesorgt + //don't delete selected content + // - at table-selection + // - at ReRead of a graphic/DDEData + // - at D&D, for the right selection was taken care of + // in Drop-Handler sal_Bool bDelSel = sal_False; switch( nDestination ) { @@ -1218,20 +1171,12 @@ int SwTransferable::PasteData( TransferableDataHelper& rData, } if( bDelSel ) - // --> FME 2004-10-19 #i34830# + // #i34830# pAction = new SwTrnsfrActionAndUndo( &rSh, UNDO_PASTE_CLIPBOARD, NULL, sal_True ); - // <-- } SwTransferable *pTrans=0, *pTunneledTrans=GetSwTransferable( rData ); -// uno::Reference<XUnoTunnel> xTunnel( rData.GetTransferable(), UNO_QUERY ); -// if ( xTunnel.is() ) -// { -// sal_Int64 nHandle = xTunnel->getSomething( getUnoTunnelId() ); -// if ( nHandle ) -// pTunneledTrans = (SwTransferable*) (sal_IntPtr) nHandle; -// } if( pPt && ( bPasteSelection ? 0 != ( pTrans = pMod->pXSelection ) : 0 != ( pTrans = pMod->pDragDrop) )) @@ -1250,25 +1195,24 @@ int SwTransferable::PasteData( TransferableDataHelper& rData, { if( !pAction ) { - // #111827# pAction = new SwTrnsfrActionAndUndo( &rSh, UNDO_PASTE_CLIPBOARD); } - // im Drag&Drop duerfen keine MessageBoxen angezeigt werden + // in Drag&Drop MessageBoxes must not be showed sal_Bool bMsg = 0 == pPt; sal_uInt8 nActionFlags = static_cast< sal_uInt8 >(( nAction >> 8 ) & 0xFF); sal_uInt16 nClearedAction = ( nAction & EXCHG_ACTION_MASK ); - // Selektionen loeschen + // delete selections switch( nClearedAction ) { case EXCHG_OUT_ACTION_INSERT_PRIVATE: -ASSERT( pPt, "EXCHG_OUT_ACTION_INSERT_PRIVATE: was soll hier passieren?" ); + OSL_ENSURE( pPt, "EXCHG_OUT_ACTION_INSERT_PRIVATE: what should happen here?" ); break; case EXCHG_OUT_ACTION_MOVE_PRIVATE: -ASSERT( pPt, "EXCHG_OUT_ACTION_MOVE_PRIVATE: was soll hier passieren?" ); + OSL_ENSURE( pPt, "EXCHG_OUT_ACTION_MOVE_PRIVATE: what should happen here?" ); break; @@ -1280,7 +1224,7 @@ ASSERT( pPt, "EXCHG_OUT_ACTION_MOVE_PRIVATE: was soll hier passieren?" ); case EXCHG_OUT_ACTION_INSERT_IMAGEMAP: case EXCHG_OUT_ACTION_REPLACE_IMAGEMAP: - // dann muss ueber das Format gegangen werden + // then we have to use the format switch( nFormat ) { case SOT_FORMATSTR_ID_DRAWING: @@ -1347,7 +1291,7 @@ ASSERT( pPt, "EXCHG_OUT_ACTION_MOVE_PRIVATE: was soll hier passieren?" ); break; case SOT_FORMAT_FILE_LIST: - // dann nur als Grafiken einfuegen + // then insert as graphics only nRet = SwTransferable::_PasteFileList( rData, rSh, EXCHG_IN_ACTION_LINK == nClearedAction, pPt, bMsg ); @@ -1382,7 +1326,7 @@ ASSERT( pPt, "EXCHG_OUT_ACTION_MOVE_PRIVATE: was soll hier passieren?" ); break; default: - ASSERT( pPt, "unbekanntes Format" ); + OSL_ENSURE( pPt, "unknown format" ); } break; @@ -1458,7 +1402,7 @@ ASSERT( pPt, "EXCHG_OUT_ACTION_MOVE_PRIVATE: was soll hier passieren?" ); nActionFlags, bMsg ); break; default: - ASSERT( sal_False, "unbekanntes Format" ); + OSL_FAIL( "unknown format" ); } break; @@ -1497,7 +1441,7 @@ ASSERT( pPt, "EXCHG_OUT_ACTION_MOVE_PRIVATE: was soll hier passieren?" ); break; default: - ASSERT( sal_False, "unbekannte Action" ); + OSL_FAIL("unknown action" ); } } @@ -1516,8 +1460,6 @@ ASSERT( pPt, "EXCHG_OUT_ACTION_MOVE_PRIVATE: was soll hier passieren?" ); return nRet; } -// ----------------------------------------------------------------------- - sal_uInt16 SwTransferable::GetSotDestination( const SwWrtShell& rSh, const Point* pPt ) { @@ -1575,22 +1517,9 @@ sal_uInt16 SwTransferable::GetSotDestination( const SwWrtShell& rSh, case OBJCNT_URLBUTTON: nRet = EXCHG_DEST_DOC_URLBUTTON; break; case OBJCNT_GROUPOBJ: nRet = EXCHG_DEST_DOC_GROUPOBJ; break; -// was mmchen wir bei Mehrfachselektion??? -// case OBJCNT_DONTCARE: +// what do we do at multiple selections??? default: { -/* -JP 13.07.98: Bug 52637: es wird ein URL-Feld erkannt also werden nur die - Inhalte zugelassen. Das ist aber bestimmt nicht das - gewollte. - SwContentAtPos aCntntAtPos( SwContentAtPos::SW_INETATTR ); - SfxItemSet aSet( (SfxItemPool&)rSh.GetAttrPool(), - RES_TXTATR_INETFMT, RES_TXTATR_INETFMT ); - if( pPt ? ((SwWrtShell&)rSh).GetContentAtPos( *pPt, aCntntAtPos, sal_False ) - : (rSh.GetAttr( aSet ) && aSet.Count()) ) - nRet = EXCHG_DEST_DOC_URLFIELD; - else -*/ if( rSh.GetView().GetDocShell()->ISA(SwWebDocShell) ) nRet = EXCHG_DEST_SWDOC_FREE_AREA_WEB; else @@ -1601,8 +1530,6 @@ JP 13.07.98: Bug 52637: es wird ein URL-Feld erkannt also werden nur die return nRet; } -// ----------------------------------------------------------------------- - int SwTransferable::_PasteFileContent( TransferableDataHelper& rData, SwWrtShell& rSh, sal_uLong nFmt, sal_Bool bMsg ) { @@ -1648,7 +1575,6 @@ int SwTransferable::_PasteFileContent( TransferableDataHelper& rData, pStream = aMSE40ClpObj.IsValid( *xStrm ); pRead = ReadHTML; pRead->SetReadUTF8( sal_True ); - //pRead->SetBaseURL( aMSE40ClpObj.GetBaseURL() ); sal_Bool bNoComments = ( nFmt == SOT_FORMATSTR_ID_HTML_NO_COMMENT ); @@ -1700,8 +1626,6 @@ int SwTransferable::_PasteFileContent( TransferableDataHelper& rData, return nRet; } -// ----------------------------------------------------------------------- - int SwTransferable::_PasteOLE( TransferableDataHelper& rData, SwWrtShell& rSh, sal_uLong nFmt, sal_uInt8 nActionFlags, sal_Bool bMsg ) { @@ -1781,7 +1705,7 @@ int SwTransferable::_PasteOLE( TransferableDataHelper& rData, SwWrtShell& rSh, { if ( !rData.GetTransferableObjectDescriptor( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR, aObjDesc ) ) { - DBG_ASSERT( !xStrm.is(), "An object without descriptor in clipboard!"); + OSL_ENSURE( !xStrm.is(), "An object without descriptor in clipboard!"); } } else @@ -1828,18 +1752,6 @@ int SwTransferable::_PasteOLE( TransferableDataHelper& rData, SwWrtShell& rSh, Graphic aGraphic; sal_uLong nGrFormat = 0; -// (wg. Selection Manager bei Trustet Solaris) -#ifndef SOLARIS -/* - if( rData.GetGraphic( SOT_FORMATSTR_ID_SVXB, aGraphic ) ) - nGrFormat = SOT_FORMATSTR_ID_SVXB; - else if( rData.GetGraphic( FORMAT_GDIMETAFILE, aGraphic ) ) - nGrFormat = SOT_FORMAT_GDIMETAFILE; - else if( rData.GetGraphic( FORMAT_BITMAP, aGraphic ) ) - nGrFormat = SOT_FORMAT_BITMAP; -*/ -#endif - // insert replacement image ( if there is one ) into the object helper if ( nGrFormat ) { @@ -1859,8 +1771,8 @@ int SwTransferable::_PasteOLE( TransferableDataHelper& rData, SwWrtShell& rSh, xObjRef.SetGraphic( aGraphic, aMimeType ); } - //Size einstellen. Ist ein Hack wg. Auslieferung, die Size sollte - //an das InsertOle uebergeben werden!!!!!!!!!! + //set size. This is a hack because of handing over, size should be + //passed to the InsertOle!!!!!!!!!! Size aSize; if ( aObjDesc.mnViewAspect == embed::Aspects::MSOLE_ICON ) { @@ -1874,7 +1786,7 @@ int SwTransferable::_PasteOLE( TransferableDataHelper& rData, SwWrtShell& rSh, } else if( aObjDesc.maSize.Width() && aObjDesc.maSize.Height() ) { - aSize = Size( aObjDesc.maSize ); //immer 100TH_MM + aSize = Size( aObjDesc.maSize ); //always 100TH_MM MapUnit aUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xObj->getMapUnit( aObjDesc.mnViewAspect ) ); aSize = OutputDevice::LogicToLogic( aSize, MAP_100TH_MM, aUnit ); awt::Size aSz; @@ -1907,7 +1819,7 @@ int SwTransferable::_PasteOLE( TransferableDataHelper& rData, SwWrtShell& rSh, { } } - //Ende mit Hack! + //End of Hack! rSh.InsertOleObject( xObjRef ); nRet = 1; @@ -1923,11 +1835,6 @@ int SwTransferable::_PasteOLE( TransferableDataHelper& rData, SwWrtShell& rSh, return nRet; } -// ----------------------------------------------------------------------- - - -// ----------------------------------------------------------------------- - int SwTransferable::_PasteTargetURL( TransferableDataHelper& rData, SwWrtShell& rSh, sal_uInt16 nAction, const Point* pPt, sal_Bool bInsertGRF ) @@ -1944,11 +1851,10 @@ int SwTransferable::_PasteTargetURL( TransferableDataHelper& rData, String sURL( aINetImg.GetImageURL() ); SwTransferable::_CheckForURLOrLNKFile( rData, sURL ); - //!!! auf FileSystem abpruefen - nur dann ist es sinnvoll die - // Grafiken zu testen !!!! + //!!! check at FileSystem - only then it make sense to test graphics !!! Graphic aGrf; - GraphicFilter *pFlt = GraphicFilter::GetGraphicFilter(); - nRet = GRFILTER_OK == GraphicFilter::LoadGraphic( sURL, aEmptyStr, aGrf, pFlt ); + GraphicFilter &rFlt = GraphicFilter::GetGraphicFilter(); + nRet = GRFILTER_OK == GraphicFilter::LoadGraphic( sURL, aEmptyStr, aGrf, &rFlt ); if( nRet ) { switch( nAction ) @@ -2007,15 +1913,12 @@ int SwTransferable::_PasteTargetURL( TransferableDataHelper& rData, return nRet; } - -// ----------------------------------------------------------------------- - void SwTransferable::SetSelInShell( SwWrtShell& rSh, sal_Bool bSelectFrm, const Point* pPt ) { if( bSelectFrm ) { - // Rahmen/Objecte selektieren + // select frames/objects if( pPt && !rSh.GetView().GetViewFrame()->GetDispatcher()->IsLocked() ) { rSh.GetView().NoRotate(); @@ -2045,22 +1948,20 @@ void SwTransferable::SetSelInShell( SwWrtShell& rSh, sal_Bool bSelectFrm, } } -// ----------------------------------------------------------------------- - int SwTransferable::_PasteDDE( TransferableDataHelper& rData, SwWrtShell& rWrtShell, sal_Bool bReReadGrf, sal_Bool bMsg ) { - // Daten aus dem Clipboardformat + // data from Clipboardformat String aApp, aTopic, aItem; { SotStorageStreamRef xStrm; if( !rData.GetSotStorageStream( SOT_FORMATSTR_ID_LINK, xStrm )) { - ASSERT( !&rWrtShell, "DDE Data not found." ); + OSL_ENSURE( !&rWrtShell, "DDE Data not found." ); return 0; - } //sinnvollen Fehler melden!! + } // report useful error!! rtl_TextEncoding eEncoding = DDE_TXT_ENCODING; xStrm->ReadCString( aApp, eEncoding ); @@ -2071,7 +1972,7 @@ int SwTransferable::_PasteDDE( TransferableDataHelper& rData, String aCmd; sfx2::MakeLnkName( aCmd, &aApp, aTopic, aItem ); - // wollen wir jetzt eine Grafik einlesen ? + // do we want to read in a graphic now? sal_uLong nFormat; if( !rData.HasFormat( FORMAT_RTF ) && !rData.HasFormat( SOT_FORMATSTR_ID_HTML ) && @@ -2144,8 +2045,7 @@ int SwTransferable::_PasteDDE( TransferableDataHelper& rData, { do { // middle checked loop - // Wenn die Daten von einer Tabellenkalkulation kommen - // fuegen wir eine DDE-Tabelle ein + // When data comes from a spreadsheet, we add a DDE-table if( ( rData.HasFormat( SOT_FORMATSTR_ID_SYLK ) || rData.HasFormat( SOT_FORMATSTR_ID_SYLK_BIGCAPS ) ) && aExpand.Len() && @@ -2159,7 +2059,7 @@ int SwTransferable::_PasteDDE( TransferableDataHelper& rData, sTmp = sTmp.GetToken( 0, '\n' ); xub_StrLen nCols = sTmp.GetTokenCount( '\t' ); - // mindestens eine Spalte & Zeile muss vorhanden sein + // at least one column & row must be there if( !nRows || !nCols ) { if( bMsg ) @@ -2169,12 +2069,12 @@ int SwTransferable::_PasteDDE( TransferableDataHelper& rData, } rWrtShell.InsertDDETable( - SwInsertTableOptions( tabopts::HEADLINE_NO_BORDER, 1 ), // TODO MULTIHEADER + SwInsertTableOptions( tabopts::SPLIT_LAYOUT, 1 ), // TODO MULTIHEADER pDDETyp, nRows, nCols ); } else if( 1 < aExpand.GetTokenCount( '\n' ) ) { - // mehrere Absaetze -> eine geschuetzte Section einfuegen + // multiple paragraphs -> insert a protected section if( rWrtShell.HasSelection() ) rWrtShell.DelRight(); @@ -2183,7 +2083,7 @@ int SwTransferable::_PasteDDE( TransferableDataHelper& rData, aSect.SetProtectFlag(true); rWrtShell.InsertSection( aSect ); - pDDETyp = 0; // FeldTypen wieder entfernen + pDDETyp = 0; // remove FieldTypes again } else { @@ -2195,11 +2095,11 @@ int SwTransferable::_PasteDDE( TransferableDataHelper& rData, } while( sal_False ); } else - pDDETyp = 0; // FeldTypen wieder entfernen + pDDETyp = 0; // remove FieldTypes again if( !pDDETyp && !bDoublePaste ) { - // FeldTyp wieder entfernen - Fehler aufgetreten! + // remove FieldType again - error occured! for( j = nSize; j >= INIT_FLDTYPES; --j ) if( pTyp == rWrtShell.GetFldType( j ) ) { @@ -2211,8 +2111,6 @@ int SwTransferable::_PasteDDE( TransferableDataHelper& rData, return 1; } -// ----------------------------------------------------------------------- - int SwTransferable::_PasteSdrFormat( TransferableDataHelper& rData, SwWrtShell& rSh, sal_uInt16 nAction, const Point* pPt, sal_uInt8 nActionFlags ) @@ -2232,8 +2130,6 @@ int SwTransferable::_PasteSdrFormat( TransferableDataHelper& rData, return nRet; } -// ----------------------------------------------------------------------- - int SwTransferable::_PasteGrf( TransferableDataHelper& rData, SwWrtShell& rSh, sal_uLong nFmt, sal_uInt16 nAction, const Point* pPt, sal_uInt8 nActionFlags, sal_Bool /*bMsg*/ ) @@ -2256,13 +2152,6 @@ int SwTransferable::_PasteGrf( TransferableDataHelper& rData, SwWrtShell& rSh, case SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR: if( 0 != ( nRet = rData.GetINetBookmark( nFmt, aBkmk ) )) { -/* if( SW_PASTESDR_SETATTR != nAction ) - { - INetURLObject aURL( aBkmk.GetURL() ); - bCheckForGrf = INET_PROT_FILE == aURL.GetProtocol(); - nRet = 0 != bCheckForGrf; - } -*/ if( SW_PASTESDR_SETATTR == nAction ) nFmt = SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK; else @@ -2294,17 +2183,16 @@ int SwTransferable::_PasteGrf( TransferableDataHelper& rData, SwWrtShell& rSh, if( bCheckForGrf ) { - //!!! auf FileSystem abpruefen - nur dann ist es sinnvoll die - // Grafiken zu testen !!!! - GraphicFilter *pFlt = GraphicFilter::GetGraphicFilter(); + //!!! check at FileSystem - only then it makes sense to test the graphics !!! + GraphicFilter &rFlt = GraphicFilter::GetGraphicFilter(); nRet = GRFILTER_OK == GraphicFilter::LoadGraphic( aBkmk.GetURL(), aEmptyStr, - aGrf, pFlt ); + aGrf, &rFlt ); if( !nRet && SW_PASTESDR_SETATTR == nAction && SOT_FORMAT_FILE == nFmt && - // Bug 63031 - nur bei Rahmenselektion + // only at frame selection rSh.IsFrmSelected() ) { - // dann als Hyperlink hinter die Grafik setzen + // then set as hyperlink after the graphic nFmt = SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK; nRet = sal_True; } @@ -2376,7 +2264,7 @@ int SwTransferable::_PasteGrf( TransferableDataHelper& rData, SwWrtShell& rSh, } else if( bCheckForImageMap ) { - // oder sollte das File ein ImageMap-File sein? + // or should the file be an ImageMap-File? ImageMap aMap; SfxMedium aMed( INetURLObject(aBkmk.GetURL()).GetFull(), STREAM_STD_READ, sal_False ); @@ -2400,8 +2288,6 @@ int SwTransferable::_PasteGrf( TransferableDataHelper& rData, SwWrtShell& rSh, return nRet; } -// ----------------------------------------------------------------------- - int SwTransferable::_PasteImageMap( TransferableDataHelper& rData, SwWrtShell& rSh ) { @@ -2413,7 +2299,7 @@ int SwTransferable::_PasteImageMap( TransferableDataHelper& rData, SwFmtURL aURL( (SwFmtURL&)aSet.Get( RES_URL ) ); const ImageMap* pOld = aURL.GetMap(); - // setzen oder ersetzen ist hier die Frage + // set or replace, that is the question ImageMap aImageMap; if( rData.GetImageMap( SOT_FORMATSTR_ID_SVIM, aImageMap ) && ( !pOld || aImageMap != *pOld )) @@ -2427,8 +2313,6 @@ int SwTransferable::_PasteImageMap( TransferableDataHelper& rData, return nRet; } -// ----------------------------------------------------------------------- - int SwTransferable::_PasteAsHyperlink( TransferableDataHelper& rData, SwWrtShell& rSh, sal_uLong nFmt ) { @@ -2439,7 +2323,7 @@ int SwTransferable::_PasteAsHyperlink( TransferableDataHelper& rData, String sDesc; SwTransferable::_CheckForURLOrLNKFile( rData, sFile, &sDesc ); - //#41801# ersteinmal die URL absolut machen + // first, make the URL absolute INetURLObject aURL; aURL.SetSmartProtocol( INET_PROT_FILE ); aURL.SetSmartURL( sFile ); @@ -2473,8 +2357,6 @@ int SwTransferable::_PasteAsHyperlink( TransferableDataHelper& rData, return nRet; } -// ----------------------------------------------------------------------- - int SwTransferable::_PasteFileName( TransferableDataHelper& rData, SwWrtShell& rSh, sal_uLong nFmt, sal_uInt16 nAction, const Point* pPt, @@ -2505,22 +2387,14 @@ int SwTransferable::_PasteFileName( TransferableDataHelper& rData, { sal_Bool bIsURLFile = SwTransferable::_CheckForURLOrLNKFile( rData, sFile, &sDesc ); - //Eigenes FileFormat? -->Einfuegen, nicht fuer StarWriter/Web + //Own FileFormat? --> insert, not for StarWriter/Web String sFileURL = URIHelper::SmartRel2Abs(INetURLObject(), sFile, Link(), false ); const SfxFilter* pFlt = SW_PASTESDR_SETATTR == nAction ? 0 : SwIoSystem::GetFileFilter( sFileURL, aEmptyStr ); - if( pFlt && !rSh.GetView().GetDocShell()->ISA(SwWebDocShell) - /* - JP 02.07.98: warum nur fuer die Formate ?? - && ( pFlt->GetUserData() == FILTER_SW5 || - pFlt->GetUserData() == FILTER_SW4 || - pFlt->GetUserData() == FILTER_SW3 || - pFlt->GetUserData() == FILTER_SWG ) - */ - ) + if( pFlt && !rSh.GetView().GetDocShell()->ISA(SwWebDocShell) ) { - // und dann per PostUser Event den Bereich-Einfuegen-Dialog hochreissen + // and then pull up the insert-region-dialog by PostUser event SwSectionData * pSect = new SwSectionData( FILE_LINK_SECTION, rSh.GetDoc()->GetUniqueSectionName() ); @@ -2534,10 +2408,9 @@ int SwTransferable::_PasteFileName( TransferableDataHelper& rData, else if( SW_PASTESDR_SETATTR == nAction || ( bIsURLFile && SW_PASTESDR_INSERT == nAction )) { - //Fremde Files koennen wir immerhin noch als Links - //Einfuegen. + //we can insert foreign files as links after all - //#41801# ersteinmal die URL absolut machen + // first, make the URL absolute INetURLObject aURL; aURL.SetSmartProtocol( INET_PROT_FILE ); aURL.SetSmartURL( sFile ); @@ -2574,8 +2447,6 @@ int SwTransferable::_PasteFileName( TransferableDataHelper& rData, return nRet; } -// ----------------------------------------------------------------------- - int SwTransferable::_PasteDBData( TransferableDataHelper& rData, SwWrtShell& rSh, sal_uLong nFmt, sal_Bool bLink, const Point* pDragPt, sal_Bool bMsg ) @@ -2678,8 +2549,6 @@ int SwTransferable::_PasteDBData( TransferableDataHelper& rData, return nRet; } -// ----------------------------------------------------------------------- - int SwTransferable::_PasteFileList( TransferableDataHelper& rData, SwWrtShell& rSh, sal_Bool bLink, const Point* pPt, sal_Bool bMsg ) @@ -2719,8 +2588,6 @@ int SwTransferable::_PasteFileList( TransferableDataHelper& rData, return nRet; } -// ----------------------------------------------------------------------- - sal_Bool SwTransferable::_CheckForURLOrLNKFile( TransferableDataHelper& rData, String& rFileName, String* pTitle ) { @@ -2741,15 +2608,13 @@ sal_Bool SwTransferable::_CheckForURLOrLNKFile( TransferableDataHelper& rData, String sExt( rFileName.Copy( nLen - 3 )); if( sExt.EqualsIgnoreCaseAscii( "url" )) { -ASSERT( !&rFileName, "how do we read today .URL - Files?" ); + OSL_ENSURE( !&rFileName, "how do we read today .URL - Files?" ); } } } return bIsURLFile; } -// ----------------------------------------------------------------------- - sal_Bool SwTransferable::IsPasteSpecial( const SwWrtShell& rWrtShell, const TransferableDataHelper& rData ) { @@ -2759,8 +2624,6 @@ sal_Bool SwTransferable::IsPasteSpecial( const SwWrtShell& rWrtShell, return aClipboardFmtItem.Count() > 0; } -// ----------------------------------------------------------------------- - int SwTransferable::PasteFormat( SwWrtShell& rSh, TransferableDataHelper& rData, sal_uLong nFormat ) @@ -2803,8 +2666,6 @@ int SwTransferable::PasteFormat( SwWrtShell& rSh, return nRet; } -// ----------------------------------------------------------------------- - int SwTransferable::_TestAllowedFormat( const TransferableDataHelper& rData, sal_uLong nFormat, sal_uInt16 nDestination ) { @@ -2821,8 +2682,6 @@ int SwTransferable::_TestAllowedFormat( const TransferableDataHelper& rData, return EXCHG_INOUT_ACTION_NONE != nAction; } -// ----------------------------------------------------------------------- - /** * the list of formats which will be offered to the user in the 'Paste * Special...' dialog and the paste button menu @@ -2845,15 +2704,12 @@ static sal_uInt16 aPasteSpecialIds[] = 0 }; - int SwTransferable::PasteUnformatted( SwWrtShell& rSh, TransferableDataHelper& rData ) { // Plain text == unformatted return SwTransferable::PasteFormat( rSh, rData, SOT_FORMAT_STRING ); } -// ----------------------------------------------------------------------- - int SwTransferable::PasteSpecial( SwWrtShell& rSh, TransferableDataHelper& rData, sal_uLong& rFormatUsed ) { int nRet = 0; @@ -2925,7 +2781,6 @@ int SwTransferable::PasteSpecial( SwWrtShell& rSh, TransferableDataHelper& rData return nRet; } - void SwTransferable::FillClipFmtItem( const SwWrtShell& rSh, const TransferableDataHelper& rData, SvxClipboardFmtItem & rToFill ) @@ -2988,10 +2843,8 @@ void SwTransferable::SetDataForDragAndDrop( const Point& rSttPos ) if( nsSelectionType::SEL_GRF == nSelection) { AddFormat( SOT_FORMATSTR_ID_SVXB ); - // --> OD 2005-02-09 #119353# - robust const Graphic* pGrf = pWrtShell->GetGraphic(); if ( pGrf && pGrf->IsSupportedGraphic() ) - // <-- { AddFormat( FORMAT_GDIMETAFILE ); AddFormat( FORMAT_BITMAP ); @@ -3007,7 +2860,7 @@ void SwTransferable::SetDataForDragAndDrop( const Point& rSttPos ) AddFormat( FORMAT_GDIMETAFILE ); eBufferType = TRNSFR_OLE; } - //Gibt es ueberhaupt etwas zum bereitstellen? + //Is there anything to provide anyway? else if ( pWrtShell->IsSelection() || pWrtShell->IsFrmSelected() || pWrtShell->IsObjSelected() ) { @@ -3027,8 +2880,7 @@ void SwTransferable::SetDataForDragAndDrop( const Point& rSttPos ) AddFormat( SOT_FORMATSTR_ID_EMBED_SOURCE ); - //RTF vor das Metafile von OLE stellen, weil mit weniger verlusten - //behaftet. + //put RTF ahead of the OLE's Metafile for less loss if( !pWrtShell->IsObjSelected() ) { AddFormat( FORMAT_RTF ); @@ -3054,7 +2906,7 @@ void SwTransferable::SetDataForDragAndDrop( const Point& rSttPos ) if( !pWrtShell->GetDrawObjGraphic( FORMAT_BITMAP, *pClpBitmap )) pOrigGrf = pClpBitmap; - // ist es ein URL-Button ? + // is it an URL-Button ? String sURL, sDesc; if( pWrtShell->GetURLFromButton( sURL, sDesc ) ) { @@ -3068,9 +2920,9 @@ void SwTransferable::SetDataForDragAndDrop( const Point& rSttPos ) } } - //ObjectDescriptor wurde bereits aus der alten DocShell gefuellt. - //Jetzt noch anpassen. Dadurch kann im GetData die erste Anfrage - //auch noch mit delayed rendering beantwortet werden. + //ObjectDescriptor was already filled from the old DocShell. + //Now adjust it. Thus in GetData the first query can still + //be answered with delayed rendering. aObjDesc.mbCanLink = sal_False; aObjDesc.maDragStartPos = rSttPos; aObjDesc.maSize = OutputDevice::LogicToLogic( Size( OLESIZE ), @@ -3080,7 +2932,7 @@ void SwTransferable::SetDataForDragAndDrop( const Point& rSttPos ) } else if( nSelection & nsSelectionType::SEL_TXT && !pWrtShell->HasMark() ) { - // ist nur ein Feld - Selektiert? + // is only one field - selected? SwContentAtPos aCntntAtPos( SwContentAtPos::SW_INETATTR ); Point aPos( SwEditWin::GetDDStartPosX(), SwEditWin::GetDDStartPosY()); @@ -3142,13 +2994,13 @@ void SwTransferable::StartDrag( Window* pWin, const Point& rPos ) void SwTransferable::DragFinished( sal_Int8 nAction ) { - //Und noch die letzten Nacharbeiten damit alle Stati stimmen. + //And the last finishing work so that all statuses are right if( DND_ACTION_MOVE == nAction ) { if( bCleanUp ) { - //Es wurde auserhalb des Writers gedroped. Wir muessen noch - //loeschen. + //It was dropped outside of Writer. We still have to + //delete. pWrtShell->StartAllAction(); pWrtShell->StartUndo( UNDO_UI_DRAG_AND_MOVE ); @@ -3157,7 +3009,7 @@ void SwTransferable::DragFinished( sal_Int8 nAction ) else { if ( !(pWrtShell->IsSelFrmMode() || pWrtShell->IsObjSelected()) ) - //SmartCut, eines der Blanks mitnehmen. + //SmartCut, take one of the blanks along pWrtShell->IntelligentCut( pWrtShell->GetSelectionType(), sal_True ); pWrtShell->DelRight(); } @@ -3180,52 +3032,39 @@ void SwTransferable::DragFinished( sal_Int8 nAction ) pWrtShell->HideCrsr(); else pWrtShell->ShowCrsr(); -//!! else if( DND_ACTION_NONE != nAction ) -//!! pWrtShell->ShowCrsr(); -//!! else -//!! { -//!! //Muss wohl sein weil gescrollt wurde und ?...? -//!! pWrtShell->StartAction(); -//!! pWrtShell->EndAction(); -//!! } ((SwViewOption *)pWrtShell->GetViewOptions())->SetIdle( bOldIdle ); } - -/* */ - int SwTransferable::PrivatePaste( SwWrtShell& rShell ) { - // erst den SelectionType erfragen, dann Action-Klammerung !!!! - // (sonst wird nicht in eine TabellenSelektion gepastet!!!) - ASSERT( !rShell.ActionPend(), "Paste darf nie eine Actionklammerung haben" ); + // first, ask for the SelectionType, then action-bracketing !!!! + // (otherwise it's not pasted into a TableSelection!!!) + OSL_ENSURE( !rShell.ActionPend(), "Paste darf nie eine Actionklammerung haben" ); if ( !pClpDocFac ) return sal_False; // the return value of the SwFEShell::Paste also is sal_Bool! const int nSelection = rShell.GetSelectionType(); - // #111827# SwRewriter aRewriter; SwTrnsfrActionAndUndo aAction( &rShell, UNDO_PASTE_CLIPBOARD); bool bKillPaMs = false; - //Selektierten Inhalt loeschen, nicht bei Tabellen-Selektion und - //Tabelle im Clipboard + //Delete selected content, not at table-selection and table in Clipboard if( rShell.HasSelection() && !( nSelection & nsSelectionType::SEL_TBL_CELLS)) { bKillPaMs = true; rShell.SetRetainSelection( true ); rShell.DelRight(); - // war ein Fly selektiert, so muss jetzt fuer eine gueltige - // Cursor-Position gesorgt werden! (geparkter Cursor!) + // when a Fly was selected, a valid cursor position has to be found now + // (parked Cursor!) if( ( nsSelectionType::SEL_FRM | nsSelectionType::SEL_GRF | nsSelectionType::SEL_OLE | nsSelectionType::SEL_DRW | nsSelectionType::SEL_DRW_FORM ) & nSelection ) { - // den Cursor wieder positionieren + // position the cursor again Point aPt( rShell.GetCharRect().Pos() ); rShell.SwCrsrShell::SetCrsr( aPt, sal_True ); } @@ -3236,14 +3075,9 @@ int SwTransferable::PrivatePaste( SwWrtShell& rShell ) bSmart = 0 != (TRNSFR_DOCUMENT_WORD & eBufferType); if( bSmart ) { -// #108491# Why not for other Scripts? If TRNSFR_DOCUMENT_WORD is set, we have -// a word in the buffer, word in this context means 'something with spaces at -// beginning and end'. In this case we definitely want these spaces to be inserted -// here. -// if( SCRIPTTYPE_LATIN != rShell.GetScriptType() ) -// bSmart = sal_False; -// else -// { +// Why not for other Scripts? If TRNSFR_DOCUMENT_WORD is set, we have a word +// in the buffer, word in this context means 'something with spaces at beginning +// and end'. In this case we definitely want these spaces to be inserted here. bInWrd = rShell.IsInWrd(); bEndWrd = rShell.IsEndWrd(); bSmart = bInWrd || bEndWrd; @@ -3253,7 +3087,6 @@ int SwTransferable::PrivatePaste( SwWrtShell& rShell ) if( bSmart && !bSttWrd && (bInWrd || bEndWrd) ) rShell.SwEditShell::Insert(' '); } -// } } int nRet = rShell.Paste( pClpDocFac->GetDoc() ); @@ -3261,7 +3094,7 @@ int SwTransferable::PrivatePaste( SwWrtShell& rShell ) if( bKillPaMs ) rShell.KillPams(); - // Wenn Smart Paste dann Leerzeichen einfuegen + // If Smart Paste then insert blank if( nRet && bSmart && ((bInWrd && !bEndWrd )|| bSttWrd) ) rShell.SwEditShell::Insert(' '); @@ -3291,7 +3124,7 @@ int SwTransferable::PrivateDrop( SwWrtShell& rSh, const Point& rDragPt, if( (TRNSFR_INETFLD & eBufferType) && pBkmk ) aTmp = *pBkmk; - // Zielgrafik selektieren + // select target graphic if( rSh.SelectObj( rDragPt ) ) { rSh.HideCrsr(); @@ -3301,7 +3134,7 @@ int SwTransferable::PrivateDrop( SwWrtShell& rSh, const Point& rDragPt, const int nSelection = rSh.GetSelectionType(); - // Draw-Objekte erstmal noch nicht beruecksichtigen + // not yet consider Draw objects if( nsSelectionType::SEL_GRF & nSelection ) { SfxItemSet aSet( rSh.GetAttrPool(), RES_URL, RES_URL ); @@ -3326,14 +3159,14 @@ int SwTransferable::PrivateDrop( SwWrtShell& rSh, const Point& rDragPt, if( &rSh != &rSrcSh && (nsSelectionType::SEL_GRF & rSh.GetSelectionType()) && TRNSFR_GRAPHIC == eBufferType ) { - // ReRead auf die Grafik + // ReRead the graphic String sGrfNm, sFltNm; rSrcSh.GetGrfNms( &sGrfNm, &sFltNm ); rSh.ReRead( sGrfNm, sFltNm, rSrcSh.GetGraphic() ); return 1; } - //Nicht in Selektionen oder selektierten Rahmen + //not in selections or selected frames if( rSh.ChgCurrPam( rDragPt ) || ( rSh.IsSelFrmMode() && rSh.IsInsideSelectedObj( rDragPt )) ) return 0; @@ -3342,7 +3175,7 @@ int SwTransferable::PrivateDrop( SwWrtShell& rSh, const Point& rDragPt, bTblSel = sal_True; else if( rSrcSh.IsSelFrmMode() || rSrcSh.IsObjSelected() ) { - // keine positionsgeschuetzten Objecte verschieben! + // don't move position-protected objects! if( bMove && rSrcSh.IsSelObjProtected( FLYPROTECT_POS ) ) return 0; @@ -3353,7 +3186,6 @@ int SwTransferable::PrivateDrop( SwWrtShell& rSh, const Point& rDragPt, SwUndoId eUndoId = bMove ? UNDO_UI_DRAG_AND_MOVE : UNDO_UI_DRAG_AND_COPY; - // #111827# SwRewriter aRewriter; aRewriter.AddRule(UNDO_ARG1, rSrcSh.GetSelDescr()); @@ -3375,13 +3207,13 @@ int SwTransferable::PrivateDrop( SwWrtShell& rSh, const Point& rDragPt, { if( !rSh.IsAddMode() ) { - // --> OD 2008-03-19 #i87233# + // #i87233# if ( rSh.IsBlockMode() ) { // preserve order of cursors for block mode rSh.GoPrevCrsr(); } - // <-- + rSh.SwCrsrShell::CreateCrsr(); } rSh.SwCrsrShell::SetCrsr( rDragPt, sal_True, false ); @@ -3397,7 +3229,7 @@ int SwTransferable::PrivateDrop( SwWrtShell& rSh, const Point& rDragPt, Point aSttPt( SwEditWin::GetDDStartPosX(), SwEditWin::GetDDStartPosY() ); - //JP 05.03.96: INetFelder erstmal selektieren ! + // at first, select INetFelder! if( TRNSFR_INETFLD == eBufferType ) { if( &rSrcSh == &rSh ) @@ -3407,7 +3239,7 @@ int SwTransferable::PrivateDrop( SwWrtShell& rSh, const Point& rDragPt, rSh.SelectTxtAttr( RES_TXTATR_INETFMT ); if( rSh.ChgCurrPam( rDragPt ) ) { - // nicht in sich selbst kopieren/verschieben + // don't copy/move inside of yourself rSh.DestroyCrsr(); rSh.EndUndo(); rSh.EndAction(); @@ -3422,15 +3254,15 @@ int SwTransferable::PrivateDrop( SwWrtShell& rSh, const Point& rDragPt, rSrcSh.SelectTxtAttr( RES_TXTATR_INETFMT ); } - // ist am Einfuege Punkt ein URL-Attribut? Dann das ersetzen, - // also einfach eine Selektion aufspannen? + // is there an URL attribute at the insert point? Then replace that, + // so simply put up a selection? rSh.DelINetAttrWithText(); bDDINetAttr = sal_True; } if ( rSrcSh.IsSelFrmMode() ) { - //Hack: Spezialbehandlung austricksen + //Hack: fool the special treatment aSttPt -= aSttPt - rSrcSh.GetObjRect().Pos(); } @@ -3444,12 +3276,12 @@ int SwTransferable::PrivateDrop( SwWrtShell& rSh, const Point& rDragPt, { if ( bTblSel ) { - /* #109590# delete table contents not cells */ + /* delete table contents not cells */ rSrcSh.Delete(); } else { - //SmartCut, eines der Blank mitnehmen. + //SmartCut, take one of the blanks along. rSh.SwCrsrShell::DestroyCrsr(); if ( cWord == SwWrtShell::WORD_SPACE_BEFORE ) rSh.ExtendSelection( sal_False ); @@ -3461,7 +3293,7 @@ int SwTransferable::PrivateDrop( SwWrtShell& rSh, const Point& rDragPt, rSrcSh.KillPams(); rSrcSh.Pop( sal_False ); - /* #109590# after dragging a table selection inside one shell + /* after dragging a table selection inside one shell set cursor to the drop position. */ if( &rSh == &rSrcSh && ( bTblSel || rSh.IsBlockMode() ) ) { @@ -3506,7 +3338,7 @@ int SwTransferable::PrivateDrop( SwWrtShell& rSh, const Point& rDragPt, rSh.SwCrsrShell::CreateCrsr(); else { - // Selektionsmodus einschalten + // turn on selection mode rSh.SttSelect(); rSh.EndSelect(); } @@ -3520,7 +3352,7 @@ int SwTransferable::PrivateDrop( SwWrtShell& rSh, const Point& rDragPt, rSrcSh.EndUndo(); rSh.EndUndo(); - // Shell in den richtigen Status versetzen + // put the shell in the right state if( &rSrcSh != &rSh && ( rSh.IsFrmSelected() || rSh.IsObjSelected() )) rSh.EnterSelFrmMode(); @@ -3536,7 +3368,6 @@ void SwTransferable::CreateSelection( SwWrtShell& rSh, SwModule *pMod = SW_MOD(); SwTransferable* pNew = new SwTransferable( rSh ); - /* #96392#*/ pNew->pCreatorView = _pCreatorView; uno::Reference< @@ -3551,30 +3382,22 @@ void SwTransferable::ClearSelection( SwWrtShell& rSh, SwModule *pMod = SW_MOD(); if( pMod->pXSelection && ((!pMod->pXSelection->pWrtShell) || (pMod->pXSelection->pWrtShell == &rSh)) && - /* #96392# */ (!_pCreatorView || (pMod->pXSelection->pCreatorView == _pCreatorView)) ) { TransferableHelper::ClearSelection( rSh.GetWin() ); } } -/* -----------------3/31/2003 11:46AM---------------- - --------------------------------------------------*/ +namespace +{ + class theSwTransferableUnoTunnelId : public rtl::Static< UnoTunnelIdInit, SwTransferable > {}; +} + const Sequence< sal_Int8 >& SwTransferable::getUnoTunnelId() { - static Sequence< sal_Int8 > aSeq; - if( !aSeq.getLength() ) - { - static osl::Mutex aCreateMutex; - osl::Guard< osl::Mutex > aGuard( aCreateMutex ); - aSeq.realloc( 16 ); - rtl_createUuid( reinterpret_cast< sal_uInt8* >( aSeq.getArray() ), 0, sal_True ); - } - return aSeq; + return theSwTransferableUnoTunnelId::get().getSeq(); } -/* -----------------3/31/2003 11:46AM---------------- - --------------------------------------------------*/ sal_Int64 SwTransferable::getSomething( const Sequence< sal_Int8 >& rId ) throw( RuntimeException ) { sal_Int64 nRet; @@ -3604,15 +3427,11 @@ SwTransferable* SwTransferable::GetSwTransferable( const TransferableDataHelper& } -/* */ - -// ----------------------------------------------------------------------- - SwTrnsfrDdeLink::SwTrnsfrDdeLink( SwTransferable& rTrans, SwWrtShell& rSh ) : rTrnsfr( rTrans ), pDocShell( 0 ), bDelBookmrk( sal_False ), bInDisconnect( sal_False ) { - // hier kommen wir nur bei Tabellen- oder Text-Selection an + // we only end up here with table- or text selection const int nSelection = rSh.GetSelectionType(); if( nsSelectionType::SEL_TBL_CELLS & nSelection ) { @@ -3647,14 +3466,12 @@ SwTrnsfrDdeLink::SwTrnsfrDdeLink( SwTransferable& rTrans, SwWrtShell& rSh ) if( sName.Len() && 0 != ( pDocShell = rSh.GetDoc()->GetDocShell() ) ) { - // dann erzeugen wir uns mal unseren "Server" und connecten uns - // zu diesem + // then we create our "server" and connect to it refObj = pDocShell->DdeCreateLinkSource( sName ); if( refObj.Is() ) { refObj->AddConnectAdvise( this ); refObj->AddDataAdvise( this, -// SotExchange::GetFormatMimeType( FORMAT_RTF ), aEmptyStr, ADVISEMODE_NODATA | ADVISEMODE_ONLYONCE ); nOldTimeOut = refObj->GetUpdateTimeout(); @@ -3663,30 +3480,25 @@ SwTrnsfrDdeLink::SwTrnsfrDdeLink( SwTransferable& rTrans, SwWrtShell& rSh ) } } -// ----------------------------------------------------------------------- - SwTrnsfrDdeLink::~SwTrnsfrDdeLink() { if( refObj.Is() ) Disconnect( sal_True ); } -// ----------------------------------------------------------------------- - -void SwTrnsfrDdeLink::DataChanged( const String& , +::sfx2::SvBaseLink::UpdateResult SwTrnsfrDdeLink::DataChanged( const String& , const uno::Any& ) { - // tja das wars dann mit dem Link + // well, that's it with the link if( !bInDisconnect ) { if( FindDocShell() && pDocShell->GetView() ) rTrnsfr.RemoveDDELinkFormat( pDocShell->GetView()->GetEditWin() ); Disconnect( sal_False ); } + return SUCCESS; } -// ----------------------------------------------------------------------- - sal_Bool SwTrnsfrDdeLink::WriteData( SvStream& rStrm ) { if( !refObj.Is() || !FindDocShell() ) @@ -3714,12 +3526,6 @@ sal_Bool SwTrnsfrDdeLink::WriteData( SvStream& rStrm ) rStrm.Write( pMem, nLen ); delete[] pMem; - //if( bDelBookmrk ) - //{ - // // er wird das erstemal abgeholt, also ins Undo mitaufnehmen - // // aber wie?? - //} - IDocumentMarkAccess* const pMarkAccess = pDocShell->GetDoc()->getIDocumentMarkAccess(); IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->findMark(sName); if(ppMark != pMarkAccess->getMarksEnd() @@ -3757,27 +3563,23 @@ sal_Bool SwTrnsfrDdeLink::WriteData( SvStream& rStrm ) return true; } -// ----------------------------------------------------------------------- - void SwTrnsfrDdeLink::Disconnect( sal_Bool bRemoveDataAdvise ) { - //JP 29.01.96 Bug 24432: - // kein DataChanged mehr entgegen nehmen, wenn man - // sich schon im Disconnet befindet! - // (DTOR vom Bookmark verschickt einen DataChanged!) + // don't accept DataChanged anymore, when already in Disconnect! + // (DTOR from Bookmark sends a DataChanged!) sal_Bool bOldDisconnect = bInDisconnect; bInDisconnect = sal_True; - // den nicht verwendeten Bookmark wieder zerstoeren (ohne Undo!)? + // destroy the unused bookmark again (without Undo!)? if( bDelBookmrk && refObj.Is() && FindDocShell() ) { SwDoc* pDoc = pDocShell->GetDoc(); ::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo()); - // --> OD, CD, OS 2005-11-25 #i58448# + // #i58448# Link aSavedOle2Link( pDoc->GetOle2Link() ); pDoc->SetOle2Link( Link() ); - // <-- + sal_Bool bIsModified = pDoc->IsModified(); IDocumentMarkAccess* const pMarkAccess = pDoc->getIDocumentMarkAccess(); @@ -3785,9 +3587,8 @@ void SwTrnsfrDdeLink::Disconnect( sal_Bool bRemoveDataAdvise ) if( !bIsModified ) pDoc->ResetModified(); - // --> OD, CD, OS 2005-11-25 #i58448# + // #i58448# pDoc->SetOle2Link( aSavedOle2Link ); - // <-- bDelBookmrk = sal_False; } @@ -3797,29 +3598,27 @@ void SwTrnsfrDdeLink::Disconnect( sal_Bool bRemoveDataAdvise ) refObj->SetUpdateTimeout( nOldTimeOut ); refObj->RemoveConnectAdvise( this ); if( bRemoveDataAdvise ) - // in einem DataChanged darf das SelectionObject NIE geloescht - // werden; wird schon von der Basisklasse erledigt + // in a DataChanged the SelectionObject must NEVER be deleted + // is already handled by the base class // (ADVISEMODE_ONLYONCE!!!!) - // Im normalen Disconnet aber schon! + // but always in normal Disconnect! refObj->RemoveAllDataAdvise( this ); refObj.Clear(); } bInDisconnect = bOldDisconnect; } -// ----------------------------------------------------------------------- - sal_Bool SwTrnsfrDdeLink::FindDocShell() { TypeId aType( TYPE( SwDocShell ) ); SfxObjectShell* pTmpSh = SfxObjectShell::GetFirst( &aType ); while( pTmpSh ) { - if( pTmpSh == pDocShell ) // die wollen wir haben + if( pTmpSh == pDocShell ) // that's what we want to have { if( pDocShell->GetDoc() ) return sal_True; - break; // das Doc ist nicht mehr vorhanden, also raus! + break; // the Doc is not there anymore, so leave! } pTmpSh = SfxObjectShell::GetNext( *pTmpSh, &aType ); } @@ -3828,8 +3627,6 @@ sal_Bool SwTrnsfrDdeLink::FindDocShell() return sal_False; } -// ----------------------------------------------------------------------- - void SwTrnsfrDdeLink::Closed() { if( !bInDisconnect && refObj.Is() ) @@ -3839,3 +3636,5 @@ void SwTrnsfrDdeLink::Closed() refObj.Clear(); } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |