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 <JoinExchange.hxx>
21 #include <sot/formats.hxx>
22 #include <comphelper/servicehelper.hxx>
26 using namespace ::com::sun::star::uno
;
27 using namespace ::com::sun::star::lang
;
28 using namespace ::com::sun::star::datatransfer
;
30 void OJoinExchObj::setDescriptors(const OJoinExchangeData
& jxdSource
,bool _bFirstEntry
)
32 m_bFirstEntry
= _bFirstEntry
;
33 m_jxdSourceDescription
= jxdSource
;
36 OJoinExchObj::OJoinExchObj()
37 : m_bFirstEntry(false)
41 OJoinExchObj::~OJoinExchObj()
45 bool OJoinExchObj::isFormatAvailable( const DataFlavorExVector
& _rFormats
,SotClipboardFormatId _nSlotID
)
47 for (auto const& format
: _rFormats
)
49 if ( _nSlotID
== format
.mnSotId
)
55 OJoinExchangeData
OJoinExchObj::GetSourceDescription(const Reference
< XTransferable
>& _rxObject
)
57 OJoinExchangeData aReturn
;
58 auto pImplementation
= comphelper::getFromUnoTunnel
<OJoinExchObj
>(_rxObject
);
60 aReturn
= pImplementation
->m_jxdSourceDescription
;
64 const Sequence
< sal_Int8
> & OJoinExchObj::getUnoTunnelId()
66 static const comphelper::UnoIdInit implId
;
67 return implId
.getSeq();
70 sal_Int64 SAL_CALL
OJoinExchObj::getSomething( const Sequence
< sal_Int8
>& _rIdentifier
)
72 return comphelper::getSomethingImpl(_rIdentifier
, this);
75 void OJoinExchObj::AddSupportedFormats()
77 AddFormat( SotClipboardFormatId::SBA_JOIN
);
79 AddFormat( SotClipboardFormatId::SBA_TABID
);
82 bool OJoinExchObj::GetData( const css::datatransfer::DataFlavor
& rFlavor
, const OUString
& /*rDestDoc*/ )
84 SotClipboardFormatId nFormat
= SotExchange::GetFormat(rFlavor
);
85 if ( SotClipboardFormatId::SBA_JOIN
== nFormat
)
87 // we don't really copy our data, the instances using us have to call GetSourceDescription...
88 // if, one day, we have a _lot_ of time, this hack should be removed...
94 Any SAL_CALL
OJoinExchObj::queryInterface( const Type
& _rType
)
96 Any aReturn
= TransferDataContainer::queryInterface(_rType
);
97 if (!aReturn
.hasValue())
98 aReturn
= OJoinExchObj_Base::queryInterface(_rType
);
102 void SAL_CALL
OJoinExchObj::acquire( ) noexcept
104 TransferDataContainer::acquire( );
107 void SAL_CALL
OJoinExchObj::release( ) noexcept
109 TransferDataContainer::release( );
114 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */