File indexing completed on 2024-05-26 16:15:07
0001 /* This file is part of the KDE project 0002 * Copyright ( C ) 2010 Boudewijn Rempt <boud@valdyas.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 <KoPAViewBase.h> 0021 #include <KoZoomHandler.h> 0022 0023 class Q_DECL_HIDDEN KoPAViewBase::Private 0024 { 0025 public: 0026 0027 KoZoomHandler zoomHandler; 0028 KoPAViewMode * viewMode; 0029 }; 0030 0031 KoPAViewBase::KoPAViewBase() 0032 : d(new Private) 0033 { 0034 d->viewMode = 0; 0035 proxyObject = new KoPAViewProxyObject(this); 0036 } 0037 0038 KoPAViewBase::~KoPAViewBase() 0039 { 0040 delete d; 0041 delete proxyObject; 0042 } 0043 0044 KoViewConverter* KoPAViewBase::viewConverter( KoPACanvasBase * canvas ) 0045 { 0046 Q_UNUSED( canvas ); 0047 0048 return &d->zoomHandler; 0049 } 0050 0051 KoZoomHandler* KoPAViewBase::zoomHandler() 0052 { 0053 return &d->zoomHandler; 0054 } 0055 0056 KoViewConverter* KoPAViewBase::viewConverter() const 0057 { 0058 return &d->zoomHandler; 0059 } 0060 0061 KoZoomHandler* KoPAViewBase::zoomHandler() const 0062 { 0063 return &d->zoomHandler; 0064 } 0065 0066 void KoPAViewBase::setViewMode( KoPAViewMode* mode ) 0067 { 0068 Q_ASSERT( mode ); 0069 if ( !d->viewMode ) { 0070 d->viewMode = mode; 0071 } 0072 else if ( mode != d->viewMode ) { 0073 KoPAViewMode * previousViewMode = d->viewMode; 0074 d->viewMode->deactivate(); 0075 d->viewMode = mode; 0076 d->viewMode->activate( previousViewMode ); 0077 } 0078 } 0079 0080 KoPAViewMode* KoPAViewBase::viewMode() const 0081 { 0082 return d->viewMode; 0083 } 0084 0085 0086 KoPAViewProxyObject::KoPAViewProxyObject(KoPAViewBase *parent) 0087 { 0088 m_view = parent; 0089 }