[Libreoffice-commits] core.git: 3 commits - sw/inc sw/qa writerfilter/inc writerfilter/source
Miklos Vajna
vmiklos at collabora.co.uk
Thu Jul 17 06:30:44 PDT 2014
sw/inc/fmtclbl.hxx | 1 +
sw/qa/extras/inc/swmodeltestbase.hxx | 3 +++
sw/qa/extras/ooxmlimport/data/unbalanced-columns.docx |binary
sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 10 ++++++++--
writerfilter/inc/dmapper/DomainMapper.hxx | 1 +
writerfilter/inc/resourcemodel/WW8ResourceModel.hxx | 3 +++
writerfilter/source/dmapper/DomainMapper.cxx | 5 +++++
writerfilter/source/dmapper/DomainMapper_Impl.cxx | 6 ++++++
writerfilter/source/dmapper/DomainMapper_Impl.hxx | 3 +++
writerfilter/source/dmapper/PropertyMap.cxx | 9 ++++++---
writerfilter/source/dmapper/PropertyMap.hxx | 2 +-
writerfilter/source/ooxml/OOXMLFastContextHandler.cxx | 5 +++++
writerfilter/source/ooxml/OOXMLFastContextHandler.hxx | 1 +
writerfilter/source/ooxml/model.xml | 1 +
14 files changed, 44 insertions(+), 6 deletions(-)
New commits:
commit 5f7bba13a7bd35f3861f9c6ed75e7b1c539c7367
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Thu Jul 17 15:17:08 2014 +0200
CppunitTest_sw_ooxmlimport: allow running a single test
Change-Id: I494cc676f384edbac9f64c1bc02b14cf7973d0d8
diff --git a/sw/qa/extras/inc/swmodeltestbase.hxx b/sw/qa/extras/inc/swmodeltestbase.hxx
index 8ede21a..43e6d7e 100644
--- a/sw/qa/extras/inc/swmodeltestbase.hxx
+++ b/sw/qa/extras/inc/swmodeltestbase.hxx
@@ -79,15 +79,18 @@ using namespace css;
void TestName::verify()
#if 1
+#define DECLARE_OOXMLIMPORT_TEST(TestName, filename) DECLARE_SW_IMPORT_TEST(TestName, filename, Test)
#define DECLARE_OOXMLEXPORT_TEST(TestName, filename) DECLARE_SW_ROUNDTRIP_TEST(TestName, filename, Test)
// For testing during development of a test, you want to use
// DECLARE_OOXMLEXPORT_TEST_ONLY, and change the above to #if 0
// Of course, don't forget to set back to #if 1 when you are done :-)
#else
+#define DECLARE_OOXMLIMPORT_TEST_ONLY(TestName, filename) DECLARE_SW_IMPORT_TEST(TestName, filename, Test)
#define DECLARE_OOXMLEXPORT_TEST_ONLY(TestName, filename) DECLARE_SW_ROUNDTRIP_TEST(TestName, filename, Test)
#undef DECLARE_OOXMLEXPORT_TEST
+#define DECLARE_OOXMLIMPORT_TEST(TestName, filename) class disabled##TestName : public Test { void disabled(); }; void disabled##TestName::disabled()
#define DECLARE_OOXMLEXPORT_TEST(TestName, filename) class disabled##TestName : public Test { void disabled(); }; void disabled##TestName::disabled()
#endif
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 4f63183..9de6c29 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -83,8 +83,6 @@ public:
}
};
-#define DECLARE_OOXMLIMPORT_TEST(TestName, filename) DECLARE_SW_IMPORT_TEST(TestName, filename, Test)
-
DECLARE_OOXMLIMPORT_TEST(testN751054, "n751054.docx")
{
text::TextContentAnchorType eValue = getProperty<text::TextContentAnchorType>(getShape(1), "AnchorType");
commit d185204737031955c56a24356ed003d342548434
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Thu Jul 17 14:59:19 2014 +0200
DOCX import: set DontBalanceTextColumns=true for the last section ...
... if it has multiple columns.
See wwSectionManager::InsertSegments() for the related binary import
code which already did this.
Change-Id: I919f585bd864db748cd349e01789ec7805f031a1
diff --git a/sw/qa/extras/ooxmlimport/data/unbalanced-columns.docx b/sw/qa/extras/ooxmlimport/data/unbalanced-columns.docx
new file mode 100755
index 0000000..da6f93f
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/unbalanced-columns.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index efbfebb..4f63183 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -2276,6 +2276,14 @@ DECLARE_OOXMLIMPORT_TEST(testFdo76803, "fdo76803.docx")
CPPUNIT_ASSERT_EQUAL(double(0), aPolygon.getB2DPoint(3).getY());
}
+DECLARE_OOXMLIMPORT_TEST(testUnbalancedColumns, "unbalanced-columns.docx")
+{
+ uno::Reference<text::XTextSectionsSupplier> xTextSectionsSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xTextSections(xTextSectionsSupplier->getTextSections(), uno::UNO_QUERY);
+ // This was false, last section was balanced, but it's unbalanced in Word.
+ CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(xTextSections->getByIndex(2), "DontBalanceTextColumns"));
+}
+
#endif
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/inc/dmapper/DomainMapper.hxx b/writerfilter/inc/dmapper/DomainMapper.hxx
index 9266f08..7143219 100644
--- a/writerfilter/inc/dmapper/DomainMapper.hxx
+++ b/writerfilter/inc/dmapper/DomainMapper.hxx
@@ -87,6 +87,7 @@ public:
// Stream
virtual void markLastParagraphInSection() SAL_OVERRIDE;
+ virtual void markLastSectionGroup() SAL_OVERRIDE;
// BinaryObj
virtual void data(const sal_uInt8* buf, size_t len,
diff --git a/writerfilter/inc/resourcemodel/WW8ResourceModel.hxx b/writerfilter/inc/resourcemodel/WW8ResourceModel.hxx
index d991a23..81209c0 100644
--- a/writerfilter/inc/resourcemodel/WW8ResourceModel.hxx
+++ b/writerfilter/inc/resourcemodel/WW8ResourceModel.hxx
@@ -197,6 +197,9 @@ public:
*/
virtual void endSectionGroup() = 0;
+ /// The current section is the last one in this body text.
+ virtual void markLastSectionGroup( ) { };
+
/**
Receives start mark for group with the same paragraph properties.
*/
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index df682c7..f007457 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -2594,6 +2594,11 @@ void DomainMapper::markLastParagraphInSection( )
m_pImpl->SetIsLastParagraphInSection( true );
}
+void DomainMapper::markLastSectionGroup( )
+{
+ m_pImpl->SetIsLastSectionGroup( true );
+}
+
void DomainMapper::lcl_startShape( uno::Reference< drawing::XShape > xShape )
{
if (m_pImpl->GetTopContext())
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index d3c5d75..9d17160 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -188,6 +188,7 @@ DomainMapper_Impl::DomainMapper_Impl(
m_bDummyParaAddedForTableInSection( false ),
m_bTextFrameInserted(false),
m_bIsLastParaInSection( false ),
+ m_bIsLastSectionGroup( false ),
m_bIsInComments( false ),
m_bParaSectpr( false ),
m_bUsingEnhancedFields( false ),
@@ -402,6 +403,11 @@ void DomainMapper_Impl::SetSymbolData( sal_Int32 nSymbolData )
}
+void DomainMapper_Impl::SetIsLastSectionGroup( bool bIsLast )
+{
+ m_bIsLastSectionGroup = bIsLast;
+}
+
void DomainMapper_Impl::SetIsLastParagraphInSection( bool bIsLast )
{
m_bIsLastParaInSection = bIsLast;
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
index f374ede..39cc154 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
@@ -390,6 +390,7 @@ private:
bool m_bDummyParaAddedForTableInSection;
bool m_bTextFrameInserted;
bool m_bIsLastParaInSection;
+ bool m_bIsLastSectionGroup;
bool m_bIsInComments;
/// If the current paragraph contains section property definitions.
bool m_bParaSectpr;
@@ -469,6 +470,8 @@ public:
void RemoveLastParagraph( );
void SetIsLastParagraphInSection( bool bIsLast );
bool GetIsLastParagraphInSection() { return m_bIsLastParaInSection;}
+ void SetIsLastSectionGroup( bool bIsLast );
+ bool GetIsLastSectionGroup() { return m_bIsLastSectionGroup;}
void SetIsFirstParagraphInSection( bool bIsFirst );
bool GetIsFirstParagraphInSection() { return m_bIsFirstParaInSection;}
void SetIsDummyParaAddedForTableInSection( bool bIsAdded );
diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx
index ff76c13..44a8168 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -607,7 +607,7 @@ void SectionPropertyMap::SetBorderDistance( uno::Reference< beans::XPropertySet
uno::Reference< text::XTextColumns > SectionPropertyMap::ApplyColumnProperties(
- uno::Reference< beans::XPropertySet > xColumnContainer )
+ uno::Reference< beans::XPropertySet > xColumnContainer, bool bLast )
{
uno::Reference< text::XTextColumns > xColumns;
try
@@ -659,6 +659,8 @@ uno::Reference< text::XTextColumns > SectionPropertyMap::ApplyColumnProperties(
rPropNameSupplier.GetName( PROP_SEPARATOR_LINE_IS_ON ),
uno::makeAny( m_bSeparatorLineIsOn ));
xColumnContainer->setPropertyValue( sTextColumns, uno::makeAny( xColumns ) );
+ if (bLast)
+ xColumnContainer->setPropertyValue("DontBalanceTextColumns", uno::makeAny(true));
}
catch( const uno::Exception& )
{
@@ -954,7 +956,7 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl )
uno::Reference< beans::XPropertySet > xSection =
rDM_Impl.appendTextSectionAfter( m_xStartingRange );
if( m_nColumnCount > 0 && xSection.is())
- ApplyColumnProperties( xSection );
+ ApplyColumnProperties( xSection, rDM_Impl.GetIsLastSectionGroup() );
uno::Reference<beans::XPropertySet> xRangeProperties(lcl_GetRangeProperties(m_bIsFirstSection, rDM_Impl, m_xStartingRange));
if (xRangeProperties.is())
{
@@ -1010,7 +1012,7 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl )
}
uno::Reference< text::XTextColumns > xColumns;
if( m_nColumnCount > 0 )
- xColumns = ApplyColumnProperties( xFollowPageStyle );
+ xColumns = ApplyColumnProperties( xFollowPageStyle, rDM_Impl.GetIsLastSectionGroup() );
//prepare text grid properties
sal_Int32 nHeight = 1;
@@ -1183,6 +1185,7 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl )
OSL_FAIL( "Exception in SectionPropertyMap::CloseSectionGroup");
}
}
+ rDM_Impl.SetIsLastSectionGroup(false);
rDM_Impl.SetIsFirstParagraphInSection(true);
}
diff --git a/writerfilter/source/dmapper/PropertyMap.hxx b/writerfilter/source/dmapper/PropertyMap.hxx
index 5fd0094..59a6559 100644
--- a/writerfilter/source/dmapper/PropertyMap.hxx
+++ b/writerfilter/source/dmapper/PropertyMap.hxx
@@ -203,7 +203,7 @@ class SectionPropertyMap : public PropertyMap
void _ApplyProperties( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xStyle );
::com::sun::star::uno::Reference< com::sun::star::text::XTextColumns > ApplyColumnProperties(
- ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xFollowPageStyle );
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xFollowPageStyle, bool bLast );
void CopyLastHeaderFooter( bool bFirstPage, DomainMapper_Impl& rDM_Impl );
void PrepareHeaderFooterProperties( bool bFirstPage );
bool HasHeader( bool bFirstPage ) const;
diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
index f5b7c47..c66d190 100644
--- a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
+++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
@@ -592,6 +592,11 @@ void OOXMLFastContextHandler::setLastParagraphInSection()
mpStream->markLastParagraphInSection( );
}
+void OOXMLFastContextHandler::setLastSectionGroup()
+{
+ mpStream->markLastSectionGroup( );
+}
+
void OOXMLFastContextHandler::newProperty
(const Id & /*nId*/, OOXMLValue::Pointer_t /*pVal*/)
{
diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx
index eb315cf..6f07c33 100644
--- a/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx
+++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx
@@ -171,6 +171,7 @@ public:
void startSectionGroup();
void setLastParagraphInSection();
+ void setLastSectionGroup();
void endSectionGroup();
void startParagraphGroup();
void endParagraphGroup();
diff --git a/writerfilter/source/ooxml/model.xml b/writerfilter/source/ooxml/model.xml
index 9fab627..0a5881b 100644
--- a/writerfilter/source/ooxml/model.xml
+++ b/writerfilter/source/ooxml/model.xml
@@ -25868,6 +25868,7 @@
-->
<action name="end" action="endCharacterGroup"/>
<action name="end" action="endParagraphGroup"/>
+ <action name="end" action="setLastSectionGroup"/>
<action name="end" action="endSectionGroup"/>
</resource>
<resource xmlns:v="urn:schemas-microsoft-com:vml" name="CT_ShapeDefaults" resource="Properties">
commit 256281d8e6259dc1a71624b0f8576e9deb9cdc65
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Thu Jul 17 12:18:51 2014 +0200
SwFmtNoBalancedColumns: add doxygen comment
Change-Id: Ifc538d8a51a333e79cec0312ab8cf4541abba7af
diff --git a/sw/inc/fmtclbl.hxx b/sw/inc/fmtclbl.hxx
index 6819f36..a524363 100644
--- a/sw/inc/fmtclbl.hxx
+++ b/sw/inc/fmtclbl.hxx
@@ -24,6 +24,7 @@
#include <format.hxx>
#include "swdllapi.h"
+/// If text in multi-column sections should be evenly distributed.
class SW_DLLPUBLIC SwFmtNoBalancedColumns : public SfxBoolItem
{
public:
More information about the Libreoffice-commits
mailing list