1 /**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22
23 #include <SectionColumnHandler.hxx>
24 #include <PropertyMap.hxx>
25 #include <doctok/resourceids.hxx>
26 #include <ConversionHelper.hxx>
27 #include <ooxml/resourceids.hxx>
28
29 #include "dmapperLoggers.hxx"
30
31 namespace writerfilter {
32 namespace dmapper {
33
34 using namespace ::com::sun::star;
35 //using namespace ::std;
36
37 /*-- 02.06.2008 13:36:24---------------------------------------------------
38
39 -----------------------------------------------------------------------*/
SectionColumnHandler()40 SectionColumnHandler::SectionColumnHandler() :
41 LoggedProperties(dmapper_logger, "SectionColumnHandler"),
42 bEqualWidth( false ),
43 nSpace( 0 ),
44 nNum( 0 ),
45 bSep( false )
46 {
47 }
48 /*-- 02.06.2008 13:36:24---------------------------------------------------
49
50 -----------------------------------------------------------------------*/
~SectionColumnHandler()51 SectionColumnHandler::~SectionColumnHandler()
52 {
53 }
54 /*-- 02.06.2008 13:36:24---------------------------------------------------
55
56 -----------------------------------------------------------------------*/
lcl_attribute(Id rName,Value & rVal)57 void SectionColumnHandler::lcl_attribute(Id rName, Value & rVal)
58 {
59 sal_Int32 nIntValue = rVal.getInt();
60 /* WRITERFILTERSTATUS: table: SectionColumnHandler_attributedata */
61 switch( rName )
62 {
63 case NS_ooxml::LN_CT_Columns_equalWidth:
64 /* WRITERFILTERSTATUS: done: 100, planned: 0.5, spent: 0 */
65 bEqualWidth = (nIntValue != 0);
66 break;
67 case NS_ooxml::LN_CT_Columns_space:
68 /* WRITERFILTERSTATUS: done: 100, planned: 0.5, spent: 0 */
69 nSpace = ConversionHelper::convertTwipToMM100( nIntValue );
70 break;
71 case NS_ooxml::LN_CT_Columns_num:
72 /* WRITERFILTERSTATUS: done: 100, planned: 0.5, spent: 0 */
73 nNum = nIntValue;
74 break;
75 case NS_ooxml::LN_CT_Columns_sep:
76 /* WRITERFILTERSTATUS: done: 100, planned: 0.5, spent: 0 */
77 bSep = (nIntValue != 0);
78 break;
79
80 case NS_ooxml::LN_CT_Column_w:
81 /* WRITERFILTERSTATUS: done: 100, planned: 0.5, spent: 0 */
82 aTempColumn.nWidth = ConversionHelper::convertTwipToMM100( nIntValue );
83 break;
84 case NS_ooxml::LN_CT_Column_space:
85 /* WRITERFILTERSTATUS: done: 100, planned: 0.5, spent: 0 */
86 aTempColumn.nSpace = ConversionHelper::convertTwipToMM100( nIntValue );
87 break;
88 default:
89 OSL_ENSURE( false, "SectionColumnHandler: unknown attribute");
90 }
91 }
92 /*-- 02.06.2008 13:36:24---------------------------------------------------
93
94 -----------------------------------------------------------------------*/
lcl_sprm(Sprm & rSprm)95 void SectionColumnHandler::lcl_sprm(Sprm & rSprm)
96 {
97 /* WRITERFILTERSTATUS: table: SectionColumnHandler_sprm */
98 switch( rSprm.getId())
99 {
100 case NS_ooxml::LN_CT_Columns_col:
101 /* WRITERFILTERSTATUS: done: 100, planned: 0.5, spent: 0 */
102 {
103 aTempColumn.nWidth = aTempColumn.nSpace = 0;
104 writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
105 if( pProperties.get())
106 {
107 pProperties->resolve(*this);
108 aCols.push_back(aTempColumn);
109 }
110 }
111 break;
112 default:
113 OSL_ENSURE( false, "SectionColumnHandler: unknown sprm");
114 }
115 }
116 } //namespace dmapper
117 } //namespace writerfilter
118