1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 "transferable.hxx"
24 CTransferable::CTransferable( wchar_t* dataString
) :
31 df.MimeType = L"text/plain; charset=unicode";
32 df.DataType = cppu::UnoType<OUString>::get();
37 //df.MimeType = L"text/plain; charset=windows1252";
38 df
.MimeType
= L
"text/plain";
39 df
.DataType
= cppu::UnoType
<Sequence
< sal_Int8
>>::get();
46 Any SAL_CALL
CTransferable::getTransferData( const DataFlavor
& aFlavor
)
47 throw(UnsupportedFlavorException
, IOException
, RuntimeException
)
51 /*if ( aFlavor == m_seqDFlv[0] )
53 anyData = makeAny( m_Data );
55 else*/ if ( aFlavor
== m_seqDFlv
[0] )
57 OString
aStr( m_Data
.getStr( ), m_Data
.getLength( ), 1252 );
58 Sequence
< sal_Int8
> sOfChars( aStr
.getLength( ) );
59 sal_Int32 lenStr
= aStr
.getLength( );
61 for ( sal_Int32 i
= 0; i
< lenStr
; ++i
)
62 sOfChars
[i
] = aStr
[i
];
64 anyData
= makeAny( sOfChars
);
70 // getTransferDataFlavors
72 Sequence
< DataFlavor
> SAL_CALL
CTransferable::getTransferDataFlavors( )
73 throw(RuntimeException
)
78 // isDataFlavorSupported
80 sal_Bool SAL_CALL
CTransferable::isDataFlavorSupported( const DataFlavor
& aFlavor
)
81 throw(RuntimeException
)
83 sal_Int32 nLength
= m_seqDFlv
.getLength( );
84 sal_Bool bRet
= sal_False
;
86 for ( sal_Int32 i
= 0; i
< nLength
; ++i
)
88 if ( m_seqDFlv
[i
] == aFlavor
)
100 void SAL_CALL
CTransferable::lostOwnership( const Reference
< XClipboard
>& xClipboard
, const Reference
< XTransferable
>& xTrans
)
101 throw(RuntimeException
)
105 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */