xref: /aoo41x/main/padmin/source/helper.hxx (revision 23e9c6ca)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _PAD_HELPER_HXX_
25 #define _PAD_HELPER_HXX_
26 
27 #ifndef __SGI_STL_LIST
28 #include <list>
29 #endif
30 #include <tools/string.hxx>
31 #ifndef _RESID_HXX
32 #include <tools/resid.hxx>
33 #endif
34 #include <vcl/dialog.hxx>
35 #ifndef _SV_BUTTON_HXX
36 #include <vcl/button.hxx>
37 #endif
38 #include <vcl/edit.hxx>
39 #include <vcl/fixed.hxx>
40 #ifndef _SV_LISTBOX_HXX
41 #include <vcl/lstbox.hxx>
42 #endif
43 #include <vcl/combobox.hxx>
44 
45 #if defined SPA_DLLIMPLEMENTATION
46 #define SPA_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
47 #else
48 #define SPA_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
49 #endif
50 
51 
52 class Config;
53 
54 #define PSPRINT_PPDDIR "driver"
55 
56 namespace padmin
57 {
58 class DelMultiListBox : public MultiListBox
59 {
60     Link			m_aDelPressedLink;
61 public:
DelMultiListBox(Window * pParent,const ResId & rResId)62     DelMultiListBox( Window* pParent, const ResId& rResId ) :
63             MultiListBox( pParent, rResId ) {}
~DelMultiListBox()64     ~DelMultiListBox() {}
65 
66     virtual long Notify( NotifyEvent& rEvent );
67 
setDelPressedLink(const Link & rLink)68     Link setDelPressedLink( const Link& rLink )
69     {
70         Link aOldLink( m_aDelPressedLink );
71 				m_aDelPressedLink = rLink;
72 				return aOldLink;
73     }
getDelPressedLink() const74     const Link& getDelPressedLink() const { return m_aDelPressedLink; }
75 };
76 
77 class DelListBox : public ListBox
78 {
79     Link			m_aDelPressedLink;
80 public:
DelListBox(Window * pParent,const ResId & rResId)81     DelListBox( Window* pParent, const ResId& rResId ) :
82 				ListBox( pParent, rResId ) {}
~DelListBox()83     ~DelListBox() {}
84 
85     virtual long Notify( NotifyEvent& rEvent );
86 
setDelPressedLink(const Link & rLink)87     Link setDelPressedLink( const Link& rLink )
88     {
89         Link aOldLink( m_aDelPressedLink );
90         m_aDelPressedLink = rLink;
91         return aOldLink;
92     }
getDelPressedLink() const93     const Link& getDelPressedLink() const { return m_aDelPressedLink; }
94 };
95 
96 class QueryString : public ModalDialog
97 {
98 private:
99     OKButton     m_aOKButton;
100     CancelButton m_aCancelButton;
101     FixedText    m_aFixedText;
102     Edit         m_aEdit;
103     ComboBox	 m_aComboBox;
104 
105     String&      m_rReturnValue;
106     bool		 m_bUseEdit;
107 
108     DECL_LINK( ClickBtnHdl, Button* );
109 
110 public:
111     QueryString( Window*, String &, String &, const ::std::list< String >& rChoices = ::std::list<String>() );
112     // parent window, Query text, initial value
113     ~QueryString();
114 };
115 
116 sal_Bool AreYouSure( Window*, int nRid = -1 );
117 
118 ResId PaResId( sal_uInt32 nId );
119 
120 void FindFiles( const String& rDirectory, ::std::list< String >& rResult, const String& rSuffixes, bool bRecursive = false );
121 
122 Config& getPadminRC();
123 void freePadminRC();
124 
125 bool chooseDirectory( String& rInOutPath );
126 
127 } // namespace padmin
128 
129 #endif
130