LibreOffice Module desktop (master)  1
lokinteractionhandler.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_LIB_LOKINTERACTIONHANDLER_HXX
21 #define INCLUDED_DESKTOP_SOURCE_LIB_LOKINTERACTIONHANDLER_HXX
22 
23 #include <osl/conditn.hxx>
24 #include <cppuhelper/implbase.hxx>
25 #include <vcl/errcode.hxx>
26 
27 #include <com/sun/star/lang/XInitialization.hpp>
28 #include <com/sun/star/lang/XServiceInfo.hpp>
29 #include <com/sun/star/task/InteractionClassification.hpp>
30 #include <com/sun/star/task/XInteractionHandler2.hpp>
31 
32 namespace desktop {
33  struct LibLibreOffice_Impl;
34  struct LibLODocument_Impl;
35 }
36 
45 class LOKInteractionHandler: public cppu::WeakImplHelper<com::sun::star::lang::XServiceInfo,
46  com::sun::star::lang::XInitialization,
47  com::sun::star::task::XInteractionHandler2>
48 {
49 private:
52 
54  OString m_command;
55 
56  OUString m_Password;
58  osl::Condition m_havePassword;
59 
62 
73  void postError(css::task::InteractionClassification classif, const char* kind, ErrCode code, const OUString &message);
74 
75  bool handleIOException(const css::uno::Sequence<css::uno::Reference<css::task::XInteractionContinuation>> &rContinuations, const css::uno::Any& rRequest);
76  bool handleNetworkException(const css::uno::Sequence<css::uno::Reference<css::task::XInteractionContinuation>> &rContinuations, const css::uno::Any& rRequest);
77  bool handlePasswordRequest(const css::uno::Sequence<css::uno::Reference<css::task::XInteractionContinuation>> &rContinuations, const css::uno::Any& rRequest);
78 
79 public:
80  void SetPassword(char const* pPassword);
81 
82  explicit LOKInteractionHandler(
83  const OString& rCommand,
85  desktop::LibLODocument_Impl *pLOKDocumt = nullptr);
86 
87  virtual ~LOKInteractionHandler() override;
88 
89  virtual OUString SAL_CALL getImplementationName() override;
90 
91  virtual sal_Bool SAL_CALL supportsService(OUString const & rServiceName) override;
92 
94 
95  virtual void SAL_CALL initialize(com::sun::star::uno::Sequence<com::sun::star::uno::Any > const & rArguments) override;
96 
97  virtual void SAL_CALL handle(com::sun::star::uno::Reference<com::sun::star::task::XInteractionRequest> const & rRequest) override;
98 
99  virtual sal_Bool SAL_CALL handleInteractionRequest(const ::com::sun::star::uno::Reference<::com::sun::star::task::XInteractionRequest>& Request) override;
100 };
101 
102 #endif
103 
104 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual sal_Bool SAL_CALL handleInteractionRequest(const ::com::sun::star::uno::Reference<::com::sun::star::task::XInteractionRequest > &Request) override
InteractionHandler is an interface that provides the user with various dialogs / error messages...
virtual void SAL_CALL handle(com::sun::star::uno::Reference< com::sun::star::task::XInteractionRequest > const &rRequest) override
Definition: app.cxx:161
bool handlePasswordRequest(const css::uno::Sequence< css::uno::Reference< css::task::XInteractionContinuation >> &rContinuations, const css::uno::Any &rRequest)
desktop::LibLODocument_Impl * m_pLOKDocument
LOKInteractionHandler & operator=(const LOKInteractionHandler &)=delete
bool handleNetworkException(const css::uno::Sequence< css::uno::Reference< css::task::XInteractionContinuation >> &rContinuations, const css::uno::Any &rRequest)
unsigned char sal_Bool
virtual OUString SAL_CALL getImplementationName() override
virtual ~LOKInteractionHandler() override
OString m_command
Command for which we use this interaction handler (like "load", "save", "saveas", ...
desktop::LibLibreOffice_Impl * m_pLOKit
void SetPassword(char const *pPassword)
virtual void SAL_CALL initialize(com::sun::star::uno::Sequence< com::sun::star::uno::Any > const &rArguments) override
bool handleIOException(const css::uno::Sequence< css::uno::Reference< css::task::XInteractionContinuation >> &rContinuations, const css::uno::Any &rRequest)
LOKInteractionHandler(const LOKInteractionHandler &)=delete
void postError(css::task::InteractionClassification classif, const char *kind, ErrCode code, const OUString &message)
Call the LOK_CALLBACK_ERROR on the LOK document (if available) or LOK lib.
virtual sal_Bool SAL_CALL supportsService(OUString const &rServiceName) override
virtual com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override