xref: /trunk/main/sc/source/ui/app/lnktrans.cxx (revision b3f79822)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_sc.hxx"
26 
27 // INCLUDE ---------------------------------------------------------------
28 
29 
30 
31 #include <svl/urlbmk.hxx>
32 
33 #include "lnktrans.hxx"
34 #include "scmod.hxx"
35 
36 using namespace com::sun::star;
37 
38 // -----------------------------------------------------------------------
39 
ScLinkTransferObj()40 ScLinkTransferObj::ScLinkTransferObj()
41 {
42 }
43 
~ScLinkTransferObj()44 ScLinkTransferObj::~ScLinkTransferObj()
45 {
46 }
47 
SetLinkURL(const String & rURL,const String & rText)48 void ScLinkTransferObj::SetLinkURL( const String& rURL, const String& rText )
49 {
50 	aLinkURL = rURL;
51 	aLinkText = rText;
52 }
53 
AddSupportedFormats()54 void ScLinkTransferObj::AddSupportedFormats()
55 {
56 	if ( aLinkURL.Len() )
57 	{
58 		//	TransferableHelper::SetINetBookmark formats
59 
60 		AddFormat( SOT_FORMATSTR_ID_SOLK );
61 		AddFormat( SOT_FORMAT_STRING );
62 		AddFormat( SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR );
63 		AddFormat( SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK );
64 		AddFormat( SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR );
65 		AddFormat( SOT_FORMATSTR_ID_FILECONTENT );
66 	}
67 }
68 
GetData(const::com::sun::star::datatransfer::DataFlavor & rFlavor)69 sal_Bool ScLinkTransferObj::GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor )
70 {
71 	sal_Bool bOK = sal_False;
72 	if ( aLinkURL.Len() )
73 	{
74 		INetBookmark aBmk( aLinkURL, aLinkText );
75 		bOK = SetINetBookmark( aBmk, rFlavor );
76 	}
77 	return bOK;
78 }
79 
ObjectReleased()80 void ScLinkTransferObj::ObjectReleased()
81 {
82 	TransferableHelper::ObjectReleased();
83 }
84 
DragFinished(sal_Int8 nDropAction)85 void ScLinkTransferObj::DragFinished( sal_Int8 nDropAction )
86 {
87 	ScModule* pScMod = SC_MOD();
88 	pScMod->ResetDragObject();
89 
90 	TransferableHelper::DragFinished( nDropAction );
91 }
92 
93 
94