Browse Source

Pull request #1788: REPORT-34954 富文本上标下标不应该可以同时设置

Merge in DESIGN/design from ~HUGH.C/design:release/10.0 to release/10.0

* commit 'b4bb3235df0fa7eb37c4284d0575b26e188ca83f':
  REPORT-34954 富文本上标下标不应该可以同时设置
  REPORT-34954 富文本上标下标可以同时设置
feature/big-screen
Hugh.C 4 years ago
parent
commit
998c68b62e
  1. 10
      designer-realize/src/main/java/com/fr/design/cell/editor/RichTextToolBar.java

10
designer-realize/src/main/java/com/fr/design/cell/editor/RichTextToolBar.java

@ -256,8 +256,11 @@ public class RichTextToolBar extends BasicPane{
@Override
public void actionPerformed(ActionEvent e) {
boolean isSub = RichTextToolBar.this.subPane.isSelected();
// 调用setCharacterAttributes函数设置文本区选择文本的字体
MutableAttributeSet attr = new SimpleAttributeSet();
if (!isSub && RichTextToolBar.this.superPane.isSelected()) {
StyleConstants.setSuperscript(attr, false);
}
// 调用setCharacterAttributes函数设置文本区选择文本的字体
StyleConstants.setSubscript(attr, !isSub);
setCharacterAttributes(RichTextToolBar.this.textPane, attr, false);
}
@ -269,6 +272,9 @@ public class RichTextToolBar extends BasicPane{
boolean isSuper = RichTextToolBar.this.superPane.isSelected();
// 调用setCharacterAttributes函数设置文本区选择文本的字体
MutableAttributeSet attr = new SimpleAttributeSet();
if (!isSuper && RichTextToolBar.this.subPane.isSelected()) {
StyleConstants.setSubscript(attr, false);
}
StyleConstants.setSuperscript(attr, !isSuper);
setCharacterAttributes(RichTextToolBar.this.textPane, attr, false);
}
@ -402,7 +408,7 @@ public class RichTextToolBar extends BasicPane{
bold.setSelected(isBold);
italic.setSelected(isItalic);
underline.setSelected(isUnderline);
subPane.setSelected(isSubscript);
subPane.setSelected(isSuperscript ? false : isSubscript);
superPane.setSelected(isSuperscript);
//为什么字体名称, 大小, 颜色, 不需要去判断是否全相同呢
//因为如果全相同, 则设置为第一个字符的样式, 如果不全相同, 那么默认也设置成第一个字符的样式.

Loading…
Cancel
Save