Refactoring patches

Yuriy Skalko yuriy.skalko at gmail.com
Mon Oct 19 21:52:11 UTC 2020


The last pass with the assistance from iwyu tool.

Yuriy
-------------- next part --------------
From d115ee3dc78c2d72aa081266654dd15b0f5402dc Mon Sep 17 00:00:00 2001
From: Yuriy Skalko <yuriy.skalko at gmail.com>
Date: Tue, 20 Oct 2020 00:42:39 +0300
Subject: [PATCH] Clean includes using the output of iwyu tool

---
 src/Author.h                |  2 +-
 src/BiblioInfo.cpp          |  3 ---
 src/BiblioInfo.h            |  2 +-
 src/Buffer.cpp              |  6 ------
 src/Buffer.h                |  5 +----
 src/BufferEncodings.h       |  4 ++--
 src/BufferList.cpp          |  6 ------
 src/BufferList.h            |  2 +-
 src/BufferParams.cpp        |  3 ---
 src/BufferView.cpp          | 20 +++-----------------
 src/Bullet.cpp              |  1 +
 src/Bullet.h                |  2 +-
 src/Changes.cpp             |  1 -
 src/Compare.cpp             |  1 -
 src/Converter.cpp           |  1 -
 src/Converter.h             |  2 +-
 src/CoordCache.cpp          |  4 ----
 src/Counters.cpp            |  1 +
 src/Counters.h              |  2 +-
 src/Cursor.cpp              |  6 ------
 src/CursorSlice.cpp         |  4 ++--
 src/CutAndPaste.cpp         |  5 -----
 src/CutAndPaste.h           |  2 +-
 src/DepTable.cpp            |  1 -
 src/Encoding.cpp            |  1 +
 src/Encoding.h              |  3 +--
 src/ErrorList.h             |  3 +--
 src/FontList.cpp            |  2 --
 src/Format.h                |  5 ++---
 src/FuncRequest.cpp         |  1 +
 src/FuncRequest.h           |  2 +-
 src/FuncStatus.h            |  2 +-
 src/Graph.cpp               |  2 --
 src/HunspellChecker.cpp     |  4 ----
 src/LaTeX.cpp               |  1 +
 src/LaTeX.h                 |  2 +-
 src/LaTeXFeatures.cpp       |  4 +---
 src/LaTeXFeatures.h         |  2 +-
 src/Language.cpp            |  1 +
 src/Language.h              |  3 +--
 src/LayoutFile.cpp          |  7 -------
 src/Lexer.cpp               |  1 -
 src/Lexer.h                 |  2 --
 src/LyX.cpp                 |  3 ---
 src/LyXRC.cpp               |  5 -----
 src/MetricsInfo.cpp         |  4 ----
 src/PDFOptions.cpp          |  3 +++
 src/PDFOptions.h            |  6 ++----
 src/ParIterator.cpp         |  2 +-
 src/ParIterator.h           |  1 +
 src/Paragraph.cpp           |  4 ++--
 src/Paragraph.h             |  1 -
 src/ParagraphMetrics.cpp    | 24 ++++--------------------
 src/ParagraphParameters.cpp |  5 ++---
 src/ParagraphParameters.h   |  6 +-----
 src/PersonalWordList.cpp    |  3 ---
 src/Row.cpp                 |  2 +-
 src/RowPainter.h            |  2 --
 src/ServerSocket.cpp        |  1 -
 src/TexRow.h                |  3 +--
 src/Text.cpp                | 17 +++++------------
 src/Text.h                  |  7 +++----
 src/Text2.cpp               | 14 +-------------
 src/Text3.cpp               | 10 ++--------
 src/TextClass.cpp           |  5 +----
 src/TextMetrics.cpp         |  4 +---
 src/TextMetrics.h           |  1 -
 src/Thesaurus.cpp           |  4 +---
 src/Thesaurus.h             |  5 +++--
 src/TocBuilder.cpp          |  1 +
 src/TocBuilder.h            |  2 +-
 src/Trans.cpp               |  4 ----
 src/Undo.cpp                |  3 ---
 src/Undo.h                  |  3 ---
 src/VCBackend.cpp           |  1 -
 src/VSpace.cpp              |  1 -
 src/factory.cpp             |  6 +-----
 src/insets/InsetText.cpp    |  2 ++
 src/lyxfind.cpp             |  3 ---
 src/lyxfind.h               |  4 ----
 src/output_xhtml.cpp        |  5 -----
 81 files changed, 71 insertions(+), 240 deletions(-)

diff --git a/src/Author.h b/src/Author.h
index 798cfd8043..aa48b5dd24 100644
--- a/src/Author.h
+++ b/src/Author.h
@@ -12,7 +12,7 @@
 #ifndef AUTHOR_H
 #define AUTHOR_H
 
-#include "support/docstring.h"
+#include "support/strfwd.h"
 
 #include <vector>
 
diff --git a/src/BiblioInfo.cpp b/src/BiblioInfo.cpp
index 486bd5c1e5..cefee85ba9 100644
--- a/src/BiblioInfo.cpp
+++ b/src/BiblioInfo.cpp
@@ -17,13 +17,10 @@
 #include "BiblioInfo.h"
 #include "Buffer.h"
 #include "BufferParams.h"
-#include "buffer_funcs.h"
 #include "Citation.h"
 #include "Encoding.h"
-#include "InsetIterator.h"
 #include "Language.h"
 #include "xml.h"
-#include "Paragraph.h"
 #include "TextClass.h"
 #include "TocBackend.h"
 
diff --git a/src/BiblioInfo.h b/src/BiblioInfo.h
index ca5cdad366..008c7c753e 100644
--- a/src/BiblioInfo.h
+++ b/src/BiblioInfo.h
@@ -15,7 +15,7 @@
 #ifndef BIBLIOINFO_H
 #define BIBLIOINFO_H
 
-#include "support/docstring.h"
+#include "support/strfwd.h"
 
 #include <map>
 #include <set>
diff --git a/src/Buffer.cpp b/src/Buffer.cpp
index 1ccb263014..2e70c8b4df 100644
--- a/src/Buffer.cpp
+++ b/src/Buffer.cpp
@@ -14,7 +14,6 @@
 #include "Buffer.h"
 
 #include "Author.h"
-#include "LayoutFile.h"
 #include "BiblioInfo.h"
 #include "BranchList.h"
 #include "buffer_funcs.h"
@@ -67,9 +66,7 @@
 #include "VCBackend.h"
 #include "version.h"
 #include "WordLangTuple.h"
-#include "WordList.h"
 
-#include "insets/InsetBibtex.h"
 #include "insets/InsetBranch.h"
 #include "insets/InsetInclude.h"
 #include "insets/InsetTabular.h"
@@ -80,7 +77,6 @@
 #include "mathed/InsetMathMacroTemplate.h"
 #include "mathed/MathSupport.h"
 
-#include "graphics/GraphicsCache.h"
 #include "graphics/PreviewLoader.h"
 
 #include "frontends/Application.h"
@@ -97,11 +93,9 @@
 #include "support/FileName.h"
 #include "support/FileNameList.h"
 #include "support/filetools.h"
-#include "support/ForkedCalls.h"
 #include "support/gettext.h"
 #include "support/gzstream.h"
 #include "support/lstrings.h"
-#include "support/lyxalgo.h"
 #include "support/mutex.h"
 #include "support/os.h"
 #include "support/Package.h"
diff --git a/src/Buffer.h b/src/Buffer.h
index 2d96ff938e..7d1b5eca97 100644
--- a/src/Buffer.h
+++ b/src/Buffer.h
@@ -13,6 +13,7 @@
 #define BUFFER_H
 
 #include "OutputEnums.h"
+#include "ParIterator.h"
 
 #include "support/unique_ptr.h"
 #include "support/strfwd.h"
@@ -48,8 +49,6 @@ class MacroNameSet;
 class MacroSet;
 class OutputParams;
 class otexstream;
-class ParConstIterator;
-class ParIterator;
 class ParagraphList;
 class TeXErrors;
 class TexRow;
@@ -93,8 +92,6 @@ typedef std::shared_ptr<CloneList> CloneList_ptr;
  * \author Lars Gullik Bjønnes
  */
 
-class MarkAsExporting;
-
 class Buffer {
 public:
 	/// What type of log will \c getLogName() return?
diff --git a/src/BufferEncodings.h b/src/BufferEncodings.h
index 89275b32e7..d5a9081f09 100644
--- a/src/BufferEncodings.h
+++ b/src/BufferEncodings.h
@@ -15,8 +15,8 @@
 #define BUFFER_ENCODINGS_H
 
 #include "Encoding.h"
-#include "support/docstring.h"
-#include "support/types.h"
+
+#include "support/strfwd.h"
 
 namespace lyx {
 
diff --git a/src/BufferList.cpp b/src/BufferList.cpp
index b99f4592cc..0cfbec135d 100644
--- a/src/BufferList.cpp
+++ b/src/BufferList.cpp
@@ -15,10 +15,6 @@
 #include "Author.h"
 #include "Buffer.h"
 #include "BufferParams.h"
-#include "Session.h"
-#include "LyX.h"
-#include "output_latex.h"
-#include "ParagraphList.h"
 
 #include "frontends/alert.h"
 
@@ -27,9 +23,7 @@
 #include "support/FileName.h"
 #include "support/FileNameList.h"
 #include "support/filetools.h"
-#include "support/gettext.h"
 #include "support/lstrings.h"
-#include "support/Package.h"
 
 #include "support/lassert.h"
 
diff --git a/src/BufferList.h b/src/BufferList.h
index 053169af61..ff5156657b 100644
--- a/src/BufferList.h
+++ b/src/BufferList.h
@@ -12,7 +12,7 @@
 #ifndef BUFFER_LIST_H
 #define BUFFER_LIST_H
 
-#include "support/docstring.h"
+#include "support/strfwd.h"
 
 #include <vector>
 
diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp
index 8d0d7d13d4..9d45d80d10 100644
--- a/src/BufferParams.cpp
+++ b/src/BufferParams.cpp
@@ -21,7 +21,6 @@
 #include "LayoutFile.h"
 #include "BranchList.h"
 #include "Buffer.h"
-#include "buffer_funcs.h"
 #include "Bullet.h"
 #include "CiteEnginesList.h"
 #include "Color.h"
@@ -33,7 +32,6 @@
 #include "Language.h"
 #include "LaTeXFeatures.h"
 #include "LaTeXFonts.h"
-#include "ModuleList.h"
 #include "Font.h"
 #include "Lexer.h"
 #include "LyXRC.h"
@@ -50,7 +48,6 @@
 
 #include "support/convert.h"
 #include "support/debug.h"
-#include "support/docstream.h"
 #include "support/FileName.h"
 #include "support/filetools.h"
 #include "support/gettext.h"
diff --git a/src/BufferView.cpp b/src/BufferView.cpp
index 88fe8fa023..fbfe41c6db 100644
--- a/src/BufferView.cpp
+++ b/src/BufferView.cpp
@@ -18,7 +18,6 @@
 
 #include "BranchList.h"
 #include "Buffer.h"
-#include "buffer_funcs.h"
 #include "BufferList.h"
 #include "BufferParams.h"
 #include "CoordCache.h"
@@ -26,48 +25,34 @@
 #include "CutAndPaste.h"
 #include "DispatchResult.h"
 #include "ErrorList.h"
-#include "factory.h"
-#include "FloatList.h"
 #include "FuncRequest.h"
 #include "FuncStatus.h"
 #include "Intl.h"
-#include "InsetIterator.h"
 #include "Language.h"
-#include "LaTeXFeatures.h"
 #include "LayoutFile.h"
 #include "Lexer.h"
 #include "LyX.h"
 #include "LyXAction.h"
 #include "lyxfind.h"
-#include "Layout.h"
 #include "LyXRC.h"
 #include "MetricsInfo.h"
 #include "Paragraph.h"
-#include "ParagraphParameters.h"
-#include "ParIterator.h"
-#include "RowPainter.h"
 #include "Session.h"
 #include "Text.h"
-#include "TextClass.h"
 #include "TextMetrics.h"
 #include "TexRow.h"
 #include "TocBackend.h"
-#include "WordLangTuple.h"
 
 #include "insets/InsetBibtex.h"
 #include "insets/InsetCitation.h"
 #include "insets/InsetCommand.h" // ChangeRefs
-#include "insets/InsetExternal.h"
 #include "insets/InsetGraphics.h"
-#include "insets/InsetNote.h"
 #include "insets/InsetRef.h"
 #include "insets/InsetText.h"
 
 #include "mathed/MathData.h"
-#include "mathed/InsetMathNest.h"
 
 #include "frontends/alert.h"
-#include "frontends/Application.h"
 #include "frontends/Delegates.h"
 #include "frontends/FontMetrics.h"
 #include "frontends/NullPainter.h"
@@ -76,17 +61,18 @@
 
 #include "support/convert.h"
 #include "support/debug.h"
-#include "support/ExceptionMessage.h"
+#include "support/docstring.h"
 #include "support/filetools.h"
 #include "support/gettext.h"
 #include "support/lassert.h"
 #include "support/Length.h"
 #include "support/lstrings.h"
 #include "support/lyxlib.h"
-#include "support/Package.h"
 #include "support/types.h"
 
+#include <algorithm>
 #include <cerrno>
+#include <cstring>
 #include <fstream>
 #include <functional>
 #include <iterator>
diff --git a/src/Bullet.cpp b/src/Bullet.cpp
index 1f4ef6af95..b3bf8e57cb 100644
--- a/src/Bullet.cpp
+++ b/src/Bullet.cpp
@@ -18,6 +18,7 @@
 
 #include "Bullet.h"
 
+#include "support/docstring.h"
 #include "support/lassert.h"
 
 using namespace std;
diff --git a/src/Bullet.h b/src/Bullet.h
index 6a4f997acb..8a6da2ac34 100644
--- a/src/Bullet.h
+++ b/src/Bullet.h
@@ -13,7 +13,7 @@
 #ifndef BULLET_H
 #define BULLET_H
 
-#include "support/docstring.h"
+#include "support/strfwd.h"
 
 
 namespace lyx {
diff --git a/src/Changes.cpp b/src/Changes.cpp
index 63bb021efe..7e97a24d10 100644
--- a/src/Changes.cpp
+++ b/src/Changes.cpp
@@ -18,7 +18,6 @@
 #include "Buffer.h"
 #include "BufferParams.h"
 #include "Encoding.h"
-#include "LaTeXFeatures.h"
 #include "LyXRC.h"
 #include "MetricsInfo.h"
 #include "OutputParams.h"
diff --git a/src/Compare.cpp b/src/Compare.cpp
index 490a2ec0bd..49bdac1bfa 100644
--- a/src/Compare.cpp
+++ b/src/Compare.cpp
@@ -24,7 +24,6 @@
 
 #include "support/docstream.h"
 #include "support/lassert.h"
-#include "support/lyxalgo.h"
 #include "support/qstring_helpers.h"
 
 using namespace std;
diff --git a/src/Converter.cpp b/src/Converter.cpp
index 59604d3127..ada329e5d9 100644
--- a/src/Converter.cpp
+++ b/src/Converter.cpp
@@ -13,7 +13,6 @@
 #include "Converter.h"
 
 #include "Buffer.h"
-#include "buffer_funcs.h"
 #include "BufferParams.h"
 #include "ConverterCache.h"
 #include "Encoding.h"
diff --git a/src/Converter.h b/src/Converter.h
index e9efa00f4f..914b8167dd 100644
--- a/src/Converter.h
+++ b/src/Converter.h
@@ -14,7 +14,7 @@
 
 #include "Graph.h"
 #include "OutputParams.h"
-#include "support/trivstring.h"
+#include "support/strfwd.h"
 
 #include <vector>
 #include <set>
diff --git a/src/CoordCache.cpp b/src/CoordCache.cpp
index 51f1c5e79a..2a81328185 100644
--- a/src/CoordCache.cpp
+++ b/src/CoordCache.cpp
@@ -11,12 +11,8 @@
 
 #include "CoordCache.h"
 
-#include "Text.h"
 
 #include "support/debug.h"
-#include "support/docstring.h"
-
-#include "insets/Inset.h"
 
 #include "support/lassert.h"
 
diff --git a/src/Counters.cpp b/src/Counters.cpp
index 32968fca66..9d7cc23d6d 100644
--- a/src/Counters.cpp
+++ b/src/Counters.cpp
@@ -20,6 +20,7 @@
 #include "support/convert.h"
 #include "support/counter_reps.h"
 #include "support/debug.h"
+#include "support/docstring.h"
 #include "support/gettext.h"
 #include "support/lassert.h"
 #include "support/lstrings.h"
diff --git a/src/Counters.h b/src/Counters.h
index 959a2f4133..e411bbb26c 100644
--- a/src/Counters.h
+++ b/src/Counters.h
@@ -17,7 +17,7 @@
 
 #include "OutputEnums.h"
 
-#include "support/docstring.h"
+#include "support/strfwd.h"
 
 #include <map>
 #include <vector>
diff --git a/src/Cursor.cpp b/src/Cursor.cpp
index 0d68c86807..7197b91cf2 100644
--- a/src/Cursor.cpp
+++ b/src/Cursor.cpp
@@ -27,7 +27,6 @@
 #include "LyXAction.h"
 #include "LyXRC.h"
 #include "Paragraph.h"
-#include "ParIterator.h"
 #include "Row.h"
 #include "texstream.h"
 #include "Text.h"
@@ -36,12 +35,10 @@
 
 #include "support/debug.h"
 #include "support/docstream.h"
-#include "support/ExceptionMessage.h"
 #include "support/gettext.h"
 #include "support/lassert.h"
 
 #include "insets/InsetTabular.h"
-#include "insets/InsetText.h"
 
 #include "mathed/InsetMath.h"
 #include "mathed/InsetMathBrace.h"
@@ -1435,10 +1432,7 @@ bool Cursor::atFirstOrLastRow(bool up)
 ///////////////////////////////////////////////////////////////////
 
 #include "mathed/InsetMathChar.h"
-#include "mathed/InsetMathGrid.h"
-#include "mathed/InsetMathScript.h"
 #include "mathed/InsetMathUnknown.h"
-#include "mathed/MathFactory.h"
 #include "mathed/MathStream.h"
 #include "mathed/MathSupport.h"
 
diff --git a/src/CursorSlice.cpp b/src/CursorSlice.cpp
index 20a163449f..872a91110e 100644
--- a/src/CursorSlice.cpp
+++ b/src/CursorSlice.cpp
@@ -17,14 +17,14 @@
 
 #include "Text.h"
 #include "Paragraph.h"
+#include "ParagraphList.h"
 
 #include "support/debug.h"
 
 #include "mathed/InsetMath.h"
 #include "mathed/InsetMathMacro.h"
+#include "mathed/MathData.h"
 
-#include "support/ExceptionMessage.h"
-#include "support/gettext.h"
 #include "support/lassert.h"
 
 #include <ostream>
diff --git a/src/CutAndPaste.cpp b/src/CutAndPaste.cpp
index 772fa49b5e..ee3418dd65 100644
--- a/src/CutAndPaste.cpp
+++ b/src/CutAndPaste.cpp
@@ -18,7 +18,6 @@
 #include "Author.h"
 #include "BranchList.h"
 #include "Buffer.h"
-#include "buffer_funcs.h"
 #include "BufferList.h"
 #include "BufferParams.h"
 #include "BufferView.h"
@@ -29,7 +28,6 @@
 #include "FuncCode.h"
 #include "FuncRequest.h"
 #include "InsetIterator.h"
-#include "InsetList.h"
 #include "Language.h"
 #include "LyX.h"
 #include "LyXRC.h"
@@ -43,7 +41,6 @@
 #include "insets/InsetBranch.h"
 #include "insets/InsetCitation.h"
 #include "insets/InsetCommand.h"
-#include "insets/InsetFlex.h"
 #include "insets/InsetGraphics.h"
 #include "insets/InsetGraphicsParams.h"
 #include "insets/InsetInclude.h"
@@ -62,13 +59,11 @@
 #include "support/lassert.h"
 #include "support/limited_stack.h"
 #include "support/lstrings.h"
-#include "support/lyxalgo.h"
 #include "support/TempFile.h"
 #include "support/unique_ptr.h"
 
 #include "frontends/alert.h"
 #include "frontends/Clipboard.h"
-#include "frontends/Selection.h"
 
 #include <string>
 #include <tuple>
diff --git a/src/CutAndPaste.h b/src/CutAndPaste.h
index fe68be5e20..fcbac19a89 100644
--- a/src/CutAndPaste.h
+++ b/src/CutAndPaste.h
@@ -16,7 +16,7 @@
 
 #include "DocumentClassPtr.h"
 
-#include "support/docstring.h"
+#include "support/strfwd.h"
 
 #include "insets/Inset.h"
 
diff --git a/src/DepTable.cpp b/src/DepTable.cpp
index f8058fee30..8b15ec745d 100644
--- a/src/DepTable.cpp
+++ b/src/DepTable.cpp
@@ -16,7 +16,6 @@
 
 #include "support/debug.h"
 #include "support/FileName.h"
-#include "support/filetools.h"
 #include "support/lstrings.h"
 #include "support/lyxtime.h"
 
diff --git a/src/Encoding.cpp b/src/Encoding.cpp
index 4dcede47b5..c7ea237179 100644
--- a/src/Encoding.cpp
+++ b/src/Encoding.cpp
@@ -17,6 +17,7 @@
 #include "Lexer.h"
 
 #include "support/debug.h"
+#include "support/docstring.h"
 #include "support/gettext.h"
 #include "support/lstrings.h"
 #include "support/mutex.h"
diff --git a/src/Encoding.h b/src/Encoding.h
index 6a96843607..e35f0fdad8 100644
--- a/src/Encoding.h
+++ b/src/Encoding.h
@@ -13,8 +13,7 @@
 #ifndef ENCODING_H
 #define ENCODING_H
 
-#include "support/docstring.h"
-#include "support/trivstring.h"
+#include "support/strfwd.h"
 #include "support/types.h"
 
 #include <map>
diff --git a/src/ErrorList.h b/src/ErrorList.h
index 35294476dc..29cb03cfe6 100644
--- a/src/ErrorList.h
+++ b/src/ErrorList.h
@@ -14,8 +14,7 @@
 
 #include "TexRow.h"
 
-#include "support/docstring.h"
-#include "support/types.h"
+#include "support/strfwd.h"
 
 #include <vector>
 
diff --git a/src/FontList.cpp b/src/FontList.cpp
index c32666080d..67fb8354b0 100644
--- a/src/FontList.cpp
+++ b/src/FontList.cpp
@@ -20,8 +20,6 @@
 
 #include "FontList.h"
 
-#include "support/lyxalgo.h"
-
 using namespace std;
 
 namespace lyx {
diff --git a/src/Format.h b/src/Format.h
index 495d9b1c8b..44b3381441 100644
--- a/src/Format.h
+++ b/src/Format.h
@@ -12,11 +12,10 @@
 #ifndef FORMAT_H
 #define FORMAT_H
 
-#include "support/docstring.h"
-#include "support/trivstring.h"
-
 #include "OutputParams.h"
 
+#include "support/strfwd.h"
+
 #include <vector>
 
 namespace lyx {
diff --git a/src/FuncRequest.cpp b/src/FuncRequest.cpp
index 2049210529..de93a9f5f3 100644
--- a/src/FuncRequest.cpp
+++ b/src/FuncRequest.cpp
@@ -14,6 +14,7 @@
 #include "LyXAction.h"
 
 #include "support/debug.h"
+#include "support/docstring.h"
 #include "support/lstrings.h"
 
 #include <climits>
diff --git a/src/FuncRequest.h b/src/FuncRequest.h
index 42829ae8de..6dfde4bfd7 100644
--- a/src/FuncRequest.h
+++ b/src/FuncRequest.h
@@ -14,7 +14,7 @@
 
 #include "FuncCode.h"
 
-#include "support/docstring.h"
+#include "support/strfwd.h"
 
 #include "frontends/KeyModifier.h"
 #include "frontends/mouse_state.h"
diff --git a/src/FuncStatus.h b/src/FuncStatus.h
index 4a632dc870..aba6eb88a2 100644
--- a/src/FuncStatus.h
+++ b/src/FuncStatus.h
@@ -12,7 +12,7 @@
 #ifndef FUNC_STATUS_H
 #define FUNC_STATUS_H
 
-#include "support/docstring.h"
+#include "support/strfwd.h"
 
 
 namespace lyx {
diff --git a/src/Graph.cpp b/src/Graph.cpp
index 036bb38857..f78be287b2 100644
--- a/src/Graph.cpp
+++ b/src/Graph.cpp
@@ -17,8 +17,6 @@
 #include "support/debug.h"
 #include "support/lassert.h"
 
-#include <algorithm>
-
 using namespace std;
 
 namespace lyx {
diff --git a/src/HunspellChecker.cpp b/src/HunspellChecker.cpp
index 015973e1f4..a85365271a 100644
--- a/src/HunspellChecker.cpp
+++ b/src/HunspellChecker.cpp
@@ -16,17 +16,13 @@
 #include "LyXRC.h"
 #include "WordLangTuple.h"
 
-#include "frontends/alert.h"
-
 #include "support/debug.h"
 #include "support/docstring_list.h"
 #include "support/filetools.h"
 #include "support/Package.h"
 #include "support/FileName.h"
-#include "support/gettext.h"
 #include "support/lassert.h"
 #include "support/lstrings.h"
-#include "support/os.h"
 
 #include <hunspell/hunspell.hxx>
 
diff --git a/src/LaTeX.cpp b/src/LaTeX.cpp
index e88184bc90..b74b13254d 100644
--- a/src/LaTeX.cpp
+++ b/src/LaTeX.cpp
@@ -26,6 +26,7 @@
 #include "Language.h"
 
 #include "support/debug.h"
+#include "support/docstring.h"
 #include "support/convert.h"
 #include "support/FileName.h"
 #include "support/filetools.h"
diff --git a/src/LaTeX.h b/src/LaTeX.h
index b76ec1fd42..c57b03b830 100644
--- a/src/LaTeX.h
+++ b/src/LaTeX.h
@@ -16,7 +16,7 @@
 
 #include "OutputParams.h"
 
-#include "support/docstring.h"
+#include "support/strfwd.h"
 #include "support/FileName.h"
 #include "support/signals.h"
 
diff --git a/src/LaTeXFeatures.cpp b/src/LaTeXFeatures.cpp
index 616e24ab8c..347a3e0450 100644
--- a/src/LaTeXFeatures.cpp
+++ b/src/LaTeXFeatures.cpp
@@ -27,7 +27,6 @@
 #include "LaTeXFonts.h"
 #include "LaTeXPackages.h"
 #include "Layout.h"
-#include "Lexer.h"
 #include "LyXRC.h"
 #include "TextClass.h"
 #include "TexRow.h"
@@ -37,9 +36,8 @@
 
 #include "support/debug.h"
 #include "support/docstream.h"
-#include "support/FileName.h"
+#include "support/docstring.h"
 #include "support/filetools.h"
-#include "support/gettext.h"
 #include "support/lstrings.h"
 #include "support/regex.h"
 
diff --git a/src/LaTeXFeatures.h b/src/LaTeXFeatures.h
index af27b5c232..27edb1f6a8 100644
--- a/src/LaTeXFeatures.h
+++ b/src/LaTeXFeatures.h
@@ -14,7 +14,7 @@
 #define LATEXFEATURES_H
 
 #include "OutputParams.h"
-#include "support/docstring.h"
+#include "support/strfwd.h"
 
 #include <set>
 #include <list>
diff --git a/src/Language.cpp b/src/Language.cpp
index 03146c358a..9ad7a9c217 100644
--- a/src/Language.cpp
+++ b/src/Language.cpp
@@ -22,6 +22,7 @@
 #include "LyXRC.h"
 
 #include "support/debug.h"
+#include "support/docstring.h"
 #include "support/FileName.h"
 #include "support/filetools.h"
 #include "support/lassert.h"
diff --git a/src/Language.h b/src/Language.h
index ad8badffbc..0dba749d9b 100644
--- a/src/Language.h
+++ b/src/Language.h
@@ -15,8 +15,7 @@
 #ifndef LANGUAGE_H
 #define LANGUAGE_H
 
-#include "support/docstring.h"
-#include "support/trivstring.h"
+#include "support/strfwd.h"
 
 #include <map>
 #include <set>
diff --git a/src/LayoutFile.cpp b/src/LayoutFile.cpp
index 9c76e5bad0..1ce04aa685 100644
--- a/src/LayoutFile.cpp
+++ b/src/LayoutFile.cpp
@@ -12,20 +12,13 @@
 #include <config.h>
 
 #include "LayoutFile.h"
-#include "Counters.h"
-#include "Floating.h"
-#include "FloatList.h"
 #include "Lexer.h"
 #include "TextClass.h"
 
-#include "frontends/alert.h"
-
 #include "support/debug.h"
 #include "support/FileName.h"
 #include "support/filetools.h"
-#include "support/gettext.h"
 #include "support/lassert.h"
-#include "support/lstrings.h"
 
 #include "support/regex.h"
 #include "support/TempFile.h"
diff --git a/src/Lexer.cpp b/src/Lexer.cpp
index 2711db49e1..b11bf4743a 100644
--- a/src/Lexer.cpp
+++ b/src/Lexer.cpp
@@ -24,7 +24,6 @@
 #include "support/lassert.h"
 #include "support/lstrings.h"
 #include "support/lyxalgo.h"
-#include "support/types.h"
 
 #include <functional>
 #include <fstream>
diff --git a/src/Lexer.h b/src/Lexer.h
index 149cc7ddf2..9568b6e19d 100644
--- a/src/Lexer.h
+++ b/src/Lexer.h
@@ -24,8 +24,6 @@ namespace lyx {
 
 namespace support { class FileName; }
 
-class PushPopHelper;
-
 /** A helper structure to describe a keyword for the Lexer.
 	Usually used bundled in C style arrays and passed to the
 	Lexer using a LexerKeywordTable object.
diff --git a/src/LyX.cpp b/src/LyX.cpp
index 180c4d335b..c1369bcde7 100644
--- a/src/LyX.cpp
+++ b/src/LyX.cpp
@@ -38,7 +38,6 @@
 #include "Language.h"
 #include "LaTeXFonts.h"
 #include "LayoutFile.h"
-#include "Lexer.h"
 #include "LyX.h"
 #include "LyXAction.h"
 #include "LyXRC.h"
@@ -47,7 +46,6 @@
 #include "Server.h"
 #include "ServerSocket.h"
 #include "Session.h"
-#include "WordList.h"
 
 #include "frontends/alert.h"
 #include "frontends/Application.h"
@@ -66,7 +64,6 @@
 #include "support/Package.h"
 #include "support/unique_ptr.h"
 
-#include <algorithm>
 #include <csignal>
 #include <iostream>
 #include <functional>
diff --git a/src/LyXRC.cpp b/src/LyXRC.cpp
index 59bdc70a58..4fd5a287ca 100644
--- a/src/LyXRC.cpp
+++ b/src/LyXRC.cpp
@@ -28,23 +28,18 @@
 #include "Lexer.h"
 #include "LyX.h"
 #include "Mover.h"
-#include "Session.h"
 #include "SpellChecker.h"
 #include "version.h"
 
-#include "graphics/GraphicsTypes.h"
-
 #include "support/convert.h"
 #include "support/debug.h"
 #include "support/environment.h"
 #include "support/FileName.h"
 #include "support/filetools.h"
-#include "support/gettext.h"
 #include "support/lstrings.h"
 #include "support/os.h"
 #include "support/Package.h"
 #include "support/TempFile.h"
-#include "support/userinfo.h"
 
 #ifdef USE_MACOSX_PACKAGING
 #include "support/AppleSupport.h"
diff --git a/src/MetricsInfo.cpp b/src/MetricsInfo.cpp
index c4caa75644..15e772ea71 100644
--- a/src/MetricsInfo.cpp
+++ b/src/MetricsInfo.cpp
@@ -10,8 +10,6 @@
 
 #include <config.h>
 
-#include "BufferView.h"
-#include "ColorSet.h"
 #include "LyXRC.h"
 #include "MetricsInfo.h"
 
@@ -22,8 +20,6 @@
 #include "frontends/FontMetrics.h"
 #include "frontends/Painter.h"
 
-#include "support/docstring.h"
-#include "support/lassert.h"
 #include "support/RefChanger.h"
 
 using namespace std;
diff --git a/src/PDFOptions.cpp b/src/PDFOptions.cpp
index 1ec97fdbb5..a3dd1f34e5 100644
--- a/src/PDFOptions.cpp
+++ b/src/PDFOptions.cpp
@@ -15,10 +15,13 @@
 
 #include "Encoding.h"
 #include "Lexer.h"
+#include "OutputParams.h"
 #include "texstream.h"
 
 #include "support/convert.h"
 #include "support/debug.h"
+#include "support/docstream.h"
+#include "support/docstring.h"
 #include "support/lstrings.h"
 
 #include <sstream>
diff --git a/src/PDFOptions.h b/src/PDFOptions.h
index d74caf430e..4ab0d9e3ad 100644
--- a/src/PDFOptions.h
+++ b/src/PDFOptions.h
@@ -12,15 +12,13 @@
 #ifndef PDFOPTIONS_H
 #define PDFOPTIONS_H
 
-#include "OutputParams.h"
-
-#include "support/strfwd.h"
-
 #include <string>
 
 namespace lyx {
 
 class Lexer;
+class OutputParams;
+class otexstream;
 
 // FIXME UNICODE
 // Write functions need to use odostream instead of ostream before
diff --git a/src/ParIterator.cpp b/src/ParIterator.cpp
index 1ddf347986..0464839adb 100644
--- a/src/ParIterator.cpp
+++ b/src/ParIterator.cpp
@@ -12,7 +12,7 @@
 
 #include "ParIterator.h"
 
-#include "Paragraph.h"
+#include "CursorSlice.h"
 #include "Text.h"
 
 #include "insets/Inset.h"
diff --git a/src/ParIterator.h b/src/ParIterator.h
index a4e410b7e2..288b0353fe 100644
--- a/src/ParIterator.h
+++ b/src/ParIterator.h
@@ -21,6 +21,7 @@ namespace lyx {
 
 class Buffer;
 class Inset;
+class Paragraph;
 class ParagraphList;
 
 
diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp
index f3dc50feb6..98e051445e 100644
--- a/src/Paragraph.cpp
+++ b/src/Paragraph.cpp
@@ -20,12 +20,11 @@
 
 #include "Paragraph.h"
 
-#include "LayoutFile.h"
 #include "Buffer.h"
 #include "BufferParams.h"
+#include "BufferEncodings.h"
 #include "Changes.h"
 #include "Counters.h"
-#include "BufferEncodings.h"
 #include "InsetList.h"
 #include "Language.h"
 #include "LaTeXFeatures.h"
@@ -42,6 +41,7 @@
 #include "texstream.h"
 #include "TexRow.h"
 #include "Text.h"
+#include "TextClass.h"
 #include "WordLangTuple.h"
 #include "WordList.h"
 
diff --git a/src/Paragraph.h b/src/Paragraph.h
index 0752dfeb0a..4812684c3d 100644
--- a/src/Paragraph.h
+++ b/src/Paragraph.h
@@ -16,7 +16,6 @@
 #ifndef PARAGRAPH_H
 #define PARAGRAPH_H
 
-#include "FontEnums.h"
 #include "LayoutEnums.h"
 #include "SpellChecker.h"
 
diff --git a/src/ParagraphMetrics.cpp b/src/ParagraphMetrics.cpp
index 72b212b10c..86a3144a1b 100644
--- a/src/ParagraphMetrics.cpp
+++ b/src/ParagraphMetrics.cpp
@@ -22,34 +22,18 @@
 #include "Buffer.h"
 #include "BufferParams.h"
 #include "BufferView.h"
-#include "Counters.h"
-#include "Encoding.h"
-#include "Language.h"
-#include "LaTeXFeatures.h"
-#include "Layout.h"
 #include "Font.h"
-#include "LyXRC.h"
+#include "Layout.h"
+#include "LayoutEnums.h"
+#include "Paragraph.h"
 #include "Row.h"
-#include "OutputParams.h"
-#include "xml.h"
 #include "TextClass.h"
-#include "TexRow.h"
 
 #include "frontends/FontMetrics.h"
 
-#include "insets/InsetBibitem.h"
-#include "insets/InsetArgument.h"
-
 #include "support/lassert.h"
 #include "support/debug.h"
-#include "support/ExceptionMessage.h"
-#include "support/gettext.h"
-#include "support/lstrings.h"
-#include "support/textutils.h"
-
-#include <algorithm>
-#include <list>
-#include <stack>
+
 #include <sstream>
 
 using namespace std;
diff --git a/src/ParagraphParameters.cpp b/src/ParagraphParameters.cpp
index 90c8705e89..6ef9224f2d 100644
--- a/src/ParagraphParameters.cpp
+++ b/src/ParagraphParameters.cpp
@@ -16,13 +16,12 @@
 
 #include "ParagraphParameters.h"
 
-#include "Buffer.h"
-#include "support/gettext.h"
 #include "Layout.h"
 #include "Lexer.h"
-#include "Text.h"
 #include "Paragraph.h"
 
+#include "support/debug.h"
+#include "support/docstring.h"
 #include "support/lstrings.h"
 
 #include <sstream>
diff --git a/src/ParagraphParameters.h b/src/ParagraphParameters.h
index b4608e0b3b..36eec30c48 100644
--- a/src/ParagraphParameters.h
+++ b/src/ParagraphParameters.h
@@ -17,20 +17,16 @@
 #include "LayoutEnums.h"
 #include "Spacing.h"
 
-#include "support/debug.h"
 #include "support/types.h"
-#include "support/docstring.h"
+#include "support/strfwd.h"
 #include "support/Length.h"
 
 
 namespace lyx {
 
-class BufferView;
 class Layout;
-class Length;
 class Lexer;
 class Paragraph;
-class Spacing;
 
 
 ///
diff --git a/src/PersonalWordList.cpp b/src/PersonalWordList.cpp
index 4d3292e3f5..ca61d8a171 100644
--- a/src/PersonalWordList.cpp
+++ b/src/PersonalWordList.cpp
@@ -17,15 +17,12 @@
 #include "support/filetools.h"
 #include "support/Package.h"
 #include "support/FileName.h"
-#include "support/lstrings.h"
-#include "support/os.h"
 
 #include <string>
 #include <fstream>
 
 using namespace std;
 using namespace lyx::support;
-using namespace lyx::support::os;
 
 namespace lyx {
 
diff --git a/src/Row.cpp b/src/Row.cpp
index f59b6e41af..9ab7f11037 100644
--- a/src/Row.cpp
+++ b/src/Row.cpp
@@ -26,8 +26,8 @@
 #include "support/debug.h"
 #include "support/lassert.h"
 #include "support/lstrings.h"
-#include "support/lyxalgo.h"
 
+#include <algorithm>
 #include <ostream>
 
 using namespace std;
diff --git a/src/RowPainter.h b/src/RowPainter.h
index d573cb8e5b..275ff92b51 100644
--- a/src/RowPainter.h
+++ b/src/RowPainter.h
@@ -23,8 +23,6 @@ class Paragraph;
 class Text;
 class TextMetrics;
 
-namespace frontend { class Painter; }
-
 /**
  * A class used for painting an individual row of text.
  * FIXME: get rid of that class.
diff --git a/src/ServerSocket.cpp b/src/ServerSocket.cpp
index fd903ce18f..3544235bba 100644
--- a/src/ServerSocket.cpp
+++ b/src/ServerSocket.cpp
@@ -18,7 +18,6 @@
 
 #include "DispatchResult.h"
 #include "FuncRequest.h"
-#include "LyX.h"
 #include "LyXAction.h"
 
 #include "frontends/Application.h"
diff --git a/src/TexRow.h b/src/TexRow.h
index 8edcd8eb16..d6617bf6be 100644
--- a/src/TexRow.h
+++ b/src/TexRow.h
@@ -28,8 +28,7 @@
 #ifndef TEXROW_H
 #define TEXROW_H
 
-#include "support/debug.h"
-#include "support/docstring.h"
+#include "support/strfwd.h"
 #include "support/types.h"
 
 #include <vector>
diff --git a/src/Text.cpp b/src/Text.cpp
index e4eb4abf10..5d761ca134 100644
--- a/src/Text.cpp
+++ b/src/Text.cpp
@@ -22,19 +22,18 @@
 
 #include "Author.h"
 #include "Buffer.h"
-#include "buffer_funcs.h"
 #include "BufferParams.h"
 #include "BufferView.h"
 #include "Changes.h"
 #include "CompletionList.h"
 #include "Cursor.h"
+#include "CursorSlice.h"
 #include "CutAndPaste.h"
 #include "DispatchResult.h"
 #include "Encoding.h"
 #include "ErrorList.h"
-#include "FuncRequest.h"
 #include "factory.h"
-#include "InsetList.h"
+#include "Font.h"
 #include "Language.h"
 #include "Layout.h"
 #include "Lexer.h"
@@ -42,31 +41,25 @@
 #include "LyXRC.h"
 #include "Paragraph.h"
 #include "ParagraphParameters.h"
-#include "ParIterator.h"
 #include "TextClass.h"
 #include "TextMetrics.h"
-#include "WordLangTuple.h"
+#include "Undo.h"
 #include "WordList.h"
 
+#include "insets/Inset.h"
 #include "insets/InsetText.h"
-#include "insets/InsetBibitem.h"
 #include "insets/InsetCaption.h"
-#include "insets/InsetNewline.h"
-#include "insets/InsetNewpage.h"
-#include "insets/InsetArgument.h"
 #include "insets/InsetIPAMacro.h"
-#include "insets/InsetSpace.h"
 #include "insets/InsetSpecialChar.h"
 #include "insets/InsetTabular.h"
 
 #include "support/convert.h"
 #include "support/debug.h"
 #include "support/docstream.h"
+#include "support/docstring.h"
 #include "support/gettext.h"
 #include "support/lassert.h"
-#include "support/Length.h"
 #include "support/lstrings.h"
-#include "support/lyxalgo.h"
 #include "support/lyxtime.h"
 #include "support/textutils.h"
 #include "support/unique_ptr.h"
diff --git a/src/Text.h b/src/Text.h
index 3faccb8c59..412e6f036c 100644
--- a/src/Text.h
+++ b/src/Text.h
@@ -15,18 +15,18 @@
 #define TEXT_H
 
 #include "DocIterator.h"
+#include "Paragraph.h"
 #include "ParagraphList.h"
 
 namespace lyx {
 
-class Buffer;
 class BufferParams;
 class BufferView;
+class Change;
 class CompletionList;
 class Cursor;
 class CursorData;
 class CursorSlice;
-class DocIterator;
 class ErrorList;
 class Font;
 class FontInfo;
@@ -35,8 +35,7 @@ class FuncStatus;
 class Inset;
 class InsetText;
 class Lexer;
-class PainterInfo;
-class Spacing;
+class ParagraphParameters;
 
 /// This class encapsulates the main text data and operations in LyX.
 /// This is more or less the private implementation of InsetText.
diff --git a/src/Text2.cpp b/src/Text2.cpp
index ad5b8aaaa5..cf687f9e09 100644
--- a/src/Text2.cpp
+++ b/src/Text2.cpp
@@ -23,34 +23,22 @@
 #include "Text.h"
 
 #include "Buffer.h"
-#include "buffer_funcs.h"
-#include "BufferList.h"
 #include "BufferParams.h"
 #include "BufferView.h"
 #include "Changes.h"
 #include "Cursor.h"
-#include "CutAndPaste.h"
-#include "DispatchResult.h"
-#include "ErrorList.h"
 #include "Language.h"
 #include "Layout.h"
-#include "Lexer.h"
-#include "LyX.h"
 #include "LyXRC.h"
 #include "Paragraph.h"
 #include "ParagraphParameters.h"
 #include "TextClass.h"
 #include "TextMetrics.h"
 
-#include "insets/InsetCollapsible.h"
-
-#include "mathed/InsetMathHull.h"
+#include "insets/InsetText.h"
 
 #include "support/lassert.h"
-#include "support/debug.h"
 #include "support/gettext.h"
-#include "support/lyxalgo.h"
-#include "support/textutils.h"
 
 #include <sstream>
 
diff --git a/src/Text3.cpp b/src/Text3.cpp
index 1d3e44d3eb..cf2d701e7f 100644
--- a/src/Text3.cpp
+++ b/src/Text3.cpp
@@ -18,18 +18,15 @@
 #include "Text.h"
 
 #include "BranchList.h"
-#include "FloatList.h"
-#include "FuncStatus.h"
 #include "Buffer.h"
-#include "buffer_funcs.h"
 #include "BufferParams.h"
 #include "BufferView.h"
-#include "Changes.h"
 #include "Cursor.h"
 #include "CutAndPaste.h"
 #include "DispatchResult.h"
-#include "ErrorList.h"
 #include "factory.h"
+#include "FloatList.h"
+#include "FuncStatus.h"
 #include "FuncRequest.h"
 #include "InsetList.h"
 #include "Intl.h"
@@ -75,9 +72,6 @@
 #include "support/lassert.h"
 #include "support/limited_stack.h"
 #include "support/lstrings.h"
-#include "support/lyxalgo.h"
-#include "support/lyxtime.h"
-#include "support/os.h"
 #include "support/regex.h"
 
 #include "mathed/InsetMathHull.h"
diff --git a/src/TextClass.cpp b/src/TextClass.cpp
index 03a7624a9a..42169c1b50 100644
--- a/src/TextClass.cpp
+++ b/src/TextClass.cpp
@@ -16,22 +16,19 @@
 
 #include "TextClass.h"
 
-#include "LayoutFile.h"
 #include "CiteEnginesList.h"
-#include "Color.h"
 #include "Counters.h"
 #include "Floating.h"
 #include "FloatList.h"
 #include "Layout.h"
+#include "LayoutFile.h"
 #include "Lexer.h"
-#include "Font.h"
 #include "ModuleList.h"
 
 #include "frontends/alert.h"
 
 #include "support/lassert.h"
 #include "support/debug.h"
-#include "support/ExceptionMessage.h"
 #include "support/FileName.h"
 #include "support/filetools.h"
 #include "support/gettext.h"
diff --git a/src/TextMetrics.cpp b/src/TextMetrics.cpp
index c7d9e18acb..5cd7a603a0 100644
--- a/src/TextMetrics.cpp
+++ b/src/TextMetrics.cpp
@@ -36,15 +36,13 @@
 
 #include "insets/InsetText.h"
 
-#include "mathed/InsetMathMacroTemplate.h"
+#include "mathed/MacroTable.h"
 
 #include "frontends/FontMetrics.h"
 #include "frontends/NullPainter.h"
 
-#include "support/convert.h"
 #include "support/debug.h"
 #include "support/lassert.h"
-#include "support/lyxlib.h"
 #include "support/RefChanger.h"
 
 #include <stdlib.h>
diff --git a/src/TextMetrics.h b/src/TextMetrics.h
index 9e887f344f..f7f30fa08e 100644
--- a/src/TextMetrics.h
+++ b/src/TextMetrics.h
@@ -28,7 +28,6 @@ namespace lyx {
 class BufferView;
 class Cursor;
 class CursorSlice;
-class DocIterator;
 class MetricsInfo;
 class Text;
 
diff --git a/src/Thesaurus.cpp b/src/Thesaurus.cpp
index 86cbd65906..ace03d79e9 100644
--- a/src/Thesaurus.cpp
+++ b/src/Thesaurus.cpp
@@ -21,17 +21,15 @@
 #include "support/FileNameList.h"
 #include "support/Package.h"
 #include "support/debug.h"
+#include "support/docstring.h"
 #include "support/docstring_list.h"
 #include "support/filetools.h"
-#include "support/gettext.h"
 #include "support/lstrings.h"
 #include "support/os.h"
 
 #include <cstdio>
 #include MYTHES_H_LOCATION
 
-#include "frontends/alert.h"
-
 #include <algorithm>
 #include <cstring>
 #include <fstream>
diff --git a/src/Thesaurus.h b/src/Thesaurus.h
index 52987cdd13..9c13b044cb 100644
--- a/src/Thesaurus.h
+++ b/src/Thesaurus.h
@@ -13,14 +13,15 @@
 #ifndef THESAURUS_H
 #define THESAURUS_H
 
-#include "support/docstring.h"
-#include "WordLangTuple.h"
+#include "support/strfwd.h"
 
 #include <map>
 #include <vector>
 
 namespace lyx {
 
+class WordLangTuple;
+
 /**
  * This class provides an interface to whatever thesauri we might support.
  */
diff --git a/src/TocBuilder.cpp b/src/TocBuilder.cpp
index deaace26c9..dada6f0435 100644
--- a/src/TocBuilder.cpp
+++ b/src/TocBuilder.cpp
@@ -12,6 +12,7 @@
 
 #include "TocBuilder.h"
 
+#include "DocIterator.h"
 #include "TocBackend.h"
 
 #include "support/lassert.h"
diff --git a/src/TocBuilder.h b/src/TocBuilder.h
index da016a632f..5c3407918a 100644
--- a/src/TocBuilder.h
+++ b/src/TocBuilder.h
@@ -12,7 +12,6 @@
 #ifndef TOC_BUILDER_H
 #define TOC_BUILDER_H
 
-#include "DocIterator.h"
 #include "Toc.h"
 
 #include "support/strfwd.h"
@@ -22,6 +21,7 @@
 
 namespace lyx {
 
+class DocIterator;
 
 /// Caption-enabled TOC builders
 class TocBuilder
diff --git a/src/Trans.cpp b/src/Trans.cpp
index 02c8f864ab..5a03665684 100644
--- a/src/Trans.cpp
+++ b/src/Trans.cpp
@@ -13,11 +13,7 @@
 
 #include "Trans.h"
 
-#include "Buffer.h"
-#include "BufferView.h"
-#include "Cursor.h"
 #include "Lexer.h"
-#include "LyXRC.h"
 #include "Text.h"
 
 #include "support/debug.h"
diff --git a/src/Undo.cpp b/src/Undo.cpp
index da4d27ca03..6704490352 100644
--- a/src/Undo.cpp
+++ b/src/Undo.cpp
@@ -20,7 +20,6 @@
 #include "Buffer.h"
 #include "BufferList.h"
 #include "BufferParams.h"
-#include "buffer_funcs.h"
 #include "Cursor.h"
 #include "CutAndPaste.h"
 #include "ErrorList.h"
@@ -28,14 +27,12 @@
 #include "ParagraphList.h"
 #include "Text.h"
 
-#include "mathed/MathSupport.h"
 #include "mathed/MathData.h"
 
 #include "insets/Inset.h"
 #include "insets/InsetText.h"
 
 #include "support/debug.h"
-#include "support/gettext.h"
 #include "support/lassert.h"
 #include "support/lyxtime.h"
 
diff --git a/src/Undo.h b/src/Undo.h
index 8b482d2582..887f7627e1 100644
--- a/src/Undo.h
+++ b/src/Undo.h
@@ -22,11 +22,8 @@
 namespace lyx {
 
 class Buffer;
-class BufferParams;
 class CursorData;
 class Inset;
-class MathData;
-class ParagraphList;
 
 /// This is used to combine consecutive undo recordings of the same kind.
 enum UndoKind {
diff --git a/src/VCBackend.cpp b/src/VCBackend.cpp
index 309d705372..bee398cc4e 100644
--- a/src/VCBackend.cpp
+++ b/src/VCBackend.cpp
@@ -13,7 +13,6 @@
 
 #include "VCBackend.h"
 #include "Buffer.h"
-#include "DispatchResult.h"
 #include "LyX.h"
 #include "FuncRequest.h"
 
diff --git a/src/VSpace.cpp b/src/VSpace.cpp
index d176850c87..abec3eff92 100644
--- a/src/VSpace.cpp
+++ b/src/VSpace.cpp
@@ -16,7 +16,6 @@
 #include "BufferParams.h"
 #include "BufferView.h"
 #include "support/gettext.h"
-#include "Text.h"
 #include "TextMetrics.h" // for defaultRowHeight()
 
 #include "support/convert.h"
diff --git a/src/factory.cpp b/src/factory.cpp
index 0cd3a4ca0a..dd72fe33d1 100644
--- a/src/factory.cpp
+++ b/src/factory.cpp
@@ -12,13 +12,9 @@
 
 #include "factory.h"
 
-#include "Buffer.h"
-#include "BufferParams.h"
-#include "FloatList.h"
 #include "FuncRequest.h"
 #include "Lexer.h"
 #include "LyX.h"
-#include "TextClass.h"
 
 #include "insets/InsetBibitem.h"
 #include "insets/InsetBibtex.h"
@@ -51,6 +47,7 @@
 #include "insets/InsetArgument.h"
 #include "insets/InsetPhantom.h"
 #include "insets/InsetPreview.h"
+#include "insets/InsetQuotes.h"
 #include "insets/InsetRef.h"
 #include "insets/InsetScript.h"
 #include "insets/InsetSeparator.h"
@@ -67,7 +64,6 @@
 
 #include "support/debug.h"
 #include "support/ExceptionMessage.h"
-#include "support/lassert.h"
 #include "support/lstrings.h"
 #include "support/unique_ptr.h"
 
diff --git a/src/insets/InsetText.cpp b/src/insets/InsetText.cpp
index 10b15c88ed..6f7a1a40e5 100644
--- a/src/insets/InsetText.cpp
+++ b/src/insets/InsetText.cpp
@@ -51,6 +51,7 @@
 #include "Text.h"
 #include "TextMetrics.h"
 #include "TocBackend.h"
+#include "TocBuilder.h"
 
 #include "frontends/alert.h"
 #include "frontends/Painter.h"
@@ -63,6 +64,7 @@
 #include "support/RefChanger.h"
 
 #include <algorithm>
+#include <stack>
 
 
 using namespace std;
diff --git a/src/lyxfind.cpp b/src/lyxfind.cpp
index e12d4d239a..54683b0db3 100644
--- a/src/lyxfind.cpp
+++ b/src/lyxfind.cpp
@@ -17,7 +17,6 @@
 #include "lyxfind.h"
 
 #include "Buffer.h"
-#include "buffer_funcs.h"
 #include "BufferList.h"
 #include "BufferParams.h"
 #include "BufferView.h"
@@ -29,8 +28,6 @@
 #include "output_latex.h"
 #include "OutputParams.h"
 #include "Paragraph.h"
-#include "ParIterator.h"
-#include "TexRow.h"
 #include "Text.h"
 #include "Encoding.h"
 
diff --git a/src/lyxfind.h b/src/lyxfind.h
index bfaae8f43d..9daf4c8d74 100644
--- a/src/lyxfind.h
+++ b/src/lyxfind.h
@@ -23,14 +23,10 @@
 
 namespace lyx {
 
-
-
-class Buffer;
 class Cursor;
 class BufferView;
 class DocIterator;
 class FuncRequest;
-class Text;
 
 /** Encode the parameters needed to find \c search as a string
  *  that can be dispatched to the LyX core in a FuncRequest wrapper.
diff --git a/src/output_xhtml.cpp b/src/output_xhtml.cpp
index d428761b10..a4aced68b0 100644
--- a/src/output_xhtml.cpp
+++ b/src/output_xhtml.cpp
@@ -15,7 +15,6 @@
 #include "output_xhtml.h"
 
 #include "Buffer.h"
-#include "buffer_funcs.h"
 #include "BufferParams.h"
 #include "Counters.h"
 #include "Font.h"
@@ -28,11 +27,7 @@
 #include "Text.h"
 #include "TextClass.h"
 
-#include "support/convert.h"
-#include "support/debug.h"
 #include "support/lassert.h"
-#include "support/lstrings.h"
-#include "support/textutils.h"
 
 #include <stack>
 #include <iostream>
-- 
2.28.0.windows.1



More information about the lyx-devel mailing list