Warning, file /office/calligra/libs/main/KoFindStyle.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  *
0003  * Copyright (c) 2012 Arjen Hiemstra <ahiemstra@heimr.nl>
0004  *
0005  * This library is free software; you can redistribute it and/or
0006  * modify it under the terms of the GNU Library General Public
0007  * License as published by the Free Software Foundation; either
0008  * version 2 of the License, or (at your option) any later version.
0009  *
0010  * This library is distributed in the hope that it will be useful,
0011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0013  * Library General Public License for more details.
0014  *
0015  * You should have received a copy of the GNU Library General Public License
0016  * along with this library; see the file COPYING.LIB.  If not, write to
0017  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0018  * Boston, MA 02110-1301, USA.
0019  */
0020 
0021 #ifndef KOFINDSTYLE_H
0022 #define KOFINDSTYLE_H
0023 
0024 #include "KoFindBase.h"
0025 
0026 #include <QMetaType>
0027 #include <QTextDocument>
0028 #include <QTextCursor>
0029 
0030 #include "komain_export.h"
0031 
0032 /**
0033  * \brief Implementation of KoFindBase that can find style usage.
0034  *
0035  * This class will search through a set of QTextDocuments for uses of  a paragraph
0036  * and character style. It will highlight the character style.
0037  *
0038  * The following options are required to be set before it works:
0039  * <ul>
0040  *      <li><strong>characterStyle</strong>: Int. Default undefined. The ID of a
0041  *              character style to search for.</li>
0042  *      <li><strong>paragraphStyle</strong>: Int. Default undefined. The ID of a
0043  *              paragraph style to search for.</li>
0044  * </ul>
0045  *
0046  * \note Before you can use this class, be sure to set a list of QTextDocuments
0047  * using setDocuments().
0048  *
0049  * Matches created by this implementation use QTextDocument for the container and
0050  * QTextCursor for the location.
0051  */
0052 class KOMAIN_EXPORT KoFindStyle : public KoFindBase
0053 {
0054 public:
0055     /**
0056      * Constructor.
0057      */
0058     explicit KoFindStyle(QObject* parent = 0);
0059     /**
0060      * Destructor.
0061      */
0062     ~KoFindStyle() override;
0063 
0064     /**
0065      * Return the list of documents currently being used for searching.
0066      */
0067     QList<QTextDocument*> documents() const;
0068     /**
0069      * Set the list of documents to use for searching.
0070      *
0071      * \param list A list of document to search through.
0072      */
0073     void setDocuments(const QList<QTextDocument*> &list);
0074 
0075     /**
0076      * Reimplemented from KoFindBase::clearMatches()
0077      */
0078     void clearMatches() override;
0079 
0080 protected:
0081     /**
0082      * Reimplemented from KoFindBase::replaceImplementation().
0083      *
0084      * \note Replace is currently not supported in this class.
0085      */
0086     void replaceImplementation(const KoFindMatch& match, const QVariant& value) override;
0087     /**
0088      * Reimplemented from KoFindBase::findImplementation()
0089      */
0090     void findImplementation(const QString& pattern, KoFindBase::KoFindMatchList& matchList) override;
0091 
0092 private:
0093     class Private;
0094     Private * const d;
0095 };
0096 
0097 #endif // KOFINDSTYLE_H