mirror of
https://github.com/qpdf/qpdf.git
synced 2025-01-05 08:02:11 +00:00
Refactor QPDFOutlineDocumentHelper::resolveNamedDest
This commit is contained in:
parent
f4e468b180
commit
963574f27f
@ -68,30 +68,25 @@ QPDFOutlineDocumentHelper::resolveNamedDest(QPDFObjectHandle name)
|
|||||||
QPDFObjectHandle result;
|
QPDFObjectHandle result;
|
||||||
if (name.isName()) {
|
if (name.isName()) {
|
||||||
if (!m->dest_dict.isInitialized()) {
|
if (!m->dest_dict.isInitialized()) {
|
||||||
m->dest_dict = this->qpdf.getRoot().getKey("/Dests");
|
m->dest_dict = qpdf.getRoot().getKey("/Dests");
|
||||||
}
|
}
|
||||||
if (m->dest_dict.isDictionary()) {
|
|
||||||
QTC::TC("qpdf", "QPDFOutlineDocumentHelper name named dest");
|
QTC::TC("qpdf", "QPDFOutlineDocumentHelper name named dest");
|
||||||
result = m->dest_dict.getKey(name.getName());
|
result= m->dest_dict.getKeyIfDict(name.getName());
|
||||||
}
|
|
||||||
} else if (name.isString()) {
|
} else if (name.isString()) {
|
||||||
if (nullptr == m->names_dest) {
|
if (!m->names_dest) {
|
||||||
QPDFObjectHandle names = this->qpdf.getRoot().getKey("/Names");
|
auto dests = qpdf.getRoot().getKey("/Names").getKeyIfDict("/Dests");
|
||||||
if (names.isDictionary()) {
|
|
||||||
QPDFObjectHandle dests = names.getKey("/Dests");
|
|
||||||
if (dests.isDictionary()) {
|
if (dests.isDictionary()) {
|
||||||
m->names_dest = std::make_shared<QPDFNameTreeObjectHelper>(dests, this->qpdf);
|
m->names_dest = std::make_shared<QPDFNameTreeObjectHelper>(dests, qpdf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
if (m->names_dest) {
|
||||||
if (m->names_dest.get()) {
|
|
||||||
if (m->names_dest->findObject(name.getUTF8Value(), result)) {
|
if (m->names_dest->findObject(name.getUTF8Value(), result)) {
|
||||||
QTC::TC("qpdf", "QPDFOutlineDocumentHelper string named dest");
|
QTC::TC("qpdf", "QPDFOutlineDocumentHelper string named dest");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!result.isInitialized()) {
|
if (!result.isInitialized()) {
|
||||||
result = QPDFObjectHandle::newNull();
|
return QPDFObjectHandle::newNull();
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user