LCOV - code coverage report
Current view: top level - libreoffice/vcl/inc/generic - gendata.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 17 5.9 %
Date: 2012-12-27 Functions: 1 11 9.1 %
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             :  * Version: MPL 1.1 / GPLv3+ / LGPLv3+
       4             :  *
       5             :  * The contents of this file are subject to the Mozilla Public License Version
       6             :  * 1.1 (the "License"); you may not use this file except in compliance with
       7             :  * the License or as specified alternatively below. You may obtain a copy of
       8             :  * the License at http://www.mozilla.org/MPL/
       9             :  *
      10             :  * Software distributed under the License is distributed on an "AS IS" basis,
      11             :  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
      12             :  * for the specific language governing rights and limitations under the
      13             :  * License.
      14             :  *
      15             :  * Major Contributor(s):
      16             :  * Copyright (C) 2011 Michael Meeks <michael.meeks@suse.org> (initial developer)
      17             :  *
      18             :  * All Rights Reserved.
      19             :  *
      20             :  * For minor contributions see the git repository.
      21             :  *
      22             :  * Alternatively, the contents of this file may be used under the terms of
      23             :  * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
      24             :  * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
      25             :  * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
      26             :  * instead of those above.
      27             :  */
      28             : 
      29             : #ifndef _SV_GENDATA_HXX
      30             : #define _SV_GENDATA_HXX
      31             : 
      32             : #include <osl/socket.hxx>
      33             : #include <saldatabasic.hxx>
      34             : 
      35             : class SalGenericDisplay;
      36             : 
      37             : // Not the prettiest - but helpful for migrating old code ...
      38             : class SalDisplay;
      39             : class GtkSalDisplay;
      40             : enum SalGenericDataType { SAL_DATA_GTK, SAL_DATA_GTK3,
      41             :                           SAL_DATA_TDE3, SAL_DATA_KDE3, SAL_DATA_KDE4,
      42             :                           SAL_DATA_UNX, SAL_DATA_SVP,
      43             :                           SAL_DATA_ANDROID, SAL_DATA_IOS,
      44             :                           SAL_DATA_HEADLESS };
      45             : 
      46             : class VCL_DLLPUBLIC SalGenericData : public SalData
      47             : {
      48             :  protected:
      49             :     SalGenericDataType m_eType;
      50             :     SalGenericDisplay *m_pDisplay;
      51             :     // cached hostname to avoid slow lookup
      52             :     rtl::OUString      m_aHostname;
      53             :     // for transient storage of unicode strings eg. 'u123' by input methods
      54             :     rtl::OUString      m_aUnicodeEntry;
      55             :  public:
      56          32 :     SalGenericData( SalGenericDataType t, SalInstance *pInstance ) : SalData(), m_eType( t ), m_pDisplay( NULL ) { m_pInstance = pInstance; SetSalData( this ); }
      57           0 :     virtual ~SalGenericData() {}
      58           0 :     virtual void Dispose() {}
      59             : 
      60           0 :     SalGenericDisplay *GetDisplay() const { return m_pDisplay; }
      61           0 :     void               SetDisplay( SalGenericDisplay *pDisp ) { m_pDisplay = pDisp; }
      62             : 
      63           0 :     const rtl::OUString& GetHostname()
      64             :     {
      65           0 :         if (m_aHostname.isEmpty())
      66           0 :             osl_getLocalHostname( &m_aHostname.pData );
      67           0 :         return m_aHostname;
      68             :     }
      69           0 :     rtl::OUString &GetUnicodeCommand()
      70             :     {
      71           0 :         return m_aUnicodeEntry;
      72             :     }
      73             :     inline SalGenericDataType GetType() const
      74             :     {
      75             :         return m_eType;
      76             :     }
      77             : 
      78             :     // Mostly useful for remote protocol backends
      79             :     virtual void ErrorTrapPush() = 0;
      80             :     virtual bool ErrorTrapPop( bool bIgnoreError = true ) = 0; // true on error
      81             : 
      82             :     // Not the prettiest - but helpful for migrating old code ...
      83           0 :     inline SalDisplay *GetSalDisplay() const
      84             :     {
      85             :         OSL_ASSERT( m_eType != SAL_DATA_GTK3 );
      86           0 :         return (SalDisplay *)GetDisplay();
      87             :     }
      88           0 :     inline GtkSalDisplay *GetGtkDisplay() const
      89             :     {
      90           0 :         return (GtkSalDisplay *)GetDisplay();
      91             :     }
      92             : };
      93             : 
      94           0 : inline SalGenericData * GetGenericData()
      95             : {
      96           0 :     return (SalGenericData *)ImplGetSVData()->mpSalData;
      97             : }
      98             : 
      99             : #endif
     100             : 
     101             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10