masterfix DEV300: #i10000# build fix
[LibreOffice.git] / forms / source / xforms / submission / submission_put.cxx
blob9ed37470ba93111a889ad0ba81d983d6617ad6e9
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 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_forms.hxx"
31 #include <memory>
33 #include "submission_put.hxx"
34 #include "serialization_app_xml.hxx"
35 #include "serialization_urlencoded.hxx"
37 #include <osl/file.hxx>
38 #include <unotools/processfactory.hxx>
39 #include <ucbhelper/content.hxx>
41 using namespace CSS::uno;
42 using namespace CSS::ucb;
43 using namespace CSS::task;
44 using namespace CSS::io;
45 using namespace rtl;
46 using namespace osl;
47 using namespace ucbhelper;
48 using namespace std;
51 CSubmissionPut::CSubmissionPut(const rtl::OUString& aURL, const CSS::uno::Reference< CSS::xml::dom::XDocumentFragment >& aFragment)
52 : CSubmission(aURL, aFragment)
56 CSubmission::SubmissionResult CSubmissionPut::submit(const CSS::uno::Reference< CSS::task::XInteractionHandler >& aInteractionHandler)
58 CSS::uno::Reference< XCommandEnvironment > aEnvironment;
59 auto_ptr< CSerialization > apSerialization(createSerialization(aInteractionHandler,aEnvironment));
61 try {
62 ucbhelper::Content aContent(m_aURLObj.GetMainURL(INetURLObject::NO_DECODE), aEnvironment);
64 // insert serialized data to content -> PUT
65 CSS::uno::Reference< XInputStream > aInStream = apSerialization->getInputStream();
66 aContent.writeStream(aInStream, sal_True);
67 //aContent.closeStream();
69 // no content as a result of put...
71 } catch (Exception&)
73 // XXX
74 OSL_ENSURE(sal_False, "Exception during UCB operatration.");
75 return UNKNOWN_ERROR;
79 return SUCCESS;