001: /*
002: Copyright © 2006 Stefano Chizzolini. http://clown.stefanochizzolini.it
003:
004: Contributors:
005: * Stefano Chizzolini (original code developer, http://www.stefanochizzolini.it):
006: contributed code is Copyright © 2006 by Stefano Chizzolini.
007:
008: This file should be part of the source code distribution of "PDF Clown library"
009: (the Program): see the accompanying README files for more info.
010:
011: This Program is free software; you can redistribute it and/or modify it under
012: the terms of the GNU General Public License as published by the Free Software
013: Foundation; either version 2 of the License, or (at your option) any later version.
014:
015: This Program is distributed in the hope that it will be useful, but WITHOUT ANY
016: WARRANTY, either expressed or implied; without even the implied warranty of
017: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the License for more details.
018:
019: You should have received a copy of the GNU General Public License along with this
020: Program (see README files); if not, go to the GNU website (http://www.gnu.org/).
021:
022: Redistribution and use, with or without modification, are permitted provided that such
023: redistributions retain the above copyright notice, license and disclaimer, along with
024: this list of conditions.
025: */
026:
027: package it.stefanochizzolini.clown.documents.contents;
028:
029: import it.stefanochizzolini.clown.documents.Document;
030: import it.stefanochizzolini.clown.objects.PdfDictionary;
031: import it.stefanochizzolini.clown.objects.PdfDirectObject;
032: import it.stefanochizzolini.clown.objects.PdfIndirectObject;
033: import it.stefanochizzolini.clown.objects.PdfName;
034: import it.stefanochizzolini.clown.objects.PdfObjectWrapper;
035: import it.stefanochizzolini.clown.util.NotImplementedException;
036:
037: /**
038: Resources collection [PDF:1.6:3.7.2].
039: */
040: public class Resources extends PdfObjectWrapper<PdfDictionary> {
041: // <class>
042: // <dynamic>
043: // <constructors>
044: public Resources(Document context) {
045: super (context.getFile(), new PdfDictionary());
046: }
047:
048: /**
049: <h3>Remarks</h3>
050: <p>For internal use only.</p>
051: */
052: public Resources(PdfDirectObject baseObject,
053: PdfIndirectObject container) {
054: super (baseObject, container);
055: }
056:
057: // </constructors>
058:
059: // <interface>
060: // <public>
061: @Override
062: public Resources clone(Document context) {
063: throw new NotImplementedException();
064: }
065:
066: public ColorSpaces getColorSpaces() {
067: /*
068: NOTE: ColorSpace entry may be undefined [PDF:1.6:3.7.2].
069: */
070: PdfDirectObject colorSpaces = getBaseDataObject().get(
071: PdfName.ColorSpace);
072: if (colorSpaces == null)
073: return null;
074: else
075: return new ColorSpaces(colorSpaces, getContainer());
076: }
077:
078: public Fonts getFonts() {
079: /*
080: NOTE: Font entry may be undefined [PDF:1.6:3.7.2].
081: */
082: PdfDirectObject fonts = getBaseDataObject().get(PdfName.Font);
083: if (fonts == null)
084: return null;
085: else
086: return new Fonts(fonts, getContainer());
087: }
088:
089: public XObjects getXObjects() {
090: /*
091: NOTE: XObject entry may be undefined [PDF:1.6:3.7.2].
092: */
093: PdfDirectObject xObjects = getBaseDataObject().get(
094: PdfName.XObject);
095: if (xObjects == null)
096: return null;
097: else
098: return new XObjects(xObjects, getContainer());
099: }
100:
101: public void setColorSpaces(ColorSpaces value) {
102: getBaseDataObject().put(PdfName.ColorSpace,
103: value.getBaseObject());
104: }
105:
106: public void setFonts(Fonts value) {
107: getBaseDataObject().put(PdfName.Font, value.getBaseObject());
108: }
109:
110: public void setXObjects(XObjects value) {
111: getBaseDataObject().put(PdfName.XObject, value.getBaseObject());
112: }
113: // </public>
114: // </interface>
115: // </dynamic>
116: // </class>
117: }
|