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_WRITERFILTER_SOURCE_DMAPPER_LOGGEDRESOURCES_HXX
21 : #define INCLUDED_WRITERFILTER_SOURCE_DMAPPER_LOGGEDRESOURCES_HXX
22 :
23 : #include <dmapper/resourcemodel.hxx>
24 : #include "TagLogger.hxx"
25 :
26 :
27 : namespace writerfilter
28 : {
29 :
30 : #ifdef DEBUG_WRITERFILTER
31 : class LoggedResourcesHelper
32 : {
33 : public:
34 : explicit LoggedResourcesHelper(const std::string & sPrefix);
35 : virtual ~LoggedResourcesHelper();
36 :
37 : void startElement(const std::string & sElement);
38 : static void endElement(const std::string & sElement);
39 : static void chars(const OUString & rChars);
40 : static void chars(const std::string & rChars);
41 : static void attribute(const std::string & rName, const std::string & rValue);
42 : static void attribute(const std::string & rName, sal_uInt32 nValue);
43 :
44 : private:
45 : std::string msPrefix;
46 : };
47 : #endif
48 :
49 : class LoggedStream : public Stream
50 : {
51 : public:
52 : explicit LoggedStream(const std::string & sPrefix);
53 : virtual ~LoggedStream();
54 :
55 : void startSectionGroup() SAL_OVERRIDE;
56 : void endSectionGroup() SAL_OVERRIDE;
57 : void startParagraphGroup() SAL_OVERRIDE;
58 : void endParagraphGroup() SAL_OVERRIDE;
59 : void startCharacterGroup() SAL_OVERRIDE;
60 : void endCharacterGroup() SAL_OVERRIDE;
61 : void startShape(css::uno::Reference<css::drawing::XShape> const& xShape) SAL_OVERRIDE;
62 : void endShape() SAL_OVERRIDE;
63 : void text(const sal_uInt8 * data, size_t len) SAL_OVERRIDE;
64 : void utext(const sal_uInt8 * data, size_t len) SAL_OVERRIDE;
65 : void positionOffset(const OUString& rText, bool bVertical) SAL_OVERRIDE;
66 : void align(const OUString& rText, bool bVertical) 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 std::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(css::uno::Reference<css::drawing::XShape> const& 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_positionOffset(const OUString& /*rText*/, bool /*bVertical*/) { }
85 0 : virtual css::awt::Point getPositionOffset() SAL_OVERRIDE { return css::awt::Point(); }
86 0 : virtual void lcl_align(const OUString& /*rText*/, bool /*bVertical*/) { }
87 0 : virtual void lcl_positivePercentage(const OUString& /*rText*/) { }
88 : virtual void lcl_props(writerfilter::Reference<Properties>::Pointer_t ref) = 0;
89 : virtual void lcl_table(Id name, writerfilter::Reference<Table>::Pointer_t ref) = 0;
90 : virtual void lcl_substream(Id name, writerfilter::Reference<Stream>::Pointer_t ref) = 0;
91 : virtual void lcl_info(const std::string & info) = 0;
92 :
93 : #ifdef DEBUG_WRITERFILTER
94 : LoggedResourcesHelper mHelper;
95 : #endif
96 : };
97 :
98 : class LoggedProperties : public Properties
99 : {
100 : public:
101 : explicit LoggedProperties(const std::string & sPrefix);
102 : virtual ~LoggedProperties();
103 :
104 : void attribute(Id name, Value & val) SAL_OVERRIDE;
105 : void sprm(Sprm & sprm) SAL_OVERRIDE;
106 :
107 : protected:
108 : virtual void lcl_attribute(Id name, Value & val) = 0;
109 : virtual void lcl_sprm(Sprm & sprm) = 0;
110 :
111 : #ifdef DEBUG_WRITERFILTER
112 : LoggedResourcesHelper mHelper;
113 : #endif
114 : };
115 :
116 : class LoggedTable : public Table
117 : {
118 : public:
119 : explicit LoggedTable(const std::string & sPrefix);
120 : virtual ~LoggedTable();
121 :
122 : void entry(int pos, writerfilter::Reference<Properties>::Pointer_t ref) SAL_OVERRIDE;
123 :
124 : protected:
125 : virtual void lcl_entry(int pos, writerfilter::Reference<Properties>::Pointer_t ref) = 0;
126 :
127 : #ifdef DEBUG_WRITERFILTER
128 : LoggedResourcesHelper mHelper;
129 : #endif
130 : };
131 :
132 : }
133 : #endif // INCLUDED_WRITERFILTER_SOURCE_DMAPPER_LOGGEDRESOURCES_HXX
134 :
135 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|