summaryrefslogtreecommitdiff
path: root/writerfilter/source/dmapper/PropertyMap.cxx
diff options
context:
space:
mode:
authorJustin Luth <justin.luth@collabora.com>2020-09-15 11:45:22 +0300
committerMiklos Vajna <vmiklos@collabora.com>2020-09-16 14:34:18 +0200
commitdf2f2c8bf1004d00dd6cdff0e3edb9bf5777ffbd (patch)
tree16c37591d8a1fa184ff3b1bc13b4e0add7ef4b81 /writerfilter/source/dmapper/PropertyMap.cxx
parent2ce8446ac40d5186c54ec26995b8e0989557cbe5 (diff)
tdf#136706 writerfilter: don't create page style for footnote
Each time CloseSectionGroup is called for a non-continuous break, it wants to create a new page style. Each footnote calls CloseSectionGroup twice, so two unused ConvertedX page styles were created for each footnote. A quick glance through the code makes me wonder whether footnotes can skip CloseSectionGroup altogether, (unit tests suggest that it can...) but it might be necessary for a floating table that should be in-lined, or setting relative width (although tables aren't really supported in footnotes). In any case, the safest approach is to change as little as possible, so that is what I have done. HandleMargins...() only seems to add the margin information into the page style, so it should be safe to avoid that function, even though relative width stuff checks the margins. Comments are already excluded, and the function is not even called for isInIndexContext() || isInBibliographyContext(). I thought header/footers were also considered sections, but that does not appear to be the case. I'm not aware of any other types of non-text sections, but if there are, they may need similar treatment. Change-Id: I4325604c286ca1132e5765a56627be4b7e64ba4f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102723 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_luth@sil.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'writerfilter/source/dmapper/PropertyMap.cxx')
-rw-r--r--writerfilter/source/dmapper/PropertyMap.cxx15
1 files changed, 11 insertions, 4 deletions
diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx
index 7a2807746141..60dbe6c4cc4f 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -477,6 +477,7 @@ uno::Reference< beans::XPropertySet > SectionPropertyMap::GetPageStyle( DomainMa
{
if ( m_sFirstPageStyleName.isEmpty() && xPageStyles.is() )
{
+ assert( !rDM_Impl.IsInFootOrEndnote() && "Don't create useless page styles" );
m_sFirstPageStyleName = rDM_Impl.GetUnusedPageStyleName();
m_aFirstPageStyle.set( xTextFactory->createInstance( "com.sun.star.style.PageStyle" ),
uno::UNO_QUERY );
@@ -503,6 +504,7 @@ uno::Reference< beans::XPropertySet > SectionPropertyMap::GetPageStyle( DomainMa
{
if ( m_sFollowPageStyleName.isEmpty() && xPageStyles.is() )
{
+ assert( !rDM_Impl.IsInFootOrEndnote() && "Don't create useless page styles" );
m_sFollowPageStyleName = rDM_Impl.GetUnusedPageStyleName();
m_aFollowPageStyle.set( xTextFactory->createInstance( "com.sun.star.style.PageStyle" ),
uno::UNO_QUERY );
@@ -1646,9 +1648,14 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl )
ApplyProtectionProperties( xSection, rDM_Impl );
//get the properties and create appropriate page styles
- uno::Reference< beans::XPropertySet > xFollowPageStyle = GetPageStyle( rDM_Impl, false );
+ uno::Reference< beans::XPropertySet > xFollowPageStyle;
+ //This part certainly is not needed for footnotes, so don't create unused page styles.
+ if ( !rDM_Impl.IsInFootOrEndnote() )
+ {
+ xFollowPageStyle.set( GetPageStyle( rDM_Impl, false ) );
- HandleMarginsHeaderFooter(/*bFirstPage=*/false, rDM_Impl );
+ HandleMarginsHeaderFooter(/*bFirstPage=*/false, rDM_Impl );
+ }
if ( rDM_Impl.GetSettingsTable()->GetMirrorMarginSettings() )
{
@@ -1662,7 +1669,7 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl )
xSection = rDM_Impl.appendTextSectionAfter( m_xStartingRange );
if ( xSection.is() )
ApplyColumnProperties( xSection, rDM_Impl );
- else
+ else if ( xFollowPageStyle.is() )
xColumns = ApplyColumnProperties( xFollowPageStyle, rDM_Impl );
}
@@ -1757,7 +1764,7 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl )
Insert( PROP_GRID_BASE_WIDTH, uno::makeAny( nCharWidth ) );
Insert( PROP_GRID_RUBY_HEIGHT, uno::makeAny( sal_Int32( 0 ) ) );
- if ( rDM_Impl.IsNewDoc() )
+ if ( rDM_Impl.IsNewDoc() && xFollowPageStyle.is() )
ApplyProperties_( xFollowPageStyle );
//todo: creating a "First Page" style depends on HasTitlePage and _fFacingPage_