LCOV - code coverage report
Current view: top level - vcl/unx/generic/dtrans - config.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 27 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 7 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 <cstdio>
      21             : #include <unotools/configitem.hxx>
      22             : 
      23             : #include "X11_selection.hxx"
      24             : 
      25             : #define SETTINGS_CONFIGNODE "VCL/Settings/Transfer"
      26             : #define SELECTION_PROPERTY "SelectionTimeout"
      27             : 
      28             : namespace x11
      29             : {
      30             : 
      31             : class DtransX11ConfigItem : public ::utl::ConfigItem
      32             : {
      33             :     sal_Int32           m_nSelectionTimeout;
      34             : 
      35             :     virtual void Notify( const ::com::sun::star::uno::Sequence< OUString >& rPropertyNames ) SAL_OVERRIDE;
      36             :     virtual void ImplCommit() SAL_OVERRIDE;
      37             : 
      38             : public:
      39             :     DtransX11ConfigItem();
      40             :     virtual ~DtransX11ConfigItem();
      41             : 
      42           0 :     sal_Int32 getSelectionTimeout() const { return m_nSelectionTimeout; }
      43             : };
      44             : 
      45             : }
      46             : 
      47             : using namespace com::sun::star::lang;
      48             : using namespace com::sun::star::uno;
      49             : using namespace x11;
      50             : 
      51           0 : sal_Int32 SelectionManager::getSelectionTimeout()
      52             : {
      53           0 :     if( m_nSelectionTimeout < 1 )
      54             :     {
      55           0 :         DtransX11ConfigItem aCfg;
      56           0 :         m_nSelectionTimeout = aCfg.getSelectionTimeout();
      57             : #if OSL_DEBUG_LEVEL > 1
      58             :         fprintf( stderr, "initialized selection timeout to %" SAL_PRIdINT32 " seconds\n", m_nSelectionTimeout );
      59             : #endif
      60             :     }
      61           0 :     return m_nSelectionTimeout;
      62             : }
      63             : 
      64             : /*
      65             :  *  DtransX11ConfigItem constructor
      66             :  */
      67             : 
      68           0 : DtransX11ConfigItem::DtransX11ConfigItem() :
      69             :     ConfigItem( OUString( SETTINGS_CONFIGNODE ),
      70             :                 ConfigItemMode::DelayedUpdate ),
      71           0 :     m_nSelectionTimeout( 3 )
      72             : {
      73           0 :     Sequence< OUString > aKeys( 1 );
      74           0 :     aKeys.getArray()[0] = SELECTION_PROPERTY;
      75           0 :     Sequence< Any > aValues = GetProperties( aKeys );
      76             : #if OSL_DEBUG_LEVEL > 1
      77             :     fprintf( stderr, "found %" SAL_PRIdINT32 " properties for %s\n", aValues.getLength(), SELECTION_PROPERTY );
      78             : #endif
      79           0 :     Any* pValue = aValues.getArray();
      80           0 :     for( int i = 0; i < aValues.getLength(); i++, pValue++ )
      81             :     {
      82           0 :         if( pValue->getValueTypeClass() == TypeClass_STRING )
      83             :         {
      84           0 :             const OUString* pLine = static_cast<const OUString*>(pValue->getValue());
      85           0 :             if( !pLine->isEmpty() )
      86             :             {
      87           0 :                 m_nSelectionTimeout = pLine->toInt32();
      88           0 :                 if( m_nSelectionTimeout < 1 )
      89           0 :                     m_nSelectionTimeout = 1;
      90             :             }
      91             : #if OSL_DEBUG_LEVEL > 1
      92             :             fprintf( stderr, "found SelectionTimeout \"%s\"\n",
      93             :                      OUStringToOString( *pLine, osl_getThreadTextEncoding() ).getStr() );
      94             : #endif
      95             :         }
      96             : #if OSL_DEBUG_LEVEL > 1
      97             :         else
      98             :             fprintf( stderr, "found SelectionTimeout of type \"%s\"\n",
      99             :                      OUStringToOString( pValue->getValueType().getTypeName(), osl_getThreadTextEncoding() ).getStr() );
     100             : #endif
     101           0 :     }
     102           0 : }
     103             : 
     104             : /*
     105             :  *  DtransX11ConfigItem destructor
     106             :  */
     107             : 
     108           0 : DtransX11ConfigItem::~DtransX11ConfigItem()
     109             : {
     110           0 : }
     111             : 
     112           0 : void DtransX11ConfigItem::ImplCommit()
     113             : {
     114             :     // for the clipboard service this is readonly, so
     115             :     // there is nothing to commit
     116           0 : }
     117             : 
     118             : /*
     119             :  *  DtransX11ConfigItem::Notify
     120             :  */
     121             : 
     122           0 : void DtransX11ConfigItem::Notify( const Sequence< OUString >& /*rPropertyNames*/ )
     123             : {
     124           0 : }
     125             : 
     126             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11