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 : :
20 : : #include <doctok/resources.hxx>
21 : : #include <WW8DocumentImpl.hxx>
22 : :
23 : : namespace writerfilter {
24 : : namespace doctok
25 : : {
26 : :
27 : 0 : void WW8PICF::resolveNoAuto(Properties & rHandler)
28 : : {
29 [ # # ][ # # ]: 0 : WW8Stream::Pointer_t pStream = getDocument()->getDataStream();
30 : :
31 : : {
32 [ # # ]: 0 : writerfilter::Reference<Properties>::Pointer_t pContent;
33 [ # # ][ # # ]: 0 : if (getDocument()->isPicData())
[ # # ]
34 : : {
35 [ # # ][ # # ]: 0 : WW8Value::Pointer_t pValue = createValue(get_ffdata());
[ # # ][ # # ]
36 [ # # ][ # # ]: 0 : rHandler.attribute(NS_rtf::LN_ffdata, *pValue);
37 : : }
38 : : else
39 : : {
40 [ # # ][ # # ]: 0 : WW8Value::Pointer_t pValue = createValue(get_DffRecord());
[ # # ][ # # ]
41 [ # # ][ # # ]: 0 : rHandler.attribute(NS_rtf::LN_DffRecord, *pValue);
42 [ # # ]: 0 : }
43 [ # # ]: 0 : }
44 : 0 : }
45 : :
46 : : writerfilter::Reference<Properties>::Pointer_t
47 : 0 : WW8PICF::get_DffRecord()
48 : : {
49 : : writerfilter::Reference<Properties>::Pointer_t
50 [ # # ][ # # ]: 0 : pRet(new DffBlock(this, get_cbHeader(), getCount() - get_cbHeader(),
51 [ # # ][ # # ]: 0 : 0));
[ # # ]
52 : 0 : return pRet;
53 : : }
54 : :
55 : : writerfilter::Reference<Properties>::Pointer_t
56 : 0 : WW8PICF::get_ffdata()
57 : : {
58 : : writerfilter::Reference<Properties>::Pointer_t
59 [ # # ][ # # ]: 0 : pRet(new WW8FFDATA(this, get_cbHeader(), getCount() - get_cbHeader()));
[ # # ][ # # ]
[ # # ][ # # ]
60 : :
61 : : WW8StructBase::Pointer_t pStruct
62 [ # # ]: 0 : (new WW8StructBase(this, get_cbHeader(),
63 [ # # ][ # # ]: 0 : getCount() - get_cbHeader()));
[ # # ][ # # ]
[ # # ]
64 : :
65 [ # # ]: 0 : pStruct->dump(output);
66 : :
67 [ # # ]: 0 : return pRet;
68 : : }
69 : :
70 : : writerfilter::Reference<Properties>::Pointer_t
71 : 0 : WW8FSPA::get_shape()
72 : : {
73 : 0 : return getDocument()->getShape(get_spid());
74 : : }
75 : :
76 : 0 : void WW8FFDATA::resolveNoAuto(Properties & rHandler)
77 : : {
78 : 0 : WW8DocumentImpl * pDocument = getDocument();
79 : :
80 [ # # ]: 0 : if (pDocument != NULL)
81 : : {
82 [ # # ]: 0 : WW8FLD::Pointer_t pFLD = pDocument->getCurrentFLD();
83 [ # # ][ # # ]: 0 : WW8Value::Pointer_t pValue = createValue(pFLD->get_flt());
[ # # ]
84 : :
85 [ # # ][ # # ]: 0 : rHandler.attribute(NS_rtf::LN_FLT, *pValue);
[ # # ]
86 : :
87 : : }
88 : 0 : }
89 : :
90 : 0 : sal_uInt32 WW8FFDATA::get_FLT()
91 : : {
92 : 0 : sal_uInt32 nResult = 0;
93 : :
94 : 0 : WW8DocumentImpl * pDocument = getDocument();
95 : :
96 [ # # ]: 0 : if (pDocument != NULL)
97 : : {
98 [ # # ]: 0 : WW8FLD::Pointer_t pFLD = pDocument->getCurrentFLD();
99 : :
100 [ # # ]: 0 : if (pFLD.get() != NULL)
101 [ # # ][ # # ]: 0 : nResult = pFLD->get_flt();
102 : : }
103 : :
104 : 0 : return nResult;
105 : : }
106 : :
107 : 0 : static sal_uInt32 lcl_FFDATA_default_offset(WW8FFDATA & rRef)
108 : : {
109 : 0 : return 0xa + (rRef.getU16(0xa) + 2) * 2;
110 : : }
111 : :
112 : 0 : static sal_uInt32 lcl_FFDATA_formatting_offset(WW8FFDATA & rRef)
113 : : {
114 : 0 : sal_uInt32 nResult = lcl_FFDATA_default_offset(rRef);
115 : :
116 [ # # ]: 0 : switch (rRef.get_FLT())
117 : : {
118 : : case 71: // forms checkbox
119 : : case 83: // forms listbox
120 : 0 : nResult += 2;
121 : 0 : break;
122 : : default:
123 : 0 : nResult += (rRef.getU16(nResult) + 2) * 2;
124 : 0 : break;
125 : : }
126 : :
127 : 0 : return nResult;
128 : : }
129 : :
130 : 0 : static sal_uInt32 lcl_FFDATA_help_offset(WW8FFDATA & rRef)
131 : : {
132 : 0 : sal_uInt32 nResult = lcl_FFDATA_formatting_offset(rRef);
133 : :
134 : 0 : nResult += (rRef.getU16(nResult) + 2) * 2;
135 : :
136 : 0 : return nResult;
137 : : }
138 : :
139 : 0 : static sal_uInt32 lcl_FFDATA_tooltip_offset(WW8FFDATA & rRef)
140 : : {
141 : 0 : sal_uInt32 nResult = lcl_FFDATA_help_offset(rRef);
142 : :
143 : 0 : nResult += (rRef.getU16(nResult) + 2) * 2;
144 : :
145 : 0 : return nResult;
146 : : }
147 : :
148 : 0 : OUString WW8FFDATA::get_default()
149 : : {
150 : 0 : OUString sResult;
151 : :
152 [ # # ]: 0 : sal_uInt32 nOffset = lcl_FFDATA_default_offset(*this);
153 [ # # ][ # # ]: 0 : switch (get_FLT())
154 : : {
155 : : case 70:
156 [ # # ]: 0 : sResult = getString(nOffset);
157 : :
158 : 0 : break;
159 : : default:
160 : 0 : break;
161 : : }
162 : :
163 : 0 : return sResult;
164 : : }
165 : :
166 : 0 : OUString WW8FFDATA::get_formatting()
167 : : {
168 : 0 : return getString(lcl_FFDATA_formatting_offset(*this));
169 : : }
170 : :
171 : 0 : OUString WW8FFDATA::get_help()
172 : : {
173 : 0 : return getString(lcl_FFDATA_help_offset(*this));
174 : : }
175 : :
176 : 0 : OUString WW8FFDATA::get_tooltip()
177 : : {
178 : 0 : OUString sResult;
179 : :
180 [ # # ][ # # ]: 0 : sResult = getString(lcl_FFDATA_tooltip_offset(*this));
181 : :
182 : 0 : return sResult;
183 : : }
184 : :
185 : 0 : sal_uInt16 WW8FFDATA::get_checked()
186 : : {
187 : 0 : sal_uInt16 nResult = 0;
188 : :
189 [ # # ]: 0 : switch (get_FLT())
190 : : {
191 : : case 71:
192 : 0 : nResult = getU16(lcl_FFDATA_default_offset(*this));
193 : 0 : break;
194 : : default:
195 : 0 : break;
196 : : }
197 : :
198 : 0 : return nResult;
199 : : }
200 [ + - ][ + - ]: 60 : }}
201 : :
202 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|