sw: let layout not mark embedded object as modified

The problem was that right after the import, the document wasn't marked
as modified, but as layout settled, it got marked as modified.

Given that we already have code to avoid modification when updating the
replacement image, do something similar here: when setting the view
area, make sure the embedded object's component is not marked as
modified.

Change-Id: I88a42829ec48db54178553661863a571cd2a268b
This commit is contained in:
Miklos Vajna 2014-06-03 12:44:37 +02:00
parent f0546a51ad
commit e2b260fc98
2 changed files with 15 additions and 0 deletions

View File

@ -2118,6 +2118,10 @@ DECLARE_OOXMLIMPORT_TEST(testChartSize, "chart-size.docx")
uno::Reference<container::XIndexAccess> xEmbeddedObjects(xTextEmbeddedObjectsSupplier->getEmbeddedObjects(), uno::UNO_QUERY);
// This was 10954.
CPPUNIT_ASSERT_EQUAL(sal_Int32(6008), getProperty<sal_Int32>(xEmbeddedObjects->getByIndex(0), "Width"));
// Layout modified the document when it had this chart.
uno::Reference<util::XModifiable> xModifiable(mxComponent, uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL(false, bool(xModifiable->isModified()));
}
DECLARE_OOXMLIMPORT_TEST(testInlineGroupshape, "inline-groupshape.docx")

View File

@ -650,7 +650,18 @@ void SwWrtShell::CalcAndSetScale( svt::EmbeddedObjectRef& xObj,
awt::Size aSz;
aSz.Width = aSize.Width();
aSz.Height = aSize.Height();
// Action 'setVisualAreaSize' doesn't have to change the
// modified state of the document, either.
bool bModified = false;
uno::Reference<util::XModifiable> xModifiable(xObj->getComponent(), uno::UNO_QUERY);
if (xModifiable.is())
bModified = xModifiable->isModified();
xObj->setVisualAreaSize( nAspect, aSz );
xModifiable.set(xObj->getComponent(), uno::UNO_QUERY);
if (xModifiable.is())
xModifiable->setModified(bModified);
// #i48419# - action 'UpdateReplacement' doesn't
// have to change the modified state of the document.
// This is only a workaround for the defect, that this action