LibreOffice Module sw (master)
1
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
sw
source
uibase
utlui
condedit.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 <
condedit.hxx
>
21
#include <
svx/dbaexchange.hxx
>
22
23
using namespace
::
svx
;
24
using namespace
::
com::sun::star::uno
;
25
26
ConditionEdit::ConditionEdit
(std::unique_ptr<weld::Entry> xControl)
27
:
m_xControl
(
std
::move(xControl))
28
, m_aDropTargetHelper(*this)
29
, bBrackets(true)
30
, bEnableDrop(true)
31
{
32
}
33
34
sal_Int8
ConditionEditDropTarget::AcceptDrop
(
const
AcceptDropEvent
&
/*rEvt*/
)
35
{
36
return
OColumnTransferable::canExtractColumnDescriptor
37
(
GetDataFlavorExVector
(),
38
ColumnTransferFormatFlags::COLUMN_DESCRIPTOR )
39
?
DND_ACTION_COPY
40
:
DND_ACTION_NONE
;
41
}
42
43
ConditionEditDropTarget::ConditionEditDropTarget
(
ConditionEdit
& rEdit)
44
:
DropTargetHelper
(rEdit.get_widget().get_drop_target())
45
, m_rEdit(rEdit)
46
{
47
}
48
49
sal_Int8
ConditionEditDropTarget::ExecuteDrop
(
const
ExecuteDropEvent
& rEvt )
50
{
51
sal_Int8
nRet =
DND_ACTION_NONE
;
52
if
(
m_rEdit
.
GetDropEnable
())
53
{
54
TransferableDataHelper
aData
( rEvt.
maDropEvent
.Transferable );
55
56
const
DataFlavorExVector
& rVector = aData.
GetDataFlavorExVector
();
57
if
(OColumnTransferable::canExtractColumnDescriptor(rVector, ColumnTransferFormatFlags::COLUMN_DESCRIPTOR))
58
{
59
ODataAccessDescriptor aColDesc = OColumnTransferable::extractColumnDescriptor(
60
aData);
61
OUString sDBName;
62
bool
bBrackets =
m_rEdit
.
GetBrackets
();
63
if
(bBrackets)
64
sDBName +=
"["
;
65
OUString sTmp = aColDesc.getDataSource();
66
sDBName += sTmp +
"."
;
67
68
aColDesc[DataAccessDescriptorProperty::Command] >>= sTmp;
69
sDBName += sTmp +
"."
;
70
71
aColDesc[DataAccessDescriptorProperty::ColumnName] >>= sTmp;
72
sDBName += sTmp;
73
if
(bBrackets)
74
sDBName +=
"]"
;
75
76
m_rEdit
.
get_widget
().
set_text
( sDBName );
77
nRet =
DND_ACTION_COPY
;
78
}
79
}
80
return
nRet;
81
}
82
83
84
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
ExecuteDropEvent
DropTargetHelper
ExecuteDropEvent::maDropEvent
const css::datatransfer::dnd::DropTargetDropEvent maDropEvent
ConditionEdit::get_widget
weld::Entry & get_widget()
Definition:
condedit.hxx:62
DND_ACTION_COPY
#define DND_ACTION_COPY
m_xControl
Reference< XControl > m_xControl
sal_Int8
signed char sal_Int8
DataFlavorExVector
::std::vector< DataFlavorEx > DataFlavorExVector
ConditionEditDropTarget::AcceptDrop
virtual SAL_DLLPRIVATE sal_Int8 AcceptDrop(const AcceptDropEvent &rEvt) override
Definition:
condedit.cxx:34
svx
weld::Entry::set_text
virtual void set_text(const OUString &rText)=0
com::sun::star::uno
std
AcceptDropEvent
DropTargetHelper::GetDataFlavorExVector
const DataFlavorExVector & GetDataFlavorExVector() const
DND_ACTION_NONE
#define DND_ACTION_NONE
condedit.hxx
SL::aData
constexpr OUStringLiteral aData
Definition:
ww8scan.hxx:47
TransferableDataHelper
ConditionEditDropTarget::ExecuteDrop
virtual SAL_DLLPRIVATE sal_Int8 ExecuteDrop(const ExecuteDropEvent &rEvt) override
Definition:
condedit.cxx:49
dbaexchange.hxx
ConditionEdit
Definition:
condedit.hxx:40
ConditionEdit::GetDropEnable
bool GetDropEnable() const
Definition:
condedit.hxx:67
ConditionEdit::ConditionEdit
ConditionEdit(std::unique_ptr< weld::Entry > xControl)
Definition:
condedit.cxx:26
ConditionEdit::GetBrackets
bool GetBrackets() const
Definition:
condedit.hxx:65
ConditionEditDropTarget::m_rEdit
ConditionEdit & m_rEdit
Definition:
condedit.hxx:31
ConditionEditDropTarget::ConditionEditDropTarget
ConditionEditDropTarget(ConditionEdit &rEdit)
Definition:
condedit.cxx:43
TransferableDataHelper::GetDataFlavorExVector
const DataFlavorExVector & GetDataFlavorExVector() const
Generated on Thu Apr 15 2021 20:37:08 for LibreOffice Module sw (master) by
1.8.10