ofz#50271 Out-of-memory with outsize line thickness
[LibreOffice.git] / uui / source / iahndl.hxx
blob7ca8b843789162039877114de08e165cd5e72323
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #pragma once
22 #include <rtl/ustring.hxx>
24 #include <com/sun/star/uno/Reference.hxx>
25 #include <com/sun/star/uno/Sequence.hxx>
26 #include <com/sun/star/uno/XComponentContext.hpp>
28 #include <com/sun/star/beans/Optional.hpp>
29 #include <com/sun/star/task/InteractionClassification.hpp>
31 #include <vcl/errcode.hxx>
32 #include <unotools/resmgr.hxx>
34 #include <unordered_map>
35 #include <vector>
37 namespace com::sun::star {
38 namespace awt {
39 class XWindow;
41 namespace embed {
42 class XStorage;
44 namespace lang {
45 class XMultiServiceFactory;
47 namespace security {
48 struct DocumentSignatureInformation;
50 namespace task {
51 class XInteractionContinuation;
52 class XInteractionHandler2;
53 class XInteractionRequest;
55 namespace ucb {
56 class NameClashResolveRequest;
60 struct InteractionHandlerData
62 /** The UNO service name to use to instantiate the content provider.
64 OUString ServiceName;
67 typedef std::vector< InteractionHandlerData > InteractionHandlerDataList;
69 typedef std::unordered_map< OUString, OUString > StringHashMap;
71 class UUIInteractionHelper
73 private:
74 css::uno::Reference< css::uno::XComponentContext > m_xContext;
75 css::uno::Reference< css::awt::XWindow > m_xWindowParam;
76 OUString m_aContextParam;
77 StringHashMap m_aTypedCustomHandlers;
78 UUIInteractionHelper(UUIInteractionHelper const &) = delete;
79 UUIInteractionHelper& operator =(UUIInteractionHelper const &) = delete;
81 public:
82 explicit UUIInteractionHelper(
83 css::uno::Reference< css::uno::XComponentContext > xContext);
85 const css::uno::Reference<css::awt::XWindow> & GetParentWindow() const { return m_xWindowParam; }
86 void SetParentWindow(const css::uno::Reference<css::awt::XWindow>& rWindow) { m_xWindowParam = rWindow; }
88 void setContext(OUString const & context) { m_aContextParam = context; }
90 ~UUIInteractionHelper();
92 bool handleRequest( css::uno::Reference< css::task::XInteractionRequest > const & rRequest);
94 css::beans::Optional< OUString >
95 getStringFromRequest(
96 css::uno::Reference< css::task::XInteractionRequest > const & rRequest);
98 // Helper.
99 static OUString
100 replaceMessageWithArguments(
101 const OUString& aMessage,
102 std::vector< OUString > const & rArguments );
104 private:
105 bool
106 handleRequest_impl(
107 css::uno::Reference< css::task::XInteractionRequest > const & rRequest,
108 bool bObtainErrorStringOnly,
109 bool & bHasErrorString,
110 OUString & rErrorString);
112 static void handlerequest(void* pHandleData, void* pInteractionHandler);
114 css::beans::Optional< OUString >
115 getStringFromRequest_impl(
116 css::uno::Reference< css::task::XInteractionRequest > const & rRequest);
118 static void getstringfromrequest(void* pHandleData, void* pInteractionHandler);
120 const css::uno::Reference< css::awt::XWindow>&
121 getParentXWindow() const;
123 css::uno::Reference< css::task::XInteractionHandler2 >
124 getInteractionHandler() const;
126 bool handleTypedHandlerImplementations(
127 css::uno::Reference< css::task::XInteractionRequest > const & rRequest
130 bool
131 tryOtherInteractionHandler(
132 css::uno::Reference< css::task::XInteractionRequest > const & rRequest);
134 void
135 getInteractionHandlerList(InteractionHandlerDataList &rdataList);
137 static bool
138 isInformationalErrorMessageRequest(
139 css::uno::Sequence<
140 css::uno::Reference< css::task::XInteractionContinuation > > const & rContinuations);
142 bool
143 handleInteractiveIOException(
144 css::uno::Reference< css::task::XInteractionRequest > const & rRequest,
145 bool bObtainErrorStringOnly,
146 bool & bHasErrorString,
147 OUString & rErrorString);
149 bool
150 handleAuthenticationRequest(
151 css::uno::Reference< css::task::XInteractionRequest > const & rRequest);
153 bool
154 handleCertificateValidationRequest(
155 css::uno::Reference< css::task::XInteractionRequest > const & rRequest);
157 void
158 handleNameClashResolveRequest(
159 css::ucb::NameClashResolveRequest const & rRequest,
160 css::uno::Sequence<
161 css::uno::Reference< css::task::XInteractionContinuation > > const & rContinuations);
163 bool
164 handleMasterPasswordRequest(
165 css::uno::Reference< css::task::XInteractionRequest > const & rRequest);
167 bool
168 handlePasswordRequest(
169 css::uno::Reference< css::task::XInteractionRequest > const & rRequest);
171 bool
172 handleNoSuchFilterRequest(
173 css::uno::Reference< css::task::XInteractionRequest > const & rRequest);
175 bool
176 handleFilterOptionsRequest(
177 css::uno::Reference<
178 css::task::XInteractionRequest > const & rRequest);
180 void
181 handleErrorHandlerRequest(
182 css::task::InteractionClassification eClassification,
183 ErrCode nErrorCode,
184 std::vector< OUString > const & rArguments,
185 css::uno::Sequence<
186 css::uno::Reference< css::task::XInteractionContinuation > > const & rContinuations,
187 bool bObtainErrorStringOnly,
188 bool & bHasErrorString,
189 OUString & rErrorString);
191 void
192 handleGenericErrorRequest(
193 ErrCode nErrorCode,
194 css::uno::Sequence<
195 css::uno::Reference< css::task::XInteractionContinuation > > const & rContinuations,
196 bool bObtainErrorStringOnly,
197 bool & bHasErrorString,
198 OUString & rErrorString);
200 void
201 handleMacroConfirmRequest(
202 const OUString& aDocumentURL,
203 const css::uno::Reference< css::embed::XStorage >& xZipStorage,
204 const OUString& aDocumentVersion,
205 const css::uno::Sequence< css::security::DocumentSignatureInformation >& aSignInfo,
206 css::uno::Sequence<
207 css::uno::Reference< css::task::XInteractionContinuation > > const & rContinuations);
209 void
210 handleBrokenPackageRequest(
211 std::vector< OUString > const & rArguments,
212 css::uno::Sequence<
213 css::uno::Reference< css::task::XInteractionContinuation > > const & rContinuations,
214 bool bObtainErrorStringOnly,
215 bool & bHasErrorString,
216 OUString & rErrorString);
218 bool handleLockedDocumentRequest(
219 css::uno::Reference< css::task::XInteractionRequest > const & rRequest);
221 bool handleChangedByOthersRequest(
222 css::uno::Reference<
223 css::task::XInteractionRequest > const & rRequest);
225 bool handleLockFileProblemRequest(
226 css::uno::Reference< css::task::XInteractionRequest > const & rRequest);
228 bool handleReloadEditableRequest(
229 css::uno::Reference<css::task::XInteractionRequest> const& rRequest);
231 bool handleCustomRequest(
232 const css::uno::Reference< css::task::XInteractionRequest >& i_rRequest,
233 const OUString& i_rServiceName
234 ) const;
236 void
237 handleAuthFallbackRequest(
238 const OUString & instructions,
239 const OUString & url,
240 css::uno::Sequence< css::uno::Reference< css::task::XInteractionContinuation > > const & rContinuations );
243 class ErrorResource
245 const std::pair<TranslateId, ErrCode>* m_pStringArray;
246 const std::locale& m_rResLocale;
247 public:
248 explicit ErrorResource(const std::pair<TranslateId, ErrCode>* pStringArray, const std::locale& rResLocale)
249 : m_pStringArray(pStringArray)
250 , m_rResLocale(rResLocale)
253 bool getString(ErrCode nErrorCode, OUString &rString) const;
256 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */