| 1 |
// SPDX-License-Identifier: LGPL-2.1-or-later |
| 2 |
|
| 3 |
/*************************************************************************** |
| 4 |
* Copyright (c) 2023 Werner Mayer <wmayer[at]users.sourceforge.net> * |
| 5 |
* * |
| 6 |
* This file is part of FreeCAD. * |
| 7 |
* * |
| 8 |
* FreeCAD is free software: you can redistribute it and/or modify it * |
| 9 |
* under the terms of the GNU Lesser General Public License as * |
| 10 |
* published by the Free Software Foundation, either version 2.1 of the * |
| 11 |
* License, or (at your option) any later version. * |
| 12 |
* * |
| 13 |
* FreeCAD is distributed in the hope that it will be useful, but * |
| 14 |
* WITHOUT ANY WARRANTY; without even the implied warranty of * |
| 15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * |
| 16 |
* Lesser General Public License for more details. * |
| 17 |
* * |
| 18 |
* You should have received a copy of the GNU Lesser General Public * |
| 19 |
* License along with FreeCAD. If not, see * |
| 20 |
* <https://www.gnu.org/licenses/>. * |
| 21 |
* * |
| 22 |
**************************************************************************/ |
| 23 |
|
| 24 |
#ifndef GUI_FILE_HANDLER_H |
| 25 |
#define GUI_FILE_HANDLER_H |
| 26 |
|
| 27 |
#include <QString> |
| 28 |
#include <string> |
| 29 |
|
| 30 |
namespace App |
| 31 |
{ |
| 32 |
class Document; |
| 33 |
} |
| 34 |
|
| 35 |
namespace Gui |
| 36 |
{ |
| 37 |
|
| 38 |
class FileHandler |
| 39 |
{ |
| 40 |
public: |
| 41 |
explicit FileHandler(const QString& filename); |
| 42 |
bool openFile(); |
| 43 |
bool importFile(const std::string& document); |
| 44 |
QString extension() const; |
| 45 |
|
| 46 |
private: |
| 47 |
bool activateEditor(); |
| 48 |
App::Document* createDocumentIfNeeded(); |
| 49 |
App::Document* getOrCreateDocument(); |
| 50 |
App::Document* getOrCreateDocument(const std::string& document); |
| 51 |
bool openInternal(); |
| 52 |
void openInternal(const char* type, const char* prop); |
| 53 |
void openInventor(); |
| 54 |
void openVRML(); |
| 55 |
void openImage(); |
| 56 |
void openPython(); |
| 57 |
|
| 58 |
private: |
| 59 |
QString filename; |
| 60 |
std::string docname; |
| 61 |
}; |
| 62 |
|
| 63 |
} // namespace Gui |
| 64 |
|
| 65 |
#endif // GUI_FILE_HANDLER_H |