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

Generated by: LCOV version 1.10