[Libreoffice-commits] core.git: Branch 'distro/suse/suse-4.0' - writerfilter/source

Cédric Bosdonnat cedric.bosdonnat at free.fr
Wed Jul 3 08:49:06 PDT 2013


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

New commits:
commit 94a9bce4fb61aeeece8809eec1cbdc37101bdd22
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

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 0cd81c3..10ed343 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -3142,7 +3142,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;
@@ -3218,15 +3248,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