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 <condedit.hxx>
21 #include <svx/dbaexchange.hxx>
23 using namespace ::svx
;
24 using namespace ::com::sun::star::uno
;
26 ConditionEdit::ConditionEdit(std::unique_ptr
<weld::Entry
> xControl
)
27 : m_xControl(std::move(xControl
))
28 , m_aDropTargetHelper(*this)
34 sal_Int8
ConditionEditDropTarget::AcceptDrop( const AcceptDropEvent
& /*rEvt*/ )
36 return OColumnTransferable::canExtractColumnDescriptor
37 ( GetDataFlavorExVector(),
38 ColumnTransferFormatFlags::COLUMN_DESCRIPTOR
)
43 ConditionEditDropTarget::ConditionEditDropTarget(ConditionEdit
& rEdit
)
44 : DropTargetHelper(rEdit
.get_widget().get_drop_target())
49 sal_Int8
ConditionEditDropTarget::ExecuteDrop( const ExecuteDropEvent
& rEvt
)
51 sal_Int8 nRet
= DND_ACTION_NONE
;
52 if (m_rEdit
.GetDropEnable())
54 TransferableDataHelper
aData( rEvt
.maDropEvent
.Transferable
);
56 const DataFlavorExVector
& rVector
= aData
.GetDataFlavorExVector();
57 if (OColumnTransferable::canExtractColumnDescriptor(rVector
, ColumnTransferFormatFlags::COLUMN_DESCRIPTOR
))
59 ODataAccessDescriptor aColDesc
= OColumnTransferable::extractColumnDescriptor(
62 bool bBrackets
= m_rEdit
.GetBrackets();
65 OUString sTmp
= aColDesc
.getDataSource();
66 sDBName
+= sTmp
+ ".";
68 aColDesc
[DataAccessDescriptorProperty::Command
] >>= sTmp
;
69 sDBName
+= sTmp
+ ".";
71 aColDesc
[DataAccessDescriptorProperty::ColumnName
] >>= sTmp
;
76 m_rEdit
.get_widget().set_text( sDBName
);
77 nRet
= DND_ACTION_COPY
;
84 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */