1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 #ifndef INCLUDED_FORMS_SOURCE_XFORMS_SUBMISSION_SUBMISSION_HXX
21 #define INCLUDED_FORMS_SOURCE_XFORMS_SUBMISSION_SUBMISSION_HXX
23 #include <tools/urlobj.hxx>
24 #include <rtl/ustring.h>
25 #include <osl/conditn.hxx>
26 #include <osl/mutex.hxx>
27 #include <comphelper/processfactory.hxx>
28 #include <com/sun/star/uno/Reference.hxx>
29 #include <com/sun/star/uno/Any.hxx>
30 #include <com/sun/star/uno/Exception.hpp>
31 #include <com/sun/star/uno/RuntimeException.hpp>
32 #include <com/sun/star/xml/xpath/XXPathObject.hpp>
33 #include <com/sun/star/xml/dom/XDocumentFragment.hpp>
34 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
36 #include <com/sun/star/ucb/XCommandEnvironment.hpp>
37 #include <com/sun/star/ucb/XProgressHandler.hpp>
39 #include <com/sun/star/task/XInteractionHandler.hpp>
41 #include <com/sun/star/frame/XFrame.hpp>
43 #include <cppuhelper/implbase1.hxx>
44 #include <cppuhelper/implbase2.hxx>
45 #include <cppuhelper/implbase3.hxx>
47 #include "serialization.hxx"
52 class CSubmissionPost
;
55 class CCommandEnvironmentHelper
: public cppu::WeakImplHelper1
< css::ucb::XCommandEnvironment
>
57 friend class CSubmissionPut
;
58 friend class CSubmissionPost
;
59 friend class CSubmissionGet
;
60 friend class CSubmission
;
63 css::uno::Reference
< css::task::XInteractionHandler
> m_aInteractionHandler
;
64 css::uno::Reference
< css::ucb::XProgressHandler
> m_aProgressHandler
;
67 virtual css::uno::Reference
< css::task::XInteractionHandler
> SAL_CALL
getInteractionHandler() throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
69 return m_aInteractionHandler
;
71 virtual css::uno::Reference
< css::ucb::XProgressHandler
> SAL_CALL
getProgressHandler() throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
73 return m_aProgressHandler
;
77 class CProgressHandlerHelper
: public cppu::WeakImplHelper1
< css::ucb::XProgressHandler
>
79 friend class CSubmissionPut
;
80 friend class CSubmissionPost
;
81 friend class CSubmissionGet
;
83 osl::Condition m_cFinished
;
87 CProgressHandlerHelper()
90 virtual void SAL_CALL
push( const com::sun::star::uno::Any
& /*aStatus*/) throw(com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
96 virtual void SAL_CALL
update(const com::sun::star::uno::Any
& /*aStatus*/) throw(com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
99 virtual void SAL_CALL
pop() throw(com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
113 INetURLObject m_aURLObj
;
114 css::uno::Reference
< css::xml::xpath::XXPathObject
> m_aXPathObject
;
115 css::uno::Reference
< css::xml::dom::XDocumentFragment
> m_aFragment
;
116 css::uno::Reference
< css::io::XInputStream
> m_aResultStream
;
117 css::uno::Reference
< css::uno::XComponentContext
> m_xContext
;
118 OUString m_aEncoding
;
120 ::std::unique_ptr
< CSerialization
> createSerialization(const ::com::sun::star::uno::Reference
< ::com::sun::star::task::XInteractionHandler
>& aHandler
121 ,com::sun::star::uno::Reference
<com::sun::star::ucb::XCommandEnvironment
>& _rOutEnv
);
124 enum SubmissionResult
{
133 CSubmission(const OUString
& aURL
, const css::uno::Reference
< css::xml::dom::XDocumentFragment
>& aFragment
)
135 , m_aFragment(aFragment
)
136 , m_xContext(::comphelper::getProcessComponentContext())
139 virtual ~CSubmission() {}
141 void setEncoding(const OUString
& aEncoding
)
143 m_aEncoding
= aEncoding
;
145 virtual SubmissionResult
submit(const css::uno::Reference
< css::task::XInteractionHandler
>& ) = 0;
147 SubmissionResult
replace(const OUString
&, const css::uno::Reference
< css::xml::dom::XDocument
>&, const css::uno::Reference
< css::frame::XFrame
>&);
153 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */