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

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


 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   37 +++++++++++++++++++---
 1 file changed, 33 insertions(+), 4 deletions(-)

New commits:
commit 4967809914871066acda64c28704e74e7047e76f
Author: Cédric Bosdonnat <cedric.bosdonnat at free.fr>
Date:   Wed Jul 3 17:43:33 2013 +0200

    n#825976: writerfilter initial support of SEQ fields
    
    No switch and no numeric formatting is taken into account ATM, just the
    defaults, but at least we have the fields properly created.
    
    Change-Id: Ib17c5e93199044a05005e4648c7e4cc81baf51dd
    (cherry picked from commit 94a9bce4fb61aeeece8809eec1cbdc37101bdd22)
    Reviewed-on: https://gerrit.libreoffice.org/4720
    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 48e40dea..66d68dd 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -3116,7 +3116,37 @@ void DomainMapper_Impl::CloseFieldCommand()
                     break;
                     case FIELD_SECTION      : break;
                     case FIELD_SECTIONPAGES : break;
-                    case FIELD_SEQ          : break;
+                    case FIELD_SEQ          :
+                    {
+                        OUString sIdentifier = lcl_ExtractParameter(pContext->GetCommand(), sizeof(" SEQ") );
+                        if (xFieldProperties.is() && !sIdentifier.isEmpty())
+                        {
+                            uno::Reference< beans::XPropertySet >xMaster = FindOrCreateFieldMaster(
+                                    "com.sun.star.text.fieldmaster.SetExpression", sIdentifier);
+
+                            // SubType 1 makes the difference between range and normal SetExpression
+                            xMaster->setPropertyValue(
+                                    rPropNameSupplier.GetName(PROP_SUB_TYPE),
+                                    uno::makeAny(sal_Int8(1)));
+
+                            uno::Reference< text::XDependentTextField > xDependentField(
+                                    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";
+                            xFieldProperties->setPropertyValue(
+                                    rPropNameSupplier.GetName(PROP_CONTENT),
+                                    uno::makeAny(sFormula));
+
+                            // TODO Take care of the numeric formatting definition, default is Arabic
+                            xFieldProperties->setPropertyValue(
+                                    rPropNameSupplier.GetName(PROP_NUMBERING_TYPE),
+                                    uno::makeAny(style::NumberingType::ARABIC));
+                        }
+
+                    }
+                    break;
                     case FIELD_SET          : break;
                     case FIELD_SKIPIF       : break;
                     case FIELD_STYLEREF     : break;
@@ -3192,15 +3222,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();
     }


More information about the Libreoffice-commits mailing list