File indexing completed on 2024-04-14 05:37:00

0001 /***************************************************************************
0002  *   Copyright (C) 2005 by David Saxton                                    *
0003  *   david@bluehaze.org                                                    *
0004  *                                                                         *
0005  *   This program is free software; you can redistribute it and/or modify  *
0006  *   it under the terms of the GNU General Public License as published by  *
0007  *   the Free Software Foundation; either version 2 of the License, or     *
0008  *   (at your option) any later version.                                   *
0009  ***************************************************************************/
0010 
0011 #include "docmanageriface.h"
0012 #include "docmanager.h"
0013 #include "document.h"
0014 
0015 // needed for casts below to compile
0016 #include "electronics/circuitdocument.h"
0017 #include "flowcodedocument.h"
0018 #include "mechanicsdocument.h"
0019 #include "textdocument.h"
0020 
0021 DocManagerIface::DocManagerIface(DocManager *docManager)
0022     : DCOPObject(/* TODO "DocumentManager" */)
0023 {
0024     m_pDocManager = docManager;
0025 }
0026 
0027 DocManagerIface::~DocManagerIface()
0028 {
0029 }
0030 
0031 bool DocManagerIface::closeAll()
0032 {
0033     return m_pDocManager->closeAll();
0034 }
0035 
0036 DCOPRef DocManagerIface::openURL(const QString &url)
0037 {
0038     return docToRef(m_pDocManager->openURL(QUrl(url)));
0039 }
0040 
0041 void DocManagerIface::gotoTextLine(const QString &url, int line)
0042 {
0043     m_pDocManager->gotoTextLine(QUrl(url), line);
0044 }
0045 
0046 DCOPRef DocManagerIface::createTextDocument()
0047 {
0048     return docToRef(static_cast<Document *>(m_pDocManager->createTextDocument()));
0049 }
0050 
0051 DCOPRef DocManagerIface::createCircuitDocument()
0052 {
0053     return docToRef(static_cast<Document *>(m_pDocManager->createCircuitDocument()));
0054 }
0055 
0056 DCOPRef DocManagerIface::createFlowCodeDocument()
0057 {
0058     return docToRef(static_cast<Document *>(m_pDocManager->createFlowCodeDocument()));
0059 }
0060 
0061 DCOPRef DocManagerIface::createMechanicsDocument()
0062 {
0063     return docToRef(static_cast<Document *>(m_pDocManager->createMechanicsDocument()));
0064 }
0065 
0066 DCOPRef DocManagerIface::docToRef(Document *document)
0067 {
0068     if (document)
0069         return DCOPRef(); // TODO document->dcopObject());
0070     return DCOPRef();
0071 }