Version: 1.6.0 (using KDE KDE 3.5.5) Installed from: Ubuntu RPMs It seems that when karbon14 exports the drawings to EPS format the bounding boxes that are defined are not compatible with the saved drawing (i.e., covering only a fraction of the drawing). That can be fixed by editing the eps file by hand but it is still a PitA.
I already found the bug, but it is too late for the fix to go into the next release (1.6.1) which will be out in the next days. However there will be a 1.6.2 release where the bug will be fixed.
Created an attachment (id=18600) [details] fixes selection of all objects fix for the unvalid bounding box when exporting to eps
SVN commit 616263 by jaham: Make it optional to export hidden layers to eps. This works only with layers as the hidden/visible state of objects is not preserved when saving and i do not feel like changing karbons default file format in the stable series. Introduced a new visitor which calculates bounding boxes configurable to use hidden objects or not. Add missing initialisation of member variable in VSelectObjects visitor which fixes selection of all objects. Merry Christmas! BUG:137457 BUG:137452 GUI:added a checkbox to the eps export dialog M +44 -11 filters/karbon/eps/epsexport.cc M +5 -0 filters/karbon/eps/epsexport.h M +9 -0 filters/karbon/eps/epsexportdlg.cc M +3 -2 filters/karbon/eps/epsexportdlg.h M +4 -2 karbon/visitors/Makefile.am A karbon/visitors/vcomputeboundingbox.cc [License: LGPL (v2+)] A karbon/visitors/vcomputeboundingbox.h [License: LGPL (v2+)] M +1 -1 karbon/visitors/vselectobjects.h --- branches/koffice/1.6/koffice/filters/karbon/eps/epsexport.cc #616262:616263 @@ -46,8 +46,8 @@ #include "vselection.h" #include "vstroke.h" #include "vtext.h" +#include "vcomputeboundingbox.h" - // Define PostScript level1 operators. static char l1_newpath = 'N'; static char l1_closepath = 'C'; @@ -83,7 +83,7 @@ EpsExport::EpsExport( KoFilter*, const char*, const QStringList& ) - : KoFilter() + : KoFilter(), m_exportHidden( true ) { } @@ -113,6 +113,7 @@ { // Which PostScript level to support? m_psLevel = dialog->psLevel() + 1; + m_exportHidden = dialog->exportHidden(); QFile fileOut( m_chain->outputFile() ); if( !fileOut.open( IO_WriteOnly ) ) @@ -154,12 +155,11 @@ void EpsExport::visitVDocument( VDocument& document ) { - // Select all objects. - document.selection()->append(); + // calculate the documents bounding box + VComputeBoundingBox bbox( ! m_exportHidden ); + document.accept( bbox ); + const KoRect &rect = bbox.boundingRect(); - // Get the bounding box of all selected objects. - const KoRect& rect = document.selection()->boundingBox(); - // Print a header. *m_stream << "%!PS-Adobe-3.0 EPSF-3.0\n" @@ -178,10 +178,6 @@ "%%Creator: Karbon14 EPS Exportfilter 0.5" << endl; - // We dont need the selection anymore. - document.selection()->clear(); - - // Process document info. KoStoreDevice* storeIn; storeIn = m_chain->storageFile( "documentinfo.xml", KoStore::Read ); @@ -235,6 +231,38 @@ } void +EpsExport::visitVGroup( VGroup& group ) +{ + VObjectListIterator itr( group.objects() ); + + for( ; itr.current(); ++itr ) + { + // do not export hidden child objects + if( ! m_exportHidden && ! isVisible( itr.current() ) ) + continue; + itr.current()->accept( *this ); + } +} + +void +EpsExport::visitVLayer( VLayer& layer ) +{ + // do not export hidden layers + if( ! m_exportHidden && ! isVisible( &layer ) ) + return; + + VObjectListIterator itr( layer.objects() ); + + for( ; itr.current(); ++itr ) + { + // do not export hidden objects + if( ! m_exportHidden && ! isVisible( itr.current() ) ) + continue; + itr.current()->accept( *this ); + } +} + +void EpsExport::visitVPath( VPath& composite ) { *m_stream << l1_newpath << "\n"; @@ -444,5 +472,10 @@ copy[2] << " " << l1_setrgbcolor; } +bool +EpsExport::isVisible( const VObject* object ) const +{ + return object->state() != VObject::hidden && object->state() != VObject::hidden_locked; +} #include "epsexport.moc" --- branches/koffice/1.6/koffice/filters/karbon/eps/epsexport.h #616262:616263 @@ -52,14 +52,19 @@ virtual void visitVDocument( VDocument& document ); virtual void visitVSubpath( VSubpath& path ); virtual void visitVText( VText& text ); + virtual void visitVGroup( VGroup& group ); + virtual void visitVLayer( VLayer& layer ); void getStroke( const VStroke& stroke ); void getFill( const VFill& fill ); void getColor( const VColor& color ); + bool isVisible( const VObject* object ) const; + QTextStream* m_stream; uint m_psLevel; + bool m_exportHidden; }; #endif --- branches/koffice/1.6/koffice/filters/karbon/eps/epsexportdlg.cc #616262:616263 @@ -21,6 +21,7 @@ #include <qradiobutton.h> #include <qstring.h> #include <qvbox.h> +#include <qcheckbox.h> #include <klocale.h> #include <knuminput.h> @@ -41,6 +42,9 @@ radio = new QRadioButton( i18n( "PostScript level 2" ), m_psLevelButtons ); radio = new QRadioButton( i18n( "PostScript level 3" ), m_psLevelButtons ); + m_hiddenExport = new QCheckBox( i18n( "Export hidden layers" ), page ); + m_hiddenExport->setChecked( true ); + m_psLevelButtons->setRadioButtonExclusive( true ); m_psLevelButtons->setButton( 2 ); } @@ -52,5 +56,10 @@ m_psLevelButtons->id( m_psLevelButtons->selected() ) ); } +bool +EpsExportDlg::exportHidden() const +{ + return m_hiddenExport->isChecked(); +} #include "epsexportdlg.moc" --- branches/koffice/1.6/koffice/filters/karbon/eps/epsexportdlg.h #616262:616263 @@ -24,8 +24,8 @@ class QButtonGroup; +class QCheckBox; - class EpsExportDlg : public KDialogBase { Q_OBJECT @@ -34,9 +34,10 @@ EpsExportDlg( QWidget* parent = 0L, const char* name = 0L ); uint psLevel() const; - + bool exportHidden() const; private: QButtonGroup* m_psLevelButtons; + QCheckBox* m_hiddenExport; }; #endif --- branches/koffice/1.6/koffice/karbon/visitors/Makefile.am #616262:616263 @@ -13,14 +13,16 @@ vselectobjects.h \ vdrawselection.h \ vselectiondesc.h \ - vtransformnodes.h + vtransformnodes.h \ + vcomputeboundingbox.h libkarbonvisitors_la_SOURCES = \ vselectnodes.cc \ vselectobjects.cc \ vdrawselection.cc \ vselectiondesc.cc \ - vtransformnodes.cc + vtransformnodes.cc \ + vcomputeboundingbox.cc libkarbonvisitors_la_METASOURCES = \ AUTO --- branches/koffice/1.6/koffice/karbon/visitors/vselectobjects.h #616262:616263 @@ -39,7 +39,7 @@ { public: VSelectObjects( VObjectList& selection, bool select = true ) - : m_selection( selection ), m_select( select ), m_insideGroups( false ) {} + : m_selection( selection ), m_select( select ), m_rectMode( true ), m_insideGroups( false ) {} VSelectObjects( VObjectList& selection, const KoRect& rect, bool select = true ) : m_selection( selection ), m_select( select ), m_rect( rect ), m_rectMode( true ), m_insideGroups( false ) { }
You need to log in before you can comment on or make changes to this bug.