public void writeDefinition ( final OutputStream result ) throws IOException { result . write ( OPEN_GROUP ) ; result . write ( LIST ) ; result . write ( LIST_TEMPLATE_ID ) ; result . write ( intToByteArray ( document . getRandomInt ( ) ) ) ; int levelsToWrite = - 1 ; switch ( this . listType ) { case LIST_TYPE_NORMAL : levelsToWrite = listLevels . size ( ) ; break ; case LIST_TYPE_SIMPLE : result . write ( LIST_SIMPLE ) ; result . write ( intToByteArray ( 1 ) ) ; levelsToWrite = 1 ; break ; case LIST_TYPE_HYBRID : result . write ( LIST_HYBRID ) ; levelsToWrite = listLevels . size ( ) ; break ; default : break ; } this . document . outputDebugLinebreak ( result ) ; // TODO: Figure out hybrid because multi-level hybrid does not work. // Seems hybrid is mixed type all single level - Simple = single level // SIMPLE1/HYRBID // 1. Line 1 // 2. Line 2 // MULTI-LEVEL LISTS Are Simple0 - 9 levels (0-8) all single digit // 1. Line 1 // 1.1. Line 1.1 // 1.2. Line 1.2 // 2. Line 2 // write the listlevels here for ( int i = 0 ; i < levelsToWrite ; i ++ ) { ( ( RtfListLevel ) listLevels . get ( i ) ) . writeDefinition ( result ) ; this . document . outputDebugLinebreak ( result ) ; } result . write ( LIST_ID ) ; result . write ( intToByteArray ( this . listID ) ) ; result . write ( CLOSE_GROUP ) ; this . document . outputDebugLinebreak ( result ) ; if ( items != null ) { for ( int i = 0 ; i < items . size ( ) ; i ++ ) { RtfElement rtfElement = ( RtfElement ) items . get ( i ) ; if ( rtfElement instanceof RtfList ) { RtfList rl = ( RtfList ) rtfElement ; rl . writeDefinition ( result ) ; break ; } else if ( rtfElement instanceof RtfListItem ) { RtfListItem rli = ( RtfListItem ) rtfElement ; if ( rli . writeDefinition ( result ) ) break ; } } } }
Writes the definition part of this list level