update emoji autocorrect entries from po-files
[LibreOffice.git] / writerfilter / source / dmapper / PageBordersHandler.cxx
blobf0790ea41ad2d9318d546c5f99bd5d2b5a92ee45
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include "PageBordersHandler.hxx"
22 #include <ooxml/resourceids.hxx>
24 namespace writerfilter {
25 namespace dmapper {
27 _PgBorder::_PgBorder( ) :
28 m_nDistance( 0 ),
29 m_ePos( BORDER_RIGHT ),
30 m_bShadow(false)
34 _PgBorder::~_PgBorder( )
38 PageBordersHandler::PageBordersHandler( ) :
39 LoggedProperties("PageBordersHandler"),
40 m_nDisplay( 0 ),
41 m_nOffset( 0 )
45 PageBordersHandler::~PageBordersHandler( )
49 void PageBordersHandler::lcl_attribute( Id eName, Value& rVal )
51 int nIntValue = rVal.getInt( );
52 switch ( eName )
54 case NS_ooxml::LN_CT_PageBorders_display:
56 switch ( nIntValue )
58 default:
59 case NS_ooxml::LN_Value_doc_ST_PageBorderDisplay_allPages:
60 m_nDisplay = 0;
61 break;
62 case NS_ooxml::LN_Value_doc_ST_PageBorderDisplay_firstPage:
63 m_nDisplay = 1;
64 break;
65 case NS_ooxml::LN_Value_doc_ST_PageBorderDisplay_notFirstPage:
66 m_nDisplay = 2;
67 break;
70 break;
71 case NS_ooxml::LN_CT_PageBorders_offsetFrom:
73 switch ( nIntValue )
75 default:
76 case NS_ooxml::LN_Value_doc_ST_PageBorderOffset_page:
77 m_nOffset = 1;
78 break;
79 case NS_ooxml::LN_Value_doc_ST_PageBorderOffset_text:
80 m_nOffset = 0;
81 break;
84 break;
85 default:;
89 void PageBordersHandler::lcl_sprm( Sprm& rSprm )
91 switch ( rSprm.getId( ) )
93 case NS_ooxml::LN_CT_PageBorders_top:
94 case NS_ooxml::LN_CT_PageBorders_left:
95 case NS_ooxml::LN_CT_PageBorders_bottom:
96 case NS_ooxml::LN_CT_PageBorders_right:
98 writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
99 if( pProperties.get())
101 BorderHandlerPtr pBorderHandler( new BorderHandler( true ) );
102 pProperties->resolve(*pBorderHandler);
103 BorderPosition ePos = BorderPosition( 0 );
104 switch( rSprm.getId( ) )
106 case NS_ooxml::LN_CT_PageBorders_top:
107 ePos = BORDER_TOP;
108 break;
109 case NS_ooxml::LN_CT_PageBorders_left:
110 ePos = BORDER_LEFT;
111 break;
112 case NS_ooxml::LN_CT_PageBorders_bottom:
113 ePos = BORDER_BOTTOM;
114 break;
115 case NS_ooxml::LN_CT_PageBorders_right:
116 ePos = BORDER_RIGHT;
117 break;
118 default:;
121 _PgBorder aPgBorder;
122 aPgBorder.m_rLine = pBorderHandler->getBorderLine( );
123 aPgBorder.m_nDistance = pBorderHandler->getLineDistance( );
124 aPgBorder.m_ePos = ePos;
125 aPgBorder.m_bShadow = pBorderHandler->getShadow();
126 m_aBorders.push_back( aPgBorder );
129 break;
130 default:;
134 void PageBordersHandler::SetBorders( SectionPropertyMap* pSectContext )
136 for ( int i = 0, length = m_aBorders.size( ); i < length; i++ )
138 _PgBorder aBorder = m_aBorders[i];
139 pSectContext->SetBorder( aBorder.m_ePos, aBorder.m_nDistance, aBorder.m_rLine, aBorder.m_bShadow );
145 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */