android: Update app-specific/MIME type icons
[LibreOffice.git] / writerfilter / source / dmapper / LoggedResources.cxx
blob819238bf671d0a6221987b50c633d065d0ce1b09
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include "LoggedResources.hxx"
21 #include "TagLogger.hxx"
22 #include <ooxml/QNameToString.hxx>
23 #include <utility>
25 using namespace ::com::sun::star;
27 namespace writerfilter
29 #ifdef DBG_UTIL
31 LoggedResourcesHelper::LoggedResourcesHelper(std::string sPrefix)
32 : msPrefix(std::move(sPrefix))
36 LoggedResourcesHelper::~LoggedResourcesHelper() {}
38 void LoggedResourcesHelper::startElement(const std::string& sElement)
40 TagLogger::getInstance().startElement(msPrefix + "." + sElement);
43 void LoggedResourcesHelper::endElement() { TagLogger::getInstance().endElement(); }
45 void LoggedResourcesHelper::chars(std::u16string_view rChars)
47 TagLogger::getInstance().chars(rChars);
50 void LoggedResourcesHelper::chars(const std::string& rChars)
52 TagLogger::getInstance().chars(rChars);
55 void LoggedResourcesHelper::attribute(const std::string& rName, const std::string& rValue)
57 TagLogger::getInstance().attribute(rName, rValue);
60 void LoggedResourcesHelper::attribute(const std::string& rName, sal_uInt32 nValue)
62 TagLogger::getInstance().attribute(rName, nValue);
65 #endif
67 LoggedStream::LoggedStream(
68 #ifdef DBG_UTIL
69 const std::string& sPrefix)
70 : mHelper(sPrefix)
71 #else
72 const std::string&)
73 #endif
77 LoggedStream::~LoggedStream() {}
79 void LoggedStream::startSectionGroup()
81 #ifdef DBG_UTIL
82 mHelper.startElement("section");
83 #endif
85 lcl_startSectionGroup();
88 void LoggedStream::endSectionGroup()
90 lcl_endSectionGroup();
92 #ifdef DBG_UTIL
93 LoggedResourcesHelper::endElement();
94 #endif
97 void LoggedStream::startParagraphGroup()
99 #ifdef DBG_UTIL
100 mHelper.startElement("paragraph");
101 #endif
103 lcl_startParagraphGroup();
106 void LoggedStream::endParagraphGroup()
108 lcl_endParagraphGroup();
110 #ifdef DBG_UTIL
111 LoggedResourcesHelper::endElement();
112 #endif
115 void LoggedStream::startCharacterGroup()
117 #ifdef DBG_UTIL
118 mHelper.startElement("charactergroup");
119 #endif
121 lcl_startCharacterGroup();
124 void LoggedStream::endCharacterGroup()
126 lcl_endCharacterGroup();
128 #ifdef DBG_UTIL
129 LoggedResourcesHelper::endElement();
130 #endif
133 void LoggedStream::startShape(uno::Reference<drawing::XShape> const& xShape)
135 #ifdef DBG_UTIL
136 mHelper.startElement("shape");
137 #endif
139 lcl_startShape(xShape);
142 void LoggedStream::endShape()
144 lcl_endShape();
146 #ifdef DBG_UTIL
147 LoggedResourcesHelper::endElement();
148 #endif
151 void LoggedStream::startTextBoxContent() { lcl_startTextBoxContent(); }
153 void LoggedStream::endTextBoxContent() { lcl_endTextBoxContent(); }
155 void LoggedStream::text(const sal_uInt8* data, size_t len)
157 #ifdef DBG_UTIL
158 mHelper.startElement("text");
160 OUString sText(reinterpret_cast<const char*>(data), len, RTL_TEXTENCODING_MS_1252);
162 mHelper.startElement("data");
163 LoggedResourcesHelper::chars(sText);
164 LoggedResourcesHelper::endElement();
165 #endif
167 lcl_text(data, len);
169 #ifdef DBG_UTIL
170 LoggedResourcesHelper::endElement();
171 #endif
174 void LoggedStream::utext(const sal_uInt8* data, size_t len)
176 #ifdef DBG_UTIL
177 mHelper.startElement("utext");
178 mHelper.startElement("data");
180 OUString sText(reinterpret_cast<const sal_Unicode*>(data), len);
182 LoggedResourcesHelper::chars(sText);
184 LoggedResourcesHelper::endElement();
185 #endif
187 lcl_utext(data, len);
189 #ifdef DBG_UTIL
190 LoggedResourcesHelper::endElement();
191 #endif
194 void LoggedStream::positionOffset(const OUString& rText, bool bVertical)
196 #ifdef DBG_UTIL
197 mHelper.startElement("positionOffset");
198 LoggedResourcesHelper::attribute("vertical", static_cast<int>(bVertical));
199 LoggedResourcesHelper::chars(rText);
200 #endif
202 lcl_positionOffset(rText, bVertical);
204 #ifdef DBG_UTIL
205 LoggedResourcesHelper::endElement();
206 #endif
209 void LoggedStream::align(const OUString& rText, bool bVertical)
211 #ifdef DBG_UTIL
212 mHelper.startElement("align");
213 LoggedResourcesHelper::attribute("vertical", static_cast<int>(bVertical));
214 LoggedResourcesHelper::chars(rText);
215 #endif
217 lcl_align(rText, bVertical);
219 #ifdef DBG_UTIL
220 LoggedResourcesHelper::endElement();
221 #endif
224 void LoggedStream::positivePercentage(const OUString& rText)
226 #ifdef DBG_UTIL
227 mHelper.startElement("positivePercentage");
228 LoggedResourcesHelper::chars(rText);
229 #endif
231 lcl_positivePercentage(rText);
233 #ifdef DBG_UTIL
234 LoggedResourcesHelper::endElement();
235 #endif
238 void LoggedStream::props(writerfilter::Reference<Properties>::Pointer_t ref)
240 #ifdef DBG_UTIL
241 mHelper.startElement("props");
242 #endif
244 lcl_props(ref);
246 #ifdef DBG_UTIL
247 LoggedResourcesHelper::endElement();
248 #endif
251 void LoggedStream::table(Id name, writerfilter::Reference<Table>::Pointer_t ref)
253 #ifdef DBG_UTIL
254 mHelper.startElement("table");
255 LoggedResourcesHelper::attribute("name", QNameToString(name));
256 #endif
258 lcl_table(name, ref);
260 #ifdef DBG_UTIL
261 LoggedResourcesHelper::endElement();
262 #endif
265 void LoggedStream::substream(Id name, writerfilter::Reference<Stream>::Pointer_t ref)
267 #ifdef DBG_UTIL
268 mHelper.startElement("substream");
269 LoggedResourcesHelper::attribute("name", QNameToString(name));
270 #endif
272 lcl_substream(name, ref);
274 #ifdef DBG_UTIL
275 LoggedResourcesHelper::endElement();
276 #endif
279 void LoggedStream::info(const std::string& _info)
281 #ifdef DBG_UTIL
282 mHelper.startElement("info");
283 LoggedResourcesHelper::attribute("text", _info);
284 #else
285 (void)_info;
286 #endif
288 #ifdef DBG_UTIL
289 LoggedResourcesHelper::endElement();
290 #endif
293 void LoggedStream::startGlossaryEntry()
295 #ifdef DBG_UTIL
296 mHelper.startElement("startGlossaryEntry");
297 #endif
299 lcl_startGlossaryEntry();
301 #ifdef DBG_UTIL
302 LoggedResourcesHelper::endElement();
303 #endif
306 void LoggedStream::endGlossaryEntry()
308 #ifdef DBG_UTIL
309 mHelper.startElement("endGlossaryEntry");
310 #endif
312 lcl_endGlossaryEntry();
314 #ifdef DBG_UTIL
315 LoggedResourcesHelper::endElement();
316 #endif
319 void LoggedStream::checkId(const sal_Int32 nId)
321 #ifdef DBG_UTIL
322 mHelper.startElement("checkId");
323 LoggedResourcesHelper::chars(OUString::number(nId));
324 #endif
326 lcl_checkId(nId);
328 #ifdef DBG_UTIL
329 LoggedResourcesHelper::endElement();
330 #endif
333 LoggedProperties::LoggedProperties(
334 #ifdef DBG_UTIL
335 const std::string& sPrefix)
336 : mHelper(sPrefix)
337 #else
338 const std::string&)
339 #endif
343 LoggedProperties::~LoggedProperties() {}
345 void LoggedProperties::attribute(Id name, Value& val)
347 #ifdef DBG_UTIL
348 mHelper.startElement("attribute");
349 LoggedResourcesHelper::attribute("name", QNameToString(name));
350 LoggedResourcesHelper::attribute("value", val.toString());
351 LoggedResourcesHelper::endElement();
352 #endif
354 lcl_attribute(name, val);
357 void LoggedProperties::sprm(Sprm& rSprm)
359 #ifdef DBG_UTIL
360 mHelper.startElement("sprm");
361 LoggedResourcesHelper::attribute("name", QNameToString(rSprm.getId()));
362 LoggedResourcesHelper::chars(rSprm.toString());
363 #endif
365 lcl_sprm(rSprm);
367 #ifdef DBG_UTIL
368 LoggedResourcesHelper::endElement();
369 #endif
372 LoggedTable::LoggedTable(
373 #ifdef DBG_UTIL
374 const std::string& sPrefix)
375 : mHelper(sPrefix)
376 #else
377 const std::string&)
378 #endif
382 LoggedTable::~LoggedTable() {}
384 void LoggedTable::entry(int pos, writerfilter::Reference<Properties>::Pointer_t ref)
386 #ifdef DBG_UTIL
387 mHelper.startElement("entry");
388 LoggedResourcesHelper::attribute("pos", pos);
389 #else
390 (void)pos;
391 #endif
393 lcl_entry(ref);
395 #ifdef DBG_UTIL
396 LoggedResourcesHelper::endElement();
397 #endif
401 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */