20#include "KPrTextObjectIface.h"
21#include "KPrTextObject.h"
22#include <KoTextViewIface.h>
23#include "KPrDocument.h"
25#include <KoTextObject.h>
26#include <tdeapplication.h>
27#include <dcopclient.h>
32KPrTextObjectIface::KPrTextObjectIface( KPrTextObject *_textobject )
33 : KPrObject2DIface(_textobject)
35 m_textobject = _textobject;
38DCOPRef KPrTextObjectIface::startEditing()
40 KPrDocument *doc=m_textobject->kPresenterDocument();
41 KPrView *view=doc->firstView();
42 view->getCanvas()->createEditing( m_textobject);
43 return DCOPRef( kapp->dcopClient()->appId(),
44 view->getCanvas()->currentTextObjectView()->dcopObject()->objId() );
47bool KPrTextObjectIface::hasSelection()
const
49 return m_textobject->textObject()->hasSelection();
52TQString KPrTextObjectIface::selectedText()
const
54 return m_textobject->textObject()->selectedText();
57void KPrTextObjectIface::selectAll(
bool select )
59 m_textobject->textObject()->selectAll(select);
62void KPrTextObjectIface::recalcPageNum( )
68void KPrTextObjectIface::setBoldText(
bool b )
70 KCommand *cmd=m_textobject->textObject()->setBoldCommand( b );
74void KPrTextObjectIface::setItalicText(
bool b )
76 KCommand *cmd=m_textobject->textObject()->setItalicCommand(b);
80void KPrTextObjectIface::setUnderlineText(
bool b )
82 KCommand *cmd=m_textobject->textObject()->setUnderlineCommand(b);
86void KPrTextObjectIface::setDoubleUnderlineText(
bool b)
88 KCommand *cmd=m_textobject->textObject()->setDoubleUnderlineCommand(b);
92void KPrTextObjectIface::setUnderlineColor(
const TQColor & color )
94 KCommand *cmd=m_textobject->textObject()->setUnderlineColorCommand( color );
98void KPrTextObjectIface::setStrikeOutText(
bool b )
100 KCommand *cmd=m_textobject->textObject()->setStrikeOutCommand(b);
104void KPrTextObjectIface::setTextColor(
const TQColor &col )
106 KCommand *cmd=m_textobject->textObject()->setTextColorCommand(col);
110void KPrTextObjectIface::setTextPointSize(
int s )
112 KCommand *cmd=m_textobject->textObject()->setPointSizeCommand( s );
116void KPrTextObjectIface::setTextSubScript(
bool b )
118 KCommand *cmd=m_textobject->textObject()->setTextSubScriptCommand( b );
122void KPrTextObjectIface::setTextSuperScript(
bool b )
124 KCommand *cmd=m_textobject->textObject()->setTextSuperScriptCommand( b );
128void KPrTextObjectIface::setTextDefaultFormat()
130 KCommand *cmd=m_textobject->textObject()->setDefaultFormatCommand();
134void KPrTextObjectIface::setTextBackgroundColor(
const TQColor & col)
136 KCommand *cmd=m_textobject->textObject()->setTextBackgroundColorCommand(col);
140bool KPrTextObjectIface::textDoubleUnderline()
const
142 return m_textobject->textObject()->textDoubleUnderline();
145TQColor KPrTextObjectIface::textUnderlineColor()
const
147 return m_textobject->textObject()->textUnderlineColor();
150TQColor KPrTextObjectIface::textColor()
const
152 return m_textobject->textObject()->textColor();
155TQFont KPrTextObjectIface::textFont()
const
157 return m_textobject->textObject()->textFont();
160TQString KPrTextObjectIface::textFontFamily()
const
162 return m_textobject->textObject()->textFontFamily();
165TQColor KPrTextObjectIface::textBackgroundColor()
const
167 return m_textobject->textObject()->textBackgroundColor();
170bool KPrTextObjectIface::textItalic()
const
172 return m_textobject->textObject()->textItalic();
175bool KPrTextObjectIface::textBold()
const
177 return m_textobject->textObject()->textBold();
180bool KPrTextObjectIface::textUnderline()
const
182 return m_textobject->textObject()->textUnderline();
185bool KPrTextObjectIface::textStrikeOut()
const
187 return m_textobject->textObject()->textStrikeOut();
190bool KPrTextObjectIface::textSubScript()
const
192 return m_textobject->textObject()->textSubScript();
195bool KPrTextObjectIface::textSuperScript()
const
197 return m_textobject->textObject()->textSuperScript();
200void KPrTextObjectIface::setTextFamilyFont(
const TQString &font)
202 KCommand *cmd=m_textobject->textObject()->setFamilyCommand(font);
206void KPrTextObjectIface::changeCaseOfText(
const TQString & caseType)
209 if( caseType.lower() ==
"uppercase" )
210 cmd=m_textobject->textObject()->setChangeCaseOfTextCommand( KoChangeCaseDia::UpperCase );
211 else if( caseType.lower() ==
"lowercase" )
212 cmd=m_textobject->textObject()->setChangeCaseOfTextCommand( KoChangeCaseDia::LowerCase );
213 else if( caseType.lower() ==
"titlecase" )
214 cmd=m_textobject->textObject()->setChangeCaseOfTextCommand( KoChangeCaseDia::TitleCase );
215 else if( caseType.lower() ==
"togglecase" )
216 cmd=m_textobject->textObject()->setChangeCaseOfTextCommand( KoChangeCaseDia::ToggleCase );
217 else if( caseType.lower() ==
"sentencecase" )
218 cmd = m_textobject->textObject()->setChangeCaseOfTextCommand( KoChangeCaseDia::SentenceCase );
220 kdDebug(33001)<<
"Error in void KWordTextFrameSetIface::changeCaseOfText( const TQString & caseType) parameter\n";
224void KPrTextObjectIface::extendTextContentsToHeight()
226 KCommand *cmd=m_textobject->textContentsToHeight();
230void KPrTextObjectIface::extendTextObjectToContents()
232 KCommand *cmd= m_textobject->textObjectToContents();
236void KPrTextObjectIface::setProtectContent (
bool _protect )
238 m_textobject->setProtectContent( _protect );
241bool KPrTextObjectIface::isProtectContent()
const
243 return m_textobject->isProtectContent();
246void KPrTextObjectIface::setPtMarginLeft(
double val)
248 m_textobject->setBLeft(val);
249 m_textobject->kPresenterDocument()->layout( m_textobject );
252void KPrTextObjectIface::setPtMarginRight(
double val)
254 m_textobject->setBRight(val);
255 m_textobject->kPresenterDocument()->layout( m_textobject );
258void KPrTextObjectIface::setPtMarginTop(
double val)
260 m_textobject->setBTop(val);
261 m_textobject->kPresenterDocument()->layout( m_textobject );
264void KPrTextObjectIface::setPtMarginBottom(
double val)
266 m_textobject->setBBottom(val);
267 m_textobject->kPresenterDocument()->layout( m_textobject );
270double KPrTextObjectIface::ptMarginLeft()
const
272 return m_textobject->bLeft();
275double KPrTextObjectIface::ptMarginRight()
const
277 return m_textobject->bRight();
280double KPrTextObjectIface::ptMarginTop()
const
282 return m_textobject->bTop();
285double KPrTextObjectIface::ptMarginBottom()
const
287 return m_textobject->bBottom();
290void KPrTextObjectIface::setVerticalAligment(
const TQString & type)
292 if ( type.lower() ==
"center" )
293 m_textobject->setVerticalAligment( KP_CENTER );
294 else if ( type.lower() ==
"top" )
295 m_textobject->setVerticalAligment( KP_TOP );
296 else if ( type.lower() ==
"bottom" )
297 m_textobject->setVerticalAligment( KP_BOTTOM );
300TQString KPrTextObjectIface::verticalAlignment()
const
302 switch( m_textobject->verticalAlignment() )
305 return TQString(
"center");
308 return TQString(
"top");
311 return TQString(
"bottom");
330double KPrTextObjectIface::relativeTextSize()
const
332 return m_textobject->textObject()->relativeTextSize();
335void KPrTextObjectIface::setRelativeTextSize(
double _size )
337 KCommand *cmd=m_textobject->textObject()->setRelativeTextSizeCommand(_size );
341bool KPrTextObjectIface::wordByWord()
const
343 return m_textobject->textObject()->wordByWord();
346void KPrTextObjectIface::setWordByWord(
bool _b )
348 KCommand *cmd=m_textobject->textObject()->setWordByWordCommand(_b );
352TQString KPrTextObjectIface::fontAttribute()
const
354 return KoTextFormat::attributeFontToString( m_textobject->textObject()->fontAttribute() );
357TQString KPrTextObjectIface::underlineLineStyle()
const
359 return KoTextFormat::underlineStyleToString( m_textobject->textObject()->underlineStyle() );
362TQString KPrTextObjectIface::strikeOutLineStyle()
const
364 return KoTextFormat::strikeOutStyleToString( m_textobject->textObject()->strikeOutStyle() );