summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTushar Bende <tushar.bende@synerzip.com>2014-05-30 11:12:54 +0530
committerMichael Stahl <mstahl@redhat.com>2014-05-30 21:07:56 +0200
commit489611732319dec36ec630f6bfffd0c6ff03b9bf (patch)
tree0730a0ad778d48388d8dddaf36ac82ee3c27ba93
parent59eabfcfeab03ee3aa830bfa31ea4a7893824776 (diff)
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@redhat.com>
-rw-r--r--sw/qa/extras/ooxmlimport/data/fdo78883.docxbin0 -> 18303 bytes
-rw-r--r--sw/qa/extras/ooxmlimport/ooxmlimport.cxx11
-rw-r--r--writerfilter/source/dmapper/DomainMapper.cxx5
-rw-r--r--writerfilter/source/dmapper/DomainMapperTableHandler.cxx12
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.cxx11
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.hxx5
6 files changed, 41 insertions, 3 deletions
diff --git a/sw/qa/extras/ooxmlimport/data/fdo78883.docx b/sw/qa/extras/ooxmlimport/data/fdo78883.docx
new file mode 100644
index 000000000000..a72ff9436e0c
--- /dev/null
+++ b/sw/qa/extras/ooxmlimport/data/fdo78883.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 0089c4a42cdc..a24c3ab51aa7 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 3c6b220ef7dc..8ccba78362fd 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 49ea9ac62dc9..57bbd32388f9 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 14330f44f86a..0312a43377be 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 f2d61e0c33af..74ff7845abf3 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 );