Skip to main content
summaryrefslogtreecommitdiffstats
blob: 5768ef141fb409e540bf4a259157dd2336f07945 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
/*******************************************************************************
 * Copyright (c) 2006 Sybase, Inc. and others.
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     Sybase, Inc. - initial API and implementation
 *******************************************************************************/
package org.eclipse.jst.pagedesigner.css2;

import java.util.Map;

import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.draw2d.geometry.Insets;
import org.eclipse.jst.pagedesigner.css2.font.ICSSFont;
import org.eclipse.jst.pagedesigner.css2.list.ICounterValueGenerator;
import org.eclipse.wst.sse.core.internal.provisional.INodeAdapter;

/**
 * The style declaration for an element can be cached.
 * 
 * @author mengbo
 */
public interface ICSSStyle extends INodeAdapter, IAdaptable {

    // the number of extra pixels to add to top, bottom, left and right padding insets
    // in the rendering so that separation between contained components is more
    // apparent at design time.  These extra pixels are design mode only
    // Note: margin padding would be preferred but it doesn't seem to affect
    // bottom padding the way border insets do.
    // TODO:  this should be set to a preference and probably also use an
    // algorithm to determine if the the current box style already has a large
    // enough separation offset (perhaps a threshold instead of an additive value)
    /**
     * the border offset
     */
    public static final int ARTIFICIAL_BORDER_OFFSET = 4;
    
    /**
     * 
     */
    public static final int INHERIT = Integer.MIN_VALUE;
    
	/**
	 * the top attribute vale
	 */
	public static final String TOP = "top"; //$NON-NLS-1$

	/**
	 * the right attribute value
	 */
	public static final String RIGHT = "right"; //$NON-NLS-1$

	/**
	 * the left attribute value
	 */
	public static final String LEFT = "left"; //$NON-NLS-1$

	/**
	 * the bottom attribute value
	 */
	public static final String BOTTOM = "bottom"; //$NON-NLS-1$

	/**
	 * 
	 */
	public void reset();

	/**
	 * @return the font
	 */
	public ICSSFont getCSSFont();

	/**
	 * @param property
	 * @return the style property
	 */
	public Object getStyleProperty(String property);

	/**
	 * @return the margin insets
	 */
	public Insets getMarginInsets();

	/**
	 * @return the border insets
	 */
	public Insets getBorderInsets();

	/**
	 * @return the padding insets
	 */
	public Insets getPaddingInsets();

	/**
	 * shortcut method to get the CSS display.
	 * 
	 * see http://www.w3.org/TR/REC-CSS2/visuren.html#propdef-display
	 * @return the display string
	 */
	public String getDisplay();

	/**
	 * null means transparent.
	 * 
	 * @return the background color
	 */
	public Object getBackgroundColor();

	/**
	 * @return the foreground color
	 */
	public Object getColor();

	/**
	 * @return true if size includes border padding
	 */
	public boolean isSizeIncludeBorderPadding();

	/**
	 * 
	 */
	public void dispose();

	/**
	 * @return the parent style
	 */
	public ICSSStyle getParentStyle();

	/**
	 * Get counters declared on this style. the counters are either created by
	 * counter-reset or refered by counter-increment
	 * 
	 * @return the counters
	 */
	public Map getCounters();

	/**
	 * Search a named counter declared on this style or its ancestors' styles
	 * 
	 * @param name
	 * @param must
	 * @return the generator
	 */
	public ICounterValueGenerator findCounter(String name, boolean must);

	/**
	 * Currently, rowspan and colspan are not CSS property. But based on the CSS
	 * specification, it is expected in the future this two will be added as CSS
	 * property, so we also include them into ICSSStyle
	 * 
	 * @return the row span
	 */
	public int getRowSpan();

	/**
	 * @return the column span
	 */
	public int getColSpan();

	/**
	 * Normally, when layout a figure and its children. We'll reset the counters
	 * declared on this style. And if there are "counter-increment" on this
	 * style, they'll also be processed.
	 * 
	 */
	public void processCounters();

	/**
	 * Whether the corresponding figure should be draw in selected mode. This is
	 * not a real CSS property. This is a shortcut method. implemented through
	 * getAdapter() on IRangeSelectionProxy
	 * 
	 * @return true if in selection
	 */
	public boolean isInSelection();

	/**
	 * @param propertyName
	 * @return the element init value
	 */
	public Object getHTMLelementInitValue(String propertyName);
}

Back to the top