Warning, file /office/calligra/libs/pageapp/KoPAViewMode.cpp 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 #include "KoPAViewMode.h" 0021 0022 #include "KoPACanvasBase.h" 0023 #include "KoPAViewBase.h" 0024 #include "KoPAPageBase.h" 0025 #include <KoCanvasController.h> 0026 0027 #include <QCloseEvent> 0028 0029 KoPAViewMode::KoPAViewMode( KoPAViewBase * view, KoPACanvasBase * canvas, const QString &name) 0030 : m_canvas( canvas ) 0031 , m_toolProxy( canvas->toolProxy() ) 0032 , m_view( view ) 0033 , m_name(name) 0034 { 0035 } 0036 0037 KoPAViewMode::~KoPAViewMode() 0038 { 0039 } 0040 0041 void KoPAViewMode::closeEvent( QCloseEvent * event ) 0042 { 0043 event->ignore(); 0044 } 0045 0046 void KoPAViewMode::setMasterMode( bool master ) 0047 { 0048 Q_UNUSED(master); 0049 } 0050 0051 bool KoPAViewMode::masterMode() 0052 { 0053 return false; 0054 } 0055 0056 void KoPAViewMode::activate( KoPAViewMode * previousViewMode ) 0057 { 0058 Q_UNUSED( previousViewMode ); 0059 m_canvas->updateSize(); 0060 updateActivePage( m_view->activePage() ); 0061 // this is done to set the preferred center 0062 m_canvas->canvasController()->setCanvasMode( KoCanvasController::Centered ); 0063 m_canvas->canvasController()->recenterPreferred(); 0064 } 0065 0066 void KoPAViewMode::deactivate() 0067 { 0068 } 0069 0070 KoPACanvasBase * KoPAViewMode::canvas() const 0071 { 0072 return m_canvas; 0073 } 0074 0075 KoPAViewBase * KoPAViewMode::view() const 0076 { 0077 return m_view; 0078 } 0079 0080 KoViewConverter * KoPAViewMode::viewConverter( KoPACanvasBase * canvas ) 0081 { 0082 return m_view->KoPAViewBase::viewConverter( canvas ); 0083 } 0084 0085 void KoPAViewMode::updateActivePage( KoPAPageBase *page ) 0086 { 0087 m_view->doUpdateActivePage( page ); 0088 } 0089 0090 void KoPAViewMode::addShape( KoShape *shape ) 0091 { 0092 Q_UNUSED( shape ); 0093 } 0094 0095 void KoPAViewMode::removeShape( KoShape *shape ) 0096 { 0097 Q_UNUSED( shape ); 0098 } 0099 0100 const KoPageLayout &KoPAViewMode::activePageLayout() const 0101 { 0102 return m_view->activePage()->pageLayout(); 0103 } 0104 0105 void KoPAViewMode::changePageLayout( const KoPageLayout &/*pageLayout*/, bool /*applyToDocument*/, KUndo2Command */*parent*/ ) 0106 { 0107 } 0108 0109 QPointF KoPAViewMode::origin() 0110 { 0111 return m_origin; 0112 } 0113 0114 void KoPAViewMode::setOrigin(const QPointF &o) 0115 { 0116 m_origin = o; 0117 } 0118 0119 void KoPAViewMode::setName(const QString &name) 0120 { 0121 m_name = name; 0122 } 0123 0124 QString KoPAViewMode::name() const 0125 { 0126 return m_name; 0127 }