File indexing completed on 2024-05-12 16:30:48

0001 /* This file is part of the KDE project
0002  * Copyright (C) 2001-2002 Lennart Kudling <kudling@kde.org>
0003  * Copyright (C) 2001-2005,2007 Rob Buis <buis@kde.org>
0004  * Copyright (C) 2002,2004-2005 Laurent Montel <montel@kde.org>
0005  * Copyright (C) 2002 Benoit Vautrin <benoit.vautrin@free.fr>
0006  * Copyright (C) 2004-2005,2007 David Faure <faure@kde.org>
0007  * Copyright (C) 2004,2006 Peter Simonsson <psn@linux.se>
0008  * Copyright (C) 2004-2005 Fredrik Edemar <f_edemar@linux.se>
0009  * Copyright (C) 2005-2007 Jan Hambrecht <jaham@gmx.net>
0010  * Copyright (C) 2005-2007 Thomas Zander <zander@kde.org>
0011  * Copyright (C) 2006 Inge Wallin <inge@lysator.liu.se>
0012  * Copyright (C) 2006 Tim Beaulen <tbscope@gmail.com>
0013  * Copyright (C) 2006 Casper Boemann <cbr@boemann.dk>
0014  * Copyright (C) 2006-2007 Thorsten Zachmann <t.zachmann@zagge.de>
0015  * Copyright (C) 2012 Yue Liu <yue.liu@mail.com>
0016  *
0017  * This library is free software; you can redistribute it and/or
0018  * modify it under the terms of the GNU Library General Public
0019  * License as published by the Free Software Foundation; either
0020  * version 2 of the License, or (at your option) any later version.
0021  *
0022  * This library is distributed in the hope that it will be useful,
0023  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0024  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0025  * Library General Public License for more details.
0026  *
0027  * You should have received a copy of the GNU Library General Public License
0028  * along with this library; see the file COPYING.LIB.  If not, write to
0029  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0030  * Boston, MA 02110-1301, USA.
0031  */
0032 
0033 #ifndef KARBON_DOCUMENT_H
0034 #define KARBON_DOCUMENT_H
0035 
0036 #include <QString>
0037 #include <QMap>
0038 #include <QRectF>
0039 
0040 #include <KoShapeBasedDocumentBase.h>
0041 
0042 #include <KoPADocument.h>
0043 #include <KoShapeLoadingContext.h>
0044 #include <KoXmlReader.h>
0045 
0046 #include <karbonui_export.h>
0047 
0048 class QRect;
0049 class KarbonPart;
0050 class KarbonCanvas;
0051 class KoDataCenterBase;
0052 class KoShape;
0053 class KoShapeSavingContext;
0054 class KoShapeLayer;
0055 class KoImageCollection;
0056 class KoStore;
0057 
0058 #define KARBON_MIME_TYPE "application/vnd.oasis.opendocument.graphics"
0059 
0060 /**
0061  * Keeps track of visual per document properties.
0062  * It loads initial settings and applies them to the document and its views.
0063  */
0064 class KARBONUI_EXPORT KarbonDocument : public KoPADocument
0065 {
0066     Q_OBJECT
0067 public:
0068     explicit KarbonDocument(KarbonPart *part);
0069     ~KarbonDocument() override;
0070 
0071     KoOdf::DocumentType documentType() const override;
0072 
0073     /// reimplemented from KoDocument
0074     QByteArray nativeFormatMimeType() const override { return KARBON_MIME_TYPE; }
0075     /// reimplemented from KoDocument
0076     QByteArray nativeOasisMimeType() const override { return KARBON_MIME_TYPE; }
0077     /// reimplemented from KoDocument
0078     QStringList extraNativeMimeTypes() const override
0079     {
0080         return QStringList() << "application/vnd.oasis.opendocument.graphics-template";
0081     }
0082 
0083     /// Returns if status bar is shown
0084     bool showStatusBar() const;
0085     /// Shows/hides status bar
0086     void setShowStatusBar(bool b);
0087     /// update attached view(s) on the current doc settings
0088     /// at this time only the status bar is handled
0089     void reorganizeGUI();
0090 
0091     /// Returns maximum number of recent files
0092     uint maxRecentFiles() const;
0093 
0094     bool mergeNativeFormat(const QString & file);
0095 
0096 public Q_SLOTS:
0097     void slotDocumentRestored();
0098 
0099 Q_SIGNALS:
0100     void applyCanvasConfiguration(KarbonCanvas *canvas);
0101 
0102 protected:
0103     const char *odfTagName(bool withNamespace) override;
0104     /// Reads settings from config file
0105     void initConfig();
0106 
0107 
0108 private:
0109     class Private;
0110     Private * const d;
0111 };
0112 
0113 #endif // KARBON_DOCUMENT_H
0114