summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2016-05-18 15:50:20 +0200
committerAndras Timar <andras.timar@collabora.com>2016-10-23 22:17:12 +0200
commit2b53993f6899bcad14af911353fea6bf15a85ba5 (patch)
tree1eb3366833c42393f988546ded90166d774a37cd
parentae906545c664083f5917fbecd1f2d4caa1e61720 (diff)
Resolves: tdf#99930 SetReplaceLeadingSingleQuotationMark(false) for Calc
(cherry picked from commit 48d0affa114d6838c0e99f3f3588dd611a4a2b72) Backported. Call to InsertTextUserInput() changed to InsertText() Change-Id: I29906de6a4075b7de82bd6e16560b56b9b648e91 Reviewed-on: https://gerrit.libreoffice.org/29759 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: jan iversen <jani@documentfoundation.org> (cherry picked from commit 3a96b9da2a99faa695eb8579a543aeb618d859d8)
-rw-r--r--editeng/source/editeng/editeng.cxx5
-rw-r--r--editeng/source/editeng/impedit.hxx6
-rw-r--r--editeng/source/editeng/impedit2.cxx11
-rw-r--r--include/editeng/editeng.hxx4
-rw-r--r--sc/source/ui/app/inputhdl.cxx1
-rw-r--r--sc/source/ui/app/inputwin.cxx1
6 files changed, 27 insertions, 1 deletions
diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx
index baa5008e3011..dad41bdcccc3 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -2721,6 +2721,11 @@ void EditEngine::SetFirstWordCapitalization( bool bCapitalize )
pImpEditEngine->SetFirstWordCapitalization( bCapitalize );
}
+void EditEngine::SetReplaceLeadingSingleQuotationMark( bool bReplace )
+{
+ pImpEditEngine->SetReplaceLeadingSingleQuotationMark( bReplace );
+}
+
bool EditEngine::IsImportHandlerSet() const
{
return pImpEditEngine->aImportHdl.IsSet();
diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
index ee6e6d888a55..9a737d33a285 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -516,6 +516,7 @@ private:
bool bImpConvertFirstCall:1; // specifies if ImpConvert is called the very first time after Convert was called
bool bFirstWordCapitalization:1; // specifies if auto-correction should capitalize the first word or not
bool mbLastTryMerge:1;
+ bool mbReplaceLeadingSingleQuotationMark:1;
// Methods...
@@ -1026,6 +1027,11 @@ public:
/// specifies if auto-correction should capitalize the first word or not (default is on)
void SetFirstWordCapitalization( bool bCapitalize ) { bFirstWordCapitalization = bCapitalize; }
bool IsFirstWordCapitalization() const { return bFirstWordCapitalization; }
+
+ /** specifies if auto-correction should replace a leading single quotation
+ mark (apostrophe) or not (default is on) */
+ void SetReplaceLeadingSingleQuotationMark( bool bReplace ) { mbReplaceLeadingSingleQuotationMark = bReplace; }
+ bool IsReplaceLeadingSingleQuotationMark() const { return mbReplaceLeadingSingleQuotationMark; }
};
inline EPaM ImpEditEngine::CreateEPaM( const EditPaM& rPaM )
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index 83ca5d63208b..4572c71fab58 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -102,7 +102,8 @@ ImpEditEngine::ImpEditEngine( EditEngine* pEE, SfxItemPool* pItemPool ) :
bCallParaInsertedOrDeleted(false),
bImpConvertFirstCall(false),
bFirstWordCapitalization(true),
- mbLastTryMerge(false)
+ mbLastTryMerge(false),
+ mbReplaceLeadingSingleQuotationMark(true)
{
pEditEngine = pEE;
pRefDev = nullptr;
@@ -2469,6 +2470,14 @@ void ImpEditEngine::ImpRemoveParagraph( sal_Int32 nPara )
EditPaM ImpEditEngine::AutoCorrect( const EditSelection& rCurSel, sal_Unicode c,
bool bOverwrite, vcl::Window* pFrameWin )
{
+ // i.e. Calc has special needs regarding a leading single quotation mark
+ // when starting cell input.
+ if (c == '\'' && !IsReplaceLeadingSingleQuotationMark() &&
+ rCurSel.Min() == rCurSel.Max() && rCurSel.Max().GetIndex() == 0)
+ {
+ return InsertText( rCurSel, c, bOverwrite );
+ }
+
EditSelection aSel( rCurSel );
SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get().GetAutoCorrect();
if ( pAutoCorrect )
diff --git a/include/editeng/editeng.hxx b/include/editeng/editeng.hxx
index cf82ba182a7e..facd2774b576 100644
--- a/include/editeng/editeng.hxx
+++ b/include/editeng/editeng.hxx
@@ -529,6 +529,10 @@ public:
/// specifies if auto-correction should capitalize the first word or not (default is on)
void SetFirstWordCapitalization( bool bCapitalize );
+ /** specifies if auto-correction should replace a leading single quotation
+ mark (apostrophe) or not (default is on) */
+ void SetReplaceLeadingSingleQuotationMark( bool bReplace );
+
EditDoc& GetEditDoc();
const EditDoc& GetEditDoc() const;
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index 1d6ce11339b9..5da83ab25c7f 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -631,6 +631,7 @@ void ScInputHandler::ImplCreateEditEngine()
pEditDefaults = new SfxItemSet( pEngine->GetEmptyItemSet() );
pEngine->SetControlWord( pEngine->GetControlWord() | EEControlBits::AUTOCORRECT );
+ pEngine->SetReplaceLeadingSingleQuotationMark( false );
pEngine->SetModifyHdl( LINK( this, ScInputHandler, ModifyHdl ) );
}
}
diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index 6087d64fbdcd..a306bd293617 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -1190,6 +1190,7 @@ void ScMultiTextWnd::InitEditEngine()
pEditEngine->SetPaperSize( PixelToLogic(Size(barSize.Width(),10000)) );
pEditEngine->SetWordDelimiters(
ScEditUtil::ModifyDelimiters( pEditEngine->GetWordDelimiters() ) );
+ pEditEngine->SetReplaceLeadingSingleQuotationMark( false );
UpdateAutoCorrFlag();