00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include <qdom.h>
00022 #include <qfileinfo.h>
00023 #include <qpainter.h>
00024 #include <qpaintdevicemetrics.h>
00025
00026 #include <kconfig.h>
00027 #include <kdebug.h>
00028 #include <klocale.h>
00029 #include <ktempfile.h>
00030 #include <KoTemplateChooseDia.h>
00031 #include <KoStoreDevice.h>
00032 #include <KoOasisStyles.h>
00033 #include <KoOasisLoadingContext.h>
00034 #include <KoXmlWriter.h>
00035 #include <KoXmlNS.h>
00036 #include <KoDom.h>
00037 #include <KoOasisSettings.h>
00038 #include <KoMainWindow.h>
00039
00040 #include "karbon_factory.h"
00041 #include "karbon_part.h"
00042 #include "karbon_part_iface.h"
00043 #include "karbon_view.h"
00044 #include "vcommand.h"
00045 #include "vglobal.h"
00046 #include "vpainter.h"
00047 #include "vpainterfactory.h"
00048 #include "vselection.h"
00049 #include "vcanvas.h"
00050 #include "vlayer.h"
00051 #include "vdocumentdocker.h"
00052 #include "vtoolcontroller.h"
00053 #include "KoApplication.h"
00054 #include "vtool.h"
00055 #include "commands/vtransformcmd.h"
00056
00057
00058
00059
00060 KarbonPart::KarbonPart( QWidget* parentWidget, const char* widgetName,
00061 QObject* parent, const char* name, bool singleViewMode )
00062 : KoDocument( parentWidget, widgetName, parent, name, singleViewMode )
00063 {
00064 setInstance( KarbonFactory::instance(), false );
00065 setTemplateType( "karbon_template" );
00066 m_bShowStatusBar = true;
00067 dcop = 0L;
00068
00069 m_commandHistory = new VCommandHistory( this );
00070 connect( m_commandHistory, SIGNAL( documentRestored() ), this, SLOT( slotDocumentRestored() ) );
00071 connect( m_commandHistory, SIGNAL( commandExecuted( VCommand * ) ), this, SLOT( slotCommandExecuted( VCommand * ) ) );
00072
00073 initConfig();
00074
00075 m_merge = false;
00076
00077 m_maxRecentFiles = 10;
00078
00079
00080 dcopObject();
00081
00082
00083 m_pageLayout.format = KoPageFormat::defaultFormat();
00084 m_pageLayout.orientation = PG_PORTRAIT;
00085 m_pageLayout.ptWidth = MM_TO_POINT( KoPageFormat::width( m_pageLayout.format, m_pageLayout.orientation ) );
00086 m_pageLayout.ptHeight = MM_TO_POINT( KoPageFormat::height( m_pageLayout.format, m_pageLayout.orientation ) );
00087 m_doc.setWidth( m_pageLayout.ptWidth );
00088 m_doc.setHeight( m_pageLayout.ptHeight );
00089
00090 m_doc.selection()->showHandle();
00091 m_doc.selection()->setSelectObjects();
00092 m_doc.selection()->setState( VObject::selected );
00093 m_doc.selection()->selectNodes();
00094 }
00095
00096 KarbonPart::~KarbonPart()
00097 {
00098
00099 delete m_commandHistory;
00100 delete dcop;
00101 }
00102
00103 DCOPObject* KarbonPart::dcopObject()
00104 {
00105 if( !dcop )
00106 dcop = new KarbonPartIface( this );
00107
00108 return dcop;
00109 }
00110
00111 void
00112 KarbonPart::setPageLayout( KoPageLayout& layout, KoUnit::Unit _unit )
00113 {
00114 m_pageLayout = layout;
00115 m_doc.setUnit( _unit );
00116 m_doc.setWidth( m_pageLayout.ptWidth );
00117 m_doc.setHeight( m_pageLayout.ptHeight );
00118 }
00119
00120 bool
00121 KarbonPart::initDoc(InitDocFlags flags, QWidget* parentWidget)
00122 {
00123 if (flags==KoDocument::InitDocEmpty)
00124 {
00125 return true;
00126 }
00127 QString file;
00128 KoTemplateChooseDia::ReturnType result;
00129
00130 KoTemplateChooseDia::DialogType dlgtype;
00131 if (flags != KoDocument::InitDocFileNew)
00132 dlgtype = KoTemplateChooseDia::Everything;
00133 else
00134 dlgtype = KoTemplateChooseDia::OnlyTemplates;
00135
00136 result = KoTemplateChooseDia::choose( KarbonFactory::instance(), file, dlgtype, "karbon_template", parentWidget );
00137
00138 if( result == KoTemplateChooseDia::Template )
00139 {
00140 resetURL();
00141 bool ok = loadNativeFormat( file );
00142 if ( !ok )
00143 showLoadingErrorDialog();
00144 setEmpty();
00145 return ok;
00146 }
00147 else if( result == KoTemplateChooseDia::Empty )
00148 {
00149 return true;
00150 }
00151 else if( result == KoTemplateChooseDia::File )
00152 {
00153 KURL url( file );
00154 return openURL( url );
00155 }
00156
00157 return false;
00158 }
00159
00160 KoView*
00161 KarbonPart::createViewInstance( QWidget* parent, const char* name )
00162 {
00163 KarbonView *result = new KarbonView( this, parent, name );
00164 return result;
00165 }
00166
00167 void
00168 KarbonPart::removeView( KoView *view )
00169 {
00170 kdDebug(38000) << "KarbonPart::removeView" << endl;
00171 KoDocument::removeView( view );
00172 }
00173
00174 double getAttribute(QDomElement &element, const char *attributeName, double defaultValue)
00175 {
00176 QString value;
00177 if ( ( value = element.attribute( attributeName ) ) != QString::null )
00178 return value.toDouble();
00179 else
00180 return defaultValue;
00181 }
00182
00183 int getAttribute(QDomElement &element, const char *attributeName, int defaultValue)
00184 {
00185 QString value;
00186 if ( ( value = element.attribute( attributeName ) ) != QString::null )
00187 return value.toInt();
00188 else
00189 return defaultValue;
00190 }
00191
00192 bool
00193 KarbonPart::loadXML( QIODevice*, const QDomDocument& document )
00194 {
00195 bool success = false;
00196
00197 QDomElement doc = document.documentElement();
00198
00199 if( m_merge )
00200 {
00201 m_doc.loadDocumentContent( doc );
00202 return true;
00203 }
00204
00205 success = m_doc.loadXML( doc );
00206
00207
00208
00209
00210 QDomElement paper = doc.namedItem( "PAPER" ).toElement();
00211 if ( !paper.isNull() )
00212 {
00213 m_pageLayout.format = static_cast<KoFormat>( getAttribute( paper, "format", 0 ) );
00214 m_pageLayout.orientation = static_cast<KoOrientation>( getAttribute( paper, "orientation", 0 ) );
00215
00216 if( m_pageLayout.format == PG_CUSTOM )
00217 {
00218 m_pageLayout.ptWidth = m_doc.width();
00219 m_pageLayout.ptHeight = m_doc.height();
00220 }
00221 else
00222 {
00223 m_pageLayout.ptWidth = getAttribute( paper, "width", 0.0 );
00224 m_pageLayout.ptHeight = getAttribute( paper, "height", 0.0 );
00225 }
00226 }
00227 else
00228 {
00229 m_pageLayout.ptWidth = getAttribute( doc, "width", 595.277);
00230 m_pageLayout.ptHeight = getAttribute( doc, "height", 841.891 );
00231 }
00232
00233 kdDebug() << " ptWidth=" << m_pageLayout.ptWidth << endl;
00234 kdDebug() << " ptHeight=" << m_pageLayout.ptHeight << endl;
00235 QDomElement borders = paper.namedItem( "PAPERBORDERS" ).toElement();
00236 if( !borders.isNull() )
00237 {
00238 if( borders.hasAttribute( "ptLeft" ) )
00239 m_pageLayout.ptLeft = borders.attribute( "ptLeft" ).toDouble();
00240 if( borders.hasAttribute( "ptTop" ) )
00241 m_pageLayout.ptTop = borders.attribute( "ptTop" ).toDouble();
00242 if( borders.hasAttribute( "ptRight" ) )
00243 m_pageLayout.ptRight = borders.attribute( "ptRight" ).toDouble();
00244 if( borders.hasAttribute( "ptBottom" ) )
00245 m_pageLayout.ptBottom = borders.attribute( "ptBottom" ).toDouble();
00246 }
00247
00248 setUnit( m_doc.unit() );
00249
00250 return success;
00251 }
00252
00253 QDomDocument
00254 KarbonPart::saveXML()
00255 {
00256 QDomDocument doc = m_doc.saveXML();
00257 QDomElement me = doc.documentElement();
00258 QDomElement paper = doc.createElement( "PAPER" );
00259 me.appendChild( paper );
00260 paper.setAttribute( "format", static_cast<int>( m_pageLayout.format ) );
00261 paper.setAttribute( "pages", pageCount() );
00262 paper.setAttribute( "width", m_pageLayout.ptWidth );
00263 paper.setAttribute( "height", m_pageLayout.ptHeight );
00264 paper.setAttribute( "orientation", static_cast<int>( m_pageLayout.orientation ) );
00265
00266 QDomElement paperBorders = doc.createElement( "PAPERBORDERS" );
00267 paperBorders.setAttribute( "ptLeft", m_pageLayout.ptLeft );
00268 paperBorders.setAttribute( "ptTop", m_pageLayout.ptTop );
00269 paperBorders.setAttribute( "ptRight", m_pageLayout.ptRight );
00270 paperBorders.setAttribute( "ptBottom", m_pageLayout.ptBottom );
00271 paper.appendChild(paperBorders);
00272
00273 return doc;
00274 }
00275
00276 bool
00277 KarbonPart::loadOasis( const QDomDocument &doc, KoOasisStyles &styles, const QDomDocument &settings, KoStore *store )
00278 {
00279 kdDebug(38000) << "Start loading OASIS document..." << doc.toString() << endl;
00280
00281 QDomElement contents = doc.documentElement();
00282 kdDebug(38000) << "Start loading OASIS document..." << contents.text() << endl;
00283 kdDebug(38000) << "Start loading OASIS contents..." << contents.lastChild().localName() << endl;
00284 kdDebug(38000) << "Start loading OASIS contents..." << contents.lastChild().namespaceURI() << endl;
00285 kdDebug(38000) << "Start loading OASIS contents..." << contents.lastChild().isElement() << endl;
00286 QDomElement body( KoDom::namedItemNS( contents, KoXmlNS::office, "body" ) );
00287 kdDebug(38000) << "Start loading OASIS document..." << body.text() << endl;
00288 if( body.isNull() )
00289 {
00290 kdDebug(38000) << "No office:body found!" << endl;
00291 setErrorMessage( i18n( "Invalid OASIS document. No office:body tag found." ) );
00292 return false;
00293 }
00294
00295 body = KoDom::namedItemNS( body, KoXmlNS::office, "drawing");
00296 if(body.isNull())
00297 {
00298 kdDebug(38000) << "No office:drawing found!" << endl;
00299 setErrorMessage( i18n( "Invalid OASIS document. No office:drawing tag found." ) );
00300 return false;
00301 }
00302
00303 QDomElement page( KoDom::namedItemNS( body, KoXmlNS::draw, "page" ) );
00304 if(page.isNull())
00305 {
00306 kdDebug(38000) << "No office:drawing found!" << endl;
00307 setErrorMessage( i18n( "Invalid OASIS document. No draw:page tag found." ) );
00308 return false;
00309 }
00310
00311 QString masterPageName = "Standard";
00312 QDomElement *master = styles.masterPages()[ masterPageName ];
00313 if ( !master )
00314 master = styles.masterPages()[ "Default" ];
00315
00316 if ( ! master )
00317 {
00318 QDictIterator<QDomElement> it( styles.masterPages() );
00319 master = it.current();
00320 }
00321 Q_ASSERT( master );
00322 const QDomElement *style = master ? styles.findStyle( master->attributeNS( KoXmlNS::style, "page-layout-name", QString::null ) ) : 0;
00323 if( style )
00324 {
00325 m_pageLayout.loadOasis( *style );
00326 m_doc.setWidth( m_pageLayout.ptWidth );
00327 m_doc.setHeight( m_pageLayout.ptHeight );
00328 }
00329 else
00330 return false;
00331
00332 KoOasisLoadingContext context( this, styles, store );
00333 m_doc.loadOasis( page, context );
00334
00335 QWMatrix mat;
00336 mat.scale( 1, -1 );
00337 mat.translate( 0, -m_doc.height() );
00338 VTransformCmd trafo( 0L, mat );
00339 trafo.visit( m_doc );
00340
00341 loadOasisSettings( settings );
00342
00343 return true;
00344 }
00345
00346 void
00347 KarbonPart::loadOasisSettings( const QDomDocument&settingsDoc )
00348 {
00349 if ( settingsDoc.isNull() )
00350 return ;
00351 KoOasisSettings settings( settingsDoc );
00352 KoOasisSettings::Items viewSettings = settings.itemSet( "view-settings" );
00353 if ( !viewSettings.isNull() )
00354 {
00355 setUnit(KoUnit::unit(viewSettings.parseConfigItemString("unit")));
00356
00357 }
00358 }
00359
00360
00361 bool
00362 KarbonPart::saveOasis( KoStore *store, KoXmlWriter *manifestWriter )
00363 {
00364 if( !store->open( "content.xml" ) )
00365 return false;
00366
00367 KoStoreDevice storeDev( store );
00368 KoXmlWriter* docWriter = createOasisXmlWriter( &storeDev, "office:document-content" );
00369 KoGenStyles mainStyles;
00370
00371 KoGenStyle pageLayout = m_pageLayout.saveOasis();
00372 QString layoutName = mainStyles.lookup( pageLayout, "PL" );
00373 KoGenStyle masterPage( KoGenStyle::STYLE_MASTER );
00374 masterPage.addAttribute( "style:page-layout-name", layoutName );
00375 mainStyles.lookup( masterPage, "Default", KoGenStyles::DontForceNumbering );
00376
00377 KTempFile contentTmpFile;
00378 contentTmpFile.setAutoDelete( true );
00379 QFile* tmpFile = contentTmpFile.file();
00380 KoXmlWriter contentTmpWriter( tmpFile, 1 );
00381
00382 contentTmpWriter.startElement( "office:body" );
00383 contentTmpWriter.startElement( "office:drawing" );
00384
00385 m_doc.saveOasis( store, &contentTmpWriter, mainStyles );
00386
00387 contentTmpWriter.endElement();
00388 contentTmpWriter.endElement();
00389
00390 docWriter->startElement( "office:automatic-styles" );
00391
00392 QValueList<KoGenStyles::NamedStyle> styles = mainStyles.styles( VDocument::STYLE_GRAPHICAUTO );
00393 QValueList<KoGenStyles::NamedStyle>::const_iterator it = styles.begin();
00394 for( ; it != styles.end() ; ++it )
00395 (*it).style->writeStyle( docWriter, mainStyles, "style:style", (*it).name , "style:graphic-properties" );
00396
00397 docWriter->endElement();
00398
00399
00400 tmpFile->close();
00401 docWriter->addCompleteElement( tmpFile );
00402 contentTmpFile.close();
00403
00404 docWriter->endElement();
00405 docWriter->endDocument();
00406 delete docWriter;
00407
00408 if( !store->close() )
00409 return false;
00410
00411 manifestWriter->addManifestEntry( "content.xml", "text/xml" );
00412
00413 if( !store->open( "styles.xml" ) )
00414 return false;
00415
00416 KoXmlWriter* styleWriter = createOasisXmlWriter( &storeDev, "office:document-styles" );
00417
00418 styleWriter->startElement( "office:styles" );
00419
00420 styles = mainStyles.styles( VDocument::STYLE_LINEAR_GRADIENT );
00421 it = styles.begin();
00422 for( ; it != styles.end() ; ++it )
00423 (*it).style->writeStyle( styleWriter, mainStyles, "svg:linearGradient", (*it).name, 0, true, true );
00424
00425 styles = mainStyles.styles( VDocument::STYLE_RADIAL_GRADIENT );
00426 it = styles.begin();
00427 for( ; it != styles.end() ; ++it )
00428 (*it).style->writeStyle( styleWriter, mainStyles, "svg:radialGradient", (*it).name, 0, true, true );
00429
00430 styleWriter->endElement();
00431
00432 styleWriter->startElement( "office:automatic-styles" );
00433
00434 QValueList<KoGenStyles::NamedStyle> styleList = mainStyles.styles( KoGenStyle::STYLE_PAGELAYOUT );
00435 it = styleList.begin();
00436
00437 for( ; it != styleList.end(); ++it )
00438 (*it).style->writeStyle( styleWriter, mainStyles, "style:page-layout", (*it).name, "style:page-layout-properties" );
00439
00440 styleWriter->endElement();
00441
00442 styles = mainStyles.styles( KoGenStyle::STYLE_MASTER );
00443 it = styles.begin();
00444 styleWriter->startElement("office:master-styles");
00445
00446 for( ; it != styles.end(); ++it)
00447 (*it).style->writeStyle( styleWriter, mainStyles, "style:master-page", (*it).name, "");
00448
00449 styleWriter->endElement();
00450
00451 styleWriter->endElement();
00452 styleWriter->endDocument();
00453 delete styleWriter;
00454
00455 if( !store->close() )
00456 return false;
00457
00458 manifestWriter->addManifestEntry( "styles.xml", "text/xml" );
00459
00460
00461 if(!store->open("settings.xml"))
00462 return false;
00463
00464
00465 KoXmlWriter& settingsWriter = *createOasisXmlWriter(&storeDev, "office:document-settings");
00466 settingsWriter.startElement("office:settings");
00467 settingsWriter.startElement("config:config-item-set");
00468 settingsWriter.addAttribute("config:name", "view-settings");
00469
00470 KoUnit::saveOasis(&settingsWriter, unit());
00471 saveOasisSettings( settingsWriter );
00472
00473 settingsWriter.endElement();
00474 settingsWriter.endElement();
00475 settingsWriter.endElement();
00476 settingsWriter.endDocument();
00477 delete &settingsWriter;
00478
00479
00480 if(!store->close())
00481 return false;
00482
00483 manifestWriter->addManifestEntry("settings.xml", "text/xml");
00484
00485 setModified( false );
00486 return true;
00487 }
00488
00489 void
00490 KarbonPart::saveOasisSettings( KoXmlWriter & )
00491 {
00492
00493 }
00494
00495 void
00496 KarbonPart::insertObject( VObject* object )
00497 {
00498
00499
00500 m_doc.append( object );
00501 setModified( true );
00502 }
00503
00504 void
00505 KarbonPart::addCommand( VCommand* cmd, bool repaint )
00506 {
00507 m_commandHistory->addCommand( cmd );
00508 setModified( true );
00509
00510 if( repaint )
00511 repaintAllViews();
00512 }
00513
00514 void
00515 KarbonPart::slotDocumentRestored()
00516 {
00517 setModified( false );
00518 }
00519
00520 void
00521 KarbonPart::slotCommandExecuted( VCommand *command )
00522 {
00523 setModified( true );
00524 if( command && command->changesSelection() )
00525 {
00526 QPtrListIterator<KoView> itr( views() );
00527 for( ; itr.current() ; ++itr )
00528 static_cast<KarbonView*>( itr.current() )->selectionChanged();
00529 }
00530 }
00531
00532 void
00533 KarbonPart::clearHistory()
00534 {
00535 m_commandHistory->clear();
00536 }
00537
00538 void
00539 KarbonPart::repaintAllViews( bool repaint )
00540 {
00541 QPtrListIterator<KoView> itr( views() );
00542
00543 for( ; itr.current() ; ++itr )
00544 static_cast<KarbonView*>( itr.current() )->canvasWidget()->repaintAll( repaint );
00545 }
00546
00547 void
00548 KarbonPart::repaintAllViews( const KoRect &rect )
00549 {
00550 QPtrListIterator<KoView> itr( views() );
00551
00552 for( ; itr.current() ; ++itr )
00553 static_cast<KarbonView*>( itr.current() )->canvasWidget()->repaintAll( rect );
00554 }
00555
00556 void
00557 KarbonPart::paintContent( QPainter& painter, const QRect& rect,
00558 bool , double , double )
00559 {
00560 kdDebug(38000) << "**** part->paintContent()" << endl;
00561
00562 KoRect r = KoRect::fromQRect( rect );
00563 double zoomFactorX = double( r.width() ) / double( document().width() );
00564 double zoomFactorY = double( r.height() ) / double( document().height() );
00565 double zoomFactor = kMin( zoomFactorX, zoomFactorY );
00566
00567 painter.eraseRect( rect );
00568 VPainterFactory *painterFactory = new VPainterFactory;
00569
00570 painterFactory->setPainter( painter.device(), rect.width(), rect.height() );
00571 VPainter *p = painterFactory->painter();
00572
00573 p->begin();
00574 p->setZoomFactor( zoomFactor );
00575 kdDebug(38000) << "painter.worldMatrix().dx() : " << painter.worldMatrix().dx() << endl;
00576 kdDebug(38000) << "painter.worldMatrix().dy() : " << painter.worldMatrix().dy() << endl;
00577 kdDebug(38000) << "rect.x() : "<< rect.x() << endl;
00578 kdDebug(38000) << "rect.y() : "<< rect.y() << endl;
00579 kdDebug(38000) << "rect.width() : "<< rect.width() << endl;
00580 kdDebug(38000) << "rect.height() : "<< rect.height() << endl;
00581 r = document().boundingBox();
00582 QWMatrix mat = painter.worldMatrix();
00583 mat.scale( 1, -1 );
00584 mat.translate( 0, -r.height() * zoomFactor );
00585 p->setWorldMatrix( mat );
00586
00587 m_doc.selection()->clear();
00588 QPtrListIterator<VLayer> itr( m_doc.layers() );
00589
00590 for( ; itr.current(); ++itr )
00591 {
00592 itr.current()->draw( p, &r );
00593 }
00594
00595 p->end();
00596 delete painterFactory;
00597 }
00598
00599 void
00600 KarbonPart::setShowStatusBar( bool b )
00601 {
00602 m_bShowStatusBar = b;
00603 }
00604
00605 void
00606 KarbonPart::reorganizeGUI()
00607 {
00608 QPtrListIterator<KoView> itr( views() );
00609
00610 for( ; itr.current(); ++itr )
00611 {
00612 static_cast<KarbonView*>( itr.current() )->reorganizeGUI();
00613 }
00614 }
00615
00616 void
00617 KarbonPart::setUndoRedoLimit( int undos )
00618 {
00619 m_commandHistory->setUndoLimit( undos );
00620 m_commandHistory->setRedoLimit( undos );
00621 }
00622
00623 void
00624 KarbonPart::initConfig()
00625 {
00626 KConfig* config = KarbonPart::instance()->config();
00627
00628 if( config->hasGroup( "Interface" ) )
00629 {
00630 config->setGroup( "Interface" );
00631 setAutoSave( config->readNumEntry( "AutoSave", defaultAutoSave() / 60 ) * 60 );
00632 m_maxRecentFiles = config->readNumEntry( "NbRecentFile", 10 );
00633 setShowStatusBar( config->readBoolEntry( "ShowStatusBar" , true ) );
00634 setBackupFile( config->readNumEntry( "BackupFile", true ) );
00635 m_doc.saveAsPath( config->readBoolEntry( "SaveAsPath", true ) );
00636 }
00637 int undos = 30;
00638 if( config->hasGroup( "Misc" ) )
00639 {
00640 config->setGroup( "Misc" );
00641 undos = config->readNumEntry( "UndoRedo", -1 );
00642 QString defaultUnit = "cm";
00643
00644 if( KGlobal::locale()->measureSystem() == KLocale::Imperial )
00645 defaultUnit = "in";
00646
00647 setUnit( KoUnit::unit( config->readEntry( "Units", defaultUnit ) ) );
00648 m_doc.setUnit( unit() );
00649 }
00650 if( undos != -1 )
00651 setUndoRedoLimit( undos );
00652 }
00653
00654 bool
00655 KarbonPart::mergeNativeFormat( const QString &file )
00656 {
00657 m_merge = true;
00658 bool result = loadNativeFormat( file );
00659 if ( !result )
00660 showLoadingErrorDialog();
00661 m_merge = false;
00662 return result;
00663 }
00664
00665 void
00666 KarbonPart::addShell( KoMainWindow *shell )
00667 {
00668 connect( shell, SIGNAL( documentSaved() ), m_commandHistory, SLOT( documentSaved() ) );
00669 KoDocument::addShell( shell );
00670 }
00671
00672
00673 void
00674 KarbonPart::slotUnitChanged( KoUnit::Unit )
00675 {
00676 #if 0
00677
00678 m_doc.setUnit( unit );
00679 if( m_toolController->activeTool() )
00680 m_toolController->activeTool()->refreshUnit();
00681 #endif
00682 }
00683
00684 #include "karbon_part.moc"
00685