writerfilter/source/dmapper/DomainMapper_Impl.cxx | 36 +++++++++++++++++++--- writerfilter/source/dmapper/PropertyIds.cxx | 1 writerfilter/source/dmapper/PropertyIds.hxx | 1 3 files changed, 34 insertions(+), 4 deletions(-)
New commits: commit 22a22a0983ec9c95e5b471395fc1c5bb813bd0d2 Author: Cédric Bosdonnat <cedric.bosdon...@free.fr> Date: Thu Jul 4 15:45:01 2013 +0200 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. Change-Id: I6fbd7cc38cf8ea7f08a0d15d1f39ffe4805dd62b diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index d0dc497..cb15550 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -2528,6 +2528,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 @@ -2542,6 +2544,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 )) @@ -2724,6 +2728,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 ); } @@ -3178,7 +3188,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)); @@ -3327,8 +3337,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 1d432fc..dda639c 100644 --- a/writerfilter/source/dmapper/PropertyIds.cxx +++ b/writerfilter/source/dmapper/PropertyIds.cxx @@ -322,6 +322,7 @@ const OUString& PropertyNameSupplier::GetName( PropertyIds eId ) const case PROP_SHADOW_FORMAT: sName = "ShadowFormat"; break; case PROP_RELATIVE_WIDTH: sName = "RelativeWidth"; break; case PROP_IS_WIDTH_RELATIVE: sName = "IsWidthRelative"; 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 c61283c..ba032a1 100644 --- a/writerfilter/source/dmapper/PropertyIds.hxx +++ b/writerfilter/source/dmapper/PropertyIds.hxx @@ -180,6 +180,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 commit 031ced0d1ade5350ef0b17a245a2cb5c76e6173d Author: Cédric Bosdonnat <cedric.bosdon...@free.fr> Date: Thu Jul 4 10:13:07 2013 +0200 n#825976: Added common flags support for SEQ field import Change-Id: I9a4505cf060880811abfe355b2ebf810cde9a4d6 diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 10ed343..d0dc497 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -3159,16 +3159,29 @@ void DomainMapper_Impl::CloseFieldCommand() xFieldInterface, uno::UNO_QUERY_THROW ); xDependentField->attachTextFieldMaster( xMaster ); - // TODO This formula may change with the flags of the SEQ field rtl::OUString sFormula = sIdentifier + "+1"; + rtl::OUString sValue; + if( lcl_FindInCommand( pContext->GetCommand(), 'c', sValue )) + { + sFormula = sIdentifier; + } + else if( lcl_FindInCommand( pContext->GetCommand(), 'r', sValue )) + { + sFormula = sValue; + } + // TODO \s isn't handled, but the spec isn't easy to understand without + // an example for this one. xFieldProperties->setPropertyValue( rPropNameSupplier.GetName(PROP_CONTENT), uno::makeAny(sFormula)); - // TODO Take care of the numeric formatting definition, default is Arabic + // 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; xFieldProperties->setPropertyValue( rPropNameSupplier.GetName(PROP_NUMBERING_TYPE), - uno::makeAny(style::NumberingType::ARABIC)); + uno::makeAny(nNumberingType)); } }
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits