1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 // MARKER(update_precomp.py): autogen include statement, do not remove 29 #include "precompiled_sw.hxx" 30 31 // include --------------------------------------------------------------- 32 33 34 #include <sot/formats.hxx> 35 36 #ifndef _CONDEDIT_HXX 37 #include <condedit.hxx> 38 #endif 39 #include <svx/dbaexchange.hxx> 40 using namespace ::svx; 41 using ::rtl::OUString; 42 using namespace ::com::sun::star::uno; 43 #define DB_DD_DELIM 0x0b 44 45 // STATIC DATA ----------------------------------------------------------- 46 47 /*-------------------------------------------------------------------- 48 Beschreibung: 49 --------------------------------------------------------------------*/ 50 51 ConditionEdit::ConditionEdit( Window* pParent, const ResId& rResId ) 52 : Edit( pParent, rResId ), 53 DropTargetHelper( this ), 54 bBrackets( sal_True ), bEnableDrop( sal_True ) 55 { 56 } 57 58 /*-------------------------------------------------------------------- 59 Beschreibung: Drop moeglich, bzw Format bekannt? 60 --------------------------------------------------------------------*/ 61 62 sal_Int8 ConditionEdit::AcceptDrop( const AcceptDropEvent& /*rEvt*/ ) 63 { 64 return OColumnTransferable::canExtractColumnDescriptor 65 ( GetDataFlavorExVector(), 66 CTF_COLUMN_DESCRIPTOR ) 67 ? DND_ACTION_COPY 68 : DND_ACTION_NONE; 69 } 70 71 sal_Int8 ConditionEdit::ExecuteDrop( const ExecuteDropEvent& rEvt ) 72 { 73 sal_Int8 nRet = DND_ACTION_NONE; 74 if( bEnableDrop ) 75 { 76 String sTxt; 77 TransferableDataHelper aData( rEvt.maDropEvent.Transferable ); 78 79 DataFlavorExVector& rVector = aData.GetDataFlavorExVector(); 80 if(OColumnTransferable::canExtractColumnDescriptor(rVector, CTF_COLUMN_DESCRIPTOR)) 81 { 82 ODataAccessDescriptor aColDesc = OColumnTransferable::extractColumnDescriptor( 83 aData); 84 String sDBName; 85 if (bBrackets) 86 sDBName += '['; 87 OUString sTmp; 88 sTmp = aColDesc.getDataSource(); 89 sDBName += String(sTmp); 90 sDBName += '.'; 91 92 aColDesc[daCommand] >>= sTmp; 93 sDBName += String(sTmp); 94 sDBName += '.'; 95 96 aColDesc[daColumnName] >>= sTmp; 97 sDBName += String(sTmp); 98 if (bBrackets) 99 sDBName += ']'; 100 101 SetText( sDBName ); 102 nRet = DND_ACTION_COPY; 103 } 104 } 105 return nRet; 106 } 107 108 109