diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2019-12-29 14:00:14 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-01-01 09:37:37 +0100 |
commit | 4992d61600536fe14b97b718dbb11f00e936c6a9 (patch) | |
tree | 870274981061d3f16896f1a9ddaea4a807bcb9da /sc/source/ui/docshell | |
parent | 6dfa6d3d53369ef3cce86717fb1923fc9fcb7982 (diff) |
tdf#129228 speedup opening of xlsx file with lots of comments
de-UNOise the Comment::finalizeImport method, so we can build
a better custom import code path, that does not touch all the stuff
that updating a running UI needs.
The primary improvements comes from using setPropertyValues
to set a bunch of props together.
This takes the opening time from 61s to 53s for me.
Change-Id: I5506a5a37a9b4b84b6930f0563a775a8aa0a9e2c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/85947
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc/source/ui/docshell')
-rw-r--r-- | sc/source/ui/docshell/docfunc.cxx | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index b9598ed24c55..b65edc73a8c0 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -1363,6 +1363,29 @@ void ScDocFunc::ReplaceNote( const ScAddress& rPos, const OUString& rNoteText, c } } +ScPostIt* ScDocFunc::ImportNote( const ScAddress& rPos, const OUString& rNoteText, const OUString* pAuthor, const OUString* pDate ) +{ + ScDocShellModificator aModificator( rDocShell ); + ScDocument& rDoc = rDocShell.GetDocument(); + + std::unique_ptr<ScPostIt> pOldNote = rDoc.ReleaseNote( rPos ); + assert(!pOldNote && "imported data has >1 notes on same cell?"); + + // create new note + ScPostIt* pNewNote = nullptr; + if( (pNewNote = ScNoteUtil::CreateNoteFromString( rDoc, rPos, rNoteText, false, true, /*nNoteId*/0 )) ) + { + if( pAuthor ) pNewNote->SetAuthor( *pAuthor ); + if( pDate ) pNewNote->SetDate( *pDate ); + } + + rDoc.SetStreamValid(rPos.Tab(), false); + + aModificator.SetDocumentModified(); + + return pNewNote; +} + bool ScDocFunc::ApplyAttributes( const ScMarkData& rMark, const ScPatternAttr& rPattern, bool bApi ) { |