diff options
author | Cédric Bosdonnat <cedric.bosdonnat@free.fr> | 2013-07-04 15:45:01 +0200 |
---|---|---|
committer | Cédric Bosdonnat <cedric.bosdonnat@free.fr> | 2013-07-04 16:39:19 +0200 |
commit | c7e4264bed4e77daccf2f72063e5e00f1008c3cf (patch) | |
tree | 4f5a85035965d24921cb1f962cc2d9e548fbda90 | |
parent | 5743211f8b5f1d68b746b462942210ef69565960 (diff) |
n#825976: Fixed the import of Table of Figures
Support the TOC \c switch and fixed the SetExpression current
presentation property to have updated fields and TOC.
(cherry picked from commit 22a22a0983ec9c95e5b471395fc1c5bb813bd0d2)
Conflicts:
writerfilter/source/dmapper/DomainMapper_Impl.cxx
writerfilter/source/dmapper/PropertyIds.cxx
Conflicts:
writerfilter/source/dmapper/PropertyIds.cxx
Change-Id: I6fbd7cc38cf8ea7f08a0d15d1f39ffe4805dd62b
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper_Impl.cxx | 19 | ||||
-rw-r--r-- | writerfilter/source/dmapper/PropertyIds.cxx | 1 | ||||
-rw-r--r-- | writerfilter/source/dmapper/PropertyIds.hxx | 1 |
3 files changed, 19 insertions, 2 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 44c0a7ad0179..871b0cfaf84a 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -2576,6 +2576,8 @@ void DomainMapper_Impl::handleToc sal_Int16 nMaxLevel = 10; OUString sTemplate; OUString sChapterNoSeparator; + OUString sFigureSequence; + // \a Builds a table of figures but does not include the captions's label and number if( lcl_FindInCommand( pContext->GetCommand(), 'a', sValue )) { //make it a table of figures @@ -2590,6 +2592,8 @@ void DomainMapper_Impl::handleToc { //todo: sValue contains the label's name bTableOfFigures = true; + sFigureSequence = sValue.trim(); + sFigureSequence = sFigureSequence.replaceAll("\"", "").replaceAll("'",""); } // \d Defines the separator between sequence and page numbers if( lcl_FindInCommand( pContext->GetCommand(), 'd', sValue )) @@ -2777,6 +2781,12 @@ void DomainMapper_Impl::handleToc } } } + else if (bTableOfFigures && xTOC.is()) + { + if (!sFigureSequence.isEmpty()) + xTOC->setPropertyValue(rPropNameSupplier.GetName(PROP_LABEL_CATEGORY), + uno::makeAny(sFigureSequence)); + } pContext->SetTOC( xTOC ); } @@ -3240,7 +3250,7 @@ void DomainMapper_Impl::CloseFieldCommand() // Take care of the numeric formatting definition, default is Arabic sal_Int16 nNumberingType = lcl_ParseNumberingType(pContext->GetCommand()); if (nNumberingType == style::NumberingType::PAGE_DESCRIPTOR) - nNumberingType == style::NumberingType::ARABIC; + nNumberingType = style::NumberingType::ARABIC; xFieldProperties->setPropertyValue( rPropNameSupplier.GetName(PROP_NUMBERING_TYPE), uno::makeAny(nNumberingType)); @@ -3387,8 +3397,13 @@ void DomainMapper_Impl::SetFieldResult( OUString& rResult ) // In case of SetExpression, the field result contains the content of the variable. uno::Reference<lang::XServiceInfo> xServiceInfo(xTextField, uno::UNO_QUERY); bool bIsSetExpression = xServiceInfo->supportsService("com.sun.star.text.TextField.SetExpression"); + // If we already have content set, then use the current presentation + rtl::OUString sValue; + uno::Any aValue = xFieldProperties->getPropertyValue( + rPropNameSupplier.GetName(PROP_CONTENT)); + aValue >>= sValue; xFieldProperties->setPropertyValue( - rPropNameSupplier.GetName(bIsSetExpression ? PROP_CONTENT : PROP_CURRENT_PRESENTATION), + rPropNameSupplier.GetName(bIsSetExpression && sValue.isEmpty()? PROP_CONTENT : PROP_CURRENT_PRESENTATION), uno::makeAny( rResult )); } } diff --git a/writerfilter/source/dmapper/PropertyIds.cxx b/writerfilter/source/dmapper/PropertyIds.cxx index dd57a8421283..5cbd552010de 100644 --- a/writerfilter/source/dmapper/PropertyIds.cxx +++ b/writerfilter/source/dmapper/PropertyIds.cxx @@ -326,6 +326,7 @@ const OUString& PropertyNameSupplier::GetName( PropertyIds eId ) const case PROP_GRAPHIC_URL: sName = "GraphicURL"; break; case PROP_GRAPHIC_BITMAP: sName = "GraphicBitmap"; break; case PROP_CHAR_SHADING_VALUE: sName = "CharShadingValue"; break; + case PROP_LABEL_CATEGORY: sName = "LabelCategory"; break; } ::std::pair<PropertyNameMap_t::iterator,bool> aInsertIt = m_pImpl->aNameMap.insert( PropertyNameMap_t::value_type( eId, sName )); diff --git a/writerfilter/source/dmapper/PropertyIds.hxx b/writerfilter/source/dmapper/PropertyIds.hxx index 1357c1db5312..a62ca59e1d7b 100644 --- a/writerfilter/source/dmapper/PropertyIds.hxx +++ b/writerfilter/source/dmapper/PropertyIds.hxx @@ -178,6 +178,7 @@ enum PropertyIds ,PROP_IS_SPLIT_ALLOWED ,PROP_IS_VISIBLE ,PROP_KEYWORDS + ,PROP_LABEL_CATEGORY ,PROP_LEFT_BORDER ,PROP_LEFT_BORDER_DISTANCE ,PROP_LEFT_MARGIN |