00001 /* -*- mode: C++; tab-width: 4; c-basic-offset: 4; indents-tab-mode:t; -*- */ 00002 /* AbiWord 00003 * Copyright (C) 1998,1999 AbiSource, Inc. 00004 * BIDI Copyright (c) 2001,2002 Tomas Frydrych 00005 * Copeyright (C) 2017 Hubert Figuière 00006 * 00007 * This program is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU General Public License 00009 * as published by the Free Software Foundation; either version 2 00010 * of the License, or (at your option) any later version. 00011 * 00012 * This program is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with this program; if not, write to the Free Software 00019 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00020 * 02110-1301 USA. 00021 */ 00022 00023 #pragma once 00024 00025 #include <memory> 00026 #include <string> 00027 00028 #include "ut_types.h" 00029 00030 /* 00031 This class is used to represent a part of the block. Pointers 00032 to this class are the things contained in m_vecSquiggles and in 00033 FL_DocLayout::m_pPendingWordForSpell 00034 */ 00035 class ABI_EXPORT fl_PartOfBlock 00036 { 00037 public: 00038 fl_PartOfBlock(); 00039 fl_PartOfBlock(UT_sint32 iOffset, UT_sint32 iPTLength, 00040 bool bIsIgnored = false); 00041 00042 bool doesTouch(UT_sint32 iOffset, UT_sint32 iLength) const; 00043 inline UT_sint32 getOffset(void) const { return m_iOffset; } 00044 inline UT_sint32 getPTLength(void)const{ return m_iPTLength; } 00045 inline bool getIsIgnored(void) const { return m_bIsIgnored; } 00046 00047 inline void setOffset(UT_sint32 iOffset) { m_iOffset = iOffset; } 00048 inline void setPTLength(UT_sint32 iLength) { m_iPTLength = iLength; } 00049 inline void setIsIgnored(bool bIsIgnored) { m_bIsIgnored = bIsIgnored; } 00050 void setInvisible(void) 00051 {m_bIsInvisible = true;} 00052 bool isInvisible(void) const 00053 { return m_bIsInvisible;} 00054 void setGrammarMessage(const std::string & sMsg); 00055 const std::string& getGrammarMessage() const; 00056 00057 private: 00058 UT_sint32 m_iOffset; 00059 UT_sint32 m_iPTLength; 00060 00061 bool m_bIsIgnored; 00062 bool m_bIsInvisible; 00063 std::string m_sGrammarMessage; 00064 }; 00065 00066 // We'd rather have this be a unique_ptr<> but we the current code we can't 00067 typedef std::shared_ptr<fl_PartOfBlock> fl_PartOfBlockPtr;