sl@0: /* sl@0: * Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: sl@0: * Header PDRRECRD.CPP sl@0: * sl@0: */ sl@0: sl@0: sl@0: #include "PDRRECRD.H" sl@0: sl@0: EXPORT_C PdrResource* PdrResource::New() sl@0: /** Creates a new instance of this class. sl@0: sl@0: @return Reference to a new object. */ sl@0: { sl@0: return new PdrResource(); sl@0: } sl@0: sl@0: EXPORT_C void PdrResource::Delete() sl@0: /** Deletes the current object. */ sl@0: { sl@0: delete this; sl@0: } sl@0: sl@0: void PdrResource::Externalize(ostream& out) sl@0: { sl@0: uint8 id = (uint8) iId; sl@0: out.write((char*) &id, sizeof(id)); sl@0: iString.Externalize(out); sl@0: } sl@0: sl@0: EXPORT_C PdrResources* PdrResources::New() sl@0: /** Creates a new instance of this class. sl@0: sl@0: @return Reference to a new object. */ sl@0: { sl@0: return new PdrResources(); sl@0: } sl@0: sl@0: EXPORT_C void PdrResources::Delete() sl@0: /** Deletes the current object. */ sl@0: { sl@0: delete this; sl@0: } sl@0: sl@0: void PdrResources::Externalize(ostream& out) sl@0: { sl@0: iStreamId = out.tellp(); sl@0: iPdrResourceList.Externalize(out); sl@0: } sl@0: sl@0: EXPORT_C void PdrResources::AddResource(PdrResource* aResource) sl@0: /** Adds a printer resource to the object. sl@0: sl@0: @param aResource Printer resource. */ sl@0: { sl@0: iPdrResourceList.Add(aResource); sl@0: } sl@0: sl@0: PdrResources::~PdrResources() sl@0: /** Default destructor. */ sl@0: { sl@0: iPdrResourceList.Destroy(); sl@0: } sl@0: sl@0: EXPORT_C PdrTranslation* PdrTranslation::New() sl@0: /** Creates a new instance of this class. sl@0: sl@0: @return Reference to a new object. */ sl@0: { sl@0: return new PdrTranslation(); sl@0: } sl@0: sl@0: EXPORT_C void PdrTranslation::Delete() sl@0: /** Deletes the current object. */ sl@0: { sl@0: delete this; sl@0: } sl@0: sl@0: void PdrTranslation::Externalize(ostream& out) sl@0: { sl@0: out.write((char*) &iFrom, sizeof(iFrom)); sl@0: iTo.Externalize(out); sl@0: } sl@0: sl@0: EXPORT_C PdrTranslates* PdrTranslates::New() sl@0: /** Creates a new instance of this class. sl@0: sl@0: @return Reference to a new object. */ sl@0: { sl@0: return new PdrTranslates(); sl@0: } sl@0: sl@0: EXPORT_C void PdrTranslates::Delete() sl@0: /** Deletes the current object. */ sl@0: { sl@0: delete this; sl@0: } sl@0: sl@0: void PdrTranslates::Externalize(ostream& out) sl@0: { sl@0: iStreamId = out.tellp(); sl@0: iPdrTranslationList.Externalize(out); sl@0: } sl@0: sl@0: EXPORT_C void PdrTranslates::AddTranslation(PdrTranslation* aTranslation) sl@0: /** Adds a printer translation to the list. sl@0: sl@0: @param aTranslation Reference to a translation. */ sl@0: { sl@0: iPdrTranslationList.Add(aTranslation); sl@0: } sl@0: sl@0: PdrTranslates::~PdrTranslates() sl@0: /** This function is internal, and is not intended for use. */ sl@0: { sl@0: iPdrTranslationList.Destroy(); sl@0: } sl@0: sl@0: EXPORT_C Width* Width::New() sl@0: /** Creates a new instance of this object. sl@0: sl@0: @return Reference to a new object. */ sl@0: { sl@0: return new Width(); sl@0: } sl@0: sl@0: EXPORT_C void Width::Delete() sl@0: /** Deletes the current object. */ sl@0: { sl@0: delete this; sl@0: } sl@0: sl@0: void Width::Externalize(ostream& out) sl@0: { sl@0: out.write ((char*) &iWidthInPixels, sizeof(iWidthInPixels)); sl@0: } sl@0: sl@0: WidthsCodeSection::WidthsCodeSection() sl@0: : iWidthList() sl@0: /** This function is internal only, and is not intended for use. */ sl@0: { sl@0: } sl@0: sl@0: EXPORT_C WidthsCodeSection* WidthsCodeSection::New() sl@0: /** Creates a new instance of this class. sl@0: sl@0: @return Reference to a new object. */ sl@0: { sl@0: return new WidthsCodeSection(); sl@0: } sl@0: sl@0: EXPORT_C void WidthsCodeSection::Delete() sl@0: /** Deletes the current object. */ sl@0: { sl@0: delete this; sl@0: } sl@0: sl@0: void WidthsCodeSection::Externalize(ostream& out) sl@0: { sl@0: out.write((char*) &iStart, sizeof(iStart)); sl@0: out.write((char*) &iEnd, sizeof(iEnd)); sl@0: iWidthList.Externalize(out); sl@0: } sl@0: sl@0: EXPORT_C void WidthsCodeSection::AddWidth(Width* aWidth) sl@0: /** Adds a new font width to the list. sl@0: sl@0: @param aWidth Font width. */ sl@0: { sl@0: iWidthList.Add(aWidth); sl@0: } sl@0: sl@0: EXPORT_C Width* WidthsCodeSection::WidthList(int i) sl@0: /** Returns a font width from the list at the position specified. sl@0: sl@0: @param i Position of font width in list. sl@0: @return Reference to a font width. */ sl@0: { sl@0: return iWidthList[i]; sl@0: } sl@0: sl@0: EXPORT_C int WidthsCodeSection::NumWidths() sl@0: /** Returns the number of font widths in the list. sl@0: sl@0: @return Number of widths. */ sl@0: { sl@0: return iWidthList.Size(); sl@0: } sl@0: sl@0: WidthsCodeSection::~WidthsCodeSection() sl@0: /** Default destructor. */ sl@0: { sl@0: iWidthList.Destroy(); sl@0: } sl@0: sl@0: EXPORT_C FontInfo* FontInfo::New() sl@0: /** Creates a new instance of this class. sl@0: sl@0: @return Reference to a new instance of this class. */ sl@0: { sl@0: return new FontInfo(); sl@0: } sl@0: sl@0: EXPORT_C void FontInfo::Delete() sl@0: /** Deletes the current FontInfo object. */ sl@0: { sl@0: delete this; sl@0: } sl@0: sl@0: void FontInfo::Externalize(ostream& out) sl@0: { sl@0: iStreamId = out.tellp(); sl@0: out.write((char*) &iAscentInPixels, sizeof(iAscentInPixels)); sl@0: out.write((char*) &iMaxCharWidthInPixels, sizeof(iMaxCharWidthInPixels)); sl@0: out.write((char*) &iMaxNormalCharWidthInPixels, sizeof(iMaxNormalCharWidthInPixels)); sl@0: iCodeSectionList.Externalize(out); sl@0: } sl@0: sl@0: EXPORT_C void FontInfo::AddCodeSection(WidthsCodeSection* aCodeSection) sl@0: /** Adds a section of information about the font to an internally-stored array. sl@0: sl@0: @param aCodeSection Font information. */ sl@0: { sl@0: iCodeSectionList.Add(aCodeSection); sl@0: } sl@0: sl@0: EXPORT_C WidthsCodeSection* FontInfo::CodeSectionList(int i) sl@0: /** Returns a section of font information from a specified position in the internally-stored sl@0: array. sl@0: sl@0: @param i Postion of information in the array. sl@0: @return Reference to section of font information. */ sl@0: { sl@0: return iCodeSectionList[i]; sl@0: } sl@0: sl@0: EXPORT_C int FontInfo::NumCodeSections() sl@0: /** Returns the number of sections of font information in the internally-stored sl@0: array. sl@0: sl@0: @return Current number of font information sections. */ sl@0: { sl@0: return iCodeSectionList.Size(); sl@0: } sl@0: sl@0: FontInfo::~FontInfo() sl@0: /** This function is internal, and not intended for use. */ sl@0: { sl@0: iCodeSectionList.Destroy(); sl@0: } sl@0: sl@0: EXPORT_C PdrStyle* PdrStyle::New() sl@0: /** Creates a new instance of this class sl@0: sl@0: @return Reference to a new object. */ sl@0: { sl@0: return new PdrStyle(); sl@0: } sl@0: sl@0: EXPORT_C void PdrStyle::Delete() sl@0: /** Deletes the current object. */ sl@0: { sl@0: delete this; sl@0: } sl@0: sl@0: void PdrStyle::Externalize(ostream& out) sl@0: { sl@0: out.write((char*) &iIsAvailable, sizeof(iIsAvailable)); sl@0: streamoff streamid = 0; sl@0: if (iIsAvailable) sl@0: streamid = iFontInfo->iStreamId; sl@0: ::ExternalizeStreamOff(out, streamid); sl@0: } sl@0: sl@0: PdrStyle::PdrStyle() sl@0: : iIsAvailable(efalse) sl@0: /** Default constructor. */ sl@0: { sl@0: } sl@0: sl@0: EXPORT_C PdrFontHeight* PdrFontHeight::New() sl@0: /** Returns a new instance of this class. sl@0: sl@0: @return Reference to new object. */ sl@0: { sl@0: return new PdrFontHeight(); sl@0: } sl@0: sl@0: EXPORT_C void PdrFontHeight::Delete() sl@0: /** Deletes the current object. */ sl@0: { sl@0: delete this; sl@0: } sl@0: sl@0: void PdrFontHeight::Externalize(ostream& out) sl@0: { sl@0: iCommandString.Externalize(out); sl@0: out.write((char*) &iHeightInTwips, sizeof(iHeightInTwips)); sl@0: out.write((char*) &iWidthScale, sizeof(iWidthScale)); sl@0: for (int style = Normal;style <= BoldItalic; style++) sl@0: iStyle[style].Externalize(out); sl@0: } sl@0: sl@0: PdrFontHeight::PdrFontHeight(): sl@0: iWidthScale(1) sl@0: /** Default constructor. */ sl@0: { sl@0: } sl@0: sl@0: PdrScalableFontHeight::PdrScalableFontHeight() sl@0: /** Default constructor. */ sl@0: { sl@0: } sl@0: sl@0: void PdrScalableFontHeight::Externalize(ostream& out) sl@0: { sl@0: iCommandString.Externalize(out); sl@0: out.write((char*) &iHeightMinInTwips, sizeof(iHeightMinInTwips)); sl@0: out.write((char*) &iHeightMaxInTwips, sizeof(iHeightMaxInTwips)); sl@0: out.write((char*) &iHeightDeltaInTwips, sizeof(iHeightDeltaInTwips)); sl@0: for (int style = Normal; style <= BoldItalic; style++) sl@0: iStyle[style].Externalize(out); sl@0: } sl@0: sl@0: EXPORT_C TypefaceFonts* TypefaceFonts::New() sl@0: /** Creates a new instance of this class. sl@0: sl@0: @return Reference to a new object. */ sl@0: { sl@0: return new TypefaceFonts(); sl@0: } sl@0: sl@0: EXPORT_C void TypefaceFonts::Delete() sl@0: /** Deletes the current object. */ sl@0: { sl@0: delete this; sl@0: } sl@0: sl@0: void TypefaceFonts::Externalize(ostream& out) sl@0: { sl@0: iStreamId = out.tellp(); sl@0: iTypeface.Externalize(out); sl@0: out.write((char*) &iIsScalable, sizeof(iIsScalable)); sl@0: if (iIsScalable) sl@0: iScalableFontHeight.Externalize(out); sl@0: else sl@0: iFontHeightList.Externalize(out); sl@0: ::ExternalizeStreamOff(out, iTranslates->iStreamId); sl@0: } sl@0: sl@0: EXPORT_C void TypefaceFonts::AddFontHeight(PdrFontHeight* aFontHeight) sl@0: { sl@0: iFontHeightList.Add(aFontHeight); sl@0: } sl@0: sl@0: EXPORT_C int TypefaceFonts::NumFontHeights() sl@0: /** Returns the number of font height descriptions currently held in the list. sl@0: sl@0: @return Number of descriptions. */ sl@0: { sl@0: return iFontHeightList.Size(); sl@0: } sl@0: sl@0: PdrFontHeight* TypefaceFonts::FontHeightList(int i) sl@0: /** Returns the font height description from the position specified in the list. sl@0: sl@0: @param i Position of description. sl@0: @return Font height description. */ sl@0: { sl@0: return iFontHeightList[i]; sl@0: } sl@0: sl@0: TypefaceFonts::TypefaceFonts(): sl@0: iIsScalable(efalse) sl@0: /** This function is internal only, and is not intended for use. */ sl@0: { sl@0: } sl@0: sl@0: TypefaceFonts::~TypefaceFonts() sl@0: /** This function is internal only, and is not intended for use. */ sl@0: { sl@0: iFontHeightList.Destroy(); sl@0: } sl@0: sl@0: EXPORT_C TypefaceFontsEntry* TypefaceFontsEntry::New(Record* aTypefaceFonts) sl@0: { sl@0: return new TypefaceFontsEntry(aTypefaceFonts); sl@0: } sl@0: sl@0: EXPORT_C void TypefaceFontsEntry::Delete() sl@0: /** Deletes the current object. */ sl@0: { sl@0: delete this; sl@0: } sl@0: sl@0: void TypefaceFontsEntry::Externalize(ostream& out) sl@0: { sl@0: ::ExternalizeStreamOff(out, iTypefaceFonts->iStreamId); sl@0: out.write((char*) &iNotInPortrait, sizeof(iNotInPortrait)); sl@0: out.write((char*) &iNotInLandscape, sizeof(iNotInLandscape)); sl@0: } sl@0: sl@0: TypefaceFontsEntry::TypefaceFontsEntry(Record* aTypefaceFonts) sl@0: : iTypefaceFonts(aTypefaceFonts), iNotInPortrait(efalse), iNotInLandscape(efalse) sl@0: { sl@0: } sl@0: sl@0: TypefaceFontsEntry::~TypefaceFontsEntry() sl@0: /** Default destructor. */ sl@0: { sl@0: } sl@0: sl@0: void Margins::Externalize(ostream& out) sl@0: { sl@0: out.write((char*) &iLeft, sizeof(iLeft)); sl@0: out.write((char*) &iRight, sizeof(iRight)); sl@0: out.write((char*) &iTop, sizeof(iTop)); sl@0: out.write((char*) &iBottom, sizeof(iBottom)); sl@0: } sl@0: sl@0: /* sl@0: PdrExtraInfo::~PdrExtraInfo() sl@0: { sl@0: iInfo.Destroy(); sl@0: } sl@0: sl@0: void PdrExtraInfo::Externalize(ostream& out) sl@0: { sl@0: iInfo.Externalize(out); sl@0: } sl@0: */ sl@0: sl@0: void PdrModelInfo::Externalize(ostream& out) sl@0: { sl@0: iStreamId=out.tellp(); sl@0: out.write((char*) &KPdrtranVersion, sizeof(KPdrtranVersion)); sl@0: out.write((char*) &iFlags, sizeof(iFlags)); sl@0: out.write((char*) &iKPixelWidthInTwips, sizeof(iKPixelWidthInTwips)); sl@0: out.write((char*) &iKPixelHeightInTwips, sizeof(iKPixelHeightInTwips)); sl@0: iPortraitOffsetInPixels.Externalize(out); sl@0: iLandscapeOffsetInPixels.Externalize(out); sl@0: iMinMarginsInPixels.Externalize(out); sl@0: out.write((char*) &iDisplayMode, sizeof(iDisplayMode)); sl@0: iTypefaceFontsEntryList.Externalize(out); sl@0: ::ExternalizeStreamOff(out, iResources->iStreamId); sl@0: streamoff streamid = 0; sl@0: if (iSpareRecord) sl@0: streamid = iSpareRecord->iStreamId; sl@0: ::ExternalizeStreamOff(out, streamid); sl@0: } sl@0: sl@0: EXPORT_C void PdrModelInfo::AddTypefaceFontsEntry(TypefaceFontsEntry* aTypefaceFontsEntry) sl@0: /** Adds an entry containing information about typeface fonts to an internally-stored sl@0: array. sl@0: sl@0: @param aTypefaceFontsEntry Typeface font information. */ sl@0: { sl@0: iTypefaceFontsEntryList.Add(aTypefaceFontsEntry); sl@0: } sl@0: sl@0: int PdrModelInfo::NumTypefaceFontsEntries() sl@0: /** Returns the number of entries containing information about typeface fonts in sl@0: the internally-stored array. sl@0: sl@0: @return Number of entries. */ sl@0: { sl@0: return iTypefaceFontsEntryList.Size(); sl@0: } sl@0: sl@0: TypefaceFontsEntry* PdrModelInfo::TypefaceFontsEntryList(int i) sl@0: /** Returns the typeface font entry stored the internal array from the position sl@0: specified. sl@0: sl@0: @param i Position in array. sl@0: @return Typeface font entry. */ sl@0: { sl@0: return iTypefaceFontsEntryList[i]; sl@0: } sl@0: sl@0: PdrModelInfo::PdrModelInfo() sl@0: : iStreamId(0), sl@0: iFlags(0), sl@0: iKPixelWidthInTwips(0), sl@0: iKPixelHeightInTwips(0), sl@0: iPortraitOffsetInPixels(), sl@0: iLandscapeOffsetInPixels(), sl@0: iMinMarginsInPixels(), sl@0: iDisplayMode(0), sl@0: iTypefaceFontsEntryList(), sl@0: iResources(NULL), sl@0: iSpareRecord(NULL) // !! Not used yet sl@0: /** Default constructor. */ sl@0: { sl@0: } sl@0: sl@0: PdrModelInfo::~PdrModelInfo() sl@0: /** Default destructor. */ sl@0: { sl@0: iTypefaceFontsEntryList.Destroy(); sl@0: } sl@0: sl@0: PrinterModelEntry::PrinterModelEntry() sl@0: : iName(), iRequiresPrinterPort(efalse), iUid(KNullUid) sl@0: /** Default constructor. */ sl@0: { sl@0: } sl@0: sl@0: void PrinterModelEntry::Externalize(ostream& out) sl@0: { sl@0: iName.Externalize(out); sl@0: out.write((char*) &iRequiresPrinterPort, sizeof(iRequiresPrinterPort)); sl@0: out.write((char*) &iUid, sizeof(iUid)); sl@0: } sl@0: sl@0: EXPORT_C PrinterModelHeader* PrinterModelHeader::New() sl@0: /** Creates a new instance of this class. sl@0: sl@0: @return Reference to a new object. */ sl@0: { sl@0: return new PrinterModelHeader(); sl@0: } sl@0: sl@0: EXPORT_C void PrinterModelHeader::Delete() sl@0: /** Deletes the current object. */ sl@0: { sl@0: delete this; sl@0: } sl@0: sl@0: void PrinterModelHeader::Externalize(ostream& out) sl@0: { sl@0: iEntry.Externalize(out); sl@0: ::ExternalizeStreamOff(out, iInfo.iStreamId); sl@0: } sl@0: sl@0: void PrinterModelHeader::ExternalizeData(ostream& out) sl@0: { sl@0: iInfo.Externalize(out); sl@0: } sl@0: sl@0: boolean PrinterModelHeader::IsPdrModel() sl@0: /** Determines whether printer information is available for this printer model. sl@0: sl@0: @return ETrue: printer description is available. */ sl@0: { sl@0: return iInfo.NumTypefaceFontsEntries() || iInfo.iResources; sl@0: } sl@0: sl@0: EXPORT_C PdrStoreFile* PdrStoreFile::New() sl@0: /** Creates a new instance of this class. sl@0: sl@0: @return Reference to a new object. */ sl@0: { sl@0: return new PdrStoreFile(); sl@0: } sl@0: sl@0: EXPORT_C void PdrStoreFile::Delete() sl@0: /** Deletes the current object. */ sl@0: { sl@0: delete this; sl@0: } sl@0: sl@0: EXPORT_C void PdrStoreFile::AddModel(PrinterModelHeader* aModel) sl@0: /** Adds a printer model. sl@0: sl@0: @param aModel Printer model. */ sl@0: { sl@0: iModelList.Add(aModel); sl@0: if (aModel->IsPdrModel()) sl@0: { sl@0: for (int i = 0; i < aModel->iInfo.NumTypefaceFontsEntries(); i++) sl@0: AddTypefaceFonts((TypefaceFonts*) aModel->iInfo.TypefaceFontsEntryList(i)->iTypefaceFonts); sl@0: iResourcesList.Add(aModel->iInfo.iResources); sl@0: // if (aModel->iInfo.iSpareRecord) sl@0: // iExtraInfoList.Add(aModel->iInfo.iSpareRecord); sl@0: } sl@0: } sl@0: sl@0: void PdrStoreFile::Externalize(ostream& out) sl@0: { sl@0: ExternalizeHeader(out); sl@0: ExternalizeComponents(out); sl@0: } sl@0: sl@0: void PdrStoreFile::ExternalizeHeader(ostream& out) sl@0: { sl@0: out.write((char*) &KStoreWriteOnceLayoutUid, sizeof(KStoreWriteOnceLayoutUid)); sl@0: out.write((char*) &KPdrStoreFileUid, sizeof(KPdrStoreFileUid)); sl@0: out.write((char*) &KNullUid, sizeof(KNullUid)); sl@0: out.write((char*) &KPdrStoreFileChecksum, sizeof(KPdrStoreFileChecksum)); sl@0: ::ExternalizeStreamOff(out, iStreamId); sl@0: iStreamId = out.tellp(); sl@0: iPDLName.Externalize(out); sl@0: out.write((char*) &iPDLUid, sizeof(iPDLUid)); sl@0: iModelList.Externalize(out); sl@0: } sl@0: sl@0: void PdrStoreFile::AddTypefaceFonts(TypefaceFonts* aTypefaceFonts) sl@0: { sl@0: iTypefaceFontsList.Add(aTypefaceFonts); sl@0: iTranslatesList.Add(aTypefaceFonts->iTranslates); sl@0: if (aTypefaceFonts->iIsScalable) sl@0: { sl@0: for (int style = Normal; style <= BoldItalic; style++) sl@0: { sl@0: if (aTypefaceFonts->iScalableFontHeight.iStyle[style].iIsAvailable) sl@0: iFontInfoList.Add(aTypefaceFonts->iScalableFontHeight.iStyle[style].iFontInfo); sl@0: } sl@0: } sl@0: else sl@0: { sl@0: for (int j = 0; j < aTypefaceFonts->NumFontHeights(); j++) sl@0: { sl@0: PdrFontHeight* fontheight = aTypefaceFonts->FontHeightList(j); sl@0: for (int style = Normal; style <= BoldItalic; style++) sl@0: { sl@0: if (fontheight->iStyle[style].iIsAvailable) sl@0: iFontInfoList.Add(fontheight->iStyle[style].iFontInfo); sl@0: } sl@0: } sl@0: } sl@0: } sl@0: sl@0: void PdrStoreFile::ExternalizeComponents(ostream& out) sl@0: { sl@0: for (int i = 0; i < iModelList.Size(); i++) sl@0: { sl@0: PrinterModelHeader* model = (PrinterModelHeader*) iModelList[i]; sl@0: if (model->IsPdrModel()) sl@0: model->ExternalizeData(out); sl@0: } sl@0: iTypefaceFontsList.Externalize(out); sl@0: iFontInfoList.Externalize(out); sl@0: iResourcesList.Externalize(out); sl@0: iTranslatesList.Externalize(out); sl@0: // iExtraInfoList.Externalize(out); sl@0: } sl@0: sl@0: PdrStoreFile::PdrStoreFile() sl@0: : Record(), sl@0: iPDLName(), sl@0: iPDLUid(KNullUid), sl@0: iModelList(), sl@0: iTypefaceFontsList(), sl@0: iFontInfoList(), sl@0: iResourcesList(), sl@0: iTranslatesList() sl@0: /** This function is internal only, and is not intended for use. */ sl@0: { sl@0: } sl@0: sl@0: EXPORT_C boolean PdrModelStore::Store(const String& aFilename) sl@0: /** Externalizes printer information from the store to the specfied external file. sl@0: sl@0: @param aFilename Filename. sl@0: @return ETrue: store successful. */ sl@0: { sl@0: boolean state = efalse; sl@0: ofstream fout; sl@0: String string = aFilename; sl@0: fout.open(string.Text(), ios::binary); sl@0: if (!fout.fail()) sl@0: { sl@0: iPdrStoreFile->Externalize(fout); sl@0: fout.close(); sl@0: fout.open(string.Text(), ios::binary | ios::trunc); sl@0: iPdrStoreFile->Externalize(fout); sl@0: fout.close(); sl@0: state = etrue; sl@0: } sl@0: return state; sl@0: } sl@0: sl@0: EXPORT_C void PdrModelStore::AddPdrStoreFile(PdrStoreFile* aPdrStoreFile) sl@0: { sl@0: iPdrStoreFile = aPdrStoreFile; sl@0: } sl@0: sl@0: EXPORT_C void PdrModelStore::AddModel(PrinterModelHeader *aModel) sl@0: /** Adds a printer model to the store. sl@0: sl@0: @param aModel Printer model. */ sl@0: { sl@0: iModelList.Add(aModel); sl@0: } sl@0: sl@0: EXPORT_C Record *PdrModelStore::FindModel(String& aLabel) sl@0: { sl@0: return iModelList.LabelToRecord(aLabel); sl@0: } sl@0: sl@0: EXPORT_C void PdrModelStore::AddTypefaceFonts(TypefaceFonts *aTypefaceFonts) sl@0: /** Adds typeface information to the store. sl@0: sl@0: @param aTypefaceFonts Typeface fonts. */ sl@0: { sl@0: iTypefaceFontsList.Add(aTypefaceFonts); sl@0: } sl@0: sl@0: EXPORT_C Record *PdrModelStore::FindTypefaceFonts(String& aLabel) sl@0: { sl@0: return iTypefaceFontsList.LabelToRecord(aLabel); sl@0: } sl@0: sl@0: EXPORT_C void PdrModelStore::AddFontInfo(FontInfo *aFontInfo) sl@0: /** Adds font information to the store. sl@0: sl@0: @param aFontInfo Font information. */ sl@0: { sl@0: iFontInfoList.Add(aFontInfo); sl@0: } sl@0: sl@0: EXPORT_C Record *PdrModelStore::FindFontInfo(String& aLabel) sl@0: { sl@0: return iFontInfoList.LabelToRecord(aLabel); sl@0: } sl@0: sl@0: EXPORT_C void PdrModelStore::AddResources(PdrResources *aResources) sl@0: { sl@0: iResourcesList.Add(aResources); sl@0: } sl@0: sl@0: EXPORT_C Record *PdrModelStore::FindResources(String& aLabel) sl@0: { sl@0: return iResourcesList.LabelToRecord(aLabel); sl@0: } sl@0: sl@0: EXPORT_C void PdrModelStore::AddTranslates(PdrTranslates *aTranslates) sl@0: /** Adds printer translations to the store. sl@0: sl@0: @param aTranslates Translation list. */ sl@0: { sl@0: iTranslatesList.Add(aTranslates); sl@0: } sl@0: sl@0: EXPORT_C Record *PdrModelStore::FindTranslates(String& aLabel) sl@0: { sl@0: return iTranslatesList.LabelToRecord(aLabel); sl@0: } sl@0: sl@0: /* sl@0: void PdrModelStore::AddExtraInfo(PdrExtraInfo *aInfo) sl@0: { sl@0: iExtraInfoList.Add(aInfo); sl@0: } sl@0: sl@0: Record* PdrModelStore::FindExtraInfo(String& aLabel) sl@0: { sl@0: return iExtraInfoList.LabelToRecord(aLabel); sl@0: } sl@0: */ sl@0: sl@0: PdrModelStore::PdrModelStore() sl@0: : iPdrStoreFile(NULL), sl@0: iModelList(), sl@0: iTypefaceFontsList(), sl@0: iFontInfoList(), sl@0: iResourcesList()//, sl@0: // iExtraInfoList() sl@0: /** Default constructor. */ sl@0: { sl@0: } sl@0: sl@0: PdrModelStore::~PdrModelStore() sl@0: /** Default destructor. */ sl@0: { sl@0: delete iPdrStoreFile; sl@0: iModelList.Destroy(); sl@0: iTypefaceFontsList.Destroy(); sl@0: iFontInfoList.Destroy(); sl@0: iResourcesList.Destroy(); sl@0: iTranslatesList.Destroy(); sl@0: // iExtraInfoList.Destroy(); sl@0: }