tdf#146269: don't set modified when connecting frame, model and controller
Change-Id: I487a989a97389af11c98e10ac001c860d7855aec Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177300 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
This commit is contained in:
parent
d88683e467
commit
1e54b2037a
3 changed files with 29 additions and 0 deletions
|
@ -23,6 +23,7 @@
|
|||
#include <com/sun/star/frame/XFrame.hpp>
|
||||
#include <com/sun/star/frame/XModel.hpp>
|
||||
#include <com/sun/star/uno/Reference.hxx>
|
||||
#include <com/sun/star/util/XModifiable2.hpp>
|
||||
|
||||
namespace utl
|
||||
{
|
||||
|
@ -40,12 +41,22 @@ ConnectFrameControllerModel(const css::uno::Reference<css::frame::XFrame>& xFram
|
|||
const css::uno::Reference<css::frame::XController2>& xController,
|
||||
const css::uno::Reference<css::frame::XModel>& xModel)
|
||||
{
|
||||
auto xModifiable = xModel.query<css::util::XModifiable2>();
|
||||
bool bOldModifiable = false;
|
||||
if (xModifiable)
|
||||
{
|
||||
bOldModifiable = xModifiable->isSetModifiedEnabled();
|
||||
if (bOldModifiable)
|
||||
xModifiable->disableSetModified();
|
||||
}
|
||||
ConnectModelController(xModel, xController);
|
||||
if (xFrame)
|
||||
xFrame->setComponent(xController->getComponentWindow(), xController);
|
||||
// creates the view and menu
|
||||
// for correct menu creation the initialized component must be already set into the frame
|
||||
xController->attachFrame(xFrame);
|
||||
if (xModifiable && bOldModifiable)
|
||||
xModifiable->enableSetModified();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
BIN
sw/qa/extras/ooxmlexport/data/deleted_pageref.docx
Normal file
BIN
sw/qa/extras/ooxmlexport/data/deleted_pageref.docx
Normal file
Binary file not shown.
|
@ -1165,6 +1165,24 @@ CPPUNIT_TEST_FIXTURE(Test, testCommentWithChildrenTdf163092)
|
|||
CPPUNIT_ASSERT_EQUAL(parents[sComment3Id], sComment2Id);
|
||||
}
|
||||
|
||||
CPPUNIT_TEST_FIXTURE(Test, testTdf146269)
|
||||
{
|
||||
// Given a focument with a field in a redline:
|
||||
createSwDoc("deleted_pageref.docx");
|
||||
// It must open unmodified:
|
||||
{
|
||||
auto xModifiable = mxComponent.queryThrow<util::XModifiable>();
|
||||
CPPUNIT_ASSERT(!xModifiable->isModified());
|
||||
}
|
||||
|
||||
// Test also after save-and-reload:
|
||||
saveAndReload(u"Office Open XML Text"_ustr);
|
||||
{
|
||||
auto xModifiable = mxComponent.queryThrow<util::XModifiable>();
|
||||
CPPUNIT_ASSERT(!xModifiable->isModified());
|
||||
}
|
||||
}
|
||||
|
||||
} // end of anonymous namespace
|
||||
CPPUNIT_PLUGIN_IMPLEMENT();
|
||||
|
||||
|
|
Loading…
Reference in a new issue