Author: spitz
Date: Tue Mar 15 11:46:14 2011
New Revision: 37932
URL: http://www.lyx.org/trac/changeset/37932
Log:
Do not hardcode specific insets, but use a variable instead.
Modified:
lyx-devel/trunk/src/Paragraph.cpp
lyx-devel/trunk/src/insets/Inset.h
lyx-devel/trunk/src/insets/InsetSpecialChar.cpp
lyx-devel/trunk/src/insets/InsetSpecialChar.h
Modified: lyx-devel/trunk/src/Paragraph.cpp
==============================================================================
--- lyx-devel/trunk/src/Paragraph.cpp Tue Mar 15 11:27:41 2011 (r37931)
+++ lyx-devel/trunk/src/Paragraph.cpp Tue Mar 15 11:46:14 2011 (r37932)
@@ -3346,10 +3346,7 @@
for (i = 0; i < strsize && pos < parsize; ++i, ++pos) {
// Ignore ligature break and hyphenation chars while searching
while (pos < parsize - 1 && isInset(pos)) {
- const InsetSpecialChar *isc = dynamic_cast<const
InsetSpecialChar*>(getInset(pos));
- if (isc == 0
- || (isc->kind() != InsetSpecialChar::HYPHENATION
- && isc->kind() !=
InsetSpecialChar::LIGATURE_BREAK))
+ if (!getInset(pos)->skipOnSearch())
break;
pos++;
}
Modified: lyx-devel/trunk/src/insets/Inset.h
==============================================================================
--- lyx-devel/trunk/src/insets/Inset.h Tue Mar 15 11:27:41 2011 (r37931)
+++ lyx-devel/trunk/src/insets/Inset.h Tue Mar 15 11:46:14 2011 (r37932)
@@ -402,6 +402,9 @@
/// Is the content of this inset part of the output document?
virtual bool producesOutput() const { return true; }
+ /// Skip this inset while searching?
+ virtual bool skipOnSearch() const { return false; }
+
/// \return Tool tip for this inset.
/// This default implementation returns an empty string.
virtual docstring toolTip(BufferView const & bv, int x, int y) const;
Modified: lyx-devel/trunk/src/insets/InsetSpecialChar.cpp
==============================================================================
--- lyx-devel/trunk/src/insets/InsetSpecialChar.cpp Tue Mar 15 11:27:41
2011 (r37931)
+++ lyx-devel/trunk/src/insets/InsetSpecialChar.cpp Tue Mar 15 11:46:14
2011 (r37932)
@@ -346,6 +346,12 @@
}
+bool InsetSpecialChar::skipOnSearch() const
+{
+ return kind_ == HYPHENATION || kind_ == LIGATURE_BREAK;
+}
+
+
bool InsetSpecialChar::isLineSeparator() const
{
#if 0
Modified: lyx-devel/trunk/src/insets/InsetSpecialChar.h
==============================================================================
--- lyx-devel/trunk/src/insets/InsetSpecialChar.h Tue Mar 15 11:27:41
2011 (r37931)
+++ lyx-devel/trunk/src/insets/InsetSpecialChar.h Tue Mar 15 11:46:14
2011 (r37932)
@@ -81,6 +81,8 @@
bool isChar() const { return true; }
/// is this equivalent to a letter?
bool isLetter() const;
+ /// Skip this inset while searching?
+ bool skipOnSearch() const;
// should we break lines after this inset?
bool isLineSeparator() const;
private: