1 /**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22
23
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_forms.hxx"
26
27 #include <memory>
28
29 #include "submission_put.hxx"
30 #include "serialization_app_xml.hxx"
31 #include "serialization_urlencoded.hxx"
32
33 #include <osl/file.hxx>
34 #include <tools/diagnose_ex.h>
35 #include <unotools/processfactory.hxx>
36 #include <ucbhelper/content.hxx>
37
38 using namespace CSS::uno;
39 using namespace CSS::ucb;
40 using namespace CSS::task;
41 using namespace CSS::io;
42 using namespace rtl;
43 using namespace osl;
44 using namespace ucbhelper;
45 using namespace std;
46
47
CSubmissionPut(const rtl::OUString & aURL,const CSS::uno::Reference<CSS::xml::dom::XDocumentFragment> & aFragment)48 CSubmissionPut::CSubmissionPut(const rtl::OUString& aURL, const CSS::uno::Reference< CSS::xml::dom::XDocumentFragment >& aFragment)
49 : CSubmission(aURL, aFragment)
50 {
51 }
52
submit(const CSS::uno::Reference<CSS::task::XInteractionHandler> & aInteractionHandler)53 CSubmission::SubmissionResult CSubmissionPut::submit(const CSS::uno::Reference< CSS::task::XInteractionHandler >& aInteractionHandler)
54 {
55 CSS::uno::Reference< XCommandEnvironment > aEnvironment;
56 auto_ptr< CSerialization > apSerialization(createSerialization(aInteractionHandler,aEnvironment));
57
58 try
59 {
60 ucbhelper::Content aContent(m_aURLObj.GetMainURL(INetURLObject::NO_DECODE), aEnvironment);
61
62 // insert serialized data to content -> PUT
63 CSS::uno::Reference< XInputStream > aInStream = apSerialization->getInputStream();
64 aContent.writeStream(aInStream, sal_True);
65 //aContent.closeStream();
66
67 // no content as a result of put...
68
69 }
70 catch ( const Exception& )
71 {
72 DBG_UNHANDLED_EXCEPTION();
73 return UNKNOWN_ERROR;
74 }
75
76
77 return SUCCESS;
78 }
79
80