Examples of RPr


Examples of org.docx4j.wml.RPr

//      System.out.println(i);
     
      P p = (P)document.getContent().get(i);
     
      PPr pPr = p.getPPr();
      RPr rPr = ((R)p.getContent().get(0)).getRPr();
     
      Text wmlText = (Text)XmlUtils.unwrap(((R)p.getContent().get(0)).getContent().get(0));
     
      log.debug(wmlText.getValue());
     
View Full Code Here

Examples of org.docx4j.wml.RPr

    return ret;
  }

  protected Node wrap(AbstractWmlConversionContext context, String result, Document doc) {
   
    RPr rPr = null;
    Node node = null;
    if (result != null) {
      node = createNode(doc);
      if (result.length() > 0) {
        node.setTextContent(result);
View Full Code Here

Examples of org.docx4j.wml.RPr

   * @param node
   */
  protected void applyStyle(AbstractWmlConversionContext context, FldSimpleModel fldSimpleModel, Node node) {
   
    CTSimpleField ctSimpleField = fldSimpleModel.getFldSimple();
    RPr rPr = null;
    if (node != null) {
      rPr = getRPr(ctSimpleField.getContent());
      if (rPr != null) {
        List<Property> properties = PropertyFactory.createProperties(context.getWmlPackage(), rPr);
        if ((properties != null) && (!properties.isEmpty())) {
View Full Code Here

Examples of org.docx4j.wml.RPr

          // so we can read it using our standard
          // methods.  Its a bit sad that we
          // can't just adorn our DOM tree with the
          // original JAXB objects?
          PPr pPr = null;
          RPr rPr = null;
          RPr rPrParagraphMark = null// required for list item label
          if (pPrNodeIt==null) {  // Never happens?           
          if (log.isDebugEnabled()) {
            log.debug("Here after all!!");
          }
            pPr = propertyResolver.getEffectivePPr(defaultParagraphStyleId);
            rPr = propertyResolver.getEffectiveRPr(defaultParagraphStyleId);
            rPrParagraphMark = rPr;
          } else {
            Node n = pPrNodeIt.nextNode();
            if (n==null) {
              if (log.isDebugEnabled()) {
                log.debug("pPrNodeIt.nextNode() was null (ie there is no pPr in this p)");
              }
                pPr = propertyResolver.getEffectivePPr(defaultParagraphStyleId);
                rPr = propertyResolver.getEffectiveRPr(defaultParagraphStyleId);
                // TODO - in this case, we should be able to compute once,
                // and on subsequent calls, just return pre computed value
            } else {
              if (log.isDebugEnabled()) {
                log.debug( "P actual pPr: "+ XmlUtils.w3CDomNodeToString(n) );
              }
              Unmarshaller u = Context.jc.createUnmarshaller();     
              u.setEventHandler(new org.docx4j.jaxb.JaxbValidationEventHandler());
              Object jaxb = u.unmarshal(n);
            pPrDirect =  (PPr)jaxb;
            pPr = propertyResolver.getEffectivePPr(pPrDirect)
            if ((pPr==null) && (log.isDebugEnabled())) {
              log.debug("pPr null; obtained from: " + XmlUtils.w3CDomNodeToString(n) );
            }
           
            // On the block representing the w:p, we want to put both
              // pPr and rPr attributes.
           
            if (log.isDebugEnabled()) {
              log.debug("getting rPr for paragraph style");
            }
            rPr = propertyResolver.getEffectiveRPr(null, pPrDirect);
              // rPr in pPr direct formatting only applies to paragraph mark,
              // and by virtue of that, to list item label,
              // so pass null here
            // Now, work out the value for list item label
                rPrParagraphMark = XmlUtils.deepCopy(rPr);
//              System.out.println("p rpr-->" + XmlUtils.marshaltoString(pPrDirect.getRPr()));
               
                StyleUtil.apply(pPrDirect.getRPr(), rPrParagraphMark);
           
            }
          }         

      if (log.isDebugEnabled() && pPr!=null) {       
        log.debug("P effective pPr: "+ XmlUtils.marshaltoString(pPr, true, true));         
      }
         
            // Create a DOM builder and parse the fragment     
      Document document = XmlUtils.getNewDocumentBuilder().newDocument();
     
      //log.info("Document: " + document.getClass().getName() );
     
      boolean indentHandledByNumbering = false;
     
      Element foBlockElement;
      Element foListBlock = null;
      if (pPr!=null
          && pPr.getNumPr()!=null
          && pPr.getNumPr().getNumId()!=null
          && pPr.getNumPr().getNumId().getVal().longValue()!=0 //zero means no numbering
          ) {
       
       
        // Its a list item.  At present we make a new list-block for
        // each list-item. This is not great; DocumentModel will ultimately
        // allow us to use fo:list-block properly.

        /* Create something like:
         *      
          <fo:list-block provisional-distance-between-starts="0.5in" start-indent="0.5in">
            <fo:list-item>
              <fo:list-item-label>
                <fo:block font-family="Times New Roman">-</fo:block>
              </fo:list-item-label>
              <fo:list-item-body start-indent="body-start()">
                <fo:block font-family="Times New Roman" font-size="9.0pt" line-height="100%" space-after="0.08in" space-before="0.08in" text-align="justify">
                  <inline xmlns="http://www.w3.org/1999/XSL/Format" id="clauseDPI5123341"/>Content goes here...
                </fo:block>
              </fo:list-item-body>
            </fo:list-item>
          </fo:list-block>
         */       

        foListBlock = document.createElementNS("http://www.w3.org/1999/XSL/Format",
            "fo:list-block");
        document.appendChild(foListBlock);
               
//        foListBlock.setAttribute("provisional-distance-between-starts", "0.5in");
       
        // Need to apply shading at fo:list-block level
        if (pPr.getShd()!=null) {
          PShading pShading = new PShading(pPr.getShd());
          pShading.setXslFO(foListBlock);
        }
       
        Element foListItem = document.createElementNS("http://www.w3.org/1999/XSL/Format",
            "fo:list-item");
        foListBlock.appendChild(foListItem);       

       
        Element foListItemLabel = document.createElementNS("http://www.w3.org/1999/XSL/Format",
            "fo:list-item-label");
        foListItem.appendChild(foListItemLabel);
       
        Element foListItemLabelBody = document.createElementNS("http://www.w3.org/1999/XSL/Format",
            "fo:block");
        foListItemLabel.appendChild(foListItemLabelBody);
       
        Element foListItemBody = document.createElementNS("http://www.w3.org/1999/XSL/Format",
            "fo:list-item-body");
        foListItem.appendChild(foListItemBody)
        foListItemBody.setAttribute(Indent.FO_NAME, "body-start()");
       
            ResultTriple triple;
            if (pPrDirect!=null && pPrDirect.getNumPr()!=null) {
              triple = org.docx4j.model.listnumbering.Emulator.getNumber(
                context.getWmlPackage(), pStyleVal,
                pPrDirect.getNumPr().getNumId().getVal().toString(),
                pPrDirect.getNumPr().getIlvl().getVal().toString() );
            } else {
              // Get the effective values; since we already know this,
              // save the effort of doing this again in Emulator
              Ilvl ilvl = pPr.getNumPr().getIlvl();
              String ilvlString = ilvl == null ? "0" : ilvl.getVal().toString();
              triple = null;
              if (pPr.getNumPr().getNumId()!=null) {
                triple = org.docx4j.model.listnumbering.Emulator.getNumber(
                    context.getWmlPackage(), pStyleVal,
                    pPr.getNumPr().getNumId().getVal().toString(),
                    ilvlString );              
              }
            }
           
           
       
        if (triple==null) {
          log.warn("computed number ResultTriple was null");
              if (log.isDebugEnabled() ) {
                foListItemLabelBody.setAttribute("color", "red");
                foListItemLabelBody.setTextContent("null#");
              }
            } else {

              /* Format the list item label
               *
               * Since it turns out (in FOP at least) that the label and the body
               * don't have the same vertical alignment
               * unless font size is applied at the same level
               * (ie to both -label and -body, or to the block inside each),
               * we have to format the list-item-body as well.
               * This issue only manifests itself if the font size on
               * the outer list-block is larger than the font sizes
               * set inside it.
               */
             
              // OK just to override specific values
              // Values come from numbering rPr, unless overridden in p-level rpr
              if(triple.getRPr()==null) {
               
                if (pPr.getRPr()==null) {
                  // do nothing, since we're already inheriting the formatting in the style
                  // (as opposed to the paragraph mark formatting)
                  // EXCEPT for font
//                  setFont( context,  foListItemLabelBody, rPr.getRFonts());
                  setFont( context,  foListItemLabelBody,  pPr,  rPr,  triple.getNumString());
                } else {
                 
              createFoAttributes(context.getWmlPackage(), rPrParagraphMark, foListItemLabel );                 
              createFoAttributes(context.getWmlPackage(), rPrParagraphMark, foListItemBody )
             
//                  setFont( context,  foListItemLabelBody, rPrParagraphMark.getRFonts());                  
                  setFont( context,  foListItemLabelBody,  pPr,  rPrParagraphMark,  triple.getNumString());
                }
               
              } else {
                RPr actual = XmlUtils.deepCopy(triple.getRPr()); // clone, so the ilvl rpr is not altered
//                System.out.println(XmlUtils.marshaltoString(rPrParagraphMark));
               
                // pMark overrides numbering, except for font
                // (which makes sense, since that would change the bullet)
                // so set the font
View Full Code Here

Examples of org.docx4j.wml.RPr

            }
          }
         
      Object jaxbR = u.unmarshal(rPrNodeIt.nextNode());     
      //RPr rPrDirect = null;
      RPr rPr = null;
      if (jaxbR instanceof RPr) {
        //rPrDirect =  (RPr)jaxbR;
        rPr = propertyResolver.getEffectiveRPr((RPr)jaxbR, pPrDirect);
      } else if (jaxbR instanceof ParaRPr) {
//        if (log.isDebugEnabled()) {
View Full Code Here

Examples of org.docx4j.wml.RPr

    for (int i=0; i<document.getContent().size(); i++) {
     
      P p = (P)document.getContent().get(i);
     
      PPr pPr = p.getPPr();
      RPr rPr = ((R)p.getContent().get(0)).getRPr();
     
      Text wmlText = (Text)XmlUtils.unwrap(((R)p.getContent().get(0)).getContent().get(0));
     
      log.debug(wmlText.getValue());
     
View Full Code Here

Examples of org.docx4j.wml.RPr

    for (int i=0; i<document.getContent().size(); i++) {
     
      P p = (P)document.getContent().get(i);
     
      PPr pPr = p.getPPr();
      RPr rPr = ((R)p.getContent().get(0)).getRPr();
     
      Text wmlText = (Text)XmlUtils.unwrap(((R)p.getContent().get(0)).getContent().get(0));
     
      log.debug(wmlText.getValue());
     
View Full Code Here

Examples of org.docx4j.wml.RPr

    for (int i=0; i<document.getContent().size(); i++) {
     
      P p = (P)document.getContent().get(i);
     
      PPr pPr = p.getPPr();
      RPr rPr = ((R)p.getContent().get(0)).getRPr();
     
      Text wmlText = (Text)XmlUtils.unwrap(((R)p.getContent().get(0)).getContent().get(0));
     
      log.debug(wmlText.getValue());
     
View Full Code Here

Examples of org.docx4j.wml.RPr

  private static void appendRun(SdtBlock currentBlock, List<Object> resultElts) {
   
    List<Object> blkElements = null;
    R run = null;
    RPr blockRPr = null;
    if (currentBlock != null) {
      blkElements = currentBlock.getSdtContent().getContent();
      if (blkElements.size() == 1) {
        //If there is only one element, there is no need to use a sdtBlock
        resultElts.add(blkElements.get(0));
      }
      else {
        resultElts.add(currentBlock);
        //Remove the borders of the child elements
        //(and the shading if it is the same as that of the container)
        blockRPr = findBlockRPr(currentBlock);
        for (Object elem:blkElements) {
          if (elem instanceof R) {
            run = (R)elem;
            if (run.getRPr() != null) {
              run.getRPr().setBdr(null);
              if (!shadingChanged(blockRPr.getShd(), run.getRPr().getShd())) {
                run.getRPr().setShd(null);
              }
            }
          }
        }
View Full Code Here

Examples of org.docx4j.wml.RPr

    for (int i=0; i<document.getContent().size(); i++) {
     
      P p = (P)document.getContent().get(i);
     
      PPr pPr = p.getPPr();
      RPr rPr = ((R)p.getContent().get(0)).getRPr();
     
      Text wmlText = (Text)XmlUtils.unwrap(((R)p.getContent().get(0)).getContent().get(0));
     
      log.debug(wmlText.getValue());
     
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.