diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2021-10-07 16:48:46 +0200 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2021-10-20 16:25:16 +0200 |
commit | c175c1dc19d0edc8ca66e39f0b4b8af04e3d6c87 (patch) | |
tree | 04e074d7e034642a4e4025e106dc20db09ca9ee2 /include | |
parent | 85d53dafd8332fc9c7bf71d6cc9da19ab9d8e252 (diff) |
svx: Don't end text edit mode for all views
This allows multiple views to not disturb each other editing inside
a impress document. With the ending of text edit for all views still
enabled, one view can cancel other views text editing just by moving
or resizing a unrelated shape in the document.
To make this possible we also need a view-local undo manager for
the text edit mode, which is independent of the document undo
manager. When the text edit mode ends, all the changes will be
added as one change to the document undo stack. This prevents any
conflicts in the undo stack that could be made when 2 views are
editing the same document at the same time.
This also adds the test for the new use case and changes the existing
tests to reflect the change.
Change-Id: I04edb4f91d7e111a490c946f7121cbca75f818d7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123220
Tested-by: Tomaž Vajngerl <quikee@gmail.com>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/svx/svdedtv.hxx | 1 | ||||
-rw-r--r-- | include/svx/svdedxv.hxx | 13 |
2 files changed, 8 insertions, 6 deletions
diff --git a/include/svx/svdedtv.hxx b/include/svx/svdedtv.hxx index a21eeb3e0a43..6f80c3aca0fa 100644 --- a/include/svx/svdedtv.hxx +++ b/include/svx/svdedtv.hxx @@ -188,6 +188,7 @@ public: * Checks if this or other views have an active text edit, if true, end them. */ void EndTextEditAllViews() const; + void EndTextEditCurrentView(); std::vector< std::unique_ptr<SdrUndoAction> > CreateConnectorUndo( const SdrObject& rO ); void AddUndoActions( std::vector< std::unique_ptr<SdrUndoAction> > ); diff --git a/include/svx/svdedxv.hxx b/include/svx/svdedxv.hxx index a4f457c9aeba..a05a61c36c8d 100644 --- a/include/svx/svdedxv.hxx +++ b/include/svx/svdedxv.hxx @@ -109,18 +109,15 @@ protected: private: SfxUndoManager* mpOldTextEditUndoManager; + std::unique_ptr<SdrUndoManager> mpLocalTextEditUndoManager; protected: - // central method to get an SdrUndoManager for enhanced TextEdit. Default will - // try to return a dynamic_casted GetModel()->GetSdrUndoManager(). Applications - // which want to use this feature will need to override this virtual method, - // provide their document UndoManager and derive it from SdrUndoManager. - virtual SdrUndoManager* getSdrUndoManagerForEnhancedTextEdit() const; + // Create a local UndoManager that is used for text editing. + virtual std::unique_ptr<SdrUndoManager> createLocalTextUndoManager(); void ImpMoveCursorAfterChainingEvent(TextChainCursorManager *pCursorManager); std::unique_ptr<TextChainCursorManager> ImpHandleMotionThroughBoxesKeyInput(const KeyEvent& rKEvt, bool *bOutHandled); - OutlinerView* ImpFindOutlinerView(vcl::Window const * pWin) const; // Create a new OutlinerView at the heap and initialize all required parameters. @@ -180,6 +177,10 @@ public: virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override; virtual void ModelHasChanged() override; + const std::unique_ptr<SdrUndoManager>& getViewLocalUndoManager() const + { + return mpLocalTextEditUndoManager; + } // TextEdit over an outliner |