1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: submission.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef __SUBMISSION_HXX
32 #define __SUBMISSION_HXX
34 #include <tools/urlobj.hxx>
35 #include <rtl/ustring.h>
36 #include <osl/conditn.hxx>
37 #include <osl/mutex.hxx>
38 #include <unotools/processfactory.hxx>
39 #include <com/sun/star/uno/Reference.hxx>
40 #include <com/sun/star/uno/Any.hxx>
41 #include <com/sun/star/uno/Exception.hpp>
42 #include <com/sun/star/uno/RuntimeException.hpp>
43 #include <com/sun/star/xml/xpath/XXPathObject.hpp>
44 #include <com/sun/star/xml/dom/XDocumentFragment.hpp>
45 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
47 #include <com/sun/star/ucb/XCommandEnvironment.hpp>
48 #include <com/sun/star/ucb/XProgressHandler.hpp>
50 #include <com/sun/star/task/XInteractionHandler.hpp>
52 #include <com/sun/star/frame/XFrame.hpp>
54 #include <cppuhelper/implbase1.hxx>
55 #include <cppuhelper/implbase2.hxx>
56 #include <cppuhelper/implbase3.hxx>
58 #include "serialization.hxx"
60 namespace CSS
= com::sun::star
;
63 class CSubmissionPost
;
66 class CCommandEnvironmentHelper
: public cppu::WeakImplHelper1
< CSS::ucb::XCommandEnvironment
>
68 friend class CSubmissionPut
;
69 friend class CSubmissionPost
;
70 friend class CSubmissionGet
;
71 friend class CSubmission
;
74 CSS::uno::Reference
< CSS::task::XInteractionHandler
> m_aInteractionHandler
;
75 CSS::uno::Reference
< CSS::ucb::XProgressHandler
> m_aProgressHandler
;
78 virtual CSS::uno::Reference
< CSS::task::XInteractionHandler
> SAL_CALL
getInteractionHandler() throw (CSS::uno::RuntimeException
)
80 return m_aInteractionHandler
;
82 virtual CSS::uno::Reference
< CSS::ucb::XProgressHandler
> SAL_CALL
getProgressHandler() throw (CSS::uno::RuntimeException
)
84 return m_aProgressHandler
;
88 class CProgressHandlerHelper
: public cppu::WeakImplHelper1
< CSS::ucb::XProgressHandler
>
90 friend class CSubmissionPut
;
91 friend class CSubmissionPost
;
92 friend class CSubmissionGet
;
94 osl::Condition m_cFinished
;
98 CProgressHandlerHelper()
101 virtual void SAL_CALL
push( const com::sun::star::uno::Any
& /*aStatus*/) throw(com::sun::star::uno::RuntimeException
)
107 virtual void SAL_CALL
update(const com::sun::star::uno::Any
& /*aStatus*/) throw(com::sun::star::uno::RuntimeException
)
110 virtual void SAL_CALL
pop() throw(com::sun::star::uno::RuntimeException
)
124 INetURLObject m_aURLObj
;
125 CSS::uno::Reference
< CSS::xml::xpath::XXPathObject
> m_aXPathObject
;
126 CSS::uno::Reference
< CSS::xml::dom::XDocumentFragment
> m_aFragment
;
127 CSS::uno::Reference
< CSS::io::XInputStream
> m_aResultStream
;
128 CSS::uno::Reference
< CSS::lang::XMultiServiceFactory
> m_aFactory
;
129 rtl::OUString m_aEncoding
;
131 ::std::auto_ptr
< CSerialization
> createSerialization(const ::com::sun::star::uno::Reference
< ::com::sun::star::task::XInteractionHandler
>& aHandler
132 ,com::sun::star::uno::Reference
<com::sun::star::ucb::XCommandEnvironment
>& _rOutEnv
);
135 enum SubmissionResult
{
144 CSubmission(const rtl::OUString
& aURL
, const CSS::uno::Reference
< CSS::xml::dom::XDocumentFragment
>& aFragment
)
146 , m_aFragment(aFragment
)
147 , m_aFactory(::utl::getProcessServiceFactory())
150 virtual ~CSubmission() {}
152 // virtual CSS::uno::Sequence< rtl::OUString > getSupportedEncodings() = 0;
153 virtual void setEncoding(const rtl::OUString
& aEncoding
)
155 m_aEncoding
= aEncoding
;
157 virtual SubmissionResult
submit(const CSS::uno::Reference
< CSS::task::XInteractionHandler
>& ) = 0;
159 virtual SubmissionResult
replace(const rtl::OUString
&, const CSS::uno::Reference
< CSS::xml::dom::XDocument
>&, const CSS::uno::Reference
< CSS::frame::XFrame
>&);