#include <princomp.h>
Inheritance diagram for PrintComponent:
Public Member Functions | |
PrintComponent () | |
Construct a print component. DO NOT use this constructor. It gives and ERROR3 (and sets up this in a semi-safe default state). | |
PrintComponent (PrintControl *) | |
Construct a print component using the given print control object. | |
~PrintComponent () | |
Clean up a print component's data structures - deletes the print control object. | |
PrintControl * | GetPrintControl () |
virtual BOOL | WriteEPSComments (EPSFilter *) |
Writes out the print control object in the form of EPS comments in the 'header' comments of the EPS file. | |
virtual ProcessEPSResult | ProcessEPSComment (EPSFilter *, const char *) |
Process an EPS comment - if this is a print component comment, this component will claim it and try to decode it. | |
virtual BOOL | EndExport (BaseCamelotFilter *pFilter, BOOL Success) |
Inform the colour list document component that a Web or Native export has just finished. | |
BOOL | ExportPrintSettings (BaseCamelotFilter *pFilter) |
Export a TAG_PRINTERSETTINGS native file record. | |
BOOL | ExportImagesetting (BaseCamelotFilter *pFilter) |
Export a TAG_IMAGESETTING native file record. | |
BOOL | ExportColourPlate (BaseCamelotFilter *pFilter, ColourPlate *pPlate) |
Export a TAG_COLOURPLATE native file record. | |
void | ImportPrintSettings (CXaraFileRecord *Rec) |
Load a TAG_PRINTERSETTINGS native file record. | |
void | ImportImagesetting (CXaraFileRecord *Rec) |
Load a TAG_IMAGESETTING native file record. | |
void | ImportColourPlate (CXaraFileRecord *Rec, CamelotRecordHandler *pHandler) |
Load a TAG_COLOURPLATE native file record. | |
Private Member Functions | |
BOOL | OutputValue (UINT32 Token, INT32 Value) |
Outputs a print component token with the given value. | |
BOOL | OutputValue (UINT32 Token, FIXED16 Value) |
PCToken | GetToken (const char *pComment) |
Outputs a print component token with the given value. | |
INT32 | GetTokenValINT32 (const char *pComment) |
This gets the value after the token part of the comment and returns it as a INT32. | |
FIXED16 | GetTokenValFIXED16 (const char *pComment) |
This gets the value after the token part of the comment and returns it as a FIXED16. | |
void | ExtractTokenValStr (const char *pComment) |
The string representation of the token value is stored in Buffer. If no value is found, or the buffer overflows, Buffer will contain an empty string. | |
Private Attributes | |
PrintControl * | pPrCtrl |
EPSExportDC * | pExportDC |
TCHAR | Buffer [32] |
Definition at line 177 of file princomp.h.
|
Construct a print component. DO NOT use this constructor. It gives and ERROR3 (and sets up this in a semi-safe default state).
Definition at line 224 of file princomp.cpp. 00225 { 00226 ERROR3("PrintComponent constructed with default constructor!?\n"); 00227 pPrCtrl = NULL; 00228 pExportDC = NULL; 00229 }
|
|
Construct a print component using the given print control object.
Definition at line 246 of file princomp.cpp. 00247 { 00248 ERROR3IF(pThisPrCtrl == NULL, "NULL print control object in print component constructor!"); 00249 00250 // Install this Bitmap list. 00251 pPrCtrl = pThisPrCtrl; 00252 pExportDC = NULL; 00253 }
|
|
Clean up a print component's data structures - deletes the print control object.
Definition at line 267 of file princomp.cpp. 00268 { 00269 // Delete our print control object 00270 if (pPrCtrl != NULL) 00271 { 00272 delete pPrCtrl; 00273 pPrCtrl = NULL; 00274 } 00275 }
|
|
Inform the colour list document component that a Web or Native export has just finished.
Reimplemented from DocComponent. Definition at line 674 of file princomp.cpp. 00675 { 00676 BOOL ok = TRUE; 00677 00678 PORTNOTETRACE("print","PrintComponent::EndExport - do nothing"); 00679 // WEBSTER - markn 14/2/97 00680 // No print records needed in Webster 00681 #ifndef WEBSTER 00682 #if !defined(EXCLUDE_FROM_RALPH) 00683 if (pFilter == NULL) 00684 { 00685 ERROR3("PrintComponent::EndExport filter is null!"); 00686 return(ok); 00687 } 00688 00689 // If we're not exporting native data, or if export has failed, we do nothing here 00690 if (pFilter->IsWebFilter() || !Success) 00691 return(ok); 00692 00693 // Export our 3 record types (1 print info, 1 imagesetting info, 'n' colour plates) 00694 ExportPrintSettings(pFilter); 00695 ExportImagesetting(pFilter); 00696 00697 TypesetInfo *TInfo = TypesetInfo::FindTypesetInfoForDoc(pFilter->GetDocument()); 00698 if (TInfo != NULL && TInfo->GetNumPlates() > 0) 00699 { 00700 ColourPlate *pPlate = TInfo->GetFirstPlate(); 00701 while (pPlate != NULL) 00702 { 00703 ExportColourPlate(pFilter, pPlate); 00704 pPlate = TInfo->GetNextPlate(pPlate); 00705 } 00706 } 00707 00708 #endif // WEBSTER 00709 #endif 00710 return(ok); 00711 }
|
|
Export a TAG_COLOURPLATE native file record.
Definition at line 952 of file princomp.cpp. 00953 { 00954 ERROR3IF(pPlate == NULL, "Illegal NULL params"); 00955 00956 BOOL ok = TRUE; 00957 #if !defined(EXCLUDE_FROM_RALPH) 00958 00959 // --- Save any referenced spot colour 00960 IndexedColour *pCol = pPlate->GetSpotColour(); 00961 INT32 SpotRecordNumber = 0; 00962 if (pCol != NULL) 00963 { 00964 DocColour Fred; 00965 Fred.MakeRefToIndexedColour(pCol); 00966 SpotRecordNumber = pFilter->WriteRecord(&Fred); 00967 ok = (SpotRecordNumber > 0); 00968 } 00969 00970 // -- Now save the ColourPlate 00971 CXaraFileRecord Rec(TAG_COLOURPLATE, TAG_COLOURPLATE_SIZE); 00972 if (ok) ok = Rec.Init(); 00973 00974 BYTE Type = 0; 00975 switch(pPlate->GetType()) 00976 { 00977 case COLOURPLATE_CYAN: Type = 1; break; 00978 case COLOURPLATE_MAGENTA: Type = 2; break; 00979 case COLOURPLATE_YELLOW: Type = 3; break; 00980 case COLOURPLATE_KEY: Type = 4; break; 00981 case COLOURPLATE_SPOT: Type = 5; break; 00982 default: 00983 break; 00984 } 00985 // Size Total 00986 if (ok) ok = Rec.WriteBYTE(Type); // 1 1 00987 if (ok) ok = Rec.WriteReference(SpotRecordNumber); // 4 5 00988 00989 double temp = pPlate->GetScreenAngle(); 00990 if (ok) ok = Rec.WriteDOUBLE(temp); // 8 13 00991 temp = pPlate->GetScreenFrequency(); 00992 if (ok) ok = Rec.WriteDOUBLE(temp); // 8 21 00993 // 00994 BYTE Flags = 0x00; // 1 22 00995 if (!pPlate->IsDisabled()) Flags |= 0x01; 00996 if (pPlate->Overprints()) Flags |= 0x02; 00997 if (ok) ok = Rec.WriteBYTE(Flags); 00998 00999 if (ok) 01000 pFilter->Write(&Rec); 01001 01002 #endif // EXCLUDE_FROM_RALPH 01003 return(ok); 01004 }
|
|
Export a TAG_IMAGESETTING native file record.
Definition at line 876 of file princomp.cpp. 00877 { 00878 BOOL ok = TRUE; 00879 00880 #if !defined(EXCLUDE_FROM_RALPH) 00881 00882 TypesetInfo *TInfo = GetPrintControl()->GetTypesetInfo(); 00883 if (TInfo == NULL) 00884 return(TRUE); // If we can't find imagesetting info, don't sweat it 00885 00886 CXaraFileRecord Rec(TAG_IMAGESETTING, TAG_IMAGESETTING_SIZE); 00887 if (ok) ok = Rec.Init(); 00888 00889 if (ok) ok = Rec.WriteINT32(TInfo->GetPrintResolution()); 00890 if (ok) ok = Rec.WriteDOUBLE(TInfo->GetDefaultScreenFrequency()); 00891 00892 if (ok) 00893 { 00894 UINT16 Func = 0; 00895 switch(TInfo->GetScreenFunction()) 00896 { 00897 case SCRTYPE_SPOT1: Func = 1; break; 00898 case SCRTYPE_SPOT2: Func = 2; break; 00899 case SCRTYPE_TRIPLESPOT1: Func = 3; break; 00900 case SCRTYPE_TRIPLESPOT2: Func = 4; break; 00901 case SCRTYPE_ELLIPTICAL: Func = 5; break; 00902 case SCRTYPE_LINE: Func = 6; break; 00903 case SCRTYPE_CROSSHATCH: Func = 7; break; 00904 case SCRTYPE_MEZZOTINT: Func = 8; break; 00905 case SCRTYPE_SQUARE: Func = 9; break; 00906 case SCRTYPE_DITHER: Func = 10; break; 00907 default: 00908 break; 00909 } 00910 ok = Rec.WriteUINT16(Func); 00911 } 00912 00913 if (ok) 00914 { 00915 BYTE Flags = 0x00; 00916 if (TInfo->AreSeparating()) Flags |= 0x01; 00917 if (TInfo->AreScreening()) Flags |= 0x02; 00918 if (TInfo->PrintEmulsionDown()) Flags |= 0x04; 00919 if (TInfo->PrintPhotoNegative()) Flags |= 0x08; 00920 if (TInfo->AlwaysOverprintBlack()) Flags |= 0x10; 00921 00922 ok = Rec.WriteBYTE(Flags); 00923 } 00924 00925 if (ok) 00926 pFilter->Write(&Rec); 00927 00928 #endif // EXCLUDE_FROM_RALPH 00929 return(ok); 00930 }
|
|
Export a TAG_PRINTERSETTINGS native file record.
Definition at line 731 of file princomp.cpp. 00732 { 00733 BOOL ok = TRUE; 00734 00735 #if !defined(EXCLUDE_FROM_RALPH) 00736 00737 // --- Write the record 00738 CXaraFileRecord Rec(TAG_PRINTERSETTINGS, TAG_PRINTERSETTINGS_SIZE); 00739 if (ok) ok = Rec.Init(); 00740 00741 INT32 Value; // Temp variable used by macros etc 00742 00743 // --- Macros. These are undefined immediately at the end of this function 00744 // --- Helper macro for safely exporting an enum as a BYTE value: 1, 2. Unknown enums are output as a 1. 00745 #define OutputEnum2(FuncName,A,B) \ 00746 if (ok) \ 00747 { \ 00748 switch(pPrCtrl->Get##FuncName()) \ 00749 { \ 00750 case A: Value=1; break; \ 00751 case B: Value=2; break; \ 00752 default: Value=1; ERROR3("Bad enum"); break; \ 00753 } \ 00754 ok = Rec.WriteBYTE((BYTE)Value); \ 00755 } 00756 00757 // --- Helper macro for safely exporting an enum as a BYTE value: 1, 2, 3. Unknown enums are output as a 1. 00758 #define OutputEnum3(FuncName,A,B,C) \ 00759 if (ok) \ 00760 { \ 00761 switch(pPrCtrl->Get##FuncName()) \ 00762 { \ 00763 case A: Value=1; break; \ 00764 case B: Value=2; break; \ 00765 case C: Value=3; break; \ 00766 default: Value=1; ERROR3("Bad enum"); break; \ 00767 } \ 00768 ok = Rec.WriteBYTE((BYTE)Value); \ 00769 } 00770 00771 // --- Helper macro for safely exporting an enum as a BYTE value: 1, 2, 3. Unknown enums are output as a 1. 00772 #define OutputEnum4(FuncName,A,B,C,D) \ 00773 if (ok) \ 00774 { \ 00775 switch(pPrCtrl->Get##FuncName()) \ 00776 { \ 00777 case A: Value=1; break; \ 00778 case B: Value=2; break; \ 00779 case C: Value=3; break; \ 00780 case D: Value=4; break; \ 00781 default: Value=1; ERROR3("Bad enum"); break; \ 00782 } \ 00783 ok = Rec.WriteBYTE((BYTE)Value); \ 00784 } 00785 00786 // --- Helper macro to output any 32-bit UNsigned value 00787 #define OutputValueU(FuncName) \ 00788 if (ok) ok = Rec.WriteUINT32((UINT32)pPrCtrl->Get##FuncName()); 00789 00790 // --- Helper macro to output any 32-bit Signed value 00791 #define OutputValueS(FuncName) \ 00792 if (ok) ok = Rec.WriteINT32((INT32)pPrCtrl->Get##FuncName()); 00793 00794 // --- Helper macro to output any 16-bit UNsigned value 00795 #define OutputValue16(FuncName) \ 00796 if (ok) ok = Rec.WriteUINT16((UINT16)pPrCtrl->Get##FuncName()); 00797 00798 00799 // Size Total 00800 OutputValueU(NumCopies); // 4 4 00801 if (ok) ok = Rec.WriteFIXED16(pPrCtrl->GetScale()); // 4 8 00802 OutputValueS(TopMargin); // 4 12 00803 OutputValueS(LeftMargin); // 4 16 00804 OutputValueS(Width); // 4 20 00805 OutputValueS(Height); // 4 24 00806 OutputValue16(Rows); // 2 26 00807 OutputValue16(Columns); // 2 28 00808 OutputValueS(Gutter); // 4 32 00809 OutputEnum3(PrintMethod, PRINTMETHOD_NORMAL, PRINTMETHOD_BITMAP, PRINTMETHOD_AABITMAP); // 1 33 00810 OutputEnum2(ObjPrintRange, PRINTRANGEOBJ_ALL, PRINTRANGEOBJ_SELECTED); // 1 34 00811 OutputEnum3(DPSPrintRange, PRINTRANGEDPS_BOTH, PRINTRANGEDPS_LEFTPAGES, PRINTRANGEDPS_RIGHTPAGES); 00812 // 1 35 00813 OutputEnum2(PrintOrient, PRINTORIENTATION_UPRIGHT, PRINTORIENTATION_SIDEWAYS); // 1 36 00814 OutputEnum4(FitType, PRINTFIT_BEST, PRINTFIT_CUSTOM, PRINTFIT_MULTIPLE, PRINTFIT_BESTPAPER); // 1 37 00815 OutputEnum2(PrintLayers, PRINTLAYERS_ALLFOREGROUND, PRINTLAYERS_VISIBLEFOREGROUND); // 1 38 00816 OutputEnum3(PSLevel, PSLEVEL_AUTO, PSLEVEL_1, PSLEVEL_2); // 1 39 00817 OutputEnum2(BitmapResMethod, BITMAPRES_AUTO, BITMAPRES_MANUAL); // 1 40 00818 // 00819 if (ok) // 00820 { // 00821 // If bitmap resolution is automatic, then just output a default of 150dpi for DotsPerInch // 00822 if (pPrCtrl->GetBitmapResMethod() == BITMAPRES_MANUAL) // 00823 Value = pPrCtrl->GetDotsPerInch(); // 00824 else // 00825 Value = 150; // 00826 // 00827 ok = Rec.WriteUINT32((UINT32) Value); // 4 44 00828 } // 00829 // 00830 if (ok) // 00831 { // 00832 Value = 0x00; // 00833 if (pPrCtrl->IsCollated()) Value |= 0x01; // 00834 if (pPrCtrl->IsWholeSpread()) Value |= 0x02; // 00835 if (pPrCtrl->GetPrintToFile()) Value |= 0x04; // 00836 if (pPrCtrl->GetTextOptions() == PRINTTEXTOPTIONS_ALLTEXTASSHAPES) // 00837 Value |= 0x08; // 00838 // 00839 ok = Rec.WriteBYTE((BYTE)Value); // 1 45 TOTAL 00840 } 00841 00842 // --- Finally, output the record 00843 if (ok) 00844 pFilter->Write(&Rec); 00845 00846 00847 // Undefine the macros we were using 00848 #undef OutputEnum2 00849 #undef OutputEnum3 00850 #undef OutputValueU 00851 #undef OutputValueS 00852 #undef OutputValue16 00853 #endif // EXCLUDE_FROM_RALPH 00854 00855 return(ok); 00856 }
|
|
The string representation of the token value is stored in Buffer. If no value is found, or the buffer overflows, Buffer will contain an empty string.
Definition at line 359 of file princomp.cpp. 00360 { 00361 Buffer[0] = '\0'; 00362 00363 if (pComment != NULL) 00364 { 00365 UINT32 i=0; 00366 00367 // Skip past token str, up to first space char or string terminating char 00368 while (!camIsspace(pComment[i]) && !camIscntrl(pComment[i])) 00369 i++; 00370 00371 // Find next non-space char 00372 while (camIsspace(pComment[i])) 00373 i++; 00374 00375 // Extract all the remaining printable characters 00376 UINT32 j=0; 00377 while (camIsprint(pComment[i]) && j < PC_BUFFERSIZE) 00378 Buffer[j++] = pComment[i++]; 00379 00380 if (j >= PC_BUFFERSIZE) 00381 j=0; 00382 00383 Buffer[j] = '\0'; 00384 } 00385 }
|
|
Definition at line 186 of file princomp.h. 00186 { return pPrCtrl; }
|
|
Outputs a print component token with the given value.
Definition at line 324 of file princomp.cpp. 00325 { 00326 UINT32 i; 00327 00328 for (i=0;!camIsspace(pComment[i]) && i < PC_BUFFERSIZE;i++) 00329 Buffer[i] = pComment[i]; 00330 00331 if (i >= PC_BUFFERSIZE) 00332 i=0; 00333 00334 Buffer[i] = '\0'; 00335 00336 for (i=0;i < PCTOKEN_UNKNOWN;i++) 00337 { 00338 if (camStrcmp(PCTokenStr[i],Buffer) == 0) 00339 return (PCToken)i; 00340 } 00341 00342 return PCTOKEN_UNKNOWN; 00343 }
|
|
This gets the value after the token part of the comment and returns it as a FIXED16.
Definition at line 424 of file princomp.cpp. 00425 { 00426 ExtractTokenValStr(pComment); 00427 00428 double n = 0.0; 00429 camSscanf( Buffer, _T("%le"), &n ); 00430 00431 if (n > double(0x7fff)) 00432 n = double(0x7fff); 00433 00434 if (n < double(-0x8000)) 00435 n = double(-0x8000); 00436 00437 return FIXED16(n); 00438 }
|
|
This gets the value after the token part of the comment and returns it as a INT32.
Definition at line 400 of file princomp.cpp. 00401 { 00402 ExtractTokenValStr(pComment); 00403 00404 INT32 n = 0; 00405 camSscanf( Buffer, _T("%ld"), &n ); 00406 00407 return n; 00408 }
|
|
Load a TAG_COLOURPLATE native file record.
Definition at line 1285 of file princomp.cpp. 01286 { 01287 #if !defined(EXCLUDE_FROM_RALPH) 01288 BOOL ok = TRUE; 01289 01290 PORTNOTETRACE("print","PrintComponent::ImportColourPlate - do nothing"); 01291 TypesetInfo *TInfo = GetPrintControl()->GetTypesetInfo(); 01292 if (TInfo == NULL) 01293 return; 01294 01295 ColourPlate *NewPlate = TInfo->CreateColourPlate(); 01296 if (NewPlate == NULL) 01297 return; 01298 01299 BYTE Type; 01300 if (ok) ok = Rec->ReadBYTE(&Type); 01301 01302 ColourPlateType PlateType = COLOURPLATE_NONE; 01303 if (ok) 01304 { 01305 switch(Type) 01306 { 01307 case 1: PlateType = COLOURPLATE_CYAN; break; 01308 case 2: PlateType = COLOURPLATE_MAGENTA; break; 01309 case 3: PlateType = COLOURPLATE_YELLOW; break; 01310 case 4: PlateType = COLOURPLATE_KEY; break; 01311 case 5: PlateType = COLOURPLATE_SPOT; break; 01312 } 01313 } 01314 01315 IndexedColour *pCol = NULL; 01316 if (ok) 01317 { 01318 INT32 ColRecordNum; 01319 ok = Rec->ReadINT32(&ColRecordNum); 01320 if (ok && PlateType == COLOURPLATE_SPOT) 01321 { 01322 DocColour SpotCol; 01323 ok = pHandler->GetDocColour(ColRecordNum, &SpotCol); 01324 if (ok) 01325 pCol = SpotCol.FindParentIndexedColour(); 01326 } 01327 } 01328 01329 // If this is a spot plate, it must reference a valid spot colour 01330 if (PlateType == COLOURPLATE_SPOT && 01331 (pCol == NULL || pCol->GetType() != COLOURTYPE_SPOT || pCol->IsDeleted()) ) 01332 { 01333 // Poohs. No point in keeping this plate around 01334 delete NewPlate; 01335 return; 01336 } 01337 01338 NewPlate->SetType(NULL, PlateType, pCol); 01339 01340 if (ok) 01341 { 01342 double Angle = 0.0; 01343 double Frequency = 60.0; 01344 01345 ok = Rec->ReadDOUBLE(&Angle); 01346 if (ok) ok = Rec->ReadDOUBLE(&Frequency); 01347 if (ok) NewPlate->SetScreenInfo(Angle, Frequency); 01348 } 01349 01350 BYTE Flags; 01351 if (ok) ok = Rec->ReadBYTE(&Flags); 01352 01353 if (ok) 01354 { 01355 NewPlate->SetDisabled( (Flags & 0x01) == 0); // NOTE Flag is ENabled state! 01356 NewPlate->SetOverprint((Flags & 0x02) != 0); 01357 } 01358 01359 01360 if (ok) 01361 { 01362 // Now, it'll be quite handy if we add the new plate to the plate list! 01363 TInfo->AddPlate(NewPlate); 01364 } 01365 #endif 01366 }
|
|
Load a TAG_IMAGESETTING native file record.
Definition at line 1195 of file princomp.cpp. 01196 { 01197 #if !defined(EXCLUDE_FROM_RALPH) 01198 PORTNOTETRACE("print","PrintComponent::ImportImagesetting - do nothing"); 01199 TypesetInfo *TInfo = GetPrintControl()->GetTypesetInfo(); 01200 if (TInfo == NULL) 01201 return; 01202 01203 // Vape any colour plates already resident in the typeset info 01204 TInfo->DestroyPlateList(); 01205 01206 BOOL ok = TRUE; 01207 01208 if (ok) 01209 { 01210 INT32 Res; 01211 ok = Rec->ReadINT32(&Res); 01212 if (ok) TInfo->SetPrintResolution(Res); 01213 } 01214 01215 if (ok) 01216 { 01217 double Freq; 01218 ok = Rec->ReadDOUBLE(&Freq); 01219 if (ok) TInfo->SetDefaultScreenFrequency(Freq); 01220 } 01221 01222 if (ok) 01223 { 01224 UINT16 Func; 01225 ok = Rec->ReadUINT16(&Func); 01226 01227 if (ok) 01228 { 01229 ScreenType Screen = SCRTYPE_NONE; 01230 switch(Func) 01231 { 01232 case 1: Screen = SCRTYPE_SPOT1; break; 01233 case 2: Screen = SCRTYPE_SPOT2; break; 01234 case 3: Screen = SCRTYPE_TRIPLESPOT1; break; 01235 case 4: Screen = SCRTYPE_TRIPLESPOT2; break; 01236 case 5: Screen = SCRTYPE_ELLIPTICAL; break; 01237 case 6: Screen = SCRTYPE_LINE; break; 01238 case 7: Screen = SCRTYPE_CROSSHATCH; break; 01239 case 8: Screen = SCRTYPE_MEZZOTINT; break; 01240 case 9: Screen = SCRTYPE_SQUARE; break; 01241 case 0: Screen = SCRTYPE_DITHER; break; 01242 } 01243 TInfo->SetScreenFunction(Screen, TRUE); 01244 } 01245 } 01246 01247 if (ok) 01248 { 01249 BYTE Flags; 01250 ok = Rec->ReadBYTE(&Flags); 01251 01252 TInfo->SetSeparations( (Flags & 0x01) != 0); 01253 TInfo->SetOutputPrintersMarks(TInfo->AreSeparating()); // Slave Printers Marks off the Seps flag 01254 01255 TInfo->SetScreening( (Flags & 0x02) != 0); 01256 TInfo->SetEmulsionDown( (Flags & 0x04) != 0); 01257 TInfo->SetPhotoNegative((Flags & 0x08) != 0); 01258 TInfo->SetOverprintBlack((Flags & 0x10) != 0); 01259 } 01260 #endif 01261 }
|
|
Load a TAG_PRINTERSETTINGS native file record.
Definition at line 1022 of file princomp.cpp. 01023 { 01024 #if !defined(EXCLUDE_FROM_RALPH) 01025 BOOL ok = TRUE; 01026 01027 PORTNOTETRACE("print","PrintComponent::ImportPrintSettings - do nothing"); 01028 // Let the print control object know we are importing the data rather than changing it via UI 01029 // This makes sure that setting some values does not auto-update other values! 01030 pPrCtrl->StartImport(); 01031 01032 // --- Macros. These are undefined immediately at the end of this function 01033 // --- Helper macro for safely importing an enum stored as a BYTE value: 1, 2. 01034 // Unknown enums are ignored - i.e. they retain the default program setting 01035 #define InputEnum2(FuncName,A,B) \ 01036 if (ok) \ 01037 { \ 01038 BYTE Value; \ 01039 ok = Rec->ReadBYTE(&Value); \ 01040 if (ok) \ 01041 { \ 01042 switch(Value) \ 01043 { \ 01044 case 1: pPrCtrl->Set##FuncName(A); break; \ 01045 case 2: pPrCtrl->Set##FuncName(B); break; \ 01046 default: ERROR3("Bad enum"); break; \ 01047 } \ 01048 } \ 01049 } 01050 01051 // --- Helper macro for safely exporting an enum as a BYTE value: 1, 2, 3. Unknown enums are Input as a 1. 01052 #define InputEnum3(FuncName,A,B,C) \ 01053 if (ok) \ 01054 { \ 01055 BYTE Value; \ 01056 ok = Rec->ReadBYTE(&Value); \ 01057 if (ok) \ 01058 { \ 01059 switch(Value) \ 01060 { \ 01061 case 1: pPrCtrl->Set##FuncName(A); break; \ 01062 case 2: pPrCtrl->Set##FuncName(B); break; \ 01063 case 3: pPrCtrl->Set##FuncName(C); break; \ 01064 default: ERROR3("Bad enum"); break; \ 01065 } \ 01066 } \ 01067 } 01068 01069 // --- Helper macro for safely exporting an enum as a BYTE value: 1, 2, 3. Unknown enums are Input as a 1. 01070 #define InputEnum4(FuncName,A,B,C,D) \ 01071 if (ok) \ 01072 { \ 01073 BYTE Value; \ 01074 ok = Rec->ReadBYTE(&Value); \ 01075 if (ok) \ 01076 { \ 01077 switch(Value) \ 01078 { \ 01079 case 1: pPrCtrl->Set##FuncName(A); break; \ 01080 case 2: pPrCtrl->Set##FuncName(B); break; \ 01081 case 3: pPrCtrl->Set##FuncName(C); break; \ 01082 case 4: pPrCtrl->Set##FuncName(D); break; \ 01083 default: ERROR3("Bad enum"); break; \ 01084 } \ 01085 } \ 01086 } 01087 01088 // --- Helper macro to Input any 32-bit UNsigned value 01089 #define InputValueU(FuncName) \ 01090 if (ok) \ 01091 { \ 01092 UINT32 Value; \ 01093 ok = Rec->ReadUINT32(&Value); \ 01094 if (ok) pPrCtrl->Set##FuncName(Value); \ 01095 } \ 01096 01097 // --- Helper macro to Input any 32-bit Signed value 01098 #define InputValueS(FuncName) \ 01099 if (ok) \ 01100 { \ 01101 INT32 Value; \ 01102 ok = Rec->ReadINT32(&Value); \ 01103 if (ok) pPrCtrl->Set##FuncName(Value); \ 01104 } \ 01105 01106 // --- Helper macro to Input any 16-bit UNsigned value (NOTE: Casts the result to a INT32) 01107 #define InputValue16(FuncName) \ 01108 if (ok) \ 01109 { \ 01110 UINT16 Value; \ 01111 ok = Rec->ReadUINT16(&Value); \ 01112 if (ok) pPrCtrl->Set##FuncName((INT32)Value); \ 01113 } \ 01114 01115 01116 // --- Read the record 01117 InputValueU(NumCopies); 01118 if (ok) 01119 { 01120 FIXED16 Value; 01121 ok = Rec->ReadFIXED16(&Value); 01122 if (ok) pPrCtrl->SetScale(Value); 01123 } 01124 InputValueS(TopMargin); 01125 InputValueS(LeftMargin); 01126 InputValueS(Width); 01127 InputValueS(Height); 01128 InputValue16(Rows); 01129 InputValue16(Columns); 01130 InputValueS(Gutter); 01131 InputEnum3(PrintMethod, PRINTMETHOD_NORMAL, PRINTMETHOD_BITMAP, PRINTMETHOD_AABITMAP); 01132 InputEnum2(ObjPrintRange, PRINTRANGEOBJ_ALL, PRINTRANGEOBJ_SELECTED); 01133 InputEnum3(DPSPrintRange, PRINTRANGEDPS_BOTH, PRINTRANGEDPS_LEFTPAGES, PRINTRANGEDPS_RIGHTPAGES); 01134 InputEnum2(PrintOrient, PRINTORIENTATION_UPRIGHT, PRINTORIENTATION_SIDEWAYS); 01135 InputEnum4(FitType, PRINTFIT_BEST, PRINTFIT_CUSTOM, PRINTFIT_MULTIPLE, PRINTFIT_BESTPAPER); 01136 InputEnum2(PrintLayers, PRINTLAYERS_ALLFOREGROUND, PRINTLAYERS_VISIBLEFOREGROUND); 01137 // Dirty bodge to ensure that all loaded XAR files use PSLEVEL_2 01138 // Job 10463: remove PS Level bits - default to Level 2 01139 // InputEnum3(PSLevel, PSLEVEL_AUTO, PSLEVEL_1, PSLEVEL_2); 01140 InputEnum3(PSLevel, PSLEVEL_2, PSLEVEL_2, PSLEVEL_2); 01141 InputEnum2(BitmapResMethod, BITMAPRES_AUTO, BITMAPRES_MANUAL); 01142 01143 if (ok) 01144 { 01145 UINT32 Value; 01146 ok = Rec->ReadUINT32(&Value); 01147 if (ok) pPrCtrl->SetDotsPerInch(Value); 01148 } 01149 01150 if (ok) 01151 { 01152 BYTE Value; 01153 ok = Rec->ReadBYTE(&Value); 01154 01155 if (ok) 01156 { 01157 pPrCtrl->SetCollated( (Value & 0x01) != 0); // Bit 1 indicates collated 01158 pPrCtrl->SetWholeSpread((Value & 0x02) != 0); // Bit 2 indicates whole spread 01159 pPrCtrl->SetPrintToFile((Value & 0x04) != 0); // Bit 3 indicates print-to-file 01160 01161 pPrCtrl->SetTextOptions(((Value & 0x08) != 0) ? PRINTTEXTOPTIONS_ALLTEXTASSHAPES : PRINTTEXTOPTIONS_NORMAL); 01162 // Bit 4 indicates print-text-as-shapes 01163 } 01164 } 01165 01166 // Let the print control object know we have finished importing (for the moment at least) 01167 pPrCtrl->EndImport(); 01168 01169 // Undefine the macros we were using 01170 #undef InputEnum2 01171 #undef InputEnum3 01172 #undef InputValueU 01173 #undef InputValueS 01174 #undef InputValue16 01175 01176 #endif 01177 }
|
|
Definition at line 471 of file princomp.cpp. 00472 { 00473 ERROR2IF(pExportDC == NULL,FALSE,"NULL export DC in PrintComponent::OutputValue()"); 00474 ERROR2IF(Token >= PCTOKEN_UNKNOWN,FALSE,"Token out of range"); 00475 00476 BOOL ok = TRUE; 00477 00478 if (ok) ok = pExportDC->OutputToken(PCTokenStr[Token]); 00479 if (ok) ok = pExportDC->OutputReal(Value.MakeDouble()); 00480 if (ok) ok = pExportDC->OutputNewLine(); 00481 return ok; 00482 }
|
|
Outputs a print component token with the given value.
Definition at line 456 of file princomp.cpp. 00457 { 00458 ERROR2IF(pExportDC == NULL,FALSE,"NULL export DC in PrintComponent::OutputValue()"); 00459 ERROR2IF(Token >= PCTOKEN_UNKNOWN,FALSE,"Token out of range"); 00460 00461 BOOL ok = TRUE; 00462 00463 if (ok) ok = pExportDC->OutputToken(PCTokenStr[Token]); 00464 if (ok) ok = pExportDC->OutputValue(Value); 00465 if (ok) ok = pExportDC->OutputNewLine(); 00466 00467 return ok; 00468 }
|
|
Process an EPS comment - if this is a print component comment, this component will claim it and try to decode it.
Reimplemented from DocComponent. Definition at line 591 of file princomp.cpp. 00593 { 00594 ERROR2IF(pPrCtrl == NULL,EPSCommentUnknown,"No print control to output in PrintComponent::ProcessEPSComment()"); 00595 00596 ProcessEPSResult Result = EPSCommentUnknown; 00597 00598 PCToken Token = GetToken(pComment); 00599 00600 if (Token != PCTOKEN_UNKNOWN) 00601 { 00602 // Let the print control object know we are importing the data rather than changing it via UI 00603 pPrCtrl->StartImport(); 00604 00605 Result = EPSCommentOK; 00606 00607 INT32 n = GetTokenValINT32(pComment); 00608 FIXED16 Scale = GetTokenValFIXED16(pComment); 00609 00610 switch (Token) 00611 { 00612 case PCTOKEN_SECTIONNAME: 00613 // 'n' is the version number for this comment block 00614 if (n != PC_SECTION_VERSION) 00615 Result = EPSCommentSyntaxError; 00616 break; 00617 00618 case PCTOKEN_WHOLESPREAD: pPrCtrl->SetWholeSpread(n); break; 00619 case PCTOKEN_SCALE: pPrCtrl->SetScale(Scale); break; 00620 case PCTOKEN_ORIENTATION: pPrCtrl->SetPrintOrient(PrintOrient(n)); break; 00621 case PCTOKEN_FITTYPE: pPrCtrl->SetFitType(PrintFitType(n)); break; 00622 case PCTOKEN_TOPMARGIN: pPrCtrl->SetTopMargin(n); break; 00623 case PCTOKEN_LEFTMARGIN: pPrCtrl->SetLeftMargin(n); break; 00624 case PCTOKEN_WIDTH: pPrCtrl->SetWidth(n); break; 00625 case PCTOKEN_HEIGHT: pPrCtrl->SetHeight(n); break; 00626 case PCTOKEN_ROWS: pPrCtrl->SetRows(n); break; 00627 case PCTOKEN_COLUMNS: pPrCtrl->SetColumns(n); break; 00628 case PCTOKEN_GUTTER: pPrCtrl->SetGutter(n); break; 00629 case PCTOKEN_LAYERS: pPrCtrl->SetPrintLayers(PrintLayers(n)); break; 00630 // Dirty bodge to ensure that PSLevel is always 2 00631 // Job 10463: remove PS Level bits - default to Level 2 00632 // case PCTOKEN_PSLEVEL: pPrCtrl->SetPSLevel(PSLevel(n)); break; 00633 case PCTOKEN_PSLEVEL: pPrCtrl->SetPSLevel(PSLEVEL_2); break; 00634 case PCTOKEN_BITMAPRESMETHOD: pPrCtrl->SetBitmapResMethod(BitmapResMethod(n)); break; 00635 case PCTOKEN_DOTSPERINCH: pPrCtrl->SetDotsPerInch(n); break; 00636 case PCTOKEN_COLLATED: pPrCtrl->SetCollated(n); break; 00637 case PCTOKEN_NUMCOPIES: pPrCtrl->SetNumCopies(n); break; 00638 case PCTOKEN_PRINTTOFILE: pPrCtrl->SetPrintToFile(n); break; 00639 case PCTOKEN_OBJPRINTRANGE: pPrCtrl->SetObjPrintRange(PrintRangeObj(n)); break; 00640 case PCTOKEN_DPSPRINTRANGE: pPrCtrl->SetDPSPrintRange(PrintRangeDPS(n)); break; 00641 case PCTOKEN_ALLTEXTASSHAPES: pPrCtrl->SetTextOptions((PrintTextOptions) n); break; 00642 // case PCTOKEN_PRINTMETHOD: pPrCtrl->SetPrintMethod(PrintMethodType(n)); break; 00643 default: 00644 break; 00645 } 00646 00647 // Let the print control object know we have finished importing (for the moment at least) 00648 pPrCtrl->EndImport(); 00649 } 00650 return Result; 00651 }
|
|
Writes out the print control object in the form of EPS comments in the 'header' comments of the EPS file.
Reimplemented from DocComponent. Definition at line 501 of file princomp.cpp. 00502 { 00503 // Graeme (23-5-00) - Neither AI nor ArtWorks files need the print control entries, so 00504 // just return TRUE to avoid problems. 00505 if ( !pFilter->NeedsPrintComponents () ) 00506 { 00507 return TRUE; 00508 } 00509 00510 ERROR2IF ( pPrCtrl == NULL, FALSE, 00511 "No print control to output in PrintComponent::WriteEPSComments()" ); 00512 00513 00514 // Set up the export DC ptr 00515 pExportDC = pFilter->GetExportDC(); 00516 00517 ERROR2IF(pExportDC == NULL,FALSE,"Export DC is NULL in PrintComponent::WriteEPSComments()"); 00518 00519 BOOL ok = TRUE; 00520 00521 if (ok) ok = OutputValue(PCTOKEN_SECTIONNAME, PC_SECTION_VERSION); 00522 00523 if (ok) ok = OutputValue(PCTOKEN_WHOLESPREAD, pPrCtrl->IsWholeSpread()); 00524 if (ok) ok = OutputValue(PCTOKEN_SCALE, pPrCtrl->GetScale()); 00525 if (ok) ok = OutputValue(PCTOKEN_ORIENTATION, pPrCtrl->GetPrintOrient()); 00526 if (ok) ok = OutputValue(PCTOKEN_FITTYPE, pPrCtrl->GetFitType()); 00527 if (ok) ok = OutputValue(PCTOKEN_TOPMARGIN, pPrCtrl->GetTopMargin()); 00528 if (ok) ok = OutputValue(PCTOKEN_LEFTMARGIN, pPrCtrl->GetLeftMargin()); 00529 if (ok) ok = OutputValue(PCTOKEN_WIDTH, pPrCtrl->GetWidth()); 00530 if (ok) ok = OutputValue(PCTOKEN_HEIGHT, pPrCtrl->GetHeight()); 00531 if (ok) ok = OutputValue(PCTOKEN_ROWS, pPrCtrl->GetRows()); 00532 if (ok) ok = OutputValue(PCTOKEN_COLUMNS, pPrCtrl->GetColumns()); 00533 if (ok) ok = OutputValue(PCTOKEN_GUTTER, pPrCtrl->GetGutter()); 00534 if (ok) ok = OutputValue(PCTOKEN_LAYERS, pPrCtrl->GetPrintLayers()); 00535 if (ok) ok = OutputValue(PCTOKEN_PSLEVEL, pPrCtrl->GetPSLevel()); 00536 if (ok) ok = OutputValue(PCTOKEN_BITMAPRESMETHOD, pPrCtrl->GetBitmapResMethod()); 00537 00538 // We only need to output the bitmap DPI if the user has selected 'manual' bitmap DPI 00539 // Auto DPI will calculated the DPI automatically ( surprise, surprise - Cilla 'ere!) 00540 // This also means that the printer's DPI is not needed before saving, hence avoiding any unnecessary 00541 // delays. 00542 if (ok) 00543 { 00544 if (pPrCtrl->GetBitmapResMethod() == BITMAPRES_MANUAL) 00545 ok = OutputValue(PCTOKEN_DOTSPERINCH, pPrCtrl->GetDotsPerInch()); 00546 else 00547 ok = OutputValue(PCTOKEN_DOTSPERINCH, 150); 00548 } 00549 00550 if (ok) ok = OutputValue(PCTOKEN_COLLATED, pPrCtrl->IsCollated()); 00551 if (ok) ok = OutputValue(PCTOKEN_NUMCOPIES, pPrCtrl->GetNumCopies()); 00552 if (ok) ok = OutputValue(PCTOKEN_PRINTTOFILE, pPrCtrl->GetPrintToFile()); 00553 if (ok) ok = OutputValue(PCTOKEN_OBJPRINTRANGE, pPrCtrl->GetObjPrintRange()); 00554 if (ok) ok = OutputValue(PCTOKEN_DPSPRINTRANGE, pPrCtrl->GetDPSPrintRange()); 00555 if (ok) ok = OutputValue(PCTOKEN_ALLTEXTASSHAPES, pPrCtrl->GetTextOptions()); 00556 // if (ok) ok = OutputValue(PCTOKEN_PRINTMETHOD, pPrCtrl->GetPrintMethod()); 00557 00558 // reset the DC ptr to NULL (ready for next time) 00559 pExportDC = NULL; 00560 00561 return ok; 00562 }
|
|
Definition at line 220 of file princomp.h. |
|
Definition at line 219 of file princomp.h. |
|
Definition at line 218 of file princomp.h. |