[Libreoffice-commits] core.git: writerfilter/source
Justin Luth
justin_luth at sil.org
Fri Jul 13 08:22:01 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 bc67bda7363df48f1983513a8e969b61738139f5
Author: Justin Luth <justin_luth at sil.org>
Date: Mon Jul 9 18:30:52 2018 +0300
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>
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 6b0663ad5d07..b1c26144ba90 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 188359b4b38a..ad1aa6e148b5 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 8f045b65102e..1d461401055e 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