summaryrefslogtreecommitdiff
path: root/xmloff/source/text/txtexppr.cxx
blob: 27955fc2149df17095782ec24cb674240ac43bd5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
/*************************************************************************
 *
 *  $RCSfile: txtexppr.cxx,v $
 *
 *  $Revision: 1.15 $
 *
 *  last change: $Author: cl $ $Date: 2001-06-07 08:52:14 $
 *
 *  The Contents of this file are made available subject to the terms of
 *  either of the following licenses
 *
 *         - GNU Lesser General Public License Version 2.1
 *         - Sun Industry Standards Source License Version 1.1
 *
 *  Sun Microsystems Inc., October, 2000
 *
 *  GNU Lesser General Public License Version 2.1
 *  =============================================
 *  Copyright 2000 by Sun Microsystems, Inc.
 *  901 San Antonio Road, Palo Alto, CA 94303, USA
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License version 2.1, as published by the Free Software Foundation.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this library; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 *  MA  02111-1307  USA
 *
 *
 *  Sun Industry Standards Source License Version 1.1
 *  =================================================
 *  The contents of this file are subject to the Sun Industry Standards
 *  Source License Version 1.1 (the "License"); You may not use this file
 *  except in compliance with the License. You may obtain a copy of the
 *  License at http://www.openoffice.org/license.html.
 *
 *  Software provided under this License is provided on an "AS IS" basis,
 *  WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
 *  WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
 *  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
 *  See the License for the specific provisions governing your rights and
 *  obligations concerning the Software.
 *
 *  The Initial Developer of the Original Code is: Sun Microsystems, Inc.
 *
 *  Copyright: 2000 by Sun Microsystems, Inc.
 *
 *  All Rights Reserved.
 *
 *  Contributor(s): _______________________________________
 *
 *
 ************************************************************************/

#ifndef _TOOLS_DEBUG_HXX
#include <tools/debug.hxx>
#endif

#ifndef _XMLOFF_TEXTPRMAP_HXX_
#include "txtprmap.hxx"
#endif

#ifndef _COM_SUN_STAR_TABLE_BORDERLINE_HPP_
#include <com/sun/star/table/BorderLine.hpp>
#endif
#ifndef _COM_SUN_STAR_TEXT_SIZETYPE_HPP_
#include <com/sun/star/text/SizeType.hpp>
#endif
#ifndef _COM_SUN_STAR_TEXT_WRAPTEXTMODE_HPP_
#include <com/sun/star/text/WrapTextMode.hpp>
#endif
#ifndef _COM_SUN_STAR_TEXT_TEXTCONTENTANCHORTYPE_HPP
#include <com/sun/star/text/TextContentAnchorType.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_FONTFAMILY_HPP
#include <com/sun/star/awt/FontFamily.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_FONTPITCH_HPP
#include <com/sun/star/awt/FontPitch.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_FONTUNDERLINE_HPP
#include <com/sun/star/awt/FontUnderline.hpp>
#endif
#ifndef _XMLOFF_TXTEXPPR_HXX
#include "txtexppr.hxx"
#endif
#ifndef _XMLOFF_XMLEXP_HXX
#include "xmlexp.hxx"
#endif
#ifndef _XMLOFF_XMLSECTIONFOOTNOTECONFIGEXPORT_HXX
#include "XMLSectionFootnoteConfigExport.hxx"
#endif

using namespace ::rtl;
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::style;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::text;
using namespace ::com::sun::star::awt;

void XMLTextExportPropertySetMapper::handleElementItem(
        const Reference< xml::sax::XDocumentHandler > & rHandler,
        const XMLPropertyState& rProperty,
        const SvXMLUnitConverter& rUnitConverter,
        const SvXMLNamespaceMap& rNamespaceMap,
        sal_uInt16 nFlags,
        const ::std::vector< XMLPropertyState > *pProperties,
        sal_uInt32 nIdx ) const
{
    XMLTextExportPropertySetMapper *pThis =
           ((XMLTextExportPropertySetMapper *)this);

    switch( getPropertySetMapper()->GetEntryContextId( rProperty.mnIndex ) )
    {
    case CTF_DROPCAPFORMAT:
        pThis->maDropCapExport.exportXML( rProperty.maValue, bDropWholeWord,
                                          sDropCharStyle, rNamespaceMap );
        pThis->bDropWholeWord = sal_False;
        pThis->sDropCharStyle = OUString();
        break;

    case CTF_TABSTOP:
        pThis->maTabStopExport.Export( rProperty.maValue, rNamespaceMap );
        break;

    case CTF_TEXTCOLUMNS:
        pThis->maTextColumnsExport.exportXML( rProperty.maValue );
        break;

    case CTF_BACKGROUND_URL:
        {
            DBG_ASSERT( pProperties && nIdx >= 2,
                        "property vector missing" );
            const Any *pPos = 0, *pFilter = 0;
            if( pProperties && nIdx >= 2 )
            {
                const XMLPropertyState& rPos = (*pProperties)[nIdx-2];
                DBG_ASSERT( CTF_BACKGROUND_POS == getPropertySetMapper()
                        ->GetEntryContextId( rPos.mnIndex ),
                         "invalid property map: pos expected" );
                if( CTF_BACKGROUND_POS == getPropertySetMapper()
                        ->GetEntryContextId( rPos.mnIndex ) )
                    pPos = &rPos.maValue;

                const XMLPropertyState& rFilter = (*pProperties)[nIdx-1];
                DBG_ASSERT( CTF_BACKGROUND_FILTER == getPropertySetMapper()
                        ->GetEntryContextId( rFilter.mnIndex ),
                         "invalid property map: filter expected" );
                if( CTF_BACKGROUND_FILTER == getPropertySetMapper()
                        ->GetEntryContextId( rFilter.mnIndex ) )
                    pFilter = &rFilter.maValue;
            }
            sal_uInt32 nPropIndex = rProperty.mnIndex;
            pThis->maBackgroundImageExport.exportXML(
                    rProperty.maValue, pPos, pFilter,
                    getPropertySetMapper()->GetEntryNameSpace( nPropIndex ),
                    getPropertySetMapper()->GetEntryXMLName( nPropIndex ) );
        }
        break;

    case CTF_SECTION_FOOTNOTE_END:
        XMLSectionFootnoteConfigExport::exportXML(rExport, sal_False,
                                                  pProperties, nIdx,
                                                  getPropertySetMapper());
        break;

    case CTF_SECTION_ENDNOTE_END:
        XMLSectionFootnoteConfigExport::exportXML(rExport, sal_True,
                                                  pProperties, nIdx,
                                                  getPropertySetMapper());
        break;

    default:
        SvXMLExportPropertyMapper::handleElementItem( rHandler, rProperty, rUnitConverter, rNamespaceMap, nFlags, pProperties, nIdx );
        break;
    }
}

void XMLTextExportPropertySetMapper::handleSpecialItem(
        SvXMLAttributeList& rAttrList,
        const XMLPropertyState& rProperty,
        const SvXMLUnitConverter& rUnitConverter,
        const SvXMLNamespaceMap& rNamespaceMap,
        const ::std::vector< XMLPropertyState > *pProperties,
        sal_uInt32 nIdx ) const
{
    XMLTextExportPropertySetMapper *pThis =
           ((XMLTextExportPropertySetMapper *)this);

    switch( getPropertySetMapper()->GetEntryContextId( rProperty.mnIndex ) )
    {
    case CTF_DROPCAPWHOLEWORD:
        DBG_ASSERT( !bDropWholeWord, "drop whole word is set already!" );
        pThis->bDropWholeWord = *(sal_Bool *)rProperty.maValue.getValue();
        break;
    case CTF_DROPCAPCHARSTYLE:
        DBG_ASSERT( !sDropCharStyle.getLength(),
                    "drop char style is set already!" );
        rProperty.maValue >>= pThis->sDropCharStyle;
        break;
    case CTF_NUMBERINGSTYLENAME:
    case CTF_PAGEDESCNAME:
    case CTF_OLDTEXTBACKGROUND:
    case CTF_BACKGROUND_POS:
    case CTF_BACKGROUND_FILTER:
    case CTF_SECTION_FOOTNOTE_NUM_OWN:
    case CTF_SECTION_FOOTNOTE_NUM_RESTART:
    case CTF_SECTION_FOOTNOTE_NUM_RESTART_AT:
    case CTF_SECTION_FOOTNOTE_NUM_TYPE:
    case CTF_SECTION_FOOTNOTE_NUM_PREFIX:
    case CTF_SECTION_FOOTNOTE_NUM_SUFFIX:
    case CTF_SECTION_ENDNOTE_NUM_OWN:
    case CTF_SECTION_ENDNOTE_NUM_RESTART:
    case CTF_SECTION_ENDNOTE_NUM_RESTART_AT:
    case CTF_SECTION_ENDNOTE_NUM_TYPE:
    case CTF_SECTION_ENDNOTE_NUM_PREFIX:
    case CTF_SECTION_ENDNOTE_NUM_SUFFIX:
        // There's nothing to do here!
        break;
    default:
        SvXMLExportPropertyMapper::handleSpecialItem(rAttrList, rProperty, rUnitConverter, rNamespaceMap, pProperties, nIdx );
        break;
    }
}

XMLTextExportPropertySetMapper::XMLTextExportPropertySetMapper(
        const UniReference< XMLPropertySetMapper >& rMapper,
        SvXMLExport& rExp ) :
    SvXMLExportPropertyMapper( rMapper ),
    rExport( rExp ),
    bDropWholeWord( sal_False ),
    maTabStopExport( rExp.GetDocHandler(), rExp.GetMM100UnitConverter() ),
    maDropCapExport( rExp.GetDocHandler(), rExp.GetMM100UnitConverter() ),
    maTextColumnsExport( rExp ),
    maBackgroundImageExport( rExp )
{
}

XMLTextExportPropertySetMapper::~XMLTextExportPropertySetMapper()
{
}

void XMLTextExportPropertySetMapper::ContextFontFilter(
    XMLPropertyState *pFontNameState,
    XMLPropertyState *pFontFamilyNameState,
    XMLPropertyState *pFontStyleNameState,
    XMLPropertyState *pFontFamilyState,
    XMLPropertyState *pFontPitchState,
    XMLPropertyState *pFontCharsetState ) const
{
    OUString sFamilyName;
    OUString sStyleName;
    sal_Int16 nFamily = FontFamily::DONTKNOW;
    sal_Int16 nPitch = FontPitch::DONTKNOW;
    rtl_TextEncoding eEnc = RTL_TEXTENCODING_DONTKNOW;

    OUString sTmp;
    if( pFontFamilyNameState && (pFontFamilyNameState->maValue >>= sTmp ) )
        sFamilyName = sTmp;
    if( pFontStyleNameState && (pFontStyleNameState->maValue >>= sTmp ) )
        sStyleName = sTmp;

    sal_Int16 nTmp;
    if( pFontFamilyState && (pFontFamilyState->maValue >>= nTmp ) )
        nFamily = nTmp;
    if( pFontPitchState && (pFontPitchState->maValue >>= nTmp ) )
        nPitch = nTmp;
    if( pFontCharsetState && (pFontCharsetState->maValue >>= nTmp ) )
        eEnc = (rtl_TextEncoding)nTmp;

    OUString sName( ((SvXMLExport&)GetExport()).GetFontAutoStylePool()->Find(
                        sFamilyName, sStyleName, nFamily, nPitch, eEnc ) );
    if( sName.getLength() )
    {
        pFontNameState->maValue <<= sName;
        if( pFontFamilyNameState )
            pFontFamilyNameState->mnIndex = -1;
        if( pFontStyleNameState )
            pFontStyleNameState->mnIndex = -1;
        if( pFontFamilyState )
            pFontFamilyState->mnIndex = -1;
        if( pFontPitchState )
            pFontPitchState->mnIndex = -1;
        if( pFontCharsetState )
            pFontCharsetState->mnIndex = -1;
    }
    else
    {
        pFontNameState->mnIndex = -1;
    }

    if( pFontFamilyNameState && (0 == sFamilyName.getLength()) )
    {
        pFontFamilyNameState->mnIndex = -1;
    }

    if( pFontStyleNameState && (0 == sStyleName.getLength()) )
    {
        pFontStyleNameState->mnIndex = -1;
    }
}

void XMLTextExportPropertySetMapper::ContextFontHeightFilter(
    XMLPropertyState* pCharHeightState,
    XMLPropertyState* pCharPropHeightState,
    XMLPropertyState* pCharDiffHeightState ) const
{
    if( pCharPropHeightState )
    {
        sal_Int32 nTemp;
        pCharPropHeightState->maValue >>= nTemp;
        if( nTemp == 100 )
        {
            pCharPropHeightState->mnIndex = -1;
            pCharPropHeightState->maValue.clear();
        }
        else
        {
            pCharHeightState->mnIndex = -1;
            pCharHeightState->maValue.clear();
        }
    }
    if( pCharDiffHeightState )
    {
        float nTemp;
        pCharDiffHeightState->maValue >>= nTemp;
        if( nTemp == 0. )
        {
            pCharDiffHeightState->mnIndex = -1;
            pCharDiffHeightState->maValue.clear();
        }
        else
        {
            pCharHeightState->mnIndex = -1;
            pCharHeightState->maValue.clear();
        }
    }

}

void XMLTextExportPropertySetMapper::ContextFilter(
    ::std::vector< XMLPropertyState >& rProperties,
    Reference< XPropertySet > rPropSet ) const
{
    // filter font
    XMLPropertyState *pFontNameState = 0;
    XMLPropertyState *pFontFamilyNameState = 0;
    XMLPropertyState *pFontStyleNameState = 0;
    XMLPropertyState *pFontFamilyState = 0;
    XMLPropertyState *pFontPitchState = 0;
    XMLPropertyState *pFontCharsetState = 0;
    XMLPropertyState *pFontNameCJKState = 0;
    XMLPropertyState *pFontFamilyNameCJKState = 0;
    XMLPropertyState *pFontStyleNameCJKState = 0;
    XMLPropertyState *pFontFamilyCJKState = 0;
    XMLPropertyState *pFontPitchCJKState = 0;
    XMLPropertyState *pFontCharsetCJKState = 0;
    XMLPropertyState *pFontNameCTLState = 0;
    XMLPropertyState *pFontFamilyNameCTLState = 0;
    XMLPropertyState *pFontStyleNameCTLState = 0;
    XMLPropertyState *pFontFamilyCTLState = 0;
    XMLPropertyState *pFontPitchCTLState = 0;
    XMLPropertyState *pFontCharsetCTLState = 0;

    // filter char height point/percent
    XMLPropertyState* pCharHeightState = NULL;
    XMLPropertyState* pCharPropHeightState = NULL;
    XMLPropertyState* pCharDiffHeightState = NULL;
    XMLPropertyState* pCharHeightCJKState = NULL;
    XMLPropertyState* pCharPropHeightCJKState = NULL;
    XMLPropertyState* pCharDiffHeightCJKState = NULL;
    XMLPropertyState* pCharHeightCTLState = NULL;
    XMLPropertyState* pCharPropHeightCTLState = NULL;
    XMLPropertyState* pCharDiffHeightCTLState = NULL;

    // filter left margin measure/percent
    XMLPropertyState* pParaLeftMarginState = NULL;
    XMLPropertyState* pParaLeftMarginRelState = NULL;

    // filter right margin measure/percent
    XMLPropertyState* pParaRightMarginState = NULL;
    XMLPropertyState* pParaRightMarginRelState = NULL;

    // filter first line indent measure/percent
    XMLPropertyState* pParaFirstLineState = NULL;
    XMLPropertyState* pParaFirstLineRelState = NULL;

    // filter ParaTopMargin/Relative
    XMLPropertyState* pParaTopMarginState = NULL;
    XMLPropertyState* pParaTopMarginRelState = NULL;

    // filter ParaTopMargin/Relative
    XMLPropertyState* pParaBottomMarginState = NULL;
    XMLPropertyState* pParaBottomMarginRelState = NULL;

    // filter (Left|Right|Top|Bottom|)BorderWidth
    XMLPropertyState* pAllBorderWidthState = NULL;
    XMLPropertyState* pLeftBorderWidthState = NULL;
    XMLPropertyState* pRightBorderWidthState = NULL;
    XMLPropertyState* pTopBorderWidthState = NULL;
    XMLPropertyState* pBottomBorderWidthState = NULL;

    // filter (Left|Right|Top|)BorderDistance
    XMLPropertyState* pAllBorderDistanceState = NULL;
    XMLPropertyState* pLeftBorderDistanceState = NULL;
    XMLPropertyState* pRightBorderDistanceState = NULL;
    XMLPropertyState* pTopBorderDistanceState = NULL;
    XMLPropertyState* pBottomBorderDistanceState = NULL;

    // filter (Left|Right|Top|Bottom|)Border
    XMLPropertyState* pAllBorderState = NULL;
    XMLPropertyState* pLeftBorderState = NULL;
    XMLPropertyState* pRightBorderState = NULL;
    XMLPropertyState* pTopBorderState = NULL;
    XMLPropertyState* pBottomBorderState = NULL;

    // filter height properties
    XMLPropertyState* pHeightMinAbsState = NULL;
    XMLPropertyState* pHeightMinRelState = NULL;
    XMLPropertyState* pHeightAbsState = NULL;
    XMLPropertyState* pHeightRelState = NULL;
    XMLPropertyState* pSizeTypeState = NULL;

    // wrap
    XMLPropertyState* pWrapState = NULL;
    XMLPropertyState* pWrapContourState = NULL;
    XMLPropertyState* pWrapContourModeState = NULL;
    XMLPropertyState* pWrapParagraphOnlyState = NULL;

    // anchor
    XMLPropertyState* pAnchorTypeState = NULL;

    // horizontal position and relation
    XMLPropertyState* pHoriOrientState = NULL;
    XMLPropertyState* pHoriOrientMirroredState = NULL;
    XMLPropertyState* pHoriOrientRelState = NULL;
    XMLPropertyState* pHoriOrientRelFrameState = NULL;
    XMLPropertyState* pHoriOrientMirrorState = NULL;

    // vertical position and relation
    XMLPropertyState* pVertOrientState = NULL;
    XMLPropertyState* pVertOrientRelState = NULL;
    XMLPropertyState* pVertOrientRelPageState = NULL;
    XMLPropertyState* pVertOrientRelFrameState = NULL;
    XMLPropertyState* pVertOrientRelAsCharState = NULL;

    // filter underline color
    XMLPropertyState* pUnderlineState = NULL;
    XMLPropertyState* pUnderlineColorState = NULL;
    XMLPropertyState* pUnderlineHasColorState = NULL;

    sal_Bool bNeedsAnchor = sal_False;

    for( ::std::vector< XMLPropertyState >::iterator propertie = rProperties.begin();
         propertie != rProperties.end();
         propertie++ )
    {
        switch( getPropertySetMapper()->GetEntryContextId( propertie->mnIndex ) )
        {
        case CTF_CHARHEIGHT:            pCharHeightState = propertie; break;
        case CTF_CHARHEIGHT_REL:        pCharPropHeightState = propertie; break;
        case CTF_CHARHEIGHT_DIFF:       pCharDiffHeightState = propertie; break;
        case CTF_CHARHEIGHT_CJK:        pCharHeightCJKState = propertie; break;
        case CTF_CHARHEIGHT_REL_CJK:    pCharPropHeightCJKState = propertie; break;
        case CTF_CHARHEIGHT_DIFF_CJK:   pCharDiffHeightCJKState = propertie; break;
        case CTF_CHARHEIGHT_CTL:        pCharHeightCTLState = propertie; break;
        case CTF_CHARHEIGHT_REL_CTL:    pCharPropHeightCTLState = propertie; break;
        case CTF_CHARHEIGHT_DIFF_CTL:   pCharDiffHeightCTLState = propertie; break;
        case CTF_PARALEFTMARGIN:        pParaLeftMarginState = propertie; break;
        case CTF_PARALEFTMARGIN_REL:    pParaLeftMarginRelState = propertie; break;
        case CTF_PARARIGHTMARGIN:       pParaRightMarginState = propertie; break;
        case CTF_PARARIGHTMARGIN_REL:   pParaRightMarginRelState = propertie; break;
        case CTF_PARAFIRSTLINE:         pParaFirstLineState = propertie; break;
        case CTF_PARAFIRSTLINE_REL:     pParaFirstLineRelState = propertie; break;
        case CTF_PARATOPMARGIN:         pParaTopMarginState = propertie; break;
        case CTF_PARATOPMARGIN_REL:     pParaTopMarginRelState = propertie; break;
        case CTF_PARABOTTOMMARGIN:      pParaBottomMarginState = propertie; break;
        case CTF_PARABOTTOMMARGIN_REL:  pParaBottomMarginRelState = propertie; break;
        case CTF_ALLBORDERWIDTH:        pAllBorderWidthState = propertie; break;
        case CTF_LEFTBORDERWIDTH:       pLeftBorderWidthState = propertie; break;
        case CTF_RIGHTBORDERWIDTH:      pRightBorderWidthState = propertie; break;
        case CTF_TOPBORDERWIDTH:        pTopBorderWidthState = propertie; break;
        case CTF_BOTTOMBORDERWIDTH:     pBottomBorderWidthState = propertie; break;
        case CTF_ALLBORDERDISTANCE:     pAllBorderDistanceState = propertie; break;
        case CTF_LEFTBORDERDISTANCE:    pLeftBorderDistanceState = propertie; break;
        case CTF_RIGHTBORDERDISTANCE:   pRightBorderDistanceState = propertie; break;
        case CTF_TOPBORDERDISTANCE:     pTopBorderDistanceState = propertie; break;
        case CTF_BOTTOMBORDERDISTANCE:  pBottomBorderDistanceState = propertie; break;
        case CTF_ALLBORDER:             pAllBorderState = propertie; break;
        case CTF_LEFTBORDER:            pLeftBorderState = propertie; break;
        case CTF_RIGHTBORDER:           pRightBorderState = propertie; break;
        case CTF_TOPBORDER:             pTopBorderState = propertie; break;
        case CTF_BOTTOMBORDER:          pBottomBorderState = propertie; break;

        case CTF_FRAMEHEIGHT_MIN_ABS:   pHeightMinAbsState = propertie; break;
        case CTF_FRAMEHEIGHT_MIN_REL:   pHeightMinRelState = propertie; break;
        case CTF_FRAMEHEIGHT_ABS:       pHeightAbsState = propertie; break;
        case CTF_FRAMEHEIGHT_REL:       pHeightRelState = propertie; break;
        case CTF_SIZETYPE:              pSizeTypeState = propertie; break;

        case CTF_WRAP:                  pWrapState = propertie; break;
        case CTF_WRAP_CONTOUR:          pWrapContourState = propertie; break;
        case CTF_WRAP_CONTOUR_MODE:     pWrapContourModeState = propertie; break;
        case CTF_WRAP_PARAGRAPH_ONLY:   pWrapParagraphOnlyState = propertie; break;
        case CTF_ANCHORTYPE:            pAnchorTypeState = propertie; break;

        case CTF_HORIZONTALPOS:             pHoriOrientState = propertie; bNeedsAnchor = sal_True; break;
        case CTF_HORIZONTALPOS_MIRRORED:    pHoriOrientMirroredState = propertie; bNeedsAnchor = sal_True; break;
        case CTF_HORIZONTALREL:             pHoriOrientRelState = propertie; bNeedsAnchor = sal_True; break;
        case CTF_HORIZONTALREL_FRAME:       pHoriOrientRelFrameState = propertie; bNeedsAnchor = sal_True; break;
        case CTF_HORIZONTALMIRROR:          pHoriOrientMirrorState = propertie; bNeedsAnchor = sal_True; break;
        case CTF_VERTICALPOS:           pVertOrientState = propertie; bNeedsAnchor = sal_True; break;
        case CTF_VERTICALREL:           pVertOrientRelState = propertie; bNeedsAnchor = sal_True; break;
        case CTF_VERTICALREL_PAGE:      pVertOrientRelPageState = propertie; bNeedsAnchor = sal_True; break;
        case CTF_VERTICALREL_FRAME:     pVertOrientRelFrameState = propertie; bNeedsAnchor = sal_True; break;
        case CTF_VERTICALREL_ASCHAR:    pVertOrientRelAsCharState = propertie; bNeedsAnchor = sal_True; break;

        case CTF_FONTNAME:              pFontNameState = propertie; break;
        case CTF_FONTFAMILYNAME:        pFontFamilyNameState = propertie; break;
        case CTF_FONTSTYLENAME:         pFontStyleNameState = propertie; break;
        case CTF_FONTFAMILY:            pFontFamilyState = propertie; break;
        case CTF_FONTPITCH:             pFontPitchState = propertie; break;
        case CTF_FONTCHARSET:           pFontCharsetState = propertie; break;

        case CTF_FONTNAME_CJK:          pFontNameCJKState = propertie; break;
        case CTF_FONTFAMILYNAME_CJK:    pFontFamilyNameCJKState = propertie; break;
        case CTF_FONTSTYLENAME_CJK:     pFontStyleNameCJKState = propertie; break;
        case CTF_FONTFAMILY_CJK:        pFontFamilyCJKState = propertie; break;
        case CTF_FONTPITCH_CJK:         pFontPitchCJKState = propertie; break;
        case CTF_FONTCHARSET_CJK:       pFontCharsetCJKState = propertie; break;

        case CTF_FONTNAME_CTL:          pFontNameCTLState = propertie; break;
        case CTF_FONTFAMILYNAME_CTL:    pFontFamilyNameCTLState = propertie; break;
        case CTF_FONTSTYLENAME_CTL:     pFontStyleNameCTLState = propertie; break;
        case CTF_FONTFAMILY_CTL:        pFontFamilyCTLState = propertie; break;
        case CTF_FONTPITCH_CTL:         pFontPitchCTLState = propertie; break;
        case CTF_FONTCHARSET_CTL:       pFontCharsetCTLState = propertie; break;
        case CTF_UNDERLINE:             pUnderlineState = propertie; break;
        case CTF_UNDERLINE_COLOR:       pUnderlineColorState = propertie; break;
        case CTF_UNDERLINE_HASCOLOR:    pUnderlineHasColorState = propertie; break;
        }
    }

    if( pFontNameState )
        ContextFontFilter( pFontNameState, pFontFamilyNameState,
                           pFontStyleNameState, pFontFamilyState,
                           pFontPitchState, pFontCharsetState );
    if( pFontNameCJKState )
        ContextFontFilter( pFontNameCJKState, pFontFamilyNameCJKState,
                           pFontStyleNameCJKState, pFontFamilyCJKState,
                           pFontPitchCJKState, pFontCharsetCJKState );
    if( pFontNameCTLState )
        ContextFontFilter( pFontNameCTLState, pFontFamilyNameCTLState,
                           pFontStyleNameCTLState, pFontFamilyCTLState,
                           pFontPitchCTLState, pFontCharsetCTLState );

    if( pCharHeightState && (pCharPropHeightState || pCharDiffHeightState ) )
        ContextFontHeightFilter( pCharHeightState, pCharPropHeightState,
                                 pCharDiffHeightState  );
    if( pCharHeightCJKState &&
        (pCharPropHeightCJKState || pCharDiffHeightCJKState ) )
        ContextFontHeightFilter( pCharHeightCJKState, pCharPropHeightCJKState,
                                 pCharDiffHeightCJKState  );
    if( pCharHeightCTLState &&
        (pCharPropHeightCTLState || pCharDiffHeightCTLState ) )
        ContextFontHeightFilter( pCharHeightCTLState, pCharPropHeightCTLState,
                                 pCharDiffHeightCTLState  );
    if( pUnderlineColorState || pUnderlineHasColorState )
    {
        sal_Bool bClear = !pUnderlineState;
        if( !bClear )
        {
            sal_Int16 nUnderline;
            pUnderlineState->maValue >>= nUnderline;
            bClear = FontUnderline::NONE == nUnderline;
        }
        if( bClear )
        {
            if( pUnderlineColorState )
                pUnderlineColorState->mnIndex = -1;
            if( pUnderlineHasColorState )
                pUnderlineHasColorState->mnIndex = -1;
        }
    }

    if( pParaLeftMarginState && pParaLeftMarginRelState )
    {
        sal_Int32 nTemp;
        pParaLeftMarginRelState->maValue >>= nTemp;
        if( nTemp == 100 )
        {
            pParaLeftMarginRelState->mnIndex = -1;
            pParaLeftMarginRelState->maValue.clear();
        }
        else
        {
            pParaLeftMarginState->mnIndex = -1;
            pParaLeftMarginState->maValue.clear();
        }

    }

    if( pParaRightMarginState && pParaRightMarginRelState )
    {
        sal_Int32 nTemp;
        pParaRightMarginRelState->maValue >>= nTemp;
        if( nTemp == 100 )
        {
            pParaRightMarginRelState->mnIndex = -1;
            pParaRightMarginRelState->maValue.clear();
        }
        else
        {
            pParaRightMarginState->mnIndex = -1;
            pParaRightMarginState->maValue.clear();
        }
    }

    if( pParaFirstLineState && pParaFirstLineRelState )
    {
        sal_Int32 nTemp;
        pParaFirstLineRelState->maValue >>= nTemp;
        if( nTemp == 100 )
        {
            pParaFirstLineRelState->mnIndex = -1;
            pParaFirstLineRelState->maValue.clear();
        }
        else
        {
            pParaFirstLineState->mnIndex = -1;
            pParaFirstLineState->maValue.clear();
        }
    }

    if( pParaTopMarginState && pParaTopMarginRelState )
    {
        sal_Int32 nTemp;
        pParaTopMarginRelState->maValue >>= nTemp;
        if( nTemp == 100 )
        {
            pParaTopMarginRelState->mnIndex = -1;
            pParaTopMarginRelState->maValue.clear();
        }
        else
        {
            pParaTopMarginState->mnIndex = -1;
            pParaTopMarginState->maValue.clear();
        }

    }

    if( pParaBottomMarginState && pParaBottomMarginRelState )
    {
        sal_Int32 nTemp;
        pParaBottomMarginRelState->maValue >>= nTemp;
        if( nTemp == 100 )
        {
            pParaBottomMarginRelState->mnIndex = -1;
            pParaBottomMarginRelState->maValue.clear();
        }
        else
        {
            pParaBottomMarginState->mnIndex = -1;
            pParaBottomMarginState->maValue.clear();
        }

    }

    if( pAllBorderWidthState )
    {
        if( pLeftBorderWidthState && pRightBorderWidthState && pTopBorderWidthState && pBottomBorderWidthState )
        {
            table::BorderLine aLeft, aRight, aTop, aBottom;

            pLeftBorderWidthState->maValue >>= aLeft;
            pRightBorderWidthState->maValue >>= aRight;
            pTopBorderWidthState->maValue >>= aTop;
            pBottomBorderWidthState->maValue >>= aBottom;
            if( aLeft.Color == aRight.Color && aLeft.InnerLineWidth == aRight.InnerLineWidth &&
                aLeft.OuterLineWidth == aRight.OuterLineWidth && aLeft.LineDistance == aRight.LineDistance &&
                aLeft.Color == aTop.Color && aLeft.InnerLineWidth == aTop.InnerLineWidth &&
                aLeft.OuterLineWidth == aTop.OuterLineWidth && aLeft.LineDistance == aTop.LineDistance &&
                aLeft.Color == aBottom.Color && aLeft.InnerLineWidth == aBottom.InnerLineWidth &&
                aLeft.OuterLineWidth == aBottom.OuterLineWidth && aLeft.LineDistance == aBottom.LineDistance )
            {
                pLeftBorderWidthState->mnIndex = -1;
                pLeftBorderWidthState->maValue.clear();
                pRightBorderWidthState->mnIndex = -1;
                pRightBorderWidthState->maValue.clear();
                pTopBorderWidthState->mnIndex = -1;
                pTopBorderWidthState->maValue.clear();
                pBottomBorderWidthState->mnIndex = -1;
                pBottomBorderWidthState->maValue.clear();
            }
            else
            {
                pAllBorderWidthState->mnIndex = -1;
                pAllBorderWidthState->maValue.clear();
            }
        }
        else
        {
            pAllBorderWidthState->mnIndex = -1;
            pAllBorderWidthState->maValue.clear();
        }
    }

    if( pAllBorderDistanceState )
    {
        if( pLeftBorderDistanceState && pRightBorderDistanceState && pTopBorderDistanceState && pBottomBorderDistanceState )
        {
            sal_Int32 aLeft, aRight, aTop, aBottom;

            pLeftBorderDistanceState->maValue >>= aLeft;
            pRightBorderDistanceState->maValue >>= aRight;
            pTopBorderDistanceState->maValue >>= aTop;
            pBottomBorderDistanceState->maValue >>= aBottom;
            if( aLeft == aRight && aLeft == aTop && aLeft == aBottom )
            {
                pLeftBorderDistanceState->mnIndex = -1;
                pLeftBorderDistanceState->maValue.clear();
                pRightBorderDistanceState->mnIndex = -1;
                pRightBorderDistanceState->maValue.clear();
                pTopBorderDistanceState->mnIndex = -1;
                pTopBorderDistanceState->maValue.clear();
                pBottomBorderDistanceState->mnIndex = -1;
                pBottomBorderDistanceState->maValue.clear();
            }
            else
            {
                pAllBorderDistanceState->mnIndex = -1;
                pAllBorderDistanceState->maValue.clear();
            }
        }
        else
        {
            pAllBorderDistanceState->mnIndex = -1;
            pAllBorderDistanceState->maValue.clear();
        }
    }

    if( pAllBorderState )
    {
        if( pLeftBorderState && pRightBorderState && pTopBorderState && pBottomBorderState )
        {
            table::BorderLine aLeft, aRight, aTop, aBottom;

            pLeftBorderState->maValue >>= aLeft;
            pRightBorderState->maValue >>= aRight;
            pTopBorderState->maValue >>= aTop;
            pBottomBorderState->maValue >>= aBottom;
            if( aLeft.Color == aRight.Color && aLeft.InnerLineWidth == aRight.InnerLineWidth &&
                aLeft.OuterLineWidth == aRight.OuterLineWidth && aLeft.LineDistance == aRight.LineDistance &&
                aLeft.Color == aTop.Color && aLeft.InnerLineWidth == aTop.InnerLineWidth &&
                aLeft.OuterLineWidth == aTop.OuterLineWidth && aLeft.LineDistance == aTop.LineDistance &&
                aLeft.Color == aBottom.Color && aLeft.InnerLineWidth == aBottom.InnerLineWidth &&
                aLeft.OuterLineWidth == aBottom.OuterLineWidth && aLeft.LineDistance == aBottom.LineDistance )
            {
                pLeftBorderState->mnIndex = -1;
                pLeftBorderState->maValue.clear();
                pRightBorderState->mnIndex = -1;
                pRightBorderState->maValue.clear();
                pTopBorderState->mnIndex = -1;
                pTopBorderState->maValue.clear();
                pBottomBorderState->mnIndex = -1;
                pBottomBorderState->maValue.clear();
            }
            else
            {
                pAllBorderState->mnIndex = -1;
                pAllBorderState->maValue.clear();
            }
        }
        else
        {
            pAllBorderState->mnIndex = -1;
            pAllBorderState->maValue.clear();
        }
    }

    sal_Int16 nSizeType = SizeType::FIX;
    if( pSizeTypeState )
    {
        pSizeTypeState->maValue >>= nSizeType;
        pSizeTypeState->mnIndex = -1;
    }

    if( pHeightMinAbsState )
    {
        sal_Int16 nRel;
        if( (SizeType::MIN != nSizeType) ||
            ( pHeightMinRelState &&
              ( !(pHeightMinRelState->maValue >>= nRel) || nRel > 0 ) ) )
        {
            pHeightMinAbsState->mnIndex = -1;
        }
    }
    if( pHeightMinRelState  && SizeType::MIN != nSizeType)
        pHeightMinRelState->mnIndex = -1;
    if( pHeightAbsState && pHeightMinAbsState &&
        -1 != pHeightMinAbsState->mnIndex )
        pHeightAbsState->mnIndex = -1;
    if( pHeightRelState && SizeType::FIX != nSizeType)
        pHeightRelState->mnIndex = -1;

    if( pWrapState )
    {
        WrapTextMode eVal;
        pWrapState->maValue >>= eVal;
        switch( eVal )
        {
        case WrapTextMode_NONE:
        case WrapTextMode_THROUGHT:
            if( pWrapContourState )
                pWrapContourState->mnIndex = -1;
            if( pWrapParagraphOnlyState )
                pWrapParagraphOnlyState->mnIndex = -1;
            break;
        }
        if( pWrapContourModeState  &&
            (!pWrapContourState ||
             !*(sal_Bool *)pWrapContourState ->maValue.getValue() ) )
            pWrapContourModeState->mnIndex = -1;
    }

    TextContentAnchorType eAnchor = TextContentAnchorType_AT_PARAGRAPH;
    if( pAnchorTypeState )
        pAnchorTypeState->maValue >>= eAnchor;
    else if( bNeedsAnchor )
    {
        Any aAny = rPropSet->getPropertyValue(
                    ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("AnchorType") ) );
        aAny >>= eAnchor;
    }

    if( pHoriOrientState && pHoriOrientMirroredState )
    {
        if( pHoriOrientMirrorState &&
            *(sal_Bool *)pHoriOrientMirrorState->maValue.getValue() )
            pHoriOrientState->mnIndex = -1;
        else
            pHoriOrientMirroredState->mnIndex = -1;
    }
    if( pHoriOrientMirrorState )
        pHoriOrientMirrorState->mnIndex = -1;

    if( pHoriOrientRelState && TextContentAnchorType_AT_FRAME == eAnchor )
        pHoriOrientRelState->mnIndex = -1;
    if( pHoriOrientRelFrameState && TextContentAnchorType_AT_FRAME != eAnchor )
        pHoriOrientRelFrameState->mnIndex = -1;;

    if( pVertOrientRelState && TextContentAnchorType_AT_PARAGRAPH != eAnchor &&
         TextContentAnchorType_AT_CHARACTER != eAnchor )
        pVertOrientRelState->mnIndex = -1;
    if( pVertOrientRelPageState && TextContentAnchorType_AT_PAGE != eAnchor )
        pVertOrientRelPageState->mnIndex = -1;
    if( pVertOrientRelFrameState && TextContentAnchorType_AT_FRAME != eAnchor )
        pVertOrientRelFrameState->mnIndex = -1;
    if( pVertOrientRelAsCharState && TextContentAnchorType_AS_CHARACTER != eAnchor )
        pVertOrientRelAsCharState->mnIndex = -1;

    SvXMLExportPropertyMapper::ContextFilter(rProperties,rPropSet);
}