diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2022-08-17 08:40:31 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2022-08-17 09:28:59 +0200 |
commit | 0b85a66cc3d8e54747506089f92e154dc7665bfe (patch) | |
tree | 8a4a755a6803649e12e018089fc810946a5257f6 /sw | |
parent | 78fb8fe0c5a58bc4d5074de66e77c20c3a441fd3 (diff) |
Return std::optional instead of using bool* argument
Change-Id: I47f03411a6677f22291bea4dc06920ab9052349a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138399
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/view.hxx | 2 | ||||
-rw-r--r-- | sw/inc/viscrs.hxx | 6 | ||||
-rw-r--r-- | sw/source/core/crsr/viscrs.cxx | 15 | ||||
-rw-r--r-- | sw/source/uibase/inc/wrtsh.hxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/uiview/view.cxx | 4 | ||||
-rw-r--r-- | sw/source/uibase/wrtsh/wrtsh4.cxx | 6 |
6 files changed, 16 insertions, 19 deletions
diff --git a/sw/inc/view.hxx b/sw/inc/view.hxx index 33847fcb93d9..d4d8ec608d8f 100644 --- a/sw/inc/view.hxx +++ b/sw/inc/view.hxx @@ -692,7 +692,7 @@ public: virtual tools::Rectangle getLOKVisibleArea() const override; virtual void flushPendingLOKInvalidateTiles() override; - virtual OString getLOKPayload(int nType, int nViewId, bool* ignore) const override; + virtual std::optional<OString> getLOKPayload(int nType, int nViewId) const override; }; inline tools::Long SwView::GetXScroll() const diff --git a/sw/inc/viscrs.hxx b/sw/inc/viscrs.hxx index 6c41fcb61b7e..7866b6335f2a 100644 --- a/sw/inc/viscrs.hxx +++ b/sw/inc/viscrs.hxx @@ -26,6 +26,8 @@ #include "swregion.hxx" #include "swdllapi.h" +#include <optional> + namespace sdr::overlay { class OverlayObject; } class SwCursorShell; @@ -61,7 +63,7 @@ public: void SetPosAndShow(SfxViewShell const * pViewShell); const vcl::Cursor& GetTextCursor() const; - OString getLOKPayload(int nType, int nViewId, bool* ignore) const; + std::optional<OString> getLOKPayload(int nType, int nViewId) const; }; // From here classes/methods for selections. @@ -123,7 +125,7 @@ public: static void Get1PixelInLogic( const SwViewShell& rSh, tools::Long* pX = nullptr, tools::Long* pY = nullptr ); - OString getLOKPayload(int nType, int nViewId, bool* ignore) const; + std::optional<OString> getLOKPayload(int nType, int nViewId) const; }; class SW_DLLPUBLIC SwShellCursor : public virtual SwCursor, public SwSelPaintRects diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx index 588f572de73d..2575495b1328 100644 --- a/sw/source/core/crsr/viscrs.cxx +++ b/sw/source/core/crsr/viscrs.cxx @@ -271,7 +271,7 @@ void SwVisibleCursor::SetPosAndShow(SfxViewShell const * pViewShell) m_aTextCursor.Show(); } -OString SwVisibleCursor::getLOKPayload(int nType, int nViewId, bool*) const +std::optional<OString> SwVisibleCursor::getLOKPayload(int nType, int nViewId) const { assert(nType == LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR || nType == LOK_CALLBACK_INVALIDATE_VIEW_CURSOR); if (comphelper::LibreOfficeKit::isActive()) @@ -516,7 +516,7 @@ void SwSelPaintRects::Show(std::vector<OString>* pSelectionRectangles) pSelectionRectangles->push_back(sRect); } -OString SwSelPaintRects::getLOKPayload( int nType, int nViewId, bool* ignore ) const +std::optional<OString> SwSelPaintRects::getLOKPayload(int nType, int nViewId) const { switch( nType ) { @@ -534,24 +534,19 @@ OString SwSelPaintRects::getLOKPayload( int nType, int nViewId, bool* ignore ) c // no selection rect if (!size()) - { - *ignore = true; - return OString(); - } + return {}; if( nType == LOK_CALLBACK_TEXT_SELECTION_START ) { if (aStartRect.HasArea()) return aStartRect.SVRect().toString(); - *ignore = true; - return OString(); + return {}; } else // LOK_CALLBACK_TEXT_SELECTION_END { if (aEndRect.HasArea()) return aEndRect.SVRect().toString(); - *ignore = true; - return OString(); + return {}; } } break; diff --git a/sw/source/uibase/inc/wrtsh.hxx b/sw/source/uibase/inc/wrtsh.hxx index 2f7fb5fa7b06..316e0b511a29 100644 --- a/sw/source/uibase/inc/wrtsh.hxx +++ b/sw/source/uibase/inc/wrtsh.hxx @@ -506,7 +506,7 @@ typedef bool (SwWrtShell::*FNSimpleMove)(); void InvalidateOutlineContentVisibility(); bool GetAttrOutlineContentVisible(const size_t nPos); - OString getLOKPayload(int nType, int nViewId, bool* ignore) const; + std::optional<OString> getLOKPayload(int nType, int nViewId) const; private: diff --git a/sw/source/uibase/uiview/view.cxx b/sw/source/uibase/uiview/view.cxx index 9fa0064386e6..4e68b6e04bf0 100644 --- a/sw/source/uibase/uiview/view.cxx +++ b/sw/source/uibase/uiview/view.cxx @@ -1916,11 +1916,11 @@ void SwView::flushPendingLOKInvalidateTiles() pSh->FlushPendingLOKInvalidateTiles(); } -OString SwView::getLOKPayload(int nType, int nViewId, bool* ignore) const +std::optional<OString> SwView::getLOKPayload(int nType, int nViewId) const { SwWrtShell* pSh = GetWrtShellPtr(); assert(pSh); - return pSh->getLOKPayload(nType, nViewId, ignore); + return pSh->getLOKPayload(nType, nViewId); } OUString SwView::GetDataSourceName() const diff --git a/sw/source/uibase/wrtsh/wrtsh4.cxx b/sw/source/uibase/wrtsh/wrtsh4.cxx index d15bb7710c37..0442e3152bb6 100644 --- a/sw/source/uibase/wrtsh/wrtsh4.cxx +++ b/sw/source/uibase/wrtsh/wrtsh4.cxx @@ -234,18 +234,18 @@ bool SwWrtShell::BwdPara_() return bRet; } -OString SwWrtShell::getLOKPayload(int nType, int nViewId, bool* ignore) const +std::optional<OString> SwWrtShell::getLOKPayload(int nType, int nViewId) const { switch(nType) { case LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR: case LOK_CALLBACK_INVALIDATE_VIEW_CURSOR: - return GetVisibleCursor()->getLOKPayload(nType, nViewId, ignore); + return GetVisibleCursor()->getLOKPayload(nType, nViewId); case LOK_CALLBACK_TEXT_SELECTION: case LOK_CALLBACK_TEXT_SELECTION_START: case LOK_CALLBACK_TEXT_SELECTION_END: case LOK_CALLBACK_TEXT_VIEW_SELECTION: - return GetCursor_()->getLOKPayload( nType, nViewId, ignore ); + return GetCursor_()->getLOKPayload(nType, nViewId); } abort(); } |