1
/* This file is part of the KDE project
2
Copyright (C) 2002 Laurent MONTEL <lmontel@mandrakesoft.com>
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.
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.
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., 59 Temple Place - Suite 330,
17
Boston, MA 02111-1307, USA.
20
#include "KWordFrameSetIface.h"
24
#include <kapplication.h>
25
#include <dcopclient.h>
28
KWordFrameSetIface::KWordFrameSetIface( KWFrameSet *_frame )
29
: DCOPObject( _frame->getName().utf8() )
34
bool KWordFrameSetIface::isAHeader() const
36
return m_frame->isAHeader();
39
bool KWordFrameSetIface::isAFooter() const
41
return m_frame->isAFooter();
44
bool KWordFrameSetIface::isHeaderOrFooter() const
46
return m_frame->isHeaderOrFooter();
49
bool KWordFrameSetIface::isMainFrameset() const
51
return m_frame->isMainFrameset();
54
bool KWordFrameSetIface::isMoveable() const
56
return m_frame->isMoveable();
59
bool KWordFrameSetIface::isVisible() const
61
return m_frame->isVisible();
64
bool KWordFrameSetIface::isFloating() const
66
return m_frame->isFloating();
69
double KWordFrameSetIface::ptWidth() const
71
return m_frame->frame(0)->normalize().width();
74
double KWordFrameSetIface::ptHeight() const
76
return m_frame->frame(0)->normalize().height();
79
double KWordFrameSetIface::ptPosX() const
81
return m_frame->frame(0)->normalize().x();
84
double KWordFrameSetIface::ptPosY() const
86
return m_frame->frame(0)->normalize().y();
89
int KWordFrameSetIface::zOrder() const
91
return m_frame->frame(0)->zOrder();
94
int KWordFrameSetIface::pageNum() const
96
return m_frame->frame(0)->pageNum();
99
QBrush KWordFrameSetIface::backgroundColor() const
101
return m_frame->frame(0)->backgroundColor();
104
void KWordFrameSetIface::setBackgroundColor( const QString &_color )
106
QBrush brush= m_frame->frame(0)->backgroundColor();
107
brush.setColor( QColor( _color ));
108
m_frame->frame(0)->setBackgroundColor( brush );
111
double KWordFrameSetIface::ptMarginLeft()const
113
return m_frame->frame(0)->bLeft();
116
double KWordFrameSetIface::ptMarginRight()const
118
return m_frame->frame(0)->bRight();
121
double KWordFrameSetIface::ptMarginTop()const
123
return m_frame->frame(0)->bTop();
126
double KWordFrameSetIface::ptMarginBottom()const
128
return m_frame->frame(0)->bBottom();
131
bool KWordFrameSetIface::isCopy()const
133
return m_frame->frame(0)->isCopy();
136
void KWordFrameSetIface::setPtMarginLeft(double val)
138
m_frame->frame( 0 )->setBLeft(val);
139
m_frame->kWordDocument()->layout();
142
void KWordFrameSetIface::setPtMarginRight(double val)
144
m_frame->frame( 0 )->setBRight(val);
145
m_frame->kWordDocument()->layout();
148
void KWordFrameSetIface::setPtMarginTop(double val)
150
m_frame->frame( 0 )->setBTop(val);
151
m_frame->kWordDocument()->layout();
154
void KWordFrameSetIface::setPtMarginBottom(double val)
156
m_frame->frame( 0 )->setBBottom(val);
157
m_frame->kWordDocument()->layout();
160
QColor KWordFrameSetIface::leftBorderColor() const
162
return m_frame->frame( 0 )->leftBorder().color;
165
QColor KWordFrameSetIface::rightBorderColor() const
167
return m_frame->frame( 0 )->rightBorder().color;
170
QColor KWordFrameSetIface::topBorderColor() const
172
return m_frame->frame( 0 )->topBorder().color;
175
QColor KWordFrameSetIface::bottomBorderColor() const
177
return m_frame->frame( 0 )->bottomBorder().color;
180
bool KWordFrameSetIface::isProtectSize()const
182
return m_frame->isProtectSize();
185
void KWordFrameSetIface::setProtectSize( bool _b )
187
m_frame->setProtectSize( _b );
190
QString KWordFrameSetIface::bottomBorderStyle() const
192
switch( m_frame->frame( 0 )->bottomBorder().getStyle())
194
case KoBorder::SOLID:
195
return QString("SOLID");
198
return QString("DASH");
201
return QString("DOT");
203
case KoBorder::DASH_DOT:
204
return QString("DASH DOT");
206
case KoBorder::DASH_DOT_DOT:
207
return QString("DASH DOT DOT");
210
case KoBorder::DOUBLE_LINE:
211
return QString("DOUBLE LINE");
214
return QString::null;
217
QString KWordFrameSetIface::topBorderStyle() const
219
switch( m_frame->frame( 0 )->topBorder().getStyle())
221
case KoBorder::SOLID:
222
return QString("SOLID");
225
return QString("DASH");
228
return QString("DOT");
230
case KoBorder::DASH_DOT:
231
return QString("DASH DOT");
233
case KoBorder::DASH_DOT_DOT:
234
return QString("DASH DOT DOT");
237
case KoBorder::DOUBLE_LINE:
238
return QString("DOUBLE LINE");
241
return QString::null;
244
QString KWordFrameSetIface::leftBorderStyle() const
246
switch( m_frame->frame( 0 )->leftBorder().getStyle())
248
case KoBorder::SOLID:
249
return QString("SOLID");
252
return QString("DASH");
255
return QString("DOT");
257
case KoBorder::DASH_DOT:
258
return QString("DASH DOT");
260
case KoBorder::DASH_DOT_DOT:
261
return QString("DASH DOT DOT");
264
case KoBorder::DOUBLE_LINE:
265
return QString("DOUBLE LINE");
268
return QString::null;
271
QString KWordFrameSetIface::rightBorderStyle() const
273
switch( m_frame->frame( 0 )->rightBorder().getStyle())
275
case KoBorder::SOLID:
276
return QString("SOLID");
279
return QString("DASH");
282
return QString("DOT");
284
case KoBorder::DASH_DOT:
285
return QString("DASH DOT");
287
case KoBorder::DASH_DOT_DOT:
288
return QString("DASH DOT DOT");
291
case KoBorder::DOUBLE_LINE:
292
return QString("DOUBLE LINE");
295
return QString::null;
298
double KWordFrameSetIface::rightBorderWidth() const
300
return m_frame->frame( 0 )->rightBorder().penWidth();
303
double KWordFrameSetIface::topBorderWidth() const
305
return m_frame->frame( 0 )->topBorder().penWidth();
308
double KWordFrameSetIface::bottomBorderWidth() const
310
return m_frame->frame( 0 )->bottomBorder().penWidth();
312
double KWordFrameSetIface::leftBorderWidth() const
314
return m_frame->frame( 0 )->leftBorder().penWidth();
317
void KWordFrameSetIface::setRightBorderWitdh( double _width )
319
KoBorder tmp = m_frame->frame( 0 )->rightBorder();
320
tmp.setPenWidth(_width);
321
m_frame->frame( 0 )->setRightBorder(tmp);
324
void KWordFrameSetIface::setLeftBorderWitdh( double _width )
326
KoBorder tmp = m_frame->frame( 0 )->leftBorder();
327
tmp.setPenWidth(_width);
328
m_frame->frame( 0 )->setLeftBorder(tmp);
331
void KWordFrameSetIface::setTopBorderWitdh( double _width )
333
KoBorder tmp = m_frame->frame( 0 )->topBorder();
334
tmp.setPenWidth(_width);
335
m_frame->frame( 0 )->setTopBorder(tmp);
338
void KWordFrameSetIface::setBottomBorderWitdh( double _width )
340
KoBorder tmp = m_frame->frame( 0 )->bottomBorder();
341
tmp.setPenWidth(_width);
342
m_frame->frame( 0 )->setBottomBorder(tmp);
345
void KWordFrameSetIface::setRightBorderStyle(const QString & _style)
347
KoBorder tmp = m_frame->frame( 0 )->rightBorder();
348
if ( _style.lower()=="solid")
349
tmp.setStyle(KoBorder::SOLID);
350
else if ( _style.lower()=="dash")
351
tmp.setStyle(KoBorder::DASH);
352
else if ( _style.lower()=="dot")
353
tmp.setStyle(KoBorder::DOT);
354
else if ( _style.lower()=="dash dot")
355
tmp.setStyle(KoBorder::DASH_DOT);
356
else if ( _style.lower()=="dash dot dot")
357
tmp.setStyle(KoBorder::DASH_DOT_DOT);
358
else if ( _style.lower()=="double line")
359
tmp.setStyle(KoBorder::DOUBLE_LINE);
362
kdDebug()<<" style :"<<_style<<" do not exist!\n";
365
m_frame->frame( 0 )->setRightBorder(tmp);
368
void KWordFrameSetIface::setLeftBorderStyle(const QString & _style)
370
KoBorder tmp = m_frame->frame( 0 )->leftBorder();
371
if ( _style.lower()=="solid")
372
tmp.setStyle(KoBorder::SOLID);
373
else if ( _style.lower()=="dash")
374
tmp.setStyle(KoBorder::DASH);
375
else if ( _style.lower()=="dot")
376
tmp.setStyle(KoBorder::DOT);
377
else if ( _style.lower()=="dash dot")
378
tmp.setStyle(KoBorder::DASH_DOT);
379
else if ( _style.lower()=="dash dot dot")
380
tmp.setStyle(KoBorder::DASH_DOT_DOT);
381
else if ( _style.lower()=="double line")
382
tmp.setStyle(KoBorder::DOUBLE_LINE);
385
kdDebug()<<" style :"<<_style<<" do not exist!\n";
388
m_frame->frame( 0 )->setLeftBorder(tmp);
392
void KWordFrameSetIface::setTopBorderStyle(const QString & _style)
394
KoBorder tmp = m_frame->frame( 0 )->topBorder();
396
if ( _style.lower()=="solid")
397
tmp.setStyle(KoBorder::SOLID);
398
else if ( _style.lower()=="dash")
399
tmp.setStyle(KoBorder::DASH);
400
else if ( _style.lower()=="dot")
401
tmp.setStyle(KoBorder::DOT);
402
else if ( _style.lower()=="dash dot")
403
tmp.setStyle(KoBorder::DASH_DOT);
404
else if ( _style.lower()=="dash dot dot")
405
tmp.setStyle(KoBorder::DASH_DOT_DOT);
406
else if ( _style.lower()=="double line")
407
tmp.setStyle(KoBorder::DOUBLE_LINE);
410
kdDebug()<<" style :"<<_style<<" do not exist!\n";
413
m_frame->frame( 0 )->setTopBorder(tmp);
416
void KWordFrameSetIface::setBottomBorderStyle(const QString & _style)
418
KoBorder tmp = m_frame->frame( 0 )->bottomBorder();
419
if ( _style.lower()=="solid")
420
tmp.setStyle(KoBorder::SOLID);
421
else if ( _style.lower()=="dash")
422
tmp.setStyle(KoBorder::DASH);
423
else if ( _style.lower()=="dot")
424
tmp.setStyle(KoBorder::DOT);
425
else if ( _style.lower()=="dash dot")
426
tmp.setStyle(KoBorder::DASH_DOT);
427
else if ( _style.lower()=="dash dot dot")
428
tmp.setStyle(KoBorder::DASH_DOT_DOT);
429
else if ( _style.lower()=="double line")
430
tmp.setStyle(KoBorder::DOUBLE_LINE);
433
kdDebug()<<" style :"<<_style<<" do not exist!\n";
436
m_frame->frame( 0 )->setBottomBorder(tmp);
439
bool KWordFrameSetIface::isFootEndNote() const
441
return m_frame->isFootEndNote();
444
QString KWordFrameSetIface::frameSetInfo() const
446
switch( m_frame->frameSetInfo() )
448
case KWFrameSet::FI_BODY:
449
return QString("body");
451
case KWFrameSet::FI_FIRST_HEADER:
452
return QString("First header");
454
case KWFrameSet::FI_ODD_HEADER:
455
return QString("First even header");
457
case KWFrameSet::FI_EVEN_HEADER:
458
return QString("First odd header");
460
case KWFrameSet::FI_FIRST_FOOTER:
461
return QString("First footer");
463
case KWFrameSet::FI_EVEN_FOOTER:
464
return QString("Odd footer");
466
case KWFrameSet::FI_ODD_FOOTER:
467
return QString("Even footer");
469
case KWFrameSet::FI_FOOTNOTE:
470
return QString("FootNote");
473
return QString::null;
478
void KWordFrameSetIface::setFrameSetInfo( const QString & _type)
480
if ( _type.lower() =="body")
482
m_frame->setFrameSetInfo( KWFrameSet::FI_BODY );
484
else if ( _type.lower() =="first header")
486
m_frame->setFrameSetInfo( KWFrameSet::FI_FIRST_HEADER );
488
else if ( _type.lower() =="first even header")
490
m_frame->setFrameSetInfo( KWFrameSet::FI_ODD_HEADER );
492
else if ( _type.lower() =="first odd header")
494
m_frame->setFrameSetInfo( KWFrameSet::FI_EVEN_HEADER );
496
else if ( _type.lower() =="first footer")
498
m_frame->setFrameSetInfo( KWFrameSet::FI_FIRST_FOOTER );
500
else if ( _type.lower() =="odd footer")
502
m_frame->setFrameSetInfo( KWFrameSet::FI_EVEN_FOOTER );
504
else if ( _type.lower() =="even footer")
506
m_frame->setFrameSetInfo( KWFrameSet::FI_ODD_FOOTER );
508
else if ( _type.lower() =="even footer")
510
m_frame->setFrameSetInfo( KWFrameSet::FI_ODD_FOOTER );
512
else if ( _type.lower() =="footnote")
514
m_frame->setFrameSetInfo( KWFrameSet::FI_FOOTNOTE );
518
kdDebug()<<" Error in setFrameSetInfo() :"<<_type<<endl;