Kaydet (Commit) 9da4fe80 authored tarafından Miklos Vajna's avatar Miklos Vajna

DOCX import: handle <w:noColumnBalance> compat setting

Change-Id: Ieffd1fe52d6167d84ada5ebb11686f20d6dce8fa
üst 5748a5ab
...@@ -2282,6 +2282,14 @@ DECLARE_OOXMLIMPORT_TEST(testUnbalancedColumns, "unbalanced-columns.docx") ...@@ -2282,6 +2282,14 @@ DECLARE_OOXMLIMPORT_TEST(testUnbalancedColumns, "unbalanced-columns.docx")
CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(xTextSections->getByIndex(2), "DontBalanceTextColumns")); CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(xTextSections->getByIndex(2), "DontBalanceTextColumns"));
} }
DECLARE_OOXMLIMPORT_TEST(testUnbalancedColumnsCompat, "unbalanced-columns-compat.docx")
{
uno::Reference<text::XTextSectionsSupplier> xTextSectionsSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xTextSections(xTextSectionsSupplier->getTextSections(), uno::UNO_QUERY);
// This was false, we ignored the relevant compat setting to make this non-last section unbalanced.
CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(xTextSections->getByIndex(0), "DontBalanceTextColumns"));
}
#endif #endif
CPPUNIT_PLUGIN_IMPLEMENT(); CPPUNIT_PLUGIN_IMPLEMENT();
......
...@@ -607,7 +607,7 @@ void SectionPropertyMap::SetBorderDistance( uno::Reference< beans::XPropertySet ...@@ -607,7 +607,7 @@ void SectionPropertyMap::SetBorderDistance( uno::Reference< beans::XPropertySet
uno::Reference< text::XTextColumns > SectionPropertyMap::ApplyColumnProperties( uno::Reference< text::XTextColumns > SectionPropertyMap::ApplyColumnProperties(
uno::Reference< beans::XPropertySet > xColumnContainer, bool bLast ) uno::Reference< beans::XPropertySet > xColumnContainer, DomainMapper_Impl& rDM_Impl )
{ {
uno::Reference< text::XTextColumns > xColumns; uno::Reference< text::XTextColumns > xColumns;
try try
...@@ -659,7 +659,8 @@ uno::Reference< text::XTextColumns > SectionPropertyMap::ApplyColumnProperties( ...@@ -659,7 +659,8 @@ uno::Reference< text::XTextColumns > SectionPropertyMap::ApplyColumnProperties(
rPropNameSupplier.GetName( PROP_SEPARATOR_LINE_IS_ON ), rPropNameSupplier.GetName( PROP_SEPARATOR_LINE_IS_ON ),
uno::makeAny( m_bSeparatorLineIsOn )); uno::makeAny( m_bSeparatorLineIsOn ));
xColumnContainer->setPropertyValue( sTextColumns, uno::makeAny( xColumns ) ); xColumnContainer->setPropertyValue( sTextColumns, uno::makeAny( xColumns ) );
if (bLast) // Set the columns to be unbalanced if that compatability option is set or this is the last section.
if (rDM_Impl.GetSettingsTable()->GetNoColumnBalance() || rDM_Impl.GetIsLastSectionGroup())
xColumnContainer->setPropertyValue("DontBalanceTextColumns", uno::makeAny(true)); xColumnContainer->setPropertyValue("DontBalanceTextColumns", uno::makeAny(true));
} }
catch( const uno::Exception& ) catch( const uno::Exception& )
...@@ -956,7 +957,7 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl ) ...@@ -956,7 +957,7 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl )
uno::Reference< beans::XPropertySet > xSection = uno::Reference< beans::XPropertySet > xSection =
rDM_Impl.appendTextSectionAfter( m_xStartingRange ); rDM_Impl.appendTextSectionAfter( m_xStartingRange );
if( m_nColumnCount > 0 && xSection.is()) if( m_nColumnCount > 0 && xSection.is())
ApplyColumnProperties( xSection, rDM_Impl.GetIsLastSectionGroup() ); ApplyColumnProperties( xSection, rDM_Impl );
uno::Reference<beans::XPropertySet> xRangeProperties(lcl_GetRangeProperties(m_bIsFirstSection, rDM_Impl, m_xStartingRange)); uno::Reference<beans::XPropertySet> xRangeProperties(lcl_GetRangeProperties(m_bIsFirstSection, rDM_Impl, m_xStartingRange));
if (xRangeProperties.is()) if (xRangeProperties.is())
{ {
...@@ -1012,7 +1013,7 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl ) ...@@ -1012,7 +1013,7 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl )
} }
uno::Reference< text::XTextColumns > xColumns; uno::Reference< text::XTextColumns > xColumns;
if( m_nColumnCount > 0 ) if( m_nColumnCount > 0 )
xColumns = ApplyColumnProperties( xFollowPageStyle, rDM_Impl.GetIsLastSectionGroup() ); xColumns = ApplyColumnProperties( xFollowPageStyle, rDM_Impl );
//prepare text grid properties //prepare text grid properties
sal_Int32 nHeight = 1; sal_Int32 nHeight = 1;
......
...@@ -203,7 +203,7 @@ class SectionPropertyMap : public PropertyMap ...@@ -203,7 +203,7 @@ class SectionPropertyMap : public PropertyMap
void _ApplyProperties( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xStyle ); 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::text::XTextColumns > ApplyColumnProperties(
::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xFollowPageStyle, bool bLast ); ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xFollowPageStyle, DomainMapper_Impl& rDM_Impl );
void CopyLastHeaderFooter( bool bFirstPage, DomainMapper_Impl& rDM_Impl ); void CopyLastHeaderFooter( bool bFirstPage, DomainMapper_Impl& rDM_Impl );
void PrepareHeaderFooterProperties( bool bFirstPage ); void PrepareHeaderFooterProperties( bool bFirstPage );
bool HasHeader( bool bFirstPage ) const; bool HasHeader( bool bFirstPage ) const;
......
...@@ -74,6 +74,7 @@ struct SettingsTable_Impl ...@@ -74,6 +74,7 @@ struct SettingsTable_Impl
bool embedTrueTypeFonts; bool embedTrueTypeFonts;
bool embedSystemFonts; bool embedSystemFonts;
bool m_bDoNotUseHTMLParagraphAutoSpacing; bool m_bDoNotUseHTMLParagraphAutoSpacing;
bool m_bNoColumnBalance;
bool m_bSplitPgBreakAndParaMark; bool m_bSplitPgBreakAndParaMark;
bool m_bMirrorMargin; bool m_bMirrorMargin;
uno::Sequence<beans::PropertyValue> m_pThemeFontLangProps; uno::Sequence<beans::PropertyValue> m_pThemeFontLangProps;
...@@ -104,6 +105,7 @@ struct SettingsTable_Impl ...@@ -104,6 +105,7 @@ struct SettingsTable_Impl
, embedTrueTypeFonts(false) , embedTrueTypeFonts(false)
, embedSystemFonts(false) , embedSystemFonts(false)
, m_bDoNotUseHTMLParagraphAutoSpacing(false) , m_bDoNotUseHTMLParagraphAutoSpacing(false)
, m_bNoColumnBalance(false)
, m_bSplitPgBreakAndParaMark(false) , m_bSplitPgBreakAndParaMark(false)
, m_bMirrorMargin(false) , m_bMirrorMargin(false)
, m_pThemeFontLangProps(3) , m_pThemeFontLangProps(3)
...@@ -276,6 +278,9 @@ void SettingsTable::lcl_sprm(Sprm& rSprm) ...@@ -276,6 +278,9 @@ void SettingsTable::lcl_sprm(Sprm& rSprm)
} }
} }
break; break;
case NS_ooxml::LN_CT_Compat_noColumnBalance:
m_pImpl->m_bNoColumnBalance = nIntValue;
break;
default: default:
{ {
#ifdef DEBUG_DOMAINMAPPER #ifdef DEBUG_DOMAINMAPPER
...@@ -338,6 +343,11 @@ bool SettingsTable::GetDoNotUseHTMLParagraphAutoSpacing() const ...@@ -338,6 +343,11 @@ bool SettingsTable::GetDoNotUseHTMLParagraphAutoSpacing() const
return m_pImpl->m_bDoNotUseHTMLParagraphAutoSpacing; return m_pImpl->m_bDoNotUseHTMLParagraphAutoSpacing;
} }
bool SettingsTable::GetNoColumnBalance() const
{
return m_pImpl->m_bNoColumnBalance;
}
bool SettingsTable::GetSplitPgBreakAndParaMark() const bool SettingsTable::GetSplitPgBreakAndParaMark() const
{ {
return m_pImpl->m_bSplitPgBreakAndParaMark; return m_pImpl->m_bSplitPgBreakAndParaMark;
......
...@@ -71,6 +71,7 @@ class SettingsTable : public LoggedProperties, public LoggedTable ...@@ -71,6 +71,7 @@ class SettingsTable : public LoggedProperties, public LoggedTable
bool GetDoNotUseHTMLParagraphAutoSpacing() const; bool GetDoNotUseHTMLParagraphAutoSpacing() const;
bool GetSplitPgBreakAndParaMark() const; bool GetSplitPgBreakAndParaMark() const;
bool GetMirrorMarginSettings() const; bool GetMirrorMarginSettings() const;
bool GetNoColumnBalance() const;
css::uno::Sequence<css::beans::PropertyValue> GetThemeFontLangProperties() const; css::uno::Sequence<css::beans::PropertyValue> GetThemeFontLangProperties() const;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment