summaryrefslogtreecommitdiff
path: root/editeng/source/editeng/impedit4.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'editeng/source/editeng/impedit4.cxx')
-rwxr-xr-xediteng/source/editeng/impedit4.cxx89
1 files changed, 64 insertions, 25 deletions
diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx
index a2ff143495..4045739d45 100755
--- a/editeng/source/editeng/impedit4.cxx
+++ b/editeng/source/editeng/impedit4.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -321,7 +322,7 @@ void lcl_FindValidAttribs( ItemList& rLst, ContentNode* pNode, sal_uInt16 nIndex
if ( pAttr->GetEnd() > nIndex )
{
if ( IsScriptItemValid( pAttr->GetItem()->Which(), nScriptType ) )
- rLst.Insert( pAttr->GetItem(), LIST_APPEND );
+ rLst.Insert( pAttr->GetItem() );
}
nAttr++;
pAttr = GetAttrib( pNode->GetCharAttribs().GetAttribs(), nAttr );
@@ -684,11 +685,11 @@ sal_uInt32 ImpEditEngine::WriteRTF( SvStream& rOutput, EditSelection aSel )
if ( !n || IsScriptChange( EditPaM( pNode, nIndex ) ) )
{
SfxItemSet aAttribs = GetAttribs( nNode, nIndex+1, nIndex+1 );
- aAttribItems.Insert( &aAttribs.Get( GetScriptItemId( EE_CHAR_FONTINFO, nScriptType ) ), LIST_APPEND );
- aAttribItems.Insert( &aAttribs.Get( GetScriptItemId( EE_CHAR_FONTHEIGHT, nScriptType ) ), LIST_APPEND );
- aAttribItems.Insert( &aAttribs.Get( GetScriptItemId( EE_CHAR_WEIGHT, nScriptType ) ), LIST_APPEND );
- aAttribItems.Insert( &aAttribs.Get( GetScriptItemId( EE_CHAR_ITALIC, nScriptType ) ), LIST_APPEND );
- aAttribItems.Insert( &aAttribs.Get( GetScriptItemId( EE_CHAR_LANGUAGE, nScriptType ) ), LIST_APPEND );
+ aAttribItems.Insert( &aAttribs.Get( GetScriptItemId( EE_CHAR_FONTINFO, nScriptType ) ) );
+ aAttribItems.Insert( &aAttribs.Get( GetScriptItemId( EE_CHAR_FONTHEIGHT, nScriptType ) ) );
+ aAttribItems.Insert( &aAttribs.Get( GetScriptItemId( EE_CHAR_WEIGHT, nScriptType ) ) );
+ aAttribItems.Insert( &aAttribs.Get( GetScriptItemId( EE_CHAR_ITALIC, nScriptType ) ) );
+ aAttribItems.Insert( &aAttribs.Get( GetScriptItemId( EE_CHAR_LANGUAGE, nScriptType ) ) );
}
// #96298# Insert hard attribs AFTER CJK attribs...
lcl_FindValidAttribs( aAttribItems, pNode, nIndex, nScriptType );
@@ -1159,7 +1160,7 @@ EditTextObject* ImpEditEngine::CreateBinTextObject( EditSelection aSel, SfxItemP
// Schwelle rauf setzen, wenn Olli die Absaetze nicht mehr zerhackt!
if ( bAllowBigObjects && bOnlyFullParagraphs && IsFormatted() && GetUpdateMode() && ( nTextPortions >= nBigObjectStart ) )
{
- XParaPortionList* pXList = new XParaPortionList( GetRefDevice(), aPaperSize.Width() );
+ XParaPortionList* pXList = new XParaPortionList( GetRefDevice(), aPaperSize.Width(), nStretchX, nStretchY );
pTxtObj->SetPortionInfo( pXList );
for ( nNode = nStartNode; nNode <= nEndNode; nNode++ )
{
@@ -1250,7 +1251,9 @@ EditSelection ImpEditEngine::InsertBinTextObject( BinTextObject& rTextObject, Ed
XParaPortionList* pPortionInfo = rTextObject.GetPortionInfo();
if ( pPortionInfo && ( (long)pPortionInfo->GetPaperWidth() == aPaperSize.Width() )
- && ( pPortionInfo->GetRefMapMode() == GetRefDevice()->GetMapMode() ) )
+ && ( pPortionInfo->GetRefMapMode() == GetRefDevice()->GetMapMode() )
+ && ( pPortionInfo->GetStretchX() == nStretchX )
+ && ( pPortionInfo->GetStretchY() == nStretchY ) )
{
if ( ( pPortionInfo->GetRefDevPtr() == (sal_uIntPtr)GetRefDevice() ) ||
( ( pPortionInfo->GetRefDevType() == OUTDEV_VIRDEV ) &&
@@ -1956,16 +1959,12 @@ Reference< XSpellAlternatives > ImpEditEngine::ImpSpell( EditView* pEditView )
return xSpellAlt;
#endif
}
-/*-- 13.10.2003 16:43:27---------------------------------------------------
- -----------------------------------------------------------------------*/
void ImpEditEngine::EndSpelling()
{
DELETEZ(pSpellInfo);
}
-/*-- 13.10.2003 16:43:27---------------------------------------------------
- -----------------------------------------------------------------------*/
void ImpEditEngine::StartSpelling(EditView& rEditView, sal_Bool bMultipleDoc)
{
DBG_ASSERT(!pSpellInfo, "pSpellInfo already set?");
@@ -1973,9 +1972,7 @@ void ImpEditEngine::StartSpelling(EditView& rEditView, sal_Bool bMultipleDoc)
EditSelection aCurSel( rEditView.pImpEditView->GetEditSelection() );
pSpellInfo = CreateSpellInfo( aCurSel, bMultipleDoc );
}
-/*-- 13.10.2003 16:43:27---------------------------------------------------
- Search for the next wrong word within the given selection
- -----------------------------------------------------------------------*/
+
Reference< XSpellAlternatives > ImpEditEngine::ImpFindNextError(EditSelection& rSelection)
{
/* ContentNode* pLastNode = */ aEditDoc.SaveGetObject( (aEditDoc.Count()-1) );
@@ -2021,7 +2018,6 @@ Reference< XSpellAlternatives > ImpEditEngine::ImpFindNextError(EditSelection& r
}
return xSpellAlt;
}
-/*-- 13.10.2003 16:43:27---------------------------------------------------
-----------------------------------------------------------------------*/
bool ImpEditEngine::SpellSentence(EditView& rEditView,
@@ -2087,9 +2083,7 @@ bool ImpEditEngine::SpellSentence(EditView& rEditView,
return bRet;
}
-/*-- 15.10.2003 16:09:12---------------------------------------------------
- adds one portion to the SpellPortions
- -----------------------------------------------------------------------*/
+// Adds one portion to the SpellPortions
void ImpEditEngine::AddPortion(
const EditSelection rSel,
uno::Reference< XSpellAlternatives > xAlt,
@@ -2115,9 +2109,7 @@ void ImpEditEngine::AddPortion(
#endif
}
-/*-- 15.10.2003 16:07:47---------------------------------------------------
- adds one or more portions of text to the SpellPortions depending on language changes
- -----------------------------------------------------------------------*/
+// Adds one or more portions of text to the SpellPortions depending on language changes
void ImpEditEngine::AddPortionIterated(
EditView& rEditView,
const EditSelection rSel,
@@ -2323,9 +2315,7 @@ void ImpEditEngine::ApplyChangedSentence(EditView& rEditView,
}
#endif
}
-/*-- 08.09.2008 11:33:02---------------------------------------------------
- -----------------------------------------------------------------------*/
void ImpEditEngine::PutSpellingToSentenceStart( EditView& rEditView )
{
#ifdef SVX_LIGHT
@@ -2334,7 +2324,7 @@ void ImpEditEngine::PutSpellingToSentenceStart( EditView& rEditView )
{
rEditView.pImpEditView->SetEditSelection( pSpellInfo->aLastSpellContentSelections.begin()->Min() );
}
-
+
#endif
}
@@ -2912,6 +2902,54 @@ EditSelection ImpEditEngine::TransliterateText( const EditSelection& rSelection,
SvxCreateLocale( GetLanguage( EditPaM( pNode, aEndBndry.startPos + 1 ) ) ),
nWordType);
}
+ // prevent advancing to the next word if selection is at word boundary
+ if (aEndBndry.startPos >= nEndPos)
+ {
+ aEndBndry = _xBI->previousWord(
+ *pNode, aEndBndry.startPos,
+ SvxCreateLocale( GetLanguage( EditPaM( pNode, aEndBndry.startPos + 1 ) ) ),
+ nWordType);
+ }
+
+ i18n::Boundary aCurWordBndry( aSttBndry );
+ while (aCurWordBndry.startPos <= aEndBndry.startPos)
+ {
+ nCurrentStart = (xub_StrLen)aCurWordBndry.startPos;
+ nCurrentEnd = (xub_StrLen)aCurWordBndry.endPos;
+ sal_Int32 nLen = nCurrentEnd - nCurrentStart;
+ DBG_ASSERT( nLen > 0, "invalid word length of 0" );
+#if OSL_DEBUG_LEVEL > 1
+ String aText( pNode->Copy( nCurrentStart, nLen ) );
+#endif
+
+ Sequence< sal_Int32 > aOffsets;
+ String aNewText( aTranslitarationWrapper.transliterate( *pNode,
+ GetLanguage( EditPaM( pNode, nCurrentStart + 1 ) ),
+ nCurrentStart, nLen, &aOffsets ));
+
+ if (!pNode->Equals( aNewText, nCurrentStart, nLen ))
+ {
+ aChgData.nStart = nCurrentStart;
+ aChgData.nLen = nLen;
+ aChgData.aSelection = EditSelection( EditPaM( pNode, nCurrentStart ), EditPaM( pNode, nCurrentEnd ) );
+ aChgData.aNewText = aNewText;
+ aChgData.aOffsets = aOffsets;
+ aChanges.push_back( aChgData );
+ }
+#if OSL_DEBUG_LEVEL > 1
+ String aSelTxt ( GetSelected( aChgData.aSelection ) );
+ (void) aSelTxt;
+#endif
+
+ aCurWordBndry = _xBI->nextWord( *pNode, nCurrentEnd,
+ SvxCreateLocale( GetLanguage( EditPaM( pNode, nCurrentEnd + 1 ) ) ),
+ nWordType);
+ }
+ DBG_ASSERT( nCurrentEnd >= aEndBndry.endPos, "failed to reach end of transliteration" );
+ }
+ else if (nTransliterationMode == i18n::TransliterationModulesExtra::SENTENCE_CASE)
+ {
+ // for 'sentence case' we need to iterate sentence by sentence
i18n::Boundary aCurWordBndry( aSttBndry );
while (aCurWordBndry.startPos <= aEndBndry.startPos)
@@ -3249,3 +3287,4 @@ long ImpEditEngine::LogicToTwips( long n )
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */