org.jpedal.objects.raw.OutlineObject Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of OpenViewerFX Show documentation
Show all versions of OpenViewerFX Show documentation
Open Source (LGPL) JavaFX PDF Viewer for NetBeans plugin
/*
* ===========================================
* Java Pdf Extraction Decoding Access Library
* ===========================================
*
* Project Info: http://www.idrsolutions.com
* Help section for developers at http://www.idrsolutions.com/support/
*
* (C) Copyright 1997-2017 IDRsolutions and Contributors.
*
* This file is part of JPedal/JPDF2HTML5
*
@LICENSE@
*
* ---------------
* OutlineObject.java
* ---------------
*/
package org.jpedal.objects.raw;
import org.jpedal.utils.StringUtils;
public class OutlineObject extends PdfObject {
String Fstring, Title;
byte[] rawFstring, rawTitle;
private PdfObject A, Fdict, First, Next, Last;
private byte[][] Dest, D;
public OutlineObject(final String ref) {
super(ref);
}
public OutlineObject(final int ref, final int gen) {
super(ref, gen);
}
@Override
public byte[] getTextStreamValueAsByte(final int id) {
switch (id) {
case PdfDictionary.Title:
return rawTitle;
default:
return super.getTextStreamValueAsByte(id);
}
}
@Override
public PdfObject getDictionary(final int id) {
switch (id) {
case PdfDictionary.A:
return A;
case PdfDictionary.F:
return Fdict;
case PdfDictionary.First:
return First;
case PdfDictionary.Last:
return Last;
case PdfDictionary.Next:
return Next;
default:
return super.getDictionary(id);
}
}
@Override
public void setDictionary(final int id, final PdfObject value) {
value.setID(id);
switch (id) {
case PdfDictionary.A:
A = value;
break;
case PdfDictionary.F:
Fdict = value;
break;
case PdfDictionary.First:
First = value;
break;
case PdfDictionary.Last:
Last = value;
break;
case PdfDictionary.Next:
Next = value;
break;
default:
super.setDictionary(id, value);
}
}
@Override
public PdfArrayIterator getMixedArray(final int id) {
switch (id) {
case PdfDictionary.D:
return new PdfArrayIterator(D);
case PdfDictionary.Dest:
return new PdfArrayIterator(Dest);
default:
return super.getMixedArray(id);
}
}
@Override
public void setMixedArray(final int id, final byte[][] value) {
switch (id) {
case PdfDictionary.D:
D = value;
break;
case PdfDictionary.Dest:
Dest = value;
break;
default:
super.setMixedArray(id, value);
}
}
@Override
public void setTextStreamValue(final int id, final byte[] value) {
switch (id) {
case PdfDictionary.F:
rawFstring = value;
break;
case PdfDictionary.Title:
rawTitle = value;
break;
default:
super.setTextStreamValue(id, value);
}
}
@Override
public String getTextStreamValue(final int id) {
switch (id) {
case PdfDictionary.F:
//setup first time
if (Fstring == null && rawFstring != null) {
Fstring = StringUtils.getTextString(rawFstring, false);
}
return Fstring;
case PdfDictionary.Title:
//setup first time
if (Title == null && rawTitle != null) {
Title = new String(rawTitle);
}
return Title;
default:
return super.getTextStreamValue(id);
}
}
@Override
public int getObjectType() {
return PdfDictionary.Outlines;
}
}