From b8c50df5d66d5c29bf3af4e48978888dd72b19b8 Mon Sep 17 00:00:00 2001 From: Eike Rathke Date: Tue, 21 Feb 2017 15:32:35 +0100 Subject: move ScDocShell de-/init related to getNewDocShell() and closeDocShell() In preparation for being able to handle two documents. Change-Id: Ie7ea65136bcd6719031af6b1034d002058bfd81a --- sc/qa/unit/ucalc.cxx | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) (limited to 'sc/qa/unit/ucalc.cxx') diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index f09a0a4e12dd..c94ddca932cf 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -127,25 +127,36 @@ ScDocShell& Test::getDocShell() return *m_pImpl->m_xDocShell; } +void Test::getNewDocShell( ScDocShellRef& rDocShellRef ) +{ + rDocShellRef = new ScDocShell( + SfxModelFlags::EMBEDDED_OBJECT | + SfxModelFlags::DISABLE_EMBEDDED_SCRIPTS | + SfxModelFlags::DISABLE_DOCUMENT_RECOVERY); + + rDocShellRef->SetIsInUcalc(); + rDocShellRef->DoInitUnitTest(); +} + +void Test::closeDocShell( ScDocShellRef& rDocShellRef ) +{ + rDocShellRef->DoClose(); + rDocShellRef.clear(); +} + void Test::setUp() { BootstrapFixture::setUp(); ScDLL::Init(); - m_pImpl->m_xDocShell = new ScDocShell( - SfxModelFlags::EMBEDDED_OBJECT | - SfxModelFlags::DISABLE_EMBEDDED_SCRIPTS | - SfxModelFlags::DISABLE_DOCUMENT_RECOVERY); - m_pImpl->m_xDocShell->SetIsInUcalc(); - m_pImpl->m_xDocShell->DoInitUnitTest(); + getNewDocShell(m_pImpl->m_xDocShell); m_pDoc = &m_pImpl->m_xDocShell->GetDocument(); } void Test::tearDown() { - m_pImpl->m_xDocShell->DoClose(); - m_pImpl->m_xDocShell.clear(); + closeDocShell(m_pImpl->m_xDocShell); BootstrapFixture::tearDown(); } -- cgit