1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
19 #include "SectionColumnHandler.hxx"
20 #include "PropertyMap.hxx"
21 #include "ConversionHelper.hxx"
22 #include <ooxml/resourceids.hxx>
23 #include <osl/diagnose.h>
25 namespace writerfilter
{
28 using namespace ::com::sun::star
;
31 SectionColumnHandler::SectionColumnHandler()
32 : LoggedProperties("SectionColumnHandler")
33 , m_bEqualWidth(false)
34 , m_nSpace(1270) // 720 twips
38 m_aTempColumn
.nWidth
= m_aTempColumn
.nSpace
= 0;
41 SectionColumnHandler::~SectionColumnHandler()
45 void SectionColumnHandler::lcl_attribute(Id rName
, Value
& rVal
)
47 sal_Int32 nIntValue
= rVal
.getInt();
50 case NS_ooxml::LN_CT_Columns_equalWidth
:
51 m_bEqualWidth
= (nIntValue
!= 0);
53 case NS_ooxml::LN_CT_Columns_space
:
54 m_nSpace
= ConversionHelper::convertTwipToMM100( nIntValue
);
56 case NS_ooxml::LN_CT_Columns_num
:
59 case NS_ooxml::LN_CT_Columns_sep
:
60 m_bSep
= (nIntValue
!= 0);
63 case NS_ooxml::LN_CT_Column_w
:
64 m_aTempColumn
.nWidth
= ConversionHelper::convertTwipToMM100( nIntValue
);
66 case NS_ooxml::LN_CT_Column_space
:
67 m_aTempColumn
.nSpace
= ConversionHelper::convertTwipToMM100( nIntValue
);
70 OSL_FAIL( "SectionColumnHandler: unknown attribute");
74 void SectionColumnHandler::lcl_sprm(Sprm
& rSprm
)
76 switch( rSprm
.getId())
78 case NS_ooxml::LN_CT_Columns_col
:
80 m_aTempColumn
.nWidth
= m_aTempColumn
.nSpace
= 0;
81 writerfilter::Reference
<Properties
>::Pointer_t pProperties
= rSprm
.getProps();
82 if( pProperties
.get())
84 pProperties
->resolve(*this);
85 m_aCols
.push_back(m_aTempColumn
);
90 OSL_FAIL( "SectionColumnHandler: unknown sprm");
94 } //namespace writerfilter
96 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */