| 1 |
/*************************************************************************** |
| 2 |
* Copyright (c) 2010 Werner Mayer <wmayer[at]users.sourceforge.net> * |
| 3 |
* * |
| 4 |
* This file is part of the FreeCAD CAx development system. * |
| 5 |
* * |
| 6 |
* This library is free software; you can redistribute it and/or * |
| 7 |
* modify it under the terms of the GNU Library General Public * |
| 8 |
* License as published by the Free Software Foundation; either * |
| 9 |
* version 2 of the License, or (at your option) any later version. * |
| 10 |
* * |
| 11 |
* This library is distributed in the hope that it will be useful, * |
| 12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
| 13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
| 14 |
* GNU Library General Public License for more details. * |
| 15 |
* * |
| 16 |
* You should have received a copy of the GNU Library General Public * |
| 17 |
* License along with this library; see the file COPYING.LIB. If not, * |
| 18 |
* write to the Free Software Foundation, Inc., 59 Temple Place, * |
| 19 |
* Suite 330, Boston, MA 02111-1307, USA * |
| 20 |
* * |
| 21 |
***************************************************************************/ |
| 22 |
|
| 23 |
|
| 24 |
#ifndef GUI_MERGEDOCUMENTS_H |
| 25 |
#define GUI_MERGEDOCUMENTS_H |
| 26 |
|
| 27 |
#include <Base/Persistence.h> |
| 28 |
#include <map> |
| 29 |
#include <vector> |
| 30 |
#include <boost/signals2.hpp> |
| 31 |
|
| 32 |
namespace zipios |
| 33 |
{ |
| 34 |
class ZipInputStream; |
| 35 |
} |
| 36 |
namespace App |
| 37 |
{ |
| 38 |
class Document; |
| 39 |
class DocumentObject; |
| 40 |
} // namespace App |
| 41 |
|
| 42 |
namespace Gui |
| 43 |
{ |
| 44 |
class Document; |
| 45 |
class GuiExport MergeDocuments: public Base::Persistence |
| 46 |
{ |
| 47 |
public: |
| 48 |
explicit MergeDocuments(App::Document* doc); |
| 49 |
~MergeDocuments() override; |
| 50 |
unsigned int getMemSize() const override; |
| 51 |
std::vector<App::DocumentObject*> importObjects(std::istream&); |
| 52 |
void importObject(const std::vector<App::DocumentObject*>& o, Base::XMLReader& r); |
| 53 |
void exportObject(const std::vector<App::DocumentObject*>& o, Base::Writer& w); |
| 54 |
void Save(Base::Writer& w) const override; |
| 55 |
void Restore(Base::XMLReader& r) override; |
| 56 |
void SaveDocFile(Base::Writer& w) const override; |
| 57 |
void RestoreDocFile(Base::Reader& r) override; |
| 58 |
|
| 59 |
private: |
| 60 |
zipios::ZipInputStream* stream {nullptr}; |
| 61 |
App::Document* appdoc; |
| 62 |
Gui::Document* document; |
| 63 |
std::vector<App::DocumentObject*> objects; |
| 64 |
std::map<std::string, std::string> nameMap; |
| 65 |
using Connection = boost::signals2::connection; |
| 66 |
Connection connectExport; |
| 67 |
Connection connectImport; |
| 68 |
}; |
| 69 |
|
| 70 |
} // namespace Gui |
| 71 |
|
| 72 |
#endif // GUI_MERGEDOCUMENTS_H |