LibreOffice Module desktop (master)  1
dp_gui_theextmgr.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #ifndef INCLUDED_DESKTOP_SOURCE_DEPLOYMENT_GUI_DP_GUI_THEEXTMGR_HXX
21 #define INCLUDED_DESKTOP_SOURCE_DEPLOYMENT_GUI_DP_GUI_THEEXTMGR_HXX
22 
23 #include <cppuhelper/implbase.hxx>
24 
25 #include <com/sun/star/container/XNameAccess.hpp>
26 #include <com/sun/star/deployment/XExtensionManager.hpp>
27 #include <com/sun/star/deployment/ExtensionManager.hpp>
28 #include <com/sun/star/frame/XDesktop2.hpp>
29 #include <com/sun/star/frame/XTerminateListener.hpp>
30 #include <com/sun/star/uno/XComponentContext.hpp>
31 #include <com/sun/star/util/XModifyListener.hpp>
32 
33 #include "dp_gui.h"
34 #include "dp_gui_dialog2.hxx"
35 #include "dp_gui_updatedata.hxx"
36 
37 
38 namespace dp_gui {
39 
40 
41 class ExtensionCmdQueue;
42 
43 
45  public ::cppu::WeakImplHelper< css::frame::XTerminateListener,
46  css::util::XModifyListener >
47 {
48 private:
49  css::uno::Reference< css::uno::XComponentContext > m_xContext;
50  css::uno::Reference< css::frame::XDesktop2 > m_xDesktop;
51  css::uno::Reference< css::deployment::XExtensionManager > m_xExtensionManager;
52  css::uno::Reference< css::container::XNameAccess > m_xNameAccessNodes;
53  css::uno::Reference< css::awt::XWindow > m_xParent;
54  std::shared_ptr<ExtMgrDialog> m_xExtMgrDialog;
55  std::unique_ptr<UpdateRequiredDialog> m_xUpdReqDialog;
56  std::unique_ptr<ExtensionCmdQueue> m_xExecuteCmdQueue;
57 
61 
62 public:
63  static ::rtl::Reference<TheExtensionManager> s_ExtMgr;
64 
65  TheExtensionManager( const css::uno::Reference< css::awt::XWindow > &xParent,
66  const css::uno::Reference< css::uno::XComponentContext > &xContext );
67  virtual ~TheExtensionManager() override;
68 
69  void createDialog( const bool bCreateUpdDlg );
70  sal_Int16 execute();
71 
72  bool isModified() const { return m_bModified; }
73  void clearModified() { m_bModified = false; }
74 
76  {
77  if (m_xExtMgrDialog)
78  return m_xExtMgrDialog->getDialog();
79  if (m_xUpdReqDialog)
80  return m_xUpdReqDialog->getDialog();
81  return nullptr;
82  }
84  {
85  if (m_xExtMgrDialog)
86  return m_xExtMgrDialog.get();
87  return m_xUpdReqDialog.get();
88  }
89  ExtensionCmdQueue* getCmdQueue() const { return m_xExecuteCmdQueue.get(); }
90 
91  void SetText( const OUString &rTitle );
92  void Show();
93  void ToTop();
94  void Close();
95  bool isVisible();
96 
97 
98  void checkUpdates();
99  bool installPackage( const OUString &rPackageURL, bool bWarnUser = false );
100  void createPackageList();
101 
102  void terminateDialog();
103 
104  // Tools
105  bool supportsOptions( const css::uno::Reference< css::deployment::XPackage > &xPackage ) const;
106  static PackageState getPackageState( const css::uno::Reference< css::deployment::XPackage > &xPackage );
107  const css::uno::Reference< css::uno::XComponentContext >& getContext() const { return m_xContext; }
108  const css::uno::Reference< css::deployment::XExtensionManager >& getExtensionManager() const { return m_xExtensionManager; }
109  bool isReadOnly( const css::uno::Reference< css::deployment::XPackage > &xPackage ) const;
110 
111 
112  static ::rtl::Reference<TheExtensionManager> get(
113  css::uno::Reference< css::uno::XComponentContext> const & xContext,
114  css::uno::Reference< css::awt::XWindow> const & xParent = nullptr,
115  OUString const & view = OUString() );
116 
117  // XEventListener
118  virtual void SAL_CALL disposing( css::lang::EventObject const & evt ) override;
119 
120  // XTerminateListener
121  virtual void SAL_CALL queryTermination( css::lang::EventObject const & evt ) override;
122  virtual void SAL_CALL notifyTermination( css::lang::EventObject const & evt ) override;
123 
124  // XModifyListener
125  virtual void SAL_CALL modified( css::lang::EventObject const & evt ) override;
126 };
127 
128 } // namespace dp_gui
129 
130 #endif
131 
132 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::uno::Reference< css::awt::XWindow > m_xParent
void SetText(const OUString &rTitle)
const css::uno::Reference< css::deployment::XExtensionManager > & getExtensionManager() const
virtual void SAL_CALL disposing(css::lang::EventObject const &evt) override
TheExtensionManager(const css::uno::Reference< css::awt::XWindow > &xParent, const css::uno::Reference< css::uno::XComponentContext > &xContext)
virtual void SAL_CALL queryTermination(css::lang::EventObject const &evt) override
virtual void SAL_CALL modified(css::lang::EventObject const &evt) override
virtual void SAL_CALL notifyTermination(css::lang::EventObject const &evt) override
std::unique_ptr< UpdateRequiredDialog > m_xUpdReqDialog
static::rtl::Reference< TheExtensionManager > s_ExtMgr
bool isReadOnly(const css::uno::Reference< css::deployment::XPackage > &xPackage) const
std::unique_ptr< ExtensionCmdQueue > m_xExecuteCmdQueue
css::uno::Reference< css::uno::XComponentContext > m_xContext
bool supportsOptions(const css::uno::Reference< css::deployment::XPackage > &xPackage) const
bool installPackage(const OUString &rPackageURL, bool bWarnUser=false)
std::shared_ptr< ExtMgrDialog > m_xExtMgrDialog
css::uno::Reference< css::deployment::XExtensionManager > m_xExtensionManager
static uno::Reference< css::uno::XComponentContext > xContext
Definition: init.cxx:1858
virtual ~TheExtensionManager() override
ExtensionCmdQueue * getCmdQueue() const
PackageState
Definition: dp_gui.h:52
static PackageState getPackageState(const css::uno::Reference< css::deployment::XPackage > &xPackage)
const css::uno::Reference< css::uno::XComponentContext > & getContext() const
css::uno::Reference< css::container::XNameAccess > m_xNameAccessNodes
css::uno::Reference< css::frame::XDesktop2 > m_xDesktop
Definition: dp_gui.h:50
void createDialog(const bool bCreateUpdDlg)
Manages installing of extensions in the GUI mode.