diff options
author | Thomas Lange [tl] <tl@openoffice.org> | 2010-06-14 14:38:44 +0200 |
---|---|---|
committer | Thomas Lange [tl] <tl@openoffice.org> | 2010-06-14 14:38:44 +0200 |
commit | 6a894a2b96fcb83d7ed3a097d172c2323c00c605 (patch) | |
tree | 8e5f483c98f62096485788e14e5bc2e5bd9e39d2 /editeng/source | |
parent | 31319bc6b2191cc95fac058347578e3ad54a95bb (diff) | |
parent | 634bd66a83cffb00d41d434e77c80eef06a0c813 (diff) |
CWS tl80: merge with DEV300_m82
Diffstat (limited to 'editeng/source')
-rw-r--r-- | editeng/source/accessibility/AccessibleEditableTextPara.cxx | 20 | ||||
-rw-r--r-- | editeng/source/editeng/editeng.cxx | 5 | ||||
-rwxr-xr-x | editeng/source/editeng/editview.cxx | 4 | ||||
-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 | ||||
-rwxr-xr-x[-rw-r--r--] | editeng/source/outliner/outlvw.cxx | 66 |
7 files changed, 147 insertions, 17 deletions
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/editeng.cxx b/editeng/source/editeng/editeng.cxx index e22f2dacad47..1b61a405dc18 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> @@ -1152,8 +1153,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/editview.cxx b/editeng/source/editeng/editview.cxx index 619262677519..642b5e0d9f17 100755 --- a/editeng/source/editeng/editview.cxx +++ b/editeng/source/editeng/editview.cxx @@ -1310,13 +1310,13 @@ void EditView::SpellIgnoreWord() pImpEditView->SpellIgnoreOrAddWord( sal_False ); } -sal_Bool EditView::SelectCurrentWord() +sal_Bool EditView::SelectCurrentWord( sal_Int16 nWordType ) { DBG_CHKTHIS( EditView, 0 ); DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 ); EditSelection aCurSel( pImpEditView->GetEditSelection() ); pImpEditView->DrawSelection(); - aCurSel = PIMPEE->SelectWord( aCurSel.Max() ); + aCurSel = PIMPEE->SelectWord( aCurSel.Max(), nWordType ); pImpEditView->SetEditSelection( aCurSel ); pImpEditView->DrawSelection(); ShowCursor( sal_True, sal_False ); 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; + } + } + } } } diff --git a/editeng/source/outliner/outlvw.cxx b/editeng/source/outliner/outlvw.cxx index fa539da6f138..e2a1fabea0ba 100644..100755 --- a/editeng/source/outliner/outlvw.cxx +++ b/editeng/source/outliner/outlvw.cxx @@ -26,7 +26,11 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove + #include "precompiled_editeng.hxx" + +#include <com/sun/star/i18n/WordType.hpp> + #include <svl/intitem.hxx> #include <editeng/editeng.hxx> #include <editeng/editview.hxx> @@ -34,7 +38,9 @@ #include <editeng/eerdll.hxx> #include <editeng/lrspitem.hxx> #include <editeng/fhgtitem.hxx> + #include <svl/style.hxx> +#include <i18npool/mslangid.hxx> #define _OUTLINER_CXX #include <editeng/outliner.hxx> @@ -59,6 +65,8 @@ #define OL_SCROLL_HOROFFSET 20 /* in % von VisibleSize.Width */ #define OL_SCROLL_VEROFFSET 20 /* in % von VisibleSize.Height */ +using namespace ::com::sun::star; + DBG_NAME(OutlinerView) @@ -972,7 +980,7 @@ void OutlinerView::InsertText( const OutlinerParaObject& rParaObj ) // Eigentlich nicht ganz richtig, das evtl. Einrueckungen // korrigiert werden muessen, aber das kommt spaeter durch ein // allgemeingueltiges Import. - // Dann wird im Inserted gleich ermittelt, was fr eine Einrueckebene + // Dann wird im Inserted gleich ermittelt, was f�r eine Einrueckebene // Moegliche Struktur: // pImportInfo mit DestPara, DestPos, nFormat, pParaObj... // Evtl. Problematisch: @@ -1295,7 +1303,7 @@ void OutlinerView::RemoveAttribs( BOOL bRemoveParaAttribs, USHORT nWhich, BOOL b -// ===================================================================== +// ===================================================================== // ====================== Einfache Durchreicher ======================= // ====================================================================== @@ -1670,3 +1678,57 @@ Selection OutlinerView::GetSurroundingTextSelection() const DBG_CHKTHIS(OutlinerView,0); return pEditView->GetSurroundingTextSelection(); } + + +// ====================================================================== +// ===== some code for thesaurus sub menu within context menu +// ====================================================================== + +// returns: true if a word for thesaurus look-up was found at the current cursor position. +// The status string will be word + iso language string (e.g. "light#en-US") +bool EDITENG_DLLPUBLIC GetStatusValueForThesaurusFromContext( + String &rStatusVal, + LanguageType &rLang, + const EditView &rEditView ) +{ + // get text and locale for thesaurus look up + String aText; + EditEngine *pEditEngine = rEditView.GetEditEngine(); + ESelection aTextSel( rEditView.GetSelection() ); + if (!aTextSel.HasRange()) + aTextSel = pEditEngine->GetWord( aTextSel, i18n::WordType::DICTIONARY_WORD ); + aText = pEditEngine->GetText( aTextSel ); + aTextSel.Adjust(); + LanguageType nLang = pEditEngine->GetLanguage( aTextSel.nStartPara, aTextSel.nStartPos ); + String aLangText( MsLangId::convertLanguageToIsoString( nLang ) ); + + // set word and locale to look up as status value + String aStatusVal( aText ); + aStatusVal.AppendAscii( "#" ); + aStatusVal += aLangText; + + rStatusVal = aStatusVal; + rLang = nLang; + + return aText.Len() > 0; +} + + +void EDITENG_DLLPUBLIC ReplaceTextWithSynonym( EditView &rEditView, const String &rSynonmText ) +{ + // get selection to use + ESelection aCurSel( rEditView.GetSelection() ); + if (!rEditView.HasSelection()) + { + // select the same word that was used in GetStatusValueForThesaurusFromContext by calling GetWord. + // (In the end both functions will call ImpEditEngine::SelectWord) + rEditView.SelectCurrentWord( i18n::WordType::DICTIONARY_WORD ); + aCurSel = rEditView.GetSelection(); + } + + // replace word ... + rEditView.InsertText( rSynonmText ); + rEditView.ShowCursor( sal_True, sal_False ); +} + + |