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

Generated by: LCOV version 1.10