writerfilter/source/dmapper/DomainMapper_Impl.cxx | 46 ++++++++++++++++++++-- writerfilter/source/dmapper/PropertyIds.cxx | 1 writerfilter/source/dmapper/PropertyIds.hxx | 1 3 files changed, 44 insertions(+), 4 deletions(-)
New commits: commit c7e4264bed4e77daccf2f72063e5e00f1008c3cf 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. (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 diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 44c0a7a..871b0cf 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 dd57a84..5cbd552 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 1357c1d..a62ca59 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 commit 5743211f8b5f1d68b746b462942210ef69565960 Author: Cédric Bosdonnat <cedric.bosdon...@free.fr> Date: Wed Jul 3 17:43:33 2013 +0200 n#825976: Added common flags support for SEQ field import (cherry picked from commit 031ced0d1ade5350ef0b17a245a2cb5c76e6173d) Conflicts: writerfilter/source/dmapper/DomainMapper_Impl.cxx Change-Id: I9a4505cf060880811abfe355b2ebf810cde9a4d6 diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index ded3f89..44c0a7a 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -3220,6 +3220,30 @@ void DomainMapper_Impl::CloseFieldCommand() // attach the master to the field uno::Reference< text::XDependentTextField > xDependentField( xFieldInterface, uno::UNO_QUERY_THROW ); xDependentField->attachTextFieldMaster( xMaster ); + + 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)); + + // 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(nNumberingType)); } break; case FIELD_SET : break; @@ -3297,15 +3321,14 @@ void DomainMapper_Impl::CloseFieldCommand() rPropNameSupplier.GetName(PROP_NUMBERING_TYPE), uno::makeAny( lcl_ParseNumberingType(pContext->GetCommand()) )); break; - } } //set the text field if there is any pContext->SetTextField( uno::Reference< text::XTextField >( xFieldInterface, uno::UNO_QUERY ) ); } - catch( const uno::Exception& ) + catch( const uno::Exception& e ) { - OSL_FAIL( "Exception in CloseFieldCommand()" ); + SAL_WARN( "writerfilter", "Exception in CloseFieldCommand(): " << e.Message ); } pContext->SetCommandCompleted(); }
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits