lok: vcl: fix multiple floatwin removal case more robustly.
[LibreOffice.git] / writerfilter / source / dmapper / SectionColumnHandler.cxx
blob320708b80a6877dc6f556d634b3198fd14bb793f
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 .
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 {
26 namespace dmapper {
28 using namespace ::com::sun::star;
31 SectionColumnHandler::SectionColumnHandler()
32 : LoggedProperties("SectionColumnHandler")
33 , m_bEqualWidth(false)
34 , m_nSpace(1270) // 720 twips
35 , m_nNum(0)
36 , m_bSep(false)
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();
48 switch( rName )
50 case NS_ooxml::LN_CT_Columns_equalWidth:
51 m_bEqualWidth = (nIntValue != 0);
52 break;
53 case NS_ooxml::LN_CT_Columns_space:
54 m_nSpace = ConversionHelper::convertTwipToMM100( nIntValue );
55 break;
56 case NS_ooxml::LN_CT_Columns_num:
57 m_nNum = nIntValue;
58 break;
59 case NS_ooxml::LN_CT_Columns_sep:
60 m_bSep = (nIntValue != 0);
61 break;
63 case NS_ooxml::LN_CT_Column_w:
64 m_aTempColumn.nWidth = ConversionHelper::convertTwipToMM100( nIntValue );
65 break;
66 case NS_ooxml::LN_CT_Column_space:
67 m_aTempColumn.nSpace = ConversionHelper::convertTwipToMM100( nIntValue );
68 break;
69 default:
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);
88 break;
89 default:
90 OSL_FAIL( "SectionColumnHandler: unknown sprm");
93 } //namespace dmapper
94 } //namespace writerfilter
96 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */