LibreOffice Module dbaccess (master) 1
JoinExchange.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#include <JoinExchange.hxx>
21#include <sot/formats.hxx>
23
24namespace dbaui
25{
26 using namespace ::com::sun::star::uno;
27 using namespace ::com::sun::star::lang;
28 using namespace ::com::sun::star::datatransfer;
29
30 void OJoinExchObj::setDescriptors(const OJoinExchangeData& jxdSource,bool _bFirstEntry)
31 {
32 m_bFirstEntry = _bFirstEntry;
33 m_jxdSourceDescription = jxdSource;
34 }
35
37 : m_bFirstEntry(false)
38 {
39 }
40
42 {
43 }
44
46 {
47 for (auto const& format : _rFormats)
48 {
49 if ( _nSlotID == format.mnSotId )
50 return true;
51 }
52 return false;
53 }
54
56 {
57 OJoinExchangeData aReturn;
58 auto pImplementation = comphelper::getFromUnoTunnel<OJoinExchObj>(_rxObject);
59 if (pImplementation)
60 aReturn = pImplementation->m_jxdSourceDescription;
61 return aReturn;
62 }
63
65 {
66 static const comphelper::UnoIdInit implId;
67 return implId.getSeq();
68 }
69
70 sal_Int64 SAL_CALL OJoinExchObj::getSomething( const Sequence< sal_Int8 >& _rIdentifier )
71 {
72 return comphelper::getSomethingImpl(_rIdentifier, this);
73 }
74
76 {
77 AddFormat( SotClipboardFormatId::SBA_JOIN );
78 if ( m_bFirstEntry )
79 AddFormat( SotClipboardFormatId::SBA_TABID );
80 }
81
82 bool OJoinExchObj::GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& /*rDestDoc*/ )
83 {
85 if ( SotClipboardFormatId::SBA_JOIN == nFormat )
86 // this is a HACK
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...
89 return true;
90
91 return false;
92 }
93
94 Any SAL_CALL OJoinExchObj::queryInterface( const Type& _rType )
95 {
96 Any aReturn = TransferDataContainer::queryInterface(_rType);
97 if (!aReturn.hasValue())
98 aReturn = OJoinExchObj_Base::queryInterface(_rType);
99 return aReturn;
100 }
101
102 void SAL_CALL OJoinExchObj::acquire( ) noexcept
103 {
104 TransferDataContainer::acquire( );
105 }
106
107 void SAL_CALL OJoinExchObj::release( ) noexcept
108 {
109 TransferDataContainer::release( );
110 }
111
112} // namespace dbaui
113
114/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static SotClipboardFormatId GetFormat(const css::datatransfer::DataFlavor &rFlavor)
void AddFormat(SotClipboardFormatId nFormat)
const css::uno::Sequence< sal_Int8 > & getSeq() const
virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const &rType) SAL_OVERRIDE
static bool isFormatAvailable(const DataFlavorExVector &_rFormats, SotClipboardFormatId _nSlotID=SotClipboardFormatId::SBA_JOIN)
OJoinExchangeData m_jxdSourceDescription
virtual bool GetData(const css::datatransfer::DataFlavor &rFlavor, const OUString &rDestDoc) override
virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 > &_rIdentifier) override
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &aType) override
virtual void SAL_CALL acquire() noexcept override
static OJoinExchangeData GetSourceDescription(const css::uno::Reference< css::datatransfer::XTransferable > &_rxObject)
virtual void SAL_CALL release() noexcept override
void setDescriptors(const OJoinExchangeData &jxdSource, bool _bFirstEntry)
virtual ~OJoinExchObj() override
static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId()
virtual void AddSupportedFormats() override
::std::vector< DataFlavorEx > DataFlavorExVector
SotClipboardFormatId
sal_Int64 getSomethingImpl(const css::uno::Sequence< sal_Int8 > &rId, T *pThis, FallbackToGetSomethingOf< Base >={})
Type