[Libreoffice-commits] core.git: 4 commits - sw/qa writerfilter/source
Jan Holesovsky
kendy at collabora.com
Thu Sep 19 05:52:49 PDT 2013
sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 9 +++++++++
writerfilter/source/dmapper/StyleSheetTable.cxx | 15 +++++++--------
2 files changed, 16 insertions(+), 8 deletions(-)
New commits:
commit f0e3c542ac88459d946b4f9cb8af69889f918a03
Author: Jan Holesovsky <kendy at collabora.com>
Date: Thu Sep 19 14:49:48 2013 +0200
DOCX styles: Unit test for <w:next> style handling.
[covers both problems fixed in the previous commits.]
Change-Id: I3df3537c52e2f6ebcb60a38f3648a35a5eca9051
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 47b6318..62398ca 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -1367,6 +1367,15 @@ void Test::testStyleInheritance()
// Check that we do _not_ export w:next for styles that point to themselves.
assertXPath(pXmlStyles, "/w:styles/w:style[1]/w:next", 0);
+
+ // Check that we roundtrip <w:next> correctly - on XML level
+ assertXPath(pXmlStyles, "/w:styles/w:style[2]/w:next", "val", "Normal");
+ // And to be REALLY sure, check it on the API level too ;-)
+ uno::Reference< container::XNameAccess > paragraphStyles = getStyles("ParagraphStyles");
+ uno::Reference< beans::XPropertySet > properties(paragraphStyles->getByName("Heading 1"), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(OUString("Standard"), getProperty<OUString>(properties, "FollowStyle"));
+ properties = uno::Reference< beans::XPropertySet >(paragraphStyles->getByName("Heading 11"), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(OUString("Heading 1"), getProperty<OUString>(properties, "FollowStyle"));
}
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
commit 3c2c2692b0cfe376e2d14f33796ec10e924342b9
Author: Jan Holesovsky <kendy at collabora.com>
Date: Thu Sep 19 14:40:58 2013 +0200
DOCX styles: Another fix in <w:next> style handling.
Compare styleId against styleId, not style name against styleId.
Change-Id: I42bbb8a04424780772065585cc8ff56d906a48e4
diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx b/writerfilter/source/dmapper/StyleSheetTable.cxx
index 30e1c81..9a419a6 100644
--- a/writerfilter/source/dmapper/StyleSheetTable.cxx
+++ b/writerfilter/source/dmapper/StyleSheetTable.cxx
@@ -894,7 +894,7 @@ void StyleSheetTable::ApplyStyleSheets( FontTablePtr rFontTable )
std::vector< StyleSheetEntryPtr >::iterator it = m_pImpl->m_aStyleSheetEntries.begin();
for (; it != m_pImpl->m_aStyleSheetEntries.end(); ++it)
{
- if (!(*it)->sStyleName.isEmpty() && (*it)->sStyleName == pEntry->sNextStyleIdentifier)
+ if (!(*it)->sStyleName.isEmpty() && (*it)->sStyleIdentifierD == pEntry->sNextStyleIdentifier)
{
beans::PropertyValue aNew;
aNew.Name = "FollowStyle";
commit 909c82d8972d223abace208d3b768916be2e046a
Author: Jan Holesovsky <kendy at collabora.com>
Date: Thu Sep 19 14:37:33 2013 +0200
Improve readability.
Change-Id: Iacb9b09f237ddab3d68f4993014efb3b4793b8e7
diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx b/writerfilter/source/dmapper/StyleSheetTable.cxx
index 19eba619..30e1c81 100644
--- a/writerfilter/source/dmapper/StyleSheetTable.cxx
+++ b/writerfilter/source/dmapper/StyleSheetTable.cxx
@@ -891,16 +891,15 @@ void StyleSheetTable::ApplyStyleSheets( FontTablePtr rFontTable )
if(bAddFollowStyle)
{
//find the name of the Next style
- std::vector< StyleSheetEntryPtr >::iterator aNextStyleIt = m_pImpl->m_aStyleSheetEntries.begin();
- for( ; aNextStyleIt != m_pImpl->m_aStyleSheetEntries.end(); ++aNextStyleIt )
+ std::vector< StyleSheetEntryPtr >::iterator it = m_pImpl->m_aStyleSheetEntries.begin();
+ for (; it != m_pImpl->m_aStyleSheetEntries.end(); ++it)
{
- if( !( *aNextStyleIt )->sStyleName.isEmpty() &&
- ( *aNextStyleIt )->sStyleName == pEntry->sNextStyleIdentifier)
+ if (!(*it)->sStyleName.isEmpty() && (*it)->sStyleName == pEntry->sNextStyleIdentifier)
{
beans::PropertyValue aNew;
aNew.Name = "FollowStyle";
- aNew.Value = uno::makeAny(ConvertStyleName( ( *aNextStyleIt )->sStyleIdentifierD ));
- aSortedPropVals.Insert( aNew );
+ aNew.Value = uno::makeAny(ConvertStyleName((*it)->sStyleIdentifierD));
+ aSortedPropVals.Insert(aNew);
break;
}
}
commit 20d87b81dc7f80c8b5f31c6b6f1841937d362d35
Author: Jan Holesovsky <kendy at collabora.com>
Date: Thu Sep 19 14:02:04 2013 +0200
DOCX styles: Fix the reading of <w:next> style.
Wow, has been broken like this since 2007...
Change-Id: I32a84e1444ed6fd89161f2060a35296044516863
diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx b/writerfilter/source/dmapper/StyleSheetTable.cxx
index 7b385d8..19eba619 100644
--- a/writerfilter/source/dmapper/StyleSheetTable.cxx
+++ b/writerfilter/source/dmapper/StyleSheetTable.cxx
@@ -796,9 +796,9 @@ void StyleSheetTable::ApplyStyleSheets( FontTablePtr rFontTable )
uno::Sequence< beans::PropertyValue > aPropValues = pEntry->pProperties->GetPropertyValues();
bool bAddFollowStyle = false;
- if(bParaStyle && pEntry->sNextStyleIdentifier.isEmpty() )
+ if(bParaStyle && !pEntry->sNextStyleIdentifier.isEmpty() )
{
- bAddFollowStyle = true;
+ bAddFollowStyle = true;
}
// remove Left/RightMargin values from TOX heading styles
More information about the Libreoffice-commits
mailing list