[Libreoffice-commits] core.git: sw/qa writerfilter/source
Tushar Bende
tushar.bende at synerzip.com
Fri May 30 12:12:42 PDT 2014
sw/qa/extras/ooxmlimport/data/fdo78883.docx |binary
sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 11 +++++++++++
writerfilter/source/dmapper/DomainMapper.cxx | 5 +++++
writerfilter/source/dmapper/DomainMapperTableHandler.cxx | 12 +++++++++---
writerfilter/source/dmapper/DomainMapper_Impl.cxx | 11 +++++++++++
writerfilter/source/dmapper/DomainMapper_Impl.hxx | 5 +++++
6 files changed, 41 insertions(+), 3 deletions(-)
New commits:
commit 489611732319dec36ec630f6bfffd0c6ff03b9bf
Author: Tushar Bende <tushar.bende at synerzip.com>
Date: Fri May 30 11:12:54 2014 +0530
fdo#78883: Writer getting Hang while opening document
Description:
Writer getting Hang while opening document because of loop in layout.
Root cause: For Documents containing table with direct formatting for
Para line spacing along with style w:type="table" in style.xml LO was
erasing PROP_PARA_LINE_SPACING Prop from pAllCellProps in
DomainMapperTableHandler::endTableGetCellProperties(). But for
Documents without direct formatting for Para line spacing this deletion
was causing problem, as after deletion there is no formatting available
to apply.
To fix this checking whether there is a Direct formatting available for
table, if Yes then proceed with this deletion logic.
Change-Id: Ibaf51ebd1aca93eff44a9edfbe8fa13832ab2b70
Signed-off-by: Michael Stahl <mstahl at redhat.com>
diff --git a/sw/qa/extras/ooxmlimport/data/fdo78883.docx b/sw/qa/extras/ooxmlimport/data/fdo78883.docx
new file mode 100644
index 0000000..a72ff94
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/fdo78883.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 0089c4a..a24c3ab 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -2126,6 +2126,17 @@ DECLARE_OOXMLIMPORT_TEST(testInlineGroupshape, "inline-groupshape.docx")
CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(getShape(1), "Opaque"));
}
+DECLARE_OOXMLIMPORT_TEST(testFdo78883, "fdo78883.docx")
+{
+ // fdo#78883 : LO was getting hang while opening document
+ // Checking there is a single page after loading a doc in LO.
+ uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
+ uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier(xModel->getCurrentController(), uno::UNO_QUERY);
+ uno::Reference<text::XPageCursor> xCursor(xTextViewCursorSupplier->getViewCursor(), uno::UNO_QUERY);
+ xCursor->jumpToLastPage();
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(1), xCursor->getPage());
+}
+
DECLARE_OOXMLIMPORT_TEST(testBnc875718, "bnc875718.docx")
{
// The frame in the footer must not accidentally end up in the document body.
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index 3c6b220..8ccba78 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -393,6 +393,11 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
}
if( nName == NS_ooxml::LN_CT_Spacing_line )
{
+ if( m_pImpl->getTableManager().isInCell() )
+ {
+ // direct formatting is applied for table cell data
+ m_pImpl->SetIsTableHasDirectFormatting(true);
+ }
m_pImpl->appendGrabBag(m_pImpl->m_aSubInteropGrabBag, "line", OUString::number(nIntValue));
//now set the value depending on the Mode
if( aSpacing.Mode == style::LineSpacingMode::PROP )
diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
index 49ea9ac..57bbd32 100644
--- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
@@ -757,9 +757,15 @@ CellPropertyValuesSeq_t DomainMapperTableHandler::endTableGetCellProperties(Tabl
if ( aDefaultRepeatIt != pAllCellProps->end( ) )
pAllCellProps->erase( aDefaultRepeatIt );
- aDefaultRepeatIt = pAllCellProps->find(PROP_PARA_LINE_SPACING);
- if ( aDefaultRepeatIt != pAllCellProps->end( ) )
- pAllCellProps->erase( aDefaultRepeatIt );
+ if( m_rDMapper_Impl.GetIsTableHasDirectFormatting() )
+ {
+ // Bug#78883 : direct formatting is applied for table cell data
+ // so we can erase para line spacing property from style.xml
+ aDefaultRepeatIt = pAllCellProps->find(PROP_PARA_LINE_SPACING);
+ if ( aDefaultRepeatIt != pAllCellProps->end( ) )
+ pAllCellProps->erase( aDefaultRepeatIt );
+ m_rDMapper_Impl.SetIsTableHasDirectFormatting(false);
+ }
aDefaultRepeatIt = pAllCellProps->find(PROP_TBL_HEADER);
if ( aDefaultRepeatIt != pAllCellProps->end( ) )
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 14330f4..0312a43 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -186,6 +186,7 @@ DomainMapper_Impl::DomainMapper_Impl(
m_bUsingEnhancedFields( false ),
m_bSdt(false),
m_bIsFirstRun(false),
+ m_bIsTableHasDirectFormatting(false),
m_xAnnotationField(),
m_nAnnotationId( -1 ),
m_aAnnotationPositions(),
@@ -449,6 +450,16 @@ bool DomainMapper_Impl::GetSdt()
return m_bSdt;
}
+void DomainMapper_Impl::SetIsTableHasDirectFormatting(bool bIsTableHasDirectFormatting)
+{
+ m_bIsTableHasDirectFormatting = bIsTableHasDirectFormatting;
+}
+
+bool DomainMapper_Impl::GetIsTableHasDirectFormatting()
+{
+ return m_bIsTableHasDirectFormatting;
+}
+
bool DomainMapper_Impl::GetParaChanged()
{
return m_bParaChanged;
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
index f2d61e0..74ff784 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
@@ -387,6 +387,7 @@ private:
/// If the current paragraph is inside a structured document element.
bool m_bSdt;
bool m_bIsFirstRun;
+ bool m_bIsTableHasDirectFormatting;
css::uno::Reference< css::text::XTextCursor > xTOCMarkerCursor;
css::uno::Reference< css::text::XTextCursor > mxTOCTextCursor;
@@ -472,6 +473,10 @@ public:
void SetSdt(bool bSdt);
/// Getter method for m_bSdt.
bool GetSdt();
+ /// Getter method for m_bIsTableHasDirectFormatting
+ bool GetIsTableHasDirectFormatting();
+ /// Setter method for m_bIsTableHasDirectFormatting
+ void SetIsTableHasDirectFormatting(bool bIsTableHasDirectFormatting);
bool GetParaChanged();
void deferBreak( BreakType deferredBreakType );
More information about the Libreoffice-commits
mailing list