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 88 89 90 91 92
|
/************************************************************************/
/* */
/* Management of Border Properties. */
/* */
/************************************************************************/
# include "tedConfig.h"
# include <stdlib.h>
# include <string.h>
# include <stdio.h>
# include <appDebugon.h>
# include "docBorderProperties.h"
/************************************************************************/
/* */
/* Initialise Border Properties. */
/* */
/************************************************************************/
void docInitBorderProperties( BorderProperties * bp )
{
bp->bpColor= 0;
bp->bpSpacingTwips= 0;
bp->bpPenWideTwips= 15;
bp->bpStyle= DOCbsNONE;
}
/************************************************************************/
/* */
/* 1) Are the columns in two RowProperties 'the same' (Do they align?) */
/* 2) All column properties identical? */
/* */
/************************************************************************/
void docBorderPropertyDifference(
PropertyMask * pBpUpdMask,
const BorderProperties * bp1,
const BorderProperties * bp2,
const PropertyMask * bpUpdMask )
{
PropertyMask bpChgMask;
PROPmaskCLEAR( &bpChgMask );
if ( PROPmaskISSET( bpUpdMask, BRDRpropCOLOR ) )
{
if ( bp1->bpColor != bp2->bpColor )
{ PROPmaskADD( &bpChgMask, BRDRpropCOLOR ); }
}
if ( PROPmaskISSET( bpUpdMask, BRDRpropSPACING ) )
{
if ( bp1->bpSpacingTwips != bp2->bpSpacingTwips )
{ PROPmaskADD( &bpChgMask, BRDRpropSPACING ); }
}
if ( PROPmaskISSET( bpUpdMask, BRDRpropPEN_WIDE ) )
{
if ( bp1->bpPenWideTwips != bp2->bpPenWideTwips )
{ PROPmaskADD( &bpChgMask, BRDRpropPEN_WIDE ); }
}
if ( PROPmaskISSET( bpUpdMask, BRDRpropSTYLE ) )
{
if ( bp1->bpStyle != bp2->bpStyle )
{ PROPmaskADD( &bpChgMask, BRDRpropSTYLE ); }
}
*pBpUpdMask= bpChgMask;
return;
}
int docBordersDiffer( const BorderProperties * bp1,
const BorderProperties * bp2 )
{
PropertyMask bpUpdMask;
PropertyMask bpChgMask;
PROPmaskCLEAR( &bpChgMask );
PROPmaskCLEAR( &bpUpdMask );
PROPmaskFILL( &bpUpdMask, BRDRprop_COUNT );
docBorderPropertyDifference( &bpChgMask, bp1, bp2, &bpUpdMask );
if ( ! PROPmaskISEMPTY( &bpChgMask ) )
{ return 1; }
return 0;
}
|