Stop leaking all ScPostIt instances.
[LibreOffice.git] / sc / source / ui / app / lnktrans.cxx
blob5733b14523c0dffdf119d3f2d18dc327785c7069
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <svl/urlbmk.hxx>
22 #include "lnktrans.hxx"
23 #include "scmod.hxx"
25 using namespace com::sun::star;
27 // -----------------------------------------------------------------------
29 ScLinkTransferObj::ScLinkTransferObj()
33 ScLinkTransferObj::~ScLinkTransferObj()
37 void ScLinkTransferObj::SetLinkURL( const OUString& rURL, const OUString& rText )
39 aLinkURL = rURL;
40 aLinkText = rText;
43 void ScLinkTransferObj::AddSupportedFormats()
45 if ( !aLinkURL.isEmpty() )
47 // TransferableHelper::SetINetBookmark formats
49 AddFormat( SOT_FORMATSTR_ID_SOLK );
50 AddFormat( SOT_FORMAT_STRING );
51 AddFormat( SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR );
52 AddFormat( SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK );
53 AddFormat( SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR );
54 AddFormat( SOT_FORMATSTR_ID_FILECONTENT );
58 sal_Bool ScLinkTransferObj::GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor )
60 sal_Bool bOK = false;
61 if ( !aLinkURL.isEmpty() )
63 INetBookmark aBmk( aLinkURL, aLinkText );
64 bOK = SetINetBookmark( aBmk, rFlavor );
66 return bOK;
69 void ScLinkTransferObj::ObjectReleased()
71 TransferableHelper::ObjectReleased();
74 void ScLinkTransferObj::DragFinished( sal_Int8 nDropAction )
76 ScModule* pScMod = SC_MOD();
77 pScMod->ResetDragObject();
79 TransferableHelper::DragFinished( nDropAction );
83 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */