LCOV - code coverage report
Current view: top level - vcl/unx/gtk/fpicker - SalGtkPicker.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 16 0.0 %
Date: 2012-08-25 Functions: 0 9 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                 :            : #ifndef _SALGTKFPICKER_HXX_
      30                 :            : #define _SALGTKFPICKER_HXX_
      31                 :            : 
      32                 :            : #include <osl/mutex.hxx>
      33                 :            : #include <cppuhelper/compbase2.hxx>
      34                 :            : #include <com/sun/star/ui/dialogs/XFilePicker.hpp>
      35                 :            : #include <com/sun/star/ui/dialogs/XFilePicker2.hpp>
      36                 :            : #include <com/sun/star/ui/dialogs/XFolderPicker.hpp>
      37                 :            : #include <com/sun/star/lang/XServiceInfo.hpp>
      38                 :            : #include <com/sun/star/util/XCancellable.hpp>
      39                 :            : 
      40                 :            : #include <com/sun/star/awt/XTopWindowListener.hpp>
      41                 :            : #include <com/sun/star/awt/XExtendedToolkit.hpp>
      42                 :            : #include <com/sun/star/frame/XDesktop.hpp>
      43                 :            : #include <com/sun/star/frame/XTerminateListener.hpp>
      44                 :            : 
      45                 :            : #include <gtk/gtk.h>
      46                 :            : #include <gdk/gdkkeysyms.h>
      47                 :            : 
      48                 :            : #define FOLDERPICKER_TITLE            500
      49                 :            : #define FOLDER_PICKER_DEF_DESCRIPTION 501
      50                 :            : #define FILE_PICKER_TITLE_OPEN        502
      51                 :            : #define FILE_PICKER_TITLE_SAVE        503
      52                 :            : #define FILE_PICKER_FILE_TYPE         504
      53                 :            : #define FILE_PICKER_OVERWRITE         505
      54                 :            : #define FILE_PICKER_ALLFORMATS        506
      55                 :            : 
      56                 :            : class SalGtkPicker
      57                 :            : {
      58                 :            :     public:
      59                 :            :                  SalGtkPicker( const ::com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext>& xContext );
      60                 :            :         virtual ~SalGtkPicker();
      61                 :            :     protected:
      62                 :            :         osl::Mutex m_rbHelperMtx;
      63                 :            :         GtkWidget  *m_pDialog;
      64                 :            :     protected:
      65                 :            :         virtual void SAL_CALL implsetTitle( const ::rtl::OUString& aTitle )
      66                 :            :             throw( ::com::sun::star::uno::RuntimeException );
      67                 :            : 
      68                 :            :         virtual void SAL_CALL implsetDisplayDirectory( const rtl::OUString& rDirectory )
      69                 :            :             throw( com::sun::star::lang::IllegalArgumentException, com::sun::star::uno::RuntimeException );
      70                 :            : 
      71                 :            :         virtual rtl::OUString SAL_CALL implgetDisplayDirectory(  )
      72                 :            :             throw( com::sun::star::uno::RuntimeException );
      73                 :            :         rtl::OUString uritounicode(const gchar *pIn);
      74                 :            :         rtl::OString unicodetouri(const rtl::OUString &rURL);
      75                 :            : 
      76                 :            :         // to instantiate own services
      77                 :            :         ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
      78                 :            :         ::com::sun::star::uno::Reference< com::sun::star::uno::XInterface > createInstance( const rtl::OUString &rName );
      79                 :            : 
      80                 :            :         rtl::OUString getResString( sal_Int32 aId );
      81                 :            :     private:
      82                 :            :         void setGtkLanguage();
      83                 :            : };
      84                 :            : 
      85                 :            : class GdkThreadLock
      86                 :            : {
      87                 :            : public:
      88                 :          0 :     GdkThreadLock() { gdk_threads_enter(); }
      89                 :          0 :     ~GdkThreadLock() { gdk_threads_leave(); }
      90                 :            : };
      91                 :            : 
      92                 :            : //Run the Gtk Dialog. Watch for any "new windows" created while we're
      93                 :            : //executing and consider that a CANCEL event to avoid e.g. "file cannot be opened"
      94                 :            : //modal dialogs and this one getting locked if some other API call causes this
      95                 :            : //to happen while we're opened waiting for user input, e.g.
      96                 :            : //https://bugzilla.redhat.com/show_bug.cgi?id=441108
      97                 :            : class RunDialog :
      98                 :            :     public cppu::WeakComponentImplHelper2<
      99                 :            :         ::com::sun::star::awt::XTopWindowListener,
     100                 :            :         ::com::sun::star::frame::XTerminateListener >
     101                 :            : {
     102                 :            : private:
     103                 :            :     osl::Mutex maLock;
     104                 :            :     GtkWidget *mpDialog;
     105                 :            :     ::com::sun::star::uno::Reference< ::com::sun::star::awt::XExtendedToolkit>  mxToolkit;
     106                 :            :     ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDesktop >  mxDesktop;
     107                 :            : public:
     108                 :            : 
     109                 :            :     // XTopWindowListener
     110                 :            :     using cppu::WeakComponentImplHelperBase::disposing;
     111                 :          0 :     virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& )
     112                 :          0 :         throw(::com::sun::star::uno::RuntimeException) {}
     113                 :            :     virtual void SAL_CALL windowOpened( const ::com::sun::star::lang::EventObject& e )
     114                 :            :         throw (::com::sun::star::uno::RuntimeException);
     115                 :          0 :     virtual void SAL_CALL windowClosing( const ::com::sun::star::lang::EventObject& )
     116                 :          0 :         throw (::com::sun::star::uno::RuntimeException) {}
     117                 :          0 :     virtual void SAL_CALL windowClosed( const ::com::sun::star::lang::EventObject& )
     118                 :          0 :         throw (::com::sun::star::uno::RuntimeException) {}
     119                 :          0 :     virtual void SAL_CALL windowMinimized( const ::com::sun::star::lang::EventObject& )
     120                 :          0 :         throw (::com::sun::star::uno::RuntimeException) {}
     121                 :          0 :     virtual void SAL_CALL windowNormalized( const ::com::sun::star::lang::EventObject& )
     122                 :          0 :         throw (::com::sun::star::uno::RuntimeException) {}
     123                 :          0 :     virtual void SAL_CALL windowActivated( const ::com::sun::star::lang::EventObject& )
     124                 :          0 :         throw (::com::sun::star::uno::RuntimeException) {}
     125                 :          0 :     virtual void SAL_CALL windowDeactivated( const ::com::sun::star::lang::EventObject& )
     126                 :          0 :         throw (::com::sun::star::uno::RuntimeException) {}
     127                 :            : 
     128                 :            :     // XTerminateListener
     129                 :            :     virtual void SAL_CALL queryTermination( const ::com::sun::star::lang::EventObject& aEvent )
     130                 :            :         throw(::com::sun::star::frame::TerminationVetoException, ::com::sun::star::uno::RuntimeException);
     131                 :            :     virtual void SAL_CALL notifyTermination( const ::com::sun::star::lang::EventObject& aEvent )
     132                 :            :         throw(::com::sun::star::uno::RuntimeException);
     133                 :            : public:
     134                 :            :     RunDialog(GtkWidget *pDialog,
     135                 :            :         ::com::sun::star::uno::Reference< ::com::sun::star::awt::XExtendedToolkit > &rToolkit,
     136                 :            :         ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDesktop > &rDesktop
     137                 :            :         );
     138                 :            :     virtual ~RunDialog();
     139                 :            :     gint run();
     140                 :            :     void cancel();
     141                 :            : };
     142                 :            : 
     143                 :            : #endif
     144                 :            : 
     145                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10