tdf#42949 Fix IWYU warnings in shell/

Except for MAC/WIN specific parts (i.e. most of it)

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

Change-Id: Ia14fb27c047e0e69f81386212aa25344f1297e05
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95663
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
diff --git a/shell/IwyuFilter_shell.yaml b/shell/IwyuFilter_shell.yaml
new file mode 100644
index 0000000..02604d9
--- /dev/null
+++ b/shell/IwyuFilter_shell.yaml
@@ -0,0 +1,31 @@
---
assumeFilename: shell/source/unix/exec/shellexec.cxx
blacklist:
    shell/source/sessioninstall/SyncDbusSessionHelper.hxx:
    # No hpp->hdl replacement
    - org/freedesktop/PackageKit/SyncDbusSessionHelper.hpp
    shell/source/backends/kf5be/kf5access.cxx:
    # Keep abstract QT headers
    - QtCore/QDir
    - QtCore/QStandardPaths
    - QtCore/QString
    - QtCore/QUrl
    - QtGui/QFont
    - QtGui/QFontDatabase
    shell/source/backends/kf5be/kf5backend.cxx:
    # Keep abstract QT headers
    - QtWidgets/QApplication
    # Keep abstract boost headers
    - boost/noncopyable.hpp
    shell/source/backends/localebe/localebackend.cxx:
    # Needed on WIN for toU
    - o3tl/char16_t2wchar_t.hxx
    shell/source/cmdmail/cmdmailsuppl.cxx:
    # Actually used
    - com/sun/star/uno/XComponentContext.hpp
    shell/source/tools/lngconvex/lngconvex.cxx:
    # Needed for std::ifstream
    - fstream
    shell/source/unix/exec/shellexec.cxx:
    # Needed on MAC
    - osl/file.hxx
diff --git a/shell/inc/xml_parser.hxx b/shell/inc/xml_parser.hxx
index aea4240..37c4478 100644
--- a/shell/inc/xml_parser.hxx
+++ b/shell/inc/xml_parser.hxx
@@ -23,8 +23,6 @@
#include <expat.h>
#include <stdexcept>

#include <sal/types.h>

class xml_parser_exception final : public std::runtime_error
{
public:
diff --git a/shell/inc/zipfile.hxx b/shell/inc/zipfile.hxx
index 1b4a2770..1d774f7 100644
--- a/shell/inc/zipfile.hxx
+++ b/shell/inc/zipfile.hxx
@@ -20,8 +20,6 @@
#ifndef INCLUDED_SHELL_INC_INTERNAL_ZIPFILE_HXX
#define INCLUDED_SHELL_INC_INTERNAL_ZIPFILE_HXX

#include <zlib.h>

#include <string>
#include <vector>
#include <memory>
diff --git a/shell/source/backends/desktopbe/desktopbackend.cxx b/shell/source/backends/desktopbe/desktopbackend.cxx
index 001adef..5f024f0 100644
--- a/shell/source/backends/desktopbe/desktopbackend.cxx
+++ b/shell/source/backends/desktopbe/desktopbackend.cxx
@@ -21,14 +21,12 @@
#include <sal/log.hxx>

#include <com/sun/star/beans/Optional.hpp>
#include <com/sun/star/beans/PropertyVetoException.hpp>
#include <com/sun/star/beans/UnknownPropertyException.hpp>
#include <com/sun/star/beans/XPropertyChangeListener.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/beans/XPropertySetInfo.hpp>
#include <com/sun/star/beans/XVetoableChangeListener.hpp>
#include <com/sun/star/lang/IllegalArgumentException.hpp>
#include <com/sun/star/lang/WrappedTargetException.hpp>
#include <com/sun/star/lang/XMultiComponentFactory.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/uno/Any.hxx>
@@ -45,15 +43,11 @@
#include <osl/file.hxx>
#include <osl/security.hxx>
#include <rtl/byteseq.hxx>
#include <rtl/string.h>
#include <rtl/textenc.h>
#include <rtl/ustring.h>
#include <rtl/ustrbuf.hxx>
#include <rtl/ustring.hxx>
#include <sal/types.h>
#include <tools/diagnose_ex.h>
#include <uno/current_context.hxx>
#include <vcl/svapp.hxx>

namespace {

diff --git a/shell/source/backends/kf5be/kf5access.cxx b/shell/source/backends/kf5be/kf5access.cxx
index 00db5c5..d983b6d 100644
--- a/shell/source/backends/kf5be/kf5access.cxx
+++ b/shell/source/backends/kf5be/kf5access.cxx
@@ -34,10 +34,8 @@
// #include <kglobalsettings.h>

#include <com/sun/star/uno/Any.hxx>
#include <cppu/unotype.hxx>
#include <osl/diagnose.h>
#include <osl/file.h>
#include <rtl/string.h>
#include <rtl/ustring.hxx>

namespace kf5access
diff --git a/shell/source/backends/kf5be/kf5backend.cxx b/shell/source/backends/kf5be/kf5backend.cxx
index f55a515..cb3f382 100644
--- a/shell/source/backends/kf5be/kf5backend.cxx
+++ b/shell/source/backends/kf5be/kf5backend.cxx
@@ -23,19 +23,15 @@

#include <boost/noncopyable.hpp>
#include <com/sun/star/beans/Optional.hpp>
#include <com/sun/star/beans/PropertyVetoException.hpp>
#include <com/sun/star/beans/UnknownPropertyException.hpp>
#include <com/sun/star/beans/XPropertyChangeListener.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/beans/XPropertySetInfo.hpp>
#include <com/sun/star/beans/XVetoableChangeListener.hpp>
#include <com/sun/star/lang/IllegalArgumentException.hpp>
#include <com/sun/star/lang/WrappedTargetException.hpp>
#include <com/sun/star/lang/XMultiComponentFactory.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/uno/Any.hxx>
#include <com/sun/star/uno/Reference.hxx>
#include <com/sun/star/uno/RuntimeException.hpp>
#include <com/sun/star/uno/Sequence.hxx>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/uno/XCurrentContext.hpp>
@@ -43,8 +39,6 @@
#include <cppuhelper/implbase.hxx>
#include <cppuhelper/implementationentry.hxx>
#include <cppuhelper/weak.hxx>
#include <rtl/string.h>
#include <rtl/ustring.h>
#include <rtl/ustring.hxx>
#include <sal/types.h>
#include <uno/current_context.hxx>
diff --git a/shell/source/backends/localebe/localebackend.cxx b/shell/source/backends/localebe/localebackend.cxx
index 263b039..f78c525 100644
--- a/shell/source/backends/localebe/localebackend.cxx
+++ b/shell/source/backends/localebe/localebackend.cxx
@@ -26,14 +26,11 @@
#include "localebackend.hxx"
#include <com/sun/star/beans/Optional.hpp>
#include <cppuhelper/supportsservice.hxx>
#include <osl/time.h>
#include <rtl/character.hxx>
#include <o3tl/char16_t2wchar_t.hxx>
#include <i18nlangtag/languagetag.hxx>
#include <i18nlangtag/mslangid.hxx>

#include <stdio.h>

#ifdef _WIN32
#if !defined WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN
diff --git a/shell/source/backends/localebe/localebackend.hxx b/shell/source/backends/localebe/localebackend.hxx
index 006d669..53abdcb 100644
--- a/shell/source/backends/localebe/localebackend.hxx
+++ b/shell/source/backends/localebe/localebackend.hxx
@@ -26,7 +26,6 @@
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <cppuhelper/implbase.hxx>
#include <rtl/string.hxx>


namespace uno = css::uno ;
diff --git a/shell/source/cmdmail/cmdmailentry.cxx b/shell/source/cmdmail/cmdmailentry.cxx
index c82f674..750277d 100644
--- a/shell/source/cmdmail/cmdmailentry.cxx
+++ b/shell/source/cmdmail/cmdmailentry.cxx
@@ -18,12 +18,10 @@
 */

#include <cppuhelper/factory.hxx>
#include <com/sun/star/container/XSet.hpp>
#include <com/sun/star/lang/XSingleComponentFactory.hpp>
#include "cmdmailsuppl.hxx"

using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::registry;
using namespace ::cppu;
diff --git a/shell/source/cmdmail/cmdmailmsg.hxx b/shell/source/cmdmail/cmdmailmsg.hxx
index 09e1aea..43e40c1 100644
--- a/shell/source/cmdmail/cmdmailmsg.hxx
+++ b/shell/source/cmdmail/cmdmailmsg.hxx
@@ -21,11 +21,9 @@
#define INCLUDED_SHELL_SOURCE_CMDMAIL_CMDMAILMSG_HXX

#include <cppuhelper/implbase.hxx>
#include <com/sun/star/lang/IllegalArgumentException.hpp>
#include <com/sun/star/container/XNameAccess.hpp>

#include <com/sun/star/system/XSimpleMailMessage2.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>



diff --git a/shell/source/cmdmail/cmdmailsuppl.cxx b/shell/source/cmdmail/cmdmailsuppl.cxx
index 415a6c4d..2867eae6 100644
--- a/shell/source/cmdmail/cmdmailsuppl.cxx
+++ b/shell/source/cmdmail/cmdmailsuppl.cxx
@@ -25,22 +25,16 @@

#include <osl/file.hxx>
#include <rtl/strbuf.hxx>
#include <sal/log.hxx>
#include "cmdmailsuppl.hxx"
#include "cmdmailmsg.hxx"
#include <com/sun/star/system/SimpleMailClientFlags.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/configuration/theDefaultProvider.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <cppuhelper/supportsservice.hxx>
#include <tools/diagnose_ex.h>

#include <string.h>
#include <errno.h>
#include <unistd.h>

using com::sun::star::beans::PropertyValue;
using com::sun::star::system::XSimpleMailClientSupplier;
using com::sun::star::system::XSimpleMailClient;
diff --git a/shell/source/sessioninstall/SyncDbusSessionHelper.hxx b/shell/source/sessioninstall/SyncDbusSessionHelper.hxx
index 0db9a1d..8a8dd3b 100644
--- a/shell/source/sessioninstall/SyncDbusSessionHelper.hxx
+++ b/shell/source/sessioninstall/SyncDbusSessionHelper.hxx
@@ -10,7 +10,6 @@
#ifndef INCLUDED_SHELL_SOURCE_SESSIONINSTALL_SYNCDBUSSESSIONHELPER_HXX
#define INCLUDED_SHELL_SOURCE_SESSIONINSTALL_SYNCDBUSSESSIONHELPER_HXX

#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <org/freedesktop/PackageKit/SyncDbusSessionHelper.hpp>
#include <cppuhelper/implbase.hxx>
diff --git a/shell/source/sessioninstall/services.cxx b/shell/source/sessioninstall/services.cxx
index 4b72bff..69a7b2e 100644
--- a/shell/source/sessioninstall/services.cxx
+++ b/shell/source/sessioninstall/services.cxx
@@ -9,7 +9,6 @@

#include "SyncDbusSessionHelper.hxx"
#include <comphelper/servicedecl.hxx>
#include <uno/environment.h>

namespace sdecl = ::comphelper::service_decl;

diff --git a/shell/source/tools/lngconvex/cmdline.hxx b/shell/source/tools/lngconvex/cmdline.hxx
index f36c6be..bbf5afa 100644
--- a/shell/source/tools/lngconvex/cmdline.hxx
+++ b/shell/source/tools/lngconvex/cmdline.hxx
@@ -24,8 +24,6 @@

#include <sal/config.h>

#include <sal/types.h>


/** Simple command line abstraction
*/
diff --git a/shell/source/tools/lngconvex/lngconvex.cxx b/shell/source/tools/lngconvex/lngconvex.cxx
index 8711b1c..7385ad2 100644
--- a/shell/source/tools/lngconvex/lngconvex.cxx
+++ b/shell/source/tools/lngconvex/lngconvex.cxx
@@ -49,9 +49,7 @@ typedef unsigned short WORD;
#include <iostream>
#include <fstream>
#include <map>
#include <sstream>
#include <iterator>
#include <algorithm>
#include <string>

#ifndef _WIN32
diff --git a/shell/source/unix/exec/shellexec.cxx b/shell/source/unix/exec/shellexec.cxx
index 58c5ef4..0bcec84 100644
--- a/shell/source/unix/exec/shellexec.cxx
+++ b/shell/source/unix/exec/shellexec.cxx
@@ -17,31 +17,23 @@
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 */

#include <config_folders.h>

#include <osl/thread.h>
#include <osl/process.h>
#include <osl/file.hxx>
#include <rtl/strbuf.hxx>
#include <rtl/ustrbuf.hxx>
#include <sal/log.hxx>

#include <rtl/uri.hxx>
#include "shellexec.hxx"
#include <com/sun/star/system/SystemShellExecuteException.hpp>
#include <com/sun/star/system/SystemShellExecuteFlags.hpp>

#include <com/sun/star/util/theMacroExpander.hpp>
#include <com/sun/star/lang/IllegalArgumentException.hpp>
#include <com/sun/star/uri/ExternalUriReferenceTranslator.hpp>
#include <com/sun/star/uri/UriReferenceFactory.hpp>
#include <cppuhelper/supportsservice.hxx>
#include <comphelper/lok.hxx>

#include <uno/current_context.hxx>

#include <string.h>
#include <errno.h>
#include <unistd.h>

#if defined MACOSX
#include <sys/stat.h>
diff --git a/shell/source/win32/shlxthandler/propsheets/propsheets.cxx b/shell/source/win32/shlxthandler/propsheets/propsheets.cxx
index 12985d7..a14d499 100644
--- a/shell/source/win32/shlxthandler/propsheets/propsheets.cxx
+++ b/shell/source/win32/shlxthandler/propsheets/propsheets.cxx
@@ -27,6 +27,8 @@

#include <shellapi.h>

#include <sal/macros.h>

#include <memory>
#include <string>
#include <vector>
diff --git a/shell/source/win32/zipfile/zipfile.cxx b/shell/source/win32/zipfile/zipfile.cxx
index a1b2b40e..78c140d 100644
--- a/shell/source/win32/zipfile/zipfile.cxx
+++ b/shell/source/win32/zipfile/zipfile.cxx
@@ -31,6 +31,8 @@

#include <o3tl/safeint.hxx>

#include <zlib.h>

namespace
{