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 "FFDataHandler.hxx"
20 :
21 : #include <ooxml/resourceids.hxx>
22 :
23 : namespace writerfilter {
24 : namespace dmapper {
25 :
26 : /************************
27 : * class: FFDataHandler *
28 : ************************/
29 :
30 63 : FFDataHandler::FFDataHandler() :
31 : LoggedProperties("FFDataHandler"),
32 : m_nCheckboxHeight(0),
33 : m_bCheckboxAutoHeight(false),
34 : m_nCheckboxChecked(-1),
35 63 : m_nCheckboxDefault(-1)
36 : {
37 63 : }
38 :
39 :
40 126 : FFDataHandler::~FFDataHandler()
41 : {
42 126 : }
43 :
44 :
45 :
46 :
47 :
48 :
49 30 : bool FFDataHandler::getCheckboxChecked() const
50 : {
51 30 : if (m_nCheckboxChecked != -1)
52 23 : return m_nCheckboxChecked;
53 7 : else if (m_nCheckboxDefault != -1)
54 6 : return m_nCheckboxDefault;
55 : else
56 1 : return false;
57 : }
58 :
59 :
60 :
61 :
62 188 : void FFDataHandler::lcl_sprm(Sprm & r_Sprm)
63 : {
64 188 : switch(r_Sprm.getId())
65 : {
66 : case NS_ooxml::LN_CT_FFData_name:
67 : {
68 32 : m_sName = r_Sprm.getValue()->getString();
69 : }
70 32 : break;
71 : case NS_ooxml::LN_CT_FFData_helpText:
72 : {
73 0 : resolveSprm(r_Sprm);
74 : }
75 0 : break;
76 : case NS_ooxml::LN_CT_FFData_statusText:
77 : {
78 1 : resolveSprm(r_Sprm);
79 : }
80 1 : break;
81 : case NS_ooxml::LN_CT_FFCheckBox_size:
82 : {
83 2 : m_nCheckboxHeight = r_Sprm.getValue()->getInt();
84 : }
85 2 : break;
86 : case NS_ooxml::LN_CT_FFCheckBox_sizeAuto:
87 : {
88 27 : m_bCheckboxAutoHeight = r_Sprm.getValue()->getInt();
89 : }
90 27 : break;
91 : case NS_ooxml::LN_CT_FFCheckBox_checked:
92 : {
93 23 : m_nCheckboxChecked = r_Sprm.getValue()->getInt();
94 : }
95 23 : break;
96 : case NS_ooxml::LN_CT_FFCheckBox_default:
97 : {
98 8 : m_nCheckboxDefault = r_Sprm.getValue()->getInt();
99 : }
100 8 : break;
101 : case NS_ooxml::LN_CT_FFData_checkBox:
102 : {
103 29 : resolveSprm(r_Sprm);
104 : }
105 29 : break;
106 : case NS_ooxml::LN_CT_FFDDList_result:
107 : {
108 0 : m_sDropDownResult = r_Sprm.getValue()->getString();
109 : }
110 0 : break;
111 : case NS_ooxml::LN_CT_FFDDList_listEntry:
112 : {
113 0 : m_DropDownEntries.push_back(r_Sprm.getValue()->getString());
114 : }
115 0 : break;
116 : case NS_ooxml::LN_CT_FFData_ddList:
117 : {
118 0 : resolveSprm(r_Sprm);
119 : }
120 0 : break;
121 : case NS_ooxml::LN_CT_FFTextInput_default:
122 : {
123 0 : m_sTextDefault = r_Sprm.getValue()->getString();
124 : }
125 0 : break;
126 : case NS_ooxml::LN_CT_FFData_textInput:
127 : {
128 2 : resolveSprm(r_Sprm);
129 : }
130 2 : break;
131 : default:
132 : #ifdef DEBUG_WRITERFILTER
133 : TagLogger::getInstance().element("unhandled");
134 : #endif
135 64 : break;
136 : }
137 188 : }
138 :
139 32 : void FFDataHandler::resolveSprm(Sprm & r_Sprm)
140 : {
141 32 : writerfilter::Reference<Properties>::Pointer_t pProperties = r_Sprm.getProps();
142 32 : if( pProperties.get())
143 32 : pProperties->resolve(*this);
144 32 : }
145 :
146 2 : void FFDataHandler::lcl_attribute(Id name, Value & val)
147 : {
148 2 : switch (name)
149 : {
150 : case NS_ooxml::LN_CT_FFHelpText_val:
151 : {
152 0 : m_sHelpText = val.getString();
153 : }
154 0 : break;
155 : case NS_ooxml::LN_CT_FFStatusText_val:
156 : {
157 1 : m_sStatusText = val.getString();
158 : }
159 1 : break;
160 : default:
161 : #ifdef DEBUG_WRITERFILTER
162 : TagLogger::getInstance().element("unhandled");
163 : #endif
164 1 : break;
165 : }
166 2 : }
167 :
168 : }}
169 :
170 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|