diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-03-11 09:08:13 +0100 |
---|---|---|
committer | Ashod Nakashian <ashod.nakashian@collabora.co.uk> | 2016-07-12 22:06:18 -0400 |
commit | 0c4c31576fe03b3b59217bf9990b75f32d193d0d (patch) | |
tree | c166cb0f6a5edaf50f5078c1c89920857374c41e /writerfilter | |
parent | 78bd7a0c5a06b617d5ab89a2fe3f2675c4d57b37 (diff) |
writerfilter: avoid ugly cross-directory include
(cherry picked from commit 9f9fa48ad0539646c68f544af1d55711d7f74c15)
Change-Id: I16db4e16e5c2fa3aa3bfb22f83d2c36695499b5c
Diffstat (limited to 'writerfilter')
-rw-r--r-- | writerfilter/Library_writerfilter.mk | 1 | ||||
-rw-r--r-- | writerfilter/inc/dmapper/DomainMapperFactory.hxx | 6 | ||||
-rw-r--r-- | writerfilter/qa/cppunittests/misc/misc.cxx | 212 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper_Impl.cxx | 52 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper_Impl.hxx | 14 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfdocumentimpl.cxx | 6 |
6 files changed, 149 insertions, 142 deletions
diff --git a/writerfilter/Library_writerfilter.mk b/writerfilter/Library_writerfilter.mk index 670237cffef1..cba6741948e8 100644 --- a/writerfilter/Library_writerfilter.mk +++ b/writerfilter/Library_writerfilter.mk @@ -21,7 +21,6 @@ $(eval $(call gb_Library_set_include,writerfilter,\ $$(INCLUDE) \ -I$(SRCDIR)/writerfilter/inc \ -I$(SRCDIR)/writerfilter/source \ - -I$(SRCDIR)/writerfilter/source/dmapper \ )) $(eval $(call gb_Library_use_sdk_api,writerfilter)) diff --git a/writerfilter/inc/dmapper/DomainMapperFactory.hxx b/writerfilter/inc/dmapper/DomainMapperFactory.hxx index afd798aec850..01c347edf903 100644 --- a/writerfilter/inc/dmapper/DomainMapperFactory.hxx +++ b/writerfilter/inc/dmapper/DomainMapperFactory.hxx @@ -9,6 +9,8 @@ #ifndef INCLUDED_WRITERFILTER_INC_DMAPPER_DOMAINMAPPERFACTORY_HXX #define INCLUDED_WRITERFILTER_INC_DMAPPER_DOMAINMAPPERFACTORY_HXX +#include <vector> + #include <dmapper/resourcemodel.hxx> #include <com/sun/star/io/XInputStream.hpp> #include <com/sun/star/lang/XComponent.hpp> @@ -42,6 +44,10 @@ public: SourceDocumentType eDocumentType, utl::MediaDescriptor& rMediaDesc); }; + +// export just for test +SAL_DLLPUBLIC_EXPORT std::tuple<OUString, std::vector<OUString>, std::vector<OUString> > splitFieldCommand(const OUString& rCommand); + } // namespace dmapper } // namespace writerfilter diff --git a/writerfilter/qa/cppunittests/misc/misc.cxx b/writerfilter/qa/cppunittests/misc/misc.cxx index 49e5e1b393c6..f59695ae368f 100644 --- a/writerfilter/qa/cppunittests/misc/misc.cxx +++ b/writerfilter/qa/cppunittests/misc/misc.cxx @@ -8,10 +8,9 @@ */ #include <limits> +#include <tuple> #include <vector> -#include <boost/tuple/tuple.hpp> - #include <cppunit/TestAssert.h> #include <cppunit/TestFixture.h> #include <cppunit/extensions/HelperMacros.h> @@ -29,9 +28,6 @@ class WriterfilterMiscTest : public ::CppUnit::TestFixture { public: - virtual void setUp() override; - virtual void tearDown() override; - void testTwipConversions(); void testFieldParameters(); @@ -41,14 +37,6 @@ public: CPPUNIT_TEST_SUITE_END(); }; -void WriterfilterMiscTest::setUp() -{ -} - -void WriterfilterMiscTest::tearDown() -{ -} - void WriterfilterMiscTest::testTwipConversions() { using writerfilter::dmapper::ConversionHelper::convertTwipToMM100; @@ -71,95 +59,115 @@ void WriterfilterMiscTest::testTwipConversions() void WriterfilterMiscTest::testFieldParameters() { - using writerfilter::dmapper::lcl_SplitFieldCommand; - boost::tuple<OUString, std::vector<OUString>, std::vector<OUString> > result; - - result = lcl_SplitFieldCommand("PAGEREF last_page"); - CPPUNIT_ASSERT_EQUAL(OUString("PAGEREF"), boost::get<0>(result)); - CPPUNIT_ASSERT_EQUAL(size_t(1), boost::get<1>(result).size()); - CPPUNIT_ASSERT_EQUAL(OUString("last_page"), boost::get<1>(result)[0]); - CPPUNIT_ASSERT(boost::get<2>(result).empty()); - - result = lcl_SplitFieldCommand(" PAGEREF last_page "); - CPPUNIT_ASSERT_EQUAL(OUString("PAGEREF"), boost::get<0>(result)); - CPPUNIT_ASSERT_EQUAL(size_t(1), boost::get<1>(result).size()); - CPPUNIT_ASSERT_EQUAL(OUString("last_page"), boost::get<1>(result)[0]); - - result = lcl_SplitFieldCommand("pageref last_page"); - CPPUNIT_ASSERT(boost::get<2>(result).empty()); - CPPUNIT_ASSERT_EQUAL(OUString("PAGEREF"), boost::get<0>(result)); - CPPUNIT_ASSERT_EQUAL(size_t(1), boost::get<1>(result).size()); - CPPUNIT_ASSERT_EQUAL(OUString("last_page"), boost::get<1>(result)[0]); - CPPUNIT_ASSERT(boost::get<2>(result).empty()); - - result = lcl_SplitFieldCommand("pageref \"last_page\""); - CPPUNIT_ASSERT_EQUAL(OUString("PAGEREF"), boost::get<0>(result)); - CPPUNIT_ASSERT_EQUAL(size_t(1), boost::get<1>(result).size()); - CPPUNIT_ASSERT_EQUAL(OUString("last_page"), boost::get<1>(result)[0]); - CPPUNIT_ASSERT(boost::get<2>(result).empty()); - - result = lcl_SplitFieldCommand("\"PAGEREF\" \"last_page\" \"\" "); - CPPUNIT_ASSERT_EQUAL(OUString("PAGEREF"), boost::get<0>(result)); - CPPUNIT_ASSERT_EQUAL(size_t(2), boost::get<1>(result).size()); - CPPUNIT_ASSERT_EQUAL(OUString("last_page"), boost::get<1>(result)[0]); - CPPUNIT_ASSERT_EQUAL(OUString(), boost::get<1>(result)[1]); - CPPUNIT_ASSERT(boost::get<2>(result).empty()); - - result = lcl_SplitFieldCommand("\"PAGEREF\"\"last_page\" "); - CPPUNIT_ASSERT_EQUAL(OUString("PAGEREF"), boost::get<0>(result)); - CPPUNIT_ASSERT_EQUAL(size_t(1), boost::get<1>(result).size()); - CPPUNIT_ASSERT_EQUAL(OUString("last_page"), boost::get<1>(result)[0]); - CPPUNIT_ASSERT(boost::get<2>(result).empty()); - - result = lcl_SplitFieldCommand("PAGEREF\"last_page\" "); - CPPUNIT_ASSERT_EQUAL(OUString("PAGEREF"), boost::get<0>(result)); - CPPUNIT_ASSERT_EQUAL(size_t(1), boost::get<1>(result).size()); - CPPUNIT_ASSERT_EQUAL(OUString("last_page"), boost::get<1>(result)[0]); - CPPUNIT_ASSERT(boost::get<2>(result).empty()); - - result = lcl_SplitFieldCommand("\"PAGEREF\"last_page \"\""); - CPPUNIT_ASSERT_EQUAL(OUString("PAGEREF"), boost::get<0>(result)); - CPPUNIT_ASSERT_EQUAL(size_t(2), boost::get<1>(result).size()); - CPPUNIT_ASSERT_EQUAL(OUString("last_page"), boost::get<1>(result)[0]); - CPPUNIT_ASSERT_EQUAL(OUString(), boost::get<1>(result)[1]); - CPPUNIT_ASSERT(boost::get<2>(result).empty()); - - result = lcl_SplitFieldCommand("\"PAGEREF\"last_page \"\""); - CPPUNIT_ASSERT_EQUAL(OUString("PAGEREF"), boost::get<0>(result)); - CPPUNIT_ASSERT_EQUAL(size_t(2), boost::get<1>(result).size()); - CPPUNIT_ASSERT_EQUAL(OUString("last_page"), boost::get<1>(result)[0]); - CPPUNIT_ASSERT_EQUAL(OUString(), boost::get<1>(result)[1]); - CPPUNIT_ASSERT(boost::get<2>(result).empty()); - - result = lcl_SplitFieldCommand("pageref \"last\\\\pa\\\"ge\""); - CPPUNIT_ASSERT_EQUAL(OUString("PAGEREF"), boost::get<0>(result)); - CPPUNIT_ASSERT_EQUAL(size_t(1), boost::get<1>(result).size()); - CPPUNIT_ASSERT_EQUAL(OUString("last\\pa\"ge"), boost::get<1>(result)[0]); - CPPUNIT_ASSERT(boost::get<2>(result).empty()); - - result = lcl_SplitFieldCommand("PAGEREF\"last_page\"\\*"); - CPPUNIT_ASSERT_EQUAL(OUString("PAGEREF"), boost::get<0>(result)); - CPPUNIT_ASSERT_EQUAL(size_t(1), boost::get<1>(result).size()); - CPPUNIT_ASSERT_EQUAL(OUString("last_page"), boost::get<1>(result)[0]); - CPPUNIT_ASSERT_EQUAL(size_t(1), boost::get<2>(result).size()); - CPPUNIT_ASSERT_EQUAL(OUString("\\*"), boost::get<2>(result)[0]); - - result = lcl_SplitFieldCommand("PAGEREF last_page \\b foobar "); - CPPUNIT_ASSERT_EQUAL(OUString("PAGEREF"), boost::get<0>(result)); - CPPUNIT_ASSERT_EQUAL(size_t(1), boost::get<1>(result).size()); - CPPUNIT_ASSERT_EQUAL(OUString("last_page"), boost::get<1>(result)[0]); - CPPUNIT_ASSERT_EQUAL(size_t(2), boost::get<2>(result).size()); - CPPUNIT_ASSERT_EQUAL(OUString("\\B"), boost::get<2>(result)[0]); - CPPUNIT_ASSERT_EQUAL(OUString("foobar"), boost::get<2>(result)[1]); - - result = lcl_SplitFieldCommand("PAGEREF\\bfoobar\\A\"\""); - CPPUNIT_ASSERT_EQUAL(OUString("PAGEREF"), boost::get<0>(result)); - CPPUNIT_ASSERT(boost::get<1>(result).empty()); - CPPUNIT_ASSERT_EQUAL(size_t(4), boost::get<2>(result).size()); - CPPUNIT_ASSERT_EQUAL(OUString("\\B"), boost::get<2>(result)[0]); - CPPUNIT_ASSERT_EQUAL(OUString("foobar"), boost::get<2>(result)[1]); - CPPUNIT_ASSERT_EQUAL(OUString("\\A"), boost::get<2>(result)[2]); - CPPUNIT_ASSERT_EQUAL(OUString(), boost::get<2>(result)[3]); + using writerfilter::dmapper::splitFieldCommand; + std::tuple<OUString, std::vector<OUString>, std::vector<OUString> > result; + + result = splitFieldCommand("PAGEREF last_page"); + CPPUNIT_ASSERT_EQUAL(OUString("PAGEREF"), std::get<0>(result)); + CPPUNIT_ASSERT_EQUAL(size_t(1), std::get<1>(result).size()); + CPPUNIT_ASSERT_EQUAL(OUString("last_page"), std::get<1>(result)[0]); + CPPUNIT_ASSERT(std::get<2>(result).empty()); + + result = splitFieldCommand(" PAGEREF last_page "); + CPPUNIT_ASSERT_EQUAL(OUString("PAGEREF"), std::get<0>(result)); + CPPUNIT_ASSERT_EQUAL(size_t(1), std::get<1>(result).size()); + CPPUNIT_ASSERT_EQUAL(OUString("last_page"), std::get<1>(result)[0]); + + result = splitFieldCommand("pageref last_page"); + CPPUNIT_ASSERT(std::get<2>(result).empty()); + CPPUNIT_ASSERT_EQUAL(OUString("PAGEREF"), std::get<0>(result)); + CPPUNIT_ASSERT_EQUAL(size_t(1), std::get<1>(result).size()); + CPPUNIT_ASSERT_EQUAL(OUString("last_page"), std::get<1>(result)[0]); + CPPUNIT_ASSERT(std::get<2>(result).empty()); + + result = splitFieldCommand("pageref \"last_page\""); + CPPUNIT_ASSERT_EQUAL(OUString("PAGEREF"), std::get<0>(result)); + CPPUNIT_ASSERT_EQUAL(size_t(1), std::get<1>(result).size()); + CPPUNIT_ASSERT_EQUAL(OUString("last_page"), std::get<1>(result)[0]); + CPPUNIT_ASSERT(std::get<2>(result).empty()); + + result = splitFieldCommand("\"PAGEREF\" \"last_page\" \"\" "); + CPPUNIT_ASSERT_EQUAL(OUString("PAGEREF"), std::get<0>(result)); + CPPUNIT_ASSERT_EQUAL(size_t(2), std::get<1>(result).size()); + CPPUNIT_ASSERT_EQUAL(OUString("last_page"), std::get<1>(result)[0]); + CPPUNIT_ASSERT_EQUAL(OUString(), std::get<1>(result)[1]); + CPPUNIT_ASSERT(std::get<2>(result).empty()); + + result = splitFieldCommand("\"PAGEREF\"\"last_page\" "); + CPPUNIT_ASSERT_EQUAL(OUString("PAGEREF"), std::get<0>(result)); + CPPUNIT_ASSERT_EQUAL(size_t(1), std::get<1>(result).size()); + CPPUNIT_ASSERT_EQUAL(OUString("last_page"), std::get<1>(result)[0]); + CPPUNIT_ASSERT(std::get<2>(result).empty()); + + result = splitFieldCommand("PAGEREF\"last_page\" "); + CPPUNIT_ASSERT_EQUAL(OUString("PAGEREF"), std::get<0>(result)); + CPPUNIT_ASSERT_EQUAL(size_t(1), std::get<1>(result).size()); + CPPUNIT_ASSERT_EQUAL(OUString("last_page"), std::get<1>(result)[0]); + CPPUNIT_ASSERT(std::get<2>(result).empty()); + + result = splitFieldCommand("\"PAGEREF\"last_page \"\""); + CPPUNIT_ASSERT_EQUAL(OUString("PAGEREF"), std::get<0>(result)); + CPPUNIT_ASSERT_EQUAL(size_t(2), std::get<1>(result).size()); + CPPUNIT_ASSERT_EQUAL(OUString("last_page"), std::get<1>(result)[0]); + CPPUNIT_ASSERT_EQUAL(OUString(), std::get<1>(result)[1]); + CPPUNIT_ASSERT(std::get<2>(result).empty()); + + result = splitFieldCommand("\"PAGEREF\"last_page \"\""); + CPPUNIT_ASSERT_EQUAL(OUString("PAGEREF"), std::get<0>(result)); + CPPUNIT_ASSERT_EQUAL(size_t(2), std::get<1>(result).size()); + CPPUNIT_ASSERT_EQUAL(OUString("last_page"), std::get<1>(result)[0]); + CPPUNIT_ASSERT_EQUAL(OUString(), std::get<1>(result)[1]); + CPPUNIT_ASSERT(std::get<2>(result).empty()); + + result = splitFieldCommand("pageref \"last\\\\pa\\\"ge\""); + CPPUNIT_ASSERT_EQUAL(OUString("PAGEREF"), std::get<0>(result)); + CPPUNIT_ASSERT_EQUAL(size_t(1), std::get<1>(result).size()); + CPPUNIT_ASSERT_EQUAL(OUString("last\\pa\"ge"), std::get<1>(result)[0]); + CPPUNIT_ASSERT(std::get<2>(result).empty()); + + result = splitFieldCommand("PAGEREF\"last_page\"\\*"); + CPPUNIT_ASSERT_EQUAL(OUString("PAGEREF"), std::get<0>(result)); + CPPUNIT_ASSERT_EQUAL(size_t(1), std::get<1>(result).size()); + CPPUNIT_ASSERT_EQUAL(OUString("last_page"), std::get<1>(result)[0]); + CPPUNIT_ASSERT_EQUAL(size_t(1), std::get<2>(result).size()); + CPPUNIT_ASSERT_EQUAL(OUString("\\*"), std::get<2>(result)[0]); + + result = splitFieldCommand("PAGEREF last_page \\b foobar "); + CPPUNIT_ASSERT_EQUAL(OUString("PAGEREF"), std::get<0>(result)); + CPPUNIT_ASSERT_EQUAL(size_t(1), std::get<1>(result).size()); + CPPUNIT_ASSERT_EQUAL(OUString("last_page"), std::get<1>(result)[0]); + CPPUNIT_ASSERT_EQUAL(size_t(2), std::get<2>(result).size()); + CPPUNIT_ASSERT_EQUAL(OUString("\\B"), std::get<2>(result)[0]); + CPPUNIT_ASSERT_EQUAL(OUString("foobar"), std::get<2>(result)[1]); + + result = splitFieldCommand("PAGEREF\\bfoobar\\A\"\""); + CPPUNIT_ASSERT_EQUAL(OUString("PAGEREF"), std::get<0>(result)); + CPPUNIT_ASSERT(std::get<1>(result).empty()); + CPPUNIT_ASSERT_EQUAL(size_t(4), std::get<2>(result).size()); + CPPUNIT_ASSERT_EQUAL(OUString("\\B"), std::get<2>(result)[0]); + CPPUNIT_ASSERT_EQUAL(OUString("foobar"), std::get<2>(result)[1]); + CPPUNIT_ASSERT_EQUAL(OUString("\\A"), std::get<2>(result)[2]); + CPPUNIT_ASSERT_EQUAL(OUString(), std::get<2>(result)[3]); + + for (auto prefix : {"#", "$", "%", "&", "'", "(", ")", "*", "+", ",", + "-", ".", "/", ":", ";", "<", ">", "?", "@", "[", + "]", "^", "_", "`", "{", "|", "}", "~"}) + { + OUString test(OUString::createFromAscii(prefix) + "PAGE"); + result = splitFieldCommand(test + " "); + CPPUNIT_ASSERT_EQUAL(test, std::get<0>(result)); + } + result = splitFieldCommand("\\PAGE "); + CPPUNIT_ASSERT_EQUAL(OUString("PAGE"), std::get<0>(result)); + result = splitFieldCommand("\\ PAGE "); + CPPUNIT_ASSERT_EQUAL(OUString("\\ "), std::get<0>(result)); + CPPUNIT_ASSERT_EQUAL(OUString("PAGE"), std::get<1>(result)[0]); + result = splitFieldCommand("\\\\PAGE "); + CPPUNIT_ASSERT_EQUAL(OUString("\\PAGE"), std::get<0>(result)); + result = splitFieldCommand("\"PAGE\" "); + CPPUNIT_ASSERT_EQUAL(OUString("PAGE"), std::get<0>(result)); + result = splitFieldCommand("\"PAGE "); + CPPUNIT_ASSERT_EQUAL(OUString("PAGE "), std::get<0>(result)); } CPPUNIT_TEST_SUITE_REGISTRATION(WriterfilterMiscTest); diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index a1985b6bb082..cfb90a0dd060 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -32,6 +32,7 @@ #include <com/sun/star/document/PrinterIndependentLayout.hpp> #include <com/sun/star/document/IndexedPropertyValues.hpp> #include <com/sun/star/drawing/XDrawPageSupplier.hpp> +#include <com/sun/star/embed/XEmbeddedObject.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/style/XStyleFamiliesSupplier.hpp> #include <com/sun/star/style/LineNumberPosition.hpp> @@ -73,7 +74,7 @@ #include <oox/token/tokens.hxx> #include <map> -#include <boost/tuple/tuple.hpp> +#include <tuple> #include <vcl/svapp.hxx> #include <vcl/outdev.hxx> @@ -449,7 +450,6 @@ void DomainMapper_Impl::SetIsFirstParagraphInSection( bool bIsFirst ) } - void DomainMapper_Impl::SetIsDummyParaAddedForTableInSection( bool bIsAdded ) { m_bDummyParaAddedForTableInSection = bIsAdded; @@ -474,7 +474,6 @@ void DomainMapper_Impl::SetSdt(bool bSdt) } - void DomainMapper_Impl::PushProperties(ContextType eId) { PropertyMapPtr pInsert(eId == CONTEXT_SECTION ? @@ -568,7 +567,6 @@ PropertyMapPtr DomainMapper_Impl::GetTopContextOfType(ContextType eId) } - uno::Reference< text::XTextAppend > DomainMapper_Impl::GetTopTextAppend() { OSL_ENSURE(!m_aTextAppendStack.empty(), "text append stack is empty" ); @@ -1327,7 +1325,6 @@ void DomainMapper_Impl::appendTextContent( } - void DomainMapper_Impl::appendOLE( const OUString& rStreamName, OLEHandlerPtr pOLEHandler ) { static const char sEmbeddedService[] = "com.sun.star.text.TextEmbeddedObject"; @@ -1722,7 +1719,6 @@ void DomainMapper_Impl::EndParaMarkerChange( ) } - void DomainMapper_Impl::PushAnnotation() { try @@ -2066,7 +2062,7 @@ void DomainMapper_Impl::PopShapeContext() bool DomainMapper_Impl::IsSdtEndBefore() { - bool bIsSdtEndBefore = false;; + bool bIsSdtEndBefore = false; PropertyMapPtr pContext = GetTopContextOfType(CONTEXT_CHARACTER); if(pContext) { @@ -2286,24 +2282,30 @@ static OUString lcl_ExtractToken(OUString const& rCommand, assert(rIndex == rCommand.getLength()); if (bQuoted) { + // MS Word allows this, so just emit a debug message SAL_INFO("writerfilter.dmapper", "field argument with unterminated quote"); - return OUString(); - } - else - { - rHaveToken = !token.isEmpty(); - return token.makeStringAndClear(); } + rHaveToken = !token.isEmpty(); + return token.makeStringAndClear(); } -boost::tuple<OUString, std::vector<OUString>, std::vector<OUString> > -lcl_SplitFieldCommand(const OUString& rCommand) +std::tuple<OUString, std::vector<OUString>, std::vector<OUString> > splitFieldCommand(const OUString& rCommand) { OUString sType; std::vector<OUString> arguments; std::vector<OUString> switches; sal_Int32 nStartIndex(0); + // tdf#54584: Field may be prepended by a backslash + // This is not an escapement, but already escaped literal "\" + // MS Word allows this, so just skip it + if ((rCommand.getLength() >= nStartIndex + 2) && + (rCommand[nStartIndex] == L'\\') && + (rCommand[nStartIndex + 1] != L'\\') && + (rCommand[nStartIndex + 1] != L' ')) + { + ++nStartIndex; + } do { @@ -2329,10 +2331,9 @@ lcl_SplitFieldCommand(const OUString& rCommand) } } while (nStartIndex < rCommand.getLength()); - return boost::make_tuple(sType, arguments, switches); + return std::make_tuple(sType, arguments, switches); } - OUString lcl_ExctractAskVariableAndHint( const OUString& rCommand, OUString& rHint ) { // the first word after "ASK " is the variable @@ -3554,13 +3555,13 @@ void DomainMapper_Impl::CloseFieldCommand() { uno::Reference< uno::XInterface > xFieldInterface; - boost::tuple<OUString, std::vector<OUString>, std::vector<OUString> > const - field(lcl_SplitFieldCommand(pContext->GetCommand())); - OUString const sFirstParam(boost::get<1>(field).empty() - ? OUString() : boost::get<1>(field).front()); + std::tuple<OUString, std::vector<OUString>, std::vector<OUString> > const + field(splitFieldCommand(pContext->GetCommand())); + OUString const sFirstParam(std::get<1>(field).empty() + ? OUString() : std::get<1>(field).front()); FieldConversionMap_t::iterator const aIt = - aFieldConversionMap.find(boost::get<0>(field)); + aFieldConversionMap.find(std::get<0>(field)); if(aIt != aFieldConversionMap.end()) { bool bCreateEnhancedField = false; @@ -3614,7 +3615,7 @@ void DomainMapper_Impl::CloseFieldCommand() { FieldConversionMap_t aEnhancedFieldConversionMap = lcl_GetEnhancedFieldConversion(); FieldConversionMap_t::iterator aEnhancedIt = - aEnhancedFieldConversionMap.find(boost::get<0>(field)); + aEnhancedFieldConversionMap.find(std::get<0>(field)); if ( aEnhancedIt != aEnhancedFieldConversionMap.end()) sServiceName += OUString::createFromAscii(aEnhancedIt->second.cFieldServiceName ); } @@ -3682,7 +3683,7 @@ void DomainMapper_Impl::CloseFieldCommand() // OUString sParam = lcl_ExtractParameter(pContext->GetCommand(), sizeof(" COMMENTS") ); // A parameter with COMMENTS shouldn't set fixed // ( or at least the binary filter doesn't ) - // If we set fixed then we wont export a field cmd. + // If we set fixed then we won't export a field cmd. // Additionally the para in COMMENTS is more like an // instruction to set the document property comments // with the param ( e.g. each COMMENT with a param will @@ -4775,7 +4776,6 @@ void DomainMapper_Impl::ImportGraphic(writerfilter::Reference< Properties >::Po } - void DomainMapper_Impl::SetLineNumbering( sal_Int32 nLnnMod, sal_uInt32 nLnc, sal_Int32 ndxaLnn ) { if( !m_bLineNumberingSet ) @@ -4823,7 +4823,6 @@ void DomainMapper_Impl::SetPageMarginTwip( PageMarElement eElement, sal_Int32 nV } - _PageMar::_PageMar() { header = footer = ConversionHelper::convertTwipToMM100(sal_Int32(720)); @@ -4835,7 +4834,6 @@ _PageMar::_PageMar() } - void DomainMapper_Impl::RegisterFrameConversion( uno::Reference< text::XTextRange > const& xFrameStartRange, uno::Reference< text::XTextRange > const& xFrameEndRange, diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx index 14199bb4a78d..0fa1374e26a5 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx @@ -27,12 +27,12 @@ #include <com/sun/star/text/XTextFrame.hpp> #include <com/sun/star/style/TabStop.hpp> #include <com/sun/star/container/XNameContainer.hpp> -#include <vector> -#include <stack> #include <queue> -#include <boost/optional.hpp> -#include <boost/tuple/tuple.hpp> +#include <stack> +#include <tuple> #include <unordered_map> +#include <vector> +#include <boost/optional.hpp> #include <ooxml/resourceids.hxx> @@ -780,7 +780,7 @@ public: css::uno::Reference<css::container::XIndexAccess> GetCurrentNumberingRules(sal_Int32* pListLevel = nullptr); /** - Used for attributes/sprms which cannot be evaluated immediatelly (e.g. they depend + Used for attributes/sprms which cannot be evaluated immediately (e.g. they depend on another one that comes in the same CONTEXT_CHARACTER). The property will be processed again in DomainMapper::processDeferredCharacterProperties(). */ @@ -870,10 +870,6 @@ private: bool m_bParaHadField; }; -// export just for test -SAL_DLLPUBLIC_EXPORT boost::tuple<OUString, std::vector<OUString>, std::vector<OUString> > - lcl_SplitFieldCommand(const OUString& rCommand); - } //namespace dmapper } //namespace writerfilter #endif diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 6b1c59885108..9a15afc77096 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -40,7 +40,7 @@ #include <oox/token/namespaces.hxx> #include <oox/drawingml/drawingmltypes.hxx> #include <rtl/uri.hxx> -#include <dmapper/DomainMapper_Impl.hxx> +#include <dmapper/DomainMapperFactory.hxx> #include <rtfsdrimport.hxx> #include <rtflookahead.hxx> #include <rtfcharsets.hxx> @@ -1603,8 +1603,8 @@ RTFError RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword) aBuf.append(ch); } OUString aFieldCommand = OStringToOUString(aBuf.toString(), RTL_TEXTENCODING_UTF8); - boost::tuple<OUString, std::vector<OUString>, std::vector<OUString> > aResult = writerfilter::dmapper::lcl_SplitFieldCommand(aFieldCommand); - m_aPicturePath = boost::get<1>(aResult).empty() ? OUString() : boost::get<1>(aResult).front(); + std::tuple<OUString, std::vector<OUString>, std::vector<OUString> > aResult = writerfilter::dmapper::splitFieldCommand(aFieldCommand); + m_aPicturePath = std::get<1>(aResult).empty() ? OUString() : std::get<1>(aResult).front(); } Strm().Seek(nPos); |