Update ooo320-m1
[ooovba.git] / desktop / source / deployment / gui / dp_gui_updatedialog.hxx
blob080148189e3696cd0a58c5c7588daa16d706598e
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
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.
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).
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.
26 ************************************************************************/
28 #ifndef INCLUDED_DESKTOP_SOURCE_DEPLOYMENT_GUI_DP_GUI_UPDATEDIALOG_HXX
29 #define INCLUDED_DESKTOP_SOURCE_DEPLOYMENT_GUI_DP_GUI_UPDATEDIALOG_HXX
31 #include "sal/config.h"
33 #include <memory>
34 #include <vector>
35 #include "com/sun/star/uno/Reference.hxx"
36 #include "com/sun/star/uno/Sequence.hxx"
37 #include "rtl/ref.hxx"
38 #include "rtl/ustring.hxx"
39 #include "svtools/svlbitm.hxx"
40 #include "svx/checklbx.hxx"
41 #include "tools/link.hxx"
42 #include "tools/solar.h"
43 #ifndef _SV_BUTTON_HXX
44 #include "vcl/button.hxx"
45 #endif
46 #include "vcl/dialog.hxx"
47 #include "vcl/fixed.hxx"
48 #include <svtools/fixedhyper.hxx>
50 #include "descedit.hxx"
51 #include "dp_gui_updatedata.hxx"
53 /// @HTML
55 class Image;
56 class KeyEvent;
57 class MouseEvent;
58 class ResId;
59 class Window;
61 namespace com { namespace sun { namespace star {
62 namespace awt { class XThrobber; }
63 namespace deployment { class XPackageManager; }
64 namespace uno { class XComponentContext; }
65 } } }
67 namespace dp_gui {
68 /**
69 The modal &ldquo;Check for Updates&rdquo; dialog.
71 class UpdateDialog: public ModalDialog {
72 public:
73 /**
74 Create an instance.
76 <p>Exactly one of <code>selectedPackages</code> and
77 <code>packageManagers</code> must be non-null.</p>
79 @param context
80 a non-null component context
82 @param parent
83 the parent window, may be null
85 @param selectedPackages
86 if non-null, only check for updates for the selected packages
88 @param packageManagers
89 if non-null, check for updates for all managed packages
91 UpdateDialog(
92 com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > const & context,
93 Window * parent,
94 const std::vector< dp_gui::TUpdateListEntry > &vExtensionList,
95 std::vector< dp_gui::UpdateData > * updateData);
97 ~UpdateDialog();
99 virtual BOOL Close();
101 virtual short Execute();
103 void notifyMenubar( bool bPrepareOnly, bool bRecheckOnly );
104 static void createNotifyJob( bool bPrepareOnly,
105 com::sun::star::uno::Sequence< com::sun::star::uno::Sequence< rtl::OUString > > &rItemList );
107 private:
108 UpdateDialog(UpdateDialog &); // not defined
109 void operator =(UpdateDialog &); // not defined
111 struct DisabledUpdate;
112 struct SpecificError;
113 union IndexUnion;
114 friend union IndexUnion;
115 struct Index;
116 friend struct Index;
117 class Thread;
118 friend class Thread;
120 class CheckListBox: public SvxCheckListBox {
121 public:
122 CheckListBox(
123 UpdateDialog & dialog, ResId const & resource,
124 Image const & normalStaticImage,
125 Image const & highContrastStaticImage);
127 virtual ~CheckListBox();
129 USHORT getItemCount() const;
131 private:
132 CheckListBox(UpdateDialog::CheckListBox &); // not defined
133 void operator =(UpdateDialog::CheckListBox &); // not defined
135 virtual void MouseButtonDown(MouseEvent const & event);
137 virtual void MouseButtonUp(MouseEvent const & event);
139 virtual void KeyInput(KeyEvent const & event);
141 UpdateDialog & m_dialog;
144 friend class CheckListBox;
146 void insertItem(
147 rtl::OUString const & name, USHORT position,
148 std::auto_ptr< UpdateDialog::Index const > index,
149 SvLBoxButtonKind kind);
151 void addAdditional(
152 rtl::OUString const & name, USHORT position,
153 std::auto_ptr< UpdateDialog::Index const > index,
154 SvLBoxButtonKind kind);
156 void addEnabledUpdate(
157 rtl::OUString const & name, dp_gui::UpdateData const & data);
159 void addDisabledUpdate(UpdateDialog::DisabledUpdate const & data);
161 void addGeneralError(rtl::OUString const & message);
163 void addSpecificError(UpdateDialog::SpecificError const & data);
165 void checkingDone();
167 void enableOk();
169 void initDescription();
170 void clearDescription();
171 bool showDescription( ::com::sun::star::uno::Reference<
172 ::com::sun::star::xml::dom::XNode > const & aUpdateInfo);
173 bool showDescription( const String& rDescription, bool bWithPublisher );
175 DECL_LINK(selectionHandler, void *);
176 DECL_LINK(allHandler, void *);
177 DECL_LINK(okHandler, void *);
178 DECL_LINK(cancelHandler, void *);
179 DECL_LINK(hyperlink_clicked, svt::FixedHyperlink *);
181 com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
182 m_context;
183 FixedText m_checking;
184 com::sun::star::uno::Reference< com::sun::star::awt::XThrobber > m_throbber;
185 FixedText m_update;
186 UpdateDialog::CheckListBox m_updates;
187 CheckBox m_all;
188 FixedLine m_description;
189 FixedText m_PublisherLabel;
190 svt::FixedHyperlink m_PublisherLink;
191 FixedText m_ReleaseNotesLabel;
192 svt::FixedHyperlink m_ReleaseNotesLink;
193 dp_gui::DescriptionEdit m_descriptions;
194 FixedLine m_line;
195 HelpButton m_help;
196 PushButton m_ok;
197 CancelButton m_cancel;
198 rtl::OUString m_error;
199 rtl::OUString m_none;
200 rtl::OUString m_noInstallable;
201 rtl::OUString m_failure;
202 rtl::OUString m_unknownError;
203 rtl::OUString m_noDescription;
204 rtl::OUString m_noInstall;
205 rtl::OUString m_noDependency;
206 rtl::OUString m_noDependencyCurVer;
207 rtl::OUString m_noPermission;
208 rtl::OUString m_noPermissionVista;
209 rtl::OUString m_browserbased;
210 rtl::OUString m_version;
211 std::vector< dp_gui::UpdateData > m_enabledUpdates;
212 std::vector< UpdateDialog::DisabledUpdate > m_disabledUpdates;
213 std::vector< rtl::OUString > m_generalErrors;
214 std::vector< UpdateDialog::SpecificError > m_specificErrors;
215 std::vector< dp_gui::UpdateData > & m_updateData;
216 rtl::Reference< UpdateDialog::Thread > m_thread;
218 Point m_aFirstLinePos;
219 Size m_aFirstLineSize;
220 long m_nFirstLineDelta;
221 long m_nOneLineMissing;
226 #endif