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;
56  std::unique_ptr<ExtensionCmdQueue> m_pExecuteCmdQueue;
57 
60 
61 public:
62  static ::rtl::Reference<TheExtensionManager> s_ExtMgr;
63 
64  TheExtensionManager( const css::uno::Reference< css::awt::XWindow > &xParent,
65  const css::uno::Reference< css::uno::XComponentContext > &xContext );
66  virtual ~TheExtensionManager() override;
67 
68  void createDialog( const bool bCreateUpdDlg );
69  sal_Int16 execute();
70 
71  bool isModified() const { return m_bModified; }
72  void clearModified() { m_bModified = false; }
73 
75  {
76  if (m_pExtMgrDialog)
77  return m_pExtMgrDialog.get();
78  return m_pUpdReqDialog.get();
79  }
81  {
82  if (m_pExtMgrDialog)
83  return m_pExtMgrDialog.get();
84  return m_pUpdReqDialog.get();
85  }
86  ExtensionCmdQueue* getCmdQueue() const { return m_pExecuteCmdQueue.get(); }
87 
88  void SetText( const OUString &rTitle );
89  void Show();
90  void ToTop( ToTopFlags nFlags );
91  bool Close();
92  bool isVisible();
93 
94 
95  void checkUpdates();
96  bool installPackage( const OUString &rPackageURL, bool bWarnUser = false );
97  void createPackageList();
98 
99  void terminateDialog();
100 
101  // Tools
102  bool supportsOptions( const css::uno::Reference< css::deployment::XPackage > &xPackage ) const;
103  static PackageState getPackageState( const css::uno::Reference< css::deployment::XPackage > &xPackage );
104  const css::uno::Reference< css::uno::XComponentContext >& getContext() const { return m_xContext; }
105  const css::uno::Reference< css::deployment::XExtensionManager >& getExtensionManager() const { return m_xExtensionManager; }
106  bool isReadOnly( const css::uno::Reference< css::deployment::XPackage > &xPackage ) const;
107 
108 
109  static ::rtl::Reference<TheExtensionManager> get(
110  css::uno::Reference< css::uno::XComponentContext> const & xContext,
111  css::uno::Reference< css::awt::XWindow> const & xParent = nullptr,
112  OUString const & view = OUString() );
113 
114  // XEventListener
115  virtual void SAL_CALL disposing( css::lang::EventObject const & evt ) override;
116 
117  // XTerminateListener
118  virtual void SAL_CALL queryTermination( css::lang::EventObject const & evt ) override;
119  virtual void SAL_CALL notifyTermination( css::lang::EventObject const & evt ) override;
120 
121  // XModifyListener
122  virtual void SAL_CALL modified( css::lang::EventObject const & evt ) override;
123 };
124 
125 } // namespace dp_gui
126 
127 #endif
128 
129 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
VclPtr< ExtMgrDialog > m_pExtMgrDialog
css::uno::Reference< css::awt::XWindow > m_xParent
void SetText(const OUString &rTitle)
VclPtr< UpdateRequiredDialog > m_pUpdReqDialog
const css::uno::Reference< css::deployment::XExtensionManager > & getExtensionManager() const
virtual void SAL_CALL disposing(css::lang::EventObject const &evt) override
std::unique_ptr< ExtensionCmdQueue > m_pExecuteCmdQueue
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
static::rtl::Reference< TheExtensionManager > s_ExtMgr
bool isReadOnly(const css::uno::Reference< css::deployment::XPackage > &xPackage) const
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)
css::uno::Reference< css::deployment::XExtensionManager > m_xExtensionManager
static uno::Reference< css::uno::XComponentContext > xContext
Definition: init.cxx:1546
virtual ~TheExtensionManager() override
ExtensionCmdQueue * getCmdQueue() const
PackageState
Definition: dp_gui.h:62
static PackageState getPackageState(const css::uno::Reference< css::deployment::XPackage > &xPackage)
void ToTop(ToTopFlags nFlags)
reference_type * get() const
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
ToTopFlags
Definition: dp_gui.h:60
void createDialog(const bool bCreateUpdDlg)
Manages installing of extensions in the GUI mode.