Kaydet (Commit) 3c5d5ff4 authored tarafından Jochen Nitschke's avatar Jochen Nitschke Kaydeden (comit) Noel Grandin

svx: pass struct by const reference ...

and use references instead of pointers for output parameters.

Change-Id: Ib91a821ff84e464639aa6f09a44ba00301f1d783
Reviewed-on: https://gerrit.libreoffice.org/39220Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 7562c5f3
...@@ -26,6 +26,8 @@ class SdrObjEditView; ...@@ -26,6 +26,8 @@ class SdrObjEditView;
class SdrTextObj; class SdrTextObj;
class KeyEvent; class KeyEvent;
class SdrOutliner; class SdrOutliner;
enum class CursorChainingEvent;
struct ESelection;
class SVX_DLLPUBLIC TextChainCursorManager class SVX_DLLPUBLIC TextChainCursorManager
...@@ -37,11 +39,11 @@ public: ...@@ -37,11 +39,11 @@ public:
// Used by HandledKeyEvent and basic building block for handling cursor event // Used by HandledKeyEvent and basic building block for handling cursor event
void HandleCursorEvent(const CursorChainingEvent aCurEvt, void HandleCursorEvent(const CursorChainingEvent aCurEvt,
const ESelection aNewSel); const ESelection& aNewSel);
// To be used after chaining event to deal with some nuisances // To be used after chaining event to deal with some nuisances
void HandleCursorEventAfterChaining(const CursorChainingEvent aCurEvt, void HandleCursorEventAfterChaining(const CursorChainingEvent aCurEvt,
const ESelection aNewSel); const ESelection& aNewSel);
private: private:
SdrObjEditView *mpEditView; SdrObjEditView *mpEditView;
...@@ -52,9 +54,9 @@ private: ...@@ -52,9 +54,9 @@ private:
void impChangeEditingTextObj(SdrTextObj *pTargetTextObj, ESelection aNewSel); void impChangeEditingTextObj(SdrTextObj *pTargetTextObj, ESelection aNewSel);
void impDetectEvent(const KeyEvent& rKEvt, void impDetectEvent(const KeyEvent& rKEvt,
CursorChainingEvent *pOutCursorEvt, CursorChainingEvent& rOutCursorEvt,
ESelection *pOutSel, ESelection& rOutSel,
bool *bOutHandled); bool& rOutHandled);
}; };
......
...@@ -43,7 +43,7 @@ bool TextChainCursorManager::HandleKeyEvent( const KeyEvent& rKEvt ) ...@@ -43,7 +43,7 @@ bool TextChainCursorManager::HandleKeyEvent( const KeyEvent& rKEvt )
// check what the cursor/event situation looks like // check what the cursor/event situation looks like
bool bCompletelyHandled = false; bool bCompletelyHandled = false;
impDetectEvent(rKEvt, &aCursorEvent, &aNewSel, &bCompletelyHandled); impDetectEvent(rKEvt, aCursorEvent, aNewSel, bCompletelyHandled);
if (aCursorEvent == CursorChainingEvent::NULL_EVENT) if (aCursorEvent == CursorChainingEvent::NULL_EVENT)
return false; return false;
...@@ -55,9 +55,9 @@ bool TextChainCursorManager::HandleKeyEvent( const KeyEvent& rKEvt ) ...@@ -55,9 +55,9 @@ bool TextChainCursorManager::HandleKeyEvent( const KeyEvent& rKEvt )
} }
void TextChainCursorManager::impDetectEvent(const KeyEvent& rKEvt, void TextChainCursorManager::impDetectEvent(const KeyEvent& rKEvt,
CursorChainingEvent *pOutCursorEvt, CursorChainingEvent& rOutCursorEvt,
ESelection *pOutSel, ESelection& rOutSel,
bool *bOutHandled) bool& rOutHandled)
{ {
SdrOutliner *pOutl = mpEditView->GetTextEditOutliner(); SdrOutliner *pOutl = mpEditView->GetTextEditOutliner();
OutlinerView *pOLV = mpEditView->GetTextEditOutlinerView(); OutlinerView *pOLV = mpEditView->GetTextEditOutlinerView();
...@@ -70,7 +70,7 @@ void TextChainCursorManager::impDetectEvent(const KeyEvent& rKEvt, ...@@ -70,7 +70,7 @@ void TextChainCursorManager::impDetectEvent(const KeyEvent& rKEvt,
// We need to have this KeyFuncType // We need to have this KeyFuncType
if (eFunc != KeyFuncType::DONTKNOW && eFunc != KeyFuncType::DELETE) if (eFunc != KeyFuncType::DONTKNOW && eFunc != KeyFuncType::DELETE)
{ {
*pOutCursorEvt = CursorChainingEvent::NULL_EVENT; rOutCursorEvt = CursorChainingEvent::NULL_EVENT;
return; return;
} }
...@@ -89,18 +89,18 @@ void TextChainCursorManager::impDetectEvent(const KeyEvent& rKEvt, ...@@ -89,18 +89,18 @@ void TextChainCursorManager::impDetectEvent(const KeyEvent& rKEvt,
// Possibility: Are we "pushing" at the end of the object? // Possibility: Are we "pushing" at the end of the object?
if (nCode == KEY_RIGHT && bAtEndOfTextContent && pNextLink) if (nCode == KEY_RIGHT && bAtEndOfTextContent && pNextLink)
{ {
*pOutCursorEvt = CursorChainingEvent::TO_NEXT_LINK; rOutCursorEvt = CursorChainingEvent::TO_NEXT_LINK;
// Selection unchanged: we are at the beginning of the box // Selection unchanged: we are at the beginning of the box
*bOutHandled = true; // Nothing more to do than move cursor rOutHandled = true; // Nothing more to do than move cursor
return; return;
} }
// Possibility: Are we "pushing" at the end of the object? // Possibility: Are we "pushing" at the end of the object?
if (eFunc == KeyFuncType::DELETE && bAtEndOfTextContent && pNextLink) if (eFunc == KeyFuncType::DELETE && bAtEndOfTextContent && pNextLink)
{ {
*pOutCursorEvt = CursorChainingEvent::TO_NEXT_LINK; rOutCursorEvt = CursorChainingEvent::TO_NEXT_LINK;
// Selection unchanged: we are at the beginning of the box // Selection unchanged: we are at the beginning of the box
*bOutHandled = false; // We still need to delete the characters rOutHandled = false; // We still need to delete the characters
mbHandlingDel = true; mbHandlingDel = true;
return; return;
} }
...@@ -111,29 +111,29 @@ void TextChainCursorManager::impDetectEvent(const KeyEvent& rKEvt, ...@@ -111,29 +111,29 @@ void TextChainCursorManager::impDetectEvent(const KeyEvent& rKEvt,
// Possibility: Are we "pushing" at the start of the object? // Possibility: Are we "pushing" at the start of the object?
if (nCode == KEY_LEFT && bAtStartOfTextContent && pPrevLink) if (nCode == KEY_LEFT && bAtStartOfTextContent && pPrevLink)
{ {
*pOutCursorEvt = CursorChainingEvent::TO_PREV_LINK; rOutCursorEvt = CursorChainingEvent::TO_PREV_LINK;
*pOutSel = aEndSelPrevBox; // Set at end of selection rOutSel = aEndSelPrevBox; // Set at end of selection
*bOutHandled = true; // Nothing more to do than move cursor rOutHandled = true; // Nothing more to do than move cursor
return; return;
} }
// Possibility: Are we "pushing" at the start of the object and deleting left? // Possibility: Are we "pushing" at the start of the object and deleting left?
if (nCode == KEY_BACKSPACE && bAtStartOfTextContent && pPrevLink) if (nCode == KEY_BACKSPACE && bAtStartOfTextContent && pPrevLink)
{ {
*pOutCursorEvt = CursorChainingEvent::TO_PREV_LINK; rOutCursorEvt = CursorChainingEvent::TO_PREV_LINK;
*pOutSel = aEndSelPrevBox; // Set at end of selection rOutSel = aEndSelPrevBox; // Set at end of selection
*bOutHandled = false; // We need to delete characters after moving cursor rOutHandled = false; // We need to delete characters after moving cursor
return; return;
} }
// If arrived here there is no event detected // If arrived here there is no event detected
*pOutCursorEvt = CursorChainingEvent::NULL_EVENT; rOutCursorEvt = CursorChainingEvent::NULL_EVENT;
} }
void TextChainCursorManager::HandleCursorEventAfterChaining( void TextChainCursorManager::HandleCursorEventAfterChaining(
const CursorChainingEvent aCurEvt, const CursorChainingEvent aCurEvt,
const ESelection aNewSel) const ESelection& aNewSel)
{ {
// Special case for DELETE handling: we need to get back at the end of the prev box // Special case for DELETE handling: we need to get back at the end of the prev box
...@@ -155,7 +155,7 @@ void TextChainCursorManager::HandleCursorEventAfterChaining( ...@@ -155,7 +155,7 @@ void TextChainCursorManager::HandleCursorEventAfterChaining(
void TextChainCursorManager::HandleCursorEvent( void TextChainCursorManager::HandleCursorEvent(
const CursorChainingEvent aCurEvt, const CursorChainingEvent aCurEvt,
const ESelection aNewSel) const ESelection& aNewSel)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment