Warning, file /office/calligra/libs/widgets/KoZoomController_p.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 C. Boemann <cbo@boemann.dk>
0003  * Copyright (C) 2007 Thomas Zander <zander@kde.org>
0004  * Copyright (C) 2007 Jan Hambrecht <jaham@gmx.net>
0005  * Copyright (C) 2010 Boudewijn Rempt <boud@kogmbh.com>
0006  * Copyright (C) 2011 Arjen Hiemstra <ahiemstra@heimr.nl>
0007  *
0008  * This library is free software; you can redistribute it and/or
0009  * modify it under the terms of the GNU Library General Public
0010  * License as published by the Free Software Foundation; either
0011  * version 2 of the License, or (at your option) any later version.
0012  *
0013  * This library is distributed in the hope that it will be useful,
0014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0016  * Library General Public License for more details.
0017  *
0018  * You should have received a copy of the GNU Library General Public License
0019  * along with this library; see the file COPYING.LIB.  If not, write to
0020  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0021  * Boston, MA 02110-1301, USA.
0022  */
0023 #ifndef KoZoomController_p_h
0024 #define KoZoomController_p_h
0025 
0026 #include <KoZoomController.h>
0027 
0028 #include <klocalizedstring.h>
0029 #include <WidgetsDebug.h>
0030 
0031 #include <KoZoomHandler.h>
0032 #include <KoCanvasBase.h>
0033 #include <KoCanvasController.h>
0034 
0035 class Q_DECL_HIDDEN KoZoomController::Private
0036 {
0037 public:
0038     Private(KoZoomController *p, KoZoomAction::SpecialButtons specialButtons)
0039         : canvasController(0), zoomHandler(0), action(0), textMinX(1), textMaxX(600), fitMargin(0), parent(p)
0040     {
0041         action = new KoZoomAction(KoZoomMode::ZOOM_WIDTH | KoZoomMode::ZOOM_PAGE, i18n("Zoom"), p);
0042         action->setSpecialButtons(specialButtons);
0043     }
0044     ~Private() = default;
0045 
0046     /// so we know when the canvasController changes size
0047     void setAvailableSize()
0048     {
0049         if(zoomHandler->zoomMode() == KoZoomMode::ZOOM_WIDTH)
0050             setZoom(KoZoomMode::ZOOM_WIDTH, -1);
0051         if(zoomHandler->zoomMode() == KoZoomMode::ZOOM_PAGE)
0052             setZoom(KoZoomMode::ZOOM_PAGE, -1);
0053         if(zoomHandler->zoomMode() == KoZoomMode::ZOOM_TEXT)
0054             setZoom(KoZoomMode::ZOOM_TEXT, -1);
0055     }
0056 
0057     /// when the canvas controller wants us to change zoom
0058     void requestZoomRelative(const qreal factor, const QPointF& stillPoint)
0059     {
0060         parent->setZoom(KoZoomMode::ZOOM_CONSTANT, factor * zoomHandler->zoom(), stillPoint);
0061     }
0062 
0063     void setZoom(KoZoomMode::Mode mode, qreal zoom)
0064     {
0065         parent->setZoom(mode, zoom);
0066     }
0067 
0068     void init(KoCanvasController *co,
0069               KoZoomHandler *zh,
0070               KActionCollection *actionCollection,
0071               bool createZoomShortcuts);
0072 
0073     KoCanvasController *canvasController;
0074     KoZoomHandler *zoomHandler;
0075     KoZoomAction *action;
0076     QSizeF pageSize;
0077     qreal textMinX;
0078     qreal textMaxX;
0079     QSizeF documentSize;
0080     int fitMargin;
0081     KoZoomController *parent;
0082 };
0083 
0084 #endif