summaryrefslogtreecommitdiff
path: root/writerfilter/source/dmapper/DomainMapper_Impl.cxx
diff options
context:
space:
mode:
authorCédric Bosdonnat <cedric.bosdonnat@free.fr>2013-07-04 15:45:01 +0200
committerFridrich Strba <fridrich@documentfoundation.org>2013-07-08 09:05:19 +0000
commitd532af592b98ccb7b9cdce59bd798063fcef8caa (patch)
tree3796276a292f57049fc797911a6f0e374cc96d94 /writerfilter/source/dmapper/DomainMapper_Impl.cxx
parent5a36fd99620aa1568e1140b5a78dc357390fba14 (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>
Diffstat (limited to 'writerfilter/source/dmapper/DomainMapper_Impl.cxx')
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.cxx19
1 files changed, 17 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 ));
}
}