diff options
author | Jens-Heiner Rechtien <hr@openoffice.org> | 2009-01-05 15:33:41 +0000 |
---|---|---|
committer | Jens-Heiner Rechtien <hr@openoffice.org> | 2009-01-05 15:33:41 +0000 |
commit | 91b4358ce216334236fe25a165ba85e08de89234 (patch) | |
tree | 192b36f2b0a6c6bd59405488b25b0ed6f6ff910d /svx | |
parent | 77c0a9229ae78d9b85f59dfa2d35bc18af1fa90f (diff) |
CWS-TOOLING: integrate CWS kashidafix
2008-12-15 15:31:40 +0100 hde r265507 : #i97098#
2008-12-15 15:30:52 +0100 hde r265506 : #i97098#
2008-12-10 14:08:07 +0100 fredrikh r265184 : i97098
2008-11-27 15:07:01 +0100 hdu r264493 : #i60594# only determine GetNextGlyphs() charpos if requested+available
2008-11-27 14:09:42 +0100 hdu r264487 : #i60594# simplify RTL-glyph-injection also for manual-cell-aligned cases
2008-11-26 13:25:08 +0100 fme r264379 : #i60594# Kashida fixes - syntax error
2008-11-26 13:16:22 +0100 hdu r264374 : #i60594# allow glyph injection even if there is not enough room if they can overlap
2008-11-25 16:40:20 +0100 hdu r264314 : #i60594# fix glyph-injection for PDF-export for usp>=1.6
2008-11-24 16:17:11 +0100 hdu r264254 : #i71804# adjust glyph-fallback usp-methods for new glyph-injection infrastructure
2008-11-24 16:15:30 +0100 hdu r264253 : #i71804# disable glyph-injection for glyph-fallback mixing
2008-11-20 08:29:15 +0100 fme r264027 : #i60594# Fix correction
2008-11-14 10:10:54 +0100 fme r263666 : CWS-TOOLING: rebase CWS kashidafix to trunk@263288 (milestone: DEV300:m35)
2008-10-30 16:35:30 +0100 fme r262834 : #i60594# migrate cws kashidafix to SVN.
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/editeng/impedit.hxx | 5 | ||||
-rw-r--r-- | svx/source/editeng/impedit2.cxx | 106 | ||||
-rw-r--r-- | svx/source/editeng/impedit3.cxx | 143 | ||||
-rw-r--r-- | svx/source/options/optctl.src | 3 | ||||
-rw-r--r-- | svx/source/svdraw/svdotext.cxx | 23 |
5 files changed, 206 insertions, 74 deletions
diff --git a/svx/source/editeng/impedit.hxx b/svx/source/editeng/impedit.hxx index e158d4cfb2..9a1f3002f8 100644 --- a/svx/source/editeng/impedit.hxx +++ b/svx/source/editeng/impedit.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: impedit.hxx,v $ - * $Revision: 1.89 $ + * $Revision: 1.89.40.1 $ * * This file is part of OpenOffice.org. * @@ -61,6 +61,8 @@ #include <com/sun/star/i18n/XExtendedInputSequenceChecker.hpp> #endif +#include <i18npool/lang.h> + #include <vos/ref.hxx> DBG_NAMEEX( EditView ) @@ -635,6 +637,7 @@ private: void ImplExpandCompressedPortions( EditLine* pLine, ParaPortion* pParaPortion, long nRemainingWidth ); void ImplInitLayoutMode( OutputDevice* pOutDev, USHORT nPara, USHORT nIndex ); + void ImplInitDigitMode( OutputDevice* pOutDev, String* pString, xub_StrLen nStt, xub_StrLen nLen, LanguageType eLang ); EditPaM ReadText( SvStream& rInput, EditSelection aSel ); EditPaM ReadRTF( SvStream& rInput, EditSelection aSel ); diff --git a/svx/source/editeng/impedit2.cxx b/svx/source/editeng/impedit2.cxx index 7576b580e0..b092861f7c 100644 --- a/svx/source/editeng/impedit2.cxx +++ b/svx/source/editeng/impedit2.cxx @@ -1,13 +1,13 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: impedit2.cxx,v $ - * $Revision: 1.124 $ + * $Revision: 1.124.40.1 $ * * This file is part of OpenOffice.org. * @@ -1672,13 +1672,30 @@ sal_Bool ImpEditEngine::IsInputSequenceCheckingRequired( sal_Unicode nChar, cons return bIsSequenceChecking; } +/************************************************************************* + * lcl_HasStrongLTR + *************************************************************************/ + bool lcl_HasStrongLTR ( const String& rTxt, xub_StrLen nStart, xub_StrLen nEnd ) + { + for ( xub_StrLen nCharIdx = nStart; nCharIdx < nEnd; ++nCharIdx ) + { + const UCharDirection nCharDir = u_charDirection ( rTxt.GetChar ( nCharIdx )); + if ( nCharDir == U_LEFT_TO_RIGHT || + nCharDir == U_LEFT_TO_RIGHT_EMBEDDING || + nCharDir == U_LEFT_TO_RIGHT_OVERRIDE ) + return true; + } + return false; + } + + + void ImpEditEngine::InitScriptTypes( USHORT nPara ) { ParaPortion* pParaPortion = GetParaPortions().SaveGetObject( nPara ); ScriptTypePosInfos& rTypes = pParaPortion->aScriptInfos; rTypes.Remove( 0, rTypes.Count() ); - // pParaPortion->aExtraCharInfos.Remove( 0, pParaPortion->aExtraCharInfos.Count() ); ContentNode* pNode = pParaPortion->GetNode(); @@ -1737,19 +1754,6 @@ void ImpEditEngine::InitScriptTypes( USHORT nPara ) nScriptType = _xBI->getScriptType( aOUText, nPos ); long nEndPos = _xBI->endOfScript( aOUText, nPos, nScriptType ); - // #96850# Handle blanks as weak, remove if BreakIterator returns WEAK for spaces. - if ( ( nScriptType == i18n::ScriptType::LATIN ) && ( aOUText.getStr()[ nPos ] == 0x20 ) ) - { - BOOL bOnlySpaces = TRUE; - for ( long n = nPos+1; ( n < nEndPos ) && bOnlySpaces; n++ ) - { - if ( aOUText.getStr()[ n ] != 0x20 ) - bOnlySpaces = FALSE; - } - if ( bOnlySpaces ) - nScriptType = i18n::ScriptType::WEAK; - } - if ( ( nScriptType == i18n::ScriptType::WEAK ) || ( nScriptType == rTypes[rTypes.Count()-1].nScriptType ) ) { // Expand last ScriptTypePosInfo, don't create weak or unecessary portions @@ -1765,6 +1769,61 @@ void ImpEditEngine::InitScriptTypes( USHORT nPara ) if ( rTypes[0].nScriptType == i18n::ScriptType::WEAK ) rTypes[0].nScriptType = ( rTypes.Count() > 1 ) ? rTypes[1].nScriptType : GetI18NScriptTypeOfLanguage( GetDefaultLanguage() ); + + // create writing direction information: + if ( !pParaPortion->aWritingDirectionInfos.Count() ) + InitWritingDirections( nPara ); + + // i89825: Use CTL font for numbers embedded into an RTL run: + WritingDirectionInfos& rDirInfos = pParaPortion->aWritingDirectionInfos; + for ( USHORT n = 0; n < rDirInfos.Count(); ++n ) + { + const xub_StrLen nStart = rDirInfos[n].nStartPos; + const xub_StrLen nEnd = rDirInfos[n].nEndPos; + const BYTE nCurrDirType = rDirInfos[n].nType; + + if ( nCurrDirType % 2 == UBIDI_RTL || // text in RTL run + ( nCurrDirType > UBIDI_LTR && !lcl_HasStrongLTR( aText, nStart, nEnd ) ) ) // non-strong text in embedded LTR run + { + USHORT nIdx = 0; + + // Skip entries in ScriptArray which are not inside the RTL run: + while ( nIdx < rTypes.Count() && rTypes[nIdx].nStartPos < nStart ) + ++nIdx; + + // Remove any entries *inside* the current run: + while ( nIdx < rTypes.Count() && rTypes[nIdx].nEndPos <= nEnd ) + rTypes.Remove( nIdx ); + + // special case: + if(nIdx < rTypes.Count() && rTypes[nIdx].nStartPos < nStart && rTypes[nIdx].nEndPos > nEnd) + { + rTypes.Insert( ScriptTypePosInfo( rTypes[nIdx].nScriptType, (USHORT)nEnd, rTypes[nIdx].nEndPos ), nIdx ); + rTypes[nIdx].nEndPos = nStart; + } + + if( nIdx ) + rTypes[nIdx - 1].nEndPos = nStart; + + rTypes.Insert( ScriptTypePosInfo( i18n::ScriptType::COMPLEX, (USHORT)nStart, (USHORT)nEnd), nIdx ); + ++nIdx; + + if( nIdx < rTypes.Count() ) + rTypes[nIdx].nStartPos = nEnd; + } + } + +#if OSL_DEBUG_LEVEL > 1 + USHORT nDebugStt = 0; + USHORT nDebugEnd = 0; + short nDebugType = 0; + for ( USHORT n = 0; n < rTypes.Count(); ++n ) + { + nDebugStt = rTypes[n].nStartPos; + nDebugEnd = rTypes[n].nEndPos; + nDebugType = rTypes[n].nScriptType; + } +#endif } } @@ -2491,7 +2550,7 @@ EditPaM ImpEditEngine::AutoCorrect( const EditSelection& rCurSel, xub_Unicode c, if ( aSel.HasRange() ) aSel = ImpDeleteSelection( rCurSel ); - // #i78661 allow application to turn off capitalization of + // #i78661 allow application to turn off capitalization of // start sentence explicitly. // (This is done by setting IsFirstWordCapitalization to FALSE.) BOOL bOldCptlSttSntnc = pAutoCorrect->IsAutoCorrFlag( CptlSttSntnc ); @@ -2520,7 +2579,7 @@ EditPaM ImpEditEngine::AutoCorrect( const EditSelection& rCurSel, xub_Unicode c, EditPaM aRight2Word( WordRight( aFirstWordSel.Max(), 1 ) ); aSecondWordSel = SelectWord( EditSelection( aRight2Word ) ); } - BOOL bIsFirstWordInFirstPara = aESel.nEndPara == 0 && + BOOL bIsFirstWordInFirstPara = aESel.nEndPara == 0 && aFirstWordSel.Max().GetIndex() <= aSel.Max().GetIndex() && aSel.Max().GetIndex() <= aSecondWordSel.Min().GetIndex(); @@ -2543,7 +2602,7 @@ EditPaM ImpEditEngine::AutoCorrect( const EditSelection& rCurSel, xub_Unicode c, } -EditPaM ImpEditEngine::InsertText( const EditSelection& rCurSel, +EditPaM ImpEditEngine::InsertText( const EditSelection& rCurSel, xub_Unicode c, BOOL bOverwrite, sal_Bool bIsUserInput ) { DBG_ASSERT( c != '\t', "Tab bei InsertText ?" ); @@ -2583,10 +2642,10 @@ EditPaM ImpEditEngine::InsertText( const EditSelection& rCurSel, if (_xISC.is() || pCTLOptions) { xub_StrLen nTmpPos = aPaM.GetIndex(); - sal_Int16 nCheckMode = pCTLOptions->IsCTLSequenceCheckingRestricted() ? + sal_Int16 nCheckMode = pCTLOptions->IsCTLSequenceCheckingRestricted() ? i18n::InputSequenceCheckMode::STRICT : i18n::InputSequenceCheckMode::BASIC; - // the text that needs to be checked is only the one + // the text that needs to be checked is only the one // before the current cursor position rtl::OUString aOldText( aPaM.GetNode()->Copy(0, nTmpPos) ); rtl::OUString aNewText( aOldText ); @@ -3125,7 +3184,7 @@ sal_uInt32 ImpEditEngine::CalcTextWidth( BOOL bIgnoreExtraSpace ) sal_uInt32 ImpEditEngine::CalcLineWidth( ParaPortion* pPortion, EditLine* pLine, BOOL bIgnoreExtraSpace ) { USHORT nPara = GetEditDoc().GetPos( pPortion->GetNode() ); - + // #114278# Saving both layout mode and language (since I'm // potentially changing both) GetRefDevice()->Push( PUSH_TEXTLAYOUTMODE|PUSH_TEXTLANGUAGE ); @@ -3160,6 +3219,7 @@ sal_uInt32 ImpEditEngine::CalcLineWidth( ParaPortion* pPortion, EditLine* pLine, SvxFont aTmpFont( pPortion->GetNode()->GetCharAttribs().GetDefFont() ); SeekCursor( pPortion->GetNode(), nPos+1, aTmpFont ); aTmpFont.SetPhysFont( GetRefDevice() ); + ImplInitDigitMode( GetRefDevice(), 0, 0, 0, aTmpFont.GetLanguage() ); nWidth += aTmpFont.QuickGetTextSize( GetRefDevice(), *pPortion->GetNode(), nPos, pTextPortion->GetLen(), NULL ).Width(); } } @@ -3559,7 +3619,7 @@ EditSelection ImpEditEngine::InsertText( uno::Reference< datatransfer::XTransfer SotExchange::GetFormatDataFlavor( SOT_FORMATSTR_ID_EDITENGINE, aFlavor ); if ( rxDataObj->isDataFlavorSupported( aFlavor ) ) { - try + try { uno::Any aData = rxDataObj->getTransferData( aFlavor ); uno::Sequence< sal_Int8 > aSeq; diff --git a/svx/source/editeng/impedit3.cxx b/svx/source/editeng/impedit3.cxx index 80ab2c4821..2acea25ec6 100644 --- a/svx/source/editeng/impedit3.cxx +++ b/svx/source/editeng/impedit3.cxx @@ -1,13 +1,13 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: impedit3.cxx,v $ - * $Revision: 1.125 $ + * $Revision: 1.125.40.1 $ * * This file is part of OpenOffice.org. * @@ -267,7 +267,7 @@ sal_Bool lcl_ConnectToPrev( xub_Unicode cCh, xub_Unicode cPrevCh ) // For Kashi } -// ---------------------------------------------------------------------- +// ---------------------------------------------------------------------- // class ImpEditEngine // ---------------------------------------------------------------------- void ImpEditEngine::UpdateViews( EditView* pCurView ) @@ -662,6 +662,7 @@ sal_Bool ImpEditEngine::CreateLines( USHORT nPara, sal_uInt32 nStartPosY ) // #114278# Saving both layout mode and language (since I'm // potentially changing both) + GetRefDevice()->Push( PUSH_TEXTLAYOUTMODE|PUSH_TEXTLANGUAGE ); ImplInitLayoutMode( GetRefDevice(), nPara, 0xFFFF ); @@ -761,7 +762,6 @@ sal_Bool ImpEditEngine::CreateLines( USHORT nPara, sal_uInt32 nStartPosY ) } } - long nMaxLineWidth; if ( !IsVertical() ) nMaxLineWidth = aStatus.AutoPageWidth() ? aMaxAutoPaperSize.Width() : aPaperSize.Width(); @@ -809,6 +809,8 @@ sal_Bool ImpEditEngine::CreateLines( USHORT nPara, sal_uInt32 nStartPosY ) { SeekCursor( pNode, nTmpPos+1, aTmpFont ); aTmpFont.SetPhysFont( GetRefDevice() ); + ImplInitDigitMode( GetRefDevice(), 0, 0, 0, aTmpFont.GetLanguage() ); + if ( IsFixedCellHeight() ) nTextLineHeight = ImplCalculateFontIndependentLineSpacing( aTmpFont.GetHeight() ); else @@ -988,6 +990,8 @@ sal_Bool ImpEditEngine::CreateLines( USHORT nPara, sal_uInt32 nStartPosY ) SeekCursor( pNode, nTmpPos+1, aTmpFont ); sal_Unicode cChar = 0; // later: NBS? aTmpFont.SetPhysFont( GetRefDevice() ); + ImplInitDigitMode( GetRefDevice(), 0, 0, 0, aTmpFont.GetLanguage() ); + String aFieldValue = cChar ? String(cChar) : ((EditCharAttribField*)pNextFeature)->GetFieldValue(); if ( bCalcCharPositions || !pPortion->HasValidSize() ) { @@ -1022,6 +1026,8 @@ sal_Bool ImpEditEngine::CreateLines( USHORT nPara, sal_uInt32 nStartPosY ) DBG_ASSERT( pPortion->GetLen() || bProcessingEmptyLine, "Empty Portion - Extra Space?!" ); SeekCursor( pNode, nTmpPos+1, aTmpFont ); aTmpFont.SetPhysFont( GetRefDevice() ); + ImplInitDigitMode( GetRefDevice(), 0, 0, 0, aTmpFont.GetLanguage() ); + if ( bCalcCharPositions || !pPortion->HasValidSize() ) { pPortion->GetSize() = aTmpFont.QuickGetTextSize( GetRefDevice(), *pParaPortion->GetNode(), nTmpPos, pPortion->GetLen(), pBuf ); @@ -1237,6 +1243,8 @@ sal_Bool ImpEditEngine::CreateLines( USHORT nPara, sal_uInt32 nStartPosY ) { SeekCursor( pNode, pLine->GetStart()+1, aTmpFont ); aTmpFont.SetPhysFont( pRefDev ); + ImplInitDigitMode( pRefDev, 0, 0, 0, aTmpFont.GetLanguage() ); + if ( IsFixedCellHeight() ) aTextSize.Height() = ImplCalculateFontIndependentLineSpacing( aTmpFont.GetHeight() ); else @@ -1244,7 +1252,6 @@ sal_Bool ImpEditEngine::CreateLines( USHORT nPara, sal_uInt32 nStartPosY ) pLine->SetHeight( (sal_uInt16)aTextSize.Height() ); } - // Die Fontmetriken koennen nicht kontinuierlich berechnet werden, // wenn der Font sowieso eingestellt ist, weil ggf. ein grosser Font // erst nach dem Umbrechen ploetzlich in der naechsten Zeile landet @@ -1259,6 +1266,7 @@ sal_Bool ImpEditEngine::CreateLines( USHORT nPara, sal_uInt32 nStartPosY ) { SeekCursor( pNode, nTPos+1, aTmpFont ); aTmpFont.SetPhysFont( GetRefDevice() ); + ImplInitDigitMode( GetRefDevice(), 0, 0, 0, aTmpFont.GetLanguage() ); RecalcFormatterFontMetrics( aFormatterMetrics, aTmpFont ); } nTPos = nTPos + pTP->GetLen(); @@ -2223,7 +2231,10 @@ sal_uInt16 ImpEditEngine::SplitTextPortion( ParaPortion* pPortion, sal_uInt16 nP SvxFont aTmpFont( pPortion->GetNode()->GetCharAttribs().GetDefFont() ); SeekCursor( pPortion->GetNode(), nTxtPortionStart+1, aTmpFont ); aTmpFont.SetPhysFont( GetRefDevice() ); + GetRefDevice()->Push( PUSH_TEXTLANGUAGE ); + ImplInitDigitMode( GetRefDevice(), 0, 0, 0, aTmpFont.GetLanguage() ); Size aSz = aTmpFont.QuickGetTextSize( GetRefDevice(), *pPortion->GetNode(), nTxtPortionStart, pTextPortion->GetLen(), NULL ); + GetRefDevice()->Pop(); pTextPortion->GetExtraInfos()->nOrgWidth = aSz.Width(); } } @@ -2895,7 +2906,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRec, Point aSta // VERT??? GetEditEnginePtr()->PaintingFirstLine( n, aParaStart, aTmpPos.Y(), aOrigin, nOrientation, pOutDev ); } - + // -------------------------------------------------- // Ueber die Portions der Zeile... // -------------------------------------------------- @@ -2974,8 +2985,8 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRec, Point aSta // #114278# Saving both layout mode and language (since I'm // potentially changing both) pOutDev->Push( PUSH_TEXTLAYOUTMODE|PUSH_TEXTLANGUAGE ); - ImplInitLayoutMode( pOutDev, n, nIndex ); + ImplInitDigitMode( pOutDev, 0, 0, 0, aTmpFont.GetLanguage() ); XubString aText; USHORT nTextStart = 0; @@ -3117,7 +3128,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRec, Point aSta aText += CH_HYPH; nTextStart = 0; nTextLen = aText.Len(); - + // #b6668980# crash when accessing 0 pointer in pDXArray pTmpDXArray = new sal_Int32[ aText.Len() ]; pDXArray = pTmpDXArray; @@ -3153,7 +3164,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRec, Point aSta if ( bStripOnly ) { EEngineData::WrongSpellVector aWrongSpellVector; - + if(GetStatus().DoOnlineSpelling() && pTextPortion->GetLen()) { WrongList* pWrongs = pPortion->GetNode()->GetWrongList(); @@ -3187,7 +3198,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRec, Point aSta // goto next index nStart = nEnd + 1; - + if(nEnd < nMaxEnd) { bWrong = pWrongs->NextWrong(nStart, nEnd); @@ -3206,7 +3217,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRec, Point aSta { EditCharAttrib* pAttr = pPortion->GetNode()->GetCharAttribs().FindFeature(nIndex); SvxFieldItem* pFieldItem = PTR_CAST(SvxFieldItem, pAttr->GetItem()); - + if(pFieldItem) { pFieldData = pFieldItem->GetField(); @@ -3226,8 +3237,11 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRec, Point aSta // consequence, but also already set at pOutDev) const Color aTextLineColor(pOutDev->GetTextLineColor()); + // Unicode code points conversion according to ctl text numeral setting + ImplInitDigitMode( 0, &aText, nTextStart, nTextLen, aTmpFont.GetLanguage() ); + // StripPortions() data callback - GetEditEnginePtr()->DrawingText( aOutPos, aText, nTextStart, nTextLen, pDXArray, + GetEditEnginePtr()->DrawingText( aOutPos, aText, nTextStart, nTextLen, pDXArray, aTmpFont, n, nIndex, pTextPortion->GetRightToLeft(), aWrongSpellVector.size() ? &aWrongSpellVector : 0, pFieldData, @@ -3560,13 +3574,13 @@ void ImpEditEngine::Paint( ImpEditView* pView, const Rectangle& rRec, sal_Bool b mpIMEInfos->pAttribs)) { sal_uInt16 nAttr = mpIMEInfos->pAttribs[ 0 ]; - if ( nAttr & EXTTEXTINPUT_ATTR_HIGHLIGHT ) + if ( nAttr & EXTTEXTINPUT_ATTR_HIGHLIGHT ) { const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); aFontColor = rStyleSettings.GetHighlightColor() ; } } - + UINT8 nColorDiff = aFontColor.GetColorError( aBackgroundColor ); if( nColorDiff < 8 ) aBackgroundColor = aFontColor.IsDark() ? COL_WHITE : COL_BLACK; @@ -4195,30 +4209,30 @@ const SvxNumberFormat* ImpEditEngine::GetNumberFormat( const ContentNode *pNode if (nPara < USHRT_MAX) { // the called function may be overloaded by an OutlinerEditEng object to provide - // access to the SvxNumberFormat of the Outliner. + // access to the SvxNumberFormat of the Outliner. // The EditEngine implementation will just return 0. pRes = pEditEngine->GetNumberFormat( nPara ); } - } + } return pRes; -} - -sal_Int32 ImpEditEngine::GetSpaceBeforeAndMinLabelWidth( - const ContentNode *pNode, +} + +sal_Int32 ImpEditEngine::GetSpaceBeforeAndMinLabelWidth( + const ContentNode *pNode, sal_Int32 *pnSpaceBefore, sal_Int32 *pnMinLabelWidth ) const { // nSpaceBefore matches the ODF attribut text:space-before // nMinLabelWidth matches the ODF attribut text:min-label-width - + const SvxNumberFormat *pNumFmt = GetNumberFormat( pNode ); - + // if no number format was found we have no Outliner or the numbering level // within the Outliner is -1 which means no number format should be applied. // Thus the default values to be returned are 0. sal_Int32 nSpaceBefore = 0; sal_Int32 nMinLabelWidth = 0; - + if (pNumFmt) { nMinLabelWidth = -pNumFmt->GetFirstLineOffset(); @@ -4231,13 +4245,76 @@ sal_Int32 ImpEditEngine::GetSpaceBeforeAndMinLabelWidth( *pnMinLabelWidth = nMinLabelWidth; return nSpaceBefore + nMinLabelWidth; -} +} const SvxLRSpaceItem& ImpEditEngine::GetLRSpaceItem( ContentNode* pNode ) { return (const SvxLRSpaceItem&)pNode->GetContentAttribs().GetItem( aStatus.IsOutliner() ? EE_PARA_OUTLLRSPACE : EE_PARA_LRSPACE ); } +// Either sets the digit mode at the output device or +// modifies the passed string according to the text numeral setting: +void ImpEditEngine::ImplInitDigitMode( OutputDevice* pOutDev, String* pString, xub_StrLen nStt, xub_StrLen nLen, LanguageType eCurLang ) +{ + // #114278# Also setting up digit language from Svt options + // (cannot reliably inherit the outdev's setting) + if( !pCTLOptions ) + pCTLOptions = new SvtCTLOptions; + + LanguageType eLang = eCurLang; + const SvtCTLOptions::TextNumerals nCTLTextNumerals = pCTLOptions->GetCTLTextNumerals(); + + if ( SvtCTLOptions::NUMERALS_HINDI == nCTLTextNumerals ) + eLang = LANGUAGE_ARABIC; + else if ( SvtCTLOptions::NUMERALS_ARABIC == nCTLTextNumerals ) + eLang = LANGUAGE_ENGLISH; + else if ( SvtCTLOptions::NUMERALS_SYSTEM == nCTLTextNumerals ) + eLang = (LanguageType) Application::GetSettings().GetLanguage(); + + if(pOutDev) + { + pOutDev->SetDigitLanguage( eLang ); + } + else if (pString) + { + // see sallayout.cxx in vcl + if ( eLang == LANGUAGE_ARABIC || + eLang == LANGUAGE_ARABIC_SAUDI_ARABIA || + eLang == LANGUAGE_ARABIC_IRAQ || + eLang == LANGUAGE_ARABIC_EGYPT || + eLang == LANGUAGE_ARABIC_LIBYA || + eLang == LANGUAGE_ARABIC_ALGERIA || + eLang == LANGUAGE_ARABIC_MOROCCO || + eLang == LANGUAGE_ARABIC_TUNISIA || + eLang == LANGUAGE_ARABIC_OMAN || + eLang == LANGUAGE_ARABIC_YEMEN || + eLang == LANGUAGE_ARABIC_SYRIA || + eLang == LANGUAGE_ARABIC_JORDAN || + eLang == LANGUAGE_ARABIC_LEBANON || + eLang == LANGUAGE_ARABIC_KUWAIT || + eLang == LANGUAGE_ARABIC_UAE || + eLang == LANGUAGE_ARABIC_BAHRAIN || + eLang == LANGUAGE_ARABIC_QATAR || + eLang == LANGUAGE_URDU || + eLang == LANGUAGE_URDU_PAKISTAN || + eLang == LANGUAGE_URDU_INDIA || + eLang == LANGUAGE_URDU_INDIA || + eLang == LANGUAGE_PUNJABI ) + { + const xub_StrLen nEnd = nStt + nLen; + int nOffset = 0x0660 - '0'; // arabic/persian/urdu + for( xub_StrLen nIdx = nStt; nIdx < nEnd; ++nIdx ) + { + sal_Unicode nChar = pString->GetChar( nIdx ); + if( (nChar < '0') || ('9' < nChar) ) + continue; + nChar = (sal_Unicode)(nChar + nOffset); + pString->SetChar( nIdx, nChar ); + } + } + } +} + void ImpEditEngine::ImplInitLayoutMode( OutputDevice* pOutDev, USHORT nPara, USHORT nIndex ) { BOOL bCTL = FALSE; @@ -4253,7 +4330,7 @@ void ImpEditEngine::ImplInitLayoutMode( OutputDevice* pOutDev, USHORT nPara, USH short nScriptType = GetScriptType( EditPaM( pNode, nIndex+1 ) ); bCTL = nScriptType == i18n::ScriptType::COMPLEX; bR2L = GetRightToLeft( nPara, nIndex + 1); // this change was discussed in issue 37190 - // it also works for issue 55927 + // it also works for issue 55927 } ULONG nLayoutMode = pOutDev->GetLayoutMode(); @@ -4277,22 +4354,6 @@ void ImpEditEngine::ImplInitLayoutMode( OutputDevice* pOutDev, USHORT nPara, USH } pOutDev->SetLayoutMode( nLayoutMode ); - - // #114278# Also setting up digit language from Svt options - // (cannot reliably inherit the outdev's setting) - LanguageType eLang; - - if( !pCTLOptions ) - pCTLOptions = new SvtCTLOptions; - - if ( SvtCTLOptions::NUMERALS_HINDI == pCTLOptions->GetCTLTextNumerals() ) - eLang = LANGUAGE_ARABIC; - else if ( SvtCTLOptions::NUMERALS_ARABIC == pCTLOptions->GetCTLTextNumerals() ) - eLang = LANGUAGE_ENGLISH; - else - eLang = (LanguageType) Application::GetSettings().GetLanguage(); - - pOutDev->SetDigitLanguage( eLang ); } Reference < i18n::XBreakIterator > ImpEditEngine::ImplGetBreakIterator() const diff --git a/svx/source/options/optctl.src b/svx/source/options/optctl.src index 85301236fe..7841b17b16 100644 --- a/svx/source/options/optctl.src +++ b/svx/source/options/optctl.src @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: optctl.src,v $ - * $Revision: 1.20 $ + * $Revision: 1.20.254.1 $ * * This file is part of OpenOffice.org. * @@ -113,6 +113,7 @@ TabPage RID_SVXPAGE_OPTIONS_CTL < "Arabic" ; > ; < "Hindi" ; > ; < "System" ; > ; + < "Context" ; > ; }; }; }; diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx index f0bf5c35cc..956eb1a45f 100644 --- a/svx/source/svdraw/svdotext.cxx +++ b/svx/source/svdraw/svdotext.cxx @@ -1,13 +1,13 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: svdotext.cxx,v $ - * $Revision: 1.90.18.1 $ + * $Revision: 1.90.40.1 $ * * This file is part of OpenOffice.org. * @@ -1128,7 +1128,7 @@ void SdrTextObj::StopTextAnimation(OutputDevice* /*pOutDev*/, long /*nExtraData* SdrObject* SdrTextObj::CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const { - if(!bTextFrame && !GetOutlinerParaObject() ) + if(!bTextFrame && !GetOutlinerParaObject() ) { return NULL; } @@ -1572,8 +1572,8 @@ void SdrTextObj::NbcSetOutlinerParaObjectForText( OutlinerParaObject* pTextObjec if( pText->GetOutlinerParaObject() ) { - SvxWritingModeItem aWritingMode(pText->GetOutlinerParaObject()->IsVertical() - ? com::sun::star::text::WritingMode_TB_RL + SvxWritingModeItem aWritingMode(pText->GetOutlinerParaObject()->IsVertical() + ? com::sun::star::text::WritingMode_TB_RL : com::sun::star::text::WritingMode_LR_TB, SDRATTR_TEXTDIRECTION); GetProperties().SetObjectItemDirect(aWritingMode); @@ -1615,6 +1615,13 @@ void SdrTextObj::NbcReformatText() SetRectsDirty(sal_True); } SetTextSizeDirty(); + ActionChanged(); + // FME, AW: i22396 + // Necessary here since we have no compare operator at the outliner + // para object which may detect changes regarding the combination + // of outliner para data and configuration (e.g., change of + // formatting of text numerals) + FlushViewContact(); } } @@ -1625,7 +1632,7 @@ void SdrTextObj::ReformatText() Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect(); - + // #110094#-14 SendRepaintBroadcast(); NbcReformatText(); SetChanged(); @@ -1836,7 +1843,7 @@ sal_Bool SdrTextObj::TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegfx:: if(!basegfx::fTools::equalZero(fRotate)) { // #i78696# - // fRotate is from the old GeoStat and thus mathematically wrong orientated. For + // fRotate is from the old GeoStat and thus mathematically wrong orientated. For // the linear combination of matrices it needed to be fixed in the API, so it needs to // be mirrored here rMatrix.rotate(-fRotate); @@ -1930,7 +1937,7 @@ void SdrTextObj::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const b { GeoStat aGeoStat; - // #i78696# + // #i78696# // fRotate is matematically correct, but aGeoStat.nDrehWink is // mirrored -> mirror value here aGeoStat.nDrehWink = NormAngle360(FRound(-fRotate / F_PI18000)); |