All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.hfg.xml.msofficexml.docx.part.VbaDataPart Maven / Gradle / Ivy

There is a newer version: 20240423
Show newest version
package com.hfg.xml.msofficexml.docx.part;


import com.hfg.xml.XMLTag;
import com.hfg.xml.msofficexml.OfficeOpenXMLContentType;
import com.hfg.xml.msofficexml.OfficeOpenXmlDocument;
import com.hfg.xml.msofficexml.OfficeXML;
import com.hfg.xml.msofficexml.docx.wordprocessingml.WmlXML;
import com.hfg.xml.msofficexml.part.OfficeXMLPart;

//------------------------------------------------------------------------------
/**
 Represents an Office Open XML VBA data part.

 @author J. Alex Taylor, hairyfatguy.com
 */
//------------------------------------------------------------------------------
// com.hfg XML/HTML Coding Library
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
//
// J. Alex Taylor, President, Founder, CEO, COO, CFO, OOPS hairyfatguy.com
// [email protected]
//------------------------------------------------------------------------------
/*
Ex:



   


 */

public class VbaDataPart extends OfficeXMLPart
{
   private XMLTag mMcdsTag;

   //---------------------------------------------------------------------------
   public VbaDataPart(OfficeOpenXmlDocument inOfficeDoc)
   {
      super(inOfficeDoc);

      setFile(WmlXML.VBA_DATA_FILE);

      XMLTag rootTag = new XMLTag(WmlXML.VBA_SUPPORT_DATA)
            .setAttribute(OfficeXML.IGNORABLE_ATT, "w14 w15 w16se w16cid w16 w16cex wp14")
            .addXMLNamespaceDeclaration(WmlXML.WORDPROCESSING_CANVAS_NAMESPACE)
            .addXMLNamespaceDeclaration(OfficeXML.CHART_EXTENSIONS_NAMESPACE)
            .addXMLNamespaceDeclaration(OfficeXML.CHART_EXTENSIONS_1_NAMESPACE)
            .addXMLNamespaceDeclaration(OfficeXML.CHART_EXTENSIONS_2_NAMESPACE)
            .addXMLNamespaceDeclaration(OfficeXML.CHART_EXTENSIONS_3_NAMESPACE)
            .addXMLNamespaceDeclaration(OfficeXML.CHART_EXTENSIONS_4_NAMESPACE)
            .addXMLNamespaceDeclaration(OfficeXML.CHART_EXTENSIONS_5_NAMESPACE)
            .addXMLNamespaceDeclaration(OfficeXML.CHART_EXTENSIONS_6_NAMESPACE)
            .addXMLNamespaceDeclaration(OfficeXML.CHART_EXTENSIONS_7_NAMESPACE)
            .addXMLNamespaceDeclaration(OfficeXML.CHART_EXTENSIONS_8_NAMESPACE)
            .addXMLNamespaceDeclaration(OfficeXML.MARKUP_CAPABILITY_NAMESPACE)
            .addXMLNamespaceDeclaration(OfficeXML.DRAWING_INK_NAMESPACE)
            .addXMLNamespaceDeclaration(OfficeXML.DRAWING_MODEL_3D_NAMESPACE)
            .addXMLNamespaceDeclaration(OfficeXML.OFFICE_NAMESPACE)
            .addXMLNamespaceDeclaration(OfficeXML.RELATIONSHIPS_NAMESPACE)
            .addXMLNamespaceDeclaration(OfficeXML.MATH_NAMESPACE)
            .addXMLNamespaceDeclaration(OfficeXML.VML_NAMESPACE)
            .addXMLNamespaceDeclaration(WmlXML.WORDPROCESSING_DRAWING_NAMESPACE)
            .addXMLNamespaceDeclaration(WmlXML.WORDPROCESSING_DRAWING_14_NAMESPACE)
            .addXMLNamespaceDeclaration(WmlXML.WORDML_10_NAMESPACE)
            .addXMLNamespaceDeclaration(WmlXML.WORDPROCESSINGML_NAMESPACE)
            .addXMLNamespaceDeclaration(WmlXML.WORDML_14_NAMESPACE)
            .addXMLNamespaceDeclaration(WmlXML.WORDML_15_NAMESPACE)
            .addXMLNamespaceDeclaration(WmlXML.WORDML_16_NAMESPACE)
            .addXMLNamespaceDeclaration(WmlXML.WORDML_16_COMMENTS_EXTENSIBLE_NAMESPACE)
            .addXMLNamespaceDeclaration(WmlXML.WORDML_16_COMMENTS_IDS_NAMESPACE)
            .addXMLNamespaceDeclaration(WmlXML.WORDML_16_SYMEX_NAMESPACE)
            .addXMLNamespaceDeclaration(WmlXML.WORDPROCESSING_GROUP_NAMESPACE)
            .addXMLNamespaceDeclaration(WmlXML.WORDPROCESSING_INK_NAMESPACE)
            .addXMLNamespaceDeclaration(WmlXML.WORDPROCESSING_SHAPE_NAMESPACE)
            .addXMLNamespaceDeclaration(WmlXML.WORDML_NAMESPACE);

      setRootNode(rootTag);

      mMcdsTag = rootTag.addSubtag(WmlXML.MACRO_COLLECTION);
   }


   //---------------------------------------------------------------------------
   @Override
   public OfficeOpenXMLContentType getContentType()
   {
      return null; // TODO
   }

   //---------------------------------------------------------------------------
   public void addMacro(String inMacroName)
   {
      XMLTag macroTag = new XMLTag(WmlXML.MACRO)
            .setAttribute(WmlXML.MACRO_NAME_ATT, inMacroName.toUpperCase())
            .setAttribute(WmlXML.NAME_ATT, inMacroName)
            .setAttribute(WmlXML.HEX_BINARY_ENCRYPT_ATT, "00")
            .setAttribute(WmlXML.CMG_ATT, "56");

      mMcdsTag.addSubtag(macroTag);
   }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy