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 .
21 #include <sot/formats.hxx>
23 #include <condedit.hxx>
24 #include <svx/dbaexchange.hxx>
25 #include <vcl/builder.hxx>
27 using namespace ::svx
;
28 using namespace ::com::sun::star::uno
;
30 ConditionEdit::ConditionEdit(Window
* pParent
, const ResId
& rResId
)
31 : Edit(pParent
, rResId
)
32 , DropTargetHelper(this)
38 ConditionEdit::ConditionEdit(Window
* pParent
, WinBits nStyle
)
39 : Edit(pParent
, nStyle
)
40 , DropTargetHelper(this)
46 extern "C" SAL_DLLPUBLIC_EXPORT Window
* SAL_CALL
makeConditionEdit(Window
*pParent
, VclBuilder::stringmap
&)
48 return new ConditionEdit(pParent
, WB_LEFT
|WB_VCENTER
|WB_BORDER
|WB_3DLOOK
);
51 // Drop possible, respectively format known?
53 sal_Int8
ConditionEdit::AcceptDrop( const AcceptDropEvent
& /*rEvt*/ )
55 return OColumnTransferable::canExtractColumnDescriptor
56 ( GetDataFlavorExVector(),
57 CTF_COLUMN_DESCRIPTOR
)
62 sal_Int8
ConditionEdit::ExecuteDrop( const ExecuteDropEvent
& rEvt
)
64 sal_Int8 nRet
= DND_ACTION_NONE
;
67 TransferableDataHelper
aData( rEvt
.maDropEvent
.Transferable
);
69 DataFlavorExVector
& rVector
= aData
.GetDataFlavorExVector();
70 if(OColumnTransferable::canExtractColumnDescriptor(rVector
, CTF_COLUMN_DESCRIPTOR
))
72 ODataAccessDescriptor aColDesc
= OColumnTransferable::extractColumnDescriptor(
78 sTmp
= aColDesc
.getDataSource();
79 sDBName
+= String(sTmp
);
82 aColDesc
[daCommand
] >>= sTmp
;
83 sDBName
+= String(sTmp
);
86 aColDesc
[daColumnName
] >>= sTmp
;
87 sDBName
+= String(sTmp
);
92 nRet
= DND_ACTION_COPY
;
99 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */