Warning, file /office/calligra/braindump/src/ViewManager.cpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* 0002 * Copyright (c) 2009 Cyrille Berger <cberger@cberger.net> 0003 * 0004 * This library is free software; you can redistribute it and/or 0005 * modify it under the terms of the GNU Lesser General Public 0006 * License as published by the Free Software Foundation; 0007 * either version 2, or (at your option) any later version of the License. 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 * Lesser General Public License for more details. 0013 * 0014 * You should have received a copy of the GNU Lesser General Public License 0015 * along with this library; see the file COPYING. 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 "ViewManager.h" 0021 0022 #include <KoShapeManager.h> 0023 #include <KoShapeLayer.h> 0024 0025 #include "Canvas.h" 0026 #include "Section.h" 0027 #include "View.h" 0028 #include "SectionContainer.h" 0029 #include "RootSection.h" 0030 #include "Utils.h" 0031 0032 ViewManager::ViewManager(RootSection* _rootSection) : m_lastViewInFocus(0), m_rootSection(_rootSection) 0033 { 0034 } 0035 0036 void ViewManager::addShape(Section* section, KoShape* shape) 0037 { 0038 if(!shape) 0039 return; 0040 if(!section) { 0041 return; 0042 } 0043 foreach(View * view, m_views) { 0044 if(section == view->activeSection()) { 0045 view->canvas()->shapeManager()->addShape(shape); 0046 } 0047 } 0048 } 0049 0050 void ViewManager::removeShape(Section* section, KoShape* shape) 0051 { 0052 if(!shape) 0053 return; 0054 if(!section) { 0055 return; 0056 } 0057 foreach(View * view, m_views) { 0058 if(section == view->activeSection()) { 0059 view->canvas()->shapeManager()->remove(shape); 0060 } 0061 } 0062 } 0063 0064 void ViewManager::addView(View* view) 0065 { 0066 Q_ASSERT(!m_views.contains(view)); 0067 m_views.append(view); 0068 } 0069 void ViewManager::removeView(View* view) 0070 { 0071 Q_ASSERT(m_views.contains(view)); 0072 m_views.removeAll(view); 0073 } 0074 0075 void ViewManager::viewHasFocus(View* view) 0076 { 0077 m_lastViewInFocus = view; 0078 }