Update ooo320-m1
[ooovba.git] / sc / source / ui / app / lnktrans.cxx
blob06130834f9cbc9fe29edf3aea8c9d56d6f8fd47b
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: lnktrans.cxx,v $
10 * $Revision: 1.4 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sc.hxx"
34 // INCLUDE ---------------------------------------------------------------
38 #include <svtools/urlbmk.hxx>
40 #include "lnktrans.hxx"
41 #include "scmod.hxx"
43 using namespace com::sun::star;
45 // -----------------------------------------------------------------------
47 ScLinkTransferObj::ScLinkTransferObj()
51 ScLinkTransferObj::~ScLinkTransferObj()
55 void ScLinkTransferObj::SetLinkURL( const String& rURL, const String& rText )
57 aLinkURL = rURL;
58 aLinkText = rText;
61 void ScLinkTransferObj::AddSupportedFormats()
63 if ( aLinkURL.Len() )
65 // TransferableHelper::SetINetBookmark formats
67 AddFormat( SOT_FORMATSTR_ID_SOLK );
68 AddFormat( SOT_FORMAT_STRING );
69 AddFormat( SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR );
70 AddFormat( SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK );
71 AddFormat( SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR );
72 AddFormat( SOT_FORMATSTR_ID_FILECONTENT );
76 sal_Bool ScLinkTransferObj::GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor )
78 sal_Bool bOK = sal_False;
79 if ( aLinkURL.Len() )
81 INetBookmark aBmk( aLinkURL, aLinkText );
82 bOK = SetINetBookmark( aBmk, rFlavor );
84 return bOK;
87 void ScLinkTransferObj::ObjectReleased()
89 TransferableHelper::ObjectReleased();
92 void ScLinkTransferObj::DragFinished( sal_Int8 nDropAction )
94 ScModule* pScMod = SC_MOD();
95 pScMod->ResetDragObject();
97 TransferableHelper::DragFinished( nDropAction );