diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-03-07 10:14:50 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-03-07 15:48:59 +0000 |
commit | 48fad5ddb1d65568ba1cb6539a19821fd1fbc6d1 (patch) | |
tree | be179ed6d3292bd0be45beac9609a4e7c201ea09 /editeng | |
parent | 6231b4b2a8bcfdcb80c5b4555f6a9d2c9946b9c6 (diff) |
no need to allocate these separately
they are all one or two words in size
Change-Id: I56f00947c92c7b092dee534a6eecf6caedbafa2f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148378
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/source/editeng/eehtml.cxx | 16 | ||||
-rw-r--r-- | editeng/source/editeng/eehtml.hxx | 4 | ||||
-rw-r--r-- | editeng/source/editeng/impedit.hxx | 2 | ||||
-rw-r--r-- | editeng/source/editeng/impedit5.cxx | 14 |
4 files changed, 18 insertions, 18 deletions
diff --git a/editeng/source/editeng/eehtml.cxx b/editeng/source/editeng/eehtml.cxx index cc26360df6a2..b3ed28395506 100644 --- a/editeng/source/editeng/eehtml.cxx +++ b/editeng/source/editeng/eehtml.cxx @@ -184,9 +184,9 @@ void EditHTMLParser::NextToken( HtmlTokenId nToken ) if ( aText.startsWith(" ") && ThrowAwayBlank() && !IsReadPRE() ) aText = aText.copy( 1 ); - if ( pCurAnchor ) + if ( moCurAnchor ) { - pCurAnchor->aText += aText; + moCurAnchor->aText += aText; } else { @@ -739,7 +739,7 @@ bool EditHTMLParser::HasTextInCurrentPara() void EditHTMLParser::AnchorStart() { // ignore anchor in anchor - if ( pCurAnchor ) + if ( moCurAnchor ) return; const HTMLOptions& aOptions = GetOptions(); @@ -762,20 +762,20 @@ void EditHTMLParser::AnchorStart() aRootURL.GetNewAbsURL( aRef, &aTargetURL ); aURL = aTargetURL.GetMainURL( INetURLObject::DecodeMechanism::ToIUri ); } - pCurAnchor.reset( new AnchorInfo ); - pCurAnchor->aHRef = aURL; + moCurAnchor.emplace(); + moCurAnchor->aHRef = aURL; } void EditHTMLParser::AnchorEnd() { - if ( !pCurAnchor ) + if ( !moCurAnchor ) return; // Insert as URL-Field... - SvxFieldItem aFld( SvxURLField( pCurAnchor->aHRef, pCurAnchor->aText, SvxURLFormat::Repr ), EE_FEATURE_FIELD ); + SvxFieldItem aFld( SvxURLField( moCurAnchor->aHRef, moCurAnchor->aText, SvxURLFormat::Repr ), EE_FEATURE_FIELD ); aCurSel = mpEditEngine->InsertField(aCurSel, aFld); bFieldsInserted = true; - pCurAnchor.reset(); + moCurAnchor.reset(); if (mpEditEngine->IsHtmlImportHandlerSet()) { diff --git a/editeng/source/editeng/eehtml.hxx b/editeng/source/editeng/eehtml.hxx index ebcb4def0e02..fddd567ac6ba 100644 --- a/editeng/source/editeng/eehtml.hxx +++ b/editeng/source/editeng/eehtml.hxx @@ -20,6 +20,7 @@ #pragma once #include <memory> +#include <optional> #include <editdoc.hxx> #include <rtl/ustrbuf.hxx> #include <svtools/parhtml.hxx> @@ -40,8 +41,7 @@ private: EditSelection aCurSel; OUString aBaseURL; EditEngine* mpEditEngine; - std::unique_ptr<AnchorInfo> - pCurAnchor; + std::optional<AnchorInfo> moCurAnchor; bool bInPara:1; bool bWasInPara:1; // Remember bInPara before HeadingStart, because afterwards it will be gone. diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx index f75e71b7f509..fd8ff61f66ca 100644 --- a/editeng/source/editeng/impedit.hxx +++ b/editeng/source/editeng/impedit.hxx @@ -517,7 +517,7 @@ private: mutable std::unique_ptr<SfxItemSet> pEmptyItemSet; EditUndoManager* pUndoManager; - std::unique_ptr<ESelection> pUndoMarkSelection; + std::optional<ESelection> moUndoMarkSelection; std::unique_ptr<ImplIMEInfos> mpIMEInfos; diff --git a/editeng/source/editeng/impedit5.cxx b/editeng/source/editeng/impedit5.cxx index 9a02ca4c4557..3a87c4b5bfb7 100644 --- a/editeng/source/editeng/impedit5.cxx +++ b/editeng/source/editeng/impedit5.cxx @@ -233,8 +233,8 @@ void ImpEditEngine::UndoActionStart( sal_uInt16 nId, const ESelection& aSel ) if ( IsUndoEnabled() && !IsInUndo() ) { GetUndoManager().EnterListAction( GetEditEnginePtr()->GetUndoComment( nId ), OUString(), nId, CreateViewShellId() ); - DBG_ASSERT( !pUndoMarkSelection, "UndoAction SelectionMarker?" ); - pUndoMarkSelection.reset(new ESelection( aSel )); + DBG_ASSERT( !moUndoMarkSelection, "UndoAction SelectionMarker?" ); + moUndoMarkSelection = aSel; } } @@ -243,7 +243,7 @@ void ImpEditEngine::UndoActionStart( sal_uInt16 nId ) if ( IsUndoEnabled() && !IsInUndo() ) { GetUndoManager().EnterListAction( GetEditEnginePtr()->GetUndoComment( nId ), OUString(), nId, CreateViewShellId() ); - DBG_ASSERT( !pUndoMarkSelection, "UndoAction SelectionMarker?" ); + DBG_ASSERT( !moUndoMarkSelection, "UndoAction SelectionMarker?" ); } } @@ -252,17 +252,17 @@ void ImpEditEngine::UndoActionEnd() if ( IsUndoEnabled() && !IsInUndo() ) { GetUndoManager().LeaveListAction(); - pUndoMarkSelection.reset(); + moUndoMarkSelection.reset(); } } void ImpEditEngine::InsertUndo( std::unique_ptr<EditUndo> pUndo, bool bTryMerge ) { DBG_ASSERT( !IsInUndo(), "InsertUndo in Undo mode!" ); - if ( pUndoMarkSelection ) + if ( moUndoMarkSelection ) { - GetUndoManager().AddUndoAction( std::make_unique<EditUndoMarkSelection>(pEditEngine, *pUndoMarkSelection) ); - pUndoMarkSelection.reset(); + GetUndoManager().AddUndoAction( std::make_unique<EditUndoMarkSelection>(pEditEngine, *moUndoMarkSelection) ); + moUndoMarkSelection.reset(); } GetUndoManager().AddUndoAction( std::move(pUndo), bTryMerge ); |