LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/sw/source/ui/utlui - condedit.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 38 2.6 %
Date: 2013-07-09 Functions: 2 7 28.6 %
Legend: Lines: hit not hit

          Line data    Source code
       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             : 
      21             : #include <sot/formats.hxx>
      22             : 
      23             : #include <condedit.hxx>
      24             : #include <svx/dbaexchange.hxx>
      25             : #include <vcl/builder.hxx>
      26             : 
      27             : using namespace ::svx;
      28             : using namespace ::com::sun::star::uno;
      29             : 
      30           0 : ConditionEdit::ConditionEdit(Window* pParent, const ResId& rResId)
      31             :     : Edit(pParent, rResId)
      32             :     , DropTargetHelper(this)
      33             :     , bBrackets(true)
      34           0 :     , bEnableDrop(true)
      35             : {
      36           0 : }
      37             : 
      38           0 : ConditionEdit::ConditionEdit(Window* pParent, WinBits nStyle)
      39             :     : Edit(pParent, nStyle)
      40             :     , DropTargetHelper(this)
      41             :     , bBrackets(true)
      42           0 :     , bEnableDrop(true)
      43             : {
      44           0 : }
      45             : 
      46           0 : extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeConditionEdit(Window *pParent, VclBuilder::stringmap &)
      47             : {
      48           0 :     return new ConditionEdit(pParent, WB_LEFT|WB_VCENTER|WB_BORDER|WB_3DLOOK);
      49             : }
      50             : 
      51             : // Drop possible, respectively format known?
      52             : 
      53           0 : sal_Int8 ConditionEdit::AcceptDrop( const AcceptDropEvent& /*rEvt*/ )
      54             : {
      55             :     return OColumnTransferable::canExtractColumnDescriptor
      56           0 :         ( GetDataFlavorExVector(),
      57           0 :                                 CTF_COLUMN_DESCRIPTOR )
      58             :                 ? DND_ACTION_COPY
      59           0 :                 : DND_ACTION_NONE;
      60             : }
      61             : 
      62           0 : sal_Int8 ConditionEdit::ExecuteDrop( const ExecuteDropEvent& rEvt )
      63             : {
      64           0 :     sal_Int8 nRet = DND_ACTION_NONE;
      65           0 :     if( bEnableDrop )
      66             :     {
      67           0 :         TransferableDataHelper aData( rEvt.maDropEvent.Transferable );
      68             : 
      69           0 :             DataFlavorExVector& rVector = aData.GetDataFlavorExVector();
      70           0 :             if(OColumnTransferable::canExtractColumnDescriptor(rVector, CTF_COLUMN_DESCRIPTOR))
      71             :             {
      72             :                 ODataAccessDescriptor aColDesc = OColumnTransferable::extractColumnDescriptor(
      73           0 :                                                                     aData);
      74           0 :                 String sDBName;
      75           0 :                 if (bBrackets)
      76           0 :                     sDBName += '[';
      77           0 :                 OUString sTmp;
      78           0 :                 sTmp = aColDesc.getDataSource();
      79           0 :                 sDBName += String(sTmp);
      80           0 :                 sDBName += '.';
      81             : 
      82           0 :                 aColDesc[daCommand] >>= sTmp;
      83           0 :                 sDBName += String(sTmp);
      84           0 :                 sDBName += '.';
      85             : 
      86           0 :                 aColDesc[daColumnName] >>= sTmp;
      87           0 :                 sDBName += String(sTmp);
      88           0 :                 if (bBrackets)
      89           0 :                     sDBName += ']';
      90             : 
      91           0 :                 SetText( sDBName );
      92           0 :                 nRet = DND_ACTION_COPY;
      93           0 :             }
      94             :     }
      95           0 :     return nRet;
      96          99 : }
      97             : 
      98             : 
      99             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10