Warning, file /office/calligra/libs/pageapp/KoPASavingContext.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 KDE project
0002    Copyright (C) 2007 Thorsten Zachmann <zachmann@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 
0020 #ifndef KOPASAVINGCONTEXT_H
0021 #define KOPASAVINGCONTEXT_H
0022 
0023 #include <QMap>
0024 #include <QSet>
0025 #include <QString>
0026 
0027 #include <KoShapeSavingContext.h>
0028 
0029 #include "kopageapp_export.h"
0030 
0031 class KoPAMasterPage;
0032 class KoPAPage;
0033 
0034 /**
0035  * Context needed for saving the data of a kopageapp.
0036  */
0037 class KOPAGEAPP_EXPORT KoPASavingContext : public KoShapeSavingContext
0038 {
0039 public:
0040     /**
0041      * @brief Constructor
0042      *
0043      * @param xmlWriter used for writing the data to
0044      * @param mainStyles the saving styles
0045      * @param embeddedSaver for saving embedded documents
0046      * @param page the starting page number
0047      */
0048     KoPASavingContext( KoXmlWriter &xmlWriter, KoGenStyles& mainStyles, KoEmbeddedDocumentSaver &embeddedSaver, int page); //TODO default
0049 
0050     /**
0051      * @brief Destructor
0052      */
0053     ~KoPASavingContext() override;
0054 
0055     /**
0056      * @brief Add style name of master to lookup table
0057      *
0058      * @param masterPage the master page
0059      * @param name the style name of the master page
0060      */
0061     void addMasterPage( const KoPAMasterPage * masterPage, const QString &name );
0062 
0063     /**
0064      * @brief Get the name of the masterpage
0065      *
0066      * @param masterPage for which the style name should be returned
0067      *
0068      * @return the style name of the masterPage
0069      */
0070     QString masterPageName( const KoPAMasterPage * masterPage ) const;
0071 
0072     /**
0073      * @brief Get the element name use in saving
0074      *
0075      * The ement name is used for saving the content of the master page style.
0076      * This makes it possible to save 2 master pages with the same content when
0077      * the element name is different.
0078      *
0079      * If KoShapeSavingContext::UniqueMasterPages is set duplicate master pages
0080      * will be merged into one.
0081      *
0082      * @return element name
0083      */
0084     QString masterPageElementName();
0085 
0086     /**
0087      * @brief Increment the page
0088      */
0089     void incrementPage();
0090 
0091     /**
0092      * @brief Get the current page number
0093      *
0094      * The page number starts at 1
0095      */
0096     int page();
0097 
0098     /**
0099      * @brief Set the clearDrawIds flag
0100      *
0101      * @see KoPAPastePage::process
0102      */
0103     void setClearDrawIds( bool clear );
0104 
0105     /**
0106      * @brief Get the clearDrawIds flag
0107      *
0108      * @see KoPAPastePage::process
0109      */
0110     bool isSetClearDrawIds();
0111 
0112     /**
0113      * @brief get the draw:name of the page to use
0114      */
0115     QString pageName( const KoPAPage * page );
0116 
0117 private:
0118     QMap<const KoPAMasterPage *, QString> m_masterPageNames;
0119     // TODO use a boost::multi_index_container
0120     QMap<const KoPAPage *, QString> m_pageToNames;
0121     QSet<QString> m_pageNames;
0122     int m_page;
0123     int m_masterPageIndex;
0124     bool m_clearDrawIds;
0125 };
0126 
0127 #endif /* KOPASAVINGCONTEXT_H */