Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 : #include <SectionColumnHandler.hxx>
20 : #include <PropertyMap.hxx>
21 : #include <ConversionHelper.hxx>
22 : #include <ooxml/resourceids.hxx>
23 :
24 : #include "dmapperLoggers.hxx"
25 :
26 : namespace writerfilter {
27 : namespace dmapper {
28 :
29 : using namespace ::com::sun::star;
30 :
31 :
32 639 : SectionColumnHandler::SectionColumnHandler()
33 : : LoggedProperties(dmapper_logger, "SectionColumnHandler")
34 : , bEqualWidth(false)
35 : , nSpace(0)
36 : , nNum(0)
37 639 : , bSep(false)
38 : {
39 639 : aTempColumn.nWidth = aTempColumn.nSpace = 0;
40 639 : }
41 :
42 1278 : SectionColumnHandler::~SectionColumnHandler()
43 : {
44 1278 : }
45 :
46 745 : void SectionColumnHandler::lcl_attribute(Id rName, Value & rVal)
47 : {
48 745 : sal_Int32 nIntValue = rVal.getInt();
49 745 : switch( rName )
50 : {
51 : case NS_ooxml::LN_CT_Columns_equalWidth:
52 23 : bEqualWidth = (nIntValue != 0);
53 23 : break;
54 : case NS_ooxml::LN_CT_Columns_space:
55 635 : nSpace = ConversionHelper::convertTwipToMM100( nIntValue );
56 635 : break;
57 : case NS_ooxml::LN_CT_Columns_num:
58 35 : nNum = nIntValue;
59 35 : break;
60 : case NS_ooxml::LN_CT_Columns_sep:
61 15 : bSep = (nIntValue != 0);
62 15 : break;
63 :
64 : case NS_ooxml::LN_CT_Column_w:
65 25 : aTempColumn.nWidth = ConversionHelper::convertTwipToMM100( nIntValue );
66 25 : break;
67 : case NS_ooxml::LN_CT_Column_space:
68 12 : aTempColumn.nSpace = ConversionHelper::convertTwipToMM100( nIntValue );
69 12 : break;
70 : default:
71 : OSL_FAIL( "SectionColumnHandler: unknown attribute");
72 : }
73 745 : }
74 :
75 25 : void SectionColumnHandler::lcl_sprm(Sprm & rSprm)
76 : {
77 25 : switch( rSprm.getId())
78 : {
79 : case NS_ooxml::LN_CT_Columns_col:
80 : {
81 25 : aTempColumn.nWidth = aTempColumn.nSpace = 0;
82 25 : writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
83 25 : if( pProperties.get())
84 : {
85 25 : pProperties->resolve(*this);
86 25 : aCols.push_back(aTempColumn);
87 25 : }
88 : }
89 25 : break;
90 : default:
91 : OSL_FAIL( "SectionColumnHandler: unknown sprm");
92 : }
93 25 : }
94 : } //namespace dmapper
95 : } //namespace writerfilter
96 :
97 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|