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::datatransfer
;
29 void OJoinExchObj::setDescriptors(const OJoinExchangeData
& jxdSource
,bool _bFirstEntry
)
31 m_bFirstEntry
= _bFirstEntry
;
32 m_jxdSourceDescription
= jxdSource
;
35 OJoinExchObj::OJoinExchObj()
36 : m_bFirstEntry(false)
40 OJoinExchObj::~OJoinExchObj()
44 bool OJoinExchObj::isFormatAvailable( const DataFlavorExVector
& _rFormats
,SotClipboardFormatId _nSlotID
)
46 for (auto const& format
: _rFormats
)
48 if ( _nSlotID
== format
.mnSotId
)
54 OJoinExchangeData
OJoinExchObj::GetSourceDescription(const Reference
< XTransferable
>& _rxObject
)
56 OJoinExchangeData aReturn
;
57 auto pImplementation
= comphelper::getFromUnoTunnel
<OJoinExchObj
>(_rxObject
);
59 aReturn
= pImplementation
->m_jxdSourceDescription
;
63 const Sequence
< sal_Int8
> & OJoinExchObj::getUnoTunnelId()
65 static const comphelper::UnoIdInit implId
;
66 return implId
.getSeq();
69 sal_Int64 SAL_CALL
OJoinExchObj::getSomething( const Sequence
< sal_Int8
>& _rIdentifier
)
71 return comphelper::getSomethingImpl(_rIdentifier
, this);
74 void OJoinExchObj::AddSupportedFormats()
76 AddFormat( SotClipboardFormatId::SBA_JOIN
);
78 AddFormat( SotClipboardFormatId::SBA_TABID
);
81 bool OJoinExchObj::GetData( const css::datatransfer::DataFlavor
& rFlavor
, const OUString
& /*rDestDoc*/ )
83 SotClipboardFormatId nFormat
= SotExchange::GetFormat(rFlavor
);
84 if ( SotClipboardFormatId::SBA_JOIN
== nFormat
)
86 // we don't really copy our data, the instances using us have to call GetSourceDescription...
87 // if, one day, we have a _lot_ of time, this hack should be removed...
93 Any SAL_CALL
OJoinExchObj::queryInterface( const Type
& _rType
)
95 Any aReturn
= TransferDataContainer::queryInterface(_rType
);
96 if (!aReturn
.hasValue())
97 aReturn
= OJoinExchObj_Base::queryInterface(_rType
);
101 void SAL_CALL
OJoinExchObj::acquire( ) noexcept
103 TransferDataContainer::acquire( );
106 void SAL_CALL
OJoinExchObj::release( ) noexcept
108 TransferDataContainer::release( );
113 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */