kword
KWCollectFramesetsVisitor.cpp
00001 /* This file is part of the KDE project 00002 Copyright (C) 2004-2005 David Faure <faure@kde.org> 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License as published by the Free Software Foundation; either 00007 version 2 of the License, or (at your option) any later version. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public License 00015 along with this library; see the file COPYING.LIB. If not, write to 00016 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00017 * Boston, MA 02110-1301, USA. 00018 */ 00019 00020 #include <KoTextParag.h> 00021 #include "KWCollectFramesetsVisitor.h" 00022 #include "KWAnchor.h" 00023 00024 bool KWCollectFramesetsVisitor::visit( KoTextParag *parag, int start, int end ) 00025 { 00026 KoTextString* str = parag->string(); 00027 for ( int i = start ; i < end ; ++i ) 00028 { 00029 const KoTextStringChar& ch = str->at( i ); 00030 if ( ch.isCustom() ) 00031 { 00032 KoTextCustomItem *customitem = ch.customItem(); 00033 KWAnchor *anchor = dynamic_cast<KWAnchor *>(customitem); 00034 if (anchor) 00035 { 00036 m_framesets.append(anchor->frameSet()); 00037 } 00038 } 00039 } 00040 return true; //always return true, i.e. keep going 00041 }