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.hslf.model;
 
SlideMaster determines the graphics, layout, and formatting for all the slides in a given presentation. It stores information about default font styles, placeholder sizes and positions, background design, and color schemes.

Author(s):
Yegor Kozlov
 
 public final class SlideMaster extends MasterSheet {
     private TextRun[] _runs;

    
all TxMasterStyleAtoms available in this master
 
     private TxMasterStyleAtom[] _txmaster;

    
Constructs a SlideMaster from the MainMaster record,
 
     public SlideMaster(MainMaster recordint sheetNo) {
         super(recordsheetNo);
 
          = findTextRuns(getPPDrawing());
         for (int i = 0; i < .i++) [i].setSheet(this);
     }

    
Returns an array of all the TextRuns found
 
     public TextRun[] getTextRuns() {
         return ;
     }

    
Returns null since SlideMasters doen't have master sheet.
 
     public MasterSheet getMasterSheet() {
         return null;
     }

    
Pickup a style attribute from the master. This is the "workhorse" which returns the default style attrubutes.
 
     public TextProp getStyleAttribute(int txtypeint levelString nameboolean isCharacter) {
 
         TextProp prop = null;
         for (int i = leveli >= 0; i--) {
             TextPropCollection[] styles =
                     isCharacter ? [txtype].getCharacterStyles() : [txtype].getParagraphStyles();
             if (i < styles.lengthprop = styles[i].findByName(name);
             if (prop != nullbreak;
         }
         if (prop == null) {
             if(isCharacter) {
                 switch (txtype) {
                     case .:
                     case .:
                     case .:
                         txtype = .;
                         break;
                     case .:
                         txtype = .;
                         break;
                     default:
                         return null;
                 }
             } else {
                 switch (txtype) {
                     case .:
                     case .:
                     case .:
                         txtype = .;
                         break;
                     case .:
                        txtype = .;
                        break;
                    default:
                        return null;
                }
            }
            prop = getStyleAttribute(txtypelevelnameisCharacter);
        }
        return prop;
    }

    
Assign SlideShow for this slide master. (Used interanlly)
    public void setSlideShow(SlideShow ss) {
        super.setSlideShow(ss);
        //after the slide show is assigned collect all available style records
        if ( == null) {
             = new TxMasterStyleAtom[9];
            [txdoc.getTextType()] = txdoc;
            TxMasterStyleAtom[] txrec = ((MainMaster)getSheetContainer()).getTxMasterStyleAtoms();
            for (int i = 0; i < txrec.lengthi++) {
                int txType = txrec[i].getTextType();
                if([txType] == null[txType] = txrec[i];
            }
        }
    }
    protected void onAddTextShape(TextShape shape) {
        TextRun run = shape.getTextRun();
        if( == null = new TextRun[]{run};
        else {
            TextRun[] tmp = new TextRun[. + 1];
            System.arraycopy(, 0, tmp, 0, .);
            tmp[tmp.length-1] = run;
             = tmp;
        }
    }
        return ;
    }
New to GrepCode? Check out our FAQ X