File indexing completed on 2024-05-12 16:37:12
0001 /* This file is part of the Calligra project 0002 * Copyright (C) 2008, 2010 Thomas Zander <zander@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 KWPageManagerPrivate_H 0020 #define KWPageManagerPrivate_H 0021 0022 #include "KWPageStyle.h" 0023 #include "KWPage.h" 0024 0025 #include <QHash> 0026 #include <QMap> 0027 0028 class KWPageManagerPrivate 0029 { 0030 public: 0031 struct Page 0032 { 0033 Page() 0034 : pageSide(KWPage::Right), 0035 orientation(KoPageFormat::Portrait), 0036 textDirection(KoText::InheritDirection), 0037 pageNumber(1), 0038 autoGenerated(0) 0039 { 0040 } 0041 KWPageStyle style; 0042 KWPage::PageSide pageSide; 0043 KoPageFormat::Orientation orientation; 0044 KoText::Direction textDirection; 0045 uint pageNumber : 20; // set by the append-page and overwritten by the text-layout 0046 uint autoGenerated : 1; // bool to signify words having generated it 0047 uint padding : 11; 0048 QRectF contentRect; 0049 }; 0050 0051 KWPageManagerPrivate(); 0052 0053 void setPageOffset(int pageNum, qreal offset); 0054 qreal pageOffset(int pageNum) const; 0055 0056 void setVisiblePageNumber(int pageId, int newPageNumber); 0057 0058 void insertPage(const Page &page); 0059 0060 // use a sorted map to find page the identifier for page objects based on the page number. 0061 QMap<int, int> pageNumbers; // page number to pageId 0062 0063 // use a fast access hash to store the page objects, sorted by their identifier 0064 QHash<int, Page> pages; // pageId to page struct 0065 0066 QMap<int, int> visiblePageNumbers; 0067 0068 int lastId; // pageIds are distributed serially, 0069 0070 QHash<QString, KWPageStyle> pageStyles; 0071 QHash<QString, QString> pageStyleNames; // map display-name to name 0072 KoInsets padding; 0073 KWPageStyle defaultPageStyle; 0074 QHash<int, qreal> pageOffsets; 0075 QHash<int, qreal> pageHeights; 0076 }; 0077 0078 #endif