1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
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"
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"
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"
61 namespace com
{ namespace sun
{ namespace star
{
62 namespace awt
{ class XThrobber
; }
63 namespace deployment
{ class XPackageManager
; }
64 namespace uno
{ class XComponentContext
; }
69 The modal “Check for Updates” dialog.
71 class UpdateDialog
: public ModalDialog
{
76 <p>Exactly one of <code>selectedPackages</code> and
77 <code>packageManagers</code> must be non-null.</p>
80 a non-null component context
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
92 com::sun::star::uno::Reference
< com::sun::star::uno::XComponentContext
> const & context
,
94 const std::vector
< dp_gui::TUpdateListEntry
> &vExtensionList
,
95 std::vector
< dp_gui::UpdateData
> * updateData
);
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
);
108 UpdateDialog(UpdateDialog
&); // not defined
109 void operator =(UpdateDialog
&); // not defined
111 struct DisabledUpdate
;
112 struct SpecificError
;
114 friend union IndexUnion
;
120 class CheckListBox
: public SvxCheckListBox
{
123 UpdateDialog
& dialog
, ResId
const & resource
,
124 Image
const & normalStaticImage
,
125 Image
const & highContrastStaticImage
);
127 virtual ~CheckListBox();
129 USHORT
getItemCount() const;
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
;
147 rtl::OUString
const & name
, USHORT position
,
148 std::auto_ptr
< UpdateDialog::Index
const > index
,
149 SvLBoxButtonKind kind
);
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
);
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
>
183 FixedText m_checking
;
184 com::sun::star::uno::Reference
< com::sun::star::awt::XThrobber
> m_throbber
;
186 UpdateDialog::CheckListBox m_updates
;
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
;
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
;