kword

KWordTextFrameSetIface.cpp

00001 /* This file is part of the KDE project
00002    Copyright (C) 2002 Laurent MONTEL <lmontel@mandrakesoft.com>
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License as published by the Free Software Foundation; either
00007    version 2 of the License, or (at your option) any later version.
00008 
00009    This library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this library; see the file COPYING.LIB.  If not, write to
00016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017  * Boston, MA 02110-1301, USA.
00018 */
00019 
00020 #include "KWordTextFrameSetIface.h"
00021 #include "KWordViewIface.h"
00022 #include "KWTextFrameSet.h"
00023 #include <KoTextViewIface.h>
00024 #include "KWView.h"
00025 #include <KoTextObject.h>
00026 #include "KWCanvas.h"
00027 #include "KWDocument.h"
00028 #include <kapplication.h>
00029 #include <dcopclient.h>
00030 #include "KWordFrameSetIface.h"
00031 #include <kdebug.h>
00032 #include <kcommand.h>
00033 
00034 KWordTextFrameSetIface::KWordTextFrameSetIface( KWTextFrameSet *_frame )
00035     : KWordFrameSetIface( _frame)
00036 {
00037    m_frametext = _frame;
00038 }
00039 
00040 DCOPRef KWordTextFrameSetIface::startEditing()
00041 {
00042     if ( m_frametext->isDeleted() )
00043         return DCOPRef();
00044     KWDocument *doc=m_frametext->kWordDocument();
00045     QValueList<KWView *> views = doc->getAllViews();
00046     KWCanvas* canvas = views.first()->getGUI()->canvasWidget();
00047     canvas->editFrameSet(m_frametext, true);
00048     return DCOPRef( kapp->dcopClient()->appId(),
00049             (static_cast<KWTextFrameSetEdit *>( canvas->currentFrameSetEdit()))->dcopObject()->objId() );
00050 }
00051 
00052 bool KWordTextFrameSetIface::hasSelection() const
00053 {
00054     return m_frametext->hasSelection();
00055 }
00056 
00057 int KWordTextFrameSetIface::numberOfParagraphs()
00058 {
00059     return m_frametext->paragraphs();
00060 }
00061 
00062 QString KWordTextFrameSetIface::name() const
00063 {
00064     return m_frametext->name();
00065 }
00066 
00067 QString KWordTextFrameSetIface::selectedText() const
00068 {
00069     return m_frametext->selectedText();
00070 }
00071 
00072 void KWordTextFrameSetIface::selectAll( bool select )
00073 {
00074     m_frametext->textObject()->selectAll(select);
00075 }
00076 
00077 int KWordTextFrameSetIface::paragraphsSelected()
00078 {
00079     return m_frametext->paragraphsSelected();
00080 }
00081 
00082 void KWordTextFrameSetIface::setBoldText( bool b )
00083 {
00084     KCommand *cmd=m_frametext->textObject()->setBoldCommand( b );
00085     delete cmd;
00086 }
00087 
00088 void KWordTextFrameSetIface::setItalicText( bool b )
00089 {
00090     KCommand *cmd=m_frametext->textObject()->setItalicCommand(b);
00091     delete cmd;
00092 }
00093 
00094 void KWordTextFrameSetIface::setUnderlineText( bool b )
00095 {
00096     KCommand *cmd=m_frametext->textObject()->setUnderlineCommand(b);
00097     delete cmd;
00098 }
00099 
00100 void KWordTextFrameSetIface::setDoubleUnderlineText(bool b)
00101 {
00102     KCommand *cmd=m_frametext->textObject()->setDoubleUnderlineCommand(b);
00103     delete cmd;
00104 }
00105 
00106 void KWordTextFrameSetIface::setStrikeOutText( bool b )
00107 {
00108     KCommand *cmd=m_frametext->textObject()->setStrikeOutCommand(b);
00109     delete cmd;
00110 }
00111 
00112 void KWordTextFrameSetIface::setTextColor( const QColor &col )
00113 {
00114     KCommand *cmd=m_frametext->textObject()->setTextColorCommand(col);
00115     delete cmd;
00116 }
00117 
00118 void KWordTextFrameSetIface::setTextPointSize( int s )
00119 {
00120     KCommand *cmd=m_frametext->textObject()->setPointSizeCommand( s );
00121     delete cmd;
00122 }
00123 
00124 void KWordTextFrameSetIface::setTextSubScript( bool b )
00125 {
00126     KCommand *cmd=m_frametext->textObject()->setTextSubScriptCommand( b );
00127     delete cmd;
00128 }
00129 
00130 void KWordTextFrameSetIface::setTextSuperScript( bool b )
00131 {
00132     KCommand *cmd=m_frametext->textObject()->setTextSuperScriptCommand( b );
00133     delete cmd;
00134 }
00135 
00136 void KWordTextFrameSetIface::setTextDefaultFormat()
00137 {
00138     KCommand *cmd=m_frametext->textObject()->setDefaultFormatCommand();
00139     delete cmd;
00140 }
00141 
00142 void KWordTextFrameSetIface::setTextBackgroundColor(const QColor & col)
00143 {
00144     KCommand *cmd=m_frametext->textObject()->setTextBackgroundColorCommand(col);
00145     delete cmd;
00146 }
00147 
00148 void KWordTextFrameSetIface::setUnderlineColor( const QColor & color )
00149 {
00150 
00151     KCommand *cmd=m_frametext->textObject()->setUnderlineColorCommand( color );
00152     delete cmd;
00153 }
00154 
00155 
00156 QColor KWordTextFrameSetIface::textColor() const
00157 {
00158     return m_frametext->textObject()->textColor();
00159 }
00160 
00161 QFont KWordTextFrameSetIface::textFont() const
00162 {
00163     return m_frametext->textObject()->textFont();
00164 }
00165 
00166 QString KWordTextFrameSetIface::textFontFamily()const
00167 {
00168     return m_frametext->textObject()->textFontFamily();
00169 }
00170 
00171 QColor KWordTextFrameSetIface::textBackgroundColor() const
00172 {
00173     return m_frametext->textObject()->textBackgroundColor();
00174 }
00175 
00176 bool KWordTextFrameSetIface::textItalic() const
00177 {
00178     return m_frametext->textObject()->textItalic();
00179 }
00180 
00181 bool KWordTextFrameSetIface::textBold() const
00182 {
00183     return m_frametext->textObject()->textBold();
00184 }
00185 
00186 bool KWordTextFrameSetIface::textUnderline()const
00187 {
00188     return m_frametext->textObject()->textUnderline();
00189 }
00190 
00191 bool KWordTextFrameSetIface::textDoubleUnderline()const
00192 {
00193     return m_frametext->textObject()->textDoubleUnderline();
00194 }
00195 
00196 QColor KWordTextFrameSetIface::textUnderlineColor() const
00197 {
00198     return m_frametext->textObject()->textUnderlineColor();
00199 }
00200 
00201 bool KWordTextFrameSetIface::textStrikeOut()const
00202 {
00203     return m_frametext->textObject()->textStrikeOut();
00204 }
00205 
00206 bool KWordTextFrameSetIface::textSubScript() const
00207 {
00208     return m_frametext->textObject()->textSubScript();
00209 }
00210 
00211 bool KWordTextFrameSetIface::textSuperScript() const
00212 {
00213     return m_frametext->textObject()->textSuperScript();
00214 }
00215 
00216 void KWordTextFrameSetIface::setTextFamilyFont(const QString &font)
00217 {
00218     KCommand *cmd=m_frametext->textObject()->setFamilyCommand(font);
00219     delete cmd;
00220 }
00221 
00222 void KWordTextFrameSetIface::changeCaseOfText( const QString & caseType)
00223 {
00224     KCommand *cmd=0L;
00225     if( caseType.lower() == "uppercase" )
00226     {
00227         cmd = m_frametext->textObject()->setChangeCaseOfTextCommand( KoChangeCaseDia::UpperCase );
00228     }
00229     else if( caseType.lower() =="lowercase" )
00230     {
00231         cmd = m_frametext->textObject()->setChangeCaseOfTextCommand( KoChangeCaseDia::LowerCase );
00232     }
00233     else if( caseType.lower() =="titlecase" )
00234     {
00235         cmd = m_frametext->textObject()->setChangeCaseOfTextCommand( KoChangeCaseDia::TitleCase );
00236     }
00237     else if( caseType.lower() =="togglecase" )
00238     {
00239         cmd = m_frametext->textObject()->setChangeCaseOfTextCommand( KoChangeCaseDia::ToggleCase );
00240     }
00241     else if( caseType.lower() =="sentencecase" )
00242     {
00243         cmd = m_frametext->textObject()->setChangeCaseOfTextCommand( KoChangeCaseDia::SentenceCase );
00244     }
00245 
00246     else
00247         kdDebug()<<"Error in void KWordTextFrameSetIface::changeCaseOfText( const QString & caseType) parameter\n";
00248     delete cmd;
00249 }
00250 
00251 // ## move to KWordFrameSetIface
00252 void KWordTextFrameSetIface::setProtectContent ( bool _protect )
00253 {
00254     m_frametext->setProtectContent( _protect );
00255 }
00256 
00257 bool KWordTextFrameSetIface::isProtectContent() const
00258 {
00259     return m_frametext->protectContent();
00260 }
00261 
00262 /*
00263 bool KWordTextFrameSetIface::textShadow() const
00264 {
00265     return m_frametext->textObject()->textShadow();
00266 }
00267 
00268 void KWordTextFrameSetIface::setTextShadow( bool b )
00269 {
00270     KCommand *cmd=m_frametext->textObject()->setShadowTextCommand( b );
00271     delete cmd;
00272 }
00273 */
00274 
00275 double KWordTextFrameSetIface::relativeTextSize() const
00276 {
00277     return m_frametext->textObject()->relativeTextSize();
00278 }
00279 
00280 void KWordTextFrameSetIface::setRelativeTextSize( double _size )
00281 {
00282     KCommand *cmd=m_frametext->textObject()->setRelativeTextSizeCommand(_size );
00283     delete cmd;
00284 }
00285 
00286 bool KWordTextFrameSetIface::wordByWord() const
00287 {
00288     return m_frametext->textObject()->wordByWord();
00289 }
00290 
00291 void KWordTextFrameSetIface::setWordByWord( bool _b )
00292 {
00293     KCommand *cmd=m_frametext->textObject()->setWordByWordCommand(_b );
00294     delete cmd;
00295 }
00296 
00297 QString KWordTextFrameSetIface::fontAttibute()const
00298 {
00299     return KoTextFormat::attributeFontToString( m_frametext->textObject()->fontAttribute() );
00300 }
00301 
00302 QString KWordTextFrameSetIface::underlineLineStyle() const
00303 {
00304     return KoTextFormat::underlineStyleToString( m_frametext->textObject()->underlineStyle() );
00305 }
00306 
00307 QString KWordTextFrameSetIface::strikeOutLineStyle()const
00308 {
00309     return KoTextFormat::strikeOutStyleToString( m_frametext->textObject()->strikeOutStyle() );
00310 }
KDE Home | KDE Accessibility Home | Description of Access Keys