LibreOffice Module writerfilter (master) 1
resourcemodel.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 <string>
23#include <sal/types.h>
24#include <com/sun/star/drawing/XShape.hpp>
25#include <com/sun/star/uno/Any.hxx>
26#include <tools/ref.hxx>
27
53typedef sal_uInt32 Id;
54
55namespace writerfilter
56{
57struct CommentProperties;
58
79template <class T> class SAL_DLLPUBLIC_TEMPLATE Reference : public virtual SvRefBase
80{
81public:
89
98 virtual void resolve(T& rHandler) = 0;
99
100 Reference() = default;
101 Reference(Reference const&) = default;
102 Reference(Reference&&) = default;
103 Reference& operator=(Reference const&) = default;
105
106protected:
107 ~Reference() override {}
108};
109
110class Value;
111class Sprm;
112
116class Properties : public virtual SvRefBase
117{
118public:
125 virtual void attribute(Id name, Value& val) = 0;
126
132 virtual void sprm(Sprm& sprm) = 0;
133
134protected:
135 ~Properties() override {}
136};
137
141class Table : public virtual SvRefBase
142{
143public:
145
153
154protected:
155 ~Table() override {}
156};
157
162{
163public:
170 virtual void data(const sal_uInt8* buf, size_t len) = 0;
171
172protected:
174};
175
178const sal_uInt8 cFieldSep = 0x14;
179const sal_uInt8 cFieldEnd = 0x15;
180
181namespace ooxml
182{
183class OOXMLDocument;
184}
185
189class Stream : public virtual SvRefBase
190{
191public:
196
200 virtual void startSectionGroup() = 0;
201
205 virtual void endSectionGroup() = 0;
206
208 virtual void markLastSectionGroup(){};
209
211
215 virtual void startParagraphGroup() = 0;
216
220 virtual void endParagraphGroup() = 0;
221
223
227 virtual void startCharacterGroup() = 0;
228
232 virtual void endCharacterGroup() = 0;
233
237 virtual void startShape(css::uno::Reference<css::drawing::XShape> const& xShape) = 0;
238
239 virtual void endShape() = 0;
240
244 virtual void startTextBoxContent() = 0;
245
246 virtual void endTextBoxContent() = 0;
247
254 virtual void text(const sal_uInt8* data, size_t len) = 0;
255
262 virtual void utext(const sal_uInt8* data, size_t len) = 0;
263
269 virtual void positionOffset(const OUString& rText, bool bVertical) = 0;
271 virtual css::awt::Point getPositionOffset() = 0;
277 virtual void align(const OUString& rText, bool bVertical) = 0;
278 virtual void positivePercentage(const OUString& rText) = 0;
279
286
294
302
308 virtual void info(const std::string& info) = 0;
309
311 virtual void startGlossaryEntry() = 0;
312
314 virtual void endGlossaryEntry() = 0;
315
317 virtual void checkId(const sal_Int32 nId) = 0;
318
319 virtual void commentProps(const OUString& /*sId*/, const CommentProperties& /*rProps*/) {}
320
321protected:
322 ~Stream() override {}
323};
324
332class Value : public virtual SvRefBase
333{
334public:
339
343 virtual int getInt() const = 0;
344
348 virtual OUString getString() const = 0;
349
353 virtual css::uno::Any getAny() const = 0;
354
359
364
368#ifdef DBG_UTIL
369 virtual std::string toString() const = 0;
370#endif
371};
372
377class Sprm : public virtual SvRefBase
378{
379public:
381
385 virtual sal_uInt32 getId() const = 0;
386
391
397
401#ifdef DBG_UTIL
402 virtual std::string getName() const = 0;
403#endif
404
408#ifdef DBG_UTIL
409 virtual std::string toString() const = 0;
410#endif
411
412protected:
413 ~Sprm() override {}
414};
415
416typedef sal_Int32 Token_t;
417}
418
419/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Handler for binary objects.
virtual void data(const sal_uInt8 *buf, size_t len)=0
Receives binary data of the object.
Handler for properties.
virtual void attribute(Id name, Value &val)=0
Receives an attribute.
virtual void sprm(Sprm &sprm)=0
Receives a SPRM.
Reference to a resource that generates events and sends them to a handler.
tools::SvRef< Reference< T > > Pointer_t
Pointer to reference.
Reference & operator=(Reference const &)=default
Reference(Reference &&)=default
virtual void resolve(T &rHandler)=0
Resolves the reference.
Reference & operator=(Reference &&)=default
Reference(Reference const &)=default
An SPRM: Section, Paragraph and Run Modifier.
tools::SvRef< Sprm > Pointer_t
virtual sal_uInt32 getId() const =0
Returns id of the SPRM.
virtual writerfilter::Reference< Properties >::Pointer_t getProps()=0
Returns reference to properties contained in the SPRM.
virtual Value::Pointer_t getValue()=0
Returns value of the SPRM.
virtual std::string getName() const =0
Returns name of sprm.
virtual std::string toString() const =0
Returns string representation of sprm.
Handler for a stream.
virtual void checkId(const sal_Int32 nId)=0
Receives identifier for node entry.
virtual void endGlossaryEntry()=0
Receives end mark for glossary document entry.
virtual void endParagraphGroup()=0
Receives end mark for group with the same paragraph properties.
virtual void endCharacterGroup()=0
Receives end mark for group with the same character properties.
virtual void props(writerfilter::Reference< Properties >::Pointer_t ref)=0
Receives properties of the current run of text.
virtual void setDocumentReference(writerfilter::ooxml::OOXMLDocument *pDocument)=0
virtual void markLastSectionGroup()
The current section is the last one in this body text.
virtual void startGlossaryEntry()=0
Receives start mark for glossary document entry.
virtual void startSectionGroup()=0
Receives start mark for group with the same section properties.
virtual void endTextBoxContent()=0
virtual void endSectionGroup()=0
Receives end mark for group with the same section properties.
virtual void align(const OUString &rText, bool bVertical)=0
Horizontal and vertical alignment for a shape.
virtual void info(const std::string &info)=0
Debugging: Receives information about current point in stream.
virtual void startParagraphGroup()=0
Receives start mark for group with the same paragraph properties.
virtual void text(const sal_uInt8 *data, size_t len)=0
Receives 8-bit per character text.
tools::SvRef< Stream > Pointer_t
Pointer to this stream.
virtual void startTextBoxContent()=0
Receives a text-box-content.
virtual void positivePercentage(const OUString &rText)=0
virtual void startShape(css::uno::Reference< css::drawing::XShape > const &xShape)=0
Receives a shape.
virtual void startCharacterGroup()=0
Receives start mark for group with the same character properties.
virtual css::awt::Point getPositionOffset()=0
Returns the last set offsets of a shape in HMM.
virtual void markLastParagraphInSection()
virtual void table(Id name, writerfilter::Reference< Table >::Pointer_t ref)=0
Receives table.
virtual void commentProps(const OUString &, const CommentProperties &)
virtual void substream(Id name, writerfilter::Reference< Stream >::Pointer_t ref)=0
Receives a substream.
virtual void positionOffset(const OUString &rText, bool bVertical)=0
Offset in EMUs for a shape.
virtual void utext(const sal_uInt8 *data, size_t len)=0
Receives 16-bit per character text.
virtual void endShape()=0
Handler for tables.
tools::SvRef< Table > Pointer_t
virtual void entry(int pos, writerfilter::Reference< Properties >::Pointer_t ref)=0
Receives an entry of the table.
virtual writerfilter::Reference< Properties >::Pointer_t getProperties()=0
Returns properties of this value.
virtual std::string toString() const =0
Returns string representation of this value.
virtual writerfilter::Reference< BinaryObj >::Pointer_t getBinary()=0
Returns binary object of this value.
virtual int getInt() const =0
Returns integer representation of the value.
virtual OUString getString() const =0
Returns string representation of the value.
virtual css::uno::Any getAny() const =0
Returns representation of the value as uno::Any.
tools::SvRef< Value > Pointer_t
Pointer to a value.
Value
sal_Int32 Token_t
const sal_uInt8 cFieldSep
const sal_uInt8 cFieldStart
const sal_uInt8 cFieldEnd
const sal_uInt8 cFieldLock
sal_uInt32 Id
A container for the extended comment properties linked to the last paragraph of a comment.
unsigned char sal_uInt8