1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
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.
14  *
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).
20  *
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.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_forms.hxx"
30 
31 #include <memory>
32 
33 #include "submission_put.hxx"
34 #include "serialization_app_xml.hxx"
35 #include "serialization_urlencoded.hxx"
36 
37 #include <osl/file.hxx>
38 #include <tools/diagnose_ex.h>
39 #include <unotools/processfactory.hxx>
40 #include <ucbhelper/content.hxx>
41 
42 using namespace CSS::uno;
43 using namespace CSS::ucb;
44 using namespace CSS::task;
45 using namespace CSS::io;
46 using namespace rtl;
47 using namespace osl;
48 using namespace ucbhelper;
49 using namespace std;
50 
51 
52 CSubmissionPut::CSubmissionPut(const rtl::OUString& aURL, const CSS::uno::Reference< CSS::xml::dom::XDocumentFragment >& aFragment)
53     : CSubmission(aURL, aFragment)
54 {
55 }
56 
57 CSubmission::SubmissionResult CSubmissionPut::submit(const CSS::uno::Reference< CSS::task::XInteractionHandler >& aInteractionHandler)
58 {
59     CSS::uno::Reference< XCommandEnvironment > aEnvironment;
60     auto_ptr< CSerialization > apSerialization(createSerialization(aInteractionHandler,aEnvironment));
61 
62     try
63     {
64         ucbhelper::Content aContent(m_aURLObj.GetMainURL(INetURLObject::NO_DECODE), aEnvironment);
65 
66         // insert serialized data to content -> PUT
67         CSS::uno::Reference< XInputStream > aInStream = apSerialization->getInputStream();
68         aContent.writeStream(aInStream, sal_True);
69         //aContent.closeStream();
70 
71         // no content as a result of put...
72 
73     }
74     catch ( const Exception& )
75     {
76         DBG_UNHANDLED_EXCEPTION();
77         return UNKNOWN_ERROR;
78     }
79 
80 
81     return SUCCESS;
82 }
83 
84