01: /*
02: * (C) Copyright IBM Corp. 1998-2004. All Rights Reserved.
03: *
04: * The program is provided "as is" without any warranty express or
05: * implied, including the warranty of non-infringement and the implied
06: * warranties of merchantibility and fitness for a particular purpose.
07: * IBM will not be liable for any damages suffered by you as a result
08: * of using the Program. In no event will IBM be liable for any
09: * special, indirect or consequential damages or lost profits even if
10: * IBM has been advised of the possibility of their occurrence. IBM
11: * will not be liable for any third party claims against you.
12: */
13: package com.ibm.richtext.textpanel;
14:
15: import com.ibm.richtext.styledtext.StyleModifier;
16: import com.ibm.richtext.styledtext.MText;
17: import com.ibm.richtext.textformat.TextOffset;
18:
19: class StyleChangeCommand extends TextCommand {
20:
21: static final String COPYRIGHT = "(C) Copyright IBM Corp. 1998-1999 - All Rights Reserved";
22: private boolean fCharacter;
23: private StyleModifier fModifier;
24:
25: public StyleChangeCommand(TextEditBehavior behavior,
26: MText originalText, TextOffset selStartBefore,
27: TextOffset selEndBefore, StyleModifier modifier,
28: boolean character) {
29:
30: super (behavior, originalText, selStartBefore.fOffset,
31: selStartBefore, selEndBefore);
32: fModifier = modifier;
33: fCharacter = character;
34: }
35:
36: public int affectedRangeEnd() {
37: return fSelEndBefore.fOffset;
38: }
39:
40: public void execute() {
41: fBehavior.doModifyStyles(fAffectedRangeStart,
42: fSelEndBefore.fOffset, fModifier, fCharacter,
43: fSelStartBefore, fSelEndBefore);
44: }
45: }
|