diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2019-10-07 17:46:36 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2019-10-08 14:30:55 +0200 |
commit | ef2ec07b4113fdadf863352c832af657b5ae205c (patch) | |
tree | 8cf3b8cd14fb3aca94c8c8838223553044cc43e1 /include/editeng/svxacorr.hxx | |
parent | cf1b5ae4c5f7c9111a745199ac993742f9007263 (diff) |
tdf#128009: Allow spaces in AutoText suggestions
Currently autotext entries with long names starting with spaces, or
containing spaces after first or second character, would never be
suggested when SvxAutoCorrCfg::IsAutoTextTip() gives true (set in
Tools -> AutoCorrect -> [x] Display remainder of name as suggestion
while typing), because only a single word no less than 3 chars long
left to cursor is considered a candidate for the name matching.
This change allows to consider multiple chunks of text left to the
cursor as the candidates for name matching. The chunks are 3-9
characters long, may start only between words, and have spaces,
including leading. Thus, AutoText entries with long names like
" Dr Foo" will now be suggested for an entry like "lorem dr f".
Change-Id: If91c957341a4f4b281acb0e4ada558706ea2f8c1
Reviewed-on: https://gerrit.libreoffice.org/80392
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'include/editeng/svxacorr.hxx')
-rw-r--r-- | include/editeng/svxacorr.hxx | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/include/editeng/svxacorr.hxx b/include/editeng/svxacorr.hxx index 5803938ce966..46c3df27f18f 100644 --- a/include/editeng/svxacorr.hxx +++ b/include/editeng/svxacorr.hxx @@ -291,8 +291,13 @@ public: // Return for the autotext expansion the previous word, // AutoCorrect - corresponding algorithm - bool GetPrevAutoCorrWord( SvxAutoCorrDoc const & rDoc, const OUString& rTxt, - sal_Int32 nPos, OUString& rWord ); + OUString GetPrevAutoCorrWord(SvxAutoCorrDoc const& rDoc, const OUString& rTxt, sal_Int32 nPos); + + // Returns vector candidates for AutoText name match, starting with the longest string between + // 3 and 9 characters long, that is a chunk of text starting with a whitespace or with a word's + // first character, and ending at the current cursor position or empty string if no such string + // exists + static std::vector<OUString> GetChunkForAutoText(const OUString& rTxt, sal_Int32 nPos); // Search for the words in the replacement table. // rText - check in this text the words of the list @@ -331,6 +336,7 @@ public: // Query/Set the current settings of AutoCorrect ACFlags GetFlags() const { return nFlags; } SvxSwAutoFormatFlags& GetSwFlags() { return aSwFlags;} + const SvxSwAutoFormatFlags& GetSwFlags() const { return aSwFlags; } bool IsAutoCorrFlag( ACFlags nFlag ) const { return bool(nFlags & nFlag); } void SetAutoCorrFlag( ACFlags nFlag, bool bOn = true ); |