bug fix for userforms
[ooovba.git] / crashrep / source / unx / interface.hxx
blob9ff4b2347b44d8a2a4561cffa2d4e341c64e5382
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: interface.hxx,v $
10 * $Revision: 1.6 $
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 #include <sys/types.h>
32 #include <sys/stat.h>
33 #include <unistd.h>
34 #include <string.h>
35 #include <stdio.h>
37 #include <gdk/gdkkeysyms.h>
38 #include <gtk/gtk.h>
39 #include <gdk/gdk.h>
40 #include <gdk/gdkx.h>
42 #include <X11/Xlib.h>
44 #include <hash_map>
45 #include <vector>
46 #include <string>
48 class WizardDialog;
50 // returns success, on true application will quit
51 bool save_crash_report( const std::string& rFileName, const std::hash_map< std::string, std::string >& rSettings );
52 // returns success, on true application will quit
53 bool send_crash_report( WizardDialog *pDialog, const std::hash_map< std::string, std::string >& rSettings );
54 // must return a valid UTF8 string containing the message that will be sent
55 std::string crash_get_details( const std::hash_map< std::string, std::string >& rSettings );
57 class StringResource
59 public:
60 static void init( int argc, char** argv );
61 static const char* get( const char* pKey );
64 class WizardPage
66 protected:
67 std::string m_aWizardTitle;
68 GtkWidget* m_pPageContents;
69 WizardDialog* m_pDialog;
70 public:
71 WizardPage( WizardDialog* pDialog ) : m_pDialog( pDialog ) {}
72 virtual ~WizardPage();
74 const char* getTitle() const { return m_aWizardTitle.c_str(); }
75 GtkWidget* getContents() const { return m_pPageContents; }
77 virtual void update() = 0;
80 class WizardDialog
82 std::vector< WizardPage* > m_aPages;
83 int m_nCurrentPage;
85 GtkWidget* m_pTopLevel;
86 GtkWidget* m_pVBox;
87 GtkWidget* m_pViewPort;
88 GtkWidget* m_pWizardTitle;
89 GtkWidget* m_pPageArea;
90 GtkWidget* m_pSeparator;
91 GtkWidget* m_pButtonBox;
92 GtkWidget* m_pBackButton;
93 GtkWidget* m_pNextButton;
94 GtkWidget* m_pSendButton;
95 GtkWidget* m_pCancelButton;
97 GtkWidget* m_pStatusDialog;
99 std::hash_map< std::string, std::string > m_aSettings;
101 static gint button_clicked( GtkWidget* pButton, WizardDialog* pThis );
103 void nextPage();
104 void lastPage();
105 public:
106 WizardDialog();
107 ~WizardDialog();
109 // takes ownership of page
110 void insertPage( WizardPage* pPage );
112 void show( bool bShow = true );
113 void show_messagebox( const std::string& rMessage );
114 gint show_sendingstatus( bool bInProgress );
115 void hide_sendingstatus();
117 std::hash_map< std::string, std::string >& getSettings() { return m_aSettings; }
118 GtkWindow* getTopLevel() const { return GTK_WINDOW(m_pTopLevel); }
121 class MainPage : public WizardPage
123 GtkWidget* m_pInfo;
124 GtkWidget* m_pEditLabel;
125 GtkWidget* m_pEdit;
126 GtkWidget* m_pEntryLabel;
127 GtkWidget* m_pEntryVBox;
128 GtkWidget* m_pScrolledEntry;
129 GtkWidget* m_pEntry;
130 GtkWidget* m_pHBox;
131 GtkWidget* m_pRightColumn;
132 GtkWidget* m_pLeftColumn;
133 GtkWidget* m_pDetails;
134 GtkWidget* m_pSave;
135 GtkWidget* m_pCheck;
136 GtkWidget* m_pOptions;
137 GtkWidget* m_pAddressLabel;
138 GtkWidget* m_pAddress;
140 static gint button_clicked( GtkWidget* pButton, MainPage* pThis );
141 static gint button_toggled( GtkWidget* pButton, MainPage* pThis );
143 public:
144 MainPage( WizardDialog* );
145 virtual ~MainPage();
147 virtual void update();
150 class WelcomePage : public WizardPage
152 public:
153 WelcomePage( WizardDialog* );
154 virtual ~WelcomePage();
156 virtual void update();
159 class OptionsDialog
161 GtkWidget* m_pDialog;
162 GtkWidget* m_pPage;
163 GtkWidget* m_pLeftColumn;
164 GtkWidget* m_pFrame;
165 GtkWidget* m_pDirect;
166 GtkWidget* m_pManual;
167 GtkWidget* m_pServerLabel;
168 GtkWidget* m_pServer;
169 GtkWidget* m_pColon;
170 GtkWidget* m_pPortLabel;
171 GtkWidget* m_pPort;
172 GtkWidget* m_pNote;
173 GtkWidget* m_pOkButton;
174 GtkWidget* m_pCancelButton;
175 GtkWidget* m_pButtonBox;
176 GtkWidget* m_pVBox;
177 GtkWidget* m_pHBox;
178 GtkWidget* m_pVBoxServer;
179 GtkWidget* m_pVBoxPort;
181 static gint button_toggled( GtkWidget* pButton, OptionsDialog* pThis );
183 public:
184 OptionsDialog( GtkWindow* pParent,
185 std::hash_map< std::string, std::string >& rSettings );
186 virtual ~OptionsDialog();
188 std::string getUseProxy();
189 std::string getServer();
190 std::string getPort();