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