summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorJustin Luth <justin_luth@sil.org>2018-12-21 21:22:51 +0300
committerMiklos Vajna <vmiklos@collabora.com>2020-01-16 15:55:41 +0100
commitf238411e5e0292c01320663dc5b3cf4d1d9e58c4 (patch)
tree4c16b66d5b222d28a6902f7323007c0f70ad1b86 /writerfilter
parentdce673e12456d6c09c8ef9407e658ceca17a8787 (diff)
tdf#121670 ooxmlimport: no columns in page styles, only sections
LIKELY TO EXPOSE SECTION EXPORT/IMPORT PROBLEMS. That is already happening somewhat because support for forms/protected sections was added in LO6.2. By making this change, it will help to expose problems faster, with the hope that they can still be fixed for 6.2. Columns in page styles are very problematic, because it doesn't let you override the number of columns (except to put sub-columns inside one of the existing columns). So, always attempt to insert a column into it's own section, and never into the page style itself. I'm rather excited that this didn't cause any unit test failures. I've made a lot of section fixes over the years (and some this week which are required for the unit test to work). This change seems very natural, and gets rid of a regression-prone hack. I found all of the existing unit tests with columns and tested them. About 10 files - all look fine including complex files tdf81345.docx and tdf104061_tableSectionColumns.docx Change-Id: If02f1bfd91b1cf8210665244d0782ff926cc2869 Reviewed-on: https://gerrit.libreoffice.org/65557 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_luth@sil.org> (cherry picked from commit 14087d3e5fed9b56384432d9aeac608a5e8d86cf) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86910 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/dmapper/PropertyMap.cxx18
1 files changed, 10 insertions, 8 deletions
diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx
index 80351c6d1c66..39e8488a8a34 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -1356,13 +1356,7 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl )
}
}
- // depending on the break type no page styles should be created
- // Continuous sections usually create only a section, and not a new page style
- const bool bTreatAsContinuous = m_nBreakType == NS_ooxml::LN_Value_ST_SectionMark_nextPage
- && m_nColumnCount > 0
- && (m_bIsFirstSection || (!HasHeader( m_bTitlePage ) && !HasFooter( m_bTitlePage )) )
- && (m_bIsFirstSection || m_sFollowPageStyleName.isEmpty() || (m_sFirstPageStyleName.isEmpty() && m_bTitlePage));
- if ( m_nBreakType == static_cast<sal_Int32>(NS_ooxml::LN_Value_ST_SectionMark_continuous) || bTreatAsContinuous )
+ if ( m_nBreakType == static_cast<sal_Int32>(NS_ooxml::LN_Value_ST_SectionMark_continuous) )
{
//todo: insert a section or access the already inserted section
uno::Reference< beans::XPropertySet > xSection =
@@ -1426,7 +1420,15 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl )
}
uno::Reference< text::XTextColumns > xColumns;
if ( m_nColumnCount > 0 )
- xColumns = ApplyColumnProperties( xFollowPageStyle, rDM_Impl );
+ {
+ // prefer setting column properties into a section, not a page style if at all possible.
+ if ( !xSection.is() )
+ xSection = rDM_Impl.appendTextSectionAfter( m_xStartingRange );
+ if ( xSection.is() )
+ ApplyColumnProperties( xSection, rDM_Impl );
+ else
+ xColumns = ApplyColumnProperties( xFollowPageStyle, rDM_Impl );
+ }
// these BreakTypes are effectively page-breaks: don't evenly distribute text in columns before a page break;
SectionPropertyMap* pLastContext = rDM_Impl.GetLastSectionContext();