View | Details | Raw Unified | Return to bug 51351
Collapse All | Expand All

(-)WordToFoExtractor.java (-22 / +68 lines)
Lines 242-247 Link Here
242
        {
242
        {
243
            CharacterRun characterRun = paragraph.getCharacterRun( c );
243
            CharacterRun characterRun = paragraph.getCharacterRun( c );
244
244
245
            if ( characterRun == null )
246
            {
247
                logger.log( POILogger.WARN,
248
                        "Paragraph " + paragraph.getStartOffset() + "--"
249
                                + paragraph.getEndOffset()
250
                                + " contains null CharacterRun #" + c );
251
                continue;
252
            }
253
245
            if ( hwpfDocument.getPicturesTable().hasPicture( characterRun ) )
254
            if ( hwpfDocument.getPicturesTable().hasPicture( characterRun ) )
246
            {
255
            {
247
                Picture picture = hwpfDocument.getPicturesTable()
256
                Picture picture = hwpfDocument.getPicturesTable()
Lines 345-372 Link Here
345
354
346
        if ( separatorMark - beginMark > 1 )
355
        if ( separatorMark - beginMark > 1 )
347
        {
356
        {
348
            CharacterRun firstAfterBegin = paragraph
357
            int index = beginMark + 1;
349
                    .getCharacterRun( beginMark + 1 );
358
            CharacterRun firstAfterBegin = null;
350
359
            while ( index < separatorMark )
351
            final Matcher hyperlinkMatcher = hyperlinkPattern
352
                    .matcher( firstAfterBegin.text() );
353
            if ( hyperlinkMatcher.matches() )
354
            {
360
            {
355
                String hyperlink = hyperlinkMatcher.group( 1 );
361
                firstAfterBegin = paragraph.getCharacterRun( index );
356
                processHyperlink( hwpfDocument, currentBlock, paragraph,
362
                if ( firstAfterBegin == null )
357
                        currentTableLevel, hyperlink, separatorMark + 1,
363
                {
358
                        endMark );
364
                    logger.log( POILogger.WARN,
359
                return;
365
                            "Paragraph " + paragraph.getStartOffset() + "--"
366
                                    + paragraph.getEndOffset()
367
                                    + " contains null CharacterRun #" + index );
368
                    index++;
369
                    continue;
370
                }
371
                break;
360
            }
372
            }
361
373
362
            final Matcher pagerefMatcher = pagerefPattern
374
            if ( firstAfterBegin != null )
363
                    .matcher( firstAfterBegin.text() );
364
            if ( pagerefMatcher.matches() )
365
            {
375
            {
366
                String pageref = pagerefMatcher.group( 1 );
376
                final Matcher hyperlinkMatcher = hyperlinkPattern
367
                processPageref( hwpfDocument, currentBlock, paragraph,
377
                        .matcher( firstAfterBegin.text() );
368
                        currentTableLevel, pageref, separatorMark + 1, endMark );
378
                if ( hyperlinkMatcher.matches() )
369
                return;
379
                {
380
                    String hyperlink = hyperlinkMatcher.group( 1 );
381
                    processHyperlink( hwpfDocument, currentBlock, paragraph,
382
                            currentTableLevel, hyperlink, separatorMark + 1,
383
                            endMark );
384
                    return;
385
                }
386
387
                final Matcher pagerefMatcher = pagerefPattern
388
                        .matcher( firstAfterBegin.text() );
389
                if ( pagerefMatcher.matches() )
390
                {
391
                    String pageref = pagerefMatcher.group( 1 );
392
                    processPageref( hwpfDocument, currentBlock, paragraph,
393
                            currentTableLevel, pageref, separatorMark + 1,
394
                            endMark );
395
                    return;
396
                }
370
            }
397
            }
371
        }
398
        }
372
399
Lines 461-470 Link Here
461
            final boolean pItalic;
488
            final boolean pItalic;
462
            {
489
            {
463
                CharacterRun characterRun = paragraph.getCharacterRun( 0 );
490
                CharacterRun characterRun = paragraph.getCharacterRun( 0 );
464
                pFontSize = characterRun.getFontSize() / 2;
491
                if (characterRun != null)
465
                pFontName = characterRun.getFontName();
492
                {
466
                pBold = characterRun.isBold();
493
                    pFontSize = characterRun.getFontSize() / 2;
467
                pItalic = characterRun.isItalic();
494
                    pFontName = characterRun.getFontName();
495
                    pBold = characterRun.isBold();
496
                    pItalic = characterRun.isItalic();
497
                }
498
                else
499
                {
500
                    pFontSize = -1;
501
                    pFontName = WordToFoUtils.EMPTY;
502
                    pBold = false;
503
                    pItalic = false;
504
                }
468
            }
505
            }
469
            WordToFoUtils.setFontFamily( block, pFontName );
506
            WordToFoUtils.setFontFamily( block, pFontName );
470
            WordToFoUtils.setFontSize( block, pFontSize );
507
            WordToFoUtils.setFontSize( block, pFontSize );
Lines 723-728 Link Here
723
        {
760
        {
724
            CharacterRun characterRun = paragraph.getCharacterRun( c );
761
            CharacterRun characterRun = paragraph.getCharacterRun( c );
725
762
763
            if ( characterRun == null )
764
            {
765
                logger.log( POILogger.WARN,
766
                        "Paragraph " + paragraph.getStartOffset() + "--"
767
                                + paragraph.getEndOffset()
768
                                + " contains null CharacterRun #" + c );
769
                continue;
770
            }
771
726
            String text = characterRun.text();
772
            String text = characterRun.text();
727
            if ( text.getBytes().length == 0 )
773
            if ( text.getBytes().length == 0 )
728
                continue;
774
                continue;

Return to bug 51351