diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-06-17 11:45:02 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-06-17 12:47:46 +0000 |
commit | 5b5706f41f97998785e1e7ad356580772da80c42 (patch) | |
tree | 90fbc80386ed79b12bd5fce299c7a139384d9e0b /sd | |
parent | e30f3bcd25762236eb739584dc71691123527c9f (diff) |
comphelper lok: remove the g_bViewCallback global
Its purpose was to allow incrementally migrate all callers of
SdrModel::libreOfficeKitCallback() to use
SfxViewShell::libreOfficeKitViewCallback() (which allows notifying only
the currently active or all views) instead. That is done by now, so it
can go.
Change-Id: I521bbbe5c638dfd844ebf025153459a37362d3c3
Reviewed-on: https://gerrit.libreoffice.org/26413
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/core/drawdoc2.cxx | 32 | ||||
-rw-r--r-- | sd/source/ui/func/fusel.cxx | 9 | ||||
-rw-r--r-- | sd/source/ui/view/Outliner.cxx | 64 | ||||
-rw-r--r-- | sd/source/ui/view/drviews1.cxx | 9 | ||||
-rw-r--r-- | sd/source/ui/view/sdwindow.cxx | 9 |
5 files changed, 30 insertions, 93 deletions
diff --git a/sd/source/core/drawdoc2.cxx b/sd/source/core/drawdoc2.cxx index d8acaf60d68d..c936af755cc6 100644 --- a/sd/source/core/drawdoc2.cxx +++ b/sd/source/core/drawdoc2.cxx @@ -377,20 +377,14 @@ void SdDrawDocument::InsertPage(SdrPage* pPage, sal_uInt16 nPos) if (!bLast) UpdatePageRelativeURLs(static_cast<SdPage*>( pPage ), nPos, 1); - if (comphelper::LibreOfficeKit::isActive() && - static_cast<SdPage*>(pPage)->GetPageKind() == PK_STANDARD) + if (comphelper::LibreOfficeKit::isActive() && static_cast<SdPage*>(pPage)->GetPageKind() == PK_STANDARD) { - if (comphelper::LibreOfficeKit::isViewCallback()) + SfxViewShell* pViewShell = SfxViewShell::GetFirst(); + while (pViewShell) { - SfxViewShell* pViewShell = SfxViewShell::GetFirst(); - while (pViewShell) - { - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_DOCUMENT_SIZE_CHANGED, ""); - pViewShell = SfxViewShell::GetNext(*pViewShell); - } + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_DOCUMENT_SIZE_CHANGED, ""); + pViewShell = SfxViewShell::GetNext(*pViewShell); } - else - libreOfficeKitCallback(LOK_CALLBACK_DOCUMENT_SIZE_CHANGED, ""); } } @@ -416,20 +410,14 @@ SdrPage* SdDrawDocument::RemovePage(sal_uInt16 nPgNum) if (!bLast) UpdatePageRelativeURLs(static_cast<SdPage*>(pPage), nPgNum, -1); - if (comphelper::LibreOfficeKit::isActive() && - static_cast<SdPage*>(pPage)->GetPageKind() == PK_STANDARD) + if (comphelper::LibreOfficeKit::isActive() && static_cast<SdPage*>(pPage)->GetPageKind() == PK_STANDARD) { - if (comphelper::LibreOfficeKit::isViewCallback()) + SfxViewShell* pViewShell = SfxViewShell::GetFirst(); + while (pViewShell) { - SfxViewShell* pViewShell = SfxViewShell::GetFirst(); - while (pViewShell) - { - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_DOCUMENT_SIZE_CHANGED, ""); - pViewShell = SfxViewShell::GetNext(*pViewShell); - } + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_DOCUMENT_SIZE_CHANGED, ""); + pViewShell = SfxViewShell::GetNext(*pViewShell); } - else - libreOfficeKitCallback(LOK_CALLBACK_DOCUMENT_SIZE_CHANGED, ""); } return pPage; diff --git a/sd/source/ui/func/fusel.cxx b/sd/source/ui/func/fusel.cxx index 3681a461f0d5..992edf1cc63d 100644 --- a/sd/source/ui/func/fusel.cxx +++ b/sd/source/ui/func/fusel.cxx @@ -278,13 +278,8 @@ bool FuSelection::MouseButtonDown(const MouseEvent& rMEvt) // If tiled rendering, let client handles URL execution and early returns. if (comphelper::LibreOfficeKit::isActive()) { - if (comphelper::LibreOfficeKit::isViewCallback()) - { - SfxViewShell& rSfxViewShell = mpViewShell->GetViewShellBase(); - rSfxViewShell.libreOfficeKitViewCallback(LOK_CALLBACK_HYPERLINK_CLICKED, aVEvt.pURLField->GetURL().toUtf8().getStr()); - } - else - mpDoc->libreOfficeKitCallback(LOK_CALLBACK_HYPERLINK_CLICKED, aVEvt.pURLField->GetURL().toUtf8().getStr()); + SfxViewShell& rSfxViewShell = mpViewShell->GetViewShellBase(); + rSfxViewShell.libreOfficeKitViewCallback(LOK_CALLBACK_HYPERLINK_CLICKED, aVEvt.pURLField->GetURL().toUtf8().getStr()); return true; } diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx index 2ea4d8102b5e..c1ac3ced45ff 100644 --- a/sd/source/ui/view/Outliner.cxx +++ b/sd/source/ui/view/Outliner.cxx @@ -620,16 +620,10 @@ bool Outliner::SearchAndReplaceAll() { // Disable selection change notifications during search all. SfxViewShell& rSfxViewShell = pViewShell->GetViewShellBase(); - if (comphelper::LibreOfficeKit::isViewCallback()) - rSfxViewShell.setTiledSearching(true); - else - pViewShell->GetDoc()->setTiledSearching(true); - comphelper::ScopeGuard aGuard([pViewShell, &rSfxViewShell]() + rSfxViewShell.setTiledSearching(true); + comphelper::ScopeGuard aGuard([&rSfxViewShell]() { - if (comphelper::LibreOfficeKit::isViewCallback()) - rSfxViewShell.setTiledSearching(false); - else - pViewShell->GetDoc()->setTiledSearching(false); + rSfxViewShell.setTiledSearching(false); }); // Go to beginning/end of document. @@ -680,10 +674,7 @@ bool Outliner::SearchAndReplaceAll() std::stringstream aStream; boost::property_tree::write_json(aStream, aTree); OString aPayload = aStream.str().c_str(); - if (comphelper::LibreOfficeKit::isViewCallback()) - rSfxViewShell.libreOfficeKitViewCallback(LOK_CALLBACK_SEARCH_RESULT_SELECTION, aPayload.getStr()); - else - pViewShell->GetDoc()->libreOfficeKitCallback(LOK_CALLBACK_SEARCH_RESULT_SELECTION, aPayload.getStr()); + rSfxViewShell.libreOfficeKitViewCallback(LOK_CALLBACK_SEARCH_RESULT_SELECTION, aPayload.getStr()); } } @@ -693,13 +684,8 @@ bool Outliner::SearchAndReplaceAll() { // Find-all, tiled rendering and we have at least one match. OString aPayload = OString::number(mnStartPageIndex); - if (comphelper::LibreOfficeKit::isViewCallback()) - { - SfxViewShell& rSfxViewShell = pViewShell->GetViewShellBase(); - rSfxViewShell.libreOfficeKitViewCallback(LOK_CALLBACK_SET_PART, aPayload.getStr()); - } - else - pViewShell->GetDoc()->libreOfficeKitCallback(LOK_CALLBACK_SET_PART, aPayload.getStr()); + SfxViewShell& rSfxViewShell = pViewShell->GetViewShellBase(); + rSfxViewShell.libreOfficeKitViewCallback(LOK_CALLBACK_SET_PART, aPayload.getStr()); // Emit a selection callback here: // 1) The original one is no longer valid, as we there was a SET_PART in between @@ -712,13 +698,7 @@ bool Outliner::SearchAndReplaceAll() aRectangles.push_back(rSelection.m_aRectangles); } OString sRectangles = comphelper::string::join("; ", aRectangles); - if (comphelper::LibreOfficeKit::isViewCallback()) - { - SfxViewShell& rSfxViewShell = pViewShell->GetViewShellBase(); - rSfxViewShell.libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, sRectangles.getStr()); - } - else - pViewShell->GetDoc()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION, sRectangles.getStr()); + rSfxViewShell.libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, sRectangles.getStr()); } mnStartPageIndex = (sal_uInt16)-1; @@ -824,13 +804,8 @@ bool Outliner::SearchAndReplaceOnce(std::vector<SearchSelection>* pSelections) { // notify LibreOfficeKit about changed page OString aPayload = OString::number(maCurrentPosition.mnPageIndex); - if (comphelper::LibreOfficeKit::isViewCallback()) - { - SfxViewShell& rSfxViewShell = pViewShell->GetViewShellBase(); - rSfxViewShell.libreOfficeKitViewCallback(LOK_CALLBACK_SET_PART, aPayload.getStr()); - } - else - pViewShell->GetDoc()->libreOfficeKitCallback(LOK_CALLBACK_SET_PART, aPayload.getStr()); + SfxViewShell& rSfxViewShell = pViewShell->GetViewShellBase(); + rSfxViewShell.libreOfficeKitViewCallback(LOK_CALLBACK_SET_PART, aPayload.getStr()); // also about search result selections boost::property_tree::ptree aTree; @@ -847,13 +822,7 @@ bool Outliner::SearchAndReplaceOnce(std::vector<SearchSelection>* pSelections) std::stringstream aStream; boost::property_tree::write_json(aStream, aTree); aPayload = aStream.str().c_str(); - if (comphelper::LibreOfficeKit::isViewCallback()) - { - SfxViewShell& rSfxViewShell = pViewShell->GetViewShellBase(); - rSfxViewShell.libreOfficeKitViewCallback(LOK_CALLBACK_SEARCH_RESULT_SELECTION, aPayload.getStr()); - } - else - pViewShell->GetDoc()->libreOfficeKitCallback(LOK_CALLBACK_SEARCH_RESULT_SELECTION, aPayload.getStr()); + rSfxViewShell.libreOfficeKitViewCallback(LOK_CALLBACK_SEARCH_RESULT_SELECTION, aPayload.getStr()); } else { @@ -1201,17 +1170,12 @@ void Outliner::ShowEndOfSearchDialog() if (!mbStringFound) { SvxSearchDialogWrapper::SetSearchLabel(SL_NotFound); - if (comphelper::LibreOfficeKit::isViewCallback()) + std::shared_ptr<ViewShell> pViewShell(mpWeakViewShell.lock()); + if (pViewShell) { - std::shared_ptr<ViewShell> pViewShell(mpWeakViewShell.lock()); - if (pViewShell) - { - SfxViewShell& rSfxViewShell = pViewShell->GetViewShellBase(); - rSfxViewShell.libreOfficeKitViewCallback(LOK_CALLBACK_SEARCH_NOT_FOUND, mpSearchItem->GetSearchString().toUtf8().getStr()); - } + SfxViewShell& rSfxViewShell = pViewShell->GetViewShellBase(); + rSfxViewShell.libreOfficeKitViewCallback(LOK_CALLBACK_SEARCH_NOT_FOUND, mpSearchItem->GetSearchString().toUtf8().getStr()); } - else - mpDrawDocument->libreOfficeKitCallback(LOK_CALLBACK_SEARCH_NOT_FOUND, mpSearchItem->GetSearchString().toUtf8().getStr()); } // don't do anything else for search diff --git a/sd/source/ui/view/drviews1.cxx b/sd/source/ui/view/drviews1.cxx index b2711f20b280..92fc471bb1a6 100644 --- a/sd/source/ui/view/drviews1.cxx +++ b/sd/source/ui/view/drviews1.cxx @@ -929,13 +929,8 @@ bool DrawViewShell::SwitchPage(sal_uInt16 nSelectedPage) { // notify LibreOfficeKit about changed page OString aPayload = OString::number(nSelectedPage); - if (comphelper::LibreOfficeKit::isViewCallback()) - { - if (SfxViewShell* pViewShell = GetViewShell()) - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_SET_PART, aPayload.getStr()); - } - else - GetDoc()->libreOfficeKitCallback(LOK_CALLBACK_SET_PART, aPayload.getStr()); + if (SfxViewShell* pViewShell = GetViewShell()) + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_SET_PART, aPayload.getStr()); } rtl::Reference< sd::SlideShow > xSlideshow( SlideShow::GetSlideShow( GetDoc() ) ); diff --git a/sd/source/ui/view/sdwindow.cxx b/sd/source/ui/view/sdwindow.cxx index ab9917e322e6..580e7a664fef 100644 --- a/sd/source/ui/view/sdwindow.cxx +++ b/sd/source/ui/view/sdwindow.cxx @@ -1017,13 +1017,8 @@ void Window::LogicInvalidate(const Rectangle* pRectangle) aRectangle = OutputDevice::LogicToLogic(aRectangle, MAP_100TH_MM, MAP_TWIP); sRectangle = aRectangle.toString(); } - if (comphelper::LibreOfficeKit::isViewCallback()) - { - SfxViewShell& rSfxViewShell = mpViewShell->GetViewShellBase(); - rSfxViewShell.libreOfficeKitViewCallback(LOK_CALLBACK_INVALIDATE_TILES, sRectangle.getStr()); - } - else - mpViewShell->GetDoc()->libreOfficeKitCallback(LOK_CALLBACK_INVALIDATE_TILES, sRectangle.getStr()); + SfxViewShell& rSfxViewShell = mpViewShell->GetViewShellBase(); + rSfxViewShell.libreOfficeKitViewCallback(LOK_CALLBACK_INVALIDATE_TILES, sRectangle.getStr()); } } // end of namespace sd |