xref: /AOO41X/main/desktop/source/deployment/gui/dp_gui_updatedialog.hxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir #ifndef INCLUDED_DESKTOP_SOURCE_DEPLOYMENT_GUI_DP_GUI_UPDATEDIALOG_HXX
29*cdf0e10cSrcweir #define INCLUDED_DESKTOP_SOURCE_DEPLOYMENT_GUI_DP_GUI_UPDATEDIALOG_HXX
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include "sal/config.h"
32*cdf0e10cSrcweir 
33*cdf0e10cSrcweir #include <memory>
34*cdf0e10cSrcweir #include <vector>
35*cdf0e10cSrcweir #include "com/sun/star/uno/Reference.hxx"
36*cdf0e10cSrcweir #include "com/sun/star/uno/Sequence.hxx"
37*cdf0e10cSrcweir #include "rtl/ref.hxx"
38*cdf0e10cSrcweir #include "rtl/ustring.hxx"
39*cdf0e10cSrcweir #include "svtools/svlbitm.hxx"
40*cdf0e10cSrcweir #include "svx/checklbx.hxx"
41*cdf0e10cSrcweir #include "tools/link.hxx"
42*cdf0e10cSrcweir #include "tools/solar.h"
43*cdf0e10cSrcweir #ifndef _SV_BUTTON_HXX
44*cdf0e10cSrcweir #include "vcl/button.hxx"
45*cdf0e10cSrcweir #endif
46*cdf0e10cSrcweir #include "vcl/dialog.hxx"
47*cdf0e10cSrcweir #include "vcl/fixed.hxx"
48*cdf0e10cSrcweir #include <svtools/fixedhyper.hxx>
49*cdf0e10cSrcweir #include <vcl/throbber.hxx>
50*cdf0e10cSrcweir 
51*cdf0e10cSrcweir #include "descedit.hxx"
52*cdf0e10cSrcweir #include "dp_gui_updatedata.hxx"
53*cdf0e10cSrcweir 
54*cdf0e10cSrcweir /// @HTML
55*cdf0e10cSrcweir 
56*cdf0e10cSrcweir class Image;
57*cdf0e10cSrcweir class KeyEvent;
58*cdf0e10cSrcweir class MouseEvent;
59*cdf0e10cSrcweir class ResId;
60*cdf0e10cSrcweir class Window;
61*cdf0e10cSrcweir 
62*cdf0e10cSrcweir namespace com { namespace sun { namespace star {
63*cdf0e10cSrcweir     namespace deployment { class XExtensionManager;
64*cdf0e10cSrcweir                            class XPackage; }
65*cdf0e10cSrcweir     namespace uno { class XComponentContext; }
66*cdf0e10cSrcweir } } }
67*cdf0e10cSrcweir 
68*cdf0e10cSrcweir namespace dp_gui {
69*cdf0e10cSrcweir /**
70*cdf0e10cSrcweir    The modal &ldquo;Check for Updates&rdquo; dialog.
71*cdf0e10cSrcweir */
72*cdf0e10cSrcweir class UpdateDialog: public ModalDialog {
73*cdf0e10cSrcweir public:
74*cdf0e10cSrcweir     /**
75*cdf0e10cSrcweir        Create an instance.
76*cdf0e10cSrcweir 
77*cdf0e10cSrcweir        <p>Exactly one of <code>selectedPackages</code> and
78*cdf0e10cSrcweir        <code>packageManagers</code> must be non-null.</p>
79*cdf0e10cSrcweir 
80*cdf0e10cSrcweir        @param context
81*cdf0e10cSrcweir        a non-null component context
82*cdf0e10cSrcweir 
83*cdf0e10cSrcweir        @param parent
84*cdf0e10cSrcweir        the parent window, may be null
85*cdf0e10cSrcweir 
86*cdf0e10cSrcweir        @param vExtensionList
87*cdf0e10cSrcweir        check for updates for the contained extensions. There must only be one extension with
88*cdf0e10cSrcweir        a particular identifier. If one extension is installed in several repositories, then the
89*cdf0e10cSrcweir        one with the highest version must be used, because it contains the latest known update
90*cdf0e10cSrcweir        information.
91*cdf0e10cSrcweir     */
92*cdf0e10cSrcweir     UpdateDialog(
93*cdf0e10cSrcweir         com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > const & context,
94*cdf0e10cSrcweir         Window * parent,
95*cdf0e10cSrcweir         const std::vector< com::sun::star::uno::Reference<
96*cdf0e10cSrcweir         com::sun::star::deployment::XPackage > > & vExtensionList,
97*cdf0e10cSrcweir         std::vector< dp_gui::UpdateData > * updateData);
98*cdf0e10cSrcweir 
99*cdf0e10cSrcweir     ~UpdateDialog();
100*cdf0e10cSrcweir 
101*cdf0e10cSrcweir     virtual sal_Bool Close();
102*cdf0e10cSrcweir 
103*cdf0e10cSrcweir     virtual short Execute();
104*cdf0e10cSrcweir 
105*cdf0e10cSrcweir     void notifyMenubar( bool bPrepareOnly, bool bRecheckOnly );
106*cdf0e10cSrcweir     static void createNotifyJob( bool bPrepareOnly,
107*cdf0e10cSrcweir         com::sun::star::uno::Sequence< com::sun::star::uno::Sequence< rtl::OUString > > &rItemList );
108*cdf0e10cSrcweir 
109*cdf0e10cSrcweir private:
110*cdf0e10cSrcweir     UpdateDialog(UpdateDialog &); // not defined
111*cdf0e10cSrcweir     void operator =(UpdateDialog &); // not defined
112*cdf0e10cSrcweir 
113*cdf0e10cSrcweir     struct DisabledUpdate;
114*cdf0e10cSrcweir     struct SpecificError;
115*cdf0e10cSrcweir     struct IgnoredUpdate;
116*cdf0e10cSrcweir     struct Index;
117*cdf0e10cSrcweir     friend struct Index;
118*cdf0e10cSrcweir     class Thread;
119*cdf0e10cSrcweir     friend class Thread;
120*cdf0e10cSrcweir 
121*cdf0e10cSrcweir     class CheckListBox: public SvxCheckListBox {
122*cdf0e10cSrcweir     public:
123*cdf0e10cSrcweir         CheckListBox(
124*cdf0e10cSrcweir             UpdateDialog & dialog, ResId const & resource,
125*cdf0e10cSrcweir             Image const & normalStaticImage,
126*cdf0e10cSrcweir             Image const & highContrastStaticImage);
127*cdf0e10cSrcweir 
128*cdf0e10cSrcweir         virtual ~CheckListBox();
129*cdf0e10cSrcweir 
130*cdf0e10cSrcweir         sal_uInt16 getItemCount() const;
131*cdf0e10cSrcweir 
132*cdf0e10cSrcweir     private:
133*cdf0e10cSrcweir         CheckListBox(UpdateDialog::CheckListBox &); // not defined
134*cdf0e10cSrcweir         void operator =(UpdateDialog::CheckListBox &); // not defined
135*cdf0e10cSrcweir 
136*cdf0e10cSrcweir         virtual void MouseButtonDown(MouseEvent const & event);
137*cdf0e10cSrcweir         virtual void MouseButtonUp(MouseEvent const & event);
138*cdf0e10cSrcweir         virtual void KeyInput(KeyEvent const & event);
139*cdf0e10cSrcweir 
140*cdf0e10cSrcweir         void handlePopupMenu( const Point &rPos );
141*cdf0e10cSrcweir 
142*cdf0e10cSrcweir         rtl::OUString m_ignoreUpdate;
143*cdf0e10cSrcweir         rtl::OUString m_ignoreAllUpdates;
144*cdf0e10cSrcweir         rtl::OUString m_enableUpdate;
145*cdf0e10cSrcweir         UpdateDialog & m_dialog;
146*cdf0e10cSrcweir     };
147*cdf0e10cSrcweir 
148*cdf0e10cSrcweir 
149*cdf0e10cSrcweir     friend class CheckListBox;
150*cdf0e10cSrcweir 
151*cdf0e10cSrcweir     sal_uInt16 insertItem( UpdateDialog::Index *pIndex, SvLBoxButtonKind kind );
152*cdf0e10cSrcweir     void addAdditional( UpdateDialog::Index *pIndex, SvLBoxButtonKind kind );
153*cdf0e10cSrcweir     bool isIgnoredUpdate( UpdateDialog::Index *pIndex );
154*cdf0e10cSrcweir     void setIgnoredUpdate( UpdateDialog::Index *pIndex, bool bIgnore, bool bIgnoreAll );
155*cdf0e10cSrcweir 
156*cdf0e10cSrcweir     void addEnabledUpdate( rtl::OUString const & name, dp_gui::UpdateData & data );
157*cdf0e10cSrcweir     void addDisabledUpdate( UpdateDialog::DisabledUpdate & data );
158*cdf0e10cSrcweir     void addSpecificError( UpdateDialog::SpecificError & data );
159*cdf0e10cSrcweir 
160*cdf0e10cSrcweir     void checkingDone();
161*cdf0e10cSrcweir 
162*cdf0e10cSrcweir     void enableOk();
163*cdf0e10cSrcweir 
164*cdf0e10cSrcweir     void getIgnoredUpdates();
165*cdf0e10cSrcweir     void storeIgnoredUpdates();
166*cdf0e10cSrcweir 
167*cdf0e10cSrcweir     void initDescription();
168*cdf0e10cSrcweir     void clearDescription();
169*cdf0e10cSrcweir     bool showDescription(::com::sun::star::uno::Reference<
170*cdf0e10cSrcweir                          ::com::sun::star::deployment::XPackage > const & aExtension);
171*cdf0e10cSrcweir     bool showDescription(std::pair< rtl::OUString, rtl::OUString > const & pairPublisher,
172*cdf0e10cSrcweir                          rtl::OUString const & sReleaseNotes);
173*cdf0e10cSrcweir     bool showDescription( ::com::sun::star::uno::Reference<
174*cdf0e10cSrcweir         ::com::sun::star::xml::dom::XNode > const & aUpdateInfo);
175*cdf0e10cSrcweir     bool showDescription( const String& rDescription, bool bWithPublisher );
176*cdf0e10cSrcweir     bool isReadOnly( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ) const;
177*cdf0e10cSrcweir 
178*cdf0e10cSrcweir     DECL_LINK(selectionHandler, void *);
179*cdf0e10cSrcweir     DECL_LINK(allHandler, void *);
180*cdf0e10cSrcweir     DECL_LINK(okHandler, void *);
181*cdf0e10cSrcweir     DECL_LINK(closeHandler, void *);
182*cdf0e10cSrcweir     DECL_LINK(hyperlink_clicked, svt::FixedHyperlink *);
183*cdf0e10cSrcweir 
184*cdf0e10cSrcweir     com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
185*cdf0e10cSrcweir         m_context;
186*cdf0e10cSrcweir     FixedText m_checking;
187*cdf0e10cSrcweir     Throbber m_throbber;
188*cdf0e10cSrcweir     FixedText m_update;
189*cdf0e10cSrcweir     UpdateDialog::CheckListBox m_updates;
190*cdf0e10cSrcweir     CheckBox m_all;
191*cdf0e10cSrcweir     FixedLine m_description;
192*cdf0e10cSrcweir     FixedText m_PublisherLabel;
193*cdf0e10cSrcweir     svt::FixedHyperlink m_PublisherLink;
194*cdf0e10cSrcweir     FixedText m_ReleaseNotesLabel;
195*cdf0e10cSrcweir     svt::FixedHyperlink m_ReleaseNotesLink;
196*cdf0e10cSrcweir     dp_gui::DescriptionEdit m_descriptions;
197*cdf0e10cSrcweir     FixedLine m_line;
198*cdf0e10cSrcweir     HelpButton m_help;
199*cdf0e10cSrcweir     PushButton m_ok;
200*cdf0e10cSrcweir     PushButton m_close;
201*cdf0e10cSrcweir     rtl::OUString m_error;
202*cdf0e10cSrcweir     rtl::OUString m_none;
203*cdf0e10cSrcweir     rtl::OUString m_noInstallable;
204*cdf0e10cSrcweir     rtl::OUString m_failure;
205*cdf0e10cSrcweir     rtl::OUString m_unknownError;
206*cdf0e10cSrcweir     rtl::OUString m_noDescription;
207*cdf0e10cSrcweir     rtl::OUString m_noInstall;
208*cdf0e10cSrcweir     rtl::OUString m_noDependency;
209*cdf0e10cSrcweir     rtl::OUString m_noDependencyCurVer;
210*cdf0e10cSrcweir     rtl::OUString m_browserbased;
211*cdf0e10cSrcweir     rtl::OUString m_version;
212*cdf0e10cSrcweir     rtl::OUString m_ignoredUpdate;
213*cdf0e10cSrcweir     std::vector< dp_gui::UpdateData > m_enabledUpdates;
214*cdf0e10cSrcweir     std::vector< UpdateDialog::DisabledUpdate > m_disabledUpdates;
215*cdf0e10cSrcweir     std::vector< UpdateDialog::SpecificError > m_specificErrors;
216*cdf0e10cSrcweir     std::vector< UpdateDialog::IgnoredUpdate* > m_ignoredUpdates;
217*cdf0e10cSrcweir     std::vector< Index* > m_ListboxEntries;
218*cdf0e10cSrcweir     std::vector< dp_gui::UpdateData > & m_updateData;
219*cdf0e10cSrcweir     rtl::Reference< UpdateDialog::Thread > m_thread;
220*cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XExtensionManager > m_xExtensionManager;
221*cdf0e10cSrcweir 
222*cdf0e10cSrcweir     Point   m_aFirstLinePos;
223*cdf0e10cSrcweir     Size    m_aFirstLineSize;
224*cdf0e10cSrcweir     long    m_nFirstLineDelta;
225*cdf0e10cSrcweir     long    m_nOneLineMissing;
226*cdf0e10cSrcweir     sal_uInt16  m_nLastID;
227*cdf0e10cSrcweir     bool    m_bModified;
228*cdf0e10cSrcweir };
229*cdf0e10cSrcweir 
230*cdf0e10cSrcweir }
231*cdf0e10cSrcweir 
232*cdf0e10cSrcweir #endif
233