Warning, file /office/calligra/libs/main/KoFilterGraph.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /* This file is part of the Calligra libraries
0002    Copyright (C) 2001 Werner Trobin <trobin@kde.org>
0003 
0004 This library is free software; you can redistribute it and/or
0005 modify it under the terms of the GNU Library General Public
0006 License as published by the Free Software Foundation; either
0007 version 2 of the License, or (at your option) any later version.
0008 
0009 This library is distributed in the hope that it will be useful,
0010 but WITHOUT ANY WARRANTY; without even the implied warranty of
0011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0012 Library General Public License for more details.
0013 
0014 You should have received a copy of the GNU Library General Public License
0015 along with this library; see the file COPYING.LIB.  If not, write to
0016 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0017 Boston, MA 02110-1301, USA.
0018 */
0019 #ifndef KOFILTERGRAPH_H
0020 #define KOFILTERGRAPH_H
0021 
0022 #include "komain_export.h"
0023 #include "KoFilterChain.h"
0024 #include "KoFilterVertex.h"
0025 #include <QByteArray>
0026 #include <QHash>
0027 
0028 namespace CalligraFilter {
0029 
0030 /**
0031  * The main worker behind the scenes. Manages the creation of the graph,
0032  * processing the information in it, and creating the filter chains.
0033  * @internal
0034  * Only exported for unit tests.
0035  */
0036 class KOMAIN_TEST_EXPORT Graph
0037 {
0038 
0039 public:
0040     explicit Graph(const QByteArray& from);
0041     ~Graph();
0042 
0043     bool isValid() const {
0044         return m_graphValid;
0045     }
0046 
0047     QByteArray sourceMimeType() const {
0048         return m_from;
0049     }
0050     void setSourceMimeType(const QByteArray& from);
0051 
0052     // Creates a chain from "from" to the "to" mimetype
0053     // If the "to" mimetype isEmpty() then we try to find the
0054     // closest Calligra mimetype and use that as destination.
0055     // After such a search "to" will contain the dest. mimetype (return value)
0056     // if the search was successful. Might return 0!
0057     KoFilterChain::Ptr chain(const KoFilterManager* manager, QByteArray& to) const;
0058 
0059     // debugging
0060     void dump() const;
0061 
0062 private:
0063     Graph(const Graph& rhs);
0064     Graph& operator=(const Graph& rhs);
0065 
0066     void buildGraph();
0067     void shortestPaths();
0068     QByteArray findCalligraPart() const;
0069 
0070     QHash<QByteArray, CalligraFilter::Vertex*> m_vertices;
0071     QByteArray m_from;
0072     bool m_graphValid;
0073 
0074     class Private;
0075     Private * const d;
0076 };
0077 
0078 }
0079 #endif // KOFILTERGRAPH_H