Improve DocBook support.
[gpl/argeo-suite.git] / publishing / org.argeo.publishing.ui / src / org / argeo / cms / text / TextSection.java
index b7b07797f922e0d66e38b7b1baa942eee08830b7..4f514bf763c4ad380262e9eb40c0863409c5ef28 100644 (file)
@@ -1,11 +1,11 @@
 package org.argeo.cms.text;
 
 import javax.jcr.Node;
-import javax.jcr.RepositoryException;
 
 import org.argeo.cms.ui.util.CmsUiUtils;
 import org.argeo.cms.ui.viewers.Section;
 import org.argeo.cms.ui.widgets.TextStyles;
+import org.eclipse.swt.SWT;
 import org.eclipse.swt.widgets.Composite;
 
 public class TextSection extends Section implements CmsNames {
@@ -13,33 +13,38 @@ public class TextSection extends Section implements CmsNames {
        private String defaultTextStyle = TextStyles.TEXT_DEFAULT;
        private String titleStyle;
 
-       public TextSection(Composite parent, int style, Node node)
-                       throws RepositoryException {
+       private final boolean flat;
+
+       private boolean titleReadOnly = false;
+
+       public TextSection(Composite parent, int style, Node node) {
                this(parent, findSection(parent), style, node);
        }
 
-       public TextSection(TextSection section, int style, Node node)
-                       throws RepositoryException {
+       public TextSection(TextSection section, int style, Node node) {
                this(section, section.getParentSection(), style, node);
        }
 
-       private TextSection(Composite parent, Section parentSection, int style,
-                       Node node) throws RepositoryException {
+       private TextSection(Composite parent, Section parentSection, int style, Node node) {
                super(parent, parentSection, style, node);
-               CmsUiUtils.style(this, TextStyles.TEXT_SECTION);
+               flat = SWT.FLAT == (style & SWT.FLAT);
+               //CmsUiUtils.style(this, TextStyles.TEXT_SECTION);
        }
 
        public String getDefaultTextStyle() {
                return defaultTextStyle;
        }
 
+       public boolean isFlat() {
+               return flat;
+       }
+
        public String getTitleStyle() {
                if (titleStyle != null)
                        return titleStyle;
                // TODO make base H styles configurable
                Integer relativeDepth = getRelativeDepth();
-               return relativeDepth == 0 ? TextStyles.TEXT_TITLE : TextStyles.TEXT_H
-                               + relativeDepth;
+               return relativeDepth == 0 ? TextStyles.TEXT_TITLE : TextStyles.TEXT_H + relativeDepth;
        }
 
        public void setDefaultTextStyle(String defaultTextStyle) {
@@ -49,4 +54,13 @@ public class TextSection extends Section implements CmsNames {
        public void setTitleStyle(String titleStyle) {
                this.titleStyle = titleStyle;
        }
+
+       public boolean isTitleReadOnly() {
+               return titleReadOnly;
+       }
+
+       public void setTitleReadOnly(boolean titleReadOnly) {
+               this.titleReadOnly = titleReadOnly;
+       }
+
 }