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