filters

aiparserbase.cc

00001 /* This file is part of the KDE project
00002    Copyright (C) 2002, Dirk Schönberger <dirk.schoenberger@sz-online.de>
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License as published by the Free Software Foundation; either
00007    version 2 of the License, or (at your option) any later version.
00008 
00009    This library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this library; see the file COPYING.LIB.  If not, write to
00016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017  * Boston, MA 02110-1301, USA.
00018 */
00019 
00020 #include "aiparserbase.h"
00021 #include "ai88handler.h"
00022 #include "ai3handler.h"
00023 #include <qregexp.h>
00024 #include <qstringlist.h>
00025 
00026 typedef struct {
00027   char* op;
00028   AIOperation action;
00029 } AIOperationMapping;
00030 
00031 typedef struct {
00032   char* op;
00033   PSOperation action;
00034 } PSOperationMapping;
00035 
00036 typedef struct {
00037   char* op;
00038   CommentOperation action;
00039 } CommentOperationMapping;
00040 
00041 static AIOperationMapping aiMappings[] = {
00042   { "k", AIO_SetFillColorCMYK },
00043   { "K", AIO_SetStrokeColorCMYK },
00044   { "g", AIO_SetFillColorGray },
00045   { "G", AIO_SetStrokeColorGray },
00046   { "x", AIO_SetFillColorCustom },
00047   { "X", AIO_SetStrokeColorCustom },
00048   { "p", AIO_SetFillPattern },
00049   { "P", AIO_SetStrokePattern },
00050   { "O", AIO_SetFillOverprinting },
00051   { "R", AIO_SetStrokeOverprinting },
00052   { "i", AIO_SetFlatness },
00053   { "J", AIO_SetLineCap },
00054   { "j", AIO_SetLineJoin },
00055   { "M", AIO_SetMiterLimit },
00056   { "w", AIO_SetLineWidth },
00057   { "d", AIO_SetDash },
00058   { "q", AIO_BeginGroupClip },
00059   { "Q", AIO_EndGroupClip },
00060   { "m", AIO_MoveTo },
00061   { "l", AIO_LineToSmooth },
00062   { "L", AIO_LineToCorner },
00063   { "c", AIO_CurveToSmooth },
00064   { "C", AIO_CurveToCorner },
00065 
00066   { "v", AIO_CurveToOmitC1Smooth },
00067   { "V", AIO_CurveToOmitC1Corner },
00068   { "y", AIO_CurveToOmitC2Smooth },
00069   { "Y", AIO_CurveToOmitC2Corner },
00070 
00071   { "H", AIO_PathIgnoreNoReset },
00072   { "h", AIO_PathIgnoreNoResetClose },
00073   { "W", AIO_PathClipPath },
00074   { "N", AIO_PathIgnoreReset },
00075   { "n", AIO_PathIgnoreResetClose },
00076   { "F", AIO_PathFillNonZero },
00077   { "f", AIO_PathFillNonZeroClose },
00078   { "B", AIO_PathFillNoReset },
00079   { "b", AIO_PathFillNoResetClose },
00080   { "S", AIO_PathStroke },
00081   { "s", AIO_PathStrokeClose },
00082   { "D", AIO_SetWindingOrder },
00083   { "Z", AIO_FontEncoding },
00084   { "E", AIO_PatternDefinition },
00085   { "A", AIO_LockElement },
00086 
00087   { "z", AIO_SetCurrentText },
00088   { "a", AIO_TextBlockFillStroke },
00089   { "e", AIO_TextBlockFill },
00090   { "I", AIO_TextBlockAppend },
00091   { "o", AIO_TextBlockIgnore },
00092   { "r", AIO_TextBlockStroke },
00093   { "t", AIO_TextOutput },
00094   { "T", AIO_TextBlockEnd },
00095   { "`", AIO_GsaveIncludeDocument },
00096   { "~", AIO_Grestore },
00097 
00098   { "u", AIO_BeginGroupNoClip },
00099   { "U", AIO_EndGroupNoClip },
00100   { "*u", AIO_BeginCombination },
00101   { "*U", AIO_EndCombination },
00102 
00103   { "XR", AIO_SetFillMode },
00104 
00105   { NULL, AIO_Other }
00106 };
00107 
00108 static PSOperationMapping psMappings[] = {
00109   { "get", PSO_Get },
00110   { "exec", PSO_Exec },
00111   { "string", PSO_String },
00112   { "bind", PSO_Bind },
00113   { "def", PSO_Def },
00114   { "userdict", PSO_Userdict },
00115   { "dict", PSO_Dict },
00116   { "dup", PSO_Dup },
00117   { "begin", PSO_Begin },
00118   { "put", PSO_Put },
00119   { NULL, PSO_Other },
00120 };
00121 
00122 static CommentOperationMapping commentMappings[] = {
00123   { "BeginProlog", CO_BeginProlog },
00124   { "BeginSetup", CO_BeginSetup },
00125   { "BeginProcSet", CO_BeginProcSet },
00126   { "BeginResource", CO_BeginResource },
00127   { "BeginEncoding", CO_BeginEncoding },
00128   { "BeginPattern", CO_BeginPattern },
00129   { "BeginDocument", CO_BeginPattern },
00130   { "Trailer", CO_Trailer },
00131   { "EndProlog", CO_EndProlog },
00132   { "EndSetup", CO_EndSetup },
00133   { "EndProcSet", CO_EndProcSet },
00134   { "EndResource", CO_EndResource },
00135   { "EndEncoding", CO_EndEncoding },
00136   { "EndPattern", CO_EndPattern },
00137   { "EndDocument", CO_EndDocument },
00138 
00139   { "Title", CO_Title },
00140   { "Creator", CO_Creator },
00141 
00142   { "EOF", CO_Ignore },
00143   { "Note", CO_Ignore },
00144   { "EndComments", CO_Ignore },
00145   { "PS-Adobe", CO_Ignore },
00146 
00147   { "BoundingBox", CO_BoundingBox },
00148   { "TemplateBox", CO_TemplateBox },
00149   { "AI3_Margin", CO_Margin },
00150 
00151   { "For", CO_For },
00152   { "CreationDate",  CO_CreationDate },
00153   { "DocumentFonts",  CO_DocumentFonts },
00154   { "DocumentFiles",  CO_DocumentFiles },
00155   { "ColorUsage",  CO_ColorUsage },
00156   { "DocumentProcSets",  CO_DocumentProcSets },
00157   { "DocumentSuppliedProcSets", CO_DocumentSuppliedProcSets },
00158 
00159   { "DocumentProcessColors",  CO_DocumentProcessColors },
00160   { "DocumentCustomColors",  CO_DocumentCustomColors },
00161   { "CMYKCustomColor", CO_CMYKCustomColor },
00162   { "TileBox",  CO_TileBox },
00163   { "%+",  CO_Continuation },
00164 
00165   { "Template",  CO_Template },
00166   { "PageOrigin",  CO_PageOrigin },
00167   { "PrinterName",  CO_PrinterName },
00168   { "PrinterRect",  CO_PrinterRect },
00169   { "Note",  CO_Note },
00170 
00171   { "DocumentNeededResources", CO_DocumentNeededResources },
00172 
00173 
00174   { "IncludeFont",  CO_IncludeFont },
00175   { "BeginBrushPattern", CO_BeginBrushPattern },
00176   { "EndBrushPattern", CO_EndBrushPattern },
00177   { "BeginGradient", CO_BeginGradient },
00178   { "EndGradient", CO_EndGradient },
00179   { "BeginPalette", CO_BeginPalette },
00180   { "EndPalette", CO_EndPalette },
00181 
00182   { "IncludeFile", CO_IncludeFile },
00183   { "IncludeResource", CO_IncludeResource },
00184 
00185   { NULL, CO_Other }
00186 };
00187 
00188 AIParserBase::AIParserBase() : m_debug(false), m_ignoring(false), m_sink (DS_Other), m_continuationMode(CM_None)
00189  {
00190   m_gstateHandler = NULL;
00191   m_structureHandler = NULL;
00192   m_pathHandler = NULL;
00193   m_miscGStateHandler = NULL;
00194   m_documentHandler = NULL;
00195   m_moduleHandler = NULL;
00196   m_embeddedHandler = NULL;
00197   m_ai88Handler = new AI88Handler(this);
00198   m_ai3Handler = new AI3Handler(this);
00199 }
00200 
00201 AIParserBase::~AIParserBase(){
00202   delete m_ai88Handler;
00203   delete m_ai3Handler;
00204 
00205 }
00206 
00207 bool AIParserBase::parse (QIODevice& fin){
00208   return AILexer::parse (fin);
00209 }
00210 
00211 void AIParserBase::gotComment (const char *value) {
00212   int llx, lly, urx, ury;
00213 
00214   CommentOperation cop = getCommentOperation (value);
00215   switch (cop) {
00216     case CO_BeginDocument :
00217        if (m_moduleHandler) m_moduleHandler->gotBeginSection (ST_Document, value);
00218        break;
00219     case CO_EndDocument :
00220        if (m_moduleHandler) m_moduleHandler->gotBeginSection (ST_Document, value);
00221        break;
00222     case CO_BeginPattern :
00223        if (m_moduleHandler) m_moduleHandler->gotBeginSection (ST_Pattern, value);
00224        break;
00225     case CO_EndPattern :
00226        if (m_moduleHandler) m_moduleHandler->gotBeginSection (ST_Pattern, value);
00227        break;
00228     case CO_BeginProlog :
00229        if (m_moduleHandler) m_moduleHandler->gotBeginSection (ST_Prolog, value);
00230        break;
00231     case CO_BeginProcSet :
00232        if (m_moduleHandler) m_moduleHandler->gotBeginSection (ST_ProcSet, value);
00233        if (m_debug) qDebug ("start ignoring");
00234        m_ignoring = true;
00235        break;
00236     case CO_BeginResource :
00237        if (m_moduleHandler) m_moduleHandler->gotBeginSection (ST_Resource, value);
00238        if (m_debug) qDebug ("start ignoring");
00239        m_ignoring = true;
00240        break;
00241     case CO_BeginEncoding :
00242        if (m_moduleHandler) m_moduleHandler->gotBeginSection (ST_Encoding, value);
00243        m_ignoring = false;
00244        break;
00245     case CO_IncludeFont :
00246        if (m_debug) qDebug ("start ignoring");
00247        m_ignoring = true;
00248        break;
00249     case CO_BeginBrushPattern :
00250        if (m_moduleHandler) m_moduleHandler->gotBeginSection (ST_BrushPattern, value);
00251        break;
00252     case CO_BeginGradient :
00253        if (m_moduleHandler) m_moduleHandler->gotBeginSection (ST_Gradient, value);
00254        break;
00255     case CO_Trailer :
00256        if (m_debug) qDebug ("start ignoring");
00257        m_ignoring = true;
00258        break;
00259     case CO_BeginPalette :
00260        if (m_moduleHandler) m_moduleHandler->gotBeginSection (ST_Palette, value);
00261        break;
00262     case CO_BeginSetup :
00263        if (m_moduleHandler) m_moduleHandler->gotBeginSection (ST_Setup, value);
00264        break;
00265     case CO_EndSetup :
00266        cleanupArrays();
00267        if (m_moduleHandler) m_moduleHandler->gotEndSection (ST_Setup, value);
00268        break;
00269     case CO_EndProlog :
00270        if (m_moduleHandler) m_moduleHandler->gotEndSection (ST_Prolog, value);
00271        break;
00272     case CO_EndProcSet :
00273        if (m_moduleHandler) m_moduleHandler->gotEndSection (ST_ProcSet, value);
00274        if (m_debug) qDebug ("stop ignoring");
00275        m_ignoring = false;
00276        break;
00277     case CO_EndResource :
00278        if (m_moduleHandler) m_moduleHandler->gotEndSection (ST_Resource, value);
00279        if (m_debug) qDebug ("stop ignoring");
00280        m_ignoring = false;
00281        break;
00282     case CO_EndEncoding :
00283        cleanupArrays();
00284        if (m_moduleHandler) m_moduleHandler->gotEndSection (ST_Encoding, value);
00285        break;
00286     case CO_EndBrushPattern :
00287        cleanupArrays();
00288        if (m_moduleHandler) m_moduleHandler->gotEndSection (ST_BrushPattern, value);
00289        break;
00290     case CO_EndGradient :
00291        cleanupArrays();
00292        if (m_moduleHandler) m_moduleHandler->gotEndSection (ST_Gradient, value);
00293        break;
00294     case CO_EndPalette :
00295        cleanupArrays();
00296        if (m_moduleHandler) m_moduleHandler->gotEndSection (ST_Palette, value);
00297        break;
00298     case CO_Ignore :
00299       break;
00300     case CO_BoundingBox :
00301       if (getRectangle (value, llx, lly, urx, ury))
00302       {
00303         if (m_documentHandler) m_documentHandler->gotBoundingBox (llx, lly, urx, ury);
00304       }
00305       break;
00306     case CO_TemplateBox :
00307       if (getRectangle (value, llx, lly, urx, ury))
00308       {
00309         if (m_documentHandler) m_documentHandler->gotTemplateBox (llx, lly, urx, ury);
00310       }
00311       break;
00312     case CO_Margin :
00313       if (getRectangle (value, llx, lly, urx, ury))
00314       {
00315         if (m_documentHandler) m_documentHandler->gotMargin (llx, lly, urx, ury);
00316       }
00317       break;
00318     case CO_Title :
00319       if (m_documentHandler) m_documentHandler->gotTitle (getValue (value));
00320       break;
00321     case CO_Creator :
00322       if (m_documentHandler) m_documentHandler->gotCreator (getValue (value));
00323       break;
00324     case CO_DocumentFonts :
00325       _handleDocumentFonts (value);
00326       m_continuationMode = CM_DocumentFonts;
00327       break;
00328     case CO_DocumentFiles :
00329       _handleDocumentFiles (value);
00330       m_continuationMode = CM_DocumentFiles;
00331       break;
00332     case CO_DocumentCustomColors :
00333       _handleDocumentCustomColors (value);
00334       m_continuationMode = CM_DocumentFiles;
00335       break;
00336     case CO_CMYKCustomColor :
00337       _handleCMYKCustomColor (value);
00338       m_continuationMode = CM_CMYKCustomColor;
00339       break;
00340     case CO_DocumentNeededResources :
00341       _handleDocumentNeededResources (value);
00342       m_continuationMode = CM_DocumentNeededResources;
00343       break;
00344     case CO_DocumentProcessColors :
00345       _handleDocumentProcessColors (value);
00346       break;
00347     case CO_CreationDate :
00348       _handleCreationDate (value);
00349       break;
00350     case CO_IncludeFile :
00351       break;
00352     case CO_IncludeResource :
00353       _handleIncludeResource (value);
00354       break;
00355     case CO_Continuation :
00356       switch (m_continuationMode) {
00357         case CM_DocumentFonts : _handleDocumentFonts (value); break;
00358         case CM_DocumentFiles : _handleDocumentFiles (value); break;
00359         case CM_DocumentCustomColors : _handleDocumentCustomColors (value); break;
00360         case CM_CMYKCustomColor :  _handleCMYKCustomColor (value); break;
00361         case CM_DocumentNeededResources :  _handleDocumentNeededResources (value); break;
00362 
00363         default : qWarning ("unknown continuation mode %d",m_continuationMode);
00364       }
00365       break;
00366 
00367     default :
00368       qWarning( "unhandled comment: %s", value );
00369   }
00370 }
00371 
00372 void AIParserBase::handleElement (AIElement &element)
00373 {
00374   if (m_ignoring) return;
00375 
00376   if (m_sink == DS_Array)
00377   {
00378     if (m_debug) qDebug ("in mode array");
00379     QValueVector<AIElement> &elementArray = m_arrayStack.top();
00380     elementArray.push_back(element);
00381   }
00382   if (m_sink == DS_Block)
00383   {
00384     if (m_debug) qDebug ("in mode block");
00385     QValueVector<AIElement> &elementArray = m_blockStack.top();
00386     elementArray.push_back(element);
00387   }
00388   else
00389   {
00390     if (m_debug) qDebug ("in mode stack");
00391     m_stack.push (element);
00392   }
00393 }
00394 
00395 void AIParserBase::gotIntValue (int value) {
00396   if (m_debug) qDebug ("got int value");
00397   if (m_ignoring) return;
00398   AIElement element (value);
00399   handleElement (element);
00400   if (m_debug) qDebug ("/got int value");
00401 }
00402 
00403 void AIParserBase::gotDoubleValue (double value) {
00404   if (m_debug) qDebug ("got double value");
00405   if (m_ignoring) return;
00406   AIElement element (value);
00407   handleElement (element);
00408   if (m_debug) qDebug ("/got double value");
00409 }
00410 
00411 void AIParserBase::gotStringValue (const char *value) {
00412   if (m_debug) qDebug ("got string value");
00413   if (m_ignoring) return;
00414   if (value == NULL) value = "";
00415   if (m_debug) qDebug ("string: %s", value);
00416   AIElement element (value);
00417   handleElement (element);
00418   if (m_debug) qDebug ("/got string value");
00419 
00420 }
00421 
00422 void AIParserBase::gotReference (const char *value) {
00423   if (m_debug) qDebug ("got reference value");
00424 
00425   if (m_ignoring) return;
00426   if (value == NULL) value = "";
00427   if (m_debug) qDebug ("reference: %s", value);
00428   QString string(value);
00429   AIElement element (string, AIElement::Reference);
00430   handleElement (element);
00431   if (m_debug) qDebug ("/got reference value");
00432 
00433 }
00434 
00435 void AIParserBase::gotByte (uchar value) {
00436   if (m_debug) qDebug ("got byte value");
00437 
00438   if (m_ignoring) return;
00439   AIElement element (value);
00440   handleElement (element);
00441   if (m_debug) qDebug ("/got byte value");
00442 }
00443 
00444 void AIParserBase::gotByteArray (const QByteArray &data) {
00445   if (m_ignoring) return;
00446   AIElement element (data);
00447   handleElement (element);
00448 }
00449 
00450 
00451 void AIParserBase::gotArrayStart () {
00452   if (m_ignoring) return;
00453   if (m_debug) qDebug ("got array start");
00454 
00455   QValueVector<AIElement> array;
00456   m_arrayStack.push (array);
00457 
00458   m_sink = DS_Array;
00459 }
00460 
00461 void AIParserBase::gotBlockStart () {
00462   if (m_ignoring) return;
00463   if (m_debug) qDebug ("got block start");
00464 
00465   QValueVector<AIElement> array;
00466   m_blockStack.push (array);
00467 
00468   m_sink = DS_Block;
00469 }
00470 
00471 void AIParserBase::gotArrayEnd () {
00472   if (m_ignoring) return;
00473   if (m_debug) qDebug ("got array end");
00474 
00475   QValueVector<AIElement> stackArray = m_arrayStack.pop();
00476 
00477   if (m_arrayStack.empty())
00478   {
00479     if (m_debug) qDebug ("put elements to stack");
00480     AIElement realElement (stackArray);
00481 
00482     if (m_debug) {
00483       qDebug ("going to stack");
00484       elementtoa (realElement);
00485       qDebug ("done");
00486     }
00487     m_stack.push (realElement);
00488 
00489     m_sink = DS_Other;
00490   }
00491   else
00492   {
00493     if (m_debug) qDebug ("put elements to nest stack level");
00494     QValueVector<AIElement> currentTOS = m_arrayStack.top();
00495     currentTOS.push_back (stackArray);
00496   }
00497 }
00498 
00499 void AIParserBase::gotBlockEnd () {
00500   if (m_ignoring) return;
00501   if (m_debug) qDebug ("got block end");
00502 
00503   QValueVector<AIElement> stackArray = m_blockStack.pop();
00504 
00505   if (m_blockStack.empty())
00506   {
00507     if (m_debug) qDebug ("put elements to stack");
00508     AIElement realElement (stackArray, AIElement::Block);
00509 
00510     if (m_debug) {
00511       qDebug ("going to stack");
00512       elementtoa (realElement);
00513       qDebug ("done");
00514     }
00515     m_stack.push (realElement);
00516 
00517     m_sink = DS_Other;
00518   }
00519   else
00520   {
00521     if (m_debug) qDebug ("put elements to nest stack level");
00522     QValueVector<AIElement> currentTOS = m_blockStack.top();
00523     currentTOS.push_back (stackArray);
00524   }
00525 }
00526 
00527 /*Ai88*/ /* void AIParserBase::_handleSetDash()
00528 {
00529   double fval = getDoubleValue();
00530 
00531   AIElement elem (m_stack.top());
00532   m_stack.pop();
00533 
00534   const QValueVector<AIElement> aval = elem.toElementArray();
00535   if (m_gstateHandler) m_gstateHandler->gotDash (aval, fval);
00536 } */
00537 
00538 /*Ai88*/ /* void AIParserBase::_handleSetFillColorCMYK()
00539 {
00540   double k = getDoubleValue();
00541   double y = getDoubleValue();
00542   double m = getDoubleValue();
00543   double c = getDoubleValue();
00544 
00545   if (m_debug) qDebug ("values 1 are %f %f %f %f",c,m,y,k);
00546   AIColor color (c,m,y,k);
00547 
00548   if (m_gstateHandler) m_gstateHandler->gotFillColor (color);
00549 } */
00550 
00551 /*Ai88*/ /* void AIParserBase::_handleSetFillPattern()
00552 {
00553   AIElement elem (m_stack.top());
00554   m_stack.pop();
00555 
00556   const QValueVector<AIElement> aval = elem.toElementArray();
00557 
00558   double ka = getDoubleValue();
00559   double k = getDoubleValue();
00560   double r = getDoubleValue();
00561   double rf = getDoubleValue();
00562   double angle = getDoubleValue();
00563   double sy = getDoubleValue();
00564   double sx = getDoubleValue();
00565   double py = getDoubleValue();
00566   double px = getDoubleValue();
00567 
00568   AIElement elem2 (m_stack.top());
00569   m_stack.pop();
00570 
00571   const QString &name = elem2.toString();
00572   if (m_gstateHandler) m_gstateHandler->gotFillPattern (name.latin1(), px, py, sx, sy, angle, rf, r, k, ka, aval);
00573 } */
00574 
00575 /*Ai88*/ /* void AIParserBase::_handleSetStrokePattern()
00576 {
00577   AIElement elem (m_stack.top());
00578   m_stack.pop();
00579 
00580   const QValueVector<AIElement> aval = elem.toElementArray();
00581 
00582   double ka = getDoubleValue();
00583   double k = getDoubleValue();
00584   double r = getDoubleValue();
00585   double rf = getDoubleValue();
00586   double angle = getDoubleValue();
00587   double sy = getDoubleValue();
00588   double sx = getDoubleValue();
00589   double py = getDoubleValue();
00590   double px = getDoubleValue();
00591 
00592   AIElement elem2 (m_stack.top());
00593   m_stack.pop();
00594 
00595   const QString &name = elem2.toString();
00596   if (m_gstateHandler) m_gstateHandler->gotStrokePattern (name.latin1(), px, py, sx, sy, angle, rf, r, k, ka, aval);
00597 } */
00598 
00599 /*Ai88*/ /* void AIParserBase::_handleSetStrokeColorCMYK()
00600 {
00601   double k = getDoubleValue();
00602   double y = getDoubleValue();
00603   double m = getDoubleValue();
00604   double c = getDoubleValue();
00605   if (m_debug) qDebug ("values 2 are %f %f %f %f",c,m,y,k);
00606 
00607   AIColor color (c,m,y,k);
00608 
00609   if (m_gstateHandler) m_gstateHandler->gotStrokeColor (color);
00610 } */
00611 
00612 /*Ai88*/ /* void AIParserBase::_handleSetFillColorGray()
00613 {
00614   double g = getDoubleValue();
00615   if (m_debug) qDebug ("values 3 are %f",g);
00616 
00617   AIColor color (g);
00618 
00619   if (m_gstateHandler) m_gstateHandler->gotFillColor (color);
00620 } */
00621 
00622 /*Ai88*/ /* void AIParserBase::_handleSetStrokeColorGray()
00623 {
00624   double g = getDoubleValue();
00625   if (m_debug) qDebug ("values 4 are %f",g);
00626 
00627   AIColor color (g);
00628 
00629   if (m_gstateHandler) m_gstateHandler->gotStrokeColor (color);
00630 } */
00631 
00632 /*Ai88*/ /* void AIParserBase::_handleSetFillColorCustom()
00633 {
00634   double g = getDoubleValue();
00635   const QString &name = getStringValue();
00636   double k = getDoubleValue();
00637   double y = getDoubleValue();
00638   double m = getDoubleValue();
00639   double c = getDoubleValue();
00640   if (m_debug) qDebug ("values 5 are %f %f %f %f",c,m,y,k);
00641 
00642   AIColor color (c,m,y,k,name.latin1(),g);
00643 
00644   if (m_gstateHandler) m_gstateHandler->gotFillColor (color);
00645 } */
00646 
00647 void AIParserBase::_handlePSGet() {
00648   m_stack.pop();
00649   m_stack.pop();
00650 
00651   QString name ("xxx");
00652   AIElement ref (name,AIElement::Reference);
00653   m_stack.push (ref);
00654 }
00655 
00656 void AIParserBase::_handlePSExec() {
00657   m_stack.pop();
00658 }
00659 
00660 void AIParserBase::_handlePSString() {
00661   m_stack.pop();
00662 
00663   QString name ("stringval");
00664   AIElement ref (name,AIElement::Reference);
00665   m_stack.push (ref);
00666 }
00667 
00668 void AIParserBase::_handlePSBind() {
00669   m_stack.pop();
00670 
00671   QString name ("bindentry");
00672   AIElement ref (name,AIElement::Reference);
00673   m_stack.push (ref);
00674 }
00675 
00676 void AIParserBase::_handlePSUserdict() {
00677   QString name ("userdict");
00678   AIElement ref (name,AIElement::Reference);
00679   m_stack.push (ref);
00680 }
00681 
00682 void AIParserBase::_handlePSDict() {
00683   m_stack.pop();
00684   m_stack.pop();
00685   m_stack.pop();
00686 
00687   QString name ("dict");
00688   AIElement ref (name,AIElement::Reference);
00689   m_stack.push (ref);
00690 }
00691 
00692 void AIParserBase::_handlePSDup() {
00693   AIElement &tos = m_stack.top();
00694 
00695   AIElement copy (tos);
00696   m_stack.push (copy);
00697 }
00698 
00699 void AIParserBase::_handlePSBegin() {
00700   m_stack.pop();
00701 
00702   QString name ("dictionary begin");
00703   AIElement ref (name,AIElement::Reference);
00704   m_stack.push (ref);
00705 }
00706 
00707 void AIParserBase::_handlePSPut() {
00708   m_stack.pop();
00709   m_stack.pop();
00710 }
00711 
00712 /*Ai88*/ /* void AIParserBase::_handlePatternDefinition()
00713 {
00714   AIElement elem (m_stack.top());
00715   m_stack.pop();
00716 
00717   const QValueVector<AIElement> aval = elem.toElementArray();
00718 
00719   double ury = getDoubleValue();
00720   double urx = getDoubleValue();
00721   double lly = getDoubleValue();
00722   double llx = getDoubleValue();
00723 
00724   AIElement elem2 (m_stack.top());
00725   m_stack.pop();
00726 
00727   const QString &name = elem2.toString();
00728 
00729   if (m_documentHandler) m_documentHandler->gotPatternDefinition (name.latin1(), aval, llx, lly, urx, ury);
00730 } */
00731 
00732 void AIParserBase::_handlePSDef() {
00733   // name ref
00734   m_stack.pop();
00735 
00736   // impl
00737   m_stack.pop();
00738 }
00739 
00740 /*Ai88*/ /* void AIParserBase::_handleSetStrokeColorCustom()
00741 {
00742   double g = getDoubleValue();
00743   const QString &name = getStringValue();
00744   double k = getDoubleValue();
00745   double y = getDoubleValue();
00746   double m = getDoubleValue();
00747   double c = getDoubleValue();
00748   if (m_debug) qDebug ("values 6 are %f %f %f %f",c,m,y,k);
00749 
00750   AIColor color (c,m,y,k,name.latin1(),g);
00751 
00752   if (m_gstateHandler) m_gstateHandler->gotStrokeColor (color);
00753 } */
00754 
00755 void AIParserBase::_handleDocumentFonts(const char *) {
00756 }
00757 
00758 void AIParserBase::_handleDocumentFiles(const char *) {
00759 }
00760 
00761 void AIParserBase::_handleDocumentCustomColors(const char *) {
00762 }
00763 
00764 void AIParserBase::_handleDocumentNeededResources(const char *data) {
00765   if (!data) return;
00766   QStringList items = QStringList::split (' ', data);
00767 
00768   QString itemType = items[1];
00769   QString name = items[2];
00770   QString version = items[3];
00771   QString release = items[4];
00772 }
00773 
00774 void AIParserBase::_handleIncludeResource(const char *data) {
00775   if (!data) return;
00776   QStringList items = QStringList::split (' ', data);
00777 
00778   QString itemType = items[1];
00779   QString name = items[2];
00780   QString version = items[3];
00781   QString release = items[4];
00782 
00783   m_modules.push_back (name);
00784 }
00785 
00786 void AIParserBase::_handleDocumentProcessColors(const char *data) {
00787   if (!data) return;
00788 
00789   int colorSet = 0;
00790   QString tmp (data);
00791 
00792   signed int index;
00793 
00794   index = tmp.find ("Cyan");
00795   if (index > 0) colorSet |= PC_Cyan;
00796 
00797   index = tmp.find ("Magenta");
00798   if (index > 0) colorSet |= PC_Magenta;
00799 
00800   index = tmp.find ("Yellow");
00801   if (index > 0) colorSet |= PC_Yellow;
00802 
00803   index = tmp.find ("Black");
00804   if (index > 0) colorSet |= PC_Black;
00805 
00806   if (m_documentHandler) m_documentHandler->gotProcessColors (colorSet);
00807 }
00808 
00809 void AIParserBase::_handleCMYKCustomColor(const char *) {
00810 }
00811 
00812 /*Ai88*/ /* void AIParserBase::_handleGsaveIncludeDocument() {
00813   AIElement elem2 (m_stack.top());
00814   m_stack.pop();
00815 
00816   const QString &name = elem2.toString();
00817 
00818   int ury = getIntValue();
00819   int urx = getIntValue();
00820   int lly = getIntValue();
00821   int llx = getIntValue();
00822 
00823   AIElement elem (m_stack.top());
00824   m_stack.pop();
00825 
00826   const QValueVector<AIElement> aval = elem.toElementArray();
00827 
00828   if (m_embeddedHandler) m_embeddedHandler->gotGsaveIncludeDocument (aval, llx,lly,urx,ury,name.latin1());
00829 } */
00830 
00831 /*Ai88*/ /* void AIParserBase::_handleSetCurrentText() {
00832   int iAlign = getIntValue();
00833   TextAlign ta = TA_HLeft;
00834 
00835   switch (iAlign)
00836   {
00837     case 0 : ta = TA_HLeft; break;
00838     case 1 : ta = TA_HCenter; break;
00839     case 2 : ta = TA_HRight; break;
00840     case 3:  ta = TA_VTop; break;
00841     case 4 : ta = TA_VCenter; break;
00842     case 5 : ta = TA_VBottom; break;
00843   }
00844 
00845   double kerning = getDoubleValue();
00846   double leading = getDoubleValue();
00847   double size = getDoubleValue();
00848 
00849   AIElement elem2 (m_stack.top());
00850   m_stack.pop();
00851 
00852   const QString &fontname = elem2.toReference();
00853 
00854   if (m_textHandler) m_textHandler->gotFontDefinition (fontname.latin1(), size, leading, kerning, ta);
00855 } */
00856 
00857 /*Ai88*/ /* void AIParserBase::_handleTextBlock (TextOperation to) {
00858   AIElement elem (m_stack.top());
00859   qDebug ("to element is (%s)",elem.typeName());
00860   m_stack.pop();
00861 
00862   const QValueVector<AIElement> aval = elem.toElementArray();
00863 
00864   if (m_textHandler) m_textHandler->gotTextBlockBegin (aval, to);
00865 } */
00866 
00867 /*Ai88*/ /* void AIParserBase::_handleTextOutput () {
00868   AIElement elem (m_stack.top());
00869   m_stack.pop();
00870 
00871   const QString &text = elem.toString();
00872 
00873   int length = -1;
00874 
00875   if (m_stack.empty())
00876   {
00877     AIElement elem2 (m_stack.top());
00878     if (elem2.type() == AIElement::Int)
00879     {
00880       length = elem2.asInt();
00881       m_stack.pop();
00882     }
00883   }
00884   if (m_textHandler) m_textHandler->gotTextOutput (text.latin1(), length);
00885 } */
00886 
00887 void AIParserBase::_handleCreationDate (const char *data)
00888 {
00889   if (!data) return;
00890 
00891   QRegExp test ("\\((.+)\\) \\((.+)\\)");
00892   if (test.search (data))
00893   {
00894     QString val1 = test.cap(1);
00895     QString val2 = test.cap(2);
00896 
00897    if (m_documentHandler) m_documentHandler->gotCreationDate (val1.latin1(),val2.latin1());
00898   }
00899 }
00900 
00901 void AIParserBase::gotToken (const char *value) {
00902   if (m_debug) qDebug ("got token");
00903 
00904   if (m_ignoring) return;
00905   if (m_debug) qDebug ("token: %s", value);
00906 
00907   if (m_sink == DS_Array)
00908   {
00909     if (m_debug) qDebug ("token in array");
00910     QString op (value);
00911     AIElement realElement (op, AIElement::Operator);
00912     handleElement (realElement);
00913 
00914     return;
00915   }
00916   if (m_sink == DS_Block)
00917   {
00918     if (m_debug) qDebug ("token in block");
00919     QString op (value);
00920     AIElement realElement (op, AIElement::Operator);
00921     handleElement (realElement);
00922 
00923     return;
00924   }
00925 
00926   if (m_debug) qDebug ("get ai operation");
00927 
00928   AIOperation op = getAIOperation (value);
00929 //  PathElement pathElement;
00930 //  double fval;
00931 //  int ival;
00932 
00933    bool handled = false;
00934 
00935    handled = m_ai88Handler->handleAIOperation (op);
00936    if (!handled) handled = m_ai3Handler->handleAIOperation (op);
00937 
00938    if (!handled)
00939    {
00940       if (m_sink == DS_Other)
00941       {
00942         if (handlePS (value)) return;
00943       }
00944       qWarning ( "unknown operator: %s", value );
00945 
00946       QString string(value);
00947 
00948       if (m_modules.findIndex(string) != -1)
00949       {
00950         AIElement element (string, AIElement::Reference);
00951         handleElement (element);
00952         return;
00953       }
00954 
00955       if (m_debug) stacktoa (m_stack);
00956       qWarning ( "pushing %s to stack", value );
00957       AIElement element (string, AIElement::Operator);
00958       handleElement (element);
00959   }
00960 
00961   if (m_debug) qDebug ("/got token value");
00962 }
00963 
00964 bool AIParserBase::handlePS (const char *operand){
00965   if (m_ignoring) return false;
00966 
00967   PSOperation psop = getPSOperation (operand);
00968 
00969   switch (psop)
00970   {
00971     case PSO_Get :
00972       _handlePSGet ();
00973       return true;
00974     case PSO_Exec :
00975       _handlePSExec ();
00976       return true;
00977     case PSO_Def :
00978       _handlePSDef ();
00979       return true;
00980     case PSO_String :
00981       _handlePSString ();
00982       return true;
00983     case PSO_Bind :
00984       _handlePSBind ();
00985       return true;
00986     case PSO_Userdict :
00987       _handlePSUserdict ();
00988       return true;
00989     case PSO_Dict :
00990       _handlePSDict ();
00991       return true;
00992     case PSO_Dup :
00993       _handlePSDup ();
00994       return true;
00995     case PSO_Begin :
00996       _handlePSBegin ();
00997       return true;
00998     case PSO_Put :
00999       _handlePSPut ();
01000       return true;
01001     default: break;
01002   }
01003   return false;
01004 }
01005 
01006 const double AIParserBase::getDoubleValue(void) {
01007   const AIElement &elem = m_stack.pop();
01008 
01009   return elem.toDouble();
01010 }
01011 
01012 const int AIParserBase::getIntValue(void) {
01013   const AIElement &elem = m_stack.pop();
01014 
01015   return elem.toInt();
01016 }
01017 
01018 const bool AIParserBase::getBoolValue(void) {
01019   return getIntValue() == 1;
01020 }
01021 
01022 const QString AIParserBase::getStringValue(void) {
01023   const AIElement &elem = m_stack.pop();
01024 
01025   return elem.toString();
01026 }
01027 
01028 const QString AIParserBase::getOperatorValue(void) {
01029   const AIElement &elem = m_stack.pop();
01030 
01031   return elem.toOperator();
01032 }
01033 
01034 AIOperation AIParserBase::getAIOperation (const char *operand)
01035 {
01036   int i=0;
01037   QString cmpValue (operand);
01038 
01039   for(;;) {    AIOperationMapping map = aiMappings[i];
01040     if (map.op == NULL) return AIO_Other;
01041     if (cmpValue.compare (map.op) == 0) return map.action;
01042 
01043     i++;
01044   }
01045 }
01046 
01047 PSOperation AIParserBase::getPSOperation (const char *operand)
01048 {
01049   int i=0;
01050   QString cmpValue (operand);
01051 
01052   for(;;) {    PSOperationMapping map = psMappings[i];
01053     if (map.op == NULL) return PSO_Other;
01054     if (cmpValue.compare (map.op) == 0) return map.action;
01055 
01056     i++;
01057   }
01058 }
01059 
01060 CommentOperation AIParserBase::getCommentOperation (const char *command) {
01061   QString data (command);
01062 
01063   signed int index;
01064 
01065   int i=0;
01066 
01067   for(;;) {
01068     CommentOperationMapping map = commentMappings[i];
01069     if (map.op == NULL) return CO_Other;
01070     index = data.find (map.op);
01071     if (index >= 0) return map.action;
01072     i++;
01073   }
01074 }
01075 
01076 void GStateHandlerBase::gotFillPattern (const char *pname, double px, double py, double sx, double sy, double angle, double rf, double r, double k, double ka, const QValueVector<AIElement>& transformData) {
01077   qDebug ( "got fill pattern %s %f %f %f %f %f %f %f %f %f", pname, px, py, sx, sy, angle, rf, r, k, ka);
01078   arraytoa (transformData);
01079   qDebug ("/got fill pattern");
01080 }
01081 
01082 void GStateHandlerBase::gotStrokePattern (const char *pname, double px, double py, double sx, double sy, double angle, double rf, double r, double k, double ka, const QValueVector<AIElement>& transformData) {
01083   qDebug ( "got stroke pattern %s %f %f %f %f %f %f %f %f %f", pname, px, py, sx, sy, angle, rf, r, k, ka);
01084   arraytoa (transformData);
01085   qDebug ("/got stroke pattern");
01086 }
01087 
01088 const char *AIParserBase::getValue (const char *input) {
01089   QString data(input);
01090 
01091   signed int index = data.find (':');
01092   if (index < 0) return "";
01093   index++;
01094   while (data.at(index) == ' ') index++;
01095   return data.mid(index).latin1();
01096 }
01097 
01098 bool AIParserBase::getRectangle (const char* input, int &llx, int &lly, int &urx, int &ury) {
01099   if (input == NULL) return false;
01100 
01101   QString s(input);
01102   if (s.contains ("(atend)")) return false;
01103   QStringList values = QStringList::split (" ", input);
01104   if (values.size() < 5) return false;
01105   llx = values[1].toInt();
01106   lly = values[2].toInt();
01107   urx = values[3].toInt();
01108   ury = values[4].toInt();
01109 
01110   return true;
01111 }
01112 
01113 bool AIParserBase::getPoint (const char* input, int &x, int &y) {
01114   if (input == NULL) return false;
01115 
01116   QString s(input);
01117   QStringList values = QStringList::split (" ", input);
01118 
01119   if (values.size() < 3) return false;
01120 
01121   x = values[1].toInt();
01122   y = values[2].toInt();
01123 
01124   return true;
01125 }
01126 
01127 void AIParserBase::cleanupArrays()
01128 {
01129   if (m_sink == DS_Array) qDebug ("unclosed array(s).");
01130   while (m_sink == DS_Array) gotArrayEnd ();
01131   stacktoa (m_stack);
01132 }
01133 
01134 /*Ai88*/ /* void AIParserBase::_handleFontEncoding()
01135 {
01136   while (m_stack.top().type() != AIElement::Reference) {
01137     m_stack.pop();
01138   }
01139 
01140   AIElement elem (m_stack.top());
01141   m_stack.pop();
01142   const QString &oldFont = elem.toReference();
01143 
01144   AIElement elem2 (m_stack.top());
01145   m_stack.pop();
01146   const QString &newFont = elem2.toReference();
01147 
01148   AIElement elem3 (m_stack.top());
01149   m_stack.pop();
01150   const QValueVector<AIElement> encodingData = elem3.toElementArray();
01151 
01152   if (m_textHandler) m_textHandler->gotFontEncoding (encodingData, oldFont.latin1(), newFont.latin1());
01153 } */
01154 
01155 void TextHandlerBase::gotFontEncoding (const QValueVector<AIElement>& encodingData, const char*oldFontName, const char*newFontName)
01156 {
01157   qDebug ("font encoding %s to %s",oldFontName, newFontName);
01158   arraytoa (encodingData);
01159   qDebug ("/font encoding");
01160 }
01161 
01162 void TextHandlerBase::gotFontDefinition (const char*fontName, double size, double leading, double kerning, TextAlign align)
01163 {
01164   qDebug ("font definition: name %s size %f leading %f kerning %f align %d", fontName, size, leading, kerning, align);
01165 }
01166 
01167 void TextHandlerBase::gotTextBlockBegin (const QValueVector<AIElement>& transData, TextOperation mode)
01168 {
01169   qDebug ("text block begin %d",mode);
01170   arraytoa (transData);
01171   qDebug ("/text block begin");
01172 }
01173 
01174 void TextHandlerBase::gotTextOutput (const char*text, int length)
01175 {
01176   qDebug ("text output (%s) %d",text,length);
01177 }
01178 
01179 void TextHandlerBase::gotTextBlockEnd ()
01180 {
01181   qDebug ("text block end");
01182 }
01183 
01184 const void elementtoa (const AIElement &/*data*/)
01185 {
01186 /*  AIElement::Type type = data.type();
01187   qDebug ("type: %s", AIElement::typeToName (type));
01188 
01189   switch (type)
01190   {
01191     case AIElement::String :
01192     case AIElement::CString :
01193     case AIElement::Int :
01194     case AIElement::UInt :
01195     case AIElement::Double :
01196       qDebug ("string value : %s",data.toString().latin1());
01197       break;
01198     case AIElement::Reference :
01199       qDebug ("string value : %s",data.toReference().latin1());
01200       break;
01201     case AIElement::Operator :
01202       qDebug ("string value : %s",data.toOperator().latin1());
01203       break;
01204     case AIElement::ElementArray :
01205       arraytoa (data.toElementArray());
01206       break;
01207     case AIElement::Block :
01208       arraytoa (data.toBlock());
01209       break;
01210 
01211     default :
01212       qDebug ("could not fetch data");
01213   } */
01214 }
01215 
01216 const void arraytoa (const QValueVector<AIElement> &/*data*/)
01217 {
01218 /*  qDebug ("array size is %d ",data.size());
01219   if (data.size() > 0)
01220   {
01221     qDebug ("[[[[[[[[[[[[[[[[[[[[");
01222     for (uint i=0; i< data.size(); i++)
01223     {
01224       elementtoa (data[i]);
01225     }
01226     qDebug ("]]]]]]]]]]]]]]]]]]]]");
01227   } */
01228 }
01229 
01230 const void stacktoa (const QValueStack<AIElement> &/*data*/)
01231 {
01232 /*  qDebug ("stack size is %d",data.size());
01233   if (data.size() > 0)
01234   {
01235     qDebug ("<<<<<<<<<<<<<<<<<<");
01236     for (uint i=0; i< data.size(); i++)
01237     {
01238       elementtoa (data[i]);
01239     }
01240   }
01241   qDebug (">>>>>>>>>>>>>>>>>>"); */
01242 }
01243 
01244 const void stacktoa2 (const QValueStack<QValueVector<AIElement> >&/*data*/)
01245 {
01246 /*  qDebug ("stack size is %d",data.size());
01247 
01248   if (data.size() > 0)
01249   {
01250     qDebug ("(((((((((((((((((((((((");
01251     for (uint i=0; i< data.size(); i++)
01252     {
01253       arraytoa (data[i]);
01254     }
01255     qDebug (")))))))))))))))))))))))");
01256   } */
01257 }
01258 
01259 const void aiotoa (AIOperation &data)
01260 {
01261   switch (data)
01262   {
01263     case AIO_SetFillColorCMYK : qDebug ("AIO_SetFillColorCMYK"); break;
01264     case AIO_SetStrokeColorCMYK : qDebug ("AIO_SetStrokeColorCMYK"); break;
01265     case AIO_SetFillColorGray : qDebug ("AIO_SetFillColorGray"); break;
01266     case AIO_SetStrokeColorGray : qDebug ("AIO_SetStrokeColorGray"); break;
01267     case AIO_SetFillColorCustom : qDebug ("AIO_SetFillColorCustom"); break;
01268     case AIO_SetStrokeColorCustom : qDebug ("AIO_SetStrokeColorCustom"); break;
01269     case AIO_SetFillPattern : qDebug ("AIO_SetFillPattern"); break;
01270     case AIO_SetStrokePattern : qDebug ("AIO_SetStrokePattern"); break;
01271     case AIO_SetFillOverprinting : qDebug ("AIO_SetFillOverprinting"); break;
01272     case AIO_SetStrokeOverprinting : qDebug ("AIO_SetStrokeOverprinting"); break;
01273     case AIO_SetFlatness : qDebug ("AIO_SetFlatness"); break;
01274     case AIO_SetLineCap : qDebug ("AIO_SetLineCap"); break;
01275     case AIO_SetLineJoin : qDebug ("AIO_SetLineJoin"); break;
01276     case AIO_SetLineWidth : qDebug ("AIO_SetLineWidth"); break;
01277     case AIO_SetMiterLimit : qDebug ("AIO_SetMiterLimit"); break;
01278     case AIO_SetDash : qDebug ("AIO_SetDash"); break;
01279     case AIO_BeginGroupClip : qDebug ("AIO_BeginGroupClip"); break;
01280     case AIO_EndGroupClip : qDebug ("AIO_EndGroupClip"); break;
01281     case AIO_MoveTo : qDebug ("AIO_MoveTo"); break;
01282     case AIO_LineToCorner : qDebug ("AIO_LineToCorner"); break;
01283     case AIO_LineToSmooth : qDebug ("AIO_LineToSmooth"); break;
01284     case AIO_CurveToSmooth : qDebug ("AIO_CurveToSmooth"); break;
01285     case AIO_CurveToCorner : qDebug ("AIO_CurveToCorner"); break;
01286     case AIO_CurveToOmitC1Smooth : qDebug ("AIO_CurveToOmitC1Smooth"); break;
01287     case AIO_CurveToOmitC1Corner : qDebug ("AIO_CurveToOmitC1Corner"); break;
01288     case AIO_CurveToOmitC2Smooth : qDebug ("AIO_CurveToOmitC2Smooth"); break;
01289     case AIO_CurveToOmitC2Corner : qDebug ("AIO_CurveToOmitC2Corner"); break;
01290     case AIO_PathIgnoreNoReset : qDebug ("AIO_PathIgnoreNoReset"); break;
01291     case AIO_PathIgnoreNoResetClose : qDebug ("AIO_PathIgnoreNoResetClose"); break;
01292     case AIO_PathClipPath : qDebug ("AIO_PathClipPath"); break;
01293     case AIO_PathIgnoreReset : qDebug ("AIO_PathIgnoreReset"); break;
01294     case AIO_PathIgnoreResetClose : qDebug ("AIO_PathIgnoreResetClose"); break;
01295     case AIO_PathFillNonZero : qDebug ("AIO_PathFillNonZero"); break;
01296     case AIO_PathFillNonZeroClose : qDebug ("AIO_PathFillNonZeroClose"); break;
01297     case AIO_PathStroke : qDebug ("AIO_PathStroke"); break;
01298     case AIO_PathStrokeClose : qDebug ("AIO_PathStrokeClose"); break;
01299     case AIO_PathFillNoReset : qDebug ("AIO_PathFillNoReset"); break;
01300     case AIO_PathFillNoResetClose : qDebug ("AIO_PathFillNoResetClose"); break;
01301     case AIO_FontEncoding : qDebug ("AIO_FontEncoding"); break;
01302     case AIO_PatternDefinition : qDebug ("AIO_PatternDefinition"); break;
01303     case AIO_SetCurrentText : qDebug ("AIO_SetCurrentText"); break;
01304     case AIO_TextBlockFillStroke : qDebug ("AIO_TextBlockFillStroke"); break;
01305     case AIO_TextBlockFill : qDebug ("AIO_TextBlockFill"); break;
01306     case AIO_TextBlockAppend : qDebug ("AIO_TextBlockAppend"); break;
01307     case AIO_TextBlockIgnore : qDebug ("AIO_TextBlockIgnore"); break;
01308     case AIO_TextBlockStroke : qDebug ("AIO_TextBlockStroke"); break;
01309     case AIO_TextOutput : qDebug ("AIO_TextOutput"); break;
01310     case AIO_TextBlockEnd : qDebug ("AIO_TextBlockEnd"); break;
01311     case AIO_GsaveIncludeDocument : qDebug ("AIO_GsaveIncludeDocument"); break;
01312     case AIO_Grestore : qDebug ("AIO_Grestore"); break;
01313     case AIO_LockElement : qDebug ("AIO_LockElement"); break;
01314     case AIO_SetWindingOrder : qDebug ("AIO_SetWindingOrder"); break;
01315     default : qDebug ("unknown");
01316   }
01317 }
01318 
01319 const void sttoa (SectionType &data, bool begin)
01320 {
01321   switch (data)
01322   {
01323     case ST_Setup : begin ? qDebug ("start setup") : qDebug ("end setup"); break;
01324     case ST_Prolog : begin ? qDebug ("start prolog") : qDebug ("end prolog"); break;
01325     case ST_ProcSet : begin ? qDebug ("start procset") : qDebug ("end procset"); break;
01326     case ST_Encoding : begin ? qDebug ("start encoding") : qDebug ("end encoding"); break;
01327     case ST_Pattern : begin ? qDebug ("start pattern") : qDebug ("end pattern"); break;
01328     case ST_Document : begin ? qDebug ("start document") : qDebug ("end document"); break;
01329     case ST_BrushPattern : begin ? qDebug ("start brush pattern") : qDebug ("end brush pattern"); break;
01330     case ST_Gradient : begin ? qDebug ("start gradient") : qDebug ("end gradient"); break;
01331     case ST_Palette : begin ? qDebug ("start palette") : qDebug ("end palette"); break;
01332     case ST_Resource : begin ? qDebug ("start resource") : qDebug ("end resouce"); break;
01333 
01334     default : begin ? qDebug ("unknown") : qDebug ("end unknown");
01335   }
01336 }
01337 
KDE Home | KDE Accessibility Home | Description of Access Keys