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 _EXTENSIONS_PRELOAD_OEMWIZ_HXX_
29 #define _EXTENSIONS_PRELOAD_OEMWIZ_HXX_
30 
31 #include <com/sun/star/beans/XPropertySet.hpp>
32 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
33 #include <svtools/wizdlg.hxx>
34 #ifndef _SV_BUTTON_HXX
35 #include <vcl/button.hxx>
36 #endif
37 #include <vcl/tabpage.hxx>
38 #include <vcl/fixed.hxx>
39 #include <svtools/svmedit.hxx>
40 #include <svl/lstner.hxx>
41 #include <vcl/scrbar.hxx>
42 
43 //.........................................................................
44 namespace preload
45 {
46     #define OEM_WELCOME     0
47     #define OEM_LICENSE     1
48     #define OEM_USERDATA    2
49 
50 //.........................................................................
51     //=====================================================================
52     //= OEMPreloadDialog
53 	//=====================================================================
54     struct OEMPreloadDialog_Impl;
55     class OEMPreloadDialog : public WizardDialog
56 	{
57         PushButton      aPrevPB;
58         PushButton      aNextPB;
59         CancelButton    aCancelPB;
60 
61         String          aNextST;
62         String          aAcceptST;
63         String          aFinishST;
64         String          aDlgTitle;
65         String          aLicense;
66         String          aUserData;
67         OEMPreloadDialog_Impl* pImpl;
68 
69         DECL_LINK(NextPrevPageHdl, PushButton*);
70     protected:
71 
72 	public:
73         OEMPreloadDialog(
74 			Window* _pParent,
75 			const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxObjectModel,
76 			const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB
77 		);
78         ~OEMPreloadDialog();
79 
80         const String&   GetAcceptString()const {return aAcceptST;}
81         const String    GetCancelString() const {return aCancelPB.GetText();}
82         void            SetCancelString( const String& rText );
83 
84         static sal_Bool LoadFromLocalFile(const String& rFileName, String& rContent);
85     };
86     class OEMWelcomeTabPage : public TabPage
87     {
88         FixedText   aInfoFT;
89         public:
90             OEMWelcomeTabPage(Window* pParent);
91             ~OEMWelcomeTabPage();
92     };
93     class LicenceView : public MultiLineEdit, public SfxListener
94     {
95         sal_Bool            mbEndReached;
96         Link            maEndReachedHdl;
97         Link            maScrolledHdl;
98 
99     public:
100                         LicenceView( Window* pParent, const ResId& rResId );
101                        ~LicenceView();
102 
103         void            ScrollDown( ScrollType eScroll );
104 
105         sal_Bool            IsEndReached() const;
106         sal_Bool            EndReached() const { return mbEndReached; }
107         void            SetEndReached( sal_Bool bEnd ) { mbEndReached = bEnd; }
108 
109         void            SetEndReachedHdl( const Link& rHdl )  { maEndReachedHdl = rHdl; }
110         const Link&     GetAutocompleteHdl() const { return maEndReachedHdl; }
111 
112         void            SetScrolledHdl( const Link& rHdl )  { maScrolledHdl = rHdl; }
113         const Link&     GetScrolledHdl() const { return maScrolledHdl; }
114 
115         virtual void    Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
116     private:
117         using MultiLineEdit::Notify;
118     };
119     class OEMLicenseTabPage : public TabPage
120     {
121         LicenceView     aLicenseML;
122         FixedText       aInfo1FT;
123         FixedText       aInfo2FT;
124         FixedText       aInfo3FT;
125         FixedText       aInfo2_1FT;
126         FixedText       aInfo3_1FT;
127         CheckBox        aCBAccept;
128         PushButton      aPBPageDown;
129         FixedImage      aArrow;
130         String          aStrAccept;
131         String          aStrNotAccept;
132         String          aOldCancelText;
133         sal_Bool            bEndReached;
134 
135         OEMPreloadDialog* pPreloadDialog;
136 
137         void                EnableControls();
138 
139         DECL_LINK(          AcceptHdl, CheckBox * );
140         DECL_LINK(          PageDownHdl, PushButton * );
141         DECL_LINK(          EndReachedHdl, LicenceView * );
142         DECL_LINK(          ScrolledHdl, LicenceView * );
143 
144         public:
145             OEMLicenseTabPage(OEMPreloadDialog* pParent);
146             ~OEMLicenseTabPage();
147 
148             virtual void ActivatePage();
149     };
150 
151 //.........................................................................
152 }   // namespace preload
153 //.........................................................................
154 
155 #endif // _EXTENSIONS_PRELOAD_OEMWIZ_HXX_
156 
157