[Libreoffice-commits] core.git: Branch 'libreoffice-4-0' - writerfilter/source

Cédric Bosdonnat cedric.bosdonnat at free.fr
Mon Jul 8 02:03:37 PDT 2013


 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   19 +++++++++++++++++--
 writerfilter/source/dmapper/PropertyIds.cxx       |    1 +
 writerfilter/source/dmapper/PropertyIds.hxx       |    1 +
 3 files changed, 19 insertions(+), 2 deletions(-)

New commits:
commit b86fe11a8374e9b1cb6b0f5326b5f13b1a61b78b
Author: Cédric Bosdonnat <cedric.bosdonnat at 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/PropertyIds.cxx
    
    Change-Id: I6fbd7cc38cf8ea7f08a0d15d1f39ffe4805dd62b
    Reviewed-on: https://gerrit.libreoffice.org/4722
    Reviewed-by: Fridrich Strba <fridrich at documentfoundation.org>
    Tested-by: Fridrich Strba <fridrich at documentfoundation.org>

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 56740bd..c4b4697 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -2502,6 +2502,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
@@ -2516,6 +2518,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 ))
@@ -2698,6 +2702,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 );
 }
 
@@ -3152,7 +3162,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));
@@ -3301,8 +3311,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 1fbf3d1..1862bf7 100644
--- a/writerfilter/source/dmapper/PropertyIds.cxx
+++ b/writerfilter/source/dmapper/PropertyIds.cxx
@@ -320,6 +320,7 @@ const OUString& PropertyNameSupplier::GetName( PropertyIds eId ) const
             case PROP_EMBED_FONTS: sName = "EmbedFonts"; break;
             case PROP_EMBED_SYSTEM_FONTS: sName = "EmbedSystemFonts"; break;
             case PROP_SHADOW_FORMAT: sName = "ShadowFormat"; 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 b29d760..b5a83ec 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


More information about the Libreoffice-commits mailing list