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

Generated by: LCOV version 1.10