summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAttila Szűcs <szucs.attila3@nisz.hu>2021-11-18 11:02:01 +0100
committerXisco Fauli <xiscofauli@libreoffice.org>2021-11-30 10:08:34 +0100
commit8a82c6f3f1e85c941ac05b48416450cec813a04e (patch)
treed4a90755723993f06c3496fd36392f7f2bf71bfd
parentbd8e584db0c19a30164575d7fc8c583436db5b85 (diff)
tdf#54465 tdf#139336 sw: add compat. flag for footnote in column
Add compatibility option FOOTNOTE_IN_COLUMN_TO_PAGEEND to keep layout of old ODT files, where multicolumn sections have footnotes in columns, growing sections to the full page. Note: Multicolumn page styles or not evenly distributed multicolumn sections, or footnotes not collected at the end of the sections still use footnotes in columns, so they don't need this compatibility option. Follow-up to commit 4c31b4ef2083087a822c3ae648fd09acc67d2f88 "tdf#139336 sw: fix extra pages of multicolumn sections with footnotes". Co-authored-by: Tibor Nagy (NISZ) Change-Id: I7d6a1f804b555dc5372767014b8fb5e3fa57ba9b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125442 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org> (cherry picked from commit 41cc1d2c0c0c3bfa5ba341311f68df05375859fb) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126001 Reviewed-by: Attila Szűcs <szucs.attila3@nisz.hu> Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> Tested-by: Jenkins
-rw-r--r--sw/inc/IDocumentSettingAccess.hxx3
-rw-r--r--sw/qa/extras/layout/data/tdf54465_ColumnsWithFootnoteDoNotOccupyEntirePage_New.odtbin0 -> 10799 bytes
-rw-r--r--sw/qa/extras/layout/data/tdf54465_ColumnsWithFootnoteDoNotOccupyEntirePage_Old.odtbin0 -> 10216 bytes
-rw-r--r--sw/qa/extras/layout/layout.cxx24
-rw-r--r--sw/source/core/doc/DocumentSettingManager.cxx15
-rw-r--r--sw/source/core/inc/DocumentSettingManager.hxx1
-rw-r--r--sw/source/core/layout/findfrm.cxx6
-rw-r--r--sw/source/filter/ww8/ww8par.cxx2
-rw-r--r--sw/source/uibase/app/docshini.cxx1
-rw-r--r--sw/source/uibase/uno/SwXDocumentSettings.cxx18
-rw-r--r--writerfilter/source/dmapper/DomainMapper.cxx1
11 files changed, 68 insertions, 3 deletions
diff --git a/sw/inc/IDocumentSettingAccess.hxx b/sw/inc/IDocumentSettingAccess.hxx
index 310f6a773c3d..d20130dbd3e5 100644
--- a/sw/inc/IDocumentSettingAccess.hxx
+++ b/sw/inc/IDocumentSettingAccess.hxx
@@ -114,6 +114,9 @@ enum class DocumentSettingId
HEADER_SPACING_BELOW_LAST_PARA,
FRAME_AUTOWIDTH_WITH_MORE_PARA,
GUTTER_AT_TOP,
+ // footnoteContainer default position is the page end instead of the column end
+ // only if "evenly distributed" is set, and "collected at the end" is not set
+ FOOTNOTE_IN_COLUMN_TO_PAGEEND,
};
/** Provides access to settings of a document
diff --git a/sw/qa/extras/layout/data/tdf54465_ColumnsWithFootnoteDoNotOccupyEntirePage_New.odt b/sw/qa/extras/layout/data/tdf54465_ColumnsWithFootnoteDoNotOccupyEntirePage_New.odt
new file mode 100644
index 000000000000..28a19263053a
--- /dev/null
+++ b/sw/qa/extras/layout/data/tdf54465_ColumnsWithFootnoteDoNotOccupyEntirePage_New.odt
Binary files differ
diff --git a/sw/qa/extras/layout/data/tdf54465_ColumnsWithFootnoteDoNotOccupyEntirePage_Old.odt b/sw/qa/extras/layout/data/tdf54465_ColumnsWithFootnoteDoNotOccupyEntirePage_Old.odt
new file mode 100644
index 000000000000..426e684937b3
--- /dev/null
+++ b/sw/qa/extras/layout/data/tdf54465_ColumnsWithFootnoteDoNotOccupyEntirePage_Old.odt
Binary files differ
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index 9050a00a86cf..3ef61970f5ae 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -3733,6 +3733,30 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf139336_ColumnsWithFootnoteDoNotOccup
assertXPath(pXmlDoc, "/root/page", 2);
}
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf54465_ColumnsWithFootnoteDoNotOccupyEntirePage)
+{
+ // Old odt files should keep their original layout, as it was before Tdf139336 fix.
+ // The new odt file is only 1 page long, while the old odt file (with the same content)
+ // was more then 1 page long.
+ // Note: Somewhy this test miscalculates the layout of the old odt file.
+ // It will be 4 pages long, while opened in Writer it is 5 pages long.
+ SwDoc* pDoc
+ = createSwDoc(DATA_DIRECTORY, "tdf54465_ColumnsWithFootnoteDoNotOccupyEntirePage_Old.odt");
+ CPPUNIT_ASSERT(pDoc);
+ Scheduler::ProcessEventsToIdle();
+ xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+ xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, "/root/page");
+ xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval;
+ CPPUNIT_ASSERT_GREATER(1, xmlXPathNodeSetGetLength(pXmlNodes));
+ xmlXPathFreeObject(pXmlObj);
+
+ discardDumpedLayout();
+ pDoc = createSwDoc(DATA_DIRECTORY, "tdf54465_ColumnsWithFootnoteDoNotOccupyEntirePage_New.odt");
+ CPPUNIT_ASSERT(pDoc);
+ pXmlDoc = parseLayoutDump();
+ assertXPath(pXmlDoc, "/root/page", 1);
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/doc/DocumentSettingManager.cxx b/sw/source/core/doc/DocumentSettingManager.cxx
index 883ab4736e73..2776422caf8e 100644
--- a/sw/source/core/doc/DocumentSettingManager.cxx
+++ b/sw/source/core/doc/DocumentSettingManager.cxx
@@ -102,7 +102,8 @@ sw::DocumentSettingManager::DocumentSettingManager(SwDoc &rDoc)
mbProtectFields(false),
mbHeaderSpacingBelowLastPara(false),
mbFrameAutowidthWithMorePara(false),
- mbGutterAtTop(false)
+ mbGutterAtTop(false),
+ mbFootnoteInColumnToPageEnd(false)
// COMPATIBILITY FLAGS END
{
@@ -238,6 +239,7 @@ bool sw::DocumentSettingManager::get(/*[in]*/ DocumentSettingId id) const
case DocumentSettingId::FRAME_AUTOWIDTH_WITH_MORE_PARA: return mbFrameAutowidthWithMorePara;
case DocumentSettingId::GUTTER_AT_TOP:
return mbGutterAtTop;
+ case DocumentSettingId::FOOTNOTE_IN_COLUMN_TO_PAGEEND: return mbFootnoteInColumnToPageEnd;
default:
OSL_FAIL("Invalid setting id");
}
@@ -503,6 +505,9 @@ void sw::DocumentSettingManager::set(/*[in]*/ DocumentSettingId id, /*[in]*/ boo
case DocumentSettingId::GUTTER_AT_TOP:
mbGutterAtTop = value;
break;
+ case DocumentSettingId::FOOTNOTE_IN_COLUMN_TO_PAGEEND:
+ mbFootnoteInColumnToPageEnd = value;
+ break;
default:
OSL_FAIL("Invalid setting id");
}
@@ -679,6 +684,7 @@ void sw::DocumentSettingManager::ReplaceCompatibilityOptions(const DocumentSetti
// No mbProtectFields: this is false by default everywhere
mbHeaderSpacingBelowLastPara = rSource.mbHeaderSpacingBelowLastPara;
mbFrameAutowidthWithMorePara = rSource.mbFrameAutowidthWithMorePara;
+ mbFootnoteInColumnToPageEnd = rSource.mbFootnoteInColumnToPageEnd;
}
sal_uInt32 sw::DocumentSettingManager::Getn32DummyCompatibilityOptions1() const
@@ -990,7 +996,7 @@ void sw::DocumentSettingManager::dumpAsXml(xmlTextWriterPtr pWriter) const
(void)xmlTextWriterStartElement(pWriter, BAD_CAST("mbFrameAutowidthWithMorePara"));
(void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"),
- BAD_CAST(OString::boolean(mbFrameAutowidthWithMorePara).getStr()));
+ BAD_CAST(OString::boolean(mbFrameAutowidthWithMorePara).getStr()));
(void)xmlTextWriterEndElement(pWriter);
(void)xmlTextWriterStartElement(pWriter, BAD_CAST("mbGutterAtTop"));
@@ -998,6 +1004,11 @@ void sw::DocumentSettingManager::dumpAsXml(xmlTextWriterPtr pWriter) const
BAD_CAST(OString::boolean(mbGutterAtTop).getStr()));
(void)xmlTextWriterEndElement(pWriter);
+ (void)xmlTextWriterStartElement(pWriter, BAD_CAST("mbFootnoteInColumnToPageEnd"));
+ (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"),
+ BAD_CAST(OString::boolean(mbFootnoteInColumnToPageEnd).getStr()));
+ (void)xmlTextWriterEndElement(pWriter);
+
(void)xmlTextWriterEndElement(pWriter);
}
diff --git a/sw/source/core/inc/DocumentSettingManager.hxx b/sw/source/core/inc/DocumentSettingManager.hxx
index 19e55d5ede47..d5604f25490c 100644
--- a/sw/source/core/inc/DocumentSettingManager.hxx
+++ b/sw/source/core/inc/DocumentSettingManager.hxx
@@ -171,6 +171,7 @@ class DocumentSettingManager final :
bool mbFrameAutowidthWithMorePara; //tdf#124423
/// Gutter position: false means left (not a compatibility setting).
bool mbGutterAtTop;
+ bool mbFootnoteInColumnToPageEnd;
public:
diff --git a/sw/source/core/layout/findfrm.cxx b/sw/source/core/layout/findfrm.cxx
index 52d7e9627a1e..445d3e29dcd6 100644
--- a/sw/source/core/layout/findfrm.cxx
+++ b/sw/source/core/layout/findfrm.cxx
@@ -39,6 +39,7 @@
#include <ndtxt.hxx>
#include <osl/diagnose.h>
#include <sal/log.hxx>
+#include <IDocumentSettingAccess.hxx>
/// Searches the first ContentFrame in BodyText below the page.
@@ -457,7 +458,10 @@ SwFootnoteBossFrame* SwFrame::FindFootnoteBossFrame( bool bFootnotes )
// similar case can be reached with a page break + FootnoteAtEnd setting
SwSectionFrame* pSectframe = pRet->FindSctFrame();
bool bMoveToPageFrame = false;
- if (pSectframe)
+ // tdf54465: compatibility flag to make old odt files keep these full page sections.
+ if (pSectframe
+ && pSectframe->GetFormat()->getIDocumentSettingAccess().get(
+ DocumentSettingId::FOOTNOTE_IN_COLUMN_TO_PAGEEND))
{
SwSection* pSect = pSectframe->GetSection();
if (pSect) {
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 818e3b013549..be67ed1fa795 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -1823,6 +1823,8 @@ void SwWW8ImplReader::ImportDop()
DocumentSettingId::HEADER_SPACING_BELOW_LAST_PARA, true);
m_rDoc.getIDocumentSettingAccess().set(
DocumentSettingId::FRAME_AUTOWIDTH_WITH_MORE_PARA, true);
+ m_rDoc.getIDocumentSettingAccess().set(
+ DocumentSettingId::FOOTNOTE_IN_COLUMN_TO_PAGEEND, true);
// Import Default Tabs
tools::Long nDefTabSiz = m_xWDop->dxaTab;
diff --git a/sw/source/uibase/app/docshini.cxx b/sw/source/uibase/app/docshini.cxx
index aabd3e8e4eb6..3694c51a0367 100644
--- a/sw/source/uibase/app/docshini.cxx
+++ b/sw/source/uibase/app/docshini.cxx
@@ -289,6 +289,7 @@ bool SwDocShell::InitNew( const uno::Reference < embed::XStorage >& xStor )
// value 'false' in the SwDoc c-tor)
m_xDoc->getIDocumentSettingAccess().set( DocumentSettingId::MATH_BASELINE_ALIGNMENT,
SW_MOD()->GetUsrPref( bWeb )->IsAlignMathObjectsToBaseline() );
+ m_xDoc->getIDocumentSettingAccess().set( DocumentSettingId::FOOTNOTE_IN_COLUMN_TO_PAGEEND, true);
}
/* #106748# If the default frame direction of a document is RTL
diff --git a/sw/source/uibase/uno/SwXDocumentSettings.cxx b/sw/source/uibase/uno/SwXDocumentSettings.cxx
index 8a8caaaa605c..881ac1540239 100644
--- a/sw/source/uibase/uno/SwXDocumentSettings.cxx
+++ b/sw/source/uibase/uno/SwXDocumentSettings.cxx
@@ -149,6 +149,7 @@ enum SwDocumentSettingsPropertyHandles
HANDLE_HEADER_SPACING_BELOW_LAST_PARA,
HANDLE_FRAME_AUTOWIDTH_WITH_MORE_PARA,
HANDLE_GUTTER_AT_TOP,
+ HANDLE_FOOTNOTE_IN_COLUMN_TO_PAGEEND,
};
}
@@ -244,6 +245,7 @@ static rtl::Reference<MasterPropertySetInfo> lcl_createSettingsInfo()
{ OUString("HeaderSpacingBelowLastPara"), HANDLE_HEADER_SPACING_BELOW_LAST_PARA, cppu::UnoType<bool>::get(), 0 },
{ OUString("FrameAutowidthWithMorePara"), HANDLE_FRAME_AUTOWIDTH_WITH_MORE_PARA, cppu::UnoType<bool>::get(), 0 },
{ OUString("GutterAtTop"), HANDLE_GUTTER_AT_TOP, cppu::UnoType<bool>::get(), 0 },
+ { OUString("FootnoteInColumnToPageEnd"), HANDLE_FOOTNOTE_IN_COLUMN_TO_PAGEEND, cppu::UnoType<bool>::get(), 0 },
/*
* As OS said, we don't have a view when we need to set this, so I have to
@@ -1016,6 +1018,16 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf
}
}
break;
+ case HANDLE_FOOTNOTE_IN_COLUMN_TO_PAGEEND:
+ {
+ bool bTmp;
+ if (rValue >>= bTmp)
+ {
+ mpDoc->getIDocumentSettingAccess().set(
+ DocumentSettingId::FOOTNOTE_IN_COLUMN_TO_PAGEEND, bTmp);
+ }
+ }
+ break;
default:
throw UnknownPropertyException(OUString::number(rInfo.mnHandle));
}
@@ -1522,6 +1534,12 @@ void SwXDocumentSettings::_getSingleValue( const comphelper::PropertyInfo & rInf
rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::GUTTER_AT_TOP);
}
break;
+ case HANDLE_FOOTNOTE_IN_COLUMN_TO_PAGEEND:
+ {
+ rValue <<= mpDoc->getIDocumentSettingAccess().get(
+ DocumentSettingId::FOOTNOTE_IN_COLUMN_TO_PAGEEND);
+ }
+ break;
default:
throw UnknownPropertyException(OUString::number(rInfo.mnHandle));
}
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index a40099ef30c7..6001d49d2117 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -130,6 +130,7 @@ DomainMapper::DomainMapper( const uno::Reference< uno::XComponentContext >& xCon
m_pImpl->SetDocumentSettingsProperty("HeaderSpacingBelowLastPara",
uno::makeAny(true));
m_pImpl->SetDocumentSettingsProperty("FrameAutowidthWithMorePara", uno::makeAny(true));
+ m_pImpl->SetDocumentSettingsProperty("FootnoteInColumnToPageEnd", uno::makeAny(true));
m_pImpl->SetDocumentSettingsProperty("TabAtLeftIndentForParagraphsInList", uno::makeAny(true));