fdo#74363: fix auto correct of initial capitals on start of first para
The GetPrevPara() method apparently has to return 0 when there is no
previous paragraph.
(regression from ac85b6cff1
)
Change-Id: I09a3e1d3a3adb33562e4e03c0755447047cbd433
This commit is contained in:
@@ -267,10 +267,10 @@ private:
|
|||||||
//fprintf(stderr, "TestAutoCorrDoc::SetINetAttr\n");
|
//fprintf(stderr, "TestAutoCorrDoc::SetINetAttr\n");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
virtual OUString GetPrevPara( sal_Bool )
|
virtual OUString const* GetPrevPara(bool)
|
||||||
{
|
{
|
||||||
//fprintf(stderr, "TestAutoCorrDoc::GetPrevPara\n");
|
//fprintf(stderr, "TestAutoCorrDoc::GetPrevPara\n");
|
||||||
return OUString();
|
return 0;
|
||||||
}
|
}
|
||||||
virtual bool ChgAutoCorrWord( sal_Int32& rSttPos,
|
virtual bool ChgAutoCorrWord( sal_Int32& rSttPos,
|
||||||
sal_Int32 nEndPos, SvxAutoCorrect& rACorrect,
|
sal_Int32 nEndPos, SvxAutoCorrect& rACorrect,
|
||||||
|
@@ -696,7 +696,7 @@ sal_Bool EdtAutoCorrDoc::SetINetAttr(sal_Int32 nStt, sal_Int32 nEnd,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
OUString EdtAutoCorrDoc::GetPrevPara( sal_Bool )
|
OUString const* EdtAutoCorrDoc::GetPrevPara(bool const)
|
||||||
{
|
{
|
||||||
// Return previous paragraph, so that it can be determined,
|
// Return previous paragraph, so that it can be determined,
|
||||||
// whether the current word is at the beginning of a sentence.
|
// whether the current word is at the beginning of a sentence.
|
||||||
@@ -719,16 +719,16 @@ OUString EdtAutoCorrDoc::GetPrevPara( sal_Bool )
|
|||||||
bBullet = true;
|
bBullet = true;
|
||||||
}
|
}
|
||||||
if ( bBullet )
|
if ( bBullet )
|
||||||
return OUString();
|
return 0;
|
||||||
|
|
||||||
for ( sal_Int32 n = nPos; n; )
|
for ( sal_Int32 n = nPos; n; )
|
||||||
{
|
{
|
||||||
n--;
|
n--;
|
||||||
ContentNode* pNode = rNodes[n];
|
ContentNode* pNode = rNodes[n];
|
||||||
if ( pNode->Len() )
|
if ( pNode->Len() )
|
||||||
return pNode->GetString();
|
return & pNode->GetString();
|
||||||
}
|
}
|
||||||
return OUString();
|
return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -147,7 +147,7 @@ public:
|
|||||||
virtual sal_Bool SetAttr( sal_Int32 nStt, sal_Int32 nEnd, sal_uInt16 nSlotId, SfxPoolItem& );
|
virtual sal_Bool SetAttr( sal_Int32 nStt, sal_Int32 nEnd, sal_uInt16 nSlotId, SfxPoolItem& );
|
||||||
virtual sal_Bool SetINetAttr( sal_Int32 nStt, sal_Int32 nEnd, const OUString& rURL );
|
virtual sal_Bool SetINetAttr( sal_Int32 nStt, sal_Int32 nEnd, const OUString& rURL );
|
||||||
|
|
||||||
virtual OUString GetPrevPara( sal_Bool bAtNormalPos );
|
virtual OUString const* GetPrevPara(bool bAtNormalPos) SAL_OVERRIDE;
|
||||||
|
|
||||||
virtual bool ChgAutoCorrWord( sal_Int32& rSttPos, sal_Int32 nEndPos,
|
virtual bool ChgAutoCorrWord( sal_Int32& rSttPos, sal_Int32 nEndPos,
|
||||||
SvxAutoCorrect& rACorrect, OUString* pPara );
|
SvxAutoCorrect& rACorrect, OUString* pPara );
|
||||||
|
@@ -865,8 +865,8 @@ sal_Bool SvxAutoCorrect::FnCptlSttSntnc( SvxAutoCorrDoc& rDoc,
|
|||||||
{
|
{
|
||||||
// Check out the previous paragraph, if it exists.
|
// Check out the previous paragraph, if it exists.
|
||||||
// If so, then check to paragraph separator at the end.
|
// If so, then check to paragraph separator at the end.
|
||||||
OUString aPrevPara = rDoc.GetPrevPara( bNormalPos );
|
OUString const*const pPrevPara = rDoc.GetPrevPara(bNormalPos);
|
||||||
if( !aPrevPara.isEmpty() )
|
if (!pPrevPara)
|
||||||
{
|
{
|
||||||
// valid separator -> replace
|
// valid separator -> replace
|
||||||
OUString sChar( *pWordStt );
|
OUString sChar( *pWordStt );
|
||||||
@@ -875,7 +875,7 @@ sal_Bool SvxAutoCorrect::FnCptlSttSntnc( SvxAutoCorrDoc& rDoc,
|
|||||||
rDoc.ReplaceRange( pWordStt - pStart, 1, sChar );
|
rDoc.ReplaceRange( pWordStt - pStart, 1, sChar );
|
||||||
}
|
}
|
||||||
|
|
||||||
aText = aPrevPara;
|
aText = *pPrevPara;
|
||||||
bAtStart = sal_False;
|
bAtStart = sal_False;
|
||||||
pStart = aText.getStr();
|
pStart = aText.getStr();
|
||||||
pStr = pStart + aText.getLength();
|
pStr = pStart + aText.getLength();
|
||||||
|
@@ -101,7 +101,7 @@ public:
|
|||||||
// TRUE: before the normal insertion position (TRUE)
|
// TRUE: before the normal insertion position (TRUE)
|
||||||
// FALSE: in which the corrected word was inserted.
|
// FALSE: in which the corrected word was inserted.
|
||||||
// (Does not to have to be the same paragraph !!!!)
|
// (Does not to have to be the same paragraph !!!!)
|
||||||
virtual OUString GetPrevPara( sal_Bool bAtNormalPos ) = 0;
|
virtual OUString const* GetPrevPara(bool bAtNormalPos) = 0;
|
||||||
|
|
||||||
virtual bool ChgAutoCorrWord( sal_Int32& rSttPos, sal_Int32 nEndPos,
|
virtual bool ChgAutoCorrWord( sal_Int32& rSttPos, sal_Int32 nEndPos,
|
||||||
SvxAutoCorrect& rACorrect,
|
SvxAutoCorrect& rACorrect,
|
||||||
|
@@ -270,9 +270,9 @@ sal_Bool SwAutoCorrDoc::SetINetAttr( sal_Int32 nStt, sal_Int32 nEnd, const OUStr
|
|||||||
* corrected word was inserted. (Doesn't need to be the same paragraph!)
|
* corrected word was inserted. (Doesn't need to be the same paragraph!)
|
||||||
* @return text or 0, if previous paragraph does not exists or there are only blankness
|
* @return text or 0, if previous paragraph does not exists or there are only blankness
|
||||||
*/
|
*/
|
||||||
OUString SwAutoCorrDoc::GetPrevPara( sal_Bool bAtNormalPos )
|
OUString const* SwAutoCorrDoc::GetPrevPara(bool const bAtNormalPos)
|
||||||
{
|
{
|
||||||
OUString aStr;
|
OUString const* pStr(0);
|
||||||
|
|
||||||
if( bAtNormalPos || !pIdx )
|
if( bAtNormalPos || !pIdx )
|
||||||
pIdx = new SwNodeIndex( rCrsr.GetPoint()->nNode, -1 );
|
pIdx = new SwNodeIndex( rCrsr.GetPoint()->nNode, -1 );
|
||||||
@@ -286,11 +286,12 @@ OUString SwAutoCorrDoc::GetPrevPara( sal_Bool bAtNormalPos )
|
|||||||
pTNd = pIdx->GetNode().GetTxtNode();
|
pTNd = pIdx->GetNode().GetTxtNode();
|
||||||
}
|
}
|
||||||
if( pTNd && 0 == pTNd->GetAttrOutlineLevel() )
|
if( pTNd && 0 == pTNd->GetAttrOutlineLevel() )
|
||||||
aStr = pTNd->GetTxt();
|
pStr = & pTNd->GetTxt();
|
||||||
|
|
||||||
if( bUndoIdInitialized )
|
if( bUndoIdInitialized )
|
||||||
bUndoIdInitialized = true;
|
bUndoIdInitialized = true;
|
||||||
return aStr;
|
|
||||||
|
return pStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SwAutoCorrDoc::ChgAutoCorrWord( sal_Int32& rSttPos, sal_Int32 nEndPos,
|
bool SwAutoCorrDoc::ChgAutoCorrWord( sal_Int32& rSttPos, sal_Int32 nEndPos,
|
||||||
|
@@ -72,7 +72,7 @@ public:
|
|||||||
// - sal_True: paragraph before "normal" insertion position
|
// - sal_True: paragraph before "normal" insertion position
|
||||||
// - sal_False: paragraph in that the corrected word was inserted
|
// - sal_False: paragraph in that the corrected word was inserted
|
||||||
// (does not need to be the same paragraph)
|
// (does not need to be the same paragraph)
|
||||||
virtual OUString GetPrevPara( sal_Bool bAtNormalPos );
|
virtual OUString const* GetPrevPara(bool bAtNormalPos) SAL_OVERRIDE;
|
||||||
|
|
||||||
virtual bool ChgAutoCorrWord( sal_Int32& rSttPos, sal_Int32 nEndPos,
|
virtual bool ChgAutoCorrWord( sal_Int32& rSttPos, sal_Int32 nEndPos,
|
||||||
SvxAutoCorrect& rACorrect,
|
SvxAutoCorrect& rACorrect,
|
||||||
|
Reference in New Issue
Block a user