com.hfg.xml.msofficexml.part.SettingsPart Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of com_hfg Show documentation
Show all versions of com_hfg Show documentation
com.hfg xml, html, svg, and bioinformatics utility library
package com.hfg.xml.msofficexml.part;
import com.hfg.xml.XMLTag;
import com.hfg.xml.msofficexml.RelationshipType;
import com.hfg.xml.msofficexml.docx.Docx;
import com.hfg.xml.msofficexml.docx.wordprocessingml.WmlXML;
//------------------------------------------------------------------------------
/**
Represents an Office Open XML settings 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]
//------------------------------------------------------------------------------
public class SettingsPart extends OfficeXMLPart
{
//###########################################################################
// CONSTRUCTORS
//###########################################################################
//---------------------------------------------------------------------------
public SettingsPart(Docx inDocx)
{
super(inDocx);
setFile(WmlXML.SETTINGS_FILE);
XMLTag rootTag = new XMLTag(WmlXML.SETTINGS);
rootTag.addXMLNamespaceDeclaration(WmlXML.WORDPROCESSINGML_NAMESPACE);
setRootNode(rootTag);
inDocx.getMainDocPartRelationshipPart().addRelationship(RelationshipType.SETTINGS, WmlXML.SETTINGS_FILE);
}
//###########################################################################
// PUBLIC METHODS
//###########################################################################
//---------------------------------------------------------------------------
public SettingsPart setHideGrammaticalErrors(boolean inValue)
{
getOrCreateSubtag(WmlXML.HIDE_GRAMMATICAL_ERRORS).setAttribute(WmlXML.VALUE_ATT, inValue);
return this;
}
//---------------------------------------------------------------------------
public SettingsPart setHideSpellingErrors(boolean inValue)
{
getOrCreateSubtag(WmlXML.HIDE_SPELLING_ERRORS).setAttribute(WmlXML.VALUE_ATT, inValue);
return this;
}
//---------------------------------------------------------------------------
public SettingsPart setCleanSpellingProofState()
{
getOrCreateSubtag(WmlXML.PROOF_STATE).setAttribute(WmlXML.SPELLING_ATT, "clean");
return this;
}
//---------------------------------------------------------------------------
public SettingsPart setDirtySpellingProofState()
{
getOrCreateSubtag(WmlXML.PROOF_STATE).setAttribute(WmlXML.SPELLING_ATT, "dirty");
return this;
}
//---------------------------------------------------------------------------
public SettingsPart setCleanGrammarProofState()
{
getOrCreateSubtag(WmlXML.PROOF_STATE).setAttribute(WmlXML.GRAMMAR_ATT, "clean");
return this;
}
//---------------------------------------------------------------------------
public SettingsPart setDirtyGrammarProofState()
{
getOrCreateSubtag(WmlXML.PROOF_STATE).setAttribute(WmlXML.GRAMMAR_ATT, "dirty");
return this;
}
//---------------------------------------------------------------------------
/**
Specifies that hosting applications shall remove all personal information of
document authors upon saving a given WordprocessingML document. The definition
and extent of personal information is not defined by ECMA-376.
*/
public SettingsPart setRemovePersonalInfo(boolean inValue)
{
getOrCreateSubtag(WmlXML.REMOVE_PERSONAL_INFO).setAttribute(WmlXML.VALUE_ATT, inValue);
return this;
}
//---------------------------------------------------------------------------
/**
Specifies if a document's Thumbnail part should be generated for the contents
of the first page of this document when saved by application which support
document thumbnail generation.
*/
public SettingsPart setSavePreviewPicture(boolean inValue)
{
getOrCreateSubtag(WmlXML.SAVE_PREVIEW_PICT).setAttribute(WmlXML.VALUE_ATT, inValue);
return this;
}
//---------------------------------------------------------------------------
/**
Specifies that applications shall track revisions made to the WordprocessingML
document. Revisions are changes to a WordprocessingML document which are recorded
such that they can be viewed independently, accepted or removed, and reverted if
needed. When revisions are tracked, the resulting WordprocessingML markup in the
Revisions subclause of this document describes the necessary syntax.
*/
public SettingsPart setTrackRevisions(boolean inValue)
{
getOrCreateSubtag(WmlXML.TRACK_REVISIONS).setAttribute(WmlXML.VALUE_ATT, inValue);
return this;
}
}