LCOV - code coverage report
Current view: top level - svx/source/form - fmexch.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 181 0.0 %
Date: 2012-08-25 Functions: 0 32 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 228 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #include "fmexch.hxx"
      30                 :            : 
      31                 :            : #include <sot/storage.hxx>
      32                 :            : #include <svl/itempool.hxx>
      33                 :            : 
      34                 :            : #include <sot/formats.hxx>
      35                 :            : #include <svtools/svtreebx.hxx>
      36                 :            : #include <tools/diagnose_ex.h>
      37                 :            : 
      38                 :            : 
      39                 :            : //........................................................................
      40                 :            : namespace svxform
      41                 :            : {
      42                 :            : //........................................................................
      43                 :            : 
      44                 :            :     using namespace ::com::sun::star::uno;
      45                 :            :     using namespace ::com::sun::star::datatransfer;
      46                 :            : 
      47                 :            :     //====================================================================
      48                 :            :     //= OLocalExchange
      49                 :            :     //====================================================================
      50                 :            :     //--------------------------------------------------------------------
      51                 :          0 :     OLocalExchange::OLocalExchange( )
      52                 :            :         :m_bDragging( sal_False )
      53         [ #  # ]:          0 :         ,m_bClipboardOwner( sal_False )
      54                 :            :     {
      55                 :          0 :     }
      56                 :            : 
      57                 :            :     //--------------------------------------------------------------------
      58                 :          0 :     void OLocalExchange::copyToClipboard( Window* _pWindow, const GrantAccess& )
      59                 :            :     {
      60         [ #  # ]:          0 :         if ( m_bClipboardOwner )
      61                 :            :         {   // simulate a lostOwnership to notify parties interested in
      62         [ #  # ]:          0 :             if ( m_aClipboardListener.IsSet() )
      63                 :          0 :                 m_aClipboardListener.Call( this );
      64                 :            :         }
      65                 :            : 
      66                 :          0 :         m_bClipboardOwner = sal_True;
      67                 :          0 :         CopyToClipboard( _pWindow );
      68                 :          0 :     }
      69                 :            : 
      70                 :            :     //--------------------------------------------------------------------
      71                 :          0 :     void OLocalExchange::clear()
      72                 :            :     {
      73         [ #  # ]:          0 :         if ( isClipboardOwner() )
      74                 :            :         {
      75                 :            :             try
      76                 :            :             {
      77                 :          0 :                 Reference< clipboard::XClipboard > xClipBoard( getOwnClipboard() );
      78         [ #  # ]:          0 :                 if ( xClipBoard.is() )
      79 [ #  # ][ #  # ]:          0 :                     xClipBoard->setContents( NULL, NULL );
         [ #  # ][ #  # ]
                 [ #  # ]
      80                 :            :             }
      81                 :          0 :             catch( const Exception& )
      82                 :            :             {
      83                 :            :                 DBG_UNHANDLED_EXCEPTION();
      84                 :            :             }
      85                 :          0 :             m_bClipboardOwner = sal_False;
      86                 :            :         }
      87                 :          0 :     }
      88                 :            : 
      89                 :            :     //--------------------------------------------------------------------
      90                 :          0 :     void SAL_CALL OLocalExchange::lostOwnership( const Reference< clipboard::XClipboard >& _rxClipboard, const Reference< XTransferable >& _rxTrans ) throw(RuntimeException)
      91                 :            :     {
      92                 :          0 :         TransferableHelper::implCallOwnLostOwnership( _rxClipboard, _rxTrans );
      93                 :          0 :         m_bClipboardOwner = sal_False;
      94                 :            : 
      95         [ #  # ]:          0 :         if ( m_aClipboardListener.IsSet() )
      96                 :          0 :             m_aClipboardListener.Call( this );
      97                 :          0 :     }
      98                 :            : 
      99                 :            :     //--------------------------------------------------------------------
     100                 :          0 :     void OLocalExchange::startDrag( Window* _pWindow, sal_Int8 _nDragSourceActions, const GrantAccess& )
     101                 :            :     {
     102                 :          0 :         m_bDragging = sal_True;
     103                 :          0 :         StartDrag( _pWindow, _nDragSourceActions );
     104                 :          0 :     }
     105                 :            : 
     106                 :            :     //--------------------------------------------------------------------
     107                 :          0 :     void OLocalExchange::DragFinished( sal_Int8 nDropAction )
     108                 :            :     {
     109                 :          0 :         TransferableHelper::DragFinished( nDropAction );
     110                 :          0 :         m_bDragging = sal_False;
     111                 :          0 :     }
     112                 :            : 
     113                 :            :     //--------------------------------------------------------------------
     114                 :          0 :     sal_Bool OLocalExchange::hasFormat( const DataFlavorExVector& _rFormats, sal_uInt32 _nFormatId )
     115                 :            :     {
     116                 :          0 :         DataFlavorExVector::const_iterator aSearch;
     117                 :            : 
     118 [ #  # ][ #  # ]:          0 :         for ( aSearch = _rFormats.begin(); aSearch != _rFormats.end(); ++aSearch )
     119         [ #  # ]:          0 :             if ( aSearch->mnSotId == _nFormatId )
     120                 :          0 :                 break;
     121                 :            : 
     122         [ #  # ]:          0 :         return aSearch != _rFormats.end();
     123                 :            :     }
     124                 :            : 
     125                 :            :     //--------------------------------------------------------------------
     126                 :          0 :     sal_Bool OLocalExchange::GetData( const ::com::sun::star::datatransfer::DataFlavor& /*_rFlavor*/ )
     127                 :            :     {
     128                 :          0 :         return sal_False;   // do not have any formats by default
     129                 :            :     }
     130                 :            : 
     131                 :            :     //====================================================================
     132                 :            :     //= OControlTransferData
     133                 :            :     //====================================================================
     134                 :            :     //--------------------------------------------------------------------
     135                 :          0 :     OControlTransferData::OControlTransferData( )
     136 [ #  # ][ #  # ]:          0 :         :m_pFocusEntry( NULL )
                 [ #  # ]
     137                 :            :     {
     138                 :          0 :     }
     139                 :            : 
     140                 :            :     //--------------------------------------------------------------------
     141                 :          0 :     OControlTransferData::OControlTransferData( const Reference< XTransferable >& _rxTransferable )
     142 [ #  # ][ #  # ]:          0 :         :m_pFocusEntry( NULL )
                 [ #  # ]
     143                 :            :     {
     144         [ #  # ]:          0 :         TransferableDataHelper aExchangedData( _rxTransferable );
     145                 :            : 
     146                 :            :         // try the formats we know
     147 [ #  # ][ #  # ]:          0 :         if ( OControlExchange::hasControlPathFormat( aExchangedData.GetDataFlavorExVector() ) )
     148                 :            :         {   // paths to the controls, relative to a root
     149         [ #  # ]:          0 :             Sequence< Any > aControlPathData;
     150 [ #  # ][ #  # ]:          0 :             if ( aExchangedData.GetAny( OControlExchange::getControlPathFormatId() ) >>= aControlPathData )
         [ #  # ][ #  # ]
     151                 :            :             {
     152                 :            :                 DBG_ASSERT( aControlPathData.getLength() >= 2, "OControlTransferData::OControlTransferData: invalid data for the control path format!" );
     153         [ #  # ]:          0 :                 if ( aControlPathData.getLength() >= 2 )
     154                 :            :                 {
     155 [ #  # ][ #  # ]:          0 :                     aControlPathData[0] >>= m_xFormsRoot;
     156 [ #  # ][ #  # ]:          0 :                     aControlPathData[1] >>= m_aControlPaths;
     157                 :            :                 }
     158                 :            :             }
     159                 :            :             else
     160                 :            :             {
     161                 :            :                 OSL_FAIL( "OControlTransferData::OControlTransferData: invalid data for the control path format (2)!" );
     162         [ #  # ]:          0 :             }
     163                 :            :         }
     164 [ #  # ][ #  # ]:          0 :         if ( OControlExchange::hasHiddenControlModelsFormat( aExchangedData.GetDataFlavorExVector() ) )
     165                 :            :         {   // sequence of models of hidden controls
     166 [ #  # ][ #  # ]:          0 :             aExchangedData.GetAny( OControlExchange::getHiddenControlModelsFormatId() ) >>= m_aHiddenControlModels;
                 [ #  # ]
     167                 :            :         }
     168                 :            : 
     169 [ #  # ][ #  # ]:          0 :         updateFormats( );
     170                 :          0 :     }
     171                 :            : 
     172                 :            :     //--------------------------------------------------------------------
     173                 :          0 :     static sal_Bool lcl_fillDataFlavorEx( SotFormatStringId nId, DataFlavorEx& _rFlavor )
     174                 :            :     {
     175                 :          0 :         _rFlavor.mnSotId = nId;
     176                 :          0 :         return SotExchange::GetFormatDataFlavor( _rFlavor.mnSotId, _rFlavor );
     177                 :            :     }
     178                 :            : 
     179                 :            :     //--------------------------------------------------------------------
     180                 :          0 :     void OControlTransferData::updateFormats( )
     181                 :            :     {
     182                 :          0 :         m_aCurrentFormats.clear();
     183         [ #  # ]:          0 :         m_aCurrentFormats.reserve( 3 );
     184                 :            : 
     185                 :          0 :         DataFlavorEx aFlavor;
     186                 :            : 
     187         [ #  # ]:          0 :         if ( m_aHiddenControlModels.getLength() )
     188                 :            :         {
     189 [ #  # ][ #  # ]:          0 :             if ( lcl_fillDataFlavorEx( OControlExchange::getHiddenControlModelsFormatId(), aFlavor ) )
                 [ #  # ]
     190         [ #  # ]:          0 :                 m_aCurrentFormats.push_back( aFlavor );
     191                 :            :         }
     192                 :            : 
     193 [ #  # ][ #  # ]:          0 :         if ( m_xFormsRoot.is() && m_aControlPaths.getLength() )
                 [ #  # ]
     194                 :            :         {
     195 [ #  # ][ #  # ]:          0 :             if ( lcl_fillDataFlavorEx( OControlExchange::getControlPathFormatId(), aFlavor ) )
                 [ #  # ]
     196         [ #  # ]:          0 :                 m_aCurrentFormats.push_back( aFlavor );
     197                 :            :         }
     198                 :            : 
     199         [ #  # ]:          0 :         if ( !m_aSelectedEntries.empty() )
     200                 :            :         {
     201 [ #  # ][ #  # ]:          0 :             if ( lcl_fillDataFlavorEx( OControlExchange::getFieldExchangeFormatId(), aFlavor ) )
                 [ #  # ]
     202         [ #  # ]:          0 :                 m_aCurrentFormats.push_back( aFlavor );
     203                 :          0 :         }
     204                 :          0 :     }
     205                 :            : 
     206                 :            :     //--------------------------------------------------------------------
     207                 :          0 :     size_t OControlTransferData::onEntryRemoved( SvLBoxEntry* _pEntry )
     208                 :            :     {
     209                 :          0 :         m_aSelectedEntries.erase( _pEntry );
     210                 :          0 :         return m_aSelectedEntries.size();
     211                 :            :     }
     212                 :            : 
     213                 :            :     //--------------------------------------------------------------------
     214                 :          0 :     void OControlTransferData::addSelectedEntry( SvLBoxEntry* _pEntry )
     215                 :            :     {
     216                 :          0 :         m_aSelectedEntries.insert( _pEntry );
     217                 :          0 :     }
     218                 :            : 
     219                 :            :     //--------------------------------------------------------------------
     220                 :          0 :     void OControlTransferData::setFocusEntry( SvLBoxEntry* _pFocusEntry )
     221                 :            :     {
     222                 :          0 :         m_pFocusEntry = _pFocusEntry;
     223                 :          0 :     }
     224                 :            : 
     225                 :            :     //------------------------------------------------------------------------
     226                 :          0 :     void OControlTransferData::addHiddenControlsFormat(const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > > seqInterfaces)
     227                 :            :     {
     228                 :          0 :         m_aHiddenControlModels = seqInterfaces;
     229                 :          0 :     }
     230                 :            : 
     231                 :            :     //------------------------------------------------------------------------
     232                 :          0 :     void OControlTransferData::buildPathFormat(SvTreeListBox* pTreeBox, SvLBoxEntry* pRoot)
     233                 :            :     {
     234                 :          0 :         m_aControlPaths.realloc(0);
     235                 :            : 
     236                 :          0 :         sal_Int32 nEntryCount = m_aSelectedEntries.size();
     237         [ #  # ]:          0 :         if (nEntryCount == 0)
     238                 :          0 :             return;
     239                 :            : 
     240                 :          0 :         m_aControlPaths.realloc(nEntryCount);
     241                 :          0 :         ::com::sun::star::uno::Sequence<sal_uInt32>* pAllPaths = m_aControlPaths.getArray();
     242 [ #  # ][ #  # ]:          0 :         for (   ListBoxEntrySet::const_iterator loop = m_aSelectedEntries.begin();
                 [ #  # ]
     243                 :          0 :                 loop != m_aSelectedEntries.end();
     244                 :            :                 ++loop, ++pAllPaths
     245                 :            :             )
     246                 :            :         {
     247                 :            :             // erst mal sammeln wir den Pfad in einem Array ein
     248         [ #  # ]:          0 :             ::std::vector< sal_uInt32 > aCurrentPath;
     249         [ #  # ]:          0 :             SvLBoxEntry* pCurrentEntry = *loop;
     250                 :            : 
     251                 :          0 :             SvLBoxEntry* pLoop = pCurrentEntry;
     252         [ #  # ]:          0 :             while (pLoop != pRoot)
     253                 :            :             {
     254 [ #  # ][ #  # ]:          0 :                 aCurrentPath.push_back(pLoop->GetChildListPos());
     255         [ #  # ]:          0 :                 pLoop = pTreeBox->GetParent(pLoop);
     256                 :            :                 DBG_ASSERT((pLoop != NULL) || (pRoot == 0), "OControlTransferData::buildPathFormat: invalid root or entry !");
     257                 :            :                     // pLoop == NULL heisst, dass ich am oberen Ende angelangt bin, dann sollte das Ganze abbrechen, was nur bei pRoot == NULL der Fall sein wird
     258                 :            :             }
     259                 :            : 
     260                 :            :             // dann koennen wir ihn in die ::com::sun::star::uno::Sequence uebertragen
     261                 :          0 :             Sequence<sal_uInt32>& rCurrentPath = *pAllPaths;
     262                 :          0 :             sal_Int32 nDepth = aCurrentPath.size();
     263                 :            : 
     264         [ #  # ]:          0 :             rCurrentPath.realloc(nDepth);
     265         [ #  # ]:          0 :             sal_uInt32* pSeq = rCurrentPath.getArray();
     266                 :            :             sal_Int32 j,k;
     267         [ #  # ]:          0 :             for (j = nDepth - 1, k = 0; k<nDepth; --j, ++k)
     268         [ #  # ]:          0 :                 pSeq[j] = aCurrentPath[k];
     269                 :          0 :         }
     270                 :            :     }
     271                 :            : 
     272                 :            :     //------------------------------------------------------------------------
     273                 :          0 :     void OControlTransferData::buildListFromPath(SvTreeListBox* pTreeBox, SvLBoxEntry* pRoot)
     274                 :            :     {
     275         [ #  # ]:          0 :         ListBoxEntrySet aEmpty;
     276         [ #  # ]:          0 :         m_aSelectedEntries.swap( aEmpty );
     277                 :            : 
     278                 :          0 :         sal_Int32 nControls = m_aControlPaths.getLength();
     279                 :          0 :         const ::com::sun::star::uno::Sequence<sal_uInt32>* pPaths = m_aControlPaths.getConstArray();
     280         [ #  # ]:          0 :         for (sal_Int32 i=0; i<nControls; ++i)
     281                 :            :         {
     282                 :          0 :             sal_Int32 nThisPatLength = pPaths[i].getLength();
     283                 :          0 :             const sal_uInt32* pThisPath = pPaths[i].getConstArray();
     284                 :          0 :             SvLBoxEntry* pSearch = pRoot;
     285         [ #  # ]:          0 :             for (sal_Int32 j=0; j<nThisPatLength; ++j)
     286         [ #  # ]:          0 :                 pSearch = pTreeBox->GetEntry(pSearch, pThisPath[j]);
     287                 :            : 
     288         [ #  # ]:          0 :             m_aSelectedEntries.insert( pSearch );
     289                 :          0 :         }
     290                 :          0 :     }
     291                 :            : 
     292                 :            :     //====================================================================
     293                 :            :     //= OControlExchange
     294                 :            :     //====================================================================
     295                 :            :     //--------------------------------------------------------------------
     296         [ #  # ]:          0 :     OControlExchange::OControlExchange( )
     297                 :            :     {
     298                 :          0 :     }
     299                 :            : 
     300                 :            :     //--------------------------------------------------------------------
     301                 :          0 :     sal_Bool OControlExchange::GetData( const DataFlavor& _rFlavor )
     302                 :            :     {
     303                 :          0 :         const sal_uInt32 nFormatId = SotExchange::GetFormat( _rFlavor );
     304                 :            : 
     305         [ #  # ]:          0 :         if ( getControlPathFormatId( ) == nFormatId )
     306                 :            :         {
     307                 :            :             // ugly. We have to pack all the info into one object
     308         [ #  # ]:          0 :             Sequence< Any > aCompleteInfo( 2 );
     309                 :            :             OSL_ENSURE( m_xFormsRoot.is(), "OLocalExchange::GetData: invalid forms root for this format!" );
     310 [ #  # ][ #  # ]:          0 :             aCompleteInfo.getArray()[ 0 ] <<= m_xFormsRoot;
     311 [ #  # ][ #  # ]:          0 :             aCompleteInfo.getArray()[ 1 ] <<= m_aControlPaths;
     312                 :            : 
     313 [ #  # ][ #  # ]:          0 :             SetAny( makeAny( aCompleteInfo ), _rFlavor );
                 [ #  # ]
     314                 :            :         }
     315         [ #  # ]:          0 :         else if ( getHiddenControlModelsFormatId() == nFormatId )
     316                 :            :         {
     317                 :            :             // just need to transfer the models
     318         [ #  # ]:          0 :             SetAny( makeAny( m_aHiddenControlModels ), _rFlavor );
     319                 :            :         }
     320                 :            :         else
     321                 :          0 :             return OLocalExchange::GetData( _rFlavor );
     322                 :            : 
     323                 :          0 :         return sal_True;
     324                 :            :     }
     325                 :            : 
     326                 :            :     //--------------------------------------------------------------------
     327                 :          0 :     void OControlExchange::AddSupportedFormats()
     328                 :            :     {
     329 [ #  # ][ #  # ]:          0 :         if (m_pFocusEntry && !m_aSelectedEntries.empty())
                 [ #  # ]
     330                 :          0 :             AddFormat(getFieldExchangeFormatId());
     331                 :            : 
     332         [ #  # ]:          0 :         if (m_aControlPaths.getLength())
     333                 :          0 :             AddFormat(getControlPathFormatId());
     334                 :            : 
     335         [ #  # ]:          0 :         if (m_aHiddenControlModels.getLength())
     336                 :          0 :             AddFormat(getHiddenControlModelsFormatId());
     337                 :          0 :     }
     338                 :            : 
     339                 :            :     //--------------------------------------------------------------------
     340                 :          0 :     sal_uInt32 OControlExchange::getControlPathFormatId()
     341                 :            :     {
     342                 :            :         static sal_uInt32 s_nFormat = (sal_uInt32)-1;
     343         [ #  # ]:          0 :         if ((sal_uInt32)-1 == s_nFormat)
     344                 :            :         {
     345 [ #  # ][ #  # ]:          0 :             s_nFormat = SotExchange::RegisterFormatName(rtl::OUString("application/x-openoffice;windows_formatname=\"svxform.ControlPathExchange\""));
                 [ #  # ]
     346                 :            :             DBG_ASSERT((sal_uInt32)-1 != s_nFormat, "OControlExchange::getControlPathFormatId: bad exchange id!");
     347                 :            :         }
     348                 :          0 :         return s_nFormat;
     349                 :            :     }
     350                 :            : 
     351                 :            :     //--------------------------------------------------------------------
     352                 :          0 :     sal_uInt32 OControlExchange::getHiddenControlModelsFormatId()
     353                 :            :     {
     354                 :            :         static sal_uInt32 s_nFormat = (sal_uInt32)-1;
     355         [ #  # ]:          0 :         if ((sal_uInt32)-1 == s_nFormat)
     356                 :            :         {
     357 [ #  # ][ #  # ]:          0 :             s_nFormat = SotExchange::RegisterFormatName(rtl::OUString("application/x-openoffice;windows_formatname=\"svxform.HiddenControlModelsExchange\""));
                 [ #  # ]
     358                 :            :             DBG_ASSERT((sal_uInt32)-1 != s_nFormat, "OControlExchange::getHiddenControlModelsFormatId: bad exchange id!");
     359                 :            :         }
     360                 :          0 :         return s_nFormat;
     361                 :            :     }
     362                 :            : 
     363                 :            :     //--------------------------------------------------------------------
     364                 :          0 :     sal_uInt32 OControlExchange::getFieldExchangeFormatId()
     365                 :            :     {
     366                 :            :         static sal_uInt32 s_nFormat = (sal_uInt32)-1;
     367         [ #  # ]:          0 :         if ((sal_uInt32)-1 == s_nFormat)
     368                 :            :         {
     369 [ #  # ][ #  # ]:          0 :             s_nFormat = SotExchange::RegisterFormatName(rtl::OUString("application/x-openoffice;windows_formatname=\"svxform.FieldNameExchange\""));
                 [ #  # ]
     370                 :            :             DBG_ASSERT((sal_uInt32)-1 != s_nFormat, "OControlExchange::getFieldExchangeFormatId: bad exchange id!");
     371                 :            :         }
     372                 :          0 :         return s_nFormat;
     373                 :            :     }
     374                 :            : 
     375                 :            :     //====================================================================
     376                 :            :     //= OControlExchangeHelper
     377                 :            :     //====================================================================
     378                 :          0 :     OLocalExchange* OControlExchangeHelper::createExchange() const
     379                 :            :     {
     380         [ #  # ]:          0 :         return new OControlExchange;
     381                 :            :     }
     382                 :            : 
     383                 :            :     //====================================================================
     384                 :            :     //= OLocalExchangeHelper
     385                 :            :     //====================================================================
     386                 :            :     //--------------------------------------------------------------------
     387                 :          0 :     OLocalExchangeHelper::OLocalExchangeHelper(Window* _pDragSource)
     388                 :            :         :m_pDragSource(_pDragSource)
     389                 :          0 :         ,m_pTransferable(NULL)
     390                 :            :     {
     391                 :          0 :     }
     392                 :            : 
     393                 :            :     //--------------------------------------------------------------------
     394                 :          0 :     OLocalExchangeHelper::~OLocalExchangeHelper()
     395                 :            :     {
     396                 :          0 :         implReset();
     397         [ #  # ]:          0 :     }
     398                 :            : 
     399                 :            :     //--------------------------------------------------------------------
     400                 :          0 :     void OLocalExchangeHelper::startDrag( sal_Int8 nDragSourceActions )
     401                 :            :     {
     402                 :            :         DBG_ASSERT(m_pTransferable, "OLocalExchangeHelper::startDrag: not prepared!");
     403         [ #  # ]:          0 :         m_pTransferable->startDrag( m_pDragSource, nDragSourceActions, OLocalExchange::GrantAccess() );
     404                 :          0 :     }
     405                 :            : 
     406                 :            :     //--------------------------------------------------------------------
     407                 :          0 :     void OLocalExchangeHelper::copyToClipboard( ) const
     408                 :            :     {
     409                 :            :         DBG_ASSERT( m_pTransferable, "OLocalExchangeHelper::copyToClipboard: not prepared!" );
     410         [ #  # ]:          0 :         m_pTransferable->copyToClipboard( m_pDragSource, OLocalExchange::GrantAccess() );
     411                 :          0 :     }
     412                 :            : 
     413                 :            :     //--------------------------------------------------------------------
     414                 :          0 :     void OLocalExchangeHelper::implReset()
     415                 :            :     {
     416         [ #  # ]:          0 :         if (m_pTransferable)
     417                 :            :         {
     418                 :          0 :             m_pTransferable->setClipboardListener( Link() );
     419                 :          0 :             m_pTransferable->release();
     420                 :          0 :             m_pTransferable = NULL;
     421                 :            :         }
     422                 :          0 :     }
     423                 :            : 
     424                 :            :     //--------------------------------------------------------------------
     425                 :          0 :     void OLocalExchangeHelper::prepareDrag( )
     426                 :            :     {
     427                 :            :         DBG_ASSERT(!m_pTransferable || !m_pTransferable->isDragging(), "OLocalExchangeHelper::prepareDrag: recursive DnD?");
     428                 :            : 
     429                 :          0 :         implReset();
     430                 :          0 :         m_pTransferable = createExchange();
     431                 :          0 :         m_pTransferable->acquire();
     432                 :          0 :     }
     433                 :            : 
     434                 :            : //........................................................................
     435                 :            : }
     436                 :            : //........................................................................
     437                 :            : 
     438                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10