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 #ifndef _SVTOOLS_STRINGTRANSFER_HXX_
25 #define _SVTOOLS_STRINGTRANSFER_HXX_
26 
27 #include "svtools/svtdllapi.h"
28 #include <svtools/transfer.hxx>
29 
30 //........................................................................
31 namespace svt
32 {
33 //........................................................................
34 
35 	//====================================================================
36 	//= OStringTransferable
37 	//====================================================================
38 	class SVT_DLLPUBLIC OStringTransferable : public TransferableHelper
39 	{
40 	protected:
41 		::rtl::OUString		m_sContent;
42 
43 	public:
44 		OStringTransferable(const ::rtl::OUString& _rContent);
45 
46 	protected:
47 		// TransferableHelper overridables
48 		virtual void				AddSupportedFormats();
49 		virtual sal_Bool			GetData( const ::com::sun::star::datatransfer::DataFlavor& _rFlavor );
50 	};
51 
52 	//====================================================================
53 	//= OStringTransfer
54 	//====================================================================
55 	class OStringTransfer
56 	{
57 	public:
58 		/** copies the string given into the system clipboard
59 			<p>Beware: In opposite to the old DragServer::CopyString, this method does not <em>add</em> the string
60 			to the clipboard, instead the old clipboard content is <em>replaced</em>!</p>
61 		*/
62 		SVT_DLLPUBLIC static void			CopyString( const ::rtl::OUString& _rContent, Window* _pWindow = NULL );
63 
64 		/** extracts a string from the system clipboard given
65 			@return <TRUE/> if the extraction was successfull, i.e. if the clipboard contained a string content
66 		*/
67 		SVT_DLLPUBLIC static sal_Bool		PasteString( ::rtl::OUString& _rContent, Window* _pWindow = NULL );
68 
69 		/** starts dragging a simple string
70 		*/
71 		SVT_DLLPUBLIC static void			StartStringDrag( const ::rtl::OUString& _rContent, Window* _pWindow, sal_Int8 _nDragSourceActions );
72 	};
73 
74 //........................................................................
75 }	// namespace svt
76 //........................................................................
77 
78 #endif // _SVTOOLS_STRINGTRANSFER_HXX_
79 
80