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

(-)writerhelper.hxx (-4 / +14 lines)
Lines 64-69 Link Here
64
#ifndef SW_WRITERHELPER
64
#ifndef SW_WRITERHELPER
65
#define SW_WRITERHELPER
65
#define SW_WRITERHELPER
66
66
67
#include <typeinfo>
68
67
#ifndef WW_TYPESSW
69
#ifndef WW_TYPESSW
68
#include "typessw.hxx"
70
#include "typessw.hxx"
69
#endif
71
#endif
Lines 99-126 Link Here
99
         helper templates defined here
101
         helper templates defined here
100
        */
102
        */
101
103
104
        template<class T> const T &item_cast(const SfxPoolItem &rItem)
105
        {
106
            if (!rItem.IsA(STATICTYPE(T)))
107
                throw std::bad_cast();
108
            return static_cast<const T &>(rItem);
109
        }
110
102
        template<class T> const T & ItemGet(const SwCntntNode &rNode, 
111
        template<class T> const T & ItemGet(const SwCntntNode &rNode, 
103
            sal_uInt16 eType)
112
            sal_uInt16 eType)
104
        {
113
        {
105
            return static_cast<const T &>(rNode.GetAttr(eType));
114
            return item_cast<T>(rNode.GetAttr(eType));
106
        }
115
        }
107
116
108
        template<class T> const T & ItemGet(const SwFmt &rFmt, 
117
        template<class T> const T & ItemGet(const SwFmt &rFmt, 
109
            sal_uInt16 eType)
118
            sal_uInt16 eType)
110
        {
119
        {
111
            return static_cast<const T &>(rFmt.GetAttr(eType));
120
            return item_cast<T>(rFmt.GetAttr(eType));
112
        }
121
        }
113
122
114
        template<class T> const T & ItemGet(const SfxItemSet &rSet, 
123
        template<class T> const T & ItemGet(const SfxItemSet &rSet, 
115
            sal_uInt16 eType)
124
            sal_uInt16 eType)
116
        {
125
        {
117
            return static_cast<const T &>(rSet.Get(eType));
126
            return item_cast<T>(rSet.Get(eType));
118
        }
127
        }
119
128
120
        template<class T> const T & DefaultItemGet(const SfxItemPool &rPool,
129
        template<class T> const T & DefaultItemGet(const SfxItemPool &rPool,
121
            sal_uInt16 eType)
130
            sal_uInt16 eType)
122
        {
131
        {
123
            return static_cast<const T &>(rPool.GetDefaultItem(eType));
132
            return item_cast<T>(rPool.GetDefaultItem(eType));
124
        }
133
        }
125
134
126
        template<class T> const T & DefaultItemGet(const SwDoc &rDoc, 
135
        template<class T> const T & DefaultItemGet(const SwDoc &rDoc, 
Lines 128-133 Link Here
128
        {
137
        {
129
            return DefaultItemGet<T>(rDoc.GetAttrPool(), eType);
138
            return DefaultItemGet<T>(rDoc.GetAttrPool(), eType);
130
        }
139
        }
140
131
    }
141
    }
132
142
133
    namespace hack
143
    namespace hack
(-)wrtw8nds.cxx (-116 / +165 lines)
Lines 220-225 Link Here
220
#include <com/sun/star/i18n/ScriptType.hdl>
220
#include <com/sun/star/i18n/ScriptType.hdl>
221
#endif
221
#endif
222
222
223
#ifndef INCLUDED_I18NUTIL_UNICODE_HXX
224
#include <i18nutil/unicode.hxx>
225
#endif
226
223
#ifndef SW_WRITERHELPER
227
#ifndef SW_WRITERHELPER
224
#include "writerhelper.hxx"
228
#include "writerhelper.hxx"
225
#endif
229
#endif
Lines 264-284 Link Here
264
// Mit OutAttr() werden die Attribute an der angegebenen SwPos
268
// Mit OutAttr() werden die Attribute an der angegebenen SwPos
265
// ausgegeben.
269
// ausgegeben.
266
270
267
class CurrentCharSet
268
{
269
private:
270
    const SwTxtAttr *mpPointer;
271
    rtl_TextEncoding meCharSet;
272
public:
273
    rtl_TextEncoding CharSet() const {return meCharSet;}
274
    CurrentCharSet(const SwTxtAttr *pPointer, rtl_TextEncoding eCharSet)
275
        : mpPointer(pPointer), meCharSet(eCharSet) {}
276
    bool operator==(const CurrentCharSet &rSecond) const
277
    {
278
        return (mpPointer == rSecond.mpPointer);
279
    }
280
};
281
282
class swFlyFrm
271
class swFlyFrm
283
{
272
{
284
public:
273
public:
Lines 294-311 Link Here
294
{
283
{
295
private:
284
private:
296
	const SwTxtNode& rNd;
285
	const SwTxtNode& rNd;
297
    std::list<CurrentCharSet> maCharSets;
286
298
    typedef std::list<CurrentCharSet>::iterator mychsiter;
287
    typedef std::pair<xub_StrLen, sal_Int16> CharSetEntry;
288
    std::vector<CharSetEntry> maCharSets;
289
    typedef std::vector<CharSetEntry>::iterator mychsiter;
290
    mychsiter maCharSetIter;
291
	rtl_TextEncoding meChrSet;
292
293
    typedef std::pair<xub_StrLen, sal_uInt16> ScriptEntry;
294
    std::vector<ScriptEntry> maScripts;
295
    typedef std::vector<ScriptEntry>::iterator mysiter;
296
    mysiter maScriptIter;
297
    sal_uInt16 mnScript;
298
299
299
	const SwRedline* pCurRedline;
300
	const SwRedline* pCurRedline;
300
	xub_StrLen nAktSwPos;
301
	xub_StrLen nAktSwPos;
301
	xub_StrLen nTmpSwPos;					// fuer HasItem()
302
	xub_StrLen nTmpSwPos;					// fuer HasItem()
302
	USHORT nCurRedlinePos;
303
	USHORT nCurRedlinePos;
303
	rtl_TextEncoding eNdChrSet;
304
    USHORT nScript;
305
304
306
    typedef std::pair<UTextOffset, bool> Entry;
305
    typedef std::pair<UTextOffset, bool> DirEntry;
307
    std::vector<Entry> maDirChanges;
306
    std::vector<DirEntry> maDirChanges;
308
    typedef std::vector<Entry>::const_iterator myciter;
307
    typedef std::vector<DirEntry>::const_iterator myciter;
309
    myciter maBiDiIter;
308
    myciter maBiDiIter;
310
    bool mbCharIsRTL;
309
    bool mbCharIsRTL;
311
    bool mbParaIsRTL;
310
    bool mbParaIsRTL;
Lines 315-327 Link Here
315
    myflyiter maFlyIter;
314
    myflyiter maFlyIter;
316
315
317
	xub_StrLen SearchNext( xub_StrLen nStartPos );
316
	xub_StrLen SearchNext( xub_StrLen nStartPos );
318
	void SetCharSet(const SwTxtAttr& rTxtAttr, bool bStart);
319
	void FieldVanish( const String& rTxt );
317
	void FieldVanish( const String& rTxt );
320
318
321
	void OutSwFmtINetFmt(const SwFmtINetFmt& rAttr, bool bStart);
319
	void OutSwFmtINetFmt(const SwFmtINetFmt& rAttr, bool bStart);
322
	void OutSwFmtRefMark(const SwFmtRefMark& rAttr, bool bStart);
320
	void OutSwFmtRefMark(const SwFmtRefMark& rAttr, bool bStart);
323
	void OutSwTOXMark(const SwTOXMark& rAttr, bool bStart);
321
	void OutSwTOXMark(const SwTOXMark& rAttr, bool bStart);
324
	void OutSwFmtRuby(const SwFmtRuby& rRuby, bool bStart);
322
	void OutSwFmtRuby(const SwFmtRuby& rRuby, bool bStart);
323
    sal_Int16 getScriptClass(sal_Unicode cChar) const;
325
324
326
    //No copying
325
    //No copying
327
    WW8_SwAttrIter(const WW8_SwAttrIter&);
326
    WW8_SwAttrIter(const WW8_SwAttrIter&);
Lines 343-353 Link Here
343
    void OutFlys(xub_StrLen nSwPos);
342
    void OutFlys(xub_StrLen nSwPos);
344
343
345
	xub_StrLen WhereNext() const					{ return nAktSwPos; }
344
	xub_StrLen WhereNext() const					{ return nAktSwPos; }
346
	rtl_TextEncoding GetNextCharSet() const;
345
    bool IsCharRTL() const { return mbCharIsRTL; }
347
	rtl_TextEncoding GetNodeCharSet() const				{ return eNdChrSet; }
346
    bool IsParaRTL() const { return mbParaIsRTL; }
348
347
    rtl_TextEncoding GetCharSet() const { return meChrSet; }
349
    bool IsCharRTL() const {return mbCharIsRTL; }
350
    bool IsParaRTL() const {return mbParaIsRTL; }
351
};
348
};
352
349
353
class sortswflys :
350
class sortswflys :
Lines 360-365 Link Here
360
    }
357
    }
361
};
358
};
362
359
360
sal_Int16 WW8_SwAttrIter::getScriptClass(sal_Unicode cChar) const
361
{
362
    static ScriptTypeList aScripts[] = 
363
    {
364
        { UnicodeScript_kBasicLatin, RTL_TEXTENCODING_MS_1252},
365
        { UnicodeScript_kLatin1Supplement, RTL_TEXTENCODING_MS_1252},
366
        { UnicodeScript_kLatinExtendedA, RTL_TEXTENCODING_MS_1250}, 
367
        { UnicodeScript_kLatinExtendedB, RTL_TEXTENCODING_MS_1257}, 
368
        { UnicodeScript_kGreek, RTL_TEXTENCODING_MS_1253},
369
        { UnicodeScript_kCyrillic, RTL_TEXTENCODING_MS_1251}, 
370
        { UnicodeScript_kHebrew, RTL_TEXTENCODING_MS_1255},
371
        { UnicodeScript_kArabic, RTL_TEXTENCODING_MS_1256},
372
        { UnicodeScript_kThai, RTL_TEXTENCODING_MS_1258},
373
        { UnicodeScript_kScriptCount, RTL_TEXTENCODING_MS_1252}
374
    };
375
376
    return unicode::getUnicodeScriptType(cChar, aScripts, 
377
        RTL_TEXTENCODING_MS_1252);
378
}
379
363
WW8_SwAttrIter::WW8_SwAttrIter(SwWW8Writer& rWr, const SwTxtNode& rTxtNd)
380
WW8_SwAttrIter::WW8_SwAttrIter(SwWW8Writer& rWr, const SwTxtNode& rTxtNd)
364
	: WW8_AttrIter(rWr), rNd(rTxtNd), pCurRedline(0), nAktSwPos(0),
381
	: WW8_AttrIter(rWr), rNd(rTxtNd), pCurRedline(0), nAktSwPos(0),
365
	nTmpSwPos(0), nCurRedlinePos(USHRT_MAX), mbCharIsRTL(false)
382
	nTmpSwPos(0), nCurRedlinePos(USHRT_MAX), mbCharIsRTL(false)
Lines 370-387 Link Here
370
    else
387
    else
371
        mbParaIsRTL = false;
388
        mbParaIsRTL = false;
372
389
373
	// Attributwechsel an Pos 0 wird ignoriert, da davon ausgegangen
374
	// wird, dass am Absatzanfang sowieso die Attribute neu ausgegeben
375
	// werden.
376
	eNdChrSet = ItemGet<SvxFontItem>(rNd, RES_CHRATR_FONT).GetCharSet();
377
    eNdChrSet = GetExtendedTextEncoding(eNdChrSet);
378
379
    const String &rTxt = rTxtNd.GetTxt();
390
    const String &rTxt = rTxtNd.GetTxt();
380
391
381
    if( pBreakIt->xBreak.is() )
392
    if (rTxt.Len() && pBreakIt->xBreak.is())
382
        nScript = pBreakIt->xBreak->getScriptType(rTxt, 0);
393
        mnScript = pBreakIt->xBreak->getScriptType(rTxt, 0);
383
    else
394
    else
384
        nScript = ScriptType::LATIN;
395
        mnScript = ScriptType::LATIN;
396
397
	// Attributwechsel an Pos 0 wird ignoriert, da davon ausgegangen
398
	// wird, dass am Absatzanfang sowieso die Attribute neu ausgegeben
399
	// werden.
400
	meChrSet = ItemGet<SvxFontItem>(rNd, 
401
        GetWhichOfScript(RES_CHRATR_FONT, mnScript)).GetCharSet();
402
    meChrSet = GetExtendedTextEncoding(meChrSet);
385
403
386
    if (rTxt.Len())
404
    if (rTxt.Len())
387
    {
405
    {
Lines 411-422 Link Here
411
            The value for UBIDI_DEFAULT_LTR is even and the one for
429
            The value for UBIDI_DEFAULT_LTR is even and the one for
412
            UBIDI_DEFAULT_RTL is odd
430
            UBIDI_DEFAULT_RTL is odd
413
            */
431
            */
414
            maDirChanges.push_back(Entry(nEnd, nCurrDir & 0x1));
432
            maDirChanges.push_back(DirEntry(nEnd, nCurrDir & 0x1));
415
            nStart = nEnd;
433
            nStart = nEnd;
416
        }
434
        }
417
        ubidi_close(pBidi);
435
        ubidi_close(pBidi);
436
437
        //Split unicode text into plausable 8bit ranges for export to older
438
        //non unicode aware format
439
        if (!rWrt.bWrtWW8)
440
        {
441
            xub_StrLen nLen = rTxt.Len();
442
            xub_StrLen nPos = 0;
443
            while (nPos != nLen)
444
            {
445
                sal_Int16 ScriptType = getScriptClass(rTxt.GetChar(nPos++));
446
                while (
447
                        (nPos != nLen) && 
448
                        (ScriptType == getScriptClass(rTxt.GetChar(nPos)))
449
                      )
450
                {
451
                    ++nPos;
452
                }
453
454
                if (maCharSets.empty())
455
                    meChrSet = ScriptType;
456
457
                maCharSets.push_back(CharSetEntry(nPos, ScriptType));
458
            }
459
        }
460
461
        if (pBreakIt->xBreak.is())
462
        {
463
            xub_StrLen nLen = rTxt.Len();
464
            xub_StrLen nPos = 0;
465
            sal_uInt16 nScript = mnScript;
466
            while (nPos < nLen)
467
            {
468
                sal_uInt32 nEnd = 
469
                    pBreakIt->xBreak->endOfScript(rTxt, nPos, nScript);
470
                if (nEnd == -1)
471
                    break;
472
                nPos = nEnd;
473
                maScripts.push_back(ScriptEntry(nPos, nScript));
474
                nScript = pBreakIt->xBreak->getScriptType(rTxt, nPos);
475
            }
476
        }
477
418
    }
478
    }
419
    maBiDiIter = maDirChanges.begin();
479
    maBiDiIter = maDirChanges.begin();
480
    maCharSetIter = maCharSets.begin();
481
    maScriptIter = maScripts.begin();
420
482
421
	/*
483
	/*
422
     #i2916#
484
     #i2916#
Lines 460-472 Link Here
460
	nAktSwPos = SearchNext( 1 );
522
	nAktSwPos = SearchNext( 1 );
461
}
523
}
462
524
463
rtl_TextEncoding WW8_SwAttrIter::GetNextCharSet() const
464
{
465
    if (!maCharSets.empty())
466
		return maCharSets.back().CharSet();
467
	return eNdChrSet;
468
}
469
470
xub_StrLen WW8_SwAttrIter::SearchNext( xub_StrLen nStartPos )
525
xub_StrLen WW8_SwAttrIter::SearchNext( xub_StrLen nStartPos )
471
{
526
{
472
    xub_StrLen nPos;
527
    xub_StrLen nPos;
Lines 513-520 Link Here
513
		}
568
		}
514
	}
569
	}
515
570
516
	const SwpHints* pTxtAttrs = rNd.GetpSwpHints();
571
	if(const SwpHints* pTxtAttrs = rNd.GetpSwpHints())
517
	if( pTxtAttrs )
518
	{
572
	{
519
573
520
// kann noch optimiert werden, wenn ausgenutzt wird, dass die TxtAttrs
574
// kann noch optimiert werden, wenn ausgenutzt wird, dass die TxtAttrs
Lines 525-553 Link Here
525
			const SwTxtAttr* pHt = (*pTxtAttrs)[i];
579
			const SwTxtAttr* pHt = (*pTxtAttrs)[i];
526
			nPos = *pHt->GetStart();	// gibt erstes Attr-Zeichen
580
			nPos = *pHt->GetStart();	// gibt erstes Attr-Zeichen
527
			if( nPos >= nStartPos && nPos <= nMinPos )
581
			if( nPos >= nStartPos && nPos <= nMinPos )
528
			{
529
				nMinPos = nPos;
582
				nMinPos = nPos;
530
				SetCharSet(*pHt, true);
531
			}
532
583
533
			if( pHt->GetEnd() )			// Attr mit Ende
584
			if( pHt->GetEnd() )			// Attr mit Ende
534
			{
585
			{
535
				nPos = *pHt->GetEnd();		// gibt letztes Attr-Zeichen + 1
586
				nPos = *pHt->GetEnd();		// gibt letztes Attr-Zeichen + 1
536
				if( nPos >= nStartPos && nPos <= nMinPos )
587
				if( nPos >= nStartPos && nPos <= nMinPos )
537
				{
538
					nMinPos = nPos;
588
					nMinPos = nPos;
539
					SetCharSet(*pHt, false);
540
				}
541
			}
589
			}
542
			else
590
			else
543
			{
591
			{
544
                // Attr ohne Ende Laenge 1 wegen CH_TXTATR im Text
592
                // Attr ohne Ende Laenge 1 wegen CH_TXTATR im Text
545
				nPos = *pHt->GetStart() + 1;
593
				nPos = *pHt->GetStart() + 1;
546
				if( nPos >= nStartPos && nPos <= nMinPos )
594
				if( nPos >= nStartPos && nPos <= nMinPos )
547
				{
548
					nMinPos = nPos;
595
					nMinPos = nPos;
549
					SetCharSet(*pHt, false);
550
				}
551
			}
596
			}
552
		}
597
		}
553
	}
598
	}
Lines 562-567 Link Here
562
        }
607
        }
563
    }
608
    }
564
609
610
    if (maCharSetIter != maCharSets.end())
611
    {
612
        if (maCharSetIter->first <= nMinPos)
613
        {
614
            nMinPos = maCharSetIter->first;
615
            meChrSet = maCharSetIter->second;
616
            ++maCharSetIter;
617
        }
618
    }
619
620
    if (maScriptIter != maScripts.end())
621
    {
622
        if (maScriptIter->first <= nMinPos)
623
        {
624
            nMinPos = maScriptIter->first;
625
            mnScript = maScriptIter->second;
626
            ++maScriptIter;
627
        }
628
    }
629
565
	/*
630
	/*
566
     #i2916#
631
     #i2916#
567
     Check to see if there are any graphics anchored to characters in this
632
     Check to see if there are any graphics anchored to characters in this
Lines 588-637 Link Here
588
	return nMinPos;
653
	return nMinPos;
589
}
654
}
590
655
591
void WW8_SwAttrIter::SetCharSet(const SwTxtAttr& rAttr, bool bStart)
592
{
593
	const SwTxtAttr* p = 0;
594
	rtl_TextEncoding eChrSet(RTL_TEXTENCODING_DONTKNOW);
595
	const SfxPoolItem& rItem = rAttr.GetAttr();
596
	switch(rItem.Which())
597
	{
598
        case RES_CHRATR_FONT:
599
            p = &rAttr;
600
            eChrSet = ((const SvxFontItem&)rItem).GetCharSet();
601
            break;
602
        case RES_TXTATR_CHARFMT:
603
            {
604
                const SfxPoolItem* pItem;
605
                if( ((SwFmtCharFmt&)rItem).GetCharFmt() && SFX_ITEM_SET ==
606
                    ((SwFmtCharFmt&)rItem).GetCharFmt()->GetItemState(
607
                        RES_CHRATR_FONT, true, &pItem ))
608
                {
609
                    p = &rAttr;
610
                    eChrSet = ((const SvxFontItem*)pItem)->GetCharSet();
611
                }
612
            }
613
            break;
614
	}
615
616
	if (p)
617
	{
618
        CurrentCharSet aEntry(p, GetExtendedTextEncoding(eChrSet));
619
		if (bStart)
620
            maCharSets.push_back(aEntry);
621
		else
622
        {
623
            mychsiter aIter = std::find(maCharSets.begin(), maCharSets.end(),
624
                aEntry);
625
            if (aIter != maCharSets.end())
626
                maCharSets.erase(aIter);
627
        }
628
	}
629
}
630
631
void WW8_SwAttrIter::OutAttr( xub_StrLen nSwPos )
656
void WW8_SwAttrIter::OutAttr( xub_StrLen nSwPos )
632
{
657
{
658
    sal_uInt16 nFontId = GetWhichOfScript(RES_CHRATR_FONT, mnScript);
659
    const SvxFontItem &rFont = ItemGet<SvxFontItem>(rNd, nFontId);
660
    const SvxFontItem *pFont = &rFont;
661
    
633
	if (rNd.GetpSwAttrSet())
662
	if (rNd.GetpSwAttrSet())
634
		rWrt.Out_SfxItemSet(*rNd.GetpSwAttrSet(), false, true, nScript);
663
    {
664
        SfxItemSet aSet(rNd.GetSwAttrSet());
665
        const SvxFontItem &rFont = ItemGet<SvxFontItem>(aSet, nFontId);
666
        pFont = &rFont;
667
        aSet.ClearItem(nFontId);
668
		rWrt.Out_SfxItemSet(aSet, false, true, mnScript);
669
    }
635
670
636
    if (rWrt.bWrtWW8 && IsCharRTL())
671
    if (rWrt.bWrtWW8 && IsCharRTL())
637
    {
672
    {
Lines 640-654 Link Here
640
        rWrtWW8.pO->Insert((BYTE)1, rWrtWW8.pO->Count());
675
        rWrtWW8.pO->Insert((BYTE)1, rWrtWW8.pO->Count());
641
    }
676
    }
642
677
643
	const SwpHints* pTxtAttrs = rNd.GetpSwpHints();
678
	if (const SwpHints* pTxtAttrs = rNd.GetpSwpHints())
644
	if( pTxtAttrs )
645
	{
679
	{
646
		const SwModify* pOldMod = rWrt.pOutFmtNode;
680
		const SwModify* pOldMod = rWrt.pOutFmtNode;
647
		rWrt.pOutFmtNode = &rNd;
681
		rWrt.pOutFmtNode = &rNd;
648
682
649
		nTmpSwPos = nSwPos;
683
		nTmpSwPos = nSwPos;
650
		register xub_StrLen i;
684
		for (xub_StrLen i = 0; i < pTxtAttrs->Count(); ++i)
651
		for( i = 0; i < pTxtAttrs->Count(); i++ )
652
		{
685
		{
653
			const SwTxtAttr* pHt = (*pTxtAttrs)[i];
686
			const SwTxtAttr* pHt = (*pTxtAttrs)[i];
654
			const xub_StrLen* pEnd = pHt->GetEnd();
687
			const xub_StrLen* pEnd = pHt->GetEnd();
Lines 656-674 Link Here
656
			if( pEnd ? ( nSwPos >= *pHt->GetStart() && nSwPos < *pEnd )
689
			if( pEnd ? ( nSwPos >= *pHt->GetStart() && nSwPos < *pEnd )
657
						: nSwPos == *pHt->GetStart() )
690
						: nSwPos == *pHt->GetStart() )
658
            {
691
            {
659
                if (rWrt.CollapseScriptsforWordOk(nScript,
692
                if (rWrt.CollapseScriptsforWordOk(mnScript,
660
                    pHt->GetAttr().Which()))
693
                    pHt->GetAttr().Which()))
661
                {
694
                {
662
                    Out(aWW8AttrFnTab, pHt->GetAttr(), rWrt);
695
                    if (pHt->GetAttr().Which() == nFontId)
696
                        pFont = &(item_cast<SvxFontItem>(pHt->GetAttr()));
697
                    else
698
                        Out(aWW8AttrFnTab, pHt->GetAttr(), rWrt);
663
                }
699
                }
664
            }
700
            }
665
			else if( nSwPos < *pHt->GetStart() )
701
			else if (nSwPos < *pHt->GetStart())
666
				break;
702
				break;
667
		}
703
		}
668
704
669
		nTmpSwPos = 0;		// HasTextItem nur in dem obigen Bereich erlaubt
705
		nTmpSwPos = 0;		// HasTextItem nur in dem obigen Bereich erlaubt
670
		rWrt.pOutFmtNode = pOldMod;
706
		rWrt.pOutFmtNode = pOldMod;
671
	}
707
	}
708
709
    ASSERT(pFont, "must be *some* font associated with this txtnode");
710
    if (pFont)
711
    {
712
        SvxFontItem aFont(*pFont);
713
714
        /*
715
         If we are a nonunicode aware format then we set the charset we want to
716
         use for export of this range. If necessary this will generate a pseudo
717
         font to use for this range.
718
        */
719
        if (!rWrt.bWrtWW8)
720
            aFont.GetCharSet() = meChrSet;
721
722
        if (rFont != aFont)
723
            Out(aWW8AttrFnTab, aFont, rWrt);
724
    }
725
672
	OutRedlines(nSwPos);
726
	OutRedlines(nSwPos);
673
}
727
}
674
728
Lines 698-705 Link Here
698
bool WW8_SwAttrIter::IsTxtAttr( xub_StrLen nSwPos )
752
bool WW8_SwAttrIter::IsTxtAttr( xub_StrLen nSwPos )
699
{
753
{
700
	// search for attrs without end position
754
	// search for attrs without end position
701
	const SwpHints* pTxtAttrs = rNd.GetpSwpHints();
755
	if (const SwpHints* pTxtAttrs = rNd.GetpSwpHints())
702
	if( pTxtAttrs )
703
	{
756
	{
704
		register USHORT i;
757
		register USHORT i;
705
		for( i = 0; i < pTxtAttrs->Count(); i++ )
758
		for( i = 0; i < pTxtAttrs->Count(); i++ )
Lines 755-764 Link Here
755
	rWrt.pO = &rItems;
808
	rWrt.pO = &rItems;
756
809
757
	if (rNd.GetpSwAttrSet())
810
	if (rNd.GetpSwAttrSet())
758
		rWrt.Out_SfxItemSet(*rNd.GetpSwAttrSet(), false, true, nScript);
811
		rWrt.Out_SfxItemSet(*rNd.GetpSwAttrSet(), false, true, mnScript);
759
812
760
	const SwpHints* pTxtAttrs = rNd.GetpSwpHints();
813
	if (const SwpHints* pTxtAttrs = rNd.GetpSwpHints())
761
	if( pTxtAttrs )
762
	{
814
	{
763
		const SwModify* pOldMod = rWrt.pOutFmtNode;
815
		const SwModify* pOldMod = rWrt.pOutFmtNode;
764
		rWrt.pOutFmtNode = &rNd;
816
		rWrt.pOutFmtNode = &rNd;
Lines 1155-1162 Link Here
1155
bool WW8_SwAttrIter::OutAttrWithRange( xub_StrLen nPos )
1207
bool WW8_SwAttrIter::OutAttrWithRange( xub_StrLen nPos )
1156
{
1208
{
1157
	bool bRet = false;
1209
	bool bRet = false;
1158
	const SwpHints* pTxtAttrs = rNd.GetpSwpHints();
1210
	if (const SwpHints* pTxtAttrs = rNd.GetpSwpHints())
1159
	if( pTxtAttrs )
1160
	{
1211
	{
1161
		nTmpSwPos = nPos;
1212
		nTmpSwPos = nPos;
1162
		const xub_StrLen* pEnd;
1213
		const xub_StrLen* pEnd;
Lines 1435-1441 Link Here
1435
	}
1486
	}
1436
1487
1437
	WW8_SwAttrIter aAttrIter( rWW8Wrt, *pNd );
1488
	WW8_SwAttrIter aAttrIter( rWW8Wrt, *pNd );
1438
	rtl_TextEncoding eChrSet = aAttrIter.GetNodeCharSet();
1489
	rtl_TextEncoding eChrSet = aAttrIter.GetCharSet();
1439
1490
1440
	ASSERT( !pO->Count(), " pO ist am Zeilenanfang nicht leer" );
1491
	ASSERT( !pO->Count(), " pO ist am Zeilenanfang nicht leer" );
1441
1492
Lines 1456-1462 Link Here
1456
1507
1457
	do {
1508
	do {
1458
		xub_StrLen nNextAttr = aAttrIter.WhereNext();
1509
		xub_StrLen nNextAttr = aAttrIter.WhereNext();
1459
		rtl_TextEncoding eNextChrSet = aAttrIter.GetNextCharSet();
1460
1510
1461
		if( nNextAttr > nEnd )
1511
		if( nNextAttr > nEnd )
1462
			nNextAttr = nEnd;
1512
			nNextAttr = nEnd;
Lines 1535-1542 Link Here
1535
			}
1585
			}
1536
		}
1586
		}
1537
		nAktPos = nNextAttr;
1587
		nAktPos = nNextAttr;
1538
		eChrSet = eNextChrSet;
1539
		aAttrIter.NextPos();
1588
		aAttrIter.NextPos();
1589
        eChrSet = aAttrIter.GetCharSet();
1540
	}
1590
	}
1541
	while( nAktPos < nEnd );
1591
	while( nAktPos < nEnd );
1542
1592
Lines 2280-2287 Link Here
2280
2330
2281
void SwWW8Writer::OutWW8FlyFrmsInCntnt( const SwTxtNode& rNd )
2331
void SwWW8Writer::OutWW8FlyFrmsInCntnt( const SwTxtNode& rNd )
2282
{
2332
{
2283
	const SwpHints* pTxtAttrs = rNd.GetpSwpHints();
2333
	if (const SwpHints* pTxtAttrs = rNd.GetpSwpHints())
2284
	if( pTxtAttrs )
2285
	{
2334
	{
2286
		for( USHORT n=0; n < pTxtAttrs->Count(); ++n )
2335
		for( USHORT n=0; n < pTxtAttrs->Count(); ++n )
2287
		{
2336
		{
(-)wrtw8sty.cxx (-1 / +4 lines)
Lines 77-82 Link Here
77
#ifndef _COM_SUN_STAR_I18N_SCRIPTTYPE_HDL_
77
#ifndef _COM_SUN_STAR_I18N_SCRIPTTYPE_HDL_
78
#include <com/sun/star/i18n/ScriptType.hdl>
78
#include <com/sun/star/i18n/ScriptType.hdl>
79
#endif
79
#endif
80
#ifndef _RTL_TENCINFO_H
81
#include <rtl/tencinfo.h>
82
#endif
80
83
81
#ifndef _HINTIDS_HXX
84
#ifndef _HINTIDS_HXX
82
#include <hintids.hxx>
85
#include <hintids.hxx>
Lines 743-749 Link Here
743
	if (RTL_TEXTENCODING_SYMBOL == eChrSet)
746
	if (RTL_TEXTENCODING_SYMBOL == eChrSet)
744
		maWW8_FFN[4] = 2;
747
		maWW8_FFN[4] = 2;
745
	else
748
	else
746
		maWW8_FFN[4] = 0;
749
		maWW8_FFN[4] = rtl_getBestWindowsCharsetFromTextEncoding(eChrSet);
747
750
748
	if (mbAlt)
751
	if (mbAlt)
749
		maWW8_FFN[5] = msFamilyNm.Len()+1;
752
		maWW8_FFN[5] = msFamilyNm.Len()+1;

Return to issue 12445