[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - writerfilter/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Jul 19 11:43:55 UTC 2018


 writerfilter/source/dmapper/DomainMapper_Impl.cxx |    8 +++-----
 writerfilter/source/dmapper/StyleSheetTable.cxx   |   13 ++-----------
 writerfilter/source/dmapper/StyleSheetTable.hxx   |    4 ++--
 3 files changed, 7 insertions(+), 18 deletions(-)

New commits:
commit d3ecf6070b439e902343a2a83bc9384382e41fee
Author:     Justin Luth <justin_luth at sil.org>
AuthorDate: Mon Jul 9 18:30:52 2018 +0300
Commit:     Miklos Vajna <vmiklos at collabora.co.uk>
CommitDate: Thu Jul 19 13:43:32 2018 +0200

    related tdf#106174 writerfilter: replace broken FindParentStyleSheet
    
    FindParentStyleSheet didn't do anything right. An empty stylename
    was supposed to check currentEntry, but instead it just returned
    null. The passed stylename was completely ignored if there was
    a currentEntry. And on top of that, the stylename itself was
    returned, not its parent. Even worse, the currentEntry properties
    were ignored because in that case it DID return the parent.
    Even the comments were totally bogus. Amazing...
    
    GetPropertyFromStyleSheet() has the potential for LOTS of use
    in writerfilter. I'm surprised it has hardly been used. Perhaps
    the completely wrong results led people to ignore it rather than
    investigate why it didn't give the expected results.
    
    Change-Id: I89a6b02877ab7990aa4eb58e5e0b6a572f3d10e3
    Reviewed-on: https://gerrit.libreoffice.org/57195
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <justin_luth at sil.org>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    (cherry picked from commit bc67bda7363df48f1983513a8e969b61738139f5)
    Reviewed-on: https://gerrit.libreoffice.org/57483

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 6521a08d0445..8a9c038d8c2f 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -660,19 +660,17 @@ const OUString DomainMapper_Impl::GetCurrentParaStyleName()
 }
 
 /*-------------------------------------------------------------------------
-    returns a the value from the current paragraph style - if available
-    TODO: What about parent styles?
+    returns the value from the current paragraph style - if available
   -----------------------------------------------------------------------*/
 uno::Any DomainMapper_Impl::GetPropertyFromStyleSheet(PropertyIds eId)
 {
     StyleSheetEntryPtr pEntry;
     if( m_bInStyleSheetImport )
-        pEntry = GetStyleSheetTable()->FindParentStyleSheet(OUString());
+        pEntry = GetStyleSheetTable()->GetCurrentEntry();
     else
         pEntry = GetStyleSheetTable()->FindStyleSheetByConvertedStyleName(GetCurrentParaStyleName());
     while(pEntry.get( ) )
     {
-        //is there a tab stop set?
         if(pEntry->pProperties)
         {
             boost::optional<PropertyMap::Property> aProperty =
@@ -683,7 +681,7 @@ uno::Any DomainMapper_Impl::GetPropertyFromStyleSheet(PropertyIds eId)
             }
         }
         //search until the property is set or no parent is available
-        StyleSheetEntryPtr pNewEntry = GetStyleSheetTable()->FindParentStyleSheet(pEntry->sBaseStyleIdentifier);
+        StyleSheetEntryPtr pNewEntry = GetStyleSheetTable()->FindStyleSheetByISTD(pEntry->sBaseStyleIdentifier);
 
         SAL_WARN_IF( pEntry == pNewEntry, "writerfilter.dmapper", "circular loop in style hierarchy?");
 
diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx b/writerfilter/source/dmapper/StyleSheetTable.cxx
index 69a03c6e8ea0..2aa8bd4d5caa 100644
--- a/writerfilter/source/dmapper/StyleSheetTable.cxx
+++ b/writerfilter/source/dmapper/StyleSheetTable.cxx
@@ -1280,18 +1280,9 @@ const StyleSheetEntryPtr StyleSheetTable::FindDefaultParaStyle()
     return pRet;
 }
 
-const StyleSheetEntryPtr StyleSheetTable::FindParentStyleSheet(const OUString& _sBaseStyle)
+const StyleSheetEntryPtr StyleSheetTable::GetCurrentEntry()
 {
-    if( _sBaseStyle.isEmpty() )
-    {
-        StyleSheetEntryPtr pEmptyPtr;
-        return pEmptyPtr;
-    }
-    OUString sBaseStyle = _sBaseStyle;
-    if( m_pImpl->m_pCurrentEntry)
-        sBaseStyle = m_pImpl->m_pCurrentEntry->sBaseStyleIdentifier;
-
-    return FindStyleSheetByISTD( sBaseStyle );
+    return m_pImpl->m_pCurrentEntry;
 }
 
 
diff --git a/writerfilter/source/dmapper/StyleSheetTable.hxx b/writerfilter/source/dmapper/StyleSheetTable.hxx
index dc1f0acf3eb5..5191d0a44386 100644
--- a/writerfilter/source/dmapper/StyleSheetTable.hxx
+++ b/writerfilter/source/dmapper/StyleSheetTable.hxx
@@ -92,8 +92,6 @@ public:
     const StyleSheetEntryPtr FindStyleSheetByISTD(const OUString& sIndex);
     const StyleSheetEntryPtr FindStyleSheetByConvertedStyleName(const OUString& rIndex);
     const StyleSheetEntryPtr FindDefaultParaStyle();
-    // returns the parent of the one with the given name - if empty the parent of the current style sheet is returned
-    const StyleSheetEntryPtr FindParentStyleSheet(const OUString& sBaseStyle);
 
     OUString ConvertStyleName( const OUString& rWWName, bool bExtendedSearch = false );
 
@@ -102,6 +100,8 @@ public:
     /// Returns the default character properties.
     PropertyMapPtr const & GetDefaultCharProps();
 
+    const StyleSheetEntryPtr GetCurrentEntry();
+
 private:
     // Properties
     virtual void lcl_attribute(Id Name, Value & val) override;


More information about the Libreoffice-commits mailing list