1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: xmlimpit.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sw.hxx"
33 #include "xmlimpit.hxx"
34 #include <xmloff/xmluconv.hxx>
35 #include <svtools/itempool.hxx>
36 #include <svtools/poolitem.hxx>
37 #include <svtools/itemset.hxx>
38 #include <xmloff/attrlist.hxx>
39 #include <xmloff/nmspmap.hxx>
40 #include <xmloff/xmlnmspe.hxx>
41 #include <svx/xmlcnitm.hxx>
44 #include "hintids.hxx"
46 #include <svx/unomid.hxx>
47 #include <svx/lrspitem.hxx>
48 #include <svx/ulspitem.hxx>
49 #include <svx/shaditem.hxx>
50 #include <svx/boxitem.hxx>
51 #include <svx/brkitem.hxx>
52 #include <svx/keepitem.hxx>
53 #include <svx/brshitem.hxx>
54 #include "fmtpdsc.hxx"
55 #include "fmtornt.hxx"
56 #include "fmtfsize.hxx"
59 #include "fmtlsplt.hxx"
61 #include <xmloff/prhdlfac.hxx>
62 #include <xmloff/xmltypes.hxx>
63 #include "xmlithlp.hxx"
64 #include <com/sun/star/uno/Any.hxx>
66 using ::rtl::OUString
;
67 using namespace ::com::sun::star
;
68 using namespace ::xmloff::token
;
71 SvXMLImportItemMapper::SvXMLImportItemMapper(
72 SvXMLItemMapEntriesRef rMapEntries
,
74 mrMapEntries( rMapEntries
),
75 nUnknownWhich( nUnknWhich
)
79 SvXMLImportItemMapper::~SvXMLImportItemMapper()
83 /** fills the given itemset with the attributes in the given list */
84 void SvXMLImportItemMapper::importXML( SfxItemSet
& rSet
,
85 uno::Reference
< xml::sax::XAttributeList
> xAttrList
,
86 const SvXMLUnitConverter
& rUnitConverter
,
87 const SvXMLNamespaceMap
& rNamespaceMap
) const
89 INT16 nAttr
= xAttrList
->getLength();
91 SvXMLAttrContainerItem
*pUnknownItem
= 0;
92 for( INT16 i
=0; i
< nAttr
; i
++ )
94 const OUString
& rAttrName
= xAttrList
->getNameByIndex( i
);
95 OUString aLocalName
, aPrefix
, aNamespace
;
97 rNamespaceMap
.GetKeyByAttrName( rAttrName
, &aPrefix
, &aLocalName
,
99 if( XML_NAMESPACE_XMLNS
== nPrefix
)
102 const OUString
& rValue
= xAttrList
->getValueByIndex( i
);
104 // find a map entry for this attribute
105 SvXMLItemMapEntry
* pEntry
= mrMapEntries
->getByName( nPrefix
, aLocalName
);
109 // we have a valid map entry here, so lets use it...
110 if( 0 == (pEntry
->nMemberId
& (MID_SW_FLAG_NO_ITEM_IMPORT
|
111 MID_SW_FLAG_ELEMENT_ITEM_IMPORT
)) )
113 // first get item from itemset
114 const SfxPoolItem
* pItem
= 0;
115 SfxItemState eState
= rSet
.GetItemState( pEntry
->nWhichId
, TRUE
,
118 // if its not set, try the pool
119 if(SFX_ITEM_SET
!= eState
&& SFX_WHICH_MAX
> pEntry
->nWhichId
)
120 pItem
= &rSet
.GetPool()->GetDefaultItem(pEntry
->nWhichId
);
122 // do we have an item?
123 if(eState
>= SFX_ITEM_DEFAULT
&& pItem
)
125 SfxPoolItem
*pNewItem
= pItem
->Clone();
128 if( 0 == (pEntry
->nMemberId
&MID_SW_FLAG_SPECIAL_ITEM_IMPORT
) )
130 // bPut = pNewItem->importXML( rValue,
131 // pEntry->nMemberId & MID_SW_FLAG_MASK,
133 bPut
= PutXMLValue( *pNewItem
, rValue
,
134 static_cast<sal_uInt16
>( pEntry
->nMemberId
& MID_SW_FLAG_MASK
),
140 bPut
= handleSpecialItem( *pEntry
, *pNewItem
, rSet
,
141 rValue
, rUnitConverter
,
146 rSet
.Put( *pNewItem
);
152 DBG_ERROR( "Could not get a needed item for xml import!" );
155 else if( 0 != (pEntry
->nMemberId
& MID_SW_FLAG_NO_ITEM_IMPORT
) )
157 handleNoItem( *pEntry
, rSet
, rValue
, rUnitConverter
,
161 else if( USHRT_MAX
!= nUnknownWhich
)
165 const SfxPoolItem
* pItem
= 0;
166 if( SFX_ITEM_SET
== rSet
.GetItemState( nUnknownWhich
, TRUE
,
169 SfxPoolItem
*pNew
= pItem
->Clone();
170 pUnknownItem
= PTR_CAST( SvXMLAttrContainerItem
, pNew
);
171 DBG_ASSERT( pUnknownItem
,
172 "SvXMLAttrContainerItem expected" );
178 pUnknownItem
= new SvXMLAttrContainerItem( nUnknownWhich
);
183 if( XML_NAMESPACE_NONE
== nPrefix
)
184 pUnknownItem
->AddAttr( aLocalName
, rValue
);
186 pUnknownItem
->AddAttr( aPrefix
, aNamespace
, aLocalName
,
194 rSet
.Put( *pUnknownItem
);
201 /** this method is called for every item that has the
202 MID_SW_FLAG_SPECIAL_ITEM_IMPORT flag set */
204 SvXMLImportItemMapper::handleSpecialItem( const SvXMLItemMapEntry
& /*rEntry*/,
205 SfxPoolItem
& /*rItem*/,
206 SfxItemSet
& /*rSet*/,
207 const OUString
& /*rValue*/,
208 const SvXMLUnitConverter
& /*rUnitConverter*/,
209 const SvXMLNamespaceMap
& /*rNamespaceMap*/ ) const
211 DBG_ERROR( "unsuported special item in xml import" );
215 /** this method is called for every item that has the
216 MID_SW_FLAG_NO_ITEM_IMPORT flag set */
217 BOOL
SvXMLImportItemMapper::handleNoItem( const SvXMLItemMapEntry
& /*rEntry*/,
218 SfxItemSet
& /*rSet*/,
219 const OUString
& /*rValue*/,
220 const SvXMLUnitConverter
& /*rUnitConverter*/,
221 const SvXMLNamespaceMap
& /*rNamespaceMap*/ ) const
223 DBG_ERROR( "unsuported no item in xml import" );
227 void SvXMLImportItemMapper::finished( SfxItemSet
& ) const
229 // nothing to do here
234 // put an XML-string value into an item
235 sal_Bool
SvXMLImportItemMapper::PutXMLValue(
237 const ::rtl::OUString
& rValue
,
238 sal_uInt16 nMemberId
,
239 const SvXMLUnitConverter
& rUnitConverter
)
241 sal_Bool bOk
= sal_False
;
243 switch (rItem
.Which())
247 SvxLRSpaceItem
* pLRSpace
= PTR_CAST(SvxLRSpaceItem
, &rItem
);
248 DBG_ASSERT( pLRSpace
!= NULL
, "Wrong Which-ID!" );
255 sal_Int32 nProp
= 100;
258 if( rValue
.indexOf( sal_Unicode('%') ) != -1 )
259 bOk
= rUnitConverter
.convertPercent( nProp
, rValue
);
261 bOk
= rUnitConverter
.convertMeasure( nAbs
, rValue
);
268 pLRSpace
->SetTxtLeft( (sal_Int32
)nAbs
, (sal_uInt16
)nProp
);
271 pLRSpace
->SetRight( (sal_Int32
)nAbs
, (sal_uInt16
)nProp
);
277 case MID_FIRST_LINE_INDENT
:
279 sal_Int32 nProp
= 100;
282 if( rValue
.indexOf( sal_Unicode('%') ) != -1 )
283 bOk
= rUnitConverter
.convertPercent( nProp
, rValue
);
285 bOk
= rUnitConverter
.convertMeasure( nAbs
, rValue
,
288 pLRSpace
->SetTxtFirstLineOfst( (short)nAbs
, (sal_uInt16
)nProp
);
294 bOk
= rUnitConverter
.convertBool( bAutoFirst
, rValue
);
296 pLRSpace
->SetAutoFirst( bAutoFirst
);
301 DBG_ERROR( "unknown member id!");
308 SvxULSpaceItem
* pULSpace
= PTR_CAST(SvxULSpaceItem
, &rItem
);
309 DBG_ASSERT( pULSpace
!= NULL
, "Wrong Which-ID!" );
311 sal_Int32 nProp
= 100;
314 if( rValue
.indexOf( sal_Unicode('%') ) != -1 )
315 bOk
= rUnitConverter
.convertPercent( nProp
, rValue
);
317 bOk
= rUnitConverter
.convertMeasure( nAbs
, rValue
);
322 pULSpace
->SetUpper( (sal_uInt16
)nAbs
, (sal_uInt16
)nProp
);
325 pULSpace
->SetLower( (sal_uInt16
)nAbs
, (sal_uInt16
)nProp
);
328 DBG_ERROR("unknown MemberId");
335 SvxShadowItem
* pShadow
= PTR_CAST(SvxShadowItem
, &rItem
);
336 DBG_ASSERT( pShadow
!= NULL
, "Wrong Which-ID" );
338 sal_Bool bColorFound
= sal_False
;
339 sal_Bool bOffsetFound
= sal_False
;
341 SvXMLTokenEnumerator
aTokenEnum( rValue
);
343 Color
aColor( 128,128, 128 );
344 pShadow
->SetLocation( SVX_SHADOW_BOTTOMRIGHT
);
347 while( aTokenEnum
.getNextToken( aToken
) )
349 if( IsXMLToken( aToken
, XML_NONE
) )
351 pShadow
->SetLocation( SVX_SHADOW_NONE
);
354 else if( !bColorFound
&& aToken
.compareToAscii( "#", 1 ) == 0 )
356 bOk
= rUnitConverter
.convertColor( aColor
, aToken
);
360 bColorFound
= sal_True
;
362 else if( !bOffsetFound
)
364 sal_Int32 nX
= 0, nY
= 0;
366 bOk
= rUnitConverter
.convertMeasure( nX
, aToken
);
367 if( bOk
&& aTokenEnum
.getNextToken( aToken
) )
368 bOk
= rUnitConverter
.convertMeasure( nY
, aToken
);
376 pShadow
->SetLocation( SVX_SHADOW_TOPLEFT
);
380 pShadow
->SetLocation( SVX_SHADOW_BOTTOMLEFT
);
387 pShadow
->SetLocation( SVX_SHADOW_TOPRIGHT
);
391 pShadow
->SetLocation( SVX_SHADOW_BOTTOMRIGHT
);
395 if( nX
< 0 ) nX
*= -1;
396 if( nY
< 0 ) nY
*= -1;
398 pShadow
->SetWidth( static_cast< USHORT
>( (nX
+ nY
) >> 1 ) );
403 if( bOk
&& ( bColorFound
|| bOffsetFound
) )
405 pShadow
->SetColor( aColor
);
414 SvxBoxItem
* pBox
= PTR_CAST(SvxBoxItem
, &rItem
);
415 DBG_ASSERT( pBox
!= NULL
, "Wrong WHich-ID" );
417 /** copy SvxBorderLines */
418 SvxBorderLine
* pTop
= pBox
->GetTop() == NULL
?
419 NULL
: new SvxBorderLine( *pBox
->GetTop() );
420 SvxBorderLine
* pBottom
= pBox
->GetBottom() == NULL
?
421 NULL
: new SvxBorderLine( *pBox
->GetBottom() );
422 SvxBorderLine
* pLeft
= pBox
->GetLeft() == NULL
?
423 NULL
: new SvxBorderLine( *pBox
->GetLeft() );
424 SvxBorderLine
* pRight
= pBox
->GetRight() == NULL
?
425 NULL
: new SvxBorderLine( *pBox
->GetRight() );
431 case ALL_BORDER_PADDING
:
432 case LEFT_BORDER_PADDING
:
433 case RIGHT_BORDER_PADDING
:
434 case TOP_BORDER_PADDING
:
435 case BOTTOM_BORDER_PADDING
:
436 if(!rUnitConverter
.convertMeasure( nTemp
, rValue
, 0, 0xffff ))
439 if( nMemberId
== LEFT_BORDER_PADDING
||
440 nMemberId
== ALL_BORDER_PADDING
)
441 pBox
->SetDistance( (sal_uInt16
)nTemp
, BOX_LINE_LEFT
);
442 if( nMemberId
== RIGHT_BORDER_PADDING
||
443 nMemberId
== ALL_BORDER_PADDING
)
444 pBox
->SetDistance( (sal_uInt16
)nTemp
, BOX_LINE_RIGHT
);
445 if( nMemberId
== TOP_BORDER_PADDING
||
446 nMemberId
== ALL_BORDER_PADDING
)
447 pBox
->SetDistance( (sal_uInt16
)nTemp
, BOX_LINE_TOP
);
448 if( nMemberId
== BOTTOM_BORDER_PADDING
||
449 nMemberId
== ALL_BORDER_PADDING
)
450 pBox
->SetDistance( (sal_uInt16
)nTemp
, BOX_LINE_BOTTOM
);
459 sal_Bool bHasStyle
= sal_False
;
460 sal_Bool bHasWidth
= sal_False
;
461 sal_Bool bHasColor
= sal_False
;
463 sal_uInt16 nStyle
= USHRT_MAX
;
464 sal_uInt16 nWidth
= 0;
465 sal_uInt16 nNamedWidth
= USHRT_MAX
;
467 Color
aColor( COL_BLACK
);
469 if( !lcl_frmitems_parseXMLBorder( rValue
, rUnitConverter
,
471 bHasWidth
, nWidth
, nNamedWidth
,
472 bHasColor
, aColor
) )
475 if( TOP_BORDER
== nMemberId
|| ALL_BORDER
== nMemberId
)
476 lcl_frmitems_setXMLBorder( pTop
,
478 bHasWidth
, nWidth
, nNamedWidth
,
481 if( BOTTOM_BORDER
== nMemberId
|| ALL_BORDER
== nMemberId
)
482 lcl_frmitems_setXMLBorder( pBottom
,
484 bHasWidth
, nWidth
, nNamedWidth
,
487 if( LEFT_BORDER
== nMemberId
|| ALL_BORDER
== nMemberId
)
488 lcl_frmitems_setXMLBorder( pLeft
,
490 bHasWidth
, nWidth
, nNamedWidth
,
493 if( RIGHT_BORDER
== nMemberId
|| ALL_BORDER
== nMemberId
)
494 lcl_frmitems_setXMLBorder( pRight
,
496 bHasWidth
, nWidth
, nNamedWidth
,
500 case ALL_BORDER_LINE_WIDTH
:
501 case LEFT_BORDER_LINE_WIDTH
:
502 case RIGHT_BORDER_LINE_WIDTH
:
503 case TOP_BORDER_LINE_WIDTH
:
504 case BOTTOM_BORDER_LINE_WIDTH
:
506 SvXMLTokenEnumerator
aTokenEnum( rValue
);
508 sal_Int32 nInWidth
, nDistance
, nOutWidth
;
511 if( !aTokenEnum
.getNextToken( aToken
) )
514 if( !rUnitConverter
.convertMeasure( nInWidth
, aToken
,
519 if( !aTokenEnum
.getNextToken( aToken
) )
522 if( !rUnitConverter
.convertMeasure( nDistance
, aToken
,
527 if( !aTokenEnum
.getNextToken( aToken
) )
530 if( !rUnitConverter
.convertMeasure( nOutWidth
, aToken
,
535 // #i61946: accept line style even it's not part of our "normal" set of line styles
536 sal_uInt16 nWidth
= 0;
538 if( TOP_BORDER_LINE_WIDTH
== nMemberId
||
539 ALL_BORDER_LINE_WIDTH
== nMemberId
)
540 lcl_frmitems_setXMLBorder( pTop
, nWidth
,
541 static_cast< sal_uInt16
>( nOutWidth
),
542 static_cast< sal_uInt16
>( nInWidth
),
543 static_cast< sal_uInt16
>( nDistance
) );
545 if( BOTTOM_BORDER_LINE_WIDTH
== nMemberId
||
546 ALL_BORDER_LINE_WIDTH
== nMemberId
)
547 lcl_frmitems_setXMLBorder( pBottom
, nWidth
,
548 static_cast< sal_uInt16
>( nOutWidth
),
549 static_cast< sal_uInt16
>( nInWidth
),
550 static_cast< sal_uInt16
>( nDistance
) );
552 if( LEFT_BORDER_LINE_WIDTH
== nMemberId
||
553 ALL_BORDER_LINE_WIDTH
== nMemberId
)
554 lcl_frmitems_setXMLBorder( pLeft
, nWidth
,
555 static_cast< sal_uInt16
>( nOutWidth
),
556 static_cast< sal_uInt16
>( nInWidth
),
557 static_cast< sal_uInt16
>( nDistance
) );
559 if( RIGHT_BORDER_LINE_WIDTH
== nMemberId
||
560 ALL_BORDER_LINE_WIDTH
== nMemberId
)
561 lcl_frmitems_setXMLBorder( pRight
, nWidth
,
562 static_cast< sal_uInt16
>( nOutWidth
),
563 static_cast< sal_uInt16
>( nInWidth
),
564 static_cast< sal_uInt16
>( nDistance
) );
569 pBox
->SetLine( pTop
, BOX_LINE_TOP
);
570 pBox
->SetLine( pBottom
, BOX_LINE_BOTTOM
);
571 pBox
->SetLine( pLeft
, BOX_LINE_LEFT
);
572 pBox
->SetLine( pRight
, BOX_LINE_RIGHT
);
585 SvxFmtBreakItem
* pFmtBreak
= PTR_CAST(SvxFmtBreakItem
, &rItem
);
586 DBG_ASSERT( pFmtBreak
!= NULL
, "Wrong Which-ID" );
590 if( !rUnitConverter
.convertEnum( eEnum
, rValue
, psXML_BreakType
) )
595 pFmtBreak
->SetValue( SVX_BREAK_NONE
);
602 case MID_BREAK_BEFORE
:
603 pFmtBreak
->SetValue( static_cast< USHORT
>((eEnum
== 1) ?
604 SVX_BREAK_COLUMN_BEFORE
:
605 SVX_BREAK_PAGE_BEFORE
) );
607 case MID_BREAK_AFTER
:
608 pFmtBreak
->SetValue( static_cast< USHORT
>((eEnum
== 1) ?
609 SVX_BREAK_COLUMN_AFTER
:
610 SVX_BREAK_PAGE_AFTER
) );
620 SvxFmtKeepItem
* pFmtKeep
= PTR_CAST(SvxFmtKeepItem
, &rItem
);
621 DBG_ASSERT( pFmtKeep
!= NULL
, "Wrong Which-ID" );
623 if( IsXMLToken( rValue
, XML_ALWAYS
) ||
624 IsXMLToken( rValue
, XML_TRUE
) )
626 pFmtKeep
->SetValue( sal_True
);
629 else if( IsXMLToken( rValue
, XML_AUTO
) ||
630 IsXMLToken( rValue
, XML_FALSE
) )
632 pFmtKeep
->SetValue( sal_False
);
640 SvxBrushItem
* pBrush
= PTR_CAST(SvxBrushItem
, &rItem
);
641 DBG_ASSERT( pBrush
!= NULL
, "Wrong Which-ID" );
647 if( IsXMLToken( rValue
, XML_TRANSPARENT
) )
649 pBrush
->GetColor().SetTransparency(0xff);
652 else if( rUnitConverter
.convertColor( aTempColor
, rValue
) )
654 aTempColor
.SetTransparency(0);
655 pBrush
->SetColor( aTempColor
);
660 case MID_GRAPHIC_LINK
:
662 SvxGraphicPosition eOldGraphicPos
= pBrush
->GetGraphicPos();
665 pBrush
->PutValue( aAny
, MID_GRAPHIC_URL
);
666 if( GPOS_NONE
== eOldGraphicPos
&&
667 GPOS_NONE
!= pBrush
->GetGraphicPos() )
668 pBrush
->SetGraphicPos( GPOS_TILED
);
673 case MID_GRAPHIC_REPEAT
:
675 SvxGraphicPosition eGraphicPos
= pBrush
->GetGraphicPos();
676 sal_uInt16 nPos
= GPOS_NONE
;
677 if( rUnitConverter
.convertEnum( nPos
, rValue
,
678 psXML_BrushRepeat
) )
680 if( GPOS_MM
!= nPos
|| GPOS_NONE
== eGraphicPos
||
681 GPOS_AREA
== eGraphicPos
|| GPOS_TILED
== eGraphicPos
)
682 pBrush
->SetGraphicPos( (SvxGraphicPosition
)nPos
);
688 case MID_GRAPHIC_POSITION
:
690 SvxGraphicPosition ePos
= GPOS_NONE
, eTmp
;
692 SvXMLTokenEnumerator
aTokenEnum( rValue
);
694 sal_Bool bHori
= sal_False
, bVert
= sal_False
;
696 while( bOk
&& aTokenEnum
.getNextToken( aToken
) )
702 else if( -1 != aToken
.indexOf( sal_Unicode('%') ) )
705 if( rUnitConverter
.convertPercent( nPrc
, aToken
) )
709 ePos
= nPrc
< 25 ? GPOS_LT
:
710 (nPrc
< 75 ? GPOS_MM
: GPOS_RB
);
715 eTmp
= nPrc
< 25 ? GPOS_LT
:
716 (nPrc
< 75 ? GPOS_LM
: GPOS_LB
);
717 lcl_frmitems_MergeXMLVertPos( ePos
, eTmp
);
727 else if( IsXMLToken( aToken
, XML_CENTER
) )
730 lcl_frmitems_MergeXMLVertPos( ePos
, GPOS_MM
);
732 lcl_frmitems_MergeXMLHoriPos( ePos
, GPOS_MM
);
736 else if( rUnitConverter
.convertEnum( nTmp
, aToken
,
737 psXML_BrushHoriPos
) )
740 lcl_frmitems_MergeXMLHoriPos(
741 ePos
, (SvxGraphicPosition
)nTmp
);
743 ePos
= (SvxGraphicPosition
)nTmp
;
748 else if( rUnitConverter
.convertEnum( nTmp
, aToken
,
749 psXML_BrushVertPos
) )
752 lcl_frmitems_MergeXMLVertPos(
753 ePos
, (SvxGraphicPosition
)nTmp
);
755 ePos
= (SvxGraphicPosition
)nTmp
;
766 bOk
&= GPOS_NONE
!= ePos
;
768 pBrush
->SetGraphicPos( ePos
);
772 case MID_GRAPHIC_FILTER
:
773 pBrush
->SetGraphicFilter( rValue
.getStr() );
782 SwFmtPageDesc
* pPageDesc
= PTR_CAST(SwFmtPageDesc
, &rItem
);
783 DBG_ASSERT( pPageDesc
!= NULL
, "Wrong Which-ID" );
785 if( MID_PAGEDESC_PAGENUMOFFSET
==nMemberId
)
788 bOk
= rUnitConverter
.convertNumber( nVal
, rValue
, 0, USHRT_MAX
);
790 pPageDesc
->SetNumOffset( (USHORT
)nVal
);
795 case RES_LAYOUT_SPLIT
:
798 SfxBoolItem
* pSplit
= PTR_CAST(SfxBoolItem
, &rItem
);
799 DBG_ASSERT( pSplit
!= NULL
, "Wrong Which-ID" );
801 if( IsXMLToken( rValue
, XML_AUTO
) ||
802 IsXMLToken( rValue
, XML_TRUE
) )
804 pSplit
->SetValue( sal_True
);
807 else if( IsXMLToken( rValue
, XML_ALWAYS
) ||
808 IsXMLToken( rValue
, XML_FALSE
) )
810 pSplit
->SetValue( sal_False
);
816 case RES_HORI_ORIENT
:
818 SwFmtHoriOrient
* pHoriOrient
= PTR_CAST(SwFmtHoriOrient
, &rItem
);
819 DBG_ASSERT( pHoriOrient
!= NULL
, "Wrong Which-ID" );
822 bOk
= rUnitConverter
.convertEnum( nValue
, rValue
,
825 pHoriOrient
->SetHoriOrient( nValue
);
829 case RES_VERT_ORIENT
:
831 SwFmtVertOrient
* pVertOrient
= PTR_CAST(SwFmtVertOrient
, &rItem
);
832 DBG_ASSERT( pVertOrient
!= NULL
, "Wrong Which-ID" );
835 bOk
= rUnitConverter
.convertEnum( nValue
, rValue
,
836 aXMLTableVAlignMap
);
838 pVertOrient
->SetVertOrient( nValue
);
839 //#i8855# text::VertOrientation::NONE is stored as empty string and should be applied here
840 else if(!rValue
.getLength())
842 pVertOrient
->SetVertOrient( text::VertOrientation::NONE
);
850 SwFmtFrmSize
* pFrmSize
= PTR_CAST(SwFmtFrmSize
, &rItem
);
851 DBG_ASSERT( pFrmSize
!= NULL
, "Wrong Which-ID" );
853 sal_Bool bSetHeight
= sal_False
;
854 sal_Bool bSetWidth
= sal_False
;
855 sal_Bool bSetSizeType
= sal_False
;
856 SwFrmSize eSizeType
= ATT_VAR_SIZE
;
857 sal_Int32 nMin
= MINLAY
;
861 case MID_FRMSIZE_REL_WIDTH
:
864 bOk
= rUnitConverter
.convertPercent( nValue
, rValue
);
869 else if( nValue
> 100 )
872 pFrmSize
->SetWidthPercent( (sal_Int8
)nValue
);
876 case MID_FRMSIZE_WIDTH
:
877 bSetWidth
= sal_True
;
879 case MID_FRMSIZE_MIN_HEIGHT
:
880 eSizeType
= ATT_MIN_SIZE
;
881 bSetHeight
= sal_True
;
883 bSetSizeType
= sal_True
;
885 case MID_FRMSIZE_FIX_HEIGHT
:
886 eSizeType
= ATT_FIX_SIZE
;
887 bSetHeight
= sal_True
;
889 bSetSizeType
= sal_True
;
891 case MID_FRMSIZE_COL_WIDTH
:
892 eSizeType
= ATT_FIX_SIZE
;
893 bSetWidth
= sal_True
;
894 bSetSizeType
= sal_True
;
896 case MID_FRMSIZE_REL_COL_WIDTH
:
898 sal_Int32 nPos
= rValue
.indexOf( (sal_Unicode
)'*' );
901 OUString
sNum( rValue
.copy( 0L, nPos
) );
902 sal_Int32 nValue
= rValue
.toInt32();
903 if( nValue
< MINLAY
)
905 else if( nValue
> USHRT_MAX
)
908 pFrmSize
->SetWidth( (sal_uInt16
)nValue
);
909 pFrmSize
->SetHeightSizeType( ATT_VAR_SIZE
);
917 if( bSetHeight
|| bSetWidth
)
919 bOk
= rUnitConverter
.convertMeasure( nValue
, rValue
, nMin
,
924 pFrmSize
->SetWidth( (sal_uInt16
)nValue
);
926 pFrmSize
->SetHeight( (sal_uInt16
)nValue
);
928 pFrmSize
->SetHeightSizeType( eSizeType
);
936 const XMLPropertyHandler
* pWritingModeHandler
=
937 XMLPropertyHandlerFactory::CreatePropertyHandler(
938 XML_TYPE_TEXT_WRITING_MODE_WITH_DEFAULT
);
939 if( pWritingModeHandler
!= NULL
)
942 bOk
= pWritingModeHandler
->importXML( rValue
, aAny
,
945 bOk
= rItem
.PutValue( aAny
);
950 case RES_COLLAPSING_BORDERS
:
952 SfxBoolItem
* pBorders
= PTR_CAST(SfxBoolItem
, &rItem
);
953 DBG_ASSERT( pBorders
!= NULL
, "Wrong Which-ID" );
955 if( IsXMLToken( rValue
, XML_COLLAPSING
) )
957 pBorders
->SetValue( sal_True
);
960 else if( IsXMLToken( rValue
, XML_SEPARATING
) )
962 pBorders
->SetValue( sal_False
);
971 DBG_ERROR("Item not implemented!");