Package writer2latex.latex

Examples of writer2latex.latex.Context


               .append("\\label").append(sName[i]).append("{");
            // Apply text style if required
            BeforeAfter baText = new BeforeAfter();
            if (bUseTextStyle) {
                String sStyleName = style.getLevelProperty(i,XMLString.TEXT_STYLE_NAME);
                palette.getCharSc().applyTextStyle(sStyleName,baText,new Context());
            }

            // Create label content
            if (style.isNumber(i)) {
                String sPrefix = style.getLevelProperty(i,XMLString.STYLE_NUM_PREFIX);
View Full Code Here


        makeDrawTextBox(node, ldp, oc);
        ldp.append("\\end{center}").nl();
    }

    private void makeDrawTextBox(Element node, LaTeXDocumentPortion ldp, Context oc) {
        Context ic = (Context) oc.clone();
        ic.setInFrame(true);
        ic.setNoFootnotes(true);

        String sWidth = Misc.truncateLength(node.getAttribute(XMLString.SVG_WIDTH));
        ldp.append("\\begin{minipage}{").append(sWidth).append("}").nl();
        palette.getBlockCv().traverseBlockText(node,ldp,ic);
        ldp.append("\\end{minipage}");
View Full Code Here

        palette.getFieldCv().addTarget(node,"|region",ldp);

        // Apply the style
        String sStyleName = node.getAttribute(XMLString.TEXT_STYLE_NAME);
        BeforeAfter ba = new BeforeAfter();
        Context ic = (Context) oc.clone();
        palette.getSectionSc().applySectionStyle(sStyleName,ba,ic);

        // Do conversion
        if (ba.getBefore().length()>0) { ldp.append(ba.getBefore()).nl(); }
        traverseBlockText(node,ldp,ic);
View Full Code Here

    public void handleTable(Element node, LaTeXDocumentPortion ldp, Context oc) {
        // Get a grid model of the table
        TableGridModel table = new TableGridModel(node);
   
        // Update the context
        Context ic = (Context) oc.clone();
        ic.setInTable(true);
   
        // Apply table style
        boolean bApplyCellFormat = config.formatting()>=Config.CONVERT_MOST;
        TableFormatter formatter = palette.getTableSc().getTableFormatter(table,
            !ic.isInMulticols(), bApplyCellFormat);

        // We may need a hyperlink target
        if (!formatter.isSubtable()) {
            palette.getFieldCv().addTarget(node,"|table",ldp);
        }
   
        // Export table declaration
        BeforeAfter baTable = new BeforeAfter();
        formatter.applyTableStyle(baTable);
        ldp.append(baTable.getBefore()).nl();
   
        // Export rows
        if (bApplyCellFormat || !formatter.isLongtable()) { ic.setNoFootnotes(true); }
        int nRowCount = table.getRowCount();
        int nColCount = table.getColCount();
        boolean bInHeader = false;
        // Add interrow material before first row:
        ldp.append(formatter.getInterrowMaterial(0)).nl();
        for (int nRow=0; nRow<nRowCount; nRow++){
            // Longtables may have headers:
            if (formatter.isLongtable()) {
                if (nRow==0 && table.getRow(nRow).isHeader()) {
                    bInHeader = true;
                    if (!bApplyCellFormat) { ic.setNoFootnotes(true); }
                }
                else if (bInHeader && !table.getRow(nRow).isHeader()) {
                    bInHeader = false;
                    if (!bApplyCellFormat) { ic.setNoFootnotes(false); }
                    palette.getNoteCv().flushFootnotes(ldp,oc)
                    ldp.append("\\endhead").nl();
                }
            }
           
View Full Code Here

     * @param <code>oc</code> the current context
     * @param <code>bOrdered</code> true if this list is an ordered list
     */
    public void handleList(Element node, LaTeXDocumentPortion ldp, Context oc, boolean bOrdered) {
        // Set up new context
        Context ic = (Context) oc.clone();
        ic.incListLevel();

        // If the list contains headings, ignore it!       
        if (ic.isIgnoreLists() || listContainsHeadings(node)) {
            ic.setIgnoreLists(true);
            traverseList(node,ldp,ic);
            return;
        }

        // Get the style name, if we don't know it already
        if (ic.getListStyleName()==null) {
            ic.setListStyleName(node.getAttribute(XMLString.TEXT_STYLE_NAME));
        }

        // Apply the style
        BeforeAfter ba = new BeforeAfter();
        palette.getListSc().applyListStyle(ic.getListStyleName(),ic.getListLevel(),
            bOrdered,"true".equals(node.getAttribute(XMLString.TEXT_CONTINUE_NUMBERING)),
            ba);
     
        // Export the list
        if (ba.getBefore().length()>0) { ldp.append(ba.getBefore()).nl(); }
View Full Code Here

            palette.getI18n().pushSpecialTable(palette.getParSc().getFontName(sStyleName));

            // Apply style
            BeforeAfter baHardPage = new BeforeAfter();
            BeforeAfter baHardChar = new BeforeAfter();
            Context ic = (Context) oc.clone();
            palette.getParSc().applyHardHeadingStyle(nLevel, sStyleName,
                baHardPage, baHardChar, ic);

            // Export the heading
            ldp.append(baHardPage.getBefore());
View Full Code Here

        // Always push the font used
        palette.getI18n().pushSpecialTable(palette.getParSc().getFontName(sStyleName));

        // Apply the style
        BeforeAfter ba = new BeforeAfter();
        Context ic = (Context) oc.clone();
        palette.getParSc().applyParStyle(sStyleName,ba,ic);
   
        // Do conversion
        ldp.append(ba.getBefore());
        if (ic.isVerbatim()) {
            palette.getInlineCv().traverseVerbatimInlineText(node,ldp,ic,false);
        }
        else {
            palette.getInlineCv().traverseInlineText(node,ldp,ic,false);
        }
        ldp.append(ba.getAfter());
        // Add a blank line except within verbatim and last in a block:
        if (!bLastInBlock && !ic.isVerbatim()) { ldp.nl(); }
   
        // Flush any floating frames from this paragraph
        palette.getDrawCv().flushFloatingFrames(ldp,ic);

        // pop the font name
View Full Code Here

               .append("\\label").append(sName[i]).append("{");
            // Apply text style if required
            BeforeAfter baText = new BeforeAfter();
            if (bUseTextStyle) {
                String sStyleName = style.getLevelProperty(i,XMLString.TEXT_STYLE_NAME);
                palette.getCharSc().applyTextStyle(sStyleName,baText,new Context());
            }

            // Create label content
            if (style.isNumber(i)) {
                String sPrefix = style.getLevelProperty(i,XMLString.STYLE_NUM_PREFIX);
View Full Code Here

        // Convert soft style:
        // This must be converted relative to a blank context!
        BeforeAfter baText = new BeforeAfter();
        palette.getI18n().applyLanguage(style,false,true,baText);
        applyFont(style,false,true,baText,new Context());
        applyFontEffects(style,true,baText);
        // declare the text style (\newcommand)
        String sTeXName = styleNames.getExportName(sName);
        styleMap.put(sName,"\\textstyle"+sTeXName+"{","}");
        declarations.append("\\newcommand\\textstyle")
View Full Code Here

     @param <code>style</code> the style to use
     *  @param <code>ba</code> the <code>BeforeAfter</code> to add LaTeX code to
     */
    public void applyHardCharFormatting(StyleWithProperties style, BeforeAfter ba) {
        palette.getI18n().applyLanguage(style,true,false,ba);
        applyFont(style,true,false,ba,new Context());
        if (!ba.isEmpty()) { ba.add(" ",""); }
    }
View Full Code Here

TOP

Related Classes of writer2latex.latex.Context

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.