[Libreoffice-commits] core.git: 12 commits - connectivity/source dbaccess/source extensions/source filter/source framework/inc idl/inc idl/source include/editeng include/filter include/framework include/oox include/sfx2 include/sot include/svtools include/svx include/test include/tools include/vcl linguistic/source lotuswordpro/source oox/qa sc/inc sc/source sd/inc sd/source sfx2/source sot/source svl/source svtools/source svx/source sw/source test/source tools/qa tools/source vcl/source

Matteo Casalin matteo.casalin at yahoo.com
Tue Oct 27 12:59:45 UTC 2015


 connectivity/source/drivers/dbase/dindexnode.cxx      |    1 
 connectivity/source/inc/dbase/dindexnode.hxx          |    3 
 dbaccess/source/ui/inc/HtmlReader.hxx                 |    3 
 dbaccess/source/ui/inc/RtfReader.hxx                  |    3 
 dbaccess/source/ui/inc/TableRow.hxx                   |    2 
 dbaccess/source/ui/inc/TokenWriter.hxx                |    3 
 dbaccess/source/ui/misc/HtmlReader.cxx                |    1 
 dbaccess/source/ui/misc/RtfReader.cxx                 |    1 
 dbaccess/source/ui/misc/TokenWriter.cxx               |    1 
 dbaccess/source/ui/tabledesign/TableRow.cxx           |    1 
 extensions/source/scanner/scanner.hxx                 |    1 
 filter/source/graphicfilter/idxf/dxfgrprd.hxx         |    5 -
 filter/source/graphicfilter/itiff/ccidecom.cxx        |    1 
 filter/source/graphicfilter/itiff/ccidecom.hxx        |    5 -
 filter/source/graphicfilter/itiff/lzwdecom.cxx        |    1 
 filter/source/graphicfilter/itiff/lzwdecom.hxx        |    5 -
 filter/source/msfilter/dffpropset.cxx                 |    1 
 filter/source/msfilter/svxmsbas2.cxx                  |    6 -
 filter/source/msfilter/viscache.hxx                   |    3 
 filter/source/svg/svgwriter.hxx                       |    1 
 framework/inc/xml/imagesconfiguration.hxx             |    1 
 idl/inc/bastype.hxx                                   |    2 
 idl/source/objects/bastype.cxx                        |    1 
 include/editeng/editobj.hxx                           |    2 
 include/filter/msfilter/dffpropset.hxx                |    3 
 include/filter/msfilter/escherex.hxx                  |    4 
 include/filter/msfilter/svxmsbas.hxx                  |    4 
 include/framework/eventsconfiguration.hxx             |    1 
 include/framework/statusbarconfiguration.hxx          |    1 
 include/oox/ole/vbaexport.hxx                         |    4 
 include/sfx2/frmhtmlw.hxx                             |    2 
 include/sfx2/mnumgr.hxx                               |    1 
 include/sot/stg.hxx                                   |    6 -
 include/sot/storage.hxx                               |    6 -
 include/svtools/HtmlWriter.hxx                        |    3 
 include/svx/Palette.hxx                               |    2 
 include/svx/msdffdef.hxx                              |    2 
 include/svx/svdlayer.hxx                              |    1 
 include/svx/svdsob.hxx                                |    1 
 include/svx/xexch.hxx                                 |    3 
 include/test/xmlwriter.hxx                            |    2 
 include/tools/stream.hxx                              |    2 
 include/vcl/gfxlink.hxx                               |    3 
 include/vcl/graphicfilter.hxx                         |    2 
 include/vcl/graphictools.hxx                          |    3 
 include/vcl/ppdparser.hxx                             |    2 
 include/vcl/print.hxx                                 |    1 
 linguistic/source/dicimp.hxx                          |    2 
 lotuswordpro/source/filter/explode.cxx                |    5 -
 lotuswordpro/source/filter/explode.hxx                |    4 
 lotuswordpro/source/filter/lwpfilter.cxx              |    1 
 lotuswordpro/source/filter/lwpfilter.hxx              |    3 
 lotuswordpro/source/filter/lwpobjstrm.cxx             |    3 
 lotuswordpro/source/filter/lwpsdwfileloader.cxx       |    2 
 lotuswordpro/source/filter/lwpsdwfileloader.hxx       |    2 
 lotuswordpro/source/filter/lwpsdwgrouploaderv0102.cxx |    2 
 lotuswordpro/source/filter/lwpsdwgrouploaderv0102.hxx |    2 
 lotuswordpro/source/filter/lwpsvstream.cxx            |    1 
 lotuswordpro/source/filter/lwpsvstream.hxx            |    3 
 oox/qa/unit/vba_compression.cxx                       |   29 +++---
 sc/inc/address.hxx                                    |    1 
 sc/inc/grouparealistener.hxx                          |    2 
 sc/inc/userlist.hxx                                   |    1 
 sc/source/core/inc/jumpmatrix.hxx                     |    1 
 sc/source/filter/excel/expop2.cxx                     |    2 
 sc/source/filter/inc/xlstream.hxx                     |    1 
 sc/source/ui/dbgui/asciiopt.cxx                       |   82 ++++++++----------
 sc/source/ui/dbgui/csvsplits.cxx                      |   33 ++++---
 sc/source/ui/dbgui/scuiasciiopt.cxx                   |    9 +
 sc/source/ui/inc/asciiopt.hxx                         |   12 --
 sc/source/ui/inc/csvsplits.hxx                        |    6 -
 sc/source/ui/inc/scuiasciiopt.hxx                     |   16 +++
 sd/inc/cusshow.hxx                                    |    1 
 sd/source/filter/eppt/pptexsoundcollection.cxx        |    1 
 sd/source/filter/eppt/pptexsoundcollection.hxx        |    3 
 sd/source/filter/html/htmlex.cxx                      |    4 
 sd/source/filter/ppt/ppt97animations.cxx              |    1 
 sd/source/filter/ppt/ppt97animations.hxx              |    4 
 sfx2/source/bastyp/frmhtmlw.cxx                       |    1 
 sot/source/sdstor/stg.cxx                             |   16 +--
 sot/source/sdstor/stgcache.cxx                        |    2 
 sot/source/sdstor/stgcache.hxx                        |    6 -
 sot/source/sdstor/stgio.cxx                           |    6 -
 sot/source/sdstor/stgstrms.hxx                        |    6 -
 sot/source/sdstor/storage.cxx                         |    2 
 sot/source/sdstor/ucbstorage.cxx                      |   16 +--
 svl/source/inc/strmadpt.hxx                           |    1 
 svl/source/items/lckbitem.cxx                         |    1 
 svtools/source/svhtml/HtmlWriter.cxx                  |    1 
 svx/source/gallery2/galtheme.cxx                      |    4 
 svx/source/tbxctrls/Palette.cxx                       |    1 
 svx/source/xoutdev/xexch.cxx                          |    1 
 sw/source/core/edit/edglss.cxx                        |    5 -
 sw/source/core/inc/swfont.hxx                         |    1 
 sw/source/core/unocore/unoobj.cxx                     |   22 ++--
 sw/source/filter/html/htmlplug.cxx                    |    3 
 sw/source/filter/html/wrthtml.hxx                     |    1 
 sw/source/filter/ww8/WW8Sttbf.cxx                     |    1 
 sw/source/filter/ww8/WW8Sttbf.hxx                     |    3 
 sw/source/filter/ww8/ww8scan.cxx                      |    2 
 sw/source/filter/ww8/ww8scan.hxx                      |    3 
 test/source/xmlwriter.cxx                             |    1 
 tools/qa/cppunit/test_urlobj.cxx                      |   12 +-
 tools/source/stream/stream.cxx                        |    2 
 vcl/source/filter/graphicfilter.cxx                   |    3 
 vcl/source/gdi/gfxlink.cxx                            |    1 
 vcl/source/gdi/graphictools.cxx                       |    1 
 vcl/source/gdi/pdfwriter_impl.hxx                     |    3 
 vcl/source/gdi/pdfwriter_impl2.cxx                    |    1 
 109 files changed, 275 insertions(+), 206 deletions(-)

New commits:
commit 20635ed90b2f684757c480b3cff70547a0e06363
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sun Oct 11 18:21:11 2015 +0200

    Reduce scope of #include <tools/stream.hxx>
    
    Change-Id: I0752cbb0cb2e0f89607d81d9eda7ce7091449fd6

diff --git a/connectivity/source/drivers/dbase/dindexnode.cxx b/connectivity/source/drivers/dbase/dindexnode.cxx
index edbbf5c..da67032 100644
--- a/connectivity/source/drivers/dbase/dindexnode.cxx
+++ b/connectivity/source/drivers/dbase/dindexnode.cxx
@@ -22,6 +22,7 @@
 #include <osl/thread.h>
 #include "dbase/DIndex.hxx"
 #include <tools/debug.hxx>
+#include <tools/stream.hxx>
 
 #include <algorithm>
 #include <memory>
diff --git a/connectivity/source/inc/dbase/dindexnode.hxx b/connectivity/source/inc/dbase/dindexnode.hxx
index e4bc122..17e713e 100644
--- a/connectivity/source/inc/dbase/dindexnode.hxx
+++ b/connectivity/source/inc/dbase/dindexnode.hxx
@@ -23,12 +23,13 @@
 #include "file/FTable.hxx"
 #include <connectivity/FValue.hxx>
 #include <rtl/ref.hxx>
-#include <tools/stream.hxx>
 #include <vector>
 
 #define NODE_NOTFOUND 0xFFFF
 #define DINDEX_PAGE_SIZE 512
 
+class SvStream;
+
 namespace connectivity
 {
     namespace dbase
diff --git a/dbaccess/source/ui/inc/HtmlReader.hxx b/dbaccess/source/ui/inc/HtmlReader.hxx
index 78368ce..9c5ca32 100644
--- a/dbaccess/source/ui/inc/HtmlReader.hxx
+++ b/dbaccess/source/ui/inc/HtmlReader.hxx
@@ -22,10 +22,11 @@
 #include "DExport.hxx"
 #include <svtools/parhtml.hxx>
 #include <editeng/svxenum.hxx>
-#include <tools/stream.hxx>
 #include <com/sun/star/awt/FontDescriptor.hpp>
 #include <com/sun/star/uno/XComponentContext.hpp>
 
+class SvStream;
+
 namespace dbaui
 {
     class OHTMLReader : public HTMLParser, public ODatabaseExport
diff --git a/dbaccess/source/ui/inc/RtfReader.hxx b/dbaccess/source/ui/inc/RtfReader.hxx
index f0da719..fe8a02e 100644
--- a/dbaccess/source/ui/inc/RtfReader.hxx
+++ b/dbaccess/source/ui/inc/RtfReader.hxx
@@ -22,7 +22,8 @@
 #include <vector>
 #include <svtools/parrtf.hxx>
 #include "DExport.hxx"
-#include <tools/stream.hxx>
+
+class SvStream;
 
 namespace dbaui
 {
diff --git a/dbaccess/source/ui/inc/TableRow.hxx b/dbaccess/source/ui/inc/TableRow.hxx
index 9d18818..fa57cf0 100644
--- a/dbaccess/source/ui/inc/TableRow.hxx
+++ b/dbaccess/source/ui/inc/TableRow.hxx
@@ -19,10 +19,10 @@
 #ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_TABLEROW_HXX
 #define INCLUDED_DBACCESS_SOURCE_UI_INC_TABLEROW_HXX
 
-#include <tools/stream.hxx>
 #include <com/sun/star/beans/XPropertySet.hpp>
 #include "TypeInfo.hxx"
 
+class SvStream;
 
 namespace dbaui
 {
diff --git a/dbaccess/source/ui/inc/TokenWriter.hxx b/dbaccess/source/ui/inc/TokenWriter.hxx
index 91fc0c8..da97dfa 100644
--- a/dbaccess/source/ui/inc/TokenWriter.hxx
+++ b/dbaccess/source/ui/inc/TokenWriter.hxx
@@ -35,7 +35,6 @@
 #include <com/sun/star/uno/XComponentContext.hpp>
 
 #include <cppuhelper/implbase.hxx>
-#include <tools/stream.hxx>
 #include <svx/dataaccessdescriptor.hxx>
 
 namespace com { namespace sun { namespace star {
@@ -44,6 +43,8 @@ namespace com { namespace sun { namespace star {
     }
 }}}
 
+class SvStream;
+
 namespace dbaui
 {
     // ODatabaseImportExport base class for import/export
diff --git a/dbaccess/source/ui/misc/HtmlReader.cxx b/dbaccess/source/ui/misc/HtmlReader.cxx
index 4cc93a2..7d11395 100644
--- a/dbaccess/source/ui/misc/HtmlReader.cxx
+++ b/dbaccess/source/ui/misc/HtmlReader.cxx
@@ -21,6 +21,7 @@
 #include <connectivity/dbconversion.hxx>
 #include <connectivity/dbtools.hxx>
 #include <toolkit/helper/vclunohelper.hxx>
+#include <tools/stream.hxx>
 #include <tools/tenccvt.hxx>
 #include <comphelper/extract.hxx>
 #include <comphelper/string.hxx>
diff --git a/dbaccess/source/ui/misc/RtfReader.cxx b/dbaccess/source/ui/misc/RtfReader.cxx
index 963fd61..9dde360 100644
--- a/dbaccess/source/ui/misc/RtfReader.cxx
+++ b/dbaccess/source/ui/misc/RtfReader.cxx
@@ -19,6 +19,7 @@
 
 #include "RtfReader.hxx"
 #include <tools/debug.hxx>
+#include <tools/stream.hxx>
 #include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp>
 #include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
 #include <com/sun/star/sdbcx/XAppend.hpp>
diff --git a/dbaccess/source/ui/misc/TokenWriter.cxx b/dbaccess/source/ui/misc/TokenWriter.cxx
index a7fda1c..c90f206 100644
--- a/dbaccess/source/ui/misc/TokenWriter.cxx
+++ b/dbaccess/source/ui/misc/TokenWriter.cxx
@@ -20,6 +20,7 @@
 #include "TokenWriter.hxx"
 #include <tools/debug.hxx>
 #include <tools/diagnose_ex.h>
+#include <tools/stream.hxx>
 #include <osl/diagnose.h>
 #include "RtfReader.hxx"
 #include "HtmlReader.hxx"
diff --git a/dbaccess/source/ui/tabledesign/TableRow.cxx b/dbaccess/source/ui/tabledesign/TableRow.cxx
index 3f7d2e1..4a85ffe 100644
--- a/dbaccess/source/ui/tabledesign/TableRow.cxx
+++ b/dbaccess/source/ui/tabledesign/TableRow.cxx
@@ -19,6 +19,7 @@
 
 #include "TableRow.hxx"
 #include <tools/debug.hxx>
+#include <tools/stream.hxx>
 #include "FieldDescriptions.hxx"
 #include <algorithm>
 #include <comphelper/types.hxx>
diff --git a/extensions/source/scanner/scanner.hxx b/extensions/source/scanner/scanner.hxx
index 2603193..10b17bb 100644
--- a/extensions/source/scanner/scanner.hxx
+++ b/extensions/source/scanner/scanner.hxx
@@ -20,7 +20,6 @@
 #ifndef INCLUDED_EXTENSIONS_SOURCE_SCANNER_SCANNER_HXX
 #define INCLUDED_EXTENSIONS_SOURCE_SCANNER_SCANNER_HXX
 
-#include <tools/stream.hxx>
 #include <osl/mutex.hxx>
 #include <rtl/ustring.hxx>
 #include <cppuhelper/implbase.hxx>
diff --git a/filter/source/graphicfilter/idxf/dxfgrprd.hxx b/filter/source/graphicfilter/idxf/dxfgrprd.hxx
index de7e1c7..8228208 100644
--- a/filter/source/graphicfilter/idxf/dxfgrprd.hxx
+++ b/filter/source/graphicfilter/idxf/dxfgrprd.hxx
@@ -20,10 +20,11 @@
 #ifndef INCLUDED_FILTER_SOURCE_GRAPHICFILTER_IDXF_DXFGRPRD_HXX
 #define INCLUDED_FILTER_SOURCE_GRAPHICFILTER_IDXF_DXFGRPRD_HXX
 
+#include <rtl/string.hxx>
 #include <sal/types.h>
+#include <tools/solar.h>
 
-#include <tools/stream.hxx>
-
+class SvStream;
 
 class DXFGroupReader
 {
diff --git a/filter/source/graphicfilter/itiff/ccidecom.cxx b/filter/source/graphicfilter/itiff/ccidecom.cxx
index 44522ad..b7f455e 100644
--- a/filter/source/graphicfilter/itiff/ccidecom.cxx
+++ b/filter/source/graphicfilter/itiff/ccidecom.cxx
@@ -19,6 +19,7 @@
 
 
 #include "ccidecom.hxx"
+#include <tools/stream.hxx>
 
 //=============================== Huffman tables ========================
 
diff --git a/filter/source/graphicfilter/itiff/ccidecom.hxx b/filter/source/graphicfilter/itiff/ccidecom.hxx
index 3463686..c92769df 100644
--- a/filter/source/graphicfilter/itiff/ccidecom.hxx
+++ b/filter/source/graphicfilter/itiff/ccidecom.hxx
@@ -20,8 +20,8 @@
 #ifndef INCLUDED_FILTER_SOURCE_GRAPHICFILTER_ITIFF_CCIDECOM_HXX
 #define INCLUDED_FILTER_SOURCE_GRAPHICFILTER_ITIFF_CCIDECOM_HXX
 
-#include <tools/stream.hxx>
-
+#include <sal/types.h>
+#include <tools/solar.h>
 
 #define CCI_OPTION_2D               1       // 2D compression (instead of 1D)
 #define CCI_OPTION_EOL              2       // There are EOL-Codes at the end of each line.
@@ -43,6 +43,7 @@ struct CCILookUpTableEntry {
     sal_uInt16 nCodeBits;
 };
 
+class SvStream;
 
 class CCIDecompressor {
 
diff --git a/filter/source/graphicfilter/itiff/lzwdecom.cxx b/filter/source/graphicfilter/itiff/lzwdecom.cxx
index dc437e2..f07fb22 100644
--- a/filter/source/graphicfilter/itiff/lzwdecom.cxx
+++ b/filter/source/graphicfilter/itiff/lzwdecom.cxx
@@ -19,6 +19,7 @@
 
 
 #include "lzwdecom.hxx"
+#include <tools/stream.hxx>
 #include <algorithm>
 #include <set>
 
diff --git a/filter/source/graphicfilter/itiff/lzwdecom.hxx b/filter/source/graphicfilter/itiff/lzwdecom.hxx
index bce76b5..85d6f06 100644
--- a/filter/source/graphicfilter/itiff/lzwdecom.hxx
+++ b/filter/source/graphicfilter/itiff/lzwdecom.hxx
@@ -20,7 +20,8 @@
 #ifndef INCLUDED_FILTER_SOURCE_GRAPHICFILTER_ITIFF_LZWDECOM_HXX
 #define INCLUDED_FILTER_SOURCE_GRAPHICFILTER_ITIFF_LZWDECOM_HXX
 
-#include <tools/stream.hxx>
+#include <sal/types.h>
+#include <tools/solar.h>
 
 struct LZWTableEntry {
     sal_uInt16 nPrevCode;
@@ -28,6 +29,8 @@ struct LZWTableEntry {
     sal_uInt8 nData;
 };
 
+class SvStream;
+
 class LZWDecompressor {
 
 public:
diff --git a/filter/source/msfilter/dffpropset.cxx b/filter/source/msfilter/dffpropset.cxx
index 14cf018..a351733 100644
--- a/filter/source/msfilter/dffpropset.cxx
+++ b/filter/source/msfilter/dffpropset.cxx
@@ -20,6 +20,7 @@
 #include <algorithm>
 #include <filter/msfilter/dffpropset.hxx>
 #include <rtl/ustrbuf.hxx>
+#include <tools/stream.hxx>
 
 static const DffPropSetEntry mso_PropSetDefaults[] = {
 
diff --git a/filter/source/msfilter/viscache.hxx b/filter/source/msfilter/viscache.hxx
index 0e44b23..40dc36b 100644
--- a/filter/source/msfilter/viscache.hxx
+++ b/filter/source/msfilter/viscache.hxx
@@ -20,10 +20,11 @@
 #define INCLUDED_FILTER_SOURCE_MSFILTER_VISCACHE_HXX
 
 #include <sfx2/objsh.hxx>
-#include <tools/stream.hxx>
 #include <vcl/gdimtf.hxx>
 #include <vcl/bitmap.hxx>
 
+class SvStream;
+
 class Impl_OlePres
 {
     SotClipboardFormatId nFormat;
diff --git a/filter/source/svg/svgwriter.hxx b/filter/source/svg/svgwriter.hxx
index a9938f2..3509871 100644
--- a/filter/source/svg/svgwriter.hxx
+++ b/filter/source/svg/svgwriter.hxx
@@ -22,7 +22,6 @@
 
 #include <cppuhelper/implbase.hxx>
 #include <rtl/ustring.hxx>
-#include <tools/stream.hxx>
 #include <vcl/gdimtf.hxx>
 #include <vcl/metaact.hxx>
 #include <vcl/metric.hxx>
diff --git a/framework/inc/xml/imagesconfiguration.hxx b/framework/inc/xml/imagesconfiguration.hxx
index f5866c4..bcaedb3 100644
--- a/framework/inc/xml/imagesconfiguration.hxx
+++ b/framework/inc/xml/imagesconfiguration.hxx
@@ -21,7 +21,6 @@
 #define INCLUDED_FRAMEWORK_INC_XML_IMAGESCONFIGURATION_HXX
 
 #include <framework/fwedllapi.h>
-#include <tools/stream.hxx>
 #include <tools/color.hxx>
 
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
diff --git a/idl/inc/bastype.hxx b/idl/inc/bastype.hxx
index 36b957e..04335fd 100644
--- a/idl/inc/bastype.hxx
+++ b/idl/inc/bastype.hxx
@@ -23,10 +23,10 @@
 
 #include <sal/types.h>
 #include <tools/globname.hxx>
-#include <tools/stream.hxx>
 
 class SvStringHashEntry;
 class SvIdlDataBase;
+class SvStream;
 class SvTokenStream;
 
 class Svint
diff --git a/idl/source/objects/bastype.cxx b/idl/source/objects/bastype.cxx
index 1d3d070..2f7adac 100644
--- a/idl/source/objects/bastype.cxx
+++ b/idl/source/objects/bastype.cxx
@@ -26,6 +26,7 @@
 #include <hash.hxx>
 #include <database.hxx>
 #include <osl/diagnose.h>
+#include <tools/stream.hxx>
 
 static bool ReadRangeSvIdl( SvStringHashEntry * pName, SvTokenStream & rInStm,
                             sal_uLong nMin, sal_uLong nMax, sal_uLong* pValue )
diff --git a/include/editeng/editobj.hxx b/include/editeng/editobj.hxx
index 8c82eab..be36b01 100644
--- a/include/editeng/editobj.hxx
+++ b/include/editeng/editobj.hxx
@@ -20,7 +20,6 @@
 #ifndef INCLUDED_EDITENG_EDITOBJ_HXX
 #define INCLUDED_EDITENG_EDITOBJ_HXX
 
-#include <tools/stream.hxx>
 #include <rsc/rscsfx.hxx>
 #include <svl/itemset.hxx>
 #include <svl/itempool.hxx>
@@ -38,6 +37,7 @@ class SfxItemPool;
 class SfxStyleSheetPool;
 class SvxFieldItem;
 class SvxFieldData;
+class SvStream;
 
 namespace editeng {
 
diff --git a/include/filter/msfilter/dffpropset.hxx b/include/filter/msfilter/dffpropset.hxx
index 7e64a17..ff2173c 100644
--- a/include/filter/msfilter/dffpropset.hxx
+++ b/include/filter/msfilter/dffpropset.hxx
@@ -21,9 +21,10 @@
 
 #include <filter/msfilter/msfilterdllapi.h>
 #include <filter/msfilter/dffrecordheader.hxx>
-#include <tools/stream.hxx>
 #include <vector>
 
+class SvStream;
+
 struct DffPropFlags
 {
     bool   bSet        : 1;
diff --git a/include/filter/msfilter/escherex.hxx b/include/filter/msfilter/escherex.hxx
index d173f7b..852202b 100644
--- a/include/filter/msfilter/escherex.hxx
+++ b/include/filter/msfilter/escherex.hxx
@@ -24,7 +24,6 @@
 #include <vector>
 #include <tools/solar.h>
 #include <tools/gen.hxx>
-#include <tools/stream.hxx>
 #include <com/sun/star/uno/Reference.h>
 #include <svtools/grfmgr.hxx>
 #include <com/sun/star/awt/Size.hpp>
@@ -556,7 +555,8 @@ enum MSOPATHTYPE
 
 const sal_uInt32 DFF_DGG_CLUSTER_SIZE       = 0x00000400;   /// Shape IDs per cluster in DGG atom.
 
-
+class SvStream;
+class SvMemoryStream;
 
 namespace com { namespace sun { namespace star {
     namespace awt {
diff --git a/include/framework/eventsconfiguration.hxx b/include/framework/eventsconfiguration.hxx
index 45e8b2d..1d807f40 100644
--- a/include/framework/eventsconfiguration.hxx
+++ b/include/framework/eventsconfiguration.hxx
@@ -21,7 +21,6 @@
 #define INCLUDED_FRAMEWORK_EVENTSCONFIGURATION_HXX
 
 #include <framework/fwedllapi.h>
-#include <tools/stream.hxx>
 #include <com/sun/star/uno/Sequence.hxx>
 #include <com/sun/star/beans/PropertyValue.hpp>
 
diff --git a/include/framework/statusbarconfiguration.hxx b/include/framework/statusbarconfiguration.hxx
index 7abcc14..39b45c2 100644
--- a/include/framework/statusbarconfiguration.hxx
+++ b/include/framework/statusbarconfiguration.hxx
@@ -20,7 +20,6 @@
 #define INCLUDED_FRAMEWORK_STATUSBARCONFIGURATION_HXX
 
 #include <framework/fwedllapi.h>
-#include <tools/stream.hxx>
 #include <vcl/status.hxx>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <com/sun/star/io/XInputStream.hpp>
diff --git a/include/oox/ole/vbaexport.hxx b/include/oox/ole/vbaexport.hxx
index db63ce3..ddc911d 100644
--- a/include/oox/ole/vbaexport.hxx
+++ b/include/oox/ole/vbaexport.hxx
@@ -12,11 +12,11 @@
 
 #include <com/sun/star/uno/XInterface.hpp>
 
-#include <tools/stream.hxx>
-
 #include <oox/dllapi.h>
 
 class SotStorage;
+class SvStream;
+class SvMemoryStream;
 
 namespace com { namespace sun { namespace star {
     namespace container { class XNameContainer; }
diff --git a/include/sfx2/frmhtmlw.hxx b/include/sfx2/frmhtmlw.hxx
index e8de3ce..6e8161b 100644
--- a/include/sfx2/frmhtmlw.hxx
+++ b/include/sfx2/frmhtmlw.hxx
@@ -26,12 +26,12 @@
 #include <sfx2/frmdescr.hxx>
 #include <com/sun/star/uno/Reference.h>
 #include <com/sun/star/beans/XPropertySet.hpp>
-#include <tools/stream.hxx>
 #include <svtools/parhtml.hxx>
 #include <svtools/htmlout.hxx>
 #include <svtools/htmlkywd.hxx>
 
 class SfxFrame;
+class SvStream;
 
 namespace com { namespace sun { namespace star {
     namespace document {
diff --git a/include/sfx2/mnumgr.hxx b/include/sfx2/mnumgr.hxx
index 57dc874..2adb619 100644
--- a/include/sfx2/mnumgr.hxx
+++ b/include/sfx2/mnumgr.hxx
@@ -25,7 +25,6 @@
 #include <com/sun/star/embed/VerbDescriptor.hpp>
 #include <com/sun/star/uno/Sequence.hxx>
 
-#include <tools/stream.hxx>
 #include <tools/resid.hxx>
 #include <sfx2/sfx.hrc>
 
diff --git a/include/svtools/HtmlWriter.hxx b/include/svtools/HtmlWriter.hxx
index 3c065ff..ca5139c 100644
--- a/include/svtools/HtmlWriter.hxx
+++ b/include/svtools/HtmlWriter.hxx
@@ -13,10 +13,11 @@
 
 #include <rtl/string.hxx>
 #include <rtl/ustring.hxx>
-#include <tools/stream.hxx>
 #include <vector>
 #include <svtools/svtdllapi.h>
 
+class SvStream;
+
 class SVT_DLLPUBLIC HtmlWriter
 {
 private:
diff --git a/include/svx/Palette.hxx b/include/svx/Palette.hxx
index ef39190..9c50899 100644
--- a/include/svx/Palette.hxx
+++ b/include/svx/Palette.hxx
@@ -23,8 +23,8 @@
 #include <svx/xtable.hxx>
 #include <rtl/ustring.hxx>
 #include <tools/color.hxx>
-#include <tools/stream.hxx>
 
+class SvFileStream;
 
 typedef std::pair<Color, OUString> NamedColor;
 typedef std::vector< NamedColor > ColorList;
diff --git a/include/svx/msdffdef.hxx b/include/svx/msdffdef.hxx
index 60f9fab..7d4323b 100644
--- a/include/svx/msdffdef.hxx
+++ b/include/svx/msdffdef.hxx
@@ -20,9 +20,9 @@
 #ifndef INCLUDED_SVX_MSDFFDEF_HXX
 #define INCLUDED_SVX_MSDFFDEF_HXX
 
+#include <limits.h>
 #include <sal/types.h>
 #include <svx/svxdllapi.h>
-#include <tools/stream.hxx>
 
 #define DFF_COMMON_RECORD_HEADER_SIZE           8
 
diff --git a/include/svx/svdlayer.hxx b/include/svx/svdlayer.hxx
index a5184ed..d6f8c3a 100644
--- a/include/svx/svdlayer.hxx
+++ b/include/svx/svdlayer.hxx
@@ -20,7 +20,6 @@
 #ifndef INCLUDED_SVX_SVDLAYER_HXX
 #define INCLUDED_SVX_SVDLAYER_HXX
 
-#include <tools/stream.hxx>
 #include <svx/svdsob.hxx>
 #include <svx/svdtypes.hxx>
 #include <svx/svxdllapi.h>
diff --git a/include/svx/svdsob.hxx b/include/svx/svdsob.hxx
index 9612801..976165b0 100644
--- a/include/svx/svdsob.hxx
+++ b/include/svx/svdsob.hxx
@@ -21,7 +21,6 @@
 #define INCLUDED_SVX_SVDSOB_HXX
 
 #include <com/sun/star/uno/Any.hxx>
-#include <tools/stream.hxx>
 
 #include <svx/svxdllapi.h>
 
diff --git a/include/svx/xexch.hxx b/include/svx/xexch.hxx
index 800348e..ccee761 100644
--- a/include/svx/xexch.hxx
+++ b/include/svx/xexch.hxx
@@ -21,7 +21,6 @@
 #define INCLUDED_SVX_XEXCH_HXX
 
 
-#include <tools/stream.hxx>
 #include <svx/svxdllapi.h>
 
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@@ -30,7 +29,7 @@
 
 class XFillAttrSetItem;
 class SfxItemPool;
-
+class SvStream;
 
 
 class SVX_DLLPUBLIC XFillExchangeData
diff --git a/include/test/xmlwriter.hxx b/include/test/xmlwriter.hxx
index 243b7fc..836a123 100644
--- a/include/test/xmlwriter.hxx
+++ b/include/test/xmlwriter.hxx
@@ -16,7 +16,7 @@
 #include <rtl/ustring.hxx>
 #include <rtl/string.hxx>
 
-#include <tools/stream.hxx>
+class SvStream;
 
 class OOO_DLLPUBLIC_TEST XmlWriter
 {
diff --git a/include/vcl/gfxlink.hxx b/include/vcl/gfxlink.hxx
index 8c36ae3..eaf211d 100644
--- a/include/vcl/gfxlink.hxx
+++ b/include/vcl/gfxlink.hxx
@@ -21,12 +21,13 @@
 #define INCLUDED_VCL_GFXLINK_HXX
 
 #include <rtl/ustring.hxx>
-#include <tools/stream.hxx>
 #include <tools/gen.hxx>
 #include <tools/solar.h>
 #include <vcl/dllapi.h>
 #include <vcl/mapmod.hxx>
 
+class SvStream;
+
 
 // - ImpBuffer -
 
diff --git a/include/vcl/graphicfilter.hxx b/include/vcl/graphicfilter.hxx
index df5bd78..80f3cdc 100644
--- a/include/vcl/graphicfilter.hxx
+++ b/include/vcl/graphicfilter.hxx
@@ -21,7 +21,6 @@
 #define INCLUDED_VCL_GRAPHICFILTER_HXX
 
 #include <tools/gen.hxx>
-#include <tools/stream.hxx>
 #include <tools/urlobj.hxx>
 #include <vcl/dllapi.h>
 #include <vcl/field.hxx>
@@ -32,6 +31,7 @@
 #include <com/sun/star/beans/PropertyValue.hpp>
 
 class FilterConfigCache;
+class SvStream;
 struct WMF_EXTERNALHEADER;
 struct ConvertData;
 
diff --git a/include/vcl/graphictools.hxx b/include/vcl/graphictools.hxx
index 8bcb671..b3da273 100644
--- a/include/vcl/graphictools.hxx
+++ b/include/vcl/graphictools.hxx
@@ -25,12 +25,13 @@
 #include <rtl/string.hxx>
 #include <tools/color.hxx>
 #include <tools/poly.hxx>
-#include <tools/stream.hxx>
 #include <vcl/graph.hxx>
 
 #include <memory>
 #include <vector>
 
+class SvStream;
+
 /** Encapsulates geometry and associated attributes of a graphical 'pen stroke'
 
     @attention Widespread use is deprecated. See declarations above
diff --git a/include/vcl/ppdparser.hxx b/include/vcl/ppdparser.hxx
index 3f8f9c7..37cd298 100644
--- a/include/vcl/ppdparser.hxx
+++ b/include/vcl/ppdparser.hxx
@@ -23,9 +23,9 @@
 #include <unordered_map>
 #include <vector>
 
-#include <tools/stream.hxx>
 #include <rtl/string.hxx>
 #include <rtl/ustring.hxx>
+#include <tools/solar.h>
 #include <vcl/dllapi.h>
 
 #include <com/sun/star/lang/Locale.hpp>
diff --git a/include/vcl/print.hxx b/include/vcl/print.hxx
index 6246335..4ee1b94 100644
--- a/include/vcl/print.hxx
+++ b/include/vcl/print.hxx
@@ -29,7 +29,6 @@
 #include <vcl/prntypes.hxx>
 #include <vcl/jobset.hxx>
 #include <vcl/gdimtf.hxx>
-#include <tools/stream.hxx>
 #include <tools/multisel.hxx>
 
 #include <com/sun/star/beans/PropertyValue.hpp>
diff --git a/linguistic/source/dicimp.hxx b/linguistic/source/dicimp.hxx
index 9f594e4..e443d90 100644
--- a/linguistic/source/dicimp.hxx
+++ b/linguistic/source/dicimp.hxx
@@ -26,7 +26,7 @@
 
 #include <cppuhelper/implbase.hxx>
 #include <cppuhelper/interfacecontainer.h>
-#include <tools/stream.hxx>
+#include <tools/solar.h>
 
 #include "defs.hxx"
 #include "linguistic/misc.hxx"
diff --git a/lotuswordpro/source/filter/explode.cxx b/lotuswordpro/source/filter/explode.cxx
index 1ae4248..14a0663 100644
--- a/lotuswordpro/source/filter/explode.cxx
+++ b/lotuswordpro/source/filter/explode.cxx
@@ -53,9 +53,12 @@
  *
  *
  ************************************************************************/
-#include <assert.h>
+
 #include "explode.hxx"
+#include <tools/stream.hxx>
+#include <assert.h>
 #include <math.h>
+
     const static char Tree1String[][32] = {
         "101",
         "11",
diff --git a/lotuswordpro/source/filter/explode.hxx b/lotuswordpro/source/filter/explode.hxx
index 5cb5601..d5b0f51 100644
--- a/lotuswordpro/source/filter/explode.hxx
+++ b/lotuswordpro/source/filter/explode.hxx
@@ -56,7 +56,9 @@
 #ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_EXPLODE_HXX
 #define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_EXPLODE_HXX
 
-#include <tools/stream.hxx>
+#include <sal/types.h>
+
+class SvStream;
 
 class HuffmanTreeNode
 {
diff --git a/lotuswordpro/source/filter/lwpfilter.cxx b/lotuswordpro/source/filter/lwpfilter.cxx
index f84f700..79aa69b 100644
--- a/lotuswordpro/source/filter/lwpfilter.cxx
+++ b/lotuswordpro/source/filter/lwpfilter.cxx
@@ -67,6 +67,7 @@
 
 #include <osl/file.h>
 #include <osl/file.hxx>
+#include <tools/stream.hxx>
 #include <vcl/svapp.hxx>
 #include <xmloff/attrlist.hxx>
 #include <com/sun/star/io/IOException.hpp>
diff --git a/lotuswordpro/source/filter/lwpfilter.hxx b/lotuswordpro/source/filter/lwpfilter.hxx
index 8bba057..d976f3d 100644
--- a/lotuswordpro/source/filter/lwpfilter.hxx
+++ b/lotuswordpro/source/filter/lwpfilter.hxx
@@ -57,7 +57,8 @@
 #define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPFILTER_HXX
 
 #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
-#include <tools/stream.hxx>
+
+class SvStream;
 
 //test code
 int ReadWordproFile(SvStream &rStream, css::uno::Reference<css::xml::sax::XDocumentHandler>& XDoc);
diff --git a/lotuswordpro/source/filter/lwpobjstrm.cxx b/lotuswordpro/source/filter/lwpobjstrm.cxx
index 7344124c..1c4c6c6 100644
--- a/lotuswordpro/source/filter/lwpobjstrm.cxx
+++ b/lotuswordpro/source/filter/lwpobjstrm.cxx
@@ -56,6 +56,9 @@
 
 #include "lwpobjstrm.hxx"
 #include "lwptools.hxx"
+
+#include <sal/types.h>
+#include <tools/solar.h>
 #include <memory>
 
 /**
diff --git a/lotuswordpro/source/filter/lwpsdwfileloader.cxx b/lotuswordpro/source/filter/lwpsdwfileloader.cxx
index 2651868..b30097a 100644
--- a/lotuswordpro/source/filter/lwpsdwfileloader.cxx
+++ b/lotuswordpro/source/filter/lwpsdwfileloader.cxx
@@ -54,6 +54,8 @@
  *
  ************************************************************************/
 
+#include <tools/stream.hxx>
+
 #include "lwpsdwfileloader.hxx"
 #include "lwpsdwgrouploaderv0102.hxx"
 
diff --git a/lotuswordpro/source/filter/lwpsdwfileloader.hxx b/lotuswordpro/source/filter/lwpsdwfileloader.hxx
index df6ea55..a8edc62 100644
--- a/lotuswordpro/source/filter/lwpsdwfileloader.hxx
+++ b/lotuswordpro/source/filter/lwpsdwfileloader.hxx
@@ -62,11 +62,11 @@
 #include <vector>
 
 #include <rtl/ref.hxx>
-#include <tools/stream.hxx>
 
 #include "lwpheader.hxx"
 #include "xfilter/ixfstream.hxx"
 
+class SvStream;
 class XFFrame;
 class LwpGraphicObject;
 class LwpSdwFileLoader
diff --git a/lotuswordpro/source/filter/lwpsdwgrouploaderv0102.cxx b/lotuswordpro/source/filter/lwpsdwgrouploaderv0102.cxx
index 58725c9..d660cc5 100644
--- a/lotuswordpro/source/filter/lwpsdwgrouploaderv0102.cxx
+++ b/lotuswordpro/source/filter/lwpsdwgrouploaderv0102.cxx
@@ -54,6 +54,8 @@
  *
  ************************************************************************/
 
+#include <tools/stream.hxx>
+
 #include "lwpsdwgrouploaderv0102.hxx"
 #include "lwpdrawobj.hxx"
 #include "lwptools.hxx"
diff --git a/lotuswordpro/source/filter/lwpsdwgrouploaderv0102.hxx b/lotuswordpro/source/filter/lwpsdwgrouploaderv0102.hxx
index c3a42e4..718e0f2 100644
--- a/lotuswordpro/source/filter/lwpsdwgrouploaderv0102.hxx
+++ b/lotuswordpro/source/filter/lwpsdwgrouploaderv0102.hxx
@@ -60,11 +60,11 @@
 #include <sal/config.h>
 
 #include <rtl/ref.hxx>
-#include <tools/stream.hxx>
 
 #include "lwpheader.hxx"
 #include "lwpsdwdrawheader.hxx"
 
+class SvStream;
 class XFFrame;
 class XFDrawGroup;
 class LwpGraphicObject;
diff --git a/lotuswordpro/source/filter/lwpsvstream.cxx b/lotuswordpro/source/filter/lwpsvstream.cxx
index e49b8b1..6c3b285 100644
--- a/lotuswordpro/source/filter/lwpsvstream.cxx
+++ b/lotuswordpro/source/filter/lwpsvstream.cxx
@@ -54,6 +54,7 @@
  *
  ************************************************************************/
 #include "lwpsvstream.hxx"
+#include <tools/stream.hxx>
 
 const sal_uInt32 LwpSvStream::LWP_STREAM_BASE = 0x0010;
 
diff --git a/lotuswordpro/source/filter/lwpsvstream.hxx b/lotuswordpro/source/filter/lwpsvstream.hxx
index 40cb435..d7ccb52 100644
--- a/lotuswordpro/source/filter/lwpsvstream.hxx
+++ b/lotuswordpro/source/filter/lwpsvstream.hxx
@@ -58,7 +58,8 @@
 
 #include "lwpheader.hxx"
 #include "xfilter/xfglobal.hxx"
-#include <tools/stream.hxx>
+
+class SvStream;
 
 /**
  * @brief   encapsulate XInputStream to provide SvStream like interfaces
diff --git a/oox/qa/unit/vba_compression.cxx b/oox/qa/unit/vba_compression.cxx
index ff50f07..e5d8cce 100644
--- a/oox/qa/unit/vba_compression.cxx
+++ b/oox/qa/unit/vba_compression.cxx
@@ -14,6 +14,7 @@
 #include <cppunit/TestFixture.h>
 
 #include <oox/ole/vbaexport.hxx>
+#include <tools/stream.hxx>
 #include <algorithm>
 
 class TestVbaCompression : public test::BootstrapFixtureBase
diff --git a/sc/inc/address.hxx b/sc/inc/address.hxx
index 460ca2c..bacbbd5a 100644
--- a/sc/inc/address.hxx
+++ b/sc/inc/address.hxx
@@ -20,7 +20,6 @@
 #ifndef INCLUDED_SC_INC_ADDRESS_HXX
 #define INCLUDED_SC_INC_ADDRESS_HXX
 
-#include <tools/stream.hxx>
 #include <rtl/ustrbuf.hxx>
 #include <rtl/strbuf.hxx>
 #include <osl/endian.h>
diff --git a/sc/inc/grouparealistener.hxx b/sc/inc/grouparealistener.hxx
index 99ade31..5c6fee9 100644
--- a/sc/inc/grouparealistener.hxx
+++ b/sc/inc/grouparealistener.hxx
@@ -16,6 +16,8 @@
 #include <svl/listener.hxx>
 #include <vector>
 
+#include <vector>
+
 class ScFormulaCell;
 class ScDocument;
 class ScColumn;
diff --git a/sc/inc/userlist.hxx b/sc/inc/userlist.hxx
index d47e795..f174b36 100644
--- a/sc/inc/userlist.hxx
+++ b/sc/inc/userlist.hxx
@@ -20,7 +20,6 @@
 #ifndef INCLUDED_SC_INC_USERLIST_HXX
 #define INCLUDED_SC_INC_USERLIST_HXX
 
-#include <tools/stream.hxx>
 #include "scdllapi.h"
 
 #include <boost/ptr_container/ptr_vector.hpp>
diff --git a/sc/source/core/inc/jumpmatrix.hxx b/sc/source/core/inc/jumpmatrix.hxx
index 9d28083..cbc72f2 100644
--- a/sc/source/core/inc/jumpmatrix.hxx
+++ b/sc/source/core/inc/jumpmatrix.hxx
@@ -22,6 +22,7 @@
 
 #include <formula/token.hxx>
 #include <formula/errorcodes.hxx>
+#include <limits.h>
 #include <vector>
 #include "types.hxx"
 #include "address.hxx"
diff --git a/sc/source/filter/inc/xlstream.hxx b/sc/source/filter/inc/xlstream.hxx
index 27ee00b..0f63f32 100644
--- a/sc/source/filter/inc/xlstream.hxx
+++ b/sc/source/filter/inc/xlstream.hxx
@@ -20,7 +20,6 @@
 #ifndef INCLUDED_SC_SOURCE_FILTER_INC_XLSTREAM_HXX
 #define INCLUDED_SC_SOURCE_FILTER_INC_XLSTREAM_HXX
 
-#include <tools/stream.hxx>
 #include <svx/svxerr.hxx>
 #include "ftools.hxx"
 
diff --git a/sd/inc/cusshow.hxx b/sd/inc/cusshow.hxx
index cad138e..1f40602 100644
--- a/sd/inc/cusshow.hxx
+++ b/sd/inc/cusshow.hxx
@@ -21,7 +21,6 @@
 #define INCLUDED_SD_INC_CUSSHOW_HXX
 
 #include <vector>
-#include <tools/stream.hxx>
 #include <cppuhelper/weakref.hxx>
 #include "sddllapi.h"
 
diff --git a/sd/source/filter/eppt/pptexsoundcollection.cxx b/sd/source/filter/eppt/pptexsoundcollection.cxx
index 0e89585..9f96da4 100644
--- a/sd/source/filter/eppt/pptexsoundcollection.cxx
+++ b/sd/source/filter/eppt/pptexsoundcollection.cxx
@@ -19,6 +19,7 @@
 
 #include <pptexsoundcollection.hxx>
 #include "epptdef.hxx"
+#include <tools/stream.hxx>
 #include <tools/urlobj.hxx>
 #include <ucbhelper/content.hxx>
 #include <comphelper/processfactory.hxx>
diff --git a/sd/source/filter/eppt/pptexsoundcollection.hxx b/sd/source/filter/eppt/pptexsoundcollection.hxx
index 693e175..2d9b20b 100644
--- a/sd/source/filter/eppt/pptexsoundcollection.hxx
+++ b/sd/source/filter/eppt/pptexsoundcollection.hxx
@@ -26,7 +26,8 @@
 #include <stdio.h>
 #endif
 #include <rtl/ustring.hxx>
-#include <tools/stream.hxx>
+
+class SvStream;
 
 namespace ppt
 {
diff --git a/sd/source/filter/ppt/ppt97animations.cxx b/sd/source/filter/ppt/ppt97animations.cxx
index e216cbf..7422ee9 100644
--- a/sd/source/filter/ppt/ppt97animations.cxx
+++ b/sd/source/filter/ppt/ppt97animations.cxx
@@ -22,6 +22,7 @@
 #include <svx/svdobj.hxx>
 #include "sdpage.hxx"
 #include <tools/debug.hxx>
+#include <tools/stream.hxx>
 #include <svx/unoapi.hxx>
 #include "EffectMigration.hxx"
 #include <CustomAnimationPreset.hxx>
diff --git a/sd/source/filter/ppt/ppt97animations.hxx b/sd/source/filter/ppt/ppt97animations.hxx
index 34118da..1668ffc 100644
--- a/sd/source/filter/ppt/ppt97animations.hxx
+++ b/sd/source/filter/ppt/ppt97animations.hxx
@@ -20,10 +20,12 @@
 #ifndef INCLUDED_SD_SOURCE_FILTER_PPT_PPT97ANIMATIONS_HXX
 #define INCLUDED_SD_SOURCE_FILTER_PPT_PPT97ANIMATIONS_HXX
 
-#include <tools/stream.hxx>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
 
 class SdrObject;
 class Ppt97Animation;
+class SvStream;
 
 /// helper class for reading PPT AnimationInfoAtom
 class Ppt97AnimationInfoAtom
diff --git a/sfx2/source/bastyp/frmhtmlw.cxx b/sfx2/source/bastyp/frmhtmlw.cxx
index 568c380..3235740 100644
--- a/sfx2/source/bastyp/frmhtmlw.cxx
+++ b/sfx2/source/bastyp/frmhtmlw.cxx
@@ -24,6 +24,7 @@
 #include <unotools/configmgr.hxx>
 #include <svl/urihelper.hxx>
 #include <tools/datetime.hxx>
+#include <tools/stream.hxx>
 
 #include <sfx2/frmhtmlw.hxx>
 #include <sfx2/evntconf.hxx>
diff --git a/svl/source/inc/strmadpt.hxx b/svl/source/inc/strmadpt.hxx
index c91d61c..ef1771f 100644
--- a/svl/source/inc/strmadpt.hxx
+++ b/svl/source/inc/strmadpt.hxx
@@ -23,7 +23,6 @@
 #include <sal/config.h>
 
 #include <com/sun/star/io/XOutputStream.hpp>
-#include <tools/stream.hxx>
 
 
 class SvOutputStreamOpenLockBytes: public SvOpenLockBytes
diff --git a/svl/source/items/lckbitem.cxx b/svl/source/items/lckbitem.cxx
index 169219f..faeeae6 100644
--- a/svl/source/items/lckbitem.cxx
+++ b/svl/source/items/lckbitem.cxx
@@ -19,6 +19,7 @@
 
 #include <svl/lckbitem.hxx>
 #include <svl/poolitem.hxx>
+#include <tools/stream.hxx>
 #include <osl/diagnose.h>
 #include <com/sun/star/uno/Any.hxx>
 #include <com/sun/star/uno/Sequence.hxx>
diff --git a/svtools/source/svhtml/HtmlWriter.cxx b/svtools/source/svhtml/HtmlWriter.cxx
index f075d40..3435b60 100644
--- a/svtools/source/svhtml/HtmlWriter.cxx
+++ b/svtools/source/svhtml/HtmlWriter.cxx
@@ -9,6 +9,7 @@
  */
 
 #include <svtools/HtmlWriter.hxx>
+#include <tools/stream.hxx>
 
 HtmlWriter::HtmlWriter(SvStream& rStream) :
     mrStream(rStream),
diff --git a/svx/source/tbxctrls/Palette.cxx b/svx/source/tbxctrls/Palette.cxx
index a333678..4fc1f3b 100644
--- a/svx/source/tbxctrls/Palette.cxx
+++ b/svx/source/tbxctrls/Palette.cxx
@@ -18,6 +18,7 @@
  */
 
 #include <svx/Palette.hxx>
+#include <tools/stream.hxx>
 
 
 Palette::~Palette()
diff --git a/svx/source/xoutdev/xexch.cxx b/svx/source/xoutdev/xexch.cxx
index 69c0016..7e61827 100644
--- a/svx/source/xoutdev/xexch.cxx
+++ b/svx/source/xoutdev/xexch.cxx
@@ -18,6 +18,7 @@
  */
 
 #include <sot/formats.hxx>
+#include <tools/stream.hxx>
 #include <tools/vcompat.hxx>
 #include <svx/xflasit.hxx>
 #include <svx/xfillit0.hxx>
diff --git a/sw/source/core/inc/swfont.hxx b/sw/source/core/inc/swfont.hxx
index b1dc397..960f5bd 100644
--- a/sw/source/core/inc/swfont.hxx
+++ b/sw/source/core/inc/swfont.hxx
@@ -21,7 +21,6 @@
 
 #include <i18nlangtag/lang.h>
 #include <tools/color.hxx>
-#include <tools/stream.hxx>
 #include <tools/gen.hxx>
 #include <editeng/svxfont.hxx>
 #include <swtypes.hxx>
diff --git a/sw/source/filter/html/wrthtml.hxx b/sw/source/filter/html/wrthtml.hxx
index 2f8fe1b..cb77d85 100644
--- a/sw/source/filter/html/wrthtml.hxx
+++ b/sw/source/filter/html/wrthtml.hxx
@@ -28,7 +28,6 @@
 #include <com/sun/star/form/XForm.hpp>
 #include <vcl/field.hxx>
 #include <i18nlangtag/lang.h>
-#include <tools/stream.hxx>
 #include <comphelper/stl_types.hxx>
 #include <o3tl/sorted_vector.hxx>
 
diff --git a/sw/source/filter/ww8/WW8Sttbf.cxx b/sw/source/filter/ww8/WW8Sttbf.cxx
index abb57bb..8d985cc 100644
--- a/sw/source/filter/ww8/WW8Sttbf.cxx
+++ b/sw/source/filter/ww8/WW8Sttbf.cxx
@@ -24,6 +24,7 @@
 #include <cstdio>
 #include <osl/endian.h>
 #include <rtl/ustrbuf.hxx>
+#include <tools/stream.hxx>
 
 namespace ww8
 {
diff --git a/sw/source/filter/ww8/WW8Sttbf.hxx b/sw/source/filter/ww8/WW8Sttbf.hxx
index 8c50744..744e4d9 100644
--- a/sw/source/filter/ww8/WW8Sttbf.hxx
+++ b/sw/source/filter/ww8/WW8Sttbf.hxx
@@ -25,9 +25,10 @@
 #include <boost/shared_array.hpp>
 #include <tools/solar.h>
 #include <rtl/ustring.hxx>
-#include <tools/stream.hxx>
 #include <IDocumentExternalData.hxx>
 
+class SvStream;
+
 namespace ww8
 {
 
diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx
index 5df35f9..8f9cc49 100644
--- a/sw/source/filter/ww8/ww8scan.cxx
+++ b/sw/source/filter/ww8/ww8scan.cxx
@@ -40,6 +40,8 @@
 #include <i18nlangtag/lang.h>
 #include <editeng/unolingu.hxx>
 
+#include <tools/stream.hxx>
+
 #include <vcl/settings.hxx>
 #include <vcl/svapp.hxx>
 
diff --git a/sw/source/filter/ww8/ww8scan.hxx b/sw/source/filter/ww8/ww8scan.hxx
index c4ca1d6..c74624a 100644
--- a/sw/source/filter/ww8/ww8scan.hxx
+++ b/sw/source/filter/ww8/ww8scan.hxx
@@ -32,7 +32,6 @@
 #include <vector>
 
 #include <tools/solar.h>
-#include <tools/stream.hxx>
 #include <rtl/ustring.hxx>
 #include "sortedarray.hxx"
 
@@ -41,6 +40,8 @@
 
 #include <unomid.h>
 
+class SvStream;
+
 //--Line below which the code has meaningful comments
 
 //Commonly used string literals for stream and storage names in word docs
diff --git a/test/source/xmlwriter.cxx b/test/source/xmlwriter.cxx
index de3b901..80f6399 100644
--- a/test/source/xmlwriter.cxx
+++ b/test/source/xmlwriter.cxx
@@ -18,6 +18,7 @@
  */
 
 #include <libxml/xmlstring.h>
+#include <tools/stream.hxx>
 #include <test/xmlwriter.hxx>
 
 namespace
diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx
index 7b76399..fc735b5 100644
--- a/vcl/source/filter/graphicfilter.cxx
+++ b/vcl/source/filter/graphicfilter.cxx
@@ -24,9 +24,10 @@
 #include <comphelper/string.hxx>
 #include <ucbhelper/content.hxx>
 #include <cppuhelper/implbase.hxx>
+#include <tools/fract.hxx>
+#include <tools/stream.hxx>
 #include <tools/urlobj.hxx>
 #include <tools/zcodec.hxx>
-#include <tools/fract.hxx>
 #include <vcl/dibtools.hxx>
 #include <vcl/salctype.hxx>
 #include <vcl/pngread.hxx>
diff --git a/vcl/source/gdi/gfxlink.cxx b/vcl/source/gdi/gfxlink.cxx
index 62aa6bf..26a69d2 100644
--- a/vcl/source/gdi/gfxlink.cxx
+++ b/vcl/source/gdi/gfxlink.cxx
@@ -18,6 +18,7 @@
  */
 
 #include <osl/file.h>
+#include <tools/stream.hxx>
 #include <tools/vcompat.hxx>
 #include <tools/debug.hxx>
 #include <unotools/ucbstreamhelper.hxx>
diff --git a/vcl/source/gdi/graphictools.cxx b/vcl/source/gdi/graphictools.cxx
index bc60fa0..a998792 100644
--- a/vcl/source/gdi/graphictools.cxx
+++ b/vcl/source/gdi/graphictools.cxx
@@ -17,6 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <tools/stream.hxx>
 #include <tools/vcompat.hxx>
 
 #include <vcl/graphictools.hxx>
diff --git a/vcl/source/gdi/pdfwriter_impl.hxx b/vcl/source/gdi/pdfwriter_impl.hxx
index 7b2adef..d5421cd 100644
--- a/vcl/source/gdi/pdfwriter_impl.hxx
+++ b/vcl/source/gdi/pdfwriter_impl.hxx
@@ -33,7 +33,6 @@
 #include <rtl/strbuf.hxx>
 #include <rtl/ustring.hxx>
 #include <tools/gen.hxx>
-#include <tools/stream.hxx>
 #include <vcl/bitmapex.hxx>
 #include <vcl/gradient.hxx>
 #include <vcl/hatch.hxx>
@@ -53,6 +52,8 @@ class ZCodec;
 class EncHashTransporter;
 struct BitStreamState;
 class PhysicalFontFace;
+class SvStream;
+class SvMemoryStream;
 
 // the maximum password length
 #define ENCRYPTED_PWD_SIZE     32
diff --git a/vcl/source/gdi/pdfwriter_impl2.cxx b/vcl/source/gdi/pdfwriter_impl2.cxx
index 836c5d4..f7c3d27 100644
--- a/vcl/source/gdi/pdfwriter_impl2.cxx
+++ b/vcl/source/gdi/pdfwriter_impl2.cxx
@@ -31,6 +31,7 @@
 #include "unotools/streamwrap.hxx"
 
 #include <tools/fract.hxx>
+#include <tools/stream.hxx>
 
 #include "comphelper/processfactory.hxx"
 
commit 7e89e2827489d0b3bbd488f6c9e5a9e7e404d732
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sun Oct 4 11:34:57 2015 +0200

    sal_uIntPtr to sal_uInt64, sal_uLong to sal_Size for streams
    
    Change-Id: I062f1f6c5b20ca47734a9a3cd1a229d51763a206

diff --git a/include/tools/stream.hxx b/include/tools/stream.hxx
index 2ac01db..9867a37 100644
--- a/include/tools/stream.hxx
+++ b/include/tools/stream.hxx
@@ -695,7 +695,7 @@ public:
     virtual void    ResetError() override;
 
     const void*    GetBuffer();
-    sal_uIntPtr     GetSize();
+    sal_uInt64     GetSize();
     sal_Size        GetEndOfData() const { return nEndOfData; }
     const void*     GetData() { Flush(); return pBuf; }
     operator const  void*() { Flush(); return pBuf; }
diff --git a/oox/qa/unit/vba_compression.cxx b/oox/qa/unit/vba_compression.cxx
index f31dc3b..ff50f07 100644
--- a/oox/qa/unit/vba_compression.cxx
+++ b/oox/qa/unit/vba_compression.cxx
@@ -96,9 +96,9 @@ void TestVbaCompression::testSimple1()
     const sal_uInt8* pReferenceData = static_cast<const sal_uInt8*>( aReferenceMemoryStream.GetData() );
     const sal_uInt8* pData = static_cast<const sal_uInt8*>( aOutputMemoryStream.GetData() );
 
-    size_t nSize = std::min(aReferenceMemoryStream.GetSize(),
+    const sal_uInt64 nSize = std::min(aReferenceMemoryStream.GetSize(),
             aOutputMemoryStream.GetSize());
-    for (size_t i = 0; i < nSize; ++i)
+    for (sal_uInt64 i = 0; i < nSize; ++i)
     {
         CPPUNIT_ASSERT_EQUAL((int)pReferenceData[i], (int)pData[i]);
     }
@@ -118,9 +118,9 @@ void TestVbaCompression::testSimple2()
     const sal_uInt8* pReferenceData = static_cast<const sal_uInt8*>( aReferenceMemoryStream.GetData() );
     const sal_uInt8* pData = static_cast<const sal_uInt8*>( aOutputMemoryStream.GetData() );
 
-    size_t nSize = std::min(aReferenceMemoryStream.GetSize(),
+    const sal_uInt64 nSize = std::min(aReferenceMemoryStream.GetSize(),
             aOutputMemoryStream.GetSize());
-    for (size_t i = 0; i < nSize; ++i)
+    for (sal_uInt64 i = 0; i < nSize; ++i)
     {
         CPPUNIT_ASSERT_EQUAL((int)pReferenceData[i], (int)pData[i]);
     }
@@ -140,9 +140,9 @@ void TestVbaCompression::testSimple3()
     const sal_uInt8* pReferenceData = static_cast<const sal_uInt8*>( aReferenceMemoryStream.GetData()  );
     const sal_uInt8* pData = static_cast<const sal_uInt8*>( aOutputMemoryStream.GetData() );
 
-    size_t nSize = std::min(aReferenceMemoryStream.GetSize(),
+    const sal_uInt64 nSize = std::min(aReferenceMemoryStream.GetSize(),
             aOutputMemoryStream.GetSize());
-    for (size_t i = 0; i < nSize; ++i)
+    for (sal_uInt64 i = 0; i < nSize; ++i)
     {
         CPPUNIT_ASSERT_EQUAL((int)pReferenceData[i], (int)pData[i]);
     }
@@ -162,9 +162,9 @@ void TestVbaCompression::testComplex1()
     const sal_uInt8* pReferenceData = static_cast<const sal_uInt8*>( aReferenceMemoryStream.GetData() );
     const sal_uInt8* pData = static_cast<const sal_uInt8*>( aOutputMemoryStream.GetData() );
 
-    size_t nSize = std::min(aReferenceMemoryStream.GetSize(),
+    const sal_uInt64 nSize = std::min(aReferenceMemoryStream.GetSize(),
             aOutputMemoryStream.GetSize());
-    for (size_t i = 0; i < nSize; ++i)
+    for (sal_uInt64 i = 0; i < nSize; ++i)
     {
         CPPUNIT_ASSERT_EQUAL((int)pReferenceData[i], (int)pData[i]);
     }
@@ -184,9 +184,9 @@ void TestVbaCompression::testSpec321()
     const sal_uInt8* pReferenceData = static_cast<const sal_uInt8*>( aReferenceMemoryStream.GetData() );
     const sal_uInt8* pData = static_cast<const sal_uInt8*>( aOutputMemoryStream.GetData() );
 
-    size_t nSize = std::min(aReferenceMemoryStream.GetSize(),
+    const sal_uInt64 nSize = std::min(aReferenceMemoryStream.GetSize(),
             aOutputMemoryStream.GetSize());
-    for (size_t i = 0; i < nSize; ++i)
+    for (sal_uInt64 i = 0; i < nSize; ++i)
     {
         CPPUNIT_ASSERT_EQUAL((int)pReferenceData[i], (int)pData[i]);
     }
@@ -206,9 +206,9 @@ void TestVbaCompression::testSpec322()
     const sal_uInt8* pReferenceData = static_cast<const sal_uInt8*>( aReferenceMemoryStream.GetData() );
     const sal_uInt8* pData = static_cast<const sal_uInt8*>( aOutputMemoryStream.GetData() );
 
-    size_t nSize = std::min(aReferenceMemoryStream.GetSize(),
+    const sal_uInt64 nSize = std::min(aReferenceMemoryStream.GetSize(),
             aOutputMemoryStream.GetSize());
-    for (size_t i = 0; i < nSize; ++i)
+    for (sal_uInt64 i = 0; i < nSize; ++i)
     {
         CPPUNIT_ASSERT_EQUAL((int)pReferenceData[i], (int)pData[i]);
     }
@@ -228,9 +228,9 @@ void TestVbaCompression::testSpec323()
     const sal_uInt8* pReferenceData = static_cast<const sal_uInt8*>( aReferenceMemoryStream.GetData() );
     const sal_uInt8* pData = static_cast<const sal_uInt8*>( aOutputMemoryStream.GetData() );
 
-    size_t nSize = std::min(aReferenceMemoryStream.GetSize(),
+    const sal_uInt64 nSize = std::min(aReferenceMemoryStream.GetSize(),
             aOutputMemoryStream.GetSize());
-    for (size_t i = 0; i < nSize; ++i)
+    for (sal_uInt64 i = 0; i < nSize; ++i)
     {
         CPPUNIT_ASSERT_EQUAL((int)pReferenceData[i], (int)pData[i]);
     }
diff --git a/sd/source/filter/html/htmlex.cxx b/sd/source/filter/html/htmlex.cxx
index 56f4caf..a52d5b3 100644
--- a/sd/source/filter/html/htmlex.cxx
+++ b/sd/source/filter/html/htmlex.cxx
@@ -1080,7 +1080,9 @@ OUString HtmlExport::DocumentMetadata() const
             "  ", RTL_TEXTENCODING_UTF8,
             &aNonConvertableCharacters);
 
-    OString aData(static_cast<const char*>(aStream.GetData()), aStream.GetSize());
+    const sal_uInt64 nLen = aStream.GetSize();
+    OSL_ENSURE(nLen < static_cast<sal_uInt64>(SAL_MAX_INT32), "Stream can't fit in OString");
+    OString aData(static_cast<const char*>(aStream.GetData()), static_cast<sal_Int32>(nLen));
 
     return OStringToOUString(aData, RTL_TEXTENCODING_UTF8);
 }
diff --git a/sot/source/sdstor/stgstrms.hxx b/sot/source/sdstor/stgstrms.hxx
index b3c8a18..94f3049 100644
--- a/sot/source/sdstor/stgstrms.hxx
+++ b/sot/source/sdstor/stgstrms.hxx
@@ -145,8 +145,8 @@ class StgTmpStrm : public SvMemoryStream
     OUString m_aName;
     SvFileStream* m_pStrm;
     using SvMemoryStream::GetData;
-    virtual sal_uLong GetData( void* pData, sal_uLong nSize ) override;
-    virtual sal_uLong PutData( const void* pData, sal_uLong nSize ) override;
+    virtual sal_Size GetData( void* pData, sal_Size nSize ) override;
+    virtual sal_Size PutData( const void* pData, sal_Size nSize ) override;
     virtual sal_uInt64 SeekPos( sal_uInt64 nPos ) override;
     virtual void FlushData() override;
 
@@ -155,7 +155,7 @@ public:
     virtual ~StgTmpStrm();
     bool Copy( StgTmpStrm& );
     virtual void SetSize( sal_uInt64 ) override;
-    sal_uLong GetSize() const;
+    sal_uInt64 GetSize() const;
 };
 
 #endif
diff --git a/sw/source/core/edit/edglss.cxx b/sw/source/core/edit/edglss.cxx
index 01d4522..5ffbdfc 100644
--- a/sw/source/core/edit/edglss.cxx
+++ b/sw/source/core/edit/edglss.cxx
@@ -325,8 +325,9 @@ bool SwEditShell::GetSelectedText( OUString &rBuf, int nHndlParaBrk )
                     rBuf = OUString(p);
                 else
                 {
-                    sal_Size nLen = aStream.GetSize();
-                    rtl_uString *pStr = rtl_uString_alloc(nLen / sizeof( sal_Unicode ));
+                    const sal_uInt64 nLen = aStream.GetSize();
+                    OSL_ENSURE( nLen/sizeof( sal_Unicode )<static_cast<sal_uInt64>(SAL_MAX_INT32), "Stream can't fit in OUString" );
+                    rtl_uString *pStr = rtl_uString_alloc(static_cast<sal_Int32>(nLen / sizeof( sal_Unicode )));
                     aStream.Seek( 0 );
                     aStream.ResetError();
                     //endian specific?, yipes!
diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx
index 6dc51fd..5309a62 100644
--- a/sw/source/core/unocore/unoobj.cxx
+++ b/sw/source/core/unocore/unoobj.cxx
@@ -187,20 +187,20 @@ void SwUnoCursorHelper::GetTextFromPam(SwPaM & rPam, OUString & rBuffer)
         const bool bOldShowProgress = xWrt->bShowProgress;
         xWrt->bShowProgress = false;
 
-        long lLen;
-        if( !IsError( aWriter.Write( xWrt ) ) &&
-            0x7ffffff > (( lLen  = aStream.GetSize() )
-                                    / sizeof( sal_Unicode )) + 1 )
+        if( !IsError( aWriter.Write( xWrt ) ) )
         {
-            aStream.WriteUInt16( '\0' );
+            const sal_uInt64 lUniLen = aStream.GetSize()/sizeof( sal_Unicode );
+            if (lUniLen < static_cast<sal_uInt64>(SAL_MAX_INT32-1))
+            {
+                aStream.WriteUInt16( '\0' );
 
-            aStream.Seek( 0 );
-            aStream.ResetError();
+                aStream.Seek( 0 );
+                aStream.ResetError();
 
-            long lUniLen = (lLen / sizeof( sal_Unicode ));
-            rtl_uString *pStr = rtl_uString_alloc(lUniLen);
-            aStream.Read(pStr->buffer, lUniLen * sizeof(sal_Unicode));
-            rBuffer = OUString(pStr, SAL_NO_ACQUIRE);
+                rtl_uString *pStr = rtl_uString_alloc(lUniLen);
+                aStream.Read(pStr->buffer, lUniLen * sizeof(sal_Unicode));
+                rBuffer = OUString(pStr, SAL_NO_ACQUIRE);
+            }
         }
         xWrt->bShowProgress = bOldShowProgress;
     }
diff --git a/sw/source/filter/html/htmlplug.cxx b/sw/source/filter/html/htmlplug.cxx
index 95e8e57..f189dd3 100644
--- a/sw/source/filter/html/htmlplug.cxx
+++ b/sw/source/filter/html/htmlplug.cxx
@@ -1299,7 +1299,8 @@ Writer& OutHTML_FrameFormatOLENodeGrf( Writer& rWrt, const SwFrameFormat& rFrame
                 aMediaDescriptor["FilterOptions"] <<= OUString("SkipHeaderFooter");
                 aMediaDescriptor["OutputStream"] <<= xOutputStream;
                 xStorable->storeToURL("private:stream", aMediaDescriptor.getAsConstPropertyValueList());
-                OString aData(static_cast<const char*>(aStream.GetData()), aStream.GetSize());
+                SAL_WARN_IF(aStream.GetSize()>=static_cast<sal_uInt64>(SAL_MAX_INT32), "sw.html", "Stream can't fit in OString");
+                OString aData(static_cast<const char*>(aStream.GetData()), static_cast<sal_Int32>(aStream.GetSize()));
                 // Wrap output in a <span> tag to avoid 'HTML parser error: Unexpected end tag: p'
                 HTMLOutFuncs::Out_AsciiTag(rWrt.Strm(), OOO_STRING_SVTOOLS_HTML_span);
                 rWrt.Strm().WriteCharPtr(aData.getStr());
diff --git a/tools/qa/cppunit/test_urlobj.cxx b/tools/qa/cppunit/test_urlobj.cxx
index 0c01830..d0cab0a 100644
--- a/tools/qa/cppunit/test_urlobj.cxx
+++ b/tools/qa/cppunit/test_urlobj.cxx
@@ -255,14 +255,14 @@ namespace tools_urlobj
             CPPUNIT_ASSERT(!url.HasError());
             strm = url.getData();
             CPPUNIT_ASSERT(strm != 0);
-            CPPUNIT_ASSERT_EQUAL(sal_uIntPtr(0), strm->GetSize());
+            CPPUNIT_ASSERT_EQUAL(sal_uInt64(0), strm->GetSize());
             strm.reset();
 
             url = INetURLObject("data:,,%C3%A4%90");
             CPPUNIT_ASSERT(!url.HasError());
             strm = url.getData();
             CPPUNIT_ASSERT(strm != 0);
-            CPPUNIT_ASSERT_EQUAL(sal_uIntPtr(4), strm->GetSize());
+            CPPUNIT_ASSERT_EQUAL(sal_uInt64(4), strm->GetSize());
             buf = static_cast<unsigned char const *>(strm->GetData());
             CPPUNIT_ASSERT_EQUAL(0x2C, int(buf[0]));
             CPPUNIT_ASSERT_EQUAL(0xC3, int(buf[1]));
@@ -279,21 +279,21 @@ namespace tools_urlobj
             CPPUNIT_ASSERT(!url.HasError());
             strm = url.getData();
             CPPUNIT_ASSERT(strm != 0);
-            CPPUNIT_ASSERT_EQUAL(sal_uIntPtr(0), strm->GetSize());
+            CPPUNIT_ASSERT_EQUAL(sal_uInt64(0), strm->GetSize());
             strm.reset();
 
             url = INetURLObject("data:;bAsE64,");
             CPPUNIT_ASSERT(!url.HasError());
             strm = url.getData();
             CPPUNIT_ASSERT(strm != 0);
-            CPPUNIT_ASSERT_EQUAL(sal_uIntPtr(0), strm->GetSize());
+            CPPUNIT_ASSERT_EQUAL(sal_uInt64(0), strm->GetSize());
             strm.reset();
 
             url = INetURLObject("data:;base64,YWJjCg==");
             CPPUNIT_ASSERT(!url.HasError());
             strm = url.getData();
             CPPUNIT_ASSERT(strm != 0);
-            CPPUNIT_ASSERT_EQUAL(sal_uIntPtr(4), strm->GetSize());
+            CPPUNIT_ASSERT_EQUAL(sal_uInt64(4), strm->GetSize());
             buf = static_cast<unsigned char const *>(strm->GetData());
             CPPUNIT_ASSERT_EQUAL(0x61, int(buf[0]));
             CPPUNIT_ASSERT_EQUAL(0x62, int(buf[1]));
@@ -315,7 +315,7 @@ namespace tools_urlobj
             CPPUNIT_ASSERT(!url.HasError());
             strm = url.getData();
             CPPUNIT_ASSERT(strm != 0);
-            CPPUNIT_ASSERT_EQUAL(sal_uIntPtr(4), strm->GetSize());
+            CPPUNIT_ASSERT_EQUAL(sal_uInt64(4), strm->GetSize());
             buf = static_cast<unsigned char const *>(strm->GetData());
             CPPUNIT_ASSERT_EQUAL(0x59, int(buf[0]));
             CPPUNIT_ASSERT_EQUAL(0x51, int(buf[1]));
diff --git a/tools/source/stream/stream.cxx b/tools/source/stream/stream.cxx
index da91a21..e1c5b17 100644
--- a/tools/source/stream/stream.cxx
+++ b/tools/source/stream/stream.cxx
@@ -1718,7 +1718,7 @@ const void* SvMemoryStream::GetBuffer()
     return GetData();
 }
 
-sal_uIntPtr SvMemoryStream::GetSize()
+sal_uInt64 SvMemoryStream::GetSize()
 {
     Flush();
     sal_uInt64 const nTemp = Tell();
commit 99628775132143936fcd00ca9e18a853616418e4
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Wed Sep 23 00:44:04 2015 +0200

    sal_uLong to ErrCode
    
    Change-Id: I2b4b2673aa27de664f6c6780e67c70559ec61971

diff --git a/filter/source/msfilter/svxmsbas2.cxx b/filter/source/msfilter/svxmsbas2.cxx
index 42f3436..e2a4ce6 100644
--- a/filter/source/msfilter/svxmsbas2.cxx
+++ b/filter/source/msfilter/svxmsbas2.cxx
@@ -27,10 +27,10 @@
 
 using namespace com::sun::star;
 
-sal_uLong SvxImportMSVBasic::SaveOrDelMSVBAStorage( bool bSaveInto,
+ErrCode SvxImportMSVBasic::SaveOrDelMSVBAStorage( bool bSaveInto,
                                                 const OUString& rStorageName )
 {
-    sal_uLong nRet = ERRCODE_NONE;
+    ErrCode nRet = ERRCODE_NONE;
     uno::Reference < embed::XStorage > xSrcRoot( rDocSh.GetStorage() );
     OUString aDstStgName( GetMSBasicStorageName() );
     tools::SvRef<SotStorage> xVBAStg( SotStorage::OpenOLEStorage( xSrcRoot, aDstStgName,
@@ -62,7 +62,7 @@ sal_uLong SvxImportMSVBasic::SaveOrDelMSVBAStorage( bool bSaveInto,
 
 // check if the MS-VBA-Storage exists in the RootStorage of the DocShell.
 // If it exists, then return the WarningId for losing the information.
-sal_uLong SvxImportMSVBasic::GetSaveWarningOfMSVBAStorage( SfxObjectShell &rDocSh)
+ErrCode SvxImportMSVBasic::GetSaveWarningOfMSVBAStorage( SfxObjectShell &rDocSh)
 {
     uno::Reference < embed::XStorage > xSrcRoot( rDocSh.GetStorage() );
     tools::SvRef<SotStorage> xVBAStg( SotStorage::OpenOLEStorage( xSrcRoot, GetMSBasicStorageName(),
diff --git a/include/filter/msfilter/svxmsbas.hxx b/include/filter/msfilter/svxmsbas.hxx
index 5b549d2..33b26b1 100644
--- a/include/filter/msfilter/svxmsbas.hxx
+++ b/include/filter/msfilter/svxmsbas.hxx
@@ -58,11 +58,11 @@ public:
     // form the ObjectShell
     // - returns a warning code if a modified basic exist, in all other
     //   cases return ERRCODE_NONE.
-    sal_uLong SaveOrDelMSVBAStorage( bool bSaveInto, const OUString& rStorageName );
+    ErrCode SaveOrDelMSVBAStorage( bool bSaveInto, const OUString& rStorageName );
 
     // check if the MS-VBA-Storage exist in the RootStorage of the DocShell.
     // If it exist, then return the WarningId for losing the information.
-    static sal_uLong GetSaveWarningOfMSVBAStorage( SfxObjectShell &rDocS );
+    static ErrCode GetSaveWarningOfMSVBAStorage( SfxObjectShell &rDocS );
 
     static OUString GetMSBasicStorageName();
 private:
diff --git a/sc/source/filter/excel/expop2.cxx b/sc/source/filter/excel/expop2.cxx
index f169716..eb2f567 100644
--- a/sc/source/filter/excel/expop2.cxx
+++ b/sc/source/filter/excel/expop2.cxx
@@ -105,7 +105,7 @@ FltError ExportBiff5::Write()
     else if( pDocShell && xRootStrg.Is() && eVbaExportMode == VBAExportMode::REEXPORT_STREAM )
     {
         SvxImportMSVBasic aBasicImport( *pDocShell, *xRootStrg );
-        sal_uLong nErr = aBasicImport.SaveOrDelMSVBAStorage( true, EXC_STORAGE_VBA_PROJECT );
+        const ErrCode nErr = aBasicImport.SaveOrDelMSVBAStorage( true, EXC_STORAGE_VBA_PROJECT );
         if( nErr != ERRCODE_NONE )
             pDocShell->SetError( nErr, OUString( OSL_LOG_PREFIX ) );
     }
commit d1eb389d7081276bb08f4cf3be16e5301a4c39cb
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sat Sep 19 10:56:57 2015 +0200

    sal_uLong/long to ErrCode
    
    Change-Id: I2ba2d867785765e4850c60070e86419f66e25f57

diff --git a/include/sot/stg.hxx b/include/sot/stg.hxx
index 2c2e7ab..056baf9 100644
--- a/include/sot/stg.hxx
+++ b/include/sot/stg.hxx
@@ -48,7 +48,7 @@ typedef struct SvGUID ClsId;
 class SOT_DLLPUBLIC StorageBase : public SvRefBase
 {
 protected:
-    mutable sal_uLong m_nError;                   // error code
+    mutable ErrCode m_nError;                   // error code
     StreamMode      m_nMode;                    // open mode
     bool            m_bAutoCommit;
                     StorageBase();
@@ -58,8 +58,8 @@ public:
     virtual bool    Validate( bool=false ) const = 0;
     virtual bool    ValidateMode( StreamMode ) const = 0;
     void            ResetError() const;
-    void            SetError( sal_uLong ) const;
-    sal_uLong       GetError() const;
+    void            SetError( ErrCode ) const;
+    ErrCode         GetError() const;
     bool            Good() const          { return bool( m_nError == SVSTREAM_OK ); }
     StreamMode      GetMode() const  { return m_nMode;  }
     void            SetAutoCommit( bool bSet )
diff --git a/include/sot/storage.hxx b/include/sot/storage.hxx
index 316bc41..b51afe4 100644
--- a/include/sot/storage.hxx
+++ b/include/sot/storage.hxx
@@ -86,7 +86,7 @@ friend class SotStorageStream;
 
     BaseStorage *   m_pOwnStg;   // target storage
     SvStream *      m_pStorStm;  // only for SDSTORAGES
-    sal_uLong       m_nError;
+    ErrCode         m_nError;
     OUString        m_aName;     // name of the storage
     bool            m_bIsRoot;   // e.g.: File Storage
     bool            m_bDelStm;
@@ -135,8 +135,8 @@ public:
                             return m_nVersion;
                         }
 
-    sal_uLong           GetError() const { return ERRCODE_TOERROR(m_nError); }
-    void                SetError( sal_uLong nErrorCode )
+    ErrCode             GetError() const { return ERRCODE_TOERROR(m_nError); }
+    void                SetError( ErrCode nErrorCode )
                         {
                             if( m_nError == SVSTREAM_OK )
                                 m_nError = nErrorCode;
diff --git a/sot/source/sdstor/stg.cxx b/sot/source/sdstor/stg.cxx
index 5156525..3ee94cf 100644
--- a/sot/source/sdstor/stg.cxx
+++ b/sot/source/sdstor/stg.cxx
@@ -62,14 +62,14 @@ StorageBase::~StorageBase()
 // The following three methods are declared as const, since they
 // may be called from within a const method.
 
-sal_uLong StorageBase::GetError() const
+ErrCode StorageBase::GetError() const
 {
-    sal_uLong n = m_nError;
+    const ErrCode n = m_nError;
     m_nError = SVSTREAM_OK;
     return n;
 }
 
-void StorageBase::SetError( sal_uLong n ) const
+void StorageBase::SetError( ErrCode n ) const
 {
     if( !m_nError )
         m_nError = n;
@@ -689,7 +689,7 @@ bool Storage::CopyTo( const OUString& rElem, BaseStorage* pDest, const OUString&
 
             if ( p2 )
             {
-                sal_uLong nTmpErr = p2->GetError();
+                ErrCode nTmpErr = p2->GetError();
                 if( !nTmpErr )
                 {
                     p2->SetClassId( p1->GetClassId() );
@@ -718,7 +718,7 @@ bool Storage::CopyTo( const OUString& rElem, BaseStorage* pDest, const OUString&
 
             if ( p2 )
             {
-                sal_uLong nTmpErr = p2->GetError();
+                ErrCode nTmpErr = p2->GetError();
                 if( !nTmpErr )
                 {
                     p1->CopyTo( p2 );
diff --git a/sot/source/sdstor/stgcache.cxx b/sot/source/sdstor/stgcache.cxx
index 0ca0e2d..d3b2ec2 100644
--- a/sot/source/sdstor/stgcache.cxx
+++ b/sot/source/sdstor/stgcache.cxx
@@ -392,7 +392,7 @@ bool StgCache::SetSize( sal_Int32 n )
     return Good();
 }
 
-void StgCache::SetError( sal_uLong n )
+void StgCache::SetError( ErrCode n )
 {
     if( n && !m_nError )
         m_nError = n;
diff --git a/sot/source/sdstor/stgcache.hxx b/sot/source/sdstor/stgcache.hxx
index 05953b9..97cada2 100644
--- a/sot/source/sdstor/stgcache.hxx
+++ b/sot/source/sdstor/stgcache.hxx
@@ -45,7 +45,7 @@ class StgCache
 
     typedef std::vector< rtl::Reference< StgPage > > LRUList;
 
-    sal_uLong m_nError;                       // error code
+    ErrCode m_nError;                         // error code
     sal_Int32 m_nPages;                       // size of data area in pages
     sal_uInt16 m_nRef;                        // reference count
     IndexToStgPage maDirtyPages;            // hash of all dirty pages
@@ -74,9 +74,9 @@ public:
     void  SetStrm( UCBStorageStream* );
     bool  IsWritable()                      { return ( m_pStrm && m_pStrm->IsWritable() ); }
     bool  Good()                            { return m_nError == SVSTREAM_OK; }
-    sal_uLong GetError()                    { return m_nError;    }
+    ErrCode GetError()                      { return m_nError;    }
     void  MoveError( StorageBase& );
-    void  SetError( sal_uLong );
+    void  SetError( ErrCode );
     void  ResetError();
     bool  Open( const OUString& rName, StreamMode );
     void  Close();
diff --git a/sot/source/sdstor/stgio.cxx b/sot/source/sdstor/stgio.cxx
index c73811a4..350d0d6 100644
--- a/sot/source/sdstor/stgio.cxx
+++ b/sot/source/sdstor/stgio.cxx
@@ -127,12 +127,12 @@ bool StgIo::CommitAll()
             if( m_aHdr.Store( *this ) )
             {
                 m_pStrm->Flush();
-                sal_uLong n = m_pStrm->GetError();
+                const ErrCode n = pStrm->GetError();
                 SetError( n );
 #ifdef DBG_UTIL
-                if( n==0 ) ValidateFATs();
+                if( n==SVSTREAM_OK ) ValidateFATs();
 #endif
-                return n == 0;
+                return n == SVSTREAM_OK;
             }
         }
     }
diff --git a/sot/source/sdstor/storage.cxx b/sot/source/sdstor/storage.cxx
index 98fd816..77adacd 100644
--- a/sot/source/sdstor/storage.cxx
+++ b/sot/source/sdstor/storage.cxx
@@ -469,7 +469,7 @@ SotStorage::SotStorage( BaseStorage * pStor )
     }
 
     m_pOwnStg = pStor;
-    sal_uLong nErr = m_pOwnStg ? m_pOwnStg->GetError() : SVSTREAM_CANNOT_MAKE;
+    const ErrCode nErr = m_pOwnStg ? m_pOwnStg->GetError() : SVSTREAM_CANNOT_MAKE;
     SetError( nErr );
     if ( IsOLEStorage() )
         m_nVersion = SOFFICE_FILEFORMAT_50;
diff --git a/sot/source/sdstor/ucbstorage.cxx b/sot/source/sdstor/ucbstorage.cxx
index b2b5efc..878af65 100644
--- a/sot/source/sdstor/ucbstorage.cxx
+++ b/sot/source/sdstor/ucbstorage.cxx
@@ -428,7 +428,7 @@ public:
                                                 // for read/write streams it's a copy into a temporary file
     OUString                    m_aTempURL;     // URL of this temporary stream
     RepresentModes              m_nRepresentMode; // should it be used as XInputStream or as SvStream
-    long                        m_nError;
+    ErrCode                     m_nError;
     StreamMode                  m_nMode;        // open mode ( read/write/trunc/nocreate/sharing )
     bool                        m_bSourceRead;  // Source still contains useful information
     bool                        m_bModified;    // only modified streams will be sent to the original content
@@ -457,7 +457,7 @@ public:
                                                                         // but the writing is done at the end of temporary
                                                                         // pointer position is not changed
     using SvStream::SetError;
-    void                        SetError( sal_uInt32 nError );
+    void                        SetError( ErrCode nError );
     void                        PrepareCachedForReopen( StreamMode nMode );
 };
 
@@ -480,7 +480,7 @@ public:
     ::ucbhelper::Content*       m_pContent;     // the content that provides the storage elements
     ::utl::TempFile*            m_pTempFile;    // temporary file, only for storages on stream
     SvStream*                   m_pSource;      // original stream, only for storages on a stream
-    long                        m_nError;
+    ErrCode                     m_nError;
     StreamMode                  m_nMode;        // open mode ( read/write/trunc/nocreate/sharing )
     bool                        m_bModified;    // only modified elements will be sent to the original content
     bool                        m_bCommited;    // sending the streams is coordinated by the root storage of the package
@@ -524,7 +524,7 @@ public:
                                 }
     UCBStorageElementList_Impl& GetChildrenList()
                                 {
-                                    long nError = m_nError;
+                                    const ErrCode nError = m_nError;
                                     ReadContent();
                                     if ( m_nMode & StreamMode::WRITE )
                                     {
@@ -538,7 +538,7 @@ public:
                                     return m_aChildrenList;
                                 }
 
-    void                        SetError( long nError );
+    void                        SetError( ErrCode nError );
 };
 
 typedef tools::SvRef<UCBStorage_Impl> UCBStorage_ImplRef;
@@ -1038,7 +1038,7 @@ void  UCBStorageStream_Impl::FlushData()
     m_bCommited = true;
 }
 
-void UCBStorageStream_Impl::SetError( sal_uInt32 nErr )
+void UCBStorageStream_Impl::SetError( ErrCode nErr )
 {
     if ( !m_nError )
     {
@@ -1078,7 +1078,7 @@ BaseStorage* UCBStorageStream_Impl::CreateStorage()
     Storage *pStorage = new Storage( *pNewStorageStream, m_bDirect );
 
     // GetError() call cleares error code for OLE storages, must be changed in future
-    long nTmpErr = pStorage->GetError();
+    const ErrCode nTmpErr = pStorage->GetError();
     pStorage->SetError( nTmpErr );
 
     m_bIsOLEStorage = !nTmpErr;
@@ -1882,7 +1882,7 @@ void UCBStorage_Impl::ReadContent()
     }
 }
 
-void UCBStorage_Impl::SetError( long nError )
+void UCBStorage_Impl::SetError( ErrCode nError )
 {
     if ( !m_nError )
     {
diff --git a/svx/source/gallery2/galtheme.cxx b/svx/source/gallery2/galtheme.cxx
index 4e97329..11e78dd 100644
--- a/svx/source/gallery2/galtheme.cxx
+++ b/svx/source/gallery2/galtheme.cxx
@@ -658,7 +658,7 @@ void GalleryTheme::Actualize( const Link<const INetURLObject&, void>& rActualize
         CopyFile( aTmpURL, aInURL );
         KillFile( aTmpURL );
 
-        sal_uIntPtr nStorErr = 0;
+        ErrCode nStorErr = ERRCODE_NONE;
 
         try
         {
@@ -674,7 +674,7 @@ void GalleryTheme::Actualize( const Link<const INetURLObject&, void>& rActualize
             nStorErr = ERRCODE_IO_GENERAL;
         }
 
-        if( !nStorErr )
+        if( nStorErr == ERRCODE_NONE )
         {
             aSvDrawStorageRef.Clear();
             CopyFile( aTmpURL, GetSdvURL() );
commit f8dac0391c4aa6d4d378919326aacd935d7bd462
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Thu Sep 17 23:39:46 2015 +0200

    Use mutable instead of const_cast'ing this
    
    Change-Id: I790cd140166bf0041abebbe0c4d9c15e931628f1

diff --git a/include/sot/stg.hxx b/include/sot/stg.hxx
index 6b6bebe..2c2e7ab 100644
--- a/include/sot/stg.hxx
+++ b/include/sot/stg.hxx
@@ -48,7 +48,7 @@ typedef struct SvGUID ClsId;
 class SOT_DLLPUBLIC StorageBase : public SvRefBase
 {
 protected:
-    sal_uLong       m_nError;                   // error code
+    mutable sal_uLong m_nError;                   // error code
     StreamMode      m_nMode;                    // open mode
     bool            m_bAutoCommit;
                     StorageBase();
diff --git a/sot/source/sdstor/stg.cxx b/sot/source/sdstor/stg.cxx
index 69ecc37..5156525 100644
--- a/sot/source/sdstor/stg.cxx
+++ b/sot/source/sdstor/stg.cxx
@@ -65,19 +65,19 @@ StorageBase::~StorageBase()
 sal_uLong StorageBase::GetError() const
 {
     sal_uLong n = m_nError;
-    const_cast<StorageBase*>(this)->m_nError = SVSTREAM_OK;
+    m_nError = SVSTREAM_OK;
     return n;
 }
 
 void StorageBase::SetError( sal_uLong n ) const
 {
     if( !m_nError )
-        const_cast<StorageBase*>(this)->m_nError = n;
+        m_nError = n;
 }
 
 void StorageBase::ResetError() const
 {
-    const_cast<StorageBase*>(this)->m_nError = SVSTREAM_OK;
+    m_nError = SVSTREAM_OK;
 }
 
 OLEStorageBase::OLEStorageBase( StgIo* p, StgDirEntry* pe, StreamMode& nMode )
commit ed931ff93d6156001fd90da6a58a757f8b006bfe
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Thu Sep 17 22:41:14 2015 +0200

    Reduce #include scope
    
    Change-Id: I0dc8e00d65078ba910516a9b4473988fdbfe2cc1

diff --git a/sc/source/ui/dbgui/asciiopt.cxx b/sc/source/ui/dbgui/asciiopt.cxx
index 2b41ff9..3bbfd6d 100644
--- a/sc/source/ui/dbgui/asciiopt.cxx
+++ b/sc/source/ui/dbgui/asciiopt.cxx
@@ -18,15 +18,10 @@
  */
 
 #include "global.hxx"
-#include "scresid.hxx"
-#include "impex.hxx"
 #include "asciiopt.hxx"
 #include "asciiopt.hrc"
 #include <comphelper/string.hxx>
 #include <osl/thread.h>
-#include <rtl/tencinfo.h>
-#include <unotools/transliterationwrapper.hxx>
-#include "editutil.hxx"
 
 static const sal_Char pStrFix[] = "FIX";
 static const sal_Char pStrMrg[] = "MRG";
diff --git a/sc/source/ui/dbgui/scuiasciiopt.cxx b/sc/source/ui/dbgui/scuiasciiopt.cxx
index 263e460..295edd1 100644
--- a/sc/source/ui/dbgui/scuiasciiopt.cxx
+++ b/sc/source/ui/dbgui/scuiasciiopt.cxx
@@ -19,11 +19,20 @@
 
 #undef SC_DLLIMPLEMENTATION
 
+#include <svx/txencbox.hxx>
+#include <vcl/button.hxx>
+#include <vcl/combobox.hxx>
+#include <vcl/edit.hxx>
+#include <vcl/field.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/lstbox.hxx>
+
 #include "global.hxx"
 #include "scresid.hxx"
 #include "impex.hxx"
 #include "scuiasciiopt.hxx"
 #include "asciiopt.hrc"
+#include "csvtablebox.hxx"
 #include <comphelper/string.hxx>
 #include <osl/thread.h>
 #include <rtl/tencinfo.h>
diff --git a/sc/source/ui/inc/asciiopt.hxx b/sc/source/ui/inc/asciiopt.hxx
index 6099fda..03e5bcf 100644
--- a/sc/source/ui/inc/asciiopt.hxx
+++ b/sc/source/ui/inc/asciiopt.hxx
@@ -20,17 +20,11 @@
 #ifndef INCLUDED_SC_SOURCE_UI_INC_ASCIIOPT_HXX
 #define INCLUDED_SC_SOURCE_UI_INC_ASCIIOPT_HXX
 
-#include <vcl/dialog.hxx>
-#include <vcl/button.hxx>
-#include <vcl/fixed.hxx>
-#include <vcl/lstbox.hxx>
-#include <vcl/combobox.hxx>
-#include <vcl/field.hxx>
-#include <tools/stream.hxx>
-#include <svx/txencbox.hxx>
-#include "csvtablebox.hxx"
+#include <rtl/ustring.hxx>
 #include <i18nlangtag/lang.h>
 
+#include "csvcontrol.hxx"
+
 class ScAsciiOptions
 {
 private:
diff --git a/sc/source/ui/inc/scuiasciiopt.hxx b/sc/source/ui/inc/scuiasciiopt.hxx
index 8eada1a..6851d73 100644
--- a/sc/source/ui/inc/scuiasciiopt.hxx
+++ b/sc/source/ui/inc/scuiasciiopt.hxx
@@ -20,9 +20,23 @@
 #ifndef INCLUDED_SC_SOURCE_UI_INC_SCUIASCIIOPT_HXX
 #define INCLUDED_SC_SOURCE_UI_INC_SCUIASCIIOPT_HXX
 
-#include "asciiopt.hxx"
+#include <vcl/dialog.hxx>
 #include <svx/langbox.hxx>
 
+#include "asciiopt.hxx"
+
+class Button;
+class CheckBox;
+class ComboBox;
+class Edit;
+class FixedText;
+class ListBox;
+class NumericField;
+class RadioButton;
+
+class ScCsvTableBox;
+class SvxTextEncodingBox;
+
 class ScImportAsciiDlg : public ModalDialog
 {
     SvStream*                   mpDatStream;
commit 8544d42fdb049d23bf569e415af64721cb464b16
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Thu Sep 17 08:10:24 2015 +0200

    SAL_WARN_IF ScCsvSplits::Insert exceeds its maximum supported size
    
    and cast size() to sal_uInt32 in ScCsvSplits::Count()
    
    Change-Id: I35de736702a58e82df6fe90396fe748161f1ff8d

diff --git a/sc/source/ui/dbgui/csvsplits.cxx b/sc/source/ui/dbgui/csvsplits.cxx
index aaa0952..aa53a88 100644
--- a/sc/source/ui/dbgui/csvsplits.cxx
+++ b/sc/source/ui/dbgui/csvsplits.cxx
@@ -21,6 +21,8 @@
 
 #include <algorithm>
 
+#include <sal/log.hxx>
+
 bool ScCsvSplits::Insert( sal_Int32 nPos )
 {
     if (nPos < 0)
@@ -31,6 +33,9 @@ bool ScCsvSplits::Insert( sal_Int32 nPos )
     if (aIter != maVec.end() && *aIter == nPos)
         return false;
 
+    SAL_WARN_IF(maVec.size()>=static_cast<std::size_t>(SAL_MAX_UINT32-1),
+                "sc.ui", "ScCsvSplits::Insert: too many elements in vector");
+
     maVec.insert( aIter, nPos );
     return true;
 }
diff --git a/sc/source/ui/inc/csvsplits.hxx b/sc/source/ui/inc/csvsplits.hxx
index 3a07f83..7ab80e3 100644
--- a/sc/source/ui/inc/csvsplits.hxx
+++ b/sc/source/ui/inc/csvsplits.hxx
@@ -68,7 +68,7 @@ public:
 
     /** Returns the number of splits. */
     sal_uInt32                  Count() const
-                                    { return maVec.size(); }
+                                    { return static_cast<sal_uInt32>(maVec.size()); }
     /** Returns the position of the specified split. */
     sal_Int32                   GetPos( sal_uInt32 nIndex ) const;
     /** Returns the position of the specified split. */
commit c3cc574235c7db2214c26860554c725ff3976161
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Thu Sep 17 07:59:00 2015 +0200

    Simplify by early bail-out
    
    Change-Id: I9210db5196e5c40f450e8bedac2ddd9bd2299f9c

diff --git a/sc/source/ui/dbgui/csvsplits.cxx b/sc/source/ui/dbgui/csvsplits.cxx
index 11ed0ba..aaa0952 100644
--- a/sc/source/ui/dbgui/csvsplits.cxx
+++ b/sc/source/ui/dbgui/csvsplits.cxx
@@ -23,24 +23,26 @@
 
 bool ScCsvSplits::Insert( sal_Int32 nPos )
 {
-    bool bValid = (nPos >= 0);
-    if( bValid )
-    {
-        iterator aIter = ::std::lower_bound( maVec.begin(), maVec.end(), nPos );
-        bValid = (aIter == maVec.end()) || (*aIter != nPos);
-        if( bValid )
-            aIter = maVec.insert( aIter, nPos );
-    }
-    return bValid;
+    if (nPos < 0)
+        return false;
+
+    const iterator aIter = ::std::lower_bound( maVec.begin(), maVec.end(), nPos );
+
+    if (aIter != maVec.end() && *aIter == nPos)
+        return false;
+
+    maVec.insert( aIter, nPos );
+    return true;
 }
 
 bool ScCsvSplits::Remove( sal_Int32 nPos )
 {
     sal_uInt32 nIndex = GetIndex( nPos );
-    bool bValid = (nIndex != CSV_VEC_NOTFOUND);
-    if( bValid )
-        maVec.erase( maVec.begin() + nIndex );
-    return bValid;
+    if (nIndex == CSV_VEC_NOTFOUND)
+        return false;
+
+    maVec.erase( maVec.begin() + nIndex );
+    return true;
 }
 
 void ScCsvSplits::RemoveRange( sal_Int32 nPosStart, sal_Int32 nPosEnd )
commit df3682c2981f9212743e84abc6c75f937011cc28
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Thu Sep 17 00:57:04 2015 +0200

    Remove inline specifier for functions defined in class
    
    Change-Id: Ia0fcd51c5c1cfaff86aeaab2919addcce6621322

diff --git a/sc/source/ui/inc/csvsplits.hxx b/sc/source/ui/inc/csvsplits.hxx
index a53be06..3a07f83 100644
--- a/sc/source/ui/inc/csvsplits.hxx
+++ b/sc/source/ui/inc/csvsplits.hxx
@@ -67,12 +67,12 @@ public:
     sal_uInt32                  UpperBound( sal_Int32 nPos ) const;
 
     /** Returns the number of splits. */
-    inline sal_uInt32           Count() const
+    sal_uInt32                  Count() const
                                     { return maVec.size(); }
     /** Returns the position of the specified split. */
     sal_Int32                   GetPos( sal_uInt32 nIndex ) const;
     /** Returns the position of the specified split. */
-    inline sal_Int32            operator[]( sal_uInt32 nIndex ) const
+    sal_Int32                   operator[]( sal_uInt32 nIndex ) const
                                     { return GetPos( nIndex ); }
 
 private:
commit d6e2d2430db084b8c2293d0135d8035a6a8b71c5
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Wed Sep 16 08:39:44 2015 +0200

    Use positioned getToken in ScAsciiOptions::ReadFromString (2)
    
    Change-Id: I1e91aa9da6fa3ead16ee8f7628dd8c44a7540238

diff --git a/sc/source/ui/dbgui/asciiopt.cxx b/sc/source/ui/dbgui/asciiopt.cxx
index c212a64..2b41ff9 100644
--- a/sc/source/ui/dbgui/asciiopt.cxx
+++ b/sc/source/ui/dbgui/asciiopt.cxx
@@ -242,10 +242,11 @@ void ScAsciiOptions::ReadFromString( const OUString& rString )
         {
             pColStart = new sal_Int32[nInfoCount];
             pColFormat = new sal_uInt8[nInfoCount];
-            for (sal_uInt16 nInfo=0; nInfo<nInfoCount; nInfo++)
+            sal_Int32 nP = 0;
+            for (sal_Int32 nInfo=0; nInfo<nInfoCount; ++nInfo)
             {
-                pColStart[nInfo]  = (sal_Int32) aToken.getToken( 2*nInfo, '/' ).toInt32();
-                pColFormat[nInfo] = (sal_uInt8) aToken.getToken( 2*nInfo+1, '/' ).toInt32();
+                pColStart[nInfo]  = aToken.getToken(0, '/', nP).toInt32();
+                pColFormat[nInfo] = static_cast<sal_uInt8>(aToken.getToken(0, '/', nP).toInt32());
             }
         }
         else
commit a9d9b1e00b1cadf2383ad97d4c5f13be344f8832
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Wed Sep 16 08:36:05 2015 +0200

    Use positioned getToken in ScAsciiOptions::ReadFromString (1)
    
    Change-Id: I59f1ff177e197db07ac9a9a33487d04c2a5e768e

diff --git a/sc/source/ui/dbgui/asciiopt.cxx b/sc/source/ui/dbgui/asciiopt.cxx
index 2c8a46e..c212a64 100644
--- a/sc/source/ui/dbgui/asciiopt.cxx
+++ b/sc/source/ui/dbgui/asciiopt.cxx
@@ -197,49 +197,45 @@ static OUString lcl_decodeSepString( const OUString & rSepNums, bool & o_bMergeF
 
 void ScAsciiOptions::ReadFromString( const OUString& rString )
 {
-    sal_Int32 nCount = comphelper::string::getTokenCount(rString, ',');
-    OUString aToken;
+    sal_Int32 nPos = rString.isEmpty() ? -1 : 0;
 
-    // Field separator.
-    if ( nCount >= 1 )
+    // Token 0: Field separator.
+    if ( nPos >= 0 )
     {
         bFixedLen = bMergeFieldSeps = false;
 
-        aToken = rString.getToken(0,',');
+        const OUString aToken = rString.getToken(0, ',', nPos);
         if ( aToken == pStrFix )
             bFixedLen = true;
         aFieldSeps = lcl_decodeSepString( aToken, bMergeFieldSeps);
     }
 
-    // Text separator.
-    if ( nCount >= 2 )
+    // Token 1: Text separator.
+    if ( nPos >= 0 )
     {
-        aToken = rString.getToken(1,',');
-        sal_Int32 nVal = aToken.toInt32();
-        cTextSep = (sal_Unicode) nVal;
+        const sal_Int32 nVal = rString.getToken(0, ',', nPos).toInt32();
+        cTextSep = static_cast<sal_Unicode>(nVal);
     }
 
-    // Text encoding.
-    if ( nCount >= 3 )
+    // Token 2: Text encoding.
+    if ( nPos >= 0 )
     {
-        aToken = rString.getToken(2,',');
-        eCharSet = ScGlobal::GetCharsetValue( aToken );
+        eCharSet = ScGlobal::GetCharsetValue( rString.getToken(0, ',', nPos) );
     }
 
-    // Number of start row.
-    if ( nCount >= 4 )
+    // Token 3: Number of start row.
+    if ( nPos >= 0 )
     {
-        aToken = rString.getToken(3,',');
-        nStartRow = aToken.toInt32();
+        nStartRow = rString.getToken(0, ',', nPos).toInt32();
     }
 
-    // Column info.
-    if ( nCount >= 5 )
+    // Token 4: Column info.
+    if ( nPos >= 0 )
     {
         delete[] pColStart;
         delete[] pColFormat;
 
-        aToken = rString.getToken(4,',');
+        const OUString aToken = rString.getToken(0, ',', nPos);
         sal_Int32 nSub = comphelper::string::getTokenCount(aToken, '/');
         nInfoCount = nSub / 2;
         if (nInfoCount)
@@ -259,25 +255,22 @@ void ScAsciiOptions::ReadFromString( const OUString& rString )
         }
     }
 
-    // Language
-    if (nCount >= 6)
+    // Token 5: Language.
+    if (nPos >= 0)
     {
-        aToken = rString.getToken(5, ',');
-        eLang = static_cast<LanguageType>(aToken.toInt32());
+        eLang = static_cast<LanguageType>(rString.getToken(0, ',', nPos).toInt32());
     }
 
-    // Import quoted field as text.
-    if (nCount >= 7)
+    // Token 6: Import quoted field as text.
+    if (nPos >= 0)
     {
-        aToken = rString.getToken(6, ',');
-        bQuotedFieldAsText = aToken == "true";
+        bQuotedFieldAsText = rString.getToken(0, ',', nPos) == "true";
     }
 
-    // Detect special numbers.
-    if (nCount >= 8)
+    // Token 7: Detect special numbers.
+    if (nPos >= 0)
     {
-        aToken = rString.getToken(7, ',');
-        bDetectSpecialNumber = aToken == "true";
+        bDetectSpecialNumber = rString.getToken(0, ',', nPos) == "true";
     }
     else
         bDetectSpecialNumber = true;    // default of versions that didn't add the parameter
commit 1353be80b6770c3d48c607e18a1093b6955c7356
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Tue Sep 15 00:05:49 2015 +0200

    Use getToken with start position in lcl_decodeSepString
    
    Change-Id: I16fba233346b807a4c216da70a71e66f2bb0e0a3

diff --git a/sc/source/ui/dbgui/asciiopt.cxx b/sc/source/ui/dbgui/asciiopt.cxx
index 931feba..2c8a46e 100644
--- a/sc/source/ui/dbgui/asciiopt.cxx
+++ b/sc/source/ui/dbgui/asciiopt.cxx
@@ -171,10 +171,13 @@ bool ScAsciiOptions::operator==( const ScAsciiOptions& rCmp ) const
 static OUString lcl_decodeSepString( const OUString & rSepNums, bool & o_bMergeFieldSeps )
 {
     OUString aFieldSeps;
-    sal_Int32 nSub = comphelper::string::getTokenCount( rSepNums, '/');
-    for (sal_Int32 i=0; i<nSub; ++i)
+    if ( rSepNums.isEmpty() )
+        return aFieldSeps;
+
+    sal_Int32 nPos = 0;
+    do
     {
-        OUString aCode = rSepNums.getToken( i, '/' );
+        const OUString aCode = rSepNums.getToken( 0, '/', nPos );
         if ( aCode == pStrMrg )
             o_bMergeFieldSeps = true;
         else
@@ -184,6 +187,8 @@ static OUString lcl_decodeSepString( const OUString & rSepNums, bool & o_bMergeF
                 aFieldSeps += OUString((sal_Unicode) nVal);
         }
     }
+    while ( nPos >= 0 );
+
     return aFieldSeps;
 }
 


More information about the Libreoffice-commits mailing list