Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /* ====================================================================
     Licensed to the Apache Software Foundation (ASF) under one or more
     contributor license agreements.  See the NOTICE file distributed with
     this work for additional information regarding copyright ownership.
     The ASF licenses this file to You under the Apache License, Version 2.0
     (the "License"); you may not use this file except in compliance with
     the License.  You may obtain a copy of the License at
  
         http://www.apache.org/licenses/LICENSE-2.0
 
    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
 ==================================================================== */
 
 package org.apache.poi.hwpf.usermodel;
 
 
 
 
 
This class is used to create a list in a Word document. It is used in conjunction with registerList in HWPFDocument. In Word, lists are not ranged entities, meaning you can't actually add one to the document. Lists only act as properties for list entries. Once you register a list, you can add list entries to a document that are a part of the list. The only benefit of this that I see, is that you can add a list entry anywhere in the document and continue numbering from the previous list.

Author(s):
Ryan Ackley
 
 public final class HWPFList
 {
     private static POILogger log = POILogFactory.getLoggerHWPFList.class );
 
     private boolean _ignoreLogicalLeftIdentation = false;
     private LFO _lfo;
     private LFOData _lfoData;
     private ListData _listData;
     private ListTables _listTables;
     private boolean _registered;
     private StyleSheet _styleSheet;

    

Parameters:
numbered true if the list should be numbered; false if it should be bulleted.
styleSheet The document's stylesheet.
 
     public HWPFListboolean numberedStyleSheet styleSheet )
     {
          = new ListData(
                 (int) ( Math.random() * System.currentTimeMillis() ), numbered );
          = new LFO();
         .setLsid.getLsid() );
          = new LFOData();
          = styleSheet;
     }
 
     public HWPFListStyleSheet styleSheetListTables listTablesint ilfo )
     {
          = listTables;
          = styleSheet;
          = true;
 
         /* See documentation for sprmPIlfo (0x460B) */
         if ( ilfo == 0 || ilfo == 0xF801 )
         {
             throw new IllegalArgumentException"Paragraph not in list" );
         }
         else if ( 0x0001 <= ilfo && ilfo <= 0x07FE )
         {
              = listTables.getLfoilfo );
              = listTables.getLfoDatailfo );
         }
         else if ( 0xF802 <= ilfo && ilfo <= 0xFFFF )
        {
            int nilfo = ilfo ^ 0xFFFF;
             = listTables.getLfonilfo );
             = listTables.getLfoDatanilfo );
             = true;
        }
        else
        {
            throw new IllegalArgumentException"Incorrect ilfo: " + ilfo );
        }
         = listTables.getListData.getLsid() );
    }
    @Internal
    public LFO getLFO()
    {
        return ;
    }
    @Internal
    public LFOData getLFOData()
    {
        return ;
    }
    @Internal
    public ListData getListData()
    {
        return ;
    }
    public int getLsid()
    {
        return .getLsid();
    }
    @Internal
    ListLevel getLVLchar level )
    {
        if ( level >= .numLevels() )
        {
            throw new IllegalArgumentException"Required level "
                    + ( (intlevel )
                    + " is more than number of level for list ("
                    + .numLevels() + ")" );
        }
        ListLevel lvl = .getLevels()[level];
        return lvl;
    }

    
An MSONFC, as specified in [MS-OSHARED] section 2.2.1.3, that specifies the format of the level numbers that replace the placeholders for this level in the xst fields of the LVLs in this list. This value MUST not be equal to 0x08, 0x09, 0x0F, or 0x13. If this is equal to 0xFF or 0x17, this level does not have a number sequence and therefore has no number formatting. If this is equal to 0x17, the level uses bullets.
    public int getNumberFormatchar level )
    {
        return getLVLlevel ).getNumberFormat();
    }
    public String getNumberTextchar level )
    {
        return getLVLlevel ).getNumberText();
    }
    public int getStartAtchar level )
    {
        if ( isStartAtOverridenlevel ) )
        {
            return .getRgLfoLvl()[level].getIStartAt();
        }
        return getLVLlevel ).getStartAt();
    }

    
"The type of character following the number text for the paragraph: 0 == tab, 1 == space, 2 == nothing."
    public byte getTypeOfCharFollowingTheNumberchar level )
    {
        return getLVLlevel ).getTypeOfCharFollowingTheNumber();
    }
    public boolean isIgnoreLogicalLeftIdentation()
    {
        return ;
    }
    public boolean isStartAtOverridenchar level )
    {
        ListFormatOverrideLevel lfolvl = .getRgLfoLvl().length > level ? 
                .getRgLfoLvl()[level] : null;
        return lfolvl != null && lfolvl.getIStartAt() != 0
                && !lfolvl.isFormatting();
    }
    public void setIgnoreLogicalLeftIdentation(
            boolean ignoreLogicalLeftIdentation )
    {
        this. = ignoreLogicalLeftIdentation;
    }

    
Sets the character properties of the list numbers.

Parameters:
level the level number that the properties should apply to.
chp The character properties.
    public void setLevelNumberPropertiesint levelCharacterProperties chp )
    {
        ListLevel listLevel = .getLevellevel );
        int styleIndex = .getLevelStylelevel );
        CharacterProperties base = .getCharacterStylestyleIndex );
        byte[] grpprl = CharacterSprmCompressor.compressCharacterPropertychp,
                base );
        listLevel.setNumberPropertiesgrpprl );
    }

    
Sets the paragraph properties for a particular level of the list.

Parameters:
level The level number.
pap The paragraph properties
    public void setLevelParagraphPropertiesint levelParagraphProperties pap )
    {
        ListLevel listLevel = .getLevellevel );
        int styleIndex = .getLevelStylelevel );
        ParagraphProperties base = .getParagraphStylestyleIndex );
        byte[] grpprl = ParagraphSprmCompressor.compressParagraphPropertypap,
                base );
        listLevel.setLevelPropertiesgrpprl );
    }
    public void setLevelStyleint levelint styleIndex )
    {
        .setLevelStylelevelstyleIndex );
    }
New to GrepCode? Check out our FAQ X