kword

KWordTextFrameSetIface.cpp
1/* This file is part of the KDE project
2 Copyright (C) 2002 Laurent MONTEL <lmontel@mandrakesoft.com>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18*/
19
20#include "KWordTextFrameSetIface.h"
21#include "KWordViewIface.h"
22#include "KWTextFrameSet.h"
23#include <KoTextViewIface.h>
24#include "KWView.h"
25#include <KoTextObject.h>
26#include "KWCanvas.h"
27#include "KWDocument.h"
28#include <tdeapplication.h>
29#include <dcopclient.h>
30#include "KWordFrameSetIface.h"
31#include <kdebug.h>
32#include <kcommand.h>
33
34KWordTextFrameSetIface::KWordTextFrameSetIface( KWTextFrameSet *_frame )
35 : KWordFrameSetIface( _frame)
36{
37 m_frametext = _frame;
38}
39
40DCOPRef KWordTextFrameSetIface::startEditing()
41{
42 if ( m_frametext->isDeleted() )
43 return DCOPRef();
44 KWDocument *doc=m_frametext->kWordDocument();
45 TQValueList<KWView *> views = doc->getAllViews();
46 KWCanvas* canvas = views.first()->getGUI()->canvasWidget();
47 canvas->editFrameSet(m_frametext, true);
48 return DCOPRef( kapp->dcopClient()->appId(),
49 (static_cast<KWTextFrameSetEdit *>( canvas->currentFrameSetEdit()))->dcopObject()->objId() );
50}
51
52bool KWordTextFrameSetIface::hasSelection() const
53{
54 return m_frametext->hasSelection();
55}
56
57int KWordTextFrameSetIface::numberOfParagraphs()
58{
59 return m_frametext->paragraphs();
60}
61
62TQString KWordTextFrameSetIface::name() const
63{
64 return m_frametext->name();
65}
66
67TQString KWordTextFrameSetIface::selectedText() const
68{
69 return m_frametext->selectedText();
70}
71
72void KWordTextFrameSetIface::selectAll( bool select )
73{
74 m_frametext->textObject()->selectAll(select);
75}
76
77int KWordTextFrameSetIface::paragraphsSelected()
78{
79 return m_frametext->paragraphsSelected();
80}
81
82void KWordTextFrameSetIface::setBoldText( bool b )
83{
84 KCommand *cmd=m_frametext->textObject()->setBoldCommand( b );
85 delete cmd;
86}
87
88void KWordTextFrameSetIface::setItalicText( bool b )
89{
90 KCommand *cmd=m_frametext->textObject()->setItalicCommand(b);
91 delete cmd;
92}
93
94void KWordTextFrameSetIface::setUnderlineText( bool b )
95{
96 KCommand *cmd=m_frametext->textObject()->setUnderlineCommand(b);
97 delete cmd;
98}
99
100void KWordTextFrameSetIface::setDoubleUnderlineText(bool b)
101{
102 KCommand *cmd=m_frametext->textObject()->setDoubleUnderlineCommand(b);
103 delete cmd;
104}
105
106void KWordTextFrameSetIface::setStrikeOutText( bool b )
107{
108 KCommand *cmd=m_frametext->textObject()->setStrikeOutCommand(b);
109 delete cmd;
110}
111
112void KWordTextFrameSetIface::setTextColor( const TQColor &col )
113{
114 KCommand *cmd=m_frametext->textObject()->setTextColorCommand(col);
115 delete cmd;
116}
117
118void KWordTextFrameSetIface::setTextPointSize( int s )
119{
120 KCommand *cmd=m_frametext->textObject()->setPointSizeCommand( s );
121 delete cmd;
122}
123
124void KWordTextFrameSetIface::setTextSubScript( bool b )
125{
126 KCommand *cmd=m_frametext->textObject()->setTextSubScriptCommand( b );
127 delete cmd;
128}
129
130void KWordTextFrameSetIface::setTextSuperScript( bool b )
131{
132 KCommand *cmd=m_frametext->textObject()->setTextSuperScriptCommand( b );
133 delete cmd;
134}
135
136void KWordTextFrameSetIface::setTextDefaultFormat()
137{
138 KCommand *cmd=m_frametext->textObject()->setDefaultFormatCommand();
139 delete cmd;
140}
141
142void KWordTextFrameSetIface::setTextBackgroundColor(const TQColor & col)
143{
144 KCommand *cmd=m_frametext->textObject()->setTextBackgroundColorCommand(col);
145 delete cmd;
146}
147
148void KWordTextFrameSetIface::setUnderlineColor( const TQColor & color )
149{
150
151 KCommand *cmd=m_frametext->textObject()->setUnderlineColorCommand( color );
152 delete cmd;
153}
154
155
156TQColor KWordTextFrameSetIface::textColor() const
157{
158 return m_frametext->textObject()->textColor();
159}
160
161TQFont KWordTextFrameSetIface::textFont() const
162{
163 return m_frametext->textObject()->textFont();
164}
165
166TQString KWordTextFrameSetIface::textFontFamily()const
167{
168 return m_frametext->textObject()->textFontFamily();
169}
170
171TQColor KWordTextFrameSetIface::textBackgroundColor() const
172{
173 return m_frametext->textObject()->textBackgroundColor();
174}
175
176bool KWordTextFrameSetIface::textItalic() const
177{
178 return m_frametext->textObject()->textItalic();
179}
180
181bool KWordTextFrameSetIface::textBold() const
182{
183 return m_frametext->textObject()->textBold();
184}
185
186bool KWordTextFrameSetIface::textUnderline()const
187{
188 return m_frametext->textObject()->textUnderline();
189}
190
191bool KWordTextFrameSetIface::textDoubleUnderline()const
192{
193 return m_frametext->textObject()->textDoubleUnderline();
194}
195
196TQColor KWordTextFrameSetIface::textUnderlineColor() const
197{
198 return m_frametext->textObject()->textUnderlineColor();
199}
200
201bool KWordTextFrameSetIface::textStrikeOut()const
202{
203 return m_frametext->textObject()->textStrikeOut();
204}
205
206bool KWordTextFrameSetIface::textSubScript() const
207{
208 return m_frametext->textObject()->textSubScript();
209}
210
211bool KWordTextFrameSetIface::textSuperScript() const
212{
213 return m_frametext->textObject()->textSuperScript();
214}
215
216void KWordTextFrameSetIface::setTextFamilyFont(const TQString &font)
217{
218 KCommand *cmd=m_frametext->textObject()->setFamilyCommand(font);
219 delete cmd;
220}
221
222void KWordTextFrameSetIface::changeCaseOfText( const TQString & caseType)
223{
224 KCommand *cmd=0L;
225 if( caseType.lower() == "uppercase" )
226 {
227 cmd = m_frametext->textObject()->setChangeCaseOfTextCommand( KoChangeCaseDia::UpperCase );
228 }
229 else if( caseType.lower() =="lowercase" )
230 {
231 cmd = m_frametext->textObject()->setChangeCaseOfTextCommand( KoChangeCaseDia::LowerCase );
232 }
233 else if( caseType.lower() =="titlecase" )
234 {
235 cmd = m_frametext->textObject()->setChangeCaseOfTextCommand( KoChangeCaseDia::TitleCase );
236 }
237 else if( caseType.lower() =="togglecase" )
238 {
239 cmd = m_frametext->textObject()->setChangeCaseOfTextCommand( KoChangeCaseDia::ToggleCase );
240 }
241 else if( caseType.lower() =="sentencecase" )
242 {
243 cmd = m_frametext->textObject()->setChangeCaseOfTextCommand( KoChangeCaseDia::SentenceCase );
244 }
245
246 else
247 kdDebug()<<"Error in void KWordTextFrameSetIface::changeCaseOfText( const TQString & caseType) parameter\n";
248 delete cmd;
249}
250
251// ## move to KWordFrameSetIface
252void KWordTextFrameSetIface::setProtectContent ( bool _protect )
253{
254 m_frametext->setProtectContent( _protect );
255}
256
257bool KWordTextFrameSetIface::isProtectContent() const
258{
259 return m_frametext->protectContent();
260}
261
262/*
263bool KWordTextFrameSetIface::textShadow() const
264{
265 return m_frametext->textObject()->textShadow();
266}
267
268void KWordTextFrameSetIface::setTextShadow( bool b )
269{
270 KCommand *cmd=m_frametext->textObject()->setShadowTextCommand( b );
271 delete cmd;
272}
273*/
274
275double KWordTextFrameSetIface::relativeTextSize() const
276{
277 return m_frametext->textObject()->relativeTextSize();
278}
279
280void KWordTextFrameSetIface::setRelativeTextSize( double _size )
281{
282 KCommand *cmd=m_frametext->textObject()->setRelativeTextSizeCommand(_size );
283 delete cmd;
284}
285
286bool KWordTextFrameSetIface::wordByWord() const
287{
288 return m_frametext->textObject()->wordByWord();
289}
290
291void KWordTextFrameSetIface::setWordByWord( bool _b )
292{
293 KCommand *cmd=m_frametext->textObject()->setWordByWordCommand(_b );
294 delete cmd;
295}
296
297TQString KWordTextFrameSetIface::fontAttibute()const
298{
299 return KoTextFormat::attributeFontToString( m_frametext->textObject()->fontAttribute() );
300}
301
302TQString KWordTextFrameSetIface::underlineLineStyle() const
303{
304 return KoTextFormat::underlineStyleToString( m_frametext->textObject()->underlineStyle() );
305}
306
307TQString KWordTextFrameSetIface::strikeOutLineStyle()const
308{
309 return KoTextFormat::strikeOutStyleToString( m_frametext->textObject()->strikeOutStyle() );
310}
Class: KWTextFrameSet Contains text (KoTextObject) and frames to display that text.