View | Details | Raw Unified | Return to issue 33074
Collapse All | Expand All

(-)source/filter/ww8/wrtw8nds.cxx (-125 / +298 lines)
Lines 219-224 Link Here
219
#ifndef _COM_SUN_STAR_I18N_SCRIPTTYPE_HDL_
219
#ifndef _COM_SUN_STAR_I18N_SCRIPTTYPE_HDL_
220
#include <com/sun/star/i18n/ScriptType.hdl>
220
#include <com/sun/star/i18n/ScriptType.hdl>
221
#endif
221
#endif
222
#ifndef INCLUDED_I18NUTIL_UNICODE_HXX
223
#include <i18nutil/unicode.hxx>  //unicode::getUnicodeScriptType
224
#endif
222
225
223
#ifndef _WRTWW8_HXX
226
#ifndef _WRTWW8_HXX
224
#include "wrtww8.hxx"
227
#include "wrtww8.hxx"
Lines 280-303 Link Here
280
    :   mpFlyFrm(pFlyFrm), mpNode(pNode), maPos(rPos) {}
283
    :   mpFlyFrm(pFlyFrm), mpNode(pNode), maPos(rPos) {}
281
};
284
};
282
285
286
struct CharRunEntry
287
{
288
    xub_StrLen mnEndPos;
289
    sal_uInt16 mnScript;
290
    rtl_TextEncoding meCharSet;
291
    bool mbRTL;
292
    CharRunEntry(xub_StrLen nEndPos, sal_uInt16 nScript,
293
        rtl_TextEncoding eCharSet, bool bRTL)
294
    : mnEndPos(nEndPos), mnScript(nScript), meCharSet(eCharSet),
295
    mbRTL(bRTL)
296
    {
297
    }
298
};
299
300
typedef std::vector<CharRunEntry> CharRuns;
301
typedef CharRuns::const_iterator cCharRunIter;
302
303
namespace
304
{
305
    //Utility to remove entries before a given starting position
306
    class IfBeforeStart
307
        : public std::unary_function<const CharRunEntry&, bool>
308
    {
309
    private:
310
        xub_StrLen mnStart;
311
    public:
312
        IfBeforeStart(xub_StrLen nStart) : mnStart(nStart) {}
313
        bool operator()(const CharRunEntry &rEntry) const
314
        {
315
            return rEntry.mnEndPos < mnStart;
316
        }
317
    };
318
}
319
283
class WW8_SwAttrIter : public WW8_AttrIter
320
class WW8_SwAttrIter : public WW8_AttrIter
284
{
321
{
285
private:
322
private:
286
	const SwTxtNode& rNd;
323
	const SwTxtNode& rNd;
287
    std::list<CurrentCharSet> maCharSets;
324
288
    typedef std::list<CurrentCharSet>::iterator mychsiter;
325
    CharRuns maCharRuns;
326
    cCharRunIter maCharRunIter;
327
328
	rtl_TextEncoding meChrSet;
329
    USHORT mnScript;
330
    bool mbCharIsRTL;
331
289
	const SwRedline* pCurRedline;
332
	const SwRedline* pCurRedline;
290
	xub_StrLen nAktSwPos;
333
	xub_StrLen nAktSwPos;
291
	xub_StrLen nTmpSwPos;					// fuer HasItem()
334
	xub_StrLen nTmpSwPos;					// fuer HasItem()
292
	USHORT nCurRedlinePos;
335
	USHORT nCurRedlinePos;
293
	rtl_TextEncoding eNdChrSet;
294
    USHORT nScript;
295
336
296
    typedef std::pair<UTextOffset, bool> Entry;
297
    std::vector<Entry> maDirChanges;
298
    typedef std::vector<Entry>::const_iterator myciter;
299
    myciter maBiDiIter;
300
    bool mbCharIsRTL;
301
    bool mbParaIsRTL;
337
    bool mbParaIsRTL;
302
338
303
    std::vector<swFlyFrm> maFlyFrms;     // #i2916#
339
    std::vector<swFlyFrm> maFlyFrms;     // #i2916#
Lines 305-311 Link Here
305
    myflyiter maFlyIter;
341
    myflyiter maFlyIter;
306
342
307
	xub_StrLen SearchNext( xub_StrLen nStartPos );
343
	xub_StrLen SearchNext( xub_StrLen nStartPos );
308
	void SetCharSet(const SwTxtAttr& rTxtAttr, bool bStart);
309
	void FieldVanish( const String& rTxt );
344
	void FieldVanish( const String& rTxt );
310
345
311
	void OutSwFmtINetFmt(const SwFmtINetFmt& rAttr, bool bStart);
346
	void OutSwFmtINetFmt(const SwFmtINetFmt& rAttr, bool bStart);
Lines 313-318 Link Here
313
	void OutSwTOXMark(const SwTOXMark& rAttr, bool bStart);
348
	void OutSwTOXMark(const SwTOXMark& rAttr, bool bStart);
314
	void OutSwFmtRuby(const SwFmtRuby& rRuby, bool bStart);
349
	void OutSwFmtRuby(const SwFmtRuby& rRuby, bool bStart);
315
350
351
    void IterToCurrent();
352
316
    //No copying
353
    //No copying
317
    WW8_SwAttrIter(const WW8_SwAttrIter&);
354
    WW8_SwAttrIter(const WW8_SwAttrIter&);
318
    WW8_SwAttrIter& operator=(const WW8_SwAttrIter&);
355
    WW8_SwAttrIter& operator=(const WW8_SwAttrIter&);
Lines 332-342 Link Here
332
    void OutFlys(xub_StrLen nSwPos);
369
    void OutFlys(xub_StrLen nSwPos);
333
370
334
	xub_StrLen WhereNext() const					{ return nAktSwPos; }
371
	xub_StrLen WhereNext() const					{ return nAktSwPos; }
335
	rtl_TextEncoding GetNextCharSet() const;
372
    sal_uInt16 GetScript() const { return mnScript; }
336
	rtl_TextEncoding GetNodeCharSet() const				{ return eNdChrSet; }
337
338
    bool IsCharRTL() const {return mbCharIsRTL; }
373
    bool IsCharRTL() const {return mbCharIsRTL; }
339
    bool IsParaRTL() const {return mbParaIsRTL; }
374
    bool IsParaRTL() const {return mbParaIsRTL; }
375
    rtl_TextEncoding GetCharSet() const { return meChrSet; }
376
    String GetSnippet(const String &rStr, xub_StrLen nAktPos,
377
        xub_StrLen nLen) const;
340
};
378
};
341
379
342
class sortswflys :
380
class sortswflys :
Lines 349-391 Link Here
349
    }
387
    }
350
};
388
};
351
389
352
WW8_SwAttrIter::WW8_SwAttrIter(SwWW8Writer& rWr, const SwTxtNode& rTxtNd)
390
void WW8_SwAttrIter::IterToCurrent()
353
	: WW8_AttrIter(rWr), rNd(rTxtNd), pCurRedline(0), nAktSwPos(0),
354
	nTmpSwPos(0), nCurRedlinePos(USHRT_MAX), mbCharIsRTL(false)
355
{
391
{
356
    SwPosition aPos(rTxtNd);
392
    ASSERT(maCharRuns.begin() != maCharRuns.end(), "Impossible");
357
    if (FRMDIR_HORI_RIGHT_TOP == rWr.pDoc->GetTextDirection(aPos))
393
    mnScript = maCharRunIter->mnScript;
358
        mbParaIsRTL = true;
394
    meChrSet = maCharRunIter->meCharSet;
359
    else
395
    mbCharIsRTL = maCharRunIter->mbRTL;
360
        mbParaIsRTL = false;
396
}
361
397
362
	// Attributwechsel an Pos 0 wird ignoriert, da davon ausgegangen
398
namespace
363
	// wird, dass am Absatzanfang sowieso die Attribute neu ausgegeben
399
{
364
	// werden.
400
    /*
365
	eNdChrSet =
401
     Utility to categorize unicode characters into the best fit windows charset
366
        ((SvxFontItem&)rNd.SwCntntNode::GetAttr(RES_CHRATR_FONT)).GetCharSet();
402
     range for exporting to ww6, or as a hint to non \u unicode token aware rtf
367
    eNdChrSet = GetExtendedTextEncoding(eNdChrSet);
403
     readers
404
    */
405
    rtl_TextEncoding getScriptClass(sal_Unicode cChar)
406
    {
407
        using namespace com::sun::star::i18n;
368
408
369
    const String &rTxt = rTxtNd.GetTxt();
409
        static ScriptTypeList aScripts[] =
410
        {
411
            { UnicodeScript_kBasicLatin, RTL_TEXTENCODING_MS_1252},
412
            { UnicodeScript_kLatin1Supplement, RTL_TEXTENCODING_MS_1252},
413
            { UnicodeScript_kLatinExtendedA, RTL_TEXTENCODING_MS_1250},
414
            { UnicodeScript_kLatinExtendedB, RTL_TEXTENCODING_MS_1257},
415
            { UnicodeScript_kGreek, RTL_TEXTENCODING_MS_1253},
416
            { UnicodeScript_kCyrillic, RTL_TEXTENCODING_MS_1251},
417
            { UnicodeScript_kHebrew, RTL_TEXTENCODING_MS_1255},
418
            { UnicodeScript_kArabic, RTL_TEXTENCODING_MS_1256},
419
            { UnicodeScript_kThai, RTL_TEXTENCODING_MS_1258},
420
            { UnicodeScript_kScriptCount, RTL_TEXTENCODING_MS_1252}
421
        };
422
423
        return unicode::getUnicodeScriptType(cChar, aScripts,
424
            RTL_TEXTENCODING_MS_1252);
425
    }
370
426
371
    if( pBreakIt->xBreak.is() )
372
        nScript = pBreakIt->xBreak->getScriptType(rTxt, 0);
373
    else
374
        nScript = ScriptType::LATIN;
375
427
376
    if (rTxt.Len())
428
    CharRuns GetPseudoCharRuns(const SwTxtNode& rTxtNd,
429
        xub_StrLen nTxtStart, bool bSplitOnCharSet)
377
    {
430
    {
378
        UBiDiDirection eDefaultDir = mbParaIsRTL ? UBIDI_RTL : UBIDI_LTR;
431
        const String &rTxt = rTxtNd.GetTxt();
432
433
        bool bParaIsRTL = false;
434
        ASSERT(rTxtNd.GetDoc(), "No document for node?, suspicious");
435
        if (rTxtNd.GetDoc())
436
        {
437
            if (FRMDIR_HORI_RIGHT_TOP ==
438
                rTxtNd.GetDoc()->GetTextDirection(SwPosition(rTxtNd)))
439
            {
440
                bParaIsRTL = true;
441
            }
442
        }
443
444
        using namespace com::sun::star::i18n;
445
446
        sal_uInt16 nScript = ScriptType::LATIN;
447
        if (rTxt.Len() && pBreakIt && pBreakIt->xBreak.is())
448
            nScript = pBreakIt->xBreak->getScriptType(rTxt, 0);
449
450
        rtl_TextEncoding eChrSet = ((const SvxFontItem&)
451
        (rTxtNd.SwCntntNode::GetAttr(GetWhichOfScript(RES_CHRATR_FONT, nScript))))
452
        .GetCharSet();
453
        eChrSet = GetExtendedTextEncoding(eChrSet);
454
455
        CharRuns aRunChanges;
456
457
        if (!rTxt.Len())
458
        {
459
            aRunChanges.push_back(CharRunEntry(0, nScript, eChrSet,
460
                bParaIsRTL));
461
            return aRunChanges;
462
        }
463
464
        typedef std::pair<int32_t, bool> DirEntry;
465
        typedef std::vector<DirEntry> DirChanges;
466
        typedef DirChanges::const_iterator cDirIter;
467
468
        typedef std::pair<xub_StrLen, sal_Int16> CharSetEntry;
469
        typedef std::vector<CharSetEntry> CharSetChanges;
470
        typedef CharSetChanges::const_iterator cCharSetIter;
471
472
        typedef std::pair<xub_StrLen, sal_uInt16> ScriptEntry;
473
        typedef std::vector<ScriptEntry> ScriptChanges;
474
        typedef ScriptChanges::const_iterator cScriptIter;
475
476
        DirChanges aDirChanges;
477
        CharSetChanges aCharSets;
478
        ScriptChanges aScripts;
479
480
        UBiDiDirection eDefaultDir = bParaIsRTL ? UBIDI_RTL : UBIDI_LTR;
379
        UErrorCode nError = U_ZERO_ERROR;
481
        UErrorCode nError = U_ZERO_ERROR;
380
        UBiDi* pBidi = ubidi_openSized(rTxt.Len(), 0, &nError);
482
        UBiDi* pBidi = ubidi_openSized(rTxt.Len(), 0, &nError);
381
        ubidi_setPara(pBidi, rTxt.GetBuffer(), rTxt.Len(), eDefaultDir, NULL,
483
        ubidi_setPara(pBidi, rTxt.GetBuffer(), rTxt.Len(), eDefaultDir,
382
            &nError);
484
            0, &nError);
383
485
384
        sal_Int32 nCount = ubidi_countRuns(pBidi, &nError);
486
        sal_Int32 nCount = ubidi_countRuns(pBidi, &nError);
385
        maDirChanges.reserve(nCount);
487
        aDirChanges.reserve(nCount);
386
488
387
        UTextOffset nStart = 0;
489
        int32_t nStart = 0;
388
        UTextOffset nEnd;
490
        int32_t nEnd;
389
        UBiDiLevel nCurrDir;
491
        UBiDiLevel nCurrDir;
390
492
391
        for (sal_Int32 nIdx = 0; nIdx < nCount; ++nIdx)
493
        for (sal_Int32 nIdx = 0; nIdx < nCount; ++nIdx)
Lines 395-415 Link Here
395
            UBiDiLevel is the type of the level values in this BiDi
497
            UBiDiLevel is the type of the level values in this BiDi
396
            implementation.
498
            implementation.
397
499
398
            It holds an embedding level and indicates the visual direction by
500
            It holds an embedding level and indicates the visual direction
399
            its bit 0 (even/odd value).
501
            by its bit 0 (even/odd value).
400
502
401
            The value for UBIDI_DEFAULT_LTR is even and the one for
503
            The value for UBIDI_DEFAULT_LTR is even and the one for
402
            UBIDI_DEFAULT_RTL is odd
504
            UBIDI_DEFAULT_RTL is odd
403
            */
505
            */
404
            maDirChanges.push_back(Entry(nEnd, nCurrDir & 0x1));
506
            aDirChanges.push_back(DirEntry(nEnd, nCurrDir & 0x1));
405
            nStart = nEnd;
507
            nStart = nEnd;
406
        }
508
        }
407
        ubidi_close(pBidi);
509
        ubidi_close(pBidi);
408
510
409
        if (!maDirChanges.empty())
511
        if (bSplitOnCharSet)
410
            mbCharIsRTL = maDirChanges.begin()->second;
512
        {
513
            //Split unicode text into plausable 8bit ranges for export to
514
            //older non unicode aware format
515
            xub_StrLen nLen = rTxt.Len();
516
            xub_StrLen nPos = 0;
517
            while (nPos != nLen)
518
            {
519
                rtl_TextEncoding ScriptType =
520
                    getScriptClass(rTxt.GetChar(nPos++));
521
                while (
522
                        (nPos != nLen) &&
523
                        (ScriptType == getScriptClass(rTxt.GetChar(nPos)))
524
                      )
525
                {
526
                    ++nPos;
527
                }
528
                
529
                aCharSets.push_back(CharSetEntry(nPos, ScriptType));
530
            }
531
        }
532
533
        if (pBreakIt && pBreakIt->xBreak.is())
534
        {
535
            xub_StrLen nLen = rTxt.Len();
536
            xub_StrLen nPos = 0;
537
            while (nPos < nLen)
538
            {
539
                sal_Int32 nEnd = pBreakIt->xBreak->endOfScript(rTxt, nPos,
540
                    nScript);
541
                if (nEnd < 0)
542
                    break;
543
                nPos = nEnd;
544
                aScripts.push_back(ScriptEntry(nPos, nScript));
545
                nScript = pBreakIt->xBreak->getScriptType(rTxt, nPos);
546
            }
547
        }
548
549
        cDirIter aBiDiEnd = aDirChanges.end();
550
        cCharSetIter aCharSetEnd = aCharSets.end();
551
        cScriptIter aScriptEnd = aScripts.end();
552
553
        cDirIter aBiDiIter = aDirChanges.begin();
554
        cCharSetIter aCharSetIter = aCharSets.begin();
555
        cScriptIter aScriptIter = aScripts.begin();
556
557
        bool bCharIsRTL = bParaIsRTL;
558
559
        while (
560
                aBiDiIter != aBiDiEnd ||
561
                aCharSetIter != aCharSetEnd ||
562
                aScriptIter != aScriptEnd
563
              )
564
        {
565
            xub_StrLen nMinPos = rTxt.Len();
566
567
            if (aBiDiIter != aBiDiEnd)
568
            {
569
                if (aBiDiIter->first < nMinPos)
570
                    nMinPos = aBiDiIter->first;
571
                bCharIsRTL = aBiDiIter->second;
572
            }
573
574
            if (aCharSetIter != aCharSetEnd)
575
            {
576
                if (aCharSetIter->first < nMinPos)
577
                    nMinPos = aCharSetIter->first;
578
                eChrSet = aCharSetIter->second;
579
            }
580
581
            if (aScriptIter != aScriptEnd)
582
            {
583
                if (aScriptIter->first < nMinPos)
584
                    nMinPos = aScriptIter->first;
585
                nScript = aScriptIter->second;
586
            }
587
588
            aRunChanges.push_back(
589
                CharRunEntry(nMinPos, nScript, eChrSet, bCharIsRTL));
590
591
            if (aBiDiIter != aBiDiEnd)
592
            {
593
                if (aBiDiIter->first == nMinPos)
594
                    ++aBiDiIter;
595
            }
596
597
            if (aCharSetIter != aCharSetEnd)
598
            {
599
                if (aCharSetIter->first == nMinPos)
600
                    ++aCharSetIter;
601
            }
602
603
            if (aScriptIter != aScriptEnd)
604
            {
605
                if (aScriptIter->first == nMinPos)
606
                    ++aScriptIter;
607
            }
608
        }
609
610
        aRunChanges.erase(std::remove_if(aRunChanges.begin(),
611
            aRunChanges.end(), IfBeforeStart(nTxtStart)), aRunChanges.end());
612
613
        return aRunChanges;
411
    }
614
    }
412
    maBiDiIter = maDirChanges.begin();
615
}
616
617
                                                                                
618
WW8_SwAttrIter::WW8_SwAttrIter(SwWW8Writer& rWr, const SwTxtNode& rTxtNd)
619
	: WW8_AttrIter(rWr), maCharRuns(GetPseudoCharRuns(rTxtNd, 0, !rWr.bWrtWW8)),
620
    rNd(rTxtNd), pCurRedline(0), nAktSwPos(0), nTmpSwPos(0), 
621
    nCurRedlinePos(USHRT_MAX), mbCharIsRTL(false)
622
{
623
    SwPosition aPos(rTxtNd);
624
    if (FRMDIR_HORI_RIGHT_TOP == rWr.pDoc->GetTextDirection(aPos))
625
        mbParaIsRTL = true;
626
    else
627
        mbParaIsRTL = false;
628
629
    maCharRunIter = maCharRuns.begin();
630
    IterToCurrent();
413
631
414
	/*
632
	/*
415
     #i2916#
633
     #i2916#
Lines 453-465 Link Here
453
	nAktSwPos = SearchNext( 1 );
671
	nAktSwPos = SearchNext( 1 );
454
}
672
}
455
673
456
rtl_TextEncoding WW8_SwAttrIter::GetNextCharSet() const
457
{
458
    if (!maCharSets.empty())
459
		return maCharSets.back().CharSet();
460
	return eNdChrSet;
461
}
462
463
xub_StrLen WW8_SwAttrIter::SearchNext( xub_StrLen nStartPos )
674
xub_StrLen WW8_SwAttrIter::SearchNext( xub_StrLen nStartPos )
464
{
675
{
465
    xub_StrLen nPos;
676
    xub_StrLen nPos;
Lines 518-555 Link Here
518
			const SwTxtAttr* pHt = (*pTxtAttrs)[i];
729
			const SwTxtAttr* pHt = (*pTxtAttrs)[i];
519
			nPos = *pHt->GetStart();	// gibt erstes Attr-Zeichen
730
			nPos = *pHt->GetStart();	// gibt erstes Attr-Zeichen
520
			if( nPos >= nStartPos && nPos <= nMinPos )
731
			if( nPos >= nStartPos && nPos <= nMinPos )
521
			{
522
				nMinPos = nPos;
732
				nMinPos = nPos;
523
				SetCharSet(*pHt, true);
524
			}
525
733
526
			if( pHt->GetEnd() )			// Attr mit Ende
734
			if( pHt->GetEnd() )			// Attr mit Ende
527
			{
735
			{
528
				nPos = *pHt->GetEnd();		// gibt letztes Attr-Zeichen + 1
736
				nPos = *pHt->GetEnd();		// gibt letztes Attr-Zeichen + 1
529
				if( nPos >= nStartPos && nPos <= nMinPos )
737
				if( nPos >= nStartPos && nPos <= nMinPos )
530
				{
531
					nMinPos = nPos;
738
					nMinPos = nPos;
532
					SetCharSet(*pHt, false);
533
				}
534
			}
739
			}
535
			else
740
			else
536
			{
741
			{
537
                // Attr ohne Ende Laenge 1 wegen CH_TXTATR im Text
742
                // Attr ohne Ende Laenge 1 wegen CH_TXTATR im Text
538
				nPos = *pHt->GetStart() + 1;
743
				nPos = *pHt->GetStart() + 1;
539
				if( nPos >= nStartPos && nPos <= nMinPos )
744
				if( nPos >= nStartPos && nPos <= nMinPos )
540
				{
541
					nMinPos = nPos;
745
					nMinPos = nPos;
542
					SetCharSet(*pHt, false);
543
				}
544
			}
746
			}
545
		}
747
		}
546
	}
748
	}
547
749
548
    if (maBiDiIter != maDirChanges.end())
750
    if (maCharRunIter != maCharRuns.end())
549
    {
751
    {
550
        if (maBiDiIter->first < nMinPos)
752
        if (maCharRunIter->mnEndPos < nMinPos)
551
            nMinPos = maBiDiIter->first;
753
            nMinPos = maCharRunIter->mnEndPos;
552
        mbCharIsRTL = maBiDiIter->second;
754
        IterToCurrent();
553
    }
755
    }
554
756
555
	/*
757
	/*
Lines 576-634 Link Here
576
	}
778
	}
577
779
578
    //nMinPos found and not going to change at this point
780
    //nMinPos found and not going to change at this point
579
    if (maBiDiIter != maDirChanges.end())
781
782
    if (maCharRunIter != maCharRuns.end())
580
    {
783
    {
581
        if (maBiDiIter->first == nMinPos)
784
        if (maCharRunIter->mnEndPos == nMinPos)
582
            ++maBiDiIter;
785
            ++maCharRunIter;
583
    }
786
    }
584
787
585
	return nMinPos;
788
	return nMinPos;
586
}
789
}
587
790
588
void WW8_SwAttrIter::SetCharSet(const SwTxtAttr& rAttr, bool bStart)
589
{
590
	const SwTxtAttr* p = 0;
591
	rtl_TextEncoding eChrSet(RTL_TEXTENCODING_DONTKNOW);
592
	const SfxPoolItem& rItem = rAttr.GetAttr();
593
	switch(rItem.Which())
594
	{
595
        case RES_CHRATR_FONT:
596
            p = &rAttr;
597
            eChrSet = ((const SvxFontItem&)rItem).GetCharSet();
598
            break;
599
        case RES_TXTATR_CHARFMT:
600
            {
601
                const SfxPoolItem* pItem;
602
                if( ((SwFmtCharFmt&)rItem).GetCharFmt() && SFX_ITEM_SET ==
603
                    ((SwFmtCharFmt&)rItem).GetCharFmt()->GetItemState(
604
                        RES_CHRATR_FONT, true, &pItem ))
605
                {
606
                    p = &rAttr;
607
                    eChrSet = ((const SvxFontItem*)pItem)->GetCharSet();
608
                }
609
            }
610
            break;
611
	}
612
613
	if (p)
614
	{
615
        CurrentCharSet aEntry(p, GetExtendedTextEncoding(eChrSet));
616
		if (bStart)
617
            maCharSets.push_back(aEntry);
618
		else
619
        {
620
            mychsiter aIter = std::find(maCharSets.begin(), maCharSets.end(),
621
                aEntry);
622
            if (aIter != maCharSets.end())
623
                maCharSets.erase(aIter);
624
        }
625
	}
626
}
627
628
void WW8_SwAttrIter::OutAttr( xub_StrLen nSwPos )
791
void WW8_SwAttrIter::OutAttr( xub_StrLen nSwPos )
629
{
792
{
630
	if (rNd.GetpSwAttrSet())
793
	if (rNd.GetpSwAttrSet())
631
		rWrt.Out_SfxItemSet(*rNd.GetpSwAttrSet(), false, true, nScript);
794
		rWrt.Out_SfxItemSet(*rNd.GetpSwAttrSet(), false, true, mnScript);
632
795
633
    if (rWrt.bWrtWW8 && IsCharRTL())
796
    if (rWrt.bWrtWW8 && IsCharRTL())
634
    {
797
    {
Lines 653-659 Link Here
653
			if( pEnd ? ( nSwPos >= *pHt->GetStart() && nSwPos < *pEnd )
816
			if( pEnd ? ( nSwPos >= *pHt->GetStart() && nSwPos < *pEnd )
654
						: nSwPos == *pHt->GetStart() )
817
						: nSwPos == *pHt->GetStart() )
655
            {
818
            {
656
                if (rWrt.CollapseScriptsforWordOk(nScript,
819
                if (rWrt.CollapseScriptsforWordOk(mnScript,
657
                    pHt->GetAttr().Which()))
820
                    pHt->GetAttr().Which()))
658
                {
821
                {
659
                    Out(aWW8AttrFnTab, pHt->GetAttr(), rWrt);
822
                    Out(aWW8AttrFnTab, pHt->GetAttr(), rWrt);
Lines 1371-1376 Link Here
1371
    return aRet;
1534
    return aRet;
1372
}
1535
}
1373
1536
1537
String WW8_SwAttrIter::GetSnippet(const String &rStr, xub_StrLen nAktPos,
1538
    xub_StrLen nLen) const
1539
{
1540
    String aSnippet(rStr, nAktPos, nLen);
1541
    if (!nLen)
1542
        return aSnippet;
1543
1544
    // 0x0a     ( Hard Line Break ) -> 0x0b
1545
    // 0xad     ( soft hyphen )     -> 0x1f
1546
    // 0x2011   ( hard hyphen )     -> 0x1e
1547
    aSnippet.SearchAndReplaceAll(0x0A, 0x0B);
1548
    aSnippet.SearchAndReplaceAll(CHAR_HARDHYPHEN, 0x1e);
1549
    aSnippet.SearchAndReplaceAll(CHAR_SOFTHYPHEN, 0x1f);
1550
1551
    return aSnippet;
1552
}
1553
1374
Writer& OutWW8_SwTxtNode( Writer& rWrt, SwCntntNode& rNode )
1554
Writer& OutWW8_SwTxtNode( Writer& rWrt, SwCntntNode& rNode )
1375
{
1555
{
1376
	SwWW8Writer& rWW8Wrt = (SwWW8Writer&)rWrt;
1556
	SwWW8Writer& rWW8Wrt = (SwWW8Writer&)rWrt;
Lines 1415-1435 Link Here
1415
	}
1595
	}
1416
1596
1417
	WW8_SwAttrIter aAttrIter( rWW8Wrt, *pNd );
1597
	WW8_SwAttrIter aAttrIter( rWW8Wrt, *pNd );
1418
	rtl_TextEncoding eChrSet = aAttrIter.GetNodeCharSet();
1598
	rtl_TextEncoding eChrSet = aAttrIter.GetCharSet();
1419
1599
1420
	ASSERT( !pO->Count(), " pO ist am Zeilenanfang nicht leer" );
1600
	ASSERT( !pO->Count(), " pO ist am Zeilenanfang nicht leer" );
1421
1601
1422
	String aStr( pNd->GetTxt() );
1602
	String aStr( pNd->GetTxt() );
1423
1603
1424
	// 0x0a		( Hard Line Break )	-> 0x0b
1425
	// 0xad		( soft hyphen ) 	-> 0x1f
1426
	// 0x2011	( hard hyphen )		-> 0x1e
1427
	if( aStr.Len() )
1428
	{
1429
		aStr.SearchAndReplaceAll( 0x0A, 0x0B );
1430
		aStr.SearchAndReplaceAll( CHAR_HARDHYPHEN, 0x1e );
1431
		aStr.SearchAndReplaceAll( CHAR_SOFTHYPHEN, 0x1f );
1432
	}
1433
	xub_StrLen nAktPos = 0;
1604
	xub_StrLen nAktPos = 0;
1434
	xub_StrLen nEnd = aStr.Len();
1605
	xub_StrLen nEnd = aStr.Len();
1435
	bool bUnicode = rWW8Wrt.bWrtWW8, bRedlineAtEnd = false;
1606
	bool bUnicode = rWW8Wrt.bWrtWW8, bRedlineAtEnd = false;
Lines 1437-1443 Link Here
1437
1608
1438
	do {
1609
	do {
1439
		xub_StrLen nNextAttr = aAttrIter.WhereNext();
1610
		xub_StrLen nNextAttr = aAttrIter.WhereNext();
1440
		rtl_TextEncoding eNextChrSet = aAttrIter.GetNextCharSet();
1441
1611
1442
		if( nNextAttr > nEnd )
1612
		if( nNextAttr > nEnd )
1443
			nNextAttr = nEnd;
1613
			nNextAttr = nEnd;
Lines 1449-1457 Link Here
1449
		bool bTxtAtr = aAttrIter.IsTxtAttr( nAktPos );
1619
		bool bTxtAtr = aAttrIter.IsTxtAttr( nAktPos );
1450
		nOpenAttrWithRange += aAttrIter.OutAttrWithRange( nAktPos );
1620
		nOpenAttrWithRange += aAttrIter.OutAttrWithRange( nAktPos );
1451
1621
1452
		if( !bTxtAtr )
1622
        xub_StrLen nLen = nNextAttr - nAktPos;
1453
			rWW8Wrt.OutSwString( aStr, nAktPos, nNextAttr - nAktPos,
1623
		if (!bTxtAtr && nLen)
1454
									bUnicode, eChrSet );
1624
        {
1625
            String aSnippet(aAttrIter.GetSnippet(aStr, nAktPos, nLen));
1626
            rWW8Wrt.OutSwString(aSnippet, 0, nLen, bUnicode, eChrSet );
1627
        }
1455
1628
1456
        // Am Zeilenende werden die Attribute bis ueber das CR aufgezogen.
1629
        // Am Zeilenende werden die Attribute bis ueber das CR aufgezogen.
1457
        // Ausnahme: Fussnoten am Zeilenende
1630
        // Ausnahme: Fussnoten am Zeilenende
Lines 1517-1524 Link Here
1517
			}
1690
			}
1518
		}
1691
		}
1519
		nAktPos = nNextAttr;
1692
		nAktPos = nNextAttr;
1520
		eChrSet = eNextChrSet;
1521
		aAttrIter.NextPos();
1693
		aAttrIter.NextPos();
1694
		eChrSet = aAttrIter.GetCharSet();
1522
	}
1695
	}
1523
	while( nAktPos < nEnd );
1696
	while( nAktPos < nEnd );
1524
1697
(-)util/makefile.mk (-1 / +2 lines)
Lines 193-199 Link Here
193
	$(CPPULIB) \
193
	$(CPPULIB) \
194
	$(VOSLIB) \
194
	$(VOSLIB) \
195
	$(SALLIB) \
195
	$(SALLIB) \
196
	$(ICUUCLIB)
196
	$(ICUUCLIB) \
197
	$(I18NUTILLIB)
197
198
198
.IF "$(OS)"=="MACOSX"
199
.IF "$(OS)"=="MACOSX"
199
# static libraries at end for OS X
200
# static libraries at end for OS X

Return to issue 33074