/*
 * SDK Pullenti Unitext, version 4.33, fabruary 2026. Copyright (c) 2013-2026, Pullenti. All rights reserved. 
 * Non-Commercial Freeware and Commercial Software. 
 * This class is generated using the converter Unisharping (www.unisharping.ru) from Pullenti C# project. 
 * The latest version of the code is available on the site www.pullenti.ru
 */

package com.pullenti.unitext.internal.word;

public class StyleDefinition {

    private WordDocument owner;

    private STD std;

    @Override
    public String toString() {
        StringBuilder tmp = new StringBuilder();
        tmp.append("'").append(this.getName()).append("'");
        tmp.append(this.getStyles().toString());
        return tmp.toString();
    }

    public String getName() {
        return std.xstzName.toString();
    }


    public boolean isTextStyle() {
        return std.stdf.stdfBase.stk == ((byte)GrLPUpxSw.stkCharGRLPUPXStkValue);
    }


    public StyleDefinition(WordDocument _owner, STD _std) {
        this.owner = _owner;
        this.std = _std;
    }

    public StyleCollection getStyles() {
        java.util.ArrayList<Prl[]> styles = new java.util.ArrayList<Prl[]>();
        this.expandStyles(styles);
        return new StyleCollection(styles);
    }

    public void expandStyles(java.util.ArrayList<Prl[]> styles) {
        if (Integer.compareUnsigned(std.stdf.stdfBase.istdBase, StdfBase.istdNull) != 0) 
            owner.getStyleDefinitionsMap().get(std.stdf.stdfBase.istdBase).expandStyles(styles);
        switch (std.stdf.stdfBase.stk) { 
        case GrLPUpxSw.stkParaGRLPUPXStkValue:
            styles.add(((StkParaGRLPUPX)std.grLPUpxSw).upxPapx.grpprlPapx);
            styles.add(((StkParaGRLPUPX)std.grLPUpxSw).upxChpx.grpprlChpx);
            break;
        case GrLPUpxSw.stkCharGRLPUPXStkValue:
            styles.add(((StkCharGRLPUPX)std.grLPUpxSw).upxChpx.grpprlChpx);
            break;
        case GrLPUpxSw.stkTableGRLPUPXStkValue:
            styles.add(((StkTableGRLPUPX)std.grLPUpxSw).upxTapx.grpprlTapx);
            styles.add(((StkTableGRLPUPX)std.grLPUpxSw).upxPapx.grpprlPapx);
            styles.add(((StkTableGRLPUPX)std.grLPUpxSw).upxChpx.grpprlChpx);
            break;
        case GrLPUpxSw.stkListGRLPUPXStkValue:
            styles.add(((StkListGRLPUPX)std.grLPUpxSw).upxPapx.grpprlPapx);
            break;
    }
    }
    public StyleDefinition() {
    }
}
