Writes the settings of this RtfParagraphStyle.

@param result The <code>OutputStream</code> to write to.
@throws IOException On i/o errors.
971713
private void writeParagraphSettings(final OutputStream result) throws IOException {
        if(this.keepTogether) {
            result.write(RtfParagraphStyle.KEEP_TOGETHER);
        }
        if(this.keepTogetherWithNext) {
            result.write(RtfParagraphStyle.KEEP_TOGETHER_WITH_NEXT);
        }
        switch (alignment) {
            case Element.ALIGN_LEFT:
                result.write(RtfParagraphStyle.ALIGN_LEFT);
                break;
            case Element.ALIGN_RIGHT:
                result.write(RtfParagraphStyle.ALIGN_RIGHT);
                break;
            case Element.ALIGN_CENTER:
                result.write(RtfParagraphStyle.ALIGN_CENTER);
                break;
            case Element.ALIGN_JUSTIFIED:
            case Element.ALIGN_JUSTIFIED_ALL:
                result.write(RtfParagraphStyle.ALIGN_JUSTIFY);
                break;
        }
        result.write(FIRST_LINE_INDENT);
        result.write(intToByteArray(this.firstLineIndent));
        result.write(RtfParagraphStyle.INDENT_LEFT);
        result.write(intToByteArray(indentLeft));
        result.write(RtfParagraphStyle.INDENT_RIGHT);
        result.write(intToByteArray(indentRight));
        if(this.spacingBefore > 0) {
            result.write(RtfParagraphStyle.SPACING_BEFORE);
            result.write(intToByteArray(this.spacingBefore));
        }
        if(this.spacingAfter > 0) {
            result.write(RtfParagraphStyle.SPACING_AFTER);
            result.write(intToByteArray(this.spacingAfter));
        }
        if(this.lineLeading > 0) {
            result.write(RtfParagraph.LINE_SPACING);
            result.write(intToByteArray(this.lineLeading));
        }            
    }
122688
public void writeContent(final OutputStream result) throws IOException
    {
    	result.write(OPEN_GROUP);
		result.write(INFO_GROUP);
		for(int i = 0; i < infoElements.size(); i++) {
			RtfInfoElement infoElement = (RtfInfoElement) infoElements.get(i);
			infoElement.writeContent(result);
		}
		
		// handle document protection
    	if(document.getDocumentSettings().isDocumentProtected()) {
	    	result.write(OPEN_GROUP);
			result.write(INFO_PASSWORD);
			result.write(DELIMITER);
			result.write(document.getDocumentSettings().getProtectionHashBytes());
			result.write(CLOSE_GROUP);
    	}

		result.write(CLOSE_GROUP);
		this.document.outputDebugLinebreak(result);
    }
730134
public void writeContent(final OutputStream result) throws IOException
    {
        result.write(OPEN_GROUP);
        result.write(ANNOTATION_ID);
        result.write(DELIMITER);
        result.write(intToByteArray(document.getRandomInt()));
        result.write(CLOSE_GROUP);
        result.write(OPEN_GROUP);
        result.write(ANNOTATION_AUTHOR);
        result.write(DELIMITER);
        result.write(DocWriter.getISOBytes(title));
        result.write(CLOSE_GROUP);
        result.write(OPEN_GROUP);
        result.write(ANNOTATION);
        result.write(RtfParagraph.PARAGRAPH_DEFAULTS);
        result.write(DELIMITER);
        result.write(DocWriter.getISOBytes(content));
        result.write(CLOSE_GROUP);    	
    }
499672
public void writeContent(final OutputStream result) throws IOException
    {
		this.shapeNr = this.doc.getRandomInt();
		
		this.properties.put("ShapeType", new RtfShapeProperty("ShapeType", this.type));
		if(this.position.isShapeBelowText()) {
			this.properties.put("fBehindDocument", new RtfShapeProperty("fBehindDocument", true));
		}
		if(this.inTable) {
			this.properties.put("fLayoutInCell", new RtfShapeProperty("fLayoutInCell", true));
		}
		if(this.properties.containsKey("posh")) {
			this.position.setIgnoreXRelative(true);
		}
		if(this.properties.containsKey("posv")) {
			this.position.setIgnoreYRelative(true);
		}
    	
    	result.write(OPEN_GROUP);
    	result.write(DocWriter.getISOBytes("\\shp"));
    	result.write(DocWriter.getISOBytes("\\shplid"));
    	result.write(intToByteArray(this.shapeNr));
    	this.position.writeContent(result);
    	switch(this.wrapping) {
    	case SHAPE_WRAP_NONE:
    		result.write(DocWriter.getISOBytes("\\shpwr3"));
    		break;
    	case SHAPE_WRAP_TOP_BOTTOM:
    		result.write(DocWriter.getISOBytes("\\shpwr1"));
    		break;
    	case SHAPE_WRAP_BOTH:
    		result.write(DocWriter.getISOBytes("\\shpwr2"));
    		result.write(DocWriter.getISOBytes("\\shpwrk0"));
    		break;
    	case SHAPE_WRAP_LEFT:
    		result.write(DocWriter.getISOBytes("\\shpwr2"));
    		result.write(DocWriter.getISOBytes("\\shpwrk1"));
    		break;
    	case SHAPE_WRAP_RIGHT:
    		result.write(DocWriter.getISOBytes("\\shpwr2"));
    		result.write(DocWriter.getISOBytes("\\shpwrk2"));
    		break;
    	case SHAPE_WRAP_LARGEST:
    		result.write(DocWriter.getISOBytes("\\shpwr2"));
    		result.write(DocWriter.getISOBytes("\\shpwrk3"));
    		break;
    	case SHAPE_WRAP_TIGHT_BOTH:
    		result.write(DocWriter.getISOBytes("\\shpwr4"));
    		result.write(DocWriter.getISOBytes("\\shpwrk0"));
    		break;
    	case SHAPE_WRAP_TIGHT_LEFT:
    		result.write(DocWriter.getISOBytes("\\shpwr4"));
    		result.write(DocWriter.getISOBytes("\\shpwrk1"));
    		break;
    	case SHAPE_WRAP_TIGHT_RIGHT:
    		result.write(DocWriter.getISOBytes("\\shpwr4"));
    		result.write(DocWriter.getISOBytes("\\shpwrk2"));
    		break;
    	case SHAPE_WRAP_TIGHT_LARGEST:
    		result.write(DocWriter.getISOBytes("\\shpwr4"));
    		result.write(DocWriter.getISOBytes("\\shpwrk3"));
    		break;
    	case SHAPE_WRAP_THROUGH:
    		result.write(DocWriter.getISOBytes("\\shpwr5"));
    		break;
    	default:
    		result.write(DocWriter.getISOBytes("\\shpwr3"));
    	}
    	if(this.inHeader) {
    		result.write(DocWriter.getISOBytes("\\shpfhdr1"));
    	} 
    	this.doc.outputDebugLinebreak(result);
    	result.write(OPEN_GROUP);
    	result.write(DocWriter.getISOBytes("\\*\\shpinst"));
    	Iterator it = this.properties.values().iterator();
    	while(it.hasNext()) {
    		RtfShapeProperty rsp = (RtfShapeProperty) it.next();
    		rsp.setRtfDocument(this.doc);
    		rsp.writeContent(result);
    	}
    	if(!this.shapeText.equals("")) {
    		result.write(OPEN_GROUP);
    		result.write(DocWriter.getISOBytes("\\shptxt"));
    		result.write(DELIMITER);
    		result.write(DocWriter.getISOBytes(this.shapeText));
    		result.write(CLOSE_GROUP);
    	}
    	result.write(CLOSE_GROUP);
    	this.doc.outputDebugLinebreak(result);
    	result.write(CLOSE_GROUP);
		
    }
1368375
public void writeDefinition(final OutputStream result) throws IOException 
    {
        if(this.mergeType == MERGE_VERT_PARENT) {
            result.write(DocWriter.getISOBytes("\\clvmgf"));
        } else if(this.mergeType == MERGE_VERT_CHILD) {
            result.write(DocWriter.getISOBytes("\\clvmrg"));
        }
        switch (verticalAlignment) {
            case Element.ALIGN_BOTTOM:
                result.write(DocWriter.getISOBytes("\\clvertalb"));
                break;
            case Element.ALIGN_CENTER:
            case Element.ALIGN_MIDDLE:
                result.write(DocWriter.getISOBytes("\\clvertalc"));
                break;
            case Element.ALIGN_TOP:
                result.write(DocWriter.getISOBytes("\\clvertalt"));
                break;
        }
        this.borders.writeContent(result);

        if(this.backgroundColor != null) {
            result.write(DocWriter.getISOBytes("\\clcbpat"));
            result.write(intToByteArray(this.backgroundColor.getColorNumber()));
        }
        this.document.outputDebugLinebreak(result);
        
        result.write(DocWriter.getISOBytes("\\clftsWidth3"));
        this.document.outputDebugLinebreak(result);
        
        result.write(DocWriter.getISOBytes("\\clwWidth"));
        result.write(intToByteArray(this.cellWidth));
        this.document.outputDebugLinebreak(result);
        
        if(this.cellPadding > 0) {
            result.write(DocWriter.getISOBytes("\\clpadl"));
            result.write(intToByteArray(this.cellPadding / 2));
            result.write(DocWriter.getISOBytes("\\clpadt"));
            result.write(intToByteArray(this.cellPadding / 2));
            result.write(DocWriter.getISOBytes("\\clpadr"));
            result.write(intToByteArray(this.cellPadding / 2));
            result.write(DocWriter.getISOBytes("\\clpadb"));
            result.write(intToByteArray(this.cellPadding / 2));
            result.write(DocWriter.getISOBytes("\\clpadfl3"));
            result.write(DocWriter.getISOBytes("\\clpadft3"));
            result.write(DocWriter.getISOBytes("\\clpadfr3"));
            result.write(DocWriter.getISOBytes("\\clpadfb3"));
        }
        result.write(DocWriter.getISOBytes("\\cellx"));
        result.write(intToByteArray(this.cellRight));
    }
889199
void write(Writer out)
         throws IOException
    {
        out.write("<frame scrolling=\""+scrolling+"\""+resize+border);
        
        if(src!=null)
            out.write(" src=\""+src+"\"");
        if(name!=null)
            out.write(" name=\""+name+"\"");
        out.write(">");
    }
1062736
public void writeDefinition(final OutputStream result) throws IOException
    {
        result.write(DocWriter.getISOBytes("{"));
        result.write(DocWriter.getISOBytes("\\stylesheet"));
        result.write(RtfBasicElement.DELIMITER);
        this.document.outputDebugLinebreak(result);
        Iterator it = this.styleMap.values().iterator();
        while(it.hasNext()) {
        	RtfParagraphStyle rps = (RtfParagraphStyle)it.next();
        	rps.writeDefinition(result);
        }
        result.write(DocWriter.getISOBytes("}"));
        this.document.outputDebugLinebreak(result);  	
    }
870026
public void setResult(T result) {
        lock.lock();
        try {
            if(Objects.equals(expected_result, result))
                super.setResult(result);
        }
        finally {
            lock.unlock();
        }
    }
743025
private void write(ContentResult contentResult) throws IOException {
        if (contentResult.getName() != null) {
            openCurlyBracket();
            writeName(contentResult.getName());
        }
        if (contentResult.isEmpty()) {
            writeNull();
        } else if (contentResult.size() == 1) {
            ActionResult actionResult = contentResult.get(0);
            if (actionResult.getActionId() != null) {
                openCurlyBracket();
                writeName(actionResult.getActionId());
                write(actionResult.getResultValue());
                closeCurlyBracket();
            } else {
                write(actionResult.getResultValue());
            }
        } else {
            openCurlyBracket();
            int cnt = 0;
            for (String actionId : contentResult.getActionIds()) {
                if (cnt++ > 0) {
                    writeComma();
                }
                ActionResult actionResult = contentResult.getActionResult(actionId);
                writeName(actionResult.getActionId());
                write(actionResult.getResultValue());
            }
            closeCurlyBracket();
        }
        if (contentResult.getName() != null) {
            closeCurlyBracket();
        }
    }
1227995
public void writeDefinition(final OutputStream result) throws IOException 
    {
        result.write(DocWriter.getISOBytes("{"));
        result.write(DocWriter.getISOBytes("\\style"));
        result.write(DocWriter.getISOBytes("\\s"));
        result.write(intToByteArray(this.styleNumber));
        result.write(RtfBasicElement.DELIMITER);
        writeParagraphSettings(result);
        super.writeBegin(result);
        result.write(RtfBasicElement.DELIMITER);
        result.write(DocWriter.getISOBytes(this.styleName));
        result.write(DocWriter.getISOBytes(";"));
        result.write(DocWriter.getISOBytes("}"));
        this.document.outputDebugLinebreak(result);   	
    }
636274
public void writeContent(final OutputStream result) throws IOException
    {
        this.font.writeBegin(result);
        writeFieldBegin(result);
        writeFieldInstBegin(result);
        writeFieldInstContent(result);
        writeFieldInstEnd(result);
        writeFieldResultBegin(result);
        writeFieldResultContent(result);
        writeFieldResultEnd(result);
        writeFieldEnd(result);
        this.font.writeEnd(result);
    }
115700
public void writeContent(final OutputStream result) throws IOException
    {
        Iterator it = this.borders.values().iterator();
        while(it.hasNext()) {
            ((RtfBorder) it.next()).writeContent(result);
        }
    }
726131
public void writeContent(final OutputStream result) throws IOException
    {    	
    	result.write(DocWriter.getISOBytes("\\shpleft"));
    	result.write(intToByteArray(this.left));
    	result.write(DocWriter.getISOBytes("\\shptop"));
    	result.write(intToByteArray(this.top));
    	result.write(DocWriter.getISOBytes("\\shpright"));
    	result.write(intToByteArray(this.right));
    	result.write(DocWriter.getISOBytes("\\shpbottom"));
    	result.write(intToByteArray(this.bottom));
    	result.write(DocWriter.getISOBytes("\\shpz"));
    	result.write(intToByteArray(this.zOrder));
    	switch(this.xRelativePos) {
    	case POSITION_X_RELATIVE_PAGE: result.write(DocWriter.getISOBytes("\\shpbxpage")); break;
    	case POSITION_X_RELATIVE_MARGIN: result.write(DocWriter.getISOBytes("\\shpbxmargin")); break;
    	case POSITION_X_RELATIVE_COLUMN: result.write(DocWriter.getISOBytes("\\shpbxcolumn")); break;
    	}
    	if(this.ignoreXRelative) {
    		result.write(DocWriter.getISOBytes("\\shpbxignore"));
    	}
    	switch(this.yRelativePos) {
    	case POSITION_Y_RELATIVE_PAGE: result.write(DocWriter.getISOBytes("\\shpbypage")); break;
    	case POSITION_Y_RELATIVE_MARGIN: result.write(DocWriter.getISOBytes("\\shpbymargin")); break;
    	case POSITION_Y_RELATIVE_PARAGRAPH: result.write(DocWriter.getISOBytes("\\shpbypara")); break;
    	}
    	if(this.ignoreYRelative) {
    		result.write(DocWriter.getISOBytes("\\shpbyignore"));
    	}
    	if(this.shapeBelowText) {
    		result.write(DocWriter.getISOBytes("\\shpfblwtxt1"));
    	} else {
    		result.write(DocWriter.getISOBytes("\\shpfblwtxt0"));
    	}
    }
1108628
private void writeResult(Object result) throws IOException {
		File outputFile = new File(outputFileLocation);
		File tempfile = FileSupport.createFile(tempOutputFileLocation);
		FileOutputStream fos = null;
		try {
			fos = new FileOutputStream(tempfile);
			PrintStream ps = new PrintStream(new FileOutputStream(tempfile));
			if (result != null) {
				if (result instanceof Throwable) {
					((Throwable) result).printStackTrace(ps);
				}
				ps.println(result.toString());
			}
			ps.close();
		} finally {
			fos.close();
		}

		if (outputFile.exists()) {
			boolean success = outputFile.delete();
		}

		boolean success = tempfile.renameTo(new File(outputFileLocation));
	}
161470
void writeResult(final RpcResult<?, ?> result, final HttpServletResponse resp)
			throws IOException {
		if (result.isSuccess()) {
			resp.setStatus(HttpServletResponse.SC_OK);
			resp.setContentType(JSON_CONTENT_TYPE);
		} else {
			resp.setStatus(APPLICATION_EXC_STATUS);
			resp.setContentType(JSON_CONTENT_TYPE);
		}

		PrintWriter writer = resp.getWriter();
		result.toJson(writer, true);
		writer.flush();
	}
1371815
private void writeFieldResultBegin(final OutputStream result) throws IOException 
    {
        result.write(OPEN_GROUP);
        result.write(FIELD_RESULT);
        result.write(DELIMITER);
    }
996958
public void writeContent(final OutputStream result) throws IOException
    {
        if(this.mode == MODE_SINGLE) {
        	headerAll.writeContent(result);
        } else if(this.mode == MODE_MULTIPLE) {
            if(headerFirst != null) {
            	headerFirst.writeContent(result);
            }
            if(headerLeft != null) {
                headerLeft.writeContent(result);
            }
            if(headerRight != null) {
                headerRight.writeContent(result);
            }
            if(headerAll != null) {
                headerAll.writeContent(result);
            }
        }
    }