bump product version to 4.1.6.2
[LibreOffice.git] / sw / source / ui / utlui / condedit.cxx
blob94dca83b61c9b4969a5d6d118afd30899ddc9793
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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)
33 , bBrackets(true)
34 , bEnableDrop(true)
38 ConditionEdit::ConditionEdit(Window* pParent, WinBits nStyle)
39 : Edit(pParent, nStyle)
40 , DropTargetHelper(this)
41 , bBrackets(true)
42 , bEnableDrop(true)
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 )
58 ? DND_ACTION_COPY
59 : DND_ACTION_NONE;
62 sal_Int8 ConditionEdit::ExecuteDrop( const ExecuteDropEvent& rEvt )
64 sal_Int8 nRet = DND_ACTION_NONE;
65 if( bEnableDrop )
67 TransferableDataHelper aData( rEvt.maDropEvent.Transferable );
69 DataFlavorExVector& rVector = aData.GetDataFlavorExVector();
70 if(OColumnTransferable::canExtractColumnDescriptor(rVector, CTF_COLUMN_DESCRIPTOR))
72 ODataAccessDescriptor aColDesc = OColumnTransferable::extractColumnDescriptor(
73 aData);
74 String sDBName;
75 if (bBrackets)
76 sDBName += '[';
77 OUString sTmp;
78 sTmp = aColDesc.getDataSource();
79 sDBName += String(sTmp);
80 sDBName += '.';
82 aColDesc[daCommand] >>= sTmp;
83 sDBName += String(sTmp);
84 sDBName += '.';
86 aColDesc[daColumnName] >>= sTmp;
87 sDBName += String(sTmp);
88 if (bBrackets)
89 sDBName += ']';
91 SetText( sDBName );
92 nRet = DND_ACTION_COPY;
95 return nRet;
99 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */