1 #include "PageBordersHandler.hxx"
3 #include <ooxml/resourceids.hxx>
5 namespace writerfilter
{
8 _PgBorder::_PgBorder( ) :
10 m_ePos( BORDER_RIGHT
)
14 _PgBorder::~_PgBorder( )
18 PageBordersHandler::PageBordersHandler( ) :
24 PageBordersHandler::~PageBordersHandler( )
28 void PageBordersHandler::attribute( Id eName
, Value
& rVal
)
30 int nIntValue
= rVal
.getInt( );
33 case NS_ooxml::LN_CT_PageBorders_display
:
38 case NS_ooxml::LN_Value_wordprocessingml_ST_PageBorderDisplay_allPages
:
41 case NS_ooxml::LN_Value_wordprocessingml_ST_PageBorderDisplay_firstPage
:
44 case NS_ooxml::LN_Value_wordprocessingml_ST_PageBorderDisplay_notFirstPage
:
50 case NS_ooxml::LN_CT_PageBorders_offsetFrom
:
55 case NS_ooxml::LN_Value_wordprocessingml_ST_PageBorderOffset_page
:
58 case NS_ooxml::LN_Value_wordprocessingml_ST_PageBorderOffset_text
:
68 void PageBordersHandler::sprm( Sprm
& rSprm
)
70 switch ( rSprm
.getId( ) )
72 case NS_ooxml::LN_CT_PageBorders_top
:
73 case NS_ooxml::LN_CT_PageBorders_left
:
74 case NS_ooxml::LN_CT_PageBorders_bottom
:
75 case NS_ooxml::LN_CT_PageBorders_right
:
77 writerfilter::Reference
<Properties
>::Pointer_t pProperties
= rSprm
.getProps();
78 if( pProperties
.get())
80 BorderHandlerPtr
pBorderHandler( new BorderHandler( true ) );
81 pProperties
->resolve(*pBorderHandler
);
82 BorderPosition ePos
= BorderPosition( 0 );
83 switch( rSprm
.getId( ) )
85 case NS_ooxml::LN_CT_PageBorders_top
:
88 case NS_ooxml::LN_CT_PageBorders_left
:
91 case NS_ooxml::LN_CT_PageBorders_bottom
:
94 case NS_ooxml::LN_CT_PageBorders_right
:
101 aPgBorder
.m_rLine
= pBorderHandler
->getBorderLine( );
102 aPgBorder
.m_nDistance
= pBorderHandler
->getLineDistance( );
103 aPgBorder
.m_ePos
= ePos
;
104 m_aBorders
.push_back( aPgBorder
);
112 void PageBordersHandler::SetBorders( SectionPropertyMap
* pSectContext
)
114 for ( int i
= 0, length
= m_aBorders
.size( ); i
< length
; i
++ )
116 _PgBorder aBorder
= m_aBorders
[i
];
117 pSectContext
->SetBorder( aBorder
.m_ePos
, aBorder
.m_nDistance
, aBorder
.m_rLine
);