tdf#42949 Fix IWYU warnings in sw/inc/*

Found with bin/find-unneeded-includes
Only removal proposals are dealt with here.

- Also fix .h / .hrc files
- Remove a bit of duplication from the .yaml file

Change-Id: I22145a79343497678e481d882544eb08e765312a
Reviewed-on: https://gerrit.libreoffice.org/65878
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
diff --git a/sw/IwyuFilter_sw.yaml b/sw/IwyuFilter_sw.yaml
index 287d761..3cdfbe6 100644
--- a/sw/IwyuFilter_sw.yaml
+++ b/sw/IwyuFilter_sw.yaml
@@ -41,12 +41,6 @@ blacklist:
    - utility
    sw/inc/shellid.hxx:
    - sfx2/shell.hxx
    sw/inc/unosett.hxx:
    # sw::UnoImplPtr typedef
    - unobaseclass.hxx
    sw/inc/unotxdoc.hxx:
    # sw::UnoImplPtr typedef
    - unobaseclass.hxx
    sw/inc/breakit.hxx:
    # std::unique_ptr dtor requires complete type
    - com/sun/star/i18n/ForbiddenCharacters.hpp
@@ -242,3 +236,26 @@ blacklist:
    - vector
    sw/inc/shellio.hxx:
    - o3tl/deleter.hxx
    sw/inc/unostyle.hxx:
    # Base class needs complete type
    - com/sun/star/beans/XPropertySet.hpp
    - com/sun/star/beans/XPropertyState.hpp
    - com/sun/star/style/XAutoStyle.hpp
    - com/sun/star/style/XAutoStyleFamily.hpp
    - com/sun/star/style/XAutoStyles.hpp
    - com/sun/star/container/XNameContainer.hpp
    - com/sun/star/style/XStyle.hpp
    - com/sun/star/style/XStyleLoader.hpp
    sw/inc/unotextrange.hxx:
    # Base class needs complete type
    - com/sun/star/lang/XUnoTunnel.hpp
    - com/sun/star/lang/XServiceInfo.hpp
    - com/sun/star/beans/XPropertySet.hpp
    - com/sun/star/beans/XPropertyState.hpp
    - com/sun/star/container/XIndexAccess.hpp
    - com/sun/star/container/XEnumerationAccess.hpp
    - com/sun/star/container/XContentEnumerationAccess.hpp
    - com/sun/star/text/XTextRange.hpp
    - com/sun/star/text/XRedline.hpp
    # sw::UnoImplPtr typedef
    - unobaseclass.hxx
diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h
index 28a13ea..b707690 100644
--- a/sw/inc/cmdid.h
+++ b/sw/inc/cmdid.h
@@ -21,7 +21,7 @@
#define INCLUDED_SW_INC_CMDID_H

#include <sfx2/sfxsids.hrc>
#include "unomid.h"
#include <svl/solar.hrc>

#define FN_FILE                 SID_SW_START
#define FN_EDIT                 (SID_SW_START +  100)
diff --git a/sw/inc/dbui.hrc b/sw/inc/dbui.hrc
index 47c4e04..086df85 100644
--- a/sw/inc/dbui.hrc
+++ b/sw/inc/dbui.hrc
@@ -20,7 +20,7 @@
#ifndef INCLUDED_SW_INC_DBUI_HRC
#define INCLUDED_SW_INC_DBUI_HRC

#include "rcid.hrc"
#include <utility>

#define NC_(Context, String) reinterpret_cast<char const *>(Context "\004" u8##String)

diff --git a/sw/inc/extinput.hxx b/sw/inc/extinput.hxx
index 1fc6e75..ab06a6d 100644
--- a/sw/inc/extinput.hxx
+++ b/sw/inc/extinput.hxx
@@ -24,8 +24,6 @@
#include <vcl/commandevent.hxx>
#include <vector>

class CommandExtTextInputData;

class SwExtTextInput : public SwPaM
{
    std::vector<ExtTextInputAttr> aAttrs;
diff --git a/sw/inc/fmtfollowtextflow.hxx b/sw/inc/fmtfollowtextflow.hxx
index ff3aa9f..9e54f07 100644
--- a/sw/inc/fmtfollowtextflow.hxx
+++ b/sw/inc/fmtfollowtextflow.hxx
@@ -19,7 +19,6 @@
#ifndef INCLUDED_SW_INC_FMTFOLLOWTEXTFLOW_HXX
#define INCLUDED_SW_INC_FMTFOLLOWTEXTFLOW_HXX

#include <sal/log.hxx>
#include <svl/eitem.hxx>
#include "hintids.hxx"
#include "format.hxx"
diff --git a/sw/inc/helpids.h b/sw/inc/helpids.h
index 163480a..ad9c825 100644
--- a/sw/inc/helpids.h
+++ b/sw/inc/helpids.h
@@ -20,9 +20,6 @@
#ifndef INCLUDED_SW_INC_HELPIDS_H
#define INCLUDED_SW_INC_HELPIDS_H

#include "swcommands.h"
#include <svx/svxcommands.h>

#define HID_EDIT_WIN                                            "SW_HID_EDIT_WIN"

#define HID_NAVI_DRAG_HYP                                       "SW_HID_NAVI_DRAG_HYP"
diff --git a/sw/inc/swerror.h b/sw/inc/swerror.h
index 840542f..87505ff0 100644
--- a/sw/inc/swerror.h
+++ b/sw/inc/swerror.h
@@ -20,8 +20,6 @@
#ifndef INCLUDED_SW_INC_SWERROR_H
#define INCLUDED_SW_INC_SWERROR_H

#include <vcl/errcode.hxx>

// Import & Export
#define ERR_SWG_FILE_FORMAT_ERROR       ErrCode(ErrCodeArea::Sw, ErrCodeClass::Read, 1 )
#define ERR_SWG_READ_ERROR              ErrCode(ErrCodeArea::Sw, ErrCodeClass::Read, 2 )
diff --git a/sw/inc/unostyle.hxx b/sw/inc/unostyle.hxx
index 4d60d961..5f2470f 100644
--- a/sw/inc/unostyle.hxx
+++ b/sw/inc/unostyle.hxx
@@ -20,19 +20,14 @@
#define INCLUDED_SW_INC_UNOSTYLE_HXX

#include <svl/style.hxx>
#include <svl/lstner.hxx>
#include "unocoll.hxx"
#include "unomap.hxx"
#include "tblafmt.hxx"
#include <com/sun/star/style/XStyle.hpp>
#include <com/sun/star/lang/XUnoTunnel.hpp>
#include <com/sun/star/style/XStyleLoader.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/beans/XMultiPropertySet.hpp>
#include <com/sun/star/beans/XPropertyState.hpp>
#include <com/sun/star/beans/XMultiPropertyStates.hpp>
#include <cppuhelper/implbase.hxx>
#include <com/sun/star/document/XEventsSupplier.hpp>
#include "calbck.hxx"

#include <com/sun/star/style/XAutoStyleFamily.hpp>
@@ -43,17 +38,11 @@
#include <memory>
#include <map>

namespace com { namespace sun { namespace star { namespace document { class XEventsSupplier; } } } }

class SwDocShell;
class SfxItemPropertySet;
class SwXStyle;
class SwStyleProperties_Impl;
class SwAutoStylesEnumImpl;
class IStyleAccess;
class SfxItemSet;
namespace sw
{
    class XStyleFamily;
};

class SwXStyleFamilies :  public cppu::WeakImplHelper
<
@@ -240,7 +229,6 @@ protected:

};

class SwTableAutoFormat;
typedef std::map<OUString, sal_Int32> CellStyleNameMap;

/// A text table style is a uno api wrapper for a SwTableAutoFormat
@@ -336,7 +324,6 @@ public:
    static css::uno::Reference<css::style::XStyle> CreateXTextTableStyle(SwDocShell* pDocShell, const OUString& rTableAutoFormatName);
};

class SwBoxAutoFormat;
/// A text cell style is a uno api wrapper for a SwBoxAutoFormat core class
class SwXTextCellStyle : public cppu::WeakImplHelper
<
diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx
index bf33086..bc4d717 100644
--- a/sw/inc/unotxdoc.hxx
+++ b/sw/inc/unotxdoc.hxx
@@ -55,7 +55,6 @@
#include <com/sun/star/text/XFlatParagraphIteratorProvider.hpp>
#include <com/sun/star/document/XDocumentLanguages.hpp>
#include <com/sun/star/util/XCloneable.hpp>
#include <com/sun/star/uno/XAggregation.hpp>
#include <o3tl/deleter.hxx>
#include <rtl/ref.hxx>
#include <svx/fmdmod.hxx>
@@ -85,6 +84,8 @@ class SfxItemPropertySet;
namespace com { namespace sun { namespace star { namespace container { class XNameContainer; } } } }
namespace com { namespace sun { namespace star { namespace frame { class XController; } } } }
namespace com { namespace sun { namespace star { namespace lang { struct Locale; } } } }
namespace com { namespace sun { namespace star { namespace uno { class XAggregation; } } } }

namespace com { namespace sun { namespace star { namespace util { class XReplaceDescriptor; } } } }

typedef cppu::WeakImplHelper
diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx
index c4586ed..6b9ade8 100644
--- a/sw/inc/viewsh.hxx
+++ b/sw/inc/viewsh.hxx
@@ -72,7 +72,6 @@ namespace vcl
{
    typedef OutputDevice RenderContext;
}
namespace weld { class Dialog; }

// Define for flags needed in ctor or layers below.
// Currently the Preview flag is needed for DrawPage.
diff --git a/sw/inc/viscrs.hxx b/sw/inc/viscrs.hxx
index 332e190..49a9cc9 100644
--- a/sw/inc/viscrs.hxx
+++ b/sw/inc/viscrs.hxx
@@ -21,12 +21,13 @@

#include <config_features.h>

#include <svx/sdr/overlay/overlayobject.hxx>
#include <vcl/cursor.hxx>
#include "swcrsr.hxx"
#include "swrect.hxx"
#include "swregion.hxx"

namespace sdr { namespace overlay { class OverlayObject; } }

class SwCursorShell;
class SfxViewShell;

diff --git a/sw/sdi/swslots.hrc b/sw/sdi/swslots.hrc
index e4a3b91..59bcaa4 100644
--- a/sw/sdi/swslots.hrc
+++ b/sw/sdi/swslots.hrc
@@ -21,5 +21,6 @@
#include <svx/svxids.hrc>
#include "globals.hrc"
#include "cmdid.h"
#include "unomid.h"

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/attr/fmtfollowtextflow.cxx b/sw/source/core/attr/fmtfollowtextflow.cxx
index f8247d6..eee767f 100644
--- a/sw/source/core/attr/fmtfollowtextflow.cxx
+++ b/sw/source/core/attr/fmtfollowtextflow.cxx
@@ -20,6 +20,7 @@
#include <fmtfollowtextflow.hxx>
#include <unomid.h>

#include <sal/log.hxx>


SfxPoolItem*    SwFormatFollowTextFlow::Clone( SfxItemPool * ) const
diff --git a/sw/source/core/doc/docglos.cxx b/sw/source/core/doc/docglos.cxx
index e7c3543..e55d9e4 100644
--- a/sw/source/core/doc/docglos.cxx
+++ b/sw/source/core/doc/docglos.cxx
@@ -22,6 +22,8 @@
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/beans/XPropertySetInfo.hpp>

#include <osl/diagnose.h>

#include <doc.hxx>
#include <IDocumentUndoRedo.hxx>
#include <IDocumentFieldsAccess.hxx>
diff --git a/sw/source/core/doc/tblafmt.cxx b/sw/source/core/doc/tblafmt.cxx
index ddd9144..47f2c64 100644
--- a/sw/source/core/doc/tblafmt.cxx
+++ b/sw/source/core/doc/tblafmt.cxx
@@ -43,6 +43,7 @@
#include <fmtlsplt.hxx>
#include <fmtrowsplt.hxx>
#include <sal/log.hxx>
#include <osl/diagnose.h>

#include <memory>
#include <vector>
diff --git a/sw/source/core/doc/textboxhelper.cxx b/sw/source/core/doc/textboxhelper.cxx
index 2eda791..59d8eb3 100644
--- a/sw/source/core/doc/textboxhelper.cxx
+++ b/sw/source/core/doc/textboxhelper.cxx
@@ -22,6 +22,7 @@
#include <unodraw.hxx>
#include <unotextrange.hxx>
#include <cmdid.h>
#include <unomid.h>
#include <unoprnms.hxx>
#include <mvsave.hxx>
#include <fmtsrnd.hxx>
diff --git a/sw/source/core/edit/edfld.cxx b/sw/source/core/edit/edfld.cxx
index 3311439..26baa3e 100644
--- a/sw/source/core/edit/edfld.cxx
+++ b/sw/source/core/edit/edfld.cxx
@@ -19,6 +19,7 @@

#include <config_features.h>

#include <osl/diagnose.h>
#include <unotools/charclass.hxx>
#include <editsh.hxx>
#include <fldbas.hxx>
diff --git a/sw/source/core/edit/edglbldc.cxx b/sw/source/core/edit/edglbldc.cxx
index ec14ef4..a018575 100644
--- a/sw/source/core/edit/edglbldc.cxx
+++ b/sw/source/core/edit/edglbldc.cxx
@@ -31,6 +31,7 @@
#include <doctxm.hxx>
#include <edglbldc.hxx>
#include <o3tl/make_unique.hxx>
#include <osl/diagnose.h>

bool SwEditShell::IsGlobalDoc() const
{
diff --git a/sw/source/core/fields/ddefld.cxx b/sw/source/core/fields/ddefld.cxx
index 232b9aa..0bc07e7 100644
--- a/sw/source/core/fields/ddefld.cxx
+++ b/sw/source/core/fields/ddefld.cxx
@@ -21,6 +21,7 @@

#include <o3tl/any.hxx>
#include <o3tl/make_unique.hxx>
#include <osl/diagnose.h>
#include <osl/thread.h>
#include <sfx2/linkmgr.hxx>
#include <doc.hxx>
diff --git a/sw/source/core/fields/fldlst.cxx b/sw/source/core/fields/fldlst.cxx
index 02bf47e..7fe5429 100644
--- a/sw/source/core/fields/fldlst.cxx
+++ b/sw/source/core/fields/fldlst.cxx
@@ -30,6 +30,8 @@
#include <docfld.hxx>
#include <ndtxt.hxx>

#include <osl/diagnose.h>

// sort input values

SwInputFieldList::SwInputFieldList( SwEditShell* pShell, bool bBuildTmpLst )
diff --git a/sw/source/core/sw3io/swacorr.cxx b/sw/source/core/sw3io/swacorr.cxx
index 7f9b79c..307e318 100644
--- a/sw/source/core/sw3io/swacorr.cxx
+++ b/sw/source/core/sw3io/swacorr.cxx
@@ -24,6 +24,7 @@
#include <docsh.hxx>
#include <editsh.hxx>
#include <sot/storage.hxx>
#include <osl/diagnose.h>

using namespace ::com::sun::star;

diff --git a/sw/source/core/undo/unsect.cxx b/sw/source/core/undo/unsect.cxx
index d10680a..b2cc03fd 100644
--- a/sw/source/core/undo/unsect.cxx
+++ b/sw/source/core/undo/unsect.cxx
@@ -20,6 +20,7 @@
#include <memory>
#include <UndoSection.hxx>

#include <osl/diagnose.h>
#include <sfx2/linkmgr.hxx>
#include <fmtcntnt.hxx>
#include <doc.hxx>
diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx
index da1facf..bfe1e1d 100644
--- a/sw/source/core/unocore/unocrsrhelper.cxx
+++ b/sw/source/core/unocore/unocrsrhelper.cxx
@@ -37,6 +37,7 @@
#include <unodraw.hxx>
#include <unofootnote.hxx>
#include <unobookmark.hxx>
#include <unomap.hxx>
#include <unorefmark.hxx>
#include <unostyle.hxx>
#include <unoidx.hxx>
diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx
index 9652f79..1e34acb 100644
--- a/sw/source/core/unocore/unodraw.cxx
+++ b/sw/source/core/unocore/unodraw.cxx
@@ -22,6 +22,7 @@
#include <sal/log.hxx>

#include <cmdid.h>
#include <unomid.h>

#include <drawdoc.hxx>
#include <unodraw.hxx>
diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx
index 18da437..07c3732 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -41,6 +41,7 @@
#include <editeng/memberids.h>
#include <swtypes.hxx>
#include <cmdid.h>
#include <unomid.h>
#include <memory>
#include <utility>
#include <hints.hxx>
diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx
index 1ed8118..288df10 100644
--- a/sw/source/core/unocore/unoobj.cxx
+++ b/sw/source/core/unocore/unoobj.cxx
@@ -27,6 +27,7 @@
#include <swtypes.hxx>
#include <hintids.hxx>
#include <cmdid.h>
#include <unomid.h>
#include <hints.hxx>
#include <IMark.hxx>
#include <frmfmt.hxx>
diff --git a/sw/source/core/unocore/unosett.cxx b/sw/source/core/unocore/unosett.cxx
index d3b949b..942829b 100644
--- a/sw/source/core/unocore/unosett.cxx
+++ b/sw/source/core/unocore/unosett.cxx
@@ -21,6 +21,7 @@
#include <editeng/memberids.h>
#include <swtypes.hxx>
#include <cmdid.h>
#include <unomid.h>
#include <hintids.hxx>
#include <strings.hrc>
#include <poolfmt.hxx>
diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx
index 68d323c..2f77470 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -44,6 +44,8 @@
#include <docary.hxx>
#include <charfmt.hxx>
#include <cmdid.h>
#include <unomid.h>
#include <unomap.hxx>
#include <unostyle.hxx>
#include <unosett.hxx>
#include <docsh.hxx>
@@ -69,6 +71,7 @@
#include <com/sun/star/drawing/BitmapMode.hpp>
#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
#include <com/sun/star/document/XEventsSupplier.hpp>
#include <istyleaccess.hxx>
#include <GetMetricVal.hxx>
#include <fmtfsize.hxx>
@@ -101,6 +104,9 @@
#include <set>
#include <limits>

class SwXStyle;
class SwStyleProperties_Impl;

namespace
{
    struct StyleFamilyEntry
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index 4f2606c..cea9fcf 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -30,6 +30,8 @@
#include <float.h>
#include <swtypes.hxx>
#include <cmdid.h>
#include <unomid.h>
#include <unomap.hxx>
#include <unotbl.hxx>
#include <unostyle.hxx>
#include <section.hxx>
diff --git a/sw/source/filter/basflt/shellio.cxx b/sw/source/filter/basflt/shellio.cxx
index e0a67591..60ff28d 100644
--- a/sw/source/filter/basflt/shellio.cxx
+++ b/sw/source/filter/basflt/shellio.cxx
@@ -18,6 +18,7 @@
 */

#include <hintids.hxx>
#include <osl/diagnose.h>
#include <tools/date.hxx>
#include <tools/time.hxx>
#include <svl/urihelper.hxx>
diff --git a/sw/source/uibase/shells/slotadd.cxx b/sw/source/uibase/shells/slotadd.cxx
index 0433572..e86a4c0 100644
--- a/sw/source/uibase/shells/slotadd.cxx
+++ b/sw/source/uibase/shells/slotadd.cxx
@@ -22,6 +22,7 @@
#include <hintids.hxx>
#include <uiitems.hxx>
#include <cmdid.h>
#include <unomid.h>

#include <svl/globalnameitem.hxx>
#include <editeng/memberids.h>
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index 83c78d2..49f6e41 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -61,6 +61,7 @@
#include <unotxdoc.hxx>
#include <svl/numuno.hxx>
#include <fldbas.hxx>
#include <unomap.hxx>
#include <unotextbodyhf.hxx>
#include <unotextrange.hxx>
#include <unotextcursor.hxx>