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