xref: /trunk/main/padmin/source/helper.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef _PAD_HELPER_HXX_
29 #define _PAD_HELPER_HXX_
30 
31 #ifndef __SGI_STL_LIST
32 #include <list>
33 #endif
34 #include <tools/string.hxx>
35 #ifndef _RESID_HXX
36 #include <tools/resid.hxx>
37 #endif
38 #include <vcl/dialog.hxx>
39 #ifndef _SV_BUTTON_HXX
40 #include <vcl/button.hxx>
41 #endif
42 #include <vcl/edit.hxx>
43 #include <vcl/fixed.hxx>
44 #ifndef _SV_LISTBOX_HXX
45 #include <vcl/lstbox.hxx>
46 #endif
47 #include <vcl/combobox.hxx>
48 
49 #if defined SPA_DLLIMPLEMENTATION
50 #define SPA_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
51 #else
52 #define SPA_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
53 #endif
54 
55 
56 class Config;
57 
58 #define PSPRINT_PPDDIR "driver"
59 
60 namespace padmin
61 {
62 class DelMultiListBox : public MultiListBox
63 {
64     Link			m_aDelPressedLink;
65 public:
66     DelMultiListBox( Window* pParent, const ResId& rResId ) :
67             MultiListBox( pParent, rResId ) {}
68     ~DelMultiListBox() {}
69 
70     virtual long Notify( NotifyEvent& rEvent );
71 
72     Link setDelPressedLink( const Link& rLink )
73     {
74         Link aOldLink( m_aDelPressedLink );
75 				m_aDelPressedLink = rLink;
76 				return aOldLink;
77     }
78     const Link& getDelPressedLink() const { return m_aDelPressedLink; }
79 };
80 
81 class DelListBox : public ListBox
82 {
83     Link			m_aDelPressedLink;
84 public:
85     DelListBox( Window* pParent, const ResId& rResId ) :
86 				ListBox( pParent, rResId ) {}
87     ~DelListBox() {}
88 
89     virtual long Notify( NotifyEvent& rEvent );
90 
91     Link setDelPressedLink( const Link& rLink )
92     {
93         Link aOldLink( m_aDelPressedLink );
94         m_aDelPressedLink = rLink;
95         return aOldLink;
96     }
97     const Link& getDelPressedLink() const { return m_aDelPressedLink; }
98 };
99 
100 class QueryString : public ModalDialog
101 {
102 private:
103     OKButton     m_aOKButton;
104     CancelButton m_aCancelButton;
105     FixedText    m_aFixedText;
106     Edit         m_aEdit;
107     ComboBox	 m_aComboBox;
108 
109     String&      m_rReturnValue;
110     bool		 m_bUseEdit;
111 
112     DECL_LINK( ClickBtnHdl, Button* );
113 
114 public:
115     QueryString( Window*, String &, String &, const ::std::list< String >& rChoices = ::std::list<String>() );
116     // parent window, Query text, initial value
117     ~QueryString();
118 };
119 
120 sal_Bool AreYouSure( Window*, int nRid = -1 );
121 
122 ResId PaResId( sal_uInt32 nId );
123 
124 void FindFiles( const String& rDirectory, ::std::list< String >& rResult, const String& rSuffixes, bool bRecursive = false );
125 
126 Config& getPadminRC();
127 void freePadminRC();
128 
129 bool chooseDirectory( String& rInOutPath );
130 
131 } // namespace padmin
132 
133 #endif
134