1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
|
/************************************************************************/
/* */
/* Calculate 'Hyperlink' fields. */
/* */
/************************************************************************/
# include "tedConfig.h"
# include <stdlib.h>
# include <string.h>
# include <stdio.h>
# include <appDebugon.h>
# include "docBuf.h"
# include "docEdit.h"
# include "docEvalField.h"
/************************************************************************/
/* */
/* Evaluate a 'HYPERLINK' field. */
/* */
/* Just make the contents blue as a compatibility hack with previous */
/* versions. */
/* */
/************************************************************************/
int docRecalculateHyperlinkField(
int * pCalculated,
BufferDocument * bd,
int * pPartShift,
int * pStroffShift,
BufferItem * paraBi,
int partFrom,
int partCount,
DocumentField * df,
void * voidadd,
DOC_CLOSE_OBJECT closeObject )
{
const int partUpto= partFrom+ partCount+ 2;
TextAttribute taSet;
PropertyMask taSetMask;
PropertyMask taDoneMask;
DocumentProperties * dp= &(bd->bdProperties);
int blue;
RGB8Color rgb8Blue;
if ( ! getenv( "TED_HYPERLINKS_BLUE" ) )
{ *pCalculated= 0; return 0; }
utilInitTextAttribute( &taSet );
PROPmaskCLEAR( &taSetMask );
PROPmaskCLEAR( &taDoneMask );
bmInitRGB8Color( &rgb8Blue );
rgb8Blue.rgb8Red= 0;
rgb8Blue.rgb8Green= 0;
rgb8Blue.rgb8Blue= 255;
blue= docAllocateDocumentColor( dp, &rgb8Blue );
if ( blue < 0 )
{ LDEB(blue); return -1; }
taSet.taTextColorNumber= blue;
taSet.taTextIsUnderlined= 1;
PROPmaskADD( &taSetMask, TApropTEXT_COLOR );
PROPmaskADD( &taSetMask, TApropTEXTUNDERLINED );
if ( docChangeParticuleAttributes( &taDoneMask, bd,
paraBi, partFrom, partUpto,
&taSet, &taSetMask ) )
{ LDEB(1); return -1; }
if ( PROPmaskISEMPTY( &taDoneMask ) )
{ *pCalculated= 0; }
else{ *pCalculated= 1; }
/*
*pPartShift += 0;
*pStroffShift += 0;
*/
return 0;
}
|