lok: vcl: fix multiple floatwin removal case more robustly.
[LibreOffice.git] / writerfilter / source / dmapper / LoggedResources.cxx
blobc58c8e37411c3838328efe3cd905332dedeca5d6
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 <rtl/ustrbuf.hxx>
21 #include "LoggedResources.hxx"
22 #include <ooxml/QNameToString.hxx>
24 using namespace ::com::sun::star;
26 namespace writerfilter
29 #ifdef DEBUG_WRITERFILTER
30 // class: LoggedResourcesHelper
32 LoggedResourcesHelper::LoggedResourcesHelper(const std::string & sPrefix)
33 : msPrefix(sPrefix)
37 LoggedResourcesHelper::~LoggedResourcesHelper()
41 void LoggedResourcesHelper::startElement(const std::string & sElement)
43 TagLogger::getInstance().startElement(msPrefix + "." + sElement);
46 void LoggedResourcesHelper::endElement()
48 TagLogger::getInstance().endElement();
51 void LoggedResourcesHelper::chars(const OUString & rChars)
53 TagLogger::getInstance().chars(rChars);
56 void LoggedResourcesHelper::chars(const std::string & rChars)
58 TagLogger::getInstance().chars(rChars);
61 void LoggedResourcesHelper::attribute(const std::string & rName, const std::string & rValue)
63 TagLogger::getInstance().attribute(rName, rValue);
66 void LoggedResourcesHelper::attribute(const std::string & rName, sal_uInt32 nValue)
68 TagLogger::getInstance().attribute(rName, nValue);
71 #endif
73 // class: LoggedStream
75 LoggedStream::LoggedStream(
76 #ifdef DEBUG_WRITERFILTER
77 const std::string & sPrefix
78 ) : mHelper(sPrefix)
79 #else
80 const std::string&
82 #endif
86 LoggedStream::~LoggedStream()
90 void LoggedStream::startSectionGroup()
92 #ifdef DEBUG_WRITERFILTER
93 mHelper.startElement("section");
94 #endif
96 lcl_startSectionGroup();
99 void LoggedStream::endSectionGroup()
101 lcl_endSectionGroup();
103 #ifdef DEBUG_WRITERFILTER
104 LoggedResourcesHelper::endElement();
105 #endif
108 void LoggedStream::startParagraphGroup()
110 #ifdef DEBUG_WRITERFILTER
111 mHelper.startElement("paragraph");
112 #endif
114 lcl_startParagraphGroup();
117 void LoggedStream::endParagraphGroup()
119 lcl_endParagraphGroup();
121 #ifdef DEBUG_WRITERFILTER
122 LoggedResourcesHelper::endElement();
123 #endif
127 void LoggedStream::startCharacterGroup()
129 #ifdef DEBUG_WRITERFILTER
130 mHelper.startElement("charactergroup");
131 #endif
133 lcl_startCharacterGroup();
136 void LoggedStream::endCharacterGroup()
138 lcl_endCharacterGroup();
140 #ifdef DEBUG_WRITERFILTER
141 LoggedResourcesHelper::endElement();
142 #endif
145 void LoggedStream::startShape(uno::Reference<drawing::XShape> const& xShape)
147 #ifdef DEBUG_WRITERFILTER
148 mHelper.startElement("shape");
149 #endif
151 lcl_startShape(xShape);
154 void LoggedStream::endShape()
156 lcl_endShape();
158 #ifdef DEBUG_WRITERFILTER
159 LoggedResourcesHelper::endElement();
160 #endif
163 void LoggedStream::text(const sal_uInt8 * data, size_t len)
165 #ifdef DEBUG_WRITERFILTER
166 mHelper.startElement("text");
168 OUString sText( reinterpret_cast<const char*>(data), len, RTL_TEXTENCODING_MS_1252 );
170 mHelper.startElement("data");
171 LoggedResourcesHelper::chars(sText);
172 LoggedResourcesHelper::endElement();
173 #endif
175 lcl_text(data, len);
177 #ifdef DEBUG_WRITERFILTER
178 LoggedResourcesHelper::endElement();
179 #endif
182 void LoggedStream::utext(const sal_uInt8 * data, size_t len)
184 #ifdef DEBUG_WRITERFILTER
185 mHelper.startElement("utext");
186 mHelper.startElement("data");
188 OUString sText;
189 OUStringBuffer aBuffer = OUStringBuffer(sal::static_int_cast<int>(len));
190 aBuffer.append( reinterpret_cast<const sal_Unicode *>(data), len);
191 sText = aBuffer.makeStringAndClear();
193 LoggedResourcesHelper::chars(sText);
195 LoggedResourcesHelper::endElement();
196 #endif
198 lcl_utext(data, len);
200 #ifdef DEBUG_WRITERFILTER
201 LoggedResourcesHelper::endElement();
202 #endif
205 void LoggedStream::positionOffset(const OUString& rText, bool bVertical)
207 #ifdef DEBUG_WRITERFILTER
208 mHelper.startElement("positionOffset");
209 LoggedResourcesHelper::attribute("vertical", static_cast<int>(bVertical));
210 LoggedResourcesHelper::chars(rText);
211 #endif
213 lcl_positionOffset(rText, bVertical);
215 #ifdef DEBUG_WRITERFILTER
216 LoggedResourcesHelper::endElement();
217 #endif
220 void LoggedStream::align(const OUString& rText, bool bVertical)
222 #ifdef DEBUG_WRITERFILTER
223 mHelper.startElement("align");
224 LoggedResourcesHelper::attribute("vertical", static_cast<int>(bVertical));
225 LoggedResourcesHelper::chars(rText);
226 #endif
228 lcl_align(rText, bVertical);
230 #ifdef DEBUG_WRITERFILTER
231 LoggedResourcesHelper::endElement();
232 #endif
235 void LoggedStream::positivePercentage(const OUString& rText)
237 #ifdef DEBUG_WRITERFILTER
238 mHelper.startElement("positivePercentage");
239 LoggedResourcesHelper::chars(rText);
240 #endif
242 lcl_positivePercentage(rText);
244 #ifdef DEBUG_WRITERFILTER
245 LoggedResourcesHelper::endElement();
246 #endif
249 void LoggedStream::props(writerfilter::Reference<Properties>::Pointer_t ref)
251 #ifdef DEBUG_WRITERFILTER
252 mHelper.startElement("props");
253 #endif
255 lcl_props(ref);
257 #ifdef DEBUG_WRITERFILTER
258 LoggedResourcesHelper::endElement();
259 #endif
262 void LoggedStream::table(Id name, writerfilter::Reference<Table>::Pointer_t ref)
264 #ifdef DEBUG_WRITERFILTER
265 mHelper.startElement("table");
266 LoggedResourcesHelper::attribute("name", (*QNameToString::Instance())(name));
267 #endif
269 lcl_table(name, ref);
271 #ifdef DEBUG_WRITERFILTER
272 LoggedResourcesHelper::endElement();
273 #endif
276 void LoggedStream::substream(Id name, writerfilter::Reference<Stream>::Pointer_t ref)
278 #ifdef DEBUG_WRITERFILTER
279 mHelper.startElement("substream");
280 LoggedResourcesHelper::attribute("name", (*QNameToString::Instance())(name));
281 #endif
283 lcl_substream(name, ref);
285 #ifdef DEBUG_WRITERFILTER
286 LoggedResourcesHelper::endElement();
287 #endif
290 void LoggedStream::info(const std::string & _info)
292 #ifdef DEBUG_WRITERFILTER
293 mHelper.startElement("info");
294 LoggedResourcesHelper::attribute("text", _info);
295 #endif
297 lcl_info(_info);
299 #ifdef DEBUG_WRITERFILTER
300 LoggedResourcesHelper::endElement();
301 #endif
304 void LoggedStream::startGlossaryEntry()
306 #ifdef DEBUG_WRITERFILTER
307 mHelper.startElement("startGlossaryEntry");
308 #endif
310 lcl_startGlossaryEntry();
312 #ifdef DEBUG_WRITERFILTER
313 LoggedResourcesHelper::endElement();
314 #endif
317 void LoggedStream::endGlossaryEntry()
319 #ifdef DEBUG_WRITERFILTER
320 mHelper.startElement("endGlossaryEntry");
321 #endif
323 lcl_endGlossaryEntry();
325 #ifdef DEBUG_WRITERFILTER
326 LoggedResourcesHelper::endElement();
327 #endif
330 // class LoggedProperties
331 LoggedProperties::LoggedProperties(
332 #ifdef DEBUG_WRITERFILTER
333 const std::string & sPrefix
334 ) : mHelper(sPrefix)
335 #else
336 const std::string&
338 #endif
342 LoggedProperties::~LoggedProperties()
346 void LoggedProperties::attribute(Id name, Value & val)
348 #ifdef DEBUG_WRITERFILTER
349 mHelper.startElement("attribute");
350 LoggedResourcesHelper::attribute("name", (*QNameToString::Instance())(name));
351 LoggedResourcesHelper::attribute("value", val.toString());
352 LoggedResourcesHelper::endElement();
353 #endif
355 lcl_attribute(name, val);
358 void LoggedProperties::sprm(Sprm & rSprm)
360 #ifdef DEBUG_WRITERFILTER
361 mHelper.startElement("sprm");
362 LoggedResourcesHelper::attribute("name", (*QNameToString::Instance())(rSprm.getId()));
363 LoggedResourcesHelper::chars(rSprm.toString());
364 #endif
366 lcl_sprm(rSprm);
368 #ifdef DEBUG_WRITERFILTER
369 LoggedResourcesHelper::endElement();
370 #endif
373 LoggedTable::LoggedTable(
374 #ifdef DEBUG_WRITERFILTER
375 const std::string & sPrefix
376 ) : mHelper(sPrefix)
377 #else
378 const std::string&
380 #endif
384 LoggedTable::~LoggedTable()
388 void LoggedTable::entry(int pos, writerfilter::Reference<Properties>::Pointer_t ref)
390 #ifdef DEBUG_WRITERFILTER
391 mHelper.startElement("entry");
392 LoggedResourcesHelper::attribute("pos", pos);
393 #endif
395 lcl_entry(pos, ref);
397 #ifdef DEBUG_WRITERFILTER
398 LoggedResourcesHelper::endElement();
399 #endif
404 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */