ACF $AcfVersion:0$
CTextDocumentComp.h
Go to the documentation of this file.
1// SPDX-License-Identifier: LGPL-2.1-or-later OR GPL-2.0-or-later OR GPL-3.0-or-later OR LicenseRef-ACF-Commercial
2#pragma once
3
4
5// Qt includes
6#include <QtCore/QString>
7
8// ACF includes
10#include <idoc/ITextDocument.h>
11
12
13namespace idoc
14{
15
16
54{
55public:
57
58 I_BEGIN_COMPONENT(CTextDocumentComp);
59 I_REGISTER_INTERFACE(iser::ISerializable);
60 I_REGISTER_INTERFACE(ITextDocument);
61 I_ASSIGN(m_defaultTextAttrPtr, "DefaultText", "Default text", false, "Hallo World!");
62 I_END_COMPONENT;
63
64 // reimplemented (idoc::ITextDocument)
65 virtual QString GetText() const override;
66 virtual void SetText(const QString& text) override;
67
68 // reimplemented (iser::ISerializable)
69 virtual bool Serialize(iser::IArchive& archive) override;
70
71protected:
72 // reimplemented (icomp::CComponentBase)
73 virtual void OnComponentCreated() override;
74
75private:
76 QString m_text;
77
78 I_TEXTATTR(m_defaultTextAttrPtr);
79};
80
81
82} // namespace idoc
83
84
85
86
87
Base class for component implementation.
Simple implementation of a text document model.
virtual bool Serialize(iser::IArchive &archive) override
Load or store state of this object as a archive stream.
virtual QString GetText() const override
Get document text.
virtual void SetText(const QString &text) override
Set document text.
icomp::CComponentBase BaseClass
virtual void OnComponentCreated() override
Simple interface for a text document.
Represents an input/output persistence archive for object serialization.
Definition IArchive.h:164
Common class for all classes which objects can be archived or restored from archive.
#define I_TEXTATTR(member)
Declare translatable text attribute member.
Contains the system independent basic implementations of Document/View design pattern.