Changeset View
Changeset View
Standalone View
Standalone View
commands/tools/selection/text/kpToolTextChangeStyleCommand.cpp
Show All 39 Lines | 39 | kpToolTextChangeStyleCommand::kpToolTextChangeStyleCommand (const QString &name, | |||
---|---|---|---|---|---|
40 | const kpTextStyle &newTextStyle, const kpTextStyle &oldTextStyle, | 40 | const kpTextStyle &newTextStyle, const kpTextStyle &oldTextStyle, | ||
41 | kpCommandEnvironment *environ) | 41 | kpCommandEnvironment *environ) | ||
42 | : kpNamedCommand (name, environ), | 42 | : kpNamedCommand (name, environ), | ||
43 | m_newTextStyle (newTextStyle), | 43 | m_newTextStyle (newTextStyle), | ||
44 | m_oldTextStyle (oldTextStyle) | 44 | m_oldTextStyle (oldTextStyle) | ||
45 | { | 45 | { | ||
46 | } | 46 | } | ||
47 | 47 | | |||
48 | kpToolTextChangeStyleCommand::~kpToolTextChangeStyleCommand () | 48 | kpToolTextChangeStyleCommand::~kpToolTextChangeStyleCommand () = default; | ||
49 | { | | |||
50 | } | | |||
51 | 49 | | |||
52 | 50 | | |||
53 | // public virtual [base kpCommand] | 51 | // public virtual [base kpCommand] | ||
54 | kpCommandSize::SizeType kpToolTextChangeStyleCommand::size () const | 52 | kpCommandSize::SizeType kpToolTextChangeStyleCommand::size () const | ||
55 | { | 53 | { | ||
56 | return 0; | 54 | return 0; | ||
57 | } | 55 | } | ||
58 | 56 | | |||
59 | 57 | | |||
60 | // public virtual [base kpCommand] | 58 | // public virtual [base kpCommand] | ||
61 | void kpToolTextChangeStyleCommand::execute () | 59 | void kpToolTextChangeStyleCommand::execute () | ||
62 | { | 60 | { | ||
63 | qCDebug(kpLogCommands) << "kpToolTextChangeStyleCommand::execute()" | 61 | qCDebug(kpLogCommands) << "kpToolTextChangeStyleCommand::execute()" | ||
64 | << " font=" << m_newTextStyle.fontFamily () | 62 | << " font=" << m_newTextStyle.fontFamily () | ||
65 | << " fontSize=" << m_newTextStyle.fontSize () | 63 | << " fontSize=" << m_newTextStyle.fontSize () | ||
66 | << " isBold=" << m_newTextStyle.isBold () | 64 | << " isBold=" << m_newTextStyle.isBold () | ||
67 | << " isItalic=" << m_newTextStyle.isItalic () | 65 | << " isItalic=" << m_newTextStyle.isItalic () | ||
68 | << " isUnderline=" << m_newTextStyle.isUnderline () | 66 | << " isUnderline=" << m_newTextStyle.isUnderline () | ||
69 | << " isStrikeThru=" << m_newTextStyle.isStrikeThru () | 67 | << " isStrikeThru=" << m_newTextStyle.isStrikeThru (); | ||
70 | << endl; | | |||
71 | 68 | | |||
72 | environ ()->setTextStyle (m_newTextStyle); | 69 | environ ()->setTextStyle (m_newTextStyle); | ||
73 | 70 | | |||
74 | if (textSelection ()) | 71 | if (textSelection ()) { | ||
75 | textSelection ()->setTextStyle (m_newTextStyle); | 72 | textSelection ()->setTextStyle (m_newTextStyle); | ||
76 | } | 73 | } | ||
74 | } | ||||
77 | 75 | | |||
78 | // public virtual [base kpCommand] | 76 | // public virtual [base kpCommand] | ||
79 | void kpToolTextChangeStyleCommand::unexecute () | 77 | void kpToolTextChangeStyleCommand::unexecute () | ||
80 | { | 78 | { | ||
81 | qCDebug(kpLogCommands) << "kpToolTextChangeStyleCommand::unexecute()" | 79 | qCDebug(kpLogCommands) << "kpToolTextChangeStyleCommand::unexecute()" | ||
82 | << " font=" << m_newTextStyle.fontFamily () | 80 | << " font=" << m_newTextStyle.fontFamily () | ||
83 | << " fontSize=" << m_newTextStyle.fontSize () | 81 | << " fontSize=" << m_newTextStyle.fontSize () | ||
84 | << " isBold=" << m_newTextStyle.isBold () | 82 | << " isBold=" << m_newTextStyle.isBold () | ||
85 | << " isItalic=" << m_newTextStyle.isItalic () | 83 | << " isItalic=" << m_newTextStyle.isItalic () | ||
86 | << " isUnderline=" << m_newTextStyle.isUnderline () | 84 | << " isUnderline=" << m_newTextStyle.isUnderline () | ||
87 | << " isStrikeThru=" << m_newTextStyle.isStrikeThru () | 85 | << " isStrikeThru=" << m_newTextStyle.isStrikeThru (); | ||
88 | << endl; | | |||
89 | 86 | | |||
90 | environ ()->setTextStyle (m_oldTextStyle); | 87 | environ ()->setTextStyle (m_oldTextStyle); | ||
91 | 88 | | |||
92 | if (textSelection ()) | 89 | if (textSelection ()) | ||
93 | textSelection ()->setTextStyle (m_oldTextStyle); | 90 | textSelection ()->setTextStyle (m_oldTextStyle); | ||
94 | } | 91 | } | ||
95 | 92 | |