use more concrete type in ImpEditEngine::SetUndoManager

instead of dynamic_cast'ing to the type we want, and __ignoring__ the
parameter if it is not, just adjust the type that we want, which
luckily everything is already sending

Change-Id: If083e11c9818cdcae199afc1261efbdb652e1c76
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159295
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2023-11-11 11:03:58 +01:00
parent f5926c8cfb
commit 9bba3a604d
22 changed files with 36 additions and 18 deletions
+4 -3
View File
@@ -26,6 +26,7 @@
#include <svl/undo.hxx>
#include <tools/debug.hxx>
#include <unotools/lingucfg.hxx>
#include <editeng/editund2.hxx>
#include <editeng/colritem.hxx>
#include <editeng/eeitem.hxx>
#include <editeng/langitem.hxx>
@@ -2078,7 +2079,7 @@ svx::SpellPortions SentenceEditWindow_Impl::CreateSpellPortions() const
void SentenceEditWindow_Impl::Undo()
{
SfxUndoManager& rUndoMgr = m_xEditEngine->GetUndoManager();
EditUndoManager& rUndoMgr = m_xEditEngine->GetUndoManager();
DBG_ASSERT(GetUndoActionCount(), "no undo actions available" );
if(!GetUndoActionCount())
return;
@@ -2097,13 +2098,13 @@ void SentenceEditWindow_Impl::Undo()
void SentenceEditWindow_Impl::ResetUndo()
{
SfxUndoManager& rUndo = m_xEditEngine->GetUndoManager();
EditUndoManager& rUndo = m_xEditEngine->GetUndoManager();
rUndo.Clear();
}
void SentenceEditWindow_Impl::AddUndoAction( std::unique_ptr<SfxUndoAction> pAction )
{
SfxUndoManager& rUndoMgr = m_xEditEngine->GetUndoManager();
EditUndoManager& rUndoMgr = m_xEditEngine->GetUndoManager();
rUndoMgr.AddUndoAction(std::move(pAction));
GetSpellDialog()->m_xUndoPB->set_sensitive(true);
}
+2 -2
View File
@@ -112,12 +112,12 @@ bool EditEngine::IsInUndo() const
return pImpEditEngine->IsInUndo();
}
SfxUndoManager& EditEngine::GetUndoManager()
EditUndoManager& EditEngine::GetUndoManager()
{
return pImpEditEngine->GetUndoManager();
}
SfxUndoManager* EditEngine::SetUndoManager(SfxUndoManager* pNew)
EditUndoManager* EditEngine::SetUndoManager(EditUndoManager* pNew)
{
return pImpEditEngine->SetUndoManager(pNew);
}
+4 -4
View File
@@ -838,7 +838,7 @@ public:
ImpEditEngine& operator=(const ImpEditEngine&) = delete;
inline EditUndoManager& GetUndoManager();
inline SfxUndoManager* SetUndoManager(SfxUndoManager* pNew);
inline EditUndoManager* SetUndoManager(EditUndoManager* pNew);
// @return the previous bUpdateLayout state
bool SetUpdateLayout( bool bUpdate, EditView* pCurView = nullptr, bool bForceUpdate = false );
@@ -1295,16 +1295,16 @@ inline EditUndoManager& ImpEditEngine::GetUndoManager()
return *pUndoManager;
}
inline SfxUndoManager* ImpEditEngine::SetUndoManager(SfxUndoManager* pNew)
inline EditUndoManager* ImpEditEngine::SetUndoManager(EditUndoManager* pNew)
{
SfxUndoManager* pRetval = pUndoManager;
EditUndoManager* pRetval = pUndoManager;
if(pUndoManager)
{
pUndoManager->SetEditEngine(nullptr);
}
pUndoManager = dynamic_cast< EditUndoManager* >(pNew);
pUndoManager = pNew;
if(pUndoManager)
{
+2 -2
View File
@@ -1142,12 +1142,12 @@ void Outliner::ImpFilterIndents( sal_Int32 nFirstPara, sal_Int32 nLastPara )
pEditEngine->SetUpdateLayout( bUpdate );
}
SfxUndoManager& Outliner::GetUndoManager()
EditUndoManager& Outliner::GetUndoManager()
{
return pEditEngine->GetUndoManager();
}
SfxUndoManager* Outliner::SetUndoManager(SfxUndoManager* pNew)
EditUndoManager* Outliner::SetUndoManager(EditUndoManager* pNew)
{
return pEditEngine->SetUndoManager(pNew);
}
+3 -2
View File
@@ -77,6 +77,7 @@ namespace editeng {
}
class ImpEditEngine;
class EditUndoManager;
class EditView;
class OutputDevice;
class SvxFont;
@@ -349,8 +350,8 @@ public:
void ShowParagraph( sal_Int32 nParagraph, bool bShow );
SfxUndoManager& GetUndoManager();
SfxUndoManager* SetUndoManager(SfxUndoManager* pNew);
EditUndoManager& GetUndoManager();
EditUndoManager* SetUndoManager(EditUndoManager* pNew);
void UndoActionStart( sal_uInt16 nId );
void UndoActionStart(sal_uInt16 nId, const ESelection& rSel);
void UndoActionEnd();
+3 -2
View File
@@ -52,6 +52,7 @@ class OutlinerEditEng;
class Outliner;
class EditView;
class EditUndo;
class EditUndoManager;
class ParagraphList;
class OutlinerParaObject;
class SvStream;
@@ -885,8 +886,8 @@ public:
ErrCode Read( SvStream& rInput, const OUString& rBaseURL, EETextFormat, SvKeyValueIterator* pHTTPHeaderAttrs = nullptr );
SfxUndoManager& GetUndoManager();
SfxUndoManager* SetUndoManager(SfxUndoManager* pNew);
EditUndoManager& GetUndoManager();
EditUndoManager* SetUndoManager(EditUndoManager* pNew);
void QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel );
void QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel );
+1 -1
View File
@@ -109,7 +109,7 @@ protected:
rtl::Reference< sdr::SelectionController > mxLastSelectionController;
private:
SfxUndoManager* mpOldTextEditUndoManager;
EditUndoManager* mpOldTextEditUndoManager;
std::unique_ptr<SdrUndoManager> mpLocalTextEditUndoManager;
protected:
+1
View File
@@ -37,6 +37,7 @@
#include <editeng/lspcitem.hxx>
#include <editeng/ulspitem.hxx>
#include <editeng/urlfieldhelper.hxx>
#include <editeng/editund2.hxx>
#include <svx/hlnkitem.hxx>
#include <svx/svdoutl.hxx>
#include <svx/sdooitm.hxx>
+1
View File
@@ -25,6 +25,7 @@
#include <svx/svdotext.hxx>
#include <svx/sdtagitm.hxx>
#include <editeng/unolingu.hxx>
#include <editeng/editund2.hxx>
#include <sfx2/bindings.hxx>
#include <sfx2/dispatch.hxx>
#include <sfx2/viewfrm.hxx>
+1
View File
@@ -35,6 +35,7 @@
#include <editeng/flstitem.hxx>
#include <editeng/fontitem.hxx>
#include <editeng/urlfieldhelper.hxx>
#include <editeng/editund2.hxx>
#include <svx/hlnkitem.hxx>
#include <vcl/EnumContext.hxx>
#include <editeng/postitem.hxx>
@@ -28,6 +28,7 @@
#include <editeng/postitem.hxx>
#include <editeng/wghtitem.hxx>
#include <editeng/crossedoutitem.hxx>
#include <editeng/editund2.hxx>
#include <svx/svxids.hrc>
#include <unotools/useroptions.hxx>
+3 -2
View File
@@ -22,6 +22,7 @@
#include <sfx2/bindings.hxx>
#include <sfx2/viewfrm.hxx>
#include <editeng/eeitem.hxx>
#include <editeng/editund2.hxx>
#include <svl/poolitem.hxx>
#include <editeng/fontitem.hxx>
#include <OutlineView.hxx>
@@ -128,7 +129,7 @@ void FuBullet::InsertFormattingMark( sal_Unicode cMark )
pOV->InsertText( "" );
// prepare undo
SfxUndoManager& rUndoMgr = pOL->GetUndoManager();
EditUndoManager& rUndoMgr = pOL->GetUndoManager();
rUndoMgr.EnterListAction(SdResId(STR_UNDO_INSERT_SPECCHAR),
"", 0, mpViewShell->GetViewShellBase().GetViewShellId() );
@@ -239,7 +240,7 @@ void FuBullet::InsertSpecialCharacter( SfxRequest const & rReq )
SfxItemSetFixed<EE_CHAR_FONTINFO, EE_CHAR_FONTINFO> aOldSet( mpDoc->GetPool() );
aOldSet.Put( pOV->GetAttribs() );
SfxUndoManager& rUndoMgr = pOL->GetUndoManager();
EditUndoManager& rUndoMgr = pOL->GetUndoManager();
ViewShellId nViewShellId = mpViewShell ? mpViewShell->GetViewShellBase().GetViewShellId() : ViewShellId(-1);
rUndoMgr.EnterListAction(SdResId(STR_UNDO_INSERT_SPECCHAR),
"", 0, nViewShellId );
+1
View File
@@ -23,6 +23,7 @@
#include <editeng/outliner.hxx>
#include <editeng/outlobj.hxx>
#include <editeng/editeng.hxx>
#include <editeng/editund2.hxx>
#include <svl/stritem.hxx>
#include <sfx2/request.hxx>
#include <sfx2/app.hxx>
+1
View File
@@ -32,6 +32,7 @@
#include <editeng/outliner.hxx>
#include <editeng/unolingu.hxx>
#include <editeng/kernitem.hxx>
#include <editeng/editund2.hxx>
#include <svl/whiter.hxx>
#include <svl/itempool.hxx>
#include <svl/stritem.hxx>
+1
View File
@@ -32,6 +32,7 @@
#include <editeng/editview.hxx>
#include <editeng/eeitem.hxx>
#include <editeng/flditem.hxx>
#include <editeng/editund2.hxx>
#include <sfx2/shell.hxx>
#include <sfx2/request.hxx>
#include <svx/hlnkitem.hxx>
+1
View File
@@ -82,6 +82,7 @@
#include <editeng/eeitem.hxx>
#include <editeng/editview.hxx>
#include <editeng/editeng.hxx>
#include <editeng/editund2.hxx>
#include <svl/itempool.hxx>
#include <svl/intitem.hxx>
#include <svl/poolitem.hxx>
+1
View File
@@ -83,6 +83,7 @@
#include <oox/mathml/imexport.hxx>
#include <ElementsDockingWindow.hxx>
#include <smediteng.hxx>
#include <editeng/editund2.hxx>
#define ShellClass_SmDocShell
#include <smslots.hxx>
+1
View File
@@ -63,6 +63,7 @@
#include <svx/zoomslideritem.hxx>
#include <editeng/editeng.hxx>
#include <editeng/editview.hxx>
#include <editeng/editund2.hxx>
#include <svx/svxdlg.hxx>
#include <sfx2/zoomitem.hxx>
#include <vcl/commandevent.hxx>
+1
View File
@@ -41,6 +41,7 @@
#include <editeng/postitem.hxx>
#include <editeng/fhgtitem.hxx>
#include <editeng/langitem.hxx>
#include <editeng/editund2.hxx>
#include <editeng/editview.hxx>
#include <editeng/outliner.hxx>
@@ -45,6 +45,7 @@
#include <editeng/editeng.hxx>
#include <editeng/eeitem.hxx>
#include <editeng/outlobj.hxx>
#include <editeng/editund2.hxx>
#include <svl/undo.hxx>
#include <svl/stritem.hxx>
+1
View File
@@ -33,6 +33,7 @@
#include <sfx2/bindings.hxx>
#include <sfx2/dispatch.hxx>
#include <sfx2/request.hxx>
#include <editeng/editund2.hxx>
#include <editeng/eeitem.hxx>
#include <editeng/flstitem.hxx>
#include <editeng/spltitem.hxx>
+1
View File
@@ -24,6 +24,7 @@
#include <svl/slstitm.hxx>
#include <svl/stritem.hxx>
#include <editeng/fontitem.hxx>
#include <editeng/editund2.hxx>
#include <svx/svdview.hxx>
#include <sfx2/viewfrm.hxx>
#include <sfx2/objface.hxx>