LCOV - code coverage report
Current view: top level - vcl/unx/generic/dtrans - X11_service.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 40 0.0 %
Date: 2012-08-25 Functions: 0 6 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 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                 :            : 
      30                 :            : #include "unx/salinst.h"
      31                 :            : 
      32                 :            : #include <X11_clipboard.hxx>
      33                 :            : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      34                 :            : #include <com/sun/star/lang/XSingleServiceFactory.hpp>
      35                 :            : #include <com/sun/star/registry/XRegistryKey.hpp>
      36                 :            : #include <uno/dispatcher.h> // declaration of generic uno interface
      37                 :            : #include <uno/mapping.hxx> // mapping stuff
      38                 :            : #include <cppuhelper/factory.hxx>
      39                 :            : #include <cppuhelper/compbase1.hxx>
      40                 :            : 
      41                 :            : namespace {
      42                 :            : 
      43                 :            : namespace css = com::sun::star;
      44                 :            : 
      45                 :            : }
      46                 :            : 
      47                 :            : using namespace cppu;
      48                 :            : using namespace com::sun::star::lang;
      49                 :            : using namespace com::sun::star::datatransfer::clipboard;
      50                 :            : using namespace com::sun::star::awt;
      51                 :            : using namespace x11;
      52                 :            : 
      53                 :            : using ::rtl::OUString;
      54                 :            : 
      55                 :          0 : Sequence< OUString > SAL_CALL x11::X11Clipboard_getSupportedServiceNames()
      56                 :            : {
      57                 :          0 :     Sequence< OUString > aRet(1);
      58                 :          0 :     aRet[0] = OUString("com.sun.star.datatransfer.clipboard.SystemClipboard");
      59                 :          0 :     return aRet;
      60                 :            : }
      61                 :            : 
      62                 :          0 : Sequence< OUString > SAL_CALL x11::Xdnd_getSupportedServiceNames()
      63                 :            : {
      64                 :          0 :     Sequence< OUString > aRet(1);
      65                 :          0 :     aRet[0] = OUString("com.sun.star.datatransfer.dnd.X11DragSource");
      66                 :          0 :     return aRet;
      67                 :            : }
      68                 :            : 
      69                 :          0 : Sequence< OUString > SAL_CALL x11::Xdnd_dropTarget_getSupportedServiceNames()
      70                 :            : {
      71                 :          0 :     Sequence< OUString > aRet(1);
      72                 :          0 :     aRet[0] = OUString("com.sun.star.datatransfer.dnd.X11DropTarget");
      73                 :          0 :     return aRet;
      74                 :            : }
      75                 :            : 
      76                 :            : // ------------------------------------------------------------------------
      77                 :            : 
      78                 :          0 : css::uno::Reference< XInterface > X11SalInstance::CreateClipboard( const Sequence< Any >& arguments )
      79                 :            : {
      80                 :          0 :     static boost::unordered_map< OUString, ::boost::unordered_map< Atom, Reference< XClipboard > >, ::rtl::OUStringHash > m_aInstances;
      81                 :            : 
      82                 :          0 :     OUString aDisplayName;
      83                 :            :     Atom nSelection;
      84                 :            : 
      85                 :            :     // extract display name from connection argument. An exception is thrown
      86                 :            :     // by SelectionManager.initialize() if no display connection is given.
      87                 :          0 :     if( arguments.getLength() > 0 )
      88                 :            :     {
      89                 :          0 :         css::uno::Reference< XDisplayConnection > xConn;
      90                 :          0 :         arguments.getConstArray()[0] >>= xConn;
      91                 :            : 
      92                 :          0 :         if( xConn.is() )
      93                 :            :         {
      94                 :          0 :             Any aIdentifier = xConn->getIdentifier();
      95                 :          0 :             aIdentifier >>= aDisplayName;
      96                 :          0 :         }
      97                 :            :     }
      98                 :            : 
      99                 :          0 :     SelectionManager& rManager = SelectionManager::get( aDisplayName );
     100                 :          0 :     rManager.initialize( arguments );
     101                 :            : 
     102                 :            :     // check if any other selection than clipboard selection is specified
     103                 :          0 :     if( arguments.getLength() > 1 )
     104                 :            :     {
     105                 :          0 :         OUString aSelectionName;
     106                 :            : 
     107                 :          0 :         arguments.getConstArray()[1] >>= aSelectionName;
     108                 :          0 :         nSelection = rManager.getAtom( aSelectionName );
     109                 :            :     }
     110                 :            :     else
     111                 :            :     {
     112                 :            :         // default atom is clipboard selection
     113                 :          0 :         nSelection = rManager.getAtom( OUString("CLIPBOARD") );
     114                 :            :     }
     115                 :            : 
     116                 :          0 :     ::boost::unordered_map< Atom, css::uno::Reference< XClipboard > >& rMap( m_aInstances[ aDisplayName ] );
     117                 :          0 :     ::boost::unordered_map< Atom, css::uno::Reference< XClipboard > >::iterator it = rMap.find( nSelection );
     118                 :          0 :     if( it != rMap.end() )
     119                 :          0 :         return it->second;
     120                 :            : 
     121                 :          0 :     X11Clipboard* pClipboard = new X11Clipboard( rManager, nSelection );
     122                 :          0 :     rMap[ nSelection ] = pClipboard;
     123                 :            : 
     124                 :          0 :     return static_cast<OWeakObject*>(pClipboard);
     125                 :            : }
     126                 :            : 
     127                 :            : // ------------------------------------------------------------------------
     128                 :            : 
     129                 :          0 : css::uno::Reference< XInterface > X11SalInstance::CreateDragSource()
     130                 :            : {
     131                 :          0 :     return css::uno::Reference < XInterface >( ( OWeakObject * ) new SelectionManagerHolder() );
     132                 :            : }
     133                 :            : 
     134                 :            : // ------------------------------------------------------------------------
     135                 :            : 
     136                 :          0 : css::uno::Reference< XInterface > X11SalInstance::CreateDropTarget()
     137                 :            : {
     138                 :          0 :     return css::uno::Reference < XInterface >( ( OWeakObject * ) new DropTarget() );
     139                 :            : }
     140                 :            : 
     141                 :            : 
     142                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10