LCOV - code coverage report
Current view: top level - vcl/unx/generic/dtrans - X11_service.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 20 34 58.8 %
Date: 2015-06-13 12:38:46 Functions: 5 8 62.5 %
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 "unx/salinst.h"
      21             : 
      22             : #include <X11_clipboard.hxx>
      23             : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      24             : #include <com/sun/star/lang/XSingleServiceFactory.hpp>
      25             : #include <com/sun/star/registry/XRegistryKey.hpp>
      26             : #include <uno/dispatcher.h>
      27             : #include <uno/mapping.hxx>
      28             : #include <cppuhelper/factory.hxx>
      29             : #include <cppuhelper/compbase1.hxx>
      30             : 
      31             : using namespace cppu;
      32             : using namespace com::sun::star::uno;
      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           0 : Sequence< OUString > SAL_CALL x11::X11Clipboard_getSupportedServiceNames()
      39             : {
      40           0 :     Sequence< OUString > aRet(1);
      41           0 :     aRet[0] = "com.sun.star.datatransfer.clipboard.SystemClipboard";
      42           0 :     return aRet;
      43             : }
      44             : 
      45           0 : Sequence< OUString > SAL_CALL x11::Xdnd_getSupportedServiceNames()
      46             : {
      47           0 :     Sequence< OUString > aRet(1);
      48           0 :     aRet[0] = "com.sun.star.datatransfer.dnd.X11DragSource";
      49           0 :     return aRet;
      50             : }
      51             : 
      52           0 : Sequence< OUString > SAL_CALL x11::Xdnd_dropTarget_getSupportedServiceNames()
      53             : {
      54           0 :     Sequence< OUString > aRet(1);
      55           0 :     aRet[0] = "com.sun.star.datatransfer.dnd.X11DropTarget";
      56           0 :     return aRet;
      57             : }
      58             : 
      59          11 : css::uno::Reference< XInterface > X11SalInstance::CreateClipboard( const Sequence< Any >& arguments )
      60             : {
      61          11 :     SelectionManager& rManager = SelectionManager::get();
      62          11 :     css::uno::Sequence<css::uno::Any> mgrArgs(1);
      63          11 :     mgrArgs[0] <<= Application::GetDisplayConnection();
      64          11 :     rManager.initialize(mgrArgs);
      65             : 
      66          22 :     OUString sel;
      67          11 :     if (arguments.getLength() == 0) {
      68          11 :         sel = "CLIPBOARD";
      69           0 :     } else if (arguments.getLength() != 1 || !(arguments[0] >>= sel)) {
      70             :         throw css::lang::IllegalArgumentException(
      71             :             "bad X11SalInstance::CreateClipboard arguments",
      72           0 :             css::uno::Reference<css::uno::XInterface>(), -1);
      73             :     }
      74          11 :     Atom nSelection = rManager.getAtom(sel);
      75             : 
      76          11 :     std::unordered_map< Atom, css::uno::Reference< XClipboard > >::iterator it = m_aInstances.find( nSelection );
      77          11 :     if( it != m_aInstances.end() )
      78           9 :         return it->second;
      79             : 
      80           4 :     css::uno::Reference<css::datatransfer::clipboard::XClipboard> pClipboard = X11Clipboard::create( rManager, nSelection );
      81           2 :     m_aInstances[ nSelection ] = pClipboard;
      82             : 
      83          13 :     return pClipboard;
      84             : }
      85             : 
      86          11 : css::uno::Reference< XInterface > X11SalInstance::CreateDragSource()
      87             : {
      88          11 :     return css::uno::Reference < XInterface >( static_cast<OWeakObject *>(new SelectionManagerHolder()) );
      89             : }
      90             : 
      91          11 : css::uno::Reference< XInterface > X11SalInstance::CreateDropTarget()
      92             : {
      93          11 :     return css::uno::Reference < XInterface >( static_cast<OWeakObject *>(new DropTarget()) );
      94           9 : }
      95             : 
      96             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11