summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorThomas Lange [tl] <tl@openoffice.org>2010-06-09 14:50:43 +0200
committerThomas Lange [tl] <tl@openoffice.org>2010-06-09 14:50:43 +0200
commitb8c5868b31b52c0ccdcc401342b55c947b19e89d (patch)
tree9cf9d5b464ec7587bcc76f08932665fa2703849f /editeng
parent79333b34480c401e3a43e3add609db5874d0b1a7 (diff)
parente03596eaf693b9809cffe86c21658a5ce381d6c3 (diff)
cws tl74: merge with DEV300_m81
Diffstat (limited to 'editeng')
-rw-r--r--editeng/inc/editeng/svxacorr.hxx4
-rw-r--r--editeng/source/accessibility/AccessibleEditableTextPara.cxx20
-rw-r--r--editeng/source/editeng/editdbg.cxx2
-rw-r--r--editeng/source/editeng/editeng.cxx5
-rw-r--r--editeng/source/editeng/eehtml.cxx21
-rw-r--r--editeng/source/editeng/eehtml.hxx1
-rw-r--r--editeng/source/misc/svxacorr.cxx47
7 files changed, 86 insertions, 14 deletions
diff --git a/editeng/inc/editeng/svxacorr.hxx b/editeng/inc/editeng/svxacorr.hxx
index c900228cc053..1ef6bad09d9b 100644
--- a/editeng/inc/editeng/svxacorr.hxx
+++ b/editeng/inc/editeng/svxacorr.hxx
@@ -209,6 +209,8 @@ class EDITENG_DLLPUBLIC SvxAutoCorrect
SvxAutoCorrLastFileAskTable_Impl* pLastFileTable;
CharClass* pCharClass;
+ bool bRunNext;
+
LanguageType eCharClassLang;
long nFlags;
@@ -374,6 +376,8 @@ public:
xub_StrLen nSttPos, xub_StrLen nEndPos,
LanguageType eLang = LANGUAGE_SYSTEM);
+ bool HasRunNext() { return bRunNext; }
+
static long GetDefaultFlags();
// returns TRUE for charcters where the function
diff --git a/editeng/source/accessibility/AccessibleEditableTextPara.cxx b/editeng/source/accessibility/AccessibleEditableTextPara.cxx
index 94981dc32e73..b5a43ae8a948 100644
--- a/editeng/source/accessibility/AccessibleEditableTextPara.cxx
+++ b/editeng/source/accessibility/AccessibleEditableTextPara.cxx
@@ -1129,6 +1129,26 @@ namespace accessibility
return aPoint;
}
+ // --> OD 2009-12-16 #i88070#
+ // fallback to parent's <XAccessibleContext> instance
+ else
+ {
+ uno::Reference< XAccessibleContext > xParentContext = xParent->getAccessibleContext();
+ if ( xParentContext.is() )
+ {
+ uno::Reference< XAccessibleComponent > xParentContextComponent( xParentContext, uno::UNO_QUERY );
+ if( xParentContextComponent.is() )
+ {
+ awt::Point aRefPoint = xParentContextComponent->getLocationOnScreen();
+ awt::Point aPoint = getLocation();
+ aPoint.X += aRefPoint.X;
+ aPoint.Y += aRefPoint.Y;
+
+ return aPoint;
+ }
+ }
+ }
+ // <--
}
throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Cannot access parent")),
diff --git a/editeng/source/editeng/editdbg.cxx b/editeng/source/editeng/editdbg.cxx
index 01a387249f24..a21c6ed345c6 100644
--- a/editeng/source/editeng/editdbg.cxx
+++ b/editeng/source/editeng/editdbg.cxx
@@ -458,7 +458,7 @@ void EditDbg::ShowEditEngineData( EditEngine* pEE, BOOL bInfoBox )
fprintf( fp, "\n\n ================================================================================" );
fprintf( fp, "\n================== EditEngine & Views ======================================" );
fprintf( fp, "\n================================================================================" );
- fprintf( fp, "\nControl: %lx", pEE->GetControlWord() );
+ fprintf( fp, "\nControl: %"SAL_PRIxUINT32, pEE->GetControlWord() );
fprintf( fp, "\nRefMapMode: %i", pEE->pImpEditEngine->pRefDev->GetMapMode().GetMapUnit() );
fprintf( fp, "\nPaperSize: %li x %li", pEE->GetPaperSize().Width(), pEE->GetPaperSize().Height() );
fprintf( fp, "\nMaxAutoPaperSize: %li x %li", pEE->GetMaxAutoPaperSize().Width(), pEE->GetMaxAutoPaperSize().Height() );
diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx
index 212fb8ff9446..8621f173c250 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -49,6 +49,7 @@
#include <eerdll2.hxx>
#include <editeng/eerdll.hxx>
#include <editeng.hrc>
+#include <editeng/acorrcfg.hxx>
#include <editeng/flditem.hxx>
#include <editeng/txtrange.hxx>
#include <vcl/graph.hxx>
@@ -1144,8 +1145,10 @@ sal_Bool EditEngine::PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pEditVie
xub_Unicode nCharCode = rKeyEvent.GetCharCode();
pEditView->pImpEditView->DrawSelection();
// Autokorrektur ?
+ SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect();
if ( ( pImpEditEngine->GetStatus().DoAutoCorrect() ) &&
- SvxAutoCorrect::IsAutoCorrectChar( nCharCode ) )
+ ( SvxAutoCorrect::IsAutoCorrectChar( nCharCode ) ||
+ pAutoCorrect->HasRunNext() ) )
{
aCurSel = pImpEditEngine->AutoCorrect( aCurSel, nCharCode, !pEditView->IsInsertMode() );
}
diff --git a/editeng/source/editeng/eehtml.cxx b/editeng/source/editeng/eehtml.cxx
index ddb82a06661d..569b80639b6b 100644
--- a/editeng/source/editeng/eehtml.cxx
+++ b/editeng/source/editeng/eehtml.cxx
@@ -60,6 +60,7 @@ EditHTMLParser::EditHTMLParser( SvStream& rIn, const String& rBaseURL, SvKeyValu
bWasInPara = FALSE;
nInTable = 0;
nInCell = 0;
+ bInTitle = FALSE;
nDefListLevel = 0;
nBulletLevel = 0;
nNumberingLevel = 0;
@@ -179,11 +180,14 @@ void EditHTMLParser::NextToken( int nToken )
break;
case HTML_TEXTTOKEN:
{
- if ( !bInPara )
- StartPara( FALSE );
-
-// if ( bInPara || pCurAnchor )
+ // #i110937# for <title> content, call aImportHdl (no SkipGroup), but don't insert the text into the EditEngine
+ if (!bInTitle)
{
+ if ( !bInPara )
+ StartPara( FALSE );
+
+ // if ( bInPara || pCurAnchor )
+
String aText = aToken;
if ( aText.Len() && ( aText.GetChar( 0 ) == ' ' )
&& ThrowAwayBlank() && !IsReadPRE() )
@@ -342,6 +346,13 @@ void EditHTMLParser::NextToken( int nToken )
// #58335# kein SkipGroup on/off auf inline markup etc.
+ case HTML_TITLE_ON:
+ bInTitle = TRUE;
+ break;
+ case HTML_TITLE_OFF:
+ bInTitle = FALSE;
+ break;
+
// globals
case HTML_HTML_ON:
case HTML_HTML_OFF:
@@ -355,8 +366,6 @@ void EditHTMLParser::NextToken( int nToken )
case HTML_THEAD_OFF:
case HTML_TBODY_ON:
case HTML_TBODY_OFF:
- case HTML_TITLE_ON:
- case HTML_TITLE_OFF:
// inline elements, structural markup
// HTML 3.0
case HTML_BANNER_ON:
diff --git a/editeng/source/editeng/eehtml.hxx b/editeng/source/editeng/eehtml.hxx
index a9b20bcd652f..8d11e743755a 100644
--- a/editeng/source/editeng/eehtml.hxx
+++ b/editeng/source/editeng/eehtml.hxx
@@ -57,6 +57,7 @@ private:
BOOL bFieldsInserted;
BYTE nInTable;
BYTE nInCell;
+ BOOL bInTitle;
BYTE nDefListLevel;
BYTE nBulletLevel;
diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index 2631c71a6b17..64343517c69f 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -363,7 +363,7 @@ SvxAutoCorrect::SvxAutoCorrect( const String& rShareAutocorrFile,
sUserAutoCorrFile( rUserAutocorrFile ),
pLangTable( new SvxAutoCorrLanguageTable_Impl ),
pLastFileTable( new SvxAutoCorrLastFileAskTable_Impl ),
- pCharClass( 0 ),
+ pCharClass( 0 ), bRunNext( false ),
cStartDQuote( 0 ), cEndDQuote( 0 ), cStartSQuote( 0 ), cEndSQuote( 0 )
{
nFlags = SvxAutoCorrect::GetDefaultFlags();
@@ -380,7 +380,7 @@ SvxAutoCorrect::SvxAutoCorrect( const SvxAutoCorrect& rCpy )
pLangTable( new SvxAutoCorrLanguageTable_Impl ),
pLastFileTable( new SvxAutoCorrLastFileAskTable_Impl ),
- pCharClass( 0 ),
+ pCharClass( 0 ), bRunNext( false ),
nFlags( rCpy.nFlags & ~(ChgWordLstLoad|CplSttLstLoad|WrdSttLstLoad)),
cStartDQuote( rCpy.cStartDQuote ), cEndDQuote( rCpy.cEndDQuote ),
@@ -669,7 +669,7 @@ BOOL SvxAutoCorrect::FnAddNonBrkSpace(
// Check the presence of "://" in the word
xub_StrLen nStrPos = rTxt.Search( String::CreateFromAscii( "://" ), nSttWdPos + 1 );
- if ( STRING_NOTFOUND == nStrPos )
+ if ( STRING_NOTFOUND == nStrPos && nEndPos > 0 )
{
// Check the previous char
sal_Unicode cPrevChar = rTxt.GetChar( nEndPos - 1 );
@@ -693,9 +693,12 @@ BOOL SvxAutoCorrect::FnAddNonBrkSpace(
// Add the non-breaking space at the end pos
if ( bHasSpace )
rDoc.Insert( nPos, CHAR_HARDBLANK );
+ bRunNext = true;
bRet = true;
}
}
+ else if ( chars.indexOf( sal_Unicode( cPrevChar ) ) != -1 )
+ bRunNext = true;
}
}
else if ( cChar == '/' )
@@ -1189,6 +1192,9 @@ ULONG SvxAutoCorrect::AutoCorrect( SvxAutoCorrDoc& rDoc, const String& rTxt,
BOOL bInsert )
{
ULONG nRet = 0;
+ bool bIsNextRun = bRunNext;
+ bRunNext = false; // if it was set, then it has to be turned off
+
do{ // only for middle check loop !!
if( cChar )
{
@@ -1227,10 +1233,39 @@ ULONG SvxAutoCorrect::AutoCorrect( SvxAutoCorrDoc& rDoc, const String& rTxt,
rDoc.Replace( nInsPos, cChar );
// Hardspaces autocorrection
- if ( NeedsHardspaceAutocorr( cChar ) && IsAutoCorrFlag( AddNonBrkSpace ) &&
- FnAddNonBrkSpace( rDoc, rTxt, 0, nInsPos, rDoc.GetLanguage( nInsPos, FALSE ) ) )
+ if ( IsAutoCorrFlag( AddNonBrkSpace ) )
{
- nRet = AddNonBrkSpace;
+ if ( NeedsHardspaceAutocorr( cChar ) &&
+ FnAddNonBrkSpace( rDoc, rTxt, 0, nInsPos, rDoc.GetLanguage( nInsPos, FALSE ) ) )
+ {
+ nRet = AddNonBrkSpace;
+ }
+ else if ( bIsNextRun && !IsAutoCorrectChar( cChar ) )
+ {
+ // Remove the NBSP if it wasn't an autocorrection
+ if ( NeedsHardspaceAutocorr( rTxt.GetChar( nInsPos - 1 ) ) &&
+ cChar != ' ' && cChar != '\t' && cChar != CHAR_HARDBLANK )
+ {
+ // Look for the last HARD_SPACE
+ xub_StrLen nPos = nInsPos - 1;
+ bool bFound = false;
+ while ( nPos != STRING_NOTFOUND && !bFound )
+ {
+ sal_Unicode cTmpChar = rTxt.GetChar( nPos );
+ if ( cTmpChar == CHAR_HARDBLANK )
+ bFound = true;
+ else if ( !NeedsHardspaceAutocorr( cTmpChar ) )
+ nPos = STRING_NOTFOUND;
+ nPos--;
+ }
+
+ if ( bFound && nPos != STRING_NOTFOUND )
+ {
+ rDoc.Delete( nPos + 1, nPos + 2 );
+ nRet = AddNonBrkSpace;
+ }
+ }
+ }
}
}