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 : #ifndef INCLUDED_LOGGED_RESOURCES_HXX
21 : #define INCLUDED_LOGGED_RESOURCES_HXX
22 :
23 : #include "WW8ResourceModel.hxx"
24 : #include "TagLogger.hxx"
25 :
26 : #include <WriterFilterDllApi.hxx>
27 :
28 : namespace writerfilter
29 : {
30 :
31 : #ifdef DEBUG_LOGGING
32 : class LoggedResourcesHelper
33 : {
34 : public:
35 : explicit LoggedResourcesHelper(TagLogger::Pointer_t pLogger, const string & sPrefix);
36 : virtual ~LoggedResourcesHelper();
37 :
38 : void startElement(const string & sElement);
39 : void endElement(const string & sElement);
40 : void chars(const OUString & rChars);
41 : void chars(const string & rChars);
42 : void attribute(const string & rName, const string & rValue);
43 : void attribute(const string & rName, sal_uInt32 nValue);
44 :
45 : private:
46 : TagLogger::Pointer_t mpLogger;
47 : string msPrefix;
48 : };
49 : #endif
50 :
51 : class LoggedStream : public Stream
52 : {
53 : public:
54 : explicit LoggedStream(TagLogger::Pointer_t pLogger, const string & sPrefix);
55 : virtual ~LoggedStream();
56 :
57 : void startSectionGroup() SAL_OVERRIDE;
58 : void endSectionGroup() SAL_OVERRIDE;
59 : void startParagraphGroup() SAL_OVERRIDE;
60 : void endParagraphGroup() SAL_OVERRIDE;
61 : void startCharacterGroup() SAL_OVERRIDE;
62 : void endCharacterGroup() SAL_OVERRIDE;
63 : void startShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape ) SAL_OVERRIDE;
64 : void endShape() SAL_OVERRIDE;
65 : void text(const sal_uInt8 * data, size_t len) SAL_OVERRIDE;
66 : void utext(const sal_uInt8 * data, size_t len) SAL_OVERRIDE;
67 : void positivePercentage(const OUString& rText) SAL_OVERRIDE;
68 : void props(writerfilter::Reference<Properties>::Pointer_t ref) SAL_OVERRIDE;
69 : void table(Id name, writerfilter::Reference<Table>::Pointer_t ref) SAL_OVERRIDE;
70 : void substream(Id name, writerfilter::Reference<Stream>::Pointer_t ref) SAL_OVERRIDE;
71 : void info(const string & info) SAL_OVERRIDE;
72 :
73 : protected:
74 : virtual void lcl_startSectionGroup() = 0;
75 : virtual void lcl_endSectionGroup() = 0;
76 : virtual void lcl_startParagraphGroup() = 0;
77 : virtual void lcl_endParagraphGroup() = 0;
78 : virtual void lcl_startCharacterGroup() = 0;
79 : virtual void lcl_endCharacterGroup() = 0;
80 : virtual void lcl_startShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape ) = 0;
81 : virtual void lcl_endShape() = 0;
82 : virtual void lcl_text(const sal_uInt8 * data, size_t len) = 0;
83 : virtual void lcl_utext(const sal_uInt8 * data, size_t len) = 0;
84 0 : virtual void lcl_positivePercentage(const OUString& /*rText*/) { }
85 : virtual void lcl_props(writerfilter::Reference<Properties>::Pointer_t ref) = 0;
86 : virtual void lcl_table(Id name, writerfilter::Reference<Table>::Pointer_t ref) = 0;
87 : virtual void lcl_substream(Id name, writerfilter::Reference<Stream>::Pointer_t ref) = 0;
88 : virtual void lcl_info(const string & info) = 0;
89 :
90 : #ifdef DEBUG_LOGGING
91 : LoggedResourcesHelper mHelper;
92 : #endif
93 : };
94 :
95 : class LoggedProperties : public Properties
96 : {
97 : public:
98 : explicit LoggedProperties(TagLogger::Pointer_t pLogger, const string & sPrefix);
99 : virtual ~LoggedProperties();
100 :
101 : void attribute(Id name, Value & val) SAL_OVERRIDE;
102 : void sprm(Sprm & sprm) SAL_OVERRIDE;
103 :
104 : protected:
105 : virtual void lcl_attribute(Id name, Value & val) = 0;
106 : virtual void lcl_sprm(Sprm & sprm) = 0;
107 :
108 : #ifdef DEBUG_LOGGING
109 : LoggedResourcesHelper mHelper;
110 : #endif
111 : };
112 :
113 : class LoggedTable : public Table
114 : {
115 : public:
116 : explicit LoggedTable(TagLogger::Pointer_t pLogger, const string & sPrefix);
117 : virtual ~LoggedTable();
118 :
119 : void entry(int pos, writerfilter::Reference<Properties>::Pointer_t ref) SAL_OVERRIDE;
120 :
121 : protected:
122 : virtual void lcl_entry(int pos, writerfilter::Reference<Properties>::Pointer_t ref) = 0;
123 :
124 : #ifdef DEBUG_LOGGING
125 : LoggedResourcesHelper mHelper;
126 : #endif
127 : };
128 :
129 : }
130 : #endif // INCLUDED_LOGGED_RESOURCES_HXX
131 :
132 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|