LCOV - code coverage report
Current view: top level - sw/source/core/uibase/utlui - condedit.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 0 35 0.0 %
Date: 2014-04-11 Functions: 0 4 0.0 %
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             : #include <sot/formats.hxx>
      21             : 
      22             : #include <condedit.hxx>
      23             : #include <svx/dbaexchange.hxx>
      24             : #include <vcl/builder.hxx>
      25             : 
      26             : using namespace ::svx;
      27             : using namespace ::com::sun::star::uno;
      28             : 
      29           0 : ConditionEdit::ConditionEdit(Window* pParent, WinBits nStyle)
      30             :     : Edit(pParent, nStyle)
      31             :     , DropTargetHelper(this)
      32             :     , bBrackets(true)
      33           0 :     , bEnableDrop(true)
      34             : {
      35           0 : }
      36             : 
      37           0 : extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeConditionEdit(Window *pParent, VclBuilder::stringmap &rMap)
      38             : {
      39           0 :     VclBuilder::ensureDefaultWidthChars(rMap);
      40           0 :     return new ConditionEdit(pParent, WB_LEFT|WB_VCENTER|WB_BORDER|WB_3DLOOK);
      41             : }
      42             : 
      43             : // Drop possible, respectively format known?
      44             : 
      45           0 : sal_Int8 ConditionEdit::AcceptDrop( const AcceptDropEvent& /*rEvt*/ )
      46             : {
      47             :     return OColumnTransferable::canExtractColumnDescriptor
      48           0 :         ( GetDataFlavorExVector(),
      49           0 :                                 CTF_COLUMN_DESCRIPTOR )
      50             :                 ? DND_ACTION_COPY
      51           0 :                 : DND_ACTION_NONE;
      52             : }
      53             : 
      54           0 : sal_Int8 ConditionEdit::ExecuteDrop( const ExecuteDropEvent& rEvt )
      55             : {
      56           0 :     sal_Int8 nRet = DND_ACTION_NONE;
      57           0 :     if( bEnableDrop )
      58             :     {
      59           0 :         TransferableDataHelper aData( rEvt.maDropEvent.Transferable );
      60             : 
      61           0 :             DataFlavorExVector& rVector = aData.GetDataFlavorExVector();
      62           0 :             if(OColumnTransferable::canExtractColumnDescriptor(rVector, CTF_COLUMN_DESCRIPTOR))
      63             :             {
      64             :                 ODataAccessDescriptor aColDesc = OColumnTransferable::extractColumnDescriptor(
      65           0 :                                                                     aData);
      66           0 :                 OUString sDBName;
      67           0 :                 if (bBrackets)
      68           0 :                     sDBName += "[";
      69           0 :                 OUString sTmp;
      70           0 :                 sTmp = aColDesc.getDataSource();
      71           0 :                 sDBName += sTmp;
      72           0 :                 sDBName += ".";
      73             : 
      74           0 :                 aColDesc[daCommand] >>= sTmp;
      75           0 :                 sDBName += sTmp;
      76           0 :                 sDBName += ".";
      77             : 
      78           0 :                 aColDesc[daColumnName] >>= sTmp;
      79           0 :                 sDBName += sTmp;
      80           0 :                 if (bBrackets)
      81           0 :                     sDBName += "]";
      82             : 
      83           0 :                 SetText( sDBName );
      84           0 :                 nRet = DND_ACTION_COPY;
      85           0 :             }
      86             :     }
      87           0 :     return nRet;
      88             : }
      89             : 
      90             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10