update dev300-m58
[ooovba.git] / fpicker / source / unx / gnome / SalGtkPicker.hxx
bloba520117c0e60ae6b564561a4491259703bc052d6
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: SalGtkPicker.hxx,v $
10 * $Revision: 1.10.42.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _SALGTKFPICKER_HXX_
32 #define _SALGTKFPICKER_HXX_
34 //_____________________________________________________________________________
35 // includes of other projects
36 //_____________________________________________________________________________
38 #include <osl/mutex.hxx>
39 #include <cppuhelper/compbase1.hxx>
40 #include <com/sun/star/ui/dialogs/XFilePicker.hpp>
41 #include <com/sun/star/ui/dialogs/XFilePicker2.hpp>
42 #include <com/sun/star/ui/dialogs/XFolderPicker.hpp>
43 #include <com/sun/star/lang/XServiceInfo.hpp>
44 #include <com/sun/star/util/XCancellable.hpp>
46 #include <com/sun/star/awt/XTopWindowListener.hpp>
47 #include <com/sun/star/awt/XExtendedToolkit.hpp>
49 #include <gtk/gtk.h>
50 #include <gdk/gdkkeysyms.h>
52 //----------------------------------------------------------
53 // class declaration
54 //----------------------------------------------------------
56 class SalGtkPicker
58 public:
59 SalGtkPicker() : m_pDialog(0) {}
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 );
68 virtual void SAL_CALL implsetDisplayDirectory( const rtl::OUString& rDirectory )
69 throw( com::sun::star::lang::IllegalArgumentException, com::sun::star::uno::RuntimeException );
71 virtual rtl::OUString SAL_CALL implgetDisplayDirectory( )
72 throw( com::sun::star::uno::RuntimeException );
73 static rtl::OUString uritounicode(const gchar *pIn);
74 static rtl::OString unicodetouri(const rtl::OUString &rURL);
77 //Run the Gtk Dialog. Watch for any "new windows" created while we're
78 //executing and consider that a CANCEL event to avoid e.g. "file cannot be opened"
79 //modal dialogs and this one getting locked if some other API call causes this
80 //to happen while we're opened waiting for user input, e.g.
81 //https://bugzilla.redhat.com/show_bug.cgi?id=441108
82 class RunDialog :
83 public cppu::WeakComponentImplHelper1< ::com::sun::star::awt::XTopWindowListener >
85 private:
86 osl::Mutex maLock;
87 GtkWidget *mpDialog;
88 GdkWindow *mpCreatedParent;
89 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XExtendedToolkit> mxToolkit;
90 public:
92 // XTopWindowListener
93 using cppu::WeakComponentImplHelperBase::disposing;
94 virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& )
95 throw(::com::sun::star::uno::RuntimeException) {}
96 virtual void SAL_CALL windowOpened( const ::com::sun::star::lang::EventObject& e )
97 throw (::com::sun::star::uno::RuntimeException);
98 virtual void SAL_CALL windowClosing( const ::com::sun::star::lang::EventObject& )
99 throw (::com::sun::star::uno::RuntimeException) {}
100 virtual void SAL_CALL windowClosed( const ::com::sun::star::lang::EventObject& )
101 throw (::com::sun::star::uno::RuntimeException) {}
102 virtual void SAL_CALL windowMinimized( const ::com::sun::star::lang::EventObject& )
103 throw (::com::sun::star::uno::RuntimeException) {}
104 virtual void SAL_CALL windowNormalized( const ::com::sun::star::lang::EventObject& )
105 throw (::com::sun::star::uno::RuntimeException) {}
106 virtual void SAL_CALL windowActivated( const ::com::sun::star::lang::EventObject& )
107 throw (::com::sun::star::uno::RuntimeException) {}
108 virtual void SAL_CALL windowDeactivated( const ::com::sun::star::lang::EventObject& )
109 throw (::com::sun::star::uno::RuntimeException) {}
110 public:
111 RunDialog(GtkWidget *pDialog, ::com::sun::star::uno::Reference< ::com::sun::star::awt::XExtendedToolkit > &rToolkit);
112 gint run();
113 void cancel();
114 ~RunDialog();
117 #endif