diff options
Diffstat (limited to 'forms/source/xforms/submission/replace.cxx')
-rw-r--r-- | forms/source/xforms/submission/replace.cxx | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/forms/source/xforms/submission/replace.cxx b/forms/source/xforms/submission/replace.cxx index e0823397d7d7..ca91176c4c76 100644 --- a/forms/source/xforms/submission/replace.cxx +++ b/forms/source/xforms/submission/replace.cxx @@ -22,7 +22,9 @@ #include "serialization_app_xml.hxx" #include <rtl/ustring.hxx> -#include <tools/diagnose_ex.h> +#include <rtl/ref.hxx> +#include <comphelper/diagnose_ex.hxx> +#include <o3tl/string_view.hxx> #include <comphelper/processfactory.hxx> #include <com/sun/star/uno/Reference.hxx> @@ -42,15 +44,15 @@ using namespace com::sun::star::beans; using namespace com::sun::star::task; using namespace com::sun::star::xml::dom; -CSubmission::SubmissionResult CSubmission::replace(const OUString& aReplace, const Reference<XDocument>& aDocument, const Reference<XFrame>& aFrame) +CSubmission::SubmissionResult CSubmission::replace(std::u16string_view aReplace, const Reference<XDocument>& aDocument, const Reference<XFrame>& aFrame) { if (!m_aResultStream.is()) return CSubmission::UNKNOWN_ERROR; try { Reference< XComponentContext > xContext = comphelper::getProcessComponentContext(); - if (aReplace.equalsIgnoreAsciiCase("all") - || aReplace.equalsIgnoreAsciiCase("document")) { + if (o3tl::equalsIgnoreAsciiCase(aReplace, u"all") + || o3tl::equalsIgnoreAsciiCase(aReplace, u"document")) { Reference< XComponentLoader > xLoader; if (aFrame.is()) xLoader.set(aFrame, UNO_QUERY); @@ -60,18 +62,19 @@ CSubmission::SubmissionResult CSubmission::replace(const OUString& aReplace, con // open the stream from the result... // build media descriptor - Sequence< PropertyValue > descriptor(2); - descriptor[0] = PropertyValue("InputStream", - -1, makeAny(m_aResultStream), PropertyState_DIRECT_VALUE); - descriptor[1] = PropertyValue("ReadOnly", - -1, makeAny(true), PropertyState_DIRECT_VALUE); + Sequence< PropertyValue > descriptor{ + PropertyValue("InputStream", + -1, Any(m_aResultStream), PropertyState_DIRECT_VALUE), + PropertyValue("ReadOnly", + -1, Any(true), PropertyState_DIRECT_VALUE) + }; OUString aURL = m_aURLObj.GetMainURL(INetURLObject::DecodeMechanism::NONE); xLoader->loadComponentFromURL(aURL, "_default", FrameSearchFlag::ALL, descriptor); return CSubmission::SUCCESS; - } else if (aReplace.equalsIgnoreAsciiCase("instance")) { + } else if (o3tl::equalsIgnoreAsciiCase(aReplace, u"instance")) { if (aDocument.is()) { // parse the result stream into a new document Reference< XDocumentBuilder > xBuilder(DocumentBuilder::create(xContext)); @@ -92,7 +95,7 @@ CSubmission::SubmissionResult CSubmission::replace(const OUString& aReplace, con // nothing to replace return CSubmission::UNKNOWN_ERROR; } - } else if (aReplace.equalsIgnoreAsciiCase("none")) { + } else if (o3tl::equalsIgnoreAsciiCase(aReplace, u"none")) { // do nothing \o/ return CSubmission::SUCCESS; } @@ -110,14 +113,14 @@ CSubmission::SubmissionResult CSubmission::replace(const OUString& aReplace, con apSerialization->serialize(); // create a commandEnvironment and use the default interaction handler - CCommandEnvironmentHelper *pHelper = new CCommandEnvironmentHelper; + rtl::Reference<CCommandEnvironmentHelper> pHelper = new CCommandEnvironmentHelper; if( _xHandler.is() ) pHelper->m_aInteractionHandler = _xHandler; else pHelper->m_aInteractionHandler.set( InteractionHandler::createWithParent(m_xContext, nullptr), UNO_QUERY_THROW); - CProgressHandlerHelper *pProgressHelper = new CProgressHandlerHelper; + rtl::Reference<CProgressHandlerHelper> pProgressHelper = new CProgressHandlerHelper; pHelper->m_aProgressHandler.set(pProgressHelper); // UCB has ownership of environment... |