Kaydet (Commit) 48961173 authored tarafından Tushar Bende's avatar Tushar Bende Kaydeden (comit) Michael Stahl

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: 's avatarMichael Stahl <mstahl@redhat.com>
üst 59eabfcf
......@@ -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.
......
......@@ -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 )
......
......@@ -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( ) )
......
......@@ -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;
......
......@@ -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 );
......
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