diff options
Diffstat (limited to 'forms/source/xforms/submission')
-rw-r--r-- | forms/source/xforms/submission/replace.cxx | 145 | ||||
-rw-r--r-- | forms/source/xforms/submission/serialization.hxx | 101 | ||||
-rw-r--r-- | forms/source/xforms/submission/serialization_app_xml.cxx | 113 | ||||
-rw-r--r-- | forms/source/xforms/submission/serialization_app_xml.hxx | 58 | ||||
-rw-r--r-- | forms/source/xforms/submission/serialization_urlencoded.cxx | 196 | ||||
-rw-r--r-- | forms/source/xforms/submission/serialization_urlencoded.hxx | 59 | ||||
-rw-r--r-- | forms/source/xforms/submission/submission.hxx | 163 | ||||
-rw-r--r-- | forms/source/xforms/submission/submission_get.cxx | 122 | ||||
-rw-r--r-- | forms/source/xforms/submission/submission_get.hxx | 47 | ||||
-rw-r--r-- | forms/source/xforms/submission/submission_post.cxx | 95 | ||||
-rw-r--r-- | forms/source/xforms/submission/submission_post.hxx | 43 | ||||
-rw-r--r-- | forms/source/xforms/submission/submission_put.cxx | 83 | ||||
-rw-r--r-- | forms/source/xforms/submission/submission_put.hxx | 46 |
13 files changed, 0 insertions, 1271 deletions
diff --git a/forms/source/xforms/submission/replace.cxx b/forms/source/xforms/submission/replace.cxx deleted file mode 100644 index 07794a412..000000000 --- a/forms/source/xforms/submission/replace.cxx +++ /dev/null @@ -1,145 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_forms.hxx" -#include <memory> -#include "submission.hxx" -#include "serialization_app_xml.hxx" - -#include <rtl/ustring.hxx> -#include <rtl/string.hxx> - -#include <unotools/processfactory.hxx> -#include <com/sun/star/uno/Reference.hxx> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/xml/dom/XDocument.hpp> -#include <com/sun/star/xml/dom/XDocumentBuilder.hpp> -#include <com/sun/star/frame/XComponentLoader.hpp> -#include <com/sun/star/frame/FrameSearchFlag.hpp> -#include <com/sun/star/beans/PropertyValue.hpp> -#include <ucbhelper/content.hxx> - -using namespace com::sun::star::uno; -using namespace com::sun::star::ucb; -using namespace com::sun::star::frame; -using namespace com::sun::star::lang; -using namespace com::sun::star::beans; -using namespace com::sun::star::task; -using namespace com::sun::star::xml::dom; - -CSubmission::SubmissionResult CSubmission::replace(const ::rtl::OUString& aReplace, const Reference<XDocument>& aDocument, const Reference<XFrame>& aFrame) -{ - if (!m_aResultStream.is()) - return CSubmission::UNKNOWN_ERROR; - - try { - Reference< XMultiServiceFactory > xFactory = utl::getProcessServiceFactory(); - if (aReplace.equalsIgnoreAsciiCaseAscii("all") || aReplace.equalsIgnoreAsciiCaseAscii("document")) { - Reference< XComponentLoader > xLoader; - if (aFrame.is()) - xLoader = Reference< XComponentLoader >(aFrame, UNO_QUERY); - - if (!xLoader.is()) - xLoader = Reference< XComponentLoader >(xFactory->createInstance( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop") ) ), UNO_QUERY_THROW); - - // open the stream from the result... - // build media descriptor - Sequence< PropertyValue > descriptor(2); - descriptor[0] = PropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("InputStream") ), - -1, makeAny(m_aResultStream), PropertyState_DIRECT_VALUE); - descriptor[1] = PropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ), - -1, makeAny(sal_True), PropertyState_DIRECT_VALUE); - - ::rtl::OUString aURL = m_aURLObj.GetMainURL(INetURLObject::NO_DECODE); - ::rtl::OUString aTarget = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_default") ); - xLoader->loadComponentFromURL(aURL, aTarget, FrameSearchFlag::ALL, descriptor); - - return CSubmission::SUCCESS; - - } else if (aReplace.equalsIgnoreAsciiCaseAscii("instance")) { - if (aDocument.is()) { - // parse the result stream into a new document - Reference< XDocumentBuilder > xBuilder(xFactory->createInstance( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.dom.DocumentBuilder") ) ), UNO_QUERY_THROW); - Reference< XDocument > aNewDocument = xBuilder->parse(m_aResultStream); - - if (aNewDocument.is()) { - // and replace the content of the current instance - Reference< XElement > oldRoot = aDocument->getDocumentElement(); - Reference< XElement > newRoot = aNewDocument->getDocumentElement(); - - Reference< XNode > aImportedNode = aDocument->importNode(Reference< XNode >(newRoot, UNO_QUERY_THROW), sal_True); - Reference< XNode >(aDocument, UNO_QUERY_THROW)->replaceChild(aImportedNode, Reference< XNode >(oldRoot, UNO_QUERY_THROW)); - return CSubmission::SUCCESS; - } else { - return CSubmission::UNKNOWN_ERROR; - } - } else { - // nothing to replace - return CSubmission::UNKNOWN_ERROR; - } - } else if (aReplace.equalsIgnoreAsciiCaseAscii("none")) { - // do nothing \o/ - return CSubmission::SUCCESS; - } - } catch (Exception& e) { - ::rtl::OString aMsg("Exception during replace:\n"); - aMsg += OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8); - OSL_FAIL(aMsg.getStr()); - } - return CSubmission::UNKNOWN_ERROR; -} -::std::auto_ptr< CSerialization > CSubmission::createSerialization(const Reference< XInteractionHandler >& _xHandler,Reference<XCommandEnvironment>& _rOutEnv) -{ - // PUT always uses application/xml - ::std::auto_ptr< CSerialization > apSerialization(new CSerializationAppXML()); - apSerialization->setSource(m_aFragment); - apSerialization->serialize(); - - // create a commandEnvironment and use the default interaction handler - CCommandEnvironmentHelper *pHelper = new CCommandEnvironmentHelper; - if( _xHandler.is() ) - pHelper->m_aInteractionHandler = _xHandler; - else - pHelper->m_aInteractionHandler = CSS::uno::Reference< XInteractionHandler >(m_aFactory->createInstance( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.task.InteractionHandler") ) ), UNO_QUERY); - OSL_ENSURE(pHelper->m_aInteractionHandler.is(), "failed to create IntreractionHandler"); - - CProgressHandlerHelper *pProgressHelper = new CProgressHandlerHelper; - pHelper->m_aProgressHandler = Reference< XProgressHandler >(pProgressHelper); - - // UCB has ownership of environment... - _rOutEnv = pHelper; - return apSerialization; -} - - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/forms/source/xforms/submission/serialization.hxx b/forms/source/xforms/submission/serialization.hxx deleted file mode 100644 index c1daa6eda..000000000 --- a/forms/source/xforms/submission/serialization.hxx +++ /dev/null @@ -1,101 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef __SERIALIZATION_HXX -#define __SERIALIZATION_HXX - -#include <map> - -#include <sal/types.h> -#include <rtl/ustring.hxx> -#include <com/sun/star/uno/Reference.hxx> -#include <com/sun/star/uno/Sequence.hxx> -#include <com/sun/star/beans/NamedValue.hpp> -#include <com/sun/star/io/XInputStream.hpp> -#include <com/sun/star/xml/xpath/XXPathObject.hpp> -#include <com/sun/star/xml/dom/XDocumentFragment.hpp> - -namespace CSS = com::sun::star; - -/** -Serialize an XObject -*/ - -typedef std::map<rtl::OUString, rtl::OUString> PropMap; - -class CSerialization -{ -protected: - CSS::uno::Reference< CSS::xml::dom::XDocumentFragment > m_aFragment; - PropMap m_properties; - -public: - virtual ~CSerialization() {} - - /** - sets the XObject that is to serialized - */ - virtual void setSource(const CSS::uno::Reference< CSS::xml::dom::XDocumentFragment >& aFragment) - { - m_aFragment = aFragment; - } - - /** - set the properties from the submission element - that control aspects of the serialization - eachs serialization may support individual properties - */ - void setProperties(const CSS::uno::Sequence< CSS::beans::NamedValue >& props) - { - m_properties.clear(); - rtl::OUString aValue; - for (sal_Int32 i=0; i<props.getLength(); i++) - { - if (props[i].Value >>= aValue) - m_properties.insert(PropMap::value_type(props[i].Name, aValue)); - } - } - - /** - start the serialization process - */ - virtual void serialize()=0; - - /** - get the serialized bytes. - reads up to buffer->getLength() bytes and returns the number of - bytes read. - returns -1 on error - */ - virtual CSS::uno::Reference< CSS::io::XInputStream > getInputStream() = 0; - -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/forms/source/xforms/submission/serialization_app_xml.cxx b/forms/source/xforms/submission/serialization_app_xml.cxx deleted file mode 100644 index 586a763ee..000000000 --- a/forms/source/xforms/submission/serialization_app_xml.cxx +++ /dev/null @@ -1,113 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_forms.hxx" - -#include "serialization.hxx" -#include "serialization_app_xml.hxx" - -#include <unotools/processfactory.hxx> -#include <com/sun/star/xml/dom/XNode.hpp> -#include <com/sun/star/xml/dom/XDocument.hpp> -#include <com/sun/star/xml/dom/XNodeList.hpp> -#include <com/sun/star/xml/dom/NodeType.hpp> -#include <com/sun/star/lang/XUnoTunnel.hpp> -#include <com/sun/star/xml/xpath/XPathObjectType.hpp> - -#include <libxml/tree.h> - -CSerializationAppXML::CSerializationAppXML() - : m_aFactory(utl::getProcessServiceFactory()) - , m_aPipe(CSS::uno::Reference< CSS::io::XOutputStream > (m_aFactory->createInstance( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.io.Pipe") ) ), CSS::uno::UNO_QUERY)) -{ - OSL_ENSURE(m_aPipe.is(), "cannot create Pipe"); -} - -CSS::uno::Reference< CSS::io::XInputStream > -CSerializationAppXML::getInputStream() -{ - // The pipes output is provided through it's - // XOutputStream interface aspect - return CSS::uno::Reference< CSS::io::XInputStream >(m_aPipe, CSS::uno::UNO_QUERY); -} - -void -CSerializationAppXML::serialize_node(const CSS::uno::Reference< CSS::xml::dom::XNode >& rNode) -{ - CSS::uno::Reference< CSS::xml::dom::XNode > aNode = rNode; - if (aNode->getNodeType() == CSS::xml::dom::NodeType_DOCUMENT_NODE) - { - CSS::uno::Reference< CSS::xml::dom::XDocument > aDoc(rNode, CSS::uno::UNO_QUERY_THROW); - aNode = CSS::uno::Reference< CSS::xml::dom::XNode >(aDoc->getDocumentElement(), CSS::uno::UNO_QUERY_THROW); - } - if (aNode->getNodeType() != CSS::xml::dom::NodeType_ELEMENT_NODE) - return; - - // clone the node to a new document and serialize that document - CSS::uno::Reference< CSS::lang::XUnoTunnel > aTunnel(aNode, CSS::uno::UNO_QUERY); - if (aTunnel.is()) - { - xmlNodePtr aNodePtr = reinterpret_cast< xmlNodePtr >( aTunnel->getSomething(CSS::uno::Sequence< sal_Int8 >()) ); - xmlDocPtr aDocPtr = xmlNewDoc((xmlChar*)"1.0"); - xmlNodePtr aDocNodePtr = xmlDocCopyNode(aNodePtr, aDocPtr, 1); - if (aDocNodePtr != NULL) { - xmlAddChild((xmlNodePtr)aDocPtr, aDocNodePtr); - xmlChar *buffer = NULL; - sal_Int32 size = 0; - xmlDocDumpMemory(aDocPtr, &buffer, (int*)&size); - - // write the xml into the pipe through it's XOutputStream interface - m_aPipe->writeBytes(CSS::uno::Sequence< sal_Int8 >((sal_Int8*)buffer, size)); - xmlFree(buffer); - } - - } else { - // can't get tunnel to native backend - // logic for generic implementation could be implemented here... - OSL_FAIL("unkown dom implementation, cannot serialize"); - return; - } -} - -void -CSerializationAppXML::serialize() -{ - if (!m_aFragment.is()) return; - - CSS::uno::Reference< CSS::xml::dom::XNode > cur = m_aFragment->getFirstChild(); - while (cur.is()) - { - serialize_node(cur); - cur = cur->getNextSibling(); - } - m_aPipe->closeOutput(); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/forms/source/xforms/submission/serialization_app_xml.hxx b/forms/source/xforms/submission/serialization_app_xml.hxx deleted file mode 100644 index 406d5aa59..000000000 --- a/forms/source/xforms/submission/serialization_app_xml.hxx +++ /dev/null @@ -1,58 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef __SERIALIZATION_APP_XML_HXX -#define __SERIALIZATION_APP_XML_HXX - -#include <com/sun/star/io/XOutputStream.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> - -#include "serialization.hxx" - - -class CSerializationAppXML : public CSerialization -{ -private: - CSS::uno::Reference< CSS::lang::XMultiServiceFactory > m_aFactory; - CSS::uno::Reference< CSS::io::XOutputStream > m_aPipe; - - void serialize_node(const CSS::uno::Reference< CSS::xml::dom::XNode >& aNode); - void serialize_nodeset(); - -public: - CSerializationAppXML(); - - virtual void serialize(); - // virtual void setSource(const CSS::uno::Reference< CSS::xml::xpath::XXPathObject >& object); - // virtual void setProperties(const CSS::uno::Sequence< CSS::beans::NamedValue >& props); - virtual CSS::uno::Reference< CSS::io::XInputStream > getInputStream(); -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/forms/source/xforms/submission/serialization_urlencoded.cxx b/forms/source/xforms/submission/serialization_urlencoded.cxx deleted file mode 100644 index 424ca6eab..000000000 --- a/forms/source/xforms/submission/serialization_urlencoded.cxx +++ /dev/null @@ -1,196 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_forms.hxx" - -#include <com/sun/star/xml/xpath/XPathObjectType.hpp> -#include <com/sun/star/xml/dom/XNode.hpp> -#include <com/sun/star/xml/dom/XText.hpp> -#include <com/sun/star/xml/dom/XNodeList.hpp> -#include <com/sun/star/xml/dom/NodeType.hpp> - -#include <rtl/ustrbuf.hxx> -#include <rtl/strbuf.hxx> -#include <unotools/processfactory.hxx> - -#include <stdio.h> - -#include "serialization_urlencoded.hxx" - -using namespace utl; -using namespace CSS::uno; -using namespace CSS::io; -using namespace CSS::xml::xpath; -using namespace CSS::xml::dom; - -CSerializationURLEncoded::CSerializationURLEncoded() - : m_aFactory(getProcessServiceFactory()) - , m_aPipe(Reference< XOutputStream > (m_aFactory->createInstance( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.io.Pipe") ) ), UNO_QUERY)) -{ -} - - -/* - rfc2396 - reserved = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" | - "$" | "," - mark = "-" | "_" | "." | "!" | "~" | "*" | "'" | "(" | ")" - unreserved = alphanum | mark -*/ -sal_Bool CSerializationURLEncoded::is_unreserved(sal_Char c) -{ - //digit? - if (c >= '0' && c <= '9') return sal_True; - if (c >= 'A' && c <= 'Z') return sal_True; - if (c >= 'a' && c <= 'z') return sal_True; - switch (c) { - case '-': - case '_': - case '.': - case '!': - case '~': - case '*': - case '\'': - case '(': - case ')': - return sal_True; - } - return sal_False; -} -void CSerializationURLEncoded::encode_and_append(const ::rtl::OUString& aString, ::rtl::OStringBuffer& aBuffer) -{ - ::rtl::OString utf8String = OUStringToOString(aString, RTL_TEXTENCODING_UTF8); - const sal_uInt8 *pString = reinterpret_cast< const sal_uInt8 * >( utf8String.getStr() ); - sal_Char tmpChar[4]; tmpChar[3] = 0; - - while( *pString != 0) - { - if( *pString < 0x80 ) - { - if ( is_unreserved(*pString) ) { - aBuffer.append(*pString); - } else if (*pString == 0x20) { - aBuffer.append('+'); - } else if (*pString == 0x0d && *(pString+1) == 0x0a) { - aBuffer.append("%0D%0A"); - pString++; - } else if (*pString == 0x0a) { - aBuffer.append("%0D%0A"); - } else { - snprintf(tmpChar, 3, "%%%X", *pString % 0x100); - aBuffer.append(tmpChar); - } - } else { - snprintf(tmpChar, 3, "%%%X", *pString % 0x100); - aBuffer.append(tmpChar); - while (*pString >= 0x80) { - // continuation... - pString++; - snprintf(tmpChar, 3, "%%%X", *pString % 0x100); - aBuffer.append(tmpChar); - } - } - pString++; - } -} - -void CSerializationURLEncoded::serialize_node(const Reference< XNode >& aNode) -{ - // serialize recursive - // every element node E that has a text child T will be serialized in document order - // <E1>T1<E2>T2</E2></E1><E3>T3</E3> -> E1=T2&E2=T2&E3=T3 (En := local name) - - // this node - Reference< XNodeList > aChildList = aNode->getChildNodes(); - Reference< XNode > aChild; - // is this an element node? - if (aNode->getNodeType() == NodeType_ELEMENT_NODE) - { - ::rtl::OUString aName = aNode->getNodeName(); - // find any text children - ::rtl::OUStringBuffer aValue; - Reference< XText > aText; - for(sal_Int32 i=0; i < aChildList->getLength(); i++) - { - aChild = aChildList->item(i); - if (aChild->getNodeType() == NodeType_TEXT_NODE) - { - aText = Reference< XText >(aChild, UNO_QUERY); - aValue.append(aText->getData()); - } - } - - // found anything? - if (aValue.getLength() > 0) - { - ::rtl::OUString aUnencValue = aValue.makeStringAndClear(); - ::rtl::OStringBuffer aEncodedBuffer; - encode_and_append(aName, aEncodedBuffer); - aEncodedBuffer.append("="); - encode_and_append(aUnencValue, aEncodedBuffer); - aEncodedBuffer.append("&"); - sal_Int8 *pData = (sal_Int8*)aEncodedBuffer.getStr(); - Sequence< sal_Int8 > sData(pData, aEncodedBuffer.getLength()); - m_aPipe->writeBytes(sData); - } - } - - // element children... - for(sal_Int32 i=0; i < aChildList->getLength(); i++) - { - aChild = aChildList->item(i); - // if this is an element node, it might be a candidate for serialization - if (aChild.is() && aChild->getNodeType() == NodeType_ELEMENT_NODE) - serialize_node(aChild); - } -} - -void CSerializationURLEncoded::serialize() -{ - - // output stream to the pipe buffer - Reference< XOutputStream > out(m_aPipe, UNO_QUERY); - - CSS::uno::Reference< CSS::xml::dom::XNode > cur = m_aFragment->getFirstChild(); - while (cur.is()) - { - serialize_node(cur); - cur = cur->getNextSibling(); - } - m_aPipe->closeOutput(); -} - -Reference< XInputStream > CSerializationURLEncoded::getInputStream() -{ - return Reference< XInputStream >(m_aPipe, UNO_QUERY); -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/forms/source/xforms/submission/serialization_urlencoded.hxx b/forms/source/xforms/submission/serialization_urlencoded.hxx deleted file mode 100644 index b3501762a..000000000 --- a/forms/source/xforms/submission/serialization_urlencoded.hxx +++ /dev/null @@ -1,59 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef __SERIALIZATION_URLENCODED_HXX -#define __SERIALIZATION_URLENCODED_HXX - -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/io/XInputStream.hpp> -#include <com/sun/star/io/XOutputStream.hpp> - -#include <rtl/strbuf.hxx> - -#include "serialization.hxx" - -class CSerializationURLEncoded : public CSerialization -{ -private: - CSS::uno::Reference< CSS::lang::XMultiServiceFactory > m_aFactory; - CSS::uno::Reference< CSS::io::XOutputStream > m_aPipe; - - sal_Bool is_unreserved(sal_Char); - void encode_and_append(const rtl::OUString& aString, rtl::OStringBuffer& aBuffer); - void serialize_node(const CSS::uno::Reference< CSS::xml::dom::XNode >& aNode); - void serialize_nodeset(); - -public: - CSerializationURLEncoded(); - virtual void serialize(); - virtual CSS::uno::Reference< CSS::io::XInputStream > getInputStream(); -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/forms/source/xforms/submission/submission.hxx b/forms/source/xforms/submission/submission.hxx deleted file mode 100644 index 098db603f..000000000 --- a/forms/source/xforms/submission/submission.hxx +++ /dev/null @@ -1,163 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef __SUBMISSION_HXX -#define __SUBMISSION_HXX - -#include <tools/urlobj.hxx> -#include <rtl/ustring.h> -#include <osl/conditn.hxx> -#include <osl/mutex.hxx> -#include <unotools/processfactory.hxx> -#include <com/sun/star/uno/Reference.hxx> -#include <com/sun/star/uno/Any.hxx> -#include <com/sun/star/uno/Exception.hpp> -#include <com/sun/star/uno/RuntimeException.hpp> -#include <com/sun/star/xml/xpath/XXPathObject.hpp> -#include <com/sun/star/xml/dom/XDocumentFragment.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> - -#include <com/sun/star/ucb/XCommandEnvironment.hpp> -#include <com/sun/star/ucb/XProgressHandler.hpp> - -#include <com/sun/star/task/XInteractionHandler.hpp> - -#include <com/sun/star/frame/XFrame.hpp> - -#include <cppuhelper/implbase1.hxx> -#include <cppuhelper/implbase2.hxx> -#include <cppuhelper/implbase3.hxx> - -#include "serialization.hxx" - -namespace CSS = com::sun::star; - -class CSubmissionPut; -class CSubmissionPost; -class CSubmissionGet; - -class CCommandEnvironmentHelper : public cppu::WeakImplHelper1< CSS::ucb::XCommandEnvironment > -{ - friend class CSubmissionPut; - friend class CSubmissionPost; - friend class CSubmissionGet; - friend class CSubmission; - -protected: - CSS::uno::Reference< CSS::task::XInteractionHandler > m_aInteractionHandler; - CSS::uno::Reference< CSS::ucb::XProgressHandler > m_aProgressHandler; - -public: - virtual CSS::uno::Reference< CSS::task::XInteractionHandler > SAL_CALL getInteractionHandler() throw (CSS::uno::RuntimeException) - { - return m_aInteractionHandler; - } - virtual CSS::uno::Reference< CSS::ucb::XProgressHandler > SAL_CALL getProgressHandler() throw (CSS::uno::RuntimeException) - { - return m_aProgressHandler; - } -}; - -class CProgressHandlerHelper : public cppu::WeakImplHelper1< CSS::ucb::XProgressHandler > -{ - friend class CSubmissionPut; - friend class CSubmissionPost; - friend class CSubmissionGet; -protected: - osl::Condition m_cFinished; - osl::Mutex m_mLock; - sal_Int32 m_count; -public: - CProgressHandlerHelper() - : m_count(0) - {} - virtual void SAL_CALL push( const com::sun::star::uno::Any& /*aStatus*/) throw(com::sun::star::uno::RuntimeException) - { - m_mLock.acquire(); - m_count++; - m_mLock.release(); - } - virtual void SAL_CALL update(const com::sun::star::uno::Any& /*aStatus*/) throw(com::sun::star::uno::RuntimeException) - { - } - virtual void SAL_CALL pop() throw(com::sun::star::uno::RuntimeException) - { - m_mLock.acquire(); - m_count--; - if (m_count == 0) - m_cFinished.set(); - m_mLock.release(); - } -}; - -class CSubmission -{ - -protected: - INetURLObject m_aURLObj; - CSS::uno::Reference< CSS::xml::xpath::XXPathObject > m_aXPathObject; - CSS::uno::Reference< CSS::xml::dom::XDocumentFragment > m_aFragment; - CSS::uno::Reference< CSS::io::XInputStream > m_aResultStream; - CSS::uno::Reference< CSS::lang::XMultiServiceFactory > m_aFactory; - rtl::OUString m_aEncoding; - - ::std::auto_ptr< CSerialization > createSerialization(const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& aHandler - ,com::sun::star::uno::Reference<com::sun::star::ucb::XCommandEnvironment>& _rOutEnv); - -public: - enum SubmissionResult { - SUCCESS, - INVALID_METHOD, - INVALID_URL, - INVALID_ENCODING, - E_TRANSMISSION, - UNKNOWN_ERROR - }; - - CSubmission(const rtl::OUString& aURL, const CSS::uno::Reference< CSS::xml::dom::XDocumentFragment >& aFragment) - : m_aURLObj(aURL) - , m_aFragment(aFragment) - , m_aFactory(::utl::getProcessServiceFactory()) - {} - - virtual ~CSubmission() {} - - // virtual CSS::uno::Sequence< rtl::OUString > getSupportedEncodings() = 0; - virtual void setEncoding(const rtl::OUString& aEncoding) - { - m_aEncoding = aEncoding; - } - virtual SubmissionResult submit(const CSS::uno::Reference< CSS::task::XInteractionHandler >& ) = 0; - - virtual SubmissionResult replace(const rtl::OUString&, const CSS::uno::Reference< CSS::xml::dom::XDocument >&, const CSS::uno::Reference< CSS::frame::XFrame>&); - -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/forms/source/xforms/submission/submission_get.cxx b/forms/source/xforms/submission/submission_get.cxx deleted file mode 100644 index 55bf875f1..000000000 --- a/forms/source/xforms/submission/submission_get.cxx +++ /dev/null @@ -1,122 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_forms.hxx" - -#include <memory> - -#include "submission_get.hxx" -#include "serialization_app_xml.hxx" -#include "serialization_urlencoded.hxx" - -#include <rtl/strbuf.hxx> -#include <rtl/string.hxx> -#include <osl/file.hxx> -#include <unotools/processfactory.hxx> -#include <ucbhelper/content.hxx> - -using namespace CSS::uno; -using namespace CSS::ucb; -using namespace CSS::task; -using namespace CSS::io; -using namespace osl; -using namespace ucbhelper; -using namespace std; - -using ::rtl::OUString; -using ::rtl::OStringToOUString; -using ::rtl::OStringBuffer; - - -CSubmissionGet::CSubmissionGet(const rtl::OUString& aURL, const CSS::uno::Reference< CSS::xml::dom::XDocumentFragment >& aFragment) - : CSubmission(aURL, aFragment) -{ -} - -CSubmission::SubmissionResult CSubmissionGet::submit(const CSS::uno::Reference< CSS::task::XInteractionHandler >& aInteractionHandler) -{ - // GET always uses apllicatin/x-www-formurlencoded - auto_ptr< CSerialization > apSerialization(new CSerializationURLEncoded()); - apSerialization->setSource(m_aFragment); - apSerialization->serialize(); - - CSS::uno::Reference< XInputStream > aInStream = apSerialization->getInputStream(); - - // create a commandEnvironment and use the default interaction handler - CCommandEnvironmentHelper *pHelper = new CCommandEnvironmentHelper; - if( aInteractionHandler.is() ) - pHelper->m_aInteractionHandler = aInteractionHandler; - else - pHelper->m_aInteractionHandler = CSS::uno::Reference< XInteractionHandler >(m_aFactory->createInstance( - OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.task.InteractionHandler"))), UNO_QUERY); - OSL_ENSURE(pHelper->m_aInteractionHandler.is(), "failed to create IntreractionHandler"); - CProgressHandlerHelper *pProgressHelper = new CProgressHandlerHelper; - pHelper->m_aProgressHandler = CSS::uno::Reference< XProgressHandler >(pProgressHelper); - - // UCB has ownership of environment... - CSS::uno::Reference< XCommandEnvironment > aEnvironment(pHelper); - - // append query string to the URL - try { - OStringBuffer aUTF8QueryURL(OUStringToOString(m_aURLObj.GetMainURL(INetURLObject::NO_DECODE), - RTL_TEXTENCODING_UTF8)); - OStringBuffer aQueryString; - - const sal_Int32 size = 1024; - sal_Int32 n = 0; - Sequence< sal_Int8 > aByteBuffer(size); - while ((n = aInStream->readSomeBytes(aByteBuffer, size-1)) != 0) - aQueryString.append((sal_Char*)aByteBuffer.getArray(), n); - if (aQueryString.getLength() > 0 && m_aURLObj.GetProtocol() != INET_PROT_FILE) - { - aUTF8QueryURL.append('?'); - aUTF8QueryURL.append(aQueryString.makeStringAndClear()); - } - OUString aQueryURL = OStringToOUString(aUTF8QueryURL.makeStringAndClear(), RTL_TEXTENCODING_UTF8); - ucbhelper::Content aContent(aQueryURL, aEnvironment); - CSS::uno::Reference< XOutputStream > aPipe(m_aFactory->createInstance( - OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.io.Pipe"))), UNO_QUERY_THROW); - aContent.openStream(aPipe); - // get reply - try { - m_aResultStream = aContent.openStream(); - } catch (Exception&) { - OSL_FAIL("Cannot open reply stream from content"); - } - } catch (Exception&) - { - // XXX - OSL_FAIL("Exception during UCB operatration."); - return UNKNOWN_ERROR; - } - - return SUCCESS; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/forms/source/xforms/submission/submission_get.hxx b/forms/source/xforms/submission/submission_get.hxx deleted file mode 100644 index 73d32e074..000000000 --- a/forms/source/xforms/submission/submission_get.hxx +++ /dev/null @@ -1,47 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef __SUBMISSION_GET_HXX -#define __SUBMISSION_GET_HXX - -#include <com/sun/star/lang/XMultiServiceFactory.hpp> - -#include "submission.hxx" - -class CSubmissionGet : public CSubmission -{ -private: - CSS::uno::Reference< CSS::lang::XMultiServiceFactory > m_aFactory; -public: - CSubmissionGet(const rtl::OUString& aURL, const CSS::uno::Reference< CSS::xml::dom::XDocumentFragment >& aFragment); - virtual SubmissionResult submit(const CSS::uno::Reference< CSS::task::XInteractionHandler >& aInteractionHandler); - -}; -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/forms/source/xforms/submission/submission_post.cxx b/forms/source/xforms/submission/submission_post.cxx deleted file mode 100644 index da353c832..000000000 --- a/forms/source/xforms/submission/submission_post.cxx +++ /dev/null @@ -1,95 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_forms.hxx" - -#include <memory> - -#include "submission_post.hxx" -#include "serialization_app_xml.hxx" -#include "serialization_urlencoded.hxx" - -#include <osl/file.hxx> -#include <unotools/processfactory.hxx> -#include <ucbhelper/content.hxx> -#include <ucbhelper/activedatasink.hxx> -#include <com/sun/star/ucb/PostCommandArgument2.hpp> - -using namespace CSS::uno; -using namespace CSS::ucb; -using namespace CSS::task; -using namespace CSS::io; -using namespace osl; -using namespace ucbhelper; -using namespace std; - -using ::rtl::OUString; - - -CSubmissionPost::CSubmissionPost(const rtl::OUString& aURL, const CSS::uno::Reference< CSS::xml::dom::XDocumentFragment >& aFragment) - : CSubmission(aURL, aFragment) -{ -} - -CSubmission::SubmissionResult CSubmissionPost::submit(const CSS::uno::Reference< CSS::task::XInteractionHandler >& aInteractionHandler) -{ - // PUT always uses application/xml - CSS::uno::Reference< XCommandEnvironment > aEnvironment; - auto_ptr< CSerialization > apSerialization(createSerialization(aInteractionHandler,aEnvironment)); - - try { - ucbhelper::Content aContent(m_aURLObj.GetMainURL(INetURLObject::NO_DECODE), aEnvironment); - - // use post command - OUString aCommandName(RTL_CONSTASCII_USTRINGPARAM("post")); - PostCommandArgument2 aPostArgument; - aPostArgument.Source = apSerialization->getInputStream(); - CSS::uno::Reference< XActiveDataSink > aSink(new ucbhelper::ActiveDataSink); - aPostArgument.Sink = aSink; - aPostArgument.MediaType = OUString(RTL_CONSTASCII_USTRINGPARAM("application/xml")); - aPostArgument.Referer = OUString(); - Any aCommandArgument; - aCommandArgument <<= aPostArgument; - aContent.executeCommand( aCommandName, aCommandArgument); - - try { - m_aResultStream = aSink->getInputStream(); - } catch (Exception&) { - OSL_FAIL("Cannot open reply stream from content"); - } - } catch (Exception&) - { - OSL_FAIL("Exception during UCB operatration."); - return UNKNOWN_ERROR; - } - - return SUCCESS; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/forms/source/xforms/submission/submission_post.hxx b/forms/source/xforms/submission/submission_post.hxx deleted file mode 100644 index 542e12521..000000000 --- a/forms/source/xforms/submission/submission_post.hxx +++ /dev/null @@ -1,43 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef __SUBMISSION_POST_HXX -#define __SUBMISSION_POST_HXX - -#include "submission.hxx" - -class CSubmissionPost : public CSubmission -{ -public: - CSubmissionPost(const rtl::OUString& aURL, const CSS::uno::Reference< CSS::xml::dom::XDocumentFragment >& aFragment); - virtual SubmissionResult submit(const CSS::uno::Reference< CSS::task::XInteractionHandler >& aInteractionHandler); - -}; -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/forms/source/xforms/submission/submission_put.cxx b/forms/source/xforms/submission/submission_put.cxx deleted file mode 100644 index 7a59063cf..000000000 --- a/forms/source/xforms/submission/submission_put.cxx +++ /dev/null @@ -1,83 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_forms.hxx" - -#include <memory> - -#include "submission_put.hxx" -#include "serialization_app_xml.hxx" -#include "serialization_urlencoded.hxx" - -#include <osl/file.hxx> -#include <unotools/processfactory.hxx> -#include <ucbhelper/content.hxx> - -using namespace CSS::uno; -using namespace CSS::ucb; -using namespace CSS::task; -using namespace CSS::io; -using namespace osl; -using namespace ucbhelper; -using namespace std; - -using ::rtl::OUString; - -CSubmissionPut::CSubmissionPut(const rtl::OUString& aURL, const CSS::uno::Reference< CSS::xml::dom::XDocumentFragment >& aFragment) - : CSubmission(aURL, aFragment) -{ -} - -CSubmission::SubmissionResult CSubmissionPut::submit(const CSS::uno::Reference< CSS::task::XInteractionHandler >& aInteractionHandler) -{ - CSS::uno::Reference< XCommandEnvironment > aEnvironment; - auto_ptr< CSerialization > apSerialization(createSerialization(aInteractionHandler,aEnvironment)); - - try { - ucbhelper::Content aContent(m_aURLObj.GetMainURL(INetURLObject::NO_DECODE), aEnvironment); - - // insert serialized data to content -> PUT - CSS::uno::Reference< XInputStream > aInStream = apSerialization->getInputStream(); - aContent.writeStream(aInStream, sal_True); - //aContent.closeStream(); - - // no content as a result of put... - - } catch (Exception&) - { - // XXX - OSL_FAIL("Exception during UCB operatration."); - return UNKNOWN_ERROR; - } - - - return SUCCESS; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/forms/source/xforms/submission/submission_put.hxx b/forms/source/xforms/submission/submission_put.hxx deleted file mode 100644 index 61d5a2436..000000000 --- a/forms/source/xforms/submission/submission_put.hxx +++ /dev/null @@ -1,46 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef __SUBMISSION_PUT_HXX -#define __SUBMISSION_PUT_HXX - -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/frame/XFrame.hpp> - -#include "submission.hxx" - -class CSubmissionPut : public CSubmission -{ -public: - CSubmissionPut(const rtl::OUString& aURL, const CSS::uno::Reference< CSS::xml::dom::XDocumentFragment >& aFragment); - virtual SubmissionResult submit(const CSS::uno::Reference< CSS::task::XInteractionHandler >& aInteractionHandler); - -}; -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |