diff options
author | Thomas Lange [tl] <tl@openoffice.org> | 2010-06-09 14:50:43 +0200 |
---|---|---|
committer | Thomas Lange [tl] <tl@openoffice.org> | 2010-06-09 14:50:43 +0200 |
commit | 5c14cccd4010d26ed84f85dc0c6944a34c407c91 (patch) | |
tree | 86ce5d2b0e40cd6874194a21adbda4c367b9a386 /editeng | |
parent | c3cc527322caac93bdd7d4a961a19d4366f86987 (diff) | |
parent | 6299e019bff7c651e9585d5bf2234539233a646d (diff) |
cws tl74: merge with DEV300_m81
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/inc/editeng/svxacorr.hxx | 4 | ||||
-rw-r--r-- | editeng/source/accessibility/AccessibleEditableTextPara.cxx | 68 | ||||
-rw-r--r-- | editeng/source/editeng/editdbg.cxx | 2 | ||||
-rw-r--r-- | editeng/source/editeng/editeng.cxx | 5 | ||||
-rw-r--r-- | editeng/source/editeng/eehtml.cxx | 21 | ||||
-rw-r--r-- | editeng/source/editeng/eehtml.hxx | 1 | ||||
-rw-r--r-- | editeng/source/misc/svxacorr.cxx | 47 |
7 files changed, 110 insertions, 38 deletions
diff --git a/editeng/inc/editeng/svxacorr.hxx b/editeng/inc/editeng/svxacorr.hxx index 72441fa901..333235bf70 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 89917d77a8..1ead09ce47 100644 --- a/editeng/source/accessibility/AccessibleEditableTextPara.cxx +++ b/editeng/source/accessibility/AccessibleEditableTextPara.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -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")), @@ -1223,7 +1243,7 @@ namespace accessibility { DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); ::vos::OGuard aGuard( Application::GetSolarMutex() ); - + CheckIndex(nIndex); // may throw IndexOutOfBoundsException // get default attribues... @@ -1254,7 +1274,7 @@ namespace accessibility aAny >>= f1; } int i = 3; - } + } #endif // get resulting sequence @@ -1890,8 +1910,8 @@ namespace accessibility } // XAccessibleTextAttributes - uno::Sequence< beans::PropertyValue > SAL_CALL AccessibleEditableTextPara::getDefaultAttributes( - const uno::Sequence< ::rtl::OUString >& rRequestedAttributes ) + uno::Sequence< beans::PropertyValue > SAL_CALL AccessibleEditableTextPara::getDefaultAttributes( + const uno::Sequence< ::rtl::OUString >& rRequestedAttributes ) throw (uno::RuntimeException) { DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); @@ -1909,8 +1929,8 @@ namespace accessibility DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX, "AccessibleEditableTextPara::getCharacterAttributes: index value overflow"); - // get XPropertySetInfo for paragraph attributes and - // character attributes that span all the paragraphs text. + // get XPropertySetInfo for paragraph attributes and + // character attributes that span all the paragraphs text. SvxAccessibleTextPropertySet aPropSet( &GetEditSource(), ImplGetSvxCharAndParaPropertiesSet() ); aPropSet.SetSelection( MakeSelection( 0, GetTextLen() ) ); @@ -1957,8 +1977,8 @@ namespace accessibility sal_Int32 nOutLen = 0; for (sal_Int32 i = 0; i < nLength; ++i) { - // calling implementation functions: - // _getPropertyState and _getPropertyValue (see below) to provide + // calling implementation functions: + // _getPropertyState and _getPropertyValue (see below) to provide // the proper paragraph number when retrieving paragraph attributes PropertyState eState = aPropSet._getPropertyState( pProperties->Name, mnParagraphIndex ); if ( eState == PropertyState_AMBIGUOUS_VALUE ) @@ -1967,7 +1987,7 @@ namespace accessibility } //if (eState == PropertyState_DIRECT_VALUE) - // per definition all paragraph properties and all character + // per definition all paragraph properties and all character // properties spanning the whole paragraph should be returned // and declared as default value { @@ -1987,9 +2007,9 @@ namespace accessibility } - uno::Sequence< beans::PropertyValue > SAL_CALL AccessibleEditableTextPara::getRunAttributes( - sal_Int32 nIndex, - const uno::Sequence< ::rtl::OUString >& rRequestedAttributes ) + uno::Sequence< beans::PropertyValue > SAL_CALL AccessibleEditableTextPara::getRunAttributes( + sal_Int32 nIndex, + const uno::Sequence< ::rtl::OUString >& rRequestedAttributes ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException) { DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); @@ -2046,7 +2066,7 @@ namespace accessibility } else aProperties = xPropSetInfo->getProperties(); - + sal_Int32 nLength = aProperties.getLength(); const beans::Property *pProperties = aProperties.getConstArray(); @@ -2056,7 +2076,7 @@ namespace accessibility sal_Int32 nOutLen = 0; for (sal_Int32 i = 0; i < nLength; ++i) { - // calling 'regular' functions that will operate on the selection + // calling 'regular' functions that will operate on the selection PropertyState eState = aPropSet.getPropertyState( pProperties->Name ); if (eState == PropertyState_DIRECT_VALUE) { @@ -2160,7 +2180,7 @@ namespace accessibility sal_Int32 nRes = -1; sal_Int32 nPara = GetParagraphIndex(); - + SvxTextForwarder &rCacheTF = GetTextForwarder(); const bool bValidPara = 0 <= nPara && nPara < rCacheTF.GetParagraphCount(); DBG_ASSERT( bValidPara, "getLineNumberAtIndex: current paragraph index out of range" ); @@ -2168,7 +2188,7 @@ namespace accessibility { // we explicitly allow for the index to point at the character right behind the text if (0 <= nIndex && nIndex <= rCacheTF.GetTextLen( static_cast< USHORT >(nPara) )) - nRes = rCacheTF.GetLineNumberAtIndex( static_cast< USHORT >(nPara), static_cast< USHORT >(nIndex) ); + nRes = rCacheTF.GetLineNumberAtIndex( static_cast< USHORT >(nPara), static_cast< USHORT >(nIndex) ); else throw lang::IndexOutOfBoundsException(); } @@ -2179,7 +2199,7 @@ namespace accessibility ::com::sun::star::accessibility::TextSegment SAL_CALL AccessibleEditableTextPara::getTextAtLineNumber( sal_Int32 nLineNo ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException) { DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); - + ::com::sun::star::accessibility::TextSegment aResult; sal_Int32 nPara = GetParagraphIndex(); SvxTextForwarder &rCacheTF = GetTextForwarder(); @@ -2203,8 +2223,8 @@ namespace accessibility { // this is not the exception that should be raised in this function ... DBG_ASSERT( 0, "unexpected exception" ); - } - } + } + } } else throw lang::IndexOutOfBoundsException(); @@ -2216,7 +2236,7 @@ namespace accessibility ::com::sun::star::accessibility::TextSegment SAL_CALL AccessibleEditableTextPara::getTextAtLineWithCaret( ) throw (uno::RuntimeException) { DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); - + ::com::sun::star::accessibility::TextSegment aResult; try { @@ -2225,7 +2245,7 @@ namespace accessibility catch (lang::IndexOutOfBoundsException &) { // this one needs to be catched since this interface does not allow for it. - } + } return aResult; } @@ -2233,7 +2253,7 @@ namespace accessibility sal_Int32 SAL_CALL AccessibleEditableTextPara::getNumberOfLineWithCaret( ) throw (uno::RuntimeException) { DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); - + sal_Int32 nRes = -1; try { @@ -2242,7 +2262,7 @@ namespace accessibility catch (lang::IndexOutOfBoundsException &) { // this one needs to be catched since this interface does not allow for it. - } + } return nRes; } diff --git a/editeng/source/editeng/editdbg.cxx b/editeng/source/editeng/editdbg.cxx index 47611286ca..c6035c1bb6 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 ef1b0c1db9..fd06f8b68c 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 a6d5096be7..87bf077bb2 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 6314db6161..4035cb1598 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 ebc025fea7..78edae142d 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; + } + } + } } } |