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 /sw/source | |
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 'sw/source')
-rw-r--r-- | sw/source/core/crsr/crsrsh.cxx | 10 | ||||
-rw-r--r-- | sw/source/core/crsr/viscrs.cxx | 30 | ||||
-rw-r--r-- | sw/source/core/view/viewsh.cxx | 5 | ||||
-rw-r--r-- | sw/source/uibase/docvw/SidebarScrollBar.cxx | 5 | ||||
-rw-r--r-- | sw/source/uibase/docvw/SidebarTxtControl.cxx | 5 | ||||
-rw-r--r-- | sw/source/uibase/docvw/SidebarWin.cxx | 8 | ||||
-rw-r--r-- | sw/source/uibase/docvw/edtwin.cxx | 8 | ||||
-rw-r--r-- | sw/source/uibase/uiview/viewsrch.cxx | 36 | ||||
-rw-r--r-- | sw/source/uibase/wrtsh/wrtsh2.cxx | 5 |
9 files changed, 21 insertions, 91 deletions
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx index 47415ca3bc14..bd7670136ac2 100644 --- a/sw/source/core/crsr/crsrsh.cxx +++ b/sw/source/core/crsr/crsrsh.cxx @@ -2138,10 +2138,7 @@ void SwCursorShell::ShowCursor() if (comphelper::LibreOfficeKit::isActive()) { - if (comphelper::LibreOfficeKit::isViewCallback()) - GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_CURSOR_VISIBLE, OString::boolean(true).getStr()); - else - libreOfficeKitCallback(LOK_CALLBACK_CURSOR_VISIBLE, OString::boolean(true).getStr()); + GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_CURSOR_VISIBLE, OString::boolean(true).getStr()); } UpdateCursor(); @@ -2160,10 +2157,7 @@ void SwCursorShell::HideCursor() if (comphelper::LibreOfficeKit::isActive()) { - if (comphelper::LibreOfficeKit::isViewCallback()) - GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_CURSOR_VISIBLE, OString::boolean(false).getStr()); - else - libreOfficeKitCallback(LOK_CALLBACK_CURSOR_VISIBLE, OString::boolean(false).getStr()); + GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_CURSOR_VISIBLE, OString::boolean(false).getStr()); } } } diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx index 8c9ee305b82c..30f6f8f60c4e 100644 --- a/sw/source/core/crsr/viscrs.cxx +++ b/sw/source/core/crsr/viscrs.cxx @@ -189,19 +189,13 @@ void SwVisibleCursor::SetPosAndShow() { m_nPageLastTime = nPage; OString aPayload = OString::number(nPage - 1); - if (comphelper::LibreOfficeKit::isViewCallback()) - m_pCursorShell->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_SET_PART, aPayload.getStr()); - else - m_pCursorShell->libreOfficeKitCallback(LOK_CALLBACK_SET_PART, aPayload.getStr()); + m_pCursorShell->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_SET_PART, aPayload.getStr()); } // notify about the cursor position & size Rectangle aSVRect(aRect.Pos().getX(), aRect.Pos().getY(), aRect.Pos().getX() + aRect.SSize().Width(), aRect.Pos().getY() + aRect.SSize().Height()); OString sRect = aSVRect.toString(); - if (comphelper::LibreOfficeKit::isViewCallback()) - m_pCursorShell->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR, sRect.getStr()); - else - m_pCursorShell->libreOfficeKitCallback(LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR, sRect.getStr()); + m_pCursorShell->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR, sRect.getStr()); } if ( !m_pCursorShell->IsCursorReadonly() || m_pCursorShell->GetViewOptions()->IsSelectionInReadonly() ) @@ -382,18 +376,12 @@ void SwSelPaintRects::Show(std::vector<OString>* pSelectionRectangles) if (aStartRect.HasArea()) { OString sRect = aStartRect.SVRect().toString(); - if (comphelper::LibreOfficeKit::isViewCallback()) - GetShell()->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION_START, sRect.getStr()); - else - GetShell()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION_START, sRect.getStr()); + GetShell()->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION_START, sRect.getStr()); } if (aEndRect.HasArea()) { OString sRect = aEndRect.SVRect().toString(); - if (comphelper::LibreOfficeKit::isViewCallback()) - GetShell()->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION_END, sRect.getStr()); - else - GetShell()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION_END, sRect.getStr()); + GetShell()->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION_END, sRect.getStr()); } } @@ -406,10 +394,7 @@ void SwSelPaintRects::Show(std::vector<OString>* pSelectionRectangles) OString sRect = comphelper::string::join("; ", aRect); if (!pSelectionRectangles) { - if (comphelper::LibreOfficeKit::isViewCallback()) - GetShell()->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, sRect.getStr()); - else - GetShell()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION, sRect.getStr()); + GetShell()->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, sRect.getStr()); } else pSelectionRectangles->push_back(sRect); @@ -616,10 +601,7 @@ void SwShellCursor::Show() aRect.push_back(rSelectionRectangle); } OString sRect = comphelper::string::join("; ", aRect); - if (comphelper::LibreOfficeKit::isViewCallback()) - GetShell()->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, sRect.getStr()); - else - GetShell()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION, sRect.getStr()); + GetShell()->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, sRect.getStr()); } } diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx index 6e500097c31f..f2cb6a1fa4f6 100644 --- a/sw/source/core/view/viewsh.cxx +++ b/sw/source/core/view/viewsh.cxx @@ -1023,10 +1023,7 @@ void SwViewShell::SizeChgNotify() std::stringstream ss; ss << aDocSize.Width() + 2L * DOCUMENTBORDER << ", " << aDocSize.Height() + 2L * DOCUMENTBORDER; OString sRect = ss.str().c_str(); - if (comphelper::LibreOfficeKit::isViewCallback()) - GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_DOCUMENT_SIZE_CHANGED, sRect.getStr()); - else - libreOfficeKitCallback(LOK_CALLBACK_DOCUMENT_SIZE_CHANGED, sRect.getStr()); + GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_DOCUMENT_SIZE_CHANGED, sRect.getStr()); } } } diff --git a/sw/source/uibase/docvw/SidebarScrollBar.cxx b/sw/source/uibase/docvw/SidebarScrollBar.cxx index 86ca488d9a11..40ddf08c9784 100644 --- a/sw/source/uibase/docvw/SidebarScrollBar.cxx +++ b/sw/source/uibase/docvw/SidebarScrollBar.cxx @@ -57,10 +57,7 @@ void SidebarScrollBar::LogicInvalidate(const Rectangle* pRectangle) OString sRectangle = aRectangle.toString(); SwWrtShell& rWrtShell = m_rView.GetWrtShell(); - if (comphelper::LibreOfficeKit::isViewCallback()) - rWrtShell.GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_INVALIDATE_TILES, sRectangle.getStr()); - else - rWrtShell.libreOfficeKitCallback(LOK_CALLBACK_INVALIDATE_TILES, sRectangle.getStr()); + rWrtShell.GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_INVALIDATE_TILES, sRectangle.getStr()); } void SidebarScrollBar::MouseButtonUp(const MouseEvent& /*rMouseEvent*/) diff --git a/sw/source/uibase/docvw/SidebarTxtControl.cxx b/sw/source/uibase/docvw/SidebarTxtControl.cxx index 9ecfeaeebe26..afe4e8a57660 100644 --- a/sw/source/uibase/docvw/SidebarTxtControl.cxx +++ b/sw/source/uibase/docvw/SidebarTxtControl.cxx @@ -213,10 +213,7 @@ void SidebarTextControl::LogicInvalidate(const Rectangle* pRectangle) OString sRectangle = aRectangle.toString(); SwWrtShell& rWrtShell = mrDocView.GetWrtShell(); - if (comphelper::LibreOfficeKit::isViewCallback()) - rWrtShell.GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_INVALIDATE_TILES, sRectangle.getStr()); - else - rWrtShell.libreOfficeKitCallback(LOK_CALLBACK_INVALIDATE_TILES, sRectangle.getStr()); + rWrtShell.GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_INVALIDATE_TILES, sRectangle.getStr()); } void SidebarTextControl::KeyInput( const KeyEvent& rKeyEvt ) diff --git a/sw/source/uibase/docvw/SidebarWin.cxx b/sw/source/uibase/docvw/SidebarWin.cxx index 60c78b80dcad..8fbd74042b48 100644 --- a/sw/source/uibase/docvw/SidebarWin.cxx +++ b/sw/source/uibase/docvw/SidebarWin.cxx @@ -614,13 +614,7 @@ void SwSidebarWin::InitControls() if (comphelper::LibreOfficeKit::isActive()) { // If there is a callback already registered, inform the new outliner view about it. - if (comphelper::LibreOfficeKit::isViewCallback()) - mpOutlinerView->registerLibreOfficeKitViewCallback(&mrView); - else - { - SwDrawModel* pDrawModel = mrView.GetWrtShellPtr()->getIDocumentDrawModelAccess().GetDrawModel(); - mpOutlinerView->registerLibreOfficeKitCallback(pDrawModel); - } + mpOutlinerView->registerLibreOfficeKitViewCallback(&mrView); } //create Scrollbars diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx index fafaf0ef3b41..5f8e026c2eec 100644 --- a/sw/source/uibase/docvw/edtwin.cxx +++ b/sw/source/uibase/docvw/edtwin.cxx @@ -6397,13 +6397,7 @@ void SwEditWin::LogicInvalidate(const Rectangle* pRectangle) else sRectangle = pRectangle->toString(); - if (comphelper::LibreOfficeKit::isViewCallback()) - m_rView.libreOfficeKitViewCallback(LOK_CALLBACK_INVALIDATE_TILES, sRectangle.getStr()); - else - { - if (m_rView.GetWrtShellPtr()) - m_rView.GetWrtShell().libreOfficeKitCallback(LOK_CALLBACK_INVALIDATE_TILES, sRectangle.getStr()); - } + m_rView.libreOfficeKitViewCallback(LOK_CALLBACK_INVALIDATE_TILES, sRectangle.getStr()); } void SwEditWin::LogicMouseButtonDown(const MouseEvent& rMouseEvent) diff --git a/sw/source/uibase/uiview/viewsrch.cxx b/sw/source/uibase/uiview/viewsrch.cxx index 41097862f08f..d773d10edb26 100644 --- a/sw/source/uibase/uiview/viewsrch.cxx +++ b/sw/source/uibase/uiview/viewsrch.cxx @@ -134,10 +134,7 @@ static void lcl_emitSearchResultCallbacks(SvxSearchItem* pSearchItem, SwWrtShell boost::property_tree::write_json(aStream, aTree); OString aPayload = aStream.str().c_str(); - if (comphelper::LibreOfficeKit::isViewCallback()) - pWrtShell->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_SEARCH_RESULT_SELECTION, aPayload.getStr()); - else - pWrtShell->libreOfficeKitCallback(LOK_CALLBACK_SEARCH_RESULT_SELECTION, aPayload.getStr()); + pWrtShell->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_SEARCH_RESULT_SELECTION, aPayload.getStr()); } } @@ -266,26 +263,16 @@ void SwView::ExecSearch(SfxRequest& rReq) case SvxSearchCmd::FIND_ALL: { // Disable LOK selection notifications during search. - SwDrawModel* pModel = m_pWrtShell->getIDocumentDrawModelAccess().GetDrawModel(); - if (comphelper::LibreOfficeKit::isViewCallback()) - m_pWrtShell->GetSfxViewShell()->setTiledSearching(true); - else if (pModel) - pModel->setTiledSearching(true); + m_pWrtShell->GetSfxViewShell()->setTiledSearching(true); bool bRet = SearchAll(); - if (comphelper::LibreOfficeKit::isViewCallback()) - m_pWrtShell->GetSfxViewShell()->setTiledSearching(false); - else if (pModel) - pModel->setTiledSearching(false); + m_pWrtShell->GetSfxViewShell()->setTiledSearching(false); if( !bRet ) { #if HAVE_FEATURE_DESKTOP if( !bQuiet ) { - if (comphelper::LibreOfficeKit::isViewCallback()) - m_pWrtShell->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_SEARCH_NOT_FOUND, m_pSrchItem->GetSearchString().toUtf8().getStr()); - else - m_pWrtShell->libreOfficeKitCallback(LOK_CALLBACK_SEARCH_NOT_FOUND, m_pSrchItem->GetSearchString().toUtf8().getStr()); + m_pWrtShell->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_SEARCH_NOT_FOUND, m_pSrchItem->GetSearchString().toUtf8().getStr()); SvxSearchDialogWrapper::SetSearchLabel(SL_NotFound); } #endif @@ -406,10 +393,7 @@ void SwView::ExecSearch(SfxRequest& rReq) #if HAVE_FEATURE_DESKTOP if( !bQuiet ) { - if (comphelper::LibreOfficeKit::isViewCallback()) - m_pWrtShell->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_SEARCH_NOT_FOUND, m_pSrchItem->GetSearchString().toUtf8().getStr()); - else - m_pWrtShell->libreOfficeKitCallback(LOK_CALLBACK_SEARCH_NOT_FOUND, m_pSrchItem->GetSearchString().toUtf8().getStr()); + m_pWrtShell->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_SEARCH_NOT_FOUND, m_pSrchItem->GetSearchString().toUtf8().getStr()); SvxSearchDialogWrapper::SetSearchLabel(SL_NotFound); } #endif @@ -605,10 +589,7 @@ bool SwView::SearchAndWrap(bool bApi) if( !bApi ) { #if HAVE_FEATURE_DESKTOP - if (comphelper::LibreOfficeKit::isViewCallback()) - m_pWrtShell->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_SEARCH_NOT_FOUND, m_pSrchItem->GetSearchString().toUtf8().getStr()); - else - m_pWrtShell->libreOfficeKitCallback(LOK_CALLBACK_SEARCH_NOT_FOUND, m_pSrchItem->GetSearchString().toUtf8().getStr()); + m_pWrtShell->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_SEARCH_NOT_FOUND, m_pSrchItem->GetSearchString().toUtf8().getStr()); SvxSearchDialogWrapper::SetSearchLabel(SL_NotFound); #endif } @@ -661,10 +642,7 @@ bool SwView::SearchAndWrap(bool bApi) } else if(!bApi) { - if (comphelper::LibreOfficeKit::isViewCallback()) - m_pWrtShell->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_SEARCH_NOT_FOUND, m_pSrchItem->GetSearchString().toUtf8().getStr()); - else - m_pWrtShell->libreOfficeKitCallback(LOK_CALLBACK_SEARCH_NOT_FOUND, m_pSrchItem->GetSearchString().toUtf8().getStr()); + m_pWrtShell->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_SEARCH_NOT_FOUND, m_pSrchItem->GetSearchString().toUtf8().getStr()); SvxSearchDialogWrapper::SetSearchLabel(SL_NotFound); } #endif diff --git a/sw/source/uibase/wrtsh/wrtsh2.cxx b/sw/source/uibase/wrtsh/wrtsh2.cxx index e35df9d6a3da..aba44d2265bc 100644 --- a/sw/source/uibase/wrtsh/wrtsh2.cxx +++ b/sw/source/uibase/wrtsh/wrtsh2.cxx @@ -473,10 +473,7 @@ void LoadURL( SwViewShell& rVSh, const OUString& rURL, sal_uInt16 nFilter, // We are doing tiledRendering, let the client handles the URL loading. if (comphelper::LibreOfficeKit::isActive()) { - if (comphelper::LibreOfficeKit::isViewCallback()) - rVSh.GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_HYPERLINK_CLICKED, rURL.toUtf8().getStr()); - else - rVSh.libreOfficeKitCallback(LOK_CALLBACK_HYPERLINK_CLICKED, rURL.toUtf8().getStr()); + rVSh.GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_HYPERLINK_CLICKED, rURL.toUtf8().getStr()); return; } |