File indexing completed on 2024-05-12 16:37:15
0001 /* This file is part of the KDE project 0002 * Copyright (C) 2008 Thomas Zander <zander@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 "Words.h" 0021 #include "frames/KWTextFrameSet.h" 0022 0023 #include <klocalizedstring.h> 0024 0025 namespace Words 0026 { 0027 0028 bool isAutoGenerated(KWFrameSet *fs) 0029 { 0030 Q_ASSERT(fs); 0031 if (fs->type() == BackgroundFrameSet) 0032 return true; 0033 if (fs->type() == TextFrameSet) { 0034 KWTextFrameSet *tfs = static_cast<KWTextFrameSet*>(fs); 0035 return tfs 0036 && (tfs->textFrameSetType() == Words::OddPagesHeaderTextFrameSet 0037 || tfs->textFrameSetType() == Words::EvenPagesHeaderTextFrameSet 0038 || tfs->textFrameSetType() == Words::OddPagesFooterTextFrameSet 0039 || tfs->textFrameSetType() == Words::EvenPagesFooterTextFrameSet 0040 || tfs->textFrameSetType() == Words::MainTextFrameSet); 0041 } 0042 return false; 0043 } 0044 0045 bool isHeaderFooter(KWTextFrameSet *tfs) 0046 { 0047 return tfs 0048 && (tfs->textFrameSetType() == Words::OddPagesHeaderTextFrameSet 0049 || tfs->textFrameSetType() == Words::EvenPagesHeaderTextFrameSet 0050 || tfs->textFrameSetType() == Words::OddPagesFooterTextFrameSet 0051 || tfs->textFrameSetType() == Words::EvenPagesFooterTextFrameSet); 0052 } 0053 0054 QString frameSetTypeName(TextFrameSetType type) 0055 { 0056 switch (type) { 0057 case Words::OddPagesHeaderTextFrameSet: 0058 return i18n("Odd Pages Header"); 0059 case Words::EvenPagesHeaderTextFrameSet: 0060 return i18n("Even Pages Header"); 0061 case Words::OddPagesFooterTextFrameSet: 0062 return i18n("Odd Pages Footer"); 0063 case Words::EvenPagesFooterTextFrameSet: 0064 return i18n("Even Pages Footer"); 0065 case Words::MainTextFrameSet: 0066 return i18n("Main text"); 0067 case Words::OtherTextFrameSet: 0068 return i18n("Other text"); 0069 } 0070 return QString(); 0071 } 0072 0073 QString frameSetTypeName(KWFrameSet* frameset) 0074 { 0075 if (KWTextFrameSet* tfs = dynamic_cast<KWTextFrameSet*>(frameset)) 0076 return frameSetTypeName(tfs->textFrameSetType()); 0077 return QString(); 0078 } 0079 0080 }