1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
22 #include <sal/config.h>
24 #include <string_view>
26 #include <dmapper/resourcemodel.hxx>
28 namespace writerfilter
31 class LoggedResourcesHelper final
34 explicit LoggedResourcesHelper(std::string sPrefix
);
35 ~LoggedResourcesHelper();
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
);
49 class LoggedStream
: public Stream
52 explicit LoggedStream(const std::string
& sPrefix
);
53 virtual ~LoggedStream() override
;
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
;
70 void props(writerfilter::Reference
<Properties
>::Pointer_t ref
) override
;
71 void table(Id name
, writerfilter::Reference
<Table
>::Pointer_t ref
) override
;
72 void substream(Id name
, writerfilter::Reference
<Stream
>::Pointer_t ref
) 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
;
78 virtual void setDocumentReference(writerfilter::ooxml::OOXMLDocument
* /*pDocument*/) override
{};
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*/) {}
97 virtual void lcl_props(writerfilter::Reference
<Properties
>::Pointer_t ref
) = 0;
98 virtual void lcl_table(Id name
, writerfilter::Reference
<Table
>::Pointer_t ref
) = 0;
99 virtual void lcl_substream(Id name
, writerfilter::Reference
<Stream
>::Pointer_t ref
) = 0;
100 virtual void lcl_startGlossaryEntry() {}
101 virtual void lcl_endGlossaryEntry() {}
102 virtual void lcl_checkId(const sal_Int32
) {}
105 LoggedResourcesHelper mHelper
;
109 class LoggedProperties
: public Properties
112 explicit LoggedProperties(const std::string
& sPrefix
);
113 virtual ~LoggedProperties() override
;
115 void attribute(Id name
, Value
& val
) override
;
116 void sprm(Sprm
& sprm
) override
;
119 virtual void lcl_attribute(Id name
, Value
& val
) = 0;
120 virtual void lcl_sprm(Sprm
& sprm
) = 0;
123 LoggedResourcesHelper mHelper
;
127 class LoggedTable
: public Table
130 explicit LoggedTable(const std::string
& sPrefix
);
131 virtual ~LoggedTable() override
;
133 void entry(int pos
, writerfilter::Reference
<Properties
>::Pointer_t ref
) override
;
136 virtual void lcl_entry(writerfilter::Reference
<Properties
>::Pointer_t ref
) = 0;
139 LoggedResourcesHelper mHelper
;
144 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */