Kaydet (Commit) 75fc9e66 authored tarafından Umesh Kadam's avatar Umesh Kadam Kaydeden (comit) Miklos Vajna

fdo#78904 : LO hangs while saving the document.

- In case of framePr attributes being omitted in original xml, LO defaults
  such attributes to incorrect values.
- Correcting these values in this fix.
- This fix stops LO from getting hang while saving the document, the actual
  fix needs to be somewhere in the table layout. We need to restrict the
  frame from being considered as part of the table as MSO does not allow
  frame to be part of a table.

Change-Id: I4c35f7eff6ca1122901f5667fc26b849df527f60
Reviewed-on: https://gerrit.libreoffice.org/9774Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
Tested-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
üst 9f878507
...@@ -1175,6 +1175,17 @@ DECLARE_OOXMLIMPORT_TEST(testToolsLineNumbering, "tools-line-numbering.docx") ...@@ -1175,6 +1175,17 @@ DECLARE_OOXMLIMPORT_TEST(testToolsLineNumbering, "tools-line-numbering.docx")
CPPUNIT_ASSERT_EQUAL(sal_Int32(3), nValue); CPPUNIT_ASSERT_EQUAL(sal_Int32(3), nValue);
} }
DECLARE_OOXMLIMPORT_TEST(testfdo78904, "fdo78904.docx")
{
uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY);
if (xIndexAccess->getCount())
{
uno::Reference<beans::XPropertySet> xFrame(xIndexAccess->getByIndex(0), uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL(sal_Int32(EMU_TO_MM100(0)), getProperty<sal_Int32>(xFrame, "HoriOrientPosition"));
}
}
DECLARE_OOXMLIMPORT_TEST(testFdo60922, "fdo60922.docx") DECLARE_OOXMLIMPORT_TEST(testFdo60922, "fdo60922.docx")
{ {
// This was 0, not 100, due to wrong import of w:position w:val="0" // This was 0, not 100, due to wrong import of w:position w:val="0"
......
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
#include <com/sun/star/text/HoriOrientation.hpp> #include <com/sun/star/text/HoriOrientation.hpp>
#include <com/sun/star/text/VertOrientation.hpp> #include <com/sun/star/text/VertOrientation.hpp>
#include <com/sun/star/text/ReferenceFieldPart.hpp> #include <com/sun/star/text/ReferenceFieldPart.hpp>
#include <com/sun/star/text/RelOrientation.hpp>
#include <com/sun/star/text/ReferenceFieldSource.hpp> #include <com/sun/star/text/ReferenceFieldSource.hpp>
#include <com/sun/star/text/SizeType.hpp> #include <com/sun/star/text/SizeType.hpp>
#include <com/sun/star/text/TextContentAnchorType.hpp> #include <com/sun/star/text/TextContentAnchorType.hpp>
...@@ -772,6 +773,8 @@ void lcl_AddRangeAndStyle( ...@@ -772,6 +773,8 @@ void lcl_AddRangeAndStyle(
//define some default frame width - 0cm ATM: this allow the frame to be wrapped around the text //define some default frame width - 0cm ATM: this allow the frame to be wrapped around the text
#define DEFAULT_FRAME_MIN_WIDTH 0 #define DEFAULT_FRAME_MIN_WIDTH 0
#define DEFAULT_FRAME_MIN_HEIGHT 0
#define DEFAULT_VALUE 0
void DomainMapper_Impl::CheckUnregisteredFrameConversion( ) void DomainMapper_Impl::CheckUnregisteredFrameConversion( )
{ {
...@@ -826,7 +829,7 @@ void DomainMapper_Impl::CheckUnregisteredFrameConversion( ) ...@@ -826,7 +829,7 @@ void DomainMapper_Impl::CheckUnregisteredFrameConversion( )
pFrameProperties[1].Value <<= pFrameProperties[1].Value <<=
rAppendContext.pLastParagraphProperties->Geth() > 0 ? rAppendContext.pLastParagraphProperties->Geth() > 0 ?
rAppendContext.pLastParagraphProperties->Geth() : rAppendContext.pLastParagraphProperties->Geth() :
pStyleProperties->Geth(); pStyleProperties->Geth() > 0 ? pStyleProperties->Geth() : DEFAULT_FRAME_MIN_HEIGHT;
pFrameProperties[2].Value <<= sal_Int16( pFrameProperties[2].Value <<= sal_Int16(
rAppendContext.pLastParagraphProperties->GethRule() >= 0 ? rAppendContext.pLastParagraphProperties->GethRule() >= 0 ?
...@@ -841,13 +844,17 @@ void DomainMapper_Impl::CheckUnregisteredFrameConversion( ) ...@@ -841,13 +844,17 @@ void DomainMapper_Impl::CheckUnregisteredFrameConversion( )
pStyleProperties->GetxAlign() >= 0 ? pStyleProperties->GetxAlign() : text::HoriOrientation::NONE ); pStyleProperties->GetxAlign() >= 0 ? pStyleProperties->GetxAlign() : text::HoriOrientation::NONE );
pFrameProperties[4].Value <<= nHoriOrient; pFrameProperties[4].Value <<= nHoriOrient;
//set a non negative default value
pFrameProperties[5].Value <<= pFrameProperties[5].Value <<=
rAppendContext.pLastParagraphProperties->IsxValid() ? rAppendContext.pLastParagraphProperties->IsxValid() ?
rAppendContext.pLastParagraphProperties->Getx() : pStyleProperties->Getx(); rAppendContext.pLastParagraphProperties->Getx() :
pStyleProperties->IsxValid() ? pStyleProperties->Getx() : DEFAULT_VALUE;
//Default the anchor in case FramePr_hAnchor is missing ECMA 17.3.1.11
pFrameProperties[6].Value <<= sal_Int16( pFrameProperties[6].Value <<= sal_Int16(
rAppendContext.pLastParagraphProperties->GethAnchor() >= 0 ? rAppendContext.pLastParagraphProperties->GethAnchor() >= 0 ?
rAppendContext.pLastParagraphProperties->GethAnchor() : rAppendContext.pLastParagraphProperties->GethAnchor() :
pStyleProperties->GethAnchor() ); pStyleProperties->GethAnchor() >=0 ? pStyleProperties->GethAnchor() : text::RelOrientation::FRAME );
sal_Int16 nVertOrient = sal_Int16( sal_Int16 nVertOrient = sal_Int16(
rAppendContext.pLastParagraphProperties->GetyAlign() >= 0 ? rAppendContext.pLastParagraphProperties->GetyAlign() >= 0 ?
...@@ -855,18 +862,22 @@ void DomainMapper_Impl::CheckUnregisteredFrameConversion( ) ...@@ -855,18 +862,22 @@ void DomainMapper_Impl::CheckUnregisteredFrameConversion( )
pStyleProperties->GetyAlign() >= 0 ? pStyleProperties->GetyAlign() : text::VertOrientation::NONE ); pStyleProperties->GetyAlign() >= 0 ? pStyleProperties->GetyAlign() : text::VertOrientation::NONE );
pFrameProperties[7].Value <<= nVertOrient; pFrameProperties[7].Value <<= nVertOrient;
//set a non negative default value
pFrameProperties[8].Value <<= pFrameProperties[8].Value <<=
rAppendContext.pLastParagraphProperties->IsyValid() ? rAppendContext.pLastParagraphProperties->IsyValid() ?
rAppendContext.pLastParagraphProperties->Gety() : pStyleProperties->Gety(); rAppendContext.pLastParagraphProperties->Gety() :
pStyleProperties->IsyValid() ? pStyleProperties->Gety() : DEFAULT_VALUE;
//Default the anchor in case FramePr_vAnchor is missing ECMA 17.3.1.11
pFrameProperties[9].Value <<= sal_Int16( pFrameProperties[9].Value <<= sal_Int16(
rAppendContext.pLastParagraphProperties->GetvAnchor() >= 0 ? rAppendContext.pLastParagraphProperties->GetvAnchor() >= 0 ?
rAppendContext.pLastParagraphProperties->GetvAnchor() : rAppendContext.pLastParagraphProperties->GetvAnchor() :
pStyleProperties->GetvAnchor() ); pStyleProperties->GetvAnchor() >= 0 ? pStyleProperties->GetvAnchor() : text::RelOrientation::FRAME );
pFrameProperties[10].Value <<= text::WrapTextMode( pFrameProperties[10].Value <<= text::WrapTextMode(
rAppendContext.pLastParagraphProperties->GetWrap() >= 0 ? rAppendContext.pLastParagraphProperties->GetWrap() >= 0 ?
rAppendContext.pLastParagraphProperties->GetWrap() : rAppendContext.pLastParagraphProperties->GetWrap() :
pStyleProperties->GetWrap()); pStyleProperties->GetWrap() >= 0 ? pStyleProperties->GetWrap() : text::WrapTextMode_NONE );
/** FDO#73546 : distL & distR should be unsigned intgers <Ecma 20.4.3.6> /** FDO#73546 : distL & distR should be unsigned intgers <Ecma 20.4.3.6>
Swapped the array elements 11,12 & 13,14 since 11 & 12 are Swapped the array elements 11,12 & 13,14 since 11 & 12 are
......
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