From koffice Mon Jun 27 10:20:16 2005 From: David Faure Date: Mon, 27 Jun 2005 10:20:16 +0000 To: koffice Subject: Re: New document problems Message-Id: <200506271220.16955.faure () kde ! org> X-MARC-Message: https://marc.info/?l=koffice&m=111986763408269 On Monday 27 June 2005 12:06, Boudewijn Rempt wrote: > I'm trying to implement paste as new image in Krita, and so I need to find a > way to create a new document, set some data in it, and then create a new view > with that document (which may not have been saved, even). I've tried wrapping > my mind around the things that happen when KoAppliatication::slotFileNew is > called, but short of duplicating a lot of that code, I cannot see a way > out... Is there actually a way of creating a document, creating a view and > settting the document to that view? This is a new requirement for kofficecore indeed, but I'm sure we can put together a method to do this. Do you want the new document to be in a new KoMainWindow ? AFAICS all you need is KoDocument* newdoc = myMainWindow->createDoc(); // or duplicate the 3 lines there KoMainWindow *win = new KoMainWindow( newdoc->instance() ); win->show(); win->setRootDocument( newdoc ); (The view stuff happens in setRootDocument automatically, you only need to care about document and mainwindow). -- David Faure, faure@kde.org, sponsored by Trolltech to work on KDE, Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org). ____________________________________ koffice mailing list koffice@kde.org To unsubscribe please visit: https://mail.kde.org/mailman/listinfo/koffice