diff -r 1ed7b2431f10 sw/inc/paratr.hxx --- a/sw/inc/paratr.hxx Mon Feb 14 12:37:17 2011 +0100 +++ b/sw/inc/paratr.hxx Thu Apr 21 01:19:45 2011 +0200 @@ -34,6 +34,7 @@ #include #include #include +#include class SwCharFmt; class IntlWrapper; @@ -51,12 +52,12 @@ //SwFmtDrop an die Absatze propagiert. class SW_DLLPUBLIC SwFmtDrop: public SfxPoolItem, public SwClient { - SwModify* pDefinedIn; // Modify-Object, in dem der DropCaps steht - // kann nur TxtFmtCollection/TxtNode sein - sal_uInt16 nDistance; // Abstand zum Textbeginn - sal_uInt16 nReadFmt; // fuer den Sw3-Reader: CharFormat-Id (Pool laden!) - sal_uInt8 nLines; // Anzahl der Zeilen - sal_uInt8 nChars; // Anzahl der Zeichen + SwModify* pDefinedIn; // Modify-Object, in which DropCaps exists + // can have only TxtFmtCollection/TxtNode + sal_uInt16 nDistance; // Distance from the text beginning + sal_uInt16 nReadFmt; // for the Sw3-Reader: CharFormat-Id (Pool load!) + sal_uInt8 nLines; // Number of lines + sal_uInt8 nChars; // Number of characters sal_Bool bWholeWord; // Erstes Wort als Initialen public: TYPEINFO(); //Bereits in der Basisklasse SwClient diff -r 1ed7b2431f10 sw/source/core/text/guess.cxx --- a/sw/source/core/text/guess.cxx Mon Feb 14 12:37:17 2011 +0100 +++ b/sw/source/core/text/guess.cxx Thu Apr 21 01:19:45 2011 +0200 @@ -28,7 +28,6 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" - #include #include #include // needed for SW_MOD() macro @@ -46,6 +45,7 @@ #include #include #include +#include using ::rtl::OUString; using namespace ::com::sun::star; @@ -69,7 +69,7 @@ { nCutPos = rInf.GetIdx(); - // Leere Strings sind immer 0 + // Empty strings are always 0 if( !rInf.GetLen() || !rInf.GetTxt().Len() ) return sal_False; @@ -192,8 +192,8 @@ nBreakWidth = nMinSize; - // Der folgende Vergleich sollte eigenlich immer sal_True ergeben, sonst - // hat es wohl bei GetTxtBreak einen Pixel-Rundungsfehler gegeben... + // The following comparison should always give sal_True, otherwise + // a pixel rounding error in GetTxtBreak will appear if ( nBreakWidth <= nLineWidth ) { if( nItalic && ( nBreakPos + 1 ) >= rInf.GetTxt().Len() ) @@ -223,21 +223,32 @@ { nBreakPos = nCutPos; xub_StrLen nX = nBreakPos; + + const SvxAdjust& rAdjust = rInf.GetTxtFrm()->GetTxtNode()->GetSwAttrSet().GetAdjust().GetAdjust(); + if ( rAdjust == SVX_ADJUST_LEFT ) + { + // we step back until a non blank character has been found + // or there is only one more character left + while( nX && nBreakPos > rInf.GetTxt().Len() && + ( CH_BLANK == ( cCutChar = rInf.GetChar( --nX ) ) || + CH_FULL_BLANK == cCutChar ) ) + --nBreakPos; + } + else + { + while( nX && nBreakPos > rInf.GetLineStart() + 1 && + ( CH_BLANK == ( cCutChar = rInf.GetChar( --nX ) ) || + CH_FULL_BLANK == cCutChar ) ) + --nBreakPos; + } - // we step back until a non blank character has been found - // or there is only one more character left - while( nX && nBreakPos > rInf.GetLineStart() + 1 && - ( CH_BLANK == ( cCutChar = rInf.GetChar( --nX ) ) || - CH_FULL_BLANK == cCutChar ) ) - --nBreakPos; - - if( nBreakPos > rInf.GetIdx() ) - nPorLen = nBreakPos - rInf.GetIdx(); + if( nBreakPos > rInf.GetIdx() ) + nPorLen = nBreakPos - rInf.GetIdx(); while( ++nCutPos < rInf.GetTxt().Len() && ( CH_BLANK == ( cCutChar = rInf.GetChar( nCutPos ) ) || CH_FULL_BLANK == cCutChar ) ) ; // nothing - + nBreakStart = nCutPos; } else if( pBreakIt->GetBreakIter().is() ) @@ -433,16 +444,20 @@ CHAR_SOFTHYPHEN == rInf.GetTxt().GetChar( nBreakPos - 1 ) ) nBreakPos = rInf.GetIdx() - 1; - // Delete any blanks at the end of a line, but be careful: - // If a field has been expanded, we do not want to delete any - // blanks inside the field portion. This would cause an unwanted - // underflow - xub_StrLen nX = nBreakPos; - while( nX > rInf.GetLineStart() && - ( CH_TXTATR_BREAKWORD != cFldChr || nX > rInf.GetIdx() ) && - ( CH_BLANK == rInf.GetChar( --nX ) || - CH_FULL_BLANK == rInf.GetChar( nX ) ) ) - nBreakPos = nX; + const SvxAdjust& rAdjust = rInf.GetTxtFrm()->GetTxtNode()->GetSwAttrSet().GetAdjust().GetAdjust(); + if( rAdjust != SVX_ADJUST_LEFT ) + { + // Delete any blanks at the end of a line, but be careful: + // If a field has been expanded, we do not want to delete any + // blanks inside the field portion. This would cause an unwanted + // underflow + xub_StrLen nX = nBreakPos; + while( nX > rInf.GetLineStart() && + ( CH_TXTATR_BREAKWORD != cFldChr || nX > rInf.GetIdx() ) && + ( CH_BLANK == rInf.GetChar( --nX ) || + CH_FULL_BLANK == rInf.GetChar( nX ) ) ) + nBreakPos = nX; + } if( nBreakPos > rInf.GetIdx() ) nPorLen = nBreakPos - rInf.GetIdx(); }