diff options
author | Rüdiger Timm <rt@openoffice.org> | 2005-10-24 06:38:20 +0000 |
---|---|---|
committer | Rüdiger Timm <rt@openoffice.org> | 2005-10-24 06:38:20 +0000 |
commit | 6c930968e3f9a41ab99942421585eaa4471fc009 (patch) | |
tree | a759cd03b2c0944d99b4dbcd02f18278a28c308a /forms/source/xforms/submission | |
parent | 17f717dc7bf6ac52f33ec71aa8b726ced6c1854e (diff) |
INTEGRATION: CWS eformspp1 (1.2.2); FILE MERGED
2005/10/17 18:30:16 lo 1.2.2.3: RESYNC: (1.2-1.3); FILE MERGED
2005/10/17 13:25:21 lo 1.2.2.2: #i50286# post/replace problems
2005/09/15 15:35:28 lo 1.2.2.1: fix get to file
Diffstat (limited to 'forms/source/xforms/submission')
-rw-r--r-- | forms/source/xforms/submission/replace.cxx | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/forms/source/xforms/submission/replace.cxx b/forms/source/xforms/submission/replace.cxx index a89d454cf155..72efd190ee42 100644 --- a/forms/source/xforms/submission/replace.cxx +++ b/forms/source/xforms/submission/replace.cxx @@ -4,9 +4,9 @@ * * $RCSfile: replace.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: rt $ $Date: 2005-09-08 23:23:30 $ + * last change: $Author: rt $ $Date: 2005-10-24 07:38:20 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -56,6 +56,9 @@ using namespace com::sun::star::xml::dom; CSubmission::SubmissionResult CSubmission::replace(const 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")) { @@ -89,14 +92,18 @@ CSubmission::SubmissionResult CSubmission::replace(const OUString& aReplace, con OUString::createFromAscii("com.sun.star.xml.dom.DocumentBuilder")), UNO_QUERY_THROW); Reference< XDocument > aNewDocument = xBuilder->parse(m_aResultStream); - // and replace the content of the current instance - Reference< XElement > oldRoot = aDocument->getDocumentElement(); - Reference< XElement > newRoot = aNewDocument->getDocumentElement(); + if (aNewDocument.is()) { + // and replace the content of the current instance + Reference< XElement > oldRoot = aDocument->getDocumentElement(); + Reference< XElement > newRoot = aNewDocument->getDocumentElement(); - // aDocument->removeChild(Reference< XNode >(oldRoot, UNO_QUERY_THROW)); - 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; + // aDocument->removeChild(Reference< XNode >(oldRoot, UNO_QUERY_THROW)); + 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; |