diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2020-07-29 17:45:03 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2020-07-30 00:02:32 +0200 |
commit | 2036db5ecd227f97e0e5ab403de61b80fff93c38 (patch) | |
tree | e071ab562f91126143c2bc98653c0e2b6e0bae14 /sw | |
parent | db46b03885e5814fa904b4f1190a0063f198c1b6 (diff) |
tdf#135244: move LockAllViews to SfxObjectShell
... so that it may be called from SfxObjectShell::SaveTo_Impl, and
handle export cases in addition to save (as) handled in tdf#41063.
Change-Id: Ie39196656dd1a95dcb6bab3ae8138c2f5c8729e6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99714
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/docsh.hxx | 13 | ||||
-rw-r--r-- | sw/source/uibase/app/docsh.cxx | 10 |
2 files changed, 12 insertions, 11 deletions
diff --git a/sw/inc/docsh.hxx b/sw/inc/docsh.hxx index 225305aec568..6dc7fdf21f35 100644 --- a/sw/inc/docsh.hxx +++ b/sw/inc/docsh.hxx @@ -319,16 +319,19 @@ public: void CallAutomationDocumentEventSinks(const OUString& Method, css::uno::Sequence< css::uno::Any >& Arguments); void RegisterAutomationDocumentObject(css::uno::Reference< ooo::vba::word::XDocument > const& xDocument); - class SAL_DLLPRIVATE LockAllViewsGuard + // Lock all unlocked views, and returns a guard object which unlocks those views when destructed + virtual std::unique_ptr<LockAllViewsGuard> LockAllViews() override; + +protected: + class LockAllViewsGuard_Impl : public LockAllViewsGuard { std::vector<SwViewShell*> m_aViewWasUnLocked; public: - explicit LockAllViewsGuard(SwViewShell* pViewShell); - ~LockAllViewsGuard(); + explicit LockAllViewsGuard_Impl(SwViewShell* pViewShell); + ~LockAllViewsGuard_Impl(); }; - // Lock all unlocked views, and returns a guard object which unlocks those views when destructed - std::unique_ptr<LockAllViewsGuard> LockAllViews(); + }; /** Find the right DocShell and create a new one: diff --git a/sw/source/uibase/app/docsh.cxx b/sw/source/uibase/app/docsh.cxx index f323d7a53e80..9846c1748e1f 100644 --- a/sw/source/uibase/app/docsh.cxx +++ b/sw/source/uibase/app/docsh.cxx @@ -349,7 +349,7 @@ bool SwDocShell::Save() return !nErr.IsError(); } -SwDocShell::LockAllViewsGuard::LockAllViewsGuard(SwViewShell* pViewShell) +SwDocShell::LockAllViewsGuard_Impl::LockAllViewsGuard_Impl(SwViewShell* pViewShell) { if (!pViewShell) return; @@ -363,23 +363,21 @@ SwDocShell::LockAllViewsGuard::LockAllViewsGuard(SwViewShell* pViewShell) } } -SwDocShell::LockAllViewsGuard::~LockAllViewsGuard() +SwDocShell::LockAllViewsGuard_Impl::~LockAllViewsGuard_Impl() { for (SwViewShell* pShell : m_aViewWasUnLocked) pShell->LockView(false); } -std::unique_ptr<SwDocShell::LockAllViewsGuard> SwDocShell::LockAllViews() +std::unique_ptr<SfxObjectShell::LockAllViewsGuard> SwDocShell::LockAllViews() { - return std::make_unique<LockAllViewsGuard>(GetEditShell()); + return std::make_unique<LockAllViewsGuard_Impl>(GetEditShell()); } // Save using the Defaultformat bool SwDocShell::SaveAs( SfxMedium& rMedium ) { SwWait aWait( *this, true ); - // tdf#41063: prevent jumping to cursor at any temporary modification - auto aViewGuard(LockAllViews()); //#i3370# remove quick help to prevent saving of autocorrection suggestions if (m_pView) m_pView->GetEditWin().StopQuickHelp(); |