[Libreoffice-commits] core.git: writerfilter/source

Miklos Vajna vmiklos at collabora.co.uk
Thu Oct 17 04:05:35 PDT 2013


 writerfilter/source/dmapper/StyleSheetTable.cxx |   28 +++++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)

New commits:
commit ab2c1321776e0b622c5f0747366bb0bfeb163cc5
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Thu Oct 17 13:02:29 2013 +0200

    writerfilter: fix default numbering style
    
    Change-Id: Ia019c93841043ac5d65e08ad17400acc27f82d6c

diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx b/writerfilter/source/dmapper/StyleSheetTable.cxx
index c3fd4a8..ab07e89 100644
--- a/writerfilter/source/dmapper/StyleSheetTable.cxx
+++ b/writerfilter/source/dmapper/StyleSheetTable.cxx
@@ -826,6 +826,31 @@ void StyleSheetTable::ApplyStyleSheets( FontTablePtr rFontTable )
                                         rPropNameSupplier.GetName( PROP_SERVICE_PARA_STYLE ) :
                                         (bListStyle ? OUString("com.sun.star.style.NumberingStyle") : rPropNameSupplier.GetName( PROP_SERVICE_CHAR_STYLE ))),
                                         uno::UNO_QUERY_THROW);
+
+                        // Numbering styles have to be inserted early, as e.g. the NumberingRules property is only available after insertion.
+                        if (bListStyle)
+                        {
+                            xStyles->insertByName( sConvertedStyleName, uno::makeAny( xStyle ) );
+                            xStyle.set(xStyles->getByName(sConvertedStyleName), uno::UNO_QUERY_THROW);
+
+                            StyleSheetPropertyMap* pPropertyMap = dynamic_cast<StyleSheetPropertyMap*>(pEntry->pProperties.get());
+                            if (pPropertyMap->GetListId() == -1)
+                            {
+                                // No properties? Word default is 'none', Writer one is 'arabic', handle this.
+                                uno::Reference<beans::XPropertySet> xPropertySet(xStyle, uno::UNO_QUERY_THROW);
+                                uno::Reference<container::XIndexReplace> xNumberingRules;
+                                xPropertySet->getPropertyValue("NumberingRules") >>= xNumberingRules;
+                                uno::Reference<container::XIndexAccess> xIndexAccess(xNumberingRules, uno::UNO_QUERY_THROW);
+                                for (sal_Int32 i = 0; i < xIndexAccess->getCount(); ++i)
+                                {
+                                    uno::Sequence< beans::PropertyValue > aLvlProps(1);
+                                    aLvlProps[0].Name = "NumberingType";
+                                    aLvlProps[0].Value <<= style::NumberingType::NUMBER_NONE;
+                                    xNumberingRules->replaceByIndex(i, uno::makeAny(aLvlProps));
+                                    xPropertySet->setPropertyValue("NumberingRules", uno::makeAny(xNumberingRules));
+                                }
+                            }
+                        }
                     }
                     if( !pEntry->sBaseStyleIdentifier.isEmpty() )
                     {
@@ -1015,7 +1040,8 @@ void StyleSheetTable::ApplyStyleSheets( FontTablePtr rFontTable )
                             OSL_FAIL( "Some style properties could not be set");
                         }
                     }
-                    if(bInsert)
+                    // Numbering style got inserted earlier.
+                    if(bInsert && !bListStyle)
                     {
                         xStyles->insertByName( sConvertedStyleName, uno::makeAny( xStyle) );
                     }


More information about the Libreoffice-commits mailing list