Branch data 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 <doctok/resourceids.hxx>
22 : : #include <ConversionHelper.hxx>
23 : : #include <ooxml/resourceids.hxx>
24 : :
25 : : #include "dmapperLoggers.hxx"
26 : :
27 : : namespace writerfilter {
28 : : namespace dmapper {
29 : :
30 : : using namespace ::com::sun::star;
31 : :
32 : :
33 : 119 : SectionColumnHandler::SectionColumnHandler() :
34 : : LoggedProperties(dmapper_logger, "SectionColumnHandler"),
35 : : bEqualWidth( false ),
36 : : nSpace( 0 ),
37 : : nNum( 0 ),
38 [ + - ][ + - ]: 119 : bSep( false )
[ + - ][ + - ]
[ + - ]
39 : : {
40 : 119 : }
41 : :
42 : 119 : SectionColumnHandler::~SectionColumnHandler()
43 : : {
44 [ - + ]: 238 : }
45 : :
46 : 152 : void SectionColumnHandler::lcl_attribute(Id rName, Value & rVal)
47 : : {
48 : 152 : sal_Int32 nIntValue = rVal.getInt();
49 [ + + + + : 152 : switch( rName )
+ + - ]
50 : : {
51 : : case NS_ooxml::LN_CT_Columns_equalWidth:
52 : 6 : bEqualWidth = (nIntValue != 0);
53 : 6 : break;
54 : : case NS_ooxml::LN_CT_Columns_space:
55 : 119 : nSpace = ConversionHelper::convertTwipToMM100( nIntValue );
56 : 119 : break;
57 : : case NS_ooxml::LN_CT_Columns_num:
58 : 6 : nNum = nIntValue;
59 : 6 : break;
60 : : case NS_ooxml::LN_CT_Columns_sep:
61 : 3 : bSep = (nIntValue != 0);
62 : 3 : break;
63 : :
64 : : case NS_ooxml::LN_CT_Column_w:
65 : 12 : aTempColumn.nWidth = ConversionHelper::convertTwipToMM100( nIntValue );
66 : 12 : break;
67 : : case NS_ooxml::LN_CT_Column_space:
68 : 6 : aTempColumn.nSpace = ConversionHelper::convertTwipToMM100( nIntValue );
69 : 6 : break;
70 : : default:
71 : : OSL_FAIL( "SectionColumnHandler: unknown attribute");
72 : : }
73 : 152 : }
74 : :
75 : 12 : void SectionColumnHandler::lcl_sprm(Sprm & rSprm)
76 : : {
77 [ + - ]: 12 : switch( rSprm.getId())
78 : : {
79 : : case NS_ooxml::LN_CT_Columns_col:
80 : : {
81 : 12 : aTempColumn.nWidth = aTempColumn.nSpace = 0;
82 [ + - ]: 12 : writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
83 [ + - ]: 12 : if( pProperties.get())
84 : : {
85 [ + - ]: 12 : pProperties->resolve(*this);
86 [ + - ]: 12 : aCols.push_back(aTempColumn);
87 [ + - ]: 12 : }
88 : : }
89 : 12 : break;
90 : : default:
91 : : OSL_FAIL( "SectionColumnHandler: unknown sprm");
92 : : }
93 : 12 : }
94 : : } //namespace dmapper
95 [ + - ][ + - ]: 60 : } //namespace writerfilter
96 : :
97 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|