diff --git a/Makefile.am b/Makefile.am index f9c66c456d..b5edb97431 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,14 +1,14 @@ -SUBDIRS = lib kspread kpresenter kword kformula kdiagramm killustrator kimage kohtml tools plugins servicetypes koshell pics +SUBDIRS = lib kspread kpresenter kword kformula kdiagramm killustrator kimage kimageshop kohtml tools plugins servicetypes koshell pics AUTOMAKE_OPTIONS = foreign # 1.4 acinclude.m4: admin/acinclude.m4.in admin/libtool.m4.in @cat $(top_srcdir)/admin/acinclude.m4.in $(top_srcdir)/admin/libtool.m4.in > $(top_srcdir)/acinclude.m4 messages: make -f admin/Makefile.common package-messages dist-hook: cd $(top_distdir) && perl $(top_srcdir)/admin/am_edit -padmin diff --git a/configure.in b/configure.in index 29b47c7d00..07fe0291b0 100644 --- a/configure.in +++ b/configure.in @@ -1,147 +1,149 @@ dnl AC_PREREQ([2.13]) dnl without this order in this file, autoconf will not work! dnl the argument is a source file out of your sources. But dnl acinclude.m4 makes the job for all programs ;-) AC_INIT(acinclude.m4) dnl This is so we can use kde-common AC_CONFIG_AUX_DIR(admin) dnl without this order in this file, automake will be confused! dnl the argument AM_CONFIG_HEADER(config.h) AC_CHECK_COMPILERS if test "$GCC" = "yes"; then CXXFLAGS="$CXXFLAGS" fi AM_INIT_AUTOMAKE(koffice, 0.1) dnl make $KDEDIR the default for the installation AC_PREFIX_DEFAULT(${KDEDIR:-/usr/local/kde}) AM_ENABLE_SHARED(yes) AM_ENABLE_STATIC(no) KDE_PROG_LIBTOOL AC_PATH_KDE AM_KDE_WITH_NLS dnl Check for MICO. The argument is the minimal version required. KDE_CHECK_MICO(2.2.6) idldir="\$(includedir)/idl" AC_SUBST(idldir) KDE_CHECK_PYTHON(1.5) AC_CHECK_HEADERS(unistd.h sys/param.h floatingpoint.h) KDE_CHECK_KIMGIO AC_FIND_QIMGIO AC_C_BIGENDIAN AC_CHECK_KDEMAXPATHLEN KDE_CHECK_NEWLIBS KOML_INCLUDES='-I$(top_srcdir)/lib/koml -I$(top_builddir)/lib/koml' AC_SUBST(KOML_INCLUDES) KSTORE_INCLUDES='-I$(top_srcdir)/lib/store -I$(top_builddir)/lib/store' AC_SUBST(KSTORE_INCLUDES) KOFFICECORE_INCLUDES='-I$(top_srcdir)/lib/kofficecore -I$(top_builddir)/lib/kofficecore' AC_SUBST(KOFFICECORE_INCLUDES) KOFFICEUI_INCLUDES='-I$(top_srcdir)/lib/kofficeui -I$(top_builddir)/lib/kofficeui' AC_SUBST(KOFFICEUI_INCLUDES) LIB_KOFFICEUI='$(top_builddir)/lib/kofficeui/libkofficeui.la' LIB_KOFFICECORE='$(top_builddir)/lib/kofficecore/libkofficecore.la' LIB_KSTORE='$(top_builddir)/lib/store/libkstore.la' LIB_KOML='$(top_builddir)/lib/koml/libkoml.la' AC_SUBST(LIB_KOFFICEUI) AC_SUBST(LIB_KOFFICECORE) AC_SUBST(LIB_KSTORE) AC_SUBST(LIB_KOML) interfacedir='$(top_srcdir)/lib/interfaces' AC_SUBST(interfacedir) KOFFICE_LIBS='$(LIB_KOFFICEUI) $(LIB_KOFFICECORE) $(LIB_KSTORE) $(LIB_KOML) $(LIB_KDEUTIL)' AC_SUBST(KOFFICE_LIBS) KOFFICE_INCLUDES='-I$(top_srcdir)/lib $(KOFFICEUI_INCLUDES) $(KOFFICECORE_INCLUDES) $(KOML_INCLUDES) $(KSTORE_INCLUDES)' AC_SUBST(KOFFICE_INCLUDES) dnl add here all your Makefiles. These are created by configure AC_OUTPUT( \ Makefile \ kchart/Makefile \ kchart/core/Makefile \ kchart/pics/Makefile \ kchart/ui/Makefile \ kformula/Makefile \ kformula/pics/Makefile \ killustrator/Makefile \ killustrator/doc/Makefile \ killustrator/filter/Makefile \ killustrator/koffice/Makefile \ killustrator/pics/Makefile \ killustrator/share/Makefile \ killustrator/standalone/Makefile \ killustrator/xmlutils/Makefile \ kohtml/Makefile \ kohtml/toolbar/Makefile \ kimage/Makefile \ kimage/pics/Makefile \ - kpresenter/Makefile \ + kimageshop/Makefile \ + kimageshop/pics/Makefile \ + kpresenter/Makefile \ kpresenter/autoformEdit/Makefile \ kpresenter/autoforms/Makefile \ kpresenter/autoforms/Arrows/Makefile \ kpresenter/autoforms/Connections/Makefile \ kpresenter/pics/Makefile \ kpresenter/templates/Makefile \ kpresenter/templates/Screenpresentations/Makefile \ kpresenter/templates/Professional/Makefile \ kpresenter/toolbar/Makefile \ kpresenter/dtd/Makefile \ kpresenter/slideshow/Makefile \ kspread/Makefile \ kspread/pics/Makefile \ kspread/toolbar/Makefile \ kspread/scripts/Makefile \ kspread/dtd/Makefile \ kspread/filters/Makefile \ kspread/filters/komma/Makefile \ kword/Makefile \ kword/toolbar/Makefile \ kword/templates/Makefile \ kword/templates/Wordprocessing/Makefile \ kword/templates/DTP/Makefile \ kword/dtd/Makefile \ kword/filters/Makefile \ kword/filters/ascii/Makefile \ kword/filters/winword97/Makefile \ kdiagramm/Makefile \ kdiagramm/pics/Makefile \ koshell/Makefile \ lib/Makefile \ lib/kofficecore/Makefile \ lib/kofficeui/Makefile \ lib/kofficeui/pics/Makefile \ lib/kofficeui/test/Makefile \ lib/koml/Makefile \ lib/store/Makefile \ servicetypes/Makefile \ tools/Makefile \ tools/spell/Makefile \ plugins/Makefile \ plugins/recorder/Makefile \ plugins/recorder/pics/Makefile \ plugins/calc/Makefile \ plugins/calc/pics/Makefile \ pics/Makefile \ pics/toolbar/Makefile \ servicetypes/Makefile ) diff --git a/kimageshop/Makefile.am b/kimageshop/Makefile.am new file mode 100644 index 0000000000..f75a7d423d --- /dev/null +++ b/kimageshop/Makefile.am @@ -0,0 +1,64 @@ +SUBDIRS = pics + +INCLUDES = $(MICO_INCLUDES) $(KOFFICE_INCLUDES) $(all_includes) -I$(idldir) +LDFLAGS = $(all_libraries) $(MICO_LDFLAGS) $(KDE_RPATH) +LDADD = $(LIB_KOFFICEUI) $(LIB_KIMGIO) + +####### Files + +bin_PROGRAMS = kimageshop + +kimageshop_SOURCES = \ + kimageshop.cc \ + kimageshop_main.cc \ + kimageshop_shell.cc \ + kimageshop_doc.cc \ + kimageshop_view.cc \ + preferencesdlg.cc \ + zoomfactordlg.cc + +noinst_HEADERS = \ + kimageshop.h \ + kimageshop_main.h \ + kimageshop_shell.h \ + kimageshop_doc.h \ + kimageshop_view.h \ + preferencesdlg.h \ + zoomfactordlg.h + +METASOURCES = \ + kimageshop_main.moc \ + kimageshop_shell.moc \ + kimageshop_doc.moc \ + kimageshop_view.moc \ + preferencesdlg.moc \ + zoomfactordlg.moc + +idl_DATA = kimageshop.idl +idl_HEADERS = kimageshop.h + +DISTCLEANFILES = $(idl_DATA:.idl=.cc) $(idl_HEADERS) $(METASOURCES) + +kdelnk_DATA = kimageshop.desktop +kdelnkdir = $(kde_appsdir)/KOffice + +####### Implicit rules + +####### Build rules + +IDL_FLAGS = --query-server-for-narrow --relative-paths -I$(top_srcdir)/lib/kofficecore -I$(top_srcdir)/lib/store -I$(interfacedir) -I$(idldir) + +messages: + (XGETTEXT) -C -ki18n -x $(includedir)/kde.pot *.cc && mv messages.po ../po/kimageshop.pot + +kimageshop.h: kimageshop.idl $(micodir)/include/CORBA.h + $(IDL) $(IDL_FLAGS) $(srcdir)/kimageshop.idl + +kimageshop.cc: kimageshop.h +kimageshop_doc.cc: kimageshop.h +kimageshop_main.cc: kimageshop.h +kimageshop_shell.cc: kimageshop.h +kimageshop_view.cc: kimageshop.h +preferencesdlg.cc: preferencesdlg.h +zoomfactordlg.cc: zoomfactordlg.h +koShell.cc: koShell.h diff --git a/kimageshop/kimageshop.desktop b/kimageshop/kimageshop.desktop new file mode 100644 index 0000000000..55bf91abb7 --- /dev/null +++ b/kimageshop/kimageshop.desktop @@ -0,0 +1,12 @@ +[Desktop Entry] +Name=KImageShop +Exec=kimageshop +CORBAExec=kimageshop --server +Comment=Image processing application +MimeType=application/x-kimageshop;image/gif +X-KDE-RepoIds=IDL:KImageShop/DocumentFactory:1.0#KImageShop +X-KDE-ActivationMode=shared +Type=OpenPart +Icon=image.xpm +MiniIcon=image.xpm +ServiceTypes=KOfficeDocument diff --git a/kimageshop/kimageshop.idl b/kimageshop/kimageshop.idl new file mode 100644 index 0000000000..449d946fc6 --- /dev/null +++ b/kimageshop/kimageshop.idl @@ -0,0 +1,53 @@ +/* This file is part of the KDE project + Copyright (C) 1998, 1999 Torben Weis + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef __kimageshop_idl__ +#define __kimageshop_idl__ + +#include +#include +#include + +module KImageShop +{ + interface View : KOffice::View + { + }; + + interface Document : KOffice::Document, KOffice::Print + { +/* + // View menu + slot void viewZoomFactor(); + slot void viewFitToView(); + slot void viewFitWithProportions(); + slot void viewOriginalSize(); + slot void viewCentered(); + slot void viewInfoImage(); + slot void viewBackgroundColor(); +*/ + }; + + interface DocumentFactory : KOffice::DocumentFactory + { + }; +}; + +#endif + diff --git a/kimageshop/kimageshop_doc.cc b/kimageshop/kimageshop_doc.cc new file mode 100644 index 0000000000..1f4688c468 --- /dev/null +++ b/kimageshop/kimageshop_doc.cc @@ -0,0 +1,940 @@ +/* This file is part of the KDE project + Copyright (C) 1998, 1999 Torben Weis + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include + +#include + +#include "kimageshop_doc.h" +#include "kimageshop_shell.h" + +#define MM_TO_POINT 2.83465 +#define POINT_TO_MM 0.3527772388 + +/***************************************************************************** + * + * KImageShopDoc + * + *****************************************************************************/ + +KImageShopDoc::KImageShopDoc() +{ + ADD_INTERFACE("IDL:KOffice/Print:1.0"); + + m_bEmpty = true; + m_bModified = false; + + m_leftBorder = 20.0; + m_rightBorder = 20.0; + m_topBorder = 20.0; + m_bottomBorder = 20.0; + m_paperFormat = PG_DIN_A4; + m_paperWidth = PG_A4_WIDTH; + m_paperHeight = PG_A4_HEIGHT; + calcPaperSize(); + m_orientation = PG_PORTRAIT; + + m_executeCommand = false; + + kimgioRegister(); + + m_lstViews.setAutoDelete( false ); +} + +CORBA::Boolean KImageShopDoc::initDoc() +{ + return true; +} + +void KImageShopDoc::cleanUp() +{ + kdebug( KDEBUG_INFO, 0, "CleanUp KImageShopDoc" ); + + if ( m_bIsClean ) + return; + + ASSERT( m_lstViews.count() == 0 ); + + m_lstAllChildren.clear(); + + KoDocument::cleanUp(); +} + +KOffice::MainWindow_ptr KImageShopDoc::createMainWindow() +{ + KImageShopShell* shell = new KImageShopShell; + shell->show(); + shell->setDocument( this ); + + return KOffice::MainWindow::_duplicate( shell->koInterface() ); +} + +void KImageShopDoc::removeView( KImageShopView* _view ) +{ + m_lstViews.removeRef( _view ); +} + +KImageShopView* KImageShopDoc::createImageView( QWidget* _parent ) +{ + KImageShopView *p = new KImageShopView( _parent, 0L, this ); + + m_lstViews.append( p ); + return p; +} + +OpenParts::View_ptr KImageShopDoc::createView() +{ + return OpenParts::View::_duplicate( createImageView() ); +} + +void KImageShopDoc::viewList( OpenParts::Document::ViewList*& _list ) +{ + _list->length( m_lstViews.count() ); + + int i = 0; + QListIterator it( m_lstViews ); + for( ; it.current(); ++it ) + { + (*_list)[i++] = OpenParts::View::_duplicate( it.current() ); + } +} + +int KImageShopDoc::viewCount() +{ + return m_lstViews.count(); +} + +bool KImageShopDoc::save( ostream& out, const char* /* format */ ) +{ + out << "" << endl; + out << otag << "" << endl; + + out << otag << "" << endl; + out << indent << "" << endl; + out << indent << "" << endl; + out << indent << "" << endl; + out << etag << "" << endl; + + out << etag << "" << endl; + + setModified( FALSE ); + + return true; +} + +bool KImageShopDoc::completeSaving( KOStore::Store_ptr _store ) +{ + CORBA::String_var u = url(); + QString u2 = u.in(); + u2 += "/image"; + + _store->open( u2, "image/bmp" ); + { + ostorestream out( _store ); + out << m_image; + out.flush(); + } + _store->close(); + + return true; +} + +/* +bool KImageShopDoc::loadBinary( istream& _stream, bool _randomaccess, KOStore::Store_ptr _store ) +{ + kdebug( KDEBUG_INFO, 0, "------------------------ LOADING --------------------" ); + + // implement binary loading here. + + kdebug( KDEBUG_INFO, 0, "--------------------- LOADING DONE ------------------" ); +} +*/ + +bool KImageShopDoc::loadXML( KOMLParser& parser, KOStore::Store_ptr _store ) +{ + kdebug( KDEBUG_INFO, 0, "------------------------ LOADING --------------------" ); + + string tag; + vector lst; + string name; + + // DOC + if ( !parser.open( "DOC", tag ) ) + { + kdebug( KDEBUG_INFO, 0, "Missing DOC" ); + return false; + } + + KOMLParser::parseTag( tag.c_str(), name, lst ); + vector::const_iterator it = lst.begin(); + for( ; it != lst.end(); it++ ) + { + if ( it->m_strName == "mime" ) + { + if ( it->m_strValue != "application/x-kimageshop" ) + { + kdebug( KDEBUG_INFO, 0, "Unknown mime type %s", it->m_strValue.c_str() ); + return false; + } + } + } + + QString format = "A4", orientation = "Portrait"; + float left = 20.0, right = 20.0, bottom = 20.0, top = 20.0; + QString hl="", hm="", hr=""; + QString fl="", fm="", fr=""; + + // PAPER + while( parser.open( 0L, tag ) ) + { + KOMLParser::parseTag( tag.c_str(), name, lst ); + + if ( name == "PAPER" ) + { + KOMLParser::parseTag( tag.c_str(), name, lst ); + vector::const_iterator it = lst.begin(); + for( ; it != lst.end(); it++ ) + { + if ( it->m_strName == "format" ) + { + format = it->m_strValue.c_str(); + } + else if ( it->m_strName == "orientation" ) + { + orientation = it->m_strValue.c_str(); + } + else + kdebug( KDEBUG_INFO, 0, "Unknown attrib PAPER:'%s'",it->m_strName.c_str() ); + } + + // PAPERBORDERS, HEAD, FOOT + while( parser.open( 0L, tag ) ) + { + KOMLParser::parseTag( tag.c_str(), name, lst ); + + if ( name == "PAPERBORDERS" ) + { + KOMLParser::parseTag( tag.c_str(), name, lst ); + vector::const_iterator it = lst.begin(); + for( ; it != lst.end(); it++ ) + { + if ( it->m_strName == "left" ) + { + left = atof( it->m_strValue.c_str() ); + } + else if ( it->m_strName == "top" ) + { + top = atof( it->m_strValue.c_str() ); + } + else if ( it->m_strName == "right" ) + { + right = atof( it->m_strValue.c_str() ); + } + else if ( it->m_strName == "bottom" ) + { + bottom = atof( it->m_strValue.c_str() ); + } + else + kdebug( KDEBUG_INFO, 0, "Unknown attrib 'PAPERBORDERS:%s'", it->m_strName.c_str() ); + } + } + else if ( name == "HEAD" ) + { + KOMLParser::parseTag( tag.c_str(), name, lst ); + vector::const_iterator it = lst.begin(); + for( ; it != lst.end(); it++ ) + { + if ( it->m_strName == "left" ) + { + hl = it->m_strValue.c_str(); + } + else if ( it->m_strName == "center" ) + { + hm = it->m_strValue.c_str(); + } + else if ( it->m_strName == "right" ) + { + hr = it->m_strValue.c_str(); + } + else + kdebug( KDEBUG_INFO, 0, "Unknown attrib 'HEAD:%s'", it->m_strName.c_str() ); + } + } + else if ( name == "FOOT" ) + { + KOMLParser::parseTag( tag.c_str(), name, lst ); + vector::const_iterator it = lst.begin(); + for( ; it != lst.end(); it++ ) + { + if ( it->m_strName == "left" ) + { + fl = it->m_strValue.c_str(); + } + else if ( it->m_strName == "center" ) + { + fm = it->m_strValue.c_str(); + } + else if ( it->m_strName == "right" ) + { + fr = it->m_strValue.c_str(); + } + else + kdebug( KDEBUG_INFO, 0, "Unknown attrib 'FOOT:%s'", it->m_strName.c_str() ); + } + } + else + kdebug( KDEBUG_INFO, 0, "Unknown tag '%s' in PAPER", tag.c_str() ); + + if ( !parser.close( tag ) ) + { + kdebug( KDEBUG_INFO, 0, "ERROR: Closing PAPER" ); + return false; + } + } + } + else + kdebug( KDEBUG_INFO, 0, "Unknown tag '%s' in DOC", tag.c_str() ); + + if ( !parser.close( tag ) ) + { + kdebug( KDEBUG_INFO, 0, "ERROR: Closing DOC" ); + return false; + } + } + + parser.close( tag ); + + setPaperLayout( left, top, right, bottom, format, orientation ); + setHeadFootLine( hl, hm, hr, fl, fm, fr ); + + kdebug( KDEBUG_INFO, 0, "------------------------ LOADING DONE --------------------" ); + + return true; +} + +bool KImageShopDoc::completeLoading( KOStore::Store_ptr _store ) +{ + kdebug( KDEBUG_INFO, 0, "------------------------ COMPLETION DONE --------------------" ); + + CORBA::String_var str = url(); + QString u = str.in(); + u += "/image"; + _store->open( u, 0L ); + { + istorestream in( _store ); + in >> m_image; + } + _store->close(); + + m_bModified = false; + m_bEmpty = false; + + emit sigUpdateView(); + + return true; +} + +void KImageShopDoc::print( QPaintDevice* _dev ) +{ + QPainter painter; + painter.begin( _dev ); + + // HACK + int pagenr = 1; + QString m_strName = ""; + + // print head line + QFont font( "Times", 10 ); + painter.setFont( font ); + QFontMetrics fm = painter.fontMetrics(); + int w = fm.width( headLeft( pagenr, m_strName ) ); + if ( w > 0 ) + painter.drawText( (int)( MM_TO_POINT * leftBorder() ), + (int)( MM_TO_POINT * 10.0 ), headLeft( pagenr, m_strName ) ); + w = fm.width( headMid( pagenr, m_strName ) ); + if ( w > 0 ) + painter.drawText( (int)( MM_TO_POINT * leftBorder() + + ( MM_TO_POINT * printableWidth() - (float)w ) / 2.0 ), + (int)( MM_TO_POINT * 10.0 ), headMid( pagenr, m_strName ) ); + w = fm.width( headRight( pagenr, m_strName ) ); + if ( w > 0 ) + painter.drawText( (int)( MM_TO_POINT * leftBorder() + + MM_TO_POINT * printableWidth() - (float)w ), + (int)( MM_TO_POINT * 10.0 ), headRight( pagenr, m_strName ) ); + + // print foot line + w = fm.width( footLeft( pagenr, m_strName ) ); + if ( w > 0 ) + painter.drawText( (int)( MM_TO_POINT * leftBorder() ), + (int)( MM_TO_POINT * ( paperHeight() - 10.0 ) ), + footLeft( pagenr, m_strName ) ); + w = fm.width( footMid( pagenr, m_strName ) ); + if ( w > 0 ) + painter.drawText( (int)( MM_TO_POINT * leftBorder() + + ( MM_TO_POINT * printableWidth() - (float)w ) / 2.0 ), + (int)( MM_TO_POINT * ( paperHeight() - 10.0 ) ), + footMid( pagenr, m_strName ) ); + w = fm.width( footRight( pagenr, m_strName ) ); + if ( w > 0 ) + painter.drawText( (int)( MM_TO_POINT * leftBorder() + + MM_TO_POINT * printableWidth() - (float)w ), + (int)( MM_TO_POINT * ( paperHeight() - 10.0 ) ), + footRight( pagenr, m_strName ) ); + + painter.translate( MM_TO_POINT * m_leftBorder, MM_TO_POINT * m_topBorder ); + + // Print centered + painter.drawImage( ( MM_TO_POINT * printableWidth() - m_image.width() ) / 2, + ( MM_TO_POINT * printableHeight() - m_image.height() ) / 2, + m_image ); + + painter.end(); +} + +void KImageShopDoc::draw( QPaintDevice* _dev, CORBA::Long _width, CORBA::Long _height, + CORBA::Float _scale ) +{ + kdebug( KDEBUG_INFO, 0, "DRAWING w=%li h=%li", _width, _height ); + + QPainter painter; + painter.begin( _dev ); + + if ( _scale != 1.0 ) + painter.scale( _scale, _scale ); + + // Print centered + int x = ( _width - m_image.width() ) / 2; + int y = ( _height - m_image.height() ) / 2; + QPoint p( x, y ); + + QRect rect; + if ( x >= 0 ) + { + rect.setLeft( 0 ); + rect.setWidth( m_image.width() ); + } + else + { + rect.setLeft( -x ); + rect.setWidth( m_image.width() + 2*x ); + } + if ( y >= 0 ) + { + rect.setTop( 0 ); + rect.setHeight( m_image.height() ); + } + else + { + rect.setTop( -x ); + rect.setHeight( m_image.height() + 2*x ); + } + + painter.drawImage( p, m_image, rect ); + + painter.end(); +} + +void KImageShopDoc::paperLayoutDlg() +{ + KoPageLayout pl; + pl.format = paperFormat(); + pl.orientation = orientation(); + pl.unit = PG_MM; + pl.width = m_paperWidth; + pl.height = m_paperHeight; + pl.left = leftBorder(); + pl.right = rightBorder(); + pl.top = topBorder(); + pl.bottom = bottomBorder(); + + KoHeadFoot hf; + hf.headLeft = headLeft(); + hf.headRight = headRight(); + hf.headMid = headMid(); + hf.footLeft = footLeft(); + hf.footRight = footRight(); + hf.footMid = footMid(); + + if ( !KoPageLayoutDia::pageLayout( pl, hf, FORMAT_AND_BORDERS | HEADER_AND_FOOTER ) ) + return; + + if ( pl.format == PG_CUSTOM ) + { + m_paperWidth = pl.width; + m_paperHeight = pl.height; + } + + setPaperLayout( pl.left, pl.top, pl.right, pl.bottom, pl.format, pl.orientation ); + + setHeadFootLine( hf.headLeft, hf.headMid, hf.headRight, hf.footLeft, hf.footMid, hf.footRight ); + + emit sigUpdateView(); +} + +void KImageShopDoc::setHeadFootLine( const char *_headl, const char *_headm, const char *_headr, + const char *_footl, const char *_footm, const char *_footr ) +{ + m_headLeft = _headl; + m_headRight = _headr; + m_headMid = _headm; + m_footLeft = _footl; + m_footRight = _footr; + m_footMid = _footm; + + m_bModified = TRUE; +} + +void KImageShopDoc::setPaperLayout( float _leftBorder, float _topBorder, float _rightBorder, float _bottomBorder, + const char * _paper, const char* _orientation ) +{ + KoFormat f = paperFormat(); + KoOrientation o = orientation(); + + if ( strcmp( "A3", _paper ) == 0L ) + f = PG_DIN_A3; + else if ( strcmp( "A4", _paper ) == 0L ) + f = PG_DIN_A4; + else if ( strcmp( "A5", _paper ) == 0L ) + f = PG_DIN_A5; + else if ( strcmp( "B5", _paper ) == 0L ) + f = PG_DIN_B5; + else if ( strcmp( "Executive", _paper ) == 0L ) + f = PG_US_EXECUTIVE; + else if ( strcmp( "Letter", _paper ) == 0L ) + f = PG_US_LETTER; + else if ( strcmp( "Legal", _paper ) == 0L ) + f = PG_US_LEGAL; + else if ( strcmp( "Screen", _paper ) == 0L ) + f = PG_SCREEN; + else if ( strcmp( "Custom", _paper ) == 0L ) + { + m_paperWidth = 0.0; + m_paperHeight = 0.0; + f = PG_CUSTOM; + QString tmp( _paper ); + m_paperWidth = atof( _paper ); + int i = tmp.find( 'x' ); + if ( i != -1 ) + m_paperHeight = atof( tmp.data() + i + 1 ); + if ( m_paperWidth < 10.0 ) + m_paperWidth = PG_A4_WIDTH; + if ( m_paperHeight < 10.0 ) + m_paperWidth = PG_A4_HEIGHT; + } + + if ( strcmp( "Portrait", _orientation ) == 0L ) + o = PG_PORTRAIT; + else if ( strcmp( "Landscape", _orientation ) == 0L ) + o = PG_LANDSCAPE; + + setPaperLayout( _leftBorder, _topBorder, _rightBorder, _bottomBorder, f, o ); +} + +void KImageShopDoc::setPaperLayout( float _leftBorder, float _topBorder, float _rightBorder, float _bottomBorder, + KoFormat _paper, KoOrientation _orientation ) +{ + m_leftBorder = _leftBorder; + m_rightBorder = _rightBorder; + m_topBorder = _topBorder; + m_bottomBorder = _bottomBorder; + m_orientation = _orientation; + m_paperFormat = _paper; + + calcPaperSize(); + + m_bModified = TRUE; +} + +QString KImageShopDoc::completeHeading( const char *_data, int _page, const char *_table ) +{ + /* QString page; + page.sprintf( "%i", _page ); + QString f = m_strFileURL.data(); + if ( f.isNull() ) + f = ""; + QString n = ""; + if ( f != "" ) + { + KURL u( f.data() ); + n = u.filename(); + } */ + QString t = QTime::currentTime().toString().copy(); + QString d = QDate::currentDate().toString().copy(); + + QString tmp = _data; + int pos = 0; + /* while ( ( pos = tmp.find( "", pos ) ) != -1 ) + tmp.replace( pos, 6, f.data() ); */ + pos = 0; + /* while ( ( pos = tmp.find( "", pos ) ) != -1 ) + tmp.replace( pos, 6, n.data() ); */ + pos = 0; + while ( ( pos = tmp.find( "