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