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

tdf#117805 DOCX export: fix lost header with at-page anchored frames

The bug has two parts: on one hand, the header was not completely lost,
just was written inside a shape. This is not valid, but at least our own
import understood that. This commit restores that old behavior, focusing
on just the regression part of the bugreport.

On the other hand the exported header is still referenced at an
incorrect location: the correct location would be the end of the
document. But that is follow-up work, it seems that never worked.

Change-Id: I468df9013c65ec581e3a474a5bf2f773fcb4f990
Reviewed-on: https://gerrit.libreoffice.org/56058
Tested-by: Jenkins
Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
üst 3a8375eb
...@@ -191,6 +191,19 @@ DECLARE_OOXMLEXPORT_TEST(testSignatureLineShape, "signature-line-all-props-set.d ...@@ -191,6 +191,19 @@ DECLARE_OOXMLEXPORT_TEST(testSignatureLineShape, "signature-line-all-props-set.d
CPPUNIT_ASSERT_EQUAL(OUString("Check the machines!"), aSigningInstructions); CPPUNIT_ASSERT_EQUAL(OUString("Check the machines!"), aSigningInstructions);
} }
DECLARE_OOXMLEXPORT_TEST(testTdf117805, "tdf117805.odt")
{
if (!mbExported)
return;
uno::Reference<packages::zip::XZipFileAccess2> xNameAccess
= packages::zip::ZipFileAccess::createWithURL(comphelper::getComponentContext(m_xSFactory),
maTempFile.GetURL());
// This failed, the header was lost. It's still referenced at an incorrect
// location in document.xml, though.
CPPUNIT_ASSERT(xNameAccess->hasByName("word/header1.xml"));
}
DECLARE_OOXMLEXPORT_TEST(testTdf113183, "tdf113183.docx") DECLARE_OOXMLEXPORT_TEST(testTdf113183, "tdf113183.docx")
{ {
// The horizontal positioning of the star shape affected the positioning of // The horizontal positioning of the star shape affected the positioning of
......
...@@ -117,6 +117,13 @@ void lclMovePositionWithRotation(awt::Point& aPos, const Size& rSize, sal_Int64 ...@@ -117,6 +117,13 @@ void lclMovePositionWithRotation(awt::Point& aPos, const Size& rSize, sal_Int64
aPos.X += nXDiff; aPos.X += nXDiff;
aPos.Y += nYDiff; aPos.Y += nYDiff;
} }
/// Determines if the anchor is inside a paragraph.
bool IsAnchorTypeInsideParagraph(const ww8::Frame* pFrame)
{
const SwFormatAnchor& rAnchor = pFrame->GetFrameFormat().GetAttrSet().GetAnchor();
return rAnchor.GetAnchorId() != RndStdIds::FLY_AT_PAGE;
}
} }
ExportDataSaveRestore::ExportDataSaveRestore(DocxExport& rExport, sal_uLong nStt, sal_uLong nEnd, ExportDataSaveRestore::ExportDataSaveRestore(DocxExport& rExport, sal_uLong nStt, sal_uLong nEnd,
...@@ -1395,7 +1402,7 @@ void DocxSdrExport::writeDMLTextFrame(ww8::Frame const* pParentFrame, int nAncho ...@@ -1395,7 +1402,7 @@ void DocxSdrExport::writeDMLTextFrame(ww8::Frame const* pParentFrame, int nAncho
bool bTextBoxOnly) bool bTextBoxOnly)
{ {
bool bDMLAndVMLDrawingOpen = m_pImpl->m_bDMLAndVMLDrawingOpen; bool bDMLAndVMLDrawingOpen = m_pImpl->m_bDMLAndVMLDrawingOpen;
m_pImpl->m_bDMLAndVMLDrawingOpen = true; m_pImpl->m_bDMLAndVMLDrawingOpen = IsAnchorTypeInsideParagraph(pParentFrame);
sax_fastparser::FSHelperPtr pFS = m_pImpl->m_pSerializer; sax_fastparser::FSHelperPtr pFS = m_pImpl->m_pSerializer;
const SwFrameFormat& rFrameFormat = pParentFrame->GetFrameFormat(); const SwFrameFormat& rFrameFormat = pParentFrame->GetFrameFormat();
...@@ -1690,7 +1697,7 @@ void DocxSdrExport::writeDMLTextFrame(ww8::Frame const* pParentFrame, int nAncho ...@@ -1690,7 +1697,7 @@ void DocxSdrExport::writeDMLTextFrame(ww8::Frame const* pParentFrame, int nAncho
void DocxSdrExport::writeVMLTextFrame(ww8::Frame const* pParentFrame, bool bTextBoxOnly) void DocxSdrExport::writeVMLTextFrame(ww8::Frame const* pParentFrame, bool bTextBoxOnly)
{ {
bool bDMLAndVMLDrawingOpen = m_pImpl->m_bDMLAndVMLDrawingOpen; bool bDMLAndVMLDrawingOpen = m_pImpl->m_bDMLAndVMLDrawingOpen;
m_pImpl->m_bDMLAndVMLDrawingOpen = true; m_pImpl->m_bDMLAndVMLDrawingOpen = IsAnchorTypeInsideParagraph(pParentFrame);
sax_fastparser::FSHelperPtr pFS = m_pImpl->m_pSerializer; sax_fastparser::FSHelperPtr pFS = m_pImpl->m_pSerializer;
const SwFrameFormat& rFrameFormat = pParentFrame->GetFrameFormat(); const SwFrameFormat& rFrameFormat = pParentFrame->GetFrameFormat();
......
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