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/frame/XDesktop2.hpp>
28 #include <com/sun/star/frame/XTerminateListener.hpp>
29 #include <com/sun/star/uno/XComponentContext.hpp>
30 #include <com/sun/star/util/XModifyListener.hpp>
31 
32 #include "dp_gui.h"
33 #include "dp_gui_dialog2.hxx"
34 
35 
36 namespace dp_gui {
37 
38 
39 class ExtensionCmdQueue;
40 
41 
43  public ::cppu::WeakImplHelper< css::frame::XTerminateListener,
44  css::util::XModifyListener >
45 {
46 private:
47  css::uno::Reference< css::uno::XComponentContext > m_xContext;
48  css::uno::Reference< css::frame::XDesktop2 > m_xDesktop;
49  css::uno::Reference< css::deployment::XExtensionManager > m_xExtensionManager;
50  css::uno::Reference< css::container::XNameAccess > m_xNameAccessNodes;
51  css::uno::Reference< css::awt::XWindow > m_xParent;
52  std::shared_ptr<ExtMgrDialog> m_xExtMgrDialog;
53  std::unique_ptr<UpdateRequiredDialog> m_xUpdReqDialog;
54  std::unique_ptr<ExtensionCmdQueue> m_xExecuteCmdQueue;
55 
59 
60 public:
61  static ::rtl::Reference<TheExtensionManager> s_ExtMgr;
62 
63  TheExtensionManager( const css::uno::Reference< css::awt::XWindow > &xParent,
64  const css::uno::Reference< css::uno::XComponentContext > &xContext );
65  virtual ~TheExtensionManager() override;
66 
67  void createDialog( const bool bCreateUpdDlg );
68  sal_Int16 execute();
69 
70  bool isModified() const { return m_bModified; }
71  void clearModified() { m_bModified = false; }
72 
74  {
75  if (m_xExtMgrDialog)
76  return m_xExtMgrDialog->getDialog();
77  if (m_xUpdReqDialog)
78  return m_xUpdReqDialog->getDialog();
79  return nullptr;
80  }
82  {
83  if (m_xExtMgrDialog)
84  return m_xExtMgrDialog.get();
85  return m_xUpdReqDialog.get();
86  }
87  ExtensionCmdQueue* getCmdQueue() const { return m_xExecuteCmdQueue.get(); }
88 
89  void SetText( const OUString &rTitle );
90  void Show();
91  void ToTop();
92  void Close();
93  bool isVisible();
94 
95 
96  void checkUpdates();
97  bool installPackage( const OUString &rPackageURL, bool bWarnUser = false );
98  void createPackageList();
99 
100  void terminateDialog();
101 
102  // Tools
103  bool supportsOptions( const css::uno::Reference< css::deployment::XPackage > &xPackage ) const;
104  static PackageState getPackageState( const css::uno::Reference< css::deployment::XPackage > &xPackage );
105  const css::uno::Reference< css::uno::XComponentContext >& getContext() const { return m_xContext; }
106  const css::uno::Reference< css::deployment::XExtensionManager >& getExtensionManager() const { return m_xExtensionManager; }
107  bool isReadOnly( const css::uno::Reference< css::deployment::XPackage > &xPackage ) const;
108 
109 
110  static ::rtl::Reference<TheExtensionManager> get(
111  css::uno::Reference< css::uno::XComponentContext> const & xContext,
112  css::uno::Reference< css::awt::XWindow> const & xParent = nullptr,
113  OUString const & view = OUString() );
114 
115  // XEventListener
116  virtual void SAL_CALL disposing( css::lang::EventObject const & evt ) override;
117 
118  // XTerminateListener
119  virtual void SAL_CALL queryTermination( css::lang::EventObject const & evt ) override;
120  virtual void SAL_CALL notifyTermination( css::lang::EventObject const & evt ) override;
121 
122  // XModifyListener
123  virtual void SAL_CALL modified( css::lang::EventObject const & evt ) override;
124 };
125 
126 } // namespace dp_gui
127 
128 #endif
129 
130 /* 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:2084
virtual ~TheExtensionManager() override
ExtensionCmdQueue * getCmdQueue() const
PackageState
Definition: dp_gui.h:25
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:23
void createDialog(const bool bCreateUpdDlg)
Manages installing of extensions in the GUI mode.