QtNovelUI/libTextEdit/entitydata.cpp

41 lines
1.7 KiB
C++
Raw Normal View History

#include "entitydata.h"
using namespace PresentDatas;
SpecificEntityData::SpecificEntityData(EntityType type, const QString &uid) : type_store(type), document_id(uid) {}
void SpecificEntityData::resetContentLayout(MemberOri oritation, MemberType child_type) {
this->oritation_store = oritation;
this->layout_type = child_type;
}
void SpecificEntityData::setAnchorTo(AnchorTarget type, EntityData *tptr) {
anchor_info = std::make_tuple(type, tptr, std::get<2>(anchor_info), std::get<3>(anchor_info), std::get<4>(anchor_info));
}
void SpecificEntityData::setAnchorPos(AnchorPos point, offset_h hoffset, offset_v v_offset) {
anchor_info = std::make_tuple(std::get<0>(anchor_info), std::get<1>(anchor_info), point, hoffset, v_offset);
}
QString SpecificEntityData::uID() const { return document_id; }
EntityType SpecificEntityData::type() const { return type_store; }
MemberOri SpecificEntityData::oritation() const { return oritation_store; }
MemberType SpecificEntityData::displayType() const { return layout_type; }
std::pair<AnchorTarget, EntityData *> SpecificEntityData::anchorTarget() const {
return std::make_pair(std::get<0>(anchor_info), std::get<1>(anchor_info));
}
std::tuple<AnchorPos, EntityData::offset_h, EntityData::offset_v> SpecificEntityData::anchorPos() const {
return std::make_tuple(std::get<2>(anchor_info), std::get<3>(anchor_info), std::get<4>(anchor_info));
}
DocumentData::DocumentData(const QString &name) : SpecificEntityData(EntityType::DOCUMENT_ENTITY, "Document-Unique") {
resetContentLayout(MemberOri::H_LEFT_TO_RIGHT, MemberType::BLOCKS);
}
void DocumentData::resetContentLayout(MemberOri oritation, MemberType) { SpecificEntityData::resetContentLayout(oritation, MemberType::BLOCKS); }