diff options
author | Cédric Bosdonnat <cedric.bosdonnat@free.fr> | 2013-07-04 15:45:01 +0200 |
---|---|---|
committer | Fridrich Strba <fridrich@documentfoundation.org> | 2013-07-08 09:05:19 +0000 |
commit | d532af592b98ccb7b9cdce59bd798063fcef8caa (patch) | |
tree | 3796276a292f57049fc797911a6f0e374cc96d94 | |
parent | 5a36fd99620aa1568e1140b5a78dc357390fba14 (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
Change-Id: I6fbd7cc38cf8ea7f08a0d15d1f39ffe4805dd62b
Reviewed-on: https://gerrit.libreoffice.org/4724
Reviewed-by: Fridrich Strba <fridrich@documentfoundation.org>
Tested-by: Fridrich Strba <fridrich@documentfoundation.org>
-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 b51ed29aa05e..2625b4f21827 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -2543,6 +2543,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 @@ -2557,6 +2559,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 )) @@ -2744,6 +2748,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 ); } @@ -3207,7 +3217,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)); @@ -3354,8 +3364,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 86438b9a6fc3..46a316cb31ac 100644 --- a/writerfilter/source/dmapper/PropertyIds.cxx +++ b/writerfilter/source/dmapper/PropertyIds.cxx @@ -324,6 +324,7 @@ const OUString& PropertyNameSupplier::GetName( PropertyIds eId ) const case PROP_IS_WIDTH_RELATIVE: sName = "IsWidthRelative"; break; case PROP_GRAPHIC_URL: sName = "GraphicURL"; break; case PROP_GRAPHIC_BITMAP: sName = "GraphicBitmap"; 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 3467321903a9..92d3928d8638 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 |