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 INCLUDED_DESKTOP_SOURCE_DEPLOYMENT_GUI_DP_GUI_UPDATEDIALOG_HXX 29 #define INCLUDED_DESKTOP_SOURCE_DEPLOYMENT_GUI_DP_GUI_UPDATEDIALOG_HXX 30 31 #include "sal/config.h" 32 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> 49 #include <vcl/throbber.hxx> 50 51 #include "descedit.hxx" 52 #include "dp_gui_updatedata.hxx" 53 54 /// @HTML 55 56 class Image; 57 class KeyEvent; 58 class MouseEvent; 59 class ResId; 60 class Window; 61 62 namespace com { namespace sun { namespace star { 63 namespace deployment { class XExtensionManager; 64 class XPackage; } 65 namespace uno { class XComponentContext; } 66 } } } 67 68 namespace dp_gui { 69 /** 70 The modal “Check for Updates” dialog. 71 */ 72 class UpdateDialog: public ModalDialog { 73 public: 74 /** 75 Create an instance. 76 77 <p>Exactly one of <code>selectedPackages</code> and 78 <code>packageManagers</code> must be non-null.</p> 79 80 @param context 81 a non-null component context 82 83 @param parent 84 the parent window, may be null 85 86 @param vExtensionList 87 check for updates for the contained extensions. There must only be one extension with 88 a particular identifier. If one extension is installed in several repositories, then the 89 one with the highest version must be used, because it contains the latest known update 90 information. 91 */ 92 UpdateDialog( 93 com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > const & context, 94 Window * parent, 95 const std::vector< com::sun::star::uno::Reference< 96 com::sun::star::deployment::XPackage > > & vExtensionList, 97 std::vector< dp_gui::UpdateData > * updateData); 98 99 ~UpdateDialog(); 100 101 virtual sal_Bool Close(); 102 103 virtual short Execute(); 104 105 void notifyMenubar( bool bPrepareOnly, bool bRecheckOnly ); 106 static void createNotifyJob( bool bPrepareOnly, 107 com::sun::star::uno::Sequence< com::sun::star::uno::Sequence< rtl::OUString > > &rItemList ); 108 109 private: 110 UpdateDialog(UpdateDialog &); // not defined 111 void operator =(UpdateDialog &); // not defined 112 113 struct DisabledUpdate; 114 struct SpecificError; 115 struct IgnoredUpdate; 116 struct Index; 117 friend struct Index; 118 class Thread; 119 friend class Thread; 120 121 class CheckListBox: public SvxCheckListBox { 122 public: 123 CheckListBox( 124 UpdateDialog & dialog, ResId const & resource, 125 Image const & normalStaticImage, 126 Image const & highContrastStaticImage); 127 128 virtual ~CheckListBox(); 129 130 sal_uInt16 getItemCount() const; 131 132 private: 133 CheckListBox(UpdateDialog::CheckListBox &); // not defined 134 void operator =(UpdateDialog::CheckListBox &); // not defined 135 136 virtual void MouseButtonDown(MouseEvent const & event); 137 virtual void MouseButtonUp(MouseEvent const & event); 138 virtual void KeyInput(KeyEvent const & event); 139 140 void handlePopupMenu( const Point &rPos ); 141 142 rtl::OUString m_ignoreUpdate; 143 rtl::OUString m_ignoreAllUpdates; 144 rtl::OUString m_enableUpdate; 145 UpdateDialog & m_dialog; 146 }; 147 148 149 friend class CheckListBox; 150 151 sal_uInt16 insertItem( UpdateDialog::Index *pIndex, SvLBoxButtonKind kind ); 152 void addAdditional( UpdateDialog::Index *pIndex, SvLBoxButtonKind kind ); 153 bool isIgnoredUpdate( UpdateDialog::Index *pIndex ); 154 void setIgnoredUpdate( UpdateDialog::Index *pIndex, bool bIgnore, bool bIgnoreAll ); 155 156 void addEnabledUpdate( rtl::OUString const & name, dp_gui::UpdateData & data ); 157 void addDisabledUpdate( UpdateDialog::DisabledUpdate & data ); 158 void addSpecificError( UpdateDialog::SpecificError & data ); 159 160 void checkingDone(); 161 162 void enableOk(); 163 164 void getIgnoredUpdates(); 165 void storeIgnoredUpdates(); 166 167 void initDescription(); 168 void clearDescription(); 169 bool showDescription(::com::sun::star::uno::Reference< 170 ::com::sun::star::deployment::XPackage > const & aExtension); 171 bool showDescription(std::pair< rtl::OUString, rtl::OUString > const & pairPublisher, 172 rtl::OUString const & sReleaseNotes); 173 bool showDescription( ::com::sun::star::uno::Reference< 174 ::com::sun::star::xml::dom::XNode > const & aUpdateInfo); 175 bool showDescription( const String& rDescription, bool bWithPublisher ); 176 bool isReadOnly( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ) const; 177 178 DECL_LINK(selectionHandler, void *); 179 DECL_LINK(allHandler, void *); 180 DECL_LINK(okHandler, void *); 181 DECL_LINK(closeHandler, void *); 182 DECL_LINK(hyperlink_clicked, svt::FixedHyperlink *); 183 184 com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > 185 m_context; 186 FixedText m_checking; 187 Throbber m_throbber; 188 FixedText m_update; 189 UpdateDialog::CheckListBox m_updates; 190 CheckBox m_all; 191 FixedLine m_description; 192 FixedText m_PublisherLabel; 193 svt::FixedHyperlink m_PublisherLink; 194 FixedText m_ReleaseNotesLabel; 195 svt::FixedHyperlink m_ReleaseNotesLink; 196 dp_gui::DescriptionEdit m_descriptions; 197 FixedLine m_line; 198 HelpButton m_help; 199 PushButton m_ok; 200 PushButton m_close; 201 rtl::OUString m_error; 202 rtl::OUString m_none; 203 rtl::OUString m_noInstallable; 204 rtl::OUString m_failure; 205 rtl::OUString m_unknownError; 206 rtl::OUString m_noDescription; 207 rtl::OUString m_noInstall; 208 rtl::OUString m_noDependency; 209 rtl::OUString m_noDependencyCurVer; 210 rtl::OUString m_browserbased; 211 rtl::OUString m_version; 212 rtl::OUString m_ignoredUpdate; 213 std::vector< dp_gui::UpdateData > m_enabledUpdates; 214 std::vector< UpdateDialog::DisabledUpdate > m_disabledUpdates; 215 std::vector< UpdateDialog::SpecificError > m_specificErrors; 216 std::vector< UpdateDialog::IgnoredUpdate* > m_ignoredUpdates; 217 std::vector< Index* > m_ListboxEntries; 218 std::vector< dp_gui::UpdateData > & m_updateData; 219 rtl::Reference< UpdateDialog::Thread > m_thread; 220 ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XExtensionManager > m_xExtensionManager; 221 222 Point m_aFirstLinePos; 223 Size m_aFirstLineSize; 224 long m_nFirstLineDelta; 225 long m_nOneLineMissing; 226 sal_uInt16 m_nLastID; 227 bool m_bModified; 228 }; 229 230 } 231 232 #endif 233