LibreOffice Module writerfilter (master) 1
LoggedResources.hxx
Go to the documentation of this file.
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#pragma once
21
22#include <sal/config.h>
23
24#include <string_view>
25
27
28namespace writerfilter
29{
30#ifdef DBG_UTIL
32{
33public:
34 explicit LoggedResourcesHelper(std::string sPrefix);
36
37 void startElement(const std::string& sElement);
38 static void endElement();
39 static void chars(std::u16string_view 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
44private:
45 std::string msPrefix;
46};
47#endif
48
49class LoggedStream : public Stream
50{
51public:
52 explicit LoggedStream(const std::string& sPrefix);
53 virtual ~LoggedStream() override;
54
55 void startSectionGroup() override;
56 void endSectionGroup() override;
57 void startParagraphGroup() override;
58 void endParagraphGroup() override;
59 void startCharacterGroup() override;
60 void endCharacterGroup() override;
61 void startShape(css::uno::Reference<css::drawing::XShape> const& xShape) override;
62 void endShape() override;
63 void startTextBoxContent() override;
64 void endTextBoxContent() override;
65 void text(const sal_uInt8* data, size_t len) override;
66 void utext(const sal_uInt8* data, size_t len) override;
67 void positionOffset(const OUString& rText, bool bVertical) override;
68 void align(const OUString& rText, bool bVertical) override;
69 void positivePercentage(const OUString& rText) override;
73 void info(const std::string& info) override;
74 void startGlossaryEntry() override;
75 void endGlossaryEntry() override;
76 void checkId(const sal_Int32 nId) override;
77
78 virtual void setDocumentReference(writerfilter::ooxml::OOXMLDocument* /*pDocument*/) override{};
79
80protected:
81 virtual void lcl_startSectionGroup() = 0;
82 virtual void lcl_endSectionGroup() = 0;
83 virtual void lcl_startParagraphGroup() = 0;
84 virtual void lcl_endParagraphGroup() = 0;
85 virtual void lcl_startCharacterGroup() = 0;
86 virtual void lcl_endCharacterGroup() = 0;
87 virtual void lcl_startShape(css::uno::Reference<css::drawing::XShape> const& xShape) = 0;
88 virtual void lcl_endShape() = 0;
89 virtual void lcl_startTextBoxContent() = 0;
90 virtual void lcl_endTextBoxContent() = 0;
91 virtual void lcl_text(const sal_uInt8* data, size_t len) = 0;
92 virtual void lcl_utext(const sal_uInt8* data, size_t len) = 0;
93 virtual void lcl_positionOffset(const OUString& /*rText*/, bool /*bVertical*/) {}
94 virtual css::awt::Point getPositionOffset() override { return css::awt::Point(); }
95 virtual void lcl_align(const OUString& /*rText*/, bool /*bVertical*/) {}
96 virtual void lcl_positivePercentage(const OUString& /*rText*/) {}
100 virtual void lcl_startGlossaryEntry() {}
101 virtual void lcl_endGlossaryEntry() {}
102 virtual void lcl_checkId(const sal_Int32) {}
103
104private:
105#ifdef DBG_UTIL
107#endif
108};
109
111{
112public:
113 explicit LoggedProperties(const std::string& sPrefix);
114 virtual ~LoggedProperties() override;
115
116 void attribute(Id name, Value& val) override;
117 void sprm(Sprm& sprm) override;
118
119protected:
120 virtual void lcl_attribute(Id name, Value& val) = 0;
121 virtual void lcl_sprm(Sprm& sprm) = 0;
122
123private:
124#ifdef DBG_UTIL
126#endif
127};
128
129class LoggedTable : public Table
130{
131public:
132 explicit LoggedTable(const std::string& sPrefix);
133 virtual ~LoggedTable() override;
134
136
137protected:
139
140private:
141#ifdef DBG_UTIL
143#endif
144};
145}
146
147/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void sprm(Sprm &sprm) override
Receives a SPRM.
virtual void lcl_attribute(Id name, Value &val)=0
virtual ~LoggedProperties() override
void attribute(Id name, Value &val) override
Receives an attribute.
LoggedProperties(const std::string &sPrefix)
virtual void lcl_sprm(Sprm &sprm)=0
static void chars(std::u16string_view rChars)
void startElement(const std::string &sElement)
static void attribute(const std::string &rName, const std::string &rValue)
LoggedResourcesHelper(std::string sPrefix)
virtual void lcl_startSectionGroup()=0
void startCharacterGroup() override
Receives start mark for group with the same character properties.
virtual void lcl_utext(const sal_uInt8 *data, size_t len)=0
virtual void lcl_text(const sal_uInt8 *data, size_t len)=0
virtual void lcl_startCharacterGroup()=0
void startGlossaryEntry() override
Receives start mark for glossary document entry.
virtual void lcl_props(writerfilter::Reference< Properties >::Pointer_t ref)=0
LoggedResourcesHelper mHelper
virtual void lcl_startShape(css::uno::Reference< css::drawing::XShape > const &xShape)=0
virtual void lcl_substream(Id name, writerfilter::Reference< Stream >::Pointer_t ref)=0
void endParagraphGroup() override
Receives end mark for group with the same paragraph properties.
virtual void lcl_startParagraphGroup()=0
virtual void lcl_startGlossaryEntry()
void props(writerfilter::Reference< Properties >::Pointer_t ref) override
Receives properties of the current run of text.
void table(Id name, writerfilter::Reference< Table >::Pointer_t ref) override
Receives table.
void endCharacterGroup() override
Receives end mark for group with the same character properties.
void substream(Id name, writerfilter::Reference< Stream >::Pointer_t ref) override
Receives a substream.
void align(const OUString &rText, bool bVertical) override
Horizontal and vertical alignment for a shape.
virtual void lcl_positionOffset(const OUString &, bool)
void startSectionGroup() override
Receives start mark for group with the same section properties.
virtual void lcl_startTextBoxContent()=0
LoggedStream(const std::string &sPrefix)
virtual void lcl_endSectionGroup()=0
virtual void setDocumentReference(writerfilter::ooxml::OOXMLDocument *) override
void text(const sal_uInt8 *data, size_t len) override
Receives 8-bit per character text.
virtual ~LoggedStream() override
void checkId(const sal_Int32 nId) override
Receives identifier for node entry.
virtual void lcl_endParagraphGroup()=0
void endSectionGroup() override
Receives end mark for group with the same section properties.
void utext(const sal_uInt8 *data, size_t len) override
Receives 16-bit per character text.
void positivePercentage(const OUString &rText) override
virtual void lcl_positivePercentage(const OUString &)
void info(const std::string &info) override
Debugging: Receives information about current point in stream.
virtual void lcl_align(const OUString &, bool)
virtual void lcl_endCharacterGroup()=0
virtual css::awt::Point getPositionOffset() override
Returns the last set offsets of a shape in HMM.
virtual void lcl_checkId(const sal_Int32)
void startTextBoxContent() override
Receives a text-box-content.
virtual void lcl_table(Id name, writerfilter::Reference< Table >::Pointer_t ref)=0
void positionOffset(const OUString &rText, bool bVertical) override
Offset in EMUs for a shape.
virtual void lcl_endTextBoxContent()=0
void startParagraphGroup() override
Receives start mark for group with the same paragraph properties.
void endGlossaryEntry() override
Receives end mark for glossary document entry.
virtual void lcl_endShape()=0
void startShape(css::uno::Reference< css::drawing::XShape > const &xShape) override
Receives a shape.
virtual void lcl_entry(writerfilter::Reference< Properties >::Pointer_t ref)=0
LoggedTable(const std::string &sPrefix)
LoggedResourcesHelper mHelper
void entry(int pos, writerfilter::Reference< Properties >::Pointer_t ref) override
Receives an entry of the table.
virtual ~LoggedTable() override
Handler for properties.
An SPRM: Section, Paragraph and Run Modifier.
Handler for a stream.
Handler for tables.
sal_Int16 nValue
OUString sPrefix
const char * name
sal_Int16 nId
The classes in this file define the interfaces for the resource model of the DocTokenizer:
sal_uInt32 Id
unsigned char sal_uInt8
size_t pos