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 DBACCESS_SOURCE_UI_INC_OPENDOCCONTROLS_HXX
29 #define DBACCESS_SOURCE_UI_INC_OPENDOCCONTROLS_HXX
30 
31 #ifndef _SV_BUTTON_HXX
32 #include <vcl/button.hxx>
33 #endif
34 #ifndef _SV_LSTBOX_HXX
35 #include <vcl/lstbox.hxx>
36 #endif
37 #ifndef _RTL_USTRING_HXX_
38 #include <rtl/ustring.hxx>
39 #endif
40 #include <map>
41 
42 //........................................................................
43 namespace dbaui
44 {
45 //........................................................................
46 
47 	//====================================================================
48 	//= OpenDocumentButton
49 	//====================================================================
50     /** a button which can be used to open a document
51 
52         The text of the button is the same as for the "Open" command in the application
53         UI. Additionally, the icon for this command is also displayed on the button.
54     */
55     class OpenDocumentButton : public PushButton
56 	{
57     private:
58         ::rtl::OUString     m_sModule;
59 
60     public:
61         OpenDocumentButton( Window* _pParent, const sal_Char* _pAsciiModuleName, const ResId& _rResId );
62 
63     protected:
64         void    impl_init( const sal_Char* _pAsciiModuleName );
65 	};
66 
67 	//====================================================================
68 	//= OpenDocumentListBox
69 	//====================================================================
70     class OpenDocumentListBox : public ListBox
71     {
72     private:
73         typedef ::std::pair< String, String >       StringPair;
74         typedef ::std::map< sal_uInt16, StringPair >    MapIndexToStringPair;
75 
76         ::rtl::OUString         m_sModule;
77         MapIndexToStringPair    m_aURLs;
78 
79     public:
80         OpenDocumentListBox( Window* _pParent, const sal_Char* _pAsciiModuleName, const ResId& _rResId );
81 
82         String  GetSelectedDocumentURL() const;
83         String  GetSelectedDocumentFilter() const;
84 
85     protected:
86         virtual void        RequestHelp( const HelpEvent& _rHEvt );
87 
88         StringPair  impl_getDocumentAtIndex( sal_uInt16 _nListIndex, bool _bSystemNotation = false ) const;
89 
90     private:
91         void    impl_init( const sal_Char* _pAsciiModuleName );
92     };
93 
94 //........................................................................
95 } // namespace dbaui
96 //........................................................................
97 
98 #endif // DBACCESS_SOURCE_UI_INC_OPENDOCCONTROLS_HXX
99 
100