1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 #ifndef __SUBMISSION_HXX
29 #define __SUBMISSION_HXX
31 #include <tools/urlobj.hxx>
32 #include <rtl/ustring.h>
33 #include <osl/conditn.hxx>
34 #include <osl/mutex.hxx>
35 #include <unotools/processfactory.hxx>
36 #include <com/sun/star/uno/Reference.hxx>
37 #include <com/sun/star/uno/Any.hxx>
38 #include <com/sun/star/uno/Exception.hpp>
39 #include <com/sun/star/uno/RuntimeException.hpp>
40 #include <com/sun/star/xml/xpath/XXPathObject.hpp>
41 #include <com/sun/star/xml/dom/XDocumentFragment.hpp>
42 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
44 #include <com/sun/star/ucb/XCommandEnvironment.hpp>
45 #include <com/sun/star/ucb/XProgressHandler.hpp>
47 #include <com/sun/star/task/XInteractionHandler.hpp>
49 #include <com/sun/star/frame/XFrame.hpp>
51 #include <cppuhelper/implbase1.hxx>
52 #include <cppuhelper/implbase2.hxx>
53 #include <cppuhelper/implbase3.hxx>
55 #include "serialization.hxx"
57 namespace CSS
= com::sun::star
;
60 class CSubmissionPost
;
63 class CCommandEnvironmentHelper
: public cppu::WeakImplHelper1
< CSS::ucb::XCommandEnvironment
>
65 friend class CSubmissionPut
;
66 friend class CSubmissionPost
;
67 friend class CSubmissionGet
;
68 friend class CSubmission
;
71 CSS::uno::Reference
< CSS::task::XInteractionHandler
> m_aInteractionHandler
;
72 CSS::uno::Reference
< CSS::ucb::XProgressHandler
> m_aProgressHandler
;
75 virtual CSS::uno::Reference
< CSS::task::XInteractionHandler
> SAL_CALL
getInteractionHandler() throw (CSS::uno::RuntimeException
)
77 return m_aInteractionHandler
;
79 virtual CSS::uno::Reference
< CSS::ucb::XProgressHandler
> SAL_CALL
getProgressHandler() throw (CSS::uno::RuntimeException
)
81 return m_aProgressHandler
;
85 class CProgressHandlerHelper
: public cppu::WeakImplHelper1
< CSS::ucb::XProgressHandler
>
87 friend class CSubmissionPut
;
88 friend class CSubmissionPost
;
89 friend class CSubmissionGet
;
91 osl::Condition m_cFinished
;
95 CProgressHandlerHelper()
98 virtual void SAL_CALL
push( const com::sun::star::uno::Any
& /*aStatus*/) throw(com::sun::star::uno::RuntimeException
)
104 virtual void SAL_CALL
update(const com::sun::star::uno::Any
& /*aStatus*/) throw(com::sun::star::uno::RuntimeException
)
107 virtual void SAL_CALL
pop() throw(com::sun::star::uno::RuntimeException
)
121 INetURLObject m_aURLObj
;
122 CSS::uno::Reference
< CSS::xml::xpath::XXPathObject
> m_aXPathObject
;
123 CSS::uno::Reference
< CSS::xml::dom::XDocumentFragment
> m_aFragment
;
124 CSS::uno::Reference
< CSS::io::XInputStream
> m_aResultStream
;
125 CSS::uno::Reference
< CSS::lang::XMultiServiceFactory
> m_aFactory
;
126 rtl::OUString m_aEncoding
;
128 ::std::auto_ptr
< CSerialization
> createSerialization(const ::com::sun::star::uno::Reference
< ::com::sun::star::task::XInteractionHandler
>& aHandler
129 ,com::sun::star::uno::Reference
<com::sun::star::ucb::XCommandEnvironment
>& _rOutEnv
);
132 enum SubmissionResult
{
141 CSubmission(const rtl::OUString
& aURL
, const CSS::uno::Reference
< CSS::xml::dom::XDocumentFragment
>& aFragment
)
143 , m_aFragment(aFragment
)
144 , m_aFactory(::utl::getProcessServiceFactory())
147 virtual ~CSubmission() {}
149 // virtual CSS::uno::Sequence< rtl::OUString > getSupportedEncodings() = 0;
150 virtual void setEncoding(const rtl::OUString
& aEncoding
)
152 m_aEncoding
= aEncoding
;
154 virtual SubmissionResult
submit(const CSS::uno::Reference
< CSS::task::XInteractionHandler
>& ) = 0;
156 virtual SubmissionResult
replace(const rtl::OUString
&, const CSS::uno::Reference
< CSS::xml::dom::XDocument
>&, const CSS::uno::Reference
< CSS::frame::XFrame
>&);